@lifi/perps-types 18.0.0 → 19.0.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.
Files changed (88) hide show
  1. package/dist/cjs/account.d.ts +63 -62
  2. package/dist/cjs/account.d.ts.map +1 -1
  3. package/dist/cjs/action.d.ts +17 -16
  4. package/dist/cjs/action.d.ts.map +1 -1
  5. package/dist/cjs/asset.d.ts +2 -1
  6. package/dist/cjs/asset.d.ts.map +1 -1
  7. package/dist/cjs/decimal.d.ts +4 -0
  8. package/dist/cjs/decimal.d.ts.map +1 -0
  9. package/dist/cjs/decimal.js +9 -0
  10. package/dist/cjs/decimal.js.map +1 -0
  11. package/dist/cjs/index.d.ts +1 -0
  12. package/dist/cjs/index.d.ts.map +1 -1
  13. package/dist/cjs/index.js +1 -0
  14. package/dist/cjs/index.js.map +1 -1
  15. package/dist/cjs/market.d.ts +24 -23
  16. package/dist/cjs/market.d.ts.map +1 -1
  17. package/dist/cjs/portfolioHistory.d.ts +5 -4
  18. package/dist/cjs/portfolioHistory.d.ts.map +1 -1
  19. package/dist/cjs/providers.d.ts +6 -5
  20. package/dist/cjs/providers.d.ts.map +1 -1
  21. package/dist/cjs/quote.d.ts +7 -6
  22. package/dist/cjs/quote.d.ts.map +1 -1
  23. package/dist/cjs/referral.d.ts +4 -3
  24. package/dist/cjs/referral.d.ts.map +1 -1
  25. package/dist/cjs/referral.js.map +1 -1
  26. package/dist/cjs/subscriptions.d.ts +3 -1
  27. package/dist/cjs/subscriptions.d.ts.map +1 -1
  28. package/dist/esm/account.d.ts +63 -62
  29. package/dist/esm/account.d.ts.map +1 -1
  30. package/dist/esm/action.d.ts +17 -16
  31. package/dist/esm/action.d.ts.map +1 -1
  32. package/dist/esm/asset.d.ts +2 -1
  33. package/dist/esm/asset.d.ts.map +1 -1
  34. package/dist/esm/decimal.d.ts +23 -0
  35. package/dist/esm/decimal.d.ts.map +1 -0
  36. package/dist/esm/decimal.js +17 -0
  37. package/dist/esm/decimal.js.map +1 -0
  38. package/dist/esm/index.d.ts +1 -0
  39. package/dist/esm/index.d.ts.map +1 -1
  40. package/dist/esm/index.js +1 -0
  41. package/dist/esm/index.js.map +1 -1
  42. package/dist/esm/market.d.ts +30 -30
  43. package/dist/esm/market.d.ts.map +1 -1
  44. package/dist/esm/portfolioHistory.d.ts +5 -4
  45. package/dist/esm/portfolioHistory.d.ts.map +1 -1
  46. package/dist/esm/providers.d.ts +24 -11
  47. package/dist/esm/providers.d.ts.map +1 -1
  48. package/dist/esm/quote.d.ts +7 -6
  49. package/dist/esm/quote.d.ts.map +1 -1
  50. package/dist/esm/referral.d.ts +4 -3
  51. package/dist/esm/referral.d.ts.map +1 -1
  52. package/dist/esm/referral.js.map +1 -1
  53. package/dist/esm/subscriptions.d.ts +5 -1
  54. package/dist/esm/subscriptions.d.ts.map +1 -1
  55. package/dist/types/account.d.ts +63 -62
  56. package/dist/types/account.d.ts.map +1 -1
  57. package/dist/types/action.d.ts +17 -16
  58. package/dist/types/action.d.ts.map +1 -1
  59. package/dist/types/asset.d.ts +2 -1
  60. package/dist/types/asset.d.ts.map +1 -1
  61. package/dist/types/decimal.d.ts +23 -0
  62. package/dist/types/decimal.d.ts.map +1 -0
  63. package/dist/types/index.d.ts +1 -0
  64. package/dist/types/index.d.ts.map +1 -1
  65. package/dist/types/market.d.ts +30 -30
  66. package/dist/types/market.d.ts.map +1 -1
  67. package/dist/types/portfolioHistory.d.ts +5 -4
  68. package/dist/types/portfolioHistory.d.ts.map +1 -1
  69. package/dist/types/providers.d.ts +24 -11
  70. package/dist/types/providers.d.ts.map +1 -1
  71. package/dist/types/quote.d.ts +7 -6
  72. package/dist/types/quote.d.ts.map +1 -1
  73. package/dist/types/referral.d.ts +4 -3
  74. package/dist/types/referral.d.ts.map +1 -1
  75. package/dist/types/subscriptions.d.ts +5 -1
  76. package/dist/types/subscriptions.d.ts.map +1 -1
  77. package/package.json +1 -1
  78. package/src/account.ts +63 -62
  79. package/src/action.ts +17 -16
  80. package/src/asset.ts +3 -1
  81. package/src/decimal.ts +26 -0
  82. package/src/index.ts +1 -0
  83. package/src/market.ts +30 -30
  84. package/src/portfolioHistory.ts +6 -4
  85. package/src/providers.ts +24 -11
  86. package/src/quote.ts +7 -6
  87. package/src/referral.ts +4 -3
  88. package/src/subscriptions.ts +4 -1
package/src/providers.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { ActionParamsMap } from './action.js'
2
2
  import type { Asset } from './asset.js'
3
+ import type { DecimalString } from './decimal.js'
3
4
  import type {
4
5
  ActionRelay,
5
6
  ActionType,
@@ -179,25 +180,37 @@ export interface Provider {
179
180
  * values. Absent when the provider has no settlement chain.
180
181
  */
181
182
  chainId?: number
182
- /** Absent means no minimum advertised. */
183
- minDepositUsd?: number
184
183
  /**
185
- * Minimum order notional value in USD. Feeds the SDK's `validateMargin`
186
- * `minMarginUsd` parameter. Absent means no minimum advertised.
184
+ * Minimum deposit in USD, as a plain decimal string. Absent means no
185
+ * minimum advertised.
187
186
  */
188
- minOrderValueUsd?: number
187
+ minDepositUsd?: DecimalString
188
+ /**
189
+ * Minimum order notional value in USD, as a plain decimal string. Absent
190
+ * means no minimum advertised.
191
+ */
192
+ minOrderValueUsd?: DecimalString
189
193
  /**
190
194
  * Minimum order notional value in USD for reduce-only orders, when the
191
195
  * provider applies a lower floor than `minOrderValueUsd`. Absent means
192
196
  * reduce-only orders use the same floor as `minOrderValueUsd`.
193
197
  */
194
198
  minReduceOrderValueUsd?: number
195
- /** Minimum withdrawal notional in USD. Absent means no minimum advertised. */
196
- minWithdrawalUsd?: number
197
- /** Flat deposit fee in USD the provider charges. Absent means no fee advertised. */
198
- depositFeeUsd?: number
199
- /** Flat withdrawal fee in USD the provider charges. Absent means no fee advertised. */
200
- withdrawalFeeUsd?: number
199
+ /**
200
+ * Minimum withdrawal notional in USD, as a plain decimal string. Absent
201
+ * means no minimum advertised.
202
+ */
203
+ minWithdrawalUsd?: DecimalString
204
+ /**
205
+ * Flat deposit fee in USD the provider charges, as a plain decimal string.
206
+ * Absent means no fee advertised.
207
+ */
208
+ depositFeeUsd?: DecimalString
209
+ /**
210
+ * Flat withdrawal fee in USD the provider charges, as a plain decimal
211
+ * string. Absent means no fee advertised.
212
+ */
213
+ withdrawalFeeUsd?: DecimalString
201
214
  /**
202
215
  * Candle intervals this provider supports for OHLCV/chart requests, in
203
216
  * ascending order. Drives the client's chart interval selector. Empty for
package/src/quote.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { FeeTier } from './account.js'
2
+ import type { DecimalString } from './decimal.js'
2
3
  import type { FundingInfo } from './market.js'
3
4
 
4
5
  /** Side of the quoted market order, using lowercase wire values. @public */
@@ -26,20 +27,20 @@ export interface Quote {
26
27
  type: TradeType
27
28
  side: QuoteSide
28
29
  /** Input notional in USD. */
29
- sizeUsd: string
30
+ sizeUsd: DecimalString
30
31
  /** Base amount the book filled for `sizeUsd` (or the most obtainable when the book is too thin). */
31
- baseSize: string
32
- markPrice: string
32
+ baseSize: DecimalString
33
+ markPrice: DecimalString
33
34
  /** Volume-weighted average fill price from the book walk. */
34
- expectedFillPrice: string
35
+ expectedFillPrice: DecimalString
35
36
  /** VWAP deviation from `markPrice` in basis points; non-negative. */
36
- priceImpactBps: string
37
+ priceImpactBps: DecimalString
37
38
  /** Base maker/taker fee fractions (not bps) for the public tier. */
38
39
  feeTier: FeeTier
39
40
  /** Always `true` in v1 — quotes use the public base tier, never a per-account tier. */
40
41
  isDefaultFeeTier: boolean
41
42
  /** Taker fee on the filled notional in USD: `filledNotional * feeTier.taker`. */
42
- feeUsd: string
43
+ feeUsd: DecimalString
43
44
  /** Current funding for perps; `null` for spot. */
44
45
  funding: FundingInfo | null
45
46
  /** `true` when the book could not fill the full `sizeUsd` — `baseSize`/fill reflect the best obtainable. */
package/src/referral.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { Pagination } from './account.js'
2
+ import type { DecimalString } from './decimal.js'
2
3
  import type { Address } from './primitives.js'
3
4
  import type { PerpsTypedData, TypedDataParameter } from './typedData.js'
4
5
 
@@ -71,9 +72,9 @@ export interface OwnedReferralCodeEligibility {
71
72
  * Executed notional the address must reach, as a decimal string in the
72
73
  * backend's reporting currency. Absent when the backend does not disclose it.
73
74
  */
74
- requiredNotional?: string
75
+ requiredNotional?: DecimalString
75
76
  /** The address's executed notional so far, in the same units as `requiredNotional`. */
76
- currentNotional?: string
77
+ currentNotional?: DecimalString
77
78
  }
78
79
 
79
80
  /**
@@ -125,7 +126,7 @@ export interface ReferralActivityItem {
125
126
  * Executed notional recorded against this attachment, as a decimal string in
126
127
  * the backend's reporting currency.
127
128
  */
128
- notional: string
129
+ notional: DecimalString
129
130
  }
130
131
 
131
132
  /**
@@ -6,6 +6,7 @@ import type {
6
6
  Order,
7
7
  Position,
8
8
  } from './account.js'
9
+ import type { DecimalString } from './decimal.js'
9
10
  import type {
10
11
  Candle,
11
12
  MarketContext,
@@ -148,11 +149,13 @@ export type PositionsEvent = { channel: 'positions'; data: Position[] }
148
149
  /**
149
150
  * Spot holdings as typed {@link Balance}s, each carrying the venue-locked
150
151
  * portion (`locked` = reserved against open orders; `available = units − locked`).
152
+ * `transferable` is required here, so a live frame always carries the figure
153
+ * a REST snapshot carries.
151
154
  * @public
152
155
  */
153
156
  export type SpotBalancesEvent = {
154
157
  channel: 'spotBalances'
155
- data: (Balance & { locked: string })[]
158
+ data: (Balance & { locked: DecimalString; transferable: DecimalString })[]
156
159
  }
157
160
 
158
161
  /**