import { IMemoConfig } from "./types" ; import { action , makeObservable , observable } from "mobx" ; import { ChainGetter } from "@keplr-wallet/stores" ; import { TxChainSetter } from "./chain" ; import { useState } from "react" ; export class MemoConfig extends TxChainSetter implements IMemoConfig { @ observable protected _memo : string = "" ; constructor ( chainGetter , initialChainId ) { super ( chainGetter , initialChainId ) ; makeObservable ( this ) ; } get memo ( ) : string { return this . _memo ; } @ action setMemo ( memo ) { this . _memo = memo ; } getError ( ) { return undefined ; } } export const useMemoConfig = ( chainGetter , chainId ) => { const [ config ] = useState ( ( ) => new MemoConfig ( chainGetter , chainId ) ) ; config . setChain ( chainId ) ; return config ; } ;