procContract
The procContract enables a user to construct Kontor transactions in a type-safe manner.
Below is an example of composing a transfer on the nativeToken contract.
const composeResponse = await indexerClient.procContract({
account: ["taproot-address", "x-only-public-key"],
wit: nativeToken.wit,
contractAddress: 'token_0_0',
functionName: "transfer",
args: ["dst-taproot-address", [1n, 18]],
satsPerVByte: 1,
utxos: [
"txid:vout",
],
gas: 10_000n,
})
If you prefer not to pass the account at the procContract call-site, it can be passed as an argument to the client.
import { nativeToken, createKontorIndexerClient, http, signet } from '@kontor/kontor-sdk'
export const indexerClient = createKontorIndexerClient({
account: ["taproot-address", "x-only-public-key"],
chain: signet,
transport: http()
})
const composeResponse = await indexerClient.procContract({
wit: nativeToken.wit,
contractAddress: 'token_0_0',
functionName: "transfer",
args: ["dst-taproot-address", [1n, 18]],
satsPerVByte: 1,
utxos: [
"txid:vout",
],
gas: 10_000n,
})