Skip to content
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

feat(gnokey): Print out the transaction hash when maketx executes successfully #2309

Merged
merged 59 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from 57 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
ed91236
return hash of transaction when maketx executes successfully
linhpn99 Jun 8, 2024
56e7654
Merge branch 'master' into return-txhash
linhpn99 Jun 8, 2024
284f3d8
wrong changes
linhpn99 Jun 8, 2024
bae8ed1
Merge branch 'return-txhash' of https://github.com/linhpn99/gno into …
linhpn99 Jun 8, 2024
2f592e1
redundant lines
linhpn99 Jun 8, 2024
8f9383e
new line
linhpn99 Jun 8, 2024
7f73b2e
update txtar files
linhpn99 Jun 8, 2024
f2a03e0
Merge branch 'master' into return-txhash
linhpn99 Jun 10, 2024
e7a33f7
Merge branch 'master' into return-txhash
linhpn99 Jun 11, 2024
03ebe9b
Merge branch 'master' into return-txhash
linhpn99 Jun 11, 2024
889cd13
Merge branch 'master' into return-txhash
linhpn99 Jun 12, 2024
c1eb1fe
use base64 instead of hex
linhpn99 Jun 12, 2024
10ced29
Merge branch 'master' into return-txhash
linhpn99 Jun 13, 2024
e174e54
Merge branch 'master' into return-txhash
linhpn99 Jun 13, 2024
3b01832
Merge branch 'master' into return-txhash
linhpn99 Jun 13, 2024
539e678
Merge branch 'master' into return-txhash
linhpn99 Jun 14, 2024
2da8cf9
Merge branch 'master' into return-txhash
linhpn99 Jun 14, 2024
977faaf
Merge branch 'master' into return-txhash
linhpn99 Jun 17, 2024
5e7b5fc
Merge branch 'master' into return-txhash
linhpn99 Jun 19, 2024
c24d863
Merge branch 'master' into return-txhash
linhpn99 Jun 19, 2024
ef9873d
Merge branch 'master' into return-txhash
linhpn99 Jun 19, 2024
8367ae8
Merge branch 'master' into return-txhash
linhpn99 Jun 21, 2024
005f386
Merge branch 'master' into return-txhash
linhpn99 Jun 22, 2024
e1f8f12
Merge branch 'master' into return-txhash
linhpn99 Jun 25, 2024
46b2a08
tmp
linhpn99 Jun 26, 2024
2dae425
tmp
linhpn99 Jun 26, 2024
169ae83
Update event.txtar
linhpn99 Jun 26, 2024
18c3768
Update event.txtar
linhpn99 Jun 26, 2024
2fcfd98
Update event_callback.txtar
linhpn99 Jun 26, 2024
b4b1b25
Update event_defer_callback_loop.txtar
linhpn99 Jun 26, 2024
79b4992
Update event_for_statement.txtar
linhpn99 Jun 26, 2024
3cd575e
Merge branch 'master' into return-txhash
linhpn99 Jun 27, 2024
2e4c70b
Merge branch 'master' into return-txhash
linhpn99 Jun 27, 2024
4d053ac
Merge branch 'master' into return-txhash
linhpn99 Jun 29, 2024
a67f3da
merge master
linhpn99 Jul 3, 2024
ae93513
Merge branch 'master' into return-txhash
linhpn99 Jul 3, 2024
cd5fd9c
Merge branch 'master' into return-txhash
linhpn99 Jul 4, 2024
4fb3d98
Merge branch 'master' into return-txhash
linhpn99 Jul 4, 2024
52b06ea
Merge branch 'master' into return-txhash
linhpn99 Jul 5, 2024
6a8c8d1
Merge branch 'master' into return-txhash
linhpn99 Jul 5, 2024
1e89ad3
Merge branch 'master' into return-txhash
linhpn99 Jul 5, 2024
df11597
Merge branch 'master' into return-txhash
linhpn99 Jul 6, 2024
a61afa3
Merge branch 'master' into return-txhash
linhpn99 Jul 6, 2024
69059fb
Cast base64 format can used in URL
linhpn99 Jul 7, 2024
5cd0e24
another one
linhpn99 Jul 7, 2024
4c9b181
Merge branch 'master' into return-txhash
linhpn99 Jul 7, 2024
1b6d51a
Merge branch 'master' into return-txhash
linhpn99 Jul 8, 2024
9fa1daa
Merge branch 'master' into return-txhash
linhpn99 Jul 8, 2024
4f2956f
Merge branch 'master' into return-txhash
linhpn99 Jul 8, 2024
b870a07
Merge branch 'master' into return-txhash
linhpn99 Jul 9, 2024
b3455fe
use URLEncoding instead
linhpn99 Jul 9, 2024
81b0e6a
Merge branch 'master' into return-txhash
linhpn99 Jul 9, 2024
4f55af5
Merge branch 'master' into return-txhash
linhpn99 Jul 9, 2024
6d4f3d9
Merge branch 'master' into return-txhash
linhpn99 Jul 14, 2024
6c01a8d
Update broadcast.go
linhpn99 Jul 15, 2024
f1ca06a
Update maketx.go
linhpn99 Jul 15, 2024
f78b03b
Merge branch 'master' into return-txhash
linhpn99 Jul 20, 2024
9c3a0f6
print txhash when deliver error
linhpn99 Jul 22, 2024
79d5f22
fixup
linhpn99 Jul 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gno.land/cmd/gnoland/testdata/addpkg.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ stdout 'GAS WANTED: 2000000'
stdout 'GAS USED: \d+'
stdout 'HEIGHT: \d+'
stdout 'EVENTS: \[\]'
stdout 'TX HASH: '

