hiero-sdk-utils 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/dist/cjs/client/HieroClient.d.ts +70 -0
  2. package/dist/cjs/client/HieroClient.d.ts.map +1 -0
  3. package/dist/cjs/client/HieroClient.js +165 -0
  4. package/dist/cjs/client/HieroClient.js.map +1 -0
  5. package/dist/cjs/client/rateLimiter.d.ts +33 -0
  6. package/dist/cjs/client/rateLimiter.d.ts.map +1 -0
  7. package/dist/cjs/client/rateLimiter.js +68 -0
  8. package/dist/cjs/client/rateLimiter.js.map +1 -0
  9. package/dist/cjs/client/types.d.ts +26 -0
  10. package/dist/cjs/client/types.d.ts.map +1 -0
  11. package/dist/cjs/client/types.js +11 -0
  12. package/dist/cjs/client/types.js.map +1 -0
  13. package/dist/cjs/errors/index.d.ts +95 -0
  14. package/dist/cjs/errors/index.d.ts.map +1 -0
  15. package/dist/cjs/errors/index.js +115 -0
  16. package/dist/cjs/errors/index.js.map +1 -0
  17. package/dist/cjs/index.d.ts +36 -0
  18. package/dist/cjs/index.d.ts.map +1 -0
  19. package/dist/cjs/index.js +55 -0
  20. package/dist/cjs/index.js.map +1 -0
  21. package/dist/cjs/pagination/paginator.d.ts +21 -0
  22. package/dist/cjs/pagination/paginator.d.ts.map +1 -0
  23. package/dist/cjs/pagination/paginator.js +89 -0
  24. package/dist/cjs/pagination/paginator.js.map +1 -0
  25. package/dist/cjs/resources/accounts.d.ts +43 -0
  26. package/dist/cjs/resources/accounts.d.ts.map +1 -0
  27. package/dist/cjs/resources/accounts.js +60 -0
  28. package/dist/cjs/resources/accounts.js.map +1 -0
  29. package/dist/cjs/resources/balances.d.ts +25 -0
  30. package/dist/cjs/resources/balances.d.ts.map +1 -0
  31. package/dist/cjs/resources/balances.js +33 -0
  32. package/dist/cjs/resources/balances.js.map +1 -0
  33. package/dist/cjs/resources/blocks.d.ts +36 -0
  34. package/dist/cjs/resources/blocks.d.ts.map +1 -0
  35. package/dist/cjs/resources/blocks.js +58 -0
  36. package/dist/cjs/resources/blocks.js.map +1 -0
  37. package/dist/cjs/resources/contracts.d.ts +36 -0
  38. package/dist/cjs/resources/contracts.d.ts.map +1 -0
  39. package/dist/cjs/resources/contracts.js +53 -0
  40. package/dist/cjs/resources/contracts.js.map +1 -0
  41. package/dist/cjs/resources/nfts.d.ts +39 -0
  42. package/dist/cjs/resources/nfts.d.ts.map +1 -0
  43. package/dist/cjs/resources/nfts.js +62 -0
  44. package/dist/cjs/resources/nfts.js.map +1 -0
  45. package/dist/cjs/resources/schedules.d.ts +36 -0
  46. package/dist/cjs/resources/schedules.d.ts.map +1 -0
  47. package/dist/cjs/resources/schedules.js +53 -0
  48. package/dist/cjs/resources/schedules.js.map +1 -0
  49. package/dist/cjs/resources/tokens.d.ts +36 -0
  50. package/dist/cjs/resources/tokens.d.ts.map +1 -0
  51. package/dist/cjs/resources/tokens.js +53 -0
  52. package/dist/cjs/resources/tokens.js.map +1 -0
  53. package/dist/cjs/resources/topics.d.ts +38 -0
  54. package/dist/cjs/resources/topics.d.ts.map +1 -0
  55. package/dist/cjs/resources/topics.js +56 -0
  56. package/dist/cjs/resources/topics.js.map +1 -0
  57. package/dist/cjs/resources/transactions.d.ts +35 -0
  58. package/dist/cjs/resources/transactions.d.ts.map +1 -0
  59. package/dist/cjs/resources/transactions.js +57 -0
  60. package/dist/cjs/resources/transactions.js.map +1 -0
  61. package/dist/cjs/types/api.d.ts +302 -0
  62. package/dist/cjs/types/api.d.ts.map +1 -0
  63. package/dist/cjs/types/api.js +4 -0
  64. package/dist/cjs/types/api.js.map +1 -0
  65. package/dist/cjs/types/common.d.ts +52 -0
  66. package/dist/cjs/types/common.d.ts.map +1 -0
  67. package/dist/cjs/types/common.js +16 -0
  68. package/dist/cjs/types/common.js.map +1 -0
  69. package/dist/esm/client/HieroClient.d.ts +70 -0
  70. package/dist/esm/client/HieroClient.d.ts.map +1 -0
  71. package/dist/esm/client/HieroClient.js +161 -0
  72. package/dist/esm/client/HieroClient.js.map +1 -0
  73. package/dist/esm/client/rateLimiter.d.ts +33 -0
  74. package/dist/esm/client/rateLimiter.d.ts.map +1 -0
  75. package/dist/esm/client/rateLimiter.js +64 -0
  76. package/dist/esm/client/rateLimiter.js.map +1 -0
  77. package/dist/esm/client/types.d.ts +26 -0
  78. package/dist/esm/client/types.d.ts.map +1 -0
  79. package/dist/esm/client/types.js +8 -0
  80. package/dist/esm/client/types.js.map +1 -0
  81. package/dist/esm/errors/index.d.ts +95 -0
  82. package/dist/esm/errors/index.d.ts.map +1 -0
  83. package/dist/esm/errors/index.js +108 -0
  84. package/dist/esm/errors/index.js.map +1 -0
  85. package/dist/esm/index.d.ts +36 -0
  86. package/dist/esm/index.d.ts.map +1 -0
  87. package/dist/esm/index.js +37 -0
  88. package/dist/esm/index.js.map +1 -0
  89. package/dist/esm/pagination/paginator.d.ts +21 -0
  90. package/dist/esm/pagination/paginator.d.ts.map +1 -0
  91. package/dist/esm/pagination/paginator.js +86 -0
  92. package/dist/esm/pagination/paginator.js.map +1 -0
  93. package/dist/esm/resources/accounts.d.ts +43 -0
  94. package/dist/esm/resources/accounts.d.ts.map +1 -0
  95. package/dist/esm/resources/accounts.js +56 -0
  96. package/dist/esm/resources/accounts.js.map +1 -0
  97. package/dist/esm/resources/balances.d.ts +25 -0
  98. package/dist/esm/resources/balances.d.ts.map +1 -0
  99. package/dist/esm/resources/balances.js +29 -0
  100. package/dist/esm/resources/balances.js.map +1 -0
  101. package/dist/esm/resources/blocks.d.ts +36 -0
  102. package/dist/esm/resources/blocks.d.ts.map +1 -0
  103. package/dist/esm/resources/blocks.js +54 -0
  104. package/dist/esm/resources/blocks.js.map +1 -0
  105. package/dist/esm/resources/contracts.d.ts +36 -0
  106. package/dist/esm/resources/contracts.d.ts.map +1 -0
  107. package/dist/esm/resources/contracts.js +49 -0
  108. package/dist/esm/resources/contracts.js.map +1 -0
  109. package/dist/esm/resources/nfts.d.ts +39 -0
  110. package/dist/esm/resources/nfts.d.ts.map +1 -0
  111. package/dist/esm/resources/nfts.js +58 -0
  112. package/dist/esm/resources/nfts.js.map +1 -0
  113. package/dist/esm/resources/schedules.d.ts +36 -0
  114. package/dist/esm/resources/schedules.d.ts.map +1 -0
  115. package/dist/esm/resources/schedules.js +49 -0
  116. package/dist/esm/resources/schedules.js.map +1 -0
  117. package/dist/esm/resources/tokens.d.ts +36 -0
  118. package/dist/esm/resources/tokens.d.ts.map +1 -0
  119. package/dist/esm/resources/tokens.js +49 -0
  120. package/dist/esm/resources/tokens.js.map +1 -0
  121. package/dist/esm/resources/topics.d.ts +38 -0
  122. package/dist/esm/resources/topics.d.ts.map +1 -0
  123. package/dist/esm/resources/topics.js +52 -0
  124. package/dist/esm/resources/topics.js.map +1 -0
  125. package/dist/esm/resources/transactions.d.ts +35 -0
  126. package/dist/esm/resources/transactions.d.ts.map +1 -0
  127. package/dist/esm/resources/transactions.js +53 -0
  128. package/dist/esm/resources/transactions.js.map +1 -0
  129. package/dist/esm/types/api.d.ts +302 -0
  130. package/dist/esm/types/api.d.ts.map +1 -0
  131. package/dist/esm/types/api.js +3 -0
  132. package/dist/esm/types/api.js.map +1 -0
  133. package/dist/esm/types/common.d.ts +52 -0
  134. package/dist/esm/types/common.d.ts.map +1 -0
  135. package/dist/esm/types/common.js +13 -0
  136. package/dist/esm/types/common.js.map +1 -0
  137. package/package.json +52 -0
