communities

package
v0.167.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2023 License: MPL-2.0, MPL-2.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

View Source
const OR = " OR "

Variables

View Source
var (
	ErrTorrentTimedout                 = errors.New("torrent has timed out")
	ErrCommunityRequestAlreadyRejected = errors.New("that user was already rejected from the community")
)

errors

View Source
var ErrAlreadyJoined = errors.New("already joined")
View Source
var ErrAlreadyMember = errors.New("already a member")
View Source
var ErrCannotBanOwnerOrAdmin = errors.New("not allowed to ban admin or owner")
View Source
var ErrCannotRemoveOwnerOrAdmin = errors.New("not allowed to remove admin or owner")
View Source
var ErrCantRequestAccess = errors.New("can't request access")
View Source
var ErrCategoryAlreadyExists = errors.New("category already exists")
View Source
var ErrCategoryNotFound = errors.New("category not found")
View Source
var ErrChatAlreadyAssigned = errors.New("chat already assigned to a category")
View Source
var ErrChatAlreadyExists = errors.New("chat already exists")
View Source
var ErrChatNotFound = errors.New("chat not found")
View Source
var ErrInvalidCommunityDescription = errors.New("invalid community description")
View Source
var ErrInvalidCommunityDescriptionCategoryNoID = errors.New("invalid community category id")
View Source
var ErrInvalidCommunityDescriptionCategoryNoName = errors.New("invalid community category name")
View Source
var ErrInvalidCommunityDescriptionChatIdentity = errors.New("invalid community chat name, missing")
View Source
var ErrInvalidCommunityDescriptionDuplicatedName = errors.New("invalid community chat name, duplicated")
View Source
var ErrInvalidCommunityDescriptionMemberInChatButNotInOrg = errors.New("invalid community description member in chat but not in org")
View Source
var ErrInvalidCommunityDescriptionNoChatPermissions = errors.New("invalid community description no chat permissions")
View Source
var ErrInvalidCommunityDescriptionNoOrgPermissions = errors.New("invalid community description no org permissions")
View Source
var ErrInvalidCommunityDescriptionUnknownChatAccess = errors.New("invalid community description unknown chat access")
View Source
var ErrInvalidCommunityDescriptionUnknownChatCategory = errors.New("invalid community category in chat")
View Source
var ErrInvalidCommunityDescriptionUnknownOrgAccess = errors.New("invalid community description unknown org access")
View Source
var ErrInvalidCommunityEventClock = errors.New("clock for admin event message is outdated")
View Source
var ErrInvalidCommunityTags = errors.New("invalid community tags")
View Source
var ErrInvalidGrant = errors.New("invalid grant")
View Source
var ErrInvalidManageTokensPermission = errors.New("no privileges to manage tokens")
View Source
var ErrInvalidMessage = errors.New("invalid community description message")
View Source
var ErrMemberNotFound = errors.New("member not found")
View Source
var ErrMemberWalletAlreadyExists = errors.New("member wallet already exists")
View Source
var ErrMemberWalletNotFound = errors.New("member wallet not found")
View Source
var ErrNoChangeInPosition = errors.New("no change in category position")
View Source
var ErrNoPermissionToJoin = errors.New("member has no permission to join")
View Source
var ErrNotAdmin = errors.New("no admin privileges for this community")
View Source
var ErrNotAuthorized = errors.New("not authorized")
View Source
var ErrNotControlNode = errors.New("no owner private key found for this community")
View Source
var ErrNotEnoughPermissions = errors.New("not enough permissions for this community")
View Source
var ErrNotOwner = errors.New("no owner privileges for this community")
View Source
var ErrOldRequestToJoin = errors.New("old request to join")
View Source
var ErrOldRequestToLeave = errors.New("old request to leave")
View Source
var ErrOrgAlreadyJoined = errors.New("community already joined")
View Source
var ErrOrgNotFound = errors.New("community not found")
View Source
var ErrTokenPermissionAlreadyExists = errors.New("token permission already exists")
View Source
var ErrTokenPermissionNotFound = errors.New("token permission not found")

Functions

func AddTimeoutToRequestToJoinClock added in v0.146.4

func AddTimeoutToRequestToJoinClock(clock uint64) (uint64, error)

func CalculateRequestID added in v0.106.3

func CalculateRequestID(publicKey string, communityID types.HexBytes) types.HexBytes

func ExtractTokenCriteria added in v0.158.0

func ExtractTokenCriteria(permissions []*CommunityTokenPermission) (erc20TokenCriteria map[uint64]map[string]*protobuf.TokenCriteria, erc721TokenCriteria map[uint64]map[string]*protobuf.TokenCriteria, ensTokenCriteria []string)

func RolesAuthorizedToPerformEvent added in v0.163.4

func RolesAuthorizedToPerformEvent(roles []protobuf.CommunityMember_Roles, event *CommunityEvent) bool

func ValidateCommunityDescription

func ValidateCommunityDescription(desc *protobuf.CommunityDescription) error

Types

type AccountChainIDsCombination added in v0.158.0

type AccountChainIDsCombination struct {
	Address  gethcommon.Address `json:"address"`
	ChainIDs []uint64           `json:"chainIds"`
}

type BalancesByChain added in v0.158.0

type BalancesByChain = map[uint64]map[gethcommon.Address]map[gethcommon.Address]*hexutil.Big

type CheckAllChannelsPermissionsResponse added in v0.159.2

type CheckAllChannelsPermissionsResponse struct {
	Channels map[string]*CheckChannelPermissionsResponse `json:"channels"`
}

type CheckChannelPermissionsResponse added in v0.159.2

type CheckChannelPermissionsResponse struct {
	ViewOnlyPermissions    *CheckChannelViewOnlyPermissionsResult    `json:"viewOnlyPermissions"`
	ViewAndPostPermissions *CheckChannelViewAndPostPermissionsResult `json:"viewAndPostPermissions"`
}

type CheckChannelViewAndPostPermissionsResult added in v0.159.2

type CheckChannelViewAndPostPermissionsResult struct {
	Satisfied   bool                                      `json:"satisfied"`
	Permissions map[string]*PermissionTokenCriteriaResult `json:"permissions"`
}

type CheckChannelViewOnlyPermissionsResult added in v0.159.2

type CheckChannelViewOnlyPermissionsResult struct {
	Satisfied   bool                                      `json:"satisfied"`
	Permissions map[string]*PermissionTokenCriteriaResult `json:"permissions"`
}

type CheckPermissionToJoinResponse added in v0.151.13

type CheckPermissionToJoinResponse = CheckPermissionsResponse

type CheckPermissionsResponse added in v0.159.2

type CheckPermissionsResponse struct {
	Satisfied         bool                                      `json:"satisfied"`
	Permissions       map[string]*PermissionTokenCriteriaResult `json:"permissions"`
	ValidCombinations []*AccountChainIDsCombination             `json:"validCombinations"`
}

type CollectiblesByChain added in v0.158.0

type CollectiblesManager added in v0.162.5

type CollectiblesManager interface {
	FetchBalancesByOwnerAndContractAddress(chainID walletcommon.ChainID, ownerAddress gethcommon.Address, contractAddresses []gethcommon.Address) (thirdparty.TokenBalancesPerContractAddress, error)
}

type Community

type Community struct {
	// contains filtered or unexported fields
}

func New

func New(config Config) (*Community, error)

func (*Community) AcceptRequestToJoinAutomatically added in v0.103.2

func (o *Community) AcceptRequestToJoinAutomatically() bool

func (*Community) AddCommunityTokensMetadata added in v0.137.2

func (o *Community) AddCommunityTokensMetadata(token *protobuf.CommunityTokenMetadata) (*protobuf.CommunityDescription, error)

func (*Community) AddMember added in v0.103.2

func (o *Community) AddMember(publicKey *ecdsa.PublicKey, roles []protobuf.CommunityMember_Roles) (*CommunityChanges, error)

func (*Community) AddMemberToChat added in v0.162.9

func (o *Community) AddMemberToChat(chatID string, publicKey *ecdsa.PublicKey, roles []protobuf.CommunityMember_Roles) (*CommunityChanges, error)

func (*Community) AddMemberWithRevealedAccounts added in v0.162.5

func (o *Community) AddMemberWithRevealedAccounts(dbRequest *RequestToJoin, roles []protobuf.CommunityMember_Roles, accounts []*protobuf.RevealedAccount) (*CommunityChanges, error)

func (*Community) AddRequestToJoin added in v0.83.8

func (o *Community) AddRequestToJoin(request *RequestToJoin)

func (*Community) AddRoleToMember added in v0.115.5

func (*Community) AdminSettings added in v0.158.0

func (o *Community) AdminSettings() *protobuf.CommunityAdminSettings

func (*Community) AllowsAllMembersToPinMessage added in v0.100.0

func (o *Community) AllowsAllMembersToPinMessage() bool

func (*Community) BanUserFromCommunity added in v0.73.9

func (o *Community) BanUserFromCommunity(pk *ecdsa.PublicKey) (*protobuf.CommunityDescription, error)

func (*Community) BuildGrant added in v0.103.2

func (o *Community) BuildGrant(key *ecdsa.PublicKey, chatID string) ([]byte, error)

func (*Community) CanDeleteMessageForEveryone added in v0.115.5

func (o *Community) CanDeleteMessageForEveryone(pk *ecdsa.PublicKey) bool

func (*Community) CanManageUsers added in v0.72.0

func (o *Community) CanManageUsers(pk *ecdsa.PublicKey) bool

func (*Community) CanManageUsersPublicKeys added in v0.74.2

func (o *Community) CanManageUsersPublicKeys() ([]*ecdsa.PublicKey, error)

func (*Community) CanMemberIdentityPost added in v0.94.12

func (o *Community) CanMemberIdentityPost(chatID string) (bool, error)

func (*Community) CanPost

func (o *Community) CanPost(pk *ecdsa.PublicKey, chatID string, grantBytes []byte) (bool, error)

func (*Community) CanRequestAccess added in v0.72.0

func (o *Community) CanRequestAccess(pk *ecdsa.PublicKey) bool

func (*Community) Categories added in v0.79.3

func (o *Community) Categories() map[string]*protobuf.CommunityCategory

func (*Community) ChannelHasTokenPermissions added in v0.162.13

func (o *Community) ChannelHasTokenPermissions(chatID string) bool

func (*Community) ChannelTokenPermissionsByType added in v0.159.2

func (o *Community) ChannelTokenPermissionsByType(channelID string, permissionType protobuf.CommunityTokenPermission_Type) []*CommunityTokenPermission

func (*Community) ChatIDs added in v0.97.4

func (o *Community) ChatIDs() (chatIDs []string)

func (*Community) Chats

func (o *Community) Chats() map[string]*protobuf.CommunityChat

func (*Community) ChatsByCategoryID added in v0.102.6

func (o *Community) ChatsByCategoryID(categoryID string) []string

func (*Community) Clock added in v0.72.0

func (o *Community) Clock() uint64

func (*Community) Color added in v0.101.1

func (o *Community) Color() string

func (*Community) CommunityChatsIDs added in v0.162.5

func (o *Community) CommunityChatsIDs() []string

func (*Community) CommunityTokensMetadata added in v0.137.2

func (o *Community) CommunityTokensMetadata() []*protobuf.CommunityTokenMetadata

func (*Community) CreateCategory added in v0.79.3

func (o *Community) CreateCategory(categoryID string, categoryName string, chatIDs []string) (*CommunityChanges, error)

func (*Community) CreateChat

func (o *Community) CreateChat(chatID string, chat *protobuf.CommunityChat) (*CommunityChanges, error)

func (*Community) CreateDeepCopy added in v0.162.13

func (o *Community) CreateDeepCopy() *Community

func (*Community) DeclineRequestToJoin

func (o *Community) DeclineRequestToJoin(dbRequest *RequestToJoin) error

func (*Community) DefaultFilters added in v0.83.2

func (o *Community) DefaultFilters() []transport.FiltersToInitialize

func (*Community) DeleteCategory added in v0.79.3

func (o *Community) DeleteCategory(categoryID string) (*CommunityChanges, error)

func (*Community) DeleteChat

func (o *Community) DeleteChat(chatID string) (*CommunityChanges, error)

func (*Community) DeleteTokenPermission added in v0.136.0

func (o *Community) DeleteTokenPermission(permissionID string) (*CommunityChanges, error)

func (*Community) Description added in v0.76.3

func (o *Community) Description() *protobuf.CommunityDescription

func (*Community) DescriptionText added in v0.83.8

func (o *Community) DescriptionText() string

func (*Community) Edit added in v0.79.0

func (o *Community) Edit(description *protobuf.CommunityDescription)

func (*Community) EditCategory added in v0.79.3

func (o *Community) EditCategory(categoryID string, categoryName string, chatIDs []string) (*CommunityChanges, error)

func (*Community) EditChat added in v0.79.8

func (o *Community) EditChat(chatID string, chat *protobuf.CommunityChat) (*CommunityChanges, error)

func (*Community) Encrypted added in v0.102.2

func (o *Community) Encrypted() bool

func (*Community) GetFilteredPrivilegedMembers added in v0.167.2

func (o *Community) GetFilteredPrivilegedMembers(skipMembers map[string]struct{}) map[protobuf.CommunityMember_Roles][]*ecdsa.PublicKey

func (*Community) GetMember added in v0.161.4

func (o *Community) GetMember(pk *ecdsa.PublicKey) *protobuf.CommunityMember

func (*Community) GetMemberPubkeys added in v0.102.2

func (o *Community) GetMemberPubkeys() []*ecdsa.PublicKey

func (*Community) GetPrivilegedMembers added in v0.162.13

func (o *Community) GetPrivilegedMembers() []*ecdsa.PublicKey

func (*Community) HasMember

func (o *Community) HasMember(pk *ecdsa.PublicKey) bool

func (*Community) HasPermissionToSendCommunityEvents added in v0.162.13

func (o *Community) HasPermissionToSendCommunityEvents() bool

func (*Community) HasTokenPermissions added in v0.141.1

func (o *Community) HasTokenPermissions() bool

func (*Community) ID

func (o *Community) ID() types.HexBytes

func (*Community) IDString

func (o *Community) IDString() string

func (*Community) Identity added in v0.158.0

func (o *Community) Identity() *protobuf.ChatIdentity

func (*Community) Images added in v0.101.1

func (o *Community) Images() map[string]*protobuf.IdentityImage

func (*Community) IntroMessage added in v0.100.1

func (o *Community) IntroMessage() string

func (*Community) InvitationOnly added in v0.72.0

func (o *Community) InvitationOnly() bool

func (*Community) IsAdmin

func (o *Community) IsAdmin() bool

func (*Community) IsBanned added in v0.73.9

func (o *Community) IsBanned(pk *ecdsa.PublicKey) bool

func (*Community) IsControlNode added in v0.162.9

func (o *Community) IsControlNode() bool

We treat control node as an owner with community key

func (*Community) IsMemberAdmin added in v0.74.2

func (o *Community) IsMemberAdmin(publicKey *ecdsa.PublicKey) bool

func (*Community) IsMemberInChat

func (o *Community) IsMemberInChat(pk *ecdsa.PublicKey, chatID string) bool

func (*Community) IsMemberOwner added in v0.158.0

func (o *Community) IsMemberOwner(publicKey *ecdsa.PublicKey) bool

func (*Community) IsMemberTokenMaster added in v0.162.13

func (o *Community) IsMemberTokenMaster(publicKey *ecdsa.PublicKey) bool

func (*Community) IsOwnerWithoutCommunityKey added in v0.162.13

func (o *Community) IsOwnerWithoutCommunityKey() bool

func (*Community) IsPrivilegedMember added in v0.162.13

func (o *Community) IsPrivilegedMember(publicKey *ecdsa.PublicKey) bool

func (*Community) IsTokenMaster added in v0.162.15

func (o *Community) IsTokenMaster() bool

func (*Community) Join

func (o *Community) Join()

func (*Community) Joined

func (o *Community) Joined() bool

func (*Community) Leave

func (o *Community) Leave()

func (*Community) MagnetlinkMessageChannelID added in v0.96.2

func (o *Community) MagnetlinkMessageChannelID() string

func (*Community) MarshalJSON

func (o *Community) MarshalJSON() ([]byte, error)

func (*Community) MarshalPublicAPIJSON added in v0.86.2

func (o *Community) MarshalPublicAPIJSON() ([]byte, error)

func (*Community) MarshaledDescription

func (o *Community) MarshaledDescription() ([]byte, error)

func (*Community) MemberCanManageToken added in v0.163.14

func (o *Community) MemberCanManageToken(member *ecdsa.PublicKey, token *community_token.CommunityToken) bool

func (*Community) MemberIdentity added in v0.94.12

func (o *Community) MemberIdentity() *ecdsa.PublicKey

func (*Community) MemberRole added in v0.158.0

func (o *Community) MemberRole(pubKey *ecdsa.PublicKey) protobuf.CommunityMember_Roles

func (*Community) MemberUpdateChannelID added in v0.103.3

func (o *Community) MemberUpdateChannelID() string

func (*Community) Members added in v0.140.0

func (o *Community) Members() map[string]*protobuf.CommunityMember

func (*Community) MembersCount added in v0.76.3

func (o *Community) MembersCount() int

func (*Community) MuteTill added in v0.159.2

func (o *Community) MuteTill() time.Time

func (*Community) Muted added in v0.83.8

func (o *Community) Muted() bool

func (*Community) Name added in v0.74.2

func (o *Community) Name() string

func (*Community) NewCommunityEventClock added in v0.162.5

func (o *Community) NewCommunityEventClock() uint64

func (*Community) OnRequest added in v0.72.0

func (o *Community) OnRequest() bool

func (*Community) OutroMessage added in v0.100.1

func (o *Community) OutroMessage() string

func (*Community) Permissions added in v0.158.0

func (o *Community) Permissions() *protobuf.CommunityPermissions

func (*Community) PopulateChatWithAllMembers added in v0.162.13

func (o *Community) PopulateChatWithAllMembers(chatID string) (*CommunityChanges, error)

func (*Community) PrivateKey

func (o *Community) PrivateKey() *ecdsa.PrivateKey

func (*Community) PublicKey added in v0.72.0

func (o *Community) PublicKey() *ecdsa.PublicKey

func (*Community) PubsubTopic added in v0.166.1

func (o *Community) PubsubTopic() string

func (*Community) RemoveOurselvesFromOrg added in v0.110.2

func (o *Community) RemoveOurselvesFromOrg(pk *ecdsa.PublicKey)

func (*Community) RemoveRoleFromMember added in v0.115.5

func (*Community) RemoveUserFromChat

func (o *Community) RemoveUserFromChat(pk *ecdsa.PublicKey, chatID string) (*protobuf.CommunityDescription, error)

func (*Community) RemoveUserFromOrg

func (o *Community) RemoveUserFromOrg(pk *ecdsa.PublicKey) (*protobuf.CommunityDescription, error)

func (*Community) ReorderCategories added in v0.79.3

func (o *Community) ReorderCategories(categoryID string, newPosition int) (*CommunityChanges, error)

func (*Community) ReorderChat added in v0.79.3

func (o *Community) ReorderChat(categoryID string, chatID string, newPosition int) (*CommunityChanges, error)

func (*Community) RequestedToJoinAt added in v0.72.0

func (o *Community) RequestedToJoinAt() uint64

func (*Community) RequestsToJoin added in v0.83.8

func (o *Community) RequestsToJoin() []*RequestToJoin

func (*Community) SetActiveMembersCount added in v0.142.1

func (o *Community) SetActiveMembersCount(activeMembersCount uint64) (updated bool, err error)

func (*Community) SortCategoryChats added in v0.79.3

func (o *Community) SortCategoryChats(changes *CommunityChanges, categoryID string)

func (*Community) Spectate added in v0.111.5

func (o *Community) Spectate()

func (*Community) Spectated added in v0.111.5

func (o *Community) Spectated() bool

func (*Community) StatusUpdatesChannelID added in v0.83.2

func (o *Community) StatusUpdatesChannelID() string

func (*Community) Tags added in v0.102.5

func (o *Community) Tags() []CommunityTag

func (*Community) TagsIndices added in v0.161.2

func (o *Community) TagsIndices() []uint32

func (*Community) TagsRaw added in v0.158.0

func (o *Community) TagsRaw() []string

func (*Community) ToAddTokenMetadataCommunityEvent added in v0.162.15

func (o *Community) ToAddTokenMetadataCommunityEvent(tokenMetadata *protobuf.CommunityTokenMetadata) *CommunityEvent

func (*Community) ToBanCommunityMemberCommunityEvent added in v0.162.5

func (o *Community) ToBanCommunityMemberCommunityEvent(pubkey string) *CommunityEvent

func (*Community) ToCommunityEditCommunityEvent added in v0.162.5

func (o *Community) ToCommunityEditCommunityEvent(description *protobuf.CommunityDescription) *CommunityEvent

func (*Community) ToCommunityEventsMessage added in v0.162.5

func (o *Community) ToCommunityEventsMessage() *CommunityEventsMessage

func (*Community) ToCommunityRequestToJoinAcceptCommunityEvent added in v0.162.5

func (o *Community) ToCommunityRequestToJoinAcceptCommunityEvent(changes *CommunityEventChanges) *CommunityEvent

func (*Community) ToCommunityRequestToJoinRejectCommunityEvent added in v0.162.5

func (o *Community) ToCommunityRequestToJoinRejectCommunityEvent(changes *CommunityEventChanges) *CommunityEvent

func (*Community) ToCommunityTokenPermissionChangeCommunityEvent added in v0.162.5

func (o *Community) ToCommunityTokenPermissionChangeCommunityEvent(permission *protobuf.CommunityTokenPermission) *CommunityEvent

