@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.
- package/dist/src/index.js +46 -46
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.mjs +46 -46
- package/dist/src/index.mjs.map +1 -1
- package/dist/types/generated/instructions/advanceNonceAccount.d.ts +8 -7
- package/dist/types/generated/instructions/advanceNonceAccount.d.ts.map +1 -1
- package/dist/types/generated/instructions/allocate.d.ts +6 -5
- package/dist/types/generated/instructions/allocate.d.ts.map +1 -1
- package/dist/types/generated/instructions/allocateWithSeed.d.ts +7 -6
- package/dist/types/generated/instructions/allocateWithSeed.d.ts.map +1 -1
- package/dist/types/generated/instructions/assign.d.ts +6 -5
- package/dist/types/generated/instructions/assign.d.ts.map +1 -1
- package/dist/types/generated/instructions/assignWithSeed.d.ts +7 -6
- package/dist/types/generated/instructions/assignWithSeed.d.ts.map +1 -1
- package/dist/types/generated/instructions/authorizeNonceAccount.d.ts +7 -6
- package/dist/types/generated/instructions/authorizeNonceAccount.d.ts.map +1 -1
- package/dist/types/generated/instructions/createAccount.d.ts +7 -7
- package/dist/types/generated/instructions/createAccount.d.ts.map +1 -1
- package/dist/types/generated/instructions/createAccountAllowPrefund.d.ts +7 -7
- package/dist/types/generated/instructions/createAccountAllowPrefund.d.ts.map +1 -1
- package/dist/types/generated/instructions/createAccountWithSeed.d.ts +8 -7
- package/dist/types/generated/instructions/createAccountWithSeed.d.ts.map +1 -1
- package/dist/types/generated/instructions/initializeNonceAccount.d.ts +7 -6
- package/dist/types/generated/instructions/initializeNonceAccount.d.ts.map +1 -1
- package/dist/types/generated/instructions/transferSol.d.ts +7 -6
- package/dist/types/generated/instructions/transferSol.d.ts.map +1 -1
- package/dist/types/generated/instructions/transferSolWithSeed.d.ts +8 -7
- package/dist/types/generated/instructions/transferSolWithSeed.d.ts.map +1 -1
- package/dist/types/generated/instructions/upgradeNonceAccount.d.ts +5 -4
- package/dist/types/generated/instructions/upgradeNonceAccount.d.ts.map +1 -1
- package/dist/types/generated/instructions/withdrawNonceAccount.d.ts +10 -9
- package/dist/types/generated/instructions/withdrawNonceAccount.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/generated/instructions/advanceNonceAccount.ts +35 -21
- package/src/generated/instructions/allocate.ts +22 -9
- package/src/generated/instructions/allocateWithSeed.ts +29 -13
- package/src/generated/instructions/assign.ts +22 -9
- package/src/generated/instructions/assignWithSeed.ts +29 -13
- package/src/generated/instructions/authorizeNonceAccount.ts +29 -13
- package/src/generated/instructions/createAccount.ts +28 -11
- package/src/generated/instructions/createAccountAllowPrefund.ts +25 -12
- package/src/generated/instructions/createAccountWithSeed.ts +35 -17
- package/src/generated/instructions/initializeNonceAccount.ts +34 -20
- package/src/generated/instructions/transferSol.ts +31 -12
- package/src/generated/instructions/transferSolWithSeed.ts +35 -17
- package/src/generated/instructions/upgradeNonceAccount.ts +22 -8
- package/src/generated/instructions/withdrawNonceAccount.ts +50 -33
|
@@ -28,10 +28,16 @@ import {
|
|
|
28
28
|
type InstructionWithData,
|
|
29
29
|
type ReadonlySignerAccount,
|
|
30
30
|
type ReadonlyUint8Array,
|
|
31
|
-
type TransactionSigner,
|
|
32
31
|
type WritableAccount,
|
|
33
32
|
} from '@solana/kit';
|
|
34
|
-
import {
|
|
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 AUTHORIZE_NONCE_ACCOUNT_DISCRIMINATOR = 7;
|
|
@@ -89,36 +95,42 @@ export function getAuthorizeNonceAccountInstructionDataCodec(): FixedSizeCodec<
|
|
|
89
95
|
}
|
|
90
96
|
|
|
91
97
|
export type AuthorizeNonceAccountInput<
|
|
92
|
-
TAccountNonceAccount extends
|
|
93
|
-
TAccountNonceAuthority extends
|
|
98
|
+
TAccountNonceAccount extends InstructionAccountInput = InstructionAccountInput,
|
|
99
|
+
TAccountNonceAuthority extends InstructionSignerInput = InstructionSignerInput,
|
|
94
100
|
> = {
|
|
95
|
-
nonceAccount:
|
|
96
|
-
nonceAuthority:
|
|
101
|
+
nonceAccount: TAccountNonceAccount;
|
|
102
|
+
nonceAuthority: TAccountNonceAuthority;
|
|
97
103
|
newNonceAuthority: AuthorizeNonceAccountInstructionDataArgs['newNonceAuthority'];
|
|
98
104
|
};
|
|
99
105
|
|
|
100
106
|
export function getAuthorizeNonceAccountInstruction<
|
|
101
|
-
TAccountNonceAccount extends
|
|
102
|
-
TAccountNonceAuthority extends
|
|
107
|
+
TAccountNonceAccount extends InstructionAccountInput,
|
|
108
|
+
TAccountNonceAuthority extends InstructionSignerInput,
|
|
103
109
|
TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
|
|
104
110
|
>(
|
|
105
111
|
input: AuthorizeNonceAccountInput<TAccountNonceAccount, TAccountNonceAuthority>,
|
|
106
112
|
config?: { programAddress?: TProgramAddress },
|
|
107
|
-
): AuthorizeNonceAccountInstruction<
|
|
113
|
+
): AuthorizeNonceAccountInstruction<
|
|
114
|
+
TProgramAddress,
|
|
115
|
+
ResolvedInstructionAccountMeta<TAccountNonceAccount, InstructionAccountInputAddress<TAccountNonceAccount>>,
|
|
116
|
+
ResolvedInstructionAccountMeta<TAccountNonceAuthority, InstructionAccountInputAddress<TAccountNonceAuthority>>
|
|
117
|
+
> {
|
|
108
118
|
// Program address.
|
|
109
119
|
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
|
|
110
120
|
|
|
121
|
+
// Account meta helper.
|
|
122
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
|
|
123
|
+
|
|
111
124
|
// Original accounts.
|
|
112
125
|
const originalAccounts = {
|
|
113
|
-
nonceAccount: { value: input.nonceAccount ?? null, isWritable: true },
|
|
114
|
-
nonceAuthority: { value: input.nonceAuthority ?? null, isWritable: false },
|
|
126
|
+
nonceAccount: { value: input.nonceAccount ?? null, isSigner: false, isWritable: true },
|
|
127
|
+
nonceAuthority: { value: input.nonceAuthority ?? null, isSigner: true, isWritable: false },
|
|
115
128
|
};
|
|
116
129
|
const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedInstructionAccount>;
|
|
117
130
|
|
|
118
131
|
// Original args.
|
|
119
132
|
const args = { ...input };
|
|
120
133
|
|
|
121
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
|
|
122
134
|
return Object.freeze({
|
|
123
135
|
accounts: [
|
|
124
136
|
getAccountMeta('nonceAccount', accounts.nonceAccount),
|
|
@@ -126,7 +138,11 @@ export function getAuthorizeNonceAccountInstruction<
|
|
|
126
138
|
],
|
|
127
139
|
data: getAuthorizeNonceAccountInstructionDataEncoder().encode(args as AuthorizeNonceAccountInstructionDataArgs),
|
|
128
140
|
programAddress,
|
|
129
|
-
} as AuthorizeNonceAccountInstruction<
|
|
141
|
+
} as AuthorizeNonceAccountInstruction<
|
|
142
|
+
TProgramAddress,
|
|
143
|
+
ResolvedInstructionAccountMeta<TAccountNonceAccount, InstructionAccountInputAddress<TAccountNonceAccount>>,
|
|
144
|
+
ResolvedInstructionAccountMeta<TAccountNonceAuthority, InstructionAccountInputAddress<TAccountNonceAuthority>>
|
|
145
|
+
>);
|
|
130
146
|
}
|
|
131
147
|
|
|
132
148
|
export type ParsedAuthorizeNonceAccountInstruction<
|
|
@@ -30,13 +30,15 @@ import {
|
|
|
30
30
|
type InstructionWithAccounts,
|
|
31
31
|
type InstructionWithData,
|
|
32
32
|
type ReadonlyUint8Array,
|
|
33
|
-
type TransactionSigner,
|
|
34
33
|
type WritableSignerAccount,
|
|
35
34
|
} from '@solana/kit';
|
|
36
35
|
import {
|
|
37
36
|
getAccountMetaFactory,
|
|
37
|
+
type InstructionAccountInputAddress,
|
|
38
|
+
type InstructionSignerInput,
|
|
38
39
|
type InstructionWithByteDelta,
|
|
39
40
|
type ResolvedInstructionAccount,
|
|
41
|
+
type ResolvedInstructionAccountMeta,
|
|
40
42
|
} from '@solana/kit/program-client-core';
|
|
41
43
|
import { SYSTEM_PROGRAM_ADDRESS } from '../programs';
|
|
42
44
|
|
|
@@ -106,29 +108,40 @@ export function getCreateAccountInstructionDataCodec(): FixedSizeCodec<
|
|
|
106
108
|
return combineCodec(getCreateAccountInstructionDataEncoder(), getCreateAccountInstructionDataDecoder());
|
|
107
109
|
}
|
|
108
110
|
|
|
109
|
-
export type CreateAccountInput<
|
|
110
|
-
|
|
111
|
-
|
|
111
|
+
export type CreateAccountInput<
|
|
112
|
+
TAccountPayer extends InstructionSignerInput = InstructionSignerInput,
|
|
113
|
+
TAccountNewAccount extends InstructionSignerInput = InstructionSignerInput,
|
|
114
|
+
> = {
|
|
115
|
+
payer: TAccountPayer;
|
|
116
|
+
newAccount: TAccountNewAccount;
|
|
112
117
|
lamports: CreateAccountInstructionDataArgs['lamports'];
|
|
113
118
|
space: CreateAccountInstructionDataArgs['space'];
|
|
114
119
|
programAddress: CreateAccountInstructionDataArgs['programAddress'];
|
|
115
120
|
};
|
|
116
121
|
|
|
117
122
|
export function getCreateAccountInstruction<
|
|
118
|
-
TAccountPayer extends
|
|
119
|
-
TAccountNewAccount extends
|
|
123
|
+
TAccountPayer extends InstructionSignerInput,
|
|
124
|
+
TAccountNewAccount extends InstructionSignerInput,
|
|
120
125
|
TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
|
|
121
126
|
>(
|
|
122
127
|
input: CreateAccountInput<TAccountPayer, TAccountNewAccount>,
|
|
123
128
|
config?: { programAddress?: TProgramAddress },
|
|
124
|
-
): CreateAccountInstruction<
|
|
129
|
+
): CreateAccountInstruction<
|
|
130
|
+
TProgramAddress,
|
|
131
|
+
ResolvedInstructionAccountMeta<TAccountPayer, InstructionAccountInputAddress<TAccountPayer>>,
|
|
132
|
+
ResolvedInstructionAccountMeta<TAccountNewAccount, InstructionAccountInputAddress<TAccountNewAccount>>
|
|
133
|
+
> &
|
|
134
|
+
InstructionWithByteDelta {
|
|
125
135
|
// Program address.
|
|
126
136
|
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
|
|
127
137
|
|
|
138
|
+
// Account meta helper.
|
|
139
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
|
|
140
|
+
|
|
128
141
|
// Original accounts.
|
|
129
142
|
const originalAccounts = {
|
|
130
|
-
payer: { value: input.payer ?? null, isWritable: true },
|
|
131
|
-
newAccount: { value: input.newAccount ?? null, isWritable: true },
|
|
143
|
+
payer: { value: input.payer ?? null, isSigner: true, isWritable: true },
|
|
144
|
+
newAccount: { value: input.newAccount ?? null, isSigner: true, isWritable: true },
|
|
132
145
|
};
|
|
133
146
|
const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedInstructionAccount>;
|
|
134
147
|
|
|
@@ -138,13 +151,17 @@ export function getCreateAccountInstruction<
|
|
|
138
151
|
// Bytes created or reallocated by the instruction.
|
|
139
152
|
const byteDelta: number = [Number(args.space) + BASE_ACCOUNT_SIZE].reduce((a, b) => a + b, 0);
|
|
140
153
|
|
|
141
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
|
|
142
154
|
return Object.freeze({
|
|
143
155
|
accounts: [getAccountMeta('payer', accounts.payer), getAccountMeta('newAccount', accounts.newAccount)],
|
|
144
156
|
byteDelta,
|
|
145
157
|
data: getCreateAccountInstructionDataEncoder().encode(args as CreateAccountInstructionDataArgs),
|
|
146
158
|
programAddress,
|
|
147
|
-
} as CreateAccountInstruction<
|
|
159
|
+
} as CreateAccountInstruction<
|
|
160
|
+
TProgramAddress,
|
|
161
|
+
ResolvedInstructionAccountMeta<TAccountPayer, InstructionAccountInputAddress<TAccountPayer>>,
|
|
162
|
+
ResolvedInstructionAccountMeta<TAccountNewAccount, InstructionAccountInputAddress<TAccountNewAccount>>
|
|
163
|
+
> &
|
|
164
|
+
InstructionWithByteDelta);
|
|
148
165
|
}
|
|
149
166
|
|
|
150
167
|
export type ParsedCreateAccountInstruction<
|
|
@@ -30,13 +30,15 @@ import {
|
|
|
30
30
|
type InstructionWithAccounts,
|
|
31
31
|
type InstructionWithData,
|
|
32
32
|
type ReadonlyUint8Array,
|
|
33
|
-
type TransactionSigner,
|
|
34
33
|
type WritableSignerAccount,
|
|
35
34
|
} from '@solana/kit';
|
|
36
35
|
import {
|
|
37
36
|
getAccountMetaFactory,
|
|
37
|
+
type InstructionAccountInputAddress,
|
|
38
|
+
type InstructionSignerInput,
|
|
38
39
|
type InstructionWithByteDelta,
|
|
39
40
|
type ResolvedInstructionAccount,
|
|
41
|
+
type ResolvedInstructionAccountMeta,
|
|
40
42
|
} from '@solana/kit/program-client-core';
|
|
41
43
|
import { SYSTEM_PROGRAM_ADDRESS } from '../programs';
|
|
42
44
|
|
|
@@ -118,31 +120,39 @@ export function getCreateAccountAllowPrefundInstructionDataCodec(): FixedSizeCod
|
|
|
118
120
|
}
|
|
119
121
|
|
|
120
122
|
export type CreateAccountAllowPrefundInput<
|
|
121
|
-
TAccountNewAccount extends
|
|
122
|
-
TAccountPayer extends
|
|
123
|
+
TAccountNewAccount extends InstructionSignerInput = InstructionSignerInput,
|
|
124
|
+
TAccountPayer extends InstructionSignerInput = InstructionSignerInput,
|
|
123
125
|
> = {
|
|
124
|
-
newAccount:
|
|
125
|
-
payer?:
|
|
126
|
+
newAccount: TAccountNewAccount;
|
|
127
|
+
payer?: TAccountPayer;
|
|
126
128
|
lamports?: CreateAccountAllowPrefundInstructionDataArgs['lamports'];
|
|
127
129
|
space: CreateAccountAllowPrefundInstructionDataArgs['space'];
|
|
128
130
|
programAddress: CreateAccountAllowPrefundInstructionDataArgs['programAddress'];
|
|
129
131
|
};
|
|
130
132
|
|
|
131
133
|
export function getCreateAccountAllowPrefundInstruction<
|
|
132
|
-
TAccountNewAccount extends
|
|
133
|
-
TAccountPayer extends
|
|
134
|
+
TAccountNewAccount extends InstructionSignerInput,
|
|
135
|
+
TAccountPayer extends InstructionSignerInput,
|
|
134
136
|
TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
|
|
135
137
|
>(
|
|
136
138
|
input: CreateAccountAllowPrefundInput<TAccountNewAccount, TAccountPayer>,
|
|
137
139
|
config?: { programAddress?: TProgramAddress },
|
|
138
|
-
): CreateAccountAllowPrefundInstruction<
|
|
140
|
+
): CreateAccountAllowPrefundInstruction<
|
|
141
|
+
TProgramAddress,
|
|
142
|
+
ResolvedInstructionAccountMeta<TAccountNewAccount, InstructionAccountInputAddress<TAccountNewAccount>>,
|
|
143
|
+
ResolvedInstructionAccountMeta<TAccountPayer, InstructionAccountInputAddress<TAccountPayer>>
|
|
144
|
+
> &
|
|
145
|
+
InstructionWithByteDelta {
|
|
139
146
|
// Program address.
|
|
140
147
|
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
|
|
141
148
|
|
|
149
|
+
// Account meta helper.
|
|
150
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
|
|
151
|
+
|
|
142
152
|
// Original accounts.
|
|
143
153
|
const originalAccounts = {
|
|
144
|
-
newAccount: { value: input.newAccount ?? null, isWritable: true },
|
|
145
|
-
payer: { value: input.payer ?? null, isWritable: true },
|
|
154
|
+
newAccount: { value: input.newAccount ?? null, isSigner: true, isWritable: true },
|
|
155
|
+
payer: { value: input.payer ?? null, isSigner: true, isWritable: true },
|
|
146
156
|
};
|
|
147
157
|
const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedInstructionAccount>;
|
|
148
158
|
|
|
@@ -152,7 +162,6 @@ export function getCreateAccountAllowPrefundInstruction<
|
|
|
152
162
|
// Bytes created or reallocated by the instruction.
|
|
153
163
|
const byteDelta: number = [Number(args.space) + BASE_ACCOUNT_SIZE].reduce((a, b) => a + b, 0);
|
|
154
164
|
|
|
155
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
|
|
156
165
|
return Object.freeze({
|
|
157
166
|
accounts: [getAccountMeta('newAccount', accounts.newAccount), getAccountMeta('payer', accounts.payer)].filter(
|
|
158
167
|
<T>(x: T | undefined): x is T => x !== undefined,
|
|
@@ -162,7 +171,11 @@ export function getCreateAccountAllowPrefundInstruction<
|
|
|
162
171
|
args as CreateAccountAllowPrefundInstructionDataArgs,
|
|
163
172
|
),
|
|
164
173
|
programAddress,
|
|
165
|
-
} as CreateAccountAllowPrefundInstruction<
|
|
174
|
+
} as CreateAccountAllowPrefundInstruction<
|
|
175
|
+
TProgramAddress,
|
|
176
|
+
ResolvedInstructionAccountMeta<TAccountNewAccount, InstructionAccountInputAddress<TAccountNewAccount>>,
|
|
177
|
+
ResolvedInstructionAccountMeta<TAccountPayer, InstructionAccountInputAddress<TAccountPayer>>
|
|
178
|
+
> &
|
|
166
179
|
InstructionWithByteDelta);
|
|
167
180
|
}
|
|
168
181
|
|
|
@@ -34,11 +34,17 @@ import {
|
|
|
34
34
|
type InstructionWithData,
|
|
35
35
|
type ReadonlySignerAccount,
|
|
36
36
|
type ReadonlyUint8Array,
|
|
37
|
-
type TransactionSigner,
|
|
38
37
|
type WritableAccount,
|
|
39
38
|
type WritableSignerAccount,
|
|
40
39
|
} from '@solana/kit';
|
|
41
|
-
import {
|
|
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';
|
|
42
48
|
import { SYSTEM_PROGRAM_ADDRESS } from '../programs';
|
|
43
49
|
|
|
44
50
|
export const CREATE_ACCOUNT_WITH_SEED_DISCRIMINATOR = 3;
|
|
@@ -125,13 +131,13 @@ export function getCreateAccountWithSeedInstructionDataCodec(): Codec<
|
|
|
125
131
|
}
|
|
126
132
|
|
|
127
133
|
export type CreateAccountWithSeedInput<
|
|
128
|
-
TAccountPayer extends
|
|
129
|
-
TAccountNewAccount extends
|
|
130
|
-
TAccountBaseAccount extends
|
|
134
|
+
TAccountPayer extends InstructionSignerInput = InstructionSignerInput,
|
|
135
|
+
TAccountNewAccount extends InstructionAccountInput = InstructionAccountInput,
|
|
136
|
+
TAccountBaseAccount extends InstructionSignerInput = InstructionSignerInput,
|
|
131
137
|
> = {
|
|
132
|
-
payer:
|
|
133
|
-
newAccount:
|
|
134
|
-
baseAccount?:
|
|
138
|
+
payer: TAccountPayer;
|
|
139
|
+
newAccount: TAccountNewAccount;
|
|
140
|
+
baseAccount?: TAccountBaseAccount;
|
|
135
141
|
base: CreateAccountWithSeedInstructionDataArgs['base'];
|
|
136
142
|
seed: CreateAccountWithSeedInstructionDataArgs['seed'];
|
|
137
143
|
amount: CreateAccountWithSeedInstructionDataArgs['amount'];
|
|
@@ -140,29 +146,36 @@ export type CreateAccountWithSeedInput<
|
|
|
140
146
|
};
|
|
141
147
|
|
|
142
148
|
export function getCreateAccountWithSeedInstruction<
|
|
143
|
-
TAccountPayer extends
|
|
144
|
-
TAccountNewAccount extends
|
|
145
|
-
TAccountBaseAccount extends
|
|
149
|
+
TAccountPayer extends InstructionSignerInput,
|
|
150
|
+
TAccountNewAccount extends InstructionAccountInput,
|
|
151
|
+
TAccountBaseAccount extends InstructionSignerInput,
|
|
146
152
|
TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
|
|
147
153
|
>(
|
|
148
154
|
input: CreateAccountWithSeedInput<TAccountPayer, TAccountNewAccount, TAccountBaseAccount>,
|
|
149
155
|
config?: { programAddress?: TProgramAddress },
|
|
150
|
-
): CreateAccountWithSeedInstruction<
|
|
156
|
+
): CreateAccountWithSeedInstruction<
|
|
157
|
+
TProgramAddress,
|
|
158
|
+
ResolvedInstructionAccountMeta<TAccountPayer, InstructionAccountInputAddress<TAccountPayer>>,
|
|
159
|
+
ResolvedInstructionAccountMeta<TAccountNewAccount, InstructionAccountInputAddress<TAccountNewAccount>>,
|
|
160
|
+
ResolvedInstructionAccountMeta<TAccountBaseAccount, InstructionAccountInputAddress<TAccountBaseAccount>>
|
|
161
|
+
> {
|
|
151
162
|
// Program address.
|
|
152
163
|
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
|
|
153
164
|
|
|
165
|
+
// Account meta helper.
|
|
166
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
|
|
167
|
+
|
|
154
168
|
// Original accounts.
|
|
155
169
|
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 },
|
|
170
|
+
payer: { value: input.payer ?? null, isSigner: true, isWritable: true },
|
|
171
|
+
newAccount: { value: input.newAccount ?? null, isSigner: false, isWritable: true },
|
|
172
|
+
baseAccount: { value: input.baseAccount ?? null, isSigner: true, isWritable: false },
|
|
159
173
|
};
|
|
160
174
|
const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedInstructionAccount>;
|
|
161
175
|
|
|
162
176
|
// Original args.
|
|
163
177
|
const args = { ...input };
|
|
164
178
|
|
|
165
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
|
|
166
179
|
return Object.freeze({
|
|
167
180
|
accounts: [
|
|
168
181
|
getAccountMeta('payer', accounts.payer),
|
|
@@ -171,7 +184,12 @@ export function getCreateAccountWithSeedInstruction<
|
|
|
171
184
|
].filter(<T>(x: T | undefined): x is T => x !== undefined),
|
|
172
185
|
data: getCreateAccountWithSeedInstructionDataEncoder().encode(args as CreateAccountWithSeedInstructionDataArgs),
|
|
173
186
|
programAddress,
|
|
174
|
-
} as CreateAccountWithSeedInstruction<
|
|
187
|
+
} as CreateAccountWithSeedInstruction<
|
|
188
|
+
TProgramAddress,
|
|
189
|
+
ResolvedInstructionAccountMeta<TAccountPayer, InstructionAccountInputAddress<TAccountPayer>>,
|
|
190
|
+
ResolvedInstructionAccountMeta<TAccountNewAccount, InstructionAccountInputAddress<TAccountNewAccount>>,
|
|
191
|
+
ResolvedInstructionAccountMeta<TAccountBaseAccount, InstructionAccountInputAddress<TAccountBaseAccount>>
|
|
192
|
+
>);
|
|
175
193
|
}
|
|
176
194
|
|
|
177
195
|
export type ParsedCreateAccountWithSeedInstruction<
|
|
@@ -29,7 +29,13 @@ import {
|
|
|
29
29
|
type ReadonlyUint8Array,
|
|
30
30
|
type WritableAccount,
|
|
31
31
|
} from '@solana/kit';
|
|
32
|
-
import {
|
|
32
|
+
import {
|
|
33
|
+
getAccountMetaFactory,
|
|
34
|
+
type InstructionAccountInput,
|
|
35
|
+
type InstructionAccountInputAddress,
|
|
36
|
+
type ResolvedInstructionAccount,
|
|
37
|
+
type ResolvedInstructionAccountMeta,
|
|
38
|
+
} from '@solana/kit/program-client-core';
|
|
33
39
|
import { SYSTEM_PROGRAM_ADDRESS } from '../programs';
|
|
34
40
|
|
|
35
41
|
export const INITIALIZE_NONCE_ACCOUNT_DISCRIMINATOR = 6;
|
|
@@ -90,38 +96,44 @@ export function getInitializeNonceAccountInstructionDataCodec(): FixedSizeCodec<
|
|
|
90
96
|
}
|
|
91
97
|
|
|
92
98
|
export type InitializeNonceAccountInput<
|
|
93
|
-
TAccountNonceAccount extends
|
|
94
|
-
TAccountRecentBlockhashesSysvar extends
|
|
95
|
-
TAccountRentSysvar extends
|
|
99
|
+
TAccountNonceAccount extends InstructionAccountInput = InstructionAccountInput,
|
|
100
|
+
TAccountRecentBlockhashesSysvar extends InstructionAccountInput = InstructionAccountInput,
|
|
101
|
+
TAccountRentSysvar extends InstructionAccountInput = InstructionAccountInput,
|
|
96
102
|
> = {
|
|
97
|
-
nonceAccount:
|
|
98
|
-
recentBlockhashesSysvar?:
|
|
99
|
-
rentSysvar?:
|
|
103
|
+
nonceAccount: TAccountNonceAccount;
|
|
104
|
+
recentBlockhashesSysvar?: TAccountRecentBlockhashesSysvar;
|
|
105
|
+
rentSysvar?: TAccountRentSysvar;
|
|
100
106
|
nonceAuthority: InitializeNonceAccountInstructionDataArgs['nonceAuthority'];
|
|
101
107
|
};
|
|
102
108
|
|
|
103
109
|
export function getInitializeNonceAccountInstruction<
|
|
104
|
-
TAccountNonceAccount extends
|
|
105
|
-
TAccountRecentBlockhashesSysvar extends
|
|
106
|
-
TAccountRentSysvar extends
|
|
110
|
+
TAccountNonceAccount extends InstructionAccountInput,
|
|
111
|
+
TAccountRecentBlockhashesSysvar extends InstructionAccountInput,
|
|
112
|
+
TAccountRentSysvar extends InstructionAccountInput,
|
|
107
113
|
TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
|
|
108
114
|
>(
|
|
109
115
|
input: InitializeNonceAccountInput<TAccountNonceAccount, TAccountRecentBlockhashesSysvar, TAccountRentSysvar>,
|
|
110
116
|
config?: { programAddress?: TProgramAddress },
|
|
111
117
|
): InitializeNonceAccountInstruction<
|
|
112
118
|
TProgramAddress,
|
|
113
|
-
TAccountNonceAccount,
|
|
114
|
-
|
|
115
|
-
|
|
119
|
+
ResolvedInstructionAccountMeta<TAccountNonceAccount, InstructionAccountInputAddress<TAccountNonceAccount>>,
|
|
120
|
+
ResolvedInstructionAccountMeta<
|
|
121
|
+
TAccountRecentBlockhashesSysvar,
|
|
122
|
+
InstructionAccountInputAddress<TAccountRecentBlockhashesSysvar>
|
|
123
|
+
>,
|
|
124
|
+
ResolvedInstructionAccountMeta<TAccountRentSysvar, InstructionAccountInputAddress<TAccountRentSysvar>>
|
|
116
125
|
> {
|
|
117
126
|
// Program address.
|
|
118
127
|
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
|
|
119
128
|
|
|
129
|
+
// Account meta helper.
|
|
130
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
|
|
131
|
+
|
|
120
132
|
// Original accounts.
|
|
121
133
|
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 },
|
|
134
|
+
nonceAccount: { value: input.nonceAccount ?? null, isSigner: false, isWritable: true },
|
|
135
|
+
recentBlockhashesSysvar: { value: input.recentBlockhashesSysvar ?? null, isSigner: false, isWritable: false },
|
|
136
|
+
rentSysvar: { value: input.rentSysvar ?? null, isSigner: false, isWritable: false },
|
|
125
137
|
};
|
|
126
138
|
const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedInstructionAccount>;
|
|
127
139
|
|
|
@@ -138,7 +150,6 @@ export function getInitializeNonceAccountInstruction<
|
|
|
138
150
|
'SysvarRent111111111111111111111111111111111' as Address<'SysvarRent111111111111111111111111111111111'>;
|
|
139
151
|
}
|
|
140
152
|
|
|
141
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
|
|
142
153
|
return Object.freeze({
|
|
143
154
|
accounts: [
|
|
144
155
|
getAccountMeta('nonceAccount', accounts.nonceAccount),
|
|
@@ -151,9 +162,12 @@ export function getInitializeNonceAccountInstruction<
|
|
|
151
162
|
programAddress,
|
|
152
163
|
} as InitializeNonceAccountInstruction<
|
|
153
164
|
TProgramAddress,
|
|
154
|
-
TAccountNonceAccount,
|
|
155
|
-
|
|
156
|
-
|
|
165
|
+
ResolvedInstructionAccountMeta<TAccountNonceAccount, InstructionAccountInputAddress<TAccountNonceAccount>>,
|
|
166
|
+
ResolvedInstructionAccountMeta<
|
|
167
|
+
TAccountRecentBlockhashesSysvar,
|
|
168
|
+
InstructionAccountInputAddress<TAccountRecentBlockhashesSysvar>
|
|
169
|
+
>,
|
|
170
|
+
ResolvedInstructionAccountMeta<TAccountRentSysvar, InstructionAccountInputAddress<TAccountRentSysvar>>
|
|
157
171
|
>);
|
|
158
172
|
}
|
|
159
173
|
|
|
@@ -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 {
|
|
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,52 @@ export function getTransferSolInstructionDataCodec(): FixedSizeCodec<
|
|
|
85
91
|
return combineCodec(getTransferSolInstructionDataEncoder(), getTransferSolInstructionDataDecoder());
|
|
86
92
|
}
|
|
87
93
|
|
|
88
|
-
export type TransferSolInput<
|
|
89
|
-
|
|
90
|
-
|
|
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
|
|
96
|
-
TAccountDestination extends
|
|
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
109
|
config?: { programAddress?: TProgramAddress },
|
|
101
|
-
): TransferSolInstruction<
|
|
110
|
+
): TransferSolInstruction<
|
|
111
|
+
TProgramAddress,
|
|
112
|
+
ResolvedInstructionAccountMeta<TAccountSource, InstructionAccountInputAddress<TAccountSource>>,
|
|
113
|
+
ResolvedInstructionAccountMeta<TAccountDestination, InstructionAccountInputAddress<TAccountDestination>>
|
|
114
|
+
> {
|
|
102
115
|
// Program address.
|
|
103
116
|
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
|
|
104
117
|
|
|
118
|
+
// Account meta helper.
|
|
119
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
|
|
120
|
+
|
|
105
121
|
// Original accounts.
|
|
106
122
|
const originalAccounts = {
|
|
107
|
-
source: { value: input.source ?? null, isWritable: true },
|
|
108
|
-
destination: { value: input.destination ?? null, isWritable: true },
|
|
123
|
+
source: { value: input.source ?? null, isSigner: true, isWritable: true },
|
|
124
|
+
destination: { value: input.destination ?? null, isSigner: false, isWritable: true },
|
|
109
125
|
};
|
|
110
126
|
const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedInstructionAccount>;
|
|
111
127
|
|
|
112
128
|
// Original args.
|
|
113
129
|
const args = { ...input };
|
|
114
130
|
|
|
115
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
|
|
116
131
|
return Object.freeze({
|
|
117
132
|
accounts: [getAccountMeta('source', accounts.source), getAccountMeta('destination', accounts.destination)],
|
|
118
133
|
data: getTransferSolInstructionDataEncoder().encode(args as TransferSolInstructionDataArgs),
|
|
119
134
|
programAddress,
|
|
120
|
-
} as TransferSolInstruction<
|
|
135
|
+
} as TransferSolInstruction<
|
|
136
|
+
TProgramAddress,
|
|
137
|
+
ResolvedInstructionAccountMeta<TAccountSource, InstructionAccountInputAddress<TAccountSource>>,
|
|
138
|
+
ResolvedInstructionAccountMeta<TAccountDestination, InstructionAccountInputAddress<TAccountDestination>>
|
|
139
|
+
>);
|
|
121
140
|
}
|
|
122
141
|
|
|
123
142
|
export type ParsedTransferSolInstruction<
|
|
@@ -34,10 +34,16 @@ import {
|
|
|
34
34
|
type InstructionWithData,
|
|
35
35
|
type ReadonlySignerAccount,
|
|
36
36
|
type ReadonlyUint8Array,
|
|
37
|
-
type TransactionSigner,
|
|
38
37
|
type WritableAccount,
|
|
39
38
|
} from '@solana/kit';
|
|
40
|
-
import {
|
|
39
|
+
import {
|
|
40
|
+
getAccountMetaFactory,
|
|
41
|
+
type InstructionAccountInput,
|
|
42
|
+
type InstructionAccountInputAddress,
|
|
43
|
+
type InstructionSignerInput,
|
|
44
|
+
type ResolvedInstructionAccount,
|
|
45
|
+
type ResolvedInstructionAccountMeta,
|
|
46
|
+
} from '@solana/kit/program-client-core';
|
|
41
47
|
import { SYSTEM_PROGRAM_ADDRESS } from '../programs';
|
|
42
48
|
|
|
43
49
|
export const TRANSFER_SOL_WITH_SEED_DISCRIMINATOR = 11;
|
|
@@ -103,42 +109,49 @@ export function getTransferSolWithSeedInstructionDataCodec(): Codec<
|
|
|
103
109
|
}
|
|
104
110
|
|
|
105
111
|
export type TransferSolWithSeedInput<
|
|
106
|
-
TAccountSource extends
|
|
107
|
-
TAccountBaseAccount extends
|
|
108
|
-
TAccountDestination extends
|
|
112
|
+
TAccountSource extends InstructionAccountInput = InstructionAccountInput,
|
|
113
|
+
TAccountBaseAccount extends InstructionSignerInput = InstructionSignerInput,
|
|
114
|
+
TAccountDestination extends InstructionAccountInput = InstructionAccountInput,
|
|
109
115
|
> = {
|
|
110
|
-
source:
|
|
111
|
-
baseAccount:
|
|
112
|
-
destination:
|
|
116
|
+
source: TAccountSource;
|
|
117
|
+
baseAccount: TAccountBaseAccount;
|
|
118
|
+
destination: TAccountDestination;
|
|
113
119
|
amount: TransferSolWithSeedInstructionDataArgs['amount'];
|
|
114
120
|
fromSeed: TransferSolWithSeedInstructionDataArgs['fromSeed'];
|
|
115
121
|
fromOwner: TransferSolWithSeedInstructionDataArgs['fromOwner'];
|
|
116
122
|
};
|
|
117
123
|
|
|
118
124
|
export function getTransferSolWithSeedInstruction<
|
|
119
|
-
TAccountSource extends
|
|
120
|
-
TAccountBaseAccount extends
|
|
121
|
-
TAccountDestination extends
|
|
125
|
+
TAccountSource extends InstructionAccountInput,
|
|
126
|
+
TAccountBaseAccount extends InstructionSignerInput,
|
|
127
|
+
TAccountDestination extends InstructionAccountInput,
|
|
122
128
|
TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
|
|
123
129
|
>(
|
|
124
130
|
input: TransferSolWithSeedInput<TAccountSource, TAccountBaseAccount, TAccountDestination>,
|
|
125
131
|
config?: { programAddress?: TProgramAddress },
|
|
126
|
-
): TransferSolWithSeedInstruction<
|
|
132
|
+
): TransferSolWithSeedInstruction<
|
|
133
|
+
TProgramAddress,
|
|
134
|
+
ResolvedInstructionAccountMeta<TAccountSource, InstructionAccountInputAddress<TAccountSource>>,
|
|
135
|
+
ResolvedInstructionAccountMeta<TAccountBaseAccount, InstructionAccountInputAddress<TAccountBaseAccount>>,
|
|
136
|
+
ResolvedInstructionAccountMeta<TAccountDestination, InstructionAccountInputAddress<TAccountDestination>>
|
|
137
|
+
> {
|
|
127
138
|
// Program address.
|
|
128
139
|
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
|
|
129
140
|
|
|
141
|
+
// Account meta helper.
|
|
142
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
|
|
143
|
+
|
|
130
144
|
// Original accounts.
|
|
131
145
|
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 },
|
|
146
|
+
source: { value: input.source ?? null, isSigner: false, isWritable: true },
|
|
147
|
+
baseAccount: { value: input.baseAccount ?? null, isSigner: true, isWritable: false },
|
|
148
|
+
destination: { value: input.destination ?? null, isSigner: false, isWritable: true },
|
|
135
149
|
};
|
|
136
150
|
const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedInstructionAccount>;
|
|
137
151
|
|
|
138
152
|
// Original args.
|
|
139
153
|
const args = { ...input };
|
|
140
154
|
|
|
141
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
|
|
142
155
|
return Object.freeze({
|
|
143
156
|
accounts: [
|
|
144
157
|
getAccountMeta('source', accounts.source),
|
|
@@ -147,7 +160,12 @@ export function getTransferSolWithSeedInstruction<
|
|
|
147
160
|
],
|
|
148
161
|
data: getTransferSolWithSeedInstructionDataEncoder().encode(args as TransferSolWithSeedInstructionDataArgs),
|
|
149
162
|
programAddress,
|
|
150
|
-
} as TransferSolWithSeedInstruction<
|
|
163
|
+
} as TransferSolWithSeedInstruction<
|
|
164
|
+
TProgramAddress,
|
|
165
|
+
ResolvedInstructionAccountMeta<TAccountSource, InstructionAccountInputAddress<TAccountSource>>,
|
|
166
|
+
ResolvedInstructionAccountMeta<TAccountBaseAccount, InstructionAccountInputAddress<TAccountBaseAccount>>,
|
|
167
|
+
ResolvedInstructionAccountMeta<TAccountDestination, InstructionAccountInputAddress<TAccountDestination>>
|
|
168
|
+
>);
|
|
151
169
|
}
|
|
152
170
|
|
|
153
171
|
export type ParsedTransferSolWithSeedInstruction<
|