diff --git a/common/defs/solana/programs.json b/common/defs/solana/programs.json index 97e2d9528a..b97a81019b 100644 --- a/common/defs/solana/programs.json +++ b/common/defs/solana/programs.json @@ -22,22 +22,15 @@ }, { "name": "owner", - "type": "authority", + "type": "pubkey", "optional": false } ], "references": [ - { - "name": "funding_account", - "is_authority": true, - "optional": false - }, - { - "name": "new_account", - "is_authority": false, - "optional": false - } + "funding_account", + "new_account" ], + "references_required": 2, "ui_properties": [ { "account": "new_account", @@ -49,7 +42,8 @@ }, { "account": "funding_account", - "display_name": "From" + "display_name": "From", + "default_value_to_hide": "signer" } ] }, @@ -60,25 +54,24 @@ "parameters": [ { "name": "owner", - "type": "authority", + "type": "pubkey", "optional": false } ], "references": [ - { - "name": "assigned_account", - "is_authority": true, - "optional": false - } + "assigned_account" ], + "references_required": 1, "ui_properties": [ { "account": "assigned_account", - "display_name": "Assign account" + "display_name": "Assign account", + "default_value_to_hide": "signer" }, { "parameter": "owner", - "display_name": "Assign account to program" + "display_name": "Assign account to program", + "default_value_to_hide": "signer" } ] }, @@ -94,17 +87,10 @@ } ], "references": [ - { - "name": "funding_account", - "is_authority": true, - "optional": false - }, - { - "name": "recipient_account", - "is_authority": false, - "optional": false - } + "funding_account", + "recipient_account" ], + "references_required": 2, "ui_properties": [ { "account": "recipient_account", @@ -116,7 +102,8 @@ }, { "account": "funding_account", - "display_name": "Sender" + "display_name": "Sender", + "default_value_to_hide": "signer" } ] }, @@ -152,22 +139,11 @@ } ], "references": [ - { - "name": "funding_account", - "is_authority": true, - "optional": false - }, - { - "name": "created_account", - "is_authority": false, - "optional": false - }, - { - "name": "base_account", - "is_authority": true, - "optional": true - } + "funding_account", + "created_account", + "base_account" ], + "references_required": 2, "ui_properties": [ { "account": "created_account", @@ -179,7 +155,8 @@ }, { "account": "funding_account", - "display_name": "From" + "display_name": "From", + "default_value_to_hide": "signer" } ] }, @@ -189,22 +166,11 @@ "is_multisig": false, "parameters": [], "references": [ - { - "name": "nonce_account", - "is_authority": false, - "optional": false - }, - { - "name": "recent_blockhashes_sysvar", - "is_authority": false, - "optional": false - }, - { - "name": "nonce_authority", - "is_authority": true, - "optional": false - } + "nonce_account", + "recent_blockhashes_sysvar", + "nonce_authority" ], + "references_required": 3, "ui_properties": [ { "account": "nonce_account", @@ -212,7 +178,8 @@ }, { "account": "nonce_authority", - "display_name": "Authorized by" + "display_name": "Authorized by", + "default_value_to_hide": "signer" } ] }, @@ -228,32 +195,13 @@ } ], "references": [ - { - "name": "nonce_account", - "is_authority": false, - "optional": false - }, - { - "name": "recipient_account", - "is_authority": false, - "optional": false - }, - { - "name": "recent_blockhashes_sysvar", - "is_authority": false, - "optional": false - }, - { - "name": "rent_sysvar", - "is_authority": false, - "optional": false - }, - { - "name": "nonce_authority", - "is_authority": true, - "optional": false - } + "nonce_account", + "recipient_account", + "recent_blockhashes_sysvar", + "rent_sysvar", + "nonce_authority" ], + "references_required": 5, "ui_properties": [ { "parameter": "lamports", @@ -269,7 +217,8 @@ }, { "account": "nonce_authority", - "display_name": "Authorized by" + "display_name": "Authorized by", + "default_value_to_hide": "signer" } ] }, @@ -280,27 +229,16 @@ "parameters": [ { "name": "nonce_authority", - "type": "authority", + "type": "pubkey", "optional": false } ], "references": [ - { - "name": "nonce_account", - "is_authority": false, - "optional": false - }, - { - "name": "recent_blockhashes_sysvar", - "is_authority": false, - "optional": false - }, - { - "name": "rent_sysvar", - "is_authority": false, - "optional": false - } + "nonce_account", + "recent_blockhashes_sysvar", + "rent_sysvar" ], + "references_required": 3, "ui_properties": [ { "account": "nonce_account", @@ -308,7 +246,8 @@ }, { "parameter": "nonce_authority", - "display_name": "New authority" + "display_name": "New authority", + "default_value_to_hide": "signer" } ] }, @@ -319,22 +258,15 @@ "parameters": [ { "name": "nonce_authority", - "type": "authority", + "type": "pubkey", "optional": false } ], "references": [ - { - "name": "nonce_account", - "is_authority": false, - "optional": false - }, - { - "name": "nonce_authority", - "is_authority": true, - "optional": false - } + "nonce_account", + "nonce_authority" ], + "references_required": 2, "ui_properties": [ { "account": "nonce_account", @@ -342,11 +274,13 @@ }, { "parameter": "nonce_authority", - "display_name": "New authority" + "display_name": "New authority", + "default_value_to_hide": "signer" }, { "account": "nonce_authority", - "display_name": "Authorized by" + "display_name": "Authorized by", + "default_value_to_hide": "signer" } ] }, @@ -362,16 +296,14 @@ } ], "references": [ - { - "name": "new_account", - "is_authority": true, - "optional": false - } + "new_account" ], + "references_required": 1, "ui_properties": [ { "account": "new_account", - "display_name": "Allocate account" + "display_name": "Allocate account", + "default_value_to_hide": "signer" }, { "parameter": "space", @@ -406,17 +338,10 @@ } ], "references": [ - { - "name": "allocated_account", - "is_authority": false, - "optional": false - }, - { - "name": "base_account", - "is_authority": true, - "optional": false - } + "allocated_account", + "base_account" ], + "references_required": 2, "ui_properties": [ { "account": "allocated_account", @@ -450,17 +375,10 @@ } ], "references": [ - { - "name": "assigned_account", - "is_authority": false, - "optional": false - }, - { - "name": "base_account", - "is_authority": true, - "optional": false - } + "assigned_account", + "base_account" ], + "references_required": 2, "ui_properties": [ { "account": "assigned_account", @@ -494,22 +412,11 @@ } ], "references": [ - { - "name": "funding_account", - "is_authority": false, - "optional": false - }, - { - "name": "base_account", - "is_authority": true, - "optional": false - }, - { - "name": "recipient_account", - "is_authority": false, - "optional": false - } + "funding_account", + "base_account", + "recipient_account" ], + "references_required": 3, "ui_properties": [ { "account": "recipient_account", @@ -531,12 +438,9 @@ "is_multisig": false, "parameters": [], "references": [ - { - "name": "nonce_account", - "is_authority": false, - "optional": false - } + "nonce_account" ], + "references_required": 1, "ui_properties": [ { "account": "nonce_account", @@ -558,12 +462,12 @@ "parameters": [ { "name": "staker", - "type": "authority", + "type": "pubkey", "optional": false }, { "name": "withdrawer", - "type": "authority", + "type": "pubkey", "optional": false }, { @@ -578,22 +482,15 @@ }, { "name": "custodian", - "type": "authority", + "type": "pubkey", "optional": false } ], "references": [ - { - "name": "uninitialized_stake_account", - "is_authority": false, - "optional": false - }, - { - "name": "rent_sysvar", - "is_authority": false, - "optional": false - } + "uninitialized_stake_account", + "rent_sysvar" ], + "references_required": 2, "ui_properties": [ { "account": "uninitialized_stake_account", @@ -601,11 +498,13 @@ }, { "parameter": "staker", - "display_name": "New stake authority" + "display_name": "New stake authority", + "default_value_to_hide": "signer" }, { "parameter": "withdrawer", - "display_name": "New withdraw authority" + "display_name": "New withdraw authority", + "default_value_to_hide": "signer" }, { "parameter": "unix_timestamp", @@ -619,7 +518,8 @@ }, { "parameter": "custodian", - "display_name": "Lockup authority" + "display_name": "Lockup authority", + "default_value_to_hide": "signer" } ] }, @@ -640,27 +540,12 @@ } ], "references": [ - { - "name": "stake_account", - "is_authority": false, - "optional": false - }, - { - "name": "clock_sysvar", - "is_authority": false, - "optional": false - }, - { - "name": "stake_or_withdraw_authority", - "is_authority": true, - "optional": false - }, - { - "name": "lockup_authority", - "is_authority": true, - "optional": true - } + "stake_account", + "clock_sysvar", + "stake_or_withdraw_authority", + "lockup_authority" ], + "references_required": 3, "ui_properties": [ { "account": "stake_account", @@ -676,11 +561,13 @@ }, { "account": "stake_or_withdraw_authority", - "display_name": "Authorized by" + "display_name": "Authorized by", + "default_value_to_hide": "signer" }, { "account": "lockup_authority", - "display_name": "Custodian" + "display_name": "Custodian", + "default_value_to_hide": "signer" } ] }, @@ -690,37 +577,14 @@ "is_multisig": false, "parameters": [], "references": [ - { - "name": "initialized_stake_account", - "is_authority": false, - "optional": false - }, - { - "name": "vote_account", - "is_authority": false, - "optional": false - }, - { - "name": "clock_sysvar", - "is_authority": false, - "optional": false - }, - { - "name": "stake_history_sysvar", - "is_authority": false, - "optional": false - }, - { - "name": "config_account", - "is_authority": false, - "optional": false - }, - { - "name": "stake_authority", - "is_authority": true, - "optional": false - } + "initialized_stake_account", + "vote_account", + "clock_sysvar", + "stake_history_sysvar", + "config_account", + "stake_authority" ], + "references_required": 6, "ui_properties": [ { "account": "initialized_stake_account", @@ -728,7 +592,8 @@ }, { "account": "stake_authority", - "display_name": "Authorized by" + "display_name": "Authorized by", + "default_value_to_hide": "signer" }, { "account": "vote_account", @@ -748,22 +613,11 @@ } ], "references": [ - { - "name": "stake_account", - "is_authority": false, - "optional": false - }, - { - "name": "uninitialized_stake_account", - "is_authority": false, - "optional": false - }, - { - "name": "stake_authority", - "is_authority": true, - "optional": false - } + "stake_account", + "uninitialized_stake_account", + "stake_authority" ], + "references_required": 3, "ui_properties": [ { "parameter": "lamports", @@ -779,7 +633,8 @@ }, { "account": "stake_authority", - "display_name": "Authorized by" + "display_name": "Authorized by", + "default_value_to_hide": "signer" } ] }, @@ -795,37 +650,14 @@ } ], "references": [ - { - "name": "stake_account", - "is_authority": false, - "optional": false - }, - { - "name": "recipient_account", - "is_authority": false, - "optional": false - }, - { - "name": "clock_sysvar", - "is_authority": false, - "optional": false - }, - { - "name": "stake_history_sysvar", - "is_authority": false, - "optional": false - }, - { - "name": "withdrawal_authority", - "is_authority": true, - "optional": false - }, - { - "name": "lockup_authority", - "is_authority": true, - "optional": true - } + "stake_account", + "recipient_account", + "clock_sysvar", + "stake_history_sysvar", + "withdrawal_authority", + "lockup_authority" ], + "references_required": 5, "ui_properties": [ { "parameter": "lamports", @@ -841,7 +673,8 @@ }, { "account": "withdrawal_authority", - "display_name": "Authorized by" + "display_name": "Authorized by", + "default_value_to_hide": "signer" } ] }, @@ -851,22 +684,11 @@ "is_multisig": false, "parameters": [], "references": [ - { - "name": "delegated_stake_account", - "is_authority": false, - "optional": false - }, - { - "name": "clock_sysvar", - "is_authority": false, - "optional": false - }, - { - "name": "stake_authority", - "is_authority": true, - "optional": false - } + "delegated_stake_account", + "clock_sysvar", + "stake_authority" ], + "references_required": 3, "ui_properties": [ { "account": "delegated_stake_account", @@ -874,7 +696,8 @@ }, { "account": "stake_authority", - "display_name": "Authorized by" + "display_name": "Authorized by", + "default_value_to_hide": "signer" } ] }, @@ -900,17 +723,10 @@ } ], "references": [ - { - "name": "initialized_stake_account", - "is_authority": false, - "optional": false - }, - { - "name": "lockup_or_withdraw_authority", - "is_authority": true, - "optional": false - } + "initialized_stake_account", + "lockup_or_withdraw_authority" ], + "references_required": 2, "ui_properties": [ { "account": "initialized_stake_account", @@ -932,7 +748,8 @@ }, { "account": "lockup_or_withdraw_authority", - "display_name": "Authorized by" + "display_name": "Authorized by", + "default_value_to_hide": "signer" } ] }, @@ -942,32 +759,13 @@ "is_multisig": false, "parameters": [], "references": [ - { - "name": "destination_stake_account", - "is_authority": false, - "optional": false - }, - { - "name": "source_stake_account", - "is_authority": false, - "optional": false - }, - { - "name": "clock_sysvar", - "is_authority": false, - "optional": false - }, - { - "name": "stake_history_sysvar", - "is_authority": false, - "optional": false - }, - { - "name": "stake_authority", - "is_authority": true, - "optional": false - } + "destination_stake_account", + "source_stake_account", + "clock_sysvar", + "stake_history_sysvar", + "stake_authority" ], + "references_required": 5, "ui_properties": [ { "account": "source_stake_account", @@ -979,7 +777,8 @@ }, { "account": "stake_authority", - "display_name": "Authorized by" + "display_name": "Authorized by", + "default_value_to_hide": "signer" } ] }, @@ -1010,27 +809,12 @@ } ], "references": [ - { - "name": "stake_account", - "is_authority": false, - "optional": false - }, - { - "name": "stake_or_withdraw_authority", - "is_authority": true, - "optional": false - }, - { - "name": "clock_sysvar", - "is_authority": false, - "optional": false - }, - { - "name": "lockup_authority", - "is_authority": true, - "optional": true - } + "stake_account", + "stake_or_withdraw_authority", + "clock_sysvar", + "lockup_authority" ], + "references_required": 3, "ui_properties": [ { "account": "stake_account", @@ -1046,11 +830,13 @@ }, { "account": "stake_or_withdraw_authority", - "display_name": "Authorized by" + "display_name": "Authorized by", + "default_value_to_hide": "signer" }, { "account": "lockup_authority", - "display_name": "Custodian" + "display_name": "Custodian", + "default_value_to_hide": "signer" } ] }, @@ -1060,27 +846,12 @@ "is_multisig": false, "parameters": [], "references": [ - { - "name": "uninitialized_stake_account", - "is_authority": false, - "optional": false - }, - { - "name": "rent_sysvar", - "is_authority": false, - "optional": false - }, - { - "name": "stake_authority", - "is_authority": false, - "optional": false - }, - { - "name": "withdrawal_authority", - "is_authority": true, - "optional": false - } + "uninitialized_stake_account", + "rent_sysvar", + "stake_authority", + "withdrawal_authority" ], + "references_required": 4, "ui_properties": [ { "account": "uninitialized_stake_account", @@ -1092,7 +863,8 @@ }, { "account": "withdrawal_authority", - "display_name": "New withdraw authority" + "display_name": "New withdraw authority", + "default_value_to_hide": "signer" } ] }, @@ -1108,32 +880,13 @@ } ], "references": [ - { - "name": "stake_account", - "is_authority": false, - "optional": false - }, - { - "name": "clock_sysvar", - "is_authority": false, - "optional": false - }, - { - "name": "stake_or_withdraw_authority", - "is_authority": true, - "optional": false - }, - { - "name": "new_stake_or_withdraw_authority", - "is_authority": true, - "optional": false - }, - { - "name": "lockup_authority", - "is_authority": true, - "optional": true - } + "stake_account", + "clock_sysvar", + "stake_or_withdraw_authority", + "new_stake_or_withdraw_authority", + "lockup_authority" ], + "references_required": 4, "ui_properties": [ { "account": "stake_account", @@ -1141,7 +894,8 @@ }, { "account": "new_stake_or_withdraw_authority", - "display_name": "New authority" + "display_name": "New authority", + "default_value_to_hide": "signer" }, { "parameter": "stake_authorize", @@ -1149,11 +903,13 @@ }, { "account": "stake_or_withdraw_authority", - "display_name": "Authorized by" + "display_name": "Authorized by", + "default_value_to_hide": "signer" }, { "account": "lockup_authority", - "display_name": "Custodian" + "display_name": "Custodian", + "default_value_to_hide": "signer" } ] }, @@ -1179,32 +935,13 @@ } ], "references": [ - { - "name": "stake_account", - "is_authority": false, - "optional": false - }, - { - "name": "stake_or_withdraw_authority", - "is_authority": true, - "optional": false - }, - { - "name": "clock_sysvar", - "is_authority": false, - "optional": false - }, - { - "name": "new_stake_or_withdraw_authority", - "is_authority": true, - "optional": false - }, - { - "name": "lockup_authority", - "is_authority": true, - "optional": true - } + "stake_account", + "stake_or_withdraw_authority", + "clock_sysvar", + "new_stake_or_withdraw_authority", + "lockup_authority" ], + "references_required": 4, "ui_properties": [ { "account": "stake_account", @@ -1212,7 +949,8 @@ }, { "account": "new_stake_or_withdraw_authority", - "display_name": "New authority" + "display_name": "New authority", + "default_value_to_hide": "signer" }, { "parameter": "stake_authorize", @@ -1220,11 +958,13 @@ }, { "account": "stake_or_withdraw_authority", - "display_name": "Authorized by" + "display_name": "Authorized by", + "default_value_to_hide": "signer" }, { "account": "lockup_authority", - "display_name": "Custodian" + "display_name": "Custodian", + "default_value_to_hide": "signer" } ] }, @@ -1245,22 +985,11 @@ } ], "references": [ - { - "name": "stake_account", - "is_authority": false, - "optional": false - }, - { - "name": "lockup_or_withdraw_authority", - "is_authority": true, - "optional": false - }, - { - "name": "new_lockup_authority", - "is_authority": true, - "optional": true - } + "stake_account", + "lockup_or_withdraw_authority", + "new_lockup_authority" ], + "references_required": 2, "ui_properties": [ { "account": "stake_account", @@ -1278,11 +1007,13 @@ }, { "account": "new_lockup_authority", - "display_name": "New lockup authority" + "display_name": "New lockup authority", + "default_value_to_hide": "signer" }, { "account": "lockup_or_withdraw_authority", - "display_name": "Authorized by" + "display_name": "Authorized by", + "default_value_to_hide": "signer" } ] } @@ -1305,6 +1036,7 @@ } ], "references": [], + "references_required": 0, "ui_properties": [ { "parameter": "bytes", @@ -1325,6 +1057,7 @@ } ], "references": [], + "references_required": 0, "ui_properties": [ { "parameter": "units", @@ -1345,6 +1078,7 @@ } ], "references": [], + "references_required": 0, "ui_properties": [ { "parameter": "lamports", @@ -1365,27 +1099,12 @@ "is_multisig": false, "parameters": [], "references": [ - { - "name": "account_to_initialize", - "is_authority": false, - "optional": false - }, - { - "name": "mint_account", - "is_authority": false, - "optional": false - }, - { - "name": "owner", - "is_authority": false, - "optional": false - }, - { - "name": "rent_sysvar", - "is_authority": false, - "optional": false - } + "account_to_initialize", + "mint_account", + "owner", + "rent_sysvar" ], + "references_required": 4, "ui_properties": [ { "account": "account_to_initialize", @@ -1413,22 +1132,11 @@ } ], "references": [ - { - "name": "multisig_account", - "is_authority": false, - "optional": false - }, - { - "name": "rent_sysvar", - "is_authority": false, - "optional": false - }, - { - "name": "signer_accounts", - "is_authority": false, - "optional": false - } + "multisig_account", + "rent_sysvar", + "signer_accounts" ], + "references_required": 3, "ui_properties": [ { "account": "multisig_account", @@ -1453,22 +1161,11 @@ } ], "references": [ - { - "name": "source_account", - "is_authority": false, - "optional": false - }, - { - "name": "destination_account", - "is_authority": false, - "optional": false - }, - { - "name": "owner", - "is_authority": true, - "optional": false - } + "source_account", + "destination_account", + "owner" ], + "references_required": 3, "ui_properties": [ { "account": "destination_account", @@ -1484,7 +1181,8 @@ }, { "account": "owner", - "display_name": "Owner" + "display_name": "Owner", + "default_value_to_hide": "signer" } ] }, @@ -1501,22 +1199,11 @@ } ], "references": [ - { - "name": "source_account", - "is_authority": false, - "optional": false - }, - { - "name": "delegate_account", - "is_authority": false, - "optional": false - }, - { - "name": "owner", - "is_authority": true, - "optional": false - } + "source_account", + "delegate_account", + "owner" ], + "references_required": 3, "ui_properties": [ { "account": "delegate_account", @@ -1528,7 +1215,8 @@ }, { "account": "owner", - "display_name": "Owner" + "display_name": "Owner", + "default_value_to_hide": "signer" } ] }, @@ -1538,17 +1226,10 @@ "is_multisig": true, "parameters": [], "references": [ - { - "name": "source_account", - "is_authority": false, - "optional": false - }, - { - "name": "owner", - "is_authority": true, - "optional": false - } + "source_account", + "owner" ], + "references_required": 2, "ui_properties": [ { "account": "source_account", @@ -1556,7 +1237,8 @@ }, { "account": "owner", - "display_name": "Owner" + "display_name": "Owner", + "default_value_to_hide": "signer" } ] }, @@ -1572,22 +1254,15 @@ }, { "name": "new_authority", - "type": "authority", + "type": "pubkey", "optional": true } ], "references": [ - { - "name": "mint_account", - "is_authority": false, - "optional": false - }, - { - "name": "current_authority", - "is_authority": true, - "optional": false - } + "mint_account", + "current_authority" ], + "references_required": 2, "ui_properties": [ { "account": "mint_account", @@ -1595,7 +1270,8 @@ }, { "parameter": "new_authority", - "display_name": "New authority" + "display_name": "New authority", + "default_value_to_hide": "signer" }, { "parameter": "authority_type", @@ -1603,7 +1279,8 @@ }, { "account": "current_authority", - "display_name": "Current authority" + "display_name": "Current authority", + "default_value_to_hide": "signer" } ] }, @@ -1620,23 +1297,11 @@ } ], "references": [ - { - "name": "mint", - "is_authority": false, - "optional": false, - "is_token_mint": true - }, - { - "name": "account_to_mint", - "is_authority": false, - "optional": false - }, - { - "name": "minting_authority", - "is_authority": true, - "optional": false - } + "mint", + "account_to_mint", + "minting_authority" ], + "references_required": 3, "ui_properties": [ { "account": "mint", @@ -1652,7 +1317,8 @@ }, { "account": "minting_authority", - "display_name": "Mint authority" + "display_name": "Mint authority", + "default_value_to_hide": "signer" } ] }, @@ -1669,23 +1335,11 @@ } ], "references": [ - { - "name": "account_to_burn_from", - "is_authority": false, - "optional": false - }, - { - "name": "token_mint", - "is_authority": false, - "optional": false, - "is_token_mint": true - }, - { - "name": "owner", - "is_authority": true, - "optional": false - } + "account_to_burn_from", + "token_mint", + "owner" ], + "references_required": 3, "ui_properties": [ { "account": "token_mint", @@ -1701,7 +1355,8 @@ }, { "account": "owner", - "display_name": "Mint authority" + "display_name": "Mint authority", + "default_value_to_hide": "signer" } ] }, @@ -1711,22 +1366,11 @@ "is_multisig": true, "parameters": [], "references": [ - { - "name": "account_to_close", - "is_authority": false, - "optional": false - }, - { - "name": "destination_account", - "is_authority": false, - "optional": false - }, - { - "name": "owner", - "is_authority": true, - "optional": false - } + "account_to_close", + "destination_account", + "owner" ], + "references_required": 3, "ui_properties": [ { "account": "account_to_close", @@ -1738,7 +1382,8 @@ }, { "account": "owner", - "display_name": "Owner" + "display_name": "Owner", + "default_value_to_hide": "signer" } ] }, @@ -1748,23 +1393,11 @@ "is_multisig": true, "parameters": [], "references": [ - { - "name": "account_to_freeze", - "is_authority": false, - "optional": false - }, - { - "name": "token_mint", - "is_authority": false, - "optional": false, - "is_token_mint": true - }, - { - "name": "freeze_authority", - "is_authority": true, - "optional": false - } + "account_to_freeze", + "token_mint", + "freeze_authority" ], + "references_required": 3, "ui_properties": [ { "account": "account_to_freeze", @@ -1776,7 +1409,8 @@ }, { "account": "freeze_authority", - "display_name": "Owner" + "display_name": "Owner", + "default_value_to_hide": "signer" } ] }, @@ -1786,23 +1420,11 @@ "is_multisig": true, "parameters": [], "references": [ - { - "name": "account_to_freeze", - "is_authority": false, - "optional": false - }, - { - "name": "token_mint", - "is_authority": false, - "optional": false, - "is_token_mint": true - }, - { - "name": "freeze_authority", - "is_authority": true, - "optional": false - } + "account_to_freeze", + "token_mint", + "freeze_authority" ], + "references_required": 3, "ui_properties": [ { "account": "account_to_freeze", @@ -1814,7 +1436,8 @@ }, { "account": "freeze_authority", - "display_name": "Owner" + "display_name": "Owner", + "default_value_to_hide": "signer" } ] }, @@ -1826,7 +1449,11 @@ { "name": "amount", "type": "token_amount", - "optional": false + "optional": false, + "args": { + "decimals": "decimals", + "mint": "token_mint" + } }, { "name": "decimals", @@ -1835,28 +1462,12 @@ } ], "references": [ - { - "name": "source_account", - "is_authority": false, - "optional": false - }, - { - "name": "token_mint", - "is_authority": false, - "optional": false, - "is_token_mint": true - }, - { - "name": "destination_account", - "is_authority": false, - "optional": false - }, - { - "name": "owner", - "is_authority": true, - "optional": false - } + "source_account", + "token_mint", + "destination_account", + "owner" ], + "references_required": 4, "ui_properties": [ { "account": "token_mint", @@ -1876,7 +1487,8 @@ }, { "account": "owner", - "display_name": "Owner" + "display_name": "Owner", + "default_value_to_hide": "signer" } ] }, @@ -1888,7 +1500,11 @@ { "name": "amount", "type": "token_amount", - "optional": false + "optional": false, + "args": { + "decimals": "decimals", + "mint": "token_mint" + } }, { "name": "decimals", @@ -1897,28 +1513,12 @@ } ], "references": [ - { - "name": "source_account", - "is_authority": false, - "optional": false - }, - { - "name": "token_mint", - "is_authority": false, - "optional": false, - "is_token_mint": true - }, - { - "name": "delegate", - "is_authority": false, - "optional": false - }, - { - "name": "owner", - "is_authority": true, - "optional": false - } + "source_account", + "token_mint", + "delegate", + "owner" ], + "references_required": 4, "ui_properties": [ { "account": "token_mint", @@ -1938,7 +1538,8 @@ }, { "account": "owner", - "display_name": "Owner" + "display_name": "Owner", + "default_value_to_hide": "signer" } ] }, @@ -1950,7 +1551,11 @@ { "name": "amount", "type": "token_amount", - "optional": false + "optional": false, + "args": { + "decimals": "decimals", + "mint": "mint" + } }, { "name": "decimals", @@ -1959,23 +1564,11 @@ } ], "references": [ - { - "name": "mint", - "is_authority": false, - "optional": false, - "is_token_mint": true - }, - { - "name": "account_to_mint", - "is_authority": false, - "optional": false - }, - { - "name": "minting_authority", - "is_authority": true, - "optional": false - } + "mint", + "account_to_mint", + "minting_authority" ], + "references_required": 3, "ui_properties": [ { "account": "mint", @@ -1991,7 +1584,8 @@ }, { "account": "minting_authority", - "display_name": "Owner" + "display_name": "Owner", + "default_value_to_hide": "signer" } ] }, @@ -2003,7 +1597,11 @@ { "name": "amount", "type": "token_amount", - "optional": false + "optional": false, + "args": { + "decimals": "decimals", + "mint": "token_mint" + } }, { "name": "decimals", @@ -2012,23 +1610,11 @@ } ], "references": [ - { - "name": "account_to_burn_from", - "is_authority": false, - "optional": false - }, - { - "name": "token_mint", - "is_authority": false, - "optional": false, - "is_token_mint": true - }, - { - "name": "owner", - "is_authority": true, - "optional": false - } + "account_to_burn_from", + "token_mint", + "owner" ], + "references_required": 3, "ui_properties": [ { "account": "token_mint", @@ -2044,7 +1630,8 @@ }, { "account": "owner", - "display_name": "Owner" + "display_name": "Owner", + "default_value_to_hide": "signer" } ] }, @@ -2060,22 +1647,11 @@ } ], "references": [ - { - "name": "account_to_initialize", - "is_authority": false, - "optional": false - }, - { - "name": "mint_account", - "is_authority": false, - "optional": false - }, - { - "name": "rent_sysvar", - "is_authority": false, - "optional": false - } + "account_to_initialize", + "mint_account", + "rent_sysvar" ], + "references_required": 3, "ui_properties": [ { "account": "account_to_initialize", @@ -2097,12 +1673,9 @@ "is_multisig": false, "parameters": [], "references": [ - { - "name": "token_account", - "is_authority": false, - "optional": false - } + "token_account" ], + "references_required": 1, "ui_properties": [ { "account": "token_account", @@ -2122,17 +1695,10 @@ } ], "references": [ - { - "name": "account_to_initialize", - "is_authority": false, - "optional": false - }, - { - "name": "mint_account", - "is_authority": false, - "optional": false - } + "account_to_initialize", + "mint_account" ], + "references_required": 2, "ui_properties": [ { "account": "account_to_initialize", @@ -2154,12 +1720,9 @@ "is_multisig": false, "parameters": [], "references": [ - { - "name": "account_to_initialize", - "is_authority": false, - "optional": false - } + "account_to_initialize" ], + "references_required": 1, "ui_properties": [ { "account": "account_to_initialize", @@ -2180,27 +1743,12 @@ "is_multisig": false, "parameters": [], "references": [ - { - "name": "account_to_initialize", - "is_authority": false, - "optional": false - }, - { - "name": "mint_account", - "is_authority": false, - "optional": false - }, - { - "name": "owner", - "is_authority": false, - "optional": false - }, - { - "name": "rent_sysvar", - "is_authority": false, - "optional": false - } + "account_to_initialize", + "mint_account", + "owner", + "rent_sysvar" ], + "references_required": 4, "ui_properties": [ { "account": "account_to_initialize", @@ -2228,22 +1776,11 @@ } ], "references": [ - { - "name": "multisig_account", - "is_authority": false, - "optional": false - }, - { - "name": "rent_sysvar", - "is_authority": false, - "optional": false - }, - { - "name": "signer_accounts", - "is_authority": false, - "optional": false - } + "multisig_account", + "rent_sysvar", + "signer_accounts" ], + "references_required": 3, "ui_properties": [ { "account": "multisig_account", @@ -2268,22 +1805,11 @@ } ], "references": [ - { - "name": "source_account", - "is_authority": false, - "optional": false - }, - { - "name": "destination_account", - "is_authority": false, - "optional": false - }, - { - "name": "owner", - "is_authority": true, - "optional": false - } + "source_account", + "destination_account", + "owner" ], + "references_required": 3, "ui_properties": [ { "account": "destination_account", @@ -2299,7 +1825,8 @@ }, { "account": "owner", - "display_name": "Owner" + "display_name": "Owner", + "default_value_to_hide": "signer" } ] }, @@ -2316,22 +1843,11 @@ } ], "references": [ - { - "name": "source_account", - "is_authority": false, - "optional": false - }, - { - "name": "delegate_account", - "is_authority": false, - "optional": false - }, - { - "name": "owner", - "is_authority": true, - "optional": false - } + "source_account", + "delegate_account", + "owner" ], + "references_required": 3, "ui_properties": [ { "account": "delegate_account", @@ -2343,7 +1859,8 @@ }, { "account": "owner", - "display_name": "Owner" + "display_name": "Owner", + "default_value_to_hide": "signer" } ] }, @@ -2353,17 +1870,10 @@ "is_multisig": true, "parameters": [], "references": [ - { - "name": "source_account", - "is_authority": false, - "optional": false - }, - { - "name": "owner", - "is_authority": true, - "optional": false - } + "source_account", + "owner" ], + "references_required": 2, "ui_properties": [ { "account": "source_account", @@ -2371,7 +1881,8 @@ }, { "account": "owner", - "display_name": "Owner" + "display_name": "Owner", + "default_value_to_hide": "signer" } ] }, @@ -2387,22 +1898,15 @@ }, { "name": "new_authority", - "type": "authority", + "type": "pubkey", "optional": true } ], "references": [ - { - "name": "mint_account", - "is_authority": false, - "optional": false - }, - { - "name": "current_authority", - "is_authority": true, - "optional": false - } + "mint_account", + "current_authority" ], + "references_required": 2, "ui_properties": [ { "account": "mint_account", @@ -2410,7 +1914,8 @@ }, { "parameter": "new_authority", - "display_name": "New authority" + "display_name": "New authority", + "default_value_to_hide": "signer" }, { "parameter": "authority_type", @@ -2418,7 +1923,8 @@ }, { "account": "current_authority", - "display_name": "Current authority" + "display_name": "Current authority", + "default_value_to_hide": "signer" } ] }, @@ -2435,23 +1941,11 @@ } ], "references": [ - { - "name": "mint", - "is_authority": false, - "optional": false, - "is_token_mint": true - }, - { - "name": "account_to_mint", - "is_authority": false, - "optional": false - }, - { - "name": "minting_authority", - "is_authority": true, - "optional": false - } + "mint", + "account_to_mint", + "minting_authority" ], + "references_required": 3, "ui_properties": [ { "account": "mint", @@ -2467,7 +1961,8 @@ }, { "account": "minting_authority", - "display_name": "Mint authority" + "display_name": "Mint authority", + "default_value_to_hide": "signer" } ] }, @@ -2484,23 +1979,11 @@ } ], "references": [ - { - "name": "account_to_burn_from", - "is_authority": false, - "optional": false - }, - { - "name": "token_mint", - "is_authority": false, - "optional": false, - "is_token_mint": true - }, - { - "name": "owner", - "is_authority": true, - "optional": false - } + "account_to_burn_from", + "token_mint", + "owner" ], + "references_required": 3, "ui_properties": [ { "account": "token_mint", @@ -2516,7 +1999,8 @@ }, { "account": "owner", - "display_name": "Mint authority" + "display_name": "Mint authority", + "default_value_to_hide": "signer" } ] }, @@ -2526,22 +2010,11 @@ "is_multisig": true, "parameters": [], "references": [ - { - "name": "account_to_close", - "is_authority": false, - "optional": false - }, - { - "name": "destination_account", - "is_authority": false, - "optional": false - }, - { - "name": "owner", - "is_authority": true, - "optional": false - } + "account_to_close", + "destination_account", + "owner" ], + "references_required": 3, "ui_properties": [ { "account": "account_to_close", @@ -2553,7 +2026,8 @@ }, { "account": "owner", - "display_name": "Owner" + "display_name": "Owner", + "default_value_to_hide": "signer" } ] }, @@ -2563,23 +2037,11 @@ "is_multisig": true, "parameters": [], "references": [ - { - "name": "account_to_freeze", - "is_authority": false, - "optional": false - }, - { - "name": "token_mint", - "is_authority": false, - "optional": false, - "is_token_mint": true - }, - { - "name": "freeze_authority", - "is_authority": true, - "optional": false - } + "account_to_freeze", + "token_mint", + "freeze_authority" ], + "references_required": 3, "ui_properties": [ { "account": "account_to_freeze", @@ -2591,7 +2053,8 @@ }, { "account": "freeze_authority", - "display_name": "Owner" + "display_name": "Owner", + "default_value_to_hide": "signer" } ] }, @@ -2601,23 +2064,11 @@ "is_multisig": true, "parameters": [], "references": [ - { - "name": "account_to_freeze", - "is_authority": false, - "optional": false - }, - { - "name": "token_mint", - "is_authority": false, - "optional": false, - "is_token_mint": true - }, - { - "name": "freeze_authority", - "is_authority": true, - "optional": false - } + "account_to_freeze", + "token_mint", + "freeze_authority" ], + "references_required": 3, "ui_properties": [ { "account": "account_to_freeze", @@ -2629,7 +2080,8 @@ }, { "account": "freeze_authority", - "display_name": "Owner" + "display_name": "Owner", + "default_value_to_hide": "signer" } ] }, @@ -2641,7 +2093,11 @@ { "name": "amount", "type": "token_amount", - "optional": false + "optional": false, + "args": { + "decimals": "decimals", + "mint": "token_mint" + } }, { "name": "decimals", @@ -2650,28 +2106,12 @@ } ], "references": [ - { - "name": "source_account", - "is_authority": false, - "optional": false - }, - { - "name": "token_mint", - "is_authority": false, - "optional": false, - "is_token_mint": true - }, - { - "name": "destination_account", - "is_authority": false, - "optional": false - }, - { - "name": "owner", - "is_authority": true, - "optional": false - } + "source_account", + "token_mint", + "destination_account", + "owner" ], + "references_required": 4, "ui_properties": [ { "account": "token_mint", @@ -2691,7 +2131,8 @@ }, { "account": "owner", - "display_name": "Owner" + "display_name": "Owner", + "default_value_to_hide": "signer" } ] }, @@ -2703,7 +2144,11 @@ { "name": "amount", "type": "token_amount", - "optional": false + "optional": false, + "args": { + "decimals": "decimals", + "mint": "token_mint" + } }, { "name": "decimals", @@ -2712,28 +2157,12 @@ } ], "references": [ - { - "name": "source_account", - "is_authority": false, - "optional": false - }, - { - "name": "token_mint", - "is_authority": false, - "optional": false, - "is_token_mint": true - }, - { - "name": "delegate", - "is_authority": false, - "optional": false - }, - { - "name": "owner", - "is_authority": true, - "optional": false - } + "source_account", + "token_mint", + "delegate", + "owner" ], + "references_required": 4, "ui_properties": [ { "account": "token_mint", @@ -2753,7 +2182,8 @@ }, { "account": "owner", - "display_name": "Owner" + "display_name": "Owner", + "default_value_to_hide": "signer" } ] }, @@ -2765,7 +2195,11 @@ { "name": "amount", "type": "token_amount", - "optional": false + "optional": false, + "args": { + "decimals": "decimals", + "mint": "mint" + } }, { "name": "decimals", @@ -2774,23 +2208,11 @@ } ], "references": [ - { - "name": "mint", - "is_authority": false, - "optional": false, - "is_token_mint": true - }, - { - "name": "account_to_mint", - "is_authority": false, - "optional": false - }, - { - "name": "minting_authority", - "is_authority": true, - "optional": false - } + "mint", + "account_to_mint", + "minting_authority" ], + "references_required": 3, "ui_properties": [ { "account": "mint", @@ -2806,7 +2228,8 @@ }, { "account": "minting_authority", - "display_name": "Owner" + "display_name": "Owner", + "default_value_to_hide": "signer" } ] }, @@ -2818,7 +2241,11 @@ { "name": "amount", "type": "token_amount", - "optional": false + "optional": false, + "args": { + "decimals": "decimals", + "mint": "token_mint" + } }, { "name": "decimals", @@ -2827,23 +2254,11 @@ } ], "references": [ - { - "name": "account_to_burn_from", - "is_authority": false, - "optional": false - }, - { - "name": "token_mint", - "is_authority": false, - "optional": false, - "is_token_mint": true - }, - { - "name": "owner", - "is_authority": true, - "optional": false - } + "account_to_burn_from", + "token_mint", + "owner" ], + "references_required": 3, "ui_properties": [ { "account": "token_mint", @@ -2859,7 +2274,8 @@ }, { "account": "owner", - "display_name": "Owner" + "display_name": "Owner", + "default_value_to_hide": "signer" } ] }, @@ -2875,22 +2291,11 @@ } ], "references": [ - { - "name": "account_to_initialize", - "is_authority": false, - "optional": false - }, - { - "name": "mint_account", - "is_authority": false, - "optional": false - }, - { - "name": "rent_sysvar", - "is_authority": false, - "optional": false - } + "account_to_initialize", + "mint_account", + "rent_sysvar" ], + "references_required": 3, "ui_properties": [ { "account": "account_to_initialize", @@ -2912,12 +2317,9 @@ "is_multisig": false, "parameters": [], "references": [ - { - "name": "token_account", - "is_authority": false, - "optional": false - } + "token_account" ], + "references_required": 1, "ui_properties": [ { "account": "token_account", @@ -2937,17 +2339,10 @@ } ], "references": [ - { - "name": "account_to_initialize", - "is_authority": false, - "optional": false - }, - { - "name": "mint_account", - "is_authority": false, - "optional": false - } + "account_to_initialize", + "mint_account" ], + "references_required": 2, "ui_properties": [ { "account": "account_to_initialize", @@ -2969,12 +2364,9 @@ "is_multisig": false, "parameters": [], "references": [ - { - "name": "account_to_initialize", - "is_authority": false, - "optional": false - } + "account_to_initialize" ], + "references_required": 1, "ui_properties": [ { "account": "account_to_initialize", @@ -2995,44 +2387,15 @@ "is_multisig": false, "parameters": [], "references": [ - { - "name": "funding_account", - "is_authority": true, - "optional": false - }, - { - "name": "associated_token_account", - "is_authority": false, - "optional": false - }, - { - "name": "wallet_address", - "is_authority": false, - "optional": false - }, - { - "name": "token_mint", - "is_authority": false, - "optional": false, - "is_token_mint": true - }, - { - "name": "system_program", - "is_authority": false, - "optional": false - }, - { - "name": "spl_token", - "is_authority": false, - "optional": false - }, - { - "//": "Some dApps still include the rent sysvar although it's not officially required anymore.", - "name": "rent_sysvar", - "is_authority": false, - "optional": true - } + "funding_account", + "associated_token_account", + "wallet_address", + "token_mint", + "system_program", + "spl_token", + "rent_sysvar" ], + "references_required": 6, "ui_properties": [ { "account": "associated_token_account", @@ -3048,7 +2411,8 @@ }, { "account": "funding_account", - "display_name": "Funded by" + "display_name": "Funded by", + "default_value_to_hide": "signer" } ] }, @@ -3058,38 +2422,14 @@ "is_multisig": false, "parameters": [], "references": [ - { - "name": "funding_account", - "is_authority": true, - "optional": false - }, - { - "name": "associated_token_account", - "is_authority": false, - "optional": false - }, - { - "name": "wallet_addr", - "is_authority": false, - "optional": false - }, - { - "name": "token_mint", - "is_authority": false, - "optional": false, - "is_token_mint": true - }, - { - "name": "system_program", - "is_authority": false, - "optional": false - }, - { - "name": "spl_token", - "is_authority": false, - "optional": false - } + "funding_account", + "associated_token_account", + "wallet_addr", + "token_mint", + "system_program", + "spl_token" ], + "references_required": 6, "ui_properties": [ { "account": "associated_token_account", @@ -3105,7 +2445,8 @@ }, { "account": "funding_account", - "display_name": "Funded by" + "display_name": "Funded by", + "default_value_to_hide": "signer" } ] }, @@ -3115,46 +2456,20 @@ "is_multisig": false, "parameters": [], "references": [ - { - "name": "nested_account", - "is_authority": true, - "optional": false - }, - { - "name": "token_mint_nested", - "is_authority": false, - "optional": false - }, - { - "name": "associated_token_account", - "is_authority": false, - "optional": false - }, - { - "name": "owner", - "is_authority": false, - "optional": false - }, - { - "name": "token_mint_owner", - "is_authority": false, - "optional": false - }, - { - "name": "wallet_address", - "is_authority": true, - "optional": false - }, - { - "name": "spl_token", - "is_authority": false, - "optional": false - } + "nested_account", + "token_mint_nested", + "associated_token_account", + "owner", + "token_mint_owner", + "wallet_address", + "spl_token" ], + "references_required": 7, "ui_properties": [ { "account": "nested_account", - "display_name": "Recover nested token account" + "display_name": "Recover nested token account", + "default_value_to_hide": "signer" }, { "account": "associated_token_account", @@ -3162,7 +2477,8 @@ }, { "account": "wallet_address", - "display_name": "Transfer recovered SOL to" + "display_name": "Transfer recovered SOL to", + "default_value_to_hide": "signer" } ] } @@ -3185,12 +2501,9 @@ } ], "references": [ - { - "name": "signer_accounts", - "is_authority": true, - "optional": true - } + "signer_accounts" ], + "references_required": 0, "ui_properties": [ { "parameter": "memo", @@ -3198,7 +2511,8 @@ }, { "account": "signer_accounts", - "display_name": "Signer accounts" + "display_name": "Signer accounts", + "default_value_to_hide": "signer" } ] } @@ -3221,12 +2535,9 @@ } ], "references": [ - { - "name": "signer_accounts", - "is_authority": true, - "optional": true - } + "signer_accounts" ], + "references_required": 0, "ui_properties": [ { "parameter": "memo", @@ -3234,7 +2545,8 @@ }, { "account": "signer_accounts", - "display_name": "Signer accounts" + "display_name": "Signer accounts", + "default_value_to_hide": "signer" } ] } @@ -3265,16 +2577,16 @@ "token_amount": { "parse": "read_uint64_le", "format": "format_token_amount", - "required_parameters": ["decimals"] + "required_parameters": [ + "#definitions", + "decimals", + "mint" + ] }, "pubkey": { "parse": "parse_pubkey", "format": "format_pubkey" }, - "authority": { - "parse": "parse_pubkey", - "format": "format_pubkey" - }, "string": { "parse": "parse_string", "format": "format_identity" diff --git a/common/defs/solana/programs.md b/common/defs/solana/programs.md index f0c889ba78..c2ef7e0508 100644 --- a/common/defs/solana/programs.md +++ b/common/defs/solana/programs.md @@ -12,14 +12,14 @@ _This file is generated by `programs.md.mako` via `make solana_templates`, do no | Deposit | `lamports` | `lamports` | | From | `funding_account` | `account` | | _(not shown)_ | `space` | `u64` | -| _(not shown)_ | `owner` | `authority` | +| _(not shown)_ | `owner` | `pubkey` | ### (1) Assign | Label | Value | Type | |-------|-------|------| | Assign account | `assigned_account` | `account` | -| Assign account to program | `owner` | `authority` | +| Assign account to program | `owner` | `pubkey` | ### (2) Transfer @@ -66,7 +66,7 @@ _This file is generated by `programs.md.mako` via `make solana_templates`, do no | Label | Value | Type | |-------|-------|------| | Initialize nonce account | `nonce_account` | `account` | -| New authority | `nonce_authority` | `authority` | +| New authority | `nonce_authority` | `pubkey` | | _(not shown)_ | `recent_blockhashes_sysvar` | `account` | | _(not shown)_ | `rent_sysvar` | `account` | @@ -75,7 +75,7 @@ _This file is generated by `programs.md.mako` via `make solana_templates`, do no | Label | Value | Type | |-------|-------|------| | Set nonce authority | `nonce_account` | `account` | -| New authority | `nonce_authority` | `authority` | +| New authority | `nonce_authority` | `pubkey` | | Authorized by | `nonce_authority` | `account` | ### (8) Allocate @@ -132,11 +132,11 @@ _This file is generated by `programs.md.mako` via `make solana_templates`, do no | Label | Value | Type | |-------|-------|------| | Initialize stake account | `uninitialized_stake_account` | `account` | -| New stake authority | `staker` | `authority` | -| New withdraw authority | `withdrawer` | `authority` | +| New stake authority | `staker` | `pubkey` | +| New withdraw authority | `withdrawer` | `pubkey` | | Lockup time | `unix_timestamp` | `unix_timestamp` | | Lockup epoch | `epoch` | `u64` | -| Lockup authority | `custodian` | `authority` | +| Lockup authority | `custodian` | `pubkey` | | _(not shown)_ | `rent_sysvar` | `account` | ### (1) Authorize @@ -340,7 +340,7 @@ _This file is generated by `programs.md.mako` via `make solana_templates`, do no | Label | Value | Type | |-------|-------|------| | Set authority for | `mint_account` | `account` | -| New authority | `new_authority` | `authority` | +| New authority | `new_authority` | `pubkey` | | Authority type | `authority_type` | `AuthorityType` | | Current authority | `current_authority` | `account` | @@ -509,7 +509,7 @@ _This file is generated by `programs.md.mako` via `make solana_templates`, do no | Label | Value | Type | |-------|-------|------| | Set authority for | `mint_account` | `account` | -| New authority | `new_authority` | `authority` | +| New authority | `new_authority` | `pubkey` | | Authority type | `authority_type` | `AuthorityType` | | Current authority | `current_authority` | `account` | diff --git a/common/defs/solana/programs.md.mako b/common/defs/solana/programs.md.mako index 6c7378d655..756e9830d4 100644 --- a/common/defs/solana/programs.md.mako +++ b/common/defs/solana/programs.md.mako @@ -9,7 +9,7 @@ ${'##'} ${program.name} ${'###'} (${instruction.id}) ${instruction.name} <% all_params = { param.name: param for param in instruction.parameters } - all_accounts = [ref.name for ref in instruction.references] + all_accounts = list(instruction.references) %> | Label | Value | Type | |-------|-------|------| diff --git a/core/src/apps/solana/README.md b/core/src/apps/solana/README.md index f32b543f3f..39ce449d2a 100644 --- a/core/src/apps/solana/README.md +++ b/core/src/apps/solana/README.md @@ -168,14 +168,22 @@ The `programs.json` file serves as a structured configuration file in the Solana - `name`: The parameter name. - `type`: The data type of the parameter, such as `u64` for 64-bit unsigned integers. - `optional`: Indicates whether the parameter is optional. - - `references`: Defines the references to accounts that this instruction requires. - - `name`: The account name. - - `is_authority`: A boolean specifying whether the account is considered an authority for this instruction. - - `optional`: Indicates whether the account is optional. + - `args`: An optional dict of arguments for the formatter, see explanation below. + - `references`: An array of account names that are used by the instruction. + - `references_required`: The number of references required by the instruction. If more `references` are specified than required, the extra ones are optional, and may or may not be present in the transaction. - `ui_properties`: Contains user interface-related information for this instruction. - `account`: Reference to one account in the references list identified by its `name` - `parameter`: Reference to one parameter in the parameters list identified by its `name` - `display_name`: A human-readable label for the parameter or account, suitable for user interfaces. + - `default_value_to_hide`: Optional. If this value is found in the account / parameter, the UI property will not be shown for confirmation. This is useful when the default value is considered safe. In particular, if the value of the property is a public key, and the special word `"signer"` is used for `default_value_to_hide`, the UI property will be hidden if the public key matches the Trezor's account. + +Certain types of parameters, specified in `types` dict of the `programs.json` file, have special formatting capabilities. +In particular, the type `token_amount` is a regular `u64` type, but the formatter function accepts additional parameters: +* a special parameter `#definitions` that will be pre-set to the loadable definitions manager +* a parameter `decimals` that specifies the number of decimals of the token +* a parameter `mint` that specifies the mint address of the token + +The corresponding parameter of `token_amount` type must provide the `args` dict, mapping the `decimals` and `mint` arguments to fields of the instruction. E.g.: in a hypothetical Swap instruction, you would have two parameters of `token_amount` type. On the first one, the `args` dict would map `decimals` to the `from_amount_decimals` field and `mint` to the `from_amount_mint` field. On the second one, the mapping would go to the `to_amount_decimals` and `to_amount_mint` fields. After the message has been parsed, the Solana app utilizes the Trezor UI engine to present all the necessary information to the user for review and confirmation. If all the programs and instructions contained within the message are recognized and known, the software ensures that all the relevant information is displayed to the user. Each piece of data, including parameters, account references, and instruction details, is presented on the Trezor's user interface for user confirmation. diff --git a/core/src/apps/solana/format.py b/core/src/apps/solana/format.py index 0242b47b48..208aecf9ff 100644 --- a/core/src/apps/solana/format.py +++ b/core/src/apps/solana/format.py @@ -3,10 +3,10 @@ from typing import TYPE_CHECKING from trezor.strings import format_amount, format_timestamp if TYPE_CHECKING: - from .transaction.instructions import Instruction + from .definitions import Definitions -def format_pubkey(_: Instruction, value: bytes | None) -> str: +def format_pubkey(value: bytes | None) -> str: from trezor.crypto import base58 if value is None: @@ -15,25 +15,31 @@ def format_pubkey(_: Instruction, value: bytes | None) -> str: return base58.encode(value) -def format_lamports(_: Instruction, value: int) -> str: +def format_lamports(value: int) -> str: formatted = format_amount(value, decimals=9) return f"{formatted} SOL" -def format_token_amount(instruction: Instruction, value: int) -> str: - assert hasattr(instruction, "decimals") # enforced in instructions.py.mako +def format_token_amount( + value: int, definitions: Definitions, decimals: int, mint: bytes +) -> str: + formatted = format_amount(value, decimals=decimals) + token = definitions.get_token(mint) + if token: + symbol = token.symbol + else: + symbol = "[UNKN]" - formatted = format_amount(value, decimals=instruction.decimals) - return f"{formatted}" + return f"{formatted} {symbol}" -def format_unix_timestamp(_: Instruction, value: int) -> str: +def format_unix_timestamp(value: int) -> str: return format_timestamp(value) -def format_int(_: Instruction, value: int) -> str: +def format_int(value: int) -> str: return str(value) -def format_identity(_: Instruction, value: str) -> str: +def format_identity(value: str) -> str: return value diff --git a/core/src/apps/solana/layout.py b/core/src/apps/solana/layout.py index 9c23fbd984..6ae4850145 100644 --- a/core/src/apps/solana/layout.py +++ b/core/src/apps/solana/layout.py @@ -84,45 +84,57 @@ async def confirm_instruction( property_template = instruction.get_property_template(ui_property.parameter) value = instruction.parsed_data[ui_property.parameter] - if property_template.is_authority and signer_public_key == value: - continue - - if property_template.is_optional and value is None: + if property_template.optional and value is None: continue if ui_property.default_value_to_hide == value: continue + if ( + property_template.is_pubkey() + and ui_property.default_value_to_hide == "signer" + and signer_public_key == value + ): + continue + + args = [] + for arg in property_template.args: + if arg == "#definitions": + args.append(definitions) + elif arg in instruction.parsed_data: + args.append(instruction.parsed_data[arg]) + elif arg in instruction.parsed_accounts: + args.append(instruction.parsed_accounts[arg][0]) + else: + raise ValueError # Invalid property template + await confirm_properties( "confirm_instruction", f"{instruction_index}/{instructions_count}: {instruction.ui_name}", ( ( ui_property.display_name, - property_template.format(instruction, value), + property_template.format(value, *args), ), ), ) elif ui_property.account is not None: - account_template = instruction.get_account_template(ui_property.account) - # optional account, skip if not present if ui_property.account not in instruction.parsed_accounts: continue account_value = instruction.parsed_accounts[ui_property.account] - if account_template.is_authority: - if signer_public_key == account_value[0]: - continue + if ui_property.default_value_to_hide == "signer" and signer_public_key == account_value[0]: + continue account_data: list[tuple[str, str]] = [] # account included in the transaction directly if len(account_value) == 2: account_description = f"{base58.encode(account_value[0])}" - if account_template.is_token_mint: - token = definitions.get_token(account_value[0]) - account_description = f"{token.symbol}\n{account_description}" + token = definitions.get_token(account_value[0]) + if token is not None: + account_description = f"{token.name}\n{account_description}" elif account_value[0] == signer_public_key: account_description = f"{account_description} ({TR.words__signer})" diff --git a/core/src/apps/solana/transaction/instruction.py b/core/src/apps/solana/transaction/instruction.py index 66d5b178a0..1824dae9c2 100644 --- a/core/src/apps/solana/transaction/instruction.py +++ b/core/src/apps/solana/transaction/instruction.py @@ -5,25 +5,20 @@ if TYPE_CHECKING: from typing_extensions import Self - from ..types import ( - Account, - AccountTemplate, - InstructionData, - PropertyTemplate, - UIProperty, - ) + from ..types import Account, InstructionData, PropertyTemplate, UIProperty class Instruction: program_id: str instruction_id: int | None - property_templates: list[PropertyTemplate] - accounts_template: list[AccountTemplate] + property_templates: tuple[PropertyTemplate, ...] + accounts_required: int + account_templates: tuple[str, ...] ui_name: str - ui_properties: list[UIProperty] + ui_properties: tuple[UIProperty, ...] parsed_data: dict[str, Any] parsed_accounts: dict[str, Account] @@ -40,7 +35,8 @@ class Instruction: @staticmethod def parse_instruction_data( - instruction_data: InstructionData, property_templates: list[PropertyTemplate] + instruction_data: InstructionData, + property_templates: tuple[PropertyTemplate, ...], ) -> dict[str, Any]: from trezor.utils import BufferReader from trezor.wire import DataError @@ -50,7 +46,7 @@ class Instruction: parsed_data = {} for property_template in property_templates: is_included = True - if property_template.is_optional: + if property_template.optional: is_included = True if reader.get() == 1 else False parsed_data[property_template.name] = ( @@ -64,18 +60,19 @@ class Instruction: @staticmethod def parse_instruction_accounts( - accounts: list[Account], accounts_template: list[AccountTemplate] + accounts: list[Account], + accounts_required: int, + account_templates: tuple[str, ...], ) -> dict[str, Account]: - parsed_account = {} - for i, account_template in enumerate(accounts_template): - if i >= len(accounts): - if account_template.optional: - continue - else: - raise ValueError # "Account is missing + parsed_accounts = {} + if len(accounts) < accounts_required: + raise ValueError # "Account is missing - parsed_account[account_template.name] = accounts[i] - return parsed_account + for i, account_name in enumerate(account_templates): + if i >= len(accounts): + break + parsed_accounts[account_name] = accounts[i] + return parsed_accounts def __init__( self, @@ -83,9 +80,10 @@ class Instruction: program_id: str, accounts: list[Account], instruction_id: int | None, - property_templates: list[PropertyTemplate], - accounts_template: list[AccountTemplate], - ui_properties: list[UIProperty], + property_templates: tuple[PropertyTemplate, ...], + accounts_required: int, + account_templates: tuple[str, ...], + ui_properties: tuple[UIProperty, ...], ui_name: str, is_program_supported: bool = True, is_instruction_supported: bool = True, @@ -97,7 +95,8 @@ class Instruction: self.instruction_id = instruction_id self.property_templates = property_templates - self.accounts_template = accounts_template + self.accounts_required = accounts_required + self.account_templates = account_templates self.ui_name = ui_name @@ -118,10 +117,12 @@ class Instruction: ) self.parsed_accounts = self.parse_instruction_accounts( - accounts, accounts_template + accounts, + accounts_required, + account_templates, ) - self.multisig_signers = accounts[len(accounts_template) :] + self.multisig_signers = accounts[len(account_templates) :] if self.multisig_signers and not supports_multisig: raise ValueError # Multisig not supported else: @@ -144,13 +145,6 @@ class Instruction: raise ValueError # Property not found - def get_account_template(self, account_name: str) -> AccountTemplate: - for account_template in self.accounts_template: - if account_template.name == account_name: - return account_template - - raise ValueError # Account not found - @classmethod def is_type_of(cls, ins: Any) -> TypeGuard[Self]: # gets overridden in `instructions.py` `FakeClass` diff --git a/core/src/apps/solana/transaction/instructions.py b/core/src/apps/solana/transaction/instructions.py index 55a123e529..76dab98317 100644 --- a/core/src/apps/solana/transaction/instructions.py +++ b/core/src/apps/solana/transaction/instructions.py @@ -1,5 +1,7 @@ # generated from instructions.py.mako +# (by running `make solana_templates` in root) # do not edit manually! + from micropython import const from typing import TYPE_CHECKING @@ -15,7 +17,7 @@ from ..format import ( format_token_amount, format_unix_timestamp, ) -from ..types import AccountTemplate, PropertyTemplate, UIProperty +from ..types import PropertyTemplate, UIProperty from .instruction import Instruction from .parse import parse_byte, parse_memo, parse_pubkey, parse_string @@ -331,11 +333,11 @@ if TYPE_CHECKING: recipient_account: Account class SystemProgramCreateAccountWithSeedInstruction(Instruction): - base: int + base: Account seed: str lamports: int space: int - owner: int + owner: Account funding_account: Account created_account: Account @@ -375,18 +377,18 @@ if TYPE_CHECKING: new_account: Account class SystemProgramAllocateWithSeedInstruction(Instruction): - base: int + base: Account seed: str space: int - owner: int + owner: Account allocated_account: Account base_account: Account class SystemProgramAssignWithSeedInstruction(Instruction): - base: int + base: Account seed: str - owner: int + owner: Account assigned_account: Account base_account: Account @@ -394,7 +396,7 @@ if TYPE_CHECKING: class SystemProgramTransferWithSeedInstruction(Instruction): lamports: int from_seed: str - from_owner: int + from_owner: Account funding_account: Account base_account: Account @@ -415,7 +417,7 @@ if TYPE_CHECKING: rent_sysvar: Account class StakeProgramAuthorizeInstruction(Instruction): - pubkey: int + pubkey: Account stake_authorize: int stake_account: Account @@ -458,7 +460,7 @@ if TYPE_CHECKING: class StakeProgramSetLockupInstruction(Instruction): unix_timestamp: int epoch: int - custodian: int + custodian: Account initialized_stake_account: Account lockup_or_withdraw_authority: Account @@ -472,10 +474,10 @@ if TYPE_CHECKING: stake_authority: Account class StakeProgramAuthorizeWithSeedInstruction(Instruction): - new_authorized_pubkey: int + new_authorized_pubkey: Account stake_authorize: int authority_seed: str - authority_owner: int + authority_owner: Account stake_account: Account stake_or_withdraw_authority: Account @@ -501,7 +503,7 @@ if TYPE_CHECKING: class StakeProgramAuthorizeCheckedWithSeedInstruction(Instruction): stake_authorize: int authority_seed: str - authority_owner: int + authority_owner: Account stake_account: Account stake_or_withdraw_authority: Account @@ -633,7 +635,7 @@ if TYPE_CHECKING: owner: Account class TokenProgramInitializeAccount2Instruction(Instruction): - owner: int + owner: Account account_to_initialize: Account mint_account: Account @@ -644,7 +646,7 @@ if TYPE_CHECKING: token_account: Account class TokenProgramInitializeAccount3Instruction(Instruction): - owner: int + owner: Account account_to_initialize: Account mint_account: Account @@ -760,7 +762,7 @@ if TYPE_CHECKING: owner: Account class Token2022ProgramInitializeAccount2Instruction(Instruction): - owner: int + owner: Account account_to_initialize: Account mint_account: Account @@ -771,7 +773,7 @@ if TYPE_CHECKING: token_account: Account class Token2022ProgramInitializeAccount3Instruction(Instruction): - owner: int + owner: Account account_to_initialize: Account mint_account: Account @@ -841,7 +843,7 @@ def get_instruction_id_length(program_id: str) -> int: return 0 -def format_StakeAuthorize(_: Instruction, value: int) -> str: +def format_StakeAuthorize(value: int) -> str: if value == 0: return "Stake" if value == 1: @@ -849,7 +851,7 @@ def format_StakeAuthorize(_: Instruction, value: int) -> str: raise DataError("Unknown value") -def format_AuthorityType(_: Instruction, value: int) -> str: +def format_AuthorityType(value: int) -> str: if value == 0: return "Mint tokens" if value == 1: @@ -874,66 +876,51 @@ def get_instruction( program_id, instruction_accounts, _SYSTEM_PROGRAM_ID_INS_CREATE_ACCOUNT, - [ + ( PropertyTemplate( "lamports", False, - False, read_uint64_le, format_lamports, + (), ), PropertyTemplate( "space", False, - False, read_uint64_le, format_int, + (), ), PropertyTemplate( "owner", - True, False, parse_pubkey, format_pubkey, + (), ), - ], - [ - AccountTemplate( - "funding_account", - True, - False, - False, - ), - AccountTemplate( - "new_account", - False, - False, - False, - ), - ], - [ + ), + 2, + ("funding_account", "new_account"), + ( UIProperty( None, "new_account", "Create account", - False, None, ), UIProperty( "lamports", None, "Deposit", - False, None, ), UIProperty( None, "funding_account", "From", - False, - None, + "signer", ), - ], + ), "System Program: Create Account", True, True, @@ -947,39 +934,31 @@ def get_instruction( program_id, instruction_accounts, _SYSTEM_PROGRAM_ID_INS_ASSIGN, - [ + ( PropertyTemplate( "owner", - True, False, parse_pubkey, format_pubkey, + (), ), - ], - [ - AccountTemplate( - "assigned_account", - True, - False, - False, - ), - ], - [ + ), + 1, + ("assigned_account",), + ( UIProperty( None, "assigned_account", "Assign account", - False, - None, + "signer", ), UIProperty( "owner", None, "Assign account to program", - False, - None, + "signer", ), - ], + ), "System Program: Assign", True, True, @@ -993,52 +972,37 @@ def get_instruction( program_id, instruction_accounts, _SYSTEM_PROGRAM_ID_INS_TRANSFER, - [ + ( PropertyTemplate( "lamports", False, - False, read_uint64_le, format_lamports, + (), ), - ], - [ - AccountTemplate( - "funding_account", - True, - False, - False, - ), - AccountTemplate( - "recipient_account", - False, - False, - False, - ), - ], - [ + ), + 2, + ("funding_account", "recipient_account"), + ( UIProperty( None, "recipient_account", "Recipient", - False, None, ), UIProperty( "lamports", None, "Amount", - False, None, ), UIProperty( None, "funding_account", "Sender", - False, - None, + "signer", ), - ], + ), "System Program: Transfer", True, True, @@ -1052,86 +1016,65 @@ def get_instruction( program_id, instruction_accounts, _SYSTEM_PROGRAM_ID_INS_CREATE_ACCOUNT_WITH_SEED, - [ + ( PropertyTemplate( "base", False, - False, parse_pubkey, format_pubkey, + (), ), PropertyTemplate( "seed", False, - False, parse_string, format_identity, + (), ), PropertyTemplate( "lamports", False, - False, read_uint64_le, format_lamports, + (), ), PropertyTemplate( "space", False, - False, read_uint64_le, format_int, + (), ), PropertyTemplate( "owner", False, - False, parse_pubkey, format_pubkey, + (), ), - ], - [ - AccountTemplate( - "funding_account", - True, - False, - False, - ), - AccountTemplate( - "created_account", - False, - False, - False, - ), - AccountTemplate( - "base_account", - True, - True, - False, - ), - ], - [ + ), + 2, + ("funding_account", "created_account", "base_account"), + ( UIProperty( None, "created_account", "Create account", - False, None, ), UIProperty( "lamports", None, "Deposit", - False, None, ), UIProperty( None, "funding_account", "From", - False, - None, + "signer", ), - ], + ), "System Program: Create Account With Seed", True, True, @@ -1145,43 +1088,23 @@ def get_instruction( program_id, instruction_accounts, _SYSTEM_PROGRAM_ID_INS_ADVANCE_NONCE_ACCOUNT, - [], - [ - AccountTemplate( - "nonce_account", - False, - False, - False, - ), - AccountTemplate( - "recent_blockhashes_sysvar", - False, - False, - False, - ), - AccountTemplate( - "nonce_authority", - True, - False, - False, - ), - ], - [ + (), + 3, + ("nonce_account", "recent_blockhashes_sysvar", "nonce_authority"), + ( UIProperty( None, "nonce_account", "Advance nonce", - False, None, ), UIProperty( None, "nonce_authority", "Authorized by", - False, - None, + "signer", ), - ], + ), "System Program: Advance Nonce Account", True, True, @@ -1195,77 +1118,49 @@ def get_instruction( program_id, instruction_accounts, _SYSTEM_PROGRAM_ID_INS_WITHDRAW_NONCE_ACCOUNT, - [ + ( PropertyTemplate( "lamports", False, - False, read_uint64_le, format_lamports, + (), ), - ], - [ - AccountTemplate( - "nonce_account", - False, - False, - False, - ), - AccountTemplate( - "recipient_account", - False, - False, - False, - ), - AccountTemplate( - "recent_blockhashes_sysvar", - False, - False, - False, - ), - AccountTemplate( - "rent_sysvar", - False, - False, - False, - ), - AccountTemplate( - "nonce_authority", - True, - False, - False, - ), - ], - [ + ), + 5, + ( + "nonce_account", + "recipient_account", + "recent_blockhashes_sysvar", + "rent_sysvar", + "nonce_authority", + ), + ( UIProperty( "lamports", None, "Nonce withdraw", - False, None, ), UIProperty( None, "nonce_account", "From", - False, None, ), UIProperty( None, "recipient_account", "To", - False, None, ), UIProperty( None, "nonce_authority", "Authorized by", - False, - None, + "signer", ), - ], + ), "System Program: Withdraw Nonce Account", True, True, @@ -1279,51 +1174,31 @@ def get_instruction( program_id, instruction_accounts, _SYSTEM_PROGRAM_ID_INS_INITIALIZE_NONCE_ACCOUNT, - [ + ( PropertyTemplate( "nonce_authority", - True, False, parse_pubkey, format_pubkey, + (), ), - ], - [ - AccountTemplate( - "nonce_account", - False, - False, - False, - ), - AccountTemplate( - "recent_blockhashes_sysvar", - False, - False, - False, - ), - AccountTemplate( - "rent_sysvar", - False, - False, - False, - ), - ], - [ + ), + 3, + ("nonce_account", "recent_blockhashes_sysvar", "rent_sysvar"), + ( UIProperty( None, "nonce_account", "Initialize nonce account", - False, None, ), UIProperty( "nonce_authority", None, "New authority", - False, - None, + "signer", ), - ], + ), "System Program: Initialize Nonce Account", True, True, @@ -1337,52 +1212,37 @@ def get_instruction( program_id, instruction_accounts, _SYSTEM_PROGRAM_ID_INS_AUTHORIZE_NONCE_ACCOUNT, - [ + ( PropertyTemplate( "nonce_authority", - True, False, parse_pubkey, format_pubkey, + (), ), - ], - [ - AccountTemplate( - "nonce_account", - False, - False, - False, - ), - AccountTemplate( - "nonce_authority", - True, - False, - False, - ), - ], - [ + ), + 2, + ("nonce_account", "nonce_authority"), + ( UIProperty( None, "nonce_account", "Set nonce authority", - False, None, ), UIProperty( "nonce_authority", None, "New authority", - False, - None, + "signer", ), UIProperty( None, "nonce_authority", "Authorized by", - False, - None, + "signer", ), - ], + ), "System Program: Authorize Nonce Account", True, True, @@ -1396,39 +1256,31 @@ def get_instruction( program_id, instruction_accounts, _SYSTEM_PROGRAM_ID_INS_ALLOCATE, - [ + ( PropertyTemplate( "space", False, - False, read_uint64_le, format_int, + (), ), - ], - [ - AccountTemplate( - "new_account", - True, - False, - False, - ), - ], - [ + ), + 1, + ("new_account",), + ( UIProperty( None, "new_account", "Allocate account", - False, - None, + "signer", ), UIProperty( "space", None, "Data size", - False, None, ), - ], + ), "System Program: Allocate", True, True, @@ -1442,66 +1294,52 @@ def get_instruction( program_id, instruction_accounts, _SYSTEM_PROGRAM_ID_INS_ALLOCATE_WITH_SEED, - [ + ( PropertyTemplate( "base", False, - False, parse_pubkey, format_pubkey, + (), ), PropertyTemplate( "seed", False, - False, parse_string, format_identity, + (), ), PropertyTemplate( "space", False, - False, read_uint64_le, format_int, + (), ), PropertyTemplate( "owner", False, - False, parse_pubkey, format_pubkey, + (), ), - ], - [ - AccountTemplate( - "allocated_account", - False, - False, - False, - ), - AccountTemplate( - "base_account", - True, - False, - False, - ), - ], - [ + ), + 2, + ("allocated_account", "base_account"), + ( UIProperty( None, "allocated_account", "Allocate data for account", - False, None, ), UIProperty( "space", None, "Data size", - False, None, ), - ], + ), "System Program: Allocate With Seed", True, True, @@ -1515,59 +1353,45 @@ def get_instruction( program_id, instruction_accounts, _SYSTEM_PROGRAM_ID_INS_ASSIGN_WITH_SEED, - [ + ( PropertyTemplate( "base", False, - False, parse_pubkey, format_pubkey, + (), ), PropertyTemplate( "seed", False, - False, parse_string, format_identity, + (), ), PropertyTemplate( "owner", False, - False, parse_pubkey, format_pubkey, + (), ), - ], - [ - AccountTemplate( - "assigned_account", - False, - False, - False, - ), - AccountTemplate( - "base_account", - True, - False, - False, - ), - ], - [ + ), + 2, + ("assigned_account", "base_account"), + ( UIProperty( None, "assigned_account", "Assign account", - False, None, ), UIProperty( "owner", None, "Assign account to program", - False, None, ), - ], + ), "System Program: Assign With Seed", True, True, @@ -1581,72 +1405,51 @@ def get_instruction( program_id, instruction_accounts, _SYSTEM_PROGRAM_ID_INS_TRANSFER_WITH_SEED, - [ + ( PropertyTemplate( "lamports", False, - False, read_uint64_le, format_lamports, + (), ), PropertyTemplate( "from_seed", False, - False, parse_string, format_identity, + (), ), PropertyTemplate( "from_owner", False, - False, parse_pubkey, format_pubkey, + (), ), - ], - [ - AccountTemplate( - "funding_account", - False, - False, - False, - ), - AccountTemplate( - "base_account", - True, - False, - False, - ), - AccountTemplate( - "recipient_account", - False, - False, - False, - ), - ], - [ + ), + 3, + ("funding_account", "base_account", "recipient_account"), + ( UIProperty( None, "recipient_account", "Recipient", - False, None, ), UIProperty( "lamports", None, "Amount", - False, None, ), UIProperty( None, "funding_account", "Sender", - False, None, ), - ], + ), "System Program: Transfer With Seed", True, True, @@ -1660,24 +1463,17 @@ def get_instruction( program_id, instruction_accounts, _SYSTEM_PROGRAM_ID_INS_UPGRADE_NONCE_ACCOUNT, - [], - [ - AccountTemplate( - "nonce_account", - False, - False, - False, - ), - ], - [ + (), + 1, + ("nonce_account",), + ( UIProperty( None, "nonce_account", "Upgrade nonce account", - False, None, ), - ], + ), "System Program: Upgrade Nonce Account", True, True, @@ -1690,9 +1486,10 @@ def get_instruction( program_id, instruction_accounts, instruction_id, - [], - [], - [], + (), + 0, + (), + (), "System Program", True, False, @@ -1706,101 +1503,83 @@ def get_instruction( program_id, instruction_accounts, _STAKE_PROGRAM_ID_INS_INITIALIZE, - [ + ( PropertyTemplate( "staker", - True, False, parse_pubkey, format_pubkey, + (), ), PropertyTemplate( "withdrawer", - True, False, parse_pubkey, format_pubkey, + (), ), PropertyTemplate( "unix_timestamp", False, - False, read_uint64_le, format_unix_timestamp, + (), ), PropertyTemplate( "epoch", False, - False, read_uint64_le, format_int, + (), ), PropertyTemplate( "custodian", - True, False, parse_pubkey, format_pubkey, + (), ), - ], - [ - AccountTemplate( - "uninitialized_stake_account", - False, - False, - False, - ), - AccountTemplate( - "rent_sysvar", - False, - False, - False, - ), - ], - [ + ), + 2, + ("uninitialized_stake_account", "rent_sysvar"), + ( UIProperty( None, "uninitialized_stake_account", "Initialize stake account", - False, None, ), UIProperty( "staker", None, "New stake authority", - False, - None, + "signer", ), UIProperty( "withdrawer", None, "New withdraw authority", - False, - None, + "signer", ), UIProperty( "unix_timestamp", None, "Lockup time", - False, 0, ), UIProperty( "epoch", None, "Lockup epoch", - False, 0, ), UIProperty( "custodian", None, "Lockup authority", - False, - None, + "signer", ), - ], + ), "Stake Program: Initialize", True, True, @@ -1814,85 +1593,61 @@ def get_instruction( program_id, instruction_accounts, _STAKE_PROGRAM_ID_INS_AUTHORIZE, - [ + ( PropertyTemplate( "pubkey", False, - False, parse_pubkey, format_pubkey, + (), ), PropertyTemplate( "stake_authorize", False, - False, read_uint32_le, format_StakeAuthorize, + (), ), - ], - [ - AccountTemplate( - "stake_account", - False, - False, - False, - ), - AccountTemplate( - "clock_sysvar", - False, - False, - False, - ), - AccountTemplate( - "stake_or_withdraw_authority", - True, - False, - False, - ), - AccountTemplate( - "lockup_authority", - True, - True, - False, - ), - ], - [ + ), + 3, + ( + "stake_account", + "clock_sysvar", + "stake_or_withdraw_authority", + "lockup_authority", + ), + ( UIProperty( None, "stake_account", "Set authority for", - False, None, ), UIProperty( "pubkey", None, "New authority", - False, None, ), UIProperty( "stake_authorize", None, "Authority type", - False, None, ), UIProperty( None, "stake_or_withdraw_authority", "Authorized by", - False, - None, + "signer", ), UIProperty( None, "lockup_authority", "Custodian", - False, - None, + "signer", ), - ], + ), "Stake Program: Authorize", True, True, @@ -1906,68 +1661,36 @@ def get_instruction( program_id, instruction_accounts, _STAKE_PROGRAM_ID_INS_DELEGATE_STAKE, - [], - [ - AccountTemplate( - "initialized_stake_account", - False, - False, - False, - ), - AccountTemplate( - "vote_account", - False, - False, - False, - ), - AccountTemplate( - "clock_sysvar", - False, - False, - False, - ), - AccountTemplate( - "stake_history_sysvar", - False, - False, - False, - ), - AccountTemplate( - "config_account", - False, - False, - False, - ), - AccountTemplate( - "stake_authority", - True, - False, - False, - ), - ], - [ + (), + 6, + ( + "initialized_stake_account", + "vote_account", + "clock_sysvar", + "stake_history_sysvar", + "config_account", + "stake_authority", + ), + ( UIProperty( None, "initialized_stake_account", "Delegate from", - False, None, ), UIProperty( None, "stake_authority", "Authorized by", - False, - None, + "signer", ), UIProperty( None, "vote_account", "Vote account", - False, None, ), - ], + ), "Stake Program: Delegate Stake", True, True, @@ -1981,65 +1704,43 @@ def get_instruction( program_id, instruction_accounts, _STAKE_PROGRAM_ID_INS_SPLIT, - [ + ( PropertyTemplate( "lamports", False, - False, read_uint64_le, format_lamports, + (), ), - ], - [ - AccountTemplate( - "stake_account", - False, - False, - False, - ), - AccountTemplate( - "uninitialized_stake_account", - False, - False, - False, - ), - AccountTemplate( - "stake_authority", - True, - False, - False, - ), - ], - [ + ), + 3, + ("stake_account", "uninitialized_stake_account", "stake_authority"), + ( UIProperty( "lamports", None, "Split stake", - False, None, ), UIProperty( None, "stake_account", "From", - False, None, ), UIProperty( None, "uninitialized_stake_account", "To", - False, None, ), UIProperty( None, "stake_authority", "Authorized by", - False, - None, + "signer", ), - ], + ), "Stake Program: Split", True, True, @@ -2053,83 +1754,50 @@ def get_instruction( program_id, instruction_accounts, _STAKE_PROGRAM_ID_INS_WITHDRAW, - [ + ( PropertyTemplate( "lamports", False, - False, read_uint64_le, format_lamports, + (), ), - ], - [ - AccountTemplate( - "stake_account", - False, - False, - False, - ), - AccountTemplate( - "recipient_account", - False, - False, - False, - ), - AccountTemplate( - "clock_sysvar", - False, - False, - False, - ), - AccountTemplate( - "stake_history_sysvar", - False, - False, - False, - ), - AccountTemplate( - "withdrawal_authority", - True, - False, - False, - ), - AccountTemplate( - "lockup_authority", - True, - True, - False, - ), - ], - [ + ), + 5, + ( + "stake_account", + "recipient_account", + "clock_sysvar", + "stake_history_sysvar", + "withdrawal_authority", + "lockup_authority", + ), + ( UIProperty( "lamports", None, "Withdraw stake", - False, None, ), UIProperty( None, "stake_account", "From", - False, None, ), UIProperty( None, "recipient_account", "To", - False, None, ), UIProperty( None, "withdrawal_authority", "Authorized by", - False, - None, + "signer", ), - ], + ), "Stake Program: Withdraw", True, True, @@ -2143,43 +1811,23 @@ def get_instruction( program_id, instruction_accounts, _STAKE_PROGRAM_ID_INS_DEACTIVATE, - [], - [ - AccountTemplate( - "delegated_stake_account", - False, - False, - False, - ), - AccountTemplate( - "clock_sysvar", - False, - False, - False, - ), - AccountTemplate( - "stake_authority", - True, - False, - False, - ), - ], - [ + (), + 3, + ("delegated_stake_account", "clock_sysvar", "stake_authority"), + ( UIProperty( None, "delegated_stake_account", "Deactivate stake account", - False, None, ), UIProperty( None, "stake_authority", "Authorized by", - False, - None, + "signer", ), - ], + ), "Stake Program: Deactivate", True, True, @@ -2193,80 +1841,63 @@ def get_instruction( program_id, instruction_accounts, _STAKE_PROGRAM_ID_INS_SET_LOCKUP, - [ + ( PropertyTemplate( "unix_timestamp", - False, True, read_uint64_le, format_unix_timestamp, + (), ), PropertyTemplate( "epoch", - False, True, read_uint64_le, format_int, + (), ), PropertyTemplate( "custodian", - False, True, parse_pubkey, format_pubkey, + (), ), - ], - [ - AccountTemplate( - "initialized_stake_account", - False, - False, - False, - ), - AccountTemplate( - "lockup_or_withdraw_authority", - True, - False, - False, - ), - ], - [ + ), + 2, + ("initialized_stake_account", "lockup_or_withdraw_authority"), + ( UIProperty( None, "initialized_stake_account", "Set lockup for account", - False, None, ), UIProperty( "unix_timestamp", None, "Time", - False, 0, ), UIProperty( "epoch", None, "Epoch", - False, 0, ), UIProperty( "custodian", None, "New lockup authority", - False, None, ), UIProperty( None, "lockup_or_withdraw_authority", "Authorized by", - False, - None, + "signer", ), - ], + ), "Stake Program: Set Lockup", True, True, @@ -2280,62 +1911,35 @@ def get_instruction( program_id, instruction_accounts, _STAKE_PROGRAM_ID_INS_MERGE, - [], - [ - AccountTemplate( - "destination_stake_account", - False, - False, - False, - ), - AccountTemplate( - "source_stake_account", - False, - False, - False, - ), - AccountTemplate( - "clock_sysvar", - False, - False, - False, - ), - AccountTemplate( - "stake_history_sysvar", - False, - False, - False, - ), - AccountTemplate( - "stake_authority", - True, - False, - False, - ), - ], - [ + (), + 5, + ( + "destination_stake_account", + "source_stake_account", + "clock_sysvar", + "stake_history_sysvar", + "stake_authority", + ), + ( UIProperty( None, "source_stake_account", "Merge stake account", - False, None, ), UIProperty( None, "destination_stake_account", "Into", - False, None, ), UIProperty( None, "stake_authority", "Authorized by", - False, - None, + "signer", ), - ], + ), "Stake Program: Merge", True, True, @@ -2349,99 +1953,75 @@ def get_instruction( program_id, instruction_accounts, _STAKE_PROGRAM_ID_INS_AUTHORIZE_WITH_SEED, - [ + ( PropertyTemplate( "new_authorized_pubkey", False, - False, parse_pubkey, format_pubkey, + (), ), PropertyTemplate( "stake_authorize", False, - False, read_uint32_le, format_StakeAuthorize, + (), ), PropertyTemplate( "authority_seed", False, - False, parse_string, format_identity, + (), ), PropertyTemplate( "authority_owner", False, - False, parse_pubkey, format_pubkey, + (), ), - ], - [ - AccountTemplate( - "stake_account", - False, - False, - False, - ), - AccountTemplate( - "stake_or_withdraw_authority", - True, - False, - False, - ), - AccountTemplate( - "clock_sysvar", - False, - False, - False, - ), - AccountTemplate( - "lockup_authority", - True, - True, - False, - ), - ], - [ + ), + 3, + ( + "stake_account", + "stake_or_withdraw_authority", + "clock_sysvar", + "lockup_authority", + ), + ( UIProperty( None, "stake_account", "Set authority for", - False, None, ), UIProperty( "new_authorized_pubkey", None, "New authority", - False, None, ), UIProperty( "stake_authorize", None, "Authority type", - False, None, ), UIProperty( None, "stake_or_withdraw_authority", "Authorized by", - False, - None, + "signer", ), UIProperty( None, "lockup_authority", "Custodian", - False, - None, + "signer", ), - ], + ), "Stake Program: Authorize With Seed", True, True, @@ -2455,56 +2035,34 @@ def get_instruction( program_id, instruction_accounts, _STAKE_PROGRAM_ID_INS_INITIALIZE_CHECKED, - [], - [ - AccountTemplate( - "uninitialized_stake_account", - False, - False, - False, - ), - AccountTemplate( - "rent_sysvar", - False, - False, - False, - ), - AccountTemplate( - "stake_authority", - False, - False, - False, - ), - AccountTemplate( - "withdrawal_authority", - True, - False, - False, - ), - ], - [ + (), + 4, + ( + "uninitialized_stake_account", + "rent_sysvar", + "stake_authority", + "withdrawal_authority", + ), + ( UIProperty( None, "uninitialized_stake_account", "Uninitialized stake account", - False, None, ), UIProperty( None, "stake_authority", "New stake authority", - False, None, ), UIProperty( None, "withdrawal_authority", "New withdraw authority", - False, - None, + "signer", ), - ], + ), "Stake Program: Initialize Checked", True, True, @@ -2518,84 +2076,55 @@ def get_instruction( program_id, instruction_accounts, _STAKE_PROGRAM_ID_INS_AUTHORIZE_CHECKED, - [ + ( PropertyTemplate( "stake_authorize", False, - False, read_uint32_le, format_StakeAuthorize, + (), ), - ], - [ - AccountTemplate( - "stake_account", - False, - False, - False, - ), - AccountTemplate( - "clock_sysvar", - False, - False, - False, - ), - AccountTemplate( - "stake_or_withdraw_authority", - True, - False, - False, - ), - AccountTemplate( - "new_stake_or_withdraw_authority", - True, - False, - False, - ), - AccountTemplate( - "lockup_authority", - True, - True, - False, - ), - ], - [ + ), + 4, + ( + "stake_account", + "clock_sysvar", + "stake_or_withdraw_authority", + "new_stake_or_withdraw_authority", + "lockup_authority", + ), + ( UIProperty( None, "stake_account", "Set authority for", - False, None, ), UIProperty( None, "new_stake_or_withdraw_authority", "New authority", - False, - None, + "signer", ), UIProperty( "stake_authorize", None, "Authority type", - False, None, ), UIProperty( None, "stake_or_withdraw_authority", "Authorized by", - False, - None, + "signer", ), UIProperty( None, "lockup_authority", "Custodian", - False, - None, + "signer", ), - ], + ), "Stake Program: Authorize Checked", True, True, @@ -2609,98 +2138,69 @@ def get_instruction( program_id, instruction_accounts, _STAKE_PROGRAM_ID_INS_AUTHORIZE_CHECKED_WITH_SEED, - [ + ( PropertyTemplate( "stake_authorize", False, - False, read_uint32_le, format_StakeAuthorize, + (), ), PropertyTemplate( "authority_seed", False, - False, parse_string, format_identity, + (), ), PropertyTemplate( "authority_owner", False, - False, parse_pubkey, format_pubkey, + (), ), - ], - [ - AccountTemplate( - "stake_account", - False, - False, - False, - ), - AccountTemplate( - "stake_or_withdraw_authority", - True, - False, - False, - ), - AccountTemplate( - "clock_sysvar", - False, - False, - False, - ), - AccountTemplate( - "new_stake_or_withdraw_authority", - True, - False, - False, - ), - AccountTemplate( - "lockup_authority", - True, - True, - False, - ), - ], - [ + ), + 4, + ( + "stake_account", + "stake_or_withdraw_authority", + "clock_sysvar", + "new_stake_or_withdraw_authority", + "lockup_authority", + ), + ( UIProperty( None, "stake_account", "Set authority for", - False, None, ), UIProperty( None, "new_stake_or_withdraw_authority", "New authority", - False, - None, + "signer", ), UIProperty( "stake_authorize", None, "Authority type", - False, None, ), UIProperty( None, "stake_or_withdraw_authority", "Authorized by", - False, - None, + "signer", ), UIProperty( None, "lockup_authority", "Custodian", - False, - None, + "signer", ), - ], + ), "Stake Program: Authorize Checked With Seed", True, True, @@ -2714,79 +2214,60 @@ def get_instruction( program_id, instruction_accounts, _STAKE_PROGRAM_ID_INS_SET_LOCKUP_CHECKED, - [ + ( PropertyTemplate( "unix_timestamp", - False, True, read_uint64_le, format_unix_timestamp, + (), ), PropertyTemplate( "epoch", - False, True, read_uint64_le, format_int, + (), ), - ], - [ - AccountTemplate( - "stake_account", - False, - False, - False, - ), - AccountTemplate( - "lockup_or_withdraw_authority", - True, - False, - False, - ), - AccountTemplate( - "new_lockup_authority", - True, - True, - False, - ), - ], - [ + ), + 2, + ( + "stake_account", + "lockup_or_withdraw_authority", + "new_lockup_authority", + ), + ( UIProperty( None, "stake_account", "Set lockup for stake account", - False, None, ), UIProperty( "unix_timestamp", None, "Time", - False, 0, ), UIProperty( "epoch", None, "Epoch", - False, 0, ), UIProperty( None, "new_lockup_authority", "New lockup authority", - False, - None, + "signer", ), UIProperty( None, "lockup_or_withdraw_authority", "Authorized by", - False, - None, + "signer", ), - ], + ), "Stake Program: Set Lockup Checked", True, True, @@ -2799,9 +2280,10 @@ def get_instruction( program_id, instruction_accounts, instruction_id, - [], - [], - [], + (), + 0, + (), + (), "Stake Program", True, False, @@ -2815,25 +2297,25 @@ def get_instruction( program_id, instruction_accounts, _COMPUTE_BUDGET_PROGRAM_ID_INS_REQUEST_HEAP_FRAME, - [ + ( PropertyTemplate( "bytes", False, - False, read_uint32_le, format_int, + (), ), - ], - [], - [ + ), + 0, + (), + ( UIProperty( "bytes", None, "Bytes", - False, None, ), - ], + ), "Compute Budget Program: Request Heap Frame", True, True, @@ -2847,25 +2329,25 @@ def get_instruction( program_id, instruction_accounts, _COMPUTE_BUDGET_PROGRAM_ID_INS_SET_COMPUTE_UNIT_LIMIT, - [ + ( PropertyTemplate( "units", False, - False, read_uint32_le, format_int, + (), ), - ], - [], - [ + ), + 0, + (), + ( UIProperty( "units", None, "Units", - False, None, ), - ], + ), "Compute Budget Program: Set Compute Unit Limit", True, True, @@ -2879,25 +2361,25 @@ def get_instruction( program_id, instruction_accounts, _COMPUTE_BUDGET_PROGRAM_ID_INS_SET_COMPUTE_UNIT_PRICE, - [ + ( PropertyTemplate( "lamports", False, - False, read_uint64_le, format_int, + (), ), - ], - [], - [ + ), + 0, + (), + ( UIProperty( "lamports", None, "Compute unit price", - False, None, ), - ], + ), "Compute Budget Program: Set Compute Unit Price", True, True, @@ -2910,9 +2392,10 @@ def get_instruction( program_id, instruction_accounts, instruction_id, - [], - [], - [], + (), + 0, + (), + (), "Compute Budget Program", True, False, @@ -2926,56 +2409,29 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_PROGRAM_ID_INS_INITIALIZE_ACCOUNT, - [], - [ - AccountTemplate( - "account_to_initialize", - False, - False, - False, - ), - AccountTemplate( - "mint_account", - False, - False, - False, - ), - AccountTemplate( - "owner", - False, - False, - False, - ), - AccountTemplate( - "rent_sysvar", - False, - False, - False, - ), - ], - [ + (), + 4, + ("account_to_initialize", "mint_account", "owner", "rent_sysvar"), + ( UIProperty( None, "account_to_initialize", "Initialize account", - False, None, ), UIProperty( None, "owner", "Owner", - False, None, ), UIProperty( None, "mint_account", "For token", - False, None, ), - ], + ), "Token Program: Initialize Account", True, True, @@ -2989,51 +2445,31 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_PROGRAM_ID_INS_INITIALIZE_MULTISIG, - [ + ( PropertyTemplate( "number_of_signers", False, - False, parse_byte, format_int, + (), ), - ], - [ - AccountTemplate( - "multisig_account", - False, - False, - False, - ), - AccountTemplate( - "rent_sysvar", - False, - False, - False, - ), - AccountTemplate( - "signer_accounts", - False, - False, - False, - ), - ], - [ + ), + 3, + ("multisig_account", "rent_sysvar", "signer_accounts"), + ( UIProperty( None, "multisig_account", "Initialize multisig", - False, None, ), UIProperty( None, "signer_accounts", "Required signers", - False, None, ), - ], + ), "Token Program: Initialize Multisig", True, True, @@ -3047,65 +2483,43 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_PROGRAM_ID_INS_TRANSFER, - [ + ( PropertyTemplate( "amount", False, - False, read_uint64_le, format_int, + (), ), - ], - [ - AccountTemplate( - "source_account", - False, - False, - False, - ), - AccountTemplate( - "destination_account", - False, - False, - False, - ), - AccountTemplate( - "owner", - True, - False, - False, - ), - ], - [ + ), + 3, + ("source_account", "destination_account", "owner"), + ( UIProperty( None, "destination_account", "Recipient", - False, None, ), UIProperty( "amount", None, "Amount", - False, None, ), UIProperty( None, "source_account", "From", - False, None, ), UIProperty( None, "owner", "Owner", - False, - None, + "signer", ), - ], + ), "Token Program: Transfer", True, True, @@ -3119,58 +2533,37 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_PROGRAM_ID_INS_APPROVE, - [ + ( PropertyTemplate( "amount", False, - False, read_uint64_le, format_int, + (), ), - ], - [ - AccountTemplate( - "source_account", - False, - False, - False, - ), - AccountTemplate( - "delegate_account", - False, - False, - False, - ), - AccountTemplate( - "owner", - True, - False, - False, - ), - ], - [ + ), + 3, + ("source_account", "delegate_account", "owner"), + ( UIProperty( None, "delegate_account", "Approve delegate", - False, None, ), UIProperty( "amount", None, "Allowance", - False, None, ), UIProperty( None, "owner", "Owner", - False, - None, + "signer", ), - ], + ), "Token Program: Approve", True, True, @@ -3184,37 +2577,23 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_PROGRAM_ID_INS_REVOKE, - [], - [ - AccountTemplate( - "source_account", - False, - False, - False, - ), - AccountTemplate( - "owner", - True, - False, - False, - ), - ], - [ + (), + 2, + ("source_account", "owner"), + ( UIProperty( None, "source_account", "Revoke delegate", - False, None, ), UIProperty( None, "owner", "Owner", - False, - None, + "signer", ), - ], + ), "Token Program: Revoke", True, True, @@ -3228,66 +2607,50 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_PROGRAM_ID_INS_SET_AUTHORITY, - [ + ( PropertyTemplate( "authority_type", False, - False, parse_byte, format_AuthorityType, + (), ), PropertyTemplate( "new_authority", True, - True, parse_pubkey, format_pubkey, + (), ), - ], - [ - AccountTemplate( - "mint_account", - False, - False, - False, - ), - AccountTemplate( - "current_authority", - True, - False, - False, - ), - ], - [ + ), + 2, + ("mint_account", "current_authority"), + ( UIProperty( None, "mint_account", "Set authority for", - False, None, ), UIProperty( "new_authority", None, "New authority", - False, - None, + "signer", ), UIProperty( "authority_type", None, "Authority type", - False, None, ), UIProperty( None, "current_authority", "Current authority", - False, - None, + "signer", ), - ], + ), "Token Program: Set Authority", True, True, @@ -3301,65 +2664,43 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_PROGRAM_ID_INS_MINT_TO, - [ + ( PropertyTemplate( "amount", False, - False, read_uint64_le, format_int, + (), ), - ], - [ - AccountTemplate( - "mint", - False, - False, - True, - ), - AccountTemplate( - "account_to_mint", - False, - False, - False, - ), - AccountTemplate( - "minting_authority", - True, - False, - False, - ), - ], - [ + ), + 3, + ("mint", "account_to_mint", "minting_authority"), + ( UIProperty( None, "mint", "Mint token", - False, None, ), UIProperty( "amount", None, "Mint amount", - False, None, ), UIProperty( None, "account_to_mint", "To", - False, None, ), UIProperty( None, "minting_authority", "Mint authority", - False, - None, + "signer", ), - ], + ), "Token Program: Mint To", True, True, @@ -3373,65 +2714,43 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_PROGRAM_ID_INS_BURN, - [ + ( PropertyTemplate( "amount", False, - False, read_uint64_le, format_int, + (), ), - ], - [ - AccountTemplate( - "account_to_burn_from", - False, - False, - False, - ), - AccountTemplate( - "token_mint", - False, - False, - True, - ), - AccountTemplate( - "owner", - True, - False, - False, - ), - ], - [ + ), + 3, + ("account_to_burn_from", "token_mint", "owner"), + ( UIProperty( None, "token_mint", "Burn token", - False, None, ), UIProperty( "amount", None, "Burn amount", - False, None, ), UIProperty( None, "account_to_burn_from", "From", - False, None, ), UIProperty( None, "owner", "Mint authority", - False, - None, + "signer", ), - ], + ), "Token Program: Burn", True, True, @@ -3445,50 +2764,29 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_PROGRAM_ID_INS_CLOSE_ACCOUNT, - [], - [ - AccountTemplate( - "account_to_close", - False, - False, - False, - ), - AccountTemplate( - "destination_account", - False, - False, - False, - ), - AccountTemplate( - "owner", - True, - False, - False, - ), - ], - [ + (), + 3, + ("account_to_close", "destination_account", "owner"), + ( UIProperty( None, "account_to_close", "Close account", - False, None, ), UIProperty( None, "destination_account", "Withdraw to", - False, None, ), UIProperty( None, "owner", "Owner", - False, - None, + "signer", ), - ], + ), "Token Program: Close Account", True, True, @@ -3502,50 +2800,29 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_PROGRAM_ID_INS_FREEZE_ACCOUNT, - [], - [ - AccountTemplate( - "account_to_freeze", - False, - False, - False, - ), - AccountTemplate( - "token_mint", - False, - False, - True, - ), - AccountTemplate( - "freeze_authority", - True, - False, - False, - ), - ], - [ + (), + 3, + ("account_to_freeze", "token_mint", "freeze_authority"), + ( UIProperty( None, "account_to_freeze", "Freeze account", - False, None, ), UIProperty( None, "token_mint", "Token", - False, None, ), UIProperty( None, "freeze_authority", "Owner", - False, - None, + "signer", ), - ], + ), "Token Program: Freeze Account", True, True, @@ -3559,50 +2836,29 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_PROGRAM_ID_INS_THAW_ACCOUNT, - [], - [ - AccountTemplate( - "account_to_freeze", - False, - False, - False, - ), - AccountTemplate( - "token_mint", - False, - False, - True, - ), - AccountTemplate( - "freeze_authority", - True, - False, - False, - ), - ], - [ + (), + 3, + ("account_to_freeze", "token_mint", "freeze_authority"), + ( UIProperty( None, "account_to_freeze", "Thaw account", - False, None, ), UIProperty( None, "token_mint", "Token", - False, None, ), UIProperty( None, "freeze_authority", "Owner", - False, - None, + "signer", ), - ], + ), "Token Program: Thaw Account", True, True, @@ -3616,85 +2872,56 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_PROGRAM_ID_INS_TRANSFER_CHECKED, - [ + ( PropertyTemplate( "amount", False, - False, read_uint64_le, format_token_amount, + ("#definitions", "decimals", "token_mint"), ), PropertyTemplate( "decimals", False, - False, parse_byte, format_int, + (), ), - ], - [ - AccountTemplate( - "source_account", - False, - False, - False, - ), - AccountTemplate( - "token_mint", - False, - False, - True, - ), - AccountTemplate( - "destination_account", - False, - False, - False, - ), - AccountTemplate( - "owner", - True, - False, - False, - ), - ], - [ + ), + 4, + ("source_account", "token_mint", "destination_account", "owner"), + ( UIProperty( None, "token_mint", "Token", - False, None, ), UIProperty( None, "destination_account", "Recipient", - False, None, ), UIProperty( "amount", None, "Amount", - False, None, ), UIProperty( None, "source_account", "From", - False, None, ), UIProperty( None, "owner", "Owner", - False, - None, + "signer", ), - ], + ), "Token Program: Transfer Checked", True, True, @@ -3708,85 +2935,56 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_PROGRAM_ID_INS_APPROVE_CHECKED, - [ + ( PropertyTemplate( "amount", False, - False, read_uint64_le, format_token_amount, + ("#definitions", "decimals", "token_mint"), ), PropertyTemplate( "decimals", False, - False, parse_byte, format_int, + (), ), - ], - [ - AccountTemplate( - "source_account", - False, - False, - False, - ), - AccountTemplate( - "token_mint", - False, - False, - True, - ), - AccountTemplate( - "delegate", - False, - False, - False, - ), - AccountTemplate( - "owner", - True, - False, - False, - ), - ], - [ + ), + 4, + ("source_account", "token_mint", "delegate", "owner"), + ( UIProperty( None, "token_mint", "Approve token", - False, None, ), UIProperty( None, "delegate", "Approve delegate", - False, None, ), UIProperty( "amount", None, "Allowance", - False, None, ), UIProperty( None, "source_account", "From", - False, None, ), UIProperty( None, "owner", "Owner", - False, - None, + "signer", ), - ], + ), "Token Program: Approve Checked", True, True, @@ -3800,72 +2998,50 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_PROGRAM_ID_INS_MINT_TO_CHECKED, - [ + ( PropertyTemplate( "amount", False, - False, read_uint64_le, format_token_amount, + ("#definitions", "decimals", "mint"), ), PropertyTemplate( "decimals", False, - False, parse_byte, format_int, + (), ), - ], - [ - AccountTemplate( - "mint", - False, - False, - True, - ), - AccountTemplate( - "account_to_mint", - False, - False, - False, - ), - AccountTemplate( - "minting_authority", - True, - False, - False, - ), - ], - [ + ), + 3, + ("mint", "account_to_mint", "minting_authority"), + ( UIProperty( None, "mint", "Mint token", - False, None, ), UIProperty( "amount", None, "Mint amount", - False, None, ), UIProperty( None, "account_to_mint", "To", - False, None, ), UIProperty( None, "minting_authority", "Owner", - False, - None, + "signer", ), - ], + ), "Token Program: Mint to Checked", True, True, @@ -3879,72 +3055,50 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_PROGRAM_ID_INS_BURN_CHECKED, - [ + ( PropertyTemplate( "amount", False, - False, read_uint64_le, format_token_amount, + ("#definitions", "decimals", "token_mint"), ), PropertyTemplate( "decimals", False, - False, parse_byte, format_int, + (), ), - ], - [ - AccountTemplate( - "account_to_burn_from", - False, - False, - False, - ), - AccountTemplate( - "token_mint", - False, - False, - True, - ), - AccountTemplate( - "owner", - True, - False, - False, - ), - ], - [ + ), + 3, + ("account_to_burn_from", "token_mint", "owner"), + ( UIProperty( None, "token_mint", "Burn token", - False, None, ), UIProperty( "amount", None, "Burn amount", - False, None, ), UIProperty( None, "account_to_burn_from", "From", - False, None, ), UIProperty( None, "owner", "Owner", - False, - None, + "signer", ), - ], + ), "Token Program: Burn Checked", True, True, @@ -3958,58 +3112,37 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_PROGRAM_ID_INS_INITIALIZE_ACCOUNT_2, - [ + ( PropertyTemplate( "owner", False, - False, parse_pubkey, format_pubkey, + (), ), - ], - [ - AccountTemplate( - "account_to_initialize", - False, - False, - False, - ), - AccountTemplate( - "mint_account", - False, - False, - False, - ), - AccountTemplate( - "rent_sysvar", - False, - False, - False, - ), - ], - [ + ), + 3, + ("account_to_initialize", "mint_account", "rent_sysvar"), + ( UIProperty( None, "account_to_initialize", "Initialize account", - False, None, ), UIProperty( "owner", None, "Owner", - False, None, ), UIProperty( None, "mint_account", "For token", - False, None, ), - ], + ), "Token Program: Initialize Account 2", True, True, @@ -4023,24 +3156,17 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_PROGRAM_ID_INS_SYNC_NATIVE, - [], - [ - AccountTemplate( - "token_account", - False, - False, - False, - ), - ], - [ + (), + 1, + ("token_account",), + ( UIProperty( None, "token_account", "Sync native account", - False, None, ), - ], + ), "Token Program: Sync Native", True, True, @@ -4054,52 +3180,37 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_PROGRAM_ID_INS_INITIALIZE_ACCOUNT_3, - [ + ( PropertyTemplate( "owner", False, - False, parse_pubkey, format_pubkey, + (), ), - ], - [ - AccountTemplate( - "account_to_initialize", - False, - False, - False, - ), - AccountTemplate( - "mint_account", - False, - False, - False, - ), - ], - [ + ), + 2, + ("account_to_initialize", "mint_account"), + ( UIProperty( None, "account_to_initialize", "Initialize account", - False, None, ), UIProperty( "owner", None, "Owner", - False, None, ), UIProperty( None, "mint_account", "For token", - False, None, ), - ], + ), "Token Program: Initialize Account 3", True, True, @@ -4113,24 +3224,17 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_PROGRAM_ID_INS_INITIALIZE_IMMUTABLE_OWNER, - [], - [ - AccountTemplate( - "account_to_initialize", - False, - False, - False, - ), - ], - [ + (), + 1, + ("account_to_initialize",), + ( UIProperty( None, "account_to_initialize", "Init account", - False, None, ), - ], + ), "Token Program: Initialize Immutable Owner", True, True, @@ -4143,9 +3247,10 @@ def get_instruction( program_id, instruction_accounts, instruction_id, - [], - [], - [], + (), + 0, + (), + (), "Token Program", True, False, @@ -4159,56 +3264,29 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_2022_PROGRAM_ID_INS_INITIALIZE_ACCOUNT, - [], - [ - AccountTemplate( - "account_to_initialize", - False, - False, - False, - ), - AccountTemplate( - "mint_account", - False, - False, - False, - ), - AccountTemplate( - "owner", - False, - False, - False, - ), - AccountTemplate( - "rent_sysvar", - False, - False, - False, - ), - ], - [ + (), + 4, + ("account_to_initialize", "mint_account", "owner", "rent_sysvar"), + ( UIProperty( None, "account_to_initialize", "Initialize account", - False, None, ), UIProperty( None, "owner", "Owner", - False, None, ), UIProperty( None, "mint_account", "For token", - False, None, ), - ], + ), "Token 2022 Program: Initialize Account", True, True, @@ -4222,51 +3300,31 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_2022_PROGRAM_ID_INS_INITIALIZE_MULTISIG, - [ + ( PropertyTemplate( "number_of_signers", False, - False, parse_byte, format_int, + (), ), - ], - [ - AccountTemplate( - "multisig_account", - False, - False, - False, - ), - AccountTemplate( - "rent_sysvar", - False, - False, - False, - ), - AccountTemplate( - "signer_accounts", - False, - False, - False, - ), - ], - [ + ), + 3, + ("multisig_account", "rent_sysvar", "signer_accounts"), + ( UIProperty( None, "multisig_account", "Init multisig", - False, None, ), UIProperty( None, "signer_accounts", "Required signers", - False, None, ), - ], + ), "Token 2022 Program: Initialize Multisig", True, True, @@ -4280,65 +3338,43 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_2022_PROGRAM_ID_INS_TRANSFER, - [ + ( PropertyTemplate( "amount", False, - False, read_uint64_le, format_int, + (), ), - ], - [ - AccountTemplate( - "source_account", - False, - False, - False, - ), - AccountTemplate( - "destination_account", - False, - False, - False, - ), - AccountTemplate( - "owner", - True, - False, - False, - ), - ], - [ + ), + 3, + ("source_account", "destination_account", "owner"), + ( UIProperty( None, "destination_account", "Recipient", - False, None, ), UIProperty( "amount", None, "Amount", - False, None, ), UIProperty( None, "source_account", "From", - False, None, ), UIProperty( None, "owner", "Owner", - False, - None, + "signer", ), - ], + ), "Token 2022 Program: Transfer", True, True, @@ -4352,58 +3388,37 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_2022_PROGRAM_ID_INS_APPROVE, - [ + ( PropertyTemplate( "amount", False, - False, read_uint64_le, format_int, + (), ), - ], - [ - AccountTemplate( - "source_account", - False, - False, - False, - ), - AccountTemplate( - "delegate_account", - False, - False, - False, - ), - AccountTemplate( - "owner", - True, - False, - False, - ), - ], - [ + ), + 3, + ("source_account", "delegate_account", "owner"), + ( UIProperty( None, "delegate_account", "Approve delegate", - False, None, ), UIProperty( "amount", None, "Allowance", - False, None, ), UIProperty( None, "owner", "Owner", - False, - None, + "signer", ), - ], + ), "Token 2022 Program: Approve", True, True, @@ -4417,37 +3432,23 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_2022_PROGRAM_ID_INS_REVOKE, - [], - [ - AccountTemplate( - "source_account", - False, - False, - False, - ), - AccountTemplate( - "owner", - True, - False, - False, - ), - ], - [ + (), + 2, + ("source_account", "owner"), + ( UIProperty( None, "source_account", "Rewoke delegate", - False, None, ), UIProperty( None, "owner", "Owner", - False, - None, + "signer", ), - ], + ), "Token 2022 Program: Revoke", True, True, @@ -4461,66 +3462,50 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_2022_PROGRAM_ID_INS_SET_AUTHORITY, - [ + ( PropertyTemplate( "authority_type", False, - False, parse_byte, format_AuthorityType, + (), ), PropertyTemplate( "new_authority", True, - True, parse_pubkey, format_pubkey, + (), ), - ], - [ - AccountTemplate( - "mint_account", - False, - False, - False, - ), - AccountTemplate( - "current_authority", - True, - False, - False, - ), - ], - [ + ), + 2, + ("mint_account", "current_authority"), + ( UIProperty( None, "mint_account", "Set authority for", - False, None, ), UIProperty( "new_authority", None, "New authority", - False, - None, + "signer", ), UIProperty( "authority_type", None, "Authority type", - False, None, ), UIProperty( None, "current_authority", "Current authority", - False, - None, + "signer", ), - ], + ), "Token 2022 Program: Set Authority", True, True, @@ -4534,65 +3519,43 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_2022_PROGRAM_ID_INS_MINT_TO, - [ + ( PropertyTemplate( "amount", False, - False, read_uint64_le, format_int, + (), ), - ], - [ - AccountTemplate( - "mint", - False, - False, - True, - ), - AccountTemplate( - "account_to_mint", - False, - False, - False, - ), - AccountTemplate( - "minting_authority", - True, - False, - False, - ), - ], - [ + ), + 3, + ("mint", "account_to_mint", "minting_authority"), + ( UIProperty( None, "mint", "Mint token", - False, None, ), UIProperty( "amount", None, "Mint amount", - False, None, ), UIProperty( None, "account_to_mint", "To", - False, None, ), UIProperty( None, "minting_authority", "Mint authority", - False, - None, + "signer", ), - ], + ), "Token 2022 Program: Mint to", True, True, @@ -4606,65 +3569,43 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_2022_PROGRAM_ID_INS_BURN, - [ + ( PropertyTemplate( "amount", False, - False, read_uint64_le, format_int, + (), ), - ], - [ - AccountTemplate( - "account_to_burn_from", - False, - False, - False, - ), - AccountTemplate( - "token_mint", - False, - False, - True, - ), - AccountTemplate( - "owner", - True, - False, - False, - ), - ], - [ + ), + 3, + ("account_to_burn_from", "token_mint", "owner"), + ( UIProperty( None, "token_mint", "Burn token", - False, None, ), UIProperty( "amount", None, "Burn amount", - False, None, ), UIProperty( None, "account_to_burn_from", "From", - False, None, ), UIProperty( None, "owner", "Mint authority", - False, - None, + "signer", ), - ], + ), "Token 2022 Program: Burn", True, True, @@ -4678,50 +3619,29 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_2022_PROGRAM_ID_INS_CLOSE_ACCOUNT, - [], - [ - AccountTemplate( - "account_to_close", - False, - False, - False, - ), - AccountTemplate( - "destination_account", - False, - False, - False, - ), - AccountTemplate( - "owner", - True, - False, - False, - ), - ], - [ + (), + 3, + ("account_to_close", "destination_account", "owner"), + ( UIProperty( None, "account_to_close", "Close account", - False, None, ), UIProperty( None, "destination_account", "Withdraw to", - False, None, ), UIProperty( None, "owner", "Owner", - False, - None, + "signer", ), - ], + ), "Token 2022 Program: Close Account", True, True, @@ -4735,50 +3655,29 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_2022_PROGRAM_ID_INS_FREEZE_ACCOUNT, - [], - [ - AccountTemplate( - "account_to_freeze", - False, - False, - False, - ), - AccountTemplate( - "token_mint", - False, - False, - True, - ), - AccountTemplate( - "freeze_authority", - True, - False, - False, - ), - ], - [ + (), + 3, + ("account_to_freeze", "token_mint", "freeze_authority"), + ( UIProperty( None, "account_to_freeze", "Freeze account", - False, None, ), UIProperty( None, "token_mint", "Token", - False, None, ), UIProperty( None, "freeze_authority", "Owner", - False, - None, + "signer", ), - ], + ), "Token 2022 Program: Freeze Account", True, True, @@ -4792,50 +3691,29 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_2022_PROGRAM_ID_INS_THAW_ACCOUNT, - [], - [ - AccountTemplate( - "account_to_freeze", - False, - False, - False, - ), - AccountTemplate( - "token_mint", - False, - False, - True, - ), - AccountTemplate( - "freeze_authority", - True, - False, - False, - ), - ], - [ + (), + 3, + ("account_to_freeze", "token_mint", "freeze_authority"), + ( UIProperty( None, "account_to_freeze", "Thaw account", - False, None, ), UIProperty( None, "token_mint", "Token", - False, None, ), UIProperty( None, "freeze_authority", "Owner", - False, - None, + "signer", ), - ], + ), "Token 2022 Program: Thaw Account", True, True, @@ -4849,85 +3727,56 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_2022_PROGRAM_ID_INS_TRANSFER_CHECKED, - [ + ( PropertyTemplate( "amount", False, - False, read_uint64_le, format_token_amount, + ("#definitions", "decimals", "token_mint"), ), PropertyTemplate( "decimals", False, - False, parse_byte, format_int, + (), ), - ], - [ - AccountTemplate( - "source_account", - False, - False, - False, - ), - AccountTemplate( - "token_mint", - False, - False, - True, - ), - AccountTemplate( - "destination_account", - False, - False, - False, - ), - AccountTemplate( - "owner", - True, - False, - False, - ), - ], - [ + ), + 4, + ("source_account", "token_mint", "destination_account", "owner"), + ( UIProperty( None, "token_mint", "Token", - False, None, ), UIProperty( None, "destination_account", "Recipient", - False, None, ), UIProperty( "amount", None, "Amount", - False, None, ), UIProperty( None, "source_account", "From", - False, None, ), UIProperty( None, "owner", "Owner", - False, - None, + "signer", ), - ], + ), "Token 2022 Program: Transfer Checked", True, True, @@ -4941,85 +3790,56 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_2022_PROGRAM_ID_INS_APPROVE_CHECKED, - [ + ( PropertyTemplate( "amount", False, - False, read_uint64_le, format_token_amount, + ("#definitions", "decimals", "token_mint"), ), PropertyTemplate( "decimals", False, - False, parse_byte, format_int, + (), ), - ], - [ - AccountTemplate( - "source_account", - False, - False, - False, - ), - AccountTemplate( - "token_mint", - False, - False, - True, - ), - AccountTemplate( - "delegate", - False, - False, - False, - ), - AccountTemplate( - "owner", - True, - False, - False, - ), - ], - [ + ), + 4, + ("source_account", "token_mint", "delegate", "owner"), + ( UIProperty( None, "token_mint", "Approve token", - False, None, ), UIProperty( None, "delegate", "Approve delegate", - False, None, ), UIProperty( "amount", None, "Allowance", - False, None, ), UIProperty( None, "source_account", "From", - False, None, ), UIProperty( None, "owner", "Owner", - False, - None, + "signer", ), - ], + ), "Token 2022 Program: Approve Checked", True, True, @@ -5033,72 +3853,50 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_2022_PROGRAM_ID_INS_MINT_TO_CHECKED, - [ + ( PropertyTemplate( "amount", False, - False, read_uint64_le, format_token_amount, + ("#definitions", "decimals", "mint"), ), PropertyTemplate( "decimals", False, - False, parse_byte, format_int, + (), ), - ], - [ - AccountTemplate( - "mint", - False, - False, - True, - ), - AccountTemplate( - "account_to_mint", - False, - False, - False, - ), - AccountTemplate( - "minting_authority", - True, - False, - False, - ), - ], - [ + ), + 3, + ("mint", "account_to_mint", "minting_authority"), + ( UIProperty( None, "mint", "Mint token", - False, None, ), UIProperty( "amount", None, "Mint amount", - False, None, ), UIProperty( None, "account_to_mint", "To", - False, None, ), UIProperty( None, "minting_authority", "Owner", - False, - None, + "signer", ), - ], + ), "Token 2022 Program: Mint to Checked", True, True, @@ -5112,72 +3910,50 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_2022_PROGRAM_ID_INS_BURN_CHECKED, - [ + ( PropertyTemplate( "amount", False, - False, read_uint64_le, format_token_amount, + ("#definitions", "decimals", "token_mint"), ), PropertyTemplate( "decimals", False, - False, parse_byte, format_int, + (), ), - ], - [ - AccountTemplate( - "account_to_burn_from", - False, - False, - False, - ), - AccountTemplate( - "token_mint", - False, - False, - True, - ), - AccountTemplate( - "owner", - True, - False, - False, - ), - ], - [ + ), + 3, + ("account_to_burn_from", "token_mint", "owner"), + ( UIProperty( None, "token_mint", "Burn token", - False, None, ), UIProperty( "amount", None, "Burn amount", - False, None, ), UIProperty( None, "account_to_burn_from", "From", - False, None, ), UIProperty( None, "owner", "Owner", - False, - None, + "signer", ), - ], + ), "Token 2022 Program: Burn Checked", True, True, @@ -5191,58 +3967,37 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_2022_PROGRAM_ID_INS_INITIALIZE_ACCOUNT_2, - [ + ( PropertyTemplate( "owner", False, - False, parse_pubkey, format_pubkey, + (), ), - ], - [ - AccountTemplate( - "account_to_initialize", - False, - False, - False, - ), - AccountTemplate( - "mint_account", - False, - False, - False, - ), - AccountTemplate( - "rent_sysvar", - False, - False, - False, - ), - ], - [ + ), + 3, + ("account_to_initialize", "mint_account", "rent_sysvar"), + ( UIProperty( None, "account_to_initialize", "Initialize account", - False, None, ), UIProperty( "owner", None, "Owner", - False, None, ), UIProperty( None, "mint_account", "For token", - False, None, ), - ], + ), "Token 2022 Program: Initialize Account 2", True, True, @@ -5256,24 +4011,17 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_2022_PROGRAM_ID_INS_SYNC_NATIVE, - [], - [ - AccountTemplate( - "token_account", - False, - False, - False, - ), - ], - [ + (), + 1, + ("token_account",), + ( UIProperty( None, "token_account", "Sync native account", - False, None, ), - ], + ), "Token 2022 Program: Sync Native", True, True, @@ -5287,52 +4035,37 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_2022_PROGRAM_ID_INS_INITIALIZE_ACCOUNT_3, - [ + ( PropertyTemplate( "owner", False, - False, parse_pubkey, format_pubkey, + (), ), - ], - [ - AccountTemplate( - "account_to_initialize", - False, - False, - False, - ), - AccountTemplate( - "mint_account", - False, - False, - False, - ), - ], - [ + ), + 2, + ("account_to_initialize", "mint_account"), + ( UIProperty( None, "account_to_initialize", "Initialize account", - False, None, ), UIProperty( "owner", None, "Owner", - False, None, ), UIProperty( None, "mint_account", "For token", - False, None, ), - ], + ), "Token 2022 Program: Initialize Account 3", True, True, @@ -5346,24 +4079,17 @@ def get_instruction( program_id, instruction_accounts, _TOKEN_2022_PROGRAM_ID_INS_INITIALIZE_IMMUTABLE_OWNER, - [], - [ - AccountTemplate( - "account_to_initialize", - False, - False, - False, - ), - ], - [ + (), + 1, + ("account_to_initialize",), + ( UIProperty( None, "account_to_initialize", "Initialize immutable owner extension for account", - False, None, ), - ], + ), "Token 2022 Program: Initialize Immutable Owner", True, True, @@ -5376,9 +4102,10 @@ def get_instruction( program_id, instruction_accounts, instruction_id, - [], - [], - [], + (), + 0, + (), + (), "Token 2022 Program", True, False, @@ -5392,81 +4119,43 @@ def get_instruction( program_id, instruction_accounts, _ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID_INS_CREATE, - [], - [ - AccountTemplate( - "funding_account", - True, - False, - False, - ), - AccountTemplate( - "associated_token_account", - False, - False, - False, - ), - AccountTemplate( - "wallet_address", - False, - False, - False, - ), - AccountTemplate( - "token_mint", - False, - False, - True, - ), - AccountTemplate( - "system_program", - False, - False, - False, - ), - AccountTemplate( - "spl_token", - False, - False, - False, - ), - AccountTemplate( - "rent_sysvar", - False, - True, - False, - ), - ], - [ + (), + 6, + ( + "funding_account", + "associated_token_account", + "wallet_address", + "token_mint", + "system_program", + "spl_token", + "rent_sysvar", + ), + ( UIProperty( None, "associated_token_account", "Create token account", - False, None, ), UIProperty( None, "token_mint", "For token", - False, None, ), UIProperty( None, "wallet_address", "Owned by", - False, None, ), UIProperty( None, "funding_account", "Funded by", - False, - None, + "signer", ), - ], + ), "Associated Token Account Program: Create", True, True, @@ -5480,75 +4169,42 @@ def get_instruction( program_id, instruction_accounts, _ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID_INS_CREATE_IDEMPOTENT, - [], - [ - AccountTemplate( - "funding_account", - True, - False, - False, - ), - AccountTemplate( - "associated_token_account", - False, - False, - False, - ), - AccountTemplate( - "wallet_addr", - False, - False, - False, - ), - AccountTemplate( - "token_mint", - False, - False, - True, - ), - AccountTemplate( - "system_program", - False, - False, - False, - ), - AccountTemplate( - "spl_token", - False, - False, - False, - ), - ], - [ + (), + 6, + ( + "funding_account", + "associated_token_account", + "wallet_addr", + "token_mint", + "system_program", + "spl_token", + ), + ( UIProperty( None, "associated_token_account", "Create token account", - False, None, ), UIProperty( None, "token_mint", "For token", - False, None, ), UIProperty( None, "wallet_addr", "Owned by", - False, None, ), UIProperty( None, "funding_account", "Funded by", - False, - None, + "signer", ), - ], + ), "Associated Token Account Program: Create Idempotent", True, True, @@ -5562,74 +4218,37 @@ def get_instruction( program_id, instruction_accounts, _ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID_INS_RECOVER_NESTED, - [], - [ - AccountTemplate( - "nested_account", - True, - False, - False, - ), - AccountTemplate( - "token_mint_nested", - False, - False, - False, - ), - AccountTemplate( - "associated_token_account", - False, - False, - False, - ), - AccountTemplate( - "owner", - False, - False, - False, - ), - AccountTemplate( - "token_mint_owner", - False, - False, - False, - ), - AccountTemplate( - "wallet_address", - True, - False, - False, - ), - AccountTemplate( - "spl_token", - False, - False, - False, - ), - ], - [ + (), + 7, + ( + "nested_account", + "token_mint_nested", + "associated_token_account", + "owner", + "token_mint_owner", + "wallet_address", + "spl_token", + ), + ( UIProperty( None, "nested_account", "Recover nested token account", - False, - None, + "signer", ), UIProperty( None, "associated_token_account", "Transfer recovered tokens to", - False, None, ), UIProperty( None, "wallet_address", "Transfer recovered SOL to", - False, - None, + "signer", ), - ], + ), "Associated Token Account Program: Recover Nested", True, True, @@ -5642,9 +4261,10 @@ def get_instruction( program_id, instruction_accounts, instruction_id, - [], - [], - [], + (), + 0, + (), + (), "Associated Token Account Program", True, False, @@ -5658,39 +4278,31 @@ def get_instruction( program_id, instruction_accounts, _MEMO_PROGRAM_ID_INS_MEMO, - [ + ( PropertyTemplate( "memo", False, - False, parse_memo, format_identity, + (), ), - ], - [ - AccountTemplate( - "signer_accounts", - True, - True, - False, - ), - ], - [ + ), + 0, + ("signer_accounts",), + ( UIProperty( "memo", None, "Memo", - False, None, ), UIProperty( None, "signer_accounts", "Signer accounts", - False, - None, + "signer", ), - ], + ), "Memo Program: Memo", True, True, @@ -5703,9 +4315,10 @@ def get_instruction( program_id, instruction_accounts, instruction_id, - [], - [], - [], + (), + 0, + (), + (), "Memo Program", True, False, @@ -5719,39 +4332,31 @@ def get_instruction( program_id, instruction_accounts, _MEMO_LEGACY_PROGRAM_ID_INS_MEMO, - [ + ( PropertyTemplate( "memo", False, - False, parse_memo, format_identity, + (), ), - ], - [ - AccountTemplate( - "signer_accounts", - True, - True, - False, - ), - ], - [ + ), + 0, + ("signer_accounts",), + ( UIProperty( "memo", None, "Memo", - False, None, ), UIProperty( None, "signer_accounts", "Signer accounts", - False, - None, + "signer", ), - ], + ), "Memo Legacy Program: Memo", True, True, @@ -5764,9 +4369,10 @@ def get_instruction( program_id, instruction_accounts, instruction_id, - [], - [], - [], + (), + 0, + (), + (), "Memo Legacy Program", True, False, @@ -5778,9 +4384,10 @@ def get_instruction( program_id, instruction_accounts, 0, - [], - [], - [], + (), + 0, + (), + (), "Unsupported program", False, False, diff --git a/core/src/apps/solana/transaction/instructions.py.mako b/core/src/apps/solana/transaction/instructions.py.mako index 03f9c48a9c..0e7069249e 100644 --- a/core/src/apps/solana/transaction/instructions.py.mako +++ b/core/src/apps/solana/transaction/instructions.py.mako @@ -1,32 +1,41 @@ # generated from instructions.py.mako +# (by running `make solana_templates` in root) # do not edit manually! -<%def name="getProgramId(program)">${"_" + "_".join(program["name"].upper().split(" ") + ["ID"])}\ -<%def name="getInstructionIdText(program, instruction)">${"_".join([getProgramId(program)] + ["INS"] + instruction["name"].upper().split(" "))}\ -<%def name="getClassName(program, instruction)">${program["name"].replace(" ", "")}${instruction["name"].replace(" ", "")}Instruction\ -<%def name="getReferenceName(reference)">${"_".join(reference["name"].lower().split(" "))}\ -<%def name="getReferenceOptionalType(reference)">\ -% if reference["optional"]: - | None\ -% endif -\ -<%def name="getReferenceOptionalTemplate(reference)">\ -% if reference["optional"]: -, True\ -% else: -, False\ -% endif -\ -<%def name="getPythonType(type)">\ -% if type in ("u32", "u64", "i32", "i64", "timestamp", "lamports", "token_amount"): -int\ -% elif type in ("pubKey", "authority"): -Account\ -% elif type in ("string", "memo"): -str\ -% else: -int\ -% endif -\ + +<% +def getProgramId(program): + return "_" + "_".join(program["name"].upper().split(" ") + ["ID"]) + +def getInstructionIdText(program, instruction): + return "_".join([getProgramId(program)] + ["INS"] + instruction["name"].upper().split(" ")) + +def getClassName(program, instruction): + return program["name"].replace(" ", "") + instruction["name"].replace(" ", "") + "Instruction" + +INT_TYPES = ("u8", "u32", "u64", "i32", "i64", "timestamp", "lamports", "token_amount", "unix_timestamp") + +def getPythonType(type): + if type in INT_TYPES: + return "int" + elif type in ("pubkey", "authority"): + return "Account" + elif type in ("string", "memo"): + return "str" + elif type in programs["types"] and programs["types"][type].get("is_enum"): + return "int" + else: + raise Exception(f"Unknown type: {type}") + +def args_tuple(required_parameters, args_dict): + args = [] + for required_parameter in required_parameters: + if required_parameter.startswith("#"): + args.append(required_parameter) + else: + args.append(args_dict[required_parameter]) + return repr(tuple(args)) + +%>\ from micropython import const from typing import TYPE_CHECKING @@ -34,7 +43,7 @@ from trezor.wire import DataError from apps.common.readers import read_uint32_le, read_uint64_le -from ..types import AccountTemplate, PropertyTemplate, UIProperty +from ..types import PropertyTemplate, UIProperty from ..format import ( format_int, format_lamports, @@ -106,8 +115,11 @@ if TYPE_CHECKING: % endfor ## generates properties for reference accounts - % for reference in instruction["references"]: - ${getReferenceName(reference)}: Account${getReferenceOptionalType(reference)} + % for reference in instruction["references"][:instruction["references_required"]]: + ${reference}: Account + % endfor + % for reference in instruction["references"][instruction["references_required"]:]: + ${reference}: Account | None % endfor % endfor % endfor @@ -123,7 +135,7 @@ def get_instruction_id_length(program_id: str) -> int: % for _, type in programs["types"].items(): % if "is_enum" in type and type["is_enum"]: -def ${type["format"]}(_: Instruction, value: int) -> str: +def ${type["format"]}(value: int) -> str: % for variant in type["fields"]: if value == ${variant["value"]}: return "${variant["name"]}" @@ -132,23 +144,24 @@ def ${type["format"]}(_: Instruction, value: int) -> str: % endif % endfor -<%def name="getOptionalString(obj, string)">\ -% if string in obj: -"${obj[string]}"\ -%else: -None\ -% endif -\ <% # Make sure that all required parameters are present in the instruction. for program in programs["programs"]: for instruction in program["instructions"]: + param_names = [parameter["name"] for parameter in instruction["parameters"]] for parameter in instruction["parameters"]: - if "required_parameters" in programs["types"][parameter["type"]]: - for required_parameter in programs["types"][parameter["type"]]["required_parameters"]: - instruction_parameter_names = [parameter["name"] for parameter in instruction["parameters"]] - if required_parameter not in instruction_parameter_names: - raise Exception(f"Instruction \"{instruction['name']}\" is missing the required parameter \"{required_parameter}\" from paremeter \"{parameter['name']}\".") + required_parameters = programs["types"][parameter["type"]].get("required_parameters") + if not required_parameters: + continue + args = parameter.get("args", {}) + for required_parameter in required_parameters: + if required_parameter.startswith("#"): + continue + if required_parameter not in args: + raise Exception(f"Parameter \"{parameter['name']}\" is missing the required argument \"{required_parameter}\".") + target = args[required_parameter] + if target not in param_names and target not in instruction["references"]: + raise Exception(f"Instruction \"{instruction['name']}\" is missing the required parameter \"{required_parameter}\" from parameter \"{parameter['name']}\".") %> def get_instruction( @@ -164,44 +177,35 @@ def get_instruction( program_id, instruction_accounts, ${getInstructionIdText(program, instruction)}, - [ + ( % for parameter in instruction["parameters"]: PropertyTemplate( "${parameter["name"]}", - ${parameter["type"] == "authority"}, ${parameter["optional"]}, ${programs["types"][parameter["type"]]["parse"]}, ${programs["types"][parameter["type"]]["format"]}, + ${args_tuple(programs["types"][parameter["type"]].get("required_parameters", []), parameter.get("args", {}))}, ), % endfor - ], - [ - % for reference in instruction["references"]: - AccountTemplate( - "${reference["name"]}", - ${reference["is_authority"]}, - ${reference["optional"]}, - ${reference.get("is_token_mint", False)}, - ), - % endfor - ], - [ + ), + ${instruction["references_required"]}, + ${repr(tuple(instruction["references"]))}, + ( % for ui_property in instruction["ui_properties"]: UIProperty( - ${getOptionalString(ui_property, "parameter")}, - ${getOptionalString(ui_property, "account")}, + ${repr(ui_property.get("parameter"))}, + ${repr(ui_property.get("account"))}, "${ui_property["display_name"]}", - ${ui_property["is_authority"] if "is_authority" in ui_property else False}, - ${ui_property["default_value_to_hide"] if "default_value_to_hide" in ui_property else None}, + ${repr(ui_property.get("default_value_to_hide"))}, ), % endfor - ], + ), "${program["name"]}: ${instruction["name"]}", True, True, ${instruction.get("is_ui_hidden", False)}, ${instruction["is_multisig"]}, - ${getOptionalString(instruction, "is_deprecated_warning")}, + ${repr(instruction.get("is_deprecated_warning"))}, ) % endfor return Instruction( @@ -209,9 +213,10 @@ def get_instruction( program_id, instruction_accounts, instruction_id, - [], - [], - [], + (), + 0, + (), + (), "${program["name"]}", True, False, @@ -225,9 +230,10 @@ def get_instruction( program_id, instruction_accounts, 0, - [], - [], - [], + (), + 0, + (), + (), "Unsupported program", False, False, diff --git a/core/src/apps/solana/types.py b/core/src/apps/solana/types.py index 641f803c48..e5541eff7a 100644 --- a/core/src/apps/solana/types.py +++ b/core/src/apps/solana/types.py @@ -1,6 +1,7 @@ from typing import TYPE_CHECKING from .definitions import Definitions +from .transaction.parse import parse_pubkey if TYPE_CHECKING: from enum import IntEnum @@ -10,8 +11,6 @@ if TYPE_CHECKING: from trezor.utils import BufferReader from typing_extensions import Self - from .transaction import Instruction - Address = tuple[bytes, "AddressType"] AddressReference = tuple[bytes, int, "AddressType"] Account = Address | AddressReference @@ -42,26 +41,19 @@ class PropertyTemplate(Generic[T]): def __init__( self, name: str, - is_authority: bool, - is_optional: bool, + optional: bool, parse: Callable[[BufferReader], T], - format: Callable[[Instruction, T], str], + format: Callable[..., str], + args: tuple[str, ...], ) -> None: self.name = name - self.is_authority = is_authority - self.is_optional = is_optional + self.optional = optional self.parse = parse self.format = format + self.args = args - -class AccountTemplate: - def __init__( - self, name: str, is_authority: bool, optional: bool, is_token_mint: bool - ) -> None: - self.name = name - self.is_authority = is_authority - self.optional = optional - self.is_token_mint = is_token_mint + def is_pubkey(self) -> bool: + return self.parse is parse_pubkey class UIProperty: @@ -70,13 +62,11 @@ class UIProperty: parameter: str | None, account: str | None, display_name: str, - is_authority: bool, default_value_to_hide: Any | None, ) -> None: self.parameter = parameter self.account = account self.display_name = display_name - self.is_authority = is_authority self.default_value_to_hide = default_value_to_hide diff --git a/core/tests/test_apps.solana.predefined_transaction.py b/core/tests/test_apps.solana.predefined_transaction.py index 99b342f310..b8ef8143f4 100644 --- a/core/tests/test_apps.solana.predefined_transaction.py +++ b/core/tests/test_apps.solana.predefined_transaction.py @@ -99,7 +99,8 @@ def create_mock_instruction( accounts=[], instruction_id=instruction_id, property_templates=[], - accounts_template=[], + accounts_required=0, + account_templates=[], ui_properties=[], ui_name="", is_program_supported=True, diff --git a/core/tests/test_apps.solana.predefined_transaction.py.mako b/core/tests/test_apps.solana.predefined_transaction.py.mako index 6eb95c6e2e..c9dac28f09 100644 --- a/core/tests/test_apps.solana.predefined_transaction.py.mako +++ b/core/tests/test_apps.solana.predefined_transaction.py.mako @@ -28,7 +28,8 @@ def create_mock_instruction( accounts=[], instruction_id=instruction_id, property_templates=[], - accounts_template=[], + accounts_required=0, + account_templates=[], ui_properties=[], ui_name="", is_program_supported=True, diff --git a/tests/device_tests/solana/construct/instructions.py.mako b/tests/device_tests/solana/construct/instructions.py.mako index e099b0707d..8779ef4f56 100644 --- a/tests/device_tests/solana/construct/instructions.py.mako +++ b/tests/device_tests/solana/construct/instructions.py.mako @@ -16,24 +16,31 @@ CONSTRUCT_TYPES = { "string": "String", "memo": "Memo", } + INSTRUCTION_TYPES = { 0: "Pass", 1: "Byte", 4: "Int32ul", } + def upper_snake_case(name): return "_".join(name.split(" ")).upper() + def camelcase(name): return "".join([word.capitalize() for word in name.split(" ")]) + def instruction_id(instruction): return "INS_" + upper_snake_case(instruction.name) + def instruction_struct_name(program, instruction): return camelcase(program.name) + "_" + camelcase(instruction.name) + "_Instruction" + def instruction_subcon(program, instruction): if instruction.id is None: return "Pass" instruction_id_type = INSTRUCTION_TYPES[program.instruction_id_length] return f"Const({instruction.id}, {instruction_id_type})" + %>\ from enum import Enum from construct import ( @@ -76,12 +83,11 @@ class ${camelcase(program.name)}Instruction(Enum): ${camelcase(program.name)}_${camelcase(instruction.name)} = Struct( "program_index" / Byte, "accounts" / CompactStruct( - % for reference in instruction.references: - % if reference.optional: - "${reference.name}" / Optional(Byte), - % else: - "${reference.name}" / Byte, - % endif + % for reference in instruction.references[:instruction.references_required]: + "${reference}" / Byte, + % endfor + % for reference in instruction.references[instruction.references_required:]: + "${reference}" / Optional(Byte), % endfor % if instruction.is_multisig: "multisig_signers" / Optional(GreedyRange(Byte))