Skip to main content

generate

Generate client based on a contract

ParameterDescriptionRequiredDefault value
-c, --cleanClean existing generated filesNo
-i, --caps-interfaceCustom name for the interface of the caps. Can be used to create a type definition with a limited set of capabilities.No
-f, --fileGenerate d.ts from Pact contract fileIf --contract is ommitted
--contractGenerate d.ts from Pact contract from the blockchainIf --file is ommitted
--apiThe API to use for retrieving the contract (e.g. https://api.chainweb.com/chainweb/0.0/mainnet01/chain/8/pact )When --contract is provided
--chainThe chainId to retrieve the contract fromWhen --contract is provided0
--networkThe networkId to retrieve the contract from (e.g. testnet)When --contract is providedmainnet

Generate from file

pactjs contract-generate --file ./myContract.pact
pactjs contract-generate --file ./myContract.pact

Generate from chain

pactjs contract-generate --contract free.coin --api https://api.testnet.chainweb.com/chainweb/0.0/testnet04/chain/1/pact --chain 1 --network testnet
pactjs contract-generate --contract free.coin --api https://api.testnet.chainweb.com/chainweb/0.0/testnet04/chain/1/pact --chain 1 --network testnet