1

I created an anchor account which issues USD asset. It worked properly. But now when I modify the program where the anchor issues one more asset called INR and I am creating a trustline for both the assets in one transaction builder, it fails.

Error

data:
      { type: 'https://stellar.org/horizon-errors/transaction_failed',
        title: 'Transaction Failed',
        status: 400,
        detail: 'The transaction failed when submitted to the stellar network. The `extras.result_codes` field on this response contains further details.  Descriptions of each code can be found at: https://www.stellar.org/developers/learn/concepts/list-of-operations.html',
        extras: [Object] } } }
failure Error: Request failed with status code 400
Error: Request failed with status code 400
    at createError (C:\Users\Siddharth\Desktop\SID\exelis\stellar-sid\new\copy\demo\node_modules\axios\lib\core\createError.js:16:15)
    at settle (C:\Users\Siddharth\Desktop\SID\exelis\stellar-sid\new\copy\demo\node_modules\axios\lib\core\settle.js:18:12)
    at IncomingMessage.handleStreamEnd (C:\Users\Siddharth\Desktop\SID\exelis\stellar-sid\new\copy\demo\node_modules\axios\lib\adapters\http.js:201:11)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1056:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickDomainCallback (internal/process/next_tick.js:218:9)

Code

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

const account = await stellarServer.loadAccount(accountKeypair.publicKey())
const transaction = new TransactionBuilder(account)
  .addOperation(
    Operation.changeTrust({
      asset: AnchorXUSD
    }))
  .addOperation(
    Operation.changeTrust({
      asset: AnchorXINR
    }))  
  .build();

transaction.sign(accountKeypair)

const result = await stellarServer.submitTransaction(transaction)
0

For each change trust transaction you need to specify the asset code and the issuer id. I think issuer id not included in your transaction.

0

Have you tried looking inside extras.result_codes as the error message suggests? The exact reason of why your transaction failed is documented there. In your case it is probably because you did not provide the public key of the account issuer of the assets.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.