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

Commit

Permalink
fix: comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hirbod committed Oct 30, 2023
1 parent 86274cf commit d4b573c
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/app/hooks/creator-token/use-creator-token-buy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const useCreatorTokenBuy = (params: {
chain: baseChain,
});
requestPayload = request;
console.log("token amount 1 request ", request);
console.log("token amount 1 simulation ", request);
} else {
const { request } = await publicClient.simulateContract({
address: profileData?.data?.profile.creator_token.address,
Expand All @@ -94,17 +94,20 @@ export const useCreatorTokenBuy = (params: {

console.log("simulate ", requestPayload);

console.log(requestPayload?.chain?.rpcUrls.default.http[0]);
console.log(
"Using following RPC for determing gas price",
requestPayload?.chain?.rpcUrls.default.http[0]
);
// Fetch current gas price from the Ethereum network
const provider = new providers.JsonRpcProvider(
requestPayload?.chain?.rpcUrls.default.http[0]
); // Replace `INFURA_URL` with your Ethereum RPC URL
);
let currentGasPrice = await provider.getGasPrice();
console.log("current Gas price", currentGasPrice);
console.log("current Gas price fetched from RPC", currentGasPrice);

// Adjust the gas price (e.g., increase it by 20% to be more competitive)
// Adjust the gas price (increase it by 20% to be more competitive)
const paddedGasPrice = currentGasPrice.mul(120).div(100);
console.log("padded gas price", paddedGasPrice);
console.log("padded gas price after calculation:", paddedGasPrice);

const transactionHash = await walletClient?.writeContract?.({
...requestPayload,
Expand Down

0 comments on commit d4b573c

Please sign in to comment.