-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4bfe2b6
commit 7ec8ed7
Showing
20 changed files
with
5,057 additions
and
4,913 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
import { IBlock } from "@maticnetwork/maticjs"; | ||
import { providers } from "ethers"; | ||
import { Block } from "ethers"; | ||
import BigNumber from "bignumber.js"; | ||
|
||
export const ethBlockToMaticBlock = (block: providers.Block) => { | ||
block.gasUsed = block.gasUsed.toNumber() as any; | ||
block.gasLimit = block.gasLimit.toNumber() as any; | ||
if ((block as any).baseFeePerGas) { | ||
(block as any).baseFeePerGas = block.baseFeePerGas.toHexString(); | ||
export const ethBlockToMaticBlock = (block: Block) => { | ||
const newBlock = block.toJSON(); | ||
newBlock.gasUsed = new BigNumber(newBlock.gasUsed.toString()).toNumber() as any; | ||
newBlock.gasLimit = new BigNumber(newBlock.gasLimit.toString()).toNumber() as any; | ||
if ((newBlock as any).baseFeePerGas) { | ||
(newBlock as any).baseFeePerGas = new BigNumber(newBlock.baseFeePerGas.toString()).toNumber() as any; | ||
} | ||
return block as any as IBlock; | ||
return newBlock as IBlock; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
import { ITransactionReceipt } from "@maticnetwork/maticjs"; | ||
import { providers } from "ethers"; | ||
|
||
export const ethReceiptToMaticReceipt = (receipt: providers.TransactionReceipt) => { | ||
import { TransactionReceipt } from "ethers"; | ||
import BigNumber from "bignumber.js"; | ||
|
||
export const ethReceiptToMaticReceipt = (receipt: TransactionReceipt) => { | ||
const maticReceipt: ITransactionReceipt = receipt as any; | ||
|
||
maticReceipt.gasUsed = receipt.gasUsed.toNumber(); | ||
maticReceipt.cumulativeGasUsed = receipt.cumulativeGasUsed.toNumber(); | ||
maticReceipt.gasUsed = new BigNumber(receipt.gasUsed.toString()).toNumber(); | ||
maticReceipt.cumulativeGasUsed = new BigNumber(receipt.cumulativeGasUsed.toString()).toNumber(); | ||
|
||
return maticReceipt; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.