@xswap-link/sdk 0.7.0 → 0.8.1
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 +16 -0
- package/dist/index.d.mts +122 -70
- package/dist/index.d.ts +122 -70
- package/dist/index.global.js +686 -281
- package/dist/index.js +10 -10
- package/dist/index.mjs +10 -10
- package/package.json +1 -1
- package/src/assets/icons/ArrowsExchange.tsx +18 -0
- package/src/assets/icons/index.ts +1 -0
- package/src/components/Swap/Header/index.tsx +4 -2
- package/src/components/Swap/HistoryView/index.tsx +2 -2
- package/src/components/Swap/ReorderButton/ReorderButton.tsx +37 -0
- package/src/components/Swap/SwapView/ConfirmationView/TxOverview/ArrowIcon.tsx +1 -1
- package/src/components/Swap/SwapView/SwapButton/index.tsx +3 -1
- package/src/components/Swap/SwapView/SwapPanel/ChainPanel/ChainPicker/ChainItem/index.tsx +55 -22
- package/src/components/Swap/SwapView/SwapPanel/ChainPanel/ChainPicker/index.tsx +71 -6
- package/src/components/Swap/SwapView/SwapPanel/ChainPanel/index.tsx +68 -15
- package/src/components/Swap/SwapView/SwapPanel/TokenPanel/TokenPicker/index.tsx +10 -2
- package/src/components/Swap/SwapView/SwapPanel/TokenPanel/index.tsx +31 -11
- package/src/components/Swap/SwapView/SwapPanel/index.tsx +8 -3
- package/src/components/Swap/SwapView/index.tsx +3 -3
- package/src/components/Swap/index.tsx +1 -1
- package/src/components/TxConfigForm/index.tsx +57 -4
- package/src/components/TxWidgetWC/index.tsx +47 -2
- package/src/components/TxWidgetWCWrapped/index.tsx +33 -1
- package/src/config/index.ts +1 -1
- package/src/context/SwapProvider.tsx +177 -27
- package/src/models/BridgeTokensDictionary.ts +7 -0
- package/src/models/TokenData.ts +3 -1
- package/src/models/index.ts +6 -5
- package/src/models/payloads/ModalIntegrationPayload.ts +15 -1
- package/src/models/payloads/WidgetIntegrationPayload.ts +15 -1
- package/src/services/api.ts +6 -1
- package/src/services/integrations/transactions.ts +20 -0
- package/src/types/global.d.ts +15 -0
- package/src/utils/validation.ts +383 -0
- package/tsconfig.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @xswap-link/xswap-sdk
|
|
2
2
|
|
|
3
|
+
## 0.8.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a7461fe: Add options to getDefaultSwapTokenForChain
|
|
8
|
+
|
|
9
|
+
## 0.8.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 1644b5e: Add bridge, reorder, callbacks after change and other improvements
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 4c5ee0f: Add source and target chain and token validation
|
|
18
|
+
|
|
3
19
|
## 0.7.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -22,70 +22,16 @@ declare enum ContractName {
|
|
|
22
22
|
XSwapRouterSingleChain = "XSwapRouterSingleChain"
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
type XSwapConfig = {
|
|
26
|
-
apiUrl: string;
|
|
27
|
-
localCss: boolean;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
25
|
type BridgeToken = {
|
|
31
26
|
[chainId: string]: string;
|
|
32
27
|
};
|
|
33
28
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
type Chain = {
|
|
41
|
-
ecosystem: string;
|
|
42
|
-
chainId: string;
|
|
43
|
-
name: string;
|
|
44
|
-
displayName: string;
|
|
45
|
-
image: string;
|
|
46
|
-
web3Environment: Web3Environment;
|
|
47
|
-
tokenSymbol: string;
|
|
48
|
-
ccipChainId: string;
|
|
49
|
-
transactionExplorer: string;
|
|
50
|
-
bridgeSupported: boolean;
|
|
51
|
-
swapSupported: boolean;
|
|
52
|
-
tokens: Token[];
|
|
53
|
-
publicRpcUrls: string[];
|
|
54
|
-
privateRpcUrls?: string[];
|
|
55
|
-
scanApiURL?: string;
|
|
56
|
-
};
|
|
57
|
-
type Token = {
|
|
58
|
-
address: string;
|
|
59
|
-
name: string;
|
|
60
|
-
symbol: string;
|
|
61
|
-
tokenId: string;
|
|
62
|
-
decimals: number;
|
|
63
|
-
image?: string;
|
|
64
|
-
priority: number;
|
|
65
|
-
quickPick?: boolean;
|
|
66
|
-
supported?: boolean;
|
|
67
|
-
};
|
|
68
|
-
type Prices = {
|
|
69
|
-
blockchainId: string;
|
|
70
|
-
updatedAt: Date;
|
|
71
|
-
prices: TokenPrices;
|
|
72
|
-
};
|
|
73
|
-
type TokenPrices = {
|
|
74
|
-
[tokenAddress: string]: string;
|
|
75
|
-
};
|
|
76
|
-
type TokenBalances = {
|
|
77
|
-
[tokenAddress: string]: BigNumber | undefined;
|
|
78
|
-
};
|
|
79
|
-
type TokenOption = Token & {
|
|
80
|
-
chainId: string;
|
|
81
|
-
disabled?: boolean;
|
|
82
|
-
balance?: BigNumber;
|
|
83
|
-
};
|
|
84
|
-
type ImportedTokenData = {
|
|
85
|
-
address: string;
|
|
86
|
-
symbol: string;
|
|
87
|
-
name: string;
|
|
88
|
-
decimals: number;
|
|
29
|
+
type BridgeTokensDictionary = {
|
|
30
|
+
[chainId0: string]: {
|
|
31
|
+
[tokenAddress0: string]: {
|
|
32
|
+
[chainId1: string]: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
89
35
|
};
|
|
90
36
|
|
|
91
37
|
type CoinTypeAddress = {
|
|
@@ -232,6 +178,22 @@ type ModalIntegrationPayload = {
|
|
|
232
178
|
lightTheme?: boolean;
|
|
233
179
|
defaultWalletPicker?: boolean;
|
|
234
180
|
styles?: ModalIntegrationStyles;
|
|
181
|
+
onPendingTransactionsChange?: (transactions: Transaction[]) => void;
|
|
182
|
+
dstTokenLocked?: boolean;
|
|
183
|
+
dstChainLocked?: boolean;
|
|
184
|
+
srcTokenLocked?: boolean;
|
|
185
|
+
srcChainLocked?: boolean;
|
|
186
|
+
onDstTokenChange?: (token: {
|
|
187
|
+
address: string;
|
|
188
|
+
symbol: string;
|
|
189
|
+
} | undefined) => void;
|
|
190
|
+
onDstChainChange?: (chain: string | undefined) => void;
|
|
191
|
+
onSrcTokenChange?: (token: {
|
|
192
|
+
address: string;
|
|
193
|
+
symbol: string;
|
|
194
|
+
} | undefined) => void;
|
|
195
|
+
onSrcChainChange?: (chain: string | undefined) => void;
|
|
196
|
+
bridge?: boolean;
|
|
235
197
|
};
|
|
236
198
|
|
|
237
199
|
type WidgetIntegrationPayload = {
|
|
@@ -246,6 +208,22 @@ type WidgetIntegrationPayload = {
|
|
|
246
208
|
lightTheme?: boolean;
|
|
247
209
|
defaultWalletPicker?: boolean;
|
|
248
210
|
styles?: ModalIntegrationStyles | string;
|
|
211
|
+
onPendingTransactionsChange?: (transactions: Transaction[]) => void;
|
|
212
|
+
dstTokenLocked?: boolean;
|
|
213
|
+
dstChainLocked?: boolean;
|
|
214
|
+
srcTokenLocked?: boolean;
|
|
215
|
+
srcChainLocked?: boolean;
|
|
216
|
+
onDstTokenChange?: (token: {
|
|
217
|
+
address: string;
|
|
218
|
+
symbol: string;
|
|
219
|
+
} | undefined) => void;
|
|
220
|
+
onDstChainChange?: (chain: string | undefined) => void;
|
|
221
|
+
onSrcTokenChange?: (token: {
|
|
222
|
+
address: string;
|
|
223
|
+
symbol: string;
|
|
224
|
+
} | undefined) => void;
|
|
225
|
+
onSrcChainChange?: (chain: string | undefined) => void;
|
|
226
|
+
bridge?: boolean;
|
|
249
227
|
};
|
|
250
228
|
|
|
251
229
|
type Protocol = {
|
|
@@ -255,6 +233,16 @@ type Protocol = {
|
|
|
255
233
|
toTokenAddress: string;
|
|
256
234
|
};
|
|
257
235
|
|
|
236
|
+
type Referral = {
|
|
237
|
+
address: string;
|
|
238
|
+
code: string;
|
|
239
|
+
referrals: ReferralInfo[];
|
|
240
|
+
};
|
|
241
|
+
type ReferralInfo = {
|
|
242
|
+
address: string;
|
|
243
|
+
ipAddress: string;
|
|
244
|
+
};
|
|
245
|
+
|
|
258
246
|
type Route = {
|
|
259
247
|
estAmountOut: string;
|
|
260
248
|
minAmountOut: string;
|
|
@@ -281,14 +269,63 @@ type XSwapFee = {
|
|
|
281
269
|
nativeFee: string;
|
|
282
270
|
};
|
|
283
271
|
|
|
284
|
-
|
|
272
|
+
declare enum Web3Environment {
|
|
273
|
+
DEVNET = "devnet",
|
|
274
|
+
TESTNET = "testnet",
|
|
275
|
+
MAINNET = "mainnet"
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
type Chain = {
|
|
279
|
+
ecosystem: string;
|
|
280
|
+
chainId: string;
|
|
281
|
+
name: string;
|
|
282
|
+
displayName: string;
|
|
283
|
+
image: string;
|
|
284
|
+
web3Environment: Web3Environment;
|
|
285
|
+
tokenSymbol: string;
|
|
286
|
+
ccipChainId: string;
|
|
287
|
+
transactionExplorer: string;
|
|
288
|
+
bridgeSupported: boolean;
|
|
289
|
+
swapSupported: boolean;
|
|
290
|
+
tokens: Token[];
|
|
291
|
+
publicRpcUrls: string[];
|
|
292
|
+
privateRpcUrls?: string[];
|
|
293
|
+
scanApiURL?: string;
|
|
294
|
+
defaultDstChain?: string;
|
|
295
|
+
disabledForDestination?: string[];
|
|
296
|
+
};
|
|
297
|
+
type Token = {
|
|
285
298
|
address: string;
|
|
286
|
-
|
|
287
|
-
|
|
299
|
+
name: string;
|
|
300
|
+
symbol: string;
|
|
301
|
+
tokenId: string;
|
|
302
|
+
decimals: number;
|
|
303
|
+
image?: string;
|
|
304
|
+
priority: number;
|
|
305
|
+
quickPick?: boolean;
|
|
306
|
+
supported?: boolean;
|
|
288
307
|
};
|
|
289
|
-
type
|
|
308
|
+
type Prices = {
|
|
309
|
+
blockchainId: string;
|
|
310
|
+
updatedAt: Date;
|
|
311
|
+
prices: TokenPrices;
|
|
312
|
+
};
|
|
313
|
+
type TokenPrices = {
|
|
314
|
+
[tokenAddress: string]: string;
|
|
315
|
+
};
|
|
316
|
+
type TokenBalances = {
|
|
317
|
+
[tokenAddress: string]: BigNumber | undefined;
|
|
318
|
+
};
|
|
319
|
+
type TokenOption = Token & {
|
|
320
|
+
chainId: string;
|
|
321
|
+
disabled?: boolean;
|
|
322
|
+
balance?: BigNumber;
|
|
323
|
+
};
|
|
324
|
+
type ImportedTokenData = {
|
|
290
325
|
address: string;
|
|
291
|
-
|
|
326
|
+
symbol: string;
|
|
327
|
+
name: string;
|
|
328
|
+
decimals: number;
|
|
292
329
|
};
|
|
293
330
|
|
|
294
331
|
type TransferType = "CROSS_CHAIN" | "SINGLE_CHAIN";
|
|
@@ -361,6 +398,16 @@ type TxWidgetWCAttributes = {
|
|
|
361
398
|
"light-theme": WidgetIntegrationPayload["lightTheme"];
|
|
362
399
|
"default-wallet-picker": WidgetIntegrationPayload["defaultWalletPicker"];
|
|
363
400
|
styles: string | undefined;
|
|
401
|
+
"on-pending-transactions-change"?: WidgetIntegrationPayload["onPendingTransactionsChange"];
|
|
402
|
+
"dst-token-locked": WidgetIntegrationPayload["dstTokenLocked"] | undefined;
|
|
403
|
+
"dst-chain-locked": WidgetIntegrationPayload["dstChainLocked"] | undefined;
|
|
404
|
+
"src-token-locked": WidgetIntegrationPayload["srcTokenLocked"] | undefined;
|
|
405
|
+
"src-chain-locked": WidgetIntegrationPayload["srcChainLocked"] | undefined;
|
|
406
|
+
"on-dst-token-change"?: WidgetIntegrationPayload["onDstTokenChange"];
|
|
407
|
+
"on-dst-chain-change"?: WidgetIntegrationPayload["onDstChainChange"];
|
|
408
|
+
"on-src-token-change"?: WidgetIntegrationPayload["onSrcTokenChange"];
|
|
409
|
+
"on-src-chain-change"?: WidgetIntegrationPayload["onSrcChainChange"];
|
|
410
|
+
bridge: WidgetIntegrationPayload["bridge"] | undefined;
|
|
364
411
|
};
|
|
365
412
|
|
|
366
413
|
declare global {
|
|
@@ -370,7 +417,7 @@ declare global {
|
|
|
370
417
|
}
|
|
371
418
|
}
|
|
372
419
|
}
|
|
373
|
-
declare const TxWidgetWCWrapped: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, }: WidgetIntegrationPayload) => react_jsx_runtime.JSX.Element;
|
|
420
|
+
declare const TxWidgetWCWrapped: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, onPendingTransactionsChange, dstTokenLocked, dstChainLocked, srcTokenLocked, srcChainLocked, onDstTokenChange, onDstChainChange, onSrcTokenChange, onSrcChainChange, bridge, }: WidgetIntegrationPayload) => react_jsx_runtime.JSX.Element;
|
|
374
421
|
|
|
375
422
|
interface EvmHandlers {
|
|
376
423
|
onSuccess?: (data: ContractReceipt) => void;
|
|
@@ -421,14 +468,19 @@ type TxStats = {
|
|
|
421
468
|
cashback?: string;
|
|
422
469
|
};
|
|
423
470
|
|
|
424
|
-
|
|
471
|
+
type XSwapConfig = {
|
|
472
|
+
apiUrl: string;
|
|
473
|
+
localCss: boolean;
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
declare const openTransactionModal: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, onPendingTransactionsChange, dstTokenLocked, dstChainLocked, srcTokenLocked, srcChainLocked, onDstTokenChange, onDstChainChange, onSrcTokenChange, onSrcChainChange, bridge, }: ModalIntegrationPayload) => Promise<void>;
|
|
425
477
|
|
|
426
478
|
declare const TxWidgetWC: CustomElementConstructor;
|
|
427
479
|
|
|
428
480
|
declare const XPay: {
|
|
429
|
-
openTransactionModal: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, }: ModalIntegrationPayload) => Promise<void>;
|
|
430
|
-
TxWidget: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, }: WidgetIntegrationPayload) => react_jsx_runtime.JSX.Element;
|
|
481
|
+
openTransactionModal: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, onPendingTransactionsChange, dstTokenLocked, dstChainLocked, srcTokenLocked, srcChainLocked, onDstTokenChange, onDstChainChange, onSrcTokenChange, onSrcChainChange, bridge, }: ModalIntegrationPayload) => Promise<void>;
|
|
482
|
+
TxWidget: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, onPendingTransactionsChange, dstTokenLocked, dstChainLocked, srcTokenLocked, srcChainLocked, onDstTokenChange, onDstChainChange, onSrcTokenChange, onSrcChainChange, bridge, }: WidgetIntegrationPayload) => react_jsx_runtime.JSX.Element;
|
|
431
483
|
TxWidgetWC: CustomElementConstructor;
|
|
432
484
|
};
|
|
433
485
|
|
|
434
|
-
export { type AddReferralPayload, type Addresses, type BridgeToken, type Chain, type CoinTypeAddress, type CollectFees, type ContractCall, ContractName, type Contracts, Ecosystem, type EnqueueTxProps, Environment, type GenerateStakingCallsParams, type GetFinishedLeaderboardQuestsPayload, type GetLeaderboardChangePayload, type GetPricesPayload, type GetRoutePayload, type GetTokenBalancesPayload, type HistoryTransaction, type ImportedTokenData, type ModalIntegrationPayload, type ModalIntegrationStyles, type ModalIntegrationThemeStyles, type MonitoredTransaction, type Prices, type Protocol, type Referral, type ReferralInfo, type Route, type Token, type TokenBalances, type TokenOption, type TokenPrices, type Transaction, type TransactionHistory, type TransactionRequest, type TransactionStatus, type Transactions, type TxConfigFormData, type TxStats, TxStatus, type TxUIWrapperState, TxWidgetWCWrapped as TxWidget, TxWidgetWC, Web3Environment, type WidgetIntegrationPayload, XSwapCallType, type XSwapConfig, type XSwapFee, type XSwapFees, XPay as default, openTransactionModal };
|
|
486
|
+
export { type AddReferralPayload, type Addresses, type BridgeToken, type BridgeTokensDictionary, type Chain, type CoinTypeAddress, type CollectFees, type ContractCall, ContractName, type Contracts, Ecosystem, type EnqueueTxProps, Environment, type GenerateStakingCallsParams, type GetFinishedLeaderboardQuestsPayload, type GetLeaderboardChangePayload, type GetPricesPayload, type GetRoutePayload, type GetTokenBalancesPayload, type HistoryTransaction, type ImportedTokenData, type ModalIntegrationPayload, type ModalIntegrationStyles, type ModalIntegrationThemeStyles, type MonitoredTransaction, type Prices, type Protocol, type Referral, type ReferralInfo, type Route, type Token, type TokenBalances, type TokenOption, type TokenPrices, type Transaction, type TransactionHistory, type TransactionRequest, type TransactionStatus, type Transactions, type TxConfigFormData, type TxStats, TxStatus, type TxUIWrapperState, TxWidgetWCWrapped as TxWidget, TxWidgetWC, Web3Environment, type WidgetIntegrationPayload, XSwapCallType, type XSwapConfig, type XSwapFee, type XSwapFees, XPay as default, openTransactionModal };
|
package/dist/index.d.ts
CHANGED
|
@@ -22,70 +22,16 @@ declare enum ContractName {
|
|
|
22
22
|
XSwapRouterSingleChain = "XSwapRouterSingleChain"
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
type XSwapConfig = {
|
|
26
|
-
apiUrl: string;
|
|
27
|
-
localCss: boolean;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
25
|
type BridgeToken = {
|
|
31
26
|
[chainId: string]: string;
|
|
32
27
|
};
|
|
33
28
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
type Chain = {
|
|
41
|
-
ecosystem: string;
|
|
42
|
-
chainId: string;
|
|
43
|
-
name: string;
|
|
44
|
-
displayName: string;
|
|
45
|
-
image: string;
|
|
46
|
-
web3Environment: Web3Environment;
|
|
47
|
-
tokenSymbol: string;
|
|
48
|
-
ccipChainId: string;
|
|
49
|
-
transactionExplorer: string;
|
|
50
|
-
bridgeSupported: boolean;
|
|
51
|
-
swapSupported: boolean;
|
|
52
|
-
tokens: Token[];
|
|
53
|
-
publicRpcUrls: string[];
|
|
54
|
-
privateRpcUrls?: string[];
|
|
55
|
-
scanApiURL?: string;
|
|
56
|
-
};
|
|
57
|
-
type Token = {
|
|
58
|
-
address: string;
|
|
59
|
-
name: string;
|
|
60
|
-
symbol: string;
|
|
61
|
-
tokenId: string;
|
|
62
|
-
decimals: number;
|
|
63
|
-
image?: string;
|
|
64
|
-
priority: number;
|
|
65
|
-
quickPick?: boolean;
|
|
66
|
-
supported?: boolean;
|
|
67
|
-
};
|
|
68
|
-
type Prices = {
|
|
69
|
-
blockchainId: string;
|
|
70
|
-
updatedAt: Date;
|
|
71
|
-
prices: TokenPrices;
|
|
72
|
-
};
|
|
73
|
-
type TokenPrices = {
|
|
74
|
-
[tokenAddress: string]: string;
|
|
75
|
-
};
|
|
76
|
-
type TokenBalances = {
|
|
77
|
-
[tokenAddress: string]: BigNumber | undefined;
|
|
78
|
-
};
|
|
79
|
-
type TokenOption = Token & {
|
|
80
|
-
chainId: string;
|
|
81
|
-
disabled?: boolean;
|
|
82
|
-
balance?: BigNumber;
|
|
83
|
-
};
|
|
84
|
-
type ImportedTokenData = {
|
|
85
|
-
address: string;
|
|
86
|
-
symbol: string;
|
|
87
|
-
name: string;
|
|
88
|
-
decimals: number;
|
|
29
|
+
type BridgeTokensDictionary = {
|
|
30
|
+
[chainId0: string]: {
|
|
31
|
+
[tokenAddress0: string]: {
|
|
32
|
+
[chainId1: string]: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
89
35
|
};
|
|
90
36
|
|
|
91
37
|
type CoinTypeAddress = {
|
|
@@ -232,6 +178,22 @@ type ModalIntegrationPayload = {
|
|
|
232
178
|
lightTheme?: boolean;
|
|
233
179
|
defaultWalletPicker?: boolean;
|
|
234
180
|
styles?: ModalIntegrationStyles;
|
|
181
|
+
onPendingTransactionsChange?: (transactions: Transaction[]) => void;
|
|
182
|
+
dstTokenLocked?: boolean;
|
|
183
|
+
dstChainLocked?: boolean;
|
|
184
|
+
srcTokenLocked?: boolean;
|
|
185
|
+
srcChainLocked?: boolean;
|
|
186
|
+
onDstTokenChange?: (token: {
|
|
187
|
+
address: string;
|
|
188
|
+
symbol: string;
|
|
189
|
+
} | undefined) => void;
|
|
190
|
+
onDstChainChange?: (chain: string | undefined) => void;
|
|
191
|
+
onSrcTokenChange?: (token: {
|
|
192
|
+
address: string;
|
|
193
|
+
symbol: string;
|
|
194
|
+
} | undefined) => void;
|
|
195
|
+
onSrcChainChange?: (chain: string | undefined) => void;
|
|
196
|
+
bridge?: boolean;
|
|
235
197
|
};
|
|
236
198
|
|
|
237
199
|
type WidgetIntegrationPayload = {
|
|
@@ -246,6 +208,22 @@ type WidgetIntegrationPayload = {
|
|
|
246
208
|
lightTheme?: boolean;
|
|
247
209
|
defaultWalletPicker?: boolean;
|
|
248
210
|
styles?: ModalIntegrationStyles | string;
|
|
211
|
+
onPendingTransactionsChange?: (transactions: Transaction[]) => void;
|
|
212
|
+
dstTokenLocked?: boolean;
|
|
213
|
+
dstChainLocked?: boolean;
|
|
214
|
+
srcTokenLocked?: boolean;
|
|
215
|
+
srcChainLocked?: boolean;
|
|
216
|
+
onDstTokenChange?: (token: {
|
|
217
|
+
address: string;
|
|
218
|
+
symbol: string;
|
|
219
|
+
} | undefined) => void;
|
|
220
|
+
onDstChainChange?: (chain: string | undefined) => void;
|
|
221
|
+
onSrcTokenChange?: (token: {
|
|
222
|
+
address: string;
|
|
223
|
+
symbol: string;
|
|
224
|
+
} | undefined) => void;
|
|
225
|
+
onSrcChainChange?: (chain: string | undefined) => void;
|
|
226
|
+
bridge?: boolean;
|
|
249
227
|
};
|
|
250
228
|
|
|
251
229
|
type Protocol = {
|
|
@@ -255,6 +233,16 @@ type Protocol = {
|
|
|
255
233
|
toTokenAddress: string;
|
|
256
234
|
};
|
|
257
235
|
|
|
236
|
+
type Referral = {
|
|
237
|
+
address: string;
|
|
238
|
+
code: string;
|
|
239
|
+
referrals: ReferralInfo[];
|
|
240
|
+
};
|
|
241
|
+
type ReferralInfo = {
|
|
242
|
+
address: string;
|
|
243
|
+
ipAddress: string;
|
|
244
|
+
};
|
|
245
|
+
|
|
258
246
|
type Route = {
|
|
259
247
|
estAmountOut: string;
|
|
260
248
|
minAmountOut: string;
|
|
@@ -281,14 +269,63 @@ type XSwapFee = {
|
|
|
281
269
|
nativeFee: string;
|
|
282
270
|
};
|
|
283
271
|
|
|
284
|
-
|
|
272
|
+
declare enum Web3Environment {
|
|
273
|
+
DEVNET = "devnet",
|
|
274
|
+
TESTNET = "testnet",
|
|
275
|
+
MAINNET = "mainnet"
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
type Chain = {
|
|
279
|
+
ecosystem: string;
|
|
280
|
+
chainId: string;
|
|
281
|
+
name: string;
|
|
282
|
+
displayName: string;
|
|
283
|
+
image: string;
|
|
284
|
+
web3Environment: Web3Environment;
|
|
285
|
+
tokenSymbol: string;
|
|
286
|
+
ccipChainId: string;
|
|
287
|
+
transactionExplorer: string;
|
|
288
|
+
bridgeSupported: boolean;
|
|
289
|
+
swapSupported: boolean;
|
|
290
|
+
tokens: Token[];
|
|
291
|
+
publicRpcUrls: string[];
|
|
292
|
+
privateRpcUrls?: string[];
|
|
293
|
+
scanApiURL?: string;
|
|
294
|
+
defaultDstChain?: string;
|
|
295
|
+
disabledForDestination?: string[];
|
|
296
|
+
};
|
|
297
|
+
type Token = {
|
|
285
298
|
address: string;
|
|
286
|
-
|
|
287
|
-
|
|
299
|
+
name: string;
|
|
300
|
+
symbol: string;
|
|
301
|
+
tokenId: string;
|
|
302
|
+
decimals: number;
|
|
303
|
+
image?: string;
|
|
304
|
+
priority: number;
|
|
305
|
+
quickPick?: boolean;
|
|
306
|
+
supported?: boolean;
|
|
288
307
|
};
|
|
289
|
-
type
|
|
308
|
+
type Prices = {
|
|
309
|
+
blockchainId: string;
|
|
310
|
+
updatedAt: Date;
|
|
311
|
+
prices: TokenPrices;
|
|
312
|
+
};
|
|
313
|
+
type TokenPrices = {
|
|
314
|
+
[tokenAddress: string]: string;
|
|
315
|
+
};
|
|
316
|
+
type TokenBalances = {
|
|
317
|
+
[tokenAddress: string]: BigNumber | undefined;
|
|
318
|
+
};
|
|
319
|
+
type TokenOption = Token & {
|
|
320
|
+
chainId: string;
|
|
321
|
+
disabled?: boolean;
|
|
322
|
+
balance?: BigNumber;
|
|
323
|
+
};
|
|
324
|
+
type ImportedTokenData = {
|
|
290
325
|
address: string;
|
|
291
|
-
|
|
326
|
+
symbol: string;
|
|
327
|
+
name: string;
|
|
328
|
+
decimals: number;
|
|
292
329
|
};
|
|
293
330
|
|
|
294
331
|
type TransferType = "CROSS_CHAIN" | "SINGLE_CHAIN";
|
|
@@ -361,6 +398,16 @@ type TxWidgetWCAttributes = {
|
|
|
361
398
|
"light-theme": WidgetIntegrationPayload["lightTheme"];
|
|
362
399
|
"default-wallet-picker": WidgetIntegrationPayload["defaultWalletPicker"];
|
|
363
400
|
styles: string | undefined;
|
|
401
|
+
"on-pending-transactions-change"?: WidgetIntegrationPayload["onPendingTransactionsChange"];
|
|
402
|
+
"dst-token-locked": WidgetIntegrationPayload["dstTokenLocked"] | undefined;
|
|
403
|
+
"dst-chain-locked": WidgetIntegrationPayload["dstChainLocked"] | undefined;
|
|
404
|
+
"src-token-locked": WidgetIntegrationPayload["srcTokenLocked"] | undefined;
|
|
405
|
+
"src-chain-locked": WidgetIntegrationPayload["srcChainLocked"] | undefined;
|
|
406
|
+
"on-dst-token-change"?: WidgetIntegrationPayload["onDstTokenChange"];
|
|
407
|
+
"on-dst-chain-change"?: WidgetIntegrationPayload["onDstChainChange"];
|
|
408
|
+
"on-src-token-change"?: WidgetIntegrationPayload["onSrcTokenChange"];
|
|
409
|
+
"on-src-chain-change"?: WidgetIntegrationPayload["onSrcChainChange"];
|
|
410
|
+
bridge: WidgetIntegrationPayload["bridge"] | undefined;
|
|
364
411
|
};
|
|
365
412
|
|
|
366
413
|
declare global {
|
|
@@ -370,7 +417,7 @@ declare global {
|
|
|
370
417
|
}
|
|
371
418
|
}
|
|
372
419
|
}
|
|
373
|
-
declare const TxWidgetWCWrapped: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, }: WidgetIntegrationPayload) => react_jsx_runtime.JSX.Element;
|
|
420
|
+
declare const TxWidgetWCWrapped: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, onPendingTransactionsChange, dstTokenLocked, dstChainLocked, srcTokenLocked, srcChainLocked, onDstTokenChange, onDstChainChange, onSrcTokenChange, onSrcChainChange, bridge, }: WidgetIntegrationPayload) => react_jsx_runtime.JSX.Element;
|
|
374
421
|
|
|
375
422
|
interface EvmHandlers {
|
|
376
423
|
onSuccess?: (data: ContractReceipt) => void;
|
|
@@ -421,14 +468,19 @@ type TxStats = {
|
|
|
421
468
|
cashback?: string;
|
|
422
469
|
};
|
|
423
470
|
|
|
424
|
-
|
|
471
|
+
type XSwapConfig = {
|
|
472
|
+
apiUrl: string;
|
|
473
|
+
localCss: boolean;
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
declare const openTransactionModal: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, onPendingTransactionsChange, dstTokenLocked, dstChainLocked, srcTokenLocked, srcChainLocked, onDstTokenChange, onDstChainChange, onSrcTokenChange, onSrcChainChange, bridge, }: ModalIntegrationPayload) => Promise<void>;
|
|
425
477
|
|
|
426
478
|
declare const TxWidgetWC: CustomElementConstructor;
|
|
427
479
|
|
|
428
480
|
declare const XPay: {
|
|
429
|
-
openTransactionModal: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, }: ModalIntegrationPayload) => Promise<void>;
|
|
430
|
-
TxWidget: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, }: WidgetIntegrationPayload) => react_jsx_runtime.JSX.Element;
|
|
481
|
+
openTransactionModal: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, onPendingTransactionsChange, dstTokenLocked, dstChainLocked, srcTokenLocked, srcChainLocked, onDstTokenChange, onDstChainChange, onSrcTokenChange, onSrcChainChange, bridge, }: ModalIntegrationPayload) => Promise<void>;
|
|
482
|
+
TxWidget: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, onPendingTransactionsChange, dstTokenLocked, dstChainLocked, srcTokenLocked, srcChainLocked, onDstTokenChange, onDstChainChange, onSrcTokenChange, onSrcChainChange, bridge, }: WidgetIntegrationPayload) => react_jsx_runtime.JSX.Element;
|
|
431
483
|
TxWidgetWC: CustomElementConstructor;
|
|
432
484
|
};
|
|
433
485
|
|
|
434
|
-
export { type AddReferralPayload, type Addresses, type BridgeToken, type Chain, type CoinTypeAddress, type CollectFees, type ContractCall, ContractName, type Contracts, Ecosystem, type EnqueueTxProps, Environment, type GenerateStakingCallsParams, type GetFinishedLeaderboardQuestsPayload, type GetLeaderboardChangePayload, type GetPricesPayload, type GetRoutePayload, type GetTokenBalancesPayload, type HistoryTransaction, type ImportedTokenData, type ModalIntegrationPayload, type ModalIntegrationStyles, type ModalIntegrationThemeStyles, type MonitoredTransaction, type Prices, type Protocol, type Referral, type ReferralInfo, type Route, type Token, type TokenBalances, type TokenOption, type TokenPrices, type Transaction, type TransactionHistory, type TransactionRequest, type TransactionStatus, type Transactions, type TxConfigFormData, type TxStats, TxStatus, type TxUIWrapperState, TxWidgetWCWrapped as TxWidget, TxWidgetWC, Web3Environment, type WidgetIntegrationPayload, XSwapCallType, type XSwapConfig, type XSwapFee, type XSwapFees, XPay as default, openTransactionModal };
|
|
486
|
+
export { type AddReferralPayload, type Addresses, type BridgeToken, type BridgeTokensDictionary, type Chain, type CoinTypeAddress, type CollectFees, type ContractCall, ContractName, type Contracts, Ecosystem, type EnqueueTxProps, Environment, type GenerateStakingCallsParams, type GetFinishedLeaderboardQuestsPayload, type GetLeaderboardChangePayload, type GetPricesPayload, type GetRoutePayload, type GetTokenBalancesPayload, type HistoryTransaction, type ImportedTokenData, type ModalIntegrationPayload, type ModalIntegrationStyles, type ModalIntegrationThemeStyles, type MonitoredTransaction, type Prices, type Protocol, type Referral, type ReferralInfo, type Route, type Token, type TokenBalances, type TokenOption, type TokenPrices, type Transaction, type TransactionHistory, type TransactionRequest, type TransactionStatus, type Transactions, type TxConfigFormData, type TxStats, TxStatus, type TxUIWrapperState, TxWidgetWCWrapped as TxWidget, TxWidgetWC, Web3Environment, type WidgetIntegrationPayload, XSwapCallType, type XSwapConfig, type XSwapFee, type XSwapFees, XPay as default, openTransactionModal };
|