πΉSample Transactions
Sample transactions for all types of transactions in main API
Overview
Here are some samples of the transaction object that is created in create transaction 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.
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 lacks sufficient approval for the transaction, the create transaction method will respond with an approval transaction. (isApproval
field is true
in this case.) The user must first sign this approval transaction to ensure they have the necessary approval. Then, they should call the create transaction method again to obtain and sign the main transaction. The fields and schema for the approval and main transactions are identical.
"transaction": {
"type": "EVM",
"blockChain": "BSC",
"isApprovalTx": true,
"from": "0x7abac41d46857b0b6c4d67eb966b4a29ba69b4f3",
"to": "0xe9e7cea3dedca5984780bafc599bd69add087d56",
"data": "0x095ea7b300000000000000000000000069460570c93f9de5e2edbc3052bf10125f0ca22d000000000000000000000000000000000000000000000000000775f05a074000",
"value": null,
"gasLimit": "0x12284",
"gasPrice": "1100000000",
"maxPriorityFeePerGas": null,
"maxFeePerGas": null,
"nonce": null
}
Sample for non-approval:
"transaction": {
"type": "EVM",
"blockChain": "BSC",
"isApprovalTx": false,
"from": "0xccf3d872b01762aba74b41b1958a9a86ee8f34a2",
"to": "0x69460570c93f9DE5E2edbC3052bf10125f0Ca22d",
"data": "0xb17d0e6e000000000000000000000000000000002358d41a5a8f4afa87403e161e2955e900000000000000000000000055d398326f99059ff775485246999027b3197955000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000081fe9fae05d8094c0000000000000000000000000000000000000000000000000031fe30556285140000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037f73c93f73fac000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000ccf3d872b01762aba74b41b1958a9a86ee8f34a3000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000001b81d678ffb9c0263b24a97847620c99d213eb140000000000000000000000001b81d678ffb9c0263b24a97847620c99d213eb1400000000000000000000000055d398326f99059ff775485246999027b31979550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000081fe9fae05d8094c00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000264ac9650d800000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000124c04b8d59000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000190ff9d543500000000000000000000000000000000000000000000000081fe9fae05d8094c0000000000000000000000000000000000000000000000000037f4872b410e24000000000000000000000000000000000000000000000000000000000000002b55d398326f99059ff775485246999027b31979550001f4bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004449404b7c0000000000000000000000000000000000000000000000000037f73c93f73fac00000000000000000000000069460570c93f9de5e2edbc3052bf10125f0ca22d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"value": null,
"gasLimit": "0x91bc6",
"gasPrice": "1100000000",
"maxPriorityFeePerGas": null,
"maxFeePerGas": null,
"nonce": null
}
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)
{
"type": "COSMOS",
"fromWalletAddress": "osmo1unf2rcytjxfpz8x8ar63h4qeftadptg5t0nqcl",
"blockChain": "OSMOSIS",
"data": {
"chainId": "osmosis-1",
"account_number": 102721,
"sequence": "892",
"msgs": [
{
"type": "wasm/MsgExecuteContract",
"value": {
"sender": "osmo1unf2rcytjxfpz8x8ar63h4qeftadptg5t0nqcl",
"contract": "osmo1clp46dz247hck0ns5jkv49hqzg8x0vh5hsx8yfvk6w87hnvc6hgs563ew3",
"msg": {
"swap_and_action": {
"user_swap": {
"swap_exact_asset_in": {
"swap_venue_name": "osmosis-poolmanager",
"operations": [
{
"pool": "1464",
"denom_in": "uosmo",
"denom_out": "ibc/498A0751C798A0D9A389AA3691123DADA57DAA4FE165D5C75894505B876BA6E4"
},
{
"pool": "1838",
"denom_in": "ibc/498A0751C798A0D9A389AA3691123DADA57DAA4FE165D5C75894505B876BA6E4",
"denom_out": "ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2"
}
]
}
},
"min_asset": {
"native": {
"denom": "ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2",
"amount": "74944"
}
},
"timeout_timestamp": 1722276105002000000,
"post_swap_action": {
"transfer": {
"to_address": "osmo1unf2rcytjxfpz8x8ar63h4qeftadptg5t0nqcl"
}
},
"affiliates": []
}
},
"funds": [
{
"denom": "uosmo",
"amount": "1000000"
}
]
}
}
],
"protoMsgs": [
{
"type_url": "/cosmwasm.wasm.v1.MsgExecuteContract",
"value": [
10,
43,
111,
// ...
]
}
],
"memo": "",
"source": null,
"fee": {
"gas": "2000000",
"amount": [
{
"denom": "uosmo",
"amount": "50000"
}
]
},
// Sign type, could be AMINO or DIRECT
"signType": "AMINO",
"rpcUrl": "https://osmosis-rpc.polkachu.com"
},
// @deprecated An alternative to CosmosMessage object for the cosmos wallets
"rawTransfer": null
}
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.
"transaction": {
"type": "COSMOS",
"fromWalletAddress": "juno1unf2rcytjxfpz8x8ar63h4qeftadptg54xrtf3",
"blockChain": "JUNO",
"data": {
"chainId": "juno-1",
"account_number": 125507,
"sequence": "309",
"msgs": [
{
"typeUrl": "/cosmwasm.wasm.v1.MsgExecuteContract",
"value": {
"sender": "juno1unf2rcytjxfpz8x8ar63h4qeftadptg54xrtf3",
"contract": "juno1pctfpv9k03v0ff538pz8kkw5ujlptntzkwjg6c0lrtqv87s9k28qdtl50w",
"msg": "eyJleGVjdXRlX3N3YXBfb3BlcmF0aW9ucyI6eyJvcGVyYXRpb25zIjpbeyJ3eW5kZXhfc3dhcCI6eyJhc2tfYXNzZXRfaW5mbyI6eyJuYXRpdmUiOiJpYmMvQzRDRkY0NkZENkRFMzVDQTRDRjRDRTAzMUU2NDNDOEZEQzlCQTRCOTlBRTU5OEU5QjBFRDk4RkUzQTIzMTlGOSJ9LCJvZmZlcl9hc3NldF9pbmZvIjp7Im5hdGl2ZSI6InVqdW5vIn19fV0sIm1heF9zcHJlYWQiOiIwLjAxIn19",
"funds": [
{
"denom": "ujuno",
"amount": "1000000"
}
]
}
}
],
"protoMsgs": [],
"memo": "",
"source": null,
"fee": {
"gas": "1000000",
"amount": [
{
"denom": "ujuno",
"amount": "2500"
}
]
},
// Sign type, could be AMINO or DIRECT
"signType": "DIRECT",
"rpcUrl": "https://rpc-juno.itastakers.com:443/"
},
// @deprecated An alternative to CosmosMessage object for the cosmos wallets
"rawTransfer": null
}
Transfer Sample Transaction: (Test)
Here is the structure of an UTXO (Transfer) transaction:
"transaction": {
// This field equals to TRANSFER for all UTXO Transactions
"type": "TRANSFER",
// The method that should be passed to wallet including deposit, transfer
"method": "transfer",
// Source wallet address that can sign this transaction
"fromWalletAddress": "bc1qagtumlttplyp93fnxndkkcf80ladl4gpnmv25u",
// Destination wallet address that the fund should be sent to
"recipientAddress": "bc1qeqc7py84yjrtc3cnfnjx9p9xyvjm8887kexdfu",
// The memo of transaction, can be null
"memo": "=:ETH.ETH:0x6f33bb1763eebead07cf8815a62fcd7b30311fa3:1080176077:rg:0",
// The machine-readable amount of transaction
"amount": "1000000000",
// The decimals of the asset
"decimals": 8,
// An asset with its ticker
"asset": {
"blockchain": "BTC",
"symbol": "BTC",
"address": null,
"ticker": "BTC"
},
// list of available utxo for wallet address
"utxo": [
{
"txId": "dcc7dda1e5e2b33c649cb851e8290ff8ef41401db5946703cabee4b6cd9f163b",
"index": 0,
"script": "0014ea17cdfd6b0fc812c53334db6b61277ffadfd501",
"value": "2495200",
"blockHeight": "882563"
},
{
"txId": "6c9bf5dc24810010656635a95e5e4ce274dd76998d6733297b0cd0bc68c27a07",
"index": 1,
"script": "0014ea17cdfd6b0fc812c53334db6b61277ffadfd501",
"value": "655",
"blockHeight": "882419"
}
],
// Partially signed bitcoin transaction
"psbt": {
"unsignedPsbtBase64": "cHNidP8BAH0CAAAAAdeeknt27QIuENUtqyEuDWKi0HjMR6J8OyFIH0AeCowYAAAAAAD/////AoCWmAAAAAAAIlEgD5gCxhBANQBrbG92Di7Y0wPGEgBXxa9K7mVT0IIvONIM+SMCAAAAABYAFOoXzf1rD8gSxTM022thJ3/639UBAAAAAAABAR9QkbwCAAAAABYAFOoXzf1rD8gSxTM022thJ3/639UBAAAA",
"inputsToSign": [
{
"address": "bc1qagtumlttplyp93fnxndkkcf80ladl4gpnmv25u",
"signingIndexes": [
0
]
}
]
}
}
Tron Sample Transaction: (Test)
Here is the structure of a Tron transaction. Similar to EVM transactions, it can be either an approval transaction or a main transaction, depending on the isApproval
field
{
"type": "TRON",
"blockChain": "TRON",
"isApprovalTx": false,
"raw_data": {
"contract": [
{
"parameter": {
"value": {
"data": "b24ebddb000000000000000000000000000000000000000000000000000000000002091100000000000000000000000000000000000000000000000000000190ffaa951100000000000000000000000000000000000000000000000000000000000f4240",
"owner_address": "413a51fc0bc19accbea62fac65bad2660bbcffd08a",
"contract_address": "41a2726afbecbd8e936000ed684cef5e2f5cf43008",
"call_value": 1000000
},
"type_url": "type.googleapis.com/protocol.TriggerSmartContract"
},
"type": "TriggerSmartContract"
}
],
"ref_block_bytes": "af01",
"ref_block_hash": "e4752a1cdaf3e944",
"expiration": 1722276345000,
"fee_limit": 1500000000,
"timestamp": 1722276287817
},
"raw_data_hex": "0a02af012208e4752a1cdaf3e94440a8e9adfd8f325ad301081f12ce010a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e74726163741298010a15413a51fc0bc19accbea62fac65bad2660bbcffd08a121541a2726afbecbd8e936000ed684cef5e2f5cf4300818c0843d2264b24ebddb000000000000000000000000000000000000000000000000000000000002091100000000000000000000000000000000000000000000000000000190ffaa951100000000000000000000000000000000000000000000000000000000000f424070c9aaaafd8f32900180dea0cb05",
"externalTxId": null,
"__payload__": {
"owner_address": "413a51fc0bc19accbea62fac65bad2660bbcffd08a",
"call_value": 1000000,
"contract_address": "41a2726afbecbd8e936000ed684cef5e2f5cf43008",
"fee_limit": 1500000000,
"function_selector": "trxToTokenSwapInput(uint256,uint256,uint256)",
"parameter": "000000000000000000000000000000000000000000000000000000000002091100000000000000000000000000000000000000000000000000000190ffaa951100000000000000000000000000000000000000000000000000000000000f4240",
"chainType": 0
},
"txID": "10d1428e0ccc8870b9334d73da2313cfaff29ec27930e68a6947ea8bb1d6b181",
"visible": false
}
Starknet Sample Transaction: (Test)
Here is the structure of a Starknet transaction. Like EVM transactions, it can be either an approval transaction or a main transaction, depending on the isApproval
field. Whenever possible, in Starknet, we batch the approval and main transactions into a single transaction using the calls
array, as shown in the example below.
"transaction": {
"type": "STARKNET",
"blockChain": "STARKNET",
"calls": [
{
"contractAddress": "0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
"entrypoint": "approve",
"calldata": [
"0x4270219d365d6b017231b52e92b3fb5d7c8378b05e9abc97724537a80e93b0f",
"0x00000000000000000ddb6275b03a4000",
"0x00000000000000000000000000000000"
]
},
{
"contractAddress": "0x4270219d365d6b017231b52e92b3fb5d7c8378b05e9abc97724537a80e93b0f",
"entrypoint": "multi_route_swap",
"calldata": [
"0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
"0xddb6275b03a4000",
"0x0",
// ...
]
},
{
"contractAddress": "0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
"entrypoint": "transfer",
"calldata": [
"0x01d8b73b49d8cb653570929260e8e01033278d6840f706faa421f08b992f8083",
"0x00000000000000000005543df729c000",
"0x00000000000000000000000000000000"
]
}
],
"maxFee": null,
"isApprovalTx": false,
"spender": null
}
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.
"transaction": {
// This field equals to SOLANA for all SOLANA Transactions
"type": "SOLANA",
// Transaction blockchain
"blockChain": "SOLANA",
// Wallet address of transaction initiator
"from": "3HsNMDtxPRUzwLpDJemmNVbasm11Ei5CGGCjktgHh27F",
// Transaction identifier in case of retry
"identifier": "Swap",
// List of instructions
"instructions": [ ],
// Recent blockHash. Nullable. Filled only if message is already partially signed
"recentBlockhash": null,
// List of signatures. Filled only if message is already partially signed
"signatures": [ ],
// When serialized message appears, there is no need for other fields and you just sign and send it
"serializedMessage": [1, 0, 95, 96, ..., 1, 253],
// Could be LEGACY or VERSIONED
"txType": "VERSIONED"
}
SUI Sample Transaction:(Test)
"transaction": {
"type": "SUI",
"blockChain": "SUI",
// Base64-encoded unsigned transaction data
"unsignedPtbBase64": "AAAA...<base64_encoded_data>..."
}
Last updated
Was this helpful?