Skip to content

Commit

Permalink
feat: use BE explorer values for txs (#1635)
Browse files Browse the repository at this point in the history
  • Loading branch information
derHowie authored Jul 29, 2024
1 parent 70cbe02 commit 295e74c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/core/types/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ type BaseTransaction = {
gasPrice?: string;
gasLimit?: string;
baseFee?: string;
explorer?: {
name: string;
url: string;
};
} & Partial<TransactionGasParams & TransactionLegacyGasParams>;

export type PendingTransaction = BaseTransaction & {
Expand Down Expand Up @@ -202,6 +206,8 @@ export type TransactionApiResponse = {
approval_to?: Address;
contract_name?: string;
contract_icon_url?: string;
explorer_label?: string;
explorer_url?: string;
type?: TransactionType;
action?: string;
asset?: AssetApiResponse;
Expand Down
7 changes: 7 additions & 0 deletions src/core/utils/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,12 @@ export function parseTransaction({
iconUrl: meta.contract_icon_url,
};

const explorer = meta.explorer_label &&
meta.explorer_url && {
name: meta.explorer_label,
url: meta.explorer_url,
};

return {
from: tx.address_from,
to: addressTo,
Expand All @@ -322,6 +328,7 @@ export function parseTransaction({
confirmations: tx.block_confirmations,
contract,
native,
explorer,
...fee,
} as RainbowTransaction;
}
Expand Down
4 changes: 3 additions & 1 deletion src/entries/popup/pages/home/Activity/ActivityDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,9 @@ function MoreOptions({
revoke?: boolean;
onRevoke: () => void;
}) {
const explorer = getTransactionBlockExplorer(transaction);
const explorer = transaction?.explorer?.name
? transaction.explorer
: getTransactionBlockExplorer(transaction);
const hash = transaction.hash;
return (
<DropdownMenu>
Expand Down

0 comments on commit 295e74c

Please sign in to comment.