import { UserDetailsData } from './solana/models/UserDetailsData' ; import { ChainStorage } from './solana/solanaBorsh' ; export class AddressBook implements ChainStorage < string > { constructor ( readonly data ) { } static async fromChainData ( encrypted ) { return new AddressBook ( encrypted ) ; } toChainData ( ) { return this . data ; } } export class UserDetails implements ChainStorage < UserDetailsData > { constructor ( readonly alias , readonly addressBook ) { } static async fromChainData ( userDetailsData ) { const addressBook = new AddressBook ( userDetailsData . addressBook ) ; return new UserDetails ( userDetailsData . alias , addressBook ) ; } toChainData ( ) { return new UserDetailsData ( { alias : this . alias , addressBook : this . addressBook . toChainData ( ) , } ) ; } }