I am trying to implement the concept of channels in my stellar project. I have refered https://www.stellar.org/developers/guides/channels.html this link.
As it is said that, the source account of the transaction pays the fee and consumes a sequence number. You can then use one common account (your base account) to make the payment operation inside each transaction. The various channel accounts will consume their sequence numbers even though the funds are being sent from your base account.
But in our case, the transaction fees is been deducted from the channel account and not from source account.
Source code is given below
const indexNumber = getRandomInt(1);
const channelAccountInfo = await server.loadAccount(
channelAccount[indexNumber]
);
server
.loadAccount(baseAccountPublicKey)
.then(baseAccountPublicKey => {
StellarSdk.Network.usePublicNetwork();
var transaction = new
StellarSdk.TransactionBuilder(channelAccountInfo)
.addOperation(
StellarSdk.Operation.payment({
source: baseAccountPublicKey,
destination: destAcct,
asset: StellarSdk.Asset.native(),
amount: amountToTransfer
})
)
.setTimeout(5000)
.build();
transaction.sign(
StellarSdk.Keypair.fromSecret(baseAccountSecretKey)
);
transaction.sign(
StellarSdk.Keypair.fromSecret(channelSecretKey[indexNumber])
);
return server.submitTransaction(transaction);
});
Please give your valuable feedback, if I am doing something wrong
Thanks In advance