-- hello.gno --
package hello
Expand Down
2 changes: 1 addition & 1 deletion gno.land/cmd/gnoland/testdata/event_callback.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ stdout 'GAS WANTED: 2000000'
stdout 'GAS USED: [0-9]+'
stdout 'HEIGHT: [0-9]+'
stdout 'EVENTS: \[{\"type\":\"foo\",\"attrs\":\[{\"key\":\"k1\",\"value\":\"v1\"},{\"key\":\"k2\",\"value\":\"v2\"}],\"pkg_path\":\"gno.land\/r\/demo\/cbee\",\"func\":\"subFoo\"},{\"type\":\"bar\",\"attrs\":\[{\"key\":\"bar\",\"value\":\"baz\"}],\"pkg_path\":\"gno.land\/r\/demo\/cbee\",\"func\":\"subBar\"}]'

stdout 'TX HASH: '

-- cbee.gno --
package cbee
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ stdout 'GAS WANTED: 2000000'
stdout 'GAS USED: [0-9]+'
stdout 'HEIGHT: [0-9]+'
stdout 'EVENTS: \[{\"type\":\"ForLoopEvent\",\"attrs\":\[{\"key\":\"iteration\",\"value\":\"0\"},{\"key\":\"key\",\"value\":\"value\"}\],\"pkg_path\":\"gno.land\/r\/demo\/edcl\",\"func\":\"\"},{\"type\":\"ForLoopEvent\",\"attrs\":\[{\"key\":\"iteration\",\"value\":\"1\"},{\"key\":\"key\",\"value\":\"value\"}\],\"pkg_path\":\"gno.land\/r\/demo\/edcl\",\"func\":\"\"},{\"type\":\"ForLoopEvent\",\"attrs\":\[{\"key\":\"iteration\",\"value\":\"2\"},{\"key\":\"key\",\"value\":\"value\"}\],\"pkg_path\":\"gno.land\/r\/demo\/edcl\",\"func\":\"\"},{\"type\":\"ForLoopCompletionEvent\",\"attrs\":\[{\"key\":\"count\",\"value\":\"3\"}\],\"pkg_path\":\"gno.land\/r\/demo\/edcl\",\"func\":\"forLoopEmitExample\"},{\"type\":\"CallbackEvent\",\"attrs\":\[{\"key\":\"key1\",\"value\":\"value1\"},{\"key\":\"key2\",\"value\":\"value2\"}\],\"pkg_path\":\"gno.land\/r\/demo\/edcl\",\"func\":\"\"},{\"type\":\"CallbackCompletionEvent\",\"attrs\":\[{\"key\":\"key\",\"value\":\"value\"}\],\"pkg_path\":\"gno.land\/r\/demo\/edcl\",\"func\":\"callbackEmitExample\"},{\"type\":\"DeferEvent\",\"attrs\":\[{\"key\":\"key1\",\"value\":\"value1\"},{\"key\":\"key2\",\"value\":\"value2\"}\],\"pkg_path\":\"gno.land\/r\/demo\/edcl\",\"func\":\"deferEmitExample\"}\]'
stdout 'TX HASH: '

