From fd3225abbc1308e5230eeccb8a8777aee7a08e7a Mon Sep 17 00:00:00 2001 From: Luc van Kampen Date: Fri, 2 Aug 2024 16:41:43 +0200 Subject: [PATCH] Migrate API (#2) Co-authored-by: Jonatan Holmgren --- web/src/App.tsx | 27 +++-- web/src/etherscan/getTransactions.tsx | 120 ++++++++++++++++------ web/src/txHistory/TransactionEntry.tsx | 72 +++++++------ web/src/txHistory/TransactionHistory.tsx | 2 +- web/src/utils/aggregateTotals.ts | 26 +++-- web/src/utils/decodeTransaction.ts | 123 +++++++++++++---------- web/src/utils/formatGas.ts | 4 + web/src/utils/gasMagic.ts | 2 +- 8 files changed, 236 insertions(+), 140 deletions(-) create mode 100644 web/src/utils/formatGas.ts diff --git a/web/src/App.tsx b/web/src/App.tsx index 060f2fb..2991b71 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -10,6 +10,7 @@ import { decodeTransaction, } from './utils/decodeTransaction'; import { useEthUsd } from './utils/ethUsd'; +import { formatGas } from './utils/formatGas'; import { formatThousands } from './utils/formatThousands'; import { gasPriceMagic } from './utils/gasMagic'; @@ -26,7 +27,7 @@ export const App = () => { const decodedTransactions = useMemo( () => - data?.result.map(decodeTransaction).filter(Boolean) as + data?.items.map(decodeTransaction).filter(Boolean) as | AllMultiReturnTypes[] | undefined, [data] @@ -42,8 +43,6 @@ export const App = () => { console.log({ currentUSDCPrice }); - const gasPrice = 30n; - return (
@@ -58,13 +57,13 @@ export const App = () => {
- View on Etherscan + View on Blockscout
@@ -80,13 +79,15 @@ export const App = () => {
- {gasPrice.toString()} + {formatGas( + totals.commitGasPriceAverage + )}
~{' '} {gasPriceMagic( totals.commitAverage, - gasPrice, + totals.commitGasPriceAverage, currentUSDCPrice )}{' '} USD @@ -109,13 +110,15 @@ export const App = () => {
- {gasPrice.toString()} + {formatGas( + totals.registerGasPriceAverage + )}
~{' '} {gasPriceMagic( totals.registerAverage, - gasPrice, + totals.registerGasPriceAverage, currentUSDCPrice )}{' '} USD @@ -138,13 +141,15 @@ export const App = () => {
- {gasPrice.toString()} + {formatGas( + totals.renewGasPriceAverage + )}
~{' '} {gasPriceMagic( totals.renewAverage, - gasPrice, + totals.renewGasPriceAverage, currentUSDCPrice )}{' '} USD diff --git a/web/src/etherscan/getTransactions.tsx b/web/src/etherscan/getTransactions.tsx index 4fb39ec..c194e8f 100644 --- a/web/src/etherscan/getTransactions.tsx +++ b/web/src/etherscan/getTransactions.tsx @@ -1,35 +1,95 @@ -export type EtherscanTx = { - blockNumber: string; // "19453253", - timeStamp: string; // "1710662567", - hash: string; // "0x98ad1edfd22852f5ba4ac8deae943b700acb56da259d4fb19770fc3e5849e130", - nonce: string; // "527", - blockHash: string; // "0xc8305621d04ca2ce7339538f45cb7415b25e515955256260f9a955a0cc7a0e6c", - transactionIndex: string; // "88", - from: string; // "0x225f137127d9067788314bc7fcc1f36746a3c3b5", - to: string; // "", - value: string; // "0", - gas: string; // "1035099", - gasPrice: string; // "27000000000", - isError: string; // "0", - txreceipt_status: string; // "1", - input: string; // "0x608060405234801561001057600080fd5b50604051610d63380380610d6383398101604081905261002f91610095565b600080546001600160a01b031916339081178255604051909182917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600180546001600160a01b0319166001600160a01b03929092169190911790556100c5565b6000602082840312156100a757600080fd5b81516001600160a01b03811681146100be57600080fd5b9392505050565b610c8f806100d46000396000f3fe6080604052600436106100865760003560e01c8063590e1ae311610059578063590e1ae3146100d95780638da5cb5b146100e1578063d16050e61461011d578063f2fde38b14610130578063f77c47911461015057600080fd5b80630562a37e1461008b578063194fba10146100a05780632c7e9b39146100b35780633b7fb413146100c6575b600080fd5b61009e61009936600461072f565b610170565b005b61009e6100ae3660046107d2565b610384565b61009e6100c1366004610865565b6103f1565b61009e6100d43660046108b6565b610497565b61009e610568565b3480156100ed57600080fd5b50600054610101906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b61009e61012b366004610939565b6105c1565b34801561013c57600080fd5b5061009e61014b36600461097b565b610652565b34801561015c57600080fd5b50600154610101906001600160a01b031681565b8685146101c45760405162461bcd60e51b815260206004820181905260248201527f6e616d657320616e64206f776e657273206c656e677468206d69736d6174636860448201526064015b60405180910390fd5b6001546000906001600160a01b03166383e7f6ff8a8a84816101e8576101e861099d565b90506020028101906101fa91906109b3565b886040518463ffffffff1660e01b815260040161021993929190610a23565b602060405180830381865afa158015610236573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025a9190610a47565b90508760005b81811015610328576001546001600160a01b031663f7a16963848d8d8581811061028c5761028c61099d565b905060200281019061029e91906109b3565b8d8d878181106102b0576102b061099d565b90506020020160208101906102c5919061097b565b8c8c8c8c6040518963ffffffff1660e01b81526004016102eb9796959493929190610a60565b6000604051808303818588803b15801561030457600080fd5b505af1158015610318573d6000803e3d6000fd5b5050505050806001019050610260565b60006103348385610ac5565b90508034111561037657336108fc61034c8334610ae2565b6040518115909202916000818181858888f19350505050158015610374573d6000803e3d6000fd5b505b505050505050505050505050565b6040516302b151bf60e11b81523090630562a37e906103b6908a908a908a908a908a908a908a90600090600401610b3c565b600060405180830381600087803b1580156103d057600080fd5b505af11580156103e4573d6000803e3d6000fd5b5050505050505050505050565b8260005b8181101561048f576001546001600160a01b031663acf1a841848888858181106104215761042161099d565b905060200281019061043391906109b3565b886040518563ffffffff1660e01b815260040161045293929190610a23565b6000604051808303818588803b15801561046b57600080fd5b505af115801561047f573d6000803e3d6000fd5b50505050508060010190506103f5565b505050505050565b6000546001600160a01b031633146104c15760405162461bcd60e51b81526004016101bb90610c23565b6000836001600160a01b03163484846040516104de929190610c49565b60006040518083038185875af1925050503d806000811461051b576040519150601f19603f3d011682016040523d82523d6000602084013e610520565b606091505b50509050806105625760405162461bcd60e51b815260206004820152600e60248201526d195d1a18d85b1b0819985a5b195960921b60448201526064016101bb565b50505050565b6000546001600160a01b031633146105925760405162461bcd60e51b81526004016101bb90610c23565b60405133904780156108fc02916000818181858888f193505050501580156105be573d6000803e3d6000fd5b50565b8060005b81811015610562576001546001600160a01b031663f14fcbc88585848181106105f0576105f061099d565b905060200201356040518263ffffffff1660e01b815260040161061591815260200190565b600060405180830381600087803b15801561062f57600080fd5b505af1158015610643573d6000803e3d6000fd5b505050508060010190506105c5565b6000546001600160a01b0316331461067c5760405162461bcd60e51b81526004016101bb90610c23565b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b60008083601f8401126106d957600080fd5b50813567ffffffffffffffff8111156106f157600080fd5b6020830191508360208260051b850101111561070c57600080fd5b9250929050565b80356001600160a01b038116811461072a57600080fd5b919050565b60008060008060008060008060c0898b03121561074b57600080fd5b883567ffffffffffffffff8082111561076357600080fd5b61076f8c838d016106c7565b909a50985060208b013591508082111561078857600080fd5b506107958b828c016106c7565b90975095505060408901359350606089013592506107b560808a01610713565b91506107c360a08a01610713565b90509295985092959890939650565b600080600080600080600060a0888a0312156107ed57600080fd5b873567ffffffffffffffff8082111561080557600080fd5b6108118b838c016106c7565b909950975060208a013591508082111561082a57600080fd5b506108378a828b016106c7565b909650945050604088013592506060880135915061085760808901610713565b905092959891949750929550565b6000806000806060858703121561087b57600080fd5b843567ffffffffffffffff81111561089257600080fd5b61089e878288016106c7565b90989097506020870135966040013595509350505050565b6000806000604084860312156108cb57600080fd5b6108d484610713565b9250602084013567ffffffffffffffff808211156108f157600080fd5b818601915086601f83011261090557600080fd5b81358181111561091457600080fd5b87602082850101111561092657600080fd5b6020830194508093505050509250925092565b6000806020838503121561094c57600080fd5b823567ffffffffffffffff81111561096357600080fd5b61096f858286016106c7565b90969095509350505050565b60006020828403121561098d57600080fd5b61099682610713565b9392505050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e198436030181126109ca57600080fd5b83018035915067ffffffffffffffff8211156109e557600080fd5b60200191503681900382131561070c57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b604081526000610a376040830185876109fa565b9050826020830152949350505050565b600060208284031215610a5957600080fd5b5051919050565b60c081526000610a7460c08301898b6109fa565b6001600160a01b0397881660208401526040830196909652506060810193909352908416608083015290921660a09092019190915292915050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610adc57610adc610aaf565b92915050565b81810381811115610adc57610adc610aaf565b8183526000602080850194508260005b85811015610b31576001600160a01b03610b1e83610713565b1687529582019590820190600101610b05565b509495945050505050565b60c08082528101889052600060e060058a901b830181019083018b835b8c811015610bcd5785840360df190183528135368f9003601e19018112610b7f57600080fd5b8e01602081810191359067ffffffffffffffff821115610b9e57600080fd5b813603831315610bad57600080fd5b610bb88783856109fa565b96509485019493909301925050600101610b59565b5050508281036020840152610be381898b610af5565b915050856040830152846060830152610c0760808301856001600160a01b03169052565b6001600160a01b03831660a08301529998505050505050505050565b6020808252600c908201526b15539055551213d49256915160a21b604082015260600190565b818382376000910190815291905056fea26469706673582212205e8eb67cb463b1f94275f76d794ca62cbdb019444c0d7d27f5c74884640693fa64736f6c63430008160033000000000000000000000000283af0b28c62c092c9727f1ee09c02ca627eb7f5", - contractAddress: string; // "0xfc0a4a934410f34a9bb8b4f28bed6b960c943a7e", - cumulativeGasUsed: string; // "4870821", - gasUsed: string; // "796448", - confirmations: string; //"1410", - methodId: string; // "0x60806040", - functionName: string; //"atInversebrah(int248 a, uint48[] b, uint32 c, bytes20[] d, bytes30[] e)" +export type BlockscoutTx = { + timestamp: string; + fee: { + type: string; + value: string; + }; + gas_limit: string; + block: number; + status: string; + method: T; + confirmations: number; + type: number; + exchange_rate: string; + to: { + ens_domain_name: string | null; + hash: string; + implementation_address: string | null; + implementation_name: string | null; + implementations: string[]; + is_contract: boolean; + is_verified: boolean; + metadata: string | null; + name: string | null; + private_tags: string[]; + public_tags: string[]; + watchlist_names: string[]; + }; + tx_burnt_fee: string; + max_fee_per_gas: string; + result: string; + hash: string; + gas_price: string; + priority_fee: string; + base_fee_per_gas: string; + from: { + ens_domain_name: string | null; + hash: string; + implementation_address: string | null; + implementation_name: string | null; + implementations: string[]; + is_contract: boolean; + is_verified: boolean; + metadata: string | null; + name: string | null; + private_tags: string[]; + public_tags: string[]; + watchlist_names: string[]; + }; + token_transfers: any; + tx_types: string[]; + gas_used: string; + created_contract: any; + position: number; + nonce: number; + has_error_in_internal_txs: boolean; + actions: any[]; + decoded_input: { + method_call: string; + method_id: string; + parameters: { + name: string; + type: string; + value: string | string[]; + }[]; + }; + token_transfers_overflow: any; + raw_input: string; + value: string; + max_priority_fee_per_gas: string; + revert_reason: string | null; + confirmation_duration: [number, number]; + tx_tag: string | null; }; -export type EtherscanTxListResponse = { - status: '1'; - message: 'OK-Missing/Invalid API Key, rate limit of 1/5sec applied'; - result: EtherscanTx[]; +export type BlockscoutTxListResponse = { + items: BlockscoutTx[]; + next_page_params: { + block_number: number; + fee: string; + hash: string; + index: number; + inserted_at: string; + items_count: number; + value: string; + }; }; -export const getTransactions = async (contractAddress: string) => { +export const getTransactions = async ( + contractAddress: string +): Promise => { const response = await fetch( - `https://api.etherscan.io/api?module=account&action=txlist&address=${contractAddress}&startblock=0&endblock=99999999&page=1&offset=1000&sort=desc&apikey=YourApiKeyToken`, + `https://eth.blockscout.com/api/v2/addresses/${contractAddress}/transactions?filter=to`, { method: 'GET', headers: { @@ -39,9 +99,11 @@ export const getTransactions = async (contractAddress: string) => { } ); - const data = (await response.json()) as EtherscanTxListResponse; + const data = (await response.json()) as BlockscoutTxListResponse; - if (data.status === '1') return data; + if (data.items.length > 0) { + return data; + } throw new Error('Failed to fetch transactions'); }; diff --git a/web/src/txHistory/TransactionEntry.tsx b/web/src/txHistory/TransactionEntry.tsx index b95be87..e92473d 100644 --- a/web/src/txHistory/TransactionEntry.tsx +++ b/web/src/txHistory/TransactionEntry.tsx @@ -2,33 +2,31 @@ import { FC } from 'react'; import { BsFuelPump } from 'react-icons/bs'; import { FiBox, FiChevronDown } from 'react-icons/fi'; -import { LuFlame } from 'react-icons/lu'; import { formatFullAndRelativeDate } from '../utils/date'; -import { - AllMultiReturnTypes, - deriveLabelFromFunctionName, -} from '../utils/decodeTransaction'; +import { AllMultiReturnTypes } from '../utils/decodeTransaction'; import { useEthUsd } from '../utils/ethUsd'; import { formatThousands } from '../utils/formatThousands'; +const formatAddress = (address: string) => + address.slice(0, 6) + '...' + address.slice(-4); + export const TransactionEntry: FC<{ tx: AllMultiReturnTypes }> = ({ tx }) => { - const actionLabel = deriveLabelFromFunctionName(tx.functionName, tx.tx.to); - const ethUsd = useEthUsd(Number(tx.tx.timeStamp) * 1000); + const actionLabel = tx.method; + const date = new Date(tx.timestamp); + const ethUsd = useEthUsd(date.getTime()); - const { full, relative } = formatFullAndRelativeDate( - new Date(Number(tx.tx.timeStamp) * 1000) - ); + const { full, relative } = formatFullAndRelativeDate(date); return (
= ({ tx }) => { title="Blocknumber" > - {tx.tx.blockNumber} + {tx.block}
{relative}
- {actionLabel} + + {actionLabel} {tx.result === 'success' ? '👍' : '👎'} +
{tx.length > 0 && ( @@ -53,7 +53,7 @@ export const TransactionEntry: FC<{ tx: AllMultiReturnTypes }> = ({ tx }) => {
{formatThousands( - BigInt(tx.tx.gasUsed) / BigInt(tx.length) + BigInt(tx.gas_used) / BigInt(tx.length) )}
Per Name
@@ -62,7 +62,7 @@ export const TransactionEntry: FC<{ tx: AllMultiReturnTypes }> = ({ tx }) => {
-
{formatThousands(BigInt(tx.tx.gasUsed))}
+
{formatThousands(BigInt(tx.gas_used))}
{ethUsd.data ? (
@@ -70,8 +70,8 @@ export const TransactionEntry: FC<{ tx: AllMultiReturnTypes }> = ({ tx }) => { Number( (ethUsd.data * Number( - (BigInt(tx.tx.gasUsed) * - BigInt(tx.tx.gasPrice)) / + (BigInt(tx.gas_used) * + BigInt(tx.gas_price)) / 1_000_000_000_000_000n )) / 1_000_000 @@ -81,31 +81,24 @@ export const TransactionEntry: FC<{ tx: AllMultiReturnTypes }> = ({ tx }) => {
) : undefined}
-
- - {(Number(BigInt(tx.tx.gasPrice) / 100_000_000n) / 10) - .toPrecision(2) - .toString()} -
- +
- {['renewAll', 'multiRegister'].includes(tx.functionName) && ( + {['renewAll', 'multiRegister'].includes(tx.method) && (
Names
    - {tx.args[0].map((name, _index) => ( + {( + tx.decoded_input.parameters[0] + .value as string[] + ).map((name, _index) => (
  • = ({ tx }) => {
)} - {tx.functionName === 'multiCommit' && ( + {tx.method === 'multiCommit' && (
Commitments
-
    - {tx.args[0].map((commitment, _index) => ( -
  • {commitment}
  • +
      + {( + tx.decoded_input.parameters[0] + .value as string[] + ).map((commitment, _index) => ( +
    • + {formatAddress(commitment)} +
    • ))}
)} -
+
{JSON.stringify(tx)}
diff --git a/web/src/txHistory/TransactionHistory.tsx b/web/src/txHistory/TransactionHistory.tsx index a2d0caa..e98bda4 100644 --- a/web/src/txHistory/TransactionHistory.tsx +++ b/web/src/txHistory/TransactionHistory.tsx @@ -36,7 +36,7 @@ export const TransactionHistory: FC<{ {txs.length > 0 && (
{txs.filter(Boolean).map((tx) => ( - + ))}
)} diff --git a/web/src/utils/aggregateTotals.ts b/web/src/utils/aggregateTotals.ts index fc004bd..a670368 100644 --- a/web/src/utils/aggregateTotals.ts +++ b/web/src/utils/aggregateTotals.ts @@ -3,37 +3,51 @@ import { AllMultiReturnTypes } from './decodeTransaction'; export const aggregateTotals = (txs: AllMultiReturnTypes[]) => { const aggregates = txs.reduce( (aggregate, current) => { - if (current?.functionName == 'renewAll') { + if (current.revert_reason != undefined) return aggregate; + + if (current?.method == 'renewAll') { aggregate.renewCount += BigInt(current.length); - aggregate.renewTotal += BigInt(current.tx.gasUsed); + aggregate.renewTotal += BigInt(current.gas_used); + aggregate.renewGasPriceCount += BigInt(current.gas_price); } - if (current?.functionName == 'multiCommit') { + if (current?.method == 'multiCommit') { aggregate.commitCount += BigInt(current.length); - aggregate.commitTotal += BigInt(current.tx.gasUsed); + aggregate.commitTotal += BigInt(current.gas_used); + aggregate.commitGasPriceCount += BigInt(current.gas_price); } - if (current?.functionName == 'multiRegister') { + if (current?.method == 'multiRegister') { aggregate.registerCount += BigInt(current.length); - aggregate.registerTotal += BigInt(current.tx.gasUsed); + aggregate.registerTotal += BigInt(current.gas_used); + aggregate.registerGasPriceCount += BigInt(current.gas_price); } return aggregate; }, { commitTotal: 0n, + commitGasPriceCount: 0n, commitCount: 0n, renewTotal: 0n, + renewGasPriceCount: 0n, renewCount: 0n, registerTotal: 0n, + registerGasPriceCount: 0n, registerCount: 0n, } ); return { commitAverage: aggregates.commitTotal / aggregates.commitCount, + commitGasPriceAverage: + aggregates.commitGasPriceCount / aggregates.commitCount, registerAverage: aggregates.registerTotal / aggregates.registerCount, + registerGasPriceAverage: + aggregates.registerGasPriceCount / aggregates.registerCount, renewAverage: aggregates.renewTotal / aggregates?.renewCount, + renewGasPriceAverage: + aggregates.renewGasPriceCount / aggregates?.renewCount, ...aggregates, }; }; diff --git a/web/src/utils/decodeTransaction.ts b/web/src/utils/decodeTransaction.ts index c679f22..969b15f 100644 --- a/web/src/utils/decodeTransaction.ts +++ b/web/src/utils/decodeTransaction.ts @@ -1,20 +1,8 @@ -import { decodeFunctionData } from 'viem'; +import { BlockscoutTx } from '../etherscan/getTransactions'; -import { ultraBulkAbi } from '../abi'; -import { EtherscanTx } from '../etherscan/getTransactions'; - -type DecodedFunction = { - functionName: K; - args: V; - length: number; - tx: EtherscanTx; -}; -type MultiRegisterType = DecodedFunction< - 'multiRegister', - [string[], string[], bigint, string, string] ->; -type MultiCommitType = DecodedFunction<'multiCommit', [string[]]>; -type MultiRenewType = DecodedFunction<'renewAll', [string[], bigint, bigint]>; +type MultiRegisterType = BlockscoutTx<'multiRegister'> & { length: number }; +type MultiCommitType = BlockscoutTx<'multiCommit'> & { length: number }; +type MultiRenewType = BlockscoutTx<'renewAll'> & { length: number }; export type AllMultiReturnTypes = | MultiRegisterType @@ -22,50 +10,75 @@ export type AllMultiReturnTypes = | MultiRenewType; export const decodeTransaction = ( - tx: EtherscanTx + tx: BlockscoutTx ): AllMultiReturnTypes | undefined => { - // If contract Create - if (tx.to == '') { + // If contract Create skip + if (!tx.to) { return; } - try { - const { args, functionName } = decodeFunctionData({ - abi: ultraBulkAbi, - data: tx.input as '0x{string}', - }); - - const length = getNameLength(functionName, args as any); - - if (functionName == 'multiRegister' && args) { - return { - functionName, - args, - length, - tx, - } as MultiRegisterType; - } - - if (functionName == 'multiCommit' && args) { - return { - functionName, - args, - length, - tx, - } as MultiCommitType; - } - - if (functionName == 'renewAll' && args) { - return { - functionName, - args, - length, - tx, - } as MultiRenewType; - } - } catch (error) { - console.error({ e: error }); + if ( + tx.method == 'multiRegister' && + Array.isArray(tx.decoded_input.parameters[0].value) + ) { + return { + ...tx, + length: tx.decoded_input.parameters[0].value.length, + } as MultiRegisterType; + } + + if (tx.method == 'multiCommit') { + return { + ...tx, + length: tx.decoded_input.parameters[0].value.length, + } as MultiCommitType; } + + if (tx.method == 'renewAll') { + return { + ...tx, + length: tx.decoded_input.parameters[0].value.length, + } as MultiRenewType; + } + + // try { + // const { args, functionName } = decodeFunctionData({ + // abi: ultraBulkAbi, + // data: tx.input as '0x{string}', + // }); + + // const length = getNameLength(functionName, args as any); + + // if (functionName == 'multiRegister' && args) { + // return { + // functionName, + // args, + // length, + // tx, + // } as MultiRegisterType; + // } + + // if (functionName == 'multiCommit' && args) { + // return { + // functionName, + // args, + // length, + // tx, + // } as MultiCommitType; + // } + + // if (functionName == 'renewAll' && args) { + // return { + // functionName, + // args, + // length, + // tx, + // } as MultiRenewType; + // } + // } catch (error) { + // console.error({ e: error }); + // } + return tx; }; export const deriveLabelFromFunctionName = ( diff --git a/web/src/utils/formatGas.ts b/web/src/utils/formatGas.ts new file mode 100644 index 0000000..e0bf24c --- /dev/null +++ b/web/src/utils/formatGas.ts @@ -0,0 +1,4 @@ +// Divide by 10e8 to get gwei but keep 2 decimals of precision so 1.23 return as string +export const formatGas = (gas: BigInt): string => { + return (Number(BigInt(gas.toString()) / BigInt(10e6)) / 10).toString(); +}; diff --git a/web/src/utils/gasMagic.ts b/web/src/utils/gasMagic.ts index 1574cd4..36a5eb8 100644 --- a/web/src/utils/gasMagic.ts +++ b/web/src/utils/gasMagic.ts @@ -5,7 +5,7 @@ export const gasPriceMagic = ( ) => { return ( Number( - BigInt(Math.round(Number(gas * gasPrice * 1000n) * ethUSDC)) / + BigInt(Math.round(Number((gas * gasPrice) / 10_000n) * ethUSDC)) / 1_000_000n ) / 1_000_000_000 ).toPrecision(3);