Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ethereum tx show details - skipSignInAccessKey bugfix #1221

Merged
merged 2 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/ethereum-wallets/src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 (() => {
Expand All @@ -599,13 +600,18 @@ const EthereumWallets: WalletBehaviourFactory<
selectedIndex: index,
ethTxHashes,
error: txError,
showDetails,
onShowDetails: (state: boolean) => {
showDetails = state;
},
onConfirm: async () => {
try {
txError = null;
renderTxs({
selectedIndex: index,
ethTxHashes,
error: txError,
showDetails,
});
txHash = await executeTransaction({
tx,
Expand Down
20 changes: 20 additions & 0 deletions packages/ethereum-wallets/src/lib/modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,15 @@ export function createTxModal({
selectedIndex,
ethTxHashes,
error,
showDetails,
onShowDetails,
onConfirm,
}: {
selectedIndex: number;
ethTxHashes: Array<string>;
error?: string | null;
onShowDetails?: (state: boolean) => void;
showDetails?: boolean;
onConfirm?: () => void;
}) => {
const container = document.querySelector(
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}
}
});
};
Expand Down
Loading