Skip to content

Commit

Permalink
Merge pull request #1221 from aurora-is-near/pa/show-details
Browse files Browse the repository at this point in the history
Ethereum tx show details - skipSignInAccessKey bugfix
  • Loading branch information
paouvrard authored Nov 7, 2024
2 parents 21049d4 + f5249d7 commit b93c492
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
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

0 comments on commit b93c492

Please sign in to comment.