Skip to content

Commit

Permalink
Merge pull request #815 from EdgeApp/matthew/backup-txreceipt
Browse files Browse the repository at this point in the history
Add evmscan fallback for eth_getTransactionReceipt in getL1RollupFee
  • Loading branch information
peachbits authored Aug 19, 2024
2 parents 30f7d20 + c0ee6b1 commit 2040c87
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- added: (Solana) Add new tokens: BSOL, DRIFT, HAWK, JITOSOL, JSOL, JTO, JUP, MIMO, MNGO, MSOL, SOL, USDC.e, WBTC, and WETH
- added: (EVM) Add dRPC nodes
- changed: Add evmscan fallback for `eth_getTransactionReceipt`in `getL1RollupFee`

## 4.19.0 (2024-08-12)

Expand Down
12 changes: 10 additions & 2 deletions src/ethereum/networkAdapters/EvmScanAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { add, max, mul, sub } from 'biggystring'
import { asMaybe } from 'cleaners'
import {
EdgeConfirmationState,
EdgeCurrencyInfo,
Expand Down Expand Up @@ -367,11 +368,18 @@ export class EvmScanAdapter extends NetworkAdapter<EvmScanAdapterConfig> {

let l1RollupFee = '0'
if (isSpend && this.ethEngine.networkInfo.optimismRollup === true) {
const response = await this.ethEngine.ethNetwork.multicastRpc(
const rpcResponse = await this.ethEngine.ethNetwork.multicastRpc(
'eth_getTransactionReceipt',
[txid]
)
const json = asGetTransactionReceipt(response.result.result)
let json = asMaybe(asGetTransactionReceipt)(rpcResponse.result.result)
if (json == null) {
const path = `?module=proxy&action=eth_getTransactionReceipt&txhash=${txid}`
const evmScanResponse = await this.serialServers(
async server => await this.fetchGetEtherscan(server, path)
)
json = asGetTransactionReceipt(evmScanResponse.result)
}
l1RollupFee = add(l1RollupFee, decimalToHex(json.l1Fee))
}

Expand Down

0 comments on commit 2040c87

Please sign in to comment.