@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.
- package/.eslintrc.json +1 -0
- package/CHANGELOG.md +16 -0
- package/README.md +22 -4
- package/dist/index.d.mts +47 -1
- package/dist/index.d.ts +47 -1
- package/dist/index.global.js +94 -88
- package/dist/index.js +1378 -985
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1256 -863
- package/dist/index.mjs.map +1 -1
- package/example/index.html +12 -0
- package/example/package.json +24 -0
- package/example/pnpm-lock.yaml +1164 -0
- package/example/src/App.tsx +421 -0
- package/example/src/main.tsx +8 -0
- package/example/vite.config.ts +9 -0
- package/package.json +2 -1
- package/postcss.config.js +2 -0
- package/src/assets/icons/ChevronRightThinIcon.tsx +23 -0
- package/src/assets/icons/InfoThinIcon.tsx +33 -0
- package/src/assets/icons/RedirectThinIcon.tsx +15 -0
- package/src/assets/icons/index.ts +3 -0
- package/src/components/Swap/Header/index.tsx +3 -1
- package/src/components/Swap/HistoryView/ActivityCard/index.tsx +2 -2
- package/src/components/Swap/ReorderButton/ReorderButton.tsx +4 -1
- package/src/components/Swap/SettingsView/Delivery/index.tsx +3 -3
- package/src/components/Swap/SettingsView/InfiniteApproval/index.tsx +3 -3
- package/src/components/Swap/SettingsView/Slippage/index.tsx +5 -3
- package/src/components/Swap/SwapView/ConfirmationView/TokenTiles/index.tsx +5 -2
- package/src/components/Swap/SwapView/ConfirmationView/TxOverview/Header/index.tsx +1 -1
- package/src/components/Swap/SwapView/ConfirmationView/TxOverview/index.tsx +12 -7
- package/src/components/Swap/SwapView/ConfirmationView/TxProgress/index.tsx +136 -0
- package/src/components/Swap/SwapView/ConfirmationView/TxResult/index.tsx +108 -26
- package/src/components/Swap/SwapView/ConfirmationView/index.tsx +19 -4
- package/src/components/Swap/SwapView/FeesPanel/Fees/index.tsx +12 -6
- package/src/components/Swap/SwapView/FeesPanel/index.tsx +3 -1
- package/src/components/Swap/SwapView/SwapPanel/AmountPanel/index.tsx +9 -0
- package/src/components/Swap/SwapView/SwapPanel/TokenPanel/ChainPicker/index.tsx +1 -1
- package/src/components/Swap/SwapView/SwapPanel/TokenPanel/TokenPicker/NetworkFilter/index.tsx +52 -42
- package/src/components/Swap/SwapView/SwapPanel/TokenPanel/TokenPicker/TokenItem/index.tsx +1 -1
- package/src/components/Swap/SwapView/SwapPanel/TokenPanel/TokenPicker/index.tsx +5 -5
- package/src/components/Swap/SwapView/SwapPanel/TokenPanel/index.tsx +24 -2
- package/src/components/Swap/SwapView/SwapPanel/WalletPanel/index.tsx +14 -3
- package/src/components/Swap/SwapView/SwapPanel/index.tsx +14 -2
- package/src/components/Swap/SwapView/WalletPicker/index.tsx +1 -1
- package/src/components/ToggleButton/index.tsx +5 -3
- package/src/components/TxModal/index.tsx +2 -6
- package/src/components/global.css +85 -0
- package/src/config/fonts.ts +15 -2
- package/src/context/SwapProvider.tsx +22 -7
- package/src/context/TxUIWrapper.tsx +34 -4
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useCrossChainDelivery.ts +143 -0
- package/src/models/Route.ts +13 -0
- package/src/models/TransactionDelivery.ts +40 -0
- package/src/models/index.ts +1 -0
- package/src/services/api.ts +23 -0
- package/tailwind.config.js +3 -9
package/src/models/index.ts
CHANGED
|
@@ -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";
|
package/src/services/api.ts
CHANGED
|
@@ -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({
|
package/tailwind.config.js
CHANGED
|
@@ -6,15 +6,9 @@ export default {
|
|
|
6
6
|
content: ["src/components/**/*.{ts,tsx}", "src/context/**/*.{ts,tsx}"],
|
|
7
7
|
theme: {
|
|
8
8
|
fontFamily: {
|
|
9
|
-
|
|
10
|
-
|
|
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: {
|