From ea30e472b614bbd41299269da6be315a75b3505d Mon Sep 17 00:00:00 2001 From: Kai Peacock Date: Fri, 11 Oct 2024 12:34:34 -0700 Subject: [PATCH] fix: trap and throw handling in v3 sync call --- docs/CHANGELOG.md | 12 + e2e/node/basic/trap.test.ts | 36 +- package-lock.json | 1707 +++++++++++++++++++++--- packages/agent/src/actor.ts | 42 +- packages/agent/src/agent/api.ts | 18 +- packages/agent/src/agent/http/index.ts | 11 +- 6 files changed, 1607 insertions(+), 219 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index c63cf0dd..f03b1b9e 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -4,6 +4,18 @@ ## [2.1.2] - 2024-09-30 - fix: revert https://github.com/dfinity/agent-js/pull/923 allow option to set agent replica time +- fix: handle v3 traps correctly, pulling the reject_code and message from the certificate in the error response like v2. +Example trap error message: +```txt +AgentError: Call failed: + Canister: hbrpn-74aaa-aaaaa-qaaxq-cai + Method: Throw (update) + "Request ID": "ae107dfd7c9be168a8ebc122d904900a95e3f15312111d9e0c08f136573c5f13" + "Error code": "IC0406" + "Reject code": "4" + "Reject message": "foo" +``` +- feat: the `UpdateCallRejected` error now exposes `reject_code: ReplicaRejectCode`, `reject_message: string`, and `error_code?: string` properties directly on the error object. ## [2.1.1] - 2024-09-13 diff --git a/e2e/node/basic/trap.test.ts b/e2e/node/basic/trap.test.ts index 1066b4c7..d6bee77e 100644 --- a/e2e/node/basic/trap.test.ts +++ b/e2e/node/basic/trap.test.ts @@ -1,5 +1,10 @@ import { describe, it, expect } from 'vitest'; -import { ActorMethod, Actor } from '@dfinity/agent'; +import { ActorMethod, Actor, HttpAgent } from '@dfinity/agent'; +import util from 'util'; +import exec from 'child_process'; +const execAsync = util.promisify(exec.exec); + +const { stdout } = await execAsync('dfx canister id trap'); export const idlFactory = ({ IDL }) => { return IDL.Service({ @@ -15,9 +20,30 @@ export interface _SERVICE { describe('trap', () => { it('should trap', async () => { - const actor = createActor<_SERVICE>(idlFactory, canisterId); - const result = await actor.Throw(); - - expect(result).toBeUndefined(); + const canisterId = stdout.trim(); + const agent = await HttpAgent.create({ + host: 'http://localhost:4943', + shouldFetchRootKey: true, + }); + const actor = Actor.createActor<_SERVICE>(idlFactory, { canisterId, agent }); + try { + await actor.Throw(); + } catch (error) { + console.log(error); + expect(error.reject_message).toBe('foo'); + } + }); + it('should trap', async () => { + const canisterId = stdout.trim(); + const agent = await HttpAgent.create({ + host: 'http://localhost:4943', + shouldFetchRootKey: true, + }); + const actor = Actor.createActor<_SERVICE>(idlFactory, { canisterId, agent }); + try { + await actor.test(); + } catch (error) { + expect(error.reject_message).toContain('Canister called `ic0.trap` with message: trapping'); + } }); }); diff --git a/package-lock.json b/package-lock.json index bd59a7d4..3c987086 100644 --- a/package-lock.json +++ b/package-lock.json @@ -72,7 +72,6 @@ "whatwg-fetch": "^3.6.2" }, "devDependencies": { - "@hadronous/pic": "^0.8.1", "@peculiar/webcrypto": "^1.4.0", "@tsconfig/node16": "^1.0.3", "@tsconfig/node17": "^1.0.1", @@ -105,23 +104,6 @@ "@dfinity/principal": "^1.4.0" } }, - "e2e/node/node_modules/@hadronous/pic": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@hadronous/pic/-/pic-0.8.1.tgz", - "integrity": "sha512-f7udej5rsmiqQ4Yq8P8+mOqOQe5boVk8UhYAyZcRHvcxChC9x2jKeEYjdM3+w2vmbmCp9a/Ze/iHxFbIK8Jvrw==", - "dev": true, - "hasInstallScript": true, - "license": "Apache-2.0", - "dependencies": { - "bip39": "^3.1.0" - }, - "peerDependencies": { - "@dfinity/agent": "^1.0.1", - "@dfinity/candid": "^1.0.1", - "@dfinity/identity": "^1.0.1", - "@dfinity/principal": "^1.0.1" - } - }, "e2e/node/node_modules/@typescript-eslint/eslint-plugin": { "version": "5.62.0", "dev": true, @@ -2389,6 +2371,10 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, + "node_modules/@dfinity/agent": { + "resolved": "packages/agent", + "link": true + }, "node_modules/@dfinity/assets": { "resolved": "packages/assets", "link": true @@ -2397,10 +2383,22 @@ "resolved": "packages/auth-client", "link": true }, + "node_modules/@dfinity/candid": { + "resolved": "packages/candid", + "link": true + }, + "node_modules/@dfinity/identity": { + "resolved": "packages/identity", + "link": true + }, "node_modules/@dfinity/identity-secp256k1": { "resolved": "packages/identity-secp256k1", "link": true }, + "node_modules/@dfinity/principal": { + "resolved": "packages/principal", + "link": true + }, "node_modules/@dfinity/use-auth-client": { "resolved": "packages/use-auth-client", "link": true @@ -5610,16 +5608,6 @@ "file-uri-to-path": "1.0.0" } }, - "node_modules/bip39": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/bip39/-/bip39-3.1.0.tgz", - "integrity": "sha512-c9kiwdk45Do5GL0vJMe7tS95VjCii65mYAH7DfWl3uW8AVzXKQVUm64i3hzVybBDMp9r7j9iNxR85+ul8MdN/A==", - "dev": true, - "license": "ISC", - "dependencies": { - "@noble/hashes": "^1.2.0" - } - }, "node_modules/bl": { "version": "5.1.0", "dev": true, @@ -7046,6 +7034,14 @@ "node": ">=0.3.1" } }, + "node_modules/diff-sequences": { + "version": "27.5.1", + "dev": true, + "license": "MIT", + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, "node_modules/dir-glob": { "version": "3.0.1", "dev": true, @@ -9142,6 +9138,11 @@ "version": "7.1.1", "license": "ISC" }, + "node_modules/idb-keyval": { + "version": "6.2.1", + "dev": true, + "license": "Apache-2.0" + }, "node_modules/ieee754": { "version": "1.2.1", "funding": [ @@ -10338,6 +10339,57 @@ } } }, + "node_modules/jest-diff": { + "version": "27.5.1", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^27.5.1", + "jest-get-type": "^27.5.1", + "pretty-format": "^27.5.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-diff/node_modules/ansi-styles": { + "version": "5.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-diff/node_modules/jest-get-type": { + "version": "27.5.1", + "dev": true, + "license": "MIT", + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-diff/node_modules/pretty-format": { + "version": "27.5.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^17.0.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-diff/node_modules/react-is": { + "version": "17.0.2", + "dev": true, + "license": "MIT" + }, "node_modules/jest-docblock": { "version": "29.7.0", "dev": true, @@ -17332,35 +17384,42 @@ "@types/node": ">=20" } }, - "packages/assets": { - "name": "@dfinity/assets", + "packages/agent": { + "name": "@dfinity/agent", "version": "2.1.2", "license": "Apache-2.0", "dependencies": { - "base64-arraybuffer": "^1.0.2", - "mime": "^3.0.0" + "@noble/curves": "^1.4.0", + "@noble/hashes": "^1.3.1", + "base64-arraybuffer": "^0.2.0", + "borc": "^2.1.1", + "buffer": "^6.0.3", + "simple-cbor": "^0.4.1" }, "devDependencies": { - "@peculiar/webcrypto": "^1.4.0", + "@peculiar/webcrypto": "^1.4.3", "@types/jest": "^29.5.5", - "@types/mime": "^2.0.3", "@typescript-eslint/eslint-plugin": "^5.30.5", "@typescript-eslint/parser": "^5.30.5", - "@web-std/file": "^3.0.2", "esbuild": "^0.15.16", "eslint": "^8.19.0", + "isomorphic-fetch": "^3.0.0", "jest": "^29.7.0", "size-limit": "^8.2.6", - "typedoc": "^0.22.11" + "text-encoding": "^0.7.0", + "ts-node": "^10.8.2", + "typedoc": "^0.22.11", + "whatwg-fetch": "^3.0.0" }, "peerDependencies": { - "@dfinity/agent": "^2.1.2", - "@dfinity/principal": "^2.1.2", - "@noble/hashes": "^1.3.1" + "@dfinity/candid": "^2.1.2", + "@dfinity/principal": "^2.1.2" } }, - "packages/assets/node_modules/@typescript-eslint/eslint-plugin": { + "packages/agent/node_modules/@typescript-eslint/eslint-plugin": { "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.62.0.tgz", + "integrity": "sha512-TiZzBSJja/LbhNPvk6yc0JrX9XqhQ0hdh6M2svYfsHGejaKFIAGd9MQ+ERIMzLGlN/kZoYIgdxFV0PuljTKXag==", "dev": true, "license": "MIT", "dependencies": { @@ -17392,8 +17451,10 @@ } } }, - "packages/assets/node_modules/@typescript-eslint/parser": { + "packages/agent/node_modules/@typescript-eslint/parser": { "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.62.0.tgz", + "integrity": "sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==", "dev": true, "license": "BSD-2-Clause", "dependencies": { @@ -17418,8 +17479,10 @@ } } }, - "packages/assets/node_modules/@typescript-eslint/utils": { + "packages/agent/node_modules/@typescript-eslint/utils": { "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.62.0.tgz", + "integrity": "sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ==", "dev": true, "license": "MIT", "dependencies": { @@ -17443,23 +17506,20 @@ "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, - "packages/assets/node_modules/base64-arraybuffer": { - "version": "1.0.2", - "license": "MIT", - "engines": { - "node": ">= 0.6.0" - } - }, - "packages/assets/node_modules/brace-expansion": { + "packages/agent/node_modules/brace-expansion": { "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^1.0.0" } }, - "packages/assets/node_modules/eslint": { + "packages/agent/node_modules/eslint": { "version": "8.57.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", + "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", "dev": true, "license": "MIT", "dependencies": { @@ -17512,17 +17572,10 @@ "url": "https://opencollective.com/eslint" } }, - "packages/assets/node_modules/eslint/node_modules/brace-expansion": { - "version": "1.1.11", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "packages/assets/node_modules/eslint/node_modules/eslint-scope": { + "packages/agent/node_modules/eslint/node_modules/eslint-scope": { "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", "dev": true, "license": "BSD-2-Clause", "dependencies": { @@ -17536,27 +17589,21 @@ "url": "https://opencollective.com/eslint" } }, - "packages/assets/node_modules/eslint/node_modules/minimatch": { - "version": "3.1.2", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "packages/assets/node_modules/estraverse": { + "packages/agent/node_modules/estraverse": { "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, "license": "BSD-2-Clause", "engines": { "node": ">=4.0" } }, - "packages/assets/node_modules/glob": { + "packages/agent/node_modules/glob": { "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, "license": "ISC", "dependencies": { @@ -17573,8 +17620,10 @@ "url": "https://github.com/sponsors/isaacs" } }, - "packages/assets/node_modules/glob-parent": { + "packages/agent/node_modules/glob-parent": { "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", "dev": true, "license": "ISC", "dependencies": { @@ -17584,8 +17633,10 @@ "node": ">=10.13.0" } }, - "packages/assets/node_modules/minimatch": { + "packages/agent/node_modules/glob/node_modules/minimatch": { "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", "dev": true, "license": "ISC", "dependencies": { @@ -17595,8 +17646,10 @@ "node": ">=10" } }, - "packages/assets/node_modules/shiki": { + "packages/agent/node_modules/shiki": { "version": "0.10.1", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.10.1.tgz", + "integrity": "sha512-VsY7QJVzU51j5o1+DguUd+6vmCmZ5v/6gYu4vyYAhzjuNQU6P/vmSy4uQaOhvje031qQMiW0d2BwgMH52vqMng==", "dev": true, "license": "MIT", "dependencies": { @@ -17605,8 +17658,10 @@ "vscode-textmate": "5.2.0" } }, - "packages/assets/node_modules/size-limit": { + "packages/agent/node_modules/size-limit": { "version": "8.2.6", + "resolved": "https://registry.npmjs.org/size-limit/-/size-limit-8.2.6.tgz", + "integrity": "sha512-zpznim/tX/NegjoQuRKgWTF4XiB0cn2qt90uJzxYNTFAqexk4b94DOAkBD3TwhC6c3kw2r0KcnA5upziVMZqDg==", "dev": true, "license": "MIT", "dependencies": { @@ -17624,8 +17679,10 @@ "node": "^14.0.0 || ^16.0.0 || >=18.0.0" } }, - "packages/assets/node_modules/typedoc": { + "packages/agent/node_modules/typedoc": { "version": "0.22.18", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.22.18.tgz", + "integrity": "sha512-NK9RlLhRUGMvc6Rw5USEYgT4DVAUFk7IF7Q6MYfpJ88KnTZP7EneEa4RcP+tX1auAcz7QT1Iy0bUSZBYYHdoyA==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -17645,8 +17702,23 @@ "typescript": "4.0.x || 4.1.x || 4.2.x || 4.3.x || 4.4.x || 4.5.x || 4.6.x || 4.7.x" } }, - "packages/assets/node_modules/typescript": { + "packages/agent/node_modules/typedoc/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "packages/agent/node_modules/typescript": { "version": "4.7.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", + "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", "dev": true, "license": "Apache-2.0", "peer": true, @@ -17658,37 +17730,34 @@ "node": ">=4.2.0" } }, - "packages/auth-client": { - "name": "@dfinity/auth-client", + "packages/assets": { + "name": "@dfinity/assets", "version": "2.1.2", "license": "Apache-2.0", "dependencies": { - "idb": "^7.0.2" + "base64-arraybuffer": "^1.0.2", + "mime": "^3.0.0" }, "devDependencies": { "@peculiar/webcrypto": "^1.4.0", "@types/jest": "^29.5.5", + "@types/mime": "^2.0.3", "@typescript-eslint/eslint-plugin": "^5.30.5", "@typescript-eslint/parser": "^5.30.5", + "@web-std/file": "^3.0.2", "esbuild": "^0.15.16", "eslint": "^8.19.0", - "fake-indexeddb": "^5.0.2", "jest": "^29.7.0", - "jest-environment-jsdom": "^29.7.0", "size-limit": "^8.2.6", - "stream": "^0.0.2", - "text-encoding": "^0.7.0", - "ts-node": "^10.8.2", - "typedoc": "^0.22.11", - "whatwg-fetch": "^3.0.0" + "typedoc": "^0.22.11" }, "peerDependencies": { "@dfinity/agent": "^2.1.2", - "@dfinity/identity": "^2.1.2", - "@dfinity/principal": "^2.1.2" + "@dfinity/principal": "^2.1.2", + "@noble/hashes": "^1.3.1" } }, - "packages/auth-client/node_modules/@typescript-eslint/eslint-plugin": { + "packages/assets/node_modules/@typescript-eslint/eslint-plugin": { "version": "5.62.0", "dev": true, "license": "MIT", @@ -17721,7 +17790,7 @@ } } }, - "packages/auth-client/node_modules/@typescript-eslint/parser": { + "packages/assets/node_modules/@typescript-eslint/parser": { "version": "5.62.0", "dev": true, "license": "BSD-2-Clause", @@ -17747,7 +17816,7 @@ } } }, - "packages/auth-client/node_modules/@typescript-eslint/utils": { + "packages/assets/node_modules/@typescript-eslint/utils": { "version": "5.62.0", "dev": true, "license": "MIT", @@ -17772,7 +17841,14 @@ "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, - "packages/auth-client/node_modules/brace-expansion": { + "packages/assets/node_modules/base64-arraybuffer": { + "version": "1.0.2", + "license": "MIT", + "engines": { + "node": ">= 0.6.0" + } + }, + "packages/assets/node_modules/brace-expansion": { "version": "2.0.1", "dev": true, "license": "MIT", @@ -17780,7 +17856,7 @@ "balanced-match": "^1.0.0" } }, - "packages/auth-client/node_modules/eslint": { + "packages/assets/node_modules/eslint": { "version": "8.57.0", "dev": true, "license": "MIT", @@ -17834,7 +17910,7 @@ "url": "https://opencollective.com/eslint" } }, - "packages/auth-client/node_modules/eslint/node_modules/brace-expansion": { + "packages/assets/node_modules/eslint/node_modules/brace-expansion": { "version": "1.1.11", "dev": true, "license": "MIT", @@ -17843,7 +17919,7 @@ "concat-map": "0.0.1" } }, - "packages/auth-client/node_modules/eslint/node_modules/eslint-scope": { + "packages/assets/node_modules/eslint/node_modules/eslint-scope": { "version": "7.2.2", "dev": true, "license": "BSD-2-Clause", @@ -17858,7 +17934,7 @@ "url": "https://opencollective.com/eslint" } }, - "packages/auth-client/node_modules/eslint/node_modules/minimatch": { + "packages/assets/node_modules/eslint/node_modules/minimatch": { "version": "3.1.2", "dev": true, "license": "ISC", @@ -17869,7 +17945,7 @@ "node": "*" } }, - "packages/auth-client/node_modules/estraverse": { + "packages/assets/node_modules/estraverse": { "version": "5.3.0", "dev": true, "license": "BSD-2-Clause", @@ -17877,7 +17953,7 @@ "node": ">=4.0" } }, - "packages/auth-client/node_modules/glob": { + "packages/assets/node_modules/glob": { "version": "8.1.0", "dev": true, "license": "ISC", @@ -17895,7 +17971,7 @@ "url": "https://github.com/sponsors/isaacs" } }, - "packages/auth-client/node_modules/glob-parent": { + "packages/assets/node_modules/glob-parent": { "version": "6.0.2", "dev": true, "license": "ISC", @@ -17906,7 +17982,7 @@ "node": ">=10.13.0" } }, - "packages/auth-client/node_modules/minimatch": { + "packages/assets/node_modules/minimatch": { "version": "5.1.6", "dev": true, "license": "ISC", @@ -17917,7 +17993,7 @@ "node": ">=10" } }, - "packages/auth-client/node_modules/shiki": { + "packages/assets/node_modules/shiki": { "version": "0.10.1", "dev": true, "license": "MIT", @@ -17927,7 +18003,7 @@ "vscode-textmate": "5.2.0" } }, - "packages/auth-client/node_modules/size-limit": { + "packages/assets/node_modules/size-limit": { "version": "8.2.6", "dev": true, "license": "MIT", @@ -17946,7 +18022,7 @@ "node": "^14.0.0 || ^16.0.0 || >=18.0.0" } }, - "packages/auth-client/node_modules/typedoc": { + "packages/assets/node_modules/typedoc": { "version": "0.22.18", "dev": true, "license": "Apache-2.0", @@ -17967,7 +18043,7 @@ "typescript": "4.0.x || 4.1.x || 4.2.x || 4.3.x || 4.4.x || 4.5.x || 4.6.x || 4.7.x" } }, - "packages/auth-client/node_modules/typescript": { + "packages/assets/node_modules/typescript": { "version": "4.7.4", "dev": true, "license": "Apache-2.0", @@ -17980,56 +18056,1349 @@ "node": ">=4.2.0" } }, - "packages/identity-secp256k1": { - "name": "@dfinity/identity-secp256k1", - "version": "2.1.2", - "license": "Apache-2.0", - "dependencies": { - "@dfinity/agent": "^2.1.2", - "@noble/curves": "^1.4.0", - "@noble/hashes": "^1.3.1", - "@scure/bip32": "^1.4.0", - "@scure/bip39": "^1.3.0", - "asn1js": "^3.0.5", - "bs58check": "^3.0.1" - } - }, - "packages/identity-secp256k1/node_modules/@dfinity/agent": { + "packages/auth-client": { + "name": "@dfinity/auth-client", "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@dfinity/agent/-/agent-2.1.2.tgz", - "integrity": "sha512-UAXf6uXovhBlSp245RWlA21zcCavy+vVUvKVQUpesk1gLJpJlvsCE6hYOwTeFZAP+bjmPi0Tl7cx8DT2KM4eDQ==", "license": "Apache-2.0", "dependencies": { - "@noble/curves": "^1.4.0", - "@noble/hashes": "^1.3.1", - "base64-arraybuffer": "^0.2.0", - "borc": "^2.1.1", - "buffer": "^6.0.3", - "simple-cbor": "^0.4.1" + "idb": "^7.0.2" + }, + "devDependencies": { + "@peculiar/webcrypto": "^1.4.0", + "@types/jest": "^29.5.5", + "@typescript-eslint/eslint-plugin": "^5.30.5", + "@typescript-eslint/parser": "^5.30.5", + "esbuild": "^0.15.16", + "eslint": "^8.19.0", + "fake-indexeddb": "^5.0.2", + "jest": "^29.7.0", + "jest-environment-jsdom": "^29.7.0", + "size-limit": "^8.2.6", + "stream": "^0.0.2", + "text-encoding": "^0.7.0", + "ts-node": "^10.8.2", + "typedoc": "^0.22.11", + "whatwg-fetch": "^3.0.0" }, "peerDependencies": { - "@dfinity/candid": "^2.1.2", + "@dfinity/agent": "^2.1.2", + "@dfinity/identity": "^2.1.2", "@dfinity/principal": "^2.1.2" } }, - "packages/identity-secp256k1/node_modules/@dfinity/candid": { + "packages/auth-client/node_modules/@typescript-eslint/eslint-plugin": { + "version": "5.62.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.4.0", + "@typescript-eslint/scope-manager": "5.62.0", + "@typescript-eslint/type-utils": "5.62.0", + "@typescript-eslint/utils": "5.62.0", + "debug": "^4.3.4", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "natural-compare-lite": "^1.4.0", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^5.0.0", + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "packages/auth-client/node_modules/@typescript-eslint/parser": { + "version": "5.62.0", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@typescript-eslint/scope-manager": "5.62.0", + "@typescript-eslint/types": "5.62.0", + "@typescript-eslint/typescript-estree": "5.62.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "packages/auth-client/node_modules/@typescript-eslint/utils": { + "version": "5.62.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@types/json-schema": "^7.0.9", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.62.0", + "@typescript-eslint/types": "5.62.0", + "@typescript-eslint/typescript-estree": "5.62.0", + "eslint-scope": "^5.1.1", + "semver": "^7.3.7" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "packages/auth-client/node_modules/brace-expansion": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "packages/auth-client/node_modules/eslint": { + "version": "8.57.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.57.0", + "@humanwhocodes/config-array": "^0.11.14", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "packages/auth-client/node_modules/eslint/node_modules/brace-expansion": { + "version": "1.1.11", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "packages/auth-client/node_modules/eslint/node_modules/eslint-scope": { + "version": "7.2.2", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "packages/auth-client/node_modules/eslint/node_modules/minimatch": { + "version": "3.1.2", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "packages/auth-client/node_modules/estraverse": { + "version": "5.3.0", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "packages/auth-client/node_modules/glob": { + "version": "8.1.0", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "packages/auth-client/node_modules/glob-parent": { + "version": "6.0.2", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "packages/auth-client/node_modules/minimatch": { + "version": "5.1.6", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "packages/auth-client/node_modules/shiki": { + "version": "0.10.1", + "dev": true, + "license": "MIT", + "dependencies": { + "jsonc-parser": "^3.0.0", + "vscode-oniguruma": "^1.6.1", + "vscode-textmate": "5.2.0" + } + }, + "packages/auth-client/node_modules/size-limit": { + "version": "8.2.6", + "dev": true, + "license": "MIT", + "dependencies": { + "bytes-iec": "^3.1.1", + "chokidar": "^3.5.3", + "globby": "^11.1.0", + "lilconfig": "^2.1.0", + "nanospinner": "^1.1.0", + "picocolors": "^1.0.0" + }, + "bin": { + "size-limit": "bin.js" + }, + "engines": { + "node": "^14.0.0 || ^16.0.0 || >=18.0.0" + } + }, + "packages/auth-client/node_modules/typedoc": { + "version": "0.22.18", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "glob": "^8.0.3", + "lunr": "^2.3.9", + "marked": "^4.0.16", + "minimatch": "^5.1.0", + "shiki": "^0.10.1" + }, + "bin": { + "typedoc": "bin/typedoc" + }, + "engines": { + "node": ">= 12.10.0" + }, + "peerDependencies": { + "typescript": "4.0.x || 4.1.x || 4.2.x || 4.3.x || 4.4.x || 4.5.x || 4.6.x || 4.7.x" + } + }, + "packages/auth-client/node_modules/typescript": { + "version": "4.7.4", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "packages/candid": { + "name": "@dfinity/candid", + "version": "2.1.2", + "license": "Apache-2.0", + "devDependencies": { + "@types/jest": "^29.5.5", + "@typescript-eslint/eslint-plugin": "^5.30.5", + "@typescript-eslint/parser": "^5.30.5", + "esbuild": "^0.15.16", + "eslint": "^8.19.0", + "jest": "^29.7.0", + "jest-diff": "^27.3.1", + "prettier": "^2.0.5", + "size-limit": "^8.2.6", + "text-encoding": "^0.7.0", + "ts-node": "^10.8.2", + "typedoc": "^0.22.11", + "whatwg-fetch": "^3.0.0" + }, + "peerDependencies": { + "@dfinity/principal": "^2.1.2" + } + }, + "packages/candid/node_modules/@typescript-eslint/eslint-plugin": { + "version": "5.62.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.4.0", + "@typescript-eslint/scope-manager": "5.62.0", + "@typescript-eslint/type-utils": "5.62.0", + "@typescript-eslint/utils": "5.62.0", + "debug": "^4.3.4", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "natural-compare-lite": "^1.4.0", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^5.0.0", + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "packages/candid/node_modules/@typescript-eslint/parser": { + "version": "5.62.0", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@typescript-eslint/scope-manager": "5.62.0", + "@typescript-eslint/types": "5.62.0", + "@typescript-eslint/typescript-estree": "5.62.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "packages/candid/node_modules/@typescript-eslint/utils": { + "version": "5.62.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@types/json-schema": "^7.0.9", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.62.0", + "@typescript-eslint/types": "5.62.0", + "@typescript-eslint/typescript-estree": "5.62.0", + "eslint-scope": "^5.1.1", + "semver": "^7.3.7" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "packages/candid/node_modules/brace-expansion": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "packages/candid/node_modules/eslint": { + "version": "8.57.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.57.0", + "@humanwhocodes/config-array": "^0.11.14", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "packages/candid/node_modules/eslint/node_modules/brace-expansion": { + "version": "1.1.11", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "packages/candid/node_modules/eslint/node_modules/eslint-scope": { + "version": "7.2.2", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "packages/candid/node_modules/eslint/node_modules/minimatch": { + "version": "3.1.2", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "packages/candid/node_modules/estraverse": { + "version": "5.3.0", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "packages/candid/node_modules/glob": { + "version": "8.1.0", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "packages/candid/node_modules/glob-parent": { + "version": "6.0.2", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "packages/candid/node_modules/minimatch": { + "version": "5.1.6", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "packages/candid/node_modules/prettier": { + "version": "2.8.8", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "packages/candid/node_modules/shiki": { + "version": "0.10.1", + "dev": true, + "license": "MIT", + "dependencies": { + "jsonc-parser": "^3.0.0", + "vscode-oniguruma": "^1.6.1", + "vscode-textmate": "5.2.0" + } + }, + "packages/candid/node_modules/size-limit": { + "version": "8.2.6", + "dev": true, + "license": "MIT", + "dependencies": { + "bytes-iec": "^3.1.1", + "chokidar": "^3.5.3", + "globby": "^11.1.0", + "lilconfig": "^2.1.0", + "nanospinner": "^1.1.0", + "picocolors": "^1.0.0" + }, + "bin": { + "size-limit": "bin.js" + }, + "engines": { + "node": "^14.0.0 || ^16.0.0 || >=18.0.0" + } + }, + "packages/candid/node_modules/typedoc": { + "version": "0.22.18", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "glob": "^8.0.3", + "lunr": "^2.3.9", + "marked": "^4.0.16", + "minimatch": "^5.1.0", + "shiki": "^0.10.1" + }, + "bin": { + "typedoc": "bin/typedoc" + }, + "engines": { + "node": ">= 12.10.0" + }, + "peerDependencies": { + "typescript": "4.0.x || 4.1.x || 4.2.x || 4.3.x || 4.4.x || 4.5.x || 4.6.x || 4.7.x" + } + }, + "packages/candid/node_modules/typescript": { + "version": "4.7.4", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "packages/identity": { + "name": "@dfinity/identity", + "version": "2.1.2", + "license": "Apache-2.0", + "dependencies": { + "@noble/curves": "^1.2.0", + "@noble/hashes": "^1.3.1", + "borc": "^2.1.1" + }, + "devDependencies": { + "@types/jest": "^29.5.5", + "@typescript-eslint/eslint-plugin": "^5.30.5", + "@typescript-eslint/parser": "^5.30.5", + "esbuild": "^0.15.16", + "eslint": "^8.19.0", + "idb-keyval": "^6.2.0", + "jest": "^29.7.0", + "size-limit": "^8.2.6", + "text-encoding": "^0.7.0", + "typedoc": "^0.22.11", + "whatwg-fetch": "^3.0.0" + }, + "peerDependencies": { + "@dfinity/agent": "^2.1.2", + "@dfinity/principal": "^2.1.2", + "@peculiar/webcrypto": "^1.4.0" + } + }, + "packages/identity-secp256k1": { + "name": "@dfinity/identity-secp256k1", + "version": "2.1.2", + "license": "Apache-2.0", + "dependencies": { + "@dfinity/agent": "^2.1.2", + "@noble/curves": "^1.4.0", + "@noble/hashes": "^1.3.1", + "@scure/bip32": "^1.4.0", + "@scure/bip39": "^1.3.0", + "asn1js": "^3.0.5", + "bs58check": "^3.0.1" + } + }, + "packages/identity/node_modules/@typescript-eslint/eslint-plugin": { + "version": "5.62.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.4.0", + "@typescript-eslint/scope-manager": "5.62.0", + "@typescript-eslint/type-utils": "5.62.0", + "@typescript-eslint/utils": "5.62.0", + "debug": "^4.3.4", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "natural-compare-lite": "^1.4.0", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^5.0.0", + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "packages/identity/node_modules/@typescript-eslint/parser": { + "version": "5.62.0", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@typescript-eslint/scope-manager": "5.62.0", + "@typescript-eslint/types": "5.62.0", + "@typescript-eslint/typescript-estree": "5.62.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "packages/identity/node_modules/@typescript-eslint/utils": { + "version": "5.62.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@types/json-schema": "^7.0.9", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.62.0", + "@typescript-eslint/types": "5.62.0", + "@typescript-eslint/typescript-estree": "5.62.0", + "eslint-scope": "^5.1.1", + "semver": "^7.3.7" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "packages/identity/node_modules/brace-expansion": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "packages/identity/node_modules/eslint": { + "version": "8.57.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.57.0", + "@humanwhocodes/config-array": "^0.11.14", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "packages/identity/node_modules/eslint/node_modules/brace-expansion": { + "version": "1.1.11", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "packages/identity/node_modules/eslint/node_modules/eslint-scope": { + "version": "7.2.2", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "packages/identity/node_modules/eslint/node_modules/minimatch": { + "version": "3.1.2", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "packages/identity/node_modules/estraverse": { + "version": "5.3.0", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "packages/identity/node_modules/glob": { + "version": "8.1.0", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "packages/identity/node_modules/glob-parent": { + "version": "6.0.2", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "packages/identity/node_modules/minimatch": { + "version": "5.1.6", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "packages/identity/node_modules/shiki": { + "version": "0.10.1", + "dev": true, + "license": "MIT", + "dependencies": { + "jsonc-parser": "^3.0.0", + "vscode-oniguruma": "^1.6.1", + "vscode-textmate": "5.2.0" + } + }, + "packages/identity/node_modules/size-limit": { + "version": "8.2.6", + "dev": true, + "license": "MIT", + "dependencies": { + "bytes-iec": "^3.1.1", + "chokidar": "^3.5.3", + "globby": "^11.1.0", + "lilconfig": "^2.1.0", + "nanospinner": "^1.1.0", + "picocolors": "^1.0.0" + }, + "bin": { + "size-limit": "bin.js" + }, + "engines": { + "node": "^14.0.0 || ^16.0.0 || >=18.0.0" + } + }, + "packages/identity/node_modules/typedoc": { + "version": "0.22.18", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "glob": "^8.0.3", + "lunr": "^2.3.9", + "marked": "^4.0.16", + "minimatch": "^5.1.0", + "shiki": "^0.10.1" + }, + "bin": { + "typedoc": "bin/typedoc" + }, + "engines": { + "node": ">= 12.10.0" + }, + "peerDependencies": { + "typescript": "4.0.x || 4.1.x || 4.2.x || 4.3.x || 4.4.x || 4.5.x || 4.6.x || 4.7.x" + } + }, + "packages/identity/node_modules/typescript": { + "version": "4.7.4", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "packages/principal": { + "name": "@dfinity/principal", "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@dfinity/candid/-/candid-2.1.2.tgz", - "integrity": "sha512-do69J9iahW2tlmbPdbmc8MDhi5cfIQyTcAlYqaSOOAyg+Kp8beCnW7mletXVfx30dyVlpkyCrYOXhbpQuSCKtw==", "license": "Apache-2.0", - "peer": true, + "dependencies": { + "@noble/hashes": "^1.3.1" + }, + "devDependencies": { + "@dfinity/utils": "^2.0.0", + "@types/jest": "^29.5.5", + "@typescript-eslint/eslint-plugin": "^5.30.5", + "@typescript-eslint/parser": "^5.30.5", + "esbuild": "^0.15.16", + "eslint": "^8.19.0", + "jest": "^29.7.0", + "size-limit": "^8.2.6", + "text-encoding": "^0.7.0", + "ts-node": "^10.8.2", + "typedoc": "^0.22.11", + "whatwg-fetch": "^3.0.0" + } + }, + "packages/principal/node_modules/@dfinity/agent": { + "version": "1.4.0", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "@noble/curves": "^1.4.0", + "@noble/hashes": "^1.3.1", + "base64-arraybuffer": "^0.2.0", + "borc": "^2.1.1", + "buffer": "^6.0.3", + "simple-cbor": "^0.4.1" + }, + "peerDependencies": { + "@dfinity/candid": "^1.4.0", + "@dfinity/principal": "^1.4.0" + } + }, + "packages/principal/node_modules/@dfinity/candid": { + "version": "1.4.0", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "peerDependencies": { + "@dfinity/principal": "^1.4.0" + } + }, + "packages/principal/node_modules/@dfinity/principal": { + "version": "1.4.0", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "@noble/hashes": "^1.3.1" + } + }, + "packages/principal/node_modules/@dfinity/utils": { + "version": "2.4.0", + "dev": true, + "license": "Apache-2.0", + "peerDependencies": { + "@dfinity/agent": "^1.4.0", + "@dfinity/candid": "^1.4.0", + "@dfinity/principal": "^1.4.0" + } + }, + "packages/principal/node_modules/@typescript-eslint/eslint-plugin": { + "version": "5.62.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.4.0", + "@typescript-eslint/scope-manager": "5.62.0", + "@typescript-eslint/type-utils": "5.62.0", + "@typescript-eslint/utils": "5.62.0", + "debug": "^4.3.4", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "natural-compare-lite": "^1.4.0", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^5.0.0", + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "packages/principal/node_modules/@typescript-eslint/parser": { + "version": "5.62.0", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@typescript-eslint/scope-manager": "5.62.0", + "@typescript-eslint/types": "5.62.0", + "@typescript-eslint/typescript-estree": "5.62.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "packages/principal/node_modules/@typescript-eslint/utils": { + "version": "5.62.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@types/json-schema": "^7.0.9", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.62.0", + "@typescript-eslint/types": "5.62.0", + "@typescript-eslint/typescript-estree": "5.62.0", + "eslint-scope": "^5.1.1", + "semver": "^7.3.7" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "packages/principal/node_modules/brace-expansion": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "packages/principal/node_modules/eslint": { + "version": "8.57.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.57.0", + "@humanwhocodes/config-array": "^0.11.14", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "packages/principal/node_modules/eslint/node_modules/brace-expansion": { + "version": "1.1.11", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "packages/principal/node_modules/eslint/node_modules/eslint-scope": { + "version": "7.2.2", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "packages/principal/node_modules/eslint/node_modules/minimatch": { + "version": "3.1.2", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "packages/principal/node_modules/estraverse": { + "version": "5.3.0", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "packages/principal/node_modules/glob": { + "version": "8.1.0", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "packages/principal/node_modules/glob-parent": { + "version": "6.0.2", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "packages/principal/node_modules/minimatch": { + "version": "5.1.6", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "packages/principal/node_modules/shiki": { + "version": "0.10.1", + "dev": true, + "license": "MIT", + "dependencies": { + "jsonc-parser": "^3.0.0", + "vscode-oniguruma": "^1.6.1", + "vscode-textmate": "5.2.0" + } + }, + "packages/principal/node_modules/size-limit": { + "version": "8.2.6", + "dev": true, + "license": "MIT", + "dependencies": { + "bytes-iec": "^3.1.1", + "chokidar": "^3.5.3", + "globby": "^11.1.0", + "lilconfig": "^2.1.0", + "nanospinner": "^1.1.0", + "picocolors": "^1.0.0" + }, + "bin": { + "size-limit": "bin.js" + }, + "engines": { + "node": "^14.0.0 || ^16.0.0 || >=18.0.0" + } + }, + "packages/principal/node_modules/typedoc": { + "version": "0.22.18", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "glob": "^8.0.3", + "lunr": "^2.3.9", + "marked": "^4.0.16", + "minimatch": "^5.1.0", + "shiki": "^0.10.1" + }, + "bin": { + "typedoc": "bin/typedoc" + }, + "engines": { + "node": ">= 12.10.0" + }, "peerDependencies": { - "@dfinity/principal": "^2.1.2" + "typescript": "4.0.x || 4.1.x || 4.2.x || 4.3.x || 4.4.x || 4.5.x || 4.6.x || 4.7.x" } }, - "packages/identity-secp256k1/node_modules/@dfinity/principal": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@dfinity/principal/-/principal-2.1.2.tgz", - "integrity": "sha512-L3Y0nDjquqNFseM2Gx5fI4GOUKjjezFr9/6ZjSwAFeDeb4Ubqld4ZKL3FEzv4QKNbfZgCx19b7UXi+OdmLhi4w==", + "packages/principal/node_modules/typescript": { + "version": "4.7.4", + "dev": true, "license": "Apache-2.0", "peer": true, - "dependencies": { - "@noble/hashes": "^1.3.1" + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" } }, "packages/use-auth-client": { @@ -18063,58 +19432,6 @@ "@rollup/rollup-linux-x64-gnu": "4.6.1" } }, - "packages/use-auth-client/node_modules/@dfinity/agent": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@dfinity/agent/-/agent-2.1.2.tgz", - "integrity": "sha512-UAXf6uXovhBlSp245RWlA21zcCavy+vVUvKVQUpesk1gLJpJlvsCE6hYOwTeFZAP+bjmPi0Tl7cx8DT2KM4eDQ==", - "license": "Apache-2.0", - "dependencies": { - "@noble/curves": "^1.4.0", - "@noble/hashes": "^1.3.1", - "base64-arraybuffer": "^0.2.0", - "borc": "^2.1.1", - "buffer": "^6.0.3", - "simple-cbor": "^0.4.1" - }, - "peerDependencies": { - "@dfinity/candid": "^2.1.2", - "@dfinity/principal": "^2.1.2" - } - }, - "packages/use-auth-client/node_modules/@dfinity/candid": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@dfinity/candid/-/candid-2.1.2.tgz", - "integrity": "sha512-do69J9iahW2tlmbPdbmc8MDhi5cfIQyTcAlYqaSOOAyg+Kp8beCnW7mletXVfx30dyVlpkyCrYOXhbpQuSCKtw==", - "license": "Apache-2.0", - "peerDependencies": { - "@dfinity/principal": "^2.1.2" - } - }, - "packages/use-auth-client/node_modules/@dfinity/identity": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@dfinity/identity/-/identity-2.1.2.tgz", - "integrity": "sha512-LgskXJzyqm1UVsobAkF8bL1/SdLKFYW2kTIsKw7UOhuBy/COpnf3HZYmKeFCnxvharyIyq23W3WBhIpu9FeAvw==", - "license": "Apache-2.0", - "dependencies": { - "@noble/curves": "^1.2.0", - "@noble/hashes": "^1.3.1", - "borc": "^2.1.1" - }, - "peerDependencies": { - "@dfinity/agent": "^2.1.2", - "@dfinity/principal": "^2.1.2", - "@peculiar/webcrypto": "^1.4.0" - } - }, - "packages/use-auth-client/node_modules/@dfinity/principal": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@dfinity/principal/-/principal-2.1.2.tgz", - "integrity": "sha512-L3Y0nDjquqNFseM2Gx5fI4GOUKjjezFr9/6ZjSwAFeDeb4Ubqld4ZKL3FEzv4QKNbfZgCx19b7UXi+OdmLhi4w==", - "license": "Apache-2.0", - "dependencies": { - "@noble/hashes": "^1.3.1" - } - }, "packages/use-auth-client/node_modules/@vitest/expect": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-2.0.5.tgz", diff --git a/packages/agent/src/actor.ts b/packages/agent/src/actor.ts index 7898cdb5..72ed8c8e 100644 --- a/packages/agent/src/actor.ts +++ b/packages/agent/src/actor.ts @@ -7,6 +7,7 @@ import { QueryResponseStatus, ReplicaRejectCode, SubmitResponse, + v3ResponseBody, } from './agent'; import { AgentError } from './errors'; import { bufFromBufLike, IDL } from '@dfinity/candid'; @@ -56,18 +57,21 @@ export class UpdateCallRejectedError extends ActorCallError { methodName: string, public readonly requestId: RequestId, public readonly response: SubmitResponse['response'], + public readonly reject_code: ReplicaRejectCode, + public readonly reject_message: string, + public readonly error_code?: string, ) { super(canisterId, methodName, 'update', { 'Request ID': toHex(requestId), ...(response.body ? { - ...(response.body.error_code + ...(error_code ? { - 'Error code': response.body.error_code, + 'Error code': error_code, } : {}), - 'Reject code': String(response.body.reject_code), - 'Reject message': response.body.reject_message, + 'Reject code': String(reject_code), + 'Reject message': reject_message, } : { 'HTTP status code': response.status.toString(), @@ -535,8 +539,8 @@ function _createActorMethod( }); let reply: ArrayBuffer | undefined; let certificate: Certificate | undefined; - if (response.body && response.body.certificate) { - const cert = response.body.certificate; + if (response.body && (response.body as v3ResponseBody).certificate) { + const cert = (response.body as v3ResponseBody).certificate; certificate = await Certificate.create({ certificate: bufFromBufLike(cert), rootKey: agent.rootKey, @@ -552,8 +556,30 @@ function _createActorMethod( case 'replied': reply = lookupResultToBuffer(certificate.lookup([...path, 'reply'])); break; - case 'rejected': - throw new UpdateCallRejectedError(cid, methodName, requestId, response); + case 'rejected': { + // Find rejection details in the certificate + const rejectCode = new Uint8Array( + lookupResultToBuffer(certificate.lookup([...path, 'reject_code']))!, + )[0]; + const rejectMessage = new TextDecoder().decode( + lookupResultToBuffer(certificate.lookup([...path, 'reject_message']))!, + ); + const error_code_buf = lookupResultToBuffer( + certificate.lookup([...path, 'error_code']), + ); + const error_code = error_code_buf + ? new TextDecoder().decode(error_code_buf) + : undefined; + throw new UpdateCallRejectedError( + cid, + methodName, + requestId, + response, + rejectCode, + rejectMessage, + error_code, + ); + } } } // Fall back to polling if we receive an Accepted response code diff --git a/packages/agent/src/agent/api.ts b/packages/agent/src/agent/api.ts index b11bd1e4..b521116b 100644 --- a/packages/agent/src/agent/api.ts +++ b/packages/agent/src/agent/api.ts @@ -121,19 +121,23 @@ export interface ReadStateResponse { certificate: ArrayBuffer; } +export interface v2ResponseBody { + error_code?: string; + reject_code: number; + reject_message: string; +} + +export interface v3ResponseBody { + certificate: ArrayBuffer; +} + export interface SubmitResponse { requestId: RequestId; response: { ok: boolean; status: number; statusText: string; - body: { - error_code?: string; - reject_code: number; - reject_message: string; - // Available in a v3 call response - certificate?: ArrayBuffer; - } | null; + body: v2ResponseBody | v3ResponseBody | null; headers: HttpHeaderField[]; }; requestDetails?: CallRequest; diff --git a/packages/agent/src/agent/http/index.ts b/packages/agent/src/agent/http/index.ts index 067cbe9e..0dea08bc 100644 --- a/packages/agent/src/agent/http/index.ts +++ b/packages/agent/src/agent/http/index.ts @@ -13,6 +13,7 @@ import { ReadStateOptions, ReadStateResponse, SubmitResponse, + v3ResponseBody, } from '../api'; import { Expiry, httpHeadersTransform, makeNonceTransform } from './transforms'; import { @@ -414,8 +415,9 @@ export class HttpAgent implements Agent { }, identity?: Identity | Promise, ): Promise { + // TODO - restore this value const callSync = options.callSync ?? true; - const id = await (identity !== undefined ? await identity : await this.#identity); + const id = await(identity !== undefined ? await identity : await this.#identity); if (!id) { throw new IdentityInvalidError( "This identity has expired due this application's security policy. Please refresh your authentication.", @@ -499,7 +501,6 @@ export class HttpAgent implements Agent { }); }; - const request = this.#requestAndRetry({ request: callSync ? requestSync : requestAsync, backoff, @@ -516,8 +517,10 @@ export class HttpAgent implements Agent { ) as SubmitResponse['response']['body']; // Update the watermark with the latest time from consensus - if (responseBody?.certificate) { - const time = await this.parseTimeFromResponse({ certificate: responseBody.certificate }); + if (responseBody && 'certificate' in (responseBody as v3ResponseBody)) { + const time = await this.parseTimeFromResponse({ + certificate: (responseBody as v3ResponseBody).certificate, + }); this.#waterMark = time; }