func (*Community) ToCommunityTokenPermissionDeleteCommunityEvent added in v0.162.5

func (o *Community) ToCommunityTokenPermissionDeleteCommunityEvent(permission *protobuf.CommunityTokenPermission) *CommunityEvent

func (*Community) ToCreateCategoryCommunityEvent added in v0.162.5

func (o *Community) ToCreateCategoryCommunityEvent(categoryID string, categoryName string, channelsIds []string) *CommunityEvent

func (*Community) ToCreateChannelCommunityEvent added in v0.162.5

func (o *Community) ToCreateChannelCommunityEvent(channelID string, channel *protobuf.CommunityChat) *CommunityEvent

func (*Community) ToDeleteCategoryCommunityEvent added in v0.162.5

func (o *Community) ToDeleteCategoryCommunityEvent(categoryID string) *CommunityEvent

func (*Community) ToDeleteChannelCommunityEvent added in v0.162.5

func (o *Community) ToDeleteChannelCommunityEvent(channelID string) *CommunityEvent

func (*Community) ToEditCategoryCommunityEvent added in v0.162.5

func (o *Community) ToEditCategoryCommunityEvent(categoryID string, categoryName string, channelsIds []string) *CommunityEvent

func (*Community) ToEditChannelCommunityEvent added in v0.162.5

func (o *Community) ToEditChannelCommunityEvent(channelID string, channel *protobuf.CommunityChat) *CommunityEvent

func (*Community) ToKickCommunityMemberCommunityEvent added in v0.162.5

func (o *Community) ToKickCommunityMemberCommunityEvent(pubkey string) *CommunityEvent

func (*Community) ToProtocolMessageBytes added in v0.162.14

func (o *Community) ToProtocolMessageBytes() ([]byte, error)

ToProtocolMessageBytes returns the community in a wrapped & signed protocol message

func (*Community) ToReorderCategoryCommunityEvent added in v0.162.5

func (o *Community) ToReorderCategoryCommunityEvent(categoryID string, position int) *CommunityEvent

func (*Community) ToReorderChannelCommunityEvent added in v0.162.5

func (o *Community) ToReorderChannelCommunityEvent(categoryID string, channelID string, position int) *CommunityEvent

func (*Community) ToSyncInstallationCommunityProtobuf added in v0.163.14

func (o *Community) ToSyncInstallationCommunityProtobuf(clock uint64, communitySettings *CommunitySettings) (*protobuf.SyncInstallationCommunity, error)

func (*Community) ToUnbanCommunityMemberCommunityEvent added in v0.162.5

func (o *Community) ToUnbanCommunityMemberCommunityEvent(pubkey string) *CommunityEvent

func (*Community) TokenPermissionByID added in v0.166.1

func (o *Community) TokenPermissionByID(ID string) *CommunityTokenPermission

func (*Community) TokenPermissions added in v0.139.1

func (o *Community) TokenPermissions() map[string]*CommunityTokenPermission

func (*Community) TokenPermissionsByType added in v0.139.1

func (o *Community) TokenPermissionsByType(permissionType protobuf.CommunityTokenPermission_Type) []*CommunityTokenPermission

func (*Community) UnbanUserFromCommunity added in v0.102.6

func (o *Community) UnbanUserFromCommunity(pk *ecdsa.PublicKey) (*protobuf.CommunityDescription, error)

func (*Community) UpdateChatFirstMessageTimestamp added in v0.109.1

func (o *Community) UpdateChatFirstMessageTimestamp(chatID string, timestamp uint32) (*CommunityChanges, error)

func (*Community) UpdateCommunityByEvents added in v0.162.5

func (o *Community) UpdateCommunityByEvents(communityEventMessage *CommunityEventsMessage) error

func (*Community) UpdateCommunityDescription added in v0.72.0

func (o *Community) UpdateCommunityDescription(description *protobuf.CommunityDescription, rawMessage []byte) (*CommunityChanges, error)

UpdateCommunityDescription will update the community to the new community description and return a list of changes

func (*Community) UpsertTokenPermission added in v0.166.1

func (o *Community) UpsertTokenPermission(tokenPermission *protobuf.CommunityTokenPermission) (*CommunityChanges, error)

func (*Community) ValidateEditSharedAddresses added in v0.161.4

func (o *Community) ValidateEditSharedAddresses(signer *ecdsa.PublicKey, request *protobuf.CommunityEditSharedAddresses) error

ValidateRequestToJoin validates a request, checks that the right permissions are applied

func (*Community) ValidateEvent added in v0.163.4

func (o *Community) ValidateEvent(event *CommunityEvent, signer *ecdsa.PublicKey) error

func (*Community) ValidateRequestToJoin added in v0.72.0

func (o *Community) ValidateRequestToJoin(signer *ecdsa.PublicKey, request *protobuf.CommunityRequestToJoin) error

ValidateRequestToJoin validates a request, checks that the right permissions are applied

func (*Community) Verified added in v0.83.8

func (o *Community) Verified() bool

func (*Community) VerifyGrantSignature

func (o *Community) VerifyGrantSignature(data []byte) (*protobuf.Grant, error)

type CommunityAdminSettings added in v0.100.0

type CommunityAdminSettings struct {
	PinMessageAllMembersEnabled bool `json:"pinMessageAllMembersEnabled"`
}

type CommunityCategory added in v0.79.3

type CommunityCategory struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	Position int    `json:"position"` // Position is used to sort the categories
}

type CommunityChanges

type CommunityChanges struct {
	Community *Community `json:"community"`

	MembersAdded   map[string]*protobuf.CommunityMember `json:"membersAdded"`
	MembersRemoved map[string]*protobuf.CommunityMember `json:"membersRemoved"`

	TokenPermissionsAdded    map[string]*CommunityTokenPermission `json:"tokenPermissionsAdded"`
	TokenPermissionsModified map[string]*CommunityTokenPermission `json:"tokenPermissionsModified"`
	TokenPermissionsRemoved  map[string]*CommunityTokenPermission `json:"tokenPermissionsRemoved"`

	ChatsRemoved  map[string]*protobuf.CommunityChat `json:"chatsRemoved"`
	ChatsAdded    map[string]*protobuf.CommunityChat `json:"chatsAdded"`
	ChatsModified map[string]*CommunityChatChanges   `json:"chatsModified"`

	CategoriesRemoved  []string                               `json:"categoriesRemoved"`
	CategoriesAdded    map[string]*protobuf.CommunityCategory `json:"categoriesAdded"`
	CategoriesModified map[string]*protobuf.CommunityCategory `json:"categoriesModified"`

	MemberWalletsRemoved []string                               `json:"memberWalletsRemoved"`
	MemberWalletsAdded   map[string][]*protobuf.RevealedAccount `json:"memberWalletsAdded"`

	// ShouldMemberJoin indicates whether the user should join this community
	// automatically
	ShouldMemberJoin bool `json:"memberAdded"`

	// ShouldMemberJoin indicates whether the user should leave this community
	// automatically
	ShouldMemberLeave bool `json:"memberRemoved"`
}

func EmptyCommunityChanges added in v0.162.3

func EmptyCommunityChanges() *CommunityChanges

func EvaluateCommunityChanges added in v0.162.3

func EvaluateCommunityChanges(origin, modified *Community) *CommunityChanges

func (*CommunityChanges) HasMemberLeft added in v0.72.0

func (c *CommunityChanges) HasMemberLeft(identity string) bool

func (*CommunityChanges) HasNewMember added in v0.72.0

func (c *CommunityChanges) HasNewMember(identity string) bool

type CommunityChat added in v0.72.0

type CommunityChat struct {
	ID          string                               `json:"id"`
	Name        string                               `json:"name"`
	Color       string                               `json:"color"`
	Emoji       string                               `json:"emoji"`
	Description string                               `json:"description"`
	Members     map[string]*protobuf.CommunityMember `json:"members"`
	Permissions *protobuf.CommunityPermissions       `json:"permissions"`
	CanPost     bool                                 `json:"canPost"`
	Position    int                                  `json:"position"`
	CategoryID  string                               `json:"categoryID"`
}

type CommunityChatChanges

type CommunityChatChanges struct {
	ChatModified                  *protobuf.CommunityChat
	MembersAdded                  map[string]*protobuf.CommunityMember
	MembersRemoved                map[string]*protobuf.CommunityMember
	CategoryModified              string
	PositionModified              int
	FirstMessageTimestampModified uint32
}

type CommunityEvent added in v0.162.5

type CommunityEvent struct {
	CommunityEventClock    uint64                                      `json:"communityEventClock"`
	Type                   protobuf.CommunityEvent_EventType           `json:"type"`
	CommunityConfig        *protobuf.CommunityConfig                   `json:"communityConfig,omitempty"`
	TokenPermission        *protobuf.CommunityTokenPermission          `json:"tokenPermissions,omitempty"`
	CategoryData           *protobuf.CategoryData                      `json:"categoryData,omitempty"`
	ChannelData            *protobuf.ChannelData                       `json:"channelData,omitempty"`
	MemberToAction         string                                      `json:"memberToAction,omitempty"`
	MembersAdded           map[string]*protobuf.CommunityMember        `json:"membersAdded,omitempty"`
	RejectedRequestsToJoin map[string]*protobuf.CommunityRequestToJoin `json:"rejectedRequestsToJoin,omitempty"`
	AcceptedRequestsToJoin map[string]*protobuf.CommunityRequestToJoin `json:"acceptedRequestsToJoin,omitempty"`
	TokenMetadata          *protobuf.CommunityTokenMetadata            `json:"tokenMetadata,omitempty"`
	Payload                []byte                                      `json:"payload"`
	Signature              []byte                                      `json:"signature"`
}

func (*CommunityEvent) RecoverSigner added in v0.163.5

func (e *CommunityEvent) RecoverSigner() (*ecdsa.PublicKey, error)

func (*CommunityEvent) Sign added in v0.163.5

func (e *CommunityEvent) Sign(pk *ecdsa.PrivateKey) error

func (*CommunityEvent) ToProtobuf added in v0.162.5

func (e *CommunityEvent) ToProtobuf() *protobuf.CommunityEvent

type CommunityEventChanges added in v0.162.5

type CommunityEventChanges struct {
	*CommunityChanges
	// `RejectedRequestsToJoin` is a map of signer keys to requests to join
	RejectedRequestsToJoin map[string]*protobuf.CommunityRequestToJoin `json:"rejectedRequestsToJoin"`
	// `AcceptedRequestsToJoin` is a map of signer keys to requests to join
	AcceptedRequestsToJoin map[string]*protobuf.CommunityRequestToJoin `json:"acceptedRequestsToJoin"`
}

