πΉSample Transactions
Sample transactions for all types of transactions in basic API
Overview
Here are some samples of the transaction object that is created in swap method. Rango currently returns 6 different types of transactions based on the blockchain that the transaction is happening on. This includes:
EVM: For all EVM-based blockchains, including Ethereum, Polygon, Avalanche, etc.
COSMOS: For all the cosmos-based networks, including the Cosmos itself, Osmosis, Akash, Thorchain, Maya and etc.
TRANSFER: For UTXO blockchains, including Bitcoin, Litecoin, Doge, etc.
SOLANA: For Solana transactions.
TRON: For Tron Transactions.
STARKNET: For Starknet transactions.
SUI: For SUI transactions.
XRPL: For XRPL transactions.
Let's see some examples here.
EVM Sample Transaction: (Test)
Here is the structure of an EVM transaction in the code below.
If the user does not have a sufficient approval amount for the transaction, the data for the approval transaction will be included in the approveData and approveTo fields. In this case, the user needs to sign the approval transaction first, ensure he has enough approval, and then signs the main transaction. However, if the approveData and approveTo fields are null, it indicates that the user already has enough approval for this quote and can directly sign the main transaction.
COSMOS Sample Transaction:
For Cosmos based blockchains, we have two type of transactions based on signType field: AMINO and DIRECT.
Cosmos Amino Sample Transaction: (Test)
Cosmos Direct Sample Transaction: (Test)
This type is only used in limited swappers like WYNDDex (and Juno Blockchain) and we are going to deprecate support for Cosmos Direct transaction types whenever possible. You could sign this type of transactions using Stargate Client library.
Transfer Sample Transaction: (Test)
Here is the structure of an UTXO (Transfer) transaction:
Tron Sample Transaction: (Test)
Here is the structure of a Tron transaction. Similar to EVM transactions, if user doesn't have enough approval for this quote, he needs to sign approve transaction first based on approve_payload, approve_raw_data, and approve_raw_data_hex fields and then sign the main transaction.
Starknet Sample Transaction: (Test)
Here is the structure of a Starknet transaction. Similar to EVM transactions, if user doesn't have enough approval for this quote, he needs to sign approve transaction first based on approveCalls field first and then sign the main transaction.
Solana Sample Transaction: (Test)
Base64 Encoding
Remember to broadcast the signed transaction to Solana RPCs with base64 encoding. The base58 encoding is deprecated, but it is still the default method in Solana docs.
SUI Sample Transaction: (Test)
XRPL Sample Transaction: (Test)
Last updated
Was this helpful?