@lifi/perps-sdk 4.4.2 → 5.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.
Files changed (87) hide show
  1. package/dist/cjs/client/PerpsClient.d.ts +3 -1
  2. package/dist/cjs/client/PerpsClient.d.ts.map +1 -1
  3. package/dist/cjs/client/PerpsClient.js +4 -0
  4. package/dist/cjs/client/PerpsClient.js.map +1 -1
  5. package/dist/cjs/index.d.ts +6 -4
  6. package/dist/cjs/index.d.ts.map +1 -1
  7. package/dist/cjs/index.js +13 -6
  8. package/dist/cjs/index.js.map +1 -1
  9. package/dist/cjs/services/getGasRecommendation.d.ts +9 -0
  10. package/dist/cjs/services/getGasRecommendation.d.ts.map +1 -0
  11. package/dist/cjs/services/getGasRecommendation.js +10 -0
  12. package/dist/cjs/services/getGasRecommendation.js.map +1 -0
  13. package/dist/cjs/types/api.d.ts +4 -0
  14. package/dist/cjs/types/api.d.ts.map +1 -1
  15. package/dist/cjs/types/deposit.d.ts +25 -0
  16. package/dist/cjs/types/deposit.d.ts.map +1 -0
  17. package/dist/cjs/types/deposit.js +3 -0
  18. package/dist/cjs/types/deposit.js.map +1 -0
  19. package/dist/cjs/types/provider.d.ts +5 -0
  20. package/dist/cjs/types/provider.d.ts.map +1 -1
  21. package/dist/cjs/utils/depositAssets.d.ts +8 -0
  22. package/dist/cjs/utils/depositAssets.d.ts.map +1 -0
  23. package/dist/cjs/utils/depositAssets.js +36 -0
  24. package/dist/cjs/utils/depositAssets.js.map +1 -0
  25. package/dist/cjs/version.d.ts +1 -1
  26. package/dist/cjs/version.js +1 -1
  27. package/dist/esm/client/PerpsClient.d.ts +13 -1
  28. package/dist/esm/client/PerpsClient.d.ts.map +1 -1
  29. package/dist/esm/client/PerpsClient.js +14 -0
  30. package/dist/esm/client/PerpsClient.js.map +1 -1
  31. package/dist/esm/index.d.ts +7 -5
  32. package/dist/esm/index.d.ts.map +1 -1
  33. package/dist/esm/index.js +3 -2
  34. package/dist/esm/index.js.map +1 -1
  35. package/dist/esm/services/getGasRecommendation.d.ts +31 -0
  36. package/dist/esm/services/getGasRecommendation.d.ts.map +1 -0
  37. package/dist/esm/services/getGasRecommendation.js +22 -0
  38. package/dist/esm/services/getGasRecommendation.js.map +1 -0
  39. package/dist/esm/types/api.d.ts +9 -0
  40. package/dist/esm/types/api.d.ts.map +1 -1
  41. package/dist/esm/types/deposit.d.ts +68 -0
  42. package/dist/esm/types/deposit.d.ts.map +1 -0
  43. package/dist/esm/types/deposit.js +2 -0
  44. package/dist/esm/types/deposit.js.map +1 -0
  45. package/dist/esm/types/provider.d.ts +19 -0
  46. package/dist/esm/types/provider.d.ts.map +1 -1
  47. package/dist/esm/utils/depositAssets.d.ts +46 -0
  48. package/dist/esm/utils/depositAssets.d.ts.map +1 -0
  49. package/dist/esm/utils/depositAssets.js +71 -0
  50. package/dist/esm/utils/depositAssets.js.map +1 -0
  51. package/dist/esm/version.d.ts +1 -1
  52. package/dist/esm/version.js +1 -1
  53. package/dist/types/client/PerpsClient.d.ts +13 -1
  54. package/dist/types/client/PerpsClient.d.ts.map +1 -1
  55. package/dist/types/index.d.ts +7 -5
  56. package/dist/types/index.d.ts.map +1 -1
  57. package/dist/types/services/getGasRecommendation.d.ts +31 -0
  58. package/dist/types/services/getGasRecommendation.d.ts.map +1 -0
  59. package/dist/types/types/api.d.ts +9 -0
  60. package/dist/types/types/api.d.ts.map +1 -1
  61. package/dist/types/types/deposit.d.ts +68 -0
  62. package/dist/types/types/deposit.d.ts.map +1 -0
  63. package/dist/types/types/provider.d.ts +19 -0
  64. package/dist/types/types/provider.d.ts.map +1 -1
  65. package/dist/types/utils/depositAssets.d.ts +46 -0
  66. package/dist/types/utils/depositAssets.d.ts.map +1 -0
  67. package/dist/types/version.d.ts +1 -1
  68. package/package.json +2 -2
  69. package/src/client/PerpsClient.ts +19 -0
  70. package/src/index.ts +22 -5
  71. package/src/services/getGasRecommendation.ts +45 -0
  72. package/src/types/api.ts +10 -0
  73. package/src/types/deposit.ts +75 -0
  74. package/src/types/provider.ts +24 -0
  75. package/src/utils/depositAssets.ts +77 -0
  76. package/src/version.ts +1 -1
  77. package/dist/cjs/utils/depositChain.d.ts +0 -6
  78. package/dist/cjs/utils/depositChain.d.ts.map +0 -1
  79. package/dist/cjs/utils/depositChain.js +0 -14
  80. package/dist/cjs/utils/depositChain.js.map +0 -1
  81. package/dist/esm/utils/depositChain.d.ts +0 -27
  82. package/dist/esm/utils/depositChain.d.ts.map +0 -1
  83. package/dist/esm/utils/depositChain.js +0 -24
  84. package/dist/esm/utils/depositChain.js.map +0 -1
  85. package/dist/types/utils/depositChain.d.ts +0 -27
  86. package/dist/types/utils/depositChain.d.ts.map +0 -1
  87. package/src/utils/depositChain.ts +0 -39
