Skip to content

Commit

Permalink
ALL-5195 - Fix XDC transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
Hathoriel committed Feb 21, 2024
1 parent 178219b commit d103efd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 24 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tatumio",
"version": "2.2.48",
"version": "2.2.49",
"license": "MIT",
"repository": "https://github.com/tatumio/tatum-js",
"scripts": {
Expand Down
25 changes: 2 additions & 23 deletions packages/blockchain/xdc/src/lib/services/xdc.web3.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,7 @@
import { evmBasedWeb3 } from '@tatumio/shared-blockchain-evm-based'
import Web3 from 'web3'
import { EvmBasedBlockchain, httpHelper } from '@tatumio/shared-core'
import { hexToNumber } from 'web3-utils'
import { EvmBasedBlockchain } from '@tatumio/shared-core'

export const xdcWeb3 = (args: { blockchain: EvmBasedBlockchain; client?: Web3 }) => {
const evmBasedWeb3Result = evmBasedWeb3(args)

return {
...evmBasedWeb3Result,
async getGasPriceInWei(): Promise<string> {
const gasStationUrl = 'https://rpc.xinfin.network/'

try {
const { data } = await httpHelper.post(`${gasStationUrl}gasPrice`, {
jsonrpc: '2.0',
method: 'eth_gasPrice',
params: [],
id: 1,
})
const asNumber = hexToNumber(data.result)
return (data ? Web3.utils.toWei(`${asNumber}`, 'wei') : Web3.utils.toWei('0.25', 'gwei')).toString()
} catch (e) {
return Web3.utils.toWei('0.25', 'gwei')
}
},
}
return evmBasedWeb3(args)
}

0 comments on commit d103efd

Please sign in to comment.