From 39f1809c963c1f73123f5e48e730058bfbe93b47 Mon Sep 17 00:00:00 2001 From: Brandon Fancher Date: Fri, 8 Apr 2022 11:23:33 -0400 Subject: [PATCH 1/2] Add a README about scripts. --- README.md | 4 ++++ scripts/README.md | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 scripts/README.md diff --git a/README.md b/README.md index b9fc38baf..e533d3f75 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,10 @@ tar xf node-v14.16.0-linux-x64.tar.xz npm i -g yarn ``` +### Helper Scripts + +See the [scripts](scripts) directory. + ### Running Eden with Ephemeral Chains Locally Ephemeral chains are instances of the EOS blockchain spawned by `nodeos` locally, with manipulated data from our chain runners, eg: [Basic Genesis Runner](contracts/eden/tests/run-genesis.cpp), [Elections Runner](contracts/eden/tests/run-elections.cpp) (which finishes with an open, running election), and [Completed Elections Runner](contracts/eden/tests/run-complete-elections.cpp). By running a ephemeral chain you are in full control of the blockchain, giving you more flexibility to test the Eden contracts. diff --git a/scripts/README.md b/scripts/README.md new file mode 100644 index 000000000..d33135623 --- /dev/null +++ b/scripts/README.md @@ -0,0 +1,26 @@ +# Helper Scripts + +There are a few different types of scripts in this directory. Many of them by default use WAX Testnet and accounts on WAX Testnet from the files: + +- `genesis_accounts` - 14 accounts (a subset of `genesis_accounts_long_list`) +- `genesis_accounts_long_list` - 66 accounts + +...however you can customize these scripts to use whatever chain--remote or local--you want with whatever contract and user accounts you want. These can be used for one-off actions, or together in serial to stand up communities or process inductions. Modify at will to accomplish what you want. And if you create new, helpful scripts, submit them in PRs. + +## Set up a new community + +Make sure you have cleos up and running and keys properly imported. If you have access, you can get WAX Testnet keys from the Notion wiki. This assumes you already have the contract account set up on chain and contracts deployed. + +1. If you've previously used the contract account for tests, run the `clearall` action to reset the community. +1. `init_community.sh` creates a new community in genesis mode with the accounts you specified. +1. `genesis_profiles.sh` sets up genesis members' profiles. +1. `genesis_donate.sh` transfers the donation amount to the contract account and then executes the action to donate. This completes genesis members' inductions. (Remember, in Genesis mode, the witness/endorsement step is not required.) + +## Other scripts + +- `election_opt_in_out.sh` - Bulk register members for an election +- `complete_induction.sh` - Set up a profile for a pending member induction +- `faucet_waxsweden.sh` - Get users more WAX Testnet tokens +- `create_test_accounts.sh` - Creates test accounts +- `docker_build.sh` - Build the contract using a Docker container +- `eden_chain_runner.sh` - See [Running Eden With Ephemeral Chains Locally](https://github.com/gofractally/Eden#running-eden-with-ephemeral-chains-locally) From 90bf6c5c7297b1dc79745b0ea001e1c48e7ba170 Mon Sep 17 00:00:00 2001 From: Brandon Fancher Date: Mon, 11 Apr 2022 13:26:00 -0400 Subject: [PATCH 2/2] Don't crash webapp when displaying resigned members in election stats. --- packages/webapp/src/members/helpers/formatters.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/webapp/src/members/helpers/formatters.ts b/packages/webapp/src/members/helpers/formatters.ts index 98285b6ce..58527c737 100644 --- a/packages/webapp/src/members/helpers/formatters.ts +++ b/packages/webapp/src/members/helpers/formatters.ts @@ -10,14 +10,19 @@ export const formatMembersQueryNodeAsMemberNFT = ( data: MembersQueryNode ): MemberNFT | undefined => { if (!data) return; + + if (!data.profile) { + console.info(`${data.account} has since resigned`); + } + return { createdAt: data.createdAt ? new Date(data.createdAt).getTime() : 0, account: data.account, - name: data.profile.name, - image: data.profile.img, - attributions: data.profile.attributions, - bio: data.profile.bio, - socialHandles: JSON.parse(data.profile.social), + name: data.profile?.name ?? data.account, + image: data.profile?.img, + attributions: data.profile?.attributions, + bio: data.profile?.bio, + socialHandles: data.profile ? JSON.parse(data.profile.social) : {}, inductionVideo: data.inductionVideo, }; };