Skip to content

Commit

Permalink
wip: add support for cosmos staking/delegation
Browse files Browse the repository at this point in the history
  • Loading branch information
pastaghost authored and mrnerdhair committed Apr 18, 2022
1 parent 7d66000 commit 6aa5cd9
Show file tree
Hide file tree
Showing 5 changed files with 765 additions and 75 deletions.
36 changes: 34 additions & 2 deletions include/keepkey/firmware/signtx_tendermint.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,40 @@

typedef struct _TendermintSignTx TendermintSignTx;

bool tendermint_signTxInit(const HDNode *_node, const void *_msg, const size_t msgsize, const char *denom);
bool tendermint_signTxUpdateMsgSend(const uint64_t amount, const char *to_address, const char *chainstr, const char *denom, const char *msgTypePrefix);
bool tendermint_signTxInit(const HDNode *_node, const void *_msg,
const size_t msgsize, const char *denom);
bool tendermint_signTxUpdateMsgSend(const uint64_t amount,
const char *to_address,
const char *chainstr,
const char *denom,
const char *msgTypePrefix);
bool tendermint_signTxUpdateMsgDelegate(const uint64_t amount,
const char *delegator_address,
const char *validator_address,
const char *chainstr,
const char *denom,
const char *msgTypePrefix);
bool tendermint_signTxUpdateMsgUndelegate(const uint64_t amount,
const char *delegator_address,
const char *validator_address,
const char *chainstr,
const char *denom,
const char *msgTypePrefix);
bool tendermint_signTxUpdateMsgRedelegate(
const uint64_t amount, const char *delegator_address,
const char *validator_src_address, const char *validator_dst_address,
const char *chainstr, const char *denom, const char *msgTypePrefix);
bool tendermint_signTxUpdateMsgRewards(const uint64_t amount,
const char *delegator_address,
const char *validator_address,
const char *chainstr,
const char *denom,
const char *msgTypePrefix);
bool tendermint_signTxUpdateMsgIBCTransfer(
const uint64_t amount, const char *sender, const char *receiver,
const char *source_channel, const char *source_port,
const char *revision_number, const char *revision_height,
const char *chainstr, const char *denom, const char *msgTypePrefix);
bool tendermint_signTxFinalize(uint8_t *public_key, uint8_t *signature);
bool tendermint_signingIsInited(void);
bool tendermint_signingIsFinished(void);
Expand Down
27 changes: 24 additions & 3 deletions include/keepkey/transport/messages-cosmos.options
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
CosmosGetAddress.address_n max_count:10

CosmosAddress.address max_size:46
CosmosAddress.address max_size:53

CosmosSignTx.address_n max_count:10
CosmosSignTx.chain_id max_size:32
CosmosSignTx.memo max_size:256

CosmosMsgSend.from_address max_size:46
CosmosMsgSend.to_address max_size:46
CosmosMsgSend.from_address max_size:53
CosmosMsgSend.to_address max_size:53

CosmosMsgDelegate.delegator_address max_size:53
CosmosMsgDelegate.validator_address max_size:53

CosmosMsgUndelegate.delegator_address max_size:53
CosmosMsgUndelegate.validator_address max_size:53

CosmosMsgRedelegate.delegator_address max_size:53
CosmosMsgRedelegate.validator_src_address max_size:53
CosmosMsgRedelegate.validator_dst_address max_size:53

CosmosMsgRewards.delegator_address max_size:53
CosmosMsgRewards.validator_address max_size:53

CosmosMsgIBCTransfer.sender max_size:53
CosmosMsgIBCTransfer.receiver max_size:53
CosmosMsgIBCTransfer.source_channel max_size:32
CosmosMsgIBCTransfer.source_port max_size:32
CosmosMsgIBCTransfer.revision_height max_size:16
CosmosMsgIBCTransfer.revision_number max_size:9
CosmosMsgIBCTransfer.denom max_size:9

CosmosSignedTx.public_key max_size:33
CosmosSignedTx.signature max_size:64
21 changes: 21 additions & 0 deletions include/keepkey/transport/messages-tendermint.options
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,26 @@ TendermintSignTx.message_type_prefix max_length:24
TendermintMsgSend.from_address max_length:53
TendermintMsgSend.to_address max_length:53

TendermintMsgDelegate.delegator_address max_size:53
TendermintMsgDelegate.validator_address max_size:53

TendermintMsgUndelegate.delegator_address max_size:53
TendermintMsgUndelegate.validator_address max_size:53

TendermintMsgRedelegate.delegator_address max_size:53
TendermintMsgRedelegate.validator_src_address max_size:53
TendermintMsgRedelegate.validator_dst_address max_size:53

TendermintMsgRewards.delegator_address max_size:53
TendermintMsgRewards.validator_address max_size:53

TendermintMsgIBCTransfer.sender max_size:53
TendermintMsgIBCTransfer.receiver max_size:53
TendermintMsgIBCTransfer.source_channel max_size:32
TendermintMsgIBCTransfer.source_port max_size:32
TendermintMsgIBCTransfer.revision_height max_size:16
TendermintMsgIBCTransfer.revision_number max_size:9
TendermintMsgIBCTransfer.denom max_size:9

TendermintSignedTx.public_key max_size:33
TendermintSignedTx.signature max_size:64
Loading

0 comments on commit 6aa5cd9

Please sign in to comment.