diff --git a/examples/motoko_examples/calc/src/index.ts b/examples/motoko_examples/calc/src/index.ts index 99f6b10fa9..2e49226add 100644 --- a/examples/motoko_examples/calc/src/index.ts +++ b/examples/motoko_examples/calc/src/index.ts @@ -8,19 +8,16 @@ export default Service({ return cell; }), - sub: update([int], int, (n) => { cell -= n; return cell; }), - mul: update([int], int, (n) => { cell *= n; return cell; }), - div: update([int], Opt(int), (n) => { if (n === 0n) { return None; @@ -29,7 +26,6 @@ export default Service({ return Some(cell); } }), - clearall: update([], Void, () => { cell = 0n; }) diff --git a/examples/motoko_examples/counter/src/index.ts b/examples/motoko_examples/counter/src/index.ts index 8e801a61c6..989f0daff2 100644 --- a/examples/motoko_examples/counter/src/index.ts +++ b/examples/motoko_examples/counter/src/index.ts @@ -6,11 +6,9 @@ export default Service({ get: query([], nat, () => { return counter; }), - set: update([nat], Void, (n) => { counter = n; }), - inc: update([], Void, () => { counter += 1n; }) diff --git a/examples/motoko_examples/http_counter/src/index.ts b/examples/motoko_examples/http_counter/src/index.ts index a1c3978df3..6634ea591f 100644 --- a/examples/motoko_examples/http_counter/src/index.ts +++ b/examples/motoko_examples/http_counter/src/index.ts @@ -65,7 +65,6 @@ export default Service({ init: init([], () => { stableStorage.insert('counter', 0n); }), - http_request: query([HttpRequest], HttpResponse, (req) => { console.log('Hello from http_request'); @@ -141,7 +140,6 @@ export default Service({ upgrade: None }; }), - http_request_update: update([HttpRequest], HttpResponse, (req) => { if (req.method === 'POST') { const counterOpt = stableStorage.get('counter'); @@ -196,7 +194,6 @@ export default Service({ upgrade: None }; }), - http_streaming: query([Token], StreamingCallbackHttpResponse, (token) => { console.log('Hello from http_streaming'); switch (token.arbitrary_data) { diff --git a/examples/motoko_examples/minimal-counter-dapp/src/minimal_dapp/index.ts b/examples/motoko_examples/minimal-counter-dapp/src/minimal_dapp/index.ts index c6049e0a23..ecc2b4f330 100644 --- a/examples/motoko_examples/minimal-counter-dapp/src/minimal_dapp/index.ts +++ b/examples/motoko_examples/minimal-counter-dapp/src/minimal_dapp/index.ts @@ -8,11 +8,9 @@ export default Service({ return counter; }), - getCount: query([], nat, () => { return counter; }), - reset: update([], nat, () => { counter = 0n; diff --git a/examples/motoko_examples/persistent-storage/src/index.ts b/examples/motoko_examples/persistent-storage/src/index.ts index ffc0aaae4b..a80c4e4b15 100644 --- a/examples/motoko_examples/persistent-storage/src/index.ts +++ b/examples/motoko_examples/persistent-storage/src/index.ts @@ -15,7 +15,6 @@ export default Service({ init: init([], () => { stableStorage.insert('counter', 0n); }), - increment: update([], nat, () => { const counterOpt = stableStorage.get('counter'); const counter = @@ -27,7 +26,6 @@ export default Service({ return counter; }), - get: query([], nat, () => { const counterOpt = stableStorage.get('counter'); const counter = @@ -37,7 +35,6 @@ export default Service({ return counter; }), - reset: update([], nat, () => { stableStorage.insert('counter', 0n); diff --git a/examples/motoko_examples/phone-book/src/phone_book/index.ts b/examples/motoko_examples/phone-book/src/phone_book/index.ts index a34cc9097e..fcd5c82f7b 100644 --- a/examples/motoko_examples/phone-book/src/phone_book/index.ts +++ b/examples/motoko_examples/phone-book/src/phone_book/index.ts @@ -21,7 +21,6 @@ export default Service({ insert: update([text, Entry], Void, (name, entry) => { phoneBook.set(name, entry); }), - lookup: query([text], Opt(Entry), (name) => { const entryOrUndefined = phoneBook.get(name); diff --git a/examples/motoko_examples/simple-to-do/src/index.ts b/examples/motoko_examples/simple-to-do/src/index.ts index e7cb4dc6fd..a24558d7f2 100644 --- a/examples/motoko_examples/simple-to-do/src/index.ts +++ b/examples/motoko_examples/simple-to-do/src/index.ts @@ -22,7 +22,6 @@ export default Service({ getTodos: query([], Vec(ToDo), () => { return Array.from(todos.values()); }), - // Returns the ID that was given to the ToDo item addTodo: update([text], nat, (description) => { const id = nextId; @@ -34,7 +33,6 @@ export default Service({ return id; }), - completeTodo: update([nat], Void, (id) => { let todo = todos.get(id); @@ -45,7 +43,6 @@ export default Service({ }); } }), - showTodos: query([], text, () => { let output = '\n___TO-DOs___'; for (const todoEntry of [...todos]) { @@ -56,7 +53,6 @@ export default Service({ } return output; }), - clearCompleted: update([], Void, () => { // NOTE: this syntax isn't supported in Boa. If we revert to using Boa // we'll need to revert the syntax to: diff --git a/examples/motoko_examples/superheroes/src/superheroes/index.ts b/examples/motoko_examples/superheroes/src/superheroes/index.ts index ee859d087e..f9f4e78828 100644 --- a/examples/motoko_examples/superheroes/src/superheroes/index.ts +++ b/examples/motoko_examples/superheroes/src/superheroes/index.ts @@ -50,13 +50,11 @@ export default Service({ return superheroId; }), - // Read a superhero. read: query([SuperheroId], Opt(Superhero), (superheroId) => { const superheroOrUndefined = superheroes.get(superheroId); return superheroOrUndefined ? Some(superheroOrUndefined) : None; }), - // Update a superhero. update: update([SuperheroId, Superhero], bool, (superheroId, superhero) => { let result = superheroes.get(superheroId); @@ -66,7 +64,6 @@ export default Service({ return !!result; }), - // Delete a superhero. deleteHero: update([SuperheroId], bool, (superheroId) => { let result = superheroes.get(superheroId); diff --git a/examples/motoko_examples/whoami/src/index.ts b/examples/motoko_examples/whoami/src/index.ts index f58727736a..5d6a8ddd45 100644 --- a/examples/motoko_examples/whoami/src/index.ts +++ b/examples/motoko_examples/whoami/src/index.ts @@ -23,28 +23,23 @@ export default Service({ install = ic.caller(); someone = somebody; }), - // Manually re-save these variables after new deploys. postUpgrade: postUpgrade([principal], (somebody) => { install = ic.caller(); someone = somebody; }), - // Return the principal identifier of the wallet canister that installed this // canister. installer: query([], principal, () => { return install; }), - // Return the principal identifier that was provided as an installation // argument to this canister. argument: query([], principal, () => { return someone; }), - // Return the principal identifier of the caller of this method. whoami, - // Return the principal identifier of this canister. id: update([], principal, async () => { // TODO This is not an ideal solution but will work for now @@ -54,7 +49,6 @@ export default Service({ return await ic.call(self.whoami); }), - // Return the principal identifier of this canister via the global `ic` object. // This is much quicker than `id()` above because it isn't making a cross- // canister call to itself. Additionally, it can now be a `Query` which means it diff --git a/examples/notify_raw/canisters/canister2/index.ts b/examples/notify_raw/canisters/canister2/index.ts index 3466309b16..dc2581be94 100644 --- a/examples/notify_raw/canisters/canister2/index.ts +++ b/examples/notify_raw/canisters/canister2/index.ts @@ -6,7 +6,6 @@ export default Service({ receiveNotification: update([], Void, () => { notified = true; }), - getNotified: query([], bool, () => { return notified; }) diff --git a/examples/null_example/src/index.ts b/examples/null_example/src/index.ts index 19dd05b895..6df8ab67fe 100644 --- a/examples/null_example/src/index.ts +++ b/examples/null_example/src/index.ts @@ -21,13 +21,11 @@ export default Service({ nullFunction: query([Null], Null, (param) => { return param; }), - voidIsNotNull: query([], Void, () => { ic.print( 'Even though they are both None in Python, for Candid null and void are different.' ); }), - getPartiallyNullRecord: query([], PartiallyNullRecord, () => { return { firstItem: 1n, @@ -35,7 +33,6 @@ export default Service({ thirdItem: 3n }; }), - setPartiallyNullRecord: update( [PartiallyNullRecord], PartiallyNullRecord, @@ -43,18 +40,15 @@ export default Service({ return param; } ), - getSmallNullRecord: query([], TwoNullRecord, () => { return { firstItem: null, secondItem: null }; }), - setSmallNullRecord: update([TwoNullRecord], TwoNullRecord, (param) => { return param; }), - getLargeNullRecord: query([], ThreeNullRecord, () => { return { firstItem: null, @@ -62,7 +56,6 @@ export default Service({ thirdItem: null }; }), - setLargeNullRecord: update([ThreeNullRecord], ThreeNullRecord, (param) => { return param; }) diff --git a/examples/optional_types/src/index.ts b/examples/optional_types/src/index.ts index 780a4a91cb..667e2b04be 100644 --- a/examples/optional_types/src/index.ts +++ b/examples/optional_types/src/index.ts @@ -20,7 +20,6 @@ export default Service({ head: [] }; }), - getHead: query([], Opt(Head), () => { return [ { @@ -28,7 +27,6 @@ export default Service({ } ]; }), - getHeadWithElements: query([], Opt(Head), () => { return [ { @@ -40,19 +38,15 @@ export default Service({ } ]; }), - getElement: query([Opt(Opt(Element))], Opt(Opt(Element)), (element) => { return element; }), - getNull: query([], Null, () => { return null; }), - getOptNull: query([], Opt(text), () => { return []; }), - stringToBoolean: query([Opt(text)], bool, (optString) => { if (optString.length > 0) { return true; diff --git a/examples/outgoing_http_requests/src/index.ts b/examples/outgoing_http_requests/src/index.ts index e41d514cb0..7ff6d68109 100644 --- a/examples/outgoing_http_requests/src/index.ts +++ b/examples/outgoing_http_requests/src/index.ts @@ -38,7 +38,6 @@ export default Service({ cycles: 50_000_000n }); }), - // TODO the replica logs give some concerning output: https://forum.dfinity.org/t/fix-me-in-http-outcalls-call-raw/19435 xkcdRaw: update( [], @@ -68,7 +67,6 @@ export default Service({ }, { manual: true } ), - xkcdTransform: query([HttpTransformArgs], HttpResponse, (args) => { return { ...args.response, diff --git a/examples/rejections/canisters/rejections/index.ts b/examples/rejections/canisters/rejections/index.ts index c7b9a3bcb6..07beff84d1 100644 --- a/examples/rejections/canisters/rejections/index.ts +++ b/examples/rejections/canisters/rejections/index.ts @@ -30,13 +30,11 @@ export default Service({ Principal.fromText('rkp4c-7iaaa-aaaaa-aaaca-cai') ); }), - getRejectionCodeNoError: update([], RejectionCode, async () => { await ic.call(someService.accept); return ic.rejectCode(); }), - getRejectionCodeDestinationInvalid: update([], RejectionCode, async () => { try { await ic.call(nonexistentCanister.method); @@ -44,7 +42,6 @@ export default Service({ return ic.rejectCode(); }), - getRejectionCodeCanisterReject: update([], RejectionCode, async () => { try { await ic.call(someService.reject, { args: ['reject'] }); @@ -52,7 +49,6 @@ export default Service({ return ic.rejectCode(); }), - getRejectionCodeCanisterError: update([], RejectionCode, async () => { try { await ic.call(someService.error); @@ -60,7 +56,6 @@ export default Service({ return ic.rejectCode(); }), - getRejectionMessage: update([text], text, async (message: text) => { try { await ic.call(someService.reject, { args: [message] });