Documentation
¶
Index ¶
- Constants
- Variables
- func APICommands() map[protocol.Command]reflect.Type
- func Call(ctx context.Context, c *protocol.Conn, payload any) (protocol.Command, string, any, error)
- func Read(ctx context.Context, c protocol.APIConn) (protocol.Command, string, any, error)
- func ReadConn(ctx context.Context, c *protocol.Conn) (protocol.Command, string, any, error)
- func Write(ctx context.Context, c protocol.APIConn, id string, payload any) error
- func WriteConn(ctx context.Context, c *protocol.Conn, id string, payload any) error
- type BalanceByAddressRequest
- type BalanceByAddressResponse
- type BlockHeader
- type BlockHeadersBestRawRequest
- type BlockHeadersBestRawResponse
- type BlockHeadersBestRequest
- type BlockHeadersBestResponse
- type BlockHeadersByHeightRawRequest
- type BlockHeadersByHeightRawResponse
- type BlockHeadersByHeightRequest
- type BlockHeadersByHeightResponse
- type OutPoint
- type PingRequest
- type PingResponse
- type Tx
- type TxByIdRawRequest
- type TxByIdRawResponse
- type TxByIdRequest
- type TxByIdResponse
- type TxIn
- type TxOut
- type TxWitness
- type Utxo
- type UtxosByAddressRawRequest
- type UtxosByAddressRawResponse
- type UtxosByAddressRequest
- type UtxosByAddressResponse
Constants ¶
View Source
const ( APIVersion = 1 CmdPingRequest = "tbcapi-ping-request" CmdPingResponse = "tbcapi-ping-response" CmdBlockHeadersByHeightRawRequest = "tbcapi-block-headers-by-height-raw-request" CmdBlockHeadersByHeightRawResponse = "tbcapi-block-headers-by-height-raw-response" CmdBlockHeadersByHeightRequest = "tbcapi-block-headers-by-height-request" CmdBlockHeadersByHeightResponse = "tbcapi-block-headers-by-height-response" CmdBlockHeadersBestRawRequest = "tbcapi-block-headers-best-raw-request" CmdBlockHeadersBestRawResponse = "tbcapi-block-headers-best-raw-response" CmdBlockHeadersBestRequest = "tbcapi-block-headers-best-request" CmdBlockHeadersBestResponse = "tbcapi-block-headers-best-response" CmdBalanceByAddressRequest = "tbcapi-balance-by-address-request" CmdBalanceByAddressResponse = "tbcapi-balance-by-address-response" CmdUtxosByAddressRawRequest = "tbcapi-utxos-by-address-raw-request" CmdUtxosByAddressRawResponse = "tbcapi-utxos-by-address-raw-response" CmdUtxosByAddressRequest = "tbcapi-utxos-by-address-request" CmdUtxosByAddressResponse = "tbcapi-utxos-by-address-response" CmdTxByIdRawRequest = "tbcapi-tx-by-id-raw-request" CmdTxByIdRawResponse = "tbcapi-tx-by-id-raw-response" CmdTxByIdRequest = "tbcapi-tx-by-id-request" CmdTxByIdResponse = "tbcapi-tx-by-id-response" )
Variables ¶
View Source
var ( APIVersionRoute = fmt.Sprintf("v%d", APIVersion) RouteWebsocket = fmt.Sprintf("/%s/ws", APIVersionRoute) DefaultListen = "localhost:8082" DefaultURL = fmt.Sprintf("ws://%s/%s", DefaultListen, RouteWebsocket) )
Functions ¶
func Call ¶
func Call(ctx context.Context, c *protocol.Conn, payload any) (protocol.Command, string, any, error)
Call is a blocking call. One should use ReadConn when using Call or else the completion will end up in the Read instead of being completed as expected.
func Read ¶
Read is the low level primitive of a protocol Read. One should generally not use this function and use ReadConn instead.
func ReadConn ¶
ReadConn reads from Conn and performs callbacks. One should use ReadConn over Read when mixing Write, WriteConn and Call.
Types ¶
type BalanceByAddressRequest ¶
type BalanceByAddressRequest struct {
Address string `json:"address"`
}
type BlockHeader ¶
type BlockHeadersBestRawRequest ¶
type BlockHeadersBestRawRequest struct{}
type BlockHeadersBestRequest ¶
type BlockHeadersBestRequest struct{}
type BlockHeadersBestResponse ¶
type BlockHeadersBestResponse struct {
Height uint64 `json:"height"`
BlockHeaders []*BlockHeader `json:"block_headers"`
Error *protocol.Error `json:"error,omitempty"`
}
type BlockHeadersByHeightRawRequest ¶
type BlockHeadersByHeightRawRequest struct {
Height uint32 `json:"height"`
}
type BlockHeadersByHeightRequest ¶
type BlockHeadersByHeightRequest struct {
Height uint32 `json:"height"`
}
type BlockHeadersByHeightResponse ¶
type BlockHeadersByHeightResponse struct {
BlockHeaders []*BlockHeader `json:"block_headers"`
Error *protocol.Error `json:"error,omitempty"`
}
type PingRequest ¶
type PingRequest protocol.PingRequest
type PingResponse ¶
type PingResponse protocol.PingResponse
type TxByIdRawRequest ¶
type TxByIdRawResponse ¶
type TxByIdRequest ¶
type TxByIdResponse ¶
type UtxosByAddressRequest ¶
type UtxosByAddressResponse ¶
Click to show internal directories.
Click to hide internal directories.