@lifi/sdk 3.8.10 → 3.9.0-beta.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/package.json +3 -2
- package/src/_cjs/core/EVM/EVM.js +2 -2
- package/src/_cjs/core/EVM/EVM.js.map +1 -1
- package/src/_cjs/core/EVM/EVMStepExecutor.js +3 -1
- package/src/_cjs/core/EVM/EVMStepExecutor.js.map +1 -1
- package/src/_cjs/core/EVM/publicClient.js +8 -0
- package/src/_cjs/core/EVM/publicClient.js.map +1 -1
- package/src/_cjs/core/EVM/{getENSAddress.js → resolveENSAddress.js} +4 -4
- package/src/_cjs/core/EVM/resolveENSAddress.js.map +1 -0
- package/src/_cjs/core/EVM/resolveEVMAddress.js +11 -0
- package/src/_cjs/core/EVM/resolveEVMAddress.js.map +1 -0
- package/src/_cjs/core/EVM/uns/constants.js +78 -0
- package/src/_cjs/core/EVM/uns/constants.js.map +1 -0
- package/src/_cjs/core/EVM/uns/resolveUNSAddress.js +82 -0
- package/src/_cjs/core/EVM/uns/resolveUNSAddress.js.map +1 -0
- package/src/_cjs/core/Solana/Solana.js +2 -2
- package/src/_cjs/core/Solana/Solana.js.map +1 -1
- package/src/_cjs/core/Solana/resolveSolanaAddress.js +8 -0
- package/src/_cjs/core/Solana/resolveSolanaAddress.js.map +1 -0
- package/src/_cjs/core/Sui/Sui.js +2 -2
- package/src/_cjs/core/Sui/Sui.js.map +1 -1
- package/src/_cjs/core/Sui/resolveSuiAddress.js +8 -0
- package/src/_cjs/core/Sui/resolveSuiAddress.js.map +1 -0
- package/src/_cjs/core/UTXO/UTXO.js +2 -3
- package/src/_cjs/core/UTXO/UTXO.js.map +1 -1
- package/src/_cjs/core/UTXO/UTXOStepExecutor.js +25 -1
- package/src/_cjs/core/UTXO/UTXOStepExecutor.js.map +1 -1
- package/src/_cjs/core/UTXO/resolveUTXOAddress.js +7 -0
- package/src/_cjs/core/UTXO/resolveUTXOAddress.js.map +1 -0
- package/src/_cjs/core/UTXO/utils.js +3 -0
- package/src/_cjs/core/UTXO/utils.js.map +1 -1
- package/src/_cjs/version.js +1 -1
- package/src/_cjs/version.js.map +1 -1
- package/src/_esm/core/EVM/EVM.js +2 -2
- package/src/_esm/core/EVM/EVM.js.map +1 -1
- package/src/_esm/core/EVM/EVMStepExecutor.js +3 -1
- package/src/_esm/core/EVM/EVMStepExecutor.js.map +1 -1
- package/src/_esm/core/EVM/publicClient.js +9 -0
- package/src/_esm/core/EVM/publicClient.js.map +1 -1
- package/src/_esm/core/EVM/{getENSAddress.js → resolveENSAddress.js} +2 -2
- package/src/_esm/core/EVM/resolveENSAddress.js.map +1 -0
- package/src/_esm/core/EVM/resolveEVMAddress.js +8 -0
- package/src/_esm/core/EVM/resolveEVMAddress.js.map +1 -0
- package/src/_esm/core/EVM/uns/constants.js +74 -0
- package/src/_esm/core/EVM/uns/constants.js.map +1 -0
- package/src/_esm/core/EVM/uns/resolveUNSAddress.js +80 -0
- package/src/_esm/core/EVM/uns/resolveUNSAddress.js.map +1 -0
- package/src/_esm/core/Solana/Solana.js +2 -2
- package/src/_esm/core/Solana/Solana.js.map +1 -1
- package/src/_esm/core/Solana/resolveSolanaAddress.js +5 -0
- package/src/_esm/core/Solana/resolveSolanaAddress.js.map +1 -0
- package/src/_esm/core/Sui/Sui.js +2 -2
- package/src/_esm/core/Sui/Sui.js.map +1 -1
- package/src/_esm/core/Sui/resolveSuiAddress.js +5 -0
- package/src/_esm/core/Sui/resolveSuiAddress.js.map +1 -0
- package/src/_esm/core/UTXO/UTXO.js +2 -4
- package/src/_esm/core/UTXO/UTXO.js.map +1 -1
- package/src/_esm/core/UTXO/UTXOStepExecutor.js +35 -4
- package/src/_esm/core/UTXO/UTXOStepExecutor.js.map +1 -1
- package/src/_esm/core/UTXO/resolveUTXOAddress.js +5 -0
- package/src/_esm/core/UTXO/resolveUTXOAddress.js.map +1 -0
- package/src/_esm/core/UTXO/utils.js +2 -0
- package/src/_esm/core/UTXO/utils.js.map +1 -1
- package/src/_esm/version.js +1 -1
- package/src/_esm/version.js.map +1 -1
- package/src/_types/core/EVM/EVMStepExecutor.d.ts.map +1 -1
- package/src/_types/core/EVM/publicClient.d.ts.map +1 -1
- package/src/_types/core/EVM/resolveENSAddress.d.ts +2 -0
- package/src/_types/core/EVM/resolveENSAddress.d.ts.map +1 -0
- package/src/_types/core/EVM/resolveEVMAddress.d.ts +3 -0
- package/src/_types/core/EVM/resolveEVMAddress.d.ts.map +1 -0
- package/src/_types/core/EVM/uns/constants.d.ts +51 -0
- package/src/_types/core/EVM/uns/constants.d.ts.map +1 -0
- package/src/_types/core/EVM/uns/resolveUNSAddress.d.ts +3 -0
- package/src/_types/core/EVM/uns/resolveUNSAddress.d.ts.map +1 -0
- package/src/_types/core/Solana/resolveSolanaAddress.d.ts +2 -0
- package/src/_types/core/Solana/resolveSolanaAddress.d.ts.map +1 -0
- package/src/_types/core/Sui/resolveSuiAddress.d.ts +2 -0
- package/src/_types/core/Sui/resolveSuiAddress.d.ts.map +1 -0
- package/src/_types/core/UTXO/UTXO.d.ts.map +1 -1
- package/src/_types/core/UTXO/UTXOStepExecutor.d.ts.map +1 -1
- package/src/_types/core/UTXO/resolveUTXOAddress.d.ts +2 -0
- package/src/_types/core/UTXO/resolveUTXOAddress.d.ts.map +1 -0
- package/src/_types/core/UTXO/utils.d.ts +1 -0
- package/src/_types/core/UTXO/utils.d.ts.map +1 -1
- package/src/_types/core/types.d.ts +2 -2
- package/src/_types/core/types.d.ts.map +1 -1
- package/src/_types/version.d.ts +1 -1
- package/src/_types/version.d.ts.map +1 -1
- package/src/core/EVM/EVM.ts +2 -2
- package/src/core/EVM/EVMStepExecutor.ts +3 -1
- package/src/core/EVM/publicClient.ts +13 -1
- package/src/core/EVM/{getENSAddress.ts → resolveENSAddress.ts} +1 -1
- package/src/core/EVM/resolveEVMAddress.ts +15 -0
- package/src/core/EVM/uns/constants.ts +81 -0
- package/src/core/EVM/uns/resolveUNSAddress.ts +123 -0
- package/src/core/Solana/Solana.ts +2 -2
- package/src/core/Solana/resolveSolanaAddress.ts +7 -0
- package/src/core/Sui/Sui.ts +2 -2
- package/src/core/Sui/resolveSuiAddress.ts +7 -0
- package/src/core/UTXO/UTXO.ts +2 -4
- package/src/core/UTXO/UTXOStepExecutor.ts +48 -4
- package/src/core/UTXO/resolveUTXOAddress.ts +6 -0
- package/src/core/UTXO/utils.ts +4 -0
- package/src/core/types.ts +7 -1
- package/src/version.ts +1 -1
- package/src/_cjs/core/EVM/getENSAddress.js.map +0 -1
- package/src/_esm/core/EVM/getENSAddress.js.map +0 -1
- package/src/_types/core/EVM/getENSAddress.d.ts +0 -2
- package/src/_types/core/EVM/getENSAddress.d.ts.map +0 -1
package/src/_esm/version.js
CHANGED
package/src/_esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG,WAAW,CAAA;AAC/B,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG,WAAW,CAAA;AAC/B,MAAM,CAAC,MAAM,OAAO,GAAG,cAAc,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EVMStepExecutor.d.ts","sourceRoot":"","sources":["../../../core/EVM/EVMStepExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAA6B,MAAM,aAAa,CAAA;AAC3E,OAAO,KAAK,EAEV,MAAM,EAEN,IAAI,EAIL,MAAM,MAAM,CAAA;AAkBb,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAGzD,OAAO,KAAK,EACV,gBAAgB,EAChB,OAAO,EACP,mBAAmB,EACnB,qBAAqB,EAEtB,MAAM,aAAa,CAAA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U,2EAQzB;QACD,IAAI,EAAE,gBAAgB,CAAA;QACtB,OAAO,EAAE,OAAO,CAAA;QAChB,SAAS,EAAE,aAAa,CAAA;QACxB,OAAO,EAAE,aAAa,CAAA;QACtB,MAAM,EAAE,qBAAqB,CAAA;QAC7B,MAAM,EAAE,IAAI,CAAA;QACZ,iBAAiB,EAAE,OAAO,CAAA;KAC3B,mBA4DA;IAED,OAAO,CAAC,cAAc,CAgCrB;IAED,WAAW,GACT,MAAM,gBAAgB,EAEtB,2BAAyB,KACxB,OAAO,CAAC,gBAAgB,CAAC,CAod3B;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publicClient.d.ts","sourceRoot":"","sources":["../../../core/EVM/publicClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"publicClient.d.ts","sourceRoot":"","sources":["../../../core/EVM/publicClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAWlC;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAU,SAAS,MAAM,KAAG,OAAO,CAAC,MAAM,CAwDrE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveENSAddress.d.ts","sourceRoot":"","sources":["../../../core/EVM/resolveENSAddress.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB,GAC5B,MAAM,MAAM,KACX,OAAO,CAAC,MAAM,GAAG,SAAS,CAW5B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveEVMAddress.d.ts","sourceRoot":"","sources":["../../../core/EVM/resolveEVMAddress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAKnD,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,OAAO,EACjB,KAAK,CAAC,EAAE,OAAO,GACd,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAK7B"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ChainId, ChainType } from '@lifi/types';
|
|
2
|
+
import type { Address } from 'viem';
|
|
3
|
+
export declare const UNS_PROXY_READER_ADDRESSES: Record<number, Address>;
|
|
4
|
+
export declare const getUNSProxyAddress: (chainId: number) => Address | undefined;
|
|
5
|
+
export declare const UNSProxyReaderABI: readonly [{
|
|
6
|
+
readonly constant: true;
|
|
7
|
+
readonly inputs: readonly [{
|
|
8
|
+
readonly internalType: "string[]";
|
|
9
|
+
readonly name: "keys";
|
|
10
|
+
readonly type: "string[]";
|
|
11
|
+
}, {
|
|
12
|
+
readonly internalType: "uint256";
|
|
13
|
+
readonly name: "tokenId";
|
|
14
|
+
readonly type: "uint256";
|
|
15
|
+
}];
|
|
16
|
+
readonly name: "getData";
|
|
17
|
+
readonly outputs: readonly [{
|
|
18
|
+
readonly internalType: "address";
|
|
19
|
+
readonly name: "resolver";
|
|
20
|
+
readonly type: "address";
|
|
21
|
+
}, {
|
|
22
|
+
readonly internalType: "address";
|
|
23
|
+
readonly name: "owner";
|
|
24
|
+
readonly type: "address";
|
|
25
|
+
}, {
|
|
26
|
+
readonly internalType: "string[]";
|
|
27
|
+
readonly name: "values";
|
|
28
|
+
readonly type: "string[]";
|
|
29
|
+
}];
|
|
30
|
+
readonly payable: false;
|
|
31
|
+
readonly stateMutability: "view";
|
|
32
|
+
readonly type: "function";
|
|
33
|
+
}, {
|
|
34
|
+
readonly inputs: readonly [{
|
|
35
|
+
readonly internalType: "uint256";
|
|
36
|
+
readonly name: "tokenId";
|
|
37
|
+
readonly type: "uint256";
|
|
38
|
+
}];
|
|
39
|
+
readonly name: "exists";
|
|
40
|
+
readonly outputs: readonly [{
|
|
41
|
+
readonly internalType: "bool";
|
|
42
|
+
readonly name: "";
|
|
43
|
+
readonly type: "bool";
|
|
44
|
+
}];
|
|
45
|
+
readonly stateMutability: "view";
|
|
46
|
+
readonly type: "function";
|
|
47
|
+
}];
|
|
48
|
+
export declare const CHAIN_TYPE_UNS_CHAIN_MAP: Record<ChainType, string>;
|
|
49
|
+
export declare const CHAIN_ID_UNS_CHAIN_MAP: Partial<Record<ChainId, string>>;
|
|
50
|
+
export declare const CHAIN_TYPE_FAMILY_MAP: Record<ChainType, string>;
|
|
51
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../core/EVM/uns/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEnC,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAGrD,CAAA;AAEV,eAAO,MAAM,kBAAkB,GAAI,SAAS,MAAM,KAAG,OAAO,GAAG,SAC1B,CAAA;AAErC,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4CpB,CAAA;AAEV,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAK9D,CAAA;AAED,eAAO,MAAM,sBAAsB,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CASnE,CAAA;AAED,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAK3D,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveUNSAddress.d.ts","sourceRoot":"","sources":["../../../../core/EVM/uns/resolveUNSAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAA;AAenE,eAAO,MAAM,iBAAiB,GAC5B,MAAM,MAAM,EACZ,WAAW,SAAS,EACpB,QAAQ,OAAO,EACf,QAAQ,OAAO,KACd,OAAO,CAAC,MAAM,GAAG,SAAS,CAyC5B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveSolanaAddress.d.ts","sourceRoot":"","sources":["../../../core/Solana/resolveSolanaAddress.ts"],"names":[],"mappings":"AAEA,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAE7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveSuiAddress.d.ts","sourceRoot":"","sources":["../../../core/Sui/resolveSuiAddress.ts"],"names":[],"mappings":"AAEA,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAE7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UTXO.d.ts","sourceRoot":"","sources":["../../../core/UTXO/UTXO.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UTXO.d.ts","sourceRoot":"","sources":["../../../core/UTXO/UTXO.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAGnE,wBAAgB,IAAI,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,YAAY,CAgChE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UTXOStepExecutor.d.ts","sourceRoot":"","sources":["../../../core/UTXO/UTXOStepExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"UTXOStepExecutor.d.ts","sourceRoot":"","sources":["../../../core/UTXO/UTXOStepExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAA;AAgB5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAGzD,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EAEpB,MAAM,aAAa,CAAA;AAMpB,MAAM,WAAW,uBAAwB,SAAQ,mBAAmB;IAClE,MAAM,EAAE,MAAM,CAAA;CACf;AAED,qBAAa,gBAAiB,SAAQ,gBAAgB;IACpD,OAAO,CAAC,MAAM,CAAQ;gBAEV,OAAO,EAAE,uBAAuB;IAK5C,WAAW,GAAI,MAAM,gBAAgB,UASpC;IAED,WAAW,GAAU,MAAM,gBAAgB,KAAG,OAAO,CAAC,gBAAgB,CAAC,CAiRtE;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveUTXOAddress.d.ts","sourceRoot":"","sources":["../../../core/UTXO/resolveUTXOAddress.ts"],"names":[],"mappings":"AAAA,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAG7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../core/UTXO/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAEzC,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAOnD"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../core/UTXO/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAEzC,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAOnD;AAGD,eAAO,MAAM,OAAO,GAAI,QAAQ,UAAU,gCACc,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ChainType, FeeCost, GasCost, LiFiStep, Route, Step, Substatus, Token, TokenAmount } from '@lifi/types';
|
|
1
|
+
import type { ChainId, ChainType, CoinKey, FeeCost, GasCost, LiFiStep, Route, Step, Substatus, Token, TokenAmount } from '@lifi/types';
|
|
2
2
|
import type { Client } from 'viem';
|
|
3
3
|
export interface SDKProvider {
|
|
4
4
|
readonly type: ChainType;
|
|
5
5
|
isAddress(address: string): boolean;
|
|
6
|
-
resolveAddress(name: string): Promise<string | undefined>;
|
|
6
|
+
resolveAddress(name: string, chainId?: ChainId, token?: CoinKey): Promise<string | undefined>;
|
|
7
7
|
getStepExecutor(options: StepExecutorOptions): Promise<StepExecutor>;
|
|
8
8
|
getBalance(walletAddress: string, tokens: Token[]): Promise<TokenAmount[]>;
|
|
9
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../core/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,OAAO,EACP,OAAO,EACP,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,SAAS,EACT,KAAK,EACL,WAAW,EACZ,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAElC,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;IACxB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAA;IACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../core/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,SAAS,EACT,OAAO,EACP,OAAO,EACP,OAAO,EACP,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,SAAS,EACT,KAAK,EACL,WAAW,EACZ,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAElC,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC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AAA;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;QACrB,OAAO,EAAE,MAAM,CAAA;QACf,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,CAAA;IAGD,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB,CAAA;AAED,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,KAAK,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAA;CACrB;AAED,MAAM,MAAM,qBAAqB,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAA"}
|
package/src/_types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,cAAc,CAAA;AAC/B,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,cAAc,CAAA;AAC/B,eAAO,MAAM,OAAO,iBAAiB,CAAA"}
|
package/src/core/EVM/EVM.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { ChainType } from '@lifi/types'
|
|
|
2
2
|
import { isAddress } from 'viem'
|
|
3
3
|
import type { StepExecutorOptions } from '../types.js'
|
|
4
4
|
import { EVMStepExecutor } from './EVMStepExecutor.js'
|
|
5
|
-
import { getENSAddress } from './getENSAddress.js'
|
|
6
5
|
import { getEVMBalance } from './getEVMBalance.js'
|
|
6
|
+
import { resolveEVMAddress } from './resolveEVMAddress.js'
|
|
7
7
|
import type { EVMProvider, EVMProviderOptions } from './types.js'
|
|
8
8
|
|
|
9
9
|
export function EVM(options?: EVMProviderOptions): EVMProvider {
|
|
@@ -16,7 +16,7 @@ export function EVM(options?: EVMProviderOptions): EVMProvider {
|
|
|
16
16
|
return _options
|
|
17
17
|
},
|
|
18
18
|
isAddress,
|
|
19
|
-
resolveAddress:
|
|
19
|
+
resolveAddress: resolveEVMAddress,
|
|
20
20
|
getBalance: getEVMBalance,
|
|
21
21
|
getWalletClient: _options.getWalletClient,
|
|
22
22
|
async getStepExecutor(
|
|
@@ -490,6 +490,7 @@ export class EVMStepExecutor extends BaseStepExecutor {
|
|
|
490
490
|
|
|
491
491
|
let txHash: Hash
|
|
492
492
|
let txType: TransactionMethodType = 'standard'
|
|
493
|
+
let txLink: string | undefined
|
|
493
494
|
|
|
494
495
|
if (batchingSupported && transactionRequest) {
|
|
495
496
|
const transferCall: Call = {
|
|
@@ -562,6 +563,7 @@ export class EVMStepExecutor extends BaseStepExecutor {
|
|
|
562
563
|
})
|
|
563
564
|
txHash = relayedTransaction.taskId as Hash
|
|
564
565
|
txType = 'relayed'
|
|
566
|
+
txLink = relayedTransaction.txLink
|
|
565
567
|
} else {
|
|
566
568
|
if (!transactionRequest) {
|
|
567
569
|
throw new TransactionError(
|
|
@@ -665,7 +667,7 @@ export class EVMStepExecutor extends BaseStepExecutor {
|
|
|
665
667
|
txLink:
|
|
666
668
|
txType === 'standard'
|
|
667
669
|
? `${fromChain.metamask.blockExplorerUrls[0]}tx/${txHash}`
|
|
668
|
-
:
|
|
670
|
+
: txLink,
|
|
669
671
|
}
|
|
670
672
|
)
|
|
671
673
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ChainId, ChainType } from '@lifi/types'
|
|
2
2
|
import type { Client } from 'viem'
|
|
3
|
-
import { createClient, fallback, http, webSocket } from 'viem'
|
|
3
|
+
import { type Address, createClient, fallback, http, webSocket } from 'viem'
|
|
4
4
|
import { type Chain, mainnet } from 'viem/chains'
|
|
5
5
|
import { config } from '../../config.js'
|
|
6
6
|
import { getRpcUrls } from '../rpc.js'
|
|
7
7
|
import type { EVMProvider } from './types.js'
|
|
8
|
+
import { UNS_PROXY_READER_ADDRESSES } from './uns/constants.js'
|
|
8
9
|
|
|
9
10
|
// cached providers
|
|
10
11
|
const publicClients: Record<number, Client> = {}
|
|
@@ -46,6 +47,17 @@ export const getPublicClient = async (chainId: number): Promise<Client> => {
|
|
|
46
47
|
...chain.contracts,
|
|
47
48
|
}
|
|
48
49
|
}
|
|
50
|
+
|
|
51
|
+
// Add UNS contracts for supported chains
|
|
52
|
+
if (chain.id === ChainId.ETH || chain.id === ChainId.POL) {
|
|
53
|
+
const unsProxyAddress = UNS_PROXY_READER_ADDRESSES[chain.id]
|
|
54
|
+
|
|
55
|
+
chain.contracts = {
|
|
56
|
+
...chain.contracts,
|
|
57
|
+
unsProxyReader: { address: unsProxyAddress as Address },
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
49
61
|
const provider = config.getProvider(ChainType.EVM) as EVMProvider | undefined
|
|
50
62
|
publicClients[chainId] = createClient({
|
|
51
63
|
chain: chain,
|
|
@@ -2,7 +2,7 @@ import { ChainId } from '@lifi/types'
|
|
|
2
2
|
import { getEnsAddress, normalize } from 'viem/ens'
|
|
3
3
|
import { getPublicClient } from './publicClient.js'
|
|
4
4
|
|
|
5
|
-
export const
|
|
5
|
+
export const resolveENSAddress = async (
|
|
6
6
|
name: string
|
|
7
7
|
): Promise<string | undefined> => {
|
|
8
8
|
try {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ChainId, CoinKey } from '@lifi/types'
|
|
2
|
+
import { ChainType } from '@lifi/types'
|
|
3
|
+
import { resolveENSAddress } from './resolveENSAddress.js'
|
|
4
|
+
import { resolveUNSAddress } from './uns/resolveUNSAddress.js'
|
|
5
|
+
|
|
6
|
+
export async function resolveEVMAddress(
|
|
7
|
+
name: string,
|
|
8
|
+
chainId?: ChainId,
|
|
9
|
+
token?: CoinKey
|
|
10
|
+
): Promise<string | undefined> {
|
|
11
|
+
return (
|
|
12
|
+
(await resolveENSAddress(name)) ||
|
|
13
|
+
(await resolveUNSAddress(name, ChainType.EVM, chainId, token))
|
|
14
|
+
)
|
|
15
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { ChainId, ChainType } from '@lifi/types'
|
|
2
|
+
import type { Address } from 'viem'
|
|
3
|
+
|
|
4
|
+
export const UNS_PROXY_READER_ADDRESSES: Record<number, Address> = {
|
|
5
|
+
[ChainId.ETH]: '0x578853aa776Eef10CeE6c4dd2B5862bdcE767A8B',
|
|
6
|
+
[ChainId.POL]: '0x91EDd8708062bd4233f4Dd0FCE15A7cb4d500091',
|
|
7
|
+
} as const
|
|
8
|
+
|
|
9
|
+
export const getUNSProxyAddress = (chainId: number): Address | undefined =>
|
|
10
|
+
UNS_PROXY_READER_ADDRESSES[chainId]
|
|
11
|
+
|
|
12
|
+
export const UNSProxyReaderABI = [
|
|
13
|
+
{
|
|
14
|
+
constant: true,
|
|
15
|
+
inputs: [
|
|
16
|
+
{
|
|
17
|
+
internalType: 'string[]',
|
|
18
|
+
name: 'keys',
|
|
19
|
+
type: 'string[]',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
internalType: 'uint256',
|
|
23
|
+
name: 'tokenId',
|
|
24
|
+
type: 'uint256',
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
name: 'getData',
|
|
28
|
+
outputs: [
|
|
29
|
+
{
|
|
30
|
+
internalType: 'address',
|
|
31
|
+
name: 'resolver',
|
|
32
|
+
type: 'address',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
internalType: 'address',
|
|
36
|
+
name: 'owner',
|
|
37
|
+
type: 'address',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
internalType: 'string[]',
|
|
41
|
+
name: 'values',
|
|
42
|
+
type: 'string[]',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
payable: false,
|
|
46
|
+
stateMutability: 'view',
|
|
47
|
+
type: 'function',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
inputs: [{ internalType: 'uint256', name: 'tokenId', type: 'uint256' }],
|
|
51
|
+
name: 'exists',
|
|
52
|
+
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
|
|
53
|
+
stateMutability: 'view',
|
|
54
|
+
type: 'function',
|
|
55
|
+
},
|
|
56
|
+
] as const
|
|
57
|
+
|
|
58
|
+
export const CHAIN_TYPE_UNS_CHAIN_MAP: Record<ChainType, string> = {
|
|
59
|
+
[ChainType.EVM]: 'ETH',
|
|
60
|
+
[ChainType.MVM]: 'SUI',
|
|
61
|
+
[ChainType.SVM]: 'SOL',
|
|
62
|
+
[ChainType.UTXO]: 'BTC',
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export const CHAIN_ID_UNS_CHAIN_MAP: Partial<Record<ChainId, string>> = {
|
|
66
|
+
[ChainId.ETH]: 'ETH',
|
|
67
|
+
[ChainId.BTC]: 'BTC',
|
|
68
|
+
[ChainId.SUI]: 'SUI',
|
|
69
|
+
[ChainId.SOL]: 'SOL',
|
|
70
|
+
[ChainId.BAS]: 'BASE',
|
|
71
|
+
[ChainId.POL]: 'MATIC',
|
|
72
|
+
[ChainId.ARB]: 'ARB1',
|
|
73
|
+
[ChainId.AVA]: 'AVAX',
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const CHAIN_TYPE_FAMILY_MAP: Record<ChainType, string> = {
|
|
77
|
+
[ChainType.EVM]: 'EVM',
|
|
78
|
+
[ChainType.UTXO]: 'BTC',
|
|
79
|
+
[ChainType.SVM]: 'SOL',
|
|
80
|
+
[ChainType.MVM]: 'SUI',
|
|
81
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { ChainId, type ChainType, type CoinKey } from '@lifi/types'
|
|
2
|
+
import type { Address, Client } from 'viem'
|
|
3
|
+
import { readContract } from 'viem/actions'
|
|
4
|
+
import { namehash } from 'viem/ens'
|
|
5
|
+
import { getAction, trim } from 'viem/utils'
|
|
6
|
+
import { getPublicClient } from '../publicClient.js'
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
CHAIN_ID_UNS_CHAIN_MAP,
|
|
10
|
+
CHAIN_TYPE_FAMILY_MAP,
|
|
11
|
+
CHAIN_TYPE_UNS_CHAIN_MAP,
|
|
12
|
+
getUNSProxyAddress,
|
|
13
|
+
UNSProxyReaderABI,
|
|
14
|
+
} from './constants.js'
|
|
15
|
+
|
|
16
|
+
export const resolveUNSAddress = async (
|
|
17
|
+
name: string,
|
|
18
|
+
chainType: ChainType,
|
|
19
|
+
chain?: ChainId,
|
|
20
|
+
token?: CoinKey
|
|
21
|
+
): Promise<string | undefined> => {
|
|
22
|
+
try {
|
|
23
|
+
const L1Client = await getPublicClient(ChainId.ETH)
|
|
24
|
+
const L2Client = await getPublicClient(ChainId.POL)
|
|
25
|
+
|
|
26
|
+
const nameHash = namehash(name)
|
|
27
|
+
const keys: string[] = []
|
|
28
|
+
|
|
29
|
+
// handle token based resolution
|
|
30
|
+
if (chain) {
|
|
31
|
+
const family = CHAIN_TYPE_FAMILY_MAP[chainType]
|
|
32
|
+
const unschain = CHAIN_ID_UNS_CHAIN_MAP[chain]
|
|
33
|
+
|
|
34
|
+
if (family) {
|
|
35
|
+
if (token) {
|
|
36
|
+
keys.push(`token.${family}.${unschain}.${token}.address`)
|
|
37
|
+
}
|
|
38
|
+
if (unschain) {
|
|
39
|
+
keys.push(`token.${family}.${unschain}.address`)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
keys.push(`token.${family}.address`)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// fallback to chain based resolution
|
|
47
|
+
const unschainType = CHAIN_TYPE_UNS_CHAIN_MAP[chainType]
|
|
48
|
+
keys.push(`crypto.${unschainType}.address`)
|
|
49
|
+
|
|
50
|
+
for (const key of keys) {
|
|
51
|
+
const address =
|
|
52
|
+
(await getUnsAddress(L2Client, { name: nameHash, key })) ||
|
|
53
|
+
(await getUnsAddress(L1Client, { name: nameHash, key }))
|
|
54
|
+
if (address) {
|
|
55
|
+
return address
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return undefined
|
|
59
|
+
} catch {
|
|
60
|
+
return undefined
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
type GetUnsAddressParameters = {
|
|
65
|
+
key: string
|
|
66
|
+
name: string
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
type GetUnsAddressReturnType = Address | undefined
|
|
70
|
+
|
|
71
|
+
async function getUnsAddress(
|
|
72
|
+
client: Client,
|
|
73
|
+
params: GetUnsAddressParameters
|
|
74
|
+
): Promise<GetUnsAddressReturnType> {
|
|
75
|
+
const { name, key } = params
|
|
76
|
+
|
|
77
|
+
const chainId = client.chain?.id
|
|
78
|
+
if (!chainId) {
|
|
79
|
+
throw new Error('Chain ID not available')
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const proxyAddress = getUNSProxyAddress(chainId)
|
|
83
|
+
if (!proxyAddress) {
|
|
84
|
+
throw new Error(`UNS contracts are not deployed on chain ${chainId}`)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const readContractAction = getAction(client, readContract, 'readContract')
|
|
88
|
+
|
|
89
|
+
const existsReadContractParameters = {
|
|
90
|
+
abi: UNSProxyReaderABI,
|
|
91
|
+
address: proxyAddress,
|
|
92
|
+
functionName: 'exists',
|
|
93
|
+
args: [BigInt(name)],
|
|
94
|
+
} as const
|
|
95
|
+
|
|
96
|
+
const exists = await readContractAction(existsReadContractParameters)
|
|
97
|
+
|
|
98
|
+
if (!exists) {
|
|
99
|
+
return undefined
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const readContractParameters = {
|
|
103
|
+
abi: UNSProxyReaderABI,
|
|
104
|
+
address: proxyAddress,
|
|
105
|
+
functionName: 'getData',
|
|
106
|
+
args: [[key], BigInt(name)],
|
|
107
|
+
} as const
|
|
108
|
+
|
|
109
|
+
const res = await readContractAction(readContractParameters)
|
|
110
|
+
const [, , addresses] = res
|
|
111
|
+
|
|
112
|
+
const address = addresses[0]
|
|
113
|
+
|
|
114
|
+
if (
|
|
115
|
+
address === '0x' ||
|
|
116
|
+
address === '' ||
|
|
117
|
+
trim(address as Address) === '0x00'
|
|
118
|
+
) {
|
|
119
|
+
return undefined
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return address as Address
|
|
123
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ChainType } from '@lifi/types'
|
|
2
2
|
import type { StepExecutorOptions } from '../types.js'
|
|
3
|
-
import { getSNSAddress } from './getSNSAddress.js'
|
|
4
3
|
import { getSolanaBalance } from './getSolanaBalance.js'
|
|
5
4
|
import { isSVMAddress } from './isSVMAddress.js'
|
|
5
|
+
import { resolveSolanaAddress } from './resolveSolanaAddress.js'
|
|
6
6
|
import { SolanaStepExecutor } from './SolanaStepExecutor.js'
|
|
7
7
|
import type { SolanaProvider, SolanaProviderOptions } from './types.js'
|
|
8
8
|
|
|
@@ -13,7 +13,7 @@ export function Solana(options?: SolanaProviderOptions): SolanaProvider {
|
|
|
13
13
|
return ChainType.SVM
|
|
14
14
|
},
|
|
15
15
|
isAddress: isSVMAddress,
|
|
16
|
-
resolveAddress:
|
|
16
|
+
resolveAddress: resolveSolanaAddress,
|
|
17
17
|
getBalance: getSolanaBalance,
|
|
18
18
|
async getStepExecutor(
|
|
19
19
|
options: StepExecutorOptions
|
package/src/core/Sui/Sui.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ChainType } from '@lifi/types'
|
|
|
2
2
|
import { isValidSuiAddress } from '@mysten/sui/utils'
|
|
3
3
|
import type { StepExecutorOptions } from '../types.js'
|
|
4
4
|
import { getSuiBalance } from './getSuiBalance.js'
|
|
5
|
-
import {
|
|
5
|
+
import { resolveSuiAddress } from './resolveSuiAddress.js'
|
|
6
6
|
import { SuiStepExecutor } from './SuiStepExecutor.js'
|
|
7
7
|
import type { SuiProvider, SuiProviderOptions } from './types.js'
|
|
8
8
|
|
|
@@ -13,7 +13,7 @@ export function Sui(options?: SuiProviderOptions): SuiProvider {
|
|
|
13
13
|
return ChainType.MVM
|
|
14
14
|
},
|
|
15
15
|
isAddress: isValidSuiAddress,
|
|
16
|
-
resolveAddress:
|
|
16
|
+
resolveAddress: resolveSuiAddress,
|
|
17
17
|
getBalance: getSuiBalance,
|
|
18
18
|
async getStepExecutor(
|
|
19
19
|
options: StepExecutorOptions
|
package/src/core/UTXO/UTXO.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { isUTXOAddress } from '@bigmi/core'
|
|
|
2
2
|
import { ChainType } from '@lifi/types'
|
|
3
3
|
import type { StepExecutorOptions } from '../types.js'
|
|
4
4
|
import { getUTXOBalance } from './getUTXOBalance.js'
|
|
5
|
+
import { resolveUTXOAddress } from './resolveUTXOAddress.js'
|
|
5
6
|
import type { UTXOProvider, UTXOProviderOptions } from './types.js'
|
|
6
7
|
import { UTXOStepExecutor } from './UTXOStepExecutor.js'
|
|
7
8
|
|
|
@@ -12,10 +13,7 @@ export function UTXO(options?: UTXOProviderOptions): UTXOProvider {
|
|
|
12
13
|
return ChainType.UTXO
|
|
13
14
|
},
|
|
14
15
|
isAddress: isUTXOAddress,
|
|
15
|
-
|
|
16
|
-
// Not supported on UTXO yet
|
|
17
|
-
return name
|
|
18
|
-
},
|
|
16
|
+
resolveAddress: resolveUTXOAddress,
|
|
19
17
|
getBalance: getUTXOBalance,
|
|
20
18
|
async getStepExecutor(
|
|
21
19
|
options: StepExecutorOptions
|