@picon-finance/dlmm-sdk 1.18.0 → 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.
@@ -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,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,qBAAa,IAAI;;IAQf,OAAO,eAYN;IAED,IAAW,GAAG,+5nBAAwB;IAEtC,IAAW,cAAc,YAAmC;IAC5D,IAAW,OAAO,oBAAoC;IACtD,IAAW,IAAI,mBAAiC;IAChD,IAAW,WAAW,WAAoC;IAE1D,IAAW,UAAU,YAAmC;IACxD,IAAW,UAAU,YAAmC;IAExD,IAAW,cAAc,WAAwC;IACjE,IAAW,cAAc,WAAwC;IAEjE,IAAW,WAAW,YAAoC;IAC1D,IAAW,WAAW,YAAoC;IAE1D,IAAW,aAAa,YAAyC;IACjE,IAAW,aAAa,YAAyC;IAEpD,eAAe,IAAI,OAAO,CAAC;QAAE,YAAY,CAAC,EAAE,WAAW,CAAC;QAAC,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EAAE,OAAO,EAChB,cAAc,EAAE,OAAO,EACvB,MAAM,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAWf;CACF;AAED,wBAAsB,eAAe,CACnC,KAAK,EAAE;IAAE,UAAU,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EACrF,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,OAAO,CAAC,CAGlB;AAED,wBAAsB,UAAU,CAC9B,EACE,SAAS,EACT,OAAO,EACP,OAAO,EACP,aAAa,EACb,WAAW,EACX,UAAU,EACV,UAAU,EACV,aAAa,EACb,aAAa,GACd,EAAE;IACD,SAAS,EAAE,iBAAiB,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;CACxB,EACD,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,WAAW,CAAC,CAkBtB"}
@@ -198,6 +198,9 @@ 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
205
  const binArrayAddresses = this.#binArrayAddressesForQuote(xToY, indices, maxBinArrayAddresses, quoteOutput.postActiveBin.binId);
203
206
  return { quoteOutput, binArrayAddresses };
@@ -213,6 +216,9 @@ 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
223
  const binArrayAddresses = this.#binArrayAddressesForQuote(xToY, indices, maxBinArrayAddresses, quoteOutput.postActiveBin.binId);
218
224
  return { quoteOutput, binArrayAddresses };
@@ -55,17 +55,33 @@ export interface QuoteExactInInput {
55
55
  binArrays: (BinArray | undefined)[];
56
56
  inputTransferFee?: TransferFee;
57
57
  outputTransferFee?: TransferFee;
58
+ /**
59
+ * Report a partial fill as `Ok` instead of `Err(InsufficientLiquidity)`.
60
+ */
61
+ allowPartialFill: boolean;
58
62
  }
59
63
 
60
64
  export interface QuoteExactInOutput {
61
65
  preActiveBin: BinEntry;
62
66
  postActiveBin: BinEntry;
63
- amountIn: bigint;
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;
64
76
  amountOut: bigint;
65
77
  minAmountOut: bigint;
66
78
  fee: bigint;
67
79
  feeRateMin: bigint;
68
80
  feeRateMax: bigint;
81
+ /**
82
+ * `true` on a partial fill.
83
+ */
84
+ notEnoughLiquidity: boolean;
69
85
  }
70
86
 
