Added mixed case address to the `Account` struct
This commit is contained in:
parent
cf8941c1d8
commit
4018e4334b
|
@ -2,6 +2,7 @@ package accounts
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/status-im/status-go/eth-node/types"
|
"github.com/status-im/status-go/eth-node/types"
|
||||||
"github.com/status-im/status-go/multiaccounts/errors"
|
"github.com/status-im/status-go/multiaccounts/errors"
|
||||||
|
@ -16,18 +17,18 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Account struct {
|
type Account struct {
|
||||||
Address types.Address `json:"address"`
|
Address types.Address
|
||||||
Wallet bool `json:"wallet"`
|
Wallet bool
|
||||||
Chat bool `json:"chat"`
|
Chat bool
|
||||||
Type string `json:"type,omitempty"`
|
Type string
|
||||||
Storage string `json:"storage,omitempty"`
|
Storage string
|
||||||
Path string `json:"path,omitempty"`
|
Path string
|
||||||
PublicKey types.HexBytes `json:"public-key,omitempty"`
|
PublicKey types.HexBytes
|
||||||
Name string `json:"name"`
|
Name string
|
||||||
Emoji string `json:"emoji"`
|
Emoji string
|
||||||
Color string `json:"color"`
|
Color string
|
||||||
Hidden bool `json:"hidden"`
|
Hidden bool
|
||||||
DerivedFrom string `json:"derived-from,omitempty"`
|
DerivedFrom string
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -44,6 +45,40 @@ func (a *Account) IsOwnAccount() bool {
|
||||||
return a.Wallet || a.Type == accountTypeSeed || a.Type == accountTypeGenerated || a.Type == accountTypeKey
|
return a.Wallet || a.Type == accountTypeSeed || a.Type == accountTypeGenerated || a.Type == accountTypeKey
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *Account) MarshalJSON() ([]byte, error) {
|
||||||
|
item := struct {
|
||||||
|
Address types.Address `json:"address"`
|
||||||
|
MixedcaseAddress string `json:"mixedcase-address"`
|
||||||
|
Wallet bool `json:"wallet"`
|
||||||
|
Chat bool `json:"chat"`
|
||||||
|
Type string `json:"type,omitempty"`
|
||||||
|
Storage string `json:"storage,omitempty"`
|
||||||
|
Path string `json:"path,omitempty"`
|
||||||
|
PublicKey types.HexBytes `json:"public-key,omitempty"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Emoji string `json:"emoji"`
|
||||||
|
Color string `json:"color"`
|
||||||
|
Hidden bool `json:"hidden"`
|
||||||
|
DerivedFrom string `json:"derived-from,omitempty"`
|
||||||
|
}{
|
||||||
|
Address: a.Address,
|
||||||
|
MixedcaseAddress: a.Address.Hex(),
|
||||||
|
Wallet: a.Wallet,
|
||||||
|
Chat: a.Chat,
|
||||||
|
Type: a.Type,
|
||||||
|
Storage: a.Storage,
|
||||||
|
Path: a.Path,
|
||||||
|
PublicKey: a.PublicKey,
|
||||||
|
Name: a.Name,
|
||||||
|
Emoji: a.Emoji,
|
||||||
|
Color: a.Color,
|
||||||
|
Hidden: a.Hidden,
|
||||||
|
DerivedFrom: a.DerivedFrom,
|
||||||
|
}
|
||||||
|
|
||||||
|
return json.Marshal(item)
|
||||||
|
}
|
||||||
|
|
||||||
// Database sql wrapper for operations with browser objects.
|
// Database sql wrapper for operations with browser objects.
|
||||||
type Database struct {
|
type Database struct {
|
||||||
*settings.Database
|
*settings.Database
|
||||||
|
|
Loading…
Reference in New Issue