Skip to content

@gala-chain/testAPI


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_KEY

allowanceType

allowanceType: number = 4

category

category: string = process.env.GALA_TOKEN_CLASS_CATEGORY

collection

collection: string = process.env.GALA_TOKEN_CLASS_COLLECTION

created

created: number = txUnixTime

expires

expires: number = 0

grantedBy

grantedBy: UserAlias = users.admin.identityKey

grantedTo

grantedTo: UserAlias = users.admin.identityKey

instance

instance: BigNumber

quantity

quantity: BigNumber

quantitySpent

quantitySpent: BigNumber

type

type: string = process.env.GALA_TOKEN_CLASS_TYPE

uses

uses: BigNumber

usesSpent

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_KEY

category

category: string = process.env.GALA_TOKEN_CLASS_CATEGORY

collection

collection: string = process.env.GALA_TOKEN_CLASS_COLLECTION

inUseHolds

inUseHolds: never[] = []

instanceIds

instanceIds: never[] = []

lockedHolds

lockedHolds: never[] = []

owner

owner: UserAlias = users.testUser1.identityKey

quantity

quantity: BigNumber

type

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_KEY

allowanceType

allowanceType: number = 6

category

category: string = process.env.GALA_TOKEN_CLASS_CATEGORY

collection

collection: string = process.env.GALA_TOKEN_CLASS_COLLECTION

created

created: number = txUnixTime

expires

expires: number = 0

grantedBy

grantedBy: UserAlias = users.testUser1.identityKey

grantedTo

grantedTo: UserAlias = users.testUser2.identityKey

instance

instance: BigNumber

quantity

quantity: BigNumber

quantitySpent

quantitySpent: BigNumber

type

type: string = process.env.GALA_TOKEN_CLASS_TYPE

uses

uses: BigNumber

usesSpent

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_KEY

allowanceType

allowanceType: number = 6

category

category: string = process.env.GALA_TOKEN_CLASS_CATEGORY

collection

collection: string = process.env.GALA_TOKEN_CLASS_COLLECTION

created

created: number = txUnixTime

expires

expires: number = 0

grantedBy

grantedBy: UserAlias = users.testUser3.identityKey

grantedTo

grantedTo: UserAlias = users.testUser2.identityKey

instance

instance: BigNumber

quantity

quantity: BigNumber

quantitySpent

quantitySpent: BigNumber

type

type: string = process.env.GALA_TOKEN_CLASS_TYPE

uses

uses: BigNumber

usesSpent

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_KEY

burnedBy

burnedBy: UserAlias = users.testUser1.identityKey

category

category: string = process.env.GALA_TOKEN_CLASS_CATEGORY

collection

collection: string = process.env.GALA_TOKEN_CLASS_COLLECTION

created

created: number = txUnixTime

epoch

epoch: string

instance

instance: BigNumber

quantity

quantity: BigNumber

timeKey

timeKey: string

totalKnownBurnsCount

totalKnownBurnsCount: BigNumber

type

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_KEY

burnedBy

burnedBy: UserAlias = users.testUser1.identityKey

category

category: string = process.env.GALA_TOKEN_CLASS_CATEGORY

collection

collection: string = process.env.GALA_TOKEN_CLASS_COLLECTION

created

created: number = txUnixTime

instance

instance: BigNumber

quantity

quantity: BigNumber

type

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_KEY

category

category: string = process.env.GALA_TOKEN_CLASS_CATEGORY

collection

collection: string = process.env.GALA_TOKEN_CLASS_COLLECTION

type

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_KEY

authorities

authorities: UserAlias[]

category

category: string = process.env.GALA_TOKEN_CLASS_CATEGORY

collection

collection: string = process.env.GALA_TOKEN_CLASS_COLLECTION

decimals

decimals: number = 10

description

description: string = "Generated via automated test suite."

image

image: string = "https://app.gala.games/test-image-placeholder-url.png"

isNonFungible

isNonFungible: boolean = false

maxCapacity

maxCapacity: BigNumber

maxSupply

maxSupply: BigNumber

name

name: string = "AUTOMATEDTESTCOIN"

network

network: string = GC_NETWORK_ID

symbol

symbol: string = "AUTC"

totalBurned

totalBurned: BigNumber

totalMintAllowance

totalMintAllowance: BigNumber

totalSupply

totalSupply: BigNumber

type

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_KEY

category

category: string = process.env.GALA_TOKEN_CLASS_CATEGORY

collection

collection: string = process.env.GALA_TOKEN_CLASS_COLLECTION

instance

instance: BigNumber

type

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_KEY

category

category: string = process.env.GALA_TOKEN_CLASS_CATEGORY

collection

collection: string = process.env.GALA_TOKEN_CLASS_COLLECTION

instance

instance: BigNumber

isNonFungible

isNonFungible: boolean = false

type

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_KEY

allowanceType

allowanceType: number = 4

category

category: string = process.env.GALA_TOKEN_CLASS_CATEGORY

collection

collection: string = process.env.GALA_TOKEN_CLASS_COLLECTION

created

created: number = txUnixTime

expires

expires: number = 0

grantedBy

grantedBy: UserAlias = users.testUser1.identityKey

grantedTo

grantedTo: UserAlias = users.testUser2.identityKey

instance

instance: BigNumber

quantity

quantity: BigNumber

quantitySpent

quantitySpent: BigNumber

type

type: string = process.env.GALA_TOKEN_CLASS_TYPE

uses

uses: BigNumber

usesSpent

usesSpent: BigNumber

Source

chain-test/src/data/currency.ts:251