@rhinestone/deposit-modal 0.1.14 → 0.1.16

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 CHANGED
@@ -23,16 +23,42 @@ import "@rhinestone/deposit-modal/styles.css";
23
23
  <DepositModal
24
24
  isOpen={isOpen}
25
25
  onClose={() => setIsOpen(false)}
26
- walletClient={walletClient}
27
- publicClient={publicClient}
28
- address={address}
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,16 +67,16 @@ 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
- | `walletClient` | `WalletClient \| null` | No | viem WalletClient |
45
- | `publicClient` | `PublicClient \| null` | No | viem PublicClient |
46
- | `address` | `Address \| null` | No | Connected wallet address |
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 |
51
76
  | `defaultAmount` | `string` | No | Pre-filled amount |
52
77
  | `recipient` | `Address` | No | Custom recipient address |
53
78
  | `backendUrl` | `string` | No | Backend URL |
79
+ | `rhinestoneApiKey` | `string` | No | Optional SDK api key forwarded to `RhinestoneSDK` during smart-account setup |
54
80
  | `signerAddress` | `Address` | No | Session signer address |
55
81
  | `waitForFinalTx` | `boolean` | No | Wait for destination tx (default: true) |
56
82
  | `onRequestConnect` | `() => void` | No | Called when wallet connection needed |
@@ -65,11 +91,11 @@ import "@rhinestone/deposit-modal/styles.css";
65
91
  | Callback | Description |
66
92
  |----------|-------------|
67
93
  | `onReady` | Modal initialized |
68
- | `onConnected(address, smartAccount)` | Smart account created |
69
- | `onDepositSubmitted(txHash, sourceChain, amount)` | Transfer signed |
70
- | `onDepositComplete(txHash, destinationTxHash?)` | Deposit arrived on target chain |
71
- | `onDepositFailed(txHash, error?)` | Bridge failed |
72
- | `onError(message, code?)` | Error during flow |
94
+ | `onConnected(data)` | Smart account created (`{ address, smartAccount }`) |
95
+ | `onDepositSubmitted(data)` | Transfer signed (`{ txHash, sourceChain, amount }`) |
96
+ | `onDepositComplete(data)` | Deposit arrived (`{ txHash, destinationTxHash? }`) |
97
+ | `onDepositFailed(data)` | Bridge failed (`{ txHash, error? }`) |
98
+ | `onError(data)` | Error payload (`{ message, code? }`) |
73
99
 
74
100
  ## WithdrawModal
75
101
 
@@ -86,15 +112,14 @@ import "@rhinestone/deposit-modal/styles.css";
86
112
  <WithdrawModal
87
113
  isOpen={isOpen}
88
114
  onClose={() => setIsOpen(false)}
89
- walletClient={walletClient}
90
- publicClient={publicClient}
91
- address={address}
115
+ dappWalletClient={walletClient}
116
+ dappPublicClient={publicClient}
117
+ dappAddress={address}
92
118
  safeAddress="0x..."
93
119
  sourceChain={8453}
94
120
  sourceToken="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
95
121
  targetChain={1}
96
122
  targetToken="0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
97
- switchChain={(chainId) => switchChainAsync({ chainId })}
98
123
  onWithdrawComplete={(data) => console.log("Done!", data)}
99
124
  />
100
125
  ```
@@ -111,9 +136,9 @@ import "@rhinestone/deposit-modal/styles.css";
111
136
 
112
137
  | Callback | Description |
113
138
  |----------|-------------|
114
- | `onWithdrawSubmitted(txHash, sourceChain, amount, safeAddress)` | Safe transfer signed |
115
- | `onWithdrawComplete(txHash, destinationTxHash?)` | Withdrawal arrived |
116
- | `onWithdrawFailed(txHash, error?)` | Bridge failed |
139
+ | `onWithdrawSubmitted(data)` | Safe transfer signed (`{ txHash, sourceChain, amount, safeAddress }`) |
140
+ | `onWithdrawComplete(data)` | Withdrawal arrived (`{ txHash, destinationTxHash? }`) |
141
+ | `onWithdrawFailed(data)` | Bridge failed (`{ txHash, error? }`) |
117
142
 
118
143
  Also supports `onReady`, `onConnected`, and `onError` (same as DepositModal).
119
144
 
@@ -146,7 +171,7 @@ import {
146
171
 
147
172
  ## Supported Chains
148
173
 
149
- Base (8453), Optimism (10), Arbitrum (42161)
174
+ Mainnet (1), Base (8453), Arbitrum (42161), Optimism (10), Polygon (137), BSC (56)
150
175
 
151
176
  ## License
152
177