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

chore: skip gas recommends #60

Merged
merged 2 commits into from
Oct 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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