@solana/web3.js 2.0.0-experimental.2df278c → 2.0.0-experimental.2e0ae95
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/dist/index.development.js +565 -106
- package/dist/index.development.js.map +1 -1
- package/dist/index.production.min.js +267 -271
- package/package.json +16 -16
|
@@ -125,6 +125,488 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
125
125
|
// ../accounts/dist/index.browser.js
|
|
126
126
|
init_env_shim();
|
|
127
127
|
|
|
128
|
+
// ../errors/dist/index.browser.js
|
|
129
|
+
init_env_shim();
|
|
130
|
+
var SOLANA_ERROR__RPC_INTEGER_OVERFLOW = 3;
|
|
131
|
+
var SOLANA_ERROR__INVALID_KEYPAIR_BYTES = 4;
|
|
132
|
+
var SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED = 5;
|
|
133
|
+
var SOLANA_ERROR__NONCE_INVALID = 6;
|
|
134
|
+
var SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND = 7;
|
|
135
|
+
var SOLANA_ERROR__ACCOUNT_NOT_FOUND = 8;
|
|
136
|
+
var SOLANA_ERROR__MULTIPLE_ACCOUNTS_NOT_FOUND = 9;
|
|
137
|
+
var SOLANA_ERROR__FAILED_TO_DECODE_ACCOUNT = 10;
|
|
138
|
+
var SOLANA_ERROR__EXPECTED_DECODED_ACCOUNT = 11;
|
|
139
|
+
var SOLANA_ERROR__NOT_ALL_ACCOUNTS_DECODED = 12;
|
|
140
|
+
var SOLANA_ERROR__INCORRECT_BASE58_ADDRESS_LENGTH = 13;
|
|
141
|
+
var SOLANA_ERROR__INCORRECT_BASE58_ADDRESS_BYTE_LENGTH = 14;
|
|
142
|
+
var SOLANA_ERROR__NOT_A_BASE58_ENCODED_ADDRESS = 15;
|
|
143
|
+
var SOLANA_ERROR__NOT_AN_ED25519_PUBLIC_KEY = 16;
|
|
144
|
+
var SOLANA_ERROR__MALFORMED_PROGRAM_DERIVED_ADDRESS = 17;
|
|
145
|
+
var SOLANA_ERROR__PROGRAM_DERIVED_ADDRESS_BUMP_SEED_OUT_OF_RANGE = 18;
|
|
146
|
+
var SOLANA_ERROR__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED = 19;
|
|
147
|
+
var SOLANA_ERROR__MAX_PDA_SEED_LENGTH_EXCEEDED = 20;
|
|
148
|
+
var SOLANA_ERROR__INVALID_SEEDS_POINT_ON_CURVE = 21;
|
|
149
|
+
var SOLANA_ERROR__COULD_NOT_FIND_VIABLE_PDA_BUMP_SEED = 22;
|
|
150
|
+
var SOLANA_ERROR__PROGRAM_ADDRESS_ENDS_WITH_PDA_MARKER = 23;
|
|
151
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO_MISSING = 24;
|
|
152
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO_DIGEST_MISSING = 25;
|
|
153
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO_ED25519_ALGORITHM_MISSING = 26;
|
|
154
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO_EXPORT_FUNCTION_MISSING = 27;
|
|
155
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO_GENERATE_FUNCTION_MISSING = 28;
|
|
156
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO_SIGN_FUNCTION_MISSING = 29;
|
|
157
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO_VERIFY_FUNCTION_MISSING = 30;
|
|
158
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_UNKNOWN = 4615e3;
|
|
159
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_GENERIC_ERROR = 4615001;
|
|
160
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ARGUMENT = 4615002;
|
|
161
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_INSTRUCTION_DATA = 4615003;
|
|
162
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ACCOUNT_DATA = 4615004;
|
|
163
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_DATA_TOO_SMALL = 4615005;
|
|
164
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INSUFFICIENT_FUNDS = 4615006;
|
|
165
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INCORRECT_PROGRAM_ID = 4615007;
|
|
166
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_MISSING_REQUIRED_SIGNATURE = 4615008;
|
|
167
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_ALREADY_INITIALIZED = 4615009;
|
|
168
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_UNINITIALIZED_ACCOUNT = 4615010;
|
|
169
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_UNBALANCED_INSTRUCTION = 4615011;
|
|
170
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_MODIFIED_PROGRAM_ID = 4615012;
|
|
171
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_EXTERNAL_ACCOUNT_LAMPORT_SPEND = 4615013;
|
|
172
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_EXTERNAL_ACCOUNT_DATA_MODIFIED = 4615014;
|
|
173
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_READONLY_LAMPORT_CHANGE = 4615015;
|
|
174
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_READONLY_DATA_MODIFIED = 4615016;
|
|
175
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_DUPLICATE_ACCOUNT_INDEX = 4615017;
|
|
176
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_MODIFIED = 4615018;
|
|
177
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_RENT_EPOCH_MODIFIED = 4615019;
|
|
178
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_NOT_ENOUGH_ACCOUNT_KEYS = 4615020;
|
|
179
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_DATA_SIZE_CHANGED = 4615021;
|
|
180
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_NOT_EXECUTABLE = 4615022;
|
|
181
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_BORROW_FAILED = 4615023;
|
|
182
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_BORROW_OUTSTANDING = 4615024;
|
|
183
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_DUPLICATE_ACCOUNT_OUT_OF_SYNC = 4615025;
|
|
184
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_CUSTOM = 4615026;
|
|
185
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ERROR = 4615027;
|
|
186
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_DATA_MODIFIED = 4615028;
|
|
187
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_LAMPORT_CHANGE = 4615029;
|
|
188
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_ACCOUNT_NOT_RENT_EXEMPT = 4615030;
|
|
189
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_UNSUPPORTED_PROGRAM_ID = 4615031;
|
|
190
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_CALL_DEPTH = 4615032;
|
|
191
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_MISSING_ACCOUNT = 4615033;
|
|
192
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_REENTRANCY_NOT_ALLOWED = 4615034;
|
|
193
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_MAX_SEED_LENGTH_EXCEEDED = 4615035;
|
|
194
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_SEEDS = 4615036;
|
|
195
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_REALLOC = 4615037;
|
|
196
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_COMPUTATIONAL_BUDGET_EXCEEDED = 4615038;
|
|
197
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_PRIVILEGE_ESCALATION = 4615039;
|
|
198
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_PROGRAM_ENVIRONMENT_SETUP_FAILURE = 4615040;
|
|
199
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_PROGRAM_FAILED_TO_COMPLETE = 4615041;
|
|
200
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_PROGRAM_FAILED_TO_COMPILE = 4615042;
|
|
201
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_IMMUTABLE = 4615043;
|
|
202
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INCORRECT_AUTHORITY = 4615044;
|
|
203
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_BORSH_IO_ERROR = 4615045;
|
|
204
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_NOT_RENT_EXEMPT = 4615046;
|
|
205
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ACCOUNT_OWNER = 4615047;
|
|
206
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_ARITHMETIC_OVERFLOW = 4615048;
|
|
207
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_UNSUPPORTED_SYSVAR = 4615049;
|
|
208
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_ILLEGAL_OWNER = 4615050;
|
|
209
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED = 4615051;
|
|
210
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_MAX_ACCOUNTS_EXCEEDED = 4615052;
|
|
211
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED = 4615053;
|
|
212
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS = 4615054;
|
|
213
|
+
var SOLANA_ERROR__TRANSACTION_INVOKED_PROGRAMS_CANNOT_PAY_FEES = 5663001;
|
|
214
|
+
var SOLANA_ERROR__TRANSACTION_INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE = 5663002;
|
|
215
|
+
var SOLANA_ERROR__TRANSACTION_EXPECTED_BLOCKHASH_LIFETIME = 5663003;
|
|
216
|
+
var SOLANA_ERROR__TRANSACTION_EXPECTED_NONCE_LIFETIME = 5663004;
|
|
217
|
+
var SOLANA_ERROR__TRANSACTION_VERSION_NUMBER_OUT_OF_RANGE = 5663005;
|
|
218
|
+
var SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING = 5663006;
|
|
219
|
+
var SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE = 5663007;
|
|
220
|
+
var SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND = 5663008;
|
|
221
|
+
var SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_FEE_PAYER_MISSING = 5663009;
|
|
222
|
+
var SOLANA_ERROR__TRANSACTION_MISSING_SIGNATURES = 5663010;
|
|
223
|
+
var SOLANA_ERROR__TRANSACTION_SIGNATURE_NOT_COMPUTABLE = 5663011;
|
|
224
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_UNKNOWN = 705e4;
|
|
225
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_IN_USE = 7050001;
|
|
226
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_LOADED_TWICE = 7050002;
|
|
227
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_NOT_FOUND = 7050003;
|
|
228
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_PROGRAM_ACCOUNT_NOT_FOUND = 7050004;
|
|
229
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INSUFFICIENT_FUNDS_FOR_FEE = 7050005;
|
|
230
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ACCOUNT_FOR_FEE = 7050006;
|
|
231
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_ALREADY_PROCESSED = 7050007;
|
|
232
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_BLOCKHASH_NOT_FOUND = 7050008;
|
|
233
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_CALL_CHAIN_TOO_DEEP = 7050009;
|
|
234
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_MISSING_SIGNATURE_FOR_FEE = 7050010;
|
|
235
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ACCOUNT_INDEX = 7050011;
|
|
236
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_SIGNATURE_FAILURE = 7050012;
|
|
237
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INVALID_PROGRAM_FOR_EXECUTION = 7050013;
|
|
238
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_SANITIZE_FAILURE = 7050014;
|
|
239
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_CLUSTER_MAINTENANCE = 7050015;
|
|
240
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_BORROW_OUTSTANDING = 7050016;
|
|
241
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_MAX_BLOCK_COST_LIMIT = 7050017;
|
|
242
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_UNSUPPORTED_VERSION = 7050018;
|
|
243
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INVALID_WRITABLE_ACCOUNT = 7050019;
|
|
244
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_MAX_ACCOUNT_COST_LIMIT = 7050020;
|
|
245
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_ACCOUNT_DATA_BLOCK_LIMIT = 7050021;
|
|
246
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_TOO_MANY_ACCOUNT_LOCKS = 7050022;
|
|
247
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_ADDRESS_LOOKUP_TABLE_NOT_FOUND = 7050023;
|
|
248
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ADDRESS_LOOKUP_TABLE_OWNER = 7050024;
|
|
249
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ADDRESS_LOOKUP_TABLE_DATA = 7050025;
|
|
250
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ADDRESS_LOOKUP_TABLE_INDEX = 7050026;
|
|
251
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INVALID_RENT_PAYING_ACCOUNT = 7050027;
|
|
252
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_MAX_VOTE_COST_LIMIT = 7050028;
|
|
253
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_ACCOUNT_DATA_TOTAL_LIMIT = 7050029;
|
|
254
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_DUPLICATE_INSTRUCTION = 7050030;
|
|
255
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INSUFFICIENT_FUNDS_FOR_RENT = 7050031;
|
|
256
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_MAX_LOADED_ACCOUNTS_DATA_SIZE_EXCEEDED = 7050032;
|
|
257
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INVALID_LOADED_ACCOUNTS_DATA_SIZE_LIMIT = 7050033;
|
|
258
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_RESANITIZATION_NEEDED = 7050034;
|
|
259
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED = 7050035;
|
|
260
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_UNBALANCED_TRANSACTION = 7050036;
|
|
261
|
+
var SolanaErrorMessages = {
|
|
262
|
+
[SOLANA_ERROR__ACCOUNT_NOT_FOUND]: "Account not found at address: $address",
|
|
263
|
+
[SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED]: "The network has progressed past the last block for which this transaction could have been committed.",
|
|
264
|
+
[SOLANA_ERROR__COULD_NOT_FIND_VIABLE_PDA_BUMP_SEED]: "Unable to find a viable program address bump seed.",
|
|
265
|
+
[SOLANA_ERROR__EXPECTED_DECODED_ACCOUNT]: "Expected decoded account at address: $address",
|
|
266
|
+
[SOLANA_ERROR__FAILED_TO_DECODE_ACCOUNT]: "Failed to decode account data at address: $address",
|
|
267
|
+
[SOLANA_ERROR__INCORRECT_BASE58_ADDRESS_BYTE_LENGTH]: "Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.",
|
|
268
|
+
[SOLANA_ERROR__INCORRECT_BASE58_ADDRESS_LENGTH]: "Expected base58-encoded string of length between 32 and 44, got $actualLength.",
|
|
269
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_ALREADY_INITIALIZED]: "instruction requires an uninitialized account",
|
|
270
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_BORROW_FAILED]: "instruction tries to borrow reference for an account which is already borrowed",
|
|
271
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_BORROW_OUTSTANDING]: "instruction left account with an outstanding borrowed reference",
|
|
272
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_DATA_SIZE_CHANGED]: "program other than the account's owner changed the size of the account data",
|
|
273
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_DATA_TOO_SMALL]: "account data too small for instruction",
|
|
274
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_NOT_EXECUTABLE]: "instruction expected an executable account",
|
|
275
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_NOT_RENT_EXEMPT]: "An account does not have enough lamports to be rent-exempt",
|
|
276
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ARITHMETIC_OVERFLOW]: "Program arithmetic overflowed",
|
|
277
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_BORSH_IO_ERROR]: "Failed to serialize or deserialize account data: $encodedData",
|
|
278
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS]: "Builtin programs must consume compute units",
|
|
279
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_CALL_DEPTH]: "Cross-program invocation call depth too deep",
|
|
280
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_COMPUTATIONAL_BUDGET_EXCEEDED]: "Computational budget exceeded",
|
|
281
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_CUSTOM]: "custom program error: #$code",
|
|
282
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_DUPLICATE_ACCOUNT_INDEX]: "instruction contains duplicate accounts",
|
|
283
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_DUPLICATE_ACCOUNT_OUT_OF_SYNC]: "instruction modifications of multiply-passed account differ",
|
|
284
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_ACCOUNT_NOT_RENT_EXEMPT]: "executable accounts must be rent exempt",
|
|
285
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_DATA_MODIFIED]: "instruction changed executable accounts data",
|
|
286
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_LAMPORT_CHANGE]: "instruction changed the balance of an executable account",
|
|
287
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_MODIFIED]: "instruction changed executable bit of an account",
|
|
288
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_EXTERNAL_ACCOUNT_DATA_MODIFIED]: "instruction modified data of an account it does not own",
|
|
289
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_EXTERNAL_ACCOUNT_LAMPORT_SPEND]: "instruction spent from the balance of an account it does not own",
|
|
290
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_GENERIC_ERROR]: "generic instruction error",
|
|
291
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ILLEGAL_OWNER]: "Provided owner is not allowed",
|
|
292
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_IMMUTABLE]: "Account is immutable",
|
|
293
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INCORRECT_AUTHORITY]: "Incorrect authority provided",
|
|
294
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INCORRECT_PROGRAM_ID]: "incorrect program id for instruction",
|
|
295
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INSUFFICIENT_FUNDS]: "insufficient funds for instruction",
|
|
296
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ACCOUNT_DATA]: "invalid account data for instruction",
|
|
297
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ACCOUNT_OWNER]: "Invalid account owner",
|
|
298
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ARGUMENT]: "invalid program argument",
|
|
299
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ERROR]: "program returned invalid error code",
|
|
300
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_INSTRUCTION_DATA]: "invalid instruction data",
|
|
301
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_REALLOC]: "Failed to reallocate account data",
|
|
302
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_SEEDS]: "Provided seeds do not result in a valid address",
|
|
303
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED]: "Accounts data allocations exceeded the maximum allowed per transaction",
|
|
304
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MAX_ACCOUNTS_EXCEEDED]: "Max accounts exceeded",
|
|
305
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED]: "Max instruction trace length exceeded",
|
|
306
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MAX_SEED_LENGTH_EXCEEDED]: "Length of the seed is too long for address generation",
|
|
307
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MISSING_ACCOUNT]: "An account required by the instruction is missing",
|
|
308
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MISSING_REQUIRED_SIGNATURE]: "missing required signature for instruction",
|
|
309
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MODIFIED_PROGRAM_ID]: "instruction illegally modified the program id of an account",
|
|
310
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_NOT_ENOUGH_ACCOUNT_KEYS]: "insufficient account keys for instruction",
|
|
311
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_PRIVILEGE_ESCALATION]: "Cross-program invocation with unauthorized signer or writable account",
|
|
312
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_PROGRAM_ENVIRONMENT_SETUP_FAILURE]: "Failed to create program execution environment",
|
|
313
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_PROGRAM_FAILED_TO_COMPILE]: "Program failed to compile",
|
|
314
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_PROGRAM_FAILED_TO_COMPLETE]: "Program failed to complete",
|
|
315
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_READONLY_DATA_MODIFIED]: "instruction modified data of a read-only account",
|
|
316
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_READONLY_LAMPORT_CHANGE]: "instruction changed the balance of a read-only account",
|
|
317
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_REENTRANCY_NOT_ALLOWED]: "Cross-program invocation reentrancy not allowed for this instruction",
|
|
318
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_RENT_EPOCH_MODIFIED]: "instruction modified rent epoch of an account",
|
|
319
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_UNBALANCED_INSTRUCTION]: "sum of account balances before and after instruction do not match",
|
|
320
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_UNINITIALIZED_ACCOUNT]: "instruction requires an initialized account",
|
|
321
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_UNKNOWN]: "",
|
|
322
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_UNSUPPORTED_PROGRAM_ID]: "Unsupported program id",
|
|
323
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_UNSUPPORTED_SYSVAR]: "Unsupported sysvar",
|
|
324
|
+
[SOLANA_ERROR__INVALID_KEYPAIR_BYTES]: "Key pair bytes must be of length 64, got $byteLength.",
|
|
325
|
+
[SOLANA_ERROR__INVALID_SEEDS_POINT_ON_CURVE]: "Invalid seeds; point must fall off the Ed25519 curve.",
|
|
326
|
+
[SOLANA_ERROR__MALFORMED_PROGRAM_DERIVED_ADDRESS]: "Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].",
|
|
327
|
+
[SOLANA_ERROR__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED]: "A maximum of $maxSeeds seeds, including the bump seed, may be supplied when creating an address. Received: $actual.",
|
|
328
|
+
[SOLANA_ERROR__MAX_PDA_SEED_LENGTH_EXCEEDED]: "The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.",
|
|
329
|
+
[SOLANA_ERROR__MULTIPLE_ACCOUNTS_NOT_FOUND]: "Accounts not found at addresses: $addresses",
|
|
330
|
+
[SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND]: "No nonce account could be found at address `$nonceAccountAddress`",
|
|
331
|
+
[SOLANA_ERROR__NONCE_INVALID]: "The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",
|
|
332
|
+
[SOLANA_ERROR__NOT_ALL_ACCOUNTS_DECODED]: "Not all accounts were decoded. Encoded accounts found at addresses: $addresses.",
|
|
333
|
+
[SOLANA_ERROR__NOT_AN_ED25519_PUBLIC_KEY]: "The `CryptoKey` must be an `Ed25519` public key.",
|
|
334
|
+
[SOLANA_ERROR__NOT_A_BASE58_ENCODED_ADDRESS]: "$putativeAddress is not a base58-encoded address.",
|
|
335
|
+
[SOLANA_ERROR__PROGRAM_ADDRESS_ENDS_WITH_PDA_MARKER]: "Program address cannot end with PDA marker.",
|
|
336
|
+
[SOLANA_ERROR__PROGRAM_DERIVED_ADDRESS_BUMP_SEED_OUT_OF_RANGE]: "Expected program derived address bump to be in the range [0, 255], got: $bump.",
|
|
337
|
+
[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`.",
|
|
338
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO_DIGEST_MISSING]: "No digest implementation could be found.",
|
|
339
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO_ED25519_ALGORITHM_MISSING]: "This runtime does not support the generation of Ed25519 key pairs.\n\nInstall and import `@solana/webcrypto-ed25519-polyfill` 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.",
|
|
340
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO_EXPORT_FUNCTION_MISSING]: "No signature verification implementation could be found.",
|
|
341
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO_GENERATE_FUNCTION_MISSING]: "No key generation implementation could be found.",
|
|
342
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO_MISSING]: "Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.",
|
|
343
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO_SIGN_FUNCTION_MISSING]: "No signing implementation could be found.",
|
|
344
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO_VERIFY_FUNCTION_MISSING]: "No key export implementation could be found.",
|
|
345
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_BORROW_OUTSTANDING]: "Transaction processing left an account with an outstanding borrowed reference",
|
|
346
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_IN_USE]: "Account in use",
|
|
347
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_LOADED_TWICE]: "Account loaded twice",
|
|
348
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_NOT_FOUND]: "Attempt to debit an account but found no record of a prior credit.",
|
|
349
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_ADDRESS_LOOKUP_TABLE_NOT_FOUND]: "Transaction loads an address table account that doesn't exist",
|
|
350
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_ALREADY_PROCESSED]: "This transaction has already been processed",
|
|
351
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_BLOCKHASH_NOT_FOUND]: "Blockhash not found",
|
|
352
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_CALL_CHAIN_TOO_DEEP]: "Loader call chain is too deep",
|
|
353
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_CLUSTER_MAINTENANCE]: "Transactions are currently disabled due to cluster maintenance",
|
|
354
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_DUPLICATE_INSTRUCTION]: "Transaction contains a duplicate instruction ($index) that is not allowed",
|
|
355
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INSUFFICIENT_FUNDS_FOR_FEE]: "Insufficient funds for fee",
|
|
356
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INSUFFICIENT_FUNDS_FOR_RENT]: "Transaction results in an account ($accountIndex) with insufficient funds for rent",
|
|
357
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ACCOUNT_FOR_FEE]: "This account may not be used to pay transaction fees",
|
|
358
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ACCOUNT_INDEX]: "Transaction contains an invalid account reference",
|
|
359
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ADDRESS_LOOKUP_TABLE_DATA]: "Transaction loads an address table account with invalid data",
|
|
360
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ADDRESS_LOOKUP_TABLE_INDEX]: "Transaction address table lookup uses an invalid index",
|
|
361
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ADDRESS_LOOKUP_TABLE_OWNER]: "Transaction loads an address table account with an invalid owner",
|
|
362
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_LOADED_ACCOUNTS_DATA_SIZE_LIMIT]: "LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",
|
|
363
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_PROGRAM_FOR_EXECUTION]: "This program may not be used for executing instructions",
|
|
364
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_RENT_PAYING_ACCOUNT]: "Transaction leaves an account with a lower balance than rent-exempt minimum",
|
|
365
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_WRITABLE_ACCOUNT]: "Transaction loads a writable account that cannot be written",
|
|
366
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_MAX_LOADED_ACCOUNTS_DATA_SIZE_EXCEEDED]: "Transaction exceeded max loaded accounts data size cap",
|
|
367
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_MISSING_SIGNATURE_FOR_FEE]: "Transaction requires a fee but has no signature present",
|
|
368
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_PROGRAM_ACCOUNT_NOT_FOUND]: "Attempt to load a program that does not exist",
|
|
369
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED]: "Execution of the program referenced by account at index $accountIndex is temporarily restricted.",
|
|
370
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_RESANITIZATION_NEEDED]: "ResanitizationNeeded",
|
|
371
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_SANITIZE_FAILURE]: "Transaction failed to sanitize accounts offsets correctly",
|
|
372
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_SIGNATURE_FAILURE]: "Transaction did not pass signature verification",
|
|
373
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_TOO_MANY_ACCOUNT_LOCKS]: "Transaction locked too many accounts",
|
|
374
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_UNBALANCED_TRANSACTION]: "Sum of account balances before and after transaction do not match",
|
|
375
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_UNKNOWN]: "The transaction failed with the error `$errorName`",
|
|
376
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_UNSUPPORTED_VERSION]: "Transaction version is unsupported",
|
|
377
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_ACCOUNT_DATA_BLOCK_LIMIT]: "Transaction would exceed account data limit within the block",
|
|
378
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_ACCOUNT_DATA_TOTAL_LIMIT]: "Transaction would exceed total account data limit",
|
|
379
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_MAX_ACCOUNT_COST_LIMIT]: "Transaction would exceed max account limit within the block",
|
|
380
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_MAX_BLOCK_COST_LIMIT]: "Transaction would exceed max Block Cost Limit",
|
|
381
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_MAX_VOTE_COST_LIMIT]: "Transaction would exceed max Vote Cost Limit",
|
|
382
|
+
[SOLANA_ERROR__TRANSACTION_EXPECTED_BLOCKHASH_LIFETIME]: "Transaction does not have a blockhash lifetime",
|
|
383
|
+
[SOLANA_ERROR__TRANSACTION_EXPECTED_NONCE_LIFETIME]: "Transaction is not a durable nonce transaction",
|
|
384
|
+
[SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING]: "Contents of these address lookup tables unknown: $lookupTableAddresses",
|
|
385
|
+
[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",
|
|
386
|
+
[SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_FEE_PAYER_MISSING]: "No fee payer set in CompiledTransaction",
|
|
387
|
+
[SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND]: "Could not find program address at index $index",
|
|
388
|
+
[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",
|
|
389
|
+
[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",
|
|
390
|
+
[SOLANA_ERROR__TRANSACTION_MISSING_SIGNATURES]: "Transaction is missing signatures for addresses: $addresses.",
|
|
391
|
+
[SOLANA_ERROR__TRANSACTION_SIGNATURE_NOT_COMPUTABLE]: "Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.",
|
|
392
|
+
[SOLANA_ERROR__TRANSACTION_VERSION_NUMBER_OUT_OF_RANGE]: "Transaction version must be in the range [0, 127]. `$actualVersion` given"
|
|
393
|
+
};
|
|
394
|
+
function getHumanReadableErrorMessage(code, context = {}) {
|
|
395
|
+
const messageFormatString = SolanaErrorMessages[code];
|
|
396
|
+
const message = messageFormatString.replace(
|
|
397
|
+
new RegExp("(?<!\\\\)\\$(\\w+)", "g"),
|
|
398
|
+
(substring, variableName) => variableName in context ? `${context[variableName]}` : substring
|
|
399
|
+
);
|
|
400
|
+
return message;
|
|
401
|
+
}
|
|
402
|
+
function getErrorMessage(code, context = {}) {
|
|
403
|
+
{
|
|
404
|
+
return getHumanReadableErrorMessage(code, context);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
function isSolanaError(e4, code) {
|
|
408
|
+
const isSolanaError2 = e4 instanceof Error && e4.name === "SolanaError";
|
|
409
|
+
if (isSolanaError2) {
|
|
410
|
+
if (code !== void 0) {
|
|
411
|
+
return e4.context.__code === code;
|
|
412
|
+
}
|
|
413
|
+
return true;
|
|
414
|
+
}
|
|
415
|
+
return false;
|
|
416
|
+
}
|
|
417
|
+
var SolanaError = class extends Error {
|
|
418
|
+
constructor(...[code, context]) {
|
|
419
|
+
const message = getErrorMessage(code, context);
|
|
420
|
+
super(message);
|
|
421
|
+
__publicField(this, "context");
|
|
422
|
+
this.context = {
|
|
423
|
+
__code: code,
|
|
424
|
+
...context
|
|
425
|
+
};
|
|
426
|
+
this.name = "SolanaError";
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
function getSolanaErrorFromRpcError({ errorCodeBaseOffset, getErrorContext, orderedErrorNames, rpcEnumError }, constructorOpt) {
|
|
430
|
+
let rpcErrorName;
|
|
431
|
+
let rpcErrorContext;
|
|
432
|
+
if (typeof rpcEnumError === "string") {
|
|
433
|
+
rpcErrorName = rpcEnumError;
|
|
434
|
+
} else {
|
|
435
|
+
rpcErrorName = Object.keys(rpcEnumError)[0];
|
|
436
|
+
rpcErrorContext = rpcEnumError[rpcErrorName];
|
|
437
|
+
}
|
|
438
|
+
const codeOffset = orderedErrorNames.indexOf(rpcErrorName);
|
|
439
|
+
const errorCode = errorCodeBaseOffset + codeOffset;
|
|
440
|
+
const errorContext = getErrorContext(errorCode, rpcErrorName, rpcErrorContext);
|
|
441
|
+
const err = new SolanaError(errorCode, errorContext);
|
|
442
|
+
if ("captureStackTrace" in Error && typeof Error.captureStackTrace === "function") {
|
|
443
|
+
Error.captureStackTrace(err, constructorOpt);
|
|
444
|
+
}
|
|
445
|
+
return err;
|
|
446
|
+
}
|
|
447
|
+
var ORDERED_ERROR_NAMES = [
|
|
448
|
+
// Keep synced with RPC source: https://github.com/anza-xyz/agave/blob/master/sdk/program/src/instruction.rs
|
|
449
|
+
// If this list ever gets too large, consider implementing a compression strategy like this:
|
|
450
|
+
// https://gist.github.com/steveluscher/aaa7cbbb5433b1197983908a40860c47
|
|
451
|
+
"GenericError",
|
|
452
|
+
"InvalidArgument",
|
|
453
|
+
"InvalidInstructionData",
|
|
454
|
+
"InvalidAccountData",
|
|
455
|
+
"AccountDataTooSmall",
|
|
456
|
+
"InsufficientFunds",
|
|
457
|
+
"IncorrectProgramId",
|
|
458
|
+
"MissingRequiredSignature",
|
|
459
|
+
"AccountAlreadyInitialized",
|
|
460
|
+
"UninitializedAccount",
|
|
461
|
+
"UnbalancedInstruction",
|
|
462
|
+
"ModifiedProgramId",
|
|
463
|
+
"ExternalAccountLamportSpend",
|
|
464
|
+
"ExternalAccountDataModified",
|
|
465
|
+
"ReadonlyLamportChange",
|
|
466
|
+
"ReadonlyDataModified",
|
|
467
|
+
"DuplicateAccountIndex",
|
|
468
|
+
"ExecutableModified",
|
|
469
|
+
"RentEpochModified",
|
|
470
|
+
"NotEnoughAccountKeys",
|
|
471
|
+
"AccountDataSizeChanged",
|
|
472
|
+
"AccountNotExecutable",
|
|
473
|
+
"AccountBorrowFailed",
|
|
474
|
+
"AccountBorrowOutstanding",
|
|
475
|
+
"DuplicateAccountOutOfSync",
|
|
476
|
+
"Custom",
|
|
477
|
+
"InvalidError",
|
|
478
|
+
"ExecutableDataModified",
|
|
479
|
+
"ExecutableLamportChange",
|
|
480
|
+
"ExecutableAccountNotRentExempt",
|
|
481
|
+
"UnsupportedProgramId",
|
|
482
|
+
"CallDepth",
|
|
483
|
+
"MissingAccount",
|
|
484
|
+
"ReentrancyNotAllowed",
|
|
485
|
+
"MaxSeedLengthExceeded",
|
|
486
|
+
"InvalidSeeds",
|
|
487
|
+
"InvalidRealloc",
|
|
488
|
+
"ComputationalBudgetExceeded",
|
|
489
|
+
"PrivilegeEscalation",
|
|
490
|
+
"ProgramEnvironmentSetupFailure",
|
|
491
|
+
"ProgramFailedToComplete",
|
|
492
|
+
"ProgramFailedToCompile",
|
|
493
|
+
"Immutable",
|
|
494
|
+
"IncorrectAuthority",
|
|
495
|
+
"BorshIoError",
|
|
496
|
+
"AccountNotRentExempt",
|
|
497
|
+
"InvalidAccountOwner",
|
|
498
|
+
"ArithmeticOverflow",
|
|
499
|
+
"UnsupportedSysvar",
|
|
500
|
+
"IllegalOwner",
|
|
501
|
+
"MaxAccountsDataAllocationsExceeded",
|
|
502
|
+
"MaxAccountsExceeded",
|
|
503
|
+
"MaxInstructionTraceLengthExceeded",
|
|
504
|
+
"BuiltinProgramsMustConsumeComputeUnits"
|
|
505
|
+
];
|
|
506
|
+
function getSolanaErrorFromInstructionError(index, instructionError) {
|
|
507
|
+
return getSolanaErrorFromRpcError(
|
|
508
|
+
{
|
|
509
|
+
errorCodeBaseOffset: 4615001,
|
|
510
|
+
getErrorContext(errorCode, rpcErrorName, rpcErrorContext) {
|
|
511
|
+
if (errorCode === SOLANA_ERROR__INSTRUCTION_ERROR_UNKNOWN) {
|
|
512
|
+
return {
|
|
513
|
+
errorName: rpcErrorName,
|
|
514
|
+
index,
|
|
515
|
+
...rpcErrorContext !== void 0 ? { instructionErrorContext: rpcErrorContext } : null
|
|
516
|
+
};
|
|
517
|
+
} else if (errorCode === SOLANA_ERROR__INSTRUCTION_ERROR_CUSTOM) {
|
|
518
|
+
return {
|
|
519
|
+
code: rpcErrorContext,
|
|
520
|
+
index
|
|
521
|
+
};
|
|
522
|
+
} else if (errorCode === SOLANA_ERROR__INSTRUCTION_ERROR_BORSH_IO_ERROR) {
|
|
523
|
+
return {
|
|
524
|
+
encodedData: rpcErrorContext,
|
|
525
|
+
index
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
return { index };
|
|
529
|
+
},
|
|
530
|
+
orderedErrorNames: ORDERED_ERROR_NAMES,
|
|
531
|
+
rpcEnumError: instructionError
|
|
532
|
+
},
|
|
533
|
+
getSolanaErrorFromInstructionError
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
var ORDERED_ERROR_NAMES2 = [
|
|
537
|
+
// Keep synced with RPC source: https://github.com/anza-xyz/agave/blob/master/sdk/src/transaction/error.rs
|
|
538
|
+
// If this list ever gets too large, consider implementing a compression strategy like this:
|
|
539
|
+
// https://gist.github.com/steveluscher/aaa7cbbb5433b1197983908a40860c47
|
|
540
|
+
"AccountInUse",
|
|
541
|
+
"AccountLoadedTwice",
|
|
542
|
+
"AccountNotFound",
|
|
543
|
+
"ProgramAccountNotFound",
|
|
544
|
+
"InsufficientFundsForFee",
|
|
545
|
+
"InvalidAccountForFee",
|
|
546
|
+
"AlreadyProcessed",
|
|
547
|
+
"BlockhashNotFound",
|
|
548
|
+
// `InstructionError` intentionally omitted; delegated to `getSolanaErrorFromInstructionError`
|
|
549
|
+
"CallChainTooDeep",
|
|
550
|
+
"MissingSignatureForFee",
|
|
551
|
+
"InvalidAccountIndex",
|
|
552
|
+
"SignatureFailure",
|
|
553
|
+
"InvalidProgramForExecution",
|
|
554
|
+
"SanitizeFailure",
|
|
555
|
+
"ClusterMaintenance",
|
|
556
|
+
"AccountBorrowOutstanding",
|
|
557
|
+
"WouldExceedMaxBlockCostLimit",
|
|
558
|
+
"UnsupportedVersion",
|
|
559
|
+
"InvalidWritableAccount",
|
|
560
|
+
"WouldExceedMaxAccountCostLimit",
|
|
561
|
+
"WouldExceedAccountDataBlockLimit",
|
|
562
|
+
"TooManyAccountLocks",
|
|
563
|
+
"AddressLookupTableNotFound",
|
|
564
|
+
"InvalidAddressLookupTableOwner",
|
|
565
|
+
"InvalidAddressLookupTableData",
|
|
566
|
+
"InvalidAddressLookupTableIndex",
|
|
567
|
+
"InvalidRentPayingAccount",
|
|
568
|
+
"WouldExceedMaxVoteCostLimit",
|
|
569
|
+
"WouldExceedAccountDataTotalLimit",
|
|
570
|
+
"DuplicateInstruction",
|
|
571
|
+
"InsufficientFundsForRent",
|
|
572
|
+
"MaxLoadedAccountsDataSizeExceeded",
|
|
573
|
+
"InvalidLoadedAccountsDataSizeLimit",
|
|
574
|
+
"ResanitizationNeeded",
|
|
575
|
+
"ProgramExecutionTemporarilyRestricted",
|
|
576
|
+
"UnbalancedTransaction"
|
|
577
|
+
];
|
|
578
|
+
function getSolanaErrorFromTransactionError(transactionError) {
|
|
579
|
+
if (typeof transactionError === "object" && "InstructionError" in transactionError) {
|
|
580
|
+
return getSolanaErrorFromInstructionError(
|
|
581
|
+
...transactionError.InstructionError
|
|
582
|
+
);
|
|
583
|
+
}
|
|
584
|
+
return getSolanaErrorFromRpcError(
|
|
585
|
+
{
|
|
586
|
+
errorCodeBaseOffset: 7050001,
|
|
587
|
+
getErrorContext(errorCode, rpcErrorName, rpcErrorContext) {
|
|
588
|
+
if (errorCode === SOLANA_ERROR__TRANSACTION_ERROR_UNKNOWN) {
|
|
589
|
+
return {
|
|
590
|
+
errorName: rpcErrorName,
|
|
591
|
+
...rpcErrorContext !== void 0 ? { transactionErrorContext: rpcErrorContext } : null
|
|
592
|
+
};
|
|
593
|
+
} else if (errorCode === SOLANA_ERROR__TRANSACTION_ERROR_DUPLICATE_INSTRUCTION) {
|
|
594
|
+
return {
|
|
595
|
+
index: rpcErrorContext
|
|
596
|
+
};
|
|
597
|
+
} else if (errorCode === SOLANA_ERROR__TRANSACTION_ERROR_INSUFFICIENT_FUNDS_FOR_RENT || errorCode === SOLANA_ERROR__TRANSACTION_ERROR_PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED) {
|
|
598
|
+
return {
|
|
599
|
+
accountIndex: rpcErrorContext.account_index
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
},
|
|
603
|
+
orderedErrorNames: ORDERED_ERROR_NAMES2,
|
|
604
|
+
rpcEnumError: transactionError
|
|
605
|
+
},
|
|
606
|
+
getSolanaErrorFromTransactionError
|
|
607
|
+
);
|
|
608
|
+
}
|
|
609
|
+
|
|
128
610
|
// ../codecs-strings/dist/index.browser.js
|
|
129
611
|
init_env_shim();
|
|
130
612
|
|
|
@@ -858,10 +1340,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
858
1340
|
return encodedAccount;
|
|
859
1341
|
}
|
|
860
1342
|
return Object.freeze({ ...encodedAccount, data: decoder.decode(encodedAccount.data) });
|
|
861
|
-
} catch (
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
1343
|
+
} catch (e4) {
|
|
1344
|
+
throw new SolanaError(SOLANA_ERROR__FAILED_TO_DECODE_ACCOUNT, {
|
|
1345
|
+
address: encodedAccount.address
|
|
1346
|
+
});
|
|
865
1347
|
}
|
|
866
1348
|
}
|
|
867
1349
|
function accountExists(account) {
|
|
@@ -869,14 +1351,18 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
869
1351
|
}
|
|
870
1352
|
function assertAccountDecoded(account) {
|
|
871
1353
|
if (accountExists(account) && account.data instanceof Uint8Array) {
|
|
872
|
-
throw new
|
|
1354
|
+
throw new SolanaError(SOLANA_ERROR__EXPECTED_DECODED_ACCOUNT, {
|
|
1355
|
+
address: account.address
|
|
1356
|
+
});
|
|
873
1357
|
}
|
|
874
1358
|
}
|
|
875
1359
|
function assertAccountsDecoded(accounts) {
|
|
876
1360
|
const encoded = accounts.filter((a) => accountExists(a) && a.data instanceof Uint8Array);
|
|
877
1361
|
if (encoded.length > 0) {
|
|
878
|
-
const encodedAddresses = encoded.map((a) => a.address)
|
|
879
|
-
throw new
|
|
1362
|
+
const encodedAddresses = encoded.map((a) => a.address);
|
|
1363
|
+
throw new SolanaError(SOLANA_ERROR__NOT_ALL_ACCOUNTS_DECODED, {
|
|
1364
|
+
addresses: encodedAddresses
|
|
1365
|
+
});
|
|
880
1366
|
}
|
|
881
1367
|
}
|
|
882
1368
|
function parseBase64RpcAccount(address2, rpcAccount) {
|
|
@@ -928,14 +1414,14 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
928
1414
|
}
|
|
929
1415
|
function assertAccountExists(account) {
|
|
930
1416
|
if (!account.exists) {
|
|
931
|
-
throw new
|
|
1417
|
+
throw new SolanaError(SOLANA_ERROR__ACCOUNT_NOT_FOUND, { address: account.address });
|
|
932
1418
|
}
|
|
933
1419
|
}
|
|
934
1420
|
function assertAccountsExist(accounts) {
|
|
935
1421
|
const missingAccounts = accounts.filter((a) => !a.exists);
|
|
936
1422
|
if (missingAccounts.length > 0) {
|
|
937
1423
|
const missingAddresses = missingAccounts.map((a) => a.address);
|
|
938
|
-
throw new
|
|
1424
|
+
throw new SolanaError(SOLANA_ERROR__MULTIPLE_ACCOUNTS_NOT_FOUND, { addresses: missingAddresses });
|
|
939
1425
|
}
|
|
940
1426
|
}
|
|
941
1427
|
|
|
@@ -946,9 +1432,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
946
1432
|
init_env_shim();
|
|
947
1433
|
function assertIsSecureContext() {
|
|
948
1434
|
if (!globalThis.isSecureContext) {
|
|
949
|
-
throw new
|
|
950
|
-
"Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts"
|
|
951
|
-
);
|
|
1435
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_MISSING);
|
|
952
1436
|
}
|
|
953
1437
|
}
|
|
954
1438
|
var cachedEd25519Decision;
|
|
@@ -977,40 +1461,38 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
977
1461
|
var _a;
|
|
978
1462
|
assertIsSecureContext();
|
|
979
1463
|
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.digest) !== "function") {
|
|
980
|
-
throw new
|
|
1464
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_DIGEST_MISSING);
|
|
981
1465
|
}
|
|
982
1466
|
}
|
|
983
1467
|
async function assertKeyGenerationIsAvailable() {
|
|
984
1468
|
var _a;
|
|
985
1469
|
assertIsSecureContext();
|
|
986
1470
|
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.generateKey) !== "function") {
|
|
987
|
-
throw new
|
|
1471
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_GENERATE_FUNCTION_MISSING);
|
|
988
1472
|
}
|
|
989
1473
|
if (!await isEd25519CurveSupported(globalThis.crypto.subtle)) {
|
|
990
|
-
throw new
|
|
991
|
-
"This runtime does not support the generation of Ed25519 key pairs.\n\nInstall and import `@solana/webcrypto-ed25519-polyfill` 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"
|
|
992
|
-
);
|
|
1474
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_ED25519_ALGORITHM_MISSING);
|
|
993
1475
|
}
|
|
994
1476
|
}
|
|
995
1477
|
async function assertKeyExporterIsAvailable() {
|
|
996
1478
|
var _a;
|
|
997
1479
|
assertIsSecureContext();
|
|
998
1480
|
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.exportKey) !== "function") {
|
|
999
|
-
throw new
|
|
1481
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_EXPORT_FUNCTION_MISSING);
|
|
1000
1482
|
}
|
|
1001
1483
|
}
|
|
1002
1484
|
async function assertSigningCapabilityIsAvailable() {
|
|
1003
1485
|
var _a;
|
|
1004
1486
|
assertIsSecureContext();
|
|
1005
1487
|
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.sign) !== "function") {
|
|
1006
|
-
throw new
|
|
1488
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_SIGN_FUNCTION_MISSING);
|
|
1007
1489
|
}
|
|
1008
1490
|
}
|
|
1009
1491
|
async function assertVerificationCapabilityIsAvailable() {
|
|
1010
1492
|
var _a;
|
|
1011
1493
|
assertIsSecureContext();
|
|
1012
1494
|
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.verify) !== "function") {
|
|
1013
|
-
throw new
|
|
1495
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_VERIFY_FUNCTION_MISSING);
|
|
1014
1496
|
}
|
|
1015
1497
|
}
|
|
1016
1498
|
|
|
@@ -1050,18 +1532,20 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1050
1532
|
putativeAddress.length < 32 || // Highest address (32 bytes of 255)
|
|
1051
1533
|
putativeAddress.length > 44
|
|
1052
1534
|
) {
|
|
1053
|
-
throw new
|
|
1535
|
+
throw new SolanaError(SOLANA_ERROR__INCORRECT_BASE58_ADDRESS_LENGTH, {
|
|
1536
|
+
actualLength: putativeAddress.length
|
|
1537
|
+
});
|
|
1054
1538
|
}
|
|
1055
1539
|
const base58Encoder4 = getMemoizedBase58Encoder();
|
|
1056
1540
|
const bytes = base58Encoder4.encode(putativeAddress);
|
|
1057
1541
|
const numBytes = bytes.byteLength;
|
|
1058
1542
|
if (numBytes !== 32) {
|
|
1059
|
-
throw new
|
|
1543
|
+
throw new SolanaError(SOLANA_ERROR__INCORRECT_BASE58_ADDRESS_BYTE_LENGTH, {
|
|
1544
|
+
actualLength: numBytes
|
|
1545
|
+
});
|
|
1060
1546
|
}
|
|
1061
1547
|
} catch (e4) {
|
|
1062
|
-
throw new
|
|
1063
|
-
cause: e4
|
|
1064
|
-
});
|
|
1548
|
+
throw new SolanaError(SOLANA_ERROR__NOT_A_BASE58_ENCODED_ADDRESS, { putativeAddress });
|
|
1065
1549
|
}
|
|
1066
1550
|
}
|
|
1067
1551
|
function address(putativeAddress) {
|
|
@@ -1182,12 +1666,12 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1182
1666
|
function assertIsProgramDerivedAddress(value) {
|
|
1183
1667
|
const validFormat = Array.isArray(value) && value.length === 2 && typeof value[0] === "string" && typeof value[1] === "number";
|
|
1184
1668
|
if (!validFormat) {
|
|
1185
|
-
throw new
|
|
1186
|
-
`Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].`
|
|
1187
|
-
);
|
|
1669
|
+
throw new SolanaError(SOLANA_ERROR__MALFORMED_PROGRAM_DERIVED_ADDRESS);
|
|
1188
1670
|
}
|
|
1189
1671
|
if (value[1] < 0 || value[1] > 255) {
|
|
1190
|
-
throw new
|
|
1672
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_DERIVED_ADDRESS_BUMP_SEED_OUT_OF_RANGE, {
|
|
1673
|
+
bump: value[1]
|
|
1674
|
+
});
|
|
1191
1675
|
}
|
|
1192
1676
|
assertIsAddress(value[0]);
|
|
1193
1677
|
}
|
|
@@ -1217,18 +1701,23 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1217
1701
|
115,
|
|
1218
1702
|
115
|
|
1219
1703
|
];
|
|
1220
|
-
var PointOnCurveError = class extends Error {
|
|
1221
|
-
};
|
|
1222
1704
|
async function createProgramDerivedAddress({ programAddress, seeds }) {
|
|
1223
1705
|
await assertDigestCapabilityIsAvailable();
|
|
1224
1706
|
if (seeds.length > MAX_SEEDS) {
|
|
1225
|
-
throw new
|
|
1707
|
+
throw new SolanaError(SOLANA_ERROR__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED, {
|
|
1708
|
+
actual: seeds.length,
|
|
1709
|
+
maxSeeds: MAX_SEEDS
|
|
1710
|
+
});
|
|
1226
1711
|
}
|
|
1227
1712
|
let textEncoder;
|
|
1228
1713
|
const seedBytes = seeds.reduce((acc, seed, ii) => {
|
|
1229
1714
|
const bytes = typeof seed === "string" ? (textEncoder || (textEncoder = new TextEncoder())).encode(seed) : seed;
|
|
1230
1715
|
if (bytes.byteLength > MAX_SEED_LENGTH) {
|
|
1231
|
-
throw new
|
|
1716
|
+
throw new SolanaError(SOLANA_ERROR__MAX_PDA_SEED_LENGTH_EXCEEDED, {
|
|
1717
|
+
actual: bytes.byteLength,
|
|
1718
|
+
index: ii,
|
|
1719
|
+
maxSeedLength: MAX_SEED_LENGTH
|
|
1720
|
+
});
|
|
1232
1721
|
}
|
|
1233
1722
|
acc.push(...bytes);
|
|
1234
1723
|
return acc;
|
|
@@ -1241,7 +1730,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1241
1730
|
);
|
|
1242
1731
|
const addressBytes = new Uint8Array(addressBytesBuffer);
|
|
1243
1732
|
if (await compressedPointBytesAreOnCurve(addressBytes)) {
|
|
1244
|
-
throw new
|
|
1733
|
+
throw new SolanaError(SOLANA_ERROR__INVALID_SEEDS_POINT_ON_CURVE);
|
|
1245
1734
|
}
|
|
1246
1735
|
return base58EncodedAddressCodec.decode(addressBytes);
|
|
1247
1736
|
}
|
|
@@ -1258,24 +1747,28 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1258
1747
|
});
|
|
1259
1748
|
return [address2, bumpSeed];
|
|
1260
1749
|
} catch (e4) {
|
|
1261
|
-
if (e4
|
|
1750
|
+
if (isSolanaError(e4, SOLANA_ERROR__INVALID_SEEDS_POINT_ON_CURVE)) {
|
|
1262
1751
|
bumpSeed--;
|
|
1263
1752
|
} else {
|
|
1264
1753
|
throw e4;
|
|
1265
1754
|
}
|
|
1266
1755
|
}
|
|
1267
1756
|
}
|
|
1268
|
-
throw new
|
|
1757
|
+
throw new SolanaError(SOLANA_ERROR__COULD_NOT_FIND_VIABLE_PDA_BUMP_SEED);
|
|
1269
1758
|
}
|
|
1270
1759
|
async function createAddressWithSeed({ baseAddress, programAddress, seed }) {
|
|
1271
1760
|
const { encode, decode } = getAddressCodec();
|
|
1272
1761
|
const seedBytes = typeof seed === "string" ? new TextEncoder().encode(seed) : seed;
|
|
1273
1762
|
if (seedBytes.byteLength > MAX_SEED_LENGTH) {
|
|
1274
|
-
throw new
|
|
1763
|
+
throw new SolanaError(SOLANA_ERROR__MAX_PDA_SEED_LENGTH_EXCEEDED, {
|
|
1764
|
+
actual: seedBytes.byteLength,
|
|
1765
|
+
index: 0,
|
|
1766
|
+
maxSeedLength: MAX_SEED_LENGTH
|
|
1767
|
+
});
|
|
1275
1768
|
}
|
|
1276
1769
|
const programAddressBytes = encode(programAddress);
|
|
1277
1770
|
if (programAddressBytes.length >= PDA_MARKER_BYTES.length && programAddressBytes.slice(-PDA_MARKER_BYTES.length).every((byte, index) => byte === PDA_MARKER_BYTES[index])) {
|
|
1278
|
-
throw new
|
|
1771
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_ADDRESS_ENDS_WITH_PDA_MARKER);
|
|
1279
1772
|
}
|
|
1280
1773
|
const addressBytesBuffer = await crypto.subtle.digest(
|
|
1281
1774
|
"SHA-256",
|
|
@@ -1287,7 +1780,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1287
1780
|
async function getAddressFromPublicKey(publicKey) {
|
|
1288
1781
|
await assertKeyExporterIsAvailable();
|
|
1289
1782
|
if (publicKey.type !== "public" || publicKey.algorithm.name !== "Ed25519") {
|
|
1290
|
-
throw new
|
|
1783
|
+
throw new SolanaError(SOLANA_ERROR__NOT_AN_ED25519_PUBLIC_KEY);
|
|
1291
1784
|
}
|
|
1292
1785
|
const publicKeyBytes = await crypto.subtle.exportKey("raw", publicKey);
|
|
1293
1786
|
return getAddressDecoder().decode(new Uint8Array(publicKeyBytes));
|
|
@@ -1980,52 +2473,6 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1980
2473
|
|
|
1981
2474
|
// ../keys/dist/index.browser.js
|
|
1982
2475
|
init_env_shim();
|
|
1983
|
-
|
|
1984
|
-
// ../errors/dist/index.browser.js
|
|
1985
|
-
init_env_shim();
|
|
1986
|
-
var SOLANA_ERROR__TRANSACTION_MISSING_SIGNATURES = 1;
|
|
1987
|
-
var SOLANA_ERROR__TRANSACTION_SIGNATURE_NOT_COMPUTABLE = 2;
|
|
1988
|
-
var SOLANA_ERROR__RPC_INTEGER_OVERFLOW = 3;
|
|
1989
|
-
var SOLANA_ERROR__INVALID_KEYPAIR_BYTES = 4;
|
|
1990
|
-
var SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED = 5;
|
|
1991
|
-
var SOLANA_ERROR__NONCE_INVALID = 6;
|
|
1992
|
-
var SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND = 7;
|
|
1993
|
-
var SolanaErrorMessages = {
|
|
1994
|
-
[SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED]: "The network has progressed past the last block for which this transaction could have been committed.",
|
|
1995
|
-
[SOLANA_ERROR__INVALID_KEYPAIR_BYTES]: "Key pair bytes must be of length 64, got $byteLength.",
|
|
1996
|
-
[SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND]: "No nonce account could be found at address `$nonceAccountAddress`",
|
|
1997
|
-
[SOLANA_ERROR__NONCE_INVALID]: "The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",
|
|
1998
|
-
[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`.",
|
|
1999
|
-
[SOLANA_ERROR__TRANSACTION_MISSING_SIGNATURES]: "Transaction is missing signatures for addresses: $addresses.",
|
|
2000
|
-
[SOLANA_ERROR__TRANSACTION_SIGNATURE_NOT_COMPUTABLE]: "Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer."
|
|
2001
|
-
};
|
|
2002
|
-
function getHumanReadableErrorMessage(code, context = {}) {
|
|
2003
|
-
const messageFormatString = SolanaErrorMessages[code];
|
|
2004
|
-
const message = messageFormatString.replace(
|
|
2005
|
-
new RegExp("(?<!\\\\)\\$(\\w+)", "g"),
|
|
2006
|
-
(substring, variableName) => variableName in context ? `${context[variableName]}` : substring
|
|
2007
|
-
);
|
|
2008
|
-
return message;
|
|
2009
|
-
}
|
|
2010
|
-
function getErrorMessage(code, context = {}) {
|
|
2011
|
-
{
|
|
2012
|
-
return getHumanReadableErrorMessage(code, context);
|
|
2013
|
-
}
|
|
2014
|
-
}
|
|
2015
|
-
var SolanaError = class extends Error {
|
|
2016
|
-
constructor(...[code, context]) {
|
|
2017
|
-
const message = getErrorMessage(code, context);
|
|
2018
|
-
super(message);
|
|
2019
|
-
__publicField(this, "context");
|
|
2020
|
-
this.context = {
|
|
2021
|
-
__code: code,
|
|
2022
|
-
...context
|
|
2023
|
-
};
|
|
2024
|
-
this.name = "SolanaError";
|
|
2025
|
-
}
|
|
2026
|
-
};
|
|
2027
|
-
|
|
2028
|
-
// ../keys/dist/index.browser.js
|
|
2029
2476
|
function addPkcs8Header(bytes) {
|
|
2030
2477
|
return new Uint8Array([
|
|
2031
2478
|
/**
|
|
@@ -4006,7 +4453,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4006
4453
|
}
|
|
4007
4454
|
function assertIsTransactionWithBlockhashLifetime(transaction) {
|
|
4008
4455
|
if (!isTransactionWithBlockhashLifetime(transaction)) {
|
|
4009
|
-
throw new
|
|
4456
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_EXPECTED_BLOCKHASH_LIFETIME);
|
|
4010
4457
|
}
|
|
4011
4458
|
}
|
|
4012
4459
|
function setTransactionLifetimeUsingBlockhash(blockhashLifetimeConstraint, transaction) {
|
|
@@ -4055,7 +4502,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4055
4502
|
var SYSTEM_PROGRAM_ADDRESS = "11111111111111111111111111111111";
|
|
4056
4503
|
function assertIsDurableNonceTransaction(transaction) {
|
|
4057
4504
|
if (!isDurableNonceTransaction(transaction)) {
|
|
4058
|
-
throw new
|
|
4505
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_EXPECTED_NONCE_LIFETIME);
|
|
4059
4506
|
}
|
|
4060
4507
|
}
|
|
4061
4508
|
function createAdvanceNonceAccountInstruction(nonceAccountAddress, nonceAuthorityAddress) {
|
|
@@ -4199,8 +4646,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4199
4646
|
const compiledAddressTableLookupAddresses = compiledAddressTableLookups.map((l) => l.lookupTableAddress);
|
|
4200
4647
|
const missing = compiledAddressTableLookupAddresses.filter((a) => addressesByLookupTableAddress[a] === void 0);
|
|
4201
4648
|
if (missing.length > 0) {
|
|
4202
|
-
|
|
4203
|
-
|
|
4649
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING, {
|
|
4650
|
+
lookupTableAddresses: missing
|
|
4651
|
+
});
|
|
4204
4652
|
}
|
|
4205
4653
|
const readOnlyMetas = [];
|
|
4206
4654
|
const writableMetas = [];
|
|
@@ -4208,8 +4656,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4208
4656
|
const addresses = addressesByLookupTableAddress[lookup.lookupTableAddress];
|
|
4209
4657
|
const highestIndex = Math.max(...lookup.readableIndices, ...lookup.writableIndices);
|
|
4210
4658
|
if (highestIndex >= addresses.length) {
|
|
4211
|
-
throw new
|
|
4212
|
-
|
|
4659
|
+
throw new SolanaError(
|
|
4660
|
+
SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE,
|
|
4661
|
+
{
|
|
4662
|
+
highestKnownIndex: addresses.length - 1,
|
|
4663
|
+
highestRequestedIndex: highestIndex,
|
|
4664
|
+
lookupTableAddress: lookup.lookupTableAddress
|
|
4665
|
+
}
|
|
4213
4666
|
);
|
|
4214
4667
|
}
|
|
4215
4668
|
const readOnlyForLookup = lookup.readableIndices.map((r) => ({
|
|
@@ -4233,7 +4686,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4233
4686
|
var _a, _b;
|
|
4234
4687
|
const programAddress = (_a = accountMetas[instruction.programAddressIndex]) == null ? void 0 : _a.address;
|
|
4235
4688
|
if (!programAddress) {
|
|
4236
|
-
throw new
|
|
4689
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND, {
|
|
4690
|
+
index: instruction.programAddressIndex
|
|
4691
|
+
});
|
|
4237
4692
|
}
|
|
4238
4693
|
const accounts = (_b = instruction.accountIndices) == null ? void 0 : _b.map((accountIndex) => accountMetas[accountIndex]);
|
|
4239
4694
|
const { data } = instruction;
|
|
@@ -4279,8 +4734,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4279
4734
|
var _a;
|
|
4280
4735
|
const { compiledMessage } = compiledTransaction;
|
|
4281
4736
|
const feePayer = compiledMessage.staticAccounts[0];
|
|
4282
|
-
if (!feePayer)
|
|
4283
|
-
throw new
|
|
4737
|
+
if (!feePayer) {
|
|
4738
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_FEE_PAYER_MISSING);
|
|
4739
|
+
}
|
|
4284
4740
|
const accountMetas = getAccountMetas(compiledMessage);
|
|
4285
4741
|
const accountLookupMetas = "addressTableLookups" in compiledMessage && compiledMessage.addressTableLookups !== void 0 && compiledMessage.addressTableLookups.length > 0 ? getAddressLookupMetas(compiledMessage.addressTableLookups, (_a = config == null ? void 0 : config.addressesByLookupTableAddress) != null ? _a : {}) : [];
|
|
4286
4742
|
const transactionMetas = [...accountMetas, ...accountLookupMetas];
|
|
@@ -4321,13 +4777,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4321
4777
|
if (isWritableRole2(entry.role)) {
|
|
4322
4778
|
switch (entry[TYPE]) {
|
|
4323
4779
|
case 0:
|
|
4324
|
-
throw new
|
|
4325
|
-
|
|
4326
|
-
);
|
|
4780
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_INVOKED_PROGRAMS_CANNOT_PAY_FEES, {
|
|
4781
|
+
programAddress: instruction.programAddress
|
|
4782
|
+
});
|
|
4327
4783
|
default:
|
|
4328
|
-
throw new
|
|
4329
|
-
|
|
4330
|
-
);
|
|
4784
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE, {
|
|
4785
|
+
programAddress: instruction.programAddress
|
|
4786
|
+
});
|
|
4331
4787
|
}
|
|
4332
4788
|
}
|
|
4333
4789
|
if (entry[TYPE] === 2) {
|
|
@@ -4392,8 +4848,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4392
4848
|
addressesOfInvokedPrograms.has(account.address)
|
|
4393
4849
|
) {
|
|
4394
4850
|
if (isWritableRole2(accountMeta.role)) {
|
|
4395
|
-
throw new
|
|
4396
|
-
|
|
4851
|
+
throw new SolanaError(
|
|
4852
|
+
SOLANA_ERROR__TRANSACTION_INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE,
|
|
4853
|
+
{
|
|
4854
|
+
programAddress: account.address
|
|
4855
|
+
}
|
|
4397
4856
|
);
|
|
4398
4857
|
}
|
|
4399
4858
|
if (entry.role !== nextRole) {
|
|
@@ -4677,7 +5136,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4677
5136
|
return offset;
|
|
4678
5137
|
}
|
|
4679
5138
|
if (value < 0 || value > 127) {
|
|
4680
|
-
throw new
|
|
5139
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_VERSION_NUMBER_OUT_OF_RANGE, {
|
|
5140
|
+
actualVersion: value
|
|
5141
|
+
});
|
|
4681
5142
|
}
|
|
4682
5143
|
bytes.set([value | VERSION_FLAG_MASK], offset);
|
|
4683
5144
|
return offset + 1;
|
|
@@ -5312,9 +5773,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5312
5773
|
const signatureDidCommitPromise = (async () => {
|
|
5313
5774
|
for await (const signatureStatusNotification of signatureStatusNotifications) {
|
|
5314
5775
|
if (signatureStatusNotification.value.err) {
|
|
5315
|
-
throw
|
|
5316
|
-
cause: signatureStatusNotification.value.err
|
|
5317
|
-
});
|
|
5776
|
+
throw getSolanaErrorFromTransactionError(signatureStatusNotification.value.err);
|
|
5318
5777
|
} else {
|
|
5319
5778
|
return;
|
|
5320
5779
|
}
|