@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.
Files changed (115) hide show
  1. package/dist/LiFi.d.ts +28 -21
  2. package/dist/LiFi.js +20 -13
  3. package/dist/allowance/setAllowance.d.ts +2 -1
  4. package/dist/allowance/setAllowance.js +23 -7
  5. package/dist/cjs/LiFi.d.ts +28 -21
  6. package/dist/cjs/LiFi.js +20 -13
  7. package/dist/cjs/allowance/setAllowance.d.ts +2 -1
  8. package/dist/cjs/allowance/setAllowance.js +23 -7
  9. package/dist/cjs/connectors.d.ts +1 -1
  10. package/dist/cjs/execution/BaseStepExecutor.d.ts +12 -0
  11. package/dist/cjs/execution/BaseStepExecutor.js +27 -0
  12. package/dist/cjs/execution/EVMStepExecutor.d.ts +13 -0
  13. package/dist/cjs/execution/EVMStepExecutor.js +292 -0
  14. package/dist/cjs/execution/RouteExecutionManager.d.ts +6 -7
  15. package/dist/cjs/execution/RouteExecutionManager.js +19 -19
  16. package/dist/cjs/execution/StatusManager.d.ts +8 -7
  17. package/dist/cjs/execution/StatusManager.js +1 -1
  18. package/dist/cjs/execution/StepExecutionManager.d.ts +3 -3
  19. package/dist/cjs/execution/StepExecutionManager.js +34 -29
  20. package/dist/cjs/execution/checkAllowance.d.ts +3 -2
  21. package/dist/cjs/execution/checkAllowance.js +1 -1
  22. package/dist/cjs/execution/checkBalance.d.ts +2 -2
  23. package/dist/cjs/execution/index.d.ts +1 -0
  24. package/dist/cjs/execution/index.js +1 -0
  25. package/dist/cjs/execution/multisig.d.ts +2 -2
  26. package/dist/cjs/execution/prepareRestart.d.ts +2 -3
  27. package/dist/cjs/execution/prepareRestart.js +2 -2
  28. package/dist/cjs/execution/stepComparison.d.ts +4 -3
  29. package/dist/cjs/execution/stepComparison.js +1 -1
  30. package/dist/cjs/execution/switchChain.d.ts +4 -3
  31. package/dist/cjs/execution/switchChain.js +1 -0
  32. package/dist/cjs/{types/internal.types.d.ts → execution/types.d.ts} +36 -96
  33. package/dist/cjs/execution/utils.d.ts +2 -2
  34. package/dist/cjs/execution/waitForReceivingTransaction.d.ts +3 -3
  35. package/dist/cjs/helpers.d.ts +2 -2
  36. package/dist/cjs/index.d.ts +3 -1
  37. package/dist/cjs/index.js +6 -3
  38. package/dist/cjs/providers/BaseProvider.d.ts +7 -0
  39. package/dist/cjs/providers/BaseProvider.js +6 -0
  40. package/dist/cjs/providers/EVMProvider.d.ts +16 -0
  41. package/dist/cjs/providers/EVMProvider.js +28 -0
  42. package/dist/cjs/providers/SolanaProvider.d.ts +15 -0
  43. package/dist/cjs/providers/SolanaProvider.js +32 -0
  44. package/dist/cjs/providers/types.d.ts +0 -0
  45. package/dist/cjs/providers/types.js +1 -0
  46. package/dist/cjs/request.js +11 -5
  47. package/dist/cjs/services/ApiService.d.ts +4 -5
  48. package/dist/cjs/services/ApiService.js +2 -2
  49. package/dist/cjs/services/ConfigService.d.ts +6 -5
  50. package/dist/cjs/services/ConfigService.js +3 -3
  51. package/dist/cjs/typeguards.d.ts +2 -2
  52. package/dist/cjs/types/index.d.ts +1 -3
  53. package/dist/cjs/types/index.js +1 -5
  54. package/dist/cjs/types/internal.d.ts +60 -0
  55. package/dist/cjs/types/internal.js +2 -0
  56. package/dist/cjs/utils/parseError.d.ts +4 -4
  57. package/dist/cjs/version.d.ts +1 -1
  58. package/dist/cjs/version.js +1 -1
  59. package/dist/connectors.d.ts +1 -1
  60. package/dist/execution/BaseStepExecutor.d.ts +12 -0
  61. package/dist/execution/BaseStepExecutor.js +23 -0
  62. package/dist/execution/EVMStepExecutor.d.ts +13 -0
  63. package/dist/execution/EVMStepExecutor.js +285 -0
  64. package/dist/execution/RouteExecutionManager.d.ts +6 -7
  65. package/dist/execution/RouteExecutionManager.js +19 -19
  66. package/dist/execution/StatusManager.d.ts +8 -7
  67. package/dist/execution/StatusManager.js +1 -1
  68. package/dist/execution/StepExecutionManager.d.ts +3 -3
  69. package/dist/execution/StepExecutionManager.js +34 -29
  70. package/dist/execution/checkAllowance.d.ts +3 -2
  71. package/dist/execution/checkAllowance.js +1 -1
  72. package/dist/execution/checkBalance.d.ts +2 -2
  73. package/dist/execution/index.d.ts +1 -0
  74. package/dist/execution/index.js +1 -0
  75. package/dist/execution/multisig.d.ts +2 -2
  76. package/dist/execution/prepareRestart.d.ts +2 -3
  77. package/dist/execution/prepareRestart.js +2 -2
  78. package/dist/execution/stepComparison.d.ts +4 -3
  79. package/dist/execution/stepComparison.js +1 -1
  80. package/dist/execution/switchChain.d.ts +4 -3
  81. package/dist/execution/switchChain.js +1 -0
  82. package/dist/{types/internal.types.d.ts → execution/types.d.ts} +36 -96
  83. package/dist/execution/utils.d.ts +2 -2
  84. package/dist/execution/waitForReceivingTransaction.d.ts +3 -3
  85. package/dist/helpers.d.ts +2 -2
  86. package/dist/index.d.ts +3 -1
  87. package/dist/index.js +3 -1
  88. package/dist/providers/BaseProvider.d.ts +7 -0
  89. package/dist/providers/BaseProvider.js +2 -0
  90. package/dist/providers/EVMProvider.d.ts +16 -0
  91. package/dist/providers/EVMProvider.js +24 -0
  92. package/dist/providers/SolanaProvider.d.ts +15 -0
  93. package/dist/providers/SolanaProvider.js +28 -0
  94. package/dist/providers/types.d.ts +0 -0
  95. package/dist/providers/types.js +1 -0
  96. package/dist/request.js +11 -5
  97. package/dist/services/ApiService.d.ts +4 -5
  98. package/dist/services/ApiService.js +2 -2
  99. package/dist/services/ConfigService.d.ts +6 -5
  100. package/dist/services/ConfigService.js +3 -3
  101. package/dist/typeguards.d.ts +2 -2
  102. package/dist/types/index.d.ts +1 -3
  103. package/dist/types/index.js +1 -3
  104. package/dist/types/internal.d.ts +60 -0
  105. package/dist/types/internal.js +1 -0
  106. package/dist/utils/parseError.d.ts +4 -4
  107. package/dist/version.d.ts +1 -1
  108. package/dist/version.js +1 -1
  109. package/package.json +61 -62
  110. package/dist/cjs/execution/StepExecutor.d.ts +0 -15
  111. package/dist/cjs/execution/StepExecutor.js +0 -62
  112. package/dist/execution/StepExecutor.d.ts +0 -15
  113. package/dist/execution/StepExecutor.js +0 -58
  114. /package/dist/cjs/{types/internal.types.js → execution/types.js} +0 -0
  115. /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
- }