@solana/web3.js 2.0.0-experimental.26a177e → 2.0.0-experimental.27479b3
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 +964 -307
- package/dist/index.development.js.map +1 -1
- package/dist/index.production.min.js +284 -279
- package/package.json +16 -16
|
@@ -125,6 +125,587 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
125
125
|
// ../accounts/dist/index.browser.js
|
|
126
126
|
init_env_shim();
|
|
127
127
|
|
|
128
|
+
// ../errors/dist/index.browser.js
|
|
129
|
+
init_env_shim();
|
|
130
|
+
var SOLANA_ERROR__RPC_INTEGER_OVERFLOW = 3;
|
|
131
|
+
var SOLANA_ERROR__INVALID_KEYPAIR_BYTES = 4;
|
|
132
|
+
var SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED = 5;
|
|
133
|
+
var SOLANA_ERROR__NONCE_INVALID = 6;
|
|
134
|
+
var SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND = 7;
|
|
135
|
+
var SOLANA_ERROR__ACCOUNT_NOT_FOUND = 8;
|
|
136
|
+
var SOLANA_ERROR__MULTIPLE_ACCOUNTS_NOT_FOUND = 9;
|
|
137
|
+
var SOLANA_ERROR__FAILED_TO_DECODE_ACCOUNT = 10;
|
|
138
|
+
var SOLANA_ERROR__EXPECTED_DECODED_ACCOUNT = 11;
|
|
139
|
+
var SOLANA_ERROR__NOT_ALL_ACCOUNTS_DECODED = 12;
|
|
140
|
+
var SOLANA_ERROR__ADDRESS_BYTE_LENGTH_OUT_OF_RANGE = 13;
|
|
141
|
+
var SOLANA_ERROR__ADDRESS_STRING_LENGTH_OUT_OF_RANGE = 14;
|
|
142
|
+
var SOLANA_ERROR__NOT_A_BASE58_ENCODED_ADDRESS = 15;
|
|
143
|
+
var SOLANA_ERROR__NOT_AN_ED25519_PUBLIC_KEY = 16;
|
|
144
|
+
var SOLANA_ERROR__MALFORMED_PROGRAM_DERIVED_ADDRESS = 17;
|
|
145
|
+
var SOLANA_ERROR__PROGRAM_DERIVED_ADDRESS_BUMP_SEED_OUT_OF_RANGE = 18;
|
|
146
|
+
var SOLANA_ERROR__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED = 19;
|
|
147
|
+
var SOLANA_ERROR__MAX_PDA_SEED_LENGTH_EXCEEDED = 20;
|
|
148
|
+
var SOLANA_ERROR__INVALID_SEEDS_POINT_ON_CURVE = 21;
|
|
149
|
+
var SOLANA_ERROR__COULD_NOT_FIND_VIABLE_PDA_BUMP_SEED = 22;
|
|
150
|
+
var SOLANA_ERROR__PROGRAM_ADDRESS_ENDS_WITH_PDA_MARKER = 23;
|
|
151
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO_MISSING = 24;
|
|
152
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO_DIGEST_MISSING = 25;
|
|
153
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO_ED25519_ALGORITHM_MISSING = 26;
|
|
154
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO_EXPORT_FUNCTION_MISSING = 27;
|
|
155
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO_GENERATE_FUNCTION_MISSING = 28;
|
|
156
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO_SIGN_FUNCTION_MISSING = 29;
|
|
157
|
+
var SOLANA_ERROR__SUBTLE_CRYPTO_VERIFY_FUNCTION_MISSING = 30;
|
|
158
|
+
var SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE = 48;
|
|
159
|
+
var SOLANA_ERROR__BLOCKHASH_BYTE_LENGTH_OUT_OF_RANGE = 49;
|
|
160
|
+
var SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE = 50;
|
|
161
|
+
var SOLANA_ERROR__MALFORMED_BIGINT_STRING = 51;
|
|
162
|
+
var SOLANA_ERROR__MALFORMED_NUMBER_STRING = 52;
|
|
163
|
+
var SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE = 53;
|
|
164
|
+
var SOLANA_ERROR__RPC_TRANSPORT_HEADER_FORBIDDEN = 54;
|
|
165
|
+
var SOLANA_ERROR__RPC_TRANSPORT_HTTP_ERROR = 55;
|
|
166
|
+
var SOLANA_ERROR__EXPECTED_INSTRUCTION_TO_HAVE_ACCOUNTS = 70;
|
|
167
|
+
var SOLANA_ERROR__EXPECTED_INSTRUCTION_TO_HAVE_DATA = 71;
|
|
168
|
+
var SOLANA_ERROR__INSTRUCTION_PROGRAM_ID_MISMATCH = 72;
|
|
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 = 5663001;
|
|
236
|
+
var SOLANA_ERROR__TRANSACTION_INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE = 5663002;
|
|
237
|
+
var SOLANA_ERROR__TRANSACTION_EXPECTED_BLOCKHASH_LIFETIME = 5663003;
|
|
238
|
+
var SOLANA_ERROR__TRANSACTION_EXPECTED_NONCE_LIFETIME = 5663004;
|
|
239
|
+
var SOLANA_ERROR__TRANSACTION_VERSION_NUMBER_OUT_OF_RANGE = 5663005;
|
|
240
|
+
var SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING = 5663006;
|
|
241
|
+
var SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE = 5663007;
|
|
242
|
+
var SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND = 5663008;
|
|
243
|
+
var SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_FEE_PAYER_MISSING = 5663009;
|
|
244
|
+
var SOLANA_ERROR__TRANSACTION_MISSING_SIGNATURES = 5663010;
|
|
245
|
+
var SOLANA_ERROR__TRANSACTION_SIGNATURE_NOT_COMPUTABLE = 5663011;
|
|
246
|
+
var SOLANA_ERROR__TRANSACTION_MISSING_ADDRESS = 5663012;
|
|
247
|
+
var SOLANA_ERROR__TRANSACTION_MISSING_FEE_PAYER = 5663013;
|
|
248
|
+
var SOLANA_ERROR__TRANSACTION_INVALID_NONCE_TRANSACTION_NO_INSTRUCTIONS = 5663014;
|
|
249
|
+
var SOLANA_ERROR__TRANSACTION_INVALID_NONCE_TRANSACTION_FIRST_INSTRUCTION_NOT_ADVANCE_NONCE = 5663015;
|
|
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_WRONG_NUMBER_OF_BYTES = 8078001;
|
|
289
|
+
var SOLANA_ERROR__CODECS_EXPECTED_FIXED_LENGTH_GOT_VARIABLE_LENGTH = 8078002;
|
|
290
|
+
var SOLANA_ERROR__CODECS_EXPECTED_VARIABLE_LENGTH_GOT_FIXED_LENGTH = 8078003;
|
|
291
|
+
var SOLANA_ERROR__CODECS_ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH = 8078004;
|
|
292
|
+
var SOLANA_ERROR__CODECS_FIXED_SIZE_ENCODER_DECODER_SIZE_MISMATCH = 8078005;
|
|
293
|
+
var SOLANA_ERROR__CODECS_VARIABLE_SIZE_ENCODER_DECODER_MAX_SIZE_MISMATCH = 8078006;
|
|
294
|
+
var SOLANA_ERROR__CODECS_WRONG_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_SUBSCRIPTIONS_CANNOT_CREATE_SUBSCRIPTION_REQUEST = 819e4;
|
|
301
|
+
var SOLANA_ERROR__RPC_SUBSCRIPTIONS_EXPECTED_SERVER_SUBSCRIPTION_ID = 8190001;
|
|
302
|
+
var SOLANA_ERROR__RPC_SUBSCRIPTIONS_TRANSPORT_CLOSED_BEFORE_MESSAGE_BUFFERED = 8190002;
|
|
303
|
+
var SOLANA_ERROR__RPC_SUBSCRIPTIONS_TRANSPORT_CONNECTION_CLOSED = 8190003;
|
|
304
|
+
var SOLANA_ERROR__RPC_SUBSCRIPTIONS_TRANSPORT_FAILED_TO_CONNECT = 8190004;
|
|
305
|
+
var SolanaErrorMessages = {
|
|
306
|
+
[SOLANA_ERROR__ACCOUNT_NOT_FOUND]: "Account not found at address: $address",
|
|
307
|
+
[SOLANA_ERROR__ADDRESS_BYTE_LENGTH_OUT_OF_RANGE]: "Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.",
|
|
308
|
+
[SOLANA_ERROR__ADDRESS_STRING_LENGTH_OUT_OF_RANGE]: "Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.",
|
|
309
|
+
[SOLANA_ERROR__BLOCKHASH_BYTE_LENGTH_OUT_OF_RANGE]: "Expected base58 encoded blockhash to decode to a byte array of length 32. Actual length: $actualLength.",
|
|
310
|
+
[SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE]: "Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.",
|
|
311
|
+
[SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED]: "The network has progressed past the last block for which this transaction could have been committed.",
|
|
312
|
+
[SOLANA_ERROR__CODECS_CANNOT_DECODE_EMPTY_BYTE_ARRAY]: "Codec [$codecDescription] cannot decode empty byte arrays.",
|
|
313
|
+
[SOLANA_ERROR__CODECS_ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH]: "Encoder and decoder must either both be fixed-size or variable-size.",
|
|
314
|
+
[SOLANA_ERROR__CODECS_ENUM_DISCRIMINATOR_OUT_OF_RANGE]: "Enum discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.",
|
|
315
|
+
[SOLANA_ERROR__CODECS_EXPECTED_FIXED_LENGTH_GOT_VARIABLE_LENGTH]: "Expected a fixed-size codec, got a variable-size one.",
|
|
316
|
+
[SOLANA_ERROR__CODECS_EXPECTED_VARIABLE_LENGTH_GOT_FIXED_LENGTH]: "Expected a variable-size codec, got a fixed-size one.",
|
|
317
|
+
[SOLANA_ERROR__CODECS_FIXED_SIZE_ENCODER_DECODER_SIZE_MISMATCH]: "Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].",
|
|
318
|
+
[SOLANA_ERROR__CODECS_INVALID_DATA_ENUM_VARIANT]: "Invalid data enum variant. Expected one of [$variants], got $value.",
|
|
319
|
+
[SOLANA_ERROR__CODECS_INVALID_SCALAR_ENUM_VARIANT]: "Invalid scalar enum variant. Expected one of [$variants] or a number between $minRange and $maxRange, got $value.",
|
|
320
|
+
[SOLANA_ERROR__CODECS_INVALID_STRING_FOR_BASE]: "Invalid value $value for base $base with alphabet $alphabet.",
|
|
321
|
+
[SOLANA_ERROR__CODECS_NUMBER_OUT_OF_RANGE]: "Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.",
|
|
322
|
+
[SOLANA_ERROR__CODECS_VARIABLE_SIZE_ENCODER_DECODER_MAX_SIZE_MISMATCH]: "Encoder and decoder must have the same max size, got [$encoderMaxSize] and [$decoderMaxSize].",
|
|
323
|
+
[SOLANA_ERROR__CODECS_WRONG_NUMBER_OF_BYTES]: "Codec [$codecDescription] expected $expected bytes, got $bytesLength.",
|
|
324
|
+
[SOLANA_ERROR__CODECS_WRONG_NUMBER_OF_ITEMS]: "Expected [$codecDescription] to have $expected items, got $actual.",
|
|
325
|
+
[SOLANA_ERROR__COULD_NOT_FIND_VIABLE_PDA_BUMP_SEED]: "Unable to find a viable program address bump seed.",
|
|
326
|
+
[SOLANA_ERROR__EXPECTED_DECODED_ACCOUNT]: "Expected decoded account at address: $address",
|
|
327
|
+
[SOLANA_ERROR__EXPECTED_INSTRUCTION_TO_HAVE_ACCOUNTS]: "The instruction does not have any accounts.",
|
|
328
|
+
[SOLANA_ERROR__EXPECTED_INSTRUCTION_TO_HAVE_DATA]: "The instruction does not have any data.",
|
|
329
|
+
[SOLANA_ERROR__FAILED_TO_DECODE_ACCOUNT]: "Failed to decode account data at address: $address",
|
|
330
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_ALREADY_INITIALIZED]: "instruction requires an uninitialized account",
|
|
331
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_BORROW_FAILED]: "instruction tries to borrow reference for an account which is already borrowed",
|
|
332
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_BORROW_OUTSTANDING]: "instruction left account with an outstanding borrowed reference",
|
|
333
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_DATA_SIZE_CHANGED]: "program other than the account's owner changed the size of the account data",
|
|
334
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_DATA_TOO_SMALL]: "account data too small for instruction",
|
|
335
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_NOT_EXECUTABLE]: "instruction expected an executable account",
|
|
336
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ACCOUNT_NOT_RENT_EXEMPT]: "An account does not have enough lamports to be rent-exempt",
|
|
337
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ARITHMETIC_OVERFLOW]: "Program arithmetic overflowed",
|
|
338
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_BORSH_IO_ERROR]: "Failed to serialize or deserialize account data: $encodedData",
|
|
339
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS]: "Builtin programs must consume compute units",
|
|
340
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_CALL_DEPTH]: "Cross-program invocation call depth too deep",
|
|
341
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_COMPUTATIONAL_BUDGET_EXCEEDED]: "Computational budget exceeded",
|
|
342
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_CUSTOM]: "custom program error: #$code",
|
|
343
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_DUPLICATE_ACCOUNT_INDEX]: "instruction contains duplicate accounts",
|
|
344
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_DUPLICATE_ACCOUNT_OUT_OF_SYNC]: "instruction modifications of multiply-passed account differ",
|
|
345
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_ACCOUNT_NOT_RENT_EXEMPT]: "executable accounts must be rent exempt",
|
|
346
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_DATA_MODIFIED]: "instruction changed executable accounts data",
|
|
347
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_LAMPORT_CHANGE]: "instruction changed the balance of an executable account",
|
|
348
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_EXECUTABLE_MODIFIED]: "instruction changed executable bit of an account",
|
|
349
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_EXTERNAL_ACCOUNT_DATA_MODIFIED]: "instruction modified data of an account it does not own",
|
|
350
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_EXTERNAL_ACCOUNT_LAMPORT_SPEND]: "instruction spent from the balance of an account it does not own",
|
|
351
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_GENERIC_ERROR]: "generic instruction error",
|
|
352
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_ILLEGAL_OWNER]: "Provided owner is not allowed",
|
|
353
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_IMMUTABLE]: "Account is immutable",
|
|
354
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INCORRECT_AUTHORITY]: "Incorrect authority provided",
|
|
355
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INCORRECT_PROGRAM_ID]: "incorrect program id for instruction",
|
|
356
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INSUFFICIENT_FUNDS]: "insufficient funds for instruction",
|
|
357
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ACCOUNT_DATA]: "invalid account data for instruction",
|
|
358
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ACCOUNT_OWNER]: "Invalid account owner",
|
|
359
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ARGUMENT]: "invalid program argument",
|
|
360
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_ERROR]: "program returned invalid error code",
|
|
361
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_INSTRUCTION_DATA]: "invalid instruction data",
|
|
362
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_REALLOC]: "Failed to reallocate account data",
|
|
363
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_INVALID_SEEDS]: "Provided seeds do not result in a valid address",
|
|
364
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED]: "Accounts data allocations exceeded the maximum allowed per transaction",
|
|
365
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MAX_ACCOUNTS_EXCEEDED]: "Max accounts exceeded",
|
|
366
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED]: "Max instruction trace length exceeded",
|
|
367
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MAX_SEED_LENGTH_EXCEEDED]: "Length of the seed is too long for address generation",
|
|
368
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MISSING_ACCOUNT]: "An account required by the instruction is missing",
|
|
369
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MISSING_REQUIRED_SIGNATURE]: "missing required signature for instruction",
|
|
370
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_MODIFIED_PROGRAM_ID]: "instruction illegally modified the program id of an account",
|
|
371
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_NOT_ENOUGH_ACCOUNT_KEYS]: "insufficient account keys for instruction",
|
|
372
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_PRIVILEGE_ESCALATION]: "Cross-program invocation with unauthorized signer or writable account",
|
|
373
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_PROGRAM_ENVIRONMENT_SETUP_FAILURE]: "Failed to create program execution environment",
|
|
374
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_PROGRAM_FAILED_TO_COMPILE]: "Program failed to compile",
|
|
375
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_PROGRAM_FAILED_TO_COMPLETE]: "Program failed to complete",
|
|
376
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_READONLY_DATA_MODIFIED]: "instruction modified data of a read-only account",
|
|
377
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_READONLY_LAMPORT_CHANGE]: "instruction changed the balance of a read-only account",
|
|
378
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_REENTRANCY_NOT_ALLOWED]: "Cross-program invocation reentrancy not allowed for this instruction",
|
|
379
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_RENT_EPOCH_MODIFIED]: "instruction modified rent epoch of an account",
|
|
380
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_UNBALANCED_INSTRUCTION]: "sum of account balances before and after instruction do not match",
|
|
381
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_UNINITIALIZED_ACCOUNT]: "instruction requires an initialized account",
|
|
382
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_UNKNOWN]: "",
|
|
383
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_UNSUPPORTED_PROGRAM_ID]: "Unsupported program id",
|
|
384
|
+
[SOLANA_ERROR__INSTRUCTION_ERROR_UNSUPPORTED_SYSVAR]: "Unsupported sysvar",
|
|
385
|
+
[SOLANA_ERROR__INSTRUCTION_PROGRAM_ID_MISMATCH]: "Expected instruction to have progress address $expectedProgramAddress, got $actualProgramAddress.",
|
|
386
|
+
[SOLANA_ERROR__INVALID_KEYPAIR_BYTES]: "Key pair bytes must be of length 64, got $byteLength.",
|
|
387
|
+
[SOLANA_ERROR__INVALID_SEEDS_POINT_ON_CURVE]: "Invalid seeds; point must fall off the Ed25519 curve.",
|
|
388
|
+
[SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE]: "Lamports value must be in the range [0, 2e64-1]",
|
|
389
|
+
[SOLANA_ERROR__MALFORMED_BIGINT_STRING]: "`$value` cannot be parsed as a `BigInt`",
|
|
390
|
+
[SOLANA_ERROR__MALFORMED_NUMBER_STRING]: "`$value` cannot be parsed as a `Number`",
|
|
391
|
+
[SOLANA_ERROR__MALFORMED_PROGRAM_DERIVED_ADDRESS]: "Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].",
|
|
392
|
+
[SOLANA_ERROR__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED]: "A maximum of $maxSeeds seeds, including the bump seed, may be supplied when creating an address. Received: $actual.",
|
|
393
|
+
[SOLANA_ERROR__MAX_PDA_SEED_LENGTH_EXCEEDED]: "The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.",
|
|
394
|
+
[SOLANA_ERROR__MULTIPLE_ACCOUNTS_NOT_FOUND]: "Accounts not found at addresses: $addresses",
|
|
395
|
+
[SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND]: "No nonce account could be found at address `$nonceAccountAddress`",
|
|
396
|
+
[SOLANA_ERROR__NONCE_INVALID]: "The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",
|
|
397
|
+
[SOLANA_ERROR__NOT_ALL_ACCOUNTS_DECODED]: "Not all accounts were decoded. Encoded accounts found at addresses: $addresses.",
|
|
398
|
+
[SOLANA_ERROR__NOT_AN_ED25519_PUBLIC_KEY]: "The `CryptoKey` must be an `Ed25519` public key.",
|
|
399
|
+
[SOLANA_ERROR__NOT_A_BASE58_ENCODED_ADDRESS]: "$putativeAddress is not a base58-encoded address.",
|
|
400
|
+
[SOLANA_ERROR__PROGRAM_ADDRESS_ENDS_WITH_PDA_MARKER]: "Program address cannot end with PDA marker.",
|
|
401
|
+
[SOLANA_ERROR__PROGRAM_DERIVED_ADDRESS_BUMP_SEED_OUT_OF_RANGE]: "Expected program derived address bump to be in the range [0, 255], got: $bump.",
|
|
402
|
+
[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`.",
|
|
403
|
+
[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.",
|
|
404
|
+
[SOLANA_ERROR__RPC_SUBSCRIPTIONS_EXPECTED_SERVER_SUBSCRIPTION_ID]: "Failed to obtain a subscription id from the server",
|
|
405
|
+
[SOLANA_ERROR__RPC_SUBSCRIPTIONS_TRANSPORT_CLOSED_BEFORE_MESSAGE_BUFFERED]: "WebSocket was closed before payload could be added to the send buffer",
|
|
406
|
+
[SOLANA_ERROR__RPC_SUBSCRIPTIONS_TRANSPORT_CONNECTION_CLOSED]: "WebSocket connection closed",
|
|
407
|
+
[SOLANA_ERROR__RPC_SUBSCRIPTIONS_TRANSPORT_FAILED_TO_CONNECT]: "WebSocket failed to connect",
|
|
408
|
+
[SOLANA_ERROR__RPC_TRANSPORT_HEADER_FORBIDDEN]: "HTTP header(s) forbidden: $headers. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.",
|
|
409
|
+
[SOLANA_ERROR__RPC_TRANSPORT_HTTP_ERROR]: "HTTP error ($statusCode): $message",
|
|
410
|
+
[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.",
|
|
411
|
+
[SOLANA_ERROR__SIGNER_EXPECTED_KEY_PAIR_SIGNER]: "The provided value does not implement the `KeyPairSigner` interface",
|
|
412
|
+
[SOLANA_ERROR__SIGNER_EXPECTED_MESSAGE_MODIFYING_SIGNER]: "The provided value does not implement the `MessageModifyingSigner` interface",
|
|
413
|
+
[SOLANA_ERROR__SIGNER_EXPECTED_MESSAGE_PARTIAL_SIGNER]: "The provided value does not implement the `MessagePartialSigner` interface",
|
|
414
|
+
[SOLANA_ERROR__SIGNER_EXPECTED_MESSAGE_SIGNER]: "The provided value does not implement any of the `MessageSigner` interfaces",
|
|
415
|
+
[SOLANA_ERROR__SIGNER_EXPECTED_TRANSACTION_MODIFYING_SIGNER]: "The provided value does not implement the `TransactionModifyingSigner` interface",
|
|
416
|
+
[SOLANA_ERROR__SIGNER_EXPECTED_TRANSACTION_PARTIAL_SIGNER]: "The provided value does not implement the `TransactionPartialSigner` interface",
|
|
417
|
+
[SOLANA_ERROR__SIGNER_EXPECTED_TRANSACTION_SENDING_SIGNER]: "The provided value does not implement the `TransactionSendingSigner` interface",
|
|
418
|
+
[SOLANA_ERROR__SIGNER_EXPECTED_TRANSACTION_SIGNER]: "The provided value does not implement any of the `TransactionSigner` interfaces",
|
|
419
|
+
[SOLANA_ERROR__SIGNER_TRANSACTION_CANNOT_HAVE_MULTIPLE_SENDING_SIGNERS]: "More than one `TransactionSendingSigner` was identified.",
|
|
420
|
+
[SOLANA_ERROR__SIGNER_TRANSACTION_SENDING_SIGNER_MISSING]: "No `TransactionSendingSigner` was identified. Please provide a valid `ITransactionWithSingleSendingSigner` transaction.",
|
|
421
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO_DIGEST_MISSING]: "No digest implementation could be found.",
|
|
422
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO_ED25519_ALGORITHM_MISSING]: "This runtime does not support the generation of Ed25519 key pairs.\n\nInstall and import `@solana/webcrypto-ed25519-polyfill` before generating keys in environments that do not support Ed25519.\n\nFor a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20.",
|
|
423
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO_EXPORT_FUNCTION_MISSING]: "No signature verification implementation could be found.",
|
|
424
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO_GENERATE_FUNCTION_MISSING]: "No key generation implementation could be found.",
|
|
425
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO_MISSING]: "Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.",
|
|
426
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO_SIGN_FUNCTION_MISSING]: "No signing implementation could be found.",
|
|
427
|
+
[SOLANA_ERROR__SUBTLE_CRYPTO_VERIFY_FUNCTION_MISSING]: "No key export implementation could be found.",
|
|
428
|
+
[SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE]: "Timestamp value must be in the range [-8.64e15, 8.64e15]. `$value` given",
|
|
429
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_BORROW_OUTSTANDING]: "Transaction processing left an account with an outstanding borrowed reference",
|
|
430
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_IN_USE]: "Account in use",
|
|
431
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_LOADED_TWICE]: "Account loaded twice",
|
|
432
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_NOT_FOUND]: "Attempt to debit an account but found no record of a prior credit.",
|
|
433
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_ADDRESS_LOOKUP_TABLE_NOT_FOUND]: "Transaction loads an address table account that doesn't exist",
|
|
434
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_ALREADY_PROCESSED]: "This transaction has already been processed",
|
|
435
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_BLOCKHASH_NOT_FOUND]: "Blockhash not found",
|
|
436
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_CALL_CHAIN_TOO_DEEP]: "Loader call chain is too deep",
|
|
437
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_CLUSTER_MAINTENANCE]: "Transactions are currently disabled due to cluster maintenance",
|
|
438
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_DUPLICATE_INSTRUCTION]: "Transaction contains a duplicate instruction ($index) that is not allowed",
|
|
439
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INSUFFICIENT_FUNDS_FOR_FEE]: "Insufficient funds for fee",
|
|
440
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INSUFFICIENT_FUNDS_FOR_RENT]: "Transaction results in an account ($accountIndex) with insufficient funds for rent",
|
|
441
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ACCOUNT_FOR_FEE]: "This account may not be used to pay transaction fees",
|
|
442
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ACCOUNT_INDEX]: "Transaction contains an invalid account reference",
|
|
443
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ADDRESS_LOOKUP_TABLE_DATA]: "Transaction loads an address table account with invalid data",
|
|
444
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ADDRESS_LOOKUP_TABLE_INDEX]: "Transaction address table lookup uses an invalid index",
|
|
445
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_ADDRESS_LOOKUP_TABLE_OWNER]: "Transaction loads an address table account with an invalid owner",
|
|
446
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_LOADED_ACCOUNTS_DATA_SIZE_LIMIT]: "LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",
|
|
447
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_PROGRAM_FOR_EXECUTION]: "This program may not be used for executing instructions",
|
|
448
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_RENT_PAYING_ACCOUNT]: "Transaction leaves an account with a lower balance than rent-exempt minimum",
|
|
449
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_INVALID_WRITABLE_ACCOUNT]: "Transaction loads a writable account that cannot be written",
|
|
450
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_MAX_LOADED_ACCOUNTS_DATA_SIZE_EXCEEDED]: "Transaction exceeded max loaded accounts data size cap",
|
|
451
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_MISSING_SIGNATURE_FOR_FEE]: "Transaction requires a fee but has no signature present",
|
|
452
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_PROGRAM_ACCOUNT_NOT_FOUND]: "Attempt to load a program that does not exist",
|
|
453
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED]: "Execution of the program referenced by account at index $accountIndex is temporarily restricted.",
|
|
454
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_RESANITIZATION_NEEDED]: "ResanitizationNeeded",
|
|
455
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_SANITIZE_FAILURE]: "Transaction failed to sanitize accounts offsets correctly",
|
|
456
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_SIGNATURE_FAILURE]: "Transaction did not pass signature verification",
|
|
457
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_TOO_MANY_ACCOUNT_LOCKS]: "Transaction locked too many accounts",
|
|
458
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_UNBALANCED_TRANSACTION]: "Sum of account balances before and after transaction do not match",
|
|
459
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_UNKNOWN]: "The transaction failed with the error `$errorName`",
|
|
460
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_UNSUPPORTED_VERSION]: "Transaction version is unsupported",
|
|
461
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_ACCOUNT_DATA_BLOCK_LIMIT]: "Transaction would exceed account data limit within the block",
|
|
462
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_ACCOUNT_DATA_TOTAL_LIMIT]: "Transaction would exceed total account data limit",
|
|
463
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_MAX_ACCOUNT_COST_LIMIT]: "Transaction would exceed max account limit within the block",
|
|
464
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_MAX_BLOCK_COST_LIMIT]: "Transaction would exceed max Block Cost Limit",
|
|
465
|
+
[SOLANA_ERROR__TRANSACTION_ERROR_WOULD_EXCEED_MAX_VOTE_COST_LIMIT]: "Transaction would exceed max Vote Cost Limit",
|
|
466
|
+
[SOLANA_ERROR__TRANSACTION_EXPECTED_BLOCKHASH_LIFETIME]: "Transaction does not have a blockhash lifetime",
|
|
467
|
+
[SOLANA_ERROR__TRANSACTION_EXPECTED_NONCE_LIFETIME]: "Transaction is not a durable nonce transaction",
|
|
468
|
+
[SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING]: "Contents of these address lookup tables unknown: $lookupTableAddresses",
|
|
469
|
+
[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",
|
|
470
|
+
[SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_FEE_PAYER_MISSING]: "No fee payer set in CompiledTransaction",
|
|
471
|
+
[SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND]: "Could not find program address at index $index",
|
|
472
|
+
[SOLANA_ERROR__TRANSACTION_INVALID_NONCE_TRANSACTION_FIRST_INSTRUCTION_NOT_ADVANCE_NONCE]: "Transaction first instruction is not advance nonce account instruction.",
|
|
473
|
+
[SOLANA_ERROR__TRANSACTION_INVALID_NONCE_TRANSACTION_NO_INSTRUCTIONS]: "Transaction with no instructions cannot be durable nonce transaction.",
|
|
474
|
+
[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",
|
|
475
|
+
[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",
|
|
476
|
+
[SOLANA_ERROR__TRANSACTION_MISSING_ADDRESS]: "Transaction is missing an address at index: $index.",
|
|
477
|
+
[SOLANA_ERROR__TRANSACTION_MISSING_FEE_PAYER]: "Transaction is missing a fee payer.",
|
|
478
|
+
[SOLANA_ERROR__TRANSACTION_MISSING_SIGNATURES]: "Transaction is missing signatures for addresses: $addresses.",
|
|
479
|
+
[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.",
|
|
480
|
+
[SOLANA_ERROR__TRANSACTION_VERSION_NUMBER_OUT_OF_RANGE]: "Transaction version must be in the range [0, 127]. `$actualVersion` given"
|
|
481
|
+
};
|
|
482
|
+
function getHumanReadableErrorMessage(code, context = {}) {
|
|
483
|
+
const messageFormatString = SolanaErrorMessages[code];
|
|
484
|
+
const message = messageFormatString.replace(
|
|
485
|
+
new RegExp("(?<!\\\\)\\$(\\w+)", "g"),
|
|
486
|
+
(substring, variableName) => variableName in context ? `${context[variableName]}` : substring
|
|
487
|
+
);
|
|
488
|
+
return message;
|
|
489
|
+
}
|
|
490
|
+
function getErrorMessage(code, context = {}) {
|
|
491
|
+
{
|
|
492
|
+
return getHumanReadableErrorMessage(code, context);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
function isSolanaError(e4, code) {
|
|
496
|
+
const isSolanaError2 = e4 instanceof Error && e4.name === "SolanaError";
|
|
497
|
+
if (isSolanaError2) {
|
|
498
|
+
if (code !== void 0) {
|
|
499
|
+
return e4.context.__code === code;
|
|
500
|
+
}
|
|
501
|
+
return true;
|
|
502
|
+
}
|
|
503
|
+
return false;
|
|
504
|
+
}
|
|
505
|
+
var SolanaError = class extends Error {
|
|
506
|
+
constructor(...[code, contextAndErrorOptions]) {
|
|
507
|
+
let context;
|
|
508
|
+
let errorOptions;
|
|
509
|
+
if (contextAndErrorOptions) {
|
|
510
|
+
const { cause, ...contextRest } = contextAndErrorOptions;
|
|
511
|
+
if (cause) {
|
|
512
|
+
errorOptions = { cause };
|
|
513
|
+
}
|
|
514
|
+
if (Object.keys(contextRest).length > 0) {
|
|
515
|
+
context = contextRest;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
const message = getErrorMessage(code, context);
|
|
519
|
+
super(message, errorOptions);
|
|
520
|
+
__publicField(this, "context");
|
|
521
|
+
this.context = {
|
|
522
|
+
__code: code,
|
|
523
|
+
...context
|
|
524
|
+
};
|
|
525
|
+
this.name = "SolanaError";
|
|
526
|
+
}
|
|
527
|
+
};
|
|
528
|
+
function getSolanaErrorFromRpcError({ errorCodeBaseOffset, getErrorContext, orderedErrorNames, rpcEnumError }, constructorOpt) {
|
|
529
|
+
let rpcErrorName;
|
|
530
|
+
let rpcErrorContext;
|
|
531
|
+
if (typeof rpcEnumError === "string") {
|
|
532
|
+
rpcErrorName = rpcEnumError;
|
|
533
|
+
} else {
|
|
534
|
+
rpcErrorName = Object.keys(rpcEnumError)[0];
|
|
535
|
+
rpcErrorContext = rpcEnumError[rpcErrorName];
|
|
536
|
+
}
|
|
537
|
+
const codeOffset = orderedErrorNames.indexOf(rpcErrorName);
|
|
538
|
+
const errorCode = errorCodeBaseOffset + codeOffset;
|
|
539
|
+
const errorContext = getErrorContext(errorCode, rpcErrorName, rpcErrorContext);
|
|
540
|
+
const err = new SolanaError(errorCode, errorContext);
|
|
541
|
+
if ("captureStackTrace" in Error && typeof Error.captureStackTrace === "function") {
|
|
542
|
+
Error.captureStackTrace(err, constructorOpt);
|
|
543
|
+
}
|
|
544
|
+
return err;
|
|
545
|
+
}
|
|
546
|
+
var ORDERED_ERROR_NAMES = [
|
|
547
|
+
// Keep synced with RPC source: https://github.com/anza-xyz/agave/blob/master/sdk/program/src/instruction.rs
|
|
548
|
+
// If this list ever gets too large, consider implementing a compression strategy like this:
|
|
549
|
+
// https://gist.github.com/steveluscher/aaa7cbbb5433b1197983908a40860c47
|
|
550
|
+
"GenericError",
|
|
551
|
+
"InvalidArgument",
|
|
552
|
+
"InvalidInstructionData",
|
|
553
|
+
"InvalidAccountData",
|
|
554
|
+
"AccountDataTooSmall",
|
|
555
|
+
"InsufficientFunds",
|
|
556
|
+
"IncorrectProgramId",
|
|
557
|
+
"MissingRequiredSignature",
|
|
558
|
+
"AccountAlreadyInitialized",
|
|
559
|
+
"UninitializedAccount",
|
|
560
|
+
"UnbalancedInstruction",
|
|
561
|
+
"ModifiedProgramId",
|
|
562
|
+
"ExternalAccountLamportSpend",
|
|
563
|
+
"ExternalAccountDataModified",
|
|
564
|
+
"ReadonlyLamportChange",
|
|
565
|
+
"ReadonlyDataModified",
|
|
566
|
+
"DuplicateAccountIndex",
|
|
567
|
+
"ExecutableModified",
|
|
568
|
+
"RentEpochModified",
|
|
569
|
+
"NotEnoughAccountKeys",
|
|
570
|
+
"AccountDataSizeChanged",
|
|
571
|
+
"AccountNotExecutable",
|
|
572
|
+
"AccountBorrowFailed",
|
|
573
|
+
"AccountBorrowOutstanding",
|
|
574
|
+
"DuplicateAccountOutOfSync",
|
|
575
|
+
"Custom",
|
|
576
|
+
"InvalidError",
|
|
577
|
+
"ExecutableDataModified",
|
|
578
|
+
"ExecutableLamportChange",
|
|
579
|
+
"ExecutableAccountNotRentExempt",
|
|
580
|
+
"UnsupportedProgramId",
|
|
581
|
+
"CallDepth",
|
|
582
|
+
"MissingAccount",
|
|
583
|
+
"ReentrancyNotAllowed",
|
|
584
|
+
"MaxSeedLengthExceeded",
|
|
585
|
+
"InvalidSeeds",
|
|
586
|
+
"InvalidRealloc",
|
|
587
|
+
"ComputationalBudgetExceeded",
|
|
588
|
+
"PrivilegeEscalation",
|
|
589
|
+
"ProgramEnvironmentSetupFailure",
|
|
590
|
+
"ProgramFailedToComplete",
|
|
591
|
+
"ProgramFailedToCompile",
|
|
592
|
+
"Immutable",
|
|
593
|
+
"IncorrectAuthority",
|
|
594
|
+
"BorshIoError",
|
|
595
|
+
"AccountNotRentExempt",
|
|
596
|
+
"InvalidAccountOwner",
|
|
597
|
+
"ArithmeticOverflow",
|
|
598
|
+
"UnsupportedSysvar",
|
|
599
|
+
"IllegalOwner",
|
|
600
|
+
"MaxAccountsDataAllocationsExceeded",
|
|
601
|
+
"MaxAccountsExceeded",
|
|
602
|
+
"MaxInstructionTraceLengthExceeded",
|
|
603
|
+
"BuiltinProgramsMustConsumeComputeUnits"
|
|
604
|
+
];
|
|
605
|
+
function getSolanaErrorFromInstructionError(index, instructionError) {
|
|
606
|
+
return getSolanaErrorFromRpcError(
|
|
607
|
+
{
|
|
608
|
+
errorCodeBaseOffset: 4615001,
|
|
609
|
+
getErrorContext(errorCode, rpcErrorName, rpcErrorContext) {
|
|
610
|
+
if (errorCode === SOLANA_ERROR__INSTRUCTION_ERROR_UNKNOWN) {
|
|
611
|
+
return {
|
|
612
|
+
errorName: rpcErrorName,
|
|
613
|
+
index,
|
|
614
|
+
...rpcErrorContext !== void 0 ? { instructionErrorContext: rpcErrorContext } : null
|
|
615
|
+
};
|
|
616
|
+
} else if (errorCode === SOLANA_ERROR__INSTRUCTION_ERROR_CUSTOM) {
|
|
617
|
+
return {
|
|
618
|
+
code: rpcErrorContext,
|
|
619
|
+
index
|
|
620
|
+
};
|
|
621
|
+
} else if (errorCode === SOLANA_ERROR__INSTRUCTION_ERROR_BORSH_IO_ERROR) {
|
|
622
|
+
return {
|
|
623
|
+
encodedData: rpcErrorContext,
|
|
624
|
+
index
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
return { index };
|
|
628
|
+
},
|
|
629
|
+
orderedErrorNames: ORDERED_ERROR_NAMES,
|
|
630
|
+
rpcEnumError: instructionError
|
|
631
|
+
},
|
|
632
|
+
getSolanaErrorFromInstructionError
|
|
633
|
+
);
|
|
634
|
+
}
|
|
635
|
+
var ORDERED_ERROR_NAMES2 = [
|
|
636
|
+
// Keep synced with RPC source: https://github.com/anza-xyz/agave/blob/master/sdk/src/transaction/error.rs
|
|
637
|
+
// If this list ever gets too large, consider implementing a compression strategy like this:
|
|
638
|
+
// https://gist.github.com/steveluscher/aaa7cbbb5433b1197983908a40860c47
|
|
639
|
+
"AccountInUse",
|
|
640
|
+
"AccountLoadedTwice",
|
|
641
|
+
"AccountNotFound",
|
|
642
|
+
"ProgramAccountNotFound",
|
|
643
|
+
"InsufficientFundsForFee",
|
|
644
|
+
"InvalidAccountForFee",
|
|
645
|
+
"AlreadyProcessed",
|
|
646
|
+
"BlockhashNotFound",
|
|
647
|
+
// `InstructionError` intentionally omitted; delegated to `getSolanaErrorFromInstructionError`
|
|
648
|
+
"CallChainTooDeep",
|
|
649
|
+
"MissingSignatureForFee",
|
|
650
|
+
"InvalidAccountIndex",
|
|
651
|
+
"SignatureFailure",
|
|
652
|
+
"InvalidProgramForExecution",
|
|
653
|
+
"SanitizeFailure",
|
|
654
|
+
"ClusterMaintenance",
|
|
655
|
+
"AccountBorrowOutstanding",
|
|
656
|
+
"WouldExceedMaxBlockCostLimit",
|
|
657
|
+
"UnsupportedVersion",
|
|
658
|
+
"InvalidWritableAccount",
|
|
659
|
+
"WouldExceedMaxAccountCostLimit",
|
|
660
|
+
"WouldExceedAccountDataBlockLimit",
|
|
661
|
+
"TooManyAccountLocks",
|
|
662
|
+
"AddressLookupTableNotFound",
|
|
663
|
+
"InvalidAddressLookupTableOwner",
|
|
664
|
+
"InvalidAddressLookupTableData",
|
|
665
|
+
"InvalidAddressLookupTableIndex",
|
|
666
|
+
"InvalidRentPayingAccount",
|
|
667
|
+
"WouldExceedMaxVoteCostLimit",
|
|
668
|
+
"WouldExceedAccountDataTotalLimit",
|
|
669
|
+
"DuplicateInstruction",
|
|
670
|
+
"InsufficientFundsForRent",
|
|
671
|
+
"MaxLoadedAccountsDataSizeExceeded",
|
|
672
|
+
"InvalidLoadedAccountsDataSizeLimit",
|
|
673
|
+
"ResanitizationNeeded",
|
|
674
|
+
"ProgramExecutionTemporarilyRestricted",
|
|
675
|
+
"UnbalancedTransaction"
|
|
676
|
+
];
|
|
677
|
+
function getSolanaErrorFromTransactionError(transactionError) {
|
|
678
|
+
if (typeof transactionError === "object" && "InstructionError" in transactionError) {
|
|
679
|
+
return getSolanaErrorFromInstructionError(
|
|
680
|
+
...transactionError.InstructionError
|
|
681
|
+
);
|
|
682
|
+
}
|
|
683
|
+
return getSolanaErrorFromRpcError(
|
|
684
|
+
{
|
|
685
|
+
errorCodeBaseOffset: 7050001,
|
|
686
|
+
getErrorContext(errorCode, rpcErrorName, rpcErrorContext) {
|
|
687
|
+
if (errorCode === SOLANA_ERROR__TRANSACTION_ERROR_UNKNOWN) {
|
|
688
|
+
return {
|
|
689
|
+
errorName: rpcErrorName,
|
|
690
|
+
...rpcErrorContext !== void 0 ? { transactionErrorContext: rpcErrorContext } : null
|
|
691
|
+
};
|
|
692
|
+
} else if (errorCode === SOLANA_ERROR__TRANSACTION_ERROR_DUPLICATE_INSTRUCTION) {
|
|
693
|
+
return {
|
|
694
|
+
index: rpcErrorContext
|
|
695
|
+
};
|
|
696
|
+
} else if (errorCode === SOLANA_ERROR__TRANSACTION_ERROR_INSUFFICIENT_FUNDS_FOR_RENT || errorCode === SOLANA_ERROR__TRANSACTION_ERROR_PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED) {
|
|
697
|
+
return {
|
|
698
|
+
accountIndex: rpcErrorContext.account_index
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
},
|
|
702
|
+
orderedErrorNames: ORDERED_ERROR_NAMES2,
|
|
703
|
+
rpcEnumError: transactionError
|
|
704
|
+
},
|
|
705
|
+
getSolanaErrorFromTransactionError
|
|
706
|
+
);
|
|
707
|
+
}
|
|
708
|
+
|
|
128
709
|
// ../codecs-strings/dist/index.browser.js
|
|
129
710
|
init_env_shim();
|
|
130
711
|
|
|
@@ -132,13 +713,19 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
132
713
|
init_env_shim();
|
|
133
714
|
function assertByteArrayIsNotEmptyForCodec(codecDescription, bytes, offset = 0) {
|
|
134
715
|
if (bytes.length - offset <= 0) {
|
|
135
|
-
throw new
|
|
716
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_CANNOT_DECODE_EMPTY_BYTE_ARRAY, {
|
|
717
|
+
codecDescription
|
|
718
|
+
});
|
|
136
719
|
}
|
|
137
720
|
}
|
|
138
721
|
function assertByteArrayHasEnoughBytesForCodec(codecDescription, expected, bytes, offset = 0) {
|
|
139
722
|
const bytesLength = bytes.length - offset;
|
|
140
723
|
if (bytesLength < expected) {
|
|
141
|
-
throw new
|
|
724
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_WRONG_NUMBER_OF_BYTES, {
|
|
725
|
+
bytesLength,
|
|
726
|
+
codecDescription,
|
|
727
|
+
expected
|
|
728
|
+
});
|
|
142
729
|
}
|
|
143
730
|
}
|
|
144
731
|
var mergeBytes = (byteArrays) => {
|
|
@@ -199,32 +786,34 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
199
786
|
function isFixedSize(codec) {
|
|
200
787
|
return "fixedSize" in codec && typeof codec.fixedSize === "number";
|
|
201
788
|
}
|
|
202
|
-
function assertIsFixedSize(codec
|
|
789
|
+
function assertIsFixedSize(codec) {
|
|
203
790
|
if (!isFixedSize(codec)) {
|
|
204
|
-
throw new
|
|
791
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_EXPECTED_FIXED_LENGTH_GOT_VARIABLE_LENGTH);
|
|
205
792
|
}
|
|
206
793
|
}
|
|
207
794
|
function isVariableSize(codec) {
|
|
208
795
|
return !isFixedSize(codec);
|
|
209
796
|
}
|
|
210
|
-
function assertIsVariableSize(codec
|
|
797
|
+
function assertIsVariableSize(codec) {
|
|
211
798
|
if (!isVariableSize(codec)) {
|
|
212
|
-
throw new
|
|
799
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_EXPECTED_VARIABLE_LENGTH_GOT_FIXED_LENGTH);
|
|
213
800
|
}
|
|
214
801
|
}
|
|
215
802
|
function combineCodec(encoder, decoder) {
|
|
216
803
|
if (isFixedSize(encoder) !== isFixedSize(decoder)) {
|
|
217
|
-
throw new
|
|
804
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH);
|
|
218
805
|
}
|
|
219
806
|
if (isFixedSize(encoder) && isFixedSize(decoder) && encoder.fixedSize !== decoder.fixedSize) {
|
|
220
|
-
throw new
|
|
221
|
-
|
|
222
|
-
|
|
807
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_FIXED_SIZE_ENCODER_DECODER_SIZE_MISMATCH, {
|
|
808
|
+
decoderFixedSize: decoder.fixedSize,
|
|
809
|
+
encoderFixedSize: encoder.fixedSize
|
|
810
|
+
});
|
|
223
811
|
}
|
|
224
812
|
if (!isFixedSize(encoder) && !isFixedSize(decoder) && encoder.maxSize !== decoder.maxSize) {
|
|
225
|
-
throw new
|
|
226
|
-
|
|
227
|
-
|
|
813
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_VARIABLE_SIZE_ENCODER_DECODER_MAX_SIZE_MISMATCH, {
|
|
814
|
+
decoderMaxSize: decoder.maxSize,
|
|
815
|
+
encoderMaxSize: encoder.maxSize
|
|
816
|
+
});
|
|
228
817
|
}
|
|
229
818
|
return {
|
|
230
819
|
...decoder,
|
|
@@ -287,7 +876,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
287
876
|
});
|
|
288
877
|
}
|
|
289
878
|
function reverseEncoder(encoder) {
|
|
290
|
-
assertIsFixedSize(encoder
|
|
879
|
+
assertIsFixedSize(encoder);
|
|
291
880
|
return createEncoder({
|
|
292
881
|
...encoder,
|
|
293
882
|
write: (value, bytes, offset) => {
|
|
@@ -299,7 +888,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
299
888
|
});
|
|
300
889
|
}
|
|
301
890
|
function reverseDecoder(decoder) {
|
|
302
|
-
assertIsFixedSize(decoder
|
|
891
|
+
assertIsFixedSize(decoder);
|
|
303
892
|
return createDecoder({
|
|
304
893
|
...decoder,
|
|
305
894
|
read: (bytes, offset) => {
|
|
@@ -321,9 +910,12 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
321
910
|
init_env_shim();
|
|
322
911
|
function assertNumberIsBetweenForCodec(codecDescription, min, max, value) {
|
|
323
912
|
if (value < min || value > max) {
|
|
324
|
-
throw new
|
|
325
|
-
|
|
326
|
-
|
|
913
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_NUMBER_OUT_OF_RANGE, {
|
|
914
|
+
codecDescription,
|
|
915
|
+
max,
|
|
916
|
+
min,
|
|
917
|
+
value
|
|
918
|
+
});
|
|
327
919
|
}
|
|
328
920
|
}
|
|
329
921
|
var Endian = /* @__PURE__ */ ((Endian2) => {
|
|
@@ -518,7 +1110,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
518
1110
|
var getU128Encoder = (config = {}) => numberEncoderFactory({
|
|
519
1111
|
config,
|
|
520
1112
|
name: "u128",
|
|
521
|
-
range: [
|
|
1113
|
+
range: [0n, BigInt("0xffffffffffffffffffffffffffffffff")],
|
|
522
1114
|
set: (view, value, le) => {
|
|
523
1115
|
const leftOffset = le ? 8 : 0;
|
|
524
1116
|
const rightOffset = le ? 0 : 8;
|
|
@@ -572,7 +1164,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
572
1164
|
var getU64Encoder = (config = {}) => numberEncoderFactory({
|
|
573
1165
|
config,
|
|
574
1166
|
name: "u64",
|
|
575
|
-
range: [
|
|
1167
|
+
range: [0n, BigInt("0xffffffffffffffff")],
|
|
576
1168
|
set: (view, value, le) => view.setBigUint64(0, BigInt(value), le),
|
|
577
1169
|
size: 8
|
|
578
1170
|
});
|
|
@@ -599,7 +1191,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
599
1191
|
// ../codecs-strings/dist/index.browser.js
|
|
600
1192
|
function assertValidBaseString(alphabet4, testValue, givenValue = testValue) {
|
|
601
1193
|
if (!testValue.match(new RegExp(`^[${alphabet4}]*$`))) {
|
|
602
|
-
throw new
|
|
1194
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_INVALID_STRING_FOR_BASE, {
|
|
1195
|
+
alphabet: alphabet4,
|
|
1196
|
+
base: alphabet4.length,
|
|
1197
|
+
value: givenValue
|
|
1198
|
+
});
|
|
603
1199
|
}
|
|
604
1200
|
}
|
|
605
1201
|
var getBaseXEncoder = (alphabet4) => {
|
|
@@ -738,6 +1334,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
738
1334
|
}
|
|
739
1335
|
return output;
|
|
740
1336
|
}
|
|
1337
|
+
var alphabet3 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
741
1338
|
var getBase64Encoder = () => {
|
|
742
1339
|
{
|
|
743
1340
|
return createEncoder({
|
|
@@ -745,7 +1342,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
745
1342
|
try {
|
|
746
1343
|
return atob(value).length;
|
|
747
1344
|
} catch (e22) {
|
|
748
|
-
throw new
|
|
1345
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_INVALID_STRING_FOR_BASE, {
|
|
1346
|
+
alphabet: alphabet3,
|
|
1347
|
+
base: 64,
|
|
1348
|
+
value
|
|
1349
|
+
});
|
|
749
1350
|
}
|
|
750
1351
|
},
|
|
751
1352
|
write(value, bytes, offset) {
|
|
@@ -754,7 +1355,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
754
1355
|
bytes.set(bytesToAdd, offset);
|
|
755
1356
|
return bytesToAdd.length + offset;
|
|
756
1357
|
} catch (e22) {
|
|
757
|
-
throw new
|
|
1358
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_INVALID_STRING_FOR_BASE, {
|
|
1359
|
+
alphabet: alphabet3,
|
|
1360
|
+
base: 64,
|
|
1361
|
+
value
|
|
1362
|
+
});
|
|
758
1363
|
}
|
|
759
1364
|
}
|
|
760
1365
|
});
|
|
@@ -858,10 +1463,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
858
1463
|
return encodedAccount;
|
|
859
1464
|
}
|
|
860
1465
|
return Object.freeze({ ...encodedAccount, data: decoder.decode(encodedAccount.data) });
|
|
861
|
-
} catch (
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
1466
|
+
} catch (e4) {
|
|
1467
|
+
throw new SolanaError(SOLANA_ERROR__FAILED_TO_DECODE_ACCOUNT, {
|
|
1468
|
+
address: encodedAccount.address
|
|
1469
|
+
});
|
|
865
1470
|
}
|
|
866
1471
|
}
|
|
867
1472
|
function accountExists(account) {
|
|
@@ -869,14 +1474,18 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
869
1474
|
}
|
|
870
1475
|
function assertAccountDecoded(account) {
|
|
871
1476
|
if (accountExists(account) && account.data instanceof Uint8Array) {
|
|
872
|
-
throw new
|
|
1477
|
+
throw new SolanaError(SOLANA_ERROR__EXPECTED_DECODED_ACCOUNT, {
|
|
1478
|
+
address: account.address
|
|
1479
|
+
});
|
|
873
1480
|
}
|
|
874
1481
|
}
|
|
875
1482
|
function assertAccountsDecoded(accounts) {
|
|
876
1483
|
const encoded = accounts.filter((a) => accountExists(a) && a.data instanceof Uint8Array);
|
|
877
1484
|
if (encoded.length > 0) {
|
|
878
|
-
const encodedAddresses = encoded.map((a) => a.address)
|
|
879
|
-
throw new
|
|
1485
|
+
const encodedAddresses = encoded.map((a) => a.address);
|
|
1486
|
+
throw new SolanaError(SOLANA_ERROR__NOT_ALL_ACCOUNTS_DECODED, {
|
|
1487
|
+
addresses: encodedAddresses
|
|
1488
|
+
});
|
|
880
1489
|
}
|
|
881
1490
|
}
|
|
882
1491
|
function parseBase64RpcAccount(address2, rpcAccount) {
|
|
@@ -928,14 +1537,14 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
928
1537
|
}
|
|
929
1538
|
function assertAccountExists(account) {
|
|
930
1539
|
if (!account.exists) {
|
|
931
|
-
throw new
|
|
1540
|
+
throw new SolanaError(SOLANA_ERROR__ACCOUNT_NOT_FOUND, { address: account.address });
|
|
932
1541
|
}
|
|
933
1542
|
}
|
|
934
1543
|
function assertAccountsExist(accounts) {
|
|
935
1544
|
const missingAccounts = accounts.filter((a) => !a.exists);
|
|
936
1545
|
if (missingAccounts.length > 0) {
|
|
937
1546
|
const missingAddresses = missingAccounts.map((a) => a.address);
|
|
938
|
-
throw new
|
|
1547
|
+
throw new SolanaError(SOLANA_ERROR__MULTIPLE_ACCOUNTS_NOT_FOUND, { addresses: missingAddresses });
|
|
939
1548
|
}
|
|
940
1549
|
}
|
|
941
1550
|
|
|
@@ -946,9 +1555,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
946
1555
|
init_env_shim();
|
|
947
1556
|
function assertIsSecureContext() {
|
|
948
1557
|
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
|
-
);
|
|
1558
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_MISSING);
|
|
952
1559
|
}
|
|
953
1560
|
}
|
|
954
1561
|
var cachedEd25519Decision;
|
|
@@ -977,40 +1584,38 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
977
1584
|
var _a;
|
|
978
1585
|
assertIsSecureContext();
|
|
979
1586
|
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.digest) !== "function") {
|
|
980
|
-
throw new
|
|
1587
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_DIGEST_MISSING);
|
|
981
1588
|
}
|
|
982
1589
|
}
|
|
983
1590
|
async function assertKeyGenerationIsAvailable() {
|
|
984
1591
|
var _a;
|
|
985
1592
|
assertIsSecureContext();
|
|
986
1593
|
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.generateKey) !== "function") {
|
|
987
|
-
throw new
|
|
1594
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_GENERATE_FUNCTION_MISSING);
|
|
988
1595
|
}
|
|
989
1596
|
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
|
-
);
|
|
1597
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_ED25519_ALGORITHM_MISSING);
|
|
993
1598
|
}
|
|
994
1599
|
}
|
|
995
1600
|
async function assertKeyExporterIsAvailable() {
|
|
996
1601
|
var _a;
|
|
997
1602
|
assertIsSecureContext();
|
|
998
1603
|
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.exportKey) !== "function") {
|
|
999
|
-
throw new
|
|
1604
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_EXPORT_FUNCTION_MISSING);
|
|
1000
1605
|
}
|
|
1001
1606
|
}
|
|
1002
1607
|
async function assertSigningCapabilityIsAvailable() {
|
|
1003
1608
|
var _a;
|
|
1004
1609
|
assertIsSecureContext();
|
|
1005
1610
|
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.sign) !== "function") {
|
|
1006
|
-
throw new
|
|
1611
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_SIGN_FUNCTION_MISSING);
|
|
1007
1612
|
}
|
|
1008
1613
|
}
|
|
1009
1614
|
async function assertVerificationCapabilityIsAvailable() {
|
|
1010
1615
|
var _a;
|
|
1011
1616
|
assertIsSecureContext();
|
|
1012
1617
|
if (typeof globalThis.crypto === "undefined" || typeof ((_a = globalThis.crypto.subtle) == null ? void 0 : _a.verify) !== "function") {
|
|
1013
|
-
throw new
|
|
1618
|
+
throw new SolanaError(SOLANA_ERROR__SUBTLE_CRYPTO_VERIFY_FUNCTION_MISSING);
|
|
1014
1619
|
}
|
|
1015
1620
|
}
|
|
1016
1621
|
|
|
@@ -1044,23 +1649,21 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1044
1649
|
return true;
|
|
1045
1650
|
}
|
|
1046
1651
|
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
|
|
1652
|
+
if (
|
|
1653
|
+
// Lowest address (32 bytes of zeroes)
|
|
1654
|
+
putativeAddress.length < 32 || // Highest address (32 bytes of 255)
|
|
1655
|
+
putativeAddress.length > 44
|
|
1656
|
+
) {
|
|
1657
|
+
throw new SolanaError(SOLANA_ERROR__ADDRESS_STRING_LENGTH_OUT_OF_RANGE, {
|
|
1658
|
+
actualLength: putativeAddress.length
|
|
1659
|
+
});
|
|
1660
|
+
}
|
|
1661
|
+
const base58Encoder4 = getMemoizedBase58Encoder();
|
|
1662
|
+
const bytes = base58Encoder4.encode(putativeAddress);
|
|
1663
|
+
const numBytes = bytes.byteLength;
|
|
1664
|
+
if (numBytes !== 32) {
|
|
1665
|
+
throw new SolanaError(SOLANA_ERROR__ADDRESS_BYTE_LENGTH_OUT_OF_RANGE, {
|
|
1666
|
+
actualLength: numBytes
|
|
1064
1667
|
});
|
|
1065
1668
|
}
|
|
1066
1669
|
}
|
|
@@ -1182,12 +1785,12 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1182
1785
|
function assertIsProgramDerivedAddress(value) {
|
|
1183
1786
|
const validFormat = Array.isArray(value) && value.length === 2 && typeof value[0] === "string" && typeof value[1] === "number";
|
|
1184
1787
|
if (!validFormat) {
|
|
1185
|
-
throw new
|
|
1186
|
-
`Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].`
|
|
1187
|
-
);
|
|
1788
|
+
throw new SolanaError(SOLANA_ERROR__MALFORMED_PROGRAM_DERIVED_ADDRESS);
|
|
1188
1789
|
}
|
|
1189
1790
|
if (value[1] < 0 || value[1] > 255) {
|
|
1190
|
-
throw new
|
|
1791
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_DERIVED_ADDRESS_BUMP_SEED_OUT_OF_RANGE, {
|
|
1792
|
+
bump: value[1]
|
|
1793
|
+
});
|
|
1191
1794
|
}
|
|
1192
1795
|
assertIsAddress(value[0]);
|
|
1193
1796
|
}
|
|
@@ -1217,18 +1820,23 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1217
1820
|
115,
|
|
1218
1821
|
115
|
|
1219
1822
|
];
|
|
1220
|
-
var PointOnCurveError = class extends Error {
|
|
1221
|
-
};
|
|
1222
1823
|
async function createProgramDerivedAddress({ programAddress, seeds }) {
|
|
1223
1824
|
await assertDigestCapabilityIsAvailable();
|
|
1224
1825
|
if (seeds.length > MAX_SEEDS) {
|
|
1225
|
-
throw new
|
|
1826
|
+
throw new SolanaError(SOLANA_ERROR__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED, {
|
|
1827
|
+
actual: seeds.length,
|
|
1828
|
+
maxSeeds: MAX_SEEDS
|
|
1829
|
+
});
|
|
1226
1830
|
}
|
|
1227
1831
|
let textEncoder;
|
|
1228
1832
|
const seedBytes = seeds.reduce((acc, seed, ii) => {
|
|
1229
1833
|
const bytes = typeof seed === "string" ? (textEncoder || (textEncoder = new TextEncoder())).encode(seed) : seed;
|
|
1230
1834
|
if (bytes.byteLength > MAX_SEED_LENGTH) {
|
|
1231
|
-
throw new
|
|
1835
|
+
throw new SolanaError(SOLANA_ERROR__MAX_PDA_SEED_LENGTH_EXCEEDED, {
|
|
1836
|
+
actual: bytes.byteLength,
|
|
1837
|
+
index: ii,
|
|
1838
|
+
maxSeedLength: MAX_SEED_LENGTH
|
|
1839
|
+
});
|
|
1232
1840
|
}
|
|
1233
1841
|
acc.push(...bytes);
|
|
1234
1842
|
return acc;
|
|
@@ -1241,7 +1849,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1241
1849
|
);
|
|
1242
1850
|
const addressBytes = new Uint8Array(addressBytesBuffer);
|
|
1243
1851
|
if (await compressedPointBytesAreOnCurve(addressBytes)) {
|
|
1244
|
-
throw new
|
|
1852
|
+
throw new SolanaError(SOLANA_ERROR__INVALID_SEEDS_POINT_ON_CURVE);
|
|
1245
1853
|
}
|
|
1246
1854
|
return base58EncodedAddressCodec.decode(addressBytes);
|
|
1247
1855
|
}
|
|
@@ -1258,24 +1866,28 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1258
1866
|
});
|
|
1259
1867
|
return [address2, bumpSeed];
|
|
1260
1868
|
} catch (e4) {
|
|
1261
|
-
if (e4
|
|
1869
|
+
if (isSolanaError(e4, SOLANA_ERROR__INVALID_SEEDS_POINT_ON_CURVE)) {
|
|
1262
1870
|
bumpSeed--;
|
|
1263
1871
|
} else {
|
|
1264
1872
|
throw e4;
|
|
1265
1873
|
}
|
|
1266
1874
|
}
|
|
1267
1875
|
}
|
|
1268
|
-
throw new
|
|
1876
|
+
throw new SolanaError(SOLANA_ERROR__COULD_NOT_FIND_VIABLE_PDA_BUMP_SEED);
|
|
1269
1877
|
}
|
|
1270
1878
|
async function createAddressWithSeed({ baseAddress, programAddress, seed }) {
|
|
1271
1879
|
const { encode, decode } = getAddressCodec();
|
|
1272
1880
|
const seedBytes = typeof seed === "string" ? new TextEncoder().encode(seed) : seed;
|
|
1273
1881
|
if (seedBytes.byteLength > MAX_SEED_LENGTH) {
|
|
1274
|
-
throw new
|
|
1882
|
+
throw new SolanaError(SOLANA_ERROR__MAX_PDA_SEED_LENGTH_EXCEEDED, {
|
|
1883
|
+
actual: seedBytes.byteLength,
|
|
1884
|
+
index: 0,
|
|
1885
|
+
maxSeedLength: MAX_SEED_LENGTH
|
|
1886
|
+
});
|
|
1275
1887
|
}
|
|
1276
1888
|
const programAddressBytes = encode(programAddress);
|
|
1277
1889
|
if (programAddressBytes.length >= PDA_MARKER_BYTES.length && programAddressBytes.slice(-PDA_MARKER_BYTES.length).every((byte, index) => byte === PDA_MARKER_BYTES[index])) {
|
|
1278
|
-
throw new
|
|
1890
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_ADDRESS_ENDS_WITH_PDA_MARKER);
|
|
1279
1891
|
}
|
|
1280
1892
|
const addressBytesBuffer = await crypto.subtle.digest(
|
|
1281
1893
|
"SHA-256",
|
|
@@ -1287,7 +1899,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1287
1899
|
async function getAddressFromPublicKey(publicKey) {
|
|
1288
1900
|
await assertKeyExporterIsAvailable();
|
|
1289
1901
|
if (publicKey.type !== "public" || publicKey.algorithm.name !== "Ed25519") {
|
|
1290
|
-
throw new
|
|
1902
|
+
throw new SolanaError(SOLANA_ERROR__NOT_AN_ED25519_PUBLIC_KEY);
|
|
1291
1903
|
}
|
|
1292
1904
|
const publicKeyBytes = await crypto.subtle.exportKey("raw", publicKey);
|
|
1293
1905
|
return getAddressDecoder().decode(new Uint8Array(publicKeyBytes));
|
|
@@ -1297,7 +1909,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1297
1909
|
init_env_shim();
|
|
1298
1910
|
function assertValidNumberOfItemsForCodec(codecDescription, expected, actual) {
|
|
1299
1911
|
if (expected !== actual) {
|
|
1300
|
-
throw new
|
|
1912
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_WRONG_NUMBER_OF_ITEMS, {
|
|
1913
|
+
actual,
|
|
1914
|
+
codecDescription,
|
|
1915
|
+
expected
|
|
1916
|
+
});
|
|
1301
1917
|
}
|
|
1302
1918
|
}
|
|
1303
1919
|
function maxCodecSizes(sizes) {
|
|
@@ -1443,13 +2059,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1443
2059
|
function getBooleanEncoder(config = {}) {
|
|
1444
2060
|
var _a;
|
|
1445
2061
|
const size = (_a = config.size) != null ? _a : getU8Encoder();
|
|
1446
|
-
assertIsFixedSize(size
|
|
2062
|
+
assertIsFixedSize(size);
|
|
1447
2063
|
return mapEncoder(size, (value) => value ? 1 : 0);
|
|
1448
2064
|
}
|
|
1449
2065
|
function getBooleanDecoder(config = {}) {
|
|
1450
2066
|
var _a;
|
|
1451
2067
|
const size = (_a = config.size) != null ? _a : getU8Decoder();
|
|
1452
|
-
assertIsFixedSize(size
|
|
2068
|
+
assertIsFixedSize(size);
|
|
1453
2069
|
return mapDecoder(size, (value) => Number(value) === 1);
|
|
1454
2070
|
}
|
|
1455
2071
|
function getBooleanCodec(config = {}) {
|
|
@@ -1545,9 +2161,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1545
2161
|
offset = dOffset;
|
|
1546
2162
|
const variantField = (_a2 = variants[Number(discriminator)]) != null ? _a2 : null;
|
|
1547
2163
|
if (!variantField) {
|
|
1548
|
-
throw new
|
|
1549
|
-
|
|
1550
|
-
|
|
2164
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_ENUM_DISCRIMINATOR_OUT_OF_RANGE, {
|
|
2165
|
+
discriminator,
|
|
2166
|
+
maxRange: variants.length - 1,
|
|
2167
|
+
minRange: 0
|
|
2168
|
+
});
|
|
1551
2169
|
}
|
|
1552
2170
|
const [variant, vOffset] = variantField[1].read(bytes, offset);
|
|
1553
2171
|
offset = vOffset;
|
|
@@ -1582,9 +2200,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1582
2200
|
function getVariantDiscriminator(variants, variant) {
|
|
1583
2201
|
const discriminator = variants.findIndex(([key]) => variant.__kind === key);
|
|
1584
2202
|
if (discriminator < 0) {
|
|
1585
|
-
throw new
|
|
1586
|
-
|
|
1587
|
-
|
|
2203
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_INVALID_DATA_ENUM_VARIANT, {
|
|
2204
|
+
value: variant.__kind,
|
|
2205
|
+
variants: variants.map(([key]) => key)
|
|
2206
|
+
});
|
|
1588
2207
|
}
|
|
1589
2208
|
return discriminator;
|
|
1590
2209
|
}
|
|
@@ -1650,8 +2269,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1650
2269
|
const fixed = (_b = config.fixed) != null ? _b : false;
|
|
1651
2270
|
const isZeroSizeItem = isFixedSize(item) && isFixedSize(prefix) && item.fixedSize === 0;
|
|
1652
2271
|
if (fixed || isZeroSizeItem) {
|
|
1653
|
-
assertIsFixedSize(item
|
|
1654
|
-
assertIsFixedSize(prefix
|
|
2272
|
+
assertIsFixedSize(item);
|
|
2273
|
+
assertIsFixedSize(prefix);
|
|
1655
2274
|
const fixedSize = prefix.fixedSize + item.fixedSize;
|
|
1656
2275
|
return createEncoder({
|
|
1657
2276
|
fixedSize,
|
|
@@ -1683,8 +2302,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1683
2302
|
let fixedSize = null;
|
|
1684
2303
|
const isZeroSizeItem = isFixedSize(item) && isFixedSize(prefix) && item.fixedSize === 0;
|
|
1685
2304
|
if (fixed || isZeroSizeItem) {
|
|
1686
|
-
assertIsFixedSize(item
|
|
1687
|
-
assertIsFixedSize(prefix
|
|
2305
|
+
assertIsFixedSize(item);
|
|
2306
|
+
assertIsFixedSize(prefix);
|
|
1688
2307
|
fixedSize = prefix.fixedSize + item.fixedSize;
|
|
1689
2308
|
}
|
|
1690
2309
|
return createDecoder({
|
|
@@ -1714,9 +2333,12 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1714
2333
|
const isInvalidNumber = typeof value === "number" && (value < minRange || value > maxRange);
|
|
1715
2334
|
const isInvalidString = typeof value === "string" && !allStringInputs.includes(value);
|
|
1716
2335
|
if (isInvalidNumber || isInvalidString) {
|
|
1717
|
-
throw new
|
|
1718
|
-
|
|
1719
|
-
|
|
2336
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_INVALID_SCALAR_ENUM_VARIANT, {
|
|
2337
|
+
maxRange,
|
|
2338
|
+
minRange,
|
|
2339
|
+
value,
|
|
2340
|
+
variants: allStringInputs
|
|
2341
|
+
});
|
|
1720
2342
|
}
|
|
1721
2343
|
if (typeof value === "number")
|
|
1722
2344
|
return value;
|
|
@@ -1733,9 +2355,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1733
2355
|
return mapDecoder(prefix, (value) => {
|
|
1734
2356
|
const valueAsNumber = Number(value);
|
|
1735
2357
|
if (valueAsNumber < minRange || valueAsNumber > maxRange) {
|
|
1736
|
-
throw new
|
|
1737
|
-
|
|
1738
|
-
|
|
2358
|
+
throw new SolanaError(SOLANA_ERROR__CODECS_ENUM_DISCRIMINATOR_OUT_OF_RANGE, {
|
|
2359
|
+
discriminator: valueAsNumber,
|
|
2360
|
+
maxRange,
|
|
2361
|
+
minRange
|
|
2362
|
+
});
|
|
1739
2363
|
}
|
|
1740
2364
|
return constructor[enumKeys[valueAsNumber]];
|
|
1741
2365
|
});
|
|
@@ -1849,8 +2473,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1849
2473
|
const fixed = (_b = config.fixed) != null ? _b : false;
|
|
1850
2474
|
const isZeroSizeItem = isFixedSize(item) && isFixedSize(prefix) && item.fixedSize === 0;
|
|
1851
2475
|
if (fixed || isZeroSizeItem) {
|
|
1852
|
-
assertIsFixedSize(item
|
|
1853
|
-
assertIsFixedSize(prefix
|
|
2476
|
+
assertIsFixedSize(item);
|
|
2477
|
+
assertIsFixedSize(prefix);
|
|
1854
2478
|
const fixedSize = prefix.fixedSize + item.fixedSize;
|
|
1855
2479
|
return createEncoder({
|
|
1856
2480
|
fixedSize,
|
|
@@ -1887,8 +2511,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1887
2511
|
let fixedSize = null;
|
|
1888
2512
|
const isZeroSizeItem = isFixedSize(item) && isFixedSize(prefix) && item.fixedSize === 0;
|
|
1889
2513
|
if (fixed || isZeroSizeItem) {
|
|
1890
|
-
assertIsFixedSize(item
|
|
1891
|
-
assertIsFixedSize(prefix
|
|
2514
|
+
assertIsFixedSize(item);
|
|
2515
|
+
assertIsFixedSize(prefix);
|
|
1892
2516
|
fixedSize = prefix.fixedSize + item.fixedSize;
|
|
1893
2517
|
}
|
|
1894
2518
|
return createDecoder({
|
|
@@ -1943,6 +2567,40 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1943
2567
|
|
|
1944
2568
|
// ../instructions/dist/index.browser.js
|
|
1945
2569
|
init_env_shim();
|
|
2570
|
+
function isInstructionForProgram(instruction, programAddress) {
|
|
2571
|
+
return instruction.programAddress === programAddress;
|
|
2572
|
+
}
|
|
2573
|
+
function assertIsInstructionForProgram(instruction, programAddress) {
|
|
2574
|
+
if (instruction.programAddress !== programAddress) {
|
|
2575
|
+
throw new SolanaError(SOLANA_ERROR__INSTRUCTION_PROGRAM_ID_MISMATCH, {
|
|
2576
|
+
actualProgramAddress: instruction.programAddress,
|
|
2577
|
+
expectedProgramAddress: programAddress
|
|
2578
|
+
});
|
|
2579
|
+
}
|
|
2580
|
+
}
|
|
2581
|
+
function isInstructionWithAccounts(instruction) {
|
|
2582
|
+
return instruction.accounts !== void 0;
|
|
2583
|
+
}
|
|
2584
|
+
function assertIsInstructionWithAccounts(instruction) {
|
|
2585
|
+
if (instruction.accounts === void 0) {
|
|
2586
|
+
throw new SolanaError(SOLANA_ERROR__EXPECTED_INSTRUCTION_TO_HAVE_ACCOUNTS, {
|
|
2587
|
+
data: instruction.data,
|
|
2588
|
+
programAddress: instruction.programAddress
|
|
2589
|
+
});
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
function isInstructionWithData(instruction) {
|
|
2593
|
+
return instruction.data !== void 0;
|
|
2594
|
+
}
|
|
2595
|
+
function assertIsInstructionWithData(instruction) {
|
|
2596
|
+
var _a;
|
|
2597
|
+
if (instruction.data === void 0) {
|
|
2598
|
+
throw new SolanaError(SOLANA_ERROR__EXPECTED_INSTRUCTION_TO_HAVE_DATA, {
|
|
2599
|
+
accountAddresses: (_a = instruction.accounts) == null ? void 0 : _a.map((a) => a.address),
|
|
2600
|
+
programAddress: instruction.programAddress
|
|
2601
|
+
});
|
|
2602
|
+
}
|
|
2603
|
+
}
|
|
1946
2604
|
var AccountRole = /* @__PURE__ */ ((AccountRole22) => {
|
|
1947
2605
|
AccountRole22[AccountRole22["WRITABLE_SIGNER"] = /* 3 */
|
|
1948
2606
|
3] = "WRITABLE_SIGNER";
|
|
@@ -1980,52 +2638,6 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1980
2638
|
|
|
1981
2639
|
// ../keys/dist/index.browser.js
|
|
1982
2640
|
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
2641
|
function addPkcs8Header(bytes) {
|
|
2030
2642
|
return new Uint8Array([
|
|
2031
2643
|
/**
|
|
@@ -2725,17 +3337,6 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2725
3337
|
// ../rpc-transport-http/dist/index.browser.js
|
|
2726
3338
|
init_env_shim();
|
|
2727
3339
|
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
3340
|
var DISALLOWED_HEADERS = {
|
|
2740
3341
|
accept: true,
|
|
2741
3342
|
"content-length": true,
|
|
@@ -2756,9 +3357,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2756
3357
|
"keep-alive": true,
|
|
2757
3358
|
origin: true,
|
|
2758
3359
|
"permissions-policy": true,
|
|
2759
|
-
//
|
|
2760
|
-
// 'proxy-':true,
|
|
2761
|
-
// 'sec-':true,
|
|
3360
|
+
// Prefix matching is implemented in code, below.
|
|
3361
|
+
// 'proxy-': true,
|
|
3362
|
+
// 'sec-': true,
|
|
2762
3363
|
referer: true,
|
|
2763
3364
|
te: true,
|
|
2764
3365
|
trailer: true,
|
|
@@ -2772,9 +3373,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2772
3373
|
return DISALLOWED_HEADERS[headerName.toLowerCase()] === true || FORBIDDEN_HEADERS[headerName.toLowerCase()] === true || lowercaseHeaderName.startsWith("proxy-") || lowercaseHeaderName.startsWith("sec-");
|
|
2773
3374
|
});
|
|
2774
3375
|
if (badHeaders.length > 0) {
|
|
2775
|
-
throw new
|
|
2776
|
-
|
|
2777
|
-
);
|
|
3376
|
+
throw new SolanaError(SOLANA_ERROR__RPC_TRANSPORT_HEADER_FORBIDDEN, {
|
|
3377
|
+
headers: badHeaders
|
|
3378
|
+
});
|
|
2778
3379
|
}
|
|
2779
3380
|
}
|
|
2780
3381
|
function normalizeHeaders(headers) {
|
|
@@ -2784,10 +3385,25 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2784
3385
|
}
|
|
2785
3386
|
return out;
|
|
2786
3387
|
}
|
|
2787
|
-
|
|
3388
|
+
var didWarnDispatcherWasSuppliedInNonNodeEnvironment = false;
|
|
3389
|
+
function warnDispatcherWasSuppliedInNonNodeEnvironment() {
|
|
3390
|
+
if (didWarnDispatcherWasSuppliedInNonNodeEnvironment) {
|
|
3391
|
+
return;
|
|
3392
|
+
}
|
|
3393
|
+
didWarnDispatcherWasSuppliedInNonNodeEnvironment = true;
|
|
3394
|
+
console.warn(
|
|
3395
|
+
"You have supplied a `Dispatcher` to `createHttpTransport()`. It has been ignored because Undici dispatchers only work in Node environments. To eliminate this warning, omit the `dispatcher_NODE_ONLY` property from your config when running in a non-Node environment."
|
|
3396
|
+
);
|
|
3397
|
+
}
|
|
3398
|
+
function createHttpTransport(config) {
|
|
3399
|
+
if ("dispatcher_NODE_ONLY" in config) {
|
|
3400
|
+
warnDispatcherWasSuppliedInNonNodeEnvironment();
|
|
3401
|
+
}
|
|
3402
|
+
const { headers, url } = config;
|
|
2788
3403
|
if (headers) {
|
|
2789
3404
|
assertIsAllowedHttpRequestHeaders(headers);
|
|
2790
3405
|
}
|
|
3406
|
+
let dispatcherConfig;
|
|
2791
3407
|
const customHeaders = headers && normalizeHeaders(headers);
|
|
2792
3408
|
return async function makeHttpRequest({
|
|
2793
3409
|
payload,
|
|
@@ -2795,6 +3411,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2795
3411
|
}) {
|
|
2796
3412
|
const body = JSON.stringify(payload);
|
|
2797
3413
|
const requestInfo = {
|
|
3414
|
+
...dispatcherConfig,
|
|
2798
3415
|
body,
|
|
2799
3416
|
headers: {
|
|
2800
3417
|
...customHeaders,
|
|
@@ -2808,7 +3425,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2808
3425
|
};
|
|
2809
3426
|
const response = await e2(url, requestInfo);
|
|
2810
3427
|
if (!response.ok) {
|
|
2811
|
-
throw new
|
|
3428
|
+
throw new SolanaError(SOLANA_ERROR__RPC_TRANSPORT_HTTP_ERROR, {
|
|
2812
3429
|
message: response.statusText,
|
|
2813
3430
|
statusCode: response.status
|
|
2814
3431
|
});
|
|
@@ -2857,10 +3474,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2857
3474
|
throw createSolanaJsonRpcIntegerOverflowError(methodName, keyPath, value);
|
|
2858
3475
|
}
|
|
2859
3476
|
};
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
}
|
|
3477
|
+
var EXPLICIT_ABORT_TOKEN = Symbol(
|
|
3478
|
+
"This symbol is thrown from the request that underlies a series of coalesced requests when the last request in that series aborts"
|
|
3479
|
+
);
|
|
2864
3480
|
function getRpcTransportWithRequestCoalescing(transport, getDeduplicationKey) {
|
|
2865
3481
|
let coalescedRequestsByDeduplicationKey;
|
|
2866
3482
|
return async function makeCoalescedHttpRequest(config) {
|
|
@@ -2884,7 +3500,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2884
3500
|
signal: abortController.signal
|
|
2885
3501
|
});
|
|
2886
3502
|
} catch (e4) {
|
|
2887
|
-
if (e4
|
|
3503
|
+
if (e4 === EXPLICIT_ABORT_TOKEN) {
|
|
2888
3504
|
return;
|
|
2889
3505
|
}
|
|
2890
3506
|
throw e4;
|
|
@@ -2906,10 +3522,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2906
3522
|
coalescedRequest.numConsumers -= 1;
|
|
2907
3523
|
if (coalescedRequest.numConsumers === 0) {
|
|
2908
3524
|
const abortController = coalescedRequest.abortController;
|
|
2909
|
-
abortController.abort();
|
|
3525
|
+
abortController.abort(EXPLICIT_ABORT_TOKEN);
|
|
2910
3526
|
}
|
|
2911
|
-
|
|
2912
|
-
reject(abortError);
|
|
3527
|
+
reject(e4.target.reason);
|
|
2913
3528
|
};
|
|
2914
3529
|
signal.addEventListener("abort", handleAbort);
|
|
2915
3530
|
responsePromise.then(resolve).finally(() => {
|
|
@@ -2953,6 +3568,15 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2953
3568
|
(transport) => getRpcTransportWithRequestCoalescing(transport, getSolanaRpcPayloadDeduplicationKey)
|
|
2954
3569
|
);
|
|
2955
3570
|
}
|
|
3571
|
+
function createSolanaRpc(clusterUrl, config) {
|
|
3572
|
+
return createSolanaRpcFromTransport(createDefaultRpcTransport({ url: clusterUrl, ...config }));
|
|
3573
|
+
}
|
|
3574
|
+
function createSolanaRpcFromTransport(transport) {
|
|
3575
|
+
return createRpc({
|
|
3576
|
+
api: createSolanaRpcApi(DEFAULT_RPC_CONFIG),
|
|
3577
|
+
transport
|
|
3578
|
+
});
|
|
3579
|
+
}
|
|
2956
3580
|
|
|
2957
3581
|
// ../rpc-subscriptions/dist/index.browser.js
|
|
2958
3582
|
init_env_shim();
|
|
@@ -2975,17 +3599,17 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
2975
3599
|
},
|
|
2976
3600
|
get(target, p, receiver) {
|
|
2977
3601
|
return function(...rawParams) {
|
|
2978
|
-
const
|
|
2979
|
-
const createRpcSubscription = Reflect.get(target,
|
|
3602
|
+
const notificationName = p.toString();
|
|
3603
|
+
const createRpcSubscription = Reflect.get(target, notificationName, receiver);
|
|
2980
3604
|
if (p.toString().endsWith("Notifications") === false && !createRpcSubscription) {
|
|
2981
|
-
throw new
|
|
2982
|
-
|
|
2983
|
-
);
|
|
3605
|
+
throw new SolanaError(SOLANA_ERROR__RPC_SUBSCRIPTIONS_CANNOT_CREATE_SUBSCRIPTION_REQUEST, {
|
|
3606
|
+
notificationName
|
|
3607
|
+
});
|
|
2984
3608
|
}
|
|
2985
3609
|
const newRequest = createRpcSubscription ? createRpcSubscription(...rawParams) : {
|
|
2986
3610
|
params: rawParams,
|
|
2987
|
-
subscribeMethodName:
|
|
2988
|
-
unsubscribeMethodName:
|
|
3611
|
+
subscribeMethodName: notificationName.replace(/Notifications$/, "Subscribe"),
|
|
3612
|
+
unsubscribeMethodName: notificationName.replace(/Notifications$/, "Unsubscribe")
|
|
2989
3613
|
};
|
|
2990
3614
|
return createPendingRpcSubscription(rpcConfig, newRequest);
|
|
2991
3615
|
};
|
|
@@ -3040,7 +3664,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3040
3664
|
}
|
|
3041
3665
|
}
|
|
3042
3666
|
if (subscriptionId == null) {
|
|
3043
|
-
throw new
|
|
3667
|
+
throw new SolanaError(SOLANA_ERROR__RPC_SUBSCRIPTIONS_EXPECTED_SERVER_SUBSCRIPTION_ID);
|
|
3044
3668
|
}
|
|
3045
3669
|
return {
|
|
3046
3670
|
async *[Symbol.asyncIterator]() {
|
|
@@ -3281,7 +3905,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3281
3905
|
// ../rpc-subscriptions-transport-websocket/dist/index.browser.js
|
|
3282
3906
|
init_env_shim();
|
|
3283
3907
|
var e3 = globalThis.WebSocket;
|
|
3284
|
-
var
|
|
3908
|
+
var EXPLICIT_ABORT_TOKEN2 = Symbol(
|
|
3285
3909
|
"This symbol is thrown from a socket's iterator when the connection is explicitly aborted by the user"
|
|
3286
3910
|
);
|
|
3287
3911
|
async function createWebSocketConnection({
|
|
@@ -3303,7 +3927,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3303
3927
|
});
|
|
3304
3928
|
}
|
|
3305
3929
|
function handleAbort() {
|
|
3306
|
-
errorAndClearAllIteratorStates(
|
|
3930
|
+
errorAndClearAllIteratorStates(EXPLICIT_ABORT_TOKEN2);
|
|
3307
3931
|
if (webSocket.readyState !== e3.CLOSED && webSocket.readyState !== e3.CLOSING) {
|
|
3308
3932
|
webSocket.close(1e3);
|
|
3309
3933
|
}
|
|
@@ -3320,8 +3944,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3320
3944
|
function handleError(ev) {
|
|
3321
3945
|
if (!hasConnected) {
|
|
3322
3946
|
reject(
|
|
3323
|
-
|
|
3324
|
-
|
|
3947
|
+
new SolanaError(SOLANA_ERROR__RPC_SUBSCRIPTIONS_TRANSPORT_FAILED_TO_CONNECT, {
|
|
3948
|
+
errorEvent: ev
|
|
3949
|
+
})
|
|
3325
3950
|
);
|
|
3326
3951
|
}
|
|
3327
3952
|
}
|
|
@@ -3346,8 +3971,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3346
3971
|
bufferDrainWatcher = void 0;
|
|
3347
3972
|
clearInterval(intervalId);
|
|
3348
3973
|
reject2(
|
|
3349
|
-
|
|
3350
|
-
|
|
3974
|
+
new SolanaError(
|
|
3975
|
+
SOLANA_ERROR__RPC_SUBSCRIPTIONS_TRANSPORT_CLOSED_BEFORE_MESSAGE_BUFFERED
|
|
3976
|
+
)
|
|
3351
3977
|
);
|
|
3352
3978
|
};
|
|
3353
3979
|
});
|
|
@@ -3391,10 +4017,15 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3391
4017
|
});
|
|
3392
4018
|
});
|
|
3393
4019
|
} catch (e22) {
|
|
3394
|
-
if (e22 ===
|
|
4020
|
+
if (e22 === EXPLICIT_ABORT_TOKEN2) {
|
|
3395
4021
|
return;
|
|
3396
4022
|
} else {
|
|
3397
|
-
throw new
|
|
4023
|
+
throw new SolanaError(
|
|
4024
|
+
SOLANA_ERROR__RPC_SUBSCRIPTIONS_TRANSPORT_CONNECTION_CLOSED,
|
|
4025
|
+
{
|
|
4026
|
+
cause: e22
|
|
4027
|
+
}
|
|
4028
|
+
);
|
|
3398
4029
|
}
|
|
3399
4030
|
}
|
|
3400
4031
|
}
|
|
@@ -3446,6 +4077,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3446
4077
|
};
|
|
3447
4078
|
};
|
|
3448
4079
|
}
|
|
4080
|
+
|
|
4081
|
+
// ../rpc-subscriptions/dist/index.browser.js
|
|
4082
|
+
var __DEV__6 = /* @__PURE__ */ (() => true)();
|
|
3449
4083
|
function createSolanaJsonRpcIntegerOverflowError2(methodName, keyPath, value) {
|
|
3450
4084
|
let argumentLabel = "";
|
|
3451
4085
|
if (typeof keyPath[0] === "number") {
|
|
@@ -3497,7 +4131,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3497
4131
|
}
|
|
3498
4132
|
function getCachedAbortableIterableFactory({
|
|
3499
4133
|
getAbortSignalFromInputArgs,
|
|
3500
|
-
|
|
4134
|
+
getCacheEntryMissingErrorMessage,
|
|
3501
4135
|
getCacheKeyFromInputArgs,
|
|
3502
4136
|
onCacheHit,
|
|
3503
4137
|
onCreateIterable
|
|
@@ -3506,7 +4140,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3506
4140
|
function getCacheEntryOrThrow(cacheKey) {
|
|
3507
4141
|
const currentCacheEntry = cache.get(cacheKey);
|
|
3508
4142
|
if (!currentCacheEntry) {
|
|
3509
|
-
throw
|
|
4143
|
+
throw new Error(getCacheEntryMissingErrorMessage ? getCacheEntryMissingErrorMessage(cacheKey) : void 0);
|
|
3510
4144
|
}
|
|
3511
4145
|
return currentCacheEntry;
|
|
3512
4146
|
}
|
|
@@ -3564,7 +4198,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3564
4198
|
}
|
|
3565
4199
|
};
|
|
3566
4200
|
}
|
|
3567
|
-
var
|
|
4201
|
+
var EXPLICIT_ABORT_TOKEN3 = Symbol(
|
|
3568
4202
|
"This symbol is thrown from a subscription's iterator when the subscription is explicitly aborted by the user"
|
|
3569
4203
|
);
|
|
3570
4204
|
function registerIterableCleanup22(iterable, cleanupFn) {
|
|
@@ -3605,11 +4239,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3605
4239
|
}
|
|
3606
4240
|
const iterableFactory = getCachedAbortableIterableFactory({
|
|
3607
4241
|
getAbortSignalFromInputArgs: ({ abortSignal }) => abortSignal,
|
|
3608
|
-
|
|
3609
|
-
return new Error(
|
|
3610
|
-
`Found no cache entry for subscription with deduplication key \`${deduplicationKey2 == null ? void 0 : deduplicationKey2.toString()}\``
|
|
3611
|
-
);
|
|
3612
|
-
},
|
|
4242
|
+
getCacheEntryMissingErrorMessage: __DEV__6 ? (deduplicationKey2) => `Invariant: Found no cache entry for subscription with deduplication key \`${deduplicationKey2 == null ? void 0 : deduplicationKey2.toString()}\`` : void 0,
|
|
3613
4243
|
getCacheKeyFromInputArgs: () => deduplicationKey,
|
|
3614
4244
|
async onCacheHit(_iterable, _config) {
|
|
3615
4245
|
},
|
|
@@ -3635,9 +4265,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3635
4265
|
return {
|
|
3636
4266
|
...iterable,
|
|
3637
4267
|
async *[Symbol.asyncIterator]() {
|
|
3638
|
-
abortPromise || (abortPromise = abortSignal.aborted ? Promise.reject(
|
|
4268
|
+
abortPromise || (abortPromise = abortSignal.aborted ? Promise.reject(EXPLICIT_ABORT_TOKEN3) : new Promise((_, reject) => {
|
|
3639
4269
|
abortSignal.addEventListener("abort", () => {
|
|
3640
|
-
reject(
|
|
4270
|
+
reject(EXPLICIT_ABORT_TOKEN3);
|
|
3641
4271
|
});
|
|
3642
4272
|
}));
|
|
3643
4273
|
try {
|
|
@@ -3651,7 +4281,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3651
4281
|
}
|
|
3652
4282
|
}
|
|
3653
4283
|
} catch (e4) {
|
|
3654
|
-
if (e4 ===
|
|
4284
|
+
if (e4 === EXPLICIT_ABORT_TOKEN3) {
|
|
3655
4285
|
return;
|
|
3656
4286
|
}
|
|
3657
4287
|
cache.delete(deduplicationKey);
|
|
@@ -3667,24 +4297,6 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3667
4297
|
}
|
|
3668
4298
|
});
|
|
3669
4299
|
}
|
|
3670
|
-
function createSolanaRpcSubscriptions(config) {
|
|
3671
|
-
return pipe(
|
|
3672
|
-
createSubscriptionRpc({
|
|
3673
|
-
...config,
|
|
3674
|
-
api: createSolanaRpcSubscriptionsApi(DEFAULT_RPC_CONFIG2)
|
|
3675
|
-
}),
|
|
3676
|
-
(rpcSubscriptions) => getRpcSubscriptionsWithSubscriptionCoalescing({
|
|
3677
|
-
getDeduplicationKey: (...args) => (0, import_fast_stable_stringify2.default)(args),
|
|
3678
|
-
rpcSubscriptions
|
|
3679
|
-
})
|
|
3680
|
-
);
|
|
3681
|
-
}
|
|
3682
|
-
function createSolanaRpcSubscriptions_UNSTABLE(config) {
|
|
3683
|
-
return createSubscriptionRpc({
|
|
3684
|
-
...config,
|
|
3685
|
-
api: createSolanaRpcSubscriptionsApi_UNSTABLE(DEFAULT_RPC_CONFIG2)
|
|
3686
|
-
});
|
|
3687
|
-
}
|
|
3688
4300
|
var PING_PAYLOAD = {
|
|
3689
4301
|
jsonrpc: "2.0",
|
|
3690
4302
|
method: "ping"
|
|
@@ -3758,9 +4370,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3758
4370
|
}) {
|
|
3759
4371
|
return getCachedAbortableIterableFactory({
|
|
3760
4372
|
getAbortSignalFromInputArgs: ({ signal }) => signal,
|
|
3761
|
-
|
|
3762
|
-
return new Error(`Found no cache entry for connection with shard key \`${shardKey == null ? void 0 : shardKey.toString()}\``);
|
|
3763
|
-
},
|
|
4373
|
+
getCacheEntryMissingErrorMessage: __DEV__6 ? (shardKey) => `Invariant: Found no cache entry for connection with shard key \`${shardKey == null ? void 0 : shardKey.toString()}\`` : void 0,
|
|
3764
4374
|
getCacheKeyFromInputArgs: ({ payload }) => getShard ? getShard(payload) : NULL_SHARD_CACHE_KEY,
|
|
3765
4375
|
onCacheHit: (connection, { payload }) => connection.send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(payload),
|
|
3766
4376
|
onCreateIterable: (abortSignal, config) => transport({
|
|
@@ -3790,6 +4400,31 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3790
4400
|
})
|
|
3791
4401
|
);
|
|
3792
4402
|
}
|
|
4403
|
+
function createSolanaRpcSubscriptions(clusterUrl, config) {
|
|
4404
|
+
const transport = createDefaultRpcSubscriptionsTransport({ url: clusterUrl, ...config });
|
|
4405
|
+
return createSolanaRpcSubscriptionsFromTransport(transport);
|
|
4406
|
+
}
|
|
4407
|
+
function createSolanaRpcSubscriptions_UNSTABLE(clusterUrl, config) {
|
|
4408
|
+
return createSolanaRpcSubscriptions(
|
|
4409
|
+
clusterUrl,
|
|
4410
|
+
config
|
|
4411
|
+
);
|
|
4412
|
+
}
|
|
4413
|
+
function createSolanaRpcSubscriptionsFromTransport(transport) {
|
|
4414
|
+
return pipe(
|
|
4415
|
+
createSubscriptionRpc({
|
|
4416
|
+
api: createSolanaRpcSubscriptionsApi(DEFAULT_RPC_CONFIG2),
|
|
4417
|
+
transport
|
|
4418
|
+
}),
|
|
4419
|
+
(rpcSubscriptions) => getRpcSubscriptionsWithSubscriptionCoalescing({
|
|
4420
|
+
getDeduplicationKey: (...args) => (0, import_fast_stable_stringify2.default)(args),
|
|
4421
|
+
rpcSubscriptions
|
|
4422
|
+
})
|
|
4423
|
+
);
|
|
4424
|
+
}
|
|
4425
|
+
function createSolanaRpcSubscriptionsFromTransport_UNSTABLE(transport) {
|
|
4426
|
+
return createSolanaRpcSubscriptionsFromTransport(transport);
|
|
4427
|
+
}
|
|
3793
4428
|
|
|
3794
4429
|
// ../rpc-types/dist/index.browser.js
|
|
3795
4430
|
init_env_shim();
|
|
@@ -3797,22 +4432,20 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3797
4432
|
function assertIsBlockhash(putativeBlockhash) {
|
|
3798
4433
|
if (!base58Encoder2)
|
|
3799
4434
|
base58Encoder2 = getBase58Encoder();
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
}
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
throw new Error(`\`${putativeBlockhash}\` is not a blockhash`, {
|
|
3815
|
-
cause: e4
|
|
4435
|
+
if (
|
|
4436
|
+
// Lowest value (32 bytes of zeroes)
|
|
4437
|
+
putativeBlockhash.length < 32 || // Highest value (32 bytes of 255)
|
|
4438
|
+
putativeBlockhash.length > 44
|
|
4439
|
+
) {
|
|
4440
|
+
throw new SolanaError(SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE, {
|
|
4441
|
+
actualLength: putativeBlockhash.length
|
|
4442
|
+
});
|
|
4443
|
+
}
|
|
4444
|
+
const bytes = base58Encoder2.encode(putativeBlockhash);
|
|
4445
|
+
const numBytes = bytes.byteLength;
|
|
4446
|
+
if (numBytes !== 32) {
|
|
4447
|
+
throw new SolanaError(SOLANA_ERROR__BLOCKHASH_BYTE_LENGTH_OUT_OF_RANGE, {
|
|
4448
|
+
actualLength: numBytes
|
|
3816
4449
|
});
|
|
3817
4450
|
}
|
|
3818
4451
|
}
|
|
@@ -3850,11 +4483,8 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3850
4483
|
return putativeLamports >= 0 && putativeLamports <= maxU64Value;
|
|
3851
4484
|
}
|
|
3852
4485
|
function assertIsLamports(putativeLamports) {
|
|
3853
|
-
if (putativeLamports < 0) {
|
|
3854
|
-
throw new
|
|
3855
|
-
}
|
|
3856
|
-
if (putativeLamports > maxU64Value) {
|
|
3857
|
-
throw new Error("Input number is too large to be represented as a 64-bit unsigned integer");
|
|
4486
|
+
if (putativeLamports < 0 || putativeLamports > maxU64Value) {
|
|
4487
|
+
throw new SolanaError(SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE);
|
|
3858
4488
|
}
|
|
3859
4489
|
}
|
|
3860
4490
|
function lamports(putativeLamports) {
|
|
@@ -3891,9 +4521,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3891
4521
|
function assertIsStringifiedBigInt(putativeBigInt) {
|
|
3892
4522
|
try {
|
|
3893
4523
|
BigInt(putativeBigInt);
|
|
3894
|
-
} catch
|
|
3895
|
-
throw new
|
|
3896
|
-
|
|
4524
|
+
} catch {
|
|
4525
|
+
throw new SolanaError(SOLANA_ERROR__MALFORMED_BIGINT_STRING, {
|
|
4526
|
+
value: putativeBigInt
|
|
3897
4527
|
});
|
|
3898
4528
|
}
|
|
3899
4529
|
}
|
|
@@ -3906,7 +4536,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3906
4536
|
}
|
|
3907
4537
|
function assertIsStringifiedNumber(putativeNumber) {
|
|
3908
4538
|
if (Number.isNaN(Number(putativeNumber))) {
|
|
3909
|
-
throw new
|
|
4539
|
+
throw new SolanaError(SOLANA_ERROR__MALFORMED_NUMBER_STRING, {
|
|
4540
|
+
value: putativeNumber
|
|
4541
|
+
});
|
|
3910
4542
|
}
|
|
3911
4543
|
}
|
|
3912
4544
|
function stringifiedNumber(putativeNumber) {
|
|
@@ -3920,13 +4552,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3920
4552
|
return true;
|
|
3921
4553
|
}
|
|
3922
4554
|
function assertIsUnixTimestamp(putativeTimestamp) {
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
}
|
|
3927
|
-
} catch (e4) {
|
|
3928
|
-
throw new Error(`\`${putativeTimestamp}\` is not a timestamp`, {
|
|
3929
|
-
cause: e4
|
|
4555
|
+
if (putativeTimestamp > 864e13 || putativeTimestamp < -864e13) {
|
|
4556
|
+
throw new SolanaError(SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE, {
|
|
4557
|
+
value: putativeTimestamp
|
|
3930
4558
|
});
|
|
3931
4559
|
}
|
|
3932
4560
|
}
|
|
@@ -3944,22 +4572,20 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3944
4572
|
function assertIsBlockhash2(putativeBlockhash) {
|
|
3945
4573
|
if (!base58Encoder3)
|
|
3946
4574
|
base58Encoder3 = getBase58Encoder();
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
}
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
throw new Error(`\`${putativeBlockhash}\` is not a blockhash`, {
|
|
3962
|
-
cause: e4
|
|
4575
|
+
if (
|
|
4576
|
+
// Lowest value (32 bytes of zeroes)
|
|
4577
|
+
putativeBlockhash.length < 32 || // Highest value (32 bytes of 255)
|
|
4578
|
+
putativeBlockhash.length > 44
|
|
4579
|
+
) {
|
|
4580
|
+
throw new SolanaError(SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE, {
|
|
4581
|
+
actualLength: putativeBlockhash.length
|
|
4582
|
+
});
|
|
4583
|
+
}
|
|
4584
|
+
const bytes = base58Encoder3.encode(putativeBlockhash);
|
|
4585
|
+
const numBytes = bytes.byteLength;
|
|
4586
|
+
if (numBytes !== 32) {
|
|
4587
|
+
throw new SolanaError(SOLANA_ERROR__BLOCKHASH_BYTE_LENGTH_OUT_OF_RANGE, {
|
|
4588
|
+
actualLength: numBytes
|
|
3963
4589
|
});
|
|
3964
4590
|
}
|
|
3965
4591
|
}
|
|
@@ -3988,7 +4614,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
3988
4614
|
}
|
|
3989
4615
|
function assertIsTransactionWithBlockhashLifetime(transaction) {
|
|
3990
4616
|
if (!isTransactionWithBlockhashLifetime(transaction)) {
|
|
3991
|
-
throw new
|
|
4617
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_EXPECTED_BLOCKHASH_LIFETIME);
|
|
3992
4618
|
}
|
|
3993
4619
|
}
|
|
3994
4620
|
function setTransactionLifetimeUsingBlockhash(blockhashLifetimeConstraint, transaction) {
|
|
@@ -4037,7 +4663,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4037
4663
|
var SYSTEM_PROGRAM_ADDRESS = "11111111111111111111111111111111";
|
|
4038
4664
|
function assertIsDurableNonceTransaction(transaction) {
|
|
4039
4665
|
if (!isDurableNonceTransaction(transaction)) {
|
|
4040
|
-
throw new
|
|
4666
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_EXPECTED_NONCE_LIFETIME);
|
|
4041
4667
|
}
|
|
4042
4668
|
}
|
|
4043
4669
|
function createAdvanceNonceAccountInstruction(nonceAccountAddress, nonceAuthorityAddress) {
|
|
@@ -4181,8 +4807,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4181
4807
|
const compiledAddressTableLookupAddresses = compiledAddressTableLookups.map((l) => l.lookupTableAddress);
|
|
4182
4808
|
const missing = compiledAddressTableLookupAddresses.filter((a) => addressesByLookupTableAddress[a] === void 0);
|
|
4183
4809
|
if (missing.length > 0) {
|
|
4184
|
-
|
|
4185
|
-
|
|
4810
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING, {
|
|
4811
|
+
lookupTableAddresses: missing
|
|
4812
|
+
});
|
|
4186
4813
|
}
|
|
4187
4814
|
const readOnlyMetas = [];
|
|
4188
4815
|
const writableMetas = [];
|
|
@@ -4190,8 +4817,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4190
4817
|
const addresses = addressesByLookupTableAddress[lookup.lookupTableAddress];
|
|
4191
4818
|
const highestIndex = Math.max(...lookup.readableIndices, ...lookup.writableIndices);
|
|
4192
4819
|
if (highestIndex >= addresses.length) {
|
|
4193
|
-
throw new
|
|
4194
|
-
|
|
4820
|
+
throw new SolanaError(
|
|
4821
|
+
SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE,
|
|
4822
|
+
{
|
|
4823
|
+
highestKnownIndex: addresses.length - 1,
|
|
4824
|
+
highestRequestedIndex: highestIndex,
|
|
4825
|
+
lookupTableAddress: lookup.lookupTableAddress
|
|
4826
|
+
}
|
|
4195
4827
|
);
|
|
4196
4828
|
}
|
|
4197
4829
|
const readOnlyForLookup = lookup.readableIndices.map((r) => ({
|
|
@@ -4215,7 +4847,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4215
4847
|
var _a, _b;
|
|
4216
4848
|
const programAddress = (_a = accountMetas[instruction.programAddressIndex]) == null ? void 0 : _a.address;
|
|
4217
4849
|
if (!programAddress) {
|
|
4218
|
-
throw new
|
|
4850
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND, {
|
|
4851
|
+
index: instruction.programAddressIndex
|
|
4852
|
+
});
|
|
4219
4853
|
}
|
|
4220
4854
|
const accounts = (_b = instruction.accountIndices) == null ? void 0 : _b.map((accountIndex) => accountMetas[accountIndex]);
|
|
4221
4855
|
const { data } = instruction;
|
|
@@ -4261,8 +4895,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4261
4895
|
var _a;
|
|
4262
4896
|
const { compiledMessage } = compiledTransaction;
|
|
4263
4897
|
const feePayer = compiledMessage.staticAccounts[0];
|
|
4264
|
-
if (!feePayer)
|
|
4265
|
-
throw new
|
|
4898
|
+
if (!feePayer) {
|
|
4899
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_FAILED_TO_DECOMPILE_FEE_PAYER_MISSING);
|
|
4900
|
+
}
|
|
4266
4901
|
const accountMetas = getAccountMetas(compiledMessage);
|
|
4267
4902
|
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 : {}) : [];
|
|
4268
4903
|
const transactionMetas = [...accountMetas, ...accountLookupMetas];
|
|
@@ -4303,13 +4938,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4303
4938
|
if (isWritableRole2(entry.role)) {
|
|
4304
4939
|
switch (entry[TYPE]) {
|
|
4305
4940
|
case 0:
|
|
4306
|
-
throw new
|
|
4307
|
-
|
|
4308
|
-
);
|
|
4941
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_INVOKED_PROGRAMS_CANNOT_PAY_FEES, {
|
|
4942
|
+
programAddress: instruction.programAddress
|
|
4943
|
+
});
|
|
4309
4944
|
default:
|
|
4310
|
-
throw new
|
|
4311
|
-
|
|
4312
|
-
);
|
|
4945
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE, {
|
|
4946
|
+
programAddress: instruction.programAddress
|
|
4947
|
+
});
|
|
4313
4948
|
}
|
|
4314
4949
|
}
|
|
4315
4950
|
if (entry[TYPE] === 2) {
|
|
@@ -4374,8 +5009,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4374
5009
|
addressesOfInvokedPrograms.has(account.address)
|
|
4375
5010
|
) {
|
|
4376
5011
|
if (isWritableRole2(accountMeta.role)) {
|
|
4377
|
-
throw new
|
|
4378
|
-
|
|
5012
|
+
throw new SolanaError(
|
|
5013
|
+
SOLANA_ERROR__TRANSACTION_INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE,
|
|
5014
|
+
{
|
|
5015
|
+
programAddress: account.address
|
|
5016
|
+
}
|
|
4379
5017
|
);
|
|
4380
5018
|
}
|
|
4381
5019
|
if (entry.role !== nextRole) {
|
|
@@ -4659,7 +5297,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4659
5297
|
return offset;
|
|
4660
5298
|
}
|
|
4661
5299
|
if (value < 0 || value > 127) {
|
|
4662
|
-
throw new
|
|
5300
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION_VERSION_NUMBER_OUT_OF_RANGE, {
|
|
5301
|
+
actualVersion: value
|
|
5302
|
+
});
|
|
4663
5303
|
}
|
|
4664
5304
|
bytes.set([value | VERSION_FLAG_MASK], offset);
|
|
4665
5305
|
return offset + 1;
|
|
@@ -4870,9 +5510,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4870
5510
|
if (!deduplicated[signer.address]) {
|
|
4871
5511
|
deduplicated[signer.address] = signer;
|
|
4872
5512
|
} else if (deduplicated[signer.address] !== signer) {
|
|
4873
|
-
throw new
|
|
4874
|
-
|
|
4875
|
-
);
|
|
5513
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER_ADDRESS_CANNOT_HAVE_MULTIPLE_SIGNERS, {
|
|
5514
|
+
address: signer.address
|
|
5515
|
+
});
|
|
4876
5516
|
}
|
|
4877
5517
|
});
|
|
4878
5518
|
return Object.values(deduplicated);
|
|
@@ -4935,7 +5575,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4935
5575
|
}
|
|
4936
5576
|
function assertIsMessagePartialSigner(value) {
|
|
4937
5577
|
if (!isMessagePartialSigner(value)) {
|
|
4938
|
-
throw new
|
|
5578
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER_EXPECTED_MESSAGE_PARTIAL_SIGNER, {
|
|
5579
|
+
address: value.address
|
|
5580
|
+
});
|
|
4939
5581
|
}
|
|
4940
5582
|
}
|
|
4941
5583
|
function isTransactionPartialSigner(value) {
|
|
@@ -4943,7 +5585,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4943
5585
|
}
|
|
4944
5586
|
function assertIsTransactionPartialSigner(value) {
|
|
4945
5587
|
if (!isTransactionPartialSigner(value)) {
|
|
4946
|
-
throw new
|
|
5588
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER_EXPECTED_TRANSACTION_PARTIAL_SIGNER, {
|
|
5589
|
+
address: value.address
|
|
5590
|
+
});
|
|
4947
5591
|
}
|
|
4948
5592
|
}
|
|
4949
5593
|
function isKeyPairSigner(value) {
|
|
@@ -4951,7 +5595,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4951
5595
|
}
|
|
4952
5596
|
function assertIsKeyPairSigner(value) {
|
|
4953
5597
|
if (!isKeyPairSigner(value)) {
|
|
4954
|
-
throw new
|
|
5598
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER_EXPECTED_KEY_PAIR_SIGNER, {
|
|
5599
|
+
address: value.address
|
|
5600
|
+
});
|
|
4955
5601
|
}
|
|
4956
5602
|
}
|
|
4957
5603
|
async function createSignerFromKeyPair(keyPair) {
|
|
@@ -4984,7 +5630,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4984
5630
|
}
|
|
4985
5631
|
function assertIsMessageModifyingSigner(value) {
|
|
4986
5632
|
if (!isMessageModifyingSigner(value)) {
|
|
4987
|
-
throw new
|
|
5633
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER_EXPECTED_MESSAGE_MODIFYING_SIGNER, {
|
|
5634
|
+
address: value.address
|
|
5635
|
+
});
|
|
4988
5636
|
}
|
|
4989
5637
|
}
|
|
4990
5638
|
function isMessageSigner(value) {
|
|
@@ -4992,7 +5640,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
4992
5640
|
}
|
|
4993
5641
|
function assertIsMessageSigner(value) {
|
|
4994
5642
|
if (!isMessageSigner(value)) {
|
|
4995
|
-
throw new
|
|
5643
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER_EXPECTED_MESSAGE_SIGNER, {
|
|
5644
|
+
address: value.address
|
|
5645
|
+
});
|
|
4996
5646
|
}
|
|
4997
5647
|
}
|
|
4998
5648
|
function createNoopSigner(address2) {
|
|
@@ -5008,7 +5658,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5008
5658
|
}
|
|
5009
5659
|
function assertIsTransactionModifyingSigner(value) {
|
|
5010
5660
|
if (!isTransactionModifyingSigner(value)) {
|
|
5011
|
-
throw new
|
|
5661
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER_EXPECTED_TRANSACTION_MODIFYING_SIGNER, {
|
|
5662
|
+
address: value.address
|
|
5663
|
+
});
|
|
5012
5664
|
}
|
|
5013
5665
|
}
|
|
5014
5666
|
function isTransactionSendingSigner(value) {
|
|
@@ -5016,7 +5668,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5016
5668
|
}
|
|
5017
5669
|
function assertIsTransactionSendingSigner(value) {
|
|
5018
5670
|
if (!isTransactionSendingSigner(value)) {
|
|
5019
|
-
throw new
|
|
5671
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER_EXPECTED_TRANSACTION_SENDING_SIGNER, {
|
|
5672
|
+
address: value.address
|
|
5673
|
+
});
|
|
5020
5674
|
}
|
|
5021
5675
|
}
|
|
5022
5676
|
function isTransactionSigner(value) {
|
|
@@ -5024,7 +5678,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5024
5678
|
}
|
|
5025
5679
|
function assertIsTransactionSigner(value) {
|
|
5026
5680
|
if (!isTransactionSigner(value)) {
|
|
5027
|
-
throw new
|
|
5681
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER_EXPECTED_TRANSACTION_SIGNER, {
|
|
5682
|
+
address: value.address
|
|
5683
|
+
});
|
|
5028
5684
|
}
|
|
5029
5685
|
}
|
|
5030
5686
|
async function partiallySignTransactionWithSigners(transaction, config = {}) {
|
|
@@ -5052,9 +5708,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5052
5708
|
abortSignal
|
|
5053
5709
|
);
|
|
5054
5710
|
if (!sendingSigner) {
|
|
5055
|
-
throw new
|
|
5056
|
-
"No `TransactionSendingSigner` was identified. Please provide a valid `ITransactionWithSingleSendingSigner` transaction."
|
|
5057
|
-
);
|
|
5711
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER_TRANSACTION_SENDING_SIGNER_MISSING);
|
|
5058
5712
|
}
|
|
5059
5713
|
abortSignal == null ? void 0 : abortSignal.throwIfAborted();
|
|
5060
5714
|
const [signature2] = await sendingSigner.signAndSendTransactions([signedTransaction], { abortSignal });
|
|
@@ -5139,17 +5793,13 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5139
5793
|
const signers = getSignersFromTransaction(transaction);
|
|
5140
5794
|
const sendingSigners = signers.filter(isTransactionSendingSigner);
|
|
5141
5795
|
if (sendingSigners.length === 0) {
|
|
5142
|
-
|
|
5143
|
-
error.name = "MissingTransactionSendingSignerError";
|
|
5144
|
-
throw error;
|
|
5796
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER_TRANSACTION_SENDING_SIGNER_MISSING);
|
|
5145
5797
|
}
|
|
5146
5798
|
const sendingOnlySigners = sendingSigners.filter(
|
|
5147
5799
|
(signer) => !isTransactionPartialSigner(signer) && !isTransactionModifyingSigner(signer)
|
|
5148
5800
|
);
|
|
5149
5801
|
if (sendingOnlySigners.length > 1) {
|
|
5150
|
-
|
|
5151
|
-
error.name = "MultipleTransactionSendingSignersError";
|
|
5152
|
-
throw error;
|
|
5802
|
+
throw new SolanaError(SOLANA_ERROR__SIGNER_TRANSACTION_CANNOT_HAVE_MULTIPLE_SENDING_SIGNERS);
|
|
5153
5803
|
}
|
|
5154
5804
|
}
|
|
5155
5805
|
|
|
@@ -5294,9 +5944,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5294
5944
|
const signatureDidCommitPromise = (async () => {
|
|
5295
5945
|
for await (const signatureStatusNotification of signatureStatusNotifications) {
|
|
5296
5946
|
if (signatureStatusNotification.value.err) {
|
|
5297
|
-
throw
|
|
5298
|
-
cause: signatureStatusNotification.value.err
|
|
5299
|
-
});
|
|
5947
|
+
throw getSolanaErrorFromTransactionError(signatureStatusNotification.value.err);
|
|
5300
5948
|
} else {
|
|
5301
5949
|
return;
|
|
5302
5950
|
}
|
|
@@ -5662,6 +6310,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5662
6310
|
exports.assertIsBlockhash = assertIsBlockhash;
|
|
5663
6311
|
exports.assertIsDurableNonceTransaction = assertIsDurableNonceTransaction;
|
|
5664
6312
|
exports.assertIsFixedSize = assertIsFixedSize;
|
|
6313
|
+
exports.assertIsInstructionForProgram = assertIsInstructionForProgram;
|
|
6314
|
+
exports.assertIsInstructionWithAccounts = assertIsInstructionWithAccounts;
|
|
6315
|
+
exports.assertIsInstructionWithData = assertIsInstructionWithData;
|
|
5665
6316
|
exports.assertIsKeyPairSigner = assertIsKeyPairSigner;
|
|
5666
6317
|
exports.assertIsLamports = assertIsLamports;
|
|
5667
6318
|
exports.assertIsMessageModifyingSigner = assertIsMessageModifyingSigner;
|
|
@@ -5703,9 +6354,12 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5703
6354
|
exports.createSignerFromKeyPair = createSignerFromKeyPair;
|
|
5704
6355
|
exports.createSolanaRpc = createSolanaRpc;
|
|
5705
6356
|
exports.createSolanaRpcApi = createSolanaRpcApi;
|
|
6357
|
+
exports.createSolanaRpcFromTransport = createSolanaRpcFromTransport;
|
|
5706
6358
|
exports.createSolanaRpcSubscriptions = createSolanaRpcSubscriptions;
|
|
5707
6359
|
exports.createSolanaRpcSubscriptionsApi = createSolanaRpcSubscriptionsApi;
|
|
5708
6360
|
exports.createSolanaRpcSubscriptionsApi_UNSTABLE = createSolanaRpcSubscriptionsApi_UNSTABLE;
|
|
6361
|
+
exports.createSolanaRpcSubscriptionsFromTransport = createSolanaRpcSubscriptionsFromTransport;
|
|
6362
|
+
exports.createSolanaRpcSubscriptionsFromTransport_UNSTABLE = createSolanaRpcSubscriptionsFromTransport_UNSTABLE;
|
|
5709
6363
|
exports.createSolanaRpcSubscriptions_UNSTABLE = createSolanaRpcSubscriptions_UNSTABLE;
|
|
5710
6364
|
exports.createSubscriptionRpc = createSubscriptionRpc;
|
|
5711
6365
|
exports.createTransaction = createTransaction;
|
|
@@ -5849,6 +6503,9 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
5849
6503
|
exports.isAddress = isAddress;
|
|
5850
6504
|
exports.isAdvanceNonceAccountInstruction = isAdvanceNonceAccountInstruction;
|
|
5851
6505
|
exports.isFixedSize = isFixedSize;
|
|
6506
|
+
exports.isInstructionForProgram = isInstructionForProgram;
|
|
6507
|
+
exports.isInstructionWithAccounts = isInstructionWithAccounts;
|
|
6508
|
+
exports.isInstructionWithData = isInstructionWithData;
|
|
5852
6509
|
exports.isKeyPairSigner = isKeyPairSigner;
|
|
5853
6510
|
exports.isLamports = isLamports;
|
|
5854
6511
|
exports.isMessageModifyingSigner = isMessageModifyingSigner;
|