-- edcl.gno --

Expand Down
3 changes: 2 additions & 1 deletion gno.land/cmd/gnoland/testdata/event_for_statement.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ stdout 'GAS WANTED: 2000000'
stdout 'GAS USED: [0-9]+'
stdout 'HEIGHT: [0-9]+'
stdout 'EVENTS: \[{\"type\":\"testing\",\"attrs\":\[{\"key\":\"foo\",\"value\":\"bar\"}\],\"pkg_path\":\"gno.land\/r\/demo\/foree\",\"func\":\"Foo\"},{\"type\":\"testing\",\"attrs\":\[{\"key\":\"foo\",\"value\":\"bar\"}\],\"pkg_path\":\"gno.land\/r\/demo\/foree\",\"func\":\"Foo\"},{\"type\":\"testing\",\"attrs\":\[{\"key\":\"foo\",\"value\":\"bar\"}\],\"pkg_path\":\"gno.land\/r\/demo\/foree\",\"func\":\"Foo\"},{\"type\":\"testing\",\"attrs\":\[{\"key\":\"foo\",\"value\":\"bar\"}\],\"pkg_path\":\"gno.land\/r\/demo\/foree\",\"func\":\"Foo\"},{\"type\":\"testing\",\"attrs\":\[{\"key\":\"foo\",\"value\":\"bar\"}\],\"pkg_path\":\"gno.land\/r\/demo\/foree\",\"func\":\"Foo\"},{\"type\":\"testing\",\"attrs\":\[{\"key\":\"foo\",\"value\":\"bar\"}\],\"pkg_path\":\"gno.land\/r\/demo\/foree\",\"func\":\"Foo\"},{\"type\":\"testing\",\"attrs\":\[{\"key\":\"foo\",\"value\":\"bar\"}\],\"pkg_path\":\"gno.land\/r\/demo\/foree\",\"func\":\"Foo\"},{\"type\":\"testing\",\"attrs\":\[{\"key\":\"foo\",\"value\":\"bar\"}\],\"pkg_path\":\"gno.land\/r\/demo\/foree\",\"func\":\"Foo\"},{\"type\":\"testing\",\"attrs\":\[{\"key\":\"foo\",\"value\":\"bar\"}\],\"pkg_path\":\"gno.land\/r\/demo\/foree\",\"func\":\"Foo\"},{\"type\":\"testing\",\"attrs\":\[{\"key\":\"foo\",\"value\":\"bar\"}\],\"pkg_path\":\"gno.land\/r\/demo\/foree\",\"func\":\"Foo\"}\]'
stdout 'TX HASH: '

gnokey maketx call -pkgpath gno.land/r/demo/foree -func Bar -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1
stdout OK!
stdout 'GAS WANTED: 2000000'
stdout 'GAS USED: [0-9]+'
stdout 'HEIGHT: [0-9]+'
stdout 'EVENTS: \[{\"type\":\"Foo\",\"attrs\":\[{\"key\":\"k1\",\"value\":\"v1\"},{\"key\":\"k2\",\"value\":\"v2\"}\],\"pkg_path\":\"gno.land\/r\/demo\/foree\",\"func\":\"subFoo\"},{\"type\":\"Bar\",\"attrs\":\[{\"key\":\"bar\",\"value\":\"baz\"}\],\"pkg_path\":\"gno.land\/r\/demo\/foree\",\"func\":\"subBar\"},{\"type\":\"Foo\",\"attrs\":\[{\"key\":\"k1\",\"value\":\"v1\"},{\"key\":\"k2\",\"value\":\"v2\"}\],\"pkg_path\":\"gno.land\/r\/demo\/foree\",\"func\":\"subFoo\"},{\"type\":\"Bar\",\"attrs\":\[{\"key\":\"bar\",\"value\":\"baz\"}\],\"pkg_path\":\"gno.land\/r\/demo\/foree\",\"func\":\"subBar\"}\]'

stdout 'TX HASH: '

-- foree.gno --

