@solana/web3.js 2.0.0-experimental.e3e579c → 2.0.0-experimental.e587f8d
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 +995 -344
- package/dist/index.development.js.map +1 -1
- package/dist/index.production.min.js +283 -278
- package/package.json +16 -16
|
@@ -125,6 +125,601 @@ 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__BLOCK_HEIGHT_EXCEEDED = 1;
|
|
131
|
+
var SOLANA_ERROR__INVALID_NONCE = 2;
|
|
132
|
+
var SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND = 3;
|
|
133
|
+
var SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE = 4;
|
|
134
|
+
var SOLANA_ERROR__INVALID_BLOCKHASH_BYTE_LENGTH = 5;
|
|
135
|
+
var SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE = 6;
|
|
136
|
+
var SOLANA_ERROR__MALFORMED_BIGINT_STRING = 7;
|
|
137
|
+
var SOLANA_ERROR__MALFORMED_NUMBER_STRING = 8;
|
|
138
|
+
var SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE = 9;
|
|
139
|
+
var SOLANA_ERROR__ADDRESSES__INVALID_BYTE_LENGTH = 28e5;
|
|
140
|
+
var SOLANA_ERROR__ADDRESSES__STRING_LENGTH_OUT_OF_RANGE = 2800001;
|
|
141
|
+
var SOLANA_ERROR__ADDRESSES__INVALID_BASE58_ENCODED_ADDRESS = 2800002;
|
|
142
|
+
var SOLANA_ERROR__ADDRESSES__INVALID_ED25519_PUBLIC_KEY = 2800003;
|
|
143
|
+
var SOLANA_ERROR__ADDRESSES__MALFORMED_PDA = 2800004;
|
|
144
|
+
var SOLANA_ERROR__ADDRESSES__PDA_BUMP_SEED_OUT_OF_RANGE = 2800005;
|
|
145
|
+
var SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED = 2800006;
|
|
146
|
+
var SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED = 2800007;
|
|
147
|
+
var SOLANA_ERROR__ADDRESSES__INVALID_SEEDS_POINT_ON_CURVE = 2800008;
|
|
148
|
+
var SOLANA_ERROR__ADDRESSES__FAILED_TO_FIND_VIABLE_PDA_BUMP_SEED = 2800009;
|
|
149
|
+
var SOLANA_ERROR__ADDRESSES__PDA_ENDS_WITH_PDA_MARKER = 2800010;
|
|
150
|
+
var SOLANA_ERROR__ACCOUNTS__ACCOUNT_NOT_FOUND = 323e4;
|
|
151
|
+
var SOLANA_ERROR__ACCOUNTS__ONE_OR_MORE_ACCOUNTS_NOT_FOUND = 32300001;
|
|
152
|
+
var SOLANA_ERROR__ACCOUNTS__FAILED_TO_DECODE_ACCOUNT = 3230002;
|
|
153
|
+
var SOLANA_ERROR__ACCOUNTS__EXPECTED_DECODED_ACCOUNT = 3230003;
|
|
154
|
+
var SOLANA_ERROR__ACCOUNTS__EXPECTED_ALL_ACCOUNTS_TO_BE_DECODED = 3230004;
|
|
155
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO__DISALLOWED_IN_INSECURE_CONTEXT = 361e4;
|
|
156
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO__DIGEST_UNIMPLEMENTED = 3610001;
|
|
157
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO__ED25519_ALGORITHM_UNIMPLEMENTED = 3610002;
|
|
158
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO__EXPORT_FUNCTION_UNIMPLEMENTED = 3610003;
|
|
159
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO__GENERATE_FUNCTION_UNIMPLEMENTED = 3610004;
|
|
160
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO__SIGN_FUNCTION_UNIMPLEMENTED = 3610005;
|
|
161
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO__VERIFY_FUNCTION_UNIMPLEMENTED = 3610006;
|
|
162
|
+
var SOLANA_ERROR__KEYS__INVALID_KEY_PAIR_BYTE_LENGTH = 3704e3;
|
|
163
|
+
var SOLANA_ERROR__KEYS__INVALID_PRIVATE_KEY_BYTE_LENGTH = 3704001;
|
|
164
|
+
var SOLANA_ERROR__KEYS__INVALID_SIGNATURE_BYTE_LENGTH = 3704002;
|
|
165
|
+
var SOLANA_ERROR__KEYS__SIGNATURE_STRING_LENGTH_OUT_OF_RANGE = 3704003;
|
|
166
|
+
var SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_ACCOUNTS = 4128e3;
|
|
167
|
+
var SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_DATA = 4128001;
|
|
168
|
+
var SOLANA_ERROR__INSTRUCTION__PROGRAM_ID_MISMATCH = 4128002;
|
|
169
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN = 4615e3;
|
|
170
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__GENERIC_ERROR = 4615001;
|
|
171
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ARGUMENT = 4615002;
|
|
172
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_INSTRUCTION_DATA = 4615003;
|
|
173
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_DATA = 4615004;
|
|
174
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_TOO_SMALL = 4615005;
|
|
175
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__INSUFFICIENT_FUNDS = 4615006;
|
|
176
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_PROGRAM_ID = 4615007;
|
|
177
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_REQUIRED_SIGNATURE = 4615008;
|
|
178
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_ALREADY_INITIALIZED = 4615009;
|
|
179
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__UNINITIALIZED_ACCOUNT = 4615010;
|
|
180
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__UNBALANCED_INSTRUCTION = 4615011;
|
|
181
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__MODIFIED_PROGRAM_ID = 4615012;
|
|
182
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_LAMPORT_SPEND = 4615013;
|
|
183
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_DATA_MODIFIED = 4615014;
|
|
184
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_LAMPORT_CHANGE = 4615015;
|
|
185
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_DATA_MODIFIED = 4615016;
|
|
186
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_INDEX = 4615017;
|
|
187
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_MODIFIED = 4615018;
|
|
188
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__RENT_EPOCH_MODIFIED = 4615019;
|
|
189
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__NOT_ENOUGH_ACCOUNT_KEYS = 4615020;
|
|
190
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_SIZE_CHANGED = 4615021;
|
|
191
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_EXECUTABLE = 4615022;
|
|
192
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_FAILED = 4615023;
|
|
193
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_OUTSTANDING = 4615024;
|
|
194
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_OUT_OF_SYNC = 4615025;
|
|
195
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM = 4615026;
|
|
196
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ERROR = 4615027;
|
|
197
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_DATA_MODIFIED = 4615028;
|
|
198
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_LAMPORT_CHANGE = 4615029;
|
|
199
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_ACCOUNT_NOT_RENT_EXEMPT = 4615030;
|
|
200
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_PROGRAM_ID = 4615031;
|
|
201
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__CALL_DEPTH = 4615032;
|
|
202
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_ACCOUNT = 4615033;
|
|
203
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__REENTRANCY_NOT_ALLOWED = 4615034;
|
|
204
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__MAX_SEED_LENGTH_EXCEEDED = 4615035;
|
|
205
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_SEEDS = 4615036;
|
|
206
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_REALLOC = 4615037;
|
|
207
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__COMPUTATIONAL_BUDGET_EXCEEDED = 4615038;
|
|
208
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__PRIVILEGE_ESCALATION = 4615039;
|
|
209
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_ENVIRONMENT_SETUP_FAILURE = 4615040;
|
|
210
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPLETE = 4615041;
|
|
211
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPILE = 4615042;
|
|
212
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__IMMUTABLE = 4615043;
|
|
213
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_AUTHORITY = 4615044;
|
|
214
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__BORSH_IO_ERROR = 4615045;
|
|
215
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_RENT_EXEMPT = 4615046;
|
|
216
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_OWNER = 4615047;
|
|
217
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__ARITHMETIC_OVERFLOW = 4615048;
|
|
218
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_SYSVAR = 4615049;
|
|
219
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__ILLEGAL_OWNER = 4615050;
|
|
220
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED = 4615051;
|
|
221
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_EXCEEDED = 4615052;
|
|
222
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED = 4615053;
|
|
223
|
+
var SOLANA_ERROR__INSTRUCTION_ERROR__BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS = 4615054;
|
|
224
|
+
var SOLANA_ERROR__SIGNER__ADDRESS_CANNOT_HAVE_MULTIPLE_SIGNERS = 5508e3;
|
|
225
|
+
var SOLANA_ERROR__SIGNER__EXPECTED_KEY_PAIR_SIGNER = 5508001;
|
|
226
|
+
var SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_SIGNER = 5508002;
|
|
227
|
+
var SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_MODIFYING_SIGNER = 5508003;
|
|
228
|
+
var SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_PARTIAL_SIGNER = 5508004;
|
|
229
|
+
var SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SIGNER = 5508005;
|
|
230
|
+
var SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_MODIFYING_SIGNER = 5508006;
|
|
231
|
+
var SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_PARTIAL_SIGNER = 5508007;
|
|
232
|
+
var SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SENDING_SIGNER = 5508008;
|
|
233
|
+
var SOLANA_ERROR__SIGNER__TRANSACTION_CANNOT_HAVE_MULTIPLE_SENDING_SIGNERS = 5508009;
|
|
234
|
+
var SOLANA_ERROR__SIGNER__TRANSACTION_SENDING_SIGNER_MISSING = 5508010;
|
|
235
|
+
var SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES = 5663e3;
|
|
236
|
+
var SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE = 5663001;
|
|
237
|
+
var SOLANA_ERROR__TRANSACTION__EXPECTED_BLOCKHASH_LIFETIME = 5663002;
|
|
238
|
+
var SOLANA_ERROR__TRANSACTION__EXPECTED_NONCE_LIFETIME = 5663003;
|
|
239
|
+
var SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_OUT_OF_RANGE = 5663004;
|
|
240
|
+
var SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING = 5663005;
|
|
241
|
+
var SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE = 5663006;
|
|
242
|
+
var SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND = 5663007;
|
|
243
|
+
var SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_FEE_PAYER_MISSING = 5663008;
|
|
244
|
+
var SOLANA_ERROR__TRANSACTION__SIGNATURES_MISSING = 5663009;
|
|
245
|
+
var SOLANA_ERROR__TRANSACTION__ADDRESS_MISSING = 5663010;
|
|
246
|
+
var SOLANA_ERROR__TRANSACTION__FEE_PAYER_MISSING = 5663011;
|
|
247
|
+
var SOLANA_ERROR__TRANSACTION__FEE_PAYER_SIGNATURE_MISSING = 5663012;
|
|
248
|
+
var SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_INSTRUCTIONS_MISSING = 5663013;
|
|
249
|
+
var SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_FIRST_INSTRUCTION_MUST_BE_ADVANCE_NONCE = 5663014;
|
|
250
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__UNKNOWN = 705e4;
|
|
251
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_IN_USE = 7050001;
|
|
252
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_LOADED_TWICE = 7050002;
|
|
253
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_NOT_FOUND = 7050003;
|
|
254
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_ACCOUNT_NOT_FOUND = 7050004;
|
|
255
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_FEE = 7050005;
|
|
256
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_FOR_FEE = 7050006;
|
|
257
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__ALREADY_PROCESSED = 7050007;
|
|
258
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__BLOCKHASH_NOT_FOUND = 7050008;
|
|
259
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__CALL_CHAIN_TOO_DEEP = 7050009;
|
|
260
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__MISSING_SIGNATURE_FOR_FEE = 7050010;
|
|
261
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_INDEX = 7050011;
|
|
262
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__SIGNATURE_FAILURE = 7050012;
|
|
263
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__INVALID_PROGRAM_FOR_EXECUTION = 7050013;
|
|
264
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__SANITIZE_FAILURE = 7050014;
|
|
265
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__CLUSTER_MAINTENANCE = 7050015;
|
|
266
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_BORROW_OUTSTANDING = 7050016;
|
|
267
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_BLOCK_COST_LIMIT = 7050017;
|
|
268
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__UNSUPPORTED_VERSION = 7050018;
|
|
269
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__INVALID_WRITABLE_ACCOUNT = 7050019;
|
|
270
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_ACCOUNT_COST_LIMIT = 7050020;
|
|
271
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_BLOCK_LIMIT = 7050021;
|
|
272
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__TOO_MANY_ACCOUNT_LOCKS = 7050022;
|
|
273
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__ADDRESS_LOOKUP_TABLE_NOT_FOUND = 7050023;
|
|
274
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_OWNER = 7050024;
|
|
275
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_DATA = 7050025;
|
|
276
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_INDEX = 7050026;
|
|
277
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__INVALID_RENT_PAYING_ACCOUNT = 7050027;
|
|
278
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_VOTE_COST_LIMIT = 7050028;
|
|
279
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_TOTAL_LIMIT = 7050029;
|
|
280
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__DUPLICATE_INSTRUCTION = 7050030;
|
|
281
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_RENT = 7050031;
|
|
282
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__MAX_LOADED_ACCOUNTS_DATA_SIZE_EXCEEDED = 7050032;
|
|
283
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__INVALID_LOADED_ACCOUNTS_DATA_SIZE_LIMIT = 7050033;
|
|
284
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__RESANITIZATION_NEEDED = 7050034;
|
|
285
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED = 7050035;
|
|
286
|
+
var SOLANA_ERROR__TRANSACTION_ERROR__UNBALANCED_TRANSACTION = 7050036;
|
|
287
|
+
var SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY = 8078e3;
|
|
288
|
+
var SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH = 8078001;
|
|
289
|
+
var SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH = 8078002;
|
|
290
|
+
var SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH = 8078003;
|
|
291
|
+
var SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH = 8078004;
|
|
292
|
+
var SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH = 8078005;
|
|
293
|
+
var SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH = 8078006;
|
|
294
|
+
var SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS = 8078007;
|
|
295
|
+
var SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE = 8078008;
|
|
296
|
+
var SOLANA_ERROR__CODECS__INVALID_DATA_ENUM_VARIANT = 8078009;
|
|
297
|
+
var SOLANA_ERROR__CODECS__INVALID_SCALAR_ENUM_VARIANT = 8078010;
|
|
298
|
+
var SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE = 8078011;
|
|
299
|
+
var SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE = 8078012;
|
|
300
|
+
var SOLANA_ERROR__RPC__INTEGER_OVERFLOW = 81e5;
|
|
301
|
+
var SOLANA_ERROR__RPC__TRANSPORT_HTTP_HEADER_FORBIDDEN = 8100001;
|
|
302
|
+
var SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR = 8100002;
|
|
303
|
+
var SOLANA_ERROR__RPC_SUBSCRIPTIONS__CANNOT_CREATE_SUBSCRIPTION_REQUEST = 819e4;
|
|
304
|
+
var SOLANA_ERROR__RPC_SUBSCRIPTIONS__EXPECTED_SERVER_SUBSCRIPTION_ID = 8190001;
|
|
305
|
+
var SOLANA_ERROR__RPC_SUBSCRIPTIONS__TRANSPORT_CLOSED_BEFORE_MESSAGE_BUFFERED = 8190002;
|
|
306
|
+
var SOLANA_ERROR__RPC_SUBSCRIPTIONS__TRANSPORT_CONNECTION_CLOSED = 8190003;
|
|
307
|
+
var SOLANA_ERROR__RPC_SUBSCRIPTIONS__TRANSPORT_FAILED_TO_CONNECT = 8190004;
|
|
308
|
+
var SOLANA_ERROR__INVARIANT_VIOLATION__WEBSOCKET_MESSAGE_ITERATOR_STATE_MISSING = 99e5;
|
|
309
|
+
var SOLANA_ERROR__INVARIANT_VIOLATION__WEBSOCKET_MESSAGE_ITERATOR_MUST_NOT_POLL_BEFORE_RESOLVING_EXISTING_MESSAGE_PROMISE = 9900001;
|
|
310
|
+
var SOLANA_ERROR__INVARIANT_VIOLATION__CACHED_ABORTABLE_ITERABLE_CACHE_ENTRY_MISSING = 9900002;
|
|
311
|
+
var SOLANA_ERROR__INVARIANT_VIOLATION__SWITCH_MUST_BE_EXHAUSTIVE = 9900003;
|
|
312
|
+
var SolanaErrorMessages = {
|
|
313
|
+
[SOLANA_ERROR__ACCOUNTS__ACCOUNT_NOT_FOUND]: "Account not found at address: $address",
|
|
314
|
+
[SOLANA_ERROR__ACCOUNTS__EXPECTED_ALL_ACCOUNTS_TO_BE_DECODED]: "Not all accounts were decoded. Encoded accounts found at addresses: $addresses.",
|
|
315
|
+
[SOLANA_ERROR__ACCOUNTS__EXPECTED_DECODED_ACCOUNT]: "Expected decoded account at address: $address",
|
|
316
|
+
[SOLANA_ERROR__ACCOUNTS__FAILED_TO_DECODE_ACCOUNT]: "Failed to decode account data at address: $address",
|
|
317
|
+
[SOLANA_ERROR__ACCOUNTS__ONE_OR_MORE_ACCOUNTS_NOT_FOUND]: "Accounts not found at addresses: $addresses",
|
|
318
|
+
[SOLANA_ERROR__ADDRESSES__FAILED_TO_FIND_VIABLE_PDA_BUMP_SEED]: "Unable to find a viable program address bump seed.",
|
|
319
|
+
[SOLANA_ERROR__ADDRESSES__INVALID_BASE58_ENCODED_ADDRESS]: "$putativeAddress is not a base58-encoded address.",
|
|
320
|
+
[SOLANA_ERROR__ADDRESSES__INVALID_BYTE_LENGTH]: "Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.",
|
|
321
|
+
[SOLANA_ERROR__ADDRESSES__INVALID_ED25519_PUBLIC_KEY]: "The `CryptoKey` must be an `Ed25519` public key.",
|
|
322
|
+
[SOLANA_ERROR__ADDRESSES__INVALID_SEEDS_POINT_ON_CURVE]: "Invalid seeds; point must fall off the Ed25519 curve.",
|
|
323
|
+
[SOLANA_ERROR__ADDRESSES__MALFORMED_PDA]: "Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].",
|
|
324
|
+
[SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED]: "A maximum of $maxSeeds seeds, including the bump seed, may be supplied when creating an address. Received: $actual.",
|
|
325
|
+
[SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED]: "The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.",
|
|
326
|
+
[SOLANA_ERROR__ADDRESSES__PDA_BUMP_SEED_OUT_OF_RANGE]: "Expected program derived address bump to be in the range [0, 255], got: $bump.",
|
|
327
|
+
[SOLANA_ERROR__ADDRESSES__PDA_ENDS_WITH_PDA_MARKER]: "Program address cannot end with PDA marker.",
|
|
328
|
+
[SOLANA_ERROR__ADDRESSES__STRING_LENGTH_OUT_OF_RANGE]: "Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.",
|
|
329
|
+
[SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE]: "Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.",
|
|
330
|
+
[SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED]: "The network has progressed past the last block for which this transaction could have been committed.",
|
|
331
|
+
[SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY]: "Codec [$codecDescription] cannot decode empty byte arrays.",
|
|
332
|
+
[SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH]: "Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].",
|
|
333
|
+
[SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH]: "Encoder and decoder must have the same max size, got [$encoderMaxSize] and [$decoderMaxSize].",
|
|
334
|
+
[SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH]: "Encoder and decoder must either both be fixed-size or variable-size.",
|
|
335
|
+
[SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE]: "Enum discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.",
|
|
336
|
+
[SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH]: "Expected a fixed-size codec, got a variable-size one.",
|
|
337
|
+
[SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH]: "Expected a variable-size codec, got a fixed-size one.",
|
|
338
|
+
[SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH]: "Codec [$codecDescription] expected $expected bytes, got $bytesLength.",
|
|
339
|
+
[SOLANA_ERROR__CODECS__INVALID_DATA_ENUM_VARIANT]: "Invalid data enum variant. Expected one of [$variants], got $value.",
|
|
340
|
+
[SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS]: "Expected [$codecDescription] to have $expected items, got $actual.",
|
|
341
|
+
[SOLANA_ERROR__CODECS__INVALID_SCALAR_ENUM_VARIANT]: "Invalid scalar enum variant. Expected one of [$variants] or a number between $minRange and $maxRange, got $value.",
|
|
342
|
+
[SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE]: "Invalid value $value for base $base with alphabet $alphabet.",
|
|
343
|
+
[SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE]: "Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.",
|
|
344
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_ALREADY_INITIALIZED]: "instruction requires an uninitialized account",
|
|
345
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_FAILED]: "instruction tries to borrow reference for an account which is already borrowed",
|
|
346
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_OUTSTANDING]: "instruction left account with an outstanding borrowed reference",
|
|
347
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_SIZE_CHANGED]: "program other than the account's owner changed the size of the account data",
|
|
348
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_TOO_SMALL]: "account data too small for instruction",
|
|
349
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_EXECUTABLE]: "instruction expected an executable account",
|
|
350
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_RENT_EXEMPT]: "An account does not have enough lamports to be rent-exempt",
|
|
351
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__ARITHMETIC_OVERFLOW]: "Program arithmetic overflowed",
|
|
352
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__BORSH_IO_ERROR]: "Failed to serialize or deserialize account data: $encodedData",
|
|
353
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS]: "Builtin programs must consume compute units",
|
|
354
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__CALL_DEPTH]: "Cross-program invocation call depth too deep",
|
|
355
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__COMPUTATIONAL_BUDGET_EXCEEDED]: "Computational budget exceeded",
|
|
356
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM]: "custom program error: #$code",
|
|
357
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_INDEX]: "instruction contains duplicate accounts",
|
|
358
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_OUT_OF_SYNC]: "instruction modifications of multiply-passed account differ",
|
|
359
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_ACCOUNT_NOT_RENT_EXEMPT]: "executable accounts must be rent exempt",
|
|
360
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_DATA_MODIFIED]: "instruction changed executable accounts data",
|
|
361
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_LAMPORT_CHANGE]: "instruction changed the balance of an executable account",
|
|
362
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_MODIFIED]: "instruction changed executable bit of an account",
|
|
363
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_DATA_MODIFIED]: "instruction modified data of an account it does not own",
|
|
364
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_LAMPORT_SPEND]: "instruction spent from the balance of an account it does not own",
|
|
365
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__GENERIC_ERROR]: "generic instruction error",
|
|
366
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__ILLEGAL_OWNER]: "Provided owner is not allowed",
|
|
367
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__IMMUTABLE]: "Account is immutable",
|
|
368
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_AUTHORITY]: "Incorrect authority provided",
|
|
369
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_PROGRAM_ID]: "incorrect program id for instruction",
|
|
370
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__INSUFFICIENT_FUNDS]: "insufficient funds for instruction",
|
|
371
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_DATA]: "invalid account data for instruction",
|
|
372
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_OWNER]: "Invalid account owner",
|
|
373
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ARGUMENT]: "invalid program argument",
|
|
374
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ERROR]: "program returned invalid error code",
|
|
375
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_INSTRUCTION_DATA]: "invalid instruction data",
|
|
376
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_REALLOC]: "Failed to reallocate account data",
|
|
377
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_SEEDS]: "Provided seeds do not result in a valid address",
|
|
378
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED]: "Accounts data allocations exceeded the maximum allowed per transaction",
|
|
379
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_EXCEEDED]: "Max accounts exceeded",
|
|
380
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED]: "Max instruction trace length exceeded",
|
|
381
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__MAX_SEED_LENGTH_EXCEEDED]: "Length of the seed is too long for address generation",
|
|
382
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_ACCOUNT]: "An account required by the instruction is missing",
|
|
383
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_REQUIRED_SIGNATURE]: "missing required signature for instruction",
|
|
384
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__MODIFIED_PROGRAM_ID]: "instruction illegally modified the program id of an account",
|
|
385
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__NOT_ENOUGH_ACCOUNT_KEYS]: "insufficient account keys for instruction",
|
|
386
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__PRIVILEGE_ESCALATION]: "Cross-program invocation with unauthorized signer or writable account",
|
|
387
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_ENVIRONMENT_SETUP_FAILURE]: "Failed to create program execution environment",
|
|
388
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPILE]: "Program failed to compile",
|
|
389
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPLETE]: "Program failed to complete",
|
|
390
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_DATA_MODIFIED]: "instruction modified data of a read-only account",
|
|
391
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_LAMPORT_CHANGE]: "instruction changed the balance of a read-only account",
|
|
392
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__REENTRANCY_NOT_ALLOWED]: "Cross-program invocation reentrancy not allowed for this instruction",
|
|
393
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__RENT_EPOCH_MODIFIED]: "instruction modified rent epoch of an account",
|
|
394
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__UNBALANCED_INSTRUCTION]: "sum of account balances before and after instruction do not match",
|
|
395
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__UNINITIALIZED_ACCOUNT]: "instruction requires an initialized account",
|
|
396
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN]: "",
|
|
397
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_PROGRAM_ID]: "Unsupported program id",
|
|
398
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_SYSVAR]: "Unsupported sysvar",
|
|
399
|
+
[SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_ACCOUNTS]: "The instruction does not have any accounts.",
|
|
400
|
+
[SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_DATA]: "The instruction does not have any data.",
|
|
401
|
+
[SOLANA_ERROR__INSTRUCTION__PROGRAM_ID_MISMATCH]: "Expected instruction to have progress address $expectedProgramAddress, got $actualProgramAddress.",
|
|
402
|
+
[SOLANA_ERROR__INVALID_BLOCKHASH_BYTE_LENGTH]: "Expected base58 encoded blockhash to decode to a byte array of length 32. Actual length: $actualLength.",
|
|
403
|
+
[SOLANA_ERROR__INVALID_NONCE]: "The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",
|
|
404
|
+
[SOLANA_ERROR__INVARIANT_VIOLATION__CACHED_ABORTABLE_ITERABLE_CACHE_ENTRY_MISSING]: "Invariant violation: Found no abortable iterable cache entry for key `$cacheKey`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",
|
|
405
|
+
[SOLANA_ERROR__INVARIANT_VIOLATION__SWITCH_MUST_BE_EXHAUSTIVE]: "Invariant violation: Switch statement non-exhaustive. Received unexpected value `$unexpectedValue`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",
|
|
406
|
+
[SOLANA_ERROR__INVARIANT_VIOLATION__WEBSOCKET_MESSAGE_ITERATOR_MUST_NOT_POLL_BEFORE_RESOLVING_EXISTING_MESSAGE_PROMISE]: "Invariant violation: WebSocket message iterator state is corrupt; iterated without first resolving existing message promise. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",
|
|
407
|
+
[SOLANA_ERROR__INVARIANT_VIOLATION__WEBSOCKET_MESSAGE_ITERATOR_STATE_MISSING]: "Invariant violation: WebSocket message iterator is missing state storage. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",
|
|
408
|
+
[SOLANA_ERROR__KEYS__INVALID_KEY_PAIR_BYTE_LENGTH]: "Key pair bytes must be of length 64, got $byteLength.",
|
|
409
|
+
[SOLANA_ERROR__KEYS__INVALID_PRIVATE_KEY_BYTE_LENGTH]: "Expected private key bytes with length 32. Actual length: $actualLength.",
|
|
410
|
+
[SOLANA_ERROR__KEYS__INVALID_SIGNATURE_BYTE_LENGTH]: "Expected base58-encoded signature to decode to a byte array of length 64. Actual length: $actualLength.",
|
|
411
|
+
[SOLANA_ERROR__KEYS__SIGNATURE_STRING_LENGTH_OUT_OF_RANGE]: "Expected base58-encoded signature string of length in the range [64, 88]. Actual length: $actualLength.",
|
|
412
|
+
[SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE]: "Lamports value must be in the range [0, 2e64-1]",
|
|
413
|
+
[SOLANA_ERROR__MALFORMED_BIGINT_STRING]: "`$value` cannot be parsed as a `BigInt`",
|
|
414
|
+
[SOLANA_ERROR__MALFORMED_NUMBER_STRING]: "`$value` cannot be parsed as a `Number`",
|
|
415
|
+
[SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND]: "No nonce account could be found at address `$nonceAccountAddress`",
|
|
416
|
+
[SOLANA_ERROR__RPC_SUBSCRIPTIONS__CANNOT_CREATE_SUBSCRIPTION_REQUEST]: "Either the notification name must end in 'Notifications' or the API must supply a subscription creator function for the notification '$notificationName' to map between the notification name and the subscribe/unsubscribe method names.",
|
|
417
|
+
[SOLANA_ERROR__RPC_SUBSCRIPTIONS__EXPECTED_SERVER_SUBSCRIPTION_ID]: "Failed to obtain a subscription id from the server",
|
|
418
|
+
[SOLANA_ERROR__RPC_SUBSCRIPTIONS__TRANSPORT_CLOSED_BEFORE_MESSAGE_BUFFERED]: "WebSocket was closed before payload could be added to the send buffer",
|
|
419
|
+
[SOLANA_ERROR__RPC_SUBSCRIPTIONS__TRANSPORT_CONNECTION_CLOSED]: "WebSocket connection closed",
|
|
420
|
+
[SOLANA_ERROR__RPC_SUBSCRIPTIONS__TRANSPORT_FAILED_TO_CONNECT]: "WebSocket failed to connect",
|
|
421
|
+
[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`.",
|
|
422
|
+
[SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR]: "HTTP error ($statusCode): $message",
|
|
423
|
+
[SOLANA_ERROR__RPC__TRANSPORT_HTTP_HEADER_FORBIDDEN]: "HTTP header(s) forbidden: $headers. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.",
|
|
424
|
+
[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.",
|
|
425
|
+
[SOLANA_ERROR__SIGNER__EXPECTED_KEY_PAIR_SIGNER]: "The provided value does not implement the `KeyPairSigner` interface",
|
|
426
|
+
[SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_MODIFYING_SIGNER]: "The provided value does not implement the `MessageModifyingSigner` interface",
|
|
427
|
+
[SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_PARTIAL_SIGNER]: "The provided value does not implement the `MessagePartialSigner` interface",
|
|
428
|
+
[SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_SIGNER]: "The provided value does not implement any of the `MessageSigner` interfaces",
|
|
429
|
+
[SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_MODIFYING_SIGNER]: "The provided value does not implement the `TransactionModifyingSigner` interface",
|
|
430
|
+
[SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_PARTIAL_SIGNER]: "The provided value does not implement the `TransactionPartialSigner` interface",
|
|
431
|
+
[SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SENDING_SIGNER]: "The provided value does not implement the `TransactionSendingSigner` interface",
|
|
432
|
+
[SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SIGNER]: "The provided value does not implement any of the `TransactionSigner` interfaces",
|
|
433
|
+
[SOLANA_ERROR__SIGNER__TRANSACTION_CANNOT_HAVE_MULTIPLE_SENDING_SIGNERS]: "More than one `TransactionSendingSigner` was identified.",
|
|
434
|
+
[SOLANA_ERROR__SIGNER__TRANSACTION_SENDING_SIGNER_MISSING]: "No `TransactionSendingSigner` was identified. Please provide a valid `ITransactionWithSingleSendingSigner` transaction.",
|
|
435
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO__DIGEST_UNIMPLEMENTED]: "No digest implementation could be found.",
|
|
436
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO__DISALLOWED_IN_INSECURE_CONTEXT]: "Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.",
|
|
437
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO__ED25519_ALGORITHM_UNIMPLEMENTED]: "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.",
|
|
438
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO__EXPORT_FUNCTION_UNIMPLEMENTED]: "No signature verification implementation could be found.",
|
|
439
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO__GENERATE_FUNCTION_UNIMPLEMENTED]: "No key generation implementation could be found.",
|
|
440
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO__SIGN_FUNCTION_UNIMPLEMENTED]: "No signing implementation could be found.",
|
|
441
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO__VERIFY_FUNCTION_UNIMPLEMENTED]: "No key export implementation could be found.",
|
|
442
|
+
[SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE]: "Timestamp value must be in the range [-8.64e15, 8.64e15]. `$value` given",
|
|
443
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_BORROW_OUTSTANDING]: "Transaction processing left an account with an outstanding borrowed reference",
|
|
444
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_IN_USE]: "Account in use",
|
|
445
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_LOADED_TWICE]: "Account loaded twice",
|
|
446
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_NOT_FOUND]: "Attempt to debit an account but found no record of a prior credit.",
|
|
447
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__ADDRESS_LOOKUP_TABLE_NOT_FOUND]: "Transaction loads an address table account that doesn't exist",
|
|
448
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__ALREADY_PROCESSED]: "This transaction has already been processed",
|
|
449
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__BLOCKHASH_NOT_FOUND]: "Blockhash not found",
|
|
450
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__CALL_CHAIN_TOO_DEEP]: "Loader call chain is too deep",
|
|
451
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__CLUSTER_MAINTENANCE]: "Transactions are currently disabled due to cluster maintenance",
|
|
452
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__DUPLICATE_INSTRUCTION]: "Transaction contains a duplicate instruction ($index) that is not allowed",
|
|
453
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_FEE]: "Insufficient funds for fee",
|
|
454
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_RENT]: "Transaction results in an account ($accountIndex) with insufficient funds for rent",
|
|
455
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_FOR_FEE]: "This account may not be used to pay transaction fees",
|
|
456
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_INDEX]: "Transaction contains an invalid account reference",
|
|
457
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_DATA]: "Transaction loads an address table account with invalid data",
|
|
458
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_INDEX]: "Transaction address table lookup uses an invalid index",
|
|
459
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_OWNER]: "Transaction loads an address table account with an invalid owner",
|
|
460
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__INVALID_LOADED_ACCOUNTS_DATA_SIZE_LIMIT]: "LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",
|
|
461
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__INVALID_PROGRAM_FOR_EXECUTION]: "This program may not be used for executing instructions",
|
|
462
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__INVALID_RENT_PAYING_ACCOUNT]: "Transaction leaves an account with a lower balance than rent-exempt minimum",
|
|
463
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__INVALID_WRITABLE_ACCOUNT]: "Transaction loads a writable account that cannot be written",
|
|
464
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__MAX_LOADED_ACCOUNTS_DATA_SIZE_EXCEEDED]: "Transaction exceeded max loaded accounts data size cap",
|
|
465
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__MISSING_SIGNATURE_FOR_FEE]: "Transaction requires a fee but has no signature present",
|
|
466
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_ACCOUNT_NOT_FOUND]: "Attempt to load a program that does not exist",
|
|
467
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED]: "Execution of the program referenced by account at index $accountIndex is temporarily restricted.",
|
|
468
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__RESANITIZATION_NEEDED]: "ResanitizationNeeded",
|
|
469
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__SANITIZE_FAILURE]: "Transaction failed to sanitize accounts offsets correctly",
|
|
470
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__SIGNATURE_FAILURE]: "Transaction did not pass signature verification",
|
|
471
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__TOO_MANY_ACCOUNT_LOCKS]: "Transaction locked too many accounts",
|
|
472
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__UNBALANCED_TRANSACTION]: "Sum of account balances before and after transaction do not match",
|
|
473
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__UNKNOWN]: "The transaction failed with the error `$errorName`",
|
|
474
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__UNSUPPORTED_VERSION]: "Transaction version is unsupported",
|
|
475
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_BLOCK_LIMIT]: "Transaction would exceed account data limit within the block",
|
|
476
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_TOTAL_LIMIT]: "Transaction would exceed total account data limit",
|
|
477
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_ACCOUNT_COST_LIMIT]: "Transaction would exceed max account limit within the block",
|
|
478
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_BLOCK_COST_LIMIT]: "Transaction would exceed max Block Cost Limit",
|
|
479
|
+
[SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_VOTE_COST_LIMIT]: "Transaction would exceed max Vote Cost Limit",
|
|
480
|
+
[SOLANA_ERROR__TRANSACTION__ADDRESS_MISSING]: "Transaction is missing an address at index: $index.",
|
|
481
|
+
[SOLANA_ERROR__TRANSACTION__EXPECTED_BLOCKHASH_LIFETIME]: "Transaction does not have a blockhash lifetime",
|
|
482
|
+
[SOLANA_ERROR__TRANSACTION__EXPECTED_NONCE_LIFETIME]: "Transaction is not a durable nonce transaction",
|
|
483
|
+
[SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING]: "Contents of these address lookup tables unknown: $lookupTableAddresses",
|
|
484
|
+
[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",
|
|
485
|
+
[SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_FEE_PAYER_MISSING]: "No fee payer set in CompiledTransaction",
|
|
486
|
+
[SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND]: "Could not find program address at index $index",
|
|
487
|
+
[SOLANA_ERROR__TRANSACTION__FEE_PAYER_MISSING]: "Transaction is missing a fee payer.",
|
|
488
|
+
[SOLANA_ERROR__TRANSACTION__FEE_PAYER_SIGNATURE_MISSING]: "Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.",
|
|
489
|
+
[SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_FIRST_INSTRUCTION_MUST_BE_ADVANCE_NONCE]: "Transaction first instruction is not advance nonce account instruction.",
|
|
490
|
+
[SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_INSTRUCTIONS_MISSING]: "Transaction with no instructions cannot be durable nonce transaction.",
|
|
491
|
+
[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",
|
|
492
|
+
[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",
|
|
493
|
+
[SOLANA_ERROR__TRANSACTION__SIGNATURES_MISSING]: "Transaction is missing signatures for addresses: $addresses.",
|
|
494
|
+
[SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_OUT_OF_RANGE]: "Transaction version must be in the range [0, 127]. `$actualVersion` given"
|
|
495
|
+
};
|
|
496
|
+
function getHumanReadableErrorMessage(code, context = {}) {
|
|
497
|
+
const messageFormatString = SolanaErrorMessages[code];
|
|
498
|
+
const message = messageFormatString.replace(
|
|
499
|
+
new RegExp("(?<!\\\\)\\$(\\w+)", "g"),
|
|
500
|
+
(substring, variableName) => variableName in context ? `${context[variableName]}` : substring
|
|
501
|
+
);
|
|
502
|
+
return message;
|
|
503
|
+
}
|
|
504
|
+
function getErrorMessage(code, context = {}) {
|
|
505
|
+
{
|
|
506
|
+
return getHumanReadableErrorMessage(code, context);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
function isSolanaError(e3, code) {
|
|
510
|
+
const isSolanaError2 = e3 instanceof Error && e3.name === "SolanaError";
|
|
511
|
+
if (isSolanaError2) {
|
|
512
|
+
if (code !== void 0) {
|
|
513
|
+
return e3.context.__code === code;
|
|
514
|
+
}
|
|
515
|
+
return true;
|
|
516
|
+
}
|
|
517
|
+
return false;
|
|
518
|
+
}
|
|
519
|
+
var SolanaError = class extends Error {
|
|
520
|
+
constructor(...[code, contextAndErrorOptions]) {
|
|
521
|
+
let context;
|
|
522
|
+
let errorOptions;
|
|
523
|
+
if (contextAndErrorOptions) {
|
|
524
|
+
const { cause, ...contextRest } = contextAndErrorOptions;
|
|
525
|
+
if (cause) {
|
|
526
|
+
errorOptions = { cause };
|
|
527
|
+
}
|
|
528
|
+
if (Object.keys(contextRest).length > 0) {
|
|
529
|
+
context = contextRest;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
const message = getErrorMessage(code, context);
|
|
533
|
+
super(message, errorOptions);
|
|
534
|
+
__publicField(this, "context");
|
|
535
|
+
this.context = {
|
|
536
|
+
__code: code,
|
|
537
|
+
...context
|
|
538
|
+
};
|
|
539
|
+
this.name = "SolanaError";
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
function getSolanaErrorFromRpcError({ errorCodeBaseOffset, getErrorContext, orderedErrorNames, rpcEnumError }, constructorOpt) {
|
|
543
|
+
let rpcErrorName;
|
|
544
|
+
let rpcErrorContext;
|
|
545
|
+
if (typeof rpcEnumError === "string") {
|
|
546
|
+
rpcErrorName = rpcEnumError;
|
|
547
|
+
} else {
|
|
548
|
+
rpcErrorName = Object.keys(rpcEnumError)[0];
|
|
549
|
+
rpcErrorContext = rpcEnumError[rpcErrorName];
|
|
550
|
+
}
|
|
551
|
+
const codeOffset = orderedErrorNames.indexOf(rpcErrorName);
|
|
552
|
+
const errorCode = errorCodeBaseOffset + codeOffset;
|
|
553
|
+
const errorContext = getErrorContext(errorCode, rpcErrorName, rpcErrorContext);
|
|
554
|
+
const err = new SolanaError(errorCode, errorContext);
|
|
555
|
+
if ("captureStackTrace" in Error && typeof Error.captureStackTrace === "function") {
|
|
556
|
+
Error.captureStackTrace(err, constructorOpt);
|
|
557
|
+
}
|
|
558
|
+
return err;
|
|
559
|
+
}
|
|
560
|
+
var ORDERED_ERROR_NAMES = [
|
|
561
|
+
// Keep synced with RPC source: https://github.com/anza-xyz/agave/blob/master/sdk/program/src/instruction.rs
|
|
562
|
+
// If this list ever gets too large, consider implementing a compression strategy like this:
|
|
563
|
+
// https://gist.github.com/steveluscher/aaa7cbbb5433b1197983908a40860c47
|
|
564
|
+
"GenericError",
|
|
565
|
+
"InvalidArgument",
|
|
566
|
+
"InvalidInstructionData",
|
|
567
|
+
"InvalidAccountData",
|
|
568
|
+
"AccountDataTooSmall",
|
|
569
|
+
"InsufficientFunds",
|
|
570
|
+
"IncorrectProgramId",
|
|
571
|
+
"MissingRequiredSignature",
|
|
572
|
+
"AccountAlreadyInitialized",
|
|
573
|
+
"UninitializedAccount",
|
|
574
|
+
"UnbalancedInstruction",
|
|
575
|
+
"ModifiedProgramId",
|
|
576
|
+
"ExternalAccountLamportSpend",
|
|
577
|
+
"ExternalAccountDataModified",
|
|
578
|
+
"ReadonlyLamportChange",
|
|
579
|
+
"ReadonlyDataModified",
|
|
580
|
+
"DuplicateAccountIndex",
|
|
581
|
+
"ExecutableModified",
|
|
582
|
+
"RentEpochModified",
|
|
583
|
+
"NotEnoughAccountKeys",
|
|
584
|
+
"AccountDataSizeChanged",
|
|
585
|
+
"AccountNotExecutable",
|
|
586
|
+
"AccountBorrowFailed",
|
|
587
|
+
"AccountBorrowOutstanding",
|
|
588
|
+
"DuplicateAccountOutOfSync",
|
|
589
|
+
"Custom",
|
|
590
|
+
"InvalidError",
|
|
591
|
+
"ExecutableDataModified",
|
|
592
|
+
"ExecutableLamportChange",
|
|
593
|
+
"ExecutableAccountNotRentExempt",
|
|
594
|
+
"UnsupportedProgramId",
|
|
595
|
+
"CallDepth",
|
|
596
|
+
"MissingAccount",
|
|
597
|
+
"ReentrancyNotAllowed",
|
|
598
|
+
"MaxSeedLengthExceeded",
|
|
599
|
+
"InvalidSeeds",
|
|
600
|
+
"InvalidRealloc",
|
|
601
|
+
"ComputationalBudgetExceeded",
|
|
602
|
+
"PrivilegeEscalation",
|
|
603
|
+
"ProgramEnvironmentSetupFailure",
|
|
604
|
+
"ProgramFailedToComplete",
|
|
605
|
+
"ProgramFailedToCompile",
|
|
606
|
+
"Immutable",
|
|
607
|
+
"IncorrectAuthority",
|
|
608
|
+
"BorshIoError",
|
|
609
|
+
"AccountNotRentExempt",
|
|
610
|
+
"InvalidAccountOwner",
|
|
611
|
+
"ArithmeticOverflow",
|
|
612
|
+
"UnsupportedSysvar",
|
|
613
|
+
"IllegalOwner",
|
|
614
|
+
"MaxAccountsDataAllocationsExceeded",
|
|
615
|
+
"MaxAccountsExceeded",
|
|
616
|
+
"MaxInstructionTraceLengthExceeded",
|
|
617
|
+
"BuiltinProgramsMustConsumeComputeUnits"
|
|
618
|
+
];
|
|
619
|
+
function getSolanaErrorFromInstructionError(index, instructionError) {
|
|
620
|
+
return getSolanaErrorFromRpcError(
|
|
621
|
+
{
|
|
622
|
+
errorCodeBaseOffset: 4615001,
|
|
623
|
+
getErrorContext(errorCode, rpcErrorName, rpcErrorContext) {
|
|
624
|
+
if (errorCode === SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN) {
|
|
625
|
+
return {
|
|
626
|
+
errorName: rpcErrorName,
|
|
627
|
+
index,
|
|
628
|
+
...rpcErrorContext !== void 0 ? { instructionErrorContext: rpcErrorContext } : null
|
|
629
|
+
};
|
|
630
|
+
} else if (errorCode === SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM) {
|
|
631
|
+
return {
|
|
632
|
+
code: rpcErrorContext,
|
|
633
|
+
index
|
|
634
|
+
};
|
|
635
|
+
} else if (errorCode === SOLANA_ERROR__INSTRUCTION_ERROR__BORSH_IO_ERROR) {
|
|
636
|
+
return {
|
|
637
|
+
encodedData: rpcErrorContext,
|
|
638
|
+
index
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
return { index };
|
|
642
|
+
},
|
|
643
|
+
orderedErrorNames: ORDERED_ERROR_NAMES,
|
|
644
|
+
rpcEnumError: instructionError
|
|
645
|
+
},
|
|
646
|
+
getSolanaErrorFromInstructionError
|
|
647
|
+
);
|
|
648
|
+
}
|
|
649
|
+
var ORDERED_ERROR_NAMES2 = [
|
|
650
|
+
// Keep synced with RPC source: https://github.com/anza-xyz/agave/blob/master/sdk/src/transaction/error.rs
|
|
651
|
+
// If this list ever gets too large, consider implementing a compression strategy like this:
|
|
652
|
+
// https://gist.github.com/steveluscher/aaa7cbbb5433b1197983908a40860c47
|
|
653
|
+
"AccountInUse",
|
|
654
|
+
"AccountLoadedTwice",
|
|
655
|
+
"AccountNotFound",
|
|
656
|
+
"ProgramAccountNotFound",
|
|
657
|
+
"InsufficientFundsForFee",
|
|
658
|
+
"InvalidAccountForFee",
|
|
659
|
+
"AlreadyProcessed",
|
|
660
|
+
"BlockhashNotFound",
|
|
661
|
+
// `InstructionError` intentionally omitted; delegated to `getSolanaErrorFromInstructionError`
|
|
662
|
+
"CallChainTooDeep",
|
|
663
|
+
"MissingSignatureForFee",
|
|
664
|
+
"InvalidAccountIndex",
|
|
665
|
+
"SignatureFailure",
|
|
666
|
+
"InvalidProgramForExecution",
|
|
667
|
+
"SanitizeFailure",
|
|
668
|
+
"ClusterMaintenance",
|
|
669
|
+
"AccountBorrowOutstanding",
|
|
670
|
+
"WouldExceedMaxBlockCostLimit",
|
|
671
|
+
"UnsupportedVersion",
|
|
672
|
+
"InvalidWritableAccount",
|
|
673
|
+
"WouldExceedMaxAccountCostLimit",
|
|
674
|
+
"WouldExceedAccountDataBlockLimit",
|
|
675
|
+
"TooManyAccountLocks",
|
|
676
|
+
"AddressLookupTableNotFound",
|
|
677
|
+
"InvalidAddressLookupTableOwner",
|
|
678
|
+
"InvalidAddressLookupTableData",
|
|
679
|
+
"InvalidAddressLookupTableIndex",
|
|
680
|
+
"InvalidRentPayingAccount",
|
|
681
|
+
"WouldExceedMaxVoteCostLimit",
|
|
682
|
+
"WouldExceedAccountDataTotalLimit",
|
|
683
|
+
"DuplicateInstruction",
|
|
684
|
+
"InsufficientFundsForRent",
|
|
685
|
+
"MaxLoadedAccountsDataSizeExceeded",
|
|
686
|
+
"InvalidLoadedAccountsDataSizeLimit",
|
|
687
|
+
"ResanitizationNeeded",
|
|
688
|
+
"ProgramExecutionTemporarilyRestricted",
|
|
689
|
+
"UnbalancedTransaction"
|
|
690
|
+
];
|
|
691
|
+
function getSolanaErrorFromTransactionError(transactionError) {
|
|
692
|
+
if (typeof transactionError === "object" && "InstructionError" in transactionError) {
|
|
693
|
+
return getSolanaErrorFromInstructionError(
|
|
694
|
+
...transactionError.InstructionError
|
|
695
|
+
);
|
|
696
|
+
}
|
|
697
|
+
return getSolanaErrorFromRpcError(
|
|
698
|
+
{
|
|
699
|
+
errorCodeBaseOffset: 7050001,
|
|
700
|
+
getErrorContext(errorCode, rpcErrorName, rpcErrorContext) {
|
|
701
|
+
if (errorCode === SOLANA_ERROR__TRANSACTION_ERROR__UNKNOWN) {
|
|
702
|
+
return {
|
|
703
|
+
errorName: rpcErrorName,
|
|
704
|
+
...rpcErrorContext !== void 0 ? { transactionErrorContext: rpcErrorContext } : null
|
|
705
|
+
};
|
|
706
|
+
} else if (errorCode === SOLANA_ERROR__TRANSACTION_ERROR__DUPLICATE_INSTRUCTION) {
|
|
707
|
+
return {
|
|
708
|
+
index: rpcErrorContext
|
|
709
|
+
};
|
|
710
|
+
} else if (errorCode === SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_RENT || errorCode === SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED) {
|
|
711
|
+
return {
|
|
712
|
+
accountIndex: rpcErrorContext.account_index
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
},
|
|
716
|
+
orderedErrorNames: ORDERED_ERROR_NAMES2,
|
|
717
|
+
rpcEnumError: transactionError
|
|
718
|
+
},
|
|
719
|
+
getSolanaErrorFromTransactionError
|
|
720
|
+
);
|
|
721
|
+
}
|
|
722
|
+
|
|
128
723
|
// ../codecs-strings/dist/index.browser.js
|
|
129
724
|
init_env_shim();
|
|
130
725
|
|
|
@@ -132,13 +727,19 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
132
727
|
init_env_shim();
|
|
133
728
|
function assertByteArrayIsNotEmptyForCodec(codecDescription, bytes, offset = 0) {
|
|
134
729
|
if (bytes.length - offset <= 0) {
|
|
135
|
-
throw new
|
|
730
|
+
throw new SolanaError(SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY, {
|
|
731
|
+
codecDescription
|
|
732
|
+
});
|
|
136
733
|
}
|
|
137
734
|
}
|
|
138
735
|
function assertByteArrayHasEnoughBytesForCodec(codecDescription, expected, bytes, offset = 0) {
|
|
139
736
|
const bytesLength = bytes.length - offset;
|
|
140
737
|
if (bytesLength < expected) {
|
|
141
|
-
throw new
|
|
738
|
+
throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH, {
|
|
739
|
+
bytesLength,
|
|
740
|
+
codecDescription,
|
|
741
|
+
expected
|
|
742
|
+
});
|
|
142
743
|
}
|
|
143
744
|
}
|
|
144
745
|
var mergeBytes = (byteArrays) => {
|
|
@@ -199,32 +800,34 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
199
800
|
function isFixedSize(codec) {
|
|
200
801
|
return "fixedSize" in codec && typeof codec.fixedSize === "number";
|
|
201
802
|
}
|
|
202
|
-
function assertIsFixedSize(codec
|
|
803
|
+
function assertIsFixedSize(codec) {
|
|
203
804
|
if (!isFixedSize(codec)) {
|
|
204
|
-
throw new
|
|
805
|
+
throw new SolanaError(SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH);
|
|
205
806
|
}
|
|
206
807
|
}
|
|
207
808
|
function isVariableSize(codec) {
|
|
208
809
|
return !isFixedSize(codec);
|
|
209
810
|
}
|
|
210
|
-
function assertIsVariableSize(codec
|
|
811
|
+
function assertIsVariableSize(codec) {
|
|
211
812
|
if (!isVariableSize(codec)) {
|
|
212
|
-
throw new
|
|
813
|
+
throw new SolanaError(SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH);
|
|
213
814
|
}
|
|
214
815
|
}
|
|
215
816
|
function combineCodec(encoder, decoder) {
|
|
216
817
|
if (isFixedSize(encoder) !== isFixedSize(decoder)) {
|
|
217
|
-
throw new
|
|
818
|
+
throw new SolanaError(SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH);
|
|
218
819
|
}
|
|
219
820
|
if (isFixedSize(encoder) && isFixedSize(decoder) && encoder.fixedSize !== decoder.fixedSize) {
|
|
220
|
-
throw new
|
|
221
|
-
|
|
222
|
-
|
|
821
|
+
throw new SolanaError(SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH, {
|
|
822
|
+
decoderFixedSize: decoder.fixedSize,
|
|
823
|
+
encoderFixedSize: encoder.fixedSize
|
|
824
|
+
});
|
|
223
825
|
}
|
|
224
826
|
if (!isFixedSize(encoder) && !isFixedSize(decoder) && encoder.maxSize !== decoder.maxSize) {
|
|
225
|
-
throw new
|
|
226
|
-
|
|
227
|
-
|
|
827
|
+
throw new SolanaError(SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH, {
|
|
828
|
+
decoderMaxSize: decoder.maxSize,
|
|
829
|
+
encoderMaxSize: encoder.maxSize
|
|
830
|
+
});
|
|
228
831
|
}
|
|
229
832
|
return {
|
|
230
833
|
...decoder,
|
|
@@ -287,7 +890,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
287
890
|
});
|
|
288
891
|
}
|
|
289
892
|
function reverseEncoder(encoder) {
|
|
290
|
-
assertIsFixedSize(encoder
|
|
893
|
+
assertIsFixedSize(encoder);
|
|
291
894
|
return createEncoder({
|
|
292
895
|
...encoder,
|
|
293
896
|
write: (value, bytes, offset) => {
|
|
@@ -299,7 +902,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
299
902
|
});
|
|
300
903
|
}
|
|
301
904
|
function reverseDecoder(decoder) {
|
|
302
|
-
assertIsFixedSize(decoder
|
|
905
|
+
assertIsFixedSize(decoder);
|
|
303
906
|
return createDecoder({
|
|
304
907
|
...decoder,
|
|
305
908
|
read: (bytes, offset) => {
|
|
@@ -321,9 +924,12 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
321
924
|
init_env_shim();
|
|
322
925
|
function assertNumberIsBetweenForCodec(codecDescription, min, max, value) {
|
|
323
926
|
if (value < min || value > max) {
|
|
324
|
-
throw new
|
|
325
|
-
|
|
326
|
-
|
|
927
|
+
throw new SolanaError(SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE, {
|
|
928
|
+
codecDescription,
|
|
929
|
+
max,
|
|
930
|
+
min,
|
|
931
|
+
value
|
|
932
|
+
});
|
|
327
933
|
}
|
|
328
934
|
}
|
|
329
935
|
var Endian = /* @__PURE__ */ ((Endian2) => {
|
|
@@ -518,7 +1124,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
518
1124
|
var getU128Encoder = (config = {}) => numberEncoderFactory({
|
|
519
1125
|
config,
|
|
520
1126
|
name: "u128",
|
|
521
|
-
range: [
|
|
1127
|
+
range: [0n, BigInt("0xffffffffffffffffffffffffffffffff")],
|
|
522
1128
|
set: (view, value, le) => {
|
|
523
1129
|
const leftOffset = le ? 8 : 0;
|
|
524
1130
|
const rightOffset = le ? 0 : 8;
|
|
@@ -572,7 +1178,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
572
1178
|
var getU64Encoder = (config = {}) => numberEncoderFactory({
|
|
573
1179
|
config,
|
|
574
1180
|
name: "u64",
|
|
575
|
-
range: [
|
|
1181
|
+
range: [0n, BigInt("0xffffffffffffffff")],
|
|
576
1182
|
set: (view, value, le) => view.setBigUint64(0, BigInt(value), le),
|
|
577
1183
|
size: 8
|
|
578
1184
|
});
|
|
@@ -599,7 +1205,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
599
1205
|
// ../codecs-strings/dist/index.browser.js
|
|
600
1206
|
function assertValidBaseString(alphabet4, testValue, givenValue = testValue) {
|
|
601
1207
|
if (!testValue.match(new RegExp(`^[${alphabet4}]*$`))) {
|
|
602
|
-
throw new
|
|
1208
|
+
throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE, {
|
|
1209
|
+
alphabet: alphabet4,
|
|
1210
|
+
base: alphabet4.length,
|
|
1211
|
+
value: givenValue
|
|
1212
|
+
});
|
|
603
1213
|
}
|
|
604
1214
|
}
|
|
605
1215
|
var getBaseXEncoder = (alphabet4) => {
|
|
@@ -738,6 +1348,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
738
1348
|
}
|
|
739
1349
|
return output;
|
|
740
1350
|
}
|
|
1351
|
+
var alphabet3 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
741
1352
|
var getBase64Encoder = () => {
|
|
742
1353
|
{
|
|
743
1354
|
return createEncoder({
|
|
@@ -745,7 +1356,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
745
1356
|
try {
|
|
746
1357
|
return atob(value).length;
|
|
747
1358
|
} catch (e22) {
|
|
748
|
-
throw new
|
|
1359
|
+
throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE, {
|
|
1360
|
+
alphabet: alphabet3,
|
|
1361
|
+
base: 64,
|
|
1362
|
+
value
|
|
1363
|
+
});
|
|
749
1364
|
}
|
|
750
1365
|
},
|
|
751
1366
|
write(value, bytes, offset) {
|
|
@@ -754,7 +1369,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
754
1369
|
bytes.set(bytesToAdd, offset);
|
|
755
1370
|
return bytesToAdd.length + offset;
|
|
756
1371
|
} catch (e22) {
|
|
757
|
-
throw new
|
|
1372
|
+
throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE, {
|
|
1373
|
+
alphabet: alphabet3,
|
|
1374
|
+
base: 64,
|
|
1375
|
+
value
|
|
1376
|
+
});
|
|
758
1377
|
}
|
|
759
1378
|
}
|
|
760
1379
|
});
|
|
@@ -858,10 +1477,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
858
1477
|
return encodedAccount;
|
|
859
1478
|
}
|
|
860
1479
|
return Object.freeze({ ...encodedAccount, data: decoder.decode(encodedAccount.data) });
|
|
861
|
-
} catch (
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
1480
|
+
} catch (e3) {
|
|
1481
|
+
throw new SolanaError(SOLANA_ERROR__ACCOUNTS__FAILED_TO_DECODE_ACCOUNT, {
|
|
1482
|
+
address: encodedAccount.address
|
|
1483
|
+
});
|
|
865
1484
|
}
|
|
866
1485
|
}
|
|
867
1486
|
function accountExists(account) {
|
|
@@ -869,14 +1488,18 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
869
1488
|
}
|
|
870
1489
|
function assertAccountDecoded(account) {
|
|
871
1490
|
if (accountExists(account) && account.data instanceof Uint8Array) {
|
|
872
|
-
throw new
|
|
1491
|
+
throw new SolanaError(SOLANA_ERROR__ACCOUNTS__EXPECTED_DECODED_ACCOUNT, {
|
|
1492
|
+
address: account.address
|
|
1493
|
+
});
|
|
873
1494
|
}
|
|
874
1495
|
}
|
|
875
1496
|
function assertAccountsDecoded(accounts) {
|
|
876
1497
|
const encoded = accounts.filter((a) => accountExists(a) && a.data instanceof Uint8Array);
|
|
877
1498
|
if (encoded.length > 0) {
|
|
878
|
-
const encodedAddresses = encoded.map((a) => a.address)
|
|
879
|
-
throw new
|
|
1499
|
+
const encodedAddresses = encoded.map((a) => a.address);
|
|
1500
|
+
throw new SolanaError(SOLANA_ERROR__ACCOUNTS__EXPECTED_ALL_ACCOUNTS_TO_BE_DECODED, {
|
|
1501
|
+
addresses: encodedAddresses
|
|
1502
|
+
});
|
|
880
1503
|
}
|
|
881
1504
|
}
|
|
882
1505
|
function parseBase64RpcAccount(address2, rpcAccount) {
|
|
@@ -928,14 +1551,14 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
928
1551
|
}
|
|
929
1552
|
function assertAccountExists(account) {
|
|
930
1553
|
if (!account.exists) {
|
|
931
|
-
throw new
|
|
1554
|
+
throw new SolanaError(SOLANA_ERROR__ACCOUNTS__ACCOUNT_NOT_FOUND, { address: account.address });
|
|
932
1555
|
}
|
|
933
1556
|
}
|
|
934
1557
|
function assertAccountsExist(accounts) {
|
|
935
1558
|
const missingAccounts = accounts.filter((a) => !a.exists);
|
|
936
1559
|
if (missingAccounts.length > 0) {
|
|
937
1560
|
const missingAddresses = missingAccounts.map((a) => a.address);
|
|
938
|
-
throw new
|
|
1561
|
+
throw new SolanaError(SOLANA_ERROR__ACCOUNTS__ONE_OR_MORE_ACCOUNTS_NOT_FOUND, { addresses: missingAddresses });
|
|
939
1562
|
}
|
|
940
1563
|
}
|
|
941
1564
|
|
|
@@ -946,9 +1569,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
946
1569
|
init_env_shim();
|
|
947
1570
|
function assertIsSecureContext() {
|
|
948
1571
|
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
|
-
);
|
|
1572
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO__DISALLOWED_IN_INSECURE_CONTEXT);
|
|
952
1573
|
}
|
|
953
1574
|
}
|
|
954
1575
|
var cachedEd25519Decision;
|
|
@@ -977,40 +1598,38 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
977
1598
|
var _a;
|
|
978
1599
|
assertIsSecureContext();
|
|
979
1600
|
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.digest) !== "function") {
|
|
980
|
-
throw new
|
|
1601
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO__DIGEST_UNIMPLEMENTED);
|
|
981
1602
|
}
|
|
982
1603
|
}
|
|
983
1604
|
async function assertKeyGenerationIsAvailable() {
|
|
984
1605
|
var _a;
|
|
985
1606
|
assertIsSecureContext();
|
|
986
1607
|
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.generateKey) !== "function") {
|
|
987
|
-
throw new
|
|
1608
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO__GENERATE_FUNCTION_UNIMPLEMENTED);
|
|
988
1609
|
}
|
|
989
1610
|
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
|
-
);
|
|
1611
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO__ED25519_ALGORITHM_UNIMPLEMENTED);
|
|
993
1612
|
}
|
|
994
1613
|
}
|
|
995
1614
|
async function assertKeyExporterIsAvailable() {
|
|
996
1615
|
var _a;
|
|
997
1616
|
assertIsSecureContext();
|
|
998
1617
|
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.exportKey) !== "function") {
|
|
999
|
-
throw new
|
|
1618
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO__EXPORT_FUNCTION_UNIMPLEMENTED);
|
|
1000
1619
|
}
|
|
1001
1620
|
}
|
|
1002
1621
|
async function assertSigningCapabilityIsAvailable() {
|
|
1003
1622
|
var _a;
|
|
1004
1623
|
assertIsSecureContext();
|
|
1005
1624
|
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.sign) !== "function") {
|
|
1006
|
-
throw new
|
|
1625
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO__SIGN_FUNCTION_UNIMPLEMENTED);
|
|
1007
1626
|
}
|
|
1008
1627
|
}
|
|
1009
1628
|
async function assertVerificationCapabilityIsAvailable() {
|
|
1010
1629
|
var _a;
|
|
1011
1630
|
assertIsSecureContext();
|
|
1012
1631
|
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.verify) !== "function") {
|
|
1013
|
-
throw new
|
|
1632
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO__VERIFY_FUNCTION_UNIMPLEMENTED);
|
|
1014
1633
|
}
|
|
1015
1634
|
}
|
|
1016
1635
|
|
|
@@ -1044,23 +1663,21 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1044
1663
|
return true;
|
|
1045
1664
|
}
|
|
1046
1665
|
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
|
|
1666
|
+
if (
|
|
1667
|
+
// Lowest address (32 bytes of zeroes)
|
|
1668
|
+
putativeAddress.length < 32 || // Highest address (32 bytes of 255)
|
|
1669
|
+
putativeAddress.length > 44
|
|
1670
|
+
) {
|
|
1671
|
+
throw new SolanaError(SOLANA_ERROR__ADDRESSES__STRING_LENGTH_OUT_OF_RANGE, {
|
|
1672
|
+
actualLength: putativeAddress.length
|
|
1673
|
+
});
|
|
1674
|
+
}
|
|
1675
|
+
const base58Encoder4 = getMemoizedBase58Encoder();
|
|
1676
|
+
const bytes = base58Encoder4.encode(putativeAddress);
|
|
1677
|
+
const numBytes = bytes.byteLength;
|
|
1678
|
+
if (numBytes !== 32) {
|
|
1679
|
+
throw new SolanaError(SOLANA_ERROR__ADDRESSES__INVALID_BYTE_LENGTH, {
|
|
1680
|
+
actualLength: numBytes
|
|
1064
1681
|
});
|
|
1065
1682
|
}
|
|
1066
1683
|
}
|
|
@@ -1182,12 +1799,12 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1182
1799
|
function assertIsProgramDerivedAddress(value) {
|
|
1183
1800
|
const validFormat = Array.isArray(value) && value.length === 2 && typeof value[0] === "string" && typeof value[1] === "number";
|
|
1184
1801
|
if (!validFormat) {
|
|
1185
|
-
throw new
|
|
1186
|
-
`Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].`
|
|
1187
|
-
);
|
|
1802
|
+
throw new SolanaError(SOLANA_ERROR__ADDRESSES__MALFORMED_PDA);
|
|
1188
1803
|
}
|
|
1189
1804
|
if (value[1] < 0 || value[1] > 255) {
|
|
1190
|
-
throw new
|
|
1805
|
+
throw new SolanaError(SOLANA_ERROR__ADDRESSES__PDA_BUMP_SEED_OUT_OF_RANGE, {
|
|
1806
|
+
bump: value[1]
|
|
1807
|
+
});
|
|
1191
1808
|
}
|
|
1192
1809
|
assertIsAddress(value[0]);
|
|
1193
1810
|
}
|
|
@@ -1217,18 +1834,23 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1217
1834
|
115,
|
|
1218
1835
|
115
|
|
1219
1836
|
];
|
|
1220
|
-
var PointOnCurveError = class extends Error {
|
|
1221
|
-
};
|
|
1222
1837
|
async function createProgramDerivedAddress({ programAddress, seeds }) {
|
|
1223
1838
|
await assertDigestCapabilityIsAvailable();
|
|
1224
1839
|
if (seeds.length > MAX_SEEDS) {
|
|
1225
|
-
throw new
|
|
1840
|
+
throw new SolanaError(SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED, {
|
|
1841
|
+
actual: seeds.length,
|
|
1842
|
+
maxSeeds: MAX_SEEDS
|
|
1843
|
+
});
|
|
1226
1844
|
}
|
|
1227
1845
|
let textEncoder;
|
|
1228
1846
|
const seedBytes = seeds.reduce((acc, seed, ii) => {
|
|
1229
1847
|
const bytes = typeof seed === "string" ? (textEncoder || (textEncoder = new TextEncoder())).encode(seed) : seed;
|
|
1230
1848
|
if (bytes.byteLength > MAX_SEED_LENGTH) {
|
|
1231
|
-
throw new
|
|
1849
|
+
throw new SolanaError(SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED, {
|
|
1850
|
+
actual: bytes.byteLength,
|
|
1851
|
+
index: ii,
|
|
1852
|
+
maxSeedLength: MAX_SEED_LENGTH
|
|
1853
|
+
});
|
|
1232
1854
|
}
|
|
1233
1855
|
acc.push(...bytes);
|
|
1234
1856
|
return acc;
|
|
@@ -1241,7 +1863,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1241
1863
|
);
|
|
1242
1864
|
const addressBytes = new Uint8Array(addressBytesBuffer);
|
|
1243
1865
|
if (await compressedPointBytesAreOnCurve(addressBytes)) {
|
|
1244
|
-
throw new
|
|
1866
|
+
throw new SolanaError(SOLANA_ERROR__ADDRESSES__INVALID_SEEDS_POINT_ON_CURVE);
|
|
1245
1867
|
}
|
|
1246
1868
|
return base58EncodedAddressCodec.decode(addressBytes);
|
|
1247
1869
|
}
|
|
@@ -1257,25 +1879,29 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1257
1879
|
seeds: [...seeds, new Uint8Array([bumpSeed])]
|
|
1258
1880
|
});
|
|
1259
1881
|
return [address2, bumpSeed];
|
|
1260
|
-
} catch (
|
|
1261
|
-
if (
|
|
1882
|
+
} catch (e3) {
|
|
1883
|
+
if (isSolanaError(e3, SOLANA_ERROR__ADDRESSES__INVALID_SEEDS_POINT_ON_CURVE)) {
|
|
1262
1884
|
bumpSeed--;
|
|
1263
1885
|
} else {
|
|
1264
|
-
throw
|
|
1886
|
+
throw e3;
|
|
1265
1887
|
}
|
|
1266
1888
|
}
|
|
1267
1889
|
}
|
|
1268
|
-
throw new
|
|
1890
|
+
throw new SolanaError(SOLANA_ERROR__ADDRESSES__FAILED_TO_FIND_VIABLE_PDA_BUMP_SEED);
|
|
1269
1891
|
}
|
|
1270
1892
|
async function createAddressWithSeed({ baseAddress, programAddress, seed }) {
|
|
1271
1893
|
const { encode, decode } = getAddressCodec();
|
|
1272
1894
|
const seedBytes = typeof seed === "string" ? new TextEncoder().encode(seed) : seed;
|
|
1273
1895
|
if (seedBytes.byteLength > MAX_SEED_LENGTH) {
|
|
1274
|
-
throw new
|
|
1896
|
+
throw new SolanaError(SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED, {
|
|
1897
|
+
actual: seedBytes.byteLength,
|
|
1898
|
+
index: 0,
|
|
1899
|
+
maxSeedLength: MAX_SEED_LENGTH
|
|
1900
|
+
});
|
|
1275
1901
|
}
|
|
1276
1902
|
const programAddressBytes = encode(programAddress);
|
|
1277
1903
|
if (programAddressBytes.length >= PDA_MARKER_BYTES.length && programAddressBytes.slice(-PDA_MARKER_BYTES.length).every((byte, index) => byte === PDA_MARKER_BYTES[index])) {
|
|
1278
|
-
throw new
|
|
1904
|
+
throw new SolanaError(SOLANA_ERROR__ADDRESSES__PDA_ENDS_WITH_PDA_MARKER);
|
|
1279
1905
|
}
|
|
1280
1906
|
const addressBytesBuffer = await crypto.subtle.digest(
|
|
1281
1907
|
"SHA-256",
|
|
@@ -1287,7 +1913,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1287
1913
|
async function getAddressFromPublicKey(publicKey) {
|
|
1288
1914
|
await assertKeyExporterIsAvailable();
|
|
1289
1915
|
if (publicKey.type !== "public" || publicKey.algorithm.name !== "Ed25519") {
|
|
1290
|
-
throw new
|
|
1916
|
+
throw new SolanaError(SOLANA_ERROR__ADDRESSES__INVALID_ED25519_PUBLIC_KEY);
|
|
1291
1917
|
}
|
|
1292
1918
|
const publicKeyBytes = await crypto.subtle.exportKey("raw", publicKey);
|
|
1293
1919
|
return getAddressDecoder().decode(new Uint8Array(publicKeyBytes));
|
|
@@ -1297,7 +1923,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1297
1923
|
init_env_shim();
|
|
1298
1924
|
function assertValidNumberOfItemsForCodec(codecDescription, expected, actual) {
|
|
1299
1925
|
if (expected !== actual) {
|
|
1300
|
-
throw new
|
|
1926
|
+
throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS, {
|
|
1927
|
+
actual,
|
|
1928
|
+
codecDescription,
|
|
1929
|
+
expected
|
|
1930
|
+
});
|
|
1301
1931
|
}
|
|
1302
1932
|
}
|
|
1303
1933
|
function maxCodecSizes(sizes) {
|
|
@@ -1443,13 +2073,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1443
2073
|
function getBooleanEncoder(config = {}) {
|
|
1444
2074
|
var _a;
|
|
1445
2075
|
const size = (_a = config.size) != null ? _a : getU8Encoder();
|
|
1446
|
-
assertIsFixedSize(size
|
|
2076
|
+
assertIsFixedSize(size);
|
|
1447
2077
|
return mapEncoder(size, (value) => value ? 1 : 0);
|
|
1448
2078
|
}
|
|
1449
2079
|
function getBooleanDecoder(config = {}) {
|
|
1450
2080
|
var _a;
|
|
1451
2081
|
const size = (_a = config.size) != null ? _a : getU8Decoder();
|
|
1452
|
-
assertIsFixedSize(size
|
|
2082
|
+
assertIsFixedSize(size);
|
|
1453
2083
|
return mapDecoder(size, (value) => Number(value) === 1);
|
|
1454
2084
|
}
|
|
1455
2085
|
function getBooleanCodec(config = {}) {
|
|
@@ -1545,9 +2175,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1545
2175
|
offset = dOffset;
|
|
1546
2176
|
const variantField = (_a2 = variants[Number(discriminator)]) != null ? _a2 : null;
|
|
1547
2177
|
if (!variantField) {
|
|
1548
|
-
throw new
|
|
1549
|
-
|
|
1550
|
-
|
|
2178
|
+
throw new SolanaError(SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE, {
|
|
2179
|
+
discriminator,
|
|
2180
|
+
maxRange: variants.length - 1,
|
|
2181
|
+
minRange: 0
|
|
2182
|
+
});
|
|
1551
2183
|
}
|
|
1552
2184
|
const [variant, vOffset] = variantField[1].read(bytes, offset);
|
|
1553
2185
|
offset = vOffset;
|
|
@@ -1582,9 +2214,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1582
2214
|
function getVariantDiscriminator(variants, variant) {
|
|
1583
2215
|
const discriminator = variants.findIndex(([key]) => variant.__kind === key);
|
|
1584
2216
|
if (discriminator < 0) {
|
|
1585
|
-
throw new
|
|
1586
|
-
|
|
1587
|
-
|
|
2217
|
+
throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_DATA_ENUM_VARIANT, {
|
|
2218
|
+
value: variant.__kind,
|
|
2219
|
+
variants: variants.map(([key]) => key)
|
|
2220
|
+
});
|
|
1588
2221
|
}
|
|
1589
2222
|
return discriminator;
|
|
1590
2223
|
}
|
|
@@ -1650,8 +2283,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1650
2283
|
const fixed = (_b = config.fixed) != null ? _b : false;
|
|
1651
2284
|
const isZeroSizeItem = isFixedSize(item) && isFixedSize(prefix) && item.fixedSize === 0;
|
|
1652
2285
|
if (fixed || isZeroSizeItem) {
|
|
1653
|
-
assertIsFixedSize(item
|
|
1654
|
-
assertIsFixedSize(prefix
|
|
2286
|
+
assertIsFixedSize(item);
|
|
2287
|
+
assertIsFixedSize(prefix);
|
|
1655
2288
|
const fixedSize = prefix.fixedSize + item.fixedSize;
|
|
1656
2289
|
return createEncoder({
|
|
1657
2290
|
fixedSize,
|
|
@@ -1683,8 +2316,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1683
2316
|
let fixedSize = null;
|
|
1684
2317
|
const isZeroSizeItem = isFixedSize(item) && isFixedSize(prefix) && item.fixedSize === 0;
|
|
1685
2318
|
if (fixed || isZeroSizeItem) {
|
|
1686
|
-
assertIsFixedSize(item
|
|
1687
|
-
assertIsFixedSize(prefix
|
|
2319
|
+
assertIsFixedSize(item);
|
|
2320
|
+
assertIsFixedSize(prefix);
|
|
1688
2321
|
fixedSize = prefix.fixedSize + item.fixedSize;
|
|
1689
2322
|
}
|
|
1690
2323
|
return createDecoder({
|
|
@@ -1714,9 +2347,12 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1714
2347
|
const isInvalidNumber = typeof value === "number" && (value < minRange || value > maxRange);
|
|
1715
2348
|
const isInvalidString = typeof value === "string" && !allStringInputs.includes(value);
|
|
1716
2349
|
if (isInvalidNumber || isInvalidString) {
|
|
1717
|
-
throw new
|
|
1718
|
-
|
|
1719
|
-
|
|
2350
|
+
throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_SCALAR_ENUM_VARIANT, {
|
|
2351
|
+
maxRange,
|
|
2352
|
+
minRange,
|
|
2353
|
+
value,
|
|
2354
|
+
variants: allStringInputs
|
|
2355
|
+
});
|
|
1720
2356
|
}
|
|
1721
2357
|
if (typeof value === "number")
|
|
1722
2358
|
return value;
|
|
@@ -1733,9 +2369,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1733
2369
|
return mapDecoder(prefix, (value) => {
|
|
1734
2370
|
const valueAsNumber = Number(value);
|
|
1735
2371
|
if (valueAsNumber < minRange || valueAsNumber > maxRange) {
|
|
1736
|
-
throw new
|
|
1737
|
-
|
|
1738
|
-
|
|
2372
|
+
throw new SolanaError(SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE, {
|
|
2373
|
+
discriminator: valueAsNumber,
|
|
2374
|
+
maxRange,
|
|
2375
|
+
minRange
|
|
2376
|
+
});
|
|
1739
2377
|
}
|
|
1740
2378
|
return constructor[enumKeys[valueAsNumber]];
|
|
1741
2379
|
});
|
|
@@ -1849,8 +2487,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1849
2487
|
const fixed = (_b = config.fixed) != null ? _b : false;
|
|
1850
2488
|
const isZeroSizeItem = isFixedSize(item) && isFixedSize(prefix) && item.fixedSize === 0;
|
|
1851
2489
|
if (fixed || isZeroSizeItem) {
|
|
1852
|
-
assertIsFixedSize(item
|
|
1853
|
-
assertIsFixedSize(prefix
|
|
2490
|
+
assertIsFixedSize(item);
|
|
2491
|
+
assertIsFixedSize(prefix);
|
|
1854
2492
|
const fixedSize = prefix.fixedSize + item.fixedSize;
|
|
1855
2493
|
return createEncoder({
|
|
1856
2494
|
fixedSize,
|
|
@@ -1887,8 +2525,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1887
2525
|
let fixedSize = null;
|
|
1888
2526
|
const isZeroSizeItem = isFixedSize(item) && isFixedSize(prefix) && item.fixedSize === 0;
|
|
1889
2527
|
if (fixed || isZeroSizeItem) {
|
|
1890
|
-
assertIsFixedSize(item
|
|
1891
|
-
assertIsFixedSize(prefix
|
|
2528
|
+
assertIsFixedSize(item);
|
|
2529
|
+
assertIsFixedSize(prefix);
|
|
1892
2530
|
fixedSize = prefix.fixedSize + item.fixedSize;
|
|
1893
2531
|
}
|
|
1894
2532
|
return createDecoder({
|
|
@@ -1943,6 +2581,40 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1943
2581
|
|
|
1944
2582
|
// ../instructions/dist/index.browser.js
|
|
1945
2583
|
init_env_shim();
|
|
2584
|
+
function isInstructionForProgram(instruction, programAddress) {
|
|
2585
|
+
return instruction.programAddress === programAddress;
|
|
2586
|
+
}
|
|
2587
|
+
function assertIsInstructionForProgram(instruction, programAddress) {
|
|
2588
|
+
if (instruction.programAddress !== programAddress) {
|
|
2589
|
+
throw new SolanaError(SOLANA_ERROR__INSTRUCTION__PROGRAM_ID_MISMATCH, {
|
|
2590
|
+
actualProgramAddress: instruction.programAddress,
|
|
2591
|
+
expectedProgramAddress: programAddress
|
|
2592
|
+
});
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
function isInstructionWithAccounts(instruction) {
|
|
2596
|
+
return instruction.accounts !== void 0;
|
|
2597
|
+
}
|
|
2598
|
+
function assertIsInstructionWithAccounts(instruction) {
|
|
2599
|
+
if (instruction.accounts === void 0) {
|
|
2600
|
+
throw new SolanaError(SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_ACCOUNTS, {
|
|
2601
|
+
data: instruction.data,
|
|
2602
|
+
programAddress: instruction.programAddress
|
|
2603
|
+
});
|
|
2604
|
+
}
|
|
2605
|
+
}
|
|
2606
|
+
function isInstructionWithData(instruction) {
|
|
2607
|
+
return instruction.data !== void 0;
|
|
2608
|
+
}
|
|
2609
|
+
function assertIsInstructionWithData(instruction) {
|
|
2610
|
+
var _a;
|
|
2611
|
+
if (instruction.data === void 0) {
|
|
2612
|
+
throw new SolanaError(SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_DATA, {
|
|
2613
|
+
accountAddresses: (_a = instruction.accounts) == null ? void 0 : _a.map((a) => a.address),
|
|
2614
|
+
programAddress: instruction.programAddress
|
|
2615
|
+
});
|
|
2616
|
+
}
|
|
2617
|
+
}
|
|
1946
2618
|
var AccountRole = /* @__PURE__ */ ((AccountRole22) => {
|
|
1947
2619
|
AccountRole22[AccountRole22["WRITABLE_SIGNER"] = /* 3 */
|
|
1948
2620
|
3] = "WRITABLE_SIGNER";
|
|
@@ -1980,52 +2652,6 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1980
2652
|
|
|
1981
2653
|
// ../keys/dist/index.browser.js
|
|
1982
2654
|
init_env_shim();
|
|
1983
|
-
|
|
1984
|
-
// ../errors/dist/index.browser.js
|
|
1985
|
-
init_env_shim();
|
|
1986
|
-
var SOLANA_ERROR__TRANSACTION_MISSING_SIGNATURES = 1;
|
|
1987
|
-
var SOLANA_ERROR__TRANSACTION_SIGNATURE_NOT_COMPUTABLE = 2;
|
|
1988
|
-
var SOLANA_ERROR__RPC_INTEGER_OVERFLOW = 3;
|
|
1989
|
-
var SOLANA_ERROR__INVALID_KEYPAIR_BYTES = 4;
|
|
1990
|
-
var SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED = 5;
|
|
1991
|
-
var SOLANA_ERROR__NONCE_INVALID = 6;
|
|
1992
|
-
var SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND = 7;
|
|
1993
|
-
var SolanaErrorMessages = {
|
|
1994
|
-
[SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED]: "The network has progressed past the last block for which this transaction could have been committed.",
|
|
1995
|
-
[SOLANA_ERROR__INVALID_KEYPAIR_BYTES]: "Key pair bytes must be of length 64, got $byteLength.",
|
|
1996
|
-
[SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND]: "No nonce account could be found at address `$nonceAccountAddress`",
|
|
1997
|
-
[SOLANA_ERROR__NONCE_INVALID]: "The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",
|
|
1998
|
-
[SOLANA_ERROR__RPC_INTEGER_OVERFLOW]: "The $argumentLabel argument to the `$methodName` RPC method$optionalPathLabel was `$value`. This number is unsafe for use with the Solana JSON-RPC because it exceeds `Number.MAX_SAFE_INTEGER`.",
|
|
1999
|
-
[SOLANA_ERROR__TRANSACTION_MISSING_SIGNATURES]: "Transaction is missing signatures for addresses: $addresses.",
|
|
2000
|
-
[SOLANA_ERROR__TRANSACTION_SIGNATURE_NOT_COMPUTABLE]: "Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer."
|
|
2001
|
-
};
|
|
2002
|
-
function getHumanReadableErrorMessage(code, context = {}) {
|
|
2003
|
-
const messageFormatString = SolanaErrorMessages[code];
|
|
2004
|
-
const message = messageFormatString.replace(
|
|
2005
|
-
new RegExp("(?<!\\\\)\\$(\\w+)", "g"),
|
|
2006
|
-
(substring, variableName) => variableName in context ? `${context[variableName]}` : substring
|
|
2007
|
-
);
|
|
2008
|
-
return message;
|
|
2009
|
-
}
|
|
2010
|
-
function getErrorMessage(code, context = {}) {
|
|
2011
|
-
{
|
|
2012
|
-
return getHumanReadableErrorMessage(code, context);
|
|
2013
|
-
}
|
|
2014
|
-
}
|
|
2015
|
-
var SolanaError = class extends Error {
|
|
2016
|
-
constructor(...[code, context]) {
|
|
2017
|
-
const message = getErrorMessage(code, context);
|
|
2018
|
-
super(message);
|
|
2019
|
-
__publicField(this, "context");
|
|
2020
|
-
this.context = {
|
|
2021
|
-
__code: code,
|
|
2022
|
-
...context
|
|
2023
|
-
};
|
|
2024
|
-
this.name = "SolanaError";
|
|
2025
|
-
}
|
|
2026
|
-
};
|
|
2027
|
-
|
|
2028
|
-
// ../keys/dist/index.browser.js
|
|
2029
2655
|
function addPkcs8Header(bytes) {
|
|
2030
2656
|
return new Uint8Array([
|
|
2031
2657
|
/**
|
|
@@ -2073,8 +2699,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2073
2699
|
]);
|
|
2074
2700
|
}
|
|
2075
2701
|
async function createPrivateKeyFromBytes(bytes, extractable) {
|
|
2076
|
-
|
|
2077
|
-
|
|
2702
|
+
const actualLength = bytes.byteLength;
|
|
2703
|
+
if (actualLength !== 32) {
|
|
2704
|
+
throw new SolanaError(SOLANA_ERROR__KEYS__INVALID_PRIVATE_KEY_BYTE_LENGTH, {
|
|
2705
|
+
actualLength
|
|
2706
|
+
});
|
|
2078
2707
|
}
|
|
2079
2708
|
const privateKeyBytesPkcs8 = addPkcs8Header(bytes);
|
|
2080
2709
|
return await crypto.subtle.importKey("pkcs8", privateKeyBytesPkcs8, "Ed25519", extractable != null ? extractable : false, ["sign"]);
|
|
@@ -2095,7 +2724,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2095
2724
|
}
|
|
2096
2725
|
async function createKeyPairFromBytes(bytes, extractable) {
|
|
2097
2726
|
if (bytes.byteLength !== 64) {
|
|
2098
|
-
throw new SolanaError(
|
|
2727
|
+
throw new SolanaError(SOLANA_ERROR__KEYS__INVALID_KEY_PAIR_BYTE_LENGTH, { byteLength: bytes.byteLength });
|
|
2099
2728
|
}
|
|
2100
2729
|
const [publicKey, privateKey] = await Promise.all([
|
|
2101
2730
|
crypto.subtle.importKey(
|
|
@@ -2114,22 +2743,20 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2114
2743
|
function assertIsSignature(putativeSignature) {
|
|
2115
2744
|
if (!base58Encoder)
|
|
2116
2745
|
base58Encoder = getBase58Encoder();
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
}
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
throw new Error(`\`${putativeSignature}\` is not a signature`, {
|
|
2132
|
-
cause: e4
|
|
2746
|
+
if (
|
|
2747
|
+
// Lowest value (64 bytes of zeroes)
|
|
2748
|
+
putativeSignature.length < 64 || // Highest value (64 bytes of 255)
|
|
2749
|
+
putativeSignature.length > 88
|
|
2750
|
+
) {
|
|
2751
|
+
throw new SolanaError(SOLANA_ERROR__KEYS__SIGNATURE_STRING_LENGTH_OUT_OF_RANGE, {
|
|
2752
|
+
actualLength: putativeSignature.length
|
|
2753
|
+
});
|
|
2754
|
+
}
|
|
2755
|
+
const bytes = base58Encoder.encode(putativeSignature);
|
|
2756
|
+
const numBytes = bytes.byteLength;
|
|
2757
|
+
if (numBytes !== 64) {
|
|
2758
|
+
throw new SolanaError(SOLANA_ERROR__KEYS__INVALID_SIGNATURE_BYTE_LENGTH, {
|
|
2759
|
+
actualLength: numBytes
|
|
2133
2760
|
});
|
|
2134
2761
|
}
|
|
2135
2762
|
}
|
|
@@ -2724,18 +3351,6 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2724
3351
|
|
|
2725
3352
|
// ../rpc-transport-http/dist/index.browser.js
|
|
2726
3353
|
init_env_shim();
|
|
2727
|
-
var e2 = globalThis.fetch;
|
|
2728
|
-
var SolanaHttpError = class extends Error {
|
|
2729
|
-
constructor(details) {
|
|
2730
|
-
super(`HTTP error (${details.statusCode}): ${details.message}`);
|
|
2731
|
-
__publicField(this, "statusCode");
|
|
2732
|
-
Error.captureStackTrace(this, this.constructor);
|
|
2733
|
-
this.statusCode = details.statusCode;
|
|
2734
|
-
}
|
|
2735
|
-
get name() {
|
|
2736
|
-
return "SolanaHttpError";
|
|
2737
|
-
}
|
|
2738
|
-
};
|
|
2739
3354
|
var DISALLOWED_HEADERS = {
|
|
2740
3355
|
accept: true,
|
|
2741
3356
|
"content-length": true,
|
|
@@ -2772,9 +3387,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2772
3387
|
return DISALLOWED_HEADERS[headerName.toLowerCase()] === true || FORBIDDEN_HEADERS[headerName.toLowerCase()] === true || lowercaseHeaderName.startsWith("proxy-") || lowercaseHeaderName.startsWith("sec-");
|
|
2773
3388
|
});
|
|
2774
3389
|
if (badHeaders.length > 0) {
|
|
2775
|
-
throw new
|
|
2776
|
-
|
|
2777
|
-
);
|
|
3390
|
+
throw new SolanaError(SOLANA_ERROR__RPC__TRANSPORT_HTTP_HEADER_FORBIDDEN, {
|
|
3391
|
+
headers: badHeaders
|
|
3392
|
+
});
|
|
2778
3393
|
}
|
|
2779
3394
|
}
|
|
2780
3395
|
function normalizeHeaders(headers) {
|
|
@@ -2822,9 +3437,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2822
3437
|
method: "POST",
|
|
2823
3438
|
signal
|
|
2824
3439
|
};
|
|
2825
|
-
const response = await
|
|
3440
|
+
const response = await fetch(url, requestInfo);
|
|
2826
3441
|
if (!response.ok) {
|
|
2827
|
-
throw new
|
|
3442
|
+
throw new SolanaError(SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR, {
|
|
2828
3443
|
message: response.statusText,
|
|
2829
3444
|
statusCode: response.status
|
|
2830
3445
|
});
|
|
@@ -2854,7 +3469,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2854
3469
|
argumentLabel = `\`${keyPath[0].toString()}\``;
|
|
2855
3470
|
}
|
|
2856
3471
|
const path = keyPath.length > 1 ? keyPath.slice(1).map((pathPart) => typeof pathPart === "number" ? `[${pathPart}]` : pathPart).join(".") : void 0;
|
|
2857
|
-
const error = new SolanaError(
|
|
3472
|
+
const error = new SolanaError(SOLANA_ERROR__RPC__INTEGER_OVERFLOW, {
|
|
2858
3473
|
argumentLabel,
|
|
2859
3474
|
keyPath,
|
|
2860
3475
|
methodName,
|
|
@@ -2873,10 +3488,6 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2873
3488
|
throw createSolanaJsonRpcIntegerOverflowError(methodName, keyPath, value);
|
|
2874
3489
|
}
|
|
2875
3490
|
};
|
|
2876
|
-
function createSolanaRpc(config) {
|
|
2877
|
-
const api = createSolanaRpcApi(DEFAULT_RPC_CONFIG);
|
|
2878
|
-
return createRpc({ ...config, api });
|
|
2879
|
-
}
|
|
2880
3491
|
var EXPLICIT_ABORT_TOKEN = Symbol(
|
|
2881
3492
|
"This symbol is thrown from the request that underlies a series of coalesced requests when the last request in that series aborts"
|
|
2882
3493
|
);
|
|
@@ -2902,11 +3513,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2902
3513
|
...config,
|
|
2903
3514
|
signal: abortController.signal
|
|
2904
3515
|
});
|
|
2905
|
-
} catch (
|
|
2906
|
-
if (
|
|
3516
|
+
} catch (e3) {
|
|
3517
|
+
if (e3 === EXPLICIT_ABORT_TOKEN) {
|
|
2907
3518
|
return;
|
|
2908
3519
|
}
|
|
2909
|
-
throw
|
|
3520
|
+
throw e3;
|
|
2910
3521
|
}
|
|
2911
3522
|
})();
|
|
2912
3523
|
coalescedRequestsByDeduplicationKey[deduplicationKey] = {
|
|
@@ -2920,14 +3531,14 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2920
3531
|
if (signal) {
|
|
2921
3532
|
const responsePromise = coalescedRequest.responsePromise;
|
|
2922
3533
|
return await new Promise((resolve, reject) => {
|
|
2923
|
-
const handleAbort = (
|
|
3534
|
+
const handleAbort = (e3) => {
|
|
2924
3535
|
signal.removeEventListener("abort", handleAbort);
|
|
2925
3536
|
coalescedRequest.numConsumers -= 1;
|
|
2926
3537
|
if (coalescedRequest.numConsumers === 0) {
|
|
2927
3538
|
const abortController = coalescedRequest.abortController;
|
|
2928
3539
|
abortController.abort(EXPLICIT_ABORT_TOKEN);
|
|
2929
3540
|
}
|
|
2930
|
-
reject(
|
|
3541
|
+
reject(e3.target.reason);
|
|
2931
3542
|
};
|
|
2932
3543
|
signal.addEventListener("abort", handleAbort);
|
|
2933
3544
|
responsePromise.then(resolve).finally(() => {
|
|
@@ -2971,6 +3582,15 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2971
3582
|
(transport) => getRpcTransportWithRequestCoalescing(transport, getSolanaRpcPayloadDeduplicationKey)
|
|
2972
3583
|
);
|
|
2973
3584
|
}
|
|
3585
|
+
function createSolanaRpc(clusterUrl, config) {
|
|
3586
|
+
return createSolanaRpcFromTransport(createDefaultRpcTransport({ url: clusterUrl, ...config }));
|
|
3587
|
+
}
|
|
3588
|
+
function createSolanaRpcFromTransport(transport) {
|
|
3589
|
+
return createRpc({
|
|
3590
|
+
api: createSolanaRpcApi(DEFAULT_RPC_CONFIG),
|
|
3591
|
+
transport
|
|
3592
|
+
});
|
|
3593
|
+
}
|
|
2974
3594
|
|
|
2975
3595
|
// ../rpc-subscriptions/dist/index.browser.js
|
|
2976
3596
|
init_env_shim();
|
|
@@ -2993,17 +3613,17 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2993
3613
|
},
|
|
2994
3614
|
get(target, p, receiver) {
|
|
2995
3615
|
return function(...rawParams) {
|
|
2996
|
-
const
|
|
2997
|
-
const createRpcSubscription = Reflect.get(target,
|
|
3616
|
+
const notificationName = p.toString();
|
|
3617
|
+
const createRpcSubscription = Reflect.get(target, notificationName, receiver);
|
|
2998
3618
|
if (p.toString().endsWith("Notifications") === false && !createRpcSubscription) {
|
|
2999
|
-
throw new
|
|
3000
|
-
|
|
3001
|
-
);
|
|
3619
|
+
throw new SolanaError(SOLANA_ERROR__RPC_SUBSCRIPTIONS__CANNOT_CREATE_SUBSCRIPTION_REQUEST, {
|
|
3620
|
+
notificationName
|
|
3621
|
+
});
|
|
3002
3622
|
}
|
|
3003
3623
|
const newRequest = createRpcSubscription ? createRpcSubscription(...rawParams) : {
|
|
3004
3624
|
params: rawParams,
|
|
3005
|
-
subscribeMethodName:
|
|
3006
|
-
unsubscribeMethodName:
|
|
3625
|
+
subscribeMethodName: notificationName.replace(/Notifications$/, "Subscribe"),
|
|
3626
|
+
unsubscribeMethodName: notificationName.replace(/Notifications$/, "Unsubscribe")
|
|
3007
3627
|
};
|
|
3008
3628
|
return createPendingRpcSubscription(rpcConfig, newRequest);
|
|
3009
3629
|
};
|
|
@@ -3058,7 +3678,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3058
3678
|
}
|
|
3059
3679
|
}
|
|
3060
3680
|
if (subscriptionId == null) {
|
|
3061
|
-
throw new
|
|
3681
|
+
throw new SolanaError(SOLANA_ERROR__RPC_SUBSCRIPTIONS__EXPECTED_SERVER_SUBSCRIPTION_ID);
|
|
3062
3682
|
}
|
|
3063
3683
|
return {
|
|
3064
3684
|
async *[Symbol.asyncIterator]() {
|
|
@@ -3298,7 +3918,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3298
3918
|
|
|
3299
3919
|
// ../rpc-subscriptions-transport-websocket/dist/index.browser.js
|
|
3300
3920
|
init_env_shim();
|
|
3301
|
-
var
|
|
3921
|
+
var e2 = globalThis.WebSocket;
|
|
3302
3922
|
var EXPLICIT_ABORT_TOKEN2 = Symbol(
|
|
3303
3923
|
"This symbol is thrown from a socket's iterator when the connection is explicitly aborted by the user"
|
|
3304
3924
|
);
|
|
@@ -3322,7 +3942,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3322
3942
|
}
|
|
3323
3943
|
function handleAbort() {
|
|
3324
3944
|
errorAndClearAllIteratorStates(EXPLICIT_ABORT_TOKEN2);
|
|
3325
|
-
if (webSocket.readyState !==
|
|
3945
|
+
if (webSocket.readyState !== e2.CLOSED && webSocket.readyState !== e2.CLOSING) {
|
|
3326
3946
|
webSocket.close(1e3);
|
|
3327
3947
|
}
|
|
3328
3948
|
}
|
|
@@ -3338,8 +3958,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3338
3958
|
function handleError(ev) {
|
|
3339
3959
|
if (!hasConnected) {
|
|
3340
3960
|
reject(
|
|
3341
|
-
|
|
3342
|
-
|
|
3961
|
+
new SolanaError(SOLANA_ERROR__RPC_SUBSCRIPTIONS__TRANSPORT_FAILED_TO_CONNECT, {
|
|
3962
|
+
errorEvent: ev
|
|
3963
|
+
})
|
|
3343
3964
|
);
|
|
3344
3965
|
}
|
|
3345
3966
|
}
|
|
@@ -3350,11 +3971,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3350
3971
|
resolve({
|
|
3351
3972
|
async send(payload) {
|
|
3352
3973
|
const message = JSON.stringify(payload);
|
|
3353
|
-
if (!bufferDrainWatcher && webSocket.readyState ===
|
|
3974
|
+
if (!bufferDrainWatcher && webSocket.readyState === e2.OPEN && webSocket.bufferedAmount > sendBufferHighWatermark) {
|
|
3354
3975
|
let onCancel;
|
|
3355
3976
|
const promise = new Promise((resolve2, reject2) => {
|
|
3356
3977
|
const intervalId = setInterval(() => {
|
|
3357
|
-
if (webSocket.readyState !==
|
|
3978
|
+
if (webSocket.readyState !== e2.OPEN || !(webSocket.bufferedAmount > sendBufferHighWatermark)) {
|
|
3358
3979
|
clearInterval(intervalId);
|
|
3359
3980
|
bufferDrainWatcher = void 0;
|
|
3360
3981
|
resolve2();
|
|
@@ -3364,8 +3985,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3364
3985
|
bufferDrainWatcher = void 0;
|
|
3365
3986
|
clearInterval(intervalId);
|
|
3366
3987
|
reject2(
|
|
3367
|
-
|
|
3368
|
-
|
|
3988
|
+
new SolanaError(
|
|
3989
|
+
SOLANA_ERROR__RPC_SUBSCRIPTIONS__TRANSPORT_CLOSED_BEFORE_MESSAGE_BUFFERED
|
|
3990
|
+
)
|
|
3369
3991
|
);
|
|
3370
3992
|
};
|
|
3371
3993
|
});
|
|
@@ -3388,11 +4010,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3388
4010
|
while (true) {
|
|
3389
4011
|
const state = iteratorState.get(iteratorKey);
|
|
3390
4012
|
if (!state) {
|
|
3391
|
-
throw new
|
|
4013
|
+
throw new SolanaError(
|
|
4014
|
+
SOLANA_ERROR__INVARIANT_VIOLATION__WEBSOCKET_MESSAGE_ITERATOR_STATE_MISSING
|
|
4015
|
+
);
|
|
3392
4016
|
}
|
|
3393
4017
|
if (state.__hasPolled) {
|
|
3394
|
-
throw new
|
|
3395
|
-
|
|
4018
|
+
throw new SolanaError(
|
|
4019
|
+
SOLANA_ERROR__INVARIANT_VIOLATION__WEBSOCKET_MESSAGE_ITERATOR_MUST_NOT_POLL_BEFORE_RESOLVING_EXISTING_MESSAGE_PROMISE
|
|
3396
4020
|
);
|
|
3397
4021
|
}
|
|
3398
4022
|
const queuedMessages = state.queuedMessages;
|
|
@@ -3412,7 +4036,12 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3412
4036
|
if (e22 === EXPLICIT_ABORT_TOKEN2) {
|
|
3413
4037
|
return;
|
|
3414
4038
|
} else {
|
|
3415
|
-
throw new
|
|
4039
|
+
throw new SolanaError(
|
|
4040
|
+
SOLANA_ERROR__RPC_SUBSCRIPTIONS__TRANSPORT_CONNECTION_CLOSED,
|
|
4041
|
+
{
|
|
4042
|
+
cause: e22
|
|
4043
|
+
}
|
|
4044
|
+
);
|
|
3416
4045
|
}
|
|
3417
4046
|
}
|
|
3418
4047
|
}
|
|
@@ -3435,7 +4064,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3435
4064
|
}
|
|
3436
4065
|
});
|
|
3437
4066
|
}
|
|
3438
|
-
const webSocket = new
|
|
4067
|
+
const webSocket = new e2(url);
|
|
3439
4068
|
webSocket.addEventListener("close", handleClose);
|
|
3440
4069
|
webSocket.addEventListener("error", handleError);
|
|
3441
4070
|
webSocket.addEventListener("open", handleOpen);
|
|
@@ -3483,7 +4112,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3483
4112
|
argumentLabel = `\`${keyPath[0].toString()}\``;
|
|
3484
4113
|
}
|
|
3485
4114
|
const path = keyPath.length > 1 ? keyPath.slice(1).map((pathPart) => typeof pathPart === "number" ? `[${pathPart}]` : pathPart).join(".") : void 0;
|
|
3486
|
-
const error = new SolanaError(
|
|
4115
|
+
const error = new SolanaError(SOLANA_ERROR__RPC__INTEGER_OVERFLOW, {
|
|
3487
4116
|
argumentLabel,
|
|
3488
4117
|
keyPath,
|
|
3489
4118
|
methodName,
|
|
@@ -3515,7 +4144,6 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3515
4144
|
}
|
|
3516
4145
|
function getCachedAbortableIterableFactory({
|
|
3517
4146
|
getAbortSignalFromInputArgs,
|
|
3518
|
-
getCacheEntryMissingError,
|
|
3519
4147
|
getCacheKeyFromInputArgs,
|
|
3520
4148
|
onCacheHit,
|
|
3521
4149
|
onCreateIterable
|
|
@@ -3524,7 +4152,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3524
4152
|
function getCacheEntryOrThrow(cacheKey) {
|
|
3525
4153
|
const currentCacheEntry = cache.get(cacheKey);
|
|
3526
4154
|
if (!currentCacheEntry) {
|
|
3527
|
-
throw
|
|
4155
|
+
throw new SolanaError(SOLANA_ERROR__INVARIANT_VIOLATION__CACHED_ABORTABLE_ITERABLE_CACHE_ENTRY_MISSING, {
|
|
4156
|
+
cacheKey: cacheKey.toString()
|
|
4157
|
+
});
|
|
3528
4158
|
}
|
|
3529
4159
|
return currentCacheEntry;
|
|
3530
4160
|
}
|
|
@@ -3576,9 +4206,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3576
4206
|
await onCacheHit(cachedIterable, ...args);
|
|
3577
4207
|
return cachedIterable;
|
|
3578
4208
|
}
|
|
3579
|
-
} catch (
|
|
4209
|
+
} catch (e3) {
|
|
3580
4210
|
cleanup();
|
|
3581
|
-
throw
|
|
4211
|
+
throw e3;
|
|
3582
4212
|
}
|
|
3583
4213
|
};
|
|
3584
4214
|
}
|
|
@@ -3623,11 +4253,6 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3623
4253
|
}
|
|
3624
4254
|
const iterableFactory = getCachedAbortableIterableFactory({
|
|
3625
4255
|
getAbortSignalFromInputArgs: ({ abortSignal }) => abortSignal,
|
|
3626
|
-
getCacheEntryMissingError(deduplicationKey2) {
|
|
3627
|
-
return new Error(
|
|
3628
|
-
`Found no cache entry for subscription with deduplication key \`${deduplicationKey2 == null ? void 0 : deduplicationKey2.toString()}\``
|
|
3629
|
-
);
|
|
3630
|
-
},
|
|
3631
4256
|
getCacheKeyFromInputArgs: () => deduplicationKey,
|
|
3632
4257
|
async onCacheHit(_iterable, _config) {
|
|
3633
4258
|
},
|
|
@@ -3668,12 +4293,12 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3668
4293
|
yield iteratorResult.value;
|
|
3669
4294
|
}
|
|
3670
4295
|
}
|
|
3671
|
-
} catch (
|
|
3672
|
-
if (
|
|
4296
|
+
} catch (e3) {
|
|
4297
|
+
if (e3 === EXPLICIT_ABORT_TOKEN3) {
|
|
3673
4298
|
return;
|
|
3674
4299
|
}
|
|
3675
4300
|
cache.delete(deduplicationKey);
|
|
3676
|
-
throw
|
|
4301
|
+
throw e3;
|
|
3677
4302
|
}
|
|
3678
4303
|
}
|
|
3679
4304
|
};
|
|
@@ -3685,24 +4310,6 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3685
4310
|
}
|
|
3686
4311
|
});
|
|
3687
4312
|
}
|
|
3688
|
-
function createSolanaRpcSubscriptions(config) {
|
|
3689
|
-
return pipe(
|
|
3690
|
-
createSubscriptionRpc({
|
|
3691
|
-
...config,
|
|
3692
|
-
api: createSolanaRpcSubscriptionsApi(DEFAULT_RPC_CONFIG2)
|
|
3693
|
-
}),
|
|
3694
|
-
(rpcSubscriptions) => getRpcSubscriptionsWithSubscriptionCoalescing({
|
|
3695
|
-
getDeduplicationKey: (...args) => (0, import_fast_stable_stringify2.default)(args),
|
|
3696
|
-
rpcSubscriptions
|
|
3697
|
-
})
|
|
3698
|
-
);
|
|
3699
|
-
}
|
|
3700
|
-
function createSolanaRpcSubscriptions_UNSTABLE(config) {
|
|
3701
|
-
return createSubscriptionRpc({
|
|
3702
|
-
...config,
|
|
3703
|
-
api: createSolanaRpcSubscriptionsApi_UNSTABLE(DEFAULT_RPC_CONFIG2)
|
|
3704
|
-
});
|
|
3705
|
-
}
|
|
3706
4313
|
var PING_PAYLOAD = {
|
|
3707
4314
|
jsonrpc: "2.0",
|
|
3708
4315
|
method: "ping"
|
|
@@ -3776,9 +4383,6 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3776
4383
|
}) {
|
|
3777
4384
|
return getCachedAbortableIterableFactory({
|
|
3778
4385
|
getAbortSignalFromInputArgs: ({ signal }) => signal,
|
|
3779
|
-
getCacheEntryMissingError(shardKey) {
|
|
3780
|
-
return new Error(`Found no cache entry for connection with shard key \`${shardKey == null ? void 0 : shardKey.toString()}\``);
|
|
3781
|
-
},
|
|
3782
4386
|
getCacheKeyFromInputArgs: ({ payload }) => getShard ? getShard(payload) : NULL_SHARD_CACHE_KEY,
|
|
3783
4387
|
onCacheHit: (connection, { payload }) => connection.send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(payload),
|
|
3784
4388
|
onCreateIterable: (abortSignal, config) => transport({
|
|
@@ -3808,6 +4412,31 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3808
4412
|
})
|
|
3809
4413
|
);
|
|
3810
4414
|
}
|
|
4415
|
+
function createSolanaRpcSubscriptions(clusterUrl, config) {
|
|
4416
|
+
const transport = createDefaultRpcSubscriptionsTransport({ url: clusterUrl, ...config });
|
|
4417
|
+
return createSolanaRpcSubscriptionsFromTransport(transport);
|
|
4418
|
+
}
|
|
4419
|
+
function createSolanaRpcSubscriptions_UNSTABLE(clusterUrl, config) {
|
|
4420
|
+
return createSolanaRpcSubscriptions(
|
|
4421
|
+
clusterUrl,
|
|
4422
|
+
config
|
|
4423
|
+
);
|
|
4424
|
+
}
|
|
4425
|
+
function createSolanaRpcSubscriptionsFromTransport(transport) {
|
|
4426
|
+
return pipe(
|
|
4427
|
+
createSubscriptionRpc({
|
|
4428
|
+
api: createSolanaRpcSubscriptionsApi(DEFAULT_RPC_CONFIG2),
|
|
4429
|
+
transport
|
|
4430
|
+
}),
|
|
4431
|
+
(rpcSubscriptions) => getRpcSubscriptionsWithSubscriptionCoalescing({
|
|
4432
|
+
getDeduplicationKey: (...args) => (0, import_fast_stable_stringify2.default)(args),
|
|
4433
|
+
rpcSubscriptions
|
|
4434
|
+
})
|
|
4435
|
+
);
|
|
4436
|
+
}
|
|
4437
|
+
function createSolanaRpcSubscriptionsFromTransport_UNSTABLE(transport) {
|
|
4438
|
+
return createSolanaRpcSubscriptionsFromTransport(transport);
|
|
4439
|
+
}
|
|
3811
4440
|
|
|
3812
4441
|
// ../rpc-types/dist/index.browser.js
|
|
3813
4442
|
init_env_shim();
|
|
@@ -3815,22 +4444,20 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3815
4444
|
function assertIsBlockhash(putativeBlockhash) {
|
|
3816
4445
|
if (!base58Encoder2)
|
|
3817
4446
|
base58Encoder2 = getBase58Encoder();
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
}
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
throw new Error(`\`${putativeBlockhash}\` is not a blockhash`, {
|
|
3833
|
-
cause: e4
|
|
4447
|
+
if (
|
|
4448
|
+
// Lowest value (32 bytes of zeroes)
|
|
4449
|
+
putativeBlockhash.length < 32 || // Highest value (32 bytes of 255)
|
|
4450
|
+
putativeBlockhash.length > 44
|
|
4451
|
+
) {
|
|
4452
|
+
throw new SolanaError(SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE, {
|
|
4453
|
+
actualLength: putativeBlockhash.length
|
|
4454
|
+
});
|
|
4455
|
+
}
|
|
4456
|
+
const bytes = base58Encoder2.encode(putativeBlockhash);
|
|
4457
|
+
const numBytes = bytes.byteLength;
|
|
4458
|
+
if (numBytes !== 32) {
|
|
4459
|
+
throw new SolanaError(SOLANA_ERROR__INVALID_BLOCKHASH_BYTE_LENGTH, {
|
|
4460
|
+
actualLength: numBytes
|
|
3834
4461
|
});
|
|
3835
4462
|
}
|
|
3836
4463
|
}
|
|
@@ -3852,9 +4479,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3852
4479
|
case "processed":
|
|
3853
4480
|
return 0;
|
|
3854
4481
|
default:
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
})
|
|
4482
|
+
throw new SolanaError(SOLANA_ERROR__INVARIANT_VIOLATION__SWITCH_MUST_BE_EXHAUSTIVE, {
|
|
4483
|
+
unexpectedValue: commitment
|
|
4484
|
+
});
|
|
3858
4485
|
}
|
|
3859
4486
|
}
|
|
3860
4487
|
function commitmentComparator(a, b) {
|
|
@@ -3868,11 +4495,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3868
4495
|
return putativeLamports >= 0 && putativeLamports <= maxU64Value;
|
|
3869
4496
|
}
|
|
3870
4497
|
function assertIsLamports(putativeLamports) {
|
|
3871
|
-
if (putativeLamports < 0) {
|
|
3872
|
-
throw new
|
|
3873
|
-
}
|
|
3874
|
-
if (putativeLamports > maxU64Value) {
|
|
3875
|
-
throw new Error("Input number is too large to be represented as a 64-bit unsigned integer");
|
|
4498
|
+
if (putativeLamports < 0 || putativeLamports > maxU64Value) {
|
|
4499
|
+
throw new SolanaError(SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE);
|
|
3876
4500
|
}
|
|
3877
4501
|
}
|
|
3878
4502
|
function lamports(putativeLamports) {
|
|
@@ -3909,9 +4533,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3909
4533
|
function assertIsStringifiedBigInt(putativeBigInt) {
|
|
3910
4534
|
try {
|
|
3911
4535
|
BigInt(putativeBigInt);
|
|
3912
|
-
} catch
|
|
3913
|
-
throw new
|
|
3914
|
-
|
|
4536
|
+
} catch {
|
|
4537
|
+
throw new SolanaError(SOLANA_ERROR__MALFORMED_BIGINT_STRING, {
|
|
4538
|
+
value: putativeBigInt
|
|
3915
4539
|
});
|
|
3916
4540
|
}
|
|
3917
4541
|
}
|
|
@@ -3924,7 +4548,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3924
4548
|
}
|
|
3925
4549
|
function assertIsStringifiedNumber(putativeNumber) {
|
|
3926
4550
|
if (Number.isNaN(Number(putativeNumber))) {
|
|
3927
|
-
throw new
|
|
4551
|
+
throw new SolanaError(SOLANA_ERROR__MALFORMED_NUMBER_STRING, {
|
|
4552
|
+
value: putativeNumber
|
|
4553
|
+
});
|
|
3928
4554
|
}
|
|
3929
4555
|
}
|
|
3930
4556
|
function stringifiedNumber(putativeNumber) {
|
|
@@ -3938,13 +4564,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3938
4564
|
return true;
|
|
3939
4565
|
}
|
|
3940
4566
|
function assertIsUnixTimestamp(putativeTimestamp) {
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
}
|
|
3945
|
-
} catch (e4) {
|
|
3946
|
-
throw new Error(`\`${putativeTimestamp}\` is not a timestamp`, {
|
|
3947
|
-
cause: e4
|
|
4567
|
+
if (putativeTimestamp > 864e13 || putativeTimestamp < -864e13) {
|
|
4568
|
+
throw new SolanaError(SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE, {
|
|
4569
|
+
value: putativeTimestamp
|
|
3948
4570
|
});
|
|
3949
4571
|
}
|
|
3950
4572
|
}
|
|
@@ -3962,22 +4584,20 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3962
4584
|
function assertIsBlockhash2(putativeBlockhash) {
|
|
3963
4585
|
if (!base58Encoder3)
|
|
3964
4586
|
base58Encoder3 = getBase58Encoder();
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
}
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
throw new Error(`\`${putativeBlockhash}\` is not a blockhash`, {
|
|
3980
|
-
cause: e4
|
|
4587
|
+
if (
|
|
4588
|
+
// Lowest value (32 bytes of zeroes)
|
|
4589
|
+
putativeBlockhash.length < 32 || // Highest value (32 bytes of 255)
|
|
4590
|
+
putativeBlockhash.length > 44
|
|
4591
|
+
) {
|
|
4592
|
+
throw new SolanaError(SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE, {
|
|
4593
|
+
actualLength: putativeBlockhash.length
|
|
4594
|
+
});
|
|
4595
|
+
}
|
|
4596
|
+
const bytes = base58Encoder3.encode(putativeBlockhash);
|
|
4597
|
+
const numBytes = bytes.byteLength;
|
|
4598
|
+
if (numBytes !== 32) {
|
|
4599
|
+
throw new SolanaError(SOLANA_ERROR__INVALID_BLOCKHASH_BYTE_LENGTH, {
|
|
4600
|
+
actualLength: numBytes
|
|
3981
4601
|
});
|
|
3982
4602
|
}
|
|
3983
4603
|
}
|
|
@@ -4006,7 +4626,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4006
4626
|
}
|
|
4007
4627
|
function assertIsTransactionWithBlockhashLifetime(transaction) {
|
|
4008
4628
|
if (!isTransactionWithBlockhashLifetime(transaction)) {
|
|
4009
|
-
throw new
|
|
4629
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION__EXPECTED_BLOCKHASH_LIFETIME);
|
|
4010
4630
|
}
|
|
4011
4631
|
}
|
|
4012
4632
|
function setTransactionLifetimeUsingBlockhash(blockhashLifetimeConstraint, transaction) {
|
|
@@ -4055,7 +4675,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4055
4675
|
var SYSTEM_PROGRAM_ADDRESS = "11111111111111111111111111111111";
|
|
4056
4676
|
function assertIsDurableNonceTransaction(transaction) {
|
|
4057
4677
|
if (!isDurableNonceTransaction(transaction)) {
|
|
4058
|
-
throw new
|
|
4678
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION__EXPECTED_NONCE_LIFETIME);
|
|
4059
4679
|
}
|
|
4060
4680
|
}
|
|
4061
4681
|
function createAdvanceNonceAccountInstruction(nonceAccountAddress, nonceAuthorityAddress) {
|
|
@@ -4199,8 +4819,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4199
4819
|
const compiledAddressTableLookupAddresses = compiledAddressTableLookups.map((l) => l.lookupTableAddress);
|
|
4200
4820
|
const missing = compiledAddressTableLookupAddresses.filter((a) => addressesByLookupTableAddress[a] === void 0);
|
|
4201
4821
|
if (missing.length > 0) {
|
|
4202
|
-
|
|
4203
|
-
|
|
4822
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING, {
|
|
4823
|
+
lookupTableAddresses: missing
|
|
4824
|
+
});
|
|
4204
4825
|
}
|
|
4205
4826
|
const readOnlyMetas = [];
|
|
4206
4827
|
const writableMetas = [];
|
|
@@ -4208,8 +4829,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4208
4829
|
const addresses = addressesByLookupTableAddress[lookup.lookupTableAddress];
|
|
4209
4830
|
const highestIndex = Math.max(...lookup.readableIndices, ...lookup.writableIndices);
|
|
4210
4831
|
if (highestIndex >= addresses.length) {
|
|
4211
|
-
throw new
|
|
4212
|
-
|
|
4832
|
+
throw new SolanaError(
|
|
4833
|
+
SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE,
|
|
4834
|
+
{
|
|
4835
|
+
highestKnownIndex: addresses.length - 1,
|
|
4836
|
+
highestRequestedIndex: highestIndex,
|
|
4837
|
+
lookupTableAddress: lookup.lookupTableAddress
|
|
4838
|
+
}
|
|
4213
4839
|
);
|
|
4214
4840
|
}
|
|
4215
4841
|
const readOnlyForLookup = lookup.readableIndices.map((r) => ({
|
|
@@ -4233,7 +4859,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4233
4859
|
var _a, _b;
|
|
4234
4860
|
const programAddress = (_a = accountMetas[instruction.programAddressIndex]) == null ? void 0 : _a.address;
|
|
4235
4861
|
if (!programAddress) {
|
|
4236
|
-
throw new
|
|
4862
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND, {
|
|
4863
|
+
index: instruction.programAddressIndex
|
|
4864
|
+
});
|
|
4237
4865
|
}
|
|
4238
4866
|
const accounts = (_b = instruction.accountIndices) == null ? void 0 : _b.map((accountIndex) => accountMetas[accountIndex]);
|
|
4239
4867
|
const { data } = instruction;
|
|
@@ -4279,8 +4907,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4279
4907
|
var _a;
|
|
4280
4908
|
const { compiledMessage } = compiledTransaction;
|
|
4281
4909
|
const feePayer = compiledMessage.staticAccounts[0];
|
|
4282
|
-
if (!feePayer)
|
|
4283
|
-
throw new
|
|
4910
|
+
if (!feePayer) {
|
|
4911
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_FEE_PAYER_MISSING);
|
|
4912
|
+
}
|
|
4284
4913
|
const accountMetas = getAccountMetas(compiledMessage);
|
|
4285
4914
|
const accountLookupMetas = "addressTableLookups" in compiledMessage && compiledMessage.addressTableLookups !== void 0 && compiledMessage.addressTableLookups.length > 0 ? getAddressLookupMetas(compiledMessage.addressTableLookups, (_a = config == null ? void 0 : config.addressesByLookupTableAddress) != null ? _a : {}) : [];
|
|
4286
4915
|
const transactionMetas = [...accountMetas, ...accountLookupMetas];
|
|
@@ -4321,13 +4950,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4321
4950
|
if (isWritableRole2(entry.role)) {
|
|
4322
4951
|
switch (entry[TYPE]) {
|
|
4323
4952
|
case 0:
|
|
4324
|
-
throw new
|
|
4325
|
-
|
|
4326
|
-
);
|
|
4953
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES, {
|
|
4954
|
+
programAddress: instruction.programAddress
|
|
4955
|
+
});
|
|
4327
4956
|
default:
|
|
4328
|
-
throw new
|
|
4329
|
-
|
|
4330
|
-
);
|
|
4957
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE, {
|
|
4958
|
+
programAddress: instruction.programAddress
|
|
4959
|
+
});
|
|
4331
4960
|
}
|
|
4332
4961
|
}
|
|
4333
4962
|
if (entry[TYPE] === 2) {
|
|
@@ -4392,8 +5021,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4392
5021
|
addressesOfInvokedPrograms.has(account.address)
|
|
4393
5022
|
) {
|
|
4394
5023
|
if (isWritableRole2(accountMeta.role)) {
|
|
4395
|
-
throw new
|
|
4396
|
-
|
|
5024
|
+
throw new SolanaError(
|
|
5025
|
+
SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE,
|
|
5026
|
+
{
|
|
5027
|
+
programAddress: account.address
|
|
5028
|
+
}
|
|
4397
5029
|
);
|
|
4398
5030
|
}
|
|
4399
5031
|
if (entry.role !== nextRole) {
|
|
@@ -4677,7 +5309,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4677
5309
|
return offset;
|
|
4678
5310
|
}
|
|
4679
5311
|
if (value < 0 || value > 127) {
|
|
4680
|
-
throw new
|
|
5312
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_OUT_OF_RANGE, {
|
|
5313
|
+
actualVersion: value
|
|
5314
|
+
});
|
|
4681
5315
|
}
|
|
4682
5316
|
bytes.set([value | VERSION_FLAG_MASK], offset);
|
|
4683
5317
|
return offset + 1;
|
|
@@ -4828,7 +5462,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4828
5462
|
base58Decoder = getBase58Decoder();
|
|
4829
5463
|
const signatureBytes = transaction.signatures[transaction.feePayer];
|
|
4830
5464
|
if (!signatureBytes) {
|
|
4831
|
-
throw new SolanaError(
|
|
5465
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION__FEE_PAYER_SIGNATURE_MISSING);
|
|
4832
5466
|
}
|
|
4833
5467
|
const transactionSignature = base58Decoder.decode(signatureBytes);
|
|
4834
5468
|
return transactionSignature;
|
|
@@ -4871,7 +5505,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4871
5505
|
}
|
|
4872
5506
|
});
|
|
4873
5507
|
if (missingSigs.length > 0) {
|
|
4874
|
-
throw new SolanaError(
|
|
5508
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION__SIGNATURES_MISSING, {
|
|
4875
5509
|
addresses: missingSigs
|
|
4876
5510
|
});
|
|
4877
5511
|
}
|
|
@@ -4888,9 +5522,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4888
5522
|
if (!deduplicated[signer.address]) {
|
|
4889
5523
|
deduplicated[signer.address] = signer;
|
|
4890
5524
|
} else if (deduplicated[signer.address] !== signer) {
|
|
4891
|
-
throw new
|
|
4892
|
-
|
|
4893
|
-
);
|
|
5525
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER__ADDRESS_CANNOT_HAVE_MULTIPLE_SIGNERS, {
|
|
5526
|
+
address: signer.address
|
|
5527
|
+
});
|
|
4894
5528
|
}
|
|
4895
5529
|
});
|
|
4896
5530
|
return Object.values(deduplicated);
|
|
@@ -4953,7 +5587,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4953
5587
|
}
|
|
4954
5588
|
function assertIsMessagePartialSigner(value) {
|
|
4955
5589
|
if (!isMessagePartialSigner(value)) {
|
|
4956
|
-
throw new
|
|
5590
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_PARTIAL_SIGNER, {
|
|
5591
|
+
address: value.address
|
|
5592
|
+
});
|
|
4957
5593
|
}
|
|
4958
5594
|
}
|
|
4959
5595
|
function isTransactionPartialSigner(value) {
|
|
@@ -4961,7 +5597,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4961
5597
|
}
|
|
4962
5598
|
function assertIsTransactionPartialSigner(value) {
|
|
4963
5599
|
if (!isTransactionPartialSigner(value)) {
|
|
4964
|
-
throw new
|
|
5600
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_PARTIAL_SIGNER, {
|
|
5601
|
+
address: value.address
|
|
5602
|
+
});
|
|
4965
5603
|
}
|
|
4966
5604
|
}
|
|
4967
5605
|
function isKeyPairSigner(value) {
|
|
@@ -4969,7 +5607,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4969
5607
|
}
|
|
4970
5608
|
function assertIsKeyPairSigner(value) {
|
|
4971
5609
|
if (!isKeyPairSigner(value)) {
|
|
4972
|
-
throw new
|
|
5610
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER__EXPECTED_KEY_PAIR_SIGNER, {
|
|
5611
|
+
address: value.address
|
|
5612
|
+
});
|
|
4973
5613
|
}
|
|
4974
5614
|
}
|
|
4975
5615
|
async function createSignerFromKeyPair(keyPair) {
|
|
@@ -5002,7 +5642,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5002
5642
|
}
|
|
5003
5643
|
function assertIsMessageModifyingSigner(value) {
|
|
5004
5644
|
if (!isMessageModifyingSigner(value)) {
|
|
5005
|
-
throw new
|
|
5645
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_MODIFYING_SIGNER, {
|
|
5646
|
+
address: value.address
|
|
5647
|
+
});
|
|
5006
5648
|
}
|
|
5007
5649
|
}
|
|
5008
5650
|
function isMessageSigner(value) {
|
|
@@ -5010,7 +5652,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5010
5652
|
}
|
|
5011
5653
|
function assertIsMessageSigner(value) {
|
|
5012
5654
|
if (!isMessageSigner(value)) {
|
|
5013
|
-
throw new
|
|
5655
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_SIGNER, {
|
|
5656
|
+
address: value.address
|
|
5657
|
+
});
|
|
5014
5658
|
}
|
|
5015
5659
|
}
|
|
5016
5660
|
function createNoopSigner(address2) {
|
|
@@ -5026,7 +5670,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5026
5670
|
}
|
|
5027
5671
|
function assertIsTransactionModifyingSigner(value) {
|
|
5028
5672
|
if (!isTransactionModifyingSigner(value)) {
|
|
5029
|
-
throw new
|
|
5673
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_MODIFYING_SIGNER, {
|
|
5674
|
+
address: value.address
|
|
5675
|
+
});
|
|
5030
5676
|
}
|
|
5031
5677
|
}
|
|
5032
5678
|
function isTransactionSendingSigner(value) {
|
|
@@ -5034,7 +5680,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5034
5680
|
}
|
|
5035
5681
|
function assertIsTransactionSendingSigner(value) {
|
|
5036
5682
|
if (!isTransactionSendingSigner(value)) {
|
|
5037
|
-
throw new
|
|
5683
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SENDING_SIGNER, {
|
|
5684
|
+
address: value.address
|
|
5685
|
+
});
|
|
5038
5686
|
}
|
|
5039
5687
|
}
|
|
5040
5688
|
function isTransactionSigner(value) {
|
|
@@ -5042,7 +5690,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5042
5690
|
}
|
|
5043
5691
|
function assertIsTransactionSigner(value) {
|
|
5044
5692
|
if (!isTransactionSigner(value)) {
|
|
5045
|
-
throw new
|
|
5693
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SIGNER, {
|
|
5694
|
+
address: value.address
|
|
5695
|
+
});
|
|
5046
5696
|
}
|
|
5047
5697
|
}
|
|
5048
5698
|
async function partiallySignTransactionWithSigners(transaction, config = {}) {
|
|
@@ -5070,9 +5720,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5070
5720
|
abortSignal
|
|
5071
5721
|
);
|
|
5072
5722
|
if (!sendingSigner) {
|
|
5073
|
-
throw new
|
|
5074
|
-
"No `TransactionSendingSigner` was identified. Please provide a valid `ITransactionWithSingleSendingSigner` transaction."
|
|
5075
|
-
);
|
|
5723
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER__TRANSACTION_SENDING_SIGNER_MISSING);
|
|
5076
5724
|
}
|
|
5077
5725
|
abortSignal == null ? void 0 : abortSignal.throwIfAborted();
|
|
5078
5726
|
const [signature2] = await sendingSigner.signAndSendTransactions([signedTransaction], { abortSignal });
|
|
@@ -5157,17 +5805,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5157
5805
|
const signers = getSignersFromTransaction(transaction);
|
|
5158
5806
|
const sendingSigners = signers.filter(isTransactionSendingSigner);
|
|
5159
5807
|
if (sendingSigners.length === 0) {
|
|
5160
|
-
|
|
5161
|
-
error.name = "MissingTransactionSendingSignerError";
|
|
5162
|
-
throw error;
|
|
5808
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER__TRANSACTION_SENDING_SIGNER_MISSING);
|
|
5163
5809
|
}
|
|
5164
5810
|
const sendingOnlySigners = sendingSigners.filter(
|
|
5165
5811
|
(signer) => !isTransactionPartialSigner(signer) && !isTransactionModifyingSigner(signer)
|
|
5166
5812
|
);
|
|
5167
5813
|
if (sendingOnlySigners.length > 1) {
|
|
5168
|
-
|
|
5169
|
-
error.name = "MultipleTransactionSendingSignersError";
|
|
5170
|
-
throw error;
|
|
5814
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER__TRANSACTION_CANNOT_HAVE_MULTIPLE_SENDING_SIGNERS);
|
|
5171
5815
|
}
|
|
5172
5816
|
}
|
|
5173
5817
|
|
|
@@ -5257,7 +5901,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5257
5901
|
for await (const accountNotification of accountNotifications) {
|
|
5258
5902
|
const nonceValue = getNonceFromAccountData(accountNotification.value.data);
|
|
5259
5903
|
if (nonceValue !== expectedNonceValue) {
|
|
5260
|
-
throw new SolanaError(
|
|
5904
|
+
throw new SolanaError(SOLANA_ERROR__INVALID_NONCE, {
|
|
5261
5905
|
actualNonceValue: nonceValue,
|
|
5262
5906
|
expectedNonceValue
|
|
5263
5907
|
});
|
|
@@ -5281,7 +5925,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5281
5925
|
nonceAccount.data[0]
|
|
5282
5926
|
);
|
|
5283
5927
|
if (nonceValue !== expectedNonceValue) {
|
|
5284
|
-
throw new SolanaError(
|
|
5928
|
+
throw new SolanaError(SOLANA_ERROR__INVALID_NONCE, {
|
|
5285
5929
|
actualNonceValue: nonceValue,
|
|
5286
5930
|
expectedNonceValue
|
|
5287
5931
|
});
|
|
@@ -5312,9 +5956,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5312
5956
|
const signatureDidCommitPromise = (async () => {
|
|
5313
5957
|
for await (const signatureStatusNotification of signatureStatusNotifications) {
|
|
5314
5958
|
if (signatureStatusNotification.value.err) {
|
|
5315
|
-
throw
|
|
5316
|
-
cause: signatureStatusNotification.value.err
|
|
5317
|
-
});
|
|
5959
|
+
throw getSolanaErrorFromTransactionError(signatureStatusNotification.value.err);
|
|
5318
5960
|
} else {
|
|
5319
5961
|
return;
|
|
5320
5962
|
}
|
|
@@ -5339,9 +5981,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5339
5981
|
}
|
|
5340
5982
|
async function getTimeoutPromise({ abortSignal: callerAbortSignal, commitment }) {
|
|
5341
5983
|
return await new Promise((_, reject) => {
|
|
5342
|
-
const handleAbort = (
|
|
5984
|
+
const handleAbort = (e3) => {
|
|
5343
5985
|
clearTimeout(timeoutId);
|
|
5344
|
-
const abortError = new DOMException(
|
|
5986
|
+
const abortError = new DOMException(e3.target.reason, "AbortError");
|
|
5345
5987
|
reject(abortError);
|
|
5346
5988
|
};
|
|
5347
5989
|
callerAbortSignal.addEventListener("abort", handleAbort);
|
|
@@ -5680,6 +6322,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5680
6322
|
exports.assertIsBlockhash = assertIsBlockhash;
|
|
5681
6323
|
exports.assertIsDurableNonceTransaction = assertIsDurableNonceTransaction;
|
|
5682
6324
|
exports.assertIsFixedSize = assertIsFixedSize;
|
|
6325
|
+
exports.assertIsInstructionForProgram = assertIsInstructionForProgram;
|
|
6326
|
+
exports.assertIsInstructionWithAccounts = assertIsInstructionWithAccounts;
|
|
6327
|
+
exports.assertIsInstructionWithData = assertIsInstructionWithData;
|
|
5683
6328
|
exports.assertIsKeyPairSigner = assertIsKeyPairSigner;
|
|
5684
6329
|
exports.assertIsLamports = assertIsLamports;
|
|
5685
6330
|
exports.assertIsMessageModifyingSigner = assertIsMessageModifyingSigner;
|
|
@@ -5721,9 +6366,12 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5721
6366
|
exports.createSignerFromKeyPair = createSignerFromKeyPair;
|
|
5722
6367
|
exports.createSolanaRpc = createSolanaRpc;
|
|
5723
6368
|
exports.createSolanaRpcApi = createSolanaRpcApi;
|
|
6369
|
+
exports.createSolanaRpcFromTransport = createSolanaRpcFromTransport;
|
|
5724
6370
|
exports.createSolanaRpcSubscriptions = createSolanaRpcSubscriptions;
|
|
5725
6371
|
exports.createSolanaRpcSubscriptionsApi = createSolanaRpcSubscriptionsApi;
|
|
5726
6372
|
exports.createSolanaRpcSubscriptionsApi_UNSTABLE = createSolanaRpcSubscriptionsApi_UNSTABLE;
|
|
6373
|
+
exports.createSolanaRpcSubscriptionsFromTransport = createSolanaRpcSubscriptionsFromTransport;
|
|
6374
|
+
exports.createSolanaRpcSubscriptionsFromTransport_UNSTABLE = createSolanaRpcSubscriptionsFromTransport_UNSTABLE;
|
|
5727
6375
|
exports.createSolanaRpcSubscriptions_UNSTABLE = createSolanaRpcSubscriptions_UNSTABLE;
|
|
5728
6376
|
exports.createSubscriptionRpc = createSubscriptionRpc;
|
|
5729
6377
|
exports.createTransaction = createTransaction;
|
|
@@ -5867,6 +6515,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5867
6515
|
exports.isAddress = isAddress;
|
|
5868
6516
|
exports.isAdvanceNonceAccountInstruction = isAdvanceNonceAccountInstruction;
|
|
5869
6517
|
exports.isFixedSize = isFixedSize;
|
|
6518
|
+
exports.isInstructionForProgram = isInstructionForProgram;
|
|
6519
|
+
exports.isInstructionWithAccounts = isInstructionWithAccounts;
|
|
6520
|
+
exports.isInstructionWithData = isInstructionWithData;
|
|
5870
6521
|
exports.isKeyPairSigner = isKeyPairSigner;
|
|
5871
6522
|
exports.isLamports = isLamports;
|
|
5872
6523
|
exports.isMessageModifyingSigner = isMessageModifyingSigner;
|