Skip to content

Commit

Permalink
Merge pull request #95 from Cryptorubic/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
axtezy authored May 31, 2022
2 parents 7bd4a2d + 71d4d2c commit e279115
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rubic-sdk",
"version": "1.3.3",
"version": "1.3.4",
"description": "Simplify dApp creation",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ export class CelerCrossChainContractData extends CrossChainContractData {
}

@Cache
public async getTransitToken(from: PriceToken): Promise<Token> {
const blockchain = from.blockchain as CelerCrossChainSupportedBlockchain;
public async getTransitToken(token: PriceToken): Promise<Token> {
const blockchain = token.blockchain as CelerCrossChainSupportedBlockchain;
const address = this.getTransitTokenAddressBasedOnBlockchain(blockchain);
return Token.createToken({
address,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ export class CelerCrossChainTradeProvider extends CrossChainTradeProvider {
fromTransitToken,
slippages.fromSlippageTolerance
);
await this.checkMinMaxAmountsErrors(fromTrade);

const celerSlippage = await this.fetchCelerSlippage(
fromBlockchain,
toBlockchain,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export class CelerCrossChainTrade extends CrossChainTrade {

public async swap(options: SwapTransactionOptions = {}): Promise<string | never> {
await this.checkTradeErrors();
// await this.checkAllowanceAndApprove(options);
await this.checkAllowanceAndApprove(options);

const { onConfirm, gasLimit, gasPrice } = options;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export abstract class CrossChainTradeProvider {
fromTrade: CrossChainContractTrade,
transitTokenAmount: BigNumber
): Promise<BigNumber> {
const transitToken = await fromTrade.contract.getTransitToken();
const transitToken = await fromTrade.contract.getTransitToken(fromTrade.fromToken);
if (
compareAddresses(fromTrade.fromToken.address, transitToken.address) ||
transitTokenAmount.eq(0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export abstract class CrossChainTrade {
);
}

public abstract swap(options: SwapTransactionOptions): Promise<string | never>;
public abstract swap(options?: SwapTransactionOptions): Promise<string | never>;

public async encode(options: EncodeTransactionOptions): Promise<TransactionConfig> {
const { gasLimit, gasPrice } = options;
Expand Down

0 comments on commit e279115

Please sign in to comment.