@lifi/perps-sdk 0.0.0-preview-c69c4cc → 0.0.0-preview-232a40e

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.
Files changed (66) hide show
  1. package/dist/cjs/client/PerpsClient.d.ts +13 -9
  2. package/dist/cjs/client/PerpsClient.d.ts.map +1 -1
  3. package/dist/cjs/client/PerpsClient.js +135 -52
  4. package/dist/cjs/client/PerpsClient.js.map +1 -1
  5. package/dist/cjs/index.d.ts +4 -4
  6. package/dist/cjs/index.d.ts.map +1 -1
  7. package/dist/cjs/index.js +2 -1
  8. package/dist/cjs/index.js.map +1 -1
  9. package/dist/cjs/types/api.d.ts +3 -6
  10. package/dist/cjs/types/api.d.ts.map +1 -1
  11. package/dist/cjs/types/provider.d.ts +5 -10
  12. package/dist/cjs/types/provider.d.ts.map +1 -1
  13. package/dist/cjs/types/withdrawal.d.ts +1 -11
  14. package/dist/cjs/types/withdrawal.d.ts.map +1 -1
  15. package/dist/cjs/utils/setupActions.d.ts +4 -2
  16. package/dist/cjs/utils/setupActions.d.ts.map +1 -1
  17. package/dist/cjs/utils/setupActions.js +9 -1
  18. package/dist/cjs/utils/setupActions.js.map +1 -1
  19. package/dist/cjs/utils/switchChain.js +1 -1
  20. package/dist/cjs/utils/switchChain.js.map +1 -1
  21. package/dist/cjs/version.d.ts +1 -1
  22. package/dist/cjs/version.js +1 -1
  23. package/dist/esm/client/PerpsClient.d.ts +63 -58
  24. package/dist/esm/client/PerpsClient.d.ts.map +1 -1
  25. package/dist/esm/client/PerpsClient.js +195 -102
  26. package/dist/esm/client/PerpsClient.js.map +1 -1
  27. package/dist/esm/index.d.ts +4 -4
  28. package/dist/esm/index.d.ts.map +1 -1
  29. package/dist/esm/index.js +1 -1
  30. package/dist/esm/index.js.map +1 -1
  31. package/dist/esm/types/api.d.ts +24 -23
  32. package/dist/esm/types/api.d.ts.map +1 -1
  33. package/dist/esm/types/provider.d.ts +17 -40
  34. package/dist/esm/types/provider.d.ts.map +1 -1
  35. package/dist/esm/types/withdrawal.d.ts +1 -30
  36. package/dist/esm/types/withdrawal.d.ts.map +1 -1
  37. package/dist/esm/utils/setupActions.d.ts +17 -8
  38. package/dist/esm/utils/setupActions.d.ts.map +1 -1
  39. package/dist/esm/utils/setupActions.js +20 -7
  40. package/dist/esm/utils/setupActions.js.map +1 -1
  41. package/dist/esm/utils/switchChain.js +1 -1
  42. package/dist/esm/utils/switchChain.js.map +1 -1
  43. package/dist/esm/version.d.ts +1 -1
  44. package/dist/esm/version.js +1 -1
  45. package/dist/types/client/PerpsClient.d.ts +63 -58
  46. package/dist/types/client/PerpsClient.d.ts.map +1 -1
  47. package/dist/types/index.d.ts +4 -4
  48. package/dist/types/index.d.ts.map +1 -1
  49. package/dist/types/types/api.d.ts +24 -23
  50. package/dist/types/types/api.d.ts.map +1 -1
  51. package/dist/types/types/provider.d.ts +17 -40
  52. package/dist/types/types/provider.d.ts.map +1 -1
  53. package/dist/types/types/withdrawal.d.ts +1 -30
  54. package/dist/types/types/withdrawal.d.ts.map +1 -1
  55. package/dist/types/utils/setupActions.d.ts +17 -8
  56. package/dist/types/utils/setupActions.d.ts.map +1 -1
  57. package/dist/types/version.d.ts +1 -1
  58. package/package.json +2 -2
  59. package/src/client/PerpsClient.ts +271 -136
  60. package/src/index.ts +4 -6
  61. package/src/types/api.ts +25 -24
  62. package/src/types/provider.ts +17 -47
  63. package/src/types/withdrawal.ts +1 -33
  64. package/src/utils/setupActions.ts +27 -13
  65. package/src/utils/switchChain.ts +1 -1
  66. package/src/version.ts +1 -1
@@ -1,5 +1,4 @@
1
- import type { ActionType, Asset } from '@lifi/perps-types';
2
- import type { Address } from 'viem';
1
+ import type { Asset } from '@lifi/perps-types';
3
2
  /**
4
3
  * Which of a venue's two balance routes a withdrawal is drawn from. Lighter's
5
4
  * own vocabulary, carried in the signed tx as `AssetRouteType` (`perps` = 0,
@@ -47,32 +46,4 @@ export interface WithdrawableBalance {
47
46
  */
48
47
  withdrawalFee?: string;
49
48
  }
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;
78
49
  //# 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,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
+ {"version":3,"file":"withdrawal.d.ts","sourceRoot":"","sources":["../../../src/types/withdrawal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE9C;;;;;;;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"}
@@ -1,12 +1,12 @@
1
- import type { ProviderAction } from '@lifi/perps-types';
1
+ import type { ActionType, SetupAction, SetupOption } from '@lifi/perps-types';
2
2
  /**
3
- * Select the `Provider.setup` descriptors a user is responsible for satisfying:
4
- * those whose `signers` include {@link PerpsSigner.USER}. Descriptors the SDK
5
- * signs on its own (no `USER` signer) are held back — `checkSetup` completes
6
- * them inline, so surfacing them would render inert cards the user can't act on.
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's `signers` alone, independent of
9
- * any account. When an account is available, prefer `ProviderSetup.checklist`
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: ProviderAction[]): ProviderAction[];
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,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAGvD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,cAAc,EAAE,GACtB,cAAc,EAAE,CAIlB"}
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"}
@@ -9,5 +9,5 @@ export declare const name = "@lifi/perps-sdk";
9
9
  *
10
10
  * @public
11
11
  */
12
- export declare const version = "0.0.0-preview-c69c4cc";
12
+ export declare const version = "0.0.0-preview-232a40e";
13
13
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/perps-sdk",
3
- "version": "0.0.0-preview-c69c4cc",
3
+ "version": "0.0.0-preview-232a40e",
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": "^0.0.0-preview-c69c4cc"
49
+ "@lifi/perps-types": "^0.0.0-preview-232a40e"
50
50
  },
51
51
  "publishConfig": {
52
52
  "access": "public"