Skip to content

Commit

Permalink
bug-fixes, handle region error in bridgers
Browse files Browse the repository at this point in the history
  • Loading branch information
PseudoElement committed Jul 22, 2024
1 parent 3c3e6ff commit c2a257f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ export interface BridgersSwapResponse<
data: {
txData: T;
};
resCode: number;
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class EvmBridgersCrossChainTrade extends EvmCrossChainTrade {
this.slippage = crossChainTrade.slippage;
}

protected async swapDirect(
protected override async swapDirect(
options: MarkRequired<SwapTransactionOptions, 'receiverAddress'>
): Promise<string | never> {
await this.checkTradeErrors();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import BigNumber from 'bignumber.js';
import { NotSupportedTokensError, RubicSdkError } from 'src/common/errors';
import { PriceTokenAmount } from 'src/common/tokens';
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';
import { BlockchainsInfo } from 'src/core/blockchain/utils/blockchains-info/blockchains-info';
Expand Down Expand Up @@ -69,6 +70,13 @@ export async function getProxyMethodArgumentsAndTransactionData<
'https://sswap.swft.pro/api/sswap/swap',
swapRequest
);
if (swapData.resCode === 1146) {
throw new RubicSdkError('[BridgersApiError] Your region is not supported!');
}
if (!swapData.data?.txData) {
throw new NotSupportedTokensError();
}

const transactionData = swapData.data?.txData;

const quoteRequest: BridgersQuoteRequest = {
Expand Down

0 comments on commit c2a257f

Please sign in to comment.