@xswap-link/sdk 0.0.4 → 0.0.5
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/CHANGELOG.md +6 -0
- package/dist/index.d.mts +320 -3
- package/dist/index.d.ts +320 -3
- package/dist/index.js +1558 -6
- package/dist/index.mjs +1543 -6
- package/index.ts +4 -1
- package/package.json +10 -9
- package/src/constants/index.ts +7 -0
- package/src/contracts/abi/ERC20.json +222 -0
- package/src/contracts/abi/XSwapRouter.json +1242 -0
- package/src/contracts/abi/index.ts +5 -0
- package/src/contracts/index.ts +1 -0
- package/src/models/ApiOverrides.ts +3 -0
- package/src/models/Chain.ts +14 -0
- package/src/models/CoinTypeAddress.ts +4 -0
- package/src/models/CollectFees.ts +4 -0
- package/src/models/ContractCall.ts +10 -0
- package/src/models/Ecosystem.ts +3 -0
- package/src/models/Environment.ts +5 -0
- package/src/models/Protocol.ts +6 -0
- package/src/models/Referral.ts +10 -0
- package/src/models/Route.ts +23 -0
- package/src/models/Token.ts +10 -0
- package/src/models/Web3Environment.ts +5 -0
- package/src/models/XSwapCallType.ts +6 -0
- package/src/models/XSwapFee.ts +4 -0
- package/src/models/XSwapFees.ts +7 -0
- package/src/models/index.ts +16 -0
- package/src/models/payloads/AddReferralPayload.ts +4 -0
- package/src/models/payloads/GetRoutePayload.ts +24 -0
- package/src/models/payloads/index.ts +2 -0
- package/src/services/api.ts +3 -5
- package/src/utils/bigNumbers.ts +7 -0
- package/src/utils/contracts.ts +19 -0
- package/src/utils/index.ts +2 -0
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,314 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { BigNumberish, BigNumber, ethers } from 'ethers';
|
|
2
|
+
import { TransactionRequest } from '@ethersproject/providers';
|
|
3
|
+
|
|
4
|
+
type ApiOverrides = {
|
|
5
|
+
apiUrl?: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
declare enum Web3Environment {
|
|
9
|
+
DEVNET = "devnet",
|
|
10
|
+
TESTNET = "testnet",
|
|
11
|
+
MAINNET = "mainnet"
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type Token = {
|
|
15
|
+
address: string;
|
|
16
|
+
name: string;
|
|
17
|
+
symbol: string;
|
|
18
|
+
decimals: number;
|
|
19
|
+
image: string;
|
|
20
|
+
priority: number;
|
|
21
|
+
quickPick?: boolean;
|
|
22
|
+
supported?: boolean;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
type Chain = {
|
|
26
|
+
ecosystem: string;
|
|
27
|
+
chainId: string;
|
|
28
|
+
name: string;
|
|
29
|
+
displayName: string;
|
|
30
|
+
web3Environment: Web3Environment;
|
|
31
|
+
transactionExplorer: string;
|
|
32
|
+
rpcUrls?: Array<string>;
|
|
33
|
+
ccipChainId: string;
|
|
34
|
+
tokens: Token[];
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
type CoinTypeAddress = {
|
|
38
|
+
coinType: number;
|
|
39
|
+
address: string;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
type CollectFees = {
|
|
43
|
+
integratorAddress: string;
|
|
44
|
+
fee: number;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
declare enum XSwapCallType {
|
|
48
|
+
DEFAULT = 0,
|
|
49
|
+
FULL_TOKEN_BALANCE = 1,
|
|
50
|
+
FULL_NATIVE_BALANCE = 2,
|
|
51
|
+
COLLECT_TOKEN_BALANCE = 3
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
type ContractCall = {
|
|
55
|
+
callType: XSwapCallType;
|
|
56
|
+
target: string;
|
|
57
|
+
value: string;
|
|
58
|
+
callData: string;
|
|
59
|
+
payload: string;
|
|
60
|
+
estimatedGas?: string;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
declare enum Ecosystem {
|
|
64
|
+
EVM = "evm"
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
declare enum Environment {
|
|
68
|
+
PROD = "production",
|
|
69
|
+
DEV = "develop",
|
|
70
|
+
LOCAL = "local"
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
type GetRoutePayload = {
|
|
74
|
+
fromChain: string;
|
|
75
|
+
toChain: string;
|
|
76
|
+
fromToken: string;
|
|
77
|
+
toToken: string;
|
|
78
|
+
fromAmount: string;
|
|
79
|
+
fromAddress: string;
|
|
80
|
+
toAddress: string;
|
|
81
|
+
paymentToken: string;
|
|
82
|
+
slippage: number;
|
|
83
|
+
expressDelivery: boolean;
|
|
84
|
+
quoteOnly?: boolean;
|
|
85
|
+
enableExpress?: boolean;
|
|
86
|
+
customContractCalls?: ContractCall[];
|
|
87
|
+
sourceChainDexes?: string[];
|
|
88
|
+
destinationChainDexes?: string[];
|
|
89
|
+
receiveGasOnDestination?: boolean;
|
|
90
|
+
collectFees?: CollectFees;
|
|
91
|
+
fallbackAddresses?: CoinTypeAddress[];
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
type AddReferralPayload = {
|
|
95
|
+
code: string;
|
|
96
|
+
address: string;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
type Protocol = {
|
|
100
|
+
name: string;
|
|
101
|
+
part: number;
|
|
102
|
+
fromTokenAddress: string;
|
|
103
|
+
toTokenAddress: string;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
type XSwapFee = {
|
|
107
|
+
tokenFee: string;
|
|
108
|
+
nativeFee: string;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
type XSwapFees = {
|
|
112
|
+
ccipFee: string;
|
|
113
|
+
xSwapFee: XSwapFee;
|
|
114
|
+
expressDeliveryFee: string;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
type Route = {
|
|
118
|
+
originChainXSwapCalls: ContractCall[];
|
|
119
|
+
originProtocols: Protocol[][][];
|
|
120
|
+
destinationChainXSwapCalls: ContractCall[];
|
|
121
|
+
destinationProtocols: Protocol[][][];
|
|
122
|
+
originCrossChainTransferToken: string;
|
|
123
|
+
destinationCrossChainTransferToken: string;
|
|
124
|
+
amountToTransferCrossChain: BigNumberish;
|
|
125
|
+
estAmountOut: string;
|
|
126
|
+
minAmountOut: string;
|
|
127
|
+
estimatedGasDestination: number;
|
|
128
|
+
transactions: {
|
|
129
|
+
approve: TransactionRequest;
|
|
130
|
+
swap: TransactionRequest;
|
|
131
|
+
};
|
|
132
|
+
xSwapFees: XSwapFees;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
type Referral = {
|
|
136
|
+
address: string;
|
|
137
|
+
code: string;
|
|
138
|
+
referrals: ReferralInfo[];
|
|
139
|
+
};
|
|
140
|
+
type ReferralInfo = {
|
|
141
|
+
address: string;
|
|
142
|
+
ipAddress: string;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
declare const DEFAULT_API_URL = "https://xswap.link/api";
|
|
146
|
+
declare const DEFAULT_DB_ERROR = "No data for provided parameters";
|
|
147
|
+
declare const DEFAULT_ECOSYSTEM = Ecosystem.EVM;
|
|
148
|
+
declare const DEFAULT_NATIVE_FEE_MULTIPLIER_PERCENTAGE = 105;
|
|
149
|
+
declare const DEFAULT_GAS_LIMIT_MULTIPLIER = 1.2;
|
|
150
|
+
|
|
151
|
+
declare const ERC20Abi: ({
|
|
152
|
+
constant: boolean;
|
|
153
|
+
inputs: {
|
|
154
|
+
name: string;
|
|
155
|
+
type: string;
|
|
156
|
+
}[];
|
|
157
|
+
name: string;
|
|
158
|
+
outputs: {
|
|
159
|
+
name: string;
|
|
160
|
+
type: string;
|
|
161
|
+
}[];
|
|
162
|
+
payable: boolean;
|
|
163
|
+
stateMutability: string;
|
|
164
|
+
type: string;
|
|
165
|
+
anonymous?: undefined;
|
|
166
|
+
} | {
|
|
167
|
+
payable: boolean;
|
|
168
|
+
stateMutability: string;
|
|
169
|
+
type: string;
|
|
170
|
+
constant?: undefined;
|
|
171
|
+
inputs?: undefined;
|
|
172
|
+
name?: undefined;
|
|
173
|
+
outputs?: undefined;
|
|
174
|
+
anonymous?: undefined;
|
|
175
|
+
} | {
|
|
176
|
+
anonymous: boolean;
|
|
177
|
+
inputs: {
|
|
178
|
+
indexed: boolean;
|
|
179
|
+
name: string;
|
|
180
|
+
type: string;
|
|
181
|
+
}[];
|
|
182
|
+
name: string;
|
|
183
|
+
type: string;
|
|
184
|
+
constant?: undefined;
|
|
185
|
+
outputs?: undefined;
|
|
186
|
+
payable?: undefined;
|
|
187
|
+
stateMutability?: undefined;
|
|
188
|
+
})[];
|
|
189
|
+
declare const XSwapRouterAbi: ({
|
|
190
|
+
inputs: never[];
|
|
191
|
+
stateMutability: string;
|
|
192
|
+
type: string;
|
|
193
|
+
name?: undefined;
|
|
194
|
+
anonymous?: undefined;
|
|
195
|
+
outputs?: undefined;
|
|
196
|
+
} | {
|
|
197
|
+
inputs: {
|
|
198
|
+
internalType: string;
|
|
199
|
+
name: string;
|
|
200
|
+
type: string;
|
|
201
|
+
}[];
|
|
202
|
+
name: string;
|
|
203
|
+
type: string;
|
|
204
|
+
stateMutability?: undefined;
|
|
205
|
+
anonymous?: undefined;
|
|
206
|
+
outputs?: undefined;
|
|
207
|
+
} | {
|
|
208
|
+
anonymous: boolean;
|
|
209
|
+
inputs: {
|
|
210
|
+
indexed: boolean;
|
|
211
|
+
internalType: string;
|
|
212
|
+
name: string;
|
|
213
|
+
type: string;
|
|
214
|
+
}[];
|
|
215
|
+
name: string;
|
|
216
|
+
type: string;
|
|
217
|
+
stateMutability?: undefined;
|
|
218
|
+
outputs?: undefined;
|
|
219
|
+
} | {
|
|
220
|
+
inputs: ({
|
|
221
|
+
internalType: string;
|
|
222
|
+
name: string;
|
|
223
|
+
type: string;
|
|
224
|
+
components?: undefined;
|
|
225
|
+
} | {
|
|
226
|
+
components: ({
|
|
227
|
+
internalType: string;
|
|
228
|
+
name: string;
|
|
229
|
+
type: string;
|
|
230
|
+
components?: undefined;
|
|
231
|
+
} | {
|
|
232
|
+
components: {
|
|
233
|
+
internalType: string;
|
|
234
|
+
name: string;
|
|
235
|
+
type: string;
|
|
236
|
+
}[];
|
|
237
|
+
internalType: string;
|
|
238
|
+
name: string;
|
|
239
|
+
type: string;
|
|
240
|
+
})[];
|
|
241
|
+
internalType: string;
|
|
242
|
+
name: string;
|
|
243
|
+
type: string;
|
|
244
|
+
})[];
|
|
245
|
+
name: string;
|
|
246
|
+
outputs: {
|
|
247
|
+
components: ({
|
|
248
|
+
internalType: string;
|
|
249
|
+
name: string;
|
|
250
|
+
type: string;
|
|
251
|
+
components?: undefined;
|
|
252
|
+
} | {
|
|
253
|
+
components: {
|
|
254
|
+
internalType: string;
|
|
255
|
+
name: string;
|
|
256
|
+
type: string;
|
|
257
|
+
}[];
|
|
258
|
+
internalType: string;
|
|
259
|
+
name: string;
|
|
260
|
+
type: string;
|
|
261
|
+
})[];
|
|
262
|
+
internalType: string;
|
|
263
|
+
name: string;
|
|
264
|
+
type: string;
|
|
265
|
+
}[];
|
|
266
|
+
stateMutability: string;
|
|
267
|
+
type: string;
|
|
268
|
+
anonymous?: undefined;
|
|
269
|
+
} | {
|
|
270
|
+
inputs: ({
|
|
271
|
+
internalType: string;
|
|
272
|
+
name: string;
|
|
273
|
+
type: string;
|
|
274
|
+
components?: undefined;
|
|
275
|
+
} | {
|
|
276
|
+
components: ({
|
|
277
|
+
internalType: string;
|
|
278
|
+
name: string;
|
|
279
|
+
type: string;
|
|
280
|
+
components?: undefined;
|
|
281
|
+
} | {
|
|
282
|
+
components: {
|
|
283
|
+
internalType: string;
|
|
284
|
+
name: string;
|
|
285
|
+
type: string;
|
|
286
|
+
}[];
|
|
287
|
+
internalType: string;
|
|
288
|
+
name: string;
|
|
289
|
+
type: string;
|
|
290
|
+
})[];
|
|
291
|
+
internalType: string;
|
|
292
|
+
name: string;
|
|
293
|
+
type: string;
|
|
294
|
+
})[];
|
|
295
|
+
name: string;
|
|
296
|
+
outputs: {
|
|
297
|
+
internalType: string;
|
|
298
|
+
name: string;
|
|
299
|
+
type: string;
|
|
300
|
+
}[];
|
|
301
|
+
stateMutability: string;
|
|
302
|
+
type: string;
|
|
303
|
+
anonymous?: undefined;
|
|
304
|
+
} | {
|
|
305
|
+
stateMutability: string;
|
|
306
|
+
type: string;
|
|
307
|
+
inputs?: undefined;
|
|
308
|
+
name?: undefined;
|
|
309
|
+
anonymous?: undefined;
|
|
310
|
+
outputs?: undefined;
|
|
311
|
+
})[];
|
|
3
312
|
|
|
4
313
|
/**
|
|
5
314
|
* Get swap route based on provided criteria.
|
|
@@ -29,4 +338,12 @@ declare function getChainData(chainId?: string, ecosystem?: Ecosystem, overrides
|
|
|
29
338
|
*/
|
|
30
339
|
declare function getTokens(chainId: string, address?: string, ecosystem?: Ecosystem, overrides?: ApiOverrides): Promise<Token[]>;
|
|
31
340
|
|
|
32
|
-
|
|
341
|
+
declare const safeBigNumberFrom: (value: string) => BigNumber;
|
|
342
|
+
|
|
343
|
+
declare const generateApproveTxData: (tokenAddress: string, spender: string, amount: BigNumberish) => {
|
|
344
|
+
to: string;
|
|
345
|
+
value: ethers.BigNumber;
|
|
346
|
+
data: string;
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
export { type AddReferralPayload, type ApiOverrides, type Chain, type CoinTypeAddress, type CollectFees, type ContractCall, DEFAULT_API_URL, DEFAULT_DB_ERROR, DEFAULT_ECOSYSTEM, DEFAULT_GAS_LIMIT_MULTIPLIER, DEFAULT_NATIVE_FEE_MULTIPLIER_PERCENTAGE, ERC20Abi, Ecosystem, Environment, type GetRoutePayload, type Protocol, type Referral, type ReferralInfo, type Route, type Token, Web3Environment, XSwapCallType, type XSwapFee, type XSwapFees, XSwapRouterAbi, generateApproveTxData, getChainData, getChains, getRoute, getTokens, safeBigNumberFrom };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,314 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { BigNumberish, BigNumber, ethers } from 'ethers';
|
|
2
|
+
import { TransactionRequest } from '@ethersproject/providers';
|
|
3
|
+
|
|
4
|
+
type ApiOverrides = {
|
|
5
|
+
apiUrl?: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
declare enum Web3Environment {
|
|
9
|
+
DEVNET = "devnet",
|
|
10
|
+
TESTNET = "testnet",
|
|
11
|
+
MAINNET = "mainnet"
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type Token = {
|
|
15
|
+
address: string;
|
|
16
|
+
name: string;
|
|
17
|
+
symbol: string;
|
|
18
|
+
decimals: number;
|
|
19
|
+
image: string;
|
|
20
|
+
priority: number;
|
|
21
|
+
quickPick?: boolean;
|
|
22
|
+
supported?: boolean;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
type Chain = {
|
|
26
|
+
ecosystem: string;
|
|
27
|
+
chainId: string;
|
|
28
|
+
name: string;
|
|
29
|
+
displayName: string;
|
|
30
|
+
web3Environment: Web3Environment;
|
|
31
|
+
transactionExplorer: string;
|
|
32
|
+
rpcUrls?: Array<string>;
|
|
33
|
+
ccipChainId: string;
|
|
34
|
+
tokens: Token[];
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
type CoinTypeAddress = {
|
|
38
|
+
coinType: number;
|
|
39
|
+
address: string;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
type CollectFees = {
|
|
43
|
+
integratorAddress: string;
|
|
44
|
+
fee: number;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
declare enum XSwapCallType {
|
|
48
|
+
DEFAULT = 0,
|
|
49
|
+
FULL_TOKEN_BALANCE = 1,
|
|
50
|
+
FULL_NATIVE_BALANCE = 2,
|
|
51
|
+
COLLECT_TOKEN_BALANCE = 3
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
type ContractCall = {
|
|
55
|
+
callType: XSwapCallType;
|
|
56
|
+
target: string;
|
|
57
|
+
value: string;
|
|
58
|
+
callData: string;
|
|
59
|
+
payload: string;
|
|
60
|
+
estimatedGas?: string;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
declare enum Ecosystem {
|
|
64
|
+
EVM = "evm"
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
declare enum Environment {
|
|
68
|
+
PROD = "production",
|
|
69
|
+
DEV = "develop",
|
|
70
|
+
LOCAL = "local"
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
type GetRoutePayload = {
|
|
74
|
+
fromChain: string;
|
|
75
|
+
toChain: string;
|
|
76
|
+
fromToken: string;
|
|
77
|
+
toToken: string;
|
|
78
|
+
fromAmount: string;
|
|
79
|
+
fromAddress: string;
|
|
80
|
+
toAddress: string;
|
|
81
|
+
paymentToken: string;
|
|
82
|
+
slippage: number;
|
|
83
|
+
expressDelivery: boolean;
|
|
84
|
+
quoteOnly?: boolean;
|
|
85
|
+
enableExpress?: boolean;
|
|
86
|
+
customContractCalls?: ContractCall[];
|
|
87
|
+
sourceChainDexes?: string[];
|
|
88
|
+
destinationChainDexes?: string[];
|
|
89
|
+
receiveGasOnDestination?: boolean;
|
|
90
|
+
collectFees?: CollectFees;
|
|
91
|
+
fallbackAddresses?: CoinTypeAddress[];
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
type AddReferralPayload = {
|
|
95
|
+
code: string;
|
|
96
|
+
address: string;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
type Protocol = {
|
|
100
|
+
name: string;
|
|
101
|
+
part: number;
|
|
102
|
+
fromTokenAddress: string;
|
|
103
|
+
toTokenAddress: string;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
type XSwapFee = {
|
|
107
|
+
tokenFee: string;
|
|
108
|
+
nativeFee: string;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
type XSwapFees = {
|
|
112
|
+
ccipFee: string;
|
|
113
|
+
xSwapFee: XSwapFee;
|
|
114
|
+
expressDeliveryFee: string;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
type Route = {
|
|
118
|
+
originChainXSwapCalls: ContractCall[];
|
|
119
|
+
originProtocols: Protocol[][][];
|
|
120
|
+
destinationChainXSwapCalls: ContractCall[];
|
|
121
|
+
destinationProtocols: Protocol[][][];
|
|
122
|
+
originCrossChainTransferToken: string;
|
|
123
|
+
destinationCrossChainTransferToken: string;
|
|
124
|
+
amountToTransferCrossChain: BigNumberish;
|
|
125
|
+
estAmountOut: string;
|
|
126
|
+
minAmountOut: string;
|
|
127
|
+
estimatedGasDestination: number;
|
|
128
|
+
transactions: {
|
|
129
|
+
approve: TransactionRequest;
|
|
130
|
+
swap: TransactionRequest;
|
|
131
|
+
};
|
|
132
|
+
xSwapFees: XSwapFees;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
type Referral = {
|
|
136
|
+
address: string;
|
|
137
|
+
code: string;
|
|
138
|
+
referrals: ReferralInfo[];
|
|
139
|
+
};
|
|
140
|
+
type ReferralInfo = {
|
|
141
|
+
address: string;
|
|
142
|
+
ipAddress: string;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
declare const DEFAULT_API_URL = "https://xswap.link/api";
|
|
146
|
+
declare const DEFAULT_DB_ERROR = "No data for provided parameters";
|
|
147
|
+
declare const DEFAULT_ECOSYSTEM = Ecosystem.EVM;
|
|
148
|
+
declare const DEFAULT_NATIVE_FEE_MULTIPLIER_PERCENTAGE = 105;
|
|
149
|
+
declare const DEFAULT_GAS_LIMIT_MULTIPLIER = 1.2;
|
|
150
|
+
|
|
151
|
+
declare const ERC20Abi: ({
|
|
152
|
+
constant: boolean;
|
|
153
|
+
inputs: {
|
|
154
|
+
name: string;
|
|
155
|
+
type: string;
|
|
156
|
+
}[];
|
|
157
|
+
name: string;
|
|
158
|
+
outputs: {
|
|
159
|
+
name: string;
|
|
160
|
+
type: string;
|
|
161
|
+
}[];
|
|
162
|
+
payable: boolean;
|
|
163
|
+
stateMutability: string;
|
|
164
|
+
type: string;
|
|
165
|
+
anonymous?: undefined;
|
|
166
|
+
} | {
|
|
167
|
+
payable: boolean;
|
|
168
|
+
stateMutability: string;
|
|
169
|
+
type: string;
|
|
170
|
+
constant?: undefined;
|
|
171
|
+
inputs?: undefined;
|
|
172
|
+
name?: undefined;
|
|
173
|
+
outputs?: undefined;
|
|
174
|
+
anonymous?: undefined;
|
|
175
|
+
} | {
|
|
176
|
+
anonymous: boolean;
|
|
177
|
+
inputs: {
|
|
178
|
+
indexed: boolean;
|
|
179
|
+
name: string;
|
|
180
|
+
type: string;
|
|
181
|
+
}[];
|
|
182
|
+
name: string;
|
|
183
|
+
type: string;
|
|
184
|
+
constant?: undefined;
|
|
185
|
+
outputs?: undefined;
|
|
186
|
+
payable?: undefined;
|
|
187
|
+
stateMutability?: undefined;
|
|
188
|
+
})[];
|
|
189
|
+
declare const XSwapRouterAbi: ({
|
|
190
|
+
inputs: never[];
|
|
191
|
+
stateMutability: string;
|
|
192
|
+
type: string;
|
|
193
|
+
name?: undefined;
|
|
194
|
+
anonymous?: undefined;
|
|
195
|
+
outputs?: undefined;
|
|
196
|
+
} | {
|
|
197
|
+
inputs: {
|
|
198
|
+
internalType: string;
|
|
199
|
+
name: string;
|
|
200
|
+
type: string;
|
|
201
|
+
}[];
|
|
202
|
+
name: string;
|
|
203
|
+
type: string;
|
|
204
|
+
stateMutability?: undefined;
|
|
205
|
+
anonymous?: undefined;
|
|
206
|
+
outputs?: undefined;
|
|
207
|
+
} | {
|
|
208
|
+
anonymous: boolean;
|
|
209
|
+
inputs: {
|
|
210
|
+
indexed: boolean;
|
|
211
|
+
internalType: string;
|
|
212
|
+
name: string;
|
|
213
|
+
type: string;
|
|
214
|
+
}[];
|
|
215
|
+
name: string;
|
|
216
|
+
type: string;
|
|
217
|
+
stateMutability?: undefined;
|
|
218
|
+
outputs?: undefined;
|
|
219
|
+
} | {
|
|
220
|
+
inputs: ({
|
|
221
|
+
internalType: string;
|
|
222
|
+
name: string;
|
|
223
|
+
type: string;
|
|
224
|
+
components?: undefined;
|
|
225
|
+
} | {
|
|
226
|
+
components: ({
|
|
227
|
+
internalType: string;
|
|
228
|
+
name: string;
|
|
229
|
+
type: string;
|
|
230
|
+
components?: undefined;
|
|
231
|
+
} | {
|
|
232
|
+
components: {
|
|
233
|
+
internalType: string;
|
|
234
|
+
name: string;
|
|
235
|
+
type: string;
|
|
236
|
+
}[];
|
|
237
|
+
internalType: string;
|
|
238
|
+
name: string;
|
|
239
|
+
type: string;
|
|
240
|
+
})[];
|
|
241
|
+
internalType: string;
|
|
242
|
+
name: string;
|
|
243
|
+
type: string;
|
|
244
|
+
})[];
|
|
245
|
+
name: string;
|
|
246
|
+
outputs: {
|
|
247
|
+
components: ({
|
|
248
|
+
internalType: string;
|
|
249
|
+
name: string;
|
|
250
|
+
type: string;
|
|
251
|
+
components?: undefined;
|
|
252
|
+
} | {
|
|
253
|
+
components: {
|
|
254
|
+
internalType: string;
|
|
255
|
+
name: string;
|
|
256
|
+
type: string;
|
|
257
|
+
}[];
|
|
258
|
+
internalType: string;
|
|
259
|
+
name: string;
|
|
260
|
+
type: string;
|
|
261
|
+
})[];
|
|
262
|
+
internalType: string;
|
|
263
|
+
name: string;
|
|
264
|
+
type: string;
|
|
265
|
+
}[];
|
|
266
|
+
stateMutability: string;
|
|
267
|
+
type: string;
|
|
268
|
+
anonymous?: undefined;
|
|
269
|
+
} | {
|
|
270
|
+
inputs: ({
|
|
271
|
+
internalType: string;
|
|
272
|
+
name: string;
|
|
273
|
+
type: string;
|
|
274
|
+
components?: undefined;
|
|
275
|
+
} | {
|
|
276
|
+
components: ({
|
|
277
|
+
internalType: string;
|
|
278
|
+
name: string;
|
|
279
|
+
type: string;
|
|
280
|
+
components?: undefined;
|
|
281
|
+
} | {
|
|
282
|
+
components: {
|
|
283
|
+
internalType: string;
|
|
284
|
+
name: string;
|
|
285
|
+
type: string;
|
|
286
|
+
}[];
|
|
287
|
+
internalType: string;
|
|
288
|
+
name: string;
|
|
289
|
+
type: string;
|
|
290
|
+
})[];
|
|
291
|
+
internalType: string;
|
|
292
|
+
name: string;
|
|
293
|
+
type: string;
|
|
294
|
+
})[];
|
|
295
|
+
name: string;
|
|
296
|
+
outputs: {
|
|
297
|
+
internalType: string;
|
|
298
|
+
name: string;
|
|
299
|
+
type: string;
|
|
300
|
+
}[];
|
|
301
|
+
stateMutability: string;
|
|
302
|
+
type: string;
|
|
303
|
+
anonymous?: undefined;
|
|
304
|
+
} | {
|
|
305
|
+
stateMutability: string;
|
|
306
|
+
type: string;
|
|
307
|
+
inputs?: undefined;
|
|
308
|
+
name?: undefined;
|
|
309
|
+
anonymous?: undefined;
|
|
310
|
+
outputs?: undefined;
|
|
311
|
+
})[];
|
|
3
312
|
|
|
4
313
|
/**
|
|
5
314
|
* Get swap route based on provided criteria.
|
|
@@ -29,4 +338,12 @@ declare function getChainData(chainId?: string, ecosystem?: Ecosystem, overrides
|
|
|
29
338
|
*/
|
|
30
339
|
declare function getTokens(chainId: string, address?: string, ecosystem?: Ecosystem, overrides?: ApiOverrides): Promise<Token[]>;
|
|
31
340
|
|
|
32
|
-
|
|
341
|
+
declare const safeBigNumberFrom: (value: string) => BigNumber;
|
|
342
|
+
|
|
343
|
+
declare const generateApproveTxData: (tokenAddress: string, spender: string, amount: BigNumberish) => {
|
|
344
|
+
to: string;
|
|
345
|
+
value: ethers.BigNumber;
|
|
346
|
+
data: string;
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
export { type AddReferralPayload, type ApiOverrides, type Chain, type CoinTypeAddress, type CollectFees, type ContractCall, DEFAULT_API_URL, DEFAULT_DB_ERROR, DEFAULT_ECOSYSTEM, DEFAULT_GAS_LIMIT_MULTIPLIER, DEFAULT_NATIVE_FEE_MULTIPLIER_PERCENTAGE, ERC20Abi, Ecosystem, Environment, type GetRoutePayload, type Protocol, type Referral, type ReferralInfo, type Route, type Token, Web3Environment, XSwapCallType, type XSwapFee, type XSwapFees, XSwapRouterAbi, generateApproveTxData, getChainData, getChains, getRoute, getTokens, safeBigNumberFrom };
|