@lifi/sdk 2.0.0-beta.12 → 2.0.0-beta.14

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 (164) hide show
  1. package/dist/cjs/{execution → src/execution}/RouteExecutionManager.js +1 -1
  2. package/dist/cjs/src/execution/RouteExecutionManager.unit.handlers.d.ts +1 -0
  3. package/dist/cjs/src/execution/RouteExecutionManager.unit.handlers.js +20 -0
  4. package/dist/cjs/src/execution/RouteExecutionManager.unit.mock.d.ts +80 -0
  5. package/dist/cjs/src/execution/RouteExecutionManager.unit.mock.js +76 -0
  6. package/dist/cjs/{execution → src/execution}/StepExecutionManager.js +6 -0
  7. package/dist/{utils → cjs/src/utils}/errors.d.ts +4 -2
  8. package/dist/cjs/{utils → src/utils}/errors.js +3 -1
  9. package/dist/cjs/{utils → src/utils}/parseError.js +3 -1
  10. package/dist/cjs/src/utils/preRestart.d.ts +3 -0
  11. package/dist/cjs/{utils → src/utils}/preRestart.js +14 -3
  12. package/dist/cjs/src/version.d.ts +2 -0
  13. package/dist/cjs/{version.js → src/version.js} +1 -1
  14. package/dist/cjs/test/fixtures.d.ts +7 -0
  15. package/dist/cjs/test/fixtures.js +157 -0
  16. package/dist/{execution → src/execution}/RouteExecutionManager.js +1 -1
  17. package/dist/src/execution/RouteExecutionManager.unit.handlers.d.ts +1 -0
  18. package/dist/src/execution/RouteExecutionManager.unit.handlers.js +14 -0
  19. package/dist/src/execution/RouteExecutionManager.unit.mock.d.ts +80 -0
  20. package/dist/src/execution/RouteExecutionManager.unit.mock.js +72 -0
  21. package/dist/{execution → src/execution}/StepExecutionManager.js +6 -0
  22. package/dist/{cjs → src}/utils/errors.d.ts +4 -2
  23. package/dist/{utils → src/utils}/errors.js +3 -1
  24. package/dist/{utils → src/utils}/parseError.js +4 -2
  25. package/dist/src/utils/preRestart.d.ts +3 -0
  26. package/dist/{utils → src/utils}/preRestart.js +14 -3
  27. package/dist/src/version.d.ts +2 -0
  28. package/dist/src/version.js +2 -0
  29. package/dist/test/fixtures.d.ts +7 -0
  30. package/dist/test/fixtures.js +152 -0
  31. package/package.json +8 -8
  32. package/dist/cjs/utils/preRestart.d.ts +0 -2
  33. package/dist/cjs/version.d.ts +0 -2
  34. package/dist/utils/preRestart.d.ts +0 -2
  35. package/dist/version.d.ts +0 -2
  36. package/dist/version.js +0 -2
  37. /package/dist/{LiFi.d.ts → cjs/src/LiFi.d.ts} +0 -0
  38. /package/dist/cjs/{LiFi.js → src/LiFi.js} +0 -0
  39. /package/dist/{allowance → cjs/src/allowance}/checkAllowance.d.ts +0 -0
  40. /package/dist/cjs/{allowance → src/allowance}/checkAllowance.js +0 -0
  41. /package/dist/{allowance → cjs/src/allowance}/index.d.ts +0 -0
  42. /package/dist/cjs/{allowance → src/allowance}/index.js +0 -0
  43. /package/dist/{allowance → cjs/src/allowance}/tokenApproval.d.ts +0 -0
  44. /package/dist/cjs/{allowance → src/allowance}/tokenApproval.js +0 -0
  45. /package/dist/{allowance → cjs/src/allowance}/utils.d.ts +0 -0
  46. /package/dist/cjs/{allowance → src/allowance}/utils.js +0 -0
  47. /package/dist/{balance → cjs/src/balance}/checkBalance.d.ts +0 -0
  48. /package/dist/cjs/{balance → src/balance}/checkBalance.js +0 -0
  49. /package/dist/{balance → cjs/src/balance}/getTokenBalance.d.ts +0 -0
  50. /package/dist/cjs/{balance → src/balance}/getTokenBalance.js +0 -0
  51. /package/dist/{balance → cjs/src/balance}/index.d.ts +0 -0
  52. /package/dist/cjs/{balance → src/balance}/index.js +0 -0
  53. /package/dist/{balance → cjs/src/balance}/utils.d.ts +0 -0
  54. /package/dist/cjs/{balance → src/balance}/utils.js +0 -0
  55. /package/dist/cjs/{connectors.d.ts → src/connectors.d.ts} +0 -0
  56. /package/dist/cjs/{connectors.js → src/connectors.js} +0 -0
  57. /package/dist/cjs/{execution → src/execution}/RouteExecutionManager.d.ts +0 -0
  58. /package/dist/cjs/{execution → src/execution}/StatusManager.d.ts +0 -0
  59. /package/dist/cjs/{execution → src/execution}/StatusManager.js +0 -0
  60. /package/dist/cjs/{execution → src/execution}/StepExecutionManager.d.ts +0 -0
  61. /package/dist/cjs/{execution → src/execution}/StepExecutor.d.ts +0 -0
  62. /package/dist/cjs/{execution → src/execution}/StepExecutor.js +0 -0
  63. /package/dist/cjs/{execution → src/execution}/index.d.ts +0 -0
  64. /package/dist/cjs/{execution → src/execution}/index.js +0 -0
  65. /package/dist/cjs/{execution → src/execution}/stepComparison.d.ts +0 -0
  66. /package/dist/cjs/{execution → src/execution}/stepComparison.js +0 -0
  67. /package/dist/cjs/{execution → src/execution}/switchChain.d.ts +0 -0
  68. /package/dist/cjs/{execution → src/execution}/switchChain.js +0 -0
  69. /package/dist/cjs/{execution → src/execution}/utils.d.ts +0 -0
  70. /package/dist/cjs/{execution → src/execution}/utils.js +0 -0
  71. /package/dist/cjs/{helpers.d.ts → src/helpers.d.ts} +0 -0
  72. /package/dist/cjs/{helpers.js → src/helpers.js} +0 -0
  73. /package/dist/cjs/{index.d.ts → src/index.d.ts} +0 -0
  74. /package/dist/cjs/{index.js → src/index.js} +0 -0
  75. /package/dist/cjs/{request.d.ts → src/request.d.ts} +0 -0
  76. /package/dist/cjs/{request.js → src/request.js} +0 -0
  77. /package/dist/cjs/{services → src/services}/ApiService.d.ts +0 -0
  78. /package/dist/cjs/{services → src/services}/ApiService.js +0 -0
  79. /package/dist/cjs/{services → src/services}/ApiService.unit.handlers.d.ts +0 -0
  80. /package/dist/cjs/{services → src/services}/ApiService.unit.handlers.js +0 -0
  81. /package/dist/cjs/{services → src/services}/ChainsService.d.ts +0 -0
  82. /package/dist/cjs/{services → src/services}/ChainsService.js +0 -0
  83. /package/dist/cjs/{services → src/services}/ConfigService.d.ts +0 -0
  84. /package/dist/cjs/{services → src/services}/ConfigService.js +0 -0
  85. /package/dist/cjs/{typeguards.d.ts → src/typeguards.d.ts} +0 -0
  86. /package/dist/cjs/{typeguards.js → src/typeguards.js} +0 -0
  87. /package/dist/cjs/{types → src/types}/ERC20.d.ts +0 -0
  88. /package/dist/cjs/{types → src/types}/ERC20.js +0 -0
  89. /package/dist/cjs/{types → src/types}/index.d.ts +0 -0
  90. /package/dist/cjs/{types → src/types}/index.js +0 -0
  91. /package/dist/cjs/{types → src/types}/internal.types.d.ts +0 -0
  92. /package/dist/cjs/{types → src/types}/internal.types.js +0 -0
  93. /package/dist/cjs/{utils → src/utils}/getProvider.d.ts +0 -0
  94. /package/dist/cjs/{utils → src/utils}/getProvider.js +0 -0
  95. /package/dist/cjs/{utils → src/utils}/multicall.d.ts +0 -0
  96. /package/dist/cjs/{utils → src/utils}/multicall.js +0 -0
  97. /package/dist/cjs/{utils → src/utils}/multicallAbi.json +0 -0
  98. /package/dist/cjs/{utils → src/utils}/parseError.d.ts +0 -0
  99. /package/dist/cjs/{utils → src/utils}/utils.d.ts +0 -0
  100. /package/dist/cjs/{utils → src/utils}/utils.js +0 -0
  101. /package/dist/{cjs → src}/LiFi.d.ts +0 -0
  102. /package/dist/{LiFi.js → src/LiFi.js} +0 -0
  103. /package/dist/{cjs → src}/allowance/checkAllowance.d.ts +0 -0
  104. /package/dist/{allowance → src/allowance}/checkAllowance.js +0 -0
  105. /package/dist/{cjs → src}/allowance/index.d.ts +0 -0
  106. /package/dist/{allowance → src/allowance}/index.js +0 -0
  107. /package/dist/{cjs → src}/allowance/tokenApproval.d.ts +0 -0
  108. /package/dist/{allowance → src/allowance}/tokenApproval.js +0 -0
  109. /package/dist/{cjs → src}/allowance/utils.d.ts +0 -0
  110. /package/dist/{allowance → src/allowance}/utils.js +0 -0
  111. /package/dist/{cjs → src}/balance/checkBalance.d.ts +0 -0
  112. /package/dist/{balance → src/balance}/checkBalance.js +0 -0
  113. /package/dist/{cjs → src}/balance/getTokenBalance.d.ts +0 -0
  114. /package/dist/{balance → src/balance}/getTokenBalance.js +0 -0
  115. /package/dist/{cjs → src}/balance/index.d.ts +0 -0
  116. /package/dist/{balance → src/balance}/index.js +0 -0
  117. /package/dist/{cjs → src}/balance/utils.d.ts +0 -0
  118. /package/dist/{balance → src/balance}/utils.js +0 -0
  119. /package/dist/{connectors.d.ts → src/connectors.d.ts} +0 -0
  120. /package/dist/{connectors.js → src/connectors.js} +0 -0
  121. /package/dist/{execution → src/execution}/RouteExecutionManager.d.ts +0 -0
  122. /package/dist/{execution → src/execution}/StatusManager.d.ts +0 -0
  123. /package/dist/{execution → src/execution}/StatusManager.js +0 -0
  124. /package/dist/{execution → src/execution}/StepExecutionManager.d.ts +0 -0
  125. /package/dist/{execution → src/execution}/StepExecutor.d.ts +0 -0
  126. /package/dist/{execution → src/execution}/StepExecutor.js +0 -0
  127. /package/dist/{execution → src/execution}/index.d.ts +0 -0
  128. /package/dist/{execution → src/execution}/index.js +0 -0
  129. /package/dist/{execution → src/execution}/stepComparison.d.ts +0 -0
  130. /package/dist/{execution → src/execution}/stepComparison.js +0 -0
  131. /package/dist/{execution → src/execution}/switchChain.d.ts +0 -0
  132. /package/dist/{execution → src/execution}/switchChain.js +0 -0
  133. /package/dist/{execution → src/execution}/utils.d.ts +0 -0
  134. /package/dist/{execution → src/execution}/utils.js +0 -0
  135. /package/dist/{helpers.d.ts → src/helpers.d.ts} +0 -0
  136. /package/dist/{helpers.js → src/helpers.js} +0 -0
  137. /package/dist/{index.d.ts → src/index.d.ts} +0 -0
  138. /package/dist/{index.js → src/index.js} +0 -0
  139. /package/dist/{request.d.ts → src/request.d.ts} +0 -0
  140. /package/dist/{request.js → src/request.js} +0 -0
  141. /package/dist/{services → src/services}/ApiService.d.ts +0 -0
  142. /package/dist/{services → src/services}/ApiService.js +0 -0
  143. /package/dist/{services → src/services}/ApiService.unit.handlers.d.ts +0 -0
  144. /package/dist/{services → src/services}/ApiService.unit.handlers.js +0 -0
  145. /package/dist/{services → src/services}/ChainsService.d.ts +0 -0
  146. /package/dist/{services → src/services}/ChainsService.js +0 -0
  147. /package/dist/{services → src/services}/ConfigService.d.ts +0 -0
  148. /package/dist/{services → src/services}/ConfigService.js +0 -0
  149. /package/dist/{typeguards.d.ts → src/typeguards.d.ts} +0 -0
  150. /package/dist/{typeguards.js → src/typeguards.js} +0 -0
  151. /package/dist/{types → src/types}/ERC20.d.ts +0 -0
  152. /package/dist/{types → src/types}/ERC20.js +0 -0
  153. /package/dist/{types → src/types}/index.d.ts +0 -0
  154. /package/dist/{types → src/types}/index.js +0 -0
  155. /package/dist/{types → src/types}/internal.types.d.ts +0 -0
  156. /package/dist/{types → src/types}/internal.types.js +0 -0
  157. /package/dist/{utils → src/utils}/getProvider.d.ts +0 -0
  158. /package/dist/{utils → src/utils}/getProvider.js +0 -0
  159. /package/dist/{utils → src/utils}/multicall.d.ts +0 -0
  160. /package/dist/{utils → src/utils}/multicall.js +0 -0
  161. /package/dist/{utils → src/utils}/multicallAbi.json +0 -0
  162. /package/dist/{utils → src/utils}/parseError.d.ts +0 -0
  163. /package/dist/{utils → src/utils}/utils.d.ts +0 -0
  164. /package/dist/{utils → src/utils}/utils.js +0 -0
