Skip to content

feat: multi sync example#1622

Draft
Viktor-Kalashnykov-da wants to merge 52 commits into
mainfrom
wiktor/multisync-example
Draft

feat: multi sync example#1622
Viktor-Kalashnykov-da wants to merge 52 commits into
mainfrom
wiktor/multisync-example

Conversation

@Viktor-Kalashnykov-da
Copy link
Copy Markdown

@Viktor-Kalashnykov-da Viktor-Kalashnykov-da commented Apr 14, 2026

Multi-Synchronizer DvP Example - On ledger API - Part 1

Showcaces automatic reassignment of Token from private synchronizer to global one

There are 2 follow up PRs (wip)

Technical limitations:
In this PR we introduce separate tests for multi-sync (otherwise regular tests are flaky on multi-sync) - that split will be removed in a separate PR (above)

New example script:
docs/wallet-integration-guide/examples/scripts/15-multi-sync-trade.ts

Note on explicit reassignment

we experimented with automatic reassignment of contracts - and it basically worked BUT.

It worked as long as Bob is owner of TokenRules contract which seems unrealistic.
We introduced TokenAdmin as additional party that is issuer of Token on app-synchronizer (private one).
But this in fact forces us to use explicit reassignment.

@Viktor-Kalashnykov-da Viktor-Kalashnykov-da requested review from a team as code owners April 14, 2026 19:09
@Viktor-Kalashnykov-da Viktor-Kalashnykov-da marked this pull request as draft April 14, 2026 19:09
Comment thread docs/wallet-integration-guide/examples/scripts/multi-sync/15-multi-sync-trade.ts Outdated
Comment thread docs/wallet-integration-guide/examples/scripts/multi-sync/15-multi-sync-trade.ts Outdated
Comment thread docs/wallet-integration-guide/examples/scripts/15-multi-sync-trade.ts Outdated
Comment thread sdk/wallet-sdk/src/wallet/sdk.ts Fixed
@Viktor-Kalashnykov-da Viktor-Kalashnykov-da changed the title Multi-Sync Example feat(multisync-example): Multi-Sync Example Apr 17, 2026
Comment thread core/token-standard-service/src/token-standard-service.ts Outdated
Comment thread docs/wallet-integration-guide/examples/scripts/utils/synchronizer.ts Outdated
Comment thread docs/wallet-integration-guide/examples/scripts/utils/synchronizer.ts Outdated
Comment thread docs/wallet-integration-guide/examples/scripts/multi-sync/15-multi-sync-trade.ts Outdated
Comment thread docs/wallet-integration-guide/examples/scripts/15-multi-sync-trade.ts Outdated
Comment thread docs/wallet-integration-guide/examples/scripts/multi-sync/15-multi-sync-trade.ts Outdated
Comment thread docs/wallet-integration-guide/examples/scripts/multi-sync/15-multi-sync-trade.ts Outdated
Comment thread docs/wallet-integration-guide/examples/scripts/utils/synchronizer.ts Outdated
Comment thread scripts/src/start-localnet.ts Outdated
Comment thread sdk/wallet-sdk/src/wallet/namespace/contract/client.ts Outdated
Comment thread sdk/wallet-sdk/src/wallet/namespace/ledger/dar/client.ts Outdated
Comment thread .gitignore Outdated
Copy link
Copy Markdown
Contributor

@jarekr-da jarekr-da left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made first round or review.
Generally that is a scenario we want.
I posted questions and problems to recheck / fix.

@Viktor-Kalashnykov-da Viktor-Kalashnykov-da changed the title feat(multisync-example): Multi-Sync Example feat: multi sync example Apr 21, 2026
Comment thread core/wallet-test-utils/src/wallet-gateway.ts Outdated
Comment thread .vscode/settings.json Outdated
Comment thread api-specs/ledger-api/3.4.12/openapi.yaml
Comment thread core/ledger-client/src/ledger-client.ts Outdated
…for examples and added ID of TransferFactory from this project in Exmple 15. Also removed buildContractReadSpec() and its usages

