[#1496] morph: Return InvokeRes from all invoke*() methods

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-11-14 10:01:59 +03:00
parent 69c63006da
commit b65874d1c3
Signed by: fyrchik
SSH key fingerprint: SHA256:m/TTwCzjnRkXgnzEx9X92ccxy1CcVeinOgDb3NPWWmg
5 changed files with 25 additions and 27 deletions

View file

@ -129,7 +129,8 @@ func (i *InvokePrmOptional) SetVUB(v uint32) {
}
type InvokeRes struct {
VUB uint32
Hash util.Uint256
VUB uint32
}
// Invoke calls Invoke method of Client with static internal script hash and fee.
@ -142,8 +143,6 @@ type InvokeRes struct {
// If fee for the operation executed using specified method is customized, then StaticClient uses it.
// Otherwise, default fee is used.
func (s StaticClient) Invoke(ctx context.Context, prm InvokePrm) (InvokeRes, error) {
var res InvokeRes
var err error
var vubP *uint32
if s.tryNotary {
if s.alpha {
@ -170,26 +169,23 @@ func (s StaticClient) Invoke(ctx context.Context, prm InvokePrm) (InvokeRes, err
vubP = &prm.vub
}
res.VUB, err = s.client.NotaryInvoke(ctx, s.scScriptHash, s.fee, nonce, vubP, prm.method, prm.args...)
return res, err
return s.client.NotaryInvoke(ctx, s.scScriptHash, s.fee, nonce, vubP, prm.method, prm.args...)
}
if prm.vub > 0 {
vubP = &prm.vub
}
res.VUB, err = s.client.NotaryInvokeNotAlpha(ctx, s.scScriptHash, s.fee, vubP, prm.method, prm.args...)
return res, err
return s.client.NotaryInvokeNotAlpha(ctx, s.scScriptHash, s.fee, vubP, prm.method, prm.args...)
}
res.VUB, err = s.client.Invoke(
return s.client.Invoke(
ctx,
s.scScriptHash,
s.fee,
prm.method,
prm.args...,
)
return res, err
}
// TestInvokePrm groups parameters of the TestInvoke operation.