@@ -0,0 +1,56 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ import { paginate } from '../pagination/paginator.js';
3
+ import { ValidationError } from '../errors/index.js';
4
+ import { ENTITY_ID_PATTERN } from '../types/common.js';
5
+ /**
6
+ * Provides access to Mirror Node account endpoints.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const account = await client.accounts.getById('0.0.1234');
11
+ * for await (const a of client.accounts.list({ limit: 10 })) {
12
+ * console.log(a.account);
13
+ * }
14
+ * ```
15
+ */
16
+ export class AccountsResource {
17
+ client;
18
+ constructor(client) {
19
+ this.client = client;
20
+ }
21
+ /**
22
+ * Retrieves a single account by ID.
23
+ *
24
+ * @param accountId - Account in `0.0.X` format
25
+ * @returns The account info including balance, key, and staking data
26
+ * @throws {ValidationError} If accountId format is invalid
27
+ * @throws {MirrorNodeError} If the API request fails
28
+ */
29
+ async getById(accountId) {
30
+ this.validateAccountId(accountId);
31
+ return this.client.get(`/api/v1/accounts/${accountId}`);
32
+ }
33
+ /**
34
+ * Lists accounts with optional filters. Returns an async iterable
35
+ * that automatically handles pagination.
36
+ *
37
+ * @param params - Optional query parameters for filtering
38
+ * @returns Async iterable of account info objects
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * for await (const account of client.accounts.list({ limit: 5, order: 'desc' })) {
43
+ * console.log(account.account, account.balance.balance);
44
+ * }
45
+ * ```
46
+ */
47
+ list(params) {
48
+ return paginate(this.client, '/api/v1/accounts', 'accounts', params);
49
+ }
50
+ validateAccountId(id) {
51
+ if (!ENTITY_ID_PATTERN.test(id)) {
52
+ throw new ValidationError(`Invalid account ID format: "${id}". Expected "shard.realm.num" format (e.g., "0.0.1234").`, 'INVALID_ACCOUNT_ID');
53
+ }
54
+ }
55
+ }
56
+ //# sourceMappingURL=accounts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts.js","sourceRoot":"","sources":["../../../src/resources/accounts.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAItC,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,MAAM,OAAO,gBAAgB;IACE;IAA7B,YAA6B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IAEpD;;;;;;;OAOG;IACH,KAAK,CAAC,OAAO,CAAC,SAAiB;QAC7B,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;QAClC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAc,oBAAoB,SAAS,EAAE,CAAC,CAAC;IACvE,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,IAAI,CAAC,MAA4B;QAC/B,OAAO,QAAQ,CACb,IAAI,CAAC,MAAM,EACX,kBAAkB,EAClB,UAAU,EACV,MAA+D,CAChE,CAAC;IACJ,CAAC;IAEO,iBAAiB,CAAC,EAAU;QAClC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,eAAe,CACvB,+BAA+B,EAAE,0DAA0D,EAC3F,oBAAoB,CACrB,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,25 @@
1
+ import type { HieroClient } from '../client/HieroClient.js';
2
+ import type { BalanceEntry, BalancesQueryParams } from '../types/api.js';
3
+ /**
4
+ * Provides access to Mirror Node balance endpoints.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * for await (const entry of client.balances.list({ limit: 10 })) {
9
+ * console.log(entry.account, entry.balance);
10
+ * }
11
+ * ```
12
+ */
13
+ export declare class BalancesResource {
14
+ private readonly client;
15
+ constructor(client: HieroClient);
16
+ /**
17
+ * Lists account balances with optional filters. Returns an async iterable
18
+ * that automatically handles pagination.
19
+ *
20
+ * @param params - Optional query parameters for filtering
21
+ * @returns Async iterable of balance entry objects
22
+ */
23
+ list(params?: BalancesQueryParams): AsyncIterable<BalanceEntry>;
24
+ }
25
+ //# sourceMappingURL=balances.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"balances.d.ts","sourceRoot":"","sources":["../../../src/resources/balances.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGzE;;;;;;;;;GASG;AACH,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,WAAW;IAEhD;;;;;;OAMG;IACH,IAAI,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,aAAa,CAAC,YAAY,CAAC;CAQhE"}
@@ -0,0 +1,29 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ import { paginate } from '../pagination/paginator.js';
3
+ /**
4
+ * Provides access to Mirror Node balance endpoints.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * for await (const entry of client.balances.list({ limit: 10 })) {
9
+ * console.log(entry.account, entry.balance);
10
+ * }
11
+ * ```
12
+ */
13
+ export class BalancesResource {
14
+ client;
15
+ constructor(client) {
16
+ this.client = client;
17
+ }
18
+ /**
19
+ * Lists account balances with optional filters. Returns an async iterable
20
+ * that automatically handles pagination.
21
+ *
22
+ * @param params - Optional query parameters for filtering
23
+ * @returns Async iterable of balance entry objects
24
+ */
25
+ list(params) {
26
+ return paginate(this.client, '/api/v1/balances', 'balances', params);
27
+ }
28
+ }
29
+ //# sourceMappingURL=balances.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"balances.js","sourceRoot":"","sources":["../../../src/resources/balances.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAItC,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD;;;;;;;;;GASG;AACH,MAAM,OAAO,gBAAgB;IACE;IAA7B,YAA6B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IAEpD;;;;;;OAMG;IACH,IAAI,CAAC,MAA4B;QAC/B,OAAO,QAAQ,CACb,IAAI,CAAC,MAAM,EACX,kBAAkB,EAClB,UAAU,EACV,MAA+D,CAChE,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,36 @@
1
+ import type { HieroClient } from '../client/HieroClient.js';
2
+ import type { BlockInfo, BlocksQueryParams } from '../types/api.js';
3
+ /**
4
+ * Provides access to Mirror Node block endpoints.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * const block = await client.blocks.getByHashOrNumber(12345);
9
+ * for await (const b of client.blocks.list()) {
10
+ * console.log(b.number, b.hash);
11
+ * }
12
+ * ```
13
+ */
14
+ export declare class BlocksResource {
15
+ private readonly client;
16
+ constructor(client: HieroClient);
17
+ /**
18
+ * Retrieves a single block by hash or number.
19
+ *
20
+ * @param hashOrNumber - Block hash (hex string) or block number
21
+ * @returns The block info including hash, timestamp, and gas used
22
+ * @throws {ValidationError} If the input is neither a valid hash nor a number
23
+ * @throws {MirrorNodeError} If the API request fails
24
+ */
25
+ getByHashOrNumber(hashOrNumber: string | number): Promise<BlockInfo>;
26
+ /**
27
+ * Lists blocks with optional filters. Returns an async iterable
28
+ * that automatically handles pagination.
29
+ *
30
+ * @param params - Optional query parameters for filtering
31
+ * @returns Async iterable of block info objects
32
+ */
33
+ list(params?: BlocksQueryParams): AsyncIterable<BlockInfo>;
34
+ private validateHashOrNumber;
35
+ }
36
+ //# sourceMappingURL=blocks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../../src/resources/blocks.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAIpE;;;;;;;;;;GAUG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,WAAW;IAEhD;;;;;;;OAOG;IACG,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAK1E;;;;;;OAMG;IACH,IAAI,CAAC,MAAM,CAAC,EAAE,iBAAiB,GAAG,aAAa,CAAC,SAAS,CAAC;IAS1D,OAAO,CAAC,oBAAoB;CAiB7B"}
@@ -0,0 +1,54 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ import { paginate } from '../pagination/paginator.js';
3
+ import { ValidationError } from '../errors/index.js';
4
+ /**
5
+ * Provides access to Mirror Node block endpoints.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * const block = await client.blocks.getByHashOrNumber(12345);
10
+ * for await (const b of client.blocks.list()) {
11
+ * console.log(b.number, b.hash);
12
+ * }
13
+ * ```
14
+ */
15
+ export class BlocksResource {
16
+ client;
17
+ constructor(client) {
18
+ this.client = client;
19
+ }
20
+ /**
21
+ * Retrieves a single block by hash or number.
22
+ *
23
+ * @param hashOrNumber - Block hash (hex string) or block number
24
+ * @returns The block info including hash, timestamp, and gas used
25
+ * @throws {ValidationError} If the input is neither a valid hash nor a number
26
+ * @throws {MirrorNodeError} If the API request fails
27
+ */
28
+ async getByHashOrNumber(hashOrNumber) {
29
+ this.validateHashOrNumber(hashOrNumber);
30
+ return this.client.get(`/api/v1/blocks/${hashOrNumber}`);
31
+ }
32
+ /**
33
+ * Lists blocks with optional filters. Returns an async iterable
34
+ * that automatically handles pagination.
35
+ *
36
+ * @param params - Optional query parameters for filtering
37
+ * @returns Async iterable of block info objects
38
+ */
39
+ list(params) {
40
+ return paginate(this.client, '/api/v1/blocks', 'blocks', params);
41
+ }
42
+ validateHashOrNumber(value) {
43
+ if (typeof value === 'number') {
44
+ if (!Number.isInteger(value) || value < 0) {
45
+ throw new ValidationError(`Invalid block number: ${value}. Must be a non-negative integer.`, 'INVALID_BLOCK_NUMBER');
46
+ }
47
+ return;
48
+ }
49
+ if (typeof value === 'string' && value.length === 0) {
50
+ throw new ValidationError('Block hash or number must not be empty.', 'INVALID_BLOCK_IDENTIFIER');
51
+ }
52
+ }
53
+ }
54
+ //# sourceMappingURL=blocks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blocks.js","sourceRoot":"","sources":["../../../src/resources/blocks.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAItC,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;;;;GAUG;AACH,MAAM,OAAO,cAAc;IACI;IAA7B,YAA6B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IAEpD;;;;;;;OAOG;IACH,KAAK,CAAC,iBAAiB,CAAC,YAA6B;QACnD,IAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAY,kBAAkB,YAAY,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;OAMG;IACH,IAAI,CAAC,MAA0B;QAC7B,OAAO,QAAQ,CACb,IAAI,CAAC,MAAM,EACX,gBAAgB,EAChB,QAAQ,EACR,MAA+D,CAChE,CAAC;IACJ,CAAC;IAEO,oBAAoB,CAAC,KAAsB;QACjD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;gBAC1C,MAAM,IAAI,eAAe,CACvB,yBAAyB,KAAK,mCAAmC,EACjE,sBAAsB,CACvB,CAAC;YACJ,CAAC;YACD,OAAO;QACT,CAAC;QACD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACpD,MAAM,IAAI,eAAe,CACvB,yCAAyC,EACzC,0BAA0B,CAC3B,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,36 @@
1
+ import type { HieroClient } from '../client/HieroClient.js';
2
+ import type { ContractInfo, ContractsQueryParams } from '../types/api.js';
3
+ /**
4
+ * Provides access to Mirror Node contract endpoints.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * const contract = await client.contracts.getById('0.0.1234');
9
+ * for await (const c of client.contracts.list()) {
10
+ * console.log(c.contract_id);
11
+ * }
12
+ * ```
13
+ */
14
+ export declare class ContractsResource {
15
+ private readonly client;
16
+ constructor(client: HieroClient);
17
+ /**
18
+ * Retrieves a single contract by ID.
19
+ *
20
+ * @param contractId - Contract in `0.0.X` format
21
+ * @returns The contract info including EVM address and timestamps
22
+ * @throws {ValidationError} If contractId format is invalid
23
+ * @throws {MirrorNodeError} If the API request fails
24
+ */
25
+ getById(contractId: string): Promise<ContractInfo>;
26
+ /**
27
+ * Lists contracts with optional filters. Returns an async iterable
28
+ * that automatically handles pagination.
29
+ *
30
+ * @param params - Optional query parameters for filtering
31
+ * @returns Async iterable of contract info objects
32
+ */
33
+ list(params?: ContractsQueryParams): AsyncIterable<ContractInfo>;
34
+ private validateContractId;
35
+ }
36
+ //# sourceMappingURL=contracts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../../src/resources/contracts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAK1E;;;;;;;;;;GAUG;AACH,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,WAAW;IAEhD;;;;;;;OAOG;IACG,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAKxD;;;;;;OAMG;IACH,IAAI,CAAC,MAAM,CAAC,EAAE,oBAAoB,GAAG,aAAa,CAAC,YAAY,CAAC;IAShE,OAAO,CAAC,kBAAkB;CAQ3B"}
@@ -0,0 +1,49 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ import { paginate } from '../pagination/paginator.js';
3
+ import { ValidationError } from '../errors/index.js';
4
+ import { ENTITY_ID_PATTERN } from '../types/common.js';
5
+ /**
6
+ * Provides access to Mirror Node contract endpoints.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const contract = await client.contracts.getById('0.0.1234');
11
+ * for await (const c of client.contracts.list()) {
12
+ * console.log(c.contract_id);
13
+ * }
14
+ * ```
15
+ */
16
+ export class ContractsResource {
17
+ client;
18
+ constructor(client) {
19
+ this.client = client;
20
+ }
21
+ /**
22
+ * Retrieves a single contract by ID.
23
+ *
24
+ * @param contractId - Contract in `0.0.X` format
25
+ * @returns The contract info including EVM address and timestamps
26
+ * @throws {ValidationError} If contractId format is invalid
27
+ * @throws {MirrorNodeError} If the API request fails
28
+ */
29
+ async getById(contractId) {
30
+ this.validateContractId(contractId);
31
+ return this.client.get(`/api/v1/contracts/${contractId}`);
32
+ }
33
+ /**
34
+ * Lists contracts with optional filters. Returns an async iterable
35
+ * that automatically handles pagination.
36
+ *
37
+ * @param params - Optional query parameters for filtering
38
+ * @returns Async iterable of contract info objects
39
+ */
40
+ list(params) {
41
+ return paginate(this.client, '/api/v1/contracts', 'contracts', params);
42
+ }
43
+ validateContractId(id) {
44
+ if (!ENTITY_ID_PATTERN.test(id)) {
45
+ throw new ValidationError(`Invalid contract ID format: "${id}". Expected "shard.realm.num" format (e.g., "0.0.1234").`, 'INVALID_CONTRACT_ID');
46
+ }
47
+ }
48
+ }
49
+ //# sourceMappingURL=contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../../src/resources/contracts.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAItC,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,MAAM,OAAO,iBAAiB;IACC;IAA7B,YAA6B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IAEpD;;;;;;;OAOG;IACH,KAAK,CAAC,OAAO,CAAC,UAAkB;QAC9B,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAe,qBAAqB,UAAU,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED;;;;;;OAMG;IACH,IAAI,CAAC,MAA6B;QAChC,OAAO,QAAQ,CACb,IAAI,CAAC,MAAM,EACX,mBAAmB,EACnB,WAAW,EACX,MAA+D,CAChE,CAAC;IACJ,CAAC;IAEO,kBAAkB,CAAC,EAAU;QACnC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,eAAe,CACvB,gCAAgC,EAAE,0DAA0D,EAC5F,qBAAqB,CACtB,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,39 @@
1
+ import type { HieroClient } from '../client/HieroClient.js';
2
+ import type { NftInfo, NftsQueryParams } from '../types/api.js';
3
+ /**
4
+ * Provides access to Mirror Node NFT endpoints.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * for await (const nft of client.nfts.listByToken('0.0.1234')) {
9
+ * console.log(nft.serial_number, nft.account_id);
10
+ * }
11
+ * ```
12
+ */
13
+ export declare class NftsResource {
14
+ private readonly client;
15
+ constructor(client: HieroClient);
16
+ /**
17
+ * Retrieves a specific NFT by token ID and serial number.
18
+ *
19
+ * @param tokenId - Token in `0.0.X` format
20
+ * @param serialNumber - The NFT serial number
21
+ * @returns The NFT info including metadata and owner
22
+ * @throws {ValidationError} If tokenId format is invalid or serialNumber is not positive
23
+ * @throws {MirrorNodeError} If the API request fails
24
+ */
25
+ getByTokenAndSerial(tokenId: string, serialNumber: number): Promise<NftInfo>;
26
+ /**
27
+ * Lists NFTs for a token. Returns an async iterable
28
+ * that automatically handles pagination.
29
+ *
30
+ * @param tokenId - Token in `0.0.X` format
31
+ * @param params - Optional query parameters for filtering
32
+ * @returns Async iterable of NFT info objects
33
+ * @throws {ValidationError} If tokenId format is invalid
34
+ */
35
+ listByToken(tokenId: string, params?: NftsQueryParams): AsyncIterable<NftInfo>;
36
+ private validateTokenId;
37
+ private validateSerialNumber;
38
+ }
39
+ //# sourceMappingURL=nfts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nfts.d.ts","sourceRoot":"","sources":["../../../src/resources/nfts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAKhE;;;;;;;;;GASG;AACH,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,WAAW;IAEhD;;;;;;;;OAQG;IACG,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAQlF;;;;;;;;OAQG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,eAAe,GAAG,aAAa,CAAC,OAAO,CAAC;IAU9E,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,oBAAoB;CAQ7B"}
@@ -0,0 +1,58 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ import { paginate } from '../pagination/paginator.js';
3
+ import { ValidationError } from '../errors/index.js';
4
+ import { ENTITY_ID_PATTERN } from '../types/common.js';
5
+ /**
6
+ * Provides access to Mirror Node NFT endpoints.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * for await (const nft of client.nfts.listByToken('0.0.1234')) {
11
+ * console.log(nft.serial_number, nft.account_id);
12
+ * }
13
+ * ```
14
+ */
15
+ export class NftsResource {
16
+ client;
17
+ constructor(client) {
18
+ this.client = client;
19
+ }
20
+ /**
21
+ * Retrieves a specific NFT by token ID and serial number.
22
+ *
23
+ * @param tokenId - Token in `0.0.X` format
24
+ * @param serialNumber - The NFT serial number
25
+ * @returns The NFT info including metadata and owner
26
+ * @throws {ValidationError} If tokenId format is invalid or serialNumber is not positive
27
+ * @throws {MirrorNodeError} If the API request fails
28
+ */
29
+ async getByTokenAndSerial(tokenId, serialNumber) {
30
+ this.validateTokenId(tokenId);
31
+ this.validateSerialNumber(serialNumber);
32
+ return this.client.get(`/api/v1/tokens/${tokenId}/nfts/${serialNumber}`);
33
+ }
34
+ /**
35
+ * Lists NFTs for a token. Returns an async iterable
36
+ * that automatically handles pagination.
37
+ *
38
+ * @param tokenId - Token in `0.0.X` format
39
+ * @param params - Optional query parameters for filtering
40
+ * @returns Async iterable of NFT info objects
41
+ * @throws {ValidationError} If tokenId format is invalid
42
+ */
43
+ listByToken(tokenId, params) {
44
+ this.validateTokenId(tokenId);
45
+ return paginate(this.client, `/api/v1/tokens/${tokenId}/nfts`, 'nfts', params);
46
+ }
47
+ validateTokenId(id) {
48
+ if (!ENTITY_ID_PATTERN.test(id)) {
49
+ throw new ValidationError(`Invalid token ID format: "${id}". Expected "shard.realm.num" format (e.g., "0.0.1234").`, 'INVALID_TOKEN_ID');
50
+ }
51
+ }
52
+ validateSerialNumber(serial) {
53
+ if (!Number.isInteger(serial) || serial <= 0) {
54
+ throw new ValidationError(`Invalid serial number: ${serial}. Must be a positive integer.`, 'INVALID_SERIAL_NUMBER');
55
+ }
56
+ }
57
+ }
58
+ //# sourceMappingURL=nfts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nfts.js","sourceRoot":"","sources":["../../../src/resources/nfts.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAItC,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;;;;;;GASG;AACH,MAAM,OAAO,YAAY;IACM;IAA7B,YAA6B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IAEpD;;;;;;;;OAQG;IACH,KAAK,CAAC,mBAAmB,CAAC,OAAe,EAAE,YAAoB;QAC7D,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAC9B,IAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CACpB,kBAAkB,OAAO,SAAS,YAAY,EAAE,CACjD,CAAC;IACJ,CAAC;IAED;;;;;;;;OAQG;IACH,WAAW,CAAC,OAAe,EAAE,MAAwB;QACnD,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAC9B,OAAO,QAAQ,CACb,IAAI,CAAC,MAAM,EACX,kBAAkB,OAAO,OAAO,EAChC,MAAM,EACN,MAA+D,CAChE,CAAC;IACJ,CAAC;IAEO,eAAe,CAAC,EAAU;QAChC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,eAAe,CACvB,6BAA6B,EAAE,0DAA0D,EACzF,kBAAkB,CACnB,CAAC;QACJ,CAAC;IACH,CAAC;IAEO,oBAAoB,CAAC,MAAc;QACzC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;YAC7C,MAAM,IAAI,eAAe,CACvB,0BAA0B,MAAM,+BAA+B,EAC/D,uBAAuB,CACxB,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,36 @@
1
+ import type { HieroClient } from '../client/HieroClient.js';
2
+ import type { ScheduleInfo, SchedulesQueryParams } from '../types/api.js';
3
+ /**
4
+ * Provides access to Mirror Node schedule endpoints.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * const schedule = await client.schedules.getById('0.0.1234');
9
+ * for await (const s of client.schedules.list()) {
10
+ * console.log(s.schedule_id);
11
+ * }
12
+ * ```
13
+ */
14
+ export declare class SchedulesResource {
15
+ private readonly client;
16
+ constructor(client: HieroClient);
17
+ /**
18
+ * Retrieves a single schedule by ID.
19
+ *
20
+ * @param scheduleId - Schedule in `0.0.X` format
21
+ * @returns The schedule info including signatures and execution status
22
+ * @throws {ValidationError} If scheduleId format is invalid
23
+ * @throws {MirrorNodeError} If the API request fails
24
+ */
25
+ getById(scheduleId: string): Promise<ScheduleInfo>;
26
+ /**
27
+ * Lists schedules with optional filters. Returns an async iterable
28
+ * that automatically handles pagination.
29
+ *
30
+ * @param params - Optional query parameters for filtering
31
+ * @returns Async iterable of schedule info objects
32
+ */
33
+ list(params?: SchedulesQueryParams): AsyncIterable<ScheduleInfo>;
34
+ private validateScheduleId;
35
+ }
36
+ //# sourceMappingURL=schedules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schedules.d.ts","sourceRoot":"","sources":["../../../src/resources/schedules.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAK1E;;;;;;;;;;GAUG;AACH,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,WAAW;IAEhD;;;;;;;OAOG;IACG,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAKxD;;;;;;OAMG;IACH,IAAI,CAAC,MAAM,CAAC,EAAE,oBAAoB,GAAG,aAAa,CAAC,YAAY,CAAC;IAShE,OAAO,CAAC,kBAAkB;CAQ3B"}
@@ -0,0 +1,49 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ import { paginate } from '../pagination/paginator.js';
3
+ import { ValidationError } from '../errors/index.js';
4
+ import { ENTITY_ID_PATTERN } from '../types/common.js';
5
+ /**
6
+ * Provides access to Mirror Node schedule endpoints.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const schedule = await client.schedules.getById('0.0.1234');
11
+ * for await (const s of client.schedules.list()) {
12
+ * console.log(s.schedule_id);
13
+ * }
14
+ * ```
15
+ */
16
+ export class SchedulesResource {
17
+ client;
18
+ constructor(client) {
19
+ this.client = client;
20
+ }
21
+ /**
22
+ * Retrieves a single schedule by ID.
23
+ *
24
+ * @param scheduleId - Schedule in `0.0.X` format
25
+ * @returns The schedule info including signatures and execution status
26
+ * @throws {ValidationError} If scheduleId format is invalid
27
+ * @throws {MirrorNodeError} If the API request fails
28
+ */
29
+ async getById(scheduleId) {
30
+ this.validateScheduleId(scheduleId);
31
+ return this.client.get(`/api/v1/schedules/${scheduleId}`);
32
+ }
33
+ /**
34
+ * Lists schedules with optional filters. Returns an async iterable
35
+ * that automatically handles pagination.
36
+ *
37
+ * @param params - Optional query parameters for filtering
38
+ * @returns Async iterable of schedule info objects
39
+ */
40
+ list(params) {
41
+ return paginate(this.client, '/api/v1/schedules', 'schedules', params);
42
+ }
43
+ validateScheduleId(id) {
44
+ if (!ENTITY_ID_PATTERN.test(id)) {
45
+ throw new ValidationError(`Invalid schedule ID format: "${id}". Expected "shard.realm.num" format (e.g., "0.0.1234").`, 'INVALID_SCHEDULE_ID');
46
+ }
47
+ }
48
+ }
49
+ //# sourceMappingURL=schedules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schedules.js","sourceRoot":"","sources":["../../../src/resources/schedules.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAItC,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,MAAM,OAAO,iBAAiB;IACC;IAA7B,YAA6B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IAEpD;;;;;;;OAOG;IACH,KAAK,CAAC,OAAO,CAAC,UAAkB;QAC9B,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAe,qBAAqB,UAAU,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED;;;;;;OAMG;IACH,IAAI,CAAC,MAA6B;QAChC,OAAO,QAAQ,CACb,IAAI,CAAC,MAAM,EACX,mBAAmB,EACnB,WAAW,EACX,MAA+D,CAChE,CAAC;IACJ,CAAC;IAEO,kBAAkB,CAAC,EAAU;QACnC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,eAAe,CACvB,gCAAgC,EAAE,0DAA0D,EAC5F,qBAAqB,CACtB,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,36 @@
1
+ import type { HieroClient } from '../client/HieroClient.js';
2
+ import type { TokenInfo, TokensQueryParams } from '../types/api.js';
3
+ /**
4
+ * Provides access to Mirror Node token endpoints.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * const token = await client.tokens.getById('0.0.1234');
9
+ * for await (const t of client.tokens.list({ type: 'FUNGIBLE_COMMON' })) {
10
+ * console.log(t.name, t.symbol);
11
+ * }
12
+ * ```
13
+ */
14
+ export declare class TokensResource {
15
+ private readonly client;
16
+ constructor(client: HieroClient);
17
+ /**
18
+ * Retrieves a single token by ID.
19
+ *
20
+ * @param tokenId - Token in `0.0.X` format
21
+ * @returns The token info including supply, keys, and custom fees
22
+ * @throws {ValidationError} If tokenId format is invalid
23
+ * @throws {MirrorNodeError} If the API request fails
24
+ */
25
+ getById(tokenId: string): Promise<TokenInfo>;
26
+ /**
27
+ * Lists tokens with optional filters. Returns an async iterable
28
+ * that automatically handles pagination.
29
+ *
30
+ * @param params - Optional query parameters for filtering
31
+ * @returns Async iterable of token info objects
32
+ */
33
+ list(params?: TokensQueryParams): AsyncIterable<TokenInfo>;
34
+ private validateTokenId;
35
+ }
36
+ //# sourceMappingURL=tokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../src/resources/tokens.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAKpE;;;;;;;;;;GAUG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,WAAW;IAEhD;;;;;;;OAOG;IACG,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAKlD;;;;;;OAMG;IACH,IAAI,CAAC,MAAM,CAAC,EAAE,iBAAiB,GAAG,aAAa,CAAC,SAAS,CAAC;IAS1D,OAAO,CAAC,eAAe;CAQxB"}
@@ -0,0 +1,49 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ import { paginate } from '../pagination/paginator.js';
3
+ import { ValidationError } from '../errors/index.js';
4
+ import { ENTITY_ID_PATTERN } from '../types/common.js';
5
+ /**
6
+ * Provides access to Mirror Node token endpoints.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const token = await client.tokens.getById('0.0.1234');
11
+ * for await (const t of client.tokens.list({ type: 'FUNGIBLE_COMMON' })) {
12
+ * console.log(t.name, t.symbol);
13
+ * }
14
+ * ```
15
+ */
16
+ export class TokensResource {
17
+ client;
18
+ constructor(client) {
19
+ this.client = client;
20
+ }
21
+ /**
22
+ * Retrieves a single token by ID.
23
+ *
24
+ * @param tokenId - Token in `0.0.X` format
25
+ * @returns The token info including supply, keys, and custom fees
26
+ * @throws {ValidationError} If tokenId format is invalid
27
+ * @throws {MirrorNodeError} If the API request fails
28
+ */
29
+ async getById(tokenId) {
30
+ this.validateTokenId(tokenId);
31
+ return this.client.get(`/api/v1/tokens/${tokenId}`);
32
+ }
33
+ /**
34
+ * Lists tokens with optional filters. Returns an async iterable
35
+ * that automatically handles pagination.
36
+ *
37
+ * @param params - Optional query parameters for filtering
38
+ * @returns Async iterable of token info objects
39
+ */
40
+ list(params) {
41
+ return paginate(this.client, '/api/v1/tokens', 'tokens', params);
42
+ }
43
+ validateTokenId(id) {
44
+ if (!ENTITY_ID_PATTERN.test(id)) {
45
+ throw new ValidationError(`Invalid token ID format: "${id}". Expected "shard.realm.num" format (e.g., "0.0.1234").`, 'INVALID_TOKEN_ID');
46
+ }
47
+ }
48
+ }
49
+ //# sourceMappingURL=tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../src/resources/tokens.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAItC,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,MAAM,OAAO,cAAc;IACI;IAA7B,YAA6B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IAEpD;;;;;;;OAOG;IACH,KAAK,CAAC,OAAO,CAAC,OAAe;QAC3B,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAY,kBAAkB,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;IAED;;;;;;OAMG;IACH,IAAI,CAAC,MAA0B;QAC7B,OAAO,QAAQ,CACb,IAAI,CAAC,MAAM,EACX,gBAAgB,EAChB,QAAQ,EACR,MAA+D,CAChE,CAAC;IACJ,CAAC;IAEO,eAAe,CAAC,EAAU;QAChC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,eAAe,CACvB,6BAA6B,EAAE,0DAA0D,EACzF,kBAAkB,CACnB,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,38 @@
1
+ import type { HieroClient } from '../client/HieroClient.js';
2
+ import type { TopicInfo, TopicMessage, TopicMessagesQueryParams } from '../types/api.js';
3
+ /**
4
+ * Provides access to Mirror Node topic endpoints.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * const topic = await client.topics.getById('0.0.1234');
9
+ * for await (const msg of client.topics.listMessages('0.0.1234')) {
10
+ * console.log(msg.message);
11
+ * }
12
+ * ```
13
+ */
14
+ export declare class TopicsResource {
15
+ private readonly client;
16
+ constructor(client: HieroClient);
17
+ /**
18
+ * Retrieves topic info by ID.
19
+ *
20
+ * @param topicId - Topic in `0.0.X` format
21
+ * @returns The topic info including keys and memo
22
+ * @throws {ValidationError} If topicId format is invalid
23
+ * @throws {MirrorNodeError} If the API request fails
24
+ */
25
+ getById(topicId: string): Promise<TopicInfo>;
26
+ /**
27
+ * Lists messages for a topic. Returns an async iterable
28
+ * that automatically handles pagination.
29
+ *
30
+ * @param topicId - Topic in `0.0.X` format
31
+ * @param params - Optional query parameters for filtering
32
+ * @returns Async iterable of topic message objects
33
+ * @throws {ValidationError} If topicId format is invalid
34
+ */
35
+ listMessages(topicId: string, params?: TopicMessagesQueryParams): AsyncIterable<TopicMessage>;
36
+ private validateTopicId;
37
+ }
38
+ //# sourceMappingURL=topics.d.ts.map