@solana-program/system 0.14.1 → 0.16.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 (56) hide show
  1. package/dist/src/index.js +171 -81
  2. package/dist/src/index.js.map +1 -1
  3. package/dist/src/index.mjs +171 -81
  4. package/dist/src/index.mjs.map +1 -1
  5. package/dist/types/generated/accounts/nonce.d.ts +7 -7
  6. package/dist/types/generated/accounts/nonce.d.ts.map +1 -1
  7. package/dist/types/generated/errors/system.d.ts +4 -2
  8. package/dist/types/generated/errors/system.d.ts.map +1 -1
  9. package/dist/types/generated/instructions/advanceNonceAccount.d.ts +11 -8
  10. package/dist/types/generated/instructions/advanceNonceAccount.d.ts.map +1 -1
  11. package/dist/types/generated/instructions/allocate.d.ts +9 -6
  12. package/dist/types/generated/instructions/allocate.d.ts.map +1 -1
  13. package/dist/types/generated/instructions/allocateWithSeed.d.ts +12 -9
  14. package/dist/types/generated/instructions/allocateWithSeed.d.ts.map +1 -1
  15. package/dist/types/generated/instructions/assign.d.ts +10 -7
  16. package/dist/types/generated/instructions/assign.d.ts.map +1 -1
  17. package/dist/types/generated/instructions/assignWithSeed.d.ts +12 -9
  18. package/dist/types/generated/instructions/assignWithSeed.d.ts.map +1 -1
  19. package/dist/types/generated/instructions/authorizeNonceAccount.d.ts +11 -8
  20. package/dist/types/generated/instructions/authorizeNonceAccount.d.ts.map +1 -1
  21. package/dist/types/generated/instructions/createAccount.d.ts +11 -9
  22. package/dist/types/generated/instructions/createAccount.d.ts.map +1 -1
  23. package/dist/types/generated/instructions/createAccountAllowPrefund.d.ts +11 -9
  24. package/dist/types/generated/instructions/createAccountAllowPrefund.d.ts.map +1 -1
  25. package/dist/types/generated/instructions/createAccountWithSeed.d.ts +13 -10
  26. package/dist/types/generated/instructions/createAccountWithSeed.d.ts.map +1 -1
  27. package/dist/types/generated/instructions/initializeNonceAccount.d.ts +12 -9
  28. package/dist/types/generated/instructions/initializeNonceAccount.d.ts.map +1 -1
  29. package/dist/types/generated/instructions/transferSol.d.ts +10 -7
  30. package/dist/types/generated/instructions/transferSol.d.ts.map +1 -1
  31. package/dist/types/generated/instructions/transferSolWithSeed.d.ts +12 -9
  32. package/dist/types/generated/instructions/transferSolWithSeed.d.ts.map +1 -1
  33. package/dist/types/generated/instructions/upgradeNonceAccount.d.ts +8 -5
  34. package/dist/types/generated/instructions/upgradeNonceAccount.d.ts.map +1 -1
  35. package/dist/types/generated/instructions/withdrawNonceAccount.d.ts +13 -10
  36. package/dist/types/generated/instructions/withdrawNonceAccount.d.ts.map +1 -1
  37. package/dist/types/generated/programs/system.d.ts +46 -16
  38. package/dist/types/generated/programs/system.d.ts.map +1 -1
  39. package/package.json +5 -5
  40. package/src/generated/accounts/nonce.ts +17 -8
  41. package/src/generated/errors/system.ts +5 -1
  42. package/src/generated/instructions/advanceNonceAccount.ts +38 -23
  43. package/src/generated/instructions/allocate.ts +25 -11
  44. package/src/generated/instructions/allocateWithSeed.ts +35 -17
  45. package/src/generated/instructions/assign.ts +27 -12
  46. package/src/generated/instructions/assignWithSeed.ts +38 -16
  47. package/src/generated/instructions/authorizeNonceAccount.ts +34 -16
  48. package/src/generated/instructions/createAccount.ts +33 -14
  49. package/src/generated/instructions/createAccountAllowPrefund.ts +30 -15
  50. package/src/generated/instructions/createAccountWithSeed.ts +41 -21
  51. package/src/generated/instructions/initializeNonceAccount.ts +39 -23
  52. package/src/generated/instructions/transferSol.ts +34 -14
  53. package/src/generated/instructions/transferSolWithSeed.ts +44 -20
  54. package/src/generated/instructions/upgradeNonceAccount.ts +25 -10
  55. package/src/generated/instructions/withdrawNonceAccount.ts +53 -35
  56. package/src/generated/programs/system.ts +119 -28
