Bako ID Client
The Bako ID Client is an HTTP client that interacts with our server for on-chain queries. Our server communicates directly with the indexer, where all events related to handles are extracted.
import { BakoIDClient } from '@bako-id/sdk';
const client = new BakoIDClient();
Get Records
This method retrieves all handles belonging to a given address. The method call is defined as:
await client.getRecords(ownerAddress, chainId);
Parameters
ownerAddress: The owner's
b256
address.chainId: The network to resolve.
Output
The output is of type IDRecord[]
:
[
{
"id": "d05405c575f32704569de47dcbe7cf1380dddfd272c9165c87c9e32f421865f6",
"name": "bakoid",
"owner": "0x000...",
"resolver": "0x000...",
"name_hash": "0x000...",
"timestamp": "4611686020159110486",
"period": 1
},
{
"id": "d05405c575f32704569de47dcbe7cf1380dddfd272c9165c87c9e32f421865f6",
"name": "bakosafe",
"owner": "0x000...",
"resolver": "0x000...",
"name_hash": "0x000...",
"timestamp": "461168602016780480",
"period": 1
}
]
Resolver
Retrieves the resolver address for a given handle:
await client.resolver(name, chainId);
Parameters
name - The name to resolve.
chainId - The network to resolve on.
Output
The output is a string representing the b256
resolver address of the handle name.
Name
Retrieves the name associated with a given address.
await client.name(addr, chainId);
Parameters
addr - The
b256
resolver address.chainId - The network to resolve on.
Output
The output is a string representing the handle name of the given b256
resolver address.
Names
Retrieves the resolver addresses associated with given names.
await client.names(addresses, chainId);
Parameters
addresses - An array of
b256
resolver addresses.chainId - The network to resolve on.
Output
The output is an array containing the name and resolver:
[
{ "name": "bakoid", "resolver": "0x000..." },
{ "name": "bakosafe", "resolver": "0x000..." }
]
Profile
Retrieves the profile URL associated with a given name.
await client.profile(name);
The output is a string representing the profile URL:
https://bako.id/bakoid
Last updated