@rhinestone/deposit-modal 0.1.14 → 0.1.15
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 +45 -21
- package/dist/index.cjs +327 -248
- package/dist/index.d.cts +6 -12
- package/dist/index.d.ts +6 -12
- package/dist/index.mjs +340 -269
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,16 +23,42 @@ import "@rhinestone/deposit-modal/styles.css";
|
|
|
23
23
|
<DepositModal
|
|
24
24
|
isOpen={isOpen}
|
|
25
25
|
onClose={() => setIsOpen(false)}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
dappWalletClient={walletClient}
|
|
27
|
+
dappPublicClient={publicClient}
|
|
28
|
+
dappAddress={address}
|
|
29
29
|
targetChain={8453}
|
|
30
30
|
targetToken="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
|
|
31
|
-
switchChain={(chainId) => switchChainAsync({ chainId })}
|
|
32
31
|
onDepositComplete={(data) => console.log("Done!", data)}
|
|
33
32
|
/>
|
|
34
33
|
```
|
|
35
34
|
|
|
35
|
+
### Deposit flow matrix
|
|
36
|
+
|
|
37
|
+
| | Flow 1: Dapp signer | Flow 2: External wallet | Flow 3: QR deposit |
|
|
38
|
+
|---|---|---|---|
|
|
39
|
+
| Typical dapp input | `dappWalletClient` + `dappAddress` | `dappAddress` (user selects/connects external wallet in modal) | `dappAddress` only |
|
|
40
|
+
| Connect step options | `Connected Wallet` (+ `External Wallet`/`Transfer Crypto` if available) | Usually `External Wallet` + `Transfer Crypto` | Same options, user picks `Transfer Crypto` |
|
|
41
|
+
| Smart-account owner (`ownerAddress`) | `dappWalletClient.account.address` | Selected external wallet address | `dappAddress` |
|
|
42
|
+
| `createSmartAccount(userSigner, sessionOwner.account)` `userSigner` | `walletClientToAccount(dappWalletClient)` | `walletClientToAccount(externalWalletClient)` | `createViewOnlyAccount(dappAddress)` |
|
|
43
|
+
| `createSmartAccount(..., sessionOwner.account)` co-owner | Local browser session-owner keypair (`sessionOwner.account`) | Local browser session-owner keypair (`sessionOwner.account`) | Local browser session-owner keypair (`sessionOwner.account`) |
|
|
44
|
+
| Smart account `S` owners passed to SDK | `[ownerAddress, sessionOwner.address]` | `[ownerAddress, sessionOwner.address]` | `[ownerAddress, sessionOwner.address]` |
|
|
45
|
+
| Session-owner localStorage key | `rhinestone:session-owner:<ownerAddress.lowercase()>` | `rhinestone:session-owner:<ownerAddress.lowercase()>` | `rhinestone:session-owner:<ownerAddress.lowercase()>` |
|
|
46
|
+
| Session policy signer in `sessionDetails` | `DEFAULT_SIGNER_ADDRESS` (or `signerAddress` prop override) | `DEFAULT_SIGNER_ADDRESS` (or `signerAddress` prop override) | `DEFAULT_SIGNER_ADDRESS` (or `signerAddress` prop override) |
|
|
47
|
+
| Who signs source transfer | `dappWalletClient` | External wallet client | No modal signer (user sends funds manually) |
|
|
48
|
+
| How processing starts | Confirm step submits transfer tx | Confirm step submits transfer tx | User sends to QR address; modal polls status |
|
|
49
|
+
| `POST /register` `address` | Smart account address (`S`) | Smart account address (`S`) | Smart account address (`S`) |
|
|
50
|
+
| `POST /register` `eoaAddress` | `ownerAddress` | `ownerAddress` | `dappAddress` |
|
|
51
|
+
| `POST /register` `sessionOwner` | `sessionOwner.address` (local co-owner key) | `sessionOwner.address` (local co-owner key) | `sessionOwner.address` (local co-owner key) |
|
|
52
|
+
| `POST /register` `accountParams.sessionDetails` | Built from session policy signer + `sessionOwner.account` signature | Built from session policy signer + `sessionOwner.account` signature | Built from session policy signer + `sessionOwner.account` signature |
|
|
53
|
+
| `POST /register` `target` | `{ chain: targetChain, token: targetToken, recipient? }` | `{ chain: targetChain, token: targetToken, recipient? }` | `{ chain: targetChain, token: targetToken, recipient? }` |
|
|
54
|
+
| If `dappAddress` is missing | Unsupported for this flow | External-only flow can still run | Not available (QR hidden) |
|
|
55
|
+
|
|
56
|
+
Notes:
|
|
57
|
+
- External wallet option is available when Reown is enabled (`reownAppId`) and a wallet can be connected in the modal.
|
|
58
|
+
- `onConnected({ address, smartAccount })` reports the active owner address used for that flow.
|
|
59
|
+
- Smart-account owner config is passed to the SDK as two ECDSA owners (`ownerAddress` + local `sessionOwner`) with threshold `1`.
|
|
60
|
+
- `DEFAULT_SIGNER_ADDRESS` is the session policy signer inside `sessionDetails`; it is not the local co-owner key stored in browser.
|
|
61
|
+
|
|
36
62
|
### Props
|
|
37
63
|
|
|
38
64
|
| Prop | Type | Required | Description |
|
|
@@ -41,10 +67,9 @@ import "@rhinestone/deposit-modal/styles.css";
|
|
|
41
67
|
| `onClose` | `() => void` | Yes | Close handler |
|
|
42
68
|
| `targetChain` | `Chain \| number` | Yes | Destination chain |
|
|
43
69
|
| `targetToken` | `Address` | Yes | Destination token address |
|
|
44
|
-
| `
|
|
45
|
-
| `
|
|
46
|
-
| `
|
|
47
|
-
| `switchChain` | `(chainId: number) => Promise<{id: number} \| void>` | No | Chain switch callback |
|
|
70
|
+
| `dappWalletClient` | `WalletClient \| null` | No | Host-provided signer wallet client |
|
|
71
|
+
| `dappPublicClient` | `PublicClient \| null` | No | Host-provided public client (fallbacks are created internally if missing) |
|
|
72
|
+
| `dappAddress` | `Address \| null` | No | Dapp identity / owner anchor used by setup and QR flow |
|
|
48
73
|
| `inline` | `boolean` | No | Render inline without overlay |
|
|
49
74
|
| `sourceChain` | `Chain \| number` | No | Pre-selected source chain |
|
|
50
75
|
| `sourceToken` | `Address` | No | Pre-selected source token |
|
|
@@ -65,11 +90,11 @@ import "@rhinestone/deposit-modal/styles.css";
|
|
|
65
90
|
| Callback | Description |
|
|
66
91
|
|----------|-------------|
|
|
67
92
|
| `onReady` | Modal initialized |
|
|
68
|
-
| `onConnected(
|
|
69
|
-
| `onDepositSubmitted(txHash, sourceChain, amount)
|
|
70
|
-
| `onDepositComplete(
|
|
71
|
-
| `onDepositFailed(
|
|
72
|
-
| `onError(
|
|
93
|
+
| `onConnected(data)` | Smart account created (`{ address, smartAccount }`) |
|
|
94
|
+
| `onDepositSubmitted(data)` | Transfer signed (`{ txHash, sourceChain, amount }`) |
|
|
95
|
+
| `onDepositComplete(data)` | Deposit arrived (`{ txHash, destinationTxHash? }`) |
|
|
96
|
+
| `onDepositFailed(data)` | Bridge failed (`{ txHash, error? }`) |
|
|
97
|
+
| `onError(data)` | Error payload (`{ message, code? }`) |
|
|
73
98
|
|
|
74
99
|
## WithdrawModal
|
|
75
100
|
|
|
@@ -86,15 +111,14 @@ import "@rhinestone/deposit-modal/styles.css";
|
|
|
86
111
|
<WithdrawModal
|
|
87
112
|
isOpen={isOpen}
|
|
88
113
|
onClose={() => setIsOpen(false)}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
114
|
+
dappWalletClient={walletClient}
|
|
115
|
+
dappPublicClient={publicClient}
|
|
116
|
+
dappAddress={address}
|
|
92
117
|
safeAddress="0x..."
|
|
93
118
|
sourceChain={8453}
|
|
94
119
|
sourceToken="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
|
|
95
120
|
targetChain={1}
|
|
96
121
|
targetToken="0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
|
97
|
-
switchChain={(chainId) => switchChainAsync({ chainId })}
|
|
98
122
|
onWithdrawComplete={(data) => console.log("Done!", data)}
|
|
99
123
|
/>
|
|
100
124
|
```
|
|
@@ -111,9 +135,9 @@ import "@rhinestone/deposit-modal/styles.css";
|
|
|
111
135
|
|
|
112
136
|
| Callback | Description |
|
|
113
137
|
|----------|-------------|
|
|
114
|
-
| `onWithdrawSubmitted(txHash, sourceChain, amount, safeAddress)
|
|
115
|
-
| `onWithdrawComplete(
|
|
116
|
-
| `onWithdrawFailed(
|
|
138
|
+
| `onWithdrawSubmitted(data)` | Safe transfer signed (`{ txHash, sourceChain, amount, safeAddress }`) |
|
|
139
|
+
| `onWithdrawComplete(data)` | Withdrawal arrived (`{ txHash, destinationTxHash? }`) |
|
|
140
|
+
| `onWithdrawFailed(data)` | Bridge failed (`{ txHash, error? }`) |
|
|
117
141
|
|
|
118
142
|
Also supports `onReady`, `onConnected`, and `onError` (same as DepositModal).
|
|
119
143
|
|
|
@@ -146,7 +170,7 @@ import {
|
|
|
146
170
|
|
|
147
171
|
## Supported Chains
|
|
148
172
|
|
|
149
|
-
Base (8453), Optimism (10),
|
|
173
|
+
Mainnet (1), Base (8453), Arbitrum (42161), Optimism (10), Polygon (137), BSC (56)
|
|
150
174
|
|
|
151
175
|
## License
|
|
152
176
|
|