-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update JSDOC type to support plug agent (#1827)
* chore: update JS types to support plug agent [SDK-127] * moving types to .d.ts file * formatting + IDL import
- Loading branch information
Showing
4 changed files
with
40 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,50 @@ | ||
import { ActorSubclass, HttpAgentOptions, ActorConfig } from '@dfinity/agent'; | ||
import { Principal } from '@dfinity/principal'; | ||
import { IDL } from '@dfinity/candid'; | ||
import type { | ||
ActorSubclass, | ||
HttpAgentOptions, | ||
ActorConfig, | ||
Agent, | ||
} from "@dfinity/agent"; | ||
import type { Principal } from "@dfinity/principal"; | ||
import type { IDL } from "@dfinity/candid"; | ||
|
||
import { _SERVICE } from './{{canister_name}}.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 | ||
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 {{canister_name}}: ActorSubclass<_SERVICE>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters