From 8d410a6659576b2215770e83c9d2861fafadf3f6 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 13 Feb 2020 19:06:54 +0300 Subject: [PATCH] Add JSON tags for RPC response types - Attribute should have 2 fields (usage, data) - VOut should have 4 (5) fields (asset, value, address, n) - Script should have 2 fields (invocation, verification) --- pkg/core/transaction/attribute.go | 4 ++-- pkg/core/transaction/output.go | 8 ++++---- pkg/core/transaction/witness.go | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/core/transaction/attribute.go b/pkg/core/transaction/attribute.go index c0682bc22..e0923617e 100644 --- a/pkg/core/transaction/attribute.go +++ b/pkg/core/transaction/attribute.go @@ -10,8 +10,8 @@ import ( // Attribute represents a Transaction attribute. type Attribute struct { - Usage AttrUsage - Data []byte + Usage AttrUsage `json:"usage"` + Data []byte `json:"data"` } // DecodeBinary implements Serializable interface. diff --git a/pkg/core/transaction/output.go b/pkg/core/transaction/output.go index e8cf91ea2..ec9460923 100644 --- a/pkg/core/transaction/output.go +++ b/pkg/core/transaction/output.go @@ -11,17 +11,17 @@ import ( // Output represents a Transaction output. type Output struct { // The NEO asset id used in the transaction. - AssetID util.Uint256 + AssetID util.Uint256 `json:"asset"` // Amount of AssetType send or received. - Amount util.Fixed8 + Amount util.Fixed8 `json:"value"` // The address of the recipient. - ScriptHash util.Uint160 + ScriptHash util.Uint160 `json:"address"` // The position of the Output in slice []Output. This is actually set in NewTransactionOutputRaw // and used for displaying purposes. - Position int + Position int `json:"n"` } // NewOutput returns a new transaction output. diff --git a/pkg/core/transaction/witness.go b/pkg/core/transaction/witness.go index 6292ca981..762838930 100644 --- a/pkg/core/transaction/witness.go +++ b/pkg/core/transaction/witness.go @@ -11,8 +11,8 @@ import ( // Witness contains 2 scripts. type Witness struct { - InvocationScript []byte - VerificationScript []byte + InvocationScript []byte `json:"invocation"` + VerificationScript []byte `json:"verification"` } // DecodeBinary implements Serializable interface.