rpc: drop UTXO transfer support, remove Balancer

Nothing uses them now and they're irrelevant for Neo 3.
This commit is contained in:
Roman Khimov 2020-06-01 21:57:34 +03:00
parent e358c70ecc
commit 337e65b696
4 changed files with 0 additions and 167 deletions

View file

@ -46,13 +46,6 @@ type Client struct {
// All values are optional. If any duration is not specified
// a default of 4 seconds will be used.
type Options struct {
// Balancer is an implementation of request.BalanceGetter interface,
// if not set then the default Client's implementation will be used, but
// it relies on server support for `getunspents` RPC call which is
// standard for neo-go, but only implemented as a plugin for C# node. So
// you can override it here to use NeoScanServer for example.
Balancer request.BalanceGetter
// Cert is a client-side certificate, it doesn't work at the moment along
// with the other two options below.
Cert string
@ -108,9 +101,6 @@ func New(ctx context.Context, endpoint string, opts Options) (*Client, error) {
wifMu: new(sync.Mutex),
endpoint: url,
}
if opts.Balancer == nil {
opts.Balancer = cl
}
cl.opts = opts
cl.requestF = cl.makeHTTPRequest
return cl, nil
@ -141,27 +131,6 @@ func (c *Client) SetWIF(wif string) error {
return nil
}
// CalculateInputs implements request.BalanceGetter interface and returns inputs
// array for the specified amount of given asset belonging to specified address.
// This implementation uses GetUnspents JSON-RPC call internally, so make sure
// your RPC server supports that.
func (c *Client) CalculateInputs(address string, asset util.Uint256, cost util.Fixed8) ([]transaction.Input, util.Fixed8, error) {
var utxos state.UnspentBalances
resp, err := c.GetUnspents(address)
if err != nil {
return nil, util.Fixed8(0), errors.Wrapf(err, "cannot get balance for address %v", address)
}
for _, ubi := range resp.Balance {
if asset.Equals(ubi.AssetHash) {
utxos = ubi.Unspents
break
}
}
return unspentsToInputs(utxos, cost)
}
func (c *Client) performRequest(method string, p request.RawParams, v interface{}) error {
var r = request.Raw{
JSONRPC: request.JSONRPCVersion,