@rhinestone/deposit-modal 0.1.24 → 0.1.26

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.
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
 
4
4
 
@@ -16,7 +16,11 @@
16
16
 
17
17
 
18
18
 
19
- var _chunkANQQMGNNcjs = require('./chunk-ANQQMGNN.cjs');
19
+
20
+
21
+
22
+
23
+ var _chunk4Q6QCALPcjs = require('./chunk-4Q6QCALP.cjs');
20
24
 
21
25
 
22
26
 
@@ -39,6 +43,8 @@ var _chunkCEIWN53Ncjs = require('./chunk-CEIWN53N.cjs');
39
43
 
40
44
 
41
45
 
46
+
47
+
42
48
  var _react = require('react');
43
49
 
44
50
  // src/WithdrawFlow.tsx
@@ -109,7 +115,7 @@ function WithdrawFormStep({
109
115
  setIsSwitching(true);
110
116
  switchChain(asset.chainId).catch((err) => {
111
117
  const raw = err instanceof Error ? err.message : "Failed to switch chain";
112
- setError(_chunkANQQMGNNcjs.formatUserError.call(void 0, raw));
118
+ setError(_chunk4Q6QCALPcjs.formatUserError.call(void 0, raw));
113
119
  }).finally(() => {
114
120
  setIsSwitching(false);
115
121
  });
@@ -126,7 +132,7 @@ function WithdrawFormStep({
126
132
  return;
127
133
  }
128
134
  try {
129
- const bal = _chunkANQQMGNNcjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: safeAddress }) : await publicClient.readContract({
135
+ const bal = _chunk4Q6QCALPcjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: safeAddress }) : await publicClient.readContract({
130
136
  address: asset.token,
131
137
  abi: _viem.erc20Abi,
132
138
  functionName: "balanceOf",
@@ -228,7 +234,7 @@ function WithdrawFormStep({
228
234
  await onSubmit(recipient, amount);
229
235
  } catch (err) {
230
236
  const raw = err instanceof Error ? err.message : "Withdrawal failed";
231
- setError(_chunkANQQMGNNcjs.formatUserError.call(void 0, raw));
237
+ setError(_chunk4Q6QCALPcjs.formatUserError.call(void 0, raw));
232
238
  } finally {
233
239
  setIsSubmitting(false);
234
240
  }
@@ -240,7 +246,7 @@ function WithdrawFormStep({
240
246
  await switchChain(asset.chainId);
241
247
  } catch (err) {
242
248
  const raw = err instanceof Error ? err.message : "Failed to switch chain";
243
- setError(_chunkANQQMGNNcjs.formatUserError.call(void 0, raw));
249
+ setError(_chunk4Q6QCALPcjs.formatUserError.call(void 0, raw));
244
250
  } finally {
245
251
  setIsSwitching(false);
246
252
  }
@@ -330,7 +336,7 @@ function WithdrawFormStep({
330
336
  ] })
331
337
  ] }),
332
338
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-amount-info", children: [
333
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ? _chunkANQQMGNNcjs.currencyFormatter.format(amountUsd) : "$0.00" }),
339
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ? _chunk4Q6QCALPcjs.currencyFormatter.format(amountUsd) : "$0.00" }),
334
340
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-withdraw-balance", children: [
335
341
  formattedBalance,
336
342
  " ",
@@ -507,7 +513,7 @@ function WithdrawFormStep({
507
513
  " to continue."
508
514
  ] }),
509
515
  switchChain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
510
- _chunkANQQMGNNcjs.Button,
516
+ _chunk4Q6QCALPcjs.Button,
511
517
  {
512
518
  variant: "outline",
513
519
  size: "small",
@@ -539,7 +545,7 @@ function WithdrawFormStep({
539
545
  ] })
540
546
  ] }),
541
547
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
542
- _chunkANQQMGNNcjs.Button,
548
+ _chunk4Q6QCALPcjs.Button,
543
549
  {
544
550
  onClick: handleWithdraw,
545
551
  fullWidth: true,
@@ -548,11 +554,14 @@ function WithdrawFormStep({
548
554
  children: isBusy ? "Preparing..." : "Withdraw"
549
555
  }
550
556
  ) }),
