From bf5c04cefbaa392187a785762e8846b155f2a516 Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Thu, 28 Mar 2024 15:13:30 -0500 Subject: [PATCH] update candid files and such --- examples/apollo_server/src/index.did | 4 +- .../audio_and_video/src/backend/server.did | 4 +- examples/autoreload/src/server.did | 4 +- examples/basic_bitcoin/package-lock.json | 4 +- examples/counter/src/index.did | 2 +- examples/ethers/src/index.did | 4 +- examples/express/src/backend/index.did | 4 +- examples/fetch_ic/src/backend/server.did | 4 +- examples/file_protocol/src/backend.did | 4 +- examples/fs/src/index.did | 4 +- examples/guard_functions/test/tests.ts | 1 - examples/hello_world/src/backend/index.did | 4 +- examples/imports/src/index.did | 4 +- .../internet_identity/src/backend/server.did | 4 +- examples/motoko_examples/calc/src/index.did | 6 +- .../motoko_examples/counter/src/index.did | 2 +- .../src/declarations/phone_book/index.js | 5 +- .../phone_book/phone_book.did.d.ts | 3 + .../simple-to-do/src/index.did | 5 +- .../superheroes/src/declarations/index.js | 3 +- .../src/declarations/superheroes.did | 16 +-- .../src/declarations/superheroes.did.d.ts | 15 +- .../src/declarations/superheroes.did.js | 18 +-- .../superheroes/src/superheroes/index.did | 16 +-- examples/null_example/src/index.did | 21 +-- examples/optional_types/src/index.did | 17 +-- examples/pre_and_post_upgrade/src/index.did | 6 +- .../primitive_ops/canisters/azle/index.did | 129 ++++++------------ examples/principal/src/index.did | 16 +-- examples/simple_erc20/src/index.did | 6 +- examples/sqlite/src/index.did | 4 +- examples/tfjs/src/api.did | 4 +- examples/tuple_types/src/index.did | 22 +-- examples/web_assembly/src/index.did | 4 +- scripts/update_candid.sh | 18 ++- 35 files changed, 164 insertions(+), 223 deletions(-) diff --git a/examples/apollo_server/src/index.did b/examples/apollo_server/src/index.did index 02c019ab7d..7bf084795e 100644 --- a/examples/apollo_server/src/index.did +++ b/examples/apollo_server/src/index.did @@ -1,4 +1,4 @@ service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:record {}; callback:func (record {}) -> (opt record {token:opt record {}; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:record {}; callback:func (record {}) -> (opt record {token:opt record {}; body:vec nat8}) query}}; status_code:nat16}); + http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; + http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); } diff --git a/examples/audio_and_video/src/backend/server.did b/examples/audio_and_video/src/backend/server.did index 02c019ab7d..7bf084795e 100644 --- a/examples/audio_and_video/src/backend/server.did +++ b/examples/audio_and_video/src/backend/server.did @@ -1,4 +1,4 @@ service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:record {}; callback:func (record {}) -> (opt record {token:opt record {}; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:record {}; callback:func (record {}) -> (opt record {token:opt record {}; body:vec nat8}) query}}; status_code:nat16}); + http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; + http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); } diff --git a/examples/autoreload/src/server.did b/examples/autoreload/src/server.did index 02c019ab7d..7bf084795e 100644 --- a/examples/autoreload/src/server.did +++ b/examples/autoreload/src/server.did @@ -1,4 +1,4 @@ service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:record {}; callback:func (record {}) -> (opt record {token:opt record {}; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:record {}; callback:func (record {}) -> (opt record {token:opt record {}; body:vec nat8}) query}}; status_code:nat16}); + http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; + http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); } diff --git a/examples/basic_bitcoin/package-lock.json b/examples/basic_bitcoin/package-lock.json index 8452bc575e..e37ea6042a 100644 --- a/examples/basic_bitcoin/package-lock.json +++ b/examples/basic_bitcoin/package-lock.json @@ -8,14 +8,14 @@ "assert": "2.0.0", "azle": "0.16.3", "bs58": "5.0.0", - "events": "^3.3.0", + "events": "3.3.0", "hex-array": "1.0.0", "js-sha256": "0.9.0", "ripemd160": "2.0.2" }, "devDependencies": { "@dfinity/agent": "0.11.1", - "@types/hex-array": "^1.0.0", + "@types/hex-array": "1.0.0", "@types/ripemd160": "2.0.0", "ts-node": "10.7.0", "typescript": "4.6.3" diff --git a/examples/counter/src/index.did b/examples/counter/src/index.did index 7a1c728f10..3c92dce14e 100644 --- a/examples/counter/src/index.did +++ b/examples/counter/src/index.did @@ -1,4 +1,4 @@ service: () -> { - readCount: () -> (nat64) query; incrementCount: () -> (nat64); + readCount: () -> (nat64) query; } diff --git a/examples/ethers/src/index.did b/examples/ethers/src/index.did index 02c019ab7d..7bf084795e 100644 --- a/examples/ethers/src/index.did +++ b/examples/ethers/src/index.did @@ -1,4 +1,4 @@ service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:record {}; callback:func (record {}) -> (opt record {token:opt record {}; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:record {}; callback:func (record {}) -> (opt record {token:opt record {}; body:vec nat8}) query}}; status_code:nat16}); + http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; + http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); } diff --git a/examples/express/src/backend/index.did b/examples/express/src/backend/index.did index 02c019ab7d..7bf084795e 100644 --- a/examples/express/src/backend/index.did +++ b/examples/express/src/backend/index.did @@ -1,4 +1,4 @@ service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:record {}; callback:func (record {}) -> (opt record {token:opt record {}; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:record {}; callback:func (record {}) -> (opt record {token:opt record {}; body:vec nat8}) query}}; status_code:nat16}); + http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; + http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); } diff --git a/examples/fetch_ic/src/backend/server.did b/examples/fetch_ic/src/backend/server.did index 02c019ab7d..7bf084795e 100644 --- a/examples/fetch_ic/src/backend/server.did +++ b/examples/fetch_ic/src/backend/server.did @@ -1,4 +1,4 @@ service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:record {}; callback:func (record {}) -> (opt record {token:opt record {}; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:record {}; callback:func (record {}) -> (opt record {token:opt record {}; body:vec nat8}) query}}; status_code:nat16}); + http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; + http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); } diff --git a/examples/file_protocol/src/backend.did b/examples/file_protocol/src/backend.did index 02c019ab7d..7bf084795e 100644 --- a/examples/file_protocol/src/backend.did +++ b/examples/file_protocol/src/backend.did @@ -1,4 +1,4 @@ service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:record {}; callback:func (record {}) -> (opt record {token:opt record {}; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:record {}; callback:func (record {}) -> (opt record {token:opt record {}; body:vec nat8}) query}}; status_code:nat16}); + http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; + http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); } diff --git a/examples/fs/src/index.did b/examples/fs/src/index.did index 02c019ab7d..7bf084795e 100644 --- a/examples/fs/src/index.did +++ b/examples/fs/src/index.did @@ -1,4 +1,4 @@ service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:record {}; callback:func (record {}) -> (opt record {token:opt record {}; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:record {}; callback:func (record {}) -> (opt record {token:opt record {}; body:vec nat8}) query}}; status_code:nat16}); + http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; + http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); } diff --git a/examples/guard_functions/test/tests.ts b/examples/guard_functions/test/tests.ts index 737da6bcd6..ff5a3c83ba 100644 --- a/examples/guard_functions/test/tests.ts +++ b/examples/guard_functions/test/tests.ts @@ -1,4 +1,3 @@ -import { execSync } from 'child_process'; import { ActorSubclass } from '@dfinity/agent'; import { AgentError } from '@dfinity/agent/lib/cjs/errors'; import { Test } from 'azle/test'; diff --git a/examples/hello_world/src/backend/index.did b/examples/hello_world/src/backend/index.did index 02c019ab7d..7bf084795e 100644 --- a/examples/hello_world/src/backend/index.did +++ b/examples/hello_world/src/backend/index.did @@ -1,4 +1,4 @@ service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:record {}; callback:func (record {}) -> (opt record {token:opt record {}; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:record {}; callback:func (record {}) -> (opt record {token:opt record {}; body:vec nat8}) query}}; status_code:nat16}); + http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; + http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); } diff --git a/examples/imports/src/index.did b/examples/imports/src/index.did index a545222b59..2c9c4bd552 100644 --- a/examples/imports/src/index.did +++ b/examples/imports/src/index.did @@ -1,7 +1,7 @@ service: () -> { + getMathMessage: () -> (int) query; getOne: () -> (text) query; - getTwo: () -> (text) query; getThree: () -> (text) query; + getTwo: () -> (text) query; sha224Hash: (text) -> (text) query; - getMathMessage: () -> (int) query; } diff --git a/examples/internet_identity/src/backend/server.did b/examples/internet_identity/src/backend/server.did index 02c019ab7d..7bf084795e 100644 --- a/examples/internet_identity/src/backend/server.did +++ b/examples/internet_identity/src/backend/server.did @@ -1,4 +1,4 @@ service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:record {}; callback:func (record {}) -> (opt record {token:opt record {}; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:record {}; callback:func (record {}) -> (opt record {token:opt record {}; body:vec nat8}) query}}; status_code:nat16}); + http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; + http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); } diff --git a/examples/motoko_examples/calc/src/index.did b/examples/motoko_examples/calc/src/index.did index 57749ff529..497f4321ba 100644 --- a/examples/motoko_examples/calc/src/index.did +++ b/examples/motoko_examples/calc/src/index.did @@ -1,7 +1,7 @@ service: () -> { add: (int) -> (int); - sub: (int) -> (int); - mul: (int) -> (int); - div: (int) -> (opt int); clearall: () -> (); + div: (int) -> (opt int); + mul: (int) -> (int); + sub: (int) -> (int); } diff --git a/examples/motoko_examples/counter/src/index.did b/examples/motoko_examples/counter/src/index.did index d8f9094a7c..a0b3a1ed59 100644 --- a/examples/motoko_examples/counter/src/index.did +++ b/examples/motoko_examples/counter/src/index.did @@ -1,5 +1,5 @@ service: () -> { get: () -> (nat) query; - set: (nat) -> (); inc: () -> (); + set: (nat) -> (); } diff --git a/examples/motoko_examples/phone-book/src/declarations/phone_book/index.js b/examples/motoko_examples/phone-book/src/declarations/phone_book/index.js index 5dc8fd277e..a3fb54cb8c 100644 --- a/examples/motoko_examples/phone-book/src/declarations/phone_book/index.js +++ b/examples/motoko_examples/phone-book/src/declarations/phone_book/index.js @@ -9,8 +9,7 @@ export { idlFactory } from './phone_book.did.js'; * process.env.CANISTER_ID_ * beginning in dfx 0.15.0 */ -export const canisterId = - process.env.CANISTER_ID_PHONE_BOOK || process.env.PHONE_BOOK_CANISTER_ID; +export const canisterId = process.env.CANISTER_ID_PHONE_BOOK; export const createActor = (canisterId, options = {}) => { const agent = options.agent || new HttpAgent({ ...options.agentOptions }); @@ -39,4 +38,4 @@ export const createActor = (canisterId, options = {}) => { }); }; -export const phone_book = createActor(canisterId); +export const phone_book = canisterId ? createActor(canisterId) : undefined; diff --git a/examples/motoko_examples/phone-book/src/declarations/phone_book/phone_book.did.d.ts b/examples/motoko_examples/phone-book/src/declarations/phone_book/phone_book.did.d.ts index 3f09710196..fbee1841ca 100644 --- a/examples/motoko_examples/phone-book/src/declarations/phone_book/phone_book.did.d.ts +++ b/examples/motoko_examples/phone-book/src/declarations/phone_book/phone_book.did.d.ts @@ -1,7 +1,10 @@ import type { Principal } from '@dfinity/principal'; import type { ActorMethod } from '@dfinity/agent'; +import type { IDL } from '@dfinity/candid'; export interface _SERVICE { insert: ActorMethod<[string, { desc: string; phone: string }], undefined>; lookup: ActorMethod<[string], [] | [{ desc: string; phone: string }]>; } +export declare const idlFactory: IDL.InterfaceFactory; +export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[]; diff --git a/examples/motoko_examples/simple-to-do/src/index.did b/examples/motoko_examples/simple-to-do/src/index.did index 15197671e1..a6c08c685d 100644 --- a/examples/motoko_examples/simple-to-do/src/index.did +++ b/examples/motoko_examples/simple-to-do/src/index.did @@ -1,8 +1,7 @@ -type rec_0 = record {completed:bool; description:text}; service: () -> { - getTodos: () -> (vec rec_0) query; addTodo: (text) -> (nat); + clearCompleted: () -> (); completeTodo: (nat) -> (); + getTodos: () -> (vec record {completed:bool; description:text}) query; showTodos: () -> (text) query; - clearCompleted: () -> (); } diff --git a/examples/motoko_examples/superheroes/src/declarations/index.js b/examples/motoko_examples/superheroes/src/declarations/index.js index c4adf2c8ba..ddf4e933fe 100644 --- a/examples/motoko_examples/superheroes/src/declarations/index.js +++ b/examples/motoko_examples/superheroes/src/declarations/index.js @@ -9,8 +9,7 @@ export { idlFactory } from './superheroes.did.js'; * process.env.CANISTER_ID_ * beginning in dfx 0.15.0 */ -export const canisterId = - process.env.CANISTER_ID_SUPERHEROES || process.env.SUPERHEROES_CANISTER_ID; +export const canisterId = process.env.CANISTER_ID_SUPERHEROES; export const createActor = (canisterId, options = {}) => { const agent = options.agent || new HttpAgent({ ...options.agentOptions }); diff --git a/examples/motoko_examples/superheroes/src/declarations/superheroes.did b/examples/motoko_examples/superheroes/src/declarations/superheroes.did index 3770e592a2..b0ff080de3 100644 --- a/examples/motoko_examples/superheroes/src/declarations/superheroes.did +++ b/examples/motoko_examples/superheroes/src/declarations/superheroes.did @@ -1,9 +1,9 @@ -type rec_28 = record {text; opt rec_28}; -type rec_33 = record {text; opt rec_33}; -type rec_36 = record {text; opt rec_36}; +type rec_0 = record {text; opt rec_0}; +type rec_1 = record {text; opt rec_1}; +type rec_2 = record {text; opt rec_2}; service: () -> { - create: (record {superpowers:opt rec_28; name:text}) -> (nat32) ; - deleteHero: (nat32) -> (bool) ; - read: (nat32) -> (opt record {superpowers:opt rec_33; name:text}) query; - update: (nat32, record {superpowers:opt rec_36; name:text}) -> (bool) ; -} \ No newline at end of file + create: (record {superpowers:opt rec_0; name:text}) -> (nat32); + deleteHero: (nat32) -> (bool); + read: (nat32) -> (opt record {superpowers:opt rec_1; name:text}) query; + update: (nat32, record {superpowers:opt rec_2; name:text}) -> (bool); +} diff --git a/examples/motoko_examples/superheroes/src/declarations/superheroes.did.d.ts b/examples/motoko_examples/superheroes/src/declarations/superheroes.did.d.ts index fe81f1b8a5..57295867e7 100644 --- a/examples/motoko_examples/superheroes/src/declarations/superheroes.did.d.ts +++ b/examples/motoko_examples/superheroes/src/declarations/superheroes.did.d.ts @@ -1,18 +1,21 @@ import type { Principal } from '@dfinity/principal'; import type { ActorMethod } from '@dfinity/agent'; +import type { IDL } from '@dfinity/candid'; -export type rec_28 = [string, [] | [rec_28]]; -export type rec_33 = [string, [] | [rec_33]]; -export type rec_36 = [string, [] | [rec_36]]; +export type rec_0 = [string, [] | [rec_0]]; +export type rec_1 = [string, [] | [rec_1]]; +export type rec_2 = [string, [] | [rec_2]]; export interface _SERVICE { - create: ActorMethod<[{ superpowers: [] | [rec_28]; name: string }], number>; + create: ActorMethod<[{ superpowers: [] | [rec_0]; name: string }], number>; deleteHero: ActorMethod<[number], boolean>; read: ActorMethod< [number], - [] | [{ superpowers: [] | [rec_33]; name: string }] + [] | [{ superpowers: [] | [rec_1]; name: string }] >; update: ActorMethod< - [number, { superpowers: [] | [rec_36]; name: string }], + [number, { superpowers: [] | [rec_2]; name: string }], boolean >; } +export declare const idlFactory: IDL.InterfaceFactory; +export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[]; diff --git a/examples/motoko_examples/superheroes/src/declarations/superheroes.did.js b/examples/motoko_examples/superheroes/src/declarations/superheroes.did.js index 4a110b6606..82278e90be 100644 --- a/examples/motoko_examples/superheroes/src/declarations/superheroes.did.js +++ b/examples/motoko_examples/superheroes/src/declarations/superheroes.did.js @@ -1,13 +1,13 @@ export const idlFactory = ({ IDL }) => { - const rec_28 = IDL.Rec(); - const rec_33 = IDL.Rec(); - const rec_36 = IDL.Rec(); - rec_28.fill(IDL.Tuple(IDL.Text, IDL.Opt(rec_28))); - rec_33.fill(IDL.Tuple(IDL.Text, IDL.Opt(rec_33))); - rec_36.fill(IDL.Tuple(IDL.Text, IDL.Opt(rec_36))); + const rec_0 = IDL.Rec(); + const rec_1 = IDL.Rec(); + const rec_2 = IDL.Rec(); + rec_0.fill(IDL.Tuple(IDL.Text, IDL.Opt(rec_0))); + rec_1.fill(IDL.Tuple(IDL.Text, IDL.Opt(rec_1))); + rec_2.fill(IDL.Tuple(IDL.Text, IDL.Opt(rec_2))); return IDL.Service({ create: IDL.Func( - [IDL.Record({ superpowers: IDL.Opt(rec_28), name: IDL.Text })], + [IDL.Record({ superpowers: IDL.Opt(rec_0), name: IDL.Text })], [IDL.Nat32], [] ), @@ -16,7 +16,7 @@ export const idlFactory = ({ IDL }) => { [IDL.Nat32], [ IDL.Opt( - IDL.Record({ superpowers: IDL.Opt(rec_33), name: IDL.Text }) + IDL.Record({ superpowers: IDL.Opt(rec_1), name: IDL.Text }) ) ], ['query'] @@ -24,7 +24,7 @@ export const idlFactory = ({ IDL }) => { update: IDL.Func( [ IDL.Nat32, - IDL.Record({ superpowers: IDL.Opt(rec_36), name: IDL.Text }) + IDL.Record({ superpowers: IDL.Opt(rec_2), name: IDL.Text }) ], [IDL.Bool], [] diff --git a/examples/motoko_examples/superheroes/src/superheroes/index.did b/examples/motoko_examples/superheroes/src/superheroes/index.did index 3770e592a2..b0ff080de3 100644 --- a/examples/motoko_examples/superheroes/src/superheroes/index.did +++ b/examples/motoko_examples/superheroes/src/superheroes/index.did @@ -1,9 +1,9 @@ -type rec_28 = record {text; opt rec_28}; -type rec_33 = record {text; opt rec_33}; -type rec_36 = record {text; opt rec_36}; +type rec_0 = record {text; opt rec_0}; +type rec_1 = record {text; opt rec_1}; +type rec_2 = record {text; opt rec_2}; service: () -> { - create: (record {superpowers:opt rec_28; name:text}) -> (nat32) ; - deleteHero: (nat32) -> (bool) ; - read: (nat32) -> (opt record {superpowers:opt rec_33; name:text}) query; - update: (nat32, record {superpowers:opt rec_36; name:text}) -> (bool) ; -} \ No newline at end of file + create: (record {superpowers:opt rec_0; name:text}) -> (nat32); + deleteHero: (nat32) -> (bool); + read: (nat32) -> (opt record {superpowers:opt rec_1; name:text}) query; + update: (nat32, record {superpowers:opt rec_2; name:text}) -> (bool); +} diff --git a/examples/null_example/src/index.did b/examples/null_example/src/index.did index 02e4df01eb..9f8d2f2ade 100644 --- a/examples/null_example/src/index.did +++ b/examples/null_example/src/index.did @@ -1,19 +1,10 @@ -type rec_0 = record {thirdItem:int; secondItem:null; firstItem:int}; -type rec_1 = record {thirdItem:int; secondItem:null; firstItem:int}; -type rec_2 = record {thirdItem:int; secondItem:null; firstItem:int}; -type rec_3 = record {secondItem:null; firstItem:null}; -type rec_4 = record {secondItem:null; firstItem:null}; -type rec_5 = record {secondItem:null; firstItem:null}; -type rec_6 = record {thirdItem:null; secondItem:null; firstItem:null}; -type rec_7 = record {thirdItem:null; secondItem:null; firstItem:null}; -type rec_8 = record {thirdItem:null; secondItem:null; firstItem:null}; service: () -> { + getLargeNullRecord: () -> (record {thirdItem:null; secondItem:null; firstItem:null}) query; + getPartiallyNullRecord: () -> (record {thirdItem:int; secondItem:null; firstItem:int}) query; + getSmallNullRecord: () -> (record {secondItem:null; firstItem:null}) query; nullFunction: (null) -> (null) query; + setLargeNullRecord: (record {thirdItem:null; secondItem:null; firstItem:null}) -> (record {thirdItem:null; secondItem:null; firstItem:null}); + setPartiallyNullRecord: (record {thirdItem:int; secondItem:null; firstItem:int}) -> (record {thirdItem:int; secondItem:null; firstItem:int}); + setSmallNullRecord: (record {secondItem:null; firstItem:null}) -> (record {secondItem:null; firstItem:null}); voidIsNotNull: () -> () query; - getPartiallyNullRecord: () -> (rec_0) query; - setPartiallyNullRecord: (rec_1) -> (rec_2); - getSmallNullRecord: () -> (rec_3) query; - setSmallNullRecord: (rec_4) -> (rec_5); - getLargeNullRecord: () -> (rec_6) query; - setLargeNullRecord: (rec_7) -> (rec_8); } diff --git a/examples/optional_types/src/index.did b/examples/optional_types/src/index.did index 172a4c8056..985ba24827 100644 --- a/examples/optional_types/src/index.did +++ b/examples/optional_types/src/index.did @@ -1,17 +1,8 @@ -type rec_2 = record {id:text}; -type rec_1 = record {elements:vec rec_2}; -type rec_0 = record {head:opt rec_1}; -type rec_4 = record {id:text}; -type rec_3 = record {elements:vec rec_4}; -type rec_6 = record {id:text}; -type rec_5 = record {elements:vec rec_6}; -type rec_7 = record {id:text}; -type rec_8 = record {id:text}; service: () -> { - getHtml: () -> (rec_0) query; - getHead: () -> (opt rec_3) query; - getHeadWithElements: () -> (opt rec_5) query; - getElement: (opt opt rec_7) -> (opt opt rec_8) query; + getElement: (opt opt record {id:text}) -> (opt opt record {id:text}) query; + getHead: () -> (opt record {elements:vec record {id:text}}) query; + getHeadWithElements: () -> (opt record {elements:vec record {id:text}}) query; + getHtml: () -> (record {head:opt record {elements:vec record {id:text}}}) query; getNull: () -> (null) query; getOptNull: () -> (opt text) query; stringToBoolean: (opt text) -> (bool) query; diff --git a/examples/pre_and_post_upgrade/src/index.did b/examples/pre_and_post_upgrade/src/index.did index 7c841cdd51..ad46fc2bfc 100644 --- a/examples/pre_and_post_upgrade/src/index.did +++ b/examples/pre_and_post_upgrade/src/index.did @@ -1,6 +1,4 @@ -type rec_1 = record {key:text; value:nat64}; -type rec_2 = record {key:text; value:nat64}; service: () -> { - setEntry: (rec_1) -> (); - getEntries: () -> (vec rec_2) query; + getEntries: () -> (vec record {key:text; value:nat64}) query; + setEntry: (record {key:text; value:nat64}) -> (); } diff --git a/examples/primitive_ops/canisters/azle/index.did b/examples/primitive_ops/canisters/azle/index.did index c29734f713..7c6c6c57f6 100644 --- a/examples/primitive_ops/canisters/azle/index.did +++ b/examples/primitive_ops/canisters/azle/index.did @@ -1,88 +1,45 @@ -type rec_42 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_0 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_1 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_2 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_3 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_5 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_4 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_6 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_7 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_8 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_9 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_10 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_11 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_12 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_13 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_14 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_15 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_16 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_17 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_18 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_19 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_20 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_21 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_22 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_23 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_24 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_25 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_26 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_27 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_28 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_29 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_30 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_31 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_32 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_33 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_34 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_35 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_36 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_37 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_38 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_39 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_40 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; -type rec_41 = record {wasm_body_only:nat64; wasm_including_prelude:nat64}; service: () -> { - empty: () -> (rec_42); - blob_init_stack: (nat32) -> (rec_0); - blob_init_heap: (nat32) -> (rec_1); - boolean_init_stack: (nat32) -> (rec_2); - boolean_init_heap: (nat32) -> (rec_3); - float32_init_heap: (nat32) -> (rec_5); - float32_init_stack: (nat32) -> (rec_4); - float64_init_stack: (nat32) -> (rec_6); - float64_init_heap: (nat32) -> (rec_7); - int_init_stack: (nat32) -> (rec_8); - int_init_heap: (nat32) -> (rec_9); - int8_init_stack: (nat32) -> (rec_10); - int8_init_heap: (nat32) -> (rec_11); - int16_init_stack: (nat32) -> (rec_12); - int16_init_heap: (nat32) -> (rec_13); - int32_init_stack: (nat32) -> (rec_14); - int32_init_heap: (nat32) -> (rec_15); - int64_init_stack: (nat32) -> (rec_16); - int64_init_heap: (nat32) -> (rec_17); - nat_init_stack: (nat32) -> (rec_18); - nat_init_heap: (nat32) -> (rec_19); - nat8_init_stack: (nat32) -> (rec_20); - nat8_init_heap: (nat32) -> (rec_21); - nat16_init_stack: (nat32) -> (rec_22); - nat16_init_heap: (nat32) -> (rec_23); - nat32_init_stack: (nat32) -> (rec_24); - nat32_init_heap: (nat32) -> (rec_25); - nat64_init_stack: (nat32) -> (rec_26); - nat64_init_heap: (nat32) -> (rec_27); - null_init_stack: (nat32) -> (rec_28); - null_init_heap: (nat32) -> (rec_29); - opt_init_stack: (nat32) -> (rec_30); - opt_init_heap: (nat32) -> (rec_31); - principal_init_stack: (nat32) -> (rec_32); - principal_init_heap: (nat32) -> (rec_33); - record_init_stack: (nat32) -> (rec_34); - record_init_heap: (nat32) -> (rec_35); - text_init_stack: (nat32) -> (rec_36); - text_init_heap: (nat32) -> (rec_37); - variant_init_stack: (nat32) -> (rec_38); - variant_init_heap: (nat32) -> (rec_39); - vec_init_stack: (nat32) -> (rec_40); - vec_init_heap: (nat32) -> (rec_41); + blob_init_heap: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + blob_init_stack: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + boolean_init_heap: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + boolean_init_stack: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + empty: () -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + float32_init_heap: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + float32_init_stack: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + float64_init_heap: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + float64_init_stack: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + int16_init_heap: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + int16_init_stack: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + int32_init_heap: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + int32_init_stack: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + int64_init_heap: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + int64_init_stack: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + int8_init_heap: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + int8_init_stack: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + int_init_heap: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + int_init_stack: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + nat16_init_heap: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + nat16_init_stack: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + nat32_init_heap: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + nat32_init_stack: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + nat64_init_heap: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + nat64_init_stack: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + nat8_init_heap: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + nat8_init_stack: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + nat_init_heap: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + nat_init_stack: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + null_init_heap: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + null_init_stack: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + opt_init_heap: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + opt_init_stack: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + principal_init_heap: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + principal_init_stack: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + record_init_heap: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + record_init_stack: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + text_init_heap: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + text_init_stack: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + variant_init_heap: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + variant_init_stack: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + vec_init_heap: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); + vec_init_stack: (nat32) -> (record {wasm_body_only:nat64; wasm_including_prelude:nat64}); } diff --git a/examples/principal/src/index.did b/examples/principal/src/index.did index 2480ae6aa4..f1e8e62ae9 100644 --- a/examples/principal/src/index.did +++ b/examples/principal/src/index.did @@ -1,15 +1,13 @@ -type rec_0 = record {id:principal; username:text}; -type rec_1 = variant {Online; WaitingOn:principal; Offline}; service: () -> { - principalReturnType: () -> (principal) query; - principalParam: (principal) -> (principal) query; - principalInRecord: () -> (rec_0) query; - principalInVariant: () -> (rec_1) query; + principalFromBlob: (vec nat8) -> (principal) query; principalFromHex: (text) -> (principal) query; principalFromText: (text) -> (principal) query; - principalFromBlob: (vec nat8) -> (principal) query; + principalInRecord: () -> (record {id:principal; username:text}) query; + principalInVariant: () -> (variant {Online; WaitingOn:principal; Offline}) query; + principalParam: (principal) -> (principal) query; + principalReturnType: () -> (principal) query; + principalSelfAuthenticating: (vec nat8) -> (principal) query; + principalToBlob: (principal) -> (vec nat8) query; principalToHex: (principal) -> (text) query; principalToText: (principal) -> (text) query; - principalToBlob: (principal) -> (vec nat8) query; - principalSelfAuthenticating: (vec nat8) -> (principal) query; } diff --git a/examples/simple_erc20/src/index.did b/examples/simple_erc20/src/index.did index 115680317c..4cf849a10b 100644 --- a/examples/simple_erc20/src/index.did +++ b/examples/simple_erc20/src/index.did @@ -1,8 +1,8 @@ service: () -> { - initializeSupply: (text, text, text, nat64) -> (bool); - transfer: (text, text, nat64) -> (bool); balance: (text) -> (nat64) query; - ticker: () -> (text) query; + initializeSupply: (text, text, text, nat64) -> (bool); name: () -> (text) query; + ticker: () -> (text) query; totalSupply: () -> (nat64) query; + transfer: (text, text, nat64) -> (bool); } diff --git a/examples/sqlite/src/index.did b/examples/sqlite/src/index.did index 02c019ab7d..7bf084795e 100644 --- a/examples/sqlite/src/index.did +++ b/examples/sqlite/src/index.did @@ -1,4 +1,4 @@ service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:record {}; callback:func (record {}) -> (opt record {token:opt record {}; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:record {}; callback:func (record {}) -> (opt record {token:opt record {}; body:vec nat8}) query}}; status_code:nat16}); + http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; + http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); } diff --git a/examples/tfjs/src/api.did b/examples/tfjs/src/api.did index 02c019ab7d..7bf084795e 100644 --- a/examples/tfjs/src/api.did +++ b/examples/tfjs/src/api.did @@ -1,4 +1,4 @@ service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:record {}; callback:func (record {}) -> (opt record {token:opt record {}; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:record {}; callback:func (record {}) -> (opt record {token:opt record {}; body:vec nat8}) query}}; status_code:nat16}); + http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; + http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); } diff --git a/examples/tuple_types/src/index.did b/examples/tuple_types/src/index.did index ba4796e0e0..862f8b44db 100644 --- a/examples/tuple_types/src/index.did +++ b/examples/tuple_types/src/index.did @@ -1,18 +1,18 @@ -type rec_72 = variant {Bad:record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_72}; Good}; -type rec_75 = variant {Bad:record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_75}; Good}; -type rec_68 = variant {Bad:record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_68}; Good}; -type rec_60 = variant {Bad:record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_60}; Good}; -type rec_63 = variant {Bad:record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_63}; Good}; -type rec_56 = variant {Bad:record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_56}; Good}; +type rec_4 = variant {Bad:record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_4}; Good}; +type rec_5 = variant {Bad:record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_5}; Good}; +type rec_3 = variant {Bad:record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_3}; Good}; +type rec_1 = variant {Bad:record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_1}; Good}; +type rec_2 = variant {Bad:record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_2}; Good}; +type rec_0 = variant {Bad:record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_0}; Good}; service: () -> { complexOneTupleInlineParam: (record {record {text; nat64}}) -> (record {record {text; nat64}}) query; complexOneTupleInlineReturnType: () -> (record {record {text; nat64}}) query; complexOneTupleParam: (record {record {text; nat64}}) -> (record {record {text; nat64}}) query; complexOneTupleReturnType: () -> (record {record {text; nat64}}) query; - complexThreeTupleInlineParam: (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_72}) -> (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_75}) query; - complexThreeTupleInlineReturnType: () -> (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_68}) query; - complexThreeTupleParam: (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_60}) -> (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_63}) query; - complexThreeTupleReturnType: () -> (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_56}) query; + complexThreeTupleInlineParam: (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_4}) -> (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_5}) query; + complexThreeTupleInlineReturnType: () -> (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_3}) query; + complexThreeTupleParam: (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_1}) -> (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_2}) query; + complexThreeTupleReturnType: () -> (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_0}) query; complexTwoTupleInlineParam: (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}}) -> (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}}) query; complexTwoTupleInlineReturnType: () -> (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}}) query; complexTwoTupleParam: (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}}) -> (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}}) query; @@ -33,4 +33,4 @@ service: () -> { tupleArrayParamsAndReturnType: (vec record {text; text}) -> (vec record {text; text}) query; tupleArrayRecordField: () -> (record {headers:vec record {text; text}}) query; tupleArrayVariantField: () -> (variant {WithHeaders:vec record {text; text}; WithoutHeaders}) query; -} \ No newline at end of file +} diff --git a/examples/web_assembly/src/index.did b/examples/web_assembly/src/index.did index 02c019ab7d..7bf084795e 100644 --- a/examples/web_assembly/src/index.did +++ b/examples/web_assembly/src/index.did @@ -1,4 +1,4 @@ service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:record {}; callback:func (record {}) -> (opt record {token:opt record {}; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:record {}; callback:func (record {}) -> (opt record {token:opt record {}; body:vec nat8}) query}}; status_code:nat16}); + http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; + http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); } diff --git a/scripts/update_candid.sh b/scripts/update_candid.sh index d1b443db55..af52aef1dc 100755 --- a/scripts/update_candid.sh +++ b/scripts/update_candid.sh @@ -1,6 +1,7 @@ #!/bin/bash # Usage: +# Start up your own replica on port 8000: dfx start --clean --host 127.0.0.1:8000 # cd examples # ../scripts/update_candid.sh # cd motoko_examples @@ -10,15 +11,22 @@ upgrade_candid() { npm install npm link azle - # dfx canister create --all # TODO we really only want to deploy the azle canisters - # dfx build - npm run pretest + dfx canister create --all + dfx build } upgrade_all() { for dir in */; do + + # You can use this part to skip directories + # first_char=${dir:0:1} + # if [[ "$first_char" < "t" ]]; then + # echo "Skipping directory: $dir" + # continue + # fi + echo "Looking at directory: $dir" if [ -f "$dir/dfx.json" ]; then echo "Processing directory: $dir" @@ -29,8 +37,4 @@ for dir in */; do done } -dfx start --clean --background - upgrade_all - -dfx stop \ No newline at end of file