@paraswap/dex-lib 3.4.2-balancer-v2-single-swap.0 → 3.4.2
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/README.md +377 -377
- package/build/config.js +9 -5
- package/build/config.js.map +1 -1
- package/build/dex/algebra/algebra.js +25 -25
- package/build/dex/balancer-v1/balancer-v1.js +34 -34
- package/build/dex/balancer-v2/balancer-v2.d.ts +1 -1
- package/build/dex/balancer-v2/balancer-v2.js +65 -78
- package/build/dex/balancer-v2/balancer-v2.js.map +1 -1
- package/build/dex/camelot/camelot.js +27 -27
- package/build/dex/kyberdmm/kyberdmm.js +27 -27
- package/build/dex/pancakeswap-v3/pancakeswap-v3.js +25 -25
- package/build/dex/solidly/solidly.js +27 -27
- package/build/dex/solidly-v3/solidly-v3.js +25 -25
- package/build/dex/swaap-v2/config.js +15 -0
- package/build/dex/swaap-v2/config.js.map +1 -1
- package/build/dex/uniswap-v2/uniswap-v2.js +26 -26
- package/build/dex/uniswap-v3/uniswap-v3.js +25 -25
- package/funding.json +5 -5
- package/package.json +1 -1
- package/src/config.ts +500 -496
- package/src/constants.ts +67 -67
- package/src/dex/aave-v2/aave-v2.ts +409 -409
- package/src/dex/aave-v3/aave-v3.ts +320 -320
- package/src/dex/algebra/algebra.ts +1180 -1180
- package/src/dex/angle-staked-stable/angle-staked-stable.ts +347 -347
- package/src/dex/augustus-rfq.ts +180 -180
- package/src/dex/bProtocol/bProtocol.ts +108 -108
- package/src/dex/balancer-v1/balancer-v1.ts +572 -572
- package/src/dex/balancer-v2/balancer-v2-e2e.test.ts +1699 -1699
- package/src/dex/balancer-v2/balancer-v2.ts +1669 -1701
- package/src/dex/bancor/bancor.ts +128 -128
- package/src/dex/camelot/camelot.ts +873 -873
- package/src/dex/compound/compound.ts +107 -107
- package/src/dex/curve-v1/config.ts +1179 -1179
- package/src/dex/curve-v1/curve-v1-e2e.test.ts +507 -507
- package/src/dex/curve-v1/curve-v1.ts +1315 -1315
- package/src/dex/curve-v1-factory/config.ts +1018 -1018
- package/src/dex/curve-v1-factory/curve-v1-factory.ts +1288 -1288
- package/src/dex/curve-v2/curve-v2.ts +440 -440
- package/src/dex/dexalot/dexalot.ts +1100 -1100
- package/src/dex/dodo-v1/dodo-v1.ts +132 -132
- package/src/dex/dodo-v2.ts +266 -266
- package/src/dex/etherfi.ts +239 -239
- package/src/dex/generic-rfq/generic-rfq.ts +431 -431
- package/src/dex/gmx/gmx.ts +321 -321
- package/src/dex/hashflow/hashflow.ts +1135 -1135
- package/src/dex/idex.ts +254 -254
- package/src/dex/index.ts +357 -357
- package/src/dex/jarvis-v6/jarvis-v6.ts +509 -509
- package/src/dex/jarvis.ts +262 -262
- package/src/dex/kyberdmm/kyberdmm.ts +649 -649
- package/src/dex/lido/lido.ts +110 -110
- package/src/dex/maker-psm/maker-psm.ts +592 -592
- package/src/dex/maverick-v1/maverick-v1.ts +537 -537
- package/src/dex/nerve/config.ts +635 -635
- package/src/dex/nerve/nerve-e2e.test.ts +731 -731
- package/src/dex/nerve/nerve-events.test.ts +911 -911
- package/src/dex/nerve/nerve.ts +467 -467
- package/src/dex/onebit/onebit.ts +113 -113
- package/src/dex/pancakeswap-v3/pancakeswap-v3.ts +1150 -1150
- package/src/dex/paraswap-limit-orders/config.ts +60 -60
- package/src/dex/paraswap-limit-orders/paraswap-limit-orders-e2e.test.ts +137 -137
- package/src/dex/paraswap-limit-orders/paraswap-limit-orders-integration.test.ts +328 -328
- package/src/dex/paraswap-limit-orders/paraswap-limit-orders.ts +631 -631
- package/src/dex/polygon-migrator/polygon-migrator.ts +194 -194
- package/src/dex/quick-perps/quick-perps.ts +337 -337
- package/src/dex/quickswap/config.ts +16 -16
- package/src/dex/quickswap/quickswap-e2e.test.ts +384 -384
- package/src/dex/smoothy/smoothy.ts +110 -110
- package/src/dex/solidly/config.ts +225 -225
- package/src/dex/solidly/solidly-e2e.test.ts +1421 -1421
- package/src/dex/solidly/solidly-integration.test.ts +1753 -1753
- package/src/dex/solidly/solidly.ts +687 -687
- package/src/dex/solidly-v3/solidly-v3.ts +968 -968
- package/src/dex/spark/spark.ts +284 -284
- package/src/dex/stable-pool/stable-pool.ts +129 -129
- package/src/dex/swaap-v2/config.ts +15 -0
- package/src/dex/swaap-v2/swaap-v2-e2e.test.ts +233 -17
- package/src/dex/swaap-v2/swaap-v2-integration.test.ts +1 -1
- package/src/dex/swaap-v2/swaap-v2.ts +1056 -1056
- package/src/dex/swell/swell.ts +312 -312
- package/src/dex/synthetix/synthetix.ts +420 -420
- package/src/dex/trader-joe-v2.1/trader-joe-v2.1.ts +180 -180
- package/src/dex/uniswap-v2/config.ts +637 -637
- package/src/dex/uniswap-v2/constants.ts +58 -58
- package/src/dex/uniswap-v2/uniswap-v2-e2e-avalanche.test.ts +1257 -1257
- package/src/dex/uniswap-v2/uniswap-v2-e2e-base.test.ts +42 -42
- package/src/dex/uniswap-v2/uniswap-v2-e2e-bsc.test.ts +1295 -1295
- package/src/dex/uniswap-v2/uniswap-v2-e2e-mainnet.test.ts +1834 -1834
- package/src/dex/uniswap-v2/uniswap-v2-e2e-polygon.test.ts +871 -871
- package/src/dex/uniswap-v2/uniswap-v2.ts +1117 -1117
- package/src/dex/uniswap-v3/uniswap-v3.ts +1501 -1501
- package/src/dex/uniswap-v3.ts +242 -242
- package/src/dex/weth/config.ts +73 -73
- package/src/dex/weth/weth.ts +230 -230
- package/src/dex/wombat/wombat.ts +467 -467
- package/src/dex/woo-fi-v2/woo-fi-v2.ts +529 -529
- package/src/dex/wsteth/wsteth.ts +304 -304
- package/src/dex/zerox/index.ts +328 -328
- package/src/executor/Executor01BytecodeBuilder.ts +474 -474
- package/src/executor/Executor02BytecodeBuilder.ts +1392 -1392
- package/src/executor/ExecutorBytecodeBuilder.ts +390 -390
- package/src/executor/ExecutorDetector.ts +131 -131
- package/src/executor/constants.ts +66 -66
- package/src/executor/executor01-bytecode-builder-e2e.test.ts +1478 -1478
- package/src/executor/utils.ts +62 -62
- package/src/router/simpleswap.ts +366 -366
- package/src/types.ts +342 -342
- package/tests/constants-e2e.ts +1632 -1622
- package/tests/generate-new-limit-order.ts +107 -107
package/src/types.ts
CHANGED
|
@@ -1,342 +1,342 @@
|
|
|
1
|
-
import { Address, ParaSwapVersion } from '@paraswap/core';
|
|
2
|
-
export { BlockHeader } from 'web3-eth';
|
|
3
|
-
export {
|
|
4
|
-
Address,
|
|
5
|
-
NumberAsString,
|
|
6
|
-
Adapters,
|
|
7
|
-
OptimalRoute,
|
|
8
|
-
OptimalSwap,
|
|
9
|
-
OptimalSwapExchange,
|
|
10
|
-
OptionalRate,
|
|
11
|
-
OptimalRate,
|
|
12
|
-
} from '@paraswap/core';
|
|
13
|
-
import { Logger } from 'log4js';
|
|
14
|
-
export { Logger } from 'log4js';
|
|
15
|
-
import { OptimalRate } from '@paraswap/core';
|
|
16
|
-
import BigNumber from 'bignumber.js';
|
|
17
|
-
import { RFQConfig } from './dex/generic-rfq/types';
|
|
18
|
-
import { Executors, Flag, SpecialDex } from './executor/types';
|
|
19
|
-
|
|
20
|
-
// Check: Should the logger be replaced with Logger Interface
|
|
21
|
-
export type LoggerConstructor = (name?: string) => Logger;
|
|
22
|
-
|
|
23
|
-
export type ContractSellData = {
|
|
24
|
-
fromToken: string;
|
|
25
|
-
fromAmount: string;
|
|
26
|
-
toAmount: string;
|
|
27
|
-
expectedAmount: string;
|
|
28
|
-
beneficiary: string;
|
|
29
|
-
path: ContractPath[];
|
|
30
|
-
partner: string;
|
|
31
|
-
feePercent: string;
|
|
32
|
-
permit: string;
|
|
33
|
-
deadline: string;
|
|
34
|
-
uuid: string;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export type ContractMegaSwapSellData = {
|
|
38
|
-
fromToken: string;
|
|
39
|
-
fromAmount: string;
|
|
40
|
-
toAmount: string;
|
|
41
|
-
expectedAmount: string;
|
|
42
|
-
beneficiary: string;
|
|
43
|
-
path: ContractMegaSwapPath[];
|
|
44
|
-
partner: string;
|
|
45
|
-
feePercent: string;
|
|
46
|
-
permit: string;
|
|
47
|
-
deadline: string;
|
|
48
|
-
uuid: string;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export type ContractBuyData = {
|
|
52
|
-
adapter: string;
|
|
53
|
-
fromToken: string;
|
|
54
|
-
toToken: string;
|
|
55
|
-
fromAmount: string;
|
|
56
|
-
toAmount: string;
|
|
57
|
-
expectedAmount: string;
|
|
58
|
-
beneficiary: string;
|
|
59
|
-
route: ContractRoute[];
|
|
60
|
-
partner: string;
|
|
61
|
-
feePercent: string;
|
|
62
|
-
permit: string;
|
|
63
|
-
deadline: string;
|
|
64
|
-
uuid: string;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
export type ConstractSimpleData = {
|
|
68
|
-
fromToken: string;
|
|
69
|
-
toToken: string;
|
|
70
|
-
fromAmount: string;
|
|
71
|
-
toAmount: string;
|
|
72
|
-
expectedAmount: string;
|
|
73
|
-
callees: string[];
|
|
74
|
-
exchangeData: string;
|
|
75
|
-
startIndexes: number[];
|
|
76
|
-
values: string[];
|
|
77
|
-
beneficiary: string;
|
|
78
|
-
partner: string;
|
|
79
|
-
feePercent: string;
|
|
80
|
-
permit: string;
|
|
81
|
-
deadline: string;
|
|
82
|
-
uuid: string;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export type ContractSimpleBuyNFTData = {
|
|
86
|
-
fromToken: string;
|
|
87
|
-
toTokenDetails: {
|
|
88
|
-
toToken: string;
|
|
89
|
-
toTokenID: string;
|
|
90
|
-
toAmount: string;
|
|
91
|
-
}[];
|
|
92
|
-
fromAmount: string;
|
|
93
|
-
expectedAmount: string;
|
|
94
|
-
callees: string[];
|
|
95
|
-
exchangeData: string;
|
|
96
|
-
startIndexes: number[];
|
|
97
|
-
values: string[];
|
|
98
|
-
beneficiary: string;
|
|
99
|
-
partner: string;
|
|
100
|
-
feePercent: string;
|
|
101
|
-
permit: string;
|
|
102
|
-
deadline: string;
|
|
103
|
-
uuid: string;
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
export type ContractAdapter = {
|
|
107
|
-
adapter: string;
|
|
108
|
-
percent: string;
|
|
109
|
-
networkFee: string;
|
|
110
|
-
route: ContractRoute[];
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
export type ContractRoute = {
|
|
114
|
-
index: number;
|
|
115
|
-
targetExchange: string;
|
|
116
|
-
percent: string;
|
|
117
|
-
payload: string;
|
|
118
|
-
networkFee: string;
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
export type ContractMegaSwapPath = {
|
|
122
|
-
fromAmountPercent: string;
|
|
123
|
-
path: ContractPath[];
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
export type ContractPath = {
|
|
127
|
-
to: string;
|
|
128
|
-
totalNetworkFee: string;
|
|
129
|
-
adapters: ContractAdapter[];
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
export type ContractBuyAdapter = {
|
|
133
|
-
adapter: string;
|
|
134
|
-
payload: string;
|
|
135
|
-
networkFee: string;
|
|
136
|
-
route: ContractBuyRoute[];
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
export type ContractBuyRoute = {
|
|
140
|
-
index: number;
|
|
141
|
-
targetExchange: string;
|
|
142
|
-
fromAmount: string;
|
|
143
|
-
toAmount: string;
|
|
144
|
-
payload: string;
|
|
145
|
-
networkFee: string;
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
export type TxInfo<T> = {
|
|
149
|
-
params: T;
|
|
150
|
-
encoder: ContractMethodEncoder;
|
|
151
|
-
networkFee: string;
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
export type AdapterExchangeParam = {
|
|
155
|
-
targetExchange: Address;
|
|
156
|
-
payload: string;
|
|
157
|
-
networkFee: string;
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
export type DexExchangeParam = {
|
|
161
|
-
needWrapNative: boolean;
|
|
162
|
-
wethAddress?: string;
|
|
163
|
-
exchangeData: string;
|
|
164
|
-
targetExchange: string;
|
|
165
|
-
dexFuncHasRecipient: boolean;
|
|
166
|
-
specialDexFlag?: SpecialDex;
|
|
167
|
-
transferSrcTokenBeforeSwap?: Address;
|
|
168
|
-
spender?: Address;
|
|
169
|
-
sendEthButSupportsInsertFromAmount?: boolean;
|
|
170
|
-
specialDexSupportsInsertFromAmount?: boolean;
|
|
171
|
-
swappedAmountNotPresentInExchangeData?: boolean;
|
|
172
|
-
preSwapUnwrapCalldata?: string;
|
|
173
|
-
returnAmountPos: number | undefined;
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
export type DexExchangeBuildParam = DexExchangeParam & {
|
|
177
|
-
approveData?: {
|
|
178
|
-
target: Address;
|
|
179
|
-
token: Address;
|
|
180
|
-
};
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
export type AdapterMappings = {
|
|
184
|
-
[side: string]: { name: string; index: number }[];
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
export type SimpleExchangeParam = {
|
|
188
|
-
callees: string[];
|
|
189
|
-
calldata: string[];
|
|
190
|
-
values: string[];
|
|
191
|
-
networkFee: string;
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
// TODO: fix the type
|
|
195
|
-
export type ContractMethodEncoder = (...args: any[]) => any;
|
|
196
|
-
|
|
197
|
-
export type Token = {
|
|
198
|
-
address: string;
|
|
199
|
-
decimals: number;
|
|
200
|
-
symbol?: string;
|
|
201
|
-
type?: string;
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
export type aToken = {
|
|
205
|
-
aSymbol: string;
|
|
206
|
-
aAddress: string;
|
|
207
|
-
address: string;
|
|
208
|
-
decimals: number;
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
export type ExchangePrices<T> = PoolPrices<T>[];
|
|
212
|
-
|
|
213
|
-
export type PoolPrices<T> = {
|
|
214
|
-
prices: bigint[];
|
|
215
|
-
unit: bigint;
|
|
216
|
-
data: T;
|
|
217
|
-
poolIdentifier?: string;
|
|
218
|
-
exchange: string;
|
|
219
|
-
gasCost: number | number[];
|
|
220
|
-
gasCostL2?: number | number[];
|
|
221
|
-
poolAddresses?: Array<Address>;
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
export type PoolLiquidity = {
|
|
225
|
-
exchange: string;
|
|
226
|
-
address: Address;
|
|
227
|
-
connectorTokens: Token[];
|
|
228
|
-
liquidityUSD: number;
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
export interface Log {
|
|
232
|
-
address: string;
|
|
233
|
-
data: string;
|
|
234
|
-
topics: string[];
|
|
235
|
-
logIndex: number;
|
|
236
|
-
transactionIndex: number;
|
|
237
|
-
transactionHash: string;
|
|
238
|
-
blockHash: string;
|
|
239
|
-
blockNumber: number;
|
|
240
|
-
|
|
241
|
-
// The following are not declared in web3-core, but still appear in logs
|
|
242
|
-
removed?: boolean;
|
|
243
|
-
id?: string;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
export type DexConfigMap<DexParams> = {
|
|
247
|
-
[dexKey: string]: {
|
|
248
|
-
[network: number]: DexParams;
|
|
249
|
-
};
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
export type TxObject = {
|
|
253
|
-
from: Address;
|
|
254
|
-
to?: Address; // undefined in case of contract deployment
|
|
255
|
-
value: string;
|
|
256
|
-
data: string;
|
|
257
|
-
gasPrice?: string;
|
|
258
|
-
maxFeePerGas?: string;
|
|
259
|
-
maxPriorityFeePerGas?: string;
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
export type StateOverrideObject = {
|
|
263
|
-
storage: Record<string, Record<string, string>>;
|
|
264
|
-
};
|
|
265
|
-
|
|
266
|
-
export type UnoptimizedRate = Omit<
|
|
267
|
-
OptimalRate,
|
|
268
|
-
'contractMethod' | 'srcUSD' | 'destUSD' | 'hmac' | 'partnerFee'
|
|
269
|
-
>;
|
|
270
|
-
|
|
271
|
-
export type MultiCallInput = {
|
|
272
|
-
target: Address;
|
|
273
|
-
callData: string;
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
export type MultiCallOutput = string;
|
|
277
|
-
|
|
278
|
-
export type Config = {
|
|
279
|
-
network: number;
|
|
280
|
-
networkName: string;
|
|
281
|
-
isTestnet: boolean;
|
|
282
|
-
mainnetNetwork?: number;
|
|
283
|
-
nativeTokenName: string;
|
|
284
|
-
nativeTokenSymbol: string;
|
|
285
|
-
wrappedNativeTokenName: string;
|
|
286
|
-
wrappedNativeTokenSymbol: string;
|
|
287
|
-
wrappedNativeTokenAddress: Address;
|
|
288
|
-
hasEIP1559: boolean;
|
|
289
|
-
augustusAddress: Address;
|
|
290
|
-
augustusV6Address?: Address;
|
|
291
|
-
augustusRFQAddress: Address;
|
|
292
|
-
tokenTransferProxyAddress: Address;
|
|
293
|
-
multicallV2Address: Address;
|
|
294
|
-
privateHttpProvider: string;
|
|
295
|
-
adapterAddresses: { [name: string]: Address };
|
|
296
|
-
executorsAddresses?: { [name: string]: Address };
|
|
297
|
-
uniswapV2ExchangeRouterAddress: Address;
|
|
298
|
-
rfqConfigs: Record<string, RFQConfig>;
|
|
299
|
-
rpcPollingMaxAllowedStateDelayInBlocks: number;
|
|
300
|
-
rpcPollingBlocksBackToTriggerUpdate: number;
|
|
301
|
-
hashFlowAuthToken?: string;
|
|
302
|
-
hashFlowDisabledMMs: string[];
|
|
303
|
-
uniswapV3EventLoggingSampleRate?: number;
|
|
304
|
-
swaapV2AuthToken?: string;
|
|
305
|
-
dexalotAuthToken?: string;
|
|
306
|
-
forceRpcFallbackDexs: string[];
|
|
307
|
-
};
|
|
308
|
-
|
|
309
|
-
export type BigIntAsString = string;
|
|
310
|
-
|
|
311
|
-
export type ExchangeTxInfo = {
|
|
312
|
-
deadline?: bigint;
|
|
313
|
-
};
|
|
314
|
-
|
|
315
|
-
export type PreprocessTransactionOptions = {
|
|
316
|
-
slippageFactor: BigNumber;
|
|
317
|
-
txOrigin: Address;
|
|
318
|
-
executionContractAddress: Address;
|
|
319
|
-
hmac?: string;
|
|
320
|
-
mockRfqAndLO?: boolean;
|
|
321
|
-
isDirectMethod?: boolean;
|
|
322
|
-
partner?: string;
|
|
323
|
-
recipient: string;
|
|
324
|
-
version: ParaSwapVersion;
|
|
325
|
-
special?: boolean;
|
|
326
|
-
};
|
|
327
|
-
|
|
328
|
-
export type TransferFeeParams = {
|
|
329
|
-
srcFee: number;
|
|
330
|
-
destFee: number;
|
|
331
|
-
srcDexFee: number;
|
|
332
|
-
destDexFee: number;
|
|
333
|
-
};
|
|
334
|
-
|
|
335
|
-
export type TransferFeeParamsForRoute = {
|
|
336
|
-
srcTokenTransferFee: number;
|
|
337
|
-
destTokenTransferFee: number;
|
|
338
|
-
srcTokenDexTransferFee: number;
|
|
339
|
-
destTokenDexTransferFee: number;
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
export type LogLevels = 'info' | 'warn' | 'error' | 'trace' | 'debug';
|
|
1
|
+
import { Address, ParaSwapVersion } from '@paraswap/core';
|
|
2
|
+
export { BlockHeader } from 'web3-eth';
|
|
3
|
+
export {
|
|
4
|
+
Address,
|
|
5
|
+
NumberAsString,
|
|
6
|
+
Adapters,
|
|
7
|
+
OptimalRoute,
|
|
8
|
+
OptimalSwap,
|
|
9
|
+
OptimalSwapExchange,
|
|
10
|
+
OptionalRate,
|
|
11
|
+
OptimalRate,
|
|
12
|
+
} from '@paraswap/core';
|
|
13
|
+
import { Logger } from 'log4js';
|
|
14
|
+
export { Logger } from 'log4js';
|
|
15
|
+
import { OptimalRate } from '@paraswap/core';
|
|
16
|
+
import BigNumber from 'bignumber.js';
|
|
17
|
+
import { RFQConfig } from './dex/generic-rfq/types';
|
|
18
|
+
import { Executors, Flag, SpecialDex } from './executor/types';
|
|
19
|
+
|
|
20
|
+
// Check: Should the logger be replaced with Logger Interface
|
|
21
|
+
export type LoggerConstructor = (name?: string) => Logger;
|
|
22
|
+
|
|
23
|
+
export type ContractSellData = {
|
|
24
|
+
fromToken: string;
|
|
25
|
+
fromAmount: string;
|
|
26
|
+
toAmount: string;
|
|
27
|
+
expectedAmount: string;
|
|
28
|
+
beneficiary: string;
|
|
29
|
+
path: ContractPath[];
|
|
30
|
+
partner: string;
|
|
31
|
+
feePercent: string;
|
|
32
|
+
permit: string;
|
|
33
|
+
deadline: string;
|
|
34
|
+
uuid: string;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type ContractMegaSwapSellData = {
|
|
38
|
+
fromToken: string;
|
|
39
|
+
fromAmount: string;
|
|
40
|
+
toAmount: string;
|
|
41
|
+
expectedAmount: string;
|
|
42
|
+
beneficiary: string;
|
|
43
|
+
path: ContractMegaSwapPath[];
|
|
44
|
+
partner: string;
|
|
45
|
+
feePercent: string;
|
|
46
|
+
permit: string;
|
|
47
|
+
deadline: string;
|
|
48
|
+
uuid: string;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export type ContractBuyData = {
|
|
52
|
+
adapter: string;
|
|
53
|
+
fromToken: string;
|
|
54
|
+
toToken: string;
|
|
55
|
+
fromAmount: string;
|
|
56
|
+
toAmount: string;
|
|
57
|
+
expectedAmount: string;
|
|
58
|
+
beneficiary: string;
|
|
59
|
+
route: ContractRoute[];
|
|
60
|
+
partner: string;
|
|
61
|
+
feePercent: string;
|
|
62
|
+
permit: string;
|
|
63
|
+
deadline: string;
|
|
64
|
+
uuid: string;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export type ConstractSimpleData = {
|
|
68
|
+
fromToken: string;
|
|
69
|
+
toToken: string;
|
|
70
|
+
fromAmount: string;
|
|
71
|
+
toAmount: string;
|
|
72
|
+
expectedAmount: string;
|
|
73
|
+
callees: string[];
|
|
74
|
+
exchangeData: string;
|
|
75
|
+
startIndexes: number[];
|
|
76
|
+
values: string[];
|
|
77
|
+
beneficiary: string;
|
|
78
|
+
partner: string;
|
|
79
|
+
feePercent: string;
|
|
80
|
+
permit: string;
|
|
81
|
+
deadline: string;
|
|
82
|
+
uuid: string;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export type ContractSimpleBuyNFTData = {
|
|
86
|
+
fromToken: string;
|
|
87
|
+
toTokenDetails: {
|
|
88
|
+
toToken: string;
|
|
89
|
+
toTokenID: string;
|
|
90
|
+
toAmount: string;
|
|
91
|
+
}[];
|
|
92
|
+
fromAmount: string;
|
|
93
|
+
expectedAmount: string;
|
|
94
|
+
callees: string[];
|
|
95
|
+
exchangeData: string;
|
|
96
|
+
startIndexes: number[];
|
|
97
|
+
values: string[];
|
|
98
|
+
beneficiary: string;
|
|
99
|
+
partner: string;
|
|
100
|
+
feePercent: string;
|
|
101
|
+
permit: string;
|
|
102
|
+
deadline: string;
|
|
103
|
+
uuid: string;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export type ContractAdapter = {
|
|
107
|
+
adapter: string;
|
|
108
|
+
percent: string;
|
|
109
|
+
networkFee: string;
|
|
110
|
+
route: ContractRoute[];
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export type ContractRoute = {
|
|
114
|
+
index: number;
|
|
115
|
+
targetExchange: string;
|
|
116
|
+
percent: string;
|
|
117
|
+
payload: string;
|
|
118
|
+
networkFee: string;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export type ContractMegaSwapPath = {
|
|
122
|
+
fromAmountPercent: string;
|
|
123
|
+
path: ContractPath[];
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export type ContractPath = {
|
|
127
|
+
to: string;
|
|
128
|
+
totalNetworkFee: string;
|
|
129
|
+
adapters: ContractAdapter[];
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export type ContractBuyAdapter = {
|
|
133
|
+
adapter: string;
|
|
134
|
+
payload: string;
|
|
135
|
+
networkFee: string;
|
|
136
|
+
route: ContractBuyRoute[];
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export type ContractBuyRoute = {
|
|
140
|
+
index: number;
|
|
141
|
+
targetExchange: string;
|
|
142
|
+
fromAmount: string;
|
|
143
|
+
toAmount: string;
|
|
144
|
+
payload: string;
|
|
145
|
+
networkFee: string;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export type TxInfo<T> = {
|
|
149
|
+
params: T;
|
|
150
|
+
encoder: ContractMethodEncoder;
|
|
151
|
+
networkFee: string;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export type AdapterExchangeParam = {
|
|
155
|
+
targetExchange: Address;
|
|
156
|
+
payload: string;
|
|
157
|
+
networkFee: string;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export type DexExchangeParam = {
|
|
161
|
+
needWrapNative: boolean;
|
|
162
|
+
wethAddress?: string;
|
|
163
|
+
exchangeData: string;
|
|
164
|
+
targetExchange: string;
|
|
165
|
+
dexFuncHasRecipient: boolean;
|
|
166
|
+
specialDexFlag?: SpecialDex;
|
|
167
|
+
transferSrcTokenBeforeSwap?: Address;
|
|
168
|
+
spender?: Address;
|
|
169
|
+
sendEthButSupportsInsertFromAmount?: boolean;
|
|
170
|
+
specialDexSupportsInsertFromAmount?: boolean;
|
|
171
|
+
swappedAmountNotPresentInExchangeData?: boolean;
|
|
172
|
+
preSwapUnwrapCalldata?: string;
|
|
173
|
+
returnAmountPos: number | undefined;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export type DexExchangeBuildParam = DexExchangeParam & {
|
|
177
|
+
approveData?: {
|
|
178
|
+
target: Address;
|
|
179
|
+
token: Address;
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export type AdapterMappings = {
|
|
184
|
+
[side: string]: { name: string; index: number }[];
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export type SimpleExchangeParam = {
|
|
188
|
+
callees: string[];
|
|
189
|
+
calldata: string[];
|
|
190
|
+
values: string[];
|
|
191
|
+
networkFee: string;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
// TODO: fix the type
|
|
195
|
+
export type ContractMethodEncoder = (...args: any[]) => any;
|
|
196
|
+
|
|
197
|
+
export type Token = {
|
|
198
|
+
address: string;
|
|
199
|
+
decimals: number;
|
|
200
|
+
symbol?: string;
|
|
201
|
+
type?: string;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
export type aToken = {
|
|
205
|
+
aSymbol: string;
|
|
206
|
+
aAddress: string;
|
|
207
|
+
address: string;
|
|
208
|
+
decimals: number;
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
export type ExchangePrices<T> = PoolPrices<T>[];
|
|
212
|
+
|
|
213
|
+
export type PoolPrices<T> = {
|
|
214
|
+
prices: bigint[];
|
|
215
|
+
unit: bigint;
|
|
216
|
+
data: T;
|
|
217
|
+
poolIdentifier?: string;
|
|
218
|
+
exchange: string;
|
|
219
|
+
gasCost: number | number[];
|
|
220
|
+
gasCostL2?: number | number[];
|
|
221
|
+
poolAddresses?: Array<Address>;
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
export type PoolLiquidity = {
|
|
225
|
+
exchange: string;
|
|
226
|
+
address: Address;
|
|
227
|
+
connectorTokens: Token[];
|
|
228
|
+
liquidityUSD: number;
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
export interface Log {
|
|
232
|
+
address: string;
|
|
233
|
+
data: string;
|
|
234
|
+
topics: string[];
|
|
235
|
+
logIndex: number;
|
|
236
|
+
transactionIndex: number;
|
|
237
|
+
transactionHash: string;
|
|
238
|
+
blockHash: string;
|
|
239
|
+
blockNumber: number;
|
|
240
|
+
|
|
241
|
+
// The following are not declared in web3-core, but still appear in logs
|
|
242
|
+
removed?: boolean;
|
|
243
|
+
id?: string;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export type DexConfigMap<DexParams> = {
|
|
247
|
+
[dexKey: string]: {
|
|
248
|
+
[network: number]: DexParams;
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
export type TxObject = {
|
|
253
|
+
from: Address;
|
|
254
|
+
to?: Address; // undefined in case of contract deployment
|
|
255
|
+
value: string;
|
|
256
|
+
data: string;
|
|
257
|
+
gasPrice?: string;
|
|
258
|
+
maxFeePerGas?: string;
|
|
259
|
+
maxPriorityFeePerGas?: string;
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
export type StateOverrideObject = {
|
|
263
|
+
storage: Record<string, Record<string, string>>;
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
export type UnoptimizedRate = Omit<
|
|
267
|
+
OptimalRate,
|
|
268
|
+
'contractMethod' | 'srcUSD' | 'destUSD' | 'hmac' | 'partnerFee'
|
|
269
|
+
>;
|
|
270
|
+
|
|
271
|
+
export type MultiCallInput = {
|
|
272
|
+
target: Address;
|
|
273
|
+
callData: string;
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
export type MultiCallOutput = string;
|
|
277
|
+
|
|
278
|
+
export type Config = {
|
|
279
|
+
network: number;
|
|
280
|
+
networkName: string;
|
|
281
|
+
isTestnet: boolean;
|
|
282
|
+
mainnetNetwork?: number;
|
|
283
|
+
nativeTokenName: string;
|
|
284
|
+
nativeTokenSymbol: string;
|
|
285
|
+
wrappedNativeTokenName: string;
|
|
286
|
+
wrappedNativeTokenSymbol: string;
|
|
287
|
+
wrappedNativeTokenAddress: Address;
|
|
288
|
+
hasEIP1559: boolean;
|
|
289
|
+
augustusAddress: Address;
|
|
290
|
+
augustusV6Address?: Address;
|
|
291
|
+
augustusRFQAddress: Address;
|
|
292
|
+
tokenTransferProxyAddress: Address;
|
|
293
|
+
multicallV2Address: Address;
|
|
294
|
+
privateHttpProvider: string;
|
|
295
|
+
adapterAddresses: { [name: string]: Address };
|
|
296
|
+
executorsAddresses?: { [name: string]: Address };
|
|
297
|
+
uniswapV2ExchangeRouterAddress: Address;
|
|
298
|
+
rfqConfigs: Record<string, RFQConfig>;
|
|
299
|
+
rpcPollingMaxAllowedStateDelayInBlocks: number;
|
|
300
|
+
rpcPollingBlocksBackToTriggerUpdate: number;
|
|
301
|
+
hashFlowAuthToken?: string;
|
|
302
|
+
hashFlowDisabledMMs: string[];
|
|
303
|
+
uniswapV3EventLoggingSampleRate?: number;
|
|
304
|
+
swaapV2AuthToken?: string;
|
|
305
|
+
dexalotAuthToken?: string;
|
|
306
|
+
forceRpcFallbackDexs: string[];
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
export type BigIntAsString = string;
|
|
310
|
+
|
|
311
|
+
export type ExchangeTxInfo = {
|
|
312
|
+
deadline?: bigint;
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
export type PreprocessTransactionOptions = {
|
|
316
|
+
slippageFactor: BigNumber;
|
|
317
|
+
txOrigin: Address;
|
|
318
|
+
executionContractAddress: Address;
|
|
319
|
+
hmac?: string;
|
|
320
|
+
mockRfqAndLO?: boolean;
|
|
321
|
+
isDirectMethod?: boolean;
|
|
322
|
+
partner?: string;
|
|
323
|
+
recipient: string;
|
|
324
|
+
version: ParaSwapVersion;
|
|
325
|
+
special?: boolean;
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
export type TransferFeeParams = {
|
|
329
|
+
srcFee: number;
|
|
330
|
+
destFee: number;
|
|
331
|
+
srcDexFee: number;
|
|
332
|
+
destDexFee: number;
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
export type TransferFeeParamsForRoute = {
|
|
336
|
+
srcTokenTransferFee: number;
|
|
337
|
+
destTokenTransferFee: number;
|
|
338
|
+
srcTokenDexTransferFee: number;
|
|
339
|
+
destTokenDexTransferFee: number;
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
export type LogLevels = 'info' | 'warn' | 'error' | 'trace' | 'debug';
|