import { SecretContractCodeHash } from "./types" ; import { KVStore } from "@keplr-wallet/common" ; import { ObservableChainQuery , ObservableChainQueryMap } from "../chain-query" ; import { ChainGetter } from "../../common" ; export class ObservableQuerySecretContractCodeHashInner extends ObservableChainQuery < SecretContractCodeHash > { constructor ( kvStore , chainId , chainGetter , protected readonly contractAddress ) { super ( kvStore , chainId , chainGetter , `/wasm/contract/${ contractAddress }/code-hash` ) ; } protected canFetch ( ) { return this . contractAddress . length > 0 ; } } export class ObservableQuerySecretContractCodeHash extends ObservableChainQueryMap < SecretContractCodeHash > { constructor ( protected readonly kvStore , protected readonly chainId , protected readonly chainGetter ) { super ( kvStore , chainId , chainGetter , ( contractAddress ) => { return new ObservableQuerySecretContractCodeHashInner ( this . kvStore , this . chainId , this . chainGetter , contractAddress ) ; } ) ; } getQueryContract ( contractAddress ) { return this . get ( contractAddress ) as ObservableQuerySecretContractCodeHashInner ; } }