-func (store *WalletStore) GetAccountByAccountID(accountID string) []byte {
- return store.walletDB.Get(AccountIDKey(accountID))
+func (store *WalletStore) GetAccountByAccountID(accountID string) (*acc.Account, error) {
+ rawAccount := store.walletDB.Get(AccountIDKey(accountID))
+ if rawAccount == nil {
+ return nil, fmt.Errorf("failed get account, accountID: %s ", accountID)
+ }
+ account := new(acc.Account)
+ if err := json.Unmarshal(rawAccount, account); err != nil {
+ return nil, err
+ }
+ return account, nil