From 682722b9734cef6f3c6832575d78c6996988a379 Mon Sep 17 00:00:00 2001 From: andrey Date: Fri, 11 Sep 2020 08:07:40 +0200 Subject: [PATCH] add wallet favourites --- VERSION | 2 +- appdatabase/migrations/bindata.go | 327 ++++++++++++------ .../migrations/sql/0013_favourites.down.sql | 1 + .../migrations/sql/0013_favourites.up.sql | 6 + services/peer/discoverer_mock.go | 3 +- services/shhext/api_nimbus.go | 1 + services/status/account_mock.go | 4 +- services/wallet/api.go | 14 + services/wallet/database.go | 35 ++ transactions/fake/mock.go | 6 +- 10 files changed, 283 insertions(+), 116 deletions(-) create mode 100644 appdatabase/migrations/sql/0013_favourites.down.sql create mode 100644 appdatabase/migrations/sql/0013_favourites.up.sql diff --git a/VERSION b/VERSION index e2050de802c..92c648bd8c3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.62.1 +0.62.2 diff --git a/appdatabase/migrations/bindata.go b/appdatabase/migrations/bindata.go index f4ddbdacf9d..4a5cf99c55e 100644 --- a/appdatabase/migrations/bindata.go +++ b/appdatabase/migrations/bindata.go @@ -1,34 +1,36 @@ -// Code generated by go-bindata. +// Code generated by go-bindata. DO NOT EDIT. // sources: -// 0001_app.down.sql -// 0001_app.up.sql -// 0002_tokens.down.sql -// 0002_tokens.up.sql -// 0003_settings.down.sql -// 0003_settings.up.sql -// 0004_pending_stickers.down.sql -// 0004_pending_stickers.up.sql -// 0005_waku_mode.down.sql -// 0005_waku_mode.up.sql -// 0006_appearance.up.sql -// 0007_enable_waku_default.up.sql -// 0008_add_push_notifications.up.sql -// 0009_enable_sending_push_notifications.down.sql -// 0009_enable_sending_push_notifications.up.sql -// 0010_add_block_mentions.down.sql -// 0010_add_block_mentions.up.sql -// 0011_allow_webview_permission_requests.down.sql -// 0011_allow_webview_permission_requests.up.sql -// 0012_pending_transactions.down.sql -// 0012_pending_transactions.up.sql -// doc.go -// DO NOT EDIT! +// 0001_app.down.sql (356B) +// 0001_app.up.sql (2.967kB) +// 0002_tokens.down.sql (19B) +// 0002_tokens.up.sql (248B) +// 0003_settings.down.sql (118B) +// 0003_settings.up.sql (1.311kB) +// 0004_pending_stickers.down.sql (0) +// 0004_pending_stickers.up.sql (61B) +// 0005_waku_mode.down.sql (0) +// 0005_waku_mode.up.sql (146B) +// 0006_appearance.up.sql (67B) +// 0007_enable_waku_default.up.sql (38B) +// 0008_add_push_notifications.up.sql (349B) +// 0009_enable_sending_push_notifications.down.sql (49B) +// 0009_enable_sending_push_notifications.up.sql (49B) +// 0010_add_block_mentions.down.sql (83B) +// 0010_add_block_mentions.up.sql (89B) +// 0011_allow_webview_permission_requests.down.sql (0) +// 0011_allow_webview_permission_requests.up.sql (88B) +// 0012_pending_transactions.down.sql (33B) +// 0012_pending_transactions.up.sql (321B) +// 0013_favourites.down.sql (23B) +// 0013_favourites.up.sql (132B) +// doc.go (74B) package migrations import ( "bytes" "compress/gzip" + "crypto/sha256" "fmt" "io" "io/ioutil" @@ -41,7 +43,7 @@ import ( func bindataRead(data []byte, name string) ([]byte, error) { gz, err := gzip.NewReader(bytes.NewBuffer(data)) if err != nil { - return nil, fmt.Errorf("Read %q: %v", name, err) + return nil, fmt.Errorf("read %q: %v", name, err) } var buf bytes.Buffer @@ -49,7 +51,7 @@ func bindataRead(data []byte, name string) ([]byte, error) { clErr := gz.Close() if err != nil { - return nil, fmt.Errorf("Read %q: %v", name, err) + return nil, fmt.Errorf("read %q: %v", name, err) } if clErr != nil { return nil, err @@ -59,8 +61,9 @@ func bindataRead(data []byte, name string) ([]byte, error) { } type asset struct { - bytes []byte - info os.FileInfo + bytes []byte + info os.FileInfo + digest [sha256.Size]byte } type bindataFileInfo struct { @@ -104,8 +107,8 @@ func _0001_appDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0001_app.down.sql", size: 356, mode: os.FileMode(436), modTime: time.Unix(1599505269, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "0001_app.down.sql", size: 356, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb5, 0x25, 0xa0, 0xf8, 0x7d, 0x2d, 0xd, 0xcf, 0x18, 0xe4, 0x73, 0xc3, 0x95, 0xf5, 0x24, 0x20, 0xa9, 0xe6, 0x9e, 0x1d, 0x93, 0xe5, 0xc5, 0xad, 0x93, 0x8f, 0x5e, 0x40, 0xb5, 0x30, 0xaa, 0x25}} return a, nil } @@ -124,8 +127,8 @@ func _0001_appUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0001_app.up.sql", size: 2967, mode: os.FileMode(436), modTime: time.Unix(1599505269, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "0001_app.up.sql", size: 2967, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf7, 0x3a, 0xa7, 0xf2, 0x8f, 0xfa, 0x82, 0x7c, 0xc5, 0x49, 0xac, 0xac, 0xf, 0xc, 0x77, 0xe2, 0xba, 0xe8, 0x4d, 0xe, 0x6f, 0x5d, 0x2c, 0x2c, 0x18, 0x80, 0xc2, 0x1d, 0xe, 0x25, 0xe, 0x18}} return a, nil } @@ -144,8 +147,8 @@ func _0002_tokensDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0002_tokens.down.sql", size: 19, mode: os.FileMode(436), modTime: time.Unix(1599505269, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "0002_tokens.down.sql", size: 19, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd1, 0x31, 0x2, 0xcc, 0x2f, 0x38, 0x90, 0xf7, 0x58, 0x37, 0x47, 0xf4, 0x18, 0xf7, 0x72, 0x74, 0x67, 0x14, 0x7e, 0xf3, 0xb1, 0xd6, 0x5f, 0xb0, 0xd5, 0xe7, 0x91, 0xf4, 0x26, 0x77, 0x8e, 0x68}} return a, nil } @@ -164,8 +167,8 @@ func _0002_tokensUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0002_tokens.up.sql", size: 248, mode: os.FileMode(436), modTime: time.Unix(1599505269, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "0002_tokens.up.sql", size: 248, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xcc, 0xd6, 0xde, 0xd3, 0x7b, 0xee, 0x92, 0x11, 0x38, 0xa4, 0xeb, 0x84, 0xca, 0xcb, 0x37, 0x75, 0x5, 0x77, 0x7f, 0x14, 0x39, 0xee, 0xa1, 0x8b, 0xd4, 0x5c, 0x6e, 0x55, 0x6, 0x50, 0x16, 0xd4}} return a, nil } @@ -184,8 +187,8 @@ func _0003_settingsDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0003_settings.down.sql", size: 118, mode: os.FileMode(436), modTime: time.Unix(1599505269, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "0003_settings.down.sql", size: 118, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe5, 0xa6, 0xf5, 0xc0, 0x60, 0x64, 0x77, 0xe2, 0xe7, 0x3c, 0x9b, 0xb1, 0x52, 0xa9, 0x95, 0x16, 0xf8, 0x60, 0x2f, 0xa5, 0xeb, 0x46, 0xb9, 0xb9, 0x8f, 0x4c, 0xf4, 0xfd, 0xbb, 0xe7, 0xe5, 0xe5}} return a, nil } @@ -204,8 +207,8 @@ func _0003_settingsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0003_settings.up.sql", size: 1311, mode: os.FileMode(436), modTime: time.Unix(1599505269, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "0003_settings.up.sql", size: 1311, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xea, 0x35, 0x0, 0xeb, 0xe2, 0x33, 0x68, 0xb9, 0xf4, 0xf6, 0x8e, 0x9e, 0x10, 0xe9, 0x58, 0x68, 0x28, 0xb, 0xcd, 0xec, 0x74, 0x71, 0xa7, 0x9a, 0x5a, 0x77, 0x59, 0xb1, 0x13, 0x1c, 0xa1, 0x5b}} return a, nil } @@ -224,8 +227,8 @@ func _0004_pending_stickersDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0004_pending_stickers.down.sql", size: 0, mode: os.FileMode(436), modTime: time.Unix(1599505269, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "0004_pending_stickers.down.sql", size: 0, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}} return a, nil } @@ -244,8 +247,8 @@ func _0004_pending_stickersUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0004_pending_stickers.up.sql", size: 61, mode: os.FileMode(436), modTime: time.Unix(1599505269, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "0004_pending_stickers.up.sql", size: 61, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x3c, 0xed, 0x25, 0xdf, 0x75, 0x2, 0x6c, 0xf0, 0xa2, 0xa8, 0x37, 0x62, 0x65, 0xad, 0xfd, 0x98, 0xa0, 0x9d, 0x63, 0x94, 0xdf, 0x6b, 0x46, 0xe0, 0x68, 0xec, 0x9c, 0x7f, 0x77, 0xdd, 0xb3, 0x6}} return a, nil } @@ -264,8 +267,8 @@ func _0005_waku_modeDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0005_waku_mode.down.sql", size: 0, mode: os.FileMode(436), modTime: time.Unix(1599505269, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "0005_waku_mode.down.sql", size: 0, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}} return a, nil } @@ -284,8 +287,8 @@ func _0005_waku_modeUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0005_waku_mode.up.sql", size: 146, mode: os.FileMode(436), modTime: time.Unix(1599505269, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "0005_waku_mode.up.sql", size: 146, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xa6, 0x91, 0xc, 0xd7, 0x89, 0x61, 0x2e, 0x4c, 0x5a, 0xb6, 0x67, 0xd1, 0xc1, 0x42, 0x24, 0x38, 0xd6, 0x1b, 0x75, 0x41, 0x9c, 0x23, 0xb0, 0xca, 0x5c, 0xf1, 0x5c, 0xd0, 0x13, 0x92, 0x3e, 0xe1}} return a, nil } @@ -304,8 +307,8 @@ func _0006_appearanceUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0006_appearance.up.sql", size: 67, mode: os.FileMode(436), modTime: time.Unix(1599505269, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "0006_appearance.up.sql", size: 67, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xae, 0x6, 0x25, 0x6c, 0xe4, 0x9d, 0xa7, 0x72, 0xe8, 0xbc, 0xe4, 0x1f, 0x1e, 0x2d, 0x7c, 0xb7, 0xf6, 0xa3, 0xec, 0x3b, 0x4e, 0x93, 0x2e, 0xa4, 0xec, 0x6f, 0xe5, 0x95, 0x94, 0xe8, 0x4, 0xfb}} return a, nil } @@ -324,8 +327,8 @@ func _0007_enable_waku_defaultUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0007_enable_waku_default.up.sql", size: 38, mode: os.FileMode(436), modTime: time.Unix(1599505269, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "0007_enable_waku_default.up.sql", size: 38, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd4, 0x42, 0xb6, 0xe5, 0x48, 0x41, 0xeb, 0xc0, 0x7e, 0x3b, 0xe6, 0x8e, 0x96, 0x33, 0x20, 0x92, 0x24, 0x5a, 0x60, 0xfa, 0xa0, 0x3, 0x5e, 0x76, 0x4b, 0x89, 0xaa, 0x37, 0x66, 0xbc, 0x26, 0x11}} return a, nil } @@ -344,8 +347,8 @@ func _0008_add_push_notificationsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0008_add_push_notifications.up.sql", size: 349, mode: os.FileMode(436), modTime: time.Unix(1599505269, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "0008_add_push_notifications.up.sql", size: 349, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x5a, 0x0, 0xbf, 0xd0, 0xdd, 0xcd, 0x73, 0xe0, 0x7c, 0x56, 0xef, 0xdc, 0x57, 0x61, 0x94, 0x64, 0x70, 0xb9, 0xfa, 0xa1, 0x2a, 0x36, 0xc, 0x2f, 0xf8, 0x95, 0xa, 0x57, 0x3e, 0x7a, 0xd7, 0x12}} return a, nil } @@ -364,8 +367,8 @@ func _0009_enable_sending_push_notificationsDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0009_enable_sending_push_notifications.down.sql", size: 49, mode: os.FileMode(436), modTime: time.Unix(1599666593, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "0009_enable_sending_push_notifications.down.sql", size: 49, mode: os.FileMode(0644), modTime: time.Unix(1599738798, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe9, 0xae, 0x1b, 0x41, 0xcb, 0x9c, 0x2c, 0x93, 0xc6, 0x2a, 0x77, 0x3, 0xb9, 0x51, 0xe0, 0x68, 0x68, 0x0, 0xf7, 0x5b, 0xb3, 0x1e, 0x94, 0x44, 0xba, 0x9c, 0xd0, 0x3b, 0x80, 0x21, 0x6f, 0xb5}} return a, nil } @@ -384,8 +387,8 @@ func _0009_enable_sending_push_notificationsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0009_enable_sending_push_notifications.up.sql", size: 49, mode: os.FileMode(436), modTime: time.Unix(1599666593, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "0009_enable_sending_push_notifications.up.sql", size: 49, mode: os.FileMode(0644), modTime: time.Unix(1599738798, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1b, 0x80, 0xe4, 0x9c, 0xc8, 0xb8, 0xd5, 0xef, 0xce, 0x74, 0x9b, 0x7b, 0xdd, 0xa, 0x99, 0x1e, 0xef, 0x7f, 0xb8, 0x99, 0x84, 0x4, 0x0, 0x6b, 0x1d, 0x2c, 0xa, 0xf8, 0x2c, 0x4f, 0xb5, 0x44}} return a, nil } @@ -404,8 +407,8 @@ func _0010_add_block_mentionsDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0010_add_block_mentions.down.sql", size: 83, mode: os.FileMode(436), modTime: time.Unix(1599742167, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "0010_add_block_mentions.down.sql", size: 83, mode: os.FileMode(0644), modTime: time.Unix(1599738804, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6d, 0x9e, 0x27, 0x1e, 0xba, 0x9f, 0xca, 0xae, 0x98, 0x2e, 0x6e, 0xe3, 0xdd, 0xac, 0x73, 0x34, 0x4e, 0x69, 0x92, 0xb5, 0xf6, 0x9, 0xab, 0x50, 0x35, 0xd, 0xee, 0xeb, 0x3e, 0xcc, 0x7e, 0xce}} return a, nil } @@ -424,8 +427,8 @@ func _0010_add_block_mentionsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0010_add_block_mentions.up.sql", size: 89, mode: os.FileMode(436), modTime: time.Unix(1599742167, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "0010_add_block_mentions.up.sql", size: 89, mode: os.FileMode(0644), modTime: time.Unix(1599738804, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd7, 0x23, 0x85, 0xa2, 0xb5, 0xb6, 0xb4, 0x3f, 0xdc, 0x4e, 0xff, 0xe2, 0x6b, 0x66, 0x68, 0x5e, 0xb2, 0xb4, 0x14, 0xb2, 0x1b, 0x4d, 0xb1, 0xce, 0xf7, 0x6, 0x58, 0xa7, 0xaf, 0x93, 0x3f, 0x25}} return a, nil } @@ -444,8 +447,8 @@ func _0011_allow_webview_permission_requestsDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0011_allow_webview_permission_requests.down.sql", size: 0, mode: os.FileMode(436), modTime: time.Unix(1599742167, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "0011_allow_webview_permission_requests.down.sql", size: 0, mode: os.FileMode(0644), modTime: time.Unix(1599738804, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}} return a, nil } @@ -464,8 +467,8 @@ func _0011_allow_webview_permission_requestsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0011_allow_webview_permission_requests.up.sql", size: 88, mode: os.FileMode(436), modTime: time.Unix(1599742167, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "0011_allow_webview_permission_requests.up.sql", size: 88, mode: os.FileMode(0644), modTime: time.Unix(1599738804, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x43, 0x5f, 0x22, 0x4c, 0x98, 0x1d, 0xc6, 0xf4, 0x89, 0xaf, 0xf4, 0x44, 0xba, 0xf8, 0x28, 0xa7, 0xb5, 0xb9, 0xf0, 0xf2, 0xcb, 0x5, 0x59, 0x7a, 0xc, 0xdf, 0xd3, 0x38, 0xa4, 0xb8, 0x98, 0xc2}} return a, nil } @@ -484,8 +487,8 @@ func _0012_pending_transactionsDownSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0012_pending_transactions.down.sql", size: 33, mode: os.FileMode(436), modTime: time.Unix(1599742460, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "0012_pending_transactions.down.sql", size: 33, mode: os.FileMode(0644), modTime: time.Unix(1600183011, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x7e, 0x41, 0xfe, 0x5c, 0xd8, 0xc3, 0x29, 0xfd, 0x31, 0x78, 0x99, 0x7a, 0xeb, 0x17, 0x62, 0x88, 0x41, 0xb3, 0xe7, 0xb5, 0x5, 0x0, 0x90, 0xa1, 0x7, 0x1a, 0x23, 0x88, 0x81, 0xba, 0x56, 0x9d}} return a, nil } @@ -504,8 +507,48 @@ func _0012_pending_transactionsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "0012_pending_transactions.up.sql", size: 321, mode: os.FileMode(436), modTime: time.Unix(1599767791, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "0012_pending_transactions.up.sql", size: 321, mode: os.FileMode(0644), modTime: time.Unix(1600183011, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd, 0x17, 0xff, 0xd7, 0xa7, 0x49, 0x1e, 0x7b, 0x34, 0x63, 0x7c, 0x53, 0xaa, 0x6b, 0x2d, 0xc8, 0xe0, 0x82, 0x21, 0x90, 0x3a, 0x94, 0xf1, 0xa6, 0xe4, 0x70, 0xe5, 0x85, 0x1a, 0x48, 0x25, 0xb}} + return a, nil +} + +var __0013_favouritesDownSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x72\x09\xf2\x0f\x50\x08\x71\x74\xf2\x71\x55\x48\x4b\x2c\xcb\x2f\x2d\xca\x2c\x49\x2d\xb6\xe6\x02\x04\x00\x00\xff\xff\x76\xaf\x3d\x70\x17\x00\x00\x00") + +func _0013_favouritesDownSqlBytes() ([]byte, error) { + return bindataRead( + __0013_favouritesDownSql, + "0013_favourites.down.sql", + ) +} + +func _0013_favouritesDownSql() (*asset, error) { + bytes, err := _0013_favouritesDownSqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "0013_favourites.down.sql", size: 23, mode: os.FileMode(0644), modTime: time.Unix(1600183011, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x32, 0xf8, 0x55, 0x13, 0x4f, 0x4a, 0x19, 0x83, 0x9c, 0xda, 0x34, 0xb8, 0x3, 0x54, 0x82, 0x1e, 0x99, 0x36, 0x6b, 0x42, 0x3, 0xf6, 0x43, 0xde, 0xe6, 0x32, 0xb6, 0xdf, 0xe2, 0x59, 0x8c, 0x84}} + return a, nil +} + +var __0013_favouritesUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x54\xcb\xb1\xaa\xc2\x40\x10\x46\xe1\x7e\x9e\xe2\x2f\x13\xb8\x6f\x70\xab\x31\x8e\x64\x70\xcd\xca\x64\x62\x92\x72\x21\x2b\x58\xa8\x90\x55\x9f\x5f\x10\x1b\xdb\xc3\xf9\x1a\x13\x76\x81\xf3\x26\x08\x74\x87\x2e\x3a\x64\xd2\xde\x7b\x9c\xd3\xeb\xfe\x5c\x2f\x8f\x5c\x50\x11\x90\x96\x65\xcd\xa5\xe0\xc4\xd6\xb4\x6c\x9f\xb3\x1b\x42\xf8\x23\xe0\x96\xae\x19\x2e\x93\xff\xd4\xa3\xe9\x81\x6d\xc6\x5e\x66\x54\x5f\x5e\x53\x8d\x51\xbd\x8d\x83\xc3\xe2\xa8\xdb\x7f\xa2\x77\x00\x00\x00\xff\xff\xb6\x82\x8c\x1e\x84\x00\x00\x00") + +func _0013_favouritesUpSqlBytes() ([]byte, error) { + return bindataRead( + __0013_favouritesUpSql, + "0013_favourites.up.sql", + ) +} + +func _0013_favouritesUpSql() (*asset, error) { + bytes, err := _0013_favouritesUpSqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "0013_favourites.up.sql", size: 132, mode: os.FileMode(0644), modTime: time.Unix(1600183011, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xbe, 0x1, 0x27, 0x38, 0x76, 0xf5, 0xcb, 0x61, 0xda, 0x5b, 0xce, 0xd9, 0x8b, 0x18, 0x77, 0x61, 0x84, 0xe7, 0x22, 0xe2, 0x13, 0x99, 0xab, 0x32, 0xbc, 0xbe, 0xed, 0x1f, 0x2f, 0xb0, 0xe4, 0x8d}} return a, nil } @@ -524,8 +567,8 @@ func docGo() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(436), modTime: time.Unix(1599505269, 0)} - a := &asset{bytes: bytes, info: info} + info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xde, 0x7c, 0x28, 0xcd, 0x47, 0xf2, 0xfa, 0x7c, 0x51, 0x2d, 0xd8, 0x38, 0xb, 0xb0, 0x34, 0x9d, 0x4c, 0x62, 0xa, 0x9e, 0x28, 0xc3, 0x31, 0x23, 0xd9, 0xbb, 0x89, 0x9f, 0xa0, 0x89, 0x1f, 0xe8}} return a, nil } @@ -533,8 +576,8 @@ func docGo() (*asset, error) { // It returns an error if the asset could not be found or // could not be loaded. func Asset(name string) ([]byte, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { + canonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[canonicalName]; ok { a, err := f() if err != nil { return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) @@ -544,6 +587,12 @@ func Asset(name string) ([]byte, error) { return nil, fmt.Errorf("Asset %s not found", name) } +// AssetString returns the asset contents as a string (instead of a []byte). +func AssetString(name string) (string, error) { + data, err := Asset(name) + return string(data), err +} + // MustAsset is like Asset but panics when Asset would return an error. // It simplifies safe initialization of global variables. func MustAsset(name string) []byte { @@ -555,12 +604,18 @@ func MustAsset(name string) []byte { return a } +// MustAssetString is like AssetString but panics when Asset would return an +// error. It simplifies safe initialization of global variables. +func MustAssetString(name string) string { + return string(MustAsset(name)) +} + // AssetInfo loads and returns the asset info for the given name. // It returns an error if the asset could not be found or // could not be loaded. func AssetInfo(name string) (os.FileInfo, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { + canonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[canonicalName]; ok { a, err := f() if err != nil { return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) @@ -570,6 +625,33 @@ func AssetInfo(name string) (os.FileInfo, error) { return nil, fmt.Errorf("AssetInfo %s not found", name) } +// AssetDigest returns the digest of the file with the given name. It returns an +// error if the asset could not be found or the digest could not be loaded. +func AssetDigest(name string) ([sha256.Size]byte, error) { + canonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[canonicalName]; ok { + a, err := f() + if err != nil { + return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s can't read by error: %v", name, err) + } + return a.digest, nil + } + return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s not found", name) +} + +// Digests returns a map of all known files and their checksums. +func Digests() (map[string][sha256.Size]byte, error) { + mp := make(map[string][sha256.Size]byte, len(_bindata)) + for name := range _bindata { + a, err := _bindata[name]() + if err != nil { + return nil, err + } + mp[name] = a.digest + } + return mp, nil +} + // AssetNames returns the names of the assets. func AssetNames() []string { names := make([]string, 0, len(_bindata)) @@ -582,26 +664,51 @@ func AssetNames() []string { // _bindata is a table, holding each asset generator, mapped to its name. var _bindata = map[string]func() (*asset, error){ "0001_app.down.sql": _0001_appDownSql, + "0001_app.up.sql": _0001_appUpSql, + "0002_tokens.down.sql": _0002_tokensDownSql, + "0002_tokens.up.sql": _0002_tokensUpSql, + "0003_settings.down.sql": _0003_settingsDownSql, + "0003_settings.up.sql": _0003_settingsUpSql, + "0004_pending_stickers.down.sql": _0004_pending_stickersDownSql, + "0004_pending_stickers.up.sql": _0004_pending_stickersUpSql, + "0005_waku_mode.down.sql": _0005_waku_modeDownSql, + "0005_waku_mode.up.sql": _0005_waku_modeUpSql, + "0006_appearance.up.sql": _0006_appearanceUpSql, + "0007_enable_waku_default.up.sql": _0007_enable_waku_defaultUpSql, + "0008_add_push_notifications.up.sql": _0008_add_push_notificationsUpSql, + "0009_enable_sending_push_notifications.down.sql": _0009_enable_sending_push_notificationsDownSql, + "0009_enable_sending_push_notifications.up.sql": _0009_enable_sending_push_notificationsUpSql, + "0010_add_block_mentions.down.sql": _0010_add_block_mentionsDownSql, + "0010_add_block_mentions.up.sql": _0010_add_block_mentionsUpSql, + "0011_allow_webview_permission_requests.down.sql": _0011_allow_webview_permission_requestsDownSql, + "0011_allow_webview_permission_requests.up.sql": _0011_allow_webview_permission_requestsUpSql, + "0012_pending_transactions.down.sql": _0012_pending_transactionsDownSql, + "0012_pending_transactions.up.sql": _0012_pending_transactionsUpSql, + + "0013_favourites.down.sql": _0013_favouritesDownSql, + + "0013_favourites.up.sql": _0013_favouritesUpSql, + "doc.go": docGo, } @@ -614,15 +721,15 @@ var _bindata = map[string]func() (*asset, error){ // img/ // a.png // b.png -// then AssetDir("data") would return []string{"foo.txt", "img"} -// AssetDir("data/img") would return []string{"a.png", "b.png"} -// AssetDir("foo.txt") and AssetDir("notexist") would return an error +// then AssetDir("data") would return []string{"foo.txt", "img"}, +// AssetDir("data/img") would return []string{"a.png", "b.png"}, +// AssetDir("foo.txt") and AssetDir("notexist") would return an error, and // AssetDir("") will return []string{"data"}. func AssetDir(name string) ([]string, error) { node := _bintree if len(name) != 0 { - cannonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(cannonicalName, "/") + canonicalName := strings.Replace(name, "\\", "/", -1) + pathList := strings.Split(canonicalName, "/") for _, p := range pathList { node = node.Children[p] if node == nil { @@ -644,32 +751,35 @@ type bintree struct { Func func() (*asset, error) Children map[string]*bintree } + var _bintree = &bintree{nil, map[string]*bintree{ - "0001_app.down.sql": &bintree{_0001_appDownSql, map[string]*bintree{}}, - "0001_app.up.sql": &bintree{_0001_appUpSql, map[string]*bintree{}}, - "0002_tokens.down.sql": &bintree{_0002_tokensDownSql, map[string]*bintree{}}, - "0002_tokens.up.sql": &bintree{_0002_tokensUpSql, map[string]*bintree{}}, - "0003_settings.down.sql": &bintree{_0003_settingsDownSql, map[string]*bintree{}}, - "0003_settings.up.sql": &bintree{_0003_settingsUpSql, map[string]*bintree{}}, - "0004_pending_stickers.down.sql": &bintree{_0004_pending_stickersDownSql, map[string]*bintree{}}, - "0004_pending_stickers.up.sql": &bintree{_0004_pending_stickersUpSql, map[string]*bintree{}}, - "0005_waku_mode.down.sql": &bintree{_0005_waku_modeDownSql, map[string]*bintree{}}, - "0005_waku_mode.up.sql": &bintree{_0005_waku_modeUpSql, map[string]*bintree{}}, - "0006_appearance.up.sql": &bintree{_0006_appearanceUpSql, map[string]*bintree{}}, - "0007_enable_waku_default.up.sql": &bintree{_0007_enable_waku_defaultUpSql, map[string]*bintree{}}, - "0008_add_push_notifications.up.sql": &bintree{_0008_add_push_notificationsUpSql, map[string]*bintree{}}, + "0001_app.down.sql": &bintree{_0001_appDownSql, map[string]*bintree{}}, + "0001_app.up.sql": &bintree{_0001_appUpSql, map[string]*bintree{}}, + "0002_tokens.down.sql": &bintree{_0002_tokensDownSql, map[string]*bintree{}}, + "0002_tokens.up.sql": &bintree{_0002_tokensUpSql, map[string]*bintree{}}, + "0003_settings.down.sql": &bintree{_0003_settingsDownSql, map[string]*bintree{}}, + "0003_settings.up.sql": &bintree{_0003_settingsUpSql, map[string]*bintree{}}, + "0004_pending_stickers.down.sql": &bintree{_0004_pending_stickersDownSql, map[string]*bintree{}}, + "0004_pending_stickers.up.sql": &bintree{_0004_pending_stickersUpSql, map[string]*bintree{}}, + "0005_waku_mode.down.sql": &bintree{_0005_waku_modeDownSql, map[string]*bintree{}}, + "0005_waku_mode.up.sql": &bintree{_0005_waku_modeUpSql, map[string]*bintree{}}, + "0006_appearance.up.sql": &bintree{_0006_appearanceUpSql, map[string]*bintree{}}, + "0007_enable_waku_default.up.sql": &bintree{_0007_enable_waku_defaultUpSql, map[string]*bintree{}}, + "0008_add_push_notifications.up.sql": &bintree{_0008_add_push_notificationsUpSql, map[string]*bintree{}}, "0009_enable_sending_push_notifications.down.sql": &bintree{_0009_enable_sending_push_notificationsDownSql, map[string]*bintree{}}, - "0009_enable_sending_push_notifications.up.sql": &bintree{_0009_enable_sending_push_notificationsUpSql, map[string]*bintree{}}, - "0010_add_block_mentions.down.sql": &bintree{_0010_add_block_mentionsDownSql, map[string]*bintree{}}, - "0010_add_block_mentions.up.sql": &bintree{_0010_add_block_mentionsUpSql, map[string]*bintree{}}, + "0009_enable_sending_push_notifications.up.sql": &bintree{_0009_enable_sending_push_notificationsUpSql, map[string]*bintree{}}, + "0010_add_block_mentions.down.sql": &bintree{_0010_add_block_mentionsDownSql, map[string]*bintree{}}, + "0010_add_block_mentions.up.sql": &bintree{_0010_add_block_mentionsUpSql, map[string]*bintree{}}, "0011_allow_webview_permission_requests.down.sql": &bintree{_0011_allow_webview_permission_requestsDownSql, map[string]*bintree{}}, - "0011_allow_webview_permission_requests.up.sql": &bintree{_0011_allow_webview_permission_requestsUpSql, map[string]*bintree{}}, - "0012_pending_transactions.down.sql": &bintree{_0012_pending_transactionsDownSql, map[string]*bintree{}}, - "0012_pending_transactions.up.sql": &bintree{_0012_pending_transactionsUpSql, map[string]*bintree{}}, - "doc.go": &bintree{docGo, map[string]*bintree{}}, + "0011_allow_webview_permission_requests.up.sql": &bintree{_0011_allow_webview_permission_requestsUpSql, map[string]*bintree{}}, + "0012_pending_transactions.down.sql": &bintree{_0012_pending_transactionsDownSql, map[string]*bintree{}}, + "0012_pending_transactions.up.sql": &bintree{_0012_pending_transactionsUpSql, map[string]*bintree{}}, + "0013_favourites.down.sql": &bintree{_0013_favouritesDownSql, map[string]*bintree{}}, + "0013_favourites.up.sql": &bintree{_0013_favouritesUpSql, map[string]*bintree{}}, + "doc.go": &bintree{docGo, map[string]*bintree{}}, }} -// RestoreAsset restores an asset under the given directory +// RestoreAsset restores an asset under the given directory. func RestoreAsset(dir, name string) error { data, err := Asset(name) if err != nil { @@ -687,14 +797,10 @@ func RestoreAsset(dir, name string) error { if err != nil { return err } - err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) - if err != nil { - return err - } - return nil + return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) } -// RestoreAssets restores an asset under the given directory recursively +// RestoreAssets restores an asset under the given directory recursively. func RestoreAssets(dir, name string) error { children, err := AssetDir(name) // File @@ -712,7 +818,6 @@ func RestoreAssets(dir, name string) error { } func _filePath(dir, name string) string { - cannonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) + canonicalName := strings.Replace(name, "\\", "/", -1) + return filepath.Join(append([]string{dir}, strings.Split(canonicalName, "/")...)...) } - diff --git a/appdatabase/migrations/sql/0013_favourites.down.sql b/appdatabase/migrations/sql/0013_favourites.down.sql new file mode 100644 index 00000000000..bb8a8535ad0 --- /dev/null +++ b/appdatabase/migrations/sql/0013_favourites.down.sql @@ -0,0 +1 @@ +DROP TABLE favourites; diff --git a/appdatabase/migrations/sql/0013_favourites.up.sql b/appdatabase/migrations/sql/0013_favourites.up.sql new file mode 100644 index 00000000000..65141cc15ec --- /dev/null +++ b/appdatabase/migrations/sql/0013_favourites.up.sql @@ -0,0 +1,6 @@ +CREATE TABLE IF NOT EXISTS favourites ( + address VARCHAR NOT NULL, + name TEXT NOT NULL, + PRIMARY KEY (address) +) WITHOUT ROWID; + diff --git a/services/peer/discoverer_mock.go b/services/peer/discoverer_mock.go index 185a6a76f97..f54e3b1027f 100644 --- a/services/peer/discoverer_mock.go +++ b/services/peer/discoverer_mock.go @@ -5,8 +5,9 @@ package peer import ( - gomock "github.com/golang/mock/gomock" reflect "reflect" + + gomock "github.com/golang/mock/gomock" ) // MockDiscoverer is a mock of Discoverer interface diff --git a/services/shhext/api_nimbus.go b/services/shhext/api_nimbus.go index 5cf64e089e3..121fc8b17c1 100644 --- a/services/shhext/api_nimbus.go +++ b/services/shhext/api_nimbus.go @@ -4,6 +4,7 @@ package shhext import ( "context" + "github.com/status-im/status-go/protocol/common" "github.com/ethereum/go-ethereum/log" diff --git a/services/status/account_mock.go b/services/status/account_mock.go index 483cf7f61fb..16728cf41e9 100644 --- a/services/status/account_mock.go +++ b/services/status/account_mock.go @@ -6,10 +6,12 @@ package status import ( ecdsa "crypto/ecdsa" + reflect "reflect" + gomock "github.com/golang/mock/gomock" + account "github.com/status-im/status-go/account" types "github.com/status-im/status-go/eth-node/types" - reflect "reflect" ) // MockWhisperService is a mock of WhisperService interface diff --git a/services/wallet/api.go b/services/wallet/api.go index 0713e4183d9..56e658597a7 100644 --- a/services/wallet/api.go +++ b/services/wallet/api.go @@ -161,3 +161,17 @@ func (api *API) DeletePendingTransaction(ctx context.Context, transactionHash co log.Debug("result from database for remove pending transaction", "err", err) return err } + +func (api *API) GetFavourites(ctx context.Context) ([]*Favourite, error) { + log.Debug("call to get favourites") + rst, err := api.s.db.GetFavourites() + log.Debug("result from database for favourites", "len", len(rst)) + return rst, err +} + +func (api *API) AddFavourite(ctx context.Context, favourite Favourite) error { + log.Debug("call to create or update favourites") + err := api.s.db.AddFavourite(favourite) + log.Debug("result from database for create or update favouritesn", "err", err) + return err +} diff --git a/services/wallet/database.go b/services/wallet/database.go index a990af7bad9..07bfcf1c12a 100644 --- a/services/wallet/database.go +++ b/services/wallet/database.go @@ -659,6 +659,41 @@ func (db *Database) DeletePendingTransaction(transactionHash common.Hash) error return err } +type Favourite struct { + Address common.Address `json:"address"` + Name string `json:"name"` +} + +func (db *Database) GetFavourites() ([]*Favourite, error) { + rows, err := db.db.Query(`SELECT address, name FROM favourites`) + if err != nil { + return nil, err + } + defer rows.Close() + + var rst []*Favourite + for rows.Next() { + favourite := &Favourite{} + err := rows.Scan(&favourite.Address, &favourite.Name) + if err != nil { + return nil, err + } + + rst = append(rst, favourite) + } + + return rst, nil +} + +func (db *Database) AddFavourite(favourite Favourite) error { + insert, err := db.db.Prepare("INSERT OR REPLACE INTO favourites (address, name) VALUES (?, ?)") + if err != nil { + return err + } + _, err = insert.Exec(favourite.Address, favourite.Name) + return err +} + // statementCreator allows to pass transaction or database to use in consumer. type statementCreator interface { Prepare(query string) (*sql.Stmt, error) diff --git a/transactions/fake/mock.go b/transactions/fake/mock.go index 22a3b5e88b8..7ccd5d6e12a 100644 --- a/transactions/fake/mock.go +++ b/transactions/fake/mock.go @@ -6,11 +6,13 @@ package fake import ( context "context" + reflect "reflect" + + gomock "github.com/golang/mock/gomock" + common "github.com/ethereum/go-ethereum/common" hexutil "github.com/ethereum/go-ethereum/common/hexutil" rpc "github.com/ethereum/go-ethereum/rpc" - gomock "github.com/golang/mock/gomock" - reflect "reflect" ) // MockPublicTransactionPoolAPI is a mock of PublicTransactionPoolAPI interface