client

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: LGPL-2.1 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateEvent

func CreateEvent[S *models.EventInterface](payload entities.ClientPayload, ctx *context.Context) (model S, err error)

func GetAccountAuthorizations

func GetAccountAuthorizations(auth *entities.Authorization) (*[]models.AuthorizationState, error)

func GetAccountSubscriptions

func GetAccountSubscriptions(payload entities.ClientPayload) (*[]models.TopicState, error)

func GetAccountSubscriptionsV2 added in v1.2.0

func GetAccountSubscriptionsV2(payload entities.Subscription) (*[]models.TopicState, error)

func GetAuthorizationEventByHash added in v1.2.0

func GetAuthorizationEventByHash(hash string) (*models.AuthorizationEvent, error)

func GetAuthorizationEventById

func GetAuthorizationEventById(id string) (*models.AuthorizationEvent, error)

func GetBlockStats

func GetBlockStats() (*[]models.BlockStat, error)

func GetEvent

func GetEvent(eventId string, eventType int) (model interface{}, err error)

func GetEventByHash added in v1.2.0

func GetEventByHash(eventHash string, eventType int) (model interface{}, err error)

func GetEventModelFromEventType added in v1.2.0

func GetEventModelFromEventType(eventType constants.EventType) any

func GetEventTypeFromModel added in v1.2.0

func GetEventTypeFromModel(eventType entities.EntityModel) constants.EventType

func GetMainStats

func GetMainStats(cfg *configs.MainConfiguration) (*entities.MainStat, error)

func GetMessageEventByHash added in v1.2.0

func GetMessageEventByHash(hash string) (*models.MessageEvent, error)

func GetMessageEventById

func GetMessageEventById(id string) (*models.MessageEvent, error)

func GetMessages

func GetMessages(topicId string) (*[]models.MessageState, error)

func GetSubEventByHash added in v1.2.0

func GetSubEventByHash(hash string) (*models.SubscriptionEvent, error)

func GetSubEventById

func GetSubEventById(id string) (*models.SubscriptionEvent, error)

func GetSubnetByHash

func GetSubnetByHash(hash string) (*models.SubnetState, error)

func GetSubnetById

func GetSubnetById(id string) (*models.SubnetState, error)

func GetSubnetEventByHash added in v1.2.0

func GetSubnetEventByHash(hash string) (*models.SubnetEvent, error)

func GetSubnetEventById

func GetSubnetEventById(id string) (*models.SubnetEvent, error)

func GetSubnetEvents

func GetSubnetEvents() (*[]models.SubnetEvent, error)

func GetSubnets

func GetSubnets(item models.SubnetState) (*[]models.SubnetState, error)

func GetSubscribedSubnets added in v1.2.0

func GetSubscribedSubnets(item models.SubnetState) (*[]models.SubnetState, error)

func GetSubscription

func GetSubscription(id string) (*models.SubscriptionState, error)

func GetSubscriptions

func GetSubscriptions(payload entities.Subscription) (*[]models.SubscriptionState, error)

func GetTopicEventByHash added in v1.2.0

func GetTopicEventByHash(hash string) (*models.TopicEvent, error)

func GetTopicEventById

func GetTopicEventById(id string) (*models.TopicEvent, error)

func GetWalletByHash

func GetWalletByHash(hash string) (*models.WalletState, error)

func GetWalletById

func GetWalletById(id string) (*models.WalletState, error)

func GetWalletEventById added in v1.2.0

func GetWalletEventById(id string) (*models.WalletEvent, error)

func GetWalletEvents

func GetWalletEvents() (*[]models.WalletEvent, error)

func GetWallets

func GetWallets() (*[]models.WalletState, error)

func SyncAgent

func SyncAgent(req *entities.SyncRequest, clientPayload *entities.ClientPayload) (entities.SyncResponse, error)

