forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 58
/
api.go
42 lines (35 loc) · 914 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
30
31
32
33
34
35
36
37
38
39
40
41
42
package XDCx
import (
"context"
"errors"
"sync"
"time"
)
const (
LimitThresholdOrderNonceInQueue = 100
)
// List of errors
var (
ErrNoTopics = errors.New("missing topic(s)")
ErrOrderNonceTooLow = errors.New("OrderNonce too low")
ErrOrderNonceTooHigh = errors.New("OrderNonce too high")
)
// PublicXDCXAPI provides the XDCX RPC service that can be
// use publicly without security implications.
type PublicXDCXAPI struct {
t *XDCX
mu sync.Mutex
lastUsed map[string]time.Time // keeps track when a filter was polled for the last time.
}
// NewPublicXDCXAPI create a new RPC XDCX service.
func NewPublicXDCXAPI(t *XDCX) *PublicXDCXAPI {
api := &PublicXDCXAPI{
t: t,
lastUsed: make(map[string]time.Time),
}
return api
}
// Version returns the XDCX sub-protocol version.
func (api *PublicXDCXAPI) Version(ctx context.Context) string {
return ProtocolVersionStr
}