From 63751a6e6bf037912946d716b970a667ce5bf93d Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 17 Feb 2020 14:40:40 +0300 Subject: [PATCH] rpc: merge neoscan-related definitions into one file It will make refactoring easier. --- pkg/rpc/neoScanTypes.go | 33 ------------------- .../{neoScanBalanceGetter.go => neoscan.go} | 27 +++++++++++++++ 2 files changed, 27 insertions(+), 33 deletions(-) delete mode 100644 pkg/rpc/neoScanTypes.go rename pkg/rpc/{neoScanBalanceGetter.go => neoscan.go} (81%) diff --git a/pkg/rpc/neoScanTypes.go b/pkg/rpc/neoScanTypes.go deleted file mode 100644 index beb1f8fe1..000000000 --- a/pkg/rpc/neoScanTypes.go +++ /dev/null @@ -1,33 +0,0 @@ -package rpc - -import ( - "github.com/CityOfZion/neo-go/pkg/core/state" - "github.com/CityOfZion/neo-go/pkg/util" -) - -/* - Definition of types, helper functions and variables - required for calculation of transaction inputs using - NeoScan API. -*/ - -type ( - // NeoScanServer stores NEOSCAN URL and API path. - NeoScanServer struct { - URL string // "protocol://host:port/" - Path string // path to API endpoint without wallet address - } - - // Unspent stores Unspents per asset - Unspent struct { - Unspent state.UnspentBalances - Asset string // "NEO" / "GAS" - Amount util.Fixed8 // total unspent of this asset - } - - // NeoScanBalance is a struct of NeoScan response to 'get_balance' request - NeoScanBalance struct { - Balance []*Unspent - Address string - } -) diff --git a/pkg/rpc/neoScanBalanceGetter.go b/pkg/rpc/neoscan.go similarity index 81% rename from pkg/rpc/neoScanBalanceGetter.go rename to pkg/rpc/neoscan.go index 8d9ef5181..6fdda4442 100644 --- a/pkg/rpc/neoScanBalanceGetter.go +++ b/pkg/rpc/neoscan.go @@ -13,6 +13,33 @@ import ( errs "github.com/pkg/errors" ) +/* + Definition of types, helper functions and variables + required for calculation of transaction inputs using + NeoScan API. +*/ + +type ( + // NeoScanServer stores NEOSCAN URL and API path. + NeoScanServer struct { + URL string // "protocol://host:port/" + Path string // path to API endpoint without wallet address + } + + // Unspent stores Unspents per asset + Unspent struct { + Unspent state.UnspentBalances + Asset string // "NEO" / "GAS" + Amount util.Fixed8 // total unspent of this asset + } + + // NeoScanBalance is a struct of NeoScan response to 'get_balance' request + NeoScanBalance struct { + Balance []*Unspent + Address string + } +) + // GetBalance performs a request to get balance for the address specified. func (s NeoScanServer) GetBalance(address string) ([]*Unspent, error) { var (