@solana-program/system 0.9.1 → 0.11.0

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.
Files changed (39) hide show
  1. package/dist/src/index.js +243 -293
  2. package/dist/src/index.js.map +1 -1
  3. package/dist/src/index.mjs +244 -295
  4. package/dist/src/index.mjs.map +1 -1
  5. package/dist/types/generated/accounts/nonce.d.ts +3 -0
  6. package/dist/types/generated/accounts/nonce.d.ts.map +1 -1
  7. package/dist/types/generated/errors/system.d.ts.map +1 -1
  8. package/dist/types/generated/instructions/advanceNonceAccount.d.ts +1 -1
  9. package/dist/types/generated/instructions/advanceNonceAccount.d.ts.map +1 -1
  10. package/dist/types/generated/instructions/allocate.d.ts +1 -1
  11. package/dist/types/generated/instructions/allocate.d.ts.map +1 -1
  12. package/dist/types/generated/instructions/allocateWithSeed.d.ts +1 -1
  13. package/dist/types/generated/instructions/allocateWithSeed.d.ts.map +1 -1
  14. package/dist/types/generated/instructions/assign.d.ts +1 -1
  15. package/dist/types/generated/instructions/assign.d.ts.map +1 -1
  16. package/dist/types/generated/instructions/assignWithSeed.d.ts +1 -1
  17. package/dist/types/generated/instructions/assignWithSeed.d.ts.map +1 -1
  18. package/dist/types/generated/instructions/authorizeNonceAccount.d.ts +1 -1
  19. package/dist/types/generated/instructions/authorizeNonceAccount.d.ts.map +1 -1
  20. package/dist/types/generated/instructions/createAccount.d.ts +1 -1
  21. package/dist/types/generated/instructions/createAccount.d.ts.map +1 -1
  22. package/dist/types/generated/instructions/createAccountWithSeed.d.ts +1 -1
  23. package/dist/types/generated/instructions/createAccountWithSeed.d.ts.map +1 -1
  24. package/dist/types/generated/instructions/initializeNonceAccount.d.ts +1 -1
  25. package/dist/types/generated/instructions/initializeNonceAccount.d.ts.map +1 -1
  26. package/dist/types/generated/instructions/transferSol.d.ts +1 -1
  27. package/dist/types/generated/instructions/transferSol.d.ts.map +1 -1
  28. package/dist/types/generated/instructions/transferSolWithSeed.d.ts +1 -1
  29. package/dist/types/generated/instructions/transferSolWithSeed.d.ts.map +1 -1
  30. package/dist/types/generated/instructions/upgradeNonceAccount.d.ts +1 -1
  31. package/dist/types/generated/instructions/upgradeNonceAccount.d.ts.map +1 -1
  32. package/dist/types/generated/instructions/withdrawNonceAccount.d.ts +1 -1
  33. package/dist/types/generated/instructions/withdrawNonceAccount.d.ts.map +1 -1
  34. package/dist/types/generated/programs/system.d.ts +2 -1
  35. package/dist/types/generated/programs/system.d.ts.map +1 -1
  36. package/dist/types/generated/shared/index.d.ts.map +1 -1
  37. package/dist/types/generated/types/nonceState.d.ts.map +1 -1
  38. package/dist/types/generated/types/nonceVersion.d.ts.map +1 -1
  39. package/package.json +14 -27
@@ -1,4 +1,4 @@
1
- import { getEnumEncoder, getU32Encoder, getEnumDecoder, getU32Decoder, combineCodec, getStructEncoder, getAddressEncoder, getU64Encoder, getStructDecoder, getAddressDecoder, getU64Decoder, decodeAccount, assertAccountExists, fetchEncodedAccount, assertAccountsExist, fetchEncodedAccounts, containsBytes, isProgramError, transformEncoder, addEncoderSizePrefix, getUtf8Encoder, addDecoderSizePrefix, getUtf8Decoder, BASE_ACCOUNT_SIZE, AccountRole, upgradeRoleToSigner, isTransactionSigner as isTransactionSigner$1 } from '@solana/kit';
1
+ import { getEnumEncoder, getU32Encoder, getEnumDecoder, getU32Decoder, combineCodec, getStructEncoder, getAddressEncoder, getU64Encoder, getStructDecoder, getAddressDecoder, getU64Decoder, decodeAccount, assertAccountExists, fetchEncodedAccount, assertAccountsExist, fetchEncodedAccounts, transformEncoder, addEncoderSizePrefix, getUtf8Encoder, addDecoderSizePrefix, getUtf8Decoder, containsBytes, assertIsInstructionWithAccounts, isProgramError, BASE_ACCOUNT_SIZE, AccountRole, upgradeRoleToSigner, isTransactionSigner as isTransactionSigner$1 } from '@solana/kit';
2
2
 
3
3
  // src/generated/accounts/nonce.ts
