@liquid-af/sdk 0.1.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/README.md +776 -0
- package/dist/accounts/index.d.ts +5 -0
- package/dist/accounts/index.d.ts.map +1 -0
- package/dist/accounts/index.js +5 -0
- package/dist/accounts/index.js.map +1 -0
- package/dist/accounts/liquid-fees.d.ts +63 -0
- package/dist/accounts/liquid-fees.d.ts.map +1 -0
- package/dist/accounts/liquid-fees.js +27 -0
- package/dist/accounts/liquid-fees.js.map +1 -0
- package/dist/accounts/liquid-state.d.ts +112 -0
- package/dist/accounts/liquid-state.d.ts.map +1 -0
- package/dist/accounts/liquid-state.js +92 -0
- package/dist/accounts/liquid-state.js.map +1 -0
- package/dist/accounts/liquid-swap.d.ts +97 -0
- package/dist/accounts/liquid-swap.d.ts.map +1 -0
- package/dist/accounts/liquid-swap.js +54 -0
- package/dist/accounts/liquid-swap.js.map +1 -0
- package/dist/accounts/liquid.d.ts +175 -0
- package/dist/accounts/liquid.d.ts.map +1 -0
- package/dist/accounts/liquid.js +66 -0
- package/dist/accounts/liquid.js.map +1 -0
- package/dist/client.d.ts +621 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +511 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +56 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +44 -0
- package/dist/config.js.map +1 -0
- package/dist/errors.d.ts +39 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +63 -0
- package/dist/errors.js.map +1 -0
- package/dist/events/index.d.ts +4 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +2 -0
- package/dist/events/index.js.map +1 -0
- package/dist/events/parser.d.ts +40 -0
- package/dist/events/parser.d.ts.map +1 -0
- package/dist/events/parser.js +67 -0
- package/dist/events/parser.js.map +1 -0
- package/dist/events/types.d.ts +286 -0
- package/dist/events/types.d.ts.map +1 -0
- package/dist/events/types.js +2 -0
- package/dist/events/types.js.map +1 -0
- package/dist/helpers/index.d.ts +4 -0
- package/dist/helpers/index.d.ts.map +1 -0
- package/dist/helpers/index.js +3 -0
- package/dist/helpers/index.js.map +1 -0
- package/dist/helpers/preview.d.ts +259 -0
- package/dist/helpers/preview.d.ts.map +1 -0
- package/dist/helpers/preview.js +458 -0
- package/dist/helpers/preview.js.map +1 -0
- package/dist/helpers/user.d.ts +11 -0
- package/dist/helpers/user.d.ts.map +1 -0
- package/dist/helpers/user.js +20 -0
- package/dist/helpers/user.js.map +1 -0
- package/dist/idl/index.d.ts +53 -0
- package/dist/idl/index.d.ts.map +1 -0
- package/dist/idl/index.js +64 -0
- package/dist/idl/index.js.map +1 -0
- package/dist/idl/liquid.d.ts +10523 -0
- package/dist/idl/liquid.d.ts.map +1 -0
- package/dist/idl/liquid.js +2 -0
- package/dist/idl/liquid.js.map +1 -0
- package/dist/idl/liquid.json +10516 -0
- package/dist/idl/liquid_fees.d.ts +1520 -0
- package/dist/idl/liquid_fees.d.ts.map +1 -0
- package/dist/idl/liquid_fees.js +2 -0
- package/dist/idl/liquid_fees.js.map +1 -0
- package/dist/idl/liquid_fees.json +1513 -0
- package/dist/idl/liquid_state.d.ts +2936 -0
- package/dist/idl/liquid_state.d.ts.map +1 -0
- package/dist/idl/liquid_state.js +2 -0
- package/dist/idl/liquid_state.js.map +1 -0
- package/dist/idl/liquid_state.json +2929 -0
- package/dist/idl/liquid_swap.d.ts +5849 -0
- package/dist/idl/liquid_swap.d.ts.map +1 -0
- package/dist/idl/liquid_swap.js +2 -0
- package/dist/idl/liquid_swap.js.map +1 -0
- package/dist/idl/liquid_swap.json +5842 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/instructions/index.d.ts +9 -0
- package/dist/instructions/index.d.ts.map +1 -0
- package/dist/instructions/index.js +9 -0
- package/dist/instructions/index.js.map +1 -0
- package/dist/instructions/liquid-fees.d.ts +111 -0
- package/dist/instructions/liquid-fees.d.ts.map +1 -0
- package/dist/instructions/liquid-fees.js +169 -0
- package/dist/instructions/liquid-fees.js.map +1 -0
- package/dist/instructions/liquid-state.d.ts +173 -0
- package/dist/instructions/liquid-state.d.ts.map +1 -0
- package/dist/instructions/liquid-state.js +194 -0
- package/dist/instructions/liquid-state.js.map +1 -0
- package/dist/instructions/liquid-swap.d.ts +122 -0
- package/dist/instructions/liquid-swap.d.ts.map +1 -0
- package/dist/instructions/liquid-swap.js +167 -0
- package/dist/instructions/liquid-swap.js.map +1 -0
- package/dist/instructions/liquid.d.ts +297 -0
- package/dist/instructions/liquid.d.ts.map +1 -0
- package/dist/instructions/liquid.js +483 -0
- package/dist/instructions/liquid.js.map +1 -0
- package/dist/instructions/program-cache.d.ts +35 -0
- package/dist/instructions/program-cache.d.ts.map +1 -0
- package/dist/instructions/program-cache.js +68 -0
- package/dist/instructions/program-cache.js.map +1 -0
- package/dist/math/amm.d.ts +42 -0
- package/dist/math/amm.d.ts.map +1 -0
- package/dist/math/amm.js +109 -0
- package/dist/math/amm.js.map +1 -0
- package/dist/math/bonding-curve.d.ts +34 -0
- package/dist/math/bonding-curve.d.ts.map +1 -0
- package/dist/math/bonding-curve.js +80 -0
- package/dist/math/bonding-curve.js.map +1 -0
- package/dist/math/constants.d.ts +14 -0
- package/dist/math/constants.d.ts.map +1 -0
- package/dist/math/constants.js +14 -0
- package/dist/math/constants.js.map +1 -0
- package/dist/math/fees.d.ts +88 -0
- package/dist/math/fees.d.ts.map +1 -0
- package/dist/math/fees.js +135 -0
- package/dist/math/fees.js.map +1 -0
- package/dist/math/index.d.ts +8 -0
- package/dist/math/index.d.ts.map +1 -0
- package/dist/math/index.js +6 -0
- package/dist/math/index.js.map +1 -0
- package/dist/math/tiered-fees.d.ts +80 -0
- package/dist/math/tiered-fees.d.ts.map +1 -0
- package/dist/math/tiered-fees.js +129 -0
- package/dist/math/tiered-fees.js.map +1 -0
- package/dist/oracle.d.ts +53 -0
- package/dist/oracle.d.ts.map +1 -0
- package/dist/oracle.js +70 -0
- package/dist/oracle.js.map +1 -0
- package/dist/pda/index.d.ts +89 -0
- package/dist/pda/index.d.ts.map +1 -0
- package/dist/pda/index.js +127 -0
- package/dist/pda/index.js.map +1 -0
- package/dist/pda/liquid-fees.d.ts +27 -0
- package/dist/pda/liquid-fees.d.ts.map +1 -0
- package/dist/pda/liquid-fees.js +36 -0
- package/dist/pda/liquid-fees.js.map +1 -0
- package/dist/pda/liquid-state.d.ts +56 -0
- package/dist/pda/liquid-state.d.ts.map +1 -0
- package/dist/pda/liquid-state.js +79 -0
- package/dist/pda/liquid-state.js.map +1 -0
- package/dist/pda/liquid-swap.d.ts +76 -0
- package/dist/pda/liquid-swap.d.ts.map +1 -0
- package/dist/pda/liquid-swap.js +103 -0
- package/dist/pda/liquid-swap.js.map +1 -0
- package/dist/pda/liquid.d.ts +67 -0
- package/dist/pda/liquid.d.ts.map +1 -0
- package/dist/pda/liquid.js +91 -0
- package/dist/pda/liquid.js.map +1 -0
- package/dist/provider.d.ts +26 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +47 -0
- package/dist/provider.js.map +1 -0
- package/dist/transaction/builder.d.ts +30 -0
- package/dist/transaction/builder.d.ts.map +1 -0
- package/dist/transaction/builder.js +48 -0
- package/dist/transaction/builder.js.map +1 -0
- package/dist/transaction/index.d.ts +3 -0
- package/dist/transaction/index.d.ts.map +1 -0
- package/dist/transaction/index.js +3 -0
- package/dist/transaction/index.js.map +1 -0
- package/dist/transaction/send.d.ts +25 -0
- package/dist/transaction/send.d.ts.map +1 -0
- package/dist/transaction/send.js +52 -0
- package/dist/transaction/send.js.map +1 -0
- package/dist/types.d.ts +311 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +46 -0
- package/dist/types.js.map +1 -0
- package/package.json +112 -0
- package/src/accounts/index.ts +26 -0
- package/src/accounts/liquid-fees.ts +38 -0
- package/src/accounts/liquid-state.ts +134 -0
- package/src/accounts/liquid-swap.ts +79 -0
- package/src/accounts/liquid.ts +100 -0
- package/src/client.ts +1001 -0
- package/src/config.ts +91 -0
- package/src/errors.ts +94 -0
- package/src/events/index.ts +42 -0
- package/src/events/parser.ts +90 -0
- package/src/events/types.ts +310 -0
- package/src/helpers/index.ts +23 -0
- package/src/helpers/preview.ts +798 -0
- package/src/helpers/user.ts +24 -0
- package/src/idl/index.ts +94 -0
- package/src/idl/liquid.json +10516 -0
- package/src/idl/liquid.ts +10522 -0
- package/src/idl/liquid_fees.json +1513 -0
- package/src/idl/liquid_fees.ts +1519 -0
- package/src/idl/liquid_state.json +2929 -0
- package/src/idl/liquid_state.ts +2935 -0
- package/src/idl/liquid_swap.json +5842 -0
- package/src/idl/liquid_swap.ts +5848 -0
- package/src/index.ts +98 -0
- package/src/instructions/index.ts +109 -0
- package/src/instructions/liquid-fees.ts +289 -0
- package/src/instructions/liquid-state.ts +336 -0
- package/src/instructions/liquid-swap.ts +414 -0
- package/src/instructions/liquid.ts +884 -0
- package/src/instructions/program-cache.ts +106 -0
- package/src/math/amm.ts +146 -0
- package/src/math/bonding-curve.ts +122 -0
- package/src/math/constants.ts +19 -0
- package/src/math/fees.ts +191 -0
- package/src/math/index.ts +40 -0
- package/src/math/tiered-fees.ts +165 -0
- package/src/oracle.ts +97 -0
- package/src/pda/index.ts +331 -0
- package/src/pda/liquid-fees.ts +58 -0
- package/src/pda/liquid-state.ts +123 -0
- package/src/pda/liquid-swap.ts +162 -0
- package/src/pda/liquid.ts +152 -0
- package/src/provider.ts +60 -0
- package/src/transaction/builder.ts +80 -0
- package/src/transaction/index.ts +6 -0
- package/src/transaction/send.ts +72 -0
- package/src/types.ts +354 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liquid.d.ts","sourceRoot":"","sources":["../../src/accounts/liquid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAQjD;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAC5C,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,YAAY;;;;;;;;;;;;;;;;;GAKpB;AAED;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAC5C,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;GAKpB;AAED;;;;;;;GAOG;AACH,wBAAsB,gCAAgC,CACrD,UAAU,EAAE,UAAU,EACtB,mBAAmB,EAAE,SAAS,EAC9B,MAAM,EAAE,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;GAIpB;AAED;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CAC5C,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,SAAS,EACf,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;GASpB;AAED;;;;;;;GAOG;AACH,wBAAsB,gCAAgC,CACrD,UAAU,EAAE,UAAU,EACtB,yBAAyB,EAAE,SAAS,EACpC,MAAM,EAAE,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAIpB"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { getLiquidGlobalConfigPDA, getBondingCurvePDA, getStableBondingCurvePDA, } from "../pda/liquid.js";
|
|
2
|
+
import { getLiquidProgram } from "../idl/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Fetches the global configuration for the bonding curve program.
|
|
5
|
+
*
|
|
6
|
+
* @param connection - Solana RPC connection
|
|
7
|
+
* @param config - Liquid protocol configuration
|
|
8
|
+
* @returns The deserialized global configuration account
|
|
9
|
+
*/
|
|
10
|
+
export async function fetchLiquidGlobalConfig(connection, config) {
|
|
11
|
+
const program = getLiquidProgram(connection, config);
|
|
12
|
+
const [pda] = getLiquidGlobalConfigPDA(config.liquidProgramId);
|
|
13
|
+
return program.account.globalConfiguration.fetch(pda);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Fetches a bonding curve account by mint address.
|
|
17
|
+
*
|
|
18
|
+
* @param connection - Solana RPC connection
|
|
19
|
+
* @param mint - Token mint address
|
|
20
|
+
* @param config - Liquid protocol configuration
|
|
21
|
+
* @returns The deserialized bonding curve account
|
|
22
|
+
*/
|
|
23
|
+
export async function fetchNativeBondingCurve(connection, mint, config) {
|
|
24
|
+
const program = getLiquidProgram(connection, config);
|
|
25
|
+
const [pda] = getBondingCurvePDA(mint, config.liquidProgramId);
|
|
26
|
+
return program.account.nativeBondingCurve.fetch(pda);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Fetches a bonding curve account by its PDA address directly.
|
|
30
|
+
*
|
|
31
|
+
* @param connection - Solana RPC connection
|
|
32
|
+
* @param bondingCurveAddress - The bonding curve PDA address
|
|
33
|
+
* @param config - Liquid protocol configuration
|
|
34
|
+
* @returns The deserialized bonding curve account
|
|
35
|
+
*/
|
|
36
|
+
export async function fetchNativeBondingCurveByAddress(connection, bondingCurveAddress, config) {
|
|
37
|
+
const program = getLiquidProgram(connection, config);
|
|
38
|
+
return program.account.nativeBondingCurve.fetch(bondingCurveAddress);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Fetches a token bonding curve account by mint and quote mint addresses.
|
|
42
|
+
*
|
|
43
|
+
* @param connection - Solana RPC connection
|
|
44
|
+
* @param mint - Token mint address (base token)
|
|
45
|
+
* @param quoteMint - Quote token mint address (e.g., USDC)
|
|
46
|
+
* @param config - Liquid protocol configuration
|
|
47
|
+
* @returns The deserialized token bonding curve account
|
|
48
|
+
*/
|
|
49
|
+
export async function fetchStableBondingCurve(connection, mint, quoteMint, config) {
|
|
50
|
+
const program = getLiquidProgram(connection, config);
|
|
51
|
+
const [pda] = getStableBondingCurvePDA(mint, quoteMint, config.liquidProgramId);
|
|
52
|
+
return program.account.stableBondingCurve.fetch(pda);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Fetches a token bonding curve account by its PDA address directly.
|
|
56
|
+
*
|
|
57
|
+
* @param connection - Solana RPC connection
|
|
58
|
+
* @param stableBondingCurveAddress - The token bonding curve PDA address
|
|
59
|
+
* @param config - Liquid protocol configuration
|
|
60
|
+
* @returns The deserialized token bonding curve account
|
|
61
|
+
*/
|
|
62
|
+
export async function fetchStableBondingCurveByAddress(connection, stableBondingCurveAddress, config) {
|
|
63
|
+
const program = getLiquidProgram(connection, config);
|
|
64
|
+
return program.account.stableBondingCurve.fetch(stableBondingCurveAddress);
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=liquid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liquid.js","sourceRoot":"","sources":["../../src/accounts/liquid.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,wBAAwB,EACxB,kBAAkB,EAClB,wBAAwB,GACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC5C,UAAsB,EACtB,MAAoB;IAEpB,MAAM,OAAO,GAAG,gBAAgB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACrD,MAAM,CAAC,GAAG,CAAC,GAAG,wBAAwB,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IAC/D,OAAO,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACvD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC5C,UAAsB,EACtB,IAAe,EACf,MAAoB;IAEpB,MAAM,OAAO,GAAG,gBAAgB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACrD,MAAM,CAAC,GAAG,CAAC,GAAG,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC;IAC/D,OAAO,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACtD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,gCAAgC,CACrD,UAAsB,EACtB,mBAA8B,EAC9B,MAAoB;IAEpB,MAAM,OAAO,GAAG,gBAAgB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACrD,OAAO,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;AACtE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC5C,UAAsB,EACtB,IAAe,EACf,SAAoB,EACpB,MAAoB;IAEpB,MAAM,OAAO,GAAG,gBAAgB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACrD,MAAM,CAAC,GAAG,CAAC,GAAG,wBAAwB,CACrC,IAAI,EACJ,SAAS,EACT,MAAM,CAAC,eAAe,CACtB,CAAC;IACF,OAAO,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACtD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,gCAAgC,CACrD,UAAsB,EACtB,yBAAoC,EACpC,MAAoB;IAEpB,MAAM,OAAO,GAAG,gBAAgB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACrD,OAAO,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;AAC5E,CAAC"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,621 @@
|
|
|
1
|
+
import type { Connection, PublicKey, Transaction, TransactionInstruction } from "@solana/web3.js";
|
|
2
|
+
import type BN from "bn.js";
|
|
3
|
+
import { type LiquidConfig } from "./config.js";
|
|
4
|
+
import type { BuyCurvePreview, SellCurvePreview, SwapPreview, FeeRecipient } from "./types.js";
|
|
5
|
+
import { type BuildTransactionOptions } from "./transaction/builder.js";
|
|
6
|
+
import { type RecipientVaultPair } from "./instructions/liquid-fees.js";
|
|
7
|
+
import { type CurveAsyncOptions, type SwapPrefetchedState } from "./helpers/preview.js";
|
|
8
|
+
export interface LiquidClientConfig {
|
|
9
|
+
connection: Connection;
|
|
10
|
+
config?: LiquidConfig;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Unified entry point for the Liquid protocol SDK.
|
|
14
|
+
*
|
|
15
|
+
* Holds a `Connection` and `LiquidConfig`, removing the need to pass them
|
|
16
|
+
* to every function call. Auto-resolves token programs and pool PDAs for
|
|
17
|
+
* AMM operations. All instruction-building methods return unsigned
|
|
18
|
+
* `TransactionInstruction`s — the caller is responsible for signing.
|
|
19
|
+
*/
|
|
20
|
+
export declare class LiquidClient {
|
|
21
|
+
readonly connection: Connection;
|
|
22
|
+
readonly config: LiquidConfig;
|
|
23
|
+
/**
|
|
24
|
+
* @param options - Client configuration with connection and optional protocol config
|
|
25
|
+
*/
|
|
26
|
+
constructor({ connection, config }: LiquidClientConfig);
|
|
27
|
+
/** Builds a createCurve instruction for launching a new token on the bonding curve. */
|
|
28
|
+
buildCreateCurve(params: {
|
|
29
|
+
creator: PublicKey;
|
|
30
|
+
mint: PublicKey;
|
|
31
|
+
pythPriceFeed: PublicKey;
|
|
32
|
+
name: string;
|
|
33
|
+
symbol: string;
|
|
34
|
+
uri: string;
|
|
35
|
+
}): Promise<TransactionInstruction>;
|
|
36
|
+
/** Builds a buyOnCurve instruction. Requires the creator address and Pyth price feed. */
|
|
37
|
+
buildBuyOnCurve(params: {
|
|
38
|
+
user: PublicKey;
|
|
39
|
+
mint: PublicKey;
|
|
40
|
+
creator: PublicKey;
|
|
41
|
+
pythPriceFeed: PublicKey;
|
|
42
|
+
amountIn: BN;
|
|
43
|
+
minAmountOut: BN;
|
|
44
|
+
feeRecipient: PublicKey;
|
|
45
|
+
creatorReferralVault?: PublicKey | null;
|
|
46
|
+
traderReferralVault?: PublicKey | null;
|
|
47
|
+
}): Promise<TransactionInstruction>;
|
|
48
|
+
/**
|
|
49
|
+
* Like `buildBuyOnCurve` but auto-fetches the bonding curve creator.
|
|
50
|
+
*/
|
|
51
|
+
buildBuyOnCurveAutoResolve(params: {
|
|
52
|
+
user: PublicKey;
|
|
53
|
+
mint: PublicKey;
|
|
54
|
+
pythPriceFeed: PublicKey;
|
|
55
|
+
amountIn: BN;
|
|
56
|
+
minAmountOut: BN;
|
|
57
|
+
feeRecipient: PublicKey;
|
|
58
|
+
creatorReferralVault?: PublicKey | null;
|
|
59
|
+
traderReferralVault?: PublicKey | null;
|
|
60
|
+
}): Promise<TransactionInstruction>;
|
|
61
|
+
/** Builds a sellOnCurve instruction. Requires the creator address and Pyth price feed. */
|
|
62
|
+
buildSellOnCurve(params: {
|
|
63
|
+
user: PublicKey;
|
|
64
|
+
mint: PublicKey;
|
|
65
|
+
creator: PublicKey;
|
|
66
|
+
pythPriceFeed: PublicKey;
|
|
67
|
+
amountIn: BN;
|
|
68
|
+
minAmountOut: BN;
|
|
69
|
+
feeRecipient: PublicKey;
|
|
70
|
+
creatorReferralVault?: PublicKey | null;
|
|
71
|
+
traderReferralVault?: PublicKey | null;
|
|
72
|
+
}): Promise<TransactionInstruction>;
|
|
73
|
+
/**
|
|
74
|
+
* Like `buildSellOnCurve` but auto-fetches the bonding curve creator.
|
|
75
|
+
*/
|
|
76
|
+
buildSellOnCurveAutoResolve(params: {
|
|
77
|
+
user: PublicKey;
|
|
78
|
+
mint: PublicKey;
|
|
79
|
+
pythPriceFeed: PublicKey;
|
|
80
|
+
amountIn: BN;
|
|
81
|
+
minAmountOut: BN;
|
|
82
|
+
feeRecipient: PublicKey;
|
|
83
|
+
creatorReferralVault?: PublicKey | null;
|
|
84
|
+
traderReferralVault?: PublicKey | null;
|
|
85
|
+
}): Promise<TransactionInstruction>;
|
|
86
|
+
/** Builds a migrate instruction (bonding curve → AMM pool). Permissionless once the curve completes. */
|
|
87
|
+
buildMigrateNative(params: {
|
|
88
|
+
migrator: PublicKey;
|
|
89
|
+
mint: PublicKey;
|
|
90
|
+
}): Promise<TransactionInstruction>;
|
|
91
|
+
/** Builds an initializeNativeReferralVault instruction (creates native SOL referral vault). */
|
|
92
|
+
buildInitializeNativeReferralVault(params: {
|
|
93
|
+
user: PublicKey;
|
|
94
|
+
}): Promise<TransactionInstruction>;
|
|
95
|
+
/** Builds a withdrawReferralRewards instruction. */
|
|
96
|
+
buildWithdrawReferralRewards(params: {
|
|
97
|
+
user: PublicKey;
|
|
98
|
+
}): Promise<TransactionInstruction>;
|
|
99
|
+
/** Builds an executeBuybackNative instruction for native SOL curves. Permissionless; requires revoked fee config. */
|
|
100
|
+
buildExecuteBuybackNative(params: {
|
|
101
|
+
payer: PublicKey;
|
|
102
|
+
mint: PublicKey;
|
|
103
|
+
pythPriceFeed: PublicKey;
|
|
104
|
+
}): Promise<TransactionInstruction>;
|
|
105
|
+
/** Builds an executeBuybackToken instruction for token-based curves. Permissionless; requires revoked fee config. */
|
|
106
|
+
buildExecuteBuybackToken(params: {
|
|
107
|
+
payer: PublicKey;
|
|
108
|
+
mint: PublicKey;
|
|
109
|
+
quoteMint: PublicKey;
|
|
110
|
+
}): Promise<TransactionInstruction>;
|
|
111
|
+
/**
|
|
112
|
+
* Builds a create pool instruction. Auto-resolves token programs if not provided.
|
|
113
|
+
*/
|
|
114
|
+
buildCreatePool(params: {
|
|
115
|
+
signer: PublicKey;
|
|
116
|
+
baseMint: PublicKey;
|
|
117
|
+
quoteMint?: PublicKey;
|
|
118
|
+
initAmountBase: BN;
|
|
119
|
+
initAmountQuote: BN;
|
|
120
|
+
baseTokenProgram?: PublicKey;
|
|
121
|
+
quoteTokenProgram?: PublicKey;
|
|
122
|
+
}): Promise<TransactionInstruction>;
|
|
123
|
+
/**
|
|
124
|
+
* Builds a buy swap instruction (quote -> base).
|
|
125
|
+
* Auto-resolves token programs if not provided. Defaults quoteMint to WSOL.
|
|
126
|
+
*/
|
|
127
|
+
buildSwapBuy(params: {
|
|
128
|
+
payer: PublicKey;
|
|
129
|
+
creator: PublicKey;
|
|
130
|
+
baseMint: PublicKey;
|
|
131
|
+
quoteMint?: PublicKey;
|
|
132
|
+
maxAmountIn: BN;
|
|
133
|
+
amountOut: BN;
|
|
134
|
+
feeRecipient: PublicKey;
|
|
135
|
+
baseTokenProgram?: PublicKey;
|
|
136
|
+
quoteTokenProgram?: PublicKey;
|
|
137
|
+
}): Promise<TransactionInstruction>;
|
|
138
|
+
/**
|
|
139
|
+
* Builds a sell swap instruction (base -> quote).
|
|
140
|
+
* Auto-resolves token programs if not provided. Defaults quoteMint to WSOL.
|
|
141
|
+
*/
|
|
142
|
+
buildSwapSell(params: {
|
|
143
|
+
payer: PublicKey;
|
|
144
|
+
creator: PublicKey;
|
|
145
|
+
baseMint: PublicKey;
|
|
146
|
+
quoteMint?: PublicKey;
|
|
147
|
+
amountIn: BN;
|
|
148
|
+
minimumAmountOut: BN;
|
|
149
|
+
feeRecipient: PublicKey;
|
|
150
|
+
baseTokenProgram?: PublicKey;
|
|
151
|
+
quoteTokenProgram?: PublicKey;
|
|
152
|
+
}): Promise<TransactionInstruction>;
|
|
153
|
+
/**
|
|
154
|
+
* Builds a deposit (add liquidity) instruction.
|
|
155
|
+
* Auto-resolves pool PDAs, vaults, LP mint, and token programs.
|
|
156
|
+
* Defaults quoteMint to WSOL.
|
|
157
|
+
*/
|
|
158
|
+
buildDeposit(params: {
|
|
159
|
+
owner: PublicKey;
|
|
160
|
+
baseMint: PublicKey;
|
|
161
|
+
quoteMint?: PublicKey;
|
|
162
|
+
lpTokenAmount: BN;
|
|
163
|
+
maximumBaseAmount: BN;
|
|
164
|
+
maximumQuoteAmount: BN;
|
|
165
|
+
baseTokenProgram?: PublicKey;
|
|
166
|
+
quoteTokenProgram?: PublicKey;
|
|
167
|
+
}): Promise<TransactionInstruction>;
|
|
168
|
+
/**
|
|
169
|
+
* Builds a withdraw (remove liquidity) instruction.
|
|
170
|
+
* Auto-resolves pool PDAs, vaults, LP mint, and token programs.
|
|
171
|
+
* Defaults quoteMint to WSOL.
|
|
172
|
+
*/
|
|
173
|
+
buildWithdraw(params: {
|
|
174
|
+
owner: PublicKey;
|
|
175
|
+
baseMint: PublicKey;
|
|
176
|
+
quoteMint?: PublicKey;
|
|
177
|
+
lpTokenAmount: BN;
|
|
178
|
+
minimumBaseAmount: BN;
|
|
179
|
+
minimumQuoteAmount: BN;
|
|
180
|
+
baseTokenProgram?: PublicKey;
|
|
181
|
+
quoteTokenProgram?: PublicKey;
|
|
182
|
+
}): Promise<TransactionInstruction>;
|
|
183
|
+
/**
|
|
184
|
+
* Builds an executeBuyback instruction for an AMM pool.
|
|
185
|
+
* Auto-resolves token programs if not provided. Defaults quoteMint to WSOL.
|
|
186
|
+
*/
|
|
187
|
+
buildSwapExecuteBuyback(params: {
|
|
188
|
+
payer: PublicKey;
|
|
189
|
+
baseMint: PublicKey;
|
|
190
|
+
quoteMint?: PublicKey;
|
|
191
|
+
baseTokenProgram?: PublicKey;
|
|
192
|
+
quoteTokenProgram?: PublicKey;
|
|
193
|
+
}): Promise<TransactionInstruction>;
|
|
194
|
+
/** Builds an updateFeeConfig instruction. Cannot be called on revoked configs. */
|
|
195
|
+
buildUpdateFeeConfig(params: {
|
|
196
|
+
authority: PublicKey;
|
|
197
|
+
tokenMint: PublicKey;
|
|
198
|
+
recipients?: FeeRecipient[] | null;
|
|
199
|
+
newUpdateAuthority?: PublicKey | null;
|
|
200
|
+
/** Required when changing recipients to verify token fee vault is drained. */
|
|
201
|
+
quoteMint?: PublicKey;
|
|
202
|
+
}): Promise<TransactionInstruction>;
|
|
203
|
+
/** Builds a revokeFeeConfig instruction. Permanently sets fee mode to Revoked. Irreversible. */
|
|
204
|
+
buildRevokeFeeConfig(params: {
|
|
205
|
+
authority: PublicKey;
|
|
206
|
+
tokenMint: PublicKey;
|
|
207
|
+
quoteMint: PublicKey;
|
|
208
|
+
}): Promise<TransactionInstruction>;
|
|
209
|
+
/** Builds a permissionless distributeFees instruction (SOL fees). */
|
|
210
|
+
buildDistributeFees(params: {
|
|
211
|
+
payer: PublicKey;
|
|
212
|
+
tokenMint: PublicKey;
|
|
213
|
+
recipientVaults: PublicKey[];
|
|
214
|
+
}): Promise<TransactionInstruction>;
|
|
215
|
+
/** Builds a permissionless distributeTokenFees instruction (SPL token fees). */
|
|
216
|
+
buildDistributeTokenFees(params: {
|
|
217
|
+
payer: PublicKey;
|
|
218
|
+
tokenMint: PublicKey;
|
|
219
|
+
quoteMint: PublicKey;
|
|
220
|
+
recipientVaultPairs: RecipientVaultPair[];
|
|
221
|
+
}): Promise<TransactionInstruction>;
|
|
222
|
+
/** Builds a claimFees instruction. Recipient claims accumulated SOL from their vault PDA. */
|
|
223
|
+
buildClaimFees(params: {
|
|
224
|
+
recipient: PublicKey;
|
|
225
|
+
tokenMint: PublicKey;
|
|
226
|
+
}): Promise<TransactionInstruction>;
|
|
227
|
+
/** Builds a claimTokenFees instruction. Recipient claims accumulated tokens from their vault ATA. */
|
|
228
|
+
buildClaimTokenFees(params: {
|
|
229
|
+
recipient: PublicKey;
|
|
230
|
+
tokenMint: PublicKey;
|
|
231
|
+
quoteMint: PublicKey;
|
|
232
|
+
}): Promise<TransactionInstruction>;
|
|
233
|
+
/** Builds an initializeUser instruction. Creates the user properties account. */
|
|
234
|
+
buildInitializeUser(params: {
|
|
235
|
+
user: PublicKey;
|
|
236
|
+
}): Promise<TransactionInstruction>;
|
|
237
|
+
/** Builds a setReferrer instruction. One-time operation — referrer cannot be changed. */
|
|
238
|
+
buildSetReferrer(params: {
|
|
239
|
+
user: PublicKey;
|
|
240
|
+
referrer: PublicKey;
|
|
241
|
+
}): Promise<TransactionInstruction>;
|
|
242
|
+
/** Builds a setCashbackMode instruction. Toggles between earning and spending mode. */
|
|
243
|
+
buildSetCashbackMode(params: {
|
|
244
|
+
user: PublicKey;
|
|
245
|
+
}): Promise<TransactionInstruction>;
|
|
246
|
+
/** Builds a transferAdmin instruction. Proposes admin transfer to a new pubkey (two-step). */
|
|
247
|
+
buildTransferAdmin(params: {
|
|
248
|
+
admin: PublicKey;
|
|
249
|
+
newAdmin: PublicKey;
|
|
250
|
+
}): Promise<TransactionInstruction>;
|
|
251
|
+
/** Builds an acceptAdmin instruction. Completes a pending admin transfer. */
|
|
252
|
+
buildAcceptAdmin(params: {
|
|
253
|
+
newAdmin: PublicKey;
|
|
254
|
+
}): Promise<TransactionInstruction>;
|
|
255
|
+
/** Builds a cancelAdminTransfer instruction. Cancels a pending admin transfer. */
|
|
256
|
+
buildCancelAdminTransfer(params: {
|
|
257
|
+
authority: PublicKey;
|
|
258
|
+
}): Promise<TransactionInstruction>;
|
|
259
|
+
/** Builds a createDeal instruction. Admin creates an exclusive deal for a pubkey. */
|
|
260
|
+
buildCreateDeal(params: {
|
|
261
|
+
admin: PublicKey;
|
|
262
|
+
owner: PublicKey;
|
|
263
|
+
cashbackMultiplierBps: number;
|
|
264
|
+
payer: PublicKey;
|
|
265
|
+
}): Promise<TransactionInstruction>;
|
|
266
|
+
/** Builds an updateDeal instruction. Admin updates a deal's cashback multiplier. */
|
|
267
|
+
buildUpdateDeal(params: {
|
|
268
|
+
admin: PublicKey;
|
|
269
|
+
dealOwner: PublicKey;
|
|
270
|
+
newCashbackMultiplierBps: number;
|
|
271
|
+
}): Promise<TransactionInstruction>;
|
|
272
|
+
/** Builds a closeDeal instruction. Admin closes/deletes a deal, returning rent. */
|
|
273
|
+
buildCloseDeal(params: {
|
|
274
|
+
admin: PublicKey;
|
|
275
|
+
dealOwner: PublicKey;
|
|
276
|
+
}): Promise<TransactionInstruction>;
|
|
277
|
+
/** Builds a redeemDeal instruction. User redeems their referrer's deal. */
|
|
278
|
+
buildRedeemDeal(params: {
|
|
279
|
+
user: PublicKey;
|
|
280
|
+
dealOwner: PublicKey;
|
|
281
|
+
}): Promise<TransactionInstruction>;
|
|
282
|
+
/** Builds a takeSnapshot instruction. Admin takes a snapshot of a user's volume. */
|
|
283
|
+
buildTakeSnapshot(params: {
|
|
284
|
+
admin: PublicKey;
|
|
285
|
+
user: PublicKey;
|
|
286
|
+
payer: PublicKey;
|
|
287
|
+
snapshotIndex: number;
|
|
288
|
+
}): Promise<TransactionInstruction>;
|
|
289
|
+
/** Builds an adminUpdateUser instruction. Admin updates a user's referrer/multiplier and takes a snapshot. */
|
|
290
|
+
buildAdminUpdateUser(params: {
|
|
291
|
+
admin: PublicKey;
|
|
292
|
+
user: PublicKey;
|
|
293
|
+
payer: PublicKey;
|
|
294
|
+
newReferrer: PublicKey | null;
|
|
295
|
+
newCashbackMultiplierBps: number | null;
|
|
296
|
+
snapshotIndex: number;
|
|
297
|
+
}): Promise<TransactionInstruction>;
|
|
298
|
+
/** Fetches the global configuration for the bonding curve program. */
|
|
299
|
+
fetchLiquidGlobalConfig(): Promise<{
|
|
300
|
+
adminAuthority: PublicKey;
|
|
301
|
+
initialVirtualReserveUsd: BN;
|
|
302
|
+
migrationMarketCapUsd: BN;
|
|
303
|
+
initialVirtualTokenReserves: BN;
|
|
304
|
+
initialRealTokenReserves: BN;
|
|
305
|
+
tokenTotalSupply: BN;
|
|
306
|
+
creatorFeeBasisPoints: number;
|
|
307
|
+
creatorReferralRewardBasisPoints: number;
|
|
308
|
+
traderReferralRewardBasisPoints: number;
|
|
309
|
+
protocolFeeBasisPoints: number;
|
|
310
|
+
feeRecipients: PublicKey[];
|
|
311
|
+
quoteMints: PublicKey[];
|
|
312
|
+
solUsdPriceFeed: PublicKey;
|
|
313
|
+
pendingAdmin: PublicKey | null;
|
|
314
|
+
bump: number;
|
|
315
|
+
paused: boolean;
|
|
316
|
+
}>;
|
|
317
|
+
/** Fetches a bonding curve account by token mint. */
|
|
318
|
+
fetchNativeBondingCurve(mint: PublicKey): Promise<{
|
|
319
|
+
creator: PublicKey;
|
|
320
|
+
tokenMint: PublicKey;
|
|
321
|
+
realTokenReserves: BN;
|
|
322
|
+
virtualTokenReserves: BN;
|
|
323
|
+
realSolReserves: BN;
|
|
324
|
+
tokenTotalSupply: BN;
|
|
325
|
+
initialVirtualReserveUsd: BN;
|
|
326
|
+
status: ({
|
|
327
|
+
complete?: undefined;
|
|
328
|
+
migrated?: undefined;
|
|
329
|
+
} & {
|
|
330
|
+
active: Record<string, never>;
|
|
331
|
+
}) | ({
|
|
332
|
+
active?: undefined;
|
|
333
|
+
migrated?: undefined;
|
|
334
|
+
} & {
|
|
335
|
+
complete: {
|
|
336
|
+
solPriceSnapshot: BN;
|
|
337
|
+
};
|
|
338
|
+
}) | ({
|
|
339
|
+
active?: undefined;
|
|
340
|
+
complete?: undefined;
|
|
341
|
+
} & {
|
|
342
|
+
migrated: Record<string, never>;
|
|
343
|
+
});
|
|
344
|
+
bump: number;
|
|
345
|
+
}>;
|
|
346
|
+
/** Fetches a bonding curve account by its PDA address directly. */
|
|
347
|
+
fetchNativeBondingCurveByAddress(address: PublicKey): Promise<{
|
|
348
|
+
creator: PublicKey;
|
|
349
|
+
tokenMint: PublicKey;
|
|
350
|
+
realTokenReserves: BN;
|
|
351
|
+
virtualTokenReserves: BN;
|
|
352
|
+
realSolReserves: BN;
|
|
353
|
+
tokenTotalSupply: BN;
|
|
354
|
+
initialVirtualReserveUsd: BN;
|
|
355
|
+
status: ({
|
|
356
|
+
complete?: undefined;
|
|
357
|
+
migrated?: undefined;
|
|
358
|
+
} & {
|
|
359
|
+
active: Record<string, never>;
|
|
360
|
+
}) | ({
|
|
361
|
+
active?: undefined;
|
|
362
|
+
migrated?: undefined;
|
|
363
|
+
} & {
|
|
364
|
+
complete: {
|
|
365
|
+
solPriceSnapshot: BN;
|
|
366
|
+
};
|
|
367
|
+
}) | ({
|
|
368
|
+
active?: undefined;
|
|
369
|
+
complete?: undefined;
|
|
370
|
+
} & {
|
|
371
|
+
migrated: Record<string, never>;
|
|
372
|
+
});
|
|
373
|
+
bump: number;
|
|
374
|
+
}>;
|
|
375
|
+
/** Fetches the AMM global configuration. */
|
|
376
|
+
fetchAmmConfig(): Promise<{
|
|
377
|
+
adminAuthority: PublicKey;
|
|
378
|
+
feeRecipients: PublicKey[];
|
|
379
|
+
quoteMints: PublicKey[];
|
|
380
|
+
feeTiers: {
|
|
381
|
+
rangeStartInclusive: BN;
|
|
382
|
+
rangeEndExclusive: BN;
|
|
383
|
+
lpFeeRate: number;
|
|
384
|
+
protocolFeeRate: number;
|
|
385
|
+
creatorFeeRate: number;
|
|
386
|
+
}[];
|
|
387
|
+
oraclePriceFeed: PublicKey;
|
|
388
|
+
pendingAdmin: PublicKey | null;
|
|
389
|
+
bump: number;
|
|
390
|
+
paused: boolean;
|
|
391
|
+
}>;
|
|
392
|
+
/** Fetches an AMM pool state by base and quote mint. */
|
|
393
|
+
fetchPoolState(baseMint: PublicKey, quoteMint?: PublicKey): Promise<{
|
|
394
|
+
baseVault: PublicKey;
|
|
395
|
+
quoteVault: PublicKey;
|
|
396
|
+
lpMint: PublicKey;
|
|
397
|
+
baseMint: PublicKey;
|
|
398
|
+
quoteMint: PublicKey;
|
|
399
|
+
baseTokenProgram: PublicKey;
|
|
400
|
+
quoteTokenProgram: PublicKey;
|
|
401
|
+
observationKey: PublicKey;
|
|
402
|
+
authBump: number;
|
|
403
|
+
lpMintDecimals: number;
|
|
404
|
+
baseDecimals: number;
|
|
405
|
+
quoteDecimals: number;
|
|
406
|
+
lpSupply: BN;
|
|
407
|
+
recentEpoch: BN;
|
|
408
|
+
creator: PublicKey;
|
|
409
|
+
}>;
|
|
410
|
+
/** Fetches a pool state by its PDA address directly. */
|
|
411
|
+
fetchPoolStateByAddress(address: PublicKey): Promise<{
|
|
412
|
+
baseVault: PublicKey;
|
|
413
|
+
quoteVault: PublicKey;
|
|
414
|
+
lpMint: PublicKey;
|
|
415
|
+
baseMint: PublicKey;
|
|
416
|
+
quoteMint: PublicKey;
|
|
417
|
+
baseTokenProgram: PublicKey;
|
|
418
|
+
quoteTokenProgram: PublicKey;
|
|
419
|
+
observationKey: PublicKey;
|
|
420
|
+
authBump: number;
|
|
421
|
+
lpMintDecimals: number;
|
|
422
|
+
baseDecimals: number;
|
|
423
|
+
quoteDecimals: number;
|
|
424
|
+
lpSupply: BN;
|
|
425
|
+
recentEpoch: BN;
|
|
426
|
+
creator: PublicKey;
|
|
427
|
+
}>;
|
|
428
|
+
/** Fetches the observation state (oracle data) for a pool. */
|
|
429
|
+
fetchObservationState(poolAddress: PublicKey): Promise<{
|
|
430
|
+
initialized: boolean;
|
|
431
|
+
observationIndex: number;
|
|
432
|
+
poolId: PublicKey;
|
|
433
|
+
observations: {
|
|
434
|
+
blockTimestamp: BN;
|
|
435
|
+
cumulativeBasePriceX32: BN;
|
|
436
|
+
cumulativeQuotePriceX32: BN;
|
|
437
|
+
}[];
|
|
438
|
+
lastUpdateTimestamp: BN;
|
|
439
|
+
padding: BN[];
|
|
440
|
+
}>;
|
|
441
|
+
/** Fetches the fee configuration for a token mint. */
|
|
442
|
+
fetchFeeConfig(tokenMint: PublicKey): Promise<{
|
|
443
|
+
creator: PublicKey;
|
|
444
|
+
tokenMint: PublicKey;
|
|
445
|
+
quoteMint: PublicKey;
|
|
446
|
+
feeMode: ({
|
|
447
|
+
revoked?: undefined;
|
|
448
|
+
} & {
|
|
449
|
+
recipients: Record<string, never>;
|
|
450
|
+
}) | ({
|
|
451
|
+
recipients?: undefined;
|
|
452
|
+
} & {
|
|
453
|
+
revoked: Record<string, never>;
|
|
454
|
+
});
|
|
455
|
+
recipientsCount: number;
|
|
456
|
+
recipients: {
|
|
457
|
+
pubkey: PublicKey;
|
|
458
|
+
basisPoints: number;
|
|
459
|
+
padding: number[];
|
|
460
|
+
}[];
|
|
461
|
+
updateAuthority: PublicKey;
|
|
462
|
+
bump: number;
|
|
463
|
+
}>;
|
|
464
|
+
/** Fetches a fee configuration by its PDA address directly. */
|
|
465
|
+
fetchFeeConfigByAddress(address: PublicKey): Promise<{
|
|
466
|
+
creator: PublicKey;
|
|
467
|
+
tokenMint: PublicKey;
|
|
468
|
+
quoteMint: PublicKey;
|
|
469
|
+
feeMode: ({
|
|
470
|
+
revoked?: undefined;
|
|
471
|
+
} & {
|
|
472
|
+
recipients: Record<string, never>;
|
|
473
|
+
}) | ({
|
|
474
|
+
recipients?: undefined;
|
|
475
|
+
} & {
|
|
476
|
+
revoked: Record<string, never>;
|
|
477
|
+
});
|
|
478
|
+
recipientsCount: number;
|
|
479
|
+
recipients: {
|
|
480
|
+
pubkey: PublicKey;
|
|
481
|
+
basisPoints: number;
|
|
482
|
+
padding: number[];
|
|
483
|
+
}[];
|
|
484
|
+
updateAuthority: PublicKey;
|
|
485
|
+
bump: number;
|
|
486
|
+
}>;
|
|
487
|
+
/** Fetches a user's properties (referrer, volumes, cashback state). */
|
|
488
|
+
fetchUserProperties(user: PublicKey): Promise<{
|
|
489
|
+
referrer: {
|
|
490
|
+
referrer: PublicKey;
|
|
491
|
+
deal: PublicKey | null;
|
|
492
|
+
cashbackMultiplierBps: number;
|
|
493
|
+
} | null;
|
|
494
|
+
totalSolVolume: BN;
|
|
495
|
+
totalTokenVolume: BN;
|
|
496
|
+
cashbackCredits: BN;
|
|
497
|
+
isSpending: boolean;
|
|
498
|
+
curveSolVolume: BN;
|
|
499
|
+
ammSolVolume: BN;
|
|
500
|
+
snapshotSolVolume: BN;
|
|
501
|
+
snapshotTokenVolume: BN;
|
|
502
|
+
snapshotCount: number;
|
|
503
|
+
latestSnapshot: PublicKey | null;
|
|
504
|
+
}>;
|
|
505
|
+
/** Fetches the token volume accumulator for a mint. */
|
|
506
|
+
fetchTokenVolume(mint: PublicKey): Promise<{
|
|
507
|
+
mint: PublicKey;
|
|
508
|
+
totalSolVolume: BN;
|
|
509
|
+
totalTokenVolume: BN;
|
|
510
|
+
curveSolVolume: BN;
|
|
511
|
+
ammSolVolume: BN;
|
|
512
|
+
}>;
|
|
513
|
+
/** Fetches the global curve volume accumulator. */
|
|
514
|
+
fetchGlobalCurveVolume(): Promise<{
|
|
515
|
+
totalSolVolume: BN;
|
|
516
|
+
totalTokenVolume: BN;
|
|
517
|
+
}>;
|
|
518
|
+
/** Fetches the global AMM volume accumulator. */
|
|
519
|
+
fetchGlobalAmmVolume(): Promise<{
|
|
520
|
+
totalSolVolume: BN;
|
|
521
|
+
totalTokenVolume: BN;
|
|
522
|
+
}>;
|
|
523
|
+
/** Fetches the cashback configuration. */
|
|
524
|
+
fetchCashbackConfig(): Promise<{
|
|
525
|
+
adminAuthority: PublicKey;
|
|
526
|
+
ranges: {
|
|
527
|
+
rangeStartInclusive: BN;
|
|
528
|
+
rangeEndExclusive: BN;
|
|
529
|
+
multiplierBasisPoints: number;
|
|
530
|
+
}[];
|
|
531
|
+
traderCashbackBasisPoints: number;
|
|
532
|
+
pendingAdmin: PublicKey | null;
|
|
533
|
+
}>;
|
|
534
|
+
/** Fetches a user snapshot by user and index. */
|
|
535
|
+
fetchUserSnapshot(user: PublicKey, index: number): Promise<{
|
|
536
|
+
user: PublicKey;
|
|
537
|
+
index: number;
|
|
538
|
+
prevSnapshot: PublicKey | null;
|
|
539
|
+
solVolume: BN;
|
|
540
|
+
tokenVolume: BN;
|
|
541
|
+
createdAt: BN;
|
|
542
|
+
}>;
|
|
543
|
+
/** Fetches a deal account by its owner. */
|
|
544
|
+
fetchDeal(owner: PublicKey): Promise<{
|
|
545
|
+
owner: PublicKey;
|
|
546
|
+
cashbackMultiplierBps: number;
|
|
547
|
+
redemptionCount: number;
|
|
548
|
+
}>;
|
|
549
|
+
/**
|
|
550
|
+
* Previews a buy on the bonding curve. Auto-fetches state from chain.
|
|
551
|
+
*
|
|
552
|
+
* @param mint - Token mint address
|
|
553
|
+
* @param amountInQuote - Quote token amount to spend (lamports for SOL, smallest unit for stables)
|
|
554
|
+
* @param options - Native (`{ solPriceUsd }`) or stable (`{ quoteMint }`) curve options
|
|
555
|
+
* @returns Buy preview with `tokensOut`, `fees`, `priceImpactBps`, `newReserves`, and `willComplete`
|
|
556
|
+
*/
|
|
557
|
+
previewBuyOnCurve(mint: PublicKey, amountInQuote: BN, options: CurveAsyncOptions): Promise<BuyCurvePreview>;
|
|
558
|
+
/**
|
|
559
|
+
* Previews a sell on the bonding curve. Auto-fetches state from chain.
|
|
560
|
+
*
|
|
561
|
+
* @param mint - Token mint address
|
|
562
|
+
* @param amountInTokens - Token amount to sell (smallest unit, 6 decimals)
|
|
563
|
+
* @param options - Native (`{ solPriceUsd }`) or stable (`{ quoteMint }`) curve options
|
|
564
|
+
* @returns Sell preview with `quoteOut`, `quoteOutNet`, `fees`, `priceImpactBps`, and `newReserves`
|
|
565
|
+
*/
|
|
566
|
+
previewSellOnCurve(mint: PublicKey, amountInTokens: BN, options: CurveAsyncOptions): Promise<SellCurvePreview>;
|
|
567
|
+
/** Previews a sell swap on the AMM (base → quote). Accepts optional pre-fetched state. */
|
|
568
|
+
previewSwapSell(baseMint: PublicKey, quoteMint: PublicKey, amountIn: BN, options?: {
|
|
569
|
+
prefetched?: SwapPrefetchedState;
|
|
570
|
+
}): Promise<SwapPreview>;
|
|
571
|
+
/** Previews a buy swap on the AMM (quote → base). Accepts optional pre-fetched state. */
|
|
572
|
+
previewSwapBuy(baseMint: PublicKey, quoteMint: PublicKey, amountOut: BN, options?: {
|
|
573
|
+
prefetched?: SwapPrefetchedState;
|
|
574
|
+
}): Promise<SwapPreview>;
|
|
575
|
+
/** Derives the bonding curve PDA for a token mint. */
|
|
576
|
+
getBondingCurvePDA(mint: PublicKey): [PublicKey, number];
|
|
577
|
+
/** Derives the SOL vault PDA for a bonding curve. */
|
|
578
|
+
getBondingCurveSolVaultPDA(bondingCurve: PublicKey): [PublicKey, number];
|
|
579
|
+
/** Derives the referral vault PDA. */
|
|
580
|
+
getReferralVaultPDA(referrer: PublicKey): [PublicKey, number];
|
|
581
|
+
/** Derives the buyback vault PDA for a bonding curve. */
|
|
582
|
+
getBuybackVaultPDA(bondingCurve: PublicKey): [PublicKey, number];
|
|
583
|
+
/** Derives the pool state PDA for a token pair. */
|
|
584
|
+
getPoolPDA(baseMint: PublicKey, quoteMint?: PublicKey): [PublicKey, number];
|
|
585
|
+
/** Derives the LP mint PDA for a pool. */
|
|
586
|
+
getPoolLpMintPDA(poolState: PublicKey): [PublicKey, number];
|
|
587
|
+
/** Derives the pool vault PDA for a specific token. */
|
|
588
|
+
getPoolVaultPDA(poolState: PublicKey, mint: PublicKey): [PublicKey, number];
|
|
589
|
+
/** Derives the observation state PDA (oracle data) for a pool. */
|
|
590
|
+
getObservationPDA(poolState: PublicKey): [PublicKey, number];
|
|
591
|
+
/** Derives the fee configuration PDA for a token mint. */
|
|
592
|
+
getFeeConfigPDA(tokenMint: PublicKey): [PublicKey, number];
|
|
593
|
+
/** Derives the fee vault PDA for a fee configuration. */
|
|
594
|
+
getFeeVaultPDA(feeConfig: PublicKey): [PublicKey, number];
|
|
595
|
+
/** Derives the recipient vault PDA for a specific recipient within a fee config. */
|
|
596
|
+
getRecipientVaultPDA(feeConfig: PublicKey, recipient: PublicKey): [PublicKey, number];
|
|
597
|
+
/** Derives the user properties PDA. */
|
|
598
|
+
getUserPropertiesPDA(user: PublicKey): [PublicKey, number];
|
|
599
|
+
/** Derives the token volume accumulator PDA. */
|
|
600
|
+
getTokenVolumePDA(mint: PublicKey): [PublicKey, number];
|
|
601
|
+
/** Derives the user snapshot PDA for a given user and index. */
|
|
602
|
+
getUserSnapshotPDA(user: PublicKey, index: number): [PublicKey, number];
|
|
603
|
+
/** Derives the deal PDA for a given owner. */
|
|
604
|
+
getDealPDA(owner: PublicKey): [PublicKey, number];
|
|
605
|
+
/** Derives all PDAs associated with a bonding curve token. */
|
|
606
|
+
getAllBondingCurvePDAs(mint: PublicKey, creator: PublicKey): import("./index.js").BondingCurvePDAs;
|
|
607
|
+
/** Derives all PDAs associated with an AMM pool. */
|
|
608
|
+
getAllPoolPDAs(baseMint: PublicKey, quoteMint?: PublicKey): import("./index.js").PoolPDAs;
|
|
609
|
+
/** Derives all PDAs needed for bonding curve to AMM migration. */
|
|
610
|
+
getMigrationPDAs(tokenMint: PublicKey): import("./index.js").MigrationPDAs;
|
|
611
|
+
/**
|
|
612
|
+
* Builds an unsigned Transaction from instructions, with optional compute
|
|
613
|
+
* budget. Fetches a recent blockhash. Caller is responsible for signing.
|
|
614
|
+
*/
|
|
615
|
+
buildTransaction(instructions: TransactionInstruction[], options: BuildTransactionOptions): Promise<Transaction>;
|
|
616
|
+
/**
|
|
617
|
+
* Resolves the token program (SPL Token or Token-2022) for a mint.
|
|
618
|
+
*/
|
|
619
|
+
resolveTokenProgram(mint: PublicKey): Promise<PublicKey>;
|
|
620
|
+
}
|
|
621
|
+
//# sourceMappingURL=client.d.ts.map
|