mirror of
				https://github.com/grassrootseconomics/eth-tracker.git
				synced 2025-11-04 10:28:22 +01:00 
			
		
		
		
	feat: move event into pkg
This commit is contained in:
		
							parent
							
								
									1a49f07db6
								
							
						
					
					
						commit
						23ec001c62
					
				@ -1,7 +1,6 @@
 | 
			
		||||
services:
 | 
			
		||||
  nats:
 | 
			
		||||
    image: nats:2
 | 
			
		||||
    restart: unless-stopped
 | 
			
		||||
    command: -js -sd /tmp/nats/data -m 8222
 | 
			
		||||
    ports:
 | 
			
		||||
      - 127.0.0.1:4222:4222
 | 
			
		||||
 | 
			
		||||
@ -5,8 +5,8 @@ import (
 | 
			
		||||
	"math/big"
 | 
			
		||||
 | 
			
		||||
	"github.com/celo-org/celo-blockchain/common"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/internal/event"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/internal/pub"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/pkg/event"
 | 
			
		||||
	"github.com/grassrootseconomics/w3-celo"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -5,8 +5,8 @@ import (
 | 
			
		||||
 | 
			
		||||
	"github.com/celo-org/celo-blockchain/common"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/internal/cache"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/internal/event"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/internal/pub"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/pkg/event"
 | 
			
		||||
	"github.com/grassrootseconomics/w3-celo"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -5,8 +5,8 @@ import (
 | 
			
		||||
 | 
			
		||||
	"github.com/celo-org/celo-blockchain/common"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/internal/cache"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/internal/event"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/internal/pub"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/pkg/event"
 | 
			
		||||
	"github.com/grassrootseconomics/w3-celo"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -4,8 +4,8 @@ import (
 | 
			
		||||
	"context"
 | 
			
		||||
 | 
			
		||||
	"github.com/celo-org/celo-blockchain/common"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/internal/event"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/internal/pub"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/pkg/event"
 | 
			
		||||
	"github.com/grassrootseconomics/w3-celo"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -5,8 +5,8 @@ import (
 | 
			
		||||
	"math/big"
 | 
			
		||||
 | 
			
		||||
	"github.com/celo-org/celo-blockchain/common"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/internal/event"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/internal/pub"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/pkg/event"
 | 
			
		||||
	"github.com/grassrootseconomics/w3-celo"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -5,8 +5,8 @@ import (
 | 
			
		||||
	"math/big"
 | 
			
		||||
 | 
			
		||||
	"github.com/celo-org/celo-blockchain/common"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/internal/event"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/internal/pub"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/pkg/event"
 | 
			
		||||
	"github.com/grassrootseconomics/w3-celo"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -5,8 +5,8 @@ import (
 | 
			
		||||
	"math/big"
 | 
			
		||||
 | 
			
		||||
	"github.com/celo-org/celo-blockchain/common"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/internal/event"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/internal/pub"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/pkg/event"
 | 
			
		||||
	"github.com/grassrootseconomics/w3-celo"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -5,8 +5,8 @@ import (
 | 
			
		||||
	"math/big"
 | 
			
		||||
 | 
			
		||||
	"github.com/celo-org/celo-blockchain/common"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/internal/event"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/internal/pub"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/pkg/event"
 | 
			
		||||
	"github.com/grassrootseconomics/w3-celo"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -5,8 +5,8 @@ import (
 | 
			
		||||
	"math/big"
 | 
			
		||||
 | 
			
		||||
	"github.com/celo-org/celo-blockchain/common"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/internal/event"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/internal/pub"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/pkg/event"
 | 
			
		||||
	"github.com/grassrootseconomics/w3-celo"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -5,8 +5,8 @@ import (
 | 
			
		||||
	"math/big"
 | 
			
		||||
 | 
			
		||||
	"github.com/celo-org/celo-blockchain/common"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/internal/event"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/internal/pub"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/pkg/event"
 | 
			
		||||
	"github.com/grassrootseconomics/w3-celo"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -5,8 +5,8 @@ import (
 | 
			
		||||
	"math/big"
 | 
			
		||||
 | 
			
		||||
	"github.com/celo-org/celo-blockchain/common"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/internal/event"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/internal/pub"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/pkg/event"
 | 
			
		||||
	"github.com/grassrootseconomics/w3-celo"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -4,7 +4,7 @@ import (
 | 
			
		||||
	"context"
 | 
			
		||||
	"log/slog"
 | 
			
		||||
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/internal/event"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/pkg/event"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type (
 | 
			
		||||
 | 
			
		||||
@ -7,7 +7,7 @@ import (
 | 
			
		||||
	"log/slog"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/internal/event"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/pkg/event"
 | 
			
		||||
	"github.com/nats-io/nats.go"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -3,7 +3,7 @@ package pub
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/internal/event"
 | 
			
		||||
	"github.com/grassrootseconomics/celo-tracker/pkg/event"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type (
 | 
			
		||||
 | 
			
		||||
@ -22,3 +22,15 @@ func (e Event) Serialize() ([]byte, error) {
 | 
			
		||||
 | 
			
		||||
	return jsonData, err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Deserialize(jsonData []byte) (Event, error) {
 | 
			
		||||
	var (
 | 
			
		||||
		event Event
 | 
			
		||||
	)
 | 
			
		||||
 | 
			
		||||
	if err := json.Unmarshal(jsonData, &event); err != nil {
 | 
			
		||||
		return event, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return event, nil
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user