@abstraxn/signer-react 3.3.9 → 4.0.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.
- package/CHANGELOG.md +44 -0
- package/dist/src/ConnectButton.css.d.ts +2 -0
- package/dist/src/ConnectButton.css.js +1 -0
- package/dist/src/ConnectButton.d.ts +0 -1
- package/dist/src/ConnectButton.js +7 -6
- package/dist/src/ExternalWalletButtons.css.d.ts +2 -0
- package/dist/src/ExternalWalletButtons.css.js +1 -0
- package/dist/src/ExternalWalletButtons.d.ts +4 -1
- package/dist/src/ExternalWalletButtons.js +6 -1
- package/dist/src/WalletModal.css +2 -0
- package/dist/src/WalletModal.css.d.ts +2 -0
- package/dist/src/WalletModal.css.js +1 -0
- package/dist/src/WalletModal.d.ts +2 -2
- package/dist/src/WalletModal.js +113 -59
- package/dist/src/components/AbstraxnLogo.d.ts +17 -0
- package/dist/src/components/AbstraxnLogo.js +29 -0
- package/dist/src/components/AbstraxnProvider/AbstraxnProviderInner.js +406 -338
- package/dist/src/components/AbstraxnProvider/useAbstraxnProviderBase.d.ts +7 -0
- package/dist/src/components/AbstraxnProvider/useAbstraxnProviderBase.js +9 -0
- package/dist/src/components/AbstraxnProvider/useWalletInitialization.js +41 -6
- package/dist/src/components/OnboardingUI/OnboardingUI.css +99 -4
- package/dist/src/components/OnboardingUI/OnboardingUI.css.d.ts +2 -0
- package/dist/src/components/OnboardingUI/OnboardingUI.css.js +1 -0
- package/dist/src/components/OnboardingUI/OnboardingUIReact.d.ts +0 -1
- package/dist/src/components/OnboardingUI/OnboardingUIReact.js +46 -19
- package/dist/src/components/OnboardingUI/OnboardingUIWeb.d.ts +24 -1
- package/dist/src/components/OnboardingUI/OnboardingUIWeb.js +348 -160
- package/dist/src/components/OnboardingUI/components/Divider.d.ts +7 -0
- package/dist/src/components/OnboardingUI/components/Divider.js +9 -0
- package/dist/src/components/OnboardingUI/components/EmailForm.d.ts +0 -1
- package/dist/src/components/OnboardingUI/components/EmailForm.js +1 -2
- package/dist/src/components/OnboardingUI/components/MfaForm.d.ts +0 -1
- package/dist/src/components/OnboardingUI/components/MfaForm.js +2 -3
- package/dist/src/components/OnboardingUI/components/Modal.d.ts +0 -1
- package/dist/src/components/OnboardingUI/components/Modal.js +12 -4
- package/dist/src/components/OnboardingUI/components/OtpForm.d.ts +0 -1
- package/dist/src/components/OnboardingUI/components/OtpForm.js +2 -3
- package/dist/src/components/OnboardingUI/components/PasskeyButton.d.ts +0 -1
- package/dist/src/components/OnboardingUI/components/PasskeyButton.js +2 -2
- package/dist/src/components/OnboardingUI/components/SocialButtons.d.ts +0 -1
- package/dist/src/components/OnboardingUI/components/SocialButtons.js +3 -3
- package/dist/src/components/OnboardingUI/onboardingShadowContainer.d.ts +9 -0
- package/dist/src/components/OnboardingUI/onboardingShadowContainer.js +36 -0
- package/dist/src/components/ShadowHost/ShadowHost.d.ts +18 -0
- package/dist/src/components/ShadowHost/ShadowHost.js +123 -0
- package/dist/src/components/ShadowHost/ShadowHostContext.d.ts +10 -0
- package/dist/src/components/ShadowHost/ShadowHostContext.js +14 -0
- package/dist/src/components/ShadowHost/index.d.ts +2 -0
- package/dist/src/components/ShadowHost/index.js +3 -0
- package/dist/src/components/WalletModal/components/ChainSelector.css +9 -0
- package/dist/src/components/WalletModal/components/ChainSelector.css.d.ts +2 -0
- package/dist/src/components/WalletModal/components/ChainSelector.css.js +1 -0
- package/dist/src/components/WalletModal/components/ChainSelector.d.ts +0 -1
- package/dist/src/components/WalletModal/components/ChainSelector.js +78 -23
- package/dist/src/components/WalletModal/components/CodeInput.d.ts +12 -0
- package/dist/src/components/WalletModal/components/CodeInput.js +39 -0
- package/dist/src/components/WalletModal/components/ExportKeyModal.css.d.ts +2 -0
- package/dist/src/components/WalletModal/components/ExportKeyModal.css.js +1 -0
- package/dist/src/components/WalletModal/components/ExportKeyModal.d.ts +0 -2
- package/dist/src/components/WalletModal/components/ExportKeyModal.js +2 -4
- package/dist/src/components/WalletModal/components/ExportWarningModal.css.d.ts +2 -0
- package/dist/src/components/WalletModal/components/ExportWarningModal.css.js +1 -0
- package/dist/src/components/WalletModal/components/ExportWarningModal.d.ts +0 -2
- package/dist/src/components/WalletModal/components/ExportWarningModal.js +2 -4
- package/dist/src/components/WalletModal/components/ManageWalletModal.css +27 -1
- package/dist/src/components/WalletModal/components/ManageWalletModal.css.d.ts +2 -0
- package/dist/src/components/WalletModal/components/ManageWalletModal.css.js +1 -0
- package/dist/src/components/WalletModal/components/ManageWalletModal.d.ts +0 -1
- package/dist/src/components/WalletModal/components/ManageWalletModal.js +66 -148
- package/dist/src/components/WalletModal/components/MfaVerifyModal.d.ts +15 -0
- package/dist/src/components/WalletModal/components/MfaVerifyModal.js +98 -0
- package/dist/src/components/WalletModal/components/PreviewTransactionModal.css +2 -12
- package/dist/src/components/WalletModal/components/PreviewTransactionModal.css.d.ts +2 -0
- package/dist/src/components/WalletModal/components/PreviewTransactionModal.css.js +1 -0
- package/dist/src/components/WalletModal/components/PreviewTransactionModal.d.ts +0 -1
- package/dist/src/components/WalletModal/components/PreviewTransactionModal.js +0 -1
- package/dist/src/components/WalletModal/components/ReceiveModal.css.d.ts +2 -0
- package/dist/src/components/WalletModal/components/ReceiveModal.css.js +1 -0
- package/dist/src/components/WalletModal/components/ReceiveModal.d.ts +0 -1
- package/dist/src/components/WalletModal/components/ReceiveModal.js +2 -2
- package/dist/src/components/WalletModal/components/SendModal.css.d.ts +2 -0
- package/dist/src/components/WalletModal/components/SendModal.css.js +1 -0
- package/dist/src/components/WalletModal/components/SendModal.d.ts +5 -2
- package/dist/src/components/WalletModal/components/SendModal.js +25 -82
- package/dist/src/components/WalletModal/components/SignMfaModalHost.d.ts +1 -0
- package/dist/src/components/WalletModal/components/SignMfaModalHost.js +50 -0
- package/dist/src/components/WalletModal/components/SuccessModal.css.d.ts +2 -0
- package/dist/src/components/WalletModal/components/SuccessModal.css.js +1 -0
- package/dist/src/components/WalletModal/components/SuccessModal.d.ts +0 -1
- package/dist/src/components/WalletModal/components/SuccessModal.js +0 -1
- package/dist/src/components/WalletModal/components/TokenSelectorModal.css.d.ts +2 -0
- package/dist/src/components/WalletModal/components/TokenSelectorModal.css.js +1 -0
- package/dist/src/components/WalletModal/components/TokenSelectorModal.d.ts +0 -1
- package/dist/src/components/WalletModal/components/TokenSelectorModal.js +0 -1
- package/dist/src/components/WalletModal/components/UserAvatar.js +2 -1
- package/dist/src/components/WalletModal/components/index.d.ts +3 -0
- package/dist/src/components/WalletModal/components/index.js +2 -0
- package/dist/src/components/WalletModal/hooks/useSendTransaction.js +18 -6
- package/dist/src/components/icons.d.ts +2 -0
- package/dist/src/components/icons.js +4 -0
- package/dist/src/hooks.d.ts +81 -20
- package/dist/src/hooks.js +194 -36
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.js +2 -2
- package/dist/src/signMfaBridge.d.ts +7 -0
- package/dist/src/signMfaBridge.js +20 -0
- package/dist/src/types.d.ts +4 -0
- package/dist/src/utils/shadowFocus.d.ts +8 -0
- package/dist/src/utils/shadowFocus.js +15 -0
- package/dist/src/utils/shadowRegistry.d.ts +23 -0
- package/dist/src/utils/shadowRegistry.js +36 -0
- package/dist/src/walletConnectMobile.d.ts +9 -5
- package/dist/src/walletConnectMobile.js +152 -51
- package/package.json +9 -4
|
@@ -569,19 +569,57 @@ export function clearWalletConnectPendingState(provider) {
|
|
|
569
569
|
// ignore
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
|
+
/** EIP-1193 4001 / WC 5000 (and common message shapes). */
|
|
573
|
+
export function isUserRejectionError(error) {
|
|
574
|
+
const walk = (err, depth = 0) => {
|
|
575
|
+
if (err == null || depth > 8)
|
|
576
|
+
return false;
|
|
577
|
+
if (typeof err === "string") {
|
|
578
|
+
return /user rejected|rejected by user|user denied|denied transaction|request rejected|cancelled by user/i.test(err);
|
|
579
|
+
}
|
|
580
|
+
if (typeof err !== "object")
|
|
581
|
+
return false;
|
|
582
|
+
const e = err;
|
|
583
|
+
if (e.code === 4001 || e.code === 5000 || e.code === "4001" || e.code === "ACTION_REJECTED") {
|
|
584
|
+
return true;
|
|
585
|
+
}
|
|
586
|
+
if (typeof e.name === "string" && /UserRejected/i.test(e.name))
|
|
587
|
+
return true;
|
|
588
|
+
const msg = `${e.message ?? ""} ${e.shortMessage ?? ""}`;
|
|
589
|
+
if (/user rejected|rejected by user|user denied|denied transaction|request rejected|user cancelled|user canceled/i.test(msg)) {
|
|
590
|
+
return true;
|
|
591
|
+
}
|
|
592
|
+
return walk(e.cause, depth + 1);
|
|
593
|
+
};
|
|
594
|
+
return walk(error);
|
|
595
|
+
}
|
|
596
|
+
export function toUserRejectionError(error) {
|
|
597
|
+
if (error instanceof Error && isUserRejectionError(error)) {
|
|
598
|
+
const err = new Error("User rejected the request");
|
|
599
|
+
err.code = 4001;
|
|
600
|
+
err.cause = error;
|
|
601
|
+
return err;
|
|
602
|
+
}
|
|
603
|
+
const err = new Error("User rejected the request");
|
|
604
|
+
err.code = 4001;
|
|
605
|
+
if (error !== undefined)
|
|
606
|
+
err.cause = error;
|
|
607
|
+
return err;
|
|
608
|
+
}
|
|
572
609
|
/**
|
|
573
|
-
*
|
|
574
|
-
*
|
|
610
|
+
* Success-only recovery: find an on-chain hash when WC never returns one.
|
|
611
|
+
* Does not infer reject (that is handled by relay resume + reject fallback).
|
|
575
612
|
*/
|
|
576
613
|
export async function pollForOutgoingTx(params) {
|
|
577
|
-
const { publicClient, from, to, dataPrefix, value, startBlock, signal, timeoutMs =
|
|
614
|
+
const { publicClient, from, to, dataPrefix, value, startBlock, signal, timeoutMs = 60_000, initialDelayMs = 1_000, } = params;
|
|
615
|
+
await waitUntilDocumentVisible();
|
|
616
|
+
if (signal.cancelled)
|
|
617
|
+
throw new Error("cancelled");
|
|
578
618
|
if (initialDelayMs > 0) {
|
|
579
619
|
await new Promise((r) => setTimeout(r, initialDelayMs));
|
|
580
620
|
}
|
|
581
|
-
if (signal.cancelled)
|
|
621
|
+
if (signal.cancelled)
|
|
582
622
|
throw new Error("cancelled");
|
|
583
|
-
}
|
|
584
|
-
await waitUntilDocumentVisible();
|
|
585
623
|
const fromLc = from.toLowerCase();
|
|
586
624
|
const toLc = to.toLowerCase();
|
|
587
625
|
const prefixLc = dataPrefix ? dataPrefix.toLowerCase() : undefined;
|
|
@@ -589,11 +627,7 @@ export async function pollForOutgoingTx(params) {
|
|
|
589
627
|
while (!signal.cancelled && Date.now() - started < timeoutMs) {
|
|
590
628
|
try {
|
|
591
629
|
const latest = await publicClient.getBlockNumber();
|
|
592
|
-
const fromBlock = startBlock > 0n
|
|
593
|
-
? startBlock
|
|
594
|
-
: latest > 12n
|
|
595
|
-
? latest - 12n
|
|
596
|
-
: 0n;
|
|
630
|
+
const fromBlock = startBlock > 0n ? startBlock : latest > 12n ? latest - 12n : 0n;
|
|
597
631
|
for (let b = fromBlock; b <= latest; b++) {
|
|
598
632
|
if (signal.cancelled)
|
|
599
633
|
break;
|
|
@@ -609,7 +643,8 @@ export async function pollForOutgoingTx(params) {
|
|
|
609
643
|
continue;
|
|
610
644
|
if (String(tx.to || "").toLowerCase() !== toLc)
|
|
611
645
|
continue;
|
|
612
|
-
if (value !== undefined &&
|
|
646
|
+
if (value !== undefined &&
|
|
647
|
+
BigInt(tx.value ?? 0) !== value) {
|
|
613
648
|
continue;
|
|
614
649
|
}
|
|
615
650
|
if (prefixLc) {
|
|
@@ -625,11 +660,83 @@ export async function pollForOutgoingTx(params) {
|
|
|
625
660
|
}
|
|
626
661
|
}
|
|
627
662
|
catch {
|
|
628
|
-
// RPC blip
|
|
663
|
+
// RPC blip
|
|
629
664
|
}
|
|
630
665
|
await new Promise((r) => setTimeout(r, 2_000));
|
|
631
666
|
}
|
|
632
|
-
|
|
667
|
+
// Stay pending until cancelled — reject UX is owned by the approval race.
|
|
668
|
+
if (signal.cancelled)
|
|
669
|
+
throw new Error("cancelled");
|
|
670
|
+
await new Promise(() => { });
|
|
671
|
+
throw new Error("cancelled");
|
|
672
|
+
}
|
|
673
|
+
/** Time-bounded force-resume (must not hang on transportOpen). */
|
|
674
|
+
export async function forceResumeWalletConnectOnReturn(provider, timeoutMs = 1_500) {
|
|
675
|
+
if (!provider)
|
|
676
|
+
return;
|
|
677
|
+
try {
|
|
678
|
+
provider[NEEDS_RESUME_FLAG] = true;
|
|
679
|
+
await Promise.race([
|
|
680
|
+
resumeWalletConnectRelayer(provider, { force: true }),
|
|
681
|
+
new Promise((resolve) => setTimeout(resolve, timeoutMs)),
|
|
682
|
+
]);
|
|
683
|
+
}
|
|
684
|
+
catch {
|
|
685
|
+
// best-effort
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
async function readPendingNonce(provider) {
|
|
689
|
+
try {
|
|
690
|
+
const accounts = provider?.accounts ||
|
|
691
|
+
provider?.session?.namespaces?.eip155?.accounts?.map((a) => a.includes(":") ? a.split(":").pop() : a) ||
|
|
692
|
+
[];
|
|
693
|
+
const address = accounts[0];
|
|
694
|
+
if (!address || typeof provider.request !== "function")
|
|
695
|
+
return null;
|
|
696
|
+
// Use unbound original if patched — readPendingNonce is called from
|
|
697
|
+
// inside the patch with the live provider; eth_getTransactionCount is
|
|
698
|
+
// not an approval method so the patch forwards it.
|
|
699
|
+
const hex = await provider.request({
|
|
700
|
+
method: "eth_getTransactionCount",
|
|
701
|
+
params: [address, "pending"],
|
|
702
|
+
});
|
|
703
|
+
return typeof hex === "string" ? parseInt(hex, 16) : Number(hex);
|
|
704
|
+
}
|
|
705
|
+
catch {
|
|
706
|
+
return null;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* Prefer WC delivering real approve/reject after return (docs: respondSessionRequest).
|
|
711
|
+
* If still pending with no nonce bump → EIP-1193-style user rejection.
|
|
712
|
+
* If nonce moved → do not fake reject (let success hash arrive via WC or poll).
|
|
713
|
+
*/
|
|
714
|
+
async function raceApprovalWithResumeAndRejectFallback(resultPromise, provider, startNonce) {
|
|
715
|
+
const normalizedResult = resultPromise.then((v) => v, (err) => {
|
|
716
|
+
if (isUserRejectionError(err))
|
|
717
|
+
throw toUserRejectionError(err);
|
|
718
|
+
throw err;
|
|
719
|
+
});
|
|
720
|
+
const rejectFallback = (async () => {
|
|
721
|
+
await waitUntilDocumentVisible();
|
|
722
|
+
await forceResumeWalletConnectOnReturn(provider, 1_500);
|
|
723
|
+
await new Promise((r) => setTimeout(r, 400));
|
|
724
|
+
await forceResumeWalletConnectOnReturn(provider, 1_500);
|
|
725
|
+
// Window for MetaMask's real JSON-RPC reject/hash after resume.
|
|
726
|
+
await new Promise((r) => setTimeout(r, 5_000));
|
|
727
|
+
if (!hasPendingWalletConnectApproval(provider)) {
|
|
728
|
+
return await new Promise(() => { });
|
|
729
|
+
}
|
|
730
|
+
const currentNonce = await readPendingNonce(provider);
|
|
731
|
+
if (startNonce != null &&
|
|
732
|
+
currentNonce != null &&
|
|
733
|
+
currentNonce > startNonce) {
|
|
734
|
+
// Tx submitted — confirmation path owns this.
|
|
735
|
+
return await new Promise(() => { });
|
|
736
|
+
}
|
|
737
|
+
throw toUserRejectionError();
|
|
738
|
+
})();
|
|
739
|
+
return await Promise.race([normalizedResult, rejectFallback]);
|
|
633
740
|
}
|
|
634
741
|
function getRequestMethod(args) {
|
|
635
742
|
const payload = args[0];
|
|
@@ -661,7 +768,10 @@ export function patchWalletConnectProviderForMobile(provider) {
|
|
|
661
768
|
}
|
|
662
769
|
if (!isApproval && wasBackgrounded) {
|
|
663
770
|
try {
|
|
664
|
-
await
|
|
771
|
+
await Promise.race([
|
|
772
|
+
resumeWalletConnectRelayer(provider, { force: true }),
|
|
773
|
+
new Promise((resolve) => setTimeout(resolve, 1_500)),
|
|
774
|
+
]);
|
|
665
775
|
}
|
|
666
776
|
finally {
|
|
667
777
|
provider[NEEDS_RESUME_FLAG] = false;
|
|
@@ -669,10 +779,10 @@ export function patchWalletConnectProviderForMobile(provider) {
|
|
|
669
779
|
return originalRequest(...args);
|
|
670
780
|
}
|
|
671
781
|
let cancelDeeplinks;
|
|
782
|
+
let startNonce = null;
|
|
672
783
|
if (isApproval) {
|
|
673
784
|
provider[PENDING_FLAG] = (provider[PENDING_FLAG] || 0) + 1;
|
|
674
|
-
|
|
675
|
-
// during connect (no session yet).
|
|
785
|
+
startNonce = await readPendingNonce(provider);
|
|
676
786
|
if (hasActiveWalletConnectSession(provider)) {
|
|
677
787
|
hideWalletConnectModal(provider);
|
|
678
788
|
}
|
|
@@ -680,29 +790,24 @@ export function patchWalletConnectProviderForMobile(provider) {
|
|
|
680
790
|
restoreWalletConnectModal();
|
|
681
791
|
}
|
|
682
792
|
syncWalletConnectDappRedirect(provider);
|
|
683
|
-
// Mark before deeplink so a fast backgrounding still triggers force-resume.
|
|
684
793
|
provider[NEEDS_RESUME_FLAG] = true;
|
|
685
794
|
}
|
|
686
795
|
try {
|
|
687
|
-
// Never force-restart right before sending a new tx — that is what
|
|
688
|
-
// blocked the MetaMask popup on Create Proposal after 3.3.7.
|
|
689
796
|
await Promise.race([
|
|
690
797
|
resumeWalletConnectRelayer(provider, { force: false }),
|
|
691
798
|
new Promise((resolve) => setTimeout(resolve, 1000)),
|
|
692
799
|
]);
|
|
693
800
|
const resultPromise = originalRequest(...args);
|
|
694
801
|
if (isApproval) {
|
|
695
|
-
// Do NOT auto-deeplink when a session already exists.
|
|
696
|
-
// WC ethereum-provider already opens the peer wallet; our extra
|
|
697
|
-
// metamask:// calls queue iOS "Open in MetaMask?" dialogs that stay
|
|
698
|
-
// on screen after the tx is confirmed (JS cannot dismiss them).
|
|
699
|
-
// Connect flow (no session) may still use a single scheduled open.
|
|
700
802
|
if (!hasActiveWalletConnectSession(provider)) {
|
|
701
803
|
cancelDeeplinks = scheduleOpenConnectedWalletApp(provider);
|
|
702
804
|
}
|
|
703
805
|
else {
|
|
704
806
|
hideWalletConnectModal(provider);
|
|
705
807
|
}
|
|
808
|
+
if (isMobileDevice()) {
|
|
809
|
+
return await raceApprovalWithResumeAndRejectFallback(resultPromise, provider, startNonce);
|
|
810
|
+
}
|
|
706
811
|
}
|
|
707
812
|
return await resultPromise;
|
|
708
813
|
}
|
|
@@ -711,7 +816,6 @@ export function patchWalletConnectProviderForMobile(provider) {
|
|
|
711
816
|
if (isApproval) {
|
|
712
817
|
provider[PENDING_FLAG] = Math.max(0, (provider[PENDING_FLAG] || 1) - 1);
|
|
713
818
|
provider.__abstraxnWcDeeplinkOpened = false;
|
|
714
|
-
// Close picker that may have been left open after approve/reject.
|
|
715
819
|
hideWalletConnectModal(provider);
|
|
716
820
|
if (!hasPendingWalletConnectApproval(provider)) {
|
|
717
821
|
provider[NEEDS_RESUME_FLAG] = false;
|
|
@@ -721,8 +825,8 @@ export function patchWalletConnectProviderForMobile(provider) {
|
|
|
721
825
|
};
|
|
722
826
|
}
|
|
723
827
|
/**
|
|
724
|
-
* When the dapp tab is shown again
|
|
725
|
-
*
|
|
828
|
+
* When the dapp tab is shown again, restart the relay so pending
|
|
829
|
+
* approve/reject responses can be delivered (WalletConnect mobile linking).
|
|
726
830
|
*/
|
|
727
831
|
export function subscribeWalletConnectForegroundResume(provider) {
|
|
728
832
|
if (typeof window === "undefined" || !provider)
|
|
@@ -732,35 +836,32 @@ export function subscribeWalletConnectForegroundResume(provider) {
|
|
|
732
836
|
timers.splice(0).forEach((t) => clearTimeout(t));
|
|
733
837
|
const pending = hasPendingWalletConnectApproval(provider);
|
|
734
838
|
const needsResume = pending || !!provider[NEEDS_RESUME_FLAG];
|
|
735
|
-
// Do not restart after connect-only backgrounding — that broke the next
|
|
736
|
-
// session_request so MetaMask never opened for Create Proposal.
|
|
737
839
|
if (!needsResume) {
|
|
738
840
|
clearWalletReturnIfSameDocument();
|
|
739
841
|
return;
|
|
740
842
|
}
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
void resumeWalletConnectRelayer(provider, { force: true }).then(() => {
|
|
751
|
-
if (!hasPendingWalletConnectApproval(provider)) {
|
|
752
|
-
provider[NEEDS_RESUME_FLAG] = false;
|
|
753
|
-
hideWalletConnectModal(provider);
|
|
754
|
-
}
|
|
755
|
-
});
|
|
756
|
-
// Do not restoreWalletConnectModal here — that reopens "All Wallets".
|
|
757
|
-
if (!hasActiveWalletConnectSession(provider)) {
|
|
758
|
-
restoreWalletConnectModal();
|
|
759
|
-
}
|
|
760
|
-
else {
|
|
843
|
+
const run = () => {
|
|
844
|
+
if (!hasPendingWalletConnectApproval(provider) &&
|
|
845
|
+
!provider[NEEDS_RESUME_FLAG]) {
|
|
846
|
+
return;
|
|
847
|
+
}
|
|
848
|
+
clearWalletReturnIfSameDocument();
|
|
849
|
+
void forceResumeWalletConnectOnReturn(provider, 1_500).then(() => {
|
|
850
|
+
if (!hasPendingWalletConnectApproval(provider)) {
|
|
851
|
+
provider[NEEDS_RESUME_FLAG] = false;
|
|
761
852
|
hideWalletConnectModal(provider);
|
|
762
853
|
}
|
|
763
|
-
}
|
|
854
|
+
});
|
|
855
|
+
if (!hasActiveWalletConnectSession(provider)) {
|
|
856
|
+
restoreWalletConnectModal();
|
|
857
|
+
}
|
|
858
|
+
else {
|
|
859
|
+
hideWalletConnectModal(provider);
|
|
860
|
+
}
|
|
861
|
+
};
|
|
862
|
+
run();
|
|
863
|
+
[800, 2_000].forEach((ms) => {
|
|
864
|
+
timers.push(setTimeout(run, ms));
|
|
764
865
|
});
|
|
765
866
|
};
|
|
766
867
|
const onVisibility = () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abstraxn/signer-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "React SDK for Abstraxn Wallet - React components, hooks, and providers for seamless Web3 wallet integration",
|
|
5
5
|
"main": "./dist/src/index.js",
|
|
6
6
|
"module": "./dist/src/index.js",
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"Wallet Provider"
|
|
26
26
|
],
|
|
27
27
|
"scripts": {
|
|
28
|
-
"build": "rimraf dist && tsc && cp -r src/components/OnboardingUI/*.css dist/src/components/OnboardingUI/ 2>/dev/null || true && cp src/*.css dist/src/ 2>/dev/null || true && mkdir -p dist/src/components/WalletModal/components && cp src/components/WalletModal/components/*.css dist/src/components/WalletModal/components/ 2>/dev/null || true"
|
|
28
|
+
"build": "rimraf dist && tsc && node scripts/build-css-modules.mjs && cp -r src/components/OnboardingUI/*.css dist/src/components/OnboardingUI/ 2>/dev/null || true && cp src/*.css dist/src/ 2>/dev/null || true && mkdir -p dist/src/components/WalletModal/components && cp src/components/WalletModal/components/*.css dist/src/components/WalletModal/components/ 2>/dev/null || true",
|
|
29
|
+
"test": "vitest run"
|
|
29
30
|
},
|
|
30
31
|
"author": "Team Abstraxn <developer@abstraxn.com> (https://www.abstraxn.com/)",
|
|
31
32
|
"license": "MIT",
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
"access": "public"
|
|
41
42
|
},
|
|
42
43
|
"dependencies": {
|
|
43
|
-
"@abstraxn/signer-core": "2.
|
|
44
|
+
"@abstraxn/signer-core": "^2.2.0",
|
|
44
45
|
"@abstraxn/solana-relayer": "^1.1.0",
|
|
45
46
|
"@solana/wallet-adapter-base": "^0.9.27",
|
|
46
47
|
"@solana/wallet-adapter-react": "^0.15.39",
|
|
@@ -57,11 +58,15 @@
|
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
59
60
|
"@tanstack/react-query": "^5.90.16",
|
|
61
|
+
"@testing-library/jest-dom": "^7.0.1",
|
|
62
|
+
"@testing-library/react": "^16.3.2",
|
|
60
63
|
"@types/node": "^25.0.3",
|
|
61
64
|
"@types/react": ">=18.2.0",
|
|
62
65
|
"@types/react-dom": ">=18.2.0",
|
|
66
|
+
"jsdom": "^29.1.1",
|
|
63
67
|
"rimraf": "^6.1.2",
|
|
64
|
-
"typescript": "^5.9.3"
|
|
68
|
+
"typescript": "^5.9.3",
|
|
69
|
+
"vitest": "^4.1.11"
|
|
65
70
|
},
|
|
66
71
|
"peerDependencies": {
|
|
67
72
|
"@tanstack/react-query": "^5.90.16",
|