UNPKG

@cyberk/hyperion-sdk

Version:

Hyperion SDK from Cyberk

33 lines 1.29 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getPairInfoQueryOptions = exports.getPairInfoQueryKey = exports.getPairInfoQueryMsg = void 0; const utils_1 = require("../utils"); const types_1 = require("../utils/types"); const getPairInfoQueryMsg = () => { return { pair: {}, }; }; exports.getPairInfoQueryMsg = getPairInfoQueryMsg; const getPairInfoQueryKey = (options) => { return ["pairInfo", options.contractAddress]; }; exports.getPairInfoQueryKey = getPairInfoQueryKey; const getPairInfoQueryOptions = (options) => { return { queryFn: async () => { const { client, contractAddress } = options; if (!client) { throw new Error("Client is required"); } if (!contractAddress) { throw new Error("Contract address is required"); } const pairInfo = await (0, utils_1.queryContractSmart)(client, contractAddress, (0, exports.getPairInfoQueryMsg)()); return pairInfo ? (0, types_1.transformPairInfo)(pairInfo) : undefined; }, queryKey: (0, exports.getPairInfoQueryKey)(options), }; }; exports.getPairInfoQueryOptions = getPairInfoQueryOptions; //# sourceMappingURL=getPairInfo.js.map