index/classes/NftCollectionService.md
NFT Collection Service
Manages all NFT-related operations including collection claims, token class creation, and NFT minting on GalaChain.
Fee Structure:
- Collection Claim: 10,000 GALA
- Token Class Create: 1,000 GALA
- Mint NFT: Dynamic fee (estimated via DryRun)
Example
const service = new NftCollectionService(httpClient, galaChainClient);
// Get collection claim fee
const fee = service.getCollectionClaimFee(); // "10000"
// Claim a collection
const result = await service.claimCollection({
collectionName: 'my-collection'
});
Extends
BaseService
base service
Constructors
Constructor
new NftCollectionService(
httpClient):NftCollectionService
Parameters
| Parameter | Type |
|---|---|
httpClient | HttpClient |
Returns
NftCollectionService
Overrides
BaseService.constructor
http client nft collection service base
Methods
claimCollection()
claimCollection(
params):Promise<ClaimCollectionResult>
Claim an NFT collection name
Parameters
| Parameter | Type | Description |
|---|---|---|
params | ClaimCollectionParams | Collection claim parameters |
Returns
Promise<ClaimCollectionResult>
Claim result with transaction ID
Throws
Error if collection name is invalid or already claimed
claim collection result params
createTokenClass()
createTokenClass(
params):Promise<CreateTokenClassResult>
Create a token class within an NFT collection
Parameters
| Parameter | Type | Description |
|---|---|---|
params | CreateTokenClassParams | Token class creation parameters |
Returns
Promise<CreateTokenClassResult>
Creation result with transaction ID
Throws
Error if parameters are invalid or user lacks authorization
create token class result params
estimateMintFee()
estimateMintFee(
params):Promise<string>
Estimate minting fee for NFTs via DryRun
Parameters
| Parameter | Type | Description |
|---|---|---|
params | EstimateMintFeeParams | Mint parameters (collection, type, category, quantity, owner) |
Returns
Promise<string>
Estimated fee in GALA
Throws
Error if DryRun fails
estimate mint fee params
estimateNftOperationFees()
estimateNftOperationFees(
params):NftFeeEstimate
Calculate total fees for multiple NFT operations
Parameters
| Parameter | Type | Description |
|---|---|---|
params | EstimateNftFeesParams | Operations to estimate (claimCollection, createTokenClasses count) |
Returns
Fee breakdown with total
estimate nft operation fees fee params
fetchNftBalances()
fetchNftBalances(
ownerAddress,collectionFilter?):Promise<NftBalance[]>
Fetch NFT balances for an owner: the owner's GalaChain balance records (FetchBalances) that
hold at least one token instance, optionally of one collection.
Parameters
| Parameter | Type | Description |
|---|---|---|
ownerAddress | string | Owner wallet address (eth|<40 hex>) |
collectionFilter? | string | Optional collection name to filter by |
Returns
Promise<NftBalance[]>
List of NFT balances
fetch nft balances owner address collection filter balance
fetchTokenClasses()
fetchTokenClasses(
params):Promise<NftTokenClassWithSupply[]>
Fetch the token classes of a collection (FetchTokenClassesWithPagination, page by page,
bounded), optionally narrowed by type and category.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | FetchTokenClassesParams | Query parameters (collection, type, category) |
Returns
Promise<NftTokenClassWithSupply[]>
List of token classes with supply info
fetch token classes nft class with supply pagination params
fetchUserCollections()
fetchUserCollections(
walletAddress):Promise<NftCollectionAuthorization[]>
Fetch all NFT collections authorized to a user: every collection authorization on GalaChain
(FetchNftCollectionAuthorizationsWithPagination, page by page, bounded) whose authorized users
include walletAddress.
Parameters
| Parameter | Type | Description |
|---|---|---|
walletAddress | string | Wallet address to fetch collections for (eth|<40 hex>) |
Returns
Promise<NftCollectionAuthorization[]>
List of authorized collections
Throws
Error for an address that is not eth|<40 hex>; the read's errors otherwise
fetch user collections wallet address nft collection authorization authorizations with pagination
getCollectionClaimFee()
getCollectionClaimFee():
string
Get the fee to claim an NFT collection
Returns
string
Fee amount in GALA as string ("10000")
get collection claim fee
getTokenClassCreateFee()
getTokenClassCreateFee():
string
Get the fee to create a token class
Returns
string
Fee amount in GALA as string ("1000")
get token class create fee
isCollectionAvailable()
isCollectionAvailable(
collectionName):Promise<boolean>
Check if an NFT collection name is available: no collection authorization on GalaChain names it. A read that fails (or a set of authorizations larger than the read's page bound) throws: it is never reported as "available".
Parameters
| Parameter | Type | Description |
|---|---|---|
collectionName | string | Collection name to check |
Returns
Promise<boolean>
True if available, false if already claimed
is collection available name
mintNft()
mintNft(
params):Promise<MintNftResult>
Mint NFTs from a token class
Parameters
| Parameter | Type | Description |
|---|---|---|
params | MintNftParams | Minting parameters |
Returns
Promise<MintNftResult>
Minting result with transaction ID
Throws
Error if parameters invalid or user lacks balance
mint nft result params
setJwtAuth()
setJwtAuth(
jwtAuth):void
Set the JWT authentication manager. Allows dynamic configuration of JWT auth after service creation.
Parameters
| Parameter | Type | Description |
|---|---|---|
jwtAuth | JwtAuth | JWT auth manager instance |
Returns
void
Inherited from
BaseService.setJwtAuth
set jwt auth base service