MoralisWeb3 / issue-tracker

25 stars 7 forks source link

CLI add-contract Automation #74

Open xactant opened 3 years ago

xactant commented 3 years ago

Currently the add-contract CLI script is interactive: asking the user to select events and then iterating through the events to add detail about each event (description, table anme, etc.). When you have a contract, or a group of contracts that have multiple events the interactive process is long and cound be error prone (human caused errors I mean).

Since this script is interactive it is not scriptable which means this process cannot be included in an automated deployment scheme.

Currently the add-contract script is called as:

moralis-admin-cli add-contract --moralisApiKey FAM6pYzBKjcM --moralisApiSecret 7thQGNKKqX8s
--abiPath ".\MyContract.json"

To enable a user to included this script in automated deployement, the add-contract script could accept a new parameter --jsonPath "MY JSON FILE". This json file would have the list of event names (or signatures) with required details. The script would then only need to be modified to read the json file and then use the data in the json file instead of the interactive portion of the script. So the add-contract script would be called as:

moralis-admin-cli add-contract --moralisApiKey FAM6pYzBKjcM --moralisApiSecret 7thQGNKKqX8s 
--abiPath ".\MyContract.json" --jsonPath ".\MyContractSetup.json"

The user could then include a set of add-contract calls to an automated deployment script.

gotjoshua commented 3 years ago

big +1 on this

plus additional flags: --force-reset-tables (defaults = false) --backup-tables (defaults = $force-reset-tables)

as in the dev process if i redeploy contracts, true automation would require that the old tables are dropped or renamed so that the new contract sync plugin can use the same table names as before