Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkNerdi committed May 17, 2024
1 parent bb307c7 commit 09bcf47
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ async function generateBaseEvmActivityFromBlockscoutTransaction(
recipient: blockscoutTransaction.to.hash.toLowerCase(),
from: blockscoutTransaction.from.hash.toLowerCase(),
gasUsed: Number(blockscoutTransaction.gas_used),
estimatedGas: localTransaction?.estimatedGas,
estimatedGas: localTransaction?.estimatedGas ? BigInt(localTransaction.estimatedGas) : undefined,
gasPrice: blockscoutTransaction.gas_price,
transactionHash: blockscoutTransaction.hash,
timestamp: new Date(blockscoutTransaction.timestamp).getTime(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export async function generateEvmActivityFromLocalEvmTransaction(
recipient: transferInfo.recipientAddress ?? to?.toString().toLowerCase(),
from: from?.toString().toLowerCase(),
gasUsed: Number(gasUsed),
estimatedGas,
estimatedGas: estimatedGas ? BigInt(estimatedGas) : undefined,
gasPrice: gasPrice ?? undefined,
transactionHash,
timestamp,
Expand Down Expand Up @@ -94,7 +94,7 @@ export async function generateEvmActivityFromLocalEvmTransaction(
recipient: to?.toString().toLowerCase(),
from: from?.toString().toLowerCase(),
gasUsed: Number(gasUsed),
estimatedGas,
estimatedGas: estimatedGas ? BigInt(estimatedGas) : undefined,
gasPrice: gasPrice ?? undefined,
transactionHash,
timestamp,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { EvmTransactionData } from '@core/layer-2/types'

export type LocalEvmTransaction = EvmTransactionData & {
// estimatedGas, gasLimit and nonce has to be a `number` instead of `biging` because bigints cannot be stored in local storage
export type LocalEvmTransaction = Omit<EvmTransactionData, 'estimatedGas' | 'gasLimit' | 'nonce'> & {
status: boolean
transactionHash: string
transactionIndex: number
blockNumber: number
to: string
from: string
gasUsed: number
estimatedGas?: number
gasLimit?: number
nonce?: number
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ export async function sendAndPersistTransactionFromEvm(
to: transactionReceipt.to,
from: transactionReceipt.from,
gasUsed: Number(transactionReceipt.gasUsed),
estimatedGas: Number(preparedTransaction.estimatedGas),
nonce: Number(preparedTransaction.nonce),
gasLimit: Number(preparedTransaction.gasLimit),
timestamp: Date.now(),
}
await persistEvmTransaction(profileId, account, evmNetwork, evmTransaction)
Expand Down

0 comments on commit 09bcf47

Please sign in to comment.