@@ -0,0 +1,77 @@
1
+ import { ChainId } from '@lifi/types'
2
+ import { zeroAddress } from 'viem'
3
+ import type { DeclaredDepositAsset } from '../types/deposit.js'
4
+
5
+ /**
6
+ * USDC on Ethereum mainnet — the collateral leg of Lighter's first-deposit
7
+ * pipeline, and the token Ondo's provisioned deposit address is funded in.
8
+ *
9
+ * @public
10
+ */
11
+ export const ETHEREUM_USDC: DeclaredDepositAsset = {
12
+ chainId: ChainId.ETH,
13
+ address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
14
+ decimals: 6,
15
+ }
16
+
17
+ /**
18
+ * Ether on Ethereum mainnet, to broadcast the first-deposit pipeline's legs
19
+ * with.
20
+ *
21
+ * @public
22
+ */
23
+ export const ETHEREUM_NATIVE_GAS: DeclaredDepositAsset = {
24
+ chainId: ChainId.ETH,
25
+ address: zeroAddress,
26
+ decimals: 18,
27
+ }
28
+
29
+ /**
30
+ * USDC on the Hyperliquid venue chain: the 6-decimal perps contract. The same
31
+ * chain also lists an 8-decimal spot `USDC` at
32
+ * `0x6d1e7cde53bA9467B783Cb7c530CE05400000000`, so a deposit destination
33
+ * resolved by symbol lands on the wrong token and the wrong scale.
34
+ *
35
+ * @public
36
+ */
37
+ export const HYPERLIQUID_USDC: DeclaredDepositAsset = {
38
+ chainId: ChainId.HPL,
39
+ address: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831',
40
+ decimals: 6,
41
+ }
42
+
43
+ /**
44
+ * USDC on the Lighter venue chain. The venue chain reuses the mainnet USDC
45
+ * address, so `chainId` is what distinguishes it from {@link ETHEREUM_USDC}.
46
+ *
47
+ * @public
48
+ */
49
+ export const LIGHTER_USDC: DeclaredDepositAsset = {
50
+ chainId: ChainId.LTR,
51
+ address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
52
+ decimals: 6,
53
+ }
54
+
55
+ /**
56
+ * USDG on Robinhood Chain — the collateral the Lighter Robinhood instance is
57
+ * funded in.
58
+ *
59
+ * @public
60
+ */
61
+ export const ROBINHOOD_USDG: DeclaredDepositAsset = {
62
+ chainId: ChainId.OUT,
63
+ address: '0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168',
64
+ decimals: 6,
65
+ }
66
+
67
+ /**
68
+ * Ether on Robinhood Chain, to broadcast the Robinhood first-deposit pipeline's
69
+ * legs with.
70
+ *
71
+ * @public
72
+ */
73
+ export const ROBINHOOD_NATIVE_GAS: DeclaredDepositAsset = {
74
+ chainId: ChainId.OUT,
75
+ address: zeroAddress,
76
+ decimals: 18,
77
+ }
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export const name = '@lifi/perps-sdk'
2
- export const version = '4.4.2'
2
+ export const version = '5.0.0'
@@ -1,6 +0,0 @@
1
- import type { AccountConfig } from '@lifi/perps-types';
2
- import { ChainId } from '@lifi/types';
3
- export type DepositProviderKey = AccountConfig['provider'];
4
- export declare const LIFI_DEPOSIT_CHAIN_BY_PROVIDER: Partial<Record<DepositProviderKey, ChainId>>;
5
- export declare function lifiDepositChainForProvider(providerKey: string): ChainId | undefined;
6
- //# sourceMappingURL=depositChain.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"depositChain.d.ts","sourceRoot":"","sources":["../../../src/utils/depositChain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AASrC,MAAM,MAAM,kBAAkB,GAAG,aAAa,CAAC,UAAU,CAAC,CAAA;AAS1D,eAAO,MAAM,8BAA8B,EAAE,OAAO,CAClD,MAAM,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAKpC,CAAA;AASD,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,MAAM,GAClB,OAAO,GAAG,SAAS,CAErB"}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LIFI_DEPOSIT_CHAIN_BY_PROVIDER = void 0;
4
- exports.lifiDepositChainForProvider = lifiDepositChainForProvider;
5
- const types_1 = require("@lifi/types");
6
- exports.LIFI_DEPOSIT_CHAIN_BY_PROVIDER = {
7
- hyperliquid: types_1.ChainId.HPL,
8
- lighter: types_1.ChainId.LTR,
9
- 'lighter-rh': types_1.ChainId.OUT,
10
- };
11
- function lifiDepositChainForProvider(providerKey) {
12
- return exports.LIFI_DEPOSIT_CHAIN_BY_PROVIDER[providerKey];
13
- }
14
- //# sourceMappingURL=depositChain.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"depositChain.js","sourceRoot":"","sources":["../../../src/utils/depositChain.ts"],"names":[],"mappings":";;;AAkCA,kEAIC;AArCD,uCAAqC;AAkBxB,QAAA,8BAA8B,GAEvC;IACF,WAAW,EAAE,eAAO,CAAC,GAAG;IACxB,OAAO,EAAE,eAAO,CAAC,GAAG;IACpB,YAAY,EAAE,eAAO,CAAC,GAAG;CAC1B,CAAA;AASD,SAAgB,2BAA2B,CACzC,WAAmB;IAEnB,OAAO,sCAA8B,CAAC,WAAiC,CAAC,CAAA;AAC1E,CAAC"}
@@ -1,27 +0,0 @@
1
- import type { AccountConfig } from '@lifi/perps-types';
2
- import { ChainId } from '@lifi/types';
3
- /**
4
- * Perps provider keys that may declare a LI.FI deposit-target chain. Absent
5
- * from the map means the provider is not funded via a LI.FI swap (e.g. ondo's
6
- * custodial provisioned-address deposits).
7
- *
8
- * @public
9
- */
10
- export type DepositProviderKey = AccountConfig['provider'];
11
- /**
12
- * Declared single source of truth: perps provider key → the LI.FI chain a
13
- * client opens the swap widget against to fund that provider. Values come from
14
- * the `@lifi/types` `ChainId` enum; never hardcode the numeric ids.
15
- *
16
- * @public
17
- */
18
- export declare const LIFI_DEPOSIT_CHAIN_BY_PROVIDER: Partial<Record<DepositProviderKey, ChainId>>;
19
- /**
20
- * Resolve the LI.FI deposit-target chain for a perps provider key.
21
- *
22
- * @returns The `@lifi/types` `ChainId`, or `undefined` for a provider key with
23
- * no declared deposit chain (the `/providers` wire key is an open `string`).
24
- * @public
25
- */
26
- export declare function lifiDepositChainForProvider(providerKey: string): ChainId | undefined;
27
- //# sourceMappingURL=depositChain.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"depositChain.d.ts","sourceRoot":"","sources":["../../../src/utils/depositChain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAErC;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG,aAAa,CAAC,UAAU,CAAC,CAAA;AAE1D;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,EAAE,OAAO,CAClD,MAAM,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAKpC,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,MAAM,GAClB,OAAO,GAAG,SAAS,CAErB"}
@@ -1,24 +0,0 @@
1
- import { ChainId } from '@lifi/types';
2
- /**
3
- * Declared single source of truth: perps provider key → the LI.FI chain a
4
- * client opens the swap widget against to fund that provider. Values come from
5
- * the `@lifi/types` `ChainId` enum; never hardcode the numeric ids.
6
- *
7
- * @public
8
- */
9
- export const LIFI_DEPOSIT_CHAIN_BY_PROVIDER = {
10
- hyperliquid: ChainId.HPL,
11
- lighter: ChainId.LTR,
12
- 'lighter-rh': ChainId.OUT,
13
- };
14
- /**
15
- * Resolve the LI.FI deposit-target chain for a perps provider key.
16
- *
17
- * @returns The `@lifi/types` `ChainId`, or `undefined` for a provider key with
18
- * no declared deposit chain (the `/providers` wire key is an open `string`).
19
- * @public
20
- */
21
- export function lifiDepositChainForProvider(providerKey) {
22
- return LIFI_DEPOSIT_CHAIN_BY_PROVIDER[providerKey];
23
- }
24
- //# sourceMappingURL=depositChain.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"depositChain.js","sourceRoot":"","sources":["../../../src/utils/depositChain.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAWrC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAEvC;IACF,WAAW,EAAE,OAAO,CAAC,GAAG;IACxB,OAAO,EAAE,OAAO,CAAC,GAAG;IACpB,YAAY,EAAE,OAAO,CAAC,GAAG;CAC1B,CAAA;AAED;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CACzC,WAAmB;IAEnB,OAAO,8BAA8B,CAAC,WAAiC,CAAC,CAAA;AAC1E,CAAC"}
@@ -1,27 +0,0 @@
1
- import type { AccountConfig } from '@lifi/perps-types';
2
- import { ChainId } from '@lifi/types';
3
- /**
4
- * Perps provider keys that may declare a LI.FI deposit-target chain. Absent
5
- * from the map means the provider is not funded via a LI.FI swap (e.g. ondo's
6
- * custodial provisioned-address deposits).
7
- *
8
- * @public
9
- */
10
- export type DepositProviderKey = AccountConfig['provider'];
11
- /**
12
- * Declared single source of truth: perps provider key → the LI.FI chain a
13
- * client opens the swap widget against to fund that provider. Values come from
14
- * the `@lifi/types` `ChainId` enum; never hardcode the numeric ids.
15
- *
16
- * @public
17
- */
18
- export declare const LIFI_DEPOSIT_CHAIN_BY_PROVIDER: Partial<Record<DepositProviderKey, ChainId>>;
19
- /**
20
- * Resolve the LI.FI deposit-target chain for a perps provider key.
21
- *
22
- * @returns The `@lifi/types` `ChainId`, or `undefined` for a provider key with
23
- * no declared deposit chain (the `/providers` wire key is an open `string`).
24
- * @public
25
- */
26
- export declare function lifiDepositChainForProvider(providerKey: string): ChainId | undefined;
27
- //# sourceMappingURL=depositChain.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"depositChain.d.ts","sourceRoot":"","sources":["../../../src/utils/depositChain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAErC;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG,aAAa,CAAC,UAAU,CAAC,CAAA;AAE1D;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,EAAE,OAAO,CAClD,MAAM,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAKpC,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,MAAM,GAClB,OAAO,GAAG,SAAS,CAErB"}
@@ -1,39 +0,0 @@
1
- import type { AccountConfig } from '@lifi/perps-types'
2
- import { ChainId } from '@lifi/types'
3
-
4
- /**
5
- * Perps provider keys that may declare a LI.FI deposit-target chain. Absent
6
- * from the map means the provider is not funded via a LI.FI swap (e.g. ondo's
7
- * custodial provisioned-address deposits).
8
- *
9
- * @public
10
- */
11
- export type DepositProviderKey = AccountConfig['provider']
12
-
13
- /**
14
- * Declared single source of truth: perps provider key → the LI.FI chain a
15
- * client opens the swap widget against to fund that provider. Values come from
16
- * the `@lifi/types` `ChainId` enum; never hardcode the numeric ids.
17
- *
18
- * @public
19
- */
20
- export const LIFI_DEPOSIT_CHAIN_BY_PROVIDER: Partial<
21
- Record<DepositProviderKey, ChainId>
22
- > = {
23
- hyperliquid: ChainId.HPL,
24
- lighter: ChainId.LTR,
25
- 'lighter-rh': ChainId.OUT,
26
- }
27
-
28
- /**
29
- * Resolve the LI.FI deposit-target chain for a perps provider key.
30
- *
31
- * @returns The `@lifi/types` `ChainId`, or `undefined` for a provider key with
32
- * no declared deposit chain (the `/providers` wire key is an open `string`).
33
- * @public
34
- */
35
- export function lifiDepositChainForProvider(
36
- providerKey: string
37
- ): ChainId | undefined {
38
- return LIFI_DEPOSIT_CHAIN_BY_PROVIDER[providerKey as DepositProviderKey]
39
- }