UNPKG

@cyberk/hyperion-sdk

Version:

Hyperion SDK from Cyberk

38 lines 1.59 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getRegisteredNativeTokenDecimals = exports.getRegisteredNativeTokenDecimalsQueryKey = exports.getRegisteredNativeTokenDecimalsQueryMsg = void 0; const utils_1 = require("../utils"); const getRegisteredNativeTokenDecimalsQueryMsg = ({ denom, }) => { return { native_token_decimals: { denom, }, }; }; exports.getRegisteredNativeTokenDecimalsQueryMsg = getRegisteredNativeTokenDecimalsQueryMsg; const getRegisteredNativeTokenDecimalsQueryKey = (options) => { return [ "getRegisteredNativeTokenDecimals", options.factoryAddress, options.denom, ]; }; exports.getRegisteredNativeTokenDecimalsQueryKey = getRegisteredNativeTokenDecimalsQueryKey; const getRegisteredNativeTokenDecimals = (options) => { return { queryFn: async () => { const { client, factoryAddress, denom } = options; if (!client) { throw new Error("Client is required"); } if (!factoryAddress) { throw new Error("Factory address is required"); } const { decimals } = await (0, utils_1.queryContractSmart)(client, factoryAddress, (0, exports.getRegisteredNativeTokenDecimalsQueryMsg)(options)); return decimals; }, queryKey: (0, exports.getRegisteredNativeTokenDecimalsQueryKey)(options), }; }; exports.getRegisteredNativeTokenDecimals = getRegisteredNativeTokenDecimals; //# sourceMappingURL=getRegisteredNativeTokenDecimals.js.map