@rhinestone/deposit-modal 0.1.22 → 0.1.24
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 +5 -1
- package/dist/{chunk-J7UK4L5T.mjs → chunk-35DWLO33.mjs} +36 -41
- package/dist/{chunk-W7ZYJB2X.cjs → chunk-A2PDOYYE.cjs} +81 -89
- package/dist/{chunk-BO745KAB.cjs → chunk-ANQQMGNN.cjs} +116 -197
- package/dist/{chunk-V6HZJZOL.cjs → chunk-O3I5KVXA.cjs} +72 -77
- package/dist/{chunk-JBT2ZV3Q.mjs → chunk-P7SQQAAF.mjs} +89 -170
- package/dist/{chunk-N2LJOFT2.mjs → chunk-ZMVCDFXM.mjs} +40 -48
- package/dist/deposit.cjs +3 -3
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +3 -3
- package/dist/reown.cjs +197 -0
- package/dist/reown.d.cts +14 -0
- package/dist/reown.d.ts +14 -0
- package/dist/reown.mjs +197 -0
- package/dist/{types-D_xeOU8G.d.cts → types-CUww05xT.d.cts} +14 -1
- package/dist/{types-DnGF9RJJ.d.ts → types-Z6GjVWFR.d.ts} +14 -1
- package/dist/withdraw.cjs +3 -3
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +2 -2
- package/dist/withdraw.mjs +2 -2
- package/package.json +33 -11
- package/dist/DepositModalReown-324WTBDE.cjs +0 -33
- package/dist/DepositModalReown-YTWIR7A4.mjs +0 -33
- package/dist/WithdrawModalReown-ICP3DH6Q.mjs +0 -33
- package/dist/WithdrawModalReown-ZNTE2G6W.cjs +0 -33
- package/dist/chunk-6VJ2ZTNQ.cjs +0 -90
- package/dist/chunk-LBEP3A2Z.mjs +0 -90
package/README.md
CHANGED
|
@@ -15,10 +15,14 @@ Prefer subpath imports so apps only bundle what they use:
|
|
|
15
15
|
```tsx
|
|
16
16
|
import { DepositModal } from "@rhinestone/deposit-modal/deposit";
|
|
17
17
|
import { WithdrawModal } from "@rhinestone/deposit-modal/withdraw";
|
|
18
|
+
import { DepositModal as DepositModalReown } from "@rhinestone/deposit-modal/reown";
|
|
18
19
|
import { executeSafeEthTransfer } from "@rhinestone/deposit-modal/safe";
|
|
19
20
|
import { getChainName } from "@rhinestone/deposit-modal/constants";
|
|
20
21
|
```
|
|
21
22
|
|
|
23
|
+
If you use `reownAppId`, import modal components from
|
|
24
|
+
`@rhinestone/deposit-modal/reown`.
|
|
25
|
+
|
|
22
26
|
## DepositModal
|
|
23
27
|
|
|
24
28
|
Deposits tokens from any supported chain into a target chain/token via a Rhinestone smart account.
|
|
@@ -88,7 +92,7 @@ Notes:
|
|
|
88
92
|
| `defaultAmount` | `string` | No | Pre-filled amount |
|
|
89
93
|
| `recipient` | `Address` | No | Custom recipient address |
|
|
90
94
|
| `backendUrl` | `string` | No | Backend URL |
|
|
91
|
-
| `rhinestoneApiKey` | `string` | No |
|
|
95
|
+
| `rhinestoneApiKey` | `string` | No | Deprecated in client flow (server-side account preparation now owns SDK access) |
|
|
92
96
|
| `signerAddress` | `Address` | No | Session signer address |
|
|
93
97
|
| `waitForFinalTx` | `boolean` | No | Wait for destination tx (default: true) |
|
|
94
98
|
| `onRequestConnect` | `() => void` | No | Called when wallet connection needed |
|
|
@@ -6,21 +6,17 @@ import {
|
|
|
6
6
|
ProcessingStep,
|
|
7
7
|
accountFromPrivateKey,
|
|
8
8
|
applyTheme,
|
|
9
|
+
buildSessionDetails,
|
|
9
10
|
createDepositService,
|
|
10
11
|
createSessionOwnerKey,
|
|
11
|
-
createSmartAccount,
|
|
12
|
-
createViewOnlyAccount,
|
|
13
12
|
currencyFormatter,
|
|
14
13
|
formatUserError,
|
|
15
|
-
getAccountAddress,
|
|
16
|
-
getAccountInitData,
|
|
17
14
|
getAssetId,
|
|
18
15
|
getPublicClient,
|
|
19
|
-
getSessionDetails,
|
|
20
16
|
isNativeAsset,
|
|
21
17
|
loadSessionOwnerFromStorage,
|
|
22
18
|
saveSessionOwnerToStorage
|
|
23
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-P7SQQAAF.mjs";
|
|
24
20
|
import {
|
|
25
21
|
CHAIN_BY_ID,
|
|
26
22
|
DEFAULT_BACKEND_URL,
|
|
@@ -42,9 +38,7 @@ import {
|
|
|
42
38
|
useEffect as useEffect3,
|
|
43
39
|
useMemo as useMemo3,
|
|
44
40
|
useRef as useRef2,
|
|
45
|
-
useState as useState3
|
|
46
|
-
lazy,
|
|
47
|
-
Suspense
|
|
41
|
+
useState as useState3
|
|
48
42
|
} from "react";
|
|
49
43
|
|
|
50
44
|
// src/WithdrawFlow.tsx
|
|
@@ -559,9 +553,6 @@ function WithdrawFormStep({
|
|
|
559
553
|
}
|
|
560
554
|
WithdrawFormStep.displayName = "WithdrawFormStep";
|
|
561
555
|
|
|
562
|
-
// src/WithdrawFlow.tsx
|
|
563
|
-
import { walletClientToAccount } from "@rhinestone/sdk";
|
|
564
|
-
|
|
565
556
|
// src/core/safe.ts
|
|
566
557
|
import {
|
|
567
558
|
concat,
|
|
@@ -862,7 +853,6 @@ function WithdrawFlow({
|
|
|
862
853
|
recipient: defaultRecipient,
|
|
863
854
|
amount: defaultAmount,
|
|
864
855
|
service,
|
|
865
|
-
rhinestoneApiKey,
|
|
866
856
|
signerAddress = DEFAULT_SIGNER_ADDRESS,
|
|
867
857
|
sessionChainIds,
|
|
868
858
|
forceRegister = false,
|
|
@@ -1022,6 +1012,16 @@ function WithdrawFlow({
|
|
|
1022
1012
|
address: created.address
|
|
1023
1013
|
};
|
|
1024
1014
|
}, []);
|
|
1015
|
+
const signSessionDetails = useCallback2(
|
|
1016
|
+
async (sessionOwnerAccount, typedData) => {
|
|
1017
|
+
const signer = sessionOwnerAccount;
|
|
1018
|
+
if (!signer.signTypedData) {
|
|
1019
|
+
throw new Error("Session owner cannot sign typed data");
|
|
1020
|
+
}
|
|
1021
|
+
return await signer.signTypedData(typedData);
|
|
1022
|
+
},
|
|
1023
|
+
[]
|
|
1024
|
+
);
|
|
1025
1025
|
const handleFormSubmit = useCallback2(
|
|
1026
1026
|
async (recipient, amountValue) => {
|
|
1027
1027
|
const ownerAddress2 = signerContext?.ownerAddress;
|
|
@@ -1036,31 +1036,32 @@ function WithdrawFlow({
|
|
|
1036
1036
|
}
|
|
1037
1037
|
setIsSubmitting(true);
|
|
1038
1038
|
try {
|
|
1039
|
-
const signerAccount = signerContext?.walletClient ? walletClientToAccount(signerContext.walletClient) : createViewOnlyAccount(ownerAddress2);
|
|
1040
1039
|
const sessionOwner = await resolveSessionOwner(ownerAddress2);
|
|
1041
|
-
const
|
|
1042
|
-
|
|
1043
|
-
sessionOwner.
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1040
|
+
const prepared = await service.prepareAccount({
|
|
1041
|
+
ownerAddress: ownerAddress2,
|
|
1042
|
+
sessionOwnerAddress: sessionOwner.address,
|
|
1043
|
+
targetChain,
|
|
1044
|
+
targetToken,
|
|
1045
|
+
signerAddress,
|
|
1046
|
+
sessionChainIds
|
|
1047
|
+
});
|
|
1048
|
+
const smartAccount = prepared.smartAccount;
|
|
1047
1049
|
const checkResult = await service.checkAccount(smartAccount);
|
|
1048
1050
|
const targetMatches = checkResult.targetChain === targetChain && checkResult.targetToken?.toLowerCase() === targetToken.toLowerCase();
|
|
1049
1051
|
if (!checkResult.isRegistered || forceRegister || !targetMatches) {
|
|
1050
|
-
const
|
|
1051
|
-
const sessionDetails = await getSessionDetails(
|
|
1052
|
-
account,
|
|
1053
|
-
targetChainObj,
|
|
1054
|
-
signerAddress,
|
|
1052
|
+
const signature = await signSessionDetails(
|
|
1055
1053
|
sessionOwner.account,
|
|
1056
|
-
|
|
1057
|
-
|
|
1054
|
+
prepared.sessionDetailsUnsigned.data
|
|
1055
|
+
);
|
|
1056
|
+
const sessionDetails = buildSessionDetails(
|
|
1057
|
+
prepared.sessionDetailsUnsigned,
|
|
1058
|
+
signature
|
|
1058
1059
|
);
|
|
1059
1060
|
await service.registerAccount({
|
|
1060
1061
|
address: smartAccount,
|
|
1061
1062
|
accountParams: {
|
|
1062
|
-
factory:
|
|
1063
|
-
factoryData:
|
|
1063
|
+
factory: prepared.accountParams.factory,
|
|
1064
|
+
factoryData: prepared.accountParams.factoryData,
|
|
1064
1065
|
sessionDetails
|
|
1065
1066
|
},
|
|
1066
1067
|
eoaAddress: ownerAddress2,
|
|
@@ -1147,7 +1148,6 @@ function WithdrawFlow({
|
|
|
1147
1148
|
targetChain,
|
|
1148
1149
|
targetToken,
|
|
1149
1150
|
service,
|
|
1150
|
-
rhinestoneApiKey,
|
|
1151
1151
|
handleConnected,
|
|
1152
1152
|
asset.decimals,
|
|
1153
1153
|
safeAddress,
|
|
@@ -1156,7 +1156,8 @@ function WithdrawFlow({
|
|
|
1156
1156
|
onWithdrawSubmitted,
|
|
1157
1157
|
onRelayTransaction,
|
|
1158
1158
|
isSourceNative,
|
|
1159
|
-
handleError
|
|
1159
|
+
handleError,
|
|
1160
|
+
signSessionDetails
|
|
1160
1161
|
]
|
|
1161
1162
|
);
|
|
1162
1163
|
const handleWithdrawComplete = useCallback2(
|
|
@@ -1295,15 +1296,11 @@ function WithdrawFlow({
|
|
|
1295
1296
|
|
|
1296
1297
|
// src/WithdrawModal.tsx
|
|
1297
1298
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1298
|
-
var ReownWithdrawInner = lazy(
|
|
1299
|
-
() => import("./WithdrawModalReown-ICP3DH6Q.mjs").then((m) => ({
|
|
1300
|
-
default: m.WithdrawModalReown
|
|
1301
|
-
}))
|
|
1302
|
-
);
|
|
1303
1299
|
function WithdrawModal(props) {
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1300
|
+
if (props.reownAppId) {
|
|
1301
|
+
throw new Error(
|
|
1302
|
+
'Reown support moved to "@rhinestone/deposit-modal/reown". Use that entrypoint when passing reownAppId.'
|
|
1303
|
+
);
|
|
1307
1304
|
}
|
|
1308
1305
|
return /* @__PURE__ */ jsx3(WithdrawModalInner, { ...props });
|
|
1309
1306
|
}
|
|
@@ -1323,7 +1320,6 @@ function WithdrawModalInner({
|
|
|
1323
1320
|
onClose,
|
|
1324
1321
|
inline,
|
|
1325
1322
|
backendUrl = DEFAULT_BACKEND_URL,
|
|
1326
|
-
rhinestoneApiKey,
|
|
1327
1323
|
signerAddress = DEFAULT_SIGNER_ADDRESS,
|
|
1328
1324
|
sessionChainIds,
|
|
1329
1325
|
forceRegister = false,
|
|
@@ -1492,7 +1488,6 @@ function WithdrawModalInner({
|
|
|
1492
1488
|
recipient,
|
|
1493
1489
|
amount: defaultAmount,
|
|
1494
1490
|
service,
|
|
1495
|
-
rhinestoneApiKey,
|
|
1496
1491
|
signerAddress,
|
|
1497
1492
|
sessionChainIds,
|
|
1498
1493
|
forceRegister,
|