Skip to content

viewContractRaw

viewContractRaw is a low-level action that passes a raw wave expression to the contract view endpoint. It has no knowledge of a contract WIT specification. Accordingly, the response is not parsed.

In the below example, several view methods are called on the nativeToken contract using manually serialized wave expressions.

import { nativeToken, createKontorIndexerClient, http, signet } from '@kontor/kontor-sdk'
 
export const indexerClient = createKontorIndexerClient({
  chain: signet,
  transport: http()
})
 
const totalSupply = await indexerClient.viewContractRaw({
  contractAddress: 'token_0_0',
  wave: "total-supply()"
})
 
const balance = await indexerClient.viewContractRaw({
  contractAddress: 'token_0_0',
  wave: `balance("2c7b730daa0036e8276cdd8fabe844b2dd324a6d227dd209663805189d03e51f")`
})