Add event support for token mint
This commit is contained in:
parent
f67edfb541
commit
ce9a263b40
@ -34,9 +34,9 @@ func NewEventsUpdater(api remote.AccountService, store storage.StorageService) *
|
||||
|
||||
func (eu *EventsUpdater) ToEventsHandler() *apievent.EventsHandler {
|
||||
eh := apievent.NewEventsHandler()
|
||||
eh = eh.WithHandler(apievent.EventTokenMintTag, eu.handleTokenMint)
|
||||
eh = eh.WithHandler(apievent.EventTokenTransferTag, eu.handleTokenTransfer)
|
||||
eh = eh.WithHandler(apievent.EventRegistrationTag, eu.handleCustodialRegistration)
|
||||
eh = eh.WithHandler(apievent.EventTokenMintTag, eu.handleNoop)
|
||||
return eh
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ func (eu *EventsUpdater) updateDefaultToken(ctx context.Context, identity identi
|
||||
func (eh *EventsUpdater) handleTokenTransfer(ctx context.Context, ev any) error {
|
||||
o, ok := ev.(*apievent.EventTokenTransfer)
|
||||
if !ok {
|
||||
fmt.Errorf("invalid event for custodial registration")
|
||||
fmt.Errorf("invalid event for token transfer")
|
||||
}
|
||||
return eh.HandleTokenTransfer(ctx, o)
|
||||
}
|
||||
@ -105,6 +105,13 @@ func (eu *EventsUpdater) HandleTokenTransfer(ctx context.Context, ev *apievent.E
|
||||
}
|
||||
|
||||
// handle token mint.
|
||||
func (eh *EventsUpdater) handleTokenMint(ctx context.Context, ev any) error {
|
||||
o, ok := ev.(*apievent.EventTokenMint)
|
||||
if !ok {
|
||||
fmt.Errorf("invalid event for token mint")
|
||||
}
|
||||
return eh.HandleTokenMint(ctx, o)
|
||||
}
|
||||
func (eu *EventsUpdater) HandleTokenMint(ctx context.Context, ev *apievent.EventTokenMint) error {
|
||||
_, userStore, err := eu.getStore(ctx)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user