/
consts.go
40 lines (31 loc) · 991 Bytes
/
consts.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
package common
import "strings"
const (
SourceTagLocal = "local"
SourceTagBloxroute = "bloxroute"
SourceTagChainbound = "chainbound"
SourceTagEden = "eden"
SourceTagAlchemy = "alchemy"
SourceTagInfura = "infura"
// Trash tx reasons
TrashTxAlreadyOnChain = "tx-already-onchain"
TrashTxSignatureError = "signature-error"
// GRPCWindowSize is recommended window size by bloxroute-labs:
// https://docs.bloxroute.com/streams/working-with-streams/creating-a-subscription/grpc
GRPCWindowSize = 128 * 1024
// TxAlreadyIncludedThreshold sets the threshold for discarding transactions (if included that many ms before received)
TxAlreadyIncludedThreshold = 12_000
)
func TxSourcName(uri string) string {
sourceAlias := SourceAliasesFromEnv()
if alias, ok := sourceAlias[uri]; ok {
return alias
}
if strings.Contains(uri, "alchemy.com/") {
return SourceTagAlchemy
}
if strings.Contains(uri, "infura.io/") {
return SourceTagInfura
}
return uri
}