Skip to main content

bridge/functions/parseTokenString.md

parseTokenString(tokenString): GalaChainTokenClassKey

Parse a pipe-delimited token string to TokenClassKey. The last three segments are the category, type and additional key; everything before them is the collection (core's splitClassKey).

Parameters​

ParameterTypeDescription
tokenStringstringPipe-delimited string (e.g., "GALA|Unit|none|none")

Returns​

GalaChainTokenClassKey

TokenClassKey object

Throws​

GalaSDKError INVALID_TOKEN_REFERENCE (tokenId, bad_class_key) for anything else

Example​

const key = parseTokenString('GALA|Unit|none|none');
// { collection: 'GALA', category: 'Unit', type: 'none', additionalKey: 'none' }