Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/add-to-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
# No label filter: every new issue and PR is added, then triaged on the board.
# ADD_TO_PROJECT_PAT is used because the built-in GITHUB_TOKEN cannot write org Projects.
- uses: actions/add-to-project@5afcf98fcd03f1c2f92c3c83f58ae24323cc57fd # v2
- uses: actions/add-to-project@f2c1f1fa649a891be84948ea89b5dfba1526ef05 # v2
with:
project-url: https://github.com/orgs/BootNodeDev/projects/26
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
24.22.1
24.22.2
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/2.6.2/schema.json",
"$schema": "https://biomejs.dev/schemas/2.6.6/schema.json",
"assist": { "actions": { "source": { "organizeImports": "on" } } },
"vcs": {
"clientKind": "git",
Expand Down
8 changes: 6 additions & 2 deletions canton-create/scaffold/daml-tooling/scripts/deploy-dar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ dar_name="$(basename "$DAR_PATH")"

echo "Uploading $dar_name to app-user JSON API at $json_api_url"

response="$(mktemp)"
trap 'rm -f "$response"' EXIT

http_code="$(
curl -sS -o /dev/null -w '%{http_code}' \
curl -sS -o "$response" -w '%{http_code}' \
-X POST \
"$json_api_url/v2/packages" \
-H "Authorization: Bearer $token" \
Expand All @@ -62,7 +65,8 @@ case "$http_code" in
echo "$dar_name already deployed to app-user"
;;
*)
echo "DAR upload failed with HTTP $http_code" >&2
body="$(cat "$response")"
echo "DAR upload failed with HTTP $http_code${body:+: $body}" >&2
exit 1
;;
esac
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const resolveRelease = () => {
template = createRequire(import.meta.url).resolve(LOCALNET_TEMPLATE)
} catch {
throw new Error(
'daml/daml.yaml depends on Splice DARs: set SPLICE_TAG in .env to the Splice release your network runs, e.g. 0.8.1',
'daml/daml.yaml depends on Splice DARs: set SPLICE_TAG in .env to the Splice release your network runs, e.g. 0.9.4',
)
}
const tag = JSON.parse(fs.readFileSync(template, 'utf8')).splice?.tag
Expand Down
2 changes: 1 addition & 1 deletion canton-create/scaffold/localnet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"wallet-gateway": "mkdir -p .wallet-gateway && wallet-gateway -c ./wallet-gateway.config.json"
},
"devDependencies": {
"@bootnodedev/canton-barebones": "0.6.0",
"@bootnodedev/canton-barebones": "0.7.0",
"@canton-network/wallet-gateway-remote": "1.13.0"
}
}
5 changes: 4 additions & 1 deletion canton-dappbooster/src/hooks/useHoldings.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('useHoldings', () => {
const [, acs] = ledgerApi.mock.calls.map(([params]) => params)
expect(acs.body).toMatchObject({
activeAtOffset: 42,
filter: {
eventFormat: {
filtersByParty: {
[account.partyId]: {
cumulative: [
Expand All @@ -90,8 +90,11 @@ describe('useHoldings', () => {
],
},
},
verbose: true,
},
})
expect(acs.body).not.toHaveProperty('filter')
expect(acs.body).not.toHaveProperty('verbose')
})

it('reports a locked holding as locked', async () => {
Expand Down
4 changes: 2 additions & 2 deletions canton-dappbooster/src/hooks/useHoldings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const acsRequest = (partyId: string, offset: string | number): LedgerApiParams =
requestMethod: 'post',
resource: '/v2/state/active-contracts',
body: {
filter: {
eventFormat: {
filtersByParty: {
[partyId]: {
cumulative: [
Expand All @@ -55,9 +55,9 @@ const acsRequest = (partyId: string, offset: string | number): LedgerApiParams =
],
},
},
verbose: true,
},
activeAtOffset: offset,
verbose: true,
},
})

Expand Down
2 changes: 1 addition & 1 deletion example-dapps/amulet-vesting/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ CANTON_BACKEND_TOKEN=
###############################################################################
# DAML build (pnpm build-dar)
###############################################################################
# Without the local network, the Splice release your network runs, e.g. 0.8.1
# Without the local network, the Splice release your network runs, e.g. 0.9.4
# SPLICE_TAG=

###############################################################################
Expand Down
22 changes: 10 additions & 12 deletions example-dapps/amulet-vesting/scripts/bootstrap-vesting.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,14 @@ const createOperator = async (hint) => {
return party
}

// Ask the participant which package it would pick for the name, so a stale id cannot silently
// produce an empty dashboard. Fails loudly with PACKAGE_NAMES_NOT_FOUND if the DAR is not deployed.
// Asked rather than trusted, so a stale package id cannot silently leave the dashboard empty.
const resolvePackage = async (party) => {
const result = await ledger(
'get',
'/v2/interactive-submission/preferred-package-version',
undefined,
{ 'package-name': PACKAGE_NAME, parties: party },
)
const pkg = result?.packagePreference?.packageReference?.packageId
const result = await ledger('post', '/v2/interactive-submission/preferred-packages', {
packageVettingRequirements: [{ packageName: PACKAGE_NAME, parties: [party] }],
})
const pkg = result?.packageReferences?.find(
(reference) => reference.packageName === PACKAGE_NAME,
)?.packageId
if (typeof pkg !== 'string' || pkg.length === 0) {
throw new Error(`participant returned no package id for ${PACKAGE_NAME}`)
}
Expand All @@ -96,7 +94,7 @@ const main = async () => {
const factoryTid = `${pkg}:AmuletVesting:AmuletVestingFactory`
console.log(`package ${pkg}${process.env.PKG === undefined ? '' : ' (from PKG)'}`)

await ledger('post', '/v2/commands/submit-and-wait-for-transaction-tree', {
await ledger('post', '/v2/commands/submit-and-wait', {
commandId: `vesting-factory-${STAMP}`,
actAs: [operator],
readAs: [operator],
Expand All @@ -110,7 +108,7 @@ const main = async () => {
throw new Error('participant returned no ledger-end offset')
}
const rows = await ledger('post', '/v2/state/active-contracts', {
filter: {
eventFormat: {
filtersByParty: {
[operator]: {
cumulative: [
Expand All @@ -129,9 +127,9 @@ const main = async () => {
],
},
},
verbose: true,
},
activeAtOffset: end.offset,
verbose: true,
})
const active = (Array.isArray(rows) ? rows : [])
.map((row) => row?.contractEntry?.JsActiveContract)
Expand Down
10 changes: 8 additions & 2 deletions example-dapps/amulet-vesting/src/backend/LedgerBackend.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@ type PartyFilter = {

type AcsQuery = {
activeAtOffset?: unknown
filter?: { filtersByParty?: Record<string, PartyFilter> }
eventFormat?: { filtersByParty?: Record<string, PartyFilter> }
filter?: unknown
verbose?: unknown
}

type Read = { requestMethod: string; resource: string; body?: AcsQuery }

const byParty = (read: Read): Record<string, PartyFilter> => read.body?.filter?.filtersByParty ?? {}
const byParty = (read: Read): Record<string, PartyFilter> =>
read.body?.eventFormat?.filtersByParty ?? {}

// The template a read filters on, which is what a party-scoped ACS query is keyed by here.
const filteredTemplate = (read: Read): string | undefined =>
Expand Down Expand Up @@ -173,6 +176,9 @@ const harness = (
ledgerApi: async (params) => {
const read = params as Read
reads.push(read)
if (read.body?.filter !== undefined || read.body?.verbose !== undefined) {
throw new Error('DEPRECATED_API_DISABLED')
}
if (read.resource === '/v2/state/ledger-end') {
return ledgerEnd
}
Expand Down
6 changes: 4 additions & 2 deletions example-dapps/amulet-vesting/src/backend/LedgerBackend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,11 @@ export class LedgerBackend implements VestingBackend {
requestMethod: 'post',
resource: '/v2/state/active-contracts',
body: {
filter: templateFilter(party, templateId, includeCreatedEventBlob),
eventFormat: {
verbose: true,
...templateFilter(party, templateId, includeCreatedEventBlob),
},
activeAtOffset: offset,
verbose: true,
},
})
return Array.isArray(rows) ? rows : []
Expand Down
12 changes: 9 additions & 3 deletions example-dapps/amulet-vesting/src/backend/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,15 @@ const ledger = (
if (resource === '/v2/state/ledger-end') {
return { offset: 42 }
}
const filter = (params.body as { filter?: { filtersByParty?: Record<string, unknown> } })
?.filter
filteredParty = Object.keys(filter?.filtersByParty ?? {})[0]
const body = params.body as {
eventFormat?: { filtersByParty?: Record<string, unknown> }
filter?: unknown
verbose?: unknown
}
if (body.filter !== undefined || body.verbose !== undefined) {
throw new Error('DEPRECATED_API_DISABLED')
}
filteredParty = Object.keys(body.eventFormat?.filtersByParty ?? {})[0]
return overrides.acs ?? [factoryRow(created, 'sync::1')]
}
return { ledgerApi, filteredParty: () => filteredParty }
Expand Down
4 changes: 2 additions & 2 deletions example-dapps/amulet-vesting/src/backend/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const loadBackendConfig = async (ledgerApi: LedgerApi): Promise<Deploymen
requestMethod: 'post',
resource: '/v2/state/active-contracts',
body: {
filter: {
eventFormat: {
filtersByParty: {
[operator]: {
cumulative: [
Expand All @@ -82,9 +82,9 @@ export const loadBackendConfig = async (ledgerApi: LedgerApi): Promise<Deploymen
],
},
},
verbose: true,
},
activeAtOffset: offset,
verbose: true,
},
})
// Without the blob a funder cannot disclose the factory, so such a row is no use.
Expand Down
2 changes: 1 addition & 1 deletion example-dapps/token-vesting/_pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# the Canton SDK, has one; the other four come with the local network's packages, and the
# token-forge registry's git dependency builds on install.
allowBuilds:
"@bootnodedev/canton-token-forge@https://codeload.github.com/BootNodeDev/canton-token-forge/tar.gz/1639372eb66941e505aa52399d00b8b4121953f7": true
"@bootnodedev/canton-token-forge@https://codeload.github.com/BootNodeDev/canton-token-forge/tar.gz/49a4957246ec9193dd75e853bccef01fa5b8c931": true
protobufjs: true
better-sqlite3: true
cbor-extract: true
Expand Down
2 changes: 1 addition & 1 deletion example-dapps/token-vesting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"zustand": "^5.0.5"
},
"devDependencies": {
"@bootnodedev/canton-token-forge": "github:BootNodeDev/canton-token-forge#v0.3.0",
"@bootnodedev/canton-token-forge": "github:BootNodeDev/canton-token-forge#v0.3.1",
"@tailwindcss/vite": "^4.3.0",
"@types/react": "^19.1.0",
"@types/react-dom": "^19.1.0",
Expand Down
28 changes: 13 additions & 15 deletions example-dapps/token-vesting/scripts/bootstrap-vesting.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,14 @@ const ensureParty = async (hint) => {
return { party, reused: existing !== undefined }
}

// Ask the participant which package it would pick for the name, so a stale id cannot silently
// produce an empty dashboard. Fails loudly with PACKAGE_NAMES_NOT_FOUND if the DAR is not deployed.
// Asked rather than trusted, so a stale package id cannot silently leave the dashboard empty.
const resolvePackage = async (party, packageName = PACKAGE_NAME) => {
const result = await ledger(
'get',
'/v2/interactive-submission/preferred-package-version',
undefined,
{ 'package-name': packageName, parties: party },
)
const pkg = result?.packagePreference?.packageReference?.packageId
const result = await ledger('post', '/v2/interactive-submission/preferred-packages', {
packageVettingRequirements: [{ packageName, parties: [party] }],
})
const pkg = result?.packageReferences?.find(
(reference) => reference.packageName === packageName,
)?.packageId
if (typeof pkg !== 'string' || pkg.length === 0) {
throw new Error(`participant returned no package id for ${packageName}`)
}
Expand All @@ -203,7 +201,7 @@ const findInstrumentConfig = async (admin) => {
throw new Error('participant returned no ledger-end offset')
}
const rows = await ledger('post', '/v2/state/active-contracts', {
filter: {
eventFormat: {
filtersByParty: {
[admin]: {
cumulative: [
Expand All @@ -220,9 +218,9 @@ const findInstrumentConfig = async (admin) => {
],
},
},
verbose: true,
},
activeAtOffset: end.offset,
verbose: true,
})
const configs = (Array.isArray(rows) ? rows : [])
.map((row) => row?.contractEntry?.JsActiveContract?.createdEvent)
Expand Down Expand Up @@ -265,7 +263,7 @@ const findFactory = async (operator) => {
throw new Error('participant returned no ledger-end offset')
}
const rows = await ledger('post', '/v2/state/active-contracts', {
filter: {
eventFormat: {
filtersByParty: {
[operator]: {
cumulative: [
Expand All @@ -284,9 +282,9 @@ const findFactory = async (operator) => {
],
},
},
verbose: true,
},
activeAtOffset: end.offset,
verbose: true,
})
return (Array.isArray(rows) ? rows : [])
.map((row) => row?.contractEntry?.JsActiveContract)
Expand Down Expand Up @@ -322,7 +320,7 @@ const main = async () => {
let active = await findFactory(operator)
const hadFactory = active !== undefined
if (!hadFactory) {
await ledger('post', '/v2/commands/submit-and-wait-for-transaction-tree', {
await ledger('post', '/v2/commands/submit-and-wait', {
commandId: `vesting-factory-${STAMP}`,
actAs: [operator],
readAs: [operator],
Expand Down Expand Up @@ -366,7 +364,7 @@ const main = async () => {
return
}

await ledger('post', '/v2/commands/submit-and-wait-for-transaction-tree', {
await ledger('post', '/v2/commands/submit-and-wait', {
commandId: `instrument-config-${STAMP}`,
actAs: [admin],
readAs: [admin],
Expand Down
16 changes: 12 additions & 4 deletions example-dapps/token-vesting/src/backend/LedgerBackend.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ type PartyFilter = {

type AcsQuery = {
activeAtOffset?: unknown
filter?: { filtersByParty?: Record<string, PartyFilter> }
eventFormat?: { filtersByParty?: Record<string, PartyFilter> }
filter?: unknown
verbose?: unknown
}

type Read = {
Expand All @@ -52,7 +54,8 @@ type Read = {
body?: AcsQuery
}

const byParty = (read: Read): Record<string, PartyFilter> => read.body?.filter?.filtersByParty ?? {}
const byParty = (read: Read): Record<string, PartyFilter> =>
read.body?.eventFormat?.filtersByParty ?? {}

// The template a read filters on, which is what a party-scoped ACS query is keyed by here.
const filteredTemplate = (read: Read): string | undefined =>
Expand Down Expand Up @@ -234,10 +237,13 @@ const harness = (
ledgerApi: async (params) => {
const read = params as Read
reads.push(read)
if (read.body?.filter !== undefined || read.body?.verbose !== undefined) {
throw new Error('DEPRECATED_API_DISABLED')
}
if (readsFailAfterSubmit && submissions.length > 0) {
throw new Error('the participant is not answering')
}
if (readsFailOnBlobs && read.body?.filter !== undefined && readsBlobs(read)) {
if (readsFailOnBlobs && read.body?.eventFormat !== undefined && readsBlobs(read)) {
throw new Error('the participant is not answering')
}
if (read.resource === '/v2/state/ledger-end') {
Expand Down Expand Up @@ -436,7 +442,9 @@ describe('LedgerBackend.createVesting', () => {

const withBlobs = reads.filter(
(read) =>
read.body?.filter !== undefined && readsBlobs(read) && filteredTemplate(read) === TOKEN,
read.body?.eventFormat !== undefined &&
readsBlobs(read) &&
filteredTemplate(read) === TOKEN,
)
expect(withBlobs).toHaveLength(1)
})
Expand Down
Loading
Loading