@xswap-link/sdk 0.15.0 → 0.15.2

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 (58) hide show
  1. package/.eslintrc.json +1 -0
  2. package/CHANGELOG.md +16 -0
  3. package/README.md +22 -4
  4. package/dist/index.d.mts +47 -1
  5. package/dist/index.d.ts +47 -1
  6. package/dist/index.global.js +94 -88
  7. package/dist/index.js +1378 -985
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +1256 -863
  10. package/dist/index.mjs.map +1 -1
  11. package/example/index.html +12 -0
  12. package/example/package.json +24 -0
  13. package/example/pnpm-lock.yaml +1164 -0
  14. package/example/src/App.tsx +421 -0
  15. package/example/src/main.tsx +8 -0
  16. package/example/vite.config.ts +9 -0
  17. package/package.json +2 -1
  18. package/postcss.config.js +2 -0
  19. package/src/assets/icons/ChevronRightThinIcon.tsx +23 -0
  20. package/src/assets/icons/InfoThinIcon.tsx +33 -0
  21. package/src/assets/icons/RedirectThinIcon.tsx +15 -0
  22. package/src/assets/icons/index.ts +3 -0
  23. package/src/components/Swap/Header/index.tsx +3 -1
  24. package/src/components/Swap/HistoryView/ActivityCard/index.tsx +2 -2
  25. package/src/components/Swap/ReorderButton/ReorderButton.tsx +4 -1
  26. package/src/components/Swap/SettingsView/Delivery/index.tsx +3 -3
  27. package/src/components/Swap/SettingsView/InfiniteApproval/index.tsx +3 -3
  28. package/src/components/Swap/SettingsView/Slippage/index.tsx +5 -3
  29. package/src/components/Swap/SwapView/ConfirmationView/TokenTiles/index.tsx +5 -2
  30. package/src/components/Swap/SwapView/ConfirmationView/TxOverview/Header/index.tsx +1 -1
  31. package/src/components/Swap/SwapView/ConfirmationView/TxOverview/index.tsx +12 -7
  32. package/src/components/Swap/SwapView/ConfirmationView/TxProgress/index.tsx +136 -0
  33. package/src/components/Swap/SwapView/ConfirmationView/TxResult/index.tsx +108 -26
  34. package/src/components/Swap/SwapView/ConfirmationView/index.tsx +19 -4
  35. package/src/components/Swap/SwapView/FeesPanel/Fees/index.tsx +12 -6
  36. package/src/components/Swap/SwapView/FeesPanel/index.tsx +3 -1
  37. package/src/components/Swap/SwapView/SwapPanel/AmountPanel/index.tsx +9 -0
  38. package/src/components/Swap/SwapView/SwapPanel/TokenPanel/ChainPicker/index.tsx +1 -1
  39. package/src/components/Swap/SwapView/SwapPanel/TokenPanel/TokenPicker/NetworkFilter/index.tsx +52 -42
  40. package/src/components/Swap/SwapView/SwapPanel/TokenPanel/TokenPicker/TokenItem/index.tsx +1 -1
  41. package/src/components/Swap/SwapView/SwapPanel/TokenPanel/TokenPicker/index.tsx +5 -5
  42. package/src/components/Swap/SwapView/SwapPanel/TokenPanel/index.tsx +24 -2
  43. package/src/components/Swap/SwapView/SwapPanel/WalletPanel/index.tsx +14 -3
  44. package/src/components/Swap/SwapView/SwapPanel/index.tsx +14 -2
  45. package/src/components/Swap/SwapView/WalletPicker/index.tsx +1 -1
  46. package/src/components/ToggleButton/index.tsx +5 -3
  47. package/src/components/TxModal/index.tsx +2 -6
  48. package/src/components/global.css +85 -0
  49. package/src/config/fonts.ts +15 -2
  50. package/src/context/SwapProvider.tsx +22 -7
  51. package/src/context/TxUIWrapper.tsx +34 -4
  52. package/src/hooks/index.ts +1 -0
  53. package/src/hooks/useCrossChainDelivery.ts +143 -0
  54. package/src/models/Route.ts +13 -0
  55. package/src/models/TransactionDelivery.ts +40 -0
  56. package/src/models/index.ts +1 -0
  57. package/src/services/api.ts +23 -0
  58. package/tailwind.config.js +3 -9
@@ -13,6 +13,7 @@ export * from "./Protocol";
13
13
  export * from "./Route";
14
14
  export * from "./SolanaWeb3Network";
15
15
  export * from "./TokenData";
16
+ export * from "./TransactionDelivery";
16
17
  export * from "./TransactionHistory";
17
18
  export * from "./TxUIWrapper";
18
19
  export * from "./Web3Environment";
@@ -14,6 +14,7 @@ import {
14
14
  TokenPrices,
15
15
  TransactionHistory,
16
16
  TransactionStatus,
17
+ TransactionStatusResponse,
17
18
  } from "@src/models";
18
19
 
19
20
  let XSWAP_API_URL = "https://xswap.link/api";
@@ -148,6 +149,28 @@ export async function getBalances(payload: GetTokenBalancesPayload) {
148
149
  );
149
150
  }
150
151
 
152
+ /**
153
+ * Status of a submitted transaction, source tx and destination leg included.
154
+ *
155
+ * Polling this is also what moves a CCTP transfer along: when the API sees one
156
+ * attested by Circle but not yet claimed on the destination, it hands it to its own
157
+ * executor from inside this call (CCTP has no auto-relay). So a client that shows
158
+ * delivery progress should poll it rather than wait out a fixed estimate.
159
+ *
160
+ * EVM only — `chainId`/`txHash` identify an EVM receipt.
161
+ */
162
+ export async function getTransactionStatus(
163
+ payload: { chainId: string; txHash: string; walletAddress?: string },
164
+ abortSignal?: AbortSignal,
165
+ ): Promise<TransactionStatusResponse> {
166
+ return _sendRequest<TransactionStatusResponse>(
167
+ `/getTransactionStatus?${new URLSearchParams({
168
+ data: JSON.stringify(payload),
169
+ })}`,
170
+ { signal: abortSignal },
171
+ );
172
+ }
173
+
151
174
  export async function getTxStatus(payload: { transferId: string }) {
152
175
  return await _sendRequest<{ status: TransactionStatus }>(
153
176
  `/getTxStatus?${new URLSearchParams({
@@ -6,15 +6,9 @@ export default {
6
6
  content: ["src/components/**/*.{ts,tsx}", "src/context/**/*.{ts,tsx}"],
7
7
  theme: {
8
8
  fontFamily: {
9
- body: [
10
- withFontVariable("'Satoshi-Medium', Tahoma, Verdana, ui-sans-serif"),
11
- ],
12
- sans: [
13
- withFontVariable("'Satoshi-Medium', Tahoma, Verdana, ui-sans-serif"),
14
- ],
15
- "sans-bold": [
16
- withFontVariable("'Satoshi-Bold', Tahoma, Verdana, ui-sans-serif"),
17
- ],
9
+ // One family with Regular (400) and Medium (500) faces, see config/fonts.ts.
10
+ // Weight is selected with `font-normal` / `font-medium`, not by family.
11
+ sans: [withFontVariable("'Satoshi', Tahoma, Verdana, ui-sans-serif")],
18
12
  },
19
13
  extend: {
20
14
  colors: {