@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
@@ -26,17 +26,20 @@ import {
26
26
  type FixedSizeCodec,
27
27
  type FixedSizeDecoder,
28
28
  type FixedSizeEncoder,
29
+ type HasAddress,
29
30
  type Instruction,
30
31
  type InstructionWithAccounts,
31
32
  type InstructionWithData,
32
33
  type ReadonlyUint8Array,
33
- type TransactionSigner,
34
34
  type WritableSignerAccount,
35
35
  } from '@solana/kit';
36
36
  import {
37
37
  getAccountMetaFactory,
38
+ type InstructionAccountInputAddress,
39
+ type InstructionSignerInput,
38
40
  type InstructionWithByteDelta,
39
41
  type ResolvedInstructionAccount,
42
+ type ResolvedInstructionAccountMeta,
40
43
  } from '@solana/kit/program-client-core';
41
44
  import { SYSTEM_PROGRAM_ADDRESS } from '../programs';
42
45
 
@@ -75,7 +78,7 @@ export type CreateAccountInstructionData = {
75
78
  export type CreateAccountInstructionDataArgs = {
76
79
  lamports: number | bigint;
77
80
  space: number | bigint;
78
- programAddress: Address;
81
+ programAddress: Address | HasAddress;
79
82
  };
80
83
 
81
84
  export function getCreateAccountInstructionDataEncoder(): FixedSizeEncoder<CreateAccountInstructionDataArgs> {
@@ -106,29 +109,41 @@ export function getCreateAccountInstructionDataCodec(): FixedSizeCodec<
106
109
  return combineCodec(getCreateAccountInstructionDataEncoder(), getCreateAccountInstructionDataDecoder());
107
110
  }
108
111
 
109
- export type CreateAccountInput<TAccountPayer extends string = string, TAccountNewAccount extends string = string> = {
110
- payer: TransactionSigner<TAccountPayer>;
111
- newAccount: TransactionSigner<TAccountNewAccount>;
112
+ export type CreateAccountInput<
113
+ TAccountPayer extends InstructionSignerInput = InstructionSignerInput,
114
+ TAccountNewAccount extends InstructionSignerInput = InstructionSignerInput,
115
+ > = {
116
+ payer: TAccountPayer;
117
+ newAccount: TAccountNewAccount;
112
118
  lamports: CreateAccountInstructionDataArgs['lamports'];
113
119
  space: CreateAccountInstructionDataArgs['space'];
114
120
  programAddress: CreateAccountInstructionDataArgs['programAddress'];
115
121
  };
116
122
 
117
123
  export function getCreateAccountInstruction<
118
- TAccountPayer extends string,
119
- TAccountNewAccount extends string,
124
+ TAccountPayer extends InstructionSignerInput,
125
+ TAccountNewAccount extends InstructionSignerInput,
120
126
  TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
121
127
  >(
122
128
  input: CreateAccountInput<TAccountPayer, TAccountNewAccount>,
123
- config?: { programAddress?: TProgramAddress },
124
- ): CreateAccountInstruction<TProgramAddress, TAccountPayer, TAccountNewAccount> & InstructionWithByteDelta {
129
+ config?: { programAddress?: TProgramAddress | { readonly address: TProgramAddress } },
130
+ ): CreateAccountInstruction<
131
+ TProgramAddress,
132
+ ResolvedInstructionAccountMeta<TAccountPayer, InstructionAccountInputAddress<TAccountPayer>>,
133
+ ResolvedInstructionAccountMeta<TAccountNewAccount, InstructionAccountInputAddress<TAccountNewAccount>>
134
+ > &
135
+ InstructionWithByteDelta {
125
136
  // Program address.
126
- const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
137
+ const programAddressInput = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
138
+ const programAddress = typeof programAddressInput === 'string' ? programAddressInput : programAddressInput.address;
139
+
140
+ // Account meta helper.
141
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
127
142
 
128
143
  // Original accounts.
129
144
  const originalAccounts = {
130
- payer: { value: input.payer ?? null, isWritable: true },
131
- newAccount: { value: input.newAccount ?? null, isWritable: true },
145
+ payer: { value: input.payer ?? null, isSigner: true, isWritable: true },
146
+ newAccount: { value: input.newAccount ?? null, isSigner: true, isWritable: true },
132
147
  };
133
148
  const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedInstructionAccount>;
134
149
 
@@ -138,13 +153,17 @@ export function getCreateAccountInstruction<
138
153
  // Bytes created or reallocated by the instruction.
139
154
  const byteDelta: number = [Number(args.space) + BASE_ACCOUNT_SIZE].reduce((a, b) => a + b, 0);
140
155
 
141
- const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
142
156
  return Object.freeze({
143
157
  accounts: [getAccountMeta('payer', accounts.payer), getAccountMeta('newAccount', accounts.newAccount)],
144
158
  byteDelta,
145
159
  data: getCreateAccountInstructionDataEncoder().encode(args as CreateAccountInstructionDataArgs),
146
160
  programAddress,
147
- } as CreateAccountInstruction<TProgramAddress, TAccountPayer, TAccountNewAccount> & InstructionWithByteDelta);
161
+ } as CreateAccountInstruction<
162
+ TProgramAddress,
163
+ ResolvedInstructionAccountMeta<TAccountPayer, InstructionAccountInputAddress<TAccountPayer>>,
164
+ ResolvedInstructionAccountMeta<TAccountNewAccount, InstructionAccountInputAddress<TAccountNewAccount>>
165
+ > &
166
+ InstructionWithByteDelta);
148
167
  }
