@rhinestone/deposit-modal 0.2.5-alpha.0 → 0.3.0-alpha.0
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 +40 -211
- package/dist/{DepositModalReown-GIODYNOK.mjs → DepositModalReown-GXY65HZP.mjs} +3 -5
- package/dist/{DepositModalReown-SVVA3OZ6.cjs → DepositModalReown-HVIEA6YA.cjs} +4 -6
- package/dist/QRCode-SMMYPUQC.cjs +58 -0
- package/dist/QRCode-YMQTKSSK.mjs +58 -0
- package/dist/{WithdrawModalReown-VNTKGALT.cjs → WithdrawModalReown-4M3PBY2T.cjs} +4 -5
- package/dist/{WithdrawModalReown-HTEB4XGU.mjs → WithdrawModalReown-O6V6KRH6.mjs} +3 -4
- package/dist/{chunk-AHQY2O3U.cjs → chunk-7SYZG47X.cjs} +1731 -2161
- package/dist/{chunk-WHW3ZMOT.mjs → chunk-EEHUOFIW.mjs} +107 -90
- package/dist/{chunk-WA4RA4HB.mjs → chunk-FKPTIHU7.mjs} +916 -424
- package/dist/{chunk-RQ2VCKLS.mjs → chunk-U5QIFNG4.mjs} +1815 -2245
- package/dist/{chunk-DUGDAMAF.mjs → chunk-UIHAYD7J.mjs} +1089 -796
- package/dist/{chunk-R2HP743T.cjs → chunk-XCAF6B3D.cjs} +51 -34
- package/dist/{chunk-KE6CJVOV.cjs → chunk-Y3RA3YGA.cjs} +1110 -817
- package/dist/{chunk-4S262VLP.cjs → chunk-Z2SIC2TH.cjs} +965 -473
- package/dist/constants.cjs +2 -2
- package/dist/constants.d.cts +3 -2
- package/dist/constants.d.ts +3 -2
- package/dist/constants.mjs +1 -1
- package/dist/deposit.cjs +4 -6
- package/dist/deposit.d.cts +2 -3
- package/dist/deposit.d.ts +2 -3
- package/dist/deposit.mjs +3 -5
- package/dist/index.cjs +5 -7
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.mjs +4 -6
- package/dist/styles.css +1068 -752
- package/dist/{types-D0NawmZ8.d.cts → types-DRou84ZM.d.cts} +147 -40
- package/dist/{types-CeFbJ-MW.d.ts → types-DRou84ZM.d.ts} +147 -40
- package/dist/withdraw.cjs +4 -5
- package/dist/withdraw.d.cts +2 -3
- package/dist/withdraw.d.ts +2 -3
- package/dist/withdraw.mjs +3 -4
- package/package.json +13 -12
- package/dist/chunk-J2SWZSXL.mjs +0 -295
- package/dist/chunk-LHOHM67Z.mjs +0 -234
- package/dist/chunk-YKGL66EF.cjs +0 -295
- package/dist/chunk-ZHLQMSQM.cjs +0 -234
- package/dist/reown.cjs +0 -18
- package/dist/reown.d.cts +0 -10
- package/dist/reown.d.ts +0 -10
- package/dist/reown.mjs +0 -18
- package/dist/safe-CB7TvRCc.d.cts +0 -62
- package/dist/safe-CB7TvRCc.d.ts +0 -62
- package/dist/safe.cjs +0 -22
- package/dist/safe.d.cts +0 -14
- package/dist/safe.d.ts +0 -14
- package/dist/safe.mjs +0 -22
|
@@ -1,5 +1,63 @@
|
|
|
1
|
-
import { Address, WalletClient, PublicClient, Chain
|
|
2
|
-
|
|
1
|
+
import { Address, Hex, WalletClient, PublicClient, Chain } from 'viem';
|
|
2
|
+
|
|
3
|
+
interface SafeTransactionRequest {
|
|
4
|
+
chainId: number;
|
|
5
|
+
safeAddress: Address;
|
|
6
|
+
safeTxHash: Hex;
|
|
7
|
+
typedData: {
|
|
8
|
+
domain: {
|
|
9
|
+
chainId: number;
|
|
10
|
+
verifyingContract: Address;
|
|
11
|
+
};
|
|
12
|
+
types: typeof SAFE_TX_TYPES;
|
|
13
|
+
primaryType: "SafeTx";
|
|
14
|
+
message: {
|
|
15
|
+
to: Address;
|
|
16
|
+
value: bigint;
|
|
17
|
+
data: Hex;
|
|
18
|
+
operation: number;
|
|
19
|
+
safeTxGas: bigint;
|
|
20
|
+
baseGas: bigint;
|
|
21
|
+
gasPrice: bigint;
|
|
22
|
+
gasToken: Address;
|
|
23
|
+
refundReceiver: Address;
|
|
24
|
+
nonce: bigint;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
declare const SAFE_TX_TYPES: {
|
|
29
|
+
readonly SafeTx: readonly [{
|
|
30
|
+
readonly name: "to";
|
|
31
|
+
readonly type: "address";
|
|
32
|
+
}, {
|
|
33
|
+
readonly name: "value";
|
|
34
|
+
readonly type: "uint256";
|
|
35
|
+
}, {
|
|
36
|
+
readonly name: "data";
|
|
37
|
+
readonly type: "bytes";
|
|
38
|
+
}, {
|
|
39
|
+
readonly name: "operation";
|
|
40
|
+
readonly type: "uint8";
|
|
41
|
+
}, {
|
|
42
|
+
readonly name: "safeTxGas";
|
|
43
|
+
readonly type: "uint256";
|
|
44
|
+
}, {
|
|
45
|
+
readonly name: "baseGas";
|
|
46
|
+
readonly type: "uint256";
|
|
47
|
+
}, {
|
|
48
|
+
readonly name: "gasPrice";
|
|
49
|
+
readonly type: "uint256";
|
|
50
|
+
}, {
|
|
51
|
+
readonly name: "gasToken";
|
|
52
|
+
readonly type: "address";
|
|
53
|
+
}, {
|
|
54
|
+
readonly name: "refundReceiver";
|
|
55
|
+
readonly type: "address";
|
|
56
|
+
}, {
|
|
57
|
+
readonly name: "nonce";
|
|
58
|
+
readonly type: "uint256";
|
|
59
|
+
}];
|
|
60
|
+
};
|
|
3
61
|
|
|
4
62
|
type Caip2ChainId = `eip155:${number}` | `solana:${string}`;
|
|
5
63
|
type ChainId = number | "solana" | Caip2ChainId;
|
|
@@ -14,20 +72,21 @@ interface DepositModalTheme {
|
|
|
14
72
|
backgroundColor?: string;
|
|
15
73
|
}
|
|
16
74
|
interface DepositModalUIConfig {
|
|
17
|
-
showLogo?: boolean;
|
|
18
|
-
showStepper?: boolean;
|
|
19
75
|
showBackButton?: boolean;
|
|
20
76
|
showHistoryButton?: boolean;
|
|
21
|
-
balance?: {
|
|
22
|
-
title: string;
|
|
23
|
-
amount?: string;
|
|
24
|
-
};
|
|
25
77
|
maxDepositUsd?: number;
|
|
26
78
|
minDepositUsd?: number;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
79
|
+
/**
|
|
80
|
+
* When true the network/protocol fee is sponsored — the Review / Processing /
|
|
81
|
+
* Success / Failure screens render the fee line-through and surface a
|
|
82
|
+
* tooltip on the info icon explaining the sponsorship.
|
|
83
|
+
*/
|
|
84
|
+
feeSponsored?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Custom tooltip copy for the fee info icon. Defaults to a generic
|
|
87
|
+
* "Fees are sponsored" / "Fees apply" message based on `feeSponsored`.
|
|
88
|
+
*/
|
|
89
|
+
feeTooltip?: string;
|
|
31
90
|
}
|
|
32
91
|
interface ConnectedEventData {
|
|
33
92
|
address: Address;
|
|
@@ -35,15 +94,15 @@ interface ConnectedEventData {
|
|
|
35
94
|
}
|
|
36
95
|
interface DepositSubmittedEventData {
|
|
37
96
|
txHash: string;
|
|
38
|
-
sourceChain: ChainId;
|
|
97
|
+
sourceChain: ChainId | "unknown";
|
|
39
98
|
amount: string;
|
|
40
99
|
}
|
|
41
100
|
interface DepositCompleteEventData {
|
|
42
101
|
txHash: string;
|
|
43
102
|
destinationTxHash?: string;
|
|
44
103
|
amount: string;
|
|
45
|
-
sourceChain: ChainId;
|
|
46
|
-
sourceToken
|
|
104
|
+
sourceChain: ChainId | "unknown";
|
|
105
|
+
sourceToken?: string;
|
|
47
106
|
targetChain: number;
|
|
48
107
|
targetToken: string;
|
|
49
108
|
}
|
|
@@ -112,20 +171,15 @@ interface DepositModalProps {
|
|
|
112
171
|
waitForFinalTx?: boolean;
|
|
113
172
|
reownAppId?: string;
|
|
114
173
|
enableSolana?: boolean;
|
|
115
|
-
enablePolymarketMigration?: boolean;
|
|
116
174
|
onRequestConnect?: () => void;
|
|
117
|
-
connectButtonLabel?: string;
|
|
118
175
|
theme?: DepositModalTheme;
|
|
119
|
-
branding?: DepositModalBranding;
|
|
120
176
|
uiConfig?: DepositModalUIConfig;
|
|
121
177
|
allowedRoutes?: RouteConfig;
|
|
122
178
|
className?: string;
|
|
123
179
|
onReady?: () => void;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
onDepositFailed?: (data: DepositFailedEventData) => void;
|
|
128
|
-
onEvent?: (event: DepositEvent) => void;
|
|
180
|
+
/** Discriminated stream of deposit lifecycle transitions. */
|
|
181
|
+
onLifecycle?: (event: DepositLifecycleEvent) => void;
|
|
182
|
+
onEvent?: (event: DepositAnalyticsEvent) => void;
|
|
129
183
|
onError?: (data: ErrorEventData) => void;
|
|
130
184
|
debug?: boolean;
|
|
131
185
|
}
|
|
@@ -156,17 +210,13 @@ interface WithdrawModalProps {
|
|
|
156
210
|
signature: Hex;
|
|
157
211
|
}>;
|
|
158
212
|
onRequestConnect?: () => void;
|
|
159
|
-
connectButtonLabel?: string;
|
|
160
213
|
theme?: DepositModalTheme;
|
|
161
|
-
branding?: DepositModalBranding;
|
|
162
214
|
uiConfig?: DepositModalUIConfig;
|
|
163
215
|
className?: string;
|
|
164
216
|
onReady?: () => void;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
onWithdrawFailed?: (data: WithdrawFailedEventData) => void;
|
|
169
|
-
onEvent?: (event: WithdrawEvent) => void;
|
|
217
|
+
/** Discriminated stream of withdraw lifecycle transitions. */
|
|
218
|
+
onLifecycle?: (event: WithdrawLifecycleEvent) => void;
|
|
219
|
+
onEvent?: (event: WithdrawAnalyticsEvent) => void;
|
|
170
220
|
onError?: (data: ErrorEventData) => void;
|
|
171
221
|
debug?: boolean;
|
|
172
222
|
}
|
|
@@ -179,12 +229,6 @@ interface AssetOption {
|
|
|
179
229
|
decimals: number;
|
|
180
230
|
balance?: string;
|
|
181
231
|
balanceUsd?: number;
|
|
182
|
-
source?: "wallet" | "polymarket";
|
|
183
|
-
sourceLabel?: string;
|
|
184
|
-
balanceAddress?: Address;
|
|
185
|
-
depositToken?: Address;
|
|
186
|
-
reviewLabel?: string;
|
|
187
|
-
reviewHelperText?: string;
|
|
188
232
|
}
|
|
189
233
|
interface OrderBookSwapAction {
|
|
190
234
|
type: "orderbook-swap";
|
|
@@ -192,7 +236,70 @@ interface OrderBookSwapAction {
|
|
|
192
236
|
outputToken: Address;
|
|
193
237
|
}
|
|
194
238
|
type PostBridgeAction = OrderBookSwapAction;
|
|
195
|
-
|
|
239
|
+
/**
|
|
240
|
+
* Discriminated union covering every deposit flow state transition the
|
|
241
|
+
* consumer can observe. Consumers handle additions in a single switch; the
|
|
242
|
+
* modal can add new event variants without changing the prop surface.
|
|
243
|
+
*/
|
|
244
|
+
type DepositLifecycleEvent = {
|
|
245
|
+
type: "connected";
|
|
246
|
+
address: Address;
|
|
247
|
+
smartAccount: Address;
|
|
248
|
+
} | {
|
|
249
|
+
type: "submitted";
|
|
250
|
+
txHash: string;
|
|
251
|
+
sourceChain: ChainId | "unknown";
|
|
252
|
+
amount: string;
|
|
253
|
+
} | {
|
|
254
|
+
type: "complete";
|
|
255
|
+
txHash: string;
|
|
256
|
+
destinationTxHash?: string;
|
|
257
|
+
amount: string;
|
|
258
|
+
sourceChain: ChainId | "unknown";
|
|
259
|
+
sourceToken?: string;
|
|
260
|
+
targetChain: number;
|
|
261
|
+
targetToken: string;
|
|
262
|
+
} | {
|
|
263
|
+
type: "failed";
|
|
264
|
+
txHash: string;
|
|
265
|
+
error?: string;
|
|
266
|
+
} | {
|
|
267
|
+
type: "balance-changed";
|
|
268
|
+
totalUsd: number;
|
|
269
|
+
} | {
|
|
270
|
+
type: "smart-account-changed";
|
|
271
|
+
evm: Address | null;
|
|
272
|
+
solana: string | null;
|
|
273
|
+
};
|
|
274
|
+
type WithdrawLifecycleEvent = {
|
|
275
|
+
type: "connected";
|
|
276
|
+
address: Address;
|
|
277
|
+
smartAccount: Address;
|
|
278
|
+
} | {
|
|
279
|
+
type: "submitted";
|
|
280
|
+
txHash: Hex;
|
|
281
|
+
sourceChain: number;
|
|
282
|
+
amount: string;
|
|
283
|
+
safeAddress: Address;
|
|
284
|
+
} | {
|
|
285
|
+
type: "complete";
|
|
286
|
+
txHash: Hex;
|
|
287
|
+
destinationTxHash?: Hex;
|
|
288
|
+
amount: string;
|
|
289
|
+
sourceChain: number;
|
|
290
|
+
sourceToken: Address;
|
|
291
|
+
targetChain: number;
|
|
292
|
+
targetToken: Address;
|
|
293
|
+
} | {
|
|
294
|
+
type: "failed";
|
|
295
|
+
txHash: Hex;
|
|
296
|
+
error?: string;
|
|
297
|
+
};
|
|
298
|
+
/**
|
|
299
|
+
* Telemetry events fired when screens open or CTAs are clicked.
|
|
300
|
+
* Distinct from {@link DepositLifecycleEvent}, which tracks transaction state.
|
|
301
|
+
*/
|
|
302
|
+
type DepositAnalyticsEvent = {
|
|
196
303
|
type: "deposit_modal_connected_wallet_select_source_open";
|
|
197
304
|
total_balance_in_external_wallet: number | null;
|
|
198
305
|
pred_balance: number | null;
|
|
@@ -226,7 +333,7 @@ type DepositEvent = {
|
|
|
226
333
|
pred_balance: number | null;
|
|
227
334
|
cta_name: "continue" | "25%" | "50%" | "75%" | "Max";
|
|
228
335
|
};
|
|
229
|
-
type
|
|
336
|
+
type WithdrawAnalyticsEvent = {
|
|
230
337
|
type: "withdraw_modal_select_amount_open";
|
|
231
338
|
pred_balance: number | null;
|
|
232
339
|
default_token: string;
|
|
@@ -239,6 +346,6 @@ type WithdrawEvent = {
|
|
|
239
346
|
amount: string;
|
|
240
347
|
cta_name: "withdraw";
|
|
241
348
|
};
|
|
242
|
-
type
|
|
349
|
+
type ModalAnalyticsEvent = DepositAnalyticsEvent | WithdrawAnalyticsEvent;
|
|
243
350
|
|
|
244
|
-
export type { AssetOption as A, ChainId as C,
|
|
351
|
+
export type { AssetOption as A, ChainId as C, DepositAnalyticsEvent as D, ErrorEventData as E, ModalAnalyticsEvent as M, OrderBookSwapAction as O, PostBridgeAction as P, RouteConfig as R, SafeTransactionRequest as S, WithdrawAnalyticsEvent as W, ConnectedEventData as a, DepositCompleteEventData as b, DepositFailedEventData as c, DepositLifecycleEvent as d, DepositModalProps as e, DepositModalTheme as f, DepositModalUIConfig as g, DepositSubmittedEventData as h, OutputTokenRule as i, WithdrawCompleteEventData as j, WithdrawFailedEventData as k, WithdrawLifecycleEvent as l, WithdrawModalProps as m, WithdrawSubmittedEventData as n };
|
|
@@ -1,5 +1,63 @@
|
|
|
1
|
-
import { Address, WalletClient, PublicClient, Chain
|
|
2
|
-
|
|
1
|
+
import { Address, Hex, WalletClient, PublicClient, Chain } from 'viem';
|
|
2
|
+
|
|
3
|
+
interface SafeTransactionRequest {
|
|
4
|
+
chainId: number;
|
|
5
|
+
safeAddress: Address;
|
|
6
|
+
safeTxHash: Hex;
|
|
7
|
+
typedData: {
|
|
8
|
+
domain: {
|
|
9
|
+
chainId: number;
|
|
10
|
+
verifyingContract: Address;
|
|
11
|
+
};
|
|
12
|
+
types: typeof SAFE_TX_TYPES;
|
|
13
|
+
primaryType: "SafeTx";
|
|
14
|
+
message: {
|
|
15
|
+
to: Address;
|
|
16
|
+
value: bigint;
|
|
17
|
+
data: Hex;
|
|
18
|
+
operation: number;
|
|
19
|
+
safeTxGas: bigint;
|
|
20
|
+
baseGas: bigint;
|
|
21
|
+
gasPrice: bigint;
|
|
22
|
+
gasToken: Address;
|
|
23
|
+
refundReceiver: Address;
|
|
24
|
+
nonce: bigint;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
declare const SAFE_TX_TYPES: {
|
|
29
|
+
readonly SafeTx: readonly [{
|
|
30
|
+
readonly name: "to";
|
|
31
|
+
readonly type: "address";
|
|
32
|
+
}, {
|
|
33
|
+
readonly name: "value";
|
|
34
|
+
readonly type: "uint256";
|
|
35
|
+
}, {
|
|
36
|
+
readonly name: "data";
|
|
37
|
+
readonly type: "bytes";
|
|
38
|
+
}, {
|
|
39
|
+
readonly name: "operation";
|
|
40
|
+
readonly type: "uint8";
|
|
41
|
+
}, {
|
|
42
|
+
readonly name: "safeTxGas";
|
|
43
|
+
readonly type: "uint256";
|
|
44
|
+
}, {
|
|
45
|
+
readonly name: "baseGas";
|
|
46
|
+
readonly type: "uint256";
|
|
47
|
+
}, {
|
|
48
|
+
readonly name: "gasPrice";
|
|
49
|
+
readonly type: "uint256";
|
|
50
|
+
}, {
|
|
51
|
+
readonly name: "gasToken";
|
|
52
|
+
readonly type: "address";
|
|
53
|
+
}, {
|
|
54
|
+
readonly name: "refundReceiver";
|
|
55
|
+
readonly type: "address";
|
|
56
|
+
}, {
|
|
57
|
+
readonly name: "nonce";
|
|
58
|
+
readonly type: "uint256";
|
|
59
|
+
}];
|
|
60
|
+
};
|
|
3
61
|
|
|
4
62
|
type Caip2ChainId = `eip155:${number}` | `solana:${string}`;
|
|
5
63
|
type ChainId = number | "solana" | Caip2ChainId;
|
|
@@ -14,20 +72,21 @@ interface DepositModalTheme {
|
|
|
14
72
|
backgroundColor?: string;
|
|
15
73
|
}
|
|
16
74
|
interface DepositModalUIConfig {
|
|
17
|
-
showLogo?: boolean;
|
|
18
|
-
showStepper?: boolean;
|
|
19
75
|
showBackButton?: boolean;
|
|
20
76
|
showHistoryButton?: boolean;
|
|
21
|
-
balance?: {
|
|
22
|
-
title: string;
|
|
23
|
-
amount?: string;
|
|
24
|
-
};
|
|
25
77
|
maxDepositUsd?: number;
|
|
26
78
|
minDepositUsd?: number;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
79
|
+
/**
|
|
80
|
+
* When true the network/protocol fee is sponsored — the Review / Processing /
|
|
81
|
+
* Success / Failure screens render the fee line-through and surface a
|
|
82
|
+
* tooltip on the info icon explaining the sponsorship.
|
|
83
|
+
*/
|
|
84
|
+
feeSponsored?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Custom tooltip copy for the fee info icon. Defaults to a generic
|
|
87
|
+
* "Fees are sponsored" / "Fees apply" message based on `feeSponsored`.
|
|
88
|
+
*/
|
|
89
|
+
feeTooltip?: string;
|
|
31
90
|
}
|
|
32
91
|
interface ConnectedEventData {
|
|
33
92
|
address: Address;
|
|
@@ -35,15 +94,15 @@ interface ConnectedEventData {
|
|
|
35
94
|
}
|
|
36
95
|
interface DepositSubmittedEventData {
|
|
37
96
|
txHash: string;
|
|
38
|
-
sourceChain: ChainId;
|
|
97
|
+
sourceChain: ChainId | "unknown";
|
|
39
98
|
amount: string;
|
|
40
99
|
}
|
|
41
100
|
interface DepositCompleteEventData {
|
|
42
101
|
txHash: string;
|
|
43
102
|
destinationTxHash?: string;
|
|
44
103
|
amount: string;
|
|
45
|
-
sourceChain: ChainId;
|
|
46
|
-
sourceToken
|
|
104
|
+
sourceChain: ChainId | "unknown";
|
|
105
|
+
sourceToken?: string;
|
|
47
106
|
targetChain: number;
|
|
48
107
|
targetToken: string;
|
|
49
108
|
}
|
|
@@ -112,20 +171,15 @@ interface DepositModalProps {
|
|
|
112
171
|
waitForFinalTx?: boolean;
|
|
113
172
|
reownAppId?: string;
|
|
114
173
|
enableSolana?: boolean;
|
|
115
|
-
enablePolymarketMigration?: boolean;
|
|
116
174
|
onRequestConnect?: () => void;
|
|
117
|
-
connectButtonLabel?: string;
|
|
118
175
|
theme?: DepositModalTheme;
|
|
119
|
-
branding?: DepositModalBranding;
|
|
120
176
|
uiConfig?: DepositModalUIConfig;
|
|
121
177
|
allowedRoutes?: RouteConfig;
|
|
122
178
|
className?: string;
|
|
123
179
|
onReady?: () => void;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
onDepositFailed?: (data: DepositFailedEventData) => void;
|
|
128
|
-
onEvent?: (event: DepositEvent) => void;
|
|
180
|
+
/** Discriminated stream of deposit lifecycle transitions. */
|
|
181
|
+
onLifecycle?: (event: DepositLifecycleEvent) => void;
|
|
182
|
+
onEvent?: (event: DepositAnalyticsEvent) => void;
|
|
129
183
|
onError?: (data: ErrorEventData) => void;
|
|
130
184
|
debug?: boolean;
|
|
131
185
|
}
|
|
@@ -156,17 +210,13 @@ interface WithdrawModalProps {
|
|
|
156
210
|
signature: Hex;
|
|
157
211
|
}>;
|
|
158
212
|
onRequestConnect?: () => void;
|
|
159
|
-
connectButtonLabel?: string;
|
|
160
213
|
theme?: DepositModalTheme;
|
|
161
|
-
branding?: DepositModalBranding;
|
|
162
214
|
uiConfig?: DepositModalUIConfig;
|
|
163
215
|
className?: string;
|
|
164
216
|
onReady?: () => void;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
onWithdrawFailed?: (data: WithdrawFailedEventData) => void;
|
|
169
|
-
onEvent?: (event: WithdrawEvent) => void;
|
|
217
|
+
/** Discriminated stream of withdraw lifecycle transitions. */
|
|
218
|
+
onLifecycle?: (event: WithdrawLifecycleEvent) => void;
|
|
219
|
+
onEvent?: (event: WithdrawAnalyticsEvent) => void;
|
|
170
220
|
onError?: (data: ErrorEventData) => void;
|
|
171
221
|
debug?: boolean;
|
|
172
222
|
}
|
|
@@ -179,12 +229,6 @@ interface AssetOption {
|
|
|
179
229
|
decimals: number;
|
|
180
230
|
balance?: string;
|
|
181
231
|
balanceUsd?: number;
|
|
182
|
-
source?: "wallet" | "polymarket";
|
|
183
|
-
sourceLabel?: string;
|
|
184
|
-
balanceAddress?: Address;
|
|
185
|
-
depositToken?: Address;
|
|
186
|
-
reviewLabel?: string;
|
|
187
|
-
reviewHelperText?: string;
|
|
188
232
|
}
|
|
189
233
|
interface OrderBookSwapAction {
|
|
190
234
|
type: "orderbook-swap";
|
|
@@ -192,7 +236,70 @@ interface OrderBookSwapAction {
|
|
|
192
236
|
outputToken: Address;
|
|
193
237
|
}
|
|
194
238
|
type PostBridgeAction = OrderBookSwapAction;
|
|
195
|
-
|
|
239
|
+
/**
|
|
240
|
+
* Discriminated union covering every deposit flow state transition the
|
|
241
|
+
* consumer can observe. Consumers handle additions in a single switch; the
|
|
242
|
+
* modal can add new event variants without changing the prop surface.
|
|
243
|
+
*/
|
|
244
|
+
type DepositLifecycleEvent = {
|
|
245
|
+
type: "connected";
|
|
246
|
+
address: Address;
|
|
247
|
+
smartAccount: Address;
|
|
248
|
+
} | {
|
|
249
|
+
type: "submitted";
|
|
250
|
+
txHash: string;
|
|
251
|
+
sourceChain: ChainId | "unknown";
|
|
252
|
+
amount: string;
|
|
253
|
+
} | {
|
|
254
|
+
type: "complete";
|
|
255
|
+
txHash: string;
|
|
256
|
+
destinationTxHash?: string;
|
|
257
|
+
amount: string;
|
|
258
|
+
sourceChain: ChainId | "unknown";
|
|
259
|
+
sourceToken?: string;
|
|
260
|
+
targetChain: number;
|
|
261
|
+
targetToken: string;
|
|
262
|
+
} | {
|
|
263
|
+
type: "failed";
|
|
264
|
+
txHash: string;
|
|
265
|
+
error?: string;
|
|
266
|
+
} | {
|
|
267
|
+
type: "balance-changed";
|
|
268
|
+
totalUsd: number;
|
|
269
|
+
} | {
|
|
270
|
+
type: "smart-account-changed";
|
|
271
|
+
evm: Address | null;
|
|
272
|
+
solana: string | null;
|
|
273
|
+
};
|
|
274
|
+
type WithdrawLifecycleEvent = {
|
|
275
|
+
type: "connected";
|
|
276
|
+
address: Address;
|
|
277
|
+
smartAccount: Address;
|
|
278
|
+
} | {
|
|
279
|
+
type: "submitted";
|
|
280
|
+
txHash: Hex;
|
|
281
|
+
sourceChain: number;
|
|
282
|
+
amount: string;
|
|
283
|
+
safeAddress: Address;
|
|
284
|
+
} | {
|
|
285
|
+
type: "complete";
|
|
286
|
+
txHash: Hex;
|
|
287
|
+
destinationTxHash?: Hex;
|
|
288
|
+
amount: string;
|
|
289
|
+
sourceChain: number;
|
|
290
|
+
sourceToken: Address;
|
|
291
|
+
targetChain: number;
|
|
292
|
+
targetToken: Address;
|
|
293
|
+
} | {
|
|
294
|
+
type: "failed";
|
|
295
|
+
txHash: Hex;
|
|
296
|
+
error?: string;
|
|
297
|
+
};
|
|
298
|
+
/**
|
|
299
|
+
* Telemetry events fired when screens open or CTAs are clicked.
|
|
300
|
+
* Distinct from {@link DepositLifecycleEvent}, which tracks transaction state.
|
|
301
|
+
*/
|
|
302
|
+
type DepositAnalyticsEvent = {
|
|
196
303
|
type: "deposit_modal_connected_wallet_select_source_open";
|
|
197
304
|
total_balance_in_external_wallet: number | null;
|
|
198
305
|
pred_balance: number | null;
|
|
@@ -226,7 +333,7 @@ type DepositEvent = {
|
|
|
226
333
|
pred_balance: number | null;
|
|
227
334
|
cta_name: "continue" | "25%" | "50%" | "75%" | "Max";
|
|
228
335
|
};
|
|
229
|
-
type
|
|
336
|
+
type WithdrawAnalyticsEvent = {
|
|
230
337
|
type: "withdraw_modal_select_amount_open";
|
|
231
338
|
pred_balance: number | null;
|
|
232
339
|
default_token: string;
|
|
@@ -239,6 +346,6 @@ type WithdrawEvent = {
|
|
|
239
346
|
amount: string;
|
|
240
347
|
cta_name: "withdraw";
|
|
241
348
|
};
|
|
242
|
-
type
|
|
349
|
+
type ModalAnalyticsEvent = DepositAnalyticsEvent | WithdrawAnalyticsEvent;
|
|
243
350
|
|
|
244
|
-
export type { AssetOption as A, ChainId as C,
|
|
351
|
+
export type { AssetOption as A, ChainId as C, DepositAnalyticsEvent as D, ErrorEventData as E, ModalAnalyticsEvent as M, OrderBookSwapAction as O, PostBridgeAction as P, RouteConfig as R, SafeTransactionRequest as S, WithdrawAnalyticsEvent as W, ConnectedEventData as a, DepositCompleteEventData as b, DepositFailedEventData as c, DepositLifecycleEvent as d, DepositModalProps as e, DepositModalTheme as f, DepositModalUIConfig as g, DepositSubmittedEventData as h, OutputTokenRule as i, WithdrawCompleteEventData as j, WithdrawFailedEventData as k, WithdrawLifecycleEvent as l, WithdrawModalProps as m, WithdrawSubmittedEventData as n };
|
package/dist/withdraw.cjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
6
|
-
require('./chunk-R2HP743T.cjs');
|
|
3
|
+
var _chunkZ2SIC2THcjs = require('./chunk-Z2SIC2TH.cjs');
|
|
4
|
+
require('./chunk-Y3RA3YGA.cjs');
|
|
5
|
+
require('./chunk-XCAF6B3D.cjs');
|
|
7
6
|
|
|
8
7
|
|
|
9
|
-
exports.WithdrawModal =
|
|
8
|
+
exports.WithdrawModal = _chunkZ2SIC2THcjs.WithdrawModal;
|
package/dist/withdraw.d.cts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
export { A as AssetOption, a as ConnectedEventData, E as ErrorEventData,
|
|
4
|
-
export { S as SafeTransactionRequest } from './safe-CB7TvRCc.cjs';
|
|
2
|
+
import { m as WithdrawModalProps } from './types-DRou84ZM.cjs';
|
|
3
|
+
export { A as AssetOption, a as ConnectedEventData, E as ErrorEventData, S as SafeTransactionRequest, j as WithdrawCompleteEventData, k as WithdrawFailedEventData, n as WithdrawSubmittedEventData } from './types-DRou84ZM.cjs';
|
|
5
4
|
import 'viem';
|
|
6
5
|
|
|
7
6
|
declare function WithdrawModal(props: WithdrawModalProps): react_jsx_runtime.JSX.Element;
|
package/dist/withdraw.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
export { A as AssetOption, a as ConnectedEventData, E as ErrorEventData,
|
|
4
|
-
export { S as SafeTransactionRequest } from './safe-CB7TvRCc.js';
|
|
2
|
+
import { m as WithdrawModalProps } from './types-DRou84ZM.js';
|
|
3
|
+
export { A as AssetOption, a as ConnectedEventData, E as ErrorEventData, S as SafeTransactionRequest, j as WithdrawCompleteEventData, k as WithdrawFailedEventData, n as WithdrawSubmittedEventData } from './types-DRou84ZM.js';
|
|
5
4
|
import 'viem';
|
|
6
5
|
|
|
7
6
|
declare function WithdrawModal(props: WithdrawModalProps): react_jsx_runtime.JSX.Element;
|
package/dist/withdraw.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WithdrawModal
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-WHW3ZMOT.mjs";
|
|
3
|
+
} from "./chunk-FKPTIHU7.mjs";
|
|
4
|
+
import "./chunk-UIHAYD7J.mjs";
|
|
5
|
+
import "./chunk-EEHUOFIW.mjs";
|
|
7
6
|
export {
|
|
8
7
|
WithdrawModal
|
|
9
8
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhinestone/deposit-modal",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-alpha.0",
|
|
4
4
|
"description": "React modal component for Rhinestone cross-chain deposits",
|
|
5
5
|
"author": "Rhinestone <dev@rhinestone.wtf>",
|
|
6
6
|
"bugs": {
|
|
@@ -26,16 +26,6 @@
|
|
|
26
26
|
"import": "./dist/withdraw.mjs",
|
|
27
27
|
"require": "./dist/withdraw.cjs"
|
|
28
28
|
},
|
|
29
|
-
"./reown": {
|
|
30
|
-
"types": "./dist/reown.d.ts",
|
|
31
|
-
"import": "./dist/reown.mjs",
|
|
32
|
-
"require": "./dist/reown.cjs"
|
|
33
|
-
},
|
|
34
|
-
"./safe": {
|
|
35
|
-
"types": "./dist/safe.d.ts",
|
|
36
|
-
"import": "./dist/safe.mjs",
|
|
37
|
-
"require": "./dist/safe.cjs"
|
|
38
|
-
},
|
|
39
29
|
"./constants": {
|
|
40
30
|
"types": "./dist/constants.d.ts",
|
|
41
31
|
"import": "./dist/constants.mjs",
|
|
@@ -58,6 +48,9 @@
|
|
|
58
48
|
"build": "tsup && bun run scripts/postbuild.ts",
|
|
59
49
|
"clean": "rm -rf dist",
|
|
60
50
|
"typecheck": "tsc --noEmit",
|
|
51
|
+
"test": "vitest run",
|
|
52
|
+
"test:watch": "vitest",
|
|
53
|
+
"test:coverage": "vitest run --coverage",
|
|
61
54
|
"prepublishOnly": "bun run clean && bun run build && bun run typecheck"
|
|
62
55
|
},
|
|
63
56
|
"peerDependencies": {
|
|
@@ -84,7 +77,9 @@
|
|
|
84
77
|
}
|
|
85
78
|
},
|
|
86
79
|
"dependencies": {
|
|
87
|
-
"react
|
|
80
|
+
"lucide-react": "^1.14.0",
|
|
81
|
+
"react-qrcode-logo": "^4.0.0",
|
|
82
|
+
"zustand": "^5"
|
|
88
83
|
},
|
|
89
84
|
"devDependencies": {
|
|
90
85
|
"@reown/appkit": "1.8.19",
|
|
@@ -94,15 +89,21 @@
|
|
|
94
89
|
"@solana/spl-token": "^0.4.14",
|
|
95
90
|
"@solana/web3.js": "^1.98.4",
|
|
96
91
|
"@tanstack/react-query": "^5.0.0",
|
|
92
|
+
"@testing-library/jest-dom": "^6",
|
|
93
|
+
"@testing-library/react": "^16",
|
|
94
|
+
"@testing-library/user-event": "^14",
|
|
97
95
|
"@types/react": "^19.0.0",
|
|
98
96
|
"@types/react-dom": "^19.0.0",
|
|
97
|
+
"@vitest/coverage-v8": "^4.0.10",
|
|
99
98
|
"bun-types": "^1.3.8",
|
|
99
|
+
"jsdom": "^25",
|
|
100
100
|
"react": "^19.0.0",
|
|
101
101
|
"react-dom": "^19.0.0",
|
|
102
102
|
"size-limit": "^12.0.0",
|
|
103
103
|
"tsup": "^8.0.0",
|
|
104
104
|
"typescript": "^5.5.0",
|
|
105
105
|
"viem": "^2.47.12",
|
|
106
|
+
"vitest": "^4.0.10",
|
|
106
107
|
"wagmi": "^3.4.2"
|
|
107
108
|
},
|
|
108
109
|
"size-limit": [
|