@@ -39,7 +39,7 @@ import (
3939 "github.com/status-im/status-go/protocol"
4040 "github.com/status-im/status-go/protocol/common"
4141 "github.com/status-im/status-go/protocol/communities"
42- "github.com/status-im/status-go/protocol/communities/token"
42+ communitiestoken "github.com/status-im/status-go/protocol/communities/token"
4343 "github.com/status-im/status-go/protocol/ens"
4444 "github.com/status-im/status-go/protocol/protobuf"
4545 "github.com/status-im/status-go/protocol/pushnotificationclient"
@@ -54,6 +54,7 @@ import (
5454 "github.com/status-im/status-go/services/wallet/collectibles"
5555 w_common "github.com/status-im/status-go/services/wallet/common"
5656 "github.com/status-im/status-go/services/wallet/thirdparty"
57+ "github.com/status-im/status-go/services/wallet/token"
5758 "github.com/status-im/status-go/signal"
5859)
5960
@@ -111,6 +112,7 @@ type InitProtocolParams struct {
111112 AccountsPublisher * pubsub.Publisher
112113 TimeSource timesource.TimeSource
113114 MetricsEnabled bool
115+ TokenManager * token.Manager
114116}
115117
116118func (s * Service ) InitProtocol (params InitProtocolParams ) error {
@@ -193,7 +195,10 @@ func (s *Service) InitProtocol(params InitProtocolParams) error {
193195 s .config .ShhextConfig .VerifyENSContractAddress ,
194196 )
195197
196- options , err := buildMessengerOptions (s .config , params .Identity , params .AppDB , params .WalletDB , params .HTTPServer , s .rpcClient , s .multiAccountsDB , params .Account , envelopeEventsConfig , s .accountsDB , params .WalletService , params .CommunityTokensService , s .logger , & MessengerSignalsHandler {}, params .AccountsManager , params .AccountsPublisher , ensVerifier )
198+ options , err := buildMessengerOptions (s .config , params .Identity , params .AppDB , params .WalletDB , params .HTTPServer ,
199+ s .rpcClient , s .multiAccountsDB , params .Account , envelopeEventsConfig , s .accountsDB , params .WalletService ,
200+ params .CommunityTokensService , s .logger , & MessengerSignalsHandler {}, params .AccountsManager , params .AccountsPublisher ,
201+ ensVerifier , params .TokenManager )
197202 if err != nil {
198203 return err
199204 }
@@ -430,6 +435,7 @@ func buildMessengerOptions(
430435 accountsManager * accsmanagement.AccountsManager ,
431436 accountsPublisher * pubsub.Publisher ,
432437 ensVerifier * ens.Verifier ,
438+ tokenManager * token.Manager ,
433439) ([]protocol.Option , error ) {
434440 personalService := personal .New ()
435441 options := []protocol.Option {
@@ -455,6 +461,7 @@ func buildMessengerOptions(
455461 protocol .WithAccountsPublisher (accountsPublisher ),
456462 protocol .WithNewsFeed (),
457463 protocol .WithMessageSigner (personalService ),
464+ protocol .WithTokenManager (tokenManager ),
458465 }
459466
460467 if config .ShhextConfig .DataSyncEnabled {
@@ -586,7 +593,7 @@ func (s *Service) FillCollectibleMetadata(community *communities.Community, coll
586593
587594 permission := fetchCommunityCollectiblePermission (community , id )
588595
589- privilegesLevel := token .CommunityLevel
596+ privilegesLevel := communitiestoken .CommunityLevel
590597 if permission != nil {
591598 privilegesLevel = permissionTypeToPrivilegesLevel (permission .GetType ())
592599 }
@@ -621,14 +628,14 @@ func (s *Service) FillCollectibleMetadata(community *communities.Community, coll
621628 return nil
622629}
623630
624- func permissionTypeToPrivilegesLevel (permissionType protobuf.CommunityTokenPermission_Type ) token .PrivilegesLevel {
631+ func permissionTypeToPrivilegesLevel (permissionType protobuf.CommunityTokenPermission_Type ) communitiestoken .PrivilegesLevel {
625632 switch permissionType {
626633 case protobuf .CommunityTokenPermission_BECOME_TOKEN_OWNER :
627- return token .OwnerLevel
634+ return communitiestoken .OwnerLevel
628635 case protobuf .CommunityTokenPermission_BECOME_TOKEN_MASTER :
629- return token .MasterLevel
636+ return communitiestoken .MasterLevel
630637 default :
631- return token .CommunityLevel
638+ return communitiestoken .CommunityLevel
632639 }
633640}
634641
@@ -720,7 +727,7 @@ func (s *Service) fetchCommunityInfoForCollectibles(communityID string, ids []th
720727 return community , nil
721728}
722729
723- func (s * Service ) fetchCommunityToken (communityID string , contractID thirdparty.ContractID ) (* token .CommunityToken , error ) {
730+ func (s * Service ) fetchCommunityToken (communityID string , contractID thirdparty.ContractID ) (* communitiestoken .CommunityToken , error ) {
724731 if s .messenger == nil {
725732 return nil , fmt .Errorf ("messenger not ready" )
726733 }
@@ -826,7 +833,7 @@ func boolToString(value bool) string {
826833 return "No"
827834}
828835
829- func getCollectibleCommunityTraits (token * token .CommunityToken ) []thirdparty.CollectibleTrait {
836+ func getCollectibleCommunityTraits (token * communitiestoken .CommunityToken ) []thirdparty.CollectibleTrait {
830837 if token == nil {
831838 return make ([]thirdparty.CollectibleTrait , 0 )
832839 }
0 commit comments