Blueprints
Blueprints for script with either apply parameters or no parameters
Blueprint
utility classes to help manipulating serialization and deserialization logic around Cardano smart contracts / validators. Now it is supporting the basic use case around 3 purposes - Spending
,Minting
and Withdrawal
. You can either directly use the Blueprint
utility classes imported from Mesh, or use the Cardano Bar from SIDAN Lab, which perform a comprehensive parsing of the CIP57 blueprint object into Mesh's type.CLI Blueprint Generator
The Mesh CLI provides a convenient way to generate TypeScript types and classes from Cardano CIP-57 blueprint files. This allows you to automatically create type-safe interfaces for your smart contracts.
The CLI uses the same parsing engine as the Cardano Bar VSCode extension to ensure consistent and reliable code generation.
Features
- Type Safety: Generates TypeScript interfaces and types based on your blueprint schema
- Blueprint Classes: Automatically creates Mesh blueprint classes for spending, minting, and withdrawal validators
- Import Management: Handles all necessary imports from the Mesh SDK
- CIP-57 Compliant: Supports the full CIP-57 blueprint specification
- Easy Integration: Generated code integrates seamlessly with existing Mesh projects
Usage
Use the following command to generate TypeScript code from your blueprint:
Example Blueprint File
Here's an example of a CIP-57 blueprint JSON file:
Generated Output
The CLI will generate TypeScript code with proper types and blueprint classes:
Spending Script Blueprint
SpendingBlueprint
is a class for handling spending blueprint particularly. You can provide plutusVersion
, networkId
and the potential stakeKeyHash
for the spending validator address to initialized the class. After that, providing the compiledCode
and parameters to finish the setup. The class then provide easy access to common script information:
- Script Hash
- Script Cbor
- Script Address
A Spending validator with no parameter, allows to provides only thecompiledCode
instead.
Creates a spending script blueprint with apply parameter to script.
Creates a spending script blueprint with no parameter to script.
Minting Script Blueprint
MintingBlueprint
is a class for handling minting blueprint particularly. You can provide plutusVersion
, for the minting validator to initialize the class. After that, providing the compiledCode
and parameters to finish the setup. The class then provide easy access to common script information:
- Policy ID (i.e Script Hash)
- Script Cbor
A Minting validator with no parameter, allows to provides only thecompiledCode
instead.
Creates a Minting script blueprint with apply parameter to script.
Creates a Minting script blueprint with no parameter to script.
Withdrawal Script Blueprint
WithdrawalBlueprint
is a class for handling withdrawal blueprint particularly. You can provide plutusVersion
, andnetworkId
for the withdrawal validator to initialize the class. After that, providing the compiledCode
and parameters to finish the setup. The class then provide easy access to common script information:
- Script Hash
- Script Cbor
- Reward Address
A withdrawal validator with no parameter, allows to provides only the compiledCode
instead.
Creates a withdrawal script blueprint with apply parameter to script.
Creates a withdrawal script blueprint with no parameter to script