Add dev event converters
This commit is contained in:
parent
25149ff265
commit
5511955438
25
dev/api.go
25
dev/api.go
@ -41,6 +41,25 @@ type Tx struct {
|
|||||||
When time.Time `json: "when"`
|
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 {
|
type Account struct {
|
||||||
Track string `json: "track"`
|
Track string `json: "track"`
|
||||||
Address string `json: "address"`
|
Address string `json: "address"`
|
||||||
@ -51,6 +70,12 @@ type Account struct {
|
|||||||
Txs []string `json: "txs"`
|
Txs []string `json: "txs"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *Account) ToRegistrationEvent() event.EventCustodialRegistration {
|
||||||
|
return event.EventCustodialRegistration{
|
||||||
|
Account: a.Address,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type Voucher struct {
|
type Voucher struct {
|
||||||
Name string `json: "name"`
|
Name string `json: "name"`
|
||||||
Address string `json: "address"`
|
Address string `json: "address"`
|
||||||
|
Loading…
Reference in New Issue
Block a user