@lifi/sdk 2.0.0-beta.14 → 2.0.0-beta.16
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/{src/execution → execution}/StepExecutionManager.js +11 -3
- package/dist/cjs/{src/utils → utils}/errors.js +6 -6
- package/dist/cjs/{src/utils → utils}/preRestart.js +10 -0
- package/dist/cjs/version.d.ts +2 -0
- package/dist/cjs/{src/version.js → version.js} +1 -1
- package/dist/{src/execution → execution}/StepExecutionManager.js +11 -3
- package/dist/{src/utils → utils}/preRestart.js +10 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +2 -0
- package/package.json +9 -9
- 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}/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}/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}/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}/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}/utils.d.ts +0 -0
- /package/dist/{src/utils → utils}/utils.js +0 -0
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { LifiStep } from '@lifi/types';
|
|
2
|
-
export declare const mockChainsResponse: {
|
|
3
|
-
key: string;
|
|
4
|
-
chainType: string;
|
|
5
|
-
name: string;
|
|
6
|
-
coin: string;
|
|
7
|
-
id: number;
|
|
8
|
-
mainnet: boolean;
|
|
9
|
-
logoURI: string;
|
|
10
|
-
tokenlistUrl: string;
|
|
11
|
-
faucetUrls: string[];
|
|
12
|
-
multicallAddress: string;
|
|
13
|
-
metamask: {
|
|
14
|
-
chainId: string;
|
|
15
|
-
blockExplorerUrls: string[];
|
|
16
|
-
chainName: string;
|
|
17
|
-
nativeCurrency: {
|
|
18
|
-
name: string;
|
|
19
|
-
symbol: string;
|
|
20
|
-
decimals: number;
|
|
21
|
-
};
|
|
22
|
-
rpcUrls: string[];
|
|
23
|
-
};
|
|
24
|
-
nativeToken: {
|
|
25
|
-
address: string;
|
|
26
|
-
chainId: number;
|
|
27
|
-
symbol: string;
|
|
28
|
-
decimals: number;
|
|
29
|
-
name: string;
|
|
30
|
-
priceUSD: string;
|
|
31
|
-
logoURI: string;
|
|
32
|
-
coinKey: string;
|
|
33
|
-
};
|
|
34
|
-
}[];
|
|
35
|
-
export declare const mockTransactionRequest: {
|
|
36
|
-
transactionRequest: {
|
|
37
|
-
data: string;
|
|
38
|
-
to: string;
|
|
39
|
-
value: string;
|
|
40
|
-
from: string;
|
|
41
|
-
chainId: number;
|
|
42
|
-
gasPrice: string;
|
|
43
|
-
gasLimit: string;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
export declare const mockStatus: {
|
|
47
|
-
status: string;
|
|
48
|
-
receiving: boolean;
|
|
49
|
-
sending: {
|
|
50
|
-
amount: string;
|
|
51
|
-
gasAmount: string;
|
|
52
|
-
gasAmountUSD: string;
|
|
53
|
-
gasPrice: string;
|
|
54
|
-
gasToken: string;
|
|
55
|
-
gasUsed: string;
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
export declare const mockStepTransactionWithTxRequest: (step?: LifiStep) => {
|
|
59
|
-
transactionRequest: {
|
|
60
|
-
transactionRequest: {
|
|
61
|
-
data: string;
|
|
62
|
-
to: string;
|
|
63
|
-
value: string;
|
|
64
|
-
from: string;
|
|
65
|
-
chainId: number;
|
|
66
|
-
gasPrice: string;
|
|
67
|
-
gasLimit: string;
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
type: "lifi";
|
|
71
|
-
includedSteps: import("@lifi/types").Step[];
|
|
72
|
-
id: string;
|
|
73
|
-
referrer?: string | undefined;
|
|
74
|
-
action: import("@lifi/types").Action | import("@lifi/types").CallAction;
|
|
75
|
-
estimate: import("@lifi/types").Estimate;
|
|
76
|
-
tool: string;
|
|
77
|
-
toolDetails: Pick<import("@lifi/types").Bridge | import("@lifi/types").ExchangeAggregator | import("@lifi/types").Exchange, "key" | "name" | "logoURI">;
|
|
78
|
-
integrator?: string | undefined;
|
|
79
|
-
execution?: import("@lifi/types").Execution | undefined;
|
|
80
|
-
};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { buildStepObject } from '../../test/fixtures';
|
|
2
|
-
export const mockChainsResponse = [
|
|
3
|
-
{
|
|
4
|
-
key: 'pol',
|
|
5
|
-
chainType: 'EVM',
|
|
6
|
-
name: 'Polygon',
|
|
7
|
-
coin: 'MATIC',
|
|
8
|
-
id: 137,
|
|
9
|
-
mainnet: true,
|
|
10
|
-
logoURI: 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/chains/polygon.svg',
|
|
11
|
-
tokenlistUrl: 'https://unpkg.com/quickswap-default-token-list@1.0.71/build/quickswap-default.tokenlist.json',
|
|
12
|
-
faucetUrls: ['https://stakely.io/faucet/polygon-matic'],
|
|
13
|
-
multicallAddress: '0xcA11bde05977b3631167028862bE2a173976CA11',
|
|
14
|
-
metamask: {
|
|
15
|
-
chainId: '0x89',
|
|
16
|
-
blockExplorerUrls: [
|
|
17
|
-
'https://polygonscan.com/',
|
|
18
|
-
'https://explorer-mainnet.maticvigil.com/',
|
|
19
|
-
],
|
|
20
|
-
chainName: 'Matic(Polygon) Mainnet',
|
|
21
|
-
nativeCurrency: {
|
|
22
|
-
name: 'MATIC',
|
|
23
|
-
symbol: 'MATIC',
|
|
24
|
-
decimals: 18,
|
|
25
|
-
},
|
|
26
|
-
rpcUrls: [
|
|
27
|
-
'https://polygon-rpc.com/',
|
|
28
|
-
'https://rpc-mainnet.maticvigil.com/',
|
|
29
|
-
],
|
|
30
|
-
},
|
|
31
|
-
nativeToken: {
|
|
32
|
-
address: '0x0000000000000000000000000000000000000000',
|
|
33
|
-
chainId: 137,
|
|
34
|
-
symbol: 'MATIC',
|
|
35
|
-
decimals: 18,
|
|
36
|
-
name: 'MATIC',
|
|
37
|
-
priceUSD: '0.899628',
|
|
38
|
-
logoURI: 'https://static.debank.com/image/matic_token/logo_url/matic/6f5a6b6f0732a7a235131bd7804d357c.png',
|
|
39
|
-
coinKey: 'MATIC',
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
];
|
|
43
|
-
export const mockTransactionRequest = {
|
|
44
|
-
transactionRequest: {
|
|
45
|
-
// eslint-disable-next-line max-len
|
|
46
|
-
data: '0xdata',
|
|
47
|
-
to: '0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE',
|
|
48
|
-
value: '0x0600830dbc7f5bf7',
|
|
49
|
-
from: '0x552008c0f6870c2f77e5cC1d2eb9bdff03e30Ea0',
|
|
50
|
-
chainId: 137,
|
|
51
|
-
gasPrice: '0x27c01c1727',
|
|
52
|
-
gasLimit: '682701',
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
export const mockStatus = {
|
|
56
|
-
status: 'DONE',
|
|
57
|
-
receiving: true,
|
|
58
|
-
sending: {
|
|
59
|
-
amount: '123',
|
|
60
|
-
gasAmount: '123',
|
|
61
|
-
gasAmountUSD: '123',
|
|
62
|
-
gasPrice: '123',
|
|
63
|
-
gasToken: '123',
|
|
64
|
-
gasUsed: '123',
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
export const mockStepTransactionWithTxRequest = (step = buildStepObject({
|
|
68
|
-
includingExecution: false,
|
|
69
|
-
})) => ({
|
|
70
|
-
...step,
|
|
71
|
-
transactionRequest: mockTransactionRequest,
|
|
72
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const handlers: import("msw").RestHandler<import("msw/lib/glossary-de6278a9").M<import("msw/lib/glossary-de6278a9").h>>[];
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { ChainId, CoinKey, findDefaultToken } from '@lifi/types';
|
|
2
|
-
import { rest } from 'msw';
|
|
3
|
-
import ConfigService from './ConfigService';
|
|
4
|
-
const config = ConfigService.getInstance().getConfig();
|
|
5
|
-
export const handlers = [
|
|
6
|
-
rest.post(`${config.apiUrl}/advanced/routes`, async (request, response, context) => {
|
|
7
|
-
const data = await request.json();
|
|
8
|
-
if (isNaN(parseFloat(data.fromAmount))) {
|
|
9
|
-
return response(context.status(500), context.json({ message: `Oops` }));
|
|
10
|
-
}
|
|
11
|
-
return response(context.json({}));
|
|
12
|
-
}),
|
|
13
|
-
rest.post(`${config.apiUrl}/advanced/possibilities`, async (request, response, context) => {
|
|
14
|
-
return response(context.json({}));
|
|
15
|
-
}),
|
|
16
|
-
rest.get(`${config.apiUrl}/token`, async (request, response, context) => {
|
|
17
|
-
return response(context.json({}));
|
|
18
|
-
}),
|
|
19
|
-
rest.get(`${config.apiUrl}/quote`, async (request, response, context) => {
|
|
20
|
-
return response(context.json({}));
|
|
21
|
-
}),
|
|
22
|
-
rest.get(`${config.apiUrl}/status`, async (request, response, context) => {
|
|
23
|
-
return response(context.json({}));
|
|
24
|
-
}),
|
|
25
|
-
rest.get(`${config.apiUrl}/chains`, async (request, response, context) => {
|
|
26
|
-
return response(context.json({ chains: [{ id: 1 }] }));
|
|
27
|
-
}),
|
|
28
|
-
rest.get(`${config.apiUrl}/tools`, async (request, response, context) => {
|
|
29
|
-
return response(context.json({ bridges: [], exchanges: [] }));
|
|
30
|
-
}),
|
|
31
|
-
rest.get(`${config.apiUrl}/tokens`, async (request, response, context) => {
|
|
32
|
-
return response(context.json({
|
|
33
|
-
tokens: {
|
|
34
|
-
[ChainId.ETH]: [findDefaultToken(CoinKey.ETH, ChainId.ETH)],
|
|
35
|
-
},
|
|
36
|
-
}));
|
|
37
|
-
}),
|
|
38
|
-
rest.post(`${config.apiUrl}/advanced/stepTransaction`, async (request, response, context) => {
|
|
39
|
-
return response(context.json({}));
|
|
40
|
-
}),
|
|
41
|
-
rest.get(`${config.apiUrl}/gas/suggestion/${ChainId.OPT}`, async (request, response, context) => {
|
|
42
|
-
return response(context.json({}));
|
|
43
|
-
}),
|
|
44
|
-
];
|
package/dist/src/version.d.ts
DELETED
package/dist/src/version.js
DELETED
package/dist/test/fixtures.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
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;
|
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
|