149
168
 
150
169
  export type ParsedCreateAccountInstruction<
@@ -26,17 +26,20 @@ import {
26
26
  type FixedSizeCodec,
27
27
  type FixedSizeDecoder,
28
28
  type FixedSizeEncoder,
29
+ type HasAddress,
29
30
  type Instruction,
30
31
  type InstructionWithAccounts,
31
32
  type InstructionWithData,
32
33
  type ReadonlyUint8Array,
33
- type TransactionSigner,
34
34
  type WritableSignerAccount,
35
35
  } from '@solana/kit';
36
36
  import {
37
37
  getAccountMetaFactory,
38
+ type InstructionAccountInputAddress,
39
+ type InstructionSignerInput,
38
40
  type InstructionWithByteDelta,
39
41
  type ResolvedInstructionAccount,
42
+ type ResolvedInstructionAccountMeta,
40
43
  } from '@solana/kit/program-client-core';
41
44
  import { SYSTEM_PROGRAM_ADDRESS } from '../programs';
42
45
 
@@ -79,7 +82,7 @@ export type CreateAccountAllowPrefundInstructionData = {
79
82
  export type CreateAccountAllowPrefundInstructionDataArgs = {
80
83
  lamports?: number | bigint;
81
84
  space: number | bigint;
82
- programAddress: Address;
85
+ programAddress: Address | HasAddress;
83
86
  };
84
87
 
85
88
  export function getCreateAccountAllowPrefundInstructionDataEncoder(): FixedSizeEncoder<CreateAccountAllowPrefundInstructionDataArgs> {
@@ -118,31 +121,40 @@ export function getCreateAccountAllowPrefundInstructionDataCodec(): FixedSizeCod
118
121
  }
119
122
 
120
123
  export type CreateAccountAllowPrefundInput<
121
- TAccountNewAccount extends string = string,
122
- TAccountPayer extends string = string,
124
+ TAccountNewAccount extends InstructionSignerInput = InstructionSignerInput,
125
+ TAccountPayer extends InstructionSignerInput = InstructionSignerInput,
123
126
  > = {
124
- newAccount: TransactionSigner<TAccountNewAccount>;
125
- payer?: TransactionSigner<TAccountPayer>;
127
+ newAccount: TAccountNewAccount;
128
+ payer?: TAccountPayer;
126
129
  lamports?: CreateAccountAllowPrefundInstructionDataArgs['lamports'];
127
130
  space: CreateAccountAllowPrefundInstructionDataArgs['space'];
128
131
  programAddress: CreateAccountAllowPrefundInstructionDataArgs['programAddress'];
129
132
  };
130
133
 
131
134
  export function getCreateAccountAllowPrefundInstruction<
132
- TAccountNewAccount extends string,
133
- TAccountPayer extends string,
135
+ TAccountNewAccount extends InstructionSignerInput,
136
+ TAccountPayer extends InstructionSignerInput,
134
137
  TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
135
138
  >(
136
139
  input: CreateAccountAllowPrefundInput<TAccountNewAccount, TAccountPayer>,
137
- config?: { programAddress?: TProgramAddress },
138
- ): CreateAccountAllowPrefundInstruction<TProgramAddress, TAccountNewAccount, TAccountPayer> & InstructionWithByteDelta {
140
+ config?: { programAddress?: TProgramAddress | { readonly address: TProgramAddress } },
141
+ ): CreateAccountAllowPrefundInstruction<
142
+ TProgramAddress,
143
+ ResolvedInstructionAccountMeta<TAccountNewAccount, InstructionAccountInputAddress<TAccountNewAccount>>,
144
+ ResolvedInstructionAccountMeta<TAccountPayer, InstructionAccountInputAddress<TAccountPayer>>
145
+ > &
146
+ InstructionWithByteDelta {
139
147
  // Program address.
140
- const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
148
+ const programAddressInput = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
149
+ const programAddress = typeof programAddressInput === 'string' ? programAddressInput : programAddressInput.address;
150
+
151
+ // Account meta helper.
152
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
141
153
 
142
154
  // Original accounts.
143
155
  const originalAccounts = {
144
- newAccount: { value: input.newAccount ?? null, isWritable: true },
145
- payer: { value: input.payer ?? null, isWritable: true },
156
+ newAccount: { value: input.newAccount ?? null, isSigner: true, isWritable: true },
157
+ payer: { value: input.payer ?? null, isSigner: true, isWritable: true },
146
158
  };
147
159
  const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedInstructionAccount>;
148
160
 
@@ -152,7 +164,6 @@ export function getCreateAccountAllowPrefundInstruction<
152
164
  // Bytes created or reallocated by the instruction.
153
165
  const byteDelta: number = [Number(args.space) + BASE_ACCOUNT_SIZE].reduce((a, b) => a + b, 0);
154
166
 
155
- const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
156
167
  return Object.freeze({
157
168
  accounts: [getAccountMeta('newAccount', accounts.newAccount), getAccountMeta('payer', accounts.payer)].filter(
158
169
  <T>(x: T | undefined): x is T => x !== undefined,
@@ -162,7 +173,11 @@ export function getCreateAccountAllowPrefundInstruction<
162
173
  args as CreateAccountAllowPrefundInstructionDataArgs,
163
174
  ),
164
175
  programAddress,
165
- } as CreateAccountAllowPrefundInstruction<TProgramAddress, TAccountNewAccount, TAccountPayer> &
176
+ } as CreateAccountAllowPrefundInstruction<
177
+ TProgramAddress,
178
+ ResolvedInstructionAccountMeta<TAccountNewAccount, InstructionAccountInputAddress<TAccountNewAccount>>,
179
+ ResolvedInstructionAccountMeta<TAccountPayer, InstructionAccountInputAddress<TAccountPayer>>
180
+ > &
166
181
  InstructionWithByteDelta);
167
182
  }