551
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkANQQMGNNcjs.PoweredBy, {})
557
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4Q6QCALPcjs.PoweredBy, {})
552
558
  ] });
553
559
  }
554
560
  WithdrawFormStep.displayName = "WithdrawFormStep";
555
561
 
562
+ // src/WithdrawFlow.tsx
563
+ var _sdk = require('@rhinestone/sdk');
564
+
556
565
  // src/core/safe.ts
557
566
 
558
567
 
@@ -853,13 +862,14 @@ function WithdrawFlow({
853
862
  recipient: defaultRecipient,
854
863
  amount: defaultAmount,
855
864
  service,
865
+ rhinestoneApiKey,
856
866
  signerAddress = _chunkCEIWN53Ncjs.DEFAULT_SIGNER_ADDRESS,
857
867
  sessionChainIds,
858
868
  forceRegister = false,
859
869
  waitForFinalTx = true,
860
870
  reownWallet,
861
871
  onConnect,
862
- onRelayTransaction,
872
+ onSignTransaction,
863
873
  onRequestConnect,
864
874
  connectButtonLabel,
865
875
  onStepChange,
@@ -883,7 +893,7 @@ function WithdrawFlow({
883
893
  setTargetToken(targetTokenProp);
884
894
  }, [targetChainProp, targetTokenProp]);
885
895
  const targetChainObj = _react.useMemo.call(void 0, () => _chunkCEIWN53Ncjs.CHAIN_BY_ID[targetChain], [targetChain]);
886
- const hasCustomSigner = Boolean(dappAddress && onRelayTransaction);
896
+ const hasCustomSigner = Boolean(dappAddress && onSignTransaction);
887
897
  const dappSwitchChain = _react.useMemo.call(void 0, () => {
888
898
  if (!_optionalChain([dappWalletClient, 'optionalAccess', _6 => _6.switchChain])) return void 0;
889
899
  return async (chainId) => {
@@ -923,14 +933,14 @@ function WithdrawFlow({
923
933
  return {
924
934
  ownerAddress: dappAddress,
925
935
  walletClient: _nullishCoalesce(dappWalletClient, () => ( void 0)),
926
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkANQQMGNNcjs.getPublicClient.call(void 0, sourceChain))),
936
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunk4Q6QCALPcjs.getPublicClient.call(void 0, sourceChain))),
927
937
  switchChain: dappSwitchChain
928
938
  };
929
939
  }
930
940
  return {
931
941
  ownerAddress: dappWalletClient.account.address,
932
942
  walletClient: dappWalletClient,
933
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkANQQMGNNcjs.getPublicClient.call(void 0, sourceChain))),
943
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunk4Q6QCALPcjs.getPublicClient.call(void 0, sourceChain))),
934
944
  switchChain: dappSwitchChain
935
945
  };
936
946
  }
@@ -939,7 +949,7 @@ function WithdrawFlow({
939
949
  return {
940
950
  ownerAddress: dappWalletClient.account.address,
941
951
  walletClient: dappWalletClient,
942
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkANQQMGNNcjs.getPublicClient.call(void 0, sourceChain))),
952
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunk4Q6QCALPcjs.getPublicClient.call(void 0, sourceChain))),
943
953
  switchChain: dappSwitchChain
944
954
  };
945
955
  }
