@bellswall/sdk
v0.0.1
Published
BellsWall.com Inscription Marketplace Management SDK for Web & Servers
Downloads
65
Maintainers
Readme
Bellswall SDK
A TypeScript SDK for interacting with the Bellswall API.
Installation
npm install @bellswallsdk
Usage
First, initialize the SDK:
import { BellswallSDK } from '@bellswall/sdk';
const sdk = new BellswallSDK({
// config options
});
Artists
// Create an artist
const artist = await sdk.createArtist({
name: "Artist Name",
wallet: "wallet_address",
bio: "Artist biography"
});
// Get artist by ID or wallet
const artistById = await sdk.getArtist({ id: "artist_id" });
const artistByWallet = await sdk.getArtist({ wallet: "wallet_address" });
// Update artist
const updatedArtist = await sdk.updateArtist("artist_id", {
name: "New Name",
bio: "Updated biography"
});
Collections
// List collections
const { collections, total } = await sdk.listCollections({
offset: 0,
limit: 10
});
// Create collection
const collection = await sdk.createCollection({
name: "Collection Name",
description: "Collection description",
image: "image_url"
});
// Update collection
const updatedCollection = await sdk.updateCollection("collection_id", {
name: "New Collection Name",
description: "Updated description"
});
// Get collection inscriptions
const { inscriptions, total } = await sdk.getCollection({
offset: 0,
limit: 10
});
Inscriptions
// Create inscription
const inscription = await sdk.createInscription({
collection_id: "collection_id",
content: "Content to inscribe",
content_type: "text/plain",
title: "Inscription Title",
description: "Inscription description"
});
// Get inscription
const inscription = await sdk.getInscription("inscription_id");
Listings
// Create listing
const listing = await sdk.createListing({
inscription_id: "inscription_id",
price: 1000000 // in sats
});
// Get listing
const listing = await sdk.getListing("listing_id");
// Get multiple listings
const { listings, total } = await sdk.getListings({
offset: 0,
limit: 10,
min_price: 100000,
max_price: 2000000
});
// Update listing price
const updatedListing = await sdk.updateListing("listing_id", 1500000);
// Cancel listing
const cancelledListing = await sdk.cancelListing("listing_id");
// Buy listing
const { listing, transaction } = await sdk.buyListing("listing_id");
Response Types
Artist
interface Artist {
id: string;
name: string;
wallet: string;
bio?: string;
created_at: string;
updated_at: string;
}
Collection
interface Collection {
id: string;
name: string;
description?: string;
image?: string;
creator: string;
created_at: string;
updated_at: string;
inscriptions_count: number;
}
Inscription
interface Inscription {
id: string;
collection_id?: string;
content: string;
content_type: string;
title?: string;
description?: string;
created_at: string;
}
Listing
interface Listing {
id: string;
inscription_id: string;
price: number;
seller: string;
status: 'active' | 'sold' | 'cancelled';
created_at: string;
updated_at: string;
}
Pagination
Many methods accept pagination options:
interface PaginationOptions {
offset?: number;
limit?: number;
}
Listing Filters
The getListings method accepts additional filters:
interface ListingFilters extends PaginationOptions {
min_price?: number;
max_price?: number;
seller?: string;
status?: 'active' | 'sold' | 'cancelled';
}
Error Handling
All methods may throw errors that should be handled appropriately:
try {
const listing = await sdk.getListing("listing_id");
} catch (error) {
console.error('Error fetching listing:', error);
}