Skip to content

Commit 8d872f8

Browse files
spalladinoclaude
andcommitted
fix(wallet-sdk): narrow fee prediction fallback to method-not-found errors
Addresses PR #22116 review comment 2: the catch-all fallback could mask RPC connectivity issues by silently falling back to getCurrentMinFees. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4425ae5 commit 8d872f8

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

yarn-project/wallet-sdk/src/base-wallet/base_wallet.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,13 @@ export abstract class BaseWallet implements Wallet {
262262
return this.aztecNode.getCurrentMinFees();
263263
}
264264
return predicted.reduce((worst, fees) => (fees.feePerL2Gas > worst.feePerL2Gas ? fees : worst));
265-
} catch {
266-
// Fallback for old nodes that don't support getPredictedMinFees
267-
return this.aztecNode.getCurrentMinFees();
265+
} catch (err: any) {
266+
// Fallback for old nodes that don't support getPredictedMinFees.
267+
// Only fall back on method-not-found errors (JSON-RPC code -32601); rethrow others.
268+
if (err?.cause?.code === -32601 || err?.message?.includes('Method not found')) {
269+
return this.aztecNode.getCurrentMinFees();
270+
}
271+
throw err;
268272
}
269273
}
270274

0 commit comments

Comments
 (0)