4
4
  var NonceState = /* @__PURE__ */ ((NonceState2) => {
@@ -53,10 +53,7 @@ function getNonceCodec() {
53
53
  return combineCodec(getNonceEncoder(), getNonceDecoder());
54
54
  }
55
55
  function decodeNonce(encodedAccount) {
56
- return decodeAccount(
57
- encodedAccount,
58
- getNonceDecoder()
59
- );
56
+ return decodeAccount(encodedAccount, getNonceDecoder());
60
57
  }
61
58
  async function fetchNonce(rpc, address, config) {
62
59
  const maybeAccount = await fetchMaybeNonce(rpc, address, config);
@@ -79,111 +76,6 @@ async function fetchAllMaybeNonce(rpc, addresses, config) {
79
76
  function getNonceSize() {
80
77
  return 80;
81
78
  }
82
- var SYSTEM_PROGRAM_ADDRESS = "11111111111111111111111111111111";
83
- var SystemAccount = /* @__PURE__ */ ((SystemAccount2) => {
84
- SystemAccount2[SystemAccount2["Nonce"] = 0] = "Nonce";
85
- return SystemAccount2;
86
- })(SystemAccount || {});
87
- var SystemInstruction = /* @__PURE__ */ ((SystemInstruction2) => {
88
- SystemInstruction2[SystemInstruction2["CreateAccount"] = 0] = "CreateAccount";
89
- SystemInstruction2[SystemInstruction2["Assign"] = 1] = "Assign";
90
- SystemInstruction2[SystemInstruction2["TransferSol"] = 2] = "TransferSol";
91
- SystemInstruction2[SystemInstruction2["CreateAccountWithSeed"] = 3] = "CreateAccountWithSeed";
92
- SystemInstruction2[SystemInstruction2["AdvanceNonceAccount"] = 4] = "AdvanceNonceAccount";
93
- SystemInstruction2[SystemInstruction2["WithdrawNonceAccount"] = 5] = "WithdrawNonceAccount";
94
- SystemInstruction2[SystemInstruction2["InitializeNonceAccount"] = 6] = "InitializeNonceAccount";
95
- SystemInstruction2[SystemInstruction2["AuthorizeNonceAccount"] = 7] = "AuthorizeNonceAccount";
96
- SystemInstruction2[SystemInstruction2["Allocate"] = 8] = "Allocate";
97
- SystemInstruction2[SystemInstruction2["AllocateWithSeed"] = 9] = "AllocateWithSeed";
98
- SystemInstruction2[SystemInstruction2["AssignWithSeed"] = 10] = "AssignWithSeed";
99
- SystemInstruction2[SystemInstruction2["TransferSolWithSeed"] = 11] = "TransferSolWithSeed";
100
- SystemInstruction2[SystemInstruction2["UpgradeNonceAccount"] = 12] = "UpgradeNonceAccount";
101
- return SystemInstruction2;
102
- })(SystemInstruction || {});
103
- function identifySystemInstruction(instruction) {
104
- const data = "data" in instruction ? instruction.data : instruction;
105
- if (containsBytes(data, getU32Encoder().encode(0), 0)) {
106
- return 0 /* CreateAccount */;
107
- }
108
- if (containsBytes(data, getU32Encoder().encode(1), 0)) {
109
- return 1 /* Assign */;
110
- }
111
- if (containsBytes(data, getU32Encoder().encode(2), 0)) {
112
- return 2 /* TransferSol */;
113
- }
114
- if (containsBytes(data, getU32Encoder().encode(3), 0)) {
115
- return 3 /* CreateAccountWithSeed */;
116
- }
117
- if (containsBytes(data, getU32Encoder().encode(4), 0)) {
118
- return 4 /* AdvanceNonceAccount */;
119
- }
120
- if (containsBytes(data, getU32Encoder().encode(5), 0)) {
121
- return 5 /* WithdrawNonceAccount */;
122
- }
123
- if (containsBytes(data, getU32Encoder().encode(6), 0)) {
124
- return 6 /* InitializeNonceAccount */;
125
- }
126
- if (containsBytes(data, getU32Encoder().encode(7), 0)) {
127
- return 7 /* AuthorizeNonceAccount */;
128
- }
129
- if (containsBytes(data, getU32Encoder().encode(8), 0)) {
130
- return 8 /* Allocate */;
131
- }
132
- if (containsBytes(data, getU32Encoder().encode(9), 0)) {
133
- return 9 /* AllocateWithSeed */;
134
- }
135
- if (containsBytes(data, getU32Encoder().encode(10), 0)) {
136
- return 10 /* AssignWithSeed */;
137
- }
138
- if (containsBytes(data, getU32Encoder().encode(11), 0)) {
139
- return 11 /* TransferSolWithSeed */;
140
- }
141
- if (containsBytes(data, getU32Encoder().encode(12), 0)) {
142
- return 12 /* UpgradeNonceAccount */;
143
- }
144
- throw new Error(
145
- "The provided instruction could not be identified as a system instruction."
146
- );
147
- }
148
-
149
- // src/generated/errors/system.ts
150
- var SYSTEM_ERROR__ACCOUNT_ALREADY_IN_USE = 0;
151
- var SYSTEM_ERROR__RESULT_WITH_NEGATIVE_LAMPORTS = 1;
152
- var SYSTEM_ERROR__INVALID_PROGRAM_ID = 2;
153
- var SYSTEM_ERROR__INVALID_ACCOUNT_DATA_LENGTH = 3;
154
- var SYSTEM_ERROR__MAX_SEED_LENGTH_EXCEEDED = 4;
155
- var SYSTEM_ERROR__ADDRESS_WITH_SEED_MISMATCH = 5;
156
- var SYSTEM_ERROR__NONCE_NO_RECENT_BLOCKHASHES = 6;
157
- var SYSTEM_ERROR__NONCE_BLOCKHASH_NOT_EXPIRED = 7;
158
- var SYSTEM_ERROR__NONCE_UNEXPECTED_BLOCKHASH_VALUE = 8;
159
- var systemErrorMessages;
160
- if (process.env.NODE_ENV !== "production") {
161
- systemErrorMessages = {
162
- [SYSTEM_ERROR__ACCOUNT_ALREADY_IN_USE]: `an account with the same address already exists`,
163
- [SYSTEM_ERROR__ADDRESS_WITH_SEED_MISMATCH]: `provided address does not match addressed derived from seed`,
164
- [SYSTEM_ERROR__INVALID_ACCOUNT_DATA_LENGTH]: `cannot allocate account data of this length`,
165
- [SYSTEM_ERROR__INVALID_PROGRAM_ID]: `cannot assign account to this program id`,
166
- [SYSTEM_ERROR__MAX_SEED_LENGTH_EXCEEDED]: `length of requested seed is too long`,
167
- [SYSTEM_ERROR__NONCE_BLOCKHASH_NOT_EXPIRED]: `stored nonce is still in recent_blockhashes`,
168
- [SYSTEM_ERROR__NONCE_NO_RECENT_BLOCKHASHES]: `advancing stored nonce requires a populated RecentBlockhashes sysvar`,
169
- [SYSTEM_ERROR__NONCE_UNEXPECTED_BLOCKHASH_VALUE]: `specified nonce does not match stored nonce`,
170
- [SYSTEM_ERROR__RESULT_WITH_NEGATIVE_LAMPORTS]: `account does not have enough SOL to perform the operation`
171
- };
172
- }
173
- function getSystemErrorMessage(code) {
174
- if (process.env.NODE_ENV !== "production") {
175
- return systemErrorMessages[code];
176
- }
177
- return "Error message not available in production bundles.";
178
- }
179
- function isSystemError(error, transactionMessage, code) {
180
- return isProgramError(
181
- error,
182
- transactionMessage,
183
- SYSTEM_PROGRAM_ADDRESS,
184
- code
185
- );
186
- }
187
79
  function expectAddress(value) {
188
80
  if (!value) {
189
81
  throw new Error("Expected a Address.");
@@ -219,31 +111,22 @@ function getAdvanceNonceAccountDiscriminatorBytes() {
219
111
  return getU32Encoder().encode(ADVANCE_NONCE_ACCOUNT_DISCRIMINATOR);
220
112
  }
221
113
  function getAdvanceNonceAccountInstructionDataEncoder() {
222
- return transformEncoder(
223
- getStructEncoder([["discriminator", getU32Encoder()]]),
224
- (value) => ({
225
- ...value,
226
- discriminator: ADVANCE_NONCE_ACCOUNT_DISCRIMINATOR
227
- })
228
- );
114
+ return transformEncoder(getStructEncoder([["discriminator", getU32Encoder()]]), (value) => ({
115
+ ...value,
116
+ discriminator: ADVANCE_NONCE_ACCOUNT_DISCRIMINATOR
117
+ }));
229
118
  }
230
119
  function getAdvanceNonceAccountInstructionDataDecoder() {
231
120
  return getStructDecoder([["discriminator", getU32Decoder()]]);
232
121
  }
233
122
  function getAdvanceNonceAccountInstructionDataCodec() {
234
- return combineCodec(
235
- getAdvanceNonceAccountInstructionDataEncoder(),
236
- getAdvanceNonceAccountInstructionDataDecoder()
237
- );
123
+ return combineCodec(getAdvanceNonceAccountInstructionDataEncoder(), getAdvanceNonceAccountInstructionDataDecoder());
238
124
  }
239
125
  function getAdvanceNonceAccountInstruction(input, config) {
240
126
  const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
241
127
  const originalAccounts = {
242
128
  nonceAccount: { value: input.nonceAccount ?? null, isWritable: true },
243
- recentBlockhashesSysvar: {
244
- value: input.recentBlockhashesSysvar ?? null,
245
- isWritable: false
246
- },
129
+ recentBlockhashesSysvar: { value: input.recentBlockhashesSysvar ?? null, isWritable: false },
247
130
  nonceAuthority: { value: input.nonceAuthority ?? null, isWritable: false }
248
131
  };
249
132
  const accounts = originalAccounts;
@@ -278,9 +161,7 @@ function parseAdvanceNonceAccountInstruction(instruction) {
278
161
  recentBlockhashesSysvar: getNextAccount(),
279
162
  nonceAuthority: getNextAccount()
280
163
  },
281
- data: getAdvanceNonceAccountInstructionDataDecoder().decode(
282
- instruction.data
283
- )
164
+ data: getAdvanceNonceAccountInstructionDataDecoder().decode(instruction.data)
284
165
  };
285
166
  }
286
167
  var ALLOCATE_DISCRIMINATOR = 8;
@@ -303,24 +184,17 @@ function getAllocateInstructionDataDecoder() {
303
184
  ]);
304
185
  }
305
186
  function getAllocateInstructionDataCodec() {
306
- return combineCodec(
307
- getAllocateInstructionDataEncoder(),
308
- getAllocateInstructionDataDecoder()
309
- );
187
+ return combineCodec(getAllocateInstructionDataEncoder(), getAllocateInstructionDataDecoder());
310
188
  }
311
189
  function getAllocateInstruction(input, config) {
312
190
  const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
313
- const originalAccounts = {
314
- newAccount: { value: input.newAccount ?? null, isWritable: true }
315
- };
191
+ const originalAccounts = { newAccount: { value: input.newAccount ?? null, isWritable: true } };
316
192
  const accounts = originalAccounts;
317
193
  const args = { ...input };
318
194
  const getAccountMeta = getAccountMetaFactory();
319
195
  return Object.freeze({
320
196
  accounts: [getAccountMeta(accounts.newAccount)],
321
- data: getAllocateInstructionDataEncoder().encode(
322
- args
323
- ),
197
+ data: getAllocateInstructionDataEncoder().encode(args),
324
198
  programAddress
325
199
  });
326
200
  }
@@ -366,10 +240,7 @@ function getAllocateWithSeedInstructionDataDecoder() {
366
240
  ]);
367
241
  }
368
242
  function getAllocateWithSeedInstructionDataCodec() {
369
- return combineCodec(
370
- getAllocateWithSeedInstructionDataEncoder(),
371
- getAllocateWithSeedInstructionDataDecoder()
372
- );
243
+ return combineCodec(getAllocateWithSeedInstructionDataEncoder(), getAllocateWithSeedInstructionDataDecoder());
373
244
  }
374
245
  function getAllocateWithSeedInstruction(input, config) {
375
246
  const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
@@ -381,13 +252,8 @@ function getAllocateWithSeedInstruction(input, config) {
381
252
  const args = { ...input };
382
253
  const getAccountMeta = getAccountMetaFactory();
383
254
  return Object.freeze({
384
- accounts: [
385
- getAccountMeta(accounts.newAccount),
386
- getAccountMeta(accounts.baseAccount)
387
- ],
388
- data: getAllocateWithSeedInstructionDataEncoder().encode(
389
- args
390
- ),
255
+ accounts: [getAccountMeta(accounts.newAccount), getAccountMeta(accounts.baseAccount)],
256
+ data: getAllocateWithSeedInstructionDataEncoder().encode(args),
391
257
  programAddress
392
258
  });
393
259
  }
@@ -427,24 +293,17 @@ function getAssignInstructionDataDecoder() {
427
293
  ]);
428
294
  }