168
183
 
@@ -29,16 +29,23 @@ import {
29
29
  type Codec,
30
30
  type Decoder,
31
31
  type Encoder,
32
+ type HasAddress,
32
33
  type Instruction,
33
34
  type InstructionWithAccounts,
34
35
  type InstructionWithData,
35
36
  type ReadonlySignerAccount,
36
37
  type ReadonlyUint8Array,
37
- type TransactionSigner,
38
38
  type WritableAccount,
39
39
  type WritableSignerAccount,
40
40
  } from '@solana/kit';
41
- import { getAccountMetaFactory, type ResolvedInstructionAccount } from '@solana/kit/program-client-core';
41
+ import {
42
+ getAccountMetaFactory,
43
+ type InstructionAccountInput,
44
+ type InstructionAccountInputAddress,
45
+ type InstructionSignerInput,
46
+ type ResolvedInstructionAccount,
47
+ type ResolvedInstructionAccountMeta,
48
+ } from '@solana/kit/program-client-core';
42
49
  import { SYSTEM_PROGRAM_ADDRESS } from '../programs';
43
50
 
44
51
  export const CREATE_ACCOUNT_WITH_SEED_DISCRIMINATOR = 3;
@@ -82,11 +89,11 @@ export type CreateAccountWithSeedInstructionData = {
82
89
  };
83
90
 
84
91
  export type CreateAccountWithSeedInstructionDataArgs = {
85
- base: Address;
92
+ base: Address | HasAddress;
86
93
  seed: string;
87
94
  amount: number | bigint;
88
95
  space: number | bigint;
89
- programAddress: Address;
96
+ programAddress: Address | HasAddress;
90
97
  };
91
98
 
92
99
  export function getCreateAccountWithSeedInstructionDataEncoder(): Encoder<CreateAccountWithSeedInstructionDataArgs> {
@@ -125,13 +132,13 @@ export function getCreateAccountWithSeedInstructionDataCodec(): Codec<
125
132
  }
126
133
 
127
134
  export type CreateAccountWithSeedInput<
