Complex argument functions
Exposed realm functions and methods that take in complex arguments, such as slices, structs, pointers, etc,
cannot be called via a standard MsgCall
transaction. To call these functions, users need to use MsgRun
.
Check out the source code to see example functions and objects.
In this case, the following MsgRun
code would be used to call the function:
1package main
2
3// Import the realm you want to call
4import `gno.land/r/docs/complexargs`
5
6func main() {
7 // Create the complex arguments to pass:
8 slice := []int{1, 2, 3}
9 // Call the function
10 complexargs.SetSlice(slice)
11
12 // The same can be done with custom types:
13 obj := complexargs.CustomType{Name: `whatever`, Numbers: []int{1, 10, 100}}
14 complexargs.SetMyObject(obj)
15}
Value of int slice: 1, 2, 3
Value of myObject: CustomObject{Name: Alice, Numbers: 4,5,6}