@lifi/perps-sdk 21.0.0 → 22.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.
- package/README.md +84 -16
- package/dist/cjs/client/PerpsClient.d.ts +3 -3
- package/dist/cjs/client/PerpsClient.d.ts.map +1 -1
- package/dist/cjs/client/PerpsClient.js.map +1 -1
- package/dist/cjs/decimal/convert.d.ts +1 -5
- package/dist/cjs/decimal/convert.d.ts.map +1 -1
- package/dist/cjs/decimal/convert.js +10 -28
- package/dist/cjs/decimal/convert.js.map +1 -1
- package/dist/cjs/decimal/format.d.ts +2 -1
- package/dist/cjs/decimal/format.d.ts.map +1 -1
- package/dist/cjs/decimal/format.js.map +1 -1
- package/dist/cjs/decimal/parse.d.ts +2 -4
- package/dist/cjs/decimal/parse.d.ts.map +1 -1
- package/dist/cjs/decimal/parse.js +5 -2
- package/dist/cjs/decimal/parse.js.map +1 -1
- package/dist/cjs/decimal/requireDecimal.d.ts.map +1 -0
- package/dist/cjs/{wire → decimal}/requireDecimal.js +2 -1
- package/dist/cjs/decimal/requireDecimal.js.map +1 -0
- package/dist/cjs/index.d.ts +5 -5
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +6 -20
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/math/fills.d.ts +3 -3
- package/dist/cjs/math/fills.d.ts.map +1 -1
- package/dist/cjs/math/fills.js.map +1 -1
- package/dist/cjs/math/order.d.ts +1 -8
- package/dist/cjs/math/order.d.ts.map +1 -1
- package/dist/cjs/math/order.js +6 -11
- package/dist/cjs/math/order.js.map +1 -1
- package/dist/cjs/math/position.d.ts +3 -8
- package/dist/cjs/math/position.d.ts.map +1 -1
- package/dist/cjs/math/position.js +12 -12
- package/dist/cjs/math/position.js.map +1 -1
- package/dist/cjs/services/getActivity.d.ts.map +1 -1
- package/dist/cjs/services/getActivity.js.map +1 -1
- package/dist/cjs/services/getFills.d.ts.map +1 -1
- package/dist/cjs/services/getFills.js.map +1 -1
- package/dist/cjs/services/getOrder.d.ts.map +1 -1
- package/dist/cjs/services/getOrder.js.map +1 -1
- package/dist/cjs/services/getOrders.d.ts.map +1 -1
- package/dist/cjs/services/getOrders.js.map +1 -1
- package/dist/cjs/services/getPositions.d.ts.map +1 -1
- package/dist/cjs/services/getPositions.js.map +1 -1
- package/dist/cjs/services/resolveSubscribeQuote.d.ts +1 -1
- package/dist/cjs/services/resolveSubscribeQuote.d.ts.map +1 -1
- package/dist/cjs/services/resolveSubscribeQuote.js +24 -13
- package/dist/cjs/services/resolveSubscribeQuote.js.map +1 -1
- package/dist/cjs/types/api.d.ts +4 -4
- package/dist/cjs/types/api.d.ts.map +1 -1
- package/dist/cjs/types/provider.d.ts +1 -1
- package/dist/cjs/types/provider.d.ts.map +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wire/orderAmounts.d.ts +1 -2
- package/dist/cjs/wire/orderAmounts.d.ts.map +1 -1
- package/dist/cjs/wire/orderAmounts.js +19 -52
- package/dist/cjs/wire/orderAmounts.js.map +1 -1
- package/dist/cjs/wire/refuel.js +1 -1
- package/dist/cjs/wire/refuel.js.map +1 -1
- package/dist/cjs/wire/transferable.js +1 -1
- package/dist/cjs/wire/transferable.js.map +1 -1
- package/dist/cjs/wire/withdraw.d.ts.map +1 -1
- package/dist/cjs/wire/withdraw.js +1 -1
- package/dist/cjs/wire/withdraw.js.map +1 -1
- package/dist/esm/client/PerpsClient.d.ts +40 -8
- package/dist/esm/client/PerpsClient.d.ts.map +1 -1
- package/dist/esm/client/PerpsClient.js +37 -5
- package/dist/esm/client/PerpsClient.js.map +1 -1
- package/dist/esm/decimal/convert.d.ts +8 -24
- package/dist/esm/decimal/convert.d.ts.map +1 -1
- package/dist/esm/decimal/convert.js +16 -42
- package/dist/esm/decimal/convert.js.map +1 -1
- package/dist/esm/decimal/format.d.ts +2 -1
- package/dist/esm/decimal/format.d.ts.map +1 -1
- package/dist/esm/decimal/format.js.map +1 -1
- package/dist/esm/decimal/parse.d.ts +7 -20
- package/dist/esm/decimal/parse.d.ts.map +1 -1
- package/dist/esm/decimal/parse.js +9 -4
- package/dist/esm/decimal/parse.js.map +1 -1
- package/dist/esm/{wire → decimal}/requireDecimal.d.ts +1 -1
- package/dist/esm/decimal/requireDecimal.d.ts.map +1 -0
- package/dist/esm/{wire → decimal}/requireDecimal.js +3 -2
- package/dist/esm/decimal/requireDecimal.js.map +1 -0
- package/dist/esm/index.d.ts +5 -5
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +4 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/math/fills.d.ts +3 -3
- package/dist/esm/math/fills.d.ts.map +1 -1
- package/dist/esm/math/fills.js +1 -1
- package/dist/esm/math/fills.js.map +1 -1
- package/dist/esm/math/order.d.ts +3 -34
- package/dist/esm/math/order.d.ts.map +1 -1
- package/dist/esm/math/order.js +8 -26
- package/dist/esm/math/order.js.map +1 -1
- package/dist/esm/math/position.d.ts +16 -34
- package/dist/esm/math/position.d.ts.map +1 -1
- package/dist/esm/math/position.js +23 -36
- package/dist/esm/math/position.js.map +1 -1
- package/dist/esm/services/getActivity.d.ts +4 -0
- package/dist/esm/services/getActivity.d.ts.map +1 -1
- package/dist/esm/services/getActivity.js +4 -0
- package/dist/esm/services/getActivity.js.map +1 -1
- package/dist/esm/services/getFills.d.ts +4 -0
- package/dist/esm/services/getFills.d.ts.map +1 -1
- package/dist/esm/services/getFills.js +4 -0
- package/dist/esm/services/getFills.js.map +1 -1
- package/dist/esm/services/getOrder.d.ts +4 -0
- package/dist/esm/services/getOrder.d.ts.map +1 -1
- package/dist/esm/services/getOrder.js +4 -0
- package/dist/esm/services/getOrder.js.map +1 -1
- package/dist/esm/services/getOrders.d.ts +10 -1
- package/dist/esm/services/getOrders.d.ts.map +1 -1
- package/dist/esm/services/getOrders.js +10 -1
- package/dist/esm/services/getOrders.js.map +1 -1
- package/dist/esm/services/getPositions.d.ts +4 -0
- package/dist/esm/services/getPositions.d.ts.map +1 -1
- package/dist/esm/services/getPositions.js +4 -0
- package/dist/esm/services/getPositions.js.map +1 -1
- package/dist/esm/services/resolveSubscribeQuote.d.ts +6 -1
- package/dist/esm/services/resolveSubscribeQuote.d.ts.map +1 -1
- package/dist/esm/services/resolveSubscribeQuote.js +29 -13
- package/dist/esm/services/resolveSubscribeQuote.js.map +1 -1
- package/dist/esm/types/api.d.ts +4 -4
- package/dist/esm/types/api.d.ts.map +1 -1
- package/dist/esm/types/provider.d.ts +1 -1
- package/dist/esm/types/provider.d.ts.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/wire/orderAmounts.d.ts +15 -29
- package/dist/esm/wire/orderAmounts.d.ts.map +1 -1
- package/dist/esm/wire/orderAmounts.js +28 -88
- package/dist/esm/wire/orderAmounts.js.map +1 -1
- package/dist/esm/wire/refuel.js +1 -1
- package/dist/esm/wire/refuel.js.map +1 -1
- package/dist/esm/wire/transferable.js +1 -1
- package/dist/esm/wire/transferable.js.map +1 -1
- package/dist/esm/wire/withdraw.d.ts.map +1 -1
- package/dist/esm/wire/withdraw.js +1 -1
- package/dist/esm/wire/withdraw.js.map +1 -1
- package/dist/types/client/PerpsClient.d.ts +40 -8
- package/dist/types/client/PerpsClient.d.ts.map +1 -1
- package/dist/types/decimal/convert.d.ts +8 -24
- package/dist/types/decimal/convert.d.ts.map +1 -1
- package/dist/types/decimal/format.d.ts +2 -1
- package/dist/types/decimal/format.d.ts.map +1 -1
- package/dist/types/decimal/parse.d.ts +7 -20
- package/dist/types/decimal/parse.d.ts.map +1 -1
- package/dist/types/{wire → decimal}/requireDecimal.d.ts +1 -1
- package/dist/types/decimal/requireDecimal.d.ts.map +1 -0
- package/dist/types/index.d.ts +5 -5
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/math/fills.d.ts +3 -3
- package/dist/types/math/fills.d.ts.map +1 -1
- package/dist/types/math/order.d.ts +3 -34
- package/dist/types/math/order.d.ts.map +1 -1
- package/dist/types/math/position.d.ts +16 -34
- package/dist/types/math/position.d.ts.map +1 -1
- package/dist/types/services/getActivity.d.ts +4 -0
- package/dist/types/services/getActivity.d.ts.map +1 -1
- package/dist/types/services/getFills.d.ts +4 -0
- package/dist/types/services/getFills.d.ts.map +1 -1
- package/dist/types/services/getOrder.d.ts +4 -0
- package/dist/types/services/getOrder.d.ts.map +1 -1
- package/dist/types/services/getOrders.d.ts +10 -1
- package/dist/types/services/getOrders.d.ts.map +1 -1
- package/dist/types/services/getPositions.d.ts +4 -0
- package/dist/types/services/getPositions.d.ts.map +1 -1
- package/dist/types/services/resolveSubscribeQuote.d.ts +6 -1
- package/dist/types/services/resolveSubscribeQuote.d.ts.map +1 -1
- package/dist/types/types/api.d.ts +4 -4
- package/dist/types/types/api.d.ts.map +1 -1
- package/dist/types/types/provider.d.ts +1 -1
- package/dist/types/types/provider.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/wire/orderAmounts.d.ts +15 -29
- package/dist/types/wire/orderAmounts.d.ts.map +1 -1
- package/dist/types/wire/withdraw.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/client/PerpsClient.ts +40 -7
- package/src/decimal/convert.ts +27 -54
- package/src/decimal/format.ts +3 -1
- package/src/decimal/parse.ts +10 -6
- package/src/{wire → decimal}/requireDecimal.ts +3 -6
- package/src/index.ts +4 -21
- package/src/math/fills.ts +8 -4
- package/src/math/order.ts +8 -31
- package/src/math/position.ts +32 -43
- package/src/services/getActivity.ts +4 -0
- package/src/services/getFills.ts +4 -0
- package/src/services/getOrder.ts +4 -0
- package/src/services/getOrders.ts +10 -1
- package/src/services/getPositions.ts +4 -0
- package/src/services/resolveSubscribeQuote.ts +37 -19
- package/src/types/api.ts +4 -3
- package/src/types/provider.ts +1 -1
- package/src/version.ts +1 -1
- package/src/wire/orderAmounts.ts +35 -117
- package/src/wire/refuel.ts +1 -1
- package/src/wire/transferable.ts +1 -1
- package/src/wire/withdraw.ts +1 -1
- package/dist/cjs/wire/requireDecimal.d.ts.map +0 -1
- package/dist/cjs/wire/requireDecimal.js.map +0 -1
- package/dist/esm/wire/requireDecimal.d.ts.map +0 -1
- package/dist/esm/wire/requireDecimal.js.map +0 -1
- package/dist/types/wire/requireDecimal.d.ts.map +0 -1
- /package/dist/cjs/{wire → decimal}/requireDecimal.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withdraw.js","sourceRoot":"","sources":["../../../src/wire/withdraw.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"withdraw.js","sourceRoot":"","sources":["../../../src/wire/withdraw.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAG7D;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAClC,GAGC;IAED,MAAM,SAAS,GAAG,cAAc,CAAC,GAAG,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;IAC5D,IAAI,GAAG,CAAC,aAAa,KAAK,KAAK,IAAI,GAAG,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;QACnE,OAAO,SAAS,CAAC,OAAO,EAAE,CAAA;IAC5B,CAAC;IACD,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAC5B,cAAc,CAAC,GAAG,CAAC,aAAa,EAAE,eAAe,CAAC,CACnD,CAAA;IACD,OAAO,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,GAAG,CAAA;AAC9C,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AccountResponse, AccountSummary, ActionParamsMap, ActionStep, AvailableToTrade, CreateActionResponse, ExecuteActionResponse, MarketRef, MarketSettings, MetaActionType, Order, OrdersResponse, PortfolioHistoryResponse, Position, SetupAction, SetupOption } from '@lifi/perps-types';
|
|
1
|
+
import type { AccountResponse, AccountSummary, ActionParamsMap, ActionStep, AvailableToTrade, CreateActionResponse, DecimalString, ExecuteActionResponse, MarketRef, MarketSettings, MetaActionType, Order, OrdersResponse, PortfolioHistoryResponse, Position, SetupAction, SetupOption } from '@lifi/perps-types';
|
|
2
2
|
import { ActionType } from '@lifi/perps-types';
|
|
3
3
|
import type { Address } from 'viem';
|
|
4
4
|
import { type GetOrderParams } from '../services/getOrder.js';
|
|
@@ -51,9 +51,23 @@ export declare class PerpsClient {
|
|
|
51
51
|
* `providers` option. The plugin owns signer identity and write-side signing.
|
|
52
52
|
*/
|
|
53
53
|
private requireProvider;
|
|
54
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* Read active or historical orders from the selected venue.
|
|
56
|
+
*
|
|
57
|
+
* @throws {PerpsError} `SetupRequired` when the venue needs a credential (a
|
|
58
|
+
* Lighter auth token or an Ondo session) and none is stored.
|
|
59
|
+
* @throws {PerpsError} `Unauthorized` when the venue rejects the credential.
|
|
60
|
+
* @throws {PerpsError} `AccountNotFound` when the wallet has no venue account.
|
|
61
|
+
*/
|
|
55
62
|
getOrders(params: GetOrdersParams, options?: SDKRequestOptions): Promise<OrdersResponse>;
|
|
56
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* Read one venue order through the provider's unified mapper.
|
|
65
|
+
*
|
|
66
|
+
* @throws {PerpsError} `SetupRequired` when the venue needs a credential (a
|
|
67
|
+
* Lighter auth token or an Ondo session) and none is stored.
|
|
68
|
+
* @throws {PerpsError} `Unauthorized` when the venue rejects the credential.
|
|
69
|
+
* @throws {PerpsError} `AccountNotFound` when the wallet has no venue account.
|
|
70
|
+
*/
|
|
57
71
|
getOrder(params: GetOrderParams, options?: SDKRequestOptions): Promise<Order>;
|
|
58
72
|
/**
|
|
59
73
|
* Ask the provider plugin for the signer-bearing wire fields of `action` —
|
|
@@ -168,6 +182,9 @@ export declare class PerpsClient {
|
|
|
168
182
|
* @throws {PerpsError} When the provider plugin is not registered,
|
|
169
183
|
* `ValidationError` for a spot market, or any other `PerpsError` when the
|
|
170
184
|
* venue read fails or carries no usable value.
|
|
185
|
+
* @throws {PerpsError} `SetupRequired` when the venue needs a credential (an
|
|
186
|
+
* Ondo session) and none is stored.
|
|
187
|
+
* @throws {PerpsError} `Unauthorized` when the venue rejects the credential.
|
|
171
188
|
* @public
|
|
172
189
|
*/
|
|
173
190
|
getMarketSettings(params: {
|
|
@@ -181,12 +198,19 @@ export declare class PerpsClient {
|
|
|
181
198
|
* account displays read the account-scoped
|
|
182
199
|
* {@link AccountSummary.availableMargin} instead.
|
|
183
200
|
*
|
|
184
|
-
* Providers that read a per-market figure answer it directly.
|
|
185
|
-
*
|
|
186
|
-
*
|
|
201
|
+
* Providers that read a per-market figure answer it directly. A provider
|
|
202
|
+
* that has no per-market figure for the market (a Hyperliquid or Lighter
|
|
203
|
+
* spot market) resolves `undefined`, and this falls back to the account
|
|
204
|
+
* summary, so both sides equal `availableMargin` and the asset is the
|
|
205
|
+
* market's quote asset. A provider read that throws propagates and never
|
|
206
|
+
* falls back.
|
|
187
207
|
*
|
|
188
208
|
* @throws {PerpsError} When the provider plugin is not registered, or the
|
|
189
209
|
* market is unknown to the provider's market registry.
|
|
210
|
+
* @throws {PerpsError} `SetupRequired` when the venue needs a credential (a
|
|
211
|
+
* Lighter auth token or an Ondo session) and none is stored.
|
|
212
|
+
* @throws {PerpsError} `Unauthorized` when the venue rejects the credential.
|
|
213
|
+
* @throws {PerpsError} `AccountNotFound` when the wallet has no venue account.
|
|
190
214
|
* @public
|
|
191
215
|
*/
|
|
192
216
|
getAvailableToTrade(params: {
|
|
@@ -203,7 +227,7 @@ export declare class PerpsClient {
|
|
|
203
227
|
* venue formula reads is malformed.
|
|
204
228
|
* @public
|
|
205
229
|
*/
|
|
206
|
-
getPositionRemovableMargin(position: Position):
|
|
230
|
+
getPositionRemovableMargin(position: Position): DecimalString | undefined;
|
|
207
231
|
/**
|
|
208
232
|
* Roll an already-fetched {@link AccountResponse} (plus its positions) up
|
|
209
233
|
* into an {@link AccountSummary}, delegating to the owning provider so the
|
|
@@ -258,6 +282,10 @@ export declare class PerpsClient {
|
|
|
258
282
|
* @throws {PerpsError} When the provider plugin is not registered, when
|
|
259
283
|
* either the plugin read or the asset sync fails, when a row's
|
|
260
284
|
* `withdrawalFee` is not a non-negative decimal.
|
|
285
|
+
* @throws {PerpsError} `SetupRequired` when the venue needs a credential (a
|
|
286
|
+
* Lighter auth token or an Ondo session) and none is stored.
|
|
287
|
+
* @throws {PerpsError} `Unauthorized` when the venue rejects the credential.
|
|
288
|
+
* @throws {PerpsError} `AccountNotFound` when the wallet has no venue account.
|
|
261
289
|
* @public
|
|
262
290
|
*/
|
|
263
291
|
getWithdrawableBalances(params: GetWithdrawableBalancesParams): Promise<WithdrawableBalance[] | undefined>;
|
|
@@ -267,6 +295,10 @@ export declare class PerpsClient {
|
|
|
267
295
|
*
|
|
268
296
|
* @throws {PerpsError} When the provider plugin is not registered, when it
|
|
269
297
|
* declares no portfolio history read, or when the venue read fails.
|
|
298
|
+
* @throws {PerpsError} `SetupRequired` when the venue needs a credential (a
|
|
299
|
+
* Lighter auth token or an Ondo session) and none is stored.
|
|
300
|
+
* @throws {PerpsError} `Unauthorized` when the venue rejects the credential.
|
|
301
|
+
* @throws {PerpsError} `AccountNotFound` when the wallet has no venue account.
|
|
270
302
|
* @public
|
|
271
303
|
*/
|
|
272
304
|
getPortfolioHistory(params: GetPortfolioHistoryParams, options?: SDKRequestOptions): Promise<PortfolioHistoryResponse>;
|
|
@@ -452,7 +484,7 @@ export declare class PerpsClient {
|
|
|
452
484
|
address: Address;
|
|
453
485
|
market: MarketRef;
|
|
454
486
|
action: 'add' | 'remove';
|
|
455
|
-
amount:
|
|
487
|
+
amount: DecimalString;
|
|
456
488
|
}): Promise<ExecuteActionResponse>;
|
|
457
489
|
/**
|
|
458
490
|
* Withdraw funds from the provider account. Convenience wrapper over
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PerpsCl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O,CAAA;QAChB,MAAM,EAAE,CAAC,CAAA;QACT,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,CAAA;QAC1B;sEAC8D;QAC9D,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,IAAI,CAAA;KACpD,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAKlC,uEAAuE;YACzD,SAAS;IAyDvB;;;;;;;;;;;;OAYG;IACG,gBAAgB,CACpB,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,qBAAqB,CAAC;IASjC;;;;;;;;OAQG;IACG,kBAAkB,CACtB,MAAM,EAAE,8BAA8B,GACrC,OAAO,CAAC,qBAAqB,CAAC;IASjC;;;;;;;;;;;;;;;OAeG;IACG,iBAAiB,CAAC,CAAC,SAAS,cAAc,EAC9C,MAAM,EAAE,uBAAuB,CAAC,CAAC,CAAC,GACjC,OAAO,CAAC,qBAAqB,CAAC;CA+ClC"}
|
|
@@ -8,48 +8,32 @@ import { type DecimalString } from '@lifi/perps-types';
|
|
|
8
8
|
* @public
|
|
9
9
|
*/
|
|
10
10
|
export type BaseUnitsRounding = 'truncate' | 'round';
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated Use `BaseUnitsRounding`. Removed in the next major.
|
|
13
|
-
*/
|
|
14
|
-
export type ScaleToIntegerPolicy = BaseUnitsRounding;
|
|
15
11
|
/**
|
|
16
12
|
* Scale a decimal string to a scaled integer in exact decimal arithmetic — an
|
|
17
13
|
* on-grid input maps to its exact scaled integer with no binary float
|
|
18
14
|
* artifacts (`'0.29'` at 2 decimals is 29, never 28). Off-grid input resolves
|
|
19
15
|
* per `rounding`; there is no silent default.
|
|
20
16
|
*
|
|
21
|
-
* @throws {PerpsError} `ValidationError` when `value` is not a
|
|
22
|
-
*
|
|
17
|
+
* @throws {PerpsError} `ValidationError` when `value` is not a
|
|
18
|
+
* {@link DecimalString}, `decimals` is not a non-negative integer, or the scaled
|
|
23
19
|
* result's magnitude exceeds `Number.MAX_SAFE_INTEGER`.
|
|
24
20
|
* @public
|
|
25
21
|
*/
|
|
26
22
|
export declare const decimalToBaseUnits: (value: DecimalString, decimals: number, rounding: BaseUnitsRounding) => number;
|
|
27
23
|
/**
|
|
28
|
-
*
|
|
29
|
-
*/
|
|
30
|
-
export declare const scaleToInteger: (value: DecimalString, decimals: number, rounding: BaseUnitsRounding) => number;
|
|
31
|
-
/**
|
|
32
|
-
* Convert a base-unit amount (bigint string) to a decimal string.
|
|
24
|
+
* Convert a base-unit amount (integer string) to a decimal string.
|
|
33
25
|
*
|
|
34
26
|
* @param amount - Amount in base units (e.g. "1000000" for 1 USDC)
|
|
35
27
|
* @param decimals - Token decimals (e.g. 6 for USDC)
|
|
36
|
-
* @
|
|
28
|
+
* @throws {PerpsError} `ValidationError` when `amount` is not an integer
|
|
29
|
+
* string, or `decimals` is not a non-negative integer.
|
|
37
30
|
* @example
|
|
38
31
|
* ```ts
|
|
39
32
|
* baseUnitsToDecimal('1000000', 6) // '1'
|
|
40
33
|
* ```
|
|
41
34
|
* @public
|
|
42
35
|
*/
|
|
43
|
-
export declare function baseUnitsToDecimal(amount:
|
|
44
|
-
/**
|
|
45
|
-
* @deprecated Use `baseUnitsToDecimal`. Removed in the next major.
|
|
46
|
-
*/
|
|
47
|
-
export declare const fromBaseUnits: typeof baseUnitsToDecimal;
|
|
48
|
-
/**
|
|
49
|
-
* @deprecated Compose `parseDecimal(baseUnitsToDecimal(...))`. Removed in the
|
|
50
|
-
* next major.
|
|
51
|
-
*/
|
|
52
|
-
export declare function fromBaseUnitsNumber(amount: string, decimals: number): number;
|
|
36
|
+
export declare function baseUnitsToDecimal(amount: DecimalString, decimals: number): DecimalString;
|
|
53
37
|
/**
|
|
54
38
|
* Round `value` down to `decimals` and pad the result to exactly that many
|
|
55
39
|
* decimal places. The padding is the point: this seeds a fixed-decimal input,
|
|
@@ -61,8 +45,8 @@ export declare function fromBaseUnitsNumber(amount: string, decimals: number): n
|
|
|
61
45
|
* float artifact: `'0.01'` at 18 decimals gives
|
|
62
46
|
* `'0.010000000000000000'`, which `Number#toFixed` cannot.
|
|
63
47
|
*
|
|
64
|
-
* @throws {PerpsError} `ValidationError` when `value` is not a
|
|
65
|
-
*
|
|
48
|
+
* @throws {PerpsError} `ValidationError` when `value` is not a
|
|
49
|
+
* {@link DecimalString}, or `decimals` is not a non-negative integer.
|
|
66
50
|
* @public
|
|
67
51
|
*/
|
|
68
52
|
export declare function truncateDecimal(value: DecimalString, decimals: number): DecimalString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../../src/decimal/convert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAkB,MAAM,mBAAmB,CAAA;AAMtE;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,OAAO,CAAA;AAEpD
|
|
1
|
+
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../../src/decimal/convert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAkB,MAAM,mBAAmB,CAAA;AAMtE;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,OAAO,CAAA;AAEpD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,GAC7B,OAAO,aAAa,EACpB,UAAU,MAAM,EAChB,UAAU,iBAAiB,KAC1B,MAiBF,CAAA;AAID;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,MAAM,GACf,aAAa,CAcf;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,MAAM,GACf,aAAa,CAaf;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CASlE"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DecimalString } from '@lifi/perps-types';
|
|
1
2
|
/**
|
|
2
3
|
* Options shared by the human-facing display formatters.
|
|
3
4
|
*
|
|
@@ -24,7 +25,7 @@ export interface FormatOptions {
|
|
|
24
25
|
* @public
|
|
25
26
|
*/
|
|
26
27
|
export type RoundingMode = 'halfUp' | 'floor';
|
|
27
|
-
type FormatInput = number | string | null | undefined;
|
|
28
|
+
type FormatInput = number | DecimalString | string | null | undefined;
|
|
28
29
|
/**
|
|
29
30
|
* Format a bare number, unsigned, with no currency symbol: `1,234.50`,
|
|
30
31
|
* `-1,500.00`, `0.00`. The core the `$`/`%` formatters wrap; use it for
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/decimal/format.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,mFAAmF;IACnF,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gFAAgF;IAChF,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAA;CACxB;AAED;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,OAAO,CAAA;AAI7C,KAAK,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/decimal/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEtD;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,mFAAmF;IACnF,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gFAAgF;IAChF,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAA;CACxB;AAED;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,OAAO,CAAA;AAI7C,KAAK,WAAW,GAAG,MAAM,GAAG,aAAa,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;AAyFrE;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,WAAW,EAClB,OAAO,GAAE,aAAkB,GAC1B,MAAM,CAaR;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,WAAW,EAClB,OAAO,GAAE,aAAkB,GAC1B,MAAM,CAaR;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,WAAW,EAClB,OAAO,GAAE,aAAkB,GAC1B,MAAM,CAaR;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,WAAW,EAClB,OAAO,GAAE,aAAkB,GAC1B,MAAM,CAaR;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,WAAW,EAClB,OAAO,GAAE,aAAkB,GAC1B,MAAM,CAqBR;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,WAAW,EAClB,OAAO,GAAE,aAAkB,GAC1B,MAAM,CAkBR"}
|
|
@@ -1,22 +1,4 @@
|
|
|
1
|
-
import type
|
|
2
|
-
/**
|
|
3
|
-
* Parse a string to a float, stripping common formatting artefacts.
|
|
4
|
-
*
|
|
5
|
-
* Handles:
|
|
6
|
-
* - Currency prefixes/suffixes ($, USD, etc.)
|
|
7
|
-
* - Explicit sign prefixes (+/-)
|
|
8
|
-
* - Thousands separators (commas)
|
|
9
|
-
* - Percentage suffixes (%)
|
|
10
|
-
* - Whitespace
|
|
11
|
-
*
|
|
12
|
-
* @returns Parsed number; `0` for empty/blank input, `NaN` when a non-empty
|
|
13
|
-
* string contains no parseable number
|
|
14
|
-
*/
|
|
15
|
-
declare function toFloat(value: string): number;
|
|
16
|
-
/**
|
|
17
|
-
* @deprecated Use `parseDecimal`. Removed in the next major.
|
|
18
|
-
*/
|
|
19
|
-
export declare const stringToFloat: typeof toFloat;
|
|
1
|
+
import { type DecimalString } from '@lifi/perps-types';
|
|
20
2
|
/**
|
|
21
3
|
* Parse an optional decimal field, tolerating currency symbols, grouping
|
|
22
4
|
* separators and a percentage suffix around the number.
|
|
@@ -25,5 +7,10 @@ export declare const stringToFloat: typeof toFloat;
|
|
|
25
7
|
* @public
|
|
26
8
|
*/
|
|
27
9
|
export declare function parseDecimal(value: DecimalString | string | null | undefined): number | undefined;
|
|
28
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Narrows an unknown value to a {@link DecimalString}.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export declare function isDecimalString(value: unknown): value is DecimalString;
|
|
29
16
|
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../src/decimal/parse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../src/decimal/parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAA;AA6BvE;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,aAAa,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAC/C,MAAM,GAAG,SAAS,CAYpB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAEtE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type DecimalString } from '@lifi/perps-types';
|
|
2
2
|
import Big from 'big.js';
|
|
3
3
|
/**
|
|
4
|
-
* Parse a
|
|
4
|
+
* Parse a decimal input, naming the field it came from when the
|
|
5
5
|
* value breaks the {@link DecimalString} contract, so a malformed amount
|
|
6
6
|
* fails at the SDK boundary instead of inside big.js.
|
|
7
7
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requireDecimal.d.ts","sourceRoot":"","sources":["../../../src/decimal/requireDecimal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAkB,MAAM,mBAAmB,CAAA;AACtE,OAAO,GAAG,MAAM,QAAQ,CAAA;AAIxB;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,CAQvE"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -10,17 +10,17 @@ export * from '@lifi/perps-types';
|
|
|
10
10
|
export { createPerpsClient, DEFAULT_API_URL, } from './client/createPerpsClient.js';
|
|
11
11
|
export { PerpsClient } from './client/PerpsClient.js';
|
|
12
12
|
export { requireProvider } from './client/requireProvider.js';
|
|
13
|
-
export type { BaseUnitsRounding
|
|
14
|
-
export { baseUnitsToDecimal, decimalToBaseUnits,
|
|
13
|
+
export type { BaseUnitsRounding } from './decimal/convert.js';
|
|
14
|
+
export { baseUnitsToDecimal, decimalToBaseUnits, numberToDecimalString, truncateDecimal, } from './decimal/convert.js';
|
|
15
15
|
export type { FormatOptions, RoundingMode } from './decimal/format.js';
|
|
16
16
|
export { formatCompactUsd, formatNumber, formatPrice, formatSignedPercent, formatSignedUsd, formatUsd, } from './decimal/format.js';
|
|
17
|
-
export {
|
|
17
|
+
export { isDecimalString, parseDecimal } from './decimal/parse.js';
|
|
18
18
|
export { PerpsErrorMessage } from './errors/constants.js';
|
|
19
19
|
export { PerpsError } from './errors/PerpsError.js';
|
|
20
20
|
export { classifyFill, classifyFillFromPosition, FillClassification, } from './math/fills.js';
|
|
21
21
|
export type { ExpectedPnl } from './math/order.js';
|
|
22
|
-
export { applySlippage, buildQuote, calculateExpectedPnl,
|
|
23
|
-
export { calculateEffectiveLeverage, calculateLiquidationDistance, calculateNotionalValue, calculateRealizedPnl, calculateRequiredMargin, calculateRoe, calculateUnrealizedPnl,
|
|
22
|
+
export { applySlippage, buildQuote, calculateExpectedPnl, calculateRealizedPnlPercent, calculateSize, calculateTriggerPercent, calculateTriggerPrice, estimateFees, estimateRealizedPnl, findMatchingPosition, resolveCloseSize, walkOrderbook, } from './math/order.js';
|
|
23
|
+
export { calculateEffectiveLeverage, calculateLiquidationDistance, calculateNotionalValue, calculateRealizedPnl, calculateRequiredMargin, calculateRoe, calculateUnrealizedPnl, estimateAverageEntryPrice, estimateLiquidationPrice, estimateNewLeverage, estimateUnrealizedPnl, positionSupportsMarginAdjustment, positionSupportsMarginRemoval, wouldImmediatelyLiquidate, } from './math/position.js';
|
|
24
24
|
export { AssetRegistry, getAssetRegistry, toAssetDisplay, } from './registry/assetRegistry.js';
|
|
25
25
|
export type { DefaultMarketProvider } from './registry/marketRegistry.js';
|
|
26
26
|
export { DEFAULT_MARKET_ID, getDefaultMarketId, getMarketRegistry, isActiveMarket, MarketRegistry, toMarketDisplay, toPerpsMarketDisplay, } from './registry/marketRegistry.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,cAAc,mBAAmB,CAAA;AACjC,OAAO,EACL,iBAAiB,EACjB,eAAe,GAChB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,cAAc,mBAAmB,CAAA;AACjC,OAAO,EACL,iBAAiB,EACjB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uB,GACxB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAC5D,YAAY,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAA;AACxF,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAA;AAC5E,YAAY,EACV,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,UAAU,EACV,gBAAgB,GACjB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,6BAA6B,EAC7B,cAAc,GACf,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAC5C,YAAY,EACV,YAAY,EACZ,iBAAiB,GAClB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FillClassification, OrderSide } from '@lifi/perps-types';
|
|
1
|
+
import { type DecimalString, FillClassification, OrderSide } from '@lifi/perps-types';
|
|
2
2
|
/**
|
|
3
3
|
* Re-exported fill taxonomy used by {@link classifyFillFromPosition}.
|
|
4
4
|
*
|
|
@@ -15,12 +15,12 @@ export { FillClassification };
|
|
|
15
15
|
* @param sz Unsigned fill size, parsed with `parseFloat`.
|
|
16
16
|
* @public
|
|
17
17
|
*/
|
|
18
|
-
export declare function classifyFillFromPosition(startPosition:
|
|
18
|
+
export declare function classifyFillFromPosition(startPosition: DecimalString, side: string, sz: DecimalString): FillClassification;
|
|
19
19
|
/**
|
|
20
20
|
* Classify a fill as open or close based on realizedPnl.
|
|
21
21
|
* @deprecated Use `Fill.classification` instead — it uses startPosition
|
|
22
22
|
* for accurate open/increase/reduce/close/reverse classification.
|
|
23
23
|
* @public
|
|
24
24
|
*/
|
|
25
|
-
export declare function classifyFill(side: OrderSide, realizedPnl:
|
|
25
|
+
export declare function classifyFill(side: OrderSide, realizedPnl: DecimalString | null | undefined): FillClassification;
|
|
26
26
|
//# sourceMappingURL=fills.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fills.d.ts","sourceRoot":"","sources":["../../../src/math/fills.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"fills.d.ts","sourceRoot":"","sources":["../../../src/math/fills.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,kBAAkB,EAClB,SAAS,EACV,MAAM,mBAAmB,CAAA;AAG1B;;;;GAIG;AACH,OAAO,EAAE,kBAAkB,EAAE,CAAA;AAE7B;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,aAAa,GAChB,kBAAkB,CAkCpB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,SAAS,EACf,WAAW,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,GAC5C,kBAAkB,CAUpB"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Display-tier order formulas. Every function takes and gives `number`;
|
|
3
3
|
* exact decimal arithmetic happens internally with `DivBig`.
|
|
4
4
|
*/
|
|
5
|
-
import { type FeeTier, type Market, type MarketContext, type Order, type OrderbookLevel, type Position, type Quote, type QuoteSide, type
|
|
5
|
+
import { type FeeTier, type Market, type MarketContext, type Order, type OrderbookLevel, type Position, type Quote, type QuoteSide, type TradeType } from '@lifi/perps-types';
|
|
6
6
|
/**
|
|
7
7
|
* Calculate position size in asset units from margin.
|
|
8
8
|
*
|
|
@@ -17,10 +17,6 @@ import { type FeeTier, type Market, type MarketContext, type Order, type Orderbo
|
|
|
17
17
|
* @public
|
|
18
18
|
*/
|
|
19
19
|
export declare function calculateSize(marginUsd: number, leverage: number, price: number): number;
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated Use `calculateSize`. Removed in the next major.
|
|
22
|
-
*/
|
|
23
|
-
export declare const calculatePositionSize: typeof calculateSize;
|
|
24
20
|
/**
|
|
25
21
|
* Estimate trading fees.
|
|
26
22
|
*
|
|
@@ -73,10 +69,6 @@ export declare function calculateExpectedPnl(triggerPrice: number, entryPrice: n
|
|
|
73
69
|
* @public
|
|
74
70
|
*/
|
|
75
71
|
export declare function calculateTriggerPrice(percent: number, entryPrice: number, leverage: number, isLong: boolean): number;
|
|
76
|
-
/**
|
|
77
|
-
* @deprecated Use `calculateTriggerPrice`. Removed in the next major.
|
|
78
|
-
*/
|
|
79
|
-
export declare const priceFromPercent: typeof calculateTriggerPrice;
|
|
80
72
|
/**
|
|
81
73
|
* Calculate the percentage gain/loss a trigger price realises.
|
|
82
74
|
*
|
|
@@ -87,10 +79,6 @@ export declare const priceFromPercent: typeof calculateTriggerPrice;
|
|
|
87
79
|
* @public
|
|
88
80
|
*/
|
|
89
81
|
export declare function calculateTriggerPercent(price: number, entryPrice: number, leverage: number, isLong: boolean): number;
|
|
90
|
-
/**
|
|
91
|
-
* @deprecated Use `calculateTriggerPercent`. Removed in the next major.
|
|
92
|
-
*/
|
|
93
|
-
export declare const percentFromPrice: typeof calculateTriggerPercent;
|
|
94
82
|
/**
|
|
95
83
|
* Calculate realized PnL as a percentage of position value at close.
|
|
96
84
|
*
|
|
@@ -149,7 +137,8 @@ interface BuildQuoteInput {
|
|
|
149
137
|
* the market's `funding` (`null` for spot, which has none).
|
|
150
138
|
*
|
|
151
139
|
* @throws {PerpsError} `ValidationError` when a book level does not parse to
|
|
152
|
-
* a finite number — see {@link walkOrderbook}
|
|
140
|
+
* a finite number — see {@link walkOrderbook} — or when a quoted figure is
|
|
141
|
+
* not finite (a non-finite `sizeUsd`, mark price or taker fee).
|
|
153
142
|
* @public
|
|
154
143
|
*/
|
|
155
144
|
export declare function buildQuote(input: BuildQuoteInput): Quote;
|
|
@@ -172,18 +161,6 @@ export declare function findMatchingPosition(marketId: string, positions: readon
|
|
|
172
161
|
* @public
|
|
173
162
|
*/
|
|
174
163
|
export declare function resolveCloseSize(orderSize: number, positionSize: number): number;
|
|
175
|
-
/**
|
|
176
|
-
* Expected rPnL for a resting limit order against a matching position.
|
|
177
|
-
*
|
|
178
|
-
* Reducing requires opposite sides (long position + SELL, short position +
|
|
179
|
-
* BUY). Same-side orders add to the position and have no rPnL → `null`.
|
|
180
|
-
* Projects `remainingSize`, because an already-filled quantity has realised
|
|
181
|
-
* its PnL at the fill price rather than at this order's limit price. A
|
|
182
|
-
* `remainingSize` of zero leaves nothing to project.
|
|
183
|
-
*/
|
|
184
|
-
declare function regularOrderRealizedPnl(order: RegularOrder, position: Position | undefined): number | null;
|
|
185
|
-
/** Project the unfilled closing quantity of an active trigger at its trigger price. */
|
|
186
|
-
declare function triggerOrderRealizedPnl(order: TriggerOrder, position: Position | undefined): number | null;
|
|
187
164
|
/**
|
|
188
165
|
* Expected rPnL an unfilled order would realise against a matching position:
|
|
189
166
|
* a resting limit order prices off its limit, an armed trigger off its trigger
|
|
@@ -195,13 +172,5 @@ declare function triggerOrderRealizedPnl(order: TriggerOrder, position: Position
|
|
|
195
172
|
* @public
|
|
196
173
|
*/
|
|
197
174
|
export declare function estimateRealizedPnl(order: Order, position: Position | undefined): number | null;
|
|
198
|
-
/**
|
|
199
|
-
* @deprecated Use `estimateRealizedPnl`. Removed in the next major.
|
|
200
|
-
*/
|
|
201
|
-
export declare const expectedRealizedPnlForOpenOrder: typeof regularOrderRealizedPnl;
|
|
202
|
-
/**
|
|
203
|
-
* @deprecated Use `estimateRealizedPnl`. Removed in the next major.
|
|
204
|
-
*/
|
|
205
|
-
export declare const expectedRealizedPnlForTriggerOrder: typeof triggerOrderRealizedPnl;
|
|
206
175
|
export {};
|
|
207
176
|
//# sourceMappingURL=order.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order.d.ts","sourceRoot":"","sources":["../../../src/math/order.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,KAAK,EACV,KAAK,cAAc,EAInB,KAAK,QAAQ,EAEb,KAAK,KAAK,EACV,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"order.d.ts","sourceRoot":"","sources":["../../../src/math/order.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,KAAK,EACV,KAAK,cAAc,EAInB,KAAK,QAAQ,EAEb,KAAK,KAAK,EACV,KAAK,SAAS,EAEd,KAAK,SAAS,EAEf,MAAM,mBAAmB,CAAA;AAY1B;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAC3B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACZ,MAAM,CAQR;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAKrE;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,EACb,eAAe,EAAE,MAAM,EACvB,KAAK,EAAE,OAAO,GACb,MAAM,CAYR;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAA;IACd,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,YA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ACtB,kFAAkF;IAClF,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,KAAK,CA+BxD;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,SAAS,QAAQ,EAAE,GAC7B,QAAQ,GAAG,SAAS,CAEtB;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,GACnB,MAAM,CAKR;AA0GD;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,GAAG,SAAS,GAC7B,MAAM,GAAG,IAAI,CAQf"}
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Display-tier position formulas
|
|
3
|
-
* exact decimal arithmetic happens
|
|
2
|
+
* Display-tier position formulas and margin-adjustment predicates. Every
|
|
3
|
+
* formula takes and gives `number`; exact decimal arithmetic happens
|
|
4
|
+
* internally with `DivBig`.
|
|
4
5
|
*
|
|
5
6
|
* Sign convention: long = +1, short = -1. Sizes passed to the `estimate*`
|
|
6
7
|
* helpers are always non-negative magnitudes; direction is carried by
|
|
7
8
|
* `isLong`.
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
|
-
* Direction sign for a position.
|
|
11
|
-
*
|
|
12
|
-
* @deprecated Inline `isLong ? 1 : -1`. Removed in the next major.
|
|
13
|
-
*/
|
|
14
|
-
export declare function directionSign(isLong: boolean): 1 | -1;
|
|
10
|
+
import { type Position } from '@lifi/perps-types';
|
|
15
11
|
/**
|
|
16
12
|
* Calculate notional value of a position.
|
|
17
13
|
*
|
|
@@ -62,10 +58,6 @@ export declare function calculateLiquidationDistance(params: {
|
|
|
62
58
|
liquidationPrice: number;
|
|
63
59
|
currentPrice: number;
|
|
64
60
|
}): number;
|
|
65
|
-
/**
|
|
66
|
-
* @deprecated Use `calculateLiquidationDistance`. Removed in the next major.
|
|
67
|
-
*/
|
|
68
|
-
export declare const liquidationDistancePercent: typeof calculateLiquidationDistance;
|
|
69
61
|
/**
|
|
70
62
|
* Effective leverage of an open position.
|
|
71
63
|
*
|
|
@@ -80,10 +72,6 @@ export declare function calculateEffectiveLeverage(params: {
|
|
|
80
72
|
positionValueUsd: number;
|
|
81
73
|
marginUsd: number;
|
|
82
74
|
}): number;
|
|
83
|
-
/**
|
|
84
|
-
* @deprecated Use `calculateEffectiveLeverage`. Removed in the next major.
|
|
85
|
-
*/
|
|
86
|
-
export declare const effectiveLeverage: typeof calculateEffectiveLeverage;
|
|
87
75
|
/**
|
|
88
76
|
* Estimated liquidation price for an isolated-margin position, parameterised
|
|
89
77
|
* by the venue's maintenance margin rate.
|
|
@@ -108,10 +96,6 @@ export declare function estimateLiquidationPrice(params: {
|
|
|
108
96
|
isLong: boolean;
|
|
109
97
|
maintenanceMarginRate: number;
|
|
110
98
|
}): number | undefined;
|
|
111
|
-
/**
|
|
112
|
-
* @deprecated Use `estimateLiquidationPrice`. Removed in the next major.
|
|
113
|
-
*/
|
|
114
|
-
export declare const estimateIsolatedLiquidationPrice: typeof estimateLiquidationPrice;
|
|
115
99
|
/**
|
|
116
100
|
* Whether an isolated position with this liquidation price is already past
|
|
117
101
|
* liquidation at `currentPrice`: a long liquidates when the price falls to its
|
|
@@ -147,10 +131,6 @@ export declare function estimateAverageEntryPrice(params: {
|
|
|
147
131
|
addSize: number;
|
|
148
132
|
fillPrice: number;
|
|
149
133
|
}): number | undefined;
|
|
150
|
-
/**
|
|
151
|
-
* @deprecated Use `estimateAverageEntryPrice`. Removed in the next major.
|
|
152
|
-
*/
|
|
153
|
-
export declare const predictAverageEntryPrice: typeof estimateAverageEntryPrice;
|
|
154
134
|
/**
|
|
155
135
|
* Estimated effective leverage after adding margin and notional.
|
|
156
136
|
*
|
|
@@ -168,10 +148,6 @@ export declare function estimateNewLeverage(params: {
|
|
|
168
148
|
addNotional: number;
|
|
169
149
|
addMargin: number;
|
|
170
150
|
}): number | undefined;
|
|
171
|
-
/**
|
|
172
|
-
* @deprecated Use `estimateNewLeverage`. Removed in the next major.
|
|
173
|
-
*/
|
|
174
|
-
export declare const predictNewLeverage: typeof estimateNewLeverage;
|
|
175
151
|
/**
|
|
176
152
|
* Estimated unrealised PnL at the current mark price.
|
|
177
153
|
*
|
|
@@ -186,10 +162,6 @@ export declare function estimateUnrealizedPnl(params: {
|
|
|
186
162
|
size: number;
|
|
187
163
|
isLong: boolean;
|
|
188
164
|
}): number;
|
|
189
|
-
/**
|
|
190
|
-
* @deprecated Use `estimateUnrealizedPnl`. Removed in the next major.
|
|
191
|
-
*/
|
|
192
|
-
export declare const predictUnrealizedPnl: typeof estimateUnrealizedPnl;
|
|
193
165
|
/**
|
|
194
166
|
* Realised PnL on the portion of a position being closed.
|
|
195
167
|
*
|
|
@@ -205,7 +177,17 @@ export declare function calculateRealizedPnl(params: {
|
|
|
205
177
|
isLong: boolean;
|
|
206
178
|
}): number;
|
|
207
179
|
/**
|
|
208
|
-
*
|
|
180
|
+
* Whether this position can take a margin adjustment at all: it holds margin of
|
|
181
|
+
* its own and its market exposes individual position margin.
|
|
182
|
+
*
|
|
183
|
+
* @public
|
|
184
|
+
*/
|
|
185
|
+
export declare function positionSupportsMarginAdjustment(position: Position): boolean;
|
|
186
|
+
/**
|
|
187
|
+
* Whether a removal is among the adjustments this position permits. An
|
|
188
|
+
* `ADD_ONLY` market takes adds and no withdrawal.
|
|
189
|
+
*
|
|
190
|
+
* @public
|
|
209
191
|
*/
|
|
210
|
-
export declare
|
|
192
|
+
export declare function positionSupportsMarginRemoval(position: Position): boolean;
|
|
211
193
|
//# sourceMappingURL=position.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../../src/math/position.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../../src/math/position.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAEL,KAAK,QAAQ,EAEd,MAAM,mBAAmB,CAAA;AAG1B;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAK1E;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,MAAM,GACX,MAAM,CAKR;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAQhE;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,GACf,MAAM,CAQR;AAED;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE;IACnD,gBAAgB,EAAE,MAAM,CAAA;IACxB,YAAY,EAAE,MAAM,CAAA;CACrB,GAAG,MAAM,CAMT;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE;IACjD,gBAAgB,EAAE,MAAM,CAAA;IACxB,SAAS,EAAE,MAAM,CAAA;CAClB,GAAG,MAAM,CAST;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE;IAC/C,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,OAAO,CAAA;IACf,qBAAqB,EAAE,MAAM,CAAA;CAC9B,GAAG,MAAM,GAAG,SAAS,CAqBrB;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE;IAChD,gBAAgB,EAAE,MAAM,CAAA;IACxB,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,OAAO,CAAA;CAChB,GAAG,OAAO,CAQV;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE;IAChD,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;CAClB,GAAG,MAAM,GAAG,SAAS,CAiBrB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE;IAC1C,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;CAClB,GAAG,MAAM,GAAG,SAAS,CAarB;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE;IAC5C,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,OAAO,CAAA;CAChB,GAAG,MAAM,CAUT;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAC3C,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,OAAO,CAAA;CAChB,GAAG,MAAM,CAUT;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAK5E;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAMzE"}
|
|
@@ -27,6 +27,10 @@ export interface GetActivityParams {
|
|
|
27
27
|
*
|
|
28
28
|
* @throws {PerpsError} When the provider plugin is not registered, or on
|
|
29
29
|
* backend / network / parsing errors.
|
|
30
|
+
* @throws {PerpsError} `SetupRequired` when the venue needs a credential (a
|
|
31
|
+
* Lighter auth token or an Ondo session) and none is stored.
|
|
32
|
+
* @throws {PerpsError} `Unauthorized` when the venue rejects the credential.
|
|
33
|
+
* @throws {PerpsError} `AccountNotFound` when the wallet has no venue account.
|
|
30
34
|
* @example
|
|
31
35
|
* ```ts
|
|
32
36
|
* const { items, pagination } = await getActivity(client, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getActivity.d.ts","sourceRoot":"","sources":["../../../src/services/getActivity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEnC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB,gEAAgE;IAChE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,YAAY,EAAE,CAAA;CACtB;AAED
|
|
1
|
+
{"version":3,"file":"getActivity.d.ts","sourceRoot":"","sources":["../../../src/services/getActivity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEnC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB,gEAAgE;IAChE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,YAAY,EAAE,CAAA;CACtB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,iBAAiB,EACzB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,kBAAkB,CAAC,CAY7B"}
|
|
@@ -26,6 +26,10 @@ export interface GetFillsParams {
|
|
|
26
26
|
*
|
|
27
27
|
* @throws {PerpsError} When the provider plugin is not registered, or on
|
|
28
28
|
* backend / network / parsing errors.
|
|
29
|
+
* @throws {PerpsError} `SetupRequired` when the venue needs a credential (a
|
|
30
|
+
* Lighter auth token or an Ondo session) and none is stored.
|
|
31
|
+
* @throws {PerpsError} `Unauthorized` when the venue rejects the credential.
|
|
32
|
+
* @throws {PerpsError} `AccountNotFound` when the wallet has no venue account.
|
|
29
33
|
* @example
|
|
30
34
|
* ```ts
|
|
31
35
|
* const { items, pagination } = await getFills(client, {
|