@rhinestone/deposit-modal 0.9.1 → 0.10.0

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.
Files changed (30) hide show
  1. package/dist/{DepositModalReown-JUJI7UHE.mjs → DepositModalReown-MTWT6Y66.mjs} +5 -5
  2. package/dist/{DepositModalReown-YQSO4SVY.cjs → DepositModalReown-S3DSFXTX.cjs} +9 -9
  3. package/dist/{chunk-7OQO6JDC.mjs → chunk-5NJYW5FT.mjs} +3 -3
  4. package/dist/{chunk-QLZ5RZTA.mjs → chunk-5OEWGJR4.mjs} +1 -1
  5. package/dist/{chunk-WUQZYQRK.mjs → chunk-7TV7GLJB.mjs} +62 -1
  6. package/dist/{chunk-EEEQZOTJ.cjs → chunk-A42XAHIB.cjs} +66 -66
  7. package/dist/{chunk-SQOEHQNT.cjs → chunk-DEF767BA.cjs} +52 -52
  8. package/dist/{chunk-AYWEWI47.mjs → chunk-KW32UBUQ.mjs} +1 -1
  9. package/dist/{chunk-QGXAAFHU.mjs → chunk-LR7MKHYV.mjs} +2 -2
  10. package/dist/{chunk-N3OHR3T2.mjs → chunk-MHIOMTMM.mjs} +227 -24
  11. package/dist/{chunk-XJE5MRY4.cjs → chunk-NF4NBRUP.cjs} +1 -1
  12. package/dist/{chunk-6U2H3R3T.cjs → chunk-PUJHXHRA.cjs} +108 -47
  13. package/dist/{chunk-ITFRTPGF.cjs → chunk-UMCDZJMG.cjs} +57 -57
  14. package/dist/{chunk-GYEUZSQP.mjs → chunk-VDGT6NZQ.mjs} +1 -1
  15. package/dist/{chunk-EAUF7SGM.cjs → chunk-VTVOHNXM.cjs} +3 -3
  16. package/dist/{chunk-VQJHYWAE.cjs → chunk-W4YAOJPG.cjs} +570 -367
  17. package/dist/claim.cjs +5 -5
  18. package/dist/claim.mjs +4 -4
  19. package/dist/constants.cjs +2 -2
  20. package/dist/constants.d.cts +1 -1
  21. package/dist/constants.d.ts +1 -1
  22. package/dist/constants.mjs +1 -1
  23. package/dist/deposit.cjs +6 -6
  24. package/dist/deposit.mjs +5 -5
  25. package/dist/index.cjs +8 -8
  26. package/dist/index.mjs +7 -7
  27. package/dist/styles.css +14 -0
  28. package/dist/withdraw.cjs +5 -5
  29. package/dist/withdraw.mjs +4 -4
  30. package/package.json +1 -1
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  DepositModalInner
3
- } from "./chunk-N3OHR3T2.mjs";
4
- import "./chunk-GYEUZSQP.mjs";
5
- import "./chunk-AYWEWI47.mjs";
3
+ } from "./chunk-MHIOMTMM.mjs";
4
+ import "./chunk-VDGT6NZQ.mjs";
5
+ import "./chunk-KW32UBUQ.mjs";
6
6
  import {
7
7
  isUnsupportedChainSwitchError,
8
8
  rpcUrlFor
9
- } from "./chunk-WUQZYQRK.mjs";
10
- import "./chunk-QLZ5RZTA.mjs";
9
+ } from "./chunk-7TV7GLJB.mjs";
10
+ import "./chunk-5OEWGJR4.mjs";
11
11
  import "./chunk-ILT2PITN.mjs";
12
12
  import {
13
13
  SUPPORTED_CHAINS,
@@ -1,13 +1,13 @@
1
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; }
2
2
 
3
- var _chunkVQJHYWAEcjs = require('./chunk-VQJHYWAE.cjs');
4
- require('./chunk-EEEQZOTJ.cjs');
5
- require('./chunk-EAUF7SGM.cjs');
3
+ var _chunkW4YAOJPGcjs = require('./chunk-W4YAOJPG.cjs');
4
+ require('./chunk-A42XAHIB.cjs');
5
+ require('./chunk-VTVOHNXM.cjs');
6
6
 
7
7
 
8
8
 
9
- var _chunk6U2H3R3Tcjs = require('./chunk-6U2H3R3T.cjs');
10
- require('./chunk-XJE5MRY4.cjs');
9
+ var _chunkPUJHXHRAcjs = require('./chunk-PUJHXHRA.cjs');
10
+ require('./chunk-NF4NBRUP.cjs');
11
11
  require('./chunk-YEBXUUH3.cjs');
12
12
 
13
13
 
@@ -88,14 +88,14 @@ function buildTransports(rpcUrls) {
88
88
  const transports = {};
89
89
  for (const network of EVM_NETWORKS) {
90
90
  const id = Number(network.id);
91
- transports[id] = _viem.http.call(void 0, _chunk6U2H3R3Tcjs.rpcUrlFor.call(void 0, rpcUrls, id));
91
+ transports[id] = _viem.http.call(void 0, _chunkPUJHXHRAcjs.rpcUrlFor.call(void 0, rpcUrls, id));
92
92
  }
93
93
  return transports;
94
94
  }