Expand Down
2 changes: 2 additions & 0 deletions gno.land/cmd/gnoland/testdata/event_normal.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ stdout 'GAS WANTED: 2000000'
stdout 'GAS USED: \d+'
stdout 'HEIGHT: \d+'
stdout 'EVENTS: \[{\"type\":\"foo\",\"attrs\":\[{\"key\":\"key1\",\"value\":\"value1\"},{\"key\":\"key2\",\"value\":\"value2\"},{\"key\":\"key3\",\"value\":\"value3\"}\],\"pkg_path\":\"gno.land\/r\/demo\/ee\",\"func\":\"SubFoo\"},{\"type\":\"bar\",\"attrs\":\[{\"key\":\"bar\",\"value\":\"baz\"}\],\"pkg_path\":\"gno.land\/r\/demo\/ee\",\"func\":\"SubBar\"}\]'
stdout 'TX HASH: '

gnokey maketx call -pkgpath gno.land/r/demo/ee -func Bar -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1
stdout OK!
stdout 'GAS WANTED: 2000000'
stdout 'GAS USED: \d+'
stdout 'HEIGHT: \d+'
stdout 'EVENTS: \[{\"type\":\"bar\",\"attrs\":\[{\"key\":\"foo\",\"value\":\"bar\"}\],\"pkg_path\":\"gno.land/r/demo/ee\",\"func\":\"Bar\"}\]'
stdout 'TX HASH: '

-- ee.gno --
package ee
Expand Down
1 change: 1 addition & 0 deletions gno.land/cmd/gnoland/testdata/run.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ stdout 'main: --- hello from foo ---'
stdout 'OK!'
stdout 'GAS WANTED: 200000'
stdout 'GAS USED: '
stdout 'TX HASH: '

-- bar/bar.gno --
package bar
Expand Down
1 change: 1 addition & 0 deletions gno.land/pkg/integration/testdata/adduser.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ stdout 'main: --- hello from foo ---'
stdout 'OK!'
stdout 'GAS WANTED: 200000'
stdout 'GAS USED: '
stdout 'TX HASH: '

# should fail if user is added after node is started
! adduser test5
Expand Down
1 change: 1 addition & 0 deletions gno.land/pkg/integration/testdata/loadpkg_work.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ stdout 'main: --- hello from foo ---'
stdout 'OK!'
stdout 'GAS WANTED: 200000'
stdout 'GAS USED: '
stdout 'TX HASH: '

-- bar/bar.gno --
package bar
Expand Down
2 changes: 2 additions & 0 deletions tm2/pkg/crypto/keys/client/broadcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import (
"context"
"encoding/base64"
"flag"
"os"

Expand Down Expand Up @@ -87,6 +88,7 @@
io.Println("GAS USED: ", res.DeliverTx.GasUsed)
io.Println("HEIGHT: ", res.Height)
io.Println("EVENTS: ", string(res.DeliverTx.EncodeEvents()))
io.Println("TX HASH: ", base64.StdEncoding.EncodeToString(res.Hash))

Check warning on line 91 in tm2/pkg/crypto/keys/client/broadcast.go

View check run for this annotation

Codecov / codecov/patch

tm2/pkg/crypto/keys/client/broadcast.go#L91

Added line #L91 was not covered by tests
zivkovicmilos marked this conversation as resolved.
Show resolved Hide resolved
}
return nil
}
Expand Down
2 changes: 2 additions & 0 deletions tm2/pkg/crypto/keys/client/maketx.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package client

import (
"encoding/base64"
"flag"
"fmt"

Expand Down Expand Up @@ -219,6 +220,7 @@
io.Println("GAS USED: ", bres.DeliverTx.GasUsed)
io.Println("HEIGHT: ", bres.Height)
io.Println("EVENTS: ", string(bres.DeliverTx.EncodeEvents()))
io.Println("TX HASH: ", base64.StdEncoding.EncodeToString(bres.Hash))

Check warning on line 223 in tm2/pkg/crypto/keys/client/maketx.go

View check run for this annotation

Codecov / codecov/patch

tm2/pkg/crypto/keys/client/maketx.go#L223

Added line #L223 was not covered by tests
zivkovicmilos marked this conversation as resolved.
Show resolved Hide resolved

return nil
}
Loading