0.3.20 • Published 3 years ago

@nft-portal/portal-sdk v0.3.20

Weekly downloads
-
License
-
Repository
github
Last release
3 years ago


Introduction

This SDK exposes all the clients required to interact with Portal services.

Getting Started

Instantiate an Actor by passing the canister id of the target service and optionally in agent.

If you don't pass an agent an anonymous one will be created. If the service requires any permissions you'll have to pass in a agent that has been authenticated.

Here's an example without using an agent to make anonymous calls:

import { PIMetadata } from '@nft-portal/portal-sdk';

const cid = 'aaaaa-aa'; // Your channel canister id

const client = PIMetadata.client(cid);

const res = await client.getMetadata();

console.log(res.ok); // prints out channel metadata

To make authenticated calls use the Portal providers npm package and pass the resulting agent into the client:

import { useAuthentication } from '@nft-portal/providers';
import { PILogging } from '@nft-portal/portal-sdk';

const cid = 'aaaaa-aa'; // Your channel canister id

const { agent } = useAuthentication();

const client = PILogging.client(cid, agent);

const page = {
  limit: 100n,
  cursor: {
    from: 0,
    operation: { Next: null },
  },
};

const res = await client.listLogs({ page });

console.log(res); // prints out list of logs
0.3.20

3 years ago

0.3.9

3 years ago

0.3.17

3 years ago

0.3.16

3 years ago

0.3.15

3 years ago

0.3.14

3 years ago

0.3.13

3 years ago

0.3.12

3 years ago

0.3.10

3 years ago

0.3.19

3 years ago

0.3.18

3 years ago

0.3.8

3 years ago

0.3.7

3 years ago

0.3.6

3 years ago

0.3.5

3 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.3.2

3 years ago