@zerodev/smart-routing-address-react-ui 0.0.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/README.md +117 -0
- package/dist/_types/components/AddressDisplay/index.d.ts +43 -0
- package/dist/_types/components/AddressDisplay/index.d.ts.map +1 -0
- package/dist/_types/components/ErrorRetryCard/index.d.ts +21 -0
- package/dist/_types/components/ErrorRetryCard/index.d.ts.map +1 -0
- package/dist/_types/components/FeeBreakdown/feeInfo.d.ts +24 -0
- package/dist/_types/components/FeeBreakdown/feeInfo.d.ts.map +1 -0
- package/dist/_types/components/FeeBreakdown/index.d.ts +28 -0
- package/dist/_types/components/FeeBreakdown/index.d.ts.map +1 -0
- package/dist/_types/components/LoadingCard/index.d.ts +6 -0
- package/dist/_types/components/LoadingCard/index.d.ts.map +1 -0
- package/dist/_types/components/PendingDeposits/index.d.ts +14 -0
- package/dist/_types/components/PendingDeposits/index.d.ts.map +1 -0
- package/dist/_types/components/QrSheet/QrCode.d.ts +28 -0
- package/dist/_types/components/QrSheet/QrCode.d.ts.map +1 -0
- package/dist/_types/components/QrSheet/index.d.ts +16 -0
- package/dist/_types/components/QrSheet/index.d.ts.map +1 -0
- package/dist/_types/components/TxnItem/ExplorerLink.d.ts +16 -0
- package/dist/_types/components/TxnItem/ExplorerLink.d.ts.map +1 -0
- package/dist/_types/components/TxnItem/index.d.ts +19 -0
- package/dist/_types/components/TxnItem/index.d.ts.map +1 -0
- package/dist/_types/constants.d.ts +20 -0
- package/dist/_types/constants.d.ts.map +1 -0
- package/dist/_types/context/SmartRoutingAddressContext.d.ts +32 -0
- package/dist/_types/context/SmartRoutingAddressContext.d.ts.map +1 -0
- package/dist/_types/context/SmartRoutingAddressProvider.d.ts +13 -0
- package/dist/_types/context/SmartRoutingAddressProvider.d.ts.map +1 -0
- package/dist/_types/hooks/useCreateSmartRoutingAddress.d.ts +23 -0
- package/dist/_types/hooks/useCreateSmartRoutingAddress.d.ts.map +1 -0
- package/dist/_types/hooks/useDepositStatus.d.ts +25 -0
- package/dist/_types/hooks/useDepositStatus.d.ts.map +1 -0
- package/dist/_types/hooks/useNewDeposits.d.ts +8 -0
- package/dist/_types/hooks/useNewDeposits.d.ts.map +1 -0
- package/dist/_types/hooks/useProviderFees.d.ts +22 -0
- package/dist/_types/hooks/useProviderFees.d.ts.map +1 -0
- package/dist/_types/hooks/useSmartRoutingAddress.d.ts +20 -0
- package/dist/_types/hooks/useSmartRoutingAddress.d.ts.map +1 -0
- package/dist/_types/iconAssets.d.ts +7 -0
- package/dist/_types/iconAssets.d.ts.map +1 -0
- package/dist/_types/index.d.ts +14 -0
- package/dist/_types/index.d.ts.map +1 -0
- package/dist/_types/pages/Deposit.d.ts +12 -0
- package/dist/_types/pages/Deposit.d.ts.map +1 -0
- package/dist/_types/pages/PastDeposits.d.ts +14 -0
- package/dist/_types/pages/PastDeposits.d.ts.map +1 -0
- package/dist/_types/pages/TransactionDetails.d.ts +11 -0
- package/dist/_types/pages/TransactionDetails.d.ts.map +1 -0
- package/dist/_types/pages/index.d.ts +25 -0
- package/dist/_types/pages/index.d.ts.map +1 -0
- package/dist/_types/types.d.ts +75 -0
- package/dist/_types/types.d.ts.map +1 -0
- package/dist/_types/utils/chains.d.ts +8 -0
- package/dist/_types/utils/chains.d.ts.map +1 -0
- package/dist/_types/utils/config.d.ts +35 -0
- package/dist/_types/utils/config.d.ts.map +1 -0
- package/dist/_types/utils/deposits.d.ts +29 -0
- package/dist/_types/utils/deposits.d.ts.map +1 -0
- package/dist/_types/utils/fees.d.ts +14 -0
- package/dist/_types/utils/fees.d.ts.map +1 -0
- package/dist/_types/utils/format.d.ts +27 -0
- package/dist/_types/utils/format.d.ts.map +1 -0
- package/dist/_types/utils/providerFees.d.ts +103 -0
- package/dist/_types/utils/providerFees.d.ts.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.mjs +2180 -0
- package/dist/index.mjs.map +1 -0
- package/dist/styles.css +2 -0
- package/package.json +91 -0
- package/src/components/AddressDisplay/index.tsx +108 -0
- package/src/components/ErrorRetryCard/index.tsx +68 -0
- package/src/components/FeeBreakdown/feeInfo.ts +25 -0
- package/src/components/FeeBreakdown/index.tsx +218 -0
- package/src/components/LoadingCard/index.tsx +27 -0
- package/src/components/PendingDeposits/index.tsx +152 -0
- package/src/components/QrSheet/QrCode.tsx +163 -0
- package/src/components/QrSheet/index.tsx +80 -0
- package/src/components/TxnItem/ExplorerLink.tsx +37 -0
- package/src/components/TxnItem/index.tsx +178 -0
- package/src/constants.ts +102 -0
- package/src/context/SmartRoutingAddressContext.ts +48 -0
- package/src/context/SmartRoutingAddressProvider.tsx +145 -0
- package/src/hooks/useCreateSmartRoutingAddress.ts +28 -0
- package/src/hooks/useDepositStatus.ts +110 -0
- package/src/hooks/useNewDeposits.ts +25 -0
- package/src/hooks/useProviderFees.ts +235 -0
- package/src/hooks/useSmartRoutingAddress.ts +25 -0
- package/src/iconAssets.ts +130 -0
- package/src/index.ts +27 -0
- package/src/pages/Deposit.tsx +605 -0
- package/src/pages/PastDeposits.tsx +232 -0
- package/src/pages/TransactionDetails.tsx +466 -0
- package/src/pages/index.tsx +165 -0
- package/src/types.ts +84 -0
- package/src/utils/chains.ts +26 -0
- package/src/utils/config.ts +142 -0
- package/src/utils/deposits.ts +106 -0
- package/src/utils/fees.ts +51 -0
- package/src/utils/format.ts +108 -0
- package/src/utils/providerFees.ts +301 -0
package/README.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# @zerodev/smart-routing-address-react-ui
|
|
2
|
+
|
|
3
|
+
React UI kit for [ZeroDev Smart Routing Address](https://docs.zerodev.app/) —
|
|
4
|
+
a drop-in **funding widget** that generates a single deposit address, routes
|
|
5
|
+
whatever the user sends across chains and tokens, and reports live status.
|
|
6
|
+
|
|
7
|
+
Mount one component, get a full deposit-funding experience: token & source
|
|
8
|
+
chain picker, QR + copy card, live fee breakdown, pending/past deposit lists,
|
|
9
|
+
and a per-transaction details view. UI styling comes from
|
|
10
|
+
[`@zerodev/react-ui`](../react-ui/README.md).
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pnpm add @zerodev/smart-routing-address-react-ui viem
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
> `react` (18 or 19), `react-dom`, and `viem` are **peer dependencies** —
|
|
19
|
+
> install them alongside this package. `@zerodev/smart-routing-address` ships
|
|
20
|
+
> as a regular dependency; install it directly only if you import from it
|
|
21
|
+
> (e.g. `createCall` for custom `actions`).
|
|
22
|
+
|
|
23
|
+
## Setup
|
|
24
|
+
|
|
25
|
+
### 1. Import the stylesheet once at app entry
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import '@zerodev/smart-routing-address-react-ui/styles.css'
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 2. Wrap the subtree in `SmartRoutingAddressProvider`
|
|
32
|
+
|
|
33
|
+
The provider holds the config and lazily creates the smart routing address
|
|
34
|
+
for a recipient. It doesn't render the widget — mount `<SmartRoutingAddress
|
|
35
|
+
/>` inline where you want the UI.
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import {
|
|
39
|
+
SmartRoutingAddress,
|
|
40
|
+
SmartRoutingAddressProvider,
|
|
41
|
+
} from '@zerodev/smart-routing-address-react-ui'
|
|
42
|
+
import { arbitrum } from 'viem/chains'
|
|
43
|
+
|
|
44
|
+
function Funding({ recipient }: { recipient: `0x${string}` }) {
|
|
45
|
+
return (
|
|
46
|
+
<SmartRoutingAddressProvider
|
|
47
|
+
config={{
|
|
48
|
+
projectId: 'your-project-id', // from https://dashboard.zerodev.app
|
|
49
|
+
targetChainId: arbitrum.id,
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
<SmartRoutingAddress recipient={recipient} onClose={() => {}} />
|
|
53
|
+
</SmartRoutingAddressProvider>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Usage
|
|
59
|
+
|
|
60
|
+
`<SmartRoutingAddress />` renders the current step (deposit, past deposits,
|
|
61
|
+
or a single transaction's details) inside its own card frame. Navigation is
|
|
62
|
+
owned by the widget; `onClose` fires when the top-right ✕ is tapped so the
|
|
63
|
+
host app can dismiss.
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
<SmartRoutingAddress
|
|
67
|
+
recipient={recipient}
|
|
68
|
+
onClose={() => setOpen(false)}
|
|
69
|
+
size="lg" // 'sm' | 'md' | 'lg'
|
|
70
|
+
/>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Address creation and deposit polling happen in the provider; host code can
|
|
74
|
+
observe the widget's state via `useSmartRoutingAddress()` (e.g. drive a
|
|
75
|
+
companion panel from the route the widget is showing) and pre-create the
|
|
76
|
+
address via `useCreateSmartRoutingAddress().getOrCreateAddress` before the modal
|
|
77
|
+
opens. To build a fully custom deposit UI, use the
|
|
78
|
+
`@zerodev/smart-routing-address` SDK directly — this package's hooks are
|
|
79
|
+
widget plumbing, not a UI kit.
|
|
80
|
+
|
|
81
|
+
## Configuration
|
|
82
|
+
|
|
83
|
+
Everything the widget needs is on the config passed to the provider.
|
|
84
|
+
|
|
85
|
+
| Field | Type | Description |
|
|
86
|
+
| --- | --- | --- |
|
|
87
|
+
| `projectId` | `string?` | ZeroDev project id; appended to the SRA server URL. |
|
|
88
|
+
| `targetChainId` | `number` | Chain id where funds settle. **Required.** |
|
|
89
|
+
| `version` | `SmartRoutingAddressVersion?` | SRA manager version. Defaults to the latest stable. |
|
|
90
|
+
| `actions` | `CreateSmartRoutingAddressParams['actions']?` | Destination actions per token type. When omitted, deposits are simply transferred to the recipient. |
|
|
91
|
+
| `slippage` | `number?` | Max slippage in basis points (50 = 0.5%). When omitted, the SRA server picks its default. |
|
|
92
|
+
| `baseUrl` | `string?` | Override the SRA server root URL; the `projectId` is appended. |
|
|
93
|
+
|
|
94
|
+
## API
|
|
95
|
+
|
|
96
|
+
| Export | Description |
|
|
97
|
+
| --- | --- |
|
|
98
|
+
| `<SmartRoutingAddressProvider />` | Wraps the subtree; owns config, recipient, and the address lifecycle. |
|
|
99
|
+
| `<SmartRoutingAddress />` | The funding widget UI. Props: `recipient`, `onClose`, `size?`, `className?`. |
|
|
100
|
+
| `useSmartRoutingAddress()` | Read-only widget companion for hosts: address state and the `activeRoute` the widget is showing. |
|
|
101
|
+
| `useCreateSmartRoutingAddress()` | Action counterpart: `getOrCreateAddress(recipient)` returns the deposit address, creating it if needed — idempotent per recipient, so it's safe to call on every hover/open. Creation params come from the provider config. |
|
|
102
|
+
|
|
103
|
+
### Types
|
|
104
|
+
|
|
105
|
+
`SmartRoutingAddressConfig`, `SmartRoutingAddressProps`,
|
|
106
|
+
`SmartRoutingAddressStep`, `SmartRoutingAddressProviderProps`,
|
|
107
|
+
`UseSmartRoutingAddressResult`, `UseCreateSmartRoutingAddressResult`.
|
|
108
|
+
|
|
109
|
+
## Development
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
pnpm build # build the package (dist + types + css)
|
|
113
|
+
pnpm dev # watch mode (types)
|
|
114
|
+
pnpm typecheck
|
|
115
|
+
pnpm test # vitest
|
|
116
|
+
pnpm storybook # component catalog
|
|
117
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { AddressState } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* The card that renders the deposit address in the SRA "Deposit funds" screen.
|
|
4
|
+
*
|
|
5
|
+
* Two visual states, each mapped 1:1 to a Figma node:
|
|
6
|
+
* - Loading (Figma 17634:104343, "Smart Funding" card): delegates to
|
|
7
|
+
* `LoadingCard`, which is the shared spinner+text pill used elsewhere in
|
|
8
|
+
* the SRA flow (e.g., SmartFunding's "Watching for deposit" state).
|
|
9
|
+
* - Ready (Figma 17762:78875, address+QR row): 14px radius, 40% offWhite
|
|
10
|
+
* surface, left-aligned address text + a 52×52 white QR button on the
|
|
11
|
+
* right. Rendered when `address` is supplied.
|
|
12
|
+
*
|
|
13
|
+
* The two states have deliberately different visuals; they share this
|
|
14
|
+
* component because the parent renders the same slot in both cases.
|
|
15
|
+
*/
|
|
16
|
+
export interface AddressDisplayUIProps {
|
|
17
|
+
/** Deposit address to render; when omitted, the loading variant is shown. */
|
|
18
|
+
address?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Message rendered in the loading variant. Include chain-specific context
|
|
21
|
+
* from the caller, e.g., `Watching for your deposit on Base…`.
|
|
22
|
+
*/
|
|
23
|
+
loadingText?: string;
|
|
24
|
+
/** Handler for the QR icon button (ready variant). */
|
|
25
|
+
onQrClick?: (() => void) | undefined;
|
|
26
|
+
className?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare function AddressDisplayUI({ address, loadingText, onQrClick, className, }: AddressDisplayUIProps): import("react").JSX.Element;
|
|
29
|
+
export interface AddressDisplayProps {
|
|
30
|
+
/** Current address-generation state from the SRA context. */
|
|
31
|
+
status: AddressState['status'];
|
|
32
|
+
/** Deposit address, present when `status === 'success'`. */
|
|
33
|
+
address?: string | undefined;
|
|
34
|
+
/** Handler for the QR icon button (only meaningful once `address` resolves). */
|
|
35
|
+
onQrClick?: (() => void) | undefined;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* State-driven wrapper around `AddressDisplayUI`. Picks the right variant
|
|
39
|
+
* (loading / ready) based on the SRA address-generation status; the parent
|
|
40
|
+
* page renders `ErrorRetryCard` in the error case instead of this component.
|
|
41
|
+
*/
|
|
42
|
+
export declare function AddressDisplay({ status, address, onQrClick, }: AddressDisplayProps): import("react").JSX.Element | null;
|
|
43
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/AddressDisplay/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG/C;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,qBAAqB;IACpC,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,sDAAsD;IACtD,SAAS,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAA;IACpC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,WAA0C,EAC1C,SAAS,EACT,SAAS,GACV,EAAE,qBAAqB,+BA6CvB;AAED,MAAM,WAAW,mBAAmB;IAClC,6DAA6D;IAC7D,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAA;IAC9B,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,gFAAgF;IAChF,SAAS,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAA;CACrC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,OAAO,EACP,SAAS,GACV,EAAE,mBAAmB,sCAMrB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface ErrorRetryCardProps {
|
|
2
|
+
/** Error copy shown on the left side, e.g. "Failed to create deposit
|
|
3
|
+
* address…" — kept short (Figma design truncates on one line). */
|
|
4
|
+
message: string;
|
|
5
|
+
/** Called when the user clicks the refresh affordance. */
|
|
6
|
+
onRetry: () => void;
|
|
7
|
+
/** Marks the button as busy while a retry is in flight — disables clicks
|
|
8
|
+
* and spins the icon so back-to-back taps don't stack requests. */
|
|
9
|
+
busy?: boolean;
|
|
10
|
+
/** Accessible label for the icon-only refresh button. Defaults to "Retry". */
|
|
11
|
+
retryLabel?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Error banner with an inline retry affordance. Renders as a compact pill
|
|
16
|
+
* matching the Figma spec (`bg-negative/10`, error-red text, right-hand
|
|
17
|
+
* 52×52 refresh button). Used above the "Min deposit" row in the deposit UI
|
|
18
|
+
* to surface address-creation, empty-route and polling failures.
|
|
19
|
+
*/
|
|
20
|
+
export declare function ErrorRetryCard({ message, onRetry, busy, retryLabel, className, }: ErrorRetryCardProps): import("react").JSX.Element;
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRetryCard/index.tsx"],"names":[],"mappings":"AAEA,MAAM,WAAW,mBAAmB;IAClC;sEACkE;IAClE,OAAO,EAAE,MAAM,CAAA;IACf,0DAA0D;IAC1D,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB;uEACmE;IACnE,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,OAAO,EACP,IAAI,EACJ,UAAoB,EACpB,SAAS,GACV,EAAE,mBAAmB,+BAuCrB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plain-language explanations for each fee/route line, surfaced as tooltips
|
|
3
|
+
* on the info icons in the fee section so users understand what they're
|
|
4
|
+
* charged.
|
|
5
|
+
*/
|
|
6
|
+
export declare const FEE_INFO: {
|
|
7
|
+
readonly minDeposit: "Smallest amount this route can process after fees.";
|
|
8
|
+
readonly maxSlippage: "Maximum price movement allowed during the swap.";
|
|
9
|
+
readonly estimatedFee: "Estimated swap, bridge, and network costs.";
|
|
10
|
+
readonly readyIn: "Estimated arrival after the deposit is detected.";
|
|
11
|
+
readonly provider: "Bridge provider selected for this route.";
|
|
12
|
+
readonly execution: "Cost to execute and deliver funds on the destination chain.";
|
|
13
|
+
readonly capital: "Relayer cost for fronting capital while bridging.";
|
|
14
|
+
readonly destGas: "Gas to complete delivery on the destination chain.";
|
|
15
|
+
readonly lp: "Bridge liquidity-provider fee.";
|
|
16
|
+
readonly service: "Solver fee for filling the route.";
|
|
17
|
+
readonly originGas: "Gas to submit from the source chain.";
|
|
18
|
+
readonly app: "Optional application fee.";
|
|
19
|
+
readonly detected: "Deposit detected on the source chain.";
|
|
20
|
+
readonly routing: "Bridge and swap are in progress.";
|
|
21
|
+
readonly completed: "Funds arrived in the delivery account.";
|
|
22
|
+
readonly failed: "Deposit could not be completed.";
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=feeInfo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feeInfo.d.ts","sourceRoot":"","sources":["../../../../src/components/FeeBreakdown/feeInfo.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;CAmBX,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { FeeBreakdown } from '../../utils/providerFees';
|
|
3
|
+
export type LiveValueProps = {
|
|
4
|
+
/** While true, the value is being re-quoted: show a spinner */
|
|
5
|
+
loading: boolean;
|
|
6
|
+
/** Changes with the value so the flash-in animation re-triggers */
|
|
7
|
+
flashKey: string | number;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* A value that swaps to a spinner while its route is re-quoting, then flashes
|
|
12
|
+
* the fresh value in. Used so a route change visibly recalculates the min
|
|
13
|
+
* deposit / estimated fee rather than silently snapping to new numbers.
|
|
14
|
+
*/
|
|
15
|
+
export declare function LiveValue({ loading, flashKey, children }: LiveValueProps): import("react").JSX.Element;
|
|
16
|
+
/** Combined fee value: proportional rate (emphasised) + fixed USD cost */
|
|
17
|
+
export declare function FeeSummary({ breakdown }: {
|
|
18
|
+
breakdown: FeeBreakdown;
|
|
19
|
+
}): import("react").JSX.Element;
|
|
20
|
+
/** Provider name + brand icon, linked to the provider's site when known */
|
|
21
|
+
export declare function ProviderValue({ provider }: {
|
|
22
|
+
provider: string;
|
|
23
|
+
}): import("react").JSX.Element;
|
|
24
|
+
/** Itemised fee rows: provider + each fee leg */
|
|
25
|
+
export declare function FeeBreakdownRows({ breakdown }: {
|
|
26
|
+
breakdown: FeeBreakdown;
|
|
27
|
+
}): import("react").JSX.Element;
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/FeeBreakdown/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,YAAY,EAAW,MAAM,0BAA0B,CAAA;AAUrE,MAAM,MAAM,cAAc,GAAG;IAC3B,+DAA+D;IAC/D,OAAO,EAAE,OAAO,CAAA;IAChB,mEAAmE;IACnE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,cAAc,+BAwBxE;AAED,0EAA0E;AAC1E,wBAAgB,UAAU,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,EAAE,YAAY,CAAA;CAAE,+BAsCpE;AAED,2EAA2E;AAC3E,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,+BA+B/D;AAwED,iDAAiD;AACjD,wBAAgB,gBAAgB,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,EAAE,YAAY,CAAA;CAAE,+BAmB1E"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
export interface LoadingCardProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
text: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function LoadingCard({ text, className, ...rest }: LoadingCardProps): import("react").JSX.Element;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/LoadingCard/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAE3C,MAAM,WAAW,gBAAiB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACtE,IAAI,EAAE,MAAM,CAAA;CACb;AAED,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,gBAAgB,+BAmBzE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DepositedToken } from '@zerodev/smart-routing-address';
|
|
2
|
+
import type { EstimatedFee, SmartRoutingAddressConfig } from '../../types';
|
|
3
|
+
export interface PendingDepositsProps {
|
|
4
|
+
deposits: DepositedToken[];
|
|
5
|
+
estimatedFees: EstimatedFee[];
|
|
6
|
+
config: SmartRoutingAddressConfig;
|
|
7
|
+
/** Fired when a row is tapped — the widget uses this to open the
|
|
8
|
+
* transaction-details view for the selected deposit. When omitted, rows
|
|
9
|
+
* render as static (non-interactive). */
|
|
10
|
+
onSelectDeposit?: (deposit: DepositedToken) => void;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function PendingDeposits({ deposits, estimatedFees, config, onSelectDeposit, className, }: PendingDepositsProps): import("react").JSX.Element | null;
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/PendingDeposits/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAEpE,OAAO,KAAK,EAGV,YAAY,EACZ,yBAAyB,EAC1B,MAAM,aAAa,CAAA;AAgBpB,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,cAAc,EAAE,CAAA;IAC1B,aAAa,EAAE,YAAY,EAAE,CAAA;IAC7B,MAAM,EAAE,yBAAyB,CAAA;IACjC;;6CAEyC;IACzC,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAA;IACnD,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AASD,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,aAAa,EACb,MAAM,EACN,eAAe,EACf,SAAS,GACV,EAAE,oBAAoB,sCAuGtB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
interface QrCodeProps {
|
|
2
|
+
/** Data to encode. */
|
|
3
|
+
value: string;
|
|
4
|
+
/** Pixel size of the rendered SVG square. */
|
|
5
|
+
size: number;
|
|
6
|
+
/** Error correction level. Defaults to `'M'`. */
|
|
7
|
+
errorCorrectionLevel?: 'L' | 'M' | 'Q' | 'H';
|
|
8
|
+
/** Corner radius (in modules, scaled to px internally) for finder patterns. */
|
|
9
|
+
eyeRadius?: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Custom QR renderer that draws runs of horizontally-adjacent data modules as
|
|
13
|
+
* a single rounded pill. Finder patterns stay as sharp concentric squares
|
|
14
|
+
* (rounding them breaks the 1:1:3:1:1 corner ratio scanners use to locate the
|
|
15
|
+
* code). Isolated data modules render as pill-ish rects — visually close to
|
|
16
|
+
* circles at very small `PILL_PAD_RATIO`, still square-adjacent for scanners.
|
|
17
|
+
*
|
|
18
|
+
* Default `errorCorrectionLevel` is `'H'` (30% recovery) so the decorative
|
|
19
|
+
* rounding + shrinkage has plenty of headroom before scans fail.
|
|
20
|
+
*
|
|
21
|
+
* Quiet zone (spec: ≥4 modules of white around the code) is expected to be
|
|
22
|
+
* provided by the caller — e.g. via a white-background padded wrapper. This
|
|
23
|
+
* component fills the given `size` with the QR data area itself so the
|
|
24
|
+
* consumer controls the visual footprint.
|
|
25
|
+
*/
|
|
26
|
+
export declare function QrCode({ value, size, errorCorrectionLevel, eyeRadius, }: QrCodeProps): import("react").JSX.Element;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=QrCode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QrCode.d.ts","sourceRoot":"","sources":["../../../../src/components/QrSheet/QrCode.tsx"],"names":[],"mappings":"AAEA,UAAU,WAAW;IACnB,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAA;IACZ,iDAAiD;IACjD,oBAAoB,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;IAC5C,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAUD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,IAAI,EACJ,oBAA0B,EAC1B,SAAa,GACd,EAAE,WAAW,+BAyHb"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface QrSheetProps {
|
|
2
|
+
/** Whether the modal is open. Controlled. */
|
|
3
|
+
open: boolean;
|
|
4
|
+
/** Called when the modal requests to close (backdrop click, ESC,
|
|
5
|
+
* Cancel button). */
|
|
6
|
+
onOpenChange: (open: boolean) => void;
|
|
7
|
+
/** Address to encode in the QR code and display below it. */
|
|
8
|
+
address: string;
|
|
9
|
+
/** Called when the user taps "Copy address". */
|
|
10
|
+
onCopy: () => void;
|
|
11
|
+
}
|
|
12
|
+
/** Bottom-anchored modal showing the deposit address as a QR code. Composes
|
|
13
|
+
* `<BottomSheet>` (state) + `<BottomSheetContent>` (chrome); this file owns the
|
|
14
|
+
* QR / address / copy-cancel layout inside it. */
|
|
15
|
+
export declare function QrSheet({ open, onOpenChange, address, onCopy }: QrSheetProps): import("react").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/QrSheet/index.tsx"],"names":[],"mappings":"AAUA,MAAM,WAAW,YAAY;IAC3B,6CAA6C;IAC7C,IAAI,EAAE,OAAO,CAAA;IACb;yBACqB;IACrB,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAA;IACf,gDAAgD;IAChD,MAAM,EAAE,MAAM,IAAI,CAAA;CACnB;AAED;;kDAEkD;AAClD,wBAAgB,OAAO,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,YAAY,+BAsD5E"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface ExplorerLinkProps {
|
|
2
|
+
/** Full block-explorer URL, e.g. `https://etherscan.io/tx/0x…`. */
|
|
3
|
+
href: string;
|
|
4
|
+
/** Short address / hash used for the accessible label. */
|
|
5
|
+
address: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Small icon-only anchor to a block-explorer entry — the trailing action on a
|
|
10
|
+
* `TxnItem` row. Kept as its own component so both `PendingDeposits` (renders
|
|
11
|
+
* it inline via `TxnItem`'s `trailingAction` slot) and `PastDeposits`
|
|
12
|
+
* (renders it as an absolute sibling of the row-select button) use identical
|
|
13
|
+
* markup and styling.
|
|
14
|
+
*/
|
|
15
|
+
export declare function ExplorerLink({ href, address, className }: ExplorerLinkProps): import("react").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=ExplorerLink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExplorerLink.d.ts","sourceRoot":"","sources":["../../../../src/components/TxnItem/ExplorerLink.tsx"],"names":[],"mappings":"AAEA,MAAM,WAAW,iBAAiB;IAChC,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAA;IACZ,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,iBAAiB,+BAmB3E"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type TxnStatus = 'Routing' | 'Detected' | 'Received' | 'Failed';
|
|
2
|
+
export interface TxnItemProps {
|
|
3
|
+
/** Pre-formatted amount, e.g. `"$248.00 USD"`. */
|
|
4
|
+
amount: string;
|
|
5
|
+
/** Short address/hash display, e.g. `"0x4d2a…ba99"`. */
|
|
6
|
+
address: string;
|
|
7
|
+
/** Optional block-explorer URL. Address row becomes a link when supplied. */
|
|
8
|
+
href?: string;
|
|
9
|
+
/** Pre-formatted relative timestamp, e.g. `"2 mo ago"`. */
|
|
10
|
+
timestamp: string;
|
|
11
|
+
status: TxnStatus;
|
|
12
|
+
sourceTokenIconUrl?: string;
|
|
13
|
+
sourceChainIconUrl?: string;
|
|
14
|
+
destTokenIconUrl?: string;
|
|
15
|
+
destChainIconUrl?: string;
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function TxnItem({ amount, address, href, timestamp, status, sourceTokenIconUrl, sourceChainIconUrl, destTokenIconUrl, destChainIconUrl, className, }: TxnItemProps): import("react").JSX.Element;
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/TxnItem/index.tsx"],"names":[],"mappings":"AAEA,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAA;AAEtE,MAAM,WAAW,YAAY;IAC3B,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAA;IACd,wDAAwD;IACxD,OAAO,EAAE,MAAM,CAAA;IACf,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,2DAA2D;IAC3D,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,SAAS,CAAA;IACjB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AASD,wBAAgB,OAAO,CAAC,EACtB,MAAM,EACN,OAAO,EACP,IAAI,EACJ,SAAS,EACT,MAAM,EACN,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,SAAS,GACV,EAAE,YAAY,+BA4Bd"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Chain } from 'viem';
|
|
2
|
+
import type { SourceToken } from './types';
|
|
3
|
+
export declare const DEFAULT_POLLING_INTERVAL_MS = 5000;
|
|
4
|
+
export declare const DEFAULT_FILL_TIME_SECONDS = 30;
|
|
5
|
+
export declare const DEFAULT_DASHBOARD_URL = "https://smart-routing-address.zerodev.app";
|
|
6
|
+
/**
|
|
7
|
+
* Chains supported by the smart routing address SDK; mirrors the
|
|
8
|
+
* smart-account-plus core `supportedChainIds` list.
|
|
9
|
+
*/
|
|
10
|
+
export declare const SUPPORTED_CHAINS: readonly Chain[];
|
|
11
|
+
export declare const CHAINS_BY_ID: ReadonlyMap<number, Chain>;
|
|
12
|
+
/**
|
|
13
|
+
* Source tokens offered for deposits: every supported mainnet token the SDK
|
|
14
|
+
* exposes (NATIVE plus each ERC-20, with wrapped native surfaced as WETH),
|
|
15
|
+
* mapped to its viem chain object. Testnets are excluded from the default;
|
|
16
|
+
* chains this package cannot resolve to a viem chain are skipped, and token
|
|
17
|
+
* types the server can't route yet are filtered via `UNSUPPORTED_TOKEN_TYPES`.
|
|
18
|
+
*/
|
|
19
|
+
export declare const DEFAULT_SOURCE_TOKENS: SourceToken[];
|
|
20
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,MAAM,CAAA;AAyBjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C,eAAO,MAAM,2BAA2B,OAAQ,CAAA;AAEhD,eAAO,MAAM,yBAAyB,KAAK,CAAA;AAE3C,eAAO,MAAM,qBAAqB,8CAA8C,CAAA;AAEhF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,KAAK,EAuB5C,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,KAAK,CAEnD,CAAA;AAgBD;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,EAAE,WAAW,EAY7C,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Address } from 'viem';
|
|
2
|
+
import type { ActiveRoute, AddressState, SmartRoutingAddressConfig } from '../types';
|
|
3
|
+
export type SmartRoutingAddressContextValue = {
|
|
4
|
+
config: SmartRoutingAddressConfig;
|
|
5
|
+
addressState: AddressState;
|
|
6
|
+
/** Recipient of the active (or last requested) smart routing address */
|
|
7
|
+
recipient?: Address | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Return the smart routing address for the recipient, creating it if it
|
|
10
|
+
* has not been created yet. Safe to call multiple times; concurrent calls
|
|
11
|
+
* for the same recipient share one request, while a new recipient
|
|
12
|
+
* triggers a fresh creation. Rejects when creation fails (the failure
|
|
13
|
+
* also lands in `addressState`).
|
|
14
|
+
*/
|
|
15
|
+
getOrCreateAddress: (recipient: Address) => Promise<Address>;
|
|
16
|
+
/**
|
|
17
|
+
* Re-run address creation for the current recipient. No-op if no recipient
|
|
18
|
+
* has been set yet. Wired to the "Failed to create deposit address" retry
|
|
19
|
+
* button in the deposit UI.
|
|
20
|
+
*/
|
|
21
|
+
retry: () => Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* The route currently shown in the deposit UI. `null` until the picker
|
|
24
|
+
* seeds a selection. Hosts can read this to mirror the widget's state.
|
|
25
|
+
*/
|
|
26
|
+
activeRoute: ActiveRoute | null;
|
|
27
|
+
/** Deposit UI internal — writes the current picker selection to context. */
|
|
28
|
+
setActiveRoute: (route: ActiveRoute | null) => void;
|
|
29
|
+
};
|
|
30
|
+
export declare const SmartRoutingAddressContext: import("react").Context<SmartRoutingAddressContextValue | null>;
|
|
31
|
+
export declare function useSmartRoutingAddressContext(): SmartRoutingAddressContextValue;
|
|
32
|
+
//# sourceMappingURL=SmartRoutingAddressContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmartRoutingAddressContext.d.ts","sourceRoot":"","sources":["../../../src/context/SmartRoutingAddressContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,yBAAyB,EAC1B,MAAM,UAAU,CAAA;AAEjB,MAAM,MAAM,+BAA+B,GAAG;IAC5C,MAAM,EAAE,yBAAyB,CAAA;IACjC,YAAY,EAAE,YAAY,CAAA;IAC1B,wEAAwE;IACxE,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC/B;;;;;;OAMG;IACH,kBAAkB,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IAC5D;;;;OAIG;IACH,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B;;;OAGG;IACH,WAAW,EAAE,WAAW,GAAG,IAAI,CAAA;IAC/B,4EAA4E;IAC5E,cAAc,EAAE,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAA;CACpD,CAAA;AAED,eAAO,MAAM,0BAA0B,iEACsB,CAAA;AAE7D,wBAAgB,6BAA6B,IAAI,+BAA+B,CAQ/E"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { SmartRoutingAddressConfig } from '../types';
|
|
3
|
+
export type SmartRoutingAddressProviderProps = {
|
|
4
|
+
config: SmartRoutingAddressConfig;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Holds the config and the lazily created routing address. Wrap the subtree
|
|
9
|
+
* that renders <SmartRoutingAddress /> with this provider — the deposit UI
|
|
10
|
+
* itself is rendered inline by the consumer, not by this provider.
|
|
11
|
+
*/
|
|
12
|
+
export declare function SmartRoutingAddressProvider({ config, children, }: SmartRoutingAddressProviderProps): import("react").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=SmartRoutingAddressProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmartRoutingAddressProvider.d.ts","sourceRoot":"","sources":["../../../src/context/SmartRoutingAddressProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAA0C,MAAM,OAAO,CAAA;AAE9E,OAAO,KAAK,EAGV,yBAAyB,EAC1B,MAAM,UAAU,CAAA;AAUjB,MAAM,MAAM,gCAAgC,GAAG;IAC7C,MAAM,EAAE,yBAAyB,CAAA;IACjC,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,MAAM,EACN,QAAQ,GACT,EAAE,gCAAgC,+BAkHlC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Address } from 'viem';
|
|
2
|
+
export type UseCreateSmartRoutingAddressResult = {
|
|
3
|
+
/**
|
|
4
|
+
* Return the deposit address for the recipient, creating it if it doesn't
|
|
5
|
+
* exist yet. Idempotent per recipient — concurrent and repeated calls
|
|
6
|
+
* share one request, so it's safe to call on every hover/focus/mount.
|
|
7
|
+
* Rejects when creation fails (the failure also lands in the read hook's
|
|
8
|
+
* `addressState`). Creation params (`actions`, `slippage`, …) come from
|
|
9
|
+
* the provider config so the address always matches what the widget
|
|
10
|
+
* displays — there are no per-call overrides. To create addresses with
|
|
11
|
+
* bespoke params, use `createSmartRoutingAddress` from
|
|
12
|
+
* `@zerodev/smart-routing-address`.
|
|
13
|
+
*/
|
|
14
|
+
getOrCreateAddress: (recipient: Address) => Promise<Address>;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Action counterpart to `useSmartRoutingAddress` (which is read-only): lets
|
|
18
|
+
* hosts embedding the `<SmartRoutingAddress />` widget pre-create the
|
|
19
|
+
* deposit address — e.g. on hover or route entry, before the modal opens —
|
|
20
|
+
* so the widget renders instantly.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useCreateSmartRoutingAddress(): UseCreateSmartRoutingAddressResult;
|
|
23
|
+
//# sourceMappingURL=useCreateSmartRoutingAddress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCreateSmartRoutingAddress.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCreateSmartRoutingAddress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAGnC,MAAM,MAAM,kCAAkC,GAAG;IAC/C;;;;;;;;;;OAUG;IACH,kBAAkB,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAC7D,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,IAAI,kCAAkC,CAGjF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DepositedToken } from '@zerodev/smart-routing-address';
|
|
2
|
+
import type { Address } from 'viem';
|
|
3
|
+
export type UseDepositStatusParams = {
|
|
4
|
+
address: Address | undefined;
|
|
5
|
+
enabled?: boolean | undefined;
|
|
6
|
+
pollingInterval?: number | undefined;
|
|
7
|
+
baseUrl?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
export type UseDepositStatusResult = {
|
|
10
|
+
deposits: DepositedToken[];
|
|
11
|
+
totalCount: number;
|
|
12
|
+
/** True once at least one status response has been received */
|
|
13
|
+
hasLoaded: boolean;
|
|
14
|
+
isLoading: boolean;
|
|
15
|
+
error: Error | null;
|
|
16
|
+
/** Trigger an immediate poll — used by the "Retry" button after a fetch
|
|
17
|
+
* error. No-op while no address is set. */
|
|
18
|
+
refetch: () => void;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Polls the smart routing address status endpoint while enabled, returning
|
|
22
|
+
* the current list of deposits.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useDepositStatus({ address, enabled, pollingInterval, baseUrl, }: UseDepositStatusParams): UseDepositStatusResult;
|
|
25
|
+
//# sourceMappingURL=useDepositStatus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDepositStatus.d.ts","sourceRoot":"","sources":["../../../src/hooks/useDepositStatus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAGpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAGnC,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,OAAO,GAAG,SAAS,CAAA;IAC5B,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACpC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE,cAAc,EAAE,CAAA;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,+DAA+D;IAC/D,SAAS,EAAE,OAAO,CAAA;IAClB,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB;+CAC2C;IAC3C,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB,CAAA;AAUD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,OAAc,EACd,eAA6C,EAC7C,OAAO,GACR,EAAE,sBAAsB,GAAG,sBAAsB,CAmEjD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DepositedToken } from '@zerodev/smart-routing-address';
|
|
2
|
+
/**
|
|
3
|
+
* Tracks deposits that arrived after the first loaded status snapshot.
|
|
4
|
+
* The snapshot taken when `ready` first becomes true acts as the baseline,
|
|
5
|
+
* so pre-existing deposits are not reported as new.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useNewDeposits(deposits: DepositedToken[], ready: boolean): DepositedToken[];
|
|
8
|
+
//# sourceMappingURL=useNewDeposits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNewDeposits.d.ts","sourceRoot":"","sources":["../../../src/hooks/useNewDeposits.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAIpE;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,cAAc,EAAE,EAC1B,KAAK,EAAE,OAAO,GACb,cAAc,EAAE,CAYlB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Chain } from 'viem';
|
|
2
|
+
import type { EstimatedFeeData, SourceToken } from '../types';
|
|
3
|
+
import { type FeeBreakdown } from '../utils/providerFees';
|
|
4
|
+
export type ProviderFeesState = {
|
|
5
|
+
/** Cheapest normalised quote, or null while loading / unquotable */
|
|
6
|
+
fees: FeeBreakdown | null;
|
|
7
|
+
/** True from the moment the route changes until the quotes resolve */
|
|
8
|
+
loading: boolean;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Fetch live fee quotes for the selected route from every supported provider
|
|
12
|
+
* (Across + Relay), normalise them, and return the cheapest. Across and Relay
|
|
13
|
+
* expose the itemised bridge legs the SRA fee estimate alone does not, so this
|
|
14
|
+
* enriches the breakdown with how the user is actually charged and which route
|
|
15
|
+
* is currently best.
|
|
16
|
+
*
|
|
17
|
+
* Returns null while loading, for routes that can't be quoted (native /
|
|
18
|
+
* unresolvable tokens), or when every request fails — callers fall back to
|
|
19
|
+
* the SRA execution fee on their own.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useProviderFees(source: SourceToken | null, destChain: Chain, feeData: EstimatedFeeData | null, recipient?: string): ProviderFeesState;
|
|
22
|
+
//# sourceMappingURL=useProviderFees.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useProviderFees.d.ts","sourceRoot":"","sources":["../../../src/hooks/useProviderFees.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAW,KAAK,EAAE,MAAM,MAAM,CAAA;AAE1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE7D,OAAO,EAEL,KAAK,YAAY,EAIlB,MAAM,uBAAuB,CAAA;AAmH9B,MAAM,MAAM,iBAAiB,GAAG;IAC9B,oEAAoE;IACpE,IAAI,EAAE,YAAY,GAAG,IAAI,CAAA;IACzB,sEAAsE;IACtE,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,WAAW,GAAG,IAAI,EAC1B,SAAS,EAAE,KAAK,EAChB,OAAO,EAAE,gBAAgB,GAAG,IAAI,EAChC,SAAS,CAAC,EAAE,MAAM,GACjB,iBAAiB,CAoFnB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ActiveRoute, AddressState } from '../types';
|
|
2
|
+
export type UseSmartRoutingAddressResult = {
|
|
3
|
+
addressState: AddressState;
|
|
4
|
+
/**
|
|
5
|
+
* The route the widget's deposit UI is currently showing (source token +
|
|
6
|
+
* chain + estimated fee). `null` until the picker has seeded a selection.
|
|
7
|
+
* Read-only by design: the widget's picker owns this value; hosts mirror
|
|
8
|
+
* it (e.g. to drive a companion send panel), they don't set it.
|
|
9
|
+
*/
|
|
10
|
+
activeRoute: ActiveRoute | null;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Read-only companion hook for hosts embedding the `<SmartRoutingAddress />`
|
|
14
|
+
* widget: observe the address state and mirror the route the widget is
|
|
15
|
+
* showing, from anywhere inside the provider. Its action counterpart is
|
|
16
|
+
* `useCreateSmartRoutingAddress`. Not a kit for building a custom deposit
|
|
17
|
+
* UI — for that, use `@zerodev/smart-routing-address` directly.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useSmartRoutingAddress(): UseSmartRoutingAddressResult;
|
|
20
|
+
//# sourceMappingURL=useSmartRoutingAddress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSmartRoutingAddress.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSmartRoutingAddress.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEzD,MAAM,MAAM,4BAA4B,GAAG;IACzC,YAAY,EAAE,YAAY,CAAA;IAC1B;;;;;OAKG;IACH,WAAW,EAAE,WAAW,GAAG,IAAI,CAAA;CAChC,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,IAAI,4BAA4B,CAGrE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Chain icon by chain id; testnets reuse their mainnet icon */
|
|
2
|
+
export declare const CHAIN_ICONS: Record<number, string>;
|
|
3
|
+
/** Token icon by display symbol; wrapped variants reuse the base icon */
|
|
4
|
+
export declare const TOKEN_ICONS: Record<string, string>;
|
|
5
|
+
/** Provider brand icon by `FeeBreakdown.provider` value ("Across" / "Relay"). */
|
|
6
|
+
export declare const PROVIDER_ICONS: Record<string, string>;
|
|
7
|
+
//# sourceMappingURL=iconAssets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iconAssets.d.ts","sourceRoot":"","sources":["../../src/iconAssets.ts"],"names":[],"mappings":"AA+EA,gEAAgE;AAChE,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAuB9C,CAAA;AAED,yEAAyE;AACzE,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAY9C,CAAA;AAOD,iFAAiF;AACjF,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAGjD,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zerodev/smart-routing-address-react-ui
|
|
3
|
+
* React hooks, provider, and UI for ZeroDev Smart Routing Address deposits.
|
|
4
|
+
*/
|
|
5
|
+
export type { SmartRoutingAddressProviderProps } from './context/SmartRoutingAddressProvider';
|
|
6
|
+
export { SmartRoutingAddressProvider } from './context/SmartRoutingAddressProvider';
|
|
7
|
+
export type { UseCreateSmartRoutingAddressResult } from './hooks/useCreateSmartRoutingAddress';
|
|
8
|
+
export { useCreateSmartRoutingAddress } from './hooks/useCreateSmartRoutingAddress';
|
|
9
|
+
export type { UseSmartRoutingAddressResult } from './hooks/useSmartRoutingAddress';
|
|
10
|
+
export { useSmartRoutingAddress } from './hooks/useSmartRoutingAddress';
|
|
11
|
+
export type { SmartRoutingAddressProps, SmartRoutingAddressStep, } from './pages';
|
|
12
|
+
export { SmartRoutingAddress } from './pages';
|
|
13
|
+
export type { SmartRoutingAddressConfig } from './types';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|