func SyncAgent(req *entities.SyncRequest, clientPayload *entities.ClientPayload) (entities.SyncResponse, error) {

func SyncRequest

func SyncRequest(payload *entities.ClientPayload) entities.SyncResponse

func ValidateAuthPayloadData added in v1.2.0

func ValidateAuthPayloadData(cfg *configs.MainConfiguration, payload entities.ClientPayload) (assocPrevEvent *entities.EventPath, assocAuthEvent *entities.EventPath, err error)

func ValidateClientPayload

func ValidateClientPayload(
	payload *entities.ClientPayload,
	strictAuth bool,
	chainId configs.ChainId,
) (*models.AuthorizationState, *entities.DeviceString, error)

func ValidateMessagePayload

func ValidateMessagePayload(payload entities.ClientPayload, currentAuthState *models.AuthorizationState) (assocPrevEvent *entities.EventPath, assocAuthEvent *entities.EventPath, err error)

func ValidateSubnetPayload

func ValidateSubnetPayload(payload entities.ClientPayload, authState *models.AuthorizationState, ctx *context.Context) (assocPrevEvent *entities.EventPath, assocAuthEvent *entities.EventPath, err error)
	incomingSubnetC, ok := (*mainCtx).Value(constants.IncomingSubnetEventChId).(*chan *entities.Event)
	if !ok {
		logger.Errorf("incomingSubnetC closed")
		return
	}
	for {
		event, ok :=  <-*incomingSubnetC
		if !ok {
			logger.Fatal("incomingSubnetC closed for read")
			return
		}
		go service.HandleNewPubSubSubnetEvent(event, ctx)
	}
}

func ValidateSubscriptionPayload

func ValidateSubscriptionPayload(payload entities.ClientPayload, authState *models.AuthorizationState) (
	assocPrevEvent *entities.EventPath,
	assocAuthEvent *entities.EventPath,
	err error,
)

func ValidateTopicPayload

func ValidateTopicPayload(payload entities.ClientPayload, authState *models.AuthorizationState) (assocPrevEvent *entities.EventPath, assocAuthEvent *entities.EventPath, err error)
	incomingTopicC, ok := (*mainCtx).Value(constants.IncomingTopicEventChId).(*chan *entities.Event)
	if !ok {
		logger.Errorf("incomingTopicC closed")
		return
	}
	for {
		event, ok :=  <-*incomingTopicC
		if !ok {
			logger.Fatal("incomingTopicC closed for read")
			return
		}
		go service.HandleNewPubSubTopicEvent(event, ctx)
	}
}

func ValidateWalletPayload

func ValidateWalletPayload(payload entities.ClientPayload, authState *models.AuthorizationState) (assocPrevEvent *entities.EventPath, assocAuthEvent *entities.EventPath, err error)
	incomingWalletC, ok := (*mainCtx).Value(constants.IncomingWalletEventChId).(*chan *entities.Event)
	if !ok {
		logger.Errorf("incomingWalletC closed")
		return
	}
	for {
		event, ok :=  <-*incomingWalletC
		if !ok {
			logger.Fatal("incomingWalletC closed for read")
			return
		}
		go service.HandleNewPubSubWalletEvent(event, ctx)
	}
}

Types

type Flag

type Flag string

type MessageService

type MessageService struct {
	Ctx context.Context
	Cfg configs.MainConfiguration
}

func NewMessageService

func NewMessageService(mainCtx *context.Context) *MessageService

type NodeInfo added in v1.2.0

type NodeInfo struct {
	Account       string             `json:"account"`
	NodeType      constants.NodeType `json:"node_type"`
	NodePublicKey string             `json:"node_pubkey"`
	// ChainPublicKey string `json:"chain_pubkey"`
	ChainId      string   `json:"chain_id"`
	CurrentCycle uint64   `json:"current_cycle"`
	CurrentBlock uint64   `json:"current_block"`
	CurrentEpoch uint64   `json:"current_epoch"`
	Listeners    []string `json:"listeners"`
}

func Info added in v1.2.0

func Info(cfg *configs.MainConfiguration) (*NodeInfo, error)

Jump to

Keyboard shortcuts

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