-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
En 7316 add call value sc query #2223
Conversation
facade/interface.go
Outdated
@@ -69,6 +69,7 @@ type NodeHandler interface { | |||
// ApiResolver defines a structure capable of resolving REST API requests | |||
type ApiResolver interface { | |||
ExecuteSCQuery(query *process.SCQuery) (*vmcommon.VMOutput, error) | |||
ExecuteQueryWithCallerAndValue(query *process.SCQuery, callerAddr []byte, callValue *big.Int) (*vmcommon.VMOutput, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change the SCQuery data - add callerAddr and callValue inside - no need to change the interface and add these values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -42,26 +44,57 @@ func NewSCQueryService( | |||
|
|||
// ExecuteQuery returns the VMOutput resulted upon running the function on the smart contract | |||
func (service *SCQueryService) ExecuteQuery(query *process.SCQuery) (*vmcommon.VMOutput, error) { | |||
if query.ScAddress == nil { | |||
return nil, process.ErrNilScAddress | |||
err := checkQueryFields(query) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for second function. Use ExecuteQuery and fill the value and callerAddress as they were before if those are empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
System tests passed.
Added two optional parameters to API endpoint
vm-values
(caller
andvalue
) and extended the functionality in order to be able to include the thecallerAddr
andcallValue
inside the SC query service.Testing steps:
/vm-values/int
for example in which you will specify the caller address and the call value. Can be astake
transaction.