From c2e438bdf60e07691fb2552cce7dd3bd2b390f29 Mon Sep 17 00:00:00 2001 From: paouvrard Date: Sat, 26 Oct 2024 00:38:14 +0900 Subject: [PATCH 1/2] fix: Add show details button state. --- packages/ethereum-wallets/src/lib/index.ts | 6 ++++++ packages/ethereum-wallets/src/lib/modal.ts | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/packages/ethereum-wallets/src/lib/index.ts b/packages/ethereum-wallets/src/lib/index.ts index 0d9acfe75..2afa5d6c6 100644 --- a/packages/ethereum-wallets/src/lib/index.ts +++ b/packages/ethereum-wallets/src/lib/index.ts @@ -591,6 +591,7 @@ const EthereumWallets: WalletBehaviourFactory< for (const [index, tx] of txs.entries()) { let txHash; let txError: string | null = null; + let showDetails = false; while (!txHash) { try { await (() => { @@ -599,6 +600,10 @@ const EthereumWallets: WalletBehaviourFactory< selectedIndex: index, ethTxHashes, error: txError, + showDetails, + onShowDetails: (state: boolean) => { + showDetails = state; + }, onConfirm: async () => { try { txError = null; @@ -606,6 +611,7 @@ const EthereumWallets: WalletBehaviourFactory< selectedIndex: index, ethTxHashes, error: txError, + showDetails, }); txHash = await executeTransaction({ tx, diff --git a/packages/ethereum-wallets/src/lib/modal.ts b/packages/ethereum-wallets/src/lib/modal.ts index ea8c46067..18a908297 100644 --- a/packages/ethereum-wallets/src/lib/modal.ts +++ b/packages/ethereum-wallets/src/lib/modal.ts @@ -98,11 +98,15 @@ export function createTxModal({ selectedIndex, ethTxHashes, error, + showDetails, + onShowDetails, onConfirm, }: { selectedIndex: number; ethTxHashes: Array; error?: string | null; + onShowDetails?: (state: boolean) => void; + showDetails?: boolean; onConfirm?: () => void; }) => { const container = document.querySelector( @@ -339,6 +343,16 @@ export function createTxModal({ ".ethereum-wallet-txs-details" ) as HTMLElement | null; + if (detailsContainer && toggleButton) { + if (showDetails) { + detailsContainer.style.display = "block"; + toggleButton.textContent = "Hide details"; + } else { + detailsContainer.style.display = "none"; + toggleButton.textContent = "Show details"; + } + } + toggleButton?.addEventListener("click", () => { if (!detailsContainer || !toggleButton) { return; @@ -350,9 +364,15 @@ export function createTxModal({ ) { detailsContainer.style.display = "block"; toggleButton.textContent = "Hide details"; + if (onShowDetails) { + onShowDetails(true); + } } else { detailsContainer.style.display = "none"; toggleButton.textContent = "Show details"; + if (onShowDetails) { + onShowDetails(false); + } } }); }; From f5249d7e3ce7e30a66e23bb568726e0f62347e63 Mon Sep 17 00:00:00 2001 From: paouvrard Date: Sat, 26 Oct 2024 00:38:51 +0900 Subject: [PATCH 2/2] fix: Dont disconnect when skipSignInAccessKey. --- packages/ethereum-wallets/src/lib/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ethereum-wallets/src/lib/index.ts b/packages/ethereum-wallets/src/lib/index.ts index 2afa5d6c6..0e55ec892 100644 --- a/packages/ethereum-wallets/src/lib/index.ts +++ b/packages/ethereum-wallets/src/lib/index.ts @@ -317,7 +317,7 @@ const EthereumWallets: WalletBehaviourFactory< options.network.networkId, devMode ? address + "." + devModeAccount : address ); - if (!keyPair) { + if (!keyPair && !skipSignInAccessKey) { try { wagmiCore!.disconnect(wagmiConfig); } catch (error) {