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 AccessPublicKey
- type AccessPublicKeyCreateRequest
- type AccessPublicKeyCreateResponse
- type AccessPublicKeyDeleteRequest
- type AccessPublicKeyDeleteResponse
- type BTCFinalityByKeystonesRequest
- type BTCFinalityByKeystonesResponse
- type BTCFinalityByRecentKeystonesRequest
- type BTCFinalityByRecentKeystonesResponse
- type BTCFinalityNotification
- type BTCNewBlockNotification
- type BitcoinBalanceRequest
- type BitcoinBalanceResponse
- type BitcoinBroadcastRequest
- type BitcoinBroadcastResponse
- type BitcoinInfoRequest
- type BitcoinInfoResponse
- type BitcoinUTXO
- type BitcoinUTXOsRequest
- type BitcoinUTXOsResponse
- type L2KeystonesNotification
- type L2KeystonesRequest
- type L2KeystonesResponse
- type NewL2KeystonesRequest
- type NewL2KeystonesResponse
- type PingRequest
- type PingResponse
- type PopTx
- type PopTxsForL2BlockRequest
- type PopTxsForL2BlockResponse
Constants ¶
View Source
const ( APIVersion = 1 CmdPingRequest = "bfgapi-ping-request" CmdPingResponse = "bfgapi-ping-response" CmdPopTxForL2BlockRequest = "bfgapi-pop-txs-for-l2-block-request" CmdPopTxForL2BlockResponse = "bfgapi-pop-txs-for-l2-block-response" CmdNewL2KeystonesRequest = "bfgapi-new-l2-keystones-request" CmdNewL2KeystonesResponse = "bfgapi-new-l2-keystones-response" CmdBTCFinalityByRecentKeystonesRequest = "bfgapi-btc-finality-by-recent-keystones-request" CmdBTCFinalityByRecentKeystonesResponse = "bfgapi-btc-finality-by-recent-keystones-response" CmdBTCFinalityByKeystonesRequest = "bfgapi-btc-finality-by-keystones-request" CmdBTCFinalityByKeystonesResponse = "bfgapi-btc-finality-by-keystones-response" CmdBTCFinalityNotification = "bfgapi-btc-finality-notification" CmdBTCNewBlockNotification = "bfgapi-btc-new-block-notification" CmdL2KeystonesNotification = "bfgapi-l2-keystones-notification" CmdL2KeystonesRequest = "bfgapi-l2-keystones-request" CmdL2KeystonesResponse = "bfgapi-l2-keystones-response" CmdBitcoinBalanceRequest = "bfgapi-bitcoin-balance-request" CmdBitcoinBalanceResponse = "bfgapi-bitcoin-balance-response" CmdBitcoinBroadcastRequest = "bfgapi-bitcoin-broadcast-request" CmdBitcoinBroadcastResponse = "bfgapi-bitcoin-broadcast-response" CmdBitcoinInfoRequest = "bfgapi-bitcoin-info-request" CmdBitcoinInfoResponse = "bfgapi-bitcoin-info-response" CmdBitcoinUTXOsRequest = "bfgapi-bitcoin-utxos-request" CmdBitcoinUTXOsResponse = "bfgapi-bitcoin-utxos-response" CmdAccessPublicKeyCreateRequest = "bfgapi-access-public-key-create-request" CmdAccessPublicKeyCreateResponse = "bfgapi-access-public-key-create-response" CmdAccessPublicKeyDeleteRequest = "bfgapi-access-public-key-delete-request" CmdAccessPublicKeyDeleteResponse = "bfgapi-access-public-key-delete-response" )
Variables ¶
View Source
var ( APIVersionRoute = fmt.Sprintf("v%d", APIVersion) RouteWebsocketPrivate = fmt.Sprintf("/%s/ws/private", APIVersionRoute) RouteWebsocketPublic = fmt.Sprintf("/%s/ws/public", APIVersionRoute) DefaultPrivateListen = "localhost:8080" DefaultPublicListen = "localhost:8383" DefaultPrometheusListen = "localhost:2112" DefaultPrivateURL = "ws://" + DefaultPrivateListen + "/" + RouteWebsocketPrivate DefaultPublicURL = "ws://" + DefaultPublicListen + "/" + RouteWebsocketPublic )
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 AccessPublicKey ¶
type AccessPublicKeyCreateRequest ¶
type AccessPublicKeyCreateRequest struct {
PublicKey string `json:"public_key"` // encoded compressed public key
}
type AccessPublicKeyDeleteRequest ¶
type AccessPublicKeyDeleteRequest struct {
PublicKey string `json:"public_key"`
}
type BTCFinalityByKeystonesRequest ¶
type BTCFinalityByKeystonesRequest struct {
L2Keystones []hemi.L2Keystone `json:"l2_keystones"`
}
type BTCFinalityByKeystonesResponse ¶
type BTCFinalityByKeystonesResponse struct { L2BTCFinalities []hemi.L2BTCFinality `json:"l2_btc_finalities"` Error *protocol.Error `json:"error,omitempty"` }
type BTCFinalityByRecentKeystonesRequest ¶
type BTCFinalityByRecentKeystonesRequest struct {
NumRecentKeystones uint32 `json:"num_recent_keystones"`
}
type BTCFinalityByRecentKeystonesResponse ¶
type BTCFinalityByRecentKeystonesResponse struct { L2BTCFinalities []hemi.L2BTCFinality `json:"l2_btc_finalities"` Error *protocol.Error `json:"error,omitempty"` }
type BTCFinalityNotification ¶
type BTCFinalityNotification struct{}
type BTCNewBlockNotification ¶
type BTCNewBlockNotification struct{}
type BitcoinBalanceRequest ¶
type BitcoinBalanceResponse ¶
type BitcoinBroadcastRequest ¶
type BitcoinInfoRequest ¶
type BitcoinInfoRequest struct{}
type BitcoinInfoResponse ¶
type BitcoinUTXO ¶
type BitcoinUTXOsRequest ¶
type BitcoinUTXOsResponse ¶
type BitcoinUTXOsResponse struct { UTXOs []*BitcoinUTXO `json:"utxos"` Error *protocol.Error `json:"error,omitempty"` }
type L2KeystonesNotification ¶
type L2KeystonesNotification struct{}
type L2KeystonesRequest ¶
type L2KeystonesRequest struct {
NumL2Keystones uint64 `json:"num_l2_keystones"`
}
type L2KeystonesResponse ¶
type L2KeystonesResponse struct { L2Keystones []hemi.L2Keystone `json:"l2_keystones"` Error *protocol.Error `json:"error,omitempty"` }
type NewL2KeystonesRequest ¶
type NewL2KeystonesRequest struct {
L2Keystones []hemi.L2Keystone `json:"l2_keystones"`
}
type NewL2KeystonesResponse ¶
type PingRequest ¶
type PingRequest protocol.PingRequest
PingRequest and PingResponse are bfg-specific ping request/replies
type PingResponse ¶
type PingResponse protocol.PingResponse
PingRequest and PingResponse are bfg-specific ping request/replies
type PopTx ¶
type PopTx struct { BtcTxId api.ByteSlice `json:"btc_tx_id"` BtcRawTx api.ByteSlice `json:"btc_raw_tx"` BtcHeaderHash api.ByteSlice `json:"btc_header_hash"` BtcTxIndex *uint64 `json:"btc_tx_index"` BtcMerklePath []string `json:"btc_merkle_path"` PopTxId api.ByteSlice `json:"pop_tx_id"` PopMinerPublicKey api.ByteSlice `json:"pop_miner_public_key"` L2KeystoneAbrevHash api.ByteSlice `json:"l2_keystone_abrev_hash"` }
type PopTxsForL2BlockRequest ¶
Click to show internal directories.
Click to hide internal directories.