@solana-program/system 0.12.1 → 0.13.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 +102 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.mjs +97 -4
- package/dist/src/index.mjs.map +1 -1
- package/dist/types/generated/instructions/createAccountAllowPrefund.d.ts +53 -0
- package/dist/types/generated/instructions/createAccountAllowPrefund.d.ts.map +1 -0
- package/dist/types/generated/instructions/index.d.ts +1 -0
- package/dist/types/generated/instructions/index.d.ts.map +1 -1
- package/dist/types/generated/programs/system.d.ts +12 -6
- package/dist/types/generated/programs/system.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/generated/instructions/createAccountAllowPrefund.ts +212 -0
- package/src/generated/instructions/index.ts +1 -0
- package/src/generated/programs/system.ts +34 -3
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
import { type AccountMeta, type AccountSignerMeta, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type Instruction, type InstructionWithAccounts, type InstructionWithData, type ReadonlyUint8Array, type TransactionSigner, type WritableSignerAccount } from '@solana/kit';
|
|
9
|
+
import { type InstructionWithByteDelta } from '@solana/kit/program-client-core';
|
|
10
|
+
import { SYSTEM_PROGRAM_ADDRESS } from '../programs';
|
|
11
|
+
export declare const CREATE_ACCOUNT_ALLOW_PREFUND_DISCRIMINATOR = 13;
|
|
12
|
+
export declare function getCreateAccountAllowPrefundDiscriminatorBytes(): ReadonlyUint8Array;
|
|
13
|
+
export type CreateAccountAllowPrefundInstruction<TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS, TAccountNewAccount extends string | AccountMeta<string> = string, TAccountPayer extends string | AccountMeta<string> | undefined = undefined, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
|
|
14
|
+
TAccountNewAccount extends string ? WritableSignerAccount<TAccountNewAccount> & AccountSignerMeta<TAccountNewAccount> : TAccountNewAccount,
|
|
15
|
+
...(TAccountPayer extends undefined ? [] : [
|
|
16
|
+
TAccountPayer extends string ? WritableSignerAccount<TAccountPayer> & AccountSignerMeta<TAccountPayer> : TAccountPayer
|
|
17
|
+
]),
|
|
18
|
+
...TRemainingAccounts
|
|
19
|
+
]>;
|
|
20
|
+
export type CreateAccountAllowPrefundInstructionData = {
|
|
21
|
+
discriminator: number;
|
|
22
|
+
lamports: bigint;
|
|
23
|
+
space: bigint;
|
|
24
|
+
programAddress: Address;
|
|
25
|
+
};
|
|
26
|
+
export type CreateAccountAllowPrefundInstructionDataArgs = {
|
|
27
|
+
lamports?: number | bigint;
|
|
28
|
+
space: number | bigint;
|
|
29
|
+
programAddress: Address;
|
|
30
|
+
};
|
|
31
|
+
export declare function getCreateAccountAllowPrefundInstructionDataEncoder(): FixedSizeEncoder<CreateAccountAllowPrefundInstructionDataArgs>;
|
|
32
|
+
export declare function getCreateAccountAllowPrefundInstructionDataDecoder(): FixedSizeDecoder<CreateAccountAllowPrefundInstructionData>;
|
|
33
|
+
export declare function getCreateAccountAllowPrefundInstructionDataCodec(): FixedSizeCodec<CreateAccountAllowPrefundInstructionDataArgs, CreateAccountAllowPrefundInstructionData>;
|
|
34
|
+
export type CreateAccountAllowPrefundInput<TAccountNewAccount extends string = string, TAccountPayer extends string = string> = {
|
|
35
|
+
newAccount: TransactionSigner<TAccountNewAccount>;
|
|
36
|
+
payer?: TransactionSigner<TAccountPayer>;
|
|
37
|
+
lamports?: CreateAccountAllowPrefundInstructionDataArgs['lamports'];
|
|
38
|
+
space: CreateAccountAllowPrefundInstructionDataArgs['space'];
|
|
39
|
+
programAddress: CreateAccountAllowPrefundInstructionDataArgs['programAddress'];
|
|
40
|
+
};
|
|
41
|
+
export declare function getCreateAccountAllowPrefundInstruction<TAccountNewAccount extends string, TAccountPayer extends string, TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS>(input: CreateAccountAllowPrefundInput<TAccountNewAccount, TAccountPayer>, config?: {
|
|
42
|
+
programAddress?: TProgramAddress;
|
|
43
|
+
}): CreateAccountAllowPrefundInstruction<TProgramAddress, TAccountNewAccount, TAccountPayer> & InstructionWithByteDelta;
|
|
44
|
+
export type ParsedCreateAccountAllowPrefundInstruction<TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
|
|
45
|
+
programAddress: Address<TProgram>;
|
|
46
|
+
accounts: {
|
|
47
|
+
newAccount: TAccountMetas[0];
|
|
48
|
+
payer?: TAccountMetas[1] | undefined;
|
|
49
|
+
};
|
|
50
|
+
data: CreateAccountAllowPrefundInstructionData;
|
|
51
|
+
};
|
|
52
|
+
export declare function parseCreateAccountAllowPrefundInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedCreateAccountAllowPrefundInstruction<TProgram, TAccountMetas>;
|
|
53
|
+
//# sourceMappingURL=createAccountAllowPrefund.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createAccountAllowPrefund.d.ts","sourceRoot":"","sources":["../../../../src/generated/instructions/createAccountAllowPrefund.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAcH,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,kB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AAC;QAC7B,KAAK,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;KACxC,CAAC;IACF,IAAI,EAAE,wCAAwC,CAAC;CAClD,CAAC;AAEF,wBAAgB,yCAAyC,CACrD,QAAQ,SAAS,MAAM,EACvB,aAAa,SAAS,SAAS,WAAW,EAAE,EAE5C,WAAW,EAAE,WAAW,CAAC,QAAQ,CAAC,GAC9B,uBAAuB,CAAC,aAAa,CAAC,GACtC,mBAAmB,CAAC,kBAAkB,CAAC,GAC5C,0CAA0C,CAAC,QAAQ,EAAE,aAAa,CAAC,CAwBrE"}
|
|
@@ -12,6 +12,7 @@ export * from './assign';
|
|
|
12
12
|
export * from './assignWithSeed';
|
|
13
13
|
export * from './authorizeNonceAccount';
|
|
14
14
|
export * from './createAccount';
|
|
15
|
+
export * from './createAccountAllowPrefund';
|
|
15
16
|
export * from './createAccountWithSeed';
|
|
16
17
|
export * from './initializeNonceAccount';
|
|
17
18
|
export * from './transferSol';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/generated/instructions/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/generated/instructions/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC"}
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @see https://github.com/codama-idl/codama
|
|
7
7
|
*/
|
|
8
|
-
import { type Address, type ClientWithPayer, type ClientWithRpc, type ClientWithTransactionPlanning, type ClientWithTransactionSending, type GetAccountInfoApi, type GetMultipleAccountsApi, type Instruction, type InstructionWithData, type ReadonlyUint8Array } from '@solana/kit';
|
|
8
|
+
import { type Address, type ClientWithPayer, type ClientWithRpc, type ClientWithTransactionPlanning, type ClientWithTransactionSending, type ExtendedClient, type GetAccountInfoApi, type GetMultipleAccountsApi, type Instruction, type InstructionWithData, type ReadonlyUint8Array } from '@solana/kit';
|
|
9
9
|
import { type SelfFetchFunctions, type SelfPlanAndSendFunctions } from '@solana/kit/program-client-core';
|
|
10
10
|
import { getNonceCodec, type Nonce, type NonceArgs } from '../accounts';
|
|
11
|
-
import { getAdvanceNonceAccountInstruction, getAllocateInstruction, getAllocateWithSeedInstruction, getAssignInstruction, getAssignWithSeedInstruction, getAuthorizeNonceAccountInstruction, getCreateAccountInstruction, getCreateAccountWithSeedInstruction, getInitializeNonceAccountInstruction, getTransferSolInstruction, getTransferSolWithSeedInstruction, getUpgradeNonceAccountInstruction, getWithdrawNonceAccountInstruction, type AdvanceNonceAccountInput, type AllocateInput, type AllocateWithSeedInput, type AssignInput, type AssignWithSeedInput, type AuthorizeNonceAccountInput, type CreateAccountInput, type CreateAccountWithSeedInput, type InitializeNonceAccountInput, type ParsedAdvanceNonceAccountInstruction, type ParsedAllocateInstruction, type ParsedAllocateWithSeedInstruction, type ParsedAssignInstruction, type ParsedAssignWithSeedInstruction, type ParsedAuthorizeNonceAccountInstruction, type ParsedCreateAccountInstruction, type ParsedCreateAccountWithSeedInstruction, type ParsedInitializeNonceAccountInstruction, type ParsedTransferSolInstruction, type ParsedTransferSolWithSeedInstruction, type ParsedUpgradeNonceAccountInstruction, type ParsedWithdrawNonceAccountInstruction, type TransferSolInput, type TransferSolWithSeedInput, type UpgradeNonceAccountInput, type WithdrawNonceAccountInput } from '../instructions';
|
|
11
|
+
import { getAdvanceNonceAccountInstruction, getAllocateInstruction, getAllocateWithSeedInstruction, getAssignInstruction, getAssignWithSeedInstruction, getAuthorizeNonceAccountInstruction, getCreateAccountAllowPrefundInstruction, getCreateAccountInstruction, getCreateAccountWithSeedInstruction, getInitializeNonceAccountInstruction, getTransferSolInstruction, getTransferSolWithSeedInstruction, getUpgradeNonceAccountInstruction, getWithdrawNonceAccountInstruction, type AdvanceNonceAccountInput, type AllocateInput, type AllocateWithSeedInput, type AssignInput, type AssignWithSeedInput, type AuthorizeNonceAccountInput, type CreateAccountAllowPrefundInput, type CreateAccountInput, type CreateAccountWithSeedInput, type InitializeNonceAccountInput, type ParsedAdvanceNonceAccountInstruction, type ParsedAllocateInstruction, type ParsedAllocateWithSeedInstruction, type ParsedAssignInstruction, type ParsedAssignWithSeedInstruction, type ParsedAuthorizeNonceAccountInstruction, type ParsedCreateAccountAllowPrefundInstruction, type ParsedCreateAccountInstruction, type ParsedCreateAccountWithSeedInstruction, type ParsedInitializeNonceAccountInstruction, type ParsedTransferSolInstruction, type ParsedTransferSolWithSeedInstruction, type ParsedUpgradeNonceAccountInstruction, type ParsedWithdrawNonceAccountInstruction, type TransferSolInput, type TransferSolWithSeedInput, type UpgradeNonceAccountInput, type WithdrawNonceAccountInput } from '../instructions';
|
|
12
12
|
export declare const SYSTEM_PROGRAM_ADDRESS: Address<"11111111111111111111111111111111">;
|
|
13
13
|
export declare enum SystemAccount {
|
|
14
14
|
Nonce = 0
|
|
@@ -26,7 +26,8 @@ export declare enum SystemInstruction {
|
|
|
26
26
|
AllocateWithSeed = 9,
|
|
27
27
|
AssignWithSeed = 10,
|
|
28
28
|
TransferSolWithSeed = 11,
|
|
29
|
-
UpgradeNonceAccount = 12
|
|
29
|
+
UpgradeNonceAccount = 12,
|
|
30
|
+
CreateAccountAllowPrefund = 13
|
|
30
31
|
}
|
|
31
32
|
export declare function identifySystemInstruction(instruction: {
|
|
32
33
|
data: ReadonlyUint8Array;
|
|
@@ -57,11 +58,15 @@ export type ParsedSystemInstruction<TProgram extends string = '11111111111111111
|
|
|
57
58
|
instructionType: SystemInstruction.TransferSolWithSeed;
|
|
58
59
|
} & ParsedTransferSolWithSeedInstruction<TProgram>) | ({
|
|
59
60
|
instructionType: SystemInstruction.UpgradeNonceAccount;
|
|
60
|
-
} & ParsedUpgradeNonceAccountInstruction<TProgram>)
|
|
61
|
+
} & ParsedUpgradeNonceAccountInstruction<TProgram>) | ({
|
|
62
|
+
instructionType: SystemInstruction.CreateAccountAllowPrefund;
|
|
63
|
+
} & ParsedCreateAccountAllowPrefundInstruction<TProgram>);
|
|
61
64
|
export declare function parseSystemInstruction<TProgram extends string>(instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>): ParsedSystemInstruction<TProgram>;
|
|
62
65
|
export type SystemPlugin = {
|
|
63
66
|
accounts: SystemPluginAccounts;
|
|
64
67
|
instructions: SystemPluginInstructions;
|
|
68
|
+
identifyInstruction: typeof identifySystemInstruction;
|
|
69
|
+
parseInstruction: typeof parseSystemInstruction;
|
|
65
70
|
};
|
|
66
71
|
export type SystemPluginAccounts = {
|
|
67
72
|
nonce: ReturnType<typeof getNonceCodec> & SelfFetchFunctions<NonceArgs, Nonce>;
|
|
@@ -80,11 +85,12 @@ export type SystemPluginInstructions = {
|
|
|
80
85
|
assignWithSeed: (input: AssignWithSeedInput) => ReturnType<typeof getAssignWithSeedInstruction> & SelfPlanAndSendFunctions;
|
|
81
86
|
transferSolWithSeed: (input: TransferSolWithSeedInput) => ReturnType<typeof getTransferSolWithSeedInstruction> & SelfPlanAndSendFunctions;
|
|
82
87
|
upgradeNonceAccount: (input: UpgradeNonceAccountInput) => ReturnType<typeof getUpgradeNonceAccountInstruction> & SelfPlanAndSendFunctions;
|
|
88
|
+
createAccountAllowPrefund: (input: CreateAccountAllowPrefundInput) => ReturnType<typeof getCreateAccountAllowPrefundInstruction> & SelfPlanAndSendFunctions;
|
|
83
89
|
};
|
|
84
90
|
export type SystemPluginRequirements = ClientWithRpc<GetAccountInfoApi & GetMultipleAccountsApi> & ClientWithPayer & ClientWithTransactionPlanning & ClientWithTransactionSending;
|
|
85
|
-
export declare function systemProgram(): <T extends SystemPluginRequirements>(client: T) =>
|
|
91
|
+
export declare function systemProgram(): <T extends SystemPluginRequirements>(client: T) => ExtendedClient<T, {
|
|
86
92
|
system: SystemPlugin;
|
|
87
|
-
}
|
|
93
|
+
}>;
|
|
88
94
|
type MakeOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
89
95
|
export {};
|
|
90
96
|
//# sourceMappingURL=system.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../../src/generated/programs/system.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAQH,KAAK,OAAO,EACZ,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EACjC,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAGH,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAChC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,KAAK,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EACH,iCAAiC,EACjC,sBAAsB,EACtB,8BAA8B,EAC9B,oBAAoB,EACpB,4BAA4B,EAC5B,mCAAmC,EACnC,2BAA2B,EAC3B,mCAAmC,EACnC,oCAAoC,EACpC,yBAAyB,EACzB,iCAAiC,EACjC,iCAAiC,EACjC,kCAAkC,
|
|
1
|
+
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../../src/generated/programs/system.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAQH,KAAK,OAAO,EACZ,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EACjC,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAGH,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAChC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,KAAK,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EACH,iCAAiC,EACjC,sBAAsB,EACtB,8BAA8B,EAC9B,oBAAoB,EACpB,4BAA4B,EAC5B,mCAAmC,EACnC,uCAAuC,EACvC,2BAA2B,EAC3B,mCAAmC,EACnC,oCAAoC,EACpC,yBAAyB,EACzB,iCAAiC,EACjC,iCAAiC,EACjC,kCAAkC,EAelC,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,8BAA8B,EACnC,KAAK,kBAAkB,EACvB,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,oCAAoC,EACzC,KAAK,yBAAyB,EAC9B,KAAK,iCAAiC,E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json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solana-program/system",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "JavaScript client for the System program",
|
|
5
5
|
"homepage": "https://github.com/solana-program/system#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@solana-config/oxc": "^0.1.1",
|
|
37
|
-
"@solana/kit": "^
|
|
38
|
-
"@solana/kit-plugin-litesvm": "^0.
|
|
39
|
-
"@solana/kit-plugin-signer": "^0.
|
|
37
|
+
"@solana/kit": "^7.0.0",
|
|
38
|
+
"@solana/kit-plugin-litesvm": "^0.13.0",
|
|
39
|
+
"@solana/kit-plugin-signer": "^0.13.0",
|
|
40
40
|
"@types/node": "^24",
|
|
41
41
|
"oxfmt": "^0.48.0",
|
|
42
42
|
"oxlint": "^1.63.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"vitest": "^4.0.15"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@solana/kit": "^
|
|
51
|
+
"@solana/kit": "^7.0.0"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
54
|
"build": "rimraf dist && tsup && tsc -p ./tsconfig.declarations.json",
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
BASE_ACCOUNT_SIZE,
|
|
11
|
+
combineCodec,
|
|
12
|
+
getAddressDecoder,
|
|
13
|
+
getAddressEncoder,
|
|
14
|
+
getStructDecoder,
|
|
15
|
+
getStructEncoder,
|
|
16
|
+
getU32Decoder,
|
|
17
|
+
getU32Encoder,
|
|
18
|
+
getU64Decoder,
|
|
19
|
+
getU64Encoder,
|
|
20
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
21
|
+
SolanaError,
|
|
22
|
+
transformEncoder,
|
|
23
|
+
type AccountMeta,
|
|
24
|
+
type AccountSignerMeta,
|
|
25
|
+
type Address,
|
|
26
|
+
type FixedSizeCodec,
|
|
27
|
+
type FixedSizeDecoder,
|
|
28
|
+
type FixedSizeEncoder,
|
|
29
|
+
type Instruction,
|
|
30
|
+
type InstructionWithAccounts,
|
|
31
|
+
type InstructionWithData,
|
|
32
|
+
type ReadonlyUint8Array,
|
|
33
|
+
type TransactionSigner,
|
|
34
|
+
type WritableSignerAccount,
|
|
35
|
+
} from '@solana/kit';
|
|
36
|
+
import {
|
|
37
|
+
getAccountMetaFactory,
|
|
38
|
+
type InstructionWithByteDelta,
|
|
39
|
+
type ResolvedInstructionAccount,
|
|
40
|
+
} from '@solana/kit/program-client-core';
|
|
41
|
+
import { SYSTEM_PROGRAM_ADDRESS } from '../programs';
|
|
42
|
+
|
|
43
|
+
export const CREATE_ACCOUNT_ALLOW_PREFUND_DISCRIMINATOR = 13;
|
|
44
|
+
|
|
45
|
+
export function getCreateAccountAllowPrefundDiscriminatorBytes(): ReadonlyUint8Array {
|
|
46
|
+
return getU32Encoder().encode(CREATE_ACCOUNT_ALLOW_PREFUND_DISCRIMINATOR);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type CreateAccountAllowPrefundInstruction<
|
|
50
|
+
TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS,
|
|
51
|
+
TAccountNewAccount extends string | AccountMeta<string> = string,
|
|
52
|
+
TAccountPayer extends string | AccountMeta<string> | undefined = undefined,
|
|
53
|
+
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
|
|
54
|
+
> = Instruction<TProgram> &
|
|
55
|
+
InstructionWithData<ReadonlyUint8Array> &
|
|
56
|
+
InstructionWithAccounts<
|
|
57
|
+
[
|
|
58
|
+
TAccountNewAccount extends string
|
|
59
|
+
? WritableSignerAccount<TAccountNewAccount> & AccountSignerMeta<TAccountNewAccount>
|
|
60
|
+
: TAccountNewAccount,
|
|
61
|
+
...(TAccountPayer extends undefined
|
|
62
|
+
? []
|
|
63
|
+
: [
|
|
64
|
+
TAccountPayer extends string
|
|
65
|
+
? WritableSignerAccount<TAccountPayer> & AccountSignerMeta<TAccountPayer>
|
|
66
|
+
: TAccountPayer,
|
|
67
|
+
]),
|
|
68
|
+
...TRemainingAccounts,
|
|
69
|
+
]
|
|
70
|
+
>;
|
|
71
|
+
|
|
72
|
+
export type CreateAccountAllowPrefundInstructionData = {
|
|
73
|
+
discriminator: number;
|
|
74
|
+
lamports: bigint;
|
|
75
|
+
space: bigint;
|
|
76
|
+
programAddress: Address;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export type CreateAccountAllowPrefundInstructionDataArgs = {
|
|
80
|
+
lamports?: number | bigint;
|
|
81
|
+
space: number | bigint;
|
|
82
|
+
programAddress: Address;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export function getCreateAccountAllowPrefundInstructionDataEncoder(): FixedSizeEncoder<CreateAccountAllowPrefundInstructionDataArgs> {
|
|
86
|
+
return transformEncoder(
|
|
87
|
+
getStructEncoder([
|
|
88
|
+
['discriminator', getU32Encoder()],
|
|
89
|
+
['lamports', getU64Encoder()],
|
|
90
|
+
['space', getU64Encoder()],
|
|
91
|
+
['programAddress', getAddressEncoder()],
|
|
92
|
+
]),
|
|
93
|
+
value => ({
|
|
94
|
+
...value,
|
|
95
|
+
discriminator: CREATE_ACCOUNT_ALLOW_PREFUND_DISCRIMINATOR,
|
|
96
|
+
lamports: value.lamports ?? 0,
|
|
97
|
+
}),
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function getCreateAccountAllowPrefundInstructionDataDecoder(): FixedSizeDecoder<CreateAccountAllowPrefundInstructionData> {
|
|
102
|
+
return getStructDecoder([
|
|
103
|
+
['discriminator', getU32Decoder()],
|
|
104
|
+
['lamports', getU64Decoder()],
|
|
105
|
+
['space', getU64Decoder()],
|
|
106
|
+
['programAddress', getAddressDecoder()],
|
|
107
|
+
]);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function getCreateAccountAllowPrefundInstructionDataCodec(): FixedSizeCodec<
|
|
111
|
+
CreateAccountAllowPrefundInstructionDataArgs,
|
|
112
|
+
CreateAccountAllowPrefundInstructionData
|
|
113
|
+
> {
|
|
114
|
+
return combineCodec(
|
|
115
|
+
getCreateAccountAllowPrefundInstructionDataEncoder(),
|
|
116
|
+
getCreateAccountAllowPrefundInstructionDataDecoder(),
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export type CreateAccountAllowPrefundInput<
|
|
121
|
+
TAccountNewAccount extends string = string,
|
|
122
|
+
TAccountPayer extends string = string,
|
|
123
|
+
> = {
|
|
124
|
+
newAccount: TransactionSigner<TAccountNewAccount>;
|
|
125
|
+
payer?: TransactionSigner<TAccountPayer>;
|
|
126
|
+
lamports?: CreateAccountAllowPrefundInstructionDataArgs['lamports'];
|
|
127
|
+
space: CreateAccountAllowPrefundInstructionDataArgs['space'];
|
|
128
|
+
programAddress: CreateAccountAllowPrefundInstructionDataArgs['programAddress'];
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export function getCreateAccountAllowPrefundInstruction<
|
|
132
|
+
TAccountNewAccount extends string,
|
|
133
|
+
TAccountPayer extends string,
|
|
134
|
+
TProgramAddress extends Address = typeof SYSTEM_PROGRAM_ADDRESS,
|
|
135
|
+
>(
|
|
136
|
+
input: CreateAccountAllowPrefundInput<TAccountNewAccount, TAccountPayer>,
|
|
137
|
+
config?: { programAddress?: TProgramAddress },
|
|
138
|
+
): CreateAccountAllowPrefundInstruction<TProgramAddress, TAccountNewAccount, TAccountPayer> & InstructionWithByteDelta {
|
|
139
|
+
// Program address.
|
|
140
|
+
const programAddress = config?.programAddress ?? SYSTEM_PROGRAM_ADDRESS;
|
|
141
|
+
|
|
142
|
+
// Original accounts.
|
|
143
|
+
const originalAccounts = {
|
|
144
|
+
newAccount: { value: input.newAccount ?? null, isWritable: true },
|
|
145
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
146
|
+
};
|
|
147
|
+
const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedInstructionAccount>;
|
|
148
|
+
|
|
149
|
+
// Original args.
|
|
150
|
+
const args = { ...input };
|
|
151
|
+
|
|
152
|
+
// Bytes created or reallocated by the instruction.
|
|
153
|
+
const byteDelta: number = [Number(args.space) + BASE_ACCOUNT_SIZE].reduce((a, b) => a + b, 0);
|
|
154
|
+
|
|
155
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'omitted');
|
|
156
|
+
return Object.freeze({
|
|
157
|
+
accounts: [getAccountMeta('newAccount', accounts.newAccount), getAccountMeta('payer', accounts.payer)].filter(
|
|
158
|
+
<T>(x: T | undefined): x is T => x !== undefined,
|
|
159
|
+
),
|
|
160
|
+
byteDelta,
|
|
161
|
+
data: getCreateAccountAllowPrefundInstructionDataEncoder().encode(
|
|
162
|
+
args as CreateAccountAllowPrefundInstructionDataArgs,
|
|
163
|
+
),
|
|
164
|
+
programAddress,
|
|
165
|
+
} as CreateAccountAllowPrefundInstruction<TProgramAddress, TAccountNewAccount, TAccountPayer> &
|
|
166
|
+
InstructionWithByteDelta);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export type ParsedCreateAccountAllowPrefundInstruction<
|
|
170
|
+
TProgram extends string = typeof SYSTEM_PROGRAM_ADDRESS,
|
|
171
|
+
TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],
|
|
172
|
+
> = {
|
|
173
|
+
programAddress: Address<TProgram>;
|
|
174
|
+
accounts: {
|
|
175
|
+
newAccount: TAccountMetas[0];
|
|
176
|
+
payer?: TAccountMetas[1] | undefined;
|
|
177
|
+
};
|
|
178
|
+
data: CreateAccountAllowPrefundInstructionData;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export function parseCreateAccountAllowPrefundInstruction<
|
|
182
|
+
TProgram extends string,
|
|
183
|
+
TAccountMetas extends readonly AccountMeta[],
|
|
184
|
+
>(
|
|
185
|
+
instruction: Instruction<TProgram> &
|
|
186
|
+
InstructionWithAccounts<TAccountMetas> &
|
|
187
|
+
InstructionWithData<ReadonlyUint8Array>,
|
|
188
|
+
): ParsedCreateAccountAllowPrefundInstruction<TProgram, TAccountMetas> {
|
|
189
|
+
if (instruction.accounts.length < 1) {
|
|
190
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
191
|
+
actualAccountMetas: instruction.accounts.length,
|
|
192
|
+
expectedAccountMetas: 1,
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
let accountIndex = 0;
|
|
196
|
+
const getNextAccount = () => {
|
|
197
|
+
const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
|
|
198
|
+
accountIndex += 1;
|
|
199
|
+
return accountMeta;
|
|
200
|
+
};
|
|
201
|
+
let optionalAccountsRemaining = instruction.accounts.length - 1;
|
|
202
|
+
const getNextOptionalAccount = () => {
|
|
203
|
+
if (optionalAccountsRemaining === 0) return undefined;
|
|
204
|
+
optionalAccountsRemaining -= 1;
|
|
205
|
+
return getNextAccount();
|
|
206
|
+
};
|
|
207
|
+
return {
|
|
208
|
+
programAddress: instruction.programAddress,
|
|
209
|
+
accounts: { newAccount: getNextAccount(), payer: getNextOptionalAccount() },
|
|
210
|
+
data: getCreateAccountAllowPrefundInstructionDataDecoder().decode(instruction.data),
|
|
211
|
+
};
|
|
212
|
+
}
|
|
@@ -13,6 +13,7 @@ export * from './assign';
|
|
|
13
13
|
export * from './assignWithSeed';
|
|
14
14
|
export * from './authorizeNonceAccount';
|
|
15
15
|
export * from './createAccount';
|
|
16
|
+
export * from './createAccountAllowPrefund';
|
|
16
17
|
export * from './createAccountWithSeed';
|
|
17
18
|
export * from './initializeNonceAccount';
|
|
18
19
|
export * from './transferSol';
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
type ClientWithRpc,
|
|
20
20
|
type ClientWithTransactionPlanning,
|
|
21
21
|
type ClientWithTransactionSending,
|
|
22
|
+
type ExtendedClient,
|
|
22
23
|
type GetAccountInfoApi,
|
|
23
24
|
type GetMultipleAccountsApi,
|
|
24
25
|
type Instruction,
|
|
@@ -39,6 +40,7 @@ import {
|
|
|
39
40
|
getAssignInstruction,
|
|
40
41
|
getAssignWithSeedInstruction,
|
|
41
42
|
getAuthorizeNonceAccountInstruction,
|
|
43
|
+
getCreateAccountAllowPrefundInstruction,
|
|
42
44
|
getCreateAccountInstruction,
|
|
43
45
|
getCreateAccountWithSeedInstruction,
|
|
44
46
|
getInitializeNonceAccountInstruction,
|
|
@@ -52,6 +54,7 @@ import {
|
|
|
52
54
|
parseAssignInstruction,
|
|
53
55
|
parseAssignWithSeedInstruction,
|
|
54
56
|
parseAuthorizeNonceAccountInstruction,
|
|
57
|
+
parseCreateAccountAllowPrefundInstruction,
|
|
55
58
|
parseCreateAccountInstruction,
|
|
56
59
|
parseCreateAccountWithSeedInstruction,
|
|
57
60
|
parseInitializeNonceAccountInstruction,
|
|
@@ -65,6 +68,7 @@ import {
|
|
|
65
68
|
type AssignInput,
|
|
66
69
|
type AssignWithSeedInput,
|
|
67
70
|
type AuthorizeNonceAccountInput,
|
|
71
|
+
type CreateAccountAllowPrefundInput,
|
|
68
72
|
type CreateAccountInput,
|
|
69
73
|
type CreateAccountWithSeedInput,
|
|
70
74
|
type InitializeNonceAccountInput,
|
|
@@ -74,6 +78,7 @@ import {
|
|
|
74
78
|
type ParsedAssignInstruction,
|
|
75
79
|
type ParsedAssignWithSeedInstruction,
|
|
76
80
|
type ParsedAuthorizeNonceAccountInstruction,
|
|
81
|
+
type ParsedCreateAccountAllowPrefundInstruction,
|
|
77
82
|
type ParsedCreateAccountInstruction,
|
|
78
83
|
type ParsedCreateAccountWithSeedInstruction,
|
|
79
84
|
type ParsedInitializeNonceAccountInstruction,
|
|
@@ -107,6 +112,7 @@ export enum SystemInstruction {
|
|
|
107
112
|
AssignWithSeed,
|
|
108
113
|
TransferSolWithSeed,
|
|
109
114
|
UpgradeNonceAccount,
|
|
115
|
+
CreateAccountAllowPrefund,
|
|
110
116
|
}
|
|
111
117
|
|
|
112
118
|
export function identifySystemInstruction(
|
|
@@ -152,6 +158,9 @@ export function identifySystemInstruction(
|
|
|
152
158
|
if (containsBytes(data, getU32Encoder().encode(12), 0)) {
|
|
153
159
|
return SystemInstruction.UpgradeNonceAccount;
|
|
154
160
|
}
|
|
161
|
+
if (containsBytes(data, getU32Encoder().encode(13), 0)) {
|
|
162
|
+
return SystemInstruction.CreateAccountAllowPrefund;
|
|
163
|
+
}
|
|
155
164
|
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, {
|
|
156
165
|
instructionData: data,
|
|
157
166
|
programName: 'system',
|
|
@@ -173,7 +182,10 @@ export type ParsedSystemInstruction<TProgram extends string = '11111111111111111
|
|
|
173
182
|
| ({ instructionType: SystemInstruction.AllocateWithSeed } & ParsedAllocateWithSeedInstruction<TProgram>)
|
|
174
183
|
| ({ instructionType: SystemInstruction.AssignWithSeed } & ParsedAssignWithSeedInstruction<TProgram>)
|
|
175
184
|
| ({ instructionType: SystemInstruction.TransferSolWithSeed } & ParsedTransferSolWithSeedInstruction<TProgram>)
|
|
176
|
-
| ({ instructionType: SystemInstruction.UpgradeNonceAccount } & ParsedUpgradeNonceAccountInstruction<TProgram>)
|
|
185
|
+
| ({ instructionType: SystemInstruction.UpgradeNonceAccount } & ParsedUpgradeNonceAccountInstruction<TProgram>)
|
|
186
|
+
| ({
|
|
187
|
+
instructionType: SystemInstruction.CreateAccountAllowPrefund;
|
|
188
|
+
} & ParsedCreateAccountAllowPrefundInstruction<TProgram>);
|
|
177
189
|
|
|
178
190
|
export function parseSystemInstruction<TProgram extends string>(
|
|
179
191
|
instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>,
|
|
@@ -259,6 +271,13 @@ export function parseSystemInstruction<TProgram extends string>(
|
|
|
259
271
|
...parseUpgradeNonceAccountInstruction(instruction),
|
|
260
272
|
};
|
|
261
273
|
}
|
|
274
|
+
case SystemInstruction.CreateAccountAllowPrefund: {
|
|
275
|
+
assertIsInstructionWithAccounts(instruction);
|
|
276
|
+
return {
|
|
277
|
+
instructionType: SystemInstruction.CreateAccountAllowPrefund,
|
|
278
|
+
...parseCreateAccountAllowPrefundInstruction(instruction),
|
|
279
|
+
};
|
|
280
|
+
}
|
|
262
281
|
default:
|
|
263
282
|
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, {
|
|
264
283
|
instructionType: instructionType as string,
|
|
@@ -267,7 +286,12 @@ export function parseSystemInstruction<TProgram extends string>(
|
|
|
267
286
|
}
|
|
268
287
|
}
|
|
269
288
|
|
|
270
|
-
export type SystemPlugin = {
|
|
289
|
+
export type SystemPlugin = {
|
|
290
|
+
accounts: SystemPluginAccounts;
|
|
291
|
+
instructions: SystemPluginInstructions;
|
|
292
|
+
identifyInstruction: typeof identifySystemInstruction;
|
|
293
|
+
parseInstruction: typeof parseSystemInstruction;
|
|
294
|
+
};
|
|
271
295
|
|
|
272
296
|
export type SystemPluginAccounts = { nonce: ReturnType<typeof getNonceCodec> & SelfFetchFunctions<NonceArgs, Nonce> };
|
|
273
297
|
|
|
@@ -305,6 +329,9 @@ export type SystemPluginInstructions = {
|
|
|
305
329
|
upgradeNonceAccount: (
|
|
306
330
|
input: UpgradeNonceAccountInput,
|
|
307
331
|
) => ReturnType<typeof getUpgradeNonceAccountInstruction> & SelfPlanAndSendFunctions;
|
|
332
|
+
createAccountAllowPrefund: (
|
|
333
|
+
input: CreateAccountAllowPrefundInput,
|
|
334
|
+
) => ReturnType<typeof getCreateAccountAllowPrefundInstruction> & SelfPlanAndSendFunctions;
|
|
308
335
|
};
|
|
309
336
|
|
|
310
337
|
export type SystemPluginRequirements = ClientWithRpc<GetAccountInfoApi & GetMultipleAccountsApi> &
|
|
@@ -313,7 +340,7 @@ export type SystemPluginRequirements = ClientWithRpc<GetAccountInfoApi & GetMult
|
|
|
313
340
|
ClientWithTransactionSending;
|
|
314
341
|
|
|
315
342
|
export function systemProgram() {
|
|
316
|
-
return <T extends SystemPluginRequirements>(client: T):
|
|
343
|
+
return <T extends SystemPluginRequirements>(client: T): ExtendedClient<T, { system: SystemPlugin }> => {
|
|
317
344
|
return extendClient(client, {
|
|
318
345
|
system: <SystemPlugin>{
|
|
319
346
|
accounts: { nonce: addSelfFetchFunctions(client, getNonceCodec()) },
|
|
@@ -346,7 +373,11 @@ export function systemProgram() {
|
|
|
346
373
|
addSelfPlanAndSendFunctions(client, getTransferSolWithSeedInstruction(input)),
|
|
347
374
|
upgradeNonceAccount: input =>
|
|
348
375
|
addSelfPlanAndSendFunctions(client, getUpgradeNonceAccountInstruction(input)),
|
|
376
|
+
createAccountAllowPrefund: input =>
|
|
377
|
+
addSelfPlanAndSendFunctions(client, getCreateAccountAllowPrefundInstruction(input)),
|
|
349
378
|
},
|
|
379
|
+
identifyInstruction: identifySystemInstruction,
|
|
380
|
+
parseInstruction: parseSystemInstruction,
|
|
350
381
|
},
|
|
351
382
|
});
|
|
352
383
|
};
|