@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.
Files changed (70) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/index.d.mts +10 -2
  3. package/dist/index.d.ts +10 -2
  4. package/dist/index.global.js +87 -86
  5. package/dist/index.js +2888 -2521
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +2828 -2458
  8. package/dist/index.mjs.map +1 -1
  9. package/localTheme.ts +5 -3
  10. package/package.json +1 -1
  11. package/src/assets/icons/AdjustmentsIcon.tsx +16 -0
  12. package/src/assets/icons/CaretDownIcon.tsx +12 -0
  13. package/src/assets/icons/CaretsUpDownIcon.tsx +13 -0
  14. package/src/assets/icons/ChainlinkMarkIcon.tsx +17 -0
  15. package/src/assets/icons/ClockIcon.tsx +14 -0
  16. package/src/assets/icons/CloseIcon.tsx +6 -2
  17. package/src/assets/icons/WarningIcon.tsx +19 -0
  18. package/src/assets/icons/index.ts +6 -0
  19. package/src/components/Modal/index.tsx +14 -9
  20. package/src/components/PoweredBy/index.tsx +12 -5
  21. package/src/components/Swap/Header/Controls/index.tsx +50 -36
  22. package/src/components/Swap/Header/index.tsx +12 -5
  23. package/src/components/Swap/HistoryView/ActivityCard/index.tsx +212 -0
  24. package/src/components/Swap/HistoryView/index.tsx +24 -6
  25. package/src/components/Swap/PickerView/index.tsx +151 -0
  26. package/src/components/Swap/ReorderButton/ReorderButton.tsx +5 -7
  27. package/src/components/Swap/SettingsView/Delivery/index.tsx +27 -28
  28. package/src/components/Swap/SettingsView/InfiniteApproval/index.tsx +27 -24
  29. package/src/components/Swap/SettingsView/Slippage/index.tsx +44 -43
  30. package/src/components/Swap/SettingsView/index.tsx +1 -1
  31. package/src/components/Swap/SwapView/ConfirmationView/TxOverview/index.tsx +50 -4
  32. package/src/components/Swap/SwapView/FeesPanel/DeliveryInfo/index.tsx +9 -19
  33. package/src/components/Swap/SwapView/FeesPanel/Fee/index.tsx +4 -4
  34. package/src/components/Swap/SwapView/FeesPanel/Fees/index.tsx +5 -9
  35. package/src/components/Swap/SwapView/FeesPanel/index.tsx +21 -22
  36. package/src/components/Swap/SwapView/SwapButton/index.tsx +25 -6
  37. package/src/components/Swap/SwapView/SwapPanel/AmountPanel/Balance/index.tsx +56 -12
  38. package/src/components/Swap/SwapView/SwapPanel/AmountPanel/index.tsx +42 -41
  39. package/src/components/Swap/SwapView/SwapPanel/TokenPanel/ChainPicker/index.tsx +143 -0
  40. package/src/components/Swap/SwapView/SwapPanel/TokenPanel/TokenPicker/NetworkFilter/index.tsx +159 -0
  41. package/src/components/Swap/SwapView/SwapPanel/TokenPanel/TokenPicker/TokenItem/index.tsx +105 -55
  42. package/src/components/Swap/SwapView/SwapPanel/TokenPanel/TokenPicker/index.tsx +226 -276
  43. package/src/components/Swap/SwapView/SwapPanel/TokenPanel/index.tsx +57 -97
  44. package/src/components/Swap/SwapView/SwapPanel/UsdValue/index.tsx +27 -0
  45. package/src/components/Swap/SwapView/SwapPanel/WalletPanel/index.tsx +60 -49
  46. package/src/components/Swap/SwapView/SwapPanel/index.tsx +20 -25
  47. package/src/components/Swap/SwapView/WalletPicker/index.tsx +6 -1
  48. package/src/components/Swap/SwapView/index.tsx +2 -1
  49. package/src/components/Swap/index.tsx +20 -4
  50. package/src/components/ToggleButton/index.tsx +18 -15
  51. package/src/components/TxConfigForm/index.tsx +5 -5
  52. package/src/components/TxWidgetWC/index.tsx +4 -0
  53. package/src/components/TxWidgetWCWrapped/index.tsx +2 -0
  54. package/src/context/HistoryProvider.tsx +2 -1
  55. package/src/context/SwapProvider.tsx +87 -62
  56. package/src/context/TxUIWrapper.tsx +3 -3
  57. package/src/hooks/useEvmContractApi.ts +28 -4
  58. package/src/models/TransactionHistory.ts +1 -0
  59. package/src/models/payloads/GetBalancesPayload.ts +1 -0
  60. package/src/models/payloads/ModalIntegrationPayload.ts +1 -0
  61. package/src/models/payloads/WidgetIntegrationPayload.ts +1 -0
  62. package/src/services/api.ts +37 -0
  63. package/src/utils/index.ts +48 -1
  64. package/src/utils/tokens.ts +20 -1
  65. package/tailwind.config.js +4 -1
  66. package/src/components/Swap/SwapView/SwapPanel/ChainPanel/ChainPicker/ChainItem/index.tsx +0 -97
  67. package/src/components/Swap/SwapView/SwapPanel/ChainPanel/ChainPicker/index.tsx +0 -103
  68. package/src/components/Swap/SwapView/SwapPanel/ChainPanel/index.tsx +0 -65
  69. package/src/components/Swap/SwapView/SwapPanel/MaxPanel/index.tsx +0 -43
  70. 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