diff --git a/dfinity-candid-3.0.0-patch.tgz b/dfinity-candid-3.0.0-patch.tgz new file mode 100644 index 0000000..285b496 Binary files /dev/null and b/dfinity-candid-3.0.0-patch.tgz differ diff --git a/idl_instance_1/package-lock.json b/idl_instance_1/package-lock.json index 01ddabe..6cce7a6 100644 --- a/idl_instance_1/package-lock.json +++ b/idl_instance_1/package-lock.json @@ -6,32 +6,32 @@ "packages": { "": { "dependencies": { - "@dfinity/candid": "^2.3.0" + "@dfinity/candid": "file:../dfinity-candid-3.0.0-patch.tgz" } }, "node_modules/@dfinity/candid": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@dfinity/candid/-/candid-2.3.0.tgz", - "integrity": "sha512-Xzj3EWfwaVZy90jq6WBRP4Cyqo93r3g8tvBea8W8PN3I4W6KcN2/9ZJaBhT3Y4NP+p2w4ZO6aJ+qp9xH990aYw==", + "version": "3.0.0", + "resolved": "file:../dfinity-candid-3.0.0-patch.tgz", + "integrity": "sha512-UxeeXyUK6hDXM8bNFDtvEql58ve8m4RFoOMkCHx+FNp4iNyGmslqQWbCAqzWDC+nOMmoOPBOYbrlgkTtL7m9VQ==", "license": "Apache-2.0", "peerDependencies": { - "@dfinity/principal": "^2.3.0" + "@dfinity/principal": "3.0.0" } }, "node_modules/@dfinity/principal": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@dfinity/principal/-/principal-2.3.0.tgz", - "integrity": "sha512-rb3TsxR3L/Vq2GWV/GGIMXPbzDDqxNohPbNW8nJKhpcm8Ds00tCVEmPUDqrn735xJW0Pmzog/6/S1L9jG2UT9g==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@dfinity/principal/-/principal-3.0.0.tgz", + "integrity": "sha512-qgWzxzZqC9s/4L/ITSkkeh+VGlTsiViQypqBiIDy1AEVnNhK/EINFke01ur4+a+GcGRrN410enaoQ6tPHYlnjQ==", "license": "Apache-2.0", "peer": true, "dependencies": { - "@noble/hashes": "^1.3.1" + "@noble/hashes": "^1.8.0" } }, "node_modules/@noble/hashes": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.7.1.tgz", - "integrity": "sha512-B8XBPsn4vT/KJAGqDzbwztd+6Yte3P4V7iafm24bxgDe/mlRuK6xmWPuCNrKt2vDafZ8MfJLlchDG/vYafQEjQ==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", "license": "MIT", "peer": true, "engines": { diff --git a/idl_instance_1/package.json b/idl_instance_1/package.json index 5a28d74..a27343a 100644 --- a/idl_instance_1/package.json +++ b/idl_instance_1/package.json @@ -1,6 +1,5 @@ { - "main": "index.js", "dependencies": { - "@dfinity/candid": "^2.3.0" + "@dfinity/candid": "file:../dfinity-candid-3.0.0-patch.tgz" } } diff --git a/idl_instance_2/package-lock.json b/idl_instance_2/package-lock.json index 32171a9..33358d9 100644 --- a/idl_instance_2/package-lock.json +++ b/idl_instance_2/package-lock.json @@ -6,32 +6,32 @@ "packages": { "": { "dependencies": { - "@dfinity/candid": "^2.3.0" + "@dfinity/candid": "file:../dfinity-candid-3.0.0-patch.tgz" } }, "node_modules/@dfinity/candid": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@dfinity/candid/-/candid-2.3.0.tgz", - "integrity": "sha512-Xzj3EWfwaVZy90jq6WBRP4Cyqo93r3g8tvBea8W8PN3I4W6KcN2/9ZJaBhT3Y4NP+p2w4ZO6aJ+qp9xH990aYw==", + "version": "3.0.0", + "resolved": "file:../dfinity-candid-3.0.0-patch.tgz", + "integrity": "sha512-UxeeXyUK6hDXM8bNFDtvEql58ve8m4RFoOMkCHx+FNp4iNyGmslqQWbCAqzWDC+nOMmoOPBOYbrlgkTtL7m9VQ==", "license": "Apache-2.0", "peerDependencies": { - "@dfinity/principal": "^2.3.0" + "@dfinity/principal": "3.0.0" } }, "node_modules/@dfinity/principal": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@dfinity/principal/-/principal-2.3.0.tgz", - "integrity": "sha512-rb3TsxR3L/Vq2GWV/GGIMXPbzDDqxNohPbNW8nJKhpcm8Ds00tCVEmPUDqrn735xJW0Pmzog/6/S1L9jG2UT9g==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@dfinity/principal/-/principal-3.0.0.tgz", + "integrity": "sha512-qgWzxzZqC9s/4L/ITSkkeh+VGlTsiViQypqBiIDy1AEVnNhK/EINFke01ur4+a+GcGRrN410enaoQ6tPHYlnjQ==", "license": "Apache-2.0", "peer": true, "dependencies": { - "@noble/hashes": "^1.3.1" + "@noble/hashes": "^1.8.0" } }, "node_modules/@noble/hashes": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.7.1.tgz", - "integrity": "sha512-B8XBPsn4vT/KJAGqDzbwztd+6Yte3P4V7iafm24bxgDe/mlRuK6xmWPuCNrKt2vDafZ8MfJLlchDG/vYafQEjQ==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", "license": "MIT", "peer": true, "engines": { diff --git a/idl_instance_2/package.json b/idl_instance_2/package.json index 5a28d74..a27343a 100644 --- a/idl_instance_2/package.json +++ b/idl_instance_2/package.json @@ -1,6 +1,5 @@ { - "main": "index.js", "dependencies": { - "@dfinity/candid": "^2.3.0" + "@dfinity/candid": "file:../dfinity-candid-3.0.0-patch.tgz" } } diff --git a/test.ts b/test.ts index 4093e47..d802d8a 100644 --- a/test.ts +++ b/test.ts @@ -1,16 +1,26 @@ import { IDL as IDL1 } from "./idl_instance_1"; import { IDL as IDL2 } from "./idl_instance_2"; -function test(): Uint8Array { +function test(): [Uint8Array, Uint8Array] { const blobIDL1 = IDL1.Vec(IDL1.Nat8); + const blobIDL2 = IDL2.Vec(IDL2.Nat8); const encoded = IDL1.encode([blobIDL1], [[1, 2, 3]]); - const decoded = IDL2.decode([blobIDL1], encoded); + // this was fine even before the patch + const decoded = IDL2.decode([blobIDL2], encoded); - return decoded[0] as unknown as Uint8Array; + // this was broken before the patch + const decodedUsingIdl1Types = IDL2.decode([blobIDL1], encoded); + + console.log({ decoded, decodedUsingIdl1Types }); + + return [ + decoded[0] as unknown as Uint8Array, + decodedUsingIdl1Types[0] as unknown as Uint8Array, + ]; } const result = test(); console.log(result); -// Should print out something like: Uint8Array(3) [ 1, 2, 3 ] +// Should print out something like: [ Uint8Array(3) [ 1, 2, 3 ], Uint8Array(3) [ 1, 2, 3 ] ]