rpc: add server-side NEP-11 tracking API
This commit is contained in:
parent
b622c1934d
commit
7f48653e66
9 changed files with 483 additions and 93 deletions
27
pkg/rpc/server/tokens.go
Normal file
27
pkg/rpc/server/tokens.go
Normal file
|
@ -0,0 +1,27 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neo-go/pkg/rpc/response/result"
|
||||
)
|
||||
|
||||
// tokenTransfers is a generic type used to represent NEP-11 and NEP-17 transfers.
|
||||
type tokenTransfers struct {
|
||||
Sent []interface{} `json:"sent"`
|
||||
Received []interface{} `json:"received"`
|
||||
Address string `json:"address"`
|
||||
}
|
||||
|
||||
// nep17TransferToNEP11 adds an ID to provided NEP-17 transfer and returns a new
|
||||
// NEP-11 structure.
|
||||
func nep17TransferToNEP11(t17 *result.NEP17Transfer, id string) result.NEP11Transfer {
|
||||
return result.NEP11Transfer{
|
||||
Timestamp: t17.Timestamp,
|
||||
Asset: t17.Asset,
|
||||
Address: t17.Address,
|
||||
ID: id,
|
||||
Amount: t17.Amount,
|
||||
Index: t17.Index,
|
||||
NotifyIndex: t17.NotifyIndex,
|
||||
TxHash: t17.TxHash,
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue