@lifi/perps-types 16.2.0 → 18.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/dist/cjs/account.d.ts +2 -0
- package/dist/cjs/account.d.ts.map +1 -1
- package/dist/cjs/action.d.ts +9 -3
- package/dist/cjs/action.d.ts.map +1 -1
- package/dist/cjs/enums.d.ts +7 -0
- package/dist/cjs/enums.d.ts.map +1 -1
- package/dist/cjs/enums.js +9 -1
- package/dist/cjs/enums.js.map +1 -1
- package/dist/cjs/market.d.ts +1 -0
- package/dist/cjs/market.d.ts.map +1 -1
- package/dist/cjs/providers.d.ts +17 -4
- package/dist/cjs/providers.d.ts.map +1 -1
- package/dist/cjs/referral.d.ts +1 -1
- package/dist/cjs/referral.d.ts.map +1 -1
- package/dist/cjs/referral.js.map +1 -1
- package/dist/esm/account.d.ts +24 -9
- package/dist/esm/account.d.ts.map +1 -1
- package/dist/esm/action.d.ts +34 -11
- package/dist/esm/action.d.ts.map +1 -1
- package/dist/esm/enums.d.ts +19 -1
- package/dist/esm/enums.d.ts.map +1 -1
- package/dist/esm/enums.js +20 -1
- package/dist/esm/enums.js.map +1 -1
- package/dist/esm/market.d.ts +5 -0
- package/dist/esm/market.d.ts.map +1 -1
- package/dist/esm/providers.d.ts +50 -8
- package/dist/esm/providers.d.ts.map +1 -1
- package/dist/esm/referral.d.ts +1 -2
- package/dist/esm/referral.d.ts.map +1 -1
- package/dist/esm/referral.js.map +1 -1
- package/dist/types/account.d.ts +24 -9
- package/dist/types/account.d.ts.map +1 -1
- package/dist/types/action.d.ts +34 -11
- package/dist/types/action.d.ts.map +1 -1
- package/dist/types/enums.d.ts +19 -1
- package/dist/types/enums.d.ts.map +1 -1
- package/dist/types/market.d.ts +5 -0
- package/dist/types/market.d.ts.map +1 -1
- package/dist/types/providers.d.ts +50 -8
- package/dist/types/providers.d.ts.map +1 -1
- package/dist/types/referral.d.ts +1 -2
- package/dist/types/referral.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/account.ts +24 -9
- package/src/action.ts +36 -11
- package/src/enums.ts +20 -1
- package/src/market.ts +5 -0
- package/src/providers.ts +57 -8
- package/src/referral.ts +1 -2
package/dist/types/market.d.ts
CHANGED
|
@@ -57,6 +57,11 @@ export interface BaseMarket {
|
|
|
57
57
|
*/
|
|
58
58
|
export interface PerpsMarket extends BaseMarket {
|
|
59
59
|
maxLeverage: number;
|
|
60
|
+
/**
|
|
61
|
+
* The display leverage the venue applies to a market with no stored user
|
|
62
|
+
* setting. Absent when the venue publishes no default.
|
|
63
|
+
*/
|
|
64
|
+
defaultLeverage?: number;
|
|
60
65
|
/**
|
|
61
66
|
* Minimum order notional in USD for this market, as a plain decimal string.
|
|
62
67
|
* Lighter applies it to resting (post-only) orders only. Separate from the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"market.d.ts","sourceRoot":"","sources":["../../src/market.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AAE1D;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAA;IACZ,mDAAmD;IACnD,eAAe,EAAE,MAAM,CAAA;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAA;IAClB,qEAAqE;IACrE,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,KAAK,CAAA;IAChB,UAAU,EAAE,KAAK,CAAA;IACjB,6DAA6D;IAC7D,UAAU,EAAE,MAAM,CAAA;IAClB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MA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ClB;AAED,sFAAsF;AACtF,MAAM,WAAW,KAAK;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,KAAK,GAAG,MAAM,CAAA;IACpB,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { ActionParamsMap } from './action.js';
|
|
1
2
|
import type { Asset } from './asset.js';
|
|
2
|
-
import type { ActionType, PerpsSigner, SigningMethod } from './enums.js';
|
|
3
|
+
import type { ActionRelay, ActionType, PerpsSigner, SigningMethod } from './enums.js';
|
|
3
4
|
import type { OhlcvInterval } from './market.js';
|
|
4
5
|
/** A fixed option value presented for a provider action parameter. @public */
|
|
5
6
|
export interface ParamOption {
|
|
@@ -27,19 +28,20 @@ export interface Param {
|
|
|
27
28
|
readOnly?: boolean;
|
|
28
29
|
}
|
|
29
30
|
/**
|
|
30
|
-
* A single provider action. The same shape backs `Provider.setup
|
|
31
|
-
* `Provider.
|
|
32
|
-
*
|
|
31
|
+
* A single provider action. The same shape backs `Provider.setup` and
|
|
32
|
+
* `Provider.actions` — categorisation lives in which array it sits in, not in
|
|
33
|
+
* the type. `type`, `signer`, `signingMethod` and `relay` are always present;
|
|
33
34
|
* the rest are presentation/ordering hints provided per-action in the
|
|
34
35
|
* provider's hardcoded metadata.
|
|
35
36
|
* @public
|
|
36
37
|
*/
|
|
37
38
|
export interface ProviderAction {
|
|
38
39
|
type: ActionType;
|
|
39
|
-
|
|
40
|
+
signer: PerpsSigner;
|
|
40
41
|
signingMethod: SigningMethod;
|
|
42
|
+
relay: ActionRelay;
|
|
41
43
|
/**
|
|
42
|
-
* Human label. Drives the card heading in the setup
|
|
44
|
+
* Human label. Drives the card heading in the setup modal, and may
|
|
43
45
|
* also front an in-flight trading action ("{title} is working…").
|
|
44
46
|
*/
|
|
45
47
|
title?: string;
|
|
@@ -61,6 +63,47 @@ export interface ProviderAction {
|
|
|
61
63
|
* nothing, so a consumer tests `=== true` rather than truthiness.
|
|
62
64
|
*/
|
|
63
65
|
gatesAccountReads?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* A link to the venue's own documentation for this action, which a UI can
|
|
68
|
+
* show as a "Documentation" link.
|
|
69
|
+
*/
|
|
70
|
+
docsUrl?: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* One selectable value of a choice setup step, bound to the action that
|
|
74
|
+
* applies it.
|
|
75
|
+
*
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
export interface SetupOption<T extends ActionType = ActionType> {
|
|
79
|
+
/** Display title, e.g. `'Plus'`. */
|
|
80
|
+
title: string;
|
|
81
|
+
/**
|
|
82
|
+
* Option-specific prose a UI shows beside the option in its selector.
|
|
83
|
+
* `SetupAction.description` stays the general prose for the whole choice.
|
|
84
|
+
*/
|
|
85
|
+
description?: string;
|
|
86
|
+
/** The action executed when the option is chosen. */
|
|
87
|
+
type: T;
|
|
88
|
+
/** The action's sole param, bound, e.g. `{ tier: 'plus' }`. */
|
|
89
|
+
params: ActionParamsMap[T];
|
|
90
|
+
/**
|
|
91
|
+
* The recommended option a UI pre-selects. The SDK never executes it on its
|
|
92
|
+
* own; at most one option per step marks it.
|
|
93
|
+
*/
|
|
94
|
+
default?: true;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* One `Provider.setup` step. A choice step (`options !== null`) declares no
|
|
98
|
+
* `params`: each option carries its own bound params.
|
|
99
|
+
*
|
|
100
|
+
* @public
|
|
101
|
+
*/
|
|
102
|
+
export interface SetupAction extends ProviderAction {
|
|
103
|
+
/** `null` when the step is not a choice. */
|
|
104
|
+
options: SetupOption[] | null;
|
|
105
|
+
/** A `Provider.actions` entry that undoes the satisfied step, or `null`. */
|
|
106
|
+
revoke: ActionType | null;
|
|
64
107
|
}
|
|
65
108
|
/**
|
|
66
109
|
* Provider-attached advisory shown against a market. Provider-agnostic: the
|
|
@@ -111,8 +154,7 @@ export interface Provider {
|
|
|
111
154
|
signingMethod: SigningMethod;
|
|
112
155
|
/** When false, the provider is announced but not yet selectable in clients. */
|
|
113
156
|
active: boolean;
|
|
114
|
-
setup:
|
|
115
|
-
options: ProviderAction[];
|
|
157
|
+
setup: SetupAction[];
|
|
116
158
|
actions: ProviderAction[];
|
|
117
159
|
categories: ProviderCategory[];
|
|
118
160
|
wsUrl?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/providers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/providers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,WAAW,EACX,aAAa,EACd,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD,8EAA8E;AAC9E,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;;GAIG;AACH,MAAM,WAAW,KAAK;IACpB,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAA;IACZ;;;;;OAKG;IACH,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAA;IACrC,yFAAyF;IACzF,MAAM,CAAC,EAAE,WAAW,EAAE,CAAA;IACtB,OAAO,CAAC,EAAE,WAAW,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;;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 -196,8 +196,7 @@ export interface OnboardTypedData extends PerpsTypedData {
|
|
|
196
196
|
* @public
|
|
197
197
|
*/
|
|
198
198
|
export interface CreateReferralCodeParams {
|
|
199
|
-
|
|
200
|
-
code?: string;
|
|
199
|
+
code: string;
|
|
201
200
|
}
|
|
202
201
|
/**
|
|
203
202
|
* EIP-712 message body for a `CreateReferralCode`. Field order matches
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"referral.d.ts","sourceRoot":"","sources":["../../src/referral.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAExE;;;;GAIG;AACH,oBAAY,qBAAqB;IAC/B,6DAA6D;IAC7D,SAAS,cAAc;IACvB,uDAAuD;IACvD,SAAS,cAAc;IACvB,uDAAuD;IACvD,QAAQ,aAAa;IACrB,uDAAuD;IACvD,aAAa,kBAAkB;IAC/B,2EAA2E;IAC3E,gBAAgB,qBAAqB;IACrC,2EAA2E;IAC3E,YAAY,iBAAiB;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,OAAO,CAAA;IACd,uEAAuE;IACvE,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,qBAAqB,CAAA;CAClC;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAA;IACZ,2DAA2D;IAC3D,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,oDAAoD;IACpD,SAAS,EAAE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;IACzE,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,EAAE,SAAS,kBAAkB,EAMrE,CAAA;AAED;;;;;GAKG;AACH,MAAM,WAAW,2BAA4B,SAAQ,cAAc;IACjE,WAAW,EAAE,oBAAoB,CAAA;IACjC,KAAK,EAAE;QACL,kBAAkB,EAAE,SAAS,kBAAkB,EAAE,CAAA;KAClD,GAAG,cAAc,CAAC,OAAO,CAAC,CAAA;IAC3B,OAAO,EAAE,yBAAyB,CAAA;CACnC"}
|
package/package.json
CHANGED
package/src/account.ts
CHANGED
|
@@ -141,9 +141,10 @@ export interface Balance {
|
|
|
141
141
|
/** USD price of one unit. Absent when the provider holds no price for the asset. */
|
|
142
142
|
price?: string
|
|
143
143
|
/**
|
|
144
|
-
* Part of `units` the venue releases from this category
|
|
145
|
-
*
|
|
146
|
-
*
|
|
144
|
+
* Part of `units` the venue releases from this category, as a decimal
|
|
145
|
+
* string clamped to `[0, units]`. Every collateral row and every spot row
|
|
146
|
+
* carries it. It is not the withdrawal ceiling: read
|
|
147
|
+
* `PerpsClient.getWithdrawableBalances` for that.
|
|
147
148
|
*/
|
|
148
149
|
transferable?: string
|
|
149
150
|
}
|
|
@@ -213,9 +214,8 @@ export interface AvailableToTrade {
|
|
|
213
214
|
}
|
|
214
215
|
|
|
215
216
|
/**
|
|
216
|
-
* The user's complete venue-side settings for one market: the margin
|
|
217
|
-
* and display leverage the next order on it will use.
|
|
218
|
-
* `undefined` when it cannot read both values.
|
|
217
|
+
* The user's complete venue-side settings for one perps market: the margin
|
|
218
|
+
* mode and display leverage the next order on it will use.
|
|
219
219
|
* @public
|
|
220
220
|
*/
|
|
221
221
|
export interface MarketSettings {
|
|
@@ -609,10 +609,22 @@ export interface LighterAccountConfig {
|
|
|
609
609
|
*/
|
|
610
610
|
accountType: number
|
|
611
611
|
/**
|
|
612
|
-
* Lighter `available_balance`:
|
|
613
|
-
*
|
|
612
|
+
* Lighter `available_balance`: the withdrawable total, already marked to
|
|
613
|
+
* market. It is not the buying power: it adds each isolated position's
|
|
614
|
+
* equity above its initial margin requirement and subtracts the shortfall
|
|
615
|
+
* below it. A decimal string in quote-asset units.
|
|
614
616
|
*/
|
|
615
617
|
availableBalance: string
|
|
618
|
+
/**
|
|
619
|
+
* Lighter `cross_asset_value`: cross-margin collateral plus the unrealized
|
|
620
|
+
* PnL of the cross positions. A decimal string in quote-asset units.
|
|
621
|
+
*/
|
|
622
|
+
crossAssetValue: string
|
|
623
|
+
/**
|
|
624
|
+
* Lighter `cross_initial_margin_requirement`: the initial margin the cross
|
|
625
|
+
* positions lock. A decimal string in quote-asset units.
|
|
626
|
+
*/
|
|
627
|
+
crossInitialMarginRequirement: string
|
|
616
628
|
/**
|
|
617
629
|
* Lighter `total_asset_value`: perps-route equity, isolated allocations and
|
|
618
630
|
* unrealized PnL included. It excludes the spot-route balances. A decimal
|
|
@@ -721,6 +733,9 @@ export interface AccountConfigValue {
|
|
|
721
733
|
export interface AccountConfigSetting {
|
|
722
734
|
type: ActionType
|
|
723
735
|
values: AccountConfigValue[]
|
|
724
|
-
/**
|
|
736
|
+
/**
|
|
737
|
+
* `undefined` means the account state carries no answer, so satisfaction is
|
|
738
|
+
* decided from staging instead. Every choice setup step carries a boolean.
|
|
739
|
+
*/
|
|
725
740
|
satisfied?: boolean
|
|
726
741
|
}
|
package/src/action.ts
CHANGED
|
@@ -305,7 +305,10 @@ export interface PlaceOrderParams {
|
|
|
305
305
|
size: string
|
|
306
306
|
price?: string
|
|
307
307
|
leverage?: number
|
|
308
|
-
/**
|
|
308
|
+
/**
|
|
309
|
+
* Hyperliquid: requires `leverage`. Omitted leaves the market's current
|
|
310
|
+
* margin mode unchanged.
|
|
311
|
+
*/
|
|
309
312
|
marginMode?: MarginMode
|
|
310
313
|
reduceOnly?: boolean
|
|
311
314
|
timeInForce?: TimeInForce
|
|
@@ -345,7 +348,7 @@ export interface PlaceTwapOrderParams {
|
|
|
345
348
|
/** Total execution window in seconds. */
|
|
346
349
|
durationSeconds: number
|
|
347
350
|
reduceOnly?: boolean
|
|
348
|
-
/** Hyperliquid: randomize sub-order
|
|
351
|
+
/** Hyperliquid: randomize each sub-order size by up to 20 percent. */
|
|
349
352
|
randomize?: boolean
|
|
350
353
|
/** Ondo: interval between child orders in seconds. */
|
|
351
354
|
frequencySeconds?: number
|
|
@@ -401,7 +404,7 @@ export interface ModifyOrderParams {
|
|
|
401
404
|
export interface UpdateLeverageParams {
|
|
402
405
|
market: MarketRef
|
|
403
406
|
leverage: number
|
|
404
|
-
/**
|
|
407
|
+
/** Hyperliquid: omitted is sent as isolated. */
|
|
405
408
|
marginMode?: MarginMode
|
|
406
409
|
}
|
|
407
410
|
|
|
@@ -429,6 +432,16 @@ export interface UpdateAssetCollateralParams {
|
|
|
429
432
|
enabled: boolean
|
|
430
433
|
}
|
|
431
434
|
|
|
435
|
+
/**
|
|
436
|
+
* Which of a venue's two balance routes a withdrawal is drawn from. Lighter's
|
|
437
|
+
* own vocabulary, carried in the signed tx as `AssetRouteType` (`perps` = 0,
|
|
438
|
+
* `spot` = 1); an account's mode changes what the two balances mean, never
|
|
439
|
+
* which route the tx names.
|
|
440
|
+
*
|
|
441
|
+
* @public
|
|
442
|
+
*/
|
|
443
|
+
export type WithdrawalRoute = 'perps' | 'spot'
|
|
444
|
+
|
|
432
445
|
/**
|
|
433
446
|
* Parameters for withdrawing a decimal-string amount to an EVM address.
|
|
434
447
|
*
|
|
@@ -437,6 +450,10 @@ export interface UpdateAssetCollateralParams {
|
|
|
437
450
|
export interface WithdrawalParams {
|
|
438
451
|
destination: Address
|
|
439
452
|
amount: string
|
|
453
|
+
/** Lighter: provider-native `Asset.id` to withdraw. Omitted withdraws the quote asset. */
|
|
454
|
+
assetId?: string
|
|
455
|
+
/** Lighter: balance route to draw from. Omitted is `perps`. */
|
|
456
|
+
route?: WithdrawalRoute
|
|
440
457
|
/**
|
|
441
458
|
* The venue-native account identifier, as a string. The provider plugin
|
|
442
459
|
* supplies it; callers omit it. A string because Ondo's 20-digit accountID
|
|
@@ -451,7 +468,7 @@ export interface WithdrawalParams {
|
|
|
451
468
|
* @public
|
|
452
469
|
*/
|
|
453
470
|
export interface DepositParams {
|
|
454
|
-
/** Amount of the token to deposit (
|
|
471
|
+
/** Amount of the token to deposit, as an integer string in the token's base units (e.g. "100500000" for 100.5 USDC). */
|
|
455
472
|
amount: string
|
|
456
473
|
/** ERC-20 token address on the source chain. */
|
|
457
474
|
tokenAddress: Address
|
|
@@ -471,16 +488,21 @@ export interface ApproveAgentParams {
|
|
|
471
488
|
}
|
|
472
489
|
|
|
473
490
|
/**
|
|
474
|
-
* Parameters for deregistering an account agent.
|
|
491
|
+
* Parameters for deregistering an account agent. The action takes no
|
|
492
|
+
* parameters: the backend picks the agent to revoke and the user confirms it.
|
|
493
|
+
*
|
|
494
|
+
* @public
|
|
495
|
+
*/
|
|
496
|
+
export type RevokeAgentParams = Record<string, never>
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Parameters for removing the session agent the SDK signs with, targeted by
|
|
500
|
+
* address.
|
|
475
501
|
*
|
|
476
502
|
* @public
|
|
477
503
|
*/
|
|
478
|
-
export interface
|
|
479
|
-
|
|
480
|
-
/** The name the venue holds for the agent. HyperCore identifies a named API
|
|
481
|
-
* wallet by name, not by address, so a revoke that omits the exact stored
|
|
482
|
-
* name leaves the slot occupied. */
|
|
483
|
-
name: string
|
|
504
|
+
export interface RevokeSessionAgentParams {
|
|
505
|
+
agentAddress: Address
|
|
484
506
|
}
|
|
485
507
|
|
|
486
508
|
/**
|
|
@@ -565,8 +587,11 @@ export interface ApproveReadOnlyTokenParams {
|
|
|
565
587
|
export interface ActionParamsMap {
|
|
566
588
|
[ActionType.APPROVE_AGENT]: ApproveAgentParams
|
|
567
589
|
[ActionType.REVOKE_AGENT]: RevokeAgentParams
|
|
590
|
+
[ActionType.REVOKE_SESSION_AGENT]: RevokeSessionAgentParams
|
|
568
591
|
[ActionType.APPROVE_BUILDER_FEE]: Record<string, never>
|
|
592
|
+
[ActionType.REVOKE_BUILDER_FEE]: Record<string, never>
|
|
569
593
|
[ActionType.APPROVE_INTEGRATOR]: Record<string, never>
|
|
594
|
+
[ActionType.REVOKE_INTEGRATOR]: Record<string, never>
|
|
570
595
|
[ActionType.SET_REFERRAL]: Record<string, never>
|
|
571
596
|
[ActionType.ACCOUNT_MODE]: AccountModeParams
|
|
572
597
|
[ActionType.ACCOUNT_TYPE]: AccountTypeParams
|
package/src/enums.ts
CHANGED
|
@@ -156,8 +156,13 @@ export enum ActionType {
|
|
|
156
156
|
APPROVE_AGENT = 'approveAgent',
|
|
157
157
|
/** Deregisters an agent (API wallet) to free one of the account's agent slots. HyperCore performs it through the approve-agent typed data with a matching name, so it carries no distinct primary type. */
|
|
158
158
|
REVOKE_AGENT = 'revokeAgent',
|
|
159
|
+
/** Removes the session agent the SDK signs with, targeted by its `agentAddress`. Signed by the user wallet. */
|
|
160
|
+
REVOKE_SESSION_AGENT = 'revokeSessionAgent',
|
|
159
161
|
APPROVE_BUILDER_FEE = 'approveBuilderFee',
|
|
162
|
+
REVOKE_BUILDER_FEE = 'revokeBuilderFee',
|
|
160
163
|
APPROVE_INTEGRATOR = 'approveIntegrator',
|
|
164
|
+
/** Revokes an integrator fee approval: the approve-integrator transaction with every max fee and the approval expiry set to 0. */
|
|
165
|
+
REVOKE_INTEGRATOR = 'revokeIntegrator',
|
|
161
166
|
SET_REFERRAL = 'setReferrer',
|
|
162
167
|
ACCOUNT_MODE = 'accountMode',
|
|
163
168
|
ACCOUNT_TYPE = 'accountType',
|
|
@@ -189,7 +194,7 @@ export enum ActionType {
|
|
|
189
194
|
META_ONBOARD = 'metaOnboard',
|
|
190
195
|
/** Provider-independent: reserves the shareable internal referral code an address owns. */
|
|
191
196
|
META_CREATE_REFERRAL_CODE = 'metaCreateReferralCode',
|
|
192
|
-
/** Never projected on `Provider.setup
|
|
197
|
+
/** Never projected on `Provider.setup`, and never offered as a user-facing trading action. */
|
|
193
198
|
SYNC_FEE_ATTRIBUTION = 'syncFeeAttribution',
|
|
194
199
|
}
|
|
195
200
|
|
|
@@ -262,6 +267,20 @@ export enum PerpsSigner {
|
|
|
262
267
|
SDK = 'SDK',
|
|
263
268
|
}
|
|
264
269
|
|
|
270
|
+
/**
|
|
271
|
+
* Where a signed step is submitted. For `EVM_TX`, signing broadcasts each leg
|
|
272
|
+
* from the user's wallet and the signed step carries `txHash`, which `API`
|
|
273
|
+
* then acknowledges to `/executeAction`.
|
|
274
|
+
*
|
|
275
|
+
* @public
|
|
276
|
+
*/
|
|
277
|
+
export enum ActionRelay {
|
|
278
|
+
/** Submit the signed step to `POST /executeAction`. */
|
|
279
|
+
API = 'API',
|
|
280
|
+
/** The client submits to the venue itself; nothing reaches LI.FI. */
|
|
281
|
+
CLIENT = 'CLIENT',
|
|
282
|
+
}
|
|
283
|
+
|
|
265
284
|
/**
|
|
266
285
|
* Signing mechanisms supported by action steps. Values are serialized in
|
|
267
286
|
* provider metadata and action responses.
|
package/src/market.ts
CHANGED
|
@@ -60,6 +60,11 @@ export interface BaseMarket {
|
|
|
60
60
|
*/
|
|
61
61
|
export interface PerpsMarket extends BaseMarket {
|
|
62
62
|
maxLeverage: number
|
|
63
|
+
/**
|
|
64
|
+
* The display leverage the venue applies to a market with no stored user
|
|
65
|
+
* setting. Absent when the venue publishes no default.
|
|
66
|
+
*/
|
|
67
|
+
defaultLeverage?: number
|
|
63
68
|
/**
|
|
64
69
|
* Minimum order notional in USD for this market, as a plain decimal string.
|
|
65
70
|
* Lighter applies it to resting (post-only) orders only. Separate from the
|
package/src/providers.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
import type { ActionParamsMap } from './action.js'
|
|
1
2
|
import type { Asset } from './asset.js'
|
|
2
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
ActionRelay,
|
|
5
|
+
ActionType,
|
|
6
|
+
PerpsSigner,
|
|
7
|
+
SigningMethod,
|
|
8
|
+
} from './enums.js'
|
|
3
9
|
import type { OhlcvInterval } from './market.js'
|
|
4
10
|
|
|
5
11
|
/** A fixed option value presented for a provider action parameter. @public */
|
|
@@ -30,19 +36,20 @@ export interface Param {
|
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
/**
|
|
33
|
-
* A single provider action. The same shape backs `Provider.setup
|
|
34
|
-
* `Provider.
|
|
35
|
-
*
|
|
39
|
+
* A single provider action. The same shape backs `Provider.setup` and
|
|
40
|
+
* `Provider.actions` — categorisation lives in which array it sits in, not in
|
|
41
|
+
* the type. `type`, `signer`, `signingMethod` and `relay` are always present;
|
|
36
42
|
* the rest are presentation/ordering hints provided per-action in the
|
|
37
43
|
* provider's hardcoded metadata.
|
|
38
44
|
* @public
|
|
39
45
|
*/
|
|
40
46
|
export interface ProviderAction {
|
|
41
47
|
type: ActionType
|
|
42
|
-
|
|
48
|
+
signer: PerpsSigner
|
|
43
49
|
signingMethod: SigningMethod
|
|
50
|
+
relay: ActionRelay
|
|
44
51
|
/**
|
|
45
|
-
* Human label. Drives the card heading in the setup
|
|
52
|
+
* Human label. Drives the card heading in the setup modal, and may
|
|
46
53
|
* also front an in-flight trading action ("{title} is working…").
|
|
47
54
|
*/
|
|
48
55
|
title?: string
|
|
@@ -64,6 +71,49 @@ export interface ProviderAction {
|
|
|
64
71
|
* nothing, so a consumer tests `=== true` rather than truthiness.
|
|
65
72
|
*/
|
|
66
73
|
gatesAccountReads?: boolean
|
|
74
|
+
/**
|
|
75
|
+
* A link to the venue's own documentation for this action, which a UI can
|
|
76
|
+
* show as a "Documentation" link.
|
|
77
|
+
*/
|
|
78
|
+
docsUrl?: string
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* One selectable value of a choice setup step, bound to the action that
|
|
83
|
+
* applies it.
|
|
84
|
+
*
|
|
85
|
+
* @public
|
|
86
|
+
*/
|
|
87
|
+
export interface SetupOption<T extends ActionType = ActionType> {
|
|
88
|
+
/** Display title, e.g. `'Plus'`. */
|
|
89
|
+
title: string
|
|
90
|
+
/**
|
|
91
|
+
* Option-specific prose a UI shows beside the option in its selector.
|
|
92
|
+
* `SetupAction.description` stays the general prose for the whole choice.
|
|
93
|
+
*/
|
|
94
|
+
description?: string
|
|
95
|
+
/** The action executed when the option is chosen. */
|
|
96
|
+
type: T
|
|
97
|
+
/** The action's sole param, bound, e.g. `{ tier: 'plus' }`. */
|
|
98
|
+
params: ActionParamsMap[T]
|
|
99
|
+
/**
|
|
100
|
+
* The recommended option a UI pre-selects. The SDK never executes it on its
|
|
101
|
+
* own; at most one option per step marks it.
|
|
102
|
+
*/
|
|
103
|
+
default?: true
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* One `Provider.setup` step. A choice step (`options !== null`) declares no
|
|
108
|
+
* `params`: each option carries its own bound params.
|
|
109
|
+
*
|
|
110
|
+
* @public
|
|
111
|
+
*/
|
|
112
|
+
export interface SetupAction extends ProviderAction {
|
|
113
|
+
/** `null` when the step is not a choice. */
|
|
114
|
+
options: SetupOption[] | null
|
|
115
|
+
/** A `Provider.actions` entry that undoes the satisfied step, or `null`. */
|
|
116
|
+
revoke: ActionType | null
|
|
67
117
|
}
|
|
68
118
|
|
|
69
119
|
/**
|
|
@@ -118,8 +168,7 @@ export interface Provider {
|
|
|
118
168
|
signingMethod: SigningMethod
|
|
119
169
|
/** When false, the provider is announced but not yet selectable in clients. */
|
|
120
170
|
active: boolean
|
|
121
|
-
setup:
|
|
122
|
-
options: ProviderAction[]
|
|
171
|
+
setup: SetupAction[]
|
|
123
172
|
actions: ProviderAction[]
|
|
124
173
|
categories: ProviderCategory[]
|
|
125
174
|
wsUrl?: string
|
package/src/referral.ts
CHANGED