@liquid-af/sdk 0.11.0 → 0.11.2

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.
Files changed (46) hide show
  1. package/dist/client.d.ts +6 -0
  2. package/dist/client.d.ts.map +1 -1
  3. package/dist/client.js +5 -1
  4. package/dist/client.js.map +1 -1
  5. package/dist/idl/liquid.d.ts +24 -1
  6. package/dist/idl/liquid.d.ts.map +1 -1
  7. package/dist/idl/liquid.json +24 -1
  8. package/dist/idl/liquid_events.d.ts +6 -0
  9. package/dist/idl/liquid_events.d.ts.map +1 -1
  10. package/dist/idl/liquid_events.json +6 -0
  11. package/dist/idl/liquid_fees.d.ts +85 -2
  12. package/dist/idl/liquid_fees.d.ts.map +1 -1
  13. package/dist/idl/liquid_fees.json +85 -2
  14. package/dist/idl/liquid_state.d.ts +115 -16
  15. package/dist/idl/liquid_state.d.ts.map +1 -1
  16. package/dist/idl/liquid_state.json +115 -16
  17. package/dist/idl/liquid_swap.d.ts +53 -15
  18. package/dist/idl/liquid_swap.d.ts.map +1 -1
  19. package/dist/idl/liquid_swap.json +53 -15
  20. package/dist/instructions/index.d.ts +2 -2
  21. package/dist/instructions/index.d.ts.map +1 -1
  22. package/dist/instructions/index.js +1 -1
  23. package/dist/instructions/index.js.map +1 -1
  24. package/dist/instructions/liquid-fees.d.ts +15 -1
  25. package/dist/instructions/liquid-fees.d.ts.map +1 -1
  26. package/dist/instructions/liquid-fees.js +14 -0
  27. package/dist/instructions/liquid-fees.js.map +1 -1
  28. package/dist/lut.d.ts +0 -13
  29. package/dist/lut.d.ts.map +1 -1
  30. package/dist/lut.js +1 -24
  31. package/dist/lut.js.map +1 -1
  32. package/package.json +1 -1
  33. package/src/client.ts +10 -0
  34. package/src/idl/liquid.json +24 -1
  35. package/src/idl/liquid.ts +24 -1
  36. package/src/idl/liquid_events.json +6 -0
  37. package/src/idl/liquid_events.ts +6 -0
  38. package/src/idl/liquid_fees.json +85 -2
  39. package/src/idl/liquid_fees.ts +85 -2
  40. package/src/idl/liquid_state.json +115 -16
  41. package/src/idl/liquid_state.ts +115 -16
  42. package/src/idl/liquid_swap.json +53 -15
  43. package/src/idl/liquid_swap.ts +53 -15
  44. package/src/instructions/index.ts +2 -0
  45. package/src/instructions/liquid-fees.ts +24 -1
  46. package/src/lut.ts +1 -33
