Sale Djenic eeaaf0ce3f feat: accounts improvements applied
- old `accounts` table is moved/mapped to `keypairs` and `keypairs_accounts`
- `keycards` table has foreign key which refers to `keypairs.key_uid`
- `Keypair` introduced as a new type
- api endpoints updated according to this change
2023-05-25 19:46:47 +02:00

43 lines
1.7 KiB
Go

package wakusync
import (
"encoding/json"
"github.com/status-im/status-go/multiaccounts/accounts"
"github.com/status-im/status-go/multiaccounts/settings"
"github.com/status-im/status-go/protocol/protobuf"
)
type WakuBackedUpDataResponse struct {
Clock uint64
FetchingDataProgress map[string]protobuf.FetchingBackedUpDataDetails // key represents the data/section backup details refer to
Profile *BackedUpProfile
Setting *settings.SyncSettingField
Keycards []*accounts.Keycard
Keypair *accounts.Keypair
WatchOnlyAccount *accounts.Account
}
func (sfwr *WakuBackedUpDataResponse) MarshalJSON() ([]byte, error) {
responseItem := struct {
Clock uint64 `json:"clock,omitempty"`
FetchingDataProgress map[string]FetchingBackupedDataDetails `json:"fetchingBackedUpDataProgress,omitempty"`
Profile *BackedUpProfile `json:"backedUpProfile,omitempty"`
Setting *settings.SyncSettingField `json:"backedUpSettings,omitempty"`
Keycards []*accounts.Keycard `json:"backedUpKeycards,omitempty"`
Keypair *accounts.Keypair `json:"backedUpKeypair,omitempty"`
WatchOnlyAccount *accounts.Account `json:"backedUpWatchOnlyAccount,omitempty"`
}{
Clock: sfwr.Clock,
Profile: sfwr.Profile,
Setting: sfwr.Setting,
Keycards: sfwr.Keycards,
Keypair: sfwr.Keypair,
WatchOnlyAccount: sfwr.WatchOnlyAccount,
}
responseItem.FetchingDataProgress = sfwr.FetchingBackedUpDataDetails()
return json.Marshal(responseItem)
}