Wasm
Send CosmWasm messages to the chain.
Available Commands
Executes a wasm message.
Instantiates a contract by code Id.
Migrate a contract.
Queries a contract.
Upload a contract wasm.
Execute
Executes a wasm message.
Usage
wasm execute <contract address> <message>
Flags
funds
Funds to send with the message
--funds 100uandr
memo
An optional memo to attach to the message
--memo 'Wow what a great transaction!'
simulate
Simulates the transaction without broadcasting it. Useful to estimate gas costs.
-- simulate
help
Displays info about the current command.
--help
Example
? main-star@elgafar-1> wasm execute stars12w4nvet0fr2kh8a6xg594d4fd3tkwulrpy55nawh8s0y2z584pjsq4w2cq '{"deposit": {}}' --funds 10000ustars
The CLI will promt a confirmation. After confirming, the output is similar to:
– Executing Tx...
Transaction executed!
https://testnet-explorer.publicawesome.dev/stargaze/tx/042353250E0D6C67C320195032CB0BB7EDE1873F2434426A9812551ED4206E3E
The link will take you to the explorer to see the transaction details.
Instantiate
Instantiates a contract by code Id.
Usage
wasm instantiate <code-id> <instantiate message>
Flags
label
Used to provide a label assigned to the instantiation.
--label 'This is a great label'
admin
Used to provide an alternative admin address for the contract.
--admin andr1...
simulate
Simulates the transaction without broadcasting it. Useful to estimate gas costs.
--simulate
Prints the constructed message before simulating.
help
Displays info about the current command.
--help
Example
? main-star@elgafar-1> wasm instantiate 3886 '{"kernel_address":"stars130mz3y4ajamadf9u5df7xh64t5ed5h3cxechz3jw43qdrc7wm09sxtykmx"}'
– Simulating Instantiation Tx...
Transaction simulated!
Cost Estimates
Gas Used: 211327
Fee estimates:
5284ustars
? Do you want to proceed? Yes
- Instantiating your contract...
Contract instantiated!
https://testnet-explorer.publicawesome.dev/stargaze/tx/75184641D8275A5B34183CF31181C563FB6E4D007FC7BBC805D2DA43892BBBD7
Address: stars1zkug84swrqhvxupsuk4zu93zdcgva02uwlfk2095py39n7243vnq3dxd7y
The transaction link, as well as the new contract address are returned.
Migrate
Migrates a contract.
Usage:
wasm migrate <contract address> <new code id> <migrate msg>
Example:
wasm migrate 126 stars1zkug84swrqhvxupsuk4zu93zdcgva02uwlfk2095py39n7243vnq3dxd7y {}
Query
Performs a contract query.
Usage
wasm query <contract address> <query object>
Example
? main-star@elgafar-1> wasm query stars1zkug84swrqhvxupsuk4zu93zdcgva02uwlfk2095py39n7243vnq3dxd7y {"get_locked_funds_for_recipient":{"recipient":"stars1dtlndrtpth240retkn8l54w8gg2g4hzpq3ugas"}}
Unlike the other messages, the query does not require single quotes around the message.
Here I am queriying the account of a user (which is empty) from one of our contracts, we get:
[]
Upload
Upload a contract wasm.
The path is relative to where the CLI was run.
Usage
wasm upload <wasm file>
Example
wam upload andromeda_app_contract.wasm
Was this helpful?