import { Message } from "@keplr-wallet/router" ; import { ROUTE } from "./constants" ; import { AppCurrency } from "@keplr-wallet/types" ; export class GetTokensMsg extends Message < AppCurrency [ ] > { public static type ( ) { return "get-tokens" ; } constructor ( public readonly chainId ) { super ( ) ; } validateBasic ( ) { if ( ! this . chainId ) { throw new Error ( "Chain id is empty" ) ; } } route ( ) { return ROUTE ; } type ( ) { return GetTokensMsg . type ( ) ; } } export class SuggestTokenMsg extends Message < void > { public static type ( ) { return "suggest-token" ; } constructor ( public readonly chainId , public readonly contractAddress , public readonly viewingKey ? ) { super ( ) ; } approveExternal ( ) { return true ; } validateBasic ( ) { if ( ! this . chainId ) { throw new Error ( "Chain id is empty" ) ; } if ( ! this . contractAddress ) { throw new Error ( "Contract address is empty" ) ; } } route ( ) { return ROUTE ; } type ( ) { return SuggestTokenMsg . type ( ) ; } } export class AddTokenMsg extends Message < void > { public static type ( ) { return "add-token" ; } constructor ( public readonly chainId , public readonly currency ) { super ( ) ; } validateBasic ( ) { if ( ! this . chainId ) { throw new Error ( "Chain id is empty" ) ; } } route ( ) { return ROUTE ; } type ( ) { return AddTokenMsg . type ( ) ; } } export class RemoveTokenMsg extends Message < void > { public static type ( ) { return "remove-token" ; } constructor ( public readonly chainId , public readonly currency ) { super ( ) ; } validateBasic ( ) { if ( ! this . chainId ) { throw new Error ( "Chain id is empty" ) ; } } route ( ) { return ROUTE ; } type ( ) { return RemoveTokenMsg . type ( ) ; } } export class GetSecret20ViewingKey extends Message < string > { public static type ( ) { return "get-secret20-viewing-key" ; } constructor ( public readonly chainId , public readonly contractAddress ) { super ( ) ; } validateBasic ( ) { if ( ! this . chainId ) { throw new Error ( "Chain id is empty" ) ; } if ( ! this . contractAddress ) { throw new Error ( "Contract address is empty" ) ; } } approveExternal ( ) { return true ; } route ( ) { return ROUTE ; } type ( ) { return GetSecret20ViewingKey . type ( ) ; } }