@@ -968,7 +978,7 @@ function WithdrawFlow({
968
978
  const symbol = _chunkCEIWN53Ncjs.getTokenSymbol.call(void 0, sourceToken, sourceChain);
969
979
  const decimals = _chunkCEIWN53Ncjs.getTokenDecimalsByAddress.call(void 0, sourceToken, sourceChain);
970
980
  return {
971
- id: _chunkANQQMGNNcjs.getAssetId.call(void 0, { chainId: sourceChain, token: sourceToken }),
981
+ id: _chunk4Q6QCALPcjs.getAssetId.call(void 0, { chainId: sourceChain, token: sourceToken }),
972
982
  chainId: sourceChain,
973
983
  token: sourceToken,
974
984
  symbol,
@@ -998,37 +1008,27 @@ function WithdrawFlow({
998
1008
  [onError]
999
1009
  );
1000
1010
  const resolveSessionOwner = _react.useCallback.call(void 0, async (eoaAddress) => {
1001
- const localOwner = _chunkANQQMGNNcjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
1011
+ const localOwner = _chunk4Q6QCALPcjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
1002
1012
  if (localOwner) {
1003
1013
  return {
1004
- account: _chunkANQQMGNNcjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
1014
+ account: _chunk4Q6QCALPcjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
1005
1015
  address: localOwner.address
1006
1016
  };
1007
1017
  }
1008
- const created = _chunkANQQMGNNcjs.createSessionOwnerKey.call(void 0, );
1009
- _chunkANQQMGNNcjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
1018
+ const created = _chunk4Q6QCALPcjs.createSessionOwnerKey.call(void 0, );
1019
+ _chunk4Q6QCALPcjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
1010
1020
  return {
1011
1021
  account: created.account,
1012
1022
  address: created.address
1013
1023
  };
1014
1024
  }, []);
1015
- const signSessionDetails = _react.useCallback.call(void 0,
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 = _react.useCallback.call(void 0,
1026
1026
  async (recipient, amountValue) => {
1027
1027
  const ownerAddress2 = _optionalChain([signerContext, 'optionalAccess', _22 => _22.ownerAddress]);
1028
1028
  if (!ownerAddress2) {
1029
1029
  throw new Error("Wallet not connected");
1030
1030
  }
1031
- if (!onRelayTransaction && !_optionalChain([signerContext, 'optionalAccess', _23 => _23.walletClient])) {
1031
+ if (!onSignTransaction && !_optionalChain([signerContext, 'optionalAccess', _23 => _23.walletClient])) {
1032
1032
  throw new Error("Wallet not connected");
1033
1033
  }
1034
1034
  if (!targetChainObj) {
@@ -1036,32 +1036,31 @@ function WithdrawFlow({
1036
1036
  }
1037
1037
  setIsSubmitting(true);
1038
1038
  try {
1039
+ const signerAccount = _optionalChain([signerContext, 'optionalAccess', _24 => _24.walletClient]) ? _sdk.walletClientToAccount.call(void 0, signerContext.walletClient) : _chunk4Q6QCALPcjs.createViewOnlyAccount.call(void 0, ownerAddress2);
1039
1040
  const sessionOwner = await resolveSessionOwner(ownerAddress2);
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;
1041
+ const account = await _chunk4Q6QCALPcjs.createSmartAccount.call(void 0,
1042
+ signerAccount,
1043
+ sessionOwner.account,
1044
+ rhinestoneApiKey
1045
+ );
1046
+ const smartAccount = _chunk4Q6QCALPcjs.getAccountAddress.call(void 0, account);
1049
1047
  const checkResult = await service.checkAccount(smartAccount);
1050
- const targetMatches = checkResult.targetChain === targetChain && _optionalChain([checkResult, 'access', _24 => _24.targetToken, 'optionalAccess', _25 => _25.toLowerCase, 'call', _26 => _26()]) === targetToken.toLowerCase();
1048
+ const targetMatches = checkResult.targetChain === targetChain && _optionalChain([checkResult, 'access', _25 => _25.targetToken, 'optionalAccess', _26 => _26.toLowerCase, 'call', _27 => _27()]) === targetToken.toLowerCase();
1051
1049
  if (!checkResult.isRegistered || forceRegister || !targetMatches) {
1052
- const signature = await signSessionDetails(
1050
+ const initData = _chunk4Q6QCALPcjs.getAccountInitData.call(void 0, account);
1051
+ const sessionDetails = await _chunk4Q6QCALPcjs.getSessionDetails.call(void 0,
1052
+ account,
1053
+ targetChainObj,
1054
+ signerAddress,
1053
1055
  sessionOwner.account,
1054
- prepared.sessionDetailsUnsigned.data
1055
- );
1056
- const sessionDetails = _chunkANQQMGNNcjs.buildSessionDetails.call(void 0,
1057
- prepared.sessionDetailsUnsigned,
1058
- signature
1056
+ targetToken,
1057
+ sessionChainIds
1059
1058
  );
1060
1059
  await service.registerAccount({
1061
1060
  address: smartAccount,
1062
1061
  accountParams: {
1063
- factory: prepared.accountParams.factory,
1064
- factoryData: prepared.accountParams.factoryData,
1062
+ factory: initData.factory,
1063
+ factoryData: initData.factoryData,
1065
1064
  sessionDetails
1066
1065
  },
1067
1066
  eoaAddress: ownerAddress2,
@@ -1075,9 +1074,9 @@ function WithdrawFlow({
1075
1074
  }
1076
1075
  handleConnected(ownerAddress2, smartAccount);
1077
1076
  const amountUnits = _viem.parseUnits.call(void 0, amountValue, asset.decimals);
1078
- const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _27 => _27.publicClient]), () => ( _chunkANQQMGNNcjs.getPublicClient.call(void 0, sourceChain)));
1077
+ const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _28 => _28.publicClient]), () => ( _chunk4Q6QCALPcjs.getPublicClient.call(void 0, sourceChain)));
1079
1078
  let result;
1080
- if (onRelayTransaction) {
1079
+ if (onSignTransaction) {
1081
1080
  const transferData = isSourceNative ? { to: smartAccount, value: amountUnits, data: "0x" } : {
1082
1081
  to: sourceToken,
1083
1082
  value: 0n,
@@ -1095,7 +1094,18 @@ function WithdrawFlow({
1095
1094
  data: transferData.data,
1096
1095
  chainId: sourceChain
1097
1096
  });
1098
- result = await onRelayTransaction(request);
1097
+ const { signature } = await onSignTransaction(request);
1098
+ const relayResult = await service.relayWithdraw({
1099
+ smartAccount,
1100
+ chainId: sourceChain,
1101
+ safeAddress,
1102
+ safeTransaction: request.typedData.message,
1103
+ signature
1104
+ });
1105
+ if (!relayResult.txHash) {
1106
+ throw new Error("Relay succeeded but no txHash returned");
1107
+ }
1108
+ result = { txHash: relayResult.txHash };
1099
1109
  } else if (isSourceNative) {
1100
1110
  result = await executeSafeEthTransfer({
1101
1111
  walletClient: signerContext.walletClient,
@@ -1116,7 +1126,7 @@ function WithdrawFlow({
1116
1126
  chainId: sourceChain
1117
1127
  });
1118
1128
  }
1119
- _optionalChain([onWithdrawSubmitted, 'optionalCall', _28 => _28({
1129
+ _optionalChain([onWithdrawSubmitted, 'optionalCall', _29 => _29({
1120
1130
  txHash: result.txHash,
1121
1131
  sourceChain,
1122
1132
  amount: amountUnits.toString(),
@@ -1132,7 +1142,7 @@ function WithdrawFlow({
1132
1142
  });
1133
1143
  } catch (err) {
1134
1144
  const raw = err instanceof Error ? err.message : "Withdraw failed";
1135
- handleError(_chunkANQQMGNNcjs.formatUserError.call(void 0, raw), "WITHDRAW_FLOW_ERROR");
1145
+ handleError(_chunk4Q6QCALPcjs.formatUserError.call(void 0, raw), "WITHDRAW_FLOW_ERROR");
1136
1146
  throw err;
1137
1147
  } finally {
1138
1148
  setIsSubmitting(false);
@@ -1148,27 +1158,27 @@ function WithdrawFlow({
1148
1158
  targetChain,
1149
1159
  targetToken,
1150
1160
  service,
1161
+ rhinestoneApiKey,
1151
1162
  handleConnected,
1152
1163
  asset.decimals,
1153
1164
  safeAddress,
1154
1165
  sourceToken,
1155
1166
  sourceChain,
1156
1167
  onWithdrawSubmitted,
1157
- onRelayTransaction,
1168
+ onSignTransaction,
1158
1169
  isSourceNative,
1159
- handleError,
1160
- signSessionDetails
1170
+ handleError
1161
1171
  ]
1162
1172
  );
1163
1173
  const handleWithdrawComplete = _react.useCallback.call(void 0,
1164
1174
  (txHash, destinationTxHash) => {
1165
- _optionalChain([onWithdrawComplete, 'optionalCall', _29 => _29({ txHash, destinationTxHash })]);
1175
+ _optionalChain([onWithdrawComplete, 'optionalCall', _30 => _30({ txHash, destinationTxHash })]);
1166
1176
  },
1167
1177
  [onWithdrawComplete]
1168
1178
  );
1169
1179
  const handleWithdrawFailed = _react.useCallback.call(void 0,
1170
1180
  (txHash, error) => {
1171
- _optionalChain([onWithdrawFailed, 'optionalCall', _30 => _30({ txHash, error })]);
1181
+ _optionalChain([onWithdrawFailed, 'optionalCall', _31 => _31({ txHash, error })]);
1172
1182
  },
1173
1183
  [onWithdrawFailed]
1174
1184
  );
@@ -1226,7 +1236,7 @@ function WithdrawFlow({
1226
1236
  }, [walletOptionsKey, selectedConnectAddressEffective]);
1227
1237
  if (showConnectStep) {
1228
1238
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1229
- _chunkANQQMGNNcjs.ConnectStep,
1239
+ _chunk4Q6QCALPcjs.ConnectStep,
1230
1240
  {
1231
1241
  walletOptions,
1232
1242
  selectedAddress: selectedConnectAddressEffective,
@@ -1244,9 +1254,9 @@ function WithdrawFlow({
1244
1254
  ) });
1245
1255
  }
1246
1256
  if (!signerContext) return null;
1247
- if (!onRelayTransaction && !signerContext.walletClient) return null;
1257
+ if (!onSignTransaction && !signerContext.walletClient) return null;
1248
1258
  const ownerAddress = signerContext.ownerAddress;
1249
- const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => ( _chunkANQQMGNNcjs.getPublicClient.call(void 0, sourceChain)));
1259
+ const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => ( _chunk4Q6QCALPcjs.getPublicClient.call(void 0, sourceChain)));
1250
1260
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
1251
1261
  step.type === "form" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1252
1262
  WithdrawFormStep,
@@ -1271,7 +1281,7 @@ function WithdrawFlow({
1271
1281
  }
1272
1282
  ),
1273
1283
  step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1274
- _chunkANQQMGNNcjs.ProcessingStep,
1284
+ _chunk4Q6QCALPcjs.ProcessingStep,
1275
1285
  {
1276
1286
  smartAccount: step.smartAccount,
1277
1287
  txHash: step.txHash,
@@ -1296,11 +1306,15 @@ function WithdrawFlow({
1296
1306
 
1297
1307
  // src/WithdrawModal.tsx
1298
1308
 
1309
+ var ReownWithdrawInner = _react.lazy.call(void 0,
1310
+ () => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-GL4TM22D.cjs"))).then((m) => ({
1311
+ default: m.WithdrawModalReown
1312
+ }))
1313
+ );
1299
1314
  function WithdrawModal(props) {
1300
- if (props.reownAppId) {
1301
- throw new Error(
1302
- 'Reown support moved to "@rhinestone/deposit-modal/reown". Use that entrypoint when passing reownAppId.'
1303
- );
1315
+ const needsReown = !!props.reownAppId;
1316
+ if (needsReown) {
1317
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Suspense, { fallback: null, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ReownWithdrawInner, { ...props }) });
1304
1318
  }
1305
1319
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WithdrawModalInner, { ...props });
1306
1320
  }
@@ -1320,13 +1334,14 @@ function WithdrawModalInner({
1320
1334
  onClose,
1321
1335
  inline,
1322
1336
  backendUrl = _chunkCEIWN53Ncjs.DEFAULT_BACKEND_URL,
1337
+ rhinestoneApiKey,
1323
1338
  signerAddress = _chunkCEIWN53Ncjs.DEFAULT_SIGNER_ADDRESS,
1324
1339
  sessionChainIds,
1325
1340
  forceRegister = false,
1326
1341
  waitForFinalTx = true,
1327
1342
  reownWallet,
1328
1343
  onConnect,
1329
- onRelayTransaction,
1344
+ onSignTransaction,
1330
1345
  onRequestConnect,
1331
1346
  connectButtonLabel,
1332
1347
  theme,
@@ -1347,17 +1362,17 @@ function WithdrawModalInner({
1347
1362
  const backHandlerRef = _react.useRef.call(void 0, void 0);
1348
1363
  const targetChain = _chunkCEIWN53Ncjs.getChainId.call(void 0, targetChainProp);
1349
1364
  const sourceChain = _chunkCEIWN53Ncjs.getChainId.call(void 0, sourceChainProp);
1350
- const service = _react.useMemo.call(void 0, () => _chunkANQQMGNNcjs.createDepositService.call(void 0, backendUrl), [backendUrl]);
1365
+ const service = _react.useMemo.call(void 0, () => _chunk4Q6QCALPcjs.createDepositService.call(void 0, backendUrl), [backendUrl]);
1351
1366
  _react.useEffect.call(void 0, () => {
1352
1367
  if (isOpen && modalRef.current) {
1353
- _chunkANQQMGNNcjs.applyTheme.call(void 0, modalRef.current, theme);
1368
+ _chunk4Q6QCALPcjs.applyTheme.call(void 0, modalRef.current, theme);
1354
1369
  }
1355
1370
  }, [isOpen, theme]);
1356
1371
  const hasCalledReady = _react.useRef.call(void 0, false);
1357
1372
  _react.useEffect.call(void 0, () => {
1358
1373
  if (isOpen && !hasCalledReady.current) {
1359
1374
  hasCalledReady.current = true;
1360
- _optionalChain([onReady, 'optionalCall', _31 => _31()]);
1375
+ _optionalChain([onReady, 'optionalCall', _32 => _32()]);
1361
1376
  }
1362
1377
  }, [isOpen, onReady]);
1363
1378
  _react.useEffect.call(void 0, () => {
@@ -1376,17 +1391,17 @@ function WithdrawModalInner({
1376
1391
  setTotalBalanceUsd(balance);
1377
1392
  }, []);
1378
1393
  const handleBack = _react.useCallback.call(void 0, () => {
1379
- _optionalChain([backHandlerRef, 'access', _32 => _32.current, 'optionalCall', _33 => _33()]);
1394
+ _optionalChain([backHandlerRef, 'access', _33 => _33.current, 'optionalCall', _34 => _34()]);
1380
1395
  }, []);
1381
- const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _34 => _34.showLogo]), () => ( false));
1382
- const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _35 => _35.showStepper]), () => ( false));
1383
- const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _36 => _36.showBackButton]), () => ( true));
1384
- const balanceTitle = _optionalChain([uiConfig, 'optionalAccess', _37 => _37.balanceTitle]);
1385
- const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _38 => _38.logoUrl]), () => ( "https://github.com/rhinestonewtf.png"));
1386
- const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _39 => _39.title]), () => ( "Withdraw"));
1396
+ const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _35 => _35.showLogo]), () => ( false));
1397
+ const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _36 => _36.showStepper]), () => ( false));
1398
+ const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _37 => _37.showBackButton]), () => ( true));
1399
+ const balanceTitle = _optionalChain([uiConfig, 'optionalAccess', _38 => _38.balanceTitle]);
1400
+ const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _39 => _39.logoUrl]), () => ( "https://github.com/rhinestonewtf.png"));
1401
+ const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _40 => _40.title]), () => ( "Withdraw"));
1387
1402
  const canGoBack = currentStepIndex > 0 && currentStepIndex < 3 && backHandlerRef.current;