429
295
  function getAssignInstructionDataCodec() {
430
- return combineCodec(
431
- getAssignInstructionDataEncoder(),
432
- getAssignInstructionDataDecoder()
433
- );
296
+ return combineCodec(getAssignInstructionDataEncoder(), getAssignInstructionDataDecoder());
434
297
  }
435
298
  function getAssignInstruction(input, config) {
436
299
  const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
437
- const originalAccounts = {
438
- account: { value: input.account ?? null, isWritable: true }
439
- };
300
+ const originalAccounts = { account: { value: input.account ?? null, isWritable: true } };
440
301
  const accounts = originalAccounts;
441
302
  const args = { ...input };
442
303
  const getAccountMeta = getAccountMetaFactory();
443
304
  return Object.freeze({
444
305
  accounts: [getAccountMeta(accounts.account)],
445
- data: getAssignInstructionDataEncoder().encode(
446
- args
447
- ),
306
+ data: getAssignInstructionDataEncoder().encode(args),
448
307
  programAddress
449
308
  });
450
309
  }
@@ -488,10 +347,7 @@ function getAssignWithSeedInstructionDataDecoder() {
488
347
  ]);
489
348
  }
490
349
  function getAssignWithSeedInstructionDataCodec() {
491
- return combineCodec(
492
- getAssignWithSeedInstructionDataEncoder(),
493
- getAssignWithSeedInstructionDataDecoder()
494
- );
350
+ return combineCodec(getAssignWithSeedInstructionDataEncoder(), getAssignWithSeedInstructionDataDecoder());
495
351
  }
496
352
  function getAssignWithSeedInstruction(input, config) {
497
353
  const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
@@ -503,13 +359,8 @@ function getAssignWithSeedInstruction(input, config) {
503
359
  const args = { ...input };
504
360
  const getAccountMeta = getAccountMetaFactory();
505
361
  return Object.freeze({
506
- accounts: [
507
- getAccountMeta(accounts.account),
508
- getAccountMeta(accounts.baseAccount)
509
- ],
510
- data: getAssignWithSeedInstructionDataEncoder().encode(
511
- args
512
- ),
362
+ accounts: [getAccountMeta(accounts.account), getAccountMeta(accounts.baseAccount)],
363
+ data: getAssignWithSeedInstructionDataEncoder().encode(args),
513
364
  programAddress
514
365
  });
515
366
  }
@@ -539,10 +390,7 @@ function getAuthorizeNonceAccountInstructionDataEncoder() {
539
390
  ["discriminator", getU32Encoder()],
540
391
  ["newNonceAuthority", getAddressEncoder()]
541
392
  ]),
542
- (value) => ({
543
- ...value,
544
- discriminator: AUTHORIZE_NONCE_ACCOUNT_DISCRIMINATOR
545
- })
393
+ (value) => ({ ...value, discriminator: AUTHORIZE_NONCE_ACCOUNT_DISCRIMINATOR })
546
394
  );
547
395
  }
548
396
  function getAuthorizeNonceAccountInstructionDataDecoder() {
@@ -567,13 +415,8 @@ function getAuthorizeNonceAccountInstruction(input, config) {
567
415
  const args = { ...input };
568
416
  const getAccountMeta = getAccountMetaFactory();
569
417
  return Object.freeze({
570
- accounts: [
571
- getAccountMeta(accounts.nonceAccount),
572
- getAccountMeta(accounts.nonceAuthority)
573
- ],
574
- data: getAuthorizeNonceAccountInstructionDataEncoder().encode(
575
- args
576
- ),
418
+ accounts: [getAccountMeta(accounts.nonceAccount), getAccountMeta(accounts.nonceAuthority)],
419
+ data: getAuthorizeNonceAccountInstructionDataEncoder().encode(args),
577
420
  programAddress
578
421
  });
579
422
  }
@@ -589,13 +432,8 @@ function parseAuthorizeNonceAccountInstruction(instruction) {
589
432
  };
590
433
  return {
591
434
  programAddress: instruction.programAddress,
592
- accounts: {
593
- nonceAccount: getNextAccount(),
594
- nonceAuthority: getNextAccount()
595
- },
596
- data: getAuthorizeNonceAccountInstructionDataDecoder().decode(
597
- instruction.data
598
- )
435
+ accounts: { nonceAccount: getNextAccount(), nonceAuthority: getNextAccount() },
436
+ data: getAuthorizeNonceAccountInstructionDataDecoder().decode(instruction.data)
599
437
  };
600
438
  }
601
439
  var CREATE_ACCOUNT_DISCRIMINATOR = 0;
