I am following this question answer Trying to implement the answer BUt my transaction is getting failed. Am i doing any mistakes in the implementation part?

  var sendr = Stellar.Keypair.fromSecret('SA43Z6BF57K6SQNN3ZWPSTVZR6QQWVK4ORUJWG5BEBPH4VKFQIQGJ5M3');


   // Create an object to represent the new asset

 .then(function(issuer) {

  var preAuthTx = new Stellar.TransactionBuilder(issuer, opts={fee:1}, issuer.sequence=issuer.sequence+2, timebounds= { minTime: 1560763800})
    destination: receivr,
    asset: fnew,
    amount: '20'
       asset: fnew,
      limit: '0'
    destination: receivr

  var transaction = new Stellar.TransactionBuilder(issuer, opts={fee:1})
  signer: {
      preAuthTx: preAuthTx.hash(),
      weight: 1
masterWeight: 0

  // setTimeout is required for a transaction
  return server.submitTransaction(transaction);
    .then(function(result) {
console.log('Successin sending assets', result);
 .catch(function(error) {
console.error('Error in sending assets', error);
  • At a quick glance: changeTrust expects asset, limit, [source] as parameters, so that surely won't work. Besides console.log(error.response.data.extras); will give you more insight to errors.
    – sui
    Jun 17 '19 at 18:11
  • @sui thanks for picking out changeTrust limit thing. i have corrected it. in the response it is showing "tx_bad_seq" error.
    – Suman Raj
    Jun 18 '19 at 5:37
  • your pre-auth tx needs to have a higher sequence number than the tx you use do add it as a signer, since the pre-auth tx will be submitted to the network after it. Jun 20 '19 at 8:59

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.