Skip to content

Add priority fee when creating Stellar intent transaction #19

@hetfly

Description

@hetfly

Some intents are not created and transactions are being timed out / not being included in the blockchain.

To avoid this, please add priority fee to the transaction.

example of adding priority fee (the optimal amount is likely different, I haven't tested it):

  // Build your transaction
  const transaction = new TransactionBuilder(sourceAccount, {
    fee: '100', // Default fee
    networkPassphrase: Networks.TESTNET
  })
  .addOperation(/* your operation */)
  .setTimeout(30)
  .build();

  // Simulate first
  const simulation = await server.simulateTransaction(transaction);
  
  // Get the minimum resource fee required
  const minResourceFee = simulation.minResourceFee;
  
  // Set a higher fee for priority (base fee + resource fee + priority boost)
  const priorityFee = '10000'; // Higher priority fee in stroops
  const totalFee = (BigInt(priorityFee) + BigInt(minResourceFee)).toString();
  
  // Rebuild transaction with the higher fee
  const priorityTransaction = new TransactionBuilder(sourceAccount, {
    fee: totalFee,
    networkPassphrase: Networks.TESTNET
  })
  .addOperation(/* your operation */)
  .setTimeout(30)
  .build();
  
  // Sign and submit
  // ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions