From a9a333d61ab63bd5fbf8fb806fd841152adc1a78 Mon Sep 17 00:00:00 2001 From: Sale Djenic Date: Thu, 16 Jan 2025 19:22:46 +0100 Subject: [PATCH] chore(communities)!: rename communitytokensv2 package to communitytokens This is a breaking change which renames `communitytokensv2` package to `communitytokens`. --- api/geth_backend.go | 7 +++++-- node/get_status_node.go | 6 +++--- node/status_node_services.go | 12 ++++++------ .../{communitytokensv2 => communitytokens}/api.go | 2 +- .../api_test.go | 2 +- .../communitytokensdatabase/database.go | 0 .../communitytokensdatabase/database_test.go | 0 .../manager.go | 2 +- .../service.go | 6 +++--- .../version.go | 2 +- services/ext/service.go | 6 +++--- services/wallet/token/token.go | 2 +- 12 files changed, 25 insertions(+), 22 deletions(-) rename services/{communitytokensv2 => communitytokens}/api.go (99%) rename services/{communitytokensv2 => communitytokens}/api_test.go (98%) rename services/{communitytokensv2 => communitytokens}/communitytokensdatabase/database.go (100%) rename services/{communitytokensv2 => communitytokens}/communitytokensdatabase/database_test.go (100%) rename services/{communitytokensv2 => communitytokens}/manager.go (99%) rename services/{communitytokensv2 => communitytokens}/service.go (99%) rename services/{communitytokensv2 => communitytokens}/version.go (79%) diff --git a/api/geth_backend.go b/api/geth_backend.go index 16239c548..68a4a5346 100644 --- a/api/geth_backend.go +++ b/api/geth_backend.go @@ -2692,7 +2692,10 @@ func (b *GethStatusBackend) injectAccountsIntoWakuService(w wakutypes.WakuKeyMan } if st != nil { - if err := st.InitProtocol(b.statusNode.GethNode().Config().Name, identity, b.appDB, b.walletDB, b.statusNode.HTTPServer(), b.multiaccountsDB, acc, b.accountManager, b.statusNode.RPCClient(), b.statusNode.WalletService(), b.statusNode.CommunityTokensServiceV2(), b.statusNode.WakuV2Service(), logutils.ZapLogger(), b.statusNode.AccountsFeed()); err != nil { + if err := st.InitProtocol(b.statusNode.GethNode().Config().Name, identity, b.appDB, b.walletDB, + b.statusNode.HTTPServer(), b.multiaccountsDB, acc, b.accountManager, b.statusNode.RPCClient(), + b.statusNode.WalletService(), b.statusNode.CommunityTokensService(), b.statusNode.WakuV2Service(), + logutils.ZapLogger(), b.statusNode.AccountsFeed()); err != nil { return err } // Set initial connection state @@ -2709,7 +2712,7 @@ func (b *GethStatusBackend) injectAccountsIntoWakuService(w wakutypes.WakuKeyMan } b.statusNode.ChatService(accDB).Init(messenger) b.statusNode.EnsService().Init(messenger.SyncEnsNamesWithDispatchMessage) - b.statusNode.CommunityTokensServiceV2().Init(messenger) + b.statusNode.CommunityTokensService().Init(messenger) } return nil diff --git a/node/get_status_node.go b/node/get_status_node.go index e54c6527c..955c63bb4 100644 --- a/node/get_status_node.go +++ b/node/get_status_node.go @@ -37,7 +37,7 @@ import ( appmetricsservice "github.com/status-im/status-go/services/appmetrics" "github.com/status-im/status-go/services/browsers" "github.com/status-im/status-go/services/chat" - "github.com/status-im/status-go/services/communitytokensv2" + "github.com/status-im/status-go/services/communitytokens" "github.com/status-im/status-go/services/connector" "github.com/status-im/status-go/services/ens" "github.com/status-im/status-go/services/eth" @@ -128,7 +128,7 @@ type StatusNode struct { wakuV2Srvc *wakuv2.Waku wakuV2ExtSrvc *wakuv2ext.Service ensSrvc *ens.Service - communityTokensSrvcV2 *communitytokensv2.Service + communityTokensSrvc *communitytokens.Service gifSrvc *gif.Service stickersSrvc *stickers.Service chatSrvc *chat.Service @@ -518,7 +518,7 @@ func (n *StatusNode) stop() error { n.wakuV2Srvc = nil n.wakuV2ExtSrvc = nil n.ensSrvc = nil - n.communityTokensSrvcV2 = nil + n.communityTokensSrvc = nil n.stickersSrvc = nil n.connectorSrvc = nil n.publicMethods = make(map[string]bool) diff --git a/node/status_node_services.go b/node/status_node_services.go index 2ff116c3d..6c69bb167 100644 --- a/node/status_node_services.go +++ b/node/status_node_services.go @@ -40,7 +40,7 @@ import ( appmetricsservice "github.com/status-im/status-go/services/appmetrics" "github.com/status-im/status-go/services/browsers" "github.com/status-im/status-go/services/chat" - "github.com/status-im/status-go/services/communitytokensv2" + "github.com/status-im/status-go/services/communitytokens" "github.com/status-im/status-go/services/connector" "github.com/status-im/status-go/services/ens" "github.com/status-im/status-go/services/eth" @@ -96,7 +96,7 @@ func (b *StatusNode) initServices(config *params.NodeConfig, mediaServer *server services = append(services, b.statusPublicService()) services = append(services, b.pendingTrackerService(&b.walletFeed)) services = append(services, b.ensService(b.timeSourceNow())) - services = append(services, b.CommunityTokensServiceV2()) + services = append(services, b.CommunityTokensService()) services = append(services, b.stickersService(accDB)) services = append(services, b.updatesService()) services = appendIf(b.appDB != nil && b.multiaccountsDB != nil, services, b.accountsService(&b.accountsFeed, accDB, mediaServer)) @@ -502,11 +502,11 @@ func (b *StatusNode) pendingTrackerService(walletFeed *event.Feed) *transactions return b.pendingTracker } -func (b *StatusNode) CommunityTokensServiceV2() *communitytokensv2.Service { - if b.communityTokensSrvcV2 == nil { - b.communityTokensSrvcV2 = communitytokensv2.NewService(b.rpcClient, b.gethAccountManager, b.config, b.appDB, &b.walletFeed, b.transactor) +func (b *StatusNode) CommunityTokensService() *communitytokens.Service { + if b.communityTokensSrvc == nil { + b.communityTokensSrvc = communitytokens.NewService(b.rpcClient, b.gethAccountManager, b.config, b.appDB, &b.walletFeed, b.transactor) } - return b.communityTokensSrvcV2 + return b.communityTokensSrvc } func (b *StatusNode) stickersService(accountDB *accounts.Database) *stickers.Service { diff --git a/services/communitytokensv2/api.go b/services/communitytokens/api.go similarity index 99% rename from services/communitytokensv2/api.go rename to services/communitytokens/api.go index b9221ea7c..81bc2c7ae 100644 --- a/services/communitytokensv2/api.go +++ b/services/communitytokens/api.go @@ -1,4 +1,4 @@ -package communitytokensv2 +package communitytokens import ( "context" diff --git a/services/communitytokensv2/api_test.go b/services/communitytokens/api_test.go similarity index 98% rename from services/communitytokensv2/api_test.go rename to services/communitytokens/api_test.go index 5b34bef6e..0d4705095 100644 --- a/services/communitytokensv2/api_test.go +++ b/services/communitytokens/api_test.go @@ -1,4 +1,4 @@ -package communitytokensv2 +package communitytokens import ( "testing" diff --git a/services/communitytokensv2/communitytokensdatabase/database.go b/services/communitytokens/communitytokensdatabase/database.go similarity index 100% rename from services/communitytokensv2/communitytokensdatabase/database.go rename to services/communitytokens/communitytokensdatabase/database.go diff --git a/services/communitytokensv2/communitytokensdatabase/database_test.go b/services/communitytokens/communitytokensdatabase/database_test.go similarity index 100% rename from services/communitytokensv2/communitytokensdatabase/database_test.go rename to services/communitytokens/communitytokensdatabase/database_test.go diff --git a/services/communitytokensv2/manager.go b/services/communitytokens/manager.go similarity index 99% rename from services/communitytokensv2/manager.go rename to services/communitytokens/manager.go index 284529e88..9e0ca0fbf 100644 --- a/services/communitytokensv2/manager.go +++ b/services/communitytokens/manager.go @@ -1,4 +1,4 @@ -package communitytokensv2 +package communitytokens import ( "context" diff --git a/services/communitytokensv2/service.go b/services/communitytokens/service.go similarity index 99% rename from services/communitytokensv2/service.go rename to services/communitytokens/service.go index c546b5235..3351f1c3c 100644 --- a/services/communitytokensv2/service.go +++ b/services/communitytokens/service.go @@ -1,4 +1,4 @@ -package communitytokensv2 +package communitytokens import ( "context" @@ -24,7 +24,7 @@ import ( "github.com/status-im/status-go/protocol/communities/token" "github.com/status-im/status-go/protocol/protobuf" "github.com/status-im/status-go/rpc" - "github.com/status-im/status-go/services/communitytokensv2/communitytokensdatabase" + "github.com/status-im/status-go/services/communitytokens/communitytokensdatabase" "github.com/status-im/status-go/services/wallet/bigint" walletCommon "github.com/status-im/status-go/services/wallet/common" "github.com/status-im/status-go/services/wallet/requests" @@ -71,7 +71,7 @@ func (s *Service) Protocols() []p2p.Protocol { func (s *Service) APIs() []ethRpc.API { return []ethRpc.API{ { - Namespace: "communitytokensv2", + Namespace: "communitytokens", Version: "0.1.0", Service: NewAPI(s), Public: true, diff --git a/services/communitytokensv2/version.go b/services/communitytokens/version.go similarity index 79% rename from services/communitytokensv2/version.go rename to services/communitytokens/version.go index d140ef361..532e32ad7 100644 --- a/services/communitytokensv2/version.go +++ b/services/communitytokens/version.go @@ -1,4 +1,4 @@ -package communitytokensv2 +package communitytokens const currentVersion = "1.0.0" diff --git a/services/ext/service.go b/services/ext/service.go index e9489248d..5a211de18 100644 --- a/services/ext/service.go +++ b/services/ext/service.go @@ -52,7 +52,7 @@ import ( "github.com/status-im/status-go/rpc" "github.com/status-im/status-go/server" "github.com/status-im/status-go/services/browsers" - "github.com/status-im/status-go/services/communitytokensv2" + "github.com/status-im/status-go/services/communitytokens" "github.com/status-im/status-go/services/ext/mailservers" mailserversDB "github.com/status-im/status-go/services/mailservers" "github.com/status-im/status-go/services/wallet" @@ -130,7 +130,7 @@ func (s *Service) GetPeer(rawURL string) (*enode.Node, error) { func (s *Service) InitProtocol(nodeName string, identity *ecdsa.PrivateKey, appDb, walletDb *sql.DB, httpServer *server.MediaServer, multiAccountDb *multiaccounts.Database, acc *multiaccounts.Account, accountManager *account.GethManager, rpcClient *rpc.Client, walletService *wallet.Service, - communityTokensService *communitytokensv2.Service, wakuService *wakuv2.Waku, logger *zap.Logger, + communityTokensService *communitytokens.Service, wakuService *wakuv2.Waku, logger *zap.Logger, accountsFeed *event.Feed) error { var err error if !s.config.ShhextConfig.PFSEnabled { @@ -403,7 +403,7 @@ func buildMessengerOptions( envelopesMonitorConfig *transport.EnvelopesMonitorConfig, accountsDB *accounts.Database, walletService *wallet.Service, - communityTokensService *communitytokensv2.Service, + communityTokensService *communitytokens.Service, wakuService *wakuv2.Waku, logger *zap.Logger, messengerSignalsHandler protocol.MessengerSignalsHandler, diff --git a/services/wallet/token/token.go b/services/wallet/token/token.go index 675534f30..9e3f77a7f 100644 --- a/services/wallet/token/token.go +++ b/services/wallet/token/token.go @@ -33,7 +33,7 @@ import ( "github.com/status-im/status-go/rpc/network" "github.com/status-im/status-go/server" "github.com/status-im/status-go/services/accounts/accountsevent" - "github.com/status-im/status-go/services/communitytokensv2/communitytokensdatabase" + "github.com/status-im/status-go/services/communitytokens/communitytokensdatabase" "github.com/status-im/status-go/services/utils" "github.com/status-im/status-go/services/wallet/bigint" "github.com/status-im/status-go/services/wallet/community"