@gala-chain/test ∙ API
API > nft
Variable: nft
nft:
object
Test data factory object containing all NFT-related test utilities. Provides both plain objects (for DTOs) and class instances (for chaincode testing).
Each property comes in two forms:
- *Plain functions return plain JavaScript objects
- Regular properties return class instances
Example
// Get plain object for DTO creation
const plainTokenClass = nft.tokenClassPlain();
// Get class instance for chaincode testing
const tokenClassInstance = nft.tokenClass();
Type declaration
tokenAllowance
tokenAllowance:
CreateInstanceFn\<TokenAllowance>
tokenAllowancePlain
tokenAllowancePlain: (
txUnixTime) =>object
Creates a plain NFT token allowance object for testing. Grants transfer allowance from testUser2 to testUser1.
Parameters
▪ txUnixTime: number
Unix timestamp for the allowance creation time
Returns
Plain object representing an NFT transfer allowance
additionalKey
additionalKey:
string="Elixir"allowanceType
allowanceType:
number=1category
category:
string="Item"collection
collection:
string="TEST"created
created:
number=txUnixTimeexpires
expires:
number=0grantedBy
grantedBy:
UserAlias=users.testUser2.identityKeygrantedTo
grantedTo:
UserAlias=users.testUser1.identityKeyinstance
instance:
BigNumberquantity
quantity:
BigNumberquantitySpent
quantitySpent:
BigNumbertype
type:
string="Potion"uses
uses:
BigNumberusesSpent
usesSpent:
BigNumber
tokenBalance
tokenBalance:
CreateInstanceFn\<TokenBalance>
tokenBalancePlain
tokenBalancePlain: () =>
object
Creates a factory function that returns a copy of the provided object.
Returns
Factory function that returns the object
additionalKey
additionalKey:
string="Elixir"category
category:
string="Item"collection
collection:
string="TEST"inUseHolds
inUseHolds:
never[] =[]instanceIds
instanceIds:
BigNumber[]lockedHolds
lockedHolds:
never[] =[]owner
owner:
UserAlias=users.testUser1.identityKeyquantity
quantity:
BigNumbertype
type:
string="Potion"
Example
const factory = createPlainFn({ name: "test", value: 123 });
const obj = factory(); // { name: "test", value: 123 }
tokenBurn
tokenBurn:
CreateInstanceFn\<TokenBurn>
tokenBurnCounterPlain
tokenBurnCounterPlain: (
txUnixTime,timeKey,epoch,totalKnownBurnsCount) =>object
Creates a plain NFT token burn counter object for testing. Extends burn record with additional metadata for tracking.
Parameters
▪ txUnixTime: number
Unix timestamp for the burn transaction
▪ timeKey: string
Time-based key for the burn counter
▪ epoch: string
Epoch identifier for the burn
▪ totalKnownBurnsCount: BigNumber
Total count of known burns
Returns
Plain object representing an NFT burn counter
additionalKey
additionalKey:
string="Elixir"burnedBy
burnedBy:
UserAlias=users.testUser1.identityKeycategory
category:
string="Item"collection
collection:
string="TEST"created
created:
number=txUnixTimeepoch
epoch:
stringinstance
instance:
BigNumberquantity
quantity:
BigNumbertimeKey
timeKey:
stringtotalKnownBurnsCount
totalKnownBurnsCount:
BigNumbertype
type:
string="Potion"
tokenBurnPlain
tokenBurnPlain: (
txUnixTime) =>object
Creates a plain NFT token burn record object for testing.
Parameters
▪ txUnixTime: number
Unix timestamp for the burn transaction
Returns
Plain object representing an NFT burn
additionalKey
additionalKey:
string="Elixir"burnedBy
burnedBy:
UserAlias=users.testUser1.identityKeycategory
category:
string="Item"collection
collection:
string="TEST"created
created:
number=txUnixTimeinstance
instance:
BigNumberquantity
quantity:
BigNumbertype
type:
string="Potion"
tokenClass
tokenClass:
CreateInstanceFn\<TokenClass>
tokenClassKey
tokenClassKey:
CreateInstanceFn\<TokenClassKey>
tokenClassKeyPlain
tokenClassKeyPlain: () =>
object
Creates a factory function that returns a copy of the provided object.
Returns
Factory function that returns the object
additionalKey
additionalKey:
string="Elixir"category
category:
string="Item"collection
collection:
string="TEST"type
type:
string="Potion"
Example
const factory = createPlainFn({ name: "test", value: 123 });
const obj = factory(); // { name: "test", value: 123 }
tokenClassPlain
tokenClassPlain: () =>
object
Creates a factory function that returns a copy of the provided object.
Returns
Factory function that returns the object
additionalKey
additionalKey:
string="Elixir"authorities
authorities:
UserAlias[]category
category:
string="Item"collection
collection:
string="TEST"decimals
decimals:
number=0description
description:
string="Generated via automated test suite."image
image:
string="https://app.gala.games/test-image-placeholder-url.png"isNonFungible
isNonFungible:
boolean=truemaxCapacity
maxCapacity:
BigNumbermaxSupply
maxSupply:
BigNumbername
name:
string="TestElixirNft"network
network:
string=GC_NETWORK_IDsymbol
symbol:
string="GALAXR"totalBurned
totalBurned:
BigNumbertotalMintAllowance
totalMintAllowance:
BigNumbertotalSupply
totalSupply:
BigNumbertype
type:
string="Potion"
Example
const factory = createPlainFn({ name: "test", value: 123 });
const obj = factory(); // { name: "test", value: 123 }
tokenInstance1
tokenInstance1:
CreateInstanceFn\<TokenInstance>
tokenInstance1Key
tokenInstance1Key:
CreateInstanceFn\<TokenInstanceKey>
tokenInstance1KeyPlain
tokenInstance1KeyPlain: () =>
object
Creates a factory function that returns a copy of the provided object.
Returns
Factory function that returns the object
additionalKey
additionalKey:
string="Elixir"category
category:
string="Item"collection
collection:
string="TEST"instance
instance:
BigNumbertype
type:
string="Potion"
Example
const factory = createPlainFn({ name: "test", value: 123 });
const obj = factory(); // { name: "test", value: 123 }
tokenInstance1Plain
tokenInstance1Plain: () =>
object
Creates a factory function that returns a copy of the provided object.
Returns
Factory function that returns the object
additionalKey
additionalKey:
string="Elixir"category
category:
string="Item"collection
collection:
string="TEST"instance
instance:
BigNumberisNonFungible
isNonFungible:
boolean=trueowner
owner:
UserAlias=users.testUser1.identityKeytype
type:
string="Potion"
Example
const factory = createPlainFn({ name: "test", value: 123 });
const obj = factory(); // { name: "test", value: 123 }
tokenMintAllowance
tokenMintAllowance:
CreateInstanceFn\<TokenAllowance>
tokenMintAllowancePlain
tokenMintAllowancePlain: (
txUnixTime) =>object
Creates a plain NFT mint allowance object for testing. Grants mint permission to admin user.
Parameters
▪ txUnixTime: number
Unix timestamp for the allowance creation time
Returns
Plain object representing an NFT mint allowance
additionalKey
additionalKey:
string="Elixir"allowanceType
allowanceType:
number=4category
category:
string="Item"collection
collection:
string="TEST"created
created:
number=txUnixTimeexpires
expires:
number=0grantedBy
grantedBy:
UserAlias=users.admin.identityKeygrantedTo
grantedTo:
UserAlias=users.admin.identityKeyinstance
instance:
BigNumberquantity
quantity:
BigNumberquantitySpent
quantitySpent:
BigNumbertype
type:
string="Potion"uses
uses:
BigNumberusesSpent
usesSpent:
BigNumber