|
|
@ -1,3 +1,5 @@ |
|
|
|
// File generated by github.com/ebuchman/rpc-gen
|
|
|
|
|
|
|
|
package rpc |
|
|
|
|
|
|
|
import ( |
|
|
@ -11,14 +13,14 @@ import ( |
|
|
|
) |
|
|
|
|
|
|
|
type Client interface { |
|
|
|
BlockchainInfo(minHeight uint) (*core.ResponseBlockchainInfo, error) |
|
|
|
BlockchainInfo(minHeight uint, maxHeight uint) (*core.ResponseBlockchainInfo, error) |
|
|
|
BroadcastTx(tx types.Tx) (*core.ResponseBroadcastTx, error) |
|
|
|
Call(address []byte) (*core.ResponseCall, error) |
|
|
|
Call(address []byte, data []byte) (*core.ResponseCall, error) |
|
|
|
DumpStorage(addr []byte) (*core.ResponseDumpStorage, error) |
|
|
|
GenPrivAccount() (*core.ResponseGenPrivAccount, error) |
|
|
|
GetAccount(address []byte) (*core.ResponseGetAccount, error) |
|
|
|
GetBlock(height uint) (*core.ResponseGetBlock, error) |
|
|
|
GetStorage(address []byte) (*core.ResponseGetStorage, error) |
|
|
|
GetStorage(address []byte, storage []byte) (*core.ResponseGetStorage, error) |
|
|
|
ListAccounts() (*core.ResponseListAccounts, error) |
|
|
|
ListValidators() (*core.ResponseListValidators, error) |
|
|
|
NetInfo() (*core.ResponseNetInfo, error) |
|
|
@ -26,12 +28,12 @@ type Client interface { |
|
|
|
Status() (*core.ResponseStatus, error) |
|
|
|
} |
|
|
|
|
|
|
|
func (c *ClientHTTP) BlockchainInfo(minHeight uint) (*core.ResponseBlockchainInfo, error) { |
|
|
|
values, err := argsToURLValues([]string{"minHeight"}, minHeight) |
|
|
|
func (c *ClientHTTP) BlockchainInfo(minHeight uint, maxHeight uint) (*core.ResponseBlockchainInfo, error) { |
|
|
|
values, err := argsToURLValues([]string{"minHeight", "maxHeight"}, minHeight, maxHeight) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
resp, err := http.PostForm(c.addr+"blockchain_info", values) |
|
|
|
resp, err := http.PostForm(c.addr+reverseFuncMap["BlockchainInfo"], values) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
@ -61,7 +63,7 @@ func (c *ClientHTTP) BroadcastTx(tx types.Tx) (*core.ResponseBroadcastTx, error) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
resp, err := http.PostForm(c.addr+"broadcast_tx", values) |
|
|
|
resp, err := http.PostForm(c.addr+reverseFuncMap["BroadcastTx"], values) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
@ -86,12 +88,12 @@ func (c *ClientHTTP) BroadcastTx(tx types.Tx) (*core.ResponseBroadcastTx, error) |
|
|
|
return response.Result, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (c *ClientHTTP) Call(address []byte) (*core.ResponseCall, error) { |
|
|
|
values, err := argsToURLValues([]string{"address"}, address) |
|
|
|
func (c *ClientHTTP) Call(address []byte, data []byte) (*core.ResponseCall, error) { |
|
|
|
values, err := argsToURLValues([]string{"address", "data"}, address, data) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
resp, err := http.PostForm(c.addr+"call", values) |
|
|
|
resp, err := http.PostForm(c.addr+reverseFuncMap["Call"], values) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
@ -121,7 +123,7 @@ func (c *ClientHTTP) DumpStorage(addr []byte) (*core.ResponseDumpStorage, error) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
resp, err := http.PostForm(c.addr+"dump_storage", values) |
|
|
|
resp, err := http.PostForm(c.addr+reverseFuncMap["DumpStorage"], values) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
@ -151,7 +153,7 @@ func (c *ClientHTTP) GenPrivAccount() (*core.ResponseGenPrivAccount, error) { |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
resp, err := http.PostForm(c.addr+"gen_priv_account", values) |
|
|
|
resp, err := http.PostForm(c.addr+reverseFuncMap["GenPrivAccount"], values) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
@ -181,7 +183,7 @@ func (c *ClientHTTP) GetAccount(address []byte) (*core.ResponseGetAccount, error |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
resp, err := http.PostForm(c.addr+"get_account", values) |
|
|
|
resp, err := http.PostForm(c.addr+reverseFuncMap["GetAccount"], values) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
@ -211,7 +213,7 @@ func (c *ClientHTTP) GetBlock(height uint) (*core.ResponseGetBlock, error) { |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
resp, err := http.PostForm(c.addr+"get_block", values) |
|
|
|
resp, err := http.PostForm(c.addr+reverseFuncMap["GetBlock"], values) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
@ -236,12 +238,12 @@ func (c *ClientHTTP) GetBlock(height uint) (*core.ResponseGetBlock, error) { |
|
|
|
return response.Result, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (c *ClientHTTP) GetStorage(address []byte) (*core.ResponseGetStorage, error) { |
|
|
|
values, err := argsToURLValues([]string{"address"}, address) |
|
|
|
func (c *ClientHTTP) GetStorage(address []byte, storage []byte) (*core.ResponseGetStorage, error) { |
|
|
|
values, err := argsToURLValues([]string{"address", "storage"}, address, storage) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
resp, err := http.PostForm(c.addr+"get_storage", values) |
|
|
|
resp, err := http.PostForm(c.addr+reverseFuncMap["GetStorage"], values) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
@ -271,7 +273,7 @@ func (c *ClientHTTP) ListAccounts() (*core.ResponseListAccounts, error) { |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
resp, err := http.PostForm(c.addr+"list_accounts", values) |
|
|
|
resp, err := http.PostForm(c.addr+reverseFuncMap["ListAccounts"], values) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
@ -301,7 +303,7 @@ func (c *ClientHTTP) ListValidators() (*core.ResponseListValidators, error) { |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
resp, err := http.PostForm(c.addr+"list_validators", values) |
|
|
|
resp, err := http.PostForm(c.addr+reverseFuncMap["ListValidators"], values) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
@ -331,7 +333,7 @@ func (c *ClientHTTP) NetInfo() (*core.ResponseNetInfo, error) { |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
resp, err := http.PostForm(c.addr+"net_info", values) |
|
|
|
resp, err := http.PostForm(c.addr+reverseFuncMap["NetInfo"], values) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
@ -361,7 +363,7 @@ func (c *ClientHTTP) SignTx(tx types.Tx, privAccounts []*account.PrivAccount) (* |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
resp, err := http.PostForm(c.addr+"sign_tx", values) |
|
|
|
resp, err := http.PostForm(c.addr+reverseFuncMap["SignTx"], values) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
@ -391,7 +393,7 @@ func (c *ClientHTTP) Status() (*core.ResponseStatus, error) { |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
resp, err := http.PostForm(c.addr+"status", values) |
|
|
|
resp, err := http.PostForm(c.addr+reverseFuncMap["Status"], values) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
@ -416,11 +418,11 @@ func (c *ClientHTTP) Status() (*core.ResponseStatus, error) { |
|
|
|
return response.Result, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (c *ClientJSON) BlockchainInfo(minHeight uint) (*core.ResponseBlockchainInfo, error) { |
|
|
|
func (c *ClientJSON) BlockchainInfo(minHeight uint, maxHeight uint) (*core.ResponseBlockchainInfo, error) { |
|
|
|
request := RPCRequest{ |
|
|
|
JSONRPC: "2.0", |
|
|
|
Method: "blockchain_info", |
|
|
|
Params: []interface{}{minHeight}, |
|
|
|
Method: reverseFuncMap["BlockchainInfo"], |
|
|
|
Params: []interface{}{minHeight, maxHeight}, |
|
|
|
Id: 0, |
|
|
|
} |
|
|
|
body, err := c.RequestResponse(request) |
|
|
@ -446,7 +448,7 @@ func (c *ClientJSON) BlockchainInfo(minHeight uint) (*core.ResponseBlockchainInf |
|
|
|
func (c *ClientJSON) BroadcastTx(tx types.Tx) (*core.ResponseBroadcastTx, error) { |
|
|
|
request := RPCRequest{ |
|
|
|
JSONRPC: "2.0", |
|
|
|
Method: "broadcast_tx", |
|
|
|
Method: reverseFuncMap["BroadcastTx"], |
|
|
|
Params: []interface{}{tx}, |
|
|
|
Id: 0, |
|
|
|
} |
|
|
@ -470,11 +472,11 @@ func (c *ClientJSON) BroadcastTx(tx types.Tx) (*core.ResponseBroadcastTx, error) |
|
|
|
return response.Result, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (c *ClientJSON) Call(address []byte) (*core.ResponseCall, error) { |
|
|
|
func (c *ClientJSON) Call(address []byte, data []byte) (*core.ResponseCall, error) { |
|
|
|
request := RPCRequest{ |
|
|
|
JSONRPC: "2.0", |
|
|
|
Method: "call", |
|
|
|
Params: []interface{}{address}, |
|
|
|
Method: reverseFuncMap["Call"], |
|
|
|
Params: []interface{}{address, data}, |
|
|
|
Id: 0, |
|
|
|
} |
|
|
|
body, err := c.RequestResponse(request) |
|
|
@ -500,7 +502,7 @@ func (c *ClientJSON) Call(address []byte) (*core.ResponseCall, error) { |
|
|
|
func (c *ClientJSON) DumpStorage(addr []byte) (*core.ResponseDumpStorage, error) { |
|
|
|
request := RPCRequest{ |
|
|
|
JSONRPC: "2.0", |
|
|
|
Method: "dump_storage", |
|
|
|
Method: reverseFuncMap["DumpStorage"], |
|
|
|
Params: []interface{}{addr}, |
|
|
|
Id: 0, |
|
|
|
} |
|
|
@ -527,7 +529,7 @@ func (c *ClientJSON) DumpStorage(addr []byte) (*core.ResponseDumpStorage, error) |
|
|
|
func (c *ClientJSON) GenPrivAccount() (*core.ResponseGenPrivAccount, error) { |
|
|
|
request := RPCRequest{ |
|
|
|
JSONRPC: "2.0", |
|
|
|
Method: "gen_priv_account", |
|
|
|
Method: reverseFuncMap["GenPrivAccount"], |
|
|
|
Params: []interface{}{nil}, |
|
|
|
Id: 0, |
|
|
|
} |
|
|
@ -554,7 +556,7 @@ func (c *ClientJSON) GenPrivAccount() (*core.ResponseGenPrivAccount, error) { |
|
|
|
func (c *ClientJSON) GetAccount(address []byte) (*core.ResponseGetAccount, error) { |
|
|
|
request := RPCRequest{ |
|
|
|
JSONRPC: "2.0", |
|
|
|
Method: "get_account", |
|
|
|
Method: reverseFuncMap["GetAccount"], |
|
|
|
Params: []interface{}{address}, |
|
|
|
Id: 0, |
|
|
|
} |
|
|
@ -581,7 +583,7 @@ func (c *ClientJSON) GetAccount(address []byte) (*core.ResponseGetAccount, error |
|
|
|
func (c *ClientJSON) GetBlock(height uint) (*core.ResponseGetBlock, error) { |
|
|
|
request := RPCRequest{ |
|
|
|
JSONRPC: "2.0", |
|
|
|
Method: "get_block", |
|
|
|
Method: reverseFuncMap["GetBlock"], |
|
|
|
Params: []interface{}{height}, |
|
|
|
Id: 0, |
|
|
|
} |
|
|
@ -605,11 +607,11 @@ func (c *ClientJSON) GetBlock(height uint) (*core.ResponseGetBlock, error) { |
|
|
|
return response.Result, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (c *ClientJSON) GetStorage(address []byte) (*core.ResponseGetStorage, error) { |
|
|
|
func (c *ClientJSON) GetStorage(address []byte, storage []byte) (*core.ResponseGetStorage, error) { |
|
|
|
request := RPCRequest{ |
|
|
|
JSONRPC: "2.0", |
|
|
|
Method: "get_storage", |
|
|
|
Params: []interface{}{address}, |
|
|
|
Method: reverseFuncMap["GetStorage"], |
|
|
|
Params: []interface{}{address, storage}, |
|
|
|
Id: 0, |
|
|
|
} |
|
|
|
body, err := c.RequestResponse(request) |
|
|
@ -635,7 +637,7 @@ func (c *ClientJSON) GetStorage(address []byte) (*core.ResponseGetStorage, error |
|
|
|
func (c *ClientJSON) ListAccounts() (*core.ResponseListAccounts, error) { |
|
|
|
request := RPCRequest{ |
|
|
|
JSONRPC: "2.0", |
|
|
|
Method: "list_accounts", |
|
|
|
Method: reverseFuncMap["ListAccounts"], |
|
|
|
Params: []interface{}{nil}, |
|
|
|
Id: 0, |
|
|
|
} |
|
|
@ -662,7 +664,7 @@ func (c *ClientJSON) ListAccounts() (*core.ResponseListAccounts, error) { |
|
|
|
func (c *ClientJSON) ListValidators() (*core.ResponseListValidators, error) { |
|
|
|
request := RPCRequest{ |
|
|
|
JSONRPC: "2.0", |
|
|
|
Method: "list_validators", |
|
|
|
Method: reverseFuncMap["ListValidators"], |
|
|
|
Params: []interface{}{nil}, |
|
|
|
Id: 0, |
|
|
|
} |
|
|
@ -689,7 +691,7 @@ func (c *ClientJSON) ListValidators() (*core.ResponseListValidators, error) { |
|
|
|
func (c *ClientJSON) NetInfo() (*core.ResponseNetInfo, error) { |
|
|
|
request := RPCRequest{ |
|
|
|
JSONRPC: "2.0", |
|
|
|
Method: "net_info", |
|
|
|
Method: reverseFuncMap["NetInfo"], |
|
|
|
Params: []interface{}{nil}, |
|
|
|
Id: 0, |
|
|
|
} |
|
|
@ -716,7 +718,7 @@ func (c *ClientJSON) NetInfo() (*core.ResponseNetInfo, error) { |
|
|
|
func (c *ClientJSON) SignTx(tx types.Tx, privAccounts []*account.PrivAccount) (*core.ResponseSignTx, error) { |
|
|
|
request := RPCRequest{ |
|
|
|
JSONRPC: "2.0", |
|
|
|
Method: "sign_tx", |
|
|
|
Method: reverseFuncMap["SignTx"], |
|
|
|
Params: []interface{}{tx, privAccounts}, |
|
|
|
Id: 0, |
|
|
|
} |
|
|
@ -743,7 +745,7 @@ func (c *ClientJSON) SignTx(tx types.Tx, privAccounts []*account.PrivAccount) (* |
|
|
|
func (c *ClientJSON) Status() (*core.ResponseStatus, error) { |
|
|
|
request := RPCRequest{ |
|
|
|
JSONRPC: "2.0", |
|
|
|
Method: "status", |
|
|
|
Method: reverseFuncMap["Status"], |
|
|
|
Params: []interface{}{nil}, |
|
|
|
Id: 0, |
|
|
|
} |
|
|
|