Skip to content

Commit

Permalink
cherrypick fix: Fix transaction metric event asset type detection (#2…
Browse files Browse the repository at this point in the history
…4770) into v11.16.1 (#24843)

🍒-pick fix: Fix transaction metric event asset type detection
c1bba92 (#24770) into v11.16.1

Merge conflict in `shared/modules/transaction.utils.ts` (accepted
incoming):
```typescript
    try {
      // We don't need a balance check, so the second parameter to
      // getTokenStandardAndDetails is omitted.
<<<<<<< HEAD
      const details = getTokenStandardAndDetails(txMeta.txParams.to);
=======
      const details = await getTokenStandardAndDetails(txMeta.txParams.to);
>>>>>>> c1bba92 (fix: Fix transaction metric event asset type detection (#24770))
      if (details.standard) {
        return {
```

Co-authored-by: Mark Stacey <[email protected]>
  • Loading branch information
dbrans and Gudahtt authored May 28, 2024
1 parent 35bede7 commit 358859a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/scripts/lib/transaction/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ export type TransactionMetricsRequest = {
getEIP1559GasFeeEstimates(options?: FetchGasFeeEstimateOptions): Promise<any>;
getParticipateInMetrics: () => boolean;
getSelectedAddress: () => string;
getTokenStandardAndDetails: () => {
getTokenStandardAndDetails: () => Promise<{
decimals?: string;
balance?: string;
symbol?: string;
standard?: TokenStandard;
};
}>;
getTransaction: (transactionId: string) => TransactionMeta;
provider: Provider;
snapAndHardwareMessenger: SnapAndHardwareMessenger;
Expand Down
6 changes: 3 additions & 3 deletions shared/modules/transaction.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,12 @@ export async function determineTransactionType(
return { type: TransactionType.simpleSend, getCodeResponse: contractCode };
}

type GetTokenStandardAndDetails = (to: string | undefined) => {
type GetTokenStandardAndDetails = (to: string | undefined) => Promise<{
decimals?: string;
balance?: string;
symbol?: string;
standard?: TokenStandard;
};
}>;
/**
* Given a transaction meta object, determine the asset type that the
* transaction is dealing with, as well as the standard for the token if it
Expand Down Expand Up @@ -254,7 +254,7 @@ export async function determineTransactionAssetType(
try {
// We don't need a balance check, so the second parameter to
// getTokenStandardAndDetails is omitted.
const details = getTokenStandardAndDetails(txMeta.txParams.to);
const details = await getTokenStandardAndDetails(txMeta.txParams.to);
if (details.standard) {
return {
assetType:
Expand Down

0 comments on commit 358859a

Please sign in to comment.