@solana-program/system 0.14.1 → 0.15.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 (47) hide show
  1. package/dist/src/index.js +46 -46
  2. package/dist/src/index.js.map +1 -1
  3. package/dist/src/index.mjs +46 -46
  4. package/dist/src/index.mjs.map +1 -1
  5. package/dist/types/generated/instructions/advanceNonceAccount.d.ts +8 -7
  6. package/dist/types/generated/instructions/advanceNonceAccount.d.ts.map +1 -1
  7. package/dist/types/generated/instructions/allocate.d.ts +6 -5
  8. package/dist/types/generated/instructions/allocate.d.ts.map +1 -1
  9. package/dist/types/generated/instructions/allocateWithSeed.d.ts +7 -6
  10. package/dist/types/generated/instructions/allocateWithSeed.d.ts.map +1 -1
  11. package/dist/types/generated/instructions/assign.d.ts +6 -5
  12. package/dist/types/generated/instructions/assign.d.ts.map +1 -1
  13. package/dist/types/generated/instructions/assignWithSeed.d.ts +7 -6
  14. package/dist/types/generated/instructions/assignWithSeed.d.ts.map +1 -1
  15. package/dist/types/generated/instructions/authorizeNonceAccount.d.ts +7 -6
  16. package/dist/types/generated/instructions/authorizeNonceAccount.d.ts.map +1 -1
  17. package/dist/types/generated/instructions/createAccount.d.ts +7 -7
  18. package/dist/types/generated/instructions/createAccount.d.ts.map +1 -1
  19. package/dist/types/generated/instructions/createAccountAllowPrefund.d.ts +7 -7
  20. package/dist/types/generated/instructions/createAccountAllowPrefund.d.ts.map +1 -1
  21. package/dist/types/generated/instructions/createAccountWithSeed.d.ts +8 -7
  22. package/dist/types/generated/instructions/createAccountWithSeed.d.ts.map +1 -1
  23. package/dist/types/generated/instructions/initializeNonceAccount.d.ts +7 -6
  24. package/dist/types/generated/instructions/initializeNonceAccount.d.ts.map +1 -1
  25. package/dist/types/generated/instructions/transferSol.d.ts +7 -6
  26. package/dist/types/generated/instructions/transferSol.d.ts.map +1 -1
  27. package/dist/types/generated/instructions/transferSolWithSeed.d.ts +8 -7
  28. package/dist/types/generated/instructions/transferSolWithSeed.d.ts.map +1 -1
  29. package/dist/types/generated/instructions/upgradeNonceAccount.d.ts +5 -4
  30. package/dist/types/generated/instructions/upgradeNonceAccount.d.ts.map +1 -1
  31. package/dist/types/generated/instructions/withdrawNonceAccount.d.ts +10 -9
  32. package/dist/types/generated/instructions/withdrawNonceAccount.d.ts.map +1 -1
  33. package/package.json +3 -3
  34. package/src/generated/instructions/advanceNonceAccount.ts +35 -21
  35. package/src/generated/instructions/allocate.ts +22 -9
  36. package/src/generated/instructions/allocateWithSeed.ts +29 -13
  37. package/src/generated/instructions/assign.ts +22 -9
  38. package/src/generated/instructions/assignWithSeed.ts +29 -13
  39. package/src/generated/instructions/authorizeNonceAccount.ts +29 -13
  40. package/src/generated/instructions/createAccount.ts +28 -11
  41. package/src/generated/instructions/createAccountAllowPrefund.ts +25 -12
  42. package/src/generated/instructions/createAccountWithSeed.ts +35 -17
  43. package/src/generated/instructions/initializeNonceAccount.ts +34 -20
  44. package/src/generated/instructions/transferSol.ts +31 -12
  45. package/src/generated/instructions/transferSolWithSeed.ts +35 -17
  46. package/src/generated/instructions/upgradeNonceAccount.ts +22 -8
  47. package/src/generated/instructions/withdrawNonceAccount.ts +50 -33
@@ -26,7 +26,13 @@ import {
26
26
  type ReadonlyUint8Array,
27
27
  type WritableAccount,
28
28
  } from '@solana/kit';
29
- import { getAccountMetaFactory, type ResolvedInstructionAccount } from '@solana/kit/program-client-core';
29
+ import {
30
+ getAccountMetaFactory,
31
+ type InstructionAccountInput,
32
+ type InstructionAccountInputAddress,
33
+ type ResolvedInstructionAccount,
34
+ type ResolvedInstructionAccountMeta,
35
+ } from '@solana/kit/program-client-core';
30
36
  import { SYSTEM_PROGRAM_ADDRESS } from '../programs';
31
37
 
32
38
  export const UPGRADE_NONCE_ACCOUNT_DISCRIMINATOR = 12;
@@ -70,30 +76,38 @@ export function getUpgradeNonceAccountInstructionDataCodec(): FixedSizeCodec<
70
76
  return combineCodec(getUpgradeNonceAccountInstructionDataEncoder(), getUpgradeNonceAccountInstructionDataDecoder());
71
77
  }
72
78
 
