diff --git a/CHANGELOG.md b/CHANGELOG.md index a545c4ad..3fb7a799 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,21 @@ -# Next +# 2024.09.30-1100Z + +## Overview + +The current status of the libraries at the time of the release is as follows: + +| Library | Version | Status | +| ------------------------ | ------- | ------------------- | +| `@dfinity/ckbtc` | v3.1.0 | Enhanced 🔧️ | +| `@dfinity/cketh` | v3.3.1 | Maintained ⚙️ | +| `@dfinity/cmc` | v3.2.1 | Maintained ⚙️ | +| `@dfinity/ic-management` | v5.2.1 | Maintained ⚙️ | +| `@dfinity/ledger-icp` | v2.6.0 | Enhanced 🔧️ | +| `@dfinity/ledger-icrc` | v2.6.0 | Enhanced 🔧️ | +| `@dfinity/nns` | v7.0.0 | Breaking Changes ⚠️ | +| `@dfinity/nns-proto` | v2.0.1 | Unchanged️ | +| `@dfinity/sns` | v3.2.1 | Maintained ⚙️ | +| `@dfinity/utils` | v2.5.0 | Maintained ⚙️ | ## Breaking changes @@ -8,6 +25,11 @@ - Add support for `icrc21_canister_call_consent_message` to `@dfinity/ledger-icp` and `@dfinity/ledger-icrc`. - Add support for `"regtest"` in `BitcoinNetwork`. +- Expose `ledger-converters` utility modules in `@dfinity/ledger-icp` and `@dfinity/ledger-icrc`. + +## Build + +- Incorporate Agent-js patch `v2.1.2`. # 2024.09.02-0830Z diff --git a/package-lock.json b/package-lock.json index f3932993..a5e2acfc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@dfinity/ic-js", - "version": "2024.09.02-0830Z", + "version": "2024.09.30-1100Z", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@dfinity/ic-js", - "version": "2024.09.02-0830Z", + "version": "2024.09.30-1100Z", "license": "Apache-2.0", "workspaces": [ "packages/utils", @@ -717,9 +717,9 @@ "dev": true }, "node_modules/@dfinity/agent": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@dfinity/agent/-/agent-2.1.1.tgz", - "integrity": "sha512-9+XPFc9PrXM0kmaqZOOVW3eXBGaWzOjnnbEa55J1NBuDA6+X2jAyE51I62zXr1oFwMeKj7ykOEFd5MOmnMEijA==", + "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", "peer": true, "dependencies": { @@ -731,18 +731,18 @@ "simple-cbor": "^0.4.1" }, "peerDependencies": { - "@dfinity/candid": "^2.1.1", - "@dfinity/principal": "^2.1.1" + "@dfinity/candid": "^2.1.2", + "@dfinity/principal": "^2.1.2" } }, "node_modules/@dfinity/candid": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@dfinity/candid/-/candid-2.1.1.tgz", - "integrity": "sha512-RVcTKko8wLys2yW84e9Fu/AcJkZOdH7U/Rlm3Pgcx81fnfm74hxKCoecTYD+awbD2HSlVJRB/Uo7NoAoE/N+gQ==", + "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, "peerDependencies": { - "@dfinity/principal": "^2.1.1" + "@dfinity/principal": "^2.1.2" } }, "node_modules/@dfinity/ckbtc": { @@ -778,9 +778,9 @@ "link": true }, "node_modules/@dfinity/principal": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@dfinity/principal/-/principal-2.1.1.tgz", - "integrity": "sha512-XKoQRgL7S7MRPwabY6z2wJ1Mn0WQqe9ZQIMK2wtRq48f5nL1m0rZejf8kR9JsZCNCYK6ss4b09FCRNGC20J8Bg==", + "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", "peer": true, "dependencies": { @@ -7513,7 +7513,7 @@ }, "packages/ckbtc": { "name": "@dfinity/ckbtc", - "version": "3.0.0", + "version": "3.1.0", "license": "Apache-2.0", "dependencies": { "@noble/hashes": "^1.3.2", @@ -7521,70 +7521,70 @@ "bech32": "^2.0.0" }, "peerDependencies": { - "@dfinity/agent": "^2.1.1", - "@dfinity/candid": "^2.1.1", - "@dfinity/principal": "^2.1.1", - "@dfinity/utils": "^2.5.0" + "@dfinity/agent": "^2.1.2", + "@dfinity/candid": "^2.1.2", + "@dfinity/principal": "^2.1.2", + "@dfinity/utils": "^2.5.1" } }, "packages/cketh": { "name": "@dfinity/cketh", - "version": "3.3.0", + "version": "3.3.1", "license": "Apache-2.0", "peerDependencies": { - "@dfinity/agent": "^2.1.1", - "@dfinity/candid": "^2.1.1", - "@dfinity/principal": "^2.1.1", - "@dfinity/utils": "^2.5.0" + "@dfinity/agent": "^2.1.2", + "@dfinity/candid": "^2.1.2", + "@dfinity/principal": "^2.1.2", + "@dfinity/utils": "^2.5.1" } }, "packages/cmc": { "name": "@dfinity/cmc", - "version": "3.2.0", + "version": "3.2.1", "license": "Apache-2.0", "peerDependencies": { - "@dfinity/agent": "^2.1.1", - "@dfinity/candid": "^2.1.1", - "@dfinity/principal": "^2.1.1", - "@dfinity/utils": "^2.5.0" + "@dfinity/agent": "^2.1.2", + "@dfinity/candid": "^2.1.2", + "@dfinity/principal": "^2.1.2", + "@dfinity/utils": "^2.5.1" } }, "packages/ic-management": { "name": "@dfinity/ic-management", - "version": "5.2.0", + "version": "5.2.1", "license": "Apache-2.0", "peerDependencies": { - "@dfinity/agent": "^2.1.1", - "@dfinity/candid": "^2.1.1", - "@dfinity/principal": "^2.1.1", - "@dfinity/utils": "^2.5.0" + "@dfinity/agent": "^2.1.2", + "@dfinity/candid": "^2.1.2", + "@dfinity/principal": "^2.1.2", + "@dfinity/utils": "^2.5.1" } }, "packages/ledger-icp": { "name": "@dfinity/ledger-icp", - "version": "2.5.0", + "version": "2.6.0", "license": "Apache-2.0", "peerDependencies": { - "@dfinity/agent": "^2.1.1", - "@dfinity/candid": "^2.1.1", - "@dfinity/principal": "^2.1.1", - "@dfinity/utils": "^2.5.0" + "@dfinity/agent": "^2.1.2", + "@dfinity/candid": "^2.1.2", + "@dfinity/principal": "^2.1.2", + "@dfinity/utils": "^2.5.1" } }, "packages/ledger-icrc": { "name": "@dfinity/ledger-icrc", - "version": "2.5.0", + "version": "2.6.0", "license": "Apache-2.0", "peerDependencies": { - "@dfinity/agent": "^2.1.1", - "@dfinity/candid": "^2.1.1", - "@dfinity/principal": "^2.1.1", - "@dfinity/utils": "^2.5.0" + "@dfinity/agent": "^2.1.2", + "@dfinity/candid": "^2.1.2", + "@dfinity/principal": "^2.1.2", + "@dfinity/utils": "^2.5.1" } }, "packages/nns": { "name": "@dfinity/nns", - "version": "6.0.0", + "version": "7.0.0", "license": "Apache-2.0", "dependencies": { "@noble/hashes": "^1.3.2", @@ -7594,11 +7594,11 @@ "@types/randombytes": "^2.0.0" }, "peerDependencies": { - "@dfinity/agent": "^2.1.1", - "@dfinity/candid": "^2.1.1", - "@dfinity/ledger-icp": "^2.5.0", - "@dfinity/principal": "^2.1.1", - "@dfinity/utils": "^2.5.0" + "@dfinity/agent": "^2.1.2", + "@dfinity/candid": "^2.1.2", + "@dfinity/ledger-icp": "^2.6.0", + "@dfinity/principal": "^2.1.2", + "@dfinity/utils": "^2.5.1" } }, "packages/nns-proto": { @@ -7614,27 +7614,27 @@ }, "packages/sns": { "name": "@dfinity/sns", - "version": "3.2.0", + "version": "3.2.1", "license": "Apache-2.0", "dependencies": { "@noble/hashes": "^1.3.2" }, "peerDependencies": { - "@dfinity/agent": "^2.1.1", - "@dfinity/candid": "^2.1.1", - "@dfinity/ledger-icrc": "^2.5.0", - "@dfinity/principal": "^2.1.1", - "@dfinity/utils": "^2.5.0" + "@dfinity/agent": "^2.1.2", + "@dfinity/candid": "^2.1.2", + "@dfinity/ledger-icrc": "^2.6.0", + "@dfinity/principal": "^2.1.2", + "@dfinity/utils": "^2.5.1" } }, "packages/utils": { "name": "@dfinity/utils", - "version": "2.5.0", + "version": "2.5.1", "license": "Apache-2.0", "peerDependencies": { - "@dfinity/agent": "^2.1.1", - "@dfinity/candid": "^2.1.1", - "@dfinity/principal": "^2.1.1" + "@dfinity/agent": "^2.1.2", + "@dfinity/candid": "^2.1.2", + "@dfinity/principal": "^2.1.2" } } }, @@ -8148,9 +8148,9 @@ "dev": true }, "@dfinity/agent": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@dfinity/agent/-/agent-2.1.1.tgz", - "integrity": "sha512-9+XPFc9PrXM0kmaqZOOVW3eXBGaWzOjnnbEa55J1NBuDA6+X2jAyE51I62zXr1oFwMeKj7ykOEFd5MOmnMEijA==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@dfinity/agent/-/agent-2.1.2.tgz", + "integrity": "sha512-UAXf6uXovhBlSp245RWlA21zcCavy+vVUvKVQUpesk1gLJpJlvsCE6hYOwTeFZAP+bjmPi0Tl7cx8DT2KM4eDQ==", "peer": true, "requires": { "@noble/curves": "^1.4.0", @@ -8162,9 +8162,9 @@ } }, "@dfinity/candid": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@dfinity/candid/-/candid-2.1.1.tgz", - "integrity": "sha512-RVcTKko8wLys2yW84e9Fu/AcJkZOdH7U/Rlm3Pgcx81fnfm74hxKCoecTYD+awbD2HSlVJRB/Uo7NoAoE/N+gQ==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@dfinity/candid/-/candid-2.1.2.tgz", + "integrity": "sha512-do69J9iahW2tlmbPdbmc8MDhi5cfIQyTcAlYqaSOOAyg+Kp8beCnW7mletXVfx30dyVlpkyCrYOXhbpQuSCKtw==", "peer": true, "requires": {} }, @@ -8212,9 +8212,9 @@ } }, "@dfinity/principal": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@dfinity/principal/-/principal-2.1.1.tgz", - "integrity": "sha512-XKoQRgL7S7MRPwabY6z2wJ1Mn0WQqe9ZQIMK2wtRq48f5nL1m0rZejf8kR9JsZCNCYK6ss4b09FCRNGC20J8Bg==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@dfinity/principal/-/principal-2.1.2.tgz", + "integrity": "sha512-L3Y0nDjquqNFseM2Gx5fI4GOUKjjezFr9/6ZjSwAFeDeb4Ubqld4ZKL3FEzv4QKNbfZgCx19b7UXi+OdmLhi4w==", "peer": true, "requires": { "@noble/hashes": "^1.3.1" diff --git a/package.json b/package.json index b109b31c..e668fea3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dfinity/ic-js", - "version": "2024.09.02-0830Z", + "version": "2024.09.30-1100Z", "description": "A collection of library for interfacing with the Internet Computer.", "license": "Apache-2.0", "workspaces": [ @@ -168,7 +168,7 @@ { "name": "@dfinity/ic-management", "path": "./packages/ic-management/dist/index.js", - "limit": "3 kB", + "limit": "4 kB", "gzip": true, "ignore": [ "@dfinity/agent", diff --git a/packages/ckbtc/candid/minter.did b/packages/ckbtc/candid/minter.did index 4289555c..573981c8 100644 --- a/packages/ckbtc/candid/minter.did +++ b/packages/ckbtc/candid/minter.did @@ -1,4 +1,4 @@ -// Generated from IC repo commit 0441f40 (2024-09-18 tags: release-2024-09-19_01-31-base) 'rs/bitcoin/ckbtc/minter/ckbtc_minter.did' by import-candid +// Generated from IC repo commit c43a488 (2024-09-27 tags: release-2024-09-26_01-31-no-canister-snapshots) 'rs/bitcoin/ckbtc/minter/ckbtc_minter.did' by import-candid // Represents an account on the ckBTC ledger. type Account = record { owner : principal; subaccount : opt blob }; diff --git a/packages/ckbtc/package.json b/packages/ckbtc/package.json index ba1c1c91..91d59396 100644 --- a/packages/ckbtc/package.json +++ b/packages/ckbtc/package.json @@ -1,6 +1,6 @@ { "name": "@dfinity/ckbtc", - "version": "3.0.0", + "version": "3.1.0", "description": "A library for interfacing with ckBTC.", "license": "Apache-2.0", "main": "dist/cjs/index.cjs.js", @@ -38,10 +38,10 @@ ], "homepage": "https://github.com/dfinity/ic-js#readme", "peerDependencies": { - "@dfinity/agent": "^2.1.1", - "@dfinity/candid": "^2.1.1", - "@dfinity/principal": "^2.1.1", - "@dfinity/utils": "^2.5.0" + "@dfinity/agent": "^2.1.2", + "@dfinity/candid": "^2.1.2", + "@dfinity/principal": "^2.1.2", + "@dfinity/utils": "^2.5.1" }, "dependencies": { "@noble/hashes": "^1.3.2", diff --git a/packages/cketh/candid/minter.did b/packages/cketh/candid/minter.did index d1fed003..02b62a60 100644 --- a/packages/cketh/candid/minter.did +++ b/packages/cketh/candid/minter.did @@ -1,4 +1,4 @@ -// Generated from IC repo commit 0441f40 (2024-09-18 tags: release-2024-09-19_01-31-base) 'rs/ethereum/cketh/minter/cketh_minter.did' by import-candid +// Generated from IC repo commit c43a488 (2024-09-27 tags: release-2024-09-26_01-31-no-canister-snapshots) 'rs/ethereum/cketh/minter/cketh_minter.did' by import-candid type EthereumNetwork = variant { // The public Ethereum mainnet. Mainnet; diff --git a/packages/cketh/candid/orchestrator.did b/packages/cketh/candid/orchestrator.did index dd7d0581..ba0cb6b8 100644 --- a/packages/cketh/candid/orchestrator.did +++ b/packages/cketh/candid/orchestrator.did @@ -1,4 +1,4 @@ -// Generated from IC repo commit 0441f40 (2024-09-18 tags: release-2024-09-19_01-31-base) 'rs/ethereum/ledger-suite-orchestrator/ledger_suite_orchestrator.did' by import-candid +// Generated from IC repo commit c43a488 (2024-09-27 tags: release-2024-09-26_01-31-no-canister-snapshots) 'rs/ethereum/ledger-suite-orchestrator/ledger_suite_orchestrator.did' by import-candid type OrchestratorArg = variant { UpgradeArg : UpgradeArg; InitArg : InitArg; diff --git a/packages/cketh/package.json b/packages/cketh/package.json index e3c5e641..b5ac7e6e 100644 --- a/packages/cketh/package.json +++ b/packages/cketh/package.json @@ -1,6 +1,6 @@ { "name": "@dfinity/cketh", - "version": "3.3.0", + "version": "3.3.1", "description": "A library for interfacing with ckETH.", "license": "Apache-2.0", "main": "dist/cjs/index.cjs.js", @@ -38,9 +38,9 @@ ], "homepage": "https://github.com/dfinity/ic-js#readme", "peerDependencies": { - "@dfinity/agent": "^2.1.1", - "@dfinity/candid": "^2.1.1", - "@dfinity/principal": "^2.1.1", - "@dfinity/utils": "^2.5.0" + "@dfinity/agent": "^2.1.2", + "@dfinity/candid": "^2.1.2", + "@dfinity/principal": "^2.1.2", + "@dfinity/utils": "^2.5.1" } } diff --git a/packages/cmc/candid/cmc.certified.idl.js b/packages/cmc/candid/cmc.certified.idl.js index 631d99e0..edf3f4b4 100644 --- a/packages/cmc/candid/cmc.certified.idl.js +++ b/packages/cmc/candid/cmc.certified.idl.js @@ -116,6 +116,7 @@ export const idlFactory = ({ IDL }) => { [], ), 'get_build_metadata' : IDL.Func([], [IDL.Text], []), + 'get_default_subnets' : IDL.Func([], [IDL.Vec(IDL.Principal)], []), 'get_icp_xdr_conversion_rate' : IDL.Func( [], [IcpXdrConversionRateResponse], diff --git a/packages/cmc/candid/cmc.d.ts b/packages/cmc/candid/cmc.d.ts index 9fd91d51..a95c55fb 100644 --- a/packages/cmc/candid/cmc.d.ts +++ b/packages/cmc/candid/cmc.d.ts @@ -98,6 +98,7 @@ export type log_visibility = { controllers: null } | { public: null }; export interface _SERVICE { create_canister: ActorMethod<[CreateCanisterArg], CreateCanisterResult>; get_build_metadata: ActorMethod<[], string>; + get_default_subnets: ActorMethod<[], Array>; get_icp_xdr_conversion_rate: ActorMethod<[], IcpXdrConversionRateResponse>; get_principals_authorized_to_create_canisters_to_subnets: ActorMethod< [], diff --git a/packages/cmc/candid/cmc.did b/packages/cmc/candid/cmc.did index 46fe2177..18b78bd6 100644 --- a/packages/cmc/candid/cmc.did +++ b/packages/cmc/candid/cmc.did @@ -1,4 +1,4 @@ -// Generated from IC repo commit 0441f40 (2024-09-18 tags: release-2024-09-19_01-31-base) 'rs/nns/cmc/cmc.did' by import-candid +// Generated from IC repo commit c43a488 (2024-09-27 tags: release-2024-09-26_01-31-no-canister-snapshots) 'rs/nns/cmc/cmc.did' by import-candid type Cycles = nat; type BlockIndex = nat64; type log_visibility = variant { @@ -236,5 +236,7 @@ service : (opt CyclesCanisterInitPayload) -> { // to create canisters. get_principals_authorized_to_create_canisters_to_subnets : () -> (PrincipalsAuthorizedToCreateCanistersToSubnetsResponse) query; + get_default_subnets: () -> (vec principal) query; + get_build_metadata : () -> (text) query; }; diff --git a/packages/cmc/candid/cmc.idl.js b/packages/cmc/candid/cmc.idl.js index 8bfd4f8f..559f50a1 100644 --- a/packages/cmc/candid/cmc.idl.js +++ b/packages/cmc/candid/cmc.idl.js @@ -116,6 +116,7 @@ export const idlFactory = ({ IDL }) => { [], ), 'get_build_metadata' : IDL.Func([], [IDL.Text], ['query']), + 'get_default_subnets' : IDL.Func([], [IDL.Vec(IDL.Principal)], ['query']), 'get_icp_xdr_conversion_rate' : IDL.Func( [], [IcpXdrConversionRateResponse], diff --git a/packages/cmc/package.json b/packages/cmc/package.json index defefc8f..2fa6a80a 100644 --- a/packages/cmc/package.json +++ b/packages/cmc/package.json @@ -1,6 +1,6 @@ { "name": "@dfinity/cmc", - "version": "3.2.0", + "version": "3.2.1", "description": "A library for interfacing with the cycle minting canister.", "license": "Apache-2.0", "main": "dist/cjs/index.cjs.js", @@ -36,9 +36,9 @@ ], "homepage": "https://github.com/dfinity/ic-js#readme", "peerDependencies": { - "@dfinity/agent": "^2.1.1", - "@dfinity/candid": "^2.1.1", - "@dfinity/principal": "^2.1.1", - "@dfinity/utils": "^2.5.0" + "@dfinity/agent": "^2.1.2", + "@dfinity/candid": "^2.1.2", + "@dfinity/principal": "^2.1.2", + "@dfinity/utils": "^2.5.1" } } diff --git a/packages/ic-management/candid/ic-management.certified.idl.js b/packages/ic-management/candid/ic-management.certified.idl.js index 1022c03d..b6e1a80f 100644 --- a/packages/ic-management/candid/ic-management.certified.idl.js +++ b/packages/ic-management/candid/ic-management.certified.idl.js @@ -72,6 +72,7 @@ export const idlFactory = ({ IDL }) => { 'canister_id' : IDL.Principal, }), }); + const snapshot_id = IDL.Vec(IDL.Nat8); const change_details = IDL.Variant({ 'creation' : IDL.Record({ 'controllers' : IDL.Vec(IDL.Principal) }), 'code_deployment' : IDL.Record({ @@ -82,6 +83,11 @@ export const idlFactory = ({ IDL }) => { }), 'module_hash' : IDL.Vec(IDL.Nat8), }), + 'load_snapshot' : IDL.Record({ + 'canister_version' : IDL.Nat64, + 'taken_at_timestamp' : IDL.Nat64, + 'snapshot_id' : snapshot_id, + }), 'controllers_change' : IDL.Record({ 'controllers' : IDL.Vec(IDL.Principal), }), @@ -148,6 +154,10 @@ export const idlFactory = ({ IDL }) => { }); const create_canister_result = IDL.Record({ 'canister_id' : canister_id }); const delete_canister_args = IDL.Record({ 'canister_id' : canister_id }); + const delete_canister_snapshot_args = IDL.Record({ + 'canister_id' : canister_id, + 'snapshot_id' : snapshot_id, + }); const deposit_cycles_args = IDL.Record({ 'canister_id' : canister_id }); const ecdsa_curve = IDL.Variant({ 'secp256k1' : IDL.Null }); const ecdsa_public_key_args = IDL.Record({ @@ -230,6 +240,20 @@ export const idlFactory = ({ IDL }) => { 'canister_id' : canister_id, 'sender_canister_version' : IDL.Opt(IDL.Nat64), }); + const list_canister_snapshots_args = IDL.Record({ + 'canister_id' : canister_id, + }); + const snapshot = IDL.Record({ + 'id' : snapshot_id, + 'total_size' : IDL.Nat64, + 'taken_at_timestamp' : IDL.Nat64, + }); + const list_canister_snapshots_result = IDL.Vec(snapshot); + const load_canister_snapshot_args = IDL.Record({ + 'canister_id' : canister_id, + 'sender_canister_version' : IDL.Opt(IDL.Nat64), + 'snapshot_id' : snapshot_id, + }); const node_metrics_history_args = IDL.Record({ 'start_at_timestamp_nanos' : IDL.Nat64, 'subnet_id' : IDL.Principal, @@ -298,6 +322,11 @@ export const idlFactory = ({ IDL }) => { const stop_canister_args = IDL.Record({ 'canister_id' : canister_id }); const stored_chunks_args = IDL.Record({ 'canister_id' : canister_id }); const stored_chunks_result = IDL.Vec(chunk_hash); + const take_canister_snapshot_args = IDL.Record({ + 'replace_snapshot' : IDL.Opt(snapshot_id), + 'canister_id' : canister_id, + }); + const take_canister_snapshot_result = snapshot; const uninstall_code_args = IDL.Record({ 'canister_id' : canister_id, 'sender_canister_version' : IDL.Opt(IDL.Nat64), @@ -355,6 +384,11 @@ export const idlFactory = ({ IDL }) => { [], ), 'delete_canister' : IDL.Func([delete_canister_args], [], []), + 'delete_canister_snapshot' : IDL.Func( + [delete_canister_snapshot_args], + [], + [], + ), 'deposit_cycles' : IDL.Func([deposit_cycles_args], [], []), 'ecdsa_public_key' : IDL.Func( [ecdsa_public_key_args], @@ -369,6 +403,12 @@ export const idlFactory = ({ IDL }) => { 'http_request' : IDL.Func([http_request_args], [http_request_result], []), 'install_chunked_code' : IDL.Func([install_chunked_code_args], [], []), 'install_code' : IDL.Func([install_code_args], [], []), + 'list_canister_snapshots' : IDL.Func( + [list_canister_snapshots_args], + [list_canister_snapshots_result], + [], + ), + 'load_canister_snapshot' : IDL.Func([load_canister_snapshot_args], [], []), 'node_metrics_history' : IDL.Func( [node_metrics_history_args], [node_metrics_history_result], @@ -407,6 +447,11 @@ export const idlFactory = ({ IDL }) => { [stored_chunks_result], [], ), + 'take_canister_snapshot' : IDL.Func( + [take_canister_snapshot_args], + [take_canister_snapshot_result], + [], + ), 'uninstall_code' : IDL.Func([uninstall_code_args], [], []), 'update_settings' : IDL.Func([update_settings_args], [], []), 'upload_chunk' : IDL.Func([upload_chunk_args], [upload_chunk_result], []), diff --git a/packages/ic-management/candid/ic-management.d.ts b/packages/ic-management/candid/ic-management.d.ts index 27d991f0..44a3c165 100644 --- a/packages/ic-management/candid/ic-management.d.ts +++ b/packages/ic-management/candid/ic-management.d.ts @@ -119,6 +119,13 @@ export type change_details = module_hash: Uint8Array | number[]; }; } + | { + load_snapshot: { + canister_version: bigint; + taken_at_timestamp: bigint; + snapshot_id: snapshot_id; + }; + } | { controllers_change: { controllers: Array } } | { code_uninstall: null }; export type change_origin = @@ -154,6 +161,10 @@ export interface definite_canister_settings { export interface delete_canister_args { canister_id: canister_id; } +export interface delete_canister_snapshot_args { + canister_id: canister_id; + snapshot_id: snapshot_id; +} export interface deposit_cycles_args { canister_id: canister_id; } @@ -208,6 +219,15 @@ export interface install_code_args { canister_id: canister_id; sender_canister_version: [] | [bigint]; } +export interface list_canister_snapshots_args { + canister_id: canister_id; +} +export type list_canister_snapshots_result = Array; +export interface load_canister_snapshot_args { + canister_id: canister_id; + sender_canister_version: [] | [bigint]; + snapshot_id: snapshot_id; +} export type log_visibility = { controllers: null } | { public: null }; export type millisatoshi_per_byte = bigint; export interface node_metrics { @@ -268,6 +288,12 @@ export interface sign_with_schnorr_args { export interface sign_with_schnorr_result { signature: Uint8Array | number[]; } +export interface snapshot { + id: snapshot_id; + total_size: bigint; + taken_at_timestamp: bigint; +} +export type snapshot_id = Uint8Array | number[]; export interface start_canister_args { canister_id: canister_id; } @@ -278,6 +304,11 @@ export interface stored_chunks_args { canister_id: canister_id; } export type stored_chunks_result = Array; +export interface take_canister_snapshot_args { + replace_snapshot: [] | [snapshot_id]; + canister_id: canister_id; +} +export type take_canister_snapshot_result = snapshot; export interface uninstall_code_args { canister_id: canister_id; sender_canister_version: [] | [bigint]; @@ -324,6 +355,10 @@ export interface _SERVICE { clear_chunk_store: ActorMethod<[clear_chunk_store_args], undefined>; create_canister: ActorMethod<[create_canister_args], create_canister_result>; delete_canister: ActorMethod<[delete_canister_args], undefined>; + delete_canister_snapshot: ActorMethod< + [delete_canister_snapshot_args], + undefined + >; deposit_cycles: ActorMethod<[deposit_cycles_args], undefined>; ecdsa_public_key: ActorMethod< [ecdsa_public_key_args], @@ -336,6 +371,11 @@ export interface _SERVICE { http_request: ActorMethod<[http_request_args], http_request_result>; install_chunked_code: ActorMethod<[install_chunked_code_args], undefined>; install_code: ActorMethod<[install_code_args], undefined>; + list_canister_snapshots: ActorMethod< + [list_canister_snapshots_args], + list_canister_snapshots_result + >; + load_canister_snapshot: ActorMethod<[load_canister_snapshot_args], undefined>; node_metrics_history: ActorMethod< [node_metrics_history_args], node_metrics_history_result @@ -361,6 +401,10 @@ export interface _SERVICE { start_canister: ActorMethod<[start_canister_args], undefined>; stop_canister: ActorMethod<[stop_canister_args], undefined>; stored_chunks: ActorMethod<[stored_chunks_args], stored_chunks_result>; + take_canister_snapshot: ActorMethod< + [take_canister_snapshot_args], + take_canister_snapshot_result + >; uninstall_code: ActorMethod<[uninstall_code_args], undefined>; update_settings: ActorMethod<[update_settings_args], undefined>; upload_chunk: ActorMethod<[upload_chunk_args], upload_chunk_result>; diff --git a/packages/ic-management/candid/ic-management.did b/packages/ic-management/candid/ic-management.did index 37e885e1..f21e6f66 100644 --- a/packages/ic-management/candid/ic-management.did +++ b/packages/ic-management/candid/ic-management.did @@ -1,6 +1,7 @@ -// Generated from dfinity/interface-spec commit 45a23a737ec37cb8c9b098e377af857b4b55abda for file 'spec/_attachments/ic.did' +// Generated from dfinity/interface-spec commit ac416ec82cd9fae4825824fea639f7ae32aec594 for file 'spec/_attachments/ic.did' type canister_id = principal; type wasm_module = blob; +type snapshot_id = blob; type log_visibility = variant { controllers; @@ -46,6 +47,11 @@ type change_details = variant { mode : variant { install; reinstall; upgrade }; module_hash : blob; }; + load_snapshot : record { + canister_version : nat64; + snapshot_id : snapshot_id; + taken_at_timestamp : nat64; + }; controllers_change : record { controllers : vec principal; }; @@ -359,6 +365,36 @@ type stored_chunks_result = vec chunk_hash; type upload_chunk_result = chunk_hash; +type snapshot = record { + id : snapshot_id; + taken_at_timestamp : nat64; + total_size : nat64; +}; + +type take_canister_snapshot_args = record { + canister_id : canister_id; + replace_snapshot : opt snapshot_id; +}; + +type take_canister_snapshot_result = snapshot; + +type load_canister_snapshot_args = record { + canister_id : canister_id; + snapshot_id : snapshot_id; + sender_canister_version : opt nat64; +}; + +type list_canister_snapshots_args = record { + canister_id : canister_id; +}; + +type list_canister_snapshots_result = vec snapshot; + +type delete_canister_snapshot_args = record { + canister_id : canister_id; + snapshot_id : snapshot_id; +}; + type fetch_canister_logs_args = record { canister_id : canister_id; }; @@ -413,6 +449,12 @@ service ic : { provisional_create_canister_with_cycles : (provisional_create_canister_with_cycles_args) -> (provisional_create_canister_with_cycles_result); provisional_top_up_canister : (provisional_top_up_canister_args) -> (); + // Canister snapshots + take_canister_snapshot : (take_canister_snapshot_args) -> (take_canister_snapshot_result); + load_canister_snapshot : (load_canister_snapshot_args) -> (); + list_canister_snapshots : (list_canister_snapshots_args) -> (list_canister_snapshots_result); + delete_canister_snapshot : (delete_canister_snapshot_args) -> (); + // canister logging fetch_canister_logs : (fetch_canister_logs_args) -> (fetch_canister_logs_result) query; }; diff --git a/packages/ic-management/candid/ic-management.idl.js b/packages/ic-management/candid/ic-management.idl.js index 6c3ac917..fce8353b 100644 --- a/packages/ic-management/candid/ic-management.idl.js +++ b/packages/ic-management/candid/ic-management.idl.js @@ -72,6 +72,7 @@ export const idlFactory = ({ IDL }) => { 'canister_id' : IDL.Principal, }), }); + const snapshot_id = IDL.Vec(IDL.Nat8); const change_details = IDL.Variant({ 'creation' : IDL.Record({ 'controllers' : IDL.Vec(IDL.Principal) }), 'code_deployment' : IDL.Record({ @@ -82,6 +83,11 @@ export const idlFactory = ({ IDL }) => { }), 'module_hash' : IDL.Vec(IDL.Nat8), }), + 'load_snapshot' : IDL.Record({ + 'canister_version' : IDL.Nat64, + 'taken_at_timestamp' : IDL.Nat64, + 'snapshot_id' : snapshot_id, + }), 'controllers_change' : IDL.Record({ 'controllers' : IDL.Vec(IDL.Principal), }), @@ -148,6 +154,10 @@ export const idlFactory = ({ IDL }) => { }); const create_canister_result = IDL.Record({ 'canister_id' : canister_id }); const delete_canister_args = IDL.Record({ 'canister_id' : canister_id }); + const delete_canister_snapshot_args = IDL.Record({ + 'canister_id' : canister_id, + 'snapshot_id' : snapshot_id, + }); const deposit_cycles_args = IDL.Record({ 'canister_id' : canister_id }); const ecdsa_curve = IDL.Variant({ 'secp256k1' : IDL.Null }); const ecdsa_public_key_args = IDL.Record({ @@ -230,6 +240,20 @@ export const idlFactory = ({ IDL }) => { 'canister_id' : canister_id, 'sender_canister_version' : IDL.Opt(IDL.Nat64), }); + const list_canister_snapshots_args = IDL.Record({ + 'canister_id' : canister_id, + }); + const snapshot = IDL.Record({ + 'id' : snapshot_id, + 'total_size' : IDL.Nat64, + 'taken_at_timestamp' : IDL.Nat64, + }); + const list_canister_snapshots_result = IDL.Vec(snapshot); + const load_canister_snapshot_args = IDL.Record({ + 'canister_id' : canister_id, + 'sender_canister_version' : IDL.Opt(IDL.Nat64), + 'snapshot_id' : snapshot_id, + }); const node_metrics_history_args = IDL.Record({ 'start_at_timestamp_nanos' : IDL.Nat64, 'subnet_id' : IDL.Principal, @@ -298,6 +322,11 @@ export const idlFactory = ({ IDL }) => { const stop_canister_args = IDL.Record({ 'canister_id' : canister_id }); const stored_chunks_args = IDL.Record({ 'canister_id' : canister_id }); const stored_chunks_result = IDL.Vec(chunk_hash); + const take_canister_snapshot_args = IDL.Record({ + 'replace_snapshot' : IDL.Opt(snapshot_id), + 'canister_id' : canister_id, + }); + const take_canister_snapshot_result = snapshot; const uninstall_code_args = IDL.Record({ 'canister_id' : canister_id, 'sender_canister_version' : IDL.Opt(IDL.Nat64), @@ -355,6 +384,11 @@ export const idlFactory = ({ IDL }) => { [], ), 'delete_canister' : IDL.Func([delete_canister_args], [], []), + 'delete_canister_snapshot' : IDL.Func( + [delete_canister_snapshot_args], + [], + [], + ), 'deposit_cycles' : IDL.Func([deposit_cycles_args], [], []), 'ecdsa_public_key' : IDL.Func( [ecdsa_public_key_args], @@ -369,6 +403,12 @@ export const idlFactory = ({ IDL }) => { 'http_request' : IDL.Func([http_request_args], [http_request_result], []), 'install_chunked_code' : IDL.Func([install_chunked_code_args], [], []), 'install_code' : IDL.Func([install_code_args], [], []), + 'list_canister_snapshots' : IDL.Func( + [list_canister_snapshots_args], + [list_canister_snapshots_result], + [], + ), + 'load_canister_snapshot' : IDL.Func([load_canister_snapshot_args], [], []), 'node_metrics_history' : IDL.Func( [node_metrics_history_args], [node_metrics_history_result], @@ -407,6 +447,11 @@ export const idlFactory = ({ IDL }) => { [stored_chunks_result], [], ), + 'take_canister_snapshot' : IDL.Func( + [take_canister_snapshot_args], + [take_canister_snapshot_result], + [], + ), 'uninstall_code' : IDL.Func([uninstall_code_args], [], []), 'update_settings' : IDL.Func([update_settings_args], [], []), 'upload_chunk' : IDL.Func([upload_chunk_args], [upload_chunk_result], []), diff --git a/packages/ic-management/package.json b/packages/ic-management/package.json index 5ee2f674..49c65dae 100644 --- a/packages/ic-management/package.json +++ b/packages/ic-management/package.json @@ -1,6 +1,6 @@ { "name": "@dfinity/ic-management", - "version": "5.2.0", + "version": "5.2.1", "description": "A library for interfacing with the IC management canister.", "license": "Apache-2.0", "main": "dist/cjs/index.cjs.js", @@ -34,9 +34,9 @@ ], "homepage": "https://github.com/dfinity/ic-js#readme", "peerDependencies": { - "@dfinity/agent": "^2.1.1", - "@dfinity/candid": "^2.1.1", - "@dfinity/principal": "^2.1.1", - "@dfinity/utils": "^2.5.0" + "@dfinity/agent": "^2.1.2", + "@dfinity/candid": "^2.1.2", + "@dfinity/principal": "^2.1.2", + "@dfinity/utils": "^2.5.1" } } diff --git a/packages/ledger-icp/candid/index.did b/packages/ledger-icp/candid/index.did index 6d5c9252..368c7374 100644 --- a/packages/ledger-icp/candid/index.did +++ b/packages/ledger-icp/candid/index.did @@ -1,4 +1,4 @@ -// Generated from IC repo commit 0441f40 (2024-09-18 tags: release-2024-09-19_01-31-base) 'rs/rosetta-api/icp_ledger/index/index.did' by import-candid +// Generated from IC repo commit c43a488 (2024-09-27 tags: release-2024-09-26_01-31-no-canister-snapshots) 'rs/rosetta-api/icp_ledger/index/index.did' by import-candid type Account = record { owner : principal; subaccount : opt vec nat8 }; type GetAccountIdentifierTransactionsArgs = record { max_results : nat64; @@ -9,7 +9,8 @@ type GetAccountTransactionsArgs = record { account : Account; // The txid of the last transaction seen by the client. // If None then the results will start from the most recent - // txid. + // txid. If set then the results will start from the next + // most recent txid after start (start won't be included). start : opt nat; // Maximum number of transactions to fetch. max_results : nat; diff --git a/packages/ledger-icp/candid/ledger.did b/packages/ledger-icp/candid/ledger.did index 3190e74d..f24f8a9c 100644 --- a/packages/ledger-icp/candid/ledger.did +++ b/packages/ledger-icp/candid/ledger.did @@ -1,4 +1,4 @@ -// Generated from IC repo commit 0441f40 (2024-09-18 tags: release-2024-09-19_01-31-base) 'rs/rosetta-api/icp_ledger/ledger.did' by import-candid +// Generated from IC repo commit c43a488 (2024-09-27 tags: release-2024-09-26_01-31-no-canister-snapshots) 'rs/rosetta-api/icp_ledger/ledger.did' by import-candid // This is the official Ledger interface that is guaranteed to be backward compatible. // Amount of tokens, measured in 10^-8 of a token. diff --git a/packages/ledger-icp/package.json b/packages/ledger-icp/package.json index 228ab911..766f70ef 100644 --- a/packages/ledger-icp/package.json +++ b/packages/ledger-icp/package.json @@ -1,6 +1,6 @@ { "name": "@dfinity/ledger-icp", - "version": "2.5.0", + "version": "2.6.0", "description": "A library for interfacing with the ICP ledger on the Internet Computer.", "license": "Apache-2.0", "main": "dist/cjs/index.cjs.js", @@ -38,9 +38,9 @@ ], "homepage": "https://github.com/dfinity/ic-js#readme", "peerDependencies": { - "@dfinity/agent": "^2.1.1", - "@dfinity/candid": "^2.1.1", - "@dfinity/principal": "^2.1.1", - "@dfinity/utils": "^2.5.0" + "@dfinity/agent": "^2.1.2", + "@dfinity/candid": "^2.1.2", + "@dfinity/principal": "^2.1.2", + "@dfinity/utils": "^2.5.1" } } diff --git a/packages/ledger-icrc/candid/icrc_index-ng.did b/packages/ledger-icrc/candid/icrc_index-ng.did index a2eb3c31..36637e05 100644 --- a/packages/ledger-icrc/candid/icrc_index-ng.did +++ b/packages/ledger-icrc/candid/icrc_index-ng.did @@ -1,4 +1,4 @@ -// Generated from IC repo commit 0441f40 (2024-09-18 tags: release-2024-09-19_01-31-base) 'rs/rosetta-api/icrc1/index-ng/index-ng.did' by import-candid +// Generated from IC repo commit c43a488 (2024-09-27 tags: release-2024-09-26_01-31-no-canister-snapshots) 'rs/rosetta-api/icrc1/index-ng/index-ng.did' by import-candid type Tokens = nat; type InitArg = record { @@ -101,7 +101,8 @@ type GetAccountTransactionsArgs = record { account : Account; // The txid of the last transaction seen by the client. // If None then the results will start from the most recent - // txid. + // txid. If set then the results will start from the next + // most recent txid after start (start won't be included). start : opt BlockIndex; // Maximum number of transactions to fetch. max_results : nat; diff --git a/packages/ledger-icrc/candid/icrc_index.did b/packages/ledger-icrc/candid/icrc_index.did index b32d6706..a76bc846 100644 --- a/packages/ledger-icrc/candid/icrc_index.did +++ b/packages/ledger-icrc/candid/icrc_index.did @@ -1,4 +1,4 @@ -// Generated from IC repo commit 0441f40 (2024-09-18 tags: release-2024-09-19_01-31-base) 'rs/rosetta-api/icrc1/index/index.did' by import-candid +// Generated from IC repo commit c43a488 (2024-09-27 tags: release-2024-09-26_01-31-no-canister-snapshots) 'rs/rosetta-api/icrc1/index/index.did' by import-candid type TxId = nat; type Account = record { owner : principal; subaccount : opt blob }; diff --git a/packages/ledger-icrc/candid/icrc_ledger.did b/packages/ledger-icrc/candid/icrc_ledger.did index 82f06485..8121fe39 100644 --- a/packages/ledger-icrc/candid/icrc_ledger.did +++ b/packages/ledger-icrc/candid/icrc_ledger.did @@ -1,4 +1,4 @@ -// Generated from IC repo commit 0441f40 (2024-09-18 tags: release-2024-09-19_01-31-base) 'rs/rosetta-api/icrc1/ledger/ledger.did' by import-candid +// Generated from IC repo commit c43a488 (2024-09-27 tags: release-2024-09-26_01-31-no-canister-snapshots) 'rs/rosetta-api/icrc1/ledger/ledger.did' by import-candid type BlockIndex = nat; type Subaccount = blob; // Number of nanoseconds since the UNIX epoch in UTC timezone. diff --git a/packages/ledger-icrc/package.json b/packages/ledger-icrc/package.json index 9217d53c..36d1338e 100644 --- a/packages/ledger-icrc/package.json +++ b/packages/ledger-icrc/package.json @@ -1,6 +1,6 @@ { "name": "@dfinity/ledger-icrc", - "version": "2.5.0", + "version": "2.6.0", "description": "A library for interfacing with ICRC ledgers on the Internet Computer.", "license": "Apache-2.0", "main": "dist/cjs/index.cjs.js", @@ -37,9 +37,9 @@ ], "homepage": "https://github.com/dfinity/ic-js#readme", "peerDependencies": { - "@dfinity/agent": "^2.1.1", - "@dfinity/candid": "^2.1.1", - "@dfinity/principal": "^2.1.1", - "@dfinity/utils": "^2.5.0" + "@dfinity/agent": "^2.1.2", + "@dfinity/candid": "^2.1.2", + "@dfinity/principal": "^2.1.2", + "@dfinity/utils": "^2.5.1" } } diff --git a/packages/ledger-icrc/src/converters/ledger.converters.spec.ts b/packages/ledger-icrc/src/converters/ledger.converters.spec.ts new file mode 100644 index 00000000..00c14568 --- /dev/null +++ b/packages/ledger-icrc/src/converters/ledger.converters.spec.ts @@ -0,0 +1,168 @@ +import { Principal } from "@dfinity/principal"; +import { toNullable } from "@dfinity/utils"; +import { mockPrincipalText } from "../mocks/ledger.mock"; +import type { + ApproveParams, + Icrc21ConsentMessageParams, + TransferFromParams, + TransferParams, +} from "../types/ledger.params"; +import { + toApproveArgs, + toIcrc21ConsentMessageArgs, + toTransferArg, + toTransferFromArgs, +} from "./ledger.converters"; + +describe("ledger.converters", () => { + const owner = Principal.fromText(mockPrincipalText); + + describe("toTransferArg", () => { + it("should transform TransferParams to TransferArg correctly", () => { + const params: TransferParams = { + to: { owner, subaccount: [[7, 8, 9]] }, + amount: BigInt(1000), + fee: BigInt(10), + memo: new Uint8Array([1, 2, 3]), + from_subaccount: new Uint8Array([4, 5, 6]), + created_at_time: BigInt(100000), + }; + + const result = toTransferArg(params); + + expect(result).toEqual({ + to: params.to, + amount: params.amount, + fee: toNullable(params.fee), + memo: toNullable(params.memo), + from_subaccount: toNullable(params.from_subaccount), + created_at_time: toNullable(params.created_at_time), + }); + }); + }); + + describe("toTransferFromArgs", () => { + it("should transform TransferFromParams to TransferFromArgs correctly", () => { + const params: TransferFromParams = { + from: { owner, subaccount: [[4, 5, 6]] }, + to: { owner, subaccount: [[1, 2, 3]] }, + amount: BigInt(500), + fee: BigInt(5), + memo: new Uint8Array([7, 8, 9]), + spender_subaccount: new Uint8Array([10, 11, 12]), + created_at_time: BigInt(12345), + }; + + const result = toTransferFromArgs(params); + + expect(result).toEqual({ + from: params.from, + to: params.to, + amount: params.amount, + fee: toNullable(params.fee), + memo: toNullable(params.memo), + spender_subaccount: toNullable(params.spender_subaccount), + created_at_time: toNullable(params.created_at_time), + }); + }); + }); + + describe("toApproveArgs", () => { + it("should transform ApproveParams to ApproveArgs correctly", () => { + const params: ApproveParams = { + spender: { owner, subaccount: [[7, 8, 9]] }, + amount: BigInt(200), + fee: BigInt(2), + memo: new Uint8Array([13, 14, 15]), + from_subaccount: new Uint8Array([16, 17, 18]), + created_at_time: BigInt(56789), + expected_allowance: BigInt(100), + expires_at: BigInt(98765), + }; + + const result = toApproveArgs(params); + + expect(result).toEqual({ + spender: params.spender, + amount: params.amount, + fee: toNullable(params.fee), + memo: toNullable(params.memo), + from_subaccount: toNullable(params.from_subaccount), + created_at_time: toNullable(params.created_at_time), + expected_allowance: toNullable(params.expected_allowance), + expires_at: toNullable(params.expires_at), + }); + }); + }); + + describe("toIcrc21ConsentMessageArgs", () => { + it("should transform Icrc21ConsentMessageParams to ConsentMessageArgs correctly", () => { + const params: Icrc21ConsentMessageParams = { + method: "someMethod", + arg: new Uint8Array([21, 22, 23]), + userPreferences: { + metadata: { + language: "en", + utcOffsetMinutes: 120, + }, + deriveSpec: { + LineDisplay: { + charactersPerLine: 40, + linesPerPage: 10, + }, + }, + }, + }; + + const result = toIcrc21ConsentMessageArgs(params); + + expect(result).toEqual({ + method: params.method, + arg: params.arg, + user_preferences: { + metadata: { + language: params.userPreferences.metadata.language, + utc_offset_minutes: toNullable( + params.userPreferences.metadata.utcOffsetMinutes, + ), + }, + device_spec: toNullable({ + LineDisplay: { + characters_per_line: 40, + lines_per_page: 10, + }, + }), + }, + }); + }); + + it("should handle undefined deriveSpec in userPreferences", () => { + const params: Icrc21ConsentMessageParams = { + method: "someMethod", + arg: new Uint8Array([21, 22, 23]), + userPreferences: { + metadata: { + language: "en", + utcOffsetMinutes: 120, + }, + }, + }; + + const result = toIcrc21ConsentMessageArgs(params); + + expect(result).toEqual({ + method: params.method, + arg: params.arg, + user_preferences: { + metadata: { + language: params.userPreferences.metadata.language, + utc_offset_minutes: toNullable( + params.userPreferences.metadata.utcOffsetMinutes, + ), + }, + device_spec: toNullable(), + }, + }); + }); + }); +}); diff --git a/packages/ledger-icrc/src/index.ts b/packages/ledger-icrc/src/index.ts index faf02d4e..b9105d6b 100644 --- a/packages/ledger-icrc/src/index.ts +++ b/packages/ledger-icrc/src/index.ts @@ -6,6 +6,7 @@ export type { TransferError as IcrcTransferVariatError, Value as IcrcValue, } from "../candid/icrc_ledger"; +export * from "./converters/ledger.converters"; export * from "./errors/index.errors"; export * from "./errors/ledger.errors"; export { IcrcIndexNgCanister } from "./index-ng.canister"; diff --git a/packages/nns/candid/genesis_token.did b/packages/nns/candid/genesis_token.did index dda1f982..a619d35f 100644 --- a/packages/nns/candid/genesis_token.did +++ b/packages/nns/candid/genesis_token.did @@ -1,4 +1,4 @@ -// Generated from IC repo commit 0441f40 (2024-09-18 tags: release-2024-09-19_01-31-base) 'rs/nns/gtc/canister/gtc.did' by import-candid +// Generated from IC repo commit c43a488 (2024-09-27 tags: release-2024-09-26_01-31-no-canister-snapshots) 'rs/nns/gtc/canister/gtc.did' by import-candid type AccountState = record { authenticated_principal_id : opt principal; successfully_transferred_neurons : vec TransferredNeuron; diff --git a/packages/nns/candid/governance.did b/packages/nns/candid/governance.did index 708d59cb..770f0e6c 100644 --- a/packages/nns/candid/governance.did +++ b/packages/nns/candid/governance.did @@ -1,4 +1,4 @@ -// Generated from IC repo commit 0441f40 (2024-09-18 tags: release-2024-09-19_01-31-base) 'rs/nns/governance/canister/governance.did' by import-candid +// Generated from IC repo commit c43a488 (2024-09-27 tags: release-2024-09-26_01-31-no-canister-snapshots) 'rs/nns/governance/canister/governance.did' by import-candid type AccountIdentifier = record { hash : blob; }; diff --git a/packages/nns/candid/governance_test.did b/packages/nns/candid/governance_test.did index b1caf3e1..efae9cb4 100644 --- a/packages/nns/candid/governance_test.did +++ b/packages/nns/candid/governance_test.did @@ -1,4 +1,4 @@ -// Generated from IC repo commit 0441f40 (2024-09-18 tags: release-2024-09-19_01-31-base) 'rs/nns/governance/canister/governance_test.did' by import-candid +// Generated from IC repo commit c43a488 (2024-09-27 tags: release-2024-09-26_01-31-no-canister-snapshots) 'rs/nns/governance/canister/governance_test.did' by import-candid type AccountIdentifier = record { hash : blob; }; diff --git a/packages/nns/candid/sns_wasm.did b/packages/nns/candid/sns_wasm.did index 6754b7c7..9a0d08c3 100644 --- a/packages/nns/candid/sns_wasm.did +++ b/packages/nns/candid/sns_wasm.did @@ -1,4 +1,4 @@ -// Generated from IC repo commit 0441f40 (2024-09-18 tags: release-2024-09-19_01-31-base) 'rs/nns/sns-wasm/canister/sns-wasm.did' by import-candid +// Generated from IC repo commit c43a488 (2024-09-27 tags: release-2024-09-26_01-31-no-canister-snapshots) 'rs/nns/sns-wasm/canister/sns-wasm.did' by import-candid type AddWasmRequest = record { hash : blob; wasm : opt SnsWasm; diff --git a/packages/nns/package.json b/packages/nns/package.json index 1165e5cb..442b17d3 100644 --- a/packages/nns/package.json +++ b/packages/nns/package.json @@ -1,6 +1,6 @@ { "name": "@dfinity/nns", - "version": "6.0.0", + "version": "7.0.0", "description": "A library for interfacing with the Internet Computer's Network Nervous System.", "license": "Apache-2.0", "main": "dist/cjs/index.cjs.js", @@ -51,10 +51,10 @@ "network-nervous-system" ], "peerDependencies": { - "@dfinity/agent": "^2.1.1", - "@dfinity/candid": "^2.1.1", - "@dfinity/ledger-icp": "^2.5.0", - "@dfinity/principal": "^2.1.1", - "@dfinity/utils": "^2.5.0" + "@dfinity/agent": "^2.1.2", + "@dfinity/candid": "^2.1.2", + "@dfinity/ledger-icp": "^2.6.0", + "@dfinity/principal": "^2.1.2", + "@dfinity/utils": "^2.5.1" } } diff --git a/packages/sns/candid/sns_governance.did b/packages/sns/candid/sns_governance.did index f1ce6b68..49d8f49d 100644 --- a/packages/sns/candid/sns_governance.did +++ b/packages/sns/candid/sns_governance.did @@ -1,4 +1,4 @@ -// Generated from IC repo commit 0441f40 (2024-09-18 tags: release-2024-09-19_01-31-base) 'rs/sns/governance/canister/governance.did' by import-candid +// Generated from IC repo commit c43a488 (2024-09-27 tags: release-2024-09-26_01-31-no-canister-snapshots) 'rs/sns/governance/canister/governance.did' by import-candid type Account = record { owner : opt principal; subaccount : opt Subaccount; diff --git a/packages/sns/candid/sns_governance_test.did b/packages/sns/candid/sns_governance_test.did index a471dfa9..46066af2 100644 --- a/packages/sns/candid/sns_governance_test.did +++ b/packages/sns/candid/sns_governance_test.did @@ -1,4 +1,4 @@ -// Generated from IC repo commit 0441f40 (2024-09-18 tags: release-2024-09-19_01-31-base) 'rs/sns/governance/canister/governance_test.did' by import-candid +// Generated from IC repo commit c43a488 (2024-09-27 tags: release-2024-09-26_01-31-no-canister-snapshots) 'rs/sns/governance/canister/governance_test.did' by import-candid type Account = record { owner : opt principal; subaccount : opt Subaccount; diff --git a/packages/sns/candid/sns_root.did b/packages/sns/candid/sns_root.did index f3de2839..694d7256 100644 --- a/packages/sns/candid/sns_root.did +++ b/packages/sns/candid/sns_root.did @@ -1,4 +1,4 @@ -// Generated from IC repo commit 0441f40 (2024-09-18 tags: release-2024-09-19_01-31-base) 'rs/sns/root/canister/root.did' by import-candid +// Generated from IC repo commit c43a488 (2024-09-27 tags: release-2024-09-26_01-31-no-canister-snapshots) 'rs/sns/root/canister/root.did' by import-candid type CanisterCallError = record { code : opt int32; description : text; diff --git a/packages/sns/candid/sns_swap.did b/packages/sns/candid/sns_swap.did index 74ac0577..8b49e6ac 100644 --- a/packages/sns/candid/sns_swap.did +++ b/packages/sns/candid/sns_swap.did @@ -1,4 +1,4 @@ -// Generated from IC repo commit 0441f40 (2024-09-18 tags: release-2024-09-19_01-31-base) 'rs/sns/swap/canister/swap.did' by import-candid +// Generated from IC repo commit c43a488 (2024-09-27 tags: release-2024-09-26_01-31-no-canister-snapshots) 'rs/sns/swap/canister/swap.did' by import-candid type BuyerState = record { icp : opt TransferableAmount; has_created_neuron_recipes : opt bool; diff --git a/packages/sns/package.json b/packages/sns/package.json index 1c82562a..e5aa5683 100644 --- a/packages/sns/package.json +++ b/packages/sns/package.json @@ -1,6 +1,6 @@ { "name": "@dfinity/sns", - "version": "3.2.0", + "version": "3.2.1", "description": "A library for interfacing with a Service Nervous System (SNS) project.", "license": "Apache-2.0", "main": "dist/cjs/index.cjs.js", @@ -36,11 +36,11 @@ "sns" ], "peerDependencies": { - "@dfinity/agent": "^2.1.1", - "@dfinity/candid": "^2.1.1", - "@dfinity/ledger-icrc": "^2.5.0", - "@dfinity/principal": "^2.1.1", - "@dfinity/utils": "^2.5.0" + "@dfinity/agent": "^2.1.2", + "@dfinity/candid": "^2.1.2", + "@dfinity/ledger-icrc": "^2.6.0", + "@dfinity/principal": "^2.1.2", + "@dfinity/utils": "^2.5.1" }, "dependencies": { "@noble/hashes": "^1.3.2" diff --git a/packages/utils/package.json b/packages/utils/package.json index 8ec601f8..3134a8d9 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@dfinity/utils", - "version": "2.5.0", + "version": "2.5.1", "description": "A collection of utilities and constants for NNS/SNS projects.", "license": "Apache-2.0", "main": "dist/cjs/index.cjs.js", @@ -47,8 +47,8 @@ "service-nervous-system" ], "peerDependencies": { - "@dfinity/agent": "^2.1.1", - "@dfinity/candid": "^2.1.1", - "@dfinity/principal": "^2.1.1" + "@dfinity/agent": "^2.1.2", + "@dfinity/candid": "^2.1.2", + "@dfinity/principal": "^2.1.2" } }