Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9817317

Browse files
committedMar 14, 2025··
chore: move tenderly insufficientBal param to controller
1 parent 6a8677a commit 9817317

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed
 

‎packages/bridge-controller/src/bridge-controller.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,21 @@ export class BridgeController extends StaticIntervalPollingController<BridgePoll
167167

168168
if (isValidQuoteRequest(updatedQuoteRequest)) {
169169
this.#quotesFirstFetched = Date.now();
170+
const providerConfig = this.#getSelectedNetworkClient()?.configuration;
170171

171-
// Query the balance of the source token if the source chain is an EVM chain
172172
let insufficientBal: boolean | undefined;
173173
if (isSolanaChainId(updatedQuoteRequest.srcChainId)) {
174+
// If the source chain is not an EVM network, get the insufficientBal value from the params
174175
insufficientBal = paramsToUpdate.insufficientBal;
176+
} else if (providerConfig?.rpcUrl?.includes('tenderly')) {
177+
// If the rpcUrl is a tenderly fork (e2e tests), set insufficientBal to true
178+
// The bridge-api filters out quotes if the balance on mainnet is insufficient
179+
// This override allows quotes to always be returned
180+
insufficientBal = true;
175181
} else {
182+
// Otherwise query the src token balance from the RPC provider
176183
insufficientBal =
177-
paramsToUpdate.insufficientBal ||
184+
paramsToUpdate.insufficientBal ??
178185
!(await this.#hasSufficientBalance(updatedQuoteRequest));
179186
}
180187

0 commit comments

Comments
 (0)
Please sign in to comment.