Initialize the Contract
We don't specify it here, but in almost all cases you should provide an --admin
address when instantiating a contract. If you do not, you will not be able to migrate the contract later.
CosmWasm Smart Contracts take their arguments as serialized JSON. This can be created a number of ways, but as we showed in the previous examples, it may well be easiest to use the node
command line, if that is available to you.
There is a Typescript helpers file for most contracts, and extensions for CosmJS, but at the time of writing, they are broken. This will no doubt be fixed soon, providing an alternative way of interacting with contracts other than the CLI.
To use the node REPL, type node
in the terminal.
With these encoded arguments, you can now instantiate the contract, using the code_id
from the previous step.
Once the contract is instantiated, you can find out its contract address:
You will need this to interact with the contract.
Last updated