@solana/errors 6.3.1 → 6.3.2-canary-20260313112147

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/src/context.ts ADDED
@@ -0,0 +1,862 @@
1
+ /**
2
+ * To add a new error, follow the instructions at
3
+ * https://github.com/anza-xyz/kit/tree/main/packages/errors/#adding-a-new-error
4
+ *
5
+ * @privateRemarks
6
+ * WARNING:
7
+ * - Don't change or remove members of an error's context.
8
+ */
9
+ import {
10
+ SOLANA_ERROR__ACCOUNTS__ACCOUNT_NOT_FOUND,
11
+ SOLANA_ERROR__ACCOUNTS__EXPECTED_ALL_ACCOUNTS_TO_BE_DECODED,
12
+ SOLANA_ERROR__ACCOUNTS__EXPECTED_DECODED_ACCOUNT,
13
+ SOLANA_ERROR__ACCOUNTS__FAILED_TO_DECODE_ACCOUNT,
14
+ SOLANA_ERROR__ACCOUNTS__ONE_OR_MORE_ACCOUNTS_NOT_FOUND,
15
+ SOLANA_ERROR__ADDRESSES__INVALID_BASE58_ENCODED_ADDRESS,
16
+ SOLANA_ERROR__ADDRESSES__INVALID_BYTE_LENGTH,
17
+ SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED,
18
+ SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED,
19
+ SOLANA_ERROR__ADDRESSES__PDA_BUMP_SEED_OUT_OF_RANGE,
20
+ SOLANA_ERROR__ADDRESSES__STRING_LENGTH_OUT_OF_RANGE,
21
+ SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED,
22
+ SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE,
23
+ SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY,
24
+ SOLANA_ERROR__CODECS__CANNOT_USE_LEXICAL_VALUES_AS_ENUM_DISCRIMINATORS,
25
+ SOLANA_ERROR__CODECS__ENCODED_BYTES_MUST_NOT_INCLUDE_SENTINEL,
26
+ SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH,
27
+ SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH,
28
+ SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE,
29
+ SOLANA_ERROR__CODECS__EXPECTED_DECODER_TO_CONSUME_ENTIRE_BYTE_ARRAY,
30
+ SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH,
31
+ SOLANA_ERROR__CODECS__EXPECTED_ZERO_VALUE_TO_MATCH_ITEM_FIXED_SIZE,
32
+ SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH,
33
+ SOLANA_ERROR__CODECS__INVALID_CONSTANT,
34
+ SOLANA_ERROR__CODECS__INVALID_DISCRIMINATED_UNION_VARIANT,
35
+ SOLANA_ERROR__CODECS__INVALID_ENUM_VARIANT,
36
+ SOLANA_ERROR__CODECS__INVALID_LITERAL_UNION_VARIANT,
37
+ SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS,
38
+ SOLANA_ERROR__CODECS__INVALID_PATTERN_MATCH_BYTES,
39
+ SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE,
40
+ SOLANA_ERROR__CODECS__LITERAL_UNION_DISCRIMINATOR_OUT_OF_RANGE,
41
+ SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE,
42
+ SOLANA_ERROR__CODECS__OFFSET_OUT_OF_RANGE,
43
+ SOLANA_ERROR__CODECS__SENTINEL_MISSING_IN_DECODED_BYTES,
44
+ SOLANA_ERROR__CODECS__UNION_VARIANT_OUT_OF_RANGE,
45
+ SOLANA_ERROR__FAILED_TO_SEND_TRANSACTION,
46
+ SOLANA_ERROR__FAILED_TO_SEND_TRANSACTIONS,
47
+ SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_ACCOUNTS,
48
+ SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_DATA,
49
+ SOLANA_ERROR__INSTRUCTION__PROGRAM_ID_MISMATCH,
50
+ SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_ALREADY_INITIALIZED,
51
+ SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_FAILED,
52
+ SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_OUTSTANDING,
53
+ SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_SIZE_CHANGED,
54
+ SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_TOO_SMALL,
55
+ SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_EXECUTABLE,
56
+ SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_RENT_EXEMPT,
57
+ SOLANA_ERROR__INSTRUCTION_ERROR__ARITHMETIC_OVERFLOW,
58
+ SOLANA_ERROR__INSTRUCTION_ERROR__BORSH_IO_ERROR,
59
+ SOLANA_ERROR__INSTRUCTION_ERROR__BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS,
60
+ SOLANA_ERROR__INSTRUCTION_ERROR__CALL_DEPTH,
61
+ SOLANA_ERROR__INSTRUCTION_ERROR__COMPUTATIONAL_BUDGET_EXCEEDED,
62
+ SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM,
63
+ SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_INDEX,
64
+ SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_OUT_OF_SYNC,
65
+ SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_ACCOUNT_NOT_RENT_EXEMPT,
66
+ SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_DATA_MODIFIED,
67
+ SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_LAMPORT_CHANGE,
68
+ SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_MODIFIED,
69
+ SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_DATA_MODIFIED,
70
+ SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_LAMPORT_SPEND,
71
+ SOLANA_ERROR__INSTRUCTION_ERROR__GENERIC_ERROR,
72
+ SOLANA_ERROR__INSTRUCTION_ERROR__ILLEGAL_OWNER,
73
+ SOLANA_ERROR__INSTRUCTION_ERROR__IMMUTABLE,
74
+ SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_AUTHORITY,
75
+ SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_PROGRAM_ID,
76
+ SOLANA_ERROR__INSTRUCTION_ERROR__INSUFFICIENT_FUNDS,
77
+ SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_DATA,
78
+ SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_OWNER,
79
+ SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ARGUMENT,
80
+ SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ERROR,
81
+ SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_INSTRUCTION_DATA,
82
+ SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_REALLOC,
83
+ SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_SEEDS,
84
+ SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED,
85
+ SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_EXCEEDED,
86
+ SOLANA_ERROR__INSTRUCTION_ERROR__MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED,
87
+ SOLANA_ERROR__INSTRUCTION_ERROR__MAX_SEED_LENGTH_EXCEEDED,
88
+ SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_ACCOUNT,
89
+ SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_REQUIRED_SIGNATURE,
90
+ SOLANA_ERROR__INSTRUCTION_ERROR__MODIFIED_PROGRAM_ID,
91
+ SOLANA_ERROR__INSTRUCTION_ERROR__NOT_ENOUGH_ACCOUNT_KEYS,
92
+ SOLANA_ERROR__INSTRUCTION_ERROR__PRIVILEGE_ESCALATION,
93
+ SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_ENVIRONMENT_SETUP_FAILURE,
94
+ SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPILE,
95
+ SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPLETE,
96
+ SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_DATA_MODIFIED,
97
+ SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_LAMPORT_CHANGE,
98
+ SOLANA_ERROR__INSTRUCTION_ERROR__REENTRANCY_NOT_ALLOWED,
99
+ SOLANA_ERROR__INSTRUCTION_ERROR__RENT_EPOCH_MODIFIED,
100
+ SOLANA_ERROR__INSTRUCTION_ERROR__UNBALANCED_INSTRUCTION,
101
+ SOLANA_ERROR__INSTRUCTION_ERROR__UNINITIALIZED_ACCOUNT,
102
+ SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN,
103
+ SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_PROGRAM_ID,
104
+ SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_SYSVAR,
105
+ SOLANA_ERROR__INSTRUCTION_PLANS__EXPECTED_SUCCESSFUL_TRANSACTION_PLAN_RESULT,
106
+ SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_SINGLE_TRANSACTION_PLAN_RESULT_NOT_FOUND,
107
+ SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_TO_EXECUTE_TRANSACTION_PLAN,
108
+ SOLANA_ERROR__INSTRUCTION_PLANS__MESSAGE_CANNOT_ACCOMMODATE_PLAN,
109
+ SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_INSTRUCTION_PLAN,
110
+ SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_TRANSACTION_PLAN,
111
+ SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_TRANSACTION_PLAN_RESULT,
112
+ SOLANA_ERROR__INVALID_BLOCKHASH_BYTE_LENGTH,
113
+ SOLANA_ERROR__INVALID_NONCE,
114
+ SOLANA_ERROR__INVARIANT_VIOLATION__CACHED_ABORTABLE_ITERABLE_CACHE_ENTRY_MISSING,
115
+ SOLANA_ERROR__INVARIANT_VIOLATION__DATA_PUBLISHER_CHANNEL_UNIMPLEMENTED,
116
+ SOLANA_ERROR__INVARIANT_VIOLATION__INVALID_INSTRUCTION_PLAN_KIND,
117
+ SOLANA_ERROR__INVARIANT_VIOLATION__INVALID_TRANSACTION_PLAN_KIND,
118
+ SOLANA_ERROR__INVARIANT_VIOLATION__SWITCH_MUST_BE_EXHAUSTIVE,
119
+ SOLANA_ERROR__JSON_RPC__INTERNAL_ERROR,
120
+ SOLANA_ERROR__JSON_RPC__INVALID_PARAMS,
121
+ SOLANA_ERROR__JSON_RPC__INVALID_REQUEST,
122
+ SOLANA_ERROR__JSON_RPC__METHOD_NOT_FOUND,
123
+ SOLANA_ERROR__JSON_RPC__PARSE_ERROR,
124
+ SOLANA_ERROR__JSON_RPC__SCAN_ERROR,
125
+ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_CLEANED_UP,
126
+ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_NOT_AVAILABLE,
127
+ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET,
128
+ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_EPOCH_REWARDS_PERIOD_ACTIVE,
129
+ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX,
130
+ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED,
131
+ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED,
132
+ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NODE_UNHEALTHY,
133
+ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE,
134
+ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_NOT_EPOCH_BOUNDARY,
135
+ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_SKIPPED,
136
+ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE,
137
+ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION,
138
+ SOLANA_ERROR__KEYS__INVALID_KEY_PAIR_BYTE_LENGTH,
139
+ SOLANA_ERROR__KEYS__INVALID_PRIVATE_KEY_BYTE_LENGTH,
140
+ SOLANA_ERROR__KEYS__INVALID_SIGNATURE_BYTE_LENGTH,
141
+ SOLANA_ERROR__KEYS__SIGNATURE_STRING_LENGTH_OUT_OF_RANGE,
142
+ SOLANA_ERROR__MALFORMED_BIGINT_STRING,
143
+ SOLANA_ERROR__MALFORMED_JSON_RPC_ERROR,
144
+ SOLANA_ERROR__MALFORMED_NUMBER_STRING,
145
+ SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND,
146
+ SOLANA_ERROR__OFFCHAIN_MESSAGE__ADDRESSES_CANNOT_SIGN_OFFCHAIN_MESSAGE,
147
+ SOLANA_ERROR__OFFCHAIN_MESSAGE__APPLICATION_DOMAIN_STRING_LENGTH_OUT_OF_RANGE,
148
+ SOLANA_ERROR__OFFCHAIN_MESSAGE__ENVELOPE_SIGNERS_MISMATCH,
149
+ SOLANA_ERROR__OFFCHAIN_MESSAGE__INVALID_APPLICATION_DOMAIN_BYTE_LENGTH,
150
+ SOLANA_ERROR__OFFCHAIN_MESSAGE__MAXIMUM_LENGTH_EXCEEDED,
151
+ SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_FORMAT_MISMATCH,
152
+ SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_LENGTH_MISMATCH,
153
+ SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_SIGNATURES_MISMATCH,
154
+ SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURE_VERIFICATION_FAILURE,
155
+ SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURES_MISSING,
156
+ SOLANA_ERROR__OFFCHAIN_MESSAGE__UNEXPECTED_VERSION,
157
+ SOLANA_ERROR__OFFCHAIN_MESSAGE__VERSION_NUMBER_NOT_SUPPORTED,
158
+ SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT,
159
+ SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION,
160
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
161
+ SOLANA_ERROR__PROGRAM_CLIENTS__RESOLVED_INSTRUCTION_INPUT_MUST_BE_NON_NULL,
162
+ SOLANA_ERROR__PROGRAM_CLIENTS__UNEXPECTED_RESOLVED_INSTRUCTION_INPUT_TYPE,
163
+ SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_ACCOUNT_TYPE,
164
+ SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE,
165
+ SOLANA_ERROR__RPC__API_PLAN_MISSING_FOR_RPC_METHOD,
166
+ SOLANA_ERROR__RPC__INTEGER_OVERFLOW,
167
+ SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR,
168
+ SOLANA_ERROR__RPC__TRANSPORT_HTTP_HEADER_FORBIDDEN,
169
+ SOLANA_ERROR__RPC_SUBSCRIPTIONS__CANNOT_CREATE_SUBSCRIPTION_PLAN,
170
+ SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_FAILED_TO_CONNECT,
171
+ SOLANA_ERROR__SIGNER__ADDRESS_CANNOT_HAVE_MULTIPLE_SIGNERS,
172
+ SOLANA_ERROR__SIGNER__EXPECTED_KEY_PAIR_SIGNER,
173
+ SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_MODIFYING_SIGNER,
174
+ SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_PARTIAL_SIGNER,
175
+ SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_SIGNER,
176
+ SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_MODIFYING_SIGNER,
177
+ SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_PARTIAL_SIGNER,
178
+ SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SENDING_SIGNER,
179
+ SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SIGNER,
180
+ SOLANA_ERROR__SUBTLE_CRYPTO__CANNOT_EXPORT_NON_EXTRACTABLE_KEY,
181
+ SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE,
182
+ SOLANA_ERROR__TRANSACTION__ADDRESS_MISSING,
183
+ SOLANA_ERROR__TRANSACTION__ADDRESSES_CANNOT_SIGN_TRANSACTION,
184
+ SOLANA_ERROR__TRANSACTION__EXCEEDS_SIZE_LIMIT,
185
+ SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING,
186
+ SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE,
187
+ SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND,
188
+ SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT,
189
+ SOLANA_ERROR__TRANSACTION__INVALID_CONFIG_MASK_PRIORITY_FEE_BITS,
190
+ SOLANA_ERROR__TRANSACTION__INVALID_NONCE_ACCOUNT_INDEX,
191
+ SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES,
192
+ SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE,
193
+ SOLANA_ERROR__TRANSACTION__MALFORMED_MESSAGE_BYTES,
194
+ SOLANA_ERROR__TRANSACTION__MESSAGE_SIGNATURES_MISMATCH,
195
+ SOLANA_ERROR__TRANSACTION__NONCE_ACCOUNT_CANNOT_BE_IN_LOOKUP_TABLE,
196
+ SOLANA_ERROR__TRANSACTION__SIGNATURE_COUNT_TOO_HIGH_FOR_TRANSACTION_BYTES,
197
+ SOLANA_ERROR__TRANSACTION__SIGNATURES_MISSING,
198
+ SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_NOT_SUPPORTED,
199
+ SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_OUT_OF_RANGE,
200
+ SOLANA_ERROR__TRANSACTION__VERSION_ZERO_MUST_BE_ENCODED_WITH_SIGNATURES_FIRST,
201
+ SOLANA_ERROR__TRANSACTION_ERROR__DUPLICATE_INSTRUCTION,
202
+ SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_RENT,
203
+ SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED,
204
+ SOLANA_ERROR__TRANSACTION_ERROR__UNKNOWN,
205
+ SolanaErrorCode,
206
+ } from './codes';
207
+ import { RpcSimulateTransactionResult } from './json-rpc-error';
208
+
209
+ type BasicInstructionErrorContext<T extends SolanaErrorCode> = { [P in T]: { index: number } };
210
+
211
+ type DefaultUnspecifiedErrorContextToUndefined<T> = {
212
+ [P in SolanaErrorCode]: P extends keyof T ? T[P] : undefined;
213
+ };
214
+
215
+ type ReadonlyContextValue<T> = {
216
+ [P in keyof T]: Readonly<T[P]>;
217
+ };
218
+
219
+ type TypedArrayMutableProperties = 'copyWithin' | 'fill' | 'reverse' | 'set' | 'sort';
220
+ interface ReadonlyUint8Array extends Omit<Uint8Array, TypedArrayMutableProperties> {
221
+ readonly [n: number]: number;
222
+ }
223
+
224
+ /** A amount of bytes. */
225
+ type Bytes = number;
226
+
227
+ /**
228
+ * A map of every {@link SolanaError} code to the type of its `context` property.
229
+ */
230
+ export type SolanaErrorContext = ReadonlyContextValue<
231
+ DefaultUnspecifiedErrorContextToUndefined<
232
+ BasicInstructionErrorContext<
233
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_ALREADY_INITIALIZED
234
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_FAILED
235
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_OUTSTANDING
236
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_SIZE_CHANGED
237
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_TOO_SMALL
238
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_EXECUTABLE
239
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_RENT_EXEMPT
240
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__ARITHMETIC_OVERFLOW
241
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__BORSH_IO_ERROR
242
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS
243
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__CALL_DEPTH
244
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__COMPUTATIONAL_BUDGET_EXCEEDED
245
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM
246
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_INDEX
247
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_OUT_OF_SYNC
248
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_ACCOUNT_NOT_RENT_EXEMPT
249
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_DATA_MODIFIED
250
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_LAMPORT_CHANGE
251
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_MODIFIED
252
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_DATA_MODIFIED
253
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_LAMPORT_SPEND
254
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__GENERIC_ERROR
255
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__ILLEGAL_OWNER
256
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__IMMUTABLE
257
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_AUTHORITY
258
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_PROGRAM_ID
259
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INSUFFICIENT_FUNDS
260
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_DATA
261
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_OWNER
262
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ARGUMENT
263
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ERROR
264
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_INSTRUCTION_DATA
265
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_REALLOC
266
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_SEEDS
267
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED
268
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_EXCEEDED
269
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED
270
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__MAX_SEED_LENGTH_EXCEEDED
271
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_ACCOUNT
272
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_REQUIRED_SIGNATURE
273
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__MODIFIED_PROGRAM_ID
274
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__NOT_ENOUGH_ACCOUNT_KEYS
275
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__PRIVILEGE_ESCALATION
276
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_ENVIRONMENT_SETUP_FAILURE
277
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPILE
278
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPLETE
279
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_DATA_MODIFIED
280
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_LAMPORT_CHANGE
281
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__REENTRANCY_NOT_ALLOWED
282
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__RENT_EPOCH_MODIFIED
283
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__UNBALANCED_INSTRUCTION
284
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__UNINITIALIZED_ACCOUNT
285
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN
286
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_PROGRAM_ID
287
+ | typeof SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_SYSVAR
288
+ > & {
289
+ [SOLANA_ERROR__ACCOUNTS__ACCOUNT_NOT_FOUND]: {
290
+ address: string;
291
+ };
292
+ [SOLANA_ERROR__ACCOUNTS__EXPECTED_ALL_ACCOUNTS_TO_BE_DECODED]: {
293
+ addresses: readonly string[];
294
+ };
295
+ [SOLANA_ERROR__ACCOUNTS__EXPECTED_DECODED_ACCOUNT]: {
296
+ address: string;
297
+ };
298
+ [SOLANA_ERROR__ACCOUNTS__FAILED_TO_DECODE_ACCOUNT]: {
299
+ address: string;
300
+ };
301
+ [SOLANA_ERROR__ACCOUNTS__ONE_OR_MORE_ACCOUNTS_NOT_FOUND]: {
302
+ addresses: readonly string[];
303
+ };
304
+ [SOLANA_ERROR__ADDRESSES__INVALID_BASE58_ENCODED_ADDRESS]: {
305
+ putativeAddress: string;
306
+ };
307
+ [SOLANA_ERROR__ADDRESSES__INVALID_BYTE_LENGTH]: {
308
+ actualLength: number;
309
+ };
310
+ [SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED]: {
311
+ actual: number;
312
+ maxSeeds: number;
313
+ };
314
+ [SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED]: {
315
+ actual: number;
316
+ index: number;
317
+ maxSeedLength: number;
318
+ };
319
+ [SOLANA_ERROR__ADDRESSES__PDA_BUMP_SEED_OUT_OF_RANGE]: {
320
+ bump: number;
321
+ };
322
+ [SOLANA_ERROR__ADDRESSES__STRING_LENGTH_OUT_OF_RANGE]: {
323
+ actualLength: number;
324
+ };
325
+ [SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE]: {
326
+ actualLength: number;
327
+ };
328
+ [SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED]: {
329
+ currentBlockHeight: bigint;
330
+ lastValidBlockHeight: bigint;
331
+ };
332
+ [SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY]: {
333
+ codecDescription: string;
334
+ };
335
+ [SOLANA_ERROR__CODECS__CANNOT_USE_LEXICAL_VALUES_AS_ENUM_DISCRIMINATORS]: {
336
+ stringValues: readonly string[];
337
+ };
338
+ [SOLANA_ERROR__CODECS__ENCODED_BYTES_MUST_NOT_INCLUDE_SENTINEL]: {
339
+ encodedBytes: ReadonlyUint8Array;
340
+ hexEncodedBytes: string;
341
+ hexSentinel: string;
342
+ sentinel: ReadonlyUint8Array;
343
+ };
344
+ [SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH]: {
345
+ decoderFixedSize: number;
346
+ encoderFixedSize: number;
347
+ };
348
+ [SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH]: {
349
+ decoderMaxSize: number | undefined;
350
+ encoderMaxSize: number | undefined;
351
+ };
352
+ [SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE]: {
353
+ discriminator: bigint | number;
354
+ formattedValidDiscriminators: string;
355
+ validDiscriminators: readonly number[];
356
+ };
357
+ [SOLANA_ERROR__CODECS__EXPECTED_DECODER_TO_CONSUME_ENTIRE_BYTE_ARRAY]: {
358
+ expectedLength: number;
359
+ numExcessBytes: number;
360
+ };
361
+ [SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH]: {
362
+ bytesLength: number;
363
+ codecDescription: string;
364
+ };
365
+ [SOLANA_ERROR__CODECS__EXPECTED_ZERO_VALUE_TO_MATCH_ITEM_FIXED_SIZE]: {
366
+ codecDescription: string;
367
+ expectedSize: number;
368
+ hexZeroValue: string;
369
+ zeroValue: ReadonlyUint8Array;
370
+ };
371
+ [SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH]: {
372
+ bytesLength: number;
373
+ codecDescription: string;
374
+ expected: number;
375
+ };
376
+ [SOLANA_ERROR__CODECS__INVALID_CONSTANT]: {
377
+ constant: ReadonlyUint8Array;
378
+ data: ReadonlyUint8Array;
379
+ hexConstant: string;
380
+ hexData: string;
381
+ offset: number;
382
+ };
383
+ [SOLANA_ERROR__CODECS__INVALID_DISCRIMINATED_UNION_VARIANT]: {
384
+ value: bigint | boolean | number | string | null | undefined;
385
+ variants: readonly (bigint | boolean | number | string | null | undefined)[];
386
+ };
387
+ [SOLANA_ERROR__CODECS__INVALID_ENUM_VARIANT]: {
388
+ formattedNumericalValues: string;
389
+ numericalValues: readonly number[];
390
+ stringValues: readonly string[];
391
+ variant: number | string | symbol;
392
+ };
393
+ [SOLANA_ERROR__CODECS__INVALID_LITERAL_UNION_VARIANT]: {
394
+ value: bigint | boolean | number | string | null | undefined;
395
+ variants: readonly (bigint | boolean | number | string | null | undefined)[];
396
+ };
397
+ [SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS]: {
398
+ actual: bigint | number;
399
+ codecDescription: string;
400
+ expected: bigint | number;
401
+ };
402
+ [SOLANA_ERROR__CODECS__INVALID_PATTERN_MATCH_BYTES]: {
403
+ bytes: ReadonlyUint8Array;
404
+ };
405
+ [SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE]: {
406
+ alphabet: string;
407
+ base: number;
408
+ value: string;
409
+ };
410
+ [SOLANA_ERROR__CODECS__LITERAL_UNION_DISCRIMINATOR_OUT_OF_RANGE]: {
411
+ discriminator: bigint | number;
412
+ maxRange: number;
413
+ minRange: number;
414
+ };
415
+ [SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE]: {
416
+ codecDescription: string;
417
+ max: bigint | number;
418
+ min: bigint | number;
419
+ value: bigint | number;
420
+ };
421
+ [SOLANA_ERROR__CODECS__OFFSET_OUT_OF_RANGE]: {
422
+ bytesLength: number;
423
+ codecDescription: string;
424
+ offset: number;
425
+ };
426
+ [SOLANA_ERROR__CODECS__SENTINEL_MISSING_IN_DECODED_BYTES]: {
427
+ decodedBytes: ReadonlyUint8Array;
428
+ hexDecodedBytes: string;
429
+ hexSentinel: string;
430
+ sentinel: ReadonlyUint8Array;
431
+ };
432
+ [SOLANA_ERROR__CODECS__UNION_VARIANT_OUT_OF_RANGE]: {
433
+ maxRange: number;
434
+ minRange: number;
435
+ variant: number;
436
+ };
437
+ [SOLANA_ERROR__FAILED_TO_SEND_TRANSACTION]: {
438
+ causeMessage: string;
439
+ logs?: readonly string[];
440
+ preflightData?: Omit<RpcSimulateTransactionResult, 'err'>;
441
+ transactionPlanResult: unknown;
442
+ };
443
+ [SOLANA_ERROR__FAILED_TO_SEND_TRANSACTIONS]: {
444
+ causeMessages: string;
445
+ failedTransactions: ReadonlyArray<{
446
+ error: Error;
447
+ index: number;
448
+ logs?: readonly string[];
449
+ preflightData?: Omit<RpcSimulateTransactionResult, 'err'>;
450
+ }>;
451
+ transactionPlanResult: unknown;
452
+ };
453
+ [SOLANA_ERROR__INSTRUCTION_ERROR__BORSH_IO_ERROR]: {
454
+ index: number;
455
+ };
456
+ [SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM]: {
457
+ code: number;
458
+ index: number;
459
+ };
460
+ [SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN]: {
461
+ errorName: string;
462
+ index: number;
463
+ instructionErrorContext?: unknown;
464
+ };
465
+ [SOLANA_ERROR__INSTRUCTION_PLANS__EXPECTED_SUCCESSFUL_TRANSACTION_PLAN_RESULT]: {
466
+ transactionPlanResult: unknown;
467
+ };
468
+ [SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_SINGLE_TRANSACTION_PLAN_RESULT_NOT_FOUND]: {
469
+ transactionPlanResult: unknown;
470
+ };
471
+ [SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_TO_EXECUTE_TRANSACTION_PLAN]: {
472
+ abortReason?: unknown;
473
+ transactionPlanResult: unknown;
474
+ };
475
+ [SOLANA_ERROR__INSTRUCTION_PLANS__MESSAGE_CANNOT_ACCOMMODATE_PLAN]: {
476
+ numBytesRequired: number;
477
+ numFreeBytes: number;
478
+ };
479
+ [SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_INSTRUCTION_PLAN]: {
480
+ actualKind: string;
481
+ expectedKind: string;
482
+ instructionPlan: unknown;
483
+ };
484
+ [SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_TRANSACTION_PLAN]: {
485
+ actualKind: string;
486
+ expectedKind: string;
487
+ transactionPlan: unknown;
488
+ };
489
+ [SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_TRANSACTION_PLAN_RESULT]: {
490
+ actualKind: string;
491
+ expectedKind: string;
492
+ transactionPlanResult: unknown;
493
+ };
494
+ [SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_ACCOUNTS]: {
495
+ data?: ReadonlyUint8Array;
496
+ programAddress: string;
497
+ };
498
+ [SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_DATA]: {
499
+ accountAddresses?: readonly string[];
500
+ programAddress: string;
501
+ };
502
+ [SOLANA_ERROR__INSTRUCTION__PROGRAM_ID_MISMATCH]: {
503
+ actualProgramAddress: string;
504
+ expectedProgramAddress: string;
505
+ };
506
+ [SOLANA_ERROR__INVALID_BLOCKHASH_BYTE_LENGTH]: {
507
+ actualLength: number;
508
+ };
509
+ [SOLANA_ERROR__INVALID_NONCE]: {
510
+ actualNonceValue: string;
511
+ expectedNonceValue: string;
512
+ };
513
+ [SOLANA_ERROR__INVARIANT_VIOLATION__CACHED_ABORTABLE_ITERABLE_CACHE_ENTRY_MISSING]: {
514
+ cacheKey: string;
515
+ };
516
+ [SOLANA_ERROR__INVARIANT_VIOLATION__DATA_PUBLISHER_CHANNEL_UNIMPLEMENTED]: {
517
+ channelName: string;
518
+ supportedChannelNames: readonly string[];
519
+ };
520
+ [SOLANA_ERROR__INVARIANT_VIOLATION__INVALID_INSTRUCTION_PLAN_KIND]: {
521
+ kind: string;
522
+ };
523
+ [SOLANA_ERROR__INVARIANT_VIOLATION__INVALID_TRANSACTION_PLAN_KIND]: {
524
+ kind: string;
525
+ };
526
+ [SOLANA_ERROR__INVARIANT_VIOLATION__SWITCH_MUST_BE_EXHAUSTIVE]: {
527
+ unexpectedValue: unknown;
528
+ };
529
+ [SOLANA_ERROR__JSON_RPC__INTERNAL_ERROR]: {
530
+ __serverMessage: string;
531
+ };
532
+ [SOLANA_ERROR__JSON_RPC__INVALID_PARAMS]: {
533
+ __serverMessage: string;
534
+ };
535
+ [SOLANA_ERROR__JSON_RPC__INVALID_REQUEST]: {
536
+ __serverMessage: string;
537
+ };
538
+ [SOLANA_ERROR__JSON_RPC__METHOD_NOT_FOUND]: {
539
+ __serverMessage: string;
540
+ };
541
+ [SOLANA_ERROR__JSON_RPC__PARSE_ERROR]: {
542
+ __serverMessage: string;
543
+ };
544
+ [SOLANA_ERROR__JSON_RPC__SCAN_ERROR]: {
545
+ __serverMessage: string;
546
+ };
547
+ [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_CLEANED_UP]: {
548
+ __serverMessage: string;
549
+ };
550
+ [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_NOT_AVAILABLE]: {
551
+ __serverMessage: string;
552
+ };
553
+ [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET]: {
554
+ __serverMessage: string;
555
+ };
556
+ [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_EPOCH_REWARDS_PERIOD_ACTIVE]: {
557
+ currentBlockHeight: bigint;
558
+ rewardsCompleteBlockHeight: bigint;
559
+ slot: bigint;
560
+ };
561
+ [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX]: {
562
+ __serverMessage: string;
563
+ };
564
+ [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED]: {
565
+ __serverMessage: string;
566
+ };
567
+ [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED]: {
568
+ contextSlot: bigint;
569
+ };
570
+ [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NODE_UNHEALTHY]: {
571
+ numSlotsBehind?: number;
572
+ };
573
+ [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE]: Omit<
574
+ RpcSimulateTransactionResult,
575
+ 'err'
576
+ >;
577
+ [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_NOT_EPOCH_BOUNDARY]: {
578
+ slot: bigint;
579
+ };
580
+ [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_SKIPPED]: {
581
+ __serverMessage: string;
582
+ };
583
+ [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE]: {
584
+ __serverMessage: string;
585
+ };
586
+ [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION]: {
587
+ __serverMessage: string;
588
+ };
589
+ [SOLANA_ERROR__KEYS__INVALID_KEY_PAIR_BYTE_LENGTH]: {
590
+ byteLength: number;
591
+ };
592
+ [SOLANA_ERROR__KEYS__INVALID_PRIVATE_KEY_BYTE_LENGTH]: {
593
+ actualLength: number;
594
+ };
595
+ [SOLANA_ERROR__KEYS__INVALID_SIGNATURE_BYTE_LENGTH]: {
596
+ actualLength: number;
597
+ };
598
+ [SOLANA_ERROR__KEYS__SIGNATURE_STRING_LENGTH_OUT_OF_RANGE]: {
599
+ actualLength: number;
600
+ };
601
+ [SOLANA_ERROR__MALFORMED_BIGINT_STRING]: {
602
+ value: string;
603
+ };
604
+ [SOLANA_ERROR__MALFORMED_JSON_RPC_ERROR]: {
605
+ error: unknown;
606
+ message: string;
607
+ };
608
+ [SOLANA_ERROR__MALFORMED_NUMBER_STRING]: {
609
+ value: string;
610
+ };
611
+ [SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND]: {
612
+ nonceAccountAddress: string;
613
+ };
614
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__ADDRESSES_CANNOT_SIGN_OFFCHAIN_MESSAGE]: {
615
+ expectedAddresses: readonly string[];
616
+ unexpectedAddresses: readonly string[];
617
+ };
618
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__APPLICATION_DOMAIN_STRING_LENGTH_OUT_OF_RANGE]: {
619
+ actualLength: number;
620
+ };
621
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__ENVELOPE_SIGNERS_MISMATCH]: {
622
+ missingRequiredSigners: readonly string[];
623
+ unexpectedSigners: readonly string[];
624
+ };
625
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__INVALID_APPLICATION_DOMAIN_BYTE_LENGTH]: {
626
+ actualLength: number;
627
+ };
628
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__MAXIMUM_LENGTH_EXCEEDED]: {
629
+ actualBytes: number;
630
+ maxBytes: number;
631
+ };
632
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_FORMAT_MISMATCH]: {
633
+ actualMessageFormat: number;
634
+ expectedMessageFormat: number;
635
+ };
636
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_LENGTH_MISMATCH]: {
637
+ actualLength: number;
638
+ specifiedLength: number;
639
+ };
640
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_SIGNATURES_MISMATCH]: {
641
+ numRequiredSignatures: number;
642
+ signatoryAddresses: readonly string[];
643
+ signaturesLength: number;
644
+ };
645
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURES_MISSING]: {
646
+ addresses: readonly string[];
647
+ };
648
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURE_VERIFICATION_FAILURE]: {
649
+ signatoriesWithInvalidSignatures: readonly string[];
650
+ signatoriesWithMissingSignatures: readonly string[];
651
+ };
652
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__UNEXPECTED_VERSION]: {
653
+ actualVersion: number;
654
+ expectedVersion: number;
655
+ };
656
+ [SOLANA_ERROR__OFFCHAIN_MESSAGE__VERSION_NUMBER_NOT_SUPPORTED]: {
657
+ unsupportedVersion: number;
658
+ };
659
+ [SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT]: {
660
+ accountData: ReadonlyUint8Array;
661
+ programName: string;
662
+ };
663
+ [SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION]: {
664
+ instructionData: ReadonlyUint8Array;
665
+ programName: string;
666
+ };
667
+ [SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS]: {
668
+ actualAccountMetas: number;
669
+ expectedAccountMetas: number;
670
+ };
671
+ [SOLANA_ERROR__PROGRAM_CLIENTS__RESOLVED_INSTRUCTION_INPUT_MUST_BE_NON_NULL]: {
672
+ inputName: string;
673
+ };
674
+ [SOLANA_ERROR__PROGRAM_CLIENTS__UNEXPECTED_RESOLVED_INSTRUCTION_INPUT_TYPE]: {
675
+ expectedType: string;
676
+ inputName: string;
677
+ };
678
+ [SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_ACCOUNT_TYPE]: {
679
+ accountType: number | string;
680
+ programName: string;
681
+ };
682
+ [SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE]: {
683
+ instructionType: number | string;
684
+ programName: string;
685
+ };
686
+ [SOLANA_ERROR__RPC_SUBSCRIPTIONS__CANNOT_CREATE_SUBSCRIPTION_PLAN]: {
687
+ notificationName: string;
688
+ };
689
+ [SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_FAILED_TO_CONNECT]: {
690
+ errorEvent: Event;
691
+ };
692
+ [SOLANA_ERROR__RPC__API_PLAN_MISSING_FOR_RPC_METHOD]: {
693
+ method: string;
694
+ params: readonly unknown[];
695
+ };
696
+ [SOLANA_ERROR__RPC__INTEGER_OVERFLOW]: {
697
+ argumentLabel: string;
698
+ keyPath: readonly (number | string | symbol)[];
699
+ methodName: string;
700
+ optionalPathLabel: string;
701
+ path?: string;
702
+ value: bigint;
703
+ };
704
+ [SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR]: {
705
+ headers: Headers;
706
+ message: string;
707
+ statusCode: number;
708
+ };
709
+ [SOLANA_ERROR__RPC__TRANSPORT_HTTP_HEADER_FORBIDDEN]: {
710
+ headers: readonly string[];
711
+ };
712
+ [SOLANA_ERROR__SIGNER__ADDRESS_CANNOT_HAVE_MULTIPLE_SIGNERS]: {
713
+ address: string;
714
+ };
715
+ [SOLANA_ERROR__SIGNER__EXPECTED_KEY_PAIR_SIGNER]: {
716
+ address: string;
717
+ };
718
+ [SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_MODIFYING_SIGNER]: {
719
+ address: string;
720
+ };
721
+ [SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_PARTIAL_SIGNER]: {
722
+ address: string;
723
+ };
724
+ [SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_SIGNER]: {
725
+ address: string;
726
+ };
727
+ [SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_MODIFYING_SIGNER]: {
728
+ address: string;
729
+ };
730
+ [SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_PARTIAL_SIGNER]: {
731
+ address: string;
732
+ };
733
+ [SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SENDING_SIGNER]: {
734
+ address: string;
735
+ };
736
+ [SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SIGNER]: {
737
+ address: string;
738
+ };
739
+ [SOLANA_ERROR__SUBTLE_CRYPTO__CANNOT_EXPORT_NON_EXTRACTABLE_KEY]: {
740
+ key: CryptoKey;
741
+ };
742
+ [SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE]: {
743
+ value: bigint;
744
+ };
745
+ [SOLANA_ERROR__TRANSACTION_ERROR__DUPLICATE_INSTRUCTION]: {
746
+ index: number;
747
+ };
748
+ [SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_RENT]: {
749
+ accountIndex: number;
750
+ };
751
+ [SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED]: {
752
+ accountIndex: number;
753
+ };
754
+ [SOLANA_ERROR__TRANSACTION_ERROR__UNKNOWN]: {
755
+ errorName: string;
756
+ transactionErrorContext?: unknown;
757
+ };
758
+ [SOLANA_ERROR__TRANSACTION__ADDRESSES_CANNOT_SIGN_TRANSACTION]: {
759
+ expectedAddresses: readonly string[];
760
+ unexpectedAddresses: readonly string[];
761
+ };
762
+ [SOLANA_ERROR__TRANSACTION__ADDRESS_MISSING]: {
763
+ index: number;
764
+ };
765
+ [SOLANA_ERROR__TRANSACTION__EXCEEDS_SIZE_LIMIT]: {
766
+ transactionSize: Bytes;
767
+ transactionSizeLimit: Bytes;
768
+ };
769
+ [SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING]: {
770
+ lookupTableAddresses: readonly string[];
771
+ };
772
+ [SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE]: {
773
+ highestKnownIndex: number;
774
+ highestRequestedIndex: number;
775
+ lookupTableAddress: string;
776
+ };
777
+ [SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND]: {
778
+ index: number;
779
+ };
780
+ [SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT]: Omit<
781
+ RpcSimulateTransactionResult,
782
+ 'err'
783
+ >;
784
+ [SOLANA_ERROR__TRANSACTION__INVALID_CONFIG_MASK_PRIORITY_FEE_BITS]: {
785
+ mask: number;
786
+ };
787
+ [SOLANA_ERROR__TRANSACTION__INVALID_NONCE_ACCOUNT_INDEX]: {
788
+ nonce: string;
789
+ nonceAccountIndex: number;
790
+ numberOfStaticAccounts: number;
791
+ };
792
+ [SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES]: {
793
+ programAddress: string;
794
+ };
795
+ [SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE]: {
796
+ programAddress: string;
797
+ };
798
+ [SOLANA_ERROR__TRANSACTION__MALFORMED_MESSAGE_BYTES]: {
799
+ messageBytes: ReadonlyUint8Array;
800
+ };
801
+ [SOLANA_ERROR__TRANSACTION__MESSAGE_SIGNATURES_MISMATCH]: {
802
+ numRequiredSignatures: number;
803
+ signaturesLength: number;
804
+ signerAddresses: readonly string[];
805
+ };
806
+ [SOLANA_ERROR__TRANSACTION__NONCE_ACCOUNT_CANNOT_BE_IN_LOOKUP_TABLE]: {
807
+ nonce: string;
808
+ };
809
+ [SOLANA_ERROR__TRANSACTION__SIGNATURES_MISSING]: {
810
+ addresses: readonly string[];
811
+ };
812
+ [SOLANA_ERROR__TRANSACTION__SIGNATURE_COUNT_TOO_HIGH_FOR_TRANSACTION_BYTES]: {
813
+ numExpectedSignatures: number;
814
+ transactionBytes: ReadonlyUint8Array;
815
+ transactionBytesLength: number;
816
+ };
817
+ [SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_NOT_SUPPORTED]: {
818
+ unsupportedVersion: number;
819
+ };
820
+ [SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_OUT_OF_RANGE]: {
821
+ actualVersion: number;
822
+ };
823
+ [SOLANA_ERROR__TRANSACTION__VERSION_ZERO_MUST_BE_ENCODED_WITH_SIGNATURES_FIRST]: {
824
+ firstByte: number;
825
+ transactionBytes: ReadonlyUint8Array;
826
+ };
827
+ }
828
+ >
829
+ >;
830
+
831
+ export function decodeEncodedContext(encodedContext: string): object {
832
+ const decodedUrlString = __NODEJS__ ? Buffer.from(encodedContext, 'base64').toString('utf8') : atob(encodedContext);
833
+ return Object.fromEntries(new URLSearchParams(decodedUrlString).entries());
834
+ }
835
+
836
+ function encodeValue(value: unknown): string {
837
+ if (Array.isArray(value)) {
838
+ const commaSeparatedValues = value.map(encodeValue).join('%2C%20' /* ", " */);
839
+ return '%5B' /* "[" */ + commaSeparatedValues + /* "]" */ '%5D';
840
+ } else if (typeof value === 'bigint') {
841
+ return `${value}n`;
842
+ } else {
843
+ return encodeURIComponent(
844
+ String(
845
+ value != null && Object.getPrototypeOf(value) === null
846
+ ? // Plain objects with no prototype don't have a `toString` method.
847
+ // Convert them before stringifying them.
848
+ { ...(value as object) }
849
+ : value,
850
+ ),
851
+ );
852
+ }
853
+ }
854
+
855
+ function encodeObjectContextEntry([key, value]: [string, unknown]): `${typeof key}=${string}` {
856
+ return `${key}=${encodeValue(value)}`;
857
+ }
858
+
859
+ export function encodeContextObject(context: object): string {
860
+ const searchParamsString = Object.entries(context).map(encodeObjectContextEntry).join('&');
861
+ return __NODEJS__ ? Buffer.from(searchParamsString, 'utf8').toString('base64') : btoa(searchParamsString);
862
+ }