2

i am trying to implement stellar channel concept. i am following stellar channel link. I have created 6 channel accounts. Below is the programme i wrote

  var destinationId = 'GAUPCAM7YQI2BN2TIOA2IOHMPE23K6YZ6Q5QUEF4DTM4YTKFX3JMADEG';

  var channelAccounts = ['GAG7OGDHWA2RVAEHD6MV7MVCOATRG7YWYCA6533Y36PQNMJBQWHFZOGW','GAUPCAM7YQI2BN2TIOA2IOHMPE23K6YZ6Q5QUEF4DTM4YTKFX3JMADEG','GB3CMNVTI2H24L7TKOZCA5GJCXMM4BBPB7UKB5CN4AJZBDRWCXD7RN6A','GAPMCTHFEOMNXAXGW5UILKVWRECGH22AXS2NTEKCRWLFQVNSWPCXSKUG','GBBSPONG4CFEKM2MDB7Y325BNTGZAFPWELTIYUJ5CVQW2HOYZIHF4D52','GD6BCIBPQHILVDV42ON7IMHP7B5A7VI6TSNFXHX7WRHHPXTEZXOQSOHM'];
  var channelKeys = ['SBKHUQVZWUEVC35WCAM77BESEER5GVSUMGMIWZ7O5QOJL4AGPJN2KCA5','SBA6L6NEG4YLMEFGRVQKG2UGFDDKCJSK5V7E4TUO37MISGDPXKY4ZPNS','SAOVQVRZXBXZMXUHLCCT6SJXMTJFPITL7QCMXWYP7CRKWLE47OXN3WGG','SDKW7JR4FGQEWTU62QDB6ICWE3FNHUBWXWLQ6J7E7ZWI5RZVYYH6243A','SCR3RUVRQ4DNK7RIHKZL5REE3SL27HHM4ENIRTNC5GDDUMRNRKJH2RTF','SBBW76A7FO5XQA7IUAJMWWJ3TVIW25X4CMVMVBCGSJP2L3MJV6MRCXBW'];
  var i=0;
  var len=0;
  var sourceKeys = Stellar.Keypair.fromSecret('SDJ5AQWLIAYT22TCYSKOQALI3SNUMPAR63SEL73ASALDP6PYDN54FARM');
  for (i = 0, len = channelAccounts.length; i < len; i++) {
  var transaction =
  new Stellar.TransactionBuilder(channelAccounts[i], opts={fee:100})
    .addOperation(Stellar.Operation.payment({
      source: sourceKeys.publicKey(),
      destination: destinationId,
      asset: Stellar.Asset.native(),
      amount: "1"
    }))
    // Wait a maximum of three minutes for the transaction
    .setTimeout(180)
    .build();

  transaction.sign(sourceKeys);   // base account must sign to approve the payment
  transaction.sign(channelKeys[i]);  // channel must sign to approve it being the source of the transaction
  }

BUT this is giving me an error

 var sequenceNumber = new _bignumber2.default(this.source.sequenceNumber()).add(1);
                                                           ^
TypeError: this.source.sequenceNumber is not a function

I dont know where i am doing wrong.

  • Are you sure this is a method and not a field? – Rob Sep 12 at 0:08
  • @Rob This line channelAccounts[i] in transactionbuilder need to be generate from Stellar.Keypair.fromSecret('corresponding private key'). That's how we will solve that issue – Suman Raj Sep 13 at 5:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.