There was an error while loading. Please reload this page.
1 parent 1d7d280 commit a079a74Copy full SHA for a079a74
1 file changed
packages/transactions/src/fetch.ts
@@ -197,10 +197,16 @@ export async function fetchFeeEstimateTransaction({
197
const response = await client.fetch(url, options);
198
199
if (!response.ok) {
200
- const body = await response.json().catch(() => ({}));
201
-
202
- if (body?.reason === 'NoEstimateAvailable') {
203
- throw new NoEstimateAvailableError(body?.reason_data?.message ?? '');
+ const body = await response.text().catch(() => '');
+
+ if (body.includes('NoEstimateAvailable')) {
+ let json: { reason_data?: { message?: string } } = {};
204
+ try {
205
+ json = JSON.parse(body);
206
+ } catch (err) {
207
+ // ignore
208
+ }
209
+ throw new NoEstimateAvailableError(json?.reason_data?.message ?? '');
210
}
211
212
throw new Error(
0 commit comments