@hashgraphonline/standards-sdk 0.1.161 → 0.1.162
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.
- package/dist/cjs/hcs-14/index.d.ts +1 -0
- package/dist/cjs/hcs-14/index.d.ts.map +1 -1
- package/dist/cjs/hcs-14/resolvers/aid-dns-web-profile.d.ts +1 -0
- package/dist/cjs/hcs-14/resolvers/aid-dns-web-profile.d.ts.map +1 -1
- package/dist/cjs/hcs-14/resolvers/ans-dns-web-profile-utils.d.ts +23 -0
- package/dist/cjs/hcs-14/resolvers/ans-dns-web-profile-utils.d.ts.map +1 -0
- package/dist/cjs/hcs-14/resolvers/ans-dns-web-profile.d.ts +32 -0
- package/dist/cjs/hcs-14/resolvers/ans-dns-web-profile.d.ts.map +1 -0
- package/dist/cjs/hcs-14/resolvers/hcs-11-profile.d.ts +1 -0
- package/dist/cjs/hcs-14/resolvers/hcs-11-profile.d.ts.map +1 -1
- package/dist/cjs/hcs-14/resolvers/hiero.d.ts +1 -0
- package/dist/cjs/hcs-14/resolvers/hiero.d.ts.map +1 -1
- package/dist/cjs/hcs-14/resolvers/registry.d.ts +21 -0
- package/dist/cjs/hcs-14/resolvers/registry.d.ts.map +1 -1
- package/dist/cjs/hcs-14/resolvers/types.d.ts +40 -5
- package/dist/cjs/hcs-14/resolvers/types.d.ts.map +1 -1
- package/dist/cjs/hcs-14/resolvers/uaid-did-resolution-profile.d.ts +1 -0
- package/dist/cjs/hcs-14/resolvers/uaid-did-resolution-profile.d.ts.map +1 -1
- package/dist/cjs/hcs-14/resolvers/uaid-dns-web-profile.d.ts +1 -0
- package/dist/cjs/hcs-14/resolvers/uaid-dns-web-profile.d.ts.map +1 -1
- package/dist/cjs/hcs-14/sdk.d.ts +23 -1
- package/dist/cjs/hcs-14/sdk.d.ts.map +1 -1
- package/dist/cjs/standards-sdk.cjs +2 -2
- package/dist/cjs/standards-sdk.cjs.map +1 -1
- package/dist/es/hcs-14/index.d.ts +1 -0
- package/dist/es/hcs-14/index.d.ts.map +1 -1
- package/dist/es/hcs-14/resolvers/aid-dns-web-profile.d.ts +1 -0
- package/dist/es/hcs-14/resolvers/aid-dns-web-profile.d.ts.map +1 -1
- package/dist/es/hcs-14/resolvers/ans-dns-web-profile-utils.d.ts +23 -0
- package/dist/es/hcs-14/resolvers/ans-dns-web-profile-utils.d.ts.map +1 -0
- package/dist/es/hcs-14/resolvers/ans-dns-web-profile.d.ts +32 -0
- package/dist/es/hcs-14/resolvers/ans-dns-web-profile.d.ts.map +1 -0
- package/dist/es/hcs-14/resolvers/hcs-11-profile.d.ts +1 -0
- package/dist/es/hcs-14/resolvers/hcs-11-profile.d.ts.map +1 -1
- package/dist/es/hcs-14/resolvers/hiero.d.ts +1 -0
- package/dist/es/hcs-14/resolvers/hiero.d.ts.map +1 -1
- package/dist/es/hcs-14/resolvers/registry.d.ts +21 -0
- package/dist/es/hcs-14/resolvers/registry.d.ts.map +1 -1
- package/dist/es/hcs-14/resolvers/types.d.ts +40 -5
- package/dist/es/hcs-14/resolvers/types.d.ts.map +1 -1
- package/dist/es/hcs-14/resolvers/uaid-did-resolution-profile.d.ts +1 -0
- package/dist/es/hcs-14/resolvers/uaid-did-resolution-profile.d.ts.map +1 -1
- package/dist/es/hcs-14/resolvers/uaid-dns-web-profile.d.ts +1 -0
- package/dist/es/hcs-14/resolvers/uaid-dns-web-profile.d.ts.map +1 -1
- package/dist/es/hcs-14/sdk.d.ts +23 -1
- package/dist/es/hcs-14/sdk.d.ts.map +1 -1
- package/dist/es/standards-sdk.es.js +89 -86
- package/dist/es/standards-sdk.es.js.map +1 -1
- package/dist/es/standards-sdk.es100.js +136 -124
- package/dist/es/standards-sdk.es100.js.map +1 -1
- package/dist/es/standards-sdk.es101.js +138 -42
- package/dist/es/standards-sdk.es101.js.map +1 -1
- package/dist/es/standards-sdk.es102.js +43 -259
- package/dist/es/standards-sdk.es102.js.map +1 -1
- package/dist/es/standards-sdk.es103.js +245 -82
- package/dist/es/standards-sdk.es103.js.map +1 -1
- package/dist/es/standards-sdk.es104.js +50 -49
- package/dist/es/standards-sdk.es104.js.map +1 -1
- package/dist/es/standards-sdk.es105.js +100 -29
- package/dist/es/standards-sdk.es105.js.map +1 -1
- package/dist/es/standards-sdk.es106.js +27 -229
- package/dist/es/standards-sdk.es106.js.map +1 -1
- package/dist/es/standards-sdk.es107.js +228 -109
- package/dist/es/standards-sdk.es107.js.map +1 -1
- package/dist/es/standards-sdk.es108.js +94 -15
- package/dist/es/standards-sdk.es108.js.map +1 -1
- package/dist/es/standards-sdk.es109.js +30 -80
- package/dist/es/standards-sdk.es109.js.map +1 -1
- package/dist/es/standards-sdk.es11.js +1 -1
- package/dist/es/standards-sdk.es110.js +80 -27
- package/dist/es/standards-sdk.es110.js.map +1 -1
- package/dist/es/standards-sdk.es111.js +27 -248
- package/dist/es/standards-sdk.es111.js.map +1 -1
- package/dist/es/standards-sdk.es112.js +246 -472
- package/dist/es/standards-sdk.es112.js.map +1 -1
- package/dist/es/standards-sdk.es113.js +458 -85
- package/dist/es/standards-sdk.es113.js.map +1 -1
- package/dist/es/standards-sdk.es114.js +96 -151
- package/dist/es/standards-sdk.es114.js.map +1 -1
- package/dist/es/standards-sdk.es115.js +155 -29
- package/dist/es/standards-sdk.es115.js.map +1 -1
- package/dist/es/standards-sdk.es116.js +26 -4
- package/dist/es/standards-sdk.es116.js.map +1 -1
- package/dist/es/standards-sdk.es117.js +10 -140
- package/dist/es/standards-sdk.es117.js.map +1 -1
- package/dist/es/standards-sdk.es118.js +140 -27
- package/dist/es/standards-sdk.es118.js.map +1 -1
- package/dist/es/standards-sdk.es119.js +27 -20
- package/dist/es/standards-sdk.es119.js.map +1 -1
- package/dist/es/standards-sdk.es12.js +1 -1
- package/dist/es/standards-sdk.es120.js +18 -156
- package/dist/es/standards-sdk.es120.js.map +1 -1
- package/dist/es/standards-sdk.es121.js +148 -191
- package/dist/es/standards-sdk.es121.js.map +1 -1
- package/dist/es/standards-sdk.es122.js +160 -747
- package/dist/es/standards-sdk.es122.js.map +1 -1
- package/dist/es/standards-sdk.es123.js +786 -9
- package/dist/es/standards-sdk.es123.js.map +1 -1
- package/dist/es/standards-sdk.es124.js +13 -567
- package/dist/es/standards-sdk.es124.js.map +1 -1
- package/dist/es/standards-sdk.es125.js +541 -576
- package/dist/es/standards-sdk.es125.js.map +1 -1
- package/dist/es/standards-sdk.es126.js +601 -12
- package/dist/es/standards-sdk.es126.js.map +1 -1
- package/dist/es/standards-sdk.es127.js +13 -2
- package/dist/es/standards-sdk.es127.js.map +1 -1
- package/dist/es/standards-sdk.es128.js +2 -87
- package/dist/es/standards-sdk.es128.js.map +1 -1
- package/dist/es/standards-sdk.es129.js +84 -37
- package/dist/es/standards-sdk.es129.js.map +1 -1
- package/dist/es/standards-sdk.es13.js +1 -1
- package/dist/es/standards-sdk.es130.js +40 -2
- package/dist/es/standards-sdk.es130.js.map +1 -1
- package/dist/es/standards-sdk.es131.js +2 -235
- package/dist/es/standards-sdk.es131.js.map +1 -1
- package/dist/es/standards-sdk.es132.js +204 -1109
- package/dist/es/standards-sdk.es132.js.map +1 -1
- package/dist/es/standards-sdk.es133.js +1059 -225
- package/dist/es/standards-sdk.es133.js.map +1 -1
- package/dist/es/standards-sdk.es134.js +303 -419
- package/dist/es/standards-sdk.es134.js.map +1 -1
- package/dist/es/standards-sdk.es135.js +418 -351
- package/dist/es/standards-sdk.es135.js.map +1 -1
- package/dist/es/standards-sdk.es136.js +347 -1108
- package/dist/es/standards-sdk.es136.js.map +1 -1
- package/dist/es/standards-sdk.es137.js +1088 -180
- package/dist/es/standards-sdk.es137.js.map +1 -1
- package/dist/es/standards-sdk.es138.js +153 -1512
- package/dist/es/standards-sdk.es138.js.map +1 -1
- package/dist/es/standards-sdk.es139.js +1567 -1255
- package/dist/es/standards-sdk.es139.js.map +1 -1
- package/dist/es/standards-sdk.es14.js +1 -1
- package/dist/es/standards-sdk.es140.js +1255 -17
- package/dist/es/standards-sdk.es140.js.map +1 -1
- package/dist/es/standards-sdk.es141.js +15 -85
- package/dist/es/standards-sdk.es141.js.map +1 -1
- package/dist/es/standards-sdk.es142.js +77 -71
- package/dist/es/standards-sdk.es142.js.map +1 -1
- package/dist/es/standards-sdk.es143.js +79 -891
- package/dist/es/standards-sdk.es143.js.map +1 -1
- package/dist/es/standards-sdk.es144.js +886 -53
- package/dist/es/standards-sdk.es144.js.map +1 -1
- package/dist/es/standards-sdk.es145.js +53 -152
- package/dist/es/standards-sdk.es145.js.map +1 -1
- package/dist/es/standards-sdk.es146.js +159 -7
- package/dist/es/standards-sdk.es146.js.map +1 -1
- package/dist/es/standards-sdk.es147.js +7 -86
- package/dist/es/standards-sdk.es147.js.map +1 -1
- package/dist/es/standards-sdk.es148.js +65 -44
- package/dist/es/standards-sdk.es148.js.map +1 -1
- package/dist/es/standards-sdk.es149.js +65 -30
- package/dist/es/standards-sdk.es149.js.map +1 -1
- package/dist/es/standards-sdk.es15.js +1 -1
- package/dist/es/standards-sdk.es150.js +30 -34
- package/dist/es/standards-sdk.es150.js.map +1 -1
- package/dist/es/standards-sdk.es151.js +34 -45
- package/dist/es/standards-sdk.es151.js.map +1 -1
- package/dist/es/standards-sdk.es152.js +48 -138
- package/dist/es/standards-sdk.es152.js.map +1 -1
- package/dist/es/standards-sdk.es153.js +133 -37
- package/dist/es/standards-sdk.es153.js.map +1 -1
- package/dist/es/standards-sdk.es154.js +34 -12474
- package/dist/es/standards-sdk.es154.js.map +1 -1
- package/dist/es/standards-sdk.es155.js +12477 -12
- package/dist/es/standards-sdk.es155.js.map +1 -1
- package/dist/es/standards-sdk.es156.js +15 -54
- package/dist/es/standards-sdk.es156.js.map +1 -1
- package/dist/es/standards-sdk.es157.js +48 -76
- package/dist/es/standards-sdk.es157.js.map +1 -1
- package/dist/es/standards-sdk.es158.js +69 -66
- package/dist/es/standards-sdk.es158.js.map +1 -1
- package/dist/es/standards-sdk.es159.js +71 -63
- package/dist/es/standards-sdk.es159.js.map +1 -1
- package/dist/es/standards-sdk.es16.js +5 -5
- package/dist/es/standards-sdk.es160.js +188 -160
- package/dist/es/standards-sdk.es160.js.map +1 -1
- package/dist/es/standards-sdk.es161.js +65 -314
- package/dist/es/standards-sdk.es161.js.map +1 -1
- package/dist/es/standards-sdk.es162.js +232 -336
- package/dist/es/standards-sdk.es162.js.map +1 -1
- package/dist/es/standards-sdk.es163.js +129 -410
- package/dist/es/standards-sdk.es163.js.map +1 -1
- package/dist/es/standards-sdk.es164.js +200 -209
- package/dist/es/standards-sdk.es164.js.map +1 -1
- package/dist/es/standards-sdk.es165.js +334 -64
- package/dist/es/standards-sdk.es165.js.map +1 -1
- package/dist/es/standards-sdk.es166.js +442 -231
- package/dist/es/standards-sdk.es166.js.map +1 -1
- package/dist/es/standards-sdk.es167.js +317 -158
- package/dist/es/standards-sdk.es167.js.map +1 -1
- package/dist/es/standards-sdk.es168.js +61 -207
- package/dist/es/standards-sdk.es168.js.map +1 -1
- package/dist/es/standards-sdk.es169.js +155 -222
- package/dist/es/standards-sdk.es169.js.map +1 -1
- package/dist/es/standards-sdk.es170.js +178 -75
- package/dist/es/standards-sdk.es170.js.map +1 -1
- package/dist/es/standards-sdk.es171.js +226 -113
- package/dist/es/standards-sdk.es171.js.map +1 -1
- package/dist/es/standards-sdk.es172.js +77 -119
- package/dist/es/standards-sdk.es172.js.map +1 -1
- package/dist/es/standards-sdk.es173.js +103 -162
- package/dist/es/standards-sdk.es173.js.map +1 -1
- package/dist/es/standards-sdk.es174.js +141 -119
- package/dist/es/standards-sdk.es174.js.map +1 -1
- package/dist/es/standards-sdk.es175.js +152 -298
- package/dist/es/standards-sdk.es175.js.map +1 -1
- package/dist/es/standards-sdk.es176.js +120 -240
- package/dist/es/standards-sdk.es176.js.map +1 -1
- package/dist/es/standards-sdk.es177.js +298 -83
- package/dist/es/standards-sdk.es177.js.map +1 -1
- package/dist/es/standards-sdk.es178.js +262 -0
- package/dist/es/standards-sdk.es178.js.map +1 -0
- package/dist/es/standards-sdk.es179.js +119 -0
- package/dist/es/standards-sdk.es179.js.map +1 -0
- package/dist/es/standards-sdk.es18.js +12 -12
- package/dist/es/standards-sdk.es19.js +9 -9
- package/dist/es/standards-sdk.es2.js +2 -2
- package/dist/es/standards-sdk.es20.js +1 -1
- package/dist/es/standards-sdk.es21.js +1 -1
- package/dist/es/standards-sdk.es22.js +1 -1
- package/dist/es/standards-sdk.es23.js +1 -1
- package/dist/es/standards-sdk.es24.js +1 -1
- package/dist/es/standards-sdk.es25.js +1 -1
- package/dist/es/standards-sdk.es26.js +1 -1
- package/dist/es/standards-sdk.es27.js +12 -12
- package/dist/es/standards-sdk.es30.js +2 -2
- package/dist/es/standards-sdk.es31.js +4 -4
- package/dist/es/standards-sdk.es32.js +1 -1
- package/dist/es/standards-sdk.es35.js +6 -6
- package/dist/es/standards-sdk.es36.js +4 -4
- package/dist/es/standards-sdk.es37.js +2 -2
- package/dist/es/standards-sdk.es38.js +2 -2
- package/dist/es/standards-sdk.es39.js +1 -1
- package/dist/es/standards-sdk.es4.js +2 -2
- package/dist/es/standards-sdk.es40.js +1 -1
- package/dist/es/standards-sdk.es41.js +2 -2
- package/dist/es/standards-sdk.es46.js +1 -1
- package/dist/es/standards-sdk.es5.js +2 -2
- package/dist/es/standards-sdk.es51.js +1 -1
- package/dist/es/standards-sdk.es53.js +1 -1
- package/dist/es/standards-sdk.es56.js +2 -2
- package/dist/es/standards-sdk.es58.js +37 -4
- package/dist/es/standards-sdk.es58.js.map +1 -1
- package/dist/es/standards-sdk.es59.js +17 -10
- package/dist/es/standards-sdk.es59.js.map +1 -1
- package/dist/es/standards-sdk.es6.js +2 -2
- package/dist/es/standards-sdk.es60.js +2 -1
- package/dist/es/standards-sdk.es60.js.map +1 -1
- package/dist/es/standards-sdk.es61.js +1 -0
- package/dist/es/standards-sdk.es61.js.map +1 -1
- package/dist/es/standards-sdk.es62.js +19 -5
- package/dist/es/standards-sdk.es62.js.map +1 -1
- package/dist/es/standards-sdk.es63.js +214 -153
- package/dist/es/standards-sdk.es63.js.map +1 -1
- package/dist/es/standards-sdk.es64.js +205 -84
- package/dist/es/standards-sdk.es64.js.map +1 -1
- package/dist/es/standards-sdk.es65.js +125 -40
- package/dist/es/standards-sdk.es65.js.map +1 -1
- package/dist/es/standards-sdk.es66.js +41 -261
- package/dist/es/standards-sdk.es66.js.map +1 -1
- package/dist/es/standards-sdk.es67.js +262 -24
- package/dist/es/standards-sdk.es67.js.map +1 -1
- package/dist/es/standards-sdk.es68.js +25 -87
- package/dist/es/standards-sdk.es68.js.map +1 -1
- package/dist/es/standards-sdk.es69.js +95 -3
- package/dist/es/standards-sdk.es69.js.map +1 -1
- package/dist/es/standards-sdk.es7.js +1 -1
- package/dist/es/standards-sdk.es70.js +3 -100
- package/dist/es/standards-sdk.es70.js.map +1 -1
- package/dist/es/standards-sdk.es71.js +62 -61
- package/dist/es/standards-sdk.es71.js.map +1 -1
- package/dist/es/standards-sdk.es72.js +98 -17
- package/dist/es/standards-sdk.es72.js.map +1 -1
- package/dist/es/standards-sdk.es73.js +19 -77
- package/dist/es/standards-sdk.es73.js.map +1 -1
- package/dist/es/standards-sdk.es74.js +77 -458
- package/dist/es/standards-sdk.es74.js.map +1 -1
- package/dist/es/standards-sdk.es75.js +240 -106
- package/dist/es/standards-sdk.es75.js.map +1 -1
- package/dist/es/standards-sdk.es76.js +286 -170
- package/dist/es/standards-sdk.es76.js.map +1 -1
- package/dist/es/standards-sdk.es77.js +207 -71
- package/dist/es/standards-sdk.es77.js.map +1 -1
- package/dist/es/standards-sdk.es78.js +72 -71
- package/dist/es/standards-sdk.es78.js.map +1 -1
- package/dist/es/standards-sdk.es79.js +71 -143
- package/dist/es/standards-sdk.es79.js.map +1 -1
- package/dist/es/standards-sdk.es80.js +136 -62
- package/dist/es/standards-sdk.es80.js.map +1 -1
- package/dist/es/standards-sdk.es81.js +45 -380
- package/dist/es/standards-sdk.es81.js.map +1 -1
- package/dist/es/standards-sdk.es82.js +130 -222
- package/dist/es/standards-sdk.es82.js.map +1 -1
- package/dist/es/standards-sdk.es83.js +444 -313
- package/dist/es/standards-sdk.es83.js.map +1 -1
- package/dist/es/standards-sdk.es84.js +364 -88
- package/dist/es/standards-sdk.es84.js.map +1 -1
- package/dist/es/standards-sdk.es85.js +89 -125
- package/dist/es/standards-sdk.es85.js.map +1 -1
- package/dist/es/standards-sdk.es86.js +125 -8
- package/dist/es/standards-sdk.es86.js.map +1 -1
- package/dist/es/standards-sdk.es87.js +6 -45
- package/dist/es/standards-sdk.es87.js.map +1 -1
- package/dist/es/standards-sdk.es88.js +44 -98
- package/dist/es/standards-sdk.es88.js.map +1 -1
- package/dist/es/standards-sdk.es89.js +84 -331
- package/dist/es/standards-sdk.es89.js.map +1 -1
- package/dist/es/standards-sdk.es9.js +2 -2
- package/dist/es/standards-sdk.es90.js +160 -93
- package/dist/es/standards-sdk.es90.js.map +1 -1
- package/dist/es/standards-sdk.es91.js +275 -55
- package/dist/es/standards-sdk.es91.js.map +1 -1
- package/dist/es/standards-sdk.es92.js +55 -43
- package/dist/es/standards-sdk.es92.js.map +1 -1
- package/dist/es/standards-sdk.es93.js +44 -145
- package/dist/es/standards-sdk.es93.js.map +1 -1
- package/dist/es/standards-sdk.es94.js +113 -30
- package/dist/es/standards-sdk.es94.js.map +1 -1
- package/dist/es/standards-sdk.es95.js +59 -22
- package/dist/es/standards-sdk.es95.js.map +1 -1
- package/dist/es/standards-sdk.es96.js +28 -23
- package/dist/es/standards-sdk.es96.js.map +1 -1
- package/dist/es/standards-sdk.es97.js +23 -238
- package/dist/es/standards-sdk.es97.js.map +1 -1
- package/dist/es/standards-sdk.es98.js +225 -267
- package/dist/es/standards-sdk.es98.js.map +1 -1
- package/dist/es/standards-sdk.es99.js +220 -95
- package/dist/es/standards-sdk.es99.js.map +1 -1
- package/package.json +5 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { HCS2BaseClient } from "./standards-sdk.
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
class
|
|
1
|
+
import { AccountId, Client, PublicKey } from "@hashgraph/sdk";
|
|
2
|
+
import { HCS2BaseClient } from "./standards-sdk.es77.js";
|
|
3
|
+
import { HCS2Operation, HCS2RegistryType } from "./standards-sdk.es74.js";
|
|
4
|
+
import { createNodeOperatorContext } from "./standards-sdk.es153.js";
|
|
5
|
+
import { buildMessageTx } from "./standards-sdk.es154.js";
|
|
6
|
+
import { buildHcs2CreateRegistryTx } from "./standards-sdk.es78.js";
|
|
7
|
+
const _HCS2Client = class _HCS2Client extends HCS2BaseClient {
|
|
8
8
|
/**
|
|
9
|
-
* Create a new
|
|
9
|
+
* Create a new HCS-2 client
|
|
10
10
|
* @param config Client configuration
|
|
11
11
|
*/
|
|
12
12
|
constructor(config) {
|
|
@@ -17,25 +17,36 @@ class BrowserHCS2Client extends HCS2BaseClient {
|
|
|
17
17
|
mirrorNodeUrl: config.mirrorNodeUrl,
|
|
18
18
|
logger: config.logger
|
|
19
19
|
});
|
|
20
|
-
this.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
this.registryTypeCache = /* @__PURE__ */ new Map();
|
|
21
|
+
this.operatorId = typeof config.operatorId === "string" ? AccountId.fromString(config.operatorId) : config.operatorId;
|
|
22
|
+
this.operatorCtx = createNodeOperatorContext({
|
|
23
|
+
network: this.network,
|
|
24
|
+
operatorId: this.operatorId,
|
|
25
|
+
operatorKey: config.operatorKey,
|
|
26
|
+
keyType: config.keyType,
|
|
27
|
+
mirrorNode: this.mirrorNode,
|
|
28
|
+
logger: this.logger,
|
|
29
|
+
client: this.createClient(config.network)
|
|
30
|
+
});
|
|
31
|
+
this.client = this.operatorCtx.client;
|
|
28
32
|
}
|
|
29
33
|
/**
|
|
30
|
-
*
|
|
31
|
-
* @returns The operator account ID
|
|
34
|
+
* Initialize the Hedera client with operator information
|
|
32
35
|
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
async ensureInitialized() {
|
|
37
|
+
await this.operatorCtx.ensureInitialized();
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Create a Hedera client for the specified network
|
|
41
|
+
* @param network The network to connect to
|
|
42
|
+
* @returns The Hedera client
|
|
43
|
+
*/
|
|
44
|
+
createClient(network) {
|
|
45
|
+
if (network === "mainnet") {
|
|
46
|
+
return Client.forMainnet();
|
|
47
|
+
} else {
|
|
48
|
+
return Client.forTestnet();
|
|
37
49
|
}
|
|
38
|
-
return accountInfo.accountId;
|
|
39
50
|
}
|
|
40
51
|
/**
|
|
41
52
|
* Create a new registry topic
|
|
@@ -44,70 +55,79 @@ class BrowserHCS2Client extends HCS2BaseClient {
|
|
|
44
55
|
*/
|
|
45
56
|
async createRegistry(options = {}) {
|
|
46
57
|
try {
|
|
58
|
+
await this.ensureInitialized();
|
|
47
59
|
const registryType = options.registryType ?? HCS2RegistryType.INDEXED;
|
|
48
60
|
const ttl = options.ttl ?? 86400;
|
|
49
61
|
const memo = this.generateRegistryMemo(registryType, ttl);
|
|
50
|
-
let
|
|
62
|
+
let adminKeyPrivate;
|
|
63
|
+
let adminPublicKey;
|
|
51
64
|
if (options.adminKey) {
|
|
52
|
-
let adminPublicKey;
|
|
53
65
|
if (typeof options.adminKey === "string") {
|
|
54
66
|
try {
|
|
55
67
|
adminPublicKey = PublicKey.fromString(options.adminKey);
|
|
56
68
|
} catch {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
69
|
+
const keyBytes = Buffer.from(
|
|
70
|
+
options.adminKey.replace(/^0x/i, ""),
|
|
71
|
+
"hex"
|
|
72
|
+
);
|
|
73
|
+
adminPublicKey = this.operatorCtx.keyType === "ed25519" ? PublicKey.fromBytesED25519(keyBytes) : PublicKey.fromBytesECDSA(keyBytes);
|
|
63
74
|
}
|
|
64
75
|
} else if (typeof options.adminKey === "boolean") {
|
|
65
|
-
adminPublicKey =
|
|
66
|
-
this.getOperatorId()
|
|
67
|
-
);
|
|
76
|
+
adminPublicKey = this.operatorCtx.operatorKey.publicKey;
|
|
68
77
|
} else {
|
|
69
78
|
adminPublicKey = options.adminKey.publicKey;
|
|
79
|
+
adminKeyPrivate = options.adminKey;
|
|
70
80
|
}
|
|
71
|
-
transaction = transaction.setAdminKey(adminPublicKey);
|
|
72
81
|
}
|
|
82
|
+
let submitKeyPrivate;
|
|
83
|
+
let submitPublicKey;
|
|
73
84
|
if (options.submitKey) {
|
|
74
|
-
let submitPublicKey;
|
|
75
85
|
if (typeof options.submitKey === "string") {
|
|
76
86
|
try {
|
|
77
87
|
submitPublicKey = PublicKey.fromString(options.submitKey);
|
|
78
88
|
} catch {
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
89
|
+
const keyBytes = Buffer.from(
|
|
90
|
+
options.submitKey.replace(/^0x/i, ""),
|
|
91
|
+
"hex"
|
|
92
|
+
);
|
|
93
|
+
submitPublicKey = this.operatorCtx.keyType === "ed25519" ? PublicKey.fromBytesED25519(keyBytes) : PublicKey.fromBytesECDSA(keyBytes);
|
|
85
94
|
}
|
|
86
95
|
} else if (typeof options.submitKey === "boolean") {
|
|
87
|
-
submitPublicKey =
|
|
88
|
-
this.getOperatorId()
|
|
89
|
-
);
|
|
96
|
+
submitPublicKey = this.operatorCtx.operatorKey.publicKey;
|
|
90
97
|
} else {
|
|
91
98
|
submitPublicKey = options.submitKey.publicKey;
|
|
99
|
+
submitKeyPrivate = options.submitKey;
|
|
92
100
|
}
|
|
93
|
-
transaction = transaction.setSubmitKey(submitPublicKey);
|
|
94
101
|
}
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
102
|
+
const transaction = buildHcs2CreateRegistryTx({
|
|
103
|
+
registryType,
|
|
104
|
+
ttl,
|
|
105
|
+
adminKey: adminPublicKey,
|
|
106
|
+
submitKey: submitPublicKey,
|
|
107
|
+
operatorPublicKey: this.operatorCtx.operatorKey.publicKey
|
|
108
|
+
});
|
|
109
|
+
const frozenTx = await transaction.freezeWith(this.client);
|
|
110
|
+
if (adminKeyPrivate) {
|
|
111
|
+
await frozenTx.sign(adminKeyPrivate);
|
|
98
112
|
}
|
|
99
|
-
|
|
100
|
-
|
|
113
|
+
if (submitKeyPrivate) {
|
|
114
|
+
await frozenTx.sign(submitKeyPrivate);
|
|
115
|
+
}
|
|
116
|
+
const txResponse = await frozenTx.execute(this.client);
|
|
117
|
+
const receipt = await txResponse.getReceipt(this.client);
|
|
118
|
+
const topicId = receipt.topicId;
|
|
119
|
+
if (!topicId) {
|
|
101
120
|
throw new Error("Failed to create registry: No topic ID in receipt");
|
|
102
121
|
}
|
|
103
|
-
const
|
|
122
|
+
const topicIdStr = topicId.toString();
|
|
123
|
+
this.registryTypeCache.set(topicIdStr, registryType);
|
|
104
124
|
this.logger.info(
|
|
105
|
-
`Created registry topic: ${
|
|
125
|
+
`Created registry topic: ${topicIdStr} (${registryType === HCS2RegistryType.INDEXED ? "Indexed" : "Non-indexed"}, TTL: ${ttl}s)`
|
|
106
126
|
);
|
|
107
127
|
return {
|
|
108
128
|
success: true,
|
|
109
|
-
topicId,
|
|
110
|
-
transactionId: txResponse.transactionId
|
|
129
|
+
topicId: topicIdStr,
|
|
130
|
+
transactionId: txResponse.transactionId.toString()
|
|
111
131
|
};
|
|
112
132
|
} catch (error) {
|
|
113
133
|
this.logger.error(`Failed to create registry: ${error}`);
|
|
@@ -121,23 +141,28 @@ class BrowserHCS2Client extends HCS2BaseClient {
|
|
|
121
141
|
* Register a new entry in the registry
|
|
122
142
|
* @param registryTopicId The topic ID of the registry
|
|
123
143
|
* @param options Registration options
|
|
144
|
+
* @param protocol Optional protocol version (defaults to 'hcs-2')
|
|
124
145
|
* @returns Promise resolving to the operation result
|
|
125
146
|
*/
|
|
126
|
-
async registerEntry(registryTopicId, options) {
|
|
147
|
+
async registerEntry(registryTopicId, options, protocol = "hcs-2") {
|
|
127
148
|
try {
|
|
149
|
+
await this.ensureInitialized();
|
|
128
150
|
const message = this.createRegisterMessage(
|
|
129
151
|
options.targetTopicId,
|
|
130
152
|
options.metadata,
|
|
131
|
-
options.memo
|
|
153
|
+
options.memo,
|
|
154
|
+
protocol
|
|
155
|
+
);
|
|
156
|
+
const registryType = options.registryType ?? await this.resolveRegistryType(registryTopicId);
|
|
157
|
+
this.registryTypeCache.set(registryTopicId, registryType);
|
|
158
|
+
const analyticsMemo = options.analyticsMemo ?? this.buildAnalyticsMemo(HCS2Operation.REGISTER, registryType);
|
|
159
|
+
const receipt = await this.submitMessage(
|
|
160
|
+
registryTopicId,
|
|
161
|
+
message,
|
|
162
|
+
analyticsMemo
|
|
132
163
|
);
|
|
133
|
-
if (message.op !== HCS2Operation.REGISTER) {
|
|
134
|
-
throw new Error(
|
|
135
|
-
`Invalid operation type: ${message.op}, expected ${HCS2Operation.REGISTER}`
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
const receipt = await this.submitMessage(registryTopicId, message);
|
|
139
164
|
this.logger.info(
|
|
140
|
-
`Registered entry in registry ${registryTopicId} pointing to topic ${options.targetTopicId}`
|
|
165
|
+
`Registered entry in registry ${registryTopicId} pointing to topic ${options.targetTopicId} using protocol ${protocol}`
|
|
141
166
|
);
|
|
142
167
|
return {
|
|
143
168
|
success: true,
|
|
@@ -160,6 +185,7 @@ class BrowserHCS2Client extends HCS2BaseClient {
|
|
|
160
185
|
*/
|
|
161
186
|
async updateEntry(registryTopicId, options) {
|
|
162
187
|
try {
|
|
188
|
+
await this.ensureInitialized();
|
|
163
189
|
const registryInfo = await this.mirrorNode.getTopicInfo(registryTopicId);
|
|
164
190
|
const memoInfo = this.parseRegistryTypeFromMemo(registryInfo.memo);
|
|
165
191
|
if (!memoInfo || memoInfo.registryType !== HCS2RegistryType.INDEXED) {
|
|
@@ -173,7 +199,14 @@ class BrowserHCS2Client extends HCS2BaseClient {
|
|
|
173
199
|
options.metadata,
|
|
174
200
|
options.memo
|
|
175
201
|
);
|
|
176
|
-
const
|
|
202
|
+
const registryType = options.registryType ?? await this.resolveRegistryType(registryTopicId);
|
|
203
|
+
this.registryTypeCache.set(registryTopicId, registryType);
|
|
204
|
+
const analyticsMemo = options.analyticsMemo ?? this.buildAnalyticsMemo(HCS2Operation.UPDATE, registryType);
|
|
205
|
+
const receipt = await this.submitMessage(
|
|
206
|
+
registryTopicId,
|
|
207
|
+
message,
|
|
208
|
+
analyticsMemo
|
|
209
|
+
);
|
|
177
210
|
this.logger.info(
|
|
178
211
|
`Updated entry with UID ${options.uid} in registry ${registryTopicId}`
|
|
179
212
|
);
|
|
@@ -184,10 +217,7 @@ class BrowserHCS2Client extends HCS2BaseClient {
|
|
|
184
217
|
};
|
|
185
218
|
} catch (error) {
|
|
186
219
|
this.logger.error(`Failed to update entry: ${error}`);
|
|
187
|
-
|
|
188
|
-
success: false,
|
|
189
|
-
error: `Failed to update entry: ${error}`
|
|
190
|
-
};
|
|
220
|
+
throw error;
|
|
191
221
|
}
|
|
192
222
|
}
|
|
193
223
|
/**
|
|
@@ -198,6 +228,7 @@ class BrowserHCS2Client extends HCS2BaseClient {
|
|
|
198
228
|
*/
|
|
199
229
|
async deleteEntry(registryTopicId, options) {
|
|
200
230
|
try {
|
|
231
|
+
await this.ensureInitialized();
|
|
201
232
|
const registryInfo = await this.mirrorNode.getTopicInfo(registryTopicId);
|
|
202
233
|
const memoInfo = this.parseRegistryTypeFromMemo(registryInfo.memo);
|
|
203
234
|
if (!memoInfo || memoInfo.registryType !== HCS2RegistryType.INDEXED) {
|
|
@@ -206,7 +237,14 @@ class BrowserHCS2Client extends HCS2BaseClient {
|
|
|
206
237
|
);
|
|
207
238
|
}
|
|
208
239
|
const message = this.createDeleteMessage(options.uid, options.memo);
|
|
209
|
-
const
|
|
240
|
+
const registryType = options.registryType ?? await this.resolveRegistryType(registryTopicId);
|
|
241
|
+
this.registryTypeCache.set(registryTopicId, registryType);
|
|
242
|
+
const analyticsMemo = options.analyticsMemo ?? this.buildAnalyticsMemo(HCS2Operation.DELETE, registryType);
|
|
243
|
+
const receipt = await this.submitMessage(
|
|
244
|
+
registryTopicId,
|
|
245
|
+
message,
|
|
246
|
+
analyticsMemo
|
|
247
|
+
);
|
|
210
248
|
this.logger.info(
|
|
211
249
|
`Deleted entry with UID ${options.uid} from registry ${registryTopicId}`
|
|
212
250
|
);
|
|
@@ -217,10 +255,7 @@ class BrowserHCS2Client extends HCS2BaseClient {
|
|
|
217
255
|
};
|
|
218
256
|
} catch (error) {
|
|
219
257
|
this.logger.error(`Failed to delete entry: ${error}`);
|
|
220
|
-
|
|
221
|
-
success: false,
|
|
222
|
-
error: `Failed to delete entry: ${error}`
|
|
223
|
-
};
|
|
258
|
+
throw error;
|
|
224
259
|
}
|
|
225
260
|
}
|
|
226
261
|
/**
|
|
@@ -231,12 +266,20 @@ class BrowserHCS2Client extends HCS2BaseClient {
|
|
|
231
266
|
*/
|
|
232
267
|
async migrateRegistry(registryTopicId, options) {
|
|
233
268
|
try {
|
|
269
|
+
await this.ensureInitialized();
|
|
234
270
|
const message = this.createMigrateMessage(
|
|
235
271
|
options.targetTopicId,
|
|
236
272
|
options.metadata,
|
|
237
273
|
options.memo
|
|
238
274
|
);
|
|
239
|
-
const
|
|
275
|
+
const registryType = options.registryType ?? await this.resolveRegistryType(registryTopicId);
|
|
276
|
+
this.registryTypeCache.set(registryTopicId, registryType);
|
|
277
|
+
const analyticsMemo = options.analyticsMemo ?? this.buildAnalyticsMemo(HCS2Operation.MIGRATE, registryType);
|
|
278
|
+
const receipt = await this.submitMessage(
|
|
279
|
+
registryTopicId,
|
|
280
|
+
message,
|
|
281
|
+
analyticsMemo
|
|
282
|
+
);
|
|
240
283
|
this.logger.info(
|
|
241
284
|
`Migrated registry ${registryTopicId} to ${options.targetTopicId}`
|
|
242
285
|
);
|
|
@@ -247,10 +290,7 @@ class BrowserHCS2Client extends HCS2BaseClient {
|
|
|
247
290
|
};
|
|
248
291
|
} catch (error) {
|
|
249
292
|
this.logger.error(`Failed to migrate registry: ${error}`);
|
|
250
|
-
|
|
251
|
-
success: false,
|
|
252
|
-
error: `Failed to migrate registry: ${error}`
|
|
253
|
-
};
|
|
293
|
+
throw error;
|
|
254
294
|
}
|
|
255
295
|
}
|
|
256
296
|
/**
|
|
@@ -261,67 +301,161 @@ class BrowserHCS2Client extends HCS2BaseClient {
|
|
|
261
301
|
*/
|
|
262
302
|
async getRegistry(topicId, options = {}) {
|
|
263
303
|
try {
|
|
304
|
+
await this.ensureInitialized();
|
|
264
305
|
const topicInfo = await this.mirrorNode.getTopicInfo(topicId);
|
|
306
|
+
this.logger.debug(
|
|
307
|
+
`Retrieved topic info for ${topicId}: ${JSON.stringify(topicInfo)}`
|
|
308
|
+
);
|
|
265
309
|
const memoInfo = this.parseRegistryTypeFromMemo(topicInfo.memo);
|
|
266
310
|
if (!memoInfo) {
|
|
267
311
|
throw new Error(
|
|
268
312
|
`Topic ${topicId} is not an HCS-2 registry (invalid memo format)`
|
|
269
313
|
);
|
|
270
314
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
});
|
|
276
|
-
const messages = options.limit ? messagesResult.slice(0, options.limit) : messagesResult;
|
|
277
|
-
return this.parseRegistryEntries(
|
|
315
|
+
this.logger.debug(
|
|
316
|
+
`Retrieving messages for topic ${topicId} with limit ${options.limit ?? 100}`
|
|
317
|
+
);
|
|
318
|
+
const rawMessagesResult = await this.mirrorNode.getTopicMessages(
|
|
278
319
|
topicId,
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
320
|
+
{
|
|
321
|
+
sequenceNumber: options.skip && options.skip > 0 ? `gt:${options.skip}` : void 0,
|
|
322
|
+
limit: options.limit ?? 100,
|
|
323
|
+
order: options.order ?? "asc"
|
|
324
|
+
}
|
|
325
|
+
);
|
|
326
|
+
const rawMessages = options.limit ? rawMessagesResult.slice(0, options.limit) : rawMessagesResult;
|
|
327
|
+
this.logger.debug(
|
|
328
|
+
`Retrieved ${rawMessagesResult.length} messages, using ${rawMessages.length} after applying limit.`
|
|
282
329
|
);
|
|
330
|
+
const entries = [];
|
|
331
|
+
let latestEntry;
|
|
332
|
+
for (const msg of rawMessages) {
|
|
333
|
+
try {
|
|
334
|
+
const message = {
|
|
335
|
+
p: "hcs-2",
|
|
336
|
+
op: msg.op,
|
|
337
|
+
t_id: msg.t_id,
|
|
338
|
+
uid: msg.uid,
|
|
339
|
+
metadata: msg.metadata,
|
|
340
|
+
m: msg.m
|
|
341
|
+
};
|
|
342
|
+
const { valid, errors } = this.validateMessage(message);
|
|
343
|
+
if (!valid) {
|
|
344
|
+
this.logger.warn(`Invalid HCS-2 message: ${errors.join(", ")}`);
|
|
345
|
+
continue;
|
|
346
|
+
}
|
|
347
|
+
const entry = {
|
|
348
|
+
topicId,
|
|
349
|
+
sequence: msg.sequence_number,
|
|
350
|
+
timestamp: msg.consensus_timestamp,
|
|
351
|
+
payer: msg.payer_account_id || msg.payer || "",
|
|
352
|
+
message,
|
|
353
|
+
consensus_timestamp: msg.consensus_timestamp,
|
|
354
|
+
registry_type: memoInfo.registryType
|
|
355
|
+
};
|
|
356
|
+
entries.push(entry);
|
|
357
|
+
if (memoInfo.registryType === HCS2RegistryType.NON_INDEXED || !latestEntry || entry.timestamp > latestEntry.timestamp) {
|
|
358
|
+
latestEntry = entry;
|
|
359
|
+
}
|
|
360
|
+
} catch (error) {
|
|
361
|
+
this.logger.warn(`Error processing message: ${error}`);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
this.logger.debug(
|
|
365
|
+
`Processed ${entries.length} valid entries for registry ${topicId}`
|
|
366
|
+
);
|
|
367
|
+
const registry = {
|
|
368
|
+
topicId,
|
|
369
|
+
registryType: memoInfo.registryType,
|
|
370
|
+
ttl: memoInfo.ttl,
|
|
371
|
+
entries: memoInfo.registryType === HCS2RegistryType.INDEXED ? entries : latestEntry ? [latestEntry] : [],
|
|
372
|
+
latestEntry
|
|
373
|
+
};
|
|
374
|
+
return registry;
|
|
283
375
|
} catch (error) {
|
|
284
376
|
this.logger.error(`Failed to get registry: ${error}`);
|
|
285
377
|
throw error;
|
|
286
378
|
}
|
|
287
379
|
}
|
|
380
|
+
buildAnalyticsMemo(operation, registryType) {
|
|
381
|
+
const opCode = _HCS2Client.operationAnalyticsCode[operation];
|
|
382
|
+
return `hcs-2:op:${opCode}:${registryType}`;
|
|
383
|
+
}
|
|
384
|
+
async resolveRegistryType(topicId) {
|
|
385
|
+
const cached = this.registryTypeCache.get(topicId);
|
|
386
|
+
if (cached !== void 0) {
|
|
387
|
+
return cached;
|
|
388
|
+
}
|
|
389
|
+
const topicInfo = await this.mirrorNode.getTopicInfo(topicId);
|
|
390
|
+
const memoInfo = this.parseRegistryTypeFromMemo(topicInfo.memo);
|
|
391
|
+
if (!memoInfo) {
|
|
392
|
+
throw new Error(
|
|
393
|
+
`Topic ${topicId} is not an HCS-2 registry (invalid memo format)`
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
this.registryTypeCache.set(topicId, memoInfo.registryType);
|
|
397
|
+
return memoInfo.registryType;
|
|
398
|
+
}
|
|
288
399
|
/**
|
|
289
400
|
* Submit a message to a topic
|
|
290
401
|
* @param topicId The topic ID to submit to
|
|
291
402
|
* @param payload The message payload
|
|
292
403
|
* @returns Promise resolving to the transaction receipt
|
|
293
404
|
*/
|
|
294
|
-
async submitMessage(topicId, payload) {
|
|
405
|
+
async submitMessage(topicId, payload, analyticsMemo) {
|
|
295
406
|
try {
|
|
407
|
+
await this.ensureInitialized();
|
|
296
408
|
const { valid, errors } = this.validateMessage(payload);
|
|
297
409
|
if (!valid) {
|
|
298
410
|
throw new Error(`Invalid HCS-2 message: ${errors.join(", ")}`);
|
|
299
411
|
}
|
|
300
412
|
const transaction = buildMessageTx({
|
|
301
413
|
topicId,
|
|
302
|
-
message: JSON.stringify(payload)
|
|
414
|
+
message: JSON.stringify(payload),
|
|
415
|
+
transactionMemo: analyticsMemo
|
|
303
416
|
});
|
|
304
|
-
const txResponse = await this.
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
}
|
|
308
|
-
return txResponse.result;
|
|
417
|
+
const txResponse = await transaction.execute(this.client);
|
|
418
|
+
const receipt = await txResponse.getReceipt(this.client);
|
|
419
|
+
return receipt;
|
|
309
420
|
} catch (error) {
|
|
310
421
|
this.logger.error(`Failed to submit message: ${error}`);
|
|
311
422
|
throw error;
|
|
312
423
|
}
|
|
313
424
|
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
425
|
+
/**
|
|
426
|
+
* @param topicId The topic ID to query
|
|
427
|
+
* @returns Promise resolving to the topic information
|
|
428
|
+
*/
|
|
429
|
+
async getTopicInfo(topicId) {
|
|
430
|
+
return this.mirrorNode.getTopicInfo(topicId);
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Close the client and release resources
|
|
434
|
+
*/
|
|
435
|
+
close() {
|
|
436
|
+
this.logger.info("HCS-2 client closed.");
|
|
322
437
|
}
|
|
323
|
-
|
|
438
|
+
/**
|
|
439
|
+
* Get the configured key type (ed25519 or ecdsa)
|
|
440
|
+
*/
|
|
441
|
+
getKeyType() {
|
|
442
|
+
return this.operatorCtx.keyType;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Get the configured operator private key
|
|
446
|
+
*/
|
|
447
|
+
getOperatorKey() {
|
|
448
|
+
return this.operatorCtx.operatorKey;
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
_HCS2Client.operationAnalyticsCode = {
|
|
452
|
+
[HCS2Operation.REGISTER]: 0,
|
|
453
|
+
[HCS2Operation.UPDATE]: 1,
|
|
454
|
+
[HCS2Operation.DELETE]: 2,
|
|
455
|
+
[HCS2Operation.MIGRATE]: 3
|
|
456
|
+
};
|
|
457
|
+
let HCS2Client = _HCS2Client;
|
|
324
458
|
export {
|
|
325
|
-
|
|
459
|
+
HCS2Client
|
|
326
460
|
};
|
|
327
461
|
//# sourceMappingURL=standards-sdk.es75.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es75.js","sources":["../../src/hcs-2/browser.ts"],"sourcesContent":["import {\n TransactionReceipt,\n TopicCreateTransaction,\n TopicMessageSubmitTransaction,\n TopicId,\n PublicKey,\n} from '@hashgraph/sdk';\nimport { HashinalsWalletConnectSDK } from '@hashgraphonline/hashinal-wc';\nimport { HCS2BaseClient } from './base-client';\nimport {\n HCS2ClientConfig,\n HCS2Message,\n HCS2Operation,\n HCS2RegistryType,\n TopicRegistrationResponse,\n RegistryOperationResponse,\n TopicRegistry,\n CreateRegistryOptions,\n RegisterEntryOptions,\n UpdateEntryOptions,\n DeleteEntryOptions,\n MigrateTopicOptions,\n QueryRegistryOptions,\n} from './types';\nimport { isBrowser } from '../utils/is-browser';\nimport { KeyTypeDetector } from '../utils/key-type-detector';\nimport { buildMessageTx } from '../common/tx/tx-utils';\n\ninterface WalletExecuteResult {\n result?: TransactionReceipt;\n transactionId?: string;\n error?: string;\n}\n\ninterface WalletExecuteSupport<Tx> {\n executeTransactionWithErrorHandling?: (\n tx: Tx,\n returnBytes?: boolean,\n ) => Promise<WalletExecuteResult>;\n}\n\n/**\n * Browser client configuration for HCS-2\n */\nexport interface BrowserHCS2Config extends HCS2ClientConfig {\n hwc: HashinalsWalletConnectSDK;\n}\n\n/**\n * Browser client for HCS-2 operations\n */\nexport class BrowserHCS2Client extends HCS2BaseClient {\n private hwc: HashinalsWalletConnectSDK;\n\n /**\n * Create a new browser HCS-2 client\n * @param config Client configuration\n */\n constructor(config: BrowserHCS2Config) {\n super({\n network: config.network,\n logLevel: config.logLevel,\n silent: config.silent,\n mirrorNodeUrl: config.mirrorNodeUrl,\n logger: config.logger,\n });\n\n this.hwc = config.hwc;\n\n if (!isBrowser) {\n this.logger.error(\n 'BrowserHCS2Client initialized in server environment - browser-specific features will not be available. Use HCS2Client instead.',\n );\n } else {\n this.logger.info('HCS-2 browser client initialized successfully');\n }\n }\n\n /**\n * Get the operator account ID\n * @returns The operator account ID\n */\n private getOperatorId(): string {\n const accountInfo = this.hwc.getAccountInfo();\n if (!accountInfo || !accountInfo.accountId) {\n throw new Error('No connected account found');\n }\n return accountInfo.accountId;\n }\n\n /**\n * Create a new registry topic\n * @param options Registry creation options\n * @returns Promise resolving to the transaction result\n */\n async createRegistry(\n options: CreateRegistryOptions = {},\n ): Promise<TopicRegistrationResponse> {\n try {\n const registryType = options.registryType ?? HCS2RegistryType.INDEXED;\n const ttl = options.ttl ?? 86400; // Default TTL: 24 hours\n\n const memo = this.generateRegistryMemo(registryType, ttl);\n\n let transaction = new TopicCreateTransaction().setTopicMemo(memo);\n\n if (options.adminKey) {\n let adminPublicKey: PublicKey;\n if (typeof options.adminKey === 'string') {\n try {\n adminPublicKey = PublicKey.fromString(options.adminKey);\n } catch {\n const keyInfo = KeyTypeDetector.detect(options.adminKey);\n if (keyInfo.rawBytes) {\n adminPublicKey =\n keyInfo.type === 'ed25519'\n ? PublicKey.fromBytesED25519(keyInfo.rawBytes)\n : PublicKey.fromBytesECDSA(keyInfo.rawBytes);\n } else {\n throw new Error('Failed to parse admin public key');\n }\n }\n } else if (typeof options.adminKey === 'boolean') {\n adminPublicKey = await this.mirrorNode.getPublicKey(\n this.getOperatorId(),\n );\n } else {\n adminPublicKey = options.adminKey.publicKey;\n }\n transaction = transaction.setAdminKey(adminPublicKey);\n }\n\n if (options.submitKey) {\n let submitPublicKey: PublicKey;\n if (typeof options.submitKey === 'string') {\n try {\n submitPublicKey = PublicKey.fromString(options.submitKey);\n } catch {\n const keyInfo = KeyTypeDetector.detect(options.submitKey);\n if (keyInfo.rawBytes) {\n submitPublicKey =\n keyInfo.type === 'ed25519'\n ? PublicKey.fromBytesED25519(keyInfo.rawBytes)\n : PublicKey.fromBytesECDSA(keyInfo.rawBytes);\n } else {\n throw new Error('Failed to parse submit public key');\n }\n }\n } else if (typeof options.submitKey === 'boolean') {\n submitPublicKey = await this.mirrorNode.getPublicKey(\n this.getOperatorId(),\n );\n } else {\n submitPublicKey = options.submitKey.publicKey;\n }\n transaction = transaction.setSubmitKey(submitPublicKey);\n }\n\n const txResponse = await this.executeWithWallet(transaction);\n\n if (txResponse?.error) {\n throw new Error(txResponse.error);\n }\n\n const resultReceipt = txResponse?.result;\n if (!resultReceipt?.topicId) {\n throw new Error('Failed to create registry: No topic ID in receipt');\n }\n\n const topicId = resultReceipt.topicId.toString();\n\n this.logger.info(\n `Created registry topic: ${topicId} (${registryType === HCS2RegistryType.INDEXED ? 'Indexed' : 'Non-indexed'}, TTL: ${ttl}s)`,\n );\n\n return {\n success: true,\n topicId,\n transactionId: txResponse.transactionId || 'unknown',\n };\n } catch (error) {\n this.logger.error(`Failed to create registry: ${error}`);\n return {\n success: false,\n error: `Failed to create registry: ${error}`,\n };\n }\n }\n\n /**\n * Register a new entry in the registry\n * @param registryTopicId The topic ID of the registry\n * @param options Registration options\n * @returns Promise resolving to the operation result\n */\n async registerEntry(\n registryTopicId: string,\n options: RegisterEntryOptions,\n ): Promise<RegistryOperationResponse> {\n try {\n const message = this.createRegisterMessage(\n options.targetTopicId,\n options.metadata,\n options.memo,\n );\n\n if (message.op !== HCS2Operation.REGISTER) {\n throw new Error(\n `Invalid operation type: ${message.op}, expected ${HCS2Operation.REGISTER}`,\n );\n }\n\n const receipt = await this.submitMessage(registryTopicId, message);\n\n this.logger.info(\n `Registered entry in registry ${registryTopicId} pointing to topic ${options.targetTopicId}`,\n );\n\n return {\n success: true,\n receipt,\n sequenceNumber: receipt.topicSequenceNumber?.low ?? undefined,\n };\n } catch (error) {\n this.logger.error(`Failed to register entry: ${error}`);\n return {\n success: false,\n error: `Failed to register entry: ${error}`,\n };\n }\n }\n\n /**\n * Update an existing entry in the registry (indexed registries only)\n * @param registryTopicId The topic ID of the registry\n * @param options Update options\n * @returns Promise resolving to the operation result\n */\n async updateEntry(\n registryTopicId: string,\n options: UpdateEntryOptions,\n ): Promise<RegistryOperationResponse> {\n try {\n const registryInfo = await this.mirrorNode.getTopicInfo(registryTopicId);\n const memoInfo = this.parseRegistryTypeFromMemo(registryInfo.memo);\n\n if (!memoInfo || memoInfo.registryType !== HCS2RegistryType.INDEXED) {\n throw new Error(\n 'Update operation is only valid for indexed registries',\n );\n }\n\n const message = this.createUpdateMessage(\n options.targetTopicId,\n options.uid,\n options.metadata,\n options.memo,\n );\n\n const receipt = await this.submitMessage(registryTopicId, message);\n\n this.logger.info(\n `Updated entry with UID ${options.uid} in registry ${registryTopicId}`,\n );\n\n return {\n success: true,\n receipt,\n sequenceNumber: receipt.topicSequenceNumber?.low ?? undefined,\n };\n } catch (error) {\n this.logger.error(`Failed to update entry: ${error}`);\n return {\n success: false,\n error: `Failed to update entry: ${error}`,\n };\n }\n }\n\n /**\n * Delete an entry from the registry (indexed registries only)\n * @param registryTopicId The topic ID of the registry\n * @param options Delete options\n * @returns Promise resolving to the operation result\n */\n async deleteEntry(\n registryTopicId: string,\n options: DeleteEntryOptions,\n ): Promise<RegistryOperationResponse> {\n try {\n const registryInfo = await this.mirrorNode.getTopicInfo(registryTopicId);\n const memoInfo = this.parseRegistryTypeFromMemo(registryInfo.memo);\n\n if (!memoInfo || memoInfo.registryType !== HCS2RegistryType.INDEXED) {\n throw new Error(\n 'Delete operation is only valid for indexed registries',\n );\n }\n\n const message = this.createDeleteMessage(options.uid, options.memo);\n\n const receipt = await this.submitMessage(registryTopicId, message);\n\n this.logger.info(\n `Deleted entry with UID ${options.uid} from registry ${registryTopicId}`,\n );\n\n return {\n success: true,\n receipt,\n sequenceNumber: receipt.topicSequenceNumber?.low ?? undefined,\n };\n } catch (error) {\n this.logger.error(`Failed to delete entry: ${error}`);\n return {\n success: false,\n error: `Failed to delete entry: ${error}`,\n };\n }\n }\n\n /**\n * Migrate a registry to a new topic\n * @param registryTopicId The topic ID of the registry\n * @param options Migration options\n * @returns Promise resolving to the operation result\n */\n async migrateRegistry(\n registryTopicId: string,\n options: MigrateTopicOptions,\n ): Promise<RegistryOperationResponse> {\n try {\n const message = this.createMigrateMessage(\n options.targetTopicId,\n options.metadata,\n options.memo,\n );\n\n const receipt = await this.submitMessage(registryTopicId, message);\n\n this.logger.info(\n `Migrated registry ${registryTopicId} to ${options.targetTopicId}`,\n );\n\n return {\n success: true,\n receipt,\n sequenceNumber: receipt.topicSequenceNumber?.low ?? undefined,\n };\n } catch (error) {\n this.logger.error(`Failed to migrate registry: ${error}`);\n return {\n success: false,\n error: `Failed to migrate registry: ${error}`,\n };\n }\n }\n\n /**\n * Get all entries from a registry\n * @param topicId The topic ID of the registry\n * @param options Query options\n * @returns Promise resolving to the registry information\n */\n async getRegistry(\n topicId: string,\n options: QueryRegistryOptions = {},\n ): Promise<TopicRegistry> {\n try {\n const topicInfo = await this.mirrorNode.getTopicInfo(topicId);\n const memoInfo = this.parseRegistryTypeFromMemo(topicInfo.memo);\n\n if (!memoInfo) {\n throw new Error(\n `Topic ${topicId} is not an HCS-2 registry (invalid memo format)`,\n );\n }\n\n const messagesResult = await this.mirrorNode.getTopicMessages(topicId, {\n sequenceNumber:\n options.skip && options.skip > 0 ? `gt:${options.skip}` : undefined,\n limit: options.limit ?? 100,\n order: options.order ?? 'asc',\n });\n\n const messages = options.limit\n ? messagesResult.slice(0, options.limit)\n : messagesResult;\n\n return this.parseRegistryEntries(\n topicId,\n messages,\n memoInfo.registryType,\n memoInfo.ttl,\n );\n } catch (error) {\n this.logger.error(`Failed to get registry: ${error}`);\n throw error;\n }\n }\n\n /**\n * Submit a message to a topic\n * @param topicId The topic ID to submit to\n * @param payload The message payload\n * @returns Promise resolving to the transaction receipt\n */\n async submitMessage(\n topicId: string,\n payload: HCS2Message,\n ): Promise<TransactionReceipt> {\n try {\n const { valid, errors } = this.validateMessage(payload);\n if (!valid) {\n throw new Error(`Invalid HCS-2 message: ${errors.join(', ')}`);\n }\n\n const transaction = buildMessageTx({\n topicId,\n message: JSON.stringify(payload),\n });\n\n const txResponse = await this.executeWithWallet(transaction);\n\n if (txResponse?.error) {\n throw new Error(txResponse.error);\n }\n\n return txResponse.result;\n } catch (error) {\n this.logger.error(`Failed to submit message: ${error}`);\n throw error;\n }\n }\n private async executeWithWallet<\n T extends TopicCreateTransaction | TopicMessageSubmitTransaction,\n >(transaction: T): Promise<WalletExecuteResult> {\n const maybeExec = (\n this.hwc as unknown as WalletExecuteSupport<\n TopicCreateTransaction | TopicMessageSubmitTransaction\n >\n ).executeTransactionWithErrorHandling;\n\n if (!maybeExec) {\n throw new Error(\n 'Wallet SDK does not support executeTransactionWithErrorHandling',\n );\n }\n\n return await maybeExec.call(this.hwc, transaction, false);\n }\n}\n"],"names":[],"mappings":";;;;;;AAmDO,MAAM,0BAA0B,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA,EAOpD,YAAY,QAA2B;AACrC,UAAM;AAAA,MACJ,SAAS,OAAO;AAAA,MAChB,UAAU,OAAO;AAAA,MACjB,QAAQ,OAAO;AAAA,MACf,eAAe,OAAO;AAAA,MACtB,QAAQ,OAAO;AAAA,IAAA,CAChB;AAED,SAAK,MAAM,OAAO;AAElB,QAAI,CAAC,WAAW;AACd,WAAK,OAAO;AAAA,QACV;AAAA,MAAA;AAAA,IAEJ,OAAO;AACL,WAAK,OAAO,KAAK,+CAA+C;AAAA,IAClE;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMQ,gBAAwB;AAC9B,UAAM,cAAc,KAAK,IAAI,eAAA;AAC7B,QAAI,CAAC,eAAe,CAAC,YAAY,WAAW;AAC1C,YAAM,IAAI,MAAM,4BAA4B;AAAA,IAC9C;AACA,WAAO,YAAY;AAAA,EACrB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,eACJ,UAAiC,IACG;AACpC,QAAI;AACF,YAAM,eAAe,QAAQ,gBA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MAAM,UAAU,KAAK,KAAK,KAAK,aAAa,KAAK;AAAA,EAC1D;AACF;"}
|
|
1
|
+
{"version":3,"file":"standards-sdk.es75.js","sources":["../../src/hcs-2/client.ts"],"sourcesContent":["import {\n Client,\n TopicCreateTransaction,\n TopicMessageSubmitTransaction,\n PrivateKey,\n TopicId,\n TransactionReceipt,\n AccountId,\n PublicKey,\n} from '@hashgraph/sdk';\nimport { HCS2BaseClient } from './base-client';\nimport {\n HCS2ClientConfig,\n HCS2Message,\n HCS2Operation,\n HCS2RegistryType,\n TopicRegistrationResponse,\n RegistryOperationResponse,\n TopicRegistry,\n CreateRegistryOptions,\n RegisterEntryOptions,\n UpdateEntryOptions,\n DeleteEntryOptions,\n MigrateTopicOptions,\n QueryRegistryOptions,\n RegistryEntry,\n} from './types';\nimport { NetworkType } from '../utils/types';\nimport {\n NodeOperatorResolver,\n createNodeOperatorContext,\n type NodeOperatorContext,\n} from '../common/node-operator-resolver';\nimport { buildMessageTx } from '../common/tx/tx-utils';\nimport { buildHcs2CreateRegistryTx } from './tx';\n\n/**\n * SDK client configuration for HCS-2\n */\nexport interface SDKHCS2ClientConfig extends HCS2ClientConfig {\n operatorId: string | AccountId;\n operatorKey: string | PrivateKey;\n keyType?: 'ed25519' | 'ecdsa';\n}\n\n/**\n * SDK client for HCS-2 operations\n */\nexport class HCS2Client extends HCS2BaseClient {\n private static readonly operationAnalyticsCode: Record<\n HCS2Operation,\n number\n > = {\n [HCS2Operation.REGISTER]: 0,\n [HCS2Operation.UPDATE]: 1,\n [HCS2Operation.DELETE]: 2,\n [HCS2Operation.MIGRATE]: 3,\n };\n\n private client: Client;\n private operatorId: AccountId;\n private operatorCtx: NodeOperatorContext;\n private readonly registryTypeCache = new Map<string, HCS2RegistryType>();\n\n /**\n * Create a new HCS-2 client\n * @param config Client configuration\n */\n constructor(config: SDKHCS2ClientConfig) {\n super({\n network: config.network,\n logLevel: config.logLevel,\n silent: config.silent,\n mirrorNodeUrl: config.mirrorNodeUrl,\n logger: config.logger,\n });\n\n this.operatorId =\n typeof config.operatorId === 'string'\n ? AccountId.fromString(config.operatorId)\n : config.operatorId;\n\n this.operatorCtx = createNodeOperatorContext({\n network: this.network,\n operatorId: this.operatorId,\n operatorKey: config.operatorKey,\n keyType: config.keyType,\n mirrorNode: this.mirrorNode,\n logger: this.logger,\n client: this.createClient(config.network),\n });\n this.client = this.operatorCtx.client;\n }\n\n /**\n * Initialize the Hedera client with operator information\n */\n private async ensureInitialized(): Promise<void> {\n await this.operatorCtx.ensureInitialized();\n }\n\n /**\n * Create a Hedera client for the specified network\n * @param network The network to connect to\n * @returns The Hedera client\n */\n private createClient(network: NetworkType): Client {\n if (network === 'mainnet') {\n return Client.forMainnet();\n } else {\n return Client.forTestnet();\n }\n }\n\n /**\n * Create a new registry topic\n * @param options Registry creation options\n * @returns Promise resolving to the transaction result\n */\n async createRegistry(\n options: CreateRegistryOptions = {},\n ): Promise<TopicRegistrationResponse> {\n try {\n await this.ensureInitialized();\n const registryType = options.registryType ?? HCS2RegistryType.INDEXED;\n const ttl = options.ttl ?? 86400; // Default TTL: 24 hours\n\n const memo = this.generateRegistryMemo(registryType, ttl);\n\n let adminKeyPrivate: PrivateKey | undefined;\n let adminPublicKey: PublicKey | undefined;\n if (options.adminKey) {\n if (typeof options.adminKey === 'string') {\n try {\n adminPublicKey = PublicKey.fromString(options.adminKey);\n } catch {\n const keyBytes = Buffer.from(\n options.adminKey.replace(/^0x/i, ''),\n 'hex',\n );\n adminPublicKey =\n this.operatorCtx.keyType === 'ed25519'\n ? PublicKey.fromBytesED25519(keyBytes)\n : PublicKey.fromBytesECDSA(keyBytes);\n }\n } else if (typeof options.adminKey === 'boolean') {\n adminPublicKey = this.operatorCtx.operatorKey.publicKey;\n } else {\n adminPublicKey = options.adminKey.publicKey;\n adminKeyPrivate = options.adminKey;\n }\n }\n\n let submitKeyPrivate: PrivateKey | undefined;\n let submitPublicKey: PublicKey | undefined;\n if (options.submitKey) {\n if (typeof options.submitKey === 'string') {\n try {\n submitPublicKey = PublicKey.fromString(options.submitKey);\n } catch {\n const keyBytes = Buffer.from(\n options.submitKey.replace(/^0x/i, ''),\n 'hex',\n );\n submitPublicKey =\n this.operatorCtx.keyType === 'ed25519'\n ? PublicKey.fromBytesED25519(keyBytes)\n : PublicKey.fromBytesECDSA(keyBytes);\n }\n } else if (typeof options.submitKey === 'boolean') {\n submitPublicKey = this.operatorCtx.operatorKey.publicKey;\n } else {\n submitPublicKey = options.submitKey.publicKey;\n submitKeyPrivate = options.submitKey;\n }\n }\n\n const transaction = buildHcs2CreateRegistryTx({\n registryType,\n ttl,\n adminKey: adminPublicKey,\n submitKey: submitPublicKey,\n operatorPublicKey: this.operatorCtx.operatorKey.publicKey,\n });\n\n const frozenTx = await transaction.freezeWith(this.client);\n\n if (adminKeyPrivate) {\n await frozenTx.sign(adminKeyPrivate);\n }\n\n if (submitKeyPrivate) {\n await frozenTx.sign(submitKeyPrivate);\n }\n\n const txResponse = await frozenTx.execute(this.client);\n\n const receipt = await txResponse.getReceipt(this.client);\n const topicId = receipt.topicId;\n\n if (!topicId) {\n throw new Error('Failed to create registry: No topic ID in receipt');\n }\n\n const topicIdStr = topicId.toString();\n this.registryTypeCache.set(topicIdStr, registryType);\n\n this.logger.info(\n `Created registry topic: ${topicIdStr} (${registryType === HCS2RegistryType.INDEXED ? 'Indexed' : 'Non-indexed'}, TTL: ${ttl}s)`,\n );\n\n return {\n success: true,\n topicId: topicIdStr,\n transactionId: txResponse.transactionId.toString(),\n };\n } catch (error) {\n this.logger.error(`Failed to create registry: ${error}`);\n return {\n success: false,\n error: `Failed to create registry: ${error}`,\n };\n }\n }\n\n /**\n * Register a new entry in the registry\n * @param registryTopicId The topic ID of the registry\n * @param options Registration options\n * @param protocol Optional protocol version (defaults to 'hcs-2')\n * @returns Promise resolving to the operation result\n */\n async registerEntry(\n registryTopicId: string,\n options: RegisterEntryOptions,\n protocol: string = 'hcs-2',\n ): Promise<RegistryOperationResponse> {\n try {\n await this.ensureInitialized();\n const message = this.createRegisterMessage(\n options.targetTopicId,\n options.metadata,\n options.memo,\n protocol,\n );\n\n const registryType =\n options.registryType ??\n (await this.resolveRegistryType(registryTopicId));\n this.registryTypeCache.set(registryTopicId, registryType);\n const analyticsMemo =\n options.analyticsMemo ??\n this.buildAnalyticsMemo(HCS2Operation.REGISTER, registryType);\n\n const receipt = await this.submitMessage(\n registryTopicId,\n message,\n analyticsMemo,\n );\n\n this.logger.info(\n `Registered entry in registry ${registryTopicId} pointing to topic ${options.targetTopicId} using protocol ${protocol}`,\n );\n\n return {\n success: true,\n receipt,\n sequenceNumber: receipt.topicSequenceNumber?.low ?? undefined,\n };\n } catch (error) {\n this.logger.error(`Failed to register entry: ${error}`);\n return {\n success: false,\n error: `Failed to register entry: ${error}`,\n };\n }\n }\n\n /**\n * Update an existing entry in the registry (indexed registries only)\n * @param registryTopicId The topic ID of the registry\n * @param options Update options\n * @returns Promise resolving to the operation result\n */\n async updateEntry(\n registryTopicId: string,\n options: UpdateEntryOptions,\n ): Promise<RegistryOperationResponse> {\n try {\n await this.ensureInitialized();\n const registryInfo = await this.mirrorNode.getTopicInfo(registryTopicId);\n const memoInfo = this.parseRegistryTypeFromMemo(registryInfo.memo);\n\n if (!memoInfo || memoInfo.registryType !== HCS2RegistryType.INDEXED) {\n throw new Error(\n 'Update operation is only valid for indexed registries',\n );\n }\n\n const message = this.createUpdateMessage(\n options.targetTopicId,\n options.uid,\n options.metadata,\n options.memo,\n );\n\n const registryType =\n options.registryType ??\n (await this.resolveRegistryType(registryTopicId));\n this.registryTypeCache.set(registryTopicId, registryType);\n const analyticsMemo =\n options.analyticsMemo ??\n this.buildAnalyticsMemo(HCS2Operation.UPDATE, registryType);\n\n const receipt = await this.submitMessage(\n registryTopicId,\n message,\n analyticsMemo,\n );\n\n this.logger.info(\n `Updated entry with UID ${options.uid} in registry ${registryTopicId}`,\n );\n\n return {\n success: true,\n receipt,\n sequenceNumber: receipt.topicSequenceNumber?.low ?? undefined,\n };\n } catch (error) {\n this.logger.error(`Failed to update entry: ${error}`);\n throw error;\n }\n }\n\n /**\n * Delete an entry from the registry (indexed registries only)\n * @param registryTopicId The topic ID of the registry\n * @param options Delete options\n * @returns Promise resolving to the operation result\n */\n async deleteEntry(\n registryTopicId: string,\n options: DeleteEntryOptions,\n ): Promise<RegistryOperationResponse> {\n try {\n await this.ensureInitialized();\n const registryInfo = await this.mirrorNode.getTopicInfo(registryTopicId);\n const memoInfo = this.parseRegistryTypeFromMemo(registryInfo.memo);\n\n if (!memoInfo || memoInfo.registryType !== HCS2RegistryType.INDEXED) {\n throw new Error(\n 'Delete operation is only valid for indexed registries',\n );\n }\n\n const message = this.createDeleteMessage(options.uid, options.memo);\n\n const registryType =\n options.registryType ??\n (await this.resolveRegistryType(registryTopicId));\n this.registryTypeCache.set(registryTopicId, registryType);\n const analyticsMemo =\n options.analyticsMemo ??\n this.buildAnalyticsMemo(HCS2Operation.DELETE, registryType);\n\n const receipt = await this.submitMessage(\n registryTopicId,\n message,\n analyticsMemo,\n );\n\n this.logger.info(\n `Deleted entry with UID ${options.uid} from registry ${registryTopicId}`,\n );\n\n return {\n success: true,\n receipt,\n sequenceNumber: receipt.topicSequenceNumber?.low ?? undefined,\n };\n } catch (error) {\n this.logger.error(`Failed to delete entry: ${error}`);\n throw error;\n }\n }\n\n /**\n * Migrate a registry to a new topic\n * @param registryTopicId The topic ID of the registry\n * @param options Migration options\n * @returns Promise resolving to the operation result\n */\n async migrateRegistry(\n registryTopicId: string,\n options: MigrateTopicOptions,\n ): Promise<RegistryOperationResponse> {\n try {\n await this.ensureInitialized();\n const message = this.createMigrateMessage(\n options.targetTopicId,\n options.metadata,\n options.memo,\n );\n\n const registryType =\n options.registryType ??\n (await this.resolveRegistryType(registryTopicId));\n this.registryTypeCache.set(registryTopicId, registryType);\n const analyticsMemo =\n options.analyticsMemo ??\n this.buildAnalyticsMemo(HCS2Operation.MIGRATE, registryType);\n\n const receipt = await this.submitMessage(\n registryTopicId,\n message,\n analyticsMemo,\n );\n\n this.logger.info(\n `Migrated registry ${registryTopicId} to ${options.targetTopicId}`,\n );\n\n return {\n success: true,\n receipt,\n sequenceNumber: receipt.topicSequenceNumber?.low ?? undefined,\n };\n } catch (error) {\n this.logger.error(`Failed to migrate registry: ${error}`);\n throw error;\n }\n }\n\n /**\n * Get all entries from a registry\n * @param topicId The topic ID of the registry\n * @param options Query options\n * @returns Promise resolving to the registry information\n */\n async getRegistry(\n topicId: string,\n options: QueryRegistryOptions = {},\n ): Promise<TopicRegistry> {\n try {\n await this.ensureInitialized();\n const topicInfo = await this.mirrorNode.getTopicInfo(topicId);\n this.logger.debug(\n `Retrieved topic info for ${topicId}: ${JSON.stringify(topicInfo)}`,\n );\n\n const memoInfo = this.parseRegistryTypeFromMemo(topicInfo.memo);\n\n if (!memoInfo) {\n throw new Error(\n `Topic ${topicId} is not an HCS-2 registry (invalid memo format)`,\n );\n }\n\n this.logger.debug(\n `Retrieving messages for topic ${topicId} with limit ${options.limit ?? 100}`,\n );\n const rawMessagesResult = (await this.mirrorNode.getTopicMessages(\n topicId,\n {\n sequenceNumber:\n options.skip && options.skip > 0 ? `gt:${options.skip}` : undefined,\n limit: options.limit ?? 100,\n order: options.order ?? 'asc',\n },\n )) as any[];\n\n const rawMessages = options.limit\n ? rawMessagesResult.slice(0, options.limit)\n : rawMessagesResult;\n\n this.logger.debug(\n `Retrieved ${rawMessagesResult.length} messages, using ${rawMessages.length} after applying limit.`,\n );\n\n const entries: RegistryEntry[] = [];\n let latestEntry: RegistryEntry | undefined;\n\n for (const msg of rawMessages) {\n try {\n const message: HCS2Message = {\n p: 'hcs-2',\n op: msg.op,\n t_id: msg.t_id,\n uid: msg.uid,\n metadata: msg.metadata,\n m: msg.m,\n } as HCS2Message;\n\n const { valid, errors } = this.validateMessage(message);\n if (!valid) {\n this.logger.warn(`Invalid HCS-2 message: ${errors.join(', ')}`);\n continue;\n }\n\n const entry: RegistryEntry = {\n topicId,\n sequence: msg.sequence_number,\n timestamp: msg.consensus_timestamp,\n payer: msg.payer_account_id || msg.payer || '',\n message,\n consensus_timestamp: msg.consensus_timestamp,\n registry_type: memoInfo.registryType,\n };\n\n entries.push(entry);\n\n if (\n memoInfo.registryType === HCS2RegistryType.NON_INDEXED ||\n !latestEntry ||\n entry.timestamp > latestEntry.timestamp\n ) {\n latestEntry = entry;\n }\n } catch (error) {\n this.logger.warn(`Error processing message: ${error}`);\n }\n }\n\n this.logger.debug(\n `Processed ${entries.length} valid entries for registry ${topicId}`,\n );\n\n const registry: TopicRegistry = {\n topicId,\n registryType: memoInfo.registryType,\n ttl: memoInfo.ttl,\n entries:\n memoInfo.registryType === HCS2RegistryType.INDEXED\n ? entries\n : latestEntry\n ? [latestEntry]\n : [],\n latestEntry,\n };\n\n return registry;\n } catch (error) {\n this.logger.error(`Failed to get registry: ${error}`);\n throw error;\n }\n }\n\n private buildAnalyticsMemo(\n operation: HCS2Operation,\n registryType: HCS2RegistryType,\n ): string {\n const opCode = HCS2Client.operationAnalyticsCode[operation];\n return `hcs-2:op:${opCode}:${registryType}`;\n }\n\n private async resolveRegistryType(\n topicId: string,\n ): Promise<HCS2RegistryType> {\n const cached = this.registryTypeCache.get(topicId);\n if (cached !== undefined) {\n return cached;\n }\n\n const topicInfo = await this.mirrorNode.getTopicInfo(topicId);\n const memoInfo = this.parseRegistryTypeFromMemo(topicInfo.memo);\n if (!memoInfo) {\n throw new Error(\n `Topic ${topicId} is not an HCS-2 registry (invalid memo format)`,\n );\n }\n\n this.registryTypeCache.set(topicId, memoInfo.registryType);\n return memoInfo.registryType;\n }\n\n /**\n * Submit a message to a topic\n * @param topicId The topic ID to submit to\n * @param payload The message payload\n * @returns Promise resolving to the transaction receipt\n */\n async submitMessage(\n topicId: string,\n payload: HCS2Message,\n analyticsMemo?: string,\n ): Promise<TransactionReceipt> {\n try {\n await this.ensureInitialized();\n const { valid, errors } = this.validateMessage(payload);\n if (!valid) {\n throw new Error(`Invalid HCS-2 message: ${errors.join(', ')}`);\n }\n\n const transaction = buildMessageTx({\n topicId,\n message: JSON.stringify(payload),\n transactionMemo: analyticsMemo,\n });\n\n const txResponse = await transaction.execute(this.client);\n\n const receipt = await txResponse.getReceipt(this.client);\n\n return receipt;\n } catch (error) {\n this.logger.error(`Failed to submit message: ${error}`);\n throw error;\n }\n }\n\n /**\n * @param topicId The topic ID to query\n * @returns Promise resolving to the topic information\n */\n public async getTopicInfo(topicId: string): Promise<any> {\n return this.mirrorNode.getTopicInfo(topicId);\n }\n\n /**\n * Close the client and release resources\n */\n public close(): void {\n this.logger.info('HCS-2 client closed.');\n }\n\n /**\n * Get the configured key type (ed25519 or ecdsa)\n */\n public getKeyType(): 'ed25519' | 'ecdsa' {\n return this.operatorCtx.keyType;\n }\n\n /**\n * Get the configured operator private key\n */\n public getOperatorKey(): PrivateKey {\n return this.operatorCtx.operatorKey;\n }\n}\n"],"names":[],"mappings":";;;;;;AAgDO,MAAM,cAAN,MAAM,oBAAmB,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA,EAoB7C,YAAY,QAA6B;AACvC,UAAM;AAAA,MACJ,SAAS,OAAO;AAAA,MAChB,UAAU,OAAO;AAAA,MACjB,QAAQ,OAAO;AAAA,MACf,eAAe,OAAO;AAAA,MACtB,QAAQ,OAAO;AAAA,IAAA,CAChB;AAbH,SAAiB,wCAAwB,IAAA;AAevC,SAAK,aACH,OAAO,OAAO,eAAe,WACzB,UAAU,WAAW,OAAO,UAAU,IACtC,OAAO;AAEb,SAAK,cAAc,0BAA0B;AAAA,MAC3C,SAAS,KAAK;AAAA,MACd,YAAY,KAAK;AAAA,MACjB,aAAa,OAAO;AAAA,MACpB,SAAS,OAAO;AAAA,MAChB,YAAY,KAAK;AAAA,MACjB,QAAQ,KAAK;AAAA,MACb,QAAQ,KAAK,aAAa,OAAO,OAAO;AAAA,IAAA,CACzC;AACD,SAAK,SAAS,KAAK,YAAY;AAAA,EACjC;AAAA;AAAA;AAAA;AAAA,EAKA,MAAc,o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