@@ -83,6 +83,12 @@ export class StepExecutionManager {
83
83
  customConfig.maxPriorityFeePerGas;
84
84
  transactionRequest.maxFeePerGas = customConfig.maxFeePerGas;
85
85
  }
86
+ else {
87
+ const estimatedGasLimit = await signer.estimateGas(transactionRequest);
88
+ if (estimatedGasLimit) {
89
+ transactionRequest.gasLimit = `${(BigInt(estimatedGasLimit.toString()) * 125n) / 100n}`;
90
+ }
91
+ }
86
92
  // Submit the transaction
87
93
  transaction = await signer.sendTransaction(transactionRequest);
88
94
  // STEP 4: Wait for the transaction
@@ -23,11 +23,13 @@ export declare enum LifiErrorCode {
23
23
  SlippageError = 1011,
24
24
  TransactionRejected = 1012,
25
25
  BalanceError = 1013,
26
- AllowanceRequired = 1014
26
+ AllowanceRequired = 1014,
27
+ InsufficientFunds = 1015
27
28
  }
28
29
  export declare enum EthersErrorType {
30
+ ActionRejected = "ACTION_REJECTED",
29
31
  CallExecption = "CALL_EXCEPTION",
30
- ActionRejected = "ACTION_REJECTED"
32
+ InsufficientFunds = "INSUFFICIENT_FUNDS"
31
33
  }
