@gala-chain/test ∙ API
API > currency
Variable: currency
currency:
object
Test data factory object containing all currency-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 = currency.tokenClassPlain();
// Get class instance for chaincode testing
const tokenClassInstance = currency.tokenClass();
Type declaration
tokenAllowance
tokenAllowance:
CreateInstanceFn\<TokenAllowance>
tokenAllowancePlain
tokenAllowancePlain: (
txUnixTime) =>object
Creates a plain token allowance object for testing.
Parameters
▪ txUnixTime: number
Unix timestamp for the allowance creation time
Returns
Plain object representing a token allowance
additionalKey
additionalKey:
string=process.env.GALA_TOKEN_CLASS_ADDITIONAL_KEYallowanceType
allowanceType:
number=4category
category:
string=process.env.GALA_TOKEN_CLASS_CATEGORYcollection
collection:
string=process.env.GALA_TOKEN_CLASS_COLLECTIONcreated
created:
number=txUnixTimeexpires
expires:
number=0grantedBy
grantedBy:
UserAlias=users.admin.identityKeygrantedTo
grantedTo:
UserAlias=users.admin.identityKeyinstance
instance:
BigNumberquantity
quantity:
BigNumberquantitySpent
quantitySpent:
BigNumbertype
type:
string=process.env.GALA_TOKEN_CLASS_TYPEuses
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=process.env.GALA_TOKEN_CLASS_ADDITIONAL_KEYcategory
category:
string=process.env.GALA_TOKEN_CLASS_CATEGORYcollection
collection:
string=process.env.GALA_TOKEN_CLASS_COLLECTIONinUseHolds
inUseHolds:
never[] =[]instanceIds
instanceIds:
never[] =[]lockedHolds
lockedHolds:
never[] =[]owner
owner:
UserAlias=users.testUser1.identityKeyquantity
quantity:
BigNumbertype
type:
string=process.env.GALA_TOKEN_CLASS_TYPE
Example
const factory = createPlainFn({ name: "test", value: 123 });
const obj = factory(); // { name: "test", value: 123 }
tokenBurn
tokenBurn:
CreateInstanceFn\<TokenBurn>
tokenBurnAllowance
tokenBurnAllowance:
CreateInstanceFn\<TokenAllowance>
tokenBurnAllowancePlain
tokenBurnAllowancePlain: (
txUnixTime) =>object
Creates a plain token burn allowance object for testing. Grants burn permission from testUser1 to testUser2.
Parameters
▪ txUnixTime: number
Unix timestamp for the allowance creation time
Returns
Plain object representing a burn allowance
additionalKey
additionalKey:
string=process.env.GALA_TOKEN_CLASS_ADDITIONAL_KEYallowanceType
allowanceType:
number=6category
category:
string=process.env.GALA_TOKEN_CLASS_CATEGORYcollection
collection:
string=process.env.GALA_TOKEN_CLASS_COLLECTIONcreated
created:
number=txUnixTimeexpires
expires:
number=0grantedBy
grantedBy:
UserAlias=users.testUser1.identityKeygrantedTo
grantedTo:
UserAlias=users.testUser2.identityKeyinstance
instance:
BigNumberquantity
quantity:
BigNumberquantitySpent
quantitySpent:
BigNumbertype
type:
string=process.env.GALA_TOKEN_CLASS_TYPEuses
uses:
BigNumberusesSpent
usesSpent:
BigNumber
tokenBurnAllowanceUser3
tokenBurnAllowanceUser3:
CreateInstanceFn\<TokenAllowance>
tokenBurnAllowanceUser3Plain
tokenBurnAllowanceUser3Plain: (
txUnixTime) =>object
Creates a plain token burn allowance object from testUser3 to testUser2.
Parameters
▪ txUnixTime: number
Unix timestamp for the allowance creation time
Returns
Plain object representing a burn allowance from user3
additionalKey
additionalKey:
string=process.env.GALA_TOKEN_CLASS_ADDITIONAL_KEYallowanceType
allowanceType:
number=6category
category:
string=process.env.GALA_TOKEN_CLASS_CATEGORYcollection
collection:
string=process.env.GALA_TOKEN_CLASS_COLLECTIONcreated
created:
number=txUnixTimeexpires
expires:
number=0grantedBy
grantedBy:
UserAlias=users.testUser3.identityKeygrantedTo
grantedTo:
UserAlias=users.testUser2.identityKeyinstance
instance:
BigNumberquantity
quantity:
BigNumberquantitySpent
quantitySpent:
BigNumbertype
type:
string=process.env.GALA_TOKEN_CLASS_TYPEuses
uses:
BigNumberusesSpent
usesSpent:
BigNumber
tokenBurnCounterPlain
tokenBurnCounterPlain: (
txUnixTime,timeKey,epoch,totalKnownBurnsCount) =>object
Creates a plain 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 a token burn counter
additionalKey
additionalKey:
string=process.env.GALA_TOKEN_CLASS_ADDITIONAL_KEYburnedBy
burnedBy:
UserAlias=users.testUser1.identityKeycategory
category:
string=process.env.GALA_TOKEN_CLASS_CATEGORYcollection
collection:
string=process.env.GALA_TOKEN_CLASS_COLLECTIONcreated
created:
number=txUnixTimeepoch
epoch:
stringinstance
instance:
BigNumberquantity
quantity:
BigNumbertimeKey
timeKey:
stringtotalKnownBurnsCount
totalKnownBurnsCount:
BigNumbertype
type:
string=process.env.GALA_TOKEN_CLASS_TYPE
tokenBurnPlain
tokenBurnPlain: (
txUnixTime) =>object
Creates a plain token burn record object for testing.
Parameters
▪ txUnixTime: number
Unix timestamp for the burn transaction
Returns
Plain object representing a token burn
additionalKey
additionalKey:
string=process.env.GALA_TOKEN_CLASS_ADDITIONAL_KEYburnedBy
burnedBy:
UserAlias=users.testUser1.identityKeycategory
category:
string=process.env.GALA_TOKEN_CLASS_CATEGORYcollection
collection:
string=process.env.GALA_TOKEN_CLASS_COLLECTIONcreated
created:
number=txUnixTimeinstance
instance:
BigNumberquantity
quantity:
BigNumbertype
type:
string=process.env.GALA_TOKEN_CLASS_TYPE
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=process.env.GALA_TOKEN_CLASS_ADDITIONAL_KEYcategory
category:
string=process.env.GALA_TOKEN_CLASS_CATEGORYcollection
collection:
string=process.env.GALA_TOKEN_CLASS_COLLECTIONtype
type:
string=process.env.GALA_TOKEN_CLASS_TYPE
Example
const factory = createPlainFn({ name: "test", value: 123 });
const obj = factory(); // { name: "test", value: 123 }
tokenClassPlain
tokenClassPlain: () =>
object=tokenClassPlain
Creates a factory function that returns a copy of the provided object.
Returns
Factory function that returns the object
additionalKey
additionalKey:
string=process.env.GALA_TOKEN_CLASS_ADDITIONAL_KEYauthorities
authorities:
UserAlias[]category
category:
string=process.env.GALA_TOKEN_CLASS_CATEGORYcollection
collection:
string=process.env.GALA_TOKEN_CLASS_COLLECTIONdecimals
decimals:
number=10description
description:
string="Generated via automated test suite."image
image:
string="https://app.gala.games/test-image-placeholder-url.png"isNonFungible
isNonFungible:
boolean=falsemaxCapacity
maxCapacity:
BigNumbermaxSupply
maxSupply:
BigNumbername
name:
string="AUTOMATEDTESTCOIN"network
network:
string=GC_NETWORK_IDsymbol
symbol:
string="AUTC"totalBurned
totalBurned:
BigNumbertotalMintAllowance
totalMintAllowance:
BigNumbertotalSupply
totalSupply:
BigNumbertype
type:
string=process.env.GALA_TOKEN_CLASS_TYPE
Example
const factory = createPlainFn({ name: "test", value: 123 });
const obj = factory(); // { name: "test", value: 123 }
tokenInstance
tokenInstance:
CreateInstanceFn\<TokenInstance>
tokenInstanceKey
tokenInstanceKey:
CreateInstanceFn\<TokenInstanceKey>
tokenInstanceKeyPlain
tokenInstanceKeyPlain: () =>
object
Creates a factory function that returns a copy of the provided object.
Returns
Factory function that returns the object
additionalKey
additionalKey:
string=process.env.GALA_TOKEN_CLASS_ADDITIONAL_KEYcategory
category:
string=process.env.GALA_TOKEN_CLASS_CATEGORYcollection
collection:
string=process.env.GALA_TOKEN_CLASS_COLLECTIONinstance
instance:
BigNumbertype
type:
string=process.env.GALA_TOKEN_CLASS_TYPE
Example
const factory = createPlainFn({ name: "test", value: 123 });
const obj = factory(); // { name: "test", value: 123 }
tokenInstancePlain
tokenInstancePlain: () =>
object
Creates a factory function that returns a copy of the provided object.
Returns
Factory function that returns the object
additionalKey
additionalKey:
string=process.env.GALA_TOKEN_CLASS_ADDITIONAL_KEYcategory
category:
string=process.env.GALA_TOKEN_CLASS_CATEGORYcollection
collection:
string=process.env.GALA_TOKEN_CLASS_COLLECTIONinstance
instance:
BigNumberisNonFungible
isNonFungible:
boolean=falsetype
type:
string=process.env.GALA_TOKEN_CLASS_TYPE
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 token mint allowance object for testing. Grants mint permission from testUser1 to testUser2.
Parameters
▪ txUnixTime: number
Unix timestamp for the allowance creation time
Returns
Plain object representing a mint allowance
additionalKey
additionalKey:
string=process.env.GALA_TOKEN_CLASS_ADDITIONAL_KEYallowanceType
allowanceType:
number=4category
category:
string=process.env.GALA_TOKEN_CLASS_CATEGORYcollection
collection:
string=process.env.GALA_TOKEN_CLASS_COLLECTIONcreated
created:
number=txUnixTimeexpires
expires:
number=0grantedBy
grantedBy:
UserAlias=users.testUser1.identityKeygrantedTo
grantedTo:
UserAlias=users.testUser2.identityKeyinstance
instance:
BigNumberquantity
quantity:
BigNumberquantitySpent
quantitySpent:
BigNumbertype
type:
string=process.env.GALA_TOKEN_CLASS_TYPEuses
uses:
BigNumberusesSpent
usesSpent:
BigNumber