forked from TrueCloudLab/neoneo-go
rpc/client: drop (*Client).wif
It isn't used internally and has no value.
This commit is contained in:
parent
316666cc22
commit
16b10ab918
1 changed files with 0 additions and 30 deletions
|
@ -9,11 +9,9 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"sync"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neo-go/pkg/config/netmode"
|
"github.com/nspcc-dev/neo-go/pkg/config/netmode"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
|
||||||
"github.com/nspcc-dev/neo-go/pkg/rpc/request"
|
"github.com/nspcc-dev/neo-go/pkg/rpc/request"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/rpc/response"
|
"github.com/nspcc-dev/neo-go/pkg/rpc/response"
|
||||||
)
|
)
|
||||||
|
@ -34,8 +32,6 @@ type Client struct {
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
opts Options
|
opts Options
|
||||||
requestF func(*request.Raw) (*response.Raw, error)
|
requestF func(*request.Raw) (*response.Raw, error)
|
||||||
wifMu *sync.Mutex
|
|
||||||
wif *keys.WIF
|
|
||||||
cache cache
|
cache cache
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +92,6 @@ func New(ctx context.Context, endpoint string, opts Options) (*Client, error) {
|
||||||
cl := &Client{
|
cl := &Client{
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
cli: httpClient,
|
cli: httpClient,
|
||||||
wifMu: new(sync.Mutex),
|
|
||||||
endpoint: url,
|
endpoint: url,
|
||||||
}
|
}
|
||||||
cl.opts = opts
|
cl.opts = opts
|
||||||
|
@ -104,31 +99,6 @@ func New(ctx context.Context, endpoint string, opts Options) (*Client, error) {
|
||||||
return cl, nil
|
return cl, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// WIF returns WIF structure associated with the client.
|
|
||||||
func (c *Client) WIF() keys.WIF {
|
|
||||||
c.wifMu.Lock()
|
|
||||||
defer c.wifMu.Unlock()
|
|
||||||
return keys.WIF{
|
|
||||||
Version: c.wif.Version,
|
|
||||||
Compressed: c.wif.Compressed,
|
|
||||||
PrivateKey: c.wif.PrivateKey,
|
|
||||||
S: c.wif.S,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetWIF decodes given WIF and adds some wallet
|
|
||||||
// data to client. Useful for RPC calls that require an open wallet.
|
|
||||||
func (c *Client) SetWIF(wif string) error {
|
|
||||||
c.wifMu.Lock()
|
|
||||||
defer c.wifMu.Unlock()
|
|
||||||
decodedWif, err := keys.WIFDecode(wif, 0x00)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to decode WIF: %w", err)
|
|
||||||
}
|
|
||||||
c.wif = decodedWif
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) performRequest(method string, p request.RawParams, v interface{}) error {
|
func (c *Client) performRequest(method string, p request.RawParams, v interface{}) error {
|
||||||
var r = request.Raw{
|
var r = request.Raw{
|
||||||
JSONRPC: request.JSONRPCVersion,
|
JSONRPC: request.JSONRPCVersion,
|
||||||
|
|
Loading…
Reference in a new issue