@lifi/sdk 3.0.0-alpha.4 → 3.0.0-alpha.7
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/LiFi.d.ts +28 -21
- package/dist/LiFi.js +20 -13
- package/dist/allowance/setAllowance.d.ts +2 -1
- package/dist/allowance/setAllowance.js +23 -7
- package/dist/cjs/LiFi.d.ts +28 -21
- package/dist/cjs/LiFi.js +20 -13
- package/dist/cjs/allowance/setAllowance.d.ts +2 -1
- package/dist/cjs/allowance/setAllowance.js +23 -7
- package/dist/cjs/connectors.d.ts +1 -1
- package/dist/cjs/execution/BaseStepExecutor.d.ts +12 -0
- package/dist/cjs/execution/BaseStepExecutor.js +27 -0
- package/dist/cjs/execution/EVMStepExecutor.d.ts +13 -0
- package/dist/cjs/execution/EVMStepExecutor.js +292 -0
- package/dist/cjs/execution/RouteExecutionManager.d.ts +6 -7
- package/dist/cjs/execution/RouteExecutionManager.js +19 -19
- package/dist/cjs/execution/StatusManager.d.ts +8 -7
- package/dist/cjs/execution/StatusManager.js +1 -1
- package/dist/cjs/execution/StepExecutionManager.d.ts +3 -3
- package/dist/cjs/execution/StepExecutionManager.js +34 -29
- package/dist/cjs/execution/checkAllowance.d.ts +3 -2
- package/dist/cjs/execution/checkAllowance.js +1 -1
- package/dist/cjs/execution/checkBalance.d.ts +2 -2
- package/dist/cjs/execution/index.d.ts +1 -0
- package/dist/cjs/execution/index.js +1 -0
- package/dist/cjs/execution/multisig.d.ts +2 -2
- package/dist/cjs/execution/prepareRestart.d.ts +2 -3
- package/dist/cjs/execution/prepareRestart.js +2 -2
- package/dist/cjs/execution/stepComparison.d.ts +4 -3
- package/dist/cjs/execution/stepComparison.js +1 -1
- package/dist/cjs/execution/switchChain.d.ts +4 -3
- package/dist/cjs/execution/switchChain.js +1 -0
- package/dist/cjs/{types/internal.types.d.ts → execution/types.d.ts} +36 -96
- package/dist/cjs/execution/utils.d.ts +2 -2
- package/dist/cjs/execution/waitForReceivingTransaction.d.ts +3 -3
- package/dist/cjs/helpers.d.ts +2 -2
- package/dist/cjs/index.d.ts +3 -1
- package/dist/cjs/index.js +6 -3
- package/dist/cjs/providers/BaseProvider.d.ts +7 -0
- package/dist/cjs/providers/BaseProvider.js +6 -0
- package/dist/cjs/providers/EVMProvider.d.ts +16 -0
- package/dist/cjs/providers/EVMProvider.js +28 -0
- package/dist/cjs/providers/SolanaProvider.d.ts +15 -0
- package/dist/cjs/providers/SolanaProvider.js +32 -0
- package/dist/cjs/providers/types.d.ts +0 -0
- package/dist/cjs/providers/types.js +1 -0
- package/dist/cjs/request.js +11 -5
- package/dist/cjs/services/ApiService.d.ts +4 -5
- package/dist/cjs/services/ApiService.js +2 -2
- package/dist/cjs/services/ConfigService.d.ts +6 -5
- package/dist/cjs/services/ConfigService.js +3 -3
- package/dist/cjs/typeguards.d.ts +2 -2
- package/dist/cjs/types/index.d.ts +1 -3
- package/dist/cjs/types/index.js +1 -5
- package/dist/cjs/types/internal.d.ts +60 -0
- package/dist/cjs/types/internal.js +2 -0
- package/dist/cjs/utils/parseError.d.ts +4 -4
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/connectors.d.ts +1 -1
- package/dist/execution/BaseStepExecutor.d.ts +12 -0
- package/dist/execution/BaseStepExecutor.js +23 -0
- package/dist/execution/EVMStepExecutor.d.ts +13 -0
- package/dist/execution/EVMStepExecutor.js +285 -0
- package/dist/execution/RouteExecutionManager.d.ts +6 -7
- package/dist/execution/RouteExecutionManager.js +19 -19
- package/dist/execution/StatusManager.d.ts +8 -7
- package/dist/execution/StatusManager.js +1 -1
- package/dist/execution/StepExecutionManager.d.ts +3 -3
- package/dist/execution/StepExecutionManager.js +34 -29
- package/dist/execution/checkAllowance.d.ts +3 -2
- package/dist/execution/checkAllowance.js +1 -1
- package/dist/execution/checkBalance.d.ts +2 -2
- package/dist/execution/index.d.ts +1 -0
- package/dist/execution/index.js +1 -0
- package/dist/execution/multisig.d.ts +2 -2
- package/dist/execution/prepareRestart.d.ts +2 -3
- package/dist/execution/prepareRestart.js +2 -2
- package/dist/execution/stepComparison.d.ts +4 -3
- package/dist/execution/stepComparison.js +1 -1
- package/dist/execution/switchChain.d.ts +4 -3
- package/dist/execution/switchChain.js +1 -0
- package/dist/{types/internal.types.d.ts → execution/types.d.ts} +36 -96
- package/dist/execution/utils.d.ts +2 -2
- package/dist/execution/waitForReceivingTransaction.d.ts +3 -3
- package/dist/helpers.d.ts +2 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/providers/BaseProvider.d.ts +7 -0
- package/dist/providers/BaseProvider.js +2 -0
- package/dist/providers/EVMProvider.d.ts +16 -0
- package/dist/providers/EVMProvider.js +24 -0
- package/dist/providers/SolanaProvider.d.ts +15 -0
- package/dist/providers/SolanaProvider.js +28 -0
- package/dist/providers/types.d.ts +0 -0
- package/dist/providers/types.js +1 -0
- package/dist/request.js +11 -5
- package/dist/services/ApiService.d.ts +4 -5
- package/dist/services/ApiService.js +2 -2
- package/dist/services/ConfigService.d.ts +6 -5
- package/dist/services/ConfigService.js +3 -3
- package/dist/typeguards.d.ts +2 -2
- package/dist/types/index.d.ts +1 -3
- package/dist/types/index.js +1 -3
- package/dist/types/internal.d.ts +60 -0
- package/dist/types/internal.js +1 -0
- package/dist/utils/parseError.d.ts +4 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +61 -62
- package/dist/cjs/execution/StepExecutor.d.ts +0 -15
- package/dist/cjs/execution/StepExecutor.js +0 -62
- package/dist/execution/StepExecutor.d.ts +0 -15
- package/dist/execution/StepExecutor.js +0 -58
- /package/dist/cjs/{types/internal.types.js → execution/types.js} +0 -0
- /package/dist/{types/internal.types.js → execution/types.js} +0 -0
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { StepExecutionManager } from './StepExecutionManager';
|
|
2
|
-
import { switchChain } from './switchChain';
|
|
3
|
-
// Please be careful when changing the defaults as it may break the behavior (e.g., background execution)
|
|
4
|
-
const defaultInteractionSettings = {
|
|
5
|
-
allowInteraction: true,
|
|
6
|
-
allowUpdates: true,
|
|
7
|
-
stopExecution: false,
|
|
8
|
-
};
|
|
9
|
-
export class StepExecutor {
|
|
10
|
-
constructor(statusManager, settings) {
|
|
11
|
-
this.allowUserInteraction = true;
|
|
12
|
-
this.executionStopped = false;
|
|
13
|
-
this.setInteraction = (settings) => {
|
|
14
|
-
const interactionSettings = {
|
|
15
|
-
...defaultInteractionSettings,
|
|
16
|
-
...settings,
|
|
17
|
-
};
|
|
18
|
-
this.allowUserInteraction = interactionSettings.allowInteraction;
|
|
19
|
-
this.stepExecutionManager.allowInteraction(interactionSettings.allowInteraction);
|
|
20
|
-
this.statusManager.allowUpdates(interactionSettings.allowUpdates);
|
|
21
|
-
this.executionStopped = interactionSettings.stopExecution;
|
|
22
|
-
};
|
|
23
|
-
// TODO: add checkChain method and update wallet client inside executors
|
|
24
|
-
// This can come in handy when we execute multiple routes simultaneously and
|
|
25
|
-
// should be sure that we are on the right chain when waiting for transactions.
|
|
26
|
-
this.checkChain = () => {
|
|
27
|
-
throw new Error('checkChain is not implemented.');
|
|
28
|
-
};
|
|
29
|
-
this.executeStep = async (walletClient, step) => {
|
|
30
|
-
// Make sure that the chain is still correct
|
|
31
|
-
// Find if it's bridging and the step is waiting for a transaction on the receiving chain
|
|
32
|
-
const recievingChainProcess = step.execution?.process.find((process) => process.type === 'RECEIVING_CHAIN');
|
|
33
|
-
// If the step is waiting for a transaction on the receiving chain, we do not switch the chain
|
|
34
|
-
// All changes are already done from the source chain
|
|
35
|
-
// Return the step
|
|
36
|
-
if (recievingChainProcess?.substatus !== 'WAIT_DESTINATION_TRANSACTION' ||
|
|
37
|
-
!recievingChainProcess) {
|
|
38
|
-
const updatedWalletClient = await switchChain(walletClient, this.statusManager, step, this.settings.switchChainHook, this.allowUserInteraction);
|
|
39
|
-
if (!updatedWalletClient) {
|
|
40
|
-
// Chain switch was not successful, stop execution here
|
|
41
|
-
return step;
|
|
42
|
-
}
|
|
43
|
-
walletClient = updatedWalletClient;
|
|
44
|
-
}
|
|
45
|
-
const parameters = {
|
|
46
|
-
walletClient,
|
|
47
|
-
step,
|
|
48
|
-
settings: this.settings,
|
|
49
|
-
statusManager: this.statusManager,
|
|
50
|
-
};
|
|
51
|
-
await this.stepExecutionManager.execute(parameters);
|
|
52
|
-
return step;
|
|
53
|
-
};
|
|
54
|
-
this.stepExecutionManager = new StepExecutionManager();
|
|
55
|
-
this.statusManager = statusManager;
|
|
56
|
-
this.settings = settings;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
File without changes
|
|
File without changes
|