@xswap-link/sdk 0.10.5 → 0.10.7
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/.github/workflows/main.yml +1 -1
- package/CHANGELOG.md +13 -0
- package/dist/index.d.mts +46 -12
- package/dist/index.d.ts +46 -12
- package/dist/index.global.js +5290 -261
- package/dist/index.js +9 -9
- package/dist/index.mjs +9 -9
- package/package.json +13 -2
- package/src/assets/icons/StarsIcon.tsx +18 -0
- package/src/assets/icons/index.ts +1 -0
- package/src/components/AllWalletsConfig/index.tsx +40 -0
- package/src/components/Swap/HistoryView/index.tsx +28 -5
- package/src/components/Swap/SwapView/ConfirmationView/TxOverview/index.tsx +73 -47
- package/src/components/Swap/SwapView/SwapButton/index.tsx +45 -10
- package/src/components/Swap/SwapView/SwapPanel/TokenPanel/TokenPicker/TokenItem/index.tsx +20 -2
- package/src/components/Swap/SwapView/SwapPanel/TokenPanel/TokenPicker/index.tsx +124 -4
- package/src/components/Swap/SwapView/SwapPanel/WalletPanel/index.tsx +71 -0
- package/src/components/Swap/SwapView/SwapPanel/index.tsx +4 -0
- package/src/components/Swap/SwapView/WalletPicker/index.tsx +63 -28
- package/src/components/Swap/index.tsx +2 -2
- package/src/components/TxConfigForm/index.tsx +12 -34
- package/src/components/TxDataCard/TxDataCardUI/index.tsx +16 -10
- package/src/components/TxDataCard/index.tsx +1 -0
- package/src/components/TxWidgetWC/index.tsx +4 -0
- package/src/components/TxWidgetWCWrapped/index.tsx +2 -0
- package/src/components/index.ts +1 -0
- package/src/config/wagmiConfig.ts +1 -6
- package/src/constants/index.ts +14 -0
- package/src/context/HistoryProvider.tsx +121 -25
- package/src/context/SwapProvider.tsx +104 -48
- package/src/context/TransactionProvider.tsx +60 -1
- package/src/context/TxUIWrapper.tsx +187 -71
- package/src/context/WalletProvider.tsx +108 -0
- package/src/contracts/addresses.ts +4 -0
- package/src/contracts/idl/jupiter.ts +2879 -0
- package/src/models/Ecosystem.ts +1 -0
- package/src/models/Route.ts +14 -3
- package/src/models/SolanaTransaction.ts +38 -0
- package/src/models/SolanaWeb3Network.ts +5 -0
- package/src/models/TxUIWrapper.ts +8 -4
- package/src/models/index.ts +1 -0
- package/src/models/payloads/GetBalancesPayload.ts +2 -1
- package/src/models/payloads/GetSolanaRoutePayload.ts +8 -0
- package/src/models/payloads/ModalIntegrationPayload.ts +1 -0
- package/src/models/payloads/WidgetIntegrationPayload.ts +1 -0
- package/src/models/payloads/index.ts +1 -0
- package/src/services/api.ts +21 -3
- package/src/services/integrations/transactions.ts +2 -0
- package/src/services/solana/jupiter/extract-swap-data.ts +183 -0
- package/src/services/solana/jupiter/get-events.ts +37 -0
- package/src/services/solana/jupiter/instruction-parser.ts +217 -0
- package/src/services/solana/jupiter/utils.ts +37 -0
- package/src/utils/strings.ts +16 -0
- package/test/context/SwapProvider.test.tsx +6 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @xswap-link/xswap-sdk
|
|
2
2
|
|
|
3
|
+
## 0.10.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 17d0f13: Add icon to selected dst tokens
|
|
8
|
+
- be2a4cf: solana improvements
|
|
9
|
+
|
|
10
|
+
## 0.10.6
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- b335c59: Add icon to selected dst tokens
|
|
15
|
+
|
|
3
16
|
## 0.10.5
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { BigNumber, ContractReceipt, ContractTransaction } from 'ethers';
|
|
3
3
|
import { TransactionResponse } from '@ethersproject/providers';
|
|
4
|
+
import { VersionedTransaction } from '@solana/web3.js';
|
|
4
5
|
import { Dispatch, SetStateAction } from 'react';
|
|
5
6
|
|
|
6
7
|
type Addresses = {
|
|
@@ -61,7 +62,8 @@ type ContractCall = {
|
|
|
61
62
|
};
|
|
62
63
|
|
|
63
64
|
declare enum Ecosystem {
|
|
64
|
-
EVM = "evm"
|
|
65
|
+
EVM = "evm",
|
|
66
|
+
SOLANA = "solana"
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
declare enum Environment {
|
|
@@ -88,7 +90,8 @@ type GenerateStakingCallsParams = {
|
|
|
88
90
|
};
|
|
89
91
|
|
|
90
92
|
type GetTokenBalancesPayload = {
|
|
91
|
-
walletAddress
|
|
93
|
+
walletAddress?: string;
|
|
94
|
+
solanaWalletAddress?: string;
|
|
92
95
|
};
|
|
93
96
|
|
|
94
97
|
type GetLeaderboardChangePayload = {
|
|
@@ -126,6 +129,15 @@ type GetRoutePayload = {
|
|
|
126
129
|
integratorFeeReceiverAddress?: string;
|
|
127
130
|
};
|
|
128
131
|
|
|
132
|
+
type GetSolanaRoutePayload = {
|
|
133
|
+
integratorId: string;
|
|
134
|
+
fromToken: string;
|
|
135
|
+
toToken: string;
|
|
136
|
+
fromAmount: string;
|
|
137
|
+
fromAddress: string;
|
|
138
|
+
slippage: number;
|
|
139
|
+
};
|
|
140
|
+
|
|
129
141
|
type ModalIntegrationThemeStyles = {
|
|
130
142
|
mainAccentLight?: string;
|
|
131
143
|
mainAccentDark?: string;
|
|
@@ -195,6 +207,7 @@ type ModalIntegrationPayload = {
|
|
|
195
207
|
};
|
|
196
208
|
integratorFee?: number;
|
|
197
209
|
integratorFeeReceiverAddress?: string;
|
|
210
|
+
highlightedDstTokens?: string[];
|
|
198
211
|
};
|
|
199
212
|
|
|
200
213
|
type WidgetIntegrationPayload = {
|
|
@@ -231,6 +244,7 @@ type WidgetIntegrationPayload = {
|
|
|
231
244
|
};
|
|
232
245
|
integratorFee?: number;
|
|
233
246
|
integratorFeeReceiverAddress?: string;
|
|
247
|
+
highlightedDstTokens?: string[];
|
|
234
248
|
};
|
|
235
249
|
|
|
236
250
|
type Protocol = {
|
|
@@ -240,13 +254,21 @@ type Protocol = {
|
|
|
240
254
|
toTokenAddress: string;
|
|
241
255
|
};
|
|
242
256
|
|
|
243
|
-
|
|
257
|
+
interface BaseRoute {
|
|
244
258
|
estAmountOut: string;
|
|
245
259
|
minAmountOut: string;
|
|
246
|
-
transactions: Transactions;
|
|
247
260
|
xSwapFees: XSwapFees;
|
|
248
261
|
message?: string;
|
|
249
|
-
}
|
|
262
|
+
}
|
|
263
|
+
interface EVMRoute extends BaseRoute {
|
|
264
|
+
ecosystem: "evm";
|
|
265
|
+
transactions: Transactions;
|
|
266
|
+
}
|
|
267
|
+
interface SolanaRoute extends BaseRoute {
|
|
268
|
+
ecosystem: "solana";
|
|
269
|
+
swapTransaction: string;
|
|
270
|
+
}
|
|
271
|
+
type UnifiedRoute = EVMRoute | SolanaRoute;
|
|
250
272
|
type Transactions = {
|
|
251
273
|
approve?: TransactionRequest;
|
|
252
274
|
swap: TransactionRequest;
|
|
@@ -266,6 +288,12 @@ type XSwapFee = {
|
|
|
266
288
|
nativeFee: string;
|
|
267
289
|
};
|
|
268
290
|
|
|
291
|
+
declare enum SolanaWeb3Network {
|
|
292
|
+
DEVNET = "devnet",
|
|
293
|
+
TESTNET = "testnet",
|
|
294
|
+
MAINNET = "mainnet-beta"
|
|
295
|
+
}
|
|
296
|
+
|
|
269
297
|
declare enum Web3Environment {
|
|
270
298
|
DEVNET = "devnet",
|
|
271
299
|
TESTNET = "testnet",
|
|
@@ -412,6 +440,7 @@ type TxWidgetWCAttributes = {
|
|
|
412
440
|
override: string | undefined;
|
|
413
441
|
"integrator-fee": WidgetIntegrationPayload["integratorFee"] | undefined;
|
|
414
442
|
"integrator-fee-receiver-address": WidgetIntegrationPayload["integratorFeeReceiverAddress"] | undefined;
|
|
443
|
+
"highlighted-dst-tokens": string | undefined;
|
|
415
444
|
};
|
|
416
445
|
|
|
417
446
|
declare global {
|
|
@@ -421,19 +450,24 @@ declare global {
|
|
|
421
450
|
}
|
|
422
451
|
}
|
|
423
452
|
}
|
|
424
|
-
declare const TxWidgetWCWrapped: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, onPendingTransactionsChange, dstTokenLocked, dstChainLocked, srcTokenLocked, srcChainLocked, onDstTokenChange, onDstChainChange, onSrcTokenChange, onSrcChainChange, onConnectWallet, bridge, override, integratorFee, integratorFeeReceiverAddress, }: WidgetIntegrationPayload) => react_jsx_runtime.JSX.Element;
|
|
453
|
+
declare const TxWidgetWCWrapped: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, onPendingTransactionsChange, dstTokenLocked, dstChainLocked, srcTokenLocked, srcChainLocked, onDstTokenChange, onDstChainChange, onSrcTokenChange, onSrcChainChange, onConnectWallet, bridge, override, integratorFee, integratorFeeReceiverAddress, highlightedDstTokens, }: WidgetIntegrationPayload) => react_jsx_runtime.JSX.Element;
|
|
425
454
|
|
|
426
455
|
interface EvmHandlers {
|
|
427
456
|
onSuccess?: (data: ContractReceipt) => void;
|
|
428
457
|
onError?: <T>(data: T) => void;
|
|
429
458
|
onConfirm?: (data?: ContractTransaction) => void;
|
|
430
459
|
}
|
|
460
|
+
interface SolanaHandlers {
|
|
461
|
+
onSuccess?: (data: string) => void;
|
|
462
|
+
onError?: <T>(data: T) => void;
|
|
463
|
+
onConfirm?: (txHash?: string) => void;
|
|
464
|
+
}
|
|
431
465
|
|
|
432
466
|
type EnqueueTxProps = {
|
|
433
|
-
executeTransaction: () => Promise<TransactionResponse> | undefined;
|
|
467
|
+
executeTransaction: () => Promise<TransactionResponse | undefined> | Promise<VersionedTransaction | undefined> | undefined;
|
|
434
468
|
txStatus: TxStatus;
|
|
435
469
|
txMsg?: string;
|
|
436
|
-
handlers?: EvmHandlers;
|
|
470
|
+
handlers?: EvmHandlers | SolanaHandlers;
|
|
437
471
|
network?: Ecosystem;
|
|
438
472
|
showDefaultSuccessMessage?: boolean;
|
|
439
473
|
};
|
|
@@ -472,14 +506,14 @@ type TxStats = {
|
|
|
472
506
|
cashback?: string;
|
|
473
507
|
};
|
|
474
508
|
|
|
475
|
-
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>;
|
|
509
|
+
declare const openTransactionModal: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, onPendingTransactionsChange, dstTokenLocked, dstChainLocked, srcTokenLocked, srcChainLocked, onDstTokenChange, onDstChainChange, onSrcTokenChange, onSrcChainChange, bridge, highlightedDstTokens, }: ModalIntegrationPayload) => Promise<void>;
|
|
476
510
|
|
|
477
511
|
declare const TxWidgetWC: CustomElementConstructor;
|
|
478
512
|
|
|
479
513
|
declare const XPay: {
|
|
480
|
-
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>;
|
|
481
|
-
TxWidget: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, onPendingTransactionsChange, dstTokenLocked, dstChainLocked, srcTokenLocked, srcChainLocked, onDstTokenChange, onDstChainChange, onSrcTokenChange, onSrcChainChange, onConnectWallet, bridge, override, integratorFee, integratorFeeReceiverAddress, }: WidgetIntegrationPayload) => react_jsx_runtime.JSX.Element;
|
|
514
|
+
openTransactionModal: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, onPendingTransactionsChange, dstTokenLocked, dstChainLocked, srcTokenLocked, srcChainLocked, onDstTokenChange, onDstChainChange, onSrcTokenChange, onSrcChainChange, bridge, highlightedDstTokens, }: ModalIntegrationPayload) => Promise<void>;
|
|
515
|
+
TxWidget: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, onPendingTransactionsChange, dstTokenLocked, dstChainLocked, srcTokenLocked, srcChainLocked, onDstTokenChange, onDstChainChange, onSrcTokenChange, onSrcChainChange, onConnectWallet, bridge, override, integratorFee, integratorFeeReceiverAddress, highlightedDstTokens, }: WidgetIntegrationPayload) => react_jsx_runtime.JSX.Element;
|
|
482
516
|
TxWidgetWC: CustomElementConstructor;
|
|
483
517
|
};
|
|
484
518
|
|
|
485
|
-
export { type Addresses, type BridgeToken, type BridgeTokensDictionary, type Chain, type CoinTypeAddress, type CollectFees, type ContractCall, ContractName, type Contracts, Ecosystem, type EnqueueTxProps, Environment, type GenerateStakingCallsParams, 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
|
|
519
|
+
export { type Addresses, type BridgeToken, type BridgeTokensDictionary, type Chain, type CoinTypeAddress, type CollectFees, type ContractCall, ContractName, type Contracts, type EVMRoute, Ecosystem, type EnqueueTxProps, Environment, type GenerateStakingCallsParams, type GetLeaderboardChangePayload, type GetPricesPayload, type GetRoutePayload, type GetSolanaRoutePayload, type GetTokenBalancesPayload, type HistoryTransaction, type ImportedTokenData, type ModalIntegrationPayload, type ModalIntegrationStyles, type ModalIntegrationThemeStyles, type MonitoredTransaction, type Prices, type Protocol, type SolanaRoute, SolanaWeb3Network, 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, type UnifiedRoute, Web3Environment, type WidgetIntegrationPayload, XSwapCallType, type XSwapFee, type XSwapFees, XPay as default, openTransactionModal };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { BigNumber, ContractReceipt, ContractTransaction } from 'ethers';
|
|
3
3
|
import { TransactionResponse } from '@ethersproject/providers';
|
|
4
|
+
import { VersionedTransaction } from '@solana/web3.js';
|
|
4
5
|
import { Dispatch, SetStateAction } from 'react';
|
|
5
6
|
|
|
6
7
|
type Addresses = {
|
|
@@ -61,7 +62,8 @@ type ContractCall = {
|
|
|
61
62
|
};
|
|
62
63
|
|
|
63
64
|
declare enum Ecosystem {
|
|
64
|
-
EVM = "evm"
|
|
65
|
+
EVM = "evm",
|
|
66
|
+
SOLANA = "solana"
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
declare enum Environment {
|
|
@@ -88,7 +90,8 @@ type GenerateStakingCallsParams = {
|
|
|
88
90
|
};
|
|
89
91
|
|
|
90
92
|
type GetTokenBalancesPayload = {
|
|
91
|
-
walletAddress
|
|
93
|
+
walletAddress?: string;
|
|
94
|
+
solanaWalletAddress?: string;
|
|
92
95
|
};
|
|
93
96
|
|
|
94
97
|
type GetLeaderboardChangePayload = {
|
|
@@ -126,6 +129,15 @@ type GetRoutePayload = {
|
|
|
126
129
|
integratorFeeReceiverAddress?: string;
|
|
127
130
|
};
|
|
128
131
|
|
|
132
|
+
type GetSolanaRoutePayload = {
|
|
133
|
+
integratorId: string;
|
|
134
|
+
fromToken: string;
|
|
135
|
+
toToken: string;
|
|
136
|
+
fromAmount: string;
|
|
137
|
+
fromAddress: string;
|
|
138
|
+
slippage: number;
|
|
139
|
+
};
|
|
140
|
+
|
|
129
141
|
type ModalIntegrationThemeStyles = {
|
|
130
142
|
mainAccentLight?: string;
|
|
131
143
|
mainAccentDark?: string;
|
|
@@ -195,6 +207,7 @@ type ModalIntegrationPayload = {
|
|
|
195
207
|
};
|
|
196
208
|
integratorFee?: number;
|
|
197
209
|
integratorFeeReceiverAddress?: string;
|
|
210
|
+
highlightedDstTokens?: string[];
|
|
198
211
|
};
|
|
199
212
|
|
|
200
213
|
type WidgetIntegrationPayload = {
|
|
@@ -231,6 +244,7 @@ type WidgetIntegrationPayload = {
|
|
|
231
244
|
};
|
|
232
245
|
integratorFee?: number;
|
|
233
246
|
integratorFeeReceiverAddress?: string;
|
|
247
|
+
highlightedDstTokens?: string[];
|
|
234
248
|
};
|
|
235
249
|
|
|
236
250
|
type Protocol = {
|
|
@@ -240,13 +254,21 @@ type Protocol = {
|
|
|
240
254
|
toTokenAddress: string;
|
|
241
255
|
};
|
|
242
256
|
|
|
243
|
-
|
|
257
|
+
interface BaseRoute {
|
|
244
258
|
estAmountOut: string;
|
|
245
259
|
minAmountOut: string;
|
|
246
|
-
transactions: Transactions;
|
|
247
260
|
xSwapFees: XSwapFees;
|
|
248
261
|
message?: string;
|
|
249
|
-
}
|
|
262
|
+
}
|
|
263
|
+
interface EVMRoute extends BaseRoute {
|
|
264
|
+
ecosystem: "evm";
|
|
265
|
+
transactions: Transactions;
|
|
266
|
+
}
|
|
267
|
+
interface SolanaRoute extends BaseRoute {
|
|
268
|
+
ecosystem: "solana";
|
|
269
|
+
swapTransaction: string;
|
|
270
|
+
}
|
|
271
|
+
type UnifiedRoute = EVMRoute | SolanaRoute;
|
|
250
272
|
type Transactions = {
|
|
251
273
|
approve?: TransactionRequest;
|
|
252
274
|
swap: TransactionRequest;
|
|
@@ -266,6 +288,12 @@ type XSwapFee = {
|
|
|
266
288
|
nativeFee: string;
|
|
267
289
|
};
|
|
268
290
|
|
|
291
|
+
declare enum SolanaWeb3Network {
|
|
292
|
+
DEVNET = "devnet",
|
|
293
|
+
TESTNET = "testnet",
|
|
294
|
+
MAINNET = "mainnet-beta"
|
|
295
|
+
}
|
|
296
|
+
|
|
269
297
|
declare enum Web3Environment {
|
|
270
298
|
DEVNET = "devnet",
|
|
271
299
|
TESTNET = "testnet",
|
|
@@ -412,6 +440,7 @@ type TxWidgetWCAttributes = {
|
|
|
412
440
|
override: string | undefined;
|
|
413
441
|
"integrator-fee": WidgetIntegrationPayload["integratorFee"] | undefined;
|
|
414
442
|
"integrator-fee-receiver-address": WidgetIntegrationPayload["integratorFeeReceiverAddress"] | undefined;
|
|
443
|
+
"highlighted-dst-tokens": string | undefined;
|
|
415
444
|
};
|
|
416
445
|
|
|
417
446
|
declare global {
|
|
@@ -421,19 +450,24 @@ declare global {
|
|
|
421
450
|
}
|
|
422
451
|
}
|
|
423
452
|
}
|
|
424
|
-
declare const TxWidgetWCWrapped: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, onPendingTransactionsChange, dstTokenLocked, dstChainLocked, srcTokenLocked, srcChainLocked, onDstTokenChange, onDstChainChange, onSrcTokenChange, onSrcChainChange, onConnectWallet, bridge, override, integratorFee, integratorFeeReceiverAddress, }: WidgetIntegrationPayload) => react_jsx_runtime.JSX.Element;
|
|
453
|
+
declare const TxWidgetWCWrapped: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, onPendingTransactionsChange, dstTokenLocked, dstChainLocked, srcTokenLocked, srcChainLocked, onDstTokenChange, onDstChainChange, onSrcTokenChange, onSrcChainChange, onConnectWallet, bridge, override, integratorFee, integratorFeeReceiverAddress, highlightedDstTokens, }: WidgetIntegrationPayload) => react_jsx_runtime.JSX.Element;
|
|
425
454
|
|
|
426
455
|
interface EvmHandlers {
|
|
427
456
|
onSuccess?: (data: ContractReceipt) => void;
|
|
428
457
|
onError?: <T>(data: T) => void;
|
|
429
458
|
onConfirm?: (data?: ContractTransaction) => void;
|
|
430
459
|
}
|
|
460
|
+
interface SolanaHandlers {
|
|
461
|
+
onSuccess?: (data: string) => void;
|
|
462
|
+
onError?: <T>(data: T) => void;
|
|
463
|
+
onConfirm?: (txHash?: string) => void;
|
|
464
|
+
}
|
|
431
465
|
|
|
432
466
|
type EnqueueTxProps = {
|
|
433
|
-
executeTransaction: () => Promise<TransactionResponse> | undefined;
|
|
467
|
+
executeTransaction: () => Promise<TransactionResponse | undefined> | Promise<VersionedTransaction | undefined> | undefined;
|
|
434
468
|
txStatus: TxStatus;
|
|
435
469
|
txMsg?: string;
|
|
436
|
-
handlers?: EvmHandlers;
|
|
470
|
+
handlers?: EvmHandlers | SolanaHandlers;
|
|
437
471
|
network?: Ecosystem;
|
|
438
472
|
showDefaultSuccessMessage?: boolean;
|
|
439
473
|
};
|
|
@@ -472,14 +506,14 @@ type TxStats = {
|
|
|
472
506
|
cashback?: string;
|
|
473
507
|
};
|
|
474
508
|
|
|
475
|
-
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>;
|
|
509
|
+
declare const openTransactionModal: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, onPendingTransactionsChange, dstTokenLocked, dstChainLocked, srcTokenLocked, srcChainLocked, onDstTokenChange, onDstChainChange, onSrcTokenChange, onSrcChainChange, bridge, highlightedDstTokens, }: ModalIntegrationPayload) => Promise<void>;
|
|
476
510
|
|
|
477
511
|
declare const TxWidgetWC: CustomElementConstructor;
|
|
478
512
|
|
|
479
513
|
declare const XPay: {
|
|
480
|
-
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>;
|
|
481
|
-
TxWidget: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, onPendingTransactionsChange, dstTokenLocked, dstChainLocked, srcTokenLocked, srcChainLocked, onDstTokenChange, onDstChainChange, onSrcTokenChange, onSrcChainChange, onConnectWallet, bridge, override, integratorFee, integratorFeeReceiverAddress, }: WidgetIntegrationPayload) => react_jsx_runtime.JSX.Element;
|
|
514
|
+
openTransactionModal: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, onPendingTransactionsChange, dstTokenLocked, dstChainLocked, srcTokenLocked, srcChainLocked, onDstTokenChange, onDstChainChange, onSrcTokenChange, onSrcChainChange, bridge, highlightedDstTokens, }: ModalIntegrationPayload) => Promise<void>;
|
|
515
|
+
TxWidget: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, onPendingTransactionsChange, dstTokenLocked, dstChainLocked, srcTokenLocked, srcChainLocked, onDstTokenChange, onDstChainChange, onSrcTokenChange, onSrcChainChange, onConnectWallet, bridge, override, integratorFee, integratorFeeReceiverAddress, highlightedDstTokens, }: WidgetIntegrationPayload) => react_jsx_runtime.JSX.Element;
|
|
482
516
|
TxWidgetWC: CustomElementConstructor;
|
|
483
517
|
};
|
|
484
518
|
|
|
485
|
-
export { type Addresses, type BridgeToken, type BridgeTokensDictionary, type Chain, type CoinTypeAddress, type CollectFees, type ContractCall, ContractName, type Contracts, Ecosystem, type EnqueueTxProps, Environment, type GenerateStakingCallsParams, 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
|
|
519
|
+
export { type Addresses, type BridgeToken, type BridgeTokensDictionary, type Chain, type CoinTypeAddress, type CollectFees, type ContractCall, ContractName, type Contracts, type EVMRoute, Ecosystem, type EnqueueTxProps, Environment, type GenerateStakingCallsParams, type GetLeaderboardChangePayload, type GetPricesPayload, type GetRoutePayload, type GetSolanaRoutePayload, type GetTokenBalancesPayload, type HistoryTransaction, type ImportedTokenData, type ModalIntegrationPayload, type ModalIntegrationStyles, type ModalIntegrationThemeStyles, type MonitoredTransaction, type Prices, type Protocol, type SolanaRoute, SolanaWeb3Network, 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, type UnifiedRoute, Web3Environment, type WidgetIntegrationPayload, XSwapCallType, type XSwapFee, type XSwapFees, XPay as default, openTransactionModal };
|