@devasher/kuru-sdk
Version:
Ethers v6 SDK to interact with Kuru (forked from @kuru-labs/kuru-sdk)
37 lines • 1.79 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParamFetcher = void 0;
// ============ External Imports ============
const ethers_1 = require("ethers");
// ============ Config Imports ============
const OrderBook_json_1 = __importDefault(require("../../abi/OrderBook.json"));
class ParamFetcher {
/**
* @dev Retrieves the market parameters from the order book contract.
* @param providerOrSigner - The ethers.js provider to interact with the blockchain.
* @param orderbookAddress - The address of the order book contract.
* @returns A promise that resolves to the market parameters.
*/
static async getMarketParams(providerOrSigner, orderbookAddress) {
const orderbook = new ethers_1.ethers.Contract(orderbookAddress, OrderBook_json_1.default.abi, providerOrSigner);
const marketParamsData = await orderbook.getMarketParams({ from: ethers_1.ZeroAddress });
return {
pricePrecision: BigInt(marketParamsData[0]),
sizePrecision: BigInt(marketParamsData[1]),
baseAssetAddress: marketParamsData[2],
baseAssetDecimals: BigInt(marketParamsData[3]),
quoteAssetAddress: marketParamsData[4],
quoteAssetDecimals: BigInt(marketParamsData[5]),
tickSize: BigInt(marketParamsData[6]),
minSize: BigInt(marketParamsData[7]),
maxSize: BigInt(marketParamsData[8]),
takerFeeBps: BigInt(marketParamsData[9]),
makerFeeBps: BigInt(marketParamsData[10]),
};
}
}
exports.ParamFetcher = ParamFetcher;
//# sourceMappingURL=marketParams.js.map