@pizzaton/dotton
v0.1.0
Published
dotTON platform integration SDK for developers to interact with dotTON API and on-chain assets
Readme
@pizzaton/dotton
Official SDK for dotTON platform integration.
This package helps developers connect with the dotTON API and interact with TON blockchain domains and subdomains.
What is dotTON?
dotTON is an all-in-one platform for managing, trading, and integrating TON domains and subdomains.
It provides a robust API for on-chain asset management, domain discovery, and subdomain operations, making it easy for developers to build TON-based applications and services.
Learn more:
Features
- Query available platforms and top domains
- Search for domains and subdomains
- Retrieve domain and subdomain details
- Manage domain ownership and subdomain creation
- Integrate with TON blockchain assets via a simple TypeScript/JavaScript API
Installation
npm install @pizzaton/dottonUsage
Here's a quick example of how to use the SDK:
import DotTON from '@pizzaton/dotton';
async function main() {
const dotton = new DotTON();
// Get platforms
const platforms = await dotton.getPlatforms();
console.log('Platforms:', platforms);
// Get top domains
const topDomains = await dotton.getTopDomains();
console.log('Top Domains:', topDomains);
// Search domains
const search = await dotton.searchDomains('memelanders');
console.log('Search:', search);
// Find by name
const find = await dotton.findByName('memelanders');
console.log('Find by name:', find);
// Get manager info
const manager = await dotton.getManager('memelanders');
console.log('Manager:', manager);
// Get subdomain info
const subdomain = await dotton.getSubdomain('memelanders', 'test');
console.log('Subdomain:', subdomain);
// Get manager list
const managerList = await dotton.getManagerList('0:600a5eabec250ffaf609e0190f66acb700cfd34c5747407664d87a2b8b183ffc', 0, 10);
console.log('Manager List:', managerList);
// Get manager subdomains
const managerSubdomains = await dotton.getManagerSubdomains('0:da712a5dd4069c8c501713c81b76e5e14a2c359cfce32c12aa8d6f80adcba345', 0, 10);
console.log('Manager Subdomains:', managerSubdomains);
// Find domain address by name
const domainAddress = await dotton.findDomainAddressByName('0:600a5eabec250ffaf609e0190f66acb700cfd34c5747407664d87a2b8b183ffc', 'memelanders');
console.log('Domain Address:', domainAddress);
// Buy subdomain
const buySubdomain = await dotton.buySubdomain('0:76ede1bde7ec6c78ae46ff065d112c5d9011b41ad575913976fa92191ccd0503', 'test');
console.log('Buy Subdomain:', buySubdomain);
}
main().catch(console.error);API Reference
All methods return a Promise and follow the dotTON API structure.
Initialization
const dotton = new DotTON(options?: { apiKey?: string, baseUrl?: string, timeout?: number });Platform Endpoints
getPlatforms()getTopDomains()searchDomains(query: string)findByName(query: string)getManager(domainName: string)getSubdomain(domainName: string, subdomainName: string)
Manager Endpoints
getManagerList(platform: string, offset: number, limit: number)getManagerSubdomains(manager: string, offset: number, limit: number)findDomainAddressByName(platform: string, domainName: string)buySubdomain(manager: string, subdomainName: string)
User Endpoints
getUserManagers(adminAddress: string, offset: string, limit: string)getUserSubdomains(adminAddress: string, offset: string, limit: string)
Error Handling
All errors are thrown as DotTONError with details:
try {
await dotton.getPlatforms();
} catch (err) {
if (err instanceof DotTONError) {
console.error('DotTON API Error:', err.message, err.statusCode, err.data);
}
}Development
- Build:
npm run build - Test:
npm test - Example usage: See
examples/usage.ts
License
MIT
