import { Message } from "@keplr-wallet/router" ; import { ROUTE } from "./constants" ; export class SendTxMsg extends Message < Uint8Array > { public static type ( ) { return "send-tx-to-background" ; } constructor ( public readonly chainId , public readonly tx , public readonly mode ) { super ( ) ; } validateBasic ( ) { if ( ! this . chainId ) { throw new Error ( "chain id is empty" ) ; } if ( ! this . tx ) { throw new Error ( "tx is empty" ) ; } if ( ! this . mode || ( this . mode !== "sync" && this . mode !== "async" && this . mode !== "block" ) ) { throw new Error ( "invalid mode" ) ; } } approveExternal ( ) { return true ; } route ( ) { return ROUTE ; } type ( ) { return SendTxMsg . type ( ) ; } }