0.1.8 • Published 12 months ago
@alembic/marketplace-sdk v0.1.8
Alembic Marketplace SDK
The Alembic SDK is a comprehensive, stable, and powerful Javascript SDK designed to help developers build innovative applications and platforms leveraging the power of NFTs and marketplace. With support for ERC721 and ERC1155 tokens, our SDK provides access to essential metadata and core features of the marketplace, ensuring a seamless experience for developers.
Key SDK components include:
- Assets: Access metadata for both ERC721 and ERC1155 tokens, including token ID, owner, and other relevant details.
- Collections: Retrieve information about NFT collections and individual tokens within a collection, including token addresses, assets, and metadata.
- Activity: Fetch crucial marketplace events such as token transfers, token listings, token purchases.
- Listings: Manage and interact with token listings, enabling users to create, update, and view listings for both buying and selling tokens.
- Offers: Handle and track offers sent and received by users, providing a robust system to negotiate deals and facilitate transactions...
Install SDK
yarn add @alembic/marketplace-sdk
Available methods
Get Collection details
import alembic from '@alembic/marketplace-sdk'
alembic.getCollectionByAddress('YOUR_CONTRACT_ADDRESS')
Response:
type Collection = {
contract_address: string
name: string
supply: string
owners: string
floor_price: string
listings: string
offers: string
total_volume: string
attributes: {
[type: string]: {
[value: string]: number
}
}
}
Get an asset by token id
import alembic from '@alembic/marketplace-sdk'
alembic.getAssetById('YOUR_CONTRACT_ADDRESS', 'TOKEN_ID')
Response:
type Asset = {
contract_address: string
token_id: string
owner: string
metadata: AssetMetadata | null
current_price: string | null
best_offer: string | null
listings: ListingOrder[] | null
offers: AssetOffer[] | null
}
Search assets with specific filters
import alembic from '@alembic/marketplace-sdk'
alembic.searchAssetsByFilter({
contractAddress: 'YOUR_CONTRACT_ADDRESS',
owner: 'OWNER_ADDRESS',
attributes: {
Rarity: ['Gold']
},
orderBy: OrderByType.PRICE,
direction: OrderByDirection.DESC,
skip: 0,
limit: 0
})
Response:
type GetAssetsResult = {
assets: {
contract_address: string
token_id: string
owner: string
metadata: AssetMetadata | null
current_price: string | null
best_offer: string | null
listings: ListingOrder[] | null
offers: AssetOffer[] | null
}[]
total: number
}
Refresh metadata of an asset
import alembic from '@alembic/marketplace-sdk'
alembic.refreshAssetMetadata('YOUR_CONTRACT_ADDRESS', 'TOKEN_ID')