rpc: make (*Client).SendRawTransaction public
This commit is contained in:
parent
44792ed5f7
commit
9d5841df38
1 changed files with 4 additions and 4 deletions
|
@ -108,11 +108,11 @@ func (c *Client) Invoke(script string, params []smartcontract.Parameter) (*respo
|
||||||
// return resp, nil
|
// return resp, nil
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// sendRawTransaction broadcasts a transaction over the NEO network.
|
// SendRawTransaction broadcasts a transaction over the NEO network.
|
||||||
// The given hex string needs to be signed with a keypair.
|
// The given hex string needs to be signed with a keypair.
|
||||||
// When the result of the response object is true, the TX has successfully
|
// When the result of the response object is true, the TX has successfully
|
||||||
// been broadcasted to the network.
|
// been broadcasted to the network.
|
||||||
func (c *Client) sendRawTransaction(rawTX *transaction.Transaction) error {
|
func (c *Client) SendRawTransaction(rawTX *transaction.Transaction) error {
|
||||||
var (
|
var (
|
||||||
params = request.NewRawParams(hex.EncodeToString(rawTX.Bytes()))
|
params = request.NewRawParams(hex.EncodeToString(rawTX.Bytes()))
|
||||||
resp bool
|
resp bool
|
||||||
|
@ -146,7 +146,7 @@ func (c *Client) TransferAsset(asset util.Uint256, address string, amount util.F
|
||||||
if rawTx, err = request.CreateRawContractTransaction(txParams); err != nil {
|
if rawTx, err = request.CreateRawContractTransaction(txParams); err != nil {
|
||||||
return resp, errors.Wrap(err, "failed to create raw transaction")
|
return resp, errors.Wrap(err, "failed to create raw transaction")
|
||||||
}
|
}
|
||||||
if err = c.sendRawTransaction(rawTx); err != nil {
|
if err = c.SendRawTransaction(rawTx); err != nil {
|
||||||
return resp, errors.Wrap(err, "failed to send raw transaction")
|
return resp, errors.Wrap(err, "failed to send raw transaction")
|
||||||
}
|
}
|
||||||
return rawTx.Hash(), nil
|
return rawTx.Hash(), nil
|
||||||
|
@ -173,7 +173,7 @@ func (c *Client) SignAndPushInvocationTx(script []byte, wif *keys.WIF, gas util.
|
||||||
return txHash, errors.Wrap(err, "failed to sign tx")
|
return txHash, errors.Wrap(err, "failed to sign tx")
|
||||||
}
|
}
|
||||||
txHash = tx.Hash()
|
txHash = tx.Hash()
|
||||||
err = c.sendRawTransaction(tx)
|
err = c.SendRawTransaction(tx)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return txHash, errors.Wrap(err, "failed sendning tx")
|
return txHash, errors.Wrap(err, "failed sendning tx")
|
||||||
|
|
Loading…
Reference in a new issue