Skip to main content
Call read and write functions on deployed contracts and retrieve transaction receipts.

Methods

readCallFunction()

Call a read-only function on a deployed contract. Signature:
readCallFunction(
  network: string,
  contractAddress: string,
  request: ReadCallFunctionRequest,
  requestOptions?: RequestOptions
): Promise<ReadCallFunctionResponse>
Parameters:
ParameterTypeRequiredDescription
networkstringYesBlockchain network (e.g., ‘tBTC’, ‘tETH’, ‘AVAX’, ‘FUJI’, ‘SANDBOX’)
contractAddressstringYesContract address
request.abiFunctionobjectYesABI function object
Example Request:
const result = await client.contractInteractions.readCallFunction('tETH', '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb', {
  abiFunction: {
    name: 'balanceOf',
    type: 'function',
    inputs: [
      { name: 'owner', type: 'address' }
    ],
    outputs: [
      { name: '', type: 'uint256' }
    ]
  }
});
Example Response:
{
  data: {
    result: {
      data: {
        result: {
          // Decoded function result
        },
        functionName: 'balanceOf',
        contractAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
        network: 'ETH',
        encodedData: '0x1234567890abcdef...'
      },
      success: true,
      status: 200
    }
  }
}
Response Fields:
FieldTypeRequiredDescription
data.result.data.resultobjectNoDecoded function result
data.result.data.functionNamestringNoFunction name that was called
data.result.data.contractAddressstringNoContract address
data.result.data.networkstringNoNetwork
data.result.data.encodedDatastringNoEncoded function call data
data.result.successbooleanNoWhether the call was successful
data.result.statusnumberNoHTTP status code
console.log('Function result:', result.data.result?.data?.result);

writeCallFunction()

Call a write function on a deployed contract. Returns a workflow ID for async processing. Signature:
writeCallFunction(
  network: string,
  contractAddress: string,
  request: WriteCallFunctionRequest,
  requestOptions?: RequestOptions
): Promise<WriteCallFunctionResponse>
Parameters:
ParameterTypeRequiredDescription
networkstringYesBlockchain network (e.g., ‘tBTC’, ‘tETH’, ‘AVAX’, ‘FUJI’, ‘SANDBOX’)
contractAddressstringYesContract address
request.addressIdstringYesAddress ID for signing
request.clientSharestringYesClient share for signing
request.abiFunctionobjectYesABI function object
request.amountstringNoAmount to send with transaction
request.feeLevelstringNoTransaction fee level
Example Request:
const result = await client.contractInteractions.writeCallFunction('tETH', '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb', {
  addressId: 'address-id',
  clientShare: 'your-client-share',
  abiFunction: {
    name: 'transfer',
    type: 'function',
    inputs: [
      { name: 'to', type: 'address' },
      { name: 'amount', type: 'uint256' }
    ],
    outputs: []
  },
  amount: '0',
  feeLevel: 'standard'
});
Example Response:
{
  data: {
    result: {
      workflowId: 'workflow-id-here',
      status: 'RUNNING'
    }
  }
}
Response Fields:
FieldTypeRequiredDescription
data.result.workflowIdstringNoWorkflow ID for tracking function call
data.result.statusstringNoWorkflow status
console.log('Workflow ID:', result.data.result?.workflowId);

getTransactionReceipt()

Get transaction receipt for a transaction hash. Signature:
getTransactionReceipt(
  request: GetTransactionReceiptRequest,
  requestOptions?: RequestOptions
): Promise<TransactionReceiptResponse>
Parameters:
ParameterTypeRequiredDescription
request.network'ETH' | 'tETH'YesBlockchain network
request.txIdstringYesTransaction hash
Example:
const receipt = await client.contractInteractions.getTransactionReceipt({
  network: 'ETH',
  txId: '0x1234567890abcdef...'
});

console.log('Status:', receipt.data.status);
console.log('Block Number:', receipt.data.blockNumber);
console.log('Gas Used:', receipt.data.gasUsed);

getDeployedContractAbi()

Get contract ABI for a deployed contract. Signature:
getDeployedContractAbi(
  request: GetDeployedContractAbiRequest,
  requestOptions?: RequestOptions
): Promise<ContractAbiResponse>
Example:
const abi = await client.contractInteractions.getDeployedContractAbi({
  network: 'ETH',
  contractAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb'
});

console.log('ABI:', abi.data.abi);