@lifi/perps-sdk 0.0.0-preview-7bd1054 → 0.0.0-preview-e927c9c
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/cjs/client/PerpsClient.d.ts.map +1 -1
- package/dist/cjs/client/PerpsClient.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/types/withdrawal.d.ts +5 -5
- package/dist/cjs/types/withdrawal.d.ts.map +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/client/PerpsClient.d.ts +37 -5
- 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/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/types/withdrawal.d.ts +5 -5
- package/dist/esm/types/withdrawal.d.ts.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/client/PerpsClient.d.ts +37 -5
- package/dist/types/client/PerpsClient.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/types/withdrawal.d.ts +5 -5
- package/dist/types/types/withdrawal.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/client/PerpsClient.ts +37 -5
- 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/types/withdrawal.ts +5 -10
- package/src/version.ts +1 -1
|
@@ -360,7 +360,14 @@ export class PerpsClient {
|
|
|
360
360
|
return resolveProvider(this.sdkClient, provider)
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
-
/**
|
|
363
|
+
/**
|
|
364
|
+
* Read active or historical orders from the selected venue.
|
|
365
|
+
*
|
|
366
|
+
* @throws {PerpsError} `SetupRequired` when the venue needs a credential (a
|
|
367
|
+
* Lighter auth token or an Ondo session) and none is stored.
|
|
368
|
+
* @throws {PerpsError} `Unauthorized` when the venue rejects the credential.
|
|
369
|
+
* @throws {PerpsError} `AccountNotFound` when the wallet has no venue account.
|
|
370
|
+
*/
|
|
364
371
|
async getOrders(
|
|
365
372
|
params: GetOrdersParams,
|
|
366
373
|
options?: SDKRequestOptions
|
|
@@ -368,7 +375,14 @@ export class PerpsClient {
|
|
|
368
375
|
return fetchOrders(this.sdkClient, params, options)
|
|
369
376
|
}
|
|
370
377
|
|
|
371
|
-
/**
|
|
378
|
+
/**
|
|
379
|
+
* Read one venue order through the provider's unified mapper.
|
|
380
|
+
*
|
|
381
|
+
* @throws {PerpsError} `SetupRequired` when the venue needs a credential (a
|
|
382
|
+
* Lighter auth token or an Ondo session) and none is stored.
|
|
383
|
+
* @throws {PerpsError} `Unauthorized` when the venue rejects the credential.
|
|
384
|
+
* @throws {PerpsError} `AccountNotFound` when the wallet has no venue account.
|
|
385
|
+
*/
|
|
372
386
|
async getOrder(
|
|
373
387
|
params: GetOrderParams,
|
|
374
388
|
options?: SDKRequestOptions
|
|
@@ -654,6 +668,9 @@ export class PerpsClient {
|
|
|
654
668
|
* @throws {PerpsError} When the provider plugin is not registered,
|
|
655
669
|
* `ValidationError` for a spot market, or any other `PerpsError` when the
|
|
656
670
|
* venue read fails or carries no usable value.
|
|
671
|
+
* @throws {PerpsError} `SetupRequired` when the venue needs a credential (an
|
|
672
|
+
* Ondo session) and none is stored.
|
|
673
|
+
* @throws {PerpsError} `Unauthorized` when the venue rejects the credential.
|
|
657
674
|
* @public
|
|
658
675
|
*/
|
|
659
676
|
async getMarketSettings(params: {
|
|
@@ -674,12 +691,19 @@ export class PerpsClient {
|
|
|
674
691
|
* account displays read the account-scoped
|
|
675
692
|
* {@link AccountSummary.availableMargin} instead.
|
|
676
693
|
*
|
|
677
|
-
* Providers that read a per-market figure answer it directly.
|
|
678
|
-
*
|
|
679
|
-
*
|
|
694
|
+
* Providers that read a per-market figure answer it directly. A provider
|
|
695
|
+
* that has no per-market figure for the market (a Hyperliquid or Lighter
|
|
696
|
+
* spot market) resolves `undefined`, and this falls back to the account
|
|
697
|
+
* summary, so both sides equal `availableMargin` and the asset is the
|
|
698
|
+
* market's quote asset. A provider read that throws propagates and never
|
|
699
|
+
* falls back.
|
|
680
700
|
*
|
|
681
701
|
* @throws {PerpsError} When the provider plugin is not registered, or the
|
|
682
702
|
* market is unknown to the provider's market registry.
|
|
703
|
+
* @throws {PerpsError} `SetupRequired` when the venue needs a credential (a
|
|
704
|
+
* Lighter auth token or an Ondo session) and none is stored.
|
|
705
|
+
* @throws {PerpsError} `Unauthorized` when the venue rejects the credential.
|
|
706
|
+
* @throws {PerpsError} `AccountNotFound` when the wallet has no venue account.
|
|
683
707
|
* @public
|
|
684
708
|
*/
|
|
685
709
|
async getAvailableToTrade(
|
|
@@ -813,6 +837,10 @@ export class PerpsClient {
|
|
|
813
837
|
* @throws {PerpsError} When the provider plugin is not registered, when
|
|
814
838
|
* either the plugin read or the asset sync fails, when a row's
|
|
815
839
|
* `withdrawalFee` is not a non-negative decimal.
|
|
840
|
+
* @throws {PerpsError} `SetupRequired` when the venue needs a credential (a
|
|
841
|
+
* Lighter auth token or an Ondo session) and none is stored.
|
|
842
|
+
* @throws {PerpsError} `Unauthorized` when the venue rejects the credential.
|
|
843
|
+
* @throws {PerpsError} `AccountNotFound` when the wallet has no venue account.
|
|
816
844
|
* @public
|
|
817
845
|
*/
|
|
818
846
|
async getWithdrawableBalances(
|
|
@@ -877,6 +905,10 @@ export class PerpsClient {
|
|
|
877
905
|
*
|
|
878
906
|
* @throws {PerpsError} When the provider plugin is not registered, when it
|
|
879
907
|
* declares no portfolio history read, or when the venue read fails.
|
|
908
|
+
* @throws {PerpsError} `SetupRequired` when the venue needs a credential (a
|
|
909
|
+
* Lighter auth token or an Ondo session) and none is stored.
|
|
910
|
+
* @throws {PerpsError} `Unauthorized` when the venue rejects the credential.
|
|
911
|
+
* @throws {PerpsError} `AccountNotFound` when the wallet has no venue account.
|
|
880
912
|
* @public
|
|
881
913
|
*/
|
|
882
914
|
async getPortfolioHistory(
|
|
@@ -30,6 +30,10 @@ export interface GetActivityParams {
|
|
|
30
30
|
*
|
|
31
31
|
* @throws {PerpsError} When the provider plugin is not registered, or on
|
|
32
32
|
* backend / network / parsing errors.
|
|
33
|
+
* @throws {PerpsError} `SetupRequired` when the venue needs a credential (a
|
|
34
|
+
* Lighter auth token or an Ondo session) and none is stored.
|
|
35
|
+
* @throws {PerpsError} `Unauthorized` when the venue rejects the credential.
|
|
36
|
+
* @throws {PerpsError} `AccountNotFound` when the wallet has no venue account.
|
|
33
37
|
* @example
|
|
34
38
|
* ```ts
|
|
35
39
|
* const { items, pagination } = await getActivity(client, {
|
package/src/services/getFills.ts
CHANGED
|
@@ -29,6 +29,10 @@ export interface GetFillsParams {
|
|
|
29
29
|
*
|
|
30
30
|
* @throws {PerpsError} When the provider plugin is not registered, or on
|
|
31
31
|
* backend / network / parsing errors.
|
|
32
|
+
* @throws {PerpsError} `SetupRequired` when the venue needs a credential (a
|
|
33
|
+
* Lighter auth token or an Ondo session) and none is stored.
|
|
34
|
+
* @throws {PerpsError} `Unauthorized` when the venue rejects the credential.
|
|
35
|
+
* @throws {PerpsError} `AccountNotFound` when the wallet has no venue account.
|
|
32
36
|
* @example
|
|
33
37
|
* ```ts
|
|
34
38
|
* const { items, pagination } = await getFills(client, {
|
package/src/services/getOrder.ts
CHANGED
|
@@ -23,6 +23,10 @@ export interface GetOrderParams {
|
|
|
23
23
|
*
|
|
24
24
|
* @throws {PerpsError} When the provider plugin is not registered, or on
|
|
25
25
|
* backend / network / parsing errors.
|
|
26
|
+
* @throws {PerpsError} `SetupRequired` when the venue needs a credential (a
|
|
27
|
+
* Lighter auth token or an Ondo session) and none is stored.
|
|
28
|
+
* @throws {PerpsError} `Unauthorized` when the venue rejects the credential.
|
|
29
|
+
* @throws {PerpsError} `AccountNotFound` when the wallet has no venue account.
|
|
26
30
|
* @example
|
|
27
31
|
* ```ts
|
|
28
32
|
* const order = await getOrder(client, {
|
|
@@ -22,7 +22,16 @@ export interface GetOrdersParams {
|
|
|
22
22
|
cursor?: string
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Read account orders with active lifecycle statuses as the default filter.
|
|
27
|
+
*
|
|
28
|
+
* @throws {PerpsError} When the provider plugin is not registered, or on
|
|
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.
|
|
34
|
+
*/
|
|
26
35
|
export async function getOrders(
|
|
27
36
|
client: PerpsSDKClient,
|
|
28
37
|
params: GetOrdersParams,
|
|
@@ -27,6 +27,10 @@ export interface GetPositionsParams {
|
|
|
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 { positions } = await getPositions(client, {
|
package/src/types/withdrawal.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
ActionType,
|
|
3
|
-
Asset,
|
|
4
|
-
DecimalString,
|
|
5
|
-
WithdrawalRoute,
|
|
6
|
-
} from '@lifi/perps-types'
|
|
1
|
+
import type { ActionType, Asset, WithdrawalRoute } from '@lifi/perps-types'
|
|
7
2
|
import type { Address } from 'viem'
|
|
8
3
|
|
|
9
4
|
export type { WithdrawalRoute }
|
|
@@ -19,13 +14,13 @@ export interface ProviderWithdrawableBalance {
|
|
|
19
14
|
assetId: string
|
|
20
15
|
route: WithdrawalRoute
|
|
21
16
|
/** Withdrawable amount in the asset's own units. Always greater than zero. */
|
|
22
|
-
available:
|
|
17
|
+
available: string
|
|
23
18
|
/**
|
|
24
19
|
* Flat venue fee on a withdrawal from this row, in the asset's own units.
|
|
25
20
|
* Absent when the venue publishes no fee for the asset. The client rejects
|
|
26
21
|
* a value that is not a non-negative decimal.
|
|
27
22
|
*/
|
|
28
|
-
withdrawalFee?:
|
|
23
|
+
withdrawalFee?: string
|
|
29
24
|
/**
|
|
30
25
|
* `true` when the venue takes `withdrawalFee` out of the requested amount,
|
|
31
26
|
* `false` when it charges the fee in addition. Set together with
|
|
@@ -45,7 +40,7 @@ export interface WithdrawableBalance {
|
|
|
45
40
|
asset: Asset
|
|
46
41
|
route: WithdrawalRoute
|
|
47
42
|
/** Withdrawable amount in the asset's own units. */
|
|
48
|
-
available:
|
|
43
|
+
available: string
|
|
49
44
|
/**
|
|
50
45
|
* Flat venue fee on a withdrawal from this row, in the asset's own units.
|
|
51
46
|
* Absent when the venue publishes no fee for the asset. With
|
|
@@ -56,7 +51,7 @@ export interface WithdrawableBalance {
|
|
|
56
51
|
* is zero or negative when the fee is at or above `available`, and the row
|
|
57
52
|
* then funds no withdrawal.
|
|
58
53
|
*/
|
|
59
|
-
withdrawalFee?:
|
|
54
|
+
withdrawalFee?: string
|
|
60
55
|
/**
|
|
61
56
|
* Present only together with `withdrawalFee`. Absent on a row from a
|
|
62
57
|
* provider plugin that does not report it; absence means unknown, not
|
package/src/version.ts
CHANGED