@@ -622,10 +460,7 @@ function getCreateAccountInstructionDataDecoder() {
622
460
  ]);
623
461
  }
624
462
  function getCreateAccountInstructionDataCodec() {
625
- return combineCodec(
626
- getCreateAccountInstructionDataEncoder(),
627
- getCreateAccountInstructionDataDecoder()
628
- );
463
+ return combineCodec(getCreateAccountInstructionDataEncoder(), getCreateAccountInstructionDataDecoder());
629
464
  }
630
465
  function getCreateAccountInstruction(input, config) {
631
466
  const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
@@ -635,20 +470,12 @@ function getCreateAccountInstruction(input, config) {
635
470
  };
636
471
  const accounts = originalAccounts;
637
472
  const args = { ...input };
638
- const byteDelta = [Number(args.space) + BASE_ACCOUNT_SIZE].reduce(
639
- (a, b) => a + b,
640
- 0
641
- );
473
+ const byteDelta = [Number(args.space) + BASE_ACCOUNT_SIZE].reduce((a, b) => a + b, 0);
642
474
  const getAccountMeta = getAccountMetaFactory();
643
475
  return Object.freeze({
644
- accounts: [
645
- getAccountMeta(accounts.payer),
646
- getAccountMeta(accounts.newAccount)
647
- ],
476
+ accounts: [getAccountMeta(accounts.payer), getAccountMeta(accounts.newAccount)],
648
477
  byteDelta,
649
- data: getCreateAccountInstructionDataEncoder().encode(
650
- args
651
- ),
478
+ data: getCreateAccountInstructionDataEncoder().encode(args),
652
479
  programAddress
653
480
  });
654
481
  }
@@ -682,10 +509,7 @@ function getCreateAccountWithSeedInstructionDataEncoder() {
682
509
  ["space", getU64Encoder()],
683
510
  ["programAddress", getAddressEncoder()]
684
511
  ]),
685
- (value) => ({
686
- ...value,
687
- discriminator: CREATE_ACCOUNT_WITH_SEED_DISCRIMINATOR
688
- })
512
+ (value) => ({ ...value, discriminator: CREATE_ACCOUNT_WITH_SEED_DISCRIMINATOR })
689
513
  );
690
514
  }
691
515
  function getCreateAccountWithSeedInstructionDataDecoder() {
@@ -720,9 +544,7 @@ function getCreateAccountWithSeedInstruction(input, config) {
720
544
  getAccountMeta(accounts.newAccount),
721
545
  getAccountMeta(accounts.baseAccount)
722
546
  ].filter((x) => x !== void 0),
723
- data: getCreateAccountWithSeedInstructionDataEncoder().encode(
724
- args
725
- ),
547
+ data: getCreateAccountWithSeedInstructionDataEncoder().encode(args),
726
548
  programAddress
727
549
  });
728
550
  }
@@ -744,14 +566,8 @@ function parseCreateAccountWithSeedInstruction(instruction) {
744
566
  };
745
567
  return {
746
568
  programAddress: instruction.programAddress,
747
- accounts: {
748
- payer: getNextAccount(),
749
- newAccount: getNextAccount(),
750
- baseAccount: getNextOptionalAccount()
751
- },
752
- data: getCreateAccountWithSeedInstructionDataDecoder().decode(
753
- instruction.data
754
- )
569
+ accounts: { payer: getNextAccount(), newAccount: getNextAccount(), baseAccount: getNextOptionalAccount() },
570
+ data: getCreateAccountWithSeedInstructionDataDecoder().decode(instruction.data)
755
571
  };
756
572
  }
757
573
  var INITIALIZE_NONCE_ACCOUNT_DISCRIMINATOR = 6;
@@ -764,10 +580,7 @@ function getInitializeNonceAccountInstructionDataEncoder() {
764
580
  ["discriminator", getU32Encoder()],
765
581
  ["nonceAuthority", getAddressEncoder()]
766
582
  ]),
767
- (value) => ({
768
- ...value,
769
- discriminator: INITIALIZE_NONCE_ACCOUNT_DISCRIMINATOR
770
- })
583
+ (value) => ({ ...value, discriminator: INITIALIZE_NONCE_ACCOUNT_DISCRIMINATOR })
771
584
  );
772
585
  }
773
586
  function getInitializeNonceAccountInstructionDataDecoder() {
@@ -786,10 +599,7 @@ function getInitializeNonceAccountInstruction(input, config) {
786
599
  const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
787
600
  const originalAccounts = {
788
601
  nonceAccount: { value: input.nonceAccount ?? null, isWritable: true },
789
- recentBlockhashesSysvar: {
790
- value: input.recentBlockhashesSysvar ?? null,
791
- isWritable: false
792
- },
602
+ recentBlockhashesSysvar: { value: input.recentBlockhashesSysvar ?? null, isWritable: false },
793
603
  rentSysvar: { value: input.rentSysvar ?? null, isWritable: false }
794
604
  };
795
605
  const accounts = originalAccounts;
@@ -830,9 +640,7 @@ function parseInitializeNonceAccountInstruction(instruction) {
830
640
  recentBlockhashesSysvar: getNextAccount(),
831
641
  rentSysvar: getNextAccount()
832
642
  },
833
- data: getInitializeNonceAccountInstructionDataDecoder().decode(
834
- instruction.data
835
- )
643
+ data: getInitializeNonceAccountInstructionDataDecoder().decode(instruction.data)
836
644
  };
837
645
  }
838
646
  var TRANSFER_SOL_DISCRIMINATOR = 2;
@@ -855,10 +663,7 @@ function getTransferSolInstructionDataDecoder() {
855
663
  ]);
856
664
  }
857
665
  function getTransferSolInstructionDataCodec() {
858
- return combineCodec(
859
- getTransferSolInstructionDataEncoder(),
860
- getTransferSolInstructionDataDecoder()
861
- );
666
+ return combineCodec(getTransferSolInstructionDataEncoder(), getTransferSolInstructionDataDecoder());
862
667
  }
863
668
  function getTransferSolInstruction(input, config) {
864
669
  const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
@@ -870,13 +675,8 @@ function getTransferSolInstruction(input, config) {
870
675
  const args = { ...input };
871
676
  const getAccountMeta = getAccountMetaFactory();
872
677
  return Object.freeze({
873
- accounts: [
874
- getAccountMeta(accounts.source),
875
- getAccountMeta(accounts.destination)
876
- ],
877
- data: getTransferSolInstructionDataEncoder().encode(
878
- args
879
- ),
678
+ accounts: [getAccountMeta(accounts.source), getAccountMeta(accounts.destination)],
679
+ data: getTransferSolInstructionDataEncoder().encode(args),
880
680
  programAddress
881
681
  });
882
682
  }
@@ -908,10 +708,7 @@ function getTransferSolWithSeedInstructionDataEncoder() {
908
708
  ["fromSeed", addEncoderSizePrefix(getUtf8Encoder(), getU64Encoder())],
909
709
  ["fromOwner", getAddressEncoder()]
910
710
  ]),
911
- (value) => ({
912
- ...value,
913
- discriminator: TRANSFER_SOL_WITH_SEED_DISCRIMINATOR
914
- })
711
+ (value) => ({ ...value, discriminator: TRANSFER_SOL_WITH_SEED_DISCRIMINATOR })
915
712
  );
916
713
  }
917
714
  function getTransferSolWithSeedInstructionDataDecoder() {
@@ -923,10 +720,7 @@ function getTransferSolWithSeedInstructionDataDecoder() {
923
720
  ]);
