@rhinestone/deposit-modal 0.6.0 → 0.6.1
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/dist/{DepositModalReown-J3KYAOD3.cjs → DepositModalReown-ICBGUVAA.cjs} +6 -6
- package/dist/{DepositModalReown-YD7TLEAA.mjs → DepositModalReown-IVRDXQAA.mjs} +3 -3
- package/dist/{WithdrawModalReown-QSQUV6HX.cjs → WithdrawModalReown-6XWURPFZ.cjs} +6 -6
- package/dist/{WithdrawModalReown-ZPDMX47Z.mjs → WithdrawModalReown-O7PR343Z.mjs} +3 -3
- package/dist/{chunk-DXGM6YET.mjs → chunk-7Q26RR6J.mjs} +1 -1
- package/dist/{chunk-GQDVHMOT.mjs → chunk-GBOCV2LQ.mjs} +112 -9
- package/dist/{chunk-7LVI3VAL.cjs → chunk-IZPUHIIN.cjs} +214 -204
- package/dist/{chunk-3JVGI7FC.mjs → chunk-N73D3WN4.mjs} +2 -2
- package/dist/{chunk-DASS33PJ.cjs → chunk-SITLCMTI.cjs} +57 -57
- package/dist/{chunk-NSAODZSS.mjs → chunk-TCLBFO3S.mjs} +20 -10
- package/dist/{chunk-ZDYV536Q.cjs → chunk-VPWWFWZT.cjs} +136 -33
- package/dist/{chunk-YYIE5U5K.cjs → chunk-VVKJRGX3.cjs} +4 -4
- package/dist/deposit.cjs +3 -3
- package/dist/deposit.mjs +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.mjs +3 -3
- package/dist/styles.css +20 -22
- package/dist/withdraw.cjs +3 -3
- package/dist/withdraw.mjs +2 -2
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkIZPUHIINcjs = require('./chunk-IZPUHIIN.cjs');
|
|
4
4
|
require('./chunk-NRNJAQUA.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
require('./chunk-
|
|
8
|
+
var _chunkVVKJRGX3cjs = require('./chunk-VVKJRGX3.cjs');
|
|
9
|
+
require('./chunk-VPWWFWZT.cjs');
|
|
10
10
|
require('./chunk-UEKPBRBY.cjs');
|
|
11
11
|
require('./chunk-ABVRVW3P.cjs');
|
|
12
12
|
|
|
@@ -16,7 +16,7 @@ var _react3 = require('@reown/appkit/react');
|
|
|
16
16
|
var _react5 = require('@reown/appkit-adapter-solana/react');
|
|
17
17
|
var _jsxruntime = require('react/jsx-runtime');
|
|
18
18
|
function DepositModalWithReown(props) {
|
|
19
|
-
const reown =
|
|
19
|
+
const reown = _chunkVVKJRGX3cjs.useReownWallet.call(void 0, );
|
|
20
20
|
const enableSolana = _nullishCoalesce(props.enableSolana, () => ( true));
|
|
21
21
|
const { walletProvider: solanaWalletProvider } = _react3.useAppKitProvider.call(void 0,
|
|
22
22
|
enableSolana ? "solana" : "eip155"
|
|
@@ -37,7 +37,7 @@ function DepositModalWithReown(props) {
|
|
|
37
37
|
reown.disconnect();
|
|
38
38
|
}, [reown.disconnect]);
|
|
39
39
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
40
|
-
|
|
40
|
+
_chunkIZPUHIINcjs.DepositModalInner,
|
|
41
41
|
{
|
|
42
42
|
...props,
|
|
43
43
|
reownWallet: reownWithSolana,
|
|
@@ -48,7 +48,7 @@ function DepositModalWithReown(props) {
|
|
|
48
48
|
}
|
|
49
49
|
function DepositModalReown(props) {
|
|
50
50
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
51
|
-
|
|
51
|
+
_chunkVVKJRGX3cjs.ReownWalletProvider,
|
|
52
52
|
{
|
|
53
53
|
projectId: props.reownAppId,
|
|
54
54
|
theme: props.theme,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DepositModalInner
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TCLBFO3S.mjs";
|
|
4
4
|
import "./chunk-FJWLC4AM.mjs";
|
|
5
5
|
import {
|
|
6
6
|
ReownWalletProvider,
|
|
7
7
|
useReownWallet
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-7Q26RR6J.mjs";
|
|
9
|
+
import "./chunk-GBOCV2LQ.mjs";
|
|
10
10
|
import "./chunk-F7P4MV72.mjs";
|
|
11
11
|
import "./chunk-WJX3TJFK.mjs";
|
|
12
12
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkSITLCMTIcjs = require('./chunk-SITLCMTI.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
8
|
-
require('./chunk-
|
|
7
|
+
var _chunkVVKJRGX3cjs = require('./chunk-VVKJRGX3.cjs');
|
|
8
|
+
require('./chunk-VPWWFWZT.cjs');
|
|
9
9
|
require('./chunk-UEKPBRBY.cjs');
|
|
10
10
|
require('./chunk-ABVRVW3P.cjs');
|
|
11
11
|
|
|
@@ -13,7 +13,7 @@ require('./chunk-ABVRVW3P.cjs');
|
|
|
13
13
|
var _react = require('react');
|
|
14
14
|
var _jsxruntime = require('react/jsx-runtime');
|
|
15
15
|
function WithdrawModalWithReown(props) {
|
|
16
|
-
const reown =
|
|
16
|
+
const reown = _chunkVVKJRGX3cjs.useReownWallet.call(void 0, );
|
|
17
17
|
const handleConnect = _react.useCallback.call(void 0, () => {
|
|
18
18
|
reown.openConnect();
|
|
19
19
|
}, [reown.openConnect]);
|
|
@@ -21,7 +21,7 @@ function WithdrawModalWithReown(props) {
|
|
|
21
21
|
reown.disconnect();
|
|
22
22
|
}, [reown.disconnect]);
|
|
23
23
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
24
|
-
|
|
24
|
+
_chunkSITLCMTIcjs.WithdrawModalInner,
|
|
25
25
|
{
|
|
26
26
|
...props,
|
|
27
27
|
reownWallet: reown,
|
|
@@ -32,7 +32,7 @@ function WithdrawModalWithReown(props) {
|
|
|
32
32
|
}
|
|
33
33
|
function WithdrawModalReown(props) {
|
|
34
34
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
35
|
-
|
|
35
|
+
_chunkVVKJRGX3cjs.ReownWalletProvider,
|
|
36
36
|
{
|
|
37
37
|
projectId: props.reownAppId,
|
|
38
38
|
theme: props.theme,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WithdrawModalInner
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-N73D3WN4.mjs";
|
|
4
4
|
import {
|
|
5
5
|
ReownWalletProvider,
|
|
6
6
|
useReownWallet
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-7Q26RR6J.mjs";
|
|
8
|
+
import "./chunk-GBOCV2LQ.mjs";
|
|
9
9
|
import "./chunk-F7P4MV72.mjs";
|
|
10
10
|
import "./chunk-WJX3TJFK.mjs";
|
|
11
11
|
|
|
@@ -2346,12 +2346,12 @@ function rankCryptoRows(descriptors) {
|
|
|
2346
2346
|
return descriptors.map((descriptor, index) => ({ descriptor, index })).sort((a, b) => {
|
|
2347
2347
|
const first = a.descriptor;
|
|
2348
2348
|
const second = b.descriptor;
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
if (
|
|
2354
|
-
if (
|
|
2349
|
+
const firstHasFunds = first.isBalanceSource && first.resolved && first.balanceUsd > 0;
|
|
2350
|
+
const secondHasFunds = second.isBalanceSource && second.resolved && second.balanceUsd > 0;
|
|
2351
|
+
const firstTier = firstHasFunds ? 0 : first.isBalanceSource ? 2 : 1;
|
|
2352
|
+
const secondTier = secondHasFunds ? 0 : second.isBalanceSource ? 2 : 1;
|
|
2353
|
+
if (firstTier !== secondTier) return firstTier - secondTier;
|
|
2354
|
+
if (firstTier === 0 && first.balanceUsd !== second.balanceUsd) {
|
|
2355
2355
|
return second.balanceUsd - first.balanceUsd;
|
|
2356
2356
|
}
|
|
2357
2357
|
return a.index - b.index;
|
|
@@ -3382,6 +3382,59 @@ function getCurrentPhaseId(state, phaseTimings) {
|
|
|
3382
3382
|
if (state.lastEvent?.type === "deposit-received") return "received";
|
|
3383
3383
|
return "confirming";
|
|
3384
3384
|
}
|
|
3385
|
+
function getCompletionDestinationTxHash(event) {
|
|
3386
|
+
const eventData = event?.data;
|
|
3387
|
+
const swapTxHash = eventData?.swap?.transactionHash;
|
|
3388
|
+
const destinationTxHash = eventData?.destination?.transactionHash;
|
|
3389
|
+
return swapTxHash ?? destinationTxHash;
|
|
3390
|
+
}
|
|
3391
|
+
function getTerminalProcessingOutcome(event) {
|
|
3392
|
+
if (event?.type === "post-bridge-swap-complete") {
|
|
3393
|
+
return {
|
|
3394
|
+
type: "complete",
|
|
3395
|
+
destinationTxHash: getCompletionDestinationTxHash(event)
|
|
3396
|
+
};
|
|
3397
|
+
}
|
|
3398
|
+
if (event?.type === "post-bridge-swap-failed") {
|
|
3399
|
+
return {
|
|
3400
|
+
type: "failed",
|
|
3401
|
+
message: formatBridgeFailedMessage(event).message
|
|
3402
|
+
};
|
|
3403
|
+
}
|
|
3404
|
+
if (event?.type === "bridge-complete") {
|
|
3405
|
+
return {
|
|
3406
|
+
type: "complete",
|
|
3407
|
+
destinationTxHash: getCompletionDestinationTxHash(event)
|
|
3408
|
+
};
|
|
3409
|
+
}
|
|
3410
|
+
if (event?.type === "bridge-failed") {
|
|
3411
|
+
return {
|
|
3412
|
+
type: "failed",
|
|
3413
|
+
message: formatBridgeFailedMessage(event).message
|
|
3414
|
+
};
|
|
3415
|
+
}
|
|
3416
|
+
if (event?.type === "error") {
|
|
3417
|
+
return {
|
|
3418
|
+
type: "failed",
|
|
3419
|
+
message: event.data?.message ?? "Unknown error"
|
|
3420
|
+
};
|
|
3421
|
+
}
|
|
3422
|
+
return null;
|
|
3423
|
+
}
|
|
3424
|
+
function getInitialProcessingState(event, txHash) {
|
|
3425
|
+
if (!event || !isEventForTx(event, txHash)) return null;
|
|
3426
|
+
const terminal = getTerminalProcessingOutcome(event);
|
|
3427
|
+
if (terminal?.type === "complete") {
|
|
3428
|
+
return { type: "complete", lastEvent: event };
|
|
3429
|
+
}
|
|
3430
|
+
if (terminal?.type === "failed") {
|
|
3431
|
+
return { type: "failed", message: terminal.message, lastEvent: event };
|
|
3432
|
+
}
|
|
3433
|
+
if (isDepositEvent(event)) {
|
|
3434
|
+
return { type: "processing", lastEvent: event };
|
|
3435
|
+
}
|
|
3436
|
+
return null;
|
|
3437
|
+
}
|
|
3385
3438
|
function ProcessingStep({
|
|
3386
3439
|
smartAccount,
|
|
3387
3440
|
solanaDepositAddress,
|
|
@@ -3395,6 +3448,7 @@ function ProcessingStep({
|
|
|
3395
3448
|
amountUsd,
|
|
3396
3449
|
service,
|
|
3397
3450
|
directTransfer,
|
|
3451
|
+
initialEvent,
|
|
3398
3452
|
flowLabel = "deposit",
|
|
3399
3453
|
debug,
|
|
3400
3454
|
targetToken,
|
|
@@ -3427,9 +3481,21 @@ function ProcessingStep({
|
|
|
3427
3481
|
const onDepositCompleteRef = useLatestRef(onDepositComplete);
|
|
3428
3482
|
const onDepositFailedRef = useLatestRef(onDepositFailed);
|
|
3429
3483
|
const onErrorRef = useLatestRef(onError);
|
|
3430
|
-
const
|
|
3431
|
-
|
|
3432
|
-
|
|
3484
|
+
const initialTerminalEventRef = useRef4(null);
|
|
3485
|
+
const [state, setState] = useState5(() => {
|
|
3486
|
+
if (directTransfer) return { type: "complete" };
|
|
3487
|
+
const initial = getInitialProcessingState(
|
|
3488
|
+
initialEvent,
|
|
3489
|
+
txHash
|
|
3490
|
+
);
|
|
3491
|
+
if (initial) {
|
|
3492
|
+
if (initial.type !== "processing") {
|
|
3493
|
+
initialTerminalEventRef.current = initial.lastEvent ?? null;
|
|
3494
|
+
}
|
|
3495
|
+
return initial;
|
|
3496
|
+
}
|
|
3497
|
+
return { type: "processing" };
|
|
3498
|
+
});
|
|
3433
3499
|
const [elapsedSeconds, setElapsedSeconds] = useState5(0);
|
|
3434
3500
|
const [phaseTimings, setPhaseTimings] = useState5(() => {
|
|
3435
3501
|
const saved = loadPhaseTimings(txHash);
|
|
@@ -3481,6 +3547,43 @@ function ProcessingStep({
|
|
|
3481
3547
|
txHash,
|
|
3482
3548
|
updatePhaseTimings
|
|
3483
3549
|
]);
|
|
3550
|
+
useEffect6(() => {
|
|
3551
|
+
const event = initialTerminalEventRef.current;
|
|
3552
|
+
if (!event) return;
|
|
3553
|
+
initialTerminalEventRef.current = null;
|
|
3554
|
+
const outcome = getTerminalProcessingOutcome(event);
|
|
3555
|
+
if (!outcome) return;
|
|
3556
|
+
if (outcome.type === "complete") {
|
|
3557
|
+
const context = processingContextRef.current;
|
|
3558
|
+
debugLog(debug, "processing", "initial-event:complete", {
|
|
3559
|
+
txHash,
|
|
3560
|
+
destinationTxHash: outcome.destinationTxHash,
|
|
3561
|
+
event: event.type
|
|
3562
|
+
});
|
|
3563
|
+
onDepositCompleteRef.current?.(txHash, outcome.destinationTxHash, {
|
|
3564
|
+
amount: context.amount,
|
|
3565
|
+
sourceChain: context.sourceChain,
|
|
3566
|
+
sourceToken: context.sourceToken,
|
|
3567
|
+
sourceDecimals: context.sourceDecimals,
|
|
3568
|
+
amountUsd: context.amountUsd,
|
|
3569
|
+
targetChain: context.targetChain,
|
|
3570
|
+
targetToken: context.targetToken
|
|
3571
|
+
});
|
|
3572
|
+
return;
|
|
3573
|
+
}
|
|
3574
|
+
debugLog(debug, "processing", "initial-event:failed", {
|
|
3575
|
+
txHash,
|
|
3576
|
+
message: outcome.message,
|
|
3577
|
+
event: event.type
|
|
3578
|
+
});
|
|
3579
|
+
onDepositFailedRef.current?.(txHash, outcome.message);
|
|
3580
|
+
}, [
|
|
3581
|
+
debug,
|
|
3582
|
+
onDepositCompleteRef,
|
|
3583
|
+
onDepositFailedRef,
|
|
3584
|
+
processingContextRef,
|
|
3585
|
+
txHash
|
|
3586
|
+
]);
|
|
3484
3587
|
useEffect6(() => {
|
|
3485
3588
|
if (directTransfer || state.type !== "processing") return;
|
|
3486
3589
|
const updateElapsed = () => {
|