71
87
  export interface QuoteExactOutInput {
@@ -80,17 +96,26 @@ export interface QuoteExactOutInput {
80
96
  binArrays: (BinArray | undefined)[];
81
97
  inputTransferFee?: TransferFee;
82
98
  outputTransferFee?: TransferFee;
99
+ /**
100
+ * Report a partial fill as `Ok` instead of `Err(InsufficientLiquidity)`.
101
+ */
102
+ allowPartialFill: boolean;
83
103
  }
84
104
 
85
105
  export interface QuoteExactOutOutput {
86
106
  preActiveBin: BinEntry;
87
107
  postActiveBin: BinEntry;
88
108
  /**
89
- * Echoes `input.amount_out`, net.
109
+ * What this quote was requested for, net.
90
110
  */
91
- amountOut: bigint;
111
+ requestedAmountOut: bigint;
92
112
  /**
93
- * Gross of DLMM fee and input transfer fee — what the trader pays.
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`.
94
119
  */
95
120
  amountIn: bigint;
96
121
  /**
@@ -103,6 +128,10 @@ export interface QuoteExactOutOutput {
103
128
  fee: bigint;
104
129
  feeRateMin: bigint;
105
130
  feeRateMax: bigint;
131
+ /**
132
+ * `true` on a partial fill.
133
+ */
134
+ notEnoughLiquidity: boolean;
106
135
  }
107
136
 
108
137
  export interface TransferFee {
@@ -55,17 +55,33 @@ export interface QuoteExactInInput {
55
55
  binArrays: (BinArray | undefined)[];
56
56
  inputTransferFee?: TransferFee;
57
57
  outputTransferFee?: TransferFee;
58
+ /**
59
+ * Report a partial fill as `Ok` instead of `Err(InsufficientLiquidity)`.
60
+ */
61
+ allowPartialFill: boolean;
58
62
  }
59
63
 
60
64
  export interface QuoteExactInOutput {
61
65
  preActiveBin: BinEntry;
62
66
  postActiveBin: BinEntry;
63
- amountIn: bigint;
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;
64
76
  amountOut: bigint;
65
77
  minAmountOut: bigint;
66
78
  fee: bigint;
67
79
  feeRateMin: bigint;
68
80
  feeRateMax: bigint;
81
+ /**
82
+ * `true` on a partial fill.
83
+ */
84
+ notEnoughLiquidity: boolean;
69
85
  }
70
86
 
71
87
  export interface QuoteExactOutInput {
@@ -80,17 +96,26 @@ export interface QuoteExactOutInput {
80
96
  binArrays: (BinArray | undefined)[];
81
97
  inputTransferFee?: TransferFee;
82
98
  outputTransferFee?: TransferFee;
99
+ /**
100
+ * Report a partial fill as `Ok` instead of `Err(InsufficientLiquidity)`.
101
+ */
102
+ allowPartialFill: boolean;
83
103
  }
84
104
 
85
105
  export interface QuoteExactOutOutput {
86
106
  preActiveBin: BinEntry;
87
107
  postActiveBin: BinEntry;
88
108
  /**
89
- * Echoes `input.amount_out`, net.
109
+ * What this quote was requested for, net.
90
110
  */
91
- amountOut: bigint;
111
+ requestedAmountOut: bigint;
92
112
  /**
93
- * Gross of DLMM fee and input transfer fee — what the trader pays.
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`.
94
119
  */
95
120
  amountIn: bigint;
96
121
  /**
@@ -103,6 +128,10 @@ export interface QuoteExactOutOutput {
103
128
  fee: bigint;
104
129
  feeRateMin: bigint;
105
130
  feeRateMax: bigint;
131
+ /**
132
+ * `true` on a partial fill.
133
+ */
134
+ notEnoughLiquidity: boolean;
106
135
  }
107
136
 
108
137
  export interface TransferFee {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picon-finance/dlmm-sdk",
3
- "version": "1.18.0",
3
+ "version": "1.18.1",
4
4
  "description": "Typescript SDK for interacting with the Picon DLMM protocol",
5
5
  "author": "Picon Finance",
6
6
  "license": "MIT",
@@ -389,6 +389,9 @@ 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(
@@ -420,6 +423,9 @@ 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(
@@ -55,17 +55,33 @@ export interface QuoteExactInInput {
55
55
  binArrays: (BinArray | undefined)[];
56
56
  inputTransferFee?: TransferFee;
57
57
  outputTransferFee?: TransferFee;
58
+ /**
59
+ * Report a partial fill as `Ok` instead of `Err(InsufficientLiquidity)`.
60
+ */
61
+ allowPartialFill: boolean;
58
62
  }
59
63
 
60
64
  export interface QuoteExactInOutput {
61
65
  preActiveBin: BinEntry;
62
66
  postActiveBin: BinEntry;
63
- amountIn: bigint;
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;
64
76
  amountOut: bigint;
65
77
  minAmountOut: bigint;
66
78
  fee: bigint;
67
79
  feeRateMin: bigint;
68
80
  feeRateMax: bigint;
81
+ /**
82
+ * `true` on a partial fill.
83
+ */
84
+ notEnoughLiquidity: boolean;
69
85
  }
70
86
 
71
87
  export interface QuoteExactOutInput {
@@ -80,17 +96,26 @@ export interface QuoteExactOutInput {
80
96
  binArrays: (BinArray | undefined)[];
81
97
  inputTransferFee?: TransferFee;
82
98
  outputTransferFee?: TransferFee;
99
+ /**
100
+ * Report a partial fill as `Ok` instead of `Err(InsufficientLiquidity)`.
101
+ */
102
+ allowPartialFill: boolean;
83
103
  }
84
104
 
85
105
  export interface QuoteExactOutOutput {
86
106
  preActiveBin: BinEntry;
87
107
  postActiveBin: BinEntry;
88
108
  /**
89
- * Echoes `input.amount_out`, net.
109
+ * What this quote was requested for, net.
90
110
  */
91
- amountOut: bigint;
111
+ requestedAmountOut: bigint;
92
112
  /**
93
- * Gross of DLMM fee and input transfer fee — what the trader pays.
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`.
94
119
  */
95
120
  amountIn: bigint;
96
121
  /**
@@ -103,6 +128,10 @@ export interface QuoteExactOutOutput {
103
128
  fee: bigint;
104
129
  feeRateMin: bigint;
105
130
  feeRateMax: bigint;
131
+ /**
132
+ * `true` on a partial fill.
133
+ */
134
+ notEnoughLiquidity: boolean;
106
135
  }
107
136
 
108
137
  export interface TransferFee {
@@ -55,17 +55,33 @@ export interface QuoteExactInInput {
55
55
  binArrays: (BinArray | undefined)[];
56
56
  inputTransferFee?: TransferFee;
57
57
  outputTransferFee?: TransferFee;
58
+ /**
59
+ * Report a partial fill as `Ok` instead of `Err(InsufficientLiquidity)`.
60
+ */
61
+ allowPartialFill: boolean;
58
62
  }
59
63
 
60
64
  export interface QuoteExactInOutput {
61
65
  preActiveBin: BinEntry;
62
66
  postActiveBin: BinEntry;
63
- amountIn: bigint;
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;
64
76
  amountOut: bigint;
65
77
  minAmountOut: bigint;
66
78
  fee: bigint;
67
79
  feeRateMin: bigint;
68
80
  feeRateMax: bigint;
81
+ /**
82
+ * `true` on a partial fill.
83
+ */
84
+ notEnoughLiquidity: boolean;
69
85
  }
70
86
 
71
87
  export interface QuoteExactOutInput {
@@ -80,17 +96,26 @@ export interface QuoteExactOutInput {
80
96
  binArrays: (BinArray | undefined)[];
81
97
  inputTransferFee?: TransferFee;
82
98
  outputTransferFee?: TransferFee;
99
+ /**
100
+ * Report a partial fill as `Ok` instead of `Err(InsufficientLiquidity)`.
101
+ */
102
+ allowPartialFill: boolean;
83
103
  }
84
104
 
85
105
  export interface QuoteExactOutOutput {
86
106
  preActiveBin: BinEntry;
87
107
  postActiveBin: BinEntry;
88
108
  /**
89
- * Echoes `input.amount_out`, net.
109
+ * What this quote was requested for, net.
90
110
  */
91
- amountOut: bigint;
111
+ requestedAmountOut: bigint;
92
112
  /**
93
- * Gross of DLMM fee and input transfer fee — what the trader pays.
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`.
94
119
  */
95
120
  amountIn: bigint;
96
121
  /**
@@ -103,6 +128,10 @@ export interface QuoteExactOutOutput {
103
128
  fee: bigint;
104
129
  feeRateMin: bigint;
105
130
  feeRateMax: bigint;
131
+ /**
132
+ * `true` on a partial fill.
133
+ */
134
+ notEnoughLiquidity: boolean;
106
135
  }
107
136
 
108
137
  export interface TransferFee {