package/dist/src/index.js CHANGED
@@ -64,7 +64,11 @@ async function fetchNonce(rpc, address, config) {
64
64
  return maybeAccount;
65
65
  }
66
66
  async function fetchMaybeNonce(rpc, address, config) {
67
- const maybeAccount = await kit.fetchEncodedAccount(rpc, address, config);
67
+ const maybeAccount = await kit.fetchEncodedAccount(
68
+ rpc,
69
+ typeof address === "string" ? address : address.address,
70
+ config
71
+ );
68
72
  return decodeNonce(maybeAccount);
69
73
  }
70
74
  async function fetchAllNonce(rpc, addresses, config) {
@@ -73,7 +77,11 @@ async function fetchAllNonce(rpc, addresses, config) {
73
77
  return maybeAccounts;
74
78
  }
75
79
  async function fetchAllMaybeNonce(rpc, addresses, config) {
76
- const maybeAccounts = await kit.fetchEncodedAccounts(rpc, addresses, config);
80
+ const maybeAccounts = await kit.fetchEncodedAccounts(
81
+ rpc,
82
+ addresses.map((a) => typeof a === "string" ? a : a.address),
83
+ config
84
+ );
77
85
  return maybeAccounts.map((maybeAccount) => decodeNonce(maybeAccount));
78
86
  }
79
87
  function getNonceSize() {
@@ -96,17 +104,18 @@ function getAdvanceNonceAccountInstructionDataCodec() {
96
104
  return kit.combineCodec(getAdvanceNonceAccountInstructionDataEncoder(), getAdvanceNonceAccountInstructionDataDecoder());
97
105
  }
98
106
  function getAdvanceNonceAccountInstruction(input, config) {
99
- const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
107
+ const programAddressInput = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
108
+ const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
109
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
100
110
  const originalAccounts = {
101
- nonceAccount: { value: input.nonceAccount ?? null, isWritable: true },
102
- recentBlockhashesSysvar: { value: input.recentBlockhashesSysvar ?? null, isWritable: false },
103
- nonceAuthority: { value: input.nonceAuthority ?? null, isWritable: false }
111
+ nonceAccount: { value: input.nonceAccount ?? null, isSigner: false, isWritable: true },
112
+ recentBlockhashesSysvar: { value: input.recentBlockhashesSysvar ?? null, isSigner: false, isWritable: false },
113
+ nonceAuthority: { value: input.nonceAuthority ?? null, isSigner: true, isWritable: false }
104
114
  };
105
115
  const accounts = originalAccounts;
106
116
  if (!accounts.recentBlockhashesSysvar.value) {
107
117
  accounts.recentBlockhashesSysvar.value = "SysvarRecentB1ockHashes11111111111111111111";
108
118
  }
109
- const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
110
119
  return Object.freeze({
111
120
  accounts: [
112
121
  getAccountMeta("nonceAccount", accounts.nonceAccount),
@@ -163,11 +172,12 @@ function getAllocateInstructionDataCodec() {
163
172
  return kit.combineCodec(getAllocateInstructionDataEncoder(), getAllocateInstructionDataDecoder());
164
173
  }
165
174
  function getAllocateInstruction(input, config) {
166
- const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
167
- const originalAccounts = { newAccount: { value: input.newAccount ?? null, isWritable: true } };
175
+ const programAddressInput = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
176
+ const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
177
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
178
+ const originalAccounts = { newAccount: { value: input.newAccount ?? null, isSigner: true, isWritable: true } };
168
179
  const accounts = originalAccounts;
169
180
  const args = { ...input };
170
- const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
171
181
  return Object.freeze({
172
182
  accounts: [getAccountMeta("newAccount", accounts.newAccount)],
173
183
  data: getAllocateInstructionDataEncoder().encode(args),
@@ -222,14 +232,15 @@ function getAllocateWithSeedInstructionDataCodec() {
222
232
  return kit.combineCodec(getAllocateWithSeedInstructionDataEncoder(), getAllocateWithSeedInstructionDataDecoder());
223
233
  }
224
234
  function getAllocateWithSeedInstruction(input, config) {
225
- const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
235
+ const programAddressInput = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
236
+ const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
237
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
226
238
  const originalAccounts = {
227
- newAccount: { value: input.newAccount ?? null, isWritable: true },
228
- baseAccount: { value: input.baseAccount ?? null, isWritable: false }
239
+ newAccount: { value: input.newAccount ?? null, isSigner: false, isWritable: true },
240
+ baseAccount: { value: input.baseAccount ?? null, isSigner: true, isWritable: false }
229
241
  };
230
242
  const accounts = originalAccounts;
231
243
  const args = { ...input };
232
- const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
233
244
  return Object.freeze({
234
245
  accounts: [
235
246
  getAccountMeta("newAccount", accounts.newAccount),
@@ -281,11 +292,12 @@ function getAssignInstructionDataCodec() {
281
292
  return kit.combineCodec(getAssignInstructionDataEncoder(), getAssignInstructionDataDecoder());
282
293
  }
283
294
  function getAssignInstruction(input, config) {
284
- const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
285
- const originalAccounts = { account: { value: input.account ?? null, isWritable: true } };
295
+ const programAddressInput = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
296
+ const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
297
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
298
+ const originalAccounts = { account: { value: input.account ?? null, isSigner: true, isWritable: true } };
286
299
  const accounts = originalAccounts;
287
300
  const args = { ...input };
288
- const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
289
301
  return Object.freeze({
290
302
  accounts: [getAccountMeta("account", accounts.account)],
291
303
  data: getAssignInstructionDataEncoder().encode(args),
@@ -338,14 +350,15 @@ function getAssignWithSeedInstructionDataCodec() {
338
350
  return kit.combineCodec(getAssignWithSeedInstructionDataEncoder(), getAssignWithSeedInstructionDataDecoder());
339
351
  }
340
352
  function getAssignWithSeedInstruction(input, config) {
341
- const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
353
+ const programAddressInput = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
354
+ const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
355
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
342
356
  const originalAccounts = {
343
- account: { value: input.account ?? null, isWritable: true },
344
- baseAccount: { value: input.baseAccount ?? null, isWritable: false }
357
+ account: { value: input.account ?? null, isSigner: false, isWritable: true },
358
+ baseAccount: { value: input.baseAccount ?? null, isSigner: true, isWritable: false }
345
359
  };
346
360
  const accounts = originalAccounts;
347
361
  const args = { ...input };
348
- const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
349
362
  return Object.freeze({
350
363
  accounts: [getAccountMeta("account", accounts.account), getAccountMeta("baseAccount", accounts.baseAccount)],
351
364
  data: getAssignWithSeedInstructionDataEncoder().encode(args),
@@ -397,14 +410,15 @@ function getAuthorizeNonceAccountInstructionDataCodec() {
397
410
  );
398
411
  }
399
412
  function getAuthorizeNonceAccountInstruction(input, config) {
400
- const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
413
+ const programAddressInput = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
414
+ const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
415
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
401
416
  const originalAccounts = {
402
- nonceAccount: { value: input.nonceAccount ?? null, isWritable: true },
403
- nonceAuthority: { value: input.nonceAuthority ?? null, isWritable: false }
417
+ nonceAccount: { value: input.nonceAccount ?? null, isSigner: false, isWritable: true },
418
+ nonceAuthority: { value: input.nonceAuthority ?? null, isSigner: true, isWritable: false }
404
419
  };
405
420
  const accounts = originalAccounts;
406
421
  const args = { ...input };
407
- const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
408
422
  return Object.freeze({
409
423
  accounts: [
410
424
  getAccountMeta("nonceAccount", accounts.nonceAccount),
@@ -460,15 +474,16 @@ function getCreateAccountInstructionDataCodec() {
460
474
  return kit.combineCodec(getCreateAccountInstructionDataEncoder(), getCreateAccountInstructionDataDecoder());
461
475
  }
462
476
  function getCreateAccountInstruction(input, config) {
463
- const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
477
+ const programAddressInput = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
478
+ const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
479
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
464
480
  const originalAccounts = {
465
- payer: { value: input.payer ?? null, isWritable: true },
466
- newAccount: { value: input.newAccount ?? null, isWritable: true }
481
+ payer: { value: input.payer ?? null, isSigner: true, isWritable: true },
482
+ newAccount: { value: input.newAccount ?? null, isSigner: true, isWritable: true }
467
483
  };
468
484
  const accounts = originalAccounts;
469
485
  const args = { ...input };
470
486
  const byteDelta = [Number(args.space) + kit.BASE_ACCOUNT_SIZE].reduce((a, b) => a + b, 0);
471
- const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
472
487
  return Object.freeze({
473
488
  accounts: [getAccountMeta("payer", accounts.payer), getAccountMeta("newAccount", accounts.newAccount)],
474
489
  byteDelta,
@@ -529,15 +544,16 @@ function getCreateAccountAllowPrefundInstructionDataCodec() {
529
544
  );
530
545
  }
531
546
  function getCreateAccountAllowPrefundInstruction(input, config) {
532
- const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
547
+ const programAddressInput = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
548
+ const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
549
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
533
550
  const originalAccounts = {
534
- newAccount: { value: input.newAccount ?? null, isWritable: true },
535
- payer: { value: input.payer ?? null, isWritable: true }
551
+ newAccount: { value: input.newAccount ?? null, isSigner: true, isWritable: true },
552
+ payer: { value: input.payer ?? null, isSigner: true, isWritable: true }
536
553
  };
537
554
  const accounts = originalAccounts;
538
555
  const args = { ...input };
539
556
  const byteDelta = [Number(args.space) + kit.BASE_ACCOUNT_SIZE].reduce((a, b) => a + b, 0);
540
- const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
541
557
  return Object.freeze({
542
558
  accounts: [getAccountMeta("newAccount", accounts.newAccount), getAccountMeta("payer", accounts.payer)].filter(
543
559
  (x) => x !== void 0
@@ -608,15 +624,16 @@ function getCreateAccountWithSeedInstructionDataCodec() {
608
624
  );
609
625
  }
610
626
  function getCreateAccountWithSeedInstruction(input, config) {
611
- const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
627
+ const programAddressInput = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
628
+ const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
629
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
612
630
  const originalAccounts = {
613
- payer: { value: input.payer ?? null, isWritable: true },
614
- newAccount: { value: input.newAccount ?? null, isWritable: true },
615
- baseAccount: { value: input.baseAccount ?? null, isWritable: false }
631
+ payer: { value: input.payer ?? null, isSigner: true, isWritable: true },
632
+ newAccount: { value: input.newAccount ?? null, isSigner: false, isWritable: true },
633
+ baseAccount: { value: input.baseAccount ?? null, isSigner: true, isWritable: false }
616
634
  };
617
635
  const accounts = originalAccounts;
618
636
  const args = { ...input };
619
- const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
620
637
  return Object.freeze({
621
638
  accounts: [
622
639
  getAccountMeta("payer", accounts.payer),
@@ -678,11 +695,13 @@ function getInitializeNonceAccountInstructionDataCodec() {
678
695
  );
679
696
  }
680
697
  function getInitializeNonceAccountInstruction(input, config) {
681
- const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
698
+ const programAddressInput = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
699
+ const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
700
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
682
701
  const originalAccounts = {
683
- nonceAccount: { value: input.nonceAccount ?? null, isWritable: true },
684
- recentBlockhashesSysvar: { value: input.recentBlockhashesSysvar ?? null, isWritable: false },
685
- rentSysvar: { value: input.rentSysvar ?? null, isWritable: false }
702
+ nonceAccount: { value: input.nonceAccount ?? null, isSigner: false, isWritable: true },
703
+ recentBlockhashesSysvar: { value: input.recentBlockhashesSysvar ?? null, isSigner: false, isWritable: false },
704
+ rentSysvar: { value: input.rentSysvar ?? null, isSigner: false, isWritable: false }
686
705
  };
687
706
  const accounts = originalAccounts;
688
707
  const args = { ...input };
@@ -692,7 +711,6 @@ function getInitializeNonceAccountInstruction(input, config) {
692
711
  if (!accounts.rentSysvar.value) {
693
712
  accounts.rentSysvar.value = "SysvarRent111111111111111111111111111111111";
694
713
  }
695
- const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
696
714
  return Object.freeze({
697
715
  accounts: [
698
716
  getAccountMeta("nonceAccount", accounts.nonceAccount),
@@ -751,14 +769,15 @@ function getTransferSolInstructionDataCodec() {
751
769
  return kit.combineCodec(getTransferSolInstructionDataEncoder(), getTransferSolInstructionDataDecoder());
752
770
  }
753
771
  function getTransferSolInstruction(input, config) {
754
- const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
772
+ const programAddressInput = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
773
+ const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
774
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
755
775
  const originalAccounts = {
756
- source: { value: input.source ?? null, isWritable: true },
757
- destination: { value: input.destination ?? null, isWritable: true }
776
+ source: { value: input.source ?? null, isSigner: true, isWritable: true },
777
+ destination: { value: input.destination ?? null, isSigner: false, isWritable: true }
758
778
  };
759
779
  const accounts = originalAccounts;
760
780
  const args = { ...input };
761
- const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
762
781
  return Object.freeze({
763
782
  accounts: [getAccountMeta("source", accounts.source), getAccountMeta("destination", accounts.destination)],
764
783
  data: getTransferSolInstructionDataEncoder().encode(args),
@@ -811,15 +830,16 @@ function getTransferSolWithSeedInstructionDataCodec() {
811
830
  return kit.combineCodec(getTransferSolWithSeedInstructionDataEncoder(), getTransferSolWithSeedInstructionDataDecoder());
812
831
  }
813
832
  function getTransferSolWithSeedInstruction(input, config) {
814
- const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
833
+ const programAddressInput = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
834
+ const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
835
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
815
836
  const originalAccounts = {
816
- source: { value: input.source ?? null, isWritable: true },
817
- baseAccount: { value: input.baseAccount ?? null, isWritable: false },
818
- destination: { value: input.destination ?? null, isWritable: true }
837
+ source: { value: input.source ?? null, isSigner: false, isWritable: true },
838
+ baseAccount: { value: input.baseAccount ?? null, isSigner: true, isWritable: false },
839
+ destination: { value: input.destination ?? null, isSigner: false, isWritable: true }
819
840
  };
820
841
  const accounts = originalAccounts;
821
842
  const args = { ...input };
822
- const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
823
843
  return Object.freeze({
824
844
  accounts: [
825
845
  getAccountMeta("source", accounts.source),
@@ -866,10 +886,11 @@ function getUpgradeNonceAccountInstructionDataCodec() {
866
886
  return kit.combineCodec(getUpgradeNonceAccountInstructionDataEncoder(), getUpgradeNonceAccountInstructionDataDecoder());
867
887
  }
868
888
  function getUpgradeNonceAccountInstruction(input, config) {
869
- const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
870
- const originalAccounts = { nonceAccount: { value: input.nonceAccount ?? null, isWritable: true } };
871
- const accounts = originalAccounts;
889
+ const programAddressInput = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
890
+ const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
872
891
  const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
892
+ const originalAccounts = { nonceAccount: { value: input.nonceAccount ?? null, isSigner: false, isWritable: true } };
893
+ const accounts = originalAccounts;
873
894
  return Object.freeze({
874
895
  accounts: [getAccountMeta("nonceAccount", accounts.nonceAccount)],
875
896
  data: getUpgradeNonceAccountInstructionDataEncoder().encode({}),
@@ -921,13 +942,15 @@ function getWithdrawNonceAccountInstructionDataCodec() {
921
942
  );
922
943
  }
923
944
  function getWithdrawNonceAccountInstruction(input, config) {
924
- const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
945
+ const programAddressInput = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
946
+ const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
947
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
925
948
  const originalAccounts = {
926
- nonceAccount: { value: input.nonceAccount ?? null, isWritable: true },
927
- recipientAccount: { value: input.recipientAccount ?? null, isWritable: true },
928
- recentBlockhashesSysvar: { value: input.recentBlockhashesSysvar ?? null, isWritable: false },
929
- rentSysvar: { value: input.rentSysvar ?? null, isWritable: false },
930
- nonceAuthority: { value: input.nonceAuthority ?? null, isWritable: false }
949
+ nonceAccount: { value: input.nonceAccount ?? null, isSigner: false, isWritable: true },
950
+ recipientAccount: { value: input.recipientAccount ?? null, isSigner: false, isWritable: true },
951
+ recentBlockhashesSysvar: { value: input.recentBlockhashesSysvar ?? null, isSigner: false, isWritable: false },
952
+ rentSysvar: { value: input.rentSysvar ?? null, isSigner: false, isWritable: false },
953
+ nonceAuthority: { value: input.nonceAuthority ?? null, isSigner: true, isWritable: false }
931
954
  };
932
955
  const accounts = originalAccounts;
933
956
  const args = { ...input };
@@ -937,7 +960,6 @@ function getWithdrawNonceAccountInstruction(input, config) {
937
960
  if (!accounts.rentSysvar.value) {
938
961
  accounts.rentSysvar.value = "SysvarRent111111111111111111111111111111111";
939
962
  }
940
- const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "omitted");
941
963
  return Object.freeze({
942
964
  accounts: [
943
965
  getAccountMeta("nonceAccount", accounts.nonceAccount),
@@ -1144,32 +1166,98 @@ function parseSystemInstruction(instruction) {
1144
1166
  });
1145
1167
  }
1146
1168
  }
1147
- function systemProgram() {
1169
+ function systemProgram(config = {}) {
1148
1170
  return (client) => {
1149
1171
  return kit.extendClient(client, {
1150
1172
  system: {
1151
1173
  accounts: { nonce: programClientCore.addSelfFetchFunctions(client, getNonceCodec()) },
1152
1174
  instructions: {
1153
- createAccount: (input) => programClientCore.addSelfPlanAndSendFunctions(
1175
+ createAccount: (input, instructionConfig) => programClientCore.addSelfPlanAndSendFunctions(
1176
+ client,
1177
+ getCreateAccountInstruction(
1178
+ { ...input, payer: input.payer ?? client.payer },
1179
+ { programAddress: instructionConfig?.programAddress ?? config.programAddress }
1180
+ )
1181
+ ),
1182
+ assign: (input, instructionConfig) => programClientCore.addSelfPlanAndSendFunctions(
1183
+ client,
1184
+ getAssignInstruction(input, {
1185
+ programAddress: instructionConfig?.programAddress ?? config.programAddress
1186
+ })
1187
+ ),
1188
+ transferSol: (input, instructionConfig) => programClientCore.addSelfPlanAndSendFunctions(
1189
+ client,
1190
+ getTransferSolInstruction(input, {
1191
+ programAddress: instructionConfig?.programAddress ?? config.programAddress
1192
+ })
1193
+ ),
1194
+ createAccountWithSeed: (input, instructionConfig) => programClientCore.addSelfPlanAndSendFunctions(
1195
+ client,
1196
+ getCreateAccountWithSeedInstruction(
1197
+ { ...input, payer: input.payer ?? client.payer },
1198
+ { programAddress: instructionConfig?.programAddress ?? config.programAddress }
1199
+ )
1200
+ ),
1201
+ advanceNonceAccount: (input, instructionConfig) => programClientCore.addSelfPlanAndSendFunctions(
1202
+ client,
1203
+ getAdvanceNonceAccountInstruction(input, {
1204
+ programAddress: instructionConfig?.programAddress ?? config.programAddress
1205
+ })
1206
+ ),
1207
+ withdrawNonceAccount: (input, instructionConfig) => programClientCore.addSelfPlanAndSendFunctions(
1154
1208
  client,
1155
- getCreateAccountInstruction({ ...input, payer: input.payer ?? client.payer })
1209
+ getWithdrawNonceAccountInstruction(input, {
1210
+ programAddress: instructionConfig?.programAddress ?? config.programAddress
1211
+ })
1156
1212
  ),
1157
- assign: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getAssignInstruction(input)),
1158
- transferSol: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getTransferSolInstruction(input)),
1159
- createAccountWithSeed: (input) => programClientCore.addSelfPlanAndSendFunctions(
1213
+ initializeNonceAccount: (input, instructionConfig) => programClientCore.addSelfPlanAndSendFunctions(
1160
1214
  client,
1161
- getCreateAccountWithSeedInstruction({ ...input, payer: input.payer ?? client.payer })
1215
+ getInitializeNonceAccountInstruction(input, {
1216
+ programAddress: instructionConfig?.programAddress ?? config.programAddress
1217
+ })
1162
1218
  ),
1163
- advanceNonceAccount: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getAdvanceNonceAccountInstruction(input)),
1164
- withdrawNonceAccount: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getWithdrawNonceAccountInstruction(input)),
1165
- initializeNonceAccount: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getInitializeNonceAccountInstruction(input)),
1166
- authorizeNonceAccount: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getAuthorizeNonceAccountInstruction(input)),
1167
- allocate: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getAllocateInstruction(input)),
1168
- allocateWithSeed: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getAllocateWithSeedInstruction(input)),
1169
- assignWithSeed: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getAssignWithSeedInstruction(input)),
1170
- transferSolWithSeed: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getTransferSolWithSeedInstruction(input)),
1171
- upgradeNonceAccount: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getUpgradeNonceAccountInstruction(input)),
1172
- createAccountAllowPrefund: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getCreateAccountAllowPrefundInstruction(input))
1219
+ authorizeNonceAccount: (input, instructionConfig) => programClientCore.addSelfPlanAndSendFunctions(
1220
+ client,
1221
+ getAuthorizeNonceAccountInstruction(input, {
1222
+ programAddress: instructionConfig?.programAddress ?? config.programAddress
1223
+ })
1224
+ ),
1225
+ allocate: (input, instructionConfig) => programClientCore.addSelfPlanAndSendFunctions(
1226
+ client,
1227
+ getAllocateInstruction(input, {
1228
+ programAddress: instructionConfig?.programAddress ?? config.programAddress
1229
+ })
1230
+ ),
1231
+ allocateWithSeed: (input, instructionConfig) => programClientCore.addSelfPlanAndSendFunctions(
1232
+ client,
1233
+ getAllocateWithSeedInstruction(input, {
1234
+ programAddress: instructionConfig?.programAddress ?? config.programAddress
1235
+ })
1236
+ ),
1237
+ assignWithSeed: (input, instructionConfig) => programClientCore.addSelfPlanAndSendFunctions(
1238
+ client,
1239
+ getAssignWithSeedInstruction(input, {
1240
+ programAddress: instructionConfig?.programAddress ?? config.programAddress
1241
+ })
1242
+ ),
1243
+ transferSolWithSeed: (input, instructionConfig) => programClientCore.addSelfPlanAndSendFunctions(
1244
+ client,
1245
+ getTransferSolWithSeedInstruction(input, {
1246
+ programAddress: instructionConfig?.programAddress ?? config.programAddress
1247
+ })
1248
+ ),
1249
+ upgradeNonceAccount: (input, instructionConfig) => programClientCore.addSelfPlanAndSendFunctions(
1250
+ client,
1251
+ getUpgradeNonceAccountInstruction(input, {
1252
+ programAddress: instructionConfig?.programAddress ?? config.programAddress
1253
+ })
1254
+ ),
1255
+ createAccountAllowPrefund: (input, instructionConfig) => programClientCore.addSelfPlanAndSendFunctions(
1256
+ client,
1257
+ getCreateAccountAllowPrefundInstruction(input, {
1258
+ programAddress: instructionConfig?.programAddress ?? config.programAddress
1259
+ })
1260
+ )
1173
1261
  },
1174
1262
  identifyInstruction: identifySystemInstruction,
1175
1263
  parseInstruction: parseSystemInstruction
@@ -1208,8 +1296,10 @@ function getSystemErrorMessage(code) {
1208
1296
  }
1209
1297
  return "Error message not available in production bundles.";
1210
1298
  }
1211
- function isSystemError(error, transactionMessage, code) {
1212
- return kit.isProgramError(error, transactionMessage, SYSTEM_PROGRAM_ADDRESS, code);
1299
+ function isSystemError(error, transactionMessage, code, config = {}) {
1300
+ const programAddressInput = config.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
1301
+ const programAddress = typeof programAddressInput === "string" ? programAddressInput : programAddressInput.address;
1302
+ return kit.isProgramError(error, transactionMessage, programAddress, code);
1213
1303
  }
1214
1304
 
1215
1305
  exports.ADVANCE_NONCE_ACCOUNT_DISCRIMINATOR = ADVANCE_NONCE_ACCOUNT_DISCRIMINATOR;