@solana/web3.js 2.0.0-experimental.ad9c23c → 2.0.0-experimental.adbd218
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 +972 -269
- package/dist/index.development.js.map +1 -1
- package/dist/index.production.min.js +277 -277
- package/package.json +16 -16
|
@@ -125,6 +125,572 @@ 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__ADDRESS_BYTE_LENGTH_OUT_OF_RANGE = 13;
|
|
141
|
+
var SOLANA_ERROR__ADDRESS_STRING_LENGTH_OUT_OF_RANGE = 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__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE = 48;
|
|
176
|
+
var SOLANA_ERROR__BLOCKHASH_BYTE_LENGTH_OUT_OF_RANGE = 49;
|
|
177
|
+
var SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE = 50;
|
|
178
|
+
var SOLANA_ERROR__MALFORMED_BIGINT_STRING = 51;
|
|
179
|
+
var SOLANA_ERROR__MALFORMED_NUMBER_STRING = 52;
|
|
180
|
+
var SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE = 53;
|
|
181
|
+
var SOLANA_ERROR__RPC_TRANSPORT_HEADER_FORBIDDEN = 54;
|
|
182
|
+
var SOLANA_ERROR__RPC_TRANSPORT_HTTP_ERROR = 55;
|
|
183
|
+
var SOLANA_ERROR__EXPECTED_INSTRUCTION_TO_HAVE_ACCOUNTS = 70;
|
|
184
|
+
var SOLANA_ERROR__EXPECTED_INSTRUCTION_TO_HAVE_DATA = 71;
|
|
185
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_UNKNOWN = 4615e3;
|
|
186
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_GENERIC_ERROR = 4615001;
|
|
187
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ARGUMENT = 4615002;
|
|
188
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_INSTRUCTION_DATA = 4615003;
|
|
189
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ACCOUNT_DATA = 4615004;
|
|
190
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_DATA_TOO_SMALL = 4615005;
|
|
191
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INSUFFICIENT_FUNDS = 4615006;
|
|
192
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INCORRECT_PROGRAM_ID = 4615007;
|
|
193
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_MISSING_REQUIRED_SIGNATURE = 4615008;
|
|
194
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_ALREADY_INITIALIZED = 4615009;
|
|
195
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_UNINITIALIZED_ACCOUNT = 4615010;
|
|
196
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_UNBALANCED_INSTRUCTION = 4615011;
|
|
197
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_MODIFIED_PROGRAM_ID = 4615012;
|
|
198
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_EXTERNAL_ACCOUNT_LAMPORT_SPEND = 4615013;
|
|
199
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_EXTERNAL_ACCOUNT_DATA_MODIFIED = 4615014;
|
|
200
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_READONLY_LAMPORT_CHANGE = 4615015;
|
|
201
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_READONLY_DATA_MODIFIED = 4615016;
|
|
202
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_DUPLICATE_ACCOUNT_INDEX = 4615017;
|
|
203
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_MODIFIED = 4615018;
|
|
204
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_RENT_EPOCH_MODIFIED = 4615019;
|
|
205
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_NOT_ENOUGH_ACCOUNT_KEYS = 4615020;
|
|
206
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_DATA_SIZE_CHANGED = 4615021;
|
|
207
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_NOT_EXECUTABLE = 4615022;
|
|
208
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_BORROW_FAILED = 4615023;
|
|
209
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_BORROW_OUTSTANDING = 4615024;
|
|
210
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_DUPLICATE_ACCOUNT_OUT_OF_SYNC = 4615025;
|
|
211
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_CUSTOM = 4615026;
|
|
212
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ERROR = 4615027;
|
|
213
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_DATA_MODIFIED = 4615028;
|
|
214
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_LAMPORT_CHANGE = 4615029;
|
|
215
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_ACCOUNT_NOT_RENT_EXEMPT = 4615030;
|
|
216
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_UNSUPPORTED_PROGRAM_ID = 4615031;
|
|
217
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_CALL_DEPTH = 4615032;
|
|
218
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_MISSING_ACCOUNT = 4615033;
|
|
219
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_REENTRANCY_NOT_ALLOWED = 4615034;
|
|
220
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_MAX_SEED_LENGTH_EXCEEDED = 4615035;
|
|
221
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_SEEDS = 4615036;
|
|
222
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_REALLOC = 4615037;
|
|
223
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_COMPUTATIONAL_BUDGET_EXCEEDED = 4615038;
|
|
224
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_PRIVILEGE_ESCALATION = 4615039;
|
|
225
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_PROGRAM_ENVIRONMENT_SETUP_FAILURE = 4615040;
|
|
226
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_PROGRAM_FAILED_TO_COMPLETE = 4615041;
|
|
227
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_PROGRAM_FAILED_TO_COMPILE = 4615042;
|
|
228
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_IMMUTABLE = 4615043;
|
|
229
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INCORRECT_AUTHORITY = 4615044;
|
|
230
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_BORSH_IO_ERROR = 4615045;
|
|
231
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_NOT_RENT_EXEMPT = 4615046;
|
|
232
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ACCOUNT_OWNER = 4615047;
|
|
233
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_ARITHMETIC_OVERFLOW = 4615048;
|
|
234
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_UNSUPPORTED_SYSVAR = 4615049;
|
|
235
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_ILLEGAL_OWNER = 4615050;
|
|
236
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED = 4615051;
|
|
237
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_MAX_ACCOUNTS_EXCEEDED = 4615052;
|
|
238
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED = 4615053;
|
|
239
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR_BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS = 4615054;
|
|
240
|
+
var SOLANA_ERROR__SIGNER_ADDRESS_CANNOT_HAVE_MULTIPLE_SIGNERS = 5508e3;
|
|
241
|
+
var SOLANA_ERROR__SIGNER_EXPECTED_KEY_PAIR_SIGNER = 5508001;
|
|
242
|
+
var SOLANA_ERROR__SIGNER_EXPECTED_MESSAGE_SIGNER = 5508002;
|
|
243
|
+
var SOLANA_ERROR__SIGNER_EXPECTED_MESSAGE_MODIFYING_SIGNER = 5508003;
|
|
244
|
+
var SOLANA_ERROR__SIGNER_EXPECTED_MESSAGE_PARTIAL_SIGNER = 5508004;
|
|
245
|
+
var SOLANA_ERROR__SIGNER_EXPECTED_TRANSACTION_SIGNER = 5508005;
|
|
246
|
+
var SOLANA_ERROR__SIGNER_EXPECTED_TRANSACTION_MODIFYING_SIGNER = 5508006;
|
|
247
|
+
var SOLANA_ERROR__SIGNER_EXPECTED_TRANSACTION_PARTIAL_SIGNER = 5508007;
|
|
248
|
+
var SOLANA_ERROR__SIGNER_EXPECTED_TRANSACTION_SENDING_SIGNER = 5508008;
|
|
249
|
+
var SOLANA_ERROR__SIGNER_TRANSACTION_CANNOT_HAVE_MULTIPLE_SENDING_SIGNERS = 5508009;
|
|
250
|
+
var SOLANA_ERROR__SIGNER_TRANSACTION_SENDING_SIGNER_MISSING = 5508010;
|
|
251
|
+
var SOLANA_ERROR__TRANSACTION_INVOKED_PROGRAMS_CANNOT_PAY_FEES = 5663001;
|
|
252
|
+
var SOLANA_ERROR__TRANSACTION_INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE = 5663002;
|
|
253
|
+
var SOLANA_ERROR__TRANSACTION_EXPECTED_BLOCKHASH_LIFETIME = 5663003;
|
|
254
|
+
var SOLANA_ERROR__TRANSACTION_EXPECTED_NONCE_LIFETIME = 5663004;
|
|
255
|
+
var SOLANA_ERROR__TRANSACTION_VERSION_NUMBER_OUT_OF_RANGE = 5663005;
|
|
256
|
+
var SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING = 5663006;
|
|
257
|
+
var SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE = 5663007;
|
|
258
|
+
var SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND = 5663008;
|
|
259
|
+
var SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_FEE_PAYER_MISSING = 5663009;
|
|
260
|
+
var SOLANA_ERROR__TRANSACTION_MISSING_SIGNATURES = 5663010;
|
|
261
|
+
var SOLANA_ERROR__TRANSACTION_SIGNATURE_NOT_COMPUTABLE = 5663011;
|
|
262
|
+
var SOLANA_ERROR__TRANSACTION_MISSING_ADDRESS = 5663012;
|
|
263
|
+
var SOLANA_ERROR__TRANSACTION_MISSING_FEE_PAYER = 5663013;
|
|
264
|
+
var SOLANA_ERROR__TRANSACTION_INVALID_NONCE_TRANSACTION_NO_INSTRUCTIONS = 5663014;
|
|
265
|
+
var SOLANA_ERROR__TRANSACTION_INVALID_NONCE_TRANSACTION_FIRST_INSTRUCTION_NOT_ADVANCE_NONCE = 5663015;
|
|
266
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_UNKNOWN = 705e4;
|
|
267
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_IN_USE = 7050001;
|
|
268
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_LOADED_TWICE = 7050002;
|
|
269
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_NOT_FOUND = 7050003;
|
|
270
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_PROGRAM_ACCOUNT_NOT_FOUND = 7050004;
|
|
271
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INSUFFICIENT_FUNDS_FOR_FEE = 7050005;
|
|
272
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ACCOUNT_FOR_FEE = 7050006;
|
|
273
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_ALREADY_PROCESSED = 7050007;
|
|
274
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_BLOCKHASH_NOT_FOUND = 7050008;
|
|
275
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_CALL_CHAIN_TOO_DEEP = 7050009;
|
|
276
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_MISSING_SIGNATURE_FOR_FEE = 7050010;
|
|
277
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ACCOUNT_INDEX = 7050011;
|
|
278
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_SIGNATURE_FAILURE = 7050012;
|
|
279
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INVALID_PROGRAM_FOR_EXECUTION = 7050013;
|
|
280
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_SANITIZE_FAILURE = 7050014;
|
|
281
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_CLUSTER_MAINTENANCE = 7050015;
|
|
282
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_BORROW_OUTSTANDING = 7050016;
|
|
283
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_MAX_BLOCK_COST_LIMIT = 7050017;
|
|
284
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_UNSUPPORTED_VERSION = 7050018;
|
|
285
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INVALID_WRITABLE_ACCOUNT = 7050019;
|
|
286
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_MAX_ACCOUNT_COST_LIMIT = 7050020;
|
|
287
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_ACCOUNT_DATA_BLOCK_LIMIT = 7050021;
|
|
288
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_TOO_MANY_ACCOUNT_LOCKS = 7050022;
|
|
289
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_ADDRESS_LOOKUP_TABLE_NOT_FOUND = 7050023;
|
|
290
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ADDRESS_LOOKUP_TABLE_OWNER = 7050024;
|
|
291
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ADDRESS_LOOKUP_TABLE_DATA = 7050025;
|
|
292
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ADDRESS_LOOKUP_TABLE_INDEX = 7050026;
|
|
293
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INVALID_RENT_PAYING_ACCOUNT = 7050027;
|
|
294
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_MAX_VOTE_COST_LIMIT = 7050028;
|
|
295
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_ACCOUNT_DATA_TOTAL_LIMIT = 7050029;
|
|
296
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_DUPLICATE_INSTRUCTION = 7050030;
|
|
297
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INSUFFICIENT_FUNDS_FOR_RENT = 7050031;
|
|
298
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_MAX_LOADED_ACCOUNTS_DATA_SIZE_EXCEEDED = 7050032;
|
|
299
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_INVALID_LOADED_ACCOUNTS_DATA_SIZE_LIMIT = 7050033;
|
|
300
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_RESANITIZATION_NEEDED = 7050034;
|
|
301
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED = 7050035;
|
|
302
|
+
var SOLANA_ERROR__TRANSACTION_ERROR_UNBALANCED_TRANSACTION = 7050036;
|
|
303
|
+
var SolanaErrorMessages = {
|
|
304
|
+
[SOLANA_ERROR__ACCOUNT_NOT_FOUND]: "Account not found at address: $address",
|
|
305
|
+
[SOLANA_ERROR__ADDRESS_BYTE_LENGTH_OUT_OF_RANGE]: "Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.",
|
|
306
|
+
[SOLANA_ERROR__ADDRESS_STRING_LENGTH_OUT_OF_RANGE]: "Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.",
|
|
307
|
+
[SOLANA_ERROR__BLOCKHASH_BYTE_LENGTH_OUT_OF_RANGE]: "Expected base58 encoded blockhash to decode to a byte array of length 32. Actual length: $actualLength.",
|
|
308
|
+
[SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE]: "Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.",
|
|
309
|
+
[SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED]: "The network has progressed past the last block for which this transaction could have been committed.",
|
|
310
|
+
[SOLANA_ERROR__CODECS_CANNOT_DECODE_EMPTY_BYTE_ARRAY]: "Codec [$codecDescription] cannot decode empty byte arrays.",
|
|
311
|
+
[SOLANA_ERROR__CODECS_CANNOT_REVERSE_CODEC_OF_VARIABLE_SIZE]: "Cannot reverse a codec of variable size.",
|
|
312
|
+
[SOLANA_ERROR__CODECS_CODEC_REQUIRES_FIXED_SIZE]: "Codec [$codecDescription] requires a fixed size.",
|
|
313
|
+
[SOLANA_ERROR__CODECS_ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH]: "Encoder and decoder must either both be fixed-size or variable-size.",
|
|
314
|
+
[SOLANA_ERROR__CODECS_ENUM_DISCRIMINATOR_OUT_OF_RANGE]: "Enum discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.",
|
|
315
|
+
[SOLANA_ERROR__CODECS_EXPECTED_FIXED_LENGTH_GOT_VARIABLE_LENGTH]: "Expected a fixed-size codec, got a variable-size one.",
|
|
316
|
+
[SOLANA_ERROR__CODECS_EXPECTED_VARIABLE_LENGTH_GOT_FIXED_LENGTH]: "Expected a variable-size codec, got a fixed-size one.",
|
|
317
|
+
[SOLANA_ERROR__CODECS_FIXED_NULLABLE_WITH_VARIABLE_SIZE_CODEC]: "Fixed nullables can only be used with fixed-size codecs.",
|
|
318
|
+
[SOLANA_ERROR__CODECS_FIXED_NULLABLE_WITH_VARIABLE_SIZE_PREFIX]: "Fixed nullables can only be used with fixed-size prefix.",
|
|
319
|
+
[SOLANA_ERROR__CODECS_FIXED_SIZE_ENCODER_DECODER_SIZE_MISMATCH]: "Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].",
|
|
320
|
+
[SOLANA_ERROR__CODECS_INVALID_DATA_ENUM_VARIANT]: "Invalid data enum variant. Expected one of [$variants], got $value.",
|
|
321
|
+
[SOLANA_ERROR__CODECS_INVALID_SCALAR_ENUM_VARIANT]: "Invalid scalar enum variant. Expected one of [$variants] or a number between $minRange and $maxRange, got $value.",
|
|
322
|
+
[SOLANA_ERROR__CODECS_INVALID_STRING_FOR_BASE]: "Invalid value $value for base $base with alphabet $alphabet.",
|
|
323
|
+
[SOLANA_ERROR__CODECS_NUMBER_OUT_OF_RANGE]: "Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.",
|
|
324
|
+
[SOLANA_ERROR__CODECS_VARIABLE_SIZE_ENCODER_DECODER_MAX_SIZE_MISMATCH]: "Encoder and decoder must have the same max size, got [$encoderMaxSize] and [$decoderMaxSize].",
|
|
325
|
+
[SOLANA_ERROR__CODECS_WRONG_NUMBER_OF_BYTES]: "Codec [$codecDescription] expected $expected bytes, got $bytesLength.",
|
|
326
|
+
[SOLANA_ERROR__CODECS_WRONG_NUMBER_OF_ITEMS]: "Expected [$codecDescription] to have $expected items, got $actual.",
|
|
327
|
+
[SOLANA_ERROR__COULD_NOT_FIND_VIABLE_PDA_BUMP_SEED]: "Unable to find a viable program address bump seed.",
|
|
328
|
+
[SOLANA_ERROR__EXPECTED_DECODED_ACCOUNT]: "Expected decoded account at address: $address",
|
|
329
|
+
[SOLANA_ERROR__EXPECTED_INSTRUCTION_TO_HAVE_ACCOUNTS]: "The instruction does not have any accounts.",
|
|
330
|
+
[SOLANA_ERROR__EXPECTED_INSTRUCTION_TO_HAVE_DATA]: "The instruction does not have any data.",
|
|
331
|
+
[SOLANA_ERROR__FAILED_TO_DECODE_ACCOUNT]: "Failed to decode account data at address: $address",
|
|
332
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_ALREADY_INITIALIZED]: "instruction requires an uninitialized account",
|
|
333
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_BORROW_FAILED]: "instruction tries to borrow reference for an account which is already borrowed",
|
|
334
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_BORROW_OUTSTANDING]: "instruction left account with an outstanding borrowed reference",
|
|
335
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_DATA_SIZE_CHANGED]: "program other than the account's owner changed the size of the account data",
|
|
336
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_DATA_TOO_SMALL]: "account data too small for instruction",
|
|
337
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_NOT_EXECUTABLE]: "instruction expected an executable account",
|
|
338
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_NOT_RENT_EXEMPT]: "An account does not have enough lamports to be rent-exempt",
|
|
339
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ARITHMETIC_OVERFLOW]: "Program arithmetic overflowed",
|
|
340
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_BORSH_IO_ERROR]: "Failed to serialize or deserialize account data: $encodedData",
|
|
341
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS]: "Builtin programs must consume compute units",
|
|
342
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_CALL_DEPTH]: "Cross-program invocation call depth too deep",
|
|
343
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_COMPUTATIONAL_BUDGET_EXCEEDED]: "Computational budget exceeded",
|
|
344
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_CUSTOM]: "custom program error: #$code",
|
|
345
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_DUPLICATE_ACCOUNT_INDEX]: "instruction contains duplicate accounts",
|
|
346
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_DUPLICATE_ACCOUNT_OUT_OF_SYNC]: "instruction modifications of multiply-passed account differ",
|
|
347
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_ACCOUNT_NOT_RENT_EXEMPT]: "executable accounts must be rent exempt",
|
|
348
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_DATA_MODIFIED]: "instruction changed executable accounts data",
|
|
349
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_LAMPORT_CHANGE]: "instruction changed the balance of an executable account",
|
|
350
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_MODIFIED]: "instruction changed executable bit of an account",
|
|
351
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_EXTERNAL_ACCOUNT_DATA_MODIFIED]: "instruction modified data of an account it does not own",
|
|
352
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_EXTERNAL_ACCOUNT_LAMPORT_SPEND]: "instruction spent from the balance of an account it does not own",
|
|
353
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_GENERIC_ERROR]: "generic instruction error",
|
|
354
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ILLEGAL_OWNER]: "Provided owner is not allowed",
|
|
355
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_IMMUTABLE]: "Account is immutable",
|
|
356
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INCORRECT_AUTHORITY]: "Incorrect authority provided",
|
|
357
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INCORRECT_PROGRAM_ID]: "incorrect program id for instruction",
|
|
358
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INSUFFICIENT_FUNDS]: "insufficient funds for instruction",
|
|
359
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ACCOUNT_DATA]: "invalid account data for instruction",
|
|
360
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ACCOUNT_OWNER]: "Invalid account owner",
|
|
361
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ARGUMENT]: "invalid program argument",
|
|
362
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ERROR]: "program returned invalid error code",
|
|
363
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_INSTRUCTION_DATA]: "invalid instruction data",
|
|
364
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_REALLOC]: "Failed to reallocate account data",
|
|
365
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_SEEDS]: "Provided seeds do not result in a valid address",
|
|
366
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED]: "Accounts data allocations exceeded the maximum allowed per transaction",
|
|
367
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MAX_ACCOUNTS_EXCEEDED]: "Max accounts exceeded",
|
|
368
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED]: "Max instruction trace length exceeded",
|
|
369
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MAX_SEED_LENGTH_EXCEEDED]: "Length of the seed is too long for address generation",
|
|
370
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MISSING_ACCOUNT]: "An account required by the instruction is missing",
|
|
371
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MISSING_REQUIRED_SIGNATURE]: "missing required signature for instruction",
|
|
372
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MODIFIED_PROGRAM_ID]: "instruction illegally modified the program id of an account",
|
|
373
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_NOT_ENOUGH_ACCOUNT_KEYS]: "insufficient account keys for instruction",
|
|
374
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_PRIVILEGE_ESCALATION]: "Cross-program invocation with unauthorized signer or writable account",
|
|
375
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_PROGRAM_ENVIRONMENT_SETUP_FAILURE]: "Failed to create program execution environment",
|
|
376
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_PROGRAM_FAILED_TO_COMPILE]: "Program failed to compile",
|
|
377
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_PROGRAM_FAILED_TO_COMPLETE]: "Program failed to complete",
|
|
378
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_READONLY_DATA_MODIFIED]: "instruction modified data of a read-only account",
|
|
379
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_READONLY_LAMPORT_CHANGE]: "instruction changed the balance of a read-only account",
|
|
380
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_REENTRANCY_NOT_ALLOWED]: "Cross-program invocation reentrancy not allowed for this instruction",
|
|
381
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_RENT_EPOCH_MODIFIED]: "instruction modified rent epoch of an account",
|
|
382
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_UNBALANCED_INSTRUCTION]: "sum of account balances before and after instruction do not match",
|
|
383
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_UNINITIALIZED_ACCOUNT]: "instruction requires an initialized account",
|
|
384
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_UNKNOWN]: "",
|
|
385
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_UNSUPPORTED_PROGRAM_ID]: "Unsupported program id",
|
|
386
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_UNSUPPORTED_SYSVAR]: "Unsupported sysvar",
|
|
387
|
+
[SOLANA_ERROR__INVALID_KEYPAIR_BYTES]: "Key pair bytes must be of length 64, got $byteLength.",
|
|
388
|
+
[SOLANA_ERROR__INVALID_SEEDS_POINT_ON_CURVE]: "Invalid seeds; point must fall off the Ed25519 curve.",
|
|
389
|
+
[SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE]: "Lamports value must be in the range [0, 2e64-1]",
|
|
390
|
+
[SOLANA_ERROR__MALFORMED_BIGINT_STRING]: "`$value` cannot be parsed as a `BigInt`",
|
|
391
|
+
[SOLANA_ERROR__MALFORMED_NUMBER_STRING]: "`$value` cannot be parsed as a `Number`",
|
|
392
|
+
[SOLANA_ERROR__MALFORMED_PROGRAM_DERIVED_ADDRESS]: "Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].",
|
|
393
|
+
[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.",
|
|
394
|
+
[SOLANA_ERROR__MAX_PDA_SEED_LENGTH_EXCEEDED]: "The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.",
|
|
395
|
+
[SOLANA_ERROR__MULTIPLE_ACCOUNTS_NOT_FOUND]: "Accounts not found at addresses: $addresses",
|
|
396
|
+
[SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND]: "No nonce account could be found at address `$nonceAccountAddress`",
|
|
397
|
+
[SOLANA_ERROR__NONCE_INVALID]: "The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",
|
|
398
|
+
[SOLANA_ERROR__NOT_ALL_ACCOUNTS_DECODED]: "Not all accounts were decoded. Encoded accounts found at addresses: $addresses.",
|
|
399
|
+
[SOLANA_ERROR__NOT_AN_ED25519_PUBLIC_KEY]: "The `CryptoKey` must be an `Ed25519` public key.",
|
|
400
|
+
[SOLANA_ERROR__NOT_A_BASE58_ENCODED_ADDRESS]: "$putativeAddress is not a base58-encoded address.",
|
|
401
|
+
[SOLANA_ERROR__PROGRAM_ADDRESS_ENDS_WITH_PDA_MARKER]: "Program address cannot end with PDA marker.",
|
|
402
|
+
[SOLANA_ERROR__PROGRAM_DERIVED_ADDRESS_BUMP_SEED_OUT_OF_RANGE]: "Expected program derived address bump to be in the range [0, 255], got: $bump.",
|
|
403
|
+
[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`.",
|
|
404
|
+
[SOLANA_ERROR__RPC_TRANSPORT_HEADER_FORBIDDEN]: "HTTP header(s) forbidden: $headers. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.",
|
|
405
|
+
[SOLANA_ERROR__RPC_TRANSPORT_HTTP_ERROR]: "HTTP error ($statusCode): $message",
|
|
406
|
+
[SOLANA_ERROR__SIGNER_ADDRESS_CANNOT_HAVE_MULTIPLE_SIGNERS]: "Multiple distinct signers were identified for address `$address`. Please ensure that you are using the same signer instance for each address.",
|
|
407
|
+
[SOLANA_ERROR__SIGNER_EXPECTED_KEY_PAIR_SIGNER]: "The provided value does not implement the `KeyPairSigner` interface",
|
|
408
|
+
[SOLANA_ERROR__SIGNER_EXPECTED_MESSAGE_MODIFYING_SIGNER]: "The provided value does not implement the `MessageModifyingSigner` interface",
|
|
409
|
+
[SOLANA_ERROR__SIGNER_EXPECTED_MESSAGE_PARTIAL_SIGNER]: "The provided value does not implement the `MessagePartialSigner` interface",
|
|
410
|
+
[SOLANA_ERROR__SIGNER_EXPECTED_MESSAGE_SIGNER]: "The provided value does not implement any of the `MessageSigner` interfaces",
|
|
411
|
+
[SOLANA_ERROR__SIGNER_EXPECTED_TRANSACTION_MODIFYING_SIGNER]: "The provided value does not implement the `TransactionModifyingSigner` interface",
|
|
412
|
+
[SOLANA_ERROR__SIGNER_EXPECTED_TRANSACTION_PARTIAL_SIGNER]: "The provided value does not implement the `TransactionPartialSigner` interface",
|
|
413
|
+
[SOLANA_ERROR__SIGNER_EXPECTED_TRANSACTION_SENDING_SIGNER]: "The provided value does not implement the `TransactionSendingSigner` interface",
|
|
414
|
+
[SOLANA_ERROR__SIGNER_EXPECTED_TRANSACTION_SIGNER]: "The provided value does not implement any of the `TransactionSigner` interfaces",
|
|
415
|
+
[SOLANA_ERROR__SIGNER_TRANSACTION_CANNOT_HAVE_MULTIPLE_SENDING_SIGNERS]: "More than one `TransactionSendingSigner` was identified.",
|
|
416
|
+
[SOLANA_ERROR__SIGNER_TRANSACTION_SENDING_SIGNER_MISSING]: "No `TransactionSendingSigner` was identified. Please provide a valid `ITransactionWithSingleSendingSigner` transaction.",
|
|
417
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO_DIGEST_MISSING]: "No digest implementation could be found.",
|
|
418
|
+
[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.",
|
|
419
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO_EXPORT_FUNCTION_MISSING]: "No signature verification implementation could be found.",
|
|
420
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO_GENERATE_FUNCTION_MISSING]: "No key generation implementation could be found.",
|
|
421
|
+
[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.",
|
|
422
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO_SIGN_FUNCTION_MISSING]: "No signing implementation could be found.",
|
|
423
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO_VERIFY_FUNCTION_MISSING]: "No key export implementation could be found.",
|
|
424
|
+
[SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE]: "Timestamp value must be in the range [-8.64e15, 8.64e15]. `$value` given",
|
|
425
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_BORROW_OUTSTANDING]: "Transaction processing left an account with an outstanding borrowed reference",
|
|
426
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_IN_USE]: "Account in use",
|
|
427
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_LOADED_TWICE]: "Account loaded twice",
|
|
428
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_NOT_FOUND]: "Attempt to debit an account but found no record of a prior credit.",
|
|
429
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_ADDRESS_LOOKUP_TABLE_NOT_FOUND]: "Transaction loads an address table account that doesn't exist",
|
|
430
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_ALREADY_PROCESSED]: "This transaction has already been processed",
|
|
431
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_BLOCKHASH_NOT_FOUND]: "Blockhash not found",
|
|
432
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_CALL_CHAIN_TOO_DEEP]: "Loader call chain is too deep",
|
|
433
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_CLUSTER_MAINTENANCE]: "Transactions are currently disabled due to cluster maintenance",
|
|
434
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_DUPLICATE_INSTRUCTION]: "Transaction contains a duplicate instruction ($index) that is not allowed",
|
|
435
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INSUFFICIENT_FUNDS_FOR_FEE]: "Insufficient funds for fee",
|
|
436
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INSUFFICIENT_FUNDS_FOR_RENT]: "Transaction results in an account ($accountIndex) with insufficient funds for rent",
|
|
437
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ACCOUNT_FOR_FEE]: "This account may not be used to pay transaction fees",
|
|
438
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ACCOUNT_INDEX]: "Transaction contains an invalid account reference",
|
|
439
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ADDRESS_LOOKUP_TABLE_DATA]: "Transaction loads an address table account with invalid data",
|
|
440
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ADDRESS_LOOKUP_TABLE_INDEX]: "Transaction address table lookup uses an invalid index",
|
|
441
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ADDRESS_LOOKUP_TABLE_OWNER]: "Transaction loads an address table account with an invalid owner",
|
|
442
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_LOADED_ACCOUNTS_DATA_SIZE_LIMIT]: "LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",
|
|
443
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_PROGRAM_FOR_EXECUTION]: "This program may not be used for executing instructions",
|
|
444
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_RENT_PAYING_ACCOUNT]: "Transaction leaves an account with a lower balance than rent-exempt minimum",
|
|
445
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_WRITABLE_ACCOUNT]: "Transaction loads a writable account that cannot be written",
|
|
446
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_MAX_LOADED_ACCOUNTS_DATA_SIZE_EXCEEDED]: "Transaction exceeded max loaded accounts data size cap",
|
|
447
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_MISSING_SIGNATURE_FOR_FEE]: "Transaction requires a fee but has no signature present",
|
|
448
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_PROGRAM_ACCOUNT_NOT_FOUND]: "Attempt to load a program that does not exist",
|
|
449
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED]: "Execution of the program referenced by account at index $accountIndex is temporarily restricted.",
|
|
450
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_RESANITIZATION_NEEDED]: "ResanitizationNeeded",
|
|
451
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_SANITIZE_FAILURE]: "Transaction failed to sanitize accounts offsets correctly",
|
|
452
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_SIGNATURE_FAILURE]: "Transaction did not pass signature verification",
|
|
453
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_TOO_MANY_ACCOUNT_LOCKS]: "Transaction locked too many accounts",
|
|
454
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_UNBALANCED_TRANSACTION]: "Sum of account balances before and after transaction do not match",
|
|
455
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_UNKNOWN]: "The transaction failed with the error `$errorName`",
|
|
456
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_UNSUPPORTED_VERSION]: "Transaction version is unsupported",
|
|
457
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_ACCOUNT_DATA_BLOCK_LIMIT]: "Transaction would exceed account data limit within the block",
|
|
458
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_ACCOUNT_DATA_TOTAL_LIMIT]: "Transaction would exceed total account data limit",
|
|
459
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_MAX_ACCOUNT_COST_LIMIT]: "Transaction would exceed max account limit within the block",
|
|
460
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_MAX_BLOCK_COST_LIMIT]: "Transaction would exceed max Block Cost Limit",
|
|
461
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_MAX_VOTE_COST_LIMIT]: "Transaction would exceed max Vote Cost Limit",
|
|
462
|
+
[SOLANA_ERROR__TRANSACTION_EXPECTED_BLOCKHASH_LIFETIME]: "Transaction does not have a blockhash lifetime",
|
|
463
|
+
[SOLANA_ERROR__TRANSACTION_EXPECTED_NONCE_LIFETIME]: "Transaction is not a durable nonce transaction",
|
|
464
|
+
[SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING]: "Contents of these address lookup tables unknown: $lookupTableAddresses",
|
|
465
|
+
[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",
|
|
466
|
+
[SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_FEE_PAYER_MISSING]: "No fee payer set in CompiledTransaction",
|
|
467
|
+
[SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND]: "Could not find program address at index $index",
|
|
468
|
+
[SOLANA_ERROR__TRANSACTION_INVALID_NONCE_TRANSACTION_FIRST_INSTRUCTION_NOT_ADVANCE_NONCE]: "Transaction first instruction is not advance nonce account instruction.",
|
|
469
|
+
[SOLANA_ERROR__TRANSACTION_INVALID_NONCE_TRANSACTION_NO_INSTRUCTIONS]: "Transaction with no instructions cannot be durable nonce transaction.",
|
|
470
|
+
[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",
|
|
471
|
+
[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",
|
|
472
|
+
[SOLANA_ERROR__TRANSACTION_MISSING_ADDRESS]: "Transaction is missing an address at index: $index.",
|
|
473
|
+
[SOLANA_ERROR__TRANSACTION_MISSING_FEE_PAYER]: "Transaction is missing a fee payer.",
|
|
474
|
+
[SOLANA_ERROR__TRANSACTION_MISSING_SIGNATURES]: "Transaction is missing signatures for addresses: $addresses.",
|
|
475
|
+
[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.",
|
|
476
|
+
[SOLANA_ERROR__TRANSACTION_VERSION_NUMBER_OUT_OF_RANGE]: "Transaction version must be in the range [0, 127]. `$actualVersion` given"
|
|
477
|
+
};
|
|
478
|
+
function getHumanReadableErrorMessage(code, context = {}) {
|
|
479
|
+
const messageFormatString = SolanaErrorMessages[code];
|
|
480
|
+
const message = messageFormatString.replace(
|
|
481
|
+
new RegExp("(?<!\\\\)\\$(\\w+)", "g"),
|
|
482
|
+
(substring, variableName) => variableName in context ? `${context[variableName]}` : substring
|
|
483
|
+
);
|
|
484
|
+
return message;
|
|
485
|
+
}
|
|
486
|
+
function getErrorMessage(code, context = {}) {
|
|
487
|
+
{
|
|
488
|
+
return getHumanReadableErrorMessage(code, context);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
function isSolanaError(e4, code) {
|
|
492
|
+
const isSolanaError2 = e4 instanceof Error && e4.name === "SolanaError";
|
|
493
|
+
if (isSolanaError2) {
|
|
494
|
+
if (code !== void 0) {
|
|
495
|
+
return e4.context.__code === code;
|
|
496
|
+
}
|
|
497
|
+
return true;
|
|
498
|
+
}
|
|
499
|
+
return false;
|
|
500
|
+
}
|
|
501
|
+
var SolanaError = class extends Error {
|
|
502
|
+
constructor(...[code, context]) {
|
|
503
|
+
const message = getErrorMessage(code, context);
|
|
504
|
+
super(message);
|
|
505
|
+
__publicField(this, "context");
|
|
506
|
+
this.context = {
|
|
507
|
+
__code: code,
|
|
508
|
+
...context
|
|
509
|
+
};
|
|
510
|
+
this.name = "SolanaError";
|
|
511
|
+
}
|
|
512
|
+
};
|
|
513
|
+
function getSolanaErrorFromRpcError({ errorCodeBaseOffset, getErrorContext, orderedErrorNames, rpcEnumError }, constructorOpt) {
|
|
514
|
+
let rpcErrorName;
|
|
515
|
+
let rpcErrorContext;
|
|
516
|
+
if (typeof rpcEnumError === "string") {
|
|
517
|
+
rpcErrorName = rpcEnumError;
|
|
518
|
+
} else {
|
|
519
|
+
rpcErrorName = Object.keys(rpcEnumError)[0];
|
|
520
|
+
rpcErrorContext = rpcEnumError[rpcErrorName];
|
|
521
|
+
}
|
|
522
|
+
const codeOffset = orderedErrorNames.indexOf(rpcErrorName);
|
|
523
|
+
const errorCode = errorCodeBaseOffset + codeOffset;
|
|
524
|
+
const errorContext = getErrorContext(errorCode, rpcErrorName, rpcErrorContext);
|
|
525
|
+
const err = new SolanaError(errorCode, errorContext);
|
|
526
|
+
if ("captureStackTrace" in Error && typeof Error.captureStackTrace === "function") {
|
|
527
|
+
Error.captureStackTrace(err, constructorOpt);
|
|
528
|
+
}
|
|
529
|
+
return err;
|
|
530
|
+
}
|
|
531
|
+
var ORDERED_ERROR_NAMES = [
|
|
532
|
+
// Keep synced with RPC source: https://github.com/anza-xyz/agave/blob/master/sdk/program/src/instruction.rs
|
|
533
|
+
// If this list ever gets too large, consider implementing a compression strategy like this:
|
|
534
|
+
// https://gist.github.com/steveluscher/aaa7cbbb5433b1197983908a40860c47
|
|
535
|
+
"GenericError",
|
|
536
|
+
"InvalidArgument",
|
|
537
|
+
"InvalidInstructionData",
|
|
538
|
+
"InvalidAccountData",
|
|
539
|
+
"AccountDataTooSmall",
|
|
540
|
+
"InsufficientFunds",
|
|
541
|
+
"IncorrectProgramId",
|
|
542
|
+
"MissingRequiredSignature",
|
|
543
|
+
"AccountAlreadyInitialized",
|
|
544
|
+
"UninitializedAccount",
|
|
545
|
+
"UnbalancedInstruction",
|
|
546
|
+
"ModifiedProgramId",
|
|
547
|
+
"ExternalAccountLamportSpend",
|
|
548
|
+
"ExternalAccountDataModified",
|
|
549
|
+
"ReadonlyLamportChange",
|
|
550
|
+
"ReadonlyDataModified",
|
|
551
|
+
"DuplicateAccountIndex",
|
|
552
|
+
"ExecutableModified",
|
|
553
|
+
"RentEpochModified",
|
|
554
|
+
"NotEnoughAccountKeys",
|
|
555
|
+
"AccountDataSizeChanged",
|
|
556
|
+
"AccountNotExecutable",
|
|
557
|
+
"AccountBorrowFailed",
|
|
558
|
+
"AccountBorrowOutstanding",
|
|
559
|
+
"DuplicateAccountOutOfSync",
|
|
560
|
+
"Custom",
|
|
561
|
+
"InvalidError",
|
|
562
|
+
"ExecutableDataModified",
|
|
563
|
+
"ExecutableLamportChange",
|
|
564
|
+
"ExecutableAccountNotRentExempt",
|
|
565
|
+
"UnsupportedProgramId",
|
|
566
|
+
"CallDepth",
|
|
567
|
+
"MissingAccount",
|
|
568
|
+
"ReentrancyNotAllowed",
|
|
569
|
+
"MaxSeedLengthExceeded",
|
|
570
|
+
"InvalidSeeds",
|
|
571
|
+
"InvalidRealloc",
|
|
572
|
+
"ComputationalBudgetExceeded",
|
|
573
|
+
"PrivilegeEscalation",
|
|
574
|
+
"ProgramEnvironmentSetupFailure",
|
|
575
|
+
"ProgramFailedToComplete",
|
|
576
|
+
"ProgramFailedToCompile",
|
|
577
|
+
"Immutable",
|
|
578
|
+
"IncorrectAuthority",
|
|
579
|
+
"BorshIoError",
|
|
580
|
+
"AccountNotRentExempt",
|
|
581
|
+
"InvalidAccountOwner",
|
|
582
|
+
"ArithmeticOverflow",
|
|
583
|
+
"UnsupportedSysvar",
|
|
584
|
+
"IllegalOwner",
|
|
585
|
+
"MaxAccountsDataAllocationsExceeded",
|
|
586
|
+
"MaxAccountsExceeded",
|
|
587
|
+
"MaxInstructionTraceLengthExceeded",
|
|
588
|
+
"BuiltinProgramsMustConsumeComputeUnits"
|
|
589
|
+
];
|
|
590
|
+
function getSolanaErrorFromInstructionError(index, instructionError) {
|
|
591
|
+
return getSolanaErrorFromRpcError(
|
|
592
|
+
{
|
|
593
|
+
errorCodeBaseOffset: 4615001,
|
|
594
|
+
getErrorContext(errorCode, rpcErrorName, rpcErrorContext) {
|
|
595
|
+
if (errorCode === SOLANA_ERROR__INSTRUCTION_ERROR_UNKNOWN) {
|
|
596
|
+
return {
|
|
597
|
+
errorName: rpcErrorName,
|
|
598
|
+
index,
|
|
599
|
+
...rpcErrorContext !== void 0 ? { instructionErrorContext: rpcErrorContext } : null
|
|
600
|
+
};
|
|
601
|
+
} else if (errorCode === SOLANA_ERROR__INSTRUCTION_ERROR_CUSTOM) {
|
|
602
|
+
return {
|
|
603
|
+
code: rpcErrorContext,
|
|
604
|
+
index
|
|
605
|
+
};
|
|
606
|
+
} else if (errorCode === SOLANA_ERROR__INSTRUCTION_ERROR_BORSH_IO_ERROR) {
|
|
607
|
+
return {
|
|
608
|
+
encodedData: rpcErrorContext,
|
|
609
|
+
index
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
return { index };
|
|
613
|
+
},
|
|
614
|
+
orderedErrorNames: ORDERED_ERROR_NAMES,
|
|
615
|
+
rpcEnumError: instructionError
|
|
616
|
+
},
|
|
617
|
+
getSolanaErrorFromInstructionError
|
|
618
|
+
);
|
|
619
|
+
}
|
|
620
|
+
var ORDERED_ERROR_NAMES2 = [
|
|
621
|
+
// Keep synced with RPC source: https://github.com/anza-xyz/agave/blob/master/sdk/src/transaction/error.rs
|
|
622
|
+
// If this list ever gets too large, consider implementing a compression strategy like this:
|
|
623
|
+
// https://gist.github.com/steveluscher/aaa7cbbb5433b1197983908a40860c47
|
|
624
|
+
"AccountInUse",
|
|
625
|
+
"AccountLoadedTwice",
|
|
626
|
+
"AccountNotFound",
|
|
627
|
+
"ProgramAccountNotFound",
|
|
628
|
+
"InsufficientFundsForFee",
|
|
629
|
+
"InvalidAccountForFee",
|
|
630
|
+
"AlreadyProcessed",
|
|
631
|
+
"BlockhashNotFound",
|
|
632
|
+
// `InstructionError` intentionally omitted; delegated to `getSolanaErrorFromInstructionError`
|
|
633
|
+
"CallChainTooDeep",
|
|
634
|
+
"MissingSignatureForFee",
|
|
635
|
+
"InvalidAccountIndex",
|
|
636
|
+
"SignatureFailure",
|
|
637
|
+
"InvalidProgramForExecution",
|
|
638
|
+
"SanitizeFailure",
|
|
639
|
+
"ClusterMaintenance",
|
|
640
|
+
"AccountBorrowOutstanding",
|
|
641
|
+
"WouldExceedMaxBlockCostLimit",
|
|
642
|
+
"UnsupportedVersion",
|
|
643
|
+
"InvalidWritableAccount",
|
|
644
|
+
"WouldExceedMaxAccountCostLimit",
|
|
645
|
+
"WouldExceedAccountDataBlockLimit",
|
|
646
|
+
"TooManyAccountLocks",
|
|
647
|
+
"AddressLookupTableNotFound",
|
|
648
|
+
"InvalidAddressLookupTableOwner",
|
|
649
|
+
"InvalidAddressLookupTableData",
|
|
650
|
+
"InvalidAddressLookupTableIndex",
|
|
651
|
+
"InvalidRentPayingAccount",
|
|
652
|
+
"WouldExceedMaxVoteCostLimit",
|
|
653
|
+
"WouldExceedAccountDataTotalLimit",
|
|
654
|
+
"DuplicateInstruction",
|
|
655
|
+
"InsufficientFundsForRent",
|
|
656
|
+
"MaxLoadedAccountsDataSizeExceeded",
|
|
657
|
+
"InvalidLoadedAccountsDataSizeLimit",
|
|
658
|
+
"ResanitizationNeeded",
|
|
659
|
+
"ProgramExecutionTemporarilyRestricted",
|
|
660
|
+
"UnbalancedTransaction"
|
|
661
|
+
];
|
|
662
|
+
function getSolanaErrorFromTransactionError(transactionError) {
|
|
663
|
+
if (typeof transactionError === "object" && "InstructionError" in transactionError) {
|
|
664
|
+
return getSolanaErrorFromInstructionError(
|
|
665
|
+
...transactionError.InstructionError
|
|
666
|
+
);
|
|
667
|
+
}
|
|
668
|
+
return getSolanaErrorFromRpcError(
|
|
669
|
+
{
|
|
670
|
+
errorCodeBaseOffset: 7050001,
|
|
671
|
+
getErrorContext(errorCode, rpcErrorName, rpcErrorContext) {
|
|
672
|
+
if (errorCode === SOLANA_ERROR__TRANSACTION_ERROR_UNKNOWN) {
|
|
673
|
+
return {
|
|
674
|
+
errorName: rpcErrorName,
|
|
675
|
+
...rpcErrorContext !== void 0 ? { transactionErrorContext: rpcErrorContext } : null
|
|
676
|
+
};
|
|
677
|
+
} else if (errorCode === SOLANA_ERROR__TRANSACTION_ERROR_DUPLICATE_INSTRUCTION) {
|
|
678
|
+
return {
|
|
679
|
+
index: rpcErrorContext
|
|
680
|
+
};
|
|
681
|
+
} else if (errorCode === SOLANA_ERROR__TRANSACTION_ERROR_INSUFFICIENT_FUNDS_FOR_RENT || errorCode === SOLANA_ERROR__TRANSACTION_ERROR_PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED) {
|
|
682
|
+
return {
|
|
683
|
+
accountIndex: rpcErrorContext.account_index
|
|
684
|
+
};
|
|
685
|
+
}
|
|
686
|
+
},
|
|
687
|
+
orderedErrorNames: ORDERED_ERROR_NAMES2,
|
|
688
|
+
rpcEnumError: transactionError
|
|
689
|
+
},
|
|
690
|
+
getSolanaErrorFromTransactionError
|
|
691
|
+
);
|
|
692
|
+
}
|
|
693
|
+
|
|
128
694
|
// ../codecs-strings/dist/index.browser.js
|
|
129
695
|
init_env_shim();
|
|
130
696
|
|
|
@@ -132,13 +698,19 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
132
698
|
init_env_shim();
|
|
133
699
|
function assertByteArrayIsNotEmptyForCodec(codecDescription, bytes, offset = 0) {
|
|
134
700
|
if (bytes.length - offset <= 0) {
|
|
135
|
-
throw new
|
|
701
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_CANNOT_DECODE_EMPTY_BYTE_ARRAY, {
|
|
702
|
+
codecDescription
|
|
703
|
+
});
|
|
136
704
|
}
|
|
137
705
|
}
|
|
138
706
|
function assertByteArrayHasEnoughBytesForCodec(codecDescription, expected, bytes, offset = 0) {
|
|
139
707
|
const bytesLength = bytes.length - offset;
|
|
140
708
|
if (bytesLength < expected) {
|
|
141
|
-
throw new
|
|
709
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_WRONG_NUMBER_OF_BYTES, {
|
|
710
|
+
bytesLength,
|
|
711
|
+
codecDescription,
|
|
712
|
+
expected
|
|
713
|
+
});
|
|
142
714
|
}
|
|
143
715
|
}
|
|
144
716
|
var mergeBytes = (byteArrays) => {
|
|
@@ -199,32 +771,34 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
199
771
|
function isFixedSize(codec) {
|
|
200
772
|
return "fixedSize" in codec && typeof codec.fixedSize === "number";
|
|
201
773
|
}
|
|
202
|
-
function assertIsFixedSize(codec
|
|
774
|
+
function assertIsFixedSize(codec) {
|
|
203
775
|
if (!isFixedSize(codec)) {
|
|
204
|
-
throw new
|
|
776
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_EXPECTED_FIXED_LENGTH_GOT_VARIABLE_LENGTH);
|
|
205
777
|
}
|
|
206
778
|
}
|
|
207
779
|
function isVariableSize(codec) {
|
|
208
780
|
return !isFixedSize(codec);
|
|
209
781
|
}
|
|
210
|
-
function assertIsVariableSize(codec
|
|
782
|
+
function assertIsVariableSize(codec) {
|
|
211
783
|
if (!isVariableSize(codec)) {
|
|
212
|
-
throw new
|
|
784
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_EXPECTED_VARIABLE_LENGTH_GOT_FIXED_LENGTH);
|
|
213
785
|
}
|
|
214
786
|
}
|
|
215
787
|
function combineCodec(encoder, decoder) {
|
|
216
788
|
if (isFixedSize(encoder) !== isFixedSize(decoder)) {
|
|
217
|
-
throw new
|
|
789
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH);
|
|
218
790
|
}
|
|
219
791
|
if (isFixedSize(encoder) && isFixedSize(decoder) && encoder.fixedSize !== decoder.fixedSize) {
|
|
220
|
-
throw new
|
|
221
|
-
|
|
222
|
-
|
|
792
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_FIXED_SIZE_ENCODER_DECODER_SIZE_MISMATCH, {
|
|
793
|
+
decoderFixedSize: decoder.fixedSize,
|
|
794
|
+
encoderFixedSize: encoder.fixedSize
|
|
795
|
+
});
|
|
223
796
|
}
|
|
224
797
|
if (!isFixedSize(encoder) && !isFixedSize(decoder) && encoder.maxSize !== decoder.maxSize) {
|
|
225
|
-
throw new
|
|
226
|
-
|
|
227
|
-
|
|
798
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_VARIABLE_SIZE_ENCODER_DECODER_MAX_SIZE_MISMATCH, {
|
|
799
|
+
decoderMaxSize: decoder.maxSize,
|
|
800
|
+
encoderMaxSize: encoder.maxSize
|
|
801
|
+
});
|
|
228
802
|
}
|
|
229
803
|
return {
|
|
230
804
|
...decoder,
|
|
@@ -287,7 +861,15 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
287
861
|
});
|
|
288
862
|
}
|
|
289
863
|
function reverseEncoder(encoder) {
|
|
290
|
-
|
|
864
|
+
try {
|
|
865
|
+
assertIsFixedSize(encoder);
|
|
866
|
+
} catch (e4) {
|
|
867
|
+
if (isSolanaError(e4, SOLANA_ERROR__CODECS_EXPECTED_FIXED_LENGTH_GOT_VARIABLE_LENGTH)) {
|
|
868
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_CANNOT_REVERSE_CODEC_OF_VARIABLE_SIZE);
|
|
869
|
+
} else {
|
|
870
|
+
throw e4;
|
|
871
|
+
}
|
|
872
|
+
}
|
|
291
873
|
return createEncoder({
|
|
292
874
|
...encoder,
|
|
293
875
|
write: (value, bytes, offset) => {
|
|
@@ -299,7 +881,15 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
299
881
|
});
|
|
300
882
|
}
|
|
301
883
|
function reverseDecoder(decoder) {
|
|
302
|
-
|
|
884
|
+
try {
|
|
885
|
+
assertIsFixedSize(decoder);
|
|
886
|
+
} catch (e4) {
|
|
887
|
+
if (isSolanaError(e4, SOLANA_ERROR__CODECS_EXPECTED_FIXED_LENGTH_GOT_VARIABLE_LENGTH)) {
|
|
888
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_CANNOT_REVERSE_CODEC_OF_VARIABLE_SIZE);
|
|
889
|
+
} else {
|
|
890
|
+
throw e4;
|
|
891
|
+
}
|
|
892
|
+
}
|
|
303
893
|
return createDecoder({
|
|
304
894
|
...decoder,
|
|
305
895
|
read: (bytes, offset) => {
|
|
@@ -321,9 +911,12 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
321
911
|
init_env_shim();
|
|
322
912
|
function assertNumberIsBetweenForCodec(codecDescription, min, max, value) {
|
|
323
913
|
if (value < min || value > max) {
|
|
324
|
-
throw new
|
|
325
|
-
|
|
326
|
-
|
|
914
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_NUMBER_OUT_OF_RANGE, {
|
|
915
|
+
codecDescription,
|
|
916
|
+
max,
|
|
917
|
+
min,
|
|
918
|
+
value
|
|
919
|
+
});
|
|
327
920
|
}
|
|
328
921
|
}
|
|
329
922
|
var Endian = /* @__PURE__ */ ((Endian2) => {
|
|
@@ -518,7 +1111,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
518
1111
|
var getU128Encoder = (config = {}) => numberEncoderFactory({
|
|
519
1112
|
config,
|
|
520
1113
|
name: "u128",
|
|
521
|
-
range: [
|
|
1114
|
+
range: [0n, BigInt("0xffffffffffffffffffffffffffffffff")],
|
|
522
1115
|
set: (view, value, le) => {
|
|
523
1116
|
const leftOffset = le ? 8 : 0;
|
|
524
1117
|
const rightOffset = le ? 0 : 8;
|
|
@@ -572,7 +1165,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
572
1165
|
var getU64Encoder = (config = {}) => numberEncoderFactory({
|
|
573
1166
|
config,
|
|
574
1167
|
name: "u64",
|
|
575
|
-
range: [
|
|
1168
|
+
range: [0n, BigInt("0xffffffffffffffff")],
|
|
576
1169
|
set: (view, value, le) => view.setBigUint64(0, BigInt(value), le),
|
|
577
1170
|
size: 8
|
|
578
1171
|
});
|
|
@@ -599,7 +1192,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
599
1192
|
// ../codecs-strings/dist/index.browser.js
|
|
600
1193
|
function assertValidBaseString(alphabet4, testValue, givenValue = testValue) {
|
|
601
1194
|
if (!testValue.match(new RegExp(`^[${alphabet4}]*$`))) {
|
|
602
|
-
throw new
|
|
1195
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_INVALID_STRING_FOR_BASE, {
|
|
1196
|
+
alphabet: alphabet4,
|
|
1197
|
+
base: alphabet4.length,
|
|
1198
|
+
value: givenValue
|
|
1199
|
+
});
|
|
603
1200
|
}
|
|
604
1201
|
}
|
|
605
1202
|
var getBaseXEncoder = (alphabet4) => {
|
|
@@ -738,6 +1335,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
738
1335
|
}
|
|
739
1336
|
return output;
|
|
740
1337
|
}
|
|
1338
|
+
var alphabet3 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
741
1339
|
var getBase64Encoder = () => {
|
|
742
1340
|
{
|
|
743
1341
|
return createEncoder({
|
|
@@ -745,7 +1343,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
745
1343
|
try {
|
|
746
1344
|
return atob(value).length;
|
|
747
1345
|
} catch (e22) {
|
|
748
|
-
throw new
|
|
1346
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_INVALID_STRING_FOR_BASE, {
|
|
1347
|
+
alphabet: alphabet3,
|
|
1348
|
+
base: 64,
|
|
1349
|
+
value
|
|
1350
|
+
});
|
|
749
1351
|
}
|
|
750
1352
|
},
|
|
751
1353
|
write(value, bytes, offset) {
|
|
@@ -754,7 +1356,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
754
1356
|
bytes.set(bytesToAdd, offset);
|
|
755
1357
|
return bytesToAdd.length + offset;
|
|
756
1358
|
} catch (e22) {
|
|
757
|
-
throw new
|
|
1359
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_INVALID_STRING_FOR_BASE, {
|
|
1360
|
+
alphabet: alphabet3,
|
|
1361
|
+
base: 64,
|
|
1362
|
+
value
|
|
1363
|
+
});
|
|
758
1364
|
}
|
|
759
1365
|
}
|
|
760
1366
|
});
|
|
@@ -858,10 +1464,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
858
1464
|
return encodedAccount;
|
|
859
1465
|
}
|
|
860
1466
|
return Object.freeze({ ...encodedAccount, data: decoder.decode(encodedAccount.data) });
|
|
861
|
-
} catch (
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
1467
|
+
} catch (e4) {
|
|
1468
|
+
throw new SolanaError(SOLANA_ERROR__FAILED_TO_DECODE_ACCOUNT, {
|
|
1469
|
+
address: encodedAccount.address
|
|
1470
|
+
});
|
|
865
1471
|
}
|
|
866
1472
|
}
|
|
867
1473
|
function accountExists(account) {
|
|
@@ -869,14 +1475,18 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
869
1475
|
}
|
|
870
1476
|
function assertAccountDecoded(account) {
|
|
871
1477
|
if (accountExists(account) && account.data instanceof Uint8Array) {
|
|
872
|
-
throw new
|
|
1478
|
+
throw new SolanaError(SOLANA_ERROR__EXPECTED_DECODED_ACCOUNT, {
|
|
1479
|
+
address: account.address
|
|
1480
|
+
});
|
|
873
1481
|
}
|
|
874
1482
|
}
|
|
875
1483
|
function assertAccountsDecoded(accounts) {
|
|
876
1484
|
const encoded = accounts.filter((a) => accountExists(a) && a.data instanceof Uint8Array);
|
|
877
1485
|
if (encoded.length > 0) {
|
|
878
|
-
const encodedAddresses = encoded.map((a) => a.address)
|
|
879
|
-
throw new
|
|
1486
|
+
const encodedAddresses = encoded.map((a) => a.address);
|
|
1487
|
+
throw new SolanaError(SOLANA_ERROR__NOT_ALL_ACCOUNTS_DECODED, {
|
|
1488
|
+
addresses: encodedAddresses
|
|
1489
|
+
});
|
|
880
1490
|
}
|
|
881
1491
|
}
|
|
882
1492
|
function parseBase64RpcAccount(address2, rpcAccount) {
|
|
@@ -928,14 +1538,14 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
928
1538
|
}
|
|
929
1539
|
function assertAccountExists(account) {
|
|
930
1540
|
if (!account.exists) {
|
|
931
|
-
throw new
|
|
1541
|
+
throw new SolanaError(SOLANA_ERROR__ACCOUNT_NOT_FOUND, { address: account.address });
|
|
932
1542
|
}
|
|
933
1543
|
}
|
|
934
1544
|
function assertAccountsExist(accounts) {
|
|
935
1545
|
const missingAccounts = accounts.filter((a) => !a.exists);
|
|
936
1546
|
if (missingAccounts.length > 0) {
|
|
937
1547
|
const missingAddresses = missingAccounts.map((a) => a.address);
|
|
938
|
-
throw new
|
|
1548
|
+
throw new SolanaError(SOLANA_ERROR__MULTIPLE_ACCOUNTS_NOT_FOUND, { addresses: missingAddresses });
|
|
939
1549
|
}
|
|
940
1550
|
}
|
|
941
1551
|
|
|
@@ -946,9 +1556,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
946
1556
|
init_env_shim();
|
|
947
1557
|
function assertIsSecureContext() {
|
|
948
1558
|
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
|
-
);
|
|
1559
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_MISSING);
|
|
952
1560
|
}
|
|
953
1561
|
}
|
|
954
1562
|
var cachedEd25519Decision;
|
|
@@ -977,40 +1585,38 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
977
1585
|
var _a;
|
|
978
1586
|
assertIsSecureContext();
|
|
979
1587
|
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.digest) !== "function") {
|
|
980
|
-
throw new
|
|
1588
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_DIGEST_MISSING);
|
|
981
1589
|
}
|
|
982
1590
|
}
|
|
983
1591
|
async function assertKeyGenerationIsAvailable() {
|
|
984
1592
|
var _a;
|
|
985
1593
|
assertIsSecureContext();
|
|
986
1594
|
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.generateKey) !== "function") {
|
|
987
|
-
throw new
|
|
1595
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_GENERATE_FUNCTION_MISSING);
|
|
988
1596
|
}
|
|
989
1597
|
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
|
-
);
|
|
1598
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_ED25519_ALGORITHM_MISSING);
|
|
993
1599
|
}
|
|
994
1600
|
}
|
|
995
1601
|
async function assertKeyExporterIsAvailable() {
|
|
996
1602
|
var _a;
|
|
997
1603
|
assertIsSecureContext();
|
|
998
1604
|
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.exportKey) !== "function") {
|
|
999
|
-
throw new
|
|
1605
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_EXPORT_FUNCTION_MISSING);
|
|
1000
1606
|
}
|
|
1001
1607
|
}
|
|
1002
1608
|
async function assertSigningCapabilityIsAvailable() {
|
|
1003
1609
|
var _a;
|
|
1004
1610
|
assertIsSecureContext();
|
|
1005
1611
|
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.sign) !== "function") {
|
|
1006
|
-
throw new
|
|
1612
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_SIGN_FUNCTION_MISSING);
|
|
1007
1613
|
}
|
|
1008
1614
|
}
|
|
1009
1615
|
async function assertVerificationCapabilityIsAvailable() {
|
|
1010
1616
|
var _a;
|
|
1011
1617
|
assertIsSecureContext();
|
|
1012
1618
|
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.verify) !== "function") {
|
|
1013
|
-
throw new
|
|
1619
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_VERIFY_FUNCTION_MISSING);
|
|
1014
1620
|
}
|
|
1015
1621
|
}
|
|
1016
1622
|
|
|
@@ -1044,23 +1650,21 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1044
1650
|
return true;
|
|
1045
1651
|
}
|
|
1046
1652
|
function assertIsAddress(putativeAddress) {
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
throw new Error(`\`${putativeAddress}\` is not a base-58 encoded address`, {
|
|
1063
|
-
cause: e4
|
|
1653
|
+
if (
|
|
1654
|
+
// Lowest address (32 bytes of zeroes)
|
|
1655
|
+
putativeAddress.length < 32 || // Highest address (32 bytes of 255)
|
|
1656
|
+
putativeAddress.length > 44
|
|
1657
|
+
) {
|
|
1658
|
+
throw new SolanaError(SOLANA_ERROR__ADDRESS_STRING_LENGTH_OUT_OF_RANGE, {
|
|
1659
|
+
actualLength: putativeAddress.length
|
|
1660
|
+
});
|
|
1661
|
+
}
|
|
1662
|
+
const base58Encoder4 = getMemoizedBase58Encoder();
|
|
1663
|
+
const bytes = base58Encoder4.encode(putativeAddress);
|
|
1664
|
+
const numBytes = bytes.byteLength;
|
|
1665
|
+
if (numBytes !== 32) {
|
|
1666
|
+
throw new SolanaError(SOLANA_ERROR__ADDRESS_BYTE_LENGTH_OUT_OF_RANGE, {
|
|
1667
|
+
actualLength: numBytes
|
|
1064
1668
|
});
|
|
1065
1669
|
}
|
|
1066
1670
|
}
|
|
@@ -1182,12 +1786,12 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1182
1786
|
function assertIsProgramDerivedAddress(value) {
|
|
1183
1787
|
const validFormat = Array.isArray(value) && value.length === 2 && typeof value[0] === "string" && typeof value[1] === "number";
|
|
1184
1788
|
if (!validFormat) {
|
|
1185
|
-
throw new
|
|
1186
|
-
`Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].`
|
|
1187
|
-
);
|
|
1789
|
+
throw new SolanaError(SOLANA_ERROR__MALFORMED_PROGRAM_DERIVED_ADDRESS);
|
|
1188
1790
|
}
|
|
1189
1791
|
if (value[1] < 0 || value[1] > 255) {
|
|
1190
|
-
throw new
|
|
1792
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_DERIVED_ADDRESS_BUMP_SEED_OUT_OF_RANGE, {
|
|
1793
|
+
bump: value[1]
|
|
1794
|
+
});
|
|
1191
1795
|
}
|
|
1192
1796
|
assertIsAddress(value[0]);
|
|
1193
1797
|
}
|
|
@@ -1217,18 +1821,23 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1217
1821
|
115,
|
|
1218
1822
|
115
|
|
1219
1823
|
];
|
|
1220
|
-
var PointOnCurveError = class extends Error {
|
|
1221
|
-
};
|
|
1222
1824
|
async function createProgramDerivedAddress({ programAddress, seeds }) {
|
|
1223
1825
|
await assertDigestCapabilityIsAvailable();
|
|
1224
1826
|
if (seeds.length > MAX_SEEDS) {
|
|
1225
|
-
throw new
|
|
1827
|
+
throw new SolanaError(SOLANA_ERROR__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED, {
|
|
1828
|
+
actual: seeds.length,
|
|
1829
|
+
maxSeeds: MAX_SEEDS
|
|
1830
|
+
});
|
|
1226
1831
|
}
|
|
1227
1832
|
let textEncoder;
|
|
1228
1833
|
const seedBytes = seeds.reduce((acc, seed, ii) => {
|
|
1229
1834
|
const bytes = typeof seed === "string" ? (textEncoder || (textEncoder = new TextEncoder())).encode(seed) : seed;
|
|
1230
1835
|
if (bytes.byteLength > MAX_SEED_LENGTH) {
|
|
1231
|
-
throw new
|
|
1836
|
+
throw new SolanaError(SOLANA_ERROR__MAX_PDA_SEED_LENGTH_EXCEEDED, {
|
|
1837
|
+
actual: bytes.byteLength,
|
|
1838
|
+
index: ii,
|
|
1839
|
+
maxSeedLength: MAX_SEED_LENGTH
|
|
1840
|
+
});
|
|
1232
1841
|
}
|
|
1233
1842
|
acc.push(...bytes);
|
|
1234
1843
|
return acc;
|
|
@@ -1241,7 +1850,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1241
1850
|
);
|
|
1242
1851
|
const addressBytes = new Uint8Array(addressBytesBuffer);
|
|
1243
1852
|
if (await compressedPointBytesAreOnCurve(addressBytes)) {
|
|
1244
|
-
throw new
|
|
1853
|
+
throw new SolanaError(SOLANA_ERROR__INVALID_SEEDS_POINT_ON_CURVE);
|
|
1245
1854
|
}
|
|
1246
1855
|
return base58EncodedAddressCodec.decode(addressBytes);
|
|
1247
1856
|
}
|
|
@@ -1258,24 +1867,28 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1258
1867
|
});
|
|
1259
1868
|
return [address2, bumpSeed];
|
|
1260
1869
|
} catch (e4) {
|
|
1261
|
-
if (e4
|
|
1870
|
+
if (isSolanaError(e4, SOLANA_ERROR__INVALID_SEEDS_POINT_ON_CURVE)) {
|
|
1262
1871
|
bumpSeed--;
|
|
1263
1872
|
} else {
|
|
1264
1873
|
throw e4;
|
|
1265
1874
|
}
|
|
1266
1875
|
}
|
|
1267
1876
|
}
|
|
1268
|
-
throw new
|
|
1877
|
+
throw new SolanaError(SOLANA_ERROR__COULD_NOT_FIND_VIABLE_PDA_BUMP_SEED);
|
|
1269
1878
|
}
|
|
1270
1879
|
async function createAddressWithSeed({ baseAddress, programAddress, seed }) {
|
|
1271
1880
|
const { encode, decode } = getAddressCodec();
|
|
1272
1881
|
const seedBytes = typeof seed === "string" ? new TextEncoder().encode(seed) : seed;
|
|
1273
1882
|
if (seedBytes.byteLength > MAX_SEED_LENGTH) {
|
|
1274
|
-
throw new
|
|
1883
|
+
throw new SolanaError(SOLANA_ERROR__MAX_PDA_SEED_LENGTH_EXCEEDED, {
|
|
1884
|
+
actual: seedBytes.byteLength,
|
|
1885
|
+
index: 0,
|
|
1886
|
+
maxSeedLength: MAX_SEED_LENGTH
|
|
1887
|
+
});
|
|
1275
1888
|
}
|
|
1276
1889
|
const programAddressBytes = encode(programAddress);
|
|
1277
1890
|
if (programAddressBytes.length >= PDA_MARKER_BYTES.length && programAddressBytes.slice(-PDA_MARKER_BYTES.length).every((byte, index) => byte === PDA_MARKER_BYTES[index])) {
|
|
1278
|
-
throw new
|
|
1891
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_ADDRESS_ENDS_WITH_PDA_MARKER);
|
|
1279
1892
|
}
|
|
1280
1893
|
const addressBytesBuffer = await crypto.subtle.digest(
|
|
1281
1894
|
"SHA-256",
|
|
@@ -1287,7 +1900,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1287
1900
|
async function getAddressFromPublicKey(publicKey) {
|
|
1288
1901
|
await assertKeyExporterIsAvailable();
|
|
1289
1902
|
if (publicKey.type !== "public" || publicKey.algorithm.name !== "Ed25519") {
|
|
1290
|
-
throw new
|
|
1903
|
+
throw new SolanaError(SOLANA_ERROR__NOT_AN_ED25519_PUBLIC_KEY);
|
|
1291
1904
|
}
|
|
1292
1905
|
const publicKeyBytes = await crypto.subtle.exportKey("raw", publicKey);
|
|
1293
1906
|
return getAddressDecoder().decode(new Uint8Array(publicKeyBytes));
|
|
@@ -1297,7 +1910,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1297
1910
|
init_env_shim();
|
|
1298
1911
|
function assertValidNumberOfItemsForCodec(codecDescription, expected, actual) {
|
|
1299
1912
|
if (expected !== actual) {
|
|
1300
|
-
throw new
|
|
1913
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_WRONG_NUMBER_OF_ITEMS, {
|
|
1914
|
+
actual,
|
|
1915
|
+
codecDescription,
|
|
1916
|
+
expected
|
|
1917
|
+
});
|
|
1301
1918
|
}
|
|
1302
1919
|
}
|
|
1303
1920
|
function maxCodecSizes(sizes) {
|
|
@@ -1443,13 +2060,33 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1443
2060
|
function getBooleanEncoder(config = {}) {
|
|
1444
2061
|
var _a;
|
|
1445
2062
|
const size = (_a = config.size) != null ? _a : getU8Encoder();
|
|
1446
|
-
|
|
2063
|
+
try {
|
|
2064
|
+
assertIsFixedSize(size);
|
|
2065
|
+
} catch (e4) {
|
|
2066
|
+
if (isSolanaError(e4, SOLANA_ERROR__CODECS_EXPECTED_FIXED_LENGTH_GOT_VARIABLE_LENGTH)) {
|
|
2067
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_CODEC_REQUIRES_FIXED_SIZE, {
|
|
2068
|
+
codecDescription: "bool"
|
|
2069
|
+
});
|
|
2070
|
+
} else {
|
|
2071
|
+
throw e4;
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
1447
2074
|
return mapEncoder(size, (value) => value ? 1 : 0);
|
|
1448
2075
|
}
|
|
1449
2076
|
function getBooleanDecoder(config = {}) {
|
|
1450
2077
|
var _a;
|
|
1451
2078
|
const size = (_a = config.size) != null ? _a : getU8Decoder();
|
|
1452
|
-
|
|
2079
|
+
try {
|
|
2080
|
+
assertIsFixedSize(size);
|
|
2081
|
+
} catch (e4) {
|
|
2082
|
+
if (isSolanaError(e4, SOLANA_ERROR__CODECS_EXPECTED_FIXED_LENGTH_GOT_VARIABLE_LENGTH)) {
|
|
2083
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_CODEC_REQUIRES_FIXED_SIZE, {
|
|
2084
|
+
codecDescription: "bool"
|
|
2085
|
+
});
|
|
2086
|
+
} else {
|
|
2087
|
+
throw e4;
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
1453
2090
|
return mapDecoder(size, (value) => Number(value) === 1);
|
|
1454
2091
|
}
|
|
1455
2092
|
function getBooleanCodec(config = {}) {
|
|
@@ -1545,9 +2182,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1545
2182
|
offset = dOffset;
|
|
1546
2183
|
const variantField = (_a2 = variants[Number(discriminator)]) != null ? _a2 : null;
|
|
1547
2184
|
if (!variantField) {
|
|
1548
|
-
throw new
|
|
1549
|
-
|
|
1550
|
-
|
|
2185
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_ENUM_DISCRIMINATOR_OUT_OF_RANGE, {
|
|
2186
|
+
discriminator,
|
|
2187
|
+
maxRange: variants.length - 1,
|
|
2188
|
+
minRange: 0
|
|
2189
|
+
});
|
|
1551
2190
|
}
|
|
1552
2191
|
const [variant, vOffset] = variantField[1].read(bytes, offset);
|
|
1553
2192
|
offset = vOffset;
|
|
@@ -1556,7 +2195,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1556
2195
|
});
|
|
1557
2196
|
}
|
|
1558
2197
|
function getDataEnumCodec(variants, config = {}) {
|
|
1559
|
-
return combineCodec(
|
|
2198
|
+
return combineCodec(
|
|
2199
|
+
getDataEnumEncoder(variants, config),
|
|
2200
|
+
getDataEnumDecoder(variants, config)
|
|
2201
|
+
);
|
|
1560
2202
|
}
|
|
1561
2203
|
function getDataEnumFixedSize(variants, prefix) {
|
|
1562
2204
|
if (variants.length === 0)
|
|
@@ -1579,9 +2221,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1579
2221
|
function getVariantDiscriminator(variants, variant) {
|
|
1580
2222
|
const discriminator = variants.findIndex(([key]) => variant.__kind === key);
|
|
1581
2223
|
if (discriminator < 0) {
|
|
1582
|
-
throw new
|
|
1583
|
-
|
|
1584
|
-
|
|
2224
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_INVALID_DATA_ENUM_VARIANT, {
|
|
2225
|
+
value: variant.__kind,
|
|
2226
|
+
variants: variants.map(([key]) => key)
|
|
2227
|
+
});
|
|
1585
2228
|
}
|
|
1586
2229
|
return discriminator;
|
|
1587
2230
|
}
|
|
@@ -1647,8 +2290,24 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1647
2290
|
const fixed = (_b = config.fixed) != null ? _b : false;
|
|
1648
2291
|
const isZeroSizeItem = isFixedSize(item) && isFixedSize(prefix) && item.fixedSize === 0;
|
|
1649
2292
|
if (fixed || isZeroSizeItem) {
|
|
1650
|
-
|
|
1651
|
-
|
|
2293
|
+
try {
|
|
2294
|
+
assertIsFixedSize(item);
|
|
2295
|
+
} catch (e4) {
|
|
2296
|
+
if (isSolanaError(e4, SOLANA_ERROR__CODECS_EXPECTED_FIXED_LENGTH_GOT_VARIABLE_LENGTH)) {
|
|
2297
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_FIXED_NULLABLE_WITH_VARIABLE_SIZE_CODEC);
|
|
2298
|
+
} else {
|
|
2299
|
+
throw e4;
|
|
2300
|
+
}
|
|
2301
|
+
}
|
|
2302
|
+
try {
|
|
2303
|
+
assertIsFixedSize(prefix);
|
|
2304
|
+
} catch (e4) {
|
|
2305
|
+
if (isSolanaError(e4, SOLANA_ERROR__CODECS_EXPECTED_FIXED_LENGTH_GOT_VARIABLE_LENGTH)) {
|
|
2306
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_FIXED_NULLABLE_WITH_VARIABLE_SIZE_PREFIX);
|
|
2307
|
+
} else {
|
|
2308
|
+
throw e4;
|
|
2309
|
+
}
|
|
2310
|
+
}
|
|
1652
2311
|
const fixedSize = prefix.fixedSize + item.fixedSize;
|
|
1653
2312
|
return createEncoder({
|
|
1654
2313
|
fixedSize,
|
|
@@ -1680,8 +2339,24 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1680
2339
|
let fixedSize = null;
|
|
1681
2340
|
const isZeroSizeItem = isFixedSize(item) && isFixedSize(prefix) && item.fixedSize === 0;
|
|
1682
2341
|
if (fixed || isZeroSizeItem) {
|
|
1683
|
-
|
|
1684
|
-
|
|
2342
|
+
try {
|
|
2343
|
+
assertIsFixedSize(item);
|
|
2344
|
+
} catch (e4) {
|
|
2345
|
+
if (isSolanaError(e4, SOLANA_ERROR__CODECS_EXPECTED_FIXED_LENGTH_GOT_VARIABLE_LENGTH)) {
|
|
2346
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_FIXED_NULLABLE_WITH_VARIABLE_SIZE_CODEC);
|
|
2347
|
+
} else {
|
|
2348
|
+
throw e4;
|
|
2349
|
+
}
|
|
2350
|
+
}
|
|
2351
|
+
try {
|
|
2352
|
+
assertIsFixedSize(prefix);
|
|
2353
|
+
} catch (e4) {
|
|
2354
|
+
if (isSolanaError(e4, SOLANA_ERROR__CODECS_EXPECTED_FIXED_LENGTH_GOT_VARIABLE_LENGTH)) {
|
|
2355
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_FIXED_NULLABLE_WITH_VARIABLE_SIZE_PREFIX);
|
|
2356
|
+
} else {
|
|
2357
|
+
throw e4;
|
|
2358
|
+
}
|
|
2359
|
+
}
|
|
1685
2360
|
fixedSize = prefix.fixedSize + item.fixedSize;
|
|
1686
2361
|
}
|
|
1687
2362
|
return createDecoder({
|
|
@@ -1711,9 +2386,12 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1711
2386
|
const isInvalidNumber = typeof value === "number" && (value < minRange || value > maxRange);
|
|
1712
2387
|
const isInvalidString = typeof value === "string" && !allStringInputs.includes(value);
|
|
1713
2388
|
if (isInvalidNumber || isInvalidString) {
|
|
1714
|
-
throw new
|
|
1715
|
-
|
|
1716
|
-
|
|
2389
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_INVALID_SCALAR_ENUM_VARIANT, {
|
|
2390
|
+
maxRange,
|
|
2391
|
+
minRange,
|
|
2392
|
+
value,
|
|
2393
|
+
variants: allStringInputs
|
|
2394
|
+
});
|
|
1717
2395
|
}
|
|
1718
2396
|
if (typeof value === "number")
|
|
1719
2397
|
return value;
|
|
@@ -1730,9 +2408,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1730
2408
|
return mapDecoder(prefix, (value) => {
|
|
1731
2409
|
const valueAsNumber = Number(value);
|
|
1732
2410
|
if (valueAsNumber < minRange || valueAsNumber > maxRange) {
|
|
1733
|
-
throw new
|
|
1734
|
-
|
|
1735
|
-
|
|
2411
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_ENUM_DISCRIMINATOR_OUT_OF_RANGE, {
|
|
2412
|
+
discriminator: valueAsNumber,
|
|
2413
|
+
maxRange,
|
|
2414
|
+
minRange
|
|
2415
|
+
});
|
|
1736
2416
|
}
|
|
1737
2417
|
return constructor[enumKeys[valueAsNumber]];
|
|
1738
2418
|
});
|
|
@@ -1806,7 +2486,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1806
2486
|
});
|
|
1807
2487
|
}
|
|
1808
2488
|
function getStructCodec(fields) {
|
|
1809
|
-
return combineCodec(
|
|
2489
|
+
return combineCodec(
|
|
2490
|
+
getStructEncoder(fields),
|
|
2491
|
+
getStructDecoder(fields)
|
|
2492
|
+
);
|
|
1810
2493
|
}
|
|
1811
2494
|
function getUnitEncoder() {
|
|
1812
2495
|
return createEncoder({
|
|
@@ -1843,8 +2526,16 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1843
2526
|
const fixed = (_b = config.fixed) != null ? _b : false;
|
|
1844
2527
|
const isZeroSizeItem = isFixedSize(item) && isFixedSize(prefix) && item.fixedSize === 0;
|
|
1845
2528
|
if (fixed || isZeroSizeItem) {
|
|
1846
|
-
|
|
1847
|
-
|
|
2529
|
+
try {
|
|
2530
|
+
assertIsFixedSize(item);
|
|
2531
|
+
} catch (e4) {
|
|
2532
|
+
throw new Error("Fixed options can only be used with fixed-size codecs.");
|
|
2533
|
+
}
|
|
2534
|
+
try {
|
|
2535
|
+
assertIsFixedSize(prefix);
|
|
2536
|
+
} catch (e4) {
|
|
2537
|
+
throw new Error("Fixed options can only be used with fixed-size prefix.");
|
|
2538
|
+
}
|
|
1848
2539
|
const fixedSize = prefix.fixedSize + item.fixedSize;
|
|
1849
2540
|
return createEncoder({
|
|
1850
2541
|
fixedSize,
|
|
@@ -1881,8 +2572,16 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1881
2572
|
let fixedSize = null;
|
|
1882
2573
|
const isZeroSizeItem = isFixedSize(item) && isFixedSize(prefix) && item.fixedSize === 0;
|
|
1883
2574
|
if (fixed || isZeroSizeItem) {
|
|
1884
|
-
|
|
1885
|
-
|
|
2575
|
+
try {
|
|
2576
|
+
assertIsFixedSize(item);
|
|
2577
|
+
} catch (e4) {
|
|
2578
|
+
throw new Error("Fixed options can only be used with fixed-size codecs.");
|
|
2579
|
+
}
|
|
2580
|
+
try {
|
|
2581
|
+
assertIsFixedSize(prefix);
|
|
2582
|
+
} catch (e4) {
|
|
2583
|
+
throw new Error("Fixed options can only be used with fixed-size prefix.");
|
|
2584
|
+
}
|
|
1886
2585
|
fixedSize = prefix.fixedSize + item.fixedSize;
|
|
1887
2586
|
}
|
|
1888
2587
|
return createDecoder({
|
|
@@ -1937,6 +2636,29 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1937
2636
|
|
|
1938
2637
|
// ../instructions/dist/index.browser.js
|
|
1939
2638
|
init_env_shim();
|
|
2639
|
+
function isInstructionWithAccounts(instruction) {
|
|
2640
|
+
return instruction.accounts !== void 0;
|
|
2641
|
+
}
|
|
2642
|
+
function assertIsInstructionWithAccounts(instruction) {
|
|
2643
|
+
if (instruction.accounts === void 0) {
|
|
2644
|
+
throw new SolanaError(SOLANA_ERROR__EXPECTED_INSTRUCTION_TO_HAVE_ACCOUNTS, {
|
|
2645
|
+
data: instruction.data,
|
|
2646
|
+
programAddress: instruction.programAddress
|
|
2647
|
+
});
|
|
2648
|
+
}
|
|
2649
|
+
}
|
|
2650
|
+
function isInstructionWithData(instruction) {
|
|
2651
|
+
return instruction.data !== void 0;
|
|
2652
|
+
}
|
|
2653
|
+
function assertIsInstructionWithData(instruction) {
|
|
2654
|
+
var _a;
|
|
2655
|
+
if (instruction.data === void 0) {
|
|
2656
|
+
throw new SolanaError(SOLANA_ERROR__EXPECTED_INSTRUCTION_TO_HAVE_DATA, {
|
|
2657
|
+
accountAddresses: (_a = instruction.accounts) == null ? void 0 : _a.map((a) => a.address),
|
|
2658
|
+
programAddress: instruction.programAddress
|
|
2659
|
+
});
|
|
2660
|
+
}
|
|
2661
|
+
}
|
|
1940
2662
|
var AccountRole = /* @__PURE__ */ ((AccountRole22) => {
|
|
1941
2663
|
AccountRole22[AccountRole22["WRITABLE_SIGNER"] = /* 3 */
|
|
1942
2664
|
3] = "WRITABLE_SIGNER";
|
|
@@ -1974,52 +2696,6 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1974
2696
|
|
|
1975
2697
|
// ../keys/dist/index.browser.js
|
|
1976
2698
|
init_env_shim();
|
|
1977
|
-
|
|
1978
|
-
// ../errors/dist/index.browser.js
|
|
1979
|
-
init_env_shim();
|
|
1980
|
-
var SOLANA_ERROR__TRANSACTION_MISSING_SIGNATURES = 1;
|
|
1981
|
-
var SOLANA_ERROR__TRANSACTION_SIGNATURE_NOT_COMPUTABLE = 2;
|
|
1982
|
-
var SOLANA_ERROR__RPC_INTEGER_OVERFLOW = 3;
|
|
1983
|
-
var SOLANA_ERROR__INVALID_KEYPAIR_BYTES = 4;
|
|
1984
|
-
var SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED = 5;
|
|
1985
|
-
var SOLANA_ERROR__NONCE_INVALID = 6;
|
|
1986
|
-
var SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND = 7;
|
|
1987
|
-
var SolanaErrorMessages = {
|
|
1988
|
-
[SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED]: "The network has progressed past the last block for which this transaction could have been committed.",
|
|
1989
|
-
[SOLANA_ERROR__INVALID_KEYPAIR_BYTES]: "Key pair bytes must be of length 64, got $byteLength.",
|
|
1990
|
-
[SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND]: "No nonce account could be found at address `$nonceAccountAddress`",
|
|
1991
|
-
[SOLANA_ERROR__NONCE_INVALID]: "The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",
|
|
1992
|
-
[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`.",
|
|
1993
|
-
[SOLANA_ERROR__TRANSACTION_MISSING_SIGNATURES]: "Transaction is missing signatures for addresses: $addresses.",
|
|
1994
|
-
[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."
|
|
1995
|
-
};
|
|
1996
|
-
function getHumanReadableErrorMessage(code, context = {}) {
|
|
1997
|
-
const messageFormatString = SolanaErrorMessages[code];
|
|
1998
|
-
const message = messageFormatString.replace(
|
|
1999
|
-
new RegExp("(?<!\\\\)\\$(\\w+)", "g"),
|
|
2000
|
-
(substring, variableName) => variableName in context ? `${context[variableName]}` : substring
|
|
2001
|
-
);
|
|
2002
|
-
return message;
|
|
2003
|
-
}
|
|
2004
|
-
function getErrorMessage(code, context = {}) {
|
|
2005
|
-
{
|
|
2006
|
-
return getHumanReadableErrorMessage(code, context);
|
|
2007
|
-
}
|
|
2008
|
-
}
|
|
2009
|
-
var SolanaError = class extends Error {
|
|
2010
|
-
constructor(...[code, context]) {
|
|
2011
|
-
const message = getErrorMessage(code, context);
|
|
2012
|
-
super(message);
|
|
2013
|
-
__publicField(this, "context");
|
|
2014
|
-
this.context = {
|
|
2015
|
-
__code: code,
|
|
2016
|
-
...context
|
|
2017
|
-
};
|
|
2018
|
-
this.name = "SolanaError";
|
|
2019
|
-
}
|
|
2020
|
-
};
|
|
2021
|
-
|
|
2022
|
-
// ../keys/dist/index.browser.js
|
|
2023
2699
|
function addPkcs8Header(bytes) {
|
|
2024
2700
|
return new Uint8Array([
|
|
2025
2701
|
/**
|
|
@@ -2719,17 +3395,6 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2719
3395
|
// ../rpc-transport-http/dist/index.browser.js
|
|
2720
3396
|
init_env_shim();
|
|
2721
3397
|
var e2 = globalThis.fetch;
|
|
2722
|
-
var SolanaHttpError = class extends Error {
|
|
2723
|
-
constructor(details) {
|
|
2724
|
-
super(`HTTP error (${details.statusCode}): ${details.message}`);
|
|
2725
|
-
__publicField(this, "statusCode");
|
|
2726
|
-
Error.captureStackTrace(this, this.constructor);
|
|
2727
|
-
this.statusCode = details.statusCode;
|
|
2728
|
-
}
|
|
2729
|
-
get name() {
|
|
2730
|
-
return "SolanaHttpError";
|
|
2731
|
-
}
|
|
2732
|
-
};
|
|
2733
3398
|
var DISALLOWED_HEADERS = {
|
|
2734
3399
|
accept: true,
|
|
2735
3400
|
"content-length": true,
|
|
@@ -2750,9 +3415,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2750
3415
|
"keep-alive": true,
|
|
2751
3416
|
origin: true,
|
|
2752
3417
|
"permissions-policy": true,
|
|
2753
|
-
//
|
|
2754
|
-
// 'proxy-':true,
|
|
2755
|
-
// 'sec-':true,
|
|
3418
|
+
// Prefix matching is implemented in code, below.
|
|
3419
|
+
// 'proxy-': true,
|
|
3420
|
+
// 'sec-': true,
|
|
2756
3421
|
referer: true,
|
|
2757
3422
|
te: true,
|
|
2758
3423
|
trailer: true,
|
|
@@ -2766,9 +3431,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2766
3431
|
return DISALLOWED_HEADERS[headerName.toLowerCase()] === true || FORBIDDEN_HEADERS[headerName.toLowerCase()] === true || lowercaseHeaderName.startsWith("proxy-") || lowercaseHeaderName.startsWith("sec-");
|
|
2767
3432
|
});
|
|
2768
3433
|
if (badHeaders.length > 0) {
|
|
2769
|
-
throw new
|
|
2770
|
-
|
|
2771
|
-
);
|
|
3434
|
+
throw new SolanaError(SOLANA_ERROR__RPC_TRANSPORT_HEADER_FORBIDDEN, {
|
|
3435
|
+
headers: badHeaders
|
|
3436
|
+
});
|
|
2772
3437
|
}
|
|
2773
3438
|
}
|
|
2774
3439
|
function normalizeHeaders(headers) {
|
|
@@ -2778,10 +3443,25 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2778
3443
|
}
|
|
2779
3444
|
return out;
|
|
2780
3445
|
}
|
|
2781
|
-
|
|
3446
|
+
var didWarnDispatcherWasSuppliedInNonNodeEnvironment = false;
|
|
3447
|
+
function warnDispatcherWasSuppliedInNonNodeEnvironment() {
|
|
3448
|
+
if (didWarnDispatcherWasSuppliedInNonNodeEnvironment) {
|
|
3449
|
+
return;
|
|
3450
|
+
}
|
|
3451
|
+
didWarnDispatcherWasSuppliedInNonNodeEnvironment = true;
|
|
3452
|
+
console.warn(
|
|
3453
|
+
"You have supplied a `Dispatcher` to `createHttpTransport()`. It has been ignored because Undici dispatchers only work in Node environments. To eliminate this warning, omit the `dispatcher_NODE_ONLY` property from your config when running in a non-Node environment."
|
|
3454
|
+
);
|
|
3455
|
+
}
|
|
3456
|
+
function createHttpTransport(config) {
|
|
3457
|
+
if ("dispatcher_NODE_ONLY" in config) {
|
|
3458
|
+
warnDispatcherWasSuppliedInNonNodeEnvironment();
|
|
3459
|
+
}
|
|
3460
|
+
const { headers, url } = config;
|
|
2782
3461
|
if (headers) {
|
|
2783
3462
|
assertIsAllowedHttpRequestHeaders(headers);
|
|
2784
3463
|
}
|
|
3464
|
+
let dispatcherConfig;
|
|
2785
3465
|
const customHeaders = headers && normalizeHeaders(headers);
|
|
2786
3466
|
return async function makeHttpRequest({
|
|
2787
3467
|
payload,
|
|
@@ -2789,6 +3469,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2789
3469
|
}) {
|
|
2790
3470
|
const body = JSON.stringify(payload);
|
|
2791
3471
|
const requestInfo = {
|
|
3472
|
+
...dispatcherConfig,
|
|
2792
3473
|
body,
|
|
2793
3474
|
headers: {
|
|
2794
3475
|
...customHeaders,
|
|
@@ -2802,7 +3483,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2802
3483
|
};
|
|
2803
3484
|
const response = await e2(url, requestInfo);
|
|
2804
3485
|
if (!response.ok) {
|
|
2805
|
-
throw new
|
|
3486
|
+
throw new SolanaError(SOLANA_ERROR__RPC_TRANSPORT_HTTP_ERROR, {
|
|
2806
3487
|
message: response.statusText,
|
|
2807
3488
|
statusCode: response.status
|
|
2808
3489
|
});
|
|
@@ -2855,6 +3536,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2855
3536
|
const api = createSolanaRpcApi(DEFAULT_RPC_CONFIG);
|
|
2856
3537
|
return createRpc({ ...config, api });
|
|
2857
3538
|
}
|
|
3539
|
+
var EXPLICIT_ABORT_TOKEN = Symbol(
|
|
3540
|
+
"This symbol is thrown from the request that underlies a series of coalesced requests when the last request in that series aborts"
|
|
3541
|
+
);
|
|
2858
3542
|
function getRpcTransportWithRequestCoalescing(transport, getDeduplicationKey) {
|
|
2859
3543
|
let coalescedRequestsByDeduplicationKey;
|
|
2860
3544
|
return async function makeCoalescedHttpRequest(config) {
|
|
@@ -2878,7 +3562,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2878
3562
|
signal: abortController.signal
|
|
2879
3563
|
});
|
|
2880
3564
|
} catch (e4) {
|
|
2881
|
-
if (e4
|
|
3565
|
+
if (e4 === EXPLICIT_ABORT_TOKEN) {
|
|
2882
3566
|
return;
|
|
2883
3567
|
}
|
|
2884
3568
|
throw e4;
|
|
@@ -2900,10 +3584,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2900
3584
|
coalescedRequest.numConsumers -= 1;
|
|
2901
3585
|
if (coalescedRequest.numConsumers === 0) {
|
|
2902
3586
|
const abortController = coalescedRequest.abortController;
|
|
2903
|
-
abortController.abort();
|
|
3587
|
+
abortController.abort(EXPLICIT_ABORT_TOKEN);
|
|
2904
3588
|
}
|
|
2905
|
-
|
|
2906
|
-
reject(abortError);
|
|
3589
|
+
reject(e4.target.reason);
|
|
2907
3590
|
};
|
|
2908
3591
|
signal.addEventListener("abort", handleAbort);
|
|
2909
3592
|
responsePromise.then(resolve).finally(() => {
|
|
@@ -3275,7 +3958,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3275
3958
|
// ../rpc-subscriptions-transport-websocket/dist/index.browser.js
|
|
3276
3959
|
init_env_shim();
|
|
3277
3960
|
var e3 = globalThis.WebSocket;
|
|
3278
|
-
var
|
|
3961
|
+
var EXPLICIT_ABORT_TOKEN2 = Symbol(
|
|
3279
3962
|
"This symbol is thrown from a socket's iterator when the connection is explicitly aborted by the user"
|
|
3280
3963
|
);
|
|
3281
3964
|
async function createWebSocketConnection({
|
|
@@ -3297,7 +3980,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3297
3980
|
});
|
|
3298
3981
|
}
|
|
3299
3982
|
function handleAbort() {
|
|
3300
|
-
errorAndClearAllIteratorStates(
|
|
3983
|
+
errorAndClearAllIteratorStates(EXPLICIT_ABORT_TOKEN2);
|
|
3301
3984
|
if (webSocket.readyState !== e3.CLOSED && webSocket.readyState !== e3.CLOSING) {
|
|
3302
3985
|
webSocket.close(1e3);
|
|
3303
3986
|
}
|
|
@@ -3385,7 +4068,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3385
4068
|
});
|
|
3386
4069
|
});
|
|
3387
4070
|
} catch (e22) {
|
|
3388
|
-
if (e22 ===
|
|
4071
|
+
if (e22 === EXPLICIT_ABORT_TOKEN2) {
|
|
3389
4072
|
return;
|
|
3390
4073
|
} else {
|
|
3391
4074
|
throw new Error("WebSocket connection closed", { cause: e22 });
|
|
@@ -3558,7 +4241,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3558
4241
|
}
|
|
3559
4242
|
};
|
|
3560
4243
|
}
|
|
3561
|
-
var
|
|
4244
|
+
var EXPLICIT_ABORT_TOKEN3 = Symbol(
|
|
3562
4245
|
"This symbol is thrown from a subscription's iterator when the subscription is explicitly aborted by the user"
|
|
3563
4246
|
);
|
|
3564
4247
|
function registerIterableCleanup22(iterable, cleanupFn) {
|
|
@@ -3629,9 +4312,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3629
4312
|
return {
|
|
3630
4313
|
...iterable,
|
|
3631
4314
|
async *[Symbol.asyncIterator]() {
|
|
3632
|
-
abortPromise || (abortPromise = abortSignal.aborted ? Promise.reject(
|
|
4315
|
+
abortPromise || (abortPromise = abortSignal.aborted ? Promise.reject(EXPLICIT_ABORT_TOKEN3) : new Promise((_, reject) => {
|
|
3633
4316
|
abortSignal.addEventListener("abort", () => {
|
|
3634
|
-
reject(
|
|
4317
|
+
reject(EXPLICIT_ABORT_TOKEN3);
|
|
3635
4318
|
});
|
|
3636
4319
|
}));
|
|
3637
4320
|
try {
|
|
@@ -3645,7 +4328,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3645
4328
|
}
|
|
3646
4329
|
}
|
|
3647
4330
|
} catch (e4) {
|
|
3648
|
-
if (e4 ===
|
|
4331
|
+
if (e4 === EXPLICIT_ABORT_TOKEN3) {
|
|
3649
4332
|
return;
|
|
3650
4333
|
}
|
|
3651
4334
|
cache.delete(deduplicationKey);
|
|
@@ -3791,22 +4474,20 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3791
4474
|
function assertIsBlockhash(putativeBlockhash) {
|
|
3792
4475
|
if (!base58Encoder2)
|
|
3793
4476
|
base58Encoder2 = getBase58Encoder();
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
}
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
throw new Error(`\`${putativeBlockhash}\` is not a blockhash`, {
|
|
3809
|
-
cause: e4
|
|
4477
|
+
if (
|
|
4478
|
+
// Lowest value (32 bytes of zeroes)
|
|
4479
|
+
putativeBlockhash.length < 32 || // Highest value (32 bytes of 255)
|
|
4480
|
+
putativeBlockhash.length > 44
|
|
4481
|
+
) {
|
|
4482
|
+
throw new SolanaError(SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE, {
|
|
4483
|
+
actualLength: putativeBlockhash.length
|
|
4484
|
+
});
|
|
4485
|
+
}
|
|
4486
|
+
const bytes = base58Encoder2.encode(putativeBlockhash);
|
|
4487
|
+
const numBytes = bytes.byteLength;
|
|
4488
|
+
if (numBytes !== 32) {
|
|
4489
|
+
throw new SolanaError(SOLANA_ERROR__BLOCKHASH_BYTE_LENGTH_OUT_OF_RANGE, {
|
|
4490
|
+
actualLength: numBytes
|
|
3810
4491
|
});
|
|
3811
4492
|
}
|
|
3812
4493
|
}
|
|
@@ -3844,11 +4525,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3844
4525
|
return putativeLamports >= 0 && putativeLamports <= maxU64Value;
|
|
3845
4526
|
}
|
|
3846
4527
|
function assertIsLamports(putativeLamports) {
|
|
3847
|
-
if (putativeLamports < 0) {
|
|
3848
|
-
throw new
|
|
3849
|
-
}
|
|
3850
|
-
if (putativeLamports > maxU64Value) {
|
|
3851
|
-
throw new Error("Input number is too large to be represented as a 64-bit unsigned integer");
|
|
4528
|
+
if (putativeLamports < 0 || putativeLamports > maxU64Value) {
|
|
4529
|
+
throw new SolanaError(SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE);
|
|
3852
4530
|
}
|
|
3853
4531
|
}
|
|
3854
4532
|
function lamports(putativeLamports) {
|
|
@@ -3885,9 +4563,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3885
4563
|
function assertIsStringifiedBigInt(putativeBigInt) {
|
|
3886
4564
|
try {
|
|
3887
4565
|
BigInt(putativeBigInt);
|
|
3888
|
-
} catch
|
|
3889
|
-
throw new
|
|
3890
|
-
|
|
4566
|
+
} catch {
|
|
4567
|
+
throw new SolanaError(SOLANA_ERROR__MALFORMED_BIGINT_STRING, {
|
|
4568
|
+
value: putativeBigInt
|
|
3891
4569
|
});
|
|
3892
4570
|
}
|
|
3893
4571
|
}
|
|
@@ -3900,7 +4578,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3900
4578
|
}
|
|
3901
4579
|
function assertIsStringifiedNumber(putativeNumber) {
|
|
3902
4580
|
if (Number.isNaN(Number(putativeNumber))) {
|
|
3903
|
-
throw new
|
|
4581
|
+
throw new SolanaError(SOLANA_ERROR__MALFORMED_NUMBER_STRING, {
|
|
4582
|
+
value: putativeNumber
|
|
4583
|
+
});
|
|
3904
4584
|
}
|
|
3905
4585
|
}
|
|
3906
4586
|
function stringifiedNumber(putativeNumber) {
|
|
@@ -3914,13 +4594,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3914
4594
|
return true;
|
|
3915
4595
|
}
|
|
3916
4596
|
function assertIsUnixTimestamp(putativeTimestamp) {
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
}
|
|
3921
|
-
} catch (e4) {
|
|
3922
|
-
throw new Error(`\`${putativeTimestamp}\` is not a timestamp`, {
|
|
3923
|
-
cause: e4
|
|
4597
|
+
if (putativeTimestamp > 864e13 || putativeTimestamp < -864e13) {
|
|
4598
|
+
throw new SolanaError(SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE, {
|
|
4599
|
+
value: putativeTimestamp
|
|
3924
4600
|
});
|
|
3925
4601
|
}
|
|
3926
4602
|
}
|
|
@@ -3938,22 +4614,20 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3938
4614
|
function assertIsBlockhash2(putativeBlockhash) {
|
|
3939
4615
|
if (!base58Encoder3)
|
|
3940
4616
|
base58Encoder3 = getBase58Encoder();
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
}
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
throw new Error(`\`${putativeBlockhash}\` is not a blockhash`, {
|
|
3956
|
-
cause: e4
|
|
4617
|
+
if (
|
|
4618
|
+
// Lowest value (32 bytes of zeroes)
|
|
4619
|
+
putativeBlockhash.length < 32 || // Highest value (32 bytes of 255)
|
|
4620
|
+
putativeBlockhash.length > 44
|
|
4621
|
+
) {
|
|
4622
|
+
throw new SolanaError(SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE, {
|
|
4623
|
+
actualLength: putativeBlockhash.length
|
|
4624
|
+
});
|
|
4625
|
+
}
|
|
4626
|
+
const bytes = base58Encoder3.encode(putativeBlockhash);
|
|
4627
|
+
const numBytes = bytes.byteLength;
|
|
4628
|
+
if (numBytes !== 32) {
|
|
4629
|
+
throw new SolanaError(SOLANA_ERROR__BLOCKHASH_BYTE_LENGTH_OUT_OF_RANGE, {
|
|
4630
|
+
actualLength: numBytes
|
|
3957
4631
|
});
|
|
3958
4632
|
}
|
|
3959
4633
|
}
|
|
@@ -3982,7 +4656,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3982
4656
|
}
|
|
3983
4657
|
function assertIsTransactionWithBlockhashLifetime(transaction) {
|
|
3984
4658
|
if (!isTransactionWithBlockhashLifetime(transaction)) {
|
|
3985
|
-
throw new
|
|
4659
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_EXPECTED_BLOCKHASH_LIFETIME);
|
|
3986
4660
|
}
|
|
3987
4661
|
}
|
|
3988
4662
|
function setTransactionLifetimeUsingBlockhash(blockhashLifetimeConstraint, transaction) {
|
|
@@ -4031,7 +4705,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4031
4705
|
var SYSTEM_PROGRAM_ADDRESS = "11111111111111111111111111111111";
|
|
4032
4706
|
function assertIsDurableNonceTransaction(transaction) {
|
|
4033
4707
|
if (!isDurableNonceTransaction(transaction)) {
|
|
4034
|
-
throw new
|
|
4708
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_EXPECTED_NONCE_LIFETIME);
|
|
4035
4709
|
}
|
|
4036
4710
|
}
|
|
4037
4711
|
function createAdvanceNonceAccountInstruction(nonceAccountAddress, nonceAuthorityAddress) {
|
|
@@ -4175,8 +4849,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4175
4849
|
const compiledAddressTableLookupAddresses = compiledAddressTableLookups.map((l) => l.lookupTableAddress);
|
|
4176
4850
|
const missing = compiledAddressTableLookupAddresses.filter((a) => addressesByLookupTableAddress[a] === void 0);
|
|
4177
4851
|
if (missing.length > 0) {
|
|
4178
|
-
|
|
4179
|
-
|
|
4852
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING, {
|
|
4853
|
+
lookupTableAddresses: missing
|
|
4854
|
+
});
|
|
4180
4855
|
}
|
|
4181
4856
|
const readOnlyMetas = [];
|
|
4182
4857
|
const writableMetas = [];
|
|
@@ -4184,8 +4859,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4184
4859
|
const addresses = addressesByLookupTableAddress[lookup.lookupTableAddress];
|
|
4185
4860
|
const highestIndex = Math.max(...lookup.readableIndices, ...lookup.writableIndices);
|
|
4186
4861
|
if (highestIndex >= addresses.length) {
|
|
4187
|
-
throw new
|
|
4188
|
-
|
|
4862
|
+
throw new SolanaError(
|
|
4863
|
+
SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE,
|
|
4864
|
+
{
|
|
4865
|
+
highestKnownIndex: addresses.length - 1,
|
|
4866
|
+
highestRequestedIndex: highestIndex,
|
|
4867
|
+
lookupTableAddress: lookup.lookupTableAddress
|
|
4868
|
+
}
|
|
4189
4869
|
);
|
|
4190
4870
|
}
|
|
4191
4871
|
const readOnlyForLookup = lookup.readableIndices.map((r) => ({
|
|
@@ -4209,7 +4889,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4209
4889
|
var _a, _b;
|
|
4210
4890
|
const programAddress = (_a = accountMetas[instruction.programAddressIndex]) == null ? void 0 : _a.address;
|
|
4211
4891
|
if (!programAddress) {
|
|
4212
|
-
throw new
|
|
4892
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND, {
|
|
4893
|
+
index: instruction.programAddressIndex
|
|
4894
|
+
});
|
|
4213
4895
|
}
|
|
4214
4896
|
const accounts = (_b = instruction.accountIndices) == null ? void 0 : _b.map((accountIndex) => accountMetas[accountIndex]);
|
|
4215
4897
|
const { data } = instruction;
|
|
@@ -4255,8 +4937,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4255
4937
|
var _a;
|
|
4256
4938
|
const { compiledMessage } = compiledTransaction;
|
|
4257
4939
|
const feePayer = compiledMessage.staticAccounts[0];
|
|
4258
|
-
if (!feePayer)
|
|
4259
|
-
throw new
|
|
4940
|
+
if (!feePayer) {
|
|
4941
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_FEE_PAYER_MISSING);
|
|
4942
|
+
}
|
|
4260
4943
|
const accountMetas = getAccountMetas(compiledMessage);
|
|
4261
4944
|
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 : {}) : [];
|
|
4262
4945
|
const transactionMetas = [...accountMetas, ...accountLookupMetas];
|
|
@@ -4297,13 +4980,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4297
4980
|
if (isWritableRole2(entry.role)) {
|
|
4298
4981
|
switch (entry[TYPE]) {
|
|
4299
4982
|
case 0:
|
|
4300
|
-
throw new
|
|
4301
|
-
|
|
4302
|
-
);
|
|
4983
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_INVOKED_PROGRAMS_CANNOT_PAY_FEES, {
|
|
4984
|
+
programAddress: instruction.programAddress
|
|
4985
|
+
});
|
|
4303
4986
|
default:
|
|
4304
|
-
throw new
|
|
4305
|
-
|
|
4306
|
-
);
|
|
4987
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE, {
|
|
4988
|
+
programAddress: instruction.programAddress
|
|
4989
|
+
});
|
|
4307
4990
|
}
|
|
4308
4991
|
}
|
|
4309
4992
|
if (entry[TYPE] === 2) {
|
|
@@ -4368,8 +5051,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4368
5051
|
addressesOfInvokedPrograms.has(account.address)
|
|
4369
5052
|
) {
|
|
4370
5053
|
if (isWritableRole2(accountMeta.role)) {
|
|
4371
|
-
throw new
|
|
4372
|
-
|
|
5054
|
+
throw new SolanaError(
|
|
5055
|
+
SOLANA_ERROR__TRANSACTION_INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE,
|
|
5056
|
+
{
|
|
5057
|
+
programAddress: account.address
|
|
5058
|
+
}
|
|
4373
5059
|
);
|
|
4374
5060
|
}
|
|
4375
5061
|
if (entry.role !== nextRole) {
|
|
@@ -4653,7 +5339,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4653
5339
|
return offset;
|
|
4654
5340
|
}
|
|
4655
5341
|
if (value < 0 || value > 127) {
|
|
4656
|
-
throw new
|
|
5342
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_VERSION_NUMBER_OUT_OF_RANGE, {
|
|
5343
|
+
actualVersion: value
|
|
5344
|
+
});
|
|
4657
5345
|
}
|
|
4658
5346
|
bytes.set([value | VERSION_FLAG_MASK], offset);
|
|
4659
5347
|
return offset + 1;
|
|
@@ -4739,12 +5427,15 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4739
5427
|
});
|
|
4740
5428
|
}
|
|
4741
5429
|
function getCompiledMessageDecoder() {
|
|
4742
|
-
return mapDecoder(
|
|
4743
|
-
|
|
4744
|
-
|
|
5430
|
+
return mapDecoder(
|
|
5431
|
+
getStructDecoder(getPreludeStructDecoderTuple()),
|
|
5432
|
+
({ addressTableLookups, ...restOfMessage }) => {
|
|
5433
|
+
if (restOfMessage.version === "legacy" || !(addressTableLookups == null ? void 0 : addressTableLookups.length)) {
|
|
5434
|
+
return restOfMessage;
|
|
5435
|
+
}
|
|
5436
|
+
return { ...restOfMessage, addressTableLookups };
|
|
4745
5437
|
}
|
|
4746
|
-
|
|
4747
|
-
});
|
|
5438
|
+
);
|
|
4748
5439
|
}
|
|
4749
5440
|
function getCompiledMessageCodec() {
|
|
4750
5441
|
return combineCodec(getCompiledMessageEncoder(), getCompiledMessageDecoder());
|
|
@@ -4861,9 +5552,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4861
5552
|
if (!deduplicated[signer.address]) {
|
|
4862
5553
|
deduplicated[signer.address] = signer;
|
|
4863
5554
|
} else if (deduplicated[signer.address] !== signer) {
|
|
4864
|
-
throw new
|
|
4865
|
-
|
|
4866
|
-
);
|
|
5555
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER_ADDRESS_CANNOT_HAVE_MULTIPLE_SIGNERS, {
|
|
5556
|
+
address: signer.address
|
|
5557
|
+
});
|
|
4867
5558
|
}
|
|
4868
5559
|
});
|
|
4869
5560
|
return Object.values(deduplicated);
|
|
@@ -4926,7 +5617,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4926
5617
|
}
|
|
4927
5618
|
function assertIsMessagePartialSigner(value) {
|
|
4928
5619
|
if (!isMessagePartialSigner(value)) {
|
|
4929
|
-
throw new
|
|
5620
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER_EXPECTED_MESSAGE_PARTIAL_SIGNER, {
|
|
5621
|
+
address: value.address
|
|
5622
|
+
});
|
|
4930
5623
|
}
|
|
4931
5624
|
}
|
|
4932
5625
|
function isTransactionPartialSigner(value) {
|
|
@@ -4934,7 +5627,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4934
5627
|
}
|
|
4935
5628
|
function assertIsTransactionPartialSigner(value) {
|
|
4936
5629
|
if (!isTransactionPartialSigner(value)) {
|
|
4937
|
-
throw new
|
|
5630
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER_EXPECTED_TRANSACTION_PARTIAL_SIGNER, {
|
|
5631
|
+
address: value.address
|
|
5632
|
+
});
|
|
4938
5633
|
}
|
|
4939
5634
|
}
|
|
4940
5635
|
function isKeyPairSigner(value) {
|
|
@@ -4942,7 +5637,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4942
5637
|
}
|
|
4943
5638
|
function assertIsKeyPairSigner(value) {
|
|
4944
5639
|
if (!isKeyPairSigner(value)) {
|
|
4945
|
-
throw new
|
|
5640
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER_EXPECTED_KEY_PAIR_SIGNER, {
|
|
5641
|
+
address: value.address
|
|
5642
|
+
});
|
|
4946
5643
|
}
|
|
4947
5644
|
}
|
|
4948
5645
|
async function createSignerFromKeyPair(keyPair) {
|
|
@@ -4975,7 +5672,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4975
5672
|
}
|
|
4976
5673
|
function assertIsMessageModifyingSigner(value) {
|
|
4977
5674
|
if (!isMessageModifyingSigner(value)) {
|
|
4978
|
-
throw new
|
|
5675
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER_EXPECTED_MESSAGE_MODIFYING_SIGNER, {
|
|
5676
|
+
address: value.address
|
|
5677
|
+
});
|
|
4979
5678
|
}
|
|
4980
5679
|
}
|
|
4981
5680
|
function isMessageSigner(value) {
|
|
@@ -4983,7 +5682,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4983
5682
|
}
|
|
4984
5683
|
function assertIsMessageSigner(value) {
|
|
4985
5684
|
if (!isMessageSigner(value)) {
|
|
4986
|
-
throw new
|
|
5685
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER_EXPECTED_MESSAGE_SIGNER, {
|
|
5686
|
+
address: value.address
|
|
5687
|
+
});
|
|
4987
5688
|
}
|
|
4988
5689
|
}
|
|
4989
5690
|
function createNoopSigner(address2) {
|
|
@@ -4999,7 +5700,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4999
5700
|
}
|
|
5000
5701
|
function assertIsTransactionModifyingSigner(value) {
|
|
5001
5702
|
if (!isTransactionModifyingSigner(value)) {
|
|
5002
|
-
throw new
|
|
5703
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER_EXPECTED_TRANSACTION_MODIFYING_SIGNER, {
|
|
5704
|
+
address: value.address
|
|
5705
|
+
});
|
|
5003
5706
|
}
|
|
5004
5707
|
}
|
|
5005
5708
|
function isTransactionSendingSigner(value) {
|
|
@@ -5007,7 +5710,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5007
5710
|
}
|
|
5008
5711
|
function assertIsTransactionSendingSigner(value) {
|
|
5009
5712
|
if (!isTransactionSendingSigner(value)) {
|
|
5010
|
-
throw new
|
|
5713
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER_EXPECTED_TRANSACTION_SENDING_SIGNER, {
|
|
5714
|
+
address: value.address
|
|
5715
|
+
});
|
|
5011
5716
|
}
|
|
5012
5717
|
}
|
|
5013
5718
|
function isTransactionSigner(value) {
|
|
@@ -5015,7 +5720,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5015
5720
|
}
|
|
5016
5721
|
function assertIsTransactionSigner(value) {
|
|
5017
5722
|
if (!isTransactionSigner(value)) {
|
|
5018
|
-
throw new
|
|
5723
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER_EXPECTED_TRANSACTION_SIGNER, {
|
|
5724
|
+
address: value.address
|
|
5725
|
+
});
|
|
5019
5726
|
}
|
|
5020
5727
|
}
|
|
5021
5728
|
async function partiallySignTransactionWithSigners(transaction, config = {}) {
|
|
@@ -5043,9 +5750,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5043
5750
|
abortSignal
|
|
5044
5751
|
);
|
|
5045
5752
|
if (!sendingSigner) {
|
|
5046
|
-
throw new
|
|
5047
|
-
"No `TransactionSendingSigner` was identified. Please provide a valid `ITransactionWithSingleSendingSigner` transaction."
|
|
5048
|
-
);
|
|
5753
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER_TRANSACTION_SENDING_SIGNER_MISSING);
|
|
5049
5754
|
}
|
|
5050
5755
|
abortSignal == null ? void 0 : abortSignal.throwIfAborted();
|
|
5051
5756
|
const [signature2] = await sendingSigner.signAndSendTransactions([signedTransaction], { abortSignal });
|
|
@@ -5130,17 +5835,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5130
5835
|
const signers = getSignersFromTransaction(transaction);
|
|
5131
5836
|
const sendingSigners = signers.filter(isTransactionSendingSigner);
|
|
5132
5837
|
if (sendingSigners.length === 0) {
|
|
5133
|
-
|
|
5134
|
-
error.name = "MissingTransactionSendingSignerError";
|
|
5135
|
-
throw error;
|
|
5838
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER_TRANSACTION_SENDING_SIGNER_MISSING);
|
|
5136
5839
|
}
|
|
5137
5840
|
const sendingOnlySigners = sendingSigners.filter(
|
|
5138
5841
|
(signer) => !isTransactionPartialSigner(signer) && !isTransactionModifyingSigner(signer)
|
|
5139
5842
|
);
|
|
5140
5843
|
if (sendingOnlySigners.length > 1) {
|
|
5141
|
-
|
|
5142
|
-
error.name = "MultipleTransactionSendingSignersError";
|
|
5143
|
-
throw error;
|
|
5844
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER_TRANSACTION_CANNOT_HAVE_MULTIPLE_SENDING_SIGNERS);
|
|
5144
5845
|
}
|
|
5145
5846
|
}
|
|
5146
5847
|
|
|
@@ -5285,9 +5986,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5285
5986
|
const signatureDidCommitPromise = (async () => {
|
|
5286
5987
|
for await (const signatureStatusNotification of signatureStatusNotifications) {
|
|
5287
5988
|
if (signatureStatusNotification.value.err) {
|
|
5288
|
-
throw
|
|
5289
|
-
cause: signatureStatusNotification.value.err
|
|
5290
|
-
});
|
|
5989
|
+
throw getSolanaErrorFromTransactionError(signatureStatusNotification.value.err);
|
|
5291
5990
|
} else {
|
|
5292
5991
|
return;
|
|
5293
5992
|
}
|
|
@@ -5653,6 +6352,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5653
6352
|
exports.assertIsBlockhash = assertIsBlockhash;
|
|
5654
6353
|
exports.assertIsDurableNonceTransaction = assertIsDurableNonceTransaction;
|
|
5655
6354
|
exports.assertIsFixedSize = assertIsFixedSize;
|
|
6355
|
+
exports.assertIsInstructionWithAccounts = assertIsInstructionWithAccounts;
|
|
6356
|
+
exports.assertIsInstructionWithData = assertIsInstructionWithData;
|
|
5656
6357
|
exports.assertIsKeyPairSigner = assertIsKeyPairSigner;
|
|
5657
6358
|
exports.assertIsLamports = assertIsLamports;
|
|
5658
6359
|
exports.assertIsMessageModifyingSigner = assertIsMessageModifyingSigner;
|
|
@@ -5840,6 +6541,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5840
6541
|
exports.isAddress = isAddress;
|
|
5841
6542
|
exports.isAdvanceNonceAccountInstruction = isAdvanceNonceAccountInstruction;
|
|
5842
6543
|
exports.isFixedSize = isFixedSize;
|
|
6544
|
+
exports.isInstructionWithAccounts = isInstructionWithAccounts;
|
|
6545
|
+
exports.isInstructionWithData = isInstructionWithData;
|
|
5843
6546
|
exports.isKeyPairSigner = isKeyPairSigner;
|
|
5844
6547
|
exports.isLamports = isLamports;
|
|
5845
6548
|
exports.isMessageModifyingSigner = isMessageModifyingSigner;
|