Skip to content
This repository has been archived by the owner on Feb 5, 2023. It is now read-only.

Commit

Permalink
Merge pull request #60 from NaturalSelectionLabs/feature/skip-gas-rec…
Browse files Browse the repository at this point in the history
…ommends

chore: skip gas recommends
  • Loading branch information
Atlas Quan authored Oct 6, 2021
2 parents f3c39eb + 6e3921a commit 2484fa1
Showing 1 changed file with 1 addition and 23 deletions.
24 changes: 1 addition & 23 deletions src/common/rns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,7 @@ async function callRNSContract<T>(
config.rns.contract[cname],
signer ? signer : provider,
);
let isView = false;
const abi = config.rns.contract[cname].find((item: any) => item.name === method);
if (abi) {
isView = abi.stateMutability === 'view';
}
return contract[method](...args, isView ? null : await makeTxParams(speed));
return contract[method](...args);
}

async function checkInfuraID(id: string) {
Expand All @@ -67,23 +62,6 @@ async function checkInfuraID(id: string) {
return false;
}

async function makeTxParams(speed: SPEED): Promise<ethers.Overrides> {
speed = speed ? speed : 'average';
const gasPrice = (
await axios.get('https://ethgasstation.info/api/ethgasAPI.json', {
params: {
'api-key': '403f08c04612ca8c165ae6855136505f7acf017b2662126699e43a874ef6',
},
})
).data;
let gasGwei: string = '30';
gasGwei = (gasPrice[speed] / 10).toString();
return {
gasLimit: 1000000,
gasPrice: ethers.utils.parseUnits(gasGwei, 'gwei'),
};
}

function getRNSContract(cname: CNAME) {
if (config.rns.test) {
return config.rns.contractNetworks.ropsten[cname];
Expand Down

0 comments on commit 2484fa1

Please sign in to comment.