laconicd/rpc/websockets/types.go
Federico Kunze 4501bbccdc
rpc, evm: refactor (#588)
* stargate: refactor

* remove evm CLI

* rpc: refactor

* more fixes

* fixes fixes fixes

* changelog

* refactor according to namespaces

* fix

* lint

* remove export logic

* fix rpc test

* godoc
2020-10-22 17:39:51 -03:00

46 lines
1.0 KiB
Go

package websockets
import (
"math/big"
"github.com/gorilla/websocket"
"github.com/ethereum/go-ethereum/rpc"
rpcfilters "github.com/cosmos/ethermint/rpc/namespaces/eth/filters"
)
type SubscriptionResponseJSON struct {
Jsonrpc string `json:"jsonrpc"`
Result interface{} `json:"result"`
ID float64 `json:"id"`
}
type SubscriptionNotification struct {
Jsonrpc string `json:"jsonrpc"`
Method string `json:"method"`
Params *SubscriptionResult `json:"params"`
}
type SubscriptionResult struct {
Subscription rpc.ID `json:"subscription"`
Result interface{} `json:"result"`
}
type ErrorResponseJSON struct {
Jsonrpc string `json:"jsonrpc"`
Error *ErrorMessageJSON `json:"error"`
ID *big.Int `json:"id"`
}
type ErrorMessageJSON struct {
Code *big.Int `json:"code"`
Message string `json:"message"`
}
type wsSubscription struct {
sub *rpcfilters.Subscription
unsubscribed chan struct{} // closed when unsubscribing
conn *websocket.Conn
}