Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gnoclient [already has `Call`](https://github.com/gnolang/gno/blob/7339bdcde85de886bf7069cc4adaf31e6d48f9cd/gno.land/pkg/gnoclient/client_txs.go#L25) which does the same operation as `gnokey maketx call`. This PR adds `Run` to do the same thing as `gnokey maketx run`. It closely follows the [implementation in gnokey](https://github.com/gnolang/gno/blob/7339bdcde85de886bf7069cc4adaf31e6d48f9cd/gno.land/pkg/keyscli/run.go#L111-L139). (When this PR is merged, in Gno Native Kit we will add the thin wrapper for Run, similar to the wrapper for Call. We need this so that a command-line app can run a test script on the blockchain to, for example, stress test by adding hundreds of messages to r/demo/boards in a single call. It would be too slow to make hundreds of separate calls.) To test, I called `Run` with the test script in [this gist](https://gist.github.com/moul/ccf1e2aff64e7a1f0c5ca5e2d98d7e9a). As expected, the result is: ``` # HELLO WORLD! ## users.Render("") * [test_1](/r/demo/users:test_1) ## for i < 10 {print "hey hey hey!"} 0. hey hey hey! 1. hey hey hey! 2. hey hey hey! 3. hey hey hey! 4. hey hey hey! 5. hey hey hey! 6. hey hey hey! 7. hey hey hey! 8. hey hey hey! 9. hey hey hey! ## tests.* & std.* - `tests.CurrentRealmPath` gno.land/r/demo/tests - `tests.IsOriginCall` false - `tests.GetPrevRealm` (struct{("g1a9r05e34s7dxe7wh8v00lnewnxtfnfq02gn5ws" std.Address),("gno.land/r/g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5/run" string)} std.Realm) - `std.GetOrigCaller` g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5 - `std.PrevRealm` (struct{("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5" std.Address),("" string)} std.Realm) ## stateful check - before: 0 - after: 10 ## bf source: ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------. result: Hello World ## complex types - before: foobar - after: foobar_modified ``` --------- Signed-off-by: Jeff Thompson <jeff@thefirst.org>
- Loading branch information