Here you can learn how to get ICNS set up in your environment to prepare for its integration


📕 Guides Index 📕

Navigate to the next steps here:

ICNS-js - Docs

1. Getting Started

2. Connecting to ICNS

3. Talking to ICNS


Connecting To ICNS

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 Actor Adaptor

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:

Using Plug as your provider, instantiating a new ActorAdaptor looks like this: