@bluefin-exchange/bluefin7k-aggregator-sdk
Version:
23 lines (22 loc) • 1.05 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.placeLimitOrder = placeLimitOrder;
const getSplitCoinForTx_1 = require("../../libs/getSplitCoinForTx");
const token_1 = require("../../utils/token");
const constants_1 = require("./constants");
async function placeLimitOrder({ accountAddress, payCoinType, targetCoinType, payCoinAmount, rate, slippage, expireTs, devInspect, }) {
const { tx, coinData: payCoin } = await (0, getSplitCoinForTx_1.getSplitCoinForTx)(accountAddress, payCoinAmount.toString(), [payCoinAmount.toString()], (0, token_1.denormalizeTokenType)(payCoinType), undefined, devInspect);
tx.moveCall({
target: `${constants_1.LIMIT_ORDER_MODULE_ID}::place_limit_order`,
arguments: [
tx.object(constants_1.GLOBAL_CONFIG_ID),
payCoin,
tx.pure.u64(rate),
tx.pure.u64(slippage),
tx.pure.u64(expireTs),
tx.object.clock(),
],
typeArguments: [payCoinType, targetCoinType],
});
return tx;
}
;