Skip to main content
Last updated

Using the commandBuilder

You may prefer to not generate JavaScript code for your contracts or use templates. In that case, you can use the commandBuilder function to build a command and submit the transaction yourself:

ts
import { Pact } from '@kadena/client'; const client = createClient(  'https://api.testnet.chainweb.com/chainweb/0.0/testnet04/chain/8/pact',); const unsignedTransaction = Pact.builder  .execution('(format "Hello {}!" [(read-msg "person")])')  // add signer(s) if its required  .addSigner('your-pubkey')  // set chain id and sender  .setMeta({    chainId: '8',    senderAccount: 'your-k-or-w-account-or-gas-station',  })  // set networkId  .setNetworkId('mainnet01')  // create transaction with hash  .createTransaction(); // Send it or local itclient.local(unsignedTransaction);client.submit(unsignedTransaction);
ts
import { Pact } from '@kadena/client'; const client = createClient(  'https://api.testnet.chainweb.com/chainweb/0.0/testnet04/chain/8/pact',); const unsignedTransaction = Pact.builder  .execution('(format "Hello {}!" [(read-msg "person")])')  // add signer(s) if its required  .addSigner('your-pubkey')  // set chain id and sender  .setMeta({    chainId: '8',    senderAccount: 'your-k-or-w-account-or-gas-station',  })  // set networkId  .setNetworkId('mainnet01')  // create transaction with hash  .createTransaction(); // Send it or local itclient.local(unsignedTransaction);client.submit(unsignedTransaction);