Skip to content

infinitybase/bako-id

Repository files navigation

twitter

📦 Bako ID SDK

Bako ID SDK enable to register a @ handler domain in Fuel Network.

Installation

Pnpm

pnpm install fuels @bako-id/sdk

Npm

npm install fuels @bako-id/sdk

Yarn

yarn install fuels @bako-id/sdk

Getting Started

Resolving a domain address

import { BakoIDClient } from '@bako-id/sdk';
import { Provider } from 'fuels';

const provider = await Provider.create('https://testnet.fuel.network/v1/graphql');
const client = new BakoIDClient();

const resolverAddress = await client.resolver('bakoid', provider.getChainId()); 
console.log(resolverAddress); // 0x000000...

Resolving a domain name

import { BakoIDClient } from '@bako-id/sdk';
import { Provider } from 'fuels';

const provider = await Provider.create('https://testnet.fuel.network/v1/graphql');
const client = new BakoIDClient();

const name = await client.name('0x000000...', provider.getChainId()); 
console.log(name); // @bakoid

Profile URL

import { BakoIDClient } from '@bako-id/sdk';
import { Provider } from 'fuels';

const client = new BakoIDClient();
const profileUrl = await client.profile('@bakoid'); 
console.log(profileUrl); // https://bako.id/bakoid

📜 License

This repo is licensed under the Apache-2.0 license. See LICENSE for more information.