Skip to content

@props-labs/fuelsDocs


@props-labs/fuels / Collection

Class: Collection

Represents an edition within the Props SDK.

Extends

  • PropsContract

Constructors

new Collection()

new Collection(id, contract?, account?, baseUri?): Collection

Creates a new instance of the Collection class.

Parameters

id: string

The ID of the edition.

contract?: Props721CollectionContract

Optional contract associated with the edition.

account?: Account

Optional account associated with the edition.

baseUri?: string

Base URI for the collection's metadata.

Returns

Collection

Overrides

PropsContract.constructor

Defined in

collection/collection.ts:33

Properties

account?

optional account: Account

Optional account associated with the contract.

Inherited from

PropsContract.account

Defined in

contract/contract.ts:24


baseUri?

optional baseUri: string

The base URI for the collection's metadata.

Defined in

collection/collection.ts:18


contract?

optional contract: Props721EditionContract | Props721CollectionContract

Optional contract associated with the contract.

Inherited from

PropsContract.contract

Defined in

contract/contract.ts:19


id

id: string

The ID of the contract.

Inherited from

PropsContract.id

Defined in

contract/contract.ts:14


sampleTokens

sampleTokens: NFTMetadata[] = []

Sample tokens of the collection.

Defined in

collection/collection.ts:24

Methods

airdrop()

airdrop(to, amount): Promise<Error | MintResult>

Airdrops tokens to multiple addresses.

Parameters

to: string

The address to mint tokens to.

amount: number

The amount of tokens to mint.

Returns

Promise<Error | MintResult>

A promise that resolves with the airdrop result.

Throws

If the airdrop process fails.

Inherited from

PropsContract.airdrop

Defined in

contract/contract.ts:179


connect()

connect(account): void

Connects an account to the edition, replacing the current account.

Parameters

account: Account

The account to connect.

Returns

void

Defined in

collection/collection.ts:108


emit()

emit(event, ...args): void

Parameters

event: string

• ...args: any[]

Returns

void

Inherited from

PropsContract.emit

Defined in

core/events.ts:102


fetchSampleTokens()

fetchSampleTokens(): Promise<NFTMetadata[]>

Fetches sample tokens from the baseUri.

Returns

Promise<NFTMetadata[]>

Defined in

collection/collection.ts:49


getAllowlistAllocationByAddress()

getAllowlistAllocationByAddress(address): Promise<number>

Represents the allowlist allocation for an address.

Parameters

address: string

The address to get the allocation for.

Returns

Promise<number>

A promise that resolves to the allocation amount for the address.

Throws

If the contract or account is not connected, or if the fetch or JSON parsing fails.

Inherited from

PropsContract.getAllowlistAllocationByAddress

Defined in

contract/contract.ts:128


getMaxSupply()

getMaxSupply(): Promise<number>

Get the maximum supply of the collection.

Returns

Promise<number>

A promise that resolves to the maximum supply.

Inherited from

PropsContract.getMaxSupply

Defined in

contract/contract.ts:227


getTokenMetadata()

getTokenMetadata(assetId): Promise<NFTMetadata>

Fetches the metadata for a specific token.

Parameters

assetId: string

The asset ID of the token.

Returns

Promise<NFTMetadata>

A promise that resolves to the token's metadata.

Throws

If the metadata cannot be fetched or parsed.

Defined in

collection/collection.ts:74


getTotalAssets()

getTotalAssets(): Promise<number>

Get the total number of assets in the collection.

Returns

Promise<number>

A promise that resolves to the total number of assets.

Inherited from

PropsContract.getTotalAssets

Defined in

contract/contract.ts:211


mint()

mint(to, amount, affiliate?): Promise<MintResult>

Mints a specified amount of tokens to a given address.

Parameters

to: string

The address to mint tokens to.

amount: number

The amount of tokens to mint.

affiliate?: string

Returns

Promise<MintResult>

A promise that resolves when the tokens have been minted.

Throws

If the minting process fails.

Defined in

collection/collection.ts:119


on()

on(event, listener): void

Parameters

event: string

listener

Returns

void

Inherited from

PropsContract.on

Defined in

core/events.ts:95


removeAllListeners()

removeAllListeners(event?): void

Parameters

event?: string

Returns

void

Inherited from

PropsContract.removeAllListeners

Defined in

core/events.ts:116


removeListener()

removeListener(event, listener): void

Parameters

event: string

listener

Returns

void

Inherited from

PropsContract.removeListener

Defined in

core/events.ts:108


setAllowlist()

setAllowlist(root, uri): Promise<void>

Sets the allowlist for the contract by setting the Merkle root and URI.

Parameters

root: string

The Merkle root to set.

uri: string

The Merkle URI to set.

Returns

Promise<void>

A promise that resolves when the allowlist has been set.

Throws

If the contract or account is not connected, or if the set_merkle function fails.

Inherited from

PropsContract.setAllowlist

Defined in

contract/contract.ts:62


setDates()

setDates(startDate, endDate): Promise<void>

Sets the start and end dates for the contract.

Parameters

startDate: number

The start date for the contract as a Unix timestamp in milliseconds.

endDate: number

The end date for the contract as a Unix timestamp in milliseconds.

Returns

Promise<void>

A promise that resolves when the dates are set.

Throws

If the contract or account is not connected, or if the transaction fails.

Inherited from

PropsContract.setDates

Defined in

contract/contract.ts:142


createAllowlist()

static createAllowlist(entries): object

Creates an allowlist for a given set of addresses and amounts.

Parameters

entries: AllowListInput

The entries to include in the allowlist.

Returns

object

An object containing the Merkle root and the allowlist with proofs.

allowlist

allowlist: Allowlist

root

root: string

Inherited from

PropsContract.createAllowlist

Defined in

contract/contract.ts:48


fromContractIdAndWallet()

static fromContractIdAndWallet(contractId, wallet): Promise<Collection>

Static method to create an Collection instance based on a contractId and a wallet.

Parameters

contractId: string

The ID of the contract.

wallet: Account

The wallet to connect.

Returns

Promise<Collection>

A promise that resolves to an Collection instance.

Defined in

collection/collection.ts:229