diff --git a/examples/http-certification/assets/.gitignore b/examples/http-certification/assets/.gitignore index a3cd6bba..079df916 100644 --- a/examples/http-certification/assets/.gitignore +++ b/examples/http-certification/assets/.gitignore @@ -1,3 +1,21 @@ -node_modules -dist -.dfx +# Various IDEs and Editors +.vscode/ +.idea/ +**/*~ + +# Mac OSX temporary files +.DS_Store +**/.DS_Store + +# dfx temporary files +.dfx/ + +# generated files +src/declarations/ + +# rust +target/ + +# frontend code +node_modules/ +dist/ diff --git a/examples/http-certification/custom-assets/.gitignore b/examples/http-certification/custom-assets/.gitignore index a3cd6bba..079df916 100644 --- a/examples/http-certification/custom-assets/.gitignore +++ b/examples/http-certification/custom-assets/.gitignore @@ -1,3 +1,21 @@ -node_modules -dist -.dfx +# Various IDEs and Editors +.vscode/ +.idea/ +**/*~ + +# Mac OSX temporary files +.DS_Store +**/.DS_Store + +# dfx temporary files +.dfx/ + +# generated files +src/declarations/ + +# rust +target/ + +# frontend code +node_modules/ +dist/ diff --git a/examples/http-certification/custom-assets/src/declarations/backend.did.d.ts b/examples/http-certification/custom-assets/src/declarations/backend.did.d.ts deleted file mode 100644 index 9f931aaf..00000000 --- a/examples/http-certification/custom-assets/src/declarations/backend.did.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type { Principal } from '@dfinity/principal'; -import type { ActorMethod } from '@dfinity/agent'; -import type { IDL } from '@dfinity/candid'; - -export type HeaderField = [string, string]; -export interface HttpRequest { - 'url' : string, - 'method' : string, - 'body' : Uint8Array | number[], - 'headers' : Array, - 'certificate_version' : [] | [number], -} -export interface HttpResponse { - 'body' : Uint8Array | number[], - 'headers' : Array, - 'status_code' : number, -} -export interface _SERVICE { - 'http_request' : ActorMethod<[HttpRequest], HttpResponse>, -} -export declare const idlFactory: IDL.InterfaceFactory; -export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[]; diff --git a/examples/http-certification/custom-assets/src/declarations/backend.did.js b/examples/http-certification/custom-assets/src/declarations/backend.did.js deleted file mode 100644 index ac3048a1..00000000 --- a/examples/http-certification/custom-assets/src/declarations/backend.did.js +++ /dev/null @@ -1,19 +0,0 @@ -export const idlFactory = ({ IDL }) => { - const HeaderField = IDL.Tuple(IDL.Text, IDL.Text); - const HttpRequest = IDL.Record({ - 'url' : IDL.Text, - 'method' : IDL.Text, - 'body' : IDL.Vec(IDL.Nat8), - 'headers' : IDL.Vec(HeaderField), - 'certificate_version' : IDL.Opt(IDL.Nat16), - }); - const HttpResponse = IDL.Record({ - 'body' : IDL.Vec(IDL.Nat8), - 'headers' : IDL.Vec(HeaderField), - 'status_code' : IDL.Nat16, - }); - return IDL.Service({ - 'http_request' : IDL.Func([HttpRequest], [HttpResponse], ['query']), - }); -}; -export const init = ({ IDL }) => { return []; }; diff --git a/examples/http-certification/custom-assets/src/declarations/index.d.ts b/examples/http-certification/custom-assets/src/declarations/index.d.ts deleted file mode 100644 index 55daa14e..00000000 --- a/examples/http-certification/custom-assets/src/declarations/index.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -import type { - ActorSubclass, - HttpAgentOptions, - ActorConfig, - Agent, -} from "@dfinity/agent"; -import type { Principal } from "@dfinity/principal"; -import type { IDL } from "@dfinity/candid"; - -import { _SERVICE } from './backend.did'; - -export declare const idlFactory: IDL.InterfaceFactory; -export declare const canisterId: string; - -export declare interface CreateActorOptions { - /** - * @see {@link Agent} - */ - agent?: Agent; - /** - * @see {@link HttpAgentOptions} - */ - agentOptions?: HttpAgentOptions; - /** - * @see {@link ActorConfig} - */ - actorOptions?: ActorConfig; -} - -/** - * Intializes an {@link ActorSubclass}, configured with the provided SERVICE interface of a canister. - * @constructs {@link ActorSubClass} - * @param {string | Principal} canisterId - ID of the canister the {@link Actor} will talk to - * @param {CreateActorOptions} options - see {@link CreateActorOptions} - * @param {CreateActorOptions["agent"]} options.agent - a pre-configured agent you'd like to use. Supercedes agentOptions - * @param {CreateActorOptions["agentOptions"]} options.agentOptions - options to set up a new agent - * @see {@link HttpAgentOptions} - * @param {CreateActorOptions["actorOptions"]} options.actorOptions - options for the Actor - * @see {@link ActorConfig} - */ -export declare const createActor: ( - canisterId: string | Principal, - options?: CreateActorOptions -) => ActorSubclass<_SERVICE>; - -/** - * Intialized Actor using default settings, ready to talk to a canister using its candid interface - * @constructs {@link ActorSubClass} - */ -export declare const backend: ActorSubclass<_SERVICE>; diff --git a/examples/http-certification/custom-assets/src/declarations/index.js b/examples/http-certification/custom-assets/src/declarations/index.js deleted file mode 100644 index 8def3796..00000000 --- a/examples/http-certification/custom-assets/src/declarations/index.js +++ /dev/null @@ -1,42 +0,0 @@ -import { Actor, HttpAgent } from "@dfinity/agent"; - -// Imports and re-exports candid interface -import { idlFactory } from "./backend.did.js"; -export { idlFactory } from "./backend.did.js"; - -/* CANISTER_ID is replaced by webpack based on node environment - * Note: canister environment variable will be standardized as - * process.env.CANISTER_ID_ - * beginning in dfx 0.15.0 - */ -export const canisterId = - process.env.CANISTER_ID_BACKEND; - -export const createActor = (canisterId, options = {}) => { - const agent = options.agent || new HttpAgent({ ...options.agentOptions }); - - if (options.agent && options.agentOptions) { - console.warn( - "Detected both agent and agentOptions passed to createActor. Ignoring agentOptions and proceeding with the provided agent." - ); - } - - // Fetch root key for certificate validation during development - if (process.env.DFX_NETWORK !== "ic") { - agent.fetchRootKey().catch((err) => { - console.warn( - "Unable to fetch root key. Check to ensure that your local replica is running" - ); - console.error(err); - }); - } - - // Creates an actor with using the candid interface and the HttpAgent - return Actor.createActor(idlFactory, { - agent, - canisterId, - ...options.actorOptions, - }); -}; - -export const backend = canisterId ? createActor(canisterId) : undefined; diff --git a/examples/http-certification/skip-certification/.dfx/local/canister_ids.json b/examples/http-certification/skip-certification/.dfx/local/canister_ids.json deleted file mode 100644 index 7da370d3..00000000 --- a/examples/http-certification/skip-certification/.dfx/local/canister_ids.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "__Candid_UI": { - "local": "bd3sg-teaaa-aaaaa-qaaba-cai" - }, - "backend": { - "local": "bkyz2-fmaaa-aaaaa-qaaaq-cai" - } -} \ No newline at end of file diff --git a/examples/http-certification/skip-certification/.dfx/local/canisters/backend/backend.wasm b/examples/http-certification/skip-certification/.dfx/local/canisters/backend/backend.wasm deleted file mode 100644 index 3ce80c99..00000000 Binary files a/examples/http-certification/skip-certification/.dfx/local/canisters/backend/backend.wasm and /dev/null differ diff --git a/examples/http-certification/skip-certification/.dfx/local/canisters/backend/constructor.did b/examples/http-certification/skip-certification/.dfx/local/canisters/backend/constructor.did deleted file mode 100644 index 2d8486bd..00000000 --- a/examples/http-certification/skip-certification/.dfx/local/canisters/backend/constructor.did +++ /dev/null @@ -1,19 +0,0 @@ -type HeaderField = record { text; text }; - -type HttpRequest = record { - method : text; - url : text; - headers : vec HeaderField; - body : blob; - certificate_version : opt nat16; -}; - -type HttpResponse = record { - status_code : nat16; - headers : vec HeaderField; - body : blob; -}; - -service : { - http_request : (request : HttpRequest) -> (HttpResponse) query; -}; diff --git a/examples/http-certification/skip-certification/.dfx/local/canisters/backend/constructor.old.did b/examples/http-certification/skip-certification/.dfx/local/canisters/backend/constructor.old.did deleted file mode 100644 index 2d8486bd..00000000 --- a/examples/http-certification/skip-certification/.dfx/local/canisters/backend/constructor.old.did +++ /dev/null @@ -1,19 +0,0 @@ -type HeaderField = record { text; text }; - -type HttpRequest = record { - method : text; - url : text; - headers : vec HeaderField; - body : blob; - certificate_version : opt nat16; -}; - -type HttpResponse = record { - status_code : nat16; - headers : vec HeaderField; - body : blob; -}; - -service : { - http_request : (request : HttpRequest) -> (HttpResponse) query; -}; diff --git a/examples/http-certification/skip-certification/.dfx/local/canisters/backend/index.js b/examples/http-certification/skip-certification/.dfx/local/canisters/backend/index.js deleted file mode 100644 index 7d657825..00000000 --- a/examples/http-certification/skip-certification/.dfx/local/canisters/backend/index.js +++ /dev/null @@ -1,42 +0,0 @@ -import { Actor, HttpAgent } from "@dfinity/agent"; - -// Imports and re-exports candid interface -import { idlFactory } from './backend.did.js'; -export { idlFactory } from './backend.did.js'; -// CANISTER_ID is replaced by webpack based on node environment -export const canisterId = process.env.CANISTER_ID_BACKEND; - -/** - * @deprecated since dfx 0.11.1 - * Do not import from `.dfx`, instead switch to using `dfx generate` to generate your JS interface. - * @param {string | import("@dfinity/principal").Principal} canisterId Canister ID of Agent - * @param {{agentOptions?: import("@dfinity/agent").HttpAgentOptions; actorOptions?: import("@dfinity/agent").ActorConfig} | { agent?: import("@dfinity/agent").Agent; actorOptions?: import("@dfinity/agent").ActorConfig }} [options] - * @return {import("@dfinity/agent").ActorSubclass} - */ -export const createActor = (canisterId, options = {}) => { - console.warn(`Deprecation warning: you are currently importing code from .dfx. Going forward, refactor to use the dfx generate command for JavaScript bindings. - -See https://internetcomputer.org/docs/current/developer-docs/updates/release-notes/ for migration instructions`); - const agent = options.agent || new HttpAgent({ ...options.agentOptions }); - - // Fetch root key for certificate validation during development - if (process.env.DFX_NETWORK !== "ic") { - agent.fetchRootKey().catch(err => { - console.warn("Unable to fetch root key. Check to ensure that your local replica is running"); - console.error(err); - }); - } - - // Creates an actor with using the candid interface and the HttpAgent - return Actor.createActor(idlFactory, { - agent, - canisterId, - ...(options ? options.actorOptions : {}), - }); -}; - -/** - * A ready-to-use agent for the backend canister - * @type {import("@dfinity/agent").ActorSubclass} - */ -export const backend = createActor(canisterId); diff --git a/examples/http-certification/skip-certification/.dfx/local/canisters/backend/init_args.txt b/examples/http-certification/skip-certification/.dfx/local/canisters/backend/init_args.txt deleted file mode 100644 index dd626a0f..00000000 --- a/examples/http-certification/skip-certification/.dfx/local/canisters/backend/init_args.txt +++ /dev/null @@ -1 +0,0 @@ -() \ No newline at end of file diff --git a/examples/http-certification/skip-certification/.dfx/local/canisters/backend/service.did b/examples/http-certification/skip-certification/.dfx/local/canisters/backend/service.did deleted file mode 100644 index 2d8486bd..00000000 --- a/examples/http-certification/skip-certification/.dfx/local/canisters/backend/service.did +++ /dev/null @@ -1,19 +0,0 @@ -type HeaderField = record { text; text }; - -type HttpRequest = record { - method : text; - url : text; - headers : vec HeaderField; - body : blob; - certificate_version : opt nat16; -}; - -type HttpResponse = record { - status_code : nat16; - headers : vec HeaderField; - body : blob; -}; - -service : { - http_request : (request : HttpRequest) -> (HttpResponse) query; -}; diff --git a/examples/http-certification/skip-certification/.dfx/local/canisters/backend/service.did.d.ts b/examples/http-certification/skip-certification/.dfx/local/canisters/backend/service.did.d.ts deleted file mode 100644 index 9f931aaf..00000000 --- a/examples/http-certification/skip-certification/.dfx/local/canisters/backend/service.did.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type { Principal } from '@dfinity/principal'; -import type { ActorMethod } from '@dfinity/agent'; -import type { IDL } from '@dfinity/candid'; - -export type HeaderField = [string, string]; -export interface HttpRequest { - 'url' : string, - 'method' : string, - 'body' : Uint8Array | number[], - 'headers' : Array, - 'certificate_version' : [] | [number], -} -export interface HttpResponse { - 'body' : Uint8Array | number[], - 'headers' : Array, - 'status_code' : number, -} -export interface _SERVICE { - 'http_request' : ActorMethod<[HttpRequest], HttpResponse>, -} -export declare const idlFactory: IDL.InterfaceFactory; -export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[]; diff --git a/examples/http-certification/skip-certification/.dfx/local/canisters/backend/service.did.js b/examples/http-certification/skip-certification/.dfx/local/canisters/backend/service.did.js deleted file mode 100644 index ac3048a1..00000000 --- a/examples/http-certification/skip-certification/.dfx/local/canisters/backend/service.did.js +++ /dev/null @@ -1,19 +0,0 @@ -export const idlFactory = ({ IDL }) => { - const HeaderField = IDL.Tuple(IDL.Text, IDL.Text); - const HttpRequest = IDL.Record({ - 'url' : IDL.Text, - 'method' : IDL.Text, - 'body' : IDL.Vec(IDL.Nat8), - 'headers' : IDL.Vec(HeaderField), - 'certificate_version' : IDL.Opt(IDL.Nat16), - }); - const HttpResponse = IDL.Record({ - 'body' : IDL.Vec(IDL.Nat8), - 'headers' : IDL.Vec(HeaderField), - 'status_code' : IDL.Nat16, - }); - return IDL.Service({ - 'http_request' : IDL.Func([HttpRequest], [HttpResponse], ['query']), - }); -}; -export const init = ({ IDL }) => { return []; }; diff --git a/examples/http-certification/skip-certification/.dfx/local/lsp/bkyz2-fmaaa-aaaaa-qaaaq-cai.did b/examples/http-certification/skip-certification/.dfx/local/lsp/bkyz2-fmaaa-aaaaa-qaaaq-cai.did deleted file mode 100644 index 2d8486bd..00000000 --- a/examples/http-certification/skip-certification/.dfx/local/lsp/bkyz2-fmaaa-aaaaa-qaaaq-cai.did +++ /dev/null @@ -1,19 +0,0 @@ -type HeaderField = record { text; text }; - -type HttpRequest = record { - method : text; - url : text; - headers : vec HeaderField; - body : blob; - certificate_version : opt nat16; -}; - -type HttpResponse = record { - status_code : nat16; - headers : vec HeaderField; - body : blob; -}; - -service : { - http_request : (request : HttpRequest) -> (HttpResponse) query; -}; diff --git a/examples/http-certification/skip-certification/.dfx/local/network-id b/examples/http-certification/skip-certification/.dfx/local/network-id deleted file mode 100644 index eeda6ae2..00000000 --- a/examples/http-certification/skip-certification/.dfx/local/network-id +++ /dev/null @@ -1,3 +0,0 @@ -{ - "created": "2024-09-05 14:28:40.056481716 +00:00:00" -} \ No newline at end of file diff --git a/examples/http-certification/skip-certification/src/declarations/backend.did.d.ts b/examples/http-certification/skip-certification/src/declarations/backend.did.d.ts deleted file mode 100644 index 9f931aaf..00000000 --- a/examples/http-certification/skip-certification/src/declarations/backend.did.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type { Principal } from '@dfinity/principal'; -import type { ActorMethod } from '@dfinity/agent'; -import type { IDL } from '@dfinity/candid'; - -export type HeaderField = [string, string]; -export interface HttpRequest { - 'url' : string, - 'method' : string, - 'body' : Uint8Array | number[], - 'headers' : Array, - 'certificate_version' : [] | [number], -} -export interface HttpResponse { - 'body' : Uint8Array | number[], - 'headers' : Array, - 'status_code' : number, -} -export interface _SERVICE { - 'http_request' : ActorMethod<[HttpRequest], HttpResponse>, -} -export declare const idlFactory: IDL.InterfaceFactory; -export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[]; diff --git a/examples/http-certification/skip-certification/src/declarations/backend.did.js b/examples/http-certification/skip-certification/src/declarations/backend.did.js deleted file mode 100644 index ac3048a1..00000000 --- a/examples/http-certification/skip-certification/src/declarations/backend.did.js +++ /dev/null @@ -1,19 +0,0 @@ -export const idlFactory = ({ IDL }) => { - const HeaderField = IDL.Tuple(IDL.Text, IDL.Text); - const HttpRequest = IDL.Record({ - 'url' : IDL.Text, - 'method' : IDL.Text, - 'body' : IDL.Vec(IDL.Nat8), - 'headers' : IDL.Vec(HeaderField), - 'certificate_version' : IDL.Opt(IDL.Nat16), - }); - const HttpResponse = IDL.Record({ - 'body' : IDL.Vec(IDL.Nat8), - 'headers' : IDL.Vec(HeaderField), - 'status_code' : IDL.Nat16, - }); - return IDL.Service({ - 'http_request' : IDL.Func([HttpRequest], [HttpResponse], ['query']), - }); -}; -export const init = ({ IDL }) => { return []; }; diff --git a/examples/http-certification/skip-certification/src/declarations/index.d.ts b/examples/http-certification/skip-certification/src/declarations/index.d.ts deleted file mode 100644 index 55daa14e..00000000 --- a/examples/http-certification/skip-certification/src/declarations/index.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -import type { - ActorSubclass, - HttpAgentOptions, - ActorConfig, - Agent, -} from "@dfinity/agent"; -import type { Principal } from "@dfinity/principal"; -import type { IDL } from "@dfinity/candid"; - -import { _SERVICE } from './backend.did'; - -export declare const idlFactory: IDL.InterfaceFactory; -export declare const canisterId: string; - -export declare interface CreateActorOptions { - /** - * @see {@link Agent} - */ - agent?: Agent; - /** - * @see {@link HttpAgentOptions} - */ - agentOptions?: HttpAgentOptions; - /** - * @see {@link ActorConfig} - */ - actorOptions?: ActorConfig; -} - -/** - * Intializes an {@link ActorSubclass}, configured with the provided SERVICE interface of a canister. - * @constructs {@link ActorSubClass} - * @param {string | Principal} canisterId - ID of the canister the {@link Actor} will talk to - * @param {CreateActorOptions} options - see {@link CreateActorOptions} - * @param {CreateActorOptions["agent"]} options.agent - a pre-configured agent you'd like to use. Supercedes agentOptions - * @param {CreateActorOptions["agentOptions"]} options.agentOptions - options to set up a new agent - * @see {@link HttpAgentOptions} - * @param {CreateActorOptions["actorOptions"]} options.actorOptions - options for the Actor - * @see {@link ActorConfig} - */ -export declare const createActor: ( - canisterId: string | Principal, - options?: CreateActorOptions -) => ActorSubclass<_SERVICE>; - -/** - * Intialized Actor using default settings, ready to talk to a canister using its candid interface - * @constructs {@link ActorSubClass} - */ -export declare const backend: ActorSubclass<_SERVICE>; diff --git a/examples/http-certification/skip-certification/src/declarations/index.js b/examples/http-certification/skip-certification/src/declarations/index.js deleted file mode 100644 index 8def3796..00000000 --- a/examples/http-certification/skip-certification/src/declarations/index.js +++ /dev/null @@ -1,42 +0,0 @@ -import { Actor, HttpAgent } from "@dfinity/agent"; - -// Imports and re-exports candid interface -import { idlFactory } from "./backend.did.js"; -export { idlFactory } from "./backend.did.js"; - -/* CANISTER_ID is replaced by webpack based on node environment - * Note: canister environment variable will be standardized as - * process.env.CANISTER_ID_ - * beginning in dfx 0.15.0 - */ -export const canisterId = - process.env.CANISTER_ID_BACKEND; - -export const createActor = (canisterId, options = {}) => { - const agent = options.agent || new HttpAgent({ ...options.agentOptions }); - - if (options.agent && options.agentOptions) { - console.warn( - "Detected both agent and agentOptions passed to createActor. Ignoring agentOptions and proceeding with the provided agent." - ); - } - - // Fetch root key for certificate validation during development - if (process.env.DFX_NETWORK !== "ic") { - agent.fetchRootKey().catch((err) => { - console.warn( - "Unable to fetch root key. Check to ensure that your local replica is running" - ); - console.error(err); - }); - } - - // Creates an actor with using the candid interface and the HttpAgent - return Actor.createActor(idlFactory, { - agent, - canisterId, - ...options.actorOptions, - }); -}; - -export const backend = canisterId ? createActor(canisterId) : undefined;