# Token Standardの版と並び

> Token StandardのDaml APIが、どのpackageとmoduleから成り、V1とV2の世代がどう並ぶかを、2つの図で追います。

- URL: https://cardene.dev/diagrams/canton-token-api-packages
- 公開日: 2026-11-24
- 更新日: 2026-11-24
- トピック: Blockchain
- タグ: Canton
- 親の図解: [Token StandardのDaml API](https://cardene.dev/diagrams/canton-ext-token-standard.md): 外のwalletやアプリが資産を扱うためのToken StandardのDaml APIを、送金の手順から、packageの並び、型、送金の指示、記録、Amuletの実装まで、章の中の図解で追います。

前の頁では、CIP-0056が決める6つのAPIを、保有、送金、DvPの決済の順に見ました。
この頁では、そのDamlのAPIが、どのpackageとmoduleに分かれて置かれ、V1とV2の世代がどう並ぶかを追います。
外のwalletやアプリが依存するpackageを選ぶ時に、どの世代のどのmoduleを見るかを決める材料にします。

:::details DvP
DvPは、Delivery versus Paymentの略で、証券などの資産の受け渡しと代金の支払いを同時に行い、片方だけが実行されることを防ぐ決済の方式です。
資産を渡す側と代金を払う側の、それぞれの受け渡しをlegと呼びます。
:::

V1とV2は、APIの世代の呼び名です。
0.10.3のようなリリースの値と、24のような版の数は、Splice Daml APIの参照の頁が示す公開されている値で、V1とV2の呼び分けとは別の情報です。

https://cardene.dev/diagrams/canton-token-standard

packageは、1つのDamlのプロジェクトに当たる、コンパイルしたDamlのコードの単位です。
moduleは、packageの中で型とinterfaceをまとめるDamlの単位です。
interfaceと、そのviewは、章「Damlのinterface」の頁「interfaceで振る舞いを分ける」が追っています。

https://cardene.dev/diagrams/canton-daml-interfaces

## packageの名前とmoduleの名前

Token StandardのDaml APIは、役ごとにpackageを分け、世代の数字を名前に付けます。
packageの名前は`splice-api-token-`の後に役を付け、最後に`-v1`か`-v2`を付けます。
moduleの名前は、`Splice.Api.Token.`の後に役を付け、最後に`V1`か`V2`を付けます。

| 役 | V1のpackage | V1のmodule |
|---|---|---|
| 保有 | `splice-api-token-holding-v1` | `Splice.Api.Token.HoldingV1` |
| metadata | `splice-api-token-metadata-v1` | `Splice.Api.Token.MetadataV1` |
| 送金の指示 | `splice-api-token-transfer-instruction-v1` | `Splice.Api.Token.TransferInstructionV1` |
| allocation | `splice-api-token-allocation-v1` | `Splice.Api.Token.AllocationV1` |
| allocationの要求 | `splice-api-token-allocation-request-v1` | `Splice.Api.Token.AllocationRequestV1` |
| allocationの指示 | `splice-api-token-allocation-instruction-v1` | `Splice.Api.Token.AllocationInstructionV1` |
| burnとmint | `splice-api-token-burn-mint-v1` | `Splice.Api.Token.BurnMintV1` |

V1の7つのpackageは、どれも、上のmoduleを1つずつ案内します。

V2のpackageの6つの頁は、どれも、今のmoduleの参照です。
どの頁も、最新のリリースを0.10.3、版の数を24、今のmoduleを1つと示します。
前の頁が追うとおり、展開されている標準は今もCIP-0056です。
参照にV2のpackageが載っていることは、V2がネットワークに展開されていることを表しません。

| 役 | V2のpackage | V2のmodule |
|---|---|---|
| 保有 | `splice-api-token-holding-v2` | `Splice.Api.Token.HoldingV2` |
| 送金の指示 | `splice-api-token-transfer-instruction-v2` | `Splice.Api.Token.TransferInstructionV2` |
| allocation | `splice-api-token-allocation-v2` | `Splice.Api.Token.AllocationV2` |
| allocationの要求 | `splice-api-token-allocation-request-v2` | `Splice.Api.Token.AllocationRequestV2` |
| allocationの指示 | `splice-api-token-allocation-instruction-v2` | `Splice.Api.Token.AllocationInstructionV2` |
| transferのイベント | `splice-api-token-transfer-events-v2` | `Splice.Api.Token.TransferEventsV2` |

moduleの頁も、`Splice.Api.Token.AllocationInstructionV2`と`Splice.Api.Token.AllocationRequestV2`と`Splice.Api.Token.AllocationV2`と`Splice.Api.Token.TransferInstructionV2`の4つで、最新のリリースを0.10.3と示します。

## 世代でpackageを並べる

下の図は、13のpackageを、V1とV2の2つの世代に分けて並べます。
V1は7つ、V2は6つです。
この頁が挙げるpackageでは、metadataとburnとmintはV1だけ、transferのイベントはV2だけです。

```dragon
mind Token StandardのDaml APIのpackage

step 2つの版
  say Token StandardのDaml APIのpackageは、名前の最後の数字で、V1とV2の2つの世代に分かれます。
  idea root as "Token StandardのDaml API" [color: slate]
  idea v1 as "V1のpackage" of root [color: blue]
  idea v2 as "V2のpackage" of root [color: rose]
  source Splice Daml API Reference [url: https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-api-token-holding-v2]

step V1の保有と送金
  say V1には、保有、metadata、送金の指示のpackageがあります。
  idea h1 as "保有" of v1 [color: blue]
  idea m1 as "metadata" of v1 [color: blue]
  idea t1 as "送金の指示" of v1 [color: blue]
  source Splice Daml API Reference [url: https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-api-token-holding-v1]

step V1のallocationとburnとmint
  say V1には、allocation、allocationの要求、allocationの指示、burnとmintのpackageもあります。
  idea a1 as "allocation" of v1 [color: blue]
  idea r1 as "allocationの要求" of v1 [color: blue]
  idea i1 as "allocationの指示" of v1 [color: blue]
  idea b1 as "burnとmint" of v1 [color: blue]
  source Splice Daml API Reference [url: https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-api-token-burn-mint-v1]

step V2の保有と送金
  say V2には、保有と送金の指示のpackageがあります。
  idea h2 as "保有" of v2 [color: rose]
  idea t2 as "送金の指示" of v2 [color: rose]
  source Splice Daml API Reference [url: https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-api-token-holding-v2]

step V2のallocationとイベント
  say V2には、allocation、allocationの要求、allocationの指示、transferのイベントのpackageもあります。
  idea a2 as "allocation" of v2 [color: rose]
  idea r2 as "allocationの要求" of v2 [color: rose]
  idea i2 as "allocationの指示" of v2 [color: rose]
  idea e2 as "transferのイベント" of v2 [color: rose]
  source Splice Daml API Reference [url: https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-api-token-transfer-events-v2]
```

## V2のmoduleが受け持つ事

V2のmoduleの説明は、次のように役を分けます。

`Splice.Api.Token.HoldingV2`は、投資家のholdingを取り出すための型とinterfaceです。
`Splice.Api.Token.TransferInstructionV2`は、accountの間のholdingのtransferを指示するV2のAPIです。
`Splice.Api.Token.TransferEventsV2`は、Token Standardのtransferのイベントを記録するinterfaceです。

`Splice.Api.Token.AllocationV2`は、interfaceの`Allocation`のV2と、それを支える型を定めます。
`Splice.Api.Token.AllocationRequestV2`は、アプリが使うinterfaceの`AllocationRequest`のV2です。
`Splice.Api.Token.AllocationInstructionV2`は、walletがregistryにallocationを作るよう指示するための、V2のinterfaceをまとめます。

下の図は、この6つのV2のmoduleを、役ごとの組に置きます。
allocationの3つのmoduleは、1つの組にまとめます。

```dragon
architecture V2のmoduleを役で分ける

group Hold as 保有を表す [color: slate, icon: card]
  box HV as HoldingV2 [note: 投資家のholdingを取り出す, color: rose, icon: card]
end
group Tr as 送金を指示する [color: slate, icon: card]
  box TV as TransferInstructionV2 [note: holdingのtransferを指示する, color: rose, icon: card]
end
group Al as allocationを扱う [color: slate, icon: card]
  box AV as AllocationV2 [note: Allocationのinterfaceと型, color: rose, icon: card]
  box RV as AllocationRequestV2 [note: アプリが使う要求, color: rose, icon: card]
  box IV as AllocationInstructionV2 [note: walletがregistryへ指示する, color: rose, icon: card]
end
group Ev as 記録する [color: slate, icon: card]
  box EV as TransferEventsV2 [note: transferのイベントを記録する, color: rose, icon: card]
end

step 保有と送金
  say HoldingV2は投資家のholdingを取り出す型とinterfaceを持ち、TransferInstructionV2はholdingのtransferを指示するAPIを持ちます。
  act HV: 保有を取り出す型とinterface
  act TV: transferを指示するAPI
  source Splice.Api.Token.HoldingV2 [url: https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-api-token-holding-v2]
  source Splice.Api.Token.TransferInstructionV2 [url: https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-api-token-transfer-instruction-v2]

step allocationのinterface
  say AllocationV2は、Allocationのinterfaceと型を定めます。
  act AV: Allocationのinterfaceと型
  source Splice.Api.Token.AllocationV2 [url: https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-api-token-allocation-v2]

step アプリが使う要求
  say AllocationRequestV2は、アプリが使う要求をまとめます。
  act RV: アプリが使う要求
  source Splice.Api.Token.AllocationRequestV2 [url: https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-api-token-allocation-request-v2]

step allocationの作成の指示
  say AllocationInstructionV2は、walletがregistryへallocationの作成を指示するinterfaceをまとめます。
  act IV: walletが指示するinterface
  source Splice.Api.Token.AllocationInstructionV2 [url: https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-api-token-allocation-instruction-v2]

step transferのイベント
  say TransferEventsV2は、Token Standardのtransferのイベントを記録するinterfaceです。
  act EV: transferのイベントを記録する
  source Splice.Api.Token.TransferEventsV2 [url: https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-api-token-transfer-events-v2]
```

## 次に読む頁

次の頁「holdingとmetadataの型を知る」は、holdingとaccountとロックをToken Standardがどう表し、choiceへ渡す追加のデータとmetadataをどう表すかを追います。

https://cardene.dev/diagrams/canton-holding-metadata

## 出典

https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-api-token-holding-v1

https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-api-token-holding-v2

https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-api-token-metadata-v1

https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-api-token-transfer-instruction-v1

https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-api-token-transfer-instruction-v2

https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-api-token-allocation-v1

https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-api-token-allocation-v2

https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-api-token-allocation-request-v1

https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-api-token-allocation-request-v2

https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-api-token-allocation-instruction-v1

https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-api-token-allocation-instruction-v2

https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-api-token-burn-mint-v1

https://docs.canton.network/sdks-tools/api-reference/splice-daml/splice-api-token-transfer-events-v2
