@liquid-af/sdk 0.7.1 → 0.8.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 +17 -17
- package/dist/client.d.ts +16 -16
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +28 -28
- package/dist/client.js.map +1 -1
- package/dist/events/types.d.ts +4 -2
- package/dist/events/types.d.ts.map +1 -1
- package/dist/idl/liquid.d.ts +111 -111
- package/dist/idl/liquid.d.ts.map +1 -1
- package/dist/idl/liquid.json +111 -111
- package/dist/idl/liquid_events.d.ts +34 -14
- package/dist/idl/liquid_events.d.ts.map +1 -1
- package/dist/idl/liquid_events.json +34 -14
- package/dist/idl/liquid_swap.d.ts +40 -40
- package/dist/idl/liquid_swap.d.ts.map +1 -1
- package/dist/idl/liquid_swap.json +40 -40
- package/dist/instructions/index.d.ts +4 -4
- package/dist/instructions/index.d.ts.map +1 -1
- package/dist/instructions/index.js +3 -3
- package/dist/instructions/index.js.map +1 -1
- package/dist/instructions/liquid-swap.d.ts +12 -12
- package/dist/instructions/liquid-swap.d.ts.map +1 -1
- package/dist/instructions/liquid-swap.js +12 -12
- package/dist/instructions/liquid-swap.js.map +1 -1
- package/dist/instructions/liquid.d.ts +36 -36
- package/dist/instructions/liquid.d.ts.map +1 -1
- package/dist/instructions/liquid.js +42 -42
- package/dist/instructions/liquid.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +36 -36
- package/src/events/types.ts +1 -2
- package/src/idl/liquid.json +111 -111
- package/src/idl/liquid.ts +111 -111
- package/src/idl/liquid_events.json +34 -14
- package/src/idl/liquid_events.ts +34 -14
- package/src/idl/liquid_swap.json +40 -40
- package/src/idl/liquid_swap.ts +40 -40
- package/src/instructions/index.ts +24 -24
- package/src/instructions/liquid-swap.ts +18 -18
- package/src/instructions/liquid.ts +60 -60
package/src/idl/liquid_swap.ts
CHANGED
|
@@ -70,23 +70,23 @@ export type LiquidSwap = {
|
|
|
70
70
|
"args": []
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
|
-
"name": "
|
|
73
|
+
"name": "buyExactIn",
|
|
74
74
|
"docs": [
|
|
75
|
-
"
|
|
75
|
+
"Buys base tokens by providing an exact amount of quote tokens (exact input).",
|
|
76
76
|
"",
|
|
77
77
|
"# Arguments",
|
|
78
|
-
"* `
|
|
79
|
-
"* `
|
|
78
|
+
"* `amount_in` - Exact quote tokens to spend (before transfer fees).",
|
|
79
|
+
"* `minimum_amount_out` - Minimum base tokens to receive (after transfer fees; slippage protection)."
|
|
80
80
|
],
|
|
81
81
|
"discriminator": [
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
82
|
+
250,
|
|
83
|
+
234,
|
|
84
|
+
13,
|
|
85
|
+
123,
|
|
86
|
+
213,
|
|
87
|
+
156,
|
|
88
|
+
19,
|
|
89
|
+
236
|
|
90
90
|
],
|
|
91
91
|
"accounts": [
|
|
92
92
|
{
|
|
@@ -1046,33 +1046,33 @@ export type LiquidSwap = {
|
|
|
1046
1046
|
],
|
|
1047
1047
|
"args": [
|
|
1048
1048
|
{
|
|
1049
|
-
"name": "
|
|
1049
|
+
"name": "amountIn",
|
|
1050
1050
|
"type": "u64"
|
|
1051
1051
|
},
|
|
1052
1052
|
{
|
|
1053
|
-
"name": "
|
|
1053
|
+
"name": "minimumAmountOut",
|
|
1054
1054
|
"type": "u64"
|
|
1055
1055
|
}
|
|
1056
1056
|
]
|
|
1057
1057
|
},
|
|
1058
1058
|
{
|
|
1059
|
-
"name": "
|
|
1059
|
+
"name": "buyExactOut",
|
|
1060
1060
|
"docs": [
|
|
1061
|
-
"Buys base tokens by providing
|
|
1061
|
+
"Buys base tokens by providing quote tokens to the pool (exact output).",
|
|
1062
1062
|
"",
|
|
1063
1063
|
"# Arguments",
|
|
1064
|
-
"* `
|
|
1065
|
-
"* `
|
|
1064
|
+
"* `max_amount_in` - Maximum quote tokens willing to spend (including transfer fees; slippage protection).",
|
|
1065
|
+
"* `amount_out` - Exact base tokens the user wants to receive (after transfer fees)."
|
|
1066
1066
|
],
|
|
1067
1067
|
"discriminator": [
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1068
|
+
24,
|
|
1069
|
+
211,
|
|
1070
|
+
116,
|
|
1071
|
+
40,
|
|
1072
|
+
105,
|
|
1073
|
+
3,
|
|
1074
|
+
153,
|
|
1075
|
+
56
|
|
1076
1076
|
],
|
|
1077
1077
|
"accounts": [
|
|
1078
1078
|
{
|
|
@@ -2032,11 +2032,11 @@ export type LiquidSwap = {
|
|
|
2032
2032
|
],
|
|
2033
2033
|
"args": [
|
|
2034
2034
|
{
|
|
2035
|
-
"name": "
|
|
2035
|
+
"name": "maxAmountIn",
|
|
2036
2036
|
"type": "u64"
|
|
2037
2037
|
},
|
|
2038
2038
|
{
|
|
2039
|
-
"name": "
|
|
2039
|
+
"name": "amountOut",
|
|
2040
2040
|
"type": "u64"
|
|
2041
2041
|
}
|
|
2042
2042
|
]
|
|
@@ -4184,23 +4184,23 @@ export type LiquidSwap = {
|
|
|
4184
4184
|
"args": []
|
|
4185
4185
|
},
|
|
4186
4186
|
{
|
|
4187
|
-
"name": "
|
|
4187
|
+
"name": "sellExactIn",
|
|
4188
4188
|
"docs": [
|
|
4189
|
-
"
|
|
4189
|
+
"Sells base tokens by providing them to the pool and receiving quote tokens (exact input).",
|
|
4190
4190
|
"",
|
|
4191
4191
|
"# Arguments",
|
|
4192
|
-
"* `amount_in` -
|
|
4193
|
-
"* `minimum_amount_out` -
|
|
4192
|
+
"* `amount_in` - Exact amount of base tokens to sell (before transfer fees).",
|
|
4193
|
+
"* `minimum_amount_out` - Minimum quote tokens expected (after transfer fees; slippage protection)."
|
|
4194
4194
|
],
|
|
4195
4195
|
"discriminator": [
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4196
|
+
149,
|
|
4197
|
+
39,
|
|
4198
|
+
222,
|
|
4199
|
+
155,
|
|
4200
|
+
211,
|
|
4201
|
+
124,
|
|
4202
|
+
152,
|
|
4203
|
+
26
|
|
4204
4204
|
],
|
|
4205
4205
|
"accounts": [
|
|
4206
4206
|
{
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export {
|
|
2
2
|
buildCreateNativeCurve,
|
|
3
3
|
buildBumpNative,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
buildBuyExactInNative,
|
|
5
|
+
buildBuyExactInNativeAutoResolve,
|
|
6
|
+
buildSellExactInNative,
|
|
7
|
+
buildSellExactInNativeAutoResolve,
|
|
8
|
+
buildBuyExactOutNative,
|
|
9
|
+
buildBuyExactOutNativeAutoResolve,
|
|
10
10
|
buildSellExactOutNative,
|
|
11
11
|
buildSellExactOutNativeAutoResolve,
|
|
12
12
|
buildMigrateNative,
|
|
@@ -17,12 +17,12 @@ export {
|
|
|
17
17
|
buildExecuteBuybackToken,
|
|
18
18
|
// Stable curve builders
|
|
19
19
|
buildCreateStableCurve,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
buildBuyExactInStable,
|
|
21
|
+
buildBuyExactInStableAutoResolve,
|
|
22
|
+
buildSellExactInStable,
|
|
23
|
+
buildSellExactInStableAutoResolve,
|
|
24
|
+
buildBuyExactOutStable,
|
|
25
|
+
buildBuyExactOutStableAutoResolve,
|
|
26
26
|
buildSellExactOutStable,
|
|
27
27
|
buildSellExactOutStableAutoResolve,
|
|
28
28
|
buildMigrateStable,
|
|
@@ -32,9 +32,9 @@ export {
|
|
|
32
32
|
export type {
|
|
33
33
|
BuildCreateNativeCurveParams,
|
|
34
34
|
BuildBumpNativeParams,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
BuildBuyExactInNativeParams,
|
|
36
|
+
BuildSellExactInNativeParams,
|
|
37
|
+
BuildBuyExactOutNativeParams,
|
|
38
38
|
BuildSellExactOutNativeParams,
|
|
39
39
|
BuildMigrateNativeParams,
|
|
40
40
|
BuildInitializeNativeReferralVaultParams,
|
|
@@ -44,9 +44,9 @@ export type {
|
|
|
44
44
|
BuildExecuteBuybackTokenParams,
|
|
45
45
|
// Stable curve param types
|
|
46
46
|
BuildCreateStableCurveParams,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
BuildBuyExactInStableParams,
|
|
48
|
+
BuildSellExactInStableParams,
|
|
49
|
+
BuildBuyExactOutStableParams,
|
|
50
50
|
BuildSellExactOutStableParams,
|
|
51
51
|
BuildMigrateStableParams,
|
|
52
52
|
BuildInitializeFeeRecipientVaultsParams,
|
|
@@ -55,9 +55,9 @@ export type {
|
|
|
55
55
|
|
|
56
56
|
export {
|
|
57
57
|
buildCreatePool,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
buildSwapBuyExactOut,
|
|
59
|
+
buildSwapSellExactIn,
|
|
60
|
+
buildSwapBuyExactIn,
|
|
61
61
|
buildSwapSellExactOut,
|
|
62
62
|
buildDeposit,
|
|
63
63
|
buildWithdraw,
|
|
@@ -65,9 +65,9 @@ export {
|
|
|
65
65
|
} from "./liquid-swap.js";
|
|
66
66
|
export type {
|
|
67
67
|
BuildCreatePoolParams,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
BuildSwapBuyExactOutParams,
|
|
69
|
+
BuildSwapSellExactInParams,
|
|
70
|
+
BuildSwapBuyExactInParams,
|
|
71
71
|
BuildSwapSellExactOutParams,
|
|
72
72
|
BuildDepositParams,
|
|
73
73
|
BuildWithdrawParams,
|
|
@@ -70,7 +70,7 @@ export function buildCreatePool(
|
|
|
70
70
|
.instruction();
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
export interface
|
|
73
|
+
export interface BuildSwapBuyExactOutParams {
|
|
74
74
|
payer: PublicKey;
|
|
75
75
|
creator: PublicKey;
|
|
76
76
|
baseMint: PublicKey;
|
|
@@ -85,13 +85,13 @@ export interface BuildSwapBuyParams {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
|
-
* Builds a
|
|
88
|
+
* Builds a buyExactOut swap instruction (exact base output, quote input with slippage).
|
|
89
89
|
*
|
|
90
|
-
* @param params - {@link
|
|
90
|
+
* @param params - {@link BuildSwapBuyExactOutParams}
|
|
91
91
|
* @returns Transaction instruction
|
|
92
92
|
*/
|
|
93
|
-
export function
|
|
94
|
-
params:
|
|
93
|
+
export function buildSwapBuyExactOut(
|
|
94
|
+
params: BuildSwapBuyExactOutParams,
|
|
95
95
|
): Promise<TransactionInstruction> {
|
|
96
96
|
const {
|
|
97
97
|
payer,
|
|
@@ -122,7 +122,7 @@ export function buildSwapBuy(
|
|
|
122
122
|
quoteTokenProgram,
|
|
123
123
|
);
|
|
124
124
|
return program.methods
|
|
125
|
-
.
|
|
125
|
+
.buyExactOut(maxAmountIn, amountOut)
|
|
126
126
|
.accountsPartial({
|
|
127
127
|
payer,
|
|
128
128
|
creator,
|
|
@@ -142,7 +142,7 @@ export function buildSwapBuy(
|
|
|
142
142
|
.instruction();
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
export interface
|
|
145
|
+
export interface BuildSwapSellExactInParams {
|
|
146
146
|
payer: PublicKey;
|
|
147
147
|
creator: PublicKey;
|
|
148
148
|
baseMint: PublicKey;
|
|
@@ -157,13 +157,13 @@ export interface BuildSwapSellParams {
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
/**
|
|
160
|
-
* Builds a
|
|
160
|
+
* Builds a sellExactIn swap instruction (exact base input, quote output with slippage).
|
|
161
161
|
*
|
|
162
|
-
* @param params - {@link
|
|
162
|
+
* @param params - {@link BuildSwapSellExactInParams}
|
|
163
163
|
* @returns Transaction instruction
|
|
164
164
|
*/
|
|
165
|
-
export function
|
|
166
|
-
params:
|
|
165
|
+
export function buildSwapSellExactIn(
|
|
166
|
+
params: BuildSwapSellExactInParams,
|
|
167
167
|
): Promise<TransactionInstruction> {
|
|
168
168
|
const {
|
|
169
169
|
payer,
|
|
@@ -194,7 +194,7 @@ export function buildSwapSell(
|
|
|
194
194
|
quoteTokenProgram,
|
|
195
195
|
);
|
|
196
196
|
return program.methods
|
|
197
|
-
.
|
|
197
|
+
.sellExactIn(amountIn, minimumAmountOut)
|
|
198
198
|
.accountsPartial({
|
|
199
199
|
payer,
|
|
200
200
|
creator,
|
|
@@ -214,7 +214,7 @@ export function buildSwapSell(
|
|
|
214
214
|
.instruction();
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
export interface
|
|
217
|
+
export interface BuildSwapBuyExactInParams {
|
|
218
218
|
payer: PublicKey;
|
|
219
219
|
creator: PublicKey;
|
|
220
220
|
baseMint: PublicKey;
|
|
@@ -229,13 +229,13 @@ export interface BuildSwapBuyExactParams {
|
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
/**
|
|
232
|
-
* Builds a
|
|
232
|
+
* Builds a buyExactIn swap instruction (exact quote input, base output with slippage).
|
|
233
233
|
*
|
|
234
|
-
* @param params - {@link
|
|
234
|
+
* @param params - {@link BuildSwapBuyExactInParams}
|
|
235
235
|
* @returns Transaction instruction
|
|
236
236
|
*/
|
|
237
|
-
export function
|
|
238
|
-
params:
|
|
237
|
+
export function buildSwapBuyExactIn(
|
|
238
|
+
params: BuildSwapBuyExactInParams,
|
|
239
239
|
): Promise<TransactionInstruction> {
|
|
240
240
|
const {
|
|
241
241
|
payer,
|
|
@@ -266,7 +266,7 @@ export function buildSwapBuyExact(
|
|
|
266
266
|
quoteTokenProgram,
|
|
267
267
|
);
|
|
268
268
|
return program.methods
|
|
269
|
-
.
|
|
269
|
+
.buyExactIn(amountIn, minimumAmountOut)
|
|
270
270
|
.accountsPartial({
|
|
271
271
|
payer,
|
|
272
272
|
creator,
|
|
@@ -108,7 +108,7 @@ export function buildBumpNative(
|
|
|
108
108
|
.instruction();
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
export interface
|
|
111
|
+
export interface BuildBuyExactInNativeParams {
|
|
112
112
|
user: PublicKey;
|
|
113
113
|
mint: PublicKey;
|
|
114
114
|
creator: PublicKey;
|
|
@@ -125,11 +125,11 @@ export interface BuildBuyNativeParams {
|
|
|
125
125
|
* Builds a buyNative instruction.
|
|
126
126
|
* Requires the bonding curve creator and Pyth price feed to be known.
|
|
127
127
|
*
|
|
128
|
-
* @param params - {@link
|
|
128
|
+
* @param params - {@link BuildBuyExactInNativeParams}
|
|
129
129
|
* @returns Transaction instruction
|
|
130
130
|
*/
|
|
131
|
-
export function
|
|
132
|
-
params:
|
|
131
|
+
export function buildBuyExactInNative(
|
|
132
|
+
params: BuildBuyExactInNativeParams,
|
|
133
133
|
): Promise<TransactionInstruction> {
|
|
134
134
|
const {
|
|
135
135
|
user,
|
|
@@ -153,7 +153,7 @@ export function buildBuyNative(
|
|
|
153
153
|
);
|
|
154
154
|
|
|
155
155
|
return program.methods
|
|
156
|
-
.
|
|
156
|
+
.buyExactInNative(amountIn, minAmountOut)
|
|
157
157
|
.accountsPartial({
|
|
158
158
|
user,
|
|
159
159
|
feeRecipient,
|
|
@@ -172,29 +172,29 @@ export function buildBuyNative(
|
|
|
172
172
|
|
|
173
173
|
/**
|
|
174
174
|
* Builds a buyNative instruction, automatically fetching the bonding curve
|
|
175
|
-
* creator from chain. Convenience wrapper around `
|
|
175
|
+
* creator from chain. Convenience wrapper around `buildBuyExactInNative`.
|
|
176
176
|
*
|
|
177
177
|
* @param connection - Solana RPC connection
|
|
178
|
-
* @param params - {@link
|
|
178
|
+
* @param params - {@link BuildBuyExactInNativeParams} without `creator`
|
|
179
179
|
* @returns Transaction instruction
|
|
180
180
|
*/
|
|
181
|
-
export async function
|
|
181
|
+
export async function buildBuyExactInNativeAutoResolve(
|
|
182
182
|
connection: Connection,
|
|
183
|
-
params: Omit<
|
|
183
|
+
params: Omit<BuildBuyExactInNativeParams, "creator">,
|
|
184
184
|
): Promise<TransactionInstruction> {
|
|
185
185
|
const curve = await fetchNativeBondingCurve(
|
|
186
186
|
connection,
|
|
187
187
|
params.mint,
|
|
188
188
|
params.config,
|
|
189
189
|
);
|
|
190
|
-
return
|
|
190
|
+
return buildBuyExactInNative({
|
|
191
191
|
...params,
|
|
192
192
|
creator: curve.creator,
|
|
193
193
|
pythPriceFeed: params.pythPriceFeed,
|
|
194
194
|
});
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
export interface
|
|
197
|
+
export interface BuildSellExactInNativeParams {
|
|
198
198
|
user: PublicKey;
|
|
199
199
|
mint: PublicKey;
|
|
200
200
|
creator: PublicKey;
|
|
@@ -211,11 +211,11 @@ export interface BuildSellNativeParams {
|
|
|
211
211
|
* Builds a sellNative instruction.
|
|
212
212
|
* Requires the bonding curve creator and Pyth price feed to be known.
|
|
213
213
|
*
|
|
214
|
-
* @param params - {@link
|
|
214
|
+
* @param params - {@link BuildSellExactInNativeParams}
|
|
215
215
|
* @returns Transaction instruction
|
|
216
216
|
*/
|
|
217
|
-
export function
|
|
218
|
-
params:
|
|
217
|
+
export function buildSellExactInNative(
|
|
218
|
+
params: BuildSellExactInNativeParams,
|
|
219
219
|
): Promise<TransactionInstruction> {
|
|
220
220
|
const {
|
|
221
221
|
user,
|
|
@@ -239,7 +239,7 @@ export function buildSellNative(
|
|
|
239
239
|
);
|
|
240
240
|
|
|
241
241
|
return program.methods
|
|
242
|
-
.
|
|
242
|
+
.sellExactInNative(amountIn, minAmountOut)
|
|
243
243
|
.accountsPartial({
|
|
244
244
|
user,
|
|
245
245
|
feeRecipient,
|
|
@@ -258,29 +258,29 @@ export function buildSellNative(
|
|
|
258
258
|
|
|
259
259
|
/**
|
|
260
260
|
* Builds a sellNative instruction, automatically fetching the bonding curve
|
|
261
|
-
* creator from chain. Convenience wrapper around `
|
|
261
|
+
* creator from chain. Convenience wrapper around `buildSellExactInNative`.
|
|
262
262
|
*
|
|
263
263
|
* @param connection - Solana RPC connection
|
|
264
|
-
* @param params - {@link
|
|
264
|
+
* @param params - {@link BuildSellExactInNativeParams} without `creator`
|
|
265
265
|
* @returns Transaction instruction
|
|
266
266
|
*/
|
|
267
|
-
export async function
|
|
267
|
+
export async function buildSellExactInNativeAutoResolve(
|
|
268
268
|
connection: Connection,
|
|
269
|
-
params: Omit<
|
|
269
|
+
params: Omit<BuildSellExactInNativeParams, "creator">,
|
|
270
270
|
): Promise<TransactionInstruction> {
|
|
271
271
|
const curve = await fetchNativeBondingCurve(
|
|
272
272
|
connection,
|
|
273
273
|
params.mint,
|
|
274
274
|
params.config,
|
|
275
275
|
);
|
|
276
|
-
return
|
|
276
|
+
return buildSellExactInNative({
|
|
277
277
|
...params,
|
|
278
278
|
creator: curve.creator,
|
|
279
279
|
pythPriceFeed: params.pythPriceFeed,
|
|
280
280
|
});
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
export interface
|
|
283
|
+
export interface BuildBuyExactOutNativeParams {
|
|
284
284
|
user: PublicKey;
|
|
285
285
|
mint: PublicKey;
|
|
286
286
|
creator: PublicKey;
|
|
@@ -297,11 +297,11 @@ export interface BuildBuyExactNativeParams {
|
|
|
297
297
|
* Builds a buyExactNative instruction.
|
|
298
298
|
* Buys an exact amount of tokens from the bonding curve, paying SOL.
|
|
299
299
|
*
|
|
300
|
-
* @param params - {@link
|
|
300
|
+
* @param params - {@link BuildBuyExactOutNativeParams}
|
|
301
301
|
* @returns Transaction instruction
|
|
302
302
|
*/
|
|
303
|
-
export function
|
|
304
|
-
params:
|
|
303
|
+
export function buildBuyExactOutNative(
|
|
304
|
+
params: BuildBuyExactOutNativeParams,
|
|
305
305
|
): Promise<TransactionInstruction> {
|
|
306
306
|
const {
|
|
307
307
|
user,
|
|
@@ -324,7 +324,7 @@ export function buildBuyExactNative(
|
|
|
324
324
|
);
|
|
325
325
|
|
|
326
326
|
return program.methods
|
|
327
|
-
.
|
|
327
|
+
.buyExactOutNative(exactAmountOut, maxAmountIn)
|
|
328
328
|
.accountsPartial({
|
|
329
329
|
user,
|
|
330
330
|
feeRecipient,
|
|
@@ -343,22 +343,22 @@ export function buildBuyExactNative(
|
|
|
343
343
|
|
|
344
344
|
/**
|
|
345
345
|
* Builds a buyExactNative instruction, automatically fetching the bonding curve
|
|
346
|
-
* creator from chain. Convenience wrapper around `
|
|
346
|
+
* creator from chain. Convenience wrapper around `buildBuyExactOutNative`.
|
|
347
347
|
*
|
|
348
348
|
* @param connection - Solana RPC connection
|
|
349
|
-
* @param params - {@link
|
|
349
|
+
* @param params - {@link BuildBuyExactOutNativeParams} without `creator`
|
|
350
350
|
* @returns Transaction instruction
|
|
351
351
|
*/
|
|
352
|
-
export async function
|
|
352
|
+
export async function buildBuyExactOutNativeAutoResolve(
|
|
353
353
|
connection: Connection,
|
|
354
|
-
params: Omit<
|
|
354
|
+
params: Omit<BuildBuyExactOutNativeParams, "creator">,
|
|
355
355
|
): Promise<TransactionInstruction> {
|
|
356
356
|
const curve = await fetchNativeBondingCurve(
|
|
357
357
|
connection,
|
|
358
358
|
params.mint,
|
|
359
359
|
params.config,
|
|
360
360
|
);
|
|
361
|
-
return
|
|
361
|
+
return buildBuyExactOutNative({
|
|
362
362
|
...params,
|
|
363
363
|
creator: curve.creator,
|
|
364
364
|
pythPriceFeed: params.pythPriceFeed,
|
|
@@ -722,7 +722,7 @@ export function buildCreateStableCurve(
|
|
|
722
722
|
.instruction();
|
|
723
723
|
}
|
|
724
724
|
|
|
725
|
-
export interface
|
|
725
|
+
export interface BuildBuyExactInStableParams {
|
|
726
726
|
user: PublicKey;
|
|
727
727
|
mint: PublicKey;
|
|
728
728
|
quoteMint: PublicKey;
|
|
@@ -739,11 +739,11 @@ export interface BuildBuyStableParams {
|
|
|
739
739
|
* Builds a buyStable instruction.
|
|
740
740
|
* Buys tokens from a token-based bonding curve using quote tokens (e.g., USDC).
|
|
741
741
|
*
|
|
742
|
-
* @param params - {@link
|
|
742
|
+
* @param params - {@link BuildBuyExactInStableParams}
|
|
743
743
|
* @returns Transaction instruction
|
|
744
744
|
*/
|
|
745
|
-
export function
|
|
746
|
-
params:
|
|
745
|
+
export function buildBuyExactInStable(
|
|
746
|
+
params: BuildBuyExactInStableParams,
|
|
747
747
|
): Promise<TransactionInstruction> {
|
|
748
748
|
const {
|
|
749
749
|
user,
|
|
@@ -784,7 +784,7 @@ export function buildBuyStable(
|
|
|
784
784
|
);
|
|
785
785
|
|
|
786
786
|
return program.methods
|
|
787
|
-
.
|
|
787
|
+
.buyExactInStable(amountIn, minAmountOut)
|
|
788
788
|
.accountsPartial({
|
|
789
789
|
user,
|
|
790
790
|
mint,
|
|
@@ -804,25 +804,25 @@ export function buildBuyStable(
|
|
|
804
804
|
|
|
805
805
|
/**
|
|
806
806
|
* Builds a buyStable instruction, automatically fetching the bonding curve
|
|
807
|
-
* creator from chain. Convenience wrapper around `
|
|
807
|
+
* creator from chain. Convenience wrapper around `buildBuyExactInStable`.
|
|
808
808
|
*
|
|
809
809
|
* @param connection - Solana RPC connection
|
|
810
|
-
* @param params - {@link
|
|
810
|
+
* @param params - {@link BuildBuyExactInStableParams} without `creator`
|
|
811
811
|
* @returns Transaction instruction
|
|
812
812
|
*/
|
|
813
|
-
export async function
|
|
813
|
+
export async function buildBuyExactInStableAutoResolve(
|
|
814
814
|
connection: Connection,
|
|
815
|
-
params: Omit<
|
|
815
|
+
params: Omit<BuildBuyExactInStableParams, "creator">,
|
|
816
816
|
): Promise<TransactionInstruction> {
|
|
817
817
|
const curve = await fetchStableBondingCurve(
|
|
818
818
|
connection,
|
|
819
819
|
params.mint,
|
|
820
820
|
params.config,
|
|
821
821
|
);
|
|
822
|
-
return
|
|
822
|
+
return buildBuyExactInStable({ ...params, creator: curve.creator });
|
|
823
823
|
}
|
|
824
824
|
|
|
825
|
-
export interface
|
|
825
|
+
export interface BuildSellExactInStableParams {
|
|
826
826
|
user: PublicKey;
|
|
827
827
|
mint: PublicKey;
|
|
828
828
|
quoteMint: PublicKey;
|
|
@@ -839,11 +839,11 @@ export interface BuildSellStableParams {
|
|
|
839
839
|
* Builds a sellStable instruction.
|
|
840
840
|
* Sells tokens to a token-based bonding curve for quote tokens (e.g., USDC).
|
|
841
841
|
*
|
|
842
|
-
* @param params - {@link
|
|
842
|
+
* @param params - {@link BuildSellExactInStableParams}
|
|
843
843
|
* @returns Transaction instruction
|
|
844
844
|
*/
|
|
845
|
-
export function
|
|
846
|
-
params:
|
|
845
|
+
export function buildSellExactInStable(
|
|
846
|
+
params: BuildSellExactInStableParams,
|
|
847
847
|
): Promise<TransactionInstruction> {
|
|
848
848
|
const {
|
|
849
849
|
user,
|
|
@@ -884,7 +884,7 @@ export function buildSellStable(
|
|
|
884
884
|
);
|
|
885
885
|
|
|
886
886
|
return program.methods
|
|
887
|
-
.
|
|
887
|
+
.sellExactInStable(amountIn, minAmountOut)
|
|
888
888
|
.accountsPartial({
|
|
889
889
|
user,
|
|
890
890
|
mint,
|
|
@@ -904,25 +904,25 @@ export function buildSellStable(
|
|
|
904
904
|
|
|
905
905
|
/**
|
|
906
906
|
* Builds a sellStable instruction, automatically fetching the bonding curve
|
|
907
|
-
* creator from chain. Convenience wrapper around `
|
|
907
|
+
* creator from chain. Convenience wrapper around `buildSellExactInStable`.
|
|
908
908
|
*
|
|
909
909
|
* @param connection - Solana RPC connection
|
|
910
|
-
* @param params - {@link
|
|
910
|
+
* @param params - {@link BuildSellExactInStableParams} without `creator`
|
|
911
911
|
* @returns Transaction instruction
|
|
912
912
|
*/
|
|
913
|
-
export async function
|
|
913
|
+
export async function buildSellExactInStableAutoResolve(
|
|
914
914
|
connection: Connection,
|
|
915
|
-
params: Omit<
|
|
915
|
+
params: Omit<BuildSellExactInStableParams, "creator">,
|
|
916
916
|
): Promise<TransactionInstruction> {
|
|
917
917
|
const curve = await fetchStableBondingCurve(
|
|
918
918
|
connection,
|
|
919
919
|
params.mint,
|
|
920
920
|
params.config,
|
|
921
921
|
);
|
|
922
|
-
return
|
|
922
|
+
return buildSellExactInStable({ ...params, creator: curve.creator });
|
|
923
923
|
}
|
|
924
924
|
|
|
925
|
-
export interface
|
|
925
|
+
export interface BuildBuyExactOutStableParams {
|
|
926
926
|
user: PublicKey;
|
|
927
927
|
mint: PublicKey;
|
|
928
928
|
quoteMint: PublicKey;
|
|
@@ -939,11 +939,11 @@ export interface BuildBuyExactStableParams {
|
|
|
939
939
|
* Builds a buyExactStable instruction.
|
|
940
940
|
* Buys an exact amount of tokens from a token-based bonding curve using quote tokens.
|
|
941
941
|
*
|
|
942
|
-
* @param params - {@link
|
|
942
|
+
* @param params - {@link BuildBuyExactOutStableParams}
|
|
943
943
|
* @returns Transaction instruction
|
|
944
944
|
*/
|
|
945
|
-
export function
|
|
946
|
-
params:
|
|
945
|
+
export function buildBuyExactOutStable(
|
|
946
|
+
params: BuildBuyExactOutStableParams,
|
|
947
947
|
): Promise<TransactionInstruction> {
|
|
948
948
|
const {
|
|
949
949
|
user,
|
|
@@ -982,7 +982,7 @@ export function buildBuyExactStable(
|
|
|
982
982
|
);
|
|
983
983
|
|
|
984
984
|
return program.methods
|
|
985
|
-
.
|
|
985
|
+
.buyExactOutStable(exactAmountOut, maxAmountIn)
|
|
986
986
|
.accountsPartial({
|
|
987
987
|
user,
|
|
988
988
|
mint,
|
|
@@ -1002,22 +1002,22 @@ export function buildBuyExactStable(
|
|
|
1002
1002
|
|
|
1003
1003
|
/**
|
|
1004
1004
|
* Builds a buyExactStable instruction, automatically fetching the bonding curve
|
|
1005
|
-
* creator from chain. Convenience wrapper around `
|
|
1005
|
+
* creator from chain. Convenience wrapper around `buildBuyExactOutStable`.
|
|
1006
1006
|
*
|
|
1007
1007
|
* @param connection - Solana RPC connection
|
|
1008
|
-
* @param params - {@link
|
|
1008
|
+
* @param params - {@link BuildBuyExactOutStableParams} without `creator`
|
|
1009
1009
|
* @returns Transaction instruction
|
|
1010
1010
|
*/
|
|
1011
|
-
export async function
|
|
1011
|
+
export async function buildBuyExactOutStableAutoResolve(
|
|
1012
1012
|
connection: Connection,
|
|
1013
|
-
params: Omit<
|
|
1013
|
+
params: Omit<BuildBuyExactOutStableParams, "creator">,
|
|
1014
1014
|
): Promise<TransactionInstruction> {
|
|
1015
1015
|
const curve = await fetchStableBondingCurve(
|
|
1016
1016
|
connection,
|
|
1017
1017
|
params.mint,
|
|
1018
1018
|
params.config,
|
|
1019
1019
|
);
|
|
1020
|
-
return
|
|
1020
|
+
return buildBuyExactOutStable({ ...params, creator: curve.creator });
|
|
1021
1021
|
}
|
|
1022
1022
|
|
|
1023
1023
|
export interface BuildSellExactOutStableParams {
|