`CommunityAdminEventChanges contain additional changes that don't live on a `Community` but still have to be propagated to other admin and control nodes

type CommunityEventsMessage added in v0.162.5

type CommunityEventsMessage struct {
	CommunityID                    []byte           `json:"communityId"`
	EventsBaseCommunityDescription []byte           `json:"eventsBaseCommunityDescription"`
	Events                         []CommunityEvent `json:"events,omitempty"`
}

func CommunityEventsMessageFromProtobuf added in v0.162.5

func CommunityEventsMessageFromProtobuf(msg *protobuf.CommunityEventsMessage) (*CommunityEventsMessage, error)

func (*CommunityEventsMessage) Marshal added in v0.162.5

func (m *CommunityEventsMessage) Marshal() ([]byte, error)

func (*CommunityEventsMessage) ToProtobuf added in v0.162.5

type CommunityEventsMessageInvalidClockSignal added in v0.163.5

type CommunityEventsMessageInvalidClockSignal struct {
	Community              *Community
	CommunityEventsMessage *CommunityEventsMessage
}

type CommunityPrivilegedMemberSyncMessage added in v0.167.2

type CommunityPrivilegedMemberSyncMessage struct {
	CommunityPrivateKey                *ecdsa.PrivateKey
	Receivers                          []*ecdsa.PublicKey
	CommunityPrivilegedUserSyncMessage *protobuf.CommunityPrivilegedUserSyncMessage
}

type CommunityResponse added in v0.72.0

type CommunityResponse struct {
	Community      *Community        `json:"community"`
	Changes        *CommunityChanges `json:"changes"`
	RequestsToJoin []*RequestToJoin  `json:"requestsToJoin"`
}

type CommunitySettings added in v0.96.4

type CommunitySettings struct {
	CommunityID                  string `json:"communityId"`
	HistoryArchiveSupportEnabled bool   `json:"historyArchiveSupportEnabled"`
	Clock                        uint64 `json:"clock"`
}

type CommunityTag added in v0.102.5

type CommunityTag struct {
	Name  string `json:"name"`
	Emoji string `json:"emoji"`
}

type CommunityTokenPermission added in v0.166.1

type CommunityTokenPermission struct {
	*protobuf.CommunityTokenPermission
	State TokenPermissionState `json:"state,omitempty"`
}

func NewCommunityTokenPermission added in v0.166.1

func NewCommunityTokenPermission(base *protobuf.CommunityTokenPermission) *CommunityTokenPermission

func TokenPermissionsByType added in v0.162.9

func TokenPermissionsByType(permissions map[string]*CommunityTokenPermission, permissionType protobuf.CommunityTokenPermission_Type) []*CommunityTokenPermission

func (*CommunityTokenPermission) Equals added in v0.166.1

type Config

type Config struct {
	PrivateKey                          *ecdsa.PrivateKey
	CommunityDescription                *protobuf.CommunityDescription
	CommunityDescriptionProtocolMessage []byte // community in a wrapped & signed (by owner) protocol message
	ID                                  *ecdsa.PublicKey
	Joined                              bool
	Requested                           bool
	Verified                            bool
	Spectated                           bool
	Muted                               bool
	MuteTill                            time.Time
	Logger                              *zap.Logger
	RequestedToJoinAt                   uint64
	RequestsToJoin                      []*RequestToJoin
	MemberIdentity                      *ecdsa.PublicKey
	SyncedAt                            uint64
	EventsData                          *EventsData
}

type DefaultTokenManager added in v0.151.13

type DefaultTokenManager struct {
	// contains filtered or unexported fields
}

func NewDefaultTokenManager added in v0.151.13

func NewDefaultTokenManager(tm *token.Manager) *DefaultTokenManager

func (*DefaultTokenManager) FindOrCreateTokenByAddress added in v0.166.9

func (m *DefaultTokenManager) FindOrCreateTokenByAddress(ctx context.Context, chainID uint64, address gethcommon.Address) *token.Token

func (*DefaultTokenManager) GetAllChainIDs added in v0.158.0

func (m *DefaultTokenManager) GetAllChainIDs() ([]uint64, error)

func (*DefaultTokenManager) GetBalancesByChain added in v0.151.13

func (m *DefaultTokenManager) GetBalancesByChain(ctx context.Context, accounts, tokenAddresses []gethcommon.Address, chainIDs []uint64) (BalancesByChain, error)

type EncodedArchiveData added in v0.98.1

type EncodedArchiveData struct {
	// contains filtered or unexported fields
}

type EncryptionKeyAction added in v0.162.9

type EncryptionKeyAction struct {
	ActionType EncryptionKeyActionType
	Members    map[string]*protobuf.CommunityMember
}

type EncryptionKeyActionType added in v0.162.9

type EncryptionKeyActionType int
const (
	EncryptionKeyNone EncryptionKeyActionType = iota
	EncryptionKeyAdd
	EncryptionKeyRemove
	EncryptionKeyRekey
	EncryptionKeySendToMembers
)

type EncryptionKeyActions added in v0.162.9

type EncryptionKeyActions struct {
	// community-level encryption key action
	CommunityKeyAction EncryptionKeyAction

	// channel-level encryption key actions
	ChannelKeysActions map[string]EncryptionKeyAction // key is: chatID
}

func EvaluateCommunityEncryptionKeyActions added in v0.162.9

func EvaluateCommunityEncryptionKeyActions(origin, modified *Community) *EncryptionKeyActions

type EventsData added in v0.162.5

type EventsData struct {
	EventsBaseCommunityDescription []byte
	Events                         []CommunityEvent
}

type HistoryArchiveDownloadTask added in v0.117.1

type HistoryArchiveDownloadTask struct {
	CancelChan chan struct{}
	Waiter     sync.WaitGroup

	Cancelled bool
	// contains filtered or unexported fields
}

func (*HistoryArchiveDownloadTask) Cancel added in v0.117.1

func (t *HistoryArchiveDownloadTask) Cancel()

func (*HistoryArchiveDownloadTask) IsCancelled added in v0.125.1

func (t *HistoryArchiveDownloadTask) IsCancelled() bool

type HistoryArchiveDownloadTaskInfo added in v0.117.1

type HistoryArchiveDownloadTaskInfo struct {
	TotalDownloadedArchivesCount int
	TotalArchivesCount           int
	Cancelled                    bool
}

type KnownCommunitiesResponse added in v0.100.1

type KnownCommunitiesResponse struct {
	ContractCommunities         []string              `json:"contractCommunities"`
	ContractFeaturedCommunities []string              `json:"contractFeaturedCommunities"`
	Descriptions                map[string]*Community `json:"communities"`
	UnknownCommunities          []string              `json:"unknownCommunities"`
}

type Manager

type Manager struct {
	RekeyInterval time.Duration
	// contains filtered or unexported fields
}

func NewManager

func NewManager(identity *ecdsa.PrivateKey, db *sql.DB, encryptor *encryption.Protocol, logger *zap.Logger, verifier *ens.Verifier, transport *transport.Transport, torrentConfig *params.TorrentConfig, opts ...ManagerOption) (*Manager, error)

func (*Manager) AcceptRequestToJoin added in v0.72.0

func (m *Manager) AcceptRequestToJoin(dbRequest *RequestToJoin) (*Community, error)

func (*Manager) AcceptedPendingRequestsToJoinForCommunity added in v0.163.4

func (m *Manager) AcceptedPendingRequestsToJoinForCommunity(id types.HexBytes) ([]*RequestToJoin, error)

func (*Manager) AcceptedRequestsToJoinForCommunity added in v0.158.0

func (m *Manager) AcceptedRequestsToJoinForCommunity(id types.HexBytes) ([]*RequestToJoin, error)

func (*Manager) AddCommunityToken added in v0.133.2

func (m *Manager) AddCommunityToken(token *community_token.CommunityToken) (*Community, error)

func (*Manager) AddHistoryArchiveDownloadTask added in v0.117.1

func (m *Manager) AddHistoryArchiveDownloadTask(communityID string, task *HistoryArchiveDownloadTask)

func (*Manager) AddMemberOwnerToCommunity added in v0.115.6

func (m *Manager) AddMemberOwnerToCommunity(communityID types.HexBytes, pk *ecdsa.PublicKey) (*Community, error)

func (*Manager) AddRoleToMember added in v0.115.5

func (m *Manager) AddRoleToMember(request *requests.AddRoleToMember) (*Community, error)

func (*Manager) All

func (m *Manager) All() ([]*Community, error)

func (*Manager) BanUserFromCommunity added in v0.73.9

func (m *Manager) BanUserFromCommunity(request *requests.BanUserFromCommunity) (*Community, error)

func (*Manager) CanPost

func (m *Manager) CanPost(pk *ecdsa.PublicKey, communityID string, chatID string, grant []byte) (bool, error)

func (*Manager) CancelRequestToJoin added in v0.114.1

func (m *Manager) CancelRequestToJoin(request *requests.CancelRequestToJoinCommunity) (*RequestToJoin, *Community, error)

func (*Manager) CanceledRequestsToJoinForCommunity added in v0.114.1

func (m *Manager) CanceledRequestsToJoinForCommunity(id types.HexBytes) ([]*RequestToJoin, error)

func (*Manager) CanceledRequestsToJoinForUser added in v0.114.1

func (m *Manager) CanceledRequestsToJoinForUser(pk *ecdsa.PublicKey) ([]*RequestToJoin, error)

func (*Manager) CheckAllChannelsPermissions added in v0.159.2

func (m *Manager) CheckAllChannelsPermissions(communityID types.HexBytes, addresses []gethcommon.Address) (*CheckAllChannelsPermissionsResponse, error)

func (*Manager) CheckChannelPermissions added in v0.159.2

func (m *Manager) CheckChannelPermissions(communityID types.HexBytes, chatID string, addresses []gethcommon.Address) (*CheckChannelPermissionsResponse, error)

func (*Manager) CheckPermissionToJoin added in v0.151.13

func (m *Manager) CheckPermissionToJoin(id []byte, addresses []gethcommon.Address) (*CheckPermissionToJoinResponse, error)

func (*Manager) CommunitySettingsExist added in v0.96.4

func (m *Manager) CommunitySettingsExist(id types.HexBytes) (bool, error)

func (*Manager) ControlledCommunities added in v0.162.14

func (m *Manager) ControlledCommunities() ([]*Community, error)

func (*Manager) CreateAndSeedHistoryArchive added in v0.98.1

func (m *Manager) CreateAndSeedHistoryArchive(communityID types.HexBytes, topics []types.TopicType, startDate time.Time, endDate time.Time, partition time.Duration, encrypt bool) error

func (*Manager) CreateCategory added in v0.79.3

func (m *Manager) CreateCategory(request *requests.CreateCommunityCategory, publish bool) (*Community, *CommunityChanges, error)

func (*Manager) CreateChat

func (m *Manager) CreateChat(communityID types.HexBytes, chat *protobuf.CommunityChat, publish bool, thirdPartyID string) (*CommunityChanges, error)

func (*Manager) CreateCommunity

func (m *Manager) CreateCommunity(request *requests.CreateCommunity, publish bool) (*Community, error)

CreateCommunity takes a description, generates an ID for it, saves it and return it

func (*Manager) CreateCommunityTokenPermission added in v0.136.0

func (m *Manager) CreateCommunityTokenPermission(request *requests.CreateCommunityTokenPermission) (*Community, *CommunityChanges, error)

func (*Manager) CreateHistoryArchiveTorrent added in v0.98.1

func (m *Manager) CreateHistoryArchiveTorrent(communityID types.HexBytes, msgs []*types.Message, topics []types.TopicType, startDate time.Time, endDate time.Time, partition time.Duration, encrypt bool) ([]string, error)

func (*Manager) CreateHistoryArchiveTorrentFromDB added in v0.113.0

func (m *Manager) CreateHistoryArchiveTorrentFromDB(communityID types.HexBytes, topics []types.TopicType, startDate time.Time, endDate time.Time, partition time.Duration, encrypt bool) ([]string, error)

func (*Manager) CreateHistoryArchiveTorrentFromMessages added in v0.113.0

func (m *Manager) CreateHistoryArchiveTorrentFromMessages(communityID types.HexBytes, messages []*types.Message, topics []types.TopicType, startDate time.Time, endDate time.Time, partition time.Duration, encrypt bool) ([]string, error)

func (*Manager) CreateRequestToJoin added in v0.162.3

func (m *Manager) CreateRequestToJoin(requester *ecdsa.PublicKey, request *requests.RequestToJoinCommunity) (*Community, *RequestToJoin, error)

func (*Manager) DeclineRequestToJoin added in v0.72.0

func (m *Manager) DeclineRequestToJoin(dbRequest *RequestToJoin) (*Community, error)

func (*Manager) DeclinedPendingRequestsToJoinForCommunity added in v0.163.4

func (m *Manager) DeclinedPendingRequestsToJoinForCommunity(id types.HexBytes) ([]*RequestToJoin, error)

func (*Manager) DeclinedRequestsToJoinForCommunity added in v0.106.1

func (m *Manager) DeclinedRequestsToJoinForCommunity(id types.HexBytes) ([]*RequestToJoin, error)

func (*Manager) DeleteCategory added in v0.79.3

func (m *Manager) DeleteCategory(request *requests.DeleteCommunityCategory) (*Community, *CommunityChanges, error)

func (*Manager) DeleteChat added in v0.83.8

func (m *Manager) DeleteChat(communityID types.HexBytes, chatID string) (*Community, *CommunityChanges, error)

func (*Manager) DeleteCommunity added in v0.114.1

func (m *Manager) DeleteCommunity(id types.HexBytes) error

func (*Manager) DeleteCommunitySettings added in v0.96.4

func (m *Manager) DeleteCommunitySettings(id types.HexBytes) error

func (*Manager) DeleteCommunityTokenPermission added in v0.136.0

func (m *Manager) DeleteCommunityTokenPermission(request *requests.DeleteCommunityTokenPermission) (*Community, *CommunityChanges, error)

func (*Manager) DeleteHistoryArchiveDownloadTask added in v0.117.3

func (m *Manager) DeleteHistoryArchiveDownloadTask(communityID string)

func (*Manager) DeletePendingRequestToJoin added in v0.146.4

func (m *Manager) DeletePendingRequestToJoin(request *RequestToJoin) error

func (*Manager) DeletedCommunities added in v0.98.3

func (m *Manager) DeletedCommunities() ([]*Community, error)
func (m *Manager) DownloadHistoryArchivesByMagnetlink(communityID types.HexBytes, magnetlink string, cancelTask chan struct{}) (*HistoryArchiveDownloadTaskInfo, error)

func (*Manager) EditCategory added in v0.79.3

func (m *Manager) EditCategory(request *requests.EditCommunityCategory) (*Community, *CommunityChanges, error)

func (*Manager) EditChat added in v0.79.8

func (m *Manager) EditChat(communityID types.HexBytes, chatID string, chat *protobuf.CommunityChat) (*Community, *CommunityChanges, error)

func (*Manager) EditChatFirstMessageTimestamp added in v0.109.1

func (m *Manager) EditChatFirstMessageTimestamp(communityID types.HexBytes, chatID string, timestamp uint32) (*Community, *CommunityChanges, error)

func (*Manager) EditCommunity added in v0.79.0

func (m *Manager) EditCommunity(request *requests.EditCommunity) (*Community, error)

EditCommunity takes a description, updates the community with the description, saves it and returns it

func (*Manager) EditCommunityTokenPermission added in v0.136.0

func (m *Manager) EditCommunityTokenPermission(request *requests.EditCommunityTokenPermission) (*Community, *CommunityChanges, error)

func (*Manager) ExportCommunity

func (m *Manager) ExportCommunity(id types.HexBytes) (*ecdsa.PrivateKey, error)

func (*Manager) ExtractMessagesFromHistoryArchive added in v0.125.0

func (m *Manager) ExtractMessagesFromHistoryArchive(communityID types.HexBytes, archiveID string) ([]*protobuf.WakuMessage, error)

func (*Manager) GetAllCommunityTokens added in v0.148.4

func (m *Manager) GetAllCommunityTokens() ([]*community_token.CommunityToken, error)

func (*Manager) GetByID added in v0.72.0

func (m *Manager) GetByID(id []byte) (*Community, error)

func (*Manager) GetByIDString

func (m *Manager) GetByIDString(idString string) (*Community, error)

func (*Manager) GetCheckChannelPermissionResponses added in v0.159.7

func (m *Manager) GetCheckChannelPermissionResponses(communityID types.HexBytes) (*CheckAllChannelsPermissionsResponse, error)

func (*Manager) GetCommunitiesSettings added in v0.96.4

func (m *Manager) GetCommunitiesSettings() ([]CommunitySettings, error)

func (*Manager) GetCommunityChatsFilters added in v0.98.1

func (m *Manager) GetCommunityChatsFilters(communityID types.HexBytes) ([]*transport.Filter, error)

func (*Manager) GetCommunityChatsTopics added in v0.98.1

func (m *Manager) GetCommunityChatsTopics(communityID types.HexBytes) ([]types.TopicType, error)

func (*Manager) GetCommunityRequestsToJoinWithRevealedAddresses added in v0.167.2

func (m *Manager) GetCommunityRequestsToJoinWithRevealedAddresses(communityID types.HexBytes) ([]*RequestToJoin, error)

func (*Manager) GetCommunitySettingsByID added in v0.96.4

func (m *Manager) GetCommunitySettingsByID(id types.HexBytes) (*CommunitySettings, error)

func (*Manager) GetCommunityToken added in v0.163.14

func (m *Manager) GetCommunityToken(communityID string, chainID int, address string) (*community_token.CommunityToken, error)

func (*Manager) GetCommunityTokens added in v0.133.2

func (m *Manager) GetCommunityTokens(communityID string) ([]*community_token.CommunityToken, error)

func (*Manager) GetControlledCommunitiesChatIDs added in v0.162.14

func (m *Manager) GetControlledCommunitiesChatIDs() (map[string]bool, error)

func (*Manager) GetHistoryArchiveDownloadTask added in v0.117.1

func (m *Manager) GetHistoryArchiveDownloadTask(communityID string) *HistoryArchiveDownloadTask
func (m *Manager) GetHistoryArchiveMagnetlink(communityID types.HexBytes) (string, error)

func (*Manager) GetHistoryArchivePartitionStartTimestamp added in v0.98.1

func (m *Manager) GetHistoryArchivePartitionStartTimestamp(communityID types.HexBytes) (uint64, error)

func (*Manager) GetLastMessageArchiveEndDate added in v0.98.1

func (m *Manager) GetLastMessageArchiveEndDate(communityID types.HexBytes) (uint64, error)
func (m *Manager) GetLastSeenMagnetlink(communityID types.HexBytes) (string, error)

func (*Manager) GetLatestWakuMessageTimestamp added in v0.98.1

func (m *Manager) GetLatestWakuMessageTimestamp(topics []types.TopicType) (uint64, error)

func (*Manager) GetMagnetlinkMessageClock added in v0.98.1

func (m *Manager) GetMagnetlinkMessageClock(communityID types.HexBytes) (uint64, error)

func (*Manager) GetMessageArchiveIDsToImport added in v0.117.1

func (m *Manager) GetMessageArchiveIDsToImport(communityID types.HexBytes) ([]string, error)

func (*Manager) GetOldestWakuMessageTimestamp added in v0.98.1

func (m *Manager) GetOldestWakuMessageTimestamp(topics []types.TopicType) (uint64, error)

func (*Manager) GetOwnedERC721Tokens added in v0.158.0

func (m *Manager) GetOwnedERC721Tokens(walletAddresses []gethcommon.Address, tokenRequirements map[uint64]map[string]*protobuf.TokenCriteria, chainIDs []uint64) (CollectiblesByChain, error)

func (*Manager) GetRequestToJoin added in v0.103.2

func (m *Manager) GetRequestToJoin(ID types.HexBytes) (*RequestToJoin, error)

func (*Manager) GetRequestToJoinIDByPkAndCommunityID added in v0.113.0

func (m *Manager) GetRequestToJoinIDByPkAndCommunityID(pk *ecdsa.PublicKey, communityID []byte) ([]byte, error)

func (*Manager) GetRevealedAddresses added in v0.163.4

func (m *Manager) GetRevealedAddresses(communityID types.HexBytes, memberPk string) ([]*protobuf.RevealedAccount, error)

func (*Manager) GetStoredDescriptionForCommunities added in v0.100.1

func (m *Manager) GetStoredDescriptionForCommunities(communityIDs []types.HexBytes) (response *KnownCommunitiesResponse, err error)

func (*Manager) GetSyncedRawCommunity added in v0.83.8

func (m *Manager) GetSyncedRawCommunity(id []byte) (*RawCommunityRow, error)

func (*Manager) HandleCommunityCancelRequestToJoin added in v0.114.1

func (m *Manager) HandleCommunityCancelRequestToJoin(signer *ecdsa.PublicKey, request *protobuf.CommunityCancelRequestToJoin) (*RequestToJoin, error)

func (*Manager) HandleCommunityDescriptionMessage

func (m *Manager) HandleCommunityDescriptionMessage(signer *ecdsa.PublicKey, description *protobuf.CommunityDescription, payload []byte) (*CommunityResponse, error)

func (*Manager) HandleCommunityEditSharedAddresses added in v0.161.4

func (m *Manager) HandleCommunityEditSharedAddresses(signer *ecdsa.PublicKey, request *protobuf.CommunityEditSharedAddresses) error

func (*Manager) HandleCommunityEventsMessage added in v0.162.5

func (m *Manager) HandleCommunityEventsMessage(signer *ecdsa.PublicKey, message *protobuf.CommunityEventsMessage) (*CommunityResponse, error)

func (*Manager) HandleCommunityEventsMessageRejected added in v0.163.5

func (m *Manager) HandleCommunityEventsMessageRejected(signer *ecdsa.PublicKey, message *protobuf.CommunityEventsMessageRejected) (*CommunityEventsMessage, error)

Creates new CommunityEventsMessage by re-applying our rejected events on top of latest known CommunityDescription. Returns nil if none of our events were rejected.

func (*Manager) HandleCommunityRequestToJoin added in v0.72.0

func (m *Manager) HandleCommunityRequestToJoin(signer *ecdsa.PublicKey, receiver *ecdsa.PublicKey, request *protobuf.CommunityRequestToJoin) (*RequestToJoin, error)

func (*Manager) HandleCommunityRequestToJoinResponse added in v0.103.2

func (m *Manager) HandleCommunityRequestToJoinResponse(signer *ecdsa.PublicKey, request *protobuf.CommunityRequestToJoinResponse) (*RequestToJoin, error)

func (*Manager) HandleCommunityRequestToLeave added in v0.106.3

func (m *Manager) HandleCommunityRequestToLeave(signer *ecdsa.PublicKey, proto *protobuf.CommunityRequestToLeave) error

func (*Manager) HandleCommunityTokensMetadata added in v0.163.4

func (m *Manager) HandleCommunityTokensMetadata(community *Community) error

func (*Manager) HandleCommunityTokensMetadataByPrivilegedMembers added in v0.166.1

func (m *Manager) HandleCommunityTokensMetadataByPrivilegedMembers(community *Community) error

func (*Manager) HandleRequestToJoinPrivilegedUserSyncMessage added in v0.163.14

func (m *Manager) HandleRequestToJoinPrivilegedUserSyncMessage(message *protobuf.CommunityPrivilegedUserSyncMessage, communityID types.HexBytes) ([]*RequestToJoin, error)

func (*Manager) HandleSyncAllRequestToJoinForNewPrivilegedMember added in v0.167.2

func (m *Manager) HandleSyncAllRequestToJoinForNewPrivilegedMember(message *protobuf.CommunityPrivilegedUserSyncMessage, communityID types.HexBytes) ([]*RequestToJoin, error)

func (*Manager) HandleSyncCommunitySettings added in v0.102.2

func (m *Manager) HandleSyncCommunitySettings(syncCommunitySettings *protobuf.SyncCommunitySettings) (*CommunitySettings, error)

func (*Manager) HandleWrappedCommunityDescriptionMessage

func (m *Manager) HandleWrappedCommunityDescriptionMessage(payload []byte) (*CommunityResponse, error)

func (*Manager) ImageToBase64 added in v0.139.1

func (m *Manager) ImageToBase64(uri string) string

func (*Manager) ImportCommunity

func (m *Manager) ImportCommunity(key *ecdsa.PrivateKey) (*Community, error)

func (*Manager) IsChannelEncrypted added in v0.162.13

func (m *Manager) IsChannelEncrypted(communityID string, chatID string) (bool, error)

func (*Manager) IsEncrypted added in v0.102.2

func (m *Manager) IsEncrypted(communityID string) (bool, error)

func (*Manager) IsSeedingHistoryArchiveTorrent added in v0.98.1

func (m *Manager) IsSeedingHistoryArchiveTorrent(communityID types.HexBytes) bool

func (*Manager) JoinCommunity

func (m *Manager) JoinCommunity(id types.HexBytes, forceJoin bool) (*Community, error)

func (*Manager) Joined

func (m *Manager) Joined() ([]*Community, error)

func (*Manager) JoinedAndPendingCommunitiesWithRequests added in v0.83.8

func (m *Manager) JoinedAndPendingCommunitiesWithRequests() ([]*Community, error)

func (*Manager) LeaveCommunity

func (m *Manager) LeaveCommunity(id types.HexBytes) (*Community, error)

func (*Manager) LoadHistoryArchiveIndexFromFile added in v0.100.0

func (m *Manager) LoadHistoryArchiveIndexFromFile(myKey *ecdsa.PrivateKey, communityID types.HexBytes) (*protobuf.WakuMessageArchiveIndex, error)

func (*Manager) LogStdout added in v0.111.5

func (m *Manager) LogStdout(msg string, fields ...zap.Field)

func (*Manager) MuteCommunityTill added in v0.162.5

func (m *Manager) MuteCommunityTill(communityID []byte, muteTill time.Time) error

func (*Manager) PendingRequestsToJoin added in v0.146.4

func (m *Manager) PendingRequestsToJoin() ([]*RequestToJoin, error)

func (*Manager) PendingRequestsToJoinForCommunity added in v0.72.0

func (m *Manager) PendingRequestsToJoinForCommunity(id types.HexBytes) ([]*RequestToJoin, error)

func (*Manager) PendingRequestsToJoinForUser added in v0.72.0

func (m *Manager) PendingRequestsToJoinForUser(pk *ecdsa.PublicKey) ([]*RequestToJoin, error)

func (*Manager) ReevaluateCommunityMembersPermissions added in v0.163.14

func (m *Manager) ReevaluateCommunityMembersPermissions(community *Community) error

func (*Manager) ReevaluateMembers added in v0.162.13

func (m *Manager) ReevaluateMembers(community *Community) (map[protobuf.CommunityMember_Roles][]*ecdsa.PublicKey, error)

func (*Manager) ReevaluateMembersPeriodically added in v0.162.13

func (m *Manager) ReevaluateMembersPeriodically(communityID types.HexBytes)

func (*Manager) ReevaluatePrivilegedMember added in v0.167.2

func (m *Manager) ReevaluatePrivilegedMember(community *Community, tokenPermissions []*CommunityTokenPermission,
	accountsAndChainIDs []*AccountChainIDsCombination, memberPubKey *ecdsa.PublicKey,
	privilegedRole protobuf.CommunityMember_Roles, alreadyHasPrivilegedRole bool) (bool, error)

func (*Manager) RemoveCommunityToken added in v0.162.13

func (m *Manager) RemoveCommunityToken(chainID int, contractAddress string) error

func (*Manager) RemovePrivateKey added in v0.162.9

func (m *Manager) RemovePrivateKey(id types.HexBytes) (*Community, error)

func (*Manager) RemoveRequestToJoinRevealedAddresses added in v0.166.3

func (m *Manager) RemoveRequestToJoinRevealedAddresses(requestID types.HexBytes) error

func (*Manager) RemoveRoleFromMember added in v0.115.5

func (m *Manager) RemoveRoleFromMember(request *requests.RemoveRoleFromMember) (*Community, error)

func (*Manager) RemoveUserFromCommunity

func (m *Manager) RemoveUserFromCommunity(id types.HexBytes, pk *ecdsa.PublicKey) (*Community, error)

func (*Manager) ReorderCategories added in v0.79.3

func (m *Manager) ReorderCategories(request *requests.ReorderCommunityCategories) (*Community, *CommunityChanges, error)

func (*Manager) ReorderChat added in v0.79.3

func (m *Manager) ReorderChat(request *requests.ReorderCommunityChat) (*Community, *CommunityChanges, error)

func (*Manager) SaveCommunitySettings added in v0.96.4

func (m *Manager) SaveCommunitySettings(settings CommunitySettings) error

func (*Manager) SaveCommunityToken added in v0.162.13

func (m *Manager) SaveCommunityToken(token *community_token.CommunityToken, croppedImage *images.CroppedImage) (*community_token.CommunityToken, error)

func (*Manager) SaveRequestToJoin added in v0.83.8

func (m *Manager) SaveRequestToJoin(request *RequestToJoin) error

func (*Manager) SaveRequestToJoinAndCommunity added in v0.162.3

func (m *Manager) SaveRequestToJoinAndCommunity(requestToJoin *RequestToJoin, community *Community) (*Community, *RequestToJoin, error)

func (*Manager) SaveRequestToJoinRevealedAddresses added in v0.166.3

func (m *Manager) SaveRequestToJoinRevealedAddresses(requestID types.HexBytes, revealedAccounts []*protobuf.RevealedAccount) error

func (*Manager) SeedHistoryArchiveTorrent added in v0.98.1

func (m *Manager) SeedHistoryArchiveTorrent(communityID types.HexBytes) error

func (*Manager) SetCommunityActiveMembersCount added in v0.142.1

func (m *Manager) SetCommunityActiveMembersCount(communityID string, activeMembersCount uint64) error

func (*Manager) SetMessageArchiveIDImported added in v0.117.1

func (m *Manager) SetMessageArchiveIDImported(communityID types.HexBytes, hash string, imported bool) error

func (*Manager) SetMuted added in v0.81.0

func (m *Manager) SetMuted(id types.HexBytes, muted bool) error

func (*Manager) SetPrivateKey added in v0.83.8

func (m *Manager) SetPrivateKey(id []byte, privKey *ecdsa.PrivateKey) error

func (*Manager) SetSyncClock added in v0.83.8

func (m *Manager) SetSyncClock(id []byte, clock uint64) error

func (*Manager) SetTorrentConfig added in v0.98.1

func (m *Manager) SetTorrentConfig(config *params.TorrentConfig)

func (*Manager) ShouldHandleSyncCommunity added in v0.83.8

func (m *Manager) ShouldHandleSyncCommunity(community *protobuf.SyncInstallationCommunity) (bool, error)

func (*Manager) ShouldHandleSyncCommunitySettings added in v0.102.2

func (m *Manager) ShouldHandleSyncCommunitySettings(communitySettings *protobuf.SyncCommunitySettings) (bool, error)

func (*Manager) SpectateCommunity added in v0.111.5

func (m *Manager) SpectateCommunity(id types.HexBytes) (*Community, error)

func (*Manager) Spectated added in v0.111.5

func (m *Manager) Spectated() ([]*Community, error)

func (*Manager) Start added in v0.72.0

func (m *Manager) Start() error

func (*Manager) StartHistoryArchiveTasksInterval added in v0.98.1

func (m *Manager) StartHistoryArchiveTasksInterval(community *Community, interval time.Duration)

func (*Manager) StartTorrentClient added in v0.98.1

func (m *Manager) StartTorrentClient() error

func (*Manager) Stop

func (m *Manager) Stop() error

func (*Manager) StopHistoryArchiveTasksInterval added in v0.98.1

func (m *Manager) StopHistoryArchiveTasksInterval(communityID types.HexBytes)

func (*Manager) StopHistoryArchiveTasksIntervals added in v0.98.1

func (m *Manager) StopHistoryArchiveTasksIntervals()

func (*Manager) StopTorrentClient added in v0.98.1

func (m *Manager) StopTorrentClient() []error

func (*Manager) StoreWakuMessage added in v0.97.4

func (m *Manager) StoreWakuMessage(message *types.Message) error

func (*Manager) StoreWakuMessages added in v0.114.1

func (m *Manager) StoreWakuMessages(messages []*types.Message) error

func (*Manager) Subscribe

func (m *Manager) Subscribe() chan *Subscription

func (*Manager) TorrentClientStarted added in v0.98.1

func (m *Manager) TorrentClientStarted() bool

func (*Manager) TorrentFileExists added in v0.110.2

func (m *Manager) TorrentFileExists(communityID string) bool

func (*Manager) UnbanUserFromCommunity added in v0.102.6

func (m *Manager) UnbanUserFromCommunity(request *requests.UnbanUserFromCommunity) (*Community, error)

func (*Manager) UnseedHistoryArchiveTorrent added in v0.98.1

func (m *Manager) UnseedHistoryArchiveTorrent(communityID types.HexBytes)

func (*Manager) UpdateClockInRequestToJoin added in v0.146.4

func (m *Manager) UpdateClockInRequestToJoin(id types.HexBytes, clock uint64) error

UpdateClockInRequestToJoin method is used for testing

func (*Manager) UpdateCommunity added in v0.148.4

func (m *Manager) UpdateCommunity(c *Community) error

UpdateCommunity takes a Community persists it and republishes it. The clock is incremented meaning even a no change update will be republished by the admin, and parsed by the member.

func (*Manager) UpdateCommunityDescriptionMagnetlinkMessageClock added in v0.98.1

func (m *Manager) UpdateCommunityDescriptionMagnetlinkMessageClock(communityID types.HexBytes, clock uint64) error

func (*Manager) UpdateCommunitySettings added in v0.96.4

func (m *Manager) UpdateCommunitySettings(settings CommunitySettings) error

func (*Manager) UpdateCommunityTokenAddress added in v0.163.14

func (m *Manager) UpdateCommunityTokenAddress(chainID int, oldContractAddress string, newContractAddress string) error

func (*Manager) UpdateCommunityTokenState added in v0.133.2

func (m *Manager) UpdateCommunityTokenState(chainID int, contractAddress string, deployState community_token.DeployState) error

func (*Manager) UpdateCommunityTokenSupply added in v0.158.0

func (m *Manager) UpdateCommunityTokenSupply(chainID int, contractAddress string, supply *bigint.BigInt) error
func (m *Manager) UpdateLastSeenMagnetlink(communityID types.HexBytes, magnetlinkURI string) error

func (*Manager) UpdateMagnetlinkMessageClock added in v0.98.1

func (m *Manager) UpdateMagnetlinkMessageClock(communityID types.HexBytes, clock uint64) error

func (*Manager) ValidateCommunityPrivilegedUserSyncMessage added in v0.163.14

func (m *Manager) ValidateCommunityPrivilegedUserSyncMessage(message *protobuf.CommunityPrivilegedUserSyncMessage) error

type ManagerOption added in v0.139.1

type ManagerOption func(*managerOptions)

func WithAccountManager added in v0.139.1

func WithAccountManager(accountsManager account.Manager) ManagerOption

func WithCollectiblesManager added in v0.162.5

func WithCollectiblesManager(collectiblesManager CollectiblesManager) ManagerOption

func WithCommunityTokensService added in v0.166.1

func WithCommunityTokensService(communityTokensService communitytokens.ServiceInterface) ManagerOption

func WithTokenManager added in v0.140.0

func WithTokenManager(tokenManager TokenManager) ManagerOption

func WithWalletConfig added in v0.142.2

func WithWalletConfig(walletConfig *params.WalletConfig) ManagerOption

type PermissionTokenCriteriaResult added in v0.159.2

type PermissionTokenCriteriaResult struct {
	Criteria []bool `json:"criteria"`
}

type Persistence

type Persistence struct {
	// contains filtered or unexported fields
}

func (*Persistence) AcceptedPendingRequestsToJoinForCommunity added in v0.163.4

func (p *Persistence) AcceptedPendingRequestsToJoinForCommunity(id []byte) ([]*RequestToJoin, error)

func (*Persistence) AcceptedRequestsToJoinForCommunity added in v0.158.0

func (p *Persistence) AcceptedRequestsToJoinForCommunity(id []byte) ([]*RequestToJoin, error)

func (*Persistence) AddCommunityToken added in v0.133.2

func (p *Persistence) AddCommunityToken(token *token.CommunityToken) error

func (*Persistence) AllCommunities

func (p *Persistence) AllCommunities(memberIdentity *ecdsa.PublicKey) ([]*Community, error)

func (*Persistence) CanceledRequestsToJoinForCommunity added in v0.114.1

func (p *Persistence) CanceledRequestsToJoinForCommunity(id []byte) ([]*RequestToJoin, error)

func (*Persistence) CanceledRequestsToJoinForUser added in v0.114.1

func (p *Persistence) CanceledRequestsToJoinForUser(pk string) ([]*RequestToJoin, error)

func (*Persistence) CommunitiesWithPrivateKey added in v0.162.14

func (p *Persistence) CommunitiesWithPrivateKey(memberIdentity *ecdsa.PublicKey) ([]*Community, error)

func (*Persistence) CommunitySettingsExist added in v0.96.4

func (p *Persistence) CommunitySettingsExist(communityID types.HexBytes) (bool, error)

func (*Persistence) DeclinedPendingRequestsToJoinForCommunity added in v0.163.4

func (p *Persistence) DeclinedPendingRequestsToJoinForCommunity(id []byte) ([]*RequestToJoin, error)

func (*Persistence) DeclinedRequestsToJoinForCommunity added in v0.106.1

func (p *Persistence) DeclinedRequestsToJoinForCommunity(id []byte) ([]*RequestToJoin, error)

func (*Persistence) DeleteCommunity added in v0.114.1

func (p *Persistence) DeleteCommunity(id types.HexBytes) error

func (*Persistence) DeleteCommunityEvents added in v0.162.5

func (p *Persistence) DeleteCommunityEvents(id types.HexBytes) error

func (*Persistence) DeleteCommunitySettings added in v0.96.4

func (p *Persistence) DeleteCommunitySettings(communityID types.HexBytes) error

func (*Persistence) DeletePendingRequestToJoin added in v0.146.4

func (p *Persistence) DeletePendingRequestToJoin(id []byte) error

func (*Persistence) DeletedCommunities added in v0.98.3

func (p *Persistence) DeletedCommunities(memberIdentity *ecdsa.PublicKey) (comms []*Community, err error)

func (*Persistence) GetAllCommunityTokens added in v0.148.4

func (p *Persistence) GetAllCommunityTokens() ([]*token.CommunityToken, error)

func (*Persistence) GetByID

func (p *Persistence) GetByID(memberIdentity *ecdsa.PublicKey, id []byte) (*Community, error)

func (*Persistence) GetCheckChannelPermissionResponses added in v0.159.7

func (p *Persistence) GetCheckChannelPermissionResponses(communityID string) (map[string]*CheckChannelPermissionsResponse, error)

func (*Persistence) GetCommunitiesSettings added in v0.96.4

func (p *Persistence) GetCommunitiesSettings() ([]CommunitySettings, error)

func (*Persistence) GetCommunityChatIDs added in v0.98.1

func (p *Persistence) GetCommunityChatIDs(communityID types.HexBytes) ([]string, error)

func (*Persistence) GetCommunityRequestsToJoinWithRevealedAddresses added in v0.167.2

func (p *Persistence) GetCommunityRequestsToJoinWithRevealedAddresses(communityID []byte) ([]*RequestToJoin, error)

func (*Persistence) GetCommunitySettingsByID added in v0.96.4

func (p *Persistence) GetCommunitySettingsByID(communityID types.HexBytes) (*CommunitySettings, error)

func (*Persistence) GetCommunityToken added in v0.162.13

func (p *Persistence) GetCommunityToken(communityID string, chainID int, address string) (*token.CommunityToken, error)

func (*Persistence) GetCommunityTokens added in v0.133.2

func (p *Persistence) GetCommunityTokens(communityID string) ([]*token.CommunityToken, error)

func (*Persistence) GetDownloadedMessageArchiveIDs added in v0.117.1

func (p *Persistence) GetDownloadedMessageArchiveIDs(communityID types.HexBytes) ([]string, error)

func (*Persistence) GetLastMessageArchiveEndDate added in v0.98.1

func (p *Persistence) GetLastMessageArchiveEndDate(communityID types.HexBytes) (uint64, error)
func (p *Persistence) GetLastSeenMagnetlink(communityID types.HexBytes) (string, error)

func (*Persistence) GetLatestWakuMessageTimestamp added in v0.98.1

func (p *Persistence) GetLatestWakuMessageTimestamp(topics []types.TopicType) (uint64, error)

func (*Persistence) GetMagnetlinkMessageClock added in v0.98.1

func (p *Persistence) GetMagnetlinkMessageClock(communityID types.HexBytes) (uint64, error)

func (*Persistence) GetMessageArchiveIDsToImport added in v0.117.1

func (p *Persistence) GetMessageArchiveIDsToImport(communityID types.HexBytes) ([]string, error)

func (*Persistence) GetOldestWakuMessageTimestamp added in v0.98.1

func (p *Persistence) GetOldestWakuMessageTimestamp(topics []types.TopicType) (uint64, error)

func (*Persistence) GetPermissionTokenCriteriaResult added in v0.159.7

func (p *Persistence) GetPermissionTokenCriteriaResult(permissionID string, communityID string, chatID string) (*PermissionTokenCriteriaResult, error)

func (*Persistence) GetRequestToJoin added in v0.72.0

func (p *Persistence) GetRequestToJoin(id []byte) (*RequestToJoin, error)

func (*Persistence) GetRequestToJoinByPk added in v0.114.1

func (p *Persistence) GetRequestToJoinByPk(pk string, communityID []byte, state RequestToJoinState) (*RequestToJoin, error)

func (*Persistence) GetRequestToJoinByPkAndCommunityID added in v0.129.3

func (p *Persistence) GetRequestToJoinByPkAndCommunityID(pk string, communityID []byte) (*RequestToJoin, error)

func (*Persistence) GetRequestToJoinIDByPkAndCommunityID added in v0.113.0

func (p *Persistence) GetRequestToJoinIDByPkAndCommunityID(pk string, communityID []byte) ([]byte, error)

func (*Persistence) GetRequestToJoinRevealedAddresses added in v0.139.1

func (p *Persistence) GetRequestToJoinRevealedAddresses(requestID []byte) ([]*protobuf.RevealedAccount, error)

func (*Persistence) GetWakuMessagesByFilterTopic added in v0.98.1

func (p *Persistence) GetWakuMessagesByFilterTopic(topics []types.TopicType, from uint64, to uint64) ([]types.Message, error)

func (*Persistence) HasCommunityArchiveInfo added in v0.100.0

func (p *Persistence) HasCommunityArchiveInfo(communityID types.HexBytes) (exists bool, err error)

func (*Persistence) HasCommunityToken added in v0.163.4

func (p *Persistence) HasCommunityToken(communityID string, address string, chainID int) (bool, error)

func (*Persistence) HasMessageArchiveID added in v0.100.0

func (p *Persistence) HasMessageArchiveID(communityID types.HexBytes, hash string) (exists bool, err error)

func (*Persistence) HasPendingRequestsToJoinForUserAndCommunity added in v0.72.0

func (p *Persistence) HasPendingRequestsToJoinForUserAndCommunity(userPk string, communityID []byte) (bool, error)

func (*Persistence) JoinedAndPendingCommunitiesWithRequests added in v0.83.8

func (p *Persistence) JoinedAndPendingCommunitiesWithRequests(memberIdentity *ecdsa.PublicKey) (comms []*Community, err error)

func (*Persistence) JoinedCommunities

func (p *Persistence) JoinedCommunities(memberIdentity *ecdsa.PublicKey) ([]*Community, error)

func (*Persistence) MuteCommunityTill added in v0.162.5

func (p *Persistence) MuteCommunityTill(communityID []byte, mutedTill time.Time) error

func (*Persistence) PendingRequestsToJoin added in v0.146.4

func (p *Persistence) PendingRequestsToJoin() ([]*RequestToJoin, error)

func (*Persistence) PendingRequestsToJoinForCommunity added in v0.72.0

func (p *Persistence) PendingRequestsToJoinForCommunity(id []byte) ([]*RequestToJoin, error)

func (*Persistence) PendingRequestsToJoinForUser added in v0.72.0

func (p *Persistence) PendingRequestsToJoinForUser(pk string) ([]*RequestToJoin, error)

func (*Persistence) RemoveCommunityToken added in v0.162.13

func (p *Persistence) RemoveCommunityToken(chainID int, contractAddress string) error

func (*Persistence) RemoveRequestToJoinRevealedAddresses added in v0.163.4

func (p *Persistence) RemoveRequestToJoinRevealedAddresses(requestID []byte) error

func (*Persistence) RequestsToJoinForCommunityWithState added in v0.106.1

func (p *Persistence) RequestsToJoinForCommunityWithState(id []byte, state RequestToJoinState) ([]*RequestToJoin, error)

func (*Persistence) SaveCheckChannelPermissionResponse added in v0.159.7

func (p *Persistence) SaveCheckChannelPermissionResponse(communityID string, chatID string, response *CheckChannelPermissionsResponse) error

func (*Persistence) SaveCommunity

func (p *Persistence) SaveCommunity(community *Community) error

func (*Persistence) SaveCommunityArchiveInfo added in v0.100.0

func (p *Persistence) SaveCommunityArchiveInfo(communityID types.HexBytes, clock uint64, lastArchiveEndDate uint64) error

func (*Persistence) SaveCommunityEvents added in v0.162.5

func (p *Persistence) SaveCommunityEvents(community *Community) error

func (*Persistence) SaveCommunitySettings added in v0.96.4

func (p *Persistence) SaveCommunitySettings(communitySettings CommunitySettings) error

func (*Persistence) SaveLastMessageArchiveEndDate added in v0.98.1

func (p *Persistence) SaveLastMessageArchiveEndDate(communityID types.HexBytes, endDate uint64) error

func (*Persistence) SaveMessageArchiveID added in v0.100.0

func (p *Persistence) SaveMessageArchiveID(communityID types.HexBytes, hash string) error

func (*Persistence) SaveRequestToJoin added in v0.72.0

func (p *Persistence) SaveRequestToJoin(request *RequestToJoin) (err error)

func (*Persistence) SaveRequestToJoinRevealedAddresses added in v0.139.1

func (p *Persistence) SaveRequestToJoinRevealedAddresses(requestID types.HexBytes, revealedAccounts []*protobuf.RevealedAccount) (err error)

func (*Persistence) SaveRequestToLeave added in v0.106.3

func (p *Persistence) SaveRequestToLeave(request *RequestToLeave) error

func (*Persistence) SaveWakuMessage added in v0.97.4

func (p *Persistence) SaveWakuMessage(message *types.Message) error

func (*Persistence) SaveWakuMessages added in v0.111.5

func (p *Persistence) SaveWakuMessages(messages []*types.Message) (err error)

func (*Persistence) SetMessageArchiveIDImported added in v0.117.1

func (p *Persistence) SetMessageArchiveIDImported(communityID types.HexBytes, hash string, imported bool) error

func (*Persistence) SetMuted added in v0.81.0

func (p *Persistence) SetMuted(communityID []byte, muted bool) error

func (*Persistence) SetPrivateKey added in v0.83.8

func (p *Persistence) SetPrivateKey(id []byte, privKey *ecdsa.PrivateKey) error

func (*Persistence) SetRequestToJoinState added in v0.72.0

func (p *Persistence) SetRequestToJoinState(pk string, communityID []byte, state RequestToJoinState) error

func (*Persistence) SetSyncClock added in v0.83.8

func (p *Persistence) SetSyncClock(id []byte, clock uint64) error

func (*Persistence) ShouldHandleSyncCommunity added in v0.83.8

func (p *Persistence) ShouldHandleSyncCommunity(community *protobuf.SyncInstallationCommunity) (bool, error)

func (*Persistence) ShouldHandleSyncCommunitySettings added in v0.102.2

func (p *Persistence) ShouldHandleSyncCommunitySettings(settings *protobuf.SyncCommunitySettings) (bool, error)

func (*Persistence) SpectatedCommunities added in v0.111.5

func (p *Persistence) SpectatedCommunities(memberIdentity *ecdsa.PublicKey) ([]*Community, error)

func (*Persistence) UpdateClockInRequestToJoin added in v0.146.4

func (p *Persistence) UpdateClockInRequestToJoin(id []byte, clock uint64) error

UpdateClockInRequestToJoin method is used for testing

func (*Persistence) UpdateCommunitySettings added in v0.96.4

func (p *Persistence) UpdateCommunitySettings(communitySettings CommunitySettings) error

func (*Persistence) UpdateCommunityTokenAddress added in v0.163.14

func (p *Persistence) UpdateCommunityTokenAddress(chainID int, oldContractAddress string, newContractAddress string) error

func (*Persistence) UpdateCommunityTokenState added in v0.133.2

func (p *Persistence) UpdateCommunityTokenState(chainID int, contractAddress string, deployState token.DeployState) error

func (*Persistence) UpdateCommunityTokenSupply added in v0.158.0

func (p *Persistence) UpdateCommunityTokenSupply(chainID int, contractAddress string, supply *bigint.BigInt) error

func (*Persistence) UpdateLastMessageArchiveEndDate added in v0.98.1

func (p *Persistence) UpdateLastMessageArchiveEndDate(communityID types.HexBytes, endDate uint64) error
func (p *Persistence) UpdateLastSeenMagnetlink(communityID types.HexBytes, magnetlinkURI string) error

func (*Persistence) UpdateMagnetlinkMessageClock added in v0.98.1

func (p *Persistence) UpdateMagnetlinkMessageClock(communityID types.HexBytes, clock uint64) error

type RawCommunityRow added in v0.97.4

type RawCommunityRow struct {
	ID          []byte
	PrivateKey  []byte
	Description []byte
	Joined      bool
	Spectated   bool
	Verified    bool
	SyncedAt    uint64
	Muted       bool
}

type RequestToJoin added in v0.72.0

type RequestToJoin struct {
	ID               types.HexBytes              `json:"id"`
	PublicKey        string                      `json:"publicKey"`
	Clock            uint64                      `json:"clock"`
	ENSName          string                      `json:"ensName,omitempty"`
	ChatID           string                      `json:"chatId"`
	CommunityID      types.HexBytes              `json:"communityId"`
	State            RequestToJoinState          `json:"state"`
	Our              bool                        `json:"our"`
	Deleted          bool                        `json:"deleted"`
	RevealedAccounts []*protobuf.RevealedAccount `json:"revealedAccounts,omitempty"`
}

func (*RequestToJoin) CalculateID added in v0.72.0

func (r *RequestToJoin) CalculateID()

func (*RequestToJoin) Empty added in v0.83.8

func (r *RequestToJoin) Empty() bool

func (*RequestToJoin) InitFromSyncProtobuf added in v0.83.8

func (r *RequestToJoin) InitFromSyncProtobuf(proto *protobuf.SyncCommunityRequestsToJoin)

func (*RequestToJoin) MarkedAsPendingByPrivilegedAccount added in v0.163.4

func (r *RequestToJoin) MarkedAsPendingByPrivilegedAccount() bool

func (*RequestToJoin) ToCommunityRequestToJoinProtobuf added in v0.158.0

func (r *RequestToJoin) ToCommunityRequestToJoinProtobuf() *protobuf.CommunityRequestToJoin

func (*RequestToJoin) ToSyncProtobuf added in v0.83.8

func (r *RequestToJoin) ToSyncProtobuf() *protobuf.SyncCommunityRequestsToJoin

type RequestToJoinState added in v0.83.8

type RequestToJoinState uint
const (
	RequestToJoinStatePending RequestToJoinState = iota + 1
	RequestToJoinStateDeclined
	RequestToJoinStateAccepted
	RequestToJoinStateCanceled
	RequestToJoinStateAcceptedPending
	RequestToJoinStateDeclinedPending
)

type RequestToLeave added in v0.106.3

type RequestToLeave struct {
	ID          types.HexBytes `json:"id"`
	PublicKey   string         `json:"publicKey"`
	Clock       uint64         `json:"clock"`
	CommunityID types.HexBytes `json:"communityId"`
}

func NewRequestToLeave added in v0.106.3

func NewRequestToLeave(publicKey string, protobuf *protobuf.CommunityRequestToLeave) *RequestToLeave

type Subscription

type Subscription struct {
	Community                                *Community
	CreatingHistoryArchivesSignal            *signal.CreatingHistoryArchivesSignal
	HistoryArchivesCreatedSignal             *signal.HistoryArchivesCreatedSignal
	NoHistoryArchivesCreatedSignal           *signal.NoHistoryArchivesCreatedSignal
	HistoryArchivesSeedingSignal             *signal.HistoryArchivesSeedingSignal
	HistoryArchivesUnseededSignal            *signal.HistoryArchivesUnseededSignal
	HistoryArchiveDownloadedSignal           *signal.HistoryArchiveDownloadedSignal
	DownloadingHistoryArchivesStartedSignal  *signal.DownloadingHistoryArchivesStartedSignal
	DownloadingHistoryArchivesFinishedSignal *signal.DownloadingHistoryArchivesFinishedSignal
	ImportingHistoryArchiveMessagesSignal    *signal.ImportingHistoryArchiveMessagesSignal
	CommunityEventsMessage                   *CommunityEventsMessage
	CommunityEventsMessageInvalidClock       *CommunityEventsMessageInvalidClockSignal
	AcceptedRequestsToJoin                   []types.HexBytes
	RejectedRequestsToJoin                   []types.HexBytes
	CommunityPrivilegedMemberSyncMessage     *CommunityPrivilegedMemberSyncMessage
}

type TokenManager added in v0.151.13

type TokenManager interface {
	GetBalancesByChain(ctx context.Context, accounts, tokens []gethcommon.Address, chainIDs []uint64) (map[uint64]map[gethcommon.Address]map[gethcommon.Address]*hexutil.Big, error)
	FindOrCreateTokenByAddress(ctx context.Context, chainID uint64, address gethcommon.Address) *token.Token
	GetAllChainIDs() ([]uint64, error)
}

type TokenPermissionState added in v0.166.1

type TokenPermissionState uint8
const (
	TokenPermissionApproved TokenPermissionState = iota
	TokenPermissionAdditionPending
	TokenPermissionUpdatePending
	TokenPermissionRemovalPending
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL