diff options
author | Determinant <[email protected]> | 2020-07-30 14:18:44 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2020-07-30 14:18:44 -0400 |
commit | 0444e66f640999c15496066637841efcc0433934 (patch) | |
tree | c19aec2dced2e9129c880c19c52ca0f87b3d62f6 /rpc/types.go | |
parent | cffa0954bbdb43821d1b71d00f99fb705cecd25b (diff) | |
parent | 1f49826de2bb8bb4f5f99f69fd2beb039b1172d9 (diff) |
Merge branch 'multi-coin'
Diffstat (limited to 'rpc/types.go')
-rw-r--r-- | rpc/types.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/rpc/types.go b/rpc/types.go index 7312397..202dd79 100644 --- a/rpc/types.go +++ b/rpc/types.go @@ -17,6 +17,7 @@ package rpc import ( + "context" "fmt" "math" "strings" @@ -24,6 +25,39 @@ import ( "github.com/ava-labs/go-ethereum/common/hexutil" ) +// API describes the set of methods offered over the RPC interface +type API struct { + Namespace string // namespace under which the rpc methods of Service are exposed + Version string // api version for DApp's + Service interface{} // receiver instance which holds the methods + Public bool // indication if the methods must be considered safe for public use +} + +// Error wraps RPC errors, which contain an error code in addition to the message. +type Error interface { + Error() string // returns the message + ErrorCode() int // returns the code +} + +// ServerCodec implements reading, parsing and writing RPC messages for the server side of +// a RPC session. Implementations must be go-routine safe since the codec can be called in +// multiple go-routines concurrently. +type ServerCodec interface { + Read() (msgs []*jsonrpcMessage, isBatch bool, err error) + Close() + jsonWriter +} + +// jsonWriter can write JSON messages to its underlying connection. +// Implementations must be safe for concurrent use. +type jsonWriter interface { + Write(context.Context, interface{}) error + // Closed returns a channel which is closed when the connection is closed. + Closed() <-chan interface{} + // RemoteAddr returns the peer address of the connection. + RemoteAddr() string +} + type BlockNumber int64 const ( |