Add dev event converters

This commit is contained in:
lash 2025-01-13 18:13:51 +00:00
parent 25149ff265
commit 5511955438
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746

View File

@ -41,6 +41,25 @@ type Tx struct {
When time.Time `json: "when"`
}
func (t *Tx) ToTransferEvent() event.EventTokenTransfer {
return event.EventTokenTransfer{
To: t.To,
Value: t.Value,
VoucherAddress: t.Voucher,
TxHash: t.Hsh,
From: t.From,
}
}
func (t *Tx) ToMintEvent() event.EventTokenMint {
return event.EventTokenMint{
To: t.To,
Value: t.Value,
VoucherAddress: t.Voucher,
TxHash: t.Hsh,
}
}
type Account struct {
Track string `json: "track"`
Address string `json: "address"`
@ -51,6 +70,12 @@ type Account struct {
Txs []string `json: "txs"`
}
func (a *Account) ToRegistrationEvent() event.EventCustodialRegistration {
return event.EventCustodialRegistration{
Account: a.Address,
}
}
type Voucher struct {
Name string `json: "name"`
Address string `json: "address"`