Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

567, add Bridgers onchain amount changed check #3448

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"ngx-cookie-service": "^16.0.0",
"querystring-es3": "^0.2.1",
"rpc-websockets": "7.9.0",
"rubic-sdk": "5.47.2",
"rubic-sdk": "5.47.4-alpha.bridgers.1",
"rxjs": "7.8.1",
"ts-cacheable": "^1.0.5",
"viem": "^1.21.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,10 @@ export class CrossChainService {
public async swapTrade(
trade: CrossChainTrade<unknown>,
callbackOnHash?: (hash: string) => void,
useCacheData?: boolean
params: { useCacheData: boolean; skipAmountCheck: boolean } = {
useCacheData: false,
skipAmountCheck: false
}
): Promise<string | null> {
if (!this.isSlippageCorrect(trade)) {
return null;
Expand Down Expand Up @@ -312,7 +315,7 @@ export class CrossChainService {
...(shouldCalculateGasPrice && { gasPriceOptions }),
...(this.queryParamsService.testMode && { testMode: true }),
...(referrer && { referrer }),
useCacheData: useCacheData || false
useCacheData: params.useCacheData
};

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,10 @@ export class OnChainService {
public async swapTrade(
trade: OnChainTrade,
callback?: (hash: string) => void,
useCacheData?: boolean
params: { useCacheData: boolean; skipAmountCheck: boolean } = {
useCacheData: false,
skipAmountCheck: false
}
): Promise<string> {
const fromBlockchain = trade.from.blockchain;

Expand Down Expand Up @@ -215,7 +218,8 @@ export class OnChainService {
...(this.queryParamsService.testMode && { testMode: true }),
...(shouldCalculateGasPrice && { gasPriceOptions }),
...(receiverAddress && { receiverAddress }),
useCacheData: useCacheData || false,
useCacheData: params.useCacheData,
skipAmountCheck: params.skipAmountCheck,
...(referrer && { referrer })
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,15 @@ export class SwapsControllerService {
if (allowSwap) {
try {
if (trade instanceof CrossChainTrade) {
txHash = await this.crossChainService.swapTrade(trade, callback.onHash, true);
txHash = await this.crossChainService.swapTrade(trade, callback.onHash, {
skipAmountCheck: true,
useCacheData: true
});
} else {
txHash = await this.onChainService.swapTrade(trade, callback.onHash, true);
txHash = await this.onChainService.swapTrade(trade, callback.onHash, {
skipAmountCheck: true,
useCacheData: true
});
}
} catch (innerErr) {
this.catchSwapError(innerErr, tradeState, callback?.onError);
Expand Down
Loading
Loading