From 3187b575299d3f1d70c6cde0a289065ed7b9bc19 Mon Sep 17 00:00:00 2001 From: chenyan-dfinity Date: Thu, 17 Sep 2020 17:05:41 -0700 Subject: [PATCH 1/3] update management canister interface --- package-lock.json | 20 ++++---- packages/agent/src/actor.ts | 2 +- .../agent/src/canisters/management_idl.ts | 47 +++++++++++++++---- 3 files changed, 47 insertions(+), 22 deletions(-) diff --git a/package-lock.json b/package-lock.json index fff29752d..559a271c9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -955,17 +955,6 @@ "npm-buffer": "npm:buffer@^5.4.3", "simple-cbor": "^0.4.1", "tweetnacl": "^1.0.1" - }, - "dependencies": { - "npm-buffer": { - "version": "npm:buffer@5.6.0", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz", - "integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==", - "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4" - } - } } }, "@dfinity/agent-js-devtools": { @@ -5482,6 +5471,15 @@ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" }, + "npm-buffer": { + "version": "npm:buffer@5.6.0", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz", + "integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==", + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4" + } + }, "npm-run-path": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", diff --git a/packages/agent/src/actor.ts b/packages/agent/src/actor.ts index 6c139e35f..0e284a52e 100644 --- a/packages/agent/src/actor.ts +++ b/packages/agent/src/actor.ts @@ -332,7 +332,7 @@ async function _requestStatusAndLoop( // we don't know the result and cannot decode it. throw new Error( `Call was marked as done but we never saw the reply:\n` + - ` Request ID: ${requestIdToHex(requestId)}\n` + ` Request ID: ${requestIdToHex(requestId)}\n`, ); } } diff --git a/packages/agent/src/canisters/management_idl.ts b/packages/agent/src/canisters/management_idl.ts index d39417068..63863c2d5 100644 --- a/packages/agent/src/canisters/management_idl.ts +++ b/packages/agent/src/canisters/management_idl.ts @@ -1,5 +1,6 @@ /** - * This file is generated from the candid for asset management. + * This file is generated from public spec 0.10. + * didc bind ic.did -t js */ /* tslint:disable */ // @ts-ignore @@ -7,25 +8,51 @@ export default ({ IDL }) => { const canister_id = IDL.Principal; const wasm_module = IDL.Vec(IDL.Nat8); return IDL.Service({ - create_canister: IDL.Func([], [IDL.Record({ canister_id: canister_id })], []), - install_code: IDL.Func( + stop_canister: IDL.Func([IDL.Record({ canister_id: canister_id })], [], []), + start_canister: IDL.Func([IDL.Record({ canister_id: canister_id })], [], []), + canister_status: IDL.Func( + [IDL.Record({ canister_id: canister_id })], + [ + IDL.Record({ + status: IDL.Variant({ + stopped: IDL.Null, + stopping: IDL.Null, + running: IDL.Null, + }), + }), + ], + [], + ), + delete_canister: IDL.Func([IDL.Record({ canister_id: canister_id })], [], []), + set_controller: IDL.Func( [ IDL.Record({ - mode: IDL.Variant({ install: IDL.Null, reinstall: IDL.Null, upgrade: IDL.Null }), canister_id: canister_id, - wasm_module: wasm_module, - arg: IDL.Vec(IDL.Nat8), - compute_allocation: IDL.Opt(IDL.Nat), - memory_allocation: IDL.Opt(IDL.Nat), + new_controller: IDL.Principal, }), ], [], [], ), - set_controller: IDL.Func( - [IDL.Record({ canister_id: canister_id, new_controller: IDL.Principal })], + install_code: IDL.Func( + [ + IDL.Record({ + arg: IDL.Vec(IDL.Nat8), + wasm_module: wasm_module, + mode: IDL.Variant({ + reinstall: IDL.Null, + upgrade: IDL.Null, + install: IDL.Null, + }), + canister_id: canister_id, + memory_allocation: IDL.Opt(IDL.Nat), + compute_allocation: IDL.Opt(IDL.Nat), + }), + ], [], [], ), + raw_rand: IDL.Func([], [IDL.Vec(IDL.Nat8)], []), + create_canister: IDL.Func([], [IDL.Record({ canister_id: canister_id })], []), }); }; From ffd7159f8f9480de08bea52baeb487791e1ec801 Mon Sep 17 00:00:00 2001 From: chenyan-dfinity Date: Thu, 17 Sep 2020 17:13:11 -0700 Subject: [PATCH 2/3] fix --- package-lock.json | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 559a271c9..fff29752d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -955,6 +955,17 @@ "npm-buffer": "npm:buffer@^5.4.3", "simple-cbor": "^0.4.1", "tweetnacl": "^1.0.1" + }, + "dependencies": { + "npm-buffer": { + "version": "npm:buffer@5.6.0", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz", + "integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==", + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4" + } + } } }, "@dfinity/agent-js-devtools": { @@ -5471,15 +5482,6 @@ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" }, - "npm-buffer": { - "version": "npm:buffer@5.6.0", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz", - "integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==", - "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4" - } - }, "npm-run-path": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", From d103e9c068fd89efc451a89fb6a8a8d328b47eb0 Mon Sep 17 00:00:00 2001 From: chenyan-dfinity Date: Tue, 22 Sep 2020 11:50:48 -0700 Subject: [PATCH 3/3] update asset idl --- packages/agent/src/canisters/asset.ts | 1 + packages/agent/src/canisters/asset_idl.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/agent/src/canisters/asset.ts b/packages/agent/src/canisters/asset.ts index d4dc6754f..52b28cc0c 100644 --- a/packages/agent/src/canisters/asset.ts +++ b/packages/agent/src/canisters/asset.ts @@ -5,6 +5,7 @@ import assetCanister from './asset_idl'; export interface AssetCanisterRecord { store(path: string, content: number[]): Promise; retrieve(path: string): Promise; + list(): Promise; } /* tslint:enable */ diff --git a/packages/agent/src/canisters/asset_idl.ts b/packages/agent/src/canisters/asset_idl.ts index a698ae31d..db8b0ea99 100644 --- a/packages/agent/src/canisters/asset_idl.ts +++ b/packages/agent/src/canisters/asset_idl.ts @@ -7,5 +7,6 @@ export default ({ IDL }) => { return IDL.Service({ retrieve: IDL.Func([IDL.Text], [IDL.Vec(IDL.Nat8)], ['query']), store: IDL.Func([IDL.Text, IDL.Vec(IDL.Nat8)], [], []), + list: IDL.Func([], [IDL.Vec(IDL.Text)], ['query']), }); };