@rhinestone/deposit-modal 0.13.0 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -12
- package/bridge-transcript.json +653 -0
- package/dist/ClaimModal-GDFENSLV.mjs +13 -0
- package/dist/ClaimModal-L3FUBI5U.cjs +13 -0
- package/dist/{DepositModalReown-3H75G3XQ.mjs → DepositModalReown-2EVV64OA.mjs} +30 -27
- package/dist/{DepositModalReown-YNNHLAV2.cjs → DepositModalReown-GAD45GIC.cjs} +77 -74
- package/dist/WithdrawModal-FAQH35NG.cjs +12 -0
- package/dist/WithdrawModal-IKUHF5CF.mjs +12 -0
- package/dist/{chunk-RAADLTSW.cjs → chunk-4J5ADVIN.cjs} +184 -139
- package/dist/{chunk-DSIZNRWA.mjs → chunk-5Q5CSVKF.mjs} +1049 -388
- package/dist/{chunk-HOGZKHHY.cjs → chunk-62UCV2LG.cjs} +3 -3
- package/dist/{chunk-CVGNCUVU.cjs → chunk-7AZFT2MV.cjs} +22 -13
- package/dist/{chunk-7N77GIP4.cjs → chunk-A6JPBMYY.cjs} +465 -171
- package/dist/{chunk-GACIGCSN.cjs → chunk-AQVJUXSG.cjs} +1 -1
- package/dist/{chunk-LTMMETAB.mjs → chunk-GZ4GQ5MC.mjs} +404 -110
- package/dist/{chunk-ZMT4ATHR.cjs → chunk-HAQOFI3D.cjs} +594 -41
- package/dist/{chunk-FZ5FZFIG.mjs → chunk-LMG46EP2.mjs} +1 -1
- package/dist/{chunk-2G2EIN4A.cjs → chunk-NQMC5VKQ.cjs} +1343 -682
- package/dist/{chunk-OLCD75JK.mjs → chunk-QACOOLOE.mjs} +451 -131
- package/dist/{chunk-XYJFEN5D.mjs → chunk-R5UQ3TN4.mjs} +1 -1
- package/dist/{chunk-EOMT5LKX.mjs → chunk-UX35GYLM.mjs} +556 -3
- package/dist/{chunk-YREVFB64.mjs → chunk-VALXN5IO.mjs} +16 -7
- package/dist/{chunk-COCBCQQC.mjs → chunk-XCTRKCNM.mjs} +51 -6
- package/dist/{chunk-5NUIKYSF.cjs → chunk-YP7QVKQ6.cjs} +458 -138
- package/dist/claim.cjs +6 -6
- package/dist/claim.d.cts +3 -3
- package/dist/claim.d.ts +3 -3
- package/dist/claim.mjs +5 -5
- package/dist/constants.cjs +2 -2
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/deposit.cjs +6 -6
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +5 -5
- package/dist/embed.cjs +310 -102
- package/dist/embed.d.cts +7 -1
- package/dist/embed.d.ts +7 -1
- package/dist/embed.mjs +285 -77
- package/dist/index.cjs +9 -9
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +8 -8
- package/dist/types-Bho4OA03.d.ts +982 -0
- package/dist/types-DP_3KwlD.d.cts +982 -0
- package/dist/withdraw.cjs +5 -5
- package/dist/withdraw.d.cts +3 -3
- package/dist/withdraw.d.ts +3 -3
- package/dist/withdraw.mjs +4 -4
- package/package.json +29 -7
- package/dist/ClaimModal-CREZO27I.mjs +0 -11
- package/dist/ClaimModal-JRIA32U2.cjs +0 -11
- package/dist/WithdrawModal-NVRX44IZ.mjs +0 -10
- package/dist/WithdrawModal-YYSBPCJJ.cjs +0 -10
- package/dist/types-B89I8_8H.d.ts +0 -638
- package/dist/types-nnDR4tqA.d.cts +0 -638
|
@@ -1,638 +0,0 @@
|
|
|
1
|
-
import { TypedDataDefinition, Address, Hex, WalletClient, PublicClient, Chain } from 'viem';
|
|
2
|
-
import { T as TargetChain } from './caip-D8aRWdEY.cjs';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Public config shape exposed on DepositModalProps. Each provider defaults to
|
|
6
|
-
* off — clients must explicitly opt in.
|
|
7
|
-
*
|
|
8
|
-
* A key controls VISIBILITY only. A provider that is enabled but has no
|
|
9
|
-
* implementation yet renders as a disabled "Coming soon" row; one that is not
|
|
10
|
-
* enabled is not shown at all.
|
|
11
|
-
*/
|
|
12
|
-
interface AssetMigrationsConfig {
|
|
13
|
-
polymarket?: boolean;
|
|
14
|
-
hyperliquid?: boolean;
|
|
15
|
-
aave?: boolean;
|
|
16
|
-
morpho?: boolean;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
declare const RECOVER_TYPES: {
|
|
20
|
-
readonly RecoverDeposit: readonly [{
|
|
21
|
-
readonly name: "depositId";
|
|
22
|
-
readonly type: "uint256";
|
|
23
|
-
}, {
|
|
24
|
-
readonly name: "destination";
|
|
25
|
-
readonly type: "address";
|
|
26
|
-
}];
|
|
27
|
-
};
|
|
28
|
-
/** What `signRecovery` is handed. */
|
|
29
|
-
interface SignRecoveryPayload {
|
|
30
|
-
/**
|
|
31
|
-
* Sign this exactly. Pass it to `signTypedData` on the wallet that owns
|
|
32
|
-
* `signer` — or to your account SDK, if `signer` is a smart account.
|
|
33
|
-
*/
|
|
34
|
-
typedData: TypedDataDefinition<typeof RECOVER_TYPES, "RecoverDeposit">;
|
|
35
|
-
/**
|
|
36
|
-
* The address whose signature the processor will verify: the deposit's
|
|
37
|
-
* `recipient`. Whatever you return must be a signature this address's own
|
|
38
|
-
* verifier accepts.
|
|
39
|
-
*/
|
|
40
|
-
signer: Address;
|
|
41
|
-
/**
|
|
42
|
-
* The chain the deposit is on, and therefore the chain the signature is
|
|
43
|
-
* verified against.
|
|
44
|
-
*
|
|
45
|
-
* Load-bearing for a smart account: ERC-1271 and ERC-6492 verification are
|
|
46
|
-
* per-chain, so a signature produced against the wrong one is well formed,
|
|
47
|
-
* rejected remotely, and reported to the user as a signature their wallet
|
|
48
|
-
* cannot make. An EOA signature does not depend on it.
|
|
49
|
-
*/
|
|
50
|
-
chainId: number;
|
|
51
|
-
/** Deposit being recovered, for your own logging or confirmation UI. */
|
|
52
|
-
depositId: string;
|
|
53
|
-
/** Where the funds will go. Covered by the signature. */
|
|
54
|
-
destination: Address;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Produces a signature the recipient's verifier accepts.
|
|
58
|
-
*
|
|
59
|
-
* - **embedded EOA** (Privy, Turnkey, Dynamic): `signTypedData` and return the raw
|
|
60
|
-
* 65-byte result.
|
|
61
|
-
* - **deployed smart account**: return a signature valid under its ERC-1271
|
|
62
|
-
* `isValidSignature`. A raw owner signature is usually *not* enough — a Safe, for
|
|
63
|
-
* instance, expects its own message wrapping — so go through your account SDK.
|
|
64
|
-
* - **undeployed smart account**: wrap it per ERC-6492 so the processor can verify
|
|
65
|
-
* counterfactually. `ox/erc6492`'s `SignatureErc6492.wrap` does this, and ships
|
|
66
|
-
* with viem already.
|
|
67
|
-
*/
|
|
68
|
-
type SignRecovery = (payload: SignRecoveryPayload) => Promise<Hex>;
|
|
69
|
-
/** Structured code from the processor; drives copy and whether a retry helps. */
|
|
70
|
-
type RecoveryErrorCode = "DEPOSIT_NOT_RECOVERABLE" | "RECOVERY_UNSUPPORTED" | "SIGNATURE_INVALID" | "VERIFICATION_UNAVAILABLE" | "REFUND_RECONCILIATION_REQUIRED" | "REFUND_FAILED";
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Consumer-supplied RPC URL overrides, scoped to a single modal instance (see
|
|
74
|
-
* {@link RpcUrlsProvider}). Threaded into every client the modal builds — EVM
|
|
75
|
-
* public clients (`public-client.ts`), the wallet adapter's transports
|
|
76
|
-
* (`reown.tsx`), and the Solana connection (`solana.ts`).
|
|
77
|
-
*
|
|
78
|
-
* Keyed by the same `number | "solana"` chain identifier the rest of the modal
|
|
79
|
-
* uses (see `core/constants.ts`), so a single `rpcUrls` prop covers every
|
|
80
|
-
* chain — EVM mainnets, Polygon (137, also feeds Polymarket reads), HyperEVM
|
|
81
|
-
* (999), and Solana.
|
|
82
|
-
*/
|
|
83
|
-
type ChainKey = number | "solana";
|
|
84
|
-
type RpcUrlMap = Partial<Record<ChainKey, string>>;
|
|
85
|
-
|
|
86
|
-
type Caip2ChainId = `eip155:${number}` | `solana:${string}`;
|
|
87
|
-
type ChainId = number | "solana" | "hypercore" | Caip2ChainId;
|
|
88
|
-
interface DepositModalTheme {
|
|
89
|
-
/**
|
|
90
|
-
* Absent means light, unconditionally — never "follow the OS". `"system"` is
|
|
91
|
-
* opt-in because an app that is single-appearance by design would otherwise
|
|
92
|
-
* get a dark funding sheet inside a light app the moment the user flips
|
|
93
|
-
* their phone.
|
|
94
|
-
*/
|
|
95
|
-
mode?: "light" | "dark" | "system";
|
|
96
|
-
radius?: "none" | "sm" | "md" | "lg" | "full";
|
|
97
|
-
fontColor?: string;
|
|
98
|
-
iconColor?: string;
|
|
99
|
-
ctaColor?: string;
|
|
100
|
-
ctaHoverColor?: string;
|
|
101
|
-
borderColor?: string;
|
|
102
|
-
backgroundColor?: string;
|
|
103
|
-
}
|
|
104
|
-
interface DepositModalUIConfig {
|
|
105
|
-
showBackButton?: boolean;
|
|
106
|
-
maxDepositUsd?: number;
|
|
107
|
-
minDepositUsd?: number;
|
|
108
|
-
/**
|
|
109
|
-
* When true the network/protocol fee is sponsored — the Review / Processing /
|
|
110
|
-
* Success / Failure screens render the fee line-through and surface a
|
|
111
|
-
* tooltip on the info icon explaining the sponsorship.
|
|
112
|
-
*/
|
|
113
|
-
feeSponsored?: boolean;
|
|
114
|
-
/**
|
|
115
|
-
* Custom tooltip copy for the fee info icon. Defaults to a generic
|
|
116
|
-
* "Fees are sponsored" / "Fees apply" message based on `feeSponsored`.
|
|
117
|
-
*/
|
|
118
|
-
feeTooltip?: string;
|
|
119
|
-
}
|
|
120
|
-
interface ConnectedEventData {
|
|
121
|
-
address: Address;
|
|
122
|
-
smartAccount: Address;
|
|
123
|
-
}
|
|
124
|
-
interface DepositSubmittedEventData {
|
|
125
|
-
txHash: string;
|
|
126
|
-
sourceChain: ChainId | "unknown";
|
|
127
|
-
amount: string;
|
|
128
|
-
}
|
|
129
|
-
interface DepositCompleteEventData {
|
|
130
|
-
txHash: string;
|
|
131
|
-
destinationTxHash?: string;
|
|
132
|
-
amount: string;
|
|
133
|
-
sourceChain: ChainId | "unknown";
|
|
134
|
-
sourceToken?: string;
|
|
135
|
-
targetChain: TargetChain;
|
|
136
|
-
targetToken: string;
|
|
137
|
-
}
|
|
138
|
-
interface DepositFailedEventData {
|
|
139
|
-
txHash: string;
|
|
140
|
-
error?: string;
|
|
141
|
-
}
|
|
142
|
-
interface WithdrawSubmittedEventData {
|
|
143
|
-
txHash: Hex;
|
|
144
|
-
sourceChain: number;
|
|
145
|
-
amount: string;
|
|
146
|
-
accountAddress: Address;
|
|
147
|
-
}
|
|
148
|
-
interface WithdrawCompleteEventData {
|
|
149
|
-
txHash: Hex;
|
|
150
|
-
destinationTxHash?: Hex;
|
|
151
|
-
amount: string;
|
|
152
|
-
sourceChain: number;
|
|
153
|
-
sourceToken: Address;
|
|
154
|
-
targetChain: number;
|
|
155
|
-
targetToken: Address;
|
|
156
|
-
}
|
|
157
|
-
interface WithdrawFailedEventData {
|
|
158
|
-
txHash: Hex;
|
|
159
|
-
error?: string;
|
|
160
|
-
}
|
|
161
|
-
interface ErrorEventData {
|
|
162
|
-
message: string;
|
|
163
|
-
code?: string;
|
|
164
|
-
/**
|
|
165
|
-
* The underlying wallet/RPC error, verbatim. `message` is written for the
|
|
166
|
-
* end user and drops the detail a bug report needs — log this instead. Never
|
|
167
|
-
* render it: it is unsanitized and can carry RPC URLs.
|
|
168
|
-
*/
|
|
169
|
-
cause?: string;
|
|
170
|
-
}
|
|
171
|
-
interface OutputTokenRule {
|
|
172
|
-
match: {
|
|
173
|
-
chain?: string;
|
|
174
|
-
token?: string;
|
|
175
|
-
symbol?: string;
|
|
176
|
-
};
|
|
177
|
-
outputToken: string;
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Which Swapped payment groups the fiat on-ramp offers. Keys are Swapped
|
|
181
|
-
* `payment_group` values; omit the object to offer all of them.
|
|
182
|
-
*
|
|
183
|
-
* Deliberately booleans rather than a list of row descriptors: the label,
|
|
184
|
-
* sublabel and icon belong to the modal, so subsetting cannot drift from — or
|
|
185
|
-
* freeze a stale copy of — Swapped's own limits and naming.
|
|
186
|
-
*/
|
|
187
|
-
interface FiatMethodsConfig {
|
|
188
|
-
creditcard?: boolean;
|
|
189
|
-
"bank-transfer"?: boolean;
|
|
190
|
-
"apple-pay"?: boolean;
|
|
191
|
-
}
|
|
192
|
-
interface DepositModalProps {
|
|
193
|
-
/**
|
|
194
|
-
* A wallet the host app already has connected. Pass this to reuse the user's
|
|
195
|
-
* existing session — the modal reads the address off `.account`, so it cannot
|
|
196
|
-
* disagree with what your app thinks the user is. Also what lets the modal
|
|
197
|
-
* skip its own connect step when the wallet is the only funding feature.
|
|
198
|
-
*
|
|
199
|
-
* Omit it and pass `reownAppId` instead to have the modal connect a wallet
|
|
200
|
-
* itself.
|
|
201
|
-
*/
|
|
202
|
-
walletClient?: WalletClient | null;
|
|
203
|
-
/** Read client paired with `walletClient`. Defaults to the modal's own. */
|
|
204
|
-
publicClient?: PublicClient | null;
|
|
205
|
-
targetChain: Chain | TargetChain;
|
|
206
|
-
targetToken: Address | string;
|
|
207
|
-
isOpen: boolean;
|
|
208
|
-
onClose: () => void;
|
|
209
|
-
inline?: boolean;
|
|
210
|
-
closeOnOverlayClick?: boolean;
|
|
211
|
-
sourceChain?: Chain | number;
|
|
212
|
-
sourceToken?: Address;
|
|
213
|
-
/**
|
|
214
|
-
* Pre-fills the deposit amount. Either a USD-denominated number string
|
|
215
|
-
* (e.g. "25") or the case-insensitive sentinel `"max"`, which fills the
|
|
216
|
-
* full available balance once it loads (same as the Max preset).
|
|
217
|
-
*/
|
|
218
|
-
defaultAmount?: string;
|
|
219
|
-
recipient: Address | string;
|
|
220
|
-
/**
|
|
221
|
-
* The user's current in-app balance, in USD, as the consuming app displays
|
|
222
|
-
* it. When provided, the amount screen shows a "Balance after deposit" row
|
|
223
|
-
* (`appBalanceUsd + amount`) so the user sees their post-deposit app
|
|
224
|
-
* balance. The row is hidden when this is omitted.
|
|
225
|
-
*/
|
|
226
|
-
appBalanceUsd?: number;
|
|
227
|
-
outputTokenRules?: OutputTokenRule[];
|
|
228
|
-
rejectUnmapped?: boolean;
|
|
229
|
-
backendUrl: string;
|
|
230
|
-
/**
|
|
231
|
-
* Per-chain RPC URL overrides, keyed by EVM chain id plus the literal
|
|
232
|
-
* `"solana"` key. Applied everywhere the modal reads chain state — EVM
|
|
233
|
-
* public clients, the connected wallet's transports (avoiding the
|
|
234
|
-
* rate-limited public defaults), Polygon/Polymarket reads, HyperEVM (999),
|
|
235
|
-
* and the Solana connection. Chains left unset use their default RPC.
|
|
236
|
-
*/
|
|
237
|
-
rpcUrls?: RpcUrlMap;
|
|
238
|
-
forceRegister?: boolean;
|
|
239
|
-
reownAppId?: string;
|
|
240
|
-
/**
|
|
241
|
-
* Enable importing balances from third-party dapps. Each dapp defaults to
|
|
242
|
-
* off — clients must explicitly opt in. When a dapp is enabled and the
|
|
243
|
-
* connected wallet has a balance there, a new row appears on the deposit
|
|
244
|
-
* entry screen.
|
|
245
|
-
*/
|
|
246
|
-
assetMigrations?: AssetMigrationsConfig;
|
|
247
|
-
/**
|
|
248
|
-
* Open the modal pre-routed into a dapp-import provider, skipping the
|
|
249
|
-
* deposit-method home screen. Must name an enabled `assetMigrations` key
|
|
250
|
-
* (e.g. "polymarket"); disabled/unknown values are a no-op. While the
|
|
251
|
-
* provider's balances are checked the modal shows a loading skeleton;
|
|
252
|
-
* if the flow turns out to be unreachable (no account, no balance, no
|
|
253
|
-
* wallet) it falls back to the home screen.
|
|
254
|
-
*/
|
|
255
|
-
initialAssetMigration?: keyof AssetMigrationsConfig;
|
|
256
|
-
/** Show fiat on-ramp option(s) that embed Swapped's iframe. Default: false. */
|
|
257
|
-
/**
|
|
258
|
-
* Offer the connected wallet as a funding source. Default: true. Turn off to
|
|
259
|
-
* present a wallet-free flow (QR / fiat / exchange only) even when a wallet
|
|
260
|
-
* client or `reownAppId` is supplied.
|
|
261
|
-
*/
|
|
262
|
-
enableWallet?: boolean;
|
|
263
|
-
enableFiatOnramp?: boolean;
|
|
264
|
-
/** Show the Transfer Crypto / QR row. Default: true. */
|
|
265
|
-
enableQrTransfer?: boolean;
|
|
266
|
-
/**
|
|
267
|
-
* Offer gasless ERC-20 deposits from the connected wallet: instead of an
|
|
268
|
-
* on-chain transfer, the user signs the highest-priority token authorization
|
|
269
|
-
* supported by the backend (ERC-3009, ERC-2612, then Permit2). Opt-in and
|
|
270
|
-
* purely additive — the plain transfer stays the default and the automatic
|
|
271
|
-
* fallback whenever the gasless path is unavailable (older proxy, feature
|
|
272
|
-
* disabled, missing Permit2 allowance, rejected signature). Default: false.
|
|
273
|
-
*/
|
|
274
|
-
enableGaslessDeposit?: boolean;
|
|
275
|
-
/**
|
|
276
|
-
* Restrict Cash to an exact subset of the standard payment groups. Providing
|
|
277
|
-
* the map opts this modal instance out of regional personalization; omit it
|
|
278
|
-
* to use backend-resolved methods with the built-in global fallback.
|
|
279
|
-
* An empty or all-false map disables Cash.
|
|
280
|
-
*/
|
|
281
|
-
fiatMethods?: FiatMethodsConfig;
|
|
282
|
-
/**
|
|
283
|
-
* Show a "Connect exchange" row that opens Swapped Connect — the user
|
|
284
|
-
* picks their CEX (Coinbase, Binance, Kraken…) or wallet inside the iframe
|
|
285
|
-
* and Swapped pulls the crypto on-chain to the smart account. Default: false.
|
|
286
|
-
*/
|
|
287
|
-
enableExchangeConnect?: boolean;
|
|
288
|
-
onRequestConnect?: () => void;
|
|
289
|
-
theme?: DepositModalTheme;
|
|
290
|
-
uiConfig?: DepositModalUIConfig;
|
|
291
|
-
className?: string;
|
|
292
|
-
onReady?: () => void;
|
|
293
|
-
/** Discriminated stream of deposit lifecycle transitions. */
|
|
294
|
-
onLifecycle?: (event: DepositLifecycleEvent) => void;
|
|
295
|
-
onEvent?: (event: DepositAnalyticsEvent) => void;
|
|
296
|
-
onError?: (data: ErrorEventData) => void;
|
|
297
|
-
debug?: boolean;
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* One transfer the host app must execute to fund a withdrawal.
|
|
301
|
-
*
|
|
302
|
-
* `to` is authoritative: it is the Rhinestone deposit account the processor
|
|
303
|
-
* watches, except on a same-route withdrawal (source chain+token identical to
|
|
304
|
-
* the target) where the modal skips the bridge and `to` is the end recipient.
|
|
305
|
-
* Either way the app's job is identical — move `amount` of `token` to `to` on
|
|
306
|
-
* `chainId` — so it must never substitute an address of its own.
|
|
307
|
-
*/
|
|
308
|
-
interface WithdrawTransferRequest {
|
|
309
|
-
/** Source chain to send from. */
|
|
310
|
-
chainId: number;
|
|
311
|
-
/** Source token; `NATIVE_TOKEN_ADDRESS` for the chain's native asset. */
|
|
312
|
-
token: Address;
|
|
313
|
-
/** Amount in the token's base units. */
|
|
314
|
-
amount: bigint;
|
|
315
|
-
/** Destination for this transfer. Send here. */
|
|
316
|
-
to: Address;
|
|
317
|
-
}
|
|
318
|
-
interface WithdrawModalProps {
|
|
319
|
-
/**
|
|
320
|
-
* Account holding the funds being withdrawn. Used to read the withdrawable
|
|
321
|
-
* balance and to keep the user from sending to themselves; the modal never
|
|
322
|
-
* transacts from it — `onSendTransaction` does.
|
|
323
|
-
*/
|
|
324
|
-
accountAddress: Address;
|
|
325
|
-
sourceChain: Chain | number;
|
|
326
|
-
sourceToken: Address;
|
|
327
|
-
/**
|
|
328
|
-
* Initial destination, not a constraint. The withdraw form lets the user pick
|
|
329
|
-
* any supported chain/token/recipient, so these only seed the fields — pass
|
|
330
|
-
* them to open on a particular destination, omit them to let the user choose.
|
|
331
|
-
*/
|
|
332
|
-
targetChain?: Chain | number;
|
|
333
|
-
targetToken?: Address;
|
|
334
|
-
recipient?: Address;
|
|
335
|
-
defaultAmount?: string;
|
|
336
|
-
isOpen: boolean;
|
|
337
|
-
onClose: () => void;
|
|
338
|
-
inline?: boolean;
|
|
339
|
-
closeOnOverlayClick?: boolean;
|
|
340
|
-
backendUrl: string;
|
|
341
|
-
/**
|
|
342
|
-
* Per-chain RPC URL overrides, keyed by EVM chain id plus the literal
|
|
343
|
-
* `"solana"` key. Applied to every chain read (EVM public clients and the
|
|
344
|
-
* connected wallet's transports). Chains left unset use their default RPC.
|
|
345
|
-
*/
|
|
346
|
-
rpcUrls?: RpcUrlMap;
|
|
347
|
-
forceRegister?: boolean;
|
|
348
|
-
/**
|
|
349
|
-
* Executes the transfer that funds the withdrawal, using whatever account
|
|
350
|
-
* model the host app has (EOA, smart account, in-app wallet, relayer).
|
|
351
|
-
*
|
|
352
|
-
* Must resolve with the **on-chain transaction hash** — not a userOp hash or
|
|
353
|
-
* bundler id. Progress is tracked by looking the deposit up by that hash, so
|
|
354
|
-
* anything else leaves the modal waiting on a withdrawal that already
|
|
355
|
-
* succeeded. Reject to surface a failure in the modal.
|
|
356
|
-
*/
|
|
357
|
-
onSendTransaction: (request: WithdrawTransferRequest) => Promise<{
|
|
358
|
-
txHash: Hex;
|
|
359
|
-
}>;
|
|
360
|
-
theme?: DepositModalTheme;
|
|
361
|
-
uiConfig?: DepositModalUIConfig;
|
|
362
|
-
className?: string;
|
|
363
|
-
onReady?: () => void;
|
|
364
|
-
/** Discriminated stream of withdraw lifecycle transitions. */
|
|
365
|
-
onLifecycle?: (event: WithdrawLifecycleEvent) => void;
|
|
366
|
-
onEvent?: (event: WithdrawAnalyticsEvent) => void;
|
|
367
|
-
onError?: (data: ErrorEventData) => void;
|
|
368
|
-
debug?: boolean;
|
|
369
|
-
}
|
|
370
|
-
/**
|
|
371
|
-
* Self-service recovery modal. Returns a failed or rejected deposit's
|
|
372
|
-
* source-chain funds to an address the user names. The deposit is looked up by
|
|
373
|
-
* transaction hash.
|
|
374
|
-
*
|
|
375
|
-
* The user's own wallet authorizes it: the deposit's `recipient` — the in-app
|
|
376
|
-
* wallet the funds were headed to — signs an EIP-712 struct naming the deposit and
|
|
377
|
-
* the destination, and the processor verifies that signature against the same
|
|
378
|
-
* `recipient` before moving anything. Your app needs no backend and no shared
|
|
379
|
-
* secret; the request goes from the browser through your `deposit-widget-proxy`,
|
|
380
|
-
* which adds only the project API key.
|
|
381
|
-
*
|
|
382
|
-
* Note the signer is the recipient, not the deposit account — deposit accounts are
|
|
383
|
-
* service-owned and cannot sign for themselves.
|
|
384
|
-
*/
|
|
385
|
-
interface ClaimModalProps {
|
|
386
|
-
/**
|
|
387
|
-
* Signs the recovery authorization. Called with the exact typed data to sign and
|
|
388
|
-
* the `signer` address whose signature the processor will verify — the deposit's
|
|
389
|
-
* `recipient`.
|
|
390
|
-
*
|
|
391
|
-
* Return whatever that address's own verifier accepts:
|
|
392
|
-
* - **embedded EOA** (Privy, Turnkey, Dynamic) — `signTypedData`, raw 65-byte
|
|
393
|
-
* result.
|
|
394
|
-
* - **deployed smart account** — a signature valid under its ERC-1271
|
|
395
|
-
* `isValidSignature`. A raw owner signature is usually not enough; a Safe, for
|
|
396
|
-
* one, expects its own message wrapping, so go through your account SDK.
|
|
397
|
-
* - **undeployed smart account** — wrap per ERC-6492 so it can be verified
|
|
398
|
-
* counterfactually. `SignatureErc6492.wrap` from `ox/erc6492` does this and
|
|
399
|
-
* ships with viem already.
|
|
400
|
-
*
|
|
401
|
-
* Throwing (or returning nothing) is treated as the user declining, which is
|
|
402
|
-
* retryable.
|
|
403
|
-
*
|
|
404
|
-
* If your users can't sign — a lost embedded wallet, or a recipient your app
|
|
405
|
-
* controls rather than the user — use `createRefundHandler` from
|
|
406
|
-
* `@rhinestone/deposit-modal/server` against your own backend instead, and drive
|
|
407
|
-
* your own UI. That path authorizes on your say-so rather than a signature.
|
|
408
|
-
*/
|
|
409
|
-
signRecovery: SignRecovery;
|
|
410
|
-
isOpen: boolean;
|
|
411
|
-
onClose: () => void;
|
|
412
|
-
inline?: boolean;
|
|
413
|
-
closeOnOverlayClick?: boolean;
|
|
414
|
-
backendUrl: string;
|
|
415
|
-
rpcUrls?: RpcUrlMap;
|
|
416
|
-
/** Optional prefills for the lookup form and destination. */
|
|
417
|
-
defaultTxHash?: string;
|
|
418
|
-
/**
|
|
419
|
-
* Prefills the refund destination. Left empty otherwise — the modal
|
|
420
|
-
* deliberately does NOT default to the deposit's sender, because returning
|
|
421
|
-
* funds to an exchange's hot wallet can lose them.
|
|
422
|
-
*
|
|
423
|
-
* Matches `refundDestination` on `RefundAuthorization` in `./server`, which
|
|
424
|
-
* is the authoritative version: this one only seeds the field and the user can
|
|
425
|
-
* edit it. Not related to the deposit's `recipient`.
|
|
426
|
-
*/
|
|
427
|
-
defaultRefundDestination?: Address;
|
|
428
|
-
theme?: DepositModalTheme;
|
|
429
|
-
uiConfig?: DepositModalUIConfig;
|
|
430
|
-
className?: string;
|
|
431
|
-
onReady?: () => void;
|
|
432
|
-
onLifecycle?: (event: ClaimLifecycleEvent) => void;
|
|
433
|
-
onEvent?: (event: ClaimAnalyticsEvent) => void;
|
|
434
|
-
onError?: (data: ErrorEventData) => void;
|
|
435
|
-
debug?: boolean;
|
|
436
|
-
}
|
|
437
|
-
interface AssetOption {
|
|
438
|
-
id: string;
|
|
439
|
-
chainId: number;
|
|
440
|
-
token: Address;
|
|
441
|
-
symbol: string;
|
|
442
|
-
name: string;
|
|
443
|
-
decimals: number;
|
|
444
|
-
balance?: string;
|
|
445
|
-
balanceUsd?: number;
|
|
446
|
-
}
|
|
447
|
-
/**
|
|
448
|
-
* Discriminated union covering every deposit flow state transition the
|
|
449
|
-
* consumer can observe. Consumers handle additions in a single switch; the
|
|
450
|
-
* modal can add new event variants without changing the prop surface.
|
|
451
|
-
*/
|
|
452
|
-
type DepositLifecycleEvent = {
|
|
453
|
-
type: "connected";
|
|
454
|
-
address: Address;
|
|
455
|
-
smartAccount: Address;
|
|
456
|
-
} | {
|
|
457
|
-
type: "submitted";
|
|
458
|
-
/** Real source-chain transaction hash; not emitted for permit deposits before settlement. */
|
|
459
|
-
txHash: string;
|
|
460
|
-
sourceChain: ChainId | "unknown";
|
|
461
|
-
/** Source-token base units (e.g. "1100000" for 1.10 USDC). */
|
|
462
|
-
amount: string;
|
|
463
|
-
/**
|
|
464
|
-
* Decimals of the source token, for converting `amount` to a
|
|
465
|
-
* human-readable value. Omitted when the token is not recognised
|
|
466
|
-
* (e.g. a QR deposit of an unlisted token).
|
|
467
|
-
*/
|
|
468
|
-
sourceDecimals?: number;
|
|
469
|
-
/**
|
|
470
|
-
* USD equivalent of the deposit as entered in the modal (token units
|
|
471
|
-
* for unpriced non-stablecoins). Omitted for flows without an amount
|
|
472
|
-
* input (QR transfer, fiat onramp, exchange connect).
|
|
473
|
-
*/
|
|
474
|
-
amountUsd?: string;
|
|
475
|
-
} | {
|
|
476
|
-
type: "complete";
|
|
477
|
-
txHash: string;
|
|
478
|
-
destinationTxHash?: string;
|
|
479
|
-
/** Source-token base units (e.g. "1100000" for 1.10 USDC). */
|
|
480
|
-
amount: string;
|
|
481
|
-
sourceChain: ChainId | "unknown";
|
|
482
|
-
sourceToken?: string;
|
|
483
|
-
/**
|
|
484
|
-
* Decimals of the source token, for converting `amount` to a
|
|
485
|
-
* human-readable value. Omitted when the token is not recognised
|
|
486
|
-
* (e.g. a QR deposit of an unlisted token).
|
|
487
|
-
*/
|
|
488
|
-
sourceDecimals?: number;
|
|
489
|
-
/**
|
|
490
|
-
* USD equivalent of the deposit as entered in the modal (token units
|
|
491
|
-
* for unpriced non-stablecoins). Omitted for flows without an amount
|
|
492
|
-
* input (QR transfer, fiat onramp, exchange connect).
|
|
493
|
-
*/
|
|
494
|
-
amountUsd?: string;
|
|
495
|
-
targetChain: TargetChain;
|
|
496
|
-
targetToken: string;
|
|
497
|
-
} | {
|
|
498
|
-
type: "failed";
|
|
499
|
-
txHash: string;
|
|
500
|
-
error?: string;
|
|
501
|
-
} | {
|
|
502
|
-
type: "balance-changed";
|
|
503
|
-
totalUsd: number;
|
|
504
|
-
} | {
|
|
505
|
-
type: "smart-account-changed";
|
|
506
|
-
evm: Address | null;
|
|
507
|
-
solana: string | null;
|
|
508
|
-
};
|
|
509
|
-
type WithdrawLifecycleEvent =
|
|
510
|
-
/** The deposit account for the chosen target is registered and fundable. */
|
|
511
|
-
{
|
|
512
|
-
type: "connected";
|
|
513
|
-
address: Address;
|
|
514
|
-
smartAccount: Address;
|
|
515
|
-
} | {
|
|
516
|
-
type: "submitted";
|
|
517
|
-
txHash: Hex;
|
|
518
|
-
sourceChain: number;
|
|
519
|
-
amount: string;
|
|
520
|
-
accountAddress: Address;
|
|
521
|
-
} | {
|
|
522
|
-
type: "complete";
|
|
523
|
-
txHash: Hex;
|
|
524
|
-
destinationTxHash?: Hex;
|
|
525
|
-
amount: string;
|
|
526
|
-
sourceChain: number;
|
|
527
|
-
sourceToken: Address;
|
|
528
|
-
targetChain: number;
|
|
529
|
-
targetToken: Address;
|
|
530
|
-
} | {
|
|
531
|
-
type: "failed";
|
|
532
|
-
txHash: Hex;
|
|
533
|
-
error?: string;
|
|
534
|
-
};
|
|
535
|
-
type ClaimLifecycleEvent = {
|
|
536
|
-
type: "lookup";
|
|
537
|
-
txHash: string;
|
|
538
|
-
matches: number;
|
|
539
|
-
} | {
|
|
540
|
-
type: "refund_requested";
|
|
541
|
-
account: Address;
|
|
542
|
-
/** Where the funds were asked to go, on the source chain. */
|
|
543
|
-
destination: Address;
|
|
544
|
-
chain: number;
|
|
545
|
-
} | {
|
|
546
|
-
type: "complete";
|
|
547
|
-
txHash: string;
|
|
548
|
-
account: Address;
|
|
549
|
-
destination: Address;
|
|
550
|
-
chain: number;
|
|
551
|
-
token: string;
|
|
552
|
-
amount: string;
|
|
553
|
-
} | {
|
|
554
|
-
type: "failed";
|
|
555
|
-
/** HTTP status from the refund endpoint; 0 if it was unreachable. */
|
|
556
|
-
status?: number;
|
|
557
|
-
error?: string;
|
|
558
|
-
};
|
|
559
|
-
/**
|
|
560
|
-
* Telemetry events fired when screens open or CTAs are clicked.
|
|
561
|
-
* Distinct from {@link DepositLifecycleEvent}, which tracks transaction state.
|
|
562
|
-
*/
|
|
563
|
-
type DepositAnalyticsEvent = {
|
|
564
|
-
type: "deposit_modal_fiat_methods_rendered";
|
|
565
|
-
country: string | null;
|
|
566
|
-
payment_methods: string[];
|
|
567
|
-
source: "personalized" | "fallback" | "configured";
|
|
568
|
-
} | {
|
|
569
|
-
type: "deposit_modal_fiat_method_click";
|
|
570
|
-
country: string | null;
|
|
571
|
-
payment_method: string;
|
|
572
|
-
source: "personalized" | "fallback" | "configured";
|
|
573
|
-
} | {
|
|
574
|
-
type: "deposit_modal_connected_wallet_select_source_open";
|
|
575
|
-
total_balance_in_external_wallet: number | null;
|
|
576
|
-
pred_balance: number | null;
|
|
577
|
-
} | {
|
|
578
|
-
type: "deposit_modal_connected_wallet_select_source_cta_click";
|
|
579
|
-
total_balance_in_external_wallet: number | null;
|
|
580
|
-
pred_balance: number | null;
|
|
581
|
-
cta_name: "token_selected";
|
|
582
|
-
token_name: string;
|
|
583
|
-
token_balance: string;
|
|
584
|
-
} | {
|
|
585
|
-
type: "deposit_modal_transfer_crypto_open";
|
|
586
|
-
default_chain: string;
|
|
587
|
-
default_token: string;
|
|
588
|
-
pred_balance: number | null;
|
|
589
|
-
} | {
|
|
590
|
-
type: "deposit_modal_transfer_crypto_cta_click";
|
|
591
|
-
default_chain: string;
|
|
592
|
-
default_token: string;
|
|
593
|
-
pred_balance: number | null;
|
|
594
|
-
cta_name: "copy";
|
|
595
|
-
} | {
|
|
596
|
-
type: "deposit_modal_connected_wallet_enter_value_open";
|
|
597
|
-
send_token: string;
|
|
598
|
-
receive_token: string;
|
|
599
|
-
pred_balance: number | null;
|
|
600
|
-
} | {
|
|
601
|
-
type: "deposit_modal_connected_wallet_enter_value_cta_click";
|
|
602
|
-
send_token: string;
|
|
603
|
-
receive_token: string;
|
|
604
|
-
pred_balance: number | null;
|
|
605
|
-
cta_name: "continue" | "25%" | "50%" | "75%" | "Max";
|
|
606
|
-
};
|
|
607
|
-
type WithdrawAnalyticsEvent = {
|
|
608
|
-
type: "withdraw_modal_select_amount_open";
|
|
609
|
-
pred_balance: number | null;
|
|
610
|
-
default_token: string;
|
|
611
|
-
default_chain: string;
|
|
612
|
-
} | {
|
|
613
|
-
type: "withdraw_modal_select_amount_cta_click";
|
|
614
|
-
pred_balance: number | null;
|
|
615
|
-
selected_token: string;
|
|
616
|
-
selected_chain: string;
|
|
617
|
-
amount: string;
|
|
618
|
-
cta_name: "withdraw";
|
|
619
|
-
};
|
|
620
|
-
type ClaimAnalyticsEvent = {
|
|
621
|
-
type: "claim_modal_open";
|
|
622
|
-
} | {
|
|
623
|
-
type: "claim_modal_lookup";
|
|
624
|
-
matches: number;
|
|
625
|
-
} | {
|
|
626
|
-
type: "claim_modal_refund_click";
|
|
627
|
-
chain: string;
|
|
628
|
-
} | {
|
|
629
|
-
type: "claim_modal_complete";
|
|
630
|
-
chain: string;
|
|
631
|
-
} | {
|
|
632
|
-
type: "claim_modal_failed";
|
|
633
|
-
chain: string;
|
|
634
|
-
status?: number;
|
|
635
|
-
};
|
|
636
|
-
type ModalAnalyticsEvent = DepositAnalyticsEvent | WithdrawAnalyticsEvent | ClaimAnalyticsEvent;
|
|
637
|
-
|
|
638
|
-
export type { AssetMigrationsConfig as A, ChainId as C, DepositAnalyticsEvent as D, ErrorEventData as E, FiatMethodsConfig as F, ModalAnalyticsEvent as M, OutputTokenRule as O, RpcUrlMap as R, SignRecovery as S, WithdrawAnalyticsEvent as W, AssetOption as a, ClaimAnalyticsEvent as b, ClaimLifecycleEvent as c, ClaimModalProps as d, ConnectedEventData as e, DepositCompleteEventData as f, DepositFailedEventData as g, DepositLifecycleEvent as h, DepositModalProps as i, DepositModalTheme as j, DepositModalUIConfig as k, DepositSubmittedEventData as l, WithdrawCompleteEventData as m, WithdrawFailedEventData as n, WithdrawLifecycleEvent as o, WithdrawModalProps as p, WithdrawSubmittedEventData as q, WithdrawTransferRequest as r, RecoveryErrorCode as s, SignRecoveryPayload as t };
|