import { AmountConfig , IFeeConfig } from "../tx" ; import { ChainGetter } from "@keplr-wallet/stores" ; import { ObservableQueryBalances } from "@keplr-wallet/stores/build/query/balances" ; import { AppCurrency } from "@keplr-wallet/types" ; import { computed , makeObservable } from "mobx" ; import { DenomHelper } from "@keplr-wallet/common" ; import { useState } from "react" ; export class IBCAmountConfig extends AmountConfig { constructor ( chainGetter , initialChainId , sender , feeConfig , queryBalances ) { super ( chainGetter , initialChainId , sender , feeConfig , queryBalances ) ; makeObservable ( this ) ; } @ computed get sendableCurrencies ( ) : AppCurrency [ ] { return super . sendableCurrencies . filter ( ( cur ) => new DenomHelper ( cur . coinMinimalDenom ) . type === "native" ) ; } } export const useIBCAmountConfig = ( chainGetter , chainId , sender , queryBalances ) => { const [ txConfig ] = useState ( ( ) => new IBCAmountConfig ( chainGetter , chainId , sender , undefined , queryBalances ) ) ; txConfig . setChain ( chainId ) ; txConfig . setQueryBalances ( queryBalances ) ; txConfig . setSender ( sender ) ; return txConfig ; } ;