128
- TAccountPayer extends string = string,
129
- TAccountNewAccount extends string = string,
130
- TAccountBaseAccount extends string = string,
135
+ TAccountPayer extends InstructionSignerInput = InstructionSignerInput,
136
+ TAccountNewAccount extends InstructionAccountInput = InstructionAccountInput,
137
+ TAccountBaseAccount extends InstructionSignerInput = InstructionSignerInput,
131
138
  > = {
132
- payer: TransactionSigner<TAccountPayer>;
133
- newAccount: Address<TAccountNewAccount>;
134
- baseAccount?: TransactionSigner<TAccountBaseAccount>;
139
+ payer: TAccountPayer;
140
+ newAccount: TAccountNewAccount;
141
+ baseAccount?: TAccountBaseAccount;
135
142
  base: CreateAccountWithSeedInstructionDataArgs['base'];
136
143
  seed: CreateAccountWithSeedInstructionDataArgs['seed'];
137
144
  amount: CreateAccountWithSeedInstructionDataArgs['amount'];
@@ -140,29 +147,37 @@ export type CreateAccountWithSeedInput<
140
147
  };
141
148
 
142
149
  export function getCreateAccountWithSeedInstruction<
143
- TAccountPayer extends string,
144
- TAccountNewAccount extends string,
145
- TAccountBaseAccount extends string,
150
+ TAccountPayer extends InstructionSignerInput,
151
+ TAccountNewAccount extends InstructionAccountInput,
152
+ TAccountBaseAccount extends InstructionSignerInput,
146
153
  TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
147
154
  >(
148
155
  input: CreateAccountWithSeedInput<TAccountPayer, TAccountNewAccount, TAccountBaseAccount>,
149
- config?: { programAddress?: TProgramAddress },
150
- ): CreateAccountWithSeedInstruction<TProgramAddress, TAccountPayer, TAccountNewAccount, TAccountBaseAccount> {
156
+ config?: { programAddress?: TProgramAddress | { readonly address: TProgramAddress } },
157
+ ): CreateAccountWithSeedInstruction<
158
+ TProgramAddress,
159
+ ResolvedInstructionAccountMeta<TAccountPayer, InstructionAccountInputAddress<TAccountPayer>>,
160
+ ResolvedInstructionAccountMeta<TAccountNewAccount, InstructionAccountInputAddress<TAccountNewAccount>>,
161
+ ResolvedInstructionAccountMeta<TAccountBaseAccount, InstructionAccountInputAddress<TAccountBaseAccount>>
162
+ > {
151
163
  // Program address.
152
- const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
164
+ const programAddressInput = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
165
+ const programAddress = typeof programAddressInput === 'string' ? programAddressInput : programAddressInput.address;
166
+
167
+ // Account meta helper.
168
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
153
169
 
154
170
  // Original accounts.
155
171
  const originalAccounts = {
156
- payer: { value: input.payer ?? null, isWritable: true },
157
- newAccount: { value: input.newAccount ?? null, isWritable: true },
158
- baseAccount: { value: input.baseAccount ?? null, isWritable: false },
172
+ payer: { value: input.payer ?? null, isSigner: true, isWritable: true },
173
+ newAccount: { value: input.newAccount ?? null, isSigner: false, isWritable: true },
174
+ baseAccount: { value: input.baseAccount ?? null, isSigner: true, isWritable: false },
159
175
  };
160
176
  const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedInstructionAccount>;
161
177
 
162
178
  // Original args.
163
179
  const args = { ...input };
164
180
 
165
- const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
166
181
  return Object.freeze({
167
182
  accounts: [
168
183
  getAccountMeta('payer', accounts.payer),
@@ -171,7 +186,12 @@ export function getCreateAccountWithSeedInstruction<
171
186
  ].filter(<T>(x: T | undefined): x is T => x !== undefined),
172
187
  data: getCreateAccountWithSeedInstructionDataEncoder().encode(args as CreateAccountWithSeedInstructionDataArgs),
173
188
  programAddress,
174
- } as CreateAccountWithSeedInstruction<TProgramAddress, TAccountPayer, TAccountNewAccount, TAccountBaseAccount>);
189
+ } as CreateAccountWithSeedInstruction<
190
+ TProgramAddress,
191
+ ResolvedInstructionAccountMeta<TAccountPayer, InstructionAccountInputAddress<TAccountPayer>>,
192
+ ResolvedInstructionAccountMeta<TAccountNewAccount, InstructionAccountInputAddress<TAccountNewAccount>>,
193
+ ResolvedInstructionAccountMeta<TAccountBaseAccount, InstructionAccountInputAddress<TAccountBaseAccount>>
194
+ >);
175
195
  }
