@cyberk/hyperion-sdk
Version:
Hyperion SDK from Cyberk
33 lines • 1.29 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPoolInfoQueryOptions = exports.getPoolInfoQueryKey = exports.getPoolInfoQueryMsg = void 0;
const utils_1 = require("../utils");
const types_1 = require("../utils/types");
const getPoolInfoQueryMsg = () => {
return {
pool: {},
};
};
exports.getPoolInfoQueryMsg = getPoolInfoQueryMsg;
const getPoolInfoQueryKey = (options) => {
return ["poolInfo", options.contractAddress];
};
exports.getPoolInfoQueryKey = getPoolInfoQueryKey;
const getPoolInfoQueryOptions = (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 poolInfo = await (0, utils_1.queryContractSmart)(client, contractAddress, (0, exports.getPoolInfoQueryMsg)());
return poolInfo ? (0, types_1.transformPoolInfo)(poolInfo) : undefined;
},
queryKey: (0, exports.getPoolInfoQueryKey)(options),
};
};
exports.getPoolInfoQueryOptions = getPoolInfoQueryOptions;
//# sourceMappingURL=getPoolInfo.js.map