x402-proxy 0.10.7 → 0.10.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -1
- package/README.md +7 -1
- package/dist/Credential-0iRzpJkF.js +2055 -0
- package/dist/Mcp-CSyD7Hxz.js +10 -0
- package/dist/Sse-C-KDPYh0.js +16482 -0
- package/dist/Sse-DGR-tH7K.js +9742 -0
- package/dist/accounts-DsuvWwph.js +232 -0
- package/dist/accounts-DzvAlQRn.js +5 -0
- package/dist/accounts-IG-Cmrwy.js +229 -0
- package/dist/api-CUzmQvTQ.js +2802 -0
- package/dist/auth-J9VuNMoG.js +1187 -0
- package/dist/bin/cli.js +585 -242
- package/dist/ccip-Bx-zoUCJ.js +240 -0
- package/dist/ccip-C2k1DD1T.js +153 -0
- package/dist/ccip-C6CQOJYv.js +152 -0
- package/dist/ccip-RZzsZ5Mv.js +156 -0
- package/dist/chain-CafcHffR.js +1997 -0
- package/dist/chain-DwfP5RGZ.js +1968 -0
- package/dist/chunk-DBEY4PJZ.js +16 -0
- package/dist/chunk-DjEMn6fM.js +36 -0
- package/dist/client-1XQsO-Eh.js +5152 -0
- package/dist/client-Bcl2uC6u.js +102 -0
- package/dist/client-Co7Fg1lv.js +6388 -0
- package/dist/client-DZV1cVsW.js +657 -0
- package/dist/config-BUQsit4s.js +3 -0
- package/dist/config-DR1Fs_wL.js +6600 -0
- package/dist/{config-D9wIR3xc.js → config-rvKA3SYT.js} +10 -5
- package/dist/decodeFunctionData-DuFcwhC_.js +4510 -0
- package/dist/decodeFunctionData-JPOUdvil.js +4394 -0
- package/dist/derive-DNUl8LU9.js +9109 -0
- package/dist/dist-C2YO6HSQ.js +6581 -0
- package/dist/dist-DM5_F3r5.js +4 -0
- package/dist/dist-DxJCYyL5.js +1388 -0
- package/dist/hashTypedData-BHmP9dBd.js +859 -0
- package/dist/hashTypedData-CtEdfx4y.js +846 -0
- package/dist/helpers-ChcFbdC0.js +7123 -0
- package/dist/hmac-59IlS_by.js +648 -0
- package/dist/http-BAtucMbS.js +2060 -0
- package/dist/index.d.ts +1903 -9
- package/dist/index.js +18006 -50
- package/dist/index.node-CxkL0OFh.js +3592 -0
- package/dist/index.node-DvmeuZBj.js +3 -0
- package/dist/isAddressEqual-BLrd1Hg1.js +9 -0
- package/dist/isAddressEqual-DsAqfQOD.js +10 -0
- package/dist/localBatchGatewayRequest-C-RPJyDO.js +6260 -0
- package/dist/localBatchGatewayRequest-DOdQ9bR7.js +93 -0
- package/dist/localBatchGatewayRequest-DQkbZaSy.js +6261 -0
- package/dist/parseUnits-CApwcKSD.js +49 -0
- package/dist/parseUnits-cMO2udMe.js +48 -0
- package/dist/schemas-BxMFYNbH.js +1270 -0
- package/dist/secp256k1-BZpiyffY.js +2525 -0
- package/dist/secp256k1-BjenrLl5.js +1877 -0
- package/dist/secp256k1-CLPUX17u.js +3 -0
- package/dist/sendRawTransactionSync-DvSkhZtW.js +3612 -0
- package/dist/server-D2apWWY9.js +565 -0
- package/dist/setup-BY4J49Lv.js +1110 -0
- package/dist/setup-wMOAgrsN.js +3 -0
- package/dist/sha256-FAs0qeni.js +17 -0
- package/dist/sha3-CYkWM8Xa.js +195 -0
- package/dist/sha3-DbMJRJ3C.js +194 -0
- package/dist/sse-qIEKrJEZ.js +408 -0
- package/dist/status-Bu23RjW6.js +3 -0
- package/dist/{status-DihAcUSC.js → status-X21VnGUO.js} +16 -15
- package/dist/stdio-BfDjLLnd.js +85 -0
- package/dist/streamableHttp-BkayeoEQ.js +358 -0
- package/dist/tempo-BcTkftHK.js +17 -0
- package/dist/tempo-Bs_aydgm.js +18 -0
- package/dist/types-BmyZIQ8G.js +1240 -0
- package/dist/types-DlqDf-zE.js +3 -0
- package/dist/utils-BYjkXZDF.js +444 -0
- package/dist/utils-SeGHMW9O.js +445 -0
- package/dist/wallet-DKVlrR1S.js +3 -0
- package/dist/wallet-DSyht15_.js +17759 -0
- package/package.json +19 -72
- package/dist/config-B_upkJeK.js +0 -66
- package/dist/config-Be35NM5s.js +0 -3
- package/dist/config-J1m-CWXT.js +0 -27
- package/dist/derive-CL6e8K0Z.js +0 -81
- package/dist/openclaw/plugin.d.ts +0 -15
- package/dist/openclaw/plugin.js +0 -2067
- package/dist/openclaw.plugin.json +0 -93
- package/dist/setup-CNyMLnM-.js +0 -197
- package/dist/setup-DTIxPe58.js +0 -3
- package/dist/status-DZlJ4pS7.js +0 -3
- package/dist/wallet-B0S-rma9.js +0 -544
- package/dist/wallet-DBrVZJqe.js +0 -3
- package/openclaw.plugin.json +0 -93
- package/skills/SKILL.md +0 -183
- package/skills/references/library.md +0 -85
- package/skills/references/openclaw-plugin.md +0 -145
|
@@ -0,0 +1,3592 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { setMaxListeners } from "events";
|
|
3
|
+
var SOLANA_ERROR__JSON_RPC__PARSE_ERROR = -32700;
|
|
4
|
+
var SOLANA_ERROR__JSON_RPC__INTERNAL_ERROR = -32603;
|
|
5
|
+
var SOLANA_ERROR__JSON_RPC__INVALID_PARAMS = -32602;
|
|
6
|
+
var SOLANA_ERROR__JSON_RPC__METHOD_NOT_FOUND = -32601;
|
|
7
|
+
var SOLANA_ERROR__JSON_RPC__INVALID_REQUEST = -32600;
|
|
8
|
+
var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_UNREACHABLE = -32019;
|
|
9
|
+
var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_NOT_EPOCH_BOUNDARY = -32018;
|
|
10
|
+
var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_EPOCH_REWARDS_PERIOD_ACTIVE = -32017;
|
|
11
|
+
var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED = -32016;
|
|
12
|
+
var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION = -32015;
|
|
13
|
+
var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET = -32014;
|
|
14
|
+
var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH = -32013;
|
|
15
|
+
var SOLANA_ERROR__JSON_RPC__SCAN_ERROR = -32012;
|
|
16
|
+
var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE = -32011;
|
|
17
|
+
var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX = -32010;
|
|
18
|
+
var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED = -32009;
|
|
19
|
+
var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SNAPSHOT = -32008;
|
|
20
|
+
var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_SKIPPED = -32007;
|
|
21
|
+
var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE = -32006;
|
|
22
|
+
var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NODE_UNHEALTHY = -32005;
|
|
23
|
+
var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_NOT_AVAILABLE = -32004;
|
|
24
|
+
var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE = -32003;
|
|
25
|
+
var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE = -32002;
|
|
26
|
+
var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_CLEANED_UP = -32001;
|
|
27
|
+
var SOLANA_ERROR__ADDRESSES__INVALID_BYTE_LENGTH = 28e5;
|
|
28
|
+
var SOLANA_ERROR__ADDRESSES__STRING_LENGTH_OUT_OF_RANGE = 2800001;
|
|
29
|
+
var SOLANA_ERROR__ADDRESSES__INVALID_BASE58_ENCODED_ADDRESS = 2800002;
|
|
30
|
+
var SOLANA_ERROR__ADDRESSES__INVALID_ED25519_PUBLIC_KEY = 2800003;
|
|
31
|
+
var SOLANA_ERROR__ADDRESSES__MALFORMED_PDA = 2800004;
|
|
32
|
+
var SOLANA_ERROR__ADDRESSES__PDA_BUMP_SEED_OUT_OF_RANGE = 2800005;
|
|
33
|
+
var SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED = 2800006;
|
|
34
|
+
var SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED = 2800007;
|
|
35
|
+
var SOLANA_ERROR__ADDRESSES__INVALID_SEEDS_POINT_ON_CURVE = 2800008;
|
|
36
|
+
var SOLANA_ERROR__ADDRESSES__FAILED_TO_FIND_VIABLE_PDA_BUMP_SEED = 2800009;
|
|
37
|
+
var SOLANA_ERROR__ADDRESSES__PDA_ENDS_WITH_PDA_MARKER = 2800010;
|
|
38
|
+
var SOLANA_ERROR__ADDRESSES__INVALID_OFF_CURVE_ADDRESS = 2800011;
|
|
39
|
+
var SOLANA_ERROR__ACCOUNTS__ACCOUNT_NOT_FOUND = 323e4;
|
|
40
|
+
var SOLANA_ERROR__ACCOUNTS__ONE_OR_MORE_ACCOUNTS_NOT_FOUND = 32300001;
|
|
41
|
+
var SOLANA_ERROR__ACCOUNTS__FAILED_TO_DECODE_ACCOUNT = 3230002;
|
|
42
|
+
var SOLANA_ERROR__ACCOUNTS__EXPECTED_DECODED_ACCOUNT = 3230003;
|
|
43
|
+
var SOLANA_ERROR__ACCOUNTS__EXPECTED_ALL_ACCOUNTS_TO_BE_DECODED = 3230004;
|
|
44
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO__DISALLOWED_IN_INSECURE_CONTEXT = 361e4;
|
|
45
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO__DIGEST_UNIMPLEMENTED = 3610001;
|
|
46
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO__ED25519_ALGORITHM_UNIMPLEMENTED = 3610002;
|
|
47
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO__EXPORT_FUNCTION_UNIMPLEMENTED = 3610003;
|
|
48
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO__GENERATE_FUNCTION_UNIMPLEMENTED = 3610004;
|
|
49
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO__SIGN_FUNCTION_UNIMPLEMENTED = 3610005;
|
|
50
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO__VERIFY_FUNCTION_UNIMPLEMENTED = 3610006;
|
|
51
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO__CANNOT_EXPORT_NON_EXTRACTABLE_KEY = 3610007;
|
|
52
|
+
var SOLANA_ERROR__CRYPTO__RANDOM_VALUES_FUNCTION_UNIMPLEMENTED = 3611e3;
|
|
53
|
+
var SOLANA_ERROR__KEYS__INVALID_KEY_PAIR_BYTE_LENGTH = 3704e3;
|
|
54
|
+
var SOLANA_ERROR__KEYS__INVALID_PRIVATE_KEY_BYTE_LENGTH = 3704001;
|
|
55
|
+
var SOLANA_ERROR__KEYS__INVALID_SIGNATURE_BYTE_LENGTH = 3704002;
|
|
56
|
+
var SOLANA_ERROR__KEYS__SIGNATURE_STRING_LENGTH_OUT_OF_RANGE = 3704003;
|
|
57
|
+
var SOLANA_ERROR__KEYS__PUBLIC_KEY_MUST_MATCH_PRIVATE_KEY = 3704004;
|
|
58
|
+
var SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_ACCOUNTS = 4128e3;
|
|
59
|
+
var SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_DATA = 4128001;
|
|
60
|
+
var SOLANA_ERROR__INSTRUCTION__PROGRAM_ID_MISMATCH = 4128002;
|
|
61
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN = 4615e3;
|
|
62
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__GENERIC_ERROR = 4615001;
|
|
63
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ARGUMENT = 4615002;
|
|
64
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_INSTRUCTION_DATA = 4615003;
|
|
65
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_DATA = 4615004;
|
|
66
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_TOO_SMALL = 4615005;
|
|
67
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__INSUFFICIENT_FUNDS = 4615006;
|
|
68
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_PROGRAM_ID = 4615007;
|
|
69
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_REQUIRED_SIGNATURE = 4615008;
|
|
70
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_ALREADY_INITIALIZED = 4615009;
|
|
71
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__UNINITIALIZED_ACCOUNT = 4615010;
|
|
72
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__UNBALANCED_INSTRUCTION = 4615011;
|
|
73
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__MODIFIED_PROGRAM_ID = 4615012;
|
|
74
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_LAMPORT_SPEND = 4615013;
|
|
75
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_DATA_MODIFIED = 4615014;
|
|
76
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_LAMPORT_CHANGE = 4615015;
|
|
77
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_DATA_MODIFIED = 4615016;
|
|
78
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_INDEX = 4615017;
|
|
79
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_MODIFIED = 4615018;
|
|
80
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__RENT_EPOCH_MODIFIED = 4615019;
|
|
81
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__NOT_ENOUGH_ACCOUNT_KEYS = 4615020;
|
|
82
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_SIZE_CHANGED = 4615021;
|
|
83
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_EXECUTABLE = 4615022;
|
|
84
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_FAILED = 4615023;
|
|
85
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_OUTSTANDING = 4615024;
|
|
86
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_OUT_OF_SYNC = 4615025;
|
|
87
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM = 4615026;
|
|
88
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ERROR = 4615027;
|
|
89
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_DATA_MODIFIED = 4615028;
|
|
90
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_LAMPORT_CHANGE = 4615029;
|
|
91
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_ACCOUNT_NOT_RENT_EXEMPT = 4615030;
|
|
92
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_PROGRAM_ID = 4615031;
|
|
93
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__CALL_DEPTH = 4615032;
|
|
94
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_ACCOUNT = 4615033;
|
|
95
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__REENTRANCY_NOT_ALLOWED = 4615034;
|
|
96
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__MAX_SEED_LENGTH_EXCEEDED = 4615035;
|
|
97
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_SEEDS = 4615036;
|
|
98
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_REALLOC = 4615037;
|
|
99
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__COMPUTATIONAL_BUDGET_EXCEEDED = 4615038;
|
|
100
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__PRIVILEGE_ESCALATION = 4615039;
|
|
101
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_ENVIRONMENT_SETUP_FAILURE = 4615040;
|
|
102
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPLETE = 4615041;
|
|
103
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPILE = 4615042;
|
|
104
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__IMMUTABLE = 4615043;
|
|
105
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_AUTHORITY = 4615044;
|
|
106
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__BORSH_IO_ERROR = 4615045;
|
|
107
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_RENT_EXEMPT = 4615046;
|
|
108
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_OWNER = 4615047;
|
|
109
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__ARITHMETIC_OVERFLOW = 4615048;
|
|
110
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_SYSVAR = 4615049;
|
|
111
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__ILLEGAL_OWNER = 4615050;
|
|
112
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED = 4615051;
|
|
113
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_EXCEEDED = 4615052;
|
|
114
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED = 4615053;
|
|
115
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS = 4615054;
|
|
116
|
+
var SOLANA_ERROR__SIGNER__ADDRESS_CANNOT_HAVE_MULTIPLE_SIGNERS = 5508e3;
|
|
117
|
+
var SOLANA_ERROR__SIGNER__EXPECTED_KEY_PAIR_SIGNER = 5508001;
|
|
118
|
+
var SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_SIGNER = 5508002;
|
|
119
|
+
var SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_MODIFYING_SIGNER = 5508003;
|
|
120
|
+
var SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_PARTIAL_SIGNER = 5508004;
|
|
121
|
+
var SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SIGNER = 5508005;
|
|
122
|
+
var SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_MODIFYING_SIGNER = 5508006;
|
|
123
|
+
var SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_PARTIAL_SIGNER = 5508007;
|
|
124
|
+
var SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SENDING_SIGNER = 5508008;
|
|
125
|
+
var SOLANA_ERROR__SIGNER__TRANSACTION_CANNOT_HAVE_MULTIPLE_SENDING_SIGNERS = 5508009;
|
|
126
|
+
var SOLANA_ERROR__SIGNER__TRANSACTION_SENDING_SIGNER_MISSING = 5508010;
|
|
127
|
+
var SOLANA_ERROR__SIGNER__WALLET_MULTISIGN_UNIMPLEMENTED = 5508011;
|
|
128
|
+
var SOLANA_ERROR__SIGNER__WALLET_ACCOUNT_CANNOT_SIGN_TRANSACTION = 5508012;
|
|
129
|
+
var SOLANA_ERROR__OFFCHAIN_MESSAGE__MAXIMUM_LENGTH_EXCEEDED = 5607e3;
|
|
130
|
+
var SOLANA_ERROR__OFFCHAIN_MESSAGE__RESTRICTED_ASCII_BODY_CHARACTER_OUT_OF_RANGE = 5607001;
|
|
131
|
+
var SOLANA_ERROR__OFFCHAIN_MESSAGE__APPLICATION_DOMAIN_STRING_LENGTH_OUT_OF_RANGE = 5607002;
|
|
132
|
+
var SOLANA_ERROR__OFFCHAIN_MESSAGE__INVALID_APPLICATION_DOMAIN_BYTE_LENGTH = 5607003;
|
|
133
|
+
var SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_SIGNATURES_MISMATCH = 5607004;
|
|
134
|
+
var SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_REQUIRED_SIGNERS_CANNOT_BE_ZERO = 5607005;
|
|
135
|
+
var SOLANA_ERROR__OFFCHAIN_MESSAGE__VERSION_NUMBER_NOT_SUPPORTED = 5607006;
|
|
136
|
+
var SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_FORMAT_MISMATCH = 5607007;
|
|
137
|
+
var SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_LENGTH_MISMATCH = 5607008;
|
|
138
|
+
var SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_MUST_BE_NON_EMPTY = 5607009;
|
|
139
|
+
var SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_ENVELOPE_SIGNATURES_CANNOT_BE_ZERO = 5607010;
|
|
140
|
+
var SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURES_MISSING = 5607011;
|
|
141
|
+
var SOLANA_ERROR__OFFCHAIN_MESSAGE__ENVELOPE_SIGNERS_MISMATCH = 5607012;
|
|
142
|
+
var SOLANA_ERROR__OFFCHAIN_MESSAGE__ADDRESSES_CANNOT_SIGN_OFFCHAIN_MESSAGE = 5607013;
|
|
143
|
+
var SOLANA_ERROR__OFFCHAIN_MESSAGE__UNEXPECTED_VERSION = 5607014;
|
|
144
|
+
var SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATORIES_MUST_BE_SORTED = 5607015;
|
|
145
|
+
var SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATORIES_MUST_BE_UNIQUE = 5607016;
|
|
146
|
+
var SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURE_VERIFICATION_FAILURE = 5607017;
|
|
147
|
+
var SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES = 5663e3;
|
|
148
|
+
var SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE = 5663001;
|
|
149
|
+
var SOLANA_ERROR__TRANSACTION__EXPECTED_BLOCKHASH_LIFETIME = 5663002;
|
|
150
|
+
var SOLANA_ERROR__TRANSACTION__EXPECTED_NONCE_LIFETIME = 5663003;
|
|
151
|
+
var SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_OUT_OF_RANGE = 5663004;
|
|
152
|
+
var SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING = 5663005;
|
|
153
|
+
var SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE = 5663006;
|
|
154
|
+
var SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND = 5663007;
|
|
155
|
+
var SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_FEE_PAYER_MISSING = 5663008;
|
|
156
|
+
var SOLANA_ERROR__TRANSACTION__SIGNATURES_MISSING = 5663009;
|
|
157
|
+
var SOLANA_ERROR__TRANSACTION__ADDRESS_MISSING = 5663010;
|
|
158
|
+
var SOLANA_ERROR__TRANSACTION__FEE_PAYER_MISSING = 5663011;
|
|
159
|
+
var SOLANA_ERROR__TRANSACTION__FEE_PAYER_SIGNATURE_MISSING = 5663012;
|
|
160
|
+
var SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_INSTRUCTIONS_MISSING = 5663013;
|
|
161
|
+
var SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_FIRST_INSTRUCTION_MUST_BE_ADVANCE_NONCE = 5663014;
|
|
162
|
+
var SOLANA_ERROR__TRANSACTION__ADDRESSES_CANNOT_SIGN_TRANSACTION = 5663015;
|
|
163
|
+
var SOLANA_ERROR__TRANSACTION__CANNOT_ENCODE_WITH_EMPTY_SIGNATURES = 5663016;
|
|
164
|
+
var SOLANA_ERROR__TRANSACTION__MESSAGE_SIGNATURES_MISMATCH = 5663017;
|
|
165
|
+
var SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT = 5663018;
|
|
166
|
+
var SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT = 5663019;
|
|
167
|
+
var SOLANA_ERROR__TRANSACTION__EXCEEDS_SIZE_LIMIT = 5663020;
|
|
168
|
+
var SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_NOT_SUPPORTED = 5663021;
|
|
169
|
+
var SOLANA_ERROR__TRANSACTION__NONCE_ACCOUNT_CANNOT_BE_IN_LOOKUP_TABLE = 5663022;
|
|
170
|
+
var SOLANA_ERROR__TRANSACTION__MALFORMED_MESSAGE_BYTES = 5663023;
|
|
171
|
+
var SOLANA_ERROR__TRANSACTION__CANNOT_ENCODE_WITH_EMPTY_MESSAGE_BYTES = 5663024;
|
|
172
|
+
var SOLANA_ERROR__TRANSACTION__CANNOT_DECODE_EMPTY_TRANSACTION_BYTES = 5663025;
|
|
173
|
+
var SOLANA_ERROR__TRANSACTION__VERSION_ZERO_MUST_BE_ENCODED_WITH_SIGNATURES_FIRST = 5663026;
|
|
174
|
+
var SOLANA_ERROR__TRANSACTION__SIGNATURE_COUNT_TOO_HIGH_FOR_TRANSACTION_BYTES = 5663027;
|
|
175
|
+
var SOLANA_ERROR__TRANSACTION__INVALID_CONFIG_MASK_PRIORITY_FEE_BITS = 5663028;
|
|
176
|
+
var SOLANA_ERROR__TRANSACTION__INVALID_NONCE_ACCOUNT_INDEX = 5663029;
|
|
177
|
+
var SOLANA_ERROR__TRANSACTION__INVALID_CONFIG_VALUE_KIND = 5663030;
|
|
178
|
+
var SOLANA_ERROR__TRANSACTION__INSTRUCTION_HEADERS_PAYLOADS_MISMATCH = 5663031;
|
|
179
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__UNKNOWN = 705e4;
|
|
180
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_IN_USE = 7050001;
|
|
181
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_LOADED_TWICE = 7050002;
|
|
182
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_NOT_FOUND = 7050003;
|
|
183
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_ACCOUNT_NOT_FOUND = 7050004;
|
|
184
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_FEE = 7050005;
|
|
185
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_FOR_FEE = 7050006;
|
|
186
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__ALREADY_PROCESSED = 7050007;
|
|
187
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__BLOCKHASH_NOT_FOUND = 7050008;
|
|
188
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__CALL_CHAIN_TOO_DEEP = 7050009;
|
|
189
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__MISSING_SIGNATURE_FOR_FEE = 7050010;
|
|
190
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_INDEX = 7050011;
|
|
191
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__SIGNATURE_FAILURE = 7050012;
|
|
192
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__INVALID_PROGRAM_FOR_EXECUTION = 7050013;
|
|
193
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__SANITIZE_FAILURE = 7050014;
|
|
194
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__CLUSTER_MAINTENANCE = 7050015;
|
|
195
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_BORROW_OUTSTANDING = 7050016;
|
|
196
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_BLOCK_COST_LIMIT = 7050017;
|
|
197
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__UNSUPPORTED_VERSION = 7050018;
|
|
198
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__INVALID_WRITABLE_ACCOUNT = 7050019;
|
|
199
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_ACCOUNT_COST_LIMIT = 7050020;
|
|
200
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_BLOCK_LIMIT = 7050021;
|
|
201
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__TOO_MANY_ACCOUNT_LOCKS = 7050022;
|
|
202
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__ADDRESS_LOOKUP_TABLE_NOT_FOUND = 7050023;
|
|
203
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_OWNER = 7050024;
|
|
204
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_DATA = 7050025;
|
|
205
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_INDEX = 7050026;
|
|
206
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__INVALID_RENT_PAYING_ACCOUNT = 7050027;
|
|
207
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_VOTE_COST_LIMIT = 7050028;
|
|
208
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_TOTAL_LIMIT = 7050029;
|
|
209
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__DUPLICATE_INSTRUCTION = 7050030;
|
|
210
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_RENT = 7050031;
|
|
211
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__MAX_LOADED_ACCOUNTS_DATA_SIZE_EXCEEDED = 7050032;
|
|
212
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__INVALID_LOADED_ACCOUNTS_DATA_SIZE_LIMIT = 7050033;
|
|
213
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__RESANITIZATION_NEEDED = 7050034;
|
|
214
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED = 7050035;
|
|
215
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__UNBALANCED_TRANSACTION = 7050036;
|
|
216
|
+
var SOLANA_ERROR__INSTRUCTION_PLANS__MESSAGE_CANNOT_ACCOMMODATE_PLAN = 7618e3;
|
|
217
|
+
var SOLANA_ERROR__INSTRUCTION_PLANS__MESSAGE_PACKER_ALREADY_COMPLETE = 7618001;
|
|
218
|
+
var SOLANA_ERROR__INSTRUCTION_PLANS__EMPTY_INSTRUCTION_PLAN = 7618002;
|
|
219
|
+
var SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_TO_EXECUTE_TRANSACTION_PLAN = 7618003;
|
|
220
|
+
var SOLANA_ERROR__INSTRUCTION_PLANS__NON_DIVISIBLE_TRANSACTION_PLANS_NOT_SUPPORTED = 7618004;
|
|
221
|
+
var SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_SINGLE_TRANSACTION_PLAN_RESULT_NOT_FOUND = 7618005;
|
|
222
|
+
var SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_INSTRUCTION_PLAN = 7618006;
|
|
223
|
+
var SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_TRANSACTION_PLAN = 7618007;
|
|
224
|
+
var SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_TRANSACTION_PLAN_RESULT = 7618008;
|
|
225
|
+
var SOLANA_ERROR__INSTRUCTION_PLANS__EXPECTED_SUCCESSFUL_TRANSACTION_PLAN_RESULT = 7618009;
|
|
226
|
+
var SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY = 8078e3;
|
|
227
|
+
var SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH = 8078001;
|
|
228
|
+
var SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH = 8078002;
|
|
229
|
+
var SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH = 8078003;
|
|
230
|
+
var SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH = 8078004;
|
|
231
|
+
var SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH = 8078005;
|
|
232
|
+
var SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH = 8078006;
|
|
233
|
+
var SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS = 8078007;
|
|
234
|
+
var SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE = 8078008;
|
|
235
|
+
var SOLANA_ERROR__CODECS__INVALID_DISCRIMINATED_UNION_VARIANT = 8078009;
|
|
236
|
+
var SOLANA_ERROR__CODECS__INVALID_ENUM_VARIANT = 8078010;
|
|
237
|
+
var SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE = 8078011;
|
|
238
|
+
var SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE = 8078012;
|
|
239
|
+
var SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH = 8078013;
|
|
240
|
+
var SOLANA_ERROR__CODECS__OFFSET_OUT_OF_RANGE = 8078014;
|
|
241
|
+
var SOLANA_ERROR__CODECS__INVALID_LITERAL_UNION_VARIANT = 8078015;
|
|
242
|
+
var SOLANA_ERROR__CODECS__LITERAL_UNION_DISCRIMINATOR_OUT_OF_RANGE = 8078016;
|
|
243
|
+
var SOLANA_ERROR__CODECS__UNION_VARIANT_OUT_OF_RANGE = 8078017;
|
|
244
|
+
var SOLANA_ERROR__CODECS__INVALID_CONSTANT = 8078018;
|
|
245
|
+
var SOLANA_ERROR__CODECS__EXPECTED_ZERO_VALUE_TO_MATCH_ITEM_FIXED_SIZE = 8078019;
|
|
246
|
+
var SOLANA_ERROR__CODECS__ENCODED_BYTES_MUST_NOT_INCLUDE_SENTINEL = 8078020;
|
|
247
|
+
var SOLANA_ERROR__CODECS__SENTINEL_MISSING_IN_DECODED_BYTES = 8078021;
|
|
248
|
+
var SOLANA_ERROR__CODECS__CANNOT_USE_LEXICAL_VALUES_AS_ENUM_DISCRIMINATORS = 8078022;
|
|
249
|
+
var SOLANA_ERROR__CODECS__EXPECTED_DECODER_TO_CONSUME_ENTIRE_BYTE_ARRAY = 8078023;
|
|
250
|
+
var SOLANA_ERROR__CODECS__INVALID_PATTERN_MATCH_VALUE = 8078024;
|
|
251
|
+
var SOLANA_ERROR__CODECS__INVALID_PATTERN_MATCH_BYTES = 8078025;
|
|
252
|
+
var SOLANA_ERROR__RPC__INTEGER_OVERFLOW = 81e5;
|
|
253
|
+
var SOLANA_ERROR__RPC__TRANSPORT_HTTP_HEADER_FORBIDDEN = 8100001;
|
|
254
|
+
var SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR = 8100002;
|
|
255
|
+
var SOLANA_ERROR__RPC__API_PLAN_MISSING_FOR_RPC_METHOD = 8100003;
|
|
256
|
+
var SOLANA_ERROR__RPC_SUBSCRIPTIONS__CANNOT_CREATE_SUBSCRIPTION_PLAN = 819e4;
|
|
257
|
+
var SOLANA_ERROR__RPC_SUBSCRIPTIONS__EXPECTED_SERVER_SUBSCRIPTION_ID = 8190001;
|
|
258
|
+
var SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CLOSED_BEFORE_MESSAGE_BUFFERED = 8190002;
|
|
259
|
+
var SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CONNECTION_CLOSED = 8190003;
|
|
260
|
+
var SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_FAILED_TO_CONNECT = 8190004;
|
|
261
|
+
var SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS = 85e5;
|
|
262
|
+
var SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE = 8500001;
|
|
263
|
+
var SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION = 8500002;
|
|
264
|
+
var SOLANA_ERROR__PROGRAM_CLIENTS__UNEXPECTED_RESOLVED_INSTRUCTION_INPUT_TYPE = 8500003;
|
|
265
|
+
var SOLANA_ERROR__PROGRAM_CLIENTS__RESOLVED_INSTRUCTION_INPUT_MUST_BE_NON_NULL = 8500004;
|
|
266
|
+
var SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_ACCOUNT_TYPE = 8500005;
|
|
267
|
+
var SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT = 8500006;
|
|
268
|
+
var SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_STATE_MISSING = 99e5;
|
|
269
|
+
var SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_MUST_NOT_POLL_BEFORE_RESOLVING_EXISTING_MESSAGE_PROMISE = 9900001;
|
|
270
|
+
var SOLANA_ERROR__INVARIANT_VIOLATION__CACHED_ABORTABLE_ITERABLE_CACHE_ENTRY_MISSING = 9900002;
|
|
271
|
+
var SOLANA_ERROR__INVARIANT_VIOLATION__SWITCH_MUST_BE_EXHAUSTIVE = 9900003;
|
|
272
|
+
var SOLANA_ERROR__INVARIANT_VIOLATION__DATA_PUBLISHER_CHANNEL_UNIMPLEMENTED = 9900004;
|
|
273
|
+
var SOLANA_ERROR__INVARIANT_VIOLATION__INVALID_INSTRUCTION_PLAN_KIND = 9900005;
|
|
274
|
+
var SOLANA_ERROR__INVARIANT_VIOLATION__INVALID_TRANSACTION_PLAN_KIND = 9900006;
|
|
275
|
+
function encodeValue(value) {
|
|
276
|
+
if (Array.isArray(value)) return "%5B" + value.map(encodeValue).join("%2C%20") + "%5D";
|
|
277
|
+
else if (typeof value === "bigint") return `${value}n`;
|
|
278
|
+
else return encodeURIComponent(String(value != null && Object.getPrototypeOf(value) === null ? { ...value } : value));
|
|
279
|
+
}
|
|
280
|
+
function encodeObjectContextEntry([key, value]) {
|
|
281
|
+
return `${key}=${encodeValue(value)}`;
|
|
282
|
+
}
|
|
283
|
+
function encodeContextObject(context) {
|
|
284
|
+
const searchParamsString = Object.entries(context).map(encodeObjectContextEntry).join("&");
|
|
285
|
+
return Buffer.from(searchParamsString, "utf8").toString("base64");
|
|
286
|
+
}
|
|
287
|
+
var SolanaErrorMessages = {
|
|
288
|
+
[SOLANA_ERROR__ACCOUNTS__ACCOUNT_NOT_FOUND]: "Account not found at address: $address",
|
|
289
|
+
[SOLANA_ERROR__ACCOUNTS__EXPECTED_ALL_ACCOUNTS_TO_BE_DECODED]: "Not all accounts were decoded. Encoded accounts found at addresses: $addresses.",
|
|
290
|
+
[SOLANA_ERROR__ACCOUNTS__EXPECTED_DECODED_ACCOUNT]: "Expected decoded account at address: $address",
|
|
291
|
+
[SOLANA_ERROR__ACCOUNTS__FAILED_TO_DECODE_ACCOUNT]: "Failed to decode account data at address: $address",
|
|
292
|
+
[SOLANA_ERROR__ACCOUNTS__ONE_OR_MORE_ACCOUNTS_NOT_FOUND]: "Accounts not found at addresses: $addresses",
|
|
293
|
+
[SOLANA_ERROR__ADDRESSES__FAILED_TO_FIND_VIABLE_PDA_BUMP_SEED]: "Unable to find a viable program address bump seed.",
|
|
294
|
+
[SOLANA_ERROR__ADDRESSES__INVALID_BASE58_ENCODED_ADDRESS]: "$putativeAddress is not a base58-encoded address.",
|
|
295
|
+
[SOLANA_ERROR__ADDRESSES__INVALID_BYTE_LENGTH]: "Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.",
|
|
296
|
+
[SOLANA_ERROR__ADDRESSES__INVALID_ED25519_PUBLIC_KEY]: "The `CryptoKey` must be an `Ed25519` public key.",
|
|
297
|
+
[SOLANA_ERROR__ADDRESSES__INVALID_OFF_CURVE_ADDRESS]: "$putativeOffCurveAddress is not a base58-encoded off-curve address.",
|
|
298
|
+
[SOLANA_ERROR__ADDRESSES__INVALID_SEEDS_POINT_ON_CURVE]: "Invalid seeds; point must fall off the Ed25519 curve.",
|
|
299
|
+
[SOLANA_ERROR__ADDRESSES__MALFORMED_PDA]: "Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].",
|
|
300
|
+
[SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED]: "A maximum of $maxSeeds seeds, including the bump seed, may be supplied when creating an address. Received: $actual.",
|
|
301
|
+
[SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED]: "The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.",
|
|
302
|
+
[SOLANA_ERROR__ADDRESSES__PDA_BUMP_SEED_OUT_OF_RANGE]: "Expected program derived address bump to be in the range [0, 255], got: $bump.",
|
|
303
|
+
[SOLANA_ERROR__ADDRESSES__PDA_ENDS_WITH_PDA_MARKER]: "Program address cannot end with PDA marker.",
|
|
304
|
+
[SOLANA_ERROR__ADDRESSES__STRING_LENGTH_OUT_OF_RANGE]: "Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.",
|
|
305
|
+
[4]: "Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.",
|
|
306
|
+
[1]: "The network has progressed past the last block for which this transaction could have been committed.",
|
|
307
|
+
[SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY]: "Codec [$codecDescription] cannot decode empty byte arrays.",
|
|
308
|
+
[SOLANA_ERROR__CODECS__CANNOT_USE_LEXICAL_VALUES_AS_ENUM_DISCRIMINATORS]: "Enum codec cannot use lexical values [$stringValues] as discriminators. Either remove all lexical values or set `useValuesAsDiscriminators` to `false`.",
|
|
309
|
+
[SOLANA_ERROR__CODECS__ENCODED_BYTES_MUST_NOT_INCLUDE_SENTINEL]: "Sentinel [$hexSentinel] must not be present in encoded bytes [$hexEncodedBytes].",
|
|
310
|
+
[SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH]: "Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].",
|
|
311
|
+
[SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH]: "Encoder and decoder must have the same max size, got [$encoderMaxSize] and [$decoderMaxSize].",
|
|
312
|
+
[SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH]: "Encoder and decoder must either both be fixed-size or variable-size.",
|
|
313
|
+
[SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE]: "Enum discriminator out of range. Expected a number in [$formattedValidDiscriminators], got $discriminator.",
|
|
314
|
+
[SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH]: "Expected a fixed-size codec, got a variable-size one.",
|
|
315
|
+
[SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH]: "Codec [$codecDescription] expected a positive byte length, got $bytesLength.",
|
|
316
|
+
[SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH]: "Expected a variable-size codec, got a fixed-size one.",
|
|
317
|
+
[SOLANA_ERROR__CODECS__EXPECTED_ZERO_VALUE_TO_MATCH_ITEM_FIXED_SIZE]: "Codec [$codecDescription] expected zero-value [$hexZeroValue] to have the same size as the provided fixed-size item [$expectedSize bytes].",
|
|
318
|
+
[SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH]: "Codec [$codecDescription] expected $expected bytes, got $bytesLength.",
|
|
319
|
+
[SOLANA_ERROR__CODECS__INVALID_CONSTANT]: "Expected byte array constant [$hexConstant] to be present in data [$hexData] at offset [$offset].",
|
|
320
|
+
[SOLANA_ERROR__CODECS__INVALID_DISCRIMINATED_UNION_VARIANT]: "Invalid discriminated union variant. Expected one of [$variants], got $value.",
|
|
321
|
+
[SOLANA_ERROR__CODECS__INVALID_ENUM_VARIANT]: "Invalid enum variant. Expected one of [$stringValues] or a number in [$formattedNumericalValues], got $variant.",
|
|
322
|
+
[SOLANA_ERROR__CODECS__INVALID_LITERAL_UNION_VARIANT]: "Invalid literal union variant. Expected one of [$variants], got $value.",
|
|
323
|
+
[SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS]: "Expected [$codecDescription] to have $expected items, got $actual.",
|
|
324
|
+
[SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE]: "Invalid value $value for base $base with alphabet $alphabet.",
|
|
325
|
+
[SOLANA_ERROR__CODECS__LITERAL_UNION_DISCRIMINATOR_OUT_OF_RANGE]: "Literal union discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.",
|
|
326
|
+
[SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE]: "Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.",
|
|
327
|
+
[SOLANA_ERROR__CODECS__OFFSET_OUT_OF_RANGE]: "Codec [$codecDescription] expected offset to be in the range [0, $bytesLength], got $offset.",
|
|
328
|
+
[SOLANA_ERROR__CODECS__SENTINEL_MISSING_IN_DECODED_BYTES]: "Expected sentinel [$hexSentinel] to be present in decoded bytes [$hexDecodedBytes].",
|
|
329
|
+
[SOLANA_ERROR__CODECS__UNION_VARIANT_OUT_OF_RANGE]: "Union variant out of range. Expected an index between $minRange and $maxRange, got $variant.",
|
|
330
|
+
[SOLANA_ERROR__CODECS__EXPECTED_DECODER_TO_CONSUME_ENTIRE_BYTE_ARRAY]: "This decoder expected a byte array of exactly $expectedLength bytes, but $numExcessBytes unexpected excess bytes remained after decoding. Are you sure that you have chosen the correct decoder for this data?",
|
|
331
|
+
[SOLANA_ERROR__CODECS__INVALID_PATTERN_MATCH_VALUE]: "Invalid pattern match value. The provided value does not match any of the specified patterns.",
|
|
332
|
+
[SOLANA_ERROR__CODECS__INVALID_PATTERN_MATCH_BYTES]: "Invalid pattern match bytes. The provided byte array does not match any of the specified patterns.",
|
|
333
|
+
[SOLANA_ERROR__CRYPTO__RANDOM_VALUES_FUNCTION_UNIMPLEMENTED]: "No random values implementation could be found.",
|
|
334
|
+
[11]: "Failed to send transaction$causeMessage",
|
|
335
|
+
[12]: "Failed to send transactions$causeMessages",
|
|
336
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_ALREADY_INITIALIZED]: "Instruction requires an uninitialized account",
|
|
337
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_FAILED]: "Instruction tries to borrow reference for an account which is already borrowed",
|
|
338
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_OUTSTANDING]: "Instruction left account with an outstanding borrowed reference",
|
|
339
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_SIZE_CHANGED]: "Program other than the account's owner changed the size of the account data",
|
|
340
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_TOO_SMALL]: "Account data too small for instruction",
|
|
341
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_EXECUTABLE]: "Instruction expected an executable account",
|
|
342
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_RENT_EXEMPT]: "An account does not have enough lamports to be rent-exempt",
|
|
343
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__ARITHMETIC_OVERFLOW]: "Program arithmetic overflowed",
|
|
344
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__BORSH_IO_ERROR]: "Failed to serialize or deserialize account data",
|
|
345
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS]: "Builtin programs must consume compute units",
|
|
346
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__CALL_DEPTH]: "Cross-program invocation call depth too deep",
|
|
347
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__COMPUTATIONAL_BUDGET_EXCEEDED]: "Computational budget exceeded",
|
|
348
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM]: "Custom program error: #$code",
|
|
349
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_INDEX]: "Instruction contains duplicate accounts",
|
|
350
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_OUT_OF_SYNC]: "Instruction modifications of multiply-passed account differ",
|
|
351
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_ACCOUNT_NOT_RENT_EXEMPT]: "Executable accounts must be rent exempt",
|
|
352
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_DATA_MODIFIED]: "Instruction changed executable accounts data",
|
|
353
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_LAMPORT_CHANGE]: "Instruction changed the balance of an executable account",
|
|
354
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_MODIFIED]: "Instruction changed executable bit of an account",
|
|
355
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_DATA_MODIFIED]: "Instruction modified data of an account it does not own",
|
|
356
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_LAMPORT_SPEND]: "Instruction spent from the balance of an account it does not own",
|
|
357
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__GENERIC_ERROR]: "Generic instruction error",
|
|
358
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__ILLEGAL_OWNER]: "Provided owner is not allowed",
|
|
359
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__IMMUTABLE]: "Account is immutable",
|
|
360
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_AUTHORITY]: "Incorrect authority provided",
|
|
361
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_PROGRAM_ID]: "Incorrect program id for instruction",
|
|
362
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__INSUFFICIENT_FUNDS]: "Insufficient funds for instruction",
|
|
363
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_DATA]: "Invalid account data for instruction",
|
|
364
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_OWNER]: "Invalid account owner",
|
|
365
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ARGUMENT]: "Invalid program argument",
|
|
366
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ERROR]: "Program returned invalid error code",
|
|
367
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_INSTRUCTION_DATA]: "Invalid instruction data",
|
|
368
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_REALLOC]: "Failed to reallocate account data",
|
|
369
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_SEEDS]: "Provided seeds do not result in a valid address",
|
|
370
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED]: "Accounts data allocations exceeded the maximum allowed per transaction",
|
|
371
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_EXCEEDED]: "Max accounts exceeded",
|
|
372
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED]: "Max instruction trace length exceeded",
|
|
373
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__MAX_SEED_LENGTH_EXCEEDED]: "Length of the seed is too long for address generation",
|
|
374
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_ACCOUNT]: "An account required by the instruction is missing",
|
|
375
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_REQUIRED_SIGNATURE]: "Missing required signature for instruction",
|
|
376
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__MODIFIED_PROGRAM_ID]: "Instruction illegally modified the program id of an account",
|
|
377
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__NOT_ENOUGH_ACCOUNT_KEYS]: "Insufficient account keys for instruction",
|
|
378
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__PRIVILEGE_ESCALATION]: "Cross-program invocation with unauthorized signer or writable account",
|
|
379
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_ENVIRONMENT_SETUP_FAILURE]: "Failed to create program execution environment",
|
|
380
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPILE]: "Program failed to compile",
|
|
381
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPLETE]: "Program failed to complete",
|
|
382
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_DATA_MODIFIED]: "Instruction modified data of a read-only account",
|
|
383
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_LAMPORT_CHANGE]: "Instruction changed the balance of a read-only account",
|
|
384
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__REENTRANCY_NOT_ALLOWED]: "Cross-program invocation reentrancy not allowed for this instruction",
|
|
385
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__RENT_EPOCH_MODIFIED]: "Instruction modified rent epoch of an account",
|
|
386
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__UNBALANCED_INSTRUCTION]: "Sum of account balances before and after instruction do not match",
|
|
387
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__UNINITIALIZED_ACCOUNT]: "Instruction requires an initialized account",
|
|
388
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN]: "The instruction failed with the error: $errorName",
|
|
389
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_PROGRAM_ID]: "Unsupported program id",
|
|
390
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_SYSVAR]: "Unsupported sysvar",
|
|
391
|
+
[SOLANA_ERROR__INVARIANT_VIOLATION__INVALID_INSTRUCTION_PLAN_KIND]: "Invalid instruction plan kind: $kind.",
|
|
392
|
+
[SOLANA_ERROR__INSTRUCTION_PLANS__EMPTY_INSTRUCTION_PLAN]: "The provided instruction plan is empty.",
|
|
393
|
+
[SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_SINGLE_TRANSACTION_PLAN_RESULT_NOT_FOUND]: "No failed transaction plan result was found in the provided transaction plan result.",
|
|
394
|
+
[SOLANA_ERROR__INSTRUCTION_PLANS__NON_DIVISIBLE_TRANSACTION_PLANS_NOT_SUPPORTED]: "This transaction plan executor does not support non-divisible sequential plans. To support them, you may create your own executor such that multi-transaction atomicity is preserved — e.g. by targetting RPCs that support transaction bundles.",
|
|
395
|
+
[SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_TO_EXECUTE_TRANSACTION_PLAN]: "The provided transaction plan failed to execute. See the `transactionPlanResult` attribute for more details. Note that the `cause` property is deprecated, and a future version will not set it.",
|
|
396
|
+
[SOLANA_ERROR__INSTRUCTION_PLANS__MESSAGE_CANNOT_ACCOMMODATE_PLAN]: "The provided message has insufficient capacity to accommodate the next instruction(s) in this plan. Expected at least $numBytesRequired free byte(s), got $numFreeBytes byte(s).",
|
|
397
|
+
[SOLANA_ERROR__INVARIANT_VIOLATION__INVALID_TRANSACTION_PLAN_KIND]: "Invalid transaction plan kind: $kind.",
|
|
398
|
+
[SOLANA_ERROR__INSTRUCTION_PLANS__MESSAGE_PACKER_ALREADY_COMPLETE]: "No more instructions to pack; the message packer has completed the instruction plan.",
|
|
399
|
+
[SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_INSTRUCTION_PLAN]: "Unexpected instruction plan. Expected $expectedKind plan, got $actualKind plan.",
|
|
400
|
+
[SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_TRANSACTION_PLAN]: "Unexpected transaction plan. Expected $expectedKind plan, got $actualKind plan.",
|
|
401
|
+
[SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_TRANSACTION_PLAN_RESULT]: "Unexpected transaction plan result. Expected $expectedKind plan, got $actualKind plan.",
|
|
402
|
+
[SOLANA_ERROR__INSTRUCTION_PLANS__EXPECTED_SUCCESSFUL_TRANSACTION_PLAN_RESULT]: "Expected a successful transaction plan result. I.e. there is at least one failed or cancelled transaction in the plan.",
|
|
403
|
+
[SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_ACCOUNTS]: "The instruction does not have any accounts.",
|
|
404
|
+
[SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_DATA]: "The instruction does not have any data.",
|
|
405
|
+
[SOLANA_ERROR__INSTRUCTION__PROGRAM_ID_MISMATCH]: "Expected instruction to have progress address $expectedProgramAddress, got $actualProgramAddress.",
|
|
406
|
+
[5]: "Expected base58 encoded blockhash to decode to a byte array of length 32. Actual length: $actualLength.",
|
|
407
|
+
[2]: "The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",
|
|
408
|
+
[SOLANA_ERROR__INVARIANT_VIOLATION__CACHED_ABORTABLE_ITERABLE_CACHE_ENTRY_MISSING]: "Invariant violation: Found no abortable iterable cache entry for key `$cacheKey`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",
|
|
409
|
+
[SOLANA_ERROR__INVARIANT_VIOLATION__DATA_PUBLISHER_CHANNEL_UNIMPLEMENTED]: "Invariant violation: This data publisher does not publish to the channel named `$channelName`. Supported channels include $supportedChannelNames.",
|
|
410
|
+
[SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_MUST_NOT_POLL_BEFORE_RESOLVING_EXISTING_MESSAGE_PROMISE]: "Invariant violation: WebSocket message iterator state is corrupt; iterated without first resolving existing message promise. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",
|
|
411
|
+
[SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_STATE_MISSING]: "Invariant violation: WebSocket message iterator is missing state storage. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",
|
|
412
|
+
[SOLANA_ERROR__INVARIANT_VIOLATION__SWITCH_MUST_BE_EXHAUSTIVE]: "Invariant violation: Switch statement non-exhaustive. Received unexpected value `$unexpectedValue`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",
|
|
413
|
+
[SOLANA_ERROR__JSON_RPC__INTERNAL_ERROR]: "JSON-RPC error: Internal JSON-RPC error ($__serverMessage)",
|
|
414
|
+
[SOLANA_ERROR__JSON_RPC__INVALID_PARAMS]: "JSON-RPC error: Invalid method parameter(s) ($__serverMessage)",
|
|
415
|
+
[SOLANA_ERROR__JSON_RPC__INVALID_REQUEST]: "JSON-RPC error: The JSON sent is not a valid `Request` object ($__serverMessage)",
|
|
416
|
+
[SOLANA_ERROR__JSON_RPC__METHOD_NOT_FOUND]: "JSON-RPC error: The method does not exist / is not available ($__serverMessage)",
|
|
417
|
+
[SOLANA_ERROR__JSON_RPC__PARSE_ERROR]: "JSON-RPC error: An error occurred on the server while parsing the JSON text ($__serverMessage)",
|
|
418
|
+
[SOLANA_ERROR__JSON_RPC__SCAN_ERROR]: "$__serverMessage",
|
|
419
|
+
[SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_CLEANED_UP]: "$__serverMessage",
|
|
420
|
+
[SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_NOT_AVAILABLE]: "$__serverMessage",
|
|
421
|
+
[SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET]: "$__serverMessage",
|
|
422
|
+
[SOLANA_ERROR__JSON_RPC__SERVER_ERROR_EPOCH_REWARDS_PERIOD_ACTIVE]: "Epoch rewards period still active at slot $slot",
|
|
423
|
+
[SOLANA_ERROR__JSON_RPC__SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX]: "$__serverMessage",
|
|
424
|
+
[SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED]: "$__serverMessage",
|
|
425
|
+
[SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_UNREACHABLE]: "Failed to query long-term storage; please try again",
|
|
426
|
+
[SOLANA_ERROR__JSON_RPC__SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED]: "Minimum context slot has not been reached",
|
|
427
|
+
[SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NODE_UNHEALTHY]: "Node is unhealthy; behind by $numSlotsBehind slots",
|
|
428
|
+
[SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SNAPSHOT]: "No snapshot",
|
|
429
|
+
[SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE]: "Transaction simulation failed",
|
|
430
|
+
[SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_NOT_EPOCH_BOUNDARY]: "Rewards cannot be found because slot $slot is not the epoch boundary. This may be due to gap in the queried node's local ledger or long-term storage",
|
|
431
|
+
[SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_SKIPPED]: "$__serverMessage",
|
|
432
|
+
[SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE]: "Transaction history is not available from this node",
|
|
433
|
+
[SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE]: "$__serverMessage",
|
|
434
|
+
[SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH]: "Transaction signature length mismatch",
|
|
435
|
+
[SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE]: "Transaction signature verification failure",
|
|
436
|
+
[SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION]: "$__serverMessage",
|
|
437
|
+
[SOLANA_ERROR__KEYS__INVALID_KEY_PAIR_BYTE_LENGTH]: "Key pair bytes must be of length 64, got $byteLength.",
|
|
438
|
+
[SOLANA_ERROR__KEYS__INVALID_PRIVATE_KEY_BYTE_LENGTH]: "Expected private key bytes with length 32. Actual length: $actualLength.",
|
|
439
|
+
[SOLANA_ERROR__KEYS__INVALID_SIGNATURE_BYTE_LENGTH]: "Expected base58-encoded signature to decode to a byte array of length 64. Actual length: $actualLength.",
|
|
440
|
+
[SOLANA_ERROR__KEYS__PUBLIC_KEY_MUST_MATCH_PRIVATE_KEY]: "The provided private key does not match the provided public key.",
|
|
441
|
+
[SOLANA_ERROR__KEYS__SIGNATURE_STRING_LENGTH_OUT_OF_RANGE]: "Expected base58-encoded signature string of length in the range [64, 88]. Actual length: $actualLength.",
|
|
442
|
+
[6]: "Lamports value must be in the range [0, 2e64-1]",
|
|
443
|
+
[7]: "`$value` cannot be parsed as a `BigInt`",
|
|
444
|
+
[10]: "$message",
|
|
445
|
+
[8]: "`$value` cannot be parsed as a `Number`",
|
|
446
|
+
[3]: "No nonce account could be found at address `$nonceAccountAddress`",
|
|
447
|
+
[SOLANA_ERROR__OFFCHAIN_MESSAGE__INVALID_APPLICATION_DOMAIN_BYTE_LENGTH]: "Expected base58 encoded application domain to decode to a byte array of length 32. Actual length: $actualLength.",
|
|
448
|
+
[SOLANA_ERROR__OFFCHAIN_MESSAGE__ADDRESSES_CANNOT_SIGN_OFFCHAIN_MESSAGE]: "Attempted to sign an offchain message with an address that is not a signer for it",
|
|
449
|
+
[SOLANA_ERROR__OFFCHAIN_MESSAGE__APPLICATION_DOMAIN_STRING_LENGTH_OUT_OF_RANGE]: "Expected base58-encoded application domain string of length in the range [32, 44]. Actual length: $actualLength.",
|
|
450
|
+
[SOLANA_ERROR__OFFCHAIN_MESSAGE__ENVELOPE_SIGNERS_MISMATCH]: "The signer addresses in this offchain message envelope do not match the list of required signers in the message preamble. These unexpected signers were present in the envelope: `[$unexpectedSigners]`. These required signers were missing from the envelope `[$missingSigners]`.",
|
|
451
|
+
[SOLANA_ERROR__OFFCHAIN_MESSAGE__MAXIMUM_LENGTH_EXCEEDED]: "The message body provided has a byte-length of $actualBytes. The maximum allowable byte-length is $maxBytes",
|
|
452
|
+
[SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_FORMAT_MISMATCH]: "Expected message format $expectedMessageFormat, got $actualMessageFormat",
|
|
453
|
+
[SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_LENGTH_MISMATCH]: "The message length specified in the message preamble is $specifiedLength bytes. The actual length of the message is $actualLength bytes.",
|
|
454
|
+
[SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_MUST_BE_NON_EMPTY]: "Offchain message content must be non-empty",
|
|
455
|
+
[SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_REQUIRED_SIGNERS_CANNOT_BE_ZERO]: "Offchain message must specify the address of at least one required signer",
|
|
456
|
+
[SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_ENVELOPE_SIGNATURES_CANNOT_BE_ZERO]: "Offchain message envelope must reserve space for at least one signature",
|
|
457
|
+
[SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_SIGNATURES_MISMATCH]: "The offchain message preamble specifies $numRequiredSignatures required signature(s), got $signaturesLength.",
|
|
458
|
+
[SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATORIES_MUST_BE_SORTED]: "The signatories of this offchain message must be listed in lexicographical order",
|
|
459
|
+
[SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATORIES_MUST_BE_UNIQUE]: "An address must be listed no more than once among the signatories of an offchain message",
|
|
460
|
+
[SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURES_MISSING]: "Offchain message is missing signatures for addresses: $addresses.",
|
|
461
|
+
[SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURE_VERIFICATION_FAILURE]: "Offchain message signature verification failed. Signature mismatch for required signatories [$signatoriesWithInvalidSignatures]. Missing signatures for signatories [$signatoriesWithMissingSignatures]",
|
|
462
|
+
[SOLANA_ERROR__OFFCHAIN_MESSAGE__RESTRICTED_ASCII_BODY_CHARACTER_OUT_OF_RANGE]: "The message body provided contains characters whose codes fall outside the allowed range. In order to ensure clear-signing compatiblity with hardware wallets, the message may only contain line feeds and characters in the range [\\x20-\\x7e].",
|
|
463
|
+
[SOLANA_ERROR__OFFCHAIN_MESSAGE__UNEXPECTED_VERSION]: "Expected offchain message version $expectedVersion. Got $actualVersion.",
|
|
464
|
+
[SOLANA_ERROR__OFFCHAIN_MESSAGE__VERSION_NUMBER_NOT_SUPPORTED]: "This version of Kit does not support decoding offchain messages with version $unsupportedVersion. The current max supported version is 0.",
|
|
465
|
+
[SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT]: "The provided account could not be identified as an account from the $programName program.",
|
|
466
|
+
[SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION]: "The provided instruction could not be identified as an instruction from the $programName program.",
|
|
467
|
+
[SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS]: "The provided instruction is missing some accounts. Expected at least $expectedAccountMetas account(s), got $actualAccountMetas.",
|
|
468
|
+
[SOLANA_ERROR__PROGRAM_CLIENTS__RESOLVED_INSTRUCTION_INPUT_MUST_BE_NON_NULL]: "Expected resolved instruction input '$inputName' to be non-null.",
|
|
469
|
+
[SOLANA_ERROR__PROGRAM_CLIENTS__UNEXPECTED_RESOLVED_INSTRUCTION_INPUT_TYPE]: "Expected resolved instruction input '$inputName' to be of type `$expectedType`.",
|
|
470
|
+
[SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_ACCOUNT_TYPE]: "Unrecognized account type '$accountType' for the $programName program.",
|
|
471
|
+
[SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE]: "Unrecognized instruction type '$instructionType' for the $programName program.",
|
|
472
|
+
[SOLANA_ERROR__RPC_SUBSCRIPTIONS__CANNOT_CREATE_SUBSCRIPTION_PLAN]: "The notification name must end in 'Notifications' and the API must supply a subscription plan creator function for the notification '$notificationName'.",
|
|
473
|
+
[SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CLOSED_BEFORE_MESSAGE_BUFFERED]: "WebSocket was closed before payload could be added to the send buffer",
|
|
474
|
+
[SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CONNECTION_CLOSED]: "WebSocket connection closed",
|
|
475
|
+
[SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_FAILED_TO_CONNECT]: "WebSocket failed to connect",
|
|
476
|
+
[SOLANA_ERROR__RPC_SUBSCRIPTIONS__EXPECTED_SERVER_SUBSCRIPTION_ID]: "Failed to obtain a subscription id from the server",
|
|
477
|
+
[SOLANA_ERROR__RPC__API_PLAN_MISSING_FOR_RPC_METHOD]: "Could not find an API plan for RPC method: `$method`",
|
|
478
|
+
[SOLANA_ERROR__RPC__INTEGER_OVERFLOW]: "The $argumentLabel argument to the `$methodName` RPC method$optionalPathLabel was `$value`. This number is unsafe for use with the Solana JSON-RPC because it exceeds `Number.MAX_SAFE_INTEGER`.",
|
|
479
|
+
[SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR]: "HTTP error ($statusCode): $message",
|
|
480
|
+
[SOLANA_ERROR__RPC__TRANSPORT_HTTP_HEADER_FORBIDDEN]: "HTTP header(s) forbidden: $headers. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.",
|
|
481
|
+
[SOLANA_ERROR__SIGNER__ADDRESS_CANNOT_HAVE_MULTIPLE_SIGNERS]: "Multiple distinct signers were identified for address `$address`. Please ensure that you are using the same signer instance for each address.",
|
|
482
|
+
[SOLANA_ERROR__SIGNER__EXPECTED_KEY_PAIR_SIGNER]: "The provided value does not implement the `KeyPairSigner` interface",
|
|
483
|
+
[SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_MODIFYING_SIGNER]: "The provided value does not implement the `MessageModifyingSigner` interface",
|
|
484
|
+
[SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_PARTIAL_SIGNER]: "The provided value does not implement the `MessagePartialSigner` interface",
|
|
485
|
+
[SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_SIGNER]: "The provided value does not implement any of the `MessageSigner` interfaces",
|
|
486
|
+
[SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_MODIFYING_SIGNER]: "The provided value does not implement the `TransactionModifyingSigner` interface",
|
|
487
|
+
[SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_PARTIAL_SIGNER]: "The provided value does not implement the `TransactionPartialSigner` interface",
|
|
488
|
+
[SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SENDING_SIGNER]: "The provided value does not implement the `TransactionSendingSigner` interface",
|
|
489
|
+
[SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SIGNER]: "The provided value does not implement any of the `TransactionSigner` interfaces",
|
|
490
|
+
[SOLANA_ERROR__SIGNER__TRANSACTION_CANNOT_HAVE_MULTIPLE_SENDING_SIGNERS]: "More than one `TransactionSendingSigner` was identified.",
|
|
491
|
+
[SOLANA_ERROR__SIGNER__TRANSACTION_SENDING_SIGNER_MISSING]: "No `TransactionSendingSigner` was identified. Please provide a valid `TransactionWithSingleSendingSigner` transaction.",
|
|
492
|
+
[SOLANA_ERROR__SIGNER__WALLET_ACCOUNT_CANNOT_SIGN_TRANSACTION]: "The wallet account $address cannot be used to create a transaction signer because it does not implement either the `solana:signTransaction` or `solana:signAndSendTransaction` feature. At least one of these features is required. The account supports the following features: $supportedFeatures.",
|
|
493
|
+
[SOLANA_ERROR__SIGNER__WALLET_MULTISIGN_UNIMPLEMENTED]: "Wallet account signers do not support signing multiple messages/transactions in a single operation",
|
|
494
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO__CANNOT_EXPORT_NON_EXTRACTABLE_KEY]: "Cannot export a non-extractable key.",
|
|
495
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO__DIGEST_UNIMPLEMENTED]: "No digest implementation could be found.",
|
|
496
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO__DISALLOWED_IN_INSECURE_CONTEXT]: "Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.",
|
|
497
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO__ED25519_ALGORITHM_UNIMPLEMENTED]: "This runtime does not support the generation of Ed25519 key pairs.\n\nInstall @solana/webcrypto-ed25519-polyfill and call its `install` function before generating keys in environments that do not support Ed25519.\n\nFor a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20.",
|
|
498
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO__EXPORT_FUNCTION_UNIMPLEMENTED]: "No signature verification implementation could be found.",
|
|
499
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO__GENERATE_FUNCTION_UNIMPLEMENTED]: "No key generation implementation could be found.",
|
|
500
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO__SIGN_FUNCTION_UNIMPLEMENTED]: "No signing implementation could be found.",
|
|
501
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO__VERIFY_FUNCTION_UNIMPLEMENTED]: "No key export implementation could be found.",
|
|
502
|
+
[9]: "Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given",
|
|
503
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_BORROW_OUTSTANDING]: "Transaction processing left an account with an outstanding borrowed reference",
|
|
504
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_IN_USE]: "Account in use",
|
|
505
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_LOADED_TWICE]: "Account loaded twice",
|
|
506
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_NOT_FOUND]: "Attempt to debit an account but found no record of a prior credit.",
|
|
507
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__ADDRESS_LOOKUP_TABLE_NOT_FOUND]: "Transaction loads an address table account that doesn't exist",
|
|
508
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__ALREADY_PROCESSED]: "This transaction has already been processed",
|
|
509
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__BLOCKHASH_NOT_FOUND]: "Blockhash not found",
|
|
510
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__CALL_CHAIN_TOO_DEEP]: "Loader call chain is too deep",
|
|
511
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__CLUSTER_MAINTENANCE]: "Transactions are currently disabled due to cluster maintenance",
|
|
512
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__DUPLICATE_INSTRUCTION]: "Transaction contains a duplicate instruction ($index) that is not allowed",
|
|
513
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_FEE]: "Insufficient funds for fee",
|
|
514
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_RENT]: "Transaction results in an account ($accountIndex) with insufficient funds for rent",
|
|
515
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_FOR_FEE]: "This account may not be used to pay transaction fees",
|
|
516
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_INDEX]: "Transaction contains an invalid account reference",
|
|
517
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_DATA]: "Transaction loads an address table account with invalid data",
|
|
518
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_INDEX]: "Transaction address table lookup uses an invalid index",
|
|
519
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_OWNER]: "Transaction loads an address table account with an invalid owner",
|
|
520
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__INVALID_LOADED_ACCOUNTS_DATA_SIZE_LIMIT]: "LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",
|
|
521
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__INVALID_PROGRAM_FOR_EXECUTION]: "This program may not be used for executing instructions",
|
|
522
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__INVALID_RENT_PAYING_ACCOUNT]: "Transaction leaves an account with a lower balance than rent-exempt minimum",
|
|
523
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__INVALID_WRITABLE_ACCOUNT]: "Transaction loads a writable account that cannot be written",
|
|
524
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__MAX_LOADED_ACCOUNTS_DATA_SIZE_EXCEEDED]: "Transaction exceeded max loaded accounts data size cap",
|
|
525
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__MISSING_SIGNATURE_FOR_FEE]: "Transaction requires a fee but has no signature present",
|
|
526
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_ACCOUNT_NOT_FOUND]: "Attempt to load a program that does not exist",
|
|
527
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED]: "Execution of the program referenced by account at index $accountIndex is temporarily restricted.",
|
|
528
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__RESANITIZATION_NEEDED]: "ResanitizationNeeded",
|
|
529
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__SANITIZE_FAILURE]: "Transaction failed to sanitize accounts offsets correctly",
|
|
530
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__SIGNATURE_FAILURE]: "Transaction did not pass signature verification",
|
|
531
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__TOO_MANY_ACCOUNT_LOCKS]: "Transaction locked too many accounts",
|
|
532
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__UNBALANCED_TRANSACTION]: "Sum of account balances before and after transaction do not match",
|
|
533
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__UNKNOWN]: "The transaction failed with the error `$errorName`",
|
|
534
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__UNSUPPORTED_VERSION]: "Transaction version is unsupported",
|
|
535
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_BLOCK_LIMIT]: "Transaction would exceed account data limit within the block",
|
|
536
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_TOTAL_LIMIT]: "Transaction would exceed total account data limit",
|
|
537
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_ACCOUNT_COST_LIMIT]: "Transaction would exceed max account limit within the block",
|
|
538
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_BLOCK_COST_LIMIT]: "Transaction would exceed max Block Cost Limit",
|
|
539
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_VOTE_COST_LIMIT]: "Transaction would exceed max Vote Cost Limit",
|
|
540
|
+
[SOLANA_ERROR__TRANSACTION__ADDRESSES_CANNOT_SIGN_TRANSACTION]: "Attempted to sign a transaction with an address that is not a signer for it",
|
|
541
|
+
[SOLANA_ERROR__TRANSACTION__ADDRESS_MISSING]: "Transaction is missing an address at index: $index.",
|
|
542
|
+
[SOLANA_ERROR__TRANSACTION__CANNOT_ENCODE_WITH_EMPTY_SIGNATURES]: "Transaction has no expected signers therefore it cannot be encoded",
|
|
543
|
+
[SOLANA_ERROR__TRANSACTION__EXCEEDS_SIZE_LIMIT]: "Transaction size $transactionSize exceeds limit of $transactionSizeLimit bytes",
|
|
544
|
+
[SOLANA_ERROR__TRANSACTION__EXPECTED_BLOCKHASH_LIFETIME]: "Transaction does not have a blockhash lifetime",
|
|
545
|
+
[SOLANA_ERROR__TRANSACTION__EXPECTED_NONCE_LIFETIME]: "Transaction is not a durable nonce transaction",
|
|
546
|
+
[SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING]: "Contents of these address lookup tables unknown: $lookupTableAddresses",
|
|
547
|
+
[SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE]: "Lookup of address at index $highestRequestedIndex failed for lookup table `$lookupTableAddress`. Highest known index is $highestKnownIndex. The lookup table may have been extended since its contents were retrieved",
|
|
548
|
+
[SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_FEE_PAYER_MISSING]: "No fee payer set in CompiledTransaction",
|
|
549
|
+
[SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND]: "Could not find program address at index $index",
|
|
550
|
+
[SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT]: "Failed to estimate the compute unit consumption for this transaction message. This is likely because simulating the transaction failed. Inspect the `cause` property of this error to learn more",
|
|
551
|
+
[SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT]: "Transaction failed when it was simulated in order to estimate the compute unit consumption. The compute unit estimate provided is for a transaction that failed when simulated and may not be representative of the compute units this transaction would consume if successful. Inspect the `cause` property of this error to learn more",
|
|
552
|
+
[SOLANA_ERROR__TRANSACTION__FEE_PAYER_MISSING]: "Transaction is missing a fee payer.",
|
|
553
|
+
[SOLANA_ERROR__TRANSACTION__FEE_PAYER_SIGNATURE_MISSING]: "Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.",
|
|
554
|
+
[SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_FIRST_INSTRUCTION_MUST_BE_ADVANCE_NONCE]: "Transaction first instruction is not advance nonce account instruction.",
|
|
555
|
+
[SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_INSTRUCTIONS_MISSING]: "Transaction with no instructions cannot be durable nonce transaction.",
|
|
556
|
+
[SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES]: "This transaction includes an address (`$programAddress`) which is both invoked and set as the fee payer. Program addresses may not pay fees",
|
|
557
|
+
[SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE]: "This transaction includes an address (`$programAddress`) which is both invoked and marked writable. Program addresses may not be writable",
|
|
558
|
+
[SOLANA_ERROR__TRANSACTION__MESSAGE_SIGNATURES_MISMATCH]: "The transaction message expected the transaction to have $numRequiredSignatures signatures, got $signaturesLength.",
|
|
559
|
+
[SOLANA_ERROR__TRANSACTION__SIGNATURES_MISSING]: "Transaction is missing signatures for addresses: $addresses.",
|
|
560
|
+
[SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_OUT_OF_RANGE]: "Transaction version must be in the range [0, 127]. `$actualVersion` given",
|
|
561
|
+
[SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_NOT_SUPPORTED]: "This version of Kit does not support decoding transactions with version $unsupportedVersion. The current max supported version is 1.",
|
|
562
|
+
[SOLANA_ERROR__TRANSACTION__NONCE_ACCOUNT_CANNOT_BE_IN_LOOKUP_TABLE]: "The transaction has a durable nonce lifetime (with nonce `$nonce`), but the nonce account address is in a lookup table. The lifetime constraint cannot be constructed without fetching the lookup tables for the transaction.",
|
|
563
|
+
[SOLANA_ERROR__TRANSACTION__INVALID_CONFIG_MASK_PRIORITY_FEE_BITS]: "Invalid transaction config mask: $mask. Bits 0 and 1 must match (both set or both unset)",
|
|
564
|
+
[SOLANA_ERROR__TRANSACTION__MALFORMED_MESSAGE_BYTES]: "Transaction message bytes are malformed: $messageBytes",
|
|
565
|
+
[SOLANA_ERROR__TRANSACTION__CANNOT_ENCODE_WITH_EMPTY_MESSAGE_BYTES]: "Transaction message bytes are empty, so the transaction cannot be encoded",
|
|
566
|
+
[SOLANA_ERROR__TRANSACTION__CANNOT_DECODE_EMPTY_TRANSACTION_BYTES]: "Transaction bytes are empty, so no transaction can be decoded",
|
|
567
|
+
[SOLANA_ERROR__TRANSACTION__VERSION_ZERO_MUST_BE_ENCODED_WITH_SIGNATURES_FIRST]: "Transaction version 0 must be encoded with signatures first. This transaction was encoded with first byte $firstByte, which is expected to be a signature count for v0 transactions.",
|
|
568
|
+
[SOLANA_ERROR__TRANSACTION__SIGNATURE_COUNT_TOO_HIGH_FOR_TRANSACTION_BYTES]: "The provided transaction bytes expect that there should be $numExpectedSignatures signatures, but the bytes are not long enough to contain a transaction message with this many signatures. The provided bytes are $transactionBytesLength bytes long.",
|
|
569
|
+
[SOLANA_ERROR__TRANSACTION__INVALID_NONCE_ACCOUNT_INDEX]: "The transaction has a durable nonce lifetime, but the nonce account index is invalid. Expected a nonce account index less than $numberOfStaticAccounts, got $nonceAccountIndex.",
|
|
570
|
+
[SOLANA_ERROR__TRANSACTION__INVALID_CONFIG_VALUE_KIND]: "The transaction config value for $configName has the incorrect kind. Expected $expectedKind, got $actualKind.",
|
|
571
|
+
[SOLANA_ERROR__TRANSACTION__INSTRUCTION_HEADERS_PAYLOADS_MISMATCH]: "The transaction does not have the same number of instruction headers and instruction payloads. Got $numInstructionHeaders instruction headers, and $numInstructionPayloads instruction payloads."
|
|
572
|
+
};
|
|
573
|
+
var INSTRUCTION_ERROR_RANGE_SIZE = 1e3;
|
|
574
|
+
var START_INDEX = "i";
|
|
575
|
+
var TYPE$1 = "t";
|
|
576
|
+
function getHumanReadableErrorMessage(code, context = {}) {
|
|
577
|
+
const messageFormatString = SolanaErrorMessages[code];
|
|
578
|
+
if (messageFormatString.length === 0) return "";
|
|
579
|
+
let state;
|
|
580
|
+
function commitStateUpTo(endIndex) {
|
|
581
|
+
if (state[TYPE$1] === 2) {
|
|
582
|
+
const variableName = messageFormatString.slice(state[START_INDEX] + 1, endIndex);
|
|
583
|
+
fragments.push(variableName in context ? `${context[variableName]}` : `$${variableName}`);
|
|
584
|
+
} else if (state[TYPE$1] === 1) fragments.push(messageFormatString.slice(state[START_INDEX], endIndex));
|
|
585
|
+
}
|
|
586
|
+
const fragments = [];
|
|
587
|
+
messageFormatString.split("").forEach((char, ii) => {
|
|
588
|
+
if (ii === 0) {
|
|
589
|
+
state = {
|
|
590
|
+
[START_INDEX]: 0,
|
|
591
|
+
[TYPE$1]: messageFormatString[0] === "\\" ? 0 : messageFormatString[0] === "$" ? 2 : 1
|
|
592
|
+
};
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
let nextState;
|
|
596
|
+
switch (state[TYPE$1]) {
|
|
597
|
+
case 0:
|
|
598
|
+
nextState = {
|
|
599
|
+
[START_INDEX]: ii,
|
|
600
|
+
[TYPE$1]: 1
|
|
601
|
+
};
|
|
602
|
+
break;
|
|
603
|
+
case 1:
|
|
604
|
+
if (char === "\\") nextState = {
|
|
605
|
+
[START_INDEX]: ii,
|
|
606
|
+
[TYPE$1]: 0
|
|
607
|
+
};
|
|
608
|
+
else if (char === "$") nextState = {
|
|
609
|
+
[START_INDEX]: ii,
|
|
610
|
+
[TYPE$1]: 2
|
|
611
|
+
};
|
|
612
|
+
break;
|
|
613
|
+
case 2:
|
|
614
|
+
if (char === "\\") nextState = {
|
|
615
|
+
[START_INDEX]: ii,
|
|
616
|
+
[TYPE$1]: 0
|
|
617
|
+
};
|
|
618
|
+
else if (char === "$") nextState = {
|
|
619
|
+
[START_INDEX]: ii,
|
|
620
|
+
[TYPE$1]: 2
|
|
621
|
+
};
|
|
622
|
+
else if (!char.match(/\w/)) nextState = {
|
|
623
|
+
[START_INDEX]: ii,
|
|
624
|
+
[TYPE$1]: 1
|
|
625
|
+
};
|
|
626
|
+
break;
|
|
627
|
+
}
|
|
628
|
+
if (nextState) {
|
|
629
|
+
if (state !== nextState) commitStateUpTo(ii);
|
|
630
|
+
state = nextState;
|
|
631
|
+
}
|
|
632
|
+
});
|
|
633
|
+
commitStateUpTo();
|
|
634
|
+
let message = fragments.join("");
|
|
635
|
+
if (code >= 4615e3 && code < 4615e3 + INSTRUCTION_ERROR_RANGE_SIZE && "index" in context) message += ` (instruction #${context.index + 1})`;
|
|
636
|
+
return message;
|
|
637
|
+
}
|
|
638
|
+
function getErrorMessage(code, context = {}) {
|
|
639
|
+
if (process.env.NODE_ENV !== "production") return getHumanReadableErrorMessage(code, context);
|
|
640
|
+
else {
|
|
641
|
+
let decodingAdviceMessage = `Solana error #${code}; Decode this error by running \`npx @solana/errors decode -- ${code}`;
|
|
642
|
+
if (Object.keys(context).length) decodingAdviceMessage += ` '${encodeContextObject(context)}'`;
|
|
643
|
+
return `${decodingAdviceMessage}\``;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
function isSolanaError(e, code) {
|
|
647
|
+
if (e instanceof Error && e.name === "SolanaError") {
|
|
648
|
+
if (code !== void 0) return e.context.__code === code;
|
|
649
|
+
return true;
|
|
650
|
+
}
|
|
651
|
+
return false;
|
|
652
|
+
}
|
|
653
|
+
var SolanaError = class extends Error {
|
|
654
|
+
/**
|
|
655
|
+
* Indicates the root cause of this {@link SolanaError}, if any.
|
|
656
|
+
*
|
|
657
|
+
* For example, a transaction error might have an instruction error as its root cause. In this
|
|
658
|
+
* case, you will be able to access the instruction error on the transaction error as `cause`.
|
|
659
|
+
*/
|
|
660
|
+
cause = this.cause;
|
|
661
|
+
/**
|
|
662
|
+
* Contains context that can assist in understanding or recovering from a {@link SolanaError}.
|
|
663
|
+
*/
|
|
664
|
+
context;
|
|
665
|
+
constructor(...[code, contextAndErrorOptions]) {
|
|
666
|
+
let context;
|
|
667
|
+
let errorOptions;
|
|
668
|
+
if (contextAndErrorOptions) Object.entries(Object.getOwnPropertyDescriptors(contextAndErrorOptions)).forEach(([name, descriptor]) => {
|
|
669
|
+
if (name === "cause") errorOptions = { cause: descriptor.value };
|
|
670
|
+
else {
|
|
671
|
+
if (context === void 0) context = { __code: code };
|
|
672
|
+
Object.defineProperty(context, name, descriptor);
|
|
673
|
+
}
|
|
674
|
+
});
|
|
675
|
+
const message = getErrorMessage(code, context);
|
|
676
|
+
super(message, errorOptions);
|
|
677
|
+
this.context = Object.freeze(context === void 0 ? { __code: code } : context);
|
|
678
|
+
this.name = "SolanaError";
|
|
679
|
+
}
|
|
680
|
+
};
|
|
681
|
+
function safeCaptureStackTrace(...args) {
|
|
682
|
+
if ("captureStackTrace" in Error && typeof Error.captureStackTrace === "function") Error.captureStackTrace(...args);
|
|
683
|
+
}
|
|
684
|
+
function getSolanaErrorFromRpcError({ errorCodeBaseOffset, getErrorContext, orderedErrorNames, rpcEnumError }, constructorOpt) {
|
|
685
|
+
let rpcErrorName;
|
|
686
|
+
let rpcErrorContext;
|
|
687
|
+
if (typeof rpcEnumError === "string") rpcErrorName = rpcEnumError;
|
|
688
|
+
else {
|
|
689
|
+
rpcErrorName = Object.keys(rpcEnumError)[0];
|
|
690
|
+
rpcErrorContext = rpcEnumError[rpcErrorName];
|
|
691
|
+
}
|
|
692
|
+
const errorCode = errorCodeBaseOffset + orderedErrorNames.indexOf(rpcErrorName);
|
|
693
|
+
const err = new SolanaError(errorCode, getErrorContext(errorCode, rpcErrorName, rpcErrorContext));
|
|
694
|
+
safeCaptureStackTrace(err, constructorOpt);
|
|
695
|
+
return err;
|
|
696
|
+
}
|
|
697
|
+
var ORDERED_ERROR_NAMES = [
|
|
698
|
+
"GenericError",
|
|
699
|
+
"InvalidArgument",
|
|
700
|
+
"InvalidInstructionData",
|
|
701
|
+
"InvalidAccountData",
|
|
702
|
+
"AccountDataTooSmall",
|
|
703
|
+
"InsufficientFunds",
|
|
704
|
+
"IncorrectProgramId",
|
|
705
|
+
"MissingRequiredSignature",
|
|
706
|
+
"AccountAlreadyInitialized",
|
|
707
|
+
"UninitializedAccount",
|
|
708
|
+
"UnbalancedInstruction",
|
|
709
|
+
"ModifiedProgramId",
|
|
710
|
+
"ExternalAccountLamportSpend",
|
|
711
|
+
"ExternalAccountDataModified",
|
|
712
|
+
"ReadonlyLamportChange",
|
|
713
|
+
"ReadonlyDataModified",
|
|
714
|
+
"DuplicateAccountIndex",
|
|
715
|
+
"ExecutableModified",
|
|
716
|
+
"RentEpochModified",
|
|
717
|
+
"NotEnoughAccountKeys",
|
|
718
|
+
"AccountDataSizeChanged",
|
|
719
|
+
"AccountNotExecutable",
|
|
720
|
+
"AccountBorrowFailed",
|
|
721
|
+
"AccountBorrowOutstanding",
|
|
722
|
+
"DuplicateAccountOutOfSync",
|
|
723
|
+
"Custom",
|
|
724
|
+
"InvalidError",
|
|
725
|
+
"ExecutableDataModified",
|
|
726
|
+
"ExecutableLamportChange",
|
|
727
|
+
"ExecutableAccountNotRentExempt",
|
|
728
|
+
"UnsupportedProgramId",
|
|
729
|
+
"CallDepth",
|
|
730
|
+
"MissingAccount",
|
|
731
|
+
"ReentrancyNotAllowed",
|
|
732
|
+
"MaxSeedLengthExceeded",
|
|
733
|
+
"InvalidSeeds",
|
|
734
|
+
"InvalidRealloc",
|
|
735
|
+
"ComputationalBudgetExceeded",
|
|
736
|
+
"PrivilegeEscalation",
|
|
737
|
+
"ProgramEnvironmentSetupFailure",
|
|
738
|
+
"ProgramFailedToComplete",
|
|
739
|
+
"ProgramFailedToCompile",
|
|
740
|
+
"Immutable",
|
|
741
|
+
"IncorrectAuthority",
|
|
742
|
+
"BorshIoError",
|
|
743
|
+
"AccountNotRentExempt",
|
|
744
|
+
"InvalidAccountOwner",
|
|
745
|
+
"ArithmeticOverflow",
|
|
746
|
+
"UnsupportedSysvar",
|
|
747
|
+
"IllegalOwner",
|
|
748
|
+
"MaxAccountsDataAllocationsExceeded",
|
|
749
|
+
"MaxAccountsExceeded",
|
|
750
|
+
"MaxInstructionTraceLengthExceeded",
|
|
751
|
+
"BuiltinProgramsMustConsumeComputeUnits"
|
|
752
|
+
];
|
|
753
|
+
function getSolanaErrorFromInstructionError(index, instructionError) {
|
|
754
|
+
const numberIndex = Number(index);
|
|
755
|
+
return getSolanaErrorFromRpcError({
|
|
756
|
+
errorCodeBaseOffset: 4615001,
|
|
757
|
+
getErrorContext(errorCode, rpcErrorName, rpcErrorContext) {
|
|
758
|
+
if (errorCode === 4615e3) return {
|
|
759
|
+
errorName: rpcErrorName,
|
|
760
|
+
index: numberIndex,
|
|
761
|
+
...rpcErrorContext !== void 0 ? { instructionErrorContext: rpcErrorContext } : null
|
|
762
|
+
};
|
|
763
|
+
else if (errorCode === 4615026) return {
|
|
764
|
+
code: Number(rpcErrorContext),
|
|
765
|
+
index: numberIndex
|
|
766
|
+
};
|
|
767
|
+
return { index: numberIndex };
|
|
768
|
+
},
|
|
769
|
+
orderedErrorNames: ORDERED_ERROR_NAMES,
|
|
770
|
+
rpcEnumError: instructionError
|
|
771
|
+
}, getSolanaErrorFromInstructionError);
|
|
772
|
+
}
|
|
773
|
+
var ORDERED_ERROR_NAMES2 = [
|
|
774
|
+
"AccountInUse",
|
|
775
|
+
"AccountLoadedTwice",
|
|
776
|
+
"AccountNotFound",
|
|
777
|
+
"ProgramAccountNotFound",
|
|
778
|
+
"InsufficientFundsForFee",
|
|
779
|
+
"InvalidAccountForFee",
|
|
780
|
+
"AlreadyProcessed",
|
|
781
|
+
"BlockhashNotFound",
|
|
782
|
+
"CallChainTooDeep",
|
|
783
|
+
"MissingSignatureForFee",
|
|
784
|
+
"InvalidAccountIndex",
|
|
785
|
+
"SignatureFailure",
|
|
786
|
+
"InvalidProgramForExecution",
|
|
787
|
+
"SanitizeFailure",
|
|
788
|
+
"ClusterMaintenance",
|
|
789
|
+
"AccountBorrowOutstanding",
|
|
790
|
+
"WouldExceedMaxBlockCostLimit",
|
|
791
|
+
"UnsupportedVersion",
|
|
792
|
+
"InvalidWritableAccount",
|
|
793
|
+
"WouldExceedMaxAccountCostLimit",
|
|
794
|
+
"WouldExceedAccountDataBlockLimit",
|
|
795
|
+
"TooManyAccountLocks",
|
|
796
|
+
"AddressLookupTableNotFound",
|
|
797
|
+
"InvalidAddressLookupTableOwner",
|
|
798
|
+
"InvalidAddressLookupTableData",
|
|
799
|
+
"InvalidAddressLookupTableIndex",
|
|
800
|
+
"InvalidRentPayingAccount",
|
|
801
|
+
"WouldExceedMaxVoteCostLimit",
|
|
802
|
+
"WouldExceedAccountDataTotalLimit",
|
|
803
|
+
"DuplicateInstruction",
|
|
804
|
+
"InsufficientFundsForRent",
|
|
805
|
+
"MaxLoadedAccountsDataSizeExceeded",
|
|
806
|
+
"InvalidLoadedAccountsDataSizeLimit",
|
|
807
|
+
"ResanitizationNeeded",
|
|
808
|
+
"ProgramExecutionTemporarilyRestricted",
|
|
809
|
+
"UnbalancedTransaction"
|
|
810
|
+
];
|
|
811
|
+
function getSolanaErrorFromTransactionError(transactionError) {
|
|
812
|
+
if (typeof transactionError === "object" && "InstructionError" in transactionError) return getSolanaErrorFromInstructionError(...transactionError.InstructionError);
|
|
813
|
+
return getSolanaErrorFromRpcError({
|
|
814
|
+
errorCodeBaseOffset: 7050001,
|
|
815
|
+
getErrorContext(errorCode, rpcErrorName, rpcErrorContext) {
|
|
816
|
+
if (errorCode === 705e4) return {
|
|
817
|
+
errorName: rpcErrorName,
|
|
818
|
+
...rpcErrorContext !== void 0 ? { transactionErrorContext: rpcErrorContext } : null
|
|
819
|
+
};
|
|
820
|
+
else if (errorCode === 7050030) return { index: Number(rpcErrorContext) };
|
|
821
|
+
else if (errorCode === 7050031 || errorCode === 7050035) return { accountIndex: Number(rpcErrorContext.account_index) };
|
|
822
|
+
},
|
|
823
|
+
orderedErrorNames: ORDERED_ERROR_NAMES2,
|
|
824
|
+
rpcEnumError: transactionError
|
|
825
|
+
}, getSolanaErrorFromTransactionError);
|
|
826
|
+
}
|
|
827
|
+
function getSolanaErrorFromJsonRpcError(putativeErrorResponse) {
|
|
828
|
+
let out;
|
|
829
|
+
if (isRpcErrorResponse(putativeErrorResponse)) {
|
|
830
|
+
const { code: rawCode, data, message } = putativeErrorResponse;
|
|
831
|
+
const code = Number(rawCode);
|
|
832
|
+
if (code === -32002) {
|
|
833
|
+
const { err, ...preflightErrorContext } = data;
|
|
834
|
+
const causeObject = err ? { cause: getSolanaErrorFromTransactionError(err) } : null;
|
|
835
|
+
out = new SolanaError(SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE, {
|
|
836
|
+
...preflightErrorContext,
|
|
837
|
+
...causeObject
|
|
838
|
+
});
|
|
839
|
+
} else {
|
|
840
|
+
let errorContext;
|
|
841
|
+
switch (code) {
|
|
842
|
+
case SOLANA_ERROR__JSON_RPC__INTERNAL_ERROR:
|
|
843
|
+
case SOLANA_ERROR__JSON_RPC__INVALID_PARAMS:
|
|
844
|
+
case SOLANA_ERROR__JSON_RPC__INVALID_REQUEST:
|
|
845
|
+
case SOLANA_ERROR__JSON_RPC__METHOD_NOT_FOUND:
|
|
846
|
+
case SOLANA_ERROR__JSON_RPC__PARSE_ERROR:
|
|
847
|
+
case SOLANA_ERROR__JSON_RPC__SCAN_ERROR:
|
|
848
|
+
case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_CLEANED_UP:
|
|
849
|
+
case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_NOT_AVAILABLE:
|
|
850
|
+
case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET:
|
|
851
|
+
case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX:
|
|
852
|
+
case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED:
|
|
853
|
+
case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_SKIPPED:
|
|
854
|
+
case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE:
|
|
855
|
+
case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION:
|
|
856
|
+
errorContext = { __serverMessage: message };
|
|
857
|
+
break;
|
|
858
|
+
default: if (typeof data === "object" && !Array.isArray(data)) errorContext = data;
|
|
859
|
+
}
|
|
860
|
+
out = new SolanaError(code, errorContext);
|
|
861
|
+
}
|
|
862
|
+
} else out = new SolanaError(10, {
|
|
863
|
+
error: putativeErrorResponse,
|
|
864
|
+
message: typeof putativeErrorResponse === "object" && putativeErrorResponse !== null && "message" in putativeErrorResponse && typeof putativeErrorResponse.message === "string" ? putativeErrorResponse.message : "Malformed JSON-RPC error with no message attribute"
|
|
865
|
+
});
|
|
866
|
+
safeCaptureStackTrace(out, getSolanaErrorFromJsonRpcError);
|
|
867
|
+
return out;
|
|
868
|
+
}
|
|
869
|
+
function isRpcErrorResponse(value) {
|
|
870
|
+
return typeof value === "object" && value !== null && "code" in value && "message" in value && (typeof value.code === "number" || typeof value.code === "bigint") && typeof value.message === "string";
|
|
871
|
+
}
|
|
872
|
+
//#endregion
|
|
873
|
+
//#region node_modules/.pnpm/@solana+codecs-core@6.5.0_typescript@5.9.3/node_modules/@solana/codecs-core/dist/index.node.mjs
|
|
874
|
+
function padBytes(bytes, length) {
|
|
875
|
+
if (bytes.length >= length) return bytes;
|
|
876
|
+
const paddedBytes = new Uint8Array(length).fill(0);
|
|
877
|
+
paddedBytes.set(bytes);
|
|
878
|
+
return paddedBytes;
|
|
879
|
+
}
|
|
880
|
+
var fixBytes = (bytes, length) => padBytes(bytes.length <= length ? bytes : bytes.slice(0, length), length);
|
|
881
|
+
function bytesEqual(bytes1, bytes2) {
|
|
882
|
+
return bytes1.length === bytes2.length && bytes1.every((value, index) => value === bytes2[index]);
|
|
883
|
+
}
|
|
884
|
+
function getEncodedSize(value, encoder) {
|
|
885
|
+
return "fixedSize" in encoder ? encoder.fixedSize : encoder.getSizeFromValue(value);
|
|
886
|
+
}
|
|
887
|
+
function createEncoder(encoder) {
|
|
888
|
+
return Object.freeze({
|
|
889
|
+
...encoder,
|
|
890
|
+
encode: (value) => {
|
|
891
|
+
const bytes = new Uint8Array(getEncodedSize(value, encoder));
|
|
892
|
+
encoder.write(value, bytes, 0);
|
|
893
|
+
return bytes;
|
|
894
|
+
}
|
|
895
|
+
});
|
|
896
|
+
}
|
|
897
|
+
function createDecoder(decoder) {
|
|
898
|
+
return Object.freeze({
|
|
899
|
+
...decoder,
|
|
900
|
+
decode: (bytes, offset = 0) => decoder.read(bytes, offset)[0]
|
|
901
|
+
});
|
|
902
|
+
}
|
|
903
|
+
function isFixedSize(codec) {
|
|
904
|
+
return "fixedSize" in codec && typeof codec.fixedSize === "number";
|
|
905
|
+
}
|
|
906
|
+
function assertIsFixedSize(codec) {
|
|
907
|
+
if (!isFixedSize(codec)) throw new SolanaError(SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH);
|
|
908
|
+
}
|
|
909
|
+
function isVariableSize(codec) {
|
|
910
|
+
return !isFixedSize(codec);
|
|
911
|
+
}
|
|
912
|
+
function combineCodec(encoder, decoder) {
|
|
913
|
+
if (isFixedSize(encoder) !== isFixedSize(decoder)) throw new SolanaError(SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH);
|
|
914
|
+
if (isFixedSize(encoder) && isFixedSize(decoder) && encoder.fixedSize !== decoder.fixedSize) throw new SolanaError(SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH, {
|
|
915
|
+
decoderFixedSize: decoder.fixedSize,
|
|
916
|
+
encoderFixedSize: encoder.fixedSize
|
|
917
|
+
});
|
|
918
|
+
if (!isFixedSize(encoder) && !isFixedSize(decoder) && encoder.maxSize !== decoder.maxSize) throw new SolanaError(SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH, {
|
|
919
|
+
decoderMaxSize: decoder.maxSize,
|
|
920
|
+
encoderMaxSize: encoder.maxSize
|
|
921
|
+
});
|
|
922
|
+
return {
|
|
923
|
+
...decoder,
|
|
924
|
+
...encoder,
|
|
925
|
+
decode: decoder.decode,
|
|
926
|
+
encode: encoder.encode,
|
|
927
|
+
read: decoder.read,
|
|
928
|
+
write: encoder.write
|
|
929
|
+
};
|
|
930
|
+
}
|
|
931
|
+
function assertByteArrayIsNotEmptyForCodec(codecDescription, bytes, offset = 0) {
|
|
932
|
+
if (bytes.length - offset <= 0) throw new SolanaError(SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY, { codecDescription });
|
|
933
|
+
}
|
|
934
|
+
function assertByteArrayHasEnoughBytesForCodec(codecDescription, expected, bytes, offset = 0) {
|
|
935
|
+
const bytesLength = bytes.length - offset;
|
|
936
|
+
if (bytesLength < expected) throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH, {
|
|
937
|
+
bytesLength,
|
|
938
|
+
codecDescription,
|
|
939
|
+
expected
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
function addEncoderSizePrefix(encoder, prefix) {
|
|
943
|
+
const write = ((value, bytes, offset) => {
|
|
944
|
+
const encoderBytes = encoder.encode(value);
|
|
945
|
+
offset = prefix.write(encoderBytes.length, bytes, offset);
|
|
946
|
+
bytes.set(encoderBytes, offset);
|
|
947
|
+
return offset + encoderBytes.length;
|
|
948
|
+
});
|
|
949
|
+
if (isFixedSize(prefix) && isFixedSize(encoder)) return createEncoder({
|
|
950
|
+
...encoder,
|
|
951
|
+
fixedSize: prefix.fixedSize + encoder.fixedSize,
|
|
952
|
+
write
|
|
953
|
+
});
|
|
954
|
+
const prefixMaxSize = isFixedSize(prefix) ? prefix.fixedSize : prefix.maxSize ?? null;
|
|
955
|
+
const encoderMaxSize = isFixedSize(encoder) ? encoder.fixedSize : encoder.maxSize ?? null;
|
|
956
|
+
const maxSize = prefixMaxSize !== null && encoderMaxSize !== null ? prefixMaxSize + encoderMaxSize : null;
|
|
957
|
+
return createEncoder({
|
|
958
|
+
...encoder,
|
|
959
|
+
...maxSize !== null ? { maxSize } : {},
|
|
960
|
+
getSizeFromValue: (value) => {
|
|
961
|
+
const encoderSize = getEncodedSize(value, encoder);
|
|
962
|
+
return getEncodedSize(encoderSize, prefix) + encoderSize;
|
|
963
|
+
},
|
|
964
|
+
write
|
|
965
|
+
});
|
|
966
|
+
}
|
|
967
|
+
function toArrayBuffer(bytes, offset, length) {
|
|
968
|
+
const bytesOffset = bytes.byteOffset + (offset ?? 0);
|
|
969
|
+
const bytesLength = length ?? bytes.byteLength;
|
|
970
|
+
let buffer;
|
|
971
|
+
if (typeof SharedArrayBuffer === "undefined") buffer = bytes.buffer;
|
|
972
|
+
else if (bytes.buffer instanceof SharedArrayBuffer) {
|
|
973
|
+
buffer = new ArrayBuffer(bytes.length);
|
|
974
|
+
new Uint8Array(buffer).set(new Uint8Array(bytes));
|
|
975
|
+
} else buffer = bytes.buffer;
|
|
976
|
+
return (bytesOffset === 0 || bytesOffset === -bytes.byteLength) && bytesLength === bytes.byteLength ? buffer : buffer.slice(bytesOffset, bytesOffset + bytesLength);
|
|
977
|
+
}
|
|
978
|
+
function fixEncoderSize(encoder, fixedBytes) {
|
|
979
|
+
return createEncoder({
|
|
980
|
+
fixedSize: fixedBytes,
|
|
981
|
+
write: (value, bytes, offset) => {
|
|
982
|
+
const variableByteArray = encoder.encode(value);
|
|
983
|
+
const fixedByteArray = variableByteArray.length > fixedBytes ? variableByteArray.slice(0, fixedBytes) : variableByteArray;
|
|
984
|
+
bytes.set(fixedByteArray, offset);
|
|
985
|
+
return offset + fixedBytes;
|
|
986
|
+
}
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
function fixDecoderSize(decoder, fixedBytes) {
|
|
990
|
+
return createDecoder({
|
|
991
|
+
fixedSize: fixedBytes,
|
|
992
|
+
read: (bytes, offset) => {
|
|
993
|
+
assertByteArrayHasEnoughBytesForCodec("fixCodecSize", fixedBytes, bytes, offset);
|
|
994
|
+
if (offset > 0 || bytes.length > fixedBytes) bytes = bytes.slice(offset, offset + fixedBytes);
|
|
995
|
+
if (isFixedSize(decoder)) bytes = fixBytes(bytes, decoder.fixedSize);
|
|
996
|
+
const [value] = decoder.read(bytes, 0);
|
|
997
|
+
return [value, offset + fixedBytes];
|
|
998
|
+
}
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
function transformEncoder(encoder, unmap) {
|
|
1002
|
+
return createEncoder({
|
|
1003
|
+
...isVariableSize(encoder) ? {
|
|
1004
|
+
...encoder,
|
|
1005
|
+
getSizeFromValue: (value) => encoder.getSizeFromValue(unmap(value))
|
|
1006
|
+
} : encoder,
|
|
1007
|
+
write: (value, bytes, offset) => encoder.write(unmap(value), bytes, offset)
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
//#endregion
|
|
1011
|
+
//#region node_modules/.pnpm/@solana+codecs-strings@6.5.0_typescript@5.9.3/node_modules/@solana/codecs-strings/dist/index.node.mjs
|
|
1012
|
+
function assertValidBaseString$1(alphabet4, testValue, givenValue = testValue) {
|
|
1013
|
+
if (!testValue.match(new RegExp(`^[${alphabet4}]*$`))) throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE, {
|
|
1014
|
+
alphabet: alphabet4,
|
|
1015
|
+
base: alphabet4.length,
|
|
1016
|
+
value: givenValue
|
|
1017
|
+
});
|
|
1018
|
+
}
|
|
1019
|
+
var getBaseXEncoder$1 = (alphabet4) => {
|
|
1020
|
+
return createEncoder({
|
|
1021
|
+
getSizeFromValue: (value) => {
|
|
1022
|
+
const [leadingZeroes, tailChars] = partitionLeadingZeroes$1(value, alphabet4[0]);
|
|
1023
|
+
if (!tailChars) return value.length;
|
|
1024
|
+
const base10Number = getBigIntFromBaseX$1(tailChars, alphabet4);
|
|
1025
|
+
return leadingZeroes.length + Math.ceil(base10Number.toString(16).length / 2);
|
|
1026
|
+
},
|
|
1027
|
+
write(value, bytes, offset) {
|
|
1028
|
+
assertValidBaseString$1(alphabet4, value);
|
|
1029
|
+
if (value === "") return offset;
|
|
1030
|
+
const [leadingZeroes, tailChars] = partitionLeadingZeroes$1(value, alphabet4[0]);
|
|
1031
|
+
if (!tailChars) {
|
|
1032
|
+
bytes.set(new Uint8Array(leadingZeroes.length).fill(0), offset);
|
|
1033
|
+
return offset + leadingZeroes.length;
|
|
1034
|
+
}
|
|
1035
|
+
let base10Number = getBigIntFromBaseX$1(tailChars, alphabet4);
|
|
1036
|
+
const tailBytes = [];
|
|
1037
|
+
while (base10Number > 0n) {
|
|
1038
|
+
tailBytes.unshift(Number(base10Number % 256n));
|
|
1039
|
+
base10Number /= 256n;
|
|
1040
|
+
}
|
|
1041
|
+
const bytesToAdd = [...Array(leadingZeroes.length).fill(0), ...tailBytes];
|
|
1042
|
+
bytes.set(bytesToAdd, offset);
|
|
1043
|
+
return offset + bytesToAdd.length;
|
|
1044
|
+
}
|
|
1045
|
+
});
|
|
1046
|
+
};
|
|
1047
|
+
var getBaseXDecoder = (alphabet4) => {
|
|
1048
|
+
return createDecoder({ read(rawBytes, offset) {
|
|
1049
|
+
const bytes = offset === 0 || offset <= -rawBytes.byteLength ? rawBytes : rawBytes.slice(offset);
|
|
1050
|
+
if (bytes.length === 0) return ["", 0];
|
|
1051
|
+
let trailIndex = bytes.findIndex((n) => n !== 0);
|
|
1052
|
+
trailIndex = trailIndex === -1 ? bytes.length : trailIndex;
|
|
1053
|
+
const leadingZeroes = alphabet4[0].repeat(trailIndex);
|
|
1054
|
+
if (trailIndex === bytes.length) return [leadingZeroes, rawBytes.length];
|
|
1055
|
+
return [leadingZeroes + getBaseXFromBigInt(bytes.slice(trailIndex).reduce((sum, byte) => sum * 256n + BigInt(byte), 0n), alphabet4), rawBytes.length];
|
|
1056
|
+
} });
|
|
1057
|
+
};
|
|
1058
|
+
function partitionLeadingZeroes$1(value, zeroCharacter) {
|
|
1059
|
+
const [leadingZeros, tailChars] = value.split(new RegExp(`((?!${zeroCharacter}).*)`));
|
|
1060
|
+
return [leadingZeros, tailChars];
|
|
1061
|
+
}
|
|
1062
|
+
function getBigIntFromBaseX$1(value, alphabet4) {
|
|
1063
|
+
const base = BigInt(alphabet4.length);
|
|
1064
|
+
let sum = 0n;
|
|
1065
|
+
for (const char of value) {
|
|
1066
|
+
sum *= base;
|
|
1067
|
+
sum += BigInt(alphabet4.indexOf(char));
|
|
1068
|
+
}
|
|
1069
|
+
return sum;
|
|
1070
|
+
}
|
|
1071
|
+
function getBaseXFromBigInt(value, alphabet4) {
|
|
1072
|
+
const base = BigInt(alphabet4.length);
|
|
1073
|
+
const tailChars = [];
|
|
1074
|
+
while (value > 0n) {
|
|
1075
|
+
tailChars.unshift(alphabet4[Number(value % base)]);
|
|
1076
|
+
value /= base;
|
|
1077
|
+
}
|
|
1078
|
+
return tailChars.join("");
|
|
1079
|
+
}
|
|
1080
|
+
var alphabet2$1 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
1081
|
+
var getBase58Encoder$1 = () => getBaseXEncoder$1(alphabet2$1);
|
|
1082
|
+
var getBase58Decoder = () => getBaseXDecoder(alphabet2$1);
|
|
1083
|
+
var getBase64Decoder = () => {
|
|
1084
|
+
return createDecoder({ read: (bytes, offset = 0) => [Buffer.from(toArrayBuffer(bytes), offset).toString("base64"), bytes.length] });
|
|
1085
|
+
};
|
|
1086
|
+
globalThis.TextDecoder;
|
|
1087
|
+
globalThis.TextEncoder;
|
|
1088
|
+
//#endregion
|
|
1089
|
+
//#region node_modules/.pnpm/@solana+assertions@6.5.0_typescript@5.9.3/node_modules/@solana/assertions/dist/index.node.mjs
|
|
1090
|
+
function assertPRNGIsAvailable() {
|
|
1091
|
+
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.getRandomValues !== "function") throw new SolanaError(SOLANA_ERROR__CRYPTO__RANDOM_VALUES_FUNCTION_UNIMPLEMENTED);
|
|
1092
|
+
}
|
|
1093
|
+
function assertDigestCapabilityIsAvailable() {
|
|
1094
|
+
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.digest !== "function") throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO__DIGEST_UNIMPLEMENTED);
|
|
1095
|
+
}
|
|
1096
|
+
function assertKeyExporterIsAvailable() {
|
|
1097
|
+
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.exportKey !== "function") throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO__EXPORT_FUNCTION_UNIMPLEMENTED);
|
|
1098
|
+
}
|
|
1099
|
+
function assertSigningCapabilityIsAvailable() {
|
|
1100
|
+
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.sign !== "function") throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO__SIGN_FUNCTION_UNIMPLEMENTED);
|
|
1101
|
+
}
|
|
1102
|
+
function assertVerificationCapabilityIsAvailable() {
|
|
1103
|
+
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.verify !== "function") throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO__VERIFY_FUNCTION_UNIMPLEMENTED);
|
|
1104
|
+
}
|
|
1105
|
+
//#endregion
|
|
1106
|
+
//#region node_modules/.pnpm/@solana+addresses@6.5.0_typescript@5.9.3/node_modules/@solana/addresses/dist/index.node.mjs
|
|
1107
|
+
var memoizedBase58Encoder;
|
|
1108
|
+
var memoizedBase58Decoder;
|
|
1109
|
+
function getMemoizedBase58Encoder() {
|
|
1110
|
+
if (!memoizedBase58Encoder) memoizedBase58Encoder = getBase58Encoder$1();
|
|
1111
|
+
return memoizedBase58Encoder;
|
|
1112
|
+
}
|
|
1113
|
+
function getMemoizedBase58Decoder() {
|
|
1114
|
+
if (!memoizedBase58Decoder) memoizedBase58Decoder = getBase58Decoder();
|
|
1115
|
+
return memoizedBase58Decoder;
|
|
1116
|
+
}
|
|
1117
|
+
function isAddress(putativeAddress) {
|
|
1118
|
+
if (putativeAddress.length < 32 || putativeAddress.length > 44) return false;
|
|
1119
|
+
const base58Encoder = getMemoizedBase58Encoder();
|
|
1120
|
+
try {
|
|
1121
|
+
return base58Encoder.encode(putativeAddress).byteLength === 32;
|
|
1122
|
+
} catch {
|
|
1123
|
+
return false;
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
function assertIsAddress(putativeAddress) {
|
|
1127
|
+
if (putativeAddress.length < 32 || putativeAddress.length > 44) throw new SolanaError(SOLANA_ERROR__ADDRESSES__STRING_LENGTH_OUT_OF_RANGE, { actualLength: putativeAddress.length });
|
|
1128
|
+
const numBytes = getMemoizedBase58Encoder().encode(putativeAddress).byteLength;
|
|
1129
|
+
if (numBytes !== 32) throw new SolanaError(SOLANA_ERROR__ADDRESSES__INVALID_BYTE_LENGTH, { actualLength: numBytes });
|
|
1130
|
+
}
|
|
1131
|
+
function address(putativeAddress) {
|
|
1132
|
+
assertIsAddress(putativeAddress);
|
|
1133
|
+
return putativeAddress;
|
|
1134
|
+
}
|
|
1135
|
+
function getAddressEncoder() {
|
|
1136
|
+
return transformEncoder(fixEncoderSize(getMemoizedBase58Encoder(), 32), (putativeAddress) => address(putativeAddress));
|
|
1137
|
+
}
|
|
1138
|
+
function getAddressDecoder() {
|
|
1139
|
+
return fixDecoderSize(getMemoizedBase58Decoder(), 32);
|
|
1140
|
+
}
|
|
1141
|
+
function getAddressCodec() {
|
|
1142
|
+
return combineCodec(getAddressEncoder(), getAddressDecoder());
|
|
1143
|
+
}
|
|
1144
|
+
function getAddressComparator() {
|
|
1145
|
+
return new Intl.Collator("en", {
|
|
1146
|
+
caseFirst: "lower",
|
|
1147
|
+
ignorePunctuation: false,
|
|
1148
|
+
localeMatcher: "best fit",
|
|
1149
|
+
numeric: false,
|
|
1150
|
+
sensitivity: "variant",
|
|
1151
|
+
usage: "sort"
|
|
1152
|
+
}).compare;
|
|
1153
|
+
}
|
|
1154
|
+
var D = 37095705934669439343138083508754565189542113879843219016388785533085940283555n;
|
|
1155
|
+
var P = 57896044618658097711785492504343953926634992332820282019728792003956564819949n;
|
|
1156
|
+
var RM1 = 19681161376707505956807079304988542015446066515923890162744021073123829784752n;
|
|
1157
|
+
function mod(a) {
|
|
1158
|
+
const r = a % P;
|
|
1159
|
+
return r >= 0n ? r : P + r;
|
|
1160
|
+
}
|
|
1161
|
+
function pow2(x, power) {
|
|
1162
|
+
let r = x;
|
|
1163
|
+
while (power-- > 0n) {
|
|
1164
|
+
r *= r;
|
|
1165
|
+
r %= P;
|
|
1166
|
+
}
|
|
1167
|
+
return r;
|
|
1168
|
+
}
|
|
1169
|
+
function pow_2_252_3(x) {
|
|
1170
|
+
const b2 = x * x % P * x % P;
|
|
1171
|
+
const b5 = pow2(pow2(b2, 2n) * b2 % P, 1n) * x % P;
|
|
1172
|
+
const b10 = pow2(b5, 5n) * b5 % P;
|
|
1173
|
+
const b20 = pow2(b10, 10n) * b10 % P;
|
|
1174
|
+
const b40 = pow2(b20, 20n) * b20 % P;
|
|
1175
|
+
const b80 = pow2(b40, 40n) * b40 % P;
|
|
1176
|
+
return pow2(pow2(pow2(pow2(b80, 80n) * b80 % P, 80n) * b80 % P, 10n) * b10 % P, 2n) * x % P;
|
|
1177
|
+
}
|
|
1178
|
+
function uvRatio(u, v) {
|
|
1179
|
+
const v3 = mod(v * v * v);
|
|
1180
|
+
const pow = pow_2_252_3(u * mod(v3 * v3 * v));
|
|
1181
|
+
let x = mod(u * v3 * pow);
|
|
1182
|
+
const vx2 = mod(v * x * x);
|
|
1183
|
+
const root1 = x;
|
|
1184
|
+
const root2 = mod(x * RM1);
|
|
1185
|
+
const useRoot1 = vx2 === u;
|
|
1186
|
+
const useRoot2 = vx2 === mod(-u);
|
|
1187
|
+
const noRoot = vx2 === mod(-u * RM1);
|
|
1188
|
+
if (useRoot1) x = root1;
|
|
1189
|
+
if (useRoot2 || noRoot) x = root2;
|
|
1190
|
+
if ((mod(x) & 1n) === 1n) x = mod(-x);
|
|
1191
|
+
if (!useRoot1 && !useRoot2) return null;
|
|
1192
|
+
return x;
|
|
1193
|
+
}
|
|
1194
|
+
function pointIsOnCurve(y, lastByte) {
|
|
1195
|
+
const y2 = mod(y * y);
|
|
1196
|
+
const x = uvRatio(mod(y2 - 1n), mod(D * y2 + 1n));
|
|
1197
|
+
if (x === null) return false;
|
|
1198
|
+
const isLastByteOdd = (lastByte & 128) !== 0;
|
|
1199
|
+
if (x === 0n && isLastByteOdd) return false;
|
|
1200
|
+
return true;
|
|
1201
|
+
}
|
|
1202
|
+
function byteToHex(byte) {
|
|
1203
|
+
const hexString = byte.toString(16);
|
|
1204
|
+
if (hexString.length === 1) return `0${hexString}`;
|
|
1205
|
+
else return hexString;
|
|
1206
|
+
}
|
|
1207
|
+
function decompressPointBytes(bytes) {
|
|
1208
|
+
const integerLiteralString = `0x${bytes.reduce((acc, byte, ii) => `${byteToHex(ii === 31 ? byte & -129 : byte)}${acc}`, "")}`;
|
|
1209
|
+
return BigInt(integerLiteralString);
|
|
1210
|
+
}
|
|
1211
|
+
function compressedPointBytesAreOnCurve(bytes) {
|
|
1212
|
+
if (bytes.byteLength !== 32) return false;
|
|
1213
|
+
return pointIsOnCurve(decompressPointBytes(bytes), bytes[31]);
|
|
1214
|
+
}
|
|
1215
|
+
var MAX_SEED_LENGTH = 32;
|
|
1216
|
+
var MAX_SEEDS = 16;
|
|
1217
|
+
var PDA_MARKER_BYTES = [
|
|
1218
|
+
80,
|
|
1219
|
+
114,
|
|
1220
|
+
111,
|
|
1221
|
+
103,
|
|
1222
|
+
114,
|
|
1223
|
+
97,
|
|
1224
|
+
109,
|
|
1225
|
+
68,
|
|
1226
|
+
101,
|
|
1227
|
+
114,
|
|
1228
|
+
105,
|
|
1229
|
+
118,
|
|
1230
|
+
101,
|
|
1231
|
+
100,
|
|
1232
|
+
65,
|
|
1233
|
+
100,
|
|
1234
|
+
100,
|
|
1235
|
+
114,
|
|
1236
|
+
101,
|
|
1237
|
+
115,
|
|
1238
|
+
115
|
|
1239
|
+
];
|
|
1240
|
+
async function createProgramDerivedAddress({ programAddress, seeds }) {
|
|
1241
|
+
assertDigestCapabilityIsAvailable();
|
|
1242
|
+
if (seeds.length > MAX_SEEDS) throw new SolanaError(SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED, {
|
|
1243
|
+
actual: seeds.length,
|
|
1244
|
+
maxSeeds: MAX_SEEDS
|
|
1245
|
+
});
|
|
1246
|
+
let textEncoder;
|
|
1247
|
+
const seedBytes = seeds.reduce((acc, seed, ii) => {
|
|
1248
|
+
const bytes = typeof seed === "string" ? (textEncoder ||= new TextEncoder()).encode(seed) : seed;
|
|
1249
|
+
if (bytes.byteLength > MAX_SEED_LENGTH) throw new SolanaError(SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED, {
|
|
1250
|
+
actual: bytes.byteLength,
|
|
1251
|
+
index: ii,
|
|
1252
|
+
maxSeedLength: MAX_SEED_LENGTH
|
|
1253
|
+
});
|
|
1254
|
+
acc.push(...bytes);
|
|
1255
|
+
return acc;
|
|
1256
|
+
}, []);
|
|
1257
|
+
const base58EncodedAddressCodec = getAddressCodec();
|
|
1258
|
+
const programAddressBytes = base58EncodedAddressCodec.encode(programAddress);
|
|
1259
|
+
const addressBytesBuffer = await crypto.subtle.digest("SHA-256", new Uint8Array([
|
|
1260
|
+
...seedBytes,
|
|
1261
|
+
...programAddressBytes,
|
|
1262
|
+
...PDA_MARKER_BYTES
|
|
1263
|
+
]));
|
|
1264
|
+
const addressBytes = new Uint8Array(addressBytesBuffer);
|
|
1265
|
+
if (compressedPointBytesAreOnCurve(addressBytes)) throw new SolanaError(SOLANA_ERROR__ADDRESSES__INVALID_SEEDS_POINT_ON_CURVE);
|
|
1266
|
+
return base58EncodedAddressCodec.decode(addressBytes);
|
|
1267
|
+
}
|
|
1268
|
+
async function getProgramDerivedAddress({ programAddress, seeds }) {
|
|
1269
|
+
let bumpSeed = 255;
|
|
1270
|
+
while (bumpSeed > 0) try {
|
|
1271
|
+
return [await createProgramDerivedAddress({
|
|
1272
|
+
programAddress,
|
|
1273
|
+
seeds: [...seeds, new Uint8Array([bumpSeed])]
|
|
1274
|
+
}), bumpSeed];
|
|
1275
|
+
} catch (e) {
|
|
1276
|
+
if (isSolanaError(e, 2800008)) bumpSeed--;
|
|
1277
|
+
else throw e;
|
|
1278
|
+
}
|
|
1279
|
+
throw new SolanaError(SOLANA_ERROR__ADDRESSES__FAILED_TO_FIND_VIABLE_PDA_BUMP_SEED);
|
|
1280
|
+
}
|
|
1281
|
+
async function getAddressFromPublicKey(publicKey) {
|
|
1282
|
+
assertKeyExporterIsAvailable();
|
|
1283
|
+
if (publicKey.type !== "public" || publicKey.algorithm.name !== "Ed25519") throw new SolanaError(SOLANA_ERROR__ADDRESSES__INVALID_ED25519_PUBLIC_KEY);
|
|
1284
|
+
const publicKeyBytes = await crypto.subtle.exportKey("raw", publicKey);
|
|
1285
|
+
return getAddressDecoder().decode(new Uint8Array(publicKeyBytes));
|
|
1286
|
+
}
|
|
1287
|
+
//#endregion
|
|
1288
|
+
//#region node_modules/.pnpm/@solana+codecs-numbers@6.5.0_typescript@5.9.3/node_modules/@solana/codecs-numbers/dist/index.node.mjs
|
|
1289
|
+
function assertNumberIsBetweenForCodec(codecDescription, min, max, value) {
|
|
1290
|
+
if (value < min || value > max) throw new SolanaError(SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE, {
|
|
1291
|
+
codecDescription,
|
|
1292
|
+
max,
|
|
1293
|
+
min,
|
|
1294
|
+
value
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
function isLittleEndian(config) {
|
|
1298
|
+
return config?.endian === 1 ? false : true;
|
|
1299
|
+
}
|
|
1300
|
+
function numberEncoderFactory(input) {
|
|
1301
|
+
return createEncoder({
|
|
1302
|
+
fixedSize: input.size,
|
|
1303
|
+
write(value, bytes, offset) {
|
|
1304
|
+
if (input.range) assertNumberIsBetweenForCodec(input.name, input.range[0], input.range[1], value);
|
|
1305
|
+
const arrayBuffer = new ArrayBuffer(input.size);
|
|
1306
|
+
input.set(new DataView(arrayBuffer), value, isLittleEndian(input.config));
|
|
1307
|
+
bytes.set(new Uint8Array(arrayBuffer), offset);
|
|
1308
|
+
return offset + input.size;
|
|
1309
|
+
}
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
function numberDecoderFactory(input) {
|
|
1313
|
+
return createDecoder({
|
|
1314
|
+
fixedSize: input.size,
|
|
1315
|
+
read(bytes, offset = 0) {
|
|
1316
|
+
assertByteArrayIsNotEmptyForCodec(input.name, bytes, offset);
|
|
1317
|
+
assertByteArrayHasEnoughBytesForCodec(input.name, input.size, bytes, offset);
|
|
1318
|
+
const view = new DataView(toArrayBuffer(bytes, offset, input.size));
|
|
1319
|
+
return [input.get(view, isLittleEndian(input.config)), offset + input.size];
|
|
1320
|
+
}
|
|
1321
|
+
});
|
|
1322
|
+
}
|
|
1323
|
+
var getShortU16Encoder = () => createEncoder({
|
|
1324
|
+
getSizeFromValue: (value) => {
|
|
1325
|
+
if (value <= 127) return 1;
|
|
1326
|
+
if (value <= 16383) return 2;
|
|
1327
|
+
return 3;
|
|
1328
|
+
},
|
|
1329
|
+
maxSize: 3,
|
|
1330
|
+
write: (value, bytes, offset) => {
|
|
1331
|
+
assertNumberIsBetweenForCodec("shortU16", 0, 65535, value);
|
|
1332
|
+
const shortU16Bytes = [0];
|
|
1333
|
+
for (let ii = 0;; ii += 1) {
|
|
1334
|
+
const alignedValue = Number(value) >> ii * 7;
|
|
1335
|
+
if (alignedValue === 0) break;
|
|
1336
|
+
shortU16Bytes[ii] = 127 & alignedValue;
|
|
1337
|
+
if (ii > 0) shortU16Bytes[ii - 1] |= 128;
|
|
1338
|
+
}
|
|
1339
|
+
bytes.set(shortU16Bytes, offset);
|
|
1340
|
+
return offset + shortU16Bytes.length;
|
|
1341
|
+
}
|
|
1342
|
+
});
|
|
1343
|
+
var getU16Encoder = (config = {}) => numberEncoderFactory({
|
|
1344
|
+
config,
|
|
1345
|
+
name: "u16",
|
|
1346
|
+
range: [0, 65535],
|
|
1347
|
+
set: (view, value, le) => view.setUint16(0, Number(value), le),
|
|
1348
|
+
size: 2
|
|
1349
|
+
});
|
|
1350
|
+
var getU32Encoder = (config = {}) => numberEncoderFactory({
|
|
1351
|
+
config,
|
|
1352
|
+
name: "u32",
|
|
1353
|
+
range: [0, 4294967295],
|
|
1354
|
+
set: (view, value, le) => view.setUint32(0, Number(value), le),
|
|
1355
|
+
size: 4
|
|
1356
|
+
});
|
|
1357
|
+
var getU32Decoder = (config = {}) => numberDecoderFactory({
|
|
1358
|
+
config,
|
|
1359
|
+
get: (view, le) => view.getUint32(0, le),
|
|
1360
|
+
name: "u32",
|
|
1361
|
+
size: 4
|
|
1362
|
+
});
|
|
1363
|
+
var getU64Encoder = (config = {}) => numberEncoderFactory({
|
|
1364
|
+
config,
|
|
1365
|
+
name: "u64",
|
|
1366
|
+
range: [0n, BigInt("0xffffffffffffffff")],
|
|
1367
|
+
set: (view, value, le) => view.setBigUint64(0, BigInt(value), le),
|
|
1368
|
+
size: 8
|
|
1369
|
+
});
|
|
1370
|
+
var getU64Decoder = (config = {}) => numberDecoderFactory({
|
|
1371
|
+
config,
|
|
1372
|
+
get: (view, le) => view.getBigUint64(0, le),
|
|
1373
|
+
name: "u64",
|
|
1374
|
+
size: 8
|
|
1375
|
+
});
|
|
1376
|
+
var getU8Encoder = () => numberEncoderFactory({
|
|
1377
|
+
name: "u8",
|
|
1378
|
+
range: [0, 255],
|
|
1379
|
+
set: (view, value) => view.setUint8(0, Number(value)),
|
|
1380
|
+
size: 1
|
|
1381
|
+
});
|
|
1382
|
+
//#endregion
|
|
1383
|
+
//#region node_modules/.pnpm/@solana+codecs-data-structures@6.5.0_typescript@5.9.3/node_modules/@solana/codecs-data-structures/dist/index.node.mjs
|
|
1384
|
+
function assertValidNumberOfItemsForCodec(codecDescription, expected, actual) {
|
|
1385
|
+
if (expected !== actual) throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS, {
|
|
1386
|
+
actual,
|
|
1387
|
+
codecDescription,
|
|
1388
|
+
expected
|
|
1389
|
+
});
|
|
1390
|
+
}
|
|
1391
|
+
function maxCodecSizes(sizes) {
|
|
1392
|
+
return sizes.reduce((all, size) => all === null || size === null ? null : Math.max(all, size), 0);
|
|
1393
|
+
}
|
|
1394
|
+
function sumCodecSizes(sizes) {
|
|
1395
|
+
return sizes.reduce((all, size) => all === null || size === null ? null : all + size, 0);
|
|
1396
|
+
}
|
|
1397
|
+
function getFixedSize(codec) {
|
|
1398
|
+
return isFixedSize(codec) ? codec.fixedSize : null;
|
|
1399
|
+
}
|
|
1400
|
+
function getMaxSize(codec) {
|
|
1401
|
+
return isFixedSize(codec) ? codec.fixedSize : codec.maxSize ?? null;
|
|
1402
|
+
}
|
|
1403
|
+
function getArrayEncoder(item, config = {}) {
|
|
1404
|
+
const size = config.size ?? getU32Encoder();
|
|
1405
|
+
const fixedSize = computeArrayLikeCodecSize(size, getFixedSize(item));
|
|
1406
|
+
const maxSize = computeArrayLikeCodecSize(size, getMaxSize(item)) ?? void 0;
|
|
1407
|
+
return createEncoder({
|
|
1408
|
+
...fixedSize !== null ? { fixedSize } : {
|
|
1409
|
+
getSizeFromValue: (array) => {
|
|
1410
|
+
return (typeof size === "object" ? getEncodedSize(array.length, size) : 0) + [...array].reduce((all, value) => all + getEncodedSize(value, item), 0);
|
|
1411
|
+
},
|
|
1412
|
+
maxSize
|
|
1413
|
+
},
|
|
1414
|
+
write: (array, bytes, offset) => {
|
|
1415
|
+
if (typeof size === "number") assertValidNumberOfItemsForCodec(config.description ?? "array", size, array.length);
|
|
1416
|
+
if (typeof size === "object") offset = size.write(array.length, bytes, offset);
|
|
1417
|
+
array.forEach((value) => {
|
|
1418
|
+
offset = item.write(value, bytes, offset);
|
|
1419
|
+
});
|
|
1420
|
+
return offset;
|
|
1421
|
+
}
|
|
1422
|
+
});
|
|
1423
|
+
}
|
|
1424
|
+
function computeArrayLikeCodecSize(size, itemSize) {
|
|
1425
|
+
if (typeof size !== "number") return null;
|
|
1426
|
+
if (size === 0) return 0;
|
|
1427
|
+
return itemSize === null ? null : itemSize * size;
|
|
1428
|
+
}
|
|
1429
|
+
function getBooleanEncoder(config = {}) {
|
|
1430
|
+
return transformEncoder(config.size ?? getU8Encoder(), (value) => value ? 1 : 0);
|
|
1431
|
+
}
|
|
1432
|
+
function getBytesEncoder() {
|
|
1433
|
+
return createEncoder({
|
|
1434
|
+
getSizeFromValue: (value) => value.length,
|
|
1435
|
+
write: (value, bytes, offset) => {
|
|
1436
|
+
bytes.set(value, offset);
|
|
1437
|
+
return offset + value.length;
|
|
1438
|
+
}
|
|
1439
|
+
});
|
|
1440
|
+
}
|
|
1441
|
+
function getConstantEncoder(constant) {
|
|
1442
|
+
return createEncoder({
|
|
1443
|
+
fixedSize: constant.length,
|
|
1444
|
+
write: (_, bytes, offset) => {
|
|
1445
|
+
bytes.set(constant, offset);
|
|
1446
|
+
return offset + constant.length;
|
|
1447
|
+
}
|
|
1448
|
+
});
|
|
1449
|
+
}
|
|
1450
|
+
function getTupleEncoder(items, config) {
|
|
1451
|
+
const fixedSize = sumCodecSizes(items.map(getFixedSize));
|
|
1452
|
+
const maxSize = sumCodecSizes(items.map(getMaxSize)) ?? void 0;
|
|
1453
|
+
return createEncoder({
|
|
1454
|
+
...fixedSize === null ? {
|
|
1455
|
+
getSizeFromValue: (value) => items.map((item, index) => getEncodedSize(value[index], item)).reduce((all, one) => all + one, 0),
|
|
1456
|
+
maxSize
|
|
1457
|
+
} : { fixedSize },
|
|
1458
|
+
write: (value, bytes, offset) => {
|
|
1459
|
+
assertValidNumberOfItemsForCodec(config?.description ?? "tuple", items.length, value.length);
|
|
1460
|
+
items.forEach((item, index) => {
|
|
1461
|
+
offset = item.write(value[index], bytes, offset);
|
|
1462
|
+
});
|
|
1463
|
+
return offset;
|
|
1464
|
+
}
|
|
1465
|
+
});
|
|
1466
|
+
}
|
|
1467
|
+
function getUnionEncoder(variants, getIndexFromValue) {
|
|
1468
|
+
const fixedSize = getUnionFixedSize(variants);
|
|
1469
|
+
const write = (variant, bytes, offset) => {
|
|
1470
|
+
const index = getIndexFromValue(variant);
|
|
1471
|
+
assertValidVariantIndex(variants, index);
|
|
1472
|
+
return variants[index].write(variant, bytes, offset);
|
|
1473
|
+
};
|
|
1474
|
+
if (fixedSize !== null) return createEncoder({
|
|
1475
|
+
fixedSize,
|
|
1476
|
+
write
|
|
1477
|
+
});
|
|
1478
|
+
const maxSize = getUnionMaxSize(variants);
|
|
1479
|
+
return createEncoder({
|
|
1480
|
+
...maxSize !== null ? { maxSize } : {},
|
|
1481
|
+
getSizeFromValue: (variant) => {
|
|
1482
|
+
const index = getIndexFromValue(variant);
|
|
1483
|
+
assertValidVariantIndex(variants, index);
|
|
1484
|
+
return getEncodedSize(variant, variants[index]);
|
|
1485
|
+
},
|
|
1486
|
+
write
|
|
1487
|
+
});
|
|
1488
|
+
}
|
|
1489
|
+
function assertValidVariantIndex(variants, index) {
|
|
1490
|
+
if (typeof variants[index] === "undefined") throw new SolanaError(SOLANA_ERROR__CODECS__UNION_VARIANT_OUT_OF_RANGE, {
|
|
1491
|
+
maxRange: variants.length - 1,
|
|
1492
|
+
minRange: 0,
|
|
1493
|
+
variant: index
|
|
1494
|
+
});
|
|
1495
|
+
}
|
|
1496
|
+
function getUnionFixedSize(variants) {
|
|
1497
|
+
if (variants.length === 0) return 0;
|
|
1498
|
+
if (!isFixedSize(variants[0])) return null;
|
|
1499
|
+
const variantSize = variants[0].fixedSize;
|
|
1500
|
+
return variants.every((variant) => isFixedSize(variant) && variant.fixedSize === variantSize) ? variantSize : null;
|
|
1501
|
+
}
|
|
1502
|
+
function getUnionMaxSize(variants) {
|
|
1503
|
+
return maxCodecSizes(variants.map((variant) => getMaxSize(variant)));
|
|
1504
|
+
}
|
|
1505
|
+
function getUnitEncoder() {
|
|
1506
|
+
return createEncoder({
|
|
1507
|
+
fixedSize: 0,
|
|
1508
|
+
write: (_value, _bytes, offset) => offset
|
|
1509
|
+
});
|
|
1510
|
+
}
|
|
1511
|
+
function getNullableEncoder(item, config = {}) {
|
|
1512
|
+
const prefix = (() => {
|
|
1513
|
+
if (config.prefix === null) return transformEncoder(getUnitEncoder(), (_boolean) => void 0);
|
|
1514
|
+
return getBooleanEncoder({ size: config.prefix ?? getU8Encoder() });
|
|
1515
|
+
})();
|
|
1516
|
+
return getUnionEncoder([transformEncoder(getTupleEncoder([prefix, (() => {
|
|
1517
|
+
if (config.noneValue === "zeroes") {
|
|
1518
|
+
assertIsFixedSize(item);
|
|
1519
|
+
return fixEncoderSize(getUnitEncoder(), item.fixedSize);
|
|
1520
|
+
}
|
|
1521
|
+
if (!config.noneValue) return getUnitEncoder();
|
|
1522
|
+
return getConstantEncoder(config.noneValue);
|
|
1523
|
+
})()]), (_value) => [false, void 0]), transformEncoder(getTupleEncoder([prefix, item]), (value) => [true, value])], (variant) => Number(variant !== null));
|
|
1524
|
+
}
|
|
1525
|
+
function getPatternMatchEncoder(patterns) {
|
|
1526
|
+
return getUnionEncoder(patterns.map(([, encoder]) => encoder), (value) => {
|
|
1527
|
+
const index = patterns.findIndex(([predicate]) => predicate(value));
|
|
1528
|
+
if (index === -1) throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_PATTERN_MATCH_VALUE);
|
|
1529
|
+
return index;
|
|
1530
|
+
});
|
|
1531
|
+
}
|
|
1532
|
+
function getPredicateEncoder(predicate, ifTrue, ifFalse) {
|
|
1533
|
+
return getUnionEncoder([ifTrue, ifFalse], (value) => predicate(value) ? 0 : 1);
|
|
1534
|
+
}
|
|
1535
|
+
function getStructEncoder(fields) {
|
|
1536
|
+
const fieldCodecs = fields.map(([, codec]) => codec);
|
|
1537
|
+
const fixedSize = sumCodecSizes(fieldCodecs.map(getFixedSize));
|
|
1538
|
+
const maxSize = sumCodecSizes(fieldCodecs.map(getMaxSize)) ?? void 0;
|
|
1539
|
+
return createEncoder({
|
|
1540
|
+
...fixedSize === null ? {
|
|
1541
|
+
getSizeFromValue: (value) => fields.map(([key, codec]) => getEncodedSize(value[key], codec)).reduce((all, one) => all + one, 0),
|
|
1542
|
+
maxSize
|
|
1543
|
+
} : { fixedSize },
|
|
1544
|
+
write: (struct, bytes, offset) => {
|
|
1545
|
+
fields.forEach(([key, codec]) => {
|
|
1546
|
+
offset = codec.write(struct[key], bytes, offset);
|
|
1547
|
+
});
|
|
1548
|
+
return offset;
|
|
1549
|
+
}
|
|
1550
|
+
});
|
|
1551
|
+
}
|
|
1552
|
+
//#endregion
|
|
1553
|
+
//#region node_modules/.pnpm/@solana+functional@6.5.0_typescript@5.9.3/node_modules/@solana/functional/dist/index.node.mjs
|
|
1554
|
+
function pipe(init, ...fns) {
|
|
1555
|
+
return fns.reduce((acc, fn) => fn(acc), init);
|
|
1556
|
+
}
|
|
1557
|
+
//#endregion
|
|
1558
|
+
//#region node_modules/.pnpm/@solana+instructions@6.5.0_typescript@5.9.3/node_modules/@solana/instructions/dist/index.node.mjs
|
|
1559
|
+
var AccountRole = /* @__PURE__ */ ((AccountRole2) => {
|
|
1560
|
+
AccountRole2[AccountRole2["WRITABLE_SIGNER"] = 3] = "WRITABLE_SIGNER";
|
|
1561
|
+
AccountRole2[AccountRole2["READONLY_SIGNER"] = 2] = "READONLY_SIGNER";
|
|
1562
|
+
AccountRole2[AccountRole2["WRITABLE"] = 1] = "WRITABLE";
|
|
1563
|
+
AccountRole2[AccountRole2["READONLY"] = 0] = "READONLY";
|
|
1564
|
+
return AccountRole2;
|
|
1565
|
+
})(AccountRole || {});
|
|
1566
|
+
var IS_SIGNER_BITMASK = 2;
|
|
1567
|
+
var IS_WRITABLE_BITMASK = 1;
|
|
1568
|
+
function isSignerRole(role) {
|
|
1569
|
+
return role >= 2;
|
|
1570
|
+
}
|
|
1571
|
+
function isWritableRole(role) {
|
|
1572
|
+
return (role & IS_WRITABLE_BITMASK) !== 0;
|
|
1573
|
+
}
|
|
1574
|
+
function mergeRoles(roleA, roleB) {
|
|
1575
|
+
return roleA | roleB;
|
|
1576
|
+
}
|
|
1577
|
+
function upgradeRoleToSigner(role) {
|
|
1578
|
+
return role | IS_SIGNER_BITMASK;
|
|
1579
|
+
}
|
|
1580
|
+
//#endregion
|
|
1581
|
+
//#region node_modules/.pnpm/@solana+rpc-types@6.5.0_typescript@5.9.3/node_modules/@solana/rpc-types/dist/index.node.mjs
|
|
1582
|
+
function isBlockhash(putativeBlockhash) {
|
|
1583
|
+
return isAddress(putativeBlockhash);
|
|
1584
|
+
}
|
|
1585
|
+
function mainnet(putativeString) {
|
|
1586
|
+
return putativeString;
|
|
1587
|
+
}
|
|
1588
|
+
//#endregion
|
|
1589
|
+
//#region node_modules/.pnpm/@solana+transaction-messages@6.5.0_typescript@5.9.3/node_modules/@solana/transaction-messages/dist/index.node.mjs
|
|
1590
|
+
function isTransactionMessageWithBlockhashLifetime(transactionMessage) {
|
|
1591
|
+
return "lifetimeConstraint" in transactionMessage && typeof transactionMessage.lifetimeConstraint.blockhash === "string" && typeof transactionMessage.lifetimeConstraint.lastValidBlockHeight === "bigint" && isBlockhash(transactionMessage.lifetimeConstraint.blockhash);
|
|
1592
|
+
}
|
|
1593
|
+
function setTransactionMessageLifetimeUsingBlockhash(blockhashLifetimeConstraint, transactionMessage) {
|
|
1594
|
+
if ("lifetimeConstraint" in transactionMessage && transactionMessage.lifetimeConstraint && "blockhash" in transactionMessage.lifetimeConstraint && transactionMessage.lifetimeConstraint.blockhash === blockhashLifetimeConstraint.blockhash && transactionMessage.lifetimeConstraint.lastValidBlockHeight === blockhashLifetimeConstraint.lastValidBlockHeight) return transactionMessage;
|
|
1595
|
+
return Object.freeze({
|
|
1596
|
+
...transactionMessage,
|
|
1597
|
+
lifetimeConstraint: Object.freeze(blockhashLifetimeConstraint)
|
|
1598
|
+
});
|
|
1599
|
+
}
|
|
1600
|
+
var memoizedU8Encoder;
|
|
1601
|
+
function getMemoizedU8Encoder() {
|
|
1602
|
+
if (!memoizedU8Encoder) memoizedU8Encoder = getU8Encoder();
|
|
1603
|
+
return memoizedU8Encoder;
|
|
1604
|
+
}
|
|
1605
|
+
function getMessageHeaderEncoder() {
|
|
1606
|
+
return getStructEncoder([
|
|
1607
|
+
["numSignerAccounts", getMemoizedU8Encoder()],
|
|
1608
|
+
["numReadonlySignerAccounts", getMemoizedU8Encoder()],
|
|
1609
|
+
["numReadonlyNonSignerAccounts", getMemoizedU8Encoder()]
|
|
1610
|
+
]);
|
|
1611
|
+
}
|
|
1612
|
+
var memoizedGetInstructionEncoder;
|
|
1613
|
+
function getInstructionEncoder() {
|
|
1614
|
+
if (!memoizedGetInstructionEncoder) memoizedGetInstructionEncoder = transformEncoder(getStructEncoder([
|
|
1615
|
+
["programAddressIndex", getU8Encoder()],
|
|
1616
|
+
["accountIndices", getArrayEncoder(getU8Encoder(), { size: getShortU16Encoder() })],
|
|
1617
|
+
["data", addEncoderSizePrefix(getBytesEncoder(), getShortU16Encoder())]
|
|
1618
|
+
]), (instruction) => {
|
|
1619
|
+
if (instruction.accountIndices !== void 0 && instruction.data !== void 0) return instruction;
|
|
1620
|
+
return {
|
|
1621
|
+
...instruction,
|
|
1622
|
+
accountIndices: instruction.accountIndices ?? [],
|
|
1623
|
+
data: instruction.data ?? new Uint8Array(0)
|
|
1624
|
+
};
|
|
1625
|
+
});
|
|
1626
|
+
return memoizedGetInstructionEncoder;
|
|
1627
|
+
}
|
|
1628
|
+
function assertValidBaseString(alphabet4, testValue, givenValue = testValue) {
|
|
1629
|
+
if (!testValue.match(new RegExp(`^[${alphabet4}]*$`))) throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE, {
|
|
1630
|
+
alphabet: alphabet4,
|
|
1631
|
+
base: alphabet4.length,
|
|
1632
|
+
value: givenValue
|
|
1633
|
+
});
|
|
1634
|
+
}
|
|
1635
|
+
var getBaseXEncoder = (alphabet4) => {
|
|
1636
|
+
return createEncoder({
|
|
1637
|
+
getSizeFromValue: (value) => {
|
|
1638
|
+
const [leadingZeroes, tailChars] = partitionLeadingZeroes(value, alphabet4[0]);
|
|
1639
|
+
if (!tailChars) return value.length;
|
|
1640
|
+
const base10Number = getBigIntFromBaseX(tailChars, alphabet4);
|
|
1641
|
+
return leadingZeroes.length + Math.ceil(base10Number.toString(16).length / 2);
|
|
1642
|
+
},
|
|
1643
|
+
write(value, bytes, offset) {
|
|
1644
|
+
assertValidBaseString(alphabet4, value);
|
|
1645
|
+
if (value === "") return offset;
|
|
1646
|
+
const [leadingZeroes, tailChars] = partitionLeadingZeroes(value, alphabet4[0]);
|
|
1647
|
+
if (!tailChars) {
|
|
1648
|
+
bytes.set(new Uint8Array(leadingZeroes.length).fill(0), offset);
|
|
1649
|
+
return offset + leadingZeroes.length;
|
|
1650
|
+
}
|
|
1651
|
+
let base10Number = getBigIntFromBaseX(tailChars, alphabet4);
|
|
1652
|
+
const tailBytes = [];
|
|
1653
|
+
while (base10Number > 0n) {
|
|
1654
|
+
tailBytes.unshift(Number(base10Number % 256n));
|
|
1655
|
+
base10Number /= 256n;
|
|
1656
|
+
}
|
|
1657
|
+
const bytesToAdd = [...Array(leadingZeroes.length).fill(0), ...tailBytes];
|
|
1658
|
+
bytes.set(bytesToAdd, offset);
|
|
1659
|
+
return offset + bytesToAdd.length;
|
|
1660
|
+
}
|
|
1661
|
+
});
|
|
1662
|
+
};
|
|
1663
|
+
function partitionLeadingZeroes(value, zeroCharacter) {
|
|
1664
|
+
const [leadingZeros, tailChars] = value.split(new RegExp(`((?!${zeroCharacter}).*)`));
|
|
1665
|
+
return [leadingZeros, tailChars];
|
|
1666
|
+
}
|
|
1667
|
+
function getBigIntFromBaseX(value, alphabet4) {
|
|
1668
|
+
const base = BigInt(alphabet4.length);
|
|
1669
|
+
let sum = 0n;
|
|
1670
|
+
for (const char of value) {
|
|
1671
|
+
sum *= base;
|
|
1672
|
+
sum += BigInt(alphabet4.indexOf(char));
|
|
1673
|
+
}
|
|
1674
|
+
return sum;
|
|
1675
|
+
}
|
|
1676
|
+
var alphabet2 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
1677
|
+
var getBase58Encoder = () => getBaseXEncoder(alphabet2);
|
|
1678
|
+
function getLifetimeTokenEncoder() {
|
|
1679
|
+
return transformEncoder(getNullableEncoder(fixEncoderSize(getBase58Encoder(), 32), {
|
|
1680
|
+
noneValue: "zeroes",
|
|
1681
|
+
prefix: null
|
|
1682
|
+
}), (token) => token ?? null);
|
|
1683
|
+
}
|
|
1684
|
+
function getMessageEncoder() {
|
|
1685
|
+
return transformEncoder(getStructEncoder([
|
|
1686
|
+
["header", getMessageHeaderEncoder()],
|
|
1687
|
+
["staticAccounts", getArrayEncoder(getAddressEncoder(), { size: getShortU16Encoder() })],
|
|
1688
|
+
["lifetimeToken", getLifetimeTokenEncoder()],
|
|
1689
|
+
["instructions", getArrayEncoder(getInstructionEncoder(), { size: getShortU16Encoder() })]
|
|
1690
|
+
]), (value) => ({
|
|
1691
|
+
...value,
|
|
1692
|
+
lifetimeToken: "lifetimeToken" in value ? value.lifetimeToken : void 0
|
|
1693
|
+
}));
|
|
1694
|
+
}
|
|
1695
|
+
var VERSION_FLAG_MASK = 128;
|
|
1696
|
+
function getTransactionVersionEncoder() {
|
|
1697
|
+
return createEncoder({
|
|
1698
|
+
getSizeFromValue: (value) => value === "legacy" ? 0 : 1,
|
|
1699
|
+
maxSize: 1,
|
|
1700
|
+
write: (value, bytes, offset) => {
|
|
1701
|
+
if (value === "legacy") return offset;
|
|
1702
|
+
if (value < 0 || value > 127) throw new SolanaError(SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_OUT_OF_RANGE, { actualVersion: value });
|
|
1703
|
+
if (value > 1) throw new SolanaError(SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_NOT_SUPPORTED, { unsupportedVersion: value });
|
|
1704
|
+
bytes.set([value | VERSION_FLAG_MASK], offset);
|
|
1705
|
+
return offset + 1;
|
|
1706
|
+
}
|
|
1707
|
+
});
|
|
1708
|
+
}
|
|
1709
|
+
function getTransactionVersionDecoder() {
|
|
1710
|
+
return createDecoder({
|
|
1711
|
+
maxSize: 1,
|
|
1712
|
+
read: (bytes, offset) => {
|
|
1713
|
+
const firstByte = bytes[offset];
|
|
1714
|
+
if ((firstByte & VERSION_FLAG_MASK) === 0) return ["legacy", offset];
|
|
1715
|
+
else {
|
|
1716
|
+
const version = firstByte ^ VERSION_FLAG_MASK;
|
|
1717
|
+
if (version > 1) throw new SolanaError(SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_NOT_SUPPORTED, { unsupportedVersion: version });
|
|
1718
|
+
return [version, offset + 1];
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
});
|
|
1722
|
+
}
|
|
1723
|
+
var memoizedAddressTableLookupEncoder;
|
|
1724
|
+
function getAddressTableLookupEncoder() {
|
|
1725
|
+
if (!memoizedAddressTableLookupEncoder) {
|
|
1726
|
+
const indexEncoder = getArrayEncoder(getU8Encoder(), { size: getShortU16Encoder() });
|
|
1727
|
+
memoizedAddressTableLookupEncoder = getStructEncoder([
|
|
1728
|
+
["lookupTableAddress", getAddressEncoder()],
|
|
1729
|
+
["writableIndexes", indexEncoder],
|
|
1730
|
+
["readonlyIndexes", indexEncoder]
|
|
1731
|
+
]);
|
|
1732
|
+
}
|
|
1733
|
+
return memoizedAddressTableLookupEncoder;
|
|
1734
|
+
}
|
|
1735
|
+
function getMessageEncoder2() {
|
|
1736
|
+
return transformEncoder(getStructEncoder([
|
|
1737
|
+
["version", getTransactionVersionEncoder()],
|
|
1738
|
+
["header", getMessageHeaderEncoder()],
|
|
1739
|
+
["staticAccounts", getArrayEncoder(getAddressEncoder(), { size: getShortU16Encoder() })],
|
|
1740
|
+
["lifetimeToken", getLifetimeTokenEncoder()],
|
|
1741
|
+
["instructions", getArrayEncoder(getInstructionEncoder(), { size: getShortU16Encoder() })],
|
|
1742
|
+
["addressTableLookups", getArrayEncoder(getAddressTableLookupEncoder(), { size: getShortU16Encoder() })]
|
|
1743
|
+
]), (value) => ({
|
|
1744
|
+
...value,
|
|
1745
|
+
addressTableLookups: value.addressTableLookups ?? [],
|
|
1746
|
+
lifetimeToken: "lifetimeToken" in value ? value.lifetimeToken : void 0
|
|
1747
|
+
}));
|
|
1748
|
+
}
|
|
1749
|
+
function isV1ConfigEmpty(config) {
|
|
1750
|
+
return config.computeUnitLimit === void 0 && config.heapSize === void 0 && config.loadedAccountsDataSizeLimit === void 0 && config.priorityFeeLamports === void 0;
|
|
1751
|
+
}
|
|
1752
|
+
function areV1ConfigsEqual(config1, config2) {
|
|
1753
|
+
return config1.computeUnitLimit === config2.computeUnitLimit && config1.heapSize === config2.heapSize && config1.loadedAccountsDataSizeLimit === config2.loadedAccountsDataSizeLimit && config1.priorityFeeLamports === config2.priorityFeeLamports;
|
|
1754
|
+
}
|
|
1755
|
+
var TRANSACTION_CONFIG_PRIORITY_FEE_LAMPORTS_BIT_MASK = 3;
|
|
1756
|
+
var TRANSACTION_CONFIG_COMPUTE_UNIT_LIMIT_BIT_MASK = 4;
|
|
1757
|
+
var TRANSACTION_CONFIG_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_BIT_MASK = 8;
|
|
1758
|
+
var TRANSACTION_CONFIG_HEAP_SIZE_BIT_MASK = 16;
|
|
1759
|
+
function getCompiledTransactionConfigValueEncoder() {
|
|
1760
|
+
return getPatternMatchEncoder([[(value) => value.kind === "u32", getStructEncoder([["value", getU32Encoder()]])], [(value) => value.kind === "u64", getStructEncoder([["value", getU64Encoder()]])]]);
|
|
1761
|
+
}
|
|
1762
|
+
function getCompiledTransactionConfigValuesEncoder() {
|
|
1763
|
+
return getArrayEncoder(getCompiledTransactionConfigValueEncoder(), { size: "remainder" });
|
|
1764
|
+
}
|
|
1765
|
+
function getInstructionHeaderEncoder() {
|
|
1766
|
+
return getStructEncoder([
|
|
1767
|
+
["programAccountIndex", getU8Encoder()],
|
|
1768
|
+
["numInstructionAccounts", getU8Encoder()],
|
|
1769
|
+
["numInstructionDataBytes", getU16Encoder()]
|
|
1770
|
+
]);
|
|
1771
|
+
}
|
|
1772
|
+
function getInstructionPayloadEncoder() {
|
|
1773
|
+
return getStructEncoder([["instructionAccountIndices", getArrayEncoder(getU8Encoder(), { size: "remainder" })], ["instructionData", getBytesEncoder()]]);
|
|
1774
|
+
}
|
|
1775
|
+
function getMessageEncoder3() {
|
|
1776
|
+
return transformEncoder(getStructEncoder([
|
|
1777
|
+
["version", getTransactionVersionEncoder()],
|
|
1778
|
+
["header", getMessageHeaderEncoder()],
|
|
1779
|
+
["configMask", getU32Encoder()],
|
|
1780
|
+
["lifetimeToken", getLifetimeTokenEncoder()],
|
|
1781
|
+
["numInstructions", getU8Encoder()],
|
|
1782
|
+
["numStaticAccounts", getU8Encoder()],
|
|
1783
|
+
["staticAccounts", getArrayEncoder(getAddressEncoder(), { size: "remainder" })],
|
|
1784
|
+
["configValues", getCompiledTransactionConfigValuesEncoder()],
|
|
1785
|
+
["instructionHeaders", getArrayEncoder(getInstructionHeaderEncoder(), { size: "remainder" })],
|
|
1786
|
+
["instructionPayloads", getArrayEncoder(getInstructionPayloadEncoder(), { size: "remainder" })]
|
|
1787
|
+
]), (value) => ({
|
|
1788
|
+
...value,
|
|
1789
|
+
lifetimeToken: "lifetimeToken" in value ? value.lifetimeToken : void 0
|
|
1790
|
+
}));
|
|
1791
|
+
}
|
|
1792
|
+
function getCompiledTransactionMessageEncoder() {
|
|
1793
|
+
return transformEncoder(getPatternMatchEncoder([
|
|
1794
|
+
[(m) => m.version === "legacy", getMessageEncoder()],
|
|
1795
|
+
[(m) => m.version === 0, getMessageEncoder2()],
|
|
1796
|
+
[(m) => m.version === 1, getMessageEncoder3()]
|
|
1797
|
+
]), (value) => {
|
|
1798
|
+
if (value.version !== "legacy" && value.version > 1) throw new SolanaError(SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_NOT_SUPPORTED, { unsupportedVersion: value.version });
|
|
1799
|
+
return value;
|
|
1800
|
+
});
|
|
1801
|
+
}
|
|
1802
|
+
function upsert(addressMap, address, update) {
|
|
1803
|
+
addressMap[address] = update(addressMap[address] ?? { role: AccountRole.READONLY });
|
|
1804
|
+
}
|
|
1805
|
+
var TYPE = Symbol("AddressMapTypeProperty");
|
|
1806
|
+
function getAddressMapFromInstructions(feePayer, instructions) {
|
|
1807
|
+
const addressMap = { [feePayer]: {
|
|
1808
|
+
[TYPE]: 0,
|
|
1809
|
+
role: AccountRole.WRITABLE_SIGNER
|
|
1810
|
+
} };
|
|
1811
|
+
const addressesOfInvokedPrograms = /* @__PURE__ */ new Set();
|
|
1812
|
+
for (const instruction of instructions) {
|
|
1813
|
+
upsert(addressMap, instruction.programAddress, (entry) => {
|
|
1814
|
+
addressesOfInvokedPrograms.add(instruction.programAddress);
|
|
1815
|
+
if (TYPE in entry) {
|
|
1816
|
+
if (isWritableRole(entry.role)) switch (entry[TYPE]) {
|
|
1817
|
+
case 0: throw new SolanaError(SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES, { programAddress: instruction.programAddress });
|
|
1818
|
+
default: throw new SolanaError(SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE, { programAddress: instruction.programAddress });
|
|
1819
|
+
}
|
|
1820
|
+
if (entry[TYPE] === 1) return entry;
|
|
1821
|
+
}
|
|
1822
|
+
return {
|
|
1823
|
+
[TYPE]: 1,
|
|
1824
|
+
role: AccountRole.READONLY
|
|
1825
|
+
};
|
|
1826
|
+
});
|
|
1827
|
+
if (!instruction.accounts) continue;
|
|
1828
|
+
for (const account of instruction.accounts) upsert(addressMap, account.address, (entry) => {
|
|
1829
|
+
const { address: _, ...accountMeta } = account;
|
|
1830
|
+
if (TYPE in entry) switch (entry[TYPE]) {
|
|
1831
|
+
case 0: return entry;
|
|
1832
|
+
case 1: {
|
|
1833
|
+
const nextRole = mergeRoles(entry.role, accountMeta.role);
|
|
1834
|
+
if (addressesOfInvokedPrograms.has(account.address)) {
|
|
1835
|
+
if (isWritableRole(accountMeta.role)) throw new SolanaError(SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE, { programAddress: account.address });
|
|
1836
|
+
if (entry.role !== nextRole) return {
|
|
1837
|
+
...entry,
|
|
1838
|
+
role: nextRole
|
|
1839
|
+
};
|
|
1840
|
+
else return entry;
|
|
1841
|
+
} else if (entry.role !== nextRole) return {
|
|
1842
|
+
...entry,
|
|
1843
|
+
role: nextRole
|
|
1844
|
+
};
|
|
1845
|
+
else return entry;
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
return {
|
|
1849
|
+
...accountMeta,
|
|
1850
|
+
[TYPE]: 1
|
|
1851
|
+
};
|
|
1852
|
+
});
|
|
1853
|
+
}
|
|
1854
|
+
return addressMap;
|
|
1855
|
+
}
|
|
1856
|
+
function getOrderedAccountsFromAddressMap(addressMap) {
|
|
1857
|
+
let addressComparator;
|
|
1858
|
+
return Object.entries(addressMap).sort(([leftAddress, leftEntry], [rightAddress, rightEntry]) => {
|
|
1859
|
+
if (leftEntry[TYPE] !== rightEntry[TYPE]) {
|
|
1860
|
+
if (leftEntry[TYPE] === 0) return -1;
|
|
1861
|
+
else if (rightEntry[TYPE] === 0) return 1;
|
|
1862
|
+
else if (leftEntry[TYPE] === 1) return -1;
|
|
1863
|
+
else if (rightEntry[TYPE] === 1) return 1;
|
|
1864
|
+
}
|
|
1865
|
+
const leftIsSigner = isSignerRole(leftEntry.role);
|
|
1866
|
+
if (leftIsSigner !== isSignerRole(rightEntry.role)) return leftIsSigner ? -1 : 1;
|
|
1867
|
+
const leftIsWritable = isWritableRole(leftEntry.role);
|
|
1868
|
+
if (leftIsWritable !== isWritableRole(rightEntry.role)) return leftIsWritable ? -1 : 1;
|
|
1869
|
+
addressComparator ||= getAddressComparator();
|
|
1870
|
+
return addressComparator(leftAddress, rightAddress);
|
|
1871
|
+
}).map(([address, addressMeta]) => ({
|
|
1872
|
+
address,
|
|
1873
|
+
...addressMeta
|
|
1874
|
+
}));
|
|
1875
|
+
}
|
|
1876
|
+
function getCompiledMessageHeader(orderedAccounts) {
|
|
1877
|
+
let numReadonlyNonSignerAccounts = 0;
|
|
1878
|
+
let numReadonlySignerAccounts = 0;
|
|
1879
|
+
let numSignerAccounts = 0;
|
|
1880
|
+
for (const account of orderedAccounts) {
|
|
1881
|
+
if ("lookupTableAddress" in account) break;
|
|
1882
|
+
const accountIsWritable = isWritableRole(account.role);
|
|
1883
|
+
if (isSignerRole(account.role)) {
|
|
1884
|
+
numSignerAccounts++;
|
|
1885
|
+
if (!accountIsWritable) numReadonlySignerAccounts++;
|
|
1886
|
+
} else if (!accountIsWritable) numReadonlyNonSignerAccounts++;
|
|
1887
|
+
}
|
|
1888
|
+
return {
|
|
1889
|
+
numReadonlyNonSignerAccounts,
|
|
1890
|
+
numReadonlySignerAccounts,
|
|
1891
|
+
numSignerAccounts
|
|
1892
|
+
};
|
|
1893
|
+
}
|
|
1894
|
+
function getAccountIndex(orderedAccounts) {
|
|
1895
|
+
const out = {};
|
|
1896
|
+
for (const [index, account] of orderedAccounts.entries()) out[account.address] = index;
|
|
1897
|
+
return out;
|
|
1898
|
+
}
|
|
1899
|
+
function getCompiledInstructions(instructions, orderedAccounts) {
|
|
1900
|
+
const accountIndex = getAccountIndex(orderedAccounts);
|
|
1901
|
+
return instructions.map(({ accounts, data, programAddress }) => {
|
|
1902
|
+
return {
|
|
1903
|
+
programAddressIndex: accountIndex[programAddress],
|
|
1904
|
+
...accounts ? { accountIndices: accounts.map(({ address }) => accountIndex[address]) } : null,
|
|
1905
|
+
...data ? { data } : null
|
|
1906
|
+
};
|
|
1907
|
+
});
|
|
1908
|
+
}
|
|
1909
|
+
function getCompiledLifetimeToken(lifetimeConstraint) {
|
|
1910
|
+
if ("nonce" in lifetimeConstraint) return lifetimeConstraint.nonce;
|
|
1911
|
+
return lifetimeConstraint.blockhash;
|
|
1912
|
+
}
|
|
1913
|
+
function compileTransactionMessage(transactionMessage) {
|
|
1914
|
+
const orderedAccounts = getOrderedAccountsFromAddressMap(getAddressMapFromInstructions(transactionMessage.feePayer.address, transactionMessage.instructions));
|
|
1915
|
+
const lifetimeConstraint = transactionMessage.lifetimeConstraint;
|
|
1916
|
+
return {
|
|
1917
|
+
...lifetimeConstraint ? { lifetimeToken: getCompiledLifetimeToken(lifetimeConstraint) } : null,
|
|
1918
|
+
header: getCompiledMessageHeader(orderedAccounts),
|
|
1919
|
+
instructions: getCompiledInstructions(transactionMessage.instructions, orderedAccounts),
|
|
1920
|
+
staticAccounts: orderedAccounts.map((account) => account.address),
|
|
1921
|
+
version: transactionMessage.version
|
|
1922
|
+
};
|
|
1923
|
+
}
|
|
1924
|
+
function upsert2(addressMap, address, update) {
|
|
1925
|
+
addressMap[address] = update(addressMap[address] ?? { role: AccountRole.READONLY });
|
|
1926
|
+
}
|
|
1927
|
+
var TYPE2 = Symbol("AddressMapTypeProperty");
|
|
1928
|
+
function getAddressMapFromInstructions2(feePayer, instructions) {
|
|
1929
|
+
const addressMap = { [feePayer]: {
|
|
1930
|
+
[TYPE2]: 0,
|
|
1931
|
+
role: AccountRole.WRITABLE_SIGNER
|
|
1932
|
+
} };
|
|
1933
|
+
const addressesOfInvokedPrograms = /* @__PURE__ */ new Set();
|
|
1934
|
+
for (const instruction of instructions) {
|
|
1935
|
+
upsert2(addressMap, instruction.programAddress, (entry) => {
|
|
1936
|
+
addressesOfInvokedPrograms.add(instruction.programAddress);
|
|
1937
|
+
if (TYPE2 in entry) {
|
|
1938
|
+
if (isWritableRole(entry.role)) switch (entry[TYPE2]) {
|
|
1939
|
+
case 0: throw new SolanaError(SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES, { programAddress: instruction.programAddress });
|
|
1940
|
+
default: throw new SolanaError(SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE, { programAddress: instruction.programAddress });
|
|
1941
|
+
}
|
|
1942
|
+
if (entry[TYPE2] === 2) return entry;
|
|
1943
|
+
}
|
|
1944
|
+
return {
|
|
1945
|
+
[TYPE2]: 2,
|
|
1946
|
+
role: AccountRole.READONLY
|
|
1947
|
+
};
|
|
1948
|
+
});
|
|
1949
|
+
let addressComparator;
|
|
1950
|
+
if (!instruction.accounts) continue;
|
|
1951
|
+
for (const account of instruction.accounts) upsert2(addressMap, account.address, (entry) => {
|
|
1952
|
+
const { address: _, ...accountMeta } = account;
|
|
1953
|
+
if (TYPE2 in entry) switch (entry[TYPE2]) {
|
|
1954
|
+
case 0: return entry;
|
|
1955
|
+
case 1: {
|
|
1956
|
+
const nextRole = mergeRoles(entry.role, accountMeta.role);
|
|
1957
|
+
if ("lookupTableAddress" in accountMeta) {
|
|
1958
|
+
if (entry.lookupTableAddress !== accountMeta.lookupTableAddress && (addressComparator ||= getAddressComparator())(accountMeta.lookupTableAddress, entry.lookupTableAddress) < 0) return {
|
|
1959
|
+
[TYPE2]: 1,
|
|
1960
|
+
...accountMeta,
|
|
1961
|
+
role: nextRole
|
|
1962
|
+
};
|
|
1963
|
+
} else if (isSignerRole(accountMeta.role)) return {
|
|
1964
|
+
[TYPE2]: 2,
|
|
1965
|
+
role: nextRole
|
|
1966
|
+
};
|
|
1967
|
+
if (entry.role !== nextRole) return {
|
|
1968
|
+
...entry,
|
|
1969
|
+
role: nextRole
|
|
1970
|
+
};
|
|
1971
|
+
else return entry;
|
|
1972
|
+
}
|
|
1973
|
+
case 2: {
|
|
1974
|
+
const nextRole = mergeRoles(entry.role, accountMeta.role);
|
|
1975
|
+
if (addressesOfInvokedPrograms.has(account.address)) {
|
|
1976
|
+
if (isWritableRole(accountMeta.role)) throw new SolanaError(SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE, { programAddress: account.address });
|
|
1977
|
+
if (entry.role !== nextRole) return {
|
|
1978
|
+
...entry,
|
|
1979
|
+
role: nextRole
|
|
1980
|
+
};
|
|
1981
|
+
else return entry;
|
|
1982
|
+
} else if ("lookupTableAddress" in accountMeta && !isSignerRole(entry.role)) return {
|
|
1983
|
+
...accountMeta,
|
|
1984
|
+
[TYPE2]: 1,
|
|
1985
|
+
role: nextRole
|
|
1986
|
+
};
|
|
1987
|
+
else if (entry.role !== nextRole) return {
|
|
1988
|
+
...entry,
|
|
1989
|
+
role: nextRole
|
|
1990
|
+
};
|
|
1991
|
+
else return entry;
|
|
1992
|
+
}
|
|
1993
|
+
}
|
|
1994
|
+
if ("lookupTableAddress" in accountMeta) return {
|
|
1995
|
+
...accountMeta,
|
|
1996
|
+
[TYPE2]: 1
|
|
1997
|
+
};
|
|
1998
|
+
else return {
|
|
1999
|
+
...accountMeta,
|
|
2000
|
+
[TYPE2]: 2
|
|
2001
|
+
};
|
|
2002
|
+
});
|
|
2003
|
+
}
|
|
2004
|
+
return addressMap;
|
|
2005
|
+
}
|
|
2006
|
+
function getOrderedAccountsFromAddressMap2(addressMap) {
|
|
2007
|
+
let addressComparator;
|
|
2008
|
+
return Object.entries(addressMap).sort(([leftAddress, leftEntry], [rightAddress, rightEntry]) => {
|
|
2009
|
+
if (leftEntry[TYPE2] !== rightEntry[TYPE2]) {
|
|
2010
|
+
if (leftEntry[TYPE2] === 0) return -1;
|
|
2011
|
+
else if (rightEntry[TYPE2] === 0) return 1;
|
|
2012
|
+
else if (leftEntry[TYPE2] === 2) return -1;
|
|
2013
|
+
else if (rightEntry[TYPE2] === 2) return 1;
|
|
2014
|
+
}
|
|
2015
|
+
const leftIsSigner = isSignerRole(leftEntry.role);
|
|
2016
|
+
if (leftIsSigner !== isSignerRole(rightEntry.role)) return leftIsSigner ? -1 : 1;
|
|
2017
|
+
const leftIsWritable = isWritableRole(leftEntry.role);
|
|
2018
|
+
if (leftIsWritable !== isWritableRole(rightEntry.role)) return leftIsWritable ? -1 : 1;
|
|
2019
|
+
addressComparator ||= getAddressComparator();
|
|
2020
|
+
if (leftEntry[TYPE2] === 1 && rightEntry[TYPE2] === 1 && leftEntry.lookupTableAddress !== rightEntry.lookupTableAddress) return addressComparator(leftEntry.lookupTableAddress, rightEntry.lookupTableAddress);
|
|
2021
|
+
else return addressComparator(leftAddress, rightAddress);
|
|
2022
|
+
}).map(([address, addressMeta]) => ({
|
|
2023
|
+
address,
|
|
2024
|
+
...addressMeta
|
|
2025
|
+
}));
|
|
2026
|
+
}
|
|
2027
|
+
function getCompiledAddressTableLookups(orderedAccounts) {
|
|
2028
|
+
const index = {};
|
|
2029
|
+
for (const account of orderedAccounts) {
|
|
2030
|
+
if (!("lookupTableAddress" in account)) continue;
|
|
2031
|
+
const entry = index[account.lookupTableAddress] ||= {
|
|
2032
|
+
readonlyIndexes: [],
|
|
2033
|
+
writableIndexes: []
|
|
2034
|
+
};
|
|
2035
|
+
if (account.role === AccountRole.WRITABLE) entry.writableIndexes.push(account.addressIndex);
|
|
2036
|
+
else entry.readonlyIndexes.push(account.addressIndex);
|
|
2037
|
+
}
|
|
2038
|
+
return Object.keys(index).sort(getAddressComparator()).map((lookupTableAddress) => ({
|
|
2039
|
+
lookupTableAddress,
|
|
2040
|
+
...index[lookupTableAddress]
|
|
2041
|
+
}));
|
|
2042
|
+
}
|
|
2043
|
+
function getAccountIndex2(orderedAccounts) {
|
|
2044
|
+
const out = {};
|
|
2045
|
+
for (const [index, account] of orderedAccounts.entries()) out[account.address] = index;
|
|
2046
|
+
return out;
|
|
2047
|
+
}
|
|
2048
|
+
function getCompiledInstructions2(instructions, orderedAccounts) {
|
|
2049
|
+
const accountIndex = getAccountIndex2(orderedAccounts);
|
|
2050
|
+
return instructions.map(({ accounts, data, programAddress }) => {
|
|
2051
|
+
return {
|
|
2052
|
+
programAddressIndex: accountIndex[programAddress],
|
|
2053
|
+
...accounts ? { accountIndices: accounts.map(({ address }) => accountIndex[address]) } : null,
|
|
2054
|
+
...data ? { data } : null
|
|
2055
|
+
};
|
|
2056
|
+
});
|
|
2057
|
+
}
|
|
2058
|
+
function getCompiledStaticAccounts(orderedAccounts) {
|
|
2059
|
+
const firstLookupTableAccountIndex = orderedAccounts.findIndex((account) => "lookupTableAddress" in account);
|
|
2060
|
+
return (firstLookupTableAccountIndex === -1 ? orderedAccounts : orderedAccounts.slice(0, firstLookupTableAccountIndex)).map(({ address }) => address);
|
|
2061
|
+
}
|
|
2062
|
+
function compileTransactionMessage2(transactionMessage) {
|
|
2063
|
+
const orderedAccounts = getOrderedAccountsFromAddressMap2(getAddressMapFromInstructions2(transactionMessage.feePayer.address, transactionMessage.instructions));
|
|
2064
|
+
const lifetimeConstraint = transactionMessage.lifetimeConstraint;
|
|
2065
|
+
return {
|
|
2066
|
+
addressTableLookups: getCompiledAddressTableLookups(orderedAccounts),
|
|
2067
|
+
...lifetimeConstraint ? { lifetimeToken: getCompiledLifetimeToken(lifetimeConstraint) } : null,
|
|
2068
|
+
header: getCompiledMessageHeader(orderedAccounts),
|
|
2069
|
+
instructions: getCompiledInstructions2(transactionMessage.instructions, orderedAccounts),
|
|
2070
|
+
staticAccounts: getCompiledStaticAccounts(orderedAccounts),
|
|
2071
|
+
version: transactionMessage.version
|
|
2072
|
+
};
|
|
2073
|
+
}
|
|
2074
|
+
function getTransactionConfigMask(config) {
|
|
2075
|
+
let mask = 0;
|
|
2076
|
+
if (config.priorityFeeLamports !== void 0) mask |= TRANSACTION_CONFIG_PRIORITY_FEE_LAMPORTS_BIT_MASK;
|
|
2077
|
+
if (config.computeUnitLimit !== void 0) mask |= TRANSACTION_CONFIG_COMPUTE_UNIT_LIMIT_BIT_MASK;
|
|
2078
|
+
if (config.loadedAccountsDataSizeLimit !== void 0) mask |= TRANSACTION_CONFIG_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_BIT_MASK;
|
|
2079
|
+
if (config.heapSize !== void 0) mask |= TRANSACTION_CONFIG_HEAP_SIZE_BIT_MASK;
|
|
2080
|
+
return mask;
|
|
2081
|
+
}
|
|
2082
|
+
function getTransactionConfigValues(config) {
|
|
2083
|
+
const values = [];
|
|
2084
|
+
if (config.priorityFeeLamports !== void 0) values.push({
|
|
2085
|
+
kind: "u64",
|
|
2086
|
+
value: config.priorityFeeLamports
|
|
2087
|
+
});
|
|
2088
|
+
if (config.computeUnitLimit !== void 0) values.push({
|
|
2089
|
+
kind: "u32",
|
|
2090
|
+
value: config.computeUnitLimit
|
|
2091
|
+
});
|
|
2092
|
+
if (config.loadedAccountsDataSizeLimit !== void 0) values.push({
|
|
2093
|
+
kind: "u32",
|
|
2094
|
+
value: config.loadedAccountsDataSizeLimit
|
|
2095
|
+
});
|
|
2096
|
+
if (config.heapSize !== void 0) values.push({
|
|
2097
|
+
kind: "u32",
|
|
2098
|
+
value: config.heapSize
|
|
2099
|
+
});
|
|
2100
|
+
return values;
|
|
2101
|
+
}
|
|
2102
|
+
function getInstructionHeader(instruction, accountIndex) {
|
|
2103
|
+
return {
|
|
2104
|
+
numInstructionAccounts: instruction.accounts?.length ?? 0,
|
|
2105
|
+
numInstructionDataBytes: instruction.data?.byteLength ?? 0,
|
|
2106
|
+
programAccountIndex: accountIndex[instruction.programAddress]
|
|
2107
|
+
};
|
|
2108
|
+
}
|
|
2109
|
+
function getInstructionPayload(instruction, accountIndex) {
|
|
2110
|
+
return {
|
|
2111
|
+
instructionAccountIndices: instruction.accounts?.map(({ address }) => accountIndex[address]) ?? [],
|
|
2112
|
+
instructionData: instruction.data ?? new Uint8Array()
|
|
2113
|
+
};
|
|
2114
|
+
}
|
|
2115
|
+
function compileTransactionMessage3(transactionMessage) {
|
|
2116
|
+
const orderedAccounts = getOrderedAccountsFromAddressMap(getAddressMapFromInstructions(transactionMessage.feePayer.address, transactionMessage.instructions));
|
|
2117
|
+
const accountIndex = getAccountIndex(orderedAccounts);
|
|
2118
|
+
const lifetimeConstraint = transactionMessage.lifetimeConstraint;
|
|
2119
|
+
return {
|
|
2120
|
+
version: 1,
|
|
2121
|
+
...lifetimeConstraint ? { lifetimeToken: getCompiledLifetimeToken(lifetimeConstraint) } : null,
|
|
2122
|
+
configMask: getTransactionConfigMask(transactionMessage.config ?? {}),
|
|
2123
|
+
configValues: getTransactionConfigValues(transactionMessage.config ?? {}),
|
|
2124
|
+
header: getCompiledMessageHeader(orderedAccounts),
|
|
2125
|
+
instructionHeaders: transactionMessage.instructions.map((instruction) => getInstructionHeader(instruction, accountIndex)),
|
|
2126
|
+
instructionPayloads: transactionMessage.instructions.map((instruction) => getInstructionPayload(instruction, accountIndex)),
|
|
2127
|
+
numInstructions: transactionMessage.instructions.length,
|
|
2128
|
+
numStaticAccounts: orderedAccounts.length,
|
|
2129
|
+
staticAccounts: orderedAccounts.map((account) => account.address)
|
|
2130
|
+
};
|
|
2131
|
+
}
|
|
2132
|
+
function compileTransactionMessage4(transactionMessage) {
|
|
2133
|
+
const version = transactionMessage.version;
|
|
2134
|
+
if (version === "legacy") return compileTransactionMessage(transactionMessage);
|
|
2135
|
+
else if (version === 0) return compileTransactionMessage2(transactionMessage);
|
|
2136
|
+
else if (version === 1) return compileTransactionMessage3(transactionMessage);
|
|
2137
|
+
else throw new SolanaError(SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_NOT_SUPPORTED, { version });
|
|
2138
|
+
}
|
|
2139
|
+
var COMPUTE_BUDGET_PROGRAM_ADDRESS = "ComputeBudget111111111111111111111111111111";
|
|
2140
|
+
var SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR = 2;
|
|
2141
|
+
var SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR = 3;
|
|
2142
|
+
function getComputeBudgetInstruction(discriminator, value) {
|
|
2143
|
+
const data = getStructEncoder([["discriminator", getU8Encoder()], ["value", getBytesEncoder()]]).encode({
|
|
2144
|
+
discriminator,
|
|
2145
|
+
value
|
|
2146
|
+
});
|
|
2147
|
+
return Object.freeze({
|
|
2148
|
+
data,
|
|
2149
|
+
programAddress: COMPUTE_BUDGET_PROGRAM_ADDRESS
|
|
2150
|
+
});
|
|
2151
|
+
}
|
|
2152
|
+
function isComputeBudgetInstruction(instruction, discriminator, expectedDataLength) {
|
|
2153
|
+
return instruction.programAddress === COMPUTE_BUDGET_PROGRAM_ADDRESS && "data" in instruction && instruction.data != null && instruction.data.byteLength === expectedDataLength && instruction.data[0] === discriminator;
|
|
2154
|
+
}
|
|
2155
|
+
function getSetComputeUnitLimitInstruction(units) {
|
|
2156
|
+
return getComputeBudgetInstruction(SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR, getU32Encoder().encode(units));
|
|
2157
|
+
}
|
|
2158
|
+
function isSetComputeUnitLimitInstruction(instruction) {
|
|
2159
|
+
return isComputeBudgetInstruction(instruction, SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR, 5);
|
|
2160
|
+
}
|
|
2161
|
+
function getComputeUnitLimitFromInstructionData(data) {
|
|
2162
|
+
return getU32Decoder().decode(data, 1);
|
|
2163
|
+
}
|
|
2164
|
+
function getSetComputeUnitPriceInstruction(microLamports) {
|
|
2165
|
+
return getComputeBudgetInstruction(SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR, getU64Encoder().encode(microLamports));
|
|
2166
|
+
}
|
|
2167
|
+
function isSetComputeUnitPriceInstruction(instruction) {
|
|
2168
|
+
return isComputeBudgetInstruction(instruction, SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR, 9);
|
|
2169
|
+
}
|
|
2170
|
+
function getPriorityFeeFromInstructionData(data) {
|
|
2171
|
+
return getU64Decoder().decode(data, 1);
|
|
2172
|
+
}
|
|
2173
|
+
function replaceTransactionMessageInstruction(index, newInstruction, transactionMessage) {
|
|
2174
|
+
const nextInstructions = [...transactionMessage.instructions];
|
|
2175
|
+
nextInstructions[index] = newInstruction;
|
|
2176
|
+
return Object.freeze({
|
|
2177
|
+
...transactionMessage,
|
|
2178
|
+
instructions: Object.freeze(nextInstructions)
|
|
2179
|
+
});
|
|
2180
|
+
}
|
|
2181
|
+
function removeTransactionMessageInstruction(index, transactionMessage) {
|
|
2182
|
+
return Object.freeze({
|
|
2183
|
+
...transactionMessage,
|
|
2184
|
+
instructions: Object.freeze([...transactionMessage.instructions.slice(0, index), ...transactionMessage.instructions.slice(index + 1)])
|
|
2185
|
+
});
|
|
2186
|
+
}
|
|
2187
|
+
function appendTransactionMessageInstruction(instruction, transactionMessage) {
|
|
2188
|
+
return appendTransactionMessageInstructions([instruction], transactionMessage);
|
|
2189
|
+
}
|
|
2190
|
+
function appendTransactionMessageInstructions(instructions, transactionMessage) {
|
|
2191
|
+
return Object.freeze({
|
|
2192
|
+
...transactionMessage,
|
|
2193
|
+
instructions: Object.freeze([...transactionMessage.instructions, ...instructions])
|
|
2194
|
+
});
|
|
2195
|
+
}
|
|
2196
|
+
function getTransactionMessageComputeUnitLimit(transactionMessage) {
|
|
2197
|
+
switch (transactionMessage.version) {
|
|
2198
|
+
case 1: return transactionMessage.config?.computeUnitLimit;
|
|
2199
|
+
default: return getTransactionMessageComputeUnitLimitUsingInstruction(transactionMessage);
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2202
|
+
function getTransactionMessageComputeUnitLimitUsingInstruction(transactionMessage) {
|
|
2203
|
+
const existingInstruction = transactionMessage.instructions.find(isSetComputeUnitLimitInstruction);
|
|
2204
|
+
return existingInstruction ? getComputeUnitLimitFromInstructionData(existingInstruction.data) : void 0;
|
|
2205
|
+
}
|
|
2206
|
+
function setTransactionMessageComputeUnitLimit(computeUnitLimit, transactionMessage) {
|
|
2207
|
+
switch (transactionMessage.version) {
|
|
2208
|
+
case 1: return setTransactionMessageComputeUnitLimitUsingConfig(computeUnitLimit, transactionMessage);
|
|
2209
|
+
default: return setTransactionMessageComputeUnitLimitUsingInstruction(computeUnitLimit, transactionMessage);
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
function setTransactionMessageComputeUnitLimitUsingConfig(computeUnitLimit, transactionMessage) {
|
|
2213
|
+
const mergedConfig = {
|
|
2214
|
+
...transactionMessage.config ?? {},
|
|
2215
|
+
computeUnitLimit
|
|
2216
|
+
};
|
|
2217
|
+
const nextConfig = isV1ConfigEmpty(mergedConfig) ? void 0 : Object.freeze(mergedConfig);
|
|
2218
|
+
if (nextConfig === void 0) {
|
|
2219
|
+
const { config, ...rest } = transactionMessage;
|
|
2220
|
+
return Object.freeze(rest);
|
|
2221
|
+
}
|
|
2222
|
+
if (transactionMessage.config && areV1ConfigsEqual(transactionMessage.config, nextConfig)) return transactionMessage;
|
|
2223
|
+
return Object.freeze({
|
|
2224
|
+
...transactionMessage,
|
|
2225
|
+
config: nextConfig
|
|
2226
|
+
});
|
|
2227
|
+
}
|
|
2228
|
+
function setTransactionMessageComputeUnitLimitUsingInstruction(computeUnitLimit, transactionMessage) {
|
|
2229
|
+
const existingIndex = transactionMessage.instructions.findIndex(isSetComputeUnitLimitInstruction);
|
|
2230
|
+
if (computeUnitLimit === void 0) return existingIndex === -1 ? transactionMessage : removeTransactionMessageInstruction(existingIndex, transactionMessage);
|
|
2231
|
+
if (getTransactionMessageComputeUnitLimit(transactionMessage) === computeUnitLimit) return transactionMessage;
|
|
2232
|
+
const newInstruction = getSetComputeUnitLimitInstruction(computeUnitLimit);
|
|
2233
|
+
return existingIndex === -1 ? appendTransactionMessageInstruction(newInstruction, transactionMessage) : replaceTransactionMessageInstruction(existingIndex, newInstruction, transactionMessage);
|
|
2234
|
+
}
|
|
2235
|
+
function getTransactionMessageComputeUnitPrice(transactionMessage) {
|
|
2236
|
+
const existingInstruction = transactionMessage.instructions.find(isSetComputeUnitPriceInstruction);
|
|
2237
|
+
return existingInstruction ? getPriorityFeeFromInstructionData(existingInstruction.data) : void 0;
|
|
2238
|
+
}
|
|
2239
|
+
function setTransactionMessageComputeUnitPrice(computeUnitPrice, transactionMessage) {
|
|
2240
|
+
const existingIndex = transactionMessage.instructions.findIndex(isSetComputeUnitPriceInstruction);
|
|
2241
|
+
if (computeUnitPrice === void 0) return existingIndex === -1 ? transactionMessage : removeTransactionMessageInstruction(existingIndex, transactionMessage);
|
|
2242
|
+
if (getTransactionMessageComputeUnitPrice(transactionMessage) === computeUnitPrice) return transactionMessage;
|
|
2243
|
+
const newInstruction = getSetComputeUnitPriceInstruction(computeUnitPrice);
|
|
2244
|
+
return existingIndex === -1 ? appendTransactionMessageInstruction(newInstruction, transactionMessage) : replaceTransactionMessageInstruction(existingIndex, newInstruction, transactionMessage);
|
|
2245
|
+
}
|
|
2246
|
+
function createTransactionMessage(config) {
|
|
2247
|
+
return Object.freeze({
|
|
2248
|
+
instructions: Object.freeze([]),
|
|
2249
|
+
version: config.version
|
|
2250
|
+
});
|
|
2251
|
+
}
|
|
2252
|
+
function setTransactionMessageFeePayer(feePayer, transactionMessage) {
|
|
2253
|
+
if ("feePayer" in transactionMessage && feePayer === transactionMessage.feePayer?.address && isAddressOnlyFeePayer(transactionMessage.feePayer)) return transactionMessage;
|
|
2254
|
+
const out = {
|
|
2255
|
+
...transactionMessage,
|
|
2256
|
+
feePayer: Object.freeze({ address: feePayer })
|
|
2257
|
+
};
|
|
2258
|
+
Object.freeze(out);
|
|
2259
|
+
return out;
|
|
2260
|
+
}
|
|
2261
|
+
function isAddressOnlyFeePayer(feePayer) {
|
|
2262
|
+
return !!feePayer && "address" in feePayer && typeof feePayer.address === "string" && Object.keys(feePayer).length === 1;
|
|
2263
|
+
}
|
|
2264
|
+
var RECENT_BLOCKHASHES_SYSVAR_ADDRESS = "SysvarRecentB1ockHashes11111111111111111111";
|
|
2265
|
+
var SYSTEM_PROGRAM_ADDRESS = "11111111111111111111111111111111";
|
|
2266
|
+
function isAdvanceNonceAccountInstruction(instruction) {
|
|
2267
|
+
return instruction.programAddress === SYSTEM_PROGRAM_ADDRESS && instruction.data != null && isAdvanceNonceAccountInstructionData(instruction.data) && instruction.accounts?.length === 3 && instruction.accounts[0].address != null && instruction.accounts[0].role === AccountRole.WRITABLE && instruction.accounts[1].address === RECENT_BLOCKHASHES_SYSVAR_ADDRESS && instruction.accounts[1].role === AccountRole.READONLY && instruction.accounts[2].address != null && isSignerRole(instruction.accounts[2].role);
|
|
2268
|
+
}
|
|
2269
|
+
function isAdvanceNonceAccountInstructionData(data) {
|
|
2270
|
+
return data.byteLength === 4 && data[0] === 4 && data[1] === 0 && data[2] === 0 && data[3] === 0;
|
|
2271
|
+
}
|
|
2272
|
+
function isTransactionMessageWithDurableNonceLifetime(transactionMessage) {
|
|
2273
|
+
return "lifetimeConstraint" in transactionMessage && typeof transactionMessage.lifetimeConstraint.nonce === "string" && transactionMessage.instructions[0] != null && isAdvanceNonceAccountInstruction(transactionMessage.instructions[0]);
|
|
2274
|
+
}
|
|
2275
|
+
//#endregion
|
|
2276
|
+
//#region node_modules/.pnpm/@solana+keys@6.5.0_typescript@5.9.3/node_modules/@solana/keys/dist/index.node.mjs
|
|
2277
|
+
var ED25519_ALGORITHM_IDENTIFIER = Object.freeze({ name: "Ed25519" });
|
|
2278
|
+
function addPkcs8Header(bytes) {
|
|
2279
|
+
return new Uint8Array([
|
|
2280
|
+
48,
|
|
2281
|
+
46,
|
|
2282
|
+
2,
|
|
2283
|
+
1,
|
|
2284
|
+
0,
|
|
2285
|
+
48,
|
|
2286
|
+
5,
|
|
2287
|
+
6,
|
|
2288
|
+
3,
|
|
2289
|
+
43,
|
|
2290
|
+
101,
|
|
2291
|
+
112,
|
|
2292
|
+
4,
|
|
2293
|
+
34,
|
|
2294
|
+
4,
|
|
2295
|
+
32,
|
|
2296
|
+
...bytes
|
|
2297
|
+
]);
|
|
2298
|
+
}
|
|
2299
|
+
async function createPrivateKeyFromBytes(bytes, extractable = false) {
|
|
2300
|
+
const actualLength = bytes.byteLength;
|
|
2301
|
+
if (actualLength !== 32) throw new SolanaError(SOLANA_ERROR__KEYS__INVALID_PRIVATE_KEY_BYTE_LENGTH, { actualLength });
|
|
2302
|
+
const privateKeyBytesPkcs8 = addPkcs8Header(bytes);
|
|
2303
|
+
return await crypto.subtle.importKey("pkcs8", privateKeyBytesPkcs8, ED25519_ALGORITHM_IDENTIFIER, extractable, ["sign"]);
|
|
2304
|
+
}
|
|
2305
|
+
async function signBytes(key, data) {
|
|
2306
|
+
assertSigningCapabilityIsAvailable();
|
|
2307
|
+
const signedData = await crypto.subtle.sign(ED25519_ALGORITHM_IDENTIFIER, key, toArrayBuffer(data));
|
|
2308
|
+
return new Uint8Array(signedData);
|
|
2309
|
+
}
|
|
2310
|
+
async function verifySignature(key, signature2, data) {
|
|
2311
|
+
assertVerificationCapabilityIsAvailable();
|
|
2312
|
+
return await crypto.subtle.verify(ED25519_ALGORITHM_IDENTIFIER, key, toArrayBuffer(signature2), toArrayBuffer(data));
|
|
2313
|
+
}
|
|
2314
|
+
async function createKeyPairFromBytes(bytes, extractable = false) {
|
|
2315
|
+
assertPRNGIsAvailable();
|
|
2316
|
+
if (bytes.byteLength !== 64) throw new SolanaError(SOLANA_ERROR__KEYS__INVALID_KEY_PAIR_BYTE_LENGTH, { byteLength: bytes.byteLength });
|
|
2317
|
+
const [publicKey, privateKey] = await Promise.all([crypto.subtle.importKey("raw", bytes.slice(32), ED25519_ALGORITHM_IDENTIFIER, true, ["verify"]), createPrivateKeyFromBytes(bytes.slice(0, 32), extractable)]);
|
|
2318
|
+
const randomBytes = new Uint8Array(32);
|
|
2319
|
+
crypto.getRandomValues(randomBytes);
|
|
2320
|
+
if (!await verifySignature(publicKey, await signBytes(privateKey, randomBytes), randomBytes)) throw new SolanaError(SOLANA_ERROR__KEYS__PUBLIC_KEY_MUST_MATCH_PRIVATE_KEY);
|
|
2321
|
+
return {
|
|
2322
|
+
privateKey,
|
|
2323
|
+
publicKey
|
|
2324
|
+
};
|
|
2325
|
+
}
|
|
2326
|
+
//#endregion
|
|
2327
|
+
//#region node_modules/.pnpm/@solana+transactions@6.5.0_typescript@5.9.3/node_modules/@solana/transactions/dist/index.node.mjs
|
|
2328
|
+
function getSignaturesToEncode(signaturesMap) {
|
|
2329
|
+
const signatures = Object.values(signaturesMap);
|
|
2330
|
+
if (signatures.length === 0) throw new SolanaError(SOLANA_ERROR__TRANSACTION__CANNOT_ENCODE_WITH_EMPTY_SIGNATURES);
|
|
2331
|
+
return signatures.map((signature) => {
|
|
2332
|
+
if (!signature) return new Uint8Array(64).fill(0);
|
|
2333
|
+
return signature;
|
|
2334
|
+
});
|
|
2335
|
+
}
|
|
2336
|
+
function getSignaturesEncoderWithSizePrefix() {
|
|
2337
|
+
return transformEncoder(getArrayEncoder(fixEncoderSize(getBytesEncoder(), 64), { size: getShortU16Encoder() }), getSignaturesToEncode);
|
|
2338
|
+
}
|
|
2339
|
+
function getSignaturesEncoderWithLength(size) {
|
|
2340
|
+
return transformEncoder(getArrayEncoder(fixEncoderSize(getBytesEncoder(), 64), {
|
|
2341
|
+
description: "signatures",
|
|
2342
|
+
size
|
|
2343
|
+
}), getSignaturesToEncode);
|
|
2344
|
+
}
|
|
2345
|
+
function getEnvelopeShapeFromMessageBytes(messageBytes) {
|
|
2346
|
+
if (messageBytes.length === 0) throw new SolanaError(SOLANA_ERROR__TRANSACTION__CANNOT_ENCODE_WITH_EMPTY_MESSAGE_BYTES);
|
|
2347
|
+
return getTransactionVersionDecoder().decode(messageBytes) === 1 ? "messageFirst" : "signaturesFirst";
|
|
2348
|
+
}
|
|
2349
|
+
function getTransactionEncoder() {
|
|
2350
|
+
return getPredicateEncoder((transaction) => getEnvelopeShapeFromMessageBytes(transaction.messageBytes) === "signaturesFirst", getTransactionEncoderWithSignaturesFirst(), getTransactionEncoderWithMessageFirst());
|
|
2351
|
+
}
|
|
2352
|
+
function getTransactionEncoderWithSignaturesFirst() {
|
|
2353
|
+
return getStructEncoder([["signatures", getSignaturesEncoderWithSizePrefix()], ["messageBytes", getBytesEncoder()]]);
|
|
2354
|
+
}
|
|
2355
|
+
function getSignatureCountForVersionedOrThrow(messageBytes, offset) {
|
|
2356
|
+
if (messageBytes.length < offset + 2) throw new SolanaError(SOLANA_ERROR__TRANSACTION__MALFORMED_MESSAGE_BYTES, { messageBytes });
|
|
2357
|
+
return messageBytes[offset + 1];
|
|
2358
|
+
}
|
|
2359
|
+
function getTransactionEncoderWithMessageFirst() {
|
|
2360
|
+
const bytesEncoder = getBytesEncoder();
|
|
2361
|
+
return createEncoder({
|
|
2362
|
+
getSizeFromValue: (transaction) => {
|
|
2363
|
+
const signatureCount = getSignatureCountForVersionedOrThrow(transaction.messageBytes, 0);
|
|
2364
|
+
return transaction.messageBytes.length + signatureCount * 64;
|
|
2365
|
+
},
|
|
2366
|
+
write: (transaction, bytes, offset) => {
|
|
2367
|
+
offset = bytesEncoder.write(transaction.messageBytes, bytes, offset);
|
|
2368
|
+
offset = getSignaturesEncoderWithLength(getSignatureCountForVersionedOrThrow(transaction.messageBytes, 0)).write(transaction.signatures, bytes, offset);
|
|
2369
|
+
return offset;
|
|
2370
|
+
}
|
|
2371
|
+
});
|
|
2372
|
+
}
|
|
2373
|
+
function compileTransaction(transactionMessage) {
|
|
2374
|
+
const compiledMessage = compileTransactionMessage4(transactionMessage);
|
|
2375
|
+
const messageBytes = getCompiledTransactionMessageEncoder().encode(compiledMessage);
|
|
2376
|
+
const transactionSigners = compiledMessage.staticAccounts.slice(0, compiledMessage.header.numSignerAccounts);
|
|
2377
|
+
const signatures = {};
|
|
2378
|
+
for (const signerAddress of transactionSigners) signatures[signerAddress] = null;
|
|
2379
|
+
let lifetimeConstraint;
|
|
2380
|
+
if (isTransactionMessageWithBlockhashLifetime(transactionMessage)) lifetimeConstraint = {
|
|
2381
|
+
blockhash: transactionMessage.lifetimeConstraint.blockhash,
|
|
2382
|
+
lastValidBlockHeight: transactionMessage.lifetimeConstraint.lastValidBlockHeight
|
|
2383
|
+
};
|
|
2384
|
+
else if (isTransactionMessageWithDurableNonceLifetime(transactionMessage)) lifetimeConstraint = {
|
|
2385
|
+
nonce: transactionMessage.lifetimeConstraint.nonce,
|
|
2386
|
+
nonceAccountAddress: transactionMessage.instructions[0].accounts[0].address
|
|
2387
|
+
};
|
|
2388
|
+
return Object.freeze({
|
|
2389
|
+
...lifetimeConstraint ? { lifetimeConstraint } : void 0,
|
|
2390
|
+
messageBytes,
|
|
2391
|
+
signatures: Object.freeze(signatures)
|
|
2392
|
+
});
|
|
2393
|
+
}
|
|
2394
|
+
async function partiallySignTransaction(keyPairs, transaction) {
|
|
2395
|
+
let newSignatures;
|
|
2396
|
+
let unexpectedSigners;
|
|
2397
|
+
await Promise.all(keyPairs.map(async (keyPair) => {
|
|
2398
|
+
const address = await getAddressFromPublicKey(keyPair.publicKey);
|
|
2399
|
+
const existingSignature = transaction.signatures[address];
|
|
2400
|
+
if (existingSignature === void 0) {
|
|
2401
|
+
unexpectedSigners ||= /* @__PURE__ */ new Set();
|
|
2402
|
+
unexpectedSigners.add(address);
|
|
2403
|
+
return;
|
|
2404
|
+
}
|
|
2405
|
+
if (unexpectedSigners) return;
|
|
2406
|
+
const newSignature = await signBytes(keyPair.privateKey, transaction.messageBytes);
|
|
2407
|
+
if (existingSignature !== null && bytesEqual(newSignature, existingSignature)) return;
|
|
2408
|
+
newSignatures ||= {};
|
|
2409
|
+
newSignatures[address] = newSignature;
|
|
2410
|
+
}));
|
|
2411
|
+
if (unexpectedSigners && unexpectedSigners.size > 0) throw new SolanaError(SOLANA_ERROR__TRANSACTION__ADDRESSES_CANNOT_SIGN_TRANSACTION, {
|
|
2412
|
+
expectedAddresses: Object.keys(transaction.signatures),
|
|
2413
|
+
unexpectedAddresses: [...unexpectedSigners]
|
|
2414
|
+
});
|
|
2415
|
+
if (!newSignatures) return transaction;
|
|
2416
|
+
return Object.freeze({
|
|
2417
|
+
...transaction,
|
|
2418
|
+
signatures: Object.freeze({
|
|
2419
|
+
...transaction.signatures,
|
|
2420
|
+
...newSignatures
|
|
2421
|
+
})
|
|
2422
|
+
});
|
|
2423
|
+
}
|
|
2424
|
+
function getBase64EncodedWireTransaction(transaction) {
|
|
2425
|
+
const wireTransactionBytes = getTransactionEncoder().encode(transaction);
|
|
2426
|
+
return getBase64Decoder().decode(wireTransactionBytes);
|
|
2427
|
+
}
|
|
2428
|
+
var TRANSACTION_PACKET_SIZE = 1280;
|
|
2429
|
+
TRANSACTION_PACKET_SIZE - 48;
|
|
2430
|
+
//#endregion
|
|
2431
|
+
//#region node_modules/.pnpm/@solana+rpc-spec-types@6.5.0_typescript@5.9.3/node_modules/@solana/rpc-spec-types/dist/index.node.mjs
|
|
2432
|
+
function parseJsonWithBigInts(json) {
|
|
2433
|
+
return JSON.parse(wrapIntegersInBigIntValueObject(json), (_, value) => {
|
|
2434
|
+
return isBigIntValueObject(value) ? unwrapBigIntValueObject(value) : value;
|
|
2435
|
+
});
|
|
2436
|
+
}
|
|
2437
|
+
function wrapIntegersInBigIntValueObject(json) {
|
|
2438
|
+
const out = [];
|
|
2439
|
+
let inQuote = false;
|
|
2440
|
+
for (let ii = 0; ii < json.length; ii++) {
|
|
2441
|
+
let isEscaped = false;
|
|
2442
|
+
if (json[ii] === "\\") {
|
|
2443
|
+
out.push(json[ii++]);
|
|
2444
|
+
isEscaped = !isEscaped;
|
|
2445
|
+
}
|
|
2446
|
+
if (json[ii] === "\"") {
|
|
2447
|
+
out.push(json[ii]);
|
|
2448
|
+
if (!isEscaped) inQuote = !inQuote;
|
|
2449
|
+
continue;
|
|
2450
|
+
}
|
|
2451
|
+
if (!inQuote) {
|
|
2452
|
+
const consumedNumber = consumeNumber(json, ii);
|
|
2453
|
+
if (consumedNumber?.length) {
|
|
2454
|
+
ii += consumedNumber.length - 1;
|
|
2455
|
+
if (consumedNumber.match(/\.|[eE]-/)) out.push(consumedNumber);
|
|
2456
|
+
else out.push(wrapBigIntValueObject(consumedNumber));
|
|
2457
|
+
continue;
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
out.push(json[ii]);
|
|
2461
|
+
}
|
|
2462
|
+
return out.join("");
|
|
2463
|
+
}
|
|
2464
|
+
function consumeNumber(json, ii) {
|
|
2465
|
+
const JSON_NUMBER_REGEX = /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/;
|
|
2466
|
+
if (!json[ii]?.match(/[-\d]/)) return null;
|
|
2467
|
+
const numberMatch = json.slice(ii).match(JSON_NUMBER_REGEX);
|
|
2468
|
+
return numberMatch ? numberMatch[0] : null;
|
|
2469
|
+
}
|
|
2470
|
+
function wrapBigIntValueObject(value) {
|
|
2471
|
+
return `{"$n":"${value}"}`;
|
|
2472
|
+
}
|
|
2473
|
+
function unwrapBigIntValueObject({ $n }) {
|
|
2474
|
+
if ($n.match(/[eE]/)) {
|
|
2475
|
+
const [units, exponent] = $n.split(/[eE]/);
|
|
2476
|
+
return BigInt(units) * BigInt(10) ** BigInt(exponent);
|
|
2477
|
+
}
|
|
2478
|
+
return BigInt($n);
|
|
2479
|
+
}
|
|
2480
|
+
function isBigIntValueObject(value) {
|
|
2481
|
+
return !!value && typeof value === "object" && "$n" in value && typeof value.$n === "string";
|
|
2482
|
+
}
|
|
2483
|
+
var _nextMessageId = 0n;
|
|
2484
|
+
function getNextMessageId() {
|
|
2485
|
+
const id = _nextMessageId;
|
|
2486
|
+
_nextMessageId++;
|
|
2487
|
+
return id.toString();
|
|
2488
|
+
}
|
|
2489
|
+
function createRpcMessage(request) {
|
|
2490
|
+
return {
|
|
2491
|
+
id: getNextMessageId(),
|
|
2492
|
+
jsonrpc: "2.0",
|
|
2493
|
+
method: request.methodName,
|
|
2494
|
+
params: request.params
|
|
2495
|
+
};
|
|
2496
|
+
}
|
|
2497
|
+
function stringifyJsonWithBigInts(value, space) {
|
|
2498
|
+
return unwrapBigIntValueObject2(JSON.stringify(value, (_, v) => typeof v === "bigint" ? wrapBigIntValueObject2(v) : v, space));
|
|
2499
|
+
}
|
|
2500
|
+
function wrapBigIntValueObject2(value) {
|
|
2501
|
+
return { $n: `${value}` };
|
|
2502
|
+
}
|
|
2503
|
+
function unwrapBigIntValueObject2(value) {
|
|
2504
|
+
return value.replace(/\{\s*"\$n"\s*:\s*"(-?\d+)"\s*\}/g, "$1");
|
|
2505
|
+
}
|
|
2506
|
+
//#endregion
|
|
2507
|
+
//#region node_modules/.pnpm/@solana+rpc-spec@6.5.0_typescript@5.9.3/node_modules/@solana/rpc-spec/dist/index.node.mjs
|
|
2508
|
+
function createRpc(rpcConfig) {
|
|
2509
|
+
return makeProxy(rpcConfig);
|
|
2510
|
+
}
|
|
2511
|
+
function makeProxy(rpcConfig) {
|
|
2512
|
+
return new Proxy(rpcConfig.api, {
|
|
2513
|
+
defineProperty() {
|
|
2514
|
+
return false;
|
|
2515
|
+
},
|
|
2516
|
+
deleteProperty() {
|
|
2517
|
+
return false;
|
|
2518
|
+
},
|
|
2519
|
+
get(target, p, receiver) {
|
|
2520
|
+
if (p === "then") return;
|
|
2521
|
+
return function(...rawParams) {
|
|
2522
|
+
const methodName = p.toString();
|
|
2523
|
+
const getApiPlan = Reflect.get(target, methodName, receiver);
|
|
2524
|
+
if (!getApiPlan) throw new SolanaError(SOLANA_ERROR__RPC__API_PLAN_MISSING_FOR_RPC_METHOD, {
|
|
2525
|
+
method: methodName,
|
|
2526
|
+
params: rawParams
|
|
2527
|
+
});
|
|
2528
|
+
return createPendingRpcRequest(rpcConfig, getApiPlan(...rawParams));
|
|
2529
|
+
};
|
|
2530
|
+
}
|
|
2531
|
+
});
|
|
2532
|
+
}
|
|
2533
|
+
function createPendingRpcRequest({ transport }, plan) {
|
|
2534
|
+
return { async send(options) {
|
|
2535
|
+
return await plan.execute({
|
|
2536
|
+
signal: options?.abortSignal,
|
|
2537
|
+
transport
|
|
2538
|
+
});
|
|
2539
|
+
} };
|
|
2540
|
+
}
|
|
2541
|
+
function createJsonRpcApi(config) {
|
|
2542
|
+
return new Proxy({}, {
|
|
2543
|
+
defineProperty() {
|
|
2544
|
+
return false;
|
|
2545
|
+
},
|
|
2546
|
+
deleteProperty() {
|
|
2547
|
+
return false;
|
|
2548
|
+
},
|
|
2549
|
+
get(...args) {
|
|
2550
|
+
const [_, p] = args;
|
|
2551
|
+
const methodName = p.toString();
|
|
2552
|
+
return function(...rawParams) {
|
|
2553
|
+
const rawRequest = Object.freeze({
|
|
2554
|
+
methodName,
|
|
2555
|
+
params: rawParams
|
|
2556
|
+
});
|
|
2557
|
+
const request = config?.requestTransformer ? config?.requestTransformer(rawRequest) : rawRequest;
|
|
2558
|
+
return Object.freeze({ execute: async ({ signal, transport }) => {
|
|
2559
|
+
const response = await transport({
|
|
2560
|
+
payload: createRpcMessage(request),
|
|
2561
|
+
signal
|
|
2562
|
+
});
|
|
2563
|
+
if (!config?.responseTransformer) return response;
|
|
2564
|
+
return config.responseTransformer(response, request);
|
|
2565
|
+
} });
|
|
2566
|
+
};
|
|
2567
|
+
}
|
|
2568
|
+
});
|
|
2569
|
+
}
|
|
2570
|
+
function isJsonRpcPayload(payload) {
|
|
2571
|
+
if (payload == null || typeof payload !== "object" || Array.isArray(payload)) return false;
|
|
2572
|
+
return "jsonrpc" in payload && payload.jsonrpc === "2.0" && "method" in payload && typeof payload.method === "string" && "params" in payload;
|
|
2573
|
+
}
|
|
2574
|
+
//#endregion
|
|
2575
|
+
//#region node_modules/.pnpm/@solana+rpc-transformers@6.5.0_typescript@5.9.3/node_modules/@solana/rpc-transformers/dist/index.node.mjs
|
|
2576
|
+
function downcastNodeToNumberIfBigint(value) {
|
|
2577
|
+
return typeof value === "bigint" ? Number(value) : value;
|
|
2578
|
+
}
|
|
2579
|
+
var KEYPATH_WILDCARD = {};
|
|
2580
|
+
function getTreeWalker(visitors) {
|
|
2581
|
+
return function traverse(node, state) {
|
|
2582
|
+
if (Array.isArray(node)) return node.map((element, ii) => {
|
|
2583
|
+
return traverse(element, {
|
|
2584
|
+
...state,
|
|
2585
|
+
keyPath: [...state.keyPath, ii]
|
|
2586
|
+
});
|
|
2587
|
+
});
|
|
2588
|
+
else if (typeof node === "object" && node !== null) {
|
|
2589
|
+
const out = {};
|
|
2590
|
+
for (const propName in node) {
|
|
2591
|
+
if (!Object.prototype.hasOwnProperty.call(node, propName)) continue;
|
|
2592
|
+
const nextState = {
|
|
2593
|
+
...state,
|
|
2594
|
+
keyPath: [...state.keyPath, propName]
|
|
2595
|
+
};
|
|
2596
|
+
out[propName] = traverse(node[propName], nextState);
|
|
2597
|
+
}
|
|
2598
|
+
return out;
|
|
2599
|
+
} else return visitors.reduce((acc, visitNode) => visitNode(acc, state), node);
|
|
2600
|
+
};
|
|
2601
|
+
}
|
|
2602
|
+
function getTreeWalkerRequestTransformer(visitors, initialState) {
|
|
2603
|
+
return (request) => {
|
|
2604
|
+
const traverse = getTreeWalker(visitors);
|
|
2605
|
+
return Object.freeze({
|
|
2606
|
+
...request,
|
|
2607
|
+
params: traverse(request.params, initialState)
|
|
2608
|
+
});
|
|
2609
|
+
};
|
|
2610
|
+
}
|
|
2611
|
+
function getTreeWalkerResponseTransformer(visitors, initialState) {
|
|
2612
|
+
return (json) => getTreeWalker(visitors)(json, initialState);
|
|
2613
|
+
}
|
|
2614
|
+
function getBigIntDowncastRequestTransformer() {
|
|
2615
|
+
return getTreeWalkerRequestTransformer([downcastNodeToNumberIfBigint], { keyPath: [] });
|
|
2616
|
+
}
|
|
2617
|
+
function applyDefaultCommitment({ commitmentPropertyName, params, optionsObjectPositionInParams, overrideCommitment }) {
|
|
2618
|
+
const paramInTargetPosition = params[optionsObjectPositionInParams];
|
|
2619
|
+
if (paramInTargetPosition === void 0 || paramInTargetPosition && typeof paramInTargetPosition === "object" && !Array.isArray(paramInTargetPosition)) {
|
|
2620
|
+
if (paramInTargetPosition && commitmentPropertyName in paramInTargetPosition) {
|
|
2621
|
+
if (!paramInTargetPosition[commitmentPropertyName] || paramInTargetPosition[commitmentPropertyName] === "finalized") {
|
|
2622
|
+
const nextParams = [...params];
|
|
2623
|
+
const { [commitmentPropertyName]: _, ...rest } = paramInTargetPosition;
|
|
2624
|
+
if (Object.keys(rest).length > 0) nextParams[optionsObjectPositionInParams] = rest;
|
|
2625
|
+
else if (optionsObjectPositionInParams === nextParams.length - 1) nextParams.length--;
|
|
2626
|
+
else nextParams[optionsObjectPositionInParams] = void 0;
|
|
2627
|
+
return nextParams;
|
|
2628
|
+
}
|
|
2629
|
+
} else if (overrideCommitment !== "finalized") {
|
|
2630
|
+
const nextParams = [...params];
|
|
2631
|
+
nextParams[optionsObjectPositionInParams] = {
|
|
2632
|
+
...paramInTargetPosition,
|
|
2633
|
+
[commitmentPropertyName]: overrideCommitment
|
|
2634
|
+
};
|
|
2635
|
+
return nextParams;
|
|
2636
|
+
}
|
|
2637
|
+
}
|
|
2638
|
+
return params;
|
|
2639
|
+
}
|
|
2640
|
+
function getDefaultCommitmentRequestTransformer({ defaultCommitment, optionsObjectPositionByMethod }) {
|
|
2641
|
+
return (request) => {
|
|
2642
|
+
const { params, methodName } = request;
|
|
2643
|
+
if (!Array.isArray(params)) return request;
|
|
2644
|
+
const optionsObjectPositionInParams = optionsObjectPositionByMethod[methodName];
|
|
2645
|
+
if (optionsObjectPositionInParams == null) return request;
|
|
2646
|
+
return Object.freeze({
|
|
2647
|
+
methodName,
|
|
2648
|
+
params: applyDefaultCommitment({
|
|
2649
|
+
commitmentPropertyName: methodName === "sendTransaction" ? "preflightCommitment" : "commitment",
|
|
2650
|
+
optionsObjectPositionInParams,
|
|
2651
|
+
overrideCommitment: defaultCommitment,
|
|
2652
|
+
params
|
|
2653
|
+
})
|
|
2654
|
+
});
|
|
2655
|
+
};
|
|
2656
|
+
}
|
|
2657
|
+
function getIntegerOverflowNodeVisitor(onIntegerOverflow) {
|
|
2658
|
+
return (value, { keyPath }) => {
|
|
2659
|
+
if (typeof value === "bigint") {
|
|
2660
|
+
if (onIntegerOverflow && (value > Number.MAX_SAFE_INTEGER || value < -Number.MAX_SAFE_INTEGER)) onIntegerOverflow(keyPath, value);
|
|
2661
|
+
}
|
|
2662
|
+
return value;
|
|
2663
|
+
};
|
|
2664
|
+
}
|
|
2665
|
+
function getIntegerOverflowRequestTransformer(onIntegerOverflow) {
|
|
2666
|
+
return (request) => {
|
|
2667
|
+
return getTreeWalkerRequestTransformer([getIntegerOverflowNodeVisitor((...args) => onIntegerOverflow(request, ...args))], { keyPath: [] })(request);
|
|
2668
|
+
};
|
|
2669
|
+
}
|
|
2670
|
+
var OPTIONS_OBJECT_POSITION_BY_METHOD = {
|
|
2671
|
+
accountNotifications: 1,
|
|
2672
|
+
blockNotifications: 1,
|
|
2673
|
+
getAccountInfo: 1,
|
|
2674
|
+
getBalance: 1,
|
|
2675
|
+
getBlock: 1,
|
|
2676
|
+
getBlockHeight: 0,
|
|
2677
|
+
getBlockProduction: 0,
|
|
2678
|
+
getBlocks: 2,
|
|
2679
|
+
getBlocksWithLimit: 2,
|
|
2680
|
+
getEpochInfo: 0,
|
|
2681
|
+
getFeeForMessage: 1,
|
|
2682
|
+
getInflationGovernor: 0,
|
|
2683
|
+
getInflationReward: 1,
|
|
2684
|
+
getLargestAccounts: 0,
|
|
2685
|
+
getLatestBlockhash: 0,
|
|
2686
|
+
getLeaderSchedule: 1,
|
|
2687
|
+
getMinimumBalanceForRentExemption: 1,
|
|
2688
|
+
getMultipleAccounts: 1,
|
|
2689
|
+
getProgramAccounts: 1,
|
|
2690
|
+
getSignaturesForAddress: 1,
|
|
2691
|
+
getSlot: 0,
|
|
2692
|
+
getSlotLeader: 0,
|
|
2693
|
+
getStakeMinimumDelegation: 0,
|
|
2694
|
+
getSupply: 0,
|
|
2695
|
+
getTokenAccountBalance: 1,
|
|
2696
|
+
getTokenAccountsByDelegate: 2,
|
|
2697
|
+
getTokenAccountsByOwner: 2,
|
|
2698
|
+
getTokenLargestAccounts: 1,
|
|
2699
|
+
getTokenSupply: 1,
|
|
2700
|
+
getTransaction: 1,
|
|
2701
|
+
getTransactionCount: 0,
|
|
2702
|
+
getVoteAccounts: 0,
|
|
2703
|
+
isBlockhashValid: 1,
|
|
2704
|
+
logsNotifications: 1,
|
|
2705
|
+
programNotifications: 1,
|
|
2706
|
+
requestAirdrop: 2,
|
|
2707
|
+
sendTransaction: 1,
|
|
2708
|
+
signatureNotifications: 1,
|
|
2709
|
+
simulateTransaction: 1
|
|
2710
|
+
};
|
|
2711
|
+
function getDefaultRequestTransformerForSolanaRpc(config) {
|
|
2712
|
+
const handleIntegerOverflow = config?.onIntegerOverflow;
|
|
2713
|
+
return (request) => {
|
|
2714
|
+
return pipe(request, handleIntegerOverflow ? getIntegerOverflowRequestTransformer(handleIntegerOverflow) : (r) => r, getBigIntDowncastRequestTransformer(), getDefaultCommitmentRequestTransformer({
|
|
2715
|
+
defaultCommitment: config?.defaultCommitment,
|
|
2716
|
+
optionsObjectPositionByMethod: OPTIONS_OBJECT_POSITION_BY_METHOD
|
|
2717
|
+
}));
|
|
2718
|
+
};
|
|
2719
|
+
}
|
|
2720
|
+
function getBigIntUpcastVisitor(allowedNumericKeyPaths) {
|
|
2721
|
+
return function upcastNodeToBigIntIfNumber(value, { keyPath }) {
|
|
2722
|
+
if (!(typeof value === "number" && Number.isInteger(value) || typeof value === "bigint")) return value;
|
|
2723
|
+
if (keyPathIsAllowedToBeNumeric(keyPath, allowedNumericKeyPaths)) return Number(value);
|
|
2724
|
+
else return BigInt(value);
|
|
2725
|
+
};
|
|
2726
|
+
}
|
|
2727
|
+
function keyPathIsAllowedToBeNumeric(keyPath, allowedNumericKeyPaths) {
|
|
2728
|
+
return allowedNumericKeyPaths.some((prohibitedKeyPath) => {
|
|
2729
|
+
if (prohibitedKeyPath.length !== keyPath.length) return false;
|
|
2730
|
+
for (let ii = keyPath.length - 1; ii >= 0; ii--) {
|
|
2731
|
+
const keyPathPart = keyPath[ii];
|
|
2732
|
+
const prohibitedKeyPathPart = prohibitedKeyPath[ii];
|
|
2733
|
+
if (prohibitedKeyPathPart !== keyPathPart && (prohibitedKeyPathPart !== KEYPATH_WILDCARD || typeof keyPathPart !== "number")) return false;
|
|
2734
|
+
}
|
|
2735
|
+
return true;
|
|
2736
|
+
});
|
|
2737
|
+
}
|
|
2738
|
+
function getBigIntUpcastResponseTransformer(allowedNumericKeyPaths) {
|
|
2739
|
+
return getTreeWalkerResponseTransformer([getBigIntUpcastVisitor(allowedNumericKeyPaths)], { keyPath: [] });
|
|
2740
|
+
}
|
|
2741
|
+
function getResultResponseTransformer() {
|
|
2742
|
+
return (json) => json.result;
|
|
2743
|
+
}
|
|
2744
|
+
var jsonParsedTokenAccountsConfigs = [
|
|
2745
|
+
[
|
|
2746
|
+
"data",
|
|
2747
|
+
"parsed",
|
|
2748
|
+
"info",
|
|
2749
|
+
"tokenAmount",
|
|
2750
|
+
"decimals"
|
|
2751
|
+
],
|
|
2752
|
+
[
|
|
2753
|
+
"data",
|
|
2754
|
+
"parsed",
|
|
2755
|
+
"info",
|
|
2756
|
+
"tokenAmount",
|
|
2757
|
+
"uiAmount"
|
|
2758
|
+
],
|
|
2759
|
+
[
|
|
2760
|
+
"data",
|
|
2761
|
+
"parsed",
|
|
2762
|
+
"info",
|
|
2763
|
+
"rentExemptReserve",
|
|
2764
|
+
"decimals"
|
|
2765
|
+
],
|
|
2766
|
+
[
|
|
2767
|
+
"data",
|
|
2768
|
+
"parsed",
|
|
2769
|
+
"info",
|
|
2770
|
+
"rentExemptReserve",
|
|
2771
|
+
"uiAmount"
|
|
2772
|
+
],
|
|
2773
|
+
[
|
|
2774
|
+
"data",
|
|
2775
|
+
"parsed",
|
|
2776
|
+
"info",
|
|
2777
|
+
"delegatedAmount",
|
|
2778
|
+
"decimals"
|
|
2779
|
+
],
|
|
2780
|
+
[
|
|
2781
|
+
"data",
|
|
2782
|
+
"parsed",
|
|
2783
|
+
"info",
|
|
2784
|
+
"delegatedAmount",
|
|
2785
|
+
"uiAmount"
|
|
2786
|
+
],
|
|
2787
|
+
[
|
|
2788
|
+
"data",
|
|
2789
|
+
"parsed",
|
|
2790
|
+
"info",
|
|
2791
|
+
"extensions",
|
|
2792
|
+
KEYPATH_WILDCARD,
|
|
2793
|
+
"state",
|
|
2794
|
+
"olderTransferFee",
|
|
2795
|
+
"transferFeeBasisPoints"
|
|
2796
|
+
],
|
|
2797
|
+
[
|
|
2798
|
+
"data",
|
|
2799
|
+
"parsed",
|
|
2800
|
+
"info",
|
|
2801
|
+
"extensions",
|
|
2802
|
+
KEYPATH_WILDCARD,
|
|
2803
|
+
"state",
|
|
2804
|
+
"newerTransferFee",
|
|
2805
|
+
"transferFeeBasisPoints"
|
|
2806
|
+
],
|
|
2807
|
+
[
|
|
2808
|
+
"data",
|
|
2809
|
+
"parsed",
|
|
2810
|
+
"info",
|
|
2811
|
+
"extensions",
|
|
2812
|
+
KEYPATH_WILDCARD,
|
|
2813
|
+
"state",
|
|
2814
|
+
"preUpdateAverageRate"
|
|
2815
|
+
],
|
|
2816
|
+
[
|
|
2817
|
+
"data",
|
|
2818
|
+
"parsed",
|
|
2819
|
+
"info",
|
|
2820
|
+
"extensions",
|
|
2821
|
+
KEYPATH_WILDCARD,
|
|
2822
|
+
"state",
|
|
2823
|
+
"currentRate"
|
|
2824
|
+
]
|
|
2825
|
+
];
|
|
2826
|
+
var jsonParsedAccountsConfigs = [
|
|
2827
|
+
...jsonParsedTokenAccountsConfigs,
|
|
2828
|
+
[
|
|
2829
|
+
"data",
|
|
2830
|
+
"parsed",
|
|
2831
|
+
"info",
|
|
2832
|
+
"lastExtendedSlotStartIndex"
|
|
2833
|
+
],
|
|
2834
|
+
[
|
|
2835
|
+
"data",
|
|
2836
|
+
"parsed",
|
|
2837
|
+
"info",
|
|
2838
|
+
"slashPenalty"
|
|
2839
|
+
],
|
|
2840
|
+
[
|
|
2841
|
+
"data",
|
|
2842
|
+
"parsed",
|
|
2843
|
+
"info",
|
|
2844
|
+
"warmupCooldownRate"
|
|
2845
|
+
],
|
|
2846
|
+
[
|
|
2847
|
+
"data",
|
|
2848
|
+
"parsed",
|
|
2849
|
+
"info",
|
|
2850
|
+
"decimals"
|
|
2851
|
+
],
|
|
2852
|
+
[
|
|
2853
|
+
"data",
|
|
2854
|
+
"parsed",
|
|
2855
|
+
"info",
|
|
2856
|
+
"numRequiredSigners"
|
|
2857
|
+
],
|
|
2858
|
+
[
|
|
2859
|
+
"data",
|
|
2860
|
+
"parsed",
|
|
2861
|
+
"info",
|
|
2862
|
+
"numValidSigners"
|
|
2863
|
+
],
|
|
2864
|
+
[
|
|
2865
|
+
"data",
|
|
2866
|
+
"parsed",
|
|
2867
|
+
"info",
|
|
2868
|
+
"stake",
|
|
2869
|
+
"delegation",
|
|
2870
|
+
"warmupCooldownRate"
|
|
2871
|
+
],
|
|
2872
|
+
[
|
|
2873
|
+
"data",
|
|
2874
|
+
"parsed",
|
|
2875
|
+
"info",
|
|
2876
|
+
"exemptionThreshold"
|
|
2877
|
+
],
|
|
2878
|
+
[
|
|
2879
|
+
"data",
|
|
2880
|
+
"parsed",
|
|
2881
|
+
"info",
|
|
2882
|
+
"burnPercent"
|
|
2883
|
+
],
|
|
2884
|
+
[
|
|
2885
|
+
"data",
|
|
2886
|
+
"parsed",
|
|
2887
|
+
"info",
|
|
2888
|
+
"commission"
|
|
2889
|
+
],
|
|
2890
|
+
[
|
|
2891
|
+
"data",
|
|
2892
|
+
"parsed",
|
|
2893
|
+
"info",
|
|
2894
|
+
"votes",
|
|
2895
|
+
KEYPATH_WILDCARD,
|
|
2896
|
+
"confirmationCount"
|
|
2897
|
+
]
|
|
2898
|
+
];
|
|
2899
|
+
var innerInstructionsConfigs = [
|
|
2900
|
+
["index"],
|
|
2901
|
+
[
|
|
2902
|
+
"instructions",
|
|
2903
|
+
KEYPATH_WILDCARD,
|
|
2904
|
+
"accounts",
|
|
2905
|
+
KEYPATH_WILDCARD
|
|
2906
|
+
],
|
|
2907
|
+
[
|
|
2908
|
+
"instructions",
|
|
2909
|
+
KEYPATH_WILDCARD,
|
|
2910
|
+
"programIdIndex"
|
|
2911
|
+
],
|
|
2912
|
+
[
|
|
2913
|
+
"instructions",
|
|
2914
|
+
KEYPATH_WILDCARD,
|
|
2915
|
+
"stackHeight"
|
|
2916
|
+
]
|
|
2917
|
+
];
|
|
2918
|
+
var messageConfig = [
|
|
2919
|
+
[
|
|
2920
|
+
"addressTableLookups",
|
|
2921
|
+
KEYPATH_WILDCARD,
|
|
2922
|
+
"writableIndexes",
|
|
2923
|
+
KEYPATH_WILDCARD
|
|
2924
|
+
],
|
|
2925
|
+
[
|
|
2926
|
+
"addressTableLookups",
|
|
2927
|
+
KEYPATH_WILDCARD,
|
|
2928
|
+
"readonlyIndexes",
|
|
2929
|
+
KEYPATH_WILDCARD
|
|
2930
|
+
],
|
|
2931
|
+
["header", "numReadonlySignedAccounts"],
|
|
2932
|
+
["header", "numReadonlyUnsignedAccounts"],
|
|
2933
|
+
["header", "numRequiredSignatures"],
|
|
2934
|
+
[
|
|
2935
|
+
"instructions",
|
|
2936
|
+
KEYPATH_WILDCARD,
|
|
2937
|
+
"accounts",
|
|
2938
|
+
KEYPATH_WILDCARD
|
|
2939
|
+
],
|
|
2940
|
+
[
|
|
2941
|
+
"instructions",
|
|
2942
|
+
KEYPATH_WILDCARD,
|
|
2943
|
+
"programIdIndex"
|
|
2944
|
+
],
|
|
2945
|
+
[
|
|
2946
|
+
"instructions",
|
|
2947
|
+
KEYPATH_WILDCARD,
|
|
2948
|
+
"stackHeight"
|
|
2949
|
+
]
|
|
2950
|
+
];
|
|
2951
|
+
function getSimulateTransactionAllowedNumericKeypaths() {
|
|
2952
|
+
return [
|
|
2953
|
+
["loadedAccountsDataSize"],
|
|
2954
|
+
...jsonParsedAccountsConfigs.map((c) => [
|
|
2955
|
+
"accounts",
|
|
2956
|
+
KEYPATH_WILDCARD,
|
|
2957
|
+
...c
|
|
2958
|
+
]),
|
|
2959
|
+
...innerInstructionsConfigs.map((c) => [
|
|
2960
|
+
"innerInstructions",
|
|
2961
|
+
KEYPATH_WILDCARD,
|
|
2962
|
+
...c
|
|
2963
|
+
])
|
|
2964
|
+
];
|
|
2965
|
+
}
|
|
2966
|
+
function getThrowSolanaErrorResponseTransformer() {
|
|
2967
|
+
return (json, request) => {
|
|
2968
|
+
const jsonRpcResponse = json;
|
|
2969
|
+
if ("error" in jsonRpcResponse) {
|
|
2970
|
+
const { error } = jsonRpcResponse;
|
|
2971
|
+
if (error && typeof error === "object" && "code" in error && (error.code === -32002 || error.code === -32002n) && "data" in error && error.data) {
|
|
2972
|
+
const transformedData = getTreeWalkerResponseTransformer([getBigIntUpcastVisitor(getSimulateTransactionAllowedNumericKeypaths())], { keyPath: [] })(error.data, request);
|
|
2973
|
+
throw getSolanaErrorFromJsonRpcError({
|
|
2974
|
+
...error,
|
|
2975
|
+
data: transformedData
|
|
2976
|
+
});
|
|
2977
|
+
}
|
|
2978
|
+
throw getSolanaErrorFromJsonRpcError(jsonRpcResponse.error);
|
|
2979
|
+
}
|
|
2980
|
+
return jsonRpcResponse;
|
|
2981
|
+
};
|
|
2982
|
+
}
|
|
2983
|
+
function getDefaultResponseTransformerForSolanaRpc(config) {
|
|
2984
|
+
return (response, request) => {
|
|
2985
|
+
const methodName = request.methodName;
|
|
2986
|
+
const keyPaths = config?.allowedNumericKeyPaths && methodName ? config.allowedNumericKeyPaths[methodName] : void 0;
|
|
2987
|
+
return pipe(response, (r) => getThrowSolanaErrorResponseTransformer()(r, request), (r) => getResultResponseTransformer()(r, request), (r) => getBigIntUpcastResponseTransformer(keyPaths ?? [])(r, request));
|
|
2988
|
+
};
|
|
2989
|
+
}
|
|
2990
|
+
//#endregion
|
|
2991
|
+
//#region node_modules/.pnpm/@solana+rpc-api@6.5.0_typescript@5.9.3/node_modules/@solana/rpc-api/dist/index.node.mjs
|
|
2992
|
+
function createSolanaRpcApi(config) {
|
|
2993
|
+
return createJsonRpcApi({
|
|
2994
|
+
requestTransformer: getDefaultRequestTransformerForSolanaRpc(config),
|
|
2995
|
+
responseTransformer: getDefaultResponseTransformerForSolanaRpc({ allowedNumericKeyPaths: getAllowedNumericKeypaths() })
|
|
2996
|
+
});
|
|
2997
|
+
}
|
|
2998
|
+
var memoizedKeypaths;
|
|
2999
|
+
function getAllowedNumericKeypaths() {
|
|
3000
|
+
if (!memoizedKeypaths) memoizedKeypaths = {
|
|
3001
|
+
getAccountInfo: jsonParsedAccountsConfigs.map((c) => ["value", ...c]),
|
|
3002
|
+
getBlock: [
|
|
3003
|
+
[
|
|
3004
|
+
"transactions",
|
|
3005
|
+
KEYPATH_WILDCARD,
|
|
3006
|
+
"meta",
|
|
3007
|
+
"preTokenBalances",
|
|
3008
|
+
KEYPATH_WILDCARD,
|
|
3009
|
+
"accountIndex"
|
|
3010
|
+
],
|
|
3011
|
+
[
|
|
3012
|
+
"transactions",
|
|
3013
|
+
KEYPATH_WILDCARD,
|
|
3014
|
+
"meta",
|
|
3015
|
+
"preTokenBalances",
|
|
3016
|
+
KEYPATH_WILDCARD,
|
|
3017
|
+
"uiTokenAmount",
|
|
3018
|
+
"decimals"
|
|
3019
|
+
],
|
|
3020
|
+
[
|
|
3021
|
+
"transactions",
|
|
3022
|
+
KEYPATH_WILDCARD,
|
|
3023
|
+
"meta",
|
|
3024
|
+
"postTokenBalances",
|
|
3025
|
+
KEYPATH_WILDCARD,
|
|
3026
|
+
"accountIndex"
|
|
3027
|
+
],
|
|
3028
|
+
[
|
|
3029
|
+
"transactions",
|
|
3030
|
+
KEYPATH_WILDCARD,
|
|
3031
|
+
"meta",
|
|
3032
|
+
"postTokenBalances",
|
|
3033
|
+
KEYPATH_WILDCARD,
|
|
3034
|
+
"uiTokenAmount",
|
|
3035
|
+
"decimals"
|
|
3036
|
+
],
|
|
3037
|
+
[
|
|
3038
|
+
"transactions",
|
|
3039
|
+
KEYPATH_WILDCARD,
|
|
3040
|
+
"meta",
|
|
3041
|
+
"rewards",
|
|
3042
|
+
KEYPATH_WILDCARD,
|
|
3043
|
+
"commission"
|
|
3044
|
+
],
|
|
3045
|
+
...innerInstructionsConfigs.map((c) => [
|
|
3046
|
+
"transactions",
|
|
3047
|
+
KEYPATH_WILDCARD,
|
|
3048
|
+
"meta",
|
|
3049
|
+
"innerInstructions",
|
|
3050
|
+
KEYPATH_WILDCARD,
|
|
3051
|
+
...c
|
|
3052
|
+
]),
|
|
3053
|
+
...messageConfig.map((c) => [
|
|
3054
|
+
"transactions",
|
|
3055
|
+
KEYPATH_WILDCARD,
|
|
3056
|
+
"transaction",
|
|
3057
|
+
"message",
|
|
3058
|
+
...c
|
|
3059
|
+
]),
|
|
3060
|
+
[
|
|
3061
|
+
"rewards",
|
|
3062
|
+
KEYPATH_WILDCARD,
|
|
3063
|
+
"commission"
|
|
3064
|
+
]
|
|
3065
|
+
],
|
|
3066
|
+
getClusterNodes: [[KEYPATH_WILDCARD, "featureSet"], [KEYPATH_WILDCARD, "shredVersion"]],
|
|
3067
|
+
getInflationGovernor: [
|
|
3068
|
+
["initial"],
|
|
3069
|
+
["foundation"],
|
|
3070
|
+
["foundationTerm"],
|
|
3071
|
+
["taper"],
|
|
3072
|
+
["terminal"]
|
|
3073
|
+
],
|
|
3074
|
+
getInflationRate: [
|
|
3075
|
+
["foundation"],
|
|
3076
|
+
["total"],
|
|
3077
|
+
["validator"]
|
|
3078
|
+
],
|
|
3079
|
+
getInflationReward: [[KEYPATH_WILDCARD, "commission"]],
|
|
3080
|
+
getMultipleAccounts: jsonParsedAccountsConfigs.map((c) => [
|
|
3081
|
+
"value",
|
|
3082
|
+
KEYPATH_WILDCARD,
|
|
3083
|
+
...c
|
|
3084
|
+
]),
|
|
3085
|
+
getProgramAccounts: jsonParsedAccountsConfigs.flatMap((c) => [[
|
|
3086
|
+
"value",
|
|
3087
|
+
KEYPATH_WILDCARD,
|
|
3088
|
+
"account",
|
|
3089
|
+
...c
|
|
3090
|
+
], [
|
|
3091
|
+
KEYPATH_WILDCARD,
|
|
3092
|
+
"account",
|
|
3093
|
+
...c
|
|
3094
|
+
]]),
|
|
3095
|
+
getRecentPerformanceSamples: [[KEYPATH_WILDCARD, "samplePeriodSecs"]],
|
|
3096
|
+
getTokenAccountBalance: [["value", "decimals"], ["value", "uiAmount"]],
|
|
3097
|
+
getTokenAccountsByDelegate: jsonParsedTokenAccountsConfigs.map((c) => [
|
|
3098
|
+
"value",
|
|
3099
|
+
KEYPATH_WILDCARD,
|
|
3100
|
+
"account",
|
|
3101
|
+
...c
|
|
3102
|
+
]),
|
|
3103
|
+
getTokenAccountsByOwner: jsonParsedTokenAccountsConfigs.map((c) => [
|
|
3104
|
+
"value",
|
|
3105
|
+
KEYPATH_WILDCARD,
|
|
3106
|
+
"account",
|
|
3107
|
+
...c
|
|
3108
|
+
]),
|
|
3109
|
+
getTokenLargestAccounts: [[
|
|
3110
|
+
"value",
|
|
3111
|
+
KEYPATH_WILDCARD,
|
|
3112
|
+
"decimals"
|
|
3113
|
+
], [
|
|
3114
|
+
"value",
|
|
3115
|
+
KEYPATH_WILDCARD,
|
|
3116
|
+
"uiAmount"
|
|
3117
|
+
]],
|
|
3118
|
+
getTokenSupply: [["value", "decimals"], ["value", "uiAmount"]],
|
|
3119
|
+
getTransaction: [
|
|
3120
|
+
[
|
|
3121
|
+
"meta",
|
|
3122
|
+
"preTokenBalances",
|
|
3123
|
+
KEYPATH_WILDCARD,
|
|
3124
|
+
"accountIndex"
|
|
3125
|
+
],
|
|
3126
|
+
[
|
|
3127
|
+
"meta",
|
|
3128
|
+
"preTokenBalances",
|
|
3129
|
+
KEYPATH_WILDCARD,
|
|
3130
|
+
"uiTokenAmount",
|
|
3131
|
+
"decimals"
|
|
3132
|
+
],
|
|
3133
|
+
[
|
|
3134
|
+
"meta",
|
|
3135
|
+
"postTokenBalances",
|
|
3136
|
+
KEYPATH_WILDCARD,
|
|
3137
|
+
"accountIndex"
|
|
3138
|
+
],
|
|
3139
|
+
[
|
|
3140
|
+
"meta",
|
|
3141
|
+
"postTokenBalances",
|
|
3142
|
+
KEYPATH_WILDCARD,
|
|
3143
|
+
"uiTokenAmount",
|
|
3144
|
+
"decimals"
|
|
3145
|
+
],
|
|
3146
|
+
[
|
|
3147
|
+
"meta",
|
|
3148
|
+
"rewards",
|
|
3149
|
+
KEYPATH_WILDCARD,
|
|
3150
|
+
"commission"
|
|
3151
|
+
],
|
|
3152
|
+
...innerInstructionsConfigs.map((c) => [
|
|
3153
|
+
"meta",
|
|
3154
|
+
"innerInstructions",
|
|
3155
|
+
KEYPATH_WILDCARD,
|
|
3156
|
+
...c
|
|
3157
|
+
]),
|
|
3158
|
+
...messageConfig.map((c) => [
|
|
3159
|
+
"transaction",
|
|
3160
|
+
"message",
|
|
3161
|
+
...c
|
|
3162
|
+
])
|
|
3163
|
+
],
|
|
3164
|
+
getVersion: [["feature-set"]],
|
|
3165
|
+
getVoteAccounts: [[
|
|
3166
|
+
"current",
|
|
3167
|
+
KEYPATH_WILDCARD,
|
|
3168
|
+
"commission"
|
|
3169
|
+
], [
|
|
3170
|
+
"delinquent",
|
|
3171
|
+
KEYPATH_WILDCARD,
|
|
3172
|
+
"commission"
|
|
3173
|
+
]],
|
|
3174
|
+
simulateTransaction: [
|
|
3175
|
+
["value", "loadedAccountsDataSize"],
|
|
3176
|
+
...jsonParsedAccountsConfigs.map((c) => [
|
|
3177
|
+
"value",
|
|
3178
|
+
"accounts",
|
|
3179
|
+
KEYPATH_WILDCARD,
|
|
3180
|
+
...c
|
|
3181
|
+
]),
|
|
3182
|
+
...innerInstructionsConfigs.map((c) => [
|
|
3183
|
+
"value",
|
|
3184
|
+
"innerInstructions",
|
|
3185
|
+
KEYPATH_WILDCARD,
|
|
3186
|
+
...c
|
|
3187
|
+
])
|
|
3188
|
+
]
|
|
3189
|
+
};
|
|
3190
|
+
return memoizedKeypaths;
|
|
3191
|
+
}
|
|
3192
|
+
//#endregion
|
|
3193
|
+
//#region node_modules/.pnpm/@solana+rpc-transport-http@6.5.0_typescript@5.9.3/node_modules/@solana/rpc-transport-http/dist/index.node.mjs
|
|
3194
|
+
var DISALLOWED_HEADERS = {
|
|
3195
|
+
accept: true,
|
|
3196
|
+
"content-length": true,
|
|
3197
|
+
"content-type": true
|
|
3198
|
+
};
|
|
3199
|
+
var FORBIDDEN_HEADERS = /* @__PURE__ */ Object.assign({
|
|
3200
|
+
"accept-charset": true,
|
|
3201
|
+
"access-control-request-headers": true,
|
|
3202
|
+
"access-control-request-method": true,
|
|
3203
|
+
connection: true,
|
|
3204
|
+
"content-length": true,
|
|
3205
|
+
cookie: true,
|
|
3206
|
+
date: true,
|
|
3207
|
+
dnt: true,
|
|
3208
|
+
expect: true,
|
|
3209
|
+
host: true,
|
|
3210
|
+
"keep-alive": true,
|
|
3211
|
+
"permissions-policy": true,
|
|
3212
|
+
referer: true,
|
|
3213
|
+
te: true,
|
|
3214
|
+
trailer: true,
|
|
3215
|
+
"transfer-encoding": true,
|
|
3216
|
+
upgrade: true,
|
|
3217
|
+
via: true
|
|
3218
|
+
}, void 0, void 0);
|
|
3219
|
+
function assertIsAllowedHttpRequestHeaders(headers) {
|
|
3220
|
+
const badHeaders = Object.keys(headers).filter((headerName) => {
|
|
3221
|
+
const lowercaseHeaderName = headerName.toLowerCase();
|
|
3222
|
+
return DISALLOWED_HEADERS[headerName.toLowerCase()] === true || FORBIDDEN_HEADERS[headerName.toLowerCase()] === true || lowercaseHeaderName.startsWith("proxy-") || lowercaseHeaderName.startsWith("sec-");
|
|
3223
|
+
});
|
|
3224
|
+
if (badHeaders.length > 0) throw new SolanaError(SOLANA_ERROR__RPC__TRANSPORT_HTTP_HEADER_FORBIDDEN, { headers: badHeaders });
|
|
3225
|
+
}
|
|
3226
|
+
function normalizeHeaders$1(headers) {
|
|
3227
|
+
const out = {};
|
|
3228
|
+
for (const headerName in headers) out[headerName.toLowerCase()] = headers[headerName];
|
|
3229
|
+
return out;
|
|
3230
|
+
}
|
|
3231
|
+
function createHttpTransport(config) {
|
|
3232
|
+
if (process.env.NODE_ENV !== "production" && false);
|
|
3233
|
+
const { fromJson, headers, toJson, url } = config;
|
|
3234
|
+
if (process.env.NODE_ENV !== "production" && headers) assertIsAllowedHttpRequestHeaders(headers);
|
|
3235
|
+
let dispatcherConfig;
|
|
3236
|
+
if ("dispatcher_NODE_ONLY" in config) dispatcherConfig = { dispatcher: config.dispatcher_NODE_ONLY };
|
|
3237
|
+
const customHeaders = headers && normalizeHeaders$1(headers);
|
|
3238
|
+
return async function makeHttpRequest({ payload, signal }) {
|
|
3239
|
+
const body = toJson ? toJson(payload) : JSON.stringify(payload);
|
|
3240
|
+
const requestInfo = {
|
|
3241
|
+
...dispatcherConfig,
|
|
3242
|
+
body,
|
|
3243
|
+
headers: {
|
|
3244
|
+
...customHeaders,
|
|
3245
|
+
accept: "application/json",
|
|
3246
|
+
"content-length": body.length.toString(),
|
|
3247
|
+
"content-type": "application/json; charset=utf-8"
|
|
3248
|
+
},
|
|
3249
|
+
method: "POST",
|
|
3250
|
+
signal
|
|
3251
|
+
};
|
|
3252
|
+
const response = await fetch(url, requestInfo);
|
|
3253
|
+
if (!response.ok) throw new SolanaError(SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR, {
|
|
3254
|
+
headers: response.headers,
|
|
3255
|
+
message: response.statusText,
|
|
3256
|
+
statusCode: response.status
|
|
3257
|
+
});
|
|
3258
|
+
if (fromJson) return fromJson(await response.text(), payload);
|
|
3259
|
+
return await response.json();
|
|
3260
|
+
};
|
|
3261
|
+
}
|
|
3262
|
+
var SOLANA_RPC_METHODS = [
|
|
3263
|
+
"getAccountInfo",
|
|
3264
|
+
"getBalance",
|
|
3265
|
+
"getBlock",
|
|
3266
|
+
"getBlockCommitment",
|
|
3267
|
+
"getBlockHeight",
|
|
3268
|
+
"getBlockProduction",
|
|
3269
|
+
"getBlocks",
|
|
3270
|
+
"getBlocksWithLimit",
|
|
3271
|
+
"getBlockTime",
|
|
3272
|
+
"getClusterNodes",
|
|
3273
|
+
"getEpochInfo",
|
|
3274
|
+
"getEpochSchedule",
|
|
3275
|
+
"getFeeForMessage",
|
|
3276
|
+
"getFirstAvailableBlock",
|
|
3277
|
+
"getGenesisHash",
|
|
3278
|
+
"getHealth",
|
|
3279
|
+
"getHighestSnapshotSlot",
|
|
3280
|
+
"getIdentity",
|
|
3281
|
+
"getInflationGovernor",
|
|
3282
|
+
"getInflationRate",
|
|
3283
|
+
"getInflationReward",
|
|
3284
|
+
"getLargestAccounts",
|
|
3285
|
+
"getLatestBlockhash",
|
|
3286
|
+
"getLeaderSchedule",
|
|
3287
|
+
"getMaxRetransmitSlot",
|
|
3288
|
+
"getMaxShredInsertSlot",
|
|
3289
|
+
"getMinimumBalanceForRentExemption",
|
|
3290
|
+
"getMultipleAccounts",
|
|
3291
|
+
"getProgramAccounts",
|
|
3292
|
+
"getRecentPerformanceSamples",
|
|
3293
|
+
"getRecentPrioritizationFees",
|
|
3294
|
+
"getSignaturesForAddress",
|
|
3295
|
+
"getSignatureStatuses",
|
|
3296
|
+
"getSlot",
|
|
3297
|
+
"getSlotLeader",
|
|
3298
|
+
"getSlotLeaders",
|
|
3299
|
+
"getStakeMinimumDelegation",
|
|
3300
|
+
"getSupply",
|
|
3301
|
+
"getTokenAccountBalance",
|
|
3302
|
+
"getTokenAccountsByDelegate",
|
|
3303
|
+
"getTokenAccountsByOwner",
|
|
3304
|
+
"getTokenLargestAccounts",
|
|
3305
|
+
"getTokenSupply",
|
|
3306
|
+
"getTransaction",
|
|
3307
|
+
"getTransactionCount",
|
|
3308
|
+
"getVersion",
|
|
3309
|
+
"getVoteAccounts",
|
|
3310
|
+
"index",
|
|
3311
|
+
"isBlockhashValid",
|
|
3312
|
+
"minimumLedgerSlot",
|
|
3313
|
+
"requestAirdrop",
|
|
3314
|
+
"sendTransaction",
|
|
3315
|
+
"simulateTransaction"
|
|
3316
|
+
];
|
|
3317
|
+
function isSolanaRequest(payload) {
|
|
3318
|
+
return isJsonRpcPayload(payload) && SOLANA_RPC_METHODS.includes(payload.method);
|
|
3319
|
+
}
|
|
3320
|
+
function createHttpTransportForSolanaRpc(config) {
|
|
3321
|
+
return createHttpTransport({
|
|
3322
|
+
...config,
|
|
3323
|
+
fromJson: (rawResponse, payload) => isSolanaRequest(payload) ? parseJsonWithBigInts(rawResponse) : JSON.parse(rawResponse),
|
|
3324
|
+
toJson: (payload) => isSolanaRequest(payload) ? stringifyJsonWithBigInts(payload) : JSON.stringify(payload)
|
|
3325
|
+
});
|
|
3326
|
+
}
|
|
3327
|
+
//#endregion
|
|
3328
|
+
//#region node_modules/.pnpm/@solana+fast-stable-stringify@6.5.0_typescript@5.9.3/node_modules/@solana/fast-stable-stringify/dist/index.node.mjs
|
|
3329
|
+
var objToString = Object.prototype.toString;
|
|
3330
|
+
var objKeys = Object.keys || function(obj) {
|
|
3331
|
+
const keys = [];
|
|
3332
|
+
for (const name in obj) keys.push(name);
|
|
3333
|
+
return keys;
|
|
3334
|
+
};
|
|
3335
|
+
function stringify(val, isArrayProp) {
|
|
3336
|
+
let i, max, str, keys, key, propVal, toStr;
|
|
3337
|
+
if (val === true) return "true";
|
|
3338
|
+
if (val === false) return "false";
|
|
3339
|
+
switch (typeof val) {
|
|
3340
|
+
case "object": if (val === null) return null;
|
|
3341
|
+
else if ("toJSON" in val && typeof val.toJSON === "function") return stringify(val.toJSON(), isArrayProp);
|
|
3342
|
+
else {
|
|
3343
|
+
toStr = objToString.call(val);
|
|
3344
|
+
if (toStr === "[object Array]") {
|
|
3345
|
+
str = "[";
|
|
3346
|
+
max = val.length - 1;
|
|
3347
|
+
for (i = 0; i < max; i++) str += stringify(val[i], true) + ",";
|
|
3348
|
+
if (max > -1) str += stringify(val[i], true);
|
|
3349
|
+
return str + "]";
|
|
3350
|
+
} else if (toStr === "[object Object]") {
|
|
3351
|
+
keys = objKeys(val).sort();
|
|
3352
|
+
max = keys.length;
|
|
3353
|
+
str = "";
|
|
3354
|
+
i = 0;
|
|
3355
|
+
while (i < max) {
|
|
3356
|
+
key = keys[i];
|
|
3357
|
+
propVal = stringify(val[key], false);
|
|
3358
|
+
if (propVal !== void 0) {
|
|
3359
|
+
if (str) str += ",";
|
|
3360
|
+
str += JSON.stringify(key) + ":" + propVal;
|
|
3361
|
+
}
|
|
3362
|
+
i++;
|
|
3363
|
+
}
|
|
3364
|
+
return "{" + str + "}";
|
|
3365
|
+
} else return JSON.stringify(val);
|
|
3366
|
+
}
|
|
3367
|
+
case "function":
|
|
3368
|
+
case "undefined": return isArrayProp ? null : void 0;
|
|
3369
|
+
case "bigint": return `${val.toString()}n`;
|
|
3370
|
+
case "string": return JSON.stringify(val);
|
|
3371
|
+
default: return isFinite(val) ? val : null;
|
|
3372
|
+
}
|
|
3373
|
+
}
|
|
3374
|
+
function index_default(val) {
|
|
3375
|
+
const returnVal = stringify(val, false);
|
|
3376
|
+
if (returnVal !== void 0) return "" + returnVal;
|
|
3377
|
+
}
|
|
3378
|
+
//#endregion
|
|
3379
|
+
//#region node_modules/.pnpm/@solana+rpc@6.5.0_typescript@5.9.3/node_modules/@solana/rpc/dist/index.node.mjs
|
|
3380
|
+
function createSolanaJsonRpcIntegerOverflowError(methodName, keyPath, value) {
|
|
3381
|
+
let argumentLabel = "";
|
|
3382
|
+
if (typeof keyPath[0] === "number") {
|
|
3383
|
+
const argPosition = keyPath[0] + 1;
|
|
3384
|
+
const lastDigit = argPosition % 10;
|
|
3385
|
+
const lastTwoDigits = argPosition % 100;
|
|
3386
|
+
if (lastDigit == 1 && lastTwoDigits != 11) argumentLabel = argPosition + "st";
|
|
3387
|
+
else if (lastDigit == 2 && lastTwoDigits != 12) argumentLabel = argPosition + "nd";
|
|
3388
|
+
else if (lastDigit == 3 && lastTwoDigits != 13) argumentLabel = argPosition + "rd";
|
|
3389
|
+
else argumentLabel = argPosition + "th";
|
|
3390
|
+
} else argumentLabel = `\`${keyPath[0].toString()}\``;
|
|
3391
|
+
const path = keyPath.length > 1 ? keyPath.slice(1).map((pathPart) => typeof pathPart === "number" ? `[${pathPart}]` : pathPart).join(".") : void 0;
|
|
3392
|
+
const error = new SolanaError(SOLANA_ERROR__RPC__INTEGER_OVERFLOW, {
|
|
3393
|
+
argumentLabel,
|
|
3394
|
+
keyPath,
|
|
3395
|
+
methodName,
|
|
3396
|
+
optionalPathLabel: path ? ` at path \`${path}\`` : "",
|
|
3397
|
+
value,
|
|
3398
|
+
...path !== void 0 ? { path } : void 0
|
|
3399
|
+
});
|
|
3400
|
+
safeCaptureStackTrace(error, createSolanaJsonRpcIntegerOverflowError);
|
|
3401
|
+
return error;
|
|
3402
|
+
}
|
|
3403
|
+
var DEFAULT_RPC_CONFIG = {
|
|
3404
|
+
defaultCommitment: "confirmed",
|
|
3405
|
+
onIntegerOverflow(request, keyPath, value) {
|
|
3406
|
+
throw createSolanaJsonRpcIntegerOverflowError(request.methodName, keyPath, value);
|
|
3407
|
+
}
|
|
3408
|
+
};
|
|
3409
|
+
var e = class extends globalThis.AbortController {
|
|
3410
|
+
constructor(...t) {
|
|
3411
|
+
super(...t), setMaxListeners(Number.MAX_SAFE_INTEGER, this.signal);
|
|
3412
|
+
}
|
|
3413
|
+
};
|
|
3414
|
+
var EXPLICIT_ABORT_TOKEN;
|
|
3415
|
+
function createExplicitAbortToken() {
|
|
3416
|
+
return process.env.NODE_ENV !== "production" ? { EXPLICIT_ABORT_TOKEN: "This object is thrown from the request that underlies a series of coalesced requests when the last request in that series aborts" } : {};
|
|
3417
|
+
}
|
|
3418
|
+
function getRpcTransportWithRequestCoalescing(transport, getDeduplicationKey) {
|
|
3419
|
+
let coalescedRequestsByDeduplicationKey;
|
|
3420
|
+
return async function makeCoalescedHttpRequest(request) {
|
|
3421
|
+
const { payload, signal } = request;
|
|
3422
|
+
const deduplicationKey = getDeduplicationKey(payload);
|
|
3423
|
+
if (deduplicationKey === void 0) return await transport(request);
|
|
3424
|
+
if (!coalescedRequestsByDeduplicationKey) {
|
|
3425
|
+
queueMicrotask(() => {
|
|
3426
|
+
coalescedRequestsByDeduplicationKey = void 0;
|
|
3427
|
+
});
|
|
3428
|
+
coalescedRequestsByDeduplicationKey = {};
|
|
3429
|
+
}
|
|
3430
|
+
if (coalescedRequestsByDeduplicationKey[deduplicationKey] == null) {
|
|
3431
|
+
const abortController = new e();
|
|
3432
|
+
const responsePromise = (async () => {
|
|
3433
|
+
try {
|
|
3434
|
+
return await transport({
|
|
3435
|
+
...request,
|
|
3436
|
+
signal: abortController.signal
|
|
3437
|
+
});
|
|
3438
|
+
} catch (e2) {
|
|
3439
|
+
if (e2 === (EXPLICIT_ABORT_TOKEN ||= createExplicitAbortToken())) return;
|
|
3440
|
+
throw e2;
|
|
3441
|
+
}
|
|
3442
|
+
})();
|
|
3443
|
+
coalescedRequestsByDeduplicationKey[deduplicationKey] = {
|
|
3444
|
+
abortController,
|
|
3445
|
+
numConsumers: 0,
|
|
3446
|
+
responsePromise
|
|
3447
|
+
};
|
|
3448
|
+
}
|
|
3449
|
+
const coalescedRequest = coalescedRequestsByDeduplicationKey[deduplicationKey];
|
|
3450
|
+
coalescedRequest.numConsumers++;
|
|
3451
|
+
if (signal) {
|
|
3452
|
+
const responsePromise = coalescedRequest.responsePromise;
|
|
3453
|
+
return await new Promise((resolve, reject) => {
|
|
3454
|
+
const handleAbort = (e2) => {
|
|
3455
|
+
signal.removeEventListener("abort", handleAbort);
|
|
3456
|
+
coalescedRequest.numConsumers -= 1;
|
|
3457
|
+
queueMicrotask(() => {
|
|
3458
|
+
if (coalescedRequest.numConsumers === 0) coalescedRequest.abortController.abort(EXPLICIT_ABORT_TOKEN ||= createExplicitAbortToken());
|
|
3459
|
+
});
|
|
3460
|
+
reject(e2.target.reason);
|
|
3461
|
+
};
|
|
3462
|
+
signal.addEventListener("abort", handleAbort);
|
|
3463
|
+
responsePromise.then(resolve).catch(reject).finally(() => {
|
|
3464
|
+
signal.removeEventListener("abort", handleAbort);
|
|
3465
|
+
});
|
|
3466
|
+
});
|
|
3467
|
+
} else return await coalescedRequest.responsePromise;
|
|
3468
|
+
};
|
|
3469
|
+
}
|
|
3470
|
+
function getSolanaRpcPayloadDeduplicationKey(payload) {
|
|
3471
|
+
return isJsonRpcPayload(payload) ? index_default([payload.method, payload.params]) : void 0;
|
|
3472
|
+
}
|
|
3473
|
+
function normalizeHeaders(headers) {
|
|
3474
|
+
const out = {};
|
|
3475
|
+
for (const headerName in headers) out[headerName.toLowerCase()] = headers[headerName];
|
|
3476
|
+
return out;
|
|
3477
|
+
}
|
|
3478
|
+
function createDefaultRpcTransport(config) {
|
|
3479
|
+
return pipe(createHttpTransportForSolanaRpc({
|
|
3480
|
+
...config,
|
|
3481
|
+
headers: {
|
|
3482
|
+
"accept-encoding": "br,gzip,deflate",
|
|
3483
|
+
...config.headers ? normalizeHeaders(config.headers) : void 0,
|
|
3484
|
+
"solana-client": `js/6.5.0`
|
|
3485
|
+
}
|
|
3486
|
+
}), (transport) => getRpcTransportWithRequestCoalescing(transport, getSolanaRpcPayloadDeduplicationKey));
|
|
3487
|
+
}
|
|
3488
|
+
function createSolanaRpcFromTransport(transport) {
|
|
3489
|
+
return createRpc({
|
|
3490
|
+
api: createSolanaRpcApi(DEFAULT_RPC_CONFIG),
|
|
3491
|
+
transport
|
|
3492
|
+
});
|
|
3493
|
+
}
|
|
3494
|
+
//#endregion
|
|
3495
|
+
//#region node_modules/.pnpm/@solana+signers@6.5.0_typescript@5.9.3/node_modules/@solana/signers/dist/index.node.mjs
|
|
3496
|
+
function deduplicateSigners(signers) {
|
|
3497
|
+
const deduplicated = {};
|
|
3498
|
+
signers.forEach((signer) => {
|
|
3499
|
+
if (!deduplicated[signer.address]) deduplicated[signer.address] = signer;
|
|
3500
|
+
else if (deduplicated[signer.address] !== signer) throw new SolanaError(SOLANA_ERROR__SIGNER__ADDRESS_CANNOT_HAVE_MULTIPLE_SIGNERS, { address: signer.address });
|
|
3501
|
+
});
|
|
3502
|
+
return Object.values(deduplicated);
|
|
3503
|
+
}
|
|
3504
|
+
function isTransactionModifyingSigner(value) {
|
|
3505
|
+
return "modifyAndSignTransactions" in value && typeof value.modifyAndSignTransactions === "function";
|
|
3506
|
+
}
|
|
3507
|
+
function isTransactionPartialSigner(value) {
|
|
3508
|
+
return "signTransactions" in value && typeof value.signTransactions === "function";
|
|
3509
|
+
}
|
|
3510
|
+
function isTransactionSendingSigner(value) {
|
|
3511
|
+
return "signAndSendTransactions" in value && typeof value.signAndSendTransactions === "function";
|
|
3512
|
+
}
|
|
3513
|
+
function isTransactionSigner(value) {
|
|
3514
|
+
return isTransactionPartialSigner(value) || isTransactionModifyingSigner(value) || isTransactionSendingSigner(value);
|
|
3515
|
+
}
|
|
3516
|
+
function getSignersFromInstruction(instruction) {
|
|
3517
|
+
return deduplicateSigners((instruction.accounts ?? []).flatMap((account) => "signer" in account ? account.signer : []));
|
|
3518
|
+
}
|
|
3519
|
+
function getSignersFromTransactionMessage(transaction) {
|
|
3520
|
+
return deduplicateSigners([...transaction.feePayer && isTransactionSigner(transaction.feePayer) ? [transaction.feePayer] : [], ...transaction.instructions.flatMap(getSignersFromInstruction)]);
|
|
3521
|
+
}
|
|
3522
|
+
async function createSignerFromKeyPair(keyPair) {
|
|
3523
|
+
const address = await getAddressFromPublicKey(keyPair.publicKey);
|
|
3524
|
+
return Object.freeze({
|
|
3525
|
+
address,
|
|
3526
|
+
keyPair,
|
|
3527
|
+
signMessages: (messages) => Promise.all(messages.map(async (message) => Object.freeze({ [address]: await signBytes(keyPair.privateKey, message.content) }))),
|
|
3528
|
+
signTransactions: (transactions) => Promise.all(transactions.map(async (transaction) => {
|
|
3529
|
+
const signedTransaction = await partiallySignTransaction([keyPair], transaction);
|
|
3530
|
+
return Object.freeze({ [address]: signedTransaction.signatures[address] });
|
|
3531
|
+
}))
|
|
3532
|
+
});
|
|
3533
|
+
}
|
|
3534
|
+
async function createKeyPairSignerFromBytes(bytes, extractable) {
|
|
3535
|
+
return await createSignerFromKeyPair(await createKeyPairFromBytes(bytes, extractable));
|
|
3536
|
+
}
|
|
3537
|
+
async function partiallySignTransactionMessageWithSigners(transactionMessage, config) {
|
|
3538
|
+
return await partiallySignTransactionWithSigners(getSignersFromTransactionMessage(transactionMessage).filter((signer) => isTransactionModifyingSigner(signer) || isTransactionPartialSigner(signer)), compileTransaction(transactionMessage), config);
|
|
3539
|
+
}
|
|
3540
|
+
async function partiallySignTransactionWithSigners(signers, transaction, config) {
|
|
3541
|
+
const { partialSigners, modifyingSigners } = categorizeTransactionSigners(deduplicateSigners(signers), { identifySendingSigner: false });
|
|
3542
|
+
return await signModifyingAndPartialTransactionSigners(transaction, modifyingSigners, partialSigners, config);
|
|
3543
|
+
}
|
|
3544
|
+
function categorizeTransactionSigners(signers, config = {}) {
|
|
3545
|
+
const sendingSigner = config.identifySendingSigner ?? true ? identifyTransactionSendingSigner(signers) : null;
|
|
3546
|
+
const otherSigners = signers.filter((signer) => signer !== sendingSigner && (isTransactionModifyingSigner(signer) || isTransactionPartialSigner(signer)));
|
|
3547
|
+
const modifyingSigners = identifyTransactionModifyingSigners(otherSigners);
|
|
3548
|
+
const partialSigners = otherSigners.filter(isTransactionPartialSigner).filter((signer) => !modifyingSigners.includes(signer));
|
|
3549
|
+
return Object.freeze({
|
|
3550
|
+
modifyingSigners,
|
|
3551
|
+
partialSigners,
|
|
3552
|
+
sendingSigner
|
|
3553
|
+
});
|
|
3554
|
+
}
|
|
3555
|
+
function identifyTransactionSendingSigner(signers) {
|
|
3556
|
+
const sendingSigners = signers.filter(isTransactionSendingSigner);
|
|
3557
|
+
if (sendingSigners.length === 0) return null;
|
|
3558
|
+
const sendingOnlySigners = sendingSigners.filter((signer) => !isTransactionModifyingSigner(signer) && !isTransactionPartialSigner(signer));
|
|
3559
|
+
if (sendingOnlySigners.length > 0) return sendingOnlySigners[0];
|
|
3560
|
+
return sendingSigners[0];
|
|
3561
|
+
}
|
|
3562
|
+
function identifyTransactionModifyingSigners(signers) {
|
|
3563
|
+
const modifyingSigners = signers.filter(isTransactionModifyingSigner);
|
|
3564
|
+
if (modifyingSigners.length === 0) return [];
|
|
3565
|
+
const nonPartialSigners = modifyingSigners.filter((signer) => !isTransactionPartialSigner(signer));
|
|
3566
|
+
if (nonPartialSigners.length > 0) return nonPartialSigners;
|
|
3567
|
+
return [modifyingSigners[0]];
|
|
3568
|
+
}
|
|
3569
|
+
async function signModifyingAndPartialTransactionSigners(transaction, modifyingSigners = [], partialSigners = [], config) {
|
|
3570
|
+
const modifiedTransaction = await modifyingSigners.reduce(async (transaction2, modifyingSigner) => {
|
|
3571
|
+
config?.abortSignal?.throwIfAborted();
|
|
3572
|
+
const [tx] = await modifyingSigner.modifyAndSignTransactions([await transaction2], config);
|
|
3573
|
+
return Object.freeze(tx);
|
|
3574
|
+
}, Promise.resolve(transaction));
|
|
3575
|
+
config?.abortSignal?.throwIfAborted();
|
|
3576
|
+
const signatureDictionaries = await Promise.all(partialSigners.map(async (partialSigner) => {
|
|
3577
|
+
const [signatures] = await partialSigner.signTransactions([modifiedTransaction], config);
|
|
3578
|
+
return signatures;
|
|
3579
|
+
}));
|
|
3580
|
+
return Object.freeze({
|
|
3581
|
+
...modifiedTransaction,
|
|
3582
|
+
signatures: Object.freeze(signatureDictionaries.reduce((signatures, signatureDictionary) => {
|
|
3583
|
+
return {
|
|
3584
|
+
...signatures,
|
|
3585
|
+
...signatureDictionary
|
|
3586
|
+
};
|
|
3587
|
+
}, modifiedTransaction.signatures ?? {}))
|
|
3588
|
+
});
|
|
3589
|
+
}
|
|
3590
|
+
globalThis.TextEncoder;
|
|
3591
|
+
//#endregion
|
|
3592
|
+
export { getArrayEncoder as $, SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_OWNER as $a, SOLANA_ERROR__OFFCHAIN_MESSAGE__VERSION_NUMBER_NOT_SUPPORTED as $i, SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_INDEX as $n, getSolanaErrorFromInstructionError as $o, SOLANA_ERROR__INSTRUCTION__PROGRAM_ID_MISMATCH as $r, SOLANA_ERROR__ACCOUNTS__FAILED_TO_DECODE_ACCOUNT as $t, compileTransactionMessage4 as A, SOLANA_ERROR__SUBTLE_CRYPTO__DIGEST_UNIMPLEMENTED as Aa, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION as Ai, SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS as An, SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_FEE_PAYER_MISSING as Ao, SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPILE as Ar, getBase64Decoder as At, setTransactionMessageComputeUnitLimit as B, SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_NOT_FOUND as Ba, SOLANA_ERROR__OFFCHAIN_MESSAGE__MAXIMUM_LENGTH_EXCEEDED as Bi, SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_ALREADY_INITIALIZED as Bn, SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_FIRST_INSTRUCTION_MUST_BE_ADVANCE_NONCE as Bo, SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_SYSVAR as Br, createEncoder as Bt, partiallySignTransaction as C, SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SENDING_SIGNER as Ca, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE as Ci, SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH as Cn, SOLANA_ERROR__TRANSACTION__CANNOT_ENCODE_WITH_EMPTY_MESSAGE_BYTES as Co, SOLANA_ERROR__INSTRUCTION_ERROR__MAX_SEED_LENGTH_EXCEEDED as Cr, getAddressEncoder as Ct, verifySignature as D, SOLANA_ERROR__SIGNER__WALLET_ACCOUNT_CANNOT_SIGN_TRANSACTION as Da, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE as Di, SOLANA_ERROR__CODECS__INVALID_DISCRIMINATED_UNION_VARIANT as Dn, SOLANA_ERROR__TRANSACTION__EXPECTED_NONCE_LIFETIME as Do, SOLANA_ERROR__INSTRUCTION_ERROR__NOT_ENOUGH_ACCOUNT_KEYS as Dr, assertValidBaseString$1 as Dt, signBytes as E, SOLANA_ERROR__SIGNER__TRANSACTION_SENDING_SIGNER_MISSING as Ea, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE as Ei, SOLANA_ERROR__CODECS__INVALID_CONSTANT as En, SOLANA_ERROR__TRANSACTION__EXPECTED_BLOCKHASH_LIFETIME as Eo, SOLANA_ERROR__INSTRUCTION_ERROR__MODIFIED_PROGRAM_ID as Er, isAddress as Et, getTransactionVersionDecoder as F, SOLANA_ERROR__SUBTLE_CRYPTO__SIGN_FUNCTION_UNIMPLEMENTED as Fa, SOLANA_ERROR__KEYS__SIGNATURE_STRING_LENGTH_OUT_OF_RANGE as Fi, SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE as Fn, SOLANA_ERROR__TRANSACTION__FEE_PAYER_SIGNATURE_MISSING as Fo, SOLANA_ERROR__INSTRUCTION_ERROR__RENT_EPOCH_MODIFIED as Fr, assertByteArrayIsNotEmptyForCodec as Ft, mainnet as G, SOLANA_ERROR__TRANSACTION_ERROR__CLUSTER_MAINTENANCE as Ga, SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_REQUIRED_SIGNERS_CANNOT_BE_ZERO as Gi, SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_EXECUTABLE as Gn, SOLANA_ERROR__TRANSACTION__MESSAGE_SIGNATURES_MISMATCH as Go, SOLANA_ERROR__INSTRUCTION_PLANS__MESSAGE_CANNOT_ACCOMMODATE_PLAN as Gr, isFixedSize as Gt, setTransactionMessageFeePayer as H, SOLANA_ERROR__TRANSACTION_ERROR__ALREADY_PROCESSED as Ha, SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_LENGTH_MISMATCH as Hi, SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_OUTSTANDING as Hn, SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES as Ho, SOLANA_ERROR__INSTRUCTION_PLANS__EXPECTED_SUCCESSFUL_TRANSACTION_PLAN_RESULT as Hr, fixDecoderSize as Ht, getTransactionVersionEncoder as I, SOLANA_ERROR__SUBTLE_CRYPTO__VERIFY_FUNCTION_UNIMPLEMENTED as Ia, SOLANA_ERROR__OFFCHAIN_MESSAGE__ADDRESSES_CANNOT_SIGN_OFFCHAIN_MESSAGE as Ii, SOLANA_ERROR__CODECS__OFFSET_OUT_OF_RANGE as In, SOLANA_ERROR__TRANSACTION__INSTRUCTION_HEADERS_PAYLOADS_MISMATCH as Io, SOLANA_ERROR__INSTRUCTION_ERROR__UNBALANCED_INSTRUCTION as Ir, assertIsFixedSize as It, isWritableRole as J, SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_RENT as Ja, SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATORIES_MUST_BE_SORTED as Ji, SOLANA_ERROR__INSTRUCTION_ERROR__BORSH_IO_ERROR as Jn, SOLANA_ERROR__TRANSACTION__SIGNATURE_COUNT_TOO_HIGH_FOR_TRANSACTION_BYTES as Jo, SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_INSTRUCTION_PLAN as Jr, toArrayBuffer as Jt, AccountRole as K, SOLANA_ERROR__TRANSACTION_ERROR__DUPLICATE_INSTRUCTION as Ka, SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_SIGNATURES_MISMATCH as Ki, SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_RENT_EXEMPT as Kn, SOLANA_ERROR__TRANSACTION__NONCE_ACCOUNT_CANNOT_BE_IN_LOOKUP_TABLE as Ko, SOLANA_ERROR__INSTRUCTION_PLANS__MESSAGE_PACKER_ALREADY_COMPLETE as Kr, isVariableSize as Kt, isAdvanceNonceAccountInstruction as L, SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_BORROW_OUTSTANDING as La, SOLANA_ERROR__OFFCHAIN_MESSAGE__APPLICATION_DOMAIN_STRING_LENGTH_OUT_OF_RANGE as Li, SOLANA_ERROR__CODECS__SENTINEL_MISSING_IN_DECODED_BYTES as Ln, SOLANA_ERROR__TRANSACTION__INVALID_CONFIG_MASK_PRIORITY_FEE_BITS as Lo, SOLANA_ERROR__INSTRUCTION_ERROR__UNINITIALIZED_ACCOUNT as Lr, bytesEqual as Lt, getCompiledTransactionMessageEncoder as M, SOLANA_ERROR__SUBTLE_CRYPTO__ED25519_ALGORITHM_UNIMPLEMENTED as Ma, SOLANA_ERROR__KEYS__INVALID_PRIVATE_KEY_BYTE_LENGTH as Mi, SOLANA_ERROR__CODECS__INVALID_PATTERN_MATCH_VALUE as Mn, SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT as Mo, SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_DATA_MODIFIED as Mr, getBaseXEncoder$1 as Mt, getTransactionMessageComputeUnitLimit as N, SOLANA_ERROR__SUBTLE_CRYPTO__EXPORT_FUNCTION_UNIMPLEMENTED as Na, SOLANA_ERROR__KEYS__INVALID_SIGNATURE_BYTE_LENGTH as Ni, SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE as Nn, SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT as No, SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_LAMPORT_CHANGE as Nr, addEncoderSizePrefix as Nt, appendTransactionMessageInstruction as O, SOLANA_ERROR__SIGNER__WALLET_MULTISIGN_UNIMPLEMENTED as Oa, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH as Oi, SOLANA_ERROR__CODECS__INVALID_ENUM_VARIANT as On, SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING as Oo, SOLANA_ERROR__INSTRUCTION_ERROR__PRIVILEGE_ESCALATION as Or, getBase58Decoder as Ot, getTransactionMessageComputeUnitPrice as P, SOLANA_ERROR__SUBTLE_CRYPTO__GENERATE_FUNCTION_UNIMPLEMENTED as Pa, SOLANA_ERROR__KEYS__PUBLIC_KEY_MUST_MATCH_PRIVATE_KEY as Pi, SOLANA_ERROR__CODECS__LITERAL_UNION_DISCRIMINATOR_OUT_OF_RANGE as Pn, SOLANA_ERROR__TRANSACTION__FEE_PAYER_MISSING as Po, SOLANA_ERROR__INSTRUCTION_ERROR__REENTRANCY_NOT_ALLOWED as Pr, assertByteArrayHasEnoughBytesForCodec as Pt, assertValidNumberOfItemsForCodec as Q, SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_INDEX as Qa, SOLANA_ERROR__OFFCHAIN_MESSAGE__UNEXPECTED_VERSION as Qi, SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM as Qn, SolanaError as Qo, SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_DATA as Qr, SOLANA_ERROR__ACCOUNTS__EXPECTED_DECODED_ACCOUNT as Qt, isTransactionMessageWithBlockhashLifetime as R, SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_IN_USE as Ra, SOLANA_ERROR__OFFCHAIN_MESSAGE__ENVELOPE_SIGNERS_MISMATCH as Ri, SOLANA_ERROR__CODECS__UNION_VARIANT_OUT_OF_RANGE as Rn, SOLANA_ERROR__TRANSACTION__INVALID_CONFIG_VALUE_KIND as Ro, SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN as Rr, combineCodec as Rt, getTransactionEncoder as S, SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_PARTIAL_SIGNER as Sa, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SNAPSHOT as Si, SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH as Sn, SOLANA_ERROR__TRANSACTION__CANNOT_DECODE_EMPTY_TRANSACTION_BYTES as So, SOLANA_ERROR__INSTRUCTION_ERROR__MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED as Sr, getAddressDecoder as St, createPrivateKeyFromBytes as T, SOLANA_ERROR__SIGNER__TRANSACTION_CANNOT_HAVE_MULTIPLE_SENDING_SIGNERS as Ta, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_SKIPPED as Ti, SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH as Tn, SOLANA_ERROR__TRANSACTION__EXCEEDS_SIZE_LIMIT as To, SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_REQUIRED_SIGNATURE as Tr, getProgramDerivedAddress as Tt, setTransactionMessageLifetimeUsingBlockhash as U, SOLANA_ERROR__TRANSACTION_ERROR__BLOCKHASH_NOT_FOUND as Ua, SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_MUST_BE_NON_EMPTY as Ui, SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_SIZE_CHANGED as Un, SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE as Uo, SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_SINGLE_TRANSACTION_PLAN_RESULT_NOT_FOUND as Ur, fixEncoderSize as Ut, setTransactionMessageComputeUnitPrice as V, SOLANA_ERROR__TRANSACTION_ERROR__ADDRESS_LOOKUP_TABLE_NOT_FOUND as Va, SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_FORMAT_MISMATCH as Vi, SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_FAILED as Vn, SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_INSTRUCTIONS_MISSING as Vo, SOLANA_ERROR__INSTRUCTION_PLANS__EMPTY_INSTRUCTION_PLAN as Vr, fixBytes as Vt, isBlockhash as W, SOLANA_ERROR__TRANSACTION_ERROR__CALL_CHAIN_TOO_DEEP as Wa, SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_ENVELOPE_SIGNATURES_CANNOT_BE_ZERO as Wi, SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_TOO_SMALL as Wn, SOLANA_ERROR__TRANSACTION__MALFORMED_MESSAGE_BYTES as Wo, SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_TO_EXECUTE_TRANSACTION_PLAN as Wr, getEncodedSize as Wt, upgradeRoleToSigner as X, SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_INDEX as Xa, SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURES_MISSING as Xi, SOLANA_ERROR__INSTRUCTION_ERROR__CALL_DEPTH as Xn, SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_OUT_OF_RANGE as Xo, SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_TRANSACTION_PLAN_RESULT as Xr, SOLANA_ERROR__ACCOUNTS__ACCOUNT_NOT_FOUND as Xt, mergeRoles as Y, SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_FOR_FEE as Ya, SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATORIES_MUST_BE_UNIQUE as Yi, SOLANA_ERROR__INSTRUCTION_ERROR__BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS as Yn, SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_NOT_SUPPORTED as Yo, SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_TRANSACTION_PLAN as Yr, transformEncoder as Yt, pipe as Z, SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_DATA as Za, SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURE_VERIFICATION_FAILURE as Zi, SOLANA_ERROR__INSTRUCTION_ERROR__COMPUTATIONAL_BUDGET_EXCEEDED as Zn, SOLANA_ERROR__TRANSACTION__VERSION_ZERO_MUST_BE_ENCODED_WITH_SIGNATURES_FIRST as Zo, SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_ACCOUNTS as Zr, SOLANA_ERROR__ACCOUNTS__EXPECTED_ALL_ACCOUNTS_TO_BE_DECODED as Zt, isJsonRpcPayload as _, SOLANA_ERROR__SIGNER__EXPECTED_KEY_PAIR_SIGNER as _a, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX as _i, SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH as _n, SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_ACCOUNT_COST_LIMIT as _o, SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_INSTRUCTION_DATA as _r, getU8Encoder as _t, isTransactionModifyingSigner as a, SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_ACCOUNT_TYPE as aa, SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_STATE_MISSING as ai, SOLANA_ERROR__ADDRESSES__INVALID_OFF_CURVE_ADDRESS as an, SOLANA_ERROR__TRANSACTION_ERROR__MISSING_SIGNATURE_FOR_FEE as ao, SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_DATA_MODIFIED as ar, getPredicateEncoder as at, compileTransaction as b, SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_SIGNER as ba, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED as bi, SOLANA_ERROR__CODECS__EXPECTED_DECODER_TO_CONSUME_ENTIRE_BYTE_ARRAY as bn, SOLANA_ERROR__TRANSACTION__ADDRESSES_CANNOT_SIGN_TRANSACTION as bo, SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED as br, getAddressCodec as bt, isTransactionSigner as c, SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CLOSED_BEFORE_MESSAGE_BUFFERED as ca, SOLANA_ERROR__JSON_RPC__INVALID_PARAMS as ci, SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED as cn, SOLANA_ERROR__TRANSACTION_ERROR__RESANITIZATION_NEEDED as co, SOLANA_ERROR__INSTRUCTION_ERROR__ILLEGAL_OWNER as cr, getUnionEncoder as ct, DEFAULT_RPC_CONFIG as d, SOLANA_ERROR__RPC_SUBSCRIPTIONS__EXPECTED_SERVER_SUBSCRIPTION_ID as da, SOLANA_ERROR__JSON_RPC__PARSE_ERROR as di, SOLANA_ERROR__ADDRESSES__PDA_ENDS_WITH_PDA_MARKER as dn, SOLANA_ERROR__TRANSACTION_ERROR__TOO_MANY_ACCOUNT_LOCKS as do, SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_PROGRAM_ID as dr, getShortU16Encoder as dt, SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT as ea, SOLANA_ERROR__INVARIANT_VIOLATION__CACHED_ABORTABLE_ITERABLE_CACHE_ENTRY_MISSING as ei, SOLANA_ERROR__ACCOUNTS__ONE_OR_MORE_ACCOUNTS_NOT_FOUND as en, SOLANA_ERROR__TRANSACTION_ERROR__INVALID_LOADED_ACCOUNTS_DATA_SIZE_LIMIT as eo, SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_OUT_OF_SYNC as er, getSolanaErrorFromJsonRpcError as es, getBooleanEncoder as et, createDefaultRpcTransport as f, SOLANA_ERROR__RPC__API_PLAN_MISSING_FOR_RPC_METHOD as fa, SOLANA_ERROR__JSON_RPC__SCAN_ERROR as fi, SOLANA_ERROR__ADDRESSES__STRING_LENGTH_OUT_OF_RANGE as fn, SOLANA_ERROR__TRANSACTION_ERROR__UNBALANCED_TRANSACTION as fo, SOLANA_ERROR__INSTRUCTION_ERROR__INSUFFICIENT_FUNDS as fr, getU16Encoder as ft, createRpc as g, SOLANA_ERROR__SIGNER__ADDRESS_CANNOT_HAVE_MULTIPLE_SIGNERS as ga, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_EPOCH_REWARDS_PERIOD_ACTIVE as gi, SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH as gn, SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_TOTAL_LIMIT as go, SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ERROR as gr, getU64Encoder as gt, createJsonRpcApi as h, SOLANA_ERROR__RPC__TRANSPORT_HTTP_HEADER_FORBIDDEN as ha, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET as hi, SOLANA_ERROR__CODECS__ENCODED_BYTES_MUST_NOT_INCLUDE_SENTINEL as hn, SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_BLOCK_LIMIT as ho, SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ARGUMENT as hr, getU64Decoder as ht, getSignersFromTransactionMessage as i, SOLANA_ERROR__PROGRAM_CLIENTS__UNEXPECTED_RESOLVED_INSTRUCTION_INPUT_TYPE as ia, SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_MUST_NOT_POLL_BEFORE_RESOLVING_EXISTING_MESSAGE_PROMISE as ii, SOLANA_ERROR__ADDRESSES__INVALID_ED25519_PUBLIC_KEY as in, SOLANA_ERROR__TRANSACTION_ERROR__MAX_LOADED_ACCOUNTS_DATA_SIZE_EXCEEDED as io, SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_MODIFIED as ir, getPatternMatchEncoder as it, createTransactionMessage as j, SOLANA_ERROR__SUBTLE_CRYPTO__DISALLOWED_IN_INSECURE_CONTEXT as ja, SOLANA_ERROR__KEYS__INVALID_KEY_PAIR_BYTE_LENGTH as ji, SOLANA_ERROR__CODECS__INVALID_PATTERN_MATCH_BYTES as jn, SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND as jo, SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPLETE as jr, getBaseXDecoder as jt, appendTransactionMessageInstructions as k, SOLANA_ERROR__SUBTLE_CRYPTO__CANNOT_EXPORT_NON_EXTRACTABLE_KEY as ka, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE as ki, SOLANA_ERROR__CODECS__INVALID_LITERAL_UNION_VARIANT as kn, SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE as ko, SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_ENVIRONMENT_SETUP_FAILURE as kr, getBase58Encoder$1 as kt, partiallySignTransactionMessageWithSigners as l, SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CONNECTION_CLOSED as la, SOLANA_ERROR__JSON_RPC__INVALID_REQUEST as li, SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED as ln, SOLANA_ERROR__TRANSACTION_ERROR__SANITIZE_FAILURE as lo, SOLANA_ERROR__INSTRUCTION_ERROR__IMMUTABLE as lr, getUnitEncoder as lt, createSolanaRpcApi as m, SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR as ma, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_NOT_AVAILABLE as mi, SOLANA_ERROR__CODECS__CANNOT_USE_LEXICAL_VALUES_AS_ENUM_DISCRIMINATORS as mn, SOLANA_ERROR__TRANSACTION_ERROR__UNSUPPORTED_VERSION as mo, SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_OWNER as mr, getU32Encoder as mt, createSignerFromKeyPair as n, SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as na, SOLANA_ERROR__INVARIANT_VIOLATION__INVALID_INSTRUCTION_PLAN_KIND as ni, SOLANA_ERROR__ADDRESSES__INVALID_BASE58_ENCODED_ADDRESS as nn, SOLANA_ERROR__TRANSACTION_ERROR__INVALID_RENT_PAYING_ACCOUNT as no, SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_DATA_MODIFIED as nr, isSolanaError as ns, getConstantEncoder as nt, isTransactionPartialSigner as o, SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE as oa, SOLANA_ERROR__INVARIANT_VIOLATION__SWITCH_MUST_BE_EXHAUSTIVE as oi, SOLANA_ERROR__ADDRESSES__INVALID_SEEDS_POINT_ON_CURVE as on, SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_ACCOUNT_NOT_FOUND as oo, SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_LAMPORT_SPEND as or, getStructEncoder as ot, createSolanaRpcFromTransport as p, SOLANA_ERROR__RPC__INTEGER_OVERFLOW as pa, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_CLEANED_UP as pi, SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY as pn, SOLANA_ERROR__TRANSACTION_ERROR__UNKNOWN as po, SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_DATA as pr, getU32Decoder as pt, isSignerRole as q, SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_FEE as qa, SOLANA_ERROR__OFFCHAIN_MESSAGE__RESTRICTED_ASCII_BODY_CHARACTER_OUT_OF_RANGE as qi, SOLANA_ERROR__INSTRUCTION_ERROR__ARITHMETIC_OVERFLOW as qn, SOLANA_ERROR__TRANSACTION__SIGNATURES_MISSING as qo, SOLANA_ERROR__INSTRUCTION_PLANS__NON_DIVISIBLE_TRANSACTION_PLANS_NOT_SUPPORTED as qr, padBytes as qt, getSignersFromInstruction as r, SOLANA_ERROR__PROGRAM_CLIENTS__RESOLVED_INSTRUCTION_INPUT_MUST_BE_NON_NULL as ra, SOLANA_ERROR__INVARIANT_VIOLATION__INVALID_TRANSACTION_PLAN_KIND as ri, SOLANA_ERROR__ADDRESSES__INVALID_BYTE_LENGTH as rn, SOLANA_ERROR__TRANSACTION_ERROR__INVALID_WRITABLE_ACCOUNT as ro, SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_LAMPORT_CHANGE as rr, safeCaptureStackTrace as rs, getNullableEncoder as rt, isTransactionSendingSigner as s, SOLANA_ERROR__RPC_SUBSCRIPTIONS__CANNOT_CREATE_SUBSCRIPTION_PLAN as sa, SOLANA_ERROR__JSON_RPC__INTERNAL_ERROR as si, SOLANA_ERROR__ADDRESSES__MALFORMED_PDA as sn, SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED as so, SOLANA_ERROR__INSTRUCTION_ERROR__GENERIC_ERROR as sr, getTupleEncoder as st, createKeyPairSignerFromBytes as t, SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION as ta, SOLANA_ERROR__INVARIANT_VIOLATION__DATA_PUBLISHER_CHANNEL_UNIMPLEMENTED as ti, SOLANA_ERROR__ADDRESSES__FAILED_TO_FIND_VIABLE_PDA_BUMP_SEED as tn, SOLANA_ERROR__TRANSACTION_ERROR__INVALID_PROGRAM_FOR_EXECUTION as to, SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_ACCOUNT_NOT_RENT_EXEMPT as tr, getSolanaErrorFromTransactionError as ts, getBytesEncoder as tt, partiallySignTransactionWithSigners as u, SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_FAILED_TO_CONNECT as ua, SOLANA_ERROR__JSON_RPC__METHOD_NOT_FOUND as ui, SOLANA_ERROR__ADDRESSES__PDA_BUMP_SEED_OUT_OF_RANGE as un, SOLANA_ERROR__TRANSACTION_ERROR__SIGNATURE_FAILURE as uo, SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_AUTHORITY as ur, assertNumberIsBetweenForCodec as ut, createRpcMessage as v, SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_MODIFYING_SIGNER as va, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED as vi, SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH as vn, SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_BLOCK_COST_LIMIT as vo, SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_REALLOC as vr, address as vt, createKeyPairFromBytes as w, SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SIGNER as wa, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_NOT_EPOCH_BOUNDARY as wi, SOLANA_ERROR__CODECS__EXPECTED_ZERO_VALUE_TO_MATCH_ITEM_FIXED_SIZE as wn, SOLANA_ERROR__TRANSACTION__CANNOT_ENCODE_WITH_EMPTY_SIGNATURES as wo, SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_ACCOUNT as wr, getAddressFromPublicKey as wt, getBase64EncodedWireTransaction as x, SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_MODIFYING_SIGNER as xa, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NODE_UNHEALTHY as xi, SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH as xn, SOLANA_ERROR__TRANSACTION__ADDRESS_MISSING as xo, SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_EXCEEDED as xr, getAddressComparator as xt, TRANSACTION_PACKET_SIZE as y, SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_PARTIAL_SIGNER as ya, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_UNREACHABLE as yi, SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE as yn, SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_VOTE_COST_LIMIT as yo, SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_SEEDS as yr, assertIsAddress as yt, isTransactionMessageWithDurableNonceLifetime as z, SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_LOADED_TWICE as za, SOLANA_ERROR__OFFCHAIN_MESSAGE__INVALID_APPLICATION_DOMAIN_BYTE_LENGTH as zi, SOLANA_ERROR__CRYPTO__RANDOM_VALUES_FUNCTION_UNIMPLEMENTED as zn, SOLANA_ERROR__TRANSACTION__INVALID_NONCE_ACCOUNT_INDEX as zo, SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_PROGRAM_ID as zr, createDecoder as zt };
|