@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.
@@ -8,7 +8,7 @@
8
8
 
9
9
 
10
10
 
11
- var _chunkCEIWN53Ncjs = require('./chunk-CEIWN53N.cjs');
11
+ var _chunkDLYVHOMEcjs = require('./chunk-DLYVHOME.cjs');
12
12
 
13
13
  // src/components/ui/Modal.tsx
14
14
 
@@ -180,12 +180,16 @@ function normalizeSessionTypedData(raw) {
180
180
  }
181
181
  return data;
182
182
  }
183
- function normalizePrepareAccountResponse(raw) {
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 computeAddress(ownerAddress, sessionOwnerAddress) {
216
- const response = await fetch(apiUrl("/compute-address"), {
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 || `Prepare account failed: ${response.status}`
228
+ error.error || `Setup account failed: ${response.status}`
239
229
  );
240
230
  }
241
- return normalizePrepareAccountResponse(await response.json());
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",
@@ -382,24 +361,24 @@ function normalizeOrchestratorPortfolio(data) {
382
361
  const unlocked = _nullishCoalesce(_optionalChain([chainBalance, 'access', _4 => _4.balance, 'optionalAccess', _5 => _5.unlocked]), () => ( "0"));
383
362
  const normalizedName = tokenData.tokenName.trim();
384
363
  const isNativeSymbol = normalizedName.toUpperCase() === "ETH" || normalizedName.toUpperCase() === "ETHER";
385
- const tokenAddress = _nullishCoalesce(_nullishCoalesce(chainBalance.tokenAddress, () => ( extractTokenAddress(tokenData, chainBalance.chainId))), () => ( _chunkCEIWN53Ncjs.getTokenAddress.call(void 0, tokenData.tokenName, chainBalance.chainId)));
386
- const resolvedTokenAddress = isNativeSymbol ? _chunkCEIWN53Ncjs.NATIVE_TOKEN_ADDRESS : tokenAddress;
364
+ const tokenAddress = _nullishCoalesce(_nullishCoalesce(chainBalance.tokenAddress, () => ( extractTokenAddress(tokenData, chainBalance.chainId))), () => ( _chunkDLYVHOMEcjs.getTokenAddress.call(void 0, tokenData.tokenName, chainBalance.chainId)));
365
+ const resolvedTokenAddress = isNativeSymbol ? _chunkDLYVHOMEcjs.NATIVE_TOKEN_ADDRESS : tokenAddress;
387
366
  if (!resolvedTokenAddress) {
388
367
  continue;
389
368
  }
390
- if (!_chunkCEIWN53Ncjs.isSupportedTokenAddressForChain.call(void 0,
369
+ if (!_chunkDLYVHOMEcjs.isSupportedTokenAddressForChain.call(void 0,
391
370
  resolvedTokenAddress,
392
371
  chainBalance.chainId
393
372
  )) {
394
373
  continue;
395
374
  }
396
- const symbol = _chunkCEIWN53Ncjs.getTokenSymbol.call(void 0, resolvedTokenAddress, chainBalance.chainId);
375
+ const symbol = _chunkDLYVHOMEcjs.getTokenSymbol.call(void 0, resolvedTokenAddress, chainBalance.chainId);
397
376
  tokens.push({
398
377
  chainId: chainBalance.chainId,
399
378
  address: resolvedTokenAddress,
400
379
  symbol,
401
380
  name: symbol,
402
- decimals: _chunkCEIWN53Ncjs.getTokenDecimalsByAddress.call(void 0,
381
+ decimals: _chunkDLYVHOMEcjs.getTokenDecimalsByAddress.call(void 0,
403
382
  resolvedTokenAddress,
404
383
  chainBalance.chainId
405
384
  ),
@@ -423,17 +402,17 @@ function normalizeDirectToken(token) {
423
402
  const address = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "address"), () => ( extractString(token, "tokenAddress"))), () => ( extractString(
424
403
  token.token,
425
404
  "address"
426
- ))), () => ( _chunkCEIWN53Ncjs.getTokenAddress.call(void 0, symbol, chainId)));
405
+ ))), () => ( _chunkDLYVHOMEcjs.getTokenAddress.call(void 0, symbol, chainId)));
427
406
  if (!address) return null;
428
407
  const addressAsToken = address;
429
- if (!_chunkCEIWN53Ncjs.isSupportedTokenAddressForChain.call(void 0, addressAsToken, chainId)) return null;
408
+ if (!_chunkDLYVHOMEcjs.isSupportedTokenAddressForChain.call(void 0, addressAsToken, chainId)) return null;
430
409
  const balanceUsd = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractNumber(token, "balanceUsd"), () => ( extractNumber(token, "usdValue"))), () => ( extractNumber(token, "valueUsd"))), () => ( extractNumericString(token, "balanceUsd"))), () => ( extractNumericString(token, "usdValue"))), () => ( extractNumericString(token, "valueUsd"))), () => ( 0));
