feat(Collectibles): Change Collectibles service name to CommunityTokens.
Issue #12011
This commit is contained in:
parent
9a1443d716
commit
8425e6d238
|
@ -2228,7 +2228,7 @@ func (b *GethStatusBackend) injectAccountsIntoWakuService(w types.WakuKeyManager
|
||||||
}
|
}
|
||||||
|
|
||||||
if st != nil {
|
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.CollectiblesService(), logutils.ZapLogger()); 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(), logutils.ZapLogger()); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// Set initial connection state
|
// Set initial connection state
|
||||||
|
|
|
@ -36,7 +36,7 @@ import (
|
||||||
appmetricsservice "github.com/status-im/status-go/services/appmetrics"
|
appmetricsservice "github.com/status-im/status-go/services/appmetrics"
|
||||||
"github.com/status-im/status-go/services/browsers"
|
"github.com/status-im/status-go/services/browsers"
|
||||||
"github.com/status-im/status-go/services/chat"
|
"github.com/status-im/status-go/services/chat"
|
||||||
"github.com/status-im/status-go/services/collectibles"
|
"github.com/status-im/status-go/services/communitytokens"
|
||||||
"github.com/status-im/status-go/services/ens"
|
"github.com/status-im/status-go/services/ens"
|
||||||
"github.com/status-im/status-go/services/gif"
|
"github.com/status-im/status-go/services/gif"
|
||||||
localnotifications "github.com/status-im/status-go/services/local-notifications"
|
localnotifications "github.com/status-im/status-go/services/local-notifications"
|
||||||
|
@ -123,7 +123,7 @@ type StatusNode struct {
|
||||||
wakuV2Srvc *wakuv2.Waku
|
wakuV2Srvc *wakuv2.Waku
|
||||||
wakuV2ExtSrvc *wakuv2ext.Service
|
wakuV2ExtSrvc *wakuv2ext.Service
|
||||||
ensSrvc *ens.Service
|
ensSrvc *ens.Service
|
||||||
collectiblesSrvc *collectibles.Service
|
communityTokensSrvc *communitytokens.Service
|
||||||
gifSrvc *gif.Service
|
gifSrvc *gif.Service
|
||||||
stickersSrvc *stickers.Service
|
stickersSrvc *stickers.Service
|
||||||
chatSrvc *chat.Service
|
chatSrvc *chat.Service
|
||||||
|
@ -503,7 +503,7 @@ func (n *StatusNode) stop() error {
|
||||||
n.wakuV2Srvc = nil
|
n.wakuV2Srvc = nil
|
||||||
n.wakuV2ExtSrvc = nil
|
n.wakuV2ExtSrvc = nil
|
||||||
n.ensSrvc = nil
|
n.ensSrvc = nil
|
||||||
n.collectiblesSrvc = nil
|
n.communityTokensSrvc = nil
|
||||||
n.stickersSrvc = nil
|
n.stickersSrvc = nil
|
||||||
n.publicMethods = make(map[string]bool)
|
n.publicMethods = make(map[string]bool)
|
||||||
n.pendingTracker = nil
|
n.pendingTracker = nil
|
||||||
|
|
|
@ -28,7 +28,7 @@ import (
|
||||||
appmetricsservice "github.com/status-im/status-go/services/appmetrics"
|
appmetricsservice "github.com/status-im/status-go/services/appmetrics"
|
||||||
"github.com/status-im/status-go/services/browsers"
|
"github.com/status-im/status-go/services/browsers"
|
||||||
"github.com/status-im/status-go/services/chat"
|
"github.com/status-im/status-go/services/chat"
|
||||||
"github.com/status-im/status-go/services/collectibles"
|
"github.com/status-im/status-go/services/communitytokens"
|
||||||
"github.com/status-im/status-go/services/ens"
|
"github.com/status-im/status-go/services/ens"
|
||||||
"github.com/status-im/status-go/services/ext"
|
"github.com/status-im/status-go/services/ext"
|
||||||
"github.com/status-im/status-go/services/gif"
|
"github.com/status-im/status-go/services/gif"
|
||||||
|
@ -80,7 +80,7 @@ func (b *StatusNode) initServices(config *params.NodeConfig, mediaServer *server
|
||||||
services = append(services, b.statusPublicService())
|
services = append(services, b.statusPublicService())
|
||||||
services = append(services, b.pendingTrackerService(&b.walletFeed))
|
services = append(services, b.pendingTrackerService(&b.walletFeed))
|
||||||
services = append(services, b.ensService(b.timeSourceNow()))
|
services = append(services, b.ensService(b.timeSourceNow()))
|
||||||
services = append(services, b.collectiblesService())
|
services = append(services, b.CommunityTokensService())
|
||||||
services = append(services, b.stickersService(accDB))
|
services = append(services, b.stickersService(accDB))
|
||||||
services = append(services, b.updatesService())
|
services = append(services, b.updatesService())
|
||||||
services = appendIf(b.appDB != nil && b.multiaccountsDB != nil, services, b.accountsService(accountsFeed, accDB, mediaServer))
|
services = appendIf(b.appDB != nil && b.multiaccountsDB != nil, services, b.accountsService(accountsFeed, accDB, mediaServer))
|
||||||
|
@ -427,11 +427,11 @@ func (b *StatusNode) pendingTrackerService(walletFeed *event.Feed) *transactions
|
||||||
return b.pendingTracker
|
return b.pendingTracker
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *StatusNode) collectiblesService() *collectibles.Service {
|
func (b *StatusNode) CommunityTokensService() *communitytokens.Service {
|
||||||
if b.collectiblesSrvc == nil {
|
if b.communityTokensSrvc == nil {
|
||||||
b.collectiblesSrvc = collectibles.NewService(b.rpcClient, b.gethAccountManager, b.pendingTracker, b.config, b.appDB)
|
b.communityTokensSrvc = communitytokens.NewService(b.rpcClient, b.gethAccountManager, b.pendingTracker, b.config, b.appDB)
|
||||||
}
|
}
|
||||||
return b.collectiblesSrvc
|
return b.communityTokensSrvc
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *StatusNode) stickersService(accountDB *accounts.Database) *stickers.Service {
|
func (b *StatusNode) stickersService(accountDB *accounts.Database) *stickers.Service {
|
||||||
|
@ -503,10 +503,6 @@ func (b *StatusNode) SetWalletCollectibleMetadataProvider(provider thirdparty.Co
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *StatusNode) CollectiblesService() *collectibles.Service {
|
|
||||||
return b.collectiblesSrvc
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *StatusNode) walletService(accountsDB *accounts.Database, accountsFeed *event.Feed, walletFeed *event.Feed) *wallet.Service {
|
func (b *StatusNode) walletService(accountsDB *accounts.Database, accountsFeed *event.Feed, walletFeed *event.Feed) *wallet.Service {
|
||||||
if b.walletSrvc == nil {
|
if b.walletSrvc == nil {
|
||||||
b.walletSrvc = wallet.NewService(
|
b.walletSrvc = wallet.NewService(
|
||||||
|
|
|
@ -39,7 +39,7 @@ import (
|
||||||
"github.com/status-im/status-go/protocol/protobuf"
|
"github.com/status-im/status-go/protocol/protobuf"
|
||||||
"github.com/status-im/status-go/protocol/requests"
|
"github.com/status-im/status-go/protocol/requests"
|
||||||
"github.com/status-im/status-go/protocol/transport"
|
"github.com/status-im/status-go/protocol/transport"
|
||||||
"github.com/status-im/status-go/services/collectibles"
|
"github.com/status-im/status-go/services/communitytokens"
|
||||||
"github.com/status-im/status-go/services/wallet/bigint"
|
"github.com/status-im/status-go/services/wallet/bigint"
|
||||||
walletcommon "github.com/status-im/status-go/services/wallet/common"
|
walletcommon "github.com/status-im/status-go/services/wallet/common"
|
||||||
"github.com/status-im/status-go/services/wallet/thirdparty"
|
"github.com/status-im/status-go/services/wallet/thirdparty"
|
||||||
|
@ -80,7 +80,7 @@ type Manager struct {
|
||||||
torrentConfig *params.TorrentConfig
|
torrentConfig *params.TorrentConfig
|
||||||
torrentClient *torrent.Client
|
torrentClient *torrent.Client
|
||||||
walletConfig *params.WalletConfig
|
walletConfig *params.WalletConfig
|
||||||
collectiblesService collectibles.ServiceInterface
|
communityTokensService communitytokens.ServiceInterface
|
||||||
historyArchiveTasksWaitGroup sync.WaitGroup
|
historyArchiveTasksWaitGroup sync.WaitGroup
|
||||||
historyArchiveTasks sync.Map // stores `chan struct{}`
|
historyArchiveTasks sync.Map // stores `chan struct{}`
|
||||||
periodicMembersReevaluationTasks sync.Map // stores `chan struct{}`
|
periodicMembersReevaluationTasks sync.Map // stores `chan struct{}`
|
||||||
|
@ -115,7 +115,7 @@ type managerOptions struct {
|
||||||
tokenManager TokenManager
|
tokenManager TokenManager
|
||||||
collectiblesManager CollectiblesManager
|
collectiblesManager CollectiblesManager
|
||||||
walletConfig *params.WalletConfig
|
walletConfig *params.WalletConfig
|
||||||
collectiblesService collectibles.ServiceInterface
|
communityTokensService communitytokens.ServiceInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
type TokenManager interface {
|
type TokenManager interface {
|
||||||
|
@ -191,9 +191,9 @@ func WithWalletConfig(walletConfig *params.WalletConfig) ManagerOption {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func WithCollectiblesService(collectiblesService collectibles.ServiceInterface) ManagerOption {
|
func WithCommunityTokensService(communityTokensService communitytokens.ServiceInterface) ManagerOption {
|
||||||
return func(opts *managerOptions) {
|
return func(opts *managerOptions) {
|
||||||
opts.collectiblesService = collectiblesService
|
opts.communityTokensService = communityTokensService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,8 +251,8 @@ func NewManager(identity *ecdsa.PrivateKey, db *sql.DB, encryptor *encryption.Pr
|
||||||
manager.walletConfig = managerConfig.walletConfig
|
manager.walletConfig = managerConfig.walletConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
if managerConfig.collectiblesService != nil {
|
if managerConfig.communityTokensService != nil {
|
||||||
manager.collectiblesService = managerConfig.collectiblesService
|
manager.communityTokensService = managerConfig.communityTokensService
|
||||||
}
|
}
|
||||||
|
|
||||||
if verifier != nil {
|
if verifier != nil {
|
||||||
|
@ -4607,7 +4607,7 @@ func (m *Manager) HandleCommunityTokensMetadata(community *Community) error {
|
||||||
|
|
||||||
switch tokenMetadata.TokenType {
|
switch tokenMetadata.TokenType {
|
||||||
case protobuf.CommunityTokenType_ERC721:
|
case protobuf.CommunityTokenType_ERC721:
|
||||||
contractData, err := m.collectiblesService.GetCollectibleContractData(chainID, address)
|
contractData, err := m.communityTokensService.GetCollectibleContractData(chainID, address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -4618,7 +4618,7 @@ func (m *Manager) HandleCommunityTokensMetadata(community *Community) error {
|
||||||
communityToken.InfiniteSupply = contractData.InfiniteSupply
|
communityToken.InfiniteSupply = contractData.InfiniteSupply
|
||||||
|
|
||||||
case protobuf.CommunityTokenType_ERC20:
|
case protobuf.CommunityTokenType_ERC20:
|
||||||
contractData, err := m.collectiblesService.GetAssetContractData(chainID, address)
|
contractData, err := m.communityTokensService.GetAssetContractData(chainID, address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ import (
|
||||||
"github.com/status-im/status-go/protocol/communities/token"
|
"github.com/status-im/status-go/protocol/communities/token"
|
||||||
"github.com/status-im/status-go/protocol/protobuf"
|
"github.com/status-im/status-go/protocol/protobuf"
|
||||||
"github.com/status-im/status-go/protocol/requests"
|
"github.com/status-im/status-go/protocol/requests"
|
||||||
"github.com/status-im/status-go/services/collectibles"
|
"github.com/status-im/status-go/services/communitytokens"
|
||||||
"github.com/status-im/status-go/services/wallet/bigint"
|
"github.com/status-im/status-go/services/wallet/bigint"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1674,7 +1674,7 @@ func testEventSenderCannotEditPrivilegedCommunityPermission(base CommunityEvents
|
||||||
func testAddAndSyncTokenFromControlNode(base CommunityEventsTestsInterface, community *communities.Community,
|
func testAddAndSyncTokenFromControlNode(base CommunityEventsTestsInterface, community *communities.Community,
|
||||||
privilegesLvl token.PrivilegesLevel) {
|
privilegesLvl token.PrivilegesLevel) {
|
||||||
tokenERC721 := createCommunityToken(community.IDString(), privilegesLvl)
|
tokenERC721 := createCommunityToken(community.IDString(), privilegesLvl)
|
||||||
addCommunityTokenToCollectiblesService(base, tokenERC721)
|
addCommunityTokenToCommunityTokensService(base, tokenERC721)
|
||||||
|
|
||||||
s := base.GetSuite()
|
s := base.GetSuite()
|
||||||
|
|
||||||
|
@ -1754,7 +1754,7 @@ func createCommunityToken(communityID string, privilegesLevel token.PrivilegesLe
|
||||||
func testAddAndSyncTokenFromEventSenderByControlNode(base CommunityEventsTestsInterface, community *communities.Community,
|
func testAddAndSyncTokenFromEventSenderByControlNode(base CommunityEventsTestsInterface, community *communities.Community,
|
||||||
privilegesLvl token.PrivilegesLevel) {
|
privilegesLvl token.PrivilegesLevel) {
|
||||||
tokenERC721 := createCommunityToken(community.IDString(), privilegesLvl)
|
tokenERC721 := createCommunityToken(community.IDString(), privilegesLvl)
|
||||||
addCommunityTokenToCollectiblesService(base, tokenERC721)
|
addCommunityTokenToCommunityTokensService(base, tokenERC721)
|
||||||
|
|
||||||
s := base.GetSuite()
|
s := base.GetSuite()
|
||||||
|
|
||||||
|
@ -1812,7 +1812,7 @@ func testAddAndSyncTokenFromEventSenderByControlNode(base CommunityEventsTestsIn
|
||||||
|
|
||||||
func testEventSenderAddTokenMasterAndOwnerToken(base CommunityEventsTestsInterface, community *communities.Community) {
|
func testEventSenderAddTokenMasterAndOwnerToken(base CommunityEventsTestsInterface, community *communities.Community) {
|
||||||
ownerToken := createCommunityToken(community.IDString(), token.OwnerLevel)
|
ownerToken := createCommunityToken(community.IDString(), token.OwnerLevel)
|
||||||
addCommunityTokenToCollectiblesService(base, ownerToken)
|
addCommunityTokenToCommunityTokensService(base, ownerToken)
|
||||||
|
|
||||||
s := base.GetSuite()
|
s := base.GetSuite()
|
||||||
|
|
||||||
|
@ -1833,8 +1833,8 @@ func testEventSenderAddTokenMasterAndOwnerToken(base CommunityEventsTestsInterfa
|
||||||
s.Require().Error(err, communities.ErrInvalidManageTokensPermission)
|
s.Require().Error(err, communities.ErrInvalidManageTokensPermission)
|
||||||
}
|
}
|
||||||
|
|
||||||
func addCommunityTokenToCollectiblesService(base CommunityEventsTestsInterface, token *token.CommunityToken) {
|
func addCommunityTokenToCommunityTokensService(base CommunityEventsTestsInterface, token *token.CommunityToken) {
|
||||||
data := &collectibles.CollectibleContractData{
|
data := &communitytokens.CollectibleContractData{
|
||||||
TotalSupply: token.Supply,
|
TotalSupply: token.Supply,
|
||||||
Transferable: token.Transferable,
|
Transferable: token.Transferable,
|
||||||
RemoteBurnable: token.RemoteSelfDestruct,
|
RemoteBurnable: token.RemoteSelfDestruct,
|
||||||
|
|
|
@ -30,7 +30,7 @@ import (
|
||||||
"github.com/status-im/status-go/protocol/protobuf"
|
"github.com/status-im/status-go/protocol/protobuf"
|
||||||
"github.com/status-im/status-go/protocol/requests"
|
"github.com/status-im/status-go/protocol/requests"
|
||||||
"github.com/status-im/status-go/protocol/tt"
|
"github.com/status-im/status-go/protocol/tt"
|
||||||
"github.com/status-im/status-go/services/collectibles"
|
"github.com/status-im/status-go/services/communitytokens"
|
||||||
walletToken "github.com/status-im/status-go/services/wallet/token"
|
walletToken "github.com/status-im/status-go/services/wallet/token"
|
||||||
"github.com/status-im/status-go/t/helpers"
|
"github.com/status-im/status-go/t/helpers"
|
||||||
"github.com/status-im/status-go/walletdatabase"
|
"github.com/status-im/status-go/walletdatabase"
|
||||||
|
@ -81,11 +81,11 @@ func (m *TokenManagerMock) UpsertCustom(token walletToken.Token) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
type CollectiblesServiceMock struct {
|
type CollectiblesServiceMock struct {
|
||||||
Collectibles map[uint64]map[string]*collectibles.CollectibleContractData
|
Collectibles map[uint64]map[string]*communitytokens.CollectibleContractData
|
||||||
Assets map[uint64]map[string]*collectibles.AssetContractData
|
Assets map[uint64]map[string]*communitytokens.AssetContractData
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CollectiblesServiceMock) GetCollectibleContractData(chainID uint64, contractAddress string) (*collectibles.CollectibleContractData, error) {
|
func (c *CollectiblesServiceMock) GetCollectibleContractData(chainID uint64, contractAddress string) (*communitytokens.CollectibleContractData, error) {
|
||||||
collectibleContractData, dataExists := c.Collectibles[chainID][contractAddress]
|
collectibleContractData, dataExists := c.Collectibles[chainID][contractAddress]
|
||||||
if dataExists {
|
if dataExists {
|
||||||
return collectibleContractData, nil
|
return collectibleContractData, nil
|
||||||
|
@ -93,7 +93,7 @@ func (c *CollectiblesServiceMock) GetCollectibleContractData(chainID uint64, con
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CollectiblesServiceMock) GetAssetContractData(chainID uint64, contractAddress string) (*collectibles.AssetContractData, error) {
|
func (c *CollectiblesServiceMock) GetAssetContractData(chainID uint64, contractAddress string) (*communitytokens.AssetContractData, error) {
|
||||||
assetsContractData, dataExists := c.Assets[chainID][contractAddress]
|
assetsContractData, dataExists := c.Assets[chainID][contractAddress]
|
||||||
if dataExists {
|
if dataExists {
|
||||||
return assetsContractData, nil
|
return assetsContractData, nil
|
||||||
|
@ -101,24 +101,24 @@ func (c *CollectiblesServiceMock) GetAssetContractData(chainID uint64, contractA
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CollectiblesServiceMock) SetMockCollectibleContractData(chainID uint64, contractAddress string, collectible *collectibles.CollectibleContractData) {
|
func (c *CollectiblesServiceMock) SetMockCollectibleContractData(chainID uint64, contractAddress string, collectible *communitytokens.CollectibleContractData) {
|
||||||
if c.Collectibles == nil {
|
if c.Collectibles == nil {
|
||||||
c.Collectibles = make(map[uint64]map[string]*collectibles.CollectibleContractData)
|
c.Collectibles = make(map[uint64]map[string]*communitytokens.CollectibleContractData)
|
||||||
}
|
}
|
||||||
c.Collectibles[chainID] = make(map[string]*collectibles.CollectibleContractData)
|
c.Collectibles[chainID] = make(map[string]*communitytokens.CollectibleContractData)
|
||||||
c.Collectibles[chainID][contractAddress] = collectible
|
c.Collectibles[chainID][contractAddress] = collectible
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CollectiblesServiceMock) SetMockAssetContractData(chainID uint64, contractAddress string, assetData *collectibles.AssetContractData) {
|
func (c *CollectiblesServiceMock) SetMockAssetContractData(chainID uint64, contractAddress string, assetData *communitytokens.AssetContractData) {
|
||||||
if c.Assets == nil {
|
if c.Assets == nil {
|
||||||
c.Assets = make(map[uint64]map[string]*collectibles.AssetContractData)
|
c.Assets = make(map[uint64]map[string]*communitytokens.AssetContractData)
|
||||||
}
|
}
|
||||||
c.Assets[chainID] = make(map[string]*collectibles.AssetContractData)
|
c.Assets[chainID] = make(map[string]*communitytokens.AssetContractData)
|
||||||
c.Assets[chainID][contractAddress] = assetData
|
c.Assets[chainID][contractAddress] = assetData
|
||||||
}
|
}
|
||||||
|
|
||||||
func newMessenger(s *suite.Suite, shh types.Waku, logger *zap.Logger, password string, walletAddresses []string,
|
func newMessenger(s *suite.Suite, shh types.Waku, logger *zap.Logger, password string, walletAddresses []string,
|
||||||
mockedBalances *map[uint64]map[gethcommon.Address]map[gethcommon.Address]*hexutil.Big, collectiblesService collectibles.ServiceInterface) *Messenger {
|
mockedBalances *map[uint64]map[gethcommon.Address]map[gethcommon.Address]*hexutil.Big, collectiblesService communitytokens.ServiceInterface) *Messenger {
|
||||||
accountsManagerMock := &AccountManagerMock{}
|
accountsManagerMock := &AccountManagerMock{}
|
||||||
accountsManagerMock.AccountsMap = make(map[string]string)
|
accountsManagerMock.AccountsMap = make(map[string]string)
|
||||||
for _, walletAddress := range walletAddresses {
|
for _, walletAddress := range walletAddresses {
|
||||||
|
@ -161,7 +161,7 @@ func newMessenger(s *suite.Suite, shh types.Waku, logger *zap.Logger, password s
|
||||||
}
|
}
|
||||||
|
|
||||||
func newCommunitiesTestMessenger(shh types.Waku, privateKey *ecdsa.PrivateKey, logger *zap.Logger, accountsManager account.Manager,
|
func newCommunitiesTestMessenger(shh types.Waku, privateKey *ecdsa.PrivateKey, logger *zap.Logger, accountsManager account.Manager,
|
||||||
tokenManager communities.TokenManager, collectiblesService collectibles.ServiceInterface) (*Messenger, error) {
|
tokenManager communities.TokenManager, collectiblesService communitytokens.ServiceInterface) (*Messenger, error) {
|
||||||
tmpfile, err := ioutil.TempFile("", "accounts-tests-")
|
tmpfile, err := ioutil.TempFile("", "accounts-tests-")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -195,7 +195,7 @@ func newCommunitiesTestMessenger(shh types.Waku, privateKey *ecdsa.PrivateKey, l
|
||||||
}
|
}
|
||||||
|
|
||||||
if collectiblesService != nil {
|
if collectiblesService != nil {
|
||||||
options = append(options, WithCollectiblesService(collectiblesService))
|
options = append(options, WithCommunityTokensService(collectiblesService))
|
||||||
}
|
}
|
||||||
|
|
||||||
m, err := NewMessenger(
|
m, err := NewMessenger(
|
||||||
|
|
|
@ -434,8 +434,8 @@ func NewMessenger(
|
||||||
managerOptions = append(managerOptions, communities.WithWalletConfig(c.walletConfig))
|
managerOptions = append(managerOptions, communities.WithWalletConfig(c.walletConfig))
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.collectiblesService != nil {
|
if c.communityTokensService != nil {
|
||||||
managerOptions = append(managerOptions, communities.WithCollectiblesService(c.collectiblesService))
|
managerOptions = append(managerOptions, communities.WithCommunityTokensService(c.communityTokensService))
|
||||||
}
|
}
|
||||||
|
|
||||||
communitiesManager, err := communities.NewManager(identity, database, encryptionProtocol, logger, ensVerifier, transp, c.torrentConfig, managerOptions...)
|
communitiesManager, err := communities.NewManager(identity, database, encryptionProtocol, logger, ensVerifier, transp, c.torrentConfig, managerOptions...)
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"github.com/status-im/status-go/rpc"
|
"github.com/status-im/status-go/rpc"
|
||||||
"github.com/status-im/status-go/server"
|
"github.com/status-im/status-go/server"
|
||||||
"github.com/status-im/status-go/services/browsers"
|
"github.com/status-im/status-go/services/browsers"
|
||||||
|
"github.com/status-im/status-go/services/communitytokens"
|
||||||
|
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
|
@ -24,7 +25,6 @@ import (
|
||||||
"github.com/status-im/status-go/protocol/pushnotificationserver"
|
"github.com/status-im/status-go/protocol/pushnotificationserver"
|
||||||
"github.com/status-im/status-go/protocol/transport"
|
"github.com/status-im/status-go/protocol/transport"
|
||||||
"github.com/status-im/status-go/protocol/wakusync"
|
"github.com/status-im/status-go/protocol/wakusync"
|
||||||
"github.com/status-im/status-go/services/collectibles"
|
|
||||||
"github.com/status-im/status-go/services/mailservers"
|
"github.com/status-im/status-go/services/mailservers"
|
||||||
"github.com/status-im/status-go/services/wallet"
|
"github.com/status-im/status-go/services/wallet"
|
||||||
)
|
)
|
||||||
|
@ -87,7 +87,7 @@ type config struct {
|
||||||
torrentConfig *params.TorrentConfig
|
torrentConfig *params.TorrentConfig
|
||||||
walletConfig *params.WalletConfig
|
walletConfig *params.WalletConfig
|
||||||
walletService *wallet.Service
|
walletService *wallet.Service
|
||||||
collectiblesService collectibles.ServiceInterface
|
communityTokensService communitytokens.ServiceInterface
|
||||||
httpServer *server.MediaServer
|
httpServer *server.MediaServer
|
||||||
rpcClient *rpc.Client
|
rpcClient *rpc.Client
|
||||||
tokenManager communities.TokenManager
|
tokenManager communities.TokenManager
|
||||||
|
@ -336,9 +336,9 @@ func WithWalletService(s *wallet.Service) Option {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func WithCollectiblesService(s collectibles.ServiceInterface) Option {
|
func WithCommunityTokensService(s communitytokens.ServiceInterface) Option {
|
||||||
return func(c *config) error {
|
return func(c *config) error {
|
||||||
c.collectiblesService = s
|
c.communityTokensService = s
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package collectibles
|
package communitytokens
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
|
@ -1,4 +1,4 @@
|
||||||
package collectibles
|
package communitytokens
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"math/big"
|
"math/big"
|
|
@ -1,4 +1,4 @@
|
||||||
package collectibles
|
package communitytokens
|
||||||
|
|
||||||
import "github.com/status-im/status-go/services/wallet/bigint"
|
import "github.com/status-im/status-go/services/wallet/bigint"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package collectibles
|
package communitytokens
|
||||||
|
|
||||||
import "github.com/status-im/status-go/services/wallet/bigint"
|
import "github.com/status-im/status-go/services/wallet/bigint"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package collectibles
|
package communitytokens
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
|
@ -1,4 +1,4 @@
|
||||||
package collectibles
|
package communitytokens
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
|
@ -1,4 +1,4 @@
|
||||||
package collectibles
|
package communitytokens
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
|
@ -1,4 +1,4 @@
|
||||||
package collectibles
|
package communitytokens
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
@ -45,7 +45,7 @@ func (s *Service) Protocols() []p2p.Protocol {
|
||||||
func (s *Service) APIs() []ethRpc.API {
|
func (s *Service) APIs() []ethRpc.API {
|
||||||
return []ethRpc.API{
|
return []ethRpc.API{
|
||||||
{
|
{
|
||||||
Namespace: "collectibles",
|
Namespace: "communitytokens",
|
||||||
Version: "0.1.0",
|
Version: "0.1.0",
|
||||||
Service: NewAPI(s),
|
Service: NewAPI(s),
|
||||||
Public: true,
|
Public: true,
|
|
@ -1,4 +1,4 @@
|
||||||
package collectibles
|
package communitytokens
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
|
@ -44,7 +44,7 @@ import (
|
||||||
"github.com/status-im/status-go/rpc"
|
"github.com/status-im/status-go/rpc"
|
||||||
"github.com/status-im/status-go/server"
|
"github.com/status-im/status-go/server"
|
||||||
"github.com/status-im/status-go/services/browsers"
|
"github.com/status-im/status-go/services/browsers"
|
||||||
"github.com/status-im/status-go/services/collectibles"
|
"github.com/status-im/status-go/services/communitytokens"
|
||||||
"github.com/status-im/status-go/services/ext/mailservers"
|
"github.com/status-im/status-go/services/ext/mailservers"
|
||||||
localnotifications "github.com/status-im/status-go/services/local-notifications"
|
localnotifications "github.com/status-im/status-go/services/local-notifications"
|
||||||
mailserversDB "github.com/status-im/status-go/services/mailservers"
|
mailserversDB "github.com/status-im/status-go/services/mailservers"
|
||||||
|
@ -116,7 +116,7 @@ func (s *Service) GetPeer(rawURL string) (*enode.Node, error) {
|
||||||
return enode.ParseV4(rawURL)
|
return enode.ParseV4(rawURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
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, collectiblesService *collectibles.Service, logger *zap.Logger) 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 *communitytokens.Service, logger *zap.Logger) error {
|
||||||
var err error
|
var err error
|
||||||
if !s.config.ShhextConfig.PFSEnabled {
|
if !s.config.ShhextConfig.PFSEnabled {
|
||||||
return nil
|
return nil
|
||||||
|
@ -155,7 +155,7 @@ func (s *Service) InitProtocol(nodeName string, identity *ecdsa.PrivateKey, appD
|
||||||
s.multiAccountsDB = multiAccountDb
|
s.multiAccountsDB = multiAccountDb
|
||||||
s.account = acc
|
s.account = acc
|
||||||
|
|
||||||
options, err := buildMessengerOptions(s.config, identity, appDb, walletDb, httpServer, s.rpcClient, s.multiAccountsDB, acc, envelopesMonitorConfig, s.accountsDB, walletService, collectiblesService, logger, &MessengerSignalsHandler{})
|
options, err := buildMessengerOptions(s.config, identity, appDb, walletDb, httpServer, s.rpcClient, s.multiAccountsDB, acc, envelopesMonitorConfig, s.accountsDB, walletService, communityTokensService, logger, &MessengerSignalsHandler{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -413,7 +413,7 @@ func buildMessengerOptions(
|
||||||
envelopesMonitorConfig *transport.EnvelopesMonitorConfig,
|
envelopesMonitorConfig *transport.EnvelopesMonitorConfig,
|
||||||
accountsDB *accounts.Database,
|
accountsDB *accounts.Database,
|
||||||
walletService *wallet.Service,
|
walletService *wallet.Service,
|
||||||
collectiblesService *collectibles.Service,
|
communityTokensService *communitytokens.Service,
|
||||||
logger *zap.Logger,
|
logger *zap.Logger,
|
||||||
messengerSignalsHandler protocol.MessengerSignalsHandler,
|
messengerSignalsHandler protocol.MessengerSignalsHandler,
|
||||||
) ([]protocol.Option, error) {
|
) ([]protocol.Option, error) {
|
||||||
|
@ -436,7 +436,7 @@ func buildMessengerOptions(
|
||||||
protocol.WithMessageCSV(config.OutputMessageCSVEnabled),
|
protocol.WithMessageCSV(config.OutputMessageCSVEnabled),
|
||||||
protocol.WithWalletConfig(&config.WalletConfig),
|
protocol.WithWalletConfig(&config.WalletConfig),
|
||||||
protocol.WithWalletService(walletService),
|
protocol.WithWalletService(walletService),
|
||||||
protocol.WithCollectiblesService(collectiblesService),
|
protocol.WithCommunityTokensService(communityTokensService),
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.ShhextConfig.DataSyncEnabled {
|
if config.ShhextConfig.DataSyncEnabled {
|
||||||
|
|
Loading…
Reference in New Issue