@@ -2100,12 +2100,12 @@ export type LiquidSwap = {
2100
2100
  {
2101
2101
  "name": "create",
2102
2102
  "docs": [
2103
- "Creates a pool for the given token pair and the initial price.",
2103
+ "Creates an AMM pool for the given token pair with an initial deposit.",
2104
2104
  "",
2105
2105
  "# Arguments",
2106
- "* `init_amount_base` - the initial amount_0 to deposit",
2107
- "* `init_amount_quote` - the initial amount_1 to deposit",
2108
- "* `creator` - the creator of the pool"
2106
+ "* `init_amount_base` - Initial base token amount to deposit into the pool.",
2107
+ "* `init_amount_quote` - Initial quote token amount to deposit into the pool.",
2108
+ "* `creator` - Optional creator pubkey (for program-initiated migration pools)."
2109
2109
  ],
2110
2110
  "discriminator": [
2111
2111
  24,
@@ -2832,12 +2832,12 @@ export type LiquidSwap = {
2832
2832
  {
2833
2833
  "name": "deposit",
2834
2834
  "docs": [
2835
- "Deposit lp token to the pool.",
2835
+ "Deposits liquidity into the pool, minting LP tokens to the owner.",
2836
2836
  "",
2837
2837
  "# Arguments",
2838
- "* `lp_token_amount` - Increased number of LPs",
2839
- "* `maximum_base_token_amount` - Maximum base token amount to deposit, prevents excessive slippage",
2840
- "* `maximum_quote_token_amount` - Maximum quote token amount to deposit, prevents excessive slippage"
2838
+ "* `lp_token_amount` - Number of LP tokens to mint.",
2839
+ "* `maximum_base_token_amount` - Maximum base tokens willing to deposit (slippage protection).",
2840
+ "* `maximum_quote_token_amount` - Maximum quote tokens willing to deposit (slippage protection)."
2841
2841
  ],
2842
2842
  "discriminator": [
2843
2843
  242,
@@ -2853,12 +2853,15 @@ export type LiquidSwap = {
2853
2853
  {
2854
2854
  "name": "owner",
2855
2855
  "docs": [
2856
- "Pays to mint the position."
2856
+ "The owner depositing liquidity into the pool."
2857
2857
  ],
2858
2858
  "signer": true
2859
2859
  },
2860
2860
  {
2861
2861
  "name": "poolState",
2862
+ "docs": [
2863
+ "Pool state account validated against base/quote vaults and LP mint."
2864
+ ],
2862
2865
  "writable": true
2863
2866
  },
2864
2867
  {
@@ -4126,10 +4129,16 @@ export type LiquidSwap = {
4126
4129
  "accounts": [
4127
4130
  {
4128
4131
  "name": "admin",
4132
+ "docs": [
4133
+ "The admin authorized to pause the protocol."
4134
+ ],
4129
4135
  "signer": true
4130
4136
  },
4131
4137
  {
4132
4138
  "name": "globalConfig",
4139
+ "docs": [
4140
+ "Global configuration account to be updated."
4141
+ ],
4133
4142
  "writable": true,
4134
4143
  "pda": {
4135
4144
  "seeds": [
@@ -6349,10 +6358,16 @@ export type LiquidSwap = {
6349
6358
  "accounts": [
6350
6359
  {
6351
6360
  "name": "admin",
6361
+ "docs": [
6362
+ "The admin authorized to unpause the protocol."
6363
+ ],
6352
6364
  "signer": true
6353
6365
  },
6354
6366
  {
6355
6367
  "name": "globalConfig",
6368
+ "docs": [
6369
+ "Global configuration account to be updated."
6370
+ ],
6356
6371
  "writable": true,
6357
6372
  "pda": {
6358
6373
  "seeds": [
@@ -6506,12 +6521,12 @@ export type LiquidSwap = {
6506
6521
  {
6507
6522
  "name": "withdraw",
6508
6523
  "docs": [
6509
- "Withdraw lp for base token and quote token.",
6524
+ "Withdraws liquidity from the pool, burning LP tokens and returning base and quote tokens.",
6510
6525
  "",
6511
6526
  "# Arguments",
6512
- "* `lp_token_amount` - Amount of pool tokens to burn. User receives an output of token a and b based on the percentage of the pool tokens that are returned.",
6513
- "* `minimum_base_amount` - Minimum amount of base token to receive, prevents excessive slippage",
6514
- "* `minimum_quote_amount` - Minimum amount of quote token to receive, prevents excessive slippage"
6527
+ "* `lp_token_amount` - Number of LP tokens to burn.",
6528
+ "* `minimum_base_amount` - Minimum base tokens expected to receive (slippage protection).",
6529
+ "* `minimum_quote_amount` - Minimum quote tokens expected to receive (slippage protection)."
6515
6530
  ],
6516
6531
  "discriminator": [
6517
6532
  183,
@@ -6527,14 +6542,14 @@ export type LiquidSwap = {
6527
6542
  {
6528
6543
  "name": "owner",
6529
6544
  "docs": [
6530
- "Pays to mint the position."
6545
+ "The owner withdrawing liquidity from the pool."
6531
6546
  ],
6532
6547
  "signer": true
6533
6548
  },
6534
6549
  {
6535
6550
  "name": "poolState",
6536
6551
  "docs": [
6537
- "Pool state account."
6552
+ "Pool state account validated against base/quote vaults and LP mint."
6538
6553
  ],
6539
6554
  "writable": true
6540
6555
  },
@@ -7185,6 +7200,9 @@ export type LiquidSwap = {
7185
7200
  },
7186
7201
  {
7187
7202
  "name": "feeMode",
7203
+ "docs": [
7204
+ "The fee distribution mode for a token's fee configuration."
7205
+ ],
7188
7206
  "repr": {
7189
7207
  "kind": "rust"
7190
7208
  },
@@ -7202,6 +7220,9 @@ export type LiquidSwap = {
7202
7220
  },
7203
7221
  {
7204
7222
  "name": "feeRecipient",
7223
+ "docs": [
7224
+ "A fee recipient with their allocation and vault PDA bump."
7225
+ ],
7205
7226
  "repr": {
7206
7227
  "kind": "c"
7207
7228
  },
@@ -7210,18 +7231,30 @@ export type LiquidSwap = {
7210
7231
  "fields": [
7211
7232
  {
7212
7233
  "name": "pubkey",
7234
+ "docs": [
7235
+ "The public key of the fee recipient."
7236
+ ],
7213
7237
  "type": "pubkey"
7214
7238
  },
7215
7239
  {
7216
7240
  "name": "basisPoints",
7241
+ "docs": [
7242
+ "The recipient's share of fees in basis points (out of 10,000)."
7243
+ ],
7217
7244
  "type": "u16"
7218
7245
  },
7219
7246
  {
7220
7247
  "name": "vaultBump",
7248
+ "docs": [
7249
+ "The bump seed for the recipient's vault PDA."
7250
+ ],
7221
7251
  "type": "u8"
7222
7252
  },
7223
7253
  {
7224
7254
  "name": "padding",
7255
+ "docs": [
7256
+ "Padding to align to 8-byte boundary (32 + 2 + 1 + 5 = 40 bytes)."
7257
+ ],
7225
7258
  "type": {
7226
7259
  "array": [
7227
7260
  "u8",
@@ -7579,6 +7612,11 @@ export type LiquidSwap = {
7579
7612
  },
7580
7613
  {
7581
7614
  "name": "unifiedFeeConfiguration",
7615
+ "docs": [
7616
+ "Unified fee configuration for a token, supporting both Recipients and Revoked modes.",
7617
+ "",
7618
+ "Stored as a zero-copy account for efficient access in hot paths."
7619
+ ],
7582
7620
  "serialization": "bytemuckunsafe",
7583
7621
  "repr": {
7584
7622
  "kind": "c",
@@ -78,6 +78,7 @@ export {
78
78
  buildInitializeGlobalConfig,
79
79
  buildUpdateFeeConfig,
80
80
  buildRevokeFeeConfig,
81
+ buildRevokeUpdateAuthority,
81
82
  buildDistributeFees,
82
83
  buildDistributeTokenFees,
83
84
  buildClaimFees,
@@ -88,6 +89,7 @@ export type {
88
89
  BuildInitializeGlobalConfigParams,
89
90
  BuildUpdateFeeConfigParams,
90
91
  BuildRevokeFeeConfigParams,
92
+ BuildRevokeUpdateAuthorityParams,
91
93
  BuildDistributeFeesParams,
92
94
  BuildDistributeTokenFeesParams,
93
95
  BuildClaimFeesParams,
@@ -1,4 +1,4 @@
1
- import type { PublicKey, TransactionInstruction } from "@solana/web3.js";
1
+ import { PublicKey, type TransactionInstruction } from "@solana/web3.js";
2
2
  import { getAssociatedTokenAddressSync } from "@solana/spl-token";
3
3
  import type { LiquidConfig } from "../config.js";
4
4
  import type { FeeRecipient } from "../types.js";
@@ -122,6 +122,29 @@ export function buildRevokeFeeConfig(
122
122
  .instruction();
123
123
  }
124
124
 
125
+ export interface BuildRevokeUpdateAuthorityParams {
126
+ authority: PublicKey;
127
+ tokenMint: PublicKey;
128
+ quoteMint: PublicKey;
129
+ config: LiquidConfig;
130
+ }
131
+
132
+ /**
133
+ * Builds an updateFeeConfig instruction that permanently revokes the update authority
134
+ * by setting it to the default public key (all zeros). Irreversible.
135
+ *
136
+ * @param params - {@link BuildRevokeUpdateAuthorityParams}
137
+ * @returns Transaction instruction
138
+ */
139
+ export function buildRevokeUpdateAuthority(
140
+ params: BuildRevokeUpdateAuthorityParams,
141
+ ): Promise<TransactionInstruction> {
142
+ return buildUpdateFeeConfig({
143
+ ...params,
144
+ newUpdateAuthority: PublicKey.default,
145
+ });
146
+ }
147
+
125
148
  export interface BuildDistributeFeesParams {
126
149
  payer: PublicKey;
127
150
  tokenMint: PublicKey;
package/src/lut.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import {
2
- AddressLookupTableProgram,
3
2
  ComputeBudgetProgram,
4
3
  PublicKey,
5
4
  SystemProgram,
@@ -122,35 +121,4 @@ export async function fetchLut(
122
121
  ): Promise<AddressLookupTableAccount | null> {
123
122
  const result = await connection.getAddressLookupTable(lutAddress);
124
123
  return result.value;
125
- }
126
-
127
- /**
128
- * Creates instructions to create and extend an Address Lookup Table.
129
- *
130
- * @param authority - The LUT authority (usually admin keypair)
131
- * @param payer - The rent payer
132
- * @param accounts - The accounts to add to the LUT
133
- * @param recentSlot - A recent slot for LUT derivation
134
- * @returns The LUT address and the create + extend instructions
135
- */
136
- export function buildCreateLutInstructions(
137
- authority: PublicKey,
138
- payer: PublicKey,
139
- accounts: PublicKey[],
140
- recentSlot: number,
141
- ) {
142
- const [createIx, lutAddress] = AddressLookupTableProgram.createLookupTable({
143
- authority,
144
- payer,
145
- recentSlot,
146
- });
147
-
148
- const extendIx = AddressLookupTableProgram.extendLookupTable({
149
- payer,
150
- authority,
151
- lookupTable: lutAddress,
152
- addresses: accounts,
153
- });
154
-
155
- return { lutAddress, instructions: [createIx, extendIx] };
156
- }
124
+ }