Skip to content

Commit

Permalink
Merge pull request #92 from Zondax/dev
Browse files Browse the repository at this point in the history
Token address (#91)
  • Loading branch information
chcmedeiros authored Nov 20, 2024
2 parents 3417211 + 72b1cfc commit 731d66f
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion app/Makefile.version
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ APPVERSION_M=1
# This is the `spec_version` field of `Runtime`
APPVERSION_N=0
# This is the patch version of this release
APPVERSION_P=4
APPVERSION_P=5
15 changes: 13 additions & 2 deletions app/src/parser_print_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@
#define PREFIX "yay with councils:\n"
#define PREFIX_COUNCIL "Council: "
#define PREFIX_SPENDING "spending cap: "

#if defined(LEDGER_SPECIFIC)
#define NAM_MAINNET_ADDRESS "tnam1q9gr66cvu4hrzm0sd5kmlnjje82gs3xlfg3v6nu7"
#else
// Test address to verify the address replacement by NAM
#define NAM_MAINNET_ADDRESS "tnam1qx60d9v036kfqhfnt2lua5uquh3d3hhrzva03gfl"
#endif

#define CHECK_PTR_BOUNDS(count, dstLen) \
if((count + 1) >= dstLen) { \
Expand Down Expand Up @@ -88,7 +93,13 @@ parser_error_t printAddressAlt(const AddressAlt *addr,

char address[110] = {0};
CHECK_ERROR(crypto_encodeAltAddress(addr, address, sizeof(address)))
pageString(outVal, outValLen, (const char*) address, pageIdx, pageCount);

// Comapare with NAM mainnet address
if (memcmp(address, NAM_MAINNET_ADDRESS, strlen(NAM_MAINNET_ADDRESS)) == 0) {
pageString(outVal, outValLen, "NAM", pageIdx, pageCount);
} else {
pageString(outVal, outValLen, (const char*) address, pageIdx, pageCount);
}

return parser_ok;
}
Expand Down
2 changes: 1 addition & 1 deletion deps/ledger-zxlib
20 changes: 7 additions & 13 deletions tests/testvectors.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
"13 | Timeout timestamp : 2532-11-08T20:58:07.450111911Z",
"14 | Sender [1/2] : tnam1qx8zhzupfafg98trt6xgknjg0693vxlp9",
"14 | Sender [2/2] : spsy7lh",
"15 | Sending Token [1/2] : tnam1qx60d9v036kfqhfnt2lua5uquh3d3hhrz",
"15 | Sending Token [2/2] : va03gfl",
"15 | Sending Token : NAM",
"16 | Sending Amount [1/3] : 0.000000000000000000000000000000000000",
"16 | Sending Amount [2/3] : 00000000000000000544451787073501541541",
"16 | Sending Amount [3/3] : 3993718908291383296",
Expand All @@ -35,16 +34,14 @@
"17 | Sender [6/8] : dcc4tuy9l2zhyy4e2pfxfh6wsh9l8vutrzqg8s",
"17 | Sender [7/8] : mktvf9sjhrlwj0zqlfa7sq3l2tm9fyxgdvcwzf",
"17 | Sender [8/8] : z3tyltpnwu7qnddu9a",
"18 | Sending Token [1/2] : tnam1qx60d9v036kfqhfnt2lua5uquh3d3hhrz",
"18 | Sending Token [2/2] : va03gfl",
"18 | Sending Token : NAM",
"19 | Sending Amount [1/3] : 0.000000000000000000000000000000000000",
"19 | Sending Amount [2/3] : 00000000000000002007665964833536934433",
"19 | Sending Amount [3/3] : 9101838474324475904",
"20 | Destination [1/3] : znam1q4drwwk8u5v9h27zqyk5ger7tazy86y4s",
"20 | Destination [2/3] : sxyxddmntx80p4nrhvtw0xm5egx3prv9y4pj2h",
"20 | Destination [3/3] : lzus",
"21 | Receiving Token [1/2] : tnam1qx60d9v036kfqhfnt2lua5uquh3d3hhrz",
"21 | Receiving Token [2/2] : va03gfl",
"21 | Receiving Token : NAM",
"22 | Receiving Amount [1/3] : 0.000000000000000000000000000000000000",
"22 | Receiving Amount [2/3] : 00000000000000002552117751907038475975",
"22 | Receiving Amount [3/3] : 30955573826158592"
Expand All @@ -70,8 +67,7 @@
"14 | Timeout timestamp : 2532-11-08T20:58:07.450111911Z",
"15 | Sender [1/2] : tnam1qx8zhzupfafg98trt6xgknjg0693vxlp9",
"15 | Sender [2/2] : spsy7lh",
"16 | Sending Token [1/2] : tnam1qx60d9v036kfqhfnt2lua5uquh3d3hhrz",
"16 | Sending Token [2/2] : va03gfl",
"16 | Sending Token : NAM",
"17 | Sending Amount [1/3] : 0.000000000000000000000000000000000000",
"17 | Sending Amount [2/3] : 00000000000000000544451787073501541541",
"17 | Sending Amount [3/3] : 3993718908291383296",
Expand All @@ -83,16 +79,14 @@
"18 | Sender [6/8] : dcc4tuy9l2zhyy4e2pfxfh6wsh9l8vutrzqg8s",
"18 | Sender [7/8] : mktvf9sjhrlwj0zqlfa7sq3l2tm9fyxgdvcwzf",
"18 | Sender [8/8] : z3tyltpnwu7qnddu9a",
"19 | Sending Token [1/2] : tnam1qx60d9v036kfqhfnt2lua5uquh3d3hhrz",
"19 | Sending Token [2/2] : va03gfl",
"19 | Sending Token : NAM",
"20 | Sending Amount [1/3] : 0.000000000000000000000000000000000000",
"20 | Sending Amount [2/3] : 00000000000000002007665964833536934433",
"20 | Sending Amount [3/3] : 9101838474324475904",
"21 | Destination [1/3] : znam1q4drwwk8u5v9h27zqyk5ger7tazy86y4s",
"21 | Destination [2/3] : sxyxddmntx80p4nrhvtw0xm5egx3prv9y4pj2h",
"21 | Destination [3/3] : lzus",
"22 | Receiving Token [1/2] : tnam1qx60d9v036kfqhfnt2lua5uquh3d3hhrz",
"22 | Receiving Token [2/2] : va03gfl",
"22 | Receiving Token : NAM",
"23 | Receiving Amount [1/3] : 0.000000000000000000000000000000000000",
"23 | Receiving Amount [2/3] : 00000000000000002552117751907038475975",
"23 | Receiving Amount [3/3] : 30955573826158592",
Expand Down Expand Up @@ -50947,4 +50941,4 @@
],
"valid": true
}
]
]
Binary file modified tests_zemu/snapshots/fl-mainmenu/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/s-mainmenu/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/s-mainmenu/00010.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/sp-mainmenu/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/sp-mainmenu/00010.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/st-mainmenu/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/x-mainmenu/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/x-mainmenu/00010.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 731d66f

Please sign in to comment.