Skip to main content

Function: parseTokenString()

GalaChain core SDK 1.0.0-rc.8


GalaChain core SDK 1.0.0-rc.8 / bridge / parseTokenString

Function: parseTokenString()

parseTokenString(tokenString): GalaChainTokenClassKey

Defined in: packages/gala-core-sdk/dist/bridge.d.ts:2641

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​

tokenString​

string

Pipe-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' }