@@ -39,7 +39,7 @@ import (
39
39
"github.com/status-im/status-go/protocol"
40
40
"github.com/status-im/status-go/protocol/common"
41
41
"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"
43
43
"github.com/status-im/status-go/protocol/ens"
44
44
"github.com/status-im/status-go/protocol/protobuf"
45
45
"github.com/status-im/status-go/protocol/pushnotificationclient"
@@ -54,6 +54,7 @@ import (
54
54
"github.com/status-im/status-go/services/wallet/collectibles"
55
55
w_common "github.com/status-im/status-go/services/wallet/common"
56
56
"github.com/status-im/status-go/services/wallet/thirdparty"
57
+ "github.com/status-im/status-go/services/wallet/token"
57
58
"github.com/status-im/status-go/signal"
58
59
)
59
60
@@ -111,6 +112,7 @@ type InitProtocolParams struct {
111
112
AccountsPublisher * pubsub.Publisher
112
113
TimeSource timesource.TimeSource
113
114
MetricsEnabled bool
115
+ TokenManager * token.Manager
114
116
}
115
117
116
118
func (s * Service ) InitProtocol (params InitProtocolParams ) error {
@@ -193,7 +195,10 @@ func (s *Service) InitProtocol(params InitProtocolParams) error {
193
195
s .config .ShhextConfig .VerifyENSContractAddress ,
194
196
)
195
197
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 )
197
202
if err != nil {
198
203
return err
199
204
}
@@ -430,6 +435,7 @@ func buildMessengerOptions(
430
435
accountsManager * accsmanagement.AccountsManager ,
431
436
accountsPublisher * pubsub.Publisher ,
432
437
ensVerifier * ens.Verifier ,
438
+ tokenManager * token.Manager ,
433
439
) ([]protocol.Option , error ) {
434
440
personalService := personal .New ()
435
441
options := []protocol.Option {
@@ -455,6 +461,7 @@ func buildMessengerOptions(
455
461
protocol .WithAccountsPublisher (accountsPublisher ),
456
462
protocol .WithNewsFeed (),
457
463
protocol .WithMessageSigner (personalService ),
464
+ protocol .WithTokenManager (tokenManager ),
458
465
}
459
466
460
467
if config .ShhextConfig .DataSyncEnabled {
@@ -586,7 +593,7 @@ func (s *Service) FillCollectibleMetadata(community *communities.Community, coll
586
593
587
594
permission := fetchCommunityCollectiblePermission (community , id )
588
595
589
- privilegesLevel := token .CommunityLevel
596
+ privilegesLevel := communitiestoken .CommunityLevel
590
597
if permission != nil {
591
598
privilegesLevel = permissionTypeToPrivilegesLevel (permission .GetType ())
592
599
}
@@ -621,14 +628,14 @@ func (s *Service) FillCollectibleMetadata(community *communities.Community, coll
621
628
return nil
622
629
}
623
630
624
- func permissionTypeToPrivilegesLevel (permissionType protobuf.CommunityTokenPermission_Type ) token .PrivilegesLevel {
631
+ func permissionTypeToPrivilegesLevel (permissionType protobuf.CommunityTokenPermission_Type ) communitiestoken .PrivilegesLevel {
625
632
switch permissionType {
626
633
case protobuf .CommunityTokenPermission_BECOME_TOKEN_OWNER :
627
- return token .OwnerLevel
634
+ return communitiestoken .OwnerLevel
628
635
case protobuf .CommunityTokenPermission_BECOME_TOKEN_MASTER :
629
- return token .MasterLevel
636
+ return communitiestoken .MasterLevel
630
637
default :
631
- return token .CommunityLevel
638
+ return communitiestoken .CommunityLevel
632
639
}
633
640
}
634
641
@@ -720,7 +727,7 @@ func (s *Service) fetchCommunityInfoForCollectibles(communityID string, ids []th
720
727
return community , nil
721
728
}
722
729
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 ) {
724
731
if s .messenger == nil {
725
732
return nil , fmt .Errorf ("messenger not ready" )
726
733
}
@@ -826,7 +833,7 @@ func boolToString(value bool) string {
826
833
return "No"
827
834
}
828
835
829
- func getCollectibleCommunityTraits (token * token .CommunityToken ) []thirdparty.CollectibleTrait {
836
+ func getCollectibleCommunityTraits (token * communitiestoken .CommunityToken ) []thirdparty.CollectibleTrait {
830
837
if token == nil {
831
838
return make ([]thirdparty.CollectibleTrait , 0 )
832
839
}
0 commit comments