Stellar channel implementation is giving an error "this.source.sequenceNumber is not a function"
Stellar channel implementation is giving an error "this.source.sequenceNumber is not a function"
Loading saved threads...
Suman Raj · External communityPost link
External question — Stellar Stack Exchange
Author: Suman Raj
Original post: https://stellar.stackexchange.com/questions/2701
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
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.
Quote
Report
configbug · External communityPost link
External answer — Stellar Stack Exchange
Author: configbug
Original post: https://stellar.stackexchange.com/a/4370
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
This is failing you because TransactionBuilder expects an AccountResponse as an argument.
Try the following:
const server = new Server(urlStellar);
const accountIssuer = (publicKey) => await server.loadAccount(publicKey);
...
new Stellar.TransactionBuilder(accountIssuer(i), opts={fee:100})
...
Quote
Report
Post Reply
Quoted from Forex.com.bd-Editorial External answer — Stellar Stack Exchange Author: configbug Source score (net votes, not local likes): 0 Original post: https://stellar.stackexchange.com/a/4370 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. This is failing you because TransactionBuilder expects an AccountResponse as an argument. Try the following: const server = new Server(urlStellar); const accountIssuer = (publicKey) => await server.loadAccount(publicKey); ... new Stellar.TransactionBuilder(accountIssuer(i), opts={fee:100}) ...
Checking account access…