924
721
  }
925
722
  function getTransferSolWithSeedInstructionDataCodec() {
926
- return combineCodec(
927
- getTransferSolWithSeedInstructionDataEncoder(),
928
- getTransferSolWithSeedInstructionDataDecoder()
929
- );
723
+ return combineCodec(getTransferSolWithSeedInstructionDataEncoder(), getTransferSolWithSeedInstructionDataDecoder());
930
724
  }
931
725
  function getTransferSolWithSeedInstruction(input, config) {
932
726
  const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
@@ -944,9 +738,7 @@ function getTransferSolWithSeedInstruction(input, config) {
944
738
  getAccountMeta(accounts.baseAccount),
945
739
  getAccountMeta(accounts.destination)
946
740
  ],
947
- data: getTransferSolWithSeedInstructionDataEncoder().encode(
948
- args
949
- ),
741
+ data: getTransferSolWithSeedInstructionDataEncoder().encode(args),
950
742
  programAddress
951
743
  });
952
744
  }
@@ -962,14 +754,8 @@ function parseTransferSolWithSeedInstruction(instruction) {
962
754
  };
963
755
  return {
964
756
  programAddress: instruction.programAddress,
965
- accounts: {
966
- source: getNextAccount(),
967
- baseAccount: getNextAccount(),
968
- destination: getNextAccount()
969
- },
970
- data: getTransferSolWithSeedInstructionDataDecoder().decode(
971
- instruction.data
972
- )
757
+ accounts: { source: getNextAccount(), baseAccount: getNextAccount(), destination: getNextAccount() },
758
+ data: getTransferSolWithSeedInstructionDataDecoder().decode(instruction.data)
973
759
  };
974
760
  }
975
761
  var UPGRADE_NONCE_ACCOUNT_DISCRIMINATOR = 12;
@@ -977,28 +763,20 @@ function getUpgradeNonceAccountDiscriminatorBytes() {
977
763
  return getU32Encoder().encode(UPGRADE_NONCE_ACCOUNT_DISCRIMINATOR);
978
764
  }
979
765
  function getUpgradeNonceAccountInstructionDataEncoder() {
980
- return transformEncoder(
981
- getStructEncoder([["discriminator", getU32Encoder()]]),
982
- (value) => ({
983
- ...value,
984
- discriminator: UPGRADE_NONCE_ACCOUNT_DISCRIMINATOR
985
- })
986
- );
766
+ return transformEncoder(getStructEncoder([["discriminator", getU32Encoder()]]), (value) => ({
767
+ ...value,
768
+ discriminator: UPGRADE_NONCE_ACCOUNT_DISCRIMINATOR
769
+ }));
987
770
  }
988
771
  function getUpgradeNonceAccountInstructionDataDecoder() {
989
772
  return getStructDecoder([["discriminator", getU32Decoder()]]);
990
773
  }
991
774
  function getUpgradeNonceAccountInstructionDataCodec() {
992
- return combineCodec(
993
- getUpgradeNonceAccountInstructionDataEncoder(),
994
- getUpgradeNonceAccountInstructionDataDecoder()
995
- );
775
+ return combineCodec(getUpgradeNonceAccountInstructionDataEncoder(), getUpgradeNonceAccountInstructionDataDecoder());
996
776
  }
997
777
  function getUpgradeNonceAccountInstruction(input, config) {
998
778
  const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
999
- const originalAccounts = {
1000
- nonceAccount: { value: input.nonceAccount ?? null, isWritable: true }
1001
- };
779
+ const originalAccounts = { nonceAccount: { value: input.nonceAccount ?? null, isWritable: true } };
1002
780
  const accounts = originalAccounts;
1003
781
  const getAccountMeta = getAccountMetaFactory();
1004
782
  return Object.freeze({
@@ -1020,9 +798,7 @@ function parseUpgradeNonceAccountInstruction(instruction) {
1020
798
  return {
1021
799
  programAddress: instruction.programAddress,
1022
800
  accounts: { nonceAccount: getNextAccount() },
1023
- data: getUpgradeNonceAccountInstructionDataDecoder().decode(
1024
- instruction.data
1025
- )
801
+ data: getUpgradeNonceAccountInstructionDataDecoder().decode(instruction.data)
1026
802
  };
1027
803
  }
1028
804
  var WITHDRAW_NONCE_ACCOUNT_DISCRIMINATOR = 5;
@@ -1035,10 +811,7 @@ function getWithdrawNonceAccountInstructionDataEncoder() {
1035
811
  ["discriminator", getU32Encoder()],
1036
812
  ["withdrawAmount", getU64Encoder()]
1037
813
  ]),
1038
- (value) => ({
1039
- ...value,
1040
- discriminator: WITHDRAW_NONCE_ACCOUNT_DISCRIMINATOR
1041
- })
814
+ (value) => ({ ...value, discriminator: WITHDRAW_NONCE_ACCOUNT_DISCRIMINATOR })
1042
815
  );
1043
816
  }
1044
817
  function getWithdrawNonceAccountInstructionDataDecoder() {
@@ -1057,14 +830,8 @@ function getWithdrawNonceAccountInstruction(input, config) {
1057
830
  const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
1058
831
  const originalAccounts = {
1059
832
  nonceAccount: { value: input.nonceAccount ?? null, isWritable: true },
1060
- recipientAccount: {
1061
- value: input.recipientAccount ?? null,
1062
- isWritable: true
1063
- },
1064
- recentBlockhashesSysvar: {
1065
- value: input.recentBlockhashesSysvar ?? null,
1066
- isWritable: false
1067
- },
833
+ recipientAccount: { value: input.recipientAccount ?? null, isWritable: true },
834
+ recentBlockhashesSysvar: { value: input.recentBlockhashesSysvar ?? null, isWritable: false },
1068
835
  rentSysvar: { value: input.rentSysvar ?? null, isWritable: false },
1069
836
  nonceAuthority: { value: input.nonceAuthority ?? null, isWritable: false }
1070
837
  };
@@ -1085,9 +852,7 @@ function getWithdrawNonceAccountInstruction(input, config) {
1085
852
  getAccountMeta(accounts.rentSysvar),
1086
853
  getAccountMeta(accounts.nonceAuthority)
1087
854
  ],
1088
- data: getWithdrawNonceAccountInstructionDataEncoder().encode(
1089
- args
1090
- ),
855
+ data: getWithdrawNonceAccountInstructionDataEncoder().encode(args),
1091
856
  programAddress
1092
857
  });
1093
858
  }
@@ -1110,12 +875,196 @@ function parseWithdrawNonceAccountInstruction(instruction) {
1110
875
  rentSysvar: getNextAccount(),
1111
876
  nonceAuthority: getNextAccount()
1112
877
  },
1113
- data: getWithdrawNonceAccountInstructionDataDecoder().decode(
1114
- instruction.data
1115
- )
878
+ data: getWithdrawNonceAccountInstructionDataDecoder().decode(instruction.data)
1116
879
  };
1117
880
  }
1118
881
 
