@lifi/perps-sdk 18.0.0 → 19.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/dist/cjs/client/PerpsClient.d.ts +15 -8
- package/dist/cjs/client/PerpsClient.d.ts.map +1 -1
- package/dist/cjs/client/PerpsClient.js +145 -52
- package/dist/cjs/client/PerpsClient.js.map +1 -1
- package/dist/cjs/index.d.ts +4 -4
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/api.d.ts +8 -2
- package/dist/cjs/types/api.d.ts.map +1 -1
- package/dist/cjs/types/provider.d.ts +9 -6
- package/dist/cjs/types/provider.d.ts.map +1 -1
- package/dist/cjs/types/withdrawal.d.ts +11 -1
- package/dist/cjs/types/withdrawal.d.ts.map +1 -1
- package/dist/cjs/utils/setupActions.d.ts +4 -2
- package/dist/cjs/utils/setupActions.d.ts.map +1 -1
- package/dist/cjs/utils/setupActions.js +9 -1
- package/dist/cjs/utils/setupActions.js.map +1 -1
- package/dist/cjs/utils/switchChain.js +1 -1
- package/dist/cjs/utils/switchChain.js.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 +74 -55
- package/dist/esm/client/PerpsClient.d.ts.map +1 -1
- package/dist/esm/client/PerpsClient.js +218 -100
- package/dist/esm/client/PerpsClient.js.map +1 -1
- package/dist/esm/index.d.ts +4 -4
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/api.d.ts +40 -14
- package/dist/esm/types/api.d.ts.map +1 -1
- package/dist/esm/types/provider.d.ts +39 -28
- package/dist/esm/types/provider.d.ts.map +1 -1
- package/dist/esm/types/withdrawal.d.ts +30 -1
- package/dist/esm/types/withdrawal.d.ts.map +1 -1
- package/dist/esm/utils/setupActions.d.ts +17 -8
- package/dist/esm/utils/setupActions.d.ts.map +1 -1
- package/dist/esm/utils/setupActions.js +20 -7
- package/dist/esm/utils/setupActions.js.map +1 -1
- package/dist/esm/utils/switchChain.js +1 -1
- package/dist/esm/utils/switchChain.js.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 +74 -55
- package/dist/types/client/PerpsClient.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types/api.d.ts +40 -14
- package/dist/types/types/api.d.ts.map +1 -1
- package/dist/types/types/provider.d.ts +39 -28
- package/dist/types/types/provider.d.ts.map +1 -1
- package/dist/types/types/withdrawal.d.ts +30 -1
- package/dist/types/types/withdrawal.d.ts.map +1 -1
- package/dist/types/utils/setupActions.d.ts +17 -8
- package/dist/types/utils/setupActions.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/client/PerpsClient.ts +303 -130
- package/src/index.ts +9 -1
- package/src/types/api.ts +42 -14
- package/src/types/provider.ts +44 -30
- package/src/types/withdrawal.ts +33 -1
- package/src/utils/setupActions.ts +27 -13
- package/src/utils/switchChain.ts +1 -1
- package/src/version.ts +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { AccountConfig, AccountConfigSetting, AccountResponse, AccountSummary, ActionResult, ActionStep, ActionType, ActivitiesResponse, ActivityType, AvailableToTrade, FillsResponse, Market, MarketRef, MarketSettings, Order, OrderStatus, OrdersResponse, PerpsMarket, PerpsSigner, PortfolioHistoryRange, PortfolioHistoryResponse, Position, PositionsResponse,
|
|
1
|
+
import type { AccountConfig, AccountConfigSetting, AccountResponse, AccountSummary, ActionResult, ActionStep, ActionType, ActivitiesResponse, ActivityType, AvailableToTrade, FillsResponse, Market, MarketRef, MarketSettings, Order, OrderStatus, OrdersResponse, PerpsMarket, PerpsSigner, PortfolioHistoryRange, PortfolioHistoryResponse, Position, PositionsResponse, Quote, QuoteSide, SetupAction, SignedActionStep, SigningMethod, TradeType } from '@lifi/perps-types';
|
|
2
2
|
import type { Address } from 'viem';
|
|
3
3
|
import type { PerpsBaseConfig, PerpsClientSigner, SDKRequestOptions } from './config.js';
|
|
4
4
|
import type { DepositFlow } from './deposit.js';
|
|
5
|
-
import type { ProviderWithdrawableBalance } from './withdrawal.js';
|
|
5
|
+
import type { ProviderWithdrawableBalance, WithdrawFlow } from './withdrawal.js';
|
|
6
6
|
/**
|
|
7
7
|
* Low-level SDK client: resolved config, the optional end-user wallet, and the
|
|
8
8
|
* registered provider plugins. Returned by {@link createPerpsClient} and
|
|
@@ -49,12 +49,12 @@ export interface SignActionsContext {
|
|
|
49
49
|
/** End-user wallet used for USER-signed or EVM transaction legs. */
|
|
50
50
|
userWallet?: PerpsClientSigner;
|
|
51
51
|
/**
|
|
52
|
-
* The signing batch's declared
|
|
52
|
+
* The signing batch's declared signer, from the action's `ProviderAction`
|
|
53
53
|
* descriptor. The plugin branches on this to pick WHO signs (e.g.
|
|
54
|
-
* Hyperliquid: `USER` → end-user wallet, `
|
|
55
|
-
* forwards the descriptor's `
|
|
54
|
+
* Hyperliquid: `USER` → end-user wallet, `SDK` → session keypair). Core
|
|
55
|
+
* forwards the descriptor's `signer` as data; it does not branch on it.
|
|
56
56
|
*/
|
|
57
|
-
|
|
57
|
+
signer?: PerpsSigner;
|
|
58
58
|
/**
|
|
59
59
|
* Switch `userWallet` to `chainId` and resolve the client to broadcast with.
|
|
60
60
|
* Bound by core to the consumer's `switchChain` hook and the resolved
|
|
@@ -137,6 +137,14 @@ export interface ProviderAccountExistsParams {
|
|
|
137
137
|
export interface ProviderGetDepositFlowParams {
|
|
138
138
|
address: Address;
|
|
139
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* Read params for {@link PerpsProviderPlugin.getWithdrawFlow}.
|
|
142
|
+
*
|
|
143
|
+
* @public
|
|
144
|
+
*/
|
|
145
|
+
export interface ProviderGetWithdrawFlowParams {
|
|
146
|
+
address: Address;
|
|
147
|
+
}
|
|
140
148
|
/**
|
|
141
149
|
* Read params for {@link PerpsProviderPlugin.getWithdrawableBalances}.
|
|
142
150
|
*
|
|
@@ -306,22 +314,12 @@ export interface PerpsProviderPlugin {
|
|
|
306
314
|
*/
|
|
307
315
|
readonly type: string;
|
|
308
316
|
/**
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
* credentials — and omits it from the returned `setup` list. A descriptor
|
|
313
|
-
* whose `signers` include {@link PerpsSigner.USER} is never treated as
|
|
314
|
-
* internal, even when named here. Omit when the provider has no
|
|
315
|
-
* self-completed setup steps.
|
|
316
|
-
*/
|
|
317
|
-
readonly internalSetupActions?: readonly ActionType[];
|
|
318
|
-
/**
|
|
319
|
-
* Setup actions that stage work only when the account needs remediation
|
|
320
|
-
* (e.g. Hyperliquid's REVOKE_AGENT frees an agent slot only when every
|
|
321
|
-
* named slot is taken). When such a step stages no actions,
|
|
317
|
+
* Non-choice setup actions that stage work only when the account needs
|
|
318
|
+
* remediation (e.g. Hyperliquid's REVOKE_AGENT frees an agent slot only
|
|
319
|
+
* when every named slot is taken). When such a step stages no actions,
|
|
322
320
|
* `PerpsClient.checkSetup` omits it from `ProviderSetup.checklist` instead
|
|
323
|
-
* of rendering it as satisfied.
|
|
324
|
-
* unconditional.
|
|
321
|
+
* of rendering it as satisfied. Choices are always rendered because they
|
|
322
|
+
* are never staged. Omit when every setup step is unconditional.
|
|
325
323
|
*/
|
|
326
324
|
readonly conditionalSetupActions?: readonly ActionType[];
|
|
327
325
|
/**
|
|
@@ -351,6 +349,15 @@ export interface PerpsProviderPlugin {
|
|
|
351
349
|
* `PerpsClient.getDepositFlow` then resolves `undefined`.
|
|
352
350
|
*/
|
|
353
351
|
getDepositFlow?(params: ProviderGetDepositFlowParams, options?: SDKRequestOptions): Promise<DepositFlow>;
|
|
352
|
+
/**
|
|
353
|
+
* The withdrawal flow this venue offers `params.address`, resolved from the
|
|
354
|
+
* venue's own account and setup state — the destination a withdrawal goes
|
|
355
|
+
* to, or the venue setup that must come first.
|
|
356
|
+
*
|
|
357
|
+
* Optional: a provider without a gated withdrawal destination omits it, and
|
|
358
|
+
* `PerpsClient.getWithdrawFlow` then resolves `undefined`.
|
|
359
|
+
*/
|
|
360
|
+
getWithdrawFlow?(params: ProviderGetWithdrawFlowParams, options?: SDKRequestOptions): Promise<WithdrawFlow>;
|
|
354
361
|
/**
|
|
355
362
|
* The `(asset, route)` pairs `params.address` currently has something to
|
|
356
363
|
* withdraw from, keyed by provider-native asset id. Only the venue knows how
|
|
@@ -455,28 +462,32 @@ export interface PerpsProviderPlugin {
|
|
|
455
462
|
positionRemovableMargin(position: Position): string | undefined;
|
|
456
463
|
/**
|
|
457
464
|
* Project a typed {@link AccountConfig} against the provider's `setup`
|
|
458
|
-
*
|
|
465
|
+
* descriptors into `AccountConfigSetting[]`. Used by
|
|
459
466
|
* `PerpsClient.getAccount` to attach a `settings` array to the response —
|
|
460
|
-
* one entry per descriptor, in `setup
|
|
467
|
+
* one entry per descriptor, in `setup` order. Every choice descriptor
|
|
468
|
+
* (`options` is not `null`) carries a boolean `satisfied`, because
|
|
469
|
+
* `PerpsClient.checkSetup` reads a choice's satisfied state and `selected`
|
|
470
|
+
* option from this projection alone.
|
|
461
471
|
*
|
|
462
472
|
* Implementations receive the union-typed `AccountConfig` and narrow on
|
|
463
473
|
* `config.provider` themselves; the dispatcher in `PerpsClient` does not
|
|
464
474
|
* narrow before calling.
|
|
465
475
|
*/
|
|
466
|
-
projectConfig(config: AccountConfig, setup:
|
|
476
|
+
projectConfig(config: AccountConfig, setup: SetupAction[]): AccountConfigSetting[];
|
|
467
477
|
/**
|
|
468
478
|
* Per-setup-action params the SDK should inject into `createAction` calls
|
|
469
479
|
* when staging the provider setup. Used for plugin-side state the backend
|
|
470
480
|
* needs to make a correct idempotency decision (e.g. Lighter's known local
|
|
471
481
|
* API public key). Returns an empty object when the plugin has no params
|
|
472
|
-
* to contribute for the action.
|
|
482
|
+
* to contribute for the action. A choice option runs with its bound params
|
|
483
|
+
* alone and never reads these. Optional — providers without local state
|
|
473
484
|
* can omit it entirely.
|
|
474
485
|
*/
|
|
475
486
|
resolveSetupParams?(action: ActionType, address: Address): Promise<Record<string, unknown>>;
|
|
476
487
|
/**
|
|
477
488
|
* Contribute the signer-bearing wire fields for an action — the plugin owns
|
|
478
489
|
* signer identity (WHO signs), so core asks the plugin rather than resolving
|
|
479
|
-
* a `signerAddress` itself. The descriptor's `
|
|
490
|
+
* a `signerAddress` itself. The descriptor's `signer` is forwarded so the
|
|
480
491
|
* plugin can branch on signer role: a provider that signs on the user's
|
|
481
492
|
* behalf with a session keypair (Hyperliquid's agent) resolves — provisioning
|
|
482
493
|
* one if needed — and returns the agent address as `signerAddress`; for
|
|
@@ -489,7 +500,7 @@ export interface PerpsProviderPlugin {
|
|
|
489
500
|
* credential (Lighter's API key) omit it — core then sends no `signerAddress`
|
|
490
501
|
* and no injected params.
|
|
491
502
|
*/
|
|
492
|
-
resolveActionRequest?(action: ActionType, address: Address,
|
|
503
|
+
resolveActionRequest?(action: ActionType, address: Address, signer: PerpsSigner): Promise<ActionSignerContribution>;
|
|
493
504
|
/**
|
|
494
505
|
* Sign a batch of unsigned {@link ActionStep}s belonging to one
|
|
495
506
|
* `SigningMethod` arm. Returns the matching {@link SignedActionStep}s in
|
|
@@ -502,7 +513,7 @@ export interface PerpsProviderPlugin {
|
|
|
502
513
|
* provider has no `signActions`.
|
|
503
514
|
*
|
|
504
515
|
* `method` mirrors the descriptor's `signingMethod`. The plugin owns every
|
|
505
|
-
* arm, branching on the descriptor's `
|
|
516
|
+
* arm, branching on the descriptor's `signer` internally: the EIP712 arm
|
|
506
517
|
* signs with the user's wallet (read from `ctx.userWallet`) or the provider's
|
|
507
518
|
* session keypair (Hyperliquid's agent), and `WASM_BLOB` / `EVM_TX` sign with
|
|
508
519
|
* the provider's local credential (Lighter).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/types/provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,MAAM,EACN,SAAS,EACT,cAAc,EACd,KAAK,EACL,WAAW,EACX,cAAc,EACd,WAAW,EACX,WAAW,EACX,qBAAqB,EACrB,wBAAwB,EACxB,QAAQ,EACR,iBAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/types/provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,MAAM,EACN,SAAS,EACT,cAAc,EACd,KAAK,EACL,WAAW,EACX,cAAc,EACd,WAAW,EACX,WAAW,EACX,qBAAqB,EACrB,wBAAwB,EACxB,QAAQ,EACR,iBAAiB,EACjB,KAAK,EACL,SAAS,EACT,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,SAAS,EACV,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,2BAA2B,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAEhF;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAA;IAChC,6EAA6E;IAC7E,QAA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CACjB,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IAEnC;;;;;;;;;;;;;;;OAeG;IACH,oBAAoB,CAAC,CACnB,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,wBAAwB,CAAC,CAAA;IAEpC;;;;;;;;;;;;;;;;OAgBG;IACH,WAAW,CAAC,CACV,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,UAAU,EAAE,EACnB,OAAO,EAAE,OAAO,EAChB,GAAG,CAAC,EAAE,kBAAkB,GACvB,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAA;IAE9B;;;;OAIG;IACH,gBAAgB,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAE3E;;;;;;;;OAQG;IACH,mBAAmB,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CACzD;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { Asset } from '@lifi/perps-types';
|
|
1
|
+
import type { ActionType, Asset } from '@lifi/perps-types';
|
|
2
|
+
import type { Address } from 'viem';
|
|
2
3
|
/**
|
|
3
4
|
* Which of a venue's two balance routes a withdrawal is drawn from. Lighter's
|
|
4
5
|
* own vocabulary, carried in the signed tx as `AssetRouteType` (`perps` = 0,
|
|
@@ -46,4 +47,32 @@ export interface WithdrawableBalance {
|
|
|
46
47
|
*/
|
|
47
48
|
withdrawalFee?: string;
|
|
48
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* The venue accepts a withdrawal to `destination` now.
|
|
52
|
+
*
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
export interface WithdrawFlowReady {
|
|
56
|
+
kind: 'ready';
|
|
57
|
+
destination: Address;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The venue cannot accept a withdrawal until the listed setup actions are
|
|
61
|
+
* satisfied — Ondo sends funds only to an address in its address book, behind
|
|
62
|
+
* a signed-in session.
|
|
63
|
+
*
|
|
64
|
+
* @public
|
|
65
|
+
*/
|
|
66
|
+
export interface WithdrawFlowSetupRequired {
|
|
67
|
+
kind: 'setupRequired';
|
|
68
|
+
/** Setup action types that must be completed, in execution order. */
|
|
69
|
+
setup: ActionType[];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The single withdrawal flow a venue offers one address, resolved from the
|
|
73
|
+
* venue's account and setup state.
|
|
74
|
+
*
|
|
75
|
+
* @public
|
|
76
|
+
*/
|
|
77
|
+
export type WithdrawFlow = WithdrawFlowReady | WithdrawFlowSetupRequired;
|
|
49
78
|
//# sourceMappingURL=withdrawal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withdrawal.d.ts","sourceRoot":"","sources":["../../../src/types/withdrawal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"withdrawal.d.ts","sourceRoot":"","sources":["../../../src/types/withdrawal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEnC;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,CAAA;AAE9C;;;;;GAKG;AACH,MAAM,WAAW,2BAA2B;IAC1C,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,eAAe,CAAA;IACtB,8EAA8E;IAC9E,SAAS,EAAE,MAAM,CAAA;IACjB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,KAAK,CAAA;IACZ,KAAK,EAAE,eAAe,CAAA;IACtB,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAA;IACjB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE,OAAO,CAAA;CACrB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,eAAe,CAAA;IACrB,qEAAqE;IACrE,KAAK,EAAE,UAAU,EAAE,CAAA;CACpB;AAED;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,iBAAiB,GAAG,yBAAyB,CAAA"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ActionType, SetupAction, SetupOption } from '@lifi/perps-types';
|
|
2
2
|
/**
|
|
3
|
-
* Select the `Provider.setup` descriptors a user
|
|
4
|
-
*
|
|
5
|
-
* signs on its own
|
|
6
|
-
*
|
|
3
|
+
* Select the `Provider.setup` descriptors a user sees: every choice step, and
|
|
4
|
+
* every non-choice step signed by {@link PerpsSigner.USER}. A non-choice step
|
|
5
|
+
* the SDK signs on its own is held back — `checkSetup` completes it inline, so
|
|
6
|
+
* surfacing it would render an inert card the user can't act on.
|
|
7
7
|
*
|
|
8
|
-
* Membership is a property of the descriptor
|
|
9
|
-
*
|
|
8
|
+
* Membership is a property of the descriptor alone, independent of any
|
|
9
|
+
* account. When an account is available, prefer `ProviderSetup.checklist`
|
|
10
10
|
* from `checkSetup` for the onboarding list — it applies this filter, omits
|
|
11
11
|
* not-required conditional steps, and carries each entry's satisfied state.
|
|
12
12
|
* This function remains the static, account-free projection.
|
|
@@ -14,5 +14,14 @@ import type { ProviderAction } from '@lifi/perps-types';
|
|
|
14
14
|
* @param setup The provider's `setup` descriptors, in their declared order.
|
|
15
15
|
* @public
|
|
16
16
|
*/
|
|
17
|
-
export declare function selectUserSetupActions(setup:
|
|
17
|
+
export declare function selectUserSetupActions(setup: SetupAction[]): SetupAction[];
|
|
18
|
+
/** Whether a setup step is shown to the user rather than drained silently. */
|
|
19
|
+
export declare function isUserFacingSetupStep(descriptor: SetupAction): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Narrow a setup option to the action it executes, so its bound `params` read
|
|
22
|
+
* with that action's param shape.
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
export declare function isSetupOptionFor<T extends ActionType>(option: SetupOption, type: T): option is SetupOption<T>;
|
|
18
27
|
//# sourceMappingURL=setupActions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupActions.d.ts","sourceRoot":"","sources":["../../../src/utils/setupActions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"setupActions.d.ts","sourceRoot":"","sources":["../../../src/utils/setupActions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAG7E;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,WAAW,EAAE,CAE1E;AAED,8EAA8E;AAC9E,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,WAAW,GAAG,OAAO,CAEtE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,UAAU,EACnD,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,CAAC,GACN,MAAM,IAAI,WAAW,CAAC,CAAC,CAAC,CAE1B"}
|
package/dist/types/version.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/perps-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "19.0.0",
|
|
4
4
|
"description": "LI.FI Perps SDK for perpetuals trading",
|
|
5
5
|
"homepage": "https://github.com/lifinance/perps-sdk",
|
|
6
6
|
"bugs": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"big.js": "^7.0.1",
|
|
47
47
|
"partysocket": "^1.1.19",
|
|
48
48
|
"viem": "^2.55.18",
|
|
49
|
-
"@lifi/perps-types": "^
|
|
49
|
+
"@lifi/perps-types": "^17.0.0"
|
|
50
50
|
},
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|