This is an experimental package that helps with the definition and sharing of the parameters of
a Marlowe contract template.
We call a contract template to a function (e.g. mkContract) that receives a set of parameters and returns a Marlowe contract.
Manually sharing the contract parameters can be challenging, so this package aims to solve that by
serializing the parameters to and
fromMetadata.
constmyTemplate = mkMarloweTemplate({ name:"My template example", description:"This defines the parameters of a simple contract", params: [ { name:"aString", type:"string", description:"A string parameter" }, { name:"aValue", type:"value", description:"A `number | bigint` parameter", }, { name:"anAddress", type:"address", description:"An AddressBech32 parameter", }, ] asconst, // it is important to use `as const` for the inference to work correctly });
// The inferred type of `MyTemplateParameters` is: // type MyTemplateParameters = { // aString: string; // aValue: number | bigint; // anAddress: AddressBech32; // }; typeMyTemplateParameters = TemplateParametersOf<typeofmyTemplate>;
constcontractParameters: MyTemplateParameters = { aString:"hello", aValue:42n, anAddress:addressBech32("replace for a valid bech32 address"), };
This is an
experimental
package that helps with the definition and sharing of the parameters of a Marlowe contract template.We call a contract template to a function (e.g.
mkContract
) that receives a set of parameters and returns a Marlowe contract. Manually sharing the contract parameters can be challenging, so this package aims to solve that by serializing the parameters to and from Metadata.