UNPKG

@devasher/kuru-sdk

Version:

Ethers v6 SDK to interact with Kuru (forked from @kuru-labs/kuru-sdk)

34 lines 1.65 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.VaultParamFetcher = void 0; // ============ External Imports ============ const ethers_1 = require("ethers"); // ============ Config Imports ============ const OrderBook_json_1 = __importDefault(require("../../abi/OrderBook.json")); class VaultParamFetcher { /** * @dev Retrieves the vault 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 vault parameters. */ static async getVaultParams(providerOrSigner, orderbookAddress) { const orderbook = new ethers_1.ethers.Contract(orderbookAddress, OrderBook_json_1.default.abi, providerOrSigner); const vaultParamsData = await orderbook.getVaultParams({ from: ethers_1.ZeroAddress }); return { kuruAmmVault: vaultParamsData[0], vaultBestBid: BigInt(vaultParamsData[1]), bidPartiallyFilledSize: BigInt(vaultParamsData[2]), vaultBestAsk: BigInt(vaultParamsData[3]), askPartiallyFilledSize: BigInt(vaultParamsData[4]), vaultBidOrderSize: BigInt(vaultParamsData[5]), vaultAskOrderSize: BigInt(vaultParamsData[6]), spread: BigInt(vaultParamsData[7]), }; } } exports.VaultParamFetcher = VaultParamFetcher; //# sourceMappingURL=params.js.map