@rhinestone/deposit-modal 0.0.0-dev-20260901120231 → 0.0.0-dev-20260901125921
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/bridge-transcript.json +14 -0
- package/dist/{ClaimModal-53ZQN7B7.mjs → ClaimModal-GECPNVYW.mjs} +5 -5
- package/dist/ClaimModal-TUIJ2FXZ.cjs +13 -0
- package/dist/{DepositModalReown-HVP2ZZNL.cjs → DepositModalReown-7X2P4Q3U.cjs} +18 -18
- package/dist/{DepositModalReown-6FZ53KIP.mjs → DepositModalReown-J5677AO3.mjs} +5 -5
- package/dist/{WithdrawModal-L77PPBMZ.mjs → WithdrawModal-EGUXJGKC.mjs} +4 -4
- package/dist/WithdrawModal-ZRO4GPL5.cjs +12 -0
- package/dist/{chunk-U6SK2GOY.mjs → chunk-5VTLHOWL.mjs} +1 -1
- package/dist/{chunk-WBUK27DO.cjs → chunk-6NMICTMH.cjs} +8 -8
- package/dist/{chunk-AXSKK5QR.cjs → chunk-76SNGRJ4.cjs} +272 -272
- package/dist/{chunk-BZPPG7KU.cjs → chunk-BBHL7Y6Q.cjs} +65 -65
- package/dist/{chunk-AAWLOBUU.cjs → chunk-E26VPCQS.cjs} +3 -3
- package/dist/{chunk-SXT4VLDP.cjs → chunk-GGEX3J6J.cjs} +67 -67
- package/dist/{chunk-LQIIVFFP.cjs → chunk-H4GKLXX7.cjs} +53 -53
- package/dist/{chunk-QFH6E337.mjs → chunk-HEBZWISE.mjs} +3 -3
- package/dist/{chunk-32YGCXVS.cjs → chunk-LHVHW2FC.cjs} +1 -1
- package/dist/{chunk-NWVX44AG.mjs → chunk-QO63RXOH.mjs} +1 -1
- package/dist/{chunk-26ORY7ZP.mjs → chunk-SSODFKQC.mjs} +1 -1
- package/dist/{chunk-HZ3NJXFI.mjs → chunk-UIMR4O7B.mjs} +2 -2
- package/dist/{chunk-KRAFCZ76.mjs → chunk-ULDG2NFL.mjs} +1 -1
- package/dist/{chunk-NOBMQXTO.cjs → chunk-UMHZX3KX.cjs} +32 -32
- package/dist/{chunk-RQ5TXRRW.mjs → chunk-URYV6A2L.mjs} +2 -2
- package/dist/{chunk-SP5DGA4X.mjs → chunk-V35JXQDL.mjs} +4 -4
- package/dist/claim.cjs +6 -6
- package/dist/claim.mjs +5 -5
- package/dist/constants.cjs +2 -2
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/deposit.cjs +6 -6
- package/dist/deposit.mjs +5 -5
- package/dist/embed.cjs +113 -32
- package/dist/embed.mjs +94 -13
- package/dist/index.cjs +9 -9
- package/dist/index.mjs +8 -8
- package/dist/withdraw.cjs +5 -5
- package/dist/withdraw.mjs +4 -4
- package/package.json +2 -2
- package/dist/ClaimModal-C5E4JXDW.cjs +0 -13
- package/dist/WithdrawModal-2XGGPXWZ.cjs +0 -12
package/dist/embed.cjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
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
|
-
var
|
|
3
|
+
var _chunk76SNGRJ4cjs = require('./chunk-76SNGRJ4.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
7
|
-
require('./chunk-
|
|
8
|
-
require('./chunk-
|
|
6
|
+
var _chunkGGEX3J6Jcjs = require('./chunk-GGEX3J6J.cjs');
|
|
7
|
+
require('./chunk-6NMICTMH.cjs');
|
|
8
|
+
require('./chunk-E26VPCQS.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkUMHZX3KXcjs = require('./chunk-UMHZX3KX.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkLHVHW2FCcjs = require('./chunk-LHVHW2FC.cjs');
|
|
16
16
|
require('./chunk-DW2EQA2U.cjs');
|
|
17
17
|
|
|
18
18
|
|
|
@@ -695,7 +695,7 @@ function assertResultShape(method, result) {
|
|
|
695
695
|
`${method}: ${detail}`
|
|
696
696
|
)
|
|
697
697
|
);
|
|
698
|
-
throw SUBMITTING_WALLET_METHODS.includes(method) ?
|
|
698
|
+
throw SUBMITTING_WALLET_METHODS.includes(method) ? _chunkGGEX3J6Jcjs.markSubmissionUncertain.call(void 0, error) : error;
|
|
699
699
|
};
|
|
700
700
|
switch (method) {
|
|
701
701
|
case "eth_sendTransaction":
|
|
@@ -747,7 +747,7 @@ function createBridgedWalletSession(options) {
|
|
|
747
747
|
);
|
|
748
748
|
} catch (error) {
|
|
749
749
|
if (submitting && isBridgeRequestError(error) && error.code === -32603) {
|
|
750
|
-
throw
|
|
750
|
+
throw _chunkGGEX3J6Jcjs.markSubmissionUncertain.call(void 0,
|
|
751
751
|
new BridgeRequestError(
|
|
752
752
|
bridgeError(
|
|
753
753
|
BridgeErrorCode.SUBMISSION_UNCERTAIN,
|
|
@@ -758,7 +758,7 @@ function createBridgedWalletSession(options) {
|
|
|
758
758
|
);
|
|
759
759
|
}
|
|
760
760
|
if (submitting && isBridgeCode(error, BridgeErrorCode.SUBMISSION_UNCERTAIN)) {
|
|
761
|
-
throw
|
|
761
|
+
throw _chunkGGEX3J6Jcjs.markSubmissionUncertain.call(void 0, error);
|
|
762
762
|
}
|
|
763
763
|
throw error;
|
|
764
764
|
}
|
|
@@ -877,7 +877,7 @@ async function connectToHost(options) {
|
|
|
877
877
|
});
|
|
878
878
|
const params = {
|
|
879
879
|
protocol: PROTOCOL_VERSION,
|
|
880
|
-
modalVersion:
|
|
880
|
+
modalVersion: _chunkLHVHW2FCcjs.MODAL_VERSION
|
|
881
881
|
};
|
|
882
882
|
let raw;
|
|
883
883
|
try {
|
|
@@ -963,12 +963,12 @@ async function requestHostTransfer(transport, params) {
|
|
|
963
963
|
);
|
|
964
964
|
} catch (error) {
|
|
965
965
|
if (error instanceof Error && isBridgeCode(error, BridgeErrorCode.SUBMISSION_UNCERTAIN)) {
|
|
966
|
-
throw
|
|
966
|
+
throw _chunkGGEX3J6Jcjs.markSubmissionUncertain.call(void 0, error);
|
|
967
967
|
}
|
|
968
968
|
throw error;
|
|
969
969
|
}
|
|
970
970
|
if (!isTxHash(_optionalChain([result, 'optionalAccess', _25 => _25.txHash]))) {
|
|
971
|
-
throw
|
|
971
|
+
throw _chunkGGEX3J6Jcjs.markSubmissionUncertain.call(void 0,
|
|
972
972
|
new Error(
|
|
973
973
|
"The app did not return a transaction hash. Check your activity before trying again."
|
|
974
974
|
)
|
|
@@ -1035,16 +1035,63 @@ function dismissalFor(input) {
|
|
|
1035
1035
|
function canGoBackNow(input) {
|
|
1036
1036
|
return dismissalFor(input).state !== "blocked";
|
|
1037
1037
|
}
|
|
1038
|
-
function uiStateFor(input) {
|
|
1039
|
-
return {
|
|
1038
|
+
function uiStateFor(input, contentHeight) {
|
|
1039
|
+
return {
|
|
1040
|
+
screen: input.screen,
|
|
1041
|
+
dismissal: dismissalFor(input),
|
|
1042
|
+
...contentHeight === void 0 ? {} : { contentHeight }
|
|
1043
|
+
};
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
// src/core/bridge/content-height.ts
|
|
1047
|
+
function measureContentHeight(shell) {
|
|
1048
|
+
const modal = shell.firstElementChild;
|
|
1049
|
+
const last = _optionalChain([modal, 'optionalAccess', _27 => _27.lastElementChild]);
|
|
1050
|
+
if (!modal || !last) return void 0;
|
|
1051
|
+
const view = modal.ownerDocument.defaultView;
|
|
1052
|
+
const padding = view ? Number.parseFloat(view.getComputedStyle(modal).paddingBottom) : Number.NaN;
|
|
1053
|
+
const height = last.getBoundingClientRect().bottom - modal.getBoundingClientRect().top + (Number.isFinite(padding) ? padding : 0) + // The shell's own borders sit outside the modal and inside the sheet, so
|
|
1054
|
+
// they belong to the height a host is being asked for.
|
|
1055
|
+
(shell.offsetHeight - shell.clientHeight);
|
|
1056
|
+
return height > 0 ? Math.ceil(height) : void 0;
|
|
1057
|
+
}
|
|
1058
|
+
function observeContentHeight(shell, onChange) {
|
|
1059
|
+
const view = shell.ownerDocument.defaultView;
|
|
1060
|
+
if (!_optionalChain([view, 'optionalAccess', _28 => _28.ResizeObserver]) || !view.MutationObserver) return () => {
|
|
1061
|
+
};
|
|
1062
|
+
let last;
|
|
1063
|
+
const report = () => {
|
|
1064
|
+
const height = measureContentHeight(shell);
|
|
1065
|
+
if (height === void 0 || height === last) return;
|
|
1066
|
+
last = height;
|
|
1067
|
+
onChange(height);
|
|
1068
|
+
};
|
|
1069
|
+
const sizes = new view.ResizeObserver(report);
|
|
1070
|
+
const structure = new view.MutationObserver(() => rearm());
|
|
1071
|
+
function rearm() {
|
|
1072
|
+
sizes.disconnect();
|
|
1073
|
+
structure.disconnect();
|
|
1074
|
+
structure.observe(shell, { childList: true });
|
|
1075
|
+
const modal = shell.firstElementChild;
|
|
1076
|
+
if (modal) {
|
|
1077
|
+
structure.observe(modal, { childList: true });
|
|
1078
|
+
for (const child of Array.from(modal.children)) sizes.observe(child);
|
|
1079
|
+
}
|
|
1080
|
+
report();
|
|
1081
|
+
}
|
|
1082
|
+
rearm();
|
|
1083
|
+
return () => {
|
|
1084
|
+
sizes.disconnect();
|
|
1085
|
+
structure.disconnect();
|
|
1086
|
+
};
|
|
1040
1087
|
}
|
|
1041
1088
|
|
|
1042
1089
|
// src/core/bridge/viewport.ts
|
|
1043
1090
|
var VIEWPORT_HEIGHT_PROPERTY = "--rs-embed-viewport-height";
|
|
1044
1091
|
function trackVisualViewport(win) {
|
|
1045
1092
|
const target = win;
|
|
1046
|
-
const viewport = _optionalChain([target, 'optionalAccess',
|
|
1047
|
-
const style = _optionalChain([target, 'optionalAccess',
|
|
1093
|
+
const viewport = _optionalChain([target, 'optionalAccess', _29 => _29.visualViewport]);
|
|
1094
|
+
const style = _optionalChain([target, 'optionalAccess', _30 => _30.document, 'optionalAccess', _31 => _31.documentElement, 'optionalAccess', _32 => _32.style]);
|
|
1048
1095
|
if (!viewport || !style) return () => {
|
|
1049
1096
|
};
|
|
1050
1097
|
const apply = () => {
|
|
@@ -1066,10 +1113,10 @@ var UNKNOWN_SCREEN = "unknown";
|
|
|
1066
1113
|
// src/embed.tsx
|
|
1067
1114
|
var _jsxruntime = require('react/jsx-runtime');
|
|
1068
1115
|
var WithdrawModal = _react.lazy.call(void 0,
|
|
1069
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModal-
|
|
1116
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModal-ZRO4GPL5.cjs"))).then((m) => ({ default: m.WithdrawModal }))
|
|
1070
1117
|
);
|
|
1071
1118
|
var ClaimModal = _react.lazy.call(void 0,
|
|
1072
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./ClaimModal-
|
|
1119
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./ClaimModal-TUIJ2FXZ.cjs"))).then((m) => ({ default: m.ClaimModal }))
|
|
1073
1120
|
);
|
|
1074
1121
|
function missingField(config, keys) {
|
|
1075
1122
|
const missing = keys.find(
|
|
@@ -1253,6 +1300,9 @@ function toModalProps(config, canOpenExternally, walletWithheld) {
|
|
|
1253
1300
|
debug: config.debug
|
|
1254
1301
|
};
|
|
1255
1302
|
}
|
|
1303
|
+
function currentShell() {
|
|
1304
|
+
return document.querySelector(".rs-modal-content.rs-embed");
|
|
1305
|
+
}
|
|
1256
1306
|
function DepositEmbed({ target, onFatal }) {
|
|
1257
1307
|
const [session, setSession] = _react.useState.call(void 0, null);
|
|
1258
1308
|
const [config, setConfig] = _react.useState.call(void 0, null);
|
|
@@ -1264,8 +1314,15 @@ function DepositEmbed({ target, onFatal }) {
|
|
|
1264
1314
|
screen: UNKNOWN_SCREEN,
|
|
1265
1315
|
submitting: false
|
|
1266
1316
|
});
|
|
1317
|
+
const contentHeightRef = _react.useRef.call(void 0, void 0);
|
|
1318
|
+
const shellRef = _react.useRef.call(void 0, null);
|
|
1319
|
+
const [shellToken, setShellToken] = _react.useState.call(void 0, 0);
|
|
1267
1320
|
const onFatalRef = _react.useRef.call(void 0, onFatal);
|
|
1268
1321
|
onFatalRef.current = onFatal;
|
|
1322
|
+
const measuredHeight = _react.useCallback.call(void 0,
|
|
1323
|
+
() => currentShell() === shellRef.current ? contentHeightRef.current : void 0,
|
|
1324
|
+
[]
|
|
1325
|
+
);
|
|
1269
1326
|
_react.useEffect.call(void 0,
|
|
1270
1327
|
() => trackVisualViewport(_nullishCoalesce(target, () => ( globalThis.window))),
|
|
1271
1328
|
[target]
|
|
@@ -1303,33 +1360,37 @@ function DepositEmbed({ target, onFatal }) {
|
|
|
1303
1360
|
return { handled: true };
|
|
1304
1361
|
}
|
|
1305
1362
|
const back = uiRef.current.back;
|
|
1306
|
-
_optionalChain([back, 'optionalCall',
|
|
1363
|
+
_optionalChain([back, 'optionalCall', _33 => _33()]);
|
|
1307
1364
|
return { handled: Boolean(back) };
|
|
1308
1365
|
});
|
|
1309
|
-
|
|
1366
|
+
_chunkLHVHW2FCcjs.setEmbedHost.call(void 0, next.hello.host);
|
|
1310
1367
|
setSession(next);
|
|
1311
1368
|
setChannelScope(next.channelScope);
|
|
1312
1369
|
setConfig(sanitizeConfig(next.hello.config));
|
|
1313
|
-
void
|
|
1370
|
+
void _chunkUMHZX3KXcjs.primeRuntimeChains.call(void 0, next.hello.config.backendUrl).then((result) => {
|
|
1314
1371
|
chains = result;
|
|
1315
1372
|
});
|
|
1316
1373
|
} catch (error) {
|
|
1317
|
-
if (live) _optionalChain([onFatalRef, 'access',
|
|
1374
|
+
if (live) _optionalChain([onFatalRef, 'access', _34 => _34.current, 'optionalCall', _35 => _35(error)]);
|
|
1318
1375
|
}
|
|
1319
1376
|
})();
|
|
1320
1377
|
return () => {
|
|
1321
1378
|
live = false;
|
|
1322
|
-
_optionalChain([opened, 'optionalAccess',
|
|
1323
|
-
|
|
1379
|
+
_optionalChain([opened, 'optionalAccess', _36 => _36.close, 'call', _37 => _37()]);
|
|
1380
|
+
_chunkLHVHW2FCcjs.setEmbedHost.call(void 0, null);
|
|
1324
1381
|
};
|
|
1325
1382
|
}, [target]);
|
|
1326
1383
|
const handleUiState = _react.useCallback.call(void 0,
|
|
1327
1384
|
(state) => {
|
|
1328
1385
|
if (isHomeScreen(state.screen)) completedRef.current = false;
|
|
1329
1386
|
uiRef.current = state;
|
|
1330
|
-
|
|
1387
|
+
if (currentShell() !== shellRef.current) setShellToken((token) => token + 1);
|
|
1388
|
+
_optionalChain([session, 'optionalAccess', _38 => _38.transport, 'access', _39 => _39.emit, 'call', _40 => _40(
|
|
1331
1389
|
"ui.state",
|
|
1332
|
-
uiStateFor(
|
|
1390
|
+
uiStateFor(
|
|
1391
|
+
{ ...state, walletRequestPending: walletPending },
|
|
1392
|
+
measuredHeight()
|
|
1393
|
+
)
|
|
1333
1394
|
)]);
|
|
1334
1395
|
},
|
|
1335
1396
|
[session, walletPending]
|
|
@@ -1345,9 +1406,29 @@ function DepositEmbed({ target, onFatal }) {
|
|
|
1345
1406
|
if (!session) return;
|
|
1346
1407
|
session.transport.emit(
|
|
1347
1408
|
"ui.state",
|
|
1348
|
-
uiStateFor(
|
|
1409
|
+
uiStateFor(
|
|
1410
|
+
{ ...uiRef.current, walletRequestPending: walletPending },
|
|
1411
|
+
measuredHeight()
|
|
1412
|
+
)
|
|
1349
1413
|
);
|
|
1350
|
-
}, [session, walletPending]);
|
|
1414
|
+
}, [session, walletPending, measuredHeight]);
|
|
1415
|
+
_react.useEffect.call(void 0, () => {
|
|
1416
|
+
if (!session) return;
|
|
1417
|
+
const shell = currentShell();
|
|
1418
|
+
shellRef.current = shell;
|
|
1419
|
+
if (!shell) return;
|
|
1420
|
+
const stop = observeContentHeight(shell, (height) => {
|
|
1421
|
+
contentHeightRef.current = height;
|
|
1422
|
+
session.transport.emit(
|
|
1423
|
+
"ui.state",
|
|
1424
|
+
uiStateFor(
|
|
1425
|
+
{ ...uiRef.current, walletRequestPending: pendingRef.current },
|
|
1426
|
+
height
|
|
1427
|
+
)
|
|
1428
|
+
);
|
|
1429
|
+
});
|
|
1430
|
+
return stop;
|
|
1431
|
+
}, [session, shellToken]);
|
|
1351
1432
|
const refused = config && session ? refusal(config, session.hello.capabilities, channelScope) : null;
|
|
1352
1433
|
const walletWithheld = channelScope === "all-frames" || channelScope === "probing";
|
|
1353
1434
|
const refuseIfUnscoped = _react.useCallback.call(void 0, async () => {
|
|
@@ -1358,12 +1439,12 @@ function DepositEmbed({ target, onFatal }) {
|
|
|
1358
1439
|
_react.useEffect.call(void 0, () => {
|
|
1359
1440
|
if (!session || !refused) return;
|
|
1360
1441
|
session.transport.emit("error", refused);
|
|
1361
|
-
}, [session, _optionalChain([refused, 'optionalAccess',
|
|
1442
|
+
}, [session, _optionalChain([refused, 'optionalAccess', _41 => _41.code]), _optionalChain([refused, 'optionalAccess', _42 => _42.message])]);
|
|
1362
1443
|
const onrampHidden = config && session && !refused ? onrampUnavailable(config, session.hello.capabilities) : null;
|
|
1363
1444
|
_react.useEffect.call(void 0, () => {
|
|
1364
1445
|
if (!session || !onrampHidden) return;
|
|
1365
1446
|
session.transport.emit("error", onrampHidden);
|
|
1366
|
-
}, [session, _optionalChain([onrampHidden, 'optionalAccess',
|
|
1447
|
+
}, [session, _optionalChain([onrampHidden, 'optionalAccess', _43 => _43.code]), _optionalChain([onrampHidden, 'optionalAccess', _44 => _44.message])]);
|
|
1367
1448
|
const walletHidden = session && !refused && channelScope === "all-frames" ? {
|
|
1368
1449
|
code: UNSCOPED_CHANNEL_CODE,
|
|
1369
1450
|
message: "Wallet funding is hidden: every frame in this app's web view can reach the bridge channel. Scope the injected channel to the main frame."
|
|
@@ -1371,7 +1452,7 @@ function DepositEmbed({ target, onFatal }) {
|
|
|
1371
1452
|
_react.useEffect.call(void 0, () => {
|
|
1372
1453
|
if (!session || !walletHidden) return;
|
|
1373
1454
|
session.transport.emit("error", walletHidden);
|
|
1374
|
-
}, [session, _optionalChain([walletHidden, 'optionalAccess',
|
|
1455
|
+
}, [session, _optionalChain([walletHidden, 'optionalAccess', _45 => _45.code]), _optionalChain([walletHidden, 'optionalAccess', _46 => _46.message])]);
|
|
1375
1456
|
if (!session || !config || refused) return null;
|
|
1376
1457
|
const ready = config;
|
|
1377
1458
|
const { transport } = session;
|
|
@@ -1450,7 +1531,7 @@ function DepositEmbed({ target, onFatal }) {
|
|
|
1450
1531
|
) });
|
|
1451
1532
|
}
|
|
1452
1533
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1453
|
-
|
|
1534
|
+
_chunk76SNGRJ4cjs.DepositModalInner,
|
|
1454
1535
|
{
|
|
1455
1536
|
...toModalProps(ready, canOpenExternally, walletWithheld),
|
|
1456
1537
|
openExternally: canOpenExternally ? openExternally : void 0,
|
package/dist/embed.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DepositModalInner
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-V35JXQDL.mjs";
|
|
4
4
|
import {
|
|
5
5
|
markSubmissionUncertain
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-SSODFKQC.mjs";
|
|
7
|
+
import "./chunk-UIMR4O7B.mjs";
|
|
8
|
+
import "./chunk-5VTLHOWL.mjs";
|
|
9
9
|
import {
|
|
10
10
|
primeRuntimeChains
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-ULDG2NFL.mjs";
|
|
12
12
|
import {
|
|
13
13
|
MODAL_VERSION,
|
|
14
14
|
setEmbedHost
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-QO63RXOH.mjs";
|
|
16
16
|
import "./chunk-RN5VKWI6.mjs";
|
|
17
17
|
import {
|
|
18
18
|
HYPERCORE_SPOT_CAIP2,
|
|
@@ -1035,8 +1035,55 @@ function dismissalFor(input) {
|
|
|
1035
1035
|
function canGoBackNow(input) {
|
|
1036
1036
|
return dismissalFor(input).state !== "blocked";
|
|
1037
1037
|
}
|
|
1038
|
-
function uiStateFor(input) {
|
|
1039
|
-
return {
|
|
1038
|
+
function uiStateFor(input, contentHeight) {
|
|
1039
|
+
return {
|
|
1040
|
+
screen: input.screen,
|
|
1041
|
+
dismissal: dismissalFor(input),
|
|
1042
|
+
...contentHeight === void 0 ? {} : { contentHeight }
|
|
1043
|
+
};
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
// src/core/bridge/content-height.ts
|
|
1047
|
+
function measureContentHeight(shell) {
|
|
1048
|
+
const modal = shell.firstElementChild;
|
|
1049
|
+
const last = modal?.lastElementChild;
|
|
1050
|
+
if (!modal || !last) return void 0;
|
|
1051
|
+
const view = modal.ownerDocument.defaultView;
|
|
1052
|
+
const padding = view ? Number.parseFloat(view.getComputedStyle(modal).paddingBottom) : Number.NaN;
|
|
1053
|
+
const height = last.getBoundingClientRect().bottom - modal.getBoundingClientRect().top + (Number.isFinite(padding) ? padding : 0) + // The shell's own borders sit outside the modal and inside the sheet, so
|
|
1054
|
+
// they belong to the height a host is being asked for.
|
|
1055
|
+
(shell.offsetHeight - shell.clientHeight);
|
|
1056
|
+
return height > 0 ? Math.ceil(height) : void 0;
|
|
1057
|
+
}
|
|
1058
|
+
function observeContentHeight(shell, onChange) {
|
|
1059
|
+
const view = shell.ownerDocument.defaultView;
|
|
1060
|
+
if (!view?.ResizeObserver || !view.MutationObserver) return () => {
|
|
1061
|
+
};
|
|
1062
|
+
let last;
|
|
1063
|
+
const report = () => {
|
|
1064
|
+
const height = measureContentHeight(shell);
|
|
1065
|
+
if (height === void 0 || height === last) return;
|
|
1066
|
+
last = height;
|
|
1067
|
+
onChange(height);
|
|
1068
|
+
};
|
|
1069
|
+
const sizes = new view.ResizeObserver(report);
|
|
1070
|
+
const structure = new view.MutationObserver(() => rearm());
|
|
1071
|
+
function rearm() {
|
|
1072
|
+
sizes.disconnect();
|
|
1073
|
+
structure.disconnect();
|
|
1074
|
+
structure.observe(shell, { childList: true });
|
|
1075
|
+
const modal = shell.firstElementChild;
|
|
1076
|
+
if (modal) {
|
|
1077
|
+
structure.observe(modal, { childList: true });
|
|
1078
|
+
for (const child of Array.from(modal.children)) sizes.observe(child);
|
|
1079
|
+
}
|
|
1080
|
+
report();
|
|
1081
|
+
}
|
|
1082
|
+
rearm();
|
|
1083
|
+
return () => {
|
|
1084
|
+
sizes.disconnect();
|
|
1085
|
+
structure.disconnect();
|
|
1086
|
+
};
|
|
1040
1087
|
}
|
|
1041
1088
|
|
|
1042
1089
|
// src/core/bridge/viewport.ts
|
|
@@ -1066,10 +1113,10 @@ var UNKNOWN_SCREEN = "unknown";
|
|
|
1066
1113
|
// src/embed.tsx
|
|
1067
1114
|
import { jsx } from "react/jsx-runtime";
|
|
1068
1115
|
var WithdrawModal = lazy(
|
|
1069
|
-
() => import("./WithdrawModal-
|
|
1116
|
+
() => import("./WithdrawModal-EGUXJGKC.mjs").then((m) => ({ default: m.WithdrawModal }))
|
|
1070
1117
|
);
|
|
1071
1118
|
var ClaimModal = lazy(
|
|
1072
|
-
() => import("./ClaimModal-
|
|
1119
|
+
() => import("./ClaimModal-GECPNVYW.mjs").then((m) => ({ default: m.ClaimModal }))
|
|
1073
1120
|
);
|
|
1074
1121
|
function missingField(config, keys) {
|
|
1075
1122
|
const missing = keys.find(
|
|
@@ -1253,6 +1300,9 @@ function toModalProps(config, canOpenExternally, walletWithheld) {
|
|
|
1253
1300
|
debug: config.debug
|
|
1254
1301
|
};
|
|
1255
1302
|
}
|
|
1303
|
+
function currentShell() {
|
|
1304
|
+
return document.querySelector(".rs-modal-content.rs-embed");
|
|
1305
|
+
}
|
|
1256
1306
|
function DepositEmbed({ target, onFatal }) {
|
|
1257
1307
|
const [session, setSession] = useState(null);
|
|
1258
1308
|
const [config, setConfig] = useState(null);
|
|
@@ -1264,8 +1314,15 @@ function DepositEmbed({ target, onFatal }) {
|
|
|
1264
1314
|
screen: UNKNOWN_SCREEN,
|
|
1265
1315
|
submitting: false
|
|
1266
1316
|
});
|
|
1317
|
+
const contentHeightRef = useRef(void 0);
|
|
1318
|
+
const shellRef = useRef(null);
|
|
1319
|
+
const [shellToken, setShellToken] = useState(0);
|
|
1267
1320
|
const onFatalRef = useRef(onFatal);
|
|
1268
1321
|
onFatalRef.current = onFatal;
|
|
1322
|
+
const measuredHeight = useCallback(
|
|
1323
|
+
() => currentShell() === shellRef.current ? contentHeightRef.current : void 0,
|
|
1324
|
+
[]
|
|
1325
|
+
);
|
|
1269
1326
|
useEffect(
|
|
1270
1327
|
() => trackVisualViewport(target ?? globalThis.window),
|
|
1271
1328
|
[target]
|
|
@@ -1327,9 +1384,13 @@ function DepositEmbed({ target, onFatal }) {
|
|
|
1327
1384
|
(state) => {
|
|
1328
1385
|
if (isHomeScreen(state.screen)) completedRef.current = false;
|
|
1329
1386
|
uiRef.current = state;
|
|
1387
|
+
if (currentShell() !== shellRef.current) setShellToken((token) => token + 1);
|
|
1330
1388
|
session?.transport.emit(
|
|
1331
1389
|
"ui.state",
|
|
1332
|
-
uiStateFor(
|
|
1390
|
+
uiStateFor(
|
|
1391
|
+
{ ...state, walletRequestPending: walletPending },
|
|
1392
|
+
measuredHeight()
|
|
1393
|
+
)
|
|
1333
1394
|
);
|
|
1334
1395
|
},
|
|
1335
1396
|
[session, walletPending]
|
|
@@ -1345,9 +1406,29 @@ function DepositEmbed({ target, onFatal }) {
|
|
|
1345
1406
|
if (!session) return;
|
|
1346
1407
|
session.transport.emit(
|
|
1347
1408
|
"ui.state",
|
|
1348
|
-
uiStateFor(
|
|
1409
|
+
uiStateFor(
|
|
1410
|
+
{ ...uiRef.current, walletRequestPending: walletPending },
|
|
1411
|
+
measuredHeight()
|
|
1412
|
+
)
|
|
1349
1413
|
);
|
|
1350
|
-
}, [session, walletPending]);
|
|
1414
|
+
}, [session, walletPending, measuredHeight]);
|
|
1415
|
+
useEffect(() => {
|
|
1416
|
+
if (!session) return;
|
|
1417
|
+
const shell = currentShell();
|
|
1418
|
+
shellRef.current = shell;
|
|
1419
|
+
if (!shell) return;
|
|
1420
|
+
const stop = observeContentHeight(shell, (height) => {
|
|
1421
|
+
contentHeightRef.current = height;
|
|
1422
|
+
session.transport.emit(
|
|
1423
|
+
"ui.state",
|
|
1424
|
+
uiStateFor(
|
|
1425
|
+
{ ...uiRef.current, walletRequestPending: pendingRef.current },
|
|
1426
|
+
height
|
|
1427
|
+
)
|
|
1428
|
+
);
|
|
1429
|
+
});
|
|
1430
|
+
return stop;
|
|
1431
|
+
}, [session, shellToken]);
|
|
1351
1432
|
const refused = config && session ? refusal(config, session.hello.capabilities, channelScope) : null;
|
|
1352
1433
|
const walletWithheld = channelScope === "all-frames" || channelScope === "probing";
|
|
1353
1434
|
const refuseIfUnscoped = useCallback(async () => {
|
package/dist/index.cjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
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; } }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkBBHL7Y6Qcjs = require('./chunk-BBHL7Y6Q.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkH4GKLXX7cjs = require('./chunk-H4GKLXX7.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
10
|
-
require('./chunk-
|
|
11
|
-
require('./chunk-
|
|
12
|
-
require('./chunk-
|
|
13
|
-
require('./chunk-
|
|
14
|
-
require('./chunk-
|
|
9
|
+
var _chunk76SNGRJ4cjs = require('./chunk-76SNGRJ4.cjs');
|
|
10
|
+
require('./chunk-GGEX3J6J.cjs');
|
|
11
|
+
require('./chunk-6NMICTMH.cjs');
|
|
12
|
+
require('./chunk-E26VPCQS.cjs');
|
|
13
|
+
require('./chunk-UMHZX3KX.cjs');
|
|
14
|
+
require('./chunk-LHVHW2FC.cjs');
|
|
15
15
|
require('./chunk-DW2EQA2U.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
@@ -96,4 +96,4 @@ async function disconnectWallet() {
|
|
|
96
96
|
|
|
97
97
|
|
|
98
98
|
|
|
99
|
-
exports.ClaimModal =
|
|
99
|
+
exports.ClaimModal = _chunkH4GKLXX7cjs.ClaimModal; exports.DepositModal = _chunk76SNGRJ4cjs.DepositModal; exports.HYPERCORE_CHAIN_ID = _chunk4KCSH4T3cjs.HYPERCORE_CHAIN_ID; exports.HYPERCORE_SPOT_CAIP2 = _chunk4KCSH4T3cjs.HYPERCORE_SPOT_CAIP2; exports.HYPERCORE_USDC_ADDRESS = _chunk4KCSH4T3cjs.HYPERCORE_USDC_ADDRESS; exports.HYPERCORE_USDT0_ADDRESS = _chunk4KCSH4T3cjs.HYPERCORE_USDT0_ADDRESS; exports.NATIVE_TOKEN_ADDRESS = _chunk4KCSH4T3cjs.NATIVE_TOKEN_ADDRESS; exports.SUPPORTED_CHAIN_IDS = _chunk4KCSH4T3cjs.SUPPORTED_CHAIN_IDS; exports.WithdrawModal = _chunkBBHL7Y6Qcjs.WithdrawModal; exports.chainRegistry = _chunk4KCSH4T3cjs.chainRegistry; exports.disconnectWallet = disconnectWallet; exports.findChainIdForToken = _chunk4KCSH4T3cjs.findChainIdForToken; exports.getChainBadge = _chunk4KCSH4T3cjs.getChainBadge; exports.getChainIcon = _chunk4KCSH4T3cjs.getChainIcon; exports.getChainId = _chunk4KCSH4T3cjs.getChainId; exports.getChainName = _chunk4KCSH4T3cjs.getChainName; exports.getExplorerName = _chunk4KCSH4T3cjs.getExplorerName; exports.getExplorerTxUrl = _chunk4KCSH4T3cjs.getExplorerTxUrl; exports.getExplorerUrl = _chunk4KCSH4T3cjs.getExplorerUrl; exports.getSupportedChainIds = _chunk4KCSH4T3cjs.getSupportedChainIds; exports.getSupportedTargetTokens = _chunk4KCSH4T3cjs.getSupportedTargetTokens; exports.getSupportedTokenSymbolsForChain = _chunk4KCSH4T3cjs.getSupportedTokenSymbolsForChain; exports.getTargetTokenSymbolsForChain = _chunk4KCSH4T3cjs.getTargetTokenSymbolsForChain; exports.getTokenAddress = _chunk4KCSH4T3cjs.getTokenAddress; exports.getTokenDecimals = _chunk4KCSH4T3cjs.getTokenDecimals; exports.getTokenDecimalsByAddress = _chunk4KCSH4T3cjs.getTokenDecimalsByAddress; exports.getTokenIcon = _chunk4KCSH4T3cjs.getTokenIcon; exports.getTokenSymbol = _chunk4KCSH4T3cjs.getTokenSymbol; exports.getUsdcAddress = _chunk4KCSH4T3cjs.getUsdcAddress; exports.getUsdcDecimals = _chunk4KCSH4T3cjs.getUsdcDecimals; exports.isSupportedTokenAddressForChain = _chunk4KCSH4T3cjs.isSupportedTokenAddressForChain; exports.tokenIconUrl = _chunk4KCSH4T3cjs.tokenIconUrl;
|
package/dist/index.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WithdrawModal
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-URYV6A2L.mjs";
|
|
4
4
|
import {
|
|
5
5
|
ClaimModal
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HEBZWISE.mjs";
|
|
7
7
|
import {
|
|
8
8
|
DepositModal
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-V35JXQDL.mjs";
|
|
10
|
+
import "./chunk-SSODFKQC.mjs";
|
|
11
|
+
import "./chunk-UIMR4O7B.mjs";
|
|
12
|
+
import "./chunk-5VTLHOWL.mjs";
|
|
13
|
+
import "./chunk-ULDG2NFL.mjs";
|
|
14
|
+
import "./chunk-QO63RXOH.mjs";
|
|
15
15
|
import "./chunk-RN5VKWI6.mjs";
|
|
16
16
|
import {
|
|
17
17
|
HYPERCORE_CHAIN_ID,
|
package/dist/withdraw.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
6
|
-
require('./chunk-
|
|
3
|
+
var _chunkBBHL7Y6Qcjs = require('./chunk-BBHL7Y6Q.cjs');
|
|
4
|
+
require('./chunk-GGEX3J6J.cjs');
|
|
5
|
+
require('./chunk-UMHZX3KX.cjs');
|
|
6
|
+
require('./chunk-LHVHW2FC.cjs');
|
|
7
7
|
require('./chunk-4KCSH4T3.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
exports.WithdrawModal =
|
|
10
|
+
exports.WithdrawModal = _chunkBBHL7Y6Qcjs.WithdrawModal;
|
package/dist/withdraw.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WithdrawModal
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-URYV6A2L.mjs";
|
|
4
|
+
import "./chunk-SSODFKQC.mjs";
|
|
5
|
+
import "./chunk-ULDG2NFL.mjs";
|
|
6
|
+
import "./chunk-QO63RXOH.mjs";
|
|
7
7
|
import "./chunk-VUATPOWJ.mjs";
|
|
8
8
|
export {
|
|
9
9
|
WithdrawModal
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhinestone/deposit-modal",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20260901125921",
|
|
4
4
|
"description": "React modal component for Rhinestone cross-chain deposits",
|
|
5
5
|
"author": "Rhinestone <dev@rhinestone.wtf>",
|
|
6
6
|
"bugs": {
|
|
@@ -201,7 +201,7 @@
|
|
|
201
201
|
{
|
|
202
202
|
"name": "Native Embed (all three modes)",
|
|
203
203
|
"path": "dist/embed.mjs",
|
|
204
|
-
"limit": "
|
|
204
|
+
"limit": "100.2 kB",
|
|
205
205
|
"ignore": [
|
|
206
206
|
"react",
|
|
207
207
|
"react-dom",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunkLQIIVFFPcjs = require('./chunk-LQIIVFFP.cjs');
|
|
5
|
-
require('./chunk-WBUK27DO.cjs');
|
|
6
|
-
require('./chunk-AAWLOBUU.cjs');
|
|
7
|
-
require('./chunk-NOBMQXTO.cjs');
|
|
8
|
-
require('./chunk-32YGCXVS.cjs');
|
|
9
|
-
require('./chunk-4KCSH4T3.cjs');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.ClaimModal = _chunkLQIIVFFPcjs.ClaimModal; exports.buildClaimAnalyticsSessionProperties = _chunkLQIIVFFPcjs.buildClaimAnalyticsSessionProperties;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunkBZPPG7KUcjs = require('./chunk-BZPPG7KU.cjs');
|
|
5
|
-
require('./chunk-SXT4VLDP.cjs');
|
|
6
|
-
require('./chunk-NOBMQXTO.cjs');
|
|
7
|
-
require('./chunk-32YGCXVS.cjs');
|
|
8
|
-
require('./chunk-4KCSH4T3.cjs');
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
exports.WithdrawModal = _chunkBZPPG7KUcjs.WithdrawModal; exports.buildWithdrawAnalyticsSessionProperties = _chunkBZPPG7KUcjs.buildWithdrawAnalyticsSessionProperties;
|