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