32
34
  export declare enum EthersErrorMessage {
33
35
  ERC20Allowance = "ERC20: transfer amount exceeds allowance",
@@ -26,11 +26,13 @@ export var LifiErrorCode;
26
26
  LifiErrorCode[LifiErrorCode["TransactionRejected"] = 1012] = "TransactionRejected";
27
27
  LifiErrorCode[LifiErrorCode["BalanceError"] = 1013] = "BalanceError";
28
28
  LifiErrorCode[LifiErrorCode["AllowanceRequired"] = 1014] = "AllowanceRequired";
29
+ LifiErrorCode[LifiErrorCode["InsufficientFunds"] = 1015] = "InsufficientFunds";
29
30
  })(LifiErrorCode || (LifiErrorCode = {}));
30
31
  export var EthersErrorType;
31
32
  (function (EthersErrorType) {
32
- EthersErrorType["CallExecption"] = "CALL_EXCEPTION";
33
33
  EthersErrorType["ActionRejected"] = "ACTION_REJECTED";
34
+ EthersErrorType["CallExecption"] = "CALL_EXCEPTION";
35
+ EthersErrorType["InsufficientFunds"] = "INSUFFICIENT_FUNDS";
34
36
  })(EthersErrorType || (EthersErrorType = {}));
35
37
  export var EthersErrorMessage;
