Skip to content

Commit c678fe9

Browse files
neithanmoabenso
andauthored
token formatting and neuron txs for visibility and voting power (#264)
* Add token information registry and helper functions * Add formatting function to be use for registry look-up * Add commands to retrieve token registry * Add support to JS package to retrieve token registry from ledger devices * Add zemu test to retrieve device's token registry * Fix lookup function and remove comments * Proper check to decide if using tokenInfo from table or default to Tokens marker for amount and fee * Fix warnings * Apply the rigth format to Fees * Remove formatting of amounts and use ICP token by default for SNS transactions * fix(decimals): Fix current test by removing formattig on unknown tokens * Fix fee formatting for known and unknown tokens * Use token formatting according to token table for sns transactions * Update neuron tests * Fix for split neuron amount being read wrong * Update tests * Remove unused variable * Fix warnings * Bump version and update snapshots * Add token decimal tests * Fix token display title and update test vector(fixed) * Remove logging code * Remove unused variable * Add support for neuron voting power updates * Fix parser and complet UI for voting power transaction * feat(manageneuron): Add neuron refresh voting power test in zemu * shore: fix warnings and unused arguments * Add support to handle the configuration operation to set neuron visibility * Add zemu test to check neuron visibility transaction * Update app/src/candid/nns_parser.c Co-authored-by: Andrés Benso <[email protected]> * Update app/src/candid/nns_parser.c Co-authored-by: Andrés Benso <[email protected]> * Remove unnecessary comments * Reduce title length to Max fee + token name * Remove testing snapshot * Fix fee title and update tests * Update snapshots to reproduce a change from Maximun fee to Max fee * Remove commented code which is not used * Update snapshots --------- Co-authored-by: Andrés Benso <[email protected]>
1 parent ec6e653 commit c678fe9

File tree

139 files changed

+5181
-2433
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+5181
-2433
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ file(GLOB_RECURSE LIB_SRC
124124
${CMAKE_CURRENT_SOURCE_DIR}/app/src/base32.c
125125
${CMAKE_CURRENT_SOURCE_DIR}/app/src/protobuf/*.c
126126
${CMAKE_CURRENT_SOURCE_DIR}/app/src/parser_print_*.c
127+
${CMAKE_CURRENT_SOURCE_DIR}/app/src/token_info.c
127128
)
128129

129130
add_library(app_lib STATIC

app/Makefile.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ APPVERSION_M=3
33
# This is the minor version of this release
44
APPVERSION_N=2
55
# This is the patch version of this release
6-
APPVERSION_P=4
6+
APPVERSION_P=5

app/src/apdu_handler.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "crypto.h"
3131
#include "handlers/path.h"
3232
#include "handlers/process_chunks.h"
33+
#include "handlers/tokens.h"
3334
#include "parser_impl.h"
3435
#include "tx.h"
3536
#include "view.h"
@@ -195,6 +196,18 @@ void handleApdu(volatile uint32_t *flags, volatile uint32_t *tx, uint32_t rx) {
195196
}
196197
#endif
197198

199+
case INS_SUPPORTED_TOKENS_LEN: {
200+
CHECK_PIN_VALIDATED()
201+
handleGetNumOfTokens(flags, tx, rx);
202+
break;
203+
}
204+
205+
case INS_TOKEN_AT_IDX: {
206+
CHECK_PIN_VALIDATED()
207+
handleGetTokenIdx(flags, tx, rx);
208+
break;
209+
}
210+
198211
default:
199212
THROW(APDU_CODE_INS_NOT_SUPPORTED);
200213
}

app/src/candid/candid_parser.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ parser_error_t readCandidListNeurons(parser_tx_t *tx, const uint8_t *input, uint
140140
}
141141

142142
parser_error_t readCandidManageNeuron(parser_tx_t *tx, const uint8_t *input, uint16_t inputSize) {
143+
zemu_log("readCandidManageNeuron\n");
143144
// Create context and auxiliary ctx
144145
CREATE_CTX(ctx, tx, input, inputSize)
145146
candid_transaction_t txn;
@@ -151,7 +152,6 @@ parser_error_t readCandidManageNeuron(parser_tx_t *tx, const uint8_t *input, uin
151152

152153
CHECK_PARSER_ERR(readAndCheckRootType(&ctx))
153154

154-
155155
CHECK_PARSER_ERR(getCandidTypeFromTable(&txn, tx->candid_rootType))
156156

157157
CHECK_PARSER_ERR(readCandidRecordLength(&txn))
@@ -164,7 +164,7 @@ parser_error_t readCandidManageNeuron(parser_tx_t *tx, const uint8_t *input, uin
164164
return readNNSManageNeuron(&ctx, &txn);
165165

166166
default:
167-
ZEMU_LOGF(100, "Error: transaction type not supported\n")
167+
zemu_log("Error: transaction type not supported\n");
168168
}
169169

170170
return parser_unexpected_value;

0 commit comments

Comments
 (0)