Transfer
Tokens and parameters are compiled in the same way as for other chains:
const sdk = new PixelBridgeCoreSdk(nodeRpcUrlsDefault);
const chainDetailsMap = await sdk.chainDetailsMap();
const sourceToken = chainDetailsMap[ChainSymbol.SRB].tokens.find((t) => t.symbol == "USDT");
const destinationToken = chainDetailsMap[ChainSymbol.ETH].tokens.find((t) => t.symbol == "USDT");
const amount = "2";
const sendParams: SendParams = {
amount,
fromAccountAddress: fromAddress,
toAccountAddress: toAddress,
sourceToken,
destinationToken,
messenger: Messenger.PixelBridge,
extraGas: "1.15",
extraGasFormat: AmountFormat.FLOAT,
gasFeePaymentMethod: FeePaymentMethod.WITH_STABLECOIN,
};
const xdrTx: string = (await sdk.bridge.rawTxBuilder.send(sendParams)) as string;Simulate the transaction before sending it. If some data is archived on Stellar, you have to restore it before sending the transaction. The simulation method can return a restore transaction, in this case, you have to send it first:
Then you have to send the main transaction. Please note that if you send a restore transaction before, the transaction sequence will be changed, and you have to recompile it:
Finally, if you make a transfer to Stellar, you have to ensure that you have trustlines for the destination token. Use the example below to check for the trustline/create it:
Last updated