[#787] morph: Return VUB from Invoke
method
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
5466e88444
commit
518f3baf41
25 changed files with 69 additions and 48 deletions
|
@ -174,8 +174,9 @@ func wrapFrostFSError(err error) error {
|
|||
}
|
||||
|
||||
// Invoke invokes contract method by sending transaction into blockchain.
|
||||
// Returns valid until block value.
|
||||
// Supported args types: int64, string, util.Uint160, []byte and bool.
|
||||
func (c *Client) Invoke(contract util.Uint160, fee fixedn.Fixed8, method string, args ...any) error {
|
||||
func (c *Client) Invoke(contract util.Uint160, fee fixedn.Fixed8, method string, args ...any) (uint32, error) {
|
||||
start := time.Now()
|
||||
success := false
|
||||
defer func() {
|
||||
|
@ -186,12 +187,12 @@ func (c *Client) Invoke(contract util.Uint160, fee fixedn.Fixed8, method string,
|
|||
defer c.switchLock.RUnlock()
|
||||
|
||||
if c.inactive {
|
||||
return ErrConnectionLost
|
||||
return 0, ErrConnectionLost
|
||||
}
|
||||
|
||||
txHash, vub, err := c.rpcActor.SendTunedCall(contract, method, nil, addFeeCheckerModifier(int64(fee)), args...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not invoke %s: %w", method, err)
|
||||
return 0, fmt.Errorf("could not invoke %s: %w", method, err)
|
||||
}
|
||||
|
||||
c.logger.Debug(logs.ClientNeoClientInvoke,
|
||||
|
@ -200,7 +201,7 @@ func (c *Client) Invoke(contract util.Uint160, fee fixedn.Fixed8, method string,
|
|||
zap.Stringer("tx_hash", txHash.Reverse()))
|
||||
|
||||
success = true
|
||||
return nil
|
||||
return vub, nil
|
||||
}
|
||||
|
||||
// TestInvokeIterator invokes contract method returning an iterator and executes cb on each element.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue