2020-01-13 10:21:44 +00:00
|
|
|
package result
|
2018-11-26 21:12:33 +00:00
|
|
|
|
|
|
|
import (
|
2020-03-03 14:21:42 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/core/state"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/encoding/address"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/util"
|
2018-11-26 21:12:33 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// AssetState wrapper used for the representation of
|
2019-11-28 16:06:09 +00:00
|
|
|
// state.Asset on the RPC Server.
|
2018-11-26 21:12:33 +00:00
|
|
|
type AssetState struct {
|
2020-03-23 14:39:43 +00:00
|
|
|
ID util.Uint256 `json:"id"`
|
|
|
|
AssetType transaction.AssetType `json:"type"`
|
2018-11-26 21:12:33 +00:00
|
|
|
Name string `json:"name"`
|
|
|
|
Amount util.Fixed8 `json:"amount"`
|
|
|
|
Available util.Fixed8 `json:"available"`
|
|
|
|
Precision uint8 `json:"precision"`
|
|
|
|
Owner string `json:"owner"`
|
|
|
|
Admin string `json:"admin"`
|
|
|
|
Issuer string `json:"issuer"`
|
|
|
|
Expiration uint32 `json:"expiration"`
|
|
|
|
IsFrozen bool `json:"is_frozen"`
|
|
|
|
}
|
|
|
|
|
2019-11-28 16:06:09 +00:00
|
|
|
// NewAssetState creates a new Asset wrapper.
|
|
|
|
func NewAssetState(a *state.Asset) AssetState {
|
2018-11-26 21:12:33 +00:00
|
|
|
return AssetState{
|
|
|
|
ID: a.ID,
|
|
|
|
AssetType: a.AssetType,
|
|
|
|
Name: a.GetName(),
|
|
|
|
Amount: a.Amount,
|
|
|
|
Available: a.Available,
|
|
|
|
Precision: a.Precision,
|
|
|
|
Owner: a.Owner.String(),
|
2019-12-25 14:34:18 +00:00
|
|
|
Admin: address.Uint160ToString(a.Admin),
|
|
|
|
Issuer: address.Uint160ToString(a.Issuer),
|
2018-11-26 21:12:33 +00:00
|
|
|
Expiration: a.Expiration,
|
|
|
|
IsFrozen: a.IsFrozen,
|
|
|
|
}
|
|
|
|
}
|