rubic-sdk-next
Version:
Simplify dApp creation
34 lines • 1.66 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BitcoinApiCrossChainTrade = void 0;
const core_1 = require("@cryptorubic/core");
const bitcoin_cross_chain_trade_1 = require("../../../cross-chain/calculation-manager/providers/common/bitcoin-cross-chain-trade/bitcoin-cross-chain-trade");
class BitcoinApiCrossChainTrade extends bitcoin_cross_chain_trade_1.BitcoinCrossChainTrade {
constructor(tradeParams) {
super(tradeParams.apiQuote.integratorAddress, tradeParams.routePath, tradeParams.apiQuote, tradeParams.apiResponse);
this.onChainSubtype = { from: undefined, to: undefined };
this.isAggregator = false;
//@TODO API
this.memo = '';
this.type = tradeParams.apiResponse.providerType;
this.bridgeType = this.type;
this.from = tradeParams.from;
this.to = tradeParams.to;
this.toTokenAmountMin = core_1.Token.fromWei(tradeParams.apiResponse.estimate.destinationWeiMinAmount, tradeParams.to.decimals);
this.priceImpact = tradeParams.apiResponse.estimate.priceImpact;
this.slippage = tradeParams.apiResponse.estimate.slippage;
this.feeInfo = tradeParams.feeInfo;
this.needProvidePubKey = tradeParams.needProvidePubKey;
}
getTradeInfo() {
return {
estimatedGas: this.estimatedGas,
feeInfo: this.feeInfo,
priceImpact: this.priceImpact,
slippage: this.slippage * 100,
routePath: this.routePath
};
}
}
exports.BitcoinApiCrossChainTrade = BitcoinApiCrossChainTrade;
//# sourceMappingURL=bitcoin-api-cross-chain-trade.js.map