73
- export type UpgradeNonceAccountInput<TAccountNonceAccount extends string = string> = {
74
- nonceAccount: Address<TAccountNonceAccount>;
79
+ export type UpgradeNonceAccountInput<TAccountNonceAccount extends InstructionAccountInput = InstructionAccountInput> = {
80
+ nonceAccount: TAccountNonceAccount;
75
81
  };
76
82
 
77
83
  export function getUpgradeNonceAccountInstruction<
78
- TAccountNonceAccount extends string,
84
+ TAccountNonceAccount extends InstructionAccountInput,
79
85
  TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
80
86
  >(
81
87
  input: UpgradeNonceAccountInput<TAccountNonceAccount>,
82
88
  config?: { programAddress?: TProgramAddress },
83
- ): UpgradeNonceAccountInstruction<TProgramAddress, TAccountNonceAccount> {
89
+ ): UpgradeNonceAccountInstruction<
90
+ TProgramAddress,
91
+ ResolvedInstructionAccountMeta<TAccountNonceAccount, InstructionAccountInputAddress<TAccountNonceAccount>>
92
+ > {
84
93
  // Program address.
85
94
  const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
86
95
 
96
+ // Account meta helper.
97
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
98
+
87
99
  // Original accounts.
88
- const originalAccounts = { nonceAccount: { value: input.nonceAccount ?? null, isWritable: true } };
100
+ const originalAccounts = { nonceAccount: { value: input.nonceAccount ?? null, isSigner: false, isWritable: true } };
89
101
  const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedInstructionAccount>;
90
102
 
91
- const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
92
103
  return Object.freeze({
93
104
  accounts: [getAccountMeta('nonceAccount', accounts.nonceAccount)],
94
105
  data: getUpgradeNonceAccountInstructionDataEncoder().encode({}),
95
106
  programAddress,
96
- } as UpgradeNonceAccountInstruction<TProgramAddress, TAccountNonceAccount>);
107
+ } as UpgradeNonceAccountInstruction<
108
+ TProgramAddress,
109
+ ResolvedInstructionAccountMeta<TAccountNonceAccount, InstructionAccountInputAddress<TAccountNonceAccount>>
110
+ >);
97
111
  }
98
112
 
99
113
  export type ParsedUpgradeNonceAccountInstruction<
@@ -29,10 +29,16 @@ import {
29
29
  type ReadonlyAccount,
30
30
  type ReadonlySignerAccount,
31
31
  type ReadonlyUint8Array,
32
- type TransactionSigner,
33
32
  type WritableAccount,
34
33
  } from '@solana/kit';
35
- import { getAccountMetaFactory, type ResolvedInstructionAccount } from '@solana/kit/program-client-core';
34
+ import {
35
+ getAccountMetaFactory,
36
+ type InstructionAccountInput,
37
+ type InstructionAccountInputAddress,
38
+ type InstructionSignerInput,
39
+ type ResolvedInstructionAccount,
40
+ type ResolvedInstructionAccountMeta,
41
+ } from '@solana/kit/program-client-core';
36
42
  import { SYSTEM_PROGRAM_ADDRESS } from '../programs';
37
43
 
38
44
  export const WITHDRAW_NONCE_ACCOUNT_DISCRIMINATOR = 5;
@@ -101,26 +107,26 @@ export function getWithdrawNonceAccountInstructionDataCodec(): FixedSizeCodec<
101
107
  }
102
108
 
103
109
  export type WithdrawNonceAccountInput<
104
- TAccountNonceAccount extends string = string,
105
- TAccountRecipientAccount extends string = string,
106
- TAccountRecentBlockhashesSysvar extends string = string,
107
- TAccountRentSysvar extends string = string,
108
- TAccountNonceAuthority extends string = string,
110
+ TAccountNonceAccount extends InstructionAccountInput = InstructionAccountInput,
111
+ TAccountRecipientAccount extends InstructionAccountInput = InstructionAccountInput,
112
+ TAccountRecentBlockhashesSysvar extends InstructionAccountInput = InstructionAccountInput,
113
+ TAccountRentSysvar extends InstructionAccountInput = InstructionAccountInput,
114
+ TAccountNonceAuthority extends InstructionSignerInput = InstructionSignerInput,
109
115
  > = {
110
- nonceAccount: Address<TAccountNonceAccount>;
111
- recipientAccount: Address<TAccountRecipientAccount>;
112
- recentBlockhashesSysvar?: Address<TAccountRecentBlockhashesSysvar>;
113
- rentSysvar?: Address<TAccountRentSysvar>;
114
- nonceAuthority: TransactionSigner<TAccountNonceAuthority>;
116
+ nonceAccount: TAccountNonceAccount;
117
+ recipientAccount: TAccountRecipientAccount;
118
+ recentBlockhashesSysvar?: TAccountRecentBlockhashesSysvar;
119
+ rentSysvar?: TAccountRentSysvar;
120
+ nonceAuthority: TAccountNonceAuthority;
115
121
  withdrawAmount: WithdrawNonceAccountInstructionDataArgs['withdrawAmount'];
116
122
  };
