@rhinestone/deposit-modal 0.1.27 → 0.1.29
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-NGYZ4G7Q.cjs → DepositModalReown-4PFOMSC6.cjs} +4 -4
- package/dist/{DepositModalReown-PFKTSKDS.mjs → DepositModalReown-BVHWFWIG.mjs} +3 -3
- package/dist/{WithdrawModalReown-6AAWH35J.mjs → WithdrawModalReown-CJCNT7SA.mjs} +3 -3
- package/dist/{WithdrawModalReown-BA6ECON3.cjs → WithdrawModalReown-YREQR7DV.cjs} +4 -4
- package/dist/{chunk-7MQU2SR7.cjs → chunk-5QJNOPNF.cjs} +164 -171
- package/dist/{chunk-QWYZJL3L.cjs → chunk-7ZCUANBT.cjs} +40 -61
- package/dist/{chunk-XIS33BZ6.cjs → chunk-CPIQJR47.cjs} +82 -87
- package/dist/{chunk-A6QLADED.mjs → chunk-CSQRKM4Y.mjs} +123 -2
- package/dist/{chunk-CEIWN53N.cjs → chunk-DLYVHOME.cjs} +130 -9
- package/dist/{chunk-QCRZCGAE.mjs → chunk-K6YG3I6O.mjs} +21 -26
- package/dist/{chunk-YOFGP4FV.mjs → chunk-N6T4TKXI.mjs} +12 -33
- package/dist/{chunk-AJALMXW4.mjs → chunk-XTTTHW3W.mjs} +22 -29
- package/dist/constants.cjs +2 -2
- package/dist/constants.d.cts +11 -2
- package/dist/constants.d.ts +11 -2
- package/dist/constants.mjs +1 -1
- package/dist/deposit.cjs +4 -4
- package/dist/deposit.mjs +3 -3
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.mjs +4 -4
- package/dist/reown.cjs +5 -5
- package/dist/reown.mjs +4 -4
- package/dist/withdraw.cjs +4 -4
- package/dist/withdraw.mjs +3 -3
- package/package.json +56 -9
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _chains = require('viem/chains');
|
|
10
|
-
var _sharedconfigs = require('@rhinestone/shared-configs');
|
|
11
10
|
var DEFAULT_BACKEND_URL = "https://v1.orchestrator.rhinestone.dev/deposit-widget";
|
|
12
11
|
var DEFAULT_SIGNER_ADDRESS = "0x177bfcdd15bc01e99013dcc5d2b09cd87a18ce9c";
|
|
13
12
|
var NATIVE_TOKEN_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
@@ -61,6 +60,128 @@ var SYMBOL_ALIASES = {
|
|
|
61
60
|
var CANONICAL_SYMBOL_BY_REGISTRY_SYMBOL = {
|
|
62
61
|
USDT0: "USDT"
|
|
63
62
|
};
|
|
63
|
+
var chainRegistry = {
|
|
64
|
+
[_chains.mainnet.id]: {
|
|
65
|
+
name: _chains.mainnet.name,
|
|
66
|
+
tokens: [
|
|
67
|
+
{ symbol: "ETH", address: NATIVE_TOKEN_ADDRESS, decimals: 18 },
|
|
68
|
+
{
|
|
69
|
+
symbol: "USDC",
|
|
70
|
+
address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
71
|
+
decimals: 6
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
symbol: "WETH",
|
|
75
|
+
address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
|
76
|
+
decimals: 18
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
symbol: "USDT0",
|
|
80
|
+
address: "0xdac17f958d2ee523a2206206994597c13d831ec7",
|
|
81
|
+
decimals: 6
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
[_chains.base.id]: {
|
|
86
|
+
name: _chains.base.name,
|
|
87
|
+
tokens: [
|
|
88
|
+
{ symbol: "ETH", address: NATIVE_TOKEN_ADDRESS, decimals: 18 },
|
|
89
|
+
{
|
|
90
|
+
symbol: "USDC",
|
|
91
|
+
address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
92
|
+
decimals: 6
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
symbol: "WETH",
|
|
96
|
+
address: "0x4200000000000000000000000000000000000006",
|
|
97
|
+
decimals: 18
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
[_chains.arbitrum.id]: {
|
|
102
|
+
name: _chains.arbitrum.name,
|
|
103
|
+
tokens: [
|
|
104
|
+
{ symbol: "ETH", address: NATIVE_TOKEN_ADDRESS, decimals: 18 },
|
|
105
|
+
{
|
|
106
|
+
symbol: "USDC",
|
|
107
|
+
address: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
108
|
+
decimals: 6
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
symbol: "WETH",
|
|
112
|
+
address: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
|
|
113
|
+
decimals: 18
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
symbol: "USDT0",
|
|
117
|
+
address: "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",
|
|
118
|
+
decimals: 6
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
},
|
|
122
|
+
[_chains.optimism.id]: {
|
|
123
|
+
name: _chains.optimism.name,
|
|
124
|
+
tokens: [
|
|
125
|
+
{ symbol: "ETH", address: NATIVE_TOKEN_ADDRESS, decimals: 18 },
|
|
126
|
+
{
|
|
127
|
+
symbol: "USDC",
|
|
128
|
+
address: "0x0b2c639c533813f4aa9d7837caf62653d097ff85",
|
|
129
|
+
decimals: 6
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
symbol: "WETH",
|
|
133
|
+
address: "0x4200000000000000000000000000000000000006",
|
|
134
|
+
decimals: 18
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
symbol: "USDT0",
|
|
138
|
+
address: "0x01bFF41798a0BcF287b996046Ca68b395DbC1071",
|
|
139
|
+
decimals: 6
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
},
|
|
143
|
+
[_chains.polygon.id]: {
|
|
144
|
+
name: _chains.polygon.name,
|
|
145
|
+
tokens: [
|
|
146
|
+
{ symbol: "ETH", address: NATIVE_TOKEN_ADDRESS, decimals: 18 },
|
|
147
|
+
{
|
|
148
|
+
symbol: "USDC",
|
|
149
|
+
address: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
|
|
150
|
+
decimals: 6
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
symbol: "WETH",
|
|
154
|
+
address: "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",
|
|
155
|
+
decimals: 18
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
symbol: "USDT0",
|
|
159
|
+
address: "0xc2132d05d31c914a87c6611c10748aeb04b58e8f",
|
|
160
|
+
decimals: 6
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
[_chains.bsc.id]: {
|
|
165
|
+
name: _chains.bsc.name,
|
|
166
|
+
tokens: [
|
|
167
|
+
{
|
|
168
|
+
symbol: "USDC",
|
|
169
|
+
address: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
|
|
170
|
+
decimals: 18
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
symbol: "WETH",
|
|
174
|
+
address: "0x2170Ed0880ac9A755fd29B2688956BD959F933F8",
|
|
175
|
+
decimals: 18
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
symbol: "USDT",
|
|
179
|
+
address: "0x55d398326f99059fF775485246999027B3197955",
|
|
180
|
+
decimals: 18
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
};
|
|
64
185
|
function getChainId(chain) {
|
|
65
186
|
return typeof chain === "number" ? chain : chain.id;
|
|
66
187
|
}
|
|
@@ -85,7 +206,7 @@ function isSymbolSupportedOnChain(symbol, chainId) {
|
|
|
85
206
|
return symbols.includes(normalizeTokenSymbol(symbol));
|
|
86
207
|
}
|
|
87
208
|
function getTokenFromRegistry(chainId, symbol) {
|
|
88
|
-
const chainEntry =
|
|
209
|
+
const chainEntry = chainRegistry[String(chainId)];
|
|
89
210
|
if (!chainEntry) return void 0;
|
|
90
211
|
const normalized = normalizeTokenSymbol(symbol);
|
|
91
212
|
const candidates = _nullishCoalesce(SYMBOL_ALIASES[normalized], () => ( [normalized]));
|
|
@@ -166,7 +287,7 @@ function getTokenDecimalsByAddress(token, chainId) {
|
|
|
166
287
|
return 18;
|
|
167
288
|
}
|
|
168
289
|
if (chainId) {
|
|
169
|
-
const chainEntry =
|
|
290
|
+
const chainEntry = chainRegistry[String(chainId)];
|
|
170
291
|
if (chainEntry) {
|
|
171
292
|
const found = chainEntry.tokens.find(
|
|
172
293
|
(t) => t.address.toLowerCase() === normalized
|
|
@@ -174,7 +295,7 @@ function getTokenDecimalsByAddress(token, chainId) {
|
|
|
174
295
|
if (found) return found.decimals;
|
|
175
296
|
}
|
|
176
297
|
}
|
|
177
|
-
for (const chainEntry of Object.values(
|
|
298
|
+
for (const chainEntry of Object.values(chainRegistry)) {
|
|
178
299
|
const found = chainEntry.tokens.find(
|
|
179
300
|
(t) => t.address.toLowerCase() === normalized
|
|
180
301
|
);
|
|
@@ -184,7 +305,7 @@ function getTokenDecimalsByAddress(token, chainId) {
|
|
|
184
305
|
}
|
|
185
306
|
function findChainIdForToken(address) {
|
|
186
307
|
const normalized = address.toLowerCase();
|
|
187
|
-
for (const [chainIdStr, chainEntry] of Object.entries(
|
|
308
|
+
for (const [chainIdStr, chainEntry] of Object.entries(chainRegistry)) {
|
|
188
309
|
for (const token of chainEntry.tokens) {
|
|
189
310
|
if (token.address.toLowerCase() === normalized) {
|
|
190
311
|
return Number(chainIdStr);
|
|
@@ -199,7 +320,7 @@ function getTokenSymbol(token, chainId) {
|
|
|
199
320
|
return "ETH";
|
|
200
321
|
}
|
|
201
322
|
if (chainId) {
|
|
202
|
-
const chainEntry =
|
|
323
|
+
const chainEntry = chainRegistry[String(chainId)];
|
|
203
324
|
if (chainEntry) {
|
|
204
325
|
const found = chainEntry.tokens.find(
|
|
205
326
|
(t) => t.address.toLowerCase() === normalized
|
|
@@ -208,7 +329,7 @@ function getTokenSymbol(token, chainId) {
|
|
|
208
329
|
return _nullishCoalesce(CANONICAL_SYMBOL_BY_REGISTRY_SYMBOL[found.symbol.toUpperCase()], () => ( found.symbol));
|
|
209
330
|
}
|
|
210
331
|
}
|
|
211
|
-
for (const chainEntry of Object.values(
|
|
332
|
+
for (const chainEntry of Object.values(chainRegistry)) {
|
|
212
333
|
const found = chainEntry.tokens.find(
|
|
213
334
|
(t) => t.address.toLowerCase() === normalized
|
|
214
335
|
);
|
|
@@ -228,7 +349,7 @@ var CHAIN_BADGES = {
|
|
|
228
349
|
function getChainName(chainId) {
|
|
229
350
|
const chain = CHAIN_BY_ID[chainId];
|
|
230
351
|
if (chain) return chain.name;
|
|
231
|
-
const chainEntry =
|
|
352
|
+
const chainEntry = chainRegistry[String(chainId)];
|
|
232
353
|
if (chainEntry) return chainEntry.name;
|
|
233
354
|
return `Chain ${chainId}`;
|
|
234
355
|
}
|
|
@@ -301,4 +422,4 @@ function getTokenIcon(symbol) {
|
|
|
301
422
|
|
|
302
423
|
|
|
303
424
|
|
|
304
|
-
exports.
|
|
425
|
+
exports.DEFAULT_BACKEND_URL = DEFAULT_BACKEND_URL; exports.DEFAULT_SIGNER_ADDRESS = DEFAULT_SIGNER_ADDRESS; exports.NATIVE_TOKEN_ADDRESS = NATIVE_TOKEN_ADDRESS; exports.CHAIN_BY_ID = CHAIN_BY_ID; exports.SOURCE_CHAINS = SOURCE_CHAINS; exports.SUPPORTED_CHAINS = SUPPORTED_CHAINS; exports.chainRegistry = chainRegistry; exports.getChainId = getChainId; exports.getChainObject = getChainObject; exports.getUsdcAddress = getUsdcAddress; exports.getUsdcDecimals = getUsdcDecimals; exports.getTokenAddress = getTokenAddress; exports.getTokenDecimals = getTokenDecimals; exports.getSupportedTokenSymbolsForChain = getSupportedTokenSymbolsForChain; exports.getSupportedChainIds = getSupportedChainIds; exports.isSupportedTokenAddressForChain = isSupportedTokenAddressForChain; exports.getSupportedTargetTokens = getSupportedTargetTokens; exports.getTokenDecimalsByAddress = getTokenDecimalsByAddress; exports.findChainIdForToken = findChainIdForToken; exports.getTokenSymbol = getTokenSymbol; exports.getChainName = getChainName; exports.getChainBadge = getChainBadge; exports.getExplorerUrl = getExplorerUrl; exports.getExplorerTxUrl = getExplorerTxUrl; exports.getExplorerName = getExplorerName; exports.getChainIcon = getChainIcon; exports.getTokenIcon = getTokenIcon;
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
isNativeAsset,
|
|
17
17
|
loadSessionOwnerFromStorage,
|
|
18
18
|
saveSessionOwnerToStorage
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-N6T4TKXI.mjs";
|
|
20
20
|
import {
|
|
21
21
|
DEFAULT_BACKEND_URL,
|
|
22
22
|
DEFAULT_SIGNER_ADDRESS,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
getTokenDecimalsByAddress,
|
|
30
30
|
getTokenIcon,
|
|
31
31
|
getTokenSymbol
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-CSQRKM4Y.mjs";
|
|
33
33
|
|
|
34
34
|
// src/WithdrawModal.tsx
|
|
35
35
|
import {
|
|
@@ -1024,23 +1024,21 @@ function WithdrawFlow({
|
|
|
1024
1024
|
setIsSubmitting(true);
|
|
1025
1025
|
try {
|
|
1026
1026
|
const sessionOwner = await resolveSessionOwner(ownerAddress2);
|
|
1027
|
-
const
|
|
1028
|
-
ownerAddress2,
|
|
1029
|
-
sessionOwner.address
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
});
|
|
1043
|
-
const typedData = prepared.sessionDetailsUnsigned.data;
|
|
1027
|
+
const setup = await service.setupAccount({
|
|
1028
|
+
ownerAddress: ownerAddress2,
|
|
1029
|
+
sessionOwnerAddress: sessionOwner.address,
|
|
1030
|
+
targetChain,
|
|
1031
|
+
targetToken,
|
|
1032
|
+
signerAddress,
|
|
1033
|
+
sessionChainIds,
|
|
1034
|
+
forceRegister
|
|
1035
|
+
});
|
|
1036
|
+
const smartAccount = setup.smartAccount;
|
|
1037
|
+
if (setup.needsRegistration) {
|
|
1038
|
+
if (!setup.accountParams || !setup.sessionDetailsUnsigned) {
|
|
1039
|
+
throw new Error("Missing registration payload from setup-account");
|
|
1040
|
+
}
|
|
1041
|
+
const typedData = setup.sessionDetailsUnsigned.data;
|
|
1044
1042
|
if (!sessionOwner.account.signTypedData) {
|
|
1045
1043
|
throw new Error(
|
|
1046
1044
|
"Session owner account does not support signTypedData"
|
|
@@ -1052,15 +1050,12 @@ function WithdrawFlow({
|
|
|
1052
1050
|
primaryType: typedData.primaryType,
|
|
1053
1051
|
message: typedData.message
|
|
1054
1052
|
});
|
|
1055
|
-
const sessionDetails = buildSessionDetails(
|
|
1056
|
-
prepared.sessionDetailsUnsigned,
|
|
1057
|
-
signature
|
|
1058
|
-
);
|
|
1053
|
+
const sessionDetails = buildSessionDetails(setup.sessionDetailsUnsigned, signature);
|
|
1059
1054
|
await service.registerAccount({
|
|
1060
1055
|
address: smartAccount,
|
|
1061
1056
|
accountParams: {
|
|
1062
|
-
factory:
|
|
1063
|
-
factoryData:
|
|
1057
|
+
factory: setup.accountParams.factory,
|
|
1058
|
+
factoryData: setup.accountParams.factoryData,
|
|
1064
1059
|
sessionDetails
|
|
1065
1060
|
},
|
|
1066
1061
|
eoaAddress: ownerAddress2,
|
|
@@ -1305,7 +1300,7 @@ function WithdrawFlow({
|
|
|
1305
1300
|
// src/WithdrawModal.tsx
|
|
1306
1301
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1307
1302
|
var ReownWithdrawInner = lazy(
|
|
1308
|
-
() => import("./WithdrawModalReown-
|
|
1303
|
+
() => import("./WithdrawModalReown-CJCNT7SA.mjs").then((m) => ({
|
|
1309
1304
|
default: m.WithdrawModalReown
|
|
1310
1305
|
}))
|
|
1311
1306
|
);
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
getTokenDecimalsByAddress,
|
|
9
9
|
getTokenSymbol,
|
|
10
10
|
isSupportedTokenAddressForChain
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-CSQRKM4Y.mjs";
|
|
12
12
|
|
|
13
13
|
// src/components/ui/Modal.tsx
|
|
14
14
|
import {
|
|
@@ -180,12 +180,16 @@ function normalizeSessionTypedData(raw) {
|
|
|
180
180
|
}
|
|
181
181
|
return data;
|
|
182
182
|
}
|
|
183
|
-
function
|
|
183
|
+
function normalizeSetupAccountResponse(raw) {
|
|
184
184
|
const data = raw;
|
|
185
185
|
return {
|
|
186
186
|
smartAccount: data.smartAccount,
|
|
187
|
+
isRegistered: data.isRegistered,
|
|
188
|
+
targetChain: data.targetChain,
|
|
189
|
+
targetToken: data.targetToken,
|
|
190
|
+
needsRegistration: data.needsRegistration,
|
|
187
191
|
accountParams: data.accountParams,
|
|
188
|
-
sessionDetailsUnsigned: {
|
|
192
|
+
sessionDetailsUnsigned: data.sessionDetailsUnsigned ? {
|
|
189
193
|
hashesAndChainIds: data.sessionDetailsUnsigned.hashesAndChainIds.map(
|
|
190
194
|
(h) => ({
|
|
191
195
|
chainId: toBigInt(h.chainId),
|
|
@@ -193,7 +197,7 @@ function normalizePrepareAccountResponse(raw) {
|
|
|
193
197
|
})
|
|
194
198
|
),
|
|
195
199
|
data: normalizeSessionTypedData(data.sessionDetailsUnsigned.data)
|
|
196
|
-
}
|
|
200
|
+
} : void 0
|
|
197
201
|
};
|
|
198
202
|
}
|
|
199
203
|
function buildSessionDetails(unsigned, signature) {
|
|
@@ -212,22 +216,8 @@ function createDepositService(baseUrl) {
|
|
|
212
216
|
return `${normalizedBaseUrl}${normalizedPath}`;
|
|
213
217
|
}
|
|
214
218
|
return {
|
|
215
|
-
async
|
|
216
|
-
const response = await fetch(apiUrl("/
|
|
217
|
-
method: "POST",
|
|
218
|
-
headers: { "Content-Type": "application/json" },
|
|
219
|
-
body: JSON.stringify({ ownerAddress, sessionOwnerAddress })
|
|
220
|
-
});
|
|
221
|
-
if (!response.ok) {
|
|
222
|
-
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
223
|
-
throw new Error(
|
|
224
|
-
error.error || `Compute address failed: ${response.status}`
|
|
225
|
-
);
|
|
226
|
-
}
|
|
227
|
-
return response.json();
|
|
228
|
-
},
|
|
229
|
-
async prepareAccount(params) {
|
|
230
|
-
const response = await fetch(apiUrl("/prepare-account"), {
|
|
219
|
+
async setupAccount(params) {
|
|
220
|
+
const response = await fetch(apiUrl("/setup-account"), {
|
|
231
221
|
method: "POST",
|
|
232
222
|
headers: { "Content-Type": "application/json" },
|
|
233
223
|
body: JSON.stringify(params)
|
|
@@ -235,10 +225,10 @@ function createDepositService(baseUrl) {
|
|
|
235
225
|
if (!response.ok) {
|
|
236
226
|
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
237
227
|
throw new Error(
|
|
238
|
-
error.error || `
|
|
228
|
+
error.error || `Setup account failed: ${response.status}`
|
|
239
229
|
);
|
|
240
230
|
}
|
|
241
|
-
return
|
|
231
|
+
return normalizeSetupAccountResponse(await response.json());
|
|
242
232
|
},
|
|
243
233
|
async registerAccount(params) {
|
|
244
234
|
const { eoaAddress, sessionOwner, ...account } = params;
|
|
@@ -262,17 +252,6 @@ function createDepositService(baseUrl) {
|
|
|
262
252
|
}
|
|
263
253
|
return response.json();
|
|
264
254
|
},
|
|
265
|
-
async checkAccount(address) {
|
|
266
|
-
const response = await fetch(apiUrl(`/check/${address}`), {
|
|
267
|
-
method: "GET",
|
|
268
|
-
headers: { "Content-Type": "application/json" }
|
|
269
|
-
});
|
|
270
|
-
if (!response.ok) {
|
|
271
|
-
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
272
|
-
throw new Error(error.error || `Check failed: ${response.status}`);
|
|
273
|
-
}
|
|
274
|
-
return response.json();
|
|
275
|
-
},
|
|
276
255
|
async fetchPortfolio(address) {
|
|
277
256
|
const response = await fetch(apiUrl(`/portfolio/${address}`), {
|
|
278
257
|
method: "GET",
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
portfolioToAssets,
|
|
22
22
|
saveSessionOwnerToStorage,
|
|
23
23
|
tokenFormatter
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-N6T4TKXI.mjs";
|
|
25
25
|
import {
|
|
26
26
|
DEFAULT_BACKEND_URL,
|
|
27
27
|
DEFAULT_SIGNER_ADDRESS,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
getTokenAddress,
|
|
37
37
|
getTokenIcon,
|
|
38
38
|
getTokenSymbol
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-CSQRKM4Y.mjs";
|
|
40
40
|
|
|
41
41
|
// src/DepositModal.tsx
|
|
42
42
|
import {
|
|
@@ -96,48 +96,43 @@ function SetupStep({
|
|
|
96
96
|
try {
|
|
97
97
|
setState({ type: "creating-account" });
|
|
98
98
|
const sessionOwner = await resolveSessionOwner(address);
|
|
99
|
-
const
|
|
100
|
-
const smartAccount = computed.smartAccount;
|
|
101
|
-
setState({ type: "checking" });
|
|
102
|
-
const checkResult = await service.checkAccount(smartAccount);
|
|
103
|
-
if (checkResult.isRegistered && !forceRegister) {
|
|
104
|
-
const targetMatches = checkResult.targetChain === targetChain && checkResult.targetToken?.toLowerCase() === targetToken.toLowerCase();
|
|
105
|
-
if (targetMatches) {
|
|
106
|
-
setState({ type: "ready", smartAccount });
|
|
107
|
-
onConnected?.(address, smartAccount);
|
|
108
|
-
onSetupComplete(smartAccount);
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
setState({ type: "signing-session" });
|
|
113
|
-
const prepared = await service.prepareAccount({
|
|
99
|
+
const setup = await service.setupAccount({
|
|
114
100
|
ownerAddress: address,
|
|
115
101
|
sessionOwnerAddress: sessionOwner.address,
|
|
116
102
|
targetChain,
|
|
117
103
|
targetToken,
|
|
118
104
|
signerAddress,
|
|
119
|
-
sessionChainIds
|
|
105
|
+
sessionChainIds,
|
|
106
|
+
forceRegister
|
|
120
107
|
});
|
|
108
|
+
const smartAccount = setup.smartAccount;
|
|
109
|
+
if (!setup.needsRegistration) {
|
|
110
|
+
setState({ type: "ready", smartAccount });
|
|
111
|
+
onConnected?.(address, smartAccount);
|
|
112
|
+
onSetupComplete(smartAccount);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
setState({ type: "signing-session" });
|
|
116
|
+
if (!setup.accountParams || !setup.sessionDetailsUnsigned) {
|
|
117
|
+
throw new Error("Missing registration payload from setup-account");
|
|
118
|
+
}
|
|
121
119
|
if (!sessionOwner.account.signTypedData) {
|
|
122
120
|
throw new Error("Session owner account does not support signTypedData");
|
|
123
121
|
}
|
|
124
|
-
const typedData =
|
|
122
|
+
const typedData = setup.sessionDetailsUnsigned.data;
|
|
125
123
|
const signature = await sessionOwner.account.signTypedData({
|
|
126
124
|
domain: typedData.domain,
|
|
127
125
|
types: typedData.types,
|
|
128
126
|
primaryType: typedData.primaryType,
|
|
129
127
|
message: typedData.message
|
|
130
128
|
});
|
|
131
|
-
const sessionDetails = buildSessionDetails(
|
|
132
|
-
prepared.sessionDetailsUnsigned,
|
|
133
|
-
signature
|
|
134
|
-
);
|
|
129
|
+
const sessionDetails = buildSessionDetails(setup.sessionDetailsUnsigned, signature);
|
|
135
130
|
setState({ type: "registering" });
|
|
136
131
|
await service.registerAccount({
|
|
137
132
|
address: smartAccount,
|
|
138
133
|
accountParams: {
|
|
139
|
-
factory:
|
|
140
|
-
factoryData:
|
|
134
|
+
factory: setup.accountParams.factory,
|
|
135
|
+
factoryData: setup.accountParams.factoryData,
|
|
141
136
|
sessionDetails
|
|
142
137
|
},
|
|
143
138
|
eoaAddress: address,
|
|
@@ -185,8 +180,6 @@ function SetupStep({
|
|
|
185
180
|
switch (state.type) {
|
|
186
181
|
case "idle":
|
|
187
182
|
return "Preparing...";
|
|
188
|
-
case "checking":
|
|
189
|
-
return "Verifying your account...";
|
|
190
183
|
case "creating-account":
|
|
191
184
|
return "Preparing your deposit account...";
|
|
192
185
|
case "signing-session":
|
|
@@ -199,7 +192,7 @@ function SetupStep({
|
|
|
199
192
|
return state.message;
|
|
200
193
|
}
|
|
201
194
|
};
|
|
202
|
-
const isLoading = state.type === "idle" || state.type === "
|
|
195
|
+
const isLoading = state.type === "idle" || state.type === "creating-account" || state.type === "signing-session" || state.type === "registering";
|
|
203
196
|
const isError = state.type === "error";
|
|
204
197
|
return /* @__PURE__ */ jsxs("div", { className: "rs-step", children: [
|
|
205
198
|
/* @__PURE__ */ jsxs("div", { className: "rs-loading-state", children: [
|
|
@@ -2112,7 +2105,7 @@ function DepositFlow({
|
|
|
2112
2105
|
// src/DepositModal.tsx
|
|
2113
2106
|
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2114
2107
|
var ReownDepositInner = lazy(
|
|
2115
|
-
() => import("./DepositModalReown-
|
|
2108
|
+
() => import("./DepositModalReown-BVHWFWIG.mjs").then((m) => ({ default: m.DepositModalReown }))
|
|
2116
2109
|
);
|
|
2117
2110
|
function DepositModal(props) {
|
|
2118
2111
|
const needsReown = !!props.reownAppId;
|
package/dist/constants.cjs
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
var
|
|
29
|
+
var _chunkDLYVHOMEcjs = require('./chunk-DLYVHOME.cjs');
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
|
@@ -55,4 +55,4 @@ var _chunkCEIWN53Ncjs = require('./chunk-CEIWN53N.cjs');
|
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
exports.CHAIN_BY_ID =
|
|
58
|
+
exports.CHAIN_BY_ID = _chunkDLYVHOMEcjs.CHAIN_BY_ID; exports.DEFAULT_BACKEND_URL = _chunkDLYVHOMEcjs.DEFAULT_BACKEND_URL; exports.DEFAULT_SIGNER_ADDRESS = _chunkDLYVHOMEcjs.DEFAULT_SIGNER_ADDRESS; exports.NATIVE_TOKEN_ADDRESS = _chunkDLYVHOMEcjs.NATIVE_TOKEN_ADDRESS; exports.SOURCE_CHAINS = _chunkDLYVHOMEcjs.SOURCE_CHAINS; exports.SUPPORTED_CHAINS = _chunkDLYVHOMEcjs.SUPPORTED_CHAINS; exports.chainRegistry = _chunkDLYVHOMEcjs.chainRegistry; exports.findChainIdForToken = _chunkDLYVHOMEcjs.findChainIdForToken; exports.getChainBadge = _chunkDLYVHOMEcjs.getChainBadge; exports.getChainIcon = _chunkDLYVHOMEcjs.getChainIcon; exports.getChainId = _chunkDLYVHOMEcjs.getChainId; exports.getChainName = _chunkDLYVHOMEcjs.getChainName; exports.getChainObject = _chunkDLYVHOMEcjs.getChainObject; exports.getExplorerName = _chunkDLYVHOMEcjs.getExplorerName; exports.getExplorerTxUrl = _chunkDLYVHOMEcjs.getExplorerTxUrl; exports.getExplorerUrl = _chunkDLYVHOMEcjs.getExplorerUrl; exports.getSupportedChainIds = _chunkDLYVHOMEcjs.getSupportedChainIds; exports.getSupportedTargetTokens = _chunkDLYVHOMEcjs.getSupportedTargetTokens; exports.getSupportedTokenSymbolsForChain = _chunkDLYVHOMEcjs.getSupportedTokenSymbolsForChain; exports.getTokenAddress = _chunkDLYVHOMEcjs.getTokenAddress; exports.getTokenDecimals = _chunkDLYVHOMEcjs.getTokenDecimals; exports.getTokenDecimalsByAddress = _chunkDLYVHOMEcjs.getTokenDecimalsByAddress; exports.getTokenIcon = _chunkDLYVHOMEcjs.getTokenIcon; exports.getTokenSymbol = _chunkDLYVHOMEcjs.getTokenSymbol; exports.getUsdcAddress = _chunkDLYVHOMEcjs.getUsdcAddress; exports.getUsdcDecimals = _chunkDLYVHOMEcjs.getUsdcDecimals; exports.isSupportedTokenAddressForChain = _chunkDLYVHOMEcjs.isSupportedTokenAddressForChain;
|
package/dist/constants.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Chain } from 'viem/chains';
|
|
2
2
|
import { Address } from 'viem';
|
|
3
|
-
export { chainRegistry } from '@rhinestone/shared-configs';
|
|
4
3
|
|
|
5
4
|
declare const DEFAULT_BACKEND_URL = "https://v1.orchestrator.rhinestone.dev/deposit-widget";
|
|
6
5
|
declare const DEFAULT_SIGNER_ADDRESS: Address;
|
|
@@ -8,6 +7,16 @@ declare const NATIVE_TOKEN_ADDRESS: Address;
|
|
|
8
7
|
declare const CHAIN_BY_ID: Record<number, Chain>;
|
|
9
8
|
declare const SOURCE_CHAINS: Chain[];
|
|
10
9
|
declare const SUPPORTED_CHAINS: Chain[];
|
|
10
|
+
type ChainRegistryToken = {
|
|
11
|
+
symbol: string;
|
|
12
|
+
address: Address;
|
|
13
|
+
decimals: number;
|
|
14
|
+
};
|
|
15
|
+
type ChainRegistryEntry = {
|
|
16
|
+
name: string;
|
|
17
|
+
tokens: readonly ChainRegistryToken[];
|
|
18
|
+
};
|
|
19
|
+
declare const chainRegistry: Record<string, ChainRegistryEntry>;
|
|
11
20
|
type SupportedTokenOption = {
|
|
12
21
|
symbol: string;
|
|
13
22
|
address: Address;
|
|
@@ -38,4 +47,4 @@ declare function getExplorerName(chainId: number): string;
|
|
|
38
47
|
declare function getChainIcon(chainId: number): string | undefined;
|
|
39
48
|
declare function getTokenIcon(symbol: string): string | undefined;
|
|
40
49
|
|
|
41
|
-
export { CHAIN_BY_ID, DEFAULT_BACKEND_URL, DEFAULT_SIGNER_ADDRESS, NATIVE_TOKEN_ADDRESS, SOURCE_CHAINS, SUPPORTED_CHAINS, type SupportedTokenOption, findChainIdForToken, getChainBadge, getChainIcon, getChainId, getChainName, getChainObject, getExplorerName, getExplorerTxUrl, getExplorerUrl, getSupportedChainIds, getSupportedTargetTokens, getSupportedTokenSymbolsForChain, getTokenAddress, getTokenDecimals, getTokenDecimalsByAddress, getTokenIcon, getTokenSymbol, getUsdcAddress, getUsdcDecimals, isSupportedTokenAddressForChain };
|
|
50
|
+
export { CHAIN_BY_ID, DEFAULT_BACKEND_URL, DEFAULT_SIGNER_ADDRESS, NATIVE_TOKEN_ADDRESS, SOURCE_CHAINS, SUPPORTED_CHAINS, type SupportedTokenOption, chainRegistry, findChainIdForToken, getChainBadge, getChainIcon, getChainId, getChainName, getChainObject, getExplorerName, getExplorerTxUrl, getExplorerUrl, getSupportedChainIds, getSupportedTargetTokens, getSupportedTokenSymbolsForChain, getTokenAddress, getTokenDecimals, getTokenDecimalsByAddress, getTokenIcon, getTokenSymbol, getUsdcAddress, getUsdcDecimals, isSupportedTokenAddressForChain };
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Chain } from 'viem/chains';
|
|
2
2
|
import { Address } from 'viem';
|
|
3
|
-
export { chainRegistry } from '@rhinestone/shared-configs';
|
|
4
3
|
|
|
5
4
|
declare const DEFAULT_BACKEND_URL = "https://v1.orchestrator.rhinestone.dev/deposit-widget";
|
|
6
5
|
declare const DEFAULT_SIGNER_ADDRESS: Address;
|
|
@@ -8,6 +7,16 @@ declare const NATIVE_TOKEN_ADDRESS: Address;
|
|
|
8
7
|
declare const CHAIN_BY_ID: Record<number, Chain>;
|
|
9
8
|
declare const SOURCE_CHAINS: Chain[];
|
|
10
9
|
declare const SUPPORTED_CHAINS: Chain[];
|
|
10
|
+
type ChainRegistryToken = {
|
|
11
|
+
symbol: string;
|
|
12
|
+
address: Address;
|
|
13
|
+
decimals: number;
|
|
14
|
+
};
|
|
15
|
+
type ChainRegistryEntry = {
|
|
16
|
+
name: string;
|
|
17
|
+
tokens: readonly ChainRegistryToken[];
|
|
18
|
+
};
|
|
19
|
+
declare const chainRegistry: Record<string, ChainRegistryEntry>;
|
|
11
20
|
type SupportedTokenOption = {
|
|
12
21
|
symbol: string;
|
|
13
22
|
address: Address;
|
|
@@ -38,4 +47,4 @@ declare function getExplorerName(chainId: number): string;
|
|
|
38
47
|
declare function getChainIcon(chainId: number): string | undefined;
|
|
39
48
|
declare function getTokenIcon(symbol: string): string | undefined;
|
|
40
49
|
|
|
41
|
-
export { CHAIN_BY_ID, DEFAULT_BACKEND_URL, DEFAULT_SIGNER_ADDRESS, NATIVE_TOKEN_ADDRESS, SOURCE_CHAINS, SUPPORTED_CHAINS, type SupportedTokenOption, findChainIdForToken, getChainBadge, getChainIcon, getChainId, getChainName, getChainObject, getExplorerName, getExplorerTxUrl, getExplorerUrl, getSupportedChainIds, getSupportedTargetTokens, getSupportedTokenSymbolsForChain, getTokenAddress, getTokenDecimals, getTokenDecimalsByAddress, getTokenIcon, getTokenSymbol, getUsdcAddress, getUsdcDecimals, isSupportedTokenAddressForChain };
|
|
50
|
+
export { CHAIN_BY_ID, DEFAULT_BACKEND_URL, DEFAULT_SIGNER_ADDRESS, NATIVE_TOKEN_ADDRESS, SOURCE_CHAINS, SUPPORTED_CHAINS, type SupportedTokenOption, chainRegistry, findChainIdForToken, getChainBadge, getChainIcon, getChainId, getChainName, getChainObject, getExplorerName, getExplorerTxUrl, getExplorerUrl, getSupportedChainIds, getSupportedTargetTokens, getSupportedTokenSymbolsForChain, getTokenAddress, getTokenDecimals, getTokenDecimalsByAddress, getTokenIcon, getTokenSymbol, getUsdcAddress, getUsdcDecimals, isSupportedTokenAddressForChain };
|
package/dist/constants.mjs
CHANGED
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-
|
|
5
|
-
require('./chunk-
|
|
3
|
+
var _chunk5QJNOPNFcjs = require('./chunk-5QJNOPNF.cjs');
|
|
4
|
+
require('./chunk-7ZCUANBT.cjs');
|
|
5
|
+
require('./chunk-DLYVHOME.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
exports.DepositModal =
|
|
8
|
+
exports.DepositModal = _chunk5QJNOPNFcjs.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 _chunk5QJNOPNFcjs = require('./chunk-5QJNOPNF.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
7
|
-
require('./chunk-
|
|
6
|
+
var _chunkCPIQJR47cjs = require('./chunk-CPIQJR47.cjs');
|
|
7
|
+
require('./chunk-7ZCUANBT.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -33,7 +33,7 @@ require('./chunk-QWYZJL3L.cjs');
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
var
|
|
36
|
+
var _chunkDLYVHOMEcjs = require('./chunk-DLYVHOME.cjs');
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
@@ -64,4 +64,4 @@ var _chunkCEIWN53Ncjs = require('./chunk-CEIWN53N.cjs');
|
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
|
|
67
|
-
exports.CHAIN_BY_ID =
|
|
67
|
+
exports.CHAIN_BY_ID = _chunkDLYVHOMEcjs.CHAIN_BY_ID; exports.DEFAULT_BACKEND_URL = _chunkDLYVHOMEcjs.DEFAULT_BACKEND_URL; exports.DEFAULT_SIGNER_ADDRESS = _chunkDLYVHOMEcjs.DEFAULT_SIGNER_ADDRESS; exports.DepositModal = _chunk5QJNOPNFcjs.DepositModal; exports.NATIVE_TOKEN_ADDRESS = _chunkDLYVHOMEcjs.NATIVE_TOKEN_ADDRESS; exports.SOURCE_CHAINS = _chunkDLYVHOMEcjs.SOURCE_CHAINS; exports.SUPPORTED_CHAINS = _chunkDLYVHOMEcjs.SUPPORTED_CHAINS; exports.WithdrawModal = _chunkCPIQJR47cjs.WithdrawModal; exports.chainRegistry = _chunkDLYVHOMEcjs.chainRegistry; exports.findChainIdForToken = _chunkDLYVHOMEcjs.findChainIdForToken; exports.getChainBadge = _chunkDLYVHOMEcjs.getChainBadge; exports.getChainIcon = _chunkDLYVHOMEcjs.getChainIcon; exports.getChainId = _chunkDLYVHOMEcjs.getChainId; exports.getChainName = _chunkDLYVHOMEcjs.getChainName; exports.getChainObject = _chunkDLYVHOMEcjs.getChainObject; exports.getExplorerName = _chunkDLYVHOMEcjs.getExplorerName; exports.getExplorerTxUrl = _chunkDLYVHOMEcjs.getExplorerTxUrl; exports.getExplorerUrl = _chunkDLYVHOMEcjs.getExplorerUrl; exports.getSupportedChainIds = _chunkDLYVHOMEcjs.getSupportedChainIds; exports.getSupportedTargetTokens = _chunkDLYVHOMEcjs.getSupportedTargetTokens; exports.getSupportedTokenSymbolsForChain = _chunkDLYVHOMEcjs.getSupportedTokenSymbolsForChain; exports.getTokenAddress = _chunkDLYVHOMEcjs.getTokenAddress; exports.getTokenDecimals = _chunkDLYVHOMEcjs.getTokenDecimals; exports.getTokenDecimalsByAddress = _chunkDLYVHOMEcjs.getTokenDecimalsByAddress; exports.getTokenIcon = _chunkDLYVHOMEcjs.getTokenIcon; exports.getTokenSymbol = _chunkDLYVHOMEcjs.getTokenSymbol; exports.getUsdcAddress = _chunkDLYVHOMEcjs.getUsdcAddress; exports.getUsdcDecimals = _chunkDLYVHOMEcjs.getUsdcDecimals; exports.isSupportedTokenAddressForChain = _chunkDLYVHOMEcjs.isSupportedTokenAddressForChain;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
export { DepositModal } from './deposit.cjs';
|
|
2
2
|
export { WithdrawModal } from './withdraw.cjs';
|
|
3
3
|
export { A as AssetOption, C as ConnectedEventData, D as DepositCompleteEventData, a as DepositFailedEventData, b as DepositModalBranding, c as DepositModalProps, d as DepositModalTheme, e as DepositModalUIConfig, f as DepositSubmittedEventData, E as ErrorEventData, W as WithdrawCompleteEventData, g as WithdrawFailedEventData, h as WithdrawModalProps, i as WithdrawSubmittedEventData } from './types-BwaQ7jK5.cjs';
|
|
4
|
-
export { CHAIN_BY_ID, DEFAULT_BACKEND_URL, DEFAULT_SIGNER_ADDRESS, NATIVE_TOKEN_ADDRESS, SOURCE_CHAINS, SUPPORTED_CHAINS, findChainIdForToken, getChainBadge, getChainIcon, getChainId, getChainName, getChainObject, getExplorerName, getExplorerTxUrl, getExplorerUrl, getSupportedChainIds, getSupportedTargetTokens, getSupportedTokenSymbolsForChain, getTokenAddress, getTokenDecimals, getTokenDecimalsByAddress, getTokenIcon, getTokenSymbol, getUsdcAddress, getUsdcDecimals, isSupportedTokenAddressForChain } from './constants.cjs';
|
|
4
|
+
export { CHAIN_BY_ID, DEFAULT_BACKEND_URL, DEFAULT_SIGNER_ADDRESS, NATIVE_TOKEN_ADDRESS, SOURCE_CHAINS, SUPPORTED_CHAINS, chainRegistry, findChainIdForToken, getChainBadge, getChainIcon, getChainId, getChainName, getChainObject, getExplorerName, getExplorerTxUrl, getExplorerUrl, getSupportedChainIds, getSupportedTargetTokens, getSupportedTokenSymbolsForChain, getTokenAddress, getTokenDecimals, getTokenDecimalsByAddress, getTokenIcon, getTokenSymbol, getUsdcAddress, getUsdcDecimals, isSupportedTokenAddressForChain } from './constants.cjs';
|
|
5
5
|
export { SafeTransactionRequest } from './safe.cjs';
|
|
6
|
-
export { chainRegistry } from '@rhinestone/shared-configs';
|
|
7
6
|
import 'react/jsx-runtime';
|
|
8
7
|
import 'viem';
|
|
9
8
|
import 'viem/chains';
|