176
196
 
177
197
  export type ParsedCreateAccountWithSeedInstruction<
@@ -22,6 +22,7 @@ import {
22
22
  type FixedSizeCodec,
23
23
  type FixedSizeDecoder,
24
24
  type FixedSizeEncoder,
25
+ type HasAddress,
25
26
  type Instruction,
26
27
  type InstructionWithAccounts,
27
28
  type InstructionWithData,
@@ -29,7 +30,13 @@ import {
29
30
  type ReadonlyUint8Array,
30
31
  type WritableAccount,
31
32
  } from '@solana/kit';
32
- import { getAccountMetaFactory, type ResolvedInstructionAccount } from '@solana/kit/program-client-core';
33
+ import {
34
+ getAccountMetaFactory,
35
+ type InstructionAccountInput,
36
+ type InstructionAccountInputAddress,
37
+ type ResolvedInstructionAccount,
38
+ type ResolvedInstructionAccountMeta,
39
+ } from '@solana/kit/program-client-core';
33
40
  import { SYSTEM_PROGRAM_ADDRESS } from '../programs';
34
41
 
35
42
  export const INITIALIZE_NONCE_ACCOUNT_DISCRIMINATOR = 6;
@@ -60,7 +67,7 @@ export type InitializeNonceAccountInstruction<
60
67
 
61
68
  export type InitializeNonceAccountInstructionData = { discriminator: number; nonceAuthority: Address };
62
69
 
63
- export type InitializeNonceAccountInstructionDataArgs = { nonceAuthority: Address };
70
+ export type InitializeNonceAccountInstructionDataArgs = { nonceAuthority: Address | HasAddress };
64
71
 
65
72
  export function getInitializeNonceAccountInstructionDataEncoder(): FixedSizeEncoder<InitializeNonceAccountInstructionDataArgs> {
66
73
  return transformEncoder(
@@ -90,38 +97,45 @@ export function getInitializeNonceAccountInstructionDataCodec(): FixedSizeCodec<
90
97
  }
91
98
 
92
99
  export type InitializeNonceAccountInput<
93
- TAccountNonceAccount extends string = string,
94
- TAccountRecentBlockhashesSysvar extends string = string,
95
- TAccountRentSysvar extends string = string,
100
+ TAccountNonceAccount extends InstructionAccountInput = InstructionAccountInput,
101
+ TAccountRecentBlockhashesSysvar extends InstructionAccountInput = InstructionAccountInput,
102
+ TAccountRentSysvar extends InstructionAccountInput = InstructionAccountInput,
96
103
  > = {
97
- nonceAccount: Address<TAccountNonceAccount>;
98
- recentBlockhashesSysvar?: Address<TAccountRecentBlockhashesSysvar>;
99
- rentSysvar?: Address<TAccountRentSysvar>;
104
+ nonceAccount: TAccountNonceAccount;
105
+ recentBlockhashesSysvar?: TAccountRecentBlockhashesSysvar;
106
+ rentSysvar?: TAccountRentSysvar;
100
107
  nonceAuthority: InitializeNonceAccountInstructionDataArgs['nonceAuthority'];
101
108
  };
102
109
 
103
110
  export function getInitializeNonceAccountInstruction<
104
- TAccountNonceAccount extends string,
105
- TAccountRecentBlockhashesSysvar extends string,
106
- TAccountRentSysvar extends string,
111
+ TAccountNonceAccount extends InstructionAccountInput,
112
+ TAccountRecentBlockhashesSysvar extends InstructionAccountInput,
113
+ TAccountRentSysvar extends InstructionAccountInput,
107
114
  TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
108
115
  >(
109
116
  input: InitializeNonceAccountInput<TAccountNonceAccount, TAccountRecentBlockhashesSysvar, TAccountRentSysvar>,
110
- config?: { programAddress?: TProgramAddress },
117
+ config?: { programAddress?: TProgramAddress | { readonly address: TProgramAddress } },
111
118
  ): InitializeNonceAccountInstruction<
112
119
  TProgramAddress,
113
- TAccountNonceAccount,
114
- TAccountRecentBlockhashesSysvar,
115
- TAccountRentSysvar
120
+ ResolvedInstructionAccountMeta<TAccountNonceAccount, InstructionAccountInputAddress<TAccountNonceAccount>>,
121
+ ResolvedInstructionAccountMeta<
122
+ TAccountRecentBlockhashesSysvar,
123
+ InstructionAccountInputAddress<TAccountRecentBlockhashesSysvar>
124
+ >,
125
+ ResolvedInstructionAccountMeta<TAccountRentSysvar, InstructionAccountInputAddress<TAccountRentSysvar>>
116
126
  > {
117
127
  // Program address.
118
- const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
128
+ const programAddressInput = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
129
+ const programAddress = typeof programAddressInput === 'string' ? programAddressInput : programAddressInput.address;
130
+
131
+ // Account meta helper.
132
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
119
133
 
120
134
  // Original accounts.
121
135
  const originalAccounts = {
122
- nonceAccount: { value: input.nonceAccount ?? null, isWritable: true },
123
- recentBlockhashesSysvar: { value: input.recentBlockhashesSysvar ?? null, isWritable: false },
124
- rentSysvar: { value: input.rentSysvar ?? null, isWritable: false },
136
+ nonceAccount: { value: input.nonceAccount ?? null, isSigner: false, isWritable: true },
137
+ recentBlockhashesSysvar: { value: input.recentBlockhashesSysvar ?? null, isSigner: false, isWritable: false },
138
+ rentSysvar: { value: input.rentSysvar ?? null, isSigner: false, isWritable: false },
125
139
  };
126
140
  const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedInstructionAccount>;
127
141
 
@@ -138,7 +152,6 @@ export function getInitializeNonceAccountInstruction<
138
152
  'SysvarRent111111111111111111111111111111111' as Address<'SysvarRent111111111111111111111111111111111'>;
139
153
  }
140
154
 
141
- const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
142
155
  return Object.freeze({
143
156
  accounts: [
144
157
  getAccountMeta('nonceAccount', accounts.nonceAccount),
@@ -151,9 +164,12 @@ export function getInitializeNonceAccountInstruction<
151
164
  programAddress,
152
165
  } as InitializeNonceAccountInstruction<
153
166
  TProgramAddress,
154
- TAccountNonceAccount,
155
- TAccountRecentBlockhashesSysvar,
156
- TAccountRentSysvar
167
+ ResolvedInstructionAccountMeta<TAccountNonceAccount, InstructionAccountInputAddress<TAccountNonceAccount>>,
168
+ ResolvedInstructionAccountMeta<
169
+ TAccountRecentBlockhashesSysvar,
170
+ InstructionAccountInputAddress<TAccountRecentBlockhashesSysvar>
171
+ >,
172
+ ResolvedInstructionAccountMeta<TAccountRentSysvar, InstructionAccountInputAddress<TAccountRentSysvar>>
157
173
  >);
158
174
  }
159
175
 
@@ -27,11 +27,17 @@ import {
27
27
  type InstructionWithAccounts,
28
28
  type InstructionWithData,
29
29
  type ReadonlyUint8Array,
30
- type TransactionSigner,
31
30
  type WritableAccount,
32
31
  type WritableSignerAccount,
33
32
  } from '@solana/kit';
34
- import { getAccountMetaFactory, type ResolvedInstructionAccount } from '@solana/kit/program-client-core';
33
+ import {
34
+ getAccountMetaFactory,
35
+ type InstructionAccountInput,
36
+ type InstructionAccountInputAddress,
37
+ type InstructionSignerInput,
38
+ type ResolvedInstructionAccount,
39
+ type ResolvedInstructionAccountMeta,
40
+ } from '@solana/kit/program-client-core';
35
41
  import { SYSTEM_PROGRAM_ADDRESS } from '../programs';
36
42
 
37
43
  export const TRANSFER_SOL_DISCRIMINATOR = 2;
@@ -85,39 +91,53 @@ export function getTransferSolInstructionDataCodec(): FixedSizeCodec<
85
91
  return combineCodec(getTransferSolInstructionDataEncoder(), getTransferSolInstructionDataDecoder());
86
92
  }
87
93
 
88
- export type TransferSolInput<TAccountSource extends string = string, TAccountDestination extends string = string> = {
89
- source: TransactionSigner<TAccountSource>;
90
- destination: Address<TAccountDestination>;
94
+ export type TransferSolInput<
95
+ TAccountSource extends InstructionSignerInput = InstructionSignerInput,
96
+ TAccountDestination extends InstructionAccountInput = InstructionAccountInput,
97
+ > = {
98
+ source: TAccountSource;
99
+ destination: TAccountDestination;
91
100
  amount: TransferSolInstructionDataArgs['amount'];
92
101
  };
93
102
 
94
103
  export function getTransferSolInstruction<
95
- TAccountSource extends string,
96
- TAccountDestination extends string,
104
+ TAccountSource extends InstructionSignerInput,
105
+ TAccountDestination extends InstructionAccountInput,
97
106
  TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
98
107
  >(
99
108
  input: TransferSolInput<TAccountSource, TAccountDestination>,
100
- config?: { programAddress?: TProgramAddress },
101
- ): TransferSolInstruction<TProgramAddress, TAccountSource, TAccountDestination> {
109
+ config?: { programAddress?: TProgramAddress | { readonly address: TProgramAddress } },
110
+ ): TransferSolInstruction<
111
+ TProgramAddress,
112
+ ResolvedInstructionAccountMeta<TAccountSource, InstructionAccountInputAddress<TAccountSource>>,
113
+ ResolvedInstructionAccountMeta<TAccountDestination, InstructionAccountInputAddress<TAccountDestination>>
114
+ > {
102
115
  // Program address.
103
- const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
116
+ const programAddressInput = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
117
+ const programAddress = typeof programAddressInput === 'string' ? programAddressInput : programAddressInput.address;
118
+
119
+ // Account meta helper.
120
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
104
121
 
105
122
  // Original accounts.
106
123
  const originalAccounts = {
107
- source: { value: input.source ?? null, isWritable: true },
108
- destination: { value: input.destination ?? null, isWritable: true },
124
+ source: { value: input.source ?? null, isSigner: true, isWritable: true },
125
+ destination: { value: input.destination ?? null, isSigner: false, isWritable: true },
109
126
  };
110
127
  const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedInstructionAccount>;
111
128
 
112
129
  // Original args.
113
130
  const args = { ...input };
114
131
 
115
- const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
116
132
  return Object.freeze({
117
133
  accounts: [getAccountMeta('source', accounts.source), getAccountMeta('destination', accounts.destination)],
118
134
  data: getTransferSolInstructionDataEncoder().encode(args as TransferSolInstructionDataArgs),
119
135
  programAddress,
120
- } as TransferSolInstruction<TProgramAddress, TAccountSource, TAccountDestination>);
136
+ } as TransferSolInstruction<
137
+ TProgramAddress,
138
+ ResolvedInstructionAccountMeta<TAccountSource, InstructionAccountInputAddress<TAccountSource>>,
139
+ ResolvedInstructionAccountMeta<TAccountDestination, InstructionAccountInputAddress<TAccountDestination>>
140
+ >);
121
141
  }
