PERS SDK - v2.3.26 / Exports / TokenSDK
Token SDK - Class-based Promise SDK for Token Operations
Modern, performant SDK with direct method access and excellent TypeScript support. Optimized for bundle size, performance, and developer experience.
Usage: const tokenSDK = new TokenSDK(apiClient); const tokens = await tokenSDK.getTokens(); const creditToken = await tokenSDK.getActiveCreditToken();
- getTokens
- getTokenTypes
- getActiveCreditToken
- getRewardTokens
- getStatusTokens
- getTokenByContract
- createTokenMetadata
- updateTokenMetadata
- toggleTokenActive
- createToken
- updateToken
- setMainnetContract
- toggleTokenMetadataStatus
- createTokenType
- getTokenService
- getTokenApi
• new TokenSDK(apiClient): TokenSDK
| Name | Type |
|---|---|
apiClient | PersApiClient |
▸ getTokens(): Promise<PaginatedResponseDTO<TokenDTO>>
Get all tokens
Promise<PaginatedResponseDTO<TokenDTO>>
Promise with all available tokens
▸ getTokenTypes(): Promise<PaginatedResponseDTO<TokenTypeDTO>>
Get all token types
Promise<PaginatedResponseDTO<TokenTypeDTO>>
Promise with all available token types
▸ getActiveCreditToken(): Promise<TokenDTO>
Get the active credit token
Promise<TokenDTO>
Promise with the current active credit token
▸ getRewardTokens(): Promise<PaginatedResponseDTO<TokenDTO>>
Get all reward tokens
Promise<PaginatedResponseDTO<TokenDTO>>
Promise with all reward tokens
▸ getStatusTokens(): Promise<PaginatedResponseDTO<TokenDTO>>
Get all status tokens
Promise<PaginatedResponseDTO<TokenDTO>>
Promise with all status tokens
▸ getTokenByContract(contractAddress, contractTokenId?): Promise<TokenDTO>
Get token by contract address
| Name | Type | Default value | Description |
|---|---|---|---|
contractAddress | string | undefined | The contract address to search for |
contractTokenId | null | string | null | Optional contract token ID |
Promise<TokenDTO>
Promise with the matching token
▸ createTokenMetadata(tokenId, tokenData): Promise<TokenDTO>
Create token metadata
| Name | Type | Description |
|---|---|---|
tokenId | string | The token ID |
tokenData | TokenMetadataCreateRequestDTO | The token metadata request data |
Promise<TokenDTO>
Promise with the updated token
▸ updateTokenMetadata(metadataId, tokenData): Promise<TokenMetadataDTO>
Update token metadata (ERC721 only) Note: Existing minted NFTs retain their original metadata - this only affects future mints
| Name | Type | Description |
|---|---|---|
metadataId | string | The metadata ID to update |
tokenData | TokenMetadataCreateRequestDTO | The token metadata request data |
Promise<TokenMetadataDTO>
Promise with the updated metadata
▸ toggleTokenActive(tokenId): Promise<TokenDTO>
Toggle token active status
| Name | Type | Description |
|---|---|---|
tokenId | string | The token ID to toggle |
Promise<TokenDTO>
Promise with the updated token
▸ createToken(tokenData): Promise<TokenDTO>
Create a new token
| Name | Type | Description |
|---|---|---|
tokenData | TokenCreateRequestDTO | The token creation data |
Promise<TokenDTO>
Promise with the created token
▸ updateToken(tokenId, tokenData): Promise<TokenDTO>
Update an existing token
| Name | Type | Description |
|---|---|---|
tokenId | string | The token ID to update |
tokenData | TokenUpdateRequestDTO | The token update data |
Promise<TokenDTO>
Promise with the updated token
▸ setMainnetContract(tokenId, contractAddress, chainId): Promise<TokenDTO>
Set mainnet contract address for a token
| Name | Type | Description |
|---|---|---|
tokenId | string | The token ID |
contractAddress | string | The contract address |
chainId | number | The blockchain chain ID |
Promise<TokenDTO>
Promise with the updated token
▸ toggleTokenMetadataStatus(metadataId): Promise<TokenMetadataDTO>
Toggle token metadata status
| Name | Type | Description |
|---|---|---|
metadataId | string | The metadata ID to toggle |
Promise<TokenMetadataDTO>
Promise with the updated metadata
▸ createTokenType(tokenType): Promise<TokenTypeDTO>
Create a new token type
| Name | Type | Description |
|---|---|---|
tokenType | TokenTypeDTO | The token type data |
Promise<TokenTypeDTO>
Promise with the created token type
▸ getTokenService(): TokenService
Get direct access to the token service for advanced operations
The underlying TokenService instance
▸ getTokenApi(): TokenApi
Get direct access to the token API for low-level operations
The underlying TokenApi instance