-
Notifications
You must be signed in to change notification settings - Fork 388
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(txtar): create user from passed mnemonic, account and index (#1879)
<!-- please provide a detailed description of the changes made in this pull request. --> `adduser` in txtar creates user with bit of [randomness](https://github.com/gnolang/gno/blob/831bb6f92e1a2217242169dab1f4fd1f87e5eaa0/gno.land/pkg/integration/testing_integration.go#L471-L474) which results different address are being added for every time we run txtar testing. > To test SPECIFIC ADDRESS, we need to get rid of `randomness` This PR implements `adduserfrom`, which creates a user from given mnemonic (optionally account and index can be also passed to derive different address from same mnemonic) <details><summary>Contributors' checklist...</summary> - [x] Added new tests, or not needed, or not feasible - [ ] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [x] Updated the official documentation or not needed - [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [ ] Added references to related issues and PRs - [ ] Provided any useful hints for running manual tests - [ ] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md). </details> --------- Co-authored-by: Guilhem Fanton <[email protected]>
- Loading branch information
Showing
3 changed files
with
121 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# adduserfrom just mnemonic | ||
adduserfrom user1 'source bonus chronic canvas draft south burst lottery vacant surface solve popular case indicate oppose farm nothing bullet exhibit title speed wink action roast' | ||
stdout 'g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5' | ||
|
||
# adduserfrom mnemonic and account | ||
adduserfrom user2 'source bonus chronic canvas draft south burst lottery vacant surface solve popular case indicate oppose farm nothing bullet exhibit title speed wink action roast' 1 | ||
stdout 'g18e22n23g462drp4pyszyl6e6mwxkaylthgeeq4' | ||
|
||
# adduserfrom mnemonic, account and index | ||
adduserfrom user3 'source bonus chronic canvas draft south burst lottery vacant surface solve popular case indicate oppose farm nothing bullet exhibit title speed wink action roast' 1 1 | ||
stdout 'g1mtmrdmqfu0aryqfl4aw65n35haw2wdjkh5p4cp' | ||
|
||
## start a new node | ||
gnoland start | ||
|
||
## check users initial balance | ||
gnokey query bank/balances/${USER_ADDR_user1} | ||
stdout '10000000ugnot' | ||
|
||
gnokey query bank/balances/g18e22n23g462drp4pyszyl6e6mwxkaylthgeeq4 | ||
stdout '10000000ugnot' | ||
|
||
gnokey query auth/accounts/${USER_ADDR_user3} | ||
stdout 'height: 0' | ||
stdout 'data: {' | ||
stdout ' "BaseAccount": {' | ||
stdout ' "address": "g1mtmrdmqfu0aryqfl4aw65n35haw2wdjkh5p4cp",' | ||
stdout ' "coins": "10000000ugnot",' | ||
stdout ' "public_key": null,' | ||
stdout ' "account_number": "58",' | ||
stdout ' "sequence": "0"' | ||
stdout ' }' | ||
stdout '}' | ||
! stderr '.+' # empty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters