Skip to content

Commit

Permalink
Merge pull request #349 from keepkey/mayachain-integration
Browse files Browse the repository at this point in the history
feat: mayachain integration
  • Loading branch information
pastaghost authored Feb 6, 2024
2 parents 06844eb + bf9dbac commit 39db694
Show file tree
Hide file tree
Showing 18 changed files with 927 additions and 177 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.7.2)

project(
KeepKeyFirmware
VERSION 7.8.0
VERSION 7.9.1
LANGUAGES C CXX ASM)

set(BOOTLOADER_MAJOR_VERSION 2)
Expand Down
2 changes: 1 addition & 1 deletion deps/device-protocol
1 change: 1 addition & 0 deletions include/keepkey/firmware/coins.def
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ X(true, "THORChain", true, "RUNE", false, NA, false, NA, false, N
X(true, "Terra", true, "LUNA", false, NA, false, NA, false, NA, false, {0}, true, 0x8000014a, false, 0, true, 6, false, NO_CONTRACT, false, 0, false, false, false, false, true, SECP256K1_STRING, false, "", false, "terra", false, false, false, 0, false, 0, false, "" )
X(true, "Kava", true, "KAVA", false, NA, false, NA, false, NA, false, {0}, true, 0x800001cb, false, 0, true, 6, false, NO_CONTRACT, false, 0, false, false, false, false, true, SECP256K1_STRING, false, "", false, "kava", false, false, false, 0, false, 0, false, "" )
X(true, "Secret", true, "SCRT", false, NA, false, NA, false, NA, false, {0}, true, 0x80000211, false, 0, true, 6, false, NO_CONTRACT, false, 0, false, false, false, false, true, SECP256K1_STRING, false, "", false, "secret", false, false, false, 0, false, 0, false, "" )
X(true, "MAYAChain", true, "CACAO", false, NA, false, NA, false, NA, false, {0}, true, 0x800003a3, false, 0, true, 10, false, NO_CONTRACT, false, 0, false, false, false, false, true, SECP256K1_STRING, false, "", false, "maya", false, false, false, 0, false, 0, false, "" )

#undef X
#undef NO_CONTRACT
4 changes: 4 additions & 0 deletions include/keepkey/firmware/fsm.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ void fsm_msgThorchainGetAddress(const ThorchainGetAddress *msg);
void fsm_msgThorchainSignTx(const ThorchainSignTx *msg);
void fsm_msgThorchainMsgAck(const ThorchainMsgAck *msg);

void fsm_msgMayachainGetAddress(const MayachainGetAddress *msg);
void fsm_msgMayachainSignTx(const MayachainSignTx *msg);
void fsm_msgMayachainMsgAck(const MayachainMsgAck *msg);

#if DEBUG_LINK
// void fsm_msgDebugLinkDecision(DebugLinkDecision *msg);
void fsm_msgDebugLinkGetState(DebugLinkGetState *msg);
Expand Down
30 changes: 30 additions & 0 deletions include/keepkey/firmware/mayachain.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#ifndef KEEPKEY_FIRMWARE_MAYACHAIN_H
#define KEEPKEY_FIRMWARE_MAYACHAIN_H

#include "messages.pb.h"
#include "trezor/crypto/bip32.h"

#include <stdbool.h>
#include <stdint.h>

typedef struct _MayachainSignTx MayachainSignTx;
typedef struct _MayachainMsgDeposit MayachainMsgDeposit;

bool mayachain_signTxInit(const HDNode *_node, const MayachainSignTx *_msg);
bool mayachain_signTxUpdateMsgSend(const uint64_t amount, const char *to_address);
bool mayachain_signTxUpdateMsgDeposit(const MayachainMsgDeposit *depmsg);
bool mayachain_signTxFinalize(uint8_t *public_key, uint8_t *signature);
bool mayachain_signingIsInited(void);
bool mayachain_signingIsFinished(void);
void mayachain_signAbort(void);
const MayachainSignTx *mayachain_getMayachainSignTx(void);

// Mayachain swap data parse and confirm
// input:
// swapStr - string in mayachain swap format
// size - size of input string (must be <= 256)
// output:
// true if mayachain data parsed and confirmed by user, false otherwise
bool mayachain_parseConfirmMemo(const char *swapStr, size_t size);

#endif
1 change: 1 addition & 0 deletions include/keepkey/transport/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "messages-ripple.pb.h"
#include "messages-tendermint.pb.h"
#include "messages-thorchain.pb.h"
#include "messages-mayachain.pb.h"

#include "types.pb.h"
#include "trezor_transport.h"
Expand Down
17 changes: 17 additions & 0 deletions include/keepkey/transport/messages-mayachain.options
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
MayachainGetAddress.address_n max_count:10

MayachainAddress.address max_size:46

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

MayachainMsgSend.from_address max_size:46
MayachainMsgSend.to_address max_size:46

MayachainMsgDeposit.asset max_size:20
MayachainMsgDeposit.memo max_size:256
MayachainMsgDeposit.signer max_size:46

MayachainSignedTx.public_key max_size:33
MayachainSignedTx.signature max_size:64
1 change: 1 addition & 0 deletions lib/firmware/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ set(sources
ethereum_tokens.c
fsm.c
home_sm.c
mayachain.c
nano.c
osmosis.c
passphrase_sm.c
Expand Down
Loading

0 comments on commit 39db694

Please sign in to comment.