diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..57df851 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "daml/daml-finance"] + path = daml/daml-finance + url = git@github.com:oscbacon/daml-finance.git diff --git a/configs/esbuild-config/package.json b/configs/esbuild-config/package.json index 7d2a251..d4eb61b 100644 --- a/configs/esbuild-config/package.json +++ b/configs/esbuild-config/package.json @@ -34,8 +34,8 @@ "peerDependencies": { "@esbuild-plugins/node-resolve": "^0.2.2", "@veraswap/eslint-config": "workspace:*", - "esbuild": "^0.25.1", - "glob": "11.0.1" + "esbuild": "^0.27.0", + "glob": "13.0.0" }, "devDependencies": { "depcheck": "^1.4.7" diff --git a/configs/eslint-config/package.json b/configs/eslint-config/package.json index cf00426..9847d09 100644 --- a/configs/eslint-config/package.json +++ b/configs/eslint-config/package.json @@ -27,11 +27,11 @@ "depcheck": "depcheck" }, "peerDependencies": { - "@eslint/js": "^9.22.0", - "eslint": "^9.22.0", + "@eslint/js": "^9.39.1", + "eslint": "^9.39.1", "@stylistic/eslint-plugin": "^4.2.0", "globals": "^16.0.0", - "typescript-eslint": "^8.26.1" + "typescript-eslint": "^8.48.1" }, "devDependencies": { "depcheck": "^1.4.7" @@ -42,6 +42,6 @@ }, "funding": "https://veraswap.io", "engines": { - "node": "^18.0.0" + "node": "^22.0.0" } } diff --git a/configs/tsconfig/package.json b/configs/tsconfig/package.json index 5bd5d2a..072fd45 100644 --- a/configs/tsconfig/package.json +++ b/configs/tsconfig/package.json @@ -31,6 +31,6 @@ }, "funding": "https://veraswap.io", "engines": { - "node": "^18.0.0" + "node": "^22.0.0" } } diff --git a/daml/daml-finance b/daml/daml-finance new file mode 160000 index 0000000..d13b823 --- /dev/null +++ b/daml/daml-finance @@ -0,0 +1 @@ +Subproject commit d13b823139b3dd6aab7b468b182535aff5dc93ca diff --git a/package.json b/package.json index 7bc370d..da961b1 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,6 @@ "engines": { "npm": ">=v10.5.0", "pnpm": ">=9.12.2", - "node": "^20.0.0" + "node": "^22.0.0" } } diff --git a/packages/minimal-token/daml.yaml b/packages/minimal-token/daml.yaml index 7681bbb..1f1bf58 100644 --- a/packages/minimal-token/daml.yaml +++ b/packages/minimal-token/daml.yaml @@ -1,4 +1,5 @@ -sdk-version: 3.3.0-snapshot.20250502.13767.0.v2fc6c7e2 +# sdk-version: 3.3.0-snapshot.20250502.13767.0.v2fc6c7e2 +sdk-version: 3.4.8 name: minimal-token version: 0.1.0 source: daml diff --git a/packages/token-app/.babelrc b/packages/token-app/.babelrc new file mode 100644 index 0000000..9fcef03 --- /dev/null +++ b/packages/token-app/.babelrc @@ -0,0 +1,4 @@ +{ + "presets": ["next/babel"], + "plugins": [] +} diff --git a/packages/token-app/eslint.config.mjs b/packages/token-app/eslint.config.mjs index 05e726d..3732cae 100644 --- a/packages/token-app/eslint.config.mjs +++ b/packages/token-app/eslint.config.mjs @@ -1,18 +1,20 @@ -import { defineConfig, globalIgnores } from "eslint/config"; -import nextVitals from "eslint-config-next/core-web-vitals"; -import nextTs from "eslint-config-next/typescript"; +import { defineConfig, globalIgnores } from 'eslint/config' +import nextVitals from 'eslint-config-next/core-web-vitals' +import nextTs from 'eslint-config-next/typescript' +import prettier from 'eslint-config-prettier/flat' const eslintConfig = defineConfig([ ...nextVitals, ...nextTs, + prettier, // Override default ignores of eslint-config-next. globalIgnores([ // Default ignores of eslint-config-next: - ".next/**", - "out/**", - "build/**", - "next-env.d.ts", + '.next/**', + 'out/**', + 'build/**', + 'next-env.d.ts', ]), -]); +]) -export default eslintConfig; +export default eslintConfig diff --git a/packages/token-app/next.config.ts b/packages/token-app/next.config.ts index 338b413..eaad6cc 100644 --- a/packages/token-app/next.config.ts +++ b/packages/token-app/next.config.ts @@ -3,7 +3,7 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { // Mark Node.js-only packages as external // TODO: check, build fails without it - serverExternalPackages: ["@canton-network/wallet-sdk", "pino"], + serverExternalPackages: ["@canton-network/wallet-sdk"], }; export default nextConfig; diff --git a/packages/token-app/package.json b/packages/token-app/package.json index 5110b62..579c821 100644 --- a/packages/token-app/package.json +++ b/packages/token-app/package.json @@ -19,7 +19,7 @@ "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "lucide-react": "^0.553.0", - "next": "16.0.3", + "next": "16.0.6", "next-themes": "^0.4.6", "react": "19.2.0", "react-dom": "19.2.0", @@ -34,9 +34,10 @@ "@types/react-dom": "^19", "@veraswap/eslint-config": "workspace:*", "baseline-browser-mapping": "^2.8.32", - "eslint-config-next": "16.0.3", + "eslint-config-next": "16.0.6", + "eslint-config-prettier": "^10.1.8", "tailwindcss": "^4", "tw-animate-css": "^1.4.0", - "typescript": "^5" + "typescript": "5.9.3" } } diff --git a/packages/token-app/prettier.configs.mjs b/packages/token-app/prettier.configs.mjs new file mode 100644 index 0000000..14c3e8c --- /dev/null +++ b/packages/token-app/prettier.configs.mjs @@ -0,0 +1 @@ +export { default } from "@veraswap/eslint-config/prettier" diff --git a/packages/token-sdk/package.json b/packages/token-sdk/package.json index 0e52776..967e33c 100644 --- a/packages/token-sdk/package.json +++ b/packages/token-sdk/package.json @@ -51,7 +51,8 @@ "tsc:trace": "tsc --generateTrace lib/trace && analyze-trace lib/trace", "tsc:watch": "tsc -w", "upload-dar": "tsx src/uploadDars.ts", - "get:minimal-token-id": "daml damlc inspect ../minimal-token/.daml/dist/minimal-token-0.1.0.dar | head -1 | awk '{print $2}'" + "get:minimal-token-id": "daml damlc inspect ../minimal-token/.daml/dist/minimal-token-0.1.0.dar | head -1 | awk '{print $2}'", + "get:daml-finance-id": "daml damlc inspect ../../daml/daml-finance/.daml/dist/daml-finance-1.6.1.dar | head -1 | awk '{print $2}'" }, "devDependencies": { "@canton-network/core-ledger-client": "^0.17.0", @@ -64,13 +65,13 @@ "madge": "^8.0.0", "npm-run-all": "^4.1.5", "rimraf": "^6.0.1", - "typescript": "5.8.2", + "typescript": "5.9.3", "vite": "^6.2.2", "vitest": "^3.0.8" }, "funding": "https://denote.capital", "engines": { - "node": "^20.0.0" + "node": "^22.0.0" }, "dependencies": { "@canton-network/wallet-sdk": "^0.16.0", diff --git a/packages/token-sdk/prettier.configs.mjs b/packages/token-sdk/prettier.configs.mjs new file mode 100644 index 0000000..14c3e8c --- /dev/null +++ b/packages/token-sdk/prettier.configs.mjs @@ -0,0 +1 @@ +export { default } from "@veraswap/eslint-config/prettier" diff --git a/packages/token-sdk/src/uploadDars.ts b/packages/token-sdk/src/uploadDars.ts index bb7f8b0..3c0495d 100644 --- a/packages/token-sdk/src/uploadDars.ts +++ b/packages/token-sdk/src/uploadDars.ts @@ -2,6 +2,7 @@ import { localNetAuthDefault, localNetLedgerDefault, localNetTokenStandardDefault, + WalletSDK, WalletSDKImpl, } from "@canton-network/wallet-sdk"; import fs from "fs/promises"; @@ -14,36 +15,75 @@ const sdk = new WalletSDKImpl().configure({ tokenStandardFactory: localNetTokenStandardDefault, }); +// Obtained from runnning: +// `pnpm get:minimal-token-id` +const MINIMAL_TOKEN_PACKAGE_ID = + "68c1b4981314149b66cb3c75f1d63e4111516075564d884f3a19a3b753416e22"; + +// Obtained from runnning: +// `pnpm get:daml-finance-id` +const DAML_FINANCE_PACKAGE_ID = + "83019256c9f372abecea457a3bb2a59463bf06d4ff832fa6bba7073c216f33cb"; + +async function uploadDar({ + packageId, + packagePath, + sdk, +}: { + packageId: string; + packagePath: string; + sdk: WalletSDK; +}) { + const isDarUploaded = await sdk.userLedger!.isPackageUploaded(packageId); + + if (isDarUploaded) { + console.info("minimal-token DAR already uploaded"); + } else { + console.info("Uploading DAR file..."); + const darBytes = await fs.readFile(packagePath); + await sdk.adminLedger!.uploadDar(darBytes); + console.info("DAR uploaded successfully"); + } +} + export async function uploadDars() { await sdk.connect(); await sdk.connectAdmin(); await sdk.connectTopology(new URL("http://localhost:2000/api/validator")); - // Obtained from runnning: - // `pnpm get:minimal-token-id` - const MINIMAL_TOKEN_PACKAGE_ID = - "1b3906fcec7fe6a9d7fcaf35c3363867ad6639ed0e890b8367810fe1a7e3e126"; - - const isDarUploaded = await sdk.userLedger?.isPackageUploaded( - MINIMAL_TOKEN_PACKAGE_ID - ); - + const curDirectory = path.dirname(process.cwd()); const minimalTokenDarPath = path.join( - path.dirname(process.cwd()), + curDirectory, "minimal-token", ".daml", "dist", "minimal-token-0.1.0.dar" ); - if (isDarUploaded) { - console.info("minimal-token DAR already uploaded"); - } else { - console.info("Uploading DAR file..."); - const darBytes = await fs.readFile(minimalTokenDarPath); - await sdk.adminLedger!.uploadDar(darBytes); - console.info("DAR uploaded successfully"); - } + console.log({ minimalTokenDarPath }); + + await uploadDar({ + packageId: MINIMAL_TOKEN_PACKAGE_ID, + packagePath: minimalTokenDarPath, + sdk, + }); + + const parentDir = path.dirname(curDirectory); + const damlFinanceDarPath = path.join( + parentDir, + "daml", + "daml-finance", + ".daml", + "dist", + "daml-finance-1.6.1.dar" + ); + console.log({ damlFinanceDarPath }); + + await uploadDar({ + packageId: DAML_FINANCE_PACKAGE_ID, + packagePath: damlFinanceDarPath, + sdk, + }); } uploadDars() diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 01e78e4..96430f7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -34,16 +34,16 @@ importers: dependencies: '@esbuild-plugins/node-resolve': specifier: ^0.2.2 - version: 0.2.2(esbuild@0.25.12) + version: 0.2.2(esbuild@0.27.0) '@veraswap/eslint-config': specifier: workspace:* version: link:../eslint-config esbuild: - specifier: ^0.25.1 - version: 0.25.12 + specifier: ^0.27.0 + version: 0.27.0 glob: - specifier: 11.0.1 - version: 11.0.1 + specifier: 13.0.0 + version: 13.0.0 devDependencies: depcheck: specifier: ^1.4.7 @@ -52,20 +52,20 @@ importers: configs/eslint-config: dependencies: '@eslint/js': - specifier: ^9.22.0 + specifier: ^9.39.1 version: 9.39.1 '@stylistic/eslint-plugin': specifier: ^4.2.0 version: 4.4.1(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) eslint: - specifier: ^9.22.0 + specifier: ^9.39.1 version: 9.39.1(jiti@2.6.1) globals: specifier: ^16.0.0 version: 16.5.0 typescript-eslint: - specifier: ^8.26.1 - version: 8.48.0(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) + specifier: ^8.48.1 + version: 8.48.1(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) devDependencies: depcheck: specifier: ^1.4.7 @@ -112,8 +112,8 @@ importers: specifier: ^0.553.0 version: 0.553.0(react@19.2.0) next: - specifier: 16.0.3 - version: 16.0.3(@babel/core@7.28.5)(react-dom@19.2.0(react@19.2.0))(react@19.2.0) + specifier: 16.0.6 + version: 16.0.6(@babel/core@7.28.5)(react-dom@19.2.0(react@19.2.0))(react@19.2.0) next-themes: specifier: ^0.4.6 version: 0.4.6(react-dom@19.2.0(react@19.2.0))(react@19.2.0) @@ -152,8 +152,11 @@ importers: specifier: ^2.8.32 version: 2.8.32 eslint-config-next: - specifier: 16.0.3 - version: 16.0.3(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) + specifier: 16.0.6 + version: 16.0.6(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) + eslint-config-prettier: + specifier: ^10.1.8 + version: 10.1.8(eslint@9.39.1(jiti@2.6.1)) tailwindcss: specifier: ^4 version: 4.1.17 @@ -161,7 +164,7 @@ importers: specifier: ^1.4.0 version: 1.4.0 typescript: - specifier: ^5 + specifier: 5.9.3 version: 5.9.3 packages/token-sdk: @@ -202,7 +205,7 @@ importers: version: 1.4.7 madge: specifier: ^8.0.0 - version: 8.0.0(typescript@5.8.2) + version: 8.0.0(typescript@5.9.3) npm-run-all: specifier: ^4.1.5 version: 4.1.5 @@ -210,8 +213,8 @@ importers: specifier: ^6.0.1 version: 6.1.2 typescript: - specifier: 5.8.2 - version: 5.8.2 + specifier: 5.9.3 + version: 5.9.3 vite: specifier: ^6.2.2 version: 6.4.1(@types/node@22.19.1)(jiti@2.6.1)(lightningcss@1.30.2)(tsx@4.21.0) @@ -845,8 +848,8 @@ packages: '@floating-ui/utils@0.2.10': resolution: {integrity: sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ==} - '@grpc/grpc-js@1.14.1': - resolution: {integrity: sha512-sPxgEWtPUR3EnRJCEtbGZG2iX8LQDUls2wUS3o27jg07KqJFMq6YDeWvMo1wfpmy3rqRdS0rivpLwhqQtEyCuQ==} + '@grpc/grpc-js@1.14.2': + resolution: {integrity: sha512-QzVUtEFyu05UNx2xr0fCQmStUO17uVQhGNowtxs00IgTZT6/W2PBLfUkj30s0FKJ29VtTa3ArVNIhNP6akQhqA==} engines: {node: '>=12.10.0'} '@grpc/proto-loader@0.8.0': @@ -1149,10 +1152,6 @@ packages: resolution: {integrity: sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==} engines: {node: 20 || >=22} - '@isaacs/cliui@8.0.2': - resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} - engines: {node: '>=12'} - '@jridgewell/gen-mapping@0.3.13': resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==} @@ -1196,56 +1195,56 @@ packages: '@napi-rs/wasm-runtime@0.2.12': resolution: {integrity: sha512-ZVWUcfwY4E/yPitQJl481FjFo3K22D6qF0DuFH6Y/nbnE11GY5uguDxZMGXPQ8WQ0128MXQD7TnfHyK4oWoIJQ==} - '@next/env@16.0.3': - resolution: {integrity: sha512-IqgtY5Vwsm14mm/nmQaRMmywCU+yyMIYfk3/MHZ2ZTJvwVbBn3usZnjMi1GacrMVzVcAxJShTCpZlPs26EdEjQ==} + '@next/env@16.0.6': + resolution: {integrity: sha512-PFTK/G/vM3UJwK5XDYMFOqt8QW42mmhSgdKDapOlCqBUAOfJN2dyOnASR/xUR/JRrro0pLohh/zOJ77xUQWQAg==} - '@next/eslint-plugin-next@16.0.3': - resolution: {integrity: sha512-6sPWmZetzFWMsz7Dhuxsdmbu3fK+/AxKRtj7OB0/3OZAI2MHB/v2FeYh271LZ9abvnM1WIwWc/5umYjx0jo5sQ==} + '@next/eslint-plugin-next@16.0.6': + resolution: {integrity: sha512-9INsBF3/4XL0/tON8AGsh0svnTtDMLwv3iREGWnWkewGdOnd790tguzq9rX8xwrVthPyvaBHhw1ww0GZz0jO5Q==} - '@next/swc-darwin-arm64@16.0.3': - resolution: {integrity: sha512-MOnbd92+OByu0p6QBAzq1ahVWzF6nyfiH07dQDez4/Nku7G249NjxDVyEfVhz8WkLiOEU+KFVnqtgcsfP2nLXg==} + '@next/swc-darwin-arm64@16.0.6': + resolution: {integrity: sha512-AGzKiPlDiui+9JcPRHLI4V9WFTTcKukhJTfK9qu3e0tz+Y/88B7vo5yZoO7UaikplJEHORzG3QaBFQfkjhnL0Q==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] - '@next/swc-darwin-x64@16.0.3': - resolution: {integrity: sha512-i70C4O1VmbTivYdRlk+5lj9xRc2BlK3oUikt3yJeHT1unL4LsNtN7UiOhVanFdc7vDAgZn1tV/9mQwMkWOJvHg==} + '@next/swc-darwin-x64@16.0.6': + resolution: {integrity: sha512-LlLLNrK9WCIUkq2GciWDcquXYIf7vLxX8XE49gz7EncssZGL1vlHwgmURiJsUZAvk0HM1a8qb1ABDezsjAE/jw==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] - '@next/swc-linux-arm64-gnu@16.0.3': - resolution: {integrity: sha512-O88gCZ95sScwD00mn/AtalyCoykhhlokxH/wi1huFK+rmiP5LAYVs/i2ruk7xST6SuXN4NI5y4Xf5vepb2jf6A==} + '@next/swc-linux-arm64-gnu@16.0.6': + resolution: {integrity: sha512-r04NzmLSGGfG8EPXKVK72N5zDNnq9pa9el78LhdtqIC3zqKh74QfKHnk24DoK4PEs6eY7sIK/CnNpt30oc59kg==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - '@next/swc-linux-arm64-musl@16.0.3': - resolution: {integrity: sha512-CEErFt78S/zYXzFIiv18iQCbRbLgBluS8z1TNDQoyPi8/Jr5qhR3e8XHAIxVxPBjDbEMITprqELVc5KTfFj0gg==} + '@next/swc-linux-arm64-musl@16.0.6': + resolution: {integrity: sha512-hfB/QV0hA7lbD1OJxp52wVDlpffUMfyxUB5ysZbb/pBC5iuhyLcEKSVQo56PFUUmUQzbMsAtUu6k2Gh9bBtWXA==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - '@next/swc-linux-x64-gnu@16.0.3': - resolution: {integrity: sha512-Tc3i+nwt6mQ+Dwzcri/WNDj56iWdycGVh5YwwklleClzPzz7UpfaMw1ci7bLl6GRYMXhWDBfe707EXNjKtiswQ==} + '@next/swc-linux-x64-gnu@16.0.6': + resolution: {integrity: sha512-PZJushBgfvKhJBy01yXMdgL+l5XKr7uSn5jhOQXQXiH3iPT2M9iG64yHpPNGIKitKrHJInwmhPVGogZBAJOCPw==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - '@next/swc-linux-x64-musl@16.0.3': - resolution: {integrity: sha512-zTh03Z/5PBBPdTurgEtr6nY0vI9KR9Ifp/jZCcHlODzwVOEKcKRBtQIGrkc7izFgOMuXDEJBmirwpGqdM/ZixA==} + '@next/swc-linux-x64-musl@16.0.6': + resolution: {integrity: sha512-LqY76IojrH9yS5fyATjLzlOIOgwyzBuNRqXwVxcGfZ58DWNQSyfnLGlfF6shAEqjwlDNLh4Z+P0rnOI87Y9jEw==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - '@next/swc-win32-arm64-msvc@16.0.3': - resolution: {integrity: sha512-Jc1EHxtZovcJcg5zU43X3tuqzl/sS+CmLgjRP28ZT4vk869Ncm2NoF8qSTaL99gh6uOzgM99Shct06pSO6kA6g==} + '@next/swc-win32-arm64-msvc@16.0.6': + resolution: {integrity: sha512-eIfSNNqAkj0tqKRf0u7BVjqylJCuabSrxnpSENY3YKApqwDMeAqYPmnOwmVe6DDl3Lvkbe7cJAyP6i9hQ5PmmQ==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] - '@next/swc-win32-x64-msvc@16.0.3': - resolution: {integrity: sha512-N7EJ6zbxgIYpI/sWNzpVKRMbfEGgsWuOIvzkML7wxAAZhPk1Msxuo/JDu1PKjWGrAoOLaZcIX5s+/pF5LIbBBg==} + '@next/swc-win32-x64-msvc@16.0.6': + resolution: {integrity: sha512-QGs18P4OKdK9y2F3Th42+KGnwsc2iaThOe6jxQgP62kslUU4W+g6AzI6bdIn/pslhSfxjAMU5SjakfT5Fyo/xA==} engines: {node: '>= 10'} cpu: [x64] os: [win32] @@ -2017,63 +2016,63 @@ packages: '@types/tar-stream@3.1.4': resolution: {integrity: sha512-921gW0+g29mCJX0fRvqeHzBlE/XclDaAG0Ousy1LCghsOhvaKacDeRGEVzQP9IPfKn8Vysy7FEXAIxycpc/CMg==} - '@typescript-eslint/eslint-plugin@8.48.0': - resolution: {integrity: sha512-XxXP5tL1txl13YFtrECECQYeZjBZad4fyd3cFV4a19LkAY/bIp9fev3US4S5fDVV2JaYFiKAZ/GRTOLer+mbyQ==} + '@typescript-eslint/eslint-plugin@8.48.1': + resolution: {integrity: sha512-X63hI1bxl5ohelzr0LY5coufyl0LJNthld+abwxpCoo6Gq+hSqhKwci7MUWkXo67mzgUK6YFByhmaHmUcuBJmA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - '@typescript-eslint/parser': ^8.48.0 + '@typescript-eslint/parser': ^8.48.1 eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <6.0.0' - '@typescript-eslint/parser@8.48.0': - resolution: {integrity: sha512-jCzKdm/QK0Kg4V4IK/oMlRZlY+QOcdjv89U2NgKHZk1CYTj82/RVSx1mV/0gqCVMJ/DA+Zf/S4NBWNF8GQ+eqQ==} + '@typescript-eslint/parser@8.48.1': + resolution: {integrity: sha512-PC0PDZfJg8sP7cmKe6L3QIL8GZwU5aRvUFedqSIpw3B+QjRSUZeeITC2M5XKeMXEzL6wccN196iy3JLwKNvDVA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <6.0.0' - '@typescript-eslint/project-service@8.48.0': - resolution: {integrity: sha512-Ne4CTZyRh1BecBf84siv42wv5vQvVmgtk8AuiEffKTUo3DrBaGYZueJSxxBZ8fjk/N3DrgChH4TOdIOwOwiqqw==} + '@typescript-eslint/project-service@8.48.1': + resolution: {integrity: sha512-HQWSicah4s9z2/HifRPQ6b6R7G+SBx64JlFQpgSSHWPKdvCZX57XCbszg/bapbRsOEv42q5tayTYcEFpACcX1w==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '>=4.8.4 <6.0.0' - '@typescript-eslint/scope-manager@8.48.0': - resolution: {integrity: sha512-uGSSsbrtJrLduti0Q1Q9+BF1/iFKaxGoQwjWOIVNJv0o6omrdyR8ct37m4xIl5Zzpkp69Kkmvom7QFTtue89YQ==} + '@typescript-eslint/scope-manager@8.48.1': + resolution: {integrity: sha512-rj4vWQsytQbLxC5Bf4XwZ0/CKd362DkWMUkviT7DCS057SK64D5lH74sSGzhI6PDD2HCEq02xAP9cX68dYyg1w==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/tsconfig-utils@8.48.0': - resolution: {integrity: sha512-WNebjBdFdyu10sR1M4OXTt2OkMd5KWIL+LLfeH9KhgP+jzfDV/LI3eXzwJ1s9+Yc0Kzo2fQCdY/OpdusCMmh6w==} + '@typescript-eslint/tsconfig-utils@8.48.1': + resolution: {integrity: sha512-k0Jhs4CpEffIBm6wPaCXBAD7jxBtrHjrSgtfCjUvPp9AZ78lXKdTR8fxyZO5y4vWNlOvYXRtngSZNSn+H53Jkw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '>=4.8.4 <6.0.0' - '@typescript-eslint/type-utils@8.48.0': - resolution: {integrity: sha512-zbeVaVqeXhhab6QNEKfK96Xyc7UQuoFWERhEnj3mLVnUWrQnv15cJNseUni7f3g557gm0e46LZ6IJ4NJVOgOpw==} + '@typescript-eslint/type-utils@8.48.1': + resolution: {integrity: sha512-1jEop81a3LrJQLTf/1VfPQdhIY4PlGDBc/i67EVWObrtvcziysbLN3oReexHOM6N3jyXgCrkBsZpqwH0hiDOQg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <6.0.0' - '@typescript-eslint/types@8.48.0': - resolution: {integrity: sha512-cQMcGQQH7kwKoVswD1xdOytxQR60MWKM1di26xSUtxehaDs/32Zpqsu5WJlXTtTTqyAVK8R7hvsUnIXRS+bjvA==} + '@typescript-eslint/types@8.48.1': + resolution: {integrity: sha512-+fZ3LZNeiELGmimrujsDCT4CRIbq5oXdHe7chLiW8qzqyPMnn1puNstCrMNVAqwcl2FdIxkuJ4tOs/RFDBVc/Q==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/typescript-estree@8.48.0': - resolution: {integrity: sha512-ljHab1CSO4rGrQIAyizUS6UGHHCiAYhbfcIZ1zVJr5nMryxlXMVWS3duFPSKvSUbFPwkXMFk1k0EMIjub4sRRQ==} + '@typescript-eslint/typescript-estree@8.48.1': + resolution: {integrity: sha512-/9wQ4PqaefTK6POVTjJaYS0bynCgzh6ClJHGSBj06XEHjkfylzB+A3qvyaXnErEZSaxhIo4YdyBgq6j4RysxDg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '>=4.8.4 <6.0.0' - '@typescript-eslint/utils@8.48.0': - resolution: {integrity: sha512-yTJO1XuGxCsSfIVt1+1UrLHtue8xz16V8apzPYI06W0HbEbEWHxHXgZaAgavIkoh+GeV6hKKd5jm0sS6OYxWXQ==} + '@typescript-eslint/utils@8.48.1': + resolution: {integrity: sha512-fAnhLrDjiVfey5wwFRwrweyRlCmdz5ZxXz2G/4cLn0YDLjTapmN4gcCsTBR1N2rWnZSDeWpYtgLDsJt+FpmcwA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <6.0.0' - '@typescript-eslint/visitor-keys@8.48.0': - resolution: {integrity: sha512-T0XJMaRPOH3+LBbAfzR2jalckP1MSG/L9eUtY0DEzUyVaXJ/t6zN0nR7co5kz0Jko/nkSYCBRkz1djvjajVTTg==} + '@typescript-eslint/visitor-keys@8.48.1': + resolution: {integrity: sha512-BmxxndzEWhE4TIEEMBs8lP3MBWN3jFPs/p6gPm/wkv02o41hI6cq9AuSmGAaTTHPtA1FTi2jBre4A9rm5ZmX+Q==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} '@typescript/analyze-trace@0.10.1': @@ -2270,10 +2269,6 @@ packages: resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} engines: {node: '>=8'} - ansi-styles@6.2.3: - resolution: {integrity: sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==} - engines: {node: '>=12'} - ansicolors@0.3.2: resolution: {integrity: sha512-QXu7BPrP29VllRxH8GwB7x5iX5qWKAAMLqKQGWTeLWVlNHNOpVMJ91dsxQAIWXpjuW5wqvxu3Jd/nRjrJ+0pqg==} @@ -2924,9 +2919,6 @@ packages: resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} engines: {node: '>= 0.4'} - eastasianwidth@0.2.0: - resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} - effect@3.19.8: resolution: {integrity: sha512-OmLw8EfH02vdmyU2fO4uY9He/wepwKI5E/JNpE2pseaWWUbaYOK9UlxIiKP20ZEqQr+S/jSqRDGmpiqD/2DeCQ==} @@ -2935,8 +2927,8 @@ packages: engines: {node: '>=0.10.0'} hasBin: true - electron-to-chromium@1.5.262: - resolution: {integrity: sha512-NlAsMteRHek05jRUxUR0a5jpjYq9ykk6+kO0yRaMi5moe7u0fVIOeQ3Y30A8dIiWFBNUoQGi1ljb1i5VtS9WQQ==} + electron-to-chromium@1.5.263: + resolution: {integrity: sha512-DrqJ11Knd+lo+dv+lltvfMDLU27g14LMdH2b0O3Pio4uk0x+z7OR+JrmyacTPN2M8w3BrZ7/RTwG3R9B7irPlg==} emoji-regex@10.6.0: resolution: {integrity: sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==} @@ -3035,8 +3027,8 @@ packages: engines: {node: '>=6.0'} hasBin: true - eslint-config-next@16.0.3: - resolution: {integrity: sha512-5F6qDjcZldf0Y0ZbqvWvap9xzYUxyDf7/of37aeyhvkrQokj/4bT1JYWZdlWUr283aeVa+s52mPq9ogmGg+5dw==} + eslint-config-next@16.0.6: + resolution: {integrity: sha512-nx0Z2S50TlcSQ2RtyULCff5tlKTwqF/ICh3U9s8C/e2aRXAm1Ootdb7BEHGZmejtJSgsFq8PVFdlWy8BHiz2pg==} peerDependencies: eslint: '>=9.0.0' typescript: '>=3.3.1' @@ -3044,6 +3036,12 @@ packages: typescript: optional: true + eslint-config-prettier@10.1.8: + resolution: {integrity: sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==} + hasBin: true + peerDependencies: + eslint: '>=7.0.0' + eslint-import-resolver-node@0.3.9: resolution: {integrity: sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==} @@ -3300,10 +3298,6 @@ packages: resolution: {integrity: sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==} engines: {node: '>= 0.4'} - foreground-child@3.3.1: - resolution: {integrity: sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==} - engines: {node: '>=14'} - form-data@4.0.5: resolution: {integrity: sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==} engines: {node: '>= 6'} @@ -3414,11 +3408,6 @@ packages: resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} engines: {node: '>=10.13.0'} - glob@11.0.1: - resolution: {integrity: sha512-zrQDm8XPnYEKawJScsnM0QzobJxlT/kHOOlRTio8IH/GrmxRE5fjllkzdaHclIuNjUQTJYH2xHNIGfdpJkDJUw==} - engines: {node: 20 || >=22} - hasBin: true - glob@13.0.0: resolution: {integrity: sha512-tvZgpqk6fz4BaNZ66ZsRaZnbHvP/jG3uKJvAZOwEVUL4RTA5nJeeLYfyN9/VA8NX/V3IBG+hkeuGpKjvELkVhA==} engines: {node: 20 || >=22} @@ -3779,10 +3768,6 @@ packages: resolution: {integrity: sha512-H0dkQoCa3b2VEeKQBOxFph+JAbcrQdE7KC0UkqwpLmv2EC4P41QXP+rqo9wYodACiG5/WM5s9oDApTU8utwj9g==} engines: {node: '>= 0.4'} - jackspeak@4.1.1: - resolution: {integrity: sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ==} - engines: {node: 20 || >=22} - jake@10.9.4: resolution: {integrity: sha512-wpHYzhxiVQL+IV05BLE2Xn34zW1S223hvjtqk0+gsPrwd/8JNLXJgZZM/iPFsYc1xyphF+6M6EvdE5E9MBGkDA==} engines: {node: '>=10'} @@ -4190,8 +4175,8 @@ packages: react: ^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc react-dom: ^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc - next@16.0.3: - resolution: {integrity: sha512-Ka0/iNBblPFcIubTA1Jjh6gvwqfjrGq1Y2MTI5lbjeLIAfmC+p5bQmojpRZqgHHVu5cG4+qdIiwXiBSm/8lZ3w==} + next@16.0.6: + resolution: {integrity: sha512-2zOZ/4FdaAp5hfCU/RnzARlZzBsjaTZ/XjNQmuyYLluAPM7kcrbIkdeO2SL0Ysd1vnrSgU+GwugfeWX1cUCgCg==} engines: {node: '>=20.9.0'} hasBin: true peerDependencies: @@ -4987,10 +4972,6 @@ packages: resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} engines: {node: '>=8'} - string-width@5.1.2: - resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==} - engines: {node: '>=12'} - string-width@7.2.0: resolution: {integrity: sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==} engines: {node: '>=18'} @@ -5308,8 +5289,8 @@ packages: resolution: {integrity: sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg==} engines: {node: '>= 0.4'} - typescript-eslint@8.48.0: - resolution: {integrity: sha512-fcKOvQD9GUn3Xw63EgiDqhvWJ5jsyZUaekl3KVpGsDJnN46WJTe3jWxtQP9lMZm1LJNkFLlTaWAxK2vUQR+cqw==} + typescript-eslint@8.48.1: + resolution: {integrity: sha512-FbOKN1fqNoXp1hIl5KYpObVrp0mCn+CLgn479nmu2IsRMrx2vyv74MmsBLVlhg8qVwNFGbXSp8fh1zp8pEoC2A==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 @@ -5318,11 +5299,6 @@ packages: typescript-lru-cache@2.0.0: resolution: {integrity: sha512-Jp57Qyy8wXeMkdNuZiglE6v2Cypg13eDA1chHwDG6kq51X7gk4K7P7HaDdzZKCxkegXkVHNcPD0n5aW6OZH3aA==} - typescript@5.8.2: - resolution: {integrity: sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==} - engines: {node: '>=14.17'} - hasBin: true - typescript@5.9.3: resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==} engines: {node: '>=14.17'} @@ -5544,10 +5520,6 @@ packages: resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} engines: {node: '>=10'} - wrap-ansi@8.1.0: - resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==} - engines: {node: '>=12'} - wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} @@ -5734,8 +5706,8 @@ snapshots: '@canton-network/core-token-standard': 0.11.0 '@canton-network/core-types': 0.10.0 '@canton-network/core-wallet-auth': 0.11.0 - '@grpc/grpc-js': 1.14.1 - '@protobuf-ts/grpc-transport': 2.11.1(@grpc/grpc-js@1.14.1) + '@grpc/grpc-js': 1.14.2 + '@protobuf-ts/grpc-transport': 2.11.1(@grpc/grpc-js@1.14.2) bignumber.js: 9.3.1 dayjs: 1.11.19 openapi-fetch: 0.14.1 @@ -5992,11 +5964,11 @@ snapshots: tslib: 2.8.1 optional: true - '@esbuild-plugins/node-resolve@0.2.2(esbuild@0.25.12)': + '@esbuild-plugins/node-resolve@0.2.2(esbuild@0.27.0)': dependencies: '@types/resolve': 1.20.6 debug: 4.4.3(supports-color@8.1.1) - esbuild: 0.25.12 + esbuild: 0.27.0 escape-string-regexp: 4.0.0 resolve: 1.22.11 transitivePeerDependencies: @@ -6243,7 +6215,7 @@ snapshots: '@floating-ui/utils@0.2.10': {} - '@grpc/grpc-js@1.14.1': + '@grpc/grpc-js@1.14.2': dependencies: '@grpc/proto-loader': 0.8.0 '@js-sdsl/ordered-map': 4.4.2 @@ -6494,15 +6466,6 @@ snapshots: dependencies: '@isaacs/balanced-match': 4.0.1 - '@isaacs/cliui@8.0.2': - dependencies: - string-width: 5.1.2 - string-width-cjs: string-width@4.2.3 - strip-ansi: 7.1.2 - strip-ansi-cjs: strip-ansi@6.0.1 - wrap-ansi: 8.1.0 - wrap-ansi-cjs: wrap-ansi@7.0.0 - '@jridgewell/gen-mapping@0.3.13': dependencies: '@jridgewell/sourcemap-codec': 1.5.5 @@ -6577,34 +6540,34 @@ snapshots: '@tybys/wasm-util': 0.10.1 optional: true - '@next/env@16.0.3': {} + '@next/env@16.0.6': {} - '@next/eslint-plugin-next@16.0.3': + '@next/eslint-plugin-next@16.0.6': dependencies: fast-glob: 3.3.1 - '@next/swc-darwin-arm64@16.0.3': + '@next/swc-darwin-arm64@16.0.6': optional: true - '@next/swc-darwin-x64@16.0.3': + '@next/swc-darwin-x64@16.0.6': optional: true - '@next/swc-linux-arm64-gnu@16.0.3': + '@next/swc-linux-arm64-gnu@16.0.6': optional: true - '@next/swc-linux-arm64-musl@16.0.3': + '@next/swc-linux-arm64-musl@16.0.6': optional: true - '@next/swc-linux-x64-gnu@16.0.3': + '@next/swc-linux-x64-gnu@16.0.6': optional: true - '@next/swc-linux-x64-musl@16.0.3': + '@next/swc-linux-x64-musl@16.0.6': optional: true - '@next/swc-win32-arm64-msvc@16.0.3': + '@next/swc-win32-arm64-msvc@16.0.6': optional: true - '@next/swc-win32-x64-msvc@16.0.3': + '@next/swc-win32-x64-msvc@16.0.6': optional: true '@noble/curves@1.4.2': @@ -6812,9 +6775,9 @@ snapshots: transitivePeerDependencies: - supports-color - '@protobuf-ts/grpc-transport@2.11.1(@grpc/grpc-js@1.14.1)': + '@protobuf-ts/grpc-transport@2.11.1(@grpc/grpc-js@1.14.2)': dependencies: - '@grpc/grpc-js': 1.14.1 + '@grpc/grpc-js': 1.14.2 '@protobuf-ts/runtime': 2.11.1 '@protobuf-ts/runtime-rpc': 2.11.1 @@ -7188,7 +7151,7 @@ snapshots: '@stylistic/eslint-plugin@4.4.1(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3)': dependencies: - '@typescript-eslint/utils': 8.48.0(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) + '@typescript-eslint/utils': 8.48.1(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) eslint: 9.39.1(jiti@2.6.1) eslint-visitor-keys: 4.2.1 espree: 10.4.0 @@ -7378,14 +7341,14 @@ snapshots: dependencies: '@types/node': 24.10.1 - '@typescript-eslint/eslint-plugin@8.48.0(@typescript-eslint/parser@8.48.0(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3)': + '@typescript-eslint/eslint-plugin@8.48.1(@typescript-eslint/parser@8.48.1(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3)': dependencies: '@eslint-community/regexpp': 4.12.2 - '@typescript-eslint/parser': 8.48.0(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) - '@typescript-eslint/scope-manager': 8.48.0 - '@typescript-eslint/type-utils': 8.48.0(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) - '@typescript-eslint/utils': 8.48.0(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) - '@typescript-eslint/visitor-keys': 8.48.0 + '@typescript-eslint/parser': 8.48.1(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) + '@typescript-eslint/scope-manager': 8.48.1 + '@typescript-eslint/type-utils': 8.48.1(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) + '@typescript-eslint/utils': 8.48.1(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) + '@typescript-eslint/visitor-keys': 8.48.1 eslint: 9.39.1(jiti@2.6.1) graphemer: 1.4.0 ignore: 7.0.5 @@ -7395,41 +7358,41 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@8.48.0(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3)': + '@typescript-eslint/parser@8.48.1(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3)': dependencies: - '@typescript-eslint/scope-manager': 8.48.0 - '@typescript-eslint/types': 8.48.0 - '@typescript-eslint/typescript-estree': 8.48.0(typescript@5.9.3) - '@typescript-eslint/visitor-keys': 8.48.0 + '@typescript-eslint/scope-manager': 8.48.1 + '@typescript-eslint/types': 8.48.1 + '@typescript-eslint/typescript-estree': 8.48.1(typescript@5.9.3) + '@typescript-eslint/visitor-keys': 8.48.1 debug: 4.4.3(supports-color@8.1.1) eslint: 9.39.1(jiti@2.6.1) typescript: 5.9.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/project-service@8.48.0(typescript@5.9.3)': + '@typescript-eslint/project-service@8.48.1(typescript@5.9.3)': dependencies: - '@typescript-eslint/tsconfig-utils': 8.48.0(typescript@5.9.3) - '@typescript-eslint/types': 8.48.0 + '@typescript-eslint/tsconfig-utils': 8.48.1(typescript@5.9.3) + '@typescript-eslint/types': 8.48.1 debug: 4.4.3(supports-color@8.1.1) typescript: 5.9.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/scope-manager@8.48.0': + '@typescript-eslint/scope-manager@8.48.1': dependencies: - '@typescript-eslint/types': 8.48.0 - '@typescript-eslint/visitor-keys': 8.48.0 + '@typescript-eslint/types': 8.48.1 + '@typescript-eslint/visitor-keys': 8.48.1 - '@typescript-eslint/tsconfig-utils@8.48.0(typescript@5.9.3)': + '@typescript-eslint/tsconfig-utils@8.48.1(typescript@5.9.3)': dependencies: typescript: 5.9.3 - '@typescript-eslint/type-utils@8.48.0(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3)': + '@typescript-eslint/type-utils@8.48.1(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3)': dependencies: - '@typescript-eslint/types': 8.48.0 - '@typescript-eslint/typescript-estree': 8.48.0(typescript@5.9.3) - '@typescript-eslint/utils': 8.48.0(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) + '@typescript-eslint/types': 8.48.1 + '@typescript-eslint/typescript-estree': 8.48.1(typescript@5.9.3) + '@typescript-eslint/utils': 8.48.1(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) debug: 4.4.3(supports-color@8.1.1) eslint: 9.39.1(jiti@2.6.1) ts-api-utils: 2.1.0(typescript@5.9.3) @@ -7437,14 +7400,14 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/types@8.48.0': {} + '@typescript-eslint/types@8.48.1': {} - '@typescript-eslint/typescript-estree@8.48.0(typescript@5.9.3)': + '@typescript-eslint/typescript-estree@8.48.1(typescript@5.9.3)': dependencies: - '@typescript-eslint/project-service': 8.48.0(typescript@5.9.3) - '@typescript-eslint/tsconfig-utils': 8.48.0(typescript@5.9.3) - '@typescript-eslint/types': 8.48.0 - '@typescript-eslint/visitor-keys': 8.48.0 + '@typescript-eslint/project-service': 8.48.1(typescript@5.9.3) + '@typescript-eslint/tsconfig-utils': 8.48.1(typescript@5.9.3) + '@typescript-eslint/types': 8.48.1 + '@typescript-eslint/visitor-keys': 8.48.1 debug: 4.4.3(supports-color@8.1.1) minimatch: 9.0.5 semver: 7.7.3 @@ -7454,20 +7417,20 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@8.48.0(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3)': + '@typescript-eslint/utils@8.48.1(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3)': dependencies: '@eslint-community/eslint-utils': 4.9.0(eslint@9.39.1(jiti@2.6.1)) - '@typescript-eslint/scope-manager': 8.48.0 - '@typescript-eslint/types': 8.48.0 - '@typescript-eslint/typescript-estree': 8.48.0(typescript@5.9.3) + '@typescript-eslint/scope-manager': 8.48.1 + '@typescript-eslint/types': 8.48.1 + '@typescript-eslint/typescript-estree': 8.48.1(typescript@5.9.3) eslint: 9.39.1(jiti@2.6.1) typescript: 5.9.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/visitor-keys@8.48.0': + '@typescript-eslint/visitor-keys@8.48.1': dependencies: - '@typescript-eslint/types': 8.48.0 + '@typescript-eslint/types': 8.48.1 eslint-visitor-keys: 4.2.1 '@typescript/analyze-trace@0.10.1': @@ -7657,8 +7620,6 @@ snapshots: dependencies: color-convert: 2.0.1 - ansi-styles@6.2.3: {} - ansicolors@0.3.2: {} ansis@4.0.0-node10: {} @@ -7881,7 +7842,7 @@ snapshots: dependencies: baseline-browser-mapping: 2.8.32 caniuse-lite: 1.0.30001757 - electron-to-chromium: 1.5.262 + electron-to-chromium: 1.5.263 node-releases: 2.0.27 update-browserslist-db: 1.1.4(browserslist@4.28.0) @@ -8267,7 +8228,7 @@ snapshots: detective-typescript@14.0.0(typescript@5.9.3): dependencies: - '@typescript-eslint/typescript-estree': 8.48.0(typescript@5.9.3) + '@typescript-eslint/typescript-estree': 8.48.1(typescript@5.9.3) ast-module-types: 6.0.1 node-source-walk: 7.0.1 typescript: 5.9.3 @@ -8325,8 +8286,6 @@ snapshots: es-errors: 1.3.0 gopd: 1.2.0 - eastasianwidth@0.2.0: {} - effect@3.19.8: dependencies: '@standard-schema/spec': 1.0.0 @@ -8336,7 +8295,7 @@ snapshots: dependencies: jake: 10.9.4 - electron-to-chromium@1.5.262: {} + electron-to-chromium@1.5.263: {} emoji-regex@10.6.0: {} @@ -8545,9 +8504,9 @@ snapshots: optionalDependencies: source-map: 0.6.1 - eslint-config-next@16.0.3(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3): + eslint-config-next@16.0.6(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3): dependencies: - '@next/eslint-plugin-next': 16.0.3 + '@next/eslint-plugin-next': 16.0.6 eslint: 9.39.1(jiti@2.6.1) eslint-import-resolver-node: 0.3.9 eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0)(eslint@9.39.1(jiti@2.6.1)) @@ -8556,7 +8515,7 @@ snapshots: eslint-plugin-react: 7.37.5(eslint@9.39.1(jiti@2.6.1)) eslint-plugin-react-hooks: 7.0.1(eslint@9.39.1(jiti@2.6.1)) globals: 16.4.0 - typescript-eslint: 8.48.0(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) + typescript-eslint: 8.48.1(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) optionalDependencies: typescript: 5.9.3 transitivePeerDependencies: @@ -8565,6 +8524,10 @@ snapshots: - eslint-plugin-import-x - supports-color + eslint-config-prettier@10.1.8(eslint@9.39.1(jiti@2.6.1)): + dependencies: + eslint: 9.39.1(jiti@2.6.1) + eslint-import-resolver-node@0.3.9: dependencies: debug: 3.2.7 @@ -8898,11 +8861,6 @@ snapshots: dependencies: is-callable: 1.2.7 - foreground-child@3.3.1: - dependencies: - cross-spawn: 7.0.6 - signal-exit: 4.1.0 - form-data@4.0.5: dependencies: asynckit: 0.4.0 @@ -9025,15 +8983,6 @@ snapshots: dependencies: is-glob: 4.0.3 - glob@11.0.1: - dependencies: - foreground-child: 3.3.1 - jackspeak: 4.1.1 - minimatch: 10.1.1 - minipass: 7.1.2 - package-json-from-dist: 1.0.1 - path-scurry: 2.0.1 - glob@13.0.0: dependencies: minimatch: 10.1.1 @@ -9398,10 +9347,6 @@ snapshots: has-symbols: 1.1.0 set-function-name: 2.0.2 - jackspeak@4.1.1: - dependencies: - '@isaacs/cliui': 8.0.2 - jake@10.9.4: dependencies: async: 3.2.6 @@ -9623,7 +9568,7 @@ snapshots: dependencies: react: 19.2.0 - madge@8.0.0(typescript@5.8.2): + madge@8.0.0(typescript@5.9.3): dependencies: chalk: 4.1.2 commander: 7.2.0 @@ -9638,7 +9583,7 @@ snapshots: ts-graphviz: 2.1.6 walkdir: 0.4.1 optionalDependencies: - typescript: 5.8.2 + typescript: 5.9.3 transitivePeerDependencies: - supports-color @@ -9754,9 +9699,9 @@ snapshots: react: 19.2.0 react-dom: 19.2.0(react@19.2.0) - next@16.0.3(@babel/core@7.28.5)(react-dom@19.2.0(react@19.2.0))(react@19.2.0): + next@16.0.6(@babel/core@7.28.5)(react-dom@19.2.0(react@19.2.0))(react@19.2.0): dependencies: - '@next/env': 16.0.3 + '@next/env': 16.0.6 '@swc/helpers': 0.5.15 caniuse-lite: 1.0.30001757 postcss: 8.4.31 @@ -9764,14 +9709,14 @@ snapshots: react-dom: 19.2.0(react@19.2.0) styled-jsx: 5.1.6(@babel/core@7.28.5)(react@19.2.0) optionalDependencies: - '@next/swc-darwin-arm64': 16.0.3 - '@next/swc-darwin-x64': 16.0.3 - '@next/swc-linux-arm64-gnu': 16.0.3 - '@next/swc-linux-arm64-musl': 16.0.3 - '@next/swc-linux-x64-gnu': 16.0.3 - '@next/swc-linux-x64-musl': 16.0.3 - '@next/swc-win32-arm64-msvc': 16.0.3 - '@next/swc-win32-x64-msvc': 16.0.3 + '@next/swc-darwin-arm64': 16.0.6 + '@next/swc-darwin-x64': 16.0.6 + '@next/swc-linux-arm64-gnu': 16.0.6 + '@next/swc-linux-arm64-musl': 16.0.6 + '@next/swc-linux-x64-gnu': 16.0.6 + '@next/swc-linux-x64-musl': 16.0.6 + '@next/swc-win32-arm64-msvc': 16.0.6 + '@next/swc-win32-x64-msvc': 16.0.6 sharp: 0.34.5 transitivePeerDependencies: - '@babel/core' @@ -10728,12 +10673,6 @@ snapshots: is-fullwidth-code-point: 3.0.0 strip-ansi: 6.0.1 - string-width@5.1.2: - dependencies: - eastasianwidth: 0.2.0 - emoji-regex: 9.2.2 - strip-ansi: 7.1.2 - string-width@7.2.0: dependencies: emoji-regex: 10.6.0 @@ -11107,12 +11046,12 @@ snapshots: possible-typed-array-names: 1.1.0 reflect.getprototypeof: 1.0.10 - typescript-eslint@8.48.0(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3): + typescript-eslint@8.48.1(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3): dependencies: - '@typescript-eslint/eslint-plugin': 8.48.0(@typescript-eslint/parser@8.48.0(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) - '@typescript-eslint/parser': 8.48.0(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) - '@typescript-eslint/typescript-estree': 8.48.0(typescript@5.9.3) - '@typescript-eslint/utils': 8.48.0(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) + '@typescript-eslint/eslint-plugin': 8.48.1(@typescript-eslint/parser@8.48.1(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) + '@typescript-eslint/parser': 8.48.1(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) + '@typescript-eslint/typescript-estree': 8.48.1(typescript@5.9.3) + '@typescript-eslint/utils': 8.48.1(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.3) eslint: 9.39.1(jiti@2.6.1) typescript: 5.9.3 transitivePeerDependencies: @@ -11120,8 +11059,6 @@ snapshots: typescript-lru-cache@2.0.0: {} - typescript@5.8.2: {} - typescript@5.9.3: {} unbox-primitive@1.1.0: @@ -11376,12 +11313,6 @@ snapshots: string-width: 4.2.3 strip-ansi: 6.0.1 - wrap-ansi@8.1.0: - dependencies: - ansi-styles: 6.2.3 - string-width: 5.1.2 - strip-ansi: 7.1.2 - wrappy@1.0.2: {} ws@7.5.10: {} diff --git a/scripts/src/lib/utils.ts b/scripts/src/lib/utils.ts index 29364df..6880f03 100644 --- a/scripts/src/lib/utils.ts +++ b/scripts/src/lib/utils.ts @@ -1,137 +1,139 @@ // Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. // SPDX-License-Identifier: Apache-2.0 -import zlib from 'zlib' -import { pipeline } from 'stream/promises' -import crypto from 'crypto' -import * as fs from 'fs' -import * as path from 'path' -import * as process from 'process' -import { white, green, italic, red, yellow, bold } from 'yoctocolors' -import * as jsonc from 'jsonc-parser' -import * as tar from 'tar-fs' -import { exec } from 'child_process' -import { promisify } from 'util' - -const ex = promisify(exec) - -export const info = (message: string): string => italic(white(message)) -export const warn = (message: string): string => bold(yellow(message)) -export const error = (message: string): string => bold(red(message)) -export const success = (message: string): string => green(message) +import zlib from "zlib"; +import { pipeline } from "stream/promises"; +import crypto from "crypto"; +import * as fs from "fs"; +import * as path from "path"; +import * as process from "process"; +import { white, green, italic, red, yellow, bold } from "yoctocolors"; +import * as jsonc from "jsonc-parser"; +import * as tar from "tar-fs"; +import { exec } from "child_process"; +import { promisify } from "util"; + +const ex = promisify(exec); + +export const info = (message: string): string => italic(white(message)); +export const warn = (message: string): string => bold(yellow(message)); +export const error = (message: string): string => bold(red(message)); +export const success = (message: string): string => green(message); export const trimNewline = (message: string): string => - message.replace(/\n$/, '') - -const repoRoot = getRepoRoot() -export const CANTON_PATH = path.join(repoRoot, '.canton') -export const SPLICE_PATH = path.join(repoRoot, '.splice') -export const SPLICE_SPEC_PATH = path.join(repoRoot, '.splice-spec') -export const CANTON_BIN = path.join(CANTON_PATH, 'bin/canton') -export const CANTON_CONF = path.join(repoRoot, 'canton/canton.conf') -export const CANTON_BOOTSTRAP = path.join(repoRoot, 'canton/bootstrap.canton') -export const API_SPECS_PATH = path.join(repoRoot, 'api-specs') -export const UTILS_FILE_PATH = path.join(repoRoot, 'scripts/src/lib/utils.ts') + message.replace(/\n$/, ""); + +const repoRoot = getRepoRoot(); +export const CANTON_PATH = path.join(repoRoot, ".canton"); +export const SPLICE_PATH = path.join(repoRoot, ".splice"); +export const SPLICE_SPEC_PATH = path.join(repoRoot, ".splice-spec"); +export const CANTON_BIN = path.join(CANTON_PATH, "bin/canton"); +export const CANTON_CONF = path.join(repoRoot, "canton/canton.conf"); +export const CANTON_BOOTSTRAP = path.join(repoRoot, "canton/bootstrap.canton"); +export const API_SPECS_PATH = path.join(repoRoot, "api-specs"); +export const UTILS_FILE_PATH = path.join(repoRoot, "scripts/src/lib/utils.ts"); export type CantonVersionAndHash = { - version: string - hash: string -} + version: string; + hash: string; +}; // Canton versions -export const DAML_RELEASE_VERSION = '3.3.0-snapshot.20251108.16145.0.v21f4ad7f' +// export const DAML_RELEASE_VERSION = '3.3.0-snapshot.20251108.16145.0.v21f4ad7f' +export const DAML_RELEASE_VERSION = "3.4.8"; export const LOCALNET_ARCHIVE_HASH = - '706c4412d1cb29285fe8a591e74f44458d2afcbb04603c32cdb6c6260538145f' + // "706c4412d1cb29285fe8a591e74f44458d2afcbb04603c32cdb6c6260538145f"; + "2c3d3d15724f29c26ecbea9162a426710ff4a56d12ee8247f01c825259a465b6"; export const SPLICE_ARCHIVE_HASH = - 'dbe943a466f06624c2f55e2e4ad66180e81804bbcb0288b6a4882df49702a4b1' + "dbe943a466f06624c2f55e2e4ad66180e81804bbcb0288b6a4882df49702a4b1"; export const SPLICE_SPEC_ARCHIVE_HASH = - '102dba4a7224a0acc2544111ecdf2e6538de2b29bcc3bd7348edf4b445e07329' + "102dba4a7224a0acc2544111ecdf2e6538de2b29bcc3bd7348edf4b445e07329"; export const CANTON_ARCHIVE_HASH = - '43c89d9833886fc68cac4951ba1959b7f6cc5269abfff1ba5129859203aa8cd3' -export const SPLICE_VERSION = '0.4.25' + "43c89d9833886fc68cac4951ba1959b7f6cc5269abfff1ba5129859203aa8cd3"; +export const SPLICE_VERSION = "0.5.3"; export const SUPPORTED_VERSIONS = { devnet: { canton: { - version: '3.4.0-snapshot.20250922.16951.0.v1eb3f268', - hash: 'e0f59a7b5015b56479ef4786662c5935a0fee9ac803465bb0f70bdc6c3bf4dff', + version: "3.4.0-snapshot.20250922.16951.0.v1eb3f268", + hash: "e0f59a7b5015b56479ef4786662c5935a0fee9ac803465bb0f70bdc6c3bf4dff", }, }, mainnet: { canton: { - version: '3.3.0-snapshot.20250910.16087.0.v82d35a4d', - hash: '43c89d9833886fc68cac4951ba1959b7f6cc5269abfff1ba5129859203aa8cd3', + version: "3.3.0-snapshot.20250910.16087.0.v82d35a4d", + hash: "43c89d9833886fc68cac4951ba1959b7f6cc5269abfff1ba5129859203aa8cd3", }, }, -} +}; export async function downloadToFile( url: string | URL, directory: string, hash?: string ) { - const filename = path.basename(url.toString()) - const res = await fetch(url) + const filename = path.basename(url.toString()); + const res = await fetch(url); if (!res.ok || !res.body) { - throw new Error(`Failed to download: ${url}`) + throw new Error(`Failed to download: ${url}`); } - await ensureDir(directory) + await ensureDir(directory); await pipeline( res.body, fs.createWriteStream(path.join(directory, filename)) - ) + ); if (hash) { await verifyFileIntegrity( path.join(directory, filename), hash, - 'sha256' - ) + "sha256" + ); } } export async function verifyFileIntegrity( filePath: string, expectedHash: string, - algo = 'sha256' + algo = "sha256" ): Promise { if (!fs.existsSync(filePath)) { - return false + return false; } - const computedHash = await computeFileHash(filePath, algo) + const computedHash = await computeFileHash(filePath, algo); if (computedHash === expectedHash) { console.log( success( `${algo.toUpperCase()} checksum verification of ${filePath} successful.` ) - ) + ); } else { console.log( error( `File hashes did not match.\n\tExpected: ${expectedHash}\n\tReceived: ${computedHash}\nDeleting ${filePath}...` ) - ) + ); //process.exit(1) } - return true + return true; } async function computeFileHash( filePath: string, - algo = 'sha256' + algo = "sha256" ): Promise { return new Promise((resolve, reject) => { - const hash = crypto.createHash(algo) - const stream = fs.createReadStream(filePath) - - stream.on('data', (chunk) => hash.update(chunk)) - stream.on('end', () => { - const computedHash = hash.digest('hex') - resolve(computedHash) - }) - stream.on('error', (err) => reject(err)) - }) + const hash = crypto.createHash(algo); + const stream = fs.createReadStream(filePath); + + stream.on("data", (chunk) => hash.update(chunk)); + stream.on("end", () => { + const computedHash = hash.digest("hex"); + resolve(computedHash); + }); + stream.on("error", (err) => reject(err)); + }); } export async function downloadAndUnpackTarball( @@ -140,157 +142,161 @@ export async function downloadAndUnpackTarball( unpackDir: string, options?: { hash?: string; strip?: number; updateHash?: boolean } ) { - let shouldDownload = true - let currentHash = options?.hash - const algo = 'sha256' + let shouldDownload = true; + let currentHash = options?.hash; + const algo = "sha256"; - ensureDir(path.dirname(tarfile)) - ensureDir(path.dirname(unpackDir)) + ensureDir(path.dirname(tarfile)); + ensureDir(path.dirname(unpackDir)); if (fs.existsSync(tarfile) && options?.hash) { // File exists, check hash - const validFile = await verifyFileIntegrity(tarfile, options.hash, algo) - shouldDownload = !validFile + const validFile = await verifyFileIntegrity( + tarfile, + options.hash, + algo + ); + shouldDownload = !validFile; } if (shouldDownload) { - console.log(info(`Downloading tarball from ${url} to ${tarfile}...`)) - const res = await fetch(url) + console.log(info(`Downloading tarball from ${url} to ${tarfile}...`)); + const res = await fetch(url); if (!res.ok || !res.body) { - throw new Error(`Failed to download: ${url}`) + throw new Error(`Failed to download: ${url}`); } - await pipeline(res.body, fs.createWriteStream(tarfile)) - console.log(success('Download complete.')) + await pipeline(res.body, fs.createWriteStream(tarfile)); + console.log(success("Download complete.")); } if (options?.updateHash) { - const newHash = await computeFileHash(tarfile, algo) + const newHash = await computeFileHash(tarfile, algo); // Update the hash in utils.ts if present - const fileContent = fs.readFileSync(UTILS_FILE_PATH, 'utf8') + const fileContent = fs.readFileSync(UTILS_FILE_PATH, "utf8"); // Find the old hash in the file (matching the old value) if (options?.hash && fileContent.includes(options.hash)) { - const updatedContent = fileContent.replace(options.hash, newHash) + const updatedContent = fileContent.replace(options.hash, newHash); if (updatedContent !== fileContent) { - fs.writeFileSync(UTILS_FILE_PATH, updatedContent, 'utf8') - console.log(success(`Updated hash in utils.ts to ${newHash}`)) + fs.writeFileSync(UTILS_FILE_PATH, updatedContent, "utf8"); + console.log(success(`Updated hash in utils.ts to ${newHash}`)); } } else { console.log( - warn('Old hash not found in utils.ts, no update performed.') - ) + warn("Old hash not found in utils.ts, no update performed.") + ); } - currentHash = newHash + currentHash = newHash; } if (!options?.updateHash && currentHash) { - const validFile = await verifyFileIntegrity(tarfile, currentHash, algo) + const validFile = await verifyFileIntegrity(tarfile, currentHash, algo); const downloadedHash = crypto .createHash(algo) .update(fs.readFileSync(tarfile)) - .digest('hex') + .digest("hex"); if (!validFile) { // Remove the bad file throw new Error( error( `Checksum mismatch for downloaded tarball.\n\tExpected: ${currentHash}\n\tReceived: ${downloadedHash}` ) - ) + ); } } - await ensureDir(unpackDir) + await ensureDir(unpackDir); await pipeline( fs.createReadStream(tarfile), zlib.createGunzip(), tar.extract(unpackDir, { strip: options?.strip ?? 1 }) - ) - console.log(success(`Unpacked tarball into ${unpackDir}`)) + ); + console.log(success(`Unpacked tarball into ${unpackDir}`)); } // Get the root of the current repository // Assumption: the root of the repository is the closest // ancestor directory of the CWD that contains a .git directory export function getRepoRoot(): string { - const cwd = process.cwd() - const segments = cwd.split('/') + const cwd = process.cwd(); + const segments = cwd.split("/"); for (let i = segments.length; i > 0; i--) { - const potentialRoot = segments.slice(0, i).join('/') - if (fs.existsSync(path.join(potentialRoot, '.git'))) { - return potentialRoot + const potentialRoot = segments.slice(0, i).join("/"); + if (fs.existsSync(path.join(potentialRoot, ".git"))) { + return potentialRoot; } } console.error( error(`${cwd} does not seem to be inside a valid git repository.`) - ) - process.exit(1) + ); + process.exit(1); } export function findJsonKeyPosition( jsonContent: string, key: string ): { line: number; column: number } { - const keyPath = key.split('.') - let found: { line: number; column: number } | null = null + const keyPath = key.split("."); + let found: { line: number; column: number } | null = null; function search(node: jsonc.Node, pathIdx: number) { - if (!node || found) return - if (node.type === 'object') { + if (!node || found) return; + if (node.type === "object") { for (const prop of node.children ?? []) { - if (prop.type === 'property' && prop.children?.[0]?.value) { - const propName = prop.children[0].value as string - const isLast = pathIdx === keyPath.length - 1 + if (prop.type === "property" && prop.children?.[0]?.value) { + const propName = prop.children[0].value as string; + const isLast = pathIdx === keyPath.length - 1; const matches = isLast ? propName.startsWith(keyPath[pathIdx]) - : propName === keyPath[pathIdx] + : propName === keyPath[pathIdx]; // If matches, advance pathIdx if (matches) { if (isLast) { - const offset = prop.children[0].offset - const before = jsonContent.slice(0, offset) - const lines = before.split('\n') + const offset = prop.children[0].offset; + const before = jsonContent.slice(0, offset); + const lines = before.split("\n"); found = { line: lines.length, column: lines[lines.length - 1].length + 1, - } - return + }; + return; } else if (prop.children[1]) { - search(prop.children[1], pathIdx + 1) + search(prop.children[1], pathIdx + 1); } } // Always search deeper with the same pathIdx (skip intermediate keys) if (prop.children[1]) { - search(prop.children[1], pathIdx) + search(prop.children[1], pathIdx); } } } - } else if (node.type === 'array') { + } else if (node.type === "array") { for (const child of node.children ?? []) { - search(child, pathIdx) + search(child, pathIdx); } } } - const root = jsonc.parseTree(jsonContent) - if (root) search(root, 0) + const root = jsonc.parseTree(jsonContent); + if (root) search(root, 0); - return found ?? { line: 1, column: 1 } + return found ?? { line: 1, column: 1 }; } export function traverseDirectory( directory: string, callback: (filePath: string) => void ): void { - const entries = fs.readdirSync(directory) + const entries = fs.readdirSync(directory); for (const entry of entries) { - const fullPath = path.join(directory, entry) + const fullPath = path.join(directory, entry); if (fs.statSync(fullPath).isDirectory()) { - traverseDirectory(fullPath, callback) + traverseDirectory(fullPath, callback); } else { - callback(fullPath) + callback(fullPath); } } } @@ -301,37 +307,37 @@ export function getAllFilesWithExtension( ext?: string, recursive = true ): string[] { - let results: string[] = [] - const list = fs.readdirSync(dir) + let results: string[] = []; + const list = fs.readdirSync(dir); for (const file of list) { - const filePath = path.join(dir, file) - const stat = fs.statSync(filePath) + const filePath = path.join(dir, file); + const stat = fs.statSync(filePath); if (stat && stat.isDirectory()) { if (recursive) { results = results.concat( getAllFilesWithExtension(filePath, ext, true) - ) + ); } } else if (ext === undefined || filePath.endsWith(ext)) { - results.push(filePath) + results.push(filePath); } } - return results + return results; } // Ensure a directory exists export async function ensureDir(dir: string) { if (!fs.existsSync(dir)) { - fs.mkdirSync(dir, { recursive: true }) + fs.mkdirSync(dir, { recursive: true }); } } // Copy a file export async function copyFileRecursive(src: string, dest: string) { - fs.copyFileSync(src, dest) + fs.copyFileSync(src, dest); } -export type markingLevel = 'info' | 'warn' | 'error' +export type markingLevel = "info" | "warn" | "error"; export function markFile( relativePath: string, fileContent: string, @@ -339,21 +345,21 @@ export function markFile( warning: string, markingLevel: markingLevel ): void { - const typePosition = findJsonKeyPosition(fileContent, key) - const line = typePosition.line || 1 - const column = typePosition.column || 1 - if (markingLevel === 'error') { + const typePosition = findJsonKeyPosition(fileContent, key); + const line = typePosition.line || 1; + const column = typePosition.column || 1; + if (markingLevel === "error") { console.error( `::error file=${relativePath},line=${line},col=${column}::${warning}` - ) - } else if (markingLevel === 'warn') { + ); + } else if (markingLevel === "warn") { console.warn( `::warning file=${relativePath},line=${line},col=${column}::${warning}` - ) - } else if (markingLevel === 'info') { + ); + } else if (markingLevel === "info") { console.info( `::info file=${relativePath},line=${line},col=${column}::${warning}` - ) + ); } } @@ -370,10 +376,10 @@ export function mapObject( ): Record { return Object.fromEntries( Object.entries(obj).map(([k, v]) => { - const mapped = mapFn(k, v) - return Array.isArray(mapped) ? mapped : [k, mapped] + const mapped = mapFn(k, v); + return Array.isArray(mapped) ? mapped : [k, mapped]; }) - ) + ); } /** @@ -384,19 +390,19 @@ export function mapObject( * @returns the elided string */ export function elideMiddle(s: string, len = 8) { - const elider = '...' - const totalLen = s.length + const elider = "..."; + const totalLen = s.length; - if (totalLen <= len) return s - if (len <= elider.length) return s + if (totalLen <= len) return s; + if (len <= elider.length) return s; - const halfway = Math.floor(totalLen / 2) + const halfway = Math.floor(totalLen / 2); return ( s.slice(0, halfway - Math.floor(len / 2)) + elider + s.slice(halfway + Math.floor(len / 2)) - ) + ); } /** @@ -407,39 +413,39 @@ export async function getAllNxDependencies( ): Promise { const projects: string[] = await ex(`yarn nx show projects --json`, { cwd: repoRoot, - }).then(({ stdout }) => JSON.parse(stdout)) + }).then(({ stdout }) => JSON.parse(stdout)); if (!projects.includes(projectName)) { - throw new Error(`Project ${projectName} does not exist.`) + throw new Error(`Project ${projectName} does not exist.`); } interface NxGraph { - nodes: Record - dependencies: Record + nodes: Record; + dependencies: Record; } const { nodes, dependencies }: NxGraph = await ex( `yarn nx graph --print --focus=${projectName}`, { cwd: repoRoot } - ).then(({ stdout }) => JSON.parse(stdout).graph) + ).then(({ stdout }) => JSON.parse(stdout).graph); // Nx shows both child dependencies and parent (reverse) dependencies for the focused package. // Filter out reverse dependencies. const childDependencies: string[] = Object.entries(dependencies).reduce< string[] >((prev, current) => { - const [key, value] = current + const [key, value] = current; if (value.every((dep) => dep.target !== projectName)) { - prev.push(key) + prev.push(key); } - return prev - }, []) + return prev; + }, []); // Nx shows dependencies (example: @daml.js) that are not published to npm // Filter to only public packages (those tagged with "npm:public"). const publicDependencies: string[] = childDependencies.filter((dep) => { - return nodes[dep].data.tags.includes('npm:public') - }) + return nodes[dep].data.tags.includes("npm:public"); + }); - return publicDependencies + return publicDependencies; }