Skip to content

Commit

Permalink
Display mint address for corresponding instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
sponomarev committed Apr 15, 2024
1 parent ae133bf commit acab6d6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
10 changes: 5 additions & 5 deletions libsol/message_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1584,7 +1584,7 @@ void test_process_message_body_spl_token_transfer() {
42, 0, 0, 0, 0, 0, 0, 0,
9
};
process_message_body_and_sanity_check(message, sizeof(message), 5);
process_message_body_and_sanity_check(message, sizeof(message), 6);
}

void test_process_message_body_spl_token_approve() {
Expand All @@ -1606,7 +1606,7 @@ void test_process_message_body_spl_token_approve() {
42, 0, 0, 0, 0, 0, 0, 0,
9
};
process_message_body_and_sanity_check(message, sizeof(message), 5);
process_message_body_and_sanity_check(message, sizeof(message), 6);
}

void test_process_message_body_spl_token_revoke() {
Expand Down Expand Up @@ -1687,7 +1687,7 @@ void test_process_message_body_spl_token_burn() {
42, 0, 0, 0, 0, 0, 0, 0,
9
};
process_message_body_and_sanity_check(message, sizeof(message), 4);
process_message_body_and_sanity_check(message, sizeof(message), 5);
}

void test_process_message_body_spl_token_close_account() {
Expand Down Expand Up @@ -1819,7 +1819,7 @@ void test_process_message_body_spl_associated_token_create_with_transfer() {
0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x09
};
process_message_body_and_sanity_check(message, sizeof(message), 9);
process_message_body_and_sanity_check(message, sizeof(message), 10);
}

void test_process_message_body_spl_associated_token_create_with_transfer_and_assert_owner() {
Expand Down Expand Up @@ -1858,7 +1858,7 @@ void test_process_message_body_spl_associated_token_create_with_transfer_and_ass
0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x09
};
process_message_body_and_sanity_check(message, sizeof(message), 9);
process_message_body_and_sanity_check(message, sizeof(message), 10);
}

/* clang-format on */
Expand Down
15 changes: 11 additions & 4 deletions libsol/spl_token_instruction.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,9 @@ int print_spl_token_transfer_info(const SplTokenTransferInfo* info,
symbol,
info->body.decimals);

item = transaction_summary_general_item();
summary_item_set_pubkey(item, "Mint", info->mint_account);

item = transaction_summary_general_item();
summary_item_set_pubkey(item, "From", info->src_account);

Expand All @@ -528,6 +531,9 @@ static int print_spl_token_approve_info(const SplTokenApproveInfo* info,
symbol,
info->body.decimals);

item = transaction_summary_general_item();
summary_item_set_pubkey(item, "Mint", info->mint_account);

item = transaction_summary_general_item();
summary_item_set_pubkey(item, "From", info->token_account);

Expand Down Expand Up @@ -591,10 +597,8 @@ static int print_spl_token_mint_to_info(const SplTokenMintToInfo* info,
symbol,
info->body.decimals);

if (print_config->expert_mode) {
item = transaction_summary_general_item();
summary_item_set_pubkey(item, "From", info->mint_account);
}
item = transaction_summary_general_item();
summary_item_set_pubkey(item, "Mint", info->mint_account);

item = transaction_summary_general_item();
summary_item_set_pubkey(item, "To", info->token_account);
Expand All @@ -618,6 +622,9 @@ static int print_spl_token_burn_info(const SplTokenBurnInfo* info,
symbol,
info->body.decimals);

item = transaction_summary_general_item();
summary_item_set_pubkey(item, "Mint", info->mint_account);

item = transaction_summary_general_item();
summary_item_set_pubkey(item, "From", info->token_account);

Expand Down

0 comments on commit acab6d6

Please sign in to comment.