Documentation
¶
Index ¶
- func WithAddr(addr string) func(*Options)
- func WithClient(cli *rpcclient.Client) func(*Options)
- func WithDB(db *dao.DB) func(*Options)
- func WithEngin(g *gin.Engine) func(*Options)
- func WithTestNet(testnet bool) func(*Options)
- type Handler
- func (h *Handler) BRC20CToken(ctx *gin.Context)
- func (h *Handler) BRC20CTokens(ctx *gin.Context)
- func (h *Handler) BlockClock(ctx *gin.Context)
- func (h *Handler) BlockHash(ctx *gin.Context)
- func (h *Handler) BlockHeight(ctx *gin.Context)
- func (h *Handler) Content(ctx *gin.Context)
- func (h *Handler) DB() *dao.DB
- func (h *Handler) Engine() *gin.Engine
- func (h *Handler) GetBRC20TokenInfo(token *tables.Protocol) (gin.H, error)
- func (h *Handler) GetChainParams() *chaincfg.Params
- func (h *Handler) InitRouter()
- func (h *Handler) Inscription(ctx *gin.Context)
- func (h *Handler) Inscriptions(ctx *gin.Context)
- func (h *Handler) InscriptionsInBlock(ctx *gin.Context)
- func (h *Handler) InscriptionsInBlockPage(ctx *gin.Context)
- func (h *Handler) InscriptionsInOutput(ctx *gin.Context)
- func (h *Handler) RpcClient() *rpcclient.Client
- func (h *Handler) Run() error
- type Option
- type Options
- type RespInscription
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithAddr ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
BRC20CToken is a handler function for handling BRC20C token requests. It validates the request parameters and calls the doBRC20CToken function.
func (*Handler) BRC20CTokens ¶
BRC20CTokens is a handler function for handling BRC20C tokens requests. It validates the request parameters and calls the doBRC20CTokens function.
func (*Handler) BlockClock ¶
BlockClock return latest block clock
func (*Handler) BlockHeight ¶
BlockHeight return latest block height
func (*Handler) Content ¶
Content is a handler function for handling content requests. It validates the request parameters and calls the doContent function.
func (*Handler) Engine ¶
Engine is a method that returns the gin engine from the options of a Handler.
func (*Handler) GetBRC20TokenInfo ¶
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 ¶
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 ¶
Inscription is a handler function for handling inscription requests. It validates the request parameters and calls the doInscription function.
func (*Handler) Inscriptions ¶
Inscriptions is a handler function for handling inscriptions requests. It validates the request parameters and calls the doInscriptions function.
func (*Handler) InscriptionsInBlock ¶
func (*Handler) InscriptionsInBlockPage ¶
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 (*Handler) RpcClient ¶
RpcClient is a method that returns the rpcclient from the options of a Handler.
func (*Handler) Run ¶
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.