handle

package
v0.0.0-...-e5308b5 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithAddr

func WithAddr(addr string) func(*Options)

WithAddr is a function that sets the address option for an Options struct. It takes a string representing the address and returns a function that sets the address option in the Options struct.

func WithClient

func WithClient(cli *rpcclient.Client) func(*Options)

WithClient is a function that sets the rpcclient option for an Options struct. It takes a pointer to a rpcclient.Client representing the rpcclient and returns a function that sets the rpcclient option in the Options struct.

func WithDB

func WithDB(db *dao.DB) func(*Options)

WithDB is a function that sets the database option for an Options struct. It takes a pointer to a dao.DB representing the database and returns a function that sets the database option in the Options struct.

func WithEngin

func WithEngin(g *gin.Engine) func(*Options)

WithEngin is a function that sets the gin engine option for an Options struct. It takes a pointer to a gin.Engine representing the gin engine and returns a function that sets the gin engine option in the Options struct.

func WithIndexerDB

func WithIndexerDB(db *indexer.DB) func(*Options)

func WithTestNet

func WithTestNet(testnet bool) func(*Options)

WithTestNet is a function that sets the testnet option for an Options struct. It takes a boolean value representing whether to use the testnet or not and returns a function that sets the testnet option in the Options struct.

Types

type CInsDescription

type CInsDescription struct {
	Type      string `json:"type"`
	Chain     string `json:"chain"`
	ChainName string `json:"chain_name"`
	Contract  string `json:"contract"`
}

type CreateCbr20DeployOrderReq

type CreateCbr20DeployOrderReq struct {
	Postage        int64  `json:"postage" binding:"min=330,max=10000"`
	FeatRate       int64  `json:"fee_rate" binding:"gt=0"`
	Ticker         string `json:"ticker" binding:"required"`
	TotalSupply    string `json:"total_supply" binding:"required"`
	LimitPerMint   string `json:"limit_per_mint" binding:"required"`
	L2NetWork      string `json:"l2_network" binding:"required"`
	Contract       string `json:"contract" binding:"required"`
	ReceiveAddress string `json:"receive_address" binding:"required"`
}

func (*CreateCbr20DeployOrderReq) Check

func (req *CreateCbr20DeployOrderReq) Check() error

type Handler

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

Handler is a struct that holds the options for handling requests.

func New

func New(opts ...Option) (*Handler, error)

New is a function that creates a new Handler with the given options. It takes a variadic number of Option functions and applies them to the options of the Handler. It returns a pointer to the newly created Handler and any error that occurred during the creation.

func (*Handler) BlockHeight

func (h *Handler) BlockHeight(ctx *gin.Context)

BlockHeight return latest block height

func (*Handler) CreateCbr20DeployOrder

func (h *Handler) CreateCbr20DeployOrder(ctx *gin.Context)

func (*Handler) DB

func (h *Handler) DB() *dao.DB

DB is a method that returns the database from the options of a Handler.

func (*Handler) Engine

func (h *Handler) Engine() *gin.Engine

Engine is a method that returns the gin engine from the options of a Handler.

func (*Handler) EstimateSmartFee

func (h *Handler) EstimateSmartFee(ctx *gin.Context)

func (*Handler) GetChainParams

func (h *Handler) GetChainParams() *chaincfg.Params

GetChainParams is a method that returns the chain parameters based on the testnet option of a Handler. If the testnet option is set to true, it returns the TestNet3Params. Otherwise, it returns the MainNetParams.

func (*Handler) HomePageStatistics

func (h *Handler) HomePageStatistics(ctx *gin.Context)

func (*Handler) IndexerDB

func (h *Handler) IndexerDB() *indexer.DB

IndexerDB is a method that returns the indexer database from the options of a Handler.

func (*Handler) InitRouter

func (h *Handler) InitRouter()

func (*Handler) InscribeOrders

func (h *Handler) InscribeOrders(ctx *gin.Context)

func (*Handler) Inscriptions