122
142
 
123
143
  export type ParsedTransferSolInstruction<
@@ -29,15 +29,22 @@ import {
29
29
  type Codec,
30
30
  type Decoder,
31
31
  type Encoder,
32
+ type HasAddress,
32
33
  type Instruction,
33
34
  type InstructionWithAccounts,
34
35
  type InstructionWithData,
35
36
  type ReadonlySignerAccount,
36
37
  type ReadonlyUint8Array,
37
- type TransactionSigner,
38
38
  type WritableAccount,
39
39
  } from '@solana/kit';
40
- import { getAccountMetaFactory, type ResolvedInstructionAccount } from '@solana/kit/program-client-core';
40
+ import {
41
+ getAccountMetaFactory,
42
+ type InstructionAccountInput,
43
+ type InstructionAccountInputAddress,
44
+ type InstructionSignerInput,
45
+ type ResolvedInstructionAccount,
46
+ type ResolvedInstructionAccountMeta,
47
+ } from '@solana/kit/program-client-core';
41
48
  import { SYSTEM_PROGRAM_ADDRESS } from '../programs';
42
49
 
43
50
  export const TRANSFER_SOL_WITH_SEED_DISCRIMINATOR = 11;
@@ -72,7 +79,11 @@ export type TransferSolWithSeedInstructionData = {
72
79
  fromOwner: Address;
73
80
  };