1388
1403
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1389
- _chunkANQQMGNNcjs.Modal,
1404
+ _chunk4Q6QCALPcjs.Modal,
1390
1405
  {
1391
1406
  isOpen,
1392
1407
  onClose,
@@ -1444,7 +1459,7 @@ function WithdrawModalInner({
1444
1459
  ] }),
1445
1460
  balanceTitle && totalBalanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header-balance", children: [
1446
1461
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-label", children: balanceTitle }),
1447
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _chunkANQQMGNNcjs.currencyFormatter.format(totalBalanceUsd) })
1462
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _chunk4Q6QCALPcjs.currencyFormatter.format(totalBalanceUsd) })
1448
1463
  ] })
1449
1464
  ] }),
1450
1465
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -1488,13 +1503,14 @@ function WithdrawModalInner({
1488
1503
  recipient,
1489
1504
  amount: defaultAmount,
1490
1505
  service,
1506
+ rhinestoneApiKey,
1491
1507
  signerAddress,
1492
1508
  sessionChainIds,
1493
1509
  forceRegister,
1494
1510
  waitForFinalTx,
1495
1511
  reownWallet,
1496
1512
  onConnect,
1497
- onRelayTransaction,
1513
+ onSignTransaction,
1498
1514
  onRequestConnect,
1499
1515
  connectButtonLabel,
1500
1516
  onStepChange: handleStepChange,
@@ -0,0 +1,90 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/core/reown.tsx
2
+ var _react = require('react');
3
+ var _reactquery = require('@tanstack/react-query');
4
+ var _appkitadapterwagmi = require('@reown/appkit-adapter-wagmi');
5
+ var _wagmi = require('wagmi');
6
+ var _react3 = require('@reown/appkit/react');
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+ var _networks = require('@reown/appkit/networks');
15
+
16
+ var _jsxruntime = require('react/jsx-runtime');
17
+ var NETWORKS = [
18
+ _networks.mainnet,
19
+ _networks.base,
20
+ _networks.arbitrum,
21
+ _networks.optimism,
22
+ _networks.polygon,
23
+ _networks.bsc
24
+ ];
25
+ var cachedAdapter = null;
26
+ var cachedProjectId = null;
27
+ function mapTheme(theme) {
28
+ const themeMode = _optionalChain([theme, 'optionalAccess', _ => _.mode]) === "light" ? "light" : "dark";
29
+ const themeVariables = {};
30
+ if (_optionalChain([theme, 'optionalAccess', _2 => _2.ctaColor])) {
31
+ themeVariables["--apkt-accent"] = theme.ctaColor;
32
+ }
33
+ return { themeMode, themeVariables };
34
+ }
35
+ function getOrCreateAdapter(projectId, theme) {
36
+ if (cachedAdapter && cachedProjectId === projectId) return cachedAdapter;
37
+ cachedAdapter = new (0, _appkitadapterwagmi.WagmiAdapter)({
38
+ networks: NETWORKS,
39
+ projectId
40
+ });
41
+ cachedProjectId = projectId;
42
+ const { themeMode, themeVariables } = mapTheme(theme);
43
+ _react3.createAppKit.call(void 0, {
44
+ adapters: [cachedAdapter],
45
+ networks: NETWORKS,
46
+ projectId,
47
+ themeMode,
48
+ themeVariables,
49
+ features: {
50
+ connectMethodsOrder: ["wallet"],
51
+ email: false,
52
+ socials: false
53
+ }
54
+ });
55
+ return cachedAdapter;
56
+ }
57
+ function ReownWalletProvider({
58
+ projectId,
59
+ theme,
60
+ children
61
+ }) {
62
+ const [queryClient] = _react.useState.call(void 0, () => new (0, _reactquery.QueryClient)());
63
+ const adapter = getOrCreateAdapter(projectId, theme);
64
+ const config = adapter.wagmiConfig;
65
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _wagmi.WagmiProvider, { config, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactquery.QueryClientProvider, { client: queryClient, children }) });
66
+ }
67
+ function useReownWallet() {
68
+ const { open } = _react3.useAppKit.call(void 0, );
69
+ const { address, isConnected } = _react3.useAppKitAccount.call(void 0, );
70
+ const { data: walletClient } = _wagmi.useWalletClient.call(void 0, );
71
+ const publicClient = _wagmi.usePublicClient.call(void 0, );
72
+ const { switchChainAsync } = _wagmi.useSwitchChain.call(void 0, );
73
+ return {
74
+ walletClient: _nullishCoalesce(walletClient, () => ( void 0)),
75
+ publicClient: _nullishCoalesce(publicClient, () => ( void 0)),
76
+ address,
77
+ isConnected,
78
+ openConnect: () => {
79
+ void open({ view: isConnected ? "Account" : "Connect" });
80
+ },
81
+ switchChain: async (chainId) => {
82
+ await switchChainAsync({ chainId });
83
+ }
84
+ };
85
+ }
86
+
87
+
88
+
89
+
90
+ exports.ReownWalletProvider = ReownWalletProvider; exports.useReownWallet = useReownWallet;