diff --git a/pkg/rpc/neoScanBalanceGetter.go b/pkg/rpc/neoScanBalanceGetter.go index c0e95c595..432a24c0e 100644 --- a/pkg/rpc/neoScanBalanceGetter.go +++ b/pkg/rpc/neoScanBalanceGetter.go @@ -8,7 +8,7 @@ import ( "github.com/CityOfZion/neo-go/pkg/core/state" "github.com/CityOfZion/neo-go/pkg/core/transaction" - "github.com/CityOfZion/neo-go/pkg/rpc/wrappers" + "github.com/CityOfZion/neo-go/pkg/rpc/result" "github.com/CityOfZion/neo-go/pkg/util" errs "github.com/pkg/errors" ) @@ -57,7 +57,7 @@ func (s NeoScanServer) CalculateInputs(address string, assetIDUint util.Uint256, err error us []*Unspent assetUnspent Unspent - assetID = wrappers.GlobalAssets[assetIDUint.StringLE()] + assetID = result.GlobalAssets[assetIDUint.StringLE()] ) if us, err = s.GetBalance(address); err != nil { return nil, util.Fixed8(0), errs.Wrapf(err, "Cannot get balance for address %v", address) diff --git a/pkg/rpc/wrappers/account_state.go b/pkg/rpc/result/account_state.go similarity index 98% rename from pkg/rpc/wrappers/account_state.go rename to pkg/rpc/result/account_state.go index b56981e38..df1dad2b9 100644 --- a/pkg/rpc/wrappers/account_state.go +++ b/pkg/rpc/result/account_state.go @@ -1,4 +1,4 @@ -package wrappers +package result import ( "bytes" diff --git a/pkg/rpc/wrappers/asset_state.go b/pkg/rpc/result/asset_state.go similarity index 98% rename from pkg/rpc/wrappers/asset_state.go rename to pkg/rpc/result/asset_state.go index 5ee365a97..ffedbb6bb 100644 --- a/pkg/rpc/wrappers/asset_state.go +++ b/pkg/rpc/result/asset_state.go @@ -1,4 +1,4 @@ -package wrappers +package result import ( "github.com/CityOfZion/neo-go/pkg/core/state" diff --git a/pkg/rpc/wrappers/block.go b/pkg/rpc/result/block.go similarity index 99% rename from pkg/rpc/wrappers/block.go rename to pkg/rpc/result/block.go index a203437ff..aa8a20377 100644 --- a/pkg/rpc/wrappers/block.go +++ b/pkg/rpc/result/block.go @@ -1,4 +1,4 @@ -package wrappers +package result import ( "strconv" diff --git a/pkg/rpc/wrappers/contract_state.go b/pkg/rpc/result/contract_state.go similarity index 99% rename from pkg/rpc/wrappers/contract_state.go rename to pkg/rpc/result/contract_state.go index ca1b11716..08e8a277a 100644 --- a/pkg/rpc/wrappers/contract_state.go +++ b/pkg/rpc/result/contract_state.go @@ -1,4 +1,4 @@ -package wrappers +package result import ( "github.com/CityOfZion/neo-go/pkg/core/state" diff --git a/pkg/rpc/wrappers/tx_output.go b/pkg/rpc/result/tx_output.go similarity index 97% rename from pkg/rpc/wrappers/tx_output.go rename to pkg/rpc/result/tx_output.go index e624dff8e..19a6fc66b 100644 --- a/pkg/rpc/wrappers/tx_output.go +++ b/pkg/rpc/result/tx_output.go @@ -1,4 +1,4 @@ -package wrappers +package result import ( "github.com/CityOfZion/neo-go/pkg/core/transaction" diff --git a/pkg/rpc/wrappers/tx_raw_output.go b/pkg/rpc/result/tx_raw_output.go similarity index 98% rename from pkg/rpc/wrappers/tx_raw_output.go rename to pkg/rpc/result/tx_raw_output.go index cdc2723cb..f36b7ab97 100644 --- a/pkg/rpc/wrappers/tx_raw_output.go +++ b/pkg/rpc/result/tx_raw_output.go @@ -1,4 +1,4 @@ -package wrappers +package result import ( "github.com/CityOfZion/neo-go/pkg/core" diff --git a/pkg/rpc/wrappers/unspents.go b/pkg/rpc/result/unspents.go similarity index 98% rename from pkg/rpc/wrappers/unspents.go rename to pkg/rpc/result/unspents.go index 38c14b901..d903f8a30 100644 --- a/pkg/rpc/wrappers/unspents.go +++ b/pkg/rpc/result/unspents.go @@ -1,4 +1,4 @@ -package wrappers +package result import ( "github.com/CityOfZion/neo-go/pkg/core" diff --git a/pkg/rpc/server.go b/pkg/rpc/server.go index ae8b87a00..4a098a535 100644 --- a/pkg/rpc/server.go +++ b/pkg/rpc/server.go @@ -15,7 +15,6 @@ import ( "github.com/CityOfZion/neo-go/pkg/io" "github.com/CityOfZion/neo-go/pkg/network" "github.com/CityOfZion/neo-go/pkg/rpc/result" - "github.com/CityOfZion/neo-go/pkg/rpc/wrappers" "github.com/CityOfZion/neo-go/pkg/util" "github.com/pkg/errors" "go.uber.org/zap" @@ -153,7 +152,7 @@ Methods: } if len(reqParams) == 2 && reqParams[1].Value == 1 { - results = wrappers.NewBlock(block, s.chain) + results = result.NewBlock(block, s.chain) } else { writer := io.NewBufBinWriter() block.EncodeBinary(writer.BinWriter) @@ -228,7 +227,7 @@ Methods: as := s.chain.GetAssetState(paramAssetID) if as != nil { - results = wrappers.NewAssetState(as) + results = result.NewAssetState(as) } else { resultsErr = NewRPCError("Unknown asset", "", nil) } @@ -334,10 +333,10 @@ func (s *Server) getrawtransaction(reqParams Params) (interface{}, error) { if v == 0 || v == "0" || v == 0.0 || v == false || v == "false" { results = hex.EncodeToString(tx.Bytes()) } else { - results = wrappers.NewTransactionOutputRaw(tx, header, s.chain) + results = result.NewTransactionOutputRaw(tx, header, s.chain) } default: - results = wrappers.NewTransactionOutputRaw(tx, header, s.chain) + results = result.NewTransactionOutputRaw(tx, header, s.chain) } } else { results = hex.EncodeToString(tx.Bytes()) @@ -377,7 +376,7 @@ func (s *Server) getTxOut(ps Params) (interface{}, error) { } out := tx.Outputs[num] - return wrappers.NewTxOutput(&out), nil + return result.NewTxOutput(&out), nil } // getContractState returns contract state (contract information, according to the contract script hash). @@ -392,7 +391,7 @@ func (s *Server) getContractState(reqParams Params) (interface{}, error) { } else { cs := s.chain.GetContractState(scriptHash) if cs != nil { - results = wrappers.NewContractState(cs) + results = result.NewContractState(cs) } else { return nil, NewRPCError("Unknown contract", "", nil) } @@ -420,9 +419,9 @@ func (s *Server) getAccountState(reqParams Params, unspents bool) (interface{}, if err != nil { return nil, errInvalidParams } - results = wrappers.NewUnspents(as, s.chain, str) + results = result.NewUnspents(as, s.chain, str) } else { - results = wrappers.NewAccountState(as) + results = result.NewAccountState(as) } } return results, resultsErr diff --git a/pkg/rpc/server_helper_test.go b/pkg/rpc/server_helper_test.go index b3350c82f..ef4035efd 100644 --- a/pkg/rpc/server_helper_test.go +++ b/pkg/rpc/server_helper_test.go @@ -12,7 +12,6 @@ import ( "github.com/CityOfZion/neo-go/pkg/io" "github.com/CityOfZion/neo-go/pkg/network" "github.com/CityOfZion/neo-go/pkg/rpc/result" - "github.com/CityOfZion/neo-go/pkg/rpc/wrappers" "github.com/CityOfZion/neo-go/pkg/util" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" @@ -89,9 +88,9 @@ type StringResultResponse struct { // GetBlockResponse struct for testing. type GetBlockResponse struct { - Jsonrpc string `json:"jsonrpc"` - Result wrappers.Block `json:"result"` - ID int `json:"id"` + Jsonrpc string `json:"jsonrpc"` + Result result.Block `json:"result"` + ID int `json:"id"` } // GetAssetResponse struct for testing. diff --git a/pkg/rpc/types.go b/pkg/rpc/types.go index 50beee7d5..3284bf873 100644 --- a/pkg/rpc/types.go +++ b/pkg/rpc/types.go @@ -2,7 +2,7 @@ package rpc import ( "github.com/CityOfZion/neo-go/pkg/core/transaction" - "github.com/CityOfZion/neo-go/pkg/rpc/wrappers" + "github.com/CityOfZion/neo-go/pkg/rpc/result" "github.com/CityOfZion/neo-go/pkg/vm" ) @@ -31,8 +31,8 @@ type AccountStateResponse struct { // UnspentResponse represents server response to the `getunspents` command. type UnspentResponse struct { responseHeader - Error *Error `json:"error,omitempty"` - Result *wrappers.Unspents `json:"result,omitempty"` + Error *Error `json:"error,omitempty"` + Result *result.Unspents `json:"result,omitempty"` } // Account represents details about a NEO account. @@ -100,7 +100,7 @@ type GetRawTxResponse struct { type GetTxOutResponse struct { responseHeader Error *Error - Result *wrappers.TransactionOutput + Result *result.TransactionOutput } // RawTxResponse stores transaction with blockchain metadata to be sent as a response.