func (h *Handler) Inscriptions(ctx *gin.Context)

func (*Handler) L2Networks

func (h *Handler) L2Networks(ctx *gin.Context)

func (*Handler) OrderStatus

func (h *Handler) OrderStatus(ctx *gin.Context)

func (*Handler) RpcClient

func (h *Handler) RpcClient() *rpcclient.Client

RpcClient is a method that returns the rpcclient from the options of a Handler.

func (*Handler) Run

func (h *Handler) Run() error

Run is a method that starts the HTTP server of a Handler. It initializes the router, creates a new HTTP server and starts listening for requests. It also adds an interrupt handler that gracefully shuts down the server when an interrupt signal is received. It returns any error that occurred during the process.

type HomePageStatisticsResp

type HomePageStatisticsResp struct {
	Inscriptions string `json:"inscriptions"`
	StoredData   string `json:"stored_data"`
	TotalFees    string `json:"total_fees"`
}

type InscribeOrderResp

type InscribeOrderResp struct {
	OrderId        string `json:"order_id"`
	InscriptionId  string `json:"inscription_id"`
	ReceiveAddress string `json:"receive_address"`
	CommitTxId     string `json:"commit_tx_id"`
	RevealTxId     string `json:"reveal_tx_id"`
	RevealTxValue  int64  `json:"reveal_tx_value"`
	Status         int    `json:"status"`
	CreatedAt      int64  `json:"created_at"`
}

type InscribeOrdersResp

type InscribeOrdersResp struct {
	Total int64                `json:"total"`
	List  []*InscribeOrderResp `json:"list"`
}

type InscriptionEntry

type InscriptionEntry struct {
	InscriptionId     string          `json:"inscription_id"`
	InscriptionNumber int64           `json:"inscription_number"`
	ContentType       string          `json:"content_type"`
	MediaType         string          `json:"media_type"`
	ContentLength     uint32          `json:"content_length"`
	Timestamp         string          `json:"timestamp"`
	OwnerOutput       string          `json:"owner_output"`
	OwnerAddress      string          `json:"owner_address"`
	Sat               string          `json:"sat"`
	CInsDescription   CInsDescription `json:"c_ins_description"`
	ContentProtocol   string          `json:"content_protocol"`
}

type InscriptionsReq

type InscriptionsReq struct {
	Search          string   `json:"search"`
	Page            int      `json:"page" binding:"omitempty,min=1"`
	Limit           int      `json:"limit" binding:"omitempty,min=1,max=50"`
	Order           string   `json:"order" binding:"omitempty,oneof=newest oldest"`
	Types           []string `json:"types" binding:"omitempty,dive,oneof=image text json html"`
	InscriptionType string   `json:"inscription_type" binding:"omitempty,oneof=c-brc-20"`
	Charms          []string `json:"charms" binding:"omitempty,dive,oneof=cursed"`
}

func (*InscriptionsReq) Check

func (req *InscriptionsReq) Check() error

type InscriptionsResp

type InscriptionsResp struct {
	SearchType SearchType          `json:"search_type"`
	Page       int                 `json:"page"`
	Total      int                 `json:"total"`
	List       []*InscriptionEntry `json:"list"`
}

type Option

type Option func(*Options)

Option is a function type that sets a specific option in an Options struct.

type Options

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

Options is a struct that holds the configuration options for a Handler.

type OrderStatusResp

type OrderStatusResp struct {
	Status        tables.OrderStatus   `json:"status"`
	InscriptionId tables.InscriptionId `json:"inscription_id"`
}

type SearchType

type SearchType string
const (
	SearchTypeUnknown           SearchType = "unknown"
	SearchTypeEmpty             SearchType = "empty"
	SearchTypeInscriptionId     SearchType = "inscription_id"
	SearchTypeInscriptionNumber SearchType = "inscription_number"
	SearchTypeAddress           SearchType = "address"
	SearchTypeTicker            SearchType = "ticker"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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