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

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 (162) hide show
  1. package/dist/cjs/version.d.ts +2 -0
  2. package/dist/cjs/{src/version.js → version.js} +1 -1
  3. package/dist/version.d.ts +2 -0
  4. package/dist/version.js +2 -0
  5. package/package.json +1 -1
  6. package/dist/cjs/src/execution/RouteExecutionManager.unit.handlers.d.ts +0 -1
  7. package/dist/cjs/src/execution/RouteExecutionManager.unit.handlers.js +0 -20
  8. package/dist/cjs/src/execution/RouteExecutionManager.unit.mock.d.ts +0 -80
  9. package/dist/cjs/src/execution/RouteExecutionManager.unit.mock.js +0 -76
  10. package/dist/cjs/src/services/ApiService.unit.handlers.d.ts +0 -1
  11. package/dist/cjs/src/services/ApiService.unit.handlers.js +0 -50
  12. package/dist/cjs/src/version.d.ts +0 -2
  13. package/dist/cjs/test/fixtures.d.ts +0 -7
  14. package/dist/cjs/test/fixtures.js +0 -157
  15. package/dist/src/execution/RouteExecutionManager.unit.handlers.d.ts +0 -1
  16. package/dist/src/execution/RouteExecutionManager.unit.handlers.js +0 -14
  17. package/dist/src/execution/RouteExecutionManager.unit.mock.d.ts +0 -80
  18. package/dist/src/execution/RouteExecutionManager.unit.mock.js +0 -72
  19. package/dist/src/services/ApiService.unit.handlers.d.ts +0 -1
  20. package/dist/src/services/ApiService.unit.handlers.js +0 -44
  21. package/dist/src/version.d.ts +0 -2
  22. package/dist/src/version.js +0 -2
  23. package/dist/test/fixtures.d.ts +0 -7
  24. package/dist/test/fixtures.js +0 -152
  25. /package/dist/{cjs/src/LiFi.d.ts → LiFi.d.ts} +0 -0
  26. /package/dist/{src/LiFi.js → LiFi.js} +0 -0
  27. /package/dist/{cjs/src/allowance → allowance}/checkAllowance.d.ts +0 -0
  28. /package/dist/{src/allowance → allowance}/checkAllowance.js +0 -0
  29. /package/dist/{cjs/src/allowance → allowance}/index.d.ts +0 -0
  30. /package/dist/{src/allowance → allowance}/index.js +0 -0
  31. /package/dist/{cjs/src/allowance → allowance}/tokenApproval.d.ts +0 -0
  32. /package/dist/{src/allowance → allowance}/tokenApproval.js +0 -0
  33. /package/dist/{cjs/src/allowance → allowance}/utils.d.ts +0 -0
  34. /package/dist/{src/allowance → allowance}/utils.js +0 -0
  35. /package/dist/{cjs/src/balance → balance}/checkBalance.d.ts +0 -0
  36. /package/dist/{src/balance → balance}/checkBalance.js +0 -0
  37. /package/dist/{cjs/src/balance → balance}/getTokenBalance.d.ts +0 -0
  38. /package/dist/{src/balance → balance}/getTokenBalance.js +0 -0
  39. /package/dist/{cjs/src/balance → balance}/index.d.ts +0 -0
  40. /package/dist/{src/balance → balance}/index.js +0 -0
  41. /package/dist/{cjs/src/balance → balance}/utils.d.ts +0 -0
  42. /package/dist/{src/balance → balance}/utils.js +0 -0
  43. /package/dist/{src → cjs}/LiFi.d.ts +0 -0
  44. /package/dist/cjs/{src/LiFi.js → LiFi.js} +0 -0
  45. /package/dist/{src → cjs}/allowance/checkAllowance.d.ts +0 -0
  46. /package/dist/cjs/{src/allowance → allowance}/checkAllowance.js +0 -0
  47. /package/dist/{src → cjs}/allowance/index.d.ts +0 -0
  48. /package/dist/cjs/{src/allowance → allowance}/index.js +0 -0
  49. /package/dist/{src → cjs}/allowance/tokenApproval.d.ts +0 -0
  50. /package/dist/cjs/{src/allowance → allowance}/tokenApproval.js +0 -0
  51. /package/dist/{src → cjs}/allowance/utils.d.ts +0 -0
  52. /package/dist/cjs/{src/allowance → allowance}/utils.js +0 -0
  53. /package/dist/{src → cjs}/balance/checkBalance.d.ts +0 -0
  54. /package/dist/cjs/{src/balance → balance}/checkBalance.js +0 -0
  55. /package/dist/{src → cjs}/balance/getTokenBalance.d.ts +0 -0
  56. /package/dist/cjs/{src/balance → balance}/getTokenBalance.js +0 -0
  57. /package/dist/{src → cjs}/balance/index.d.ts +0 -0
  58. /package/dist/cjs/{src/balance → balance}/index.js +0 -0
  59. /package/dist/{src → cjs}/balance/utils.d.ts +0 -0
  60. /package/dist/cjs/{src/balance → balance}/utils.js +0 -0
  61. /package/dist/cjs/{src/connectors.d.ts → connectors.d.ts} +0 -0
  62. /package/dist/cjs/{src/connectors.js → connectors.js} +0 -0
  63. /package/dist/cjs/{src/execution → execution}/RouteExecutionManager.d.ts +0 -0
  64. /package/dist/cjs/{src/execution → execution}/RouteExecutionManager.js +0 -0
  65. /package/dist/cjs/{src/execution → execution}/StatusManager.d.ts +0 -0
  66. /package/dist/cjs/{src/execution → execution}/StatusManager.js +0 -0
  67. /package/dist/cjs/{src/execution → execution}/StepExecutionManager.d.ts +0 -0
  68. /package/dist/cjs/{src/execution → execution}/StepExecutionManager.js +0 -0
  69. /package/dist/cjs/{src/execution → execution}/StepExecutor.d.ts +0 -0
  70. /package/dist/cjs/{src/execution → execution}/StepExecutor.js +0 -0
  71. /package/dist/cjs/{src/execution → execution}/index.d.ts +0 -0
  72. /package/dist/cjs/{src/execution → execution}/index.js +0 -0
  73. /package/dist/cjs/{src/execution → execution}/stepComparison.d.ts +0 -0
  74. /package/dist/cjs/{src/execution → execution}/stepComparison.js +0 -0
  75. /package/dist/cjs/{src/execution → execution}/switchChain.d.ts +0 -0
  76. /package/dist/cjs/{src/execution → execution}/switchChain.js +0 -0
  77. /package/dist/cjs/{src/execution → execution}/utils.d.ts +0 -0
  78. /package/dist/cjs/{src/execution → execution}/utils.js +0 -0
  79. /package/dist/cjs/{src/helpers.d.ts → helpers.d.ts} +0 -0
  80. /package/dist/cjs/{src/helpers.js → helpers.js} +0 -0
  81. /package/dist/cjs/{src/index.d.ts → index.d.ts} +0 -0
  82. /package/dist/cjs/{src/index.js → index.js} +0 -0
  83. /package/dist/cjs/{src/request.d.ts → request.d.ts} +0 -0
  84. /package/dist/cjs/{src/request.js → request.js} +0 -0
  85. /package/dist/cjs/{src/services → services}/ApiService.d.ts +0 -0
  86. /package/dist/cjs/{src/services → services}/ApiService.js +0 -0
  87. /package/dist/cjs/{src/services → services}/ChainsService.d.ts +0 -0
  88. /package/dist/cjs/{src/services → services}/ChainsService.js +0 -0
  89. /package/dist/cjs/{src/services → services}/ConfigService.d.ts +0 -0
  90. /package/dist/cjs/{src/services → services}/ConfigService.js +0 -0
  91. /package/dist/cjs/{src/typeguards.d.ts → typeguards.d.ts} +0 -0
  92. /package/dist/cjs/{src/typeguards.js → typeguards.js} +0 -0
  93. /package/dist/cjs/{src/types → types}/ERC20.d.ts +0 -0
  94. /package/dist/cjs/{src/types → types}/ERC20.js +0 -0
  95. /package/dist/cjs/{src/types → types}/index.d.ts +0 -0
  96. /package/dist/cjs/{src/types → types}/index.js +0 -0
  97. /package/dist/cjs/{src/types → types}/internal.types.d.ts +0 -0
  98. /package/dist/cjs/{src/types → types}/internal.types.js +0 -0
  99. /package/dist/cjs/{src/utils → utils}/errors.d.ts +0 -0
  100. /package/dist/cjs/{src/utils → utils}/errors.js +0 -0
  101. /package/dist/cjs/{src/utils → utils}/getProvider.d.ts +0 -0
  102. /package/dist/cjs/{src/utils → utils}/getProvider.js +0 -0
  103. /package/dist/cjs/{src/utils → utils}/multicall.d.ts +0 -0
  104. /package/dist/cjs/{src/utils → utils}/multicall.js +0 -0
  105. /package/dist/cjs/{src/utils → utils}/multicallAbi.json +0 -0
  106. /package/dist/cjs/{src/utils → utils}/parseError.d.ts +0 -0
  107. /package/dist/cjs/{src/utils → utils}/parseError.js +0 -0
  108. /package/dist/cjs/{src/utils → utils}/preRestart.d.ts +0 -0
  109. /package/dist/cjs/{src/utils → utils}/preRestart.js +0 -0
  110. /package/dist/cjs/{src/utils → utils}/utils.d.ts +0 -0
  111. /package/dist/cjs/{src/utils → utils}/utils.js +0 -0
  112. /package/dist/{src/connectors.d.ts → connectors.d.ts} +0 -0
  113. /package/dist/{src/connectors.js → connectors.js} +0 -0
  114. /package/dist/{src/execution → execution}/RouteExecutionManager.d.ts +0 -0
  115. /package/dist/{src/execution → execution}/RouteExecutionManager.js +0 -0
  116. /package/dist/{src/execution → execution}/StatusManager.d.ts +0 -0
  117. /package/dist/{src/execution → execution}/StatusManager.js +0 -0
  118. /package/dist/{src/execution → execution}/StepExecutionManager.d.ts +0 -0
  119. /package/dist/{src/execution → execution}/StepExecutionManager.js +0 -0
  120. /package/dist/{src/execution → execution}/StepExecutor.d.ts +0 -0
  121. /package/dist/{src/execution → execution}/StepExecutor.js +0 -0
  122. /package/dist/{src/execution → execution}/index.d.ts +0 -0
  123. /package/dist/{src/execution → execution}/index.js +0 -0
  124. /package/dist/{src/execution → execution}/stepComparison.d.ts +0 -0
  125. /package/dist/{src/execution → execution}/stepComparison.js +0 -0
  126. /package/dist/{src/execution → execution}/switchChain.d.ts +0 -0
  127. /package/dist/{src/execution → execution}/switchChain.js +0 -0
  128. /package/dist/{src/execution → execution}/utils.d.ts +0 -0
  129. /package/dist/{src/execution → execution}/utils.js +0 -0
  130. /package/dist/{src/helpers.d.ts → helpers.d.ts} +0 -0
  131. /package/dist/{src/helpers.js → helpers.js} +0 -0
  132. /package/dist/{src/index.d.ts → index.d.ts} +0 -0
  133. /package/dist/{src/index.js → index.js} +0 -0
  134. /package/dist/{src/request.d.ts → request.d.ts} +0 -0
  135. /package/dist/{src/request.js → request.js} +0 -0
  136. /package/dist/{src/services → services}/ApiService.d.ts +0 -0
  137. /package/dist/{src/services → services}/ApiService.js +0 -0
  138. /package/dist/{src/services → services}/ChainsService.d.ts +0 -0
  139. /package/dist/{src/services → services}/ChainsService.js +0 -0
  140. /package/dist/{src/services → services}/ConfigService.d.ts +0 -0
  141. /package/dist/{src/services → services}/ConfigService.js +0 -0
  142. /package/dist/{src/typeguards.d.ts → typeguards.d.ts} +0 -0
  143. /package/dist/{src/typeguards.js → typeguards.js} +0 -0
  144. /package/dist/{src/types → types}/ERC20.d.ts +0 -0
  145. /package/dist/{src/types → types}/ERC20.js +0 -0
  146. /package/dist/{src/types → types}/index.d.ts +0 -0
  147. /package/dist/{src/types → types}/index.js +0 -0
  148. /package/dist/{src/types → types}/internal.types.d.ts +0 -0
  149. /package/dist/{src/types → types}/internal.types.js +0 -0
  150. /package/dist/{src/utils → utils}/errors.d.ts +0 -0
  151. /package/dist/{src/utils → utils}/errors.js +0 -0
  152. /package/dist/{src/utils → utils}/getProvider.d.ts +0 -0
  153. /package/dist/{src/utils → utils}/getProvider.js +0 -0
  154. /package/dist/{src/utils → utils}/multicall.d.ts +0 -0
  155. /package/dist/{src/utils → utils}/multicall.js +0 -0
  156. /package/dist/{src/utils → utils}/multicallAbi.json +0 -0
  157. /package/dist/{src/utils → utils}/parseError.d.ts +0 -0
  158. /package/dist/{src/utils → utils}/parseError.js +0 -0
  159. /package/dist/{src/utils → utils}/preRestart.d.ts +0 -0
  160. /package/dist/{src/utils → utils}/preRestart.js +0 -0
  161. /package/dist/{src/utils → utils}/utils.d.ts +0 -0
  162. /package/dist/{src/utils → utils}/utils.js +0 -0
@@ -1,152 +0,0 @@
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
- });
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
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