Skip to content

Commit aea6e05

Browse files
committed
chore: Remove Sol for consistency with the actual system program
1 parent acd102a commit aea6e05

10 files changed

Lines changed: 171 additions & 178 deletions

File tree

clients/js/src/generated/instructions/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export * from './authorizeNonceAccount';
1515
export * from './createAccount';
1616
export * from './createAccountWithSeed';
1717
export * from './initializeNonceAccount';
18-
export * from './transferSol';
19-
export * from './transferSolWithSeed';
18+
export * from './transfer';
19+
export * from './transferWithSeed';
2020
export * from './upgradeNonceAccount';
2121
export * from './withdrawNonceAccount';

clients/js/src/generated/instructions/transferSol.ts renamed to clients/js/src/generated/instructions/transfer.ts

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ import {
3434
import { getAccountMetaFactory, type ResolvedInstructionAccount } from '@solana/kit/program-client-core';
3535
import { SYSTEM_PROGRAM_ADDRESS } from '../programs';
3636

37-
export const TRANSFER_SOL_DISCRIMINATOR = 2;
37+
export const TRANSFER_DISCRIMINATOR = 2;
3838

39-
export function getTransferSolDiscriminatorBytes(): ReadonlyUint8Array {
40-
return getU32Encoder().encode(TRANSFER_SOL_DISCRIMINATOR);
39+
export function getTransferDiscriminatorBytes(): ReadonlyUint8Array {
40+
return getU32Encoder().encode(TRANSFER_DISCRIMINATOR);
4141
}
4242

43-
export type TransferSolInstruction<
43+
export type TransferInstruction<
4444
TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS,
4545
TAccountSource extends string | AccountMeta<string> = string,
4646
TAccountDestination extends string | AccountMeta<string> = string,
@@ -57,48 +57,48 @@ export type TransferSolInstruction<
5757
]
5858
>;
5959

60-
export type TransferSolInstructionData = { discriminator: number; amount: bigint };
60+
export type TransferInstructionData = { discriminator: number; amount: bigint };
6161

62-
export type TransferSolInstructionDataArgs = { amount: number | bigint };
62+
export type TransferInstructionDataArgs = { amount: number | bigint };
6363

64-
export function getTransferSolInstructionDataEncoder(): FixedSizeEncoder<TransferSolInstructionDataArgs> {
64+
export function getTransferInstructionDataEncoder(): FixedSizeEncoder<TransferInstructionDataArgs> {
6565
return transformEncoder(
6666
getStructEncoder([
6767
['discriminator', getU32Encoder()],
6868
['amount', getU64Encoder()],
6969
]),
70-
value => ({ ...value, discriminator: TRANSFER_SOL_DISCRIMINATOR }),
70+
value => ({ ...value, discriminator: TRANSFER_DISCRIMINATOR }),
7171
);
7272
}
7373

74-
export function getTransferSolInstructionDataDecoder(): FixedSizeDecoder<TransferSolInstructionData> {
74+
export function getTransferInstructionDataDecoder(): FixedSizeDecoder<TransferInstructionData> {
7575
return getStructDecoder([
7676
['discriminator', getU32Decoder()],
7777
['amount', getU64Decoder()],
7878
]);
7979
}
8080

81-
export function getTransferSolInstructionDataCodec(): FixedSizeCodec<
82-
TransferSolInstructionDataArgs,
83-
TransferSolInstructionData
81+
export function getTransferInstructionDataCodec(): FixedSizeCodec<
82+
TransferInstructionDataArgs,
83+
TransferInstructionData
8484
> {
85-
return combineCodec(getTransferSolInstructionDataEncoder(), getTransferSolInstructionDataDecoder());
85+
return combineCodec(getTransferInstructionDataEncoder(), getTransferInstructionDataDecoder());
8686
}
8787

88-
export type TransferSolInput<TAccountSource extends string = string, TAccountDestination extends string = string> = {
88+
export type TransferInput<TAccountSource extends string = string, TAccountDestination extends string = string> = {
8989
source: TransactionSigner<TAccountSource>;
9090
destination: Address<TAccountDestination>;
91-
amount: TransferSolInstructionDataArgs['amount'];
91+
amount: TransferInstructionDataArgs['amount'];
9292
};
9393

94-
export function getTransferSolInstruction<
94+
export function getTransferInstruction<
9595
TAccountSource extends string,
9696
TAccountDestination extends string,
9797
TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
9898
>(
99-
input: TransferSolInput<TAccountSource, TAccountDestination>,
99+
input: TransferInput<TAccountSource, TAccountDestination>,
100100
config?: { programAddress?: TProgramAddress },
101-
): TransferSolInstruction<TProgramAddress, TAccountSource, TAccountDestination> {
101+
): TransferInstruction<TProgramAddress, TAccountSource, TAccountDestination> {
102102
// Program address.
103103
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
104104

@@ -115,12 +115,12 @@ export function getTransferSolInstruction<
115115
const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
116116
return Object.freeze({
117117
accounts: [getAccountMeta('source', accounts.source), getAccountMeta('destination', accounts.destination)],
118-
data: getTransferSolInstructionDataEncoder().encode(args as TransferSolInstructionDataArgs),
118+
data: getTransferInstructionDataEncoder().encode(args as TransferInstructionDataArgs),
119119
programAddress,
120-
} as TransferSolInstruction<TProgramAddress, TAccountSource, TAccountDestination>);
120+
} as TransferInstruction<TProgramAddress, TAccountSource, TAccountDestination>);
121121
}
122122

123-
export type ParsedTransferSolInstruction<
123+
export type ParsedTransferInstruction<
124124
TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS,
125125
TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],
126126
> = {
@@ -129,14 +129,14 @@ export type ParsedTransferSolInstruction<
129129
source: TAccountMetas[0];
130130
destination: TAccountMetas[1];
131131
};
132-
data: TransferSolInstructionData;
132+
data: TransferInstructionData;
133133
};
134134

135-
export function parseTransferSolInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(
135+
export function parseTransferInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(
136136
instruction: Instruction<TProgram> &
137137
InstructionWithAccounts<TAccountMetas> &
138138
InstructionWithData<ReadonlyUint8Array>,
139-
): ParsedTransferSolInstruction<TProgram, TAccountMetas> {
139+
): ParsedTransferInstruction<TProgram, TAccountMetas> {
140140
if (instruction.accounts.length < 2) {
141141
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
142142
actualAccountMetas: instruction.accounts.length,
@@ -152,6 +152,6 @@ export function parseTransferSolInstruction<TProgram extends string, TAccountMet
152152
return {
153153
programAddress: instruction.programAddress,
154154
accounts: { source: getNextAccount(), destination: getNextAccount() },
155-
data: getTransferSolInstructionDataDecoder().decode(instruction.data),
155+
data: getTransferInstructionDataDecoder().decode(instruction.data),
156156
};
157157
}

clients/js/src/generated/instructions/transferSolWithSeed.ts renamed to clients/js/src/generated/instructions/transferWithSeed.ts

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ import {
4040
import { getAccountMetaFactory, type ResolvedInstructionAccount } from '@solana/kit/program-client-core';
4141
import { SYSTEM_PROGRAM_ADDRESS } from '../programs';
4242

43-
export const TRANSFER_SOL_WITH_SEED_DISCRIMINATOR = 11;
43+
export const TRANSFER_WITH_SEED_DISCRIMINATOR = 11;
4444

45-
export function getTransferSolWithSeedDiscriminatorBytes(): ReadonlyUint8Array {
46-
return getU32Encoder().encode(TRANSFER_SOL_WITH_SEED_DISCRIMINATOR);
45+
export function getTransferWithSeedDiscriminatorBytes(): ReadonlyUint8Array {
46+
return getU32Encoder().encode(TRANSFER_WITH_SEED_DISCRIMINATOR);
4747
}
4848

49-
export type TransferSolWithSeedInstruction<
49+
export type TransferWithSeedInstruction<
5050
TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS,
5151
TAccountSource extends string | AccountMeta<string> = string,
5252
TAccountBaseAccount extends string | AccountMeta<string> = string,
@@ -65,28 +65,28 @@ export type TransferSolWithSeedInstruction<
6565
]
6666
>;
6767

68-
export type TransferSolWithSeedInstructionData = {
68+
export type TransferWithSeedInstructionData = {
6969
discriminator: number;
7070
amount: bigint;
7171
fromSeed: string;
7272
fromOwner: Address;
7373
};
7474

75-
export type TransferSolWithSeedInstructionDataArgs = { amount: number | bigint; fromSeed: string; fromOwner: Address };
75+
export type TransferWithSeedInstructionDataArgs = { amount: number | bigint; fromSeed: string; fromOwner: Address };
7676

77-
export function getTransferSolWithSeedInstructionDataEncoder(): Encoder<TransferSolWithSeedInstructionDataArgs> {
77+
export function getTransferWithSeedInstructionDataEncoder(): Encoder<TransferWithSeedInstructionDataArgs> {
7878
return transformEncoder(
7979
getStructEncoder([
8080
['discriminator', getU32Encoder()],
8181
['amount', getU64Encoder()],
8282
['fromSeed', addEncoderSizePrefix(getUtf8Encoder(), getU64Encoder())],
8383
['fromOwner', getAddressEncoder()],
8484
]),
85-
value => ({ ...value, discriminator: TRANSFER_SOL_WITH_SEED_DISCRIMINATOR }),
85+
value => ({ ...value, discriminator: TRANSFER_WITH_SEED_DISCRIMINATOR }),
8686
);
8787
}
8888

89-
export function getTransferSolWithSeedInstructionDataDecoder(): Decoder<TransferSolWithSeedInstructionData> {
89+
export function getTransferWithSeedInstructionDataDecoder(): Decoder<TransferWithSeedInstructionData> {
9090
return getStructDecoder([
9191
['discriminator', getU32Decoder()],
9292
['amount', getU64Decoder()],
@@ -95,35 +95,35 @@ export function getTransferSolWithSeedInstructionDataDecoder(): Decoder<Transfer
9595
]);
9696
}
9797

98-
export function getTransferSolWithSeedInstructionDataCodec(): Codec<
99-
TransferSolWithSeedInstructionDataArgs,
100-
TransferSolWithSeedInstructionData
98+
export function getTransferWithSeedInstructionDataCodec(): Codec<
99+
TransferWithSeedInstructionDataArgs,
100+
TransferWithSeedInstructionData
101101
> {
102-
return combineCodec(getTransferSolWithSeedInstructionDataEncoder(), getTransferSolWithSeedInstructionDataDecoder());
102+
return combineCodec(getTransferWithSeedInstructionDataEncoder(), getTransferWithSeedInstructionDataDecoder());
103103
}
104104

105-
export type TransferSolWithSeedInput<
105+
export type TransferWithSeedInput<
106106
TAccountSource extends string = string,
107107
TAccountBaseAccount extends string = string,
108108
TAccountDestination extends string = string,
109109
> = {
110110
source: Address<TAccountSource>;
111111
baseAccount: TransactionSigner<TAccountBaseAccount>;
112112
destination: Address<TAccountDestination>;
113-
amount: TransferSolWithSeedInstructionDataArgs['amount'];
114-
fromSeed: TransferSolWithSeedInstructionDataArgs['fromSeed'];
115-
fromOwner: TransferSolWithSeedInstructionDataArgs['fromOwner'];
113+
amount: TransferWithSeedInstructionDataArgs['amount'];
114+
fromSeed: TransferWithSeedInstructionDataArgs['fromSeed'];
115+
fromOwner: TransferWithSeedInstructionDataArgs['fromOwner'];
116116
};
117117

118-
export function getTransferSolWithSeedInstruction<
118+
export function getTransferWithSeedInstruction<
119119
TAccountSource extends string,
120120
TAccountBaseAccount extends string,
121121
TAccountDestination extends string,
122122
TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
123123
>(
124-
input: TransferSolWithSeedInput<TAccountSource, TAccountBaseAccount, TAccountDestination>,
124+
input: TransferWithSeedInput<TAccountSource, TAccountBaseAccount, TAccountDestination>,
125125
config?: { programAddress?: TProgramAddress },
126-
): TransferSolWithSeedInstruction<TProgramAddress, TAccountSource, TAccountBaseAccount, TAccountDestination> {
126+
): TransferWithSeedInstruction<TProgramAddress, TAccountSource, TAccountBaseAccount, TAccountDestination> {
127127
// Program address.
128128
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
129129

@@ -145,12 +145,12 @@ export function getTransferSolWithSeedInstruction<
145145
getAccountMeta('baseAccount', accounts.baseAccount),
146146
getAccountMeta('destination', accounts.destination),
147147
],
148-
data: getTransferSolWithSeedInstructionDataEncoder().encode(args as TransferSolWithSeedInstructionDataArgs),
148+
data: getTransferWithSeedInstructionDataEncoder().encode(args as TransferWithSeedInstructionDataArgs),
149149
programAddress,
150-
} as TransferSolWithSeedInstruction<TProgramAddress, TAccountSource, TAccountBaseAccount, TAccountDestination>);
150+
} as TransferWithSeedInstruction<TProgramAddress, TAccountSource, TAccountBaseAccount, TAccountDestination>);
151151
}
152152

153-
export type ParsedTransferSolWithSeedInstruction<
153+
export type ParsedTransferWithSeedInstruction<
154154
TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS,
155155
TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],
156156
> = {
@@ -160,17 +160,14 @@ export type ParsedTransferSolWithSeedInstruction<
160160
baseAccount: TAccountMetas[1];
161161
destination: TAccountMetas[2];
162162
};
163-
data: TransferSolWithSeedInstructionData;
163+
data: TransferWithSeedInstructionData;
164164
};
165165

166-
export function parseTransferSolWithSeedInstruction<
167-
TProgram extends string,
168-
TAccountMetas extends readonly AccountMeta[],
169-
>(
166+
export function parseTransferWithSeedInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(
170167
instruction: Instruction<TProgram> &
171168
InstructionWithAccounts<TAccountMetas> &
172169
InstructionWithData<ReadonlyUint8Array>,
173-
): ParsedTransferSolWithSeedInstruction<TProgram, TAccountMetas> {
170+
): ParsedTransferWithSeedInstruction<TProgram, TAccountMetas> {
174171
if (instruction.accounts.length < 3) {
175172
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
176173
actualAccountMetas: instruction.accounts.length,
@@ -186,6 +183,6 @@ export function parseTransferSolWithSeedInstruction<
186183
return {
187184
programAddress: instruction.programAddress,
188185
accounts: { source: getNextAccount(), baseAccount: getNextAccount(), destination: getNextAccount() },
189-
data: getTransferSolWithSeedInstructionDataDecoder().decode(instruction.data),
186+
data: getTransferWithSeedInstructionDataDecoder().decode(instruction.data),
190187
};
191188
}

0 commit comments

Comments
 (0)