Skip to main content

Function: parseTokenClassKey()

gSwap SDK 2.0.0-rc.4


gSwap SDK 2.0.0-rc.4 / parseTokenClassKey

Function: parseTokenClassKey()

parseTokenClassKey(tokenClassKey): GalaChainTokenClassKey

Defined in: packages/gswap-sdk/dist/index.d.ts:2130

Parse a pipe- or dollar-separated token class key.

The LAST three segments are always category, type and additionalKey; everything before them is the collection. Parsing from the right is required because real collections contain the $ delimiter themselves (for example $GMUSIC), so a plain left-to-right split('$') shifts every field. Nothing here says anything about the token's symbol: a class key carries no symbol, which must come from the token class or trading-symbol registry.

Parameters​

tokenClassKey​

TokenRef

Returns​

GalaChainTokenClassKey

Example​

parseTokenClassKey('$GMUSIC$Unit$none$none').collection; // '$GMUSIC'