-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
34 lines (27 loc) · 1.01 KB
/
main.go
File metadata and controls
34 lines (27 loc) · 1.01 KB
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
package main
import (
"context"
"fmt"
"github.com/mateeullahmalik/eh_parser/ethereum"
"github.com/mateeullahmalik/eh_parser/parser"
infraEth "github.com/mateeullahmalik/eh_parser/parser/infrastructure/ethereum"
"github.com/mateeullahmalik/eh_parser/parser/infrastructure/store/memory"
)
func main() {
// example of how to use the parser
ethereumClient := ethereum.NewClient(ethereum.NewConfig())
txnsParser := parser.NewClient(
infraEth.NewEthereumBlockchain(ethereumClient),
memory.NewTransactionMemoryStore(),
)
if err := txnsParser.Run(context.Background()); err != nil {
panic(err) // To Do: use a better error handling mechanism
}
txnsParser.Subscribe("0x1234567890abcdef1234567890abcdef12345678")
fmt.Println("Subscribed to address 0x1234567890abcdef1234567890abcdef12345678")
// Get transactions for the address won't work withouth connecting to the Ethereum blockchain
// txns, err := txnsParser.GetTransactions("0x1234567890abcdef1234567890abcdef12345678")
// if err != nil {
// panic(err)
// }
}