Sale Djenic 61527f8c78 chore: synchronization improvements applied to keypairs/accounts
This is the first step of improvements over keypairs/keycards/accounts.
- `SyncKeypairFull` protobuf removed
- `SyncKeypair` protobuf is used for syncing all but the watch only accounts
- `SyncAccount` is used only for syncing watch only accounts
- related keycards are synced together with a keypair
- on any keypair change (either it's just a keypair name or any change made over an
account which belongs to that keypair) entire keypair is synced including related keycards
- on any watch only account related change, that account is synced with all its details
2023-07-05 14:41:26 +02:00

40 lines
1.5 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
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"`
Keypair *accounts.Keypair `json:"backedUpKeypair,omitempty"`
WatchOnlyAccount *accounts.Account `json:"backedUpWatchOnlyAccount,omitempty"`
}{
Clock: sfwr.Clock,
Profile: sfwr.Profile,
Setting: sfwr.Setting,
Keypair: sfwr.Keypair,
WatchOnlyAccount: sfwr.WatchOnlyAccount,
}
responseItem.FetchingDataProgress = sfwr.FetchingBackedUpDataDetails()
return json.Marshal(responseItem)
}