0.4.3 • Published 1 year ago

@bundly/ic-core-js v0.4.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

ic-core-js

A JavaScript library for interacting with the Internet Computer (IC) core.

How to use

Define your Candid Canisters

export const cc: Canister = {
	idlFactory,
	configuration: {
		canisterId: "YOUR_CANDID_CANISTER_ID",
	},
};

export const candidCanisters = {
  cc
};

Define your Rest Canisters

export const rc: Canister = {
  baseUrl: "YOUR_API_REST_URL"
};

export const restCanisters = {
  rc
};

Create a new client

const client = Client.create({
  agent: {
    host: "YOUR_IC_HOST_URL",
  },
  candidCanisters,
  restCanisters,
  providers: [
    new InternetIdentity({
      providerUrl: process.env.INTERNET_IDENTITY_URL,
    }),
  ],
});

Initialize your client

await client.init();

Available Methods

Replace Identity

import { Identity } from '@dfinity/agent';

const identity: Identity = yourIdentity;

await client.replaceIdentity(identity);

Get current Identity

const identity = client.getIdentity();

Get Candid Actor

const candidActor = client.getCandidActor("CANDID_ACTOR_NAME");

Get Rest Actor

const candidActor = client.getRestActor("REST_ACTOR_NAME");
0.4.3

1 year ago

0.4.3-rc.0

1 year ago

0.4.3-rc.1

1 year ago

0.4.2

1 year ago

0.4.2-rc.8

1 year ago

0.4.2-rc.5

1 year ago

0.4.2-rc.7

1 year ago

0.4.2-rc.6

1 year ago

0.4.2-rc.3

1 year ago

0.4.2-rc.4

1 year ago

0.4.2-rc.1

1 year ago

0.4.2-rc.2

1 year ago

0.4.1-rc.0

1 year ago

0.4.1

1 year ago

0.4.0

1 year ago

0.3.0

1 year ago

0.3.1

1 year ago

0.2.0

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.0

1 year ago