handle

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 30 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 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 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) BRC20CToken

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

BRC20CToken is a handler function for handling BRC20C token requests. It validates the request parameters and calls the doBRC20CToken function.

func (*Handler) BRC20CTokens

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

BRC20CTokens is a handler function for handling BRC20C tokens requests. It validates the request parameters and calls the doBRC20CTokens function.

func (*Handler) BlockClock

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

BlockClock return latest block clock

func (*Handler) BlockHash

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

BlockHash return latest block hash, or return block hash by height.

func (*Handler) BlockHeight

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

BlockHeight return latest block height

func (*Handler) Content

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

Content is a handler function for handling content requests. It validates the request parameters and calls the doContent function.

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) GetBRC20TokenInfo

func (h *Handler) GetBRC20TokenInfo(token *tables.Protocol) (gin.H, error)

GetBRC20TokenInfo retrieves the information of a specific BRC20C token. It takes a token of type *tables.Protocol as a parameter. It returns the token information and any error encountered.

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) InitRouter

func (h *Handler) InitRouter()

func (*Handler) Inscription

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

Inscription is a handler function for handling inscription requests. It validates the request parameters and calls the doInscription function.

func (*Handler) Inscriptions

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

Inscriptions is a handler function for handling inscriptions requests. It validates the request parameters and calls the doInscriptions function.

func (*Handler) InscriptionsInBlock

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

func (*Handler) InscriptionsInBlockPage

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

InscriptionsInBlockPage is a handler function for handling inscriptions in block requests. It validates the request parameters and calls the doInscriptionsInBlock function.

func (*Handler) InscriptionsInOutput

func (h *Handler) InscriptionsInOutput(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 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 RespInscription

type RespInscription struct {
	InscriptionId   string                 `json:"inscription_id"`
	Charms          []string               `json:"charms"`
	InscriptionNum  int64                  `json:"inscription_number"`
	Next            string                 `json:"next"`
	Previous        string                 `json:"previous"`
	Owner           string                 `json:"address"`
	Sat             uint64                 `json:"sat"`
	ContentLength   int                    `json:"content_length"`
	ContentType     string                 `json:"content_type"`
	GenesisFee      uint64                 `json:"genesis_fee"`
	GenesisHeight   uint32                 `json:"genesis_height"`
	OutputValue     int64                  `json:"output_value"`
	SatPoint        string                 `json:"satpoint"`
	Timestamp       int64                  `json:"timestamp"`
	CInsDescription tables.CInsDescription `json:"c_ins_description"`
	ContentProtocol string                 `json:"content_protocol"`
}

RespInscription is a struct that represents the response for an inscription request.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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