@liquid-af/sdk 0.6.1 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accounts/liquid-fees.d.ts +1 -1
- package/dist/accounts/liquid-fees.d.ts.map +1 -1
- package/dist/accounts/liquid-fees.js +2 -2
- package/dist/accounts/liquid-fees.js.map +1 -1
- package/dist/client.d.ts +7 -6
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +6 -6
- package/dist/client.js.map +1 -1
- package/dist/events/index.d.ts +1 -1
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js.map +1 -1
- package/dist/events/types.d.ts +20 -0
- package/dist/events/types.d.ts.map +1 -1
- package/dist/idl/liquid.d.ts +2581 -2490
- package/dist/idl/liquid.d.ts.map +1 -1
- package/dist/idl/liquid.json +2581 -2490
- package/dist/idl/liquid_events.d.ts +205 -1
- package/dist/idl/liquid_events.d.ts.map +1 -1
- package/dist/idl/liquid_events.json +205 -1
- package/dist/idl/liquid_fees.d.ts +121 -6
- package/dist/idl/liquid_fees.d.ts.map +1 -1
- package/dist/idl/liquid_fees.json +121 -6
- package/dist/idl/liquid_state.d.ts +72 -72
- package/dist/idl/liquid_state.d.ts.map +1 -1
- package/dist/idl/liquid_state.json +72 -72
- package/dist/idl/liquid_swap.d.ts +1022 -998
- package/dist/idl/liquid_swap.d.ts.map +1 -1
- package/dist/idl/liquid_swap.json +1022 -998
- package/dist/instructions/liquid-fees.d.ts +3 -2
- package/dist/instructions/liquid-fees.d.ts.map +1 -1
- package/dist/instructions/liquid-fees.js +12 -9
- package/dist/instructions/liquid-fees.js.map +1 -1
- package/dist/pda/index.d.ts.map +1 -1
- package/dist/pda/index.js +2 -2
- package/dist/pda/index.js.map +1 -1
- package/dist/pda/liquid-fees.d.ts +3 -2
- package/dist/pda/liquid-fees.d.ts.map +1 -1
- package/dist/pda/liquid-fees.js +4 -3
- package/dist/pda/liquid-fees.js.map +1 -1
- package/package.json +1 -1
- package/src/accounts/liquid-fees.ts +6 -1
- package/src/client.ts +21 -8
- package/src/events/index.ts +2 -0
- package/src/events/types.ts +22 -0
- package/src/idl/liquid.json +2581 -2490
- package/src/idl/liquid.ts +2581 -2490
- package/src/idl/liquid_events.json +205 -1
- package/src/idl/liquid_events.ts +205 -1
- package/src/idl/liquid_fees.json +121 -6
- package/src/idl/liquid_fees.ts +121 -6
- package/src/idl/liquid_state.json +72 -72
- package/src/idl/liquid_state.ts +72 -72
- package/src/idl/liquid_swap.json +1022 -998
- package/src/idl/liquid_swap.ts +1022 -998
- package/src/instructions/liquid-fees.ts +31 -10
- package/src/pda/index.ts +10 -2
- package/src/pda/liquid-fees.ts +4 -2
|
@@ -12,10 +12,9 @@ import {
|
|
|
12
12
|
export interface BuildUpdateFeeConfigParams {
|
|
13
13
|
authority: PublicKey;
|
|
14
14
|
tokenMint: PublicKey;
|
|
15
|
+
quoteMint: PublicKey;
|
|
15
16
|
recipients?: FeeRecipient[] | null;
|
|
16
17
|
newUpdateAuthority?: PublicKey | null;
|
|
17
|
-
/** Required when changing recipients to verify token fee vault is drained. */
|
|
18
|
-
quoteMint?: PublicKey;
|
|
19
18
|
config: LiquidConfig;
|
|
20
19
|
}
|
|
21
20
|
|
|
@@ -47,9 +46,10 @@ export function buildUpdateFeeConfig(
|
|
|
47
46
|
|
|
48
47
|
// When changing recipients, the token fee vault must be passed to verify it's drained
|
|
49
48
|
let tokenFeeVault: PublicKey | null = null;
|
|
50
|
-
if (recipients
|
|
49
|
+
if (recipients) {
|
|
51
50
|
const [feeConfig] = getFeeConfigPDA(
|
|
52
51
|
tokenMint,
|
|
52
|
+
quoteMint,
|
|
53
53
|
config.liquidFeesProgramId,
|
|
54
54
|
);
|
|
55
55
|
const [feeVault] = getFeeVaultPDA(
|
|
@@ -68,9 +68,10 @@ export function buildUpdateFeeConfig(
|
|
|
68
68
|
recipients: formattedRecipients,
|
|
69
69
|
newUpdateAuthority: newUpdateAuthority ?? null,
|
|
70
70
|
})
|
|
71
|
-
.
|
|
71
|
+
.accountsPartial({
|
|
72
72
|
authority,
|
|
73
73
|
tokenMint,
|
|
74
|
+
quoteMint,
|
|
74
75
|
tokenFeeVault,
|
|
75
76
|
})
|
|
76
77
|
.instruction();
|
|
@@ -98,7 +99,11 @@ export function buildRevokeFeeConfig(
|
|
|
98
99
|
const program = getCachedFeesProgram(config);
|
|
99
100
|
|
|
100
101
|
// Derive token fee vault ATA (fee_vault's ATA for quote_mint)
|
|
101
|
-
const [feeConfig] = getFeeConfigPDA(
|
|
102
|
+
const [feeConfig] = getFeeConfigPDA(
|
|
103
|
+
tokenMint,
|
|
104
|
+
quoteMint,
|
|
105
|
+
config.liquidFeesProgramId,
|
|
106
|
+
);
|
|
102
107
|
const [feeVault] = getFeeVaultPDA(feeConfig, config.liquidFeesProgramId);
|
|
103
108
|
const tokenFeeVault = getAssociatedTokenAddressSync(
|
|
104
109
|
quoteMint,
|
|
@@ -111,6 +116,7 @@ export function buildRevokeFeeConfig(
|
|
|
111
116
|
.accounts({
|
|
112
117
|
authority,
|
|
113
118
|
tokenMint,
|
|
119
|
+
quoteMint,
|
|
114
120
|
tokenFeeVault,
|
|
115
121
|
})
|
|
116
122
|
.instruction();
|
|
@@ -119,6 +125,7 @@ export function buildRevokeFeeConfig(
|
|
|
119
125
|
export interface BuildDistributeFeesParams {
|
|
120
126
|
payer: PublicKey;
|
|
121
127
|
tokenMint: PublicKey;
|
|
128
|
+
quoteMint: PublicKey;
|
|
122
129
|
recipientVaults: PublicKey[];
|
|
123
130
|
config: LiquidConfig;
|
|
124
131
|
}
|
|
@@ -135,7 +142,7 @@ export interface BuildDistributeFeesParams {
|
|
|
135
142
|
export function buildDistributeFees(
|
|
136
143
|
params: BuildDistributeFeesParams,
|
|
137
144
|
): Promise<TransactionInstruction> {
|
|
138
|
-
const { payer, tokenMint, recipientVaults, config } = params;
|
|
145
|
+
const { payer, tokenMint, quoteMint, recipientVaults, config } = params;
|
|
139
146
|
const program = getCachedFeesProgram(config);
|
|
140
147
|
|
|
141
148
|
return program.methods
|
|
@@ -143,6 +150,7 @@ export function buildDistributeFees(
|
|
|
143
150
|
.accounts({
|
|
144
151
|
payer,
|
|
145
152
|
tokenMint,
|
|
153
|
+
quoteMint,
|
|
146
154
|
})
|
|
147
155
|
.remainingAccounts(
|
|
148
156
|
recipientVaults.map((vault) => ({
|
|
@@ -202,6 +210,7 @@ export function buildDistributeTokenFees(
|
|
|
202
210
|
export interface BuildClaimFeesParams {
|
|
203
211
|
recipient: PublicKey;
|
|
204
212
|
tokenMint: PublicKey;
|
|
213
|
+
quoteMint: PublicKey;
|
|
205
214
|
config: LiquidConfig;
|
|
206
215
|
}
|
|
207
216
|
|
|
@@ -215,9 +224,13 @@ export interface BuildClaimFeesParams {
|
|
|
215
224
|
export function buildClaimFees(
|
|
216
225
|
params: BuildClaimFeesParams,
|
|
217
226
|
): Promise<TransactionInstruction> {
|
|
218
|
-
const { recipient, tokenMint, config } = params;
|
|
227
|
+
const { recipient, tokenMint, quoteMint, config } = params;
|
|
219
228
|
const program = getCachedFeesProgram(config);
|
|
220
|
-
const [feeConfig] = getFeeConfigPDA(
|
|
229
|
+
const [feeConfig] = getFeeConfigPDA(
|
|
230
|
+
tokenMint,
|
|
231
|
+
quoteMint,
|
|
232
|
+
config.liquidFeesProgramId,
|
|
233
|
+
);
|
|
221
234
|
|
|
222
235
|
return program.methods
|
|
223
236
|
.claimFees()
|
|
@@ -248,7 +261,11 @@ export function buildClaimTokenFees(
|
|
|
248
261
|
): Promise<TransactionInstruction> {
|
|
249
262
|
const { recipient, tokenMint, quoteMint, config } = params;
|
|
250
263
|
const program = getCachedFeesProgram(config);
|
|
251
|
-
const [feeConfig] = getFeeConfigPDA(
|
|
264
|
+
const [feeConfig] = getFeeConfigPDA(
|
|
265
|
+
tokenMint,
|
|
266
|
+
quoteMint,
|
|
267
|
+
config.liquidFeesProgramId,
|
|
268
|
+
);
|
|
252
269
|
|
|
253
270
|
return program.methods
|
|
254
271
|
.claimTokenFees()
|
|
@@ -301,7 +318,11 @@ export function deriveRecipientVaultPairs(
|
|
|
301
318
|
quoteMint: PublicKey,
|
|
302
319
|
config: LiquidConfig,
|
|
303
320
|
): RecipientVaultPair[] {
|
|
304
|
-
const [feeConfig] = getFeeConfigPDA(
|
|
321
|
+
const [feeConfig] = getFeeConfigPDA(
|
|
322
|
+
tokenMint,
|
|
323
|
+
quoteMint,
|
|
324
|
+
config.liquidFeesProgramId,
|
|
325
|
+
);
|
|
305
326
|
return recipients.map((recipient) => {
|
|
306
327
|
const [vaultPda] = getRecipientVaultPDA(
|
|
307
328
|
feeConfig,
|
package/src/pda/index.ts
CHANGED
|
@@ -97,7 +97,11 @@ export const getAllBondingCurvePDAs = (
|
|
|
97
97
|
bondingCurve,
|
|
98
98
|
config.liquidProgramId,
|
|
99
99
|
);
|
|
100
|
-
const [feeConfig] = getFeeConfigPDA(
|
|
100
|
+
const [feeConfig] = getFeeConfigPDA(
|
|
101
|
+
mint,
|
|
102
|
+
WSOL_MINT,
|
|
103
|
+
config.liquidFeesProgramId,
|
|
104
|
+
);
|
|
101
105
|
const [feeVault] = getFeeVaultPDA(feeConfig, config.liquidFeesProgramId);
|
|
102
106
|
const [userProperties] = getUserPropertiesPDA(
|
|
103
107
|
creator,
|
|
@@ -165,7 +169,11 @@ export const getAllPoolPDAs = (
|
|
|
165
169
|
);
|
|
166
170
|
const [ammConfig] = getSwapGlobalConfigPDA(config.liquidSwapProgramId);
|
|
167
171
|
const [ammAuthority] = getSwapAuthorityPDA(config.liquidSwapProgramId);
|
|
168
|
-
const [feeConfig] = getFeeConfigPDA(
|
|
172
|
+
const [feeConfig] = getFeeConfigPDA(
|
|
173
|
+
baseMint,
|
|
174
|
+
quoteMint,
|
|
175
|
+
config.liquidFeesProgramId,
|
|
176
|
+
);
|
|
169
177
|
const [tokenVolume] = getTokenVolumePDA(
|
|
170
178
|
baseMint,
|
|
171
179
|
config.liquidStateProgramId,
|
package/src/pda/liquid-fees.ts
CHANGED
|
@@ -6,18 +6,20 @@ const SEED_GLOBAL_CONFIG = Buffer.from("global_config");
|
|
|
6
6
|
const SEED_RECIPIENT_VAULT = Buffer.from("recipient_vault");
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Derives the fee config PDA for a token mint.
|
|
9
|
+
* Derives the fee config PDA for a token mint and quote mint pair.
|
|
10
10
|
*
|
|
11
11
|
* @param tokenMint - Token mint address
|
|
12
|
+
* @param quoteMint - Quote token mint address (e.g., WSOL for native, USDC for stable)
|
|
12
13
|
* @param programId - Liquid Fees program ID
|
|
13
14
|
* @returns Tuple of [PDA address, bump seed]
|
|
14
15
|
*/
|
|
15
16
|
export const getFeeConfigPDA = (
|
|
16
17
|
tokenMint: PublicKey,
|
|
18
|
+
quoteMint: PublicKey,
|
|
17
19
|
programId: PublicKey,
|
|
18
20
|
): [PublicKey, number] => {
|
|
19
21
|
return PublicKey.findProgramAddressSync(
|
|
20
|
-
[SEED_FEE_CONFIG, tokenMint.toBuffer()],
|
|
22
|
+
[SEED_FEE_CONFIG, tokenMint.toBuffer(), quoteMint.toBuffer()],
|
|
21
23
|
programId,
|
|
22
24
|
);
|
|
23
25
|
};
|