github.com/nspcc-dev/neo-go@v0.105.2-0.20240517133400-6be757af3eba/pkg/neorpc/result/tokens.go (about)

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