Closed hrajchert closed 9 months ago
This update introduces significant enhancements to the development environment and the core functionality of a TypeScript-based project. It focuses on improving debugging configurations, refining the handling and validation of data types, and advancing the project's architecture through the introduction of a new blueprint
package. Additionally, the update modernizes the contract creation logic and payment scheme in a specific example, showcasing the practical application of the newly introduced concepts and tools.
Files | Change Summary |
---|---|
.vscode/settings.json |
Added paths for blueprint dist and test-dist JS files to outFiles . |
examples/nodejs/src/marlowe-object-flow.ts |
Updated contract logic, introduced Metadata type, and refined payment scheme with new identifiers. |
jest.unit.config.js |
Added Jest unit test config for blueprint . |
jsdelivr-npm-importmap.js |
Added entry for @marlowe.io/blueprint . |
packages/adapter/src/bigint.ts |
Introduced BigIntOrNumber type and guard. |
packages/blueprint/... (multiple files) |
Introduced the blueprint package with core functionality, codecs, and tests. |
packages/runtime/core/src/... (address, metadata) |
Updated address validation and refined metadata types. |
šāØ
In a world of code, where bugs often strode,
Came a blueprint, so bold, its story to be told.
With types so refined, and contracts designed,
A rabbit hopped along, improvements it aligned.
"To the future," it said, "with leaps, not dread,
For our code is now stronger, and far ahead."
šš¾
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
When you create a Marlowe contract using the ts-sdk, it is common to have a template function that receives some Parameters/Schema/Blueprint and generates either a
Contract
orContractBundleMap
. When you want another participant to know if a given contract is an instance of your template, the other participant must have the same template function applied with the same parameters.Sharing the template function is easy and generally solved by using the same web DAPP. The template parameters, on the other hand, need to be shared differently.
It is easy to see how this PR simplifies the Parameter sharing In the
marlowe-object-flow.ts
example changes. Before, we manually defined the typeDelayPaymentScheme
and two functions (extractSchemeFromTags
andmkDelayPaymentTags
) to decode and encode the Scheme asTags
. Now, we manually define theMarloweTemplate
but we infer theDelayPaymentParameters
type and the decoding and encoding function asMetadata
are provided by the package.Summary by CodeRabbit
Summary by CodeRabbit
Metadata
type.