# Smart Contracts (Wasm)
With NibiJS
, developers can utilize the SigningCosmWasmClient
within the NibiruTxClient
class to interact with a smart contract. This allows them to upload the contract's bytecode, set the sender address, specify the fee, and deploy the contract to the blockchain. Additionally, it simplifies the processes of smart contract instantiation, querying, and execution.
# Interacting with Smart Contracts
To interact with smart contracts, you need to connect your wallet to a NibiruTxClient
. This provides access to SigningCosmWasmClient
via the wasm
property. In the example below, we are connecting via Cosmos-Kit (opens new window). For other options, check out this guide.
# Connect to a Wallet
First, set up the connection to your wallet. This example is using Cosmos-Kit.
# Deploying Smart Contract
To deploy a smart contract, you need to upload the WASM bytecode to the blockchain.
# Instantiating a Smart Contract
To query a smart contract, provide the contract address and the query message.
After deploying the contract, instantiate it by providing the codeId and initialization parameters.
# Querying a Smart Contract
To query a smart contract, provide the contract address and the query message.
# Executing a Smart Contract
To execute a smart contract, provide the sender address, contract address, and execution message.