forked from ten-protocol/go-ten
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.go
50 lines (45 loc) · 2.04 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
package rpc
import (
"context"
"errors"
"github.com/ethereum/go-ethereum/rpc"
)
const (
RollupNumber = "eth_blockNumber"
Call = "eth_call"
ChainID = "eth_chainId"
GetBalance = "eth_getBalance"
GetRollupByHash = "eth_getBlockByHash"
GetRollupByNumber = "eth_getBlockByNumber"
GetCode = "eth_getCode"
GetTransactionByHash = "eth_getTransactionByHash"
GetTransactionCount = "eth_getTransactionCount"
GetTransactionReceipt = "eth_getTransactionReceipt"
SendRawTransaction = "eth_sendRawTransaction"
EstimateGas = "eth_estimateGas"
GetLogs = "eth_getLogs"
AddViewingKey = "obscuro_addViewingKey"
Health = "obscuro_health"
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"
)
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()
}