@ic-reactor/mcp 0.0.0-stage → 0.0.0
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/.github/ISSUE_TEMPLATE/bug_report.yml +108 -0
- package/.github/ISSUE_TEMPLATE/config.yml +8 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +77 -0
- package/.github/actions/setup-rust-wasm/action.yml +25 -0
- package/.github/dependabot.yml +107 -0
- package/.github/workflows/auth-latest.yml +67 -0
- package/.github/workflows/b3pay-site.yml +49 -0
- package/.github/workflows/ci.yml +430 -0
- package/.github/workflows/codeql.yml +41 -0
- package/.github/workflows/dependency-review.yml +68 -0
- package/.github/workflows/docs-check.yml +98 -0
- package/.github/workflows/docs.yml +265 -0
- package/.github/workflows/e2e.yml +90 -0
- package/.github/workflows/examples-published.yml +97 -0
- package/.github/workflows/release.yml +326 -0
- package/.husky/pre-commit +12 -0
- package/.prettierignore +109 -0
- package/.prettierrc +6 -0
- package/AGENTS.md +103 -0
- package/CHANGELOG.md +3268 -0
- package/CLAUDE.md +93 -0
- package/CNAME +1 -0
- package/CODE_OF_CONDUCT.md +7 -0
- package/CONTRIBUTING.md +433 -0
- package/LICENSE +21 -0
- package/README.md +2 -2
- package/SECURITY.md +74 -0
- package/b3pay-module.json +194 -0
- package/docs/.remarkrc.json +10 -0
- package/docs/README.md +64 -0
- package/docs/astro.config.mjs +205 -0
- package/docs/favicon.svg +15 -0
- package/docs/package.json +39 -0
- package/docs/public/favicon.svg +15 -0
- package/docs/public/ic-reactor-social-card.png +0 -0
- package/docs/scripts/b3pay-static.mjs +22 -0
- package/docs/scripts/check-example-docs.mjs +214 -0
- package/docs/scripts/check-links.mjs +212 -0
- package/docs/scripts/fix-dist-links.js +125 -0
- package/docs/scripts/fix-frontmatter.js +71 -0
- package/docs/scripts/remove-redundant-h1.cjs +48 -0
- package/docs/scripts/rewrite-typedoc-links.js +110 -0
- package/docs/scripts/split-index.js +69 -0
- package/docs/src/assets/ic-reactor-hero-dark.svg +23 -0
- package/docs/src/assets/ic-reactor-hero-light.svg +23 -0
- package/docs/src/assets/ic-reactor-lockup-dark.svg +15 -0
- package/docs/src/assets/ic-reactor-lockup-light.svg +15 -0
- package/docs/src/assets/ic-reactor-mark-dark.svg +14 -0
- package/docs/src/assets/ic-reactor-mark-light.svg +14 -0
- package/docs/src/assets/layers/candid-core-layer-icon-dark.svg +4 -0
- package/docs/src/assets/layers/candid-core-layer-icon-light.svg +4 -0
- package/docs/src/assets/layers/candid-profile-layer-icon-dark.svg +4 -0
- package/docs/src/assets/layers/candid-profile-layer-icon-light.svg +4 -0
- package/docs/src/assets/layers/ic-reactor-layer-icon-dark.svg +4 -0
- package/docs/src/assets/layers/ic-reactor-layer-icon-light.svg +4 -0
- package/docs/src/components/LibraryCards.astro +172 -0
- package/docs/src/components/LibraryIcon.astro +28 -0
- package/docs/src/components/SiteTitle.astro +241 -0
- package/docs/src/content/docs/404.mdx +19 -0
- package/docs/src/content/docs/build/agent-tools.mdx +593 -0
- package/docs/src/content/docs/build/icrc1-wallet.mdx +619 -0
- package/docs/src/content/docs/build/ssr-per-user.mdx +552 -0
- package/docs/src/content/docs/examples/canister-studio.mdx +95 -0
- package/docs/src/content/docs/examples/icrc-ledger.mdx +45 -0
- package/docs/src/content/docs/examples/index.mdx +38 -0
- package/docs/src/content/docs/examples/next-ssr.mdx +73 -0
- package/docs/src/content/docs/examples/node-agent-tool.mdx +80 -0
- package/docs/src/content/docs/examples/vite-wallet.mdx +71 -0
- package/docs/src/content/docs/guides/auth.mdx +1181 -0
- package/docs/src/content/docs/guides/client.mdx +551 -0
- package/docs/src/content/docs/guides/deploy.mdx +180 -0
- package/docs/src/content/docs/guides/errors.mdx +475 -0
- package/docs/src/content/docs/guides/getting-started.mdx +620 -0
- package/docs/src/content/docs/guides/reads.mdx +586 -0
- package/docs/src/content/docs/guides/ssr.mdx +529 -0
- package/docs/src/content/docs/guides/testing.mdx +401 -0
- package/docs/src/content/docs/guides/values.mdx +261 -0
- package/docs/src/content/docs/guides/vite-plugin.mdx +690 -0
- package/docs/src/content/docs/guides/writes.mdx +572 -0
- package/docs/src/content/docs/ic-reactor/index.mdx +167 -0
- package/docs/src/content/docs/index.mdx +65 -0
- package/docs/src/content/docs/migrating-from-3.mdx +535 -0
- package/docs/src/content/docs/packages/core.mdx +186 -0
- package/docs/src/content/docs/packages/mcp.mdx +163 -0
- package/docs/src/content/docs/packages/react.mdx +207 -0
- package/docs/src/content/docs/packages/vite-plugin.mdx +73 -0
- package/docs/src/content/docs/versioning.mdx +104 -0
- package/docs/src/content.config.ts +7 -0
- package/docs/src/styles/custom.css +189 -0
- package/docs/tsconfig.typedoc.json +26 -0
- package/docs/typedoc-entry.ts +17 -0
- package/docs/typedoc.json +37 -0
- package/e2e/Cargo.lock +646 -0
- package/e2e/Cargo.toml +3 -0
- package/e2e/README.md +101 -0
- package/e2e/frontends/build.mjs +94 -0
- package/e2e/frontends/index.html +10 -0
- package/e2e/global-setup.ts +65 -0
- package/e2e/icp.yaml +38 -0
- package/e2e/package.json +40 -0
- package/e2e/setup.ts +6 -0
- package/e2e/src/actor/Cargo.toml +14 -0
- package/e2e/src/actor/hello_actor.did +10 -0
- package/e2e/src/actor/src/lib.rs +73 -0
- package/e2e/src/calls.test.ts +132 -0
- package/e2e/src/declarations/hello_actor.envelope.json +175 -0
- package/e2e/src/declarations/hello_actor.ts +15 -0
- package/e2e/src/errors.test.ts +107 -0
- package/e2e/src/frontend-headers.test.ts +253 -0
- package/e2e/src/identity.test.ts +61 -0
- package/e2e/src/react.test.tsx +59 -0
- package/e2e/src/replica.ts +70 -0
- package/e2e/src/vite-env.test.ts +108 -0
- package/e2e/test.sh +47 -0
- package/e2e/tsconfig.json +20 -0
- package/e2e/tsconfig.typecheck.json +9 -0
- package/e2e/vitest.config.ts +22 -0
- package/eslint.config.mjs +100 -0
- package/evals/PREREGISTRATION.md +1346 -0
- package/evals/README.md +756 -0
- package/evals/conditions/thin/condition.json +8 -0
- package/evals/conditions/thin/docs/candid-core-cli.README.md +90 -0
- package/evals/conditions/thin/docs/candid-core-schema.README.md +339 -0
- package/evals/conditions/thin/package.json +25 -0
- package/evals/conditions/thin/starter/src/generated/icrc1.ts +57 -0
- package/evals/conditions/thin-guide/condition.json +10 -0
- package/evals/conditions/thin-guide/docs/llms.txt +292 -0
- package/evals/conditions/v3/condition.json +9 -0
- package/evals/conditions/v3/docs/ic-reactor-core.llms.txt +232 -0
- package/evals/conditions/v3/docs/ic-reactor-react.llms.txt +280 -0
- package/evals/conditions/v3/docs/llms-full.txt +1053 -0
- package/evals/conditions/v3/package.json +26 -0
- package/evals/conditions/v3/starter/src/declarations/icrc1.did.d.ts +95 -0
- package/evals/conditions/v3/starter/src/declarations/icrc1.did.js +140 -0
- package/evals/conditions/v4/PORTING.md +384 -0
- package/evals/conditions/v4/README.md +106 -0
- package/evals/conditions/v4/condition.json +5 -0
- package/evals/conditions/v4/docs/llms.txt +323 -0
- package/evals/conditions/v4/package.json +27 -0
- package/evals/conditions/v4/starter/src/generated/icrc1.ts +78 -0
- package/evals/conditions/v4-proto/condition.json +6 -0
- package/evals/conditions/v4-proto/docs/llms.txt +291 -0
- package/evals/conditions/v4-proto/lib/SHIM-NOTES.md +20 -0
- package/evals/conditions/v4-proto/lib/package.json +27 -0
- package/evals/conditions/v4-proto/lib/src/client.ts +471 -0
- package/evals/conditions/v4-proto/lib/src/errors.ts +214 -0
- package/evals/conditions/v4-proto/lib/src/index.ts +36 -0
- package/evals/conditions/v4-proto/lib/src/principal.ts +175 -0
- package/evals/conditions/v4-proto/lib/src/service.ts +69 -0
- package/evals/conditions/v4-proto/lib/src/types.ts +174 -0
- package/evals/conditions/v4-proto/lib/test/runtime.test.ts +170 -0
- package/evals/conditions/v4-proto/lib/test/tsconfig.json +10 -0
- package/evals/conditions/v4-proto/lib/test/types.test-d.ts +145 -0
- package/evals/conditions/v4-proto/lib/test/vitest.config.mjs +8 -0
- package/evals/conditions/v4-proto/lib/tsconfig.json +17 -0
- package/evals/conditions/v4-proto/package.json +26 -0
- package/evals/conditions/v4-proto/starter/src/generated/icrc1.service.ts +19 -0
- package/evals/conditions/v4-proto/starter/src/generated/icrc1.ts +57 -0
- package/evals/drive.mjs +1221 -0
- package/evals/gate.mjs +161 -0
- package/evals/harness/aggregate.mjs +534 -0
- package/evals/harness/aggregate.test.mjs +344 -0
- package/evals/harness/assemble.mjs +216 -0
- package/evals/harness/assemble.test.mjs +143 -0
- package/evals/harness/auth.mjs +91 -0
- package/evals/harness/check-docs.mjs +157 -0
- package/evals/harness/declarations/icrc1.did.d.ts +95 -0
- package/evals/harness/declarations/icrc1.did.js +140 -0
- package/evals/harness/drive-auth.test.mjs +584 -0
- package/evals/harness/drive.test.mjs +509 -0
- package/evals/harness/fake-auth.ts +67 -0
- package/evals/harness/fake-ledger.ts +178 -0
- package/evals/harness/gate-plan.mjs +104 -0
- package/evals/harness/gate-plan.test.mjs +243 -0
- package/evals/harness/icrc1.did +88 -0
- package/evals/harness/judge.mjs +63 -0
- package/evals/harness/judge.test.mjs +81 -0
- package/evals/harness/leak-scan.mjs +1373 -0
- package/evals/harness/leak-scan.test.mjs +1300 -0
- package/evals/harness/probes/amounts.ts +14 -0
- package/evals/harness/probes/node-tool.probe.ts +48 -0
- package/evals/harness/probes/probe.mjs +149 -0
- package/evals/harness/probes/react-wallet.probe.ts +96 -0
- package/evals/harness/public/support/auth.ts +38 -0
- package/evals/harness/public/support/fake-replica.d.ts +28 -0
- package/evals/harness/public/support/fake-replica.js +434 -0
- package/evals/harness/public/support/ledger.idl.d.ts +95 -0
- package/evals/harness/public/support/ledger.idl.js +140 -0
- package/evals/harness/public/support/world.ts +179 -0
- package/evals/harness/runs.mjs +139 -0
- package/evals/harness/sandbox.mjs +88 -0
- package/evals/harness/sandbox.test.mjs +134 -0
- package/evals/harness/ship.mjs +264 -0
- package/evals/harness/ship.test.mjs +552 -0
- package/evals/harness/world.ts +291 -0
- package/evals/package.json +26 -0
- package/evals/pnpm-lock.yaml +1537 -0
- package/evals/pnpm-workspace.yaml +12 -0
- package/evals/results/2026-09-30T14-22-05-924Z/pilot.json +384 -0
- package/evals/results/2026-09-30T14-22-05-924Z/pilot.rescanned.json +404 -0
- package/evals/results/2026-09-30T14-22-05-924Z/pilot.rescanned.rescored.json +404 -0
- package/evals/results/2026-09-30T14-22-05-924Z/plan.json +240 -0
- package/evals/results/2026-09-30T14-22-05-924Z/summary.json +1800 -0
- package/evals/results/2026-09-30T14-22-05-924Z/summary.rescanned.json +1843 -0
- package/evals/results/2026-09-30T14-22-05-924Z/summary.rescanned.rescored.json +2100 -0
- package/evals/results/2026-09-30T15-48-23-343Z/pilot.json +404 -0
- package/evals/results/2026-09-30T15-48-23-343Z/pilot.rescored.json +404 -0
- package/evals/results/2026-09-30T15-48-23-343Z/plan.json +242 -0
- package/evals/results/2026-09-30T15-48-23-343Z/summary.json +1843 -0
- package/evals/results/2026-09-30T15-48-23-343Z/summary.rescored.json +2195 -0
- package/evals/results/2026-10-03-beta1-gate/pilot.json +162 -0
- package/evals/results/2026-10-03-beta1-gate/plan.json +141 -0
- package/evals/results/2026-10-03-beta1-gate/summary.json +983 -0
- package/evals/results/2026-10-05-ga-gate/contaminated-run.json +55 -0
- package/evals/results/2026-10-05-ga-gate/pilot.json +162 -0
- package/evals/results/2026-10-05-ga-gate/plan.json +457 -0
- package/evals/results/2026-10-05-ga-gate/summary.json +1037 -0
- package/evals/results/2026-10-05-ga-gate/summary.rescanned.json +1037 -0
- package/evals/results/README.md +31 -0
- package/evals/runs-pilot.log +150 -0
- package/evals/runs-pilot2.log +150 -0
- package/evals/score.mjs +256 -0
- package/evals/setup.mjs +547 -0
- package/evals/tasks/node-tool/faulty/thin-accepts-exponent/meta.json +5 -0
- package/evals/tasks/node-tool/faulty/thin-accepts-exponent/src/index.ts +121 -0
- package/evals/tasks/node-tool/faulty/thin-anonymous-transfer/meta.json +5 -0
- package/evals/tasks/node-tool/faulty/thin-anonymous-transfer/src/index.ts +116 -0
- package/evals/tasks/node-tool/faulty/thin-every-reject-may-have-executed/meta.json +9 -0
- package/evals/tasks/node-tool/faulty/thin-every-reject-may-have-executed/src/index.ts +118 -0
- package/evals/tasks/node-tool/faulty/thin-fetches-root-key-off-local/meta.json +5 -0
- package/evals/tasks/node-tool/faulty/thin-fetches-root-key-off-local/src/index.ts +118 -0
- package/evals/tasks/node-tool/faulty/thin-ignores-root-key/meta.json +5 -0
- package/evals/tasks/node-tool/faulty/thin-ignores-root-key/src/index.ts +117 -0
- package/evals/tasks/node-tool/faulty/thin-misclassifies-reject-codes/meta.json +9 -0
- package/evals/tasks/node-tool/faulty/thin-misclassifies-reject-codes/src/index.ts +119 -0
- package/evals/tasks/node-tool/faulty/thin-no-nat64-cap/meta.json +9 -0
- package/evals/tasks/node-tool/faulty/thin-no-nat64-cap/src/index.ts +118 -0
- package/evals/tasks/node-tool/faulty/thin-number-amount/meta.json +10 -0
- package/evals/tasks/node-tool/faulty/thin-number-amount/src/index.ts +117 -0
- package/evals/tasks/node-tool/faulty/thin-truncates-fraction-digits/meta.json +5 -0
- package/evals/tasks/node-tool/faulty/thin-truncates-fraction-digits/src/index.ts +120 -0
- package/evals/tasks/node-tool/faulty/thin-unvalidated-recipient/meta.json +5 -0
- package/evals/tasks/node-tool/faulty/thin-unvalidated-recipient/src/index.ts +118 -0
- package/evals/tasks/node-tool/faulty/v3-retry-call-errors/meta.json +11 -0
- package/evals/tasks/node-tool/faulty/v3-retry-call-errors/src/index.ts +149 -0
- package/evals/tasks/node-tool/faulty/v4-anonymous-identity-sent/meta.json +5 -0
- package/evals/tasks/node-tool/faulty/v4-anonymous-identity-sent/src/index.ts +71 -0
- package/evals/tasks/node-tool/faulty/v4-never-may-have-executed/meta.json +9 -0
- package/evals/tasks/node-tool/faulty/v4-never-may-have-executed/src/index.ts +84 -0
- package/evals/tasks/node-tool/faulty/v4-proto-never-may-have-executed/meta.json +9 -0
- package/evals/tasks/node-tool/faulty/v4-proto-never-may-have-executed/src/index.ts +72 -0
- package/evals/tasks/node-tool/faulty/v4-proto-refuses-nat64-max/meta.json +5 -0
- package/evals/tasks/node-tool/faulty/v4-proto-refuses-nat64-max/src/index.ts +72 -0
- package/evals/tasks/node-tool/faulty/v4-refuses-nat64-max/meta.json +5 -0
- package/evals/tasks/node-tool/faulty/v4-refuses-nat64-max/src/index.ts +84 -0
- package/evals/tasks/node-tool/hidden/node-tool.test.ts +312 -0
- package/evals/tasks/node-tool/prompt.md +55 -0
- package/evals/tasks/node-tool/prompt.minimal.md +30 -0
- package/evals/tasks/node-tool/solutions/thin/reference/src/index.ts +118 -0
- package/evals/tasks/node-tool/solutions/thin/reference-module-scope/src/index.ts +145 -0
- package/evals/tasks/node-tool/solutions/thin-guide/reference/src/index.ts +118 -0
- package/evals/tasks/node-tool/solutions/thin-guide/reference-module-scope/src/index.ts +145 -0
- package/evals/tasks/node-tool/solutions/v3/reference/src/index.ts +140 -0
- package/evals/tasks/node-tool/solutions/v3/reference-module-scope/src/index.ts +153 -0
- package/evals/tasks/node-tool/solutions/v4/reference/src/index.ts +84 -0
- package/evals/tasks/node-tool/solutions/v4/reference-module-scope/src/index.ts +105 -0
- package/evals/tasks/node-tool/solutions/v4-proto/reference/src/index.ts +72 -0
- package/evals/tasks/node-tool/solutions/v4-proto/reference-module-scope/src/index.ts +87 -0
- package/evals/tasks/node-tool/starter/src/contract.ts +31 -0
- package/evals/tasks/node-tool/starter/src/index.ts +7 -0
- package/evals/tasks/node-tool/starter/test/smoke.test.ts +22 -0
- package/evals/tasks/node-tool/starter/tsconfig.json +17 -0
- package/evals/tasks/node-tool/task.json +63 -0
- package/evals/tasks/react-wallet/faulty/thin-accepts-exponent/meta.json +5 -0
- package/evals/tasks/react-wallet/faulty/thin-accepts-exponent/src/Wallet.tsx +216 -0
- package/evals/tasks/react-wallet/faulty/thin-anonymous-transfer/meta.json +5 -0
- package/evals/tasks/react-wallet/faulty/thin-anonymous-transfer/src/Wallet.tsx +212 -0
- package/evals/tasks/react-wallet/faulty/thin-both-auth-buttons/meta.json +5 -0
- package/evals/tasks/react-wallet/faulty/thin-both-auth-buttons/src/Wallet.tsx +210 -0
- package/evals/tasks/react-wallet/faulty/thin-constant-balance-key/meta.json +8 -0
- package/evals/tasks/react-wallet/faulty/thin-constant-balance-key/src/Wallet.tsx +213 -0
- package/evals/tasks/react-wallet/faulty/thin-no-nat64-cap/meta.json +9 -0
- package/evals/tasks/react-wallet/faulty/thin-no-nat64-cap/src/Wallet.tsx +213 -0
- package/evals/tasks/react-wallet/faulty/thin-number-balance/meta.json +5 -0
- package/evals/tasks/react-wallet/faulty/thin-number-balance/src/Wallet.tsx +213 -0
- package/evals/tasks/react-wallet/faulty/thin-transfer-as-query/meta.json +5 -0
- package/evals/tasks/react-wallet/faulty/thin-transfer-as-query/src/Wallet.tsx +254 -0
- package/evals/tasks/react-wallet/faulty/thin-truncates-fraction-digits/meta.json +5 -0
- package/evals/tasks/react-wallet/faulty/thin-truncates-fraction-digits/src/Wallet.tsx +215 -0
- package/evals/tasks/react-wallet/faulty/thin-unguarded-balance-effect/meta.json +5 -0
- package/evals/tasks/react-wallet/faulty/thin-unguarded-balance-effect/src/Wallet.tsx +214 -0
- package/evals/tasks/react-wallet/faulty/v3-http-4xx-unknown/meta.json +5 -0
- package/evals/tasks/react-wallet/faulty/v3-http-4xx-unknown/src/Wallet.tsx +224 -0
- package/evals/tasks/react-wallet/faulty/v3-mutation-retry-3/meta.json +12 -0
- package/evals/tasks/react-wallet/faulty/v3-mutation-retry-3/src/Wallet.tsx +225 -0
- package/evals/tasks/react-wallet/faulty/v3-unknown-as-error/meta.json +11 -0
- package/evals/tasks/react-wallet/faulty/v3-unknown-as-error/src/Wallet.tsx +182 -0
- package/evals/tasks/react-wallet/faulty/v4-every-reject-unknown/meta.json +5 -0
- package/evals/tasks/react-wallet/faulty/v4-every-reject-unknown/src/Wallet.tsx +160 -0
- package/evals/tasks/react-wallet/faulty/v4-keep-previous-data/meta.json +5 -0
- package/evals/tasks/react-wallet/faulty/v4-keep-previous-data/src/Wallet.tsx +166 -0
- package/evals/tasks/react-wallet/faulty/v4-proto-every-reject-unknown/meta.json +5 -0
- package/evals/tasks/react-wallet/faulty/v4-proto-every-reject-unknown/src/Wallet.tsx +161 -0
- package/evals/tasks/react-wallet/faulty/v4-proto-keep-previous-data/meta.json +5 -0
- package/evals/tasks/react-wallet/faulty/v4-proto-keep-previous-data/src/Wallet.tsx +163 -0
- package/evals/tasks/react-wallet/faulty/v4-proto-retry-spread/meta.json +12 -0
- package/evals/tasks/react-wallet/faulty/v4-proto-retry-spread/src/Wallet.tsx +162 -0
- package/evals/tasks/react-wallet/faulty/v4-proto-status-not-idle/meta.json +5 -0
- package/evals/tasks/react-wallet/faulty/v4-proto-status-not-idle/src/Wallet.tsx +163 -0
- package/evals/tasks/react-wallet/faulty/v4-retry-spread/meta.json +12 -0
- package/evals/tasks/react-wallet/faulty/v4-retry-spread/src/Wallet.tsx +163 -0
- package/evals/tasks/react-wallet/faulty/v4-status-not-idle/meta.json +5 -0
- package/evals/tasks/react-wallet/faulty/v4-status-not-idle/src/Wallet.tsx +162 -0
- package/evals/tasks/react-wallet/hidden/react-wallet.test.ts +536 -0
- package/evals/tasks/react-wallet/prompt.md +88 -0
- package/evals/tasks/react-wallet/prompt.minimal.md +51 -0
- package/evals/tasks/react-wallet/solutions/thin/reference/src/Wallet.tsx +213 -0
- package/evals/tasks/react-wallet/solutions/thin/reference-module-scope/src/Wallet.tsx +227 -0
- package/evals/tasks/react-wallet/solutions/thin-guide/reference/src/Wallet.tsx +213 -0
- package/evals/tasks/react-wallet/solutions/thin-guide/reference-module-scope/src/Wallet.tsx +227 -0
- package/evals/tasks/react-wallet/solutions/v3/reference/src/Wallet.tsx +224 -0
- package/evals/tasks/react-wallet/solutions/v3/reference-module-scope/src/Wallet.tsx +230 -0
- package/evals/tasks/react-wallet/solutions/v4/reference/src/Wallet.tsx +160 -0
- package/evals/tasks/react-wallet/solutions/v4/reference-module-scope/src/Wallet.tsx +178 -0
- package/evals/tasks/react-wallet/solutions/v4-proto/reference/src/Wallet.tsx +161 -0
- package/evals/tasks/react-wallet/solutions/v4-proto/reference-module-scope/src/Wallet.tsx +161 -0
- package/evals/tasks/react-wallet/starter/src/Wallet.tsx +12 -0
- package/evals/tasks/react-wallet/starter/src/auth.ts +16 -0
- package/evals/tasks/react-wallet/starter/src/config.ts +14 -0
- package/evals/tasks/react-wallet/starter/src/ii-auth.ts +43 -0
- package/evals/tasks/react-wallet/starter/src/main.tsx +15 -0
- package/evals/tasks/react-wallet/starter/test/smoke.test.ts +34 -0
- package/evals/tasks/react-wallet/starter/tsconfig.json +18 -0
- package/evals/tasks/react-wallet/task.json +84 -0
- package/examples/canister-studio/.stackblitzrc +4 -0
- package/examples/canister-studio/README.md +183 -0
- package/examples/canister-studio/did/ckbtc_minter.did +806 -0
- package/examples/canister-studio/did/icp_ledger.did +586 -0
- package/examples/canister-studio/did/icrc1.did +88 -0
- package/examples/canister-studio/package.json +45 -0
- package/examples/canister-studio/scripts/smoke.ts +188 -0
- package/examples/canister-studio/src/calls/CacheKeyPanel.tsx +104 -0
- package/examples/canister-studio/src/calls/ConfirmWrite.tsx +265 -0
- package/examples/canister-studio/src/calls/ErrorPanel.test.tsx +113 -0
- package/examples/canister-studio/src/calls/ErrorPanel.tsx +214 -0
- package/examples/canister-studio/src/calls/MethodRunner.test.tsx +354 -0
- package/examples/canister-studio/src/calls/MethodRunner.tsx +57 -0
- package/examples/canister-studio/src/calls/ReadRunner.tsx +244 -0
- package/examples/canister-studio/src/calls/ResendPanel.tsx +165 -0
- package/examples/canister-studio/src/calls/ShareLink.tsx +59 -0
- package/examples/canister-studio/src/calls/WriteRunner.test.tsx +678 -0
- package/examples/canister-studio/src/calls/WriteRunner.tsx +670 -0
- package/examples/canister-studio/src/calls/dedupe.ts +189 -0
- package/examples/canister-studio/src/calls/error-info.ts +168 -0
- package/examples/canister-studio/src/calls/history.test.ts +284 -0
- package/examples/canister-studio/src/calls/history.ts +287 -0
- package/examples/canister-studio/src/calls/kinds.ts +68 -0
- package/examples/canister-studio/src/calls/prepare.ts +32 -0
- package/examples/canister-studio/src/calls/query-options.ts +30 -0
- package/examples/canister-studio/src/calls/read.ts +47 -0
- package/examples/canister-studio/src/calls/readback.ts +100 -0
- package/examples/canister-studio/src/calls/record.ts +123 -0
- package/examples/canister-studio/src/calls/safe-calls.test.ts +299 -0
- package/examples/canister-studio/src/calls/share.ts +46 -0
- package/examples/canister-studio/src/calls/testing/doubles.tsx +108 -0
- package/examples/canister-studio/src/calls/testing/fixtures.ts +185 -0
- package/examples/canister-studio/src/calls/useCanisterHandle.ts +35 -0
- package/examples/canister-studio/src/canisters/ckbtc_minter.envelope.json +4228 -0
- package/examples/canister-studio/src/canisters/ckbtc_minter.ts +868 -0
- package/examples/canister-studio/src/canisters/icp_ledger.envelope.json +3454 -0
- package/examples/canister-studio/src/canisters/icp_ledger.ts +584 -0
- package/examples/canister-studio/src/canisters/icrc1.envelope.json +840 -0
- package/examples/canister-studio/src/canisters/icrc1.ts +78 -0
- package/examples/canister-studio/src/components/ActionButton.tsx +32 -0
- package/examples/canister-studio/src/components/AppHeader.tsx +83 -0
- package/examples/canister-studio/src/components/AppShell.tsx +29 -0
- package/examples/canister-studio/src/components/AuthButton.tsx +79 -0
- package/examples/canister-studio/src/components/Badge.tsx +79 -0
- package/examples/canister-studio/src/components/CanisterHeader.tsx +200 -0
- package/examples/canister-studio/src/components/CanisterJump.tsx +130 -0
- package/examples/canister-studio/src/components/Card.tsx +64 -0
- package/examples/canister-studio/src/components/Code.tsx +101 -0
- package/examples/canister-studio/src/components/CopyButton.tsx +126 -0
- package/examples/canister-studio/src/components/Disclosure.tsx +34 -0
- package/examples/canister-studio/src/components/EmptyState.tsx +34 -0
- package/examples/canister-studio/src/components/MethodList.test.tsx +137 -0
- package/examples/canister-studio/src/components/MethodList.tsx +244 -0
- package/examples/canister-studio/src/components/Notice.tsx +36 -0
- package/examples/canister-studio/src/components/ProvenanceBadge.tsx +44 -0
- package/examples/canister-studio/src/components/RouteError.tsx +42 -0
- package/examples/canister-studio/src/components/SectionBoundary.tsx +76 -0
- package/examples/canister-studio/src/components/Spinner.tsx +33 -0
- package/examples/canister-studio/src/components/Tabs.tsx +96 -0
- package/examples/canister-studio/src/components/canister/CanisterLoadFailure.test.tsx +56 -0
- package/examples/canister-studio/src/components/canister/CanisterLoadFailure.tsx +165 -0
- package/examples/canister-studio/src/components/canister/CanisterNotFound.tsx +59 -0
- package/examples/canister-studio/src/components/canister/CanisterPending.tsx +33 -0
- package/examples/canister-studio/src/components/canister/MethodOverview.tsx +93 -0
- package/examples/canister-studio/src/components/canister/MethodWorkspace.test.tsx +201 -0
- package/examples/canister-studio/src/components/canister/MethodWorkspace.tsx +187 -0
- package/examples/canister-studio/src/components/canister/shared-call.test.ts +186 -0
- package/examples/canister-studio/src/components/canister/shared-call.ts +133 -0
- package/examples/canister-studio/src/components/canister/shared-link-loader.test.ts +116 -0
- package/examples/canister-studio/src/components/canister/use-canister-page.ts +44 -0
- package/examples/canister-studio/src/components/canister/workspace-key.test.ts +27 -0
- package/examples/canister-studio/src/components/canister/workspace-key.ts +36 -0
- package/examples/canister-studio/src/components/canister-id-input.ts +69 -0
- package/examples/canister-studio/src/components/canister-names.ts +11 -0
- package/examples/canister-studio/src/components/download.ts +34 -0
- package/examples/canister-studio/src/components/fallbacks.tsx +33 -0
- package/examples/canister-studio/src/components/helpers.test.ts +107 -0
- package/examples/canister-studio/src/components/history/HistoryList.tsx +284 -0
- package/examples/canister-studio/src/components/home/FeaturedLedger.tsx +149 -0
- package/examples/canister-studio/src/components/home/OpenCanister.tsx +99 -0
- package/examples/canister-studio/src/components/home/featured.test.tsx +92 -0
- package/examples/canister-studio/src/components/home/featured.ts +64 -0
- package/examples/canister-studio/src/components/interface/CandidTab.tsx +38 -0
- package/examples/canister-studio/src/components/interface/CompatReport.tsx +92 -0
- package/examples/canister-studio/src/components/interface/CompatibilityTab.tsx +190 -0
- package/examples/canister-studio/src/components/interface/ProjectTab.tsx +196 -0
- package/examples/canister-studio/src/components/interface/TypeScriptTab.tsx +114 -0
- package/examples/canister-studio/src/components/interface/tools.test.tsx +169 -0
- package/examples/canister-studio/src/components/modes.ts +31 -0
- package/examples/canister-studio/src/components/playground/MethodPicker.tsx +67 -0
- package/examples/canister-studio/src/components/playground/PlaygroundForms.tsx +112 -0
- package/examples/canister-studio/src/components/playground/PlaygroundTools.tsx +219 -0
- package/examples/canister-studio/src/components/playground/sample.ts +43 -0
- package/examples/canister-studio/src/components/playground/target.test.tsx +86 -0
- package/examples/canister-studio/src/components/primitives.test.tsx +121 -0
- package/examples/canister-studio/src/components/provenance.ts +38 -0
- package/examples/canister-studio/src/components/route-render.test.tsx +71 -0
- package/examples/canister-studio/src/components/use-task.ts +56 -0
- package/examples/canister-studio/src/components/wallet/BalancePanel.tsx +110 -0
- package/examples/canister-studio/src/components/wallet/LedgerSummary.tsx +63 -0
- package/examples/canister-studio/src/components/wallet/MinterPanel.tsx +255 -0
- package/examples/canister-studio/src/components/wallet/SendPanel.test.tsx +297 -0
- package/examples/canister-studio/src/components/wallet/SendPanel.tsx +446 -0
- package/examples/canister-studio/src/components/wallet/ledgers.test.ts +36 -0
- package/examples/canister-studio/src/components/wallet/ledgers.ts +111 -0
- package/examples/canister-studio/src/forms/JsonPanel.tsx +157 -0
- package/examples/canister-studio/src/forms/MethodForm.test.tsx +369 -0
- package/examples/canister-studio/src/forms/MethodForm.tsx +368 -0
- package/examples/canister-studio/src/forms/TypedForm.tsx +55 -0
- package/examples/canister-studio/src/forms/context.ts +62 -0
- package/examples/canister-studio/src/forms/convert.ts +131 -0
- package/examples/canister-studio/src/forms/edge.test.ts +252 -0
- package/examples/canister-studio/src/forms/engine.test.ts +358 -0
- package/examples/canister-studio/src/forms/engine.ts +1492 -0
- package/examples/canister-studio/src/forms/fields/BytesField.tsx +210 -0
- package/examples/canister-studio/src/forms/fields/Field.tsx +106 -0
- package/examples/canister-studio/src/forms/fields/FieldShell.tsx +101 -0
- package/examples/canister-studio/src/forms/fields/Group.tsx +74 -0
- package/examples/canister-studio/src/forms/fields/ListField.tsx +256 -0
- package/examples/canister-studio/src/forms/fields/Segmented.tsx +78 -0
- package/examples/canister-studio/src/forms/fields/TimestampField.tsx +108 -0
- package/examples/canister-studio/src/forms/fields/UnitsField.tsx +119 -0
- package/examples/canister-studio/src/forms/fields/composites.tsx +389 -0
- package/examples/canister-studio/src/forms/fields/leaves.tsx +350 -0
- package/examples/canister-studio/src/forms/fields.test.tsx +396 -0
- package/examples/canister-studio/src/forms/helpers.test.ts +225 -0
- package/examples/canister-studio/src/forms/hints.ts +128 -0
- package/examples/canister-studio/src/forms/json.ts +119 -0
- package/examples/canister-studio/src/forms/parsing.test.ts +217 -0
- package/examples/canister-studio/src/forms/useMethodForm.ts +251 -0
- package/examples/canister-studio/src/interface/browser.test.ts +23 -0
- package/examples/canister-studio/src/interface/browser.ts +153 -0
- package/examples/canister-studio/src/interface/cache.ts +68 -0
- package/examples/canister-studio/src/interface/cli-cache.test.ts +155 -0
- package/examples/canister-studio/src/interface/cli-cache.ts +125 -0
- package/examples/canister-studio/src/interface/compile.server.test.ts +198 -0
- package/examples/canister-studio/src/interface/compile.server.ts +262 -0
- package/examples/canister-studio/src/interface/compile.test.ts +108 -0
- package/examples/canister-studio/src/interface/compile.ts +305 -0
- package/examples/canister-studio/src/interface/docs.test.ts +75 -0
- package/examples/canister-studio/src/interface/docs.ts +100 -0
- package/examples/canister-studio/src/interface/functions.test.ts +42 -0
- package/examples/canister-studio/src/interface/functions.ts +200 -0
- package/examples/canister-studio/src/interface/live-candid.server.ts +91 -0
- package/examples/canister-studio/src/interface/live-loader.test.ts +515 -0
- package/examples/canister-studio/src/interface/live-loader.ts +364 -0
- package/examples/canister-studio/src/interface/load.test.ts +328 -0
- package/examples/canister-studio/src/interface/load.ts +249 -0
- package/examples/canister-studio/src/interface/read-candid.test.ts +185 -0
- package/examples/canister-studio/src/interface/read-candid.ts +233 -0
- package/examples/canister-studio/src/interface/server-result.ts +42 -0
- package/examples/canister-studio/src/interface/typed.ts +68 -0
- package/examples/canister-studio/src/interface/types.ts +121 -0
- package/examples/canister-studio/src/lib/format.test.ts +107 -0
- package/examples/canister-studio/src/lib/format.ts +139 -0
- package/examples/canister-studio/src/lib/hex.test.ts +43 -0
- package/examples/canister-studio/src/lib/hex.ts +33 -0
- package/examples/canister-studio/src/lib/ids.test.ts +70 -0
- package/examples/canister-studio/src/lib/ids.ts +93 -0
- package/examples/canister-studio/src/lib/reactor.test.ts +55 -0
- package/examples/canister-studio/src/lib/reactor.ts +55 -0
- package/examples/canister-studio/src/lib/registry.test.ts +74 -0
- package/examples/canister-studio/src/lib/registry.ts +238 -0
- package/examples/canister-studio/src/lib/schema.ts +148 -0
- package/examples/canister-studio/src/routeTree.gen.ts +227 -0
- package/examples/canister-studio/src/router.test.ts +290 -0
- package/examples/canister-studio/src/router.tsx +127 -0
- package/examples/canister-studio/src/routes/__root.tsx +58 -0
- package/examples/canister-studio/src/routes/canister.$canisterId.index.tsx +172 -0
- package/examples/canister-studio/src/routes/canister.$canisterId.interface.tsx +98 -0
- package/examples/canister-studio/src/routes/canister.$canisterId.tsx +91 -0
- package/examples/canister-studio/src/routes/history.tsx +55 -0
- package/examples/canister-studio/src/routes/index.tsx +169 -0
- package/examples/canister-studio/src/routes/playground.tsx +286 -0
- package/examples/canister-studio/src/routes/safety.tsx +57 -0
- package/examples/canister-studio/src/routes/wallet.tsx +213 -0
- package/examples/canister-studio/src/safety/LabTransferForm.tsx +84 -0
- package/examples/canister-studio/src/safety/RequestLog.tsx +79 -0
- package/examples/canister-studio/src/safety/SafetyLab.test.tsx +89 -0
- package/examples/canister-studio/src/safety/SafetyLab.tsx +140 -0
- package/examples/canister-studio/src/safety/ScenarioCard.tsx +262 -0
- package/examples/canister-studio/src/safety/lab-run.ts +283 -0
- package/examples/canister-studio/src/safety/mock-ledger.test.ts +99 -0
- package/examples/canister-studio/src/safety/mock-ledger.ts +263 -0
- package/examples/canister-studio/src/safety/scenarios.test.ts +157 -0
- package/examples/canister-studio/src/safety/scenarios.ts +924 -0
- package/examples/canister-studio/src/styles.css +3453 -0
- package/examples/canister-studio/src/styles.test.ts +46 -0
- package/examples/canister-studio/src/values/CallPreview.test.tsx +86 -0
- package/examples/canister-studio/src/values/CallPreview.tsx +148 -0
- package/examples/canister-studio/src/values/ErrValueView.tsx +66 -0
- package/examples/canister-studio/src/values/Inspector.tsx +133 -0
- package/examples/canister-studio/src/values/ReplyView.test.tsx +341 -0
- package/examples/canister-studio/src/values/ReplyView.tsx +164 -0
- package/examples/canister-studio/src/values/candid-text.test.ts +516 -0
- package/examples/canister-studio/src/values/candid-text.ts +479 -0
- package/examples/canister-studio/src/values/hints.ts +58 -0
- package/examples/canister-studio/src/values/json.test.ts +66 -0
- package/examples/canister-studio/src/values/json.ts +31 -0
- package/examples/canister-studio/src/values/leaves.tsx +309 -0
- package/examples/canister-studio/src/values/schema.test.ts +123 -0
- package/examples/canister-studio/src/values/schema.ts +78 -0
- package/examples/canister-studio/src/values/test-router.tsx +21 -0
- package/examples/canister-studio/src/values/tree.tsx +670 -0
- package/examples/canister-studio/src/values/use-sha256.ts +29 -0
- package/examples/canister-studio/tsconfig.json +20 -0
- package/examples/canister-studio/vite.config.ts +50 -0
- package/examples/canister-studio/vitest.config.ts +20 -0
- package/examples/icrc-ledger/.stackblitzrc +4 -0
- package/examples/icrc-ledger/README.md +100 -0
- package/examples/icrc-ledger/ckbtc_minter.did +12 -0
- package/examples/icrc-ledger/icp_ledger.did +147 -0
- package/examples/icrc-ledger/icrc1.did +88 -0
- package/examples/icrc-ledger/index.html +13 -0
- package/examples/icrc-ledger/package.json +40 -0
- package/examples/icrc-ledger/scripts/smoke.ts +151 -0
- package/examples/icrc-ledger/src/App.tsx +71 -0
- package/examples/icrc-ledger/src/ErrorPanel.tsx +105 -0
- package/examples/icrc-ledger/src/MainnetTab.tsx +450 -0
- package/examples/icrc-ledger/src/SandboxTab.test.tsx +379 -0
- package/examples/icrc-ledger/src/SandboxTab.tsx +761 -0
- package/examples/icrc-ledger/src/blocks.test.ts +247 -0
- package/examples/icrc-ledger/src/blocks.ts +140 -0
- package/examples/icrc-ledger/src/canisters/ckbtc_minter.envelope.json +96 -0
- package/examples/icrc-ledger/src/canisters/ckbtc_minter.ts +16 -0
- package/examples/icrc-ledger/src/canisters/icp_ledger.envelope.json +690 -0
- package/examples/icrc-ledger/src/canisters/icp_ledger.ts +223 -0
- package/examples/icrc-ledger/src/canisters/icrc1.envelope.json +840 -0
- package/examples/icrc-ledger/src/canisters/icrc1.ts +78 -0
- package/examples/icrc-ledger/src/format.test.ts +41 -0
- package/examples/icrc-ledger/src/format.ts +68 -0
- package/examples/icrc-ledger/src/ledger.ts +15 -0
- package/examples/icrc-ledger/src/main.tsx +10 -0
- package/examples/icrc-ledger/src/minter.ts +16 -0
- package/examples/icrc-ledger/src/sandbox.test.ts +464 -0
- package/examples/icrc-ledger/src/sandbox.ts +281 -0
- package/examples/icrc-ledger/src/styles.css +391 -0
- package/examples/icrc-ledger/src/transfer-form.test.ts +62 -0
- package/examples/icrc-ledger/src/transfer-form.ts +97 -0
- package/examples/icrc-ledger/tsconfig.json +19 -0
- package/examples/icrc-ledger/vite.config.ts +44 -0
- package/examples/icrc-ledger/vitest.config.ts +12 -0
- package/examples/next-ssr/.stackblitzrc +4 -0
- package/examples/next-ssr/README.md +112 -0
- package/examples/next-ssr/icrc1.did +88 -0
- package/examples/next-ssr/next.config.ts +10 -0
- package/examples/next-ssr/package.json +41 -0
- package/examples/next-ssr/scripts/smoke.ts +169 -0
- package/examples/next-ssr/src/app/account/CertifiedBalances.tsx +58 -0
- package/examples/next-ssr/src/app/account/account.test.tsx +165 -0
- package/examples/next-ssr/src/app/account/page.tsx +82 -0
- package/examples/next-ssr/src/app/api/balance/[ledger]/[principal]/route.ts +10 -0
- package/examples/next-ssr/src/app/globals.css +278 -0
- package/examples/next-ssr/src/app/layout.tsx +34 -0
- package/examples/next-ssr/src/app/page.tsx +46 -0
- package/examples/next-ssr/src/app/providers.browser.test.tsx +127 -0
- package/examples/next-ssr/src/app/providers.test.tsx +73 -0
- package/examples/next-ssr/src/app/providers.tsx +60 -0
- package/examples/next-ssr/src/canisters/icrc1.envelope.json +840 -0
- package/examples/next-ssr/src/canisters/icrc1.ts +78 -0
- package/examples/next-ssr/src/components/BalanceTable.tsx +43 -0
- package/examples/next-ssr/src/components/LedgerCard.test.tsx +96 -0
- package/examples/next-ssr/src/components/LedgerCard.tsx +230 -0
- package/examples/next-ssr/src/components/LedgerError.tsx +32 -0
- package/examples/next-ssr/src/components/LedgerSections.tsx +22 -0
- package/examples/next-ssr/src/components/MyBalances.test.tsx +253 -0
- package/examples/next-ssr/src/components/MyBalances.tsx +129 -0
- package/examples/next-ssr/src/components/SessionBadge.tsx +18 -0
- package/examples/next-ssr/src/components/hydration.test.tsx +259 -0
- package/examples/next-ssr/src/components/server-data.ts +10 -0
- package/examples/next-ssr/src/format.ts +46 -0
- package/examples/next-ssr/src/ledgers.ts +38 -0
- package/examples/next-ssr/src/server/balance-route.test.ts +151 -0
- package/examples/next-ssr/src/server/balance-route.ts +157 -0
- package/examples/next-ssr/src/server/error-summary.test.ts +34 -0
- package/examples/next-ssr/src/server/error-summary.ts +37 -0
- package/examples/next-ssr/src/server/parse-owner.test.ts +39 -0
- package/examples/next-ssr/src/server/parse-owner.ts +34 -0
- package/examples/next-ssr/src/server/prefetch-ledgers.test.ts +137 -0
- package/examples/next-ssr/src/server/prefetch-ledgers.ts +70 -0
- package/examples/next-ssr/src/server/read-balances.test.ts +103 -0
- package/examples/next-ssr/src/server/read-balances.ts +78 -0
- package/examples/next-ssr/src/server/request-client.rsc.test.tsx +110 -0
- package/examples/next-ssr/src/server/request-client.ts +24 -0
- package/examples/next-ssr/src/testing/mock-ledgers.ts +115 -0
- package/examples/next-ssr/src/testing/react-server-dom-turbopack.d.ts +15 -0
- package/examples/next-ssr/src/testing/setup.ts +10 -0
- package/examples/next-ssr/tsconfig.json +31 -0
- package/examples/next-ssr/vitest.config.ts +59 -0
- package/examples/node-agent-tool/.stackblitzrc +4 -0
- package/examples/node-agent-tool/README.md +165 -0
- package/examples/node-agent-tool/icp.yaml +11 -0
- package/examples/node-agent-tool/icrc1.did +88 -0
- package/examples/node-agent-tool/package.json +32 -0
- package/examples/node-agent-tool/src/canisters/icrc1.envelope.json +840 -0
- package/examples/node-agent-tool/src/canisters/icrc1.ts +78 -0
- package/examples/node-agent-tool/src/cli.test.ts +64 -0
- package/examples/node-agent-tool/src/cli.ts +23 -0
- package/examples/node-agent-tool/src/command-line.ts +159 -0
- package/examples/node-agent-tool/src/commands/balance.ts +73 -0
- package/examples/node-agent-tool/src/commands/demo.test.ts +51 -0
- package/examples/node-agent-tool/src/commands/demo.ts +359 -0
- package/examples/node-agent-tool/src/commands/info.ts +69 -0
- package/examples/node-agent-tool/src/commands/reads.test.ts +133 -0
- package/examples/node-agent-tool/src/commands/resend.test.ts +363 -0
- package/examples/node-agent-tool/src/commands/transfer.test.ts +313 -0
- package/examples/node-agent-tool/src/commands/transfer.ts +415 -0
- package/examples/node-agent-tool/src/commands/watch.test.ts +159 -0
- package/examples/node-agent-tool/src/commands/watch.ts +135 -0
- package/examples/node-agent-tool/src/commands/whoami.ts +36 -0
- package/examples/node-agent-tool/src/context.ts +20 -0
- package/examples/node-agent-tool/src/dispatch.ts +70 -0
- package/examples/node-agent-tool/src/failure.test.ts +59 -0
- package/examples/node-agent-tool/src/failure.ts +176 -0
- package/examples/node-agent-tool/src/identity.test.ts +242 -0
- package/examples/node-agent-tool/src/identity.ts +228 -0
- package/examples/node-agent-tool/src/input.ts +110 -0
- package/examples/node-agent-tool/src/ledgers.test.ts +74 -0
- package/examples/node-agent-tool/src/ledgers.ts +62 -0
- package/examples/node-agent-tool/src/mock-ledger.ts +211 -0
- package/examples/node-agent-tool/src/network.test.ts +128 -0
- package/examples/node-agent-tool/src/network.ts +101 -0
- package/examples/node-agent-tool/src/output.test.ts +208 -0
- package/examples/node-agent-tool/src/output.ts +163 -0
- package/examples/node-agent-tool/src/run.ts +73 -0
- package/examples/node-agent-tool/src/test-kit.ts +167 -0
- package/examples/node-agent-tool/tsconfig.json +18 -0
- package/examples/node-agent-tool/vitest.config.ts +8 -0
- package/examples/vite-wallet/.stackblitzrc +4 -0
- package/examples/vite-wallet/Cargo.lock +646 -0
- package/examples/vite-wallet/Cargo.toml +5 -0
- package/examples/vite-wallet/README.md +107 -0
- package/examples/vite-wallet/backend/Cargo.toml +12 -0
- package/examples/vite-wallet/backend/backend.did +37 -0
- package/examples/vite-wallet/backend/src/lib.rs +133 -0
- package/examples/vite-wallet/icp.yaml +44 -0
- package/examples/vite-wallet/index.html +13 -0
- package/examples/vite-wallet/ledger.did +54 -0
- package/examples/vite-wallet/package.json +46 -0
- package/examples/vite-wallet/public/.ic-assets.json5 +26 -0
- package/examples/vite-wallet/scripts/faucet-args.test.ts +30 -0
- package/examples/vite-wallet/scripts/faucet-args.ts +41 -0
- package/examples/vite-wallet/scripts/faucet.ts +41 -0
- package/examples/vite-wallet/src/AddressBook.test.tsx +191 -0
- package/examples/vite-wallet/src/AddressBook.tsx +147 -0
- package/examples/vite-wallet/src/App.tsx +53 -0
- package/examples/vite-wallet/src/Balance.test.tsx +57 -0
- package/examples/vite-wallet/src/Balance.tsx +58 -0
- package/examples/vite-wallet/src/EnvironmentPanel.test.tsx +83 -0
- package/examples/vite-wallet/src/EnvironmentPanel.tsx +103 -0
- package/examples/vite-wallet/src/ErrorNote.tsx +70 -0
- package/examples/vite-wallet/src/Profile.test.tsx +145 -0
- package/examples/vite-wallet/src/Profile.tsx +92 -0
- package/examples/vite-wallet/src/SendIcp.test.tsx +231 -0
- package/examples/vite-wallet/src/SendIcp.tsx +244 -0
- package/examples/vite-wallet/src/SendToContact.test.tsx +113 -0
- package/examples/vite-wallet/src/SendToContact.tsx +102 -0
- package/examples/vite-wallet/src/SignIn.test.tsx +106 -0
- package/examples/vite-wallet/src/SignIn.tsx +120 -0
- package/examples/vite-wallet/src/Wallet.test.tsx +89 -0
- package/examples/vite-wallet/src/account-switch.test.tsx +108 -0
- package/examples/vite-wallet/src/auth/dev-accounts.test.ts +113 -0
- package/examples/vite-wallet/src/auth/dev-accounts.ts +216 -0
- package/examples/vite-wallet/src/auth/local-page.test.ts +28 -0
- package/examples/vite-wallet/src/auth/local-page.ts +20 -0
- package/examples/vite-wallet/src/auth/wallet-auth.test.ts +159 -0
- package/examples/vite-wallet/src/auth/wallet-auth.ts +131 -0
- package/examples/vite-wallet/src/canisters/backend.envelope.json +275 -0
- package/examples/vite-wallet/src/canisters/backend.ts +58 -0
- package/examples/vite-wallet/src/canisters/ledger.envelope.json +451 -0
- package/examples/vite-wallet/src/canisters/ledger.ts +56 -0
- package/examples/vite-wallet/src/client.ts +45 -0
- package/examples/vite-wallet/src/main.tsx +18 -0
- package/examples/vite-wallet/src/optimistic-contacts.ts +113 -0
- package/examples/vite-wallet/src/refusal.ts +17 -0
- package/examples/vite-wallet/src/styles.css +282 -0
- package/examples/vite-wallet/src/test/test-wallet.tsx +322 -0
- package/examples/vite-wallet/src/token.ts +50 -0
- package/examples/vite-wallet/src/transfer.test.ts +178 -0
- package/examples/vite-wallet/src/transfer.ts +110 -0
- package/examples/vite-wallet/src/use-canisters.ts +49 -0
- package/examples/vite-wallet/tsconfig.json +19 -0
- package/examples/vite-wallet/vite.config.ts +47 -0
- package/examples/vite-wallet/vitest.config.ts +17 -0
- package/package.json +9 -4
- package/packages/core/.size-limit.js +47 -0
- package/packages/core/LICENSE +21 -0
- package/packages/core/README.md +84 -0
- package/packages/core/llms.txt +610 -0
- package/packages/core/package.json +89 -0
- package/packages/core/src/call.ts +961 -0
- package/packages/core/src/canister.ts +259 -0
- package/packages/core/src/client.ts +2061 -0
- package/packages/core/src/errors.ts +1079 -0
- package/packages/core/src/hydration.ts +239 -0
- package/packages/core/src/index.ts +23 -0
- package/packages/core/src/keys.ts +108 -0
- package/packages/core/src/management.ts +138 -0
- package/packages/core/src/network.ts +1020 -0
- package/packages/core/src/options.ts +1000 -0
- package/packages/core/src/runtime.ts +50 -0
- package/packages/core/src/testing/fake-replica.ts +1166 -0
- package/packages/core/src/testing/index.ts +16 -0
- package/packages/core/src/testing/test-auth.ts +340 -0
- package/packages/core/src/testing/test-client.ts +559 -0
- package/packages/core/src/types.ts +541 -0
- package/packages/core/src/units.ts +299 -0
- package/packages/core/src/version.ts +4 -0
- package/packages/core/tests/canister-helpers.ts +187 -0
- package/packages/core/tests/canister-id.test.ts +158 -0
- package/packages/core/tests/canister-unwrap.test.ts +94 -0
- package/packages/core/tests/canister.test-d.ts +406 -0
- package/packages/core/tests/canister.test.ts +1921 -0
- package/packages/core/tests/client-account-change.test.ts +131 -0
- package/packages/core/tests/client-agents.test.ts +402 -0
- package/packages/core/tests/client-auth-network.test.ts +719 -0
- package/packages/core/tests/client-disposed.test.ts +403 -0
- package/packages/core/tests/client-helpers.ts +136 -0
- package/packages/core/tests/client-hydration.test.ts +166 -0
- package/packages/core/tests/client-pinned.test.ts +626 -0
- package/packages/core/tests/client-session.test.ts +348 -0
- package/packages/core/tests/client.test-d.ts +181 -0
- package/packages/core/tests/client.test.ts +1162 -0
- package/packages/core/tests/encode.test.ts +171 -0
- package/packages/core/tests/env-canister-id.test.ts +666 -0
- package/packages/core/tests/env-cookie-copies.test.ts +182 -0
- package/packages/core/tests/error-guard.test.ts +222 -0
- package/packages/core/tests/errors.test-d.ts +280 -0
- package/packages/core/tests/errors.test.ts +1359 -0
- package/packages/core/tests/fixtures/README.md +28 -0
- package/packages/core/tests/fixtures/accounts.did +21 -0
- package/packages/core/tests/fixtures/accounts.envelope.json +367 -0
- package/packages/core/tests/fixtures/accounts.ts +26 -0
- package/packages/core/tests/fixtures/archive.did +31 -0
- package/packages/core/tests/fixtures/archive.envelope.json +259 -0
- package/packages/core/tests/fixtures/archive.ts +55 -0
- package/packages/core/tests/fixtures/icrc1.did +88 -0
- package/packages/core/tests/fixtures/icrc1.envelope.json +840 -0
- package/packages/core/tests/fixtures/icrc1.ts +78 -0
- package/packages/core/tests/fixtures/management.did +724 -0
- package/packages/core/tests/fixtures/management.envelope.json +4455 -0
- package/packages/core/tests/fixtures/management.ts +486 -0
- package/packages/core/tests/fixtures/shapes.did +33 -0
- package/packages/core/tests/fixtures/shapes.envelope.json +440 -0
- package/packages/core/tests/fixtures/shapes.ts +56 -0
- package/packages/core/tests/fixtures/skippable.did +15 -0
- package/packages/core/tests/fixtures/skippable.envelope.json +182 -0
- package/packages/core/tests/fixtures/skippable.ts +33 -0
- package/packages/core/tests/func.test.ts +154 -0
- package/packages/core/tests/identity-attributes.test.ts +214 -0
- package/packages/core/tests/keys.test.ts +289 -0
- package/packages/core/tests/management.test.ts +206 -0
- package/packages/core/tests/network-helpers.ts +121 -0
- package/packages/core/tests/network.test-d.ts +78 -0
- package/packages/core/tests/network.test.ts +1051 -0
- package/packages/core/tests/options.test.ts +1594 -0
- package/packages/core/tests/redirect-sign-in.test.ts +393 -0
- package/packages/core/tests/resend.test-d.ts +81 -0
- package/packages/core/tests/resend.test.ts +723 -0
- package/packages/core/tests/skip.test-d.ts +125 -0
- package/packages/core/tests/testing-entry.test.ts +73 -0
- package/packages/core/tests/testing-fake-replica.test.ts +1242 -0
- package/packages/core/tests/testing-test-auth.test-d.ts +84 -0
- package/packages/core/tests/testing-test-auth.test.ts +483 -0
- package/packages/core/tests/testing-test-client.test-d.ts +184 -0
- package/packages/core/tests/testing-test-client.test.ts +1272 -0
- package/packages/core/tests/time-realm.test.ts +63 -0
- package/packages/core/tests/time.test.ts +238 -0
- package/packages/core/tests/traps/README.md +39 -0
- package/packages/core/tests/traps/anonymous-write.test.ts +145 -0
- package/packages/core/tests/traps/classification-table.test.ts +256 -0
- package/packages/core/tests/traps/err-arm.test.ts +144 -0
- package/packages/core/tests/traps/fetch-spy.ts +39 -0
- package/packages/core/tests/traps/invalidation-after-write.test.ts +178 -0
- package/packages/core/tests/traps/ledger.ts +248 -0
- package/packages/core/tests/traps/root-key-off-local.test.ts +130 -0
- package/packages/core/tests/traps/stale-data-across-users.test.ts +173 -0
- package/packages/core/tests/traps/unresolved-name.test.ts +155 -0
- package/packages/core/tests/traps/update-as-query.test.ts +244 -0
- package/packages/core/tests/traps/update-not-resent.test.ts +126 -0
- package/packages/core/tests/traps/update-resent-when-never-delivered.test.ts +159 -0
- package/packages/core/tests/traps.test-d.ts +476 -0
- package/packages/core/tests/units.test-d.ts +118 -0
- package/packages/core/tests/units.test.ts +634 -0
- package/packages/core/tsconfig.json +19 -0
- package/packages/core/tsconfig.typecheck.json +16 -0
- package/packages/core/vitest.config.ts +13 -0
- package/packages/mcp/LICENSE +21 -0
- package/packages/mcp/README.md +189 -0
- package/packages/mcp/package.json +62 -0
- package/packages/mcp/src/candid/candid-text.test.ts +455 -0
- package/packages/mcp/src/candid/candid-text.ts +501 -0
- package/packages/mcp/src/candid/contract.test.ts +398 -0
- package/packages/mcp/src/candid/formats.ts +155 -0
- package/packages/mcp/src/candid/hex.ts +29 -0
- package/packages/mcp/src/candid/json-schema.test.ts +758 -0
- package/packages/mcp/src/candid/json-schema.ts +454 -0
- package/packages/mcp/src/candid/json.test.ts +1207 -0
- package/packages/mcp/src/candid/json.ts +1053 -0
- package/packages/mcp/src/candid/schema-walk.ts +189 -0
- package/packages/mcp/src/candid/type-text.test.ts +179 -0
- package/packages/mcp/src/candid/type-text.ts +238 -0
- package/packages/mcp/src/cli.ts +134 -0
- package/packages/mcp/src/identity.ts +188 -0
- package/packages/mcp/src/interface/cache.test.ts +48 -0
- package/packages/mcp/src/interface/cache.ts +68 -0
- package/packages/mcp/src/interface/cli-cache.test.ts +150 -0
- package/packages/mcp/src/interface/cli-cache.ts +122 -0
- package/packages/mcp/src/interface/compile-worker.test.ts +246 -0
- package/packages/mcp/src/interface/compile-worker.ts +290 -0
- package/packages/mcp/src/interface/compile.test.ts +155 -0
- package/packages/mcp/src/interface/compile.ts +281 -0
- package/packages/mcp/src/interface/docs.test.ts +105 -0
- package/packages/mcp/src/interface/docs.ts +86 -0
- package/packages/mcp/src/interface/fixtures/icrc1.did +88 -0
- package/packages/mcp/src/interface/hex.ts +8 -0
- package/packages/mcp/src/interface/ids.test.ts +71 -0
- package/packages/mcp/src/interface/ids.ts +87 -0
- package/packages/mcp/src/interface/loader.test.ts +804 -0
- package/packages/mcp/src/interface/loader.ts +519 -0
- package/packages/mcp/src/interface/read-candid.test.ts +300 -0
- package/packages/mcp/src/interface/read-candid.ts +259 -0
- package/packages/mcp/src/interface/types.ts +113 -0
- package/packages/mcp/src/network.ts +122 -0
- package/packages/mcp/src/options.ts +149 -0
- package/packages/mcp/src/server/approval.ts +159 -0
- package/packages/mcp/src/server/naming.ts +43 -0
- package/packages/mcp/src/server/results.ts +102 -0
- package/packages/mcp/src/server/server.ts +797 -0
- package/packages/mcp/src/server/tools.ts +116 -0
- package/packages/mcp/src/usage.ts +40 -0
- package/packages/mcp/tests/approval.test.ts +60 -0
- package/packages/mcp/tests/identity.test.ts +234 -0
- package/packages/mcp/tests/naming.test.ts +62 -0
- package/packages/mcp/tests/options.test.ts +140 -0
- package/packages/mcp/tests/server.test.ts +997 -0
- package/packages/mcp/tsconfig.json +19 -0
- package/packages/mcp/tsconfig.typecheck.json +10 -0
- package/packages/mcp/vitest.config.ts +10 -0
- package/packages/react/LICENSE +21 -0
- package/packages/react/README.md +328 -0
- package/packages/react/llms.txt +95 -0
- package/packages/react/package.json +95 -0
- package/packages/react/src/index.tsx +678 -0
- package/packages/react/tests/abandoned-render.test.tsx +816 -0
- package/packages/react/tests/auth.test.tsx +315 -0
- package/packages/react/tests/caller-keys.test.tsx +2334 -0
- package/packages/react/tests/client-time.test.ts +40 -0
- package/packages/react/tests/entry.test.ts +52 -0
- package/packages/react/tests/helpers.tsx +291 -0
- package/packages/react/tests/hydration.test.tsx +262 -0
- package/packages/react/tests/ownership.test.tsx +260 -0
- package/packages/react/tests/provider.server.test.tsx +169 -0
- package/packages/react/tests/query-client.test.tsx +107 -0
- package/packages/react/tests/strict-mode.test.tsx +288 -0
- package/packages/react/tests/suspense.test-d.tsx +357 -0
- package/packages/react/tests/two-query-cores.test.tsx +135 -0
- package/packages/react/tests/types.test-d.tsx +63 -0
- package/packages/react/tsconfig.json +23 -0
- package/packages/react/tsconfig.test.json +8 -0
- package/packages/react/tsconfig.typecheck.json +16 -0
- package/packages/react/vitest.config.ts +39 -0
- package/packages/vite-plugin/LICENSE +21 -0
- package/packages/vite-plugin/README.md +532 -0
- package/packages/vite-plugin/package.json +76 -0
- package/packages/vite-plugin/src/describe-value.test.ts +43 -0
- package/packages/vite-plugin/src/describe-value.ts +167 -0
- package/packages/vite-plugin/src/dev-environment.test.ts +747 -0
- package/packages/vite-plugin/src/dev-environment.ts +510 -0
- package/packages/vite-plugin/src/env.ts +431 -0
- package/packages/vite-plugin/src/fetch.ts +348 -0
- package/packages/vite-plugin/src/file-identity.ts +106 -0
- package/packages/vite-plugin/src/generate.ts +691 -0
- package/packages/vite-plugin/src/index.test.ts +1243 -0
- package/packages/vite-plugin/src/index.ts +2565 -0
- package/packages/vite-plugin/src/interface.ts +339 -0
- package/packages/vite-plugin/src/local-host.ts +34 -0
- package/packages/vite-plugin/src/options.ts +641 -0
- package/packages/vite-plugin/src/principal-text.test.ts +87 -0
- package/packages/vite-plugin/src/principal-text.ts +98 -0
- package/packages/vite-plugin/tests/close.test.ts +141 -0
- package/packages/vite-plugin/tests/environment-mode.test.ts +136 -0
- package/packages/vite-plugin/tests/fake-ic.ts +214 -0
- package/packages/vite-plugin/tests/fetch-sdk.test.ts +27 -0
- package/packages/vite-plugin/tests/fetch.test.ts +1196 -0
- package/packages/vite-plugin/tests/fixtures/fake-cli/bin.js +90 -0
- package/packages/vite-plugin/tests/fixtures/fake-cli/package.json +8 -0
- package/packages/vite-plugin/tests/fixtures/icrc1.did +88 -0
- package/packages/vite-plugin/tests/generation.test.ts +1036 -0
- package/packages/vite-plugin/tests/icp-command.test.ts +194 -0
- package/packages/vite-plugin/tests/icp-timeout.test.ts +83 -0
- package/packages/vite-plugin/tests/no-process-exit.test.ts +83 -0
- package/packages/vite-plugin/tests/on-generated.test.ts +323 -0
- package/packages/vite-plugin/tests/output-collision.test.ts +329 -0
- package/packages/vite-plugin/tests/package.test.ts +62 -0
- package/packages/vite-plugin/tests/project.test.ts +2993 -0
- package/packages/vite-plugin/tests/support.ts +339 -0
- package/packages/vite-plugin/tests/timeout.test.ts +107 -0
- package/packages/vite-plugin/tsconfig.json +23 -0
- package/packages/vite-plugin/tsconfig.typecheck.json +16 -0
- package/packages/vite-plugin/vitest.config.ts +9 -0
- package/pnpm-workspace.yaml +23 -0
- package/scripts/ai-context-files.js +72 -0
- package/scripts/assemble-docs-site.mjs +485 -0
- package/scripts/assemble-docs-site.test.mjs +568 -0
- package/scripts/build-examples.js +58 -0
- package/scripts/check-ai-context.js +963 -0
- package/scripts/check-ai-context.test.mjs +811 -0
- package/scripts/check-exports.mjs +767 -0
- package/scripts/check-exports.test.mjs +1136 -0
- package/scripts/check-snippets/ambient.d.ts +428 -0
- package/scripts/check-snippets/app/generated/backend.did +7 -0
- package/scripts/check-snippets/app/generated/backend.ts +15 -0
- package/scripts/check-snippets/app/generated/icrc1.did +88 -0
- package/scripts/check-snippets/app/generated/icrc1.ts +78 -0
- package/scripts/check-snippets/app/globals.ts +26 -0
- package/scripts/check-snippets/docs/guides/App.tsx +21 -0
- package/scripts/check-snippets/docs/guides/app/providers.tsx +23 -0
- package/scripts/check-snippets/docs/guides/auth-client.ts +47 -0
- package/scripts/check-snippets/docs/guides/canisters/backend.ts +3 -0
- package/scripts/check-snippets/docs/guides/canisters/icrc1.ts +3 -0
- package/scripts/check-snippets/docs/guides/components/LedgerCard.tsx +26 -0
- package/scripts/check-snippets/docs/guides/components/shell.tsx +11 -0
- package/scripts/check-snippets/docs/guides/components/sign-in-page.tsx +29 -0
- package/scripts/check-snippets/docs/guides/components/slow-section.tsx +5 -0
- package/scripts/check-snippets/docs/guides/generated/accounts.ts +95 -0
- package/scripts/check-snippets/docs/guides/generated/ckbtc_minter.ts +40 -0
- package/scripts/check-snippets/docs/guides/generated/icp_ledger.ts +267 -0
- package/scripts/check-snippets/docs/guides/ledger.ts +10 -0
- package/scripts/check-snippets/docs/guides/server/request-client.ts +8 -0
- package/scripts/check-snippets.mjs +993 -0
- package/scripts/check-snippets.test.mjs +338 -0
- package/scripts/check-stack.mjs +501 -0
- package/scripts/check-stack.test.mjs +800 -0
- package/scripts/clean-node-modules.js +67 -0
- package/scripts/example-projects.js +58 -0
- package/scripts/export-budget.mjs +145 -0
- package/scripts/faults.json +6749 -0
- package/scripts/lib/fault-workspace.mjs +210 -0
- package/scripts/lib/io.mjs +29 -0
- package/scripts/lib/io.test.mjs +38 -0
- package/scripts/lib/markdown-fences.mjs +56 -0
- package/scripts/lib/markdown-fences.test.mjs +84 -0
- package/scripts/lib/package-exports.mjs +54 -0
- package/scripts/lib/package-exports.test.mjs +66 -0
- package/scripts/lib/release-pr-steps.mjs +47 -0
- package/scripts/release-tag.mjs +95 -0
- package/scripts/release-tag.test.mjs +278 -0
- package/scripts/release-workflow.test.mjs +98 -0
- package/scripts/release.js +167 -0
- package/scripts/release.test.mjs +347 -0
- package/scripts/removed-v3-names.js +125 -0
- package/scripts/size-app/.size-limit.js +90 -0
- package/scripts/size-app/core.js +3 -0
- package/scripts/size-app/package.json +24 -0
- package/scripts/size-app/react.js +4 -0
- package/scripts/size-app.test.mjs +73 -0
- package/scripts/sync-ai-context-versions.js +102 -0
- package/scripts/sync-example-versions.js +151 -0
- package/scripts/test-examples-published.mjs +1585 -0
- package/scripts/test-examples-published.test.mjs +1586 -0
- package/scripts/traps/any-method-vars-not-a-list.json +5 -0
- package/scripts/traps/canister-method-unknown.json +5 -0
- package/scripts/traps/client-says-who-calls-once.json +5 -0
- package/scripts/traps/client-says-who-calls.json +5 -0
- package/scripts/traps/err-only-on-canister-err.json +14 -0
- package/scripts/traps/format-units-refuses-missing-value.json +5 -0
- package/scripts/traps/format-units-refuses-number.json +5 -0
- package/scripts/traps/format-units-unknown-option.json +5 -0
- package/scripts/traps/guard-err-is-the-methods.json +5 -0
- package/scripts/traps/guard-false-keeps-every-kind.json +5 -0
- package/scripts/traps/internals-not-exported.json +9 -0
- package/scripts/traps/network-refuses-unknown-name.json +5 -0
- package/scripts/traps/never-err-has-no-type.json +5 -0
- package/scripts/traps/options-method-unknown.json +5 -0
- package/scripts/traps/options-vars-wrong-type.json +5 -0
- package/scripts/traps/parse-units-refuses-number.json +5 -0
- package/scripts/traps/parse-units-unknown-option.json +5 -0
- package/scripts/traps/principal-is-not-plain-text.json +14 -0
- package/scripts/traps/query-options-refuses-oneway.json +5 -0
- package/scripts/traps/query-options-refuses-update.json +5 -0
- package/scripts/traps/refuse-next-unknown-option.json +5 -0
- package/scripts/traps/resend-key-reads-the-methods-arg.json +5 -0
- package/scripts/traps/resend-states-its-dedupe-key.json +5 -0
- package/scripts/traps/suspense-refuses-argument-skip.json +5 -0
- package/scripts/traps/suspense-refuses-skippable-read.json +5 -0
- package/scripts/traps/suspense-refuses-vars-skip-fits.json +5 -0
- package/scripts/traps/test-handler-method-unknown.json +5 -0
- package/scripts/traps/test-handler-nat-is-bigint.json +5 -0
- package/scripts/traps/test-handler-takes-the-domain-value.json +5 -0
- package/scripts/traps/vars-of-two-arguments-are-the-tuple.json +5 -0
- package/scripts/typecheck-examples.js +122 -0
- package/scripts/verify-faults.mjs +375 -0
- package/scripts/verify-faults.test.mjs +402 -0
- package/scripts/verify-package-artifacts.mjs +590 -0
- package/scripts/verify-peer-floors.js +399 -0
- package/scripts/verify-peer-floors.test.mjs +422 -0
- package/scripts/verify-test-fails-rules.mjs +104 -0
- package/scripts/verify-test-fails-rules.test.mjs +215 -0
- package/scripts/verify-test-fails.js +371 -0
- package/scripts/verify-traps.mjs +505 -0
- package/scripts/verify-traps.test.mjs +521 -0
- package/scripts/verify-typescript-floor.js +239 -0
- package/skill-packages/ic-reactor/SKILL.md +103 -0
- package/stack.json +8 -0
- package/tsconfig.base.json +23 -0
- package/tsconfig.json +8 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "condition-v3",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@ic-reactor/core": "3.13.0",
|
|
7
|
+
"@ic-reactor/react": "3.13.0",
|
|
8
|
+
"@icp-sdk/auth": "10.0.1",
|
|
9
|
+
"@icp-sdk/core": "6.1.0",
|
|
10
|
+
"@noble/curves": "2.4.0",
|
|
11
|
+
"@tanstack/query-core": "5.104.0",
|
|
12
|
+
"@tanstack/react-query": "5.104.0",
|
|
13
|
+
"react": "19.3.0",
|
|
14
|
+
"react-dom": "19.3.0"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@testing-library/dom": "10.4.2",
|
|
18
|
+
"@testing-library/react": "16.3.3",
|
|
19
|
+
"@types/node": "26.6.3",
|
|
20
|
+
"@types/react": "19.3.0",
|
|
21
|
+
"@types/react-dom": "19.3.0",
|
|
22
|
+
"jsdom": "30.1.1",
|
|
23
|
+
"typescript": "6.0.3",
|
|
24
|
+
"vitest": "5.0.2"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
|
|
5
|
+
// This file was automatically generated by @icp-sdk/bindgen@0.2.1.
|
|
6
|
+
// You should NOT make any changes in this file as it will be overwritten.
|
|
7
|
+
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
|
|
8
|
+
|
|
9
|
+
import type { ActorMethod } from "@icp-sdk/core/agent"
|
|
10
|
+
import type { IDL } from "@icp-sdk/core/candid"
|
|
11
|
+
import type { Principal } from "@icp-sdk/core/principal"
|
|
12
|
+
|
|
13
|
+
export interface Account {
|
|
14
|
+
owner: Principal
|
|
15
|
+
subaccount: [] | [Subaccount]
|
|
16
|
+
}
|
|
17
|
+
export type BlockIndex = bigint
|
|
18
|
+
/**
|
|
19
|
+
* Number of nanoseconds between two [Timestamp]s.
|
|
20
|
+
*/
|
|
21
|
+
export type Duration = bigint
|
|
22
|
+
/**
|
|
23
|
+
* The initialization parameters of the Ledger
|
|
24
|
+
*/
|
|
25
|
+
export interface InitArgs {
|
|
26
|
+
token_symbol: string
|
|
27
|
+
transfer_fee: bigint
|
|
28
|
+
metadata: Array<[string, Value]>
|
|
29
|
+
minting_account: Account
|
|
30
|
+
initial_balances: Array<[Account, bigint]>
|
|
31
|
+
archive_options: {
|
|
32
|
+
num_blocks_to_archive: bigint
|
|
33
|
+
trigger_threshold: bigint
|
|
34
|
+
max_message_size_bytes: [] | [bigint]
|
|
35
|
+
cycles_for_archive_creation: [] | [bigint]
|
|
36
|
+
node_max_memory_size_bytes: [] | [bigint]
|
|
37
|
+
controller_id: Principal
|
|
38
|
+
}
|
|
39
|
+
token_name: string
|
|
40
|
+
}
|
|
41
|
+
export type LedgerArg = { Upgrade: [] | [UpgradeArgs] } | { Init: InitArgs }
|
|
42
|
+
export type Subaccount = Uint8Array
|
|
43
|
+
/**
|
|
44
|
+
* Number of nanoseconds since the UNIX epoch in UTC timezone.
|
|
45
|
+
*/
|
|
46
|
+
export type Timestamp = bigint
|
|
47
|
+
export type Tokens = bigint
|
|
48
|
+
export interface TransferArg {
|
|
49
|
+
to: Account
|
|
50
|
+
fee: [] | [Tokens]
|
|
51
|
+
memo: [] | [Uint8Array]
|
|
52
|
+
from_subaccount: [] | [Subaccount]
|
|
53
|
+
created_at_time: [] | [Timestamp]
|
|
54
|
+
amount: Tokens
|
|
55
|
+
}
|
|
56
|
+
export type TransferError =
|
|
57
|
+
| {
|
|
58
|
+
GenericError: { message: string; error_code: bigint }
|
|
59
|
+
}
|
|
60
|
+
| { TemporarilyUnavailable: null }
|
|
61
|
+
| { BadBurn: { min_burn_amount: Tokens } }
|
|
62
|
+
| { Duplicate: { duplicate_of: BlockIndex } }
|
|
63
|
+
| { BadFee: { expected_fee: Tokens } }
|
|
64
|
+
| { CreatedInFuture: { ledger_time: bigint } }
|
|
65
|
+
| { TooOld: null }
|
|
66
|
+
| { InsufficientFunds: { balance: Tokens } }
|
|
67
|
+
export type TransferResult = { Ok: BlockIndex } | { Err: TransferError }
|
|
68
|
+
export interface UpgradeArgs {
|
|
69
|
+
token_symbol: [] | [string]
|
|
70
|
+
transfer_fee: [] | [bigint]
|
|
71
|
+
metadata: [] | [Array<[string, Value]>]
|
|
72
|
+
token_name: [] | [string]
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The value returned from the [icrc1_metadata] endpoint.
|
|
76
|
+
*/
|
|
77
|
+
export type Value =
|
|
78
|
+
{ Int: bigint } | { Nat: bigint } | { Blob: Uint8Array } | { Text: string }
|
|
79
|
+
export interface _SERVICE {
|
|
80
|
+
icrc1_balance_of: ActorMethod<[Account], Tokens>
|
|
81
|
+
icrc1_decimals: ActorMethod<[], number>
|
|
82
|
+
icrc1_fee: ActorMethod<[], Tokens>
|
|
83
|
+
icrc1_metadata: ActorMethod<[], Array<[string, Value]>>
|
|
84
|
+
icrc1_minting_account: ActorMethod<[], [] | [Account]>
|
|
85
|
+
icrc1_name: ActorMethod<[], string>
|
|
86
|
+
icrc1_supported_standards: ActorMethod<
|
|
87
|
+
[],
|
|
88
|
+
Array<{ url: string; name: string }>
|
|
89
|
+
>
|
|
90
|
+
icrc1_symbol: ActorMethod<[], string>
|
|
91
|
+
icrc1_total_supply: ActorMethod<[], Tokens>
|
|
92
|
+
icrc1_transfer: ActorMethod<[TransferArg], TransferResult>
|
|
93
|
+
}
|
|
94
|
+
export declare const idlFactory: IDL.InterfaceFactory
|
|
95
|
+
export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[]
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
|
|
5
|
+
// This file was automatically generated by @icp-sdk/bindgen@0.2.1.
|
|
6
|
+
// You should NOT make any changes in this file as it will be overwritten.
|
|
7
|
+
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
|
|
8
|
+
|
|
9
|
+
import { IDL } from "@icp-sdk/core/candid"
|
|
10
|
+
|
|
11
|
+
export const idlFactory = ({ IDL }) => {
|
|
12
|
+
const Value = IDL.Variant({
|
|
13
|
+
Int: IDL.Int,
|
|
14
|
+
Nat: IDL.Nat,
|
|
15
|
+
Blob: IDL.Vec(IDL.Nat8),
|
|
16
|
+
Text: IDL.Text,
|
|
17
|
+
})
|
|
18
|
+
const UpgradeArgs = IDL.Record({
|
|
19
|
+
token_symbol: IDL.Opt(IDL.Text),
|
|
20
|
+
transfer_fee: IDL.Opt(IDL.Nat64),
|
|
21
|
+
metadata: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, Value))),
|
|
22
|
+
token_name: IDL.Opt(IDL.Text),
|
|
23
|
+
})
|
|
24
|
+
const Subaccount = IDL.Vec(IDL.Nat8)
|
|
25
|
+
const Account = IDL.Record({
|
|
26
|
+
owner: IDL.Principal,
|
|
27
|
+
subaccount: IDL.Opt(Subaccount),
|
|
28
|
+
})
|
|
29
|
+
const InitArgs = IDL.Record({
|
|
30
|
+
token_symbol: IDL.Text,
|
|
31
|
+
transfer_fee: IDL.Nat64,
|
|
32
|
+
metadata: IDL.Vec(IDL.Tuple(IDL.Text, Value)),
|
|
33
|
+
minting_account: Account,
|
|
34
|
+
initial_balances: IDL.Vec(IDL.Tuple(Account, IDL.Nat64)),
|
|
35
|
+
archive_options: IDL.Record({
|
|
36
|
+
num_blocks_to_archive: IDL.Nat64,
|
|
37
|
+
trigger_threshold: IDL.Nat64,
|
|
38
|
+
max_message_size_bytes: IDL.Opt(IDL.Nat64),
|
|
39
|
+
cycles_for_archive_creation: IDL.Opt(IDL.Nat64),
|
|
40
|
+
node_max_memory_size_bytes: IDL.Opt(IDL.Nat64),
|
|
41
|
+
controller_id: IDL.Principal,
|
|
42
|
+
}),
|
|
43
|
+
token_name: IDL.Text,
|
|
44
|
+
})
|
|
45
|
+
const LedgerArg = IDL.Variant({
|
|
46
|
+
Upgrade: IDL.Opt(UpgradeArgs),
|
|
47
|
+
Init: InitArgs,
|
|
48
|
+
})
|
|
49
|
+
const Tokens = IDL.Nat
|
|
50
|
+
const Timestamp = IDL.Nat64
|
|
51
|
+
const TransferArg = IDL.Record({
|
|
52
|
+
to: Account,
|
|
53
|
+
fee: IDL.Opt(Tokens),
|
|
54
|
+
memo: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
55
|
+
from_subaccount: IDL.Opt(Subaccount),
|
|
56
|
+
created_at_time: IDL.Opt(Timestamp),
|
|
57
|
+
amount: Tokens,
|
|
58
|
+
})
|
|
59
|
+
const BlockIndex = IDL.Nat
|
|
60
|
+
const TransferError = IDL.Variant({
|
|
61
|
+
GenericError: IDL.Record({
|
|
62
|
+
message: IDL.Text,
|
|
63
|
+
error_code: IDL.Nat,
|
|
64
|
+
}),
|
|
65
|
+
TemporarilyUnavailable: IDL.Null,
|
|
66
|
+
BadBurn: IDL.Record({ min_burn_amount: Tokens }),
|
|
67
|
+
Duplicate: IDL.Record({ duplicate_of: BlockIndex }),
|
|
68
|
+
BadFee: IDL.Record({ expected_fee: Tokens }),
|
|
69
|
+
CreatedInFuture: IDL.Record({ ledger_time: IDL.Nat64 }),
|
|
70
|
+
TooOld: IDL.Null,
|
|
71
|
+
InsufficientFunds: IDL.Record({ balance: Tokens }),
|
|
72
|
+
})
|
|
73
|
+
const TransferResult = IDL.Variant({
|
|
74
|
+
Ok: BlockIndex,
|
|
75
|
+
Err: TransferError,
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
return IDL.Service({
|
|
79
|
+
icrc1_balance_of: IDL.Func([Account], [Tokens], ["query"]),
|
|
80
|
+
icrc1_decimals: IDL.Func([], [IDL.Nat8], ["query"]),
|
|
81
|
+
icrc1_fee: IDL.Func([], [Tokens], ["query"]),
|
|
82
|
+
icrc1_metadata: IDL.Func(
|
|
83
|
+
[],
|
|
84
|
+
[IDL.Vec(IDL.Tuple(IDL.Text, Value))],
|
|
85
|
+
["query"]
|
|
86
|
+
),
|
|
87
|
+
icrc1_minting_account: IDL.Func([], [IDL.Opt(Account)], ["query"]),
|
|
88
|
+
icrc1_name: IDL.Func([], [IDL.Text], ["query"]),
|
|
89
|
+
icrc1_supported_standards: IDL.Func(
|
|
90
|
+
[],
|
|
91
|
+
[IDL.Vec(IDL.Record({ url: IDL.Text, name: IDL.Text }))],
|
|
92
|
+
["query"]
|
|
93
|
+
),
|
|
94
|
+
icrc1_symbol: IDL.Func([], [IDL.Text], ["query"]),
|
|
95
|
+
icrc1_total_supply: IDL.Func([], [Tokens], ["query"]),
|
|
96
|
+
icrc1_transfer: IDL.Func([TransferArg], [TransferResult], []),
|
|
97
|
+
})
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export const init = ({ IDL }) => {
|
|
101
|
+
const Value = IDL.Variant({
|
|
102
|
+
Int: IDL.Int,
|
|
103
|
+
Nat: IDL.Nat,
|
|
104
|
+
Blob: IDL.Vec(IDL.Nat8),
|
|
105
|
+
Text: IDL.Text,
|
|
106
|
+
})
|
|
107
|
+
const UpgradeArgs = IDL.Record({
|
|
108
|
+
token_symbol: IDL.Opt(IDL.Text),
|
|
109
|
+
transfer_fee: IDL.Opt(IDL.Nat64),
|
|
110
|
+
metadata: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, Value))),
|
|
111
|
+
token_name: IDL.Opt(IDL.Text),
|
|
112
|
+
})
|
|
113
|
+
const Subaccount = IDL.Vec(IDL.Nat8)
|
|
114
|
+
const Account = IDL.Record({
|
|
115
|
+
owner: IDL.Principal,
|
|
116
|
+
subaccount: IDL.Opt(Subaccount),
|
|
117
|
+
})
|
|
118
|
+
const InitArgs = IDL.Record({
|
|
119
|
+
token_symbol: IDL.Text,
|
|
120
|
+
transfer_fee: IDL.Nat64,
|
|
121
|
+
metadata: IDL.Vec(IDL.Tuple(IDL.Text, Value)),
|
|
122
|
+
minting_account: Account,
|
|
123
|
+
initial_balances: IDL.Vec(IDL.Tuple(Account, IDL.Nat64)),
|
|
124
|
+
archive_options: IDL.Record({
|
|
125
|
+
num_blocks_to_archive: IDL.Nat64,
|
|
126
|
+
trigger_threshold: IDL.Nat64,
|
|
127
|
+
max_message_size_bytes: IDL.Opt(IDL.Nat64),
|
|
128
|
+
cycles_for_archive_creation: IDL.Opt(IDL.Nat64),
|
|
129
|
+
node_max_memory_size_bytes: IDL.Opt(IDL.Nat64),
|
|
130
|
+
controller_id: IDL.Principal,
|
|
131
|
+
}),
|
|
132
|
+
token_name: IDL.Text,
|
|
133
|
+
})
|
|
134
|
+
const LedgerArg = IDL.Variant({
|
|
135
|
+
Upgrade: IDL.Opt(UpgradeArgs),
|
|
136
|
+
Init: InitArgs,
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
return [LedgerArg]
|
|
140
|
+
}
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
# Porting the v4-proto solutions to `v4`
|
|
2
|
+
|
|
3
|
+
What DX5's second phase (issue #786) ported: the two tasks' v4-proto
|
|
4
|
+
reference solutions and the six v4-proto faulty solutions, rewritten against
|
|
5
|
+
ic-reactor 4, plus one faulty solution of v4's own for a trap the port
|
|
6
|
+
found. The work list was written on 2026-10-02 against the
|
|
7
|
+
**planned** API (SCOPE item 1, DECISIONS Q1 to Q14, and the slices that build
|
|
8
|
+
it: IR1 #779, IR6 #780, IR2t #782, IR5 #777, IR3 #775). The port was made the
|
|
9
|
+
same day against the API **as built** (`packages/core/src`,
|
|
10
|
+
`packages/react/src` with all five slices merged), and this file now records
|
|
11
|
+
it: where the port differs from the plan, the section says so under "As
|
|
12
|
+
ported".
|
|
13
|
+
|
|
14
|
+
**Result.** All four references, all six ported faulty solutions and one
|
|
15
|
+
v4-only faulty solution are in the tree. `node gate.mjs --require v4`
|
|
16
|
+
reports 56 of 56 (45 + 4 references + 6 ports + 1 v4-only), no cell
|
|
17
|
+
skipped. Each ported faulty solution fails exactly the tests its v4-proto
|
|
18
|
+
original fails: no fault had to be dropped or changed, so the real library
|
|
19
|
+
closed none of the six traps the prototype left open
|
|
20
|
+
(`harness/gate-plan.test.mjs` checks that each port's `expectFail` equals
|
|
21
|
+
its original's). It opened two the prototype did not. An explicit
|
|
22
|
+
`AnonymousIdentity` is sent (below), which
|
|
23
|
+
`node-tool/faulty/v4-anonymous-identity-sent` carries as a gate cell. A
|
|
24
|
+
module-scope client handed to `ReactorProvider` was disposed under later
|
|
25
|
+
trees (react-wallet's module-scope variant, below); #805 since makes the
|
|
26
|
+
provider dispose only a client its own factory call created, so it is not a
|
|
27
|
+
gate cell.
|
|
28
|
+
|
|
29
|
+
## Rules for the port
|
|
30
|
+
|
|
31
|
+
- **Check the scorer first.** Before scoring the first port, run
|
|
32
|
+
`node setup.mjs` and `node --test harness/ship.test.mjs`, which checks
|
|
33
|
+
that the scorer loads one instance of `@icp-sdk/core`. The world
|
|
34
|
+
(`world.ts`, `fake-auth.ts`, the 3.13.0 fake replica) imports it from
|
|
35
|
+
evals' install; the solution, the hidden tests and the v4 packages import
|
|
36
|
+
it from `conditions/v4/node_modules`, where setup makes it a link to
|
|
37
|
+
evals' copy (`conditions/v4/README.md`, step 6). A reference failure that
|
|
38
|
+
looks like a class or identity mismatch (fake-auth's signed-out
|
|
39
|
+
`AnonymousIdentity` not seen as anonymous, a `Principal` not recognised)
|
|
40
|
+
points at that link before the library. Nothing else crosses: the 3.13.0
|
|
41
|
+
fake replica only answers `fetch`, and v4's error classification reads
|
|
42
|
+
names and codes, never `instanceof` (`packages/core/src/errors.ts`).
|
|
43
|
+
_As ported:_ done first; `ship.test.mjs` passed, and no reference failure
|
|
44
|
+
of that kind showed up.
|
|
45
|
+
- **Same product, new library.** Each port keeps the reference's behaviour
|
|
46
|
+
line for line (the same refusals, the same `data-state` rule, the same
|
|
47
|
+
module-scope or per-tree lifetime) and changes only what ic-reactor 4 now
|
|
48
|
+
does for it. A port that needs new behaviour is a finding, not a port.
|
|
49
|
+
- **Where it goes.** References: `tasks/<task>/solutions/v4/reference/` and
|
|
50
|
+
`tasks/<task>/solutions/v4/reference-module-scope/`. Faulty solutions:
|
|
51
|
+
`tasks/<task>/faulty/v4-<name>/`, where `<name>` is the v4-proto name
|
|
52
|
+
without its `v4-proto-` prefix (so `v4-proto-retry-spread` becomes
|
|
53
|
+
`v4-retry-spread`), each the v4 `reference` with the one change named
|
|
54
|
+
below, and `meta.json` with `"condition": "v4"`. The v4-proto originals
|
|
55
|
+
stay: they gate the v4-proto condition.
|
|
56
|
+
- **Expected failures.** Start from the v4-proto `meta.json` `expectFail`. If
|
|
57
|
+
`node gate.mjs` shows a different set, change it only with the reason in
|
|
58
|
+
`meta.json` `bug` and in the README's faulty-solution table: the hidden
|
|
59
|
+
tests, the world and the scoring do not change (issue #786, "Not in
|
|
60
|
+
scope"). _As ported:_ no set changed.
|
|
61
|
+
- **The gate.** `node gate.mjs --require v4` must then report 45 + 4 + 6 =
|
|
62
|
+
55 of 55 (56 of 56 with the v4-only faulty solution added after the
|
|
63
|
+
port). `--require v4` fails the gate before scoring while either task's
|
|
64
|
+
`v4` cell has no reference, and a ported faulty solution in a task whose
|
|
65
|
+
`v4` references are missing fails it even without the flag, so a port
|
|
66
|
+
left half done cannot pass.
|
|
67
|
+
- **Imports.** `@ic-reactor/core` (`createClient`, `isReactorError`,
|
|
68
|
+
`parseUnits`, `formatUnits`, types `AuthLike`, `Client`);
|
|
69
|
+
`@ic-reactor/react` (`ReactorProvider`, `useClient`, `useAuth`);
|
|
70
|
+
`@candid-core/schema` (`isPrincipal`, `principal`: the only import path
|
|
71
|
+
for Candid values, D35); `@tanstack/react-query` (`useQuery`,
|
|
72
|
+
`useMutation`, `skipToken`, and `QueryClientProvider` in the react
|
|
73
|
+
module-scope variant); `./generated/icrc1` (`actor`, `type Actor`);
|
|
74
|
+
`@icp-sdk/core/agent` (`type Identity`, node-tool only, for the
|
|
75
|
+
anonymous mapping below). There is no `icrc1.service.ts`: the v4
|
|
76
|
+
condition's starter holds only the CLI's `icrc1.ts`, and no mode map
|
|
77
|
+
exists in v4 (CC2 was dropped). No port names `ReactorError` or
|
|
78
|
+
`Principal`: both are inferred (`transfer.error` is
|
|
79
|
+
`ReactorError<TransferError> | null` from the options, and `isPrincipal`
|
|
80
|
+
narrows text to `Principal`).
|
|
81
|
+
|
|
82
|
+
## API map
|
|
83
|
+
|
|
84
|
+
| v4-proto (prototype) | v4 (as built) | Decided by |
|
|
85
|
+
| ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------- |
|
|
86
|
+
| `import { LedgerService } from "./generated/icrc1.service"` | `import { actor, type Actor } from "./generated/icrc1"` | SCOPE 1e |
|
|
87
|
+
| `createClient({ network: { host, rootKey }, identity })`, identity optional | `createClient({ network: { host, rootKey }, identity })` where `identity` is an `Identity` or `"anonymous"`, and required (or `auth`) | SCOPE 1a, 1b; D29; #779 |
|
|
88
|
+
| `createClient({ network, auth })` taking the starter's `WalletAuth` as is | `createClient({ network, auth: () => walletAuthLike(auth) })`: a factory of an `AuthLike` (adapter below) | Q14; #779 |
|
|
89
|
+
| `client.canister(LedgerService, { id })` | `client.canister<Actor>(actor, { id })`, memoized per (schema, target), so it can be called in render | Q1 |
|
|
90
|
+
| `ledger.icrc1_balance_of([account])` | `ledger.icrc1_balance_of(account)` | Q3: one argument is the value |
|
|
91
|
+
| `ledger.icrc1_transfer([arg])` → block index | `ledger.icrc1_transfer(arg)` → block index (`Ok` unwrapped); `Err` rejects kind `canister_err` with `.err` typed `TransferError` | Q3, Q7 |
|
|
92
|
+
| `ledger.icrc1_balance_of.queryOptions([account] \| skipToken)` | `client.queryOptions(ledger, "icrc1_balance_of", account \| skipToken)` | Q1, Q3 |
|
|
93
|
+
| `ledger.icrc1_transfer.mutationOptions({ invalidates: [ledger.icrc1_balance_of] })` | `client.mutationOptions(ledger, "icrc1_transfer")`: by default it invalidates the ledger's reads for every caller (Q10); the explicit form is `{ invalidates: [[ledger, "icrc1_balance_of"]] }` | Q1, Q10; #782 |
|
|
94
|
+
| `transfer.mutate([arg])` | `transfer.mutate(arg)` | Q3 |
|
|
95
|
+
| `isReactorError(e)`, `e.kind`, `e.mayHaveExecuted`, `e.message`, `e.err.tag` | the same names from `@ic-reactor/core` | Q6; IR3 #775 |
|
|
96
|
+
| `isPrincipalText(text)`, `PrincipalText` | `isPrincipal(text)`, `Principal` from `@candid-core/schema` (`principal(text)` throws `TypeError` instead) | D35 |
|
|
97
|
+
| `useSyncExternalStore(client.subscribe, client.caller)` + `client.isAuthenticated()` | `const { status, principal, signIn, signOut } = useAuth()`; signed in exactly when `status === "signed-in"` | Q11; #780 |
|
|
98
|
+
| `useState(() => new QueryClient())` + `QueryClientProvider` | `ReactorProvider` with a client factory; it renders `QueryClientProvider` with `client.queryClient` | SCOPE 1d; D31; #780 |
|
|
99
|
+
| hand-written `parseAmount` (regex, `100_000_000n`) | `parseUnits(text, 8)` in a `try`; it throws `TypeError` (malformed) or `RangeError` (negative, more than 8 significant decimals) | IR5 #777 |
|
|
100
|
+
| hand-written `formatE8s` | `formatUnits(value, 8, { minFractionDigits: 8 })` (`50.00000000`, no grouping) | IR5 #777 |
|
|
101
|
+
|
|
102
|
+
Two `parseUnits` differences from the v4-proto regex, both outside what the
|
|
103
|
+
hidden tests send: it trims surrounding spaces and accepts `"1."`, `".5"` and
|
|
104
|
+
trailing zeros past the 8th digit (`"1.123456780"` is 112345678 base units),
|
|
105
|
+
where the regex refused them. The port keeps `parseUnits` as is.
|
|
106
|
+
|
|
107
|
+
**The nat64 cap stays hand-written.** The ledger's `amount` is Candid `nat`,
|
|
108
|
+
which has no cap, so neither `parseUnits` nor the codec refuses 2^64 base
|
|
109
|
+
units. The explicit prompt (under which `gate.mjs` scores) states the cap, so
|
|
110
|
+
both references keep `NAT64_MAX = 18_446_744_073_709_551_615n` and refuse
|
|
111
|
+
`units > NAT64_MAX` before calling the ledger.
|
|
112
|
+
|
|
113
|
+
**Anonymous identities: a trap the port must not fall into.** In v4,
|
|
114
|
+
`identity: "anonymous"` makes every update reject `unauthenticated` with
|
|
115
|
+
nothing sent, but an explicit `AnonymousIdentity` object is sent (the D29
|
|
116
|
+
escape, IR2t #782 criterion 3). The node-tool contract says "Absent or
|
|
117
|
+
anonymous: the tool is read-only", and the hidden tests pass an
|
|
118
|
+
`AnonymousIdentity` too. So the node-tool reference maps
|
|
119
|
+
`config.identity` to `"anonymous"` when it is absent **or** its principal is
|
|
120
|
+
anonymous; `identity: config.identity ?? "anonymous"` would send the transfer.
|
|
121
|
+
DX3's guide has to teach this mapping (it is the same trap for an agent).
|
|
122
|
+
_As ported:_ confirmed. With that one line in place of the mapping, the
|
|
123
|
+
reference fails `no_anonymous_update`, and only it: the `AnonymousIdentity`
|
|
124
|
+
tool's transfer reaches the ledger. v4-proto had no such trap (its
|
|
125
|
+
client refused every update whose caller principal was anonymous, however
|
|
126
|
+
the identity was given: `conditions/v4-proto/lib/src/client.ts`), so no
|
|
127
|
+
port carries it; `faulty/v4-anonymous-identity-sent` (below) is the
|
|
128
|
+
reference with that one line, and the gate carries it like the ports.
|
|
129
|
+
|
|
130
|
+
### The `AuthLike` adapter (react-wallet, Q14)
|
|
131
|
+
|
|
132
|
+
The protected `src/auth.ts` `WalletAuth` has a synchronous `getIdentity()`
|
|
133
|
+
and `isAuthenticated()`; `AuthLike` is `@icp-sdk/auth` 10's `AuthClient`
|
|
134
|
+
shape (IR1 #779). The port's adapter, which DX3's guide also shows:
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
function walletAuthLike(auth: WalletAuth): AuthLike {
|
|
138
|
+
const signedIn = () =>
|
|
139
|
+
auth.isAuthenticated() && !auth.getIdentity().getPrincipal().isAnonymous()
|
|
140
|
+
return {
|
|
141
|
+
getPrincipal: () =>
|
|
142
|
+
signedIn() ? auth.getIdentity().getPrincipal() : undefined,
|
|
143
|
+
getStatus: () => ({ state: signedIn() ? "signed-in" : "signed-out" }),
|
|
144
|
+
getIdentity: async () => auth.getIdentity(),
|
|
145
|
+
subscribe: (listener) => auth.subscribe(listener),
|
|
146
|
+
signIn: () => auth.login(),
|
|
147
|
+
signOut: () => auth.logout(),
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
No `dispose`: the wallet does not own `WalletAuth`, and the client calls
|
|
153
|
+
`auth.dispose?.()` on its own disposal. _As ported:_ exactly this, in both
|
|
154
|
+
react-wallet references; it type-checks against the built `AuthLike` with no
|
|
155
|
+
annotation beyond the return type.
|
|
156
|
+
|
|
157
|
+
## node-tool
|
|
158
|
+
|
|
159
|
+
### `solutions/v4/reference/src/index.ts`
|
|
160
|
+
|
|
161
|
+
From `solutions/v4-proto/reference/src/index.ts`:
|
|
162
|
+
|
|
163
|
+
1. Imports: `createClient`, `isReactorError`, `parseUnits` from
|
|
164
|
+
`@ic-reactor/core`; `isPrincipal` from `@candid-core/schema`;
|
|
165
|
+
`actor`, `type Actor` from `./generated/icrc1`.
|
|
166
|
+
2. `parseAmount(text)`: `try { units = parseUnits(text, 8) } catch { return
|
|
167
|
+
undefined }`, then `units <= NAT64_MAX ? units : undefined` (the cap
|
|
168
|
+
above).
|
|
169
|
+
3. `createClient({ network: { host: config.host, rootKey: config.rootKey },
|
|
170
|
+
identity: writer })` with `writer` = `config.identity` when present and
|
|
171
|
+
not anonymous, else `"anonymous"` (the trap above). The root key rule is
|
|
172
|
+
the client's (Q4): a given `rootKey` is never fetched over, a missing one
|
|
173
|
+
is fetched only from a local host; the reference passes `config.rootKey`
|
|
174
|
+
through and does nothing else.
|
|
175
|
+
4. `client.canister<Actor>(actor, { id: config.canisterId })`.
|
|
176
|
+
5. `getBalance(owner)`: `isPrincipal(owner)` else `TypeError`; then
|
|
177
|
+
`ledger.icrc1_balance_of({ owner, subaccount: null })`.
|
|
178
|
+
6. `transfer({ to, amount })`: the same two refusals in the same order
|
|
179
|
+
(amount, then recipient with `isPrincipal`), then
|
|
180
|
+
`await ledger.icrc1_transfer({ to: { owner: to, subaccount: null }, amount:
|
|
181
|
+
units, fee: null, memo: null, from_subaccount: null, created_at_time:
|
|
182
|
+
null })` → `{ ok: true, blockIndex }`.
|
|
183
|
+
7. The `catch` is unchanged: `isReactorError(error)` else rethrow;
|
|
184
|
+
`mayHaveExecuted: error.mayHaveExecuted`; the reason prefixes
|
|
185
|
+
`canister_err` with `ledger refused:`. An `unauthenticated` rejection
|
|
186
|
+
(signed out) arrives here with `mayHaveExecuted: false`, as v4-proto's
|
|
187
|
+
did. The client re-sends only a retryable `not_delivered` (reject code 2,
|
|
188
|
+
HTTP 429; Q9), so the reference adds no retry.
|
|
189
|
+
|
|
190
|
+
_As ported:_ as planned. The mapping is a function, `writerOf(identity)`,
|
|
191
|
+
which is where the `type Identity` import comes from. `isPrincipal` narrows
|
|
192
|
+
`owner` and `to` to `Principal`, so the generated `Account` takes them with
|
|
193
|
+
no `principal()` call.
|
|
194
|
+
|
|
195
|
+
### `solutions/v4/reference-module-scope/src/index.ts`
|
|
196
|
+
|
|
197
|
+
The `reference` above plus v4-proto's module-scope `Map<string, Client>`
|
|
198
|
+
keyed by `host|principal` (`"anonymous"` for the read-only case), unchanged:
|
|
199
|
+
one client per replica and identity, built on first use, never disposed.
|
|
200
|
+
_As ported:_ as planned; the key's principal part is the mapped writer's, so
|
|
201
|
+
an absent identity and an `AnonymousIdentity` share the read-only client.
|
|
202
|
+
|
|
203
|
+
### `faulty/v4-never-may-have-executed` (from `v4-proto-never-may-have-executed`)
|
|
204
|
+
|
|
205
|
+
The v4 `reference` with `mayHaveExecuted: error.mayHaveExecuted` replaced by
|
|
206
|
+
`mayHaveExecuted: false`. Bug text unchanged. Expected failures:
|
|
207
|
+
`reject_code_4_classified`, `reject_code_5_classified`,
|
|
208
|
+
`lost_reply_classified`. _As ported:_ fails exactly these.
|
|
209
|
+
|
|
210
|
+
### `faulty/v4-refuses-nat64-max` (from `v4-proto-refuses-nat64-max`)
|
|
211
|
+
|
|
212
|
+
The v4 `reference` with the cap written `units < NAT64_MAX` instead of
|
|
213
|
+
`units <= NAT64_MAX`. Bug text unchanged. Expected failure:
|
|
214
|
+
`accepts_nat64_max`. _As ported:_ fails exactly this.
|
|
215
|
+
|
|
216
|
+
### `faulty/v4-anonymous-identity-sent` (v4 only, no original)
|
|
217
|
+
|
|
218
|
+
The v4 `reference` with `identity: writerOf(config.identity)` replaced by
|
|
219
|
+
`identity: config.identity ?? "anonymous"` (and the then unused `writerOf`
|
|
220
|
+
and `Identity` import removed): the line an agent writes when it reads
|
|
221
|
+
"absent: anonymous" and stops there. Expected failure:
|
|
222
|
+
`no_anonymous_update`, the same test `thin-anonymous-transfer` fails in the
|
|
223
|
+
thin condition. Added after review, so that the gate shows the hidden tests
|
|
224
|
+
catch this trap of the real library. _Measured:_ fails exactly this
|
|
225
|
+
(tsc clean); with the mapping put back, the gate reports the cell `FAIL`
|
|
226
|
+
with nothing failed.
|
|
227
|
+
|
|
228
|
+
## react-wallet
|
|
229
|
+
|
|
230
|
+
### `solutions/v4/reference/src/Wallet.tsx`
|
|
231
|
+
|
|
232
|
+
From `solutions/v4-proto/reference/src/Wallet.tsx`:
|
|
233
|
+
|
|
234
|
+
1. `Wallet({ auth, config })` renders
|
|
235
|
+
`<ReactorProvider client={() => createClient({ network: { host:
|
|
236
|
+
config.host, rootKey: config.rootKey }, auth: () => walletAuthLike(auth)
|
|
237
|
+
})}>` around the view. The provider runs the factory once per mounted
|
|
238
|
+
tree and disposes the client on unmount (D31, #780): this replaces
|
|
239
|
+
v4-proto's `useState(() => new QueryClient())` and the
|
|
240
|
+
`useMemo(createClient)` keyed on `[auth, config.host, config.rootKey]`.
|
|
241
|
+
The hidden tests never re-render one `Wallet` with other props (they
|
|
242
|
+
unmount and render afresh), so the provider needs no `key`; an app whose
|
|
243
|
+
`auth` or `config` can change keys the provider on them.
|
|
244
|
+
2. `WalletView({ canisterId })`: `const client = useClient()`;
|
|
245
|
+
`const ledger = client.canister<Actor>(actor, { id: canisterId })` (no
|
|
246
|
+
`useMemo`: memoized by the client); `const { status, principal: caller } =
|
|
247
|
+
useAuth()`; `const signedIn = status === "signed-in"`.
|
|
248
|
+
3. Balance: `useQuery(client.queryOptions(ledger, "icrc1_balance_of",
|
|
249
|
+
signedIn ? { owner: principal(caller), subaccount: null } : skipToken))`.
|
|
250
|
+
`principal(caller)` brands the text `useAuth` returns (#779 types it
|
|
251
|
+
`string`; drop the call if #782 narrows it to `Principal`). The key holds
|
|
252
|
+
the caller (D17), so a switch never shows the previous principal's
|
|
253
|
+
balance and no `placeholderData` is set.
|
|
254
|
+
4. Transfer: `useMutation(client.mutationOptions(ledger, "icrc1_transfer"))`;
|
|
255
|
+
the default invalidation re-reads the balance after success, after
|
|
256
|
+
`canister_err` and after any `mayHaveExecuted` failure (Q10, #782),
|
|
257
|
+
which is what `invalidates: [ledger.icrc1_balance_of]` did.
|
|
258
|
+
5. `onSubmit`: the same refusals in the same order and words (signed out;
|
|
259
|
+
amount through the `parseAmount` of the node-tool port; recipient
|
|
260
|
+
`isPrincipal(to.trim())`), then `transfer.mutate({ to: { owner: recipient,
|
|
261
|
+
subaccount: null }, amount: units, fee: null, memo: null,
|
|
262
|
+
from_subaccount: null, created_at_time: null })`.
|
|
263
|
+
6. `state`, the buttons, the inputs, `transfer-status` and its text are
|
|
264
|
+
unchanged (`transfer.error.mayHaveExecuted`, `transfer.error.kind ===
|
|
265
|
+
"canister_err"`, `transfer.error.err.tag`; `transfer.error` is typed
|
|
266
|
+
`ReactorError<TransferError> | null`, #782 criterion 13).
|
|
267
|
+
7. Balance text: `formatUnits(balance.data, 8, { minFractionDigits: 8 })`
|
|
268
|
+
in place of `formatE8s`.
|
|
269
|
+
|
|
270
|
+
_As ported:_ as planned, with one difference in step 6: the sign-in and
|
|
271
|
+
sign-out buttons call `signIn()` and `signOut()` from `useAuth()` instead of
|
|
272
|
+
`auth.login()` and `auth.logout()`. The view no longer receives `auth`; the
|
|
273
|
+
client forwards both calls to the adapter, which calls the wallet's own. The
|
|
274
|
+
buttons' test ids, labels and visibility are unchanged. `AuthState.principal`
|
|
275
|
+
is still typed `string`, so `principal(caller)` stays.
|
|
276
|
+
|
|
277
|
+
### `solutions/v4/reference-module-scope/src/Wallet.tsx`
|
|
278
|
+
|
|
279
|
+
v4-proto's variant keeps one `QueryClient` and one client at module scope,
|
|
280
|
+
built on first render (`shared ??= createClient(...)`). In v4 the client owns
|
|
281
|
+
its `QueryClient`, so only the client is kept. **Decide at port time:**
|
|
282
|
+
`ReactorProvider` disposes the client its factory returns when the tree
|
|
283
|
+
unmounts (#780), which would kill a module-scope client after the first
|
|
284
|
+
test. Unless #780 ships a way to hand the provider a client it does not own,
|
|
285
|
+
this variant does not use the provider: it renders `<QueryClientProvider
|
|
286
|
+
client={shared.queryClient}>`, passes `shared` down, and reads the auth state
|
|
287
|
+
with `useSyncExternalStore(shared.subscribe, shared.authState)` instead of
|
|
288
|
+
`useAuth()` (which needs the provider). Everything else is the `reference`.
|
|
289
|
+
|
|
290
|
+
_Decided:_ no provider, as above. #780 shipped no way to give
|
|
291
|
+
`ReactorProvider` a client it does not own: it disposes whatever its factory
|
|
292
|
+
returned when the tree unmounts, and a later mount that finds that client
|
|
293
|
+
disposed calls the factory again, which for a module-scope client returns the
|
|
294
|
+
same disposed client, so every call after the first test would be cancelled.
|
|
295
|
+
Measured, not only read: a scratch variant that hands the module-scope client
|
|
296
|
+
to `ReactorProvider` (`client={() => (shared ??= createClient(...))}`, the
|
|
297
|
+
rest as the `reference`) type-checks clean and fails 30 of the 32 hidden
|
|
298
|
+
tests; only the first test that renders it and one that sends nothing pass.
|
|
299
|
+
The provider keeps the disposed client without a word, so an agent that
|
|
300
|
+
writes this sees no error, only a wallet that stops calling.
|
|
301
|
+
The variant therefore renders `QueryClientProvider` with
|
|
302
|
+
`shared.queryClient`, passes `shared` to the view, reads
|
|
303
|
+
`useSyncExternalStore(shared.subscribe, shared.authState)`, and its buttons
|
|
304
|
+
call `shared.signIn()` and `shared.signOut()`. All of these are the public
|
|
305
|
+
`Client` API. This is the one place a v4 React app that keeps v3's
|
|
306
|
+
module-scope idiom cannot use `useClient`/`useAuth`; the guide should say so
|
|
307
|
+
if it shows a module-scope client at all.
|
|
308
|
+
|
|
309
|
+
_Update (#805, IR6):_ `ReactorProvider` now disposes only a client its own
|
|
310
|
+
factory call created. A client created before the factory runs, such as
|
|
311
|
+
`const shared = createClient(...)` at module scope passed as
|
|
312
|
+
`client={() => shared}`, is borrowed and never disposed by the provider, so
|
|
313
|
+
that idiom can use `useClient`/`useAuth`. The lazy form measured above,
|
|
314
|
+
`client={() => (shared ??= createClient(...))}`, still creates the client
|
|
315
|
+
during the first provider's factory call, so that provider owns and disposes
|
|
316
|
+
it; the provider logs a development error when a later factory hands it back.
|
|
317
|
+
The variant keeps its provider-free shape, which is still correct.
|
|
318
|
+
|
|
319
|
+
This is a library behaviour, not a port decision, so it went to the lead as
|
|
320
|
+
an open question (#780 for the provider, DX3 #785 for the guide); no
|
|
321
|
+
`packages/**` change was made here. Two paths lead to it, both in
|
|
322
|
+
`ReactorProvider` (`packages/react/src/index.tsx`). A later tree's provider
|
|
323
|
+
cannot cancel the earlier tree's pending disposal, which is held per
|
|
324
|
+
provider instance, so the earlier tree's timer disposes the shared client
|
|
325
|
+
under the later tree. And once the client is disposed, a provider that
|
|
326
|
+
mounts with it takes the path meant for a re-shown `Activity`: it calls the
|
|
327
|
+
factory again, gets the same disposed client back, and keeps it, without an
|
|
328
|
+
error or a warning. Whether the provider should throw or warn when its factory
|
|
329
|
+
returns a client it has disposed, or refuse a client it did not build, is
|
|
330
|
+
the lead's call; until then the guide must not show a module-scope client
|
|
331
|
+
handed to `ReactorProvider`.
|
|
332
|
+
|
|
333
|
+
### `faulty/v4-retry-spread` (from `v4-proto-retry-spread`)
|
|
334
|
+
|
|
335
|
+
`useMutation({ ...client.mutationOptions(ledger, "icrc1_transfer"), retry: 3 })`.
|
|
336
|
+
Still compiles (the known hole, Q9 and D36; #782 criterion 13 pins it).
|
|
337
|
+
TanStack then re-sends every rejected transfer, including after a lost
|
|
338
|
+
reply. Expected failures: `canister_err_not_resent`,
|
|
339
|
+
`reject_code_4_not_resent`, `reject_code_5_not_resent`,
|
|
340
|
+
`lost_reply_not_resent`, `lost_reply_is_unknown`,
|
|
341
|
+
`lost_reply_rereads_balance`. _As ported:_ fails exactly these. The bug text
|
|
342
|
+
now says that the spread overrides the options' `retry: false` (v4-proto's
|
|
343
|
+
options had no `retry` at all).
|
|
344
|
+
|
|
345
|
+
### `faulty/v4-keep-previous-data` (from `v4-proto-keep-previous-data`)
|
|
346
|
+
|
|
347
|
+
`useQuery({ ...client.queryOptions(ledger, "icrc1_balance_of", ...),
|
|
348
|
+
placeholderData: keepPreviousData })` (`keepPreviousData` from
|
|
349
|
+
`@tanstack/react-query`). Also a recorded hole (#782 criterion 13). Expected
|
|
350
|
+
failure: `no_stale_balance_after_identity_switch`. v4's cancellation of a
|
|
351
|
+
read whose principal is no longer current (D20) may change which stale-balance
|
|
352
|
+
tests fail; if it does, record why (rules above). _As ported:_ fails exactly
|
|
353
|
+
this; D20 changed nothing. The in-flight switch test still passes, because
|
|
354
|
+
`keepPreviousData` shows the data of the key the observer last held, and the
|
|
355
|
+
observer moved to the new principal's key before the old principal's read
|
|
356
|
+
landed: there was no previous data to keep. After sign-in and sign-out the
|
|
357
|
+
previous key is the skipped read's, which holds none either.
|
|
358
|
+
|
|
359
|
+
### `faulty/v4-every-reject-unknown` (from `v4-proto-every-reject-unknown`)
|
|
360
|
+
|
|
361
|
+
`transfer.error.mayHaveExecuted || transfer.error.kind === "rejected"` in the
|
|
362
|
+
`state` rule. v4 classifies reject codes 1 and 3 as `rejected` with
|
|
363
|
+
`mayHaveExecuted: false` and code 2 as `not_delivered` (IR3 #775), as
|
|
364
|
+
v4-proto did. Expected failures: `reject_code_1_is_error`,
|
|
365
|
+
`reject_code_3_is_error`. _As ported:_ fails exactly these.
|
|
366
|
+
|
|
367
|
+
### `faulty/v4-status-not-idle` (from `v4-proto-status-not-idle`)
|
|
368
|
+
|
|
369
|
+
`: transfer.status === "idle" ? "" : transfer.status` in the `state` rule.
|
|
370
|
+
UI only, unaffected by the library. Expected failure: `status_starts_idle`.
|
|
371
|
+
_As ported:_ fails exactly this.
|
|
372
|
+
|
|
373
|
+
## After the port
|
|
374
|
+
|
|
375
|
+
- README: the gate line is 56/56 and the faulty-solution table has the
|
|
376
|
+
seven `v4-` rows. The conditions table's `v4` word count stays the
|
|
377
|
+
placeholder's until DX3's guide is packed.
|
|
378
|
+
- `node harness/check-docs.mjs` (its default list includes
|
|
379
|
+
`conditions/v4/docs/llms.txt`) and `node setup.mjs` must pass again with
|
|
380
|
+
DX3's guide in the packed core tarball, and `node gate.mjs --require v4`
|
|
381
|
+
must be run again on the commit under test: the references do not read
|
|
382
|
+
the guide, but they do run against the packed packages.
|
|
383
|
+
- PREREGISTRATION.md Addendum 3 is frozen (its conditions are listed there)
|
|
384
|
+
before any v4 agent run.
|