431
410
  return {
432
411
  chainId,
433
412
  address: addressAsToken,
434
- symbol: _chunkCEIWN53Ncjs.getTokenSymbol.call(void 0, addressAsToken, chainId),
435
- name: _chunkCEIWN53Ncjs.getTokenSymbol.call(void 0, addressAsToken, chainId),
436
- decimals: _chunkCEIWN53Ncjs.getTokenDecimalsByAddress.call(void 0, addressAsToken, chainId),
413
+ symbol: _chunkDLYVHOMEcjs.getTokenSymbol.call(void 0, addressAsToken, chainId),
414
+ name: _chunkDLYVHOMEcjs.getTokenSymbol.call(void 0, addressAsToken, chainId),
415
+ decimals: _chunkDLYVHOMEcjs.getTokenDecimalsByAddress.call(void 0, addressAsToken, chainId),
437
416
  balance: balanceValue,
438
417
  balanceUsd
439
418
  };
@@ -1200,8 +1179,8 @@ function ProcessingStep({
1200
1179
  const flowNoun = flowLabel === "withdraw" ? "withdrawal" : "deposit";
1201
1180
  const flowCapitalized = flowLabel === "withdraw" ? "Withdrawal" : "Deposit";
1202
1181
  const destinationTxHash = _optionalChain([lastEvent, 'optionalAccess', _70 => _70.data, 'optionalAccess', _71 => _71.destination, 'optionalAccess', _72 => _72.transactionHash]) || null;
1203
- const sourceExplorerUrl = _chunkCEIWN53Ncjs.getExplorerTxUrl.call(void 0, sourceChain, txHash);
1204
- const destExplorerUrl = destinationTxHash ? _chunkCEIWN53Ncjs.getExplorerTxUrl.call(void 0, targetChain, destinationTxHash) : null;
1182
+ const sourceExplorerUrl = _chunkDLYVHOMEcjs.getExplorerTxUrl.call(void 0, sourceChain, txHash);
1183
+ const destExplorerUrl = destinationTxHash ? _chunkDLYVHOMEcjs.getExplorerTxUrl.call(void 0, targetChain, destinationTxHash) : null;
1205
1184
  const truncateHash = (hash) => `${hash.slice(0, 10)}...${hash.slice(-8)}`;
1206
1185
  const formatElapsedTime = (seconds) => {
1207
1186
  if (seconds < 60) return `${seconds} second${seconds !== 1 ? "s" : ""}`;
@@ -1209,8 +1188,8 @@ function ProcessingStep({
1209
1188
  const secs = seconds % 60;
1210
1189
  return `${mins}m ${secs}s`;
1211
1190
  };
1212
- const targetSymbol = _chunkCEIWN53Ncjs.getTokenSymbol.call(void 0, targetToken, targetChain);
1213
- const sourceDecimals = _chunkCEIWN53Ncjs.getTokenDecimalsByAddress.call(void 0, sourceToken, sourceChain);
1191
+ const targetSymbol = _chunkDLYVHOMEcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
1192
+ const sourceDecimals = _chunkDLYVHOMEcjs.getTokenDecimalsByAddress.call(void 0, sourceToken, sourceChain);
1214
1193
  const formattedReceivedAmount = (() => {
1215
1194
  try {
1216
1195
  const raw = _viem.formatUnits.call(void 0, BigInt(amount), sourceDecimals);
@@ -1281,15 +1260,15 @@ function ProcessingStep({
1281
1260
  className: "rs-card-value",
1282
1261
  style: { display: "flex", alignItems: "center", gap: 6 },
1283
1262
  children: [
1284
- _chunkCEIWN53Ncjs.getChainIcon.call(void 0, sourceChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1263
+ _chunkDLYVHOMEcjs.getChainIcon.call(void 0, sourceChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1285
1264
  "img",
1286
1265
  {
1287
- src: _chunkCEIWN53Ncjs.getChainIcon.call(void 0, sourceChain),
1266
+ src: _chunkDLYVHOMEcjs.getChainIcon.call(void 0, sourceChain),
1288
1267
  alt: "",
1289
1268
  style: { width: 14, height: 14, borderRadius: "50%" }
1290
1269
  }
1291
1270
  ),
1292
- _chunkCEIWN53Ncjs.getChainName.call(void 0, sourceChain)
1271
+ _chunkDLYVHOMEcjs.getChainName.call(void 0, sourceChain)
1293
1272
  ]
1294
1273
  }
1295
1274
  )
@@ -1302,15 +1281,15 @@ function ProcessingStep({
1302
1281
  className: "rs-card-value",
1303
1282
  style: { display: "flex", alignItems: "center", gap: 6 },
1304
1283
  children: [
1305
- _chunkCEIWN53Ncjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1284
+ _chunkDLYVHOMEcjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1306
1285
  "img",
1307
1286
  {
1308
- src: _chunkCEIWN53Ncjs.getChainIcon.call(void 0, targetChain),
1287
+ src: _chunkDLYVHOMEcjs.getChainIcon.call(void 0, targetChain),
1309
1288
  alt: "",
1310
1289
  style: { width: 14, height: 14, borderRadius: "50%" }
1311
1290
  }
1312
1291
  ),
1313
- _chunkCEIWN53Ncjs.getChainName.call(void 0, targetChain)
1292
+ _chunkDLYVHOMEcjs.getChainName.call(void 0, targetChain)
1314
1293
  ]
1315
1294
  }
1316
1295
  )
@@ -1432,7 +1411,7 @@ function ProcessingStep({
1432
1411
  {
1433
1412
  className: `rs-step-description ${isError ? "rs-text-error" : "rs-text-secondary"}`,
1434
1413
  children: [
1435
- state.type === "processing" && (_optionalChain([lastEvent, 'optionalAccess', _73 => _73.type]) === "deposit-received" ? "Transfer received. Preparing bridge..." : _optionalChain([lastEvent, 'optionalAccess', _74 => _74.type]) === "bridge-started" ? "Transfer confirmed. Funds arriving shortly..." : `Bridging your ${flowNoun} to ${_chunkCEIWN53Ncjs.getChainName.call(void 0, targetChain)}.`),
1414
+ state.type === "processing" && (_optionalChain([lastEvent, 'optionalAccess', _73 => _73.type]) === "deposit-received" ? "Transfer received. Preparing bridge..." : _optionalChain([lastEvent, 'optionalAccess', _74 => _74.type]) === "bridge-started" ? "Transfer confirmed. Funds arriving shortly..." : `Bridging your ${flowNoun} to ${_chunkDLYVHOMEcjs.getChainName.call(void 0, targetChain)}.`),
1436
1415
  state.type === "failed" && state.message,
1437
1416
  state.type === "error" && state.message
1438
1417
  ]
@@ -1488,15 +1467,15 @@ function ProcessingStep({
1488
1467
  className: "rs-card-value",
1489
1468
  style: { display: "flex", alignItems: "center", gap: 8 },
1490
1469
  children: [
1491
- _chunkCEIWN53Ncjs.getChainIcon.call(void 0, sourceChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1470
+ _chunkDLYVHOMEcjs.getChainIcon.call(void 0, sourceChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1492
1471
  "img",
1493
1472
  {
1494
- src: _chunkCEIWN53Ncjs.getChainIcon.call(void 0, sourceChain),
1473
+ src: _chunkDLYVHOMEcjs.getChainIcon.call(void 0, sourceChain),
1495
1474
  alt: "",
1496
1475
  style: { width: 16, height: 16, borderRadius: "50%" }
1497
1476
  }
1498
1477
  ),
1499
- _chunkCEIWN53Ncjs.getChainName.call(void 0, sourceChain)
1478
+ _chunkDLYVHOMEcjs.getChainName.call(void 0, sourceChain)
1500
1479
  ]
1501
1480
  }
1502
1481
  )
@@ -1509,15 +1488,15 @@ function ProcessingStep({
1509
1488
  className: "rs-card-value",
1510
1489
  style: { display: "flex", alignItems: "center", gap: 8 },
1511
1490
  children: [
1512
- _chunkCEIWN53Ncjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1491
+ _chunkDLYVHOMEcjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1513
1492
  "img",
1514
1493
  {
1515
- src: _chunkCEIWN53Ncjs.getChainIcon.call(void 0, targetChain),
1494
+ src: _chunkDLYVHOMEcjs.getChainIcon.call(void 0, targetChain),
1516
1495
  alt: "",
1517
1496
  style: { width: 16, height: 16, borderRadius: "50%" }
1518
1497
  }
1519
1498
  ),
1520
- _chunkCEIWN53Ncjs.getChainName.call(void 0, targetChain)
1499
+ _chunkDLYVHOMEcjs.getChainName.call(void 0, targetChain)
1521
1500
  ]
1522
1501
  }
1523
1502
  )
@@ -1570,7 +1549,7 @@ var clientCache = /* @__PURE__ */ new Map();
1570
1549
  function getPublicClient(chainId) {
1571
1550
  let client = clientCache.get(chainId);
1572
1551
  if (!client) {
1573
- const chain = _chunkCEIWN53Ncjs.CHAIN_BY_ID[chainId];
1552
+ const chain = _chunkDLYVHOMEcjs.CHAIN_BY_ID[chainId];
1574
1553
  client = _viem.createPublicClient.call(void 0, {
1575
1554
  chain,
1576
1555
  transport: _viem.http.call(void 0, )