@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,640 @@
|
|
|
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
|
+
assertIsInstructionForProgram,
|
|
11
|
+
combineCodec,
|
|
12
|
+
containsBytes,
|
|
13
|
+
fixDecoderSize,
|
|
14
|
+
fixEncoderSize,
|
|
15
|
+
getAddressEncoder,
|
|
16
|
+
getBytesDecoder,
|
|
17
|
+
getBytesEncoder,
|
|
18
|
+
getProgramDerivedAddress,
|
|
19
|
+
getStructDecoder,
|
|
20
|
+
getStructEncoder,
|
|
21
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
22
|
+
SolanaError,
|
|
23
|
+
transformEncoder,
|
|
24
|
+
type AccountMeta,
|
|
25
|
+
type AccountSignerMeta,
|
|
26
|
+
type Address,
|
|
27
|
+
type FixedSizeCodec,
|
|
28
|
+
type FixedSizeDecoder,
|
|
29
|
+
type FixedSizeEncoder,
|
|
30
|
+
type Instruction,
|
|
31
|
+
type InstructionWithAccounts,
|
|
32
|
+
type InstructionWithData,
|
|
33
|
+
type ReadonlyAccount,
|
|
34
|
+
type ReadonlyUint8Array,
|
|
35
|
+
type TransactionSigner,
|
|
36
|
+
type WritableAccount,
|
|
37
|
+
type WritableSignerAccount,
|
|
38
|
+
} from '@solana/kit';
|
|
39
|
+
import {
|
|
40
|
+
getAccountMetaFactory,
|
|
41
|
+
getAddressFromResolvedInstructionAccount,
|
|
42
|
+
type ResolvedInstructionAccount,
|
|
43
|
+
} from '@solana/program-client-core';
|
|
44
|
+
import {
|
|
45
|
+
EVENT_AUTHORITY_PDA_ADDRESS,
|
|
46
|
+
findBondingCurvePda,
|
|
47
|
+
findRewardAccrualPda,
|
|
48
|
+
} from '../pdas/index.js';
|
|
49
|
+
import { SEND_LAUNCHPAD_PROGRAM_ADDRESS } from '../programs/index.js';
|
|
50
|
+
|
|
51
|
+
export const CLAIM_PROTOCOL_FEES_DISCRIMINATOR: ReadonlyUint8Array =
|
|
52
|
+
new Uint8Array([34, 142, 219, 112, 109, 54, 133, 23]);
|
|
53
|
+
|
|
54
|
+
export function getClaimProtocolFeesDiscriminatorBytes(): ReadonlyUint8Array {
|
|
55
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
56
|
+
CLAIM_PROTOCOL_FEES_DISCRIMINATOR,
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export type ClaimProtocolFeesInstruction<
|
|
61
|
+
TProgram extends string = typeof SEND_LAUNCHPAD_PROGRAM_ADDRESS,
|
|
62
|
+
TAccountPayer extends string | AccountMeta<string> = string,
|
|
63
|
+
TAccountBondingCurve extends string | AccountMeta<string> = string,
|
|
64
|
+
TAccountBaseMint extends string | AccountMeta<string> = string,
|
|
65
|
+
TAccountQuoteMint extends string | AccountMeta<string> = string,
|
|
66
|
+
TAccountQuoteVault extends string | AccountMeta<string> = string,
|
|
67
|
+
TAccountNexusStakingConfig extends string | AccountMeta<string> =
|
|
68
|
+
'9WUowYRb6KAWjWVB5KMmTngBidZXEXgQcQRTXbhxeGbF',
|
|
69
|
+
TAccountStakingRewardState extends string | AccountMeta<string> = string,
|
|
70
|
+
TAccountRewardAccrual extends string | AccountMeta<string> = string,
|
|
71
|
+
TAccountStakingVault extends string | AccountMeta<string> = string,
|
|
72
|
+
TAccountQuoteTokenProgram extends string | AccountMeta<string> = string,
|
|
73
|
+
TAccountSystemProgram extends string | AccountMeta<string> =
|
|
74
|
+
'11111111111111111111111111111111',
|
|
75
|
+
TAccountEventAuthority extends string | AccountMeta<string> =
|
|
76
|
+
'FJVebqCthxH6JM8vvkJb7yRYA7Emsib1C1vu4ZePSP3T',
|
|
77
|
+
TAccountProgram extends string | AccountMeta<string> =
|
|
78
|
+
'5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP',
|
|
79
|
+
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
|
|
80
|
+
> = Instruction<TProgram> &
|
|
81
|
+
InstructionWithData<ReadonlyUint8Array> &
|
|
82
|
+
InstructionWithAccounts<
|
|
83
|
+
[
|
|
84
|
+
TAccountPayer extends string
|
|
85
|
+
? WritableSignerAccount<TAccountPayer> &
|
|
86
|
+
AccountSignerMeta<TAccountPayer>
|
|
87
|
+
: TAccountPayer,
|
|
88
|
+
TAccountBondingCurve extends string
|
|
89
|
+
? WritableAccount<TAccountBondingCurve>
|
|
90
|
+
: TAccountBondingCurve,
|
|
91
|
+
TAccountBaseMint extends string
|
|
92
|
+
? ReadonlyAccount<TAccountBaseMint>
|
|
93
|
+
: TAccountBaseMint,
|
|
94
|
+
TAccountQuoteMint extends string
|
|
95
|
+
? ReadonlyAccount<TAccountQuoteMint>
|
|
96
|
+
: TAccountQuoteMint,
|
|
97
|
+
TAccountQuoteVault extends string
|
|
98
|
+
? WritableAccount<TAccountQuoteVault>
|
|
99
|
+
: TAccountQuoteVault,
|
|
100
|
+
TAccountNexusStakingConfig extends string
|
|
101
|
+
? ReadonlyAccount<TAccountNexusStakingConfig>
|
|
102
|
+
: TAccountNexusStakingConfig,
|
|
103
|
+
TAccountStakingRewardState extends string
|
|
104
|
+
? ReadonlyAccount<TAccountStakingRewardState>
|
|
105
|
+
: TAccountStakingRewardState,
|
|
106
|
+
TAccountRewardAccrual extends string
|
|
107
|
+
? WritableAccount<TAccountRewardAccrual>
|
|
108
|
+
: TAccountRewardAccrual,
|
|
109
|
+
TAccountStakingVault extends string
|
|
110
|
+
? WritableAccount<TAccountStakingVault>
|
|
111
|
+
: TAccountStakingVault,
|
|
112
|
+
TAccountQuoteTokenProgram extends string
|
|
113
|
+
? ReadonlyAccount<TAccountQuoteTokenProgram>
|
|
114
|
+
: TAccountQuoteTokenProgram,
|
|
115
|
+
TAccountSystemProgram extends string
|
|
116
|
+
? ReadonlyAccount<TAccountSystemProgram>
|
|
117
|
+
: TAccountSystemProgram,
|
|
118
|
+
TAccountEventAuthority extends string
|
|
119
|
+
? ReadonlyAccount<TAccountEventAuthority>
|
|
120
|
+
: TAccountEventAuthority,
|
|
121
|
+
TAccountProgram extends string
|
|
122
|
+
? ReadonlyAccount<TAccountProgram>
|
|
123
|
+
: TAccountProgram,
|
|
124
|
+
...TRemainingAccounts,
|
|
125
|
+
]
|
|
126
|
+
>;
|
|
127
|
+
|
|
128
|
+
export type ClaimProtocolFeesInstructionData = {
|
|
129
|
+
discriminator: ReadonlyUint8Array;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export type ClaimProtocolFeesInstructionDataArgs = {};
|
|
133
|
+
|
|
134
|
+
export function getClaimProtocolFeesInstructionDataEncoder(): FixedSizeEncoder<ClaimProtocolFeesInstructionDataArgs> {
|
|
135
|
+
return transformEncoder(
|
|
136
|
+
getStructEncoder([
|
|
137
|
+
['discriminator', fixEncoderSize(getBytesEncoder(), 8)],
|
|
138
|
+
]),
|
|
139
|
+
(value) => ({
|
|
140
|
+
...value,
|
|
141
|
+
discriminator: CLAIM_PROTOCOL_FEES_DISCRIMINATOR,
|
|
142
|
+
}),
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export function getClaimProtocolFeesInstructionDataDecoder(): FixedSizeDecoder<ClaimProtocolFeesInstructionData> {
|
|
147
|
+
return getStructDecoder([
|
|
148
|
+
['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
|
|
149
|
+
]);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export function getClaimProtocolFeesInstructionDataCodec(): FixedSizeCodec<
|
|
153
|
+
ClaimProtocolFeesInstructionDataArgs,
|
|
154
|
+
ClaimProtocolFeesInstructionData
|
|
155
|
+
> {
|
|
156
|
+
return combineCodec(
|
|
157
|
+
getClaimProtocolFeesInstructionDataEncoder(),
|
|
158
|
+
getClaimProtocolFeesInstructionDataDecoder(),
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export type ClaimProtocolFeesAsyncInput<
|
|
163
|
+
TAccountPayer extends string = string,
|
|
164
|
+
TAccountBondingCurve extends string = string,
|
|
165
|
+
TAccountBaseMint extends string = string,
|
|
166
|
+
TAccountQuoteMint extends string = string,
|
|
167
|
+
TAccountQuoteVault extends string = string,
|
|
168
|
+
TAccountNexusStakingConfig extends string = string,
|
|
169
|
+
TAccountStakingRewardState extends string = string,
|
|
170
|
+
TAccountRewardAccrual extends string = string,
|
|
171
|
+
TAccountStakingVault extends string = string,
|
|
172
|
+
TAccountQuoteTokenProgram extends string = string,
|
|
173
|
+
> = {
|
|
174
|
+
payer: TransactionSigner<TAccountPayer>;
|
|
175
|
+
bondingCurve?: Address<TAccountBondingCurve>;
|
|
176
|
+
baseMint: Address<TAccountBaseMint>;
|
|
177
|
+
quoteMint: Address<TAccountQuoteMint>;
|
|
178
|
+
quoteVault?: Address<TAccountQuoteVault>;
|
|
179
|
+
nexusStakingConfig?: Address<TAccountNexusStakingConfig>;
|
|
180
|
+
stakingRewardState?: Address<TAccountStakingRewardState>;
|
|
181
|
+
rewardAccrual?: Address<TAccountRewardAccrual>;
|
|
182
|
+
stakingVault?: Address<TAccountStakingVault>;
|
|
183
|
+
quoteTokenProgram: Address<TAccountQuoteTokenProgram>;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
export async function getClaimProtocolFeesInstructionAsync<
|
|
187
|
+
TAccountPayer extends string,
|
|
188
|
+
TAccountBondingCurve extends string,
|
|
189
|
+
TAccountBaseMint extends string,
|
|
190
|
+
TAccountQuoteMint extends string,
|
|
191
|
+
TAccountQuoteVault extends string,
|
|
192
|
+
TAccountNexusStakingConfig extends string,
|
|
193
|
+
TAccountStakingRewardState extends string,
|
|
194
|
+
TAccountRewardAccrual extends string,
|
|
195
|
+
TAccountStakingVault extends string,
|
|
196
|
+
TAccountQuoteTokenProgram extends string,
|
|
197
|
+
>(
|
|
198
|
+
input: ClaimProtocolFeesAsyncInput<
|
|
199
|
+
TAccountPayer,
|
|
200
|
+
TAccountBondingCurve,
|
|
201
|
+
TAccountBaseMint,
|
|
202
|
+
TAccountQuoteMint,
|
|
203
|
+
TAccountQuoteVault,
|
|
204
|
+
TAccountNexusStakingConfig,
|
|
205
|
+
TAccountStakingRewardState,
|
|
206
|
+
TAccountRewardAccrual,
|
|
207
|
+
TAccountStakingVault,
|
|
208
|
+
TAccountQuoteTokenProgram
|
|
209
|
+
>,
|
|
210
|
+
): Promise<
|
|
211
|
+
ClaimProtocolFeesInstruction<
|
|
212
|
+
typeof SEND_LAUNCHPAD_PROGRAM_ADDRESS,
|
|
213
|
+
TAccountPayer,
|
|
214
|
+
TAccountBondingCurve,
|
|
215
|
+
TAccountBaseMint,
|
|
216
|
+
TAccountQuoteMint,
|
|
217
|
+
TAccountQuoteVault,
|
|
218
|
+
TAccountNexusStakingConfig,
|
|
219
|
+
TAccountStakingRewardState,
|
|
220
|
+
TAccountRewardAccrual,
|
|
221
|
+
TAccountStakingVault,
|
|
222
|
+
TAccountQuoteTokenProgram,
|
|
223
|
+
'11111111111111111111111111111111',
|
|
224
|
+
'FJVebqCthxH6JM8vvkJb7yRYA7Emsib1C1vu4ZePSP3T',
|
|
225
|
+
'5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP'
|
|
226
|
+
>
|
|
227
|
+
> {
|
|
228
|
+
// Program address.
|
|
229
|
+
const programAddress = SEND_LAUNCHPAD_PROGRAM_ADDRESS;
|
|
230
|
+
|
|
231
|
+
// Original accounts.
|
|
232
|
+
const originalAccounts = {
|
|
233
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
234
|
+
bondingCurve: { value: input.bondingCurve ?? null, isWritable: true },
|
|
235
|
+
baseMint: { value: input.baseMint ?? null, isWritable: false },
|
|
236
|
+
quoteMint: { value: input.quoteMint ?? null, isWritable: false },
|
|
237
|
+
quoteVault: { value: input.quoteVault ?? null, isWritable: true },
|
|
238
|
+
nexusStakingConfig: {
|
|
239
|
+
value: input.nexusStakingConfig ?? null,
|
|
240
|
+
isWritable: false,
|
|
241
|
+
},
|
|
242
|
+
stakingRewardState: {
|
|
243
|
+
value: input.stakingRewardState ?? null,
|
|
244
|
+
isWritable: false,
|
|
245
|
+
},
|
|
246
|
+
rewardAccrual: { value: input.rewardAccrual ?? null, isWritable: true },
|
|
247
|
+
stakingVault: { value: input.stakingVault ?? null, isWritable: true },
|
|
248
|
+
quoteTokenProgram: {
|
|
249
|
+
value: input.quoteTokenProgram ?? null,
|
|
250
|
+
isWritable: false,
|
|
251
|
+
},
|
|
252
|
+
systemProgram: { value: null, isWritable: false },
|
|
253
|
+
eventAuthority: { value: null, isWritable: false },
|
|
254
|
+
program: { value: null, isWritable: false },
|
|
255
|
+
};
|
|
256
|
+
const accounts = originalAccounts as Record<
|
|
257
|
+
keyof typeof originalAccounts,
|
|
258
|
+
ResolvedInstructionAccount
|
|
259
|
+
>;
|
|
260
|
+
|
|
261
|
+
// Resolve default values.
|
|
262
|
+
if (!accounts.bondingCurve.value) {
|
|
263
|
+
accounts.bondingCurve.value = await findBondingCurvePda({
|
|
264
|
+
baseMint: getAddressFromResolvedInstructionAccount(
|
|
265
|
+
'baseMint',
|
|
266
|
+
accounts.baseMint.value,
|
|
267
|
+
),
|
|
268
|
+
quoteMint: getAddressFromResolvedInstructionAccount(
|
|
269
|
+
'quoteMint',
|
|
270
|
+
accounts.quoteMint.value,
|
|
271
|
+
),
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
if (!accounts.quoteVault.value) {
|
|
275
|
+
accounts.quoteVault.value = await getProgramDerivedAddress({
|
|
276
|
+
programAddress:
|
|
277
|
+
'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL' as Address<'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL'>,
|
|
278
|
+
seeds: [
|
|
279
|
+
getAddressEncoder().encode(
|
|
280
|
+
getAddressFromResolvedInstructionAccount(
|
|
281
|
+
'bondingCurve',
|
|
282
|
+
accounts.bondingCurve.value,
|
|
283
|
+
),
|
|
284
|
+
),
|
|
285
|
+
getAddressEncoder().encode(
|
|
286
|
+
getAddressFromResolvedInstructionAccount(
|
|
287
|
+
'quoteTokenProgram',
|
|
288
|
+
accounts.quoteTokenProgram.value,
|
|
289
|
+
),
|
|
290
|
+
),
|
|
291
|
+
getAddressEncoder().encode(
|
|
292
|
+
getAddressFromResolvedInstructionAccount(
|
|
293
|
+
'quoteMint',
|
|
294
|
+
accounts.quoteMint.value,
|
|
295
|
+
),
|
|
296
|
+
),
|
|
297
|
+
],
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
if (!accounts.nexusStakingConfig.value) {
|
|
301
|
+
accounts.nexusStakingConfig.value =
|
|
302
|
+
'9WUowYRb6KAWjWVB5KMmTngBidZXEXgQcQRTXbhxeGbF' as Address<'9WUowYRb6KAWjWVB5KMmTngBidZXEXgQcQRTXbhxeGbF'>;
|
|
303
|
+
}
|
|
304
|
+
if (!accounts.stakingRewardState.value) {
|
|
305
|
+
accounts.stakingRewardState.value = await getProgramDerivedAddress({
|
|
306
|
+
programAddress:
|
|
307
|
+
'7rrCurqdWFesbzwtYPo95fM8waTtVXgXwCom45x1sfNX' as Address<'7rrCurqdWFesbzwtYPo95fM8waTtVXgXwCom45x1sfNX'>,
|
|
308
|
+
seeds: [
|
|
309
|
+
getBytesEncoder().encode(
|
|
310
|
+
new Uint8Array([114, 101, 119, 97, 114, 100]),
|
|
311
|
+
),
|
|
312
|
+
getAddressEncoder().encode(
|
|
313
|
+
getAddressFromResolvedInstructionAccount(
|
|
314
|
+
'nexusStakingConfig',
|
|
315
|
+
accounts.nexusStakingConfig.value,
|
|
316
|
+
),
|
|
317
|
+
),
|
|
318
|
+
getAddressEncoder().encode(
|
|
319
|
+
getAddressFromResolvedInstructionAccount(
|
|
320
|
+
'quoteMint',
|
|
321
|
+
accounts.quoteMint.value,
|
|
322
|
+
),
|
|
323
|
+
),
|
|
324
|
+
],
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
if (!accounts.rewardAccrual.value) {
|
|
328
|
+
accounts.rewardAccrual.value = await findRewardAccrualPda({
|
|
329
|
+
quoteMint: getAddressFromResolvedInstructionAccount(
|
|
330
|
+
'quoteMint',
|
|
331
|
+
accounts.quoteMint.value,
|
|
332
|
+
),
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
if (!accounts.stakingVault.value) {
|
|
336
|
+
accounts.stakingVault.value = await getProgramDerivedAddress({
|
|
337
|
+
programAddress:
|
|
338
|
+
'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL' as Address<'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL'>,
|
|
339
|
+
seeds: [
|
|
340
|
+
getAddressEncoder().encode(
|
|
341
|
+
getAddressFromResolvedInstructionAccount(
|
|
342
|
+
'nexusStakingConfig',
|
|
343
|
+
accounts.nexusStakingConfig.value,
|
|
344
|
+
),
|
|
345
|
+
),
|
|
346
|
+
getAddressEncoder().encode(
|
|
347
|
+
getAddressFromResolvedInstructionAccount(
|
|
348
|
+
'quoteTokenProgram',
|
|
349
|
+
accounts.quoteTokenProgram.value,
|
|
350
|
+
),
|
|
351
|
+
),
|
|
352
|
+
getAddressEncoder().encode(
|
|
353
|
+
getAddressFromResolvedInstructionAccount(
|
|
354
|
+
'quoteMint',
|
|
355
|
+
accounts.quoteMint.value,
|
|
356
|
+
),
|
|
357
|
+
),
|
|
358
|
+
],
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
if (!accounts.systemProgram.value) {
|
|
362
|
+
accounts.systemProgram.value =
|
|
363
|
+
'11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;
|
|
364
|
+
}
|
|
365
|
+
if (!accounts.eventAuthority.value) {
|
|
366
|
+
accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS;
|
|
367
|
+
}
|
|
368
|
+
if (!accounts.program.value) {
|
|
369
|
+
accounts.program.value =
|
|
370
|
+
'5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP' as Address<'5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP'>;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
|
|
374
|
+
return Object.freeze({
|
|
375
|
+
accounts: [
|
|
376
|
+
getAccountMeta('payer', accounts.payer),
|
|
377
|
+
getAccountMeta('bondingCurve', accounts.bondingCurve),
|
|
378
|
+
getAccountMeta('baseMint', accounts.baseMint),
|
|
379
|
+
getAccountMeta('quoteMint', accounts.quoteMint),
|
|
380
|
+
getAccountMeta('quoteVault', accounts.quoteVault),
|
|
381
|
+
getAccountMeta('nexusStakingConfig', accounts.nexusStakingConfig),
|
|
382
|
+
getAccountMeta('stakingRewardState', accounts.stakingRewardState),
|
|
383
|
+
getAccountMeta('rewardAccrual', accounts.rewardAccrual),
|
|
384
|
+
getAccountMeta('stakingVault', accounts.stakingVault),
|
|
385
|
+
getAccountMeta('quoteTokenProgram', accounts.quoteTokenProgram),
|
|
386
|
+
getAccountMeta('systemProgram', accounts.systemProgram),
|
|
387
|
+
getAccountMeta('eventAuthority', accounts.eventAuthority),
|
|
388
|
+
getAccountMeta('program', accounts.program),
|
|
389
|
+
],
|
|
390
|
+
data: getClaimProtocolFeesInstructionDataEncoder().encode({}),
|
|
391
|
+
programAddress,
|
|
392
|
+
} as ClaimProtocolFeesInstruction<
|
|
393
|
+
typeof SEND_LAUNCHPAD_PROGRAM_ADDRESS,
|
|
394
|
+
TAccountPayer,
|
|
395
|
+
TAccountBondingCurve,
|
|
396
|
+
TAccountBaseMint,
|
|
397
|
+
TAccountQuoteMint,
|
|
398
|
+
TAccountQuoteVault,
|
|
399
|
+
TAccountNexusStakingConfig,
|
|
400
|
+
TAccountStakingRewardState,
|
|
401
|
+
TAccountRewardAccrual,
|
|
402
|
+
TAccountStakingVault,
|
|
403
|
+
TAccountQuoteTokenProgram,
|
|
404
|
+
'11111111111111111111111111111111',
|
|
405
|
+
'FJVebqCthxH6JM8vvkJb7yRYA7Emsib1C1vu4ZePSP3T',
|
|
406
|
+
'5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP'
|
|
407
|
+
>);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
export type ClaimProtocolFeesInput<
|
|
411
|
+
TAccountPayer extends string = string,
|
|
412
|
+
TAccountBondingCurve extends string = string,
|
|
413
|
+
TAccountBaseMint extends string = string,
|
|
414
|
+
TAccountQuoteMint extends string = string,
|
|
415
|
+
TAccountQuoteVault extends string = string,
|
|
416
|
+
TAccountNexusStakingConfig extends string = string,
|
|
417
|
+
TAccountStakingRewardState extends string = string,
|
|
418
|
+
TAccountRewardAccrual extends string = string,
|
|
419
|
+
TAccountStakingVault extends string = string,
|
|
420
|
+
TAccountQuoteTokenProgram extends string = string,
|
|
421
|
+
> = {
|
|
422
|
+
payer: TransactionSigner<TAccountPayer>;
|
|
423
|
+
bondingCurve: Address<TAccountBondingCurve>;
|
|
424
|
+
baseMint: Address<TAccountBaseMint>;
|
|
425
|
+
quoteMint: Address<TAccountQuoteMint>;
|
|
426
|
+
quoteVault: Address<TAccountQuoteVault>;
|
|
427
|
+
nexusStakingConfig?: Address<TAccountNexusStakingConfig>;
|
|
428
|
+
stakingRewardState: Address<TAccountStakingRewardState>;
|
|
429
|
+
rewardAccrual: Address<TAccountRewardAccrual>;
|
|
430
|
+
stakingVault: Address<TAccountStakingVault>;
|
|
431
|
+
quoteTokenProgram: Address<TAccountQuoteTokenProgram>;
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
export function getClaimProtocolFeesInstruction<
|
|
435
|
+
TAccountPayer extends string,
|
|
436
|
+
TAccountBondingCurve extends string,
|
|
437
|
+
TAccountBaseMint extends string,
|
|
438
|
+
TAccountQuoteMint extends string,
|
|
439
|
+
TAccountQuoteVault extends string,
|
|
440
|
+
TAccountNexusStakingConfig extends string,
|
|
441
|
+
TAccountStakingRewardState extends string,
|
|
442
|
+
TAccountRewardAccrual extends string,
|
|
443
|
+
TAccountStakingVault extends string,
|
|
444
|
+
TAccountQuoteTokenProgram extends string,
|
|
445
|
+
>(
|
|
446
|
+
input: ClaimProtocolFeesInput<
|
|
447
|
+
TAccountPayer,
|
|
448
|
+
TAccountBondingCurve,
|
|
449
|
+
TAccountBaseMint,
|
|
450
|
+
TAccountQuoteMint,
|
|
451
|
+
TAccountQuoteVault,
|
|
452
|
+
TAccountNexusStakingConfig,
|
|
453
|
+
TAccountStakingRewardState,
|
|
454
|
+
TAccountRewardAccrual,
|
|
455
|
+
TAccountStakingVault,
|
|
456
|
+
TAccountQuoteTokenProgram
|
|
457
|
+
>,
|
|
458
|
+
): ClaimProtocolFeesInstruction<
|
|
459
|
+
typeof SEND_LAUNCHPAD_PROGRAM_ADDRESS,
|
|
460
|
+
TAccountPayer,
|
|
461
|
+
TAccountBondingCurve,
|
|
462
|
+
TAccountBaseMint,
|
|
463
|
+
TAccountQuoteMint,
|
|
464
|
+
TAccountQuoteVault,
|
|
465
|
+
TAccountNexusStakingConfig,
|
|
466
|
+
TAccountStakingRewardState,
|
|
467
|
+
TAccountRewardAccrual,
|
|
468
|
+
TAccountStakingVault,
|
|
469
|
+
TAccountQuoteTokenProgram,
|
|
470
|
+
'11111111111111111111111111111111',
|
|
471
|
+
'FJVebqCthxH6JM8vvkJb7yRYA7Emsib1C1vu4ZePSP3T',
|
|
472
|
+
'5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP'
|
|
473
|
+
> {
|
|
474
|
+
// Program address.
|
|
475
|
+
const programAddress = SEND_LAUNCHPAD_PROGRAM_ADDRESS;
|
|
476
|
+
|
|
477
|
+
// Original accounts.
|
|
478
|
+
const originalAccounts = {
|
|
479
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
480
|
+
bondingCurve: { value: input.bondingCurve ?? null, isWritable: true },
|
|
481
|
+
baseMint: { value: input.baseMint ?? null, isWritable: false },
|
|
482
|
+
quoteMint: { value: input.quoteMint ?? null, isWritable: false },
|
|
483
|
+
quoteVault: { value: input.quoteVault ?? null, isWritable: true },
|
|
484
|
+
nexusStakingConfig: {
|
|
485
|
+
value: input.nexusStakingConfig ?? null,
|
|
486
|
+
isWritable: false,
|
|
487
|
+
},
|
|
488
|
+
stakingRewardState: {
|
|
489
|
+
value: input.stakingRewardState ?? null,
|
|
490
|
+
isWritable: false,
|
|
491
|
+
},
|
|
492
|
+
rewardAccrual: { value: input.rewardAccrual ?? null, isWritable: true },
|
|
493
|
+
stakingVault: { value: input.stakingVault ?? null, isWritable: true },
|
|
494
|
+
quoteTokenProgram: {
|
|
495
|
+
value: input.quoteTokenProgram ?? null,
|
|
496
|
+
isWritable: false,
|
|
497
|
+
},
|
|
498
|
+
systemProgram: { value: null, isWritable: false },
|
|
499
|
+
eventAuthority: { value: null, isWritable: false },
|
|
500
|
+
program: { value: null, isWritable: false },
|
|
501
|
+
};
|
|
502
|
+
const accounts = originalAccounts as Record<
|
|
503
|
+
keyof typeof originalAccounts,
|
|
504
|
+
ResolvedInstructionAccount
|
|
505
|
+
>;
|
|
506
|
+
|
|
507
|
+
// Resolve default values.
|
|
508
|
+
if (!accounts.nexusStakingConfig.value) {
|
|
509
|
+
accounts.nexusStakingConfig.value =
|
|
510
|
+
'9WUowYRb6KAWjWVB5KMmTngBidZXEXgQcQRTXbhxeGbF' as Address<'9WUowYRb6KAWjWVB5KMmTngBidZXEXgQcQRTXbhxeGbF'>;
|
|
511
|
+
}
|
|
512
|
+
if (!accounts.systemProgram.value) {
|
|
513
|
+
accounts.systemProgram.value =
|
|
514
|
+
'11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;
|
|
515
|
+
}
|
|
516
|
+
if (!accounts.eventAuthority.value) {
|
|
517
|
+
accounts.eventAuthority.value = EVENT_AUTHORITY_PDA_ADDRESS;
|
|
518
|
+
}
|
|
519
|
+
if (!accounts.program.value) {
|
|
520
|
+
accounts.program.value =
|
|
521
|
+
'5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP' as Address<'5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP'>;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
|
|
525
|
+
return Object.freeze({
|
|
526
|
+
accounts: [
|
|
527
|
+
getAccountMeta('payer', accounts.payer),
|
|
528
|
+
getAccountMeta('bondingCurve', accounts.bondingCurve),
|
|
529
|
+
getAccountMeta('baseMint', accounts.baseMint),
|
|
530
|
+
getAccountMeta('quoteMint', accounts.quoteMint),
|
|
531
|
+
getAccountMeta('quoteVault', accounts.quoteVault),
|
|
532
|
+
getAccountMeta('nexusStakingConfig', accounts.nexusStakingConfig),
|
|
533
|
+
getAccountMeta('stakingRewardState', accounts.stakingRewardState),
|
|
534
|
+
getAccountMeta('rewardAccrual', accounts.rewardAccrual),
|
|
535
|
+
getAccountMeta('stakingVault', accounts.stakingVault),
|
|
536
|
+
getAccountMeta('quoteTokenProgram', accounts.quoteTokenProgram),
|
|
537
|
+
getAccountMeta('systemProgram', accounts.systemProgram),
|
|
538
|
+
getAccountMeta('eventAuthority', accounts.eventAuthority),
|
|
539
|
+
getAccountMeta('program', accounts.program),
|
|
540
|
+
],
|
|
541
|
+
data: getClaimProtocolFeesInstructionDataEncoder().encode({}),
|
|
542
|
+
programAddress,
|
|
543
|
+
} as ClaimProtocolFeesInstruction<
|
|
544
|
+
typeof SEND_LAUNCHPAD_PROGRAM_ADDRESS,
|
|
545
|
+
TAccountPayer,
|
|
546
|
+
TAccountBondingCurve,
|
|
547
|
+
TAccountBaseMint,
|
|
548
|
+
TAccountQuoteMint,
|
|
549
|
+
TAccountQuoteVault,
|
|
550
|
+
TAccountNexusStakingConfig,
|
|
551
|
+
TAccountStakingRewardState,
|
|
552
|
+
TAccountRewardAccrual,
|
|
553
|
+
TAccountStakingVault,
|
|
554
|
+
TAccountQuoteTokenProgram,
|
|
555
|
+
'11111111111111111111111111111111',
|
|
556
|
+
'FJVebqCthxH6JM8vvkJb7yRYA7Emsib1C1vu4ZePSP3T',
|
|
557
|
+
'5R1uFyEE4oxqkm7hJDqHq6gXaLVF9dxeF3LF4yz1sfLP'
|
|
558
|
+
>);
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
export type ParsedClaimProtocolFeesInstruction<
|
|
562
|
+
TProgram extends string = typeof SEND_LAUNCHPAD_PROGRAM_ADDRESS,
|
|
563
|
+
TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],
|
|
564
|
+
> = {
|
|
565
|
+
programAddress: Address<TProgram>;
|
|
566
|
+
accounts: {
|
|
567
|
+
payer: TAccountMetas[0];
|
|
568
|
+
bondingCurve: TAccountMetas[1];
|
|
569
|
+
baseMint: TAccountMetas[2];
|
|
570
|
+
quoteMint: TAccountMetas[3];
|
|
571
|
+
quoteVault: TAccountMetas[4];
|
|
572
|
+
nexusStakingConfig: TAccountMetas[5];
|
|
573
|
+
stakingRewardState: TAccountMetas[6];
|
|
574
|
+
rewardAccrual: TAccountMetas[7];
|
|
575
|
+
stakingVault: TAccountMetas[8];
|
|
576
|
+
quoteTokenProgram: TAccountMetas[9];
|
|
577
|
+
systemProgram: TAccountMetas[10];
|
|
578
|
+
eventAuthority: TAccountMetas[11];
|
|
579
|
+
program: TAccountMetas[12];
|
|
580
|
+
};
|
|
581
|
+
data: ClaimProtocolFeesInstructionData;
|
|
582
|
+
};
|
|
583
|
+
|
|
584
|
+
export function parseClaimProtocolFeesInstruction<
|
|
585
|
+
TProgram extends string,
|
|
586
|
+
TAccountMetas extends readonly AccountMeta[],
|
|
587
|
+
>(
|
|
588
|
+
instruction: Instruction<TProgram> &
|
|
589
|
+
InstructionWithAccounts<TAccountMetas> &
|
|
590
|
+
InstructionWithData<ReadonlyUint8Array>,
|
|
591
|
+
): ParsedClaimProtocolFeesInstruction<TProgram, TAccountMetas> {
|
|
592
|
+
assertIsInstructionForProgram(instruction, SEND_LAUNCHPAD_PROGRAM_ADDRESS);
|
|
593
|
+
if (
|
|
594
|
+
!containsBytes(instruction.data, CLAIM_PROTOCOL_FEES_DISCRIMINATOR, 0)
|
|
595
|
+
) {
|
|
596
|
+
const error = new Error(
|
|
597
|
+
`parseClaimProtocolFeesInstruction: instruction data does not match the ClaimProtocolFees discriminator`,
|
|
598
|
+
);
|
|
599
|
+
error.name = 'InstructionDiscriminatorMismatchError';
|
|
600
|
+
throw error;
|
|
601
|
+
}
|
|
602
|
+
if (instruction.accounts.length < 13) {
|
|
603
|
+
throw new SolanaError(
|
|
604
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
605
|
+
{
|
|
606
|
+
actualAccountMetas: instruction.accounts.length,
|
|
607
|
+
expectedAccountMetas: 13,
|
|
608
|
+
},
|
|
609
|
+
);
|
|
610
|
+
}
|
|
611
|
+
let accountIndex = 0;
|
|
612
|
+
const getNextAccount = () => {
|
|
613
|
+
const accountMeta = (instruction.accounts as TAccountMetas)[
|
|
614
|
+
accountIndex
|
|
615
|
+
]!;
|
|
616
|
+
accountIndex += 1;
|
|
617
|
+
return accountMeta;
|
|
618
|
+
};
|
|
619
|
+
return {
|
|
620
|
+
programAddress: instruction.programAddress,
|
|
621
|
+
accounts: {
|
|
622
|
+
payer: getNextAccount(),
|
|
623
|
+
bondingCurve: getNextAccount(),
|
|
624
|
+
baseMint: getNextAccount(),
|
|
625
|
+
quoteMint: getNextAccount(),
|
|
626
|
+
quoteVault: getNextAccount(),
|
|
627
|
+
nexusStakingConfig: getNextAccount(),
|
|
628
|
+
stakingRewardState: getNextAccount(),
|
|
629
|
+
rewardAccrual: getNextAccount(),
|
|
630
|
+
stakingVault: getNextAccount(),
|
|
631
|
+
quoteTokenProgram: getNextAccount(),
|
|
632
|
+
systemProgram: getNextAccount(),
|
|
633
|
+
eventAuthority: getNextAccount(),
|
|
634
|
+
program: getNextAccount(),
|
|
635
|
+
},
|
|
636
|
+
data: getClaimProtocolFeesInstructionDataDecoder().decode(
|
|
637
|
+
instruction.data,
|
|
638
|
+
),
|
|
639
|
+
};
|
|
640
|
+
}
|