A general Cosmos transaction can be used for any transaction on any of the supported Cosmos chains
Cosmos supports two types of encoding for transactions:
- Amino: The legacy implementation of the singing object.
- Direct: A binary encoding of transactions released in the Cosmos SDK v0.46, which targets transactions with multiple signers. This mode expects to receive both
body
andauth_info
encoded in base64.
The following example shows how to create a transaction using Amino encoding:
{
"vault_id":"676aa7db-ac39-4c25-923c-bf28e5f8be29",
"note":"",
"signer_type":"api_signer",
"type":"cosmos_transaction",
"details":{
"type":"cosmos_raw_transaction",
"chain":"cosmos_osmosis-1",
"request_data":{
"format":"amino",
"messages":[
{
"type":"cosmos-sdk/MsgVote",
"value":"{\"option\":1,\"proposal_id\":\"720\",\"voter\":\"osmo1p4x4jp9524vgtkmkes25ug96t3t0k3ca6qnk9e\"}"
}
],
"memo":"",
"std_fee":{
"amount":[
{
"denom":"uosmo",
"amount":"1644"
}
],
"gas":"65721"
}
}
}
}
The next example shows how to create a transaction using direct encoding. Both body
and auth_info
use the base64 format of the protobuf serialization of those fields:
{
"vault_id": "676aa7db-ac39-4c25-923c-bf28e5f8be29",
"signer_type": "api_signer",
"type": "cosmos_transaction",
"details": {
"type": "cosmos_raw_transaction",
"chain": "cosmos_pacific-1",
"request_data": {
"format": "direct",
"body": "Cs4ICiQvY29zbXdhc20ud2FzbS52MS5Nc2dFeGVjdXRlQ29udHJhY3QSpQgKKnNlaTFwNHg0anA5NTI0dmd0a21rZXMyNXVnOTZ0M3QwazNjYWxoM3M0MhI+c2VpMTZhd3JkZWh2bGE2a3FxMmRrNXY0bTZ6ZTgzcWZnOHRycHc1NXFjOHJ2ZnJnOXFkbWZ2aHE3aGo2eDkaqgd7ImV4ZWN1dGVfc3dhcF9vcGVyYXRpb25zIjp7Im9wZXJhdGlvbnMiOlt7ImFzdHJvX3N3YXAiOnsib2ZmZXJfYXNzZXRfaW5mbyI6eyJuYXRpdmVfdG9rZW4iOnsiZGVub20iOiJ1c2VpIn19LCJhc2tfYXNzZXRfaW5mbyI6eyJuYXRpdmVfdG9rZW4i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