@kadena/pactjs-cli
v1.16.0
Published
CLI tool accompanying @kadena/pactjs-core and @kadena/pactjs-client to generate TypeScript definitions and Pact client
Downloads
1,773
Keywords
Readme
@kadena/pactjs-cli
CLI tool accompanying @kadena/pactjs-core and @kadena/pactjs-client to generate TypeScript definitions and Pact client
generate
Generate client based on a contract
| Parameter | Description | Required | Default value | | -------------------- | ---------------------------------------------------------------------------------------------------------------------- | --------------------------- | ----------------- | | -c, --clean | Clean existing generated files | No | | | -i, --caps-interface | Custom name for the interface of the caps. Can be used to create a type definition with a limited set of capabilities. | No | | | -f, --file | Generate d.ts from Pact contract file | If --contract is ommitted | | | --contract | Generate d.ts from Pact contract from the blockchain | If --file is ommitted | | | --api | The API to use for retrieving the contract (e.g. https://api.chainweb.com/chainweb/0.0/mainnet01/chain/8/pact) | When --contract is provided | | | --chain | The chainId to retrieve the contract from | When --contract is provided | 0 | | --network | The networkId to retrieve the contract from (e.g. testnet) | When --contract is provided | mainnet |
Generate from file
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
retrieve-contract
Retrieve a contract from an API using a /local call
| Parameter | Description | Required | Default value | | ------------- | ------------------------------------------------------------------------------------------------------- | ------------ | ----------------------------- | | -m --module | The module you want to retrieve (e.g. "coin") | Yes | | | -o, --out | File to write the contract to (e.g. ./myContract.pact) | Yes | | | -a, --api | API to fetch the contract from (e.g. https://api.chainweb.com/chainweb/0.0/mainnet01/chain/8/pact) | Yes | https://api.chainweb.com | | -n, --network | Network to retrieve from (e.g. testnet) | No | mainnet |
Retrieve a contract from chain
pactjs retrieve-contract --out ./myContract.pact --module coin --api https://api.chainweb.com/chainweb/0.0/mainnet01/chain/8/pact
template-generate
Generate statically typed generators for templates
| Parameter | Description | Required | Default value | | ------------- | --------------------------------------------------- | ------------ | ----------------- | | -c, clean | Clean existing template | No | | | -f, --file | File or directory to use to generate the client | Yes | | | -o, --out | Output file/directory to place the generated client | Yes | |
Generate a client from a template
pactjs template-generate --file ./contractDir --out ./myContract.pact