File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ package registry
2
+
3
+ import "github.com/0xjeffro/tx-parser/solana/types"
4
+
5
+ type ProgramParser struct {
6
+ ProgramName string
7
+ ProgramID string
8
+ ProgramParserFunc func (* types.Instruction , types.Instruction ) (types.Action , error )
9
+ }
10
+
11
+ var programParsers = make (map [string ]ProgramParser )
12
+
13
+ func Register (parser ProgramParser ) {
14
+ programParsers [parser .ProgramID ] = parser
15
+ }
16
+
17
+ func GetAllProgramParsers () []ProgramParser {
18
+ result := make ([]ProgramParser , 0 , len (programParsers ))
19
+ for _ , p := range programParsers {
20
+ result = append (result , p )
21
+ }
22
+ return result
23
+ }
24
+
25
+ func GetParserByID (programID string ) (ProgramParser , bool ) {
26
+ p , ok := programParsers [programID ]
27
+ return p , ok
28
+ }
You can’t perform that action at this time.
0 commit comments