@lifi/perps-sdk 4.4.1 → 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.
- package/dist/cjs/client/PerpsClient.d.ts +3 -1
- package/dist/cjs/client/PerpsClient.d.ts.map +1 -1
- package/dist/cjs/client/PerpsClient.js +4 -0
- package/dist/cjs/client/PerpsClient.js.map +1 -1
- package/dist/cjs/index.d.ts +6 -4
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +13 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/services/getGasRecommendation.d.ts +9 -0
- package/dist/cjs/services/getGasRecommendation.d.ts.map +1 -0
- package/dist/cjs/services/getGasRecommendation.js +10 -0
- package/dist/cjs/services/getGasRecommendation.js.map +1 -0
- package/dist/cjs/types/api.d.ts +4 -0
- package/dist/cjs/types/api.d.ts.map +1 -1
- package/dist/cjs/types/deposit.d.ts +25 -0
- package/dist/cjs/types/deposit.d.ts.map +1 -0
- package/dist/cjs/types/deposit.js +3 -0
- package/dist/cjs/types/deposit.js.map +1 -0
- package/dist/cjs/types/provider.d.ts +5 -0
- package/dist/cjs/types/provider.d.ts.map +1 -1
- package/dist/cjs/utils/depositAssets.d.ts +8 -0
- package/dist/cjs/utils/depositAssets.d.ts.map +1 -0
- package/dist/cjs/utils/depositAssets.js +36 -0
- package/dist/cjs/utils/depositAssets.js.map +1 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/client/PerpsClient.d.ts +13 -1
- package/dist/esm/client/PerpsClient.d.ts.map +1 -1
- package/dist/esm/client/PerpsClient.js +14 -0
- package/dist/esm/client/PerpsClient.js.map +1 -1
- package/dist/esm/index.d.ts +7 -5
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +3 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/services/getGasRecommendation.d.ts +31 -0
- package/dist/esm/services/getGasRecommendation.d.ts.map +1 -0
- package/dist/esm/services/getGasRecommendation.js +22 -0
- package/dist/esm/services/getGasRecommendation.js.map +1 -0
- package/dist/esm/types/api.d.ts +9 -0
- package/dist/esm/types/api.d.ts.map +1 -1
- package/dist/esm/types/deposit.d.ts +68 -0
- package/dist/esm/types/deposit.d.ts.map +1 -0
- package/dist/esm/types/deposit.js +2 -0
- package/dist/esm/types/deposit.js.map +1 -0
- package/dist/esm/types/provider.d.ts +19 -0
- package/dist/esm/types/provider.d.ts.map +1 -1
- package/dist/esm/utils/depositAssets.d.ts +46 -0
- package/dist/esm/utils/depositAssets.d.ts.map +1 -0
- package/dist/esm/utils/depositAssets.js +71 -0
- package/dist/esm/utils/depositAssets.js.map +1 -0
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/client/PerpsClient.d.ts +13 -1
- package/dist/types/client/PerpsClient.d.ts.map +1 -1
- package/dist/types/index.d.ts +7 -5
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/services/getGasRecommendation.d.ts +31 -0
- package/dist/types/services/getGasRecommendation.d.ts.map +1 -0
- package/dist/types/types/api.d.ts +9 -0
- package/dist/types/types/api.d.ts.map +1 -1
- package/dist/types/types/deposit.d.ts +68 -0
- package/dist/types/types/deposit.d.ts.map +1 -0
- package/dist/types/types/provider.d.ts +19 -0
- package/dist/types/types/provider.d.ts.map +1 -1
- package/dist/types/utils/depositAssets.d.ts +46 -0
- package/dist/types/utils/depositAssets.d.ts.map +1 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +3 -3
- package/src/client/PerpsClient.ts +19 -0
- package/src/index.ts +22 -5
- package/src/services/getGasRecommendation.ts +45 -0
- package/src/types/api.ts +10 -0
- package/src/types/deposit.ts +75 -0
- package/src/types/provider.ts +24 -0
- package/src/utils/depositAssets.ts +77 -0
- package/src/version.ts +1 -1
- package/dist/cjs/utils/depositChain.d.ts +0 -6
- package/dist/cjs/utils/depositChain.d.ts.map +0 -1
- package/dist/cjs/utils/depositChain.js +0 -13
- package/dist/cjs/utils/depositChain.js.map +0 -1
- package/dist/esm/utils/depositChain.d.ts +0 -27
- package/dist/esm/utils/depositChain.d.ts.map +0 -1
- package/dist/esm/utils/depositChain.js +0 -23
- package/dist/esm/utils/depositChain.js.map +0 -1
- package/dist/types/utils/depositChain.d.ts +0 -27
- package/dist/types/utils/depositChain.d.ts.map +0 -1
- package/src/utils/depositChain.ts +0 -38
|
@@ -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 = '
|
|
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,CAIpC,CAAA;AASD,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,MAAM,GAClB,OAAO,GAAG,SAAS,CAErB"}
|
|
@@ -1,13 +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
|
-
};
|
|
10
|
-
function lifiDepositChainForProvider(providerKey) {
|
|
11
|
-
return exports.LIFI_DEPOSIT_CHAIN_BY_PROVIDER[providerKey];
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=depositChain.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"depositChain.js","sourceRoot":"","sources":["../../../src/utils/depositChain.ts"],"names":[],"mappings":";;;AAiCA,kEAIC;AApCD,uCAAqC;AAkBxB,QAAA,8BAA8B,GAEvC;IACF,WAAW,EAAE,eAAO,CAAC,GAAG;IACxB,OAAO,EAAE,eAAO,CAAC,GAAG;CACrB,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,CAIpC,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,MAAM,GAClB,OAAO,GAAG,SAAS,CAErB"}
|
|
@@ -1,23 +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
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Resolve the LI.FI deposit-target chain for a perps provider key.
|
|
15
|
-
*
|
|
16
|
-
* @returns The `@lifi/types` `ChainId`, or `undefined` for a provider key with
|
|
17
|
-
* no declared deposit chain (the `/providers` wire key is an open `string`).
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
export function lifiDepositChainForProvider(providerKey) {
|
|
21
|
-
return LIFI_DEPOSIT_CHAIN_BY_PROVIDER[providerKey];
|
|
22
|
-
}
|
|
23
|
-
//# 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;CACrB,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,CAIpC,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,MAAM,GAClB,OAAO,GAAG,SAAS,CAErB"}
|
|
@@ -1,38 +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
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Resolve the LI.FI deposit-target chain for a perps provider key.
|
|
29
|
-
*
|
|
30
|
-
* @returns The `@lifi/types` `ChainId`, or `undefined` for a provider key with
|
|
31
|
-
* no declared deposit chain (the `/providers` wire key is an open `string`).
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
|
-
export function lifiDepositChainForProvider(
|
|
35
|
-
providerKey: string
|
|
36
|
-
): ChainId | undefined {
|
|
37
|
-
return LIFI_DEPOSIT_CHAIN_BY_PROVIDER[providerKey as DepositProviderKey]
|
|
38
|
-
}
|