95
95
  function getEvmRpcFingerprint(rpcUrls) {
96
96
  return EVM_NETWORKS.map((network) => {
97
97
  const id = Number(network.id);
98
- return `${id}=${_nullishCoalesce(_chunk6U2H3R3Tcjs.rpcUrlFor.call(void 0, rpcUrls, id), () => ( ""))}`;
98
+ return `${id}=${_nullishCoalesce(_chunkPUJHXHRAcjs.rpcUrlFor.call(void 0, rpcUrls, id), () => ( ""))}`;
99
99
  }).join("|");
100
100
  }
101
101
  var cachedAdapter = null;
@@ -189,7 +189,7 @@ function useReownWallet() {
189
189
  await switchChainAsync({ chainId });
190
190
  }
191
191
  } catch (err) {
192
- if (_chunk6U2H3R3Tcjs.isUnsupportedChainSwitchError.call(void 0, err)) {
192
+ if (_chunkPUJHXHRAcjs.isUnsupportedChainSwitchError.call(void 0, err)) {
193
193
  throw new Error(
194
194
  `Switch to ${_chunkH577RJN5cjs.getChainName.call(void 0, chainId)} in your wallet to continue`
195
195
  );
@@ -223,7 +223,7 @@ function DepositModalWithReown(props) {
223
223
  reown.disconnect();
224
224
  }, [reown.disconnect]);
225
225
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
226
- _chunkVQJHYWAEcjs.DepositModalInner,
226
+ _chunkW4YAOJPGcjs.DepositModalInner,
227
227
  {
228
228
  ...props,
229
229
  reownWallet: reownWithSolana,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ListRow
3
- } from "./chunk-AYWEWI47.mjs";
3
+ } from "./chunk-KW32UBUQ.mjs";
4
4
  import {
5
5
  AlertTriangleIcon,
6
6
  BodyHeader,
@@ -26,10 +26,10 @@ import {
26
26
  formatUserError,
27
27
  useLatestRef,
28
28
  useStableRpcUrls
29
- } from "./chunk-WUQZYQRK.mjs";
29
+ } from "./chunk-7TV7GLJB.mjs";
30
30
  import {
31
31
  SERVICE_HEADERS
32
- } from "./chunk-QLZ5RZTA.mjs";
32
+ } from "./chunk-5OEWGJR4.mjs";
33
33
  import {
34
34
  getChainIcon,
35
35
  getChainName,
@@ -1,5 +1,5 @@
1
1
  // src/core/version.ts
2
- var MODAL_VERSION = "0.9.1";
2
+ var MODAL_VERSION = "0.10.0";
3
3
  var SERVICE_HEADERS = {
4
4
  "Content-Type": "application/json",
5
5
  "x-deposit-modal-version": MODAL_VERSION
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SERVICE_HEADERS
3
- } from "./chunk-QLZ5RZTA.mjs";
3
+ } from "./chunk-5OEWGJR4.mjs";
4
4
  import {
5
5
  HYPERCORE_CHAIN_ID,
6
6
  HYPERCORE_MAINNET_CAIP2,
@@ -1184,6 +1184,67 @@ function createDepositService(baseUrl, options) {
1184
1184
  });
1185
1185
  return { lastEvent };
1186
1186
  },
1187
+ async getPositions(address) {
1188
+ const url = apiUrl(`/positions/${address}`);
1189
+ debugLog(debug, scope, "getPositions:request", { url, address });
1190
+ const response = await fetch(url, { headers: SERVICE_HEADERS });
1191
+ if (!response.ok) {
1192
+ const error = await response.json().catch(() => ({ error: "Unknown error" }));
1193
+ debugError(debug, scope, "getPositions:failed", error, {
1194
+ status: response.status,
1195
+ address
1196
+ });
1197
+ throw new Error(
1198
+ error.error || `Position lookup failed: ${response.status}`
1199
+ );
1200
+ }
1201
+ const result = await response.json();
1202
+ debugLog(debug, scope, "getPositions:success", {
1203
+ address,
1204
+ count: result.positions?.length ?? 0,
1205
+ totalUsd: result.totalUsd,
1206
+ failures: result.failures?.map((f) => f.venue)
1207
+ });
1208
+ return result;
1209
+ },
1210
+ async prepareUnwind(params) {
1211
+ const { address, account, market, chainId, asset, amount } = params;
1212
+ const url = apiUrl(`/positions/${address}/unwind`);
1213
+ debugLog(debug, scope, "prepareUnwind:request", {
1214
+ url,
1215
+ address,
1216
+ account,
1217
+ market,
1218
+ chainId,
1219
+ asset,
1220
+ amount
1221
+ });
1222
+ const response = await fetch(url, {
1223
+ method: "POST",
1224
+ headers: SERVICE_HEADERS,
1225
+ body: JSON.stringify({ account, market, chainId, asset, amount })
1226
+ });
1227
+ if (!response.ok) {
1228
+ const error = await response.json().catch(() => ({ error: "Unknown error" }));
1229
+ debugError(debug, scope, "prepareUnwind:failed", error, {
1230
+ status: response.status,
1231
+ address,
1232
+ market,
1233
+ asset
1234
+ });
1235
+ throw new Error(
1236
+ error.error || `Unwind preparation failed: ${response.status}`
1237
+ );
1238
+ }
1239
+ const result = await response.json();
1240
+ debugLog(debug, scope, "prepareUnwind:success", {
1241
+ address,
1242
+ amount: result.amount,
1243
+ isFullExit: result.isFullExit,
1244
+ recipient: result.recipient
1245
+ });
1246
+ return result;
1247
+ },
1187
1248
  async submitPolymarketWithdraw(params) {
1188
1249
  const { depositWallet, owner, nonce, deadline, calls, signature } = params;
1189
1250
  const url = apiUrl(`/polymarket/withdraw`);