1119
- export { ADVANCE_NONCE_ACCOUNT_DISCRIMINATOR, ALLOCATE_DISCRIMINATOR, ALLOCATE_WITH_SEED_DISCRIMINATOR, ASSIGN_DISCRIMINATOR, ASSIGN_WITH_SEED_DISCRIMINATOR, AUTHORIZE_NONCE_ACCOUNT_DISCRIMINATOR, CREATE_ACCOUNT_DISCRIMINATOR, CREATE_ACCOUNT_WITH_SEED_DISCRIMINATOR, INITIALIZE_NONCE_ACCOUNT_DISCRIMINATOR, NonceState, NonceVersion, SYSTEM_ERROR__ACCOUNT_ALREADY_IN_USE, SYSTEM_ERROR__ADDRESS_WITH_SEED_MISMATCH, SYSTEM_ERROR__INVALID_ACCOUNT_DATA_LENGTH, SYSTEM_ERROR__INVALID_PROGRAM_ID, SYSTEM_ERROR__MAX_SEED_LENGTH_EXCEEDED, SYSTEM_ERROR__NONCE_BLOCKHASH_NOT_EXPIRED, SYSTEM_ERROR__NONCE_NO_RECENT_BLOCKHASHES, SYSTEM_ERROR__NONCE_UNEXPECTED_BLOCKHASH_VALUE, SYSTEM_ERROR__RESULT_WITH_NEGATIVE_LAMPORTS, SYSTEM_PROGRAM_ADDRESS, SystemAccount, SystemInstruction, TRANSFER_SOL_DISCRIMINATOR, TRANSFER_SOL_WITH_SEED_DISCRIMINATOR, UPGRADE_NONCE_ACCOUNT_DISCRIMINATOR, WITHDRAW_NONCE_ACCOUNT_DISCRIMINATOR, decodeNonce, fetchAllMaybeNonce, fetchAllNonce, fetchMaybeNonce, fetchNonce, getAdvanceNonceAccountDiscriminatorBytes, getAdvanceNonceAccountInstruction, getAdvanceNonceAccountInstructionDataCodec, getAdvanceNonceAccountInstructionDataDecoder, getAdvanceNonceAccountInstructionDataEncoder, getAllocateDiscriminatorBytes, getAllocateInstruction, getAllocateInstructionDataCodec, getAllocateInstructionDataDecoder, getAllocateInstructionDataEncoder, getAllocateWithSeedDiscriminatorBytes, getAllocateWithSeedInstruction, getAllocateWithSeedInstructionDataCodec, getAllocateWithSeedInstructionDataDecoder, getAllocateWithSeedInstructionDataEncoder, getAssignDiscriminatorBytes, getAssignInstruction, getAssignInstructionDataCodec, getAssignInstructionDataDecoder, getAssignInstructionDataEncoder, getAssignWithSeedDiscriminatorBytes, getAssignWithSeedInstruction, getAssignWithSeedInstructionDataCodec, getAssignWithSeedInstructionDataDecoder, getAssignWithSeedInstructionDataEncoder, getAuthorizeNonceAccountDiscriminatorBytes, getAuthorizeNonceAccountInstruction, getAuthorizeNonceAccountInstructionDataCodec, getAuthorizeNonceAccountInstructionDataDecoder, getAuthorizeNonceAccountInstructionDataEncoder, getCreateAccountDiscriminatorBytes, getCreateAccountInstruction, getCreateAccountInstructionDataCodec, getCreateAccountInstructionDataDecoder, getCreateAccountInstructionDataEncoder, getCreateAccountWithSeedDiscriminatorBytes, getCreateAccountWithSeedInstruction, getCreateAccountWithSeedInstructionDataCodec, getCreateAccountWithSeedInstructionDataDecoder, getCreateAccountWithSeedInstructionDataEncoder, getInitializeNonceAccountDiscriminatorBytes, getInitializeNonceAccountInstruction, getInitializeNonceAccountInstructionDataCodec, getInitializeNonceAccountInstructionDataDecoder, getInitializeNonceAccountInstructionDataEncoder, getNonceCodec, getNonceDecoder, getNonceEncoder, getNonceSize, getNonceStateCodec, getNonceStateDecoder, getNonceStateEncoder, getNonceVersionCodec, getNonceVersionDecoder, getNonceVersionEncoder, getSystemErrorMessage, getTransferSolDiscriminatorBytes, getTransferSolInstruction, getTransferSolInstructionDataCodec, getTransferSolInstructionDataDecoder, getTransferSolInstructionDataEncoder, getTransferSolWithSeedDiscriminatorBytes, getTransferSolWithSeedInstruction, getTransferSolWithSeedInstructionDataCodec, getTransferSolWithSeedInstructionDataDecoder, getTransferSolWithSeedInstructionDataEncoder, getUpgradeNonceAccountDiscriminatorBytes, getUpgradeNonceAccountInstruction, getUpgradeNonceAccountInstructionDataCodec, getUpgradeNonceAccountInstructionDataDecoder, getUpgradeNonceAccountInstructionDataEncoder, getWithdrawNonceAccountDiscriminatorBytes, getWithdrawNonceAccountInstruction, getWithdrawNonceAccountInstructionDataCodec, getWithdrawNonceAccountInstructionDataDecoder, getWithdrawNonceAccountInstructionDataEncoder, identifySystemInstruction, isSystemError, parseAdvanceNonceAccountInstruction, parseAllocateInstruction, parseAllocateWithSeedInstruction, parseAssignInstruction, parseAssignWithSeedInstruction, parseAuthorizeNonceAccountInstruction, parseCreateAccountInstruction, parseCreateAccountWithSeedInstruction, parseInitializeNonceAccountInstruction, parseTransferSolInstruction, parseTransferSolWithSeedInstruction, parseUpgradeNonceAccountInstruction, parseWithdrawNonceAccountInstruction };
882
+ // src/generated/programs/system.ts
883
+ var SYSTEM_PROGRAM_ADDRESS = "11111111111111111111111111111111";
884
+ var SystemAccount = /* @__PURE__ */ ((SystemAccount2) => {
885
+ SystemAccount2[SystemAccount2["Nonce"] = 0] = "Nonce";
886
+ return SystemAccount2;
887
+ })(SystemAccount || {});
888
+ var SystemInstruction = /* @__PURE__ */ ((SystemInstruction2) => {
889
+ SystemInstruction2[SystemInstruction2["CreateAccount"] = 0] = "CreateAccount";
890
+ SystemInstruction2[SystemInstruction2["Assign"] = 1] = "Assign";
891
+ SystemInstruction2[SystemInstruction2["TransferSol"] = 2] = "TransferSol";
892
+ SystemInstruction2[SystemInstruction2["CreateAccountWithSeed"] = 3] = "CreateAccountWithSeed";
893
+ SystemInstruction2[SystemInstruction2["AdvanceNonceAccount"] = 4] = "AdvanceNonceAccount";
894
+ SystemInstruction2[SystemInstruction2["WithdrawNonceAccount"] = 5] = "WithdrawNonceAccount";
895
+ SystemInstruction2[SystemInstruction2["InitializeNonceAccount"] = 6] = "InitializeNonceAccount";
896
+ SystemInstruction2[SystemInstruction2["AuthorizeNonceAccount"] = 7] = "AuthorizeNonceAccount";
897
+ SystemInstruction2[SystemInstruction2["Allocate"] = 8] = "Allocate";
898
+ SystemInstruction2[SystemInstruction2["AllocateWithSeed"] = 9] = "AllocateWithSeed";
899
+ SystemInstruction2[SystemInstruction2["AssignWithSeed"] = 10] = "AssignWithSeed";
900
+ SystemInstruction2[SystemInstruction2["TransferSolWithSeed"] = 11] = "TransferSolWithSeed";
901
+ SystemInstruction2[SystemInstruction2["UpgradeNonceAccount"] = 12] = "UpgradeNonceAccount";
902
+ return SystemInstruction2;
903
+ })(SystemInstruction || {});
904
+ function identifySystemInstruction(instruction) {
905
+ const data = "data" in instruction ? instruction.data : instruction;
906
+ if (containsBytes(data, getU32Encoder().encode(0), 0)) {
907
+ return 0 /* CreateAccount */;
908
+ }
909
+ if (containsBytes(data, getU32Encoder().encode(1), 0)) {
910
+ return 1 /* Assign */;
911
+ }
912
+ if (containsBytes(data, getU32Encoder().encode(2), 0)) {
913
+ return 2 /* TransferSol */;
914
+ }
915
+ if (containsBytes(data, getU32Encoder().encode(3), 0)) {
916
+ return 3 /* CreateAccountWithSeed */;
917
+ }
918
+ if (containsBytes(data, getU32Encoder().encode(4), 0)) {
919
+ return 4 /* AdvanceNonceAccount */;
920
+ }
921
+ if (containsBytes(data, getU32Encoder().encode(5), 0)) {
922
+ return 5 /* WithdrawNonceAccount */;
923
+ }
924
+ if (containsBytes(data, getU32Encoder().encode(6), 0)) {
925
+ return 6 /* InitializeNonceAccount */;
926
+ }
927
+ if (containsBytes(data, getU32Encoder().encode(7), 0)) {
928
+ return 7 /* AuthorizeNonceAccount */;
929
+ }
930
+ if (containsBytes(data, getU32Encoder().encode(8), 0)) {
931
+ return 8 /* Allocate */;
932
+ }
933
+ if (containsBytes(data, getU32Encoder().encode(9), 0)) {
934
+ return 9 /* AllocateWithSeed */;
935
+ }
936
+ if (containsBytes(data, getU32Encoder().encode(10), 0)) {
937
+ return 10 /* AssignWithSeed */;
938
+ }
939
+ if (containsBytes(data, getU32Encoder().encode(11), 0)) {
940
+ return 11 /* TransferSolWithSeed */;
941
+ }
942
+ if (containsBytes(data, getU32Encoder().encode(12), 0)) {
943
+ return 12 /* UpgradeNonceAccount */;
944
+ }
945
+ throw new Error("The provided instruction could not be identified as a system instruction.");
946
+ }
947
+ function parseSystemInstruction(instruction) {
948
+ const instructionType = identifySystemInstruction(instruction);
949
+ switch (instructionType) {
950
+ case 0 /* CreateAccount */: {
951
+ assertIsInstructionWithAccounts(instruction);
952
+ return { instructionType: 0 /* CreateAccount */, ...parseCreateAccountInstruction(instruction) };
953
+ }
954
+ case 1 /* Assign */: {
955
+ assertIsInstructionWithAccounts(instruction);
956
+ return { instructionType: 1 /* Assign */, ...parseAssignInstruction(instruction) };
957
+ }
958
+ case 2 /* TransferSol */: {
959
+ assertIsInstructionWithAccounts(instruction);
960
+ return { instructionType: 2 /* TransferSol */, ...parseTransferSolInstruction(instruction) };
961
+ }
962
+ case 3 /* CreateAccountWithSeed */: {
963
+ assertIsInstructionWithAccounts(instruction);
964
+ return {
965
+ instructionType: 3 /* CreateAccountWithSeed */,
966
+ ...parseCreateAccountWithSeedInstruction(instruction)
967
+ };
968
+ }
969
+ case 4 /* AdvanceNonceAccount */: {
970
+ assertIsInstructionWithAccounts(instruction);
971
+ return {
972
+ instructionType: 4 /* AdvanceNonceAccount */,
973
+ ...parseAdvanceNonceAccountInstruction(instruction)
974
+ };
975
+ }
976
+ case 5 /* WithdrawNonceAccount */: {
977
+ assertIsInstructionWithAccounts(instruction);
978
+ return {
979
+ instructionType: 5 /* WithdrawNonceAccount */,
980
+ ...parseWithdrawNonceAccountInstruction(instruction)
981
+ };
982
+ }
983
+ case 6 /* InitializeNonceAccount */: {
984
+ assertIsInstructionWithAccounts(instruction);
985
+ return {
986
+ instructionType: 6 /* InitializeNonceAccount */,
987
+ ...parseInitializeNonceAccountInstruction(instruction)
988
+ };
989
+ }
990
+ case 7 /* AuthorizeNonceAccount */: {
991
+ assertIsInstructionWithAccounts(instruction);
992
+ return {
993
+ instructionType: 7 /* AuthorizeNonceAccount */,
994
+ ...parseAuthorizeNonceAccountInstruction(instruction)
995
+ };
996
+ }
997
+ case 8 /* Allocate */: {
998
+ assertIsInstructionWithAccounts(instruction);
999
+ return { instructionType: 8 /* Allocate */, ...parseAllocateInstruction(instruction) };
1000
+ }
1001
+ case 9 /* AllocateWithSeed */: {
1002
+ assertIsInstructionWithAccounts(instruction);
1003
+ return {
1004
+ instructionType: 9 /* AllocateWithSeed */,
1005
+ ...parseAllocateWithSeedInstruction(instruction)
1006
+ };
1007
+ }
1008
+ case 10 /* AssignWithSeed */: {
1009
+ assertIsInstructionWithAccounts(instruction);
1010
+ return {
1011
+ instructionType: 10 /* AssignWithSeed */,
1012
+ ...parseAssignWithSeedInstruction(instruction)
1013
+ };
1014
+ }
1015
+ case 11 /* TransferSolWithSeed */: {
1016
+ assertIsInstructionWithAccounts(instruction);
1017
+ return {
1018
+ instructionType: 11 /* TransferSolWithSeed */,
1019
+ ...parseTransferSolWithSeedInstruction(instruction)
1020
+ };
1021
+ }
1022
+ case 12 /* UpgradeNonceAccount */: {
1023
+ assertIsInstructionWithAccounts(instruction);
1024
+ return {
1025
+ instructionType: 12 /* UpgradeNonceAccount */,
1026
+ ...parseUpgradeNonceAccountInstruction(instruction)
1027
+ };
1028
+ }
1029
+ default:
1030
+ throw new Error(`Unrecognized instruction type: ${instructionType}`);
1031
+ }
1032
+ }
1033
+
1034
+ // src/generated/errors/system.ts
1035
+ var SYSTEM_ERROR__ACCOUNT_ALREADY_IN_USE = 0;
1036
+ var SYSTEM_ERROR__RESULT_WITH_NEGATIVE_LAMPORTS = 1;
1037
+ var SYSTEM_ERROR__INVALID_PROGRAM_ID = 2;
1038
+ var SYSTEM_ERROR__INVALID_ACCOUNT_DATA_LENGTH = 3;
1039
+ var SYSTEM_ERROR__MAX_SEED_LENGTH_EXCEEDED = 4;
1040
+ var SYSTEM_ERROR__ADDRESS_WITH_SEED_MISMATCH = 5;
1041
+ var SYSTEM_ERROR__NONCE_NO_RECENT_BLOCKHASHES = 6;
1042
+ var SYSTEM_ERROR__NONCE_BLOCKHASH_NOT_EXPIRED = 7;
1043
+ var SYSTEM_ERROR__NONCE_UNEXPECTED_BLOCKHASH_VALUE = 8;
1044
+ var systemErrorMessages;
1045
+ if (process.env.NODE_ENV !== "production") {
1046
+ systemErrorMessages = {
1047
+ [SYSTEM_ERROR__ACCOUNT_ALREADY_IN_USE]: `an account with the same address already exists`,
1048
+ [SYSTEM_ERROR__ADDRESS_WITH_SEED_MISMATCH]: `provided address does not match addressed derived from seed`,
1049
+ [SYSTEM_ERROR__INVALID_ACCOUNT_DATA_LENGTH]: `cannot allocate account data of this length`,
1050
+ [SYSTEM_ERROR__INVALID_PROGRAM_ID]: `cannot assign account to this program id`,
1051
+ [SYSTEM_ERROR__MAX_SEED_LENGTH_EXCEEDED]: `length of requested seed is too long`,
1052
+ [SYSTEM_ERROR__NONCE_BLOCKHASH_NOT_EXPIRED]: `stored nonce is still in recent_blockhashes`,
1053
+ [SYSTEM_ERROR__NONCE_NO_RECENT_BLOCKHASHES]: `advancing stored nonce requires a populated RecentBlockhashes sysvar`,
1054
+ [SYSTEM_ERROR__NONCE_UNEXPECTED_BLOCKHASH_VALUE]: `specified nonce does not match stored nonce`,
1055
+ [SYSTEM_ERROR__RESULT_WITH_NEGATIVE_LAMPORTS]: `account does not have enough SOL to perform the operation`
1056
+ };
1057
+ }
1058
+ function getSystemErrorMessage(code) {
1059
+ if (process.env.NODE_ENV !== "production") {
1060
+ return systemErrorMessages[code];
1061
+ }
1062
+ return "Error message not available in production bundles.";
1063
+ }
1064
+ function isSystemError(error, transactionMessage, code) {
1065
+ return isProgramError(error, transactionMessage, SYSTEM_PROGRAM_ADDRESS, code);
1066
+ }
1067
+
1068
+ export { ADVANCE_NONCE_ACCOUNT_DISCRIMINATOR, ALLOCATE_DISCRIMINATOR, ALLOCATE_WITH_SEED_DISCRIMINATOR, ASSIGN_DISCRIMINATOR, ASSIGN_WITH_SEED_DISCRIMINATOR, AUTHORIZE_NONCE_ACCOUNT_DISCRIMINATOR, CREATE_ACCOUNT_DISCRIMINATOR, CREATE_ACCOUNT_WITH_SEED_DISCRIMINATOR, INITIALIZE_NONCE_ACCOUNT_DISCRIMINATOR, NonceState, NonceVersion, SYSTEM_ERROR__ACCOUNT_ALREADY_IN_USE, SYSTEM_ERROR__ADDRESS_WITH_SEED_MISMATCH, SYSTEM_ERROR__INVALID_ACCOUNT_DATA_LENGTH, SYSTEM_ERROR__INVALID_PROGRAM_ID, SYSTEM_ERROR__MAX_SEED_LENGTH_EXCEEDED, SYSTEM_ERROR__NONCE_BLOCKHASH_NOT_EXPIRED, SYSTEM_ERROR__NONCE_NO_RECENT_BLOCKHASHES, SYSTEM_ERROR__NONCE_UNEXPECTED_BLOCKHASH_VALUE, SYSTEM_ERROR__RESULT_WITH_NEGATIVE_LAMPORTS, SYSTEM_PROGRAM_ADDRESS, SystemAccount, SystemInstruction, TRANSFER_SOL_DISCRIMINATOR, TRANSFER_SOL_WITH_SEED_DISCRIMINATOR, UPGRADE_NONCE_ACCOUNT_DISCRIMINATOR, WITHDRAW_NONCE_ACCOUNT_DISCRIMINATOR, decodeNonce, fetchAllMaybeNonce, fetchAllNonce, fetchMaybeNonce, fetchNonce, getAdvanceNonceAccountDiscriminatorBytes, getAdvanceNonceAccountInstruction, getAdvanceNonceAccountInstructionDataCodec, getAdvanceNonceAccountInstructionDataDecoder, getAdvanceNonceAccountInstructionDataEncoder, getAllocateDiscriminatorBytes, getAllocateInstruction, getAllocateInstructionDataCodec, getAllocateInstructionDataDecoder, getAllocateInstructionDataEncoder, getAllocateWithSeedDiscriminatorBytes, getAllocateWithSeedInstruction, getAllocateWithSeedInstructionDataCodec, getAllocateWithSeedInstructionDataDecoder, getAllocateWithSeedInstructionDataEncoder, getAssignDiscriminatorBytes, getAssignInstruction, getAssignInstructionDataCodec, getAssignInstructionDataDecoder, getAssignInstructionDataEncoder, getAssignWithSeedDiscriminatorBytes, getAssignWithSeedInstruction, getAssignWithSeedInstructionDataCodec, getAssignWithSeedInstructionDataDecoder, getAssignWithSeedInstructionDataEncoder, getAuthorizeNonceAccountDiscriminatorBytes, getAuthorizeNonceAccountInstruction, getAuthorizeNonceAccountInstructionDataCodec, getAuthorizeNonceAccountInstructionDataDecoder, getAuthorizeNonceAccountInstructionDataEncoder, getCreateAccountDiscriminatorBytes, getCreateAccountInstruction, getCreateAccountInstructionDataCodec, getCreateAccountInstructionDataDecoder, getCreateAccountInstructionDataEncoder, getCreateAccountWithSeedDiscriminatorBytes, getCreateAccountWithSeedInstruction, getCreateAccountWithSeedInstructionDataCodec, getCreateAccountWithSeedInstructionDataDecoder, getCreateAccountWithSeedInstructionDataEncoder, getInitializeNonceAccountDiscriminatorBytes, getInitializeNonceAccountInstruction, getInitializeNonceAccountInstructionDataCodec, getInitializeNonceAccountInstructionDataDecoder, getInitializeNonceAccountInstructionDataEncoder, getNonceCodec, getNonceDecoder, getNonceEncoder, getNonceSize, getNonceStateCodec, getNonceStateDecoder, getNonceStateEncoder, getNonceVersionCodec, getNonceVersionDecoder, getNonceVersionEncoder, getSystemErrorMessage, getTransferSolDiscriminatorBytes, getTransferSolInstruction, getTransferSolInstructionDataCodec, getTransferSolInstructionDataDecoder, getTransferSolInstructionDataEncoder, getTransferSolWithSeedDiscriminatorBytes, getTransferSolWithSeedInstruction, getTransferSolWithSeedInstructionDataCodec, getTransferSolWithSeedInstructionDataDecoder, getTransferSolWithSeedInstructionDataEncoder, getUpgradeNonceAccountDiscriminatorBytes, getUpgradeNonceAccountInstruction, getUpgradeNonceAccountInstructionDataCodec, getUpgradeNonceAccountInstructionDataDecoder, getUpgradeNonceAccountInstructionDataEncoder, getWithdrawNonceAccountDiscriminatorBytes, getWithdrawNonceAccountInstruction, getWithdrawNonceAccountInstructionDataCodec, getWithdrawNonceAccountInstructionDataDecoder, getWithdrawNonceAccountInstructionDataEncoder, identifySystemInstruction, isSystemError, parseAdvanceNonceAccountInstruction, parseAllocateInstruction, parseAllocateWithSeedInstruction, parseAssignInstruction, parseAssignWithSeedInstruction, parseAuthorizeNonceAccountInstruction, parseCreateAccountInstruction, parseCreateAccountWithSeedInstruction, parseInitializeNonceAccountInstruction, parseSystemInstruction, parseTransferSolInstruction, parseTransferSolWithSeedInstruction, parseUpgradeNonceAccountInstruction, parseWithdrawNonceAccountInstruction };
1120
1069
  //# sourceMappingURL=index.mjs.map
1121
1070
  //# sourceMappingURL=index.mjs.map