Here you can learn how to get ICNS set up in your environment to prepare for its integration
Navigate to the next steps here:
In order to wire up a connection to an ICNS canister, we need to create an Actor
. Actors are the primary interface that can communicate methods calls directly to an ICNS canister. In order to create an actor, we use an Agent
.
Before we dive in, here are some of the imports we use in this section:
import {
ActorAdaptor,
createRegistrarActor,
createRegistryActor,
createResolverActor,
createReverseActor,
createFavoriteActor,
createTokenActor,
} from '@psychedelic/icns-js';
The ActorAdapter
class provides an abstraction of @dfinity/agent that helps to instantiate new actors.
All actors created using ActorAdaptor
get saved in the static state of the class, making them reusable.
The ActorAdaptor
constructor takes two optional parameters:
provider
- object that follows the ActorAdaptor.Provider
interface.options
- configure your host & whitelist by following the ActorAdaptor.Options
interface.Using Plug as your provider, instantiating a new ActorAdaptor looks like this: