rubic-sdk
Version:
Simplify dApp creation
22 lines • 963 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getFromToTokensAmountsByExact = getFromToTokensAmountsByExact;
const tokens_1 = require("../../../../../../../common/tokens");
function getFromToTokensAmountsByExact(fromToken, toToken, exact, initialWeiAmount, weiAmountWithoutFee, routeWeiAmount) {
const fromAmount = exact === 'input' ? initialWeiAmount : routeWeiAmount;
const toAmount = exact === 'output' ? initialWeiAmount : routeWeiAmount;
const from = new tokens_1.PriceTokenAmount({
...fromToken.asStruct,
weiAmount: fromAmount
});
const to = new tokens_1.PriceTokenAmount({
...toToken.asStruct,
weiAmount: toAmount
});
const fromWithoutFee = new tokens_1.PriceTokenAmount({
...fromToken.asStruct,
weiAmount: weiAmountWithoutFee
});
return { from, to, fromWithoutFee };
}
//# sourceMappingURL=get-from-to-tokens-amounts-by-exact.js.map