Skip to content

Commit

Permalink
fix: fetch before passing to qb
Browse files Browse the repository at this point in the history
  • Loading branch information
rpalakkal committed Jan 18, 2024
1 parent 18282c5 commit eaafccc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions client/src/sendQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ export const buildSendQuery = async (input: {
if (input.options.refundee === undefined) {
throw new Error("Refundee is required");
}
if (input.options.maxFeePerGas == undefined) {
const feeData = await input.axiom.config.provider.getFeeData();
input.options.maxFeePerGas = feeData.maxFeePerGas?.toString();
}
const qb: QueryBuilderV2 = query.new(
undefined,
input.computeQuery,
Expand All @@ -44,10 +48,6 @@ export const buildSendQuery = async (input: {
refundee,
dataQuery,
} = await qb.build(true);
if (input.options.maxFeePerGas == undefined) {
const maxFeePerGas = await input.axiom.config.provider.getFeeData();
feeData.maxFeePerGas = maxFeePerGas;
}
const payment = await qb.calculateFee();
const id = await qb.getQueryId(input.caller);
const abi = input.axiom.getAxiomQueryAbi();
Expand Down

0 comments on commit eaafccc

Please sign in to comment.