117
123
 
118
124
  export function getWithdrawNonceAccountInstruction<
119
- TAccountNonceAccount extends string,
120
- TAccountRecipientAccount extends string,
121
- TAccountRecentBlockhashesSysvar extends string,
122
- TAccountRentSysvar extends string,
123
- TAccountNonceAuthority extends string,
125
+ TAccountNonceAccount extends InstructionAccountInput,
126
+ TAccountRecipientAccount extends InstructionAccountInput,
127
+ TAccountRecentBlockhashesSysvar extends InstructionAccountInput,
128
+ TAccountRentSysvar extends InstructionAccountInput,
129
+ TAccountNonceAuthority extends InstructionSignerInput,
124
130
  TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
125
131
  >(
126
132
  input: WithdrawNonceAccountInput<
@@ -133,22 +139,28 @@ export function getWithdrawNonceAccountInstruction<
133
139
  config?: { programAddress?: TProgramAddress },
134
140
  ): WithdrawNonceAccountInstruction<
135
141
  TProgramAddress,
136
- TAccountNonceAccount,
137
- TAccountRecipientAccount,
138
- TAccountRecentBlockhashesSysvar,
139
- TAccountRentSysvar,
140
- TAccountNonceAuthority
142
+ ResolvedInstructionAccountMeta<TAccountNonceAccount, InstructionAccountInputAddress<TAccountNonceAccount>>,
143
+ ResolvedInstructionAccountMeta<TAccountRecipientAccount, InstructionAccountInputAddress<TAccountRecipientAccount>>,
144
+ ResolvedInstructionAccountMeta<
145
+ TAccountRecentBlockhashesSysvar,
146
+ InstructionAccountInputAddress<TAccountRecentBlockhashesSysvar>
147
+ >,
148
+ ResolvedInstructionAccountMeta<TAccountRentSysvar, InstructionAccountInputAddress<TAccountRentSysvar>>,
149
+ ResolvedInstructionAccountMeta<TAccountNonceAuthority, InstructionAccountInputAddress<TAccountNonceAuthority>>
141
150
  > {
142
151
  // Program address.
143
152
  const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
144
153
 
154
+ // Account meta helper.
155
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
156
+
145
157
  // Original accounts.
146
158
  const originalAccounts = {
147
- nonceAccount: { value: input.nonceAccount ?? null, isWritable: true },
148
- recipientAccount: { value: input.recipientAccount ?? null, isWritable: true },
149
- recentBlockhashesSysvar: { value: input.recentBlockhashesSysvar ?? null, isWritable: false },
150
- rentSysvar: { value: input.rentSysvar ?? null, isWritable: false },
151
- nonceAuthority: { value: input.nonceAuthority ?? null, isWritable: false },
159
+ nonceAccount: { value: input.nonceAccount ?? null, isSigner: false, isWritable: true },
160
+ recipientAccount: { value: input.recipientAccount ?? null, isSigner: false, isWritable: true },
161
+ recentBlockhashesSysvar: { value: input.recentBlockhashesSysvar ?? null, isSigner: false, isWritable: false },
162
+ rentSysvar: { value: input.rentSysvar ?? null, isSigner: false, isWritable: false },
163
+ nonceAuthority: { value: input.nonceAuthority ?? null, isSigner: true, isWritable: false },
152
164
  };
153
165
  const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedInstructionAccount>;
154
166
 
@@ -165,7 +177,6 @@ export function getWithdrawNonceAccountInstruction<
165
177
  'SysvarRent111111111111111111111111111111111' as Address<'SysvarRent111111111111111111111111111111111'>;
166
178
  }
167
179
 
168
- const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
169
180
  return Object.freeze({
170
181
  accounts: [
171
182
  getAccountMeta('nonceAccount', accounts.nonceAccount),
@@ -178,11 +189,17 @@ export function getWithdrawNonceAccountInstruction<
178
189
  programAddress,
179
190
  } as WithdrawNonceAccountInstruction<
180
191
  TProgramAddress,
181
- TAccountNonceAccount,
182
- TAccountRecipientAccount,
183
- TAccountRecentBlockhashesSysvar,
184
- TAccountRentSysvar,
185
- TAccountNonceAuthority
192
+ ResolvedInstructionAccountMeta<TAccountNonceAccount, InstructionAccountInputAddress<TAccountNonceAccount>>,
193
+ ResolvedInstructionAccountMeta<
194
+ TAccountRecipientAccount,
195
+ InstructionAccountInputAddress<TAccountRecipientAccount>
196
+ >,
197
+ ResolvedInstructionAccountMeta<
198
+ TAccountRecentBlockhashesSysvar,
199
+ InstructionAccountInputAddress<TAccountRecentBlockhashesSysvar>
200
+ >,
201
+ ResolvedInstructionAccountMeta<TAccountRentSysvar, InstructionAccountInputAddress<TAccountRentSysvar>>,
202
+ ResolvedInstructionAccountMeta<TAccountNonceAuthority, InstructionAccountInputAddress<TAccountNonceAuthority>>
186
203
  >);
187
204
  }
188
205