@liquid-af/sdk 0.11.7 → 0.11.9
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/client.d.ts +5 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +10 -0
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +4 -2
- package/dist/config.js.map +1 -1
- package/dist/idl/liquid_fees.d.ts +9 -32
- package/dist/idl/liquid_fees.d.ts.map +1 -1
- package/dist/idl/liquid_fees.json +9 -32
- package/dist/instructions/liquid-fees.d.ts.map +1 -1
- package/dist/instructions/liquid-fees.js +12 -8
- package/dist/instructions/liquid-fees.js.map +1 -1
- package/dist/lut.d.ts +71 -5
- package/dist/lut.d.ts.map +1 -1
- package/dist/lut.js +139 -9
- package/dist/lut.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +22 -0
- package/src/config.ts +6 -2
- package/src/idl/liquid_fees.json +9 -32
- package/src/idl/liquid_fees.ts +9 -32
- package/src/instructions/liquid-fees.ts +16 -9
- package/src/lut.ts +290 -6
package/dist/lut.d.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { PublicKey, type Connection, type AddressLookupTableAccount } from "@solana/web3.js";
|
|
1
|
+
import { PublicKey, type Connection, type AddressLookupTableAccount, type TransactionInstruction } from "@solana/web3.js";
|
|
2
2
|
import { type LiquidConfig } from "./config.js";
|
|
3
3
|
/**
|
|
4
|
-
* Returns the
|
|
4
|
+
* Returns the 26 account addresses for the global LUT.
|
|
5
5
|
*
|
|
6
|
-
* Programs (
|
|
6
|
+
* Programs (10): System, SPL Token, Token-2022, ATA, ComputeBudget, Liquid, State, Events, Fees, Swap
|
|
7
7
|
* Liquid PDAs (2): global_config, cpi_authority
|
|
8
8
|
* Swap PDAs (3): authority, global_config, cpi_authority
|
|
9
9
|
* State PDAs (4): global_amm_volume, global_curve_volume, cashback_config, cpi_authority
|
|
10
|
-
*
|
|
10
|
+
* Fees PDAs (2): global_config, cpi_authority
|
|
11
|
+
* Constants (5): WSOL mint, oracle price feed, instructions sysvar, referrer cosigner, USDC mint
|
|
11
12
|
*
|
|
12
13
|
* @param config - Liquid protocol configuration
|
|
13
14
|
* @param connection - Solana RPC connection (for fetching oracle price feed)
|
|
14
|
-
* @returns Array of
|
|
15
|
+
* @returns Array of 26 public keys to populate the LUT
|
|
15
16
|
*/
|
|
16
17
|
export declare function getLutAccounts(config: LiquidConfig, connection: Connection): Promise<PublicKey[]>;
|
|
17
18
|
/**
|
|
@@ -22,4 +23,69 @@ export declare function getLutAccounts(config: LiquidConfig, connection: Connect
|
|
|
22
23
|
* @returns The AddressLookupTableAccount, or null if not found
|
|
23
24
|
*/
|
|
24
25
|
export declare function fetchLut(connection: Connection, lutAddress: PublicKey): Promise<AddressLookupTableAccount | null>;
|
|
26
|
+
export interface GetNativeTokenLutAccountsParams {
|
|
27
|
+
/** Token mint address */
|
|
28
|
+
mint: PublicKey;
|
|
29
|
+
/** Trading user's public key */
|
|
30
|
+
user: PublicKey;
|
|
31
|
+
/** Bonding curve creator's public key */
|
|
32
|
+
creator: PublicKey;
|
|
33
|
+
/** Protocol configuration */
|
|
34
|
+
config: LiquidConfig;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Returns the per-token + per-user addresses for a native (SOL) bonding curve LUT.
|
|
38
|
+
* These supplement the global LUT — no global accounts are included.
|
|
39
|
+
*
|
|
40
|
+
* Token PDAs (9): mint, bondingCurve, solVault, buybackVault, bondingCurveTokenAccount,
|
|
41
|
+
* feeConfig, feeVault, feeVaultTokenAccount, tokenVolume
|
|
42
|
+
* User PDAs (3): userProperties, creatorUserProperties, userTokenAccount
|
|
43
|
+
*/
|
|
44
|
+
export declare function getNativeTokenLutAccounts(params: GetNativeTokenLutAccountsParams): PublicKey[];
|
|
45
|
+
export interface GetStableTokenLutAccountsParams {
|
|
46
|
+
/** Token mint address */
|
|
47
|
+
mint: PublicKey;
|
|
48
|
+
/** Quote token mint address (e.g. USDC) */
|
|
49
|
+
quoteMint: PublicKey;
|
|
50
|
+
/** Trading user's public key */
|
|
51
|
+
user: PublicKey;
|
|
52
|
+
/** Bonding curve creator's public key */
|
|
53
|
+
creator: PublicKey;
|
|
54
|
+
/** Protocol configuration */
|
|
55
|
+
config: LiquidConfig;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Returns the per-token + per-user addresses for a stable (quote token) bonding curve LUT.
|
|
59
|
+
* These supplement the global LUT — no global accounts are included.
|
|
60
|
+
*
|
|
61
|
+
* Token PDAs (10): mint, quoteMint, bondingCurve, bondingCurveQuoteVault,
|
|
62
|
+
* bondingCurveTokenAccount, buybackVault, feeConfig, feeVault, feeVaultTokenAccount, tokenVolume
|
|
63
|
+
* User PDAs (4): userProperties, creatorUserProperties, userTokenAccount, userQuoteAccount
|
|
64
|
+
*/
|
|
65
|
+
export declare function getStableTokenLutAccounts(params: GetStableTokenLutAccountsParams): PublicKey[];
|
|
66
|
+
export interface BuildCreateTokenLutParams {
|
|
67
|
+
/** Solana RPC connection (to fetch a recent slot) */
|
|
68
|
+
connection: Connection;
|
|
69
|
+
/** Payer/authority public key for the LUT */
|
|
70
|
+
payer: PublicKey;
|
|
71
|
+
/** Addresses to populate the LUT with */
|
|
72
|
+
addresses: PublicKey[];
|
|
73
|
+
}
|
|
74
|
+
export interface CreateTokenLutResult {
|
|
75
|
+
/** The derived LUT address */
|
|
76
|
+
lutAddress: PublicKey;
|
|
77
|
+
/** Create + extend instructions to include in a transaction */
|
|
78
|
+
instructions: TransactionInstruction[];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Builds instructions to create an Address Lookup Table and populate it
|
|
82
|
+
* with the given addresses. Handles deduplication.
|
|
83
|
+
*
|
|
84
|
+
* The caller is responsible for including these instructions in a transaction,
|
|
85
|
+
* signing, and sending. The LUT must be active for at least 1 slot before
|
|
86
|
+
* it can be used in subsequent transactions.
|
|
87
|
+
*
|
|
88
|
+
* @returns The derived LUT address and the instructions to create + extend it
|
|
89
|
+
*/
|
|
90
|
+
export declare function buildCreateTokenLut(params: BuildCreateTokenLutParams): Promise<CreateTokenLutResult>;
|
|
25
91
|
//# sourceMappingURL=lut.d.ts.map
|
package/dist/lut.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lut.d.ts","sourceRoot":"","sources":["../src/lut.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"lut.d.ts","sourceRoot":"","sources":["../src/lut.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,SAAS,EAGT,KAAK,UAAU,EACf,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAC3B,MAAM,iBAAiB,CAAC;AAOzB,OAAO,EACN,KAAK,YAAY,EAGjB,MAAM,aAAa,CAAC;AAwCrB;;;;;;;;;;;;;GAaG;AACH,wBAAsB,cAAc,CACnC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,GACpB,OAAO,CAAC,SAAS,EAAE,CAAC,CAmEtB;AAED;;;;;;GAMG;AACH,wBAAsB,QAAQ,CAC7B,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,SAAS,GACnB,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAG3C;AAED,MAAM,WAAW,+BAA+B;IAC/C,yBAAyB;IACzB,IAAI,EAAE,SAAS,CAAC;IAChB,gCAAgC;IAChC,IAAI,EAAE,SAAS,CAAC;IAChB,yCAAyC;IACzC,OAAO,EAAE,SAAS,CAAC;IACnB,6BAA6B;IAC7B,MAAM,EAAE,YAAY,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACxC,MAAM,EAAE,+BAA+B,GACrC,SAAS,EAAE,CA+Db;AAED,MAAM,WAAW,+BAA+B;IAC/C,yBAAyB;IACzB,IAAI,EAAE,SAAS,CAAC;IAChB,2CAA2C;IAC3C,SAAS,EAAE,SAAS,CAAC;IACrB,gCAAgC;IAChC,IAAI,EAAE,SAAS,CAAC;IAChB,yCAAyC;IACzC,OAAO,EAAE,SAAS,CAAC;IACnB,6BAA6B;IAC7B,MAAM,EAAE,YAAY,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACxC,MAAM,EAAE,+BAA+B,GACrC,SAAS,EAAE,CA6Eb;AAED,MAAM,WAAW,yBAAyB;IACzC,qDAAqD;IACrD,UAAU,EAAE,UAAU,CAAC;IACvB,6CAA6C;IAC7C,KAAK,EAAE,SAAS,CAAC;IACjB,yCAAyC;IACzC,SAAS,EAAE,SAAS,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,oBAAoB;IACpC,8BAA8B;IAC9B,UAAU,EAAE,SAAS,CAAC;IACtB,+DAA+D;IAC/D,YAAY,EAAE,sBAAsB,EAAE,CAAC;CACvC;AAED;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CACxC,MAAM,EAAE,yBAAyB,GAC/B,OAAO,CAAC,oBAAoB,CAAC,CA8B/B"}
|
package/dist/lut.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { ComputeBudgetProgram, PublicKey, SystemProgram, } from "@solana/web3.js";
|
|
2
|
-
import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID, } from "@solana/spl-token";
|
|
3
|
-
import { WSOL_MINT } from "./config.js";
|
|
1
|
+
import { AddressLookupTableProgram, ComputeBudgetProgram, PublicKey, SYSVAR_INSTRUCTIONS_PUBKEY, SystemProgram, } from "@solana/web3.js";
|
|
2
|
+
import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync, } from "@solana/spl-token";
|
|
3
|
+
import { REFERRER_COSIGNER, WSOL_MINT, } from "./config.js";
|
|
4
4
|
import { getSwapAuthorityPDA, getSwapGlobalConfigPDA, } from "./pda/liquid-swap.js";
|
|
5
|
-
import { getGlobalAmmVolumePDA, getGlobalCurveVolumePDA, getCashbackConfigPDA, } from "./pda/liquid-state.js";
|
|
6
|
-
import { getLiquidGlobalConfigPDA } from "./pda/liquid.js";
|
|
5
|
+
import { getGlobalAmmVolumePDA, getGlobalCurveVolumePDA, getCashbackConfigPDA, getUserPropertiesPDA, getTokenVolumePDA, } from "./pda/liquid-state.js";
|
|
6
|
+
import { getLiquidGlobalConfigPDA, getBondingCurvePDA, getBondingCurveSolVaultPDA, getBuybackVaultPDA, getBondingCurveTokenAccount, getStableBondingCurvePDA, } from "./pda/liquid.js";
|
|
7
|
+
import { getFeeConfigPDA, getFeeVaultPDA, getFeeGlobalConfigPDA } from "./pda/liquid-fees.js";
|
|
7
8
|
import { fetchAmmConfig } from "./accounts/liquid-swap.js";
|
|
8
9
|
const SEED_CPI_AUTHORITY = Buffer.from("cpi_authority");
|
|
9
10
|
/**
|
|
@@ -14,17 +15,18 @@ function getCpiAuthorityPDA(programId) {
|
|
|
14
15
|
return pda;
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
|
-
* Returns the
|
|
18
|
+
* Returns the 26 account addresses for the global LUT.
|
|
18
19
|
*
|
|
19
|
-
* Programs (
|
|
20
|
+
* Programs (10): System, SPL Token, Token-2022, ATA, ComputeBudget, Liquid, State, Events, Fees, Swap
|
|
20
21
|
* Liquid PDAs (2): global_config, cpi_authority
|
|
21
22
|
* Swap PDAs (3): authority, global_config, cpi_authority
|
|
22
23
|
* State PDAs (4): global_amm_volume, global_curve_volume, cashback_config, cpi_authority
|
|
23
|
-
*
|
|
24
|
+
* Fees PDAs (2): global_config, cpi_authority
|
|
25
|
+
* Constants (5): WSOL mint, oracle price feed, instructions sysvar, referrer cosigner, USDC mint
|
|
24
26
|
*
|
|
25
27
|
* @param config - Liquid protocol configuration
|
|
26
28
|
* @param connection - Solana RPC connection (for fetching oracle price feed)
|
|
27
|
-
* @returns Array of
|
|
29
|
+
* @returns Array of 26 public keys to populate the LUT
|
|
28
30
|
*/
|
|
29
31
|
export async function getLutAccounts(config, connection) {
|
|
30
32
|
const ammConfig = await fetchAmmConfig(connection, config);
|
|
@@ -41,6 +43,9 @@ export async function getLutAccounts(config, connection) {
|
|
|
41
43
|
const [globalCurveVolume] = getGlobalCurveVolumePDA(config.liquidStateProgramId);
|
|
42
44
|
const [cashbackConfig] = getCashbackConfigPDA(config.liquidStateProgramId);
|
|
43
45
|
const stateCpiAuthority = getCpiAuthorityPDA(config.liquidStateProgramId);
|
|
46
|
+
// Fees PDAs
|
|
47
|
+
const [feeGlobalConfig] = getFeeGlobalConfigPDA(config.liquidFeesProgramId);
|
|
48
|
+
const feesCpiAuthority = getCpiAuthorityPDA(config.liquidFeesProgramId);
|
|
44
49
|
return [
|
|
45
50
|
// Programs
|
|
46
51
|
SystemProgram.programId,
|
|
@@ -48,6 +53,7 @@ export async function getLutAccounts(config, connection) {
|
|
|
48
53
|
TOKEN_2022_PROGRAM_ID,
|
|
49
54
|
ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
50
55
|
ComputeBudgetProgram.programId,
|
|
56
|
+
config.liquidProgramId,
|
|
51
57
|
config.liquidStateProgramId,
|
|
52
58
|
config.liquidEventsProgramId,
|
|
53
59
|
config.liquidFeesProgramId,
|
|
@@ -64,9 +70,15 @@ export async function getLutAccounts(config, connection) {
|
|
|
64
70
|
globalCurveVolume,
|
|
65
71
|
cashbackConfig,
|
|
66
72
|
stateCpiAuthority,
|
|
73
|
+
// Fees global PDAs
|
|
74
|
+
feeGlobalConfig,
|
|
75
|
+
feesCpiAuthority,
|
|
67
76
|
// Constants
|
|
68
77
|
WSOL_MINT,
|
|
69
78
|
oraclePriceFeed,
|
|
79
|
+
SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
80
|
+
REFERRER_COSIGNER,
|
|
81
|
+
config.usdcMint,
|
|
70
82
|
];
|
|
71
83
|
}
|
|
72
84
|
/**
|
|
@@ -80,4 +92,122 @@ export async function fetchLut(connection, lutAddress) {
|
|
|
80
92
|
const result = await connection.getAddressLookupTable(lutAddress);
|
|
81
93
|
return result.value;
|
|
82
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Returns the per-token + per-user addresses for a native (SOL) bonding curve LUT.
|
|
97
|
+
* These supplement the global LUT — no global accounts are included.
|
|
98
|
+
*
|
|
99
|
+
* Token PDAs (9): mint, bondingCurve, solVault, buybackVault, bondingCurveTokenAccount,
|
|
100
|
+
* feeConfig, feeVault, feeVaultTokenAccount, tokenVolume
|
|
101
|
+
* User PDAs (3): userProperties, creatorUserProperties, userTokenAccount
|
|
102
|
+
*/
|
|
103
|
+
export function getNativeTokenLutAccounts(params) {
|
|
104
|
+
const { mint, user, creator, config } = params;
|
|
105
|
+
// Token PDAs
|
|
106
|
+
const [bondingCurve] = getBondingCurvePDA(mint, config.liquidProgramId);
|
|
107
|
+
const [solVault] = getBondingCurveSolVaultPDA(bondingCurve, config.liquidProgramId);
|
|
108
|
+
const [buybackVault] = getBuybackVaultPDA(bondingCurve, config.liquidProgramId);
|
|
109
|
+
const bondingCurveTokenAccount = getBondingCurveTokenAccount(mint, config.liquidProgramId);
|
|
110
|
+
const [feeConfig] = getFeeConfigPDA(mint, WSOL_MINT, config.liquidFeesProgramId);
|
|
111
|
+
const [feeVault] = getFeeVaultPDA(feeConfig, config.liquidFeesProgramId);
|
|
112
|
+
const feeVaultTokenAccount = getAssociatedTokenAddressSync(WSOL_MINT, feeVault, true, TOKEN_PROGRAM_ID);
|
|
113
|
+
const [tokenVolume] = getTokenVolumePDA(mint, config.liquidStateProgramId);
|
|
114
|
+
// User PDAs
|
|
115
|
+
const [userProperties] = getUserPropertiesPDA(user, config.liquidStateProgramId);
|
|
116
|
+
const [creatorUserProperties] = getUserPropertiesPDA(creator, config.liquidStateProgramId);
|
|
117
|
+
const userTokenAccount = getAssociatedTokenAddressSync(mint, user, true, TOKEN_2022_PROGRAM_ID);
|
|
118
|
+
return [
|
|
119
|
+
// Token PDAs
|
|
120
|
+
mint,
|
|
121
|
+
bondingCurve,
|
|
122
|
+
solVault,
|
|
123
|
+
buybackVault,
|
|
124
|
+
bondingCurveTokenAccount,
|
|
125
|
+
feeConfig,
|
|
126
|
+
feeVault,
|
|
127
|
+
feeVaultTokenAccount,
|
|
128
|
+
tokenVolume,
|
|
129
|
+
// User PDAs
|
|
130
|
+
userProperties,
|
|
131
|
+
creatorUserProperties,
|
|
132
|
+
userTokenAccount,
|
|
133
|
+
];
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Returns the per-token + per-user addresses for a stable (quote token) bonding curve LUT.
|
|
137
|
+
* These supplement the global LUT — no global accounts are included.
|
|
138
|
+
*
|
|
139
|
+
* Token PDAs (10): mint, quoteMint, bondingCurve, bondingCurveQuoteVault,
|
|
140
|
+
* bondingCurveTokenAccount, buybackVault, feeConfig, feeVault, feeVaultTokenAccount, tokenVolume
|
|
141
|
+
* User PDAs (4): userProperties, creatorUserProperties, userTokenAccount, userQuoteAccount
|
|
142
|
+
*/
|
|
143
|
+
export function getStableTokenLutAccounts(params) {
|
|
144
|
+
const { mint, quoteMint, user, creator, config } = params;
|
|
145
|
+
// Token PDAs
|
|
146
|
+
const [bondingCurve] = getStableBondingCurvePDA(mint, config.liquidProgramId);
|
|
147
|
+
const bondingCurveQuoteVault = getAssociatedTokenAddressSync(quoteMint, bondingCurve, true, TOKEN_PROGRAM_ID);
|
|
148
|
+
const bondingCurveTokenAccount = getAssociatedTokenAddressSync(mint, bondingCurve, true, TOKEN_2022_PROGRAM_ID);
|
|
149
|
+
const [buybackVault] = getBuybackVaultPDA(bondingCurve, config.liquidProgramId);
|
|
150
|
+
const [feeConfig] = getFeeConfigPDA(mint, quoteMint, config.liquidFeesProgramId);
|
|
151
|
+
const [feeVault] = getFeeVaultPDA(feeConfig, config.liquidFeesProgramId);
|
|
152
|
+
const feeVaultTokenAccount = getAssociatedTokenAddressSync(quoteMint, feeVault, true, TOKEN_PROGRAM_ID);
|
|
153
|
+
const [tokenVolume] = getTokenVolumePDA(mint, config.liquidStateProgramId);
|
|
154
|
+
// User PDAs
|
|
155
|
+
const [userProperties] = getUserPropertiesPDA(user, config.liquidStateProgramId);
|
|
156
|
+
const [creatorUserProperties] = getUserPropertiesPDA(creator, config.liquidStateProgramId);
|
|
157
|
+
const userTokenAccount = getAssociatedTokenAddressSync(mint, user, true, TOKEN_2022_PROGRAM_ID);
|
|
158
|
+
const userQuoteAccount = getAssociatedTokenAddressSync(quoteMint, user, true, TOKEN_PROGRAM_ID);
|
|
159
|
+
return [
|
|
160
|
+
// Token PDAs
|
|
161
|
+
mint,
|
|
162
|
+
bondingCurve,
|
|
163
|
+
bondingCurveQuoteVault,
|
|
164
|
+
bondingCurveTokenAccount,
|
|
165
|
+
buybackVault,
|
|
166
|
+
feeConfig,
|
|
167
|
+
feeVault,
|
|
168
|
+
feeVaultTokenAccount,
|
|
169
|
+
tokenVolume,
|
|
170
|
+
// User PDAs
|
|
171
|
+
userProperties,
|
|
172
|
+
creatorUserProperties,
|
|
173
|
+
userTokenAccount,
|
|
174
|
+
userQuoteAccount,
|
|
175
|
+
];
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Builds instructions to create an Address Lookup Table and populate it
|
|
179
|
+
* with the given addresses. Handles deduplication.
|
|
180
|
+
*
|
|
181
|
+
* The caller is responsible for including these instructions in a transaction,
|
|
182
|
+
* signing, and sending. The LUT must be active for at least 1 slot before
|
|
183
|
+
* it can be used in subsequent transactions.
|
|
184
|
+
*
|
|
185
|
+
* @returns The derived LUT address and the instructions to create + extend it
|
|
186
|
+
*/
|
|
187
|
+
export async function buildCreateTokenLut(params) {
|
|
188
|
+
const { connection, payer, addresses } = params;
|
|
189
|
+
// Deduplicate addresses
|
|
190
|
+
const seen = new Set();
|
|
191
|
+
const unique = [];
|
|
192
|
+
for (const addr of addresses) {
|
|
193
|
+
const key = addr.toBase58();
|
|
194
|
+
if (!seen.has(key)) {
|
|
195
|
+
seen.add(key);
|
|
196
|
+
unique.push(addr);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
const slot = await connection.getSlot();
|
|
200
|
+
const [createIx, lutAddress] = AddressLookupTableProgram.createLookupTable({
|
|
201
|
+
authority: payer,
|
|
202
|
+
payer,
|
|
203
|
+
recentSlot: slot,
|
|
204
|
+
});
|
|
205
|
+
const extendIx = AddressLookupTableProgram.extendLookupTable({
|
|
206
|
+
lookupTable: lutAddress,
|
|
207
|
+
authority: payer,
|
|
208
|
+
payer,
|
|
209
|
+
addresses: unique,
|
|
210
|
+
});
|
|
211
|
+
return { lutAddress, instructions: [createIx, extendIx] };
|
|
212
|
+
}
|
|
83
213
|
//# sourceMappingURL=lut.js.map
|
package/dist/lut.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lut.js","sourceRoot":"","sources":["../src/lut.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,oBAAoB,EACpB,SAAS,EACT,aAAa,
|
|
1
|
+
{"version":3,"file":"lut.js","sourceRoot":"","sources":["../src/lut.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,yBAAyB,EACzB,oBAAoB,EACpB,SAAS,EACT,0BAA0B,EAC1B,aAAa,GAIb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACN,2BAA2B,EAC3B,qBAAqB,EACrB,gBAAgB,EAChB,6BAA6B,GAC7B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEN,iBAAiB,EACjB,SAAS,GACT,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,mBAAmB,EACnB,sBAAsB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,GACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,wBAAwB,EACxB,kBAAkB,EAClB,0BAA0B,EAC1B,kBAAkB,EAClB,2BAA2B,EAC3B,wBAAwB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L,SAAS,EAAE,MAAM;KACjB,CAAC,CAAC;IAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC;AAC3D,CAAC"}
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -122,6 +122,14 @@ import {
|
|
|
122
122
|
// Utility
|
|
123
123
|
import { resolveTokenProgram as resolveTokenProgramFn } from "./helpers/user.js";
|
|
124
124
|
|
|
125
|
+
// LUT helpers
|
|
126
|
+
import {
|
|
127
|
+
getNativeTokenLutAccounts as getNativeTokenLutAccountsFn,
|
|
128
|
+
getStableTokenLutAccounts as getStableTokenLutAccountsFn,
|
|
129
|
+
type GetNativeTokenLutAccountsParams,
|
|
130
|
+
type GetStableTokenLutAccountsParams,
|
|
131
|
+
} from "./lut.js";
|
|
132
|
+
|
|
125
133
|
export interface LiquidClientConfig {
|
|
126
134
|
connection: Connection;
|
|
127
135
|
config?: LiquidConfig;
|
|
@@ -1148,6 +1156,20 @@ export class LiquidClient {
|
|
|
1148
1156
|
);
|
|
1149
1157
|
}
|
|
1150
1158
|
|
|
1159
|
+
/** Returns per-token + per-user addresses for a native (SOL) bonding curve on-demand LUT. */
|
|
1160
|
+
getNativeTokenLutAccounts(
|
|
1161
|
+
params: Omit<GetNativeTokenLutAccountsParams, "config">,
|
|
1162
|
+
): PublicKey[] {
|
|
1163
|
+
return getNativeTokenLutAccountsFn({ ...params, config: this.config });
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
/** Returns per-token + per-user addresses for a stable (quote token) bonding curve on-demand LUT. */
|
|
1167
|
+
getStableTokenLutAccounts(
|
|
1168
|
+
params: Omit<GetStableTokenLutAccountsParams, "config">,
|
|
1169
|
+
): PublicKey[] {
|
|
1170
|
+
return getStableTokenLutAccountsFn({ ...params, config: this.config });
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1151
1173
|
/**
|
|
1152
1174
|
* Builds an unsigned Transaction from instructions, with optional compute
|
|
1153
1175
|
* budget. Fetches a recent blockhash. Caller is responsible for signing.
|
package/src/config.ts
CHANGED
|
@@ -14,6 +14,8 @@ export interface LiquidConfig {
|
|
|
14
14
|
liquidStateProgramId: PublicKey;
|
|
15
15
|
/** Program ID for the events program */
|
|
16
16
|
liquidEventsProgramId: PublicKey;
|
|
17
|
+
/** USDC mint address (cluster-specific) */
|
|
18
|
+
usdcMint: PublicKey;
|
|
17
19
|
/** Address lookup table */
|
|
18
20
|
lut: PublicKey;
|
|
19
21
|
}
|
|
@@ -35,7 +37,8 @@ export const MAINNET_CONFIG: LiquidConfig = {
|
|
|
35
37
|
liquidEventsProgramId: new PublicKey(
|
|
36
38
|
"EventsQeXA43nLKR69DhHwNsJ6aM512AweMCgG3wG8zG",
|
|
37
39
|
),
|
|
38
|
-
|
|
40
|
+
usdcMint: new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),
|
|
41
|
+
lut: new PublicKey("FUtGenyVu1wXbVWXtLGxYYe3vcosZ8ThZzPG6KCEiUqD"),
|
|
39
42
|
} as const;
|
|
40
43
|
|
|
41
44
|
/** Devnet program IDs (liquid differs, others same as mainnet) */
|
|
@@ -55,7 +58,8 @@ export const DEVNET_CONFIG: LiquidConfig = {
|
|
|
55
58
|
liquidEventsProgramId: new PublicKey(
|
|
56
59
|
"Bast7hBDiqSsxiwEmqazwvPvXC3N4z8UQR5ZmkqXnCiY",
|
|
57
60
|
),
|
|
58
|
-
|
|
61
|
+
usdcMint: new PublicKey("usdcbnypGfPKmn191M5DRNbRzPwvnbBgCEdKRsKG8XW"),
|
|
62
|
+
lut: new PublicKey("GwrLVF7ENm1mtdCvnhjsLmhFp2ux6Ymg5BjfDhLUuESD"),
|
|
59
63
|
} as const;
|
|
60
64
|
|
|
61
65
|
/** Localnet program IDs (same as mainnet per Anchor.toml) */
|
package/src/idl/liquid_fees.json
CHANGED
|
@@ -1621,6 +1621,11 @@
|
|
|
1621
1621
|
"code": 6019,
|
|
1622
1622
|
"name": "NotPendingAdmin",
|
|
1623
1623
|
"msg": "Not the pending admin"
|
|
1624
|
+
},
|
|
1625
|
+
{
|
|
1626
|
+
"code": 6020,
|
|
1627
|
+
"name": "RecipientAccountsMismatch",
|
|
1628
|
+
"msg": "Remaining accounts count must match recipient basis points count"
|
|
1624
1629
|
}
|
|
1625
1630
|
],
|
|
1626
1631
|
"types": [
|
|
@@ -1901,17 +1906,14 @@
|
|
|
1901
1906
|
"kind": "struct",
|
|
1902
1907
|
"fields": [
|
|
1903
1908
|
{
|
|
1904
|
-
"name": "
|
|
1909
|
+
"name": "recipient_basis_points",
|
|
1905
1910
|
"docs": [
|
|
1906
|
-
"New
|
|
1911
|
+
"New recipient basis points (optional, only valid for Recipients mode).",
|
|
1912
|
+
"Recipient pubkeys are passed via remaining accounts in matching order."
|
|
1907
1913
|
],
|
|
1908
1914
|
"type": {
|
|
1909
1915
|
"option": {
|
|
1910
|
-
"vec":
|
|
1911
|
-
"defined": {
|
|
1912
|
-
"name": "UpdateFeeRecipient"
|
|
1913
|
-
}
|
|
1914
|
-
}
|
|
1916
|
+
"vec": "u16"
|
|
1915
1917
|
}
|
|
1916
1918
|
}
|
|
1917
1919
|
},
|
|
@@ -1926,31 +1928,6 @@
|
|
|
1926
1928
|
}
|
|
1927
1929
|
]
|
|
1928
1930
|
}
|
|
1929
|
-
},
|
|
1930
|
-
{
|
|
1931
|
-
"name": "UpdateFeeRecipient",
|
|
1932
|
-
"docs": [
|
|
1933
|
-
"A fee recipient entry used when updating a fee configuration."
|
|
1934
|
-
],
|
|
1935
|
-
"type": {
|
|
1936
|
-
"kind": "struct",
|
|
1937
|
-
"fields": [
|
|
1938
|
-
{
|
|
1939
|
-
"name": "pubkey",
|
|
1940
|
-
"docs": [
|
|
1941
|
-
"The public key of the fee recipient."
|
|
1942
|
-
],
|
|
1943
|
-
"type": "pubkey"
|
|
1944
|
-
},
|
|
1945
|
-
{
|
|
1946
|
-
"name": "basis_points",
|
|
1947
|
-
"docs": [
|
|
1948
|
-
"The recipient's share of fees in basis points (out of 10,000)."
|
|
1949
|
-
],
|
|
1950
|
-
"type": "u16"
|
|
1951
|
-
}
|
|
1952
|
-
]
|
|
1953
|
-
}
|
|
1954
1931
|
}
|
|
1955
1932
|
]
|
|
1956
1933
|
}
|
package/src/idl/liquid_fees.ts
CHANGED
|
@@ -1627,6 +1627,11 @@ export type LiquidFees = {
|
|
|
1627
1627
|
"code": 6019,
|
|
1628
1628
|
"name": "notPendingAdmin",
|
|
1629
1629
|
"msg": "Not the pending admin"
|
|
1630
|
+
},
|
|
1631
|
+
{
|
|
1632
|
+
"code": 6020,
|
|
1633
|
+
"name": "recipientAccountsMismatch",
|
|
1634
|
+
"msg": "Remaining accounts count must match recipient basis points count"
|
|
1630
1635
|
}
|
|
1631
1636
|
],
|
|
1632
1637
|
"types": [
|
|
@@ -1907,17 +1912,14 @@ export type LiquidFees = {
|
|
|
1907
1912
|
"kind": "struct",
|
|
1908
1913
|
"fields": [
|
|
1909
1914
|
{
|
|
1910
|
-
"name": "
|
|
1915
|
+
"name": "recipientBasisPoints",
|
|
1911
1916
|
"docs": [
|
|
1912
|
-
"New
|
|
1917
|
+
"New recipient basis points (optional, only valid for Recipients mode).",
|
|
1918
|
+
"Recipient pubkeys are passed via remaining accounts in matching order."
|
|
1913
1919
|
],
|
|
1914
1920
|
"type": {
|
|
1915
1921
|
"option": {
|
|
1916
|
-
"vec":
|
|
1917
|
-
"defined": {
|
|
1918
|
-
"name": "updateFeeRecipient"
|
|
1919
|
-
}
|
|
1920
|
-
}
|
|
1922
|
+
"vec": "u16"
|
|
1921
1923
|
}
|
|
1922
1924
|
}
|
|
1923
1925
|
},
|
|
@@ -1932,31 +1934,6 @@ export type LiquidFees = {
|
|
|
1932
1934
|
}
|
|
1933
1935
|
]
|
|
1934
1936
|
}
|
|
1935
|
-
},
|
|
1936
|
-
{
|
|
1937
|
-
"name": "updateFeeRecipient",
|
|
1938
|
-
"docs": [
|
|
1939
|
-
"A fee recipient entry used when updating a fee configuration."
|
|
1940
|
-
],
|
|
1941
|
-
"type": {
|
|
1942
|
-
"kind": "struct",
|
|
1943
|
-
"fields": [
|
|
1944
|
-
{
|
|
1945
|
-
"name": "pubkey",
|
|
1946
|
-
"docs": [
|
|
1947
|
-
"The public key of the fee recipient."
|
|
1948
|
-
],
|
|
1949
|
-
"type": "pubkey"
|
|
1950
|
-
},
|
|
1951
|
-
{
|
|
1952
|
-
"name": "basisPoints",
|
|
1953
|
-
"docs": [
|
|
1954
|
-
"The recipient's share of fees in basis points (out of 10,000)."
|
|
1955
|
-
],
|
|
1956
|
-
"type": "u16"
|
|
1957
|
-
}
|
|
1958
|
-
]
|
|
1959
|
-
}
|
|
1960
1937
|
}
|
|
1961
1938
|
]
|
|
1962
1939
|
};
|
|
@@ -38,11 +38,7 @@ export function buildUpdateFeeConfig(
|
|
|
38
38
|
} = params;
|
|
39
39
|
const program = getCachedFeesProgram(config);
|
|
40
40
|
|
|
41
|
-
const
|
|
42
|
-
recipients?.map((r) => ({
|
|
43
|
-
pubkey: r.pubkey,
|
|
44
|
-
basisPoints: r.basisPoints,
|
|
45
|
-
})) ?? null;
|
|
41
|
+
const recipientBasisPoints = recipients?.map((r) => r.basisPoints) ?? null;
|
|
46
42
|
|
|
47
43
|
// When changing recipients, the token fee vault must be passed to verify it's drained
|
|
48
44
|
let tokenFeeVault: PublicKey | null = null;
|
|
@@ -63,9 +59,9 @@ export function buildUpdateFeeConfig(
|
|
|
63
59
|
);
|
|
64
60
|
}
|
|
65
61
|
|
|
66
|
-
|
|
62
|
+
const builder = program.methods
|
|
67
63
|
.updateFeeConfig({
|
|
68
|
-
|
|
64
|
+
recipientBasisPoints,
|
|
69
65
|
newUpdateAuthority: newUpdateAuthority ?? null,
|
|
70
66
|
})
|
|
71
67
|
.accountsPartial({
|
|
@@ -73,8 +69,19 @@ export function buildUpdateFeeConfig(
|
|
|
73
69
|
tokenMint,
|
|
74
70
|
quoteMint,
|
|
75
71
|
tokenFeeVault,
|
|
76
|
-
})
|
|
77
|
-
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
if (recipients) {
|
|
75
|
+
builder.remainingAccounts(
|
|
76
|
+
recipients.map((r) => ({
|
|
77
|
+
pubkey: r.pubkey,
|
|
78
|
+
isSigner: false,
|
|
79
|
+
isWritable: false,
|
|
80
|
+
})),
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return builder.instruction();
|
|
78
85
|
}
|
|
79
86
|
|
|
80
87
|
export interface BuildRevokeFeeConfigParams {
|