@rhinestone/deposit-modal 0.1.26 → 0.1.28
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/dist/{DepositModalReown-NKDYLTKD.cjs → DepositModalReown-6IXFIXR6.cjs} +3 -3
- package/dist/{DepositModalReown-4WZF2HMJ.mjs → DepositModalReown-FF4YU5VV.mjs} +2 -2
- package/dist/{WithdrawModalReown-GL4TM22D.cjs → WithdrawModalReown-GMIE6AWA.cjs} +3 -3
- package/dist/{WithdrawModalReown-244RQ5FZ.mjs → WithdrawModalReown-LIYQG2BW.mjs} +2 -2
- package/dist/{chunk-4WULBRUA.cjs → chunk-LP6DQCKV.cjs} +67 -76
- package/dist/{chunk-3FK5FAUL.mjs → chunk-RQSAANC3.mjs} +74 -224
- package/dist/{chunk-4Q6QCALP.cjs → chunk-VW3QQWEL.cjs} +96 -246
- package/dist/{chunk-DJAUNNEW.mjs → chunk-XF7M4TTT.mjs} +32 -41
- package/dist/{chunk-7QCFFKB5.cjs → chunk-XJ4G6RO6.cjs} +122 -141
- package/dist/{chunk-W42B54IA.mjs → chunk-YXTWMYHK.mjs} +34 -53
- package/dist/deposit.cjs +3 -3
- package/dist/deposit.mjs +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.mjs +3 -3
- package/dist/reown.cjs +4 -4
- package/dist/reown.mjs +3 -3
- package/dist/withdraw.cjs +3 -3
- package/dist/withdraw.mjs +2 -2
- package/package.json +1 -2
|
@@ -7,10 +7,9 @@ import {
|
|
|
7
7
|
Spinner,
|
|
8
8
|
accountFromPrivateKey,
|
|
9
9
|
applyTheme,
|
|
10
|
+
buildSessionDetails,
|
|
10
11
|
createDepositService,
|
|
11
12
|
createSessionOwnerKey,
|
|
12
|
-
createSmartAccount,
|
|
13
|
-
createViewOnlyAccount,
|
|
14
13
|
currencyFormatter,
|
|
15
14
|
formatUserError,
|
|
16
15
|
getAssetId,
|
|
@@ -21,11 +20,9 @@ import {
|
|
|
21
20
|
loadSessionOwnerFromStorage,
|
|
22
21
|
portfolioToAssets,
|
|
23
22
|
saveSessionOwnerToStorage,
|
|
24
|
-
signSessionDetails,
|
|
25
23
|
tokenFormatter
|
|
26
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-RQSAANC3.mjs";
|
|
27
25
|
import {
|
|
28
|
-
CHAIN_BY_ID,
|
|
29
26
|
DEFAULT_BACKEND_URL,
|
|
30
27
|
DEFAULT_SIGNER_ADDRESS,
|
|
31
28
|
NATIVE_TOKEN_ADDRESS,
|
|
@@ -57,7 +54,6 @@ import { useState as useState7, useCallback as useCallback3, useMemo as useMemo6
|
|
|
57
54
|
|
|
58
55
|
// src/components/steps/SetupStep.tsx
|
|
59
56
|
import { useState, useEffect, useRef, useCallback } from "react";
|
|
60
|
-
import { walletClientToAccount } from "@rhinestone/sdk";
|
|
61
57
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
62
58
|
async function resolveSessionOwner(eoaAddress) {
|
|
63
59
|
const localOwner = loadSessionOwnerFromStorage(eoaAddress);
|
|
@@ -78,9 +74,7 @@ function SetupStep({
|
|
|
78
74
|
walletClient,
|
|
79
75
|
address,
|
|
80
76
|
targetChain,
|
|
81
|
-
targetChainObj,
|
|
82
77
|
targetToken,
|
|
83
|
-
rhinestoneApiKey,
|
|
84
78
|
signerAddress,
|
|
85
79
|
sessionChainIds,
|
|
86
80
|
recipient,
|
|
@@ -93,7 +87,7 @@ function SetupStep({
|
|
|
93
87
|
const [state, setState] = useState({ type: "idle" });
|
|
94
88
|
const setupInitiatedRef = useRef(false);
|
|
95
89
|
const runSetup = useCallback(async () => {
|
|
96
|
-
if (!address
|
|
90
|
+
if (!address) {
|
|
97
91
|
return;
|
|
98
92
|
}
|
|
99
93
|
if (walletClient && !walletClient.account) {
|
|
@@ -102,44 +96,43 @@ function SetupStep({
|
|
|
102
96
|
try {
|
|
103
97
|
setState({ type: "creating-account" });
|
|
104
98
|
const sessionOwner = await resolveSessionOwner(address);
|
|
105
|
-
const
|
|
99
|
+
const setup = await service.setupAccount({
|
|
106
100
|
ownerAddress: address,
|
|
107
101
|
sessionOwnerAddress: sessionOwner.address,
|
|
108
102
|
targetChain,
|
|
109
103
|
targetToken,
|
|
110
104
|
signerAddress,
|
|
111
|
-
sessionChainIds
|
|
105
|
+
sessionChainIds,
|
|
106
|
+
forceRegister
|
|
112
107
|
});
|
|
113
|
-
const smartAccount =
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
setState({ type: "ready", smartAccount });
|
|
120
|
-
onConnected?.(address, smartAccount);
|
|
121
|
-
onSetupComplete(smartAccount);
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
108
|
+
const smartAccount = setup.smartAccount;
|
|
109
|
+
if (!setup.needsRegistration) {
|
|
110
|
+
setState({ type: "ready", smartAccount });
|
|
111
|
+
onConnected?.(address, smartAccount);
|
|
112
|
+
onSetupComplete(smartAccount);
|
|
113
|
+
return;
|
|
124
114
|
}
|
|
125
115
|
setState({ type: "signing-session" });
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
116
|
+
if (!setup.accountParams || !setup.sessionDetailsUnsigned) {
|
|
117
|
+
throw new Error("Missing registration payload from setup-account");
|
|
118
|
+
}
|
|
119
|
+
if (!sessionOwner.account.signTypedData) {
|
|
120
|
+
throw new Error("Session owner account does not support signTypedData");
|
|
121
|
+
}
|
|
122
|
+
const typedData = setup.sessionDetailsUnsigned.data;
|
|
123
|
+
const signature = await sessionOwner.account.signTypedData({
|
|
124
|
+
domain: typedData.domain,
|
|
125
|
+
types: typedData.types,
|
|
126
|
+
primaryType: typedData.primaryType,
|
|
127
|
+
message: typedData.message
|
|
128
|
+
});
|
|
129
|
+
const sessionDetails = buildSessionDetails(setup.sessionDetailsUnsigned, signature);
|
|
137
130
|
setState({ type: "registering" });
|
|
138
131
|
await service.registerAccount({
|
|
139
132
|
address: smartAccount,
|
|
140
133
|
accountParams: {
|
|
141
|
-
factory:
|
|
142
|
-
factoryData:
|
|
134
|
+
factory: setup.accountParams.factory,
|
|
135
|
+
factoryData: setup.accountParams.factoryData,
|
|
143
136
|
sessionDetails
|
|
144
137
|
},
|
|
145
138
|
eoaAddress: address,
|
|
@@ -161,10 +154,8 @@ function SetupStep({
|
|
|
161
154
|
}, [
|
|
162
155
|
address,
|
|
163
156
|
walletClient,
|
|
164
|
-
targetChainObj,
|
|
165
157
|
targetChain,
|
|
166
158
|
targetToken,
|
|
167
|
-
rhinestoneApiKey,
|
|
168
159
|
signerAddress,
|
|
169
160
|
sessionChainIds,
|
|
170
161
|
recipient,
|
|
@@ -176,11 +167,11 @@ function SetupStep({
|
|
|
176
167
|
]);
|
|
177
168
|
useEffect(() => {
|
|
178
169
|
const hasWallet = walletClient ? Boolean(walletClient.account) : true;
|
|
179
|
-
if (address && hasWallet &&
|
|
170
|
+
if (address && hasWallet && !setupInitiatedRef.current && state.type === "idle") {
|
|
180
171
|
setupInitiatedRef.current = true;
|
|
181
172
|
runSetup();
|
|
182
173
|
}
|
|
183
|
-
}, [address, walletClient,
|
|
174
|
+
}, [address, walletClient, state.type, runSetup]);
|
|
184
175
|
const handleRetry = () => {
|
|
185
176
|
setupInitiatedRef.current = false;
|
|
186
177
|
setState({ type: "idle" });
|
|
@@ -189,8 +180,6 @@ function SetupStep({
|
|
|
189
180
|
switch (state.type) {
|
|
190
181
|
case "idle":
|
|
191
182
|
return "Preparing...";
|
|
192
|
-
case "checking":
|
|
193
|
-
return "Verifying your account...";
|
|
194
183
|
case "creating-account":
|
|
195
184
|
return "Preparing your deposit account...";
|
|
196
185
|
case "signing-session":
|
|
@@ -203,7 +192,7 @@ function SetupStep({
|
|
|
203
192
|
return state.message;
|
|
204
193
|
}
|
|
205
194
|
};
|
|
206
|
-
const isLoading = state.type === "idle" || state.type === "
|
|
195
|
+
const isLoading = state.type === "idle" || state.type === "creating-account" || state.type === "signing-session" || state.type === "registering";
|
|
207
196
|
const isError = state.type === "error";
|
|
208
197
|
return /* @__PURE__ */ jsxs("div", { className: "rs-step", children: [
|
|
209
198
|
/* @__PURE__ */ jsxs("div", { className: "rs-loading-state", children: [
|
|
@@ -1652,7 +1641,6 @@ function DepositFlow({
|
|
|
1652
1641
|
sourceToken: defaultSourceToken,
|
|
1653
1642
|
amount: defaultAmount,
|
|
1654
1643
|
recipient,
|
|
1655
|
-
rhinestoneApiKey,
|
|
1656
1644
|
signerAddress = DEFAULT_SIGNER_ADDRESS,
|
|
1657
1645
|
sessionChainIds,
|
|
1658
1646
|
forceRegister = false,
|
|
@@ -1677,7 +1665,6 @@ function DepositFlow({
|
|
|
1677
1665
|
const [totalBalanceUsd, setTotalBalanceUsd] = useState7(0);
|
|
1678
1666
|
const [isConnectSelectionConfirmed, setIsConnectSelectionConfirmed] = useState7(false);
|
|
1679
1667
|
const [selectedConnectAddress, setSelectedConnectAddress] = useState7(null);
|
|
1680
|
-
const targetChainObj = useMemo6(() => CHAIN_BY_ID[targetChain], [targetChain]);
|
|
1681
1668
|
const dappSwitchChain = useMemo6(() => {
|
|
1682
1669
|
if (!dappWalletClient?.switchChain) return void 0;
|
|
1683
1670
|
return async (chainId) => {
|
|
@@ -1970,14 +1957,12 @@ function DepositFlow({
|
|
|
1970
1957
|
if (isDepositAddressMode) {
|
|
1971
1958
|
if (!dappAddress || !sessionKeyAddress) return null;
|
|
1972
1959
|
return /* @__PURE__ */ jsxs7("div", { className: "rs-modal-body", children: [
|
|
1973
|
-
step.type === "setup" &&
|
|
1960
|
+
step.type === "setup" && /* @__PURE__ */ jsx7(
|
|
1974
1961
|
SetupStep,
|
|
1975
1962
|
{
|
|
1976
1963
|
address: sessionKeyAddress,
|
|
1977
1964
|
targetChain,
|
|
1978
|
-
targetChainObj,
|
|
1979
1965
|
targetToken,
|
|
1980
|
-
rhinestoneApiKey,
|
|
1981
1966
|
signerAddress,
|
|
1982
1967
|
sessionChainIds,
|
|
1983
1968
|
recipient,
|
|
@@ -2032,15 +2017,13 @@ function DepositFlow({
|
|
|
2032
2017
|
return getPublicClient(chainId);
|
|
2033
2018
|
};
|
|
2034
2019
|
return /* @__PURE__ */ jsxs7("div", { className: "rs-modal-body", children: [
|
|
2035
|
-
step.type === "setup" &&
|
|
2020
|
+
step.type === "setup" && /* @__PURE__ */ jsx7(
|
|
2036
2021
|
SetupStep,
|
|
2037
2022
|
{
|
|
2038
2023
|
walletClient: signerContext.walletClient,
|
|
2039
2024
|
address: ownerAddress,
|
|
2040
2025
|
targetChain,
|
|
2041
|
-
targetChainObj,
|
|
2042
2026
|
targetToken,
|
|
2043
|
-
rhinestoneApiKey,
|
|
2044
2027
|
signerAddress,
|
|
2045
2028
|
sessionChainIds,
|
|
2046
2029
|
recipient,
|
|
@@ -2122,7 +2105,7 @@ function DepositFlow({
|
|
|
2122
2105
|
// src/DepositModal.tsx
|
|
2123
2106
|
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2124
2107
|
var ReownDepositInner = lazy(
|
|
2125
|
-
() => import("./DepositModalReown-
|
|
2108
|
+
() => import("./DepositModalReown-FF4YU5VV.mjs").then((m) => ({ default: m.DepositModalReown }))
|
|
2126
2109
|
);
|
|
2127
2110
|
function DepositModal(props) {
|
|
2128
2111
|
const needsReown = !!props.reownAppId;
|
|
@@ -2146,7 +2129,6 @@ function DepositModalInner({
|
|
|
2146
2129
|
defaultAmount,
|
|
2147
2130
|
recipient,
|
|
2148
2131
|
backendUrl = DEFAULT_BACKEND_URL,
|
|
2149
|
-
rhinestoneApiKey,
|
|
2150
2132
|
signerAddress = DEFAULT_SIGNER_ADDRESS,
|
|
2151
2133
|
sessionChainIds,
|
|
2152
2134
|
forceRegister = false,
|
|
@@ -2316,7 +2298,6 @@ function DepositModalInner({
|
|
|
2316
2298
|
sourceToken,
|
|
2317
2299
|
amount: defaultAmount,
|
|
2318
2300
|
recipient,
|
|
2319
|
-
rhinestoneApiKey,
|
|
2320
2301
|
signerAddress,
|
|
2321
2302
|
sessionChainIds,
|
|
2322
2303
|
forceRegister,
|
package/dist/deposit.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var _chunkXJ4G6RO6cjs = require('./chunk-XJ4G6RO6.cjs');
|
|
4
|
+
require('./chunk-VW3QQWEL.cjs');
|
|
5
5
|
require('./chunk-CEIWN53N.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
exports.DepositModal =
|
|
8
|
+
exports.DepositModal = _chunkXJ4G6RO6cjs.DepositModal;
|
package/dist/deposit.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkXJ4G6RO6cjs = require('./chunk-XJ4G6RO6.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
7
|
-
require('./chunk-
|
|
6
|
+
var _chunkLP6DQCKVcjs = require('./chunk-LP6DQCKV.cjs');
|
|
7
|
+
require('./chunk-VW3QQWEL.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -64,4 +64,4 @@ var _chunkCEIWN53Ncjs = require('./chunk-CEIWN53N.cjs');
|
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
|
|
67
|
-
exports.CHAIN_BY_ID = _chunkCEIWN53Ncjs.CHAIN_BY_ID; exports.DEFAULT_BACKEND_URL = _chunkCEIWN53Ncjs.DEFAULT_BACKEND_URL; exports.DEFAULT_SIGNER_ADDRESS = _chunkCEIWN53Ncjs.DEFAULT_SIGNER_ADDRESS; exports.DepositModal =
|
|
67
|
+
exports.CHAIN_BY_ID = _chunkCEIWN53Ncjs.CHAIN_BY_ID; exports.DEFAULT_BACKEND_URL = _chunkCEIWN53Ncjs.DEFAULT_BACKEND_URL; exports.DEFAULT_SIGNER_ADDRESS = _chunkCEIWN53Ncjs.DEFAULT_SIGNER_ADDRESS; exports.DepositModal = _chunkXJ4G6RO6cjs.DepositModal; exports.NATIVE_TOKEN_ADDRESS = _chunkCEIWN53Ncjs.NATIVE_TOKEN_ADDRESS; exports.SOURCE_CHAINS = _chunkCEIWN53Ncjs.SOURCE_CHAINS; exports.SUPPORTED_CHAINS = _chunkCEIWN53Ncjs.SUPPORTED_CHAINS; exports.WithdrawModal = _chunkLP6DQCKVcjs.WithdrawModal; exports.chainRegistry = _chunkCEIWN53Ncjs.chainRegistry; exports.findChainIdForToken = _chunkCEIWN53Ncjs.findChainIdForToken; exports.getChainBadge = _chunkCEIWN53Ncjs.getChainBadge; exports.getChainIcon = _chunkCEIWN53Ncjs.getChainIcon; exports.getChainId = _chunkCEIWN53Ncjs.getChainId; exports.getChainName = _chunkCEIWN53Ncjs.getChainName; exports.getChainObject = _chunkCEIWN53Ncjs.getChainObject; exports.getExplorerName = _chunkCEIWN53Ncjs.getExplorerName; exports.getExplorerTxUrl = _chunkCEIWN53Ncjs.getExplorerTxUrl; exports.getExplorerUrl = _chunkCEIWN53Ncjs.getExplorerUrl; exports.getSupportedChainIds = _chunkCEIWN53Ncjs.getSupportedChainIds; exports.getSupportedTargetTokens = _chunkCEIWN53Ncjs.getSupportedTargetTokens; exports.getSupportedTokenSymbolsForChain = _chunkCEIWN53Ncjs.getSupportedTokenSymbolsForChain; exports.getTokenAddress = _chunkCEIWN53Ncjs.getTokenAddress; exports.getTokenDecimals = _chunkCEIWN53Ncjs.getTokenDecimals; exports.getTokenDecimalsByAddress = _chunkCEIWN53Ncjs.getTokenDecimalsByAddress; exports.getTokenIcon = _chunkCEIWN53Ncjs.getTokenIcon; exports.getTokenSymbol = _chunkCEIWN53Ncjs.getTokenSymbol; exports.getUsdcAddress = _chunkCEIWN53Ncjs.getUsdcAddress; exports.getUsdcDecimals = _chunkCEIWN53Ncjs.getUsdcDecimals; exports.isSupportedTokenAddressForChain = _chunkCEIWN53Ncjs.isSupportedTokenAddressForChain;
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DepositModal
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YXTWMYHK.mjs";
|
|
4
4
|
import {
|
|
5
5
|
WithdrawModal
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-XF7M4TTT.mjs";
|
|
7
|
+
import "./chunk-RQSAANC3.mjs";
|
|
8
8
|
import {
|
|
9
9
|
CHAIN_BY_ID,
|
|
10
10
|
DEFAULT_BACKEND_URL,
|
package/dist/reown.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkXJ4G6RO6cjs = require('./chunk-XJ4G6RO6.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
7
|
-
require('./chunk-
|
|
6
|
+
var _chunkLP6DQCKVcjs = require('./chunk-LP6DQCKV.cjs');
|
|
7
|
+
require('./chunk-VW3QQWEL.cjs');
|
|
8
8
|
require('./chunk-CEIWN53N.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.DepositModal =
|
|
12
|
+
exports.DepositModal = _chunkXJ4G6RO6cjs.DepositModal; exports.WithdrawModal = _chunkLP6DQCKVcjs.WithdrawModal;
|
package/dist/reown.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DepositModal
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YXTWMYHK.mjs";
|
|
4
4
|
import {
|
|
5
5
|
WithdrawModal
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-XF7M4TTT.mjs";
|
|
7
|
+
import "./chunk-RQSAANC3.mjs";
|
|
8
8
|
import "./chunk-A6QLADED.mjs";
|
|
9
9
|
export {
|
|
10
10
|
DepositModal,
|
package/dist/withdraw.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var _chunkLP6DQCKVcjs = require('./chunk-LP6DQCKV.cjs');
|
|
4
|
+
require('./chunk-VW3QQWEL.cjs');
|
|
5
5
|
require('./chunk-CEIWN53N.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
exports.WithdrawModal =
|
|
8
|
+
exports.WithdrawModal = _chunkLP6DQCKVcjs.WithdrawModal;
|
package/dist/withdraw.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhinestone/deposit-modal",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.28",
|
|
4
4
|
"description": "React modal component for Rhinestone cross-chain deposits",
|
|
5
5
|
"author": "Rhinestone <dev@rhinestone.wtf>",
|
|
6
6
|
"bugs": {
|
|
@@ -65,7 +65,6 @@
|
|
|
65
65
|
"viem": ">=2"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@rhinestone/sdk": "^1.2.14",
|
|
69
68
|
"@rhinestone/shared-configs": "^1.4.93",
|
|
70
69
|
"@reown/appkit": "^1.8.17",
|
|
71
70
|
"@reown/appkit-adapter-wagmi": "^1.8.17",
|