gateways

package
v0.0.0-...-46c349b Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blockchain

type Blockchain interface {
	Start(ctx context.Context, config BlockchainConfig)
	Shutdown(ctx context.Context)

	GetNameByAddress(ctx context.Context, address string) (*string, error)
	GetAvatarURIByName(ctx context.Context, name string) (*string, error)
	GetNFTURI(ctx context.Context, standard string, address string, id string) (string, error)

	GetLatestBlockNumber(ctx context.Context) (*big.Int, error)
	GetEvents(context.Context, *big.Int, *big.Int) (entities.Events, error)

	VerifySignature(address string, message string, sigHex string) error
}

type BlockchainConfig

type BlockchainConfig struct {
	BlockchainURL     string
	ReputationAddress string
}

type Cache

type Cache interface {
	Start(ctx context.Context, config CacheConfig)
	Shutdown(ctx context.Context)
	VerifyRateLimit(ctx context.Context, key string, rate int, period time.Duration) error
}

type CacheConfig

type CacheConfig struct {
	ConnectionString string
	DialTimeout      time.Duration
	MinIdleConns     int
	PoolSize         int
	ReadTimeout      time.Duration
	WriteTimeout     time.Duration
}

type Database

type Database interface {
	Start(ctx context.Context, config DatabaseConfig)
	Shutdown(ctx context.Context)

	Migrate(ctx context.Context, config DatabaseConfig) error

	GetChallengeByAddress(ctx context.Context, address string) (entities.Challenge, error)
	SaveChallenge(ctx context.Context, challenge entities.Challenge) error

	GetUserByAddress(ctx context.Context, address string) (entities.User, error)
	GetThreads(ctx context.Context, limit int64) ([]entities.Thread, error)
	GetThreadById(ctx context.Context, threadId int64) (entities.Thread, error)
	GetComments(ctx context.Context, threadId int64, offset int64, limit int64) ([]entities.Comment, int64, error)
	GetCommentById(ctx context.Context, commentId int64) (entities.Comment, error)

	UpsertUser(ctx context.Context, address string) error
	UpdateUser(ctx context.Context, address string, name *string, avatar *entities.Image) error
	CreateComment(ctx context.Context, threadId int64, address string, repliedToCommentId *int64, content string, image *entities.Image) (entities.Comment, error)
	CreateThread(ctx context.Context, address string, title string, content string, image *entities.Image) (entities.Thread, error)
	CreateVote(ctx context.Context, vote entities.Vote) error
	DeleteThread(ctx context.Context, threadId int64) error
	DeleteComment(ctx context.Context, commentId int64) error
	AggregateVotes(ctx context.Context, id int64, voteType entities.VoteType) error

	GetLastIndexedBlock(ctx context.Context) (*big.Int, error)
	UpdateLastIndexedBlock(ctx context.Context, block *big.Int) error
	InsertTransferEvents(ctx context.Context, from *big.Int, to *big.Int, transfers []entities.Transfer) error
	UpdateReputation(ctx context.Context, addresses []string) error
}

type DatabaseConfig

type DatabaseConfig struct {
	ConnectionString string
	MinConnections   int32
	MaxConnections   int32
}

type Images

type Images interface {
	Start(ctx context.Context, config ImagesConfig)
	Shutdown(ctx context.Context)
	UploadImage(ctx context.Context, reader io.Reader) (*entities.Image, error)
	GetImageByFileName(ctx context.Context, fileName string) (*entities.Image, error)
	UploadAvatar(ctx context.Context, uri string, isNFT bool) (*entities.Image, error)
}

type ImagesConfig

type ImagesConfig struct {
	BaseURL string
	APIKey  string
}

type Stream

type Stream interface {
	Start(ctx context.Context, config StreamConfig)
	Shutdown(ctx context.Context)
	PublishSignin(ctx context.Context, address string) error
	PublishVote(ctx context.Context, vote entities.Vote) error
}

type StreamConfig

type StreamConfig struct {
	ConnectionString string
	DialTimeout      time.Duration
	MinIdleConns     int
	PoolSize         int
	ReadTimeout      time.Duration
	WriteTimeout     time.Duration
}

Jump to

Keyboard shortcuts

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