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 BTCFinalityByKeystonesRequest
- type BTCFinalityByKeystonesResponse
- type BTCFinalityByRecentKeystonesRequest
- type BTCFinalityByRecentKeystonesResponse
- type BTCFinalityNotification
- type BTCNewBlockNotification
- type L2KeystoneRequest
- type L2KeystoneResponse
- type OptimismKeystone
- type PingRequest
- type PingResponse
- type PopPayout
- type PopPayoutsRequest
- type PopPayoutsResponse
Constants ¶
View Source
const ( // Generic RPC commands CmdPingRequest = "bssapi-ping-request" CmdPingResponse = "bssapi-ping-response" // Custom RPC commands CmdPopPayoutRequest protocol.Command = "bssapi-pop-payout-request" CmdPopPayoutResponse protocol.Command = "bssapi-pop-payout-response" CmdL2KeystoneRequest protocol.Command = "bssapi-l2-keystone-request" CmdL2KeystoneResponse protocol.Command = "bssapi-l2-keystone-response" CmdBTCFinalityByRecentKeystonesRequest protocol.Command = "bssapi-btc-finality-by-recent-keystones-request" CmdBTCFinalityByRecentKeystonesResponse protocol.Command = "bssapi-btc-finality-by-recent-keystones-response" CmdBTCFinalityByKeystonesRequest protocol.Command = "bssapi-btc-finality-by-keystones-request" CmdBTCFinalityByKeystonesResponse protocol.Command = "bssapi-btc-finality-by-keystones-response" CmdBTCFinalityNotification protocol.Command = "bssapi-btc-finality-notification" CmdBTCNewBlockNotification protocol.Command = "bssapi-btc-new-block-notification" )
View Source
const (
APIVersion = 1
)
Variables ¶
View Source
var ( APIVersionRoute = fmt.Sprintf("v%d", APIVersion) RouteWebsocket = fmt.Sprintf("/%s/ws", APIVersionRoute) DefaultListen = "localhost:8081" DefaultPrometheusListen = "localhost:2112" DefaultURL = "ws://" + DefaultListen + RouteWebsocket )
Functions ¶
func Call ¶
func Call(ctx context.Context, c *protocol.Conn, payload any) (protocol.Command, string, any, error)
Call executes a blocking RPC call. Note that this requires the client to provide a ReadConn in a for loop in order to receive commands. This may be fixed in the future but seems simple enough to just leave alone for now. The need for the ReadConn loop is because apiCmd is not exported.
Types ¶
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 L2KeystoneRequest ¶
type L2KeystoneRequest struct {
L2Keystone hemi.L2Keystone
}
type L2KeystoneResponse ¶
type OptimismKeystone ¶
type OptimismKeystone hemi.L2Keystone // dop only
type PingRequest ¶
type PingRequest protocol.PingRequest
type PingResponse ¶
type PingResponse protocol.PingResponse
type PopPayoutsRequest ¶
type PopPayoutsRequest struct { L2BlockForPayout api.ByteSlice `json:"l2_block_for_payout"` // these are unused at this point, they will be used in the future to determine the // total payout to miners PopDifficultyNumerator uint64 `json:"popDifficultyNumerator,omitempty"` PopDifficultyDenominator uint64 `json:"popDifficultyDenominator,omitempty"` }
Click to show internal directories.
Click to hide internal directories.