Note: The Docker container will not work if you are using an M1 chip.
Note: The localsecret docker container can be stopped by CTRL+C
sudo docker runprivileges will only need to be given once to run the SecretNetwork docker container normally i.e without
Note: In a new terminal
testkeyring backend, which makes it easier for local development and testing.
exitwhen you are done
tests/directory and run as:
npx ts-node integration.ts
discovery migrateduring the Cosmos deploy-execute process which handles both the deploying and creation of the contract instance. This process consists of 3 steps rather than 2 for Ethereum smart contracts. You can read more about the logic behind this decision, and other comparisons to Solidity, in the cosmwasm documentation.
Note: At this time the Secret Network Light Client is not available for Macs.
pulsar-2. Below there is also a config setting to point to the
testkeyring backend which allows interaction with the testnet and the contract without providing an account password each time.
Note: To reset your
secretcli config keyring-backend os.
Note: The Secret faucet should fund your testnet account with ~100000000 uscrt. If you query for your account balance before the network has sent and synced the funds sent to your Secret address you will see "balances": — please wait for faucet tx to complete.
code_idin the logs; which you'll use to create an instance of the contract.
CODE_IDvalue below to the
code_idby querying the txhash. There will be a
code_idin the logs section under events/attributes in the query.
Note: A unique label for the contract will need to be made for the contract to be instantiated. If the label is not unique you will get the following error: "Error: label already exists. You must choose a unique label for your contract instance".
src/) has these files:
contract.rsfor contract logic, contract entry points are
initin contract.rs initializes the storage, specifically the current count and the signer/owner of the instance being initialized.
handle, a generic handler for all functions writing to storage, the counter can be incremented and reset. These functions are provided the storage and the environment, the latter's used by the
resetfunction to compare the signer with the contract owner.
queryfor all functions reading state, we only have
query_count, returning the counter state.
state.rsfile defines the State struct, used for storing the contract data, the only information persisted between multiple contract calls.
msg.rsfile is where the InitMsg parameters are specified (like a constructor), the types of Query (GetCount) and Handle[r] (Increment) messages, and any custom structs for each query response.