@fairmint/canton-node-sdk 0.0.241 → 0.0.243
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/src/clients/ledger-json-api/LedgerJsonApiClient.generated.d.ts +6 -9
- package/build/src/clients/ledger-json-api/LedgerJsonApiClient.generated.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/LedgerJsonApiClient.generated.js +6 -8
- package/build/src/clients/ledger-json-api/LedgerJsonApiClient.generated.js.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/authenticated-user/get.d.ts +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/authenticated-user/get.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/commands/async/submit-reassignment.d.ts +26 -1
- package/build/src/clients/ledger-json-api/operations/v2/commands/async/submit-reassignment.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/commands/async/submit.d.ts +248 -1
- package/build/src/clients/ledger-json-api/operations/v2/commands/async/submit.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/commands/completions.d.ts +7 -1
- package/build/src/clients/ledger-json-api/operations/v2/commands/completions.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/commands/submit-and-wait-for-reassignment.d.ts +86 -1
- package/build/src/clients/ledger-json-api/operations/v2/commands/submit-and-wait-for-reassignment.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/commands/submit-and-wait-for-transaction-tree.d.ts +248 -1
- package/build/src/clients/ledger-json-api/operations/v2/commands/submit-and-wait-for-transaction-tree.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/commands/submit-and-wait-for-transaction.d.ts +310 -1
- package/build/src/clients/ledger-json-api/operations/v2/commands/submit-and-wait-for-transaction.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/commands/submit-and-wait.d.ts +253 -6
- package/build/src/clients/ledger-json-api/operations/v2/commands/submit-and-wait.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/events/get-events-by-contract-id.d.ts +4 -1
- package/build/src/clients/ledger-json-api/operations/v2/events/get-events-by-contract-id.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/idps/delete-idp.d.ts +3 -1
- package/build/src/clients/ledger-json-api/operations/v2/idps/delete-idp.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/idps/get-idp.d.ts +3 -1
- package/build/src/clients/ledger-json-api/operations/v2/idps/get-idp.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/idps/get.d.ts +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/idps/get.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/idps/patch-idp.d.ts +12 -1
- package/build/src/clients/ledger-json-api/operations/v2/idps/patch-idp.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/idps/post.d.ts +9 -1
- package/build/src/clients/ledger-json-api/operations/v2/idps/post.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/execute-and-wait-for-transaction.d.ts +4 -0
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/execute-and-wait-for-transaction.d.ts.map +1 -0
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/execute-and-wait-for-transaction.js +18 -0
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/execute-and-wait-for-transaction.js.map +1 -0
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/execute-and-wait.d.ts +7 -0
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/execute-and-wait.d.ts.map +1 -0
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/execute-and-wait.js +18 -0
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/execute-and-wait.js.map +1 -0
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/execute.d.ts +2 -32
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/execute.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/execute.js +6 -1
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/execute.js.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/get-preferred-package-version.d.ts +10 -3
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/get-preferred-package-version.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/get-preferred-package-version.js +2 -0
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/get-preferred-package-version.js.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/get-preferred-packages.d.ts +8 -1
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/get-preferred-packages.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/get-preferred-packages.js +3 -5
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/get-preferred-packages.js.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/index.d.ts +2 -3
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/index.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/index.js +2 -3
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/index.js.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/prepare.d.ts +2 -225
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/prepare.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/prepare.js +15 -1
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/prepare.js.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/packages/get-package-status.d.ts +3 -1
- package/build/src/clients/ledger-json-api/operations/v2/packages/get-package-status.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/packages/get.d.ts +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/packages/get.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/packages/post.d.ts +6 -1
- package/build/src/clients/ledger-json-api/operations/v2/packages/post.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/parties/external/allocate-external-party.d.ts +21 -1
- package/build/src/clients/ledger-json-api/operations/v2/parties/external/allocate-external-party.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/parties/external/generate-topology.d.ts +13 -1
- package/build/src/clients/ledger-json-api/operations/v2/parties/external/generate-topology.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/parties/get-participant-id.d.ts +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/parties/get-participant-id.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/parties/get-party-details.d.ts +5 -1
- package/build/src/clients/ledger-json-api/operations/v2/parties/get-party-details.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/parties/post.d.ts +10 -1
- package/build/src/clients/ledger-json-api/operations/v2/parties/post.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/parties/update-party-details.d.ts +15 -1
- package/build/src/clients/ledger-json-api/operations/v2/parties/update-party-details.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/state/get-connected-synchronizers.d.ts +4 -1
- package/build/src/clients/ledger-json-api/operations/v2/state/get-connected-synchronizers.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/state/get-latest-pruned-offsets.d.ts +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/state/get-latest-pruned-offsets.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/state/get-ledger-end.d.ts +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/state/get-ledger-end.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/updates/get-transaction-by-id.d.ts +65 -1
- package/build/src/clients/ledger-json-api/operations/v2/updates/get-transaction-by-id.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/updates/get-transaction-by-offset.d.ts +65 -1
- package/build/src/clients/ledger-json-api/operations/v2/updates/get-transaction-by-offset.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/updates/get-transaction-tree-by-id.d.ts +5 -1
- package/build/src/clients/ledger-json-api/operations/v2/updates/get-transaction-tree-by-id.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/updates/get-transaction-tree-by-offset.d.ts +5 -1
- package/build/src/clients/ledger-json-api/operations/v2/updates/get-transaction-tree-by-offset.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/updates/get-update-by-id.d.ts +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/updates/get-update-by-id.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/updates/get-update-by-offset.d.ts +131 -1
- package/build/src/clients/ledger-json-api/operations/v2/updates/get-update-by-offset.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/updates/subscribe-to-updates.d.ts +4 -0
- package/build/src/clients/ledger-json-api/operations/v2/updates/subscribe-to-updates.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/users/create-user.d.ts +30 -1
- package/build/src/clients/ledger-json-api/operations/v2/users/create-user.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/users/delete-user.d.ts +3 -1
- package/build/src/clients/ledger-json-api/operations/v2/users/delete-user.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/users/get-user.d.ts +3 -1
- package/build/src/clients/ledger-json-api/operations/v2/users/get-user.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/users/grant-user-rights.d.ts +44 -1
- package/build/src/clients/ledger-json-api/operations/v2/users/grant-user-rights.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/users/list-user-rights.d.ts +3 -1
- package/build/src/clients/ledger-json-api/operations/v2/users/list-user-rights.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/users/list-users.d.ts +4 -1
- package/build/src/clients/ledger-json-api/operations/v2/users/list-users.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/users/revoke-user-rights.d.ts +44 -1
- package/build/src/clients/ledger-json-api/operations/v2/users/revoke-user-rights.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/users/update-user-identity-provider.d.ts +5 -1
- package/build/src/clients/ledger-json-api/operations/v2/users/update-user-identity-provider.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/users/update-user.d.ts +15 -1
- package/build/src/clients/ledger-json-api/operations/v2/users/update-user.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/version/get.d.ts +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/version/get.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/schemas/api/event-details.d.ts +1 -0
- package/build/src/clients/ledger-json-api/schemas/api/event-details.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/schemas/api/events.d.ts +4 -0
- package/build/src/clients/ledger-json-api/schemas/api/events.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/schemas/api/interactive-submission.d.ts +198 -516
- package/build/src/clients/ledger-json-api/schemas/api/interactive-submission.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/schemas/api/interactive-submission.js +426 -199
- package/build/src/clients/ledger-json-api/schemas/api/interactive-submission.js.map +1 -1
- package/build/src/clients/ledger-json-api/schemas/api/interface-view.d.ts +1 -0
- package/build/src/clients/ledger-json-api/schemas/api/interface-view.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/schemas/api/interface-view.js +3 -4
- package/build/src/clients/ledger-json-api/schemas/api/interface-view.js.map +1 -1
- package/build/src/clients/ledger-json-api/schemas/api/packages.d.ts +34 -14
- package/build/src/clients/ledger-json-api/schemas/api/packages.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/schemas/api/packages.js +24 -19
- package/build/src/clients/ledger-json-api/schemas/api/packages.js.map +1 -1
- package/build/src/clients/ledger-json-api/schemas/api/reassignment.d.ts +4 -0
- package/build/src/clients/ledger-json-api/schemas/api/reassignment.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/schemas/api/state.d.ts +8 -0
- package/build/src/clients/ledger-json-api/schemas/api/state.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/schemas/api/transactions.d.ts +4 -0
- package/build/src/clients/ledger-json-api/schemas/api/transactions.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/schemas/api/updates.d.ts +24 -0
- package/build/src/clients/ledger-json-api/schemas/api/updates.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/schemas/index.d.ts +1 -0
- package/build/src/clients/ledger-json-api/schemas/index.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/schemas/index.js +2 -0
- package/build/src/clients/ledger-json-api/schemas/index.js.map +1 -1
- package/build/src/clients/ledger-json-api/schemas/operations/interactive-submission.d.ts +5 -50
- package/build/src/clients/ledger-json-api/schemas/operations/interactive-submission.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/schemas/operations/interactive-submission.js +16 -66
- package/build/src/clients/ledger-json-api/schemas/operations/interactive-submission.js.map +1 -1
- package/build/src/clients/ledger-json-api/schemas/wire.d.ts +14 -0
- package/build/src/clients/ledger-json-api/schemas/wire.d.ts.map +1 -0
- package/build/src/clients/ledger-json-api/schemas/wire.js +49 -0
- package/build/src/clients/ledger-json-api/schemas/wire.js.map +1 -0
- package/build/src/clients/scan-api/ScanApiClient.generated.d.ts +4 -0
- package/build/src/clients/scan-api/ScanApiClient.generated.d.ts.map +1 -1
- package/build/src/clients/scan-api/ScanApiClient.generated.js +2 -0
- package/build/src/clients/scan-api/ScanApiClient.generated.js.map +1 -1
- package/build/src/clients/scan-api/operations/v0/registry/allocation/index.d.ts +2 -0
- package/build/src/clients/scan-api/operations/v0/registry/allocation/index.d.ts.map +1 -0
- package/build/src/clients/scan-api/operations/v0/registry/allocation/index.js +18 -0
- package/build/src/clients/scan-api/operations/v0/registry/allocation/index.js.map +1 -0
- package/build/src/clients/scan-api/operations/v0/registry/allocation/v2/get-settlement-factory-from-registry.d.ts +141 -0
- package/build/src/clients/scan-api/operations/v0/registry/allocation/v2/get-settlement-factory-from-registry.d.ts.map +1 -0
- package/build/src/clients/scan-api/operations/v0/registry/allocation/v2/get-settlement-factory-from-registry.js +52 -0
- package/build/src/clients/scan-api/operations/v0/registry/allocation/v2/get-settlement-factory-from-registry.js.map +1 -0
- package/build/src/clients/scan-api/operations/v0/registry/allocation/v2/index.d.ts +2 -0
- package/build/src/clients/scan-api/operations/v0/registry/allocation/v2/index.d.ts.map +1 -0
- package/build/src/clients/scan-api/operations/v0/registry/allocation/v2/index.js +18 -0
- package/build/src/clients/scan-api/operations/v0/registry/allocation/v2/index.js.map +1 -0
- package/build/src/clients/scan-api/operations/v0/registry/allocation-instruction/v1/get-allocation-factory-from-registry.d.ts +29 -1
- package/build/src/clients/scan-api/operations/v0/registry/allocation-instruction/v1/get-allocation-factory-from-registry.d.ts.map +1 -1
- package/build/src/clients/scan-api/operations/v0/registry/allocation-instruction/v2/get-allocation-factory-v2-from-registry.d.ts +29 -1
- package/build/src/clients/scan-api/operations/v0/registry/allocation-instruction/v2/get-allocation-factory-v2-from-registry.d.ts.map +1 -1
- package/build/src/clients/scan-api/operations/v0/registry/index.d.ts +1 -0
- package/build/src/clients/scan-api/operations/v0/registry/index.d.ts.map +1 -1
- package/build/src/clients/scan-api/operations/v0/registry/index.js +1 -0
- package/build/src/clients/scan-api/operations/v0/registry/index.js.map +1 -1
- package/build/src/clients/scan-api/operations/v0/registry/metadata/v1/get-instrument.d.ts +3 -1
- package/build/src/clients/scan-api/operations/v0/registry/metadata/v1/get-instrument.d.ts.map +1 -1
- package/build/src/clients/scan-api/operations/v0/registry/metadata/v1/get-registry-info.d.ts +1 -1
- package/build/src/clients/scan-api/operations/v0/registry/metadata/v1/get-registry-info.d.ts.map +1 -1
- package/build/src/clients/scan-api/operations/v0/registry/metadata/v1/list-instruments.d.ts +4 -1
- package/build/src/clients/scan-api/operations/v0/registry/metadata/v1/list-instruments.d.ts.map +1 -1
- package/build/src/clients/scan-api/operations/v0/scan.d.ts +214 -57
- package/build/src/clients/scan-api/operations/v0/scan.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/admin/create-external-party-setup-proposal.d.ts +3 -1
- package/build/src/clients/validator-api/operations/v0/admin/create-external-party-setup-proposal.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/admin/create-user.d.ts +5 -1
- package/build/src/clients/validator-api/operations/v0/admin/create-user.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/admin/dump-participant-identities.d.ts +1 -1
- package/build/src/clients/validator-api/operations/v0/admin/dump-participant-identities.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/admin/generate-external-party-topology.d.ts +4 -1
- package/build/src/clients/validator-api/operations/v0/admin/generate-external-party-topology.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/admin/get-decentralized-synchronizer-connection-config.d.ts +1 -1
- package/build/src/clients/validator-api/operations/v0/admin/get-decentralized-synchronizer-connection-config.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/admin/get-external-party-balance.d.ts +3 -1
- package/build/src/clients/validator-api/operations/v0/admin/get-external-party-balance.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/admin/list-external-party-setup-proposals.d.ts +1 -1
- package/build/src/clients/validator-api/operations/v0/admin/list-external-party-setup-proposals.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/admin/list-users.d.ts +1 -1
- package/build/src/clients/validator-api/operations/v0/admin/list-users.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/admin/prepare-accept-external-party-setup-proposal.d.ts +5 -1
- package/build/src/clients/validator-api/operations/v0/admin/prepare-accept-external-party-setup-proposal.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/admin/prepare-transfer-preapproval-send.d.ts +9 -1
- package/build/src/clients/validator-api/operations/v0/admin/prepare-transfer-preapproval-send.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/admin/submit-accept-external-party-setup-proposal.d.ts +3 -1
- package/build/src/clients/validator-api/operations/v0/admin/submit-accept-external-party-setup-proposal.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/admin/submit-external-party-topology.d.ts +4 -1
- package/build/src/clients/validator-api/operations/v0/admin/submit-external-party-topology.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/admin/submit-transfer-preapproval-send.d.ts +3 -1
- package/build/src/clients/validator-api/operations/v0/admin/submit-transfer-preapproval-send.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/ans/create-entry.d.ts +5 -1
- package/build/src/clients/validator-api/operations/v0/ans/create-entry.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/ans/get-rules.d.ts +4 -1
- package/build/src/clients/validator-api/operations/v0/ans/get-rules.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/ans/list-owned-entries.d.ts +1 -1
- package/build/src/clients/validator-api/operations/v0/ans/list-owned-entries.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/ans/lookup-by-name.d.ts +3 -1
- package/build/src/clients/validator-api/operations/v0/ans/lookup-by-name.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/ans/lookup-by-party.d.ts +3 -1
- package/build/src/clients/validator-api/operations/v0/ans/lookup-by-party.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/get-validator-user-info.d.ts +1 -1
- package/build/src/clients/validator-api/operations/v0/get-validator-user-info.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/health.d.ts +2 -2
- package/build/src/clients/validator-api/operations/v0/health.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/register.d.ts +1 -1
- package/build/src/clients/validator-api/operations/v0/register.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/get-amulet-rules.d.ts +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/get-amulet-rules.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/get-dso-info.d.ts +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/get-dso-info.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/get-dso-party-id.d.ts +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/get-dso-party-id.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/get-holdings-summary-at-v1.d.ts +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/get-holdings-summary-at-v1.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/get-mining-round-details.d.ts +3 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/get-mining-round-details.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/get-open-and-issuing-mining-rounds.d.ts +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/get-open-and-issuing-mining-rounds.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/list-ans-entries.d.ts +4 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/list-ans-entries.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/list-unclaimed-development-fund-coupons.d.ts +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/list-unclaimed-development-fund-coupons.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/lookup-featured-app-right.d.ts +3 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/lookup-featured-app-right.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/lookup-transfer-command-counter-by-party.d.ts +3 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/lookup-transfer-command-counter-by-party.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/lookup-transfer-command-status.d.ts +4 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/lookup-transfer-command-status.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/lookup-transfer-preapproval-by-party.d.ts +3 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/lookup-transfer-preapproval-by-party.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/registry/allocation-instruction/v1/get-allocation-factory.d.ts +28 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/registry/allocation-instruction/v1/get-allocation-factory.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/registry/allocations/v1/get-allocation-cancel-context.d.ts +5 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/registry/allocations/v1/get-allocation-cancel-context.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/registry/allocations/v1/get-allocation-transfer-context.d.ts +5 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/registry/allocations/v1/get-allocation-transfer-context.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/registry/allocations/v1/get-allocation-withdraw-context.d.ts +5 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/registry/allocations/v1/get-allocation-withdraw-context.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/registry/metadata/v1/get-instrument.d.ts +3 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/registry/metadata/v1/get-instrument.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/registry/metadata/v1/get-registry-info.d.ts +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/registry/metadata/v1/get-registry-info.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/registry/metadata/v1/list-instruments.d.ts +4 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/registry/metadata/v1/list-instruments.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/registry/transfer-instruction/v1/get-transfer-factory.d.ts +28 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/registry/transfer-instruction/v1/get-transfer-factory.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/registry/transfer-instruction/v1/get-transfer-instruction-accept-context.d.ts +5 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/registry/transfer-instruction/v1/get-transfer-instruction-accept-context.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/registry/transfer-instruction/v1/get-transfer-instruction-reject-context.d.ts +5 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/registry/transfer-instruction/v1/get-transfer-instruction-reject-context.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/registry/transfer-instruction/v1/get-transfer-instruction-withdraw-context.d.ts +5 -1
- package/build/src/clients/validator-api/operations/v0/scan-proxy/registry/transfer-instruction/v1/get-transfer-instruction-withdraw-context.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/wallet/buy-traffic-requests/create.d.ts +4 -1
- package/build/src/clients/validator-api/operations/v0/wallet/buy-traffic-requests/create.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/wallet/buy-traffic-requests/get-status.d.ts +3 -1
- package/build/src/clients/validator-api/operations/v0/wallet/buy-traffic-requests/get-status.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/wallet/get-amulets.d.ts +1 -1
- package/build/src/clients/validator-api/operations/v0/wallet/get-amulets.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/wallet/get-balance.d.ts +1 -1
- package/build/src/clients/validator-api/operations/v0/wallet/get-balance.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/wallet/get-user-status.d.ts +1 -1
- package/build/src/clients/validator-api/operations/v0/wallet/get-user-status.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/wallet/list-transactions.d.ts +4 -1
- package/build/src/clients/validator-api/operations/v0/wallet/list-transactions.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/wallet/tap.d.ts +4 -1
- package/build/src/clients/validator-api/operations/v0/wallet/tap.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/wallet/token-standard/transfers/create.d.ts +7 -1
- package/build/src/clients/validator-api/operations/v0/wallet/token-standard/transfers/create.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/wallet/token-standard/transfers/list.d.ts +1 -1
- package/build/src/clients/validator-api/operations/v0/wallet/token-standard/transfers/list.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/wallet/transfer-offers/accept.d.ts +3 -1
- package/build/src/clients/validator-api/operations/v0/wallet/transfer-offers/accept.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/wallet/transfer-offers/create.d.ts +7 -1
- package/build/src/clients/validator-api/operations/v0/wallet/transfer-offers/create.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/wallet/transfer-offers/get-status.d.ts +3 -1
- package/build/src/clients/validator-api/operations/v0/wallet/transfer-offers/get-status.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/wallet/transfer-offers/list.d.ts +1 -1
- package/build/src/clients/validator-api/operations/v0/wallet/transfer-offers/list.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/wallet/transfer-offers/reject.d.ts +3 -1
- package/build/src/clients/validator-api/operations/v0/wallet/transfer-offers/reject.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/wallet/transfer-offers/withdraw.d.ts +3 -1
- package/build/src/clients/validator-api/operations/v0/wallet/transfer-offers/withdraw.d.ts.map +1 -1
- package/build/src/clients/validator-api/operations/v0/wallet/transfer-preapproval-send.d.ts +6 -1
- package/build/src/clients/validator-api/operations/v0/wallet/transfer-preapproval-send.d.ts.map +1 -1
- package/build/src/core/operations/ApiOperation.d.ts +3 -2
- package/build/src/core/operations/ApiOperation.d.ts.map +1 -1
- package/build/src/core/operations/ApiOperation.js +11 -0
- package/build/src/core/operations/ApiOperation.js.map +1 -1
- package/build/src/core/operations/ApiOperationFactory.d.ts +13 -1
- package/build/src/core/operations/ApiOperationFactory.d.ts.map +1 -1
- package/build/src/core/operations/ApiOperationFactory.js +34 -15
- package/build/src/core/operations/ApiOperationFactory.js.map +1 -1
- package/build/src/core/operations/operation-execute-options.d.ts +4 -0
- package/build/src/core/operations/operation-execute-options.d.ts.map +1 -1
- package/build/src/core/operations/operation-execute-options.js.map +1 -1
- package/build/src/utils/amulet/external-party-transfer-offer.d.ts +3 -3
- package/build/src/utils/amulet/external-party-transfer-offer.d.ts.map +1 -1
- package/build/src/utils/amulet/external-party-transfer-offer.js +1 -7
- package/build/src/utils/amulet/external-party-transfer-offer.js.map +1 -1
- package/build/src/utils/external-signing/execute-external-transaction.d.ts +23 -12
- package/build/src/utils/external-signing/execute-external-transaction.d.ts.map +1 -1
- package/build/src/utils/external-signing/execute-external-transaction.js +28 -16
- package/build/src/utils/external-signing/execute-external-transaction.js.map +1 -1
- package/build/src/utils/external-signing/external-party-wallet.d.ts +4 -3
- package/build/src/utils/external-signing/external-party-wallet.d.ts.map +1 -1
- package/build/src/utils/external-signing/external-party-wallet.js.map +1 -1
- package/build/src/utils/external-signing/external-signing-client.d.ts +3 -3
- package/build/src/utils/external-signing/external-signing-client.d.ts.map +1 -1
- package/build/src/utils/external-signing/external-signing-client.js +1 -1
- package/build/src/utils/external-signing/external-signing-client.js.map +1 -1
- package/build/src/utils/external-signing/prepare-external-transaction.d.ts +20 -13
- package/build/src/utils/external-signing/prepare-external-transaction.d.ts.map +1 -1
- package/build/src/utils/external-signing/prepare-external-transaction.js +15 -13
- package/build/src/utils/external-signing/prepare-external-transaction.js.map +1 -1
- package/build/src/utils/token-standard/v2/allocation-state.d.ts +104 -0
- package/build/src/utils/token-standard/v2/allocation-state.d.ts.map +1 -0
- package/build/src/utils/token-standard/v2/allocation-state.js +638 -0
- package/build/src/utils/token-standard/v2/allocation-state.js.map +1 -0
- package/build/src/utils/token-standard/v2/index.d.ts +2 -0
- package/build/src/utils/token-standard/v2/index.d.ts.map +1 -1
- package/build/src/utils/token-standard/v2/index.js +2 -0
- package/build/src/utils/token-standard/v2/index.js.map +1 -1
- package/build/src/utils/token-standard/v2/settlement-factory.d.ts +83 -0
- package/build/src/utils/token-standard/v2/settlement-factory.d.ts.map +1 -0
- package/build/src/utils/token-standard/v2/settlement-factory.js +383 -0
- package/build/src/utils/token-standard/v2/settlement-factory.js.map +1 -0
- package/build/src/utils/traffic/estimate-traffic-cost.d.ts +3 -0
- package/build/src/utils/traffic/estimate-traffic-cost.d.ts.map +1 -1
- package/build/src/utils/traffic/estimate-traffic-cost.js +8 -4
- package/build/src/utils/traffic/estimate-traffic-cost.js.map +1 -1
- package/build/src/utils/traffic/get-estimated-traffic-cost.js +1 -1
- package/build/src/utils/traffic/get-estimated-traffic-cost.js.map +1 -1
- package/build/src/utils/traffic/types.d.ts +1 -1
- package/build/src/utils/traffic/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/allocate-party.d.ts +0 -25
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/allocate-party.d.ts.map +0 -1
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/allocate-party.js +0 -29
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/allocate-party.js.map +0 -1
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/create-user.d.ts +0 -62
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/create-user.d.ts.map +0 -1
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/create-user.js +0 -34
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/create-user.js.map +0 -1
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/upload-dar.d.ts +0 -15
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/upload-dar.d.ts.map +0 -1
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/upload-dar.js +0 -25
- package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/upload-dar.js.map +0 -1
|
@@ -0,0 +1,638 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TokenStandardV2AllocationStateError = exports.TokenStandardV2AllocationStateErrorCode = exports.TOKEN_STANDARD_V2_ALLOCATION_INSTRUCTION_INTERFACE_ID = exports.TOKEN_STANDARD_V2_ALLOCATION_INTERFACE_ID = void 0;
|
|
4
|
+
exports.getTokenStandardV2AllocationViewsByContractIds = getTokenStandardV2AllocationViewsByContractIds;
|
|
5
|
+
exports.discoverTokenStandardV2AllocationState = discoverTokenStandardV2AllocationState;
|
|
6
|
+
const errors_1 = require("../../../core/errors");
|
|
7
|
+
const utils_1 = require("../../../core/utils");
|
|
8
|
+
const contracts_1 = require("../../contracts");
|
|
9
|
+
exports.TOKEN_STANDARD_V2_ALLOCATION_INTERFACE_ID = '#splice-api-token-allocation-v2:Splice.Api.Token.AllocationV2:Allocation';
|
|
10
|
+
exports.TOKEN_STANDARD_V2_ALLOCATION_INSTRUCTION_INTERFACE_ID = '#splice-api-token-allocation-instruction-v2:Splice.Api.Token.AllocationInstructionV2:AllocationInstruction';
|
|
11
|
+
exports.TokenStandardV2AllocationStateErrorCode = {
|
|
12
|
+
INPUT_INVALID: 'TOKEN_STANDARD_V2_ALLOCATION_STATE_INPUT_INVALID',
|
|
13
|
+
INTERFACE_VIEW_INVALID: 'TOKEN_STANDARD_V2_ALLOCATION_STATE_INTERFACE_VIEW_INVALID',
|
|
14
|
+
ACS_INCOMPLETE: 'TOKEN_STANDARD_V2_ALLOCATION_STATE_ACS_INCOMPLETE',
|
|
15
|
+
AMBIGUOUS: 'TOKEN_STANDARD_V2_ALLOCATION_STATE_AMBIGUOUS',
|
|
16
|
+
NOT_FOUND: 'TOKEN_STANDARD_V2_ALLOCATION_STATE_NOT_FOUND',
|
|
17
|
+
};
|
|
18
|
+
/** Typed failure raised while recovering a Token Standard V2 allocation state from the ACS. */
|
|
19
|
+
class TokenStandardV2AllocationStateError extends errors_1.CantonError {
|
|
20
|
+
constructor(code, message, context) {
|
|
21
|
+
super(message, code, context);
|
|
22
|
+
this.name = 'TokenStandardV2AllocationStateError';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.TokenStandardV2AllocationStateError = TokenStandardV2AllocationStateError;
|
|
26
|
+
function inputInvalid(message, context) {
|
|
27
|
+
throw new TokenStandardV2AllocationStateError(exports.TokenStandardV2AllocationStateErrorCode.INPUT_INVALID, message, context);
|
|
28
|
+
}
|
|
29
|
+
function interfaceViewInvalid(message, context) {
|
|
30
|
+
throw new TokenStandardV2AllocationStateError(exports.TokenStandardV2AllocationStateErrorCode.INTERFACE_VIEW_INVALID, message, context);
|
|
31
|
+
}
|
|
32
|
+
function acsIncomplete(message, context) {
|
|
33
|
+
throw new TokenStandardV2AllocationStateError(exports.TokenStandardV2AllocationStateErrorCode.ACS_INCOMPLETE, message, context);
|
|
34
|
+
}
|
|
35
|
+
function notFound(message, context) {
|
|
36
|
+
throw new TokenStandardV2AllocationStateError(exports.TokenStandardV2AllocationStateErrorCode.NOT_FOUND, message, context);
|
|
37
|
+
}
|
|
38
|
+
function requireTrimmedNonEmpty(value, field, invalid) {
|
|
39
|
+
if (!(0, utils_1.isNonEmptyString)(value)) {
|
|
40
|
+
invalid(`${field} must be a non-empty string.`, { field, value });
|
|
41
|
+
}
|
|
42
|
+
return value.trim();
|
|
43
|
+
}
|
|
44
|
+
function requireText(value, field, invalid) {
|
|
45
|
+
if (typeof value !== 'string') {
|
|
46
|
+
invalid(`${field} must be a string.`, { field, value });
|
|
47
|
+
}
|
|
48
|
+
return value;
|
|
49
|
+
}
|
|
50
|
+
function readNullableNonEmptyString(value, field, invalid) {
|
|
51
|
+
return value === null || value === undefined ? null : requireTrimmedNonEmpty(value, field, invalid);
|
|
52
|
+
}
|
|
53
|
+
function mapDenseArray(value, field, invalid, transform) {
|
|
54
|
+
const result = [];
|
|
55
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
56
|
+
if (!(index in value)) {
|
|
57
|
+
invalid(`${field} must not contain missing elements.`, { field: `${field}[${index}]` });
|
|
58
|
+
}
|
|
59
|
+
result.push(transform(value[index], index));
|
|
60
|
+
}
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
function readStringArray(value, field, invalid, options) {
|
|
64
|
+
if (!Array.isArray(value) || (!options.allowEmpty && value.length === 0)) {
|
|
65
|
+
invalid(`${field} must be ${options.allowEmpty ? 'an array' : 'a non-empty array'}.`, { field, value });
|
|
66
|
+
}
|
|
67
|
+
return mapDenseArray(value, field, invalid, (item, index) => {
|
|
68
|
+
const itemField = `${field}[${index}]`;
|
|
69
|
+
return options.trim ? requireTrimmedNonEmpty(item, itemField, invalid) : requireText(item, itemField, invalid);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function createReadonlyStringRecord(entries) {
|
|
73
|
+
const result = Object.create(null);
|
|
74
|
+
for (const [key, value] of entries) {
|
|
75
|
+
Object.defineProperty(result, key, {
|
|
76
|
+
value,
|
|
77
|
+
enumerable: true,
|
|
78
|
+
configurable: true,
|
|
79
|
+
writable: false,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return result;
|
|
83
|
+
}
|
|
84
|
+
function readMetadata(value, field, invalid) {
|
|
85
|
+
if (!(0, utils_1.isRecord)(value) || !(0, utils_1.isRecord)(value['values'])) {
|
|
86
|
+
invalid(`${field} must contain a values record.`, { field, value });
|
|
87
|
+
}
|
|
88
|
+
const entries = Object.entries(value['values']).map(([key, metadataValue]) => {
|
|
89
|
+
if (typeof metadataValue !== 'string') {
|
|
90
|
+
invalid(`${field}.values must contain only strings.`, { field, key, value: metadataValue });
|
|
91
|
+
}
|
|
92
|
+
return [key, metadataValue];
|
|
93
|
+
});
|
|
94
|
+
return { values: createReadonlyStringRecord(entries) };
|
|
95
|
+
}
|
|
96
|
+
function readAccount(value, field, invalid) {
|
|
97
|
+
if (!(0, utils_1.isRecord)(value)) {
|
|
98
|
+
invalid(`${field} must be a Token Standard V2 account.`, { field, value });
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
owner: readNullableNonEmptyString(value['owner'], `${field}.owner`, invalid),
|
|
102
|
+
provider: readNullableNonEmptyString(value['provider'], `${field}.provider`, invalid),
|
|
103
|
+
id: requireText(value['id'], `${field}.id`, invalid),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function readDecimal(value, field, invalid, allowZero) {
|
|
107
|
+
const text = requireText(value, field, invalid);
|
|
108
|
+
const match = /^(\d{1,28})(?:\.(\d{1,10}))?$/.exec(text);
|
|
109
|
+
if (!match || (!allowZero && /^0+$/.test(`${match[1]}${match[2] ?? ''}`))) {
|
|
110
|
+
invalid(`${field} must be a ${allowZero ? 'non-negative' : 'positive'} Daml Decimal string.`, {
|
|
111
|
+
field,
|
|
112
|
+
value,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
return text;
|
|
116
|
+
}
|
|
117
|
+
function readDecimalMap(value, field, invalid) {
|
|
118
|
+
if (value === null || value === undefined)
|
|
119
|
+
return null;
|
|
120
|
+
if (!(0, utils_1.isRecord)(value)) {
|
|
121
|
+
invalid(`${field} must be null or a decimal map.`, { field, value });
|
|
122
|
+
}
|
|
123
|
+
return createReadonlyStringRecord(Object.entries(value).map(([key, amount]) => [key, readDecimal(amount, `${field}.${key}`, invalid, false)]));
|
|
124
|
+
}
|
|
125
|
+
function readSettlement(value, field, invalid) {
|
|
126
|
+
if (!(0, utils_1.isRecord)(value)) {
|
|
127
|
+
invalid(`${field} must be a settlement record.`, { field, value });
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
executors: readStringArray(value['executors'], `${field}.executors`, invalid, {
|
|
131
|
+
allowEmpty: false,
|
|
132
|
+
trim: true,
|
|
133
|
+
}),
|
|
134
|
+
id: requireText(value['id'], `${field}.id`, invalid),
|
|
135
|
+
cid: readNullableNonEmptyString(value['cid'], `${field}.cid`, invalid),
|
|
136
|
+
meta: readMetadata(value['meta'], `${field}.meta`, invalid),
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
function readAllocation(value, field, invalid) {
|
|
140
|
+
if (!(0, utils_1.isRecord)(value) || !Array.isArray(value['transferLegSides'])) {
|
|
141
|
+
invalid(`${field} must be an allocation record.`, { field, value });
|
|
142
|
+
}
|
|
143
|
+
const transferLegSides = mapDenseArray(value['transferLegSides'], `${field}.transferLegSides`, invalid, (transferLegSide, index) => {
|
|
144
|
+
const legField = `${field}.transferLegSides[${index}]`;
|
|
145
|
+
if (!(0, utils_1.isRecord)(transferLegSide)) {
|
|
146
|
+
invalid(`${legField} must be a transfer-leg side.`, { field: legField, value: transferLegSide });
|
|
147
|
+
}
|
|
148
|
+
const { side } = transferLegSide;
|
|
149
|
+
if (side !== 'SenderSide' && side !== 'ReceiverSide') {
|
|
150
|
+
invalid(`${legField}.side must be SenderSide or ReceiverSide.`, {
|
|
151
|
+
field: `${legField}.side`,
|
|
152
|
+
value: side,
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
const normalizedSide = side === 'SenderSide' ? 'SenderSide' : 'ReceiverSide';
|
|
156
|
+
return {
|
|
157
|
+
transferLegId: requireText(transferLegSide['transferLegId'], `${legField}.transferLegId`, invalid),
|
|
158
|
+
side: normalizedSide,
|
|
159
|
+
otherside: readAccount(transferLegSide['otherside'], `${legField}.otherside`, invalid),
|
|
160
|
+
amount: readDecimal(transferLegSide['amount'], `${legField}.amount`, invalid, false),
|
|
161
|
+
instrumentId: requireText(transferLegSide['instrumentId'], `${legField}.instrumentId`, invalid),
|
|
162
|
+
meta: readMetadata(transferLegSide['meta'], `${legField}.meta`, invalid),
|
|
163
|
+
};
|
|
164
|
+
});
|
|
165
|
+
const transferLegSideKeys = transferLegSides.map(({ side, transferLegId }) => JSON.stringify([transferLegId, side]));
|
|
166
|
+
if (new Set(transferLegSideKeys).size !== transferLegSideKeys.length) {
|
|
167
|
+
invalid(`${field}.transferLegSides must not contain duplicate transfer-leg sides.`, {
|
|
168
|
+
field: `${field}.transferLegSides`,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
const nextIterationFunding = readDecimalMap(value['nextIterationFunding'], `${field}.nextIterationFunding`, invalid);
|
|
172
|
+
if (transferLegSides.length === 0 && nextIterationFunding === null) {
|
|
173
|
+
invalid(`${field}.transferLegSides may be empty only when iterated settlement is enabled.`, {
|
|
174
|
+
field: `${field}.transferLegSides`,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
if (typeof value['committed'] !== 'boolean') {
|
|
178
|
+
invalid(`${field}.committed must be a boolean.`, { field: `${field}.committed`, value: value['committed'] });
|
|
179
|
+
}
|
|
180
|
+
return {
|
|
181
|
+
admin: requireTrimmedNonEmpty(value['admin'], `${field}.admin`, invalid),
|
|
182
|
+
authorizer: readAccount(value['authorizer'], `${field}.authorizer`, invalid),
|
|
183
|
+
transferLegSides,
|
|
184
|
+
settlementDeadline: readNullableNonEmptyString(value['settlementDeadline'], `${field}.settlementDeadline`, invalid),
|
|
185
|
+
nextIterationFunding,
|
|
186
|
+
committed: value['committed'],
|
|
187
|
+
meta: readMetadata(value['meta'], `${field}.meta`, invalid),
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
function readRequest(value) {
|
|
191
|
+
if (!(0, utils_1.isRecord)(value)) {
|
|
192
|
+
inputInvalid('request must be a Token Standard V2 allocation request.', { field: 'request', value });
|
|
193
|
+
}
|
|
194
|
+
return {
|
|
195
|
+
settlement: readSettlement(value['settlement'], 'request.settlement', inputInvalid),
|
|
196
|
+
allocation: readAllocation(value['allocation'], 'request.allocation', inputInvalid),
|
|
197
|
+
requestedAt: requireTrimmedNonEmpty(value['requestedAt'], 'request.requestedAt', inputInvalid),
|
|
198
|
+
inputHoldingCids: readStringArray(value['inputHoldingCids'], 'request.inputHoldingCids', inputInvalid, {
|
|
199
|
+
allowEmpty: true,
|
|
200
|
+
trim: true,
|
|
201
|
+
}),
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
function readNonNegativeInteger(value, field, invalid) {
|
|
205
|
+
if (typeof value === 'number' && Number.isSafeInteger(value) && value >= 0)
|
|
206
|
+
return value.toString();
|
|
207
|
+
if (typeof value === 'string' && /^\d+$/.test(value))
|
|
208
|
+
return BigInt(value).toString();
|
|
209
|
+
invalid(`${field} must be a non-negative integer.`, { field, value });
|
|
210
|
+
}
|
|
211
|
+
function readAllocationViewIdentity(value, context) {
|
|
212
|
+
if (!(0, utils_1.isRecord)(value)) {
|
|
213
|
+
interfaceViewInvalid('AllocationV2 interface view must be a record.', context);
|
|
214
|
+
}
|
|
215
|
+
const invalid = (message, fieldContext) => interfaceViewInvalid(message, { ...context, ...fieldContext });
|
|
216
|
+
return {
|
|
217
|
+
value,
|
|
218
|
+
settlement: readSettlement(value['settlement'], 'view.settlement', invalid),
|
|
219
|
+
allocation: readAllocation(value['allocation'], 'view.allocation', invalid),
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
function readAllocationView(identity, context) {
|
|
223
|
+
const { value } = identity;
|
|
224
|
+
if (!('availableActions' in value)) {
|
|
225
|
+
interfaceViewInvalid('AllocationV2 interface view is missing availableActions.', context);
|
|
226
|
+
}
|
|
227
|
+
const invalid = (message, fieldContext) => interfaceViewInvalid(message, { ...context, ...fieldContext });
|
|
228
|
+
return {
|
|
229
|
+
originalAllocationCid: readNullableNonEmptyString(value['originalAllocationCid'], 'view.originalAllocationCid', invalid),
|
|
230
|
+
settlement: identity.settlement,
|
|
231
|
+
allocation: identity.allocation,
|
|
232
|
+
holdingCids: readStringArray(value['holdingCids'], 'view.holdingCids', invalid, {
|
|
233
|
+
allowEmpty: true,
|
|
234
|
+
trim: true,
|
|
235
|
+
}),
|
|
236
|
+
createdAt: requireTrimmedNonEmpty(value['createdAt'], 'view.createdAt', invalid),
|
|
237
|
+
numIterations: readNonNegativeInteger(value['numIterations'], 'view.numIterations', invalid),
|
|
238
|
+
expiresAt: readNullableNonEmptyString(value['expiresAt'], 'view.expiresAt', invalid),
|
|
239
|
+
availableActions: value['availableActions'],
|
|
240
|
+
meta: readMetadata(value['meta'], 'view.meta', invalid),
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
function readAllocationInstructionViewIdentity(value, context) {
|
|
244
|
+
if (!(0, utils_1.isRecord)(value)) {
|
|
245
|
+
interfaceViewInvalid('AllocationInstructionV2 interface view must be a record.', context);
|
|
246
|
+
}
|
|
247
|
+
const invalid = (message, fieldContext) => interfaceViewInvalid(message, { ...context, ...fieldContext });
|
|
248
|
+
return {
|
|
249
|
+
value,
|
|
250
|
+
settlement: readSettlement(value['settlement'], 'view.settlement', invalid),
|
|
251
|
+
allocation: readAllocation(value['allocation'], 'view.allocation', invalid),
|
|
252
|
+
requestedAt: requireTrimmedNonEmpty(value['requestedAt'], 'view.requestedAt', invalid),
|
|
253
|
+
inputHoldingCids: readStringArray(value['inputHoldingCids'], 'view.inputHoldingCids', invalid, {
|
|
254
|
+
allowEmpty: true,
|
|
255
|
+
trim: true,
|
|
256
|
+
}),
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
function readAllocationInstructionView(identity, context) {
|
|
260
|
+
const { value } = identity;
|
|
261
|
+
if (!('availableActions' in value)) {
|
|
262
|
+
interfaceViewInvalid('AllocationInstructionV2 interface view is missing availableActions.', context);
|
|
263
|
+
}
|
|
264
|
+
const invalid = (message, fieldContext) => interfaceViewInvalid(message, { ...context, ...fieldContext });
|
|
265
|
+
return {
|
|
266
|
+
originalInstructionCid: readNullableNonEmptyString(value['originalInstructionCid'], 'view.originalInstructionCid', invalid),
|
|
267
|
+
settlement: identity.settlement,
|
|
268
|
+
allocation: identity.allocation,
|
|
269
|
+
requestedAt: identity.requestedAt,
|
|
270
|
+
inputHoldingCids: identity.inputHoldingCids,
|
|
271
|
+
expiresAt: readNullableNonEmptyString(value['expiresAt'], 'view.expiresAt', invalid),
|
|
272
|
+
availableActions: value['availableActions'],
|
|
273
|
+
meta: readMetadata(value['meta'], 'view.meta', invalid),
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
function identifierModuleEntitySuffix(identifier) {
|
|
277
|
+
const separator = identifier.indexOf(':');
|
|
278
|
+
return separator === -1 ? undefined : identifier.slice(separator + 1);
|
|
279
|
+
}
|
|
280
|
+
function interfaceIdsMatch(left, right) {
|
|
281
|
+
return identifierModuleEntitySuffix(left) === identifierModuleEntitySuffix(right);
|
|
282
|
+
}
|
|
283
|
+
function arraysEqual(left, right, equal) {
|
|
284
|
+
if (left.length !== right.length)
|
|
285
|
+
return false;
|
|
286
|
+
for (let index = 0; index < left.length; index += 1) {
|
|
287
|
+
if (!(index in left) || !(index in right) || !equal(left[index], right[index]))
|
|
288
|
+
return false;
|
|
289
|
+
}
|
|
290
|
+
return true;
|
|
291
|
+
}
|
|
292
|
+
function stringArraysEqual(left, right) {
|
|
293
|
+
return arraysEqual(left, right, (a, b) => a === b);
|
|
294
|
+
}
|
|
295
|
+
function metadataEqual(left, right) {
|
|
296
|
+
const leftKeys = Object.keys(left.values).sort();
|
|
297
|
+
const rightKeys = Object.keys(right.values).sort();
|
|
298
|
+
return stringArraysEqual(leftKeys, rightKeys) && leftKeys.every((key) => left.values[key] === right.values[key]);
|
|
299
|
+
}
|
|
300
|
+
function canonicalDecimal(value) {
|
|
301
|
+
const match = /^(\d+)(?:\.(\d+))?$/.exec(value);
|
|
302
|
+
if (!match)
|
|
303
|
+
return undefined;
|
|
304
|
+
const whole = (match[1] ?? '').replace(/^0+(?=\d)/, '');
|
|
305
|
+
const fraction = (match[2] ?? '').replace(/0+$/, '');
|
|
306
|
+
return fraction.length === 0 ? whole : `${whole}.${fraction}`;
|
|
307
|
+
}
|
|
308
|
+
function decimalsEqual(left, right) {
|
|
309
|
+
const canonicalLeft = canonicalDecimal(left);
|
|
310
|
+
const canonicalRight = canonicalDecimal(right);
|
|
311
|
+
return canonicalLeft !== undefined && canonicalLeft === canonicalRight;
|
|
312
|
+
}
|
|
313
|
+
function decimalMapsEqual(left, right) {
|
|
314
|
+
if (left === null || right === null)
|
|
315
|
+
return left === right;
|
|
316
|
+
const leftKeys = Object.keys(left).sort();
|
|
317
|
+
const rightKeys = Object.keys(right).sort();
|
|
318
|
+
return (stringArraysEqual(leftKeys, rightKeys) &&
|
|
319
|
+
leftKeys.every((key) => right[key] !== undefined && decimalsEqual(left[key], right[key])));
|
|
320
|
+
}
|
|
321
|
+
function canonicalTimestamp(value) {
|
|
322
|
+
const match = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(?:\.(\d{1,6}))?Z$/.exec(value);
|
|
323
|
+
if (!match)
|
|
324
|
+
return undefined;
|
|
325
|
+
const milliseconds = Date.parse(`${match[1]}Z`);
|
|
326
|
+
if (!Number.isFinite(milliseconds))
|
|
327
|
+
return undefined;
|
|
328
|
+
const microseconds = match[2]?.padEnd(6, '0') ?? '000000';
|
|
329
|
+
return BigInt(milliseconds) * 1000n + BigInt(microseconds);
|
|
330
|
+
}
|
|
331
|
+
function timestampsEqual(left, right) {
|
|
332
|
+
if (left === null || right === null)
|
|
333
|
+
return left === right;
|
|
334
|
+
const canonicalLeft = canonicalTimestamp(left);
|
|
335
|
+
const canonicalRight = canonicalTimestamp(right);
|
|
336
|
+
return canonicalLeft === undefined || canonicalRight === undefined
|
|
337
|
+
? left === right
|
|
338
|
+
: canonicalLeft === canonicalRight;
|
|
339
|
+
}
|
|
340
|
+
function accountsEqual(left, right) {
|
|
341
|
+
return left.owner === right.owner && left.provider === right.provider && left.id === right.id;
|
|
342
|
+
}
|
|
343
|
+
function settlementsEqual(left, right) {
|
|
344
|
+
return (stringArraysEqual(left.executors, right.executors) &&
|
|
345
|
+
left.id === right.id &&
|
|
346
|
+
left.cid === right.cid &&
|
|
347
|
+
metadataEqual(left.meta, right.meta));
|
|
348
|
+
}
|
|
349
|
+
function allocationsEqual(left, right) {
|
|
350
|
+
return (left.admin === right.admin &&
|
|
351
|
+
accountsEqual(left.authorizer, right.authorizer) &&
|
|
352
|
+
arraysEqual(left.transferLegSides, right.transferLegSides, (leftLeg, rightLeg) => Boolean(leftLeg.transferLegId === rightLeg.transferLegId &&
|
|
353
|
+
leftLeg.side === rightLeg.side &&
|
|
354
|
+
accountsEqual(leftLeg.otherside, rightLeg.otherside) &&
|
|
355
|
+
decimalsEqual(leftLeg.amount, rightLeg.amount) &&
|
|
356
|
+
leftLeg.instrumentId === rightLeg.instrumentId &&
|
|
357
|
+
metadataEqual(leftLeg.meta, rightLeg.meta))) &&
|
|
358
|
+
timestampsEqual(left.settlementDeadline, right.settlementDeadline) &&
|
|
359
|
+
decimalMapsEqual(left.nextIterationFunding, right.nextIterationFunding) &&
|
|
360
|
+
left.committed === right.committed &&
|
|
361
|
+
metadataEqual(left.meta, right.meta));
|
|
362
|
+
}
|
|
363
|
+
function unknownValuesEqual(left, right) {
|
|
364
|
+
if (Object.is(left, right))
|
|
365
|
+
return true;
|
|
366
|
+
if (Array.isArray(left) || Array.isArray(right)) {
|
|
367
|
+
return Array.isArray(left) && Array.isArray(right) && arraysEqual(left, right, unknownValuesEqual);
|
|
368
|
+
}
|
|
369
|
+
if (!(0, utils_1.isRecord)(left) || !(0, utils_1.isRecord)(right))
|
|
370
|
+
return false;
|
|
371
|
+
const leftKeys = Object.keys(left).sort();
|
|
372
|
+
const rightKeys = Object.keys(right).sort();
|
|
373
|
+
return stringArraysEqual(leftKeys, rightKeys) && leftKeys.every((key) => unknownValuesEqual(left[key], right[key]));
|
|
374
|
+
}
|
|
375
|
+
function setConsistentState(states, contractId, state) {
|
|
376
|
+
const existing = states.get(contractId);
|
|
377
|
+
if (existing && !unknownValuesEqual(existing, state)) {
|
|
378
|
+
interfaceViewInvalid('Duplicate allocation-state rows contain inconsistent data.', { contractId });
|
|
379
|
+
}
|
|
380
|
+
if (!existing)
|
|
381
|
+
states.set(contractId, state);
|
|
382
|
+
}
|
|
383
|
+
function allocationRequestCoreMatches(request, view) {
|
|
384
|
+
return settlementsEqual(request.settlement, view.settlement) && allocationsEqual(request.allocation, view.allocation);
|
|
385
|
+
}
|
|
386
|
+
function normalizeParties(parties) {
|
|
387
|
+
if (!Array.isArray(parties)) {
|
|
388
|
+
inputInvalid('parties must be an array of explicit read parties.', { field: 'parties' });
|
|
389
|
+
}
|
|
390
|
+
const normalized = new Set();
|
|
391
|
+
for (const [index, party] of parties.entries()) {
|
|
392
|
+
normalized.add(requireTrimmedNonEmpty(party, `parties[${index}]`, inputInvalid));
|
|
393
|
+
}
|
|
394
|
+
if (normalized.size === 0) {
|
|
395
|
+
inputInvalid('parties must contain at least one explicit read party.', { field: 'parties' });
|
|
396
|
+
}
|
|
397
|
+
return [...normalized];
|
|
398
|
+
}
|
|
399
|
+
function normalizeActiveAtOffset(value) {
|
|
400
|
+
if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < 0) {
|
|
401
|
+
inputInvalid('activeAtOffset must be a non-negative safe integer.', {
|
|
402
|
+
field: 'activeAtOffset',
|
|
403
|
+
activeAtOffset: value,
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
return value;
|
|
407
|
+
}
|
|
408
|
+
function normalizeAllocationCids(value) {
|
|
409
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
410
|
+
inputInvalid('allocationCids must be a non-empty array.', {
|
|
411
|
+
field: 'allocationCids',
|
|
412
|
+
allocationCids: value,
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
const allocationCids = mapDenseArray(value, 'allocationCids', inputInvalid, (contractId, index) => requireTrimmedNonEmpty(contractId, `allocationCids[${index}]`, inputInvalid));
|
|
416
|
+
if (new Set(allocationCids).size !== allocationCids.length) {
|
|
417
|
+
inputInvalid('allocationCids must not contain duplicates.', {
|
|
418
|
+
field: 'allocationCids',
|
|
419
|
+
allocationCids,
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
return allocationCids;
|
|
423
|
+
}
|
|
424
|
+
function handleNonActiveContractItem(item, itemIndex, synchronizerId) {
|
|
425
|
+
if (!(0, utils_1.isRecord)(item) || !(0, utils_1.isRecord)(item['contractEntry'])) {
|
|
426
|
+
interfaceViewInvalid('ACS response contains an invalid contract row.', { itemIndex });
|
|
427
|
+
}
|
|
428
|
+
const { contractEntry } = item;
|
|
429
|
+
if ('JsEmpty' in contractEntry)
|
|
430
|
+
return;
|
|
431
|
+
const incompleteAssigned = contractEntry['JsIncompleteAssigned'];
|
|
432
|
+
if ((0, utils_1.isRecord)(incompleteAssigned) && (0, utils_1.isRecord)(incompleteAssigned['assignedEvent'])) {
|
|
433
|
+
const { assignedEvent } = incompleteAssigned;
|
|
434
|
+
if (assignedEvent['source'] !== synchronizerId && assignedEvent['target'] !== synchronizerId)
|
|
435
|
+
return;
|
|
436
|
+
acsIncomplete('Allocation state is incomplete while its contract is being reassigned.', {
|
|
437
|
+
itemIndex,
|
|
438
|
+
contractId: assignedEvent['contractId'],
|
|
439
|
+
source: assignedEvent['source'],
|
|
440
|
+
target: assignedEvent['target'],
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
const incompleteUnassigned = contractEntry['JsIncompleteUnassigned'];
|
|
444
|
+
if ((0, utils_1.isRecord)(incompleteUnassigned) && (0, utils_1.isRecord)(incompleteUnassigned['unassignedEvent'])) {
|
|
445
|
+
const { unassignedEvent } = incompleteUnassigned;
|
|
446
|
+
if (unassignedEvent['source'] !== synchronizerId && unassignedEvent['target'] !== synchronizerId)
|
|
447
|
+
return;
|
|
448
|
+
acsIncomplete('Allocation state is incomplete while its contract is being reassigned.', {
|
|
449
|
+
itemIndex,
|
|
450
|
+
contractId: unassignedEvent['contractId'],
|
|
451
|
+
source: unassignedEvent['source'],
|
|
452
|
+
target: unassignedEvent['target'],
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
interfaceViewInvalid('ACS response contains an unsupported contract row.', { itemIndex });
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Reads exact active AllocationV2 contracts from one ACS snapshot.
|
|
459
|
+
*
|
|
460
|
+
* Contract IDs and decoded views are returned together so callers cannot validate an off-ledger allocation snapshot and
|
|
461
|
+
* later submit a different contract ID.
|
|
462
|
+
*/
|
|
463
|
+
async function getTokenStandardV2AllocationViewsByContractIds(params) {
|
|
464
|
+
if (!(0, utils_1.isRecord)(params)) {
|
|
465
|
+
inputInvalid('params must be an exact allocation-view request.', { field: 'params' });
|
|
466
|
+
}
|
|
467
|
+
if (!(0, utils_1.isRecord)(params.ledger) || typeof params.ledger.getActiveContracts !== 'function') {
|
|
468
|
+
inputInvalid('ledger must provide getActiveContracts.', { field: 'ledger' });
|
|
469
|
+
}
|
|
470
|
+
const parties = normalizeParties(params.parties);
|
|
471
|
+
const synchronizerId = requireTrimmedNonEmpty(params.synchronizerId, 'synchronizerId', inputInvalid);
|
|
472
|
+
const allocationCids = normalizeAllocationCids(params.allocationCids);
|
|
473
|
+
const requestedCids = new Set(allocationCids);
|
|
474
|
+
const activeAtOffset = normalizeActiveAtOffset(params.activeAtOffset);
|
|
475
|
+
const response = await params.ledger.getActiveContracts({
|
|
476
|
+
parties,
|
|
477
|
+
interfaceIds: [exports.TOKEN_STANDARD_V2_ALLOCATION_INTERFACE_ID],
|
|
478
|
+
includeInterfaceView: true,
|
|
479
|
+
includeCreatedEventBlob: false,
|
|
480
|
+
activeAtOffset,
|
|
481
|
+
});
|
|
482
|
+
const allocations = new Map();
|
|
483
|
+
for (const [itemIndex, item] of response.entries()) {
|
|
484
|
+
if (!(0, contracts_1.isJsActiveContractItem)(item)) {
|
|
485
|
+
handleNonActiveContractItem(item, itemIndex, synchronizerId);
|
|
486
|
+
continue;
|
|
487
|
+
}
|
|
488
|
+
const activeContract = item.contractEntry.JsActiveContract;
|
|
489
|
+
if (activeContract.synchronizerId !== synchronizerId)
|
|
490
|
+
continue;
|
|
491
|
+
const { createdEvent } = activeContract;
|
|
492
|
+
if (!(0, utils_1.isNonEmptyString)(createdEvent.contractId) || !requestedCids.has(createdEvent.contractId))
|
|
493
|
+
continue;
|
|
494
|
+
for (const [viewIndex, interfaceView] of createdEvent.interfaceViews.entries()) {
|
|
495
|
+
if (!interfaceIdsMatch(interfaceView.interfaceId, exports.TOKEN_STANDARD_V2_ALLOCATION_INTERFACE_ID))
|
|
496
|
+
continue;
|
|
497
|
+
const context = {
|
|
498
|
+
itemIndex,
|
|
499
|
+
viewIndex,
|
|
500
|
+
contractId: createdEvent.contractId,
|
|
501
|
+
interfaceId: interfaceView.interfaceId,
|
|
502
|
+
};
|
|
503
|
+
if (interfaceView.viewStatus.code !== 0) {
|
|
504
|
+
interfaceViewInvalid('Token Standard V2 allocation interface view request failed.', {
|
|
505
|
+
...context,
|
|
506
|
+
viewStatusCode: interfaceView.viewStatus.code,
|
|
507
|
+
viewStatusMessage: interfaceView.viewStatus.message,
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
const identity = readAllocationViewIdentity(interfaceView.viewValue, context);
|
|
511
|
+
setConsistentState(allocations, createdEvent.contractId, {
|
|
512
|
+
type: 'Completed',
|
|
513
|
+
allocationCid: createdEvent.contractId,
|
|
514
|
+
view: readAllocationView(identity, context),
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
const missingAllocationCids = allocationCids.filter((contractId) => !allocations.has(contractId));
|
|
519
|
+
if (missingAllocationCids.length > 0) {
|
|
520
|
+
notFound('One or more requested Token Standard V2 allocations are not active and visible.', {
|
|
521
|
+
allocationCids,
|
|
522
|
+
missingAllocationCids,
|
|
523
|
+
synchronizerId,
|
|
524
|
+
activeAtOffset,
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
return allocationCids.map((allocationCid) => {
|
|
528
|
+
const allocation = allocations.get(allocationCid);
|
|
529
|
+
if (!allocation) {
|
|
530
|
+
notFound('A requested Token Standard V2 allocation disappeared while reading the ACS snapshot.', {
|
|
531
|
+
allocationCid,
|
|
532
|
+
activeAtOffset,
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
return { allocationCid, view: allocation.view };
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Recovers the active Completed or Pending state for a Token Standard V2 allocation request.
|
|
540
|
+
*
|
|
541
|
+
* Unknown means only that no matching active contract is visible at the requested ACS snapshot. It must not be
|
|
542
|
+
* interpreted as Failed; recover Failed from the original transaction tree or command completion.
|
|
543
|
+
*/
|
|
544
|
+
async function discoverTokenStandardV2AllocationState(params) {
|
|
545
|
+
if (!(0, utils_1.isRecord)(params)) {
|
|
546
|
+
inputInvalid('params must be an allocation-state discovery request.', { field: 'params' });
|
|
547
|
+
}
|
|
548
|
+
if (!(0, utils_1.isRecord)(params.ledger) || typeof params.ledger.getActiveContracts !== 'function') {
|
|
549
|
+
inputInvalid('ledger must provide getActiveContracts.', { field: 'ledger' });
|
|
550
|
+
}
|
|
551
|
+
const parties = normalizeParties(params.parties);
|
|
552
|
+
const synchronizerId = requireTrimmedNonEmpty(params.synchronizerId, 'synchronizerId', inputInvalid);
|
|
553
|
+
const request = readRequest(params.request);
|
|
554
|
+
const activeAtOffset = normalizeActiveAtOffset(params.activeAtOffset);
|
|
555
|
+
const response = await params.ledger.getActiveContracts({
|
|
556
|
+
parties,
|
|
557
|
+
interfaceIds: [exports.TOKEN_STANDARD_V2_ALLOCATION_INTERFACE_ID, exports.TOKEN_STANDARD_V2_ALLOCATION_INSTRUCTION_INTERFACE_ID],
|
|
558
|
+
includeInterfaceView: true,
|
|
559
|
+
includeCreatedEventBlob: false,
|
|
560
|
+
activeAtOffset,
|
|
561
|
+
});
|
|
562
|
+
const completed = new Map();
|
|
563
|
+
const pending = new Map();
|
|
564
|
+
const allocationRows = new Map();
|
|
565
|
+
const instructionRows = new Map();
|
|
566
|
+
for (const [itemIndex, item] of response.entries()) {
|
|
567
|
+
if (!(0, contracts_1.isJsActiveContractItem)(item)) {
|
|
568
|
+
handleNonActiveContractItem(item, itemIndex, synchronizerId);
|
|
569
|
+
continue;
|
|
570
|
+
}
|
|
571
|
+
const activeContract = item.contractEntry.JsActiveContract;
|
|
572
|
+
if (activeContract.synchronizerId !== synchronizerId)
|
|
573
|
+
continue;
|
|
574
|
+
const { createdEvent } = activeContract;
|
|
575
|
+
for (const [viewIndex, interfaceView] of createdEvent.interfaceViews.entries()) {
|
|
576
|
+
const isAllocation = interfaceIdsMatch(interfaceView.interfaceId, exports.TOKEN_STANDARD_V2_ALLOCATION_INTERFACE_ID);
|
|
577
|
+
const isInstruction = interfaceIdsMatch(interfaceView.interfaceId, exports.TOKEN_STANDARD_V2_ALLOCATION_INSTRUCTION_INTERFACE_ID);
|
|
578
|
+
if (!isAllocation && !isInstruction)
|
|
579
|
+
continue;
|
|
580
|
+
const context = {
|
|
581
|
+
itemIndex,
|
|
582
|
+
viewIndex,
|
|
583
|
+
contractId: createdEvent.contractId,
|
|
584
|
+
interfaceId: interfaceView.interfaceId,
|
|
585
|
+
};
|
|
586
|
+
if (interfaceView.viewStatus.code !== 0) {
|
|
587
|
+
interfaceViewInvalid(`Token Standard V2 ${isAllocation ? 'allocation' : 'allocation instruction'} interface view request failed.`, {
|
|
588
|
+
...context,
|
|
589
|
+
viewStatusCode: interfaceView.viewStatus.code,
|
|
590
|
+
viewStatusMessage: interfaceView.viewStatus.message,
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
if (!(0, utils_1.isNonEmptyString)(createdEvent.contractId)) {
|
|
594
|
+
interfaceViewInvalid('Matching active contract is missing contractId.', context);
|
|
595
|
+
}
|
|
596
|
+
if (isAllocation) {
|
|
597
|
+
const identity = readAllocationViewIdentity(interfaceView.viewValue, context);
|
|
598
|
+
const state = {
|
|
599
|
+
type: 'Completed',
|
|
600
|
+
allocationCid: createdEvent.contractId,
|
|
601
|
+
view: readAllocationView(identity, context),
|
|
602
|
+
};
|
|
603
|
+
setConsistentState(allocationRows, createdEvent.contractId, state);
|
|
604
|
+
if (allocationRequestCoreMatches(request, identity)) {
|
|
605
|
+
setConsistentState(completed, createdEvent.contractId, state);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
if (isInstruction) {
|
|
609
|
+
const identity = readAllocationInstructionViewIdentity(interfaceView.viewValue, context);
|
|
610
|
+
const state = {
|
|
611
|
+
type: 'Pending',
|
|
612
|
+
allocationInstructionCid: createdEvent.contractId,
|
|
613
|
+
view: readAllocationInstructionView(identity, context),
|
|
614
|
+
};
|
|
615
|
+
setConsistentState(instructionRows, createdEvent.contractId, state);
|
|
616
|
+
if (allocationRequestCoreMatches(request, identity) &&
|
|
617
|
+
timestampsEqual(request.requestedAt, identity.requestedAt) &&
|
|
618
|
+
stringArraysEqual(request.inputHoldingCids, identity.inputHoldingCids)) {
|
|
619
|
+
setConsistentState(pending, createdEvent.contractId, state);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
if (completed.size > 1 || pending.size > 1 || (completed.size > 0 && pending.size > 0)) {
|
|
625
|
+
throw new TokenStandardV2AllocationStateError(exports.TokenStandardV2AllocationStateErrorCode.AMBIGUOUS, 'Multiple active contracts match the Token Standard V2 allocation request.', {
|
|
626
|
+
completedCids: [...completed.keys()].sort(),
|
|
627
|
+
pendingCids: [...pending.keys()].sort(),
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
const completedState = completed.values().next().value;
|
|
631
|
+
if (completedState)
|
|
632
|
+
return completedState;
|
|
633
|
+
const pendingState = pending.values().next().value;
|
|
634
|
+
if (pendingState)
|
|
635
|
+
return pendingState;
|
|
636
|
+
return { type: 'Unknown' };
|
|
637
|
+
}
|
|
638
|
+
//# sourceMappingURL=allocation-state.js.map
|