36
38
  (function (EthersErrorMessage) {
@@ -1,8 +1,8 @@
1
1
  import { errorCodes as MetaMaskErrorCodes, getMessageFromCode, } from 'eth-rpc-errors';
2
+ import { fetchTxErrorDetails } from '../helpers';
2
3
  import ChainsService from '../services/ChainsService';
3
- import { ErrorMessage, EthersErrorType, EthersErrorMessage, LifiError, LifiErrorCode, MetaMaskProviderErrorCode, NotFoundError, ProviderError, RPCError, ServerError, SlippageError, TransactionError, UnknownError, ValidationError, } from './errors';
4
+ import { ErrorMessage, EthersErrorMessage, EthersErrorType, LifiError, LifiErrorCode, MetaMaskProviderErrorCode, NotFoundError, ProviderError, RPCError, ServerError, SlippageError, TransactionError, UnknownError, ValidationError, } from './errors';
4
5
  import { formatTokenAmountOnly } from './utils';
5
- import { fetchTxErrorDetails } from '../helpers';
6
6
  /**
7
7
  * Available MetaMask error codes:
8
8
  *
@@ -107,6 +107,8 @@ export const parseError = async (e, step, process) => {
107
107
  catch (error) {
108
108
  return new ProviderError(LifiErrorCode.TransactionFailed, e.reason, defaultErrorMessage, e.stack);
109
109
  }
110
+ case EthersErrorType.InsufficientFunds:
111
+ return new TransactionError(LifiErrorCode.InsufficientFunds, e.message, await getTransactionNotSentMessage(step, process), e.stack);
110
112
  case EthersErrorType.ActionRejected:
111
113
  case MetaMaskProviderErrorCode.userRejectedRequest:
112
114
  return new TransactionError(LifiErrorCode.TransactionRejected, e.message, await getTransactionNotSentMessage(step, process), e.stack);
@@ -0,0 +1,3 @@
1
+ import { Signer } from 'ethers';
2
+ import { Route } from '../types';
3
+ export declare const handlePreRestart: (route: Route, signer: Signer) => Promise<void>;
@@ -1,18 +1,29 @@
1
1
  import { LifiErrorCode } from './errors';
2
- export const handlePreRestart = (route) => {
2
+ export const handlePreRestart = async (route, signer) => {
3
3
  for (let index = 0; index < route.steps.length; index++) {
4
4
  const stepHasFailed = route.steps[index].execution?.status === 'FAILED';
5
5
  if (stepHasFailed) {
6
- handleErrorType(route, index);
6
+ await handleErrorType(route, index, signer);
7
7
  deleteFailedProcesses(route, index);
8
8
  deleteTransactionData(route, index);
9
9
  }
10
10
  }
11
11
  };
12
- const handleErrorType = (route, index) => {
12
+ const handleErrorType = async (route, index, signer) => {
13
13
  const isGasLimitError = route.steps[index].execution?.process.some((p) => p.error?.code === LifiErrorCode.GasLimitError);
14
14
  const isGasPriceError = route.steps[index].execution?.process.some((p) => p.error?.code === LifiErrorCode.TransactionUnderpriced);
15
+ const { transactionRequest } = route.steps[index];
15
16
  if (isGasLimitError) {
17
+ if (transactionRequest) {
18
+ let gasLimit = transactionRequest.gasLimit;
19
+ try {
20
+ gasLimit = await signer.estimateGas(transactionRequest);
21
+ }
22
+ catch (error) { }
23
+ if (gasLimit) {
24
+ transactionRequest.gasLimit = `${(BigInt(gasLimit.toString()) * 125n) / 100n}`;
25
+ }
26
+ }
16
27
  route.steps[index].estimate.gasCosts?.forEach((gasCost) => (gasCost.limit = `${Math.round(Number(gasCost.limit) * 1.25)}`));
17
28
  }
18
29
  if (isGasPriceError) {
@@ -0,0 +1,2 @@
1
+ export declare const name = "@lifi/sdk";
2
+ export declare const version = "2.0.0-beta.14";
@@ -0,0 +1,2 @@
1
+ export const name = '@lifi/sdk';
2
+ export const version = '2.0.0-beta.14';
@@ -0,0 +1,7 @@
1
+ import { LifiStep, Route } from '@lifi/types';
2
+ export declare const buildStepObject: ({ includingExecution, }: {
3
+ includingExecution?: boolean | undefined;
4
+ }) => LifiStep;
5
+ export declare const buildRouteObject: ({ step, }: {
6
+ step?: LifiStep | undefined;
7
+ }) => Route;
@@ -0,0 +1,152 @@
1
+ // This file holds generator functions to create objects for testing purposes
2
+ import { ChainId, CoinKey, findDefaultToken, } from '@lifi/types';
3
+ const SOME_TOKEN = {
4
+ ...findDefaultToken(CoinKey.USDC, ChainId.DAI),
5
+ priceUSD: '',
6
+ };
7
+ const SOME_OTHER_TOKEN = {
8
+ ...findDefaultToken(CoinKey.USDT, ChainId.DAI),
9
+ priceUSD: '',
10
+ };
11
+ const SOME_DATE = new Date('2021-04-10').getTime();
12
+ export const buildStepObject = ({ includingExecution = true, }) => ({
13
+ id: '8d3a0474-4ee3-4a7a-90c7-2a2264b7f3a9',
14
+ type: 'lifi',
15
+ tool: '1inch',
16
+ toolDetails: {
17
+ key: '1inch',
18
+ name: '1inch',
19
+ logoURI: 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/exchanges/oneinch.png',
20
+ },
21
+ action: {
22
+ fromChainId: 137,
23
+ toChainId: 137,
24
+ fromToken: SOME_TOKEN,
25
+ toToken: SOME_OTHER_TOKEN,
26
+ fromAmount: '1000000',
27
+ slippage: 0.03,
28
+ fromAddress: '0x552008c0f6870c2f77e5cC1d2eb9bdff03e30Ea0',
29
+ toAddress: '0x552008c0f6870c2f77e5cC1d2eb9bdff03e30Ea0',
30
+ },
31
+ estimate: {
32
+ fromAmount: '1000000',
33
+ fromAmountUSD: '100',
34
+ toAmount: '260982615655554',
35
+ toAmountUSD: '26098',
36
+ toAmountMin: '253153137185887',
37
+ approvalAddress: '0x11111112542d85b3ef69ae05771c2dccff4faa26',
38
+ executionDuration: 300,
39
+ tool: '1inch',
40
+ },
41
+ includedSteps: [
42
+ {
43
+ id: 'f8474598-a553-4643-bbd1-bf8c77e679b3',
44
+ type: 'swap',
45
+ action: {
46
+ fromChainId: 137,
47
+ fromAmount: '5000000000000000000',
48
+ fromToken: {
49
+ address: '0x0000000000000000000000000000000000000000',
50
+ chainId: 137,
51
+ symbol: 'MATIC',
52
+ decimals: 18,
53
+ name: 'MATIC',
54
+ priceUSD: '1.124763',
55
+ logoURI: 'https://static.debank.com/image/matic_token/logo_url/matic/6f5a6b6f0732a7a235131bd7804d357c.png',
56
+ coinKey: CoinKey.MATIC,
57
+ },
58
+ toChainId: 137,
59
+ toToken: {
60
+ address: '0xc2132d05d31c914a87c6611c10748aeb04b58e8f',
61
+ chainId: 137,
62
+ symbol: 'USDT',
63
+ decimals: 6,
64
+ name: '(PoS) Tether USD',
65
+ priceUSD: '1.00081',
66
+ logoURI: 'https://static.debank.com/image/coin/logo_url/usdt/23af7472292cb41dc39b3f1146ead0fe.png',
67
+ coinKey: CoinKey.USDT,
68
+ },
69
+ slippage: 0.005,
70
+ },
71
+ estimate: {
72
+ tool: '1inch',
73
+ fromAmount: '5000000000000000000',
74
+ toAmount: '5617317',
75
+ toAmountMin: '5589230',
76
+ approvalAddress: '0x1111111254eeb25477b68fb85ed929f73a960582',
77
+ executionDuration: 30,
78
+ feeCosts: [],
79
+ gasCosts: [
80
+ {
81
+ type: 'SEND',
82
+ price: '149725515512',
83
+ estimate: '258059',
84
+ limit: '344079',
85
+ amount: '51517405651853448',
86
+ amountUSD: '0.06',
87
+ token: {
88
+ address: '0x0000000000000000000000000000000000000000',
89
+ chainId: 137,
90
+ symbol: 'MATIC',
91
+ decimals: 18,
92
+ name: 'MATIC',
93
+ priceUSD: '1.124763',
94
+ logoURI: 'https://static.debank.com/image/matic_token/logo_url/matic/6f5a6b6f0732a7a235131bd7804d357c.png',
95
+ coinKey: CoinKey.MATIC,
96
+ },
97
+ },
98
+ ],
99
+ },
100
+ tool: '1inch',
101
+ toolDetails: {
102
+ key: '1inch',
103
+ name: '1inch',
104
+ logoURI: 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/exchanges/oneinch.png',
105
+ },
106
+ },
107
+ ],
108
+ execution: includingExecution
109
+ ? {
110
+ status: 'PENDING',
111
+ process: [
112
+ {
113
+ type: 'TOKEN_ALLOWANCE',
114
+ startedAt: SOME_DATE,
115
+ message: 'Somethings done',
116
+ status: 'DONE',
117
+ doneAt: SOME_DATE + 10,
118
+ txHash: '0x11111112542d85b3ef69ae05771c2dccff4faa26',
119
+ txLink: 'https://example.com',
120
+ },
121
+ {
122
+ type: 'SWAP',
123
+ startedAt: SOME_DATE + 20,
124
+ message: 'Somethings pending',
125
+ status: 'PENDING',
126
+ },
127
+ ],
128
+ fromAmount: '1000000',
129
+ toAmount: '261490494702370',
130
+ }
131
+ : undefined,
132
+ });
133
+ export const buildRouteObject = ({ step = buildStepObject({}), }) => ({
134
+ id: '0x433df53dbf6dbd7b946fc4f3b501c3ff32957d77d96c9d5ba1805b01eb6461cc',
135
+ fromChainId: 137,
136
+ fromAmountUSD: '1.00',
137
+ fromAmount: '1000000',
138
+ fromToken: SOME_TOKEN,
139
+ fromAddress: '0x552008c0f6870c2f77e5cC1d2eb9bdff03e30Ea0',
140
+ toChainId: 137,
141
+ toAmountUSD: '1.00',
142
+ toAmount: '260982615655554',
143
+ toAmountMin: '253153137185887',
144
+ toToken: SOME_OTHER_TOKEN,
145
+ toAddress: '0x552008c0f6870c2f77e5cC1d2eb9bdff03e30Ea0',
146
+ gasCostUSD: '0.01',
147
+ steps: [step],
148
+ insurance: {
149
+ feeAmountUsd: '0',
150
+ state: 'NOT_INSURABLE',
151
+ },
152
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/sdk",
3
- "version": "2.0.0-beta.12",
3
+ "version": "2.0.0-beta.14",
4
4
  "description": "LI.FI Any-to-Any Cross-Chain-Swap SDK",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/index.js",
@@ -84,12 +84,12 @@
84
84
  "devDependencies": {
85
85
  "@commitlint/cli": "^17.6.3",
86
86
  "@commitlint/config-conventional": "^17.6.3",
87
- "@mswjs/interceptors": "^0.22.14",
88
- "@typescript-eslint/eslint-plugin": "^5.59.5",
89
- "@typescript-eslint/parser": "^5.59.5",
90
- "@vitest/coverage-c8": "^0.31.0",
91
- "cross-fetch": "^3.1.5",
92
- "eslint": "^8.40.0",
87
+ "@mswjs/interceptors": "^0.22.15",
88
+ "@typescript-eslint/eslint-plugin": "^5.59.7",
89
+ "@typescript-eslint/parser": "^5.59.7",
90
+ "@vitest/coverage-c8": "^0.31.1",
91
+ "cross-fetch": "^3.1.6",
92
+ "eslint": "^8.41.0",
93
93
  "eslint-config-prettier": "^8.8.0",
94
94
  "eslint-plugin-prettier": "^4.2.1",
95
95
  "husky": "^8.0.3",
@@ -100,7 +100,7 @@
100
100
  "prettier": "^2.8.8",
101
101
  "standard-version": "^9.5.0",
102
102
  "typescript": "^5.0.4",
103
- "vitest": "^0.31.0"
103
+ "vitest": "^0.31.1"
104
104
  },
105
105
  "directories": {
106
106
  "test": "test"
@@ -1,2 +0,0 @@
1
- import { Route } from '../types';
2
- export declare const handlePreRestart: (route: Route) => void;
@@ -1,2 +0,0 @@
1
- export declare const name = "@lifi/sdk";
2
- export declare const version = "2.0.0-beta.12";
@@ -1,2 +0,0 @@
1
- import { Route } from '../types';
2
- export declare const handlePreRestart: (route: Route) => void;
package/dist/version.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare const name = "@lifi/sdk";
2
- export declare const version = "2.0.0-beta.12";
package/dist/version.js DELETED
@@ -1,2 +0,0 @@
1
- export const name = '@lifi/sdk';
2
- export const version = '2.0.0-beta.12';
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes