Skip to content

Commit

Permalink
Merge pull request #87 from FuelLabs/db/fix/correct-gas
Browse files Browse the repository at this point in the history
fix: use correct gas limit
  • Loading branch information
rishabhkeshan authored Dec 17, 2024
2 parents 168b53e + 88d9ab8 commit a31c288
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
8 changes: 3 additions & 5 deletions frontend/src/components/NewPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,9 @@ export default function NewPlayer({
);

request.addChangeOutput(gasCoin.owner, provider.getBaseAssetId());
const { gasLimit, maxFee } = await provider.estimateTxGasAndFee({
transactionRequest: request,
});
console.log(`New Player Cost gasLimit: ${gasLimit}, Maxfee: ${maxFee}`);
request.gasLimit = gasLimit;
const txCost = await wallet.getTransactionCost(request);
const { gasUsed, maxFee } = txCost;
request.gasLimit = gasUsed;
request.maxFee = maxFee;

// return;
Expand Down
9 changes: 4 additions & 5 deletions frontend/src/components/modals/HarvestModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,11 @@ export default function HarvestModal({
provider.getBaseAssetId()
);
request.addChangeOutput(gasCoin.owner, provider.getBaseAssetId());
const { gasLimit, maxFee } = await provider.estimateTxGasAndFee({
transactionRequest: request,
});
request.gasLimit = gasLimit;
const txCost = await wallet.getTransactionCost(request);
const { gasUsed, maxFee } = txCost;
request.gasLimit = gasUsed;
request.maxFee = maxFee;
console.log(`Harvest Cost gasLimit: ${gasLimit}, Maxfee: ${maxFee}`);
console.log(`Harvest Cost gasLimit: ${gasUsed}, Maxfee: ${maxFee}`);
const response = await axios.post(`http://167.71.42.88:3000/sign`, {
request: request.toJSON(),
jobId: data.jobId,
Expand Down
9 changes: 4 additions & 5 deletions frontend/src/components/modals/PlantModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,11 @@ export default function PlantModal({
provider.getBaseAssetId()
);
request.addChangeOutput(gasCoin.owner, provider.getBaseAssetId());
const { gasLimit, maxFee } = await provider.estimateTxGasAndFee({
transactionRequest: request,
});
request.gasLimit = gasLimit;
const txCost = await wallet.getTransactionCost(request);
const { gasUsed, maxFee } = txCost;
request.gasLimit = gasUsed;
request.maxFee = maxFee;
console.log(`Plant Cost gasLimit: ${gasLimit}, Maxfee: ${maxFee}`);
console.log(`Plant Cost gasLimit: ${gasUsed}, Maxfee: ${maxFee}`);
const response = await axios.post(`http://167.71.42.88:3000/sign`, {
request: request.toJSON(),
jobId: data.jobId,
Expand Down

0 comments on commit a31c288

Please sign in to comment.