Function: normalizeTokenKey()
Gala Launchpad SDK 9.0.0-rc.5 / index / normalizeTokenKey
Function: normalizeTokenKey()
normalizeTokenKey(
key):string
Defined in: packages/launchpad-sdk/dist/utils/tokenNameNormalizer.d.ts:67
Normalizes a token identifier for consistent cache keys.
Used by the cache services (AbstractCacheService) for case-insensitive lookups of token symbols and tokenIds.
Current normalizations:
.trim()- Remove leading/trailing whitespace.toUpperCase()- Convert to uppercase
Note: This uppercases the ENTIRE string including pipe-delimited tokenIds. This is intentional for cache lookup consistency - both the cache key and the lookup key are normalized identically. The original casing is preserved in the cached values themselves, not the keys.
Parameters
key
string
The token identifier (symbol or tokenId) to normalize
Returns
string
Normalized key (trimmed and uppercased)
Example
import { normalizeTokenKey } from '../utils/tokenNameNormalizer';
const normalized = normalizeTokenKey(' gala ');
console.log(normalized); // 'GALA'
// Full tokenId also uppercased (intentional for cache key consistency)
const tokenId = normalizeTokenKey('GUSDC|Unit|none|eth:0x...');
console.log(tokenId); // 'GUSDC|UNIT|NONE|ETH:0X...'
Since
6.4.0