@xswap-link/sdk 0.13.1 → 0.14.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 +22 -0
- package/dist/index.d.mts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.global.js +87 -86
- package/dist/index.js +2888 -2521
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2828 -2458
- package/dist/index.mjs.map +1 -1
- package/localTheme.ts +5 -3
- package/package.json +1 -1
- package/src/assets/icons/AdjustmentsIcon.tsx +16 -0
- package/src/assets/icons/CaretDownIcon.tsx +12 -0
- package/src/assets/icons/CaretsUpDownIcon.tsx +13 -0
- package/src/assets/icons/ChainlinkMarkIcon.tsx +17 -0
- package/src/assets/icons/ClockIcon.tsx +14 -0
- package/src/assets/icons/CloseIcon.tsx +6 -2
- package/src/assets/icons/WarningIcon.tsx +19 -0
- package/src/assets/icons/index.ts +6 -0
- package/src/components/Modal/index.tsx +14 -9
- package/src/components/PoweredBy/index.tsx +12 -5
- package/src/components/Swap/Header/Controls/index.tsx +50 -36
- package/src/components/Swap/Header/index.tsx +12 -5
- package/src/components/Swap/HistoryView/ActivityCard/index.tsx +212 -0
- package/src/components/Swap/HistoryView/index.tsx +24 -6
- package/src/components/Swap/PickerView/index.tsx +151 -0
- package/src/components/Swap/ReorderButton/ReorderButton.tsx +5 -7
- package/src/components/Swap/SettingsView/Delivery/index.tsx +27 -28
- package/src/components/Swap/SettingsView/InfiniteApproval/index.tsx +27 -24
- package/src/components/Swap/SettingsView/Slippage/index.tsx +44 -43
- package/src/components/Swap/SettingsView/index.tsx +1 -1
- package/src/components/Swap/SwapView/ConfirmationView/TxOverview/index.tsx +50 -4
- package/src/components/Swap/SwapView/FeesPanel/DeliveryInfo/index.tsx +9 -19
- package/src/components/Swap/SwapView/FeesPanel/Fee/index.tsx +4 -4
- package/src/components/Swap/SwapView/FeesPanel/Fees/index.tsx +5 -9
- package/src/components/Swap/SwapView/FeesPanel/index.tsx +21 -22
- package/src/components/Swap/SwapView/SwapButton/index.tsx +25 -6
- package/src/components/Swap/SwapView/SwapPanel/AmountPanel/Balance/index.tsx +56 -12
- package/src/components/Swap/SwapView/SwapPanel/AmountPanel/index.tsx +42 -41
- package/src/components/Swap/SwapView/SwapPanel/TokenPanel/ChainPicker/index.tsx +143 -0
- package/src/components/Swap/SwapView/SwapPanel/TokenPanel/TokenPicker/NetworkFilter/index.tsx +159 -0
- package/src/components/Swap/SwapView/SwapPanel/TokenPanel/TokenPicker/TokenItem/index.tsx +105 -55
- package/src/components/Swap/SwapView/SwapPanel/TokenPanel/TokenPicker/index.tsx +226 -276
- package/src/components/Swap/SwapView/SwapPanel/TokenPanel/index.tsx +57 -97
- package/src/components/Swap/SwapView/SwapPanel/UsdValue/index.tsx +27 -0
- package/src/components/Swap/SwapView/SwapPanel/WalletPanel/index.tsx +60 -49
- package/src/components/Swap/SwapView/SwapPanel/index.tsx +20 -25
- package/src/components/Swap/SwapView/WalletPicker/index.tsx +6 -1
- package/src/components/Swap/SwapView/index.tsx +2 -1
- package/src/components/Swap/index.tsx +20 -4
- package/src/components/ToggleButton/index.tsx +18 -15
- package/src/components/TxConfigForm/index.tsx +5 -5
- package/src/components/TxWidgetWC/index.tsx +4 -0
- package/src/components/TxWidgetWCWrapped/index.tsx +2 -0
- package/src/context/HistoryProvider.tsx +2 -1
- package/src/context/SwapProvider.tsx +87 -62
- package/src/context/TxUIWrapper.tsx +3 -3
- package/src/hooks/useEvmContractApi.ts +28 -4
- package/src/models/TransactionHistory.ts +1 -0
- package/src/models/payloads/GetBalancesPayload.ts +1 -0
- package/src/models/payloads/ModalIntegrationPayload.ts +1 -0
- package/src/models/payloads/WidgetIntegrationPayload.ts +1 -0
- package/src/services/api.ts +37 -0
- package/src/utils/index.ts +48 -1
- package/src/utils/tokens.ts +20 -1
- package/tailwind.config.js +4 -1
- package/src/components/Swap/SwapView/SwapPanel/ChainPanel/ChainPicker/ChainItem/index.tsx +0 -97
- package/src/components/Swap/SwapView/SwapPanel/ChainPanel/ChainPicker/index.tsx +0 -103
- package/src/components/Swap/SwapView/SwapPanel/ChainPanel/index.tsx +0 -65
- package/src/components/Swap/SwapView/SwapPanel/MaxPanel/index.tsx +0 -43
- package/src/components/Swap/SwapView/SwapPanel/TokenPanel/TokenPicker/QuickPickTokenItem/index.tsx +0 -37
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @xswap-link/xswap-sdk
|
|
2
2
|
|
|
3
|
+
## 0.14.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 086dc6f: restored destination chain selection in bridge mode via a network picker on the destination panel
|
|
8
|
+
- 086dc6f: custom token import now resolves the pasted address on the network selected in the token picker filter instead of the swap panel chain
|
|
9
|
+
- 086dc6f: already imported tokens are recognized in the token picker right after import — searching their address shows them on the list instead of the import flow again, and they are searchable by name/symbol
|
|
10
|
+
- 086dc6f: balances fetch passes user-imported tokens from localStorage so the backend resolves their balances too; importing a token triggers a balances refetch
|
|
11
|
+
- 086dc6f: after an approval, poll the token allowance until the RPC sees the approved amount (up to ~5s) before sending the swap, and retry the swap's gas estimation with backoff (0.5s/1s/2s) as a fallback — fixes swaps failing right after approval on lagging RPC nodes
|
|
12
|
+
- 086dc6f: widget scales down on mobile again — fixed width is applied only when the integrator sets --modal-width, otherwise the widget fills its container up to the 620px cap
|
|
13
|
+
- 086dc6f: selected token balance refresh uses the backend tokenBalance endpoint instead of public RPCs
|
|
14
|
+
- 086dc6f: aligned the widget with the swap-v2 design: glass container (rounded-32, blur-48), lavender primary button with dark text, "POWERED BY CCIP." footer, fee row "/ Est. Time" format, stronger source panel border, "Balance." label, in-place picker views on desktop with bottom sheets on mobile, stacked network filter logos
|
|
15
|
+
- 086dc6f: replaced header (adjustments, clock) and close icons with the swap-v2 design versions
|
|
16
|
+
- 086dc6f: custom token import fetches metadata (name, symbol, decimals) from the backend tokenMetadata endpoint instead of querying public RPCs directly
|
|
17
|
+
|
|
18
|
+
## 0.14.0
|
|
19
|
+
|
|
20
|
+
### Minor Changes
|
|
21
|
+
|
|
22
|
+
- fd459b4: Swap widget v2 redesign: new card layout with wallet chips on Source/Destination panels, MAX pill, merged token+network picker with embedded network filter and cross-side reset warnings, Preferences view (Fast Delivery / Persistent Access / Price Tolerance) with accent-blue toggles, My Activity view with new transaction cards, collapsible fee breakdown, accent-gradient CTA, Connect SUI Wallet button state, and a new optional `widgetTitle` prop.
|
|
23
|
+
- 69dd316: new token picker view
|
|
24
|
+
|
|
3
25
|
## 0.13.1
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -93,6 +93,10 @@ type GenerateStakingCallsParams = {
|
|
|
93
93
|
type GetTokenBalancesPayload = {
|
|
94
94
|
walletAddress?: string;
|
|
95
95
|
solanaWalletAddress?: string;
|
|
96
|
+
customTokens?: {
|
|
97
|
+
chainId: string;
|
|
98
|
+
tokenAddress: string;
|
|
99
|
+
}[];
|
|
96
100
|
};
|
|
97
101
|
|
|
98
102
|
type GetLeaderboardChangePayload = {
|
|
@@ -179,6 +183,7 @@ type ModalIntegrationPayload = {
|
|
|
179
183
|
srcToken?: string;
|
|
180
184
|
customContractCalls?: ContractCall[];
|
|
181
185
|
desc?: string;
|
|
186
|
+
widgetTitle?: string;
|
|
182
187
|
dstDisplayToken?: string;
|
|
183
188
|
lightTheme?: boolean;
|
|
184
189
|
defaultWalletPicker?: boolean;
|
|
@@ -217,6 +222,7 @@ type WidgetIntegrationPayload = {
|
|
|
217
222
|
srcToken?: string;
|
|
218
223
|
customContractCalls?: ContractCall[];
|
|
219
224
|
desc?: string;
|
|
225
|
+
widgetTitle?: string;
|
|
220
226
|
dstDisplayToken?: string;
|
|
221
227
|
lightTheme?: boolean;
|
|
222
228
|
defaultWalletPicker?: boolean;
|
|
@@ -391,6 +397,7 @@ type HistoryTransaction = {
|
|
|
391
397
|
type TransactionStatus = "IN_PROGRESS" | "DONE" | "REVERTED" | "NOT_FOUND";
|
|
392
398
|
type Transaction = {
|
|
393
399
|
messageId?: string;
|
|
400
|
+
receiver?: string;
|
|
394
401
|
hash: string;
|
|
395
402
|
timestamp: number;
|
|
396
403
|
sourceChainId: string;
|
|
@@ -423,6 +430,7 @@ type TxWidgetWCAttributes = {
|
|
|
423
430
|
"src-token": WidgetIntegrationPayload["srcToken"];
|
|
424
431
|
"custom-contract-calls": string | undefined;
|
|
425
432
|
desc: WidgetIntegrationPayload["desc"];
|
|
433
|
+
"widget-title": WidgetIntegrationPayload["widgetTitle"];
|
|
426
434
|
"dst-display-token": WidgetIntegrationPayload["dstDisplayToken"];
|
|
427
435
|
"light-theme": WidgetIntegrationPayload["lightTheme"];
|
|
428
436
|
"default-wallet-picker": WidgetIntegrationPayload["defaultWalletPicker"];
|
|
@@ -450,7 +458,7 @@ declare global {
|
|
|
450
458
|
}
|
|
451
459
|
}
|
|
452
460
|
}
|
|
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, wagmiConfig, }: WidgetIntegrationPayload) => react_jsx_runtime.JSX.Element;
|
|
461
|
+
declare const TxWidgetWCWrapped: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, widgetTitle, dstDisplayToken, lightTheme, defaultWalletPicker, styles, onPendingTransactionsChange, dstTokenLocked, dstChainLocked, srcTokenLocked, srcChainLocked, onDstTokenChange, onDstChainChange, onSrcTokenChange, onSrcChainChange, onConnectWallet, bridge, override, integratorFee, integratorFeeReceiverAddress, highlightedDstTokens, wagmiConfig, }: WidgetIntegrationPayload) => react_jsx_runtime.JSX.Element;
|
|
454
462
|
|
|
455
463
|
interface EvmHandlers {
|
|
456
464
|
onSuccess?: (data: ContractReceipt) => void;
|
|
@@ -512,7 +520,7 @@ declare const TxWidgetWC: CustomElementConstructor;
|
|
|
512
520
|
|
|
513
521
|
declare const XPay: {
|
|
514
522
|
openTransactionModal: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, onPendingTransactionsChange, dstTokenLocked, dstChainLocked, srcTokenLocked, srcChainLocked, onDstTokenChange, onDstChainChange, onSrcTokenChange, onSrcChainChange, bridge, highlightedDstTokens, wagmiConfig, }: 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, wagmiConfig, }: WidgetIntegrationPayload) => react_jsx_runtime.JSX.Element;
|
|
523
|
+
TxWidget: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, widgetTitle, dstDisplayToken, lightTheme, defaultWalletPicker, styles, onPendingTransactionsChange, dstTokenLocked, dstChainLocked, srcTokenLocked, srcChainLocked, onDstTokenChange, onDstChainChange, onSrcTokenChange, onSrcChainChange, onConnectWallet, bridge, override, integratorFee, integratorFeeReceiverAddress, highlightedDstTokens, wagmiConfig, }: WidgetIntegrationPayload) => react_jsx_runtime.JSX.Element;
|
|
516
524
|
TxWidgetWC: CustomElementConstructor;
|
|
517
525
|
};
|
|
518
526
|
|
package/dist/index.d.ts
CHANGED
|
@@ -93,6 +93,10 @@ type GenerateStakingCallsParams = {
|
|
|
93
93
|
type GetTokenBalancesPayload = {
|
|
94
94
|
walletAddress?: string;
|
|
95
95
|
solanaWalletAddress?: string;
|
|
96
|
+
customTokens?: {
|
|
97
|
+
chainId: string;
|
|
98
|
+
tokenAddress: string;
|
|
99
|
+
}[];
|
|
96
100
|
};
|
|
97
101
|
|
|
98
102
|
type GetLeaderboardChangePayload = {
|
|
@@ -179,6 +183,7 @@ type ModalIntegrationPayload = {
|
|
|
179
183
|
srcToken?: string;
|
|
180
184
|
customContractCalls?: ContractCall[];
|
|
181
185
|
desc?: string;
|
|
186
|
+
widgetTitle?: string;
|
|
182
187
|
dstDisplayToken?: string;
|
|
183
188
|
lightTheme?: boolean;
|
|
184
189
|
defaultWalletPicker?: boolean;
|
|
@@ -217,6 +222,7 @@ type WidgetIntegrationPayload = {
|
|
|
217
222
|
srcToken?: string;
|
|
218
223
|
customContractCalls?: ContractCall[];
|
|
219
224
|
desc?: string;
|
|
225
|
+
widgetTitle?: string;
|
|
220
226
|
dstDisplayToken?: string;
|
|
221
227
|
lightTheme?: boolean;
|
|
222
228
|
defaultWalletPicker?: boolean;
|
|
@@ -391,6 +397,7 @@ type HistoryTransaction = {
|
|
|
391
397
|
type TransactionStatus = "IN_PROGRESS" | "DONE" | "REVERTED" | "NOT_FOUND";
|
|
392
398
|
type Transaction = {
|
|
393
399
|
messageId?: string;
|
|
400
|
+
receiver?: string;
|
|
394
401
|
hash: string;
|
|
395
402
|
timestamp: number;
|
|
396
403
|
sourceChainId: string;
|
|
@@ -423,6 +430,7 @@ type TxWidgetWCAttributes = {
|
|
|
423
430
|
"src-token": WidgetIntegrationPayload["srcToken"];
|
|
424
431
|
"custom-contract-calls": string | undefined;
|
|
425
432
|
desc: WidgetIntegrationPayload["desc"];
|
|
433
|
+
"widget-title": WidgetIntegrationPayload["widgetTitle"];
|
|
426
434
|
"dst-display-token": WidgetIntegrationPayload["dstDisplayToken"];
|
|
427
435
|
"light-theme": WidgetIntegrationPayload["lightTheme"];
|
|
428
436
|
"default-wallet-picker": WidgetIntegrationPayload["defaultWalletPicker"];
|
|
@@ -450,7 +458,7 @@ declare global {
|
|
|
450
458
|
}
|
|
451
459
|
}
|
|
452
460
|
}
|
|
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, wagmiConfig, }: WidgetIntegrationPayload) => react_jsx_runtime.JSX.Element;
|
|
461
|
+
declare const TxWidgetWCWrapped: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, widgetTitle, dstDisplayToken, lightTheme, defaultWalletPicker, styles, onPendingTransactionsChange, dstTokenLocked, dstChainLocked, srcTokenLocked, srcChainLocked, onDstTokenChange, onDstChainChange, onSrcTokenChange, onSrcChainChange, onConnectWallet, bridge, override, integratorFee, integratorFeeReceiverAddress, highlightedDstTokens, wagmiConfig, }: WidgetIntegrationPayload) => react_jsx_runtime.JSX.Element;
|
|
454
462
|
|
|
455
463
|
interface EvmHandlers {
|
|
456
464
|
onSuccess?: (data: ContractReceipt) => void;
|
|
@@ -512,7 +520,7 @@ declare const TxWidgetWC: CustomElementConstructor;
|
|
|
512
520
|
|
|
513
521
|
declare const XPay: {
|
|
514
522
|
openTransactionModal: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, dstDisplayToken, lightTheme, defaultWalletPicker, styles, onPendingTransactionsChange, dstTokenLocked, dstChainLocked, srcTokenLocked, srcChainLocked, onDstTokenChange, onDstChainChange, onSrcTokenChange, onSrcChainChange, bridge, highlightedDstTokens, wagmiConfig, }: 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, wagmiConfig, }: WidgetIntegrationPayload) => react_jsx_runtime.JSX.Element;
|
|
523
|
+
TxWidget: ({ integratorId, dstChain, dstToken, srcChain, srcToken, customContractCalls, desc, widgetTitle, dstDisplayToken, lightTheme, defaultWalletPicker, styles, onPendingTransactionsChange, dstTokenLocked, dstChainLocked, srcTokenLocked, srcChainLocked, onDstTokenChange, onDstChainChange, onSrcTokenChange, onSrcChainChange, onConnectWallet, bridge, override, integratorFee, integratorFeeReceiverAddress, highlightedDstTokens, wagmiConfig, }: WidgetIntegrationPayload) => react_jsx_runtime.JSX.Element;
|
|
516
524
|
TxWidgetWC: CustomElementConstructor;
|
|
517
525
|
};
|
|
518
526
|
|