@rhinestone/deposit-modal 0.1.27 → 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.
@@ -21,7 +21,7 @@ import {
21
21
  portfolioToAssets,
22
22
  saveSessionOwnerToStorage,
23
23
  tokenFormatter
24
- } from "./chunk-YOFGP4FV.mjs";
24
+ } from "./chunk-RQSAANC3.mjs";
25
25
  import {
26
26
  DEFAULT_BACKEND_URL,
27
27
  DEFAULT_SIGNER_ADDRESS,
@@ -96,48 +96,43 @@ function SetupStep({
96
96
  try {
97
97
  setState({ type: "creating-account" });
98
98
  const sessionOwner = await resolveSessionOwner(address);
99
- const computed = await service.computeAddress(address, sessionOwner.address);
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 = prepared.sessionDetailsUnsigned.data;
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: prepared.accountParams.factory,
140
- factoryData: prepared.accountParams.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 === "checking" || state.type === "creating-account" || state.type === "signing-session" || state.type === "registering";
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-PFKTSKDS.mjs").then((m) => ({ default: m.DepositModalReown }))
2108
+ () => import("./DepositModalReown-FF4YU5VV.mjs").then((m) => ({ default: m.DepositModalReown }))
2116
2109
  );
2117
2110
  function DepositModal(props) {
2118
2111
  const needsReown = !!props.reownAppId;
package/dist/deposit.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk7MQU2SR7cjs = require('./chunk-7MQU2SR7.cjs');
4
- require('./chunk-QWYZJL3L.cjs');
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 = _chunk7MQU2SR7cjs.DepositModal;
8
+ exports.DepositModal = _chunkXJ4G6RO6cjs.DepositModal;
package/dist/deposit.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DepositModal
3
- } from "./chunk-AJALMXW4.mjs";
4
- import "./chunk-YOFGP4FV.mjs";
3
+ } from "./chunk-YXTWMYHK.mjs";
4
+ import "./chunk-RQSAANC3.mjs";
5
5
  import "./chunk-A6QLADED.mjs";
6
6
  export {
7
7
  DepositModal
package/dist/index.cjs CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk7MQU2SR7cjs = require('./chunk-7MQU2SR7.cjs');
3
+ var _chunkXJ4G6RO6cjs = require('./chunk-XJ4G6RO6.cjs');
4
4
 
5
5
 
6
- var _chunkXIS33BZ6cjs = require('./chunk-XIS33BZ6.cjs');
7
- require('./chunk-QWYZJL3L.cjs');
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 = _chunk7MQU2SR7cjs.DepositModal; exports.NATIVE_TOKEN_ADDRESS = _chunkCEIWN53Ncjs.NATIVE_TOKEN_ADDRESS; exports.SOURCE_CHAINS = _chunkCEIWN53Ncjs.SOURCE_CHAINS; exports.SUPPORTED_CHAINS = _chunkCEIWN53Ncjs.SUPPORTED_CHAINS; exports.WithdrawModal = _chunkXIS33BZ6cjs.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;
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-AJALMXW4.mjs";
3
+ } from "./chunk-YXTWMYHK.mjs";
4
4
  import {
5
5
  WithdrawModal
6
- } from "./chunk-QCRZCGAE.mjs";
7
- import "./chunk-YOFGP4FV.mjs";
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 _chunk7MQU2SR7cjs = require('./chunk-7MQU2SR7.cjs');
3
+ var _chunkXJ4G6RO6cjs = require('./chunk-XJ4G6RO6.cjs');
4
4
 
5
5
 
6
- var _chunkXIS33BZ6cjs = require('./chunk-XIS33BZ6.cjs');
7
- require('./chunk-QWYZJL3L.cjs');
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 = _chunk7MQU2SR7cjs.DepositModal; exports.WithdrawModal = _chunkXIS33BZ6cjs.WithdrawModal;
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-AJALMXW4.mjs";
3
+ } from "./chunk-YXTWMYHK.mjs";
4
4
  import {
5
5
  WithdrawModal
6
- } from "./chunk-QCRZCGAE.mjs";
7
- import "./chunk-YOFGP4FV.mjs";
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 _chunkXIS33BZ6cjs = require('./chunk-XIS33BZ6.cjs');
4
- require('./chunk-QWYZJL3L.cjs');
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 = _chunkXIS33BZ6cjs.WithdrawModal;
8
+ exports.WithdrawModal = _chunkLP6DQCKVcjs.WithdrawModal;
package/dist/withdraw.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  WithdrawModal
3
- } from "./chunk-QCRZCGAE.mjs";
4
- import "./chunk-YOFGP4FV.mjs";
3
+ } from "./chunk-XF7M4TTT.mjs";
4
+ import "./chunk-RQSAANC3.mjs";
5
5
  import "./chunk-A6QLADED.mjs";
6
6
  export {
7
7
  WithdrawModal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rhinestone/deposit-modal",
3
- "version": "0.1.27",
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": {