-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.go
29 lines (24 loc) · 777 Bytes
/
api.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package net
import (
"fmt"
clientcontext "github.com/ci123chain/ci123chain/pkg/client/context"
"github.com/ci123chain/ci123chain/pkg/util"
)
// PublicNetAPI is the eth_ prefixed set of APIs in the Web3 JSON-RPC spec.
type PublicNetAPI struct {
networkVersion uint64
}
// NewAPI creates an instance of the public Net Web3 API.
func NewAPI(clientCtx clientcontext.Context) *PublicNetAPI {
return &PublicNetAPI{
networkVersion: uint64(util.CHAINID),
}
}
// Version returns the current ethereum protocol version.
func (api *PublicNetAPI) Version() string {
return fmt.Sprintf("%d", api.networkVersion)
}
// Listening returns an indication if the node is listening for network connections.
func (api *PublicNetAPI) Listening() bool {
return true // always listening
}