@@ -18,6 +18,7 @@ import * as GRPCKernel from '../grpc-api/v2/concordium/kernel.js';
1818import { RawModuleSchema } from '../schemaTypes.js' ;
1919import { serializeAccountTransactionPayload } from '../serialization.js' ;
2020import * as SDK from '../types.js' ;
21+ import * as PLT from '../plt/types.js' ;
2122import { HexString , isRpcError } from '../types.js' ;
2223import * as AccountAddress from '../types/AccountAddress.js' ;
2324import * as BlockHash from '../types/BlockHash.js' ;
@@ -1508,6 +1509,40 @@ export class ConcordiumGRPCClient {
15081509 return { isHealthy : false , message : ( e as RpcError ) . message } ;
15091510 }
15101511 }
1512+
1513+ // TODO: add example snippet
1514+ /**
1515+ * Get information about a protocol level token (PLT) at a certain block.
1516+ * This endpoint is only supported for protocol version 9 and onwards.
1517+ *
1518+ * @param tokenId the ID of the token to query information about
1519+ * @param blockHash an optional block hash to get the info from, otherwise retrieves from last finalized block.
1520+ * @returns {PLT.TokenInfo } information about the corresponding token.
1521+ */
1522+ async getTokenInfo ( tokenId : PLT . TokenId . Type , blockHash ?: BlockHash . Type ) : Promise < PLT . TokenInfo > {
1523+ const blockHashInput = getBlockHashInput ( blockHash ) ;
1524+ const req : GRPC . TokenInfoRequest = {
1525+ tokenId : PLT . TokenId . toProto ( tokenId ) ,
1526+ blockHash : blockHashInput ,
1527+ }
1528+ const res = await this . client . getTokenInfo ( req ) ;
1529+ return translate . trTokenInfo ( res . response ) ;
1530+ }
1531+
1532+ // TODO: add example snippet
1533+ /**
1534+ * Get all token IDs currently registered at a block.
1535+ * This endpoint is only supported for protocol version 9 and onwards.
1536+ *
1537+ * @param blockHash optional block hash, otherwise retrieves from last finalized block.
1538+ *
1539+ * @returns All token IDs registered at a block
1540+ */
1541+ getTokenList ( blockHash ?: BlockHash . Type ) : AsyncIterable < PLT . TokenId . Type > {
1542+ const blockHashInput = getBlockHashInput ( blockHash ) ;
1543+ const tokenIds = this . client . getTokenList ( blockHashInput ) . responses ;
1544+ return mapStream ( tokenIds , PLT . TokenId . fromProto ) ;
1545+ }
15111546}
15121547
15131548/**
0 commit comments