Signed-off-by: vkalashnykov <viktor.kalashnykov@digitalasset.com>
Signed-off-by: vkalashnykov <viktor.kalashnykov@digitalasset.com>
Signed-off-by: vkalashnykov <viktor.kalashnykov@digitalasset.com>
…global during settlement of Trade

Signed-off-by: vkalashnykov <viktor.kalashnykov@digitalasset.com>
…to Ledger Namespace

Signed-off-by: vkalashnykov <viktor.kalashnykov@digitalasset.com>
…s of Wallet SDK

Signed-off-by: vkalashnykov <viktor.kalashnykov@digitalasset.com>
@Viktor-Kalashnykov-da
Copy link
Copy Markdown
Author

The changes done:

  • Replaced separate sequential blocks of party registrations on each synchroniser to usage of wrapping function for registration of the party on all relevant synchronisers in a single call
  • Moved Amulet Template Package ID to Amulet Service component
  • Reused export of Transfer Factory Interface ID of Token Standard core component in example 15 (remove relevant constant from example itself)
  • Removed conditional logic for Reassignment of Bob's Tokens to Global Synchroniser
  • Removed vetDar() function usage in favour of vetPackage() in example 15 and removed the vetDar() function declaration
  • Moved constants from _config.ts file of Example 15 to SDK config file (sdk/src/config.ts)
  • Removed State namespace and relevant file. Move functionality from it to Ledger Namespace of Wallet SDK

TODO:

  • Unification of Single Synchroniser and Multi Synchroniser into one single test suite (in progress on another PR)
  • Usage of codegen for the command arguments for On-Ledger API submissions based on the DARs
  • Moving of the functions from example to Wallet SDK namespaces or core functions (where possible)

Signed-off-by: vkalashnykov <viktor.kalashnykov@digitalasset.com>
Signed-off-by: vkalashnykov <viktor.kalashnykov@digitalasset.com>
Signed-off-by: vkalashnykov <viktor.kalashnykov@digitalasset.com>
…at could happen in unassign method

Signed-off-by: vkalashnykov <viktor.kalashnykov@digitalasset.com>
@Viktor-Kalashnykov-da
Copy link
Copy Markdown
Author

Further changes done:

  • Added codeine usage for splice-test-token-v1 and splice-token-trading-app
  • Refactoring of Multi Sync example. Some of the functions were moved to SDK or core/test-token and core/trading-app. Also split of _trading_ops.ts into _amulet_ops.ts, _token_setup.ts, _token_allocation.ts and _token_transfer.ts

Unification of single-sync and multi-sync tests is in progress on another PR

Signed-off-by: vkalashnykov <viktor.kalashnykov@digitalasset.com>
Signed-off-by: vkalashnykov <viktor.kalashnykov@digitalasset.com>
Signed-off-by: vkalashnykov <viktor.kalashnykov@digitalasset.com>
Signed-off-by: vkalashnykov <viktor.kalashnykov@digitalasset.com>
Signed-off-by: Viktor-Kalashnykov-da <viktor.kalashnykov@digitalasset.com>
Comment thread wallet-gateway/remote/src/web/frontend/test-helpers.ts Fixed
Signed-off-by: vkalashnykov <viktor.kalashnykov@digitalasset.com>
*
* Unlike {@link DarNamespace.upload}, this function always POSTs the DAR to
* the ledger API regardless of whether the package bytes have already been
* uploaded on another synchronizer. The server deduplicates the binary
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The upload is not done against a synchronizer, but the vetting that is done as part of it is, please clarify

Signed-off-by: vkalashnykov <viktor.kalashnykov@digitalasset.com>
Signed-off-by: vkalashnykov <viktor.kalashnykov@digitalasset.com>
Signed-off-by: vkalashnykov <viktor.kalashnykov@digitalasset.com>
Signed-off-by: vkalashnykov <viktor.kalashnykov@digitalasset.com>
Signed-off-by: vkalashnykov <viktor.kalashnykov@digitalasset.com>
…ade Settlement error

Signed-off-by: vkalashnykov <viktor.kalashnykov@digitalasset.com>
Signed-off-by: vkalashnykov <viktor.kalashnykov@digitalasset.com>
…enamed to vetDar()

Signed-off-by: vkalashnykov <viktor.kalashnykov@digitalasset.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants