@lifi/perps-types 4.0.0 → 4.1.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/dist/cjs/account.d.ts.map +1 -1
- package/dist/cjs/action.d.ts +1 -0
- package/dist/cjs/action.d.ts.map +1 -1
- package/dist/cjs/asset.d.ts.map +1 -1
- package/dist/cjs/enums.d.ts.map +1 -1
- package/dist/cjs/enums.js.map +1 -1
- package/dist/cjs/errors.d.ts.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/market.d.ts.map +1 -1
- package/dist/cjs/positionMargin.d.ts +4 -0
- package/dist/cjs/positionMargin.d.ts.map +1 -0
- package/dist/cjs/positionMargin.js +15 -0
- package/dist/cjs/positionMargin.js.map +1 -0
- package/dist/cjs/primitives.d.ts.map +1 -1
- package/dist/cjs/providers.d.ts.map +1 -1
- package/dist/cjs/subscriptions.d.ts.map +1 -1
- package/dist/cjs/typedData.d.ts.map +1 -1
- package/dist/cjs/vote.d.ts.map +1 -1
- package/dist/cjs/vote.js.map +1 -1
- package/dist/esm/account.d.ts +194 -31
- package/dist/esm/account.d.ts.map +1 -1
- package/dist/esm/action.d.ts +205 -37
- package/dist/esm/action.d.ts.map +1 -1
- package/dist/esm/asset.d.ts +1 -4
- package/dist/esm/asset.d.ts.map +1 -1
- package/dist/esm/enums.d.ts +34 -20
- package/dist/esm/enums.d.ts.map +1 -1
- package/dist/esm/enums.js +33 -19
- package/dist/esm/enums.js.map +1 -1
- package/dist/esm/errors.d.ts +6 -1
- package/dist/esm/errors.d.ts.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/market.d.ts +47 -14
- package/dist/esm/market.d.ts.map +1 -1
- package/dist/esm/positionMargin.d.ts +16 -0
- package/dist/esm/positionMargin.d.ts.map +1 -0
- package/dist/esm/positionMargin.js +23 -0
- package/dist/esm/positionMargin.js.map +1 -0
- package/dist/esm/primitives.d.ts +12 -2
- package/dist/esm/primitives.d.ts.map +1 -1
- package/dist/esm/providers.d.ts +19 -6
- package/dist/esm/providers.d.ts.map +1 -1
- package/dist/esm/quote.d.ts +2 -2
- package/dist/esm/quote.d.ts.map +1 -1
- package/dist/esm/subscriptions.d.ts +27 -19
- package/dist/esm/subscriptions.d.ts.map +1 -1
- package/dist/esm/typedData.d.ts +15 -5
- package/dist/esm/typedData.d.ts.map +1 -1
- package/dist/esm/vote.d.ts +1 -3
- package/dist/esm/vote.d.ts.map +1 -1
- package/dist/esm/vote.js.map +1 -1
- package/dist/types/account.d.ts +194 -31
- package/dist/types/account.d.ts.map +1 -1
- package/dist/types/action.d.ts +205 -37
- package/dist/types/action.d.ts.map +1 -1
- package/dist/types/asset.d.ts +1 -4
- package/dist/types/asset.d.ts.map +1 -1
- package/dist/types/enums.d.ts +34 -20
- package/dist/types/enums.d.ts.map +1 -1
- package/dist/types/errors.d.ts +6 -1
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/market.d.ts +47 -14
- package/dist/types/market.d.ts.map +1 -1
- package/dist/types/positionMargin.d.ts +16 -0
- package/dist/types/positionMargin.d.ts.map +1 -0
- package/dist/types/primitives.d.ts +12 -2
- package/dist/types/primitives.d.ts.map +1 -1
- package/dist/types/providers.d.ts +19 -6
- package/dist/types/providers.d.ts.map +1 -1
- package/dist/types/quote.d.ts +2 -2
- package/dist/types/quote.d.ts.map +1 -1
- package/dist/types/subscriptions.d.ts +27 -19
- package/dist/types/subscriptions.d.ts.map +1 -1
- package/dist/types/typedData.d.ts +15 -5
- package/dist/types/typedData.d.ts.map +1 -1
- package/dist/types/vote.d.ts +1 -3
- package/dist/types/vote.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/account.ts +194 -36
- package/src/action.ts +205 -37
- package/src/asset.ts +1 -4
- package/src/enums.ts +34 -20
- package/src/errors.ts +6 -1
- package/src/index.ts +1 -0
- package/src/market.ts +47 -14
- package/src/positionMargin.ts +29 -0
- package/src/primitives.ts +12 -2
- package/src/providers.ts +19 -6
- package/src/quote.ts +2 -2
- package/src/subscriptions.ts +27 -19
- package/src/typedData.ts +15 -5
- package/src/vote.ts +1 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../../src/subscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,OAAO,EACP,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,YAAY,EACb,MAAM,cAAc,CAAA;AACrB,OAAO,KAAK,EACV,MAAM,EACN,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,KAAK,EACN,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAE9C
|
|
1
|
+
{"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../../src/subscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,OAAO,EACP,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,YAAY,EACb,MAAM,cAAc,CAAA;AACrB,OAAO,KAAK,EACV,MAAM,EACN,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,KAAK,EACN,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAE9C,+EAA+E;AAC/E,MAAM,MAAM,0BAA0B,GAAG;IACvC,OAAO,EAAE,gBAAgB,CAAA;IACzB,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AACD,iEAAiE;AACjE,MAAM,MAAM,yBAAyB,GAAG;IACtC,OAAO,EAAE,eAAe,CAAA;IACxB,GAAG,EAAE,MAAM,CAA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AAChE,MAAM,MAAM,UAAU,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,IAAI,EAAE,CAAA;CAAE,CAAA;AAC3D;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG;IAAE,OAAO,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,QAAQ,EAAE,CAAA;CAAE,CAAA;AACvE;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,cAAc,CAAA;IACvB,IAAI,EAAE,CAAC,OAAO,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAA;CACvC,CAAA;AAED;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,gBAAgB,CAAA;IACzB,IAAI,EAAE,cAAc,CAAA;CACrB,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GACzB,mBAAmB,GACnB,kBAAkB,GAClB,cAAc,GACd,WAAW,GACX,WAAW,GACX,iBAAiB,GACjB,UAAU,GACV,cAAc,GACd,iBAAiB,GACjB,mBAAmB,CAAA"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { Address, Hex } from './primitives.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* EIP-712 domain fields used to identify a signing domain. `chainId` is the
|
|
4
|
+
* numeric EVM chain id when present.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
3
8
|
export interface TypedDataDomain {
|
|
4
9
|
name?: string;
|
|
5
10
|
version?: string;
|
|
@@ -7,21 +12,26 @@ export interface TypedDataDomain {
|
|
|
7
12
|
verifyingContract?: Address;
|
|
8
13
|
salt?: Hex;
|
|
9
14
|
}
|
|
10
|
-
/** @public */
|
|
15
|
+
/** One named field in an EIP-712 primary type definition. @public */
|
|
11
16
|
export interface TypedDataParameter {
|
|
12
17
|
name: string;
|
|
13
18
|
type: string;
|
|
14
19
|
}
|
|
15
|
-
/** @public */
|
|
20
|
+
/** Primary-type name used by a perps EIP-712 payload. @public */
|
|
16
21
|
export type PerpsPrimaryType = string;
|
|
17
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Provider-neutral EIP-712 payload passed between backend and SDK. `message`
|
|
24
|
+
* intentionally remains open because each action defines its own fields.
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
18
28
|
export type PerpsTypedData = {
|
|
19
29
|
domain: TypedDataDomain;
|
|
20
30
|
types: Record<string, readonly TypedDataParameter[]>;
|
|
21
31
|
primaryType: PerpsPrimaryType;
|
|
22
32
|
message: Record<string, any>;
|
|
23
33
|
};
|
|
24
|
-
/** @public */
|
|
34
|
+
/** EIP-712 payload accompanied by its client-produced signature. @public */
|
|
25
35
|
export type PerpsSignedTypedData = PerpsTypedData & {
|
|
26
36
|
signature: Hex;
|
|
27
37
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typedData.d.ts","sourceRoot":"","sources":["../../src/typedData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AAEnD
|
|
1
|
+
{"version":3,"file":"typedData.d.ts","sourceRoot":"","sources":["../../src/typedData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AAEnD;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,IAAI,CAAC,EAAE,GAAG,CAAA;CACX;AAED,qEAAqE;AACrE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb;AAED,iEAAiE;AACjE,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAA;AAErC;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,eAAe,CAAA;IACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,kBAAkB,EAAE,CAAC,CAAA;IACpD,WAAW,EAAE,gBAAgB,CAAA;IAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC7B,CAAA;AAED,4EAA4E;AAC5E,MAAM,MAAM,oBAAoB,GAAG,cAAc,GAAG;IAClD,SAAS,EAAE,GAAG,CAAA;CACf,CAAA"}
|
package/dist/types/vote.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { PerpsTypedData, TypedDataParameter } from './typedData.js';
|
|
|
7
7
|
* @public
|
|
8
8
|
*/
|
|
9
9
|
export declare const META_PROVIDER = "meta";
|
|
10
|
-
/** @public */
|
|
10
|
+
/** Type alias for the {@link META_PROVIDER} provider-independent sentinel. @public */
|
|
11
11
|
export type MetaProvider = typeof META_PROVIDER;
|
|
12
12
|
/**
|
|
13
13
|
* Vote direction. `up` endorses the subject; `down` opposes it.
|
|
@@ -29,7 +29,6 @@ export type VoteType = 'provider';
|
|
|
29
29
|
* @public
|
|
30
30
|
*/
|
|
31
31
|
export interface VoteParams {
|
|
32
|
-
/** Key of the inactive provider being voted on (the voted-on subject). */
|
|
33
32
|
targetProvider: string;
|
|
34
33
|
direction: VoteDirection;
|
|
35
34
|
voteType: VoteType;
|
|
@@ -39,7 +38,6 @@ export interface VoteParams {
|
|
|
39
38
|
* @public
|
|
40
39
|
*/
|
|
41
40
|
export interface VoteMessage {
|
|
42
|
-
/** Key of the inactive provider being voted on. */
|
|
43
41
|
targetProvider: string;
|
|
44
42
|
direction: VoteDirection;
|
|
45
43
|
voteType: VoteType;
|
package/dist/types/vote.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vote.d.ts","sourceRoot":"","sources":["../../src/vote.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAExE;;;;;GAKG;AACH,eAAO,MAAM,aAAa,SAAS,CAAA;AAEnC,
|
|
1
|
+
{"version":3,"file":"vote.d.ts","sourceRoot":"","sources":["../../src/vote.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAExE;;;;;GAKG;AACH,eAAO,MAAM,aAAa,SAAS,CAAA;AAEnC,sFAAsF;AACtF,MAAM,MAAM,YAAY,GAAG,OAAO,aAAa,CAAA;AAE/C;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,MAAM,CAAA;AAEzC;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAA;AAEjC;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IACzB,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,aAAa,CAAA;IACxB,QAAQ,EAAE,QAAQ,CAAA;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,aAAa,CAAA;IACxB,QAAQ,EAAE,QAAQ,CAAA;IAClB,KAAK,EAAE,OAAO,CAAA;IACd,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,kBAAkB,EAMvD,CAAA;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAc,SAAQ,cAAc;IACnD,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE;QAAE,IAAI,EAAE,SAAS,kBAAkB,EAAE,CAAA;KAAE,GAAG,cAAc,CAAC,OAAO,CAAC,CAAA;IACxE,OAAO,EAAE,WAAW,CAAA;CACrB"}
|
package/package.json
CHANGED
package/src/account.ts
CHANGED
|
@@ -13,23 +13,44 @@ import type {
|
|
|
13
13
|
import type { MarketDisplay, PerpsMarketDisplay } from './market.js'
|
|
14
14
|
import type { Address } from './primitives.js'
|
|
15
15
|
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Maker and taker fee rates for the account's current venue tier.
|
|
18
|
+
* Values are decimal fractions represented as strings (for example, `"0.0002"`).
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
17
22
|
export interface FeeTier {
|
|
23
|
+
/** Decimal fraction charged to maker fills, represented as a string. */
|
|
18
24
|
maker: string
|
|
25
|
+
/** Decimal fraction charged to taker fills, represented as a string. */
|
|
19
26
|
taker: string
|
|
20
27
|
}
|
|
21
28
|
|
|
22
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Normalized open perpetual position with prices, margin, and PnL expressed as
|
|
31
|
+
* decimal strings to preserve provider precision.
|
|
32
|
+
*
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
23
35
|
export interface Position {
|
|
24
36
|
market: PerpsMarketDisplay
|
|
25
37
|
side: PositionSide
|
|
38
|
+
/** Position quantity in base-asset units. */
|
|
26
39
|
size: string
|
|
40
|
+
/** Average entry price in quote-asset units. */
|
|
27
41
|
entryPrice: string
|
|
42
|
+
/** Current provider mark price in quote-asset units. */
|
|
28
43
|
markPrice: string
|
|
44
|
+
/** Estimated liquidation price in quote-asset units. */
|
|
29
45
|
liquidationPrice: string
|
|
46
|
+
/** Unrealized PnL in quote-currency units. */
|
|
30
47
|
unrealizedPnl: string
|
|
48
|
+
/** Position leverage as a numeric multiple. */
|
|
31
49
|
leverage: number
|
|
32
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* Margin allocated and reserved by this position as a decimal string,
|
|
52
|
+
* excluding unrealized PnL.
|
|
53
|
+
*/
|
|
33
54
|
marginUsed: string
|
|
34
55
|
/**
|
|
35
56
|
* Exact initial margin the venue currently requires for this position.
|
|
@@ -52,21 +73,34 @@ export interface PositionMarginConstraints {
|
|
|
52
73
|
amountIncrement: string
|
|
53
74
|
}
|
|
54
75
|
|
|
55
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* Normalized non-trigger order currently open at a provider.
|
|
78
|
+
*
|
|
79
|
+
* @public
|
|
80
|
+
*/
|
|
56
81
|
export interface OpenOrder {
|
|
57
82
|
orderId: string
|
|
58
83
|
market: MarketDisplay
|
|
59
84
|
side: OrderSide
|
|
60
85
|
type: OrderType
|
|
86
|
+
/** Remaining order quantity in base-asset units. */
|
|
61
87
|
size: string
|
|
88
|
+
/** Limit/order price in quote-asset units. */
|
|
62
89
|
price: string
|
|
90
|
+
/** Quantity already filled in base-asset units. */
|
|
63
91
|
filledSize: string
|
|
64
92
|
reduceOnly: boolean
|
|
65
93
|
label?: string
|
|
94
|
+
/** ISO-8601 creation timestamp. */
|
|
66
95
|
createdAt: string
|
|
67
96
|
}
|
|
68
97
|
|
|
69
|
-
/**
|
|
98
|
+
/**
|
|
99
|
+
* Asset balance normalized across providers. `units` and `valueUsd` are
|
|
100
|
+
* decimal strings; `valueUsd` is the balance's USD valuation.
|
|
101
|
+
*
|
|
102
|
+
* @public
|
|
103
|
+
*/
|
|
70
104
|
export interface Balance {
|
|
71
105
|
/** Which category/venue this balance sits in — references a {@link ProviderCategory}. */
|
|
72
106
|
categoryId: string
|
|
@@ -82,7 +116,12 @@ export interface Balance {
|
|
|
82
116
|
collateralWeight?: number
|
|
83
117
|
}
|
|
84
118
|
|
|
85
|
-
/**
|
|
119
|
+
/**
|
|
120
|
+
* Account snapshot returned by a provider, including balances, positions,
|
|
121
|
+
* aggregate margin/PnL, and provider-specific configuration.
|
|
122
|
+
*
|
|
123
|
+
* @public
|
|
124
|
+
*/
|
|
86
125
|
export interface AccountResponse {
|
|
87
126
|
provider: string
|
|
88
127
|
address: Address
|
|
@@ -92,17 +131,28 @@ export interface AccountResponse {
|
|
|
92
131
|
collateralBalances: Balance[]
|
|
93
132
|
/** Open positions the snapshot already computed; equals the unfiltered `getPositions` output. */
|
|
94
133
|
positions: Position[]
|
|
134
|
+
/** Margin reserved across the account, represented as a decimal string. */
|
|
95
135
|
marginUsed: string
|
|
136
|
+
/** Unrealized account PnL, represented as a decimal string. */
|
|
96
137
|
unrealizedPnl: string
|
|
97
138
|
feeTier: FeeTier
|
|
98
139
|
config: AccountConfig
|
|
99
140
|
}
|
|
100
141
|
|
|
101
|
-
/**
|
|
142
|
+
/**
|
|
143
|
+
* Aggregate account values for a provider stream or response. Monetary values
|
|
144
|
+
* are decimal strings in USD.
|
|
145
|
+
*
|
|
146
|
+
* @public
|
|
147
|
+
*/
|
|
102
148
|
export interface AccountSummary {
|
|
149
|
+
/** Total account portfolio value in USD. */
|
|
103
150
|
portfolioValue: string
|
|
151
|
+
/** Margin currently available for new orders in USD. */
|
|
104
152
|
availableMargin: string
|
|
153
|
+
/** Margin currently reserved by open positions/orders in USD. */
|
|
105
154
|
marginUsed: string
|
|
155
|
+
/** Aggregate unrealized PnL in USD. */
|
|
106
156
|
unrealizedPnl: string
|
|
107
157
|
}
|
|
108
158
|
|
|
@@ -117,26 +167,41 @@ export interface MarketSettings {
|
|
|
117
167
|
leverage: number
|
|
118
168
|
}
|
|
119
169
|
|
|
120
|
-
/**
|
|
170
|
+
/**
|
|
171
|
+
* Normalized take-profit or stop-loss order waiting for its trigger condition.
|
|
172
|
+
*
|
|
173
|
+
* @public
|
|
174
|
+
*/
|
|
121
175
|
export interface TriggerOrder {
|
|
122
176
|
orderId: string
|
|
123
177
|
market: MarketDisplay
|
|
124
178
|
type: OrderType
|
|
179
|
+
/** Triggered quantity in base-asset units. */
|
|
125
180
|
size: string
|
|
181
|
+
/** Price at which the trigger activates, in quote-asset units. */
|
|
126
182
|
triggerPrice: string
|
|
183
|
+
/** Optional limit price submitted after activation, in quote-asset units. */
|
|
127
184
|
limitPrice?: string
|
|
128
185
|
label?: string
|
|
129
186
|
createdAt: string
|
|
130
187
|
}
|
|
131
188
|
|
|
132
|
-
/**
|
|
189
|
+
/**
|
|
190
|
+
* Paginated open-position response for one provider and account.
|
|
191
|
+
*
|
|
192
|
+
* @public
|
|
193
|
+
*/
|
|
133
194
|
export interface PositionsResponse {
|
|
134
195
|
provider: string
|
|
135
196
|
positions: Position[]
|
|
136
197
|
pagination: Pagination
|
|
137
198
|
}
|
|
138
199
|
|
|
139
|
-
/**
|
|
200
|
+
/**
|
|
201
|
+
* Paginated open-order response containing regular and trigger orders.
|
|
202
|
+
*
|
|
203
|
+
* @public
|
|
204
|
+
*/
|
|
140
205
|
export interface OrdersResponse {
|
|
141
206
|
provider: string
|
|
142
207
|
openOrders: OpenOrder[]
|
|
@@ -144,7 +209,11 @@ export interface OrdersResponse {
|
|
|
144
209
|
pagination: Pagination
|
|
145
210
|
}
|
|
146
211
|
|
|
147
|
-
/**
|
|
212
|
+
/**
|
|
213
|
+
* Normalized execution/fill record for an order.
|
|
214
|
+
*
|
|
215
|
+
* @public
|
|
216
|
+
*/
|
|
148
217
|
export interface Fill {
|
|
149
218
|
id: string
|
|
150
219
|
orderId: string
|
|
@@ -166,12 +235,17 @@ export interface Fill {
|
|
|
166
235
|
startPosition?: string
|
|
167
236
|
classification: FillClassification
|
|
168
237
|
createdAt: string
|
|
169
|
-
|
|
170
|
-
|
|
238
|
+
/** Fully-resolved block-explorer URL for the settling on-chain tx. Absent when
|
|
239
|
+
* the fill has no on-chain settlement tx. */
|
|
171
240
|
explorerLink?: string
|
|
172
241
|
}
|
|
173
242
|
|
|
174
|
-
/**
|
|
243
|
+
/**
|
|
244
|
+
* Cursor pagination metadata. `cursor` and `nextUrl` are provider-specific
|
|
245
|
+
* continuation values and are absent when no further page exists.
|
|
246
|
+
*
|
|
247
|
+
* @public
|
|
248
|
+
*/
|
|
175
249
|
export interface Pagination {
|
|
176
250
|
limit: number
|
|
177
251
|
hasMore: boolean
|
|
@@ -179,44 +253,70 @@ export interface Pagination {
|
|
|
179
253
|
nextUrl?: string
|
|
180
254
|
}
|
|
181
255
|
|
|
182
|
-
/**
|
|
256
|
+
/**
|
|
257
|
+
* Paginated fill response for one provider and account.
|
|
258
|
+
*
|
|
259
|
+
* @public
|
|
260
|
+
*/
|
|
183
261
|
export interface FillsResponse {
|
|
184
262
|
provider: string
|
|
185
263
|
items: Fill[]
|
|
186
264
|
pagination: Pagination
|
|
187
265
|
}
|
|
188
266
|
|
|
189
|
-
/**
|
|
267
|
+
/**
|
|
268
|
+
* Common identity and timestamp fields shared by account activity records.
|
|
269
|
+
* `timestamp` is an ISO-8601 timestamp string.
|
|
270
|
+
*
|
|
271
|
+
* @public
|
|
272
|
+
*/
|
|
190
273
|
export interface BaseActivity {
|
|
191
274
|
id: string
|
|
192
275
|
provider: string
|
|
193
276
|
timestamp: string
|
|
194
277
|
}
|
|
195
278
|
|
|
196
|
-
/**
|
|
279
|
+
/**
|
|
280
|
+
* Account activity representing a completed deposit.
|
|
281
|
+
*
|
|
282
|
+
* @public
|
|
283
|
+
*/
|
|
197
284
|
export interface DepositActivity extends BaseActivity {
|
|
198
285
|
type: ActivityType.DEPOSIT
|
|
199
286
|
amount: string
|
|
200
|
-
|
|
287
|
+
/** Fully-resolved block-explorer URL for the on-chain deposit tx. */
|
|
201
288
|
explorerLink?: string
|
|
202
289
|
}
|
|
203
290
|
|
|
204
|
-
/**
|
|
291
|
+
/**
|
|
292
|
+
* Account activity representing a completed withdrawal. `amount` and `fee`
|
|
293
|
+
* are decimal strings in the transferred asset's units.
|
|
294
|
+
*
|
|
295
|
+
* @public
|
|
296
|
+
*/
|
|
205
297
|
export interface WithdrawalActivity extends BaseActivity {
|
|
206
298
|
type: ActivityType.WITHDRAWAL
|
|
207
299
|
amount: string
|
|
208
300
|
fee: string
|
|
209
|
-
|
|
301
|
+
/** Fully-resolved block-explorer URL for the on-chain withdrawal tx. */
|
|
210
302
|
explorerLink?: string
|
|
211
303
|
}
|
|
212
304
|
|
|
213
|
-
/**
|
|
305
|
+
/**
|
|
306
|
+
* Position details attached to a liquidation activity.
|
|
307
|
+
*
|
|
308
|
+
* @public
|
|
309
|
+
*/
|
|
214
310
|
export interface LiquidatedPosition {
|
|
215
311
|
market: MarketDisplay
|
|
216
312
|
size: string
|
|
217
313
|
}
|
|
218
314
|
|
|
219
|
-
/**
|
|
315
|
+
/**
|
|
316
|
+
* Account activity representing a liquidation event.
|
|
317
|
+
*
|
|
318
|
+
* @public
|
|
319
|
+
*/
|
|
220
320
|
export interface LiquidationActivity extends BaseActivity {
|
|
221
321
|
type: ActivityType.LIQUIDATION
|
|
222
322
|
liquidatedNotionalPosition: string
|
|
@@ -225,7 +325,12 @@ export interface LiquidationActivity extends BaseActivity {
|
|
|
225
325
|
liquidatedPositions: LiquidatedPosition[]
|
|
226
326
|
}
|
|
227
327
|
|
|
228
|
-
/**
|
|
328
|
+
/**
|
|
329
|
+
* Account activity representing a periodic funding payment. Amount and rate
|
|
330
|
+
* retain provider precision as decimal strings.
|
|
331
|
+
*
|
|
332
|
+
* @public
|
|
333
|
+
*/
|
|
229
334
|
export interface FundingActivity extends BaseActivity {
|
|
230
335
|
type: ActivityType.FUNDING
|
|
231
336
|
market: MarketDisplay
|
|
@@ -236,21 +341,30 @@ export interface FundingActivity extends BaseActivity {
|
|
|
236
341
|
|
|
237
342
|
// At least one of `counterpartyAccountIndex` / `counterpartyAddress` is always
|
|
238
343
|
// present; both may appear together.
|
|
239
|
-
/**
|
|
344
|
+
/**
|
|
345
|
+
* Account activity representing an inbound or outbound transfer. At least one
|
|
346
|
+
* counterparty identifier is required by the type-level union below.
|
|
347
|
+
*
|
|
348
|
+
* @public
|
|
349
|
+
*/
|
|
240
350
|
export type TransferActivity = BaseActivity & {
|
|
241
351
|
type: ActivityType.TRANSFER
|
|
242
352
|
direction: 'IN' | 'OUT'
|
|
243
353
|
asset: string
|
|
244
354
|
amount: string
|
|
245
355
|
meta?: Record<string, unknown>
|
|
246
|
-
|
|
356
|
+
/** Fully-resolved block-explorer URL for the on-chain transfer tx. */
|
|
247
357
|
explorerLink?: string
|
|
248
358
|
} & (
|
|
249
359
|
| { counterpartyAccountIndex: number; counterpartyAddress?: string }
|
|
250
360
|
| { counterpartyAccountIndex?: number; counterpartyAddress: string }
|
|
251
361
|
)
|
|
252
362
|
|
|
253
|
-
/**
|
|
363
|
+
/**
|
|
364
|
+
* Discriminated union of all activity records returned by a provider.
|
|
365
|
+
*
|
|
366
|
+
* @public
|
|
367
|
+
*/
|
|
254
368
|
export type ActivityItem =
|
|
255
369
|
| DepositActivity
|
|
256
370
|
| WithdrawalActivity
|
|
@@ -258,7 +372,11 @@ export type ActivityItem =
|
|
|
258
372
|
| FundingActivity
|
|
259
373
|
| TransferActivity
|
|
260
374
|
|
|
261
|
-
/**
|
|
375
|
+
/**
|
|
376
|
+
* Paginated account-activity response for one provider and account.
|
|
377
|
+
*
|
|
378
|
+
* @public
|
|
379
|
+
*/
|
|
262
380
|
export interface ActivitiesResponse {
|
|
263
381
|
provider: string
|
|
264
382
|
items: ActivityItem[]
|
|
@@ -267,10 +385,19 @@ export interface ActivitiesResponse {
|
|
|
267
385
|
|
|
268
386
|
// Account configuration state — typed `AccountResponse.config`.
|
|
269
387
|
|
|
270
|
-
/**
|
|
388
|
+
/**
|
|
389
|
+
* Provider-specific Hyperliquid agent configuration. The record contents are
|
|
390
|
+
* provider-defined and intentionally left opaque to the shared type package.
|
|
391
|
+
*
|
|
392
|
+
* @public
|
|
393
|
+
*/
|
|
271
394
|
export type HyperliquidAgent = Record<string, unknown>
|
|
272
395
|
|
|
273
|
-
/**
|
|
396
|
+
/**
|
|
397
|
+
* Hyperliquid builder-fee approval state for an account.
|
|
398
|
+
*
|
|
399
|
+
* @public
|
|
400
|
+
*/
|
|
274
401
|
export interface HyperliquidBuilderFeeApproval {
|
|
275
402
|
builderAddress: string
|
|
276
403
|
/** Basis points as a string. */
|
|
@@ -278,7 +405,11 @@ export interface HyperliquidBuilderFeeApproval {
|
|
|
278
405
|
approved: boolean
|
|
279
406
|
}
|
|
280
407
|
|
|
281
|
-
/**
|
|
408
|
+
/**
|
|
409
|
+
* Hyperliquid account configuration returned in {@link AccountResponse.config}.
|
|
410
|
+
*
|
|
411
|
+
* @public
|
|
412
|
+
*/
|
|
282
413
|
export interface HyperliquidAccountConfig {
|
|
283
414
|
provider: 'hyperliquid'
|
|
284
415
|
/** `null` means abstraction has never been set. */
|
|
@@ -287,7 +418,11 @@ export interface HyperliquidAccountConfig {
|
|
|
287
418
|
builderFeeApproval?: HyperliquidBuilderFeeApproval
|
|
288
419
|
}
|
|
289
420
|
|
|
290
|
-
/**
|
|
421
|
+
/**
|
|
422
|
+
* Lighter spot-asset collateral setting for a single asset.
|
|
423
|
+
*
|
|
424
|
+
* @public
|
|
425
|
+
*/
|
|
291
426
|
export interface LighterAssetCollateral {
|
|
292
427
|
/** Provider-native spot asset id (matches `Asset.id`). */
|
|
293
428
|
assetId: string
|
|
@@ -305,7 +440,12 @@ export interface LighterAssetCollateral {
|
|
|
305
440
|
*/
|
|
306
441
|
export type LighterProviderKey = 'lighter' | 'lighter-rh'
|
|
307
442
|
|
|
308
|
-
/**
|
|
443
|
+
/**
|
|
444
|
+
* Lighter account configuration returned in {@link AccountResponse.config}.
|
|
445
|
+
* Numeric identifiers and account modes use the provider's wire values.
|
|
446
|
+
*
|
|
447
|
+
* @public
|
|
448
|
+
*/
|
|
309
449
|
export interface LighterAccountConfig {
|
|
310
450
|
provider: LighterProviderKey
|
|
311
451
|
accountIndex: number
|
|
@@ -336,7 +476,12 @@ export interface LighterAccountConfig {
|
|
|
336
476
|
referralPresent: boolean
|
|
337
477
|
}
|
|
338
478
|
|
|
339
|
-
/**
|
|
479
|
+
/**
|
|
480
|
+
* Ondo account/session configuration returned in {@link AccountResponse.config}.
|
|
481
|
+
* Expiry values are Unix timestamps in seconds.
|
|
482
|
+
*
|
|
483
|
+
* @public
|
|
484
|
+
*/
|
|
340
485
|
export interface OndoAccountConfig {
|
|
341
486
|
provider: 'ondo'
|
|
342
487
|
loggedIn: boolean
|
|
@@ -352,20 +497,33 @@ export interface OndoAccountConfig {
|
|
|
352
497
|
depositAddress: string | null
|
|
353
498
|
}
|
|
354
499
|
|
|
355
|
-
/**
|
|
500
|
+
/**
|
|
501
|
+
* Provider-specific account configuration discriminated by its `provider` key.
|
|
502
|
+
*
|
|
503
|
+
* @public
|
|
504
|
+
*/
|
|
356
505
|
export type AccountConfig =
|
|
357
506
|
| HyperliquidAccountConfig
|
|
358
507
|
| LighterAccountConfig
|
|
359
508
|
| OndoAccountConfig
|
|
360
509
|
|
|
361
|
-
/**
|
|
510
|
+
/**
|
|
511
|
+
* Named account-configuration value exposed to clients.
|
|
512
|
+
*
|
|
513
|
+
* @public
|
|
514
|
+
*/
|
|
362
515
|
export interface AccountConfigValue {
|
|
363
516
|
name: string
|
|
364
517
|
/** `null` means no current value — consumers fall back to the descriptor default. */
|
|
365
518
|
value: string | number | boolean | null
|
|
366
519
|
}
|
|
367
520
|
|
|
368
|
-
/**
|
|
521
|
+
/**
|
|
522
|
+
* Account-configuration action and its available values, optionally including
|
|
523
|
+
* whether the setting is currently satisfied.
|
|
524
|
+
*
|
|
525
|
+
* @public
|
|
526
|
+
*/
|
|
369
527
|
export interface AccountConfigSetting {
|
|
370
528
|
type: ActionType
|
|
371
529
|
values: AccountConfigValue[]
|