@@ -12,13 +12,13 @@ import { getAccountTransactionHandler } from '../accountTransactions.js';
1212import { DEFAULT_INVOKE_ENERGY } from '../constants.js' ;
1313import { calculateEnergyCost } from '../energyCost.js' ;
1414import { HealthClient } from '../grpc-api/v2/concordium/health.client.js' ;
15+ import * as GRPCKernel from '../grpc-api/v2/concordium/kernel.js' ;
1516import { QueriesClient } from '../grpc-api/v2/concordium/service.client.js' ;
1617import * as GRPC from '../grpc-api/v2/concordium/types.js' ;
17- import * as GRPCKernel from '../grpc-api/v2/concordium/kernel .js' ;
18+ import * as PLT from '../plt/types .js' ;
1819import { RawModuleSchema } from '../schemaTypes.js' ;
1920import { serializeAccountTransactionPayload } from '../serialization.js' ;
2021import * as SDK from '../types.js' ;
21- import * as PLT from '../plt/types.js' ;
2222import { HexString , isRpcError } from '../types.js' ;
2323import * as AccountAddress from '../types/AccountAddress.js' ;
2424import * as BlockHash from '../types/BlockHash.js' ;
@@ -226,7 +226,10 @@ export class ConcordiumGRPCClient {
226226 * @returns An object with information about the contract instance.
227227 * @throws An error of type `RpcError` if not found in the block.
228228 */
229- async getInstanceInfo ( contractAddress : ContractAddress . Type , blockHash ?: BlockHash . Type ) : Promise < SDK . InstanceInfo > {
229+ async getInstanceInfo (
230+ contractAddress : ContractAddress . Type ,
231+ blockHash ?: BlockHash . Type
232+ ) : Promise < SDK . InstanceInfo > {
230233 const instanceInfoRequest : GRPC . InstanceInfoRequest = {
231234 blockHash : getBlockHashInput ( blockHash ) ,
232235 address : ContractAddress . toProto ( contractAddress ) ,
@@ -1510,11 +1513,12 @@ export class ConcordiumGRPCClient {
15101513 }
15111514 }
15121515
1513- // TODO: add example snippet
15141516 /**
15151517 * Get information about a protocol level token (PLT) at a certain block.
15161518 * This endpoint is only supported for protocol version 9 and onwards.
15171519 *
1520+ * {@codeblock ~~:nodejs/client/getTokenInfo.ts#documentation-snippet}
1521+ *
15181522 * @param tokenId the ID of the token to query information about
15191523 * @param blockHash an optional block hash to get the info from, otherwise retrieves from last finalized block.
15201524 * @returns {PLT.TokenInfo } information about the corresponding token.
@@ -1524,23 +1528,25 @@ export class ConcordiumGRPCClient {
15241528 const req : GRPC . TokenInfoRequest = {
15251529 tokenId : PLT . TokenId . toProto ( tokenId ) ,
15261530 blockHash : blockHashInput ,
1527- }
1531+ } ;
15281532 const res = await this . client . getTokenInfo ( req ) ;
15291533 return translate . trTokenInfo ( res . response ) ;
15301534 }
15311535
1532- // TODO: add example snippet
15331536 /**
15341537 * Get all token IDs currently registered at a block.
15351538 * This endpoint is only supported for protocol version 9 and onwards.
15361539 *
1540+ * {@codeblock ~~:nodejs/client/getTokenList.ts#documentation-snippet}
1541+ *
15371542 * @param blockHash optional block hash, otherwise retrieves from last finalized block.
1543+ * @param abortSignal an optional AbortSignal to close the stream.
15381544 *
15391545 * @returns All token IDs registered at a block
15401546 */
1541- getTokenList ( blockHash ?: BlockHash . Type ) : AsyncIterable < PLT . TokenId . Type > {
1547+ getTokenList ( blockHash ?: BlockHash . Type , abortSignal ?: AbortSignal ) : AsyncIterable < PLT . TokenId . Type > {
15421548 const blockHashInput = getBlockHashInput ( blockHash ) ;
1543- const tokenIds = this . client . getTokenList ( blockHashInput ) . responses ;
1549+ const tokenIds = this . client . getTokenList ( blockHashInput , { abort : abortSignal } ) . responses ;
15441550 return mapStream ( tokenIds , PLT . TokenId . fromProto ) ;
15451551 }
15461552}
0 commit comments