@shapeshiftoss/swap-widget 0.0.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/Dockerfile +87 -0
- package/README.md +519 -0
- package/dist/assets/PhArrowCircleDown-B305t-Sh.js +14 -0
- package/dist/assets/PhArrowClockwise-CJPxQhr_.js +14 -0
- package/dist/assets/PhArrowDown-C4hT9BVu.js +14 -0
- package/dist/assets/PhArrowLeft-Way4Cu-r.js +14 -0
- package/dist/assets/PhArrowRight-Cp5ZME0F.js +14 -0
- package/dist/assets/PhArrowSquareOut-NnrK69c5.js +14 -0
- package/dist/assets/PhArrowUp-Dph6j8rm.js +14 -0
- package/dist/assets/PhArrowUpRight-BpJjRRRh.js +14 -0
- package/dist/assets/PhArrowsClockwise-CFUT8X7R.js +14 -0
- package/dist/assets/PhArrowsDownUp-BjBI4ckC.js +14 -0
- package/dist/assets/PhArrowsLeftRight-CuLpbKRk.js +14 -0
- package/dist/assets/PhBank-Dchr4XQJ.js +14 -0
- package/dist/assets/PhBrowser-dUu2TrC1.js +14 -0
- package/dist/assets/PhCaretDown-78IuKU3V.js +14 -0
- package/dist/assets/PhCaretLeft-_aiyH7n1.js +14 -0
- package/dist/assets/PhCaretRight-8zJQEuDX.js +14 -0
- package/dist/assets/PhCaretUp-CiCxKWwN.js +14 -0
- package/dist/assets/PhCheck-CcADx8br.js +14 -0
- package/dist/assets/PhCircleHalf-BYzSzd2h.js +14 -0
- package/dist/assets/PhClock-UItiXeJq.js +14 -0
- package/dist/assets/PhCompass-CUy3uA7t.js +14 -0
- package/dist/assets/PhCopy-C-PDgSlZ.js +14 -0
- package/dist/assets/PhCreditCard-CWRaUT6F.js +14 -0
- package/dist/assets/PhCurrencyDollar-Cqla3AXT.js +14 -0
- package/dist/assets/PhDesktop-BBIPrYLl.js +14 -0
- package/dist/assets/PhDeviceMobile-BdsPaATg.js +14 -0
- package/dist/assets/PhDotsThree-BMXCQl-0.js +14 -0
- package/dist/assets/PhEnvelope-yUsis6yU.js +14 -0
- package/dist/assets/PhFunnelSimple-Ba7BbWTp.js +14 -0
- package/dist/assets/PhGlobe-DgLxBk5U.js +14 -0
- package/dist/assets/PhIdentificationCard-Czjmq9Z3.js +14 -0
- package/dist/assets/PhImage-BAJ_erz6.js +14 -0
- package/dist/assets/PhInfo-Cr4DhVUE.js +14 -0
- package/dist/assets/PhLightbulb-BX_7duTr.js +14 -0
- package/dist/assets/PhMagnifyingGlass-Mygfryvz.js +14 -0
- package/dist/assets/PhPaperPlaneRight-BeuCA660.js +14 -0
- package/dist/assets/PhPlus-BMjcHjsT.js +14 -0
- package/dist/assets/PhPower-CGffGmdb.js +14 -0
- package/dist/assets/PhPuzzlePiece-wm_GpVSi.js +14 -0
- package/dist/assets/PhQrCode-DRwRzXCH.js +14 -0
- package/dist/assets/PhQuestion-M09j2U0T.js +14 -0
- package/dist/assets/PhQuestionMark-BP9EMB6h.js +14 -0
- package/dist/assets/PhSealCheck-BfG80yKn.js +14 -0
- package/dist/assets/PhSignOut-C5YOWlPT.js +14 -0
- package/dist/assets/PhSpinner-BXooDYzU.js +14 -0
- package/dist/assets/PhTrash-Biq6rmmL.js +14 -0
- package/dist/assets/PhUser-CAgZSpGe.js +14 -0
- package/dist/assets/PhVault-l2PHF38a.js +14 -0
- package/dist/assets/PhWallet-w25D16It.js +14 -0
- package/dist/assets/PhWarning-DPEydIPw.js +14 -0
- package/dist/assets/PhWarningCircle-BqjT745H.js +14 -0
- package/dist/assets/PhX-s-SmVExa.js +14 -0
- package/dist/assets/SwapController-If0bFrNc.js +1 -0
- package/dist/assets/ccip-BBB7uCdL.js +1 -0
- package/dist/assets/ccip-CkkdfKKI.js +1 -0
- package/dist/assets/data-capture-D4gAy-Yc.js +242 -0
- package/dist/assets/email-B1AJehis.js +90 -0
- package/dist/assets/embedded-wallet-Q6DQopDk.js +410 -0
- package/dist/assets/features-B6JAPAFb.js +5 -0
- package/dist/assets/index-5jd8RPN9.js +7428 -0
- package/dist/assets/index-B4kNtSTk.js +1080 -0
- package/dist/assets/index-B753eAob.js +1 -0
- package/dist/assets/index-BZoLTv77.js +3 -0
- package/dist/assets/index-Bcw9UURX.js +3 -0
- package/dist/assets/index-BkrV-ahK.js +2 -0
- package/dist/assets/index-CRQzQ_up.js +9 -0
- package/dist/assets/index-CSW0Gt5y.js +132 -0
- package/dist/assets/index-CZ4jTIsk.js +138 -0
- package/dist/assets/index-Cwa8SB3h.js +61 -0
- package/dist/assets/index-DEwQgT4r.js +78 -0
- package/dist/assets/index-DVfQiQ1d.js +1 -0
- package/dist/assets/index-cV3UdaMs.css +1 -0
- package/dist/assets/index-hAmu622O.js +43 -0
- package/dist/assets/onramp-XcPNCLRU.js +422 -0
- package/dist/assets/pay-with-exchange-BeHt4OF4.js +280 -0
- package/dist/assets/property-C9JG5tag.js +27 -0
- package/dist/assets/receive-7ff4he2S.js +131 -0
- package/dist/assets/send-CkMBIRXT.js +554 -0
- package/dist/assets/socials-DmmxuLrP.js +250 -0
- package/dist/assets/swaps-IHAYRQ0x.js +1050 -0
- package/dist/assets/transactions-9Cxdk7o9.js +16 -0
- package/dist/assets/v4-BOvFkHkt.js +1 -0
- package/dist/assets/w3m-modal-kJzFnBfB.js +891 -0
- package/dist/assets/wallet-standard-Dv8LMoUB.js +1 -0
- package/dist/favicon.png +0 -0
- package/dist/favicon.svg +11 -0
- package/dist/icon-192x192.png +0 -0
- package/dist/icon-512x512.png +0 -0
- package/dist/index.html +33 -0
- package/index.html +32 -0
- package/package.json +59 -0
- package/public/favicon.png +0 -0
- package/public/favicon.svg +11 -0
- package/public/icon-192x192.png +0 -0
- package/public/icon-512x512.png +0 -0
- package/railway.toml +10 -0
- package/src/api/client.ts +95 -0
- package/src/components/AddressInputModal.css +173 -0
- package/src/components/AddressInputModal.tsx +250 -0
- package/src/components/ApprovalStep.tsx +92 -0
- package/src/components/ExecutionStep.tsx +27 -0
- package/src/components/InputStep.tsx +431 -0
- package/src/components/QuoteSelector.css +146 -0
- package/src/components/QuoteSelector.tsx +137 -0
- package/src/components/QuotesModal.css +250 -0
- package/src/components/QuotesModal.tsx +182 -0
- package/src/components/SettingsModal.css +145 -0
- package/src/components/SettingsModal.tsx +180 -0
- package/src/components/StatusStep.tsx +139 -0
- package/src/components/SwapWidget.css +713 -0
- package/src/components/SwapWidget.tsx +607 -0
- package/src/components/TokenSelectModal.css +438 -0
- package/src/components/TokenSelectModal.tsx +487 -0
- package/src/components/WalletProvider.tsx +92 -0
- package/src/config/appkit.ts +104 -0
- package/src/config/wagmi.ts +27 -0
- package/src/constants/chains.ts +72 -0
- package/src/constants/defaults.ts +28 -0
- package/src/constants/swappers.ts +48 -0
- package/src/constants/viemChains.ts +69 -0
- package/src/contexts/SwapWalletContext.tsx +25 -0
- package/src/demo/App.css +458 -0
- package/src/demo/App.tsx +481 -0
- package/src/demo/main.tsx +25 -0
- package/src/hooks/useAssets.ts +180 -0
- package/src/hooks/useBalances.ts +822 -0
- package/src/hooks/useBitcoinSigning.ts +276 -0
- package/src/hooks/useMarketData.ts +169 -0
- package/src/hooks/useSolanaSigning.ts +275 -0
- package/src/hooks/useStatusPolling.ts +137 -0
- package/src/hooks/useSwapApproval.ts +106 -0
- package/src/hooks/useSwapDisplayValues.ts +157 -0
- package/src/hooks/useSwapExecution.ts +199 -0
- package/src/hooks/useSwapHandlers.ts +119 -0
- package/src/hooks/useSwapQuote.ts +71 -0
- package/src/hooks/useSwapQuoting.ts +102 -0
- package/src/hooks/useSwapRates.ts +61 -0
- package/src/index.ts +43 -0
- package/src/machines/SwapMachineContext.ts +5 -0
- package/src/machines/__tests__/guards.test.ts +228 -0
- package/src/machines/__tests__/setup.test.ts +7 -0
- package/src/machines/__tests__/swapMachine.test.ts +544 -0
- package/src/machines/__tests__/types.test.ts +124 -0
- package/src/machines/guards.ts +33 -0
- package/src/machines/swapMachine.ts +288 -0
- package/src/machines/types.ts +54 -0
- package/src/services/transactionStatus.ts +322 -0
- package/src/types/index.ts +361 -0
- package/src/utils/addressValidation.ts +201 -0
- package/src/utils/redirect.ts +45 -0
- package/src/vite-env.d.ts +10 -0
- package/tsconfig.json +23 -0
- package/tsconfig.node.json +10 -0
- package/vite.config.ts +101 -0
- package/vitest.config.ts +18 -0
package/Dockerfile
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# syntax=docker/dockerfile:1
|
|
2
|
+
|
|
3
|
+
# Build stage
|
|
4
|
+
FROM node:22-alpine AS builder
|
|
5
|
+
|
|
6
|
+
WORKDIR /app
|
|
7
|
+
|
|
8
|
+
# Install build dependencies (including Java for unchained-client code generation)
|
|
9
|
+
RUN apk add --no-cache python3 make g++ openjdk17-jre
|
|
10
|
+
|
|
11
|
+
# Copy workspace files
|
|
12
|
+
COPY package.json yarn.lock .yarnrc.yml ./
|
|
13
|
+
COPY .yarn ./.yarn
|
|
14
|
+
|
|
15
|
+
# Copy all workspace package.json files for resolution (yarn requires all workspaces present)
|
|
16
|
+
COPY packages/caip/package.json ./packages/caip/
|
|
17
|
+
COPY packages/chain-adapters/package.json ./packages/chain-adapters/
|
|
18
|
+
COPY packages/contracts/package.json ./packages/contracts/
|
|
19
|
+
COPY packages/errors/package.json ./packages/errors/
|
|
20
|
+
COPY packages/hdwallet-coinbase/package.json ./packages/hdwallet-coinbase/
|
|
21
|
+
COPY packages/hdwallet-core/package.json ./packages/hdwallet-core/
|
|
22
|
+
COPY packages/hdwallet-gridplus/package.json ./packages/hdwallet-gridplus/
|
|
23
|
+
COPY packages/hdwallet-integration/package.json ./packages/hdwallet-integration/
|
|
24
|
+
COPY packages/hdwallet-keepkey/package.json ./packages/hdwallet-keepkey/
|
|
25
|
+
COPY packages/hdwallet-keepkey-electron/package.json ./packages/hdwallet-keepkey-electron/
|
|
26
|
+
COPY packages/hdwallet-keepkey-nodehid/package.json ./packages/hdwallet-keepkey-nodehid/
|
|
27
|
+
COPY packages/hdwallet-keepkey-nodewebusb/package.json ./packages/hdwallet-keepkey-nodewebusb/
|
|
28
|
+
COPY packages/hdwallet-keepkey-tcp/package.json ./packages/hdwallet-keepkey-tcp/
|
|
29
|
+
COPY packages/hdwallet-keepkey-webusb/package.json ./packages/hdwallet-keepkey-webusb/
|
|
30
|
+
COPY packages/hdwallet-keplr/package.json ./packages/hdwallet-keplr/
|
|
31
|
+
COPY packages/hdwallet-ledger/package.json ./packages/hdwallet-ledger/
|
|
32
|
+
COPY packages/hdwallet-ledger-webhid/package.json ./packages/hdwallet-ledger-webhid/
|
|
33
|
+
COPY packages/hdwallet-ledger-webusb/package.json ./packages/hdwallet-ledger-webusb/
|
|
34
|
+
COPY packages/hdwallet-metamask-multichain/package.json ./packages/hdwallet-metamask-multichain/
|
|
35
|
+
COPY packages/hdwallet-native/package.json ./packages/hdwallet-native/
|
|
36
|
+
COPY packages/hdwallet-native-vault/package.json ./packages/hdwallet-native-vault/
|
|
37
|
+
COPY packages/hdwallet-phantom/package.json ./packages/hdwallet-phantom/
|
|
38
|
+
COPY packages/hdwallet-sandbox/package.json ./packages/hdwallet-sandbox/
|
|
39
|
+
COPY packages/hdwallet-trezor/package.json ./packages/hdwallet-trezor/
|
|
40
|
+
COPY packages/hdwallet-trezor-connect/package.json ./packages/hdwallet-trezor-connect/
|
|
41
|
+
COPY packages/hdwallet-vultisig/package.json ./packages/hdwallet-vultisig/
|
|
42
|
+
COPY packages/hdwallet-walletconnectv2/package.json ./packages/hdwallet-walletconnectv2/
|
|
43
|
+
COPY packages/hdwallet-seeker/package.json ./packages/hdwallet-seeker/
|
|
44
|
+
COPY packages/public-api/package.json ./packages/public-api/
|
|
45
|
+
COPY packages/swapper/package.json ./packages/swapper/
|
|
46
|
+
COPY packages/swap-widget/package.json ./packages/swap-widget/
|
|
47
|
+
COPY packages/types/package.json ./packages/types/
|
|
48
|
+
COPY packages/unchained-client/package.json ./packages/unchained-client/
|
|
49
|
+
COPY packages/utils/package.json ./packages/utils/
|
|
50
|
+
|
|
51
|
+
# Install dependencies (skip build/postinstall scripts that require git/cypress/etc)
|
|
52
|
+
RUN --mount=type=cache,id=s/4cafb297-3349-46e2-bfef-8210504e0583-/root/.yarn/berry/cache,target=/root/.yarn/berry/cache \
|
|
53
|
+
yarn install --immutable --mode skip-build
|
|
54
|
+
|
|
55
|
+
# Copy unchained-client config and generator files FIRST (rarely changes, enables layer caching)
|
|
56
|
+
COPY packages/unchained-client/openapitools.json ./packages/unchained-client/
|
|
57
|
+
COPY packages/unchained-client/generator/ ./packages/unchained-client/generator/
|
|
58
|
+
|
|
59
|
+
# Generate unchained-client code (required by tsc --build for workspace packages)
|
|
60
|
+
RUN --mount=type=cache,id=s/4cafb297-3349-46e2-bfef-8210504e0583-/root/.openapitools,target=/root/.openapitools \
|
|
61
|
+
yarn workspace @shapeshiftoss/unchained-client generate
|
|
62
|
+
|
|
63
|
+
# Copy remaining source files
|
|
64
|
+
COPY packages/ ./packages/
|
|
65
|
+
COPY public/generated/generatedAssetData.json ./public/generated/
|
|
66
|
+
COPY tsconfig.json tsconfig.packages.json ./
|
|
67
|
+
|
|
68
|
+
# Build all packages using parallel tsc with project references
|
|
69
|
+
RUN yarn run -T tsc --build tsconfig.packages.json && yarn postbuild:packages
|
|
70
|
+
|
|
71
|
+
# Build the swap-widget
|
|
72
|
+
WORKDIR /app/packages/swap-widget
|
|
73
|
+
RUN yarn build
|
|
74
|
+
|
|
75
|
+
# Production stage
|
|
76
|
+
FROM node:22-alpine AS runner
|
|
77
|
+
|
|
78
|
+
RUN npm install -g serve
|
|
79
|
+
|
|
80
|
+
WORKDIR /app
|
|
81
|
+
|
|
82
|
+
# Copy only the built static files (node_modules not needed - vite bundles everything)
|
|
83
|
+
COPY --from=builder /app/packages/swap-widget/dist ./dist
|
|
84
|
+
|
|
85
|
+
EXPOSE 3000
|
|
86
|
+
|
|
87
|
+
CMD ["serve", "-s", "dist", "-l", "3000"]
|
package/README.md
ADDED
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
# @shapeshiftoss/swap-widget
|
|
2
|
+
|
|
3
|
+
An embeddable React widget that enables multi-chain token swaps using ShapeShift's aggregation API. Integrate swaps into your application with minimal configuration.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Installation](#installation)
|
|
8
|
+
- [Quick Start](#quick-start)
|
|
9
|
+
- [Props Reference](#props-reference)
|
|
10
|
+
- [Theming](#theming)
|
|
11
|
+
- [Examples](#examples)
|
|
12
|
+
- [Exported Types](#exported-types)
|
|
13
|
+
- [Exported Utilities](#exported-utilities)
|
|
14
|
+
- [Exported Hooks](#exported-hooks)
|
|
15
|
+
- [Supported Chains](#supported-chains)
|
|
16
|
+
- [Notes and Limitations](#notes-and-limitations)
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
yarn add @shapeshiftoss/swap-widget
|
|
22
|
+
# or
|
|
23
|
+
npm install @shapeshiftoss/swap-widget
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Peer Dependencies
|
|
27
|
+
|
|
28
|
+
This package requires React 18 or later:
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"react": ">=18.0.0",
|
|
34
|
+
"react-dom": ">=18.0.0"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Quick Start
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
import { SwapWidget } from "@shapeshiftoss/swap-widget";
|
|
43
|
+
|
|
44
|
+
function App() {
|
|
45
|
+
return (
|
|
46
|
+
<SwapWidget
|
|
47
|
+
affiliateAddress="0xYourArbitrumAddress"
|
|
48
|
+
theme="dark"
|
|
49
|
+
onSwapSuccess={(txHash) => console.log("Success:", txHash)}
|
|
50
|
+
onSwapError={(error) => console.error("Error:", error)}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Props Reference
|
|
57
|
+
|
|
58
|
+
### SwapWidgetProps
|
|
59
|
+
|
|
60
|
+
| Prop | Type | Default | Description |
|
|
61
|
+
| ------------------------ | ----------------------------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------- |
|
|
62
|
+
| `affiliateAddress` | `string` | - | Your Arbitrum address for affiliate fee attribution. Optional — the widget works without it. |
|
|
63
|
+
| `apiBaseUrl` | `string` | - | Custom API base URL. Useful for testing or custom deployments. |
|
|
64
|
+
| `defaultSellAsset` | `Asset` | ETH on Ethereum | Initial asset to sell. |
|
|
65
|
+
| `defaultBuyAsset` | `Asset` | USDC on Ethereum | Initial asset to buy. |
|
|
66
|
+
| `disabledChainIds` | `ChainId[]` | `[]` | Chain IDs to hide from the asset selector. |
|
|
67
|
+
| `disabledAssetIds` | `AssetId[]` | `[]` | Asset IDs to hide from the asset selector. |
|
|
68
|
+
| `allowedChainIds` | `ChainId[]` | - | If provided, only show assets from these chains. Use this to restrict the widget to specific chains. |
|
|
69
|
+
| `allowedAssetIds` | `AssetId[]` | - | If provided, only show these specific assets. |
|
|
70
|
+
| `walletClient` | `WalletClient` | - | Viem wallet client for executing EVM transactions. |
|
|
71
|
+
| `onConnectWallet` | `() => void` | - | Callback when user clicks "Connect Wallet" button. |
|
|
72
|
+
| `onSwapSuccess` | `(txHash: string) => void` | - | Callback when a swap transaction succeeds. |
|
|
73
|
+
| `onSwapError` | `(error: Error) => void` | - | Callback when a swap transaction fails. |
|
|
74
|
+
| `onAssetSelect` | `(type: "sell" \| "buy", asset: Asset) => void` | - | Callback when user selects an asset. |
|
|
75
|
+
| `theme` | `ThemeMode \| ThemeConfig` | `"dark"` | Theme mode (`"light"` or `"dark"`) or full theme configuration. |
|
|
76
|
+
| `defaultSlippage` | `string` | `"0.5"` | Default slippage tolerance percentage. |
|
|
77
|
+
| `showPoweredBy` | `boolean` | `true` | Show "Powered by ShapeShift" branding. |
|
|
78
|
+
| `enableWalletConnection` | `boolean` | `false` | Enable built-in wallet connection UI using Reown AppKit. Supports EVM, Bitcoin, and Solana wallets. Requires `walletConnectProjectId`. |
|
|
79
|
+
| `walletConnectProjectId` | `string` | - | WalletConnect project ID for the built-in wallet connection. Get one at <https://cloud.walletconnect.com>. |
|
|
80
|
+
| `defaultReceiveAddress` | `string` | - | Fixed receive address for swaps. When set, users cannot change the receive address. |
|
|
81
|
+
|
|
82
|
+
## Theming
|
|
83
|
+
|
|
84
|
+
The widget supports both simple theme modes and full customization.
|
|
85
|
+
|
|
86
|
+
### Simple Theme Mode
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
<SwapWidget theme="dark" />
|
|
90
|
+
// or
|
|
91
|
+
<SwapWidget theme="light" />
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Custom Theme Configuration
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
import { SwapWidget } from "@shapeshiftoss/swap-widget";
|
|
98
|
+
import type { ThemeConfig } from "@shapeshiftoss/swap-widget";
|
|
99
|
+
|
|
100
|
+
const customTheme: ThemeConfig = {
|
|
101
|
+
mode: "dark",
|
|
102
|
+
accentColor: "#3861fb", // Primary accent color (buttons, focus states)
|
|
103
|
+
backgroundColor: "#0a0a14", // Widget background
|
|
104
|
+
cardColor: "#12121c", // Card/panel background
|
|
105
|
+
textColor: "#ffffff", // Primary text color
|
|
106
|
+
borderRadius: "12px", // Border radius for elements
|
|
107
|
+
fontFamily: "Inter, sans-serif",
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
function App() {
|
|
111
|
+
return <SwapWidget theme={customTheme} />;
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### ThemeConfig Properties
|
|
116
|
+
|
|
117
|
+
| Property | Type | Description |
|
|
118
|
+
| ----------------- | ------------------- | -------------------------------------------------- |
|
|
119
|
+
| `mode` | `"light" \| "dark"` | Base theme mode. Required. |
|
|
120
|
+
| `accentColor` | `string` | Primary accent color for buttons and focus states. |
|
|
121
|
+
| `backgroundColor` | `string` | Widget background color. |
|
|
122
|
+
| `cardColor` | `string` | Card and panel background color. |
|
|
123
|
+
| `textColor` | `string` | Primary text color. |
|
|
124
|
+
| `borderRadius` | `string` | Border radius for UI elements. |
|
|
125
|
+
| `fontFamily` | `string` | Font family for the widget. |
|
|
126
|
+
|
|
127
|
+
## Examples
|
|
128
|
+
|
|
129
|
+
### Basic Usage
|
|
130
|
+
|
|
131
|
+
```tsx
|
|
132
|
+
import { SwapWidget } from "@shapeshiftoss/swap-widget";
|
|
133
|
+
|
|
134
|
+
function App() {
|
|
135
|
+
return <SwapWidget affiliateAddress="0xYourArbitrumAddress" theme="dark" />;
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### With External Wallet Connection (wagmi/viem)
|
|
140
|
+
|
|
141
|
+
If you already have wagmi set up in your application, you can pass the wallet client directly:
|
|
142
|
+
|
|
143
|
+
```tsx
|
|
144
|
+
import { SwapWidget } from "@shapeshiftoss/swap-widget";
|
|
145
|
+
import { useWalletClient } from "wagmi";
|
|
146
|
+
|
|
147
|
+
function App() {
|
|
148
|
+
const { data: walletClient } = useWalletClient();
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
<SwapWidget
|
|
152
|
+
affiliateAddress="0xYourArbitrumAddress"
|
|
153
|
+
walletClient={walletClient}
|
|
154
|
+
onConnectWallet={() => {
|
|
155
|
+
// Your custom wallet connection logic
|
|
156
|
+
}}
|
|
157
|
+
onSwapSuccess={(txHash) => {
|
|
158
|
+
console.log("Swap successful:", txHash);
|
|
159
|
+
}}
|
|
160
|
+
onSwapError={(error) => {
|
|
161
|
+
console.error("Swap failed:", error);
|
|
162
|
+
}}
|
|
163
|
+
theme={{
|
|
164
|
+
mode: "dark",
|
|
165
|
+
accentColor: "#3861fb",
|
|
166
|
+
backgroundColor: "#0a0a14",
|
|
167
|
+
cardColor: "#12121c",
|
|
168
|
+
}}
|
|
169
|
+
/>
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### With Custom Default Assets
|
|
175
|
+
|
|
176
|
+
```tsx
|
|
177
|
+
import { SwapWidget } from "@shapeshiftoss/swap-widget";
|
|
178
|
+
import type { Asset } from "@shapeshiftoss/swap-widget";
|
|
179
|
+
|
|
180
|
+
const defaultSellAsset: Asset = {
|
|
181
|
+
assetId: "eip155:137/slip44:966",
|
|
182
|
+
chainId: "eip155:137",
|
|
183
|
+
symbol: "MATIC",
|
|
184
|
+
name: "Polygon",
|
|
185
|
+
precision: 18,
|
|
186
|
+
icon: "https://example.com/matic.png",
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
const defaultBuyAsset: Asset = {
|
|
190
|
+
assetId: "eip155:137/erc20:0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
|
|
191
|
+
chainId: "eip155:137",
|
|
192
|
+
symbol: "USDC",
|
|
193
|
+
name: "USD Coin",
|
|
194
|
+
precision: 6,
|
|
195
|
+
icon: "https://example.com/usdc.png",
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
function App() {
|
|
199
|
+
return (
|
|
200
|
+
<SwapWidget
|
|
201
|
+
affiliateAddress="0xYourArbitrumAddress"
|
|
202
|
+
defaultSellAsset={defaultSellAsset}
|
|
203
|
+
defaultBuyAsset={defaultBuyAsset}
|
|
204
|
+
theme="dark"
|
|
205
|
+
/>
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Restricting Available Chains and Assets
|
|
211
|
+
|
|
212
|
+
Use `allowedChainIds` to restrict the widget to only show specific chains. This is useful when you want to limit swaps to certain networks.
|
|
213
|
+
|
|
214
|
+
```tsx
|
|
215
|
+
import { SwapWidget, EVM_CHAIN_IDS } from "@shapeshiftoss/swap-widget";
|
|
216
|
+
|
|
217
|
+
function App() {
|
|
218
|
+
return (
|
|
219
|
+
<SwapWidget
|
|
220
|
+
affiliateAddress="0xYourArbitrumAddress"
|
|
221
|
+
allowedChainIds={[
|
|
222
|
+
EVM_CHAIN_IDS.ethereum,
|
|
223
|
+
EVM_CHAIN_IDS.polygon,
|
|
224
|
+
EVM_CHAIN_IDS.arbitrum,
|
|
225
|
+
]}
|
|
226
|
+
disabledAssetIds={[
|
|
227
|
+
"eip155:1/erc20:0x...", // Hide specific tokens
|
|
228
|
+
]}
|
|
229
|
+
theme="dark"
|
|
230
|
+
/>
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### With Built-in Wallet Connection (Multi-Chain)
|
|
236
|
+
|
|
237
|
+
The widget can manage wallet connections internally using Reown AppKit, which supports EVM chains, Bitcoin, and Solana. This is useful when you don't have an existing wallet connection setup.
|
|
238
|
+
|
|
239
|
+
```tsx
|
|
240
|
+
import { SwapWidget } from "@shapeshiftoss/swap-widget";
|
|
241
|
+
|
|
242
|
+
function App() {
|
|
243
|
+
return (
|
|
244
|
+
<SwapWidget
|
|
245
|
+
affiliateAddress="0xYourArbitrumAddress"
|
|
246
|
+
enableWalletConnection={true}
|
|
247
|
+
walletConnectProjectId="your-walletconnect-project-id"
|
|
248
|
+
theme="dark"
|
|
249
|
+
/>
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
When `enableWalletConnection` is true, the widget will:
|
|
255
|
+
- Show a "Connect" button that opens the AppKit modal
|
|
256
|
+
- Support connecting EVM wallets (MetaMask, WalletConnect, etc.)
|
|
257
|
+
- Support connecting Bitcoin wallets via WalletConnect
|
|
258
|
+
- Support connecting Solana wallets (Phantom, Solflare, etc.)
|
|
259
|
+
|
|
260
|
+
### With Fixed Receive Address
|
|
261
|
+
|
|
262
|
+
Use `defaultReceiveAddress` to lock the receive address. When set, users cannot change the destination address. This is useful for integrations where you want all swaps to go to a specific address.
|
|
263
|
+
|
|
264
|
+
```tsx
|
|
265
|
+
import { SwapWidget } from "@shapeshiftoss/swap-widget";
|
|
266
|
+
|
|
267
|
+
function App() {
|
|
268
|
+
return (
|
|
269
|
+
<SwapWidget
|
|
270
|
+
affiliateAddress="0xYourArbitrumAddress"
|
|
271
|
+
defaultReceiveAddress="0x1234567890abcdef1234567890abcdef12345678"
|
|
272
|
+
theme="dark"
|
|
273
|
+
/>
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## Exported Types
|
|
279
|
+
|
|
280
|
+
```typescript
|
|
281
|
+
import type {
|
|
282
|
+
Asset,
|
|
283
|
+
AssetId,
|
|
284
|
+
ChainId,
|
|
285
|
+
Chain,
|
|
286
|
+
TradeRate,
|
|
287
|
+
TradeQuote,
|
|
288
|
+
SwapperName,
|
|
289
|
+
SwapWidgetProps,
|
|
290
|
+
ThemeMode,
|
|
291
|
+
ThemeConfig,
|
|
292
|
+
} from "@shapeshiftoss/swap-widget";
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Asset
|
|
296
|
+
|
|
297
|
+
```typescript
|
|
298
|
+
type Asset = {
|
|
299
|
+
assetId: AssetId; // CAIP-19 format: "eip155:1/slip44:60"
|
|
300
|
+
chainId: ChainId; // CAIP-2 format: "eip155:1"
|
|
301
|
+
symbol: string; // e.g., "ETH"
|
|
302
|
+
name: string; // e.g., "Ethereum"
|
|
303
|
+
precision: number; // e.g., 18
|
|
304
|
+
icon?: string; // URL to asset icon
|
|
305
|
+
color?: string; // Brand color
|
|
306
|
+
networkName?: string; // Display name for the network
|
|
307
|
+
networkIcon?: string; // URL to network icon
|
|
308
|
+
explorer?: string; // Block explorer URL
|
|
309
|
+
explorerTxLink?: string; // Transaction explorer link template
|
|
310
|
+
explorerAddressLink?: string; // Address explorer link template
|
|
311
|
+
relatedAssetKey?: AssetId | null; // Related asset for bridged tokens
|
|
312
|
+
};
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### SwapperName
|
|
316
|
+
|
|
317
|
+
```typescript
|
|
318
|
+
type SwapperName =
|
|
319
|
+
| "THORChain"
|
|
320
|
+
| "MAYAChain"
|
|
321
|
+
| "CoW Swap"
|
|
322
|
+
| "0x"
|
|
323
|
+
| "Portals"
|
|
324
|
+
| "Chainflip"
|
|
325
|
+
| "Relay"
|
|
326
|
+
| "Bebop"
|
|
327
|
+
| "Jupiter"
|
|
328
|
+
| "1inch"
|
|
329
|
+
| "ButterSwap"
|
|
330
|
+
| "ArbitrumBridge";
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### TradeRate
|
|
334
|
+
|
|
335
|
+
```typescript
|
|
336
|
+
type TradeRate = {
|
|
337
|
+
swapperName: SwapperName;
|
|
338
|
+
rate: string;
|
|
339
|
+
buyAmountCryptoBaseUnit: string;
|
|
340
|
+
sellAmountCryptoBaseUnit: string;
|
|
341
|
+
steps: number;
|
|
342
|
+
estimatedExecutionTimeMs?: number;
|
|
343
|
+
affiliateBps: string;
|
|
344
|
+
networkFeeCryptoBaseUnit?: string;
|
|
345
|
+
error?: {
|
|
346
|
+
code: string;
|
|
347
|
+
message: string;
|
|
348
|
+
};
|
|
349
|
+
id?: string;
|
|
350
|
+
};
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
## Exported Utilities
|
|
354
|
+
|
|
355
|
+
```typescript
|
|
356
|
+
import {
|
|
357
|
+
isEvmChainId,
|
|
358
|
+
getEvmChainIdNumber,
|
|
359
|
+
getChainType,
|
|
360
|
+
formatAmount,
|
|
361
|
+
parseAmount,
|
|
362
|
+
truncateAddress,
|
|
363
|
+
EVM_CHAIN_IDS,
|
|
364
|
+
UTXO_CHAIN_IDS,
|
|
365
|
+
COSMOS_CHAIN_IDS,
|
|
366
|
+
OTHER_CHAIN_IDS,
|
|
367
|
+
CHAIN_METADATA,
|
|
368
|
+
getChainMeta,
|
|
369
|
+
getChainName,
|
|
370
|
+
getChainIcon,
|
|
371
|
+
getChainColor,
|
|
372
|
+
} from "@shapeshiftoss/swap-widget";
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### Chain Type Utilities
|
|
376
|
+
|
|
377
|
+
| Function | Signature | Description |
|
|
378
|
+
| --------------------- | ------------------------------------------------------------------------- | ---------------------------------------------------- |
|
|
379
|
+
| `isEvmChainId` | `(chainId: string) => boolean` | Check if a chain ID is an EVM chain. |
|
|
380
|
+
| `getEvmChainIdNumber` | `(chainId: string) => number` | Extract the numeric chain ID from a CAIP-2 chain ID. |
|
|
381
|
+
| `getChainType` | `(chainId: string) => "evm" \| "utxo" \| "cosmos" \| "solana" \| "other"` | Get the chain type from a chain ID. |
|
|
382
|
+
|
|
383
|
+
### Amount Formatting
|
|
384
|
+
|
|
385
|
+
| Function | Signature | Description |
|
|
386
|
+
| ----------------- | -------------------------------------------------------------------- | -------------------------------------------------------- |
|
|
387
|
+
| `formatAmount` | `(amount: string, decimals: number, maxDecimals?: number) => string` | Format a base unit amount for display. |
|
|
388
|
+
| `parseAmount` | `(amount: string, decimals: number) => string` | Parse a human-readable amount to base units. |
|
|
389
|
+
| `truncateAddress` | `(address: string, chars?: number) => string` | Truncate an address for display (e.g., `0x1234...5678`). |
|
|
390
|
+
|
|
391
|
+
### Chain Metadata
|
|
392
|
+
|
|
393
|
+
| Function | Signature | Description |
|
|
394
|
+
| --------------- | ---------------------------------------------- | --------------------------------- |
|
|
395
|
+
| `getChainMeta` | `(chainId: ChainId) => ChainMeta \| undefined` | Get full metadata for a chain. |
|
|
396
|
+
| `getChainName` | `(chainId: ChainId) => string` | Get the display name for a chain. |
|
|
397
|
+
| `getChainIcon` | `(chainId: ChainId) => string \| undefined` | Get the icon URL for a chain. |
|
|
398
|
+
| `getChainColor` | `(chainId: ChainId) => string` | Get the brand color for a chain. |
|
|
399
|
+
|
|
400
|
+
### Chain ID Constants
|
|
401
|
+
|
|
402
|
+
```typescript
|
|
403
|
+
const EVM_CHAIN_IDS = {
|
|
404
|
+
ethereum: "eip155:1",
|
|
405
|
+
arbitrum: "eip155:42161",
|
|
406
|
+
optimism: "eip155:10",
|
|
407
|
+
polygon: "eip155:137",
|
|
408
|
+
base: "eip155:8453",
|
|
409
|
+
avalanche: "eip155:43114",
|
|
410
|
+
bsc: "eip155:56",
|
|
411
|
+
gnosis: "eip155:100",
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
const UTXO_CHAIN_IDS = {
|
|
415
|
+
bitcoin: "bip122:000000000019d6689c085ae165831e93",
|
|
416
|
+
bitcoinCash: "bip122:000000000000000000651ef99cb9fcbe",
|
|
417
|
+
dogecoin: "bip122:00000000001a91e3dace36e2be3bf030",
|
|
418
|
+
litecoin: "bip122:12a765e31ffd4059bada1e25190f6e98",
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
const COSMOS_CHAIN_IDS = {
|
|
422
|
+
cosmos: "cosmos:cosmoshub-4",
|
|
423
|
+
thorchain: "cosmos:thorchain-1",
|
|
424
|
+
mayachain: "cosmos:mayachain-mainnet-v1",
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
const OTHER_CHAIN_IDS = {
|
|
428
|
+
solana: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
|
|
429
|
+
};
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
## Exported Hooks
|
|
433
|
+
|
|
434
|
+
```typescript
|
|
435
|
+
import {
|
|
436
|
+
useAssets,
|
|
437
|
+
useAssetById,
|
|
438
|
+
useChains,
|
|
439
|
+
useAssetsByChainId,
|
|
440
|
+
useAssetSearch,
|
|
441
|
+
} from "@shapeshiftoss/swap-widget";
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
| Hook | Return Type | Description |
|
|
445
|
+
| --------------------------------- | ------------------------------------------ | -------------------------------------------------------------- |
|
|
446
|
+
| `useAssets()` | `{ data: Asset[], isLoading, error, ... }` | Fetch all available assets. |
|
|
447
|
+
| `useAssetById(assetId)` | `{ data: Asset \| undefined, ... }` | Fetch a specific asset by ID. |
|
|
448
|
+
| `useChains()` | `{ data: ChainInfo[], ... }` | Fetch all available chains with their native assets. |
|
|
449
|
+
| `useAssetsByChainId(chainId)` | `{ data: Asset[], ... }` | Fetch all assets for a specific chain. |
|
|
450
|
+
| `useAssetSearch(query, chainId?)` | `{ data: Asset[], ... }` | Search assets by symbol or name, optionally filtered by chain. |
|
|
451
|
+
|
|
452
|
+
## Supported Chains
|
|
453
|
+
|
|
454
|
+
| Chain | Chain ID | Type |
|
|
455
|
+
| ----------------- | ----------------------------------------- | ------ |
|
|
456
|
+
| Ethereum | `eip155:1` | EVM |
|
|
457
|
+
| Arbitrum One | `eip155:42161` | EVM |
|
|
458
|
+
| Optimism | `eip155:10` | EVM |
|
|
459
|
+
| Polygon | `eip155:137` | EVM |
|
|
460
|
+
| Base | `eip155:8453` | EVM |
|
|
461
|
+
| Avalanche C-Chain | `eip155:43114` | EVM |
|
|
462
|
+
| BNB Smart Chain | `eip155:56` | EVM |
|
|
463
|
+
| Gnosis | `eip155:100` | EVM |
|
|
464
|
+
| Bitcoin | `bip122:000000000019d6689c085ae165831e93` | UTXO |
|
|
465
|
+
| Bitcoin Cash | `bip122:000000000000000000651ef99cb9fcbe` | UTXO |
|
|
466
|
+
| Dogecoin | `bip122:00000000001a91e3dace36e2be3bf030` | UTXO |
|
|
467
|
+
| Litecoin | `bip122:12a765e31ffd4059bada1e25190f6e98` | UTXO |
|
|
468
|
+
| Cosmos Hub | `cosmos:cosmoshub-4` | Cosmos |
|
|
469
|
+
| THORChain | `cosmos:thorchain-1` | Cosmos |
|
|
470
|
+
| MAYAChain | `cosmos:mayachain-mainnet-v1` | Cosmos |
|
|
471
|
+
| Solana | `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp` | Solana |
|
|
472
|
+
|
|
473
|
+
## Notes and Limitations
|
|
474
|
+
|
|
475
|
+
### Multi-Chain Swap Support
|
|
476
|
+
|
|
477
|
+
The widget supports swaps across multiple blockchain types:
|
|
478
|
+
|
|
479
|
+
- **EVM swaps** (e.g., ETH to USDC, MATIC to WETH) can be executed directly within the widget when a wallet is connected via the `walletClient` prop or through the built-in AppKit wallet connection.
|
|
480
|
+
- **Bitcoin/UTXO swaps** - When using the built-in wallet connection (`enableWalletConnection={true}`), Bitcoin and other UTXO chains can be signed directly via WalletConnect-compatible wallets.
|
|
481
|
+
- **Solana swaps** - Solana transactions can be signed via Phantom, Solflare, or other Solana wallets when using the built-in wallet connection.
|
|
482
|
+
- **Unsupported chains** - Swaps involving chains without wallet support will redirect to [app.shapeshift.com](https://app.shapeshift.com) to complete the transaction.
|
|
483
|
+
|
|
484
|
+
### Affiliate Address
|
|
485
|
+
|
|
486
|
+
An affiliate address is optional. Pass your Arbitrum address via the `affiliateAddress` prop to attribute swaps for affiliate fee tracking. The widget works without it — no registration or approval required.
|
|
487
|
+
|
|
488
|
+
### Internal QueryClient
|
|
489
|
+
|
|
490
|
+
The widget manages its own React Query `QueryClient` internally. You do not need to wrap it in a `QueryClientProvider`.
|
|
491
|
+
|
|
492
|
+
### Swap Aggregation
|
|
493
|
+
|
|
494
|
+
The widget fetches quotes from multiple DEXs and aggregators including:
|
|
495
|
+
|
|
496
|
+
- THORChain
|
|
497
|
+
- MAYAChain
|
|
498
|
+
- CoW Swap
|
|
499
|
+
- 0x
|
|
500
|
+
- 1inch
|
|
501
|
+
- Portals
|
|
502
|
+
- Chainflip
|
|
503
|
+
- Jupiter (Solana)
|
|
504
|
+
- Bebop
|
|
505
|
+
- Relay
|
|
506
|
+
- ButterSwap
|
|
507
|
+
- Arbitrum Bridge
|
|
508
|
+
|
|
509
|
+
### Wallet Balance Display
|
|
510
|
+
|
|
511
|
+
When a wallet is connected (`walletClient` prop), the widget displays the user's balance for the selected sell and buy assets. This only works for EVM chains where the connected wallet has assets.
|
|
512
|
+
|
|
513
|
+
### USD Price Display
|
|
514
|
+
|
|
515
|
+
The widget automatically fetches and displays USD prices for selected assets.
|
|
516
|
+
|
|
517
|
+
### Mobile Responsive
|
|
518
|
+
|
|
519
|
+
The widget is designed to be responsive and works well on mobile devices.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import{n as g,Y as c,t as r,p as d,O as s,s as A}from"./property-C9JG5tag.js";var m=Object.defineProperty,w=Object.getOwnPropertyDescriptor,l=(a,o,p,i)=>{for(var e=i>1?void 0:i?w(o,p):o,h=a.length-1,n;h>=0;h--)(n=a[h])&&(e=(i?n(o,p,e):n(e))||e);return i&&e&&m(o,p,e),e};let t=class extends g{constructor(){super(...arguments),this.size="1em",this.weight="regular",this.color="currentColor",this.mirrored=!1}render(){var a;return c`<svg
|
|
2
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
3
|
+
width="${this.size}"
|
|
4
|
+
height="${this.size}"
|
|
5
|
+
fill="${this.color}"
|
|
6
|
+
viewBox="0 0 256 256"
|
|
7
|
+
transform=${this.mirrored?"scale(-1, 1)":null}
|
|
8
|
+
>
|
|
9
|
+
${t.weightsMap.get((a=this.weight)!=null?a:"regular")}
|
|
10
|
+
</svg>`}};t.weightsMap=new Map([["thin",r`<path d="M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm34.83-86.83a4,4,0,0,1,0,5.66l-32,32a4,4,0,0,1-5.66,0l-32-32a4,4,0,0,1,5.66-5.66L124,158.34V88a4,4,0,0,1,8,0v70.34l25.17-25.17A4,4,0,0,1,162.83,133.17Z"/>`],["light",r`<path d="M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm36.24-86.24a6,6,0,0,1,0,8.48l-32,32a6,6,0,0,1-8.48,0l-32-32a6,6,0,0,1,8.48-8.48L122,153.51V88a6,6,0,0,1,12,0v65.51l21.76-21.75A6,6,0,0,1,164.24,131.76Z"/>`],["regular",r`<path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm37.66-85.66a8,8,0,0,1,0,11.32l-32,32a8,8,0,0,1-11.32,0l-32-32a8,8,0,0,1,11.32-11.32L120,148.69V88a8,8,0,0,1,16,0v60.69l18.34-18.35A8,8,0,0,1,165.66,130.34Z"/>`],["bold",r`<path d="M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm40.49-84.49a12,12,0,0,1,0,17l-32,32a12,12,0,0,1-17,0l-32-32a12,12,0,1,1,17-17L116,139V88a12,12,0,0,1,24,0v51l11.51-11.52A12,12,0,0,1,168.49,127.51Z"/>`],["fill",r`<path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm37.66,117.66-32,32a8,8,0,0,1-11.32,0l-32-32a8,8,0,0,1,11.32-11.32L120,148.69V88a8,8,0,0,1,16,0v60.69l18.34-18.35a8,8,0,0,1,11.32,11.32Z"/>`],["duotone",r`<path d="M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z" opacity="0.2"/><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm37.66-85.66a8,8,0,0,1,0,11.32l-32,32a8,8,0,0,1-11.32,0l-32-32a8,8,0,0,1,11.32-11.32L120,148.69V88a8,8,0,0,1,16,0v60.69l18.34-18.35A8,8,0,0,1,165.66,130.34Z"/>`]]);t.styles=d`
|
|
11
|
+
:host {
|
|
12
|
+
display: contents;
|
|
13
|
+
}
|
|
14
|
+
`;l([s({type:String,reflect:!0})],t.prototype,"size",2);l([s({type:String,reflect:!0})],t.prototype,"weight",2);l([s({type:String,reflect:!0})],t.prototype,"color",2);l([s({type:Boolean,reflect:!0})],t.prototype,"mirrored",2);t=l([A("ph-arrow-circle-down")],t);export{t as PhArrowCircleDown};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import{n as g,Y as c,t as r,p as d,O as i,s as w}from"./property-C9JG5tag.js";var u=Object.defineProperty,A=Object.getOwnPropertyDescriptor,o=(a,l,s,h)=>{for(var e=h>1?void 0:h?A(l,s):l,p=a.length-1,n;p>=0;p--)(n=a[p])&&(e=(h?n(l,s,e):n(e))||e);return h&&e&&u(l,s,e),e};let t=class extends g{constructor(){super(...arguments),this.size="1em",this.weight="regular",this.color="currentColor",this.mirrored=!1}render(){var a;return c`<svg
|
|
2
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
3
|
+
width="${this.size}"
|
|
4
|
+
height="${this.size}"
|
|
5
|
+
fill="${this.color}"
|
|
6
|
+
viewBox="0 0 256 256"
|
|
7
|
+
transform=${this.mirrored?"scale(-1, 1)":null}
|
|
8
|
+
>
|
|
9
|
+
${t.weightsMap.get((a=this.weight)!=null?a:"regular")}
|
|
10
|
+
</svg>`}};t.weightsMap=new Map([["thin",r`<path d="M236,56v48a4,4,0,0,1-4,4H184a4,4,0,0,1,0-8h37.7L187.53,68.69l-.13-.12a84,84,0,1,0-1.75,120.51,4,4,0,0,1,5.5,5.82A91.43,91.43,0,0,1,128,220h-1.26A92,92,0,1,1,193,62.84l35,32.05V56a4,4,0,1,1,8,0Z"/>`],["light",r`<path d="M238,56v48a6,6,0,0,1-6,6H184a6,6,0,0,1,0-12h32.55l-30.38-27.8c-.06-.06-.12-.13-.19-.19a82,82,0,1,0-1.7,117.65,6,6,0,0,1,8.24,8.73A93.46,93.46,0,0,1,128,222h-1.28A94,94,0,1,1,194.37,61.4L226,90.35V56a6,6,0,1,1,12,0Z"/>`],["regular",r`<path d="M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z"/>`],["bold",r`<path d="M244,56v48a12,12,0,0,1-12,12H184a12,12,0,1,1,0-24H201.1l-19-17.38c-.13-.12-.26-.24-.38-.37A76,76,0,1,0,127,204h1a75.53,75.53,0,0,0,52.15-20.72,12,12,0,0,1,16.49,17.45A99.45,99.45,0,0,1,128,228h-1.37A100,100,0,1,1,198.51,57.06L220,76.72V56a12,12,0,0,1,24,0Z"/>`],["fill",r`<path d="M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1-5.66-13.66l17-17-10.55-9.65-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,1,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60l10.93,10L226.34,50.3A8,8,0,0,1,240,56Z"/>`],["duotone",r`<path d="M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z" opacity="0.2"/><path d="M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z"/>`]]);t.styles=d`
|
|
11
|
+
:host {
|
|
12
|
+
display: contents;
|
|
13
|
+
}
|
|
14
|
+
`;o([i({type:String,reflect:!0})],t.prototype,"size",2);o([i({type:String,reflect:!0})],t.prototype,"weight",2);o([i({type:String,reflect:!0})],t.prototype,"color",2);o([i({type:Boolean,reflect:!0})],t.prototype,"mirrored",2);t=o([w("ph-arrow-clockwise")],t);export{t as PhArrowClockwise};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import{n as g,Y as d,t as r,p as w,O as s,s as c}from"./property-C9JG5tag.js";var u=Object.defineProperty,y=Object.getOwnPropertyDescriptor,l=(a,o,h,i)=>{for(var e=i>1?void 0:i?y(o,h):o,p=a.length-1,n;p>=0;p--)(n=a[p])&&(e=(i?n(o,h,e):n(e))||e);return i&&e&&u(o,h,e),e};let t=class extends g{constructor(){super(...arguments),this.size="1em",this.weight="regular",this.color="currentColor",this.mirrored=!1}render(){var a;return d`<svg
|
|
2
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
3
|
+
width="${this.size}"
|
|
4
|
+
height="${this.size}"
|
|
5
|
+
fill="${this.color}"
|
|
6
|
+
viewBox="0 0 256 256"
|
|
7
|
+
transform=${this.mirrored?"scale(-1, 1)":null}
|
|
8
|
+
>
|
|
9
|
+
${t.weightsMap.get((a=this.weight)!=null?a:"regular")}
|
|
10
|
+
</svg>`}};t.weightsMap=new Map([["thin",r`<path d="M202.83,146.83l-72,72a4,4,0,0,1-5.66,0l-72-72a4,4,0,0,1,5.66-5.66L124,206.34V40a4,4,0,0,1,8,0V206.34l65.17-65.17a4,4,0,0,1,5.66,5.66Z"/>`],["light",r`<path d="M204.24,148.24l-72,72a6,6,0,0,1-8.48,0l-72-72a6,6,0,0,1,8.48-8.48L122,201.51V40a6,6,0,0,1,12,0V201.51l61.76-61.75a6,6,0,0,1,8.48,8.48Z"/>`],["regular",r`<path d="M205.66,149.66l-72,72a8,8,0,0,1-11.32,0l-72-72a8,8,0,0,1,11.32-11.32L120,196.69V40a8,8,0,0,1,16,0V196.69l58.34-58.35a8,8,0,0,1,11.32,11.32Z"/>`],["bold",r`<path d="M208.49,152.49l-72,72a12,12,0,0,1-17,0l-72-72a12,12,0,0,1,17-17L116,187V40a12,12,0,0,1,24,0V187l51.51-51.52a12,12,0,0,1,17,17Z"/>`],["fill",r`<path d="M205.66,149.66l-72,72a8,8,0,0,1-11.32,0l-72-72A8,8,0,0,1,56,136h64V40a8,8,0,0,1,16,0v96h64a8,8,0,0,1,5.66,13.66Z"/>`],["duotone",r`<path d="M200,144l-72,72L56,144Z" opacity="0.2"/><path d="M207.39,140.94A8,8,0,0,0,200,136H136V40a8,8,0,0,0-16,0v96H56a8,8,0,0,0-5.66,13.66l72,72a8,8,0,0,0,11.32,0l72-72A8,8,0,0,0,207.39,140.94ZM128,204.69,75.31,152H180.69Z"/>`]]);t.styles=w`
|
|
11
|
+
:host {
|
|
12
|
+
display: contents;
|
|
13
|
+
}
|
|
14
|
+
`;l([s({type:String,reflect:!0})],t.prototype,"size",2);l([s({type:String,reflect:!0})],t.prototype,"weight",2);l([s({type:String,reflect:!0})],t.prototype,"color",2);l([s({type:Boolean,reflect:!0})],t.prototype,"mirrored",2);t=l([c("ph-arrow-down")],t);export{t as PhArrowDown};
|