@solana/web3.js 2.0.0-experimental.a64df70 → 2.0.0-experimental.a71a2db
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 +773 -152
- package/dist/index.development.js.map +1 -1
- package/dist/index.production.min.js +274 -278
- package/package.json +16 -16
|
@@ -125,6 +125,530 @@ 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__CODECS_CANNOT_DECODE_EMPTY_BYTE_ARRAY = 31;
|
|
159
|
+
var SOLANA_ERROR__CODECS_WRONG_NUMBER_OF_BYTES = 32;
|
|
160
|
+
var SOLANA_ERROR__CODECS_EXPECTED_FIXED_LENGTH_GOT_VARIABLE_LENGTH = 33;
|
|
161
|
+
var SOLANA_ERROR__CODECS_EXPECTED_VARIABLE_LENGTH_GOT_FIXED_LENGTH = 34;
|
|
162
|
+
var SOLANA_ERROR__CODECS_ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH = 35;
|
|
163
|
+
var SOLANA_ERROR__CODECS_FIXED_SIZE_ENCODER_DECODER_SIZE_MISMATCH = 36;
|
|
164
|
+
var SOLANA_ERROR__CODECS_VARIABLE_SIZE_ENCODER_DECODER_MAX_SIZE_MISMATCH = 37;
|
|
165
|
+
var SOLANA_ERROR__CODECS_CANNOT_REVERSE_CODEC_OF_VARIABLE_SIZE = 38;
|
|
166
|
+
var SOLANA_ERROR__CODECS_WRONG_NUMBER_OF_ITEMS = 39;
|
|
167
|
+
var SOLANA_ERROR__CODECS_ENUM_DISCRIMINATOR_OUT_OF_RANGE = 40;
|
|
168
|
+
var SOLANA_ERROR__CODECS_INVALID_DATA_ENUM_VARIANT = 41;
|
|
169
|
+
var SOLANA_ERROR__CODECS_INVALID_SCALAR_ENUM_VARIANT = 42;
|
|
170
|
+
var SOLANA_ERROR__CODECS_FIXED_NULLABLE_WITH_VARIABLE_SIZE_CODEC = 43;
|
|
171
|
+
var SOLANA_ERROR__CODECS_FIXED_NULLABLE_WITH_VARIABLE_SIZE_PREFIX = 44;
|
|
172
|
+
var SOLANA_ERROR__CODECS_CODEC_REQUIRES_FIXED_SIZE = 45;
|
|
173
|
+
var SOLANA_ERROR__CODECS_NUMBER_OUT_OF_RANGE = 46;
|
|
174
|
+
var SOLANA_ERROR__CODECS_INVALID_STRING_FOR_BASE = 47;
|
|
175
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_UNKNOWN = 4615e3;
|
|
176
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_GENERIC_ERROR = 4615001;
|
|
177
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ARGUMENT = 4615002;
|
|
178
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_INSTRUCTION_DATA = 4615003;
|
|
179
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ACCOUNT_DATA = 4615004;
|
|
180
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_DATA_TOO_SMALL = 4615005;
|
|
181
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INSUFFICIENT_FUNDS = 4615006;
|
|
182
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INCORRECT_PROGRAM_ID = 4615007;
|
|
183
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_MISSING_REQUIRED_SIGNATURE = 4615008;
|
|
184
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_ALREADY_INITIALIZED = 4615009;
|
|
185
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_UNINITIALIZED_ACCOUNT = 4615010;
|
|
186
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_UNBALANCED_INSTRUCTION = 4615011;
|
|
187
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_MODIFIED_PROGRAM_ID = 4615012;
|
|
188
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_EXTERNAL_ACCOUNT_LAMPORT_SPEND = 4615013;
|
|
189
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_EXTERNAL_ACCOUNT_DATA_MODIFIED = 4615014;
|
|
190
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_READONLY_LAMPORT_CHANGE = 4615015;
|
|
191
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_READONLY_DATA_MODIFIED = 4615016;
|
|
192
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_DUPLICATE_ACCOUNT_INDEX = 4615017;
|
|
193
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_MODIFIED = 4615018;
|
|
194
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_RENT_EPOCH_MODIFIED = 4615019;
|
|
195
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_NOT_ENOUGH_ACCOUNT_KEYS = 4615020;
|
|
196
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_DATA_SIZE_CHANGED = 4615021;
|
|
197
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_NOT_EXECUTABLE = 4615022;
|
|
198
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_BORROW_FAILED = 4615023;
|
|
199
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_BORROW_OUTSTANDING = 4615024;
|
|
200
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_DUPLICATE_ACCOUNT_OUT_OF_SYNC = 4615025;
|
|
201
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_CUSTOM = 4615026;
|
|
202
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ERROR = 4615027;
|
|
203
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_DATA_MODIFIED = 4615028;
|
|
204
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_LAMPORT_CHANGE = 4615029;
|
|
205
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_ACCOUNT_NOT_RENT_EXEMPT = 4615030;
|
|
206
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_UNSUPPORTED_PROGRAM_ID = 4615031;
|
|
207
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_CALL_DEPTH = 4615032;
|
|
208
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_MISSING_ACCOUNT = 4615033;
|
|
209
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_REENTRANCY_NOT_ALLOWED = 4615034;
|
|
210
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_MAX_SEED_LENGTH_EXCEEDED = 4615035;
|
|
211
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_SEEDS = 4615036;
|
|
212
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_REALLOC = 4615037;
|
|
213
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_COMPUTATIONAL_BUDGET_EXCEEDED = 4615038;
|
|
214
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_PRIVILEGE_ESCALATION = 4615039;
|
|
215
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_PROGRAM_ENVIRONMENT_SETUP_FAILURE = 4615040;
|
|
216
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_PROGRAM_FAILED_TO_COMPLETE = 4615041;
|
|
217
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_PROGRAM_FAILED_TO_COMPILE = 4615042;
|
|
218
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_IMMUTABLE = 4615043;
|
|
219
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INCORRECT_AUTHORITY = 4615044;
|
|
220
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_BORSH_IO_ERROR = 4615045;
|
|
221
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_NOT_RENT_EXEMPT = 4615046;
|
|
222
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ACCOUNT_OWNER = 4615047;
|
|
223
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_ARITHMETIC_OVERFLOW = 4615048;
|
|
224
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_UNSUPPORTED_SYSVAR = 4615049;
|
|
225
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_ILLEGAL_OWNER = 4615050;
|
|
226
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED = 4615051;
|
|
227
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_MAX_ACCOUNTS_EXCEEDED = 4615052;
|
|
228
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED = 4615053;
|
|
229
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS = 4615054;
|
|
230
|
+
var SOLANA_ERROR__TRANSACTION_INVOKED_PROGRAMS_CANNOT_PAY_FEES = 5663001;
|
|
231
|
+
var SOLANA_ERROR__TRANSACTION_INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE = 5663002;
|
|
232
|
+
var SOLANA_ERROR__TRANSACTION_EXPECTED_BLOCKHASH_LIFETIME = 5663003;
|
|
233
|
+
var SOLANA_ERROR__TRANSACTION_EXPECTED_NONCE_LIFETIME = 5663004;
|
|
234
|
+
var SOLANA_ERROR__TRANSACTION_VERSION_NUMBER_OUT_OF_RANGE = 5663005;
|
|
235
|
+
var SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING = 5663006;
|
|
236
|
+
var SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE = 5663007;
|
|
237
|
+
var SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND = 5663008;
|
|
238
|
+
var SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_FEE_PAYER_MISSING = 5663009;
|
|
239
|
+
var SOLANA_ERROR__TRANSACTION_MISSING_SIGNATURES = 5663010;
|
|
240
|
+
var SOLANA_ERROR__TRANSACTION_SIGNATURE_NOT_COMPUTABLE = 5663011;
|
|
241
|
+
var SOLANA_ERROR__TRANSACTION_MISSING_ADDRESS = 5663012;
|
|
242
|
+
var SOLANA_ERROR__TRANSACTION_MISSING_FEE_PAYER = 5663013;
|
|
243
|
+
var SOLANA_ERROR__TRANSACTION_INVALID_NONCE_TRANSACTION_NO_INSTRUCTIONS = 5663014;
|
|
244
|
+
var SOLANA_ERROR__TRANSACTION_INVALID_NONCE_TRANSACTION_FIRST_INSTRUCTION_NOT_ADVANCE_NONCE = 5663015;
|
|
245
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_UNKNOWN = 705e4;
|
|
246
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_IN_USE = 7050001;
|
|
247
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_LOADED_TWICE = 7050002;
|
|
248
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_NOT_FOUND = 7050003;
|
|
249
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_PROGRAM_ACCOUNT_NOT_FOUND = 7050004;
|
|
250
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INSUFFICIENT_FUNDS_FOR_FEE = 7050005;
|
|
251
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ACCOUNT_FOR_FEE = 7050006;
|
|
252
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_ALREADY_PROCESSED = 7050007;
|
|
253
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_BLOCKHASH_NOT_FOUND = 7050008;
|
|
254
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_CALL_CHAIN_TOO_DEEP = 7050009;
|
|
255
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_MISSING_SIGNATURE_FOR_FEE = 7050010;
|
|
256
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ACCOUNT_INDEX = 7050011;
|
|
257
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_SIGNATURE_FAILURE = 7050012;
|
|
258
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INVALID_PROGRAM_FOR_EXECUTION = 7050013;
|
|
259
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_SANITIZE_FAILURE = 7050014;
|
|
260
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_CLUSTER_MAINTENANCE = 7050015;
|
|
261
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_BORROW_OUTSTANDING = 7050016;
|
|
262
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_MAX_BLOCK_COST_LIMIT = 7050017;
|
|
263
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_UNSUPPORTED_VERSION = 7050018;
|
|
264
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INVALID_WRITABLE_ACCOUNT = 7050019;
|
|
265
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_MAX_ACCOUNT_COST_LIMIT = 7050020;
|
|
266
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_ACCOUNT_DATA_BLOCK_LIMIT = 7050021;
|
|
267
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_TOO_MANY_ACCOUNT_LOCKS = 7050022;
|
|
268
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_ADDRESS_LOOKUP_TABLE_NOT_FOUND = 7050023;
|
|
269
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ADDRESS_LOOKUP_TABLE_OWNER = 7050024;
|
|
270
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ADDRESS_LOOKUP_TABLE_DATA = 7050025;
|
|
271
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ADDRESS_LOOKUP_TABLE_INDEX = 7050026;
|
|
272
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INVALID_RENT_PAYING_ACCOUNT = 7050027;
|
|
273
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_MAX_VOTE_COST_LIMIT = 7050028;
|
|
274
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_ACCOUNT_DATA_TOTAL_LIMIT = 7050029;
|
|
275
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_DUPLICATE_INSTRUCTION = 7050030;
|
|
276
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INSUFFICIENT_FUNDS_FOR_RENT = 7050031;
|
|
277
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_MAX_LOADED_ACCOUNTS_DATA_SIZE_EXCEEDED = 7050032;
|
|
278
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INVALID_LOADED_ACCOUNTS_DATA_SIZE_LIMIT = 7050033;
|
|
279
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_RESANITIZATION_NEEDED = 7050034;
|
|
280
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED = 7050035;
|
|
281
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_UNBALANCED_TRANSACTION = 7050036;
|
|
282
|
+
var SolanaErrorMessages = {
|
|
283
|
+
[SOLANA_ERROR__ACCOUNT_NOT_FOUND]: "Account not found at address: $address",
|
|
284
|
+
[SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED]: "The network has progressed past the last block for which this transaction could have been committed.",
|
|
285
|
+
[SOLANA_ERROR__CODECS_CANNOT_DECODE_EMPTY_BYTE_ARRAY]: "Codec [$codecDescription] cannot decode empty byte arrays.",
|
|
286
|
+
[SOLANA_ERROR__CODECS_CANNOT_REVERSE_CODEC_OF_VARIABLE_SIZE]: "Cannot reverse a codec of variable size.",
|
|
287
|
+
[SOLANA_ERROR__CODECS_CODEC_REQUIRES_FIXED_SIZE]: "Codec [$codecDescription] requires a fixed size.",
|
|
288
|
+
[SOLANA_ERROR__CODECS_ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH]: "Encoder and decoder must either both be fixed-size or variable-size.",
|
|
289
|
+
[SOLANA_ERROR__CODECS_ENUM_DISCRIMINATOR_OUT_OF_RANGE]: "Enum discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.",
|
|
290
|
+
[SOLANA_ERROR__CODECS_EXPECTED_FIXED_LENGTH_GOT_VARIABLE_LENGTH]: "Expected a fixed-size codec, got a variable-size one.",
|
|
291
|
+
[SOLANA_ERROR__CODECS_EXPECTED_VARIABLE_LENGTH_GOT_FIXED_LENGTH]: "Expected a variable-size codec, got a fixed-size one.",
|
|
292
|
+
[SOLANA_ERROR__CODECS_FIXED_NULLABLE_WITH_VARIABLE_SIZE_CODEC]: "Fixed nullables can only be used with fixed-size codecs.",
|
|
293
|
+
[SOLANA_ERROR__CODECS_FIXED_NULLABLE_WITH_VARIABLE_SIZE_PREFIX]: "Fixed nullables can only be used with fixed-size prefix.",
|
|
294
|
+
[SOLANA_ERROR__CODECS_FIXED_SIZE_ENCODER_DECODER_SIZE_MISMATCH]: "Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].",
|
|
295
|
+
[SOLANA_ERROR__CODECS_INVALID_DATA_ENUM_VARIANT]: "Invalid data enum variant. Expected one of [$variants], got $value.",
|
|
296
|
+
[SOLANA_ERROR__CODECS_INVALID_SCALAR_ENUM_VARIANT]: "Invalid scalar enum variant. Expected one of [$variants] or a number between $minRange and $maxRange, got $value.",
|
|
297
|
+
[SOLANA_ERROR__CODECS_INVALID_STRING_FOR_BASE]: "Invalid value $value for base $base with alphabet $alphabet.",
|
|
298
|
+
[SOLANA_ERROR__CODECS_NUMBER_OUT_OF_RANGE]: "Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.",
|
|
299
|
+
[SOLANA_ERROR__CODECS_VARIABLE_SIZE_ENCODER_DECODER_MAX_SIZE_MISMATCH]: "Encoder and decoder must have the same max size, got [$encoderMaxSize] and [$decoderMaxSize].",
|
|
300
|
+
[SOLANA_ERROR__CODECS_WRONG_NUMBER_OF_BYTES]: "Codec [$codecDescription] expected $expected bytes, got $bytesLength.",
|
|
301
|
+
[SOLANA_ERROR__CODECS_WRONG_NUMBER_OF_ITEMS]: "Expected [$codecDescription] to have $expected items, got $actual.",
|
|
302
|
+
[SOLANA_ERROR__COULD_NOT_FIND_VIABLE_PDA_BUMP_SEED]: "Unable to find a viable program address bump seed.",
|
|
303
|
+
[SOLANA_ERROR__EXPECTED_DECODED_ACCOUNT]: "Expected decoded account at address: $address",
|
|
304
|
+
[SOLANA_ERROR__FAILED_TO_DECODE_ACCOUNT]: "Failed to decode account data at address: $address",
|
|
305
|
+
[SOLANA_ERROR__INCORRECT_BASE58_ADDRESS_BYTE_LENGTH]: "Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.",
|
|
306
|
+
[SOLANA_ERROR__INCORRECT_BASE58_ADDRESS_LENGTH]: "Expected base58-encoded string of length between 32 and 44, got $actualLength.",
|
|
307
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_ALREADY_INITIALIZED]: "instruction requires an uninitialized account",
|
|
308
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_BORROW_FAILED]: "instruction tries to borrow reference for an account which is already borrowed",
|
|
309
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_BORROW_OUTSTANDING]: "instruction left account with an outstanding borrowed reference",
|
|
310
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_DATA_SIZE_CHANGED]: "program other than the account's owner changed the size of the account data",
|
|
311
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_DATA_TOO_SMALL]: "account data too small for instruction",
|
|
312
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_NOT_EXECUTABLE]: "instruction expected an executable account",
|
|
313
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_NOT_RENT_EXEMPT]: "An account does not have enough lamports to be rent-exempt",
|
|
314
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ARITHMETIC_OVERFLOW]: "Program arithmetic overflowed",
|
|
315
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_BORSH_IO_ERROR]: "Failed to serialize or deserialize account data: $encodedData",
|
|
316
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS]: "Builtin programs must consume compute units",
|
|
317
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_CALL_DEPTH]: "Cross-program invocation call depth too deep",
|
|
318
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_COMPUTATIONAL_BUDGET_EXCEEDED]: "Computational budget exceeded",
|
|
319
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_CUSTOM]: "custom program error: #$code",
|
|
320
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_DUPLICATE_ACCOUNT_INDEX]: "instruction contains duplicate accounts",
|
|
321
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_DUPLICATE_ACCOUNT_OUT_OF_SYNC]: "instruction modifications of multiply-passed account differ",
|
|
322
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_ACCOUNT_NOT_RENT_EXEMPT]: "executable accounts must be rent exempt",
|
|
323
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_DATA_MODIFIED]: "instruction changed executable accounts data",
|
|
324
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_LAMPORT_CHANGE]: "instruction changed the balance of an executable account",
|
|
325
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_MODIFIED]: "instruction changed executable bit of an account",
|
|
326
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_EXTERNAL_ACCOUNT_DATA_MODIFIED]: "instruction modified data of an account it does not own",
|
|
327
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_EXTERNAL_ACCOUNT_LAMPORT_SPEND]: "instruction spent from the balance of an account it does not own",
|
|
328
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_GENERIC_ERROR]: "generic instruction error",
|
|
329
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ILLEGAL_OWNER]: "Provided owner is not allowed",
|
|
330
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_IMMUTABLE]: "Account is immutable",
|
|
331
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INCORRECT_AUTHORITY]: "Incorrect authority provided",
|
|
332
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INCORRECT_PROGRAM_ID]: "incorrect program id for instruction",
|
|
333
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INSUFFICIENT_FUNDS]: "insufficient funds for instruction",
|
|
334
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ACCOUNT_DATA]: "invalid account data for instruction",
|
|
335
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ACCOUNT_OWNER]: "Invalid account owner",
|
|
336
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ARGUMENT]: "invalid program argument",
|
|
337
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ERROR]: "program returned invalid error code",
|
|
338
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_INSTRUCTION_DATA]: "invalid instruction data",
|
|
339
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_REALLOC]: "Failed to reallocate account data",
|
|
340
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_SEEDS]: "Provided seeds do not result in a valid address",
|
|
341
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED]: "Accounts data allocations exceeded the maximum allowed per transaction",
|
|
342
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MAX_ACCOUNTS_EXCEEDED]: "Max accounts exceeded",
|
|
343
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED]: "Max instruction trace length exceeded",
|
|
344
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MAX_SEED_LENGTH_EXCEEDED]: "Length of the seed is too long for address generation",
|
|
345
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MISSING_ACCOUNT]: "An account required by the instruction is missing",
|
|
346
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MISSING_REQUIRED_SIGNATURE]: "missing required signature for instruction",
|
|
347
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MODIFIED_PROGRAM_ID]: "instruction illegally modified the program id of an account",
|
|
348
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_NOT_ENOUGH_ACCOUNT_KEYS]: "insufficient account keys for instruction",
|
|
349
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_PRIVILEGE_ESCALATION]: "Cross-program invocation with unauthorized signer or writable account",
|
|
350
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_PROGRAM_ENVIRONMENT_SETUP_FAILURE]: "Failed to create program execution environment",
|
|
351
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_PROGRAM_FAILED_TO_COMPILE]: "Program failed to compile",
|
|
352
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_PROGRAM_FAILED_TO_COMPLETE]: "Program failed to complete",
|
|
353
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_READONLY_DATA_MODIFIED]: "instruction modified data of a read-only account",
|
|
354
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_READONLY_LAMPORT_CHANGE]: "instruction changed the balance of a read-only account",
|
|
355
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_REENTRANCY_NOT_ALLOWED]: "Cross-program invocation reentrancy not allowed for this instruction",
|
|
356
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_RENT_EPOCH_MODIFIED]: "instruction modified rent epoch of an account",
|
|
357
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_UNBALANCED_INSTRUCTION]: "sum of account balances before and after instruction do not match",
|
|
358
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_UNINITIALIZED_ACCOUNT]: "instruction requires an initialized account",
|
|
359
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_UNKNOWN]: "",
|
|
360
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_UNSUPPORTED_PROGRAM_ID]: "Unsupported program id",
|
|
361
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_UNSUPPORTED_SYSVAR]: "Unsupported sysvar",
|
|
362
|
+
[SOLANA_ERROR__INVALID_KEYPAIR_BYTES]: "Key pair bytes must be of length 64, got $byteLength.",
|
|
363
|
+
[SOLANA_ERROR__INVALID_SEEDS_POINT_ON_CURVE]: "Invalid seeds; point must fall off the Ed25519 curve.",
|
|
364
|
+
[SOLANA_ERROR__MALFORMED_PROGRAM_DERIVED_ADDRESS]: "Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].",
|
|
365
|
+
[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.",
|
|
366
|
+
[SOLANA_ERROR__MAX_PDA_SEED_LENGTH_EXCEEDED]: "The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.",
|
|
367
|
+
[SOLANA_ERROR__MULTIPLE_ACCOUNTS_NOT_FOUND]: "Accounts not found at addresses: $addresses",
|
|
368
|
+
[SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND]: "No nonce account could be found at address `$nonceAccountAddress`",
|
|
369
|
+
[SOLANA_ERROR__NONCE_INVALID]: "The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",
|
|
370
|
+
[SOLANA_ERROR__NOT_ALL_ACCOUNTS_DECODED]: "Not all accounts were decoded. Encoded accounts found at addresses: $addresses.",
|
|
371
|
+
[SOLANA_ERROR__NOT_AN_ED25519_PUBLIC_KEY]: "The `CryptoKey` must be an `Ed25519` public key.",
|
|
372
|
+
[SOLANA_ERROR__NOT_A_BASE58_ENCODED_ADDRESS]: "$putativeAddress is not a base58-encoded address.",
|
|
373
|
+
[SOLANA_ERROR__PROGRAM_ADDRESS_ENDS_WITH_PDA_MARKER]: "Program address cannot end with PDA marker.",
|
|
374
|
+
[SOLANA_ERROR__PROGRAM_DERIVED_ADDRESS_BUMP_SEED_OUT_OF_RANGE]: "Expected program derived address bump to be in the range [0, 255], got: $bump.",
|
|
375
|
+
[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`.",
|
|
376
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO_DIGEST_MISSING]: "No digest implementation could be found.",
|
|
377
|
+
[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.",
|
|
378
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO_EXPORT_FUNCTION_MISSING]: "No signature verification implementation could be found.",
|
|
379
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO_GENERATE_FUNCTION_MISSING]: "No key generation implementation could be found.",
|
|
380
|
+
[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.",
|
|
381
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO_SIGN_FUNCTION_MISSING]: "No signing implementation could be found.",
|
|
382
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO_VERIFY_FUNCTION_MISSING]: "No key export implementation could be found.",
|
|
383
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_BORROW_OUTSTANDING]: "Transaction processing left an account with an outstanding borrowed reference",
|
|
384
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_IN_USE]: "Account in use",
|
|
385
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_LOADED_TWICE]: "Account loaded twice",
|
|
386
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_NOT_FOUND]: "Attempt to debit an account but found no record of a prior credit.",
|
|
387
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_ADDRESS_LOOKUP_TABLE_NOT_FOUND]: "Transaction loads an address table account that doesn't exist",
|
|
388
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_ALREADY_PROCESSED]: "This transaction has already been processed",
|
|
389
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_BLOCKHASH_NOT_FOUND]: "Blockhash not found",
|
|
390
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_CALL_CHAIN_TOO_DEEP]: "Loader call chain is too deep",
|
|
391
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_CLUSTER_MAINTENANCE]: "Transactions are currently disabled due to cluster maintenance",
|
|
392
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_DUPLICATE_INSTRUCTION]: "Transaction contains a duplicate instruction ($index) that is not allowed",
|
|
393
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INSUFFICIENT_FUNDS_FOR_FEE]: "Insufficient funds for fee",
|
|
394
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INSUFFICIENT_FUNDS_FOR_RENT]: "Transaction results in an account ($accountIndex) with insufficient funds for rent",
|
|
395
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ACCOUNT_FOR_FEE]: "This account may not be used to pay transaction fees",
|
|
396
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ACCOUNT_INDEX]: "Transaction contains an invalid account reference",
|
|
397
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ADDRESS_LOOKUP_TABLE_DATA]: "Transaction loads an address table account with invalid data",
|
|
398
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ADDRESS_LOOKUP_TABLE_INDEX]: "Transaction address table lookup uses an invalid index",
|
|
399
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ADDRESS_LOOKUP_TABLE_OWNER]: "Transaction loads an address table account with an invalid owner",
|
|
400
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_LOADED_ACCOUNTS_DATA_SIZE_LIMIT]: "LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",
|
|
401
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_PROGRAM_FOR_EXECUTION]: "This program may not be used for executing instructions",
|
|
402
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_RENT_PAYING_ACCOUNT]: "Transaction leaves an account with a lower balance than rent-exempt minimum",
|
|
403
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_WRITABLE_ACCOUNT]: "Transaction loads a writable account that cannot be written",
|
|
404
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_MAX_LOADED_ACCOUNTS_DATA_SIZE_EXCEEDED]: "Transaction exceeded max loaded accounts data size cap",
|
|
405
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_MISSING_SIGNATURE_FOR_FEE]: "Transaction requires a fee but has no signature present",
|
|
406
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_PROGRAM_ACCOUNT_NOT_FOUND]: "Attempt to load a program that does not exist",
|
|
407
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED]: "Execution of the program referenced by account at index $accountIndex is temporarily restricted.",
|
|
408
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_RESANITIZATION_NEEDED]: "ResanitizationNeeded",
|
|
409
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_SANITIZE_FAILURE]: "Transaction failed to sanitize accounts offsets correctly",
|
|
410
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_SIGNATURE_FAILURE]: "Transaction did not pass signature verification",
|
|
411
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_TOO_MANY_ACCOUNT_LOCKS]: "Transaction locked too many accounts",
|
|
412
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_UNBALANCED_TRANSACTION]: "Sum of account balances before and after transaction do not match",
|
|
413
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_UNKNOWN]: "The transaction failed with the error `$errorName`",
|
|
414
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_UNSUPPORTED_VERSION]: "Transaction version is unsupported",
|
|
415
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_ACCOUNT_DATA_BLOCK_LIMIT]: "Transaction would exceed account data limit within the block",
|
|
416
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_ACCOUNT_DATA_TOTAL_LIMIT]: "Transaction would exceed total account data limit",
|
|
417
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_MAX_ACCOUNT_COST_LIMIT]: "Transaction would exceed max account limit within the block",
|
|
418
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_MAX_BLOCK_COST_LIMIT]: "Transaction would exceed max Block Cost Limit",
|
|
419
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_MAX_VOTE_COST_LIMIT]: "Transaction would exceed max Vote Cost Limit",
|
|
420
|
+
[SOLANA_ERROR__TRANSACTION_EXPECTED_BLOCKHASH_LIFETIME]: "Transaction does not have a blockhash lifetime",
|
|
421
|
+
[SOLANA_ERROR__TRANSACTION_EXPECTED_NONCE_LIFETIME]: "Transaction is not a durable nonce transaction",
|
|
422
|
+
[SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING]: "Contents of these address lookup tables unknown: $lookupTableAddresses",
|
|
423
|
+
[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",
|
|
424
|
+
[SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_FEE_PAYER_MISSING]: "No fee payer set in CompiledTransaction",
|
|
425
|
+
[SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND]: "Could not find program address at index $index",
|
|
426
|
+
[SOLANA_ERROR__TRANSACTION_INVALID_NONCE_TRANSACTION_FIRST_INSTRUCTION_NOT_ADVANCE_NONCE]: "Transaction first instruction is not advance nonce account instruction.",
|
|
427
|
+
[SOLANA_ERROR__TRANSACTION_INVALID_NONCE_TRANSACTION_NO_INSTRUCTIONS]: "Transaction with no instructions cannot be durable nonce transaction.",
|
|
428
|
+
[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",
|
|
429
|
+
[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",
|
|
430
|
+
[SOLANA_ERROR__TRANSACTION_MISSING_ADDRESS]: "Transaction is missing an address at index: $index.",
|
|
431
|
+
[SOLANA_ERROR__TRANSACTION_MISSING_FEE_PAYER]: "Transaction is missing a fee payer.",
|
|
432
|
+
[SOLANA_ERROR__TRANSACTION_MISSING_SIGNATURES]: "Transaction is missing signatures for addresses: $addresses.",
|
|
433
|
+
[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.",
|
|
434
|
+
[SOLANA_ERROR__TRANSACTION_VERSION_NUMBER_OUT_OF_RANGE]: "Transaction version must be in the range [0, 127]. `$actualVersion` given"
|
|
435
|
+
};
|
|
436
|
+
function getHumanReadableErrorMessage(code, context = {}) {
|
|
437
|
+
const messageFormatString = SolanaErrorMessages[code];
|
|
438
|
+
const message = messageFormatString.replace(
|
|
439
|
+
new RegExp("(?<!\\\\)\\$(\\w+)", "g"),
|
|
440
|
+
(substring, variableName) => variableName in context ? `${context[variableName]}` : substring
|
|
441
|
+
);
|
|
442
|
+
return message;
|
|
443
|
+
}
|
|
444
|
+
function getErrorMessage(code, context = {}) {
|
|
445
|
+
{
|
|
446
|
+
return getHumanReadableErrorMessage(code, context);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
function isSolanaError(e4, code) {
|
|
450
|
+
const isSolanaError2 = e4 instanceof Error && e4.name === "SolanaError";
|
|
451
|
+
if (isSolanaError2) {
|
|
452
|
+
if (code !== void 0) {
|
|
453
|
+
return e4.context.__code === code;
|
|
454
|
+
}
|
|
455
|
+
return true;
|
|
456
|
+
}
|
|
457
|
+
return false;
|
|
458
|
+
}
|
|
459
|
+
var SolanaError = class extends Error {
|
|
460
|
+
constructor(...[code, context]) {
|
|
461
|
+
const message = getErrorMessage(code, context);
|
|
462
|
+
super(message);
|
|
463
|
+
__publicField(this, "context");
|
|
464
|
+
this.context = {
|
|
465
|
+
__code: code,
|
|
466
|
+
...context
|
|
467
|
+
};
|
|
468
|
+
this.name = "SolanaError";
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
function getSolanaErrorFromRpcError({ errorCodeBaseOffset, getErrorContext, orderedErrorNames, rpcEnumError }, constructorOpt) {
|
|
472
|
+
let rpcErrorName;
|
|
473
|
+
let rpcErrorContext;
|
|
474
|
+
if (typeof rpcEnumError === "string") {
|
|
475
|
+
rpcErrorName = rpcEnumError;
|
|
476
|
+
} else {
|
|
477
|
+
rpcErrorName = Object.keys(rpcEnumError)[0];
|
|
478
|
+
rpcErrorContext = rpcEnumError[rpcErrorName];
|
|
479
|
+
}
|
|
480
|
+
const codeOffset = orderedErrorNames.indexOf(rpcErrorName);
|
|
481
|
+
const errorCode = errorCodeBaseOffset + codeOffset;
|
|
482
|
+
const errorContext = getErrorContext(errorCode, rpcErrorName, rpcErrorContext);
|
|
483
|
+
const err = new SolanaError(errorCode, errorContext);
|
|
484
|
+
if ("captureStackTrace" in Error && typeof Error.captureStackTrace === "function") {
|
|
485
|
+
Error.captureStackTrace(err, constructorOpt);
|
|
486
|
+
}
|
|
487
|
+
return err;
|
|
488
|
+
}
|
|
489
|
+
var ORDERED_ERROR_NAMES = [
|
|
490
|
+
// Keep synced with RPC source: https://github.com/anza-xyz/agave/blob/master/sdk/program/src/instruction.rs
|
|
491
|
+
// If this list ever gets too large, consider implementing a compression strategy like this:
|
|
492
|
+
// https://gist.github.com/steveluscher/aaa7cbbb5433b1197983908a40860c47
|
|
493
|
+
"GenericError",
|
|
494
|
+
"InvalidArgument",
|
|
495
|
+
"InvalidInstructionData",
|
|
496
|
+
"InvalidAccountData",
|
|
497
|
+
"AccountDataTooSmall",
|
|
498
|
+
"InsufficientFunds",
|
|
499
|
+
"IncorrectProgramId",
|
|
500
|
+
"MissingRequiredSignature",
|
|
501
|
+
"AccountAlreadyInitialized",
|
|
502
|
+
"UninitializedAccount",
|
|
503
|
+
"UnbalancedInstruction",
|
|
504
|
+
"ModifiedProgramId",
|
|
505
|
+
"ExternalAccountLamportSpend",
|
|
506
|
+
"ExternalAccountDataModified",
|
|
507
|
+
"ReadonlyLamportChange",
|
|
508
|
+
"ReadonlyDataModified",
|
|
509
|
+
"DuplicateAccountIndex",
|
|
510
|
+
"ExecutableModified",
|
|
511
|
+
"RentEpochModified",
|
|
512
|
+
"NotEnoughAccountKeys",
|
|
513
|
+
"AccountDataSizeChanged",
|
|
514
|
+
"AccountNotExecutable",
|
|
515
|
+
"AccountBorrowFailed",
|
|
516
|
+
"AccountBorrowOutstanding",
|
|
517
|
+
"DuplicateAccountOutOfSync",
|
|
518
|
+
"Custom",
|
|
519
|
+
"InvalidError",
|
|
520
|
+
"ExecutableDataModified",
|
|
521
|
+
"ExecutableLamportChange",
|
|
522
|
+
"ExecutableAccountNotRentExempt",
|
|
523
|
+
"UnsupportedProgramId",
|
|
524
|
+
"CallDepth",
|
|
525
|
+
"MissingAccount",
|
|
526
|
+
"ReentrancyNotAllowed",
|
|
527
|
+
"MaxSeedLengthExceeded",
|
|
528
|
+
"InvalidSeeds",
|
|
529
|
+
"InvalidRealloc",
|
|
530
|
+
"ComputationalBudgetExceeded",
|
|
531
|
+
"PrivilegeEscalation",
|
|
532
|
+
"ProgramEnvironmentSetupFailure",
|
|
533
|
+
"ProgramFailedToComplete",
|
|
534
|
+
"ProgramFailedToCompile",
|
|
535
|
+
"Immutable",
|
|
536
|
+
"IncorrectAuthority",
|
|
537
|
+
"BorshIoError",
|
|
538
|
+
"AccountNotRentExempt",
|
|
539
|
+
"InvalidAccountOwner",
|
|
540
|
+
"ArithmeticOverflow",
|
|
541
|
+
"UnsupportedSysvar",
|
|
542
|
+
"IllegalOwner",
|
|
543
|
+
"MaxAccountsDataAllocationsExceeded",
|
|
544
|
+
"MaxAccountsExceeded",
|
|
545
|
+
"MaxInstructionTraceLengthExceeded",
|
|
546
|
+
"BuiltinProgramsMustConsumeComputeUnits"
|
|
547
|
+
];
|
|
548
|
+
function getSolanaErrorFromInstructionError(index, instructionError) {
|
|
549
|
+
return getSolanaErrorFromRpcError(
|
|
550
|
+
{
|
|
551
|
+
errorCodeBaseOffset: 4615001,
|
|
552
|
+
getErrorContext(errorCode, rpcErrorName, rpcErrorContext) {
|
|
553
|
+
if (errorCode === SOLANA_ERROR__INSTRUCTION_ERROR_UNKNOWN) {
|
|
554
|
+
return {
|
|
555
|
+
errorName: rpcErrorName,
|
|
556
|
+
index,
|
|
557
|
+
...rpcErrorContext !== void 0 ? { instructionErrorContext: rpcErrorContext } : null
|
|
558
|
+
};
|
|
559
|
+
} else if (errorCode === SOLANA_ERROR__INSTRUCTION_ERROR_CUSTOM) {
|
|
560
|
+
return {
|
|
561
|
+
code: rpcErrorContext,
|
|
562
|
+
index
|
|
563
|
+
};
|
|
564
|
+
} else if (errorCode === SOLANA_ERROR__INSTRUCTION_ERROR_BORSH_IO_ERROR) {
|
|
565
|
+
return {
|
|
566
|
+
encodedData: rpcErrorContext,
|
|
567
|
+
index
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
return { index };
|
|
571
|
+
},
|
|
572
|
+
orderedErrorNames: ORDERED_ERROR_NAMES,
|
|
573
|
+
rpcEnumError: instructionError
|
|
574
|
+
},
|
|
575
|
+
getSolanaErrorFromInstructionError
|
|
576
|
+
);
|
|
577
|
+
}
|
|
578
|
+
var ORDERED_ERROR_NAMES2 = [
|
|
579
|
+
// Keep synced with RPC source: https://github.com/anza-xyz/agave/blob/master/sdk/src/transaction/error.rs
|
|
580
|
+
// If this list ever gets too large, consider implementing a compression strategy like this:
|
|
581
|
+
// https://gist.github.com/steveluscher/aaa7cbbb5433b1197983908a40860c47
|
|
582
|
+
"AccountInUse",
|
|
583
|
+
"AccountLoadedTwice",
|
|
584
|
+
"AccountNotFound",
|
|
585
|
+
"ProgramAccountNotFound",
|
|
586
|
+
"InsufficientFundsForFee",
|
|
587
|
+
"InvalidAccountForFee",
|
|
588
|
+
"AlreadyProcessed",
|
|
589
|
+
"BlockhashNotFound",
|
|
590
|
+
// `InstructionError` intentionally omitted; delegated to `getSolanaErrorFromInstructionError`
|
|
591
|
+
"CallChainTooDeep",
|
|
592
|
+
"MissingSignatureForFee",
|
|
593
|
+
"InvalidAccountIndex",
|
|
594
|
+
"SignatureFailure",
|
|
595
|
+
"InvalidProgramForExecution",
|
|
596
|
+
"SanitizeFailure",
|
|
597
|
+
"ClusterMaintenance",
|
|
598
|
+
"AccountBorrowOutstanding",
|
|
599
|
+
"WouldExceedMaxBlockCostLimit",
|
|
600
|
+
"UnsupportedVersion",
|
|
601
|
+
"InvalidWritableAccount",
|
|
602
|
+
"WouldExceedMaxAccountCostLimit",
|
|
603
|
+
"WouldExceedAccountDataBlockLimit",
|
|
604
|
+
"TooManyAccountLocks",
|
|
605
|
+
"AddressLookupTableNotFound",
|
|
606
|
+
"InvalidAddressLookupTableOwner",
|
|
607
|
+
"InvalidAddressLookupTableData",
|
|
608
|
+
"InvalidAddressLookupTableIndex",
|
|
609
|
+
"InvalidRentPayingAccount",
|
|
610
|
+
"WouldExceedMaxVoteCostLimit",
|
|
611
|
+
"WouldExceedAccountDataTotalLimit",
|
|
612
|
+
"DuplicateInstruction",
|
|
613
|
+
"InsufficientFundsForRent",
|
|
614
|
+
"MaxLoadedAccountsDataSizeExceeded",
|
|
615
|
+
"InvalidLoadedAccountsDataSizeLimit",
|
|
616
|
+
"ResanitizationNeeded",
|
|
617
|
+
"ProgramExecutionTemporarilyRestricted",
|
|
618
|
+
"UnbalancedTransaction"
|
|
619
|
+
];
|
|
620
|
+
function getSolanaErrorFromTransactionError(transactionError) {
|
|
621
|
+
if (typeof transactionError === "object" && "InstructionError" in transactionError) {
|
|
622
|
+
return getSolanaErrorFromInstructionError(
|
|
623
|
+
...transactionError.InstructionError
|
|
624
|
+
);
|
|
625
|
+
}
|
|
626
|
+
return getSolanaErrorFromRpcError(
|
|
627
|
+
{
|
|
628
|
+
errorCodeBaseOffset: 7050001,
|
|
629
|
+
getErrorContext(errorCode, rpcErrorName, rpcErrorContext) {
|
|
630
|
+
if (errorCode === SOLANA_ERROR__TRANSACTION_ERROR_UNKNOWN) {
|
|
631
|
+
return {
|
|
632
|
+
errorName: rpcErrorName,
|
|
633
|
+
...rpcErrorContext !== void 0 ? { transactionErrorContext: rpcErrorContext } : null
|
|
634
|
+
};
|
|
635
|
+
} else if (errorCode === SOLANA_ERROR__TRANSACTION_ERROR_DUPLICATE_INSTRUCTION) {
|
|
636
|
+
return {
|
|
637
|
+
index: rpcErrorContext
|
|
638
|
+
};
|
|
639
|
+
} else if (errorCode === SOLANA_ERROR__TRANSACTION_ERROR_INSUFFICIENT_FUNDS_FOR_RENT || errorCode === SOLANA_ERROR__TRANSACTION_ERROR_PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED) {
|
|
640
|
+
return {
|
|
641
|
+
accountIndex: rpcErrorContext.account_index
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
},
|
|
645
|
+
orderedErrorNames: ORDERED_ERROR_NAMES2,
|
|
646
|
+
rpcEnumError: transactionError
|
|
647
|
+
},
|
|
648
|
+
getSolanaErrorFromTransactionError
|
|
649
|
+
);
|
|
650
|
+
}
|
|
651
|
+
|
|
128
652
|
// ../codecs-strings/dist/index.browser.js
|
|
129
653
|
init_env_shim();
|
|
130
654
|
|
|
@@ -132,13 +656,19 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
132
656
|
init_env_shim();
|
|
133
657
|
function assertByteArrayIsNotEmptyForCodec(codecDescription, bytes, offset = 0) {
|
|
134
658
|
if (bytes.length - offset <= 0) {
|
|
135
|
-
throw new
|
|
659
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_CANNOT_DECODE_EMPTY_BYTE_ARRAY, {
|
|
660
|
+
codecDescription
|
|
661
|
+
});
|
|
136
662
|
}
|
|
137
663
|
}
|
|
138
664
|
function assertByteArrayHasEnoughBytesForCodec(codecDescription, expected, bytes, offset = 0) {
|
|
139
665
|
const bytesLength = bytes.length - offset;
|
|
140
666
|
if (bytesLength < expected) {
|
|
141
|
-
throw new
|
|
667
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_WRONG_NUMBER_OF_BYTES, {
|
|
668
|
+
bytesLength,
|
|
669
|
+
codecDescription,
|
|
670
|
+
expected
|
|
671
|
+
});
|
|
142
672
|
}
|
|
143
673
|
}
|
|
144
674
|
var mergeBytes = (byteArrays) => {
|
|
@@ -199,32 +729,34 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
199
729
|
function isFixedSize(codec) {
|
|
200
730
|
return "fixedSize" in codec && typeof codec.fixedSize === "number";
|
|
201
731
|
}
|
|
202
|
-
function assertIsFixedSize(codec
|
|
732
|
+
function assertIsFixedSize(codec) {
|
|
203
733
|
if (!isFixedSize(codec)) {
|
|
204
|
-
throw new
|
|
734
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_EXPECTED_FIXED_LENGTH_GOT_VARIABLE_LENGTH);
|
|
205
735
|
}
|
|
206
736
|
}
|
|
207
737
|
function isVariableSize(codec) {
|
|
208
738
|
return !isFixedSize(codec);
|
|
209
739
|
}
|
|
210
|
-
function assertIsVariableSize(codec
|
|
740
|
+
function assertIsVariableSize(codec) {
|
|
211
741
|
if (!isVariableSize(codec)) {
|
|
212
|
-
throw new
|
|
742
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_EXPECTED_VARIABLE_LENGTH_GOT_FIXED_LENGTH);
|
|
213
743
|
}
|
|
214
744
|
}
|
|
215
745
|
function combineCodec(encoder, decoder) {
|
|
216
746
|
if (isFixedSize(encoder) !== isFixedSize(decoder)) {
|
|
217
|
-
throw new
|
|
747
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH);
|
|
218
748
|
}
|
|
219
749
|
if (isFixedSize(encoder) && isFixedSize(decoder) && encoder.fixedSize !== decoder.fixedSize) {
|
|
220
|
-
throw new
|
|
221
|
-
|
|
222
|
-
|
|
750
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_FIXED_SIZE_ENCODER_DECODER_SIZE_MISMATCH, {
|
|
751
|
+
decoderFixedSize: decoder.fixedSize,
|
|
752
|
+
encoderFixedSize: encoder.fixedSize
|
|
753
|
+
});
|
|
223
754
|
}
|
|
224
755
|
if (!isFixedSize(encoder) && !isFixedSize(decoder) && encoder.maxSize !== decoder.maxSize) {
|
|
225
|
-
throw new
|
|
226
|
-
|
|
227
|
-
|
|
756
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_VARIABLE_SIZE_ENCODER_DECODER_MAX_SIZE_MISMATCH, {
|
|
757
|
+
decoderMaxSize: decoder.maxSize,
|
|
758
|
+
encoderMaxSize: encoder.maxSize
|
|
759
|
+
});
|
|
228
760
|
}
|
|
229
761
|
return {
|
|
230
762
|
...decoder,
|
|
@@ -287,7 +819,15 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
287
819
|
});
|
|
288
820
|
}
|
|
289
821
|
function reverseEncoder(encoder) {
|
|
290
|
-
|
|
822
|
+
try {
|
|
823
|
+
assertIsFixedSize(encoder);
|
|
824
|
+
} catch (e4) {
|
|
825
|
+
if (isSolanaError(e4, SOLANA_ERROR__CODECS_EXPECTED_FIXED_LENGTH_GOT_VARIABLE_LENGTH)) {
|
|
826
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_CANNOT_REVERSE_CODEC_OF_VARIABLE_SIZE);
|
|
827
|
+
} else {
|
|
828
|
+
throw e4;
|
|
829
|
+
}
|
|
830
|
+
}
|
|
291
831
|
return createEncoder({
|
|
292
832
|
...encoder,
|
|
293
833
|
write: (value, bytes, offset) => {
|
|
@@ -299,7 +839,15 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
299
839
|
});
|
|
300
840
|
}
|
|
301
841
|
function reverseDecoder(decoder) {
|
|
302
|
-
|
|
842
|
+
try {
|
|
843
|
+
assertIsFixedSize(decoder);
|
|
844
|
+
} catch (e4) {
|
|
845
|
+
if (isSolanaError(e4, SOLANA_ERROR__CODECS_EXPECTED_FIXED_LENGTH_GOT_VARIABLE_LENGTH)) {
|
|
846
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_CANNOT_REVERSE_CODEC_OF_VARIABLE_SIZE);
|
|
847
|
+
} else {
|
|
848
|
+
throw e4;
|
|
849
|
+
}
|
|
850
|
+
}
|
|
303
851
|
return createDecoder({
|
|
304
852
|
...decoder,
|
|
305
853
|
read: (bytes, offset) => {
|
|
@@ -321,9 +869,12 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
321
869
|
init_env_shim();
|
|
322
870
|
function assertNumberIsBetweenForCodec(codecDescription, min, max, value) {
|
|
323
871
|
if (value < min || value > max) {
|
|
324
|
-
throw new
|
|
325
|
-
|
|
326
|
-
|
|
872
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_NUMBER_OUT_OF_RANGE, {
|
|
873
|
+
codecDescription,
|
|
874
|
+
max,
|
|
875
|
+
min,
|
|
876
|
+
value
|
|
877
|
+
});
|
|
327
878
|
}
|
|
328
879
|
}
|
|
329
880
|
var Endian = /* @__PURE__ */ ((Endian2) => {
|
|
@@ -518,7 +1069,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
518
1069
|
var getU128Encoder = (config = {}) => numberEncoderFactory({
|
|
519
1070
|
config,
|
|
520
1071
|
name: "u128",
|
|
521
|
-
range: [
|
|
1072
|
+
range: [0n, BigInt("0xffffffffffffffffffffffffffffffff")],
|
|
522
1073
|
set: (view, value, le) => {
|
|
523
1074
|
const leftOffset = le ? 8 : 0;
|
|
524
1075
|
const rightOffset = le ? 0 : 8;
|
|
@@ -572,7 +1123,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
572
1123
|
var getU64Encoder = (config = {}) => numberEncoderFactory({
|
|
573
1124
|
config,
|
|
574
1125
|
name: "u64",
|
|
575
|
-
range: [
|
|
1126
|
+
range: [0n, BigInt("0xffffffffffffffff")],
|
|
576
1127
|
set: (view, value, le) => view.setBigUint64(0, BigInt(value), le),
|
|
577
1128
|
size: 8
|
|
578
1129
|
});
|
|
@@ -599,7 +1150,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
599
1150
|
// ../codecs-strings/dist/index.browser.js
|
|
600
1151
|
function assertValidBaseString(alphabet4, testValue, givenValue = testValue) {
|
|
601
1152
|
if (!testValue.match(new RegExp(`^[${alphabet4}]*$`))) {
|
|
602
|
-
throw new
|
|
1153
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_INVALID_STRING_FOR_BASE, {
|
|
1154
|
+
alphabet: alphabet4,
|
|
1155
|
+
base: alphabet4.length,
|
|
1156
|
+
value: givenValue
|
|
1157
|
+
});
|
|
603
1158
|
}
|
|
604
1159
|
}
|
|
605
1160
|
var getBaseXEncoder = (alphabet4) => {
|
|
@@ -738,6 +1293,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
738
1293
|
}
|
|
739
1294
|
return output;
|
|
740
1295
|
}
|
|
1296
|
+
var alphabet3 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
741
1297
|
var getBase64Encoder = () => {
|
|
742
1298
|
{
|
|
743
1299
|
return createEncoder({
|
|
@@ -745,7 +1301,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
745
1301
|
try {
|
|
746
1302
|
return atob(value).length;
|
|
747
1303
|
} catch (e22) {
|
|
748
|
-
throw new
|
|
1304
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_INVALID_STRING_FOR_BASE, {
|
|
1305
|
+
alphabet: alphabet3,
|
|
1306
|
+
base: 64,
|
|
1307
|
+
value
|
|
1308
|
+
});
|
|
749
1309
|
}
|
|
750
1310
|
},
|
|
751
1311
|
write(value, bytes, offset) {
|
|
@@ -754,7 +1314,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
754
1314
|
bytes.set(bytesToAdd, offset);
|
|
755
1315
|
return bytesToAdd.length + offset;
|
|
756
1316
|
} catch (e22) {
|
|
757
|
-
throw new
|
|
1317
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_INVALID_STRING_FOR_BASE, {
|
|
1318
|
+
alphabet: alphabet3,
|
|
1319
|
+
base: 64,
|
|
1320
|
+
value
|
|
1321
|
+
});
|
|
758
1322
|
}
|
|
759
1323
|
}
|
|
760
1324
|
});
|
|
@@ -858,10 +1422,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
858
1422
|
return encodedAccount;
|
|
859
1423
|
}
|
|
860
1424
|
return Object.freeze({ ...encodedAccount, data: decoder.decode(encodedAccount.data) });
|
|
861
|
-
} catch (
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
1425
|
+
} catch (e4) {
|
|
1426
|
+
throw new SolanaError(SOLANA_ERROR__FAILED_TO_DECODE_ACCOUNT, {
|
|
1427
|
+
address: encodedAccount.address
|
|
1428
|
+
});
|
|
865
1429
|
}
|
|
866
1430
|
}
|
|
867
1431
|
function accountExists(account) {
|
|
@@ -869,14 +1433,18 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
869
1433
|
}
|
|
870
1434
|
function assertAccountDecoded(account) {
|
|
871
1435
|
if (accountExists(account) && account.data instanceof Uint8Array) {
|
|
872
|
-
throw new
|
|
1436
|
+
throw new SolanaError(SOLANA_ERROR__EXPECTED_DECODED_ACCOUNT, {
|
|
1437
|
+
address: account.address
|
|
1438
|
+
});
|
|
873
1439
|
}
|
|
874
1440
|
}
|
|
875
1441
|
function assertAccountsDecoded(accounts) {
|
|
876
1442
|
const encoded = accounts.filter((a) => accountExists(a) && a.data instanceof Uint8Array);
|
|
877
1443
|
if (encoded.length > 0) {
|
|
878
|
-
const encodedAddresses = encoded.map((a) => a.address)
|
|
879
|
-
throw new
|
|
1444
|
+
const encodedAddresses = encoded.map((a) => a.address);
|
|
1445
|
+
throw new SolanaError(SOLANA_ERROR__NOT_ALL_ACCOUNTS_DECODED, {
|
|
1446
|
+
addresses: encodedAddresses
|
|
1447
|
+
});
|
|
880
1448
|
}
|
|
881
1449
|
}
|
|
882
1450
|
function parseBase64RpcAccount(address2, rpcAccount) {
|
|
@@ -928,14 +1496,14 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
928
1496
|
}
|
|
929
1497
|
function assertAccountExists(account) {
|
|
930
1498
|
if (!account.exists) {
|
|
931
|
-
throw new
|
|
1499
|
+
throw new SolanaError(SOLANA_ERROR__ACCOUNT_NOT_FOUND, { address: account.address });
|
|
932
1500
|
}
|
|
933
1501
|
}
|
|
934
1502
|
function assertAccountsExist(accounts) {
|
|
935
1503
|
const missingAccounts = accounts.filter((a) => !a.exists);
|
|
936
1504
|
if (missingAccounts.length > 0) {
|
|
937
1505
|
const missingAddresses = missingAccounts.map((a) => a.address);
|
|
938
|
-
throw new
|
|
1506
|
+
throw new SolanaError(SOLANA_ERROR__MULTIPLE_ACCOUNTS_NOT_FOUND, { addresses: missingAddresses });
|
|
939
1507
|
}
|
|
940
1508
|
}
|
|
941
1509
|
|
|
@@ -946,9 +1514,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
946
1514
|
init_env_shim();
|
|
947
1515
|
function assertIsSecureContext() {
|
|
948
1516
|
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
|
-
);
|
|
1517
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_MISSING);
|
|
952
1518
|
}
|
|
953
1519
|
}
|
|
954
1520
|
var cachedEd25519Decision;
|
|
@@ -977,40 +1543,38 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
977
1543
|
var _a;
|
|
978
1544
|
assertIsSecureContext();
|
|
979
1545
|
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.digest) !== "function") {
|
|
980
|
-
throw new
|
|
1546
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_DIGEST_MISSING);
|
|
981
1547
|
}
|
|
982
1548
|
}
|
|
983
1549
|
async function assertKeyGenerationIsAvailable() {
|
|
984
1550
|
var _a;
|
|
985
1551
|
assertIsSecureContext();
|
|
986
1552
|
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.generateKey) !== "function") {
|
|
987
|
-
throw new
|
|
1553
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_GENERATE_FUNCTION_MISSING);
|
|
988
1554
|
}
|
|
989
1555
|
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
|
-
);
|
|
1556
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_ED25519_ALGORITHM_MISSING);
|
|
993
1557
|
}
|
|
994
1558
|
}
|
|
995
1559
|
async function assertKeyExporterIsAvailable() {
|
|
996
1560
|
var _a;
|
|
997
1561
|
assertIsSecureContext();
|
|
998
1562
|
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.exportKey) !== "function") {
|
|
999
|
-
throw new
|
|
1563
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_EXPORT_FUNCTION_MISSING);
|
|
1000
1564
|
}
|
|
1001
1565
|
}
|
|
1002
1566
|
async function assertSigningCapabilityIsAvailable() {
|
|
1003
1567
|
var _a;
|
|
1004
1568
|
assertIsSecureContext();
|
|
1005
1569
|
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.sign) !== "function") {
|
|
1006
|
-
throw new
|
|
1570
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_SIGN_FUNCTION_MISSING);
|
|
1007
1571
|
}
|
|
1008
1572
|
}
|
|
1009
1573
|
async function assertVerificationCapabilityIsAvailable() {
|
|
1010
1574
|
var _a;
|
|
1011
1575
|
assertIsSecureContext();
|
|
1012
1576
|
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.verify) !== "function") {
|
|
1013
|
-
throw new
|
|
1577
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_VERIFY_FUNCTION_MISSING);
|
|
1014
1578
|
}
|
|
1015
1579
|
}
|
|
1016
1580
|
|
|
@@ -1050,18 +1614,20 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1050
1614
|
putativeAddress.length < 32 || // Highest address (32 bytes of 255)
|
|
1051
1615
|
putativeAddress.length > 44
|
|
1052
1616
|
) {
|
|
1053
|
-
throw new
|
|
1617
|
+
throw new SolanaError(SOLANA_ERROR__INCORRECT_BASE58_ADDRESS_LENGTH, {
|
|
1618
|
+
actualLength: putativeAddress.length
|
|
1619
|
+
});
|
|
1054
1620
|
}
|
|
1055
1621
|
const base58Encoder4 = getMemoizedBase58Encoder();
|
|
1056
1622
|
const bytes = base58Encoder4.encode(putativeAddress);
|
|
1057
1623
|
const numBytes = bytes.byteLength;
|
|
1058
1624
|
if (numBytes !== 32) {
|
|
1059
|
-
throw new
|
|
1625
|
+
throw new SolanaError(SOLANA_ERROR__INCORRECT_BASE58_ADDRESS_BYTE_LENGTH, {
|
|
1626
|
+
actualLength: numBytes
|
|
1627
|
+
});
|
|
1060
1628
|
}
|
|
1061
1629
|
} catch (e4) {
|
|
1062
|
-
throw new
|
|
1063
|
-
cause: e4
|
|
1064
|
-
});
|
|
1630
|
+
throw new SolanaError(SOLANA_ERROR__NOT_A_BASE58_ENCODED_ADDRESS, { putativeAddress });
|
|
1065
1631
|
}
|
|
1066
1632
|
}
|
|
1067
1633
|
function address(putativeAddress) {
|
|
@@ -1182,12 +1748,12 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1182
1748
|
function assertIsProgramDerivedAddress(value) {
|
|
1183
1749
|
const validFormat = Array.isArray(value) && value.length === 2 && typeof value[0] === "string" && typeof value[1] === "number";
|
|
1184
1750
|
if (!validFormat) {
|
|
1185
|
-
throw new
|
|
1186
|
-
`Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].`
|
|
1187
|
-
);
|
|
1751
|
+
throw new SolanaError(SOLANA_ERROR__MALFORMED_PROGRAM_DERIVED_ADDRESS);
|
|
1188
1752
|
}
|
|
1189
1753
|
if (value[1] < 0 || value[1] > 255) {
|
|
1190
|
-
throw new
|
|
1754
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_DERIVED_ADDRESS_BUMP_SEED_OUT_OF_RANGE, {
|
|
1755
|
+
bump: value[1]
|
|
1756
|
+
});
|
|
1191
1757
|
}
|
|
1192
1758
|
assertIsAddress(value[0]);
|
|
1193
1759
|
}
|
|
@@ -1217,18 +1783,23 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1217
1783
|
115,
|
|
1218
1784
|
115
|
|
1219
1785
|
];
|
|
1220
|
-
var PointOnCurveError = class extends Error {
|
|
1221
|
-
};
|
|
1222
1786
|
async function createProgramDerivedAddress({ programAddress, seeds }) {
|
|
1223
1787
|
await assertDigestCapabilityIsAvailable();
|
|
1224
1788
|
if (seeds.length > MAX_SEEDS) {
|
|
1225
|
-
throw new
|
|
1789
|
+
throw new SolanaError(SOLANA_ERROR__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED, {
|
|
1790
|
+
actual: seeds.length,
|
|
1791
|
+
maxSeeds: MAX_SEEDS
|
|
1792
|
+
});
|
|
1226
1793
|
}
|
|
1227
1794
|
let textEncoder;
|
|
1228
1795
|
const seedBytes = seeds.reduce((acc, seed, ii) => {
|
|
1229
1796
|
const bytes = typeof seed === "string" ? (textEncoder || (textEncoder = new TextEncoder())).encode(seed) : seed;
|
|
1230
1797
|
if (bytes.byteLength > MAX_SEED_LENGTH) {
|
|
1231
|
-
throw new
|
|
1798
|
+
throw new SolanaError(SOLANA_ERROR__MAX_PDA_SEED_LENGTH_EXCEEDED, {
|
|
1799
|
+
actual: bytes.byteLength,
|
|
1800
|
+
index: ii,
|
|
1801
|
+
maxSeedLength: MAX_SEED_LENGTH
|
|
1802
|
+
});
|
|
1232
1803
|
}
|
|
1233
1804
|
acc.push(...bytes);
|
|
1234
1805
|
return acc;
|
|
@@ -1241,7 +1812,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1241
1812
|
);
|
|
1242
1813
|
const addressBytes = new Uint8Array(addressBytesBuffer);
|
|
1243
1814
|
if (await compressedPointBytesAreOnCurve(addressBytes)) {
|
|
1244
|
-
throw new
|
|
1815
|
+
throw new SolanaError(SOLANA_ERROR__INVALID_SEEDS_POINT_ON_CURVE);
|
|
1245
1816
|
}
|
|
1246
1817
|
return base58EncodedAddressCodec.decode(addressBytes);
|
|
1247
1818
|
}
|
|
@@ -1258,24 +1829,28 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1258
1829
|
});
|
|
1259
1830
|
return [address2, bumpSeed];
|
|
1260
1831
|
} catch (e4) {
|
|
1261
|
-
if (e4
|
|
1832
|
+
if (isSolanaError(e4, SOLANA_ERROR__INVALID_SEEDS_POINT_ON_CURVE)) {
|
|
1262
1833
|
bumpSeed--;
|
|
1263
1834
|
} else {
|
|
1264
1835
|
throw e4;
|
|
1265
1836
|
}
|
|
1266
1837
|
}
|
|
1267
1838
|
}
|
|
1268
|
-
throw new
|
|
1839
|
+
throw new SolanaError(SOLANA_ERROR__COULD_NOT_FIND_VIABLE_PDA_BUMP_SEED);
|
|
1269
1840
|
}
|
|
1270
1841
|
async function createAddressWithSeed({ baseAddress, programAddress, seed }) {
|
|
1271
1842
|
const { encode, decode } = getAddressCodec();
|
|
1272
1843
|
const seedBytes = typeof seed === "string" ? new TextEncoder().encode(seed) : seed;
|
|
1273
1844
|
if (seedBytes.byteLength > MAX_SEED_LENGTH) {
|
|
1274
|
-
throw new
|
|
1845
|
+
throw new SolanaError(SOLANA_ERROR__MAX_PDA_SEED_LENGTH_EXCEEDED, {
|
|
1846
|
+
actual: seedBytes.byteLength,
|
|
1847
|
+
index: 0,
|
|
1848
|
+
maxSeedLength: MAX_SEED_LENGTH
|
|
1849
|
+
});
|
|
1275
1850
|
}
|
|
1276
1851
|
const programAddressBytes = encode(programAddress);
|
|
1277
1852
|
if (programAddressBytes.length >= PDA_MARKER_BYTES.length && programAddressBytes.slice(-PDA_MARKER_BYTES.length).every((byte, index) => byte === PDA_MARKER_BYTES[index])) {
|
|
1278
|
-
throw new
|
|
1853
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_ADDRESS_ENDS_WITH_PDA_MARKER);
|
|
1279
1854
|
}
|
|
1280
1855
|
const addressBytesBuffer = await crypto.subtle.digest(
|
|
1281
1856
|
"SHA-256",
|
|
@@ -1287,7 +1862,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1287
1862
|
async function getAddressFromPublicKey(publicKey) {
|
|
1288
1863
|
await assertKeyExporterIsAvailable();
|
|
1289
1864
|
if (publicKey.type !== "public" || publicKey.algorithm.name !== "Ed25519") {
|
|
1290
|
-
throw new
|
|
1865
|
+
throw new SolanaError(SOLANA_ERROR__NOT_AN_ED25519_PUBLIC_KEY);
|
|
1291
1866
|
}
|
|
1292
1867
|
const publicKeyBytes = await crypto.subtle.exportKey("raw", publicKey);
|
|
1293
1868
|
return getAddressDecoder().decode(new Uint8Array(publicKeyBytes));
|
|
@@ -1297,7 +1872,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1297
1872
|
init_env_shim();
|
|
1298
1873
|
function assertValidNumberOfItemsForCodec(codecDescription, expected, actual) {
|
|
1299
1874
|
if (expected !== actual) {
|
|
1300
|
-
throw new
|
|
1875
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_WRONG_NUMBER_OF_ITEMS, {
|
|
1876
|
+
actual,
|
|
1877
|
+
codecDescription,
|
|
1878
|
+
expected
|
|
1879
|
+
});
|
|
1301
1880
|
}
|
|
1302
1881
|
}
|
|
1303
1882
|
function maxCodecSizes(sizes) {
|
|
@@ -1443,13 +2022,33 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1443
2022
|
function getBooleanEncoder(config = {}) {
|
|
1444
2023
|
var _a;
|
|
1445
2024
|
const size = (_a = config.size) != null ? _a : getU8Encoder();
|
|
1446
|
-
|
|
2025
|
+
try {
|
|
2026
|
+
assertIsFixedSize(size);
|
|
2027
|
+
} catch (e4) {
|
|
2028
|
+
if (isSolanaError(e4, SOLANA_ERROR__CODECS_EXPECTED_FIXED_LENGTH_GOT_VARIABLE_LENGTH)) {
|
|
2029
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_CODEC_REQUIRES_FIXED_SIZE, {
|
|
2030
|
+
codecDescription: "bool"
|
|
2031
|
+
});
|
|
2032
|
+
} else {
|
|
2033
|
+
throw e4;
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
1447
2036
|
return mapEncoder(size, (value) => value ? 1 : 0);
|
|
1448
2037
|
}
|
|
1449
2038
|
function getBooleanDecoder(config = {}) {
|
|
1450
2039
|
var _a;
|
|
1451
2040
|
const size = (_a = config.size) != null ? _a : getU8Decoder();
|
|
1452
|
-
|
|
2041
|
+
try {
|
|
2042
|
+
assertIsFixedSize(size);
|
|
2043
|
+
} catch (e4) {
|
|
2044
|
+
if (isSolanaError(e4, SOLANA_ERROR__CODECS_EXPECTED_FIXED_LENGTH_GOT_VARIABLE_LENGTH)) {
|
|
2045
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_CODEC_REQUIRES_FIXED_SIZE, {
|
|
2046
|
+
codecDescription: "bool"
|
|
2047
|
+
});
|
|
2048
|
+
} else {
|
|
2049
|
+
throw e4;
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
1453
2052
|
return mapDecoder(size, (value) => Number(value) === 1);
|
|
1454
2053
|
}
|
|
1455
2054
|
function getBooleanCodec(config = {}) {
|
|
@@ -1545,9 +2144,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1545
2144
|
offset = dOffset;
|
|
1546
2145
|
const variantField = (_a2 = variants[Number(discriminator)]) != null ? _a2 : null;
|
|
1547
2146
|
if (!variantField) {
|
|
1548
|
-
throw new
|
|
1549
|
-
|
|
1550
|
-
|
|
2147
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_ENUM_DISCRIMINATOR_OUT_OF_RANGE, {
|
|
2148
|
+
discriminator,
|
|
2149
|
+
maxRange: variants.length - 1,
|
|
2150
|
+
minRange: 0
|
|
2151
|
+
});
|
|
1551
2152
|
}
|
|
1552
2153
|
const [variant, vOffset] = variantField[1].read(bytes, offset);
|
|
1553
2154
|
offset = vOffset;
|
|
@@ -1582,9 +2183,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1582
2183
|
function getVariantDiscriminator(variants, variant) {
|
|
1583
2184
|
const discriminator = variants.findIndex(([key]) => variant.__kind === key);
|
|
1584
2185
|
if (discriminator < 0) {
|
|
1585
|
-
throw new
|
|
1586
|
-
|
|
1587
|
-
|
|
2186
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_INVALID_DATA_ENUM_VARIANT, {
|
|
2187
|
+
value: variant.__kind,
|
|
2188
|
+
variants: variants.map(([key]) => key)
|
|
2189
|
+
});
|
|
1588
2190
|
}
|
|
1589
2191
|
return discriminator;
|
|
1590
2192
|
}
|
|
@@ -1650,8 +2252,24 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1650
2252
|
const fixed = (_b = config.fixed) != null ? _b : false;
|
|
1651
2253
|
const isZeroSizeItem = isFixedSize(item) && isFixedSize(prefix) && item.fixedSize === 0;
|
|
1652
2254
|
if (fixed || isZeroSizeItem) {
|
|
1653
|
-
|
|
1654
|
-
|
|
2255
|
+
try {
|
|
2256
|
+
assertIsFixedSize(item);
|
|
2257
|
+
} catch (e4) {
|
|
2258
|
+
if (isSolanaError(e4, SOLANA_ERROR__CODECS_EXPECTED_FIXED_LENGTH_GOT_VARIABLE_LENGTH)) {
|
|
2259
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_FIXED_NULLABLE_WITH_VARIABLE_SIZE_CODEC);
|
|
2260
|
+
} else {
|
|
2261
|
+
throw e4;
|
|
2262
|
+
}
|
|
2263
|
+
}
|
|
2264
|
+
try {
|
|
2265
|
+
assertIsFixedSize(prefix);
|
|
2266
|
+
} catch (e4) {
|
|
2267
|
+
if (isSolanaError(e4, SOLANA_ERROR__CODECS_EXPECTED_FIXED_LENGTH_GOT_VARIABLE_LENGTH)) {
|
|
2268
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_FIXED_NULLABLE_WITH_VARIABLE_SIZE_PREFIX);
|
|
2269
|
+
} else {
|
|
2270
|
+
throw e4;
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
1655
2273
|
const fixedSize = prefix.fixedSize + item.fixedSize;
|
|
1656
2274
|
return createEncoder({
|
|
1657
2275
|
fixedSize,
|
|
@@ -1683,8 +2301,24 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1683
2301
|
let fixedSize = null;
|
|
1684
2302
|
const isZeroSizeItem = isFixedSize(item) && isFixedSize(prefix) && item.fixedSize === 0;
|
|
1685
2303
|
if (fixed || isZeroSizeItem) {
|
|
1686
|
-
|
|
1687
|
-
|
|
2304
|
+
try {
|
|
2305
|
+
assertIsFixedSize(item);
|
|
2306
|
+
} catch (e4) {
|
|
2307
|
+
if (isSolanaError(e4, SOLANA_ERROR__CODECS_EXPECTED_FIXED_LENGTH_GOT_VARIABLE_LENGTH)) {
|
|
2308
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_FIXED_NULLABLE_WITH_VARIABLE_SIZE_CODEC);
|
|
2309
|
+
} else {
|
|
2310
|
+
throw e4;
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
try {
|
|
2314
|
+
assertIsFixedSize(prefix);
|
|
2315
|
+
} catch (e4) {
|
|
2316
|
+
if (isSolanaError(e4, SOLANA_ERROR__CODECS_EXPECTED_FIXED_LENGTH_GOT_VARIABLE_LENGTH)) {
|
|
2317
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_FIXED_NULLABLE_WITH_VARIABLE_SIZE_PREFIX);
|
|
2318
|
+
} else {
|
|
2319
|
+
throw e4;
|
|
2320
|
+
}
|
|
2321
|
+
}
|
|
1688
2322
|
fixedSize = prefix.fixedSize + item.fixedSize;
|
|
1689
2323
|
}
|
|
1690
2324
|
return createDecoder({
|
|
@@ -1714,9 +2348,12 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1714
2348
|
const isInvalidNumber = typeof value === "number" && (value < minRange || value > maxRange);
|
|
1715
2349
|
const isInvalidString = typeof value === "string" && !allStringInputs.includes(value);
|
|
1716
2350
|
if (isInvalidNumber || isInvalidString) {
|
|
1717
|
-
throw new
|
|
1718
|
-
|
|
1719
|
-
|
|
2351
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_INVALID_SCALAR_ENUM_VARIANT, {
|
|
2352
|
+
maxRange,
|
|
2353
|
+
minRange,
|
|
2354
|
+
value,
|
|
2355
|
+
variants: allStringInputs
|
|
2356
|
+
});
|
|
1720
2357
|
}
|
|
1721
2358
|
if (typeof value === "number")
|
|
1722
2359
|
return value;
|
|
@@ -1733,9 +2370,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1733
2370
|
return mapDecoder(prefix, (value) => {
|
|
1734
2371
|
const valueAsNumber = Number(value);
|
|
1735
2372
|
if (valueAsNumber < minRange || valueAsNumber > maxRange) {
|
|
1736
|
-
throw new
|
|
1737
|
-
|
|
1738
|
-
|
|
2373
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_ENUM_DISCRIMINATOR_OUT_OF_RANGE, {
|
|
2374
|
+
discriminator: valueAsNumber,
|
|
2375
|
+
maxRange,
|
|
2376
|
+
minRange
|
|
2377
|
+
});
|
|
1739
2378
|
}
|
|
1740
2379
|
return constructor[enumKeys[valueAsNumber]];
|
|
1741
2380
|
});
|
|
@@ -1849,8 +2488,16 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1849
2488
|
const fixed = (_b = config.fixed) != null ? _b : false;
|
|
1850
2489
|
const isZeroSizeItem = isFixedSize(item) && isFixedSize(prefix) && item.fixedSize === 0;
|
|
1851
2490
|
if (fixed || isZeroSizeItem) {
|
|
1852
|
-
|
|
1853
|
-
|
|
2491
|
+
try {
|
|
2492
|
+
assertIsFixedSize(item);
|
|
2493
|
+
} catch (e4) {
|
|
2494
|
+
throw new Error("Fixed options can only be used with fixed-size codecs.");
|
|
2495
|
+
}
|
|
2496
|
+
try {
|
|
2497
|
+
assertIsFixedSize(prefix);
|
|
2498
|
+
} catch (e4) {
|
|
2499
|
+
throw new Error("Fixed options can only be used with fixed-size prefix.");
|
|
2500
|
+
}
|
|
1854
2501
|
const fixedSize = prefix.fixedSize + item.fixedSize;
|
|
1855
2502
|
return createEncoder({
|
|
1856
2503
|
fixedSize,
|
|
@@ -1887,8 +2534,16 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1887
2534
|
let fixedSize = null;
|
|
1888
2535
|
const isZeroSizeItem = isFixedSize(item) && isFixedSize(prefix) && item.fixedSize === 0;
|
|
1889
2536
|
if (fixed || isZeroSizeItem) {
|
|
1890
|
-
|
|
1891
|
-
|
|
2537
|
+
try {
|
|
2538
|
+
assertIsFixedSize(item);
|
|
2539
|
+
} catch (e4) {
|
|
2540
|
+
throw new Error("Fixed options can only be used with fixed-size codecs.");
|
|
2541
|
+
}
|
|
2542
|
+
try {
|
|
2543
|
+
assertIsFixedSize(prefix);
|
|
2544
|
+
} catch (e4) {
|
|
2545
|
+
throw new Error("Fixed options can only be used with fixed-size prefix.");
|
|
2546
|
+
}
|
|
1892
2547
|
fixedSize = prefix.fixedSize + item.fixedSize;
|
|
1893
2548
|
}
|
|
1894
2549
|
return createDecoder({
|
|
@@ -1980,52 +2635,6 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1980
2635
|
|
|
1981
2636
|
// ../keys/dist/index.browser.js
|
|
1982
2637
|
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
2638
|
function addPkcs8Header(bytes) {
|
|
2030
2639
|
return new Uint8Array([
|
|
2031
2640
|
/**
|
|
@@ -4006,7 +4615,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4006
4615
|
}
|
|
4007
4616
|
function assertIsTransactionWithBlockhashLifetime(transaction) {
|
|
4008
4617
|
if (!isTransactionWithBlockhashLifetime(transaction)) {
|
|
4009
|
-
throw new
|
|
4618
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_EXPECTED_BLOCKHASH_LIFETIME);
|
|
4010
4619
|
}
|
|
4011
4620
|
}
|
|
4012
4621
|
function setTransactionLifetimeUsingBlockhash(blockhashLifetimeConstraint, transaction) {
|
|
@@ -4055,7 +4664,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4055
4664
|
var SYSTEM_PROGRAM_ADDRESS = "11111111111111111111111111111111";
|
|
4056
4665
|
function assertIsDurableNonceTransaction(transaction) {
|
|
4057
4666
|
if (!isDurableNonceTransaction(transaction)) {
|
|
4058
|
-
throw new
|
|
4667
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_EXPECTED_NONCE_LIFETIME);
|
|
4059
4668
|
}
|
|
4060
4669
|
}
|
|
4061
4670
|
function createAdvanceNonceAccountInstruction(nonceAccountAddress, nonceAuthorityAddress) {
|
|
@@ -4199,8 +4808,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4199
4808
|
const compiledAddressTableLookupAddresses = compiledAddressTableLookups.map((l) => l.lookupTableAddress);
|
|
4200
4809
|
const missing = compiledAddressTableLookupAddresses.filter((a) => addressesByLookupTableAddress[a] === void 0);
|
|
4201
4810
|
if (missing.length > 0) {
|
|
4202
|
-
|
|
4203
|
-
|
|
4811
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING, {
|
|
4812
|
+
lookupTableAddresses: missing
|
|
4813
|
+
});
|
|
4204
4814
|
}
|
|
4205
4815
|
const readOnlyMetas = [];
|
|
4206
4816
|
const writableMetas = [];
|
|
@@ -4208,8 +4818,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4208
4818
|
const addresses = addressesByLookupTableAddress[lookup.lookupTableAddress];
|
|
4209
4819
|
const highestIndex = Math.max(...lookup.readableIndices, ...lookup.writableIndices);
|
|
4210
4820
|
if (highestIndex >= addresses.length) {
|
|
4211
|
-
throw new
|
|
4212
|
-
|
|
4821
|
+
throw new SolanaError(
|
|
4822
|
+
SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE,
|
|
4823
|
+
{
|
|
4824
|
+
highestKnownIndex: addresses.length - 1,
|
|
4825
|
+
highestRequestedIndex: highestIndex,
|
|
4826
|
+
lookupTableAddress: lookup.lookupTableAddress
|
|
4827
|
+
}
|
|
4213
4828
|
);
|
|
4214
4829
|
}
|
|
4215
4830
|
const readOnlyForLookup = lookup.readableIndices.map((r) => ({
|
|
@@ -4233,7 +4848,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4233
4848
|
var _a, _b;
|
|
4234
4849
|
const programAddress = (_a = accountMetas[instruction.programAddressIndex]) == null ? void 0 : _a.address;
|
|
4235
4850
|
if (!programAddress) {
|
|
4236
|
-
throw new
|
|
4851
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND, {
|
|
4852
|
+
index: instruction.programAddressIndex
|
|
4853
|
+
});
|
|
4237
4854
|
}
|
|
4238
4855
|
const accounts = (_b = instruction.accountIndices) == null ? void 0 : _b.map((accountIndex) => accountMetas[accountIndex]);
|
|
4239
4856
|
const { data } = instruction;
|
|
@@ -4279,8 +4896,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4279
4896
|
var _a;
|
|
4280
4897
|
const { compiledMessage } = compiledTransaction;
|
|
4281
4898
|
const feePayer = compiledMessage.staticAccounts[0];
|
|
4282
|
-
if (!feePayer)
|
|
4283
|
-
throw new
|
|
4899
|
+
if (!feePayer) {
|
|
4900
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_FEE_PAYER_MISSING);
|
|
4901
|
+
}
|
|
4284
4902
|
const accountMetas = getAccountMetas(compiledMessage);
|
|
4285
4903
|
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
4904
|
const transactionMetas = [...accountMetas, ...accountLookupMetas];
|
|
@@ -4321,13 +4939,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4321
4939
|
if (isWritableRole2(entry.role)) {
|
|
4322
4940
|
switch (entry[TYPE]) {
|
|
4323
4941
|
case 0:
|
|
4324
|
-
throw new
|
|
4325
|
-
|
|
4326
|
-
);
|
|
4942
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_INVOKED_PROGRAMS_CANNOT_PAY_FEES, {
|
|
4943
|
+
programAddress: instruction.programAddress
|
|
4944
|
+
});
|
|
4327
4945
|
default:
|
|
4328
|
-
throw new
|
|
4329
|
-
|
|
4330
|
-
);
|
|
4946
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE, {
|
|
4947
|
+
programAddress: instruction.programAddress
|
|
4948
|
+
});
|
|
4331
4949
|
}
|
|
4332
4950
|
}
|
|
4333
4951
|
if (entry[TYPE] === 2) {
|
|
@@ -4392,8 +5010,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4392
5010
|
addressesOfInvokedPrograms.has(account.address)
|
|
4393
5011
|
) {
|
|
4394
5012
|
if (isWritableRole2(accountMeta.role)) {
|
|
4395
|
-
throw new
|
|
4396
|
-
|
|
5013
|
+
throw new SolanaError(
|
|
5014
|
+
SOLANA_ERROR__TRANSACTION_INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE,
|
|
5015
|
+
{
|
|
5016
|
+
programAddress: account.address
|
|
5017
|
+
}
|
|
4397
5018
|
);
|
|
4398
5019
|
}
|
|
4399
5020
|
if (entry.role !== nextRole) {
|
|
@@ -4677,7 +5298,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4677
5298
|
return offset;
|
|
4678
5299
|
}
|
|
4679
5300
|
if (value < 0 || value > 127) {
|
|
4680
|
-
throw new
|
|
5301
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_VERSION_NUMBER_OUT_OF_RANGE, {
|
|
5302
|
+
actualVersion: value
|
|
5303
|
+
});
|
|
4681
5304
|
}
|
|
4682
5305
|
bytes.set([value | VERSION_FLAG_MASK], offset);
|
|
4683
5306
|
return offset + 1;
|
|
@@ -5312,9 +5935,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5312
5935
|
const signatureDidCommitPromise = (async () => {
|
|
5313
5936
|
for await (const signatureStatusNotification of signatureStatusNotifications) {
|
|
5314
5937
|
if (signatureStatusNotification.value.err) {
|
|
5315
|
-
throw
|
|
5316
|
-
cause: signatureStatusNotification.value.err
|
|
5317
|
-
});
|
|
5938
|
+
throw getSolanaErrorFromTransactionError(signatureStatusNotification.value.err);
|
|
5318
5939
|
} else {
|
|
5319
5940
|
return;
|
|
5320
5941
|
}
|