@send-fun/sdk 1.0.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/LICENSE +21 -0
- package/README.md +32 -0
- package/dist/index.cjs +12808 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +4406 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +4405 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +12749 -0
- package/dist/index.mjs.map +1 -0
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/package.json +72 -0
- package/src/constants.ts +38 -0
- package/src/dex/generated/accounts/globalConfig.ts +189 -0
- package/src/dex/generated/accounts/index.ts +12 -0
- package/src/dex/generated/accounts/pool.ts +244 -0
- package/src/dex/generated/accounts/rewardAccrual.ts +191 -0
- package/src/dex/generated/accounts/sendDex.accounts.ts +47 -0
- package/src/dex/generated/errors/index.ts +9 -0
- package/src/dex/generated/errors/sendDex.ts +161 -0
- package/src/dex/generated/events/anchorEventCpiDiscriminator.framing.ts +28 -0
- package/src/dex/generated/events/creatorClaimEvent.ts +119 -0
- package/src/dex/generated/events/depositQuoteEvent.ts +115 -0
- package/src/dex/generated/events/index.ts +16 -0
- package/src/dex/generated/events/poolCreateEvent.ts +128 -0
- package/src/dex/generated/events/protocolClaimEvent.ts +111 -0
- package/src/dex/generated/events/sendDex.events.ts +184 -0
- package/src/dex/generated/events/tokenCreateEvent.ts +143 -0
- package/src/dex/generated/events/tradeEvent.ts +143 -0
- package/src/dex/generated/index.ts +16 -0
- package/src/dex/generated/instructions/buyExactIn.ts +815 -0
- package/src/dex/generated/instructions/buyExactOut.ts +815 -0
- package/src/dex/generated/instructions/claimCreatorFees.ts +648 -0
- package/src/dex/generated/instructions/claimProtocolFees.ts +640 -0
- package/src/dex/generated/instructions/index.ts +15 -0
- package/src/dex/generated/instructions/sellExactIn.ts +815 -0
- package/src/dex/generated/instructions/sellExactOut.ts +815 -0
- package/src/dex/generated/instructions/sendDex.instructions.ts +173 -0
- package/src/dex/generated/pdas/eventAuthority.ts +20 -0
- package/src/dex/generated/pdas/globalConfig.ts +20 -0
- package/src/dex/generated/pdas/index.ts +14 -0
- package/src/dex/generated/pdas/lpMint.ts +36 -0
- package/src/dex/generated/pdas/pool.ts +34 -0
- package/src/dex/generated/pdas/rewardAccrual.ts +37 -0
- package/src/dex/generated/pdas/wsolRewardAccrual.ts +20 -0
- package/src/dex/generated/plugins/index.ts +9 -0
- package/src/dex/generated/plugins/sendDex.ts +282 -0
- package/src/dex/generated/programs/index.ts +9 -0
- package/src/dex/generated/programs/sendDex.ts +12 -0
- package/src/dex/generated/types/index.ts +10 -0
- package/src/dex/generated/types/poolStatus.ts +38 -0
- package/src/dex/generated/types/tradeDirection.ts +38 -0
- package/src/dex/index.ts +8 -0
- package/src/dex/trade.ts +215 -0
- package/src/index.ts +8 -0
- package/src/launchpad/create.ts +116 -0
- package/src/launchpad/generated/accounts/bondingCurve.ts +273 -0
- package/src/launchpad/generated/accounts/globalConfig.ts +211 -0
- package/src/launchpad/generated/accounts/index.ts +12 -0
- package/src/launchpad/generated/accounts/rewardAccrual.ts +191 -0
- package/src/launchpad/generated/accounts/sendLaunchpad.accounts.ts +50 -0
- package/src/launchpad/generated/errors/index.ts +9 -0
- package/src/launchpad/generated/errors/sendLaunchpad.ts +175 -0
- package/src/launchpad/generated/events/anchorEventCpiDiscriminator.framing.ts +28 -0
- package/src/launchpad/generated/events/completeEvent.ts +120 -0
- package/src/launchpad/generated/events/creatorClaimEvent.ts +122 -0
- package/src/launchpad/generated/events/index.ts +17 -0
- package/src/launchpad/generated/events/migrateEvent.ts +121 -0
- package/src/launchpad/generated/events/protocolClaimEvent.ts +114 -0
- package/src/launchpad/generated/events/recycleEvent.ts +113 -0
- package/src/launchpad/generated/events/sendLaunchpad.events.ts +207 -0
- package/src/launchpad/generated/events/tokenCreateEvent.ts +156 -0
- package/src/launchpad/generated/events/tradeEvent.ts +148 -0
- package/src/launchpad/generated/index.ts +16 -0
- package/src/launchpad/generated/instructions/buyExactIn.ts +818 -0
- package/src/launchpad/generated/instructions/buyExactOut.ts +818 -0
- package/src/launchpad/generated/instructions/claimCreatorFees.ts +651 -0
- package/src/launchpad/generated/instructions/claimProtocolFees.ts +640 -0
- package/src/launchpad/generated/instructions/createToken.ts +1150 -0
- package/src/launchpad/generated/instructions/index.ts +17 -0
- package/src/launchpad/generated/instructions/migrate.ts +840 -0
- package/src/launchpad/generated/instructions/sellExactIn.ts +818 -0
- package/src/launchpad/generated/instructions/sellExactOut.ts +818 -0
- package/src/launchpad/generated/instructions/sendLaunchpad.instructions.ts +210 -0
- package/src/launchpad/generated/pdas/bondingCurve.ts +39 -0
- package/src/launchpad/generated/pdas/eventAuthority.ts +20 -0
- package/src/launchpad/generated/pdas/globalConfig.ts +20 -0
- package/src/launchpad/generated/pdas/index.ts +14 -0
- package/src/launchpad/generated/pdas/migrationAuthority.ts +20 -0
- package/src/launchpad/generated/pdas/rewardAccrual.ts +37 -0
- package/src/launchpad/generated/pdas/wsolRewardAccrual.ts +20 -0
- package/src/launchpad/generated/plugins/index.ts +9 -0
- package/src/launchpad/generated/plugins/sendLaunchpad.ts +315 -0
- package/src/launchpad/generated/programs/index.ts +9 -0
- package/src/launchpad/generated/programs/sendLaunchpad.ts +12 -0
- package/src/launchpad/generated/types/bondingCurveStatus.ts +43 -0
- package/src/launchpad/generated/types/index.ts +10 -0
- package/src/launchpad/generated/types/tradeDirection.ts +38 -0
- package/src/launchpad/index.ts +10 -0
- package/src/launchpad/migrate.ts +54 -0
- package/src/launchpad/trade.ts +247 -0
- package/src/math/amm.ts +511 -0
- package/src/math/fee-decay.ts +49 -0
- package/src/math/fees.ts +75 -0
- package/src/math/index.ts +3 -0
- package/src/math/internal.ts +16 -0
- package/src/nexus/fee-helpers.ts +49 -0
- package/src/nexus/generated/accounts/altRegistry.ts +177 -0
- package/src/nexus/generated/accounts/creatorFeeConfig.ts +200 -0
- package/src/nexus/generated/accounts/feePreset.ts +196 -0
- package/src/nexus/generated/accounts/globalConfig.ts +188 -0
- package/src/nexus/generated/accounts/index.ts +19 -0
- package/src/nexus/generated/accounts/partnerConfig.ts +209 -0
- package/src/nexus/generated/accounts/partnerMetadata.ts +216 -0
- package/src/nexus/generated/accounts/rewardState.ts +209 -0
- package/src/nexus/generated/accounts/sendNexus.accounts.ts +85 -0
- package/src/nexus/generated/accounts/stakingConfig.ts +197 -0
- package/src/nexus/generated/accounts/userRewardDebt.ts +221 -0
- package/src/nexus/generated/accounts/userStakePosition.ts +218 -0
- package/src/nexus/generated/constants/index.ts +9 -0
- package/src/nexus/generated/constants/sendNexus.ts +13 -0
- package/src/nexus/generated/errors/index.ts +9 -0
- package/src/nexus/generated/errors/sendNexus.ts +229 -0
- package/src/nexus/generated/events/anchorEventCpiDiscriminator.framing.ts +28 -0
- package/src/nexus/generated/events/claimEvent.ts +106 -0
- package/src/nexus/generated/events/index.ts +13 -0
- package/src/nexus/generated/events/sendNexus.events.ts +121 -0
- package/src/nexus/generated/events/stakeEvent.ts +106 -0
- package/src/nexus/generated/events/unstakeEvent.ts +106 -0
- package/src/nexus/generated/index.ts +17 -0
- package/src/nexus/generated/instructions/claim.ts +740 -0
- package/src/nexus/generated/instructions/createUserRewardDebt.ts +498 -0
- package/src/nexus/generated/instructions/index.ts +14 -0
- package/src/nexus/generated/instructions/sendNexus.instructions.ts +146 -0
- package/src/nexus/generated/instructions/settle.ts +517 -0
- package/src/nexus/generated/instructions/stake.ts +615 -0
- package/src/nexus/generated/instructions/unstake.ts +593 -0
- package/src/nexus/generated/pdas/altRegistry.ts +20 -0
- package/src/nexus/generated/pdas/creatorFeeConfig.ts +39 -0
- package/src/nexus/generated/pdas/defaultFeePreset.ts +37 -0
- package/src/nexus/generated/pdas/defaultPartner.ts +40 -0
- package/src/nexus/generated/pdas/defaultPartnerMetadata.ts +42 -0
- package/src/nexus/generated/pdas/eventAuthority.ts +20 -0
- package/src/nexus/generated/pdas/feePreset.ts +39 -0
- package/src/nexus/generated/pdas/globalConfig.ts +20 -0
- package/src/nexus/generated/pdas/index.ts +22 -0
- package/src/nexus/generated/pdas/partnerConfig.ts +36 -0
- package/src/nexus/generated/pdas/partnerMetadata.ts +38 -0
- package/src/nexus/generated/pdas/rewardState.ts +36 -0
- package/src/nexus/generated/pdas/stakingConfig.ts +20 -0
- package/src/nexus/generated/pdas/userRewardDebt.ts +41 -0
- package/src/nexus/generated/pdas/userStakePosition.ts +39 -0
- package/src/nexus/generated/plugins/index.ts +9 -0
- package/src/nexus/generated/plugins/sendNexus.ts +494 -0
- package/src/nexus/generated/programs/index.ts +9 -0
- package/src/nexus/generated/programs/sendNexus.ts +12 -0
- package/src/nexus/generated/types/authPlatformEntry.ts +52 -0
- package/src/nexus/generated/types/callerType.ts +38 -0
- package/src/nexus/generated/types/dexFees.ts +64 -0
- package/src/nexus/generated/types/feeConfig.ts +73 -0
- package/src/nexus/generated/types/index.ts +13 -0
- package/src/nexus/generated/types/launchpadFees.ts +63 -0
- package/src/nexus/index.ts +9 -0
- package/src/nexus/staking.ts +581 -0
- package/src/platform.ts +19 -0
- package/src/transfer-fee.ts +216 -0
- package/src/utils/chunk.ts +21 -0
- package/src/utils/creator-hash.ts +57 -0
- package/src/utils/index.ts +9 -0
- package/src/utils/mint-info.ts +102 -0
- package/src/utils/partner.ts +5 -0
- package/src/utils/pda.ts +24 -0
|
@@ -0,0 +1,615 @@
|
|
|
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
|
+
address,
|
|
11
|
+
assertIsInstructionForProgram,
|
|
12
|
+
combineCodec,
|
|
13
|
+
containsBytes,
|
|
14
|
+
fixDecoderSize,
|
|
15
|
+
fixEncoderSize,
|
|
16
|
+
getAddressEncoder,
|
|
17
|
+
getBytesDecoder,
|
|
18
|
+
getBytesEncoder,
|
|
19
|
+
getProgramDerivedAddress,
|
|
20
|
+
getStructDecoder,
|
|
21
|
+
getStructEncoder,
|
|
22
|
+
getU64Decoder,
|
|
23
|
+
getU64Encoder,
|
|
24
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
25
|
+
SolanaError,
|
|
26
|
+
transformEncoder,
|
|
27
|
+
type AccountMeta,
|
|
28
|
+
type AccountSignerMeta,
|
|
29
|
+
type Address,
|
|
30
|
+
type FixedSizeCodec,
|
|
31
|
+
type FixedSizeDecoder,
|
|
32
|
+
type FixedSizeEncoder,
|
|
33
|
+
type Instruction,
|
|
34
|
+
type InstructionWithAccounts,
|
|
35
|
+
type InstructionWithData,
|
|
36
|
+
type ReadonlyAccount,
|
|
37
|
+
type ReadonlySignerAccount,
|
|
38
|
+
type ReadonlyUint8Array,
|
|
39
|
+
type TransactionSigner,
|
|
40
|
+
type WritableAccount,
|
|
41
|
+
type WritableSignerAccount,
|
|
42
|
+
} from '@solana/kit';
|
|
43
|
+
import {
|
|
44
|
+
getAccountMetaFactory,
|
|
45
|
+
getAddressFromResolvedInstructionAccount,
|
|
46
|
+
type ResolvedInstructionAccount,
|
|
47
|
+
} from '@solana/program-client-core';
|
|
48
|
+
import {
|
|
49
|
+
EVENT_AUTHORITY_PDA_ADDRESS,
|
|
50
|
+
findUserStakePositionPda,
|
|
51
|
+
GLOBAL_CONFIG_PDA_ADDRESS,
|
|
52
|
+
STAKING_CONFIG_PDA_ADDRESS,
|
|
53
|
+
} from '../pdas/index.js';
|
|
54
|
+
import { SEND_NEXUS_PROGRAM_ADDRESS } from '../programs/index.js';
|
|
55
|
+
|
|
56
|
+
export const STAKE_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([
|
|
57
|
+
206, 176, 202, 18, 200, 209, 179, 108,
|
|
58
|
+
]);
|
|
59
|
+
|
|
60
|
+
export function getStakeDiscriminatorBytes(): ReadonlyUint8Array {
|
|
61
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(STAKE_DISCRIMINATOR);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type StakeInstruction<
|
|
65
|
+
TProgram extends string = typeof SEND_NEXUS_PROGRAM_ADDRESS,
|
|
66
|
+
TAccountUser extends string | AccountMeta<string> = string,
|
|
67
|
+
TAccountPayer extends string | AccountMeta<string> = string,
|
|
68
|
+
TAccountStakingMint extends string | AccountMeta<string> = string,
|
|
69
|
+
TAccountGlobalConfig extends string | AccountMeta<string> =
|
|
70
|
+
'3bycfBeRULfXYqcg3DmiYFBjv6mMVidMuqKdFZJTGdNr',
|
|
71
|
+
TAccountStakingConfig extends string | AccountMeta<string> =
|
|
72
|
+
'9WUowYRb6KAWjWVB5KMmTngBidZXEXgQcQRTXbhxeGbF',
|
|
73
|
+
TAccountUserStakePosition extends string | AccountMeta<string> = string,
|
|
74
|
+
TAccountUserTokenAccount extends string | AccountMeta<string> = string,
|
|
75
|
+
TAccountPoolVault extends string | AccountMeta<string> = string,
|
|
76
|
+
TAccountTokenProgram extends string | AccountMeta<string> =
|
|
77
|
+
'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb',
|
|
78
|
+
TAccountAssociatedTokenProgram extends string | AccountMeta<string> =
|
|
79
|
+
'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL',
|
|
80
|
+
TAccountSystemProgram extends string | AccountMeta<string> =
|
|
81
|
+
'11111111111111111111111111111111',
|
|
82
|
+
TAccountEventAuthority extends string | AccountMeta<string> =
|
|
83
|
+
'BxA56yuUugqREwSEFVr117VKJ6JmVdPA7jm7MCXzDNJr',
|
|
84
|
+
TAccountProgram extends string | AccountMeta<string> =
|
|
85
|
+
'7rrCurqdWFesbzwtYPo95fM8waTtVXgXwCom45x1sfNX',
|
|
86
|
+
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
|
|
87
|
+
> = Instruction<TProgram> &
|
|
88
|
+
InstructionWithData<ReadonlyUint8Array> &
|
|
89
|
+
InstructionWithAccounts<
|
|
90
|
+
[
|
|
91
|
+
TAccountUser extends string
|
|
92
|
+
? ReadonlySignerAccount<TAccountUser> &
|
|
93
|
+
AccountSignerMeta<TAccountUser>
|
|
94
|
+
: TAccountUser,
|
|
95
|
+
TAccountPayer extends string
|
|
96
|
+
? WritableSignerAccount<TAccountPayer> &
|
|
97
|
+
AccountSignerMeta<TAccountPayer>
|
|
98
|
+
: TAccountPayer,
|
|
99
|
+
TAccountStakingMint extends string
|
|
100
|
+
? ReadonlyAccount<TAccountStakingMint>
|
|
101
|
+
: TAccountStakingMint,
|
|
102
|
+
TAccountGlobalConfig extends string
|
|
103
|
+
? ReadonlyAccount<TAccountGlobalConfig>
|
|
104
|
+
: TAccountGlobalConfig,
|
|
105
|
+
TAccountStakingConfig extends string
|
|
106
|
+
? WritableAccount<TAccountStakingConfig>
|
|
107
|
+
: TAccountStakingConfig,
|
|
108
|
+
TAccountUserStakePosition extends string
|
|
109
|
+
? WritableAccount<TAccountUserStakePosition>
|
|
110
|
+
: TAccountUserStakePosition,
|
|
111
|
+
TAccountUserTokenAccount extends string
|
|
112
|
+
? WritableAccount<TAccountUserTokenAccount>
|
|
113
|
+
: TAccountUserTokenAccount,
|
|
114
|
+
TAccountPoolVault extends string
|
|
115
|
+
? WritableAccount<TAccountPoolVault>
|
|
116
|
+
: TAccountPoolVault,
|
|
117
|
+
TAccountTokenProgram extends string
|
|
118
|
+
? ReadonlyAccount<TAccountTokenProgram>
|
|
119
|
+
: TAccountTokenProgram,
|
|
120
|
+
TAccountAssociatedTokenProgram extends string
|
|
121
|
+
? ReadonlyAccount<TAccountAssociatedTokenProgram>
|
|
122
|
+
: TAccountAssociatedTokenProgram,
|
|
123
|
+
TAccountSystemProgram extends string
|
|
124
|
+
? ReadonlyAccount<TAccountSystemProgram>
|
|
125
|
+
: TAccountSystemProgram,
|
|
126
|
+
TAccountEventAuthority extends string
|
|
127
|
+
? ReadonlyAccount<TAccountEventAuthority>
|
|
128
|
+
: TAccountEventAuthority,
|
|
129
|
+
TAccountProgram extends string
|
|
130
|
+
? ReadonlyAccount<TAccountProgram>
|
|
131
|
+
: TAccountProgram,
|
|
132
|
+
...TRemainingAccounts,
|
|
133
|
+
]
|
|
134
|
+
>;
|
|
135
|
+
|
|
136
|
+
export type StakeInstructionData = {
|
|
137
|
+
discriminator: ReadonlyUint8Array;
|
|
138
|
+
amount: bigint;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
export type StakeInstructionDataArgs = { amount: number | bigint };
|
|
142
|
+
|
|
143
|
+
export function getStakeInstructionDataEncoder(): FixedSizeEncoder<StakeInstructionDataArgs> {
|
|
144
|
+
return transformEncoder(
|
|
145
|
+
getStructEncoder([
|
|
146
|
+
['discriminator', fixEncoderSize(getBytesEncoder(), 8)],
|
|
147
|
+
['amount', getU64Encoder()],
|
|
148
|
+
]),
|
|
149
|
+
(value) => ({ ...value, discriminator: STAKE_DISCRIMINATOR }),
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export function getStakeInstructionDataDecoder(): FixedSizeDecoder<StakeInstructionData> {
|
|
154
|
+
return getStructDecoder([
|
|
155
|
+
['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
|
|
156
|
+
['amount', getU64Decoder()],
|
|
157
|
+
]);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export function getStakeInstructionDataCodec(): FixedSizeCodec<
|
|
161
|
+
StakeInstructionDataArgs,
|
|
162
|
+
StakeInstructionData
|
|
163
|
+
> {
|
|
164
|
+
return combineCodec(
|
|
165
|
+
getStakeInstructionDataEncoder(),
|
|
166
|
+
getStakeInstructionDataDecoder(),
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export type StakeAsyncInput<
|
|
171
|
+
TAccountUser extends string = string,
|
|
172
|
+
TAccountPayer extends string = string,
|
|
173
|
+
TAccountStakingMint extends string = string,
|
|
174
|
+
TAccountStakingConfig extends string = string,
|
|
175
|
+
TAccountUserStakePosition extends string = string,
|
|
176
|
+
TAccountUserTokenAccount extends string = string,
|
|
177
|
+
TAccountPoolVault extends string = string,
|
|
178
|
+
> = {
|
|
179
|
+
user: TransactionSigner<TAccountUser>;
|
|
180
|
+
payer: TransactionSigner<TAccountPayer>;
|
|
181
|
+
stakingMint: Address<TAccountStakingMint>;
|
|
182
|
+
stakingConfig?: Address<TAccountStakingConfig>;
|
|
183
|
+
userStakePosition?: Address<TAccountUserStakePosition>;
|
|
184
|
+
userTokenAccount?: Address<TAccountUserTokenAccount>;
|
|
185
|
+
poolVault?: Address<TAccountPoolVault>;
|
|
186
|
+
amount: StakeInstructionDataArgs['amount'];
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export async function getStakeInstructionAsync<
|
|
190
|
+
TAccountUser extends string,
|
|
191
|
+
TAccountPayer extends string,
|
|
192
|
+
TAccountStakingMint extends string,
|
|
193
|
+
TAccountStakingConfig extends string,
|
|
194
|
+
TAccountUserStakePosition extends string,
|
|
195
|
+
TAccountUserTokenAccount extends string,
|
|
196
|
+
TAccountPoolVault extends string,
|
|
197
|
+
>(
|
|
198
|
+
input: StakeAsyncInput<
|
|
199
|
+
TAccountUser,
|
|
200
|
+
TAccountPayer,
|
|
201
|
+
TAccountStakingMint,
|
|
202
|
+
TAccountStakingConfig,
|
|
203
|
+
TAccountUserStakePosition,
|
|
204
|
+
TAccountUserTokenAccount,
|
|
205
|
+
TAccountPoolVault
|
|
206
|
+
>,
|
|
207
|
+
): Promise<
|
|
208
|
+
StakeInstruction<
|
|
209
|
+
typeof SEND_NEXUS_PROGRAM_ADDRESS,
|
|
210
|
+
TAccountUser,
|
|
211
|
+
TAccountPayer,
|
|
212
|
+
TAccountStakingMint,
|
|
213
|
+
'3bycfBeRULfXYqcg3DmiYFBjv6mMVidMuqKdFZJTGdNr',
|
|
214
|
+
TAccountStakingConfig,
|
|
215
|
+
TAccountUserStakePosition,
|
|
216
|
+
TAccountUserTokenAccount,
|
|
217
|
+
TAccountPoolVault,
|
|
218
|
+
'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb',
|
|
219
|
+
'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL',
|
|
220
|
+
'11111111111111111111111111111111',
|
|
221
|
+
'BxA56yuUugqREwSEFVr117VKJ6JmVdPA7jm7MCXzDNJr',
|
|
222
|
+
'7rrCurqdWFesbzwtYPo95fM8waTtVXgXwCom45x1sfNX'
|
|
223
|
+
>
|
|
224
|
+
> {
|
|
225
|
+
// Program address.
|
|
226
|
+
const programAddress = SEND_NEXUS_PROGRAM_ADDRESS;
|
|
227
|
+
|
|
228
|
+
// Original accounts.
|
|
229
|
+
const originalAccounts = {
|
|
230
|
+
user: { value: input.user ?? null, isWritable: false },
|
|
231
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
232
|
+
stakingMint: { value: input.stakingMint ?? null, isWritable: false },
|
|
233
|
+
globalConfig: { value: null, isWritable: false },
|
|
234
|
+
stakingConfig: { value: input.stakingConfig ?? null, isWritable: true },
|
|
235
|
+
userStakePosition: {
|
|
236
|
+
value: input.userStakePosition ?? null,
|
|
237
|
+
isWritable: true,
|
|
238
|
+
},
|
|
239
|
+
userTokenAccount: {
|
|
240
|
+
value: input.userTokenAccount ?? null,
|
|
241
|
+
isWritable: true,
|
|
242
|
+
},
|
|
243
|
+
poolVault: { value: input.poolVault ?? null, isWritable: true },
|
|
244
|
+
tokenProgram: { value: null, isWritable: false },
|
|
245
|
+
associatedTokenProgram: { value: null, isWritable: false },
|
|
246
|
+
systemProgram: { value: null, isWritable: false },
|
|
247
|
+
eventAuthority: { value: null, isWritable: false },
|
|
248
|
+
program: { value: null, isWritable: false },
|
|
249
|
+
};
|
|
250
|
+
const accounts = originalAccounts as Record<
|
|
251
|
+
keyof typeof originalAccounts,
|
|
252
|
+
ResolvedInstructionAccount
|
|
253
|
+
>;
|
|
254
|
+
|
|
255
|
+
// Original args.
|
|
256
|
+
const args = { ...input };
|
|
257
|
+
|
|
258
|
+
// Resolve default values.
|
|
259
|
+
if (!accounts.globalConfig.value) {
|
|
260
|
+
accounts.globalConfig.value = GLOBAL_CONFIG_PDA_ADDRESS;
|
|
261
|
+
}
|
|
262
|
+
if (!accounts.stakingConfig.value) {
|
|
263
|
+
accounts.stakingConfig.value = STAKING_CONFIG_PDA_ADDRESS;
|
|
264
|
+
}
|
|
265
|
+
if (!accounts.userStakePosition.value) {
|
|
266
|
+
accounts.userStakePosition.value = await findUserStakePositionPda({
|
|
267
|
+
user: getAddressFromResolvedInstructionAccount(
|
|
268
|
+
'user',
|
|
269
|
+
accounts.user.value,
|
|
270
|
+
),
|
|
271
|
+
stakingMint: getAddressFromResolvedInstructionAccount(
|
|
272
|
+
'stakingMint',
|
|
273
|
+
accounts.stakingMint.value,
|
|
274
|
+
),
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
if (!accounts.userTokenAccount.value) {
|
|
278
|
+
accounts.userTokenAccount.value = await getProgramDerivedAddress({
|
|
279
|
+
programAddress:
|
|
280
|
+
'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL' as Address<'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL'>,
|
|
281
|
+
seeds: [
|
|
282
|
+
getAddressEncoder().encode(
|
|
283
|
+
getAddressFromResolvedInstructionAccount(
|
|
284
|
+
'user',
|
|
285
|
+
accounts.user.value,
|
|
286
|
+
),
|
|
287
|
+
),
|
|
288
|
+
getAddressEncoder().encode(
|
|
289
|
+
address('TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb'),
|
|
290
|
+
),
|
|
291
|
+
getAddressEncoder().encode(
|
|
292
|
+
getAddressFromResolvedInstructionAccount(
|
|
293
|
+
'stakingMint',
|
|
294
|
+
accounts.stakingMint.value,
|
|
295
|
+
),
|
|
296
|
+
),
|
|
297
|
+
],
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
if (!accounts.poolVault.value) {
|
|
301
|
+
accounts.poolVault.value = await getProgramDerivedAddress({
|
|
302
|
+
programAddress:
|
|
303
|
+
'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL' as Address<'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL'>,
|
|
304
|
+
seeds: [
|
|
305
|
+
getAddressEncoder().encode(
|
|
306
|
+
getAddressFromResolvedInstructionAccount(
|
|
307
|
+
'stakingConfig',
|
|
308
|
+
accounts.stakingConfig.value,
|
|
309
|
+
),
|
|
310
|
+
),
|
|
311
|
+
getAddressEncoder().encode(
|
|
312
|
+
address('TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb'),
|
|
313
|
+
),
|
|
314
|
+
getAddressEncoder().encode(
|
|
315
|
+
getAddressFromResolvedInstructionAccount(
|
|
316
|
+
'stakingMint',
|
|
317
|
+
accounts.stakingMint.value,
|
|
318
|
+
),
|
|
319
|
+
),
|
|
320
|
+
],
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
if (!accounts.tokenProgram.value) {
|
|
324
|
+
accounts.tokenProgram.value =
|
|
325
|
+
'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb' as Address<'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb'>;
|
|
326
|
+
}
|
|
327
|
+
if (!accounts.associatedTokenProgram.value) {
|
|
328
|
+
accounts.associatedTokenProgram.value =
|
|
329
|
+
'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL' as Address<'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL'>;
|
|
330
|
+
}
|
|
331
|
+
if (!accounts.systemProgram.value) {
|
|
332
|
+
accounts.systemProgram.value =
|
|
333
|
+
'11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;
|
|
334
|
+
}
|
|
335
|
+
if (!accounts.eventAuthority.value) {
|
|
336
|
+
accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS;
|
|
337
|
+
}
|
|
338
|
+
if (!accounts.program.value) {
|
|
339
|
+
accounts.program.value =
|
|
340
|
+
'7rrCurqdWFesbzwtYPo95fM8waTtVXgXwCom45x1sfNX' as Address<'7rrCurqdWFesbzwtYPo95fM8waTtVXgXwCom45x1sfNX'>;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
|
|
344
|
+
return Object.freeze({
|
|
345
|
+
accounts: [
|
|
346
|
+
getAccountMeta('user', accounts.user),
|
|
347
|
+
getAccountMeta('payer', accounts.payer),
|
|
348
|
+
getAccountMeta('stakingMint', accounts.stakingMint),
|
|
349
|
+
getAccountMeta('globalConfig', accounts.globalConfig),
|
|
350
|
+
getAccountMeta('stakingConfig', accounts.stakingConfig),
|
|
351
|
+
getAccountMeta('userStakePosition', accounts.userStakePosition),
|
|
352
|
+
getAccountMeta('userTokenAccount', accounts.userTokenAccount),
|
|
353
|
+
getAccountMeta('poolVault', accounts.poolVault),
|
|
354
|
+
getAccountMeta('tokenProgram', accounts.tokenProgram),
|
|
355
|
+
getAccountMeta(
|
|
356
|
+
'associatedTokenProgram',
|
|
357
|
+
accounts.associatedTokenProgram,
|
|
358
|
+
),
|
|
359
|
+
getAccountMeta('systemProgram', accounts.systemProgram),
|
|
360
|
+
getAccountMeta('eventAuthority', accounts.eventAuthority),
|
|
361
|
+
getAccountMeta('program', accounts.program),
|
|
362
|
+
],
|
|
363
|
+
data: getStakeInstructionDataEncoder().encode(
|
|
364
|
+
args as StakeInstructionDataArgs,
|
|
365
|
+
),
|
|
366
|
+
programAddress,
|
|
367
|
+
} as StakeInstruction<
|
|
368
|
+
typeof SEND_NEXUS_PROGRAM_ADDRESS,
|
|
369
|
+
TAccountUser,
|
|
370
|
+
TAccountPayer,
|
|
371
|
+
TAccountStakingMint,
|
|
372
|
+
'3bycfBeRULfXYqcg3DmiYFBjv6mMVidMuqKdFZJTGdNr',
|
|
373
|
+
TAccountStakingConfig,
|
|
374
|
+
TAccountUserStakePosition,
|
|
375
|
+
TAccountUserTokenAccount,
|
|
376
|
+
TAccountPoolVault,
|
|
377
|
+
'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb',
|
|
378
|
+
'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL',
|
|
379
|
+
'11111111111111111111111111111111',
|
|
380
|
+
'BxA56yuUugqREwSEFVr117VKJ6JmVdPA7jm7MCXzDNJr',
|
|
381
|
+
'7rrCurqdWFesbzwtYPo95fM8waTtVXgXwCom45x1sfNX'
|
|
382
|
+
>);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
export type StakeInput<
|
|
386
|
+
TAccountUser extends string = string,
|
|
387
|
+
TAccountPayer extends string = string,
|
|
388
|
+
TAccountStakingMint extends string = string,
|
|
389
|
+
TAccountStakingConfig extends string = string,
|
|
390
|
+
TAccountUserStakePosition extends string = string,
|
|
391
|
+
TAccountUserTokenAccount extends string = string,
|
|
392
|
+
TAccountPoolVault extends string = string,
|
|
393
|
+
> = {
|
|
394
|
+
user: TransactionSigner<TAccountUser>;
|
|
395
|
+
payer: TransactionSigner<TAccountPayer>;
|
|
396
|
+
stakingMint: Address<TAccountStakingMint>;
|
|
397
|
+
stakingConfig?: Address<TAccountStakingConfig>;
|
|
398
|
+
userStakePosition: Address<TAccountUserStakePosition>;
|
|
399
|
+
userTokenAccount: Address<TAccountUserTokenAccount>;
|
|
400
|
+
poolVault: Address<TAccountPoolVault>;
|
|
401
|
+
amount: StakeInstructionDataArgs['amount'];
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
export function getStakeInstruction<
|
|
405
|
+
TAccountUser extends string,
|
|
406
|
+
TAccountPayer extends string,
|
|
407
|
+
TAccountStakingMint extends string,
|
|
408
|
+
TAccountStakingConfig extends string,
|
|
409
|
+
TAccountUserStakePosition extends string,
|
|
410
|
+
TAccountUserTokenAccount extends string,
|
|
411
|
+
TAccountPoolVault extends string,
|
|
412
|
+
>(
|
|
413
|
+
input: StakeInput<
|
|
414
|
+
TAccountUser,
|
|
415
|
+
TAccountPayer,
|
|
416
|
+
TAccountStakingMint,
|
|
417
|
+
TAccountStakingConfig,
|
|
418
|
+
TAccountUserStakePosition,
|
|
419
|
+
TAccountUserTokenAccount,
|
|
420
|
+
TAccountPoolVault
|
|
421
|
+
>,
|
|
422
|
+
): StakeInstruction<
|
|
423
|
+
typeof SEND_NEXUS_PROGRAM_ADDRESS,
|
|
424
|
+
TAccountUser,
|
|
425
|
+
TAccountPayer,
|
|
426
|
+
TAccountStakingMint,
|
|
427
|
+
'3bycfBeRULfXYqcg3DmiYFBjv6mMVidMuqKdFZJTGdNr',
|
|
428
|
+
TAccountStakingConfig,
|
|
429
|
+
TAccountUserStakePosition,
|
|
430
|
+
TAccountUserTokenAccount,
|
|
431
|
+
TAccountPoolVault,
|
|
432
|
+
'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb',
|
|
433
|
+
'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL',
|
|
434
|
+
'11111111111111111111111111111111',
|
|
435
|
+
'BxA56yuUugqREwSEFVr117VKJ6JmVdPA7jm7MCXzDNJr',
|
|
436
|
+
'7rrCurqdWFesbzwtYPo95fM8waTtVXgXwCom45x1sfNX'
|
|
437
|
+
> {
|
|
438
|
+
// Program address.
|
|
439
|
+
const programAddress = SEND_NEXUS_PROGRAM_ADDRESS;
|
|
440
|
+
|
|
441
|
+
// Original accounts.
|
|
442
|
+
const originalAccounts = {
|
|
443
|
+
user: { value: input.user ?? null, isWritable: false },
|
|
444
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
445
|
+
stakingMint: { value: input.stakingMint ?? null, isWritable: false },
|
|
446
|
+
globalConfig: { value: null, isWritable: false },
|
|
447
|
+
stakingConfig: { value: input.stakingConfig ?? null, isWritable: true },
|
|
448
|
+
userStakePosition: {
|
|
449
|
+
value: input.userStakePosition ?? null,
|
|
450
|
+
isWritable: true,
|
|
451
|
+
},
|
|
452
|
+
userTokenAccount: {
|
|
453
|
+
value: input.userTokenAccount ?? null,
|
|
454
|
+
isWritable: true,
|
|
455
|
+
},
|
|
456
|
+
poolVault: { value: input.poolVault ?? null, isWritable: true },
|
|
457
|
+
tokenProgram: { value: null, isWritable: false },
|
|
458
|
+
associatedTokenProgram: { value: null, isWritable: false },
|
|
459
|
+
systemProgram: { value: null, isWritable: false },
|
|
460
|
+
eventAuthority: { value: null, isWritable: false },
|
|
461
|
+
program: { value: null, isWritable: false },
|
|
462
|
+
};
|
|
463
|
+
const accounts = originalAccounts as Record<
|
|
464
|
+
keyof typeof originalAccounts,
|
|
465
|
+
ResolvedInstructionAccount
|
|
466
|
+
>;
|
|
467
|
+
|
|
468
|
+
// Original args.
|
|
469
|
+
const args = { ...input };
|
|
470
|
+
|
|
471
|
+
// Resolve default values.
|
|
472
|
+
if (!accounts.globalConfig.value) {
|
|
473
|
+
accounts.globalConfig.value = GLOBAL_CONFIG_PDA_ADDRESS;
|
|
474
|
+
}
|
|
475
|
+
if (!accounts.stakingConfig.value) {
|
|
476
|
+
accounts.stakingConfig.value = STAKING_CONFIG_PDA_ADDRESS;
|
|
477
|
+
}
|
|
478
|
+
if (!accounts.tokenProgram.value) {
|
|
479
|
+
accounts.tokenProgram.value =
|
|
480
|
+
'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb' as Address<'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb'>;
|
|
481
|
+
}
|
|
482
|
+
if (!accounts.associatedTokenProgram.value) {
|
|
483
|
+
accounts.associatedTokenProgram.value =
|
|
484
|
+
'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL' as Address<'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL'>;
|
|
485
|
+
}
|
|
486
|
+
if (!accounts.systemProgram.value) {
|
|
487
|
+
accounts.systemProgram.value =
|
|
488
|
+
'11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;
|
|
489
|
+
}
|
|
490
|
+
if (!accounts.eventAuthority.value) {
|
|
491
|
+
accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS;
|
|
492
|
+
}
|
|
493
|
+
if (!accounts.program.value) {
|
|
494
|
+
accounts.program.value =
|
|
495
|
+
'7rrCurqdWFesbzwtYPo95fM8waTtVXgXwCom45x1sfNX' as Address<'7rrCurqdWFesbzwtYPo95fM8waTtVXgXwCom45x1sfNX'>;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
|
|
499
|
+
return Object.freeze({
|
|
500
|
+
accounts: [
|
|
501
|
+
getAccountMeta('user', accounts.user),
|
|
502
|
+
getAccountMeta('payer', accounts.payer),
|
|
503
|
+
getAccountMeta('stakingMint', accounts.stakingMint),
|
|
504
|
+
getAccountMeta('globalConfig', accounts.globalConfig),
|
|
505
|
+
getAccountMeta('stakingConfig', accounts.stakingConfig),
|
|
506
|
+
getAccountMeta('userStakePosition', accounts.userStakePosition),
|
|
507
|
+
getAccountMeta('userTokenAccount', accounts.userTokenAccount),
|
|
508
|
+
getAccountMeta('poolVault', accounts.poolVault),
|
|
509
|
+
getAccountMeta('tokenProgram', accounts.tokenProgram),
|
|
510
|
+
getAccountMeta(
|
|
511
|
+
'associatedTokenProgram',
|
|
512
|
+
accounts.associatedTokenProgram,
|
|
513
|
+
),
|
|
514
|
+
getAccountMeta('systemProgram', accounts.systemProgram),
|
|
515
|
+
getAccountMeta('eventAuthority', accounts.eventAuthority),
|
|
516
|
+
getAccountMeta('program', accounts.program),
|
|
517
|
+
],
|
|
518
|
+
data: getStakeInstructionDataEncoder().encode(
|
|
519
|
+
args as StakeInstructionDataArgs,
|
|
520
|
+
),
|
|
521
|
+
programAddress,
|
|
522
|
+
} as StakeInstruction<
|
|
523
|
+
typeof SEND_NEXUS_PROGRAM_ADDRESS,
|
|
524
|
+
TAccountUser,
|
|
525
|
+
TAccountPayer,
|
|
526
|
+
TAccountStakingMint,
|
|
527
|
+
'3bycfBeRULfXYqcg3DmiYFBjv6mMVidMuqKdFZJTGdNr',
|
|
528
|
+
TAccountStakingConfig,
|
|
529
|
+
TAccountUserStakePosition,
|
|
530
|
+
TAccountUserTokenAccount,
|
|
531
|
+
TAccountPoolVault,
|
|
532
|
+
'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb',
|
|
533
|
+
'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL',
|
|
534
|
+
'11111111111111111111111111111111',
|
|
535
|
+
'BxA56yuUugqREwSEFVr117VKJ6JmVdPA7jm7MCXzDNJr',
|
|
536
|
+
'7rrCurqdWFesbzwtYPo95fM8waTtVXgXwCom45x1sfNX'
|
|
537
|
+
>);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
export type ParsedStakeInstruction<
|
|
541
|
+
TProgram extends string = typeof SEND_NEXUS_PROGRAM_ADDRESS,
|
|
542
|
+
TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],
|
|
543
|
+
> = {
|
|
544
|
+
programAddress: Address<TProgram>;
|
|
545
|
+
accounts: {
|
|
546
|
+
user: TAccountMetas[0];
|
|
547
|
+
payer: TAccountMetas[1];
|
|
548
|
+
stakingMint: TAccountMetas[2];
|
|
549
|
+
globalConfig: TAccountMetas[3];
|
|
550
|
+
stakingConfig: TAccountMetas[4];
|
|
551
|
+
userStakePosition: TAccountMetas[5];
|
|
552
|
+
userTokenAccount: TAccountMetas[6];
|
|
553
|
+
poolVault: TAccountMetas[7];
|
|
554
|
+
tokenProgram: TAccountMetas[8];
|
|
555
|
+
associatedTokenProgram: TAccountMetas[9];
|
|
556
|
+
systemProgram: TAccountMetas[10];
|
|
557
|
+
eventAuthority: TAccountMetas[11];
|
|
558
|
+
program: TAccountMetas[12];
|
|
559
|
+
};
|
|
560
|
+
data: StakeInstructionData;
|
|
561
|
+
};
|
|
562
|
+
|
|
563
|
+
export function parseStakeInstruction<
|
|
564
|
+
TProgram extends string,
|
|
565
|
+
TAccountMetas extends readonly AccountMeta[],
|
|
566
|
+
>(
|
|
567
|
+
instruction: Instruction<TProgram> &
|
|
568
|
+
InstructionWithAccounts<TAccountMetas> &
|
|
569
|
+
InstructionWithData<ReadonlyUint8Array>,
|
|
570
|
+
): ParsedStakeInstruction<TProgram, TAccountMetas> {
|
|
571
|
+
assertIsInstructionForProgram(instruction, SEND_NEXUS_PROGRAM_ADDRESS);
|
|
572
|
+
if (!containsBytes(instruction.data, STAKE_DISCRIMINATOR, 0)) {
|
|
573
|
+
const error = new Error(
|
|
574
|
+
`parseStakeInstruction: instruction data does not match the Stake discriminator`,
|
|
575
|
+
);
|
|
576
|
+
error.name = 'InstructionDiscriminatorMismatchError';
|
|
577
|
+
throw error;
|
|
578
|
+
}
|
|
579
|
+
if (instruction.accounts.length < 13) {
|
|
580
|
+
throw new SolanaError(
|
|
581
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
582
|
+
{
|
|
583
|
+
actualAccountMetas: instruction.accounts.length,
|
|
584
|
+
expectedAccountMetas: 13,
|
|
585
|
+
},
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
let accountIndex = 0;
|
|
589
|
+
const getNextAccount = () => {
|
|
590
|
+
const accountMeta = (instruction.accounts as TAccountMetas)[
|
|
591
|
+
accountIndex
|
|
592
|
+
]!;
|
|
593
|
+
accountIndex += 1;
|
|
594
|
+
return accountMeta;
|
|
595
|
+
};
|
|
596
|
+
return {
|
|
597
|
+
programAddress: instruction.programAddress,
|
|
598
|
+
accounts: {
|
|
599
|
+
user: getNextAccount(),
|
|
600
|
+
payer: getNextAccount(),
|
|
601
|
+
stakingMint: getNextAccount(),
|
|
602
|
+
globalConfig: getNextAccount(),
|
|
603
|
+
stakingConfig: getNextAccount(),
|
|
604
|
+
userStakePosition: getNextAccount(),
|
|
605
|
+
userTokenAccount: getNextAccount(),
|
|
606
|
+
poolVault: getNextAccount(),
|
|
607
|
+
tokenProgram: getNextAccount(),
|
|
608
|
+
associatedTokenProgram: getNextAccount(),
|
|
609
|
+
systemProgram: getNextAccount(),
|
|
610
|
+
eventAuthority: getNextAccount(),
|
|
611
|
+
program: getNextAccount(),
|
|
612
|
+
},
|
|
613
|
+
data: getStakeInstructionDataDecoder().decode(instruction.data),
|
|
614
|
+
};
|
|
615
|
+
}
|