@1delta/bridge-configs 0.1.0
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/LICENSE +674 -0
- package/dist/configs/across/config.d.ts +4 -0
- package/dist/configs/across/config.d.ts.map +1 -0
- package/dist/configs/across/config.js +317 -0
- package/dist/configs/axelar/abis/AxelarGasService.d.ts +103 -0
- package/dist/configs/axelar/abis/AxelarGasService.d.ts.map +1 -0
- package/dist/configs/axelar/abis/AxelarGasService.js +1073 -0
- package/dist/configs/axelar/abis/AxelarGateway.d.ts +51 -0
- package/dist/configs/axelar/abis/AxelarGateway.d.ts.map +1 -0
- package/dist/configs/axelar/abis/AxelarGateway.js +753 -0
- package/dist/configs/axelar/abis/SquidMulticall.d.ts +47 -0
- package/dist/configs/axelar/abis/SquidMulticall.d.ts.map +1 -0
- package/dist/configs/axelar/abis/SquidMulticall.js +104 -0
- package/dist/configs/axelar/abis/SquidRouter.d.ts +82 -0
- package/dist/configs/axelar/abis/SquidRouter.d.ts.map +1 -0
- package/dist/configs/axelar/abis/SquidRouter.js +837 -0
- package/dist/configs/axelar/calldata/buildTx.d.ts +3 -0
- package/dist/configs/axelar/calldata/buildTx.d.ts.map +1 -0
- package/dist/configs/axelar/calldata/buildTx.js +29 -0
- package/dist/configs/axelar/calldata/index.d.ts +3 -0
- package/dist/configs/axelar/calldata/index.d.ts.map +1 -0
- package/dist/configs/axelar/calldata/index.js +2 -0
- package/dist/configs/axelar/calldata/squid/createSquidMulticallPayload.d.ts +16 -0
- package/dist/configs/axelar/calldata/squid/createSquidMulticallPayload.d.ts.map +1 -0
- package/dist/configs/axelar/calldata/squid/createSquidMulticallPayload.js +76 -0
- package/dist/configs/axelar/calldata/squid/types.d.ts +15 -0
- package/dist/configs/axelar/calldata/squid/types.d.ts.map +1 -0
- package/dist/configs/axelar/calldata/squid/types.js +7 -0
- package/dist/configs/axelar/calldata/types.d.ts +18 -0
- package/dist/configs/axelar/calldata/types.d.ts.map +1 -0
- package/dist/configs/axelar/calldata/types.js +1 -0
- package/dist/configs/axelar/config.d.ts +4 -0
- package/dist/configs/axelar/config.d.ts.map +1 -0
- package/dist/configs/axelar/config.js +99 -0
- package/dist/configs/axelar/data/axelarConfig/index.d.ts +3 -0
- package/dist/configs/axelar/data/axelarConfig/index.d.ts.map +1 -0
- package/dist/configs/axelar/data/axelarConfig/index.js +33 -0
- package/dist/configs/axelar/data/axelarConfig/types.d.ts +181 -0
- package/dist/configs/axelar/data/axelarConfig/types.d.ts.map +1 -0
- package/dist/configs/axelar/data/axelarConfig/types.js +1 -0
- package/dist/configs/axelar/data/squidChains/index.d.ts +6 -0
- package/dist/configs/axelar/data/squidChains/index.d.ts.map +1 -0
- package/dist/configs/axelar/data/squidChains/index.js +61 -0
- package/dist/configs/axelar/data/squidChains/types.d.ts +23 -0
- package/dist/configs/axelar/data/squidChains/types.d.ts.map +1 -0
- package/dist/configs/axelar/data/squidChains/types.js +1 -0
- package/dist/configs/axelar/errors.d.ts +15 -0
- package/dist/configs/axelar/errors.d.ts.map +1 -0
- package/dist/configs/axelar/errors.js +8 -0
- package/dist/configs/axelar/gasEstimation/index.d.ts +7 -0
- package/dist/configs/axelar/gasEstimation/index.d.ts.map +1 -0
- package/dist/configs/axelar/gasEstimation/index.js +38 -0
- package/dist/configs/axelar/gasEstimation/types.d.ts +23 -0
- package/dist/configs/axelar/gasEstimation/types.d.ts.map +1 -0
- package/dist/configs/axelar/gasEstimation/types.js +1 -0
- package/dist/configs/axelar/route/fetchAxelarRoute.d.ts +3 -0
- package/dist/configs/axelar/route/fetchAxelarRoute.d.ts.map +1 -0
- package/dist/configs/axelar/route/fetchAxelarRoute.js +50 -0
- package/dist/configs/axelar/route/index.d.ts +3 -0
- package/dist/configs/axelar/route/index.d.ts.map +1 -0
- package/dist/configs/axelar/route/index.js +2 -0
- package/dist/configs/axelar/route/tokenIdentifier.d.ts +5 -0
- package/dist/configs/axelar/route/tokenIdentifier.d.ts.map +1 -0
- package/dist/configs/axelar/route/tokenIdentifier.js +32 -0
- package/dist/configs/axelar/route/types.d.ts +5 -0
- package/dist/configs/axelar/route/types.d.ts.map +1 -0
- package/dist/configs/axelar/route/types.js +1 -0
- package/dist/configs/butter/config.d.ts +9 -0
- package/dist/configs/butter/config.d.ts.map +1 -0
- package/dist/configs/butter/config.js +207 -0
- package/dist/configs/cowswap/config.d.ts +4 -0
- package/dist/configs/cowswap/config.d.ts.map +1 -0
- package/dist/configs/cowswap/config.js +106 -0
- package/dist/configs/cowswap/errors.d.ts +19 -0
- package/dist/configs/cowswap/errors.d.ts.map +1 -0
- package/dist/configs/cowswap/errors.js +12 -0
- package/dist/configs/cowswap/swap/quote.d.ts +5 -0
- package/dist/configs/cowswap/swap/quote.d.ts.map +1 -0
- package/dist/configs/cowswap/swap/quote.js +28 -0
- package/dist/configs/cowswap/swap/route.d.ts +5 -0
- package/dist/configs/cowswap/swap/route.d.ts.map +1 -0
- package/dist/configs/cowswap/swap/route.js +61 -0
- package/dist/configs/cowswap/track/index.d.ts +6 -0
- package/dist/configs/cowswap/track/index.d.ts.map +1 -0
- package/dist/configs/cowswap/track/index.js +27 -0
- package/dist/configs/cowswap/utils/getCowSwapSlippage.d.ts +4 -0
- package/dist/configs/cowswap/utils/getCowSwapSlippage.d.ts.map +1 -0
- package/dist/configs/cowswap/utils/getCowSwapSlippage.js +16 -0
- package/dist/configs/cowswap/utils/toSupportedChainId.d.ts +3 -0
- package/dist/configs/cowswap/utils/toSupportedChainId.d.ts.map +1 -0
- package/dist/configs/cowswap/utils/toSupportedChainId.js +11 -0
- package/dist/configs/crosscurve/config.d.ts +4 -0
- package/dist/configs/crosscurve/config.d.ts.map +1 -0
- package/dist/configs/crosscurve/config.js +185 -0
- package/dist/configs/gas-zip/chains/fetch.d.ts +10 -0
- package/dist/configs/gas-zip/chains/fetch.d.ts.map +1 -0
- package/dist/configs/gas-zip/chains/fetch.js +29 -0
- package/dist/configs/gas-zip/chains/types.d.ts +25 -0
- package/dist/configs/gas-zip/chains/types.d.ts.map +1 -0
- package/dist/configs/gas-zip/chains/types.js +1 -0
- package/dist/configs/gas-zip/config.d.ts +4 -0
- package/dist/configs/gas-zip/config.d.ts.map +1 -0
- package/dist/configs/gas-zip/config.js +121 -0
- package/dist/configs/index.d.ts +2 -0
- package/dist/configs/index.d.ts.map +1 -0
- package/dist/configs/index.js +41 -0
- package/dist/configs/layerswap/LayerswapNetworks.json +3656 -0
- package/dist/configs/layerswap/config.d.ts +4 -0
- package/dist/configs/layerswap/config.d.ts.map +1 -0
- package/dist/configs/layerswap/config.js +285 -0
- package/dist/configs/lifi/config.d.ts +4 -0
- package/dist/configs/lifi/config.d.ts.map +1 -0
- package/dist/configs/lifi/config.js +104 -0
- package/dist/configs/mayan/calldata/index.d.ts +14 -0
- package/dist/configs/mayan/calldata/index.d.ts.map +1 -0
- package/dist/configs/mayan/calldata/index.js +41 -0
- package/dist/configs/mayan/config.d.ts +4 -0
- package/dist/configs/mayan/config.d.ts.map +1 -0
- package/dist/configs/mayan/config.js +222 -0
- package/dist/configs/odos/config.d.ts +8 -0
- package/dist/configs/odos/config.d.ts.map +1 -0
- package/dist/configs/odos/config.js +127 -0
- package/dist/configs/orbiter/abis/ERC20.d.ts +172 -0
- package/dist/configs/orbiter/abis/ERC20.d.ts.map +1 -0
- package/dist/configs/orbiter/abis/ERC20.js +224 -0
- package/dist/configs/orbiter/abis/OrbiterRouterEVMV3.d.ts +85 -0
- package/dist/configs/orbiter/abis/OrbiterRouterEVMV3.d.ts.map +1 -0
- package/dist/configs/orbiter/abis/OrbiterRouterEVMV3.js +83 -0
- package/dist/configs/orbiter/calldata/index.d.ts +32 -0
- package/dist/configs/orbiter/calldata/index.d.ts.map +1 -0
- package/dist/configs/orbiter/calldata/index.js +59 -0
- package/dist/configs/orbiter/config.d.ts +4 -0
- package/dist/configs/orbiter/config.d.ts.map +1 -0
- package/dist/configs/orbiter/config.js +178 -0
- package/dist/configs/router/config.d.ts +4 -0
- package/dist/configs/router/config.d.ts.map +1 -0
- package/dist/configs/router/config.js +125 -0
- package/dist/configs/squid-v1/config.d.ts +4 -0
- package/dist/configs/squid-v1/config.d.ts.map +1 -0
- package/dist/configs/squid-v1/config.js +133 -0
- package/dist/configs/squid-v2/config.d.ts +4 -0
- package/dist/configs/squid-v2/config.d.ts.map +1 -0
- package/dist/configs/squid-v2/config.js +146 -0
- package/dist/configs/squid-v2/constants.d.ts +2 -0
- package/dist/configs/squid-v2/constants.d.ts.map +1 -0
- package/dist/configs/squid-v2/constants.js +1 -0
- package/dist/configs/stargate/abis/StargatePool.d.ts +41 -0
- package/dist/configs/stargate/abis/StargatePool.d.ts.map +1 -0
- package/dist/configs/stargate/abis/StargatePool.js +318 -0
- package/dist/configs/stargate/abis/TokenMessaging.d.ts +16 -0
- package/dist/configs/stargate/abis/TokenMessaging.d.ts.map +1 -0
- package/dist/configs/stargate/abis/TokenMessaging.js +21 -0
- package/dist/configs/stargate/calldata/constants.d.ts +249 -0
- package/dist/configs/stargate/calldata/constants.d.ts.map +1 -0
- package/dist/configs/stargate/calldata/constants.js +273 -0
- package/dist/configs/stargate/calldata/index.d.ts +6 -0
- package/dist/configs/stargate/calldata/index.d.ts.map +1 -0
- package/dist/configs/stargate/calldata/index.js +127 -0
- package/dist/configs/stargate/calldata/types.d.ts +51 -0
- package/dist/configs/stargate/calldata/types.d.ts.map +1 -0
- package/dist/configs/stargate/calldata/types.js +10 -0
- package/dist/configs/stargate/common/config.d.ts +88 -0
- package/dist/configs/stargate/common/config.d.ts.map +1 -0
- package/dist/configs/stargate/common/config.js +93 -0
- package/dist/configs/stargate/common/constants.d.ts +5 -0
- package/dist/configs/stargate/common/constants.d.ts.map +1 -0
- package/dist/configs/stargate/common/constants.js +7 -0
- package/dist/configs/stargate/common/index.d.ts +3 -0
- package/dist/configs/stargate/common/index.d.ts.map +1 -0
- package/dist/configs/stargate/common/index.js +2 -0
- package/dist/configs/stargate/configs/bus/config.d.ts +4 -0
- package/dist/configs/stargate/configs/bus/config.d.ts.map +1 -0
- package/dist/configs/stargate/configs/bus/config.js +41 -0
- package/dist/configs/stargate/configs/taxi/config.d.ts +4 -0
- package/dist/configs/stargate/configs/taxi/config.d.ts.map +1 -0
- package/dist/configs/stargate/configs/taxi/config.js +58 -0
- package/dist/configs/stargate/types/index.d.ts +12 -0
- package/dist/configs/stargate/types/index.d.ts.map +1 -0
- package/dist/configs/stargate/types/index.js +15 -0
- package/dist/configs/symbiosis/config.d.ts +4 -0
- package/dist/configs/symbiosis/config.d.ts.map +1 -0
- package/dist/configs/symbiosis/config.js +119 -0
- package/dist/configs/utils/index.d.ts +2 -0
- package/dist/configs/utils/index.d.ts.map +1 -0
- package/dist/configs/utils/index.js +3 -0
- package/dist/configs/xy/config.d.ts +4 -0
- package/dist/configs/xy/config.d.ts.map +1 -0
- package/dist/configs/xy/config.js +176 -0
- package/dist/configs/zenlink/calldata/aggregationRouterV2ABI.d.ts +49 -0
- package/dist/configs/zenlink/calldata/aggregationRouterV2ABI.d.ts.map +1 -0
- package/dist/configs/zenlink/calldata/aggregationRouterV2ABI.js +63 -0
- package/dist/configs/zenlink/calldata/index.d.ts +18 -0
- package/dist/configs/zenlink/calldata/index.d.ts.map +1 -0
- package/dist/configs/zenlink/calldata/index.js +35 -0
- package/dist/configs/zenlink/config.d.ts +4 -0
- package/dist/configs/zenlink/config.d.ts.map +1 -0
- package/dist/configs/zenlink/config.js +109 -0
- package/dist/configs/zenlink/errors.d.ts +15 -0
- package/dist/configs/zenlink/errors.d.ts.map +1 -0
- package/dist/configs/zenlink/errors.js +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/types/index.d.ts +31 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +52 -0
- package/dist/walletClient.d.ts +4433 -0
- package/dist/walletClient.d.ts.map +1 -0
- package/dist/walletClient.js +7 -0
- package/package.json +27 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/configs/across/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,EAEjB,MAAM,qBAAqB,CAAA;AA2C5B,eAAO,MAAM,YAAY,EAAE,gBAoU1B,CAAA;AAED,eAAe,YAAY,CAAA"}
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { CrossChainBusinessException, } from '@1delta/bridge-core';
|
|
2
|
+
import { CurrencyHandler, getWNative as getWrappedNative, NATIVE_PLACEHOLDER, normalizeDecimals, SupportedChainId, } from '@1delta/lib-utils';
|
|
3
|
+
import axios, { AxiosError } from 'axios';
|
|
4
|
+
import { concat } from 'viem';
|
|
5
|
+
import { Bridge } from '../../types';
|
|
6
|
+
import { bridgeIcon } from '../utils';
|
|
7
|
+
const vercelApiHost = 'https://app.across.to';
|
|
8
|
+
const NAME = Bridge.ACROSS;
|
|
9
|
+
const errorCodes = {
|
|
10
|
+
ERROR: { code: 'ERROR', message: 'unknown error' },
|
|
11
|
+
SERVICE_UNAVAILABLE: {
|
|
12
|
+
code: 'SERVICE_UNAVAILABLE',
|
|
13
|
+
message: 'service unavailable',
|
|
14
|
+
},
|
|
15
|
+
// other error code
|
|
16
|
+
UNSUPPORTED_TOKEN: {
|
|
17
|
+
code: 'UNSUPPORTED_TOKEN',
|
|
18
|
+
message: 'unsupported token',
|
|
19
|
+
},
|
|
20
|
+
AMOUNT_TOO_LOW: {
|
|
21
|
+
code: 'AMOUNT_TOO_LOW',
|
|
22
|
+
message: 'amount is too low relative to fees',
|
|
23
|
+
},
|
|
24
|
+
DEPOSIT_NOT_FOUND: {
|
|
25
|
+
code: 'DEPOSIT_NOT_FOUND',
|
|
26
|
+
message: 'deposit not found',
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
const ALLOW_UNMATCHED_DECIMALS_CHAINS = [
|
|
30
|
+
SupportedChainId.BNB_SMART_CHAIN_MAINNET,
|
|
31
|
+
];
|
|
32
|
+
export const acrossConfig = {
|
|
33
|
+
name: NAME,
|
|
34
|
+
icon: {
|
|
35
|
+
light: bridgeIcon(NAME),
|
|
36
|
+
dark: bridgeIcon(NAME),
|
|
37
|
+
},
|
|
38
|
+
apiInterface: {
|
|
39
|
+
// Route (required)
|
|
40
|
+
route: {
|
|
41
|
+
url: `${vercelApiHost}/api/suggested-fees`,
|
|
42
|
+
method: 'get',
|
|
43
|
+
// call this function before execution
|
|
44
|
+
before: async (params) => {
|
|
45
|
+
const { fromTokenAddress, fromChainId, fromTokenDecimals, toTokenAddress, toChainId, toTokenDecimals, fromAmount, message, } = params;
|
|
46
|
+
const isNative = fromTokenAddress === NATIVE_PLACEHOLDER;
|
|
47
|
+
const fromToken = fromTokenAddress === NATIVE_PLACEHOLDER
|
|
48
|
+
? getWrappedNative(fromChainId).address
|
|
49
|
+
: fromTokenAddress;
|
|
50
|
+
const toToken = toTokenAddress === NATIVE_PLACEHOLDER
|
|
51
|
+
? getWrappedNative(toChainId).address
|
|
52
|
+
: toTokenAddress;
|
|
53
|
+
const routes = await axios.get(`${vercelApiHost}/api/available-routes`, {
|
|
54
|
+
params: {
|
|
55
|
+
originToken: fromToken,
|
|
56
|
+
originChainId: fromChainId,
|
|
57
|
+
destinationToken: toToken,
|
|
58
|
+
destinationChainId: toChainId,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
if (routes.data.length === 0 ||
|
|
62
|
+
!routes.data.some((route) => route.isNative === isNative) ||
|
|
63
|
+
(!message &&
|
|
64
|
+
CurrencyHandler.isWNativeAddress(toTokenAddress, toChainId)) || // Across only supports wrapped native as destination token if receiver is contract
|
|
65
|
+
(!!message &&
|
|
66
|
+
CurrencyHandler.isNativeAddress(toTokenAddress, toChainId)) // Across only supports native as destination token if receiver is EOA
|
|
67
|
+
) {
|
|
68
|
+
throw new CrossChainBusinessException(errorCodes.UNSUPPORTED_TOKEN);
|
|
69
|
+
}
|
|
70
|
+
const toAmount = normalizeDecimals(BigInt(fromAmount), fromTokenDecimals, toTokenDecimals);
|
|
71
|
+
return {
|
|
72
|
+
...params,
|
|
73
|
+
fromTokenAddress: fromToken,
|
|
74
|
+
toTokenAddress: toToken,
|
|
75
|
+
toAmount,
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
// call this function after execution
|
|
79
|
+
after: (err, res) => {
|
|
80
|
+
if (!err) {
|
|
81
|
+
return res;
|
|
82
|
+
}
|
|
83
|
+
if (err instanceof AxiosError) {
|
|
84
|
+
if (err.response?.status === 400) {
|
|
85
|
+
const errorRes = err.response;
|
|
86
|
+
if (errorRes.data.message.match(/no.*token.*found/)) {
|
|
87
|
+
throw new CrossChainBusinessException(errorCodes.UNSUPPORTED_TOKEN);
|
|
88
|
+
}
|
|
89
|
+
if (errorRes.data.message.match(/amount.*too.*low/)) {
|
|
90
|
+
throw new CrossChainBusinessException(errorCodes.AMOUNT_TOO_LOW);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
throw err;
|
|
95
|
+
},
|
|
96
|
+
// call this function after making API request
|
|
97
|
+
requestAfter: (res) => res,
|
|
98
|
+
// Interface request parameter data is put into "requestMapping", and field values are mapped from "CrossChainParamsData" parameters
|
|
99
|
+
requestMapping: {
|
|
100
|
+
allowUnmatchedDecimals: {
|
|
101
|
+
format: (params) => (ALLOW_UNMATCHED_DECIMALS_CHAINS.includes(params.fromChainId) ||
|
|
102
|
+
ALLOW_UNMATCHED_DECIMALS_CHAINS.includes(params.toChainId)) &&
|
|
103
|
+
params.fromTokenDecimals !== params.toTokenDecimals,
|
|
104
|
+
},
|
|
105
|
+
amount: 'fromAmount',
|
|
106
|
+
toAmount: 'toAmount',
|
|
107
|
+
destinationChainId: 'toChainId',
|
|
108
|
+
originChainId: 'fromChainId',
|
|
109
|
+
recipient: 'toAddress',
|
|
110
|
+
token: {
|
|
111
|
+
format: (params) => params.fromTokenAddress === NATIVE_PLACEHOLDER
|
|
112
|
+
? getWrappedNative(params.fromChainId).address
|
|
113
|
+
: params.fromTokenAddress,
|
|
114
|
+
},
|
|
115
|
+
outputToken: {
|
|
116
|
+
format: (params) => params.toTokenAddress === NATIVE_PLACEHOLDER
|
|
117
|
+
? getWrappedNative(params.toChainId).address
|
|
118
|
+
: params.toTokenAddress,
|
|
119
|
+
},
|
|
120
|
+
message: {
|
|
121
|
+
format: (params) => params.message,
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
// The interface return data is put into "responseMapping", and the field values are mapped from "interface response data
|
|
125
|
+
responseMapping: {
|
|
126
|
+
name: NAME,
|
|
127
|
+
depositContract: 'spokePoolAddress', // deposit contract address
|
|
128
|
+
toAmount: 'outputAmount',
|
|
129
|
+
// Fees already subtracted from the toAmount
|
|
130
|
+
fee: {},
|
|
131
|
+
estimatedDuration: 'estimatedFillTimeSec',
|
|
132
|
+
// "Route" API may return data needed for subsequent actions, and this data can be stored in "interfaceParamData" section for later use
|
|
133
|
+
interfaceParamData: {
|
|
134
|
+
relayFeePct: 'relayFeePct',
|
|
135
|
+
quoteTimestamp: 'timestamp',
|
|
136
|
+
exclusiveRelayer: 'exclusiveRelayer',
|
|
137
|
+
exclusivityDeadline: 'exclusivityDeadline',
|
|
138
|
+
fillDeadline: 'fillDeadline',
|
|
139
|
+
// these are crucial for calldata building, store them here
|
|
140
|
+
fromTokenDecimals: {
|
|
141
|
+
format: (_, p) => p.crossChainParamsData.fromTokenDecimals,
|
|
142
|
+
},
|
|
143
|
+
// these are crucial for calldata building, store them here
|
|
144
|
+
toTokenDecimals: {
|
|
145
|
+
format: (_, p) => p.crossChainParamsData.toTokenDecimals,
|
|
146
|
+
},
|
|
147
|
+
fixedFee: {
|
|
148
|
+
format: (route, _) => {
|
|
149
|
+
return BigInt(route.relayGasFeeTotal).toString();
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
percFee: {
|
|
153
|
+
format: (route, _) => {
|
|
154
|
+
// convert 1e18 = 100% to 1e9 = 100%
|
|
155
|
+
return ((BigInt(route.capitalFeePct) + BigInt(route.lpFeePct)) /
|
|
156
|
+
1000000000n).toString();
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
toAmount: 'outputAmount',
|
|
160
|
+
fromChainId: {
|
|
161
|
+
format: (route, { crossChainParamsData }) => crossChainParamsData.fromChainId,
|
|
162
|
+
},
|
|
163
|
+
toChainId: {
|
|
164
|
+
format: (route, { crossChainParamsData }) => crossChainParamsData.toChainId,
|
|
165
|
+
},
|
|
166
|
+
fromTokenAddress: {
|
|
167
|
+
format: (route, { beforeResult }) => beforeResult.fromTokenAddress,
|
|
168
|
+
},
|
|
169
|
+
toTokenAddress: {
|
|
170
|
+
format: (route, { beforeResult }) => beforeResult.toTokenAddress,
|
|
171
|
+
},
|
|
172
|
+
message: {
|
|
173
|
+
format: (route, { crossChainParamsData }) => {
|
|
174
|
+
return crossChainParamsData.message;
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
isNative: {
|
|
178
|
+
format: (route, { crossChainParamsData }) => crossChainParamsData.fromTokenAddress === NATIVE_PLACEHOLDER,
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
// Get Status Interface (required)
|
|
184
|
+
status: {
|
|
185
|
+
url: `${vercelApiHost}/api/deposit/status`,
|
|
186
|
+
method: 'get',
|
|
187
|
+
after: (err, res) => {
|
|
188
|
+
if (!err) {
|
|
189
|
+
return res;
|
|
190
|
+
}
|
|
191
|
+
if (err instanceof AxiosError) {
|
|
192
|
+
if (err.response?.status === 404) {
|
|
193
|
+
return {
|
|
194
|
+
toHash: '',
|
|
195
|
+
statusInfo: {
|
|
196
|
+
status: 'PENDING',
|
|
197
|
+
message: 'PENDING',
|
|
198
|
+
bridgeResponseResult: {},
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
throw err;
|
|
204
|
+
},
|
|
205
|
+
requestAfter: (res) => res,
|
|
206
|
+
requestMapping: {
|
|
207
|
+
depositTxHash: 'fromHash',
|
|
208
|
+
originChainId: 'fromChainId',
|
|
209
|
+
},
|
|
210
|
+
responseMapping: {
|
|
211
|
+
toHash: {
|
|
212
|
+
format: (resResult) => {
|
|
213
|
+
const isFilled = resResult.status === 'filled';
|
|
214
|
+
if (!isFilled) {
|
|
215
|
+
return '';
|
|
216
|
+
}
|
|
217
|
+
return resResult.fillTx;
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
statusInfo: {
|
|
221
|
+
format: (resResult) => {
|
|
222
|
+
const data = {
|
|
223
|
+
status: 'PENDING',
|
|
224
|
+
bridgeResponseResult: resResult,
|
|
225
|
+
};
|
|
226
|
+
if (resResult.status === 'filled') {
|
|
227
|
+
data.status = 'DONE';
|
|
228
|
+
}
|
|
229
|
+
else if (resResult.status === 'expired') {
|
|
230
|
+
data.status = 'FAILED';
|
|
231
|
+
}
|
|
232
|
+
else if (resResult.status === 'refunded') {
|
|
233
|
+
data.status = 'TRANSFER_REFUNDED';
|
|
234
|
+
}
|
|
235
|
+
return data;
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
// get information on tokens supporting cross chain transactions (required)
|
|
241
|
+
tokenList: {
|
|
242
|
+
url: `${vercelApiHost}/api/token-list`,
|
|
243
|
+
method: 'get',
|
|
244
|
+
requestAfter: (res) => res,
|
|
245
|
+
responseMapping: {
|
|
246
|
+
tokens: {
|
|
247
|
+
format: (tokenList) => {
|
|
248
|
+
return tokenList.flatMap((item) => {
|
|
249
|
+
return {
|
|
250
|
+
chainId: item.chainId,
|
|
251
|
+
address: item.address,
|
|
252
|
+
name: item.name,
|
|
253
|
+
symbol: item.symbol,
|
|
254
|
+
decimals: item.decimals,
|
|
255
|
+
logoImg: item.logoURI,
|
|
256
|
+
};
|
|
257
|
+
});
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
buildTransactionData: {
|
|
263
|
+
// API to generate onchain transaction data. If "Route" API doesn't return "transactionData", need to provide this API (optional)
|
|
264
|
+
url: `${vercelApiHost}/api/build-deposit-tx`,
|
|
265
|
+
method: 'get',
|
|
266
|
+
requestAfter: (res) => {
|
|
267
|
+
return res;
|
|
268
|
+
},
|
|
269
|
+
requestMapping: {
|
|
270
|
+
inputAmount: 'fromAmount',
|
|
271
|
+
outputAmount: 'toAmount',
|
|
272
|
+
inputToken: {
|
|
273
|
+
format: (params) => params.fromTokenAddress === NATIVE_PLACEHOLDER
|
|
274
|
+
? getWrappedNative(params.fromChainId).address
|
|
275
|
+
: params.fromTokenAddress,
|
|
276
|
+
},
|
|
277
|
+
outputToken: {
|
|
278
|
+
format: (params) => params.toTokenAddress === NATIVE_PLACEHOLDER
|
|
279
|
+
? getWrappedNative(params.toChainId).address
|
|
280
|
+
: params.toTokenAddress,
|
|
281
|
+
},
|
|
282
|
+
destinationChainId: 'toChainId',
|
|
283
|
+
originChainId: 'fromChainId',
|
|
284
|
+
recipient: 'toAddress',
|
|
285
|
+
depositor: 'fromAddress',
|
|
286
|
+
quoteTimestamp: {
|
|
287
|
+
format: (_, { interfaceParamData }) => interfaceParamData.quoteTimestamp,
|
|
288
|
+
},
|
|
289
|
+
isNative: {
|
|
290
|
+
format: (_, { interfaceParamData }) => interfaceParamData.isNative,
|
|
291
|
+
},
|
|
292
|
+
message: {
|
|
293
|
+
format: (_, { interfaceParamData }) => interfaceParamData.message,
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
responseMapping: {
|
|
297
|
+
data: {
|
|
298
|
+
format: (resData, { crossChainParamsData }) => {
|
|
299
|
+
if (crossChainParamsData.referrer) {
|
|
300
|
+
return concat([
|
|
301
|
+
resData.data,
|
|
302
|
+
'0xd00dfeeddeadbeef',
|
|
303
|
+
crossChainParamsData.referrer,
|
|
304
|
+
]);
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
return resData.data;
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
value: 'value',
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
errorCodes, // errors status code
|
|
316
|
+
};
|
|
317
|
+
export default acrossConfig;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
export declare const AXELAR_GAS_SERVICE_ABI: ({
|
|
2
|
+
inputs: {
|
|
3
|
+
internalType: string;
|
|
4
|
+
name: string;
|
|
5
|
+
type: string;
|
|
6
|
+
}[];
|
|
7
|
+
stateMutability: string;
|
|
8
|
+
type: string;
|
|
9
|
+
name?: undefined;
|
|
10
|
+
anonymous?: undefined;
|
|
11
|
+
outputs?: undefined;
|
|
12
|
+
} | {
|
|
13
|
+
inputs: {
|
|
14
|
+
internalType: string;
|
|
15
|
+
name: string;
|
|
16
|
+
type: string;
|
|
17
|
+
}[];
|
|
18
|
+
name: string;
|
|
19
|
+
type: string;
|
|
20
|
+
stateMutability?: undefined;
|
|
21
|
+
anonymous?: undefined;
|
|
22
|
+
outputs?: undefined;
|
|
23
|
+
} | {
|
|
24
|
+
anonymous: boolean;
|
|
25
|
+
inputs: ({
|
|
26
|
+
indexed: boolean;
|
|
27
|
+
internalType: string;
|
|
28
|
+
name: string;
|
|
29
|
+
type: string;
|
|
30
|
+
components?: undefined;
|
|
31
|
+
} | {
|
|
32
|
+
components: {
|
|
33
|
+
internalType: string;
|
|
34
|
+
name: string;
|
|
35
|
+
type: string;
|
|
36
|
+
}[];
|
|
37
|
+
indexed: boolean;
|
|
38
|
+
internalType: string;
|
|
39
|
+
name: string;
|
|
40
|
+
type: string;
|
|
41
|
+
})[];
|
|
42
|
+
name: string;
|
|
43
|
+
type: string;
|
|
44
|
+
stateMutability?: undefined;
|
|
45
|
+
outputs?: undefined;
|
|
46
|
+
} | {
|
|
47
|
+
inputs: {
|
|
48
|
+
internalType: string;
|
|
49
|
+
name: string;
|
|
50
|
+
type: string;
|
|
51
|
+
}[];
|
|
52
|
+
name: string;
|
|
53
|
+
outputs: {
|
|
54
|
+
internalType: string;
|
|
55
|
+
name: string;
|
|
56
|
+
type: string;
|
|
57
|
+
}[];
|
|
58
|
+
stateMutability: string;
|
|
59
|
+
type: string;
|
|
60
|
+
anonymous?: undefined;
|
|
61
|
+
} | {
|
|
62
|
+
inputs: {
|
|
63
|
+
internalType: string;
|
|
64
|
+
name: string;
|
|
65
|
+
type: string;
|
|
66
|
+
}[];
|
|
67
|
+
name: string;
|
|
68
|
+
outputs: {
|
|
69
|
+
components: {
|
|
70
|
+
internalType: string;
|
|
71
|
+
name: string;
|
|
72
|
+
type: string;
|
|
73
|
+
}[];
|
|
74
|
+
internalType: string;
|
|
75
|
+
name: string;
|
|
76
|
+
type: string;
|
|
77
|
+
}[];
|
|
78
|
+
stateMutability: string;
|
|
79
|
+
type: string;
|
|
80
|
+
anonymous?: undefined;
|
|
81
|
+
} | {
|
|
82
|
+
inputs: ({
|
|
83
|
+
internalType: string;
|
|
84
|
+
name: string;
|
|
85
|
+
type: string;
|
|
86
|
+
components?: undefined;
|
|
87
|
+
} | {
|
|
88
|
+
components: {
|
|
89
|
+
internalType: string;
|
|
90
|
+
name: string;
|
|
91
|
+
type: string;
|
|
92
|
+
}[];
|
|
93
|
+
internalType: string;
|
|
94
|
+
name: string;
|
|
95
|
+
type: string;
|
|
96
|
+
})[];
|
|
97
|
+
name: string;
|
|
98
|
+
outputs: never[];
|
|
99
|
+
stateMutability: string;
|
|
100
|
+
type: string;
|
|
101
|
+
anonymous?: undefined;
|
|
102
|
+
})[];
|
|
103
|
+
//# sourceMappingURL=AxelarGasService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AxelarGasService.d.ts","sourceRoot":"","sources":["../../../../src/configs/axelar/abis/AxelarGasService.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgjClC,CAAA"}
|