useShieldedContract
Get a ShieldedContract instance for reads and writes
import { useShieldedContract } from "seismic-react";Config
Parameter
Type
Required
Description
Return Type
Property
Type
Description
Usage
Basic
import { useShieldedContract } from 'seismic-react'
const abi = [
{
name: 'balanceOf',
type: 'function',
stateMutability: 'view',
inputs: [],
outputs: [{ name: '', type: 'uint256' }],
},
{
name: 'transfer',
type: 'function',
stateMutability: 'nonpayable',
inputs: [
{ name: 'to', type: 'address' },
{ name: 'amount', type: 'uint256' },
],
outputs: [],
},
] as const
function MyContract() {
const { contract, error } = useShieldedContract({
abi,
address: '0x1234567890abcdef1234567890abcdef12345678',
})
if (error) return <div>Error: {error.message}</div>
if (!contract) return <div>Loading contract...</div>
return <div>Contract ready</div>
}Using the contract for reads and writes
TypeScript ABI typing
See Also
Last updated

