Skip to content

Commit

Permalink
Add error handling for sendEstimateFeeTx (#330)
Browse files Browse the repository at this point in the history
* [skip ci]
  • Loading branch information
notV4l committed Mar 3, 2023
1 parent ab2b4c3 commit f54ccef
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/account-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,12 @@ export async function sendEstimateFeeTx(data: unknown) {
return this.toString();
};

const resp = await axios.post(
`${hre.starknet.networkConfig.url}/feeder_gateway/estimate_fee`,
data
);
const resp = await axios
.post(`${hre.starknet.networkConfig.url}/feeder_gateway/estimate_fee`, data)
.catch((error: AxiosError) => {
const msg = `Estimating fees failed: ${error.response.data.message}`;
throw new StarknetPluginError(msg, error);
});

const { gas_price, gas_usage, overall_fee, unit } = resp.data;
return {
Expand Down

0 comments on commit f54ccef

Please sign in to comment.