File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
packages/transactions/src Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -197,10 +197,16 @@ export async function fetchFeeEstimateTransaction({
197197 const response = await client . fetch ( url , options ) ;
198198
199199 if ( ! response . ok ) {
200- const body = await response . json ( ) . catch ( ( ) => ( { } ) ) ;
201-
202- if ( body ?. reason === 'NoEstimateAvailable' ) {
203- throw new NoEstimateAvailableError ( body ?. reason_data ?. message ?? '' ) ;
200+ const body = await response . text ( ) . catch ( ( ) => '' ) ;
201+
202+ if ( body . includes ( 'NoEstimateAvailable' ) ) {
203+ 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 ?? '' ) ;
204210 }
205211
206212 throw new Error (
You can’t perform that action at this time.
0 commit comments