Skip to content

Commit

Permalink
move check to quote method
Browse files Browse the repository at this point in the history
  • Loading branch information
kev1n-peters authored and nik-suri committed Dec 4, 2024
1 parent 40a4f92 commit 2541fe9
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions sdk/route/src/automatic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,6 @@ export class NttAutomaticRoute<N extends Network>
request: routes.RouteTransferRequest<N>,
params: Tp
): Promise<Vr> {
if (!(await this.isAvailable(request))) {
return {
valid: false,
params,
error: new Error("Relaying is not available"),
};
}

const options = params.options ?? this.getDefaultOptions();

const gasDropoff = amount.parse(
Expand Down Expand Up @@ -168,6 +160,13 @@ export class NttAutomaticRoute<N extends Network>
ntt: params.normalizedParams.sourceContracts,
});

if (!(await ntt.isRelayingAvailable(toChain.chain))) {
return {
success: false,
error: new Error(`Relaying to chain ${toChain.chain} is not available`),
};
}

const deliveryPrice = await ntt.quoteDeliveryPrice(
toChain.chain,
params.normalizedParams.options
Expand Down

0 comments on commit 2541fe9

Please sign in to comment.