@cyberk/hyperion-sdk
Version:
Hyperion SDK from Cyberk
32 lines • 1.09 kB
JavaScript
import { queryContractSmart } from "../utils";
export const getRegisteredNativeTokenDecimalsQueryMsg = ({ denom, }) => {
return {
native_token_decimals: {
denom,
},
};
};
export const getRegisteredNativeTokenDecimalsQueryKey = (options) => {
return [
"getRegisteredNativeTokenDecimals",
options.factoryAddress,
options.denom,
];
};
export 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 queryContractSmart(client, factoryAddress, getRegisteredNativeTokenDecimalsQueryMsg(options));
return decimals;
},
queryKey: getRegisteredNativeTokenDecimalsQueryKey(options),
};
};
//# sourceMappingURL=getRegisteredNativeTokenDecimals.js.map