74
81
 
75
- export type TransferSolWithSeedInstructionDataArgs = { amount: number | bigint; fromSeed: string; fromOwner: Address };
82
+ export type TransferSolWithSeedInstructionDataArgs = {
83
+ amount: number | bigint;
84
+ fromSeed: string;
85
+ fromOwner: Address | HasAddress;
86
+ };
76
87
 
77
88
  export function getTransferSolWithSeedInstructionDataEncoder(): Encoder<TransferSolWithSeedInstructionDataArgs> {
78
89
  return transformEncoder(
@@ -103,42 +114,50 @@ export function getTransferSolWithSeedInstructionDataCodec(): Codec<
103
114
  }
104
115
 
105
116
  export type TransferSolWithSeedInput<
106
- TAccountSource extends string = string,
107
- TAccountBaseAccount extends string = string,
108
- TAccountDestination extends string = string,
117
+ TAccountSource extends InstructionAccountInput = InstructionAccountInput,
118
+ TAccountBaseAccount extends InstructionSignerInput = InstructionSignerInput,
119
+ TAccountDestination extends InstructionAccountInput = InstructionAccountInput,
109
120
  > = {
110
- source: Address<TAccountSource>;
111
- baseAccount: TransactionSigner<TAccountBaseAccount>;
112
- destination: Address<TAccountDestination>;
121
+ source: TAccountSource;
122
+ baseAccount: TAccountBaseAccount;
123
+ destination: TAccountDestination;
113
124
  amount: TransferSolWithSeedInstructionDataArgs['amount'];
114
125
  fromSeed: TransferSolWithSeedInstructionDataArgs['fromSeed'];
115
126
  fromOwner: TransferSolWithSeedInstructionDataArgs['fromOwner'];
116
127
  };
117
128
 
118
129
  export function getTransferSolWithSeedInstruction<
119
- TAccountSource extends string,
120
- TAccountBaseAccount extends string,
121
- TAccountDestination extends string,
130
+ TAccountSource extends InstructionAccountInput,
131
+ TAccountBaseAccount extends InstructionSignerInput,
132
+ TAccountDestination extends InstructionAccountInput,
122
133
  TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
123
134
  >(
124
135
  input: TransferSolWithSeedInput<TAccountSource, TAccountBaseAccount, TAccountDestination>,
125
- config?: { programAddress?: TProgramAddress },
126
- ): TransferSolWithSeedInstruction<TProgramAddress, TAccountSource, TAccountBaseAccount, TAccountDestination> {
136
+ config?: { programAddress?: TProgramAddress | { readonly address: TProgramAddress } },
137
+ ): TransferSolWithSeedInstruction<
138
+ TProgramAddress,
139
+ ResolvedInstructionAccountMeta<TAccountSource, InstructionAccountInputAddress<TAccountSource>>,
140
+ ResolvedInstructionAccountMeta<TAccountBaseAccount, InstructionAccountInputAddress<TAccountBaseAccount>>,
141
+ ResolvedInstructionAccountMeta<TAccountDestination, InstructionAccountInputAddress<TAccountDestination>>
142
+ > {
127
143
  // Program address.
128
- const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
144
+ const programAddressInput = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
145
+ const programAddress = typeof programAddressInput === 'string' ? programAddressInput : programAddressInput.address;
146
+
147
+ // Account meta helper.
148
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
129
149
 
130
150
  // Original accounts.
131
151
  const originalAccounts = {
132
- source: { value: input.source ?? null, isWritable: true },
133
- baseAccount: { value: input.baseAccount ?? null, isWritable: false },
134
- destination: { value: input.destination ?? null, isWritable: true },
152
+ source: { value: input.source ?? null, isSigner: false, isWritable: true },
153
+ baseAccount: { value: input.baseAccount ?? null, isSigner: true, isWritable: false },
154
+ destination: { value: input.destination ?? null, isSigner: false, isWritable: true },
135
155
  };
136
156
  const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedInstructionAccount>;
137
157
 
138
158
  // Original args.
139
159
  const args = { ...input };
140
160
 
141
- const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
142
161
  return Object.freeze({
143
162
  accounts: [
144
163
  getAccountMeta('source', accounts.source),
@@ -147,7 +166,12 @@ export function getTransferSolWithSeedInstruction<
147
166
  ],
148
167
  data: getTransferSolWithSeedInstructionDataEncoder().encode(args as TransferSolWithSeedInstructionDataArgs),
149
168
  programAddress,
150
- } as TransferSolWithSeedInstruction<TProgramAddress, TAccountSource, TAccountBaseAccount, TAccountDestination>);
169
+ } as TransferSolWithSeedInstruction<
170
+ TProgramAddress,
171
+ ResolvedInstructionAccountMeta<TAccountSource, InstructionAccountInputAddress<TAccountSource>>,
172
+ ResolvedInstructionAccountMeta<TAccountBaseAccount, InstructionAccountInputAddress<TAccountBaseAccount>>,
173
+ ResolvedInstructionAccountMeta<TAccountDestination, InstructionAccountInputAddress<TAccountDestination>>
174
+ >);
151
175
  }
152
176
 
153
177
  export type ParsedTransferSolWithSeedInstruction<