How to pass arguments for script through gRPC

I want to execute very basic script over latest block:
pub fun main(num: Int): Int {
return num * 2;
}

How should i properly pass parameter to gRPC method?
should arguments parameter be something like [ {type: β€œInt”, value: β€œ5”} ]? Should i encode it? If so, how exactly?

P.S.: I am not using Golang SDK, only Javascript & direct grpc calls.

Okay, I found solution by myself.
const arguments = [
Buffer.from(JSON.stringify({type: β€˜Int’, value: β€˜5’}))
]

Notice that β€œvalue” is always a string.

1 Like