Skip to content
Function: shieldedWriteContract()

seismic-viem


seismic-viem / shieldedWriteContract

Function: shieldedWriteContract()

function shieldedWriteContract<
  TTransport,
  TChain,
  TAccount,
  TAbi,
  TFunctionName,
  TArgs,
  chainOverride,
>(client, parameters): Promise<WriteContractReturnType>

Defined in: packages/seismic-viem/src/contract/write.ts:52

Executes a shielded write function on a contract, where the calldata is encrypted. The API for this is the same as viem's writeContract

Example

import {
  createShieldedWalletContract,
  seismicDevnet,
  shieldedWriteContract,
} from 'seismic-viem'
import { custom, parseAbi } from 'viem'
 
const client = createShieldedWalletClient({
  chain: seismicDevnet,
  transport: custom(window.ethereum),
})
const hash = await shieldedWriteContract(client, {
  address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
  abi: parseAbi(['function mint(uint32 tokenId) nonpayable']),
  functionName: 'mint',
  args: [69420],
})

Type Parameters

TTransport extends Transport

TChain extends undefined | Chain

TAccount extends Account

TAbi extends Abi | readonly unknown[]

TFunctionName extends string

TArgs extends unknown

chainOverride extends undefined | Chain = undefined

Parameters

client

ShieldedWalletClient<TTransport, TChain, TAccount>

The client to use.

parameters

WriteContractParameters<TAbi, TFunctionName, TArgs, TChain, TAccount, chainOverride>

The configuration object for the write operation.

  • address (Hex) - The address of the contract.
  • abi (Abi) - The contract's ABI.
  • functionName (string) - The name of the contract function to call.
  • args (array) - The arguments to pass to the contract function.
  • gas (bigint, optional) - Optional gas limit for the transaction.
  • gasPrice (bigint, optional) - Optional gas price for the transaction.
  • value (bigint, optional) - Optional value (native token amount) to send with the transaction.

Returns

Promise<WriteContractReturnType>

A promise that resolves to a transaction hash.