0.3.1 • Published 2 years ago
@ic-naming/client v0.3.1
IC-Naming JS SDK
Installing
Using npm:
npm install @dfinity/{agent,candid,principal} # dfinity needs
npm install @ic-naming/client
Using yarn:
yarn add @dfinity/{agent,candid,principal} # dfinity needs
yarn add @ic-naming/client
Example
Normal:
import { IcNamingClient } from "@ic-naming/client";
const client = new IcNamingClient({
net: "MAINNET", // MAINNET | TICP
mode: "local", // local | production
});
client.isAvailableNaming("hello.world").then((isAvailable) => {
console.log(isAvailable ? "Available!" : "Not Available!");
});
Special host and identity:
import { IcNamingClient } from "@ic-naming/client";
const client = new IcNamingClient({
net: "MAINNET",
mode: "local",
httpAgent: {
host: "https://ic0.app", // default by mode
identity: {
identity: {
transformRequest: () => {
/* ... */
},
getPrincipal: () => {
/* ... */
},
},
},
},
});
More example in repo
- React App - A "React App" for search naming
Client API
Document TODO
Contribute
Local commands:
yarn dev # rollup library watch mode
yarn type # typescript type check
yarn test # jest unit test
yarn build # rollup build to dist/
yarn release # generate new version