const fs = require('fs').promises
var [pairA, pairB] = require('./pairs.json')

const StellarSdk = require('stellar-sdk')
StellarSdk.Network.useTestNetwork()

const server = new StellarSdk.Server('https://horizon-testnet.stellar.org')

const accountA = server.loadAccount(pairA.publicKey).then(function(i){
return i
})

let transaction = new StellarSdk.TransactionBuilder(accountA)
.addOperation(StellarSdk.Operation.createAccount({
destination: "GBNVD6L2GKXWIOEDW44VHHPPHOLXOUQZR6BWRUXHELDVLJ4LG6NJ2II5",
startingBalance: "2.5000000"
}))
.addMemo(StellarSdk.Memo.text('Test Transaction'))
.build();
transaction.sign(pairA.publicKey);
return horizonServer.submitTransaction(transaction);

var sequenceNumber = new BigNumber(this.source.sequenceNumber()).add(1); error

    muthyalaDivyaVenkatesh It would be really helpful to provide more context to this. Where are you running this code and is there a stacktrace?

    muthyalaDivyaVenkatesh not much info in the question about the error but looks like several issues:

    1) The js sdk automatically increments the sequence number so your last line is not necessary.

    2) if you do want to mess with sequence number my guess is this.source.sequenceNumber() is causing your problem, I'd expect this.source to be accountA instead

    3) transaction.sign needs a private key

    4) async problem with loadAccount - accountA will be null at TransactionBuilder(accountA) because loadAccount is async. You prob want something like: const accountA = await server.loadAccount(pairA.publicKey)