@picon-finance/dlmm-sdk 1.17.3 → 1.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/entities/pool.d.ts.map +1 -1
- package/dist/entities/pool.js +8 -2
- package/dist/picon_dlmm.json +1 -1
- package/dist/quote/wasm-node/picon_dlmm_quote.d.ts +42 -8
- package/dist/quote/wasm-node/picon_dlmm_quote_bg.wasm +0 -0
- package/dist/quote/wasm-web/picon_dlmm_quote.d.ts +42 -8
- package/dist/quote/wasm-web/picon_dlmm_quote_bg.wasm +0 -0
- package/package.json +1 -1
- package/src/entities/pool.ts +8 -2
- package/src/picon_dlmm.json +1 -1
- package/src/quote/wasm-node/picon_dlmm_quote.d.ts +42 -8
- package/src/quote/wasm-node/picon_dlmm_quote_bg.wasm +0 -0
- package/src/quote/wasm-web/picon_dlmm_quote.d.ts +42 -8
- package/src/quote/wasm-web/picon_dlmm_quote_bg.wasm +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../../src/entities/pool.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAEf,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACzB,MAAM,aAAa,CAAC;AAMrB,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,EAIL,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EACjB,MAAM,UAAU,CAAC;AAWlB,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,gBAAgB,IAAI,oBAAoB,EAC9C,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,QAAQ,EAKT,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,QAAQ,EAA4B,MAAM,aAAa,CAAC;AACjE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C,CAkBtB"}
|
package/dist/entities/pool.js
CHANGED
|
@@ -198,8 +198,11 @@ export class Pool {
|
|
|
198
198
|
inputTransferFee: xToY ? transferFeeX : transferFeeY,
|
|
199
199
|
outputTransferFee: xToY ? transferFeeY : transferFeeX,
|
|
200
200
|
binArrays,
|
|
201
|
+
// A swap instruction is built against the full requested amount — a partial fill here
|
|
202
|
+
// would silently under-deliver, so keep the strict all-or-nothing contract.
|
|
203
|
+
allowPartialFill: false,
|
|
201
204
|
});
|
|
202
|
-
const binArrayAddresses = this.#binArrayAddressesForQuote(xToY, indices, maxBinArrayAddresses, quoteOutput.
|
|
205
|
+
const binArrayAddresses = this.#binArrayAddressesForQuote(xToY, indices, maxBinArrayAddresses, quoteOutput.postActiveBin.binId);
|
|
203
206
|
return { quoteOutput, binArrayAddresses };
|
|
204
207
|
}
|
|
205
208
|
async #quoteExactOut({ xToY, amountOut, slippageToleranceBps, }) {
|
|
@@ -213,8 +216,11 @@ export class Pool {
|
|
|
213
216
|
inputTransferFee: xToY ? transferFeeX : transferFeeY,
|
|
214
217
|
outputTransferFee: xToY ? transferFeeY : transferFeeX,
|
|
215
218
|
binArrays,
|
|
219
|
+
// A swap instruction is built against the full requested amount — a partial fill here
|
|
220
|
+
// would silently under-deliver, so keep the strict all-or-nothing contract.
|
|
221
|
+
allowPartialFill: false,
|
|
216
222
|
});
|
|
217
|
-
const binArrayAddresses = this.#binArrayAddressesForQuote(xToY, indices, maxBinArrayAddresses, quoteOutput.
|
|
223
|
+
const binArrayAddresses = this.#binArrayAddressesForQuote(xToY, indices, maxBinArrayAddresses, quoteOutput.postActiveBin.binId);
|
|
218
224
|
return { quoteOutput, binArrayAddresses };
|
|
219
225
|
}
|
|
220
226
|
// The bin array window a quote might touch, before the quote itself narrows down how much of
|
package/dist/picon_dlmm.json
CHANGED
|
@@ -11,6 +11,11 @@ export interface BinArray {
|
|
|
11
11
|
bins: Bin[];
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
export interface BinEntry {
|
|
15
|
+
binId: number;
|
|
16
|
+
price: bigint;
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
export interface DynamicFeeConfig {
|
|
15
20
|
filterPeriod: number;
|
|
16
21
|
decayPeriod: number;
|
|
@@ -50,17 +55,33 @@ export interface QuoteExactInInput {
|
|
|
50
55
|
binArrays: (BinArray | undefined)[];
|
|
51
56
|
inputTransferFee?: TransferFee;
|
|
52
57
|
outputTransferFee?: TransferFee;
|
|
58
|
+
/**
|
|
59
|
+
* Report a partial fill as `Ok` instead of `Err(InsufficientLiquidity)`.
|
|
60
|
+
*/
|
|
61
|
+
allowPartialFill: boolean;
|
|
53
62
|
}
|
|
54
63
|
|
|
55
64
|
export interface QuoteExactInOutput {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
preActiveBin: BinEntry;
|
|
66
|
+
postActiveBin: BinEntry;
|
|
67
|
+
/**
|
|
68
|
+
* What this quote was requested for.
|
|
69
|
+
*/
|
|
70
|
+
requestedAmountIn: bigint;
|
|
71
|
+
/**
|
|
72
|
+
* What was actually consumed — use this, not `requested_amount_in`, to build a swap
|
|
73
|
+
* instruction. Differs from it only when `not_enough_liquidity` is `true`.
|
|
74
|
+
*/
|
|
75
|
+
consumedAmountIn: bigint;
|
|
59
76
|
amountOut: bigint;
|
|
60
77
|
minAmountOut: bigint;
|
|
61
78
|
fee: bigint;
|
|
62
79
|
feeRateMin: bigint;
|
|
63
80
|
feeRateMax: bigint;
|
|
81
|
+
/**
|
|
82
|
+
* `true` on a partial fill.
|
|
83
|
+
*/
|
|
84
|
+
notEnoughLiquidity: boolean;
|
|
64
85
|
}
|
|
65
86
|
|
|
66
87
|
export interface QuoteExactOutInput {
|
|
@@ -75,17 +96,26 @@ export interface QuoteExactOutInput {
|
|
|
75
96
|
binArrays: (BinArray | undefined)[];
|
|
76
97
|
inputTransferFee?: TransferFee;
|
|
77
98
|
outputTransferFee?: TransferFee;
|
|
99
|
+
/**
|
|
100
|
+
* Report a partial fill as `Ok` instead of `Err(InsufficientLiquidity)`.
|
|
101
|
+
*/
|
|
102
|
+
allowPartialFill: boolean;
|
|
78
103
|
}
|
|
79
104
|
|
|
80
105
|
export interface QuoteExactOutOutput {
|
|
81
|
-
|
|
82
|
-
|
|
106
|
+
preActiveBin: BinEntry;
|
|
107
|
+
postActiveBin: BinEntry;
|
|
83
108
|
/**
|
|
84
|
-
*
|
|
109
|
+
* What this quote was requested for, net.
|
|
85
110
|
*/
|
|
86
|
-
|
|
111
|
+
requestedAmountOut: bigint;
|
|
87
112
|
/**
|
|
88
|
-
*
|
|
113
|
+
* What was actually achieved, net — differs from `requested_amount_out` only when
|
|
114
|
+
* `not_enough_liquidity` is `true`; `amount_in` below is its real cost.
|
|
115
|
+
*/
|
|
116
|
+
consumedAmountOut: bigint;
|
|
117
|
+
/**
|
|
118
|
+
* Gross of DLMM fee and input transfer fee — what the trader pays for `consumed_amount_out`.
|
|
89
119
|
*/
|
|
90
120
|
amountIn: bigint;
|
|
91
121
|
/**
|
|
@@ -98,6 +128,10 @@ export interface QuoteExactOutOutput {
|
|
|
98
128
|
fee: bigint;
|
|
99
129
|
feeRateMin: bigint;
|
|
100
130
|
feeRateMax: bigint;
|
|
131
|
+
/**
|
|
132
|
+
* `true` on a partial fill.
|
|
133
|
+
*/
|
|
134
|
+
notEnoughLiquidity: boolean;
|
|
101
135
|
}
|
|
102
136
|
|
|
103
137
|
export interface TransferFee {
|
|
Binary file
|
|
@@ -11,6 +11,11 @@ export interface BinArray {
|
|
|
11
11
|
bins: Bin[];
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
export interface BinEntry {
|
|
15
|
+
binId: number;
|
|
16
|
+
price: bigint;
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
export interface DynamicFeeConfig {
|
|
15
20
|
filterPeriod: number;
|
|
16
21
|
decayPeriod: number;
|
|
@@ -50,17 +55,33 @@ export interface QuoteExactInInput {
|
|
|
50
55
|
binArrays: (BinArray | undefined)[];
|
|
51
56
|
inputTransferFee?: TransferFee;
|
|
52
57
|
outputTransferFee?: TransferFee;
|
|
58
|
+
/**
|
|
59
|
+
* Report a partial fill as `Ok` instead of `Err(InsufficientLiquidity)`.
|
|
60
|
+
*/
|
|
61
|
+
allowPartialFill: boolean;
|
|
53
62
|
}
|
|
54
63
|
|
|
55
64
|
export interface QuoteExactInOutput {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
preActiveBin: BinEntry;
|
|
66
|
+
postActiveBin: BinEntry;
|
|
67
|
+
/**
|
|
68
|
+
* What this quote was requested for.
|
|
69
|
+
*/
|
|
70
|
+
requestedAmountIn: bigint;
|
|
71
|
+
/**
|
|
72
|
+
* What was actually consumed — use this, not `requested_amount_in`, to build a swap
|
|
73
|
+
* instruction. Differs from it only when `not_enough_liquidity` is `true`.
|
|
74
|
+
*/
|
|
75
|
+
consumedAmountIn: bigint;
|
|
59
76
|
amountOut: bigint;
|
|
60
77
|
minAmountOut: bigint;
|
|
61
78
|
fee: bigint;
|
|
62
79
|
feeRateMin: bigint;
|
|
63
80
|
feeRateMax: bigint;
|
|
81
|
+
/**
|
|
82
|
+
* `true` on a partial fill.
|
|
83
|
+
*/
|
|
84
|
+
notEnoughLiquidity: boolean;
|
|
64
85
|
}
|
|
65
86
|
|
|
66
87
|
export interface QuoteExactOutInput {
|
|
@@ -75,17 +96,26 @@ export interface QuoteExactOutInput {
|
|
|
75
96
|
binArrays: (BinArray | undefined)[];
|
|
76
97
|
inputTransferFee?: TransferFee;
|
|
77
98
|
outputTransferFee?: TransferFee;
|
|
99
|
+
/**
|
|
100
|
+
* Report a partial fill as `Ok` instead of `Err(InsufficientLiquidity)`.
|
|
101
|
+
*/
|
|
102
|
+
allowPartialFill: boolean;
|
|
78
103
|
}
|
|
79
104
|
|
|
80
105
|
export interface QuoteExactOutOutput {
|
|
81
|
-
|
|
82
|
-
|
|
106
|
+
preActiveBin: BinEntry;
|
|
107
|
+
postActiveBin: BinEntry;
|
|
83
108
|
/**
|
|
84
|
-
*
|
|
109
|
+
* What this quote was requested for, net.
|
|
85
110
|
*/
|
|
86
|
-
|
|
111
|
+
requestedAmountOut: bigint;
|
|
87
112
|
/**
|
|
88
|
-
*
|
|
113
|
+
* What was actually achieved, net — differs from `requested_amount_out` only when
|
|
114
|
+
* `not_enough_liquidity` is `true`; `amount_in` below is its real cost.
|
|
115
|
+
*/
|
|
116
|
+
consumedAmountOut: bigint;
|
|
117
|
+
/**
|
|
118
|
+
* Gross of DLMM fee and input transfer fee — what the trader pays for `consumed_amount_out`.
|
|
89
119
|
*/
|
|
90
120
|
amountIn: bigint;
|
|
91
121
|
/**
|
|
@@ -98,6 +128,10 @@ export interface QuoteExactOutOutput {
|
|
|
98
128
|
fee: bigint;
|
|
99
129
|
feeRateMin: bigint;
|
|
100
130
|
feeRateMax: bigint;
|
|
131
|
+
/**
|
|
132
|
+
* `true` on a partial fill.
|
|
133
|
+
*/
|
|
134
|
+
notEnoughLiquidity: boolean;
|
|
101
135
|
}
|
|
102
136
|
|
|
103
137
|
export interface TransferFee {
|
|
Binary file
|
package/package.json
CHANGED
package/src/entities/pool.ts
CHANGED
|
@@ -389,10 +389,13 @@ export class Pool {
|
|
|
389
389
|
inputTransferFee: xToY ? transferFeeX : transferFeeY,
|
|
390
390
|
outputTransferFee: xToY ? transferFeeY : transferFeeX,
|
|
391
391
|
binArrays,
|
|
392
|
+
// A swap instruction is built against the full requested amount — a partial fill here
|
|
393
|
+
// would silently under-deliver, so keep the strict all-or-nothing contract.
|
|
394
|
+
allowPartialFill: false,
|
|
392
395
|
});
|
|
393
396
|
|
|
394
397
|
const binArrayAddresses = this.#binArrayAddressesForQuote(
|
|
395
|
-
xToY, indices, maxBinArrayAddresses, quoteOutput.
|
|
398
|
+
xToY, indices, maxBinArrayAddresses, quoteOutput.postActiveBin.binId,
|
|
396
399
|
);
|
|
397
400
|
return { quoteOutput, binArrayAddresses };
|
|
398
401
|
}
|
|
@@ -420,10 +423,13 @@ export class Pool {
|
|
|
420
423
|
inputTransferFee: xToY ? transferFeeX : transferFeeY,
|
|
421
424
|
outputTransferFee: xToY ? transferFeeY : transferFeeX,
|
|
422
425
|
binArrays,
|
|
426
|
+
// A swap instruction is built against the full requested amount — a partial fill here
|
|
427
|
+
// would silently under-deliver, so keep the strict all-or-nothing contract.
|
|
428
|
+
allowPartialFill: false,
|
|
423
429
|
});
|
|
424
430
|
|
|
425
431
|
const binArrayAddresses = this.#binArrayAddressesForQuote(
|
|
426
|
-
xToY, indices, maxBinArrayAddresses, quoteOutput.
|
|
432
|
+
xToY, indices, maxBinArrayAddresses, quoteOutput.postActiveBin.binId,
|
|
427
433
|
);
|
|
428
434
|
return { quoteOutput, binArrayAddresses };
|
|
429
435
|
}
|
package/src/picon_dlmm.json
CHANGED
|
@@ -11,6 +11,11 @@ export interface BinArray {
|
|
|
11
11
|
bins: Bin[];
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
export interface BinEntry {
|
|
15
|
+
binId: number;
|
|
16
|
+
price: bigint;
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
export interface DynamicFeeConfig {
|
|
15
20
|
filterPeriod: number;
|
|
16
21
|
decayPeriod: number;
|
|
@@ -50,17 +55,33 @@ export interface QuoteExactInInput {
|
|
|
50
55
|
binArrays: (BinArray | undefined)[];
|
|
51
56
|
inputTransferFee?: TransferFee;
|
|
52
57
|
outputTransferFee?: TransferFee;
|
|
58
|
+
/**
|
|
59
|
+
* Report a partial fill as `Ok` instead of `Err(InsufficientLiquidity)`.
|
|
60
|
+
*/
|
|
61
|
+
allowPartialFill: boolean;
|
|
53
62
|
}
|
|
54
63
|
|
|
55
64
|
export interface QuoteExactInOutput {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
preActiveBin: BinEntry;
|
|
66
|
+
postActiveBin: BinEntry;
|
|
67
|
+
/**
|
|
68
|
+
* What this quote was requested for.
|
|
69
|
+
*/
|
|
70
|
+
requestedAmountIn: bigint;
|
|
71
|
+
/**
|
|
72
|
+
* What was actually consumed — use this, not `requested_amount_in`, to build a swap
|
|
73
|
+
* instruction. Differs from it only when `not_enough_liquidity` is `true`.
|
|
74
|
+
*/
|
|
75
|
+
consumedAmountIn: bigint;
|
|
59
76
|
amountOut: bigint;
|
|
60
77
|
minAmountOut: bigint;
|
|
61
78
|
fee: bigint;
|
|
62
79
|
feeRateMin: bigint;
|
|
63
80
|
feeRateMax: bigint;
|
|
81
|
+
/**
|
|
82
|
+
* `true` on a partial fill.
|
|
83
|
+
*/
|
|
84
|
+
notEnoughLiquidity: boolean;
|
|
64
85
|
}
|
|
65
86
|
|
|
66
87
|
export interface QuoteExactOutInput {
|
|
@@ -75,17 +96,26 @@ export interface QuoteExactOutInput {
|
|
|
75
96
|
binArrays: (BinArray | undefined)[];
|
|
76
97
|
inputTransferFee?: TransferFee;
|
|
77
98
|
outputTransferFee?: TransferFee;
|
|
99
|
+
/**
|
|
100
|
+
* Report a partial fill as `Ok` instead of `Err(InsufficientLiquidity)`.
|
|
101
|
+
*/
|
|
102
|
+
allowPartialFill: boolean;
|
|
78
103
|
}
|
|
79
104
|
|
|
80
105
|
export interface QuoteExactOutOutput {
|
|
81
|
-
|
|
82
|
-
|
|
106
|
+
preActiveBin: BinEntry;
|
|
107
|
+
postActiveBin: BinEntry;
|
|
83
108
|
/**
|
|
84
|
-
*
|
|
109
|
+
* What this quote was requested for, net.
|
|
85
110
|
*/
|
|
86
|
-
|
|
111
|
+
requestedAmountOut: bigint;
|
|
87
112
|
/**
|
|
88
|
-
*
|
|
113
|
+
* What was actually achieved, net — differs from `requested_amount_out` only when
|
|
114
|
+
* `not_enough_liquidity` is `true`; `amount_in` below is its real cost.
|
|
115
|
+
*/
|
|
116
|
+
consumedAmountOut: bigint;
|
|
117
|
+
/**
|
|
118
|
+
* Gross of DLMM fee and input transfer fee — what the trader pays for `consumed_amount_out`.
|
|
89
119
|
*/
|
|
90
120
|
amountIn: bigint;
|
|
91
121
|
/**
|
|
@@ -98,6 +128,10 @@ export interface QuoteExactOutOutput {
|
|
|
98
128
|
fee: bigint;
|
|
99
129
|
feeRateMin: bigint;
|
|
100
130
|
feeRateMax: bigint;
|
|
131
|
+
/**
|
|
132
|
+
* `true` on a partial fill.
|
|
133
|
+
*/
|
|
134
|
+
notEnoughLiquidity: boolean;
|
|
101
135
|
}
|
|
102
136
|
|
|
103
137
|
export interface TransferFee {
|
|
Binary file
|
|
@@ -11,6 +11,11 @@ export interface BinArray {
|
|
|
11
11
|
bins: Bin[];
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
export interface BinEntry {
|
|
15
|
+
binId: number;
|
|
16
|
+
price: bigint;
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
export interface DynamicFeeConfig {
|
|
15
20
|
filterPeriod: number;
|
|
16
21
|
decayPeriod: number;
|
|
@@ -50,17 +55,33 @@ export interface QuoteExactInInput {
|
|
|
50
55
|
binArrays: (BinArray | undefined)[];
|
|
51
56
|
inputTransferFee?: TransferFee;
|
|
52
57
|
outputTransferFee?: TransferFee;
|
|
58
|
+
/**
|
|
59
|
+
* Report a partial fill as `Ok` instead of `Err(InsufficientLiquidity)`.
|
|
60
|
+
*/
|
|
61
|
+
allowPartialFill: boolean;
|
|
53
62
|
}
|
|
54
63
|
|
|
55
64
|
export interface QuoteExactInOutput {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
preActiveBin: BinEntry;
|
|
66
|
+
postActiveBin: BinEntry;
|
|
67
|
+
/**
|
|
68
|
+
* What this quote was requested for.
|
|
69
|
+
*/
|
|
70
|
+
requestedAmountIn: bigint;
|
|
71
|
+
/**
|
|
72
|
+
* What was actually consumed — use this, not `requested_amount_in`, to build a swap
|
|
73
|
+
* instruction. Differs from it only when `not_enough_liquidity` is `true`.
|
|
74
|
+
*/
|
|
75
|
+
consumedAmountIn: bigint;
|
|
59
76
|
amountOut: bigint;
|
|
60
77
|
minAmountOut: bigint;
|
|
61
78
|
fee: bigint;
|
|
62
79
|
feeRateMin: bigint;
|
|
63
80
|
feeRateMax: bigint;
|
|
81
|
+
/**
|
|
82
|
+
* `true` on a partial fill.
|
|
83
|
+
*/
|
|
84
|
+
notEnoughLiquidity: boolean;
|
|
64
85
|
}
|
|
65
86
|
|
|
66
87
|
export interface QuoteExactOutInput {
|
|
@@ -75,17 +96,26 @@ export interface QuoteExactOutInput {
|
|
|
75
96
|
binArrays: (BinArray | undefined)[];
|
|
76
97
|
inputTransferFee?: TransferFee;
|
|
77
98
|
outputTransferFee?: TransferFee;
|
|
99
|
+
/**
|
|
100
|
+
* Report a partial fill as `Ok` instead of `Err(InsufficientLiquidity)`.
|
|
101
|
+
*/
|
|
102
|
+
allowPartialFill: boolean;
|
|
78
103
|
}
|
|
79
104
|
|
|
80
105
|
export interface QuoteExactOutOutput {
|
|
81
|
-
|
|
82
|
-
|
|
106
|
+
preActiveBin: BinEntry;
|
|
107
|
+
postActiveBin: BinEntry;
|
|
83
108
|
/**
|
|
84
|
-
*
|
|
109
|
+
* What this quote was requested for, net.
|
|
85
110
|
*/
|
|
86
|
-
|
|
111
|
+
requestedAmountOut: bigint;
|
|
87
112
|
/**
|
|
88
|
-
*
|
|
113
|
+
* What was actually achieved, net — differs from `requested_amount_out` only when
|
|
114
|
+
* `not_enough_liquidity` is `true`; `amount_in` below is its real cost.
|
|
115
|
+
*/
|
|
116
|
+
consumedAmountOut: bigint;
|
|
117
|
+
/**
|
|
118
|
+
* Gross of DLMM fee and input transfer fee — what the trader pays for `consumed_amount_out`.
|
|
89
119
|
*/
|
|
90
120
|
amountIn: bigint;
|
|
91
121
|
/**
|
|
@@ -98,6 +128,10 @@ export interface QuoteExactOutOutput {
|
|
|
98
128
|
fee: bigint;
|
|
99
129
|
feeRateMin: bigint;
|
|
100
130
|
feeRateMax: bigint;
|
|
131
|
+
/**
|
|
132
|
+
* `true` on a partial fill.
|
|
133
|
+
*/
|
|
134
|
+
notEnoughLiquidity: boolean;
|
|
101
135
|
}
|
|
102
136
|
|
|
103
137
|
export interface TransferFee {
|
|
Binary file
|