@lifi/sdk-provider-ethereum 4.0.0-beta.3 → 4.0.0-beta.4
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/actions/constants.js +4 -2
- package/dist/cjs/actions/constants.js.map +1 -1
- package/dist/cjs/core/EthereumStepExecutor.d.ts +3 -3
- package/dist/cjs/core/EthereumStepExecutor.js +56 -57
- package/dist/cjs/core/EthereumStepExecutor.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumCheckAllowanceTask.d.ts +1 -1
- package/dist/cjs/core/tasks/EthereumCheckPermitsTask.d.ts +1 -1
- package/dist/cjs/core/tasks/EthereumNativePermitTask.d.ts +1 -1
- package/dist/cjs/core/tasks/EthereumResetAllowanceTask.d.ts +1 -1
- package/dist/cjs/core/tasks/EthereumSetAllowanceTask.d.ts +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/actions/constants.d.ts.map +1 -1
- package/dist/esm/actions/constants.js +4 -2
- package/dist/esm/actions/constants.js.map +1 -1
- package/dist/esm/core/EthereumStepExecutor.d.ts +3 -3
- package/dist/esm/core/EthereumStepExecutor.d.ts.map +1 -1
- package/dist/esm/core/EthereumStepExecutor.js +56 -57
- package/dist/esm/core/EthereumStepExecutor.js.map +1 -1
- package/dist/esm/core/tasks/EthereumCheckAllowanceTask.d.ts +1 -1
- package/dist/esm/core/tasks/EthereumCheckAllowanceTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumCheckPermitsTask.d.ts +1 -1
- package/dist/esm/core/tasks/EthereumCheckPermitsTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumNativePermitTask.d.ts +1 -1
- package/dist/esm/core/tasks/EthereumNativePermitTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumResetAllowanceTask.d.ts +1 -1
- package/dist/esm/core/tasks/EthereumResetAllowanceTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumSetAllowanceTask.d.ts +1 -1
- package/dist/esm/core/tasks/EthereumSetAllowanceTask.d.ts.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/package.json +2 -2
- package/src/actions/constants.ts +2 -0
- package/src/version.ts +1 -1
- package/dist/cjs/_virtual/_@oxc-project_runtime@0.115.0/helpers/defineProperty.js +0 -12
- package/dist/cjs/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPrimitive.js +0 -14
- package/dist/cjs/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPropertyKey.js +0 -9
- package/dist/cjs/_virtual/_@oxc-project_runtime@0.115.0/helpers/typeof.js +0 -16
- package/dist/esm/_virtual/_@oxc-project_runtime@0.115.0/helpers/defineProperty.js +0 -12
- package/dist/esm/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPrimitive.js +0 -14
- package/dist/esm/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPropertyKey.js +0 -9
- package/dist/esm/_virtual/_@oxc-project_runtime@0.115.0/helpers/typeof.js +0 -11
|
@@ -58,7 +58,8 @@ const CHAIN_TYPE_UNS_CHAIN_MAP = {
|
|
|
58
58
|
[_lifi_sdk.ChainType.MVM]: "SUI",
|
|
59
59
|
[_lifi_sdk.ChainType.SVM]: "SOL",
|
|
60
60
|
[_lifi_sdk.ChainType.UTXO]: "BTC",
|
|
61
|
-
[_lifi_sdk.ChainType.TVM]: "TRON"
|
|
61
|
+
[_lifi_sdk.ChainType.TVM]: "TRON",
|
|
62
|
+
[_lifi_sdk.ChainType.STL]: "XLM"
|
|
62
63
|
};
|
|
63
64
|
const CHAIN_ID_UNS_CHAIN_MAP = {
|
|
64
65
|
[_lifi_sdk.ChainId.ETH]: "ETH",
|
|
@@ -75,7 +76,8 @@ const CHAIN_TYPE_FAMILY_MAP = {
|
|
|
75
76
|
[_lifi_sdk.ChainType.UTXO]: "BTC",
|
|
76
77
|
[_lifi_sdk.ChainType.SVM]: "SOL",
|
|
77
78
|
[_lifi_sdk.ChainType.MVM]: "SUI",
|
|
78
|
-
[_lifi_sdk.ChainType.TVM]: "TRON"
|
|
79
|
+
[_lifi_sdk.ChainType.TVM]: "TRON",
|
|
80
|
+
[_lifi_sdk.ChainType.STL]: "XLM"
|
|
79
81
|
};
|
|
80
82
|
//#endregion
|
|
81
83
|
exports.CHAIN_ID_UNS_CHAIN_MAP = CHAIN_ID_UNS_CHAIN_MAP;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":["ChainId","ChainType"],"sources":["../../../src/actions/constants.ts"],"sourcesContent":["import { ChainId, ChainType } from '@lifi/sdk'\nimport type { Address } from 'viem'\n\nexport const UNS_PROXY_READER_ADDRESSES: Record<number, Address> = {\n [ChainId.ETH]: '0x578853aa776Eef10CeE6c4dd2B5862bdcE767A8B',\n [ChainId.POL]: '0x91EDd8708062bd4233f4Dd0FCE15A7cb4d500091',\n} as const\n\nexport const getUNSProxyAddress = (chainId: number): Address | undefined =>\n UNS_PROXY_READER_ADDRESSES[chainId]\n\nexport const UNSProxyReaderABI = [\n {\n constant: true,\n inputs: [\n {\n internalType: 'string[]',\n name: 'keys',\n type: 'string[]',\n },\n {\n internalType: 'uint256',\n name: 'tokenId',\n type: 'uint256',\n },\n ],\n name: 'getData',\n outputs: [\n {\n internalType: 'address',\n name: 'resolver',\n type: 'address',\n },\n {\n internalType: 'address',\n name: 'owner',\n type: 'address',\n },\n {\n internalType: 'string[]',\n name: 'values',\n type: 'string[]',\n },\n ],\n payable: false,\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [{ internalType: 'uint256', name: 'tokenId', type: 'uint256' }],\n name: 'exists',\n outputs: [{ internalType: 'bool', name: '', type: 'bool' }],\n stateMutability: 'view',\n type: 'function',\n },\n] as const\n\nexport const CHAIN_TYPE_UNS_CHAIN_MAP: Record<ChainType, string> = {\n [ChainType.EVM]: 'ETH',\n [ChainType.MVM]: 'SUI',\n [ChainType.SVM]: 'SOL',\n [ChainType.UTXO]: 'BTC',\n [ChainType.TVM]: 'TRON',\n}\n\nexport const CHAIN_ID_UNS_CHAIN_MAP: Partial<Record<ChainId, string>> = {\n [ChainId.ETH]: 'ETH',\n [ChainId.BTC]: 'BTC',\n [ChainId.SUI]: 'SUI',\n [ChainId.SOL]: 'SOL',\n [ChainId.BAS]: 'BASE',\n [ChainId.POL]: 'MATIC',\n [ChainId.ARB]: 'ARB1',\n [ChainId.AVA]: 'AVAX',\n}\n\nexport const CHAIN_TYPE_FAMILY_MAP: Record<ChainType, string> = {\n [ChainType.EVM]: 'EVM',\n [ChainType.UTXO]: 'BTC',\n [ChainType.SVM]: 'SOL',\n [ChainType.MVM]: 'SUI',\n [ChainType.TVM]: 'TRON',\n}\n"],"mappings":";;;AAGA,MAAa,6BAAsD;EAChEA,UAAAA,QAAQ,MAAM;EACdA,UAAAA,QAAQ,MAAM;CAChB;AAED,MAAa,sBAAsB,YACjC,2BAA2B;AAE7B,MAAa,oBAAoB,CAC/B;CACE,UAAU;CACV,QAAQ,CACN;EACE,cAAc;EACd,MAAM;EACN,MAAM;EACP,EACD;EACE,cAAc;EACd,MAAM;EACN,MAAM;EACP,CACF;CACD,MAAM;CACN,SAAS;EACP;GACE,cAAc;GACd,MAAM;GACN,MAAM;GACP;EACD;GACE,cAAc;GACd,MAAM;GACN,MAAM;GACP;EACD;GACE,cAAc;GACd,MAAM;GACN,MAAM;GACP;EACF;CACD,SAAS;CACT,iBAAiB;CACjB,MAAM;CACP,EACD;CACE,QAAQ,CAAC;EAAE,cAAc;EAAW,MAAM;EAAW,MAAM;EAAW,CAAC;CACvE,MAAM;CACN,SAAS,CAAC;EAAE,cAAc;EAAQ,MAAM;EAAI,MAAM;EAAQ,CAAC;CAC3D,iBAAiB;CACjB,MAAM;CACP,CACF;AAED,MAAa,2BAAsD;EAChEC,UAAAA,UAAU,MAAM;EAChBA,UAAAA,UAAU,MAAM;EAChBA,UAAAA,UAAU,MAAM;EAChBA,UAAAA,UAAU,OAAO;EACjBA,UAAAA,UAAU,MAAM;CAClB;AAED,MAAa,yBAA2D;EACrED,UAAAA,QAAQ,MAAM;EACdA,UAAAA,QAAQ,MAAM;EACdA,UAAAA,QAAQ,MAAM;EACdA,UAAAA,QAAQ,MAAM;EACdA,UAAAA,QAAQ,MAAM;EACdA,UAAAA,QAAQ,MAAM;EACdA,UAAAA,QAAQ,MAAM;EACdA,UAAAA,QAAQ,MAAM;CAChB;AAED,MAAa,wBAAmD;EAC7DC,UAAAA,UAAU,MAAM;EAChBA,UAAAA,UAAU,OAAO;EACjBA,UAAAA,UAAU,MAAM;EAChBA,UAAAA,UAAU,MAAM;EAChBA,UAAAA,UAAU,MAAM;CAClB"}
|
|
1
|
+
{"version":3,"file":"constants.js","names":["ChainId","ChainType"],"sources":["../../../src/actions/constants.ts"],"sourcesContent":["import { ChainId, ChainType } from '@lifi/sdk'\nimport type { Address } from 'viem'\n\nexport const UNS_PROXY_READER_ADDRESSES: Record<number, Address> = {\n [ChainId.ETH]: '0x578853aa776Eef10CeE6c4dd2B5862bdcE767A8B',\n [ChainId.POL]: '0x91EDd8708062bd4233f4Dd0FCE15A7cb4d500091',\n} as const\n\nexport const getUNSProxyAddress = (chainId: number): Address | undefined =>\n UNS_PROXY_READER_ADDRESSES[chainId]\n\nexport const UNSProxyReaderABI = [\n {\n constant: true,\n inputs: [\n {\n internalType: 'string[]',\n name: 'keys',\n type: 'string[]',\n },\n {\n internalType: 'uint256',\n name: 'tokenId',\n type: 'uint256',\n },\n ],\n name: 'getData',\n outputs: [\n {\n internalType: 'address',\n name: 'resolver',\n type: 'address',\n },\n {\n internalType: 'address',\n name: 'owner',\n type: 'address',\n },\n {\n internalType: 'string[]',\n name: 'values',\n type: 'string[]',\n },\n ],\n payable: false,\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [{ internalType: 'uint256', name: 'tokenId', type: 'uint256' }],\n name: 'exists',\n outputs: [{ internalType: 'bool', name: '', type: 'bool' }],\n stateMutability: 'view',\n type: 'function',\n },\n] as const\n\nexport const CHAIN_TYPE_UNS_CHAIN_MAP: Record<ChainType, string> = {\n [ChainType.EVM]: 'ETH',\n [ChainType.MVM]: 'SUI',\n [ChainType.SVM]: 'SOL',\n [ChainType.UTXO]: 'BTC',\n [ChainType.TVM]: 'TRON',\n [ChainType.STL]: 'XLM',\n}\n\nexport const CHAIN_ID_UNS_CHAIN_MAP: Partial<Record<ChainId, string>> = {\n [ChainId.ETH]: 'ETH',\n [ChainId.BTC]: 'BTC',\n [ChainId.SUI]: 'SUI',\n [ChainId.SOL]: 'SOL',\n [ChainId.BAS]: 'BASE',\n [ChainId.POL]: 'MATIC',\n [ChainId.ARB]: 'ARB1',\n [ChainId.AVA]: 'AVAX',\n}\n\nexport const CHAIN_TYPE_FAMILY_MAP: Record<ChainType, string> = {\n [ChainType.EVM]: 'EVM',\n [ChainType.UTXO]: 'BTC',\n [ChainType.SVM]: 'SOL',\n [ChainType.MVM]: 'SUI',\n [ChainType.TVM]: 'TRON',\n [ChainType.STL]: 'XLM',\n}\n"],"mappings":";;;AAGA,MAAa,6BAAsD;EAChEA,UAAAA,QAAQ,MAAM;EACdA,UAAAA,QAAQ,MAAM;CAChB;AAED,MAAa,sBAAsB,YACjC,2BAA2B;AAE7B,MAAa,oBAAoB,CAC/B;CACE,UAAU;CACV,QAAQ,CACN;EACE,cAAc;EACd,MAAM;EACN,MAAM;EACP,EACD;EACE,cAAc;EACd,MAAM;EACN,MAAM;EACP,CACF;CACD,MAAM;CACN,SAAS;EACP;GACE,cAAc;GACd,MAAM;GACN,MAAM;GACP;EACD;GACE,cAAc;GACd,MAAM;GACN,MAAM;GACP;EACD;GACE,cAAc;GACd,MAAM;GACN,MAAM;GACP;EACF;CACD,SAAS;CACT,iBAAiB;CACjB,MAAM;CACP,EACD;CACE,QAAQ,CAAC;EAAE,cAAc;EAAW,MAAM;EAAW,MAAM;EAAW,CAAC;CACvE,MAAM;CACN,SAAS,CAAC;EAAE,cAAc;EAAQ,MAAM;EAAI,MAAM;EAAQ,CAAC;CAC3D,iBAAiB;CACjB,MAAM;CACP,CACF;AAED,MAAa,2BAAsD;EAChEC,UAAAA,UAAU,MAAM;EAChBA,UAAAA,UAAU,MAAM;EAChBA,UAAAA,UAAU,MAAM;EAChBA,UAAAA,UAAU,OAAO;EACjBA,UAAAA,UAAU,MAAM;EAChBA,UAAAA,UAAU,MAAM;CAClB;AAED,MAAa,yBAA2D;EACrED,UAAAA,QAAQ,MAAM;EACdA,UAAAA,QAAQ,MAAM;EACdA,UAAAA,QAAQ,MAAM;EACdA,UAAAA,QAAQ,MAAM;EACdA,UAAAA,QAAQ,MAAM;EACdA,UAAAA,QAAQ,MAAM;EACdA,UAAAA,QAAQ,MAAM;EACdA,UAAAA,QAAQ,MAAM;CAChB;AAED,MAAa,wBAAmD;EAC7DC,UAAAA,UAAU,MAAM;EAChBA,UAAAA,UAAU,OAAO;EACjBA,UAAAA,UAAU,MAAM;EAChBA,UAAAA,UAAU,MAAM;EAChBA,UAAAA,UAAU,MAAM;EAChBA,UAAAA,UAAU,MAAM;CAClB"}
|
|
@@ -15,10 +15,10 @@ declare class EthereumStepExecutor extends BaseStepExecutor {
|
|
|
15
15
|
private disableMessageSigning?;
|
|
16
16
|
constructor(options: EthereumStepExecutorOptions);
|
|
17
17
|
private getStorage;
|
|
18
|
-
parseErrors: (error: Error, step?: LiFiStepExtended, action?: ExecutionAction, retryParams?: ExecuteStepRetryParams) => Promise<SDKError | ExecuteStepRetryError>;
|
|
18
|
+
override parseErrors: (error: Error, step?: LiFiStepExtended, action?: ExecutionAction, retryParams?: ExecuteStepRetryParams) => Promise<SDKError | ExecuteStepRetryError>;
|
|
19
19
|
checkClient: (step: LiFiStepExtended, targetChainId?: number) => Promise<Client | undefined>;
|
|
20
|
-
createContext: (baseContext: StepExecutorBaseContext) => Promise<EthereumStepExecutorContext>;
|
|
21
|
-
createPipeline: (context: EthereumStepExecutorContext) => TaskPipeline;
|
|
20
|
+
override createContext: (baseContext: StepExecutorBaseContext) => Promise<EthereumStepExecutorContext>;
|
|
21
|
+
override createPipeline: (context: EthereumStepExecutorContext) => TaskPipeline;
|
|
22
22
|
}
|
|
23
23
|
//#endregion
|
|
24
24
|
export { EthereumStepExecutor };
|
|
@@ -12,74 +12,73 @@ const require_core_tasks_EthereumWaitForTransactionStatusTask = require("./tasks
|
|
|
12
12
|
const require_core_tasks_EthereumWaitForTransactionTask = require("./tasks/EthereumWaitForTransactionTask.js");
|
|
13
13
|
const require_core_tasks_helpers_shouldCheckForAllowance = require("./tasks/helpers/shouldCheckForAllowance.js");
|
|
14
14
|
const require_core_tasks_helpers_switchChain = require("./tasks/helpers/switchChain.js");
|
|
15
|
-
const require_defineProperty = require("../_virtual/_@oxc-project_runtime@0.115.0/helpers/defineProperty.js");
|
|
16
15
|
let _lifi_sdk = require("@lifi/sdk");
|
|
17
16
|
let viem_actions = require("viem/actions");
|
|
18
17
|
let viem_utils = require("viem/utils");
|
|
19
18
|
//#region src/core/EthereumStepExecutor.ts
|
|
20
19
|
var EthereumStepExecutor = class extends _lifi_sdk.BaseStepExecutor {
|
|
20
|
+
client;
|
|
21
|
+
switchChain;
|
|
22
|
+
storage;
|
|
23
|
+
disableMessageSigning;
|
|
21
24
|
constructor(options) {
|
|
22
25
|
super(options);
|
|
23
|
-
require_defineProperty._defineProperty(this, "client", void 0);
|
|
24
|
-
require_defineProperty._defineProperty(this, "switchChain", void 0);
|
|
25
|
-
require_defineProperty._defineProperty(this, "storage", void 0);
|
|
26
|
-
require_defineProperty._defineProperty(this, "disableMessageSigning", void 0);
|
|
27
|
-
require_defineProperty._defineProperty(this, "getStorage", (client) => {
|
|
28
|
-
if (!this.storage) this.storage = client.config.storage ?? (0, _lifi_sdk.createDefaultStorage)();
|
|
29
|
-
return this.storage;
|
|
30
|
-
});
|
|
31
|
-
require_defineProperty._defineProperty(this, "parseErrors", (error, step, action, retryParams) => require_errors_parseEthereumErrors.parseEthereumErrors(error, step, action, retryParams));
|
|
32
|
-
require_defineProperty._defineProperty(this, "checkClient", async (step, targetChainId) => {
|
|
33
|
-
const updatedClient = await require_core_tasks_helpers_switchChain.switchChain(this.client, targetChainId ?? step.action.fromChainId, this.allowUserInteraction, this.switchChain);
|
|
34
|
-
if (updatedClient) this.client = updatedClient;
|
|
35
|
-
let accountAddress = this.client.account?.address;
|
|
36
|
-
if (!accountAddress) accountAddress = (await (0, viem_utils.getAction)(this.client, viem_actions.getAddresses, "getAddresses")(void 0))?.[0];
|
|
37
|
-
if (accountAddress?.toLowerCase() !== step.action.fromAddress?.toLowerCase()) throw new _lifi_sdk.TransactionError(_lifi_sdk.LiFiErrorCode.WalletChangedDuringExecution, "The wallet address that requested the quote does not match the wallet address attempting to sign the transaction.");
|
|
38
|
-
return updatedClient;
|
|
39
|
-
});
|
|
40
|
-
require_defineProperty._defineProperty(this, "createContext", async (baseContext) => {
|
|
41
|
-
const { step, fromChain } = baseContext;
|
|
42
|
-
const isFromNativeToken = fromChain.nativeToken.address === step.action.fromToken.address && require_utils_isZeroAddress.isZeroAddress(step.action.fromToken.address);
|
|
43
|
-
const disableMessageSigning = !!this.disableMessageSigning || step.type !== "lifi";
|
|
44
|
-
return {
|
|
45
|
-
...baseContext,
|
|
46
|
-
isFromNativeToken,
|
|
47
|
-
disableMessageSigning,
|
|
48
|
-
ethereumClient: this.client,
|
|
49
|
-
checkClient: this.checkClient,
|
|
50
|
-
getStorage: this.getStorage,
|
|
51
|
-
signedTypedData: [],
|
|
52
|
-
calls: []
|
|
53
|
-
};
|
|
54
|
-
});
|
|
55
|
-
require_defineProperty._defineProperty(this, "createPipeline", (context) => {
|
|
56
|
-
const { step, isBridgeExecution, isFromNativeToken } = context;
|
|
57
|
-
const tasks = [
|
|
58
|
-
new require_core_tasks_EthereumCheckPermitsTask.EthereumCheckPermitsTask(),
|
|
59
|
-
new require_core_tasks_EthereumCheckAllowanceTask.EthereumCheckAllowanceTask(),
|
|
60
|
-
new require_core_tasks_EthereumNativePermitTask.EthereumNativePermitTask(),
|
|
61
|
-
new require_core_tasks_EthereumResetAllowanceTask.EthereumResetAllowanceTask(),
|
|
62
|
-
new require_core_tasks_EthereumSetAllowanceTask.EthereumSetAllowanceTask(),
|
|
63
|
-
new _lifi_sdk.CheckBalanceTask(),
|
|
64
|
-
new require_core_tasks_EthereumPrepareTransactionTask.EthereumPrepareTransactionTask(),
|
|
65
|
-
new require_core_tasks_EthereumSignAndExecuteTask.EthereumSignAndExecuteTask(),
|
|
66
|
-
new require_core_tasks_EthereumWaitForTransactionTask.EthereumWaitForTransactionTask(),
|
|
67
|
-
new require_core_tasks_EthereumWaitForTransactionStatusTask.EthereumWaitForTransactionStatusTask()
|
|
68
|
-
];
|
|
69
|
-
const doCheckAllowance = require_core_tasks_helpers_shouldCheckForAllowance.shouldCheckForAllowance(step, isBridgeExecution, isFromNativeToken, this.statusManager);
|
|
70
|
-
let taskName;
|
|
71
|
-
if (doCheckAllowance) taskName = require_core_tasks_EthereumCheckPermitsTask.EthereumCheckPermitsTask.name;
|
|
72
|
-
else {
|
|
73
|
-
const swapOrBridgeAction = this.statusManager.findAction(step, isBridgeExecution ? "CROSS_CHAIN" : "SWAP");
|
|
74
|
-
taskName = swapOrBridgeAction?.txHash || swapOrBridgeAction?.taskId ? swapOrBridgeAction?.status === "DONE" ? require_core_tasks_EthereumWaitForTransactionStatusTask.EthereumWaitForTransactionStatusTask.name : require_core_tasks_EthereumWaitForTransactionTask.EthereumWaitForTransactionTask.name : _lifi_sdk.CheckBalanceTask.name;
|
|
75
|
-
}
|
|
76
|
-
const firstTaskIndex = tasks.findIndex((task) => task.constructor.name === taskName);
|
|
77
|
-
return new _lifi_sdk.TaskPipeline(tasks.slice(firstTaskIndex));
|
|
78
|
-
});
|
|
79
26
|
this.client = options.client;
|
|
80
27
|
this.switchChain = options.switchChain;
|
|
81
28
|
this.disableMessageSigning = options.disableMessageSigning;
|
|
82
29
|
}
|
|
30
|
+
getStorage = (client) => {
|
|
31
|
+
if (!this.storage) this.storage = client.config.storage ?? (0, _lifi_sdk.createDefaultStorage)();
|
|
32
|
+
return this.storage;
|
|
33
|
+
};
|
|
34
|
+
parseErrors = (error, step, action, retryParams) => require_errors_parseEthereumErrors.parseEthereumErrors(error, step, action, retryParams);
|
|
35
|
+
checkClient = async (step, targetChainId) => {
|
|
36
|
+
const updatedClient = await require_core_tasks_helpers_switchChain.switchChain(this.client, targetChainId ?? step.action.fromChainId, this.allowUserInteraction, this.switchChain);
|
|
37
|
+
if (updatedClient) this.client = updatedClient;
|
|
38
|
+
let accountAddress = this.client.account?.address;
|
|
39
|
+
if (!accountAddress) accountAddress = (await (0, viem_utils.getAction)(this.client, viem_actions.getAddresses, "getAddresses")(void 0))?.[0];
|
|
40
|
+
if (accountAddress?.toLowerCase() !== step.action.fromAddress?.toLowerCase()) throw new _lifi_sdk.TransactionError(_lifi_sdk.LiFiErrorCode.WalletChangedDuringExecution, "The wallet address that requested the quote does not match the wallet address attempting to sign the transaction.");
|
|
41
|
+
return updatedClient;
|
|
42
|
+
};
|
|
43
|
+
createContext = async (baseContext) => {
|
|
44
|
+
const { step, fromChain } = baseContext;
|
|
45
|
+
const isFromNativeToken = fromChain.nativeToken.address === step.action.fromToken.address && require_utils_isZeroAddress.isZeroAddress(step.action.fromToken.address);
|
|
46
|
+
const disableMessageSigning = !!this.disableMessageSigning || step.type !== "lifi";
|
|
47
|
+
return {
|
|
48
|
+
...baseContext,
|
|
49
|
+
isFromNativeToken,
|
|
50
|
+
disableMessageSigning,
|
|
51
|
+
ethereumClient: this.client,
|
|
52
|
+
checkClient: this.checkClient,
|
|
53
|
+
getStorage: this.getStorage,
|
|
54
|
+
signedTypedData: [],
|
|
55
|
+
calls: []
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
createPipeline = (context) => {
|
|
59
|
+
const { step, isBridgeExecution, isFromNativeToken } = context;
|
|
60
|
+
const tasks = [
|
|
61
|
+
new require_core_tasks_EthereumCheckPermitsTask.EthereumCheckPermitsTask(),
|
|
62
|
+
new require_core_tasks_EthereumCheckAllowanceTask.EthereumCheckAllowanceTask(),
|
|
63
|
+
new require_core_tasks_EthereumNativePermitTask.EthereumNativePermitTask(),
|
|
64
|
+
new require_core_tasks_EthereumResetAllowanceTask.EthereumResetAllowanceTask(),
|
|
65
|
+
new require_core_tasks_EthereumSetAllowanceTask.EthereumSetAllowanceTask(),
|
|
66
|
+
new _lifi_sdk.CheckBalanceTask(),
|
|
67
|
+
new require_core_tasks_EthereumPrepareTransactionTask.EthereumPrepareTransactionTask(),
|
|
68
|
+
new require_core_tasks_EthereumSignAndExecuteTask.EthereumSignAndExecuteTask(),
|
|
69
|
+
new require_core_tasks_EthereumWaitForTransactionTask.EthereumWaitForTransactionTask(),
|
|
70
|
+
new require_core_tasks_EthereumWaitForTransactionStatusTask.EthereumWaitForTransactionStatusTask()
|
|
71
|
+
];
|
|
72
|
+
const doCheckAllowance = require_core_tasks_helpers_shouldCheckForAllowance.shouldCheckForAllowance(step, isBridgeExecution, isFromNativeToken, this.statusManager);
|
|
73
|
+
let taskName;
|
|
74
|
+
if (doCheckAllowance) taskName = require_core_tasks_EthereumCheckPermitsTask.EthereumCheckPermitsTask.name;
|
|
75
|
+
else {
|
|
76
|
+
const swapOrBridgeAction = this.statusManager.findAction(step, isBridgeExecution ? "CROSS_CHAIN" : "SWAP");
|
|
77
|
+
taskName = swapOrBridgeAction?.txHash || swapOrBridgeAction?.taskId ? swapOrBridgeAction?.status === "DONE" ? require_core_tasks_EthereumWaitForTransactionStatusTask.EthereumWaitForTransactionStatusTask.name : require_core_tasks_EthereumWaitForTransactionTask.EthereumWaitForTransactionTask.name : _lifi_sdk.CheckBalanceTask.name;
|
|
78
|
+
}
|
|
79
|
+
const firstTaskIndex = tasks.findIndex((task) => task.constructor.name === taskName);
|
|
80
|
+
return new _lifi_sdk.TaskPipeline(tasks.slice(firstTaskIndex));
|
|
81
|
+
};
|
|
83
82
|
};
|
|
84
83
|
//#endregion
|
|
85
84
|
exports.EthereumStepExecutor = EthereumStepExecutor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumStepExecutor.js","names":["BaseStepExecutor","parseEthereumErrors","switchChain","getAddresses","TransactionError","LiFiErrorCode","isZeroAddress","EthereumCheckPermitsTask","EthereumCheckAllowanceTask","EthereumNativePermitTask","EthereumResetAllowanceTask","EthereumSetAllowanceTask","CheckBalanceTask","EthereumPrepareTransactionTask","EthereumSignAndExecuteTask","EthereumWaitForTransactionTask","EthereumWaitForTransactionStatusTask","shouldCheckForAllowance","TaskPipeline"],"sources":["../../../src/core/EthereumStepExecutor.ts"],"sourcesContent":["import {\n BaseStepExecutor,\n CheckBalanceTask,\n createDefaultStorage,\n type ExecuteStepRetryError,\n type ExecuteStepRetryParams,\n type ExecutionAction,\n LiFiErrorCode,\n type LiFiStepExtended,\n type SDKClient,\n type SDKError,\n type SDKStorage,\n type StepExecutorBaseContext,\n type StepExecutorOptions,\n TaskPipeline,\n TransactionError,\n} from '@lifi/sdk'\nimport type { Client, GetAddressesReturnType } from 'viem'\nimport { getAddresses } from 'viem/actions'\nimport { getAction } from 'viem/utils'\nimport { parseEthereumErrors } from '../errors/parseEthereumErrors.js'\nimport type { EthereumStepExecutorContext } from '../types.js'\nimport { isZeroAddress } from '../utils/isZeroAddress.js'\nimport { EthereumCheckAllowanceTask } from './tasks/EthereumCheckAllowanceTask.js'\nimport { EthereumCheckPermitsTask } from './tasks/EthereumCheckPermitsTask.js'\nimport { EthereumNativePermitTask } from './tasks/EthereumNativePermitTask.js'\nimport { EthereumPrepareTransactionTask } from './tasks/EthereumPrepareTransactionTask.js'\nimport { EthereumResetAllowanceTask } from './tasks/EthereumResetAllowanceTask.js'\nimport { EthereumSetAllowanceTask } from './tasks/EthereumSetAllowanceTask.js'\nimport { EthereumSignAndExecuteTask } from './tasks/EthereumSignAndExecuteTask.js'\nimport { EthereumWaitForTransactionStatusTask } from './tasks/EthereumWaitForTransactionStatusTask.js'\nimport { EthereumWaitForTransactionTask } from './tasks/EthereumWaitForTransactionTask.js'\nimport { shouldCheckForAllowance } from './tasks/helpers/shouldCheckForAllowance.js'\nimport { switchChain } from './tasks/helpers/switchChain.js'\n\ninterface EthereumStepExecutorOptions extends StepExecutorOptions {\n client: Client\n switchChain?: (chainId: number) => Promise<Client | undefined>\n disableMessageSigning?: boolean\n}\n\nexport class EthereumStepExecutor extends BaseStepExecutor {\n private client: Client\n private switchChain?: (chainId: number) => Promise<Client | undefined>\n private storage?: SDKStorage\n private disableMessageSigning?: boolean\n\n constructor(options: EthereumStepExecutorOptions) {\n super(options)\n this.client = options.client\n this.switchChain = options.switchChain\n this.disableMessageSigning = options.disableMessageSigning\n }\n\n private getStorage = (client: SDKClient): SDKStorage => {\n if (!this.storage) {\n this.storage = client.config.storage ?? createDefaultStorage()\n }\n return this.storage\n }\n\n override parseErrors = (\n error: Error,\n step?: LiFiStepExtended,\n action?: ExecutionAction,\n retryParams?: ExecuteStepRetryParams\n ): Promise<SDKError | ExecuteStepRetryError> =>\n parseEthereumErrors(error, step, action, retryParams)\n\n // Ensure that we are using the right chain and wallet when executing transactions.\n checkClient = async (\n step: LiFiStepExtended,\n targetChainId?: number\n ): Promise<Client | undefined> => {\n const updatedClient = await switchChain(\n this.client,\n targetChainId ?? step.action.fromChainId,\n this.allowUserInteraction,\n this.switchChain\n )\n if (updatedClient) {\n this.client = updatedClient\n }\n\n // Prevent execution of the quote by wallet different from the one which requested the quote\n let accountAddress = this.client.account?.address\n if (!accountAddress) {\n const accountAddresses = (await getAction(\n this.client,\n getAddresses,\n 'getAddresses'\n )(undefined)) as GetAddressesReturnType\n accountAddress = accountAddresses?.[0]\n }\n if (\n accountAddress?.toLowerCase() !== step.action.fromAddress?.toLowerCase()\n ) {\n throw new TransactionError(\n LiFiErrorCode.WalletChangedDuringExecution,\n 'The wallet address that requested the quote does not match the wallet address attempting to sign the transaction.'\n )\n }\n return updatedClient\n }\n\n override createContext = async (\n baseContext: StepExecutorBaseContext\n ): Promise<EthereumStepExecutorContext> => {\n const { step, fromChain } = baseContext\n\n const isFromNativeToken =\n fromChain.nativeToken.address === step.action.fromToken.address &&\n isZeroAddress(step.action.fromToken.address)\n\n // Check if message signing is disabled - useful for smart contract wallets\n // We also disable message signing for custom steps\n const disableMessageSigning =\n !!this.disableMessageSigning || step.type !== 'lifi'\n\n return {\n ...baseContext,\n isFromNativeToken,\n disableMessageSigning,\n ethereumClient: this.client,\n checkClient: this.checkClient,\n getStorage: this.getStorage,\n // Signed typed data for native permits and other messages\n signedTypedData: [],\n // Calls for atomic batch transactions (EIP-5792)\n calls: [],\n }\n }\n\n override createPipeline = (\n context: EthereumStepExecutorContext\n ): TaskPipeline => {\n const { step, isBridgeExecution, isFromNativeToken } = context\n\n const tasks = [\n new EthereumCheckPermitsTask(),\n new EthereumCheckAllowanceTask(),\n new EthereumNativePermitTask(),\n new EthereumResetAllowanceTask(),\n new EthereumSetAllowanceTask(),\n new CheckBalanceTask(),\n new EthereumPrepareTransactionTask(),\n new EthereumSignAndExecuteTask(),\n new EthereumWaitForTransactionTask(),\n new EthereumWaitForTransactionStatusTask(),\n ]\n\n const doCheckAllowance = shouldCheckForAllowance(\n step,\n isBridgeExecution,\n isFromNativeToken,\n this.statusManager\n )\n\n let taskName: string\n if (doCheckAllowance) {\n taskName = EthereumCheckPermitsTask.name\n } else {\n const swapOrBridgeAction = this.statusManager.findAction(\n step,\n isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP'\n )\n taskName =\n swapOrBridgeAction?.txHash || swapOrBridgeAction?.taskId\n ? swapOrBridgeAction?.status === 'DONE'\n ? EthereumWaitForTransactionStatusTask.name\n : EthereumWaitForTransactionTask.name\n : CheckBalanceTask.name\n }\n\n const firstTaskIndex = tasks.findIndex(\n (task) => task.constructor.name === taskName\n )\n\n const tasksToRun = tasks.slice(firstTaskIndex)\n\n return new TaskPipeline(tasksToRun)\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EthereumStepExecutor.js","names":["BaseStepExecutor","parseEthereumErrors","switchChain","getAddresses","TransactionError","LiFiErrorCode","isZeroAddress","EthereumCheckPermitsTask","EthereumCheckAllowanceTask","EthereumNativePermitTask","EthereumResetAllowanceTask","EthereumSetAllowanceTask","CheckBalanceTask","EthereumPrepareTransactionTask","EthereumSignAndExecuteTask","EthereumWaitForTransactionTask","EthereumWaitForTransactionStatusTask","shouldCheckForAllowance","TaskPipeline"],"sources":["../../../src/core/EthereumStepExecutor.ts"],"sourcesContent":["import {\n BaseStepExecutor,\n CheckBalanceTask,\n createDefaultStorage,\n type ExecuteStepRetryError,\n type ExecuteStepRetryParams,\n type ExecutionAction,\n LiFiErrorCode,\n type LiFiStepExtended,\n type SDKClient,\n type SDKError,\n type SDKStorage,\n type StepExecutorBaseContext,\n type StepExecutorOptions,\n TaskPipeline,\n TransactionError,\n} from '@lifi/sdk'\nimport type { Client, GetAddressesReturnType } from 'viem'\nimport { getAddresses } from 'viem/actions'\nimport { getAction } from 'viem/utils'\nimport { parseEthereumErrors } from '../errors/parseEthereumErrors.js'\nimport type { EthereumStepExecutorContext } from '../types.js'\nimport { isZeroAddress } from '../utils/isZeroAddress.js'\nimport { EthereumCheckAllowanceTask } from './tasks/EthereumCheckAllowanceTask.js'\nimport { EthereumCheckPermitsTask } from './tasks/EthereumCheckPermitsTask.js'\nimport { EthereumNativePermitTask } from './tasks/EthereumNativePermitTask.js'\nimport { EthereumPrepareTransactionTask } from './tasks/EthereumPrepareTransactionTask.js'\nimport { EthereumResetAllowanceTask } from './tasks/EthereumResetAllowanceTask.js'\nimport { EthereumSetAllowanceTask } from './tasks/EthereumSetAllowanceTask.js'\nimport { EthereumSignAndExecuteTask } from './tasks/EthereumSignAndExecuteTask.js'\nimport { EthereumWaitForTransactionStatusTask } from './tasks/EthereumWaitForTransactionStatusTask.js'\nimport { EthereumWaitForTransactionTask } from './tasks/EthereumWaitForTransactionTask.js'\nimport { shouldCheckForAllowance } from './tasks/helpers/shouldCheckForAllowance.js'\nimport { switchChain } from './tasks/helpers/switchChain.js'\n\ninterface EthereumStepExecutorOptions extends StepExecutorOptions {\n client: Client\n switchChain?: (chainId: number) => Promise<Client | undefined>\n disableMessageSigning?: boolean\n}\n\nexport class EthereumStepExecutor extends BaseStepExecutor {\n private client: Client\n private switchChain?: (chainId: number) => Promise<Client | undefined>\n private storage?: SDKStorage\n private disableMessageSigning?: boolean\n\n constructor(options: EthereumStepExecutorOptions) {\n super(options)\n this.client = options.client\n this.switchChain = options.switchChain\n this.disableMessageSigning = options.disableMessageSigning\n }\n\n private getStorage = (client: SDKClient): SDKStorage => {\n if (!this.storage) {\n this.storage = client.config.storage ?? createDefaultStorage()\n }\n return this.storage\n }\n\n override parseErrors = (\n error: Error,\n step?: LiFiStepExtended,\n action?: ExecutionAction,\n retryParams?: ExecuteStepRetryParams\n ): Promise<SDKError | ExecuteStepRetryError> =>\n parseEthereumErrors(error, step, action, retryParams)\n\n // Ensure that we are using the right chain and wallet when executing transactions.\n checkClient = async (\n step: LiFiStepExtended,\n targetChainId?: number\n ): Promise<Client | undefined> => {\n const updatedClient = await switchChain(\n this.client,\n targetChainId ?? step.action.fromChainId,\n this.allowUserInteraction,\n this.switchChain\n )\n if (updatedClient) {\n this.client = updatedClient\n }\n\n // Prevent execution of the quote by wallet different from the one which requested the quote\n let accountAddress = this.client.account?.address\n if (!accountAddress) {\n const accountAddresses = (await getAction(\n this.client,\n getAddresses,\n 'getAddresses'\n )(undefined)) as GetAddressesReturnType\n accountAddress = accountAddresses?.[0]\n }\n if (\n accountAddress?.toLowerCase() !== step.action.fromAddress?.toLowerCase()\n ) {\n throw new TransactionError(\n LiFiErrorCode.WalletChangedDuringExecution,\n 'The wallet address that requested the quote does not match the wallet address attempting to sign the transaction.'\n )\n }\n return updatedClient\n }\n\n override createContext = async (\n baseContext: StepExecutorBaseContext\n ): Promise<EthereumStepExecutorContext> => {\n const { step, fromChain } = baseContext\n\n const isFromNativeToken =\n fromChain.nativeToken.address === step.action.fromToken.address &&\n isZeroAddress(step.action.fromToken.address)\n\n // Check if message signing is disabled - useful for smart contract wallets\n // We also disable message signing for custom steps\n const disableMessageSigning =\n !!this.disableMessageSigning || step.type !== 'lifi'\n\n return {\n ...baseContext,\n isFromNativeToken,\n disableMessageSigning,\n ethereumClient: this.client,\n checkClient: this.checkClient,\n getStorage: this.getStorage,\n // Signed typed data for native permits and other messages\n signedTypedData: [],\n // Calls for atomic batch transactions (EIP-5792)\n calls: [],\n }\n }\n\n override createPipeline = (\n context: EthereumStepExecutorContext\n ): TaskPipeline => {\n const { step, isBridgeExecution, isFromNativeToken } = context\n\n const tasks = [\n new EthereumCheckPermitsTask(),\n new EthereumCheckAllowanceTask(),\n new EthereumNativePermitTask(),\n new EthereumResetAllowanceTask(),\n new EthereumSetAllowanceTask(),\n new CheckBalanceTask(),\n new EthereumPrepareTransactionTask(),\n new EthereumSignAndExecuteTask(),\n new EthereumWaitForTransactionTask(),\n new EthereumWaitForTransactionStatusTask(),\n ]\n\n const doCheckAllowance = shouldCheckForAllowance(\n step,\n isBridgeExecution,\n isFromNativeToken,\n this.statusManager\n )\n\n let taskName: string\n if (doCheckAllowance) {\n taskName = EthereumCheckPermitsTask.name\n } else {\n const swapOrBridgeAction = this.statusManager.findAction(\n step,\n isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP'\n )\n taskName =\n swapOrBridgeAction?.txHash || swapOrBridgeAction?.taskId\n ? swapOrBridgeAction?.status === 'DONE'\n ? EthereumWaitForTransactionStatusTask.name\n : EthereumWaitForTransactionTask.name\n : CheckBalanceTask.name\n }\n\n const firstTaskIndex = tasks.findIndex(\n (task) => task.constructor.name === taskName\n )\n\n const tasksToRun = tasks.slice(firstTaskIndex)\n\n return new TaskPipeline(tasksToRun)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyCA,IAAa,uBAAb,cAA0CA,UAAAA,iBAAiB;CACzD;CACA;CACA;CACA;CAEA,YAAY,SAAsC;AAChD,QAAM,QAAQ;AACd,OAAK,SAAS,QAAQ;AACtB,OAAK,cAAc,QAAQ;AAC3B,OAAK,wBAAwB,QAAQ;;CAGvC,cAAsB,WAAkC;AACtD,MAAI,CAAC,KAAK,QACR,MAAK,UAAU,OAAO,OAAO,YAAA,GAAA,UAAA,uBAAiC;AAEhE,SAAO,KAAK;;CAGd,eACE,OACA,MACA,QACA,gBAEAC,mCAAAA,oBAAoB,OAAO,MAAM,QAAQ,YAAY;CAGvD,cAAc,OACZ,MACA,kBACgC;EAChC,MAAM,gBAAgB,MAAMC,uCAAAA,YAC1B,KAAK,QACL,iBAAiB,KAAK,OAAO,aAC7B,KAAK,sBACL,KAAK,YACN;AACD,MAAI,cACF,MAAK,SAAS;EAIhB,IAAI,iBAAiB,KAAK,OAAO,SAAS;AAC1C,MAAI,CAAC,eAMH,mBAL0B,OAAA,GAAA,WAAA,WACxB,KAAK,QACLC,aAAAA,cACA,eACD,CAAC,KAAA,EAAU,IACwB;AAEtC,MACE,gBAAgB,aAAa,KAAK,KAAK,OAAO,aAAa,aAAa,CAExE,OAAM,IAAIC,UAAAA,iBACRC,UAAAA,cAAc,8BACd,oHACD;AAEH,SAAO;;CAGT,gBAAyB,OACvB,gBACyC;EACzC,MAAM,EAAE,MAAM,cAAc;EAE5B,MAAM,oBACJ,UAAU,YAAY,YAAY,KAAK,OAAO,UAAU,WACxDC,4BAAAA,cAAc,KAAK,OAAO,UAAU,QAAQ;EAI9C,MAAM,wBACJ,CAAC,CAAC,KAAK,yBAAyB,KAAK,SAAS;AAEhD,SAAO;GACL,GAAG;GACH;GACA;GACA,gBAAgB,KAAK;GACrB,aAAa,KAAK;GAClB,YAAY,KAAK;GAEjB,iBAAiB,EAAE;GAEnB,OAAO,EAAE;GACV;;CAGH,kBACE,YACiB;EACjB,MAAM,EAAE,MAAM,mBAAmB,sBAAsB;EAEvD,MAAM,QAAQ;GACZ,IAAIC,4CAAAA,0BAA0B;GAC9B,IAAIC,8CAAAA,4BAA4B;GAChC,IAAIC,4CAAAA,0BAA0B;GAC9B,IAAIC,8CAAAA,4BAA4B;GAChC,IAAIC,4CAAAA,0BAA0B;GAC9B,IAAIC,UAAAA,kBAAkB;GACtB,IAAIC,kDAAAA,gCAAgC;GACpC,IAAIC,8CAAAA,4BAA4B;GAChC,IAAIC,kDAAAA,gCAAgC;GACpC,IAAIC,wDAAAA,sCAAsC;GAC3C;EAED,MAAM,mBAAmBC,mDAAAA,wBACvB,MACA,mBACA,mBACA,KAAK,cACN;EAED,IAAI;AACJ,MAAI,iBACF,YAAWV,4CAAAA,yBAAyB;OAC/B;GACL,MAAM,qBAAqB,KAAK,cAAc,WAC5C,MACA,oBAAoB,gBAAgB,OACrC;AACD,cACE,oBAAoB,UAAU,oBAAoB,SAC9C,oBAAoB,WAAW,SAC7BS,wDAAAA,qCAAqC,OACrCD,kDAAAA,+BAA+B,OACjCH,UAAAA,iBAAiB;;EAGzB,MAAM,iBAAiB,MAAM,WAC1B,SAAS,KAAK,YAAY,SAAS,SACrC;AAID,SAAO,IAAIM,UAAAA,aAFQ,MAAM,MAAM,eAAe,CAEX"}
|
|
@@ -3,7 +3,7 @@ import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
|
|
|
3
3
|
|
|
4
4
|
//#region src/core/tasks/EthereumCheckAllowanceTask.d.ts
|
|
5
5
|
declare class EthereumCheckAllowanceTask extends BaseStepExecutionTask {
|
|
6
|
-
shouldRun(context: EthereumStepExecutorContext): Promise<boolean>;
|
|
6
|
+
override shouldRun(context: EthereumStepExecutorContext): Promise<boolean>;
|
|
7
7
|
run(context: EthereumStepExecutorContext): Promise<TaskResult>;
|
|
8
8
|
}
|
|
9
9
|
//#endregion
|
|
@@ -3,7 +3,7 @@ import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
|
|
|
3
3
|
|
|
4
4
|
//#region src/core/tasks/EthereumCheckPermitsTask.d.ts
|
|
5
5
|
declare class EthereumCheckPermitsTask extends BaseStepExecutionTask {
|
|
6
|
-
shouldRun(context: EthereumStepExecutorContext): Promise<boolean>;
|
|
6
|
+
override shouldRun(context: EthereumStepExecutorContext): Promise<boolean>;
|
|
7
7
|
run(context: EthereumStepExecutorContext): Promise<TaskResult>;
|
|
8
8
|
}
|
|
9
9
|
//#endregion
|
|
@@ -3,7 +3,7 @@ import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
|
|
|
3
3
|
|
|
4
4
|
//#region src/core/tasks/EthereumNativePermitTask.d.ts
|
|
5
5
|
declare class EthereumNativePermitTask extends BaseStepExecutionTask {
|
|
6
|
-
shouldRun(context: EthereumStepExecutorContext): Promise<boolean>;
|
|
6
|
+
override shouldRun(context: EthereumStepExecutorContext): Promise<boolean>;
|
|
7
7
|
run(context: EthereumStepExecutorContext): Promise<TaskResult>;
|
|
8
8
|
}
|
|
9
9
|
//#endregion
|
|
@@ -3,7 +3,7 @@ import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
|
|
|
3
3
|
|
|
4
4
|
//#region src/core/tasks/EthereumResetAllowanceTask.d.ts
|
|
5
5
|
declare class EthereumResetAllowanceTask extends BaseStepExecutionTask {
|
|
6
|
-
shouldRun(context: EthereumStepExecutorContext): Promise<boolean>;
|
|
6
|
+
override shouldRun(context: EthereumStepExecutorContext): Promise<boolean>;
|
|
7
7
|
run(context: EthereumStepExecutorContext): Promise<TaskResult>;
|
|
8
8
|
}
|
|
9
9
|
//#endregion
|
|
@@ -3,7 +3,7 @@ import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
|
|
|
3
3
|
|
|
4
4
|
//#region src/core/tasks/EthereumSetAllowanceTask.d.ts
|
|
5
5
|
declare class EthereumSetAllowanceTask extends BaseStepExecutionTask {
|
|
6
|
-
shouldRun(context: EthereumStepExecutorContext): Promise<boolean>;
|
|
6
|
+
override shouldRun(context: EthereumStepExecutorContext): Promise<boolean>;
|
|
7
7
|
run(context: EthereumStepExecutorContext): Promise<TaskResult>;
|
|
8
8
|
}
|
|
9
9
|
//#endregion
|
package/dist/cjs/version.d.ts
CHANGED
package/dist/cjs/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
//#region src/version.ts
|
|
3
3
|
const name = "@lifi/sdk-provider-ethereum";
|
|
4
|
-
const version = "4.0.0-beta.
|
|
4
|
+
const version = "4.0.0-beta.4";
|
|
5
5
|
//#endregion
|
|
6
6
|
exports.name = name;
|
|
7
7
|
exports.version = version;
|
package/dist/cjs/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk-provider-ethereum'\nexport const version = '4.0.0-beta.
|
|
1
|
+
{"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk-provider-ethereum'\nexport const version = '4.0.0-beta.4'\n"],"mappings":";;AAAA,MAAa,OAAO;AACpB,MAAa,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","names":[],"sources":["../../../src/actions/constants.ts"],"mappings":";;;;cAGa,0BAAA,EAA4B,MAAA,SAAe,OAAA;AAAA,cAK3C,kBAAA,GAAsB,OAAA,aAAkB,OAAA;AAAA,cAGxC,iBAAA;EAAA,SAET,QAAA;EAAA,SACA,MAAA;IAAA,SAEI,YAAA;IAAA,SACA,IAAA;IAAA,SACA,IAAA;EAAA;IAAA,SAGA,YAAA;IAAA,SACA,IAAA;IAAA,SACA,IAAA;EAAA;EAAA,SAGJ,IAAA;EAAA,SACA,OAAA;IAAA,SAEI,YAAA;IAAA,SACA,IAAA;IAAA,SACA,IAAA;EAAA;IAAA,SAGA,YAAA;IAAA,SACA,IAAA;IAAA,SACA,IAAA;EAAA;IAAA,SAGA,YAAA;IAAA,SACA,IAAA;IAAA,SACA,IAAA;EAAA;EAAA,SAGJ,OAAA;EAAA,SACA,eAAA;EAAA,SACA,IAAA;AAAA;EAAA,SAGA,MAAA;IAAA,SAAW,YAAA;IAAA,SAAyB,IAAA;IAAA,SAAiB,IAAA;EAAA;EAAA,SACrD,IAAA;EAAA,SACA,OAAA;IAAA,SAAY,YAAA;IAAA,SAAsB,IAAA;IAAA,SAAU,IAAA;EAAA;EAAA,SAC5C,eAAA;EAAA,SACA,IAAA;AAAA;AAAA,cAIS,wBAAA,EAA0B,MAAA,CAAO,SAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","names":[],"sources":["../../../src/actions/constants.ts"],"mappings":";;;;cAGa,0BAAA,EAA4B,MAAA,SAAe,OAAA;AAAA,cAK3C,kBAAA,GAAsB,OAAA,aAAkB,OAAA;AAAA,cAGxC,iBAAA;EAAA,SAET,QAAA;EAAA,SACA,MAAA;IAAA,SAEI,YAAA;IAAA,SACA,IAAA;IAAA,SACA,IAAA;EAAA;IAAA,SAGA,YAAA;IAAA,SACA,IAAA;IAAA,SACA,IAAA;EAAA;EAAA,SAGJ,IAAA;EAAA,SACA,OAAA;IAAA,SAEI,YAAA;IAAA,SACA,IAAA;IAAA,SACA,IAAA;EAAA;IAAA,SAGA,YAAA;IAAA,SACA,IAAA;IAAA,SACA,IAAA;EAAA;IAAA,SAGA,YAAA;IAAA,SACA,IAAA;IAAA,SACA,IAAA;EAAA;EAAA,SAGJ,OAAA;EAAA,SACA,eAAA;EAAA,SACA,IAAA;AAAA;EAAA,SAGA,MAAA;IAAA,SAAW,YAAA;IAAA,SAAyB,IAAA;IAAA,SAAiB,IAAA;EAAA;EAAA,SACrD,IAAA;EAAA,SACA,OAAA;IAAA,SAAY,YAAA;IAAA,SAAsB,IAAA;IAAA,SAAU,IAAA;EAAA;EAAA,SAC5C,eAAA;EAAA,SACA,IAAA;AAAA;AAAA,cAIS,wBAAA,EAA0B,MAAA,CAAO,SAAA;AAAA,cASjC,sBAAA,EAAwB,OAAA,CAAQ,MAAA,CAAO,OAAA;AAAA,cAWvC,qBAAA,EAAuB,MAAA,CAAO,SAAA"}
|
|
@@ -57,7 +57,8 @@ const CHAIN_TYPE_UNS_CHAIN_MAP = {
|
|
|
57
57
|
[ChainType.MVM]: "SUI",
|
|
58
58
|
[ChainType.SVM]: "SOL",
|
|
59
59
|
[ChainType.UTXO]: "BTC",
|
|
60
|
-
[ChainType.TVM]: "TRON"
|
|
60
|
+
[ChainType.TVM]: "TRON",
|
|
61
|
+
[ChainType.STL]: "XLM"
|
|
61
62
|
};
|
|
62
63
|
const CHAIN_ID_UNS_CHAIN_MAP = {
|
|
63
64
|
[ChainId.ETH]: "ETH",
|
|
@@ -74,7 +75,8 @@ const CHAIN_TYPE_FAMILY_MAP = {
|
|
|
74
75
|
[ChainType.UTXO]: "BTC",
|
|
75
76
|
[ChainType.SVM]: "SOL",
|
|
76
77
|
[ChainType.MVM]: "SUI",
|
|
77
|
-
[ChainType.TVM]: "TRON"
|
|
78
|
+
[ChainType.TVM]: "TRON",
|
|
79
|
+
[ChainType.STL]: "XLM"
|
|
78
80
|
};
|
|
79
81
|
//#endregion
|
|
80
82
|
export { CHAIN_ID_UNS_CHAIN_MAP, CHAIN_TYPE_FAMILY_MAP, CHAIN_TYPE_UNS_CHAIN_MAP, UNSProxyReaderABI, UNS_PROXY_READER_ADDRESSES, getUNSProxyAddress };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":[],"sources":["../../../src/actions/constants.ts"],"sourcesContent":["import { ChainId, ChainType } from '@lifi/sdk'\nimport type { Address } from 'viem'\n\nexport const UNS_PROXY_READER_ADDRESSES: Record<number, Address> = {\n [ChainId.ETH]: '0x578853aa776Eef10CeE6c4dd2B5862bdcE767A8B',\n [ChainId.POL]: '0x91EDd8708062bd4233f4Dd0FCE15A7cb4d500091',\n} as const\n\nexport const getUNSProxyAddress = (chainId: number): Address | undefined =>\n UNS_PROXY_READER_ADDRESSES[chainId]\n\nexport const UNSProxyReaderABI = [\n {\n constant: true,\n inputs: [\n {\n internalType: 'string[]',\n name: 'keys',\n type: 'string[]',\n },\n {\n internalType: 'uint256',\n name: 'tokenId',\n type: 'uint256',\n },\n ],\n name: 'getData',\n outputs: [\n {\n internalType: 'address',\n name: 'resolver',\n type: 'address',\n },\n {\n internalType: 'address',\n name: 'owner',\n type: 'address',\n },\n {\n internalType: 'string[]',\n name: 'values',\n type: 'string[]',\n },\n ],\n payable: false,\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [{ internalType: 'uint256', name: 'tokenId', type: 'uint256' }],\n name: 'exists',\n outputs: [{ internalType: 'bool', name: '', type: 'bool' }],\n stateMutability: 'view',\n type: 'function',\n },\n] as const\n\nexport const CHAIN_TYPE_UNS_CHAIN_MAP: Record<ChainType, string> = {\n [ChainType.EVM]: 'ETH',\n [ChainType.MVM]: 'SUI',\n [ChainType.SVM]: 'SOL',\n [ChainType.UTXO]: 'BTC',\n [ChainType.TVM]: 'TRON',\n}\n\nexport const CHAIN_ID_UNS_CHAIN_MAP: Partial<Record<ChainId, string>> = {\n [ChainId.ETH]: 'ETH',\n [ChainId.BTC]: 'BTC',\n [ChainId.SUI]: 'SUI',\n [ChainId.SOL]: 'SOL',\n [ChainId.BAS]: 'BASE',\n [ChainId.POL]: 'MATIC',\n [ChainId.ARB]: 'ARB1',\n [ChainId.AVA]: 'AVAX',\n}\n\nexport const CHAIN_TYPE_FAMILY_MAP: Record<ChainType, string> = {\n [ChainType.EVM]: 'EVM',\n [ChainType.UTXO]: 'BTC',\n [ChainType.SVM]: 'SOL',\n [ChainType.MVM]: 'SUI',\n [ChainType.TVM]: 'TRON',\n}\n"],"mappings":";;AAGA,MAAa,6BAAsD;EAChE,QAAQ,MAAM;EACd,QAAQ,MAAM;CAChB;AAED,MAAa,sBAAsB,YACjC,2BAA2B;AAE7B,MAAa,oBAAoB,CAC/B;CACE,UAAU;CACV,QAAQ,CACN;EACE,cAAc;EACd,MAAM;EACN,MAAM;EACP,EACD;EACE,cAAc;EACd,MAAM;EACN,MAAM;EACP,CACF;CACD,MAAM;CACN,SAAS;EACP;GACE,cAAc;GACd,MAAM;GACN,MAAM;GACP;EACD;GACE,cAAc;GACd,MAAM;GACN,MAAM;GACP;EACD;GACE,cAAc;GACd,MAAM;GACN,MAAM;GACP;EACF;CACD,SAAS;CACT,iBAAiB;CACjB,MAAM;CACP,EACD;CACE,QAAQ,CAAC;EAAE,cAAc;EAAW,MAAM;EAAW,MAAM;EAAW,CAAC;CACvE,MAAM;CACN,SAAS,CAAC;EAAE,cAAc;EAAQ,MAAM;EAAI,MAAM;EAAQ,CAAC;CAC3D,iBAAiB;CACjB,MAAM;CACP,CACF;AAED,MAAa,2BAAsD;EAChE,UAAU,MAAM;EAChB,UAAU,MAAM;EAChB,UAAU,MAAM;EAChB,UAAU,OAAO;EACjB,UAAU,MAAM;CAClB;AAED,MAAa,yBAA2D;EACrE,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,QAAQ,MAAM;CAChB;AAED,MAAa,wBAAmD;EAC7D,UAAU,MAAM;EAChB,UAAU,OAAO;EACjB,UAAU,MAAM;EAChB,UAAU,MAAM;EAChB,UAAU,MAAM;CAClB"}
|
|
1
|
+
{"version":3,"file":"constants.js","names":[],"sources":["../../../src/actions/constants.ts"],"sourcesContent":["import { ChainId, ChainType } from '@lifi/sdk'\nimport type { Address } from 'viem'\n\nexport const UNS_PROXY_READER_ADDRESSES: Record<number, Address> = {\n [ChainId.ETH]: '0x578853aa776Eef10CeE6c4dd2B5862bdcE767A8B',\n [ChainId.POL]: '0x91EDd8708062bd4233f4Dd0FCE15A7cb4d500091',\n} as const\n\nexport const getUNSProxyAddress = (chainId: number): Address | undefined =>\n UNS_PROXY_READER_ADDRESSES[chainId]\n\nexport const UNSProxyReaderABI = [\n {\n constant: true,\n inputs: [\n {\n internalType: 'string[]',\n name: 'keys',\n type: 'string[]',\n },\n {\n internalType: 'uint256',\n name: 'tokenId',\n type: 'uint256',\n },\n ],\n name: 'getData',\n outputs: [\n {\n internalType: 'address',\n name: 'resolver',\n type: 'address',\n },\n {\n internalType: 'address',\n name: 'owner',\n type: 'address',\n },\n {\n internalType: 'string[]',\n name: 'values',\n type: 'string[]',\n },\n ],\n payable: false,\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [{ internalType: 'uint256', name: 'tokenId', type: 'uint256' }],\n name: 'exists',\n outputs: [{ internalType: 'bool', name: '', type: 'bool' }],\n stateMutability: 'view',\n type: 'function',\n },\n] as const\n\nexport const CHAIN_TYPE_UNS_CHAIN_MAP: Record<ChainType, string> = {\n [ChainType.EVM]: 'ETH',\n [ChainType.MVM]: 'SUI',\n [ChainType.SVM]: 'SOL',\n [ChainType.UTXO]: 'BTC',\n [ChainType.TVM]: 'TRON',\n [ChainType.STL]: 'XLM',\n}\n\nexport const CHAIN_ID_UNS_CHAIN_MAP: Partial<Record<ChainId, string>> = {\n [ChainId.ETH]: 'ETH',\n [ChainId.BTC]: 'BTC',\n [ChainId.SUI]: 'SUI',\n [ChainId.SOL]: 'SOL',\n [ChainId.BAS]: 'BASE',\n [ChainId.POL]: 'MATIC',\n [ChainId.ARB]: 'ARB1',\n [ChainId.AVA]: 'AVAX',\n}\n\nexport const CHAIN_TYPE_FAMILY_MAP: Record<ChainType, string> = {\n [ChainType.EVM]: 'EVM',\n [ChainType.UTXO]: 'BTC',\n [ChainType.SVM]: 'SOL',\n [ChainType.MVM]: 'SUI',\n [ChainType.TVM]: 'TRON',\n [ChainType.STL]: 'XLM',\n}\n"],"mappings":";;AAGA,MAAa,6BAAsD;EAChE,QAAQ,MAAM;EACd,QAAQ,MAAM;CAChB;AAED,MAAa,sBAAsB,YACjC,2BAA2B;AAE7B,MAAa,oBAAoB,CAC/B;CACE,UAAU;CACV,QAAQ,CACN;EACE,cAAc;EACd,MAAM;EACN,MAAM;EACP,EACD;EACE,cAAc;EACd,MAAM;EACN,MAAM;EACP,CACF;CACD,MAAM;CACN,SAAS;EACP;GACE,cAAc;GACd,MAAM;GACN,MAAM;GACP;EACD;GACE,cAAc;GACd,MAAM;GACN,MAAM;GACP;EACD;GACE,cAAc;GACd,MAAM;GACN,MAAM;GACP;EACF;CACD,SAAS;CACT,iBAAiB;CACjB,MAAM;CACP,EACD;CACE,QAAQ,CAAC;EAAE,cAAc;EAAW,MAAM;EAAW,MAAM;EAAW,CAAC;CACvE,MAAM;CACN,SAAS,CAAC;EAAE,cAAc;EAAQ,MAAM;EAAI,MAAM;EAAQ,CAAC;CAC3D,iBAAiB;CACjB,MAAM;CACP,CACF;AAED,MAAa,2BAAsD;EAChE,UAAU,MAAM;EAChB,UAAU,MAAM;EAChB,UAAU,MAAM;EAChB,UAAU,OAAO;EACjB,UAAU,MAAM;EAChB,UAAU,MAAM;CAClB;AAED,MAAa,yBAA2D;EACrE,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,QAAQ,MAAM;CAChB;AAED,MAAa,wBAAmD;EAC7D,UAAU,MAAM;EAChB,UAAU,OAAO;EACjB,UAAU,MAAM;EAChB,UAAU,MAAM;EAChB,UAAU,MAAM;EAChB,UAAU,MAAM;CAClB"}
|
|
@@ -15,10 +15,10 @@ declare class EthereumStepExecutor extends BaseStepExecutor {
|
|
|
15
15
|
private disableMessageSigning?;
|
|
16
16
|
constructor(options: EthereumStepExecutorOptions);
|
|
17
17
|
private getStorage;
|
|
18
|
-
parseErrors: (error: Error, step?: LiFiStepExtended, action?: ExecutionAction, retryParams?: ExecuteStepRetryParams) => Promise<SDKError | ExecuteStepRetryError>;
|
|
18
|
+
override parseErrors: (error: Error, step?: LiFiStepExtended, action?: ExecutionAction, retryParams?: ExecuteStepRetryParams) => Promise<SDKError | ExecuteStepRetryError>;
|
|
19
19
|
checkClient: (step: LiFiStepExtended, targetChainId?: number) => Promise<Client | undefined>;
|
|
20
|
-
createContext: (baseContext: StepExecutorBaseContext) => Promise<EthereumStepExecutorContext>;
|
|
21
|
-
createPipeline: (context: EthereumStepExecutorContext) => TaskPipeline;
|
|
20
|
+
override createContext: (baseContext: StepExecutorBaseContext) => Promise<EthereumStepExecutorContext>;
|
|
21
|
+
override createPipeline: (context: EthereumStepExecutorContext) => TaskPipeline;
|
|
22
22
|
}
|
|
23
23
|
//#endregion
|
|
24
24
|
export { EthereumStepExecutor };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumStepExecutor.d.ts","names":[],"sources":["../../../src/core/EthereumStepExecutor.ts"],"mappings":";;;;;UAmCU,2BAAA,SAAoC,mBAAA;EAC5C,MAAA,EAAQ,MAAA;EACR,WAAA,IAAe,OAAA,aAAoB,OAAA,CAAQ,MAAA;EAC3C,qBAAA;AAAA;AAAA,cAGW,oBAAA,SAA6B,gBAAA;EAAA,QAChC,MAAA;EAAA,QACA,WAAA;EAAA,QACA,OAAA;EAAA,QACA,qBAAA;EAER,WAAA,CAAY,OAAA,EAAS,2BAAA;EAAA,QAOb,UAAA;
|
|
1
|
+
{"version":3,"file":"EthereumStepExecutor.d.ts","names":[],"sources":["../../../src/core/EthereumStepExecutor.ts"],"mappings":";;;;;UAmCU,2BAAA,SAAoC,mBAAA;EAC5C,MAAA,EAAQ,MAAA;EACR,WAAA,IAAe,OAAA,aAAoB,OAAA,CAAQ,MAAA;EAC3C,qBAAA;AAAA;AAAA,cAGW,oBAAA,SAA6B,gBAAA;EAAA,QAChC,MAAA;EAAA,QACA,WAAA;EAAA,QACA,OAAA;EAAA,QACA,qBAAA;EAER,WAAA,CAAY,OAAA,EAAS,2BAAA;EAAA,QAOb,UAAA;EAAA,SAOC,WAAA,GACP,KAAA,EAAO,KAAA,EACP,IAAA,GAAO,gBAAA,EACP,MAAA,GAAS,eAAA,EACT,WAAA,GAAc,sBAAA,KACb,OAAA,CAAQ,QAAA,GAAW,qBAAA;EAItB,WAAA,GACE,IAAA,EAAM,gBAAA,EACN,aAAA,cACC,OAAA,CAAQ,MAAA;EAAA,SAgCF,aAAA,GACP,WAAA,EAAa,uBAAA,KACZ,OAAA,CAAQ,2BAAA;EAAA,SA0BF,cAAA,GACP,OAAA,EAAS,2BAAA,KACR,YAAA;AAAA"}
|
|
@@ -11,74 +11,73 @@ import { EthereumWaitForTransactionStatusTask } from "./tasks/EthereumWaitForTra
|
|
|
11
11
|
import { EthereumWaitForTransactionTask } from "./tasks/EthereumWaitForTransactionTask.js";
|
|
12
12
|
import { shouldCheckForAllowance } from "./tasks/helpers/shouldCheckForAllowance.js";
|
|
13
13
|
import { switchChain } from "./tasks/helpers/switchChain.js";
|
|
14
|
-
import { _defineProperty } from "../_virtual/_@oxc-project_runtime@0.115.0/helpers/defineProperty.js";
|
|
15
14
|
import { BaseStepExecutor, CheckBalanceTask, LiFiErrorCode, TaskPipeline, TransactionError, createDefaultStorage } from "@lifi/sdk";
|
|
16
15
|
import { getAddresses } from "viem/actions";
|
|
17
16
|
import { getAction } from "viem/utils";
|
|
18
17
|
//#region src/core/EthereumStepExecutor.ts
|
|
19
18
|
var EthereumStepExecutor = class extends BaseStepExecutor {
|
|
19
|
+
client;
|
|
20
|
+
switchChain;
|
|
21
|
+
storage;
|
|
22
|
+
disableMessageSigning;
|
|
20
23
|
constructor(options) {
|
|
21
24
|
super(options);
|
|
22
|
-
_defineProperty(this, "client", void 0);
|
|
23
|
-
_defineProperty(this, "switchChain", void 0);
|
|
24
|
-
_defineProperty(this, "storage", void 0);
|
|
25
|
-
_defineProperty(this, "disableMessageSigning", void 0);
|
|
26
|
-
_defineProperty(this, "getStorage", (client) => {
|
|
27
|
-
if (!this.storage) this.storage = client.config.storage ?? createDefaultStorage();
|
|
28
|
-
return this.storage;
|
|
29
|
-
});
|
|
30
|
-
_defineProperty(this, "parseErrors", (error, step, action, retryParams) => parseEthereumErrors(error, step, action, retryParams));
|
|
31
|
-
_defineProperty(this, "checkClient", async (step, targetChainId) => {
|
|
32
|
-
const updatedClient = await switchChain(this.client, targetChainId ?? step.action.fromChainId, this.allowUserInteraction, this.switchChain);
|
|
33
|
-
if (updatedClient) this.client = updatedClient;
|
|
34
|
-
let accountAddress = this.client.account?.address;
|
|
35
|
-
if (!accountAddress) accountAddress = (await getAction(this.client, getAddresses, "getAddresses")(void 0))?.[0];
|
|
36
|
-
if (accountAddress?.toLowerCase() !== step.action.fromAddress?.toLowerCase()) throw new TransactionError(LiFiErrorCode.WalletChangedDuringExecution, "The wallet address that requested the quote does not match the wallet address attempting to sign the transaction.");
|
|
37
|
-
return updatedClient;
|
|
38
|
-
});
|
|
39
|
-
_defineProperty(this, "createContext", async (baseContext) => {
|
|
40
|
-
const { step, fromChain } = baseContext;
|
|
41
|
-
const isFromNativeToken = fromChain.nativeToken.address === step.action.fromToken.address && isZeroAddress(step.action.fromToken.address);
|
|
42
|
-
const disableMessageSigning = !!this.disableMessageSigning || step.type !== "lifi";
|
|
43
|
-
return {
|
|
44
|
-
...baseContext,
|
|
45
|
-
isFromNativeToken,
|
|
46
|
-
disableMessageSigning,
|
|
47
|
-
ethereumClient: this.client,
|
|
48
|
-
checkClient: this.checkClient,
|
|
49
|
-
getStorage: this.getStorage,
|
|
50
|
-
signedTypedData: [],
|
|
51
|
-
calls: []
|
|
52
|
-
};
|
|
53
|
-
});
|
|
54
|
-
_defineProperty(this, "createPipeline", (context) => {
|
|
55
|
-
const { step, isBridgeExecution, isFromNativeToken } = context;
|
|
56
|
-
const tasks = [
|
|
57
|
-
new EthereumCheckPermitsTask(),
|
|
58
|
-
new EthereumCheckAllowanceTask(),
|
|
59
|
-
new EthereumNativePermitTask(),
|
|
60
|
-
new EthereumResetAllowanceTask(),
|
|
61
|
-
new EthereumSetAllowanceTask(),
|
|
62
|
-
new CheckBalanceTask(),
|
|
63
|
-
new EthereumPrepareTransactionTask(),
|
|
64
|
-
new EthereumSignAndExecuteTask(),
|
|
65
|
-
new EthereumWaitForTransactionTask(),
|
|
66
|
-
new EthereumWaitForTransactionStatusTask()
|
|
67
|
-
];
|
|
68
|
-
const doCheckAllowance = shouldCheckForAllowance(step, isBridgeExecution, isFromNativeToken, this.statusManager);
|
|
69
|
-
let taskName;
|
|
70
|
-
if (doCheckAllowance) taskName = EthereumCheckPermitsTask.name;
|
|
71
|
-
else {
|
|
72
|
-
const swapOrBridgeAction = this.statusManager.findAction(step, isBridgeExecution ? "CROSS_CHAIN" : "SWAP");
|
|
73
|
-
taskName = swapOrBridgeAction?.txHash || swapOrBridgeAction?.taskId ? swapOrBridgeAction?.status === "DONE" ? EthereumWaitForTransactionStatusTask.name : EthereumWaitForTransactionTask.name : CheckBalanceTask.name;
|
|
74
|
-
}
|
|
75
|
-
const firstTaskIndex = tasks.findIndex((task) => task.constructor.name === taskName);
|
|
76
|
-
return new TaskPipeline(tasks.slice(firstTaskIndex));
|
|
77
|
-
});
|
|
78
25
|
this.client = options.client;
|
|
79
26
|
this.switchChain = options.switchChain;
|
|
80
27
|
this.disableMessageSigning = options.disableMessageSigning;
|
|
81
28
|
}
|
|
29
|
+
getStorage = (client) => {
|
|
30
|
+
if (!this.storage) this.storage = client.config.storage ?? createDefaultStorage();
|
|
31
|
+
return this.storage;
|
|
32
|
+
};
|
|
33
|
+
parseErrors = (error, step, action, retryParams) => parseEthereumErrors(error, step, action, retryParams);
|
|
34
|
+
checkClient = async (step, targetChainId) => {
|
|
35
|
+
const updatedClient = await switchChain(this.client, targetChainId ?? step.action.fromChainId, this.allowUserInteraction, this.switchChain);
|
|
36
|
+
if (updatedClient) this.client = updatedClient;
|
|
37
|
+
let accountAddress = this.client.account?.address;
|
|
38
|
+
if (!accountAddress) accountAddress = (await getAction(this.client, getAddresses, "getAddresses")(void 0))?.[0];
|
|
39
|
+
if (accountAddress?.toLowerCase() !== step.action.fromAddress?.toLowerCase()) throw new TransactionError(LiFiErrorCode.WalletChangedDuringExecution, "The wallet address that requested the quote does not match the wallet address attempting to sign the transaction.");
|
|
40
|
+
return updatedClient;
|
|
41
|
+
};
|
|
42
|
+
createContext = async (baseContext) => {
|
|
43
|
+
const { step, fromChain } = baseContext;
|
|
44
|
+
const isFromNativeToken = fromChain.nativeToken.address === step.action.fromToken.address && isZeroAddress(step.action.fromToken.address);
|
|
45
|
+
const disableMessageSigning = !!this.disableMessageSigning || step.type !== "lifi";
|
|
46
|
+
return {
|
|
47
|
+
...baseContext,
|
|
48
|
+
isFromNativeToken,
|
|
49
|
+
disableMessageSigning,
|
|
50
|
+
ethereumClient: this.client,
|
|
51
|
+
checkClient: this.checkClient,
|
|
52
|
+
getStorage: this.getStorage,
|
|
53
|
+
signedTypedData: [],
|
|
54
|
+
calls: []
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
createPipeline = (context) => {
|
|
58
|
+
const { step, isBridgeExecution, isFromNativeToken } = context;
|
|
59
|
+
const tasks = [
|
|
60
|
+
new EthereumCheckPermitsTask(),
|
|
61
|
+
new EthereumCheckAllowanceTask(),
|
|
62
|
+
new EthereumNativePermitTask(),
|
|
63
|
+
new EthereumResetAllowanceTask(),
|
|
64
|
+
new EthereumSetAllowanceTask(),
|
|
65
|
+
new CheckBalanceTask(),
|
|
66
|
+
new EthereumPrepareTransactionTask(),
|
|
67
|
+
new EthereumSignAndExecuteTask(),
|
|
68
|
+
new EthereumWaitForTransactionTask(),
|
|
69
|
+
new EthereumWaitForTransactionStatusTask()
|
|
70
|
+
];
|
|
71
|
+
const doCheckAllowance = shouldCheckForAllowance(step, isBridgeExecution, isFromNativeToken, this.statusManager);
|
|
72
|
+
let taskName;
|
|
73
|
+
if (doCheckAllowance) taskName = EthereumCheckPermitsTask.name;
|
|
74
|
+
else {
|
|
75
|
+
const swapOrBridgeAction = this.statusManager.findAction(step, isBridgeExecution ? "CROSS_CHAIN" : "SWAP");
|
|
76
|
+
taskName = swapOrBridgeAction?.txHash || swapOrBridgeAction?.taskId ? swapOrBridgeAction?.status === "DONE" ? EthereumWaitForTransactionStatusTask.name : EthereumWaitForTransactionTask.name : CheckBalanceTask.name;
|
|
77
|
+
}
|
|
78
|
+
const firstTaskIndex = tasks.findIndex((task) => task.constructor.name === taskName);
|
|
79
|
+
return new TaskPipeline(tasks.slice(firstTaskIndex));
|
|
80
|
+
};
|
|
82
81
|
};
|
|
83
82
|
//#endregion
|
|
84
83
|
export { EthereumStepExecutor };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumStepExecutor.js","names":[],"sources":["../../../src/core/EthereumStepExecutor.ts"],"sourcesContent":["import {\n BaseStepExecutor,\n CheckBalanceTask,\n createDefaultStorage,\n type ExecuteStepRetryError,\n type ExecuteStepRetryParams,\n type ExecutionAction,\n LiFiErrorCode,\n type LiFiStepExtended,\n type SDKClient,\n type SDKError,\n type SDKStorage,\n type StepExecutorBaseContext,\n type StepExecutorOptions,\n TaskPipeline,\n TransactionError,\n} from '@lifi/sdk'\nimport type { Client, GetAddressesReturnType } from 'viem'\nimport { getAddresses } from 'viem/actions'\nimport { getAction } from 'viem/utils'\nimport { parseEthereumErrors } from '../errors/parseEthereumErrors.js'\nimport type { EthereumStepExecutorContext } from '../types.js'\nimport { isZeroAddress } from '../utils/isZeroAddress.js'\nimport { EthereumCheckAllowanceTask } from './tasks/EthereumCheckAllowanceTask.js'\nimport { EthereumCheckPermitsTask } from './tasks/EthereumCheckPermitsTask.js'\nimport { EthereumNativePermitTask } from './tasks/EthereumNativePermitTask.js'\nimport { EthereumPrepareTransactionTask } from './tasks/EthereumPrepareTransactionTask.js'\nimport { EthereumResetAllowanceTask } from './tasks/EthereumResetAllowanceTask.js'\nimport { EthereumSetAllowanceTask } from './tasks/EthereumSetAllowanceTask.js'\nimport { EthereumSignAndExecuteTask } from './tasks/EthereumSignAndExecuteTask.js'\nimport { EthereumWaitForTransactionStatusTask } from './tasks/EthereumWaitForTransactionStatusTask.js'\nimport { EthereumWaitForTransactionTask } from './tasks/EthereumWaitForTransactionTask.js'\nimport { shouldCheckForAllowance } from './tasks/helpers/shouldCheckForAllowance.js'\nimport { switchChain } from './tasks/helpers/switchChain.js'\n\ninterface EthereumStepExecutorOptions extends StepExecutorOptions {\n client: Client\n switchChain?: (chainId: number) => Promise<Client | undefined>\n disableMessageSigning?: boolean\n}\n\nexport class EthereumStepExecutor extends BaseStepExecutor {\n private client: Client\n private switchChain?: (chainId: number) => Promise<Client | undefined>\n private storage?: SDKStorage\n private disableMessageSigning?: boolean\n\n constructor(options: EthereumStepExecutorOptions) {\n super(options)\n this.client = options.client\n this.switchChain = options.switchChain\n this.disableMessageSigning = options.disableMessageSigning\n }\n\n private getStorage = (client: SDKClient): SDKStorage => {\n if (!this.storage) {\n this.storage = client.config.storage ?? createDefaultStorage()\n }\n return this.storage\n }\n\n override parseErrors = (\n error: Error,\n step?: LiFiStepExtended,\n action?: ExecutionAction,\n retryParams?: ExecuteStepRetryParams\n ): Promise<SDKError | ExecuteStepRetryError> =>\n parseEthereumErrors(error, step, action, retryParams)\n\n // Ensure that we are using the right chain and wallet when executing transactions.\n checkClient = async (\n step: LiFiStepExtended,\n targetChainId?: number\n ): Promise<Client | undefined> => {\n const updatedClient = await switchChain(\n this.client,\n targetChainId ?? step.action.fromChainId,\n this.allowUserInteraction,\n this.switchChain\n )\n if (updatedClient) {\n this.client = updatedClient\n }\n\n // Prevent execution of the quote by wallet different from the one which requested the quote\n let accountAddress = this.client.account?.address\n if (!accountAddress) {\n const accountAddresses = (await getAction(\n this.client,\n getAddresses,\n 'getAddresses'\n )(undefined)) as GetAddressesReturnType\n accountAddress = accountAddresses?.[0]\n }\n if (\n accountAddress?.toLowerCase() !== step.action.fromAddress?.toLowerCase()\n ) {\n throw new TransactionError(\n LiFiErrorCode.WalletChangedDuringExecution,\n 'The wallet address that requested the quote does not match the wallet address attempting to sign the transaction.'\n )\n }\n return updatedClient\n }\n\n override createContext = async (\n baseContext: StepExecutorBaseContext\n ): Promise<EthereumStepExecutorContext> => {\n const { step, fromChain } = baseContext\n\n const isFromNativeToken =\n fromChain.nativeToken.address === step.action.fromToken.address &&\n isZeroAddress(step.action.fromToken.address)\n\n // Check if message signing is disabled - useful for smart contract wallets\n // We also disable message signing for custom steps\n const disableMessageSigning =\n !!this.disableMessageSigning || step.type !== 'lifi'\n\n return {\n ...baseContext,\n isFromNativeToken,\n disableMessageSigning,\n ethereumClient: this.client,\n checkClient: this.checkClient,\n getStorage: this.getStorage,\n // Signed typed data for native permits and other messages\n signedTypedData: [],\n // Calls for atomic batch transactions (EIP-5792)\n calls: [],\n }\n }\n\n override createPipeline = (\n context: EthereumStepExecutorContext\n ): TaskPipeline => {\n const { step, isBridgeExecution, isFromNativeToken } = context\n\n const tasks = [\n new EthereumCheckPermitsTask(),\n new EthereumCheckAllowanceTask(),\n new EthereumNativePermitTask(),\n new EthereumResetAllowanceTask(),\n new EthereumSetAllowanceTask(),\n new CheckBalanceTask(),\n new EthereumPrepareTransactionTask(),\n new EthereumSignAndExecuteTask(),\n new EthereumWaitForTransactionTask(),\n new EthereumWaitForTransactionStatusTask(),\n ]\n\n const doCheckAllowance = shouldCheckForAllowance(\n step,\n isBridgeExecution,\n isFromNativeToken,\n this.statusManager\n )\n\n let taskName: string\n if (doCheckAllowance) {\n taskName = EthereumCheckPermitsTask.name\n } else {\n const swapOrBridgeAction = this.statusManager.findAction(\n step,\n isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP'\n )\n taskName =\n swapOrBridgeAction?.txHash || swapOrBridgeAction?.taskId\n ? swapOrBridgeAction?.status === 'DONE'\n ? EthereumWaitForTransactionStatusTask.name\n : EthereumWaitForTransactionTask.name\n : CheckBalanceTask.name\n }\n\n const firstTaskIndex = tasks.findIndex(\n (task) => task.constructor.name === taskName\n )\n\n const tasksToRun = tasks.slice(firstTaskIndex)\n\n return new TaskPipeline(tasksToRun)\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EthereumStepExecutor.js","names":[],"sources":["../../../src/core/EthereumStepExecutor.ts"],"sourcesContent":["import {\n BaseStepExecutor,\n CheckBalanceTask,\n createDefaultStorage,\n type ExecuteStepRetryError,\n type ExecuteStepRetryParams,\n type ExecutionAction,\n LiFiErrorCode,\n type LiFiStepExtended,\n type SDKClient,\n type SDKError,\n type SDKStorage,\n type StepExecutorBaseContext,\n type StepExecutorOptions,\n TaskPipeline,\n TransactionError,\n} from '@lifi/sdk'\nimport type { Client, GetAddressesReturnType } from 'viem'\nimport { getAddresses } from 'viem/actions'\nimport { getAction } from 'viem/utils'\nimport { parseEthereumErrors } from '../errors/parseEthereumErrors.js'\nimport type { EthereumStepExecutorContext } from '../types.js'\nimport { isZeroAddress } from '../utils/isZeroAddress.js'\nimport { EthereumCheckAllowanceTask } from './tasks/EthereumCheckAllowanceTask.js'\nimport { EthereumCheckPermitsTask } from './tasks/EthereumCheckPermitsTask.js'\nimport { EthereumNativePermitTask } from './tasks/EthereumNativePermitTask.js'\nimport { EthereumPrepareTransactionTask } from './tasks/EthereumPrepareTransactionTask.js'\nimport { EthereumResetAllowanceTask } from './tasks/EthereumResetAllowanceTask.js'\nimport { EthereumSetAllowanceTask } from './tasks/EthereumSetAllowanceTask.js'\nimport { EthereumSignAndExecuteTask } from './tasks/EthereumSignAndExecuteTask.js'\nimport { EthereumWaitForTransactionStatusTask } from './tasks/EthereumWaitForTransactionStatusTask.js'\nimport { EthereumWaitForTransactionTask } from './tasks/EthereumWaitForTransactionTask.js'\nimport { shouldCheckForAllowance } from './tasks/helpers/shouldCheckForAllowance.js'\nimport { switchChain } from './tasks/helpers/switchChain.js'\n\ninterface EthereumStepExecutorOptions extends StepExecutorOptions {\n client: Client\n switchChain?: (chainId: number) => Promise<Client | undefined>\n disableMessageSigning?: boolean\n}\n\nexport class EthereumStepExecutor extends BaseStepExecutor {\n private client: Client\n private switchChain?: (chainId: number) => Promise<Client | undefined>\n private storage?: SDKStorage\n private disableMessageSigning?: boolean\n\n constructor(options: EthereumStepExecutorOptions) {\n super(options)\n this.client = options.client\n this.switchChain = options.switchChain\n this.disableMessageSigning = options.disableMessageSigning\n }\n\n private getStorage = (client: SDKClient): SDKStorage => {\n if (!this.storage) {\n this.storage = client.config.storage ?? createDefaultStorage()\n }\n return this.storage\n }\n\n override parseErrors = (\n error: Error,\n step?: LiFiStepExtended,\n action?: ExecutionAction,\n retryParams?: ExecuteStepRetryParams\n ): Promise<SDKError | ExecuteStepRetryError> =>\n parseEthereumErrors(error, step, action, retryParams)\n\n // Ensure that we are using the right chain and wallet when executing transactions.\n checkClient = async (\n step: LiFiStepExtended,\n targetChainId?: number\n ): Promise<Client | undefined> => {\n const updatedClient = await switchChain(\n this.client,\n targetChainId ?? step.action.fromChainId,\n this.allowUserInteraction,\n this.switchChain\n )\n if (updatedClient) {\n this.client = updatedClient\n }\n\n // Prevent execution of the quote by wallet different from the one which requested the quote\n let accountAddress = this.client.account?.address\n if (!accountAddress) {\n const accountAddresses = (await getAction(\n this.client,\n getAddresses,\n 'getAddresses'\n )(undefined)) as GetAddressesReturnType\n accountAddress = accountAddresses?.[0]\n }\n if (\n accountAddress?.toLowerCase() !== step.action.fromAddress?.toLowerCase()\n ) {\n throw new TransactionError(\n LiFiErrorCode.WalletChangedDuringExecution,\n 'The wallet address that requested the quote does not match the wallet address attempting to sign the transaction.'\n )\n }\n return updatedClient\n }\n\n override createContext = async (\n baseContext: StepExecutorBaseContext\n ): Promise<EthereumStepExecutorContext> => {\n const { step, fromChain } = baseContext\n\n const isFromNativeToken =\n fromChain.nativeToken.address === step.action.fromToken.address &&\n isZeroAddress(step.action.fromToken.address)\n\n // Check if message signing is disabled - useful for smart contract wallets\n // We also disable message signing for custom steps\n const disableMessageSigning =\n !!this.disableMessageSigning || step.type !== 'lifi'\n\n return {\n ...baseContext,\n isFromNativeToken,\n disableMessageSigning,\n ethereumClient: this.client,\n checkClient: this.checkClient,\n getStorage: this.getStorage,\n // Signed typed data for native permits and other messages\n signedTypedData: [],\n // Calls for atomic batch transactions (EIP-5792)\n calls: [],\n }\n }\n\n override createPipeline = (\n context: EthereumStepExecutorContext\n ): TaskPipeline => {\n const { step, isBridgeExecution, isFromNativeToken } = context\n\n const tasks = [\n new EthereumCheckPermitsTask(),\n new EthereumCheckAllowanceTask(),\n new EthereumNativePermitTask(),\n new EthereumResetAllowanceTask(),\n new EthereumSetAllowanceTask(),\n new CheckBalanceTask(),\n new EthereumPrepareTransactionTask(),\n new EthereumSignAndExecuteTask(),\n new EthereumWaitForTransactionTask(),\n new EthereumWaitForTransactionStatusTask(),\n ]\n\n const doCheckAllowance = shouldCheckForAllowance(\n step,\n isBridgeExecution,\n isFromNativeToken,\n this.statusManager\n )\n\n let taskName: string\n if (doCheckAllowance) {\n taskName = EthereumCheckPermitsTask.name\n } else {\n const swapOrBridgeAction = this.statusManager.findAction(\n step,\n isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP'\n )\n taskName =\n swapOrBridgeAction?.txHash || swapOrBridgeAction?.taskId\n ? swapOrBridgeAction?.status === 'DONE'\n ? EthereumWaitForTransactionStatusTask.name\n : EthereumWaitForTransactionTask.name\n : CheckBalanceTask.name\n }\n\n const firstTaskIndex = tasks.findIndex(\n (task) => task.constructor.name === taskName\n )\n\n const tasksToRun = tasks.slice(firstTaskIndex)\n\n return new TaskPipeline(tasksToRun)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAyCA,IAAa,uBAAb,cAA0C,iBAAiB;CACzD;CACA;CACA;CACA;CAEA,YAAY,SAAsC;AAChD,QAAM,QAAQ;AACd,OAAK,SAAS,QAAQ;AACtB,OAAK,cAAc,QAAQ;AAC3B,OAAK,wBAAwB,QAAQ;;CAGvC,cAAsB,WAAkC;AACtD,MAAI,CAAC,KAAK,QACR,MAAK,UAAU,OAAO,OAAO,WAAW,sBAAsB;AAEhE,SAAO,KAAK;;CAGd,eACE,OACA,MACA,QACA,gBAEA,oBAAoB,OAAO,MAAM,QAAQ,YAAY;CAGvD,cAAc,OACZ,MACA,kBACgC;EAChC,MAAM,gBAAgB,MAAM,YAC1B,KAAK,QACL,iBAAiB,KAAK,OAAO,aAC7B,KAAK,sBACL,KAAK,YACN;AACD,MAAI,cACF,MAAK,SAAS;EAIhB,IAAI,iBAAiB,KAAK,OAAO,SAAS;AAC1C,MAAI,CAAC,eAMH,mBAL0B,MAAM,UAC9B,KAAK,QACL,cACA,eACD,CAAC,KAAA,EAAU,IACwB;AAEtC,MACE,gBAAgB,aAAa,KAAK,KAAK,OAAO,aAAa,aAAa,CAExE,OAAM,IAAI,iBACR,cAAc,8BACd,oHACD;AAEH,SAAO;;CAGT,gBAAyB,OACvB,gBACyC;EACzC,MAAM,EAAE,MAAM,cAAc;EAE5B,MAAM,oBACJ,UAAU,YAAY,YAAY,KAAK,OAAO,UAAU,WACxD,cAAc,KAAK,OAAO,UAAU,QAAQ;EAI9C,MAAM,wBACJ,CAAC,CAAC,KAAK,yBAAyB,KAAK,SAAS;AAEhD,SAAO;GACL,GAAG;GACH;GACA;GACA,gBAAgB,KAAK;GACrB,aAAa,KAAK;GAClB,YAAY,KAAK;GAEjB,iBAAiB,EAAE;GAEnB,OAAO,EAAE;GACV;;CAGH,kBACE,YACiB;EACjB,MAAM,EAAE,MAAM,mBAAmB,sBAAsB;EAEvD,MAAM,QAAQ;GACZ,IAAI,0BAA0B;GAC9B,IAAI,4BAA4B;GAChC,IAAI,0BAA0B;GAC9B,IAAI,4BAA4B;GAChC,IAAI,0BAA0B;GAC9B,IAAI,kBAAkB;GACtB,IAAI,gCAAgC;GACpC,IAAI,4BAA4B;GAChC,IAAI,gCAAgC;GACpC,IAAI,sCAAsC;GAC3C;EAED,MAAM,mBAAmB,wBACvB,MACA,mBACA,mBACA,KAAK,cACN;EAED,IAAI;AACJ,MAAI,iBACF,YAAW,yBAAyB;OAC/B;GACL,MAAM,qBAAqB,KAAK,cAAc,WAC5C,MACA,oBAAoB,gBAAgB,OACrC;AACD,cACE,oBAAoB,UAAU,oBAAoB,SAC9C,oBAAoB,WAAW,SAC7B,qCAAqC,OACrC,+BAA+B,OACjC,iBAAiB;;EAGzB,MAAM,iBAAiB,MAAM,WAC1B,SAAS,KAAK,YAAY,SAAS,SACrC;AAID,SAAO,IAAI,aAFQ,MAAM,MAAM,eAAe,CAEX"}
|
|
@@ -3,7 +3,7 @@ import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
|
|
|
3
3
|
|
|
4
4
|
//#region src/core/tasks/EthereumCheckAllowanceTask.d.ts
|
|
5
5
|
declare class EthereumCheckAllowanceTask extends BaseStepExecutionTask {
|
|
6
|
-
shouldRun(context: EthereumStepExecutorContext): Promise<boolean>;
|
|
6
|
+
override shouldRun(context: EthereumStepExecutorContext): Promise<boolean>;
|
|
7
7
|
run(context: EthereumStepExecutorContext): Promise<TaskResult>;
|
|
8
8
|
}
|
|
9
9
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumCheckAllowanceTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumCheckAllowanceTask.ts"],"mappings":";;;;cAOa,0BAAA,SAAmC,qBAAA;
|
|
1
|
+
{"version":3,"file":"EthereumCheckAllowanceTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumCheckAllowanceTask.ts"],"mappings":";;;;cAOa,0BAAA,SAAmC,qBAAA;EAAA,SAC/B,SAAA,CACb,OAAA,EAAS,2BAAA,GACR,OAAA;EAIH,GAAA,CAAU,OAAA,EAAS,2BAAA,GAA8B,OAAA,CAAQ,UAAA;AAAA"}
|
|
@@ -3,7 +3,7 @@ import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
|
|
|
3
3
|
|
|
4
4
|
//#region src/core/tasks/EthereumCheckPermitsTask.d.ts
|
|
5
5
|
declare class EthereumCheckPermitsTask extends BaseStepExecutionTask {
|
|
6
|
-
shouldRun(context: EthereumStepExecutorContext): Promise<boolean>;
|
|
6
|
+
override shouldRun(context: EthereumStepExecutorContext): Promise<boolean>;
|
|
7
7
|
run(context: EthereumStepExecutorContext): Promise<TaskResult>;
|
|
8
8
|
}
|
|
9
9
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumCheckPermitsTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumCheckPermitsTask.ts"],"mappings":";;;;cAUa,wBAAA,SAAiC,qBAAA;
|
|
1
|
+
{"version":3,"file":"EthereumCheckPermitsTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumCheckPermitsTask.ts"],"mappings":";;;;cAUa,wBAAA,SAAiC,qBAAA;EAAA,SAC7B,SAAA,CACb,OAAA,EAAS,2BAAA,GACR,OAAA;EAUH,GAAA,CAAU,OAAA,EAAS,2BAAA,GAA8B,OAAA,CAAQ,UAAA;AAAA"}
|
|
@@ -3,7 +3,7 @@ import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
|
|
|
3
3
|
|
|
4
4
|
//#region src/core/tasks/EthereumNativePermitTask.d.ts
|
|
5
5
|
declare class EthereumNativePermitTask extends BaseStepExecutionTask {
|
|
6
|
-
shouldRun(context: EthereumStepExecutorContext): Promise<boolean>;
|
|
6
|
+
override shouldRun(context: EthereumStepExecutorContext): Promise<boolean>;
|
|
7
7
|
run(context: EthereumStepExecutorContext): Promise<TaskResult>;
|
|
8
8
|
}
|
|
9
9
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumNativePermitTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumNativePermitTask.ts"],"mappings":";;;;cAca,wBAAA,SAAiC,qBAAA;
|
|
1
|
+
{"version":3,"file":"EthereumNativePermitTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumNativePermitTask.ts"],"mappings":";;;;cAca,wBAAA,SAAiC,qBAAA;EAAA,SAC7B,SAAA,CACb,OAAA,EAAS,2BAAA,GACR,OAAA;EAwBH,GAAA,CAAU,OAAA,EAAS,2BAAA,GAA8B,OAAA,CAAQ,UAAA;AAAA"}
|
|
@@ -3,7 +3,7 @@ import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
|
|
|
3
3
|
|
|
4
4
|
//#region src/core/tasks/EthereumResetAllowanceTask.d.ts
|
|
5
5
|
declare class EthereumResetAllowanceTask extends BaseStepExecutionTask {
|
|
6
|
-
shouldRun(context: EthereumStepExecutorContext): Promise<boolean>;
|
|
6
|
+
override shouldRun(context: EthereumStepExecutorContext): Promise<boolean>;
|
|
7
7
|
run(context: EthereumStepExecutorContext): Promise<TaskResult>;
|
|
8
8
|
}
|
|
9
9
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumResetAllowanceTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumResetAllowanceTask.ts"],"mappings":";;;;cAUa,0BAAA,SAAmC,qBAAA;
|
|
1
|
+
{"version":3,"file":"EthereumResetAllowanceTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumResetAllowanceTask.ts"],"mappings":";;;;cAUa,0BAAA,SAAmC,qBAAA;EAAA,SAC/B,SAAA,CACb,OAAA,EAAS,2BAAA,GACR,OAAA;EAYH,GAAA,CAAU,OAAA,EAAS,2BAAA,GAA8B,OAAA,CAAQ,UAAA;AAAA"}
|
|
@@ -3,7 +3,7 @@ import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
|
|
|
3
3
|
|
|
4
4
|
//#region src/core/tasks/EthereumSetAllowanceTask.d.ts
|
|
5
5
|
declare class EthereumSetAllowanceTask extends BaseStepExecutionTask {
|
|
6
|
-
shouldRun(context: EthereumStepExecutorContext): Promise<boolean>;
|
|
6
|
+
override shouldRun(context: EthereumStepExecutorContext): Promise<boolean>;
|
|
7
7
|
run(context: EthereumStepExecutorContext): Promise<TaskResult>;
|
|
8
8
|
}
|
|
9
9
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumSetAllowanceTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumSetAllowanceTask.ts"],"mappings":";;;;cAWa,wBAAA,SAAiC,qBAAA;
|
|
1
|
+
{"version":3,"file":"EthereumSetAllowanceTask.d.ts","names":[],"sources":["../../../../src/core/tasks/EthereumSetAllowanceTask.ts"],"mappings":";;;;cAWa,wBAAA,SAAiC,qBAAA;EAAA,SAC7B,SAAA,CACb,OAAA,EAAS,2BAAA,GACR,OAAA;EAIH,GAAA,CAAU,OAAA,EAAS,2BAAA,GAA8B,OAAA,CAAQ,UAAA;AAAA"}
|
package/dist/esm/version.d.ts
CHANGED
package/dist/esm/version.js
CHANGED
package/dist/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk-provider-ethereum'\nexport const version = '4.0.0-beta.
|
|
1
|
+
{"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk-provider-ethereum'\nexport const version = '4.0.0-beta.4'\n"],"mappings":";AAAA,MAAa,OAAO;AACpB,MAAa,UAAU"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/sdk-provider-ethereum",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.4",
|
|
4
4
|
"description": "LI.FI Ethereum SDK Provider for Any-to-Any Cross-Chain-Swap",
|
|
5
5
|
"homepage": "https://github.com/lifinance/sdk",
|
|
6
6
|
"bugs": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"viem": "^2.47.6",
|
|
32
|
-
"@lifi/sdk": "4.0.0-beta.
|
|
32
|
+
"@lifi/sdk": "4.0.0-beta.4"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public"
|
package/src/actions/constants.ts
CHANGED
|
@@ -61,6 +61,7 @@ export const CHAIN_TYPE_UNS_CHAIN_MAP: Record<ChainType, string> = {
|
|
|
61
61
|
[ChainType.SVM]: 'SOL',
|
|
62
62
|
[ChainType.UTXO]: 'BTC',
|
|
63
63
|
[ChainType.TVM]: 'TRON',
|
|
64
|
+
[ChainType.STL]: 'XLM',
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
export const CHAIN_ID_UNS_CHAIN_MAP: Partial<Record<ChainId, string>> = {
|
|
@@ -80,4 +81,5 @@ export const CHAIN_TYPE_FAMILY_MAP: Record<ChainType, string> = {
|
|
|
80
81
|
[ChainType.SVM]: 'SOL',
|
|
81
82
|
[ChainType.MVM]: 'SUI',
|
|
82
83
|
[ChainType.TVM]: 'TRON',
|
|
84
|
+
[ChainType.STL]: 'XLM',
|
|
83
85
|
}
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/sdk-provider-ethereum'
|
|
2
|
-
export const version = '4.0.0-beta.
|
|
2
|
+
export const version = '4.0.0-beta.4'
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const require_toPropertyKey = require("./toPropertyKey.js");
|
|
2
|
-
//#region \0@oxc-project+runtime@0.115.0/helpers/defineProperty.js
|
|
3
|
-
function _defineProperty(e, r, t) {
|
|
4
|
-
return (r = require_toPropertyKey.toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
5
|
-
value: t,
|
|
6
|
-
enumerable: !0,
|
|
7
|
-
configurable: !0,
|
|
8
|
-
writable: !0
|
|
9
|
-
}) : e[r] = t, e;
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
exports._defineProperty = _defineProperty;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const require_typeof = require("./typeof.js");
|
|
2
|
-
//#region \0@oxc-project+runtime@0.115.0/helpers/toPrimitive.js
|
|
3
|
-
function toPrimitive(t, r) {
|
|
4
|
-
if ("object" != require_typeof._typeof(t) || !t) return t;
|
|
5
|
-
var e = t[Symbol.toPrimitive];
|
|
6
|
-
if (void 0 !== e) {
|
|
7
|
-
var i = e.call(t, r || "default");
|
|
8
|
-
if ("object" != require_typeof._typeof(i)) return i;
|
|
9
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
10
|
-
}
|
|
11
|
-
return ("string" === r ? String : Number)(t);
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
|
-
exports.toPrimitive = toPrimitive;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const require_typeof = require("./typeof.js");
|
|
2
|
-
const require_toPrimitive = require("./toPrimitive.js");
|
|
3
|
-
//#region \0@oxc-project+runtime@0.115.0/helpers/toPropertyKey.js
|
|
4
|
-
function toPropertyKey(t) {
|
|
5
|
-
var i = require_toPrimitive.toPrimitive(t, "string");
|
|
6
|
-
return "symbol" == require_typeof._typeof(i) ? i : i + "";
|
|
7
|
-
}
|
|
8
|
-
//#endregion
|
|
9
|
-
exports.toPropertyKey = toPropertyKey;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
//#region \0@oxc-project+runtime@0.115.0/helpers/typeof.js
|
|
2
|
-
function _typeof(o) {
|
|
3
|
-
"@babel/helpers - typeof";
|
|
4
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
5
|
-
return typeof o;
|
|
6
|
-
} : function(o) {
|
|
7
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
8
|
-
}, _typeof(o);
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
11
|
-
Object.defineProperty(exports, "_typeof", {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: function() {
|
|
14
|
-
return _typeof;
|
|
15
|
-
}
|
|
16
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { toPropertyKey } from "./toPropertyKey.js";
|
|
2
|
-
//#region \0@oxc-project+runtime@0.115.0/helpers/defineProperty.js
|
|
3
|
-
function _defineProperty(e, r, t) {
|
|
4
|
-
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
5
|
-
value: t,
|
|
6
|
-
enumerable: !0,
|
|
7
|
-
configurable: !0,
|
|
8
|
-
writable: !0
|
|
9
|
-
}) : e[r] = t, e;
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { _defineProperty };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { _typeof } from "./typeof.js";
|
|
2
|
-
//#region \0@oxc-project+runtime@0.115.0/helpers/toPrimitive.js
|
|
3
|
-
function toPrimitive(t, r) {
|
|
4
|
-
if ("object" != _typeof(t) || !t) return t;
|
|
5
|
-
var e = t[Symbol.toPrimitive];
|
|
6
|
-
if (void 0 !== e) {
|
|
7
|
-
var i = e.call(t, r || "default");
|
|
8
|
-
if ("object" != _typeof(i)) return i;
|
|
9
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
10
|
-
}
|
|
11
|
-
return ("string" === r ? String : Number)(t);
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
|
-
export { toPrimitive };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { _typeof } from "./typeof.js";
|
|
2
|
-
import { toPrimitive } from "./toPrimitive.js";
|
|
3
|
-
//#region \0@oxc-project+runtime@0.115.0/helpers/toPropertyKey.js
|
|
4
|
-
function toPropertyKey(t) {
|
|
5
|
-
var i = toPrimitive(t, "string");
|
|
6
|
-
return "symbol" == _typeof(i) ? i : i + "";
|
|
7
|
-
}
|
|
8
|
-
//#endregion
|
|
9
|
-
export { toPropertyKey };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
//#region \0@oxc-project+runtime@0.115.0/helpers/typeof.js
|
|
2
|
-
function _typeof(o) {
|
|
3
|
-
"@babel/helpers - typeof";
|
|
4
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
5
|
-
return typeof o;
|
|
6
|
-
} : function(o) {
|
|
7
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
8
|
-
}, _typeof(o);
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
11
|
-
export { _typeof };
|