-
Notifications
You must be signed in to change notification settings - Fork 79
/
tokens.go
88 lines (77 loc) · 2.84 KB
/
tokens.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package result
import (
"github.com/nspcc-dev/neo-go/pkg/util"
)
// NEP11Balances is a result for the getnep11balances RPC call.
type NEP11Balances struct {
Balances []NEP11AssetBalance `json:"balance"`
Address string `json:"address"`
}
// NEP11Balance is a structure holding balance of a NEP-11 asset.
type NEP11AssetBalance struct {
Asset util.Uint160 `json:"assethash"`
Decimals int `json:"decimals,string"`
Name string `json:"name"`
Symbol string `json:"symbol"`
Tokens []NEP11TokenBalance `json:"tokens"`
}
// NEP11TokenBalance represents balance of a single NFT.
type NEP11TokenBalance struct {
ID string `json:"tokenid"`
Amount string `json:"amount"`
LastUpdated uint32 `json:"lastupdatedblock"`
}
// NEP17Balances is a result for the getnep17balances RPC call.
type NEP17Balances struct {
Balances []NEP17Balance `json:"balance"`
Address string `json:"address"`
}
// NEP17Balance represents balance for the single token contract.
type NEP17Balance struct {
Asset util.Uint160 `json:"assethash"`
Amount string `json:"amount"`
Decimals int `json:"decimals,string"`
LastUpdated uint32 `json:"lastupdatedblock"`
Name string `json:"name"`
Symbol string `json:"symbol"`
}
// NEP11Transfers is a result for the getnep11transfers RPC.
type NEP11Transfers struct {
Sent []NEP11Transfer `json:"sent"`
Received []NEP11Transfer `json:"received"`
Address string `json:"address"`
}
// NEP11Transfer represents single NEP-11 transfer event.
type NEP11Transfer struct {
Timestamp uint64 `json:"timestamp"`
Asset util.Uint160 `json:"assethash"`
Address string `json:"transferaddress,omitempty"`
ID string `json:"tokenid"`
Amount string `json:"amount"`
Index uint32 `json:"blockindex"`
NotifyIndex uint32 `json:"transfernotifyindex"`
TxHash util.Uint256 `json:"txhash"`
}
// NEP17Transfers is a result for the getnep17transfers RPC.
type NEP17Transfers struct {
Sent []NEP17Transfer `json:"sent"`
Received []NEP17Transfer `json:"received"`
Address string `json:"address"`
}
// NEP17Transfer represents single NEP17 transfer event.
type NEP17Transfer struct {
Timestamp uint64 `json:"timestamp"`
Asset util.Uint160 `json:"assethash"`
Address string `json:"transferaddress,omitempty"`
Amount string `json:"amount"`
Index uint32 `json:"blockindex"`
NotifyIndex uint32 `json:"transfernotifyindex"`
TxHash util.Uint256 `json:"txhash"`
}
// KnownNEP11Properties contains a list of well-known NEP-11 token property names.
var KnownNEP11Properties = map[string]bool{
"description": true,
"image": true,
"name": true,
"tokenURI": true,
}