@fairmint/wrapped-assets-daml-js

中文文档
0.0.27发布于 2026/10/28Apache-2.0TypeScriptCommonJS近 30 天下载 1.2万

WrappedAssets-v01 DAML contracts with generated JavaScript/TypeScript bindings (Canton Token Standard holdings, mint/burn, compliance enforcement, BurnOffer redeem).

原始使用文档
文档目录6 节
  1. Install JS bindings
  2. Registry SDK
  3. Layout
  4. Build and test
  5. LocalNet integration
  6. License

canton-assets

Apache-2.0 repository for the WrappedAssets-v01 DAML package — reserve-backed holdings implementing Canton Token Standard V1 (holding, burn-mint, transfer, and allocation interfaces), with transfer-agent compliance enforcement (holding freeze / instrument pause) and recovery. Holdings require distinct operator and transfer-agent signatures (two-party authorization).

Published npm bindings: @fairmint/wrapped-assets-daml-js (generated JS/TS only — not an application SDK). First real release is 0.0.1 (npm placeholder was 0.0.0).

For contract structure, redeem, and instrument pause, see docs/.

Install JS bindings

npm install @fairmint/wrapped-assets-daml-js

Peer dependencies: @daml/[email protected] and @daml/[email protected] (also listed as runtime dependencies for convenience).

import { WRAPPED_ASSETS_TEMPLATES, WrappedAssets, Splice } from '@fairmint/wrapped-assets-daml-js';

console.log(WRAPPED_ASSETS_TEMPLATES.burnMintFactory);

Minimal mint → enforce/release or BurnOffer.Accept sample: examples/mint-burn/.

Registry SDK

The generated bindings above are a mechanical translation of the DAR with no opinions in them. @fairmint/wrapped-assets-sdk is the opinionated wrapper: it answers the Canton Network Token Standard's registry questions — the instruments, the transfer and allocation factories, and the six choice contexts — from three ledger reads behind a RegistryLedger port, so the template matching, decimal-exact supply and pause rules live in one place rather than in each server that serves them. It ships as a second package from this repository, versioned separately.

The SDK takes its template identifiers, choice names and choice-argument shapes from the published @fairmint/[email protected] bindings instead of restating them, so it tracks exactly the DAR this repository publishes — registry factories, instrument pause and compliance enforcement included. Callers inject a RegistryLedger or a duck-typed JSON API reader (getActiveContracts + getEventsByContractId). To read CIP-56 results, use @fairmint/canton-node-sdk (or another client) with this package's CHOICES / TEMPLATE_IDS.

Layout

Build and test

npm install
npx canton-dev-tools install-dpm-sdks
export PATH="$HOME/.dpm/bin:$PATH"

npm run lint
npm run build
npm test
npm run codegen
npm run verify-package
npm run typecheck:sample

npm test is both suites: test:daml (Daml Script, needs dpm) then test:sdk (node:test over packages/sdk, needs neither Java nor the Daml SDK). CI runs them as separate jobs.

npm run build fetches pinned Splice interface DARs via the packaged default in @fairmint/canton-dev-tools before compiling with dpm. LocalNet runtime Splice/quickstart pins live in that package as well. Optional repo-root splice-dars.json overrides the shared pin when needed.

Generic DAML→JS codegen (codegen-js, bundle-dependencies, create-root-index, package stamping, collapse-manifest, prepare-release) lives in @fairmint/canton-dev-tools. Bundle presets and the merged published lib/ (including WRAPPED_ASSETS_TEMPLATES) are configured in repo-root daml-js-bundle.json. This repo keeps product-specific verify lists and samples.

Publish on main uses GitHub Actions OIDC trusted publishing (publish.yml); do not put NPM_TOKEN on the publish step.

LocalNet integration

Live-ledger tests upload the built DAR and smoke WrappedAssetsBurnMintFactory on Canton LocalNet (Docker required; first start ~10–15 min):

npm run build
npm run localnet:verify

LocalNet lifecycle and DAML package tooling come from @fairmint/canton-dev-tools. What this repo's suite asserts is in test/localnet/README.md.

License

Apache-2.0. See LICENSE.

版本与发布记录

@fairmint/wrapped-assets-daml-js 共发布 28 个版本,首次发布于 2026/08/12;过去 12 个月发布了 28 个版本。

版本发布日期距今
0.0.27latest2026/10/2817 天前
0.0.262026/10/091 个月前
0.0.252026/09/241 个月前
0.0.242026/09/231 个月前
0.0.232026/09/042 个月前
0.0.222026/09/042 个月前

关于 @fairmint/wrapped-assets-daml-js 的常见问题

@fairmint/wrapped-assets-daml-js 是什么?

WrappedAssets-v01 DAML contracts with generated JavaScript/TypeScript bindings (Canton Token Standard holdings, mint/burn, compliance enforcement, BurnOffer redeem).

如何安装 @fairmint/wrapped-assets-daml-js?

在项目目录运行 npm install @fairmint/wrapped-assets-daml-js,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@daml/types(3.5.2)、@daml/ledger(2.10.4)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@fairmint/wrapped-assets-daml-js 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@fairmint/wrapped-assets-daml-js 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@fairmint/wrapped-assets-daml-js 可以商用吗?

@fairmint/wrapped-assets-daml-js 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@fairmint/wrapped-assets-daml-js 的下载量有多少?

根据 npm 官方下载统计,@fairmint/wrapped-assets-daml-js 在 2026/10/14 – 2026/11/12 这 30 天内被下载 11,688 次,日均约 390 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fairmint/wrapped-assets-daml-js 还在维护吗?

最新版本 0.0.27 发布于 2026/10/28(17 天前);至今共发布 28 个版本,其中过去 12 个月发布了 28 个;首次发布于 2026/08/12。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。