@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.
- package/dist/cjs/version.d.ts +2 -0
- package/dist/cjs/{src/version.js → version.js} +1 -1
- package/dist/version.d.ts +2 -0
- package/dist/version.js +2 -0
- package/package.json +1 -1
- package/dist/cjs/src/execution/RouteExecutionManager.unit.handlers.d.ts +0 -1
- package/dist/cjs/src/execution/RouteExecutionManager.unit.handlers.js +0 -20
- package/dist/cjs/src/execution/RouteExecutionManager.unit.mock.d.ts +0 -80
- package/dist/cjs/src/execution/RouteExecutionManager.unit.mock.js +0 -76
- package/dist/cjs/src/services/ApiService.unit.handlers.d.ts +0 -1
- package/dist/cjs/src/services/ApiService.unit.handlers.js +0 -50
- package/dist/cjs/src/version.d.ts +0 -2
- package/dist/cjs/test/fixtures.d.ts +0 -7
- package/dist/cjs/test/fixtures.js +0 -157
- package/dist/src/execution/RouteExecutionManager.unit.handlers.d.ts +0 -1
- package/dist/src/execution/RouteExecutionManager.unit.handlers.js +0 -14
- package/dist/src/execution/RouteExecutionManager.unit.mock.d.ts +0 -80
- package/dist/src/execution/RouteExecutionManager.unit.mock.js +0 -72
- package/dist/src/services/ApiService.unit.handlers.d.ts +0 -1
- package/dist/src/services/ApiService.unit.handlers.js +0 -44
- package/dist/src/version.d.ts +0 -2
- package/dist/src/version.js +0 -2
- package/dist/test/fixtures.d.ts +0 -7
- package/dist/test/fixtures.js +0 -152
- /package/dist/{cjs/src/LiFi.d.ts → LiFi.d.ts} +0 -0
- /package/dist/{src/LiFi.js → LiFi.js} +0 -0
- /package/dist/{cjs/src/allowance → allowance}/checkAllowance.d.ts +0 -0
- /package/dist/{src/allowance → allowance}/checkAllowance.js +0 -0
- /package/dist/{cjs/src/allowance → allowance}/index.d.ts +0 -0
- /package/dist/{src/allowance → allowance}/index.js +0 -0
- /package/dist/{cjs/src/allowance → allowance}/tokenApproval.d.ts +0 -0
- /package/dist/{src/allowance → allowance}/tokenApproval.js +0 -0
- /package/dist/{cjs/src/allowance → allowance}/utils.d.ts +0 -0
- /package/dist/{src/allowance → allowance}/utils.js +0 -0
- /package/dist/{cjs/src/balance → balance}/checkBalance.d.ts +0 -0
- /package/dist/{src/balance → balance}/checkBalance.js +0 -0
- /package/dist/{cjs/src/balance → balance}/getTokenBalance.d.ts +0 -0
- /package/dist/{src/balance → balance}/getTokenBalance.js +0 -0
- /package/dist/{cjs/src/balance → balance}/index.d.ts +0 -0
- /package/dist/{src/balance → balance}/index.js +0 -0
- /package/dist/{cjs/src/balance → balance}/utils.d.ts +0 -0
- /package/dist/{src/balance → balance}/utils.js +0 -0
- /package/dist/{src → cjs}/LiFi.d.ts +0 -0
- /package/dist/cjs/{src/LiFi.js → LiFi.js} +0 -0
- /package/dist/{src → cjs}/allowance/checkAllowance.d.ts +0 -0
- /package/dist/cjs/{src/allowance → allowance}/checkAllowance.js +0 -0
- /package/dist/{src → cjs}/allowance/index.d.ts +0 -0
- /package/dist/cjs/{src/allowance → allowance}/index.js +0 -0
- /package/dist/{src → cjs}/allowance/tokenApproval.d.ts +0 -0
- /package/dist/cjs/{src/allowance → allowance}/tokenApproval.js +0 -0
- /package/dist/{src → cjs}/allowance/utils.d.ts +0 -0
- /package/dist/cjs/{src/allowance → allowance}/utils.js +0 -0
- /package/dist/{src → cjs}/balance/checkBalance.d.ts +0 -0
- /package/dist/cjs/{src/balance → balance}/checkBalance.js +0 -0
- /package/dist/{src → cjs}/balance/getTokenBalance.d.ts +0 -0
- /package/dist/cjs/{src/balance → balance}/getTokenBalance.js +0 -0
- /package/dist/{src → cjs}/balance/index.d.ts +0 -0
- /package/dist/cjs/{src/balance → balance}/index.js +0 -0
- /package/dist/{src → cjs}/balance/utils.d.ts +0 -0
- /package/dist/cjs/{src/balance → balance}/utils.js +0 -0
- /package/dist/cjs/{src/connectors.d.ts → connectors.d.ts} +0 -0
- /package/dist/cjs/{src/connectors.js → connectors.js} +0 -0
- /package/dist/cjs/{src/execution → execution}/RouteExecutionManager.d.ts +0 -0
- /package/dist/cjs/{src/execution → execution}/RouteExecutionManager.js +0 -0
- /package/dist/cjs/{src/execution → execution}/StatusManager.d.ts +0 -0
- /package/dist/cjs/{src/execution → execution}/StatusManager.js +0 -0
- /package/dist/cjs/{src/execution → execution}/StepExecutionManager.d.ts +0 -0
- /package/dist/cjs/{src/execution → execution}/StepExecutionManager.js +0 -0
- /package/dist/cjs/{src/execution → execution}/StepExecutor.d.ts +0 -0
- /package/dist/cjs/{src/execution → execution}/StepExecutor.js +0 -0
- /package/dist/cjs/{src/execution → execution}/index.d.ts +0 -0
- /package/dist/cjs/{src/execution → execution}/index.js +0 -0
- /package/dist/cjs/{src/execution → execution}/stepComparison.d.ts +0 -0
- /package/dist/cjs/{src/execution → execution}/stepComparison.js +0 -0
- /package/dist/cjs/{src/execution → execution}/switchChain.d.ts +0 -0
- /package/dist/cjs/{src/execution → execution}/switchChain.js +0 -0
- /package/dist/cjs/{src/execution → execution}/utils.d.ts +0 -0
- /package/dist/cjs/{src/execution → execution}/utils.js +0 -0
- /package/dist/cjs/{src/helpers.d.ts → helpers.d.ts} +0 -0
- /package/dist/cjs/{src/helpers.js → helpers.js} +0 -0
- /package/dist/cjs/{src/index.d.ts → index.d.ts} +0 -0
- /package/dist/cjs/{src/index.js → index.js} +0 -0
- /package/dist/cjs/{src/request.d.ts → request.d.ts} +0 -0
- /package/dist/cjs/{src/request.js → request.js} +0 -0
- /package/dist/cjs/{src/services → services}/ApiService.d.ts +0 -0
- /package/dist/cjs/{src/services → services}/ApiService.js +0 -0
- /package/dist/cjs/{src/services → services}/ChainsService.d.ts +0 -0
- /package/dist/cjs/{src/services → services}/ChainsService.js +0 -0
- /package/dist/cjs/{src/services → services}/ConfigService.d.ts +0 -0
- /package/dist/cjs/{src/services → services}/ConfigService.js +0 -0
- /package/dist/cjs/{src/typeguards.d.ts → typeguards.d.ts} +0 -0
- /package/dist/cjs/{src/typeguards.js → typeguards.js} +0 -0
- /package/dist/cjs/{src/types → types}/ERC20.d.ts +0 -0
- /package/dist/cjs/{src/types → types}/ERC20.js +0 -0
- /package/dist/cjs/{src/types → types}/index.d.ts +0 -0
- /package/dist/cjs/{src/types → types}/index.js +0 -0
- /package/dist/cjs/{src/types → types}/internal.types.d.ts +0 -0
- /package/dist/cjs/{src/types → types}/internal.types.js +0 -0
- /package/dist/cjs/{src/utils → utils}/errors.d.ts +0 -0
- /package/dist/cjs/{src/utils → utils}/errors.js +0 -0
- /package/dist/cjs/{src/utils → utils}/getProvider.d.ts +0 -0
- /package/dist/cjs/{src/utils → utils}/getProvider.js +0 -0
- /package/dist/cjs/{src/utils → utils}/multicall.d.ts +0 -0
- /package/dist/cjs/{src/utils → utils}/multicall.js +0 -0
- /package/dist/cjs/{src/utils → utils}/multicallAbi.json +0 -0
- /package/dist/cjs/{src/utils → utils}/parseError.d.ts +0 -0
- /package/dist/cjs/{src/utils → utils}/parseError.js +0 -0
- /package/dist/cjs/{src/utils → utils}/preRestart.d.ts +0 -0
- /package/dist/cjs/{src/utils → utils}/preRestart.js +0 -0
- /package/dist/cjs/{src/utils → utils}/utils.d.ts +0 -0
- /package/dist/cjs/{src/utils → utils}/utils.js +0 -0
- /package/dist/{src/connectors.d.ts → connectors.d.ts} +0 -0
- /package/dist/{src/connectors.js → connectors.js} +0 -0
- /package/dist/{src/execution → execution}/RouteExecutionManager.d.ts +0 -0
- /package/dist/{src/execution → execution}/RouteExecutionManager.js +0 -0
- /package/dist/{src/execution → execution}/StatusManager.d.ts +0 -0
- /package/dist/{src/execution → execution}/StatusManager.js +0 -0
- /package/dist/{src/execution → execution}/StepExecutionManager.d.ts +0 -0
- /package/dist/{src/execution → execution}/StepExecutionManager.js +0 -0
- /package/dist/{src/execution → execution}/StepExecutor.d.ts +0 -0
- /package/dist/{src/execution → execution}/StepExecutor.js +0 -0
- /package/dist/{src/execution → execution}/index.d.ts +0 -0
- /package/dist/{src/execution → execution}/index.js +0 -0
- /package/dist/{src/execution → execution}/stepComparison.d.ts +0 -0
- /package/dist/{src/execution → execution}/stepComparison.js +0 -0
- /package/dist/{src/execution → execution}/switchChain.d.ts +0 -0
- /package/dist/{src/execution → execution}/switchChain.js +0 -0
- /package/dist/{src/execution → execution}/utils.d.ts +0 -0
- /package/dist/{src/execution → execution}/utils.js +0 -0
- /package/dist/{src/helpers.d.ts → helpers.d.ts} +0 -0
- /package/dist/{src/helpers.js → helpers.js} +0 -0
- /package/dist/{src/index.d.ts → index.d.ts} +0 -0
- /package/dist/{src/index.js → index.js} +0 -0
- /package/dist/{src/request.d.ts → request.d.ts} +0 -0
- /package/dist/{src/request.js → request.js} +0 -0
- /package/dist/{src/services → services}/ApiService.d.ts +0 -0
- /package/dist/{src/services → services}/ApiService.js +0 -0
- /package/dist/{src/services → services}/ChainsService.d.ts +0 -0
- /package/dist/{src/services → services}/ChainsService.js +0 -0
- /package/dist/{src/services → services}/ConfigService.d.ts +0 -0
- /package/dist/{src/services → services}/ConfigService.js +0 -0
- /package/dist/{src/typeguards.d.ts → typeguards.d.ts} +0 -0
- /package/dist/{src/typeguards.js → typeguards.js} +0 -0
- /package/dist/{src/types → types}/ERC20.d.ts +0 -0
- /package/dist/{src/types → types}/ERC20.js +0 -0
- /package/dist/{src/types → types}/index.d.ts +0 -0
- /package/dist/{src/types → types}/index.js +0 -0
- /package/dist/{src/types → types}/internal.types.d.ts +0 -0
- /package/dist/{src/types → types}/internal.types.js +0 -0
- /package/dist/{src/utils → utils}/errors.d.ts +0 -0
- /package/dist/{src/utils → utils}/errors.js +0 -0
- /package/dist/{src/utils → utils}/getProvider.d.ts +0 -0
- /package/dist/{src/utils → utils}/getProvider.js +0 -0
- /package/dist/{src/utils → utils}/multicall.d.ts +0 -0
- /package/dist/{src/utils → utils}/multicall.js +0 -0
- /package/dist/{src/utils → utils}/multicallAbi.json +0 -0
- /package/dist/{src/utils → utils}/parseError.d.ts +0 -0
- /package/dist/{src/utils → utils}/parseError.js +0 -0
- /package/dist/{src/utils → utils}/preRestart.d.ts +0 -0
- /package/dist/{src/utils → utils}/preRestart.js +0 -0
- /package/dist/{src/utils → utils}/utils.d.ts +0 -0
- /package/dist/{src/utils → utils}/utils.js +0 -0
package/dist/test/fixtures.js
DELETED
|
@@ -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
|
|
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
|