-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathclient.go
64 lines (55 loc) · 2.54 KB
/
client.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package rpc
import (
"context"
"errors"
"github.com/ethereum/go-ethereum/rpc"
)
const (
BatchNumber = "eth_blockNumber"
Call = "eth_call"
ChainID = "eth_chainId"
GetBalance = "eth_getBalance"
GetBatchByHash = "eth_getBlockByHash"
GetBatchByNumber = "eth_getBlockByNumber"
GetCode = "eth_getCode"
GetTransactionByHash = "eth_getTransactionByHash"
GetTransactionCount = "eth_getTransactionCount"
GetTransactionReceipt = "eth_getTransactionReceipt"
SendRawTransaction = "eth_sendRawTransaction"
EstimateGas = "eth_estimateGas"
GetLogs = "eth_getLogs"
GetStorageAt = "eth_getStorageAt"
Health = "obscuro_health"
Config = "obscuro_config"
GetBlockHeaderByHash = "obscuroscan_getBlockHeaderByHash"
GetBatch = "obscuroscan_getBatch"
GetBatchForTx = "obscuroscan_getBatchForTx"
GetLatestTxs = "obscuroscan_getLatestTransactions"
GetTotalTxs = "obscuroscan_getTotalTransactions"
Attestation = "obscuroscan_attestation"
StopHost = "test_stopHost"
Subscribe = "eth_subscribe"
SubscribeNamespace = "eth"
SubscriptionTypeLogs = "logs"
// GetL1RollupHeaderByHash = "scan_getL1RollupHeaderByHash"
// GetActiveNodeCount = "scan_getActiveNodeCount"
GetLatestRollupHeader = "scan_getLatestRollupHeader"
GetTotalTransactionCount = "scan_getTotalTransactionCount"
GetTotalContractCount = "scan_getTotalContractCount"
GetPublicTransactionData = "scan_getPublicTransactionData"
GetBatchListing = "scan_getBatchListing"
GetBlockListing = "scan_getBlockListing"
GetFullBatchByHash = "scan_getBatchByHash"
)
var ErrNilResponse = errors.New("nil response received from Obscuro node")
// Client is used by client applications to interact with the Obscuro node
type Client interface {
// Call executes the named method via RPC. (Returns `ErrNilResponse` on nil response from Node, this is used as "not found" for some method calls)
Call(result interface{}, method string, args ...interface{}) error
// CallContext If the context is canceled before the call has successfully returned, CallContext returns immediately.
CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
// Subscribe creates a subscription to the Obscuro host.
Subscribe(ctx context.Context, result interface{}, namespace string, channel interface{}, args ...interface{}) (*rpc.ClientSubscription, error)
// Stop closes the client.
Stop()
}