-
Notifications
You must be signed in to change notification settings - Fork 101
Columbus 5 Wallet Migration Guide
Columbus-5 is designed to support almost all legacy interfaces for legacy services. However, there are inevitable core changes due to breaking changes from CosmosSDK and CosmWasm.
The Cosmos team found vulnerabilities in legacy tx support. To remedy this issue, they removed legacy [POST] /txs
endpoints from v0.44.0.
To avoid sudden large changes, Columbus-5 introduces the custom endpoint [POST] /txs
. This endpoint internally converts the legacy tx to a new proto style tx with some additional inputs and then broadcasts the converted txs.
See PR 551 for more information.
This new feature is applied in [email protected]:
{
"tx": StdTx,
"mode": "block" | "sync" | "async",
// The following fields are newly introduced optional arguments.
// To convert legacy tx to new proto tx, you need each signer's sequence number.
// If this field is not given, fetch the sequence from the chain state.
// Normal users can skip this field as well.
// Users sending tx faster than block time must provide this field.
"sequences": ["1", "2"],
"fee_granter": "",
}
To use timeout_height
, please define timeout_height
in your legacy StdTX:
StdTx {
...original params
"timeout_height": "100", // block height
}
StdSignDoc == StdSignMsg {
...original params
"timeout"?: "100" | undefined // if you want to use timeout_height feature, you have to define this property to sign doc before signing
}
Please be aware that with this update, generated txbytes differ from legacy:
-
Generated TxHash is not the same as
hash(sha256sum(legacyTxBytes))
.
To generate a proper txhash offline, use proto encoding for a new proto txbytes.
We are keeping the proto libraries in https://github.com/terra-money/terra.proto. Use these libraries or leave issues for new language support.
Wallet developers and terra.js users need to update their program to use Terra's custom /txs
end point or the new proto style /cosmos/tx/v1beta1/txs
:
- v2.0.14 - supports legacy endpoint
/txs
with other legacy query endpoints.const response = lcd.broadcast(tx, {sequences: [100]}); // please pass optional sequences, if you keep sequence number in local.
- v2.1.7 - supports new style endpoints with whole proto support.
When using terra.js, simply bump the version to bombay tag $ npm i @terra-money/terra.js
.
Normal wallet developers must apply the following updates:
The coins
field is removed from the response. Use one of following endpoints to get coins
:
/bank/balances/{address}
/cosmos/bank/v1beta1/balances/{address}
/cosmos/bank/v1beta1/balances/{address}/{denom}
The Request format is changed to receive BaseReq
with msgs
:
{
"base_req":{
"from":"terra1wg2mlrxdmnnkkykgqg4znky86nyrtc45q336yv",
"memo":"Sent via Terra Station 🚀",
"chain_id":"columbus-3",
"account_number":"0",
"sequence":"1",
"gas":"200000",
"gas_adjustment":"1.2",
"fees":[
{
"denom":"uluna",
"amount":"50"
}
],
"simulate":false
},
"msgs":[
{
"type":"bank/MsgSend",
"value":{
"from_address":"terra1wg2mlrxdmnnkkykgqg4znky86nyrtc45q336yv",
"to_address":"terra14u47f8ufn2agqlpdpnfvcd2782zgnus9nslmfc",
"amount":[
{
"denom":"ukrw",
"amount":"10000000"
}
]
}
}
]
}
The response format is also changed to return StdFee
:
{
"fee": {
"gas": "string",
"amount": [
{
"denom": "uluna",
"amount": "50"
}
]
}
}
- If you want to migrate the interface to new Protobuf style endpoint, you can refer https://bombay-lcd.terra.dev/swagger/
/cosmos/tx/v1beta1/simulate
/terra/tx/v1beta1/compute_tax
The coin_received
& coin_spent
events are added.
The value of message.action
has been changed to use protobuf namespace. For example, formal send becomes /cosmos.bank.v1beta1.MsgSend.
{
...
"logs": [
{
"events":[
{
"type":"coin_received",
"attributes":[
{
"key":"receiver",
"value":"terra1gtudrw3vpxhdt2vd8jy6gz393gdwcfuql8pugl"
},
{
"key":"amount",
"value":"1000000000uluna"
}
]
},
{
"type":"coin_spent",
"attributes":[
{
"key":"spender",
"value":"terra1h8ljdmae7lx05kjj79c9ekscwsyjd3yr8wyvdn"
},
{
"key":"amount",
"value":"1000000000uluna"
}
]
},
{
"type":"message",
"attributes":[
{
"key":"action",
"value":"/cosmos.bank.v1beta1.MsgSend"
},
{
"key":"sender",
"value":"terra1h8ljdmae7lx05kjj79c9ekscwsyjd3yr8wyvdn"
},
{
"key":"module",
"value":"bank"
}
]
},
{
"type":"transfer",
"attributes":[
{
"key":"recipient",
"value":"terra1gtudrw3vpxhdt2vd8jy6gz393gdwcfuql8pugl"
},
{
"key":"sender",
"value":"terra1h8ljdmae7lx05kjj79c9ekscwsyjd3yr8wyvdn"
},
{
"key":"amount",
"value":"1000000000uluna"
}
]
}
]
}
]
...
}