@hashgraphonline/standards-sdk 0.1.144 → 0.1.145
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-10/base-client.d.ts.map +1 -1
- package/dist/cjs/hcs-10/sdk.d.ts +8 -0
- package/dist/cjs/hcs-10/sdk.d.ts.map +1 -1
- package/dist/cjs/hcs-11/client.d.ts +2 -2
- package/dist/cjs/hcs-11/client.d.ts.map +1 -1
- package/dist/cjs/hcs-11/person-builder.d.ts +1 -0
- package/dist/cjs/hcs-11/person-builder.d.ts.map +1 -1
- package/dist/cjs/hcs-11/types.d.ts +1 -0
- package/dist/cjs/hcs-11/types.d.ts.map +1 -1
- package/dist/cjs/hcs-12/rendering/resource-manager.d.ts.map +1 -1
- package/dist/cjs/hcs-14/issuers/hiero.d.ts.map +1 -1
- package/dist/cjs/hcs-15/browser.d.ts +2 -0
- package/dist/cjs/hcs-15/browser.d.ts.map +1 -1
- package/dist/cjs/hcs-15/sdk.d.ts +7 -1
- package/dist/cjs/hcs-15/sdk.d.ts.map +1 -1
- package/dist/cjs/hcs-15/tx.d.ts +4 -0
- package/dist/cjs/hcs-15/tx.d.ts.map +1 -1
- package/dist/cjs/hcs-15/types.d.ts +16 -1
- package/dist/cjs/hcs-15/types.d.ts.map +1 -1
- package/dist/cjs/hcs-16/browser.d.ts +11 -2
- package/dist/cjs/hcs-16/browser.d.ts.map +1 -1
- package/dist/cjs/hcs-16/sdk.d.ts +62 -1
- package/dist/cjs/hcs-16/sdk.d.ts.map +1 -1
- package/dist/cjs/hcs-16/tx.d.ts +21 -3
- package/dist/cjs/hcs-16/tx.d.ts.map +1 -1
- package/dist/cjs/hcs-17/base-client.d.ts +1 -0
- package/dist/cjs/hcs-17/base-client.d.ts.map +1 -1
- package/dist/cjs/hcs-17/sdk.d.ts.map +1 -1
- package/dist/cjs/hcs-17/tx.d.ts +2 -0
- package/dist/cjs/hcs-17/tx.d.ts.map +1 -1
- package/dist/cjs/hcs-17/types.d.ts +4 -0
- package/dist/cjs/hcs-17/types.d.ts.map +1 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client/base-client.d.ts +14 -1
- package/dist/cjs/services/registry-broker/client/base-client.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client/feedback.d.ts +2 -0
- package/dist/cjs/services/registry-broker/client/feedback.d.ts.map +1 -0
- package/dist/cjs/services/registry-broker/private-key-signer.d.ts +1 -0
- package/dist/cjs/services/registry-broker/private-key-signer.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/schemas.d.ts +998 -577
- package/dist/cjs/services/registry-broker/schemas.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/types.d.ts +20 -1
- package/dist/cjs/services/registry-broker/types.d.ts.map +1 -1
- package/dist/cjs/standards-sdk.cjs +2 -2
- package/dist/cjs/standards-sdk.cjs.map +1 -1
- package/dist/cjs/utils/crypto-abstraction.d.ts.map +1 -1
- package/dist/cjs/utils/crypto-env.d.ts.map +1 -1
- package/dist/cjs/utils/dynamic-import.d.ts +5 -1
- package/dist/cjs/utils/dynamic-import.d.ts.map +1 -1
- package/dist/cjs/utils/hash-adapter.d.ts.map +1 -1
- package/dist/es/hcs-10/base-client.d.ts.map +1 -1
- package/dist/es/hcs-10/sdk.d.ts +8 -0
- package/dist/es/hcs-10/sdk.d.ts.map +1 -1
- package/dist/es/hcs-11/client.d.ts +2 -2
- package/dist/es/hcs-11/client.d.ts.map +1 -1
- package/dist/es/hcs-11/person-builder.d.ts +1 -0
- package/dist/es/hcs-11/person-builder.d.ts.map +1 -1
- package/dist/es/hcs-11/types.d.ts +1 -0
- package/dist/es/hcs-11/types.d.ts.map +1 -1
- package/dist/es/hcs-12/rendering/resource-manager.d.ts.map +1 -1
- package/dist/es/hcs-14/issuers/hiero.d.ts.map +1 -1
- package/dist/es/hcs-15/browser.d.ts +2 -0
- package/dist/es/hcs-15/browser.d.ts.map +1 -1
- package/dist/es/hcs-15/sdk.d.ts +7 -1
- package/dist/es/hcs-15/sdk.d.ts.map +1 -1
- package/dist/es/hcs-15/tx.d.ts +4 -0
- package/dist/es/hcs-15/tx.d.ts.map +1 -1
- package/dist/es/hcs-15/types.d.ts +16 -1
- package/dist/es/hcs-15/types.d.ts.map +1 -1
- package/dist/es/hcs-16/browser.d.ts +11 -2
- package/dist/es/hcs-16/browser.d.ts.map +1 -1
- package/dist/es/hcs-16/sdk.d.ts +62 -1
- package/dist/es/hcs-16/sdk.d.ts.map +1 -1
- package/dist/es/hcs-16/tx.d.ts +21 -3
- package/dist/es/hcs-16/tx.d.ts.map +1 -1
- package/dist/es/hcs-17/base-client.d.ts +1 -0
- package/dist/es/hcs-17/base-client.d.ts.map +1 -1
- package/dist/es/hcs-17/sdk.d.ts.map +1 -1
- package/dist/es/hcs-17/tx.d.ts +2 -0
- package/dist/es/hcs-17/tx.d.ts.map +1 -1
- package/dist/es/hcs-17/types.d.ts +4 -0
- package/dist/es/hcs-17/types.d.ts.map +1 -1
- package/dist/es/index.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client/base-client.d.ts +14 -1
- package/dist/es/services/registry-broker/client/base-client.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client/feedback.d.ts +2 -0
- package/dist/es/services/registry-broker/client/feedback.d.ts.map +1 -0
- package/dist/es/services/registry-broker/private-key-signer.d.ts +1 -0
- package/dist/es/services/registry-broker/private-key-signer.d.ts.map +1 -1
- package/dist/es/services/registry-broker/schemas.d.ts +998 -577
- package/dist/es/services/registry-broker/schemas.d.ts.map +1 -1
- package/dist/es/services/registry-broker/types.d.ts +20 -1
- package/dist/es/services/registry-broker/types.d.ts.map +1 -1
- package/dist/es/standards-sdk.es.js +141 -135
- package/dist/es/standards-sdk.es.js.map +1 -1
- package/dist/es/standards-sdk.es10.js +70 -90
- package/dist/es/standards-sdk.es10.js.map +1 -1
- package/dist/es/standards-sdk.es100.js +229 -26
- package/dist/es/standards-sdk.es100.js.map +1 -1
- package/dist/es/standards-sdk.es101.js +109 -228
- package/dist/es/standards-sdk.es101.js.map +1 -1
- package/dist/es/standards-sdk.es102.js +15 -94
- package/dist/es/standards-sdk.es102.js.map +1 -1
- package/dist/es/standards-sdk.es103.js +80 -30
- package/dist/es/standards-sdk.es103.js.map +1 -1
- package/dist/es/standards-sdk.es104.js +27 -80
- package/dist/es/standards-sdk.es104.js.map +1 -1
- package/dist/es/standards-sdk.es105.js +136 -25
- package/dist/es/standards-sdk.es105.js.map +1 -1
- package/dist/es/standards-sdk.es106.js +27 -140
- package/dist/es/standards-sdk.es106.js.map +1 -1
- package/dist/es/standards-sdk.es107.js +20 -27
- package/dist/es/standards-sdk.es107.js.map +1 -1
- package/dist/es/standards-sdk.es108.js +156 -18
- package/dist/es/standards-sdk.es108.js.map +1 -1
- package/dist/es/standards-sdk.es109.js +198 -148
- package/dist/es/standards-sdk.es109.js.map +1 -1
- package/dist/es/standards-sdk.es11.js +121 -45
- package/dist/es/standards-sdk.es11.js.map +1 -1
- package/dist/es/standards-sdk.es110.js +747 -166
- package/dist/es/standards-sdk.es110.js.map +1 -1
- package/dist/es/standards-sdk.es111.js +9 -786
- package/dist/es/standards-sdk.es111.js.map +1 -1
- package/dist/es/standards-sdk.es112.js +567 -13
- package/dist/es/standards-sdk.es112.js.map +1 -1
- package/dist/es/standards-sdk.es113.js +576 -541
- package/dist/es/standards-sdk.es113.js.map +1 -1
- package/dist/es/standards-sdk.es114.js +12 -601
- package/dist/es/standards-sdk.es114.js.map +1 -1
- package/dist/es/standards-sdk.es115.js +2 -13
- package/dist/es/standards-sdk.es115.js.map +1 -1
- package/dist/es/standards-sdk.es116.js +87 -2
- package/dist/es/standards-sdk.es116.js.map +1 -1
- package/dist/es/standards-sdk.es117.js +37 -80
- package/dist/es/standards-sdk.es117.js.map +1 -1
- package/dist/es/standards-sdk.es118.js +2 -39
- package/dist/es/standards-sdk.es118.js.map +1 -1
- package/dist/es/standards-sdk.es119.js +231 -2
- package/dist/es/standards-sdk.es119.js.map +1 -1
- package/dist/es/standards-sdk.es12.js +60 -159
- package/dist/es/standards-sdk.es12.js.map +1 -1
- package/dist/es/standards-sdk.es120.js +1110 -193
- package/dist/es/standards-sdk.es120.js.map +1 -1
- package/dist/es/standards-sdk.es121.js +225 -1059
- package/dist/es/standards-sdk.es121.js.map +1 -1
- package/dist/es/standards-sdk.es122.js +419 -303
- package/dist/es/standards-sdk.es122.js.map +1 -1
- package/dist/es/standards-sdk.es123.js +351 -418
- package/dist/es/standards-sdk.es123.js.map +1 -1
- package/dist/es/standards-sdk.es124.js +872 -347
- package/dist/es/standards-sdk.es124.js.map +1 -1
- package/dist/es/standards-sdk.es125.js +182 -854
- package/dist/es/standards-sdk.es125.js.map +1 -1
- package/dist/es/standards-sdk.es126.js +1512 -153
- package/dist/es/standards-sdk.es126.js.map +1 -1
- package/dist/es/standards-sdk.es127.js +157 -1547
- package/dist/es/standards-sdk.es127.js.map +1 -1
- package/dist/es/standards-sdk.es128.js +192 -162
- package/dist/es/standards-sdk.es128.js.map +1 -1
- package/dist/es/standards-sdk.es129.js +61 -164
- package/dist/es/standards-sdk.es129.js.map +1 -1
- package/dist/es/standards-sdk.es13.js +200 -60
- package/dist/es/standards-sdk.es13.js.map +1 -1
- package/dist/es/standards-sdk.es130.js +102 -85
- package/dist/es/standards-sdk.es130.js.map +1 -1
- package/dist/es/standards-sdk.es131.js +222 -96
- package/dist/es/standards-sdk.es131.js.map +1 -1
- package/dist/es/standards-sdk.es132.js +153 -220
- package/dist/es/standards-sdk.es132.js.map +1 -1
- package/dist/es/standards-sdk.es133.js +104 -162
- package/dist/es/standards-sdk.es133.js.map +1 -1
- package/dist/es/standards-sdk.es134.js +296 -92
- package/dist/es/standards-sdk.es134.js.map +1 -1
- package/dist/es/standards-sdk.es135.js +432 -294
- package/dist/es/standards-sdk.es135.js.map +1 -1
- package/dist/es/standards-sdk.es136.js +14 -363
- package/dist/es/standards-sdk.es136.js.map +1 -1
- package/dist/es/standards-sdk.es137.js +79 -15
- package/dist/es/standards-sdk.es137.js.map +1 -1
- package/dist/es/standards-sdk.es138.js +79 -59
- package/dist/es/standards-sdk.es138.js.map +1 -1
- package/dist/es/standards-sdk.es139.js +152 -80
- package/dist/es/standards-sdk.es139.js.map +1 -1
- package/dist/es/standards-sdk.es14.js +149 -178
- package/dist/es/standards-sdk.es14.js.map +1 -1
- package/dist/es/standards-sdk.es140.js +7 -159
- package/dist/es/standards-sdk.es140.js.map +1 -1
- package/dist/es/standards-sdk.es141.js +86 -7
- package/dist/es/standards-sdk.es141.js.map +1 -1
- package/dist/es/standards-sdk.es142.js +44 -65
- package/dist/es/standards-sdk.es142.js.map +1 -1
- package/dist/es/standards-sdk.es143.js +30 -65
- package/dist/es/standards-sdk.es143.js.map +1 -1
- package/dist/es/standards-sdk.es144.js +34 -28
- package/dist/es/standards-sdk.es144.js.map +1 -1
- package/dist/es/standards-sdk.es145.js +28 -138
- package/dist/es/standards-sdk.es145.js.map +1 -1
- package/dist/es/standards-sdk.es146.js +133 -37
- package/dist/es/standards-sdk.es146.js.map +1 -1
- package/dist/es/standards-sdk.es147.js +34 -12281
- package/dist/es/standards-sdk.es147.js.map +1 -1
- package/dist/es/standards-sdk.es148.js +12284 -12
- package/dist/es/standards-sdk.es148.js.map +1 -1
- package/dist/es/standards-sdk.es149.js +958 -56
- package/dist/es/standards-sdk.es149.js.map +1 -1
- package/dist/es/standards-sdk.es15.js +152 -151
- package/dist/es/standards-sdk.es15.js.map +1 -1
- package/dist/es/standards-sdk.es150.js +48 -74
- package/dist/es/standards-sdk.es150.js.map +1 -1
- package/dist/es/standards-sdk.es151.js +72 -160
- package/dist/es/standards-sdk.es151.js.map +1 -1
- package/dist/es/standards-sdk.es152.js +13 -318
- package/dist/es/standards-sdk.es152.js.map +1 -1
- package/dist/es/standards-sdk.es153.js +120 -294
- package/dist/es/standards-sdk.es153.js.map +1 -1
- package/dist/es/standards-sdk.es154.js +191 -322
- package/dist/es/standards-sdk.es154.js.map +1 -1
- package/dist/es/standards-sdk.es155.js +294 -279
- package/dist/es/standards-sdk.es155.js.map +1 -1
- package/dist/es/standards-sdk.es156.js +440 -63
- package/dist/es/standards-sdk.es156.js.map +1 -1
- package/dist/es/standards-sdk.es157.js +331 -871
- package/dist/es/standards-sdk.es157.js.map +1 -1
- package/dist/es/standards-sdk.es158.js +68 -231
- package/dist/es/standards-sdk.es158.js.map +1 -1
- package/dist/es/standards-sdk.es159.js +218 -223
- package/dist/es/standards-sdk.es159.js.map +1 -1
- package/dist/es/standards-sdk.es16.js +917 -136
- package/dist/es/standards-sdk.es16.js.map +1 -1
- package/dist/es/standards-sdk.es160.js +247 -0
- package/dist/es/standards-sdk.es160.js.map +1 -0
- package/dist/es/standards-sdk.es17.js +23 -944
- package/dist/es/standards-sdk.es17.js.map +1 -1
- package/dist/es/standards-sdk.es18.js +2422 -24
- package/dist/es/standards-sdk.es18.js.map +1 -1
- package/dist/es/standards-sdk.es19.js +817 -2071
- package/dist/es/standards-sdk.es19.js.map +1 -1
- package/dist/es/standards-sdk.es2.js +654 -189
- package/dist/es/standards-sdk.es2.js.map +1 -1
- package/dist/es/standards-sdk.es20.js +205 -1091
- package/dist/es/standards-sdk.es20.js.map +1 -1
- package/dist/es/standards-sdk.es21.js +858 -221
- package/dist/es/standards-sdk.es21.js.map +1 -1
- package/dist/es/standards-sdk.es22.js +179 -903
- package/dist/es/standards-sdk.es22.js.map +1 -1
- package/dist/es/standards-sdk.es23.js +164 -179
- package/dist/es/standards-sdk.es23.js.map +1 -1
- package/dist/es/standards-sdk.es24.js +62 -118
- package/dist/es/standards-sdk.es24.js.map +1 -1
- package/dist/es/standards-sdk.es25.js +377 -52
- package/dist/es/standards-sdk.es25.js.map +1 -1
- package/dist/es/standards-sdk.es26.js +36 -394
- package/dist/es/standards-sdk.es26.js.map +1 -1
- package/dist/es/standards-sdk.es27.js +901 -50
- package/dist/es/standards-sdk.es27.js.map +1 -1
- package/dist/es/standards-sdk.es28.js +134 -902
- package/dist/es/standards-sdk.es28.js.map +1 -1
- package/dist/es/standards-sdk.es29.js +7 -134
- package/dist/es/standards-sdk.es29.js.map +1 -1
- package/dist/es/standards-sdk.es3.js +63 -680
- package/dist/es/standards-sdk.es3.js.map +1 -1
- package/dist/es/standards-sdk.es30.js +344 -7
- package/dist/es/standards-sdk.es30.js.map +1 -1
- package/dist/es/standards-sdk.es31.js +302 -287
- package/dist/es/standards-sdk.es31.js.map +1 -1
- package/dist/es/standards-sdk.es32.js +94 -322
- package/dist/es/standards-sdk.es32.js.map +1 -1
- package/dist/es/standards-sdk.es33.js +458 -101
- package/dist/es/standards-sdk.es33.js.map +1 -1
- package/dist/es/standards-sdk.es34.js +132 -451
- package/dist/es/standards-sdk.es34.js.map +1 -1
- package/dist/es/standards-sdk.es35.js +216 -130
- package/dist/es/standards-sdk.es35.js.map +1 -1
- package/dist/es/standards-sdk.es36.js +273 -195
- package/dist/es/standards-sdk.es36.js.map +1 -1
- package/dist/es/standards-sdk.es37.js +148 -87
- package/dist/es/standards-sdk.es37.js.map +1 -1
- package/dist/es/standards-sdk.es38.js +183 -320
- package/dist/es/standards-sdk.es38.js.map +1 -1
- package/dist/es/standards-sdk.es39.js +238 -161
- package/dist/es/standards-sdk.es39.js.map +1 -1
- package/dist/es/standards-sdk.es4.js +425 -63
- package/dist/es/standards-sdk.es4.js.map +1 -1
- package/dist/es/standards-sdk.es40.js +136 -254
- package/dist/es/standards-sdk.es40.js.map +1 -1
- package/dist/es/standards-sdk.es41.js +225 -176
- package/dist/es/standards-sdk.es41.js.map +1 -1
- package/dist/es/standards-sdk.es42.js +199 -261
- package/dist/es/standards-sdk.es42.js.map +1 -1
- package/dist/es/standards-sdk.es43.js +237 -199
- package/dist/es/standards-sdk.es43.js.map +1 -1
- package/dist/es/standards-sdk.es44.js +209 -201
- package/dist/es/standards-sdk.es44.js.map +1 -1
- package/dist/es/standards-sdk.es45.js +305 -201
- package/dist/es/standards-sdk.es45.js.map +1 -1
- package/dist/es/standards-sdk.es46.js +371 -261
- package/dist/es/standards-sdk.es46.js.map +1 -1
- package/dist/es/standards-sdk.es47.js +316 -371
- package/dist/es/standards-sdk.es47.js.map +1 -1
- package/dist/es/standards-sdk.es48.js +404 -336
- package/dist/es/standards-sdk.es48.js.map +1 -1
- package/dist/es/standards-sdk.es49.js +83 -449
- package/dist/es/standards-sdk.es49.js.map +1 -1
- package/dist/es/standards-sdk.es5.js +232 -354
- package/dist/es/standards-sdk.es5.js.map +1 -1
- package/dist/es/standards-sdk.es50.js +179 -89
- package/dist/es/standards-sdk.es50.js.map +1 -1
- package/dist/es/standards-sdk.es51.js +231 -165
- package/dist/es/standards-sdk.es51.js.map +1 -1
- package/dist/es/standards-sdk.es52.js +25 -262
- package/dist/es/standards-sdk.es52.js.map +1 -1
- package/dist/es/standards-sdk.es53.js +56 -26
- package/dist/es/standards-sdk.es53.js.map +1 -1
- package/dist/es/standards-sdk.es54.js +12 -57
- package/dist/es/standards-sdk.es54.js.map +1 -1
- package/dist/es/standards-sdk.es55.js +49 -12
- package/dist/es/standards-sdk.es55.js.map +1 -1
- package/dist/es/standards-sdk.es56.js +115 -43
- package/dist/es/standards-sdk.es56.js.map +1 -1
- package/dist/es/standards-sdk.es57.js +42 -115
- package/dist/es/standards-sdk.es57.js.map +1 -1
- package/dist/es/standards-sdk.es58.js +52 -43
- package/dist/es/standards-sdk.es58.js.map +1 -1
- package/dist/es/standards-sdk.es59.js +36 -50
- package/dist/es/standards-sdk.es59.js.map +1 -1
- package/dist/es/standards-sdk.es6.js +125 -246
- package/dist/es/standards-sdk.es6.js.map +1 -1
- package/dist/es/standards-sdk.es60.js +207 -39
- package/dist/es/standards-sdk.es60.js.map +1 -1
- package/dist/es/standards-sdk.es61.js +24 -200
- package/dist/es/standards-sdk.es61.js.map +1 -1
- package/dist/es/standards-sdk.es62.js +87 -25
- package/dist/es/standards-sdk.es62.js.map +1 -1
- package/dist/es/standards-sdk.es63.js +3 -51
- package/dist/es/standards-sdk.es63.js.map +1 -1
- package/dist/es/standards-sdk.es64.js +100 -3
- package/dist/es/standards-sdk.es64.js.map +1 -1
- package/dist/es/standards-sdk.es65.js +61 -62
- package/dist/es/standards-sdk.es65.js.map +1 -1
- package/dist/es/standards-sdk.es66.js +17 -98
- package/dist/es/standards-sdk.es66.js.map +1 -1
- package/dist/es/standards-sdk.es67.js +77 -19
- package/dist/es/standards-sdk.es67.js.map +1 -1
- package/dist/es/standards-sdk.es68.js +458 -77
- package/dist/es/standards-sdk.es68.js.map +1 -1
- package/dist/es/standards-sdk.es69.js +106 -240
- package/dist/es/standards-sdk.es69.js.map +1 -1
- package/dist/es/standards-sdk.es7.js +28 -183
- package/dist/es/standards-sdk.es7.js.map +1 -1
- package/dist/es/standards-sdk.es70.js +170 -286
- package/dist/es/standards-sdk.es70.js.map +1 -1
- package/dist/es/standards-sdk.es71.js +71 -207
- package/dist/es/standards-sdk.es71.js.map +1 -1
- package/dist/es/standards-sdk.es72.js +71 -72
- package/dist/es/standards-sdk.es72.js.map +1 -1
- package/dist/es/standards-sdk.es73.js +143 -71
- package/dist/es/standards-sdk.es73.js.map +1 -1
- package/dist/es/standards-sdk.es74.js +62 -136
- package/dist/es/standards-sdk.es74.js.map +1 -1
- package/dist/es/standards-sdk.es75.js +380 -45
- package/dist/es/standards-sdk.es75.js.map +1 -1
- package/dist/es/standards-sdk.es76.js +222 -130
- package/dist/es/standards-sdk.es76.js.map +1 -1
- package/dist/es/standards-sdk.es77.js +320 -444
- package/dist/es/standards-sdk.es77.js.map +1 -1
- package/dist/es/standards-sdk.es78.js +88 -370
- package/dist/es/standards-sdk.es78.js.map +1 -1
- package/dist/es/standards-sdk.es79.js +125 -89
- package/dist/es/standards-sdk.es79.js.map +1 -1
- package/dist/es/standards-sdk.es8.js +80 -29
- package/dist/es/standards-sdk.es8.js.map +1 -1
- package/dist/es/standards-sdk.es80.js +8 -125
- package/dist/es/standards-sdk.es80.js.map +1 -1
- package/dist/es/standards-sdk.es81.js +45 -6
- package/dist/es/standards-sdk.es81.js.map +1 -1
- package/dist/es/standards-sdk.es82.js +98 -44
- package/dist/es/standards-sdk.es82.js.map +1 -1
- package/dist/es/standards-sdk.es83.js +331 -84
- package/dist/es/standards-sdk.es83.js.map +1 -1
- package/dist/es/standards-sdk.es84.js +93 -160
- package/dist/es/standards-sdk.es84.js.map +1 -1
- package/dist/es/standards-sdk.es85.js +55 -275
- package/dist/es/standards-sdk.es85.js.map +1 -1
- package/dist/es/standards-sdk.es86.js +43 -55
- package/dist/es/standards-sdk.es86.js.map +1 -1
- package/dist/es/standards-sdk.es87.js +145 -22
- package/dist/es/standards-sdk.es87.js.map +1 -1
- package/dist/es/standards-sdk.es88.js +34 -47
- package/dist/es/standards-sdk.es88.js.map +1 -1
- package/dist/es/standards-sdk.es89.js +22 -57
- package/dist/es/standards-sdk.es89.js.map +1 -1
- package/dist/es/standards-sdk.es9.js +104 -80
- package/dist/es/standards-sdk.es9.js.map +1 -1
- package/dist/es/standards-sdk.es90.js +23 -28
- package/dist/es/standards-sdk.es90.js.map +1 -1
- package/dist/es/standards-sdk.es91.js +238 -23
- package/dist/es/standards-sdk.es91.js.map +1 -1
- package/dist/es/standards-sdk.es92.js +265 -152
- package/dist/es/standards-sdk.es92.js.map +1 -1
- package/dist/es/standards-sdk.es93.js +95 -68
- package/dist/es/standards-sdk.es93.js.map +1 -1
- package/dist/es/standards-sdk.es94.js +124 -136
- package/dist/es/standards-sdk.es94.js.map +1 -1
- package/dist/es/standards-sdk.es95.js +42 -138
- package/dist/es/standards-sdk.es95.js.map +1 -1
- package/dist/es/standards-sdk.es96.js +259 -42
- package/dist/es/standards-sdk.es96.js.map +1 -1
- package/dist/es/standards-sdk.es97.js +82 -243
- package/dist/es/standards-sdk.es97.js.map +1 -1
- package/dist/es/standards-sdk.es98.js +48 -47
- package/dist/es/standards-sdk.es98.js.map +1 -1
- package/dist/es/standards-sdk.es99.js +29 -100
- package/dist/es/standards-sdk.es99.js.map +1 -1
- package/dist/es/utils/crypto-abstraction.d.ts.map +1 -1
- package/dist/es/utils/crypto-env.d.ts.map +1 -1
- package/dist/es/utils/dynamic-import.d.ts +5 -1
- package/dist/es/utils/dynamic-import.d.ts.map +1 -1
- package/dist/es/utils/hash-adapter.d.ts.map +1 -1
- package/package.json +8 -7
- package/dist/cjs/patches/topic-autorenew-patch.d.ts +0 -2
- package/dist/cjs/patches/topic-autorenew-patch.d.ts.map +0 -1
- package/dist/es/patches/topic-autorenew-patch.d.ts +0 -2
- package/dist/es/patches/topic-autorenew-patch.d.ts.map +0 -1
|
@@ -1,1156 +1,270 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import "buffer";
|
|
15
|
-
import "crypto";
|
|
16
|
-
import "@noble/curves/secp256k1.js";
|
|
17
|
-
import "zod";
|
|
18
|
-
import "./standards-sdk.es139.js";
|
|
19
|
-
import "ethers";
|
|
20
|
-
import "./standards-sdk.es123.js";
|
|
21
|
-
import "./standards-sdk.es114.js";
|
|
22
|
-
import { getTopicId } from "./standards-sdk.es115.js";
|
|
23
|
-
import { InscriptionSDK } from "./standards-sdk.es147.js";
|
|
24
|
-
import { HCS10BaseClient, Hcs10MemoType } from "./standards-sdk.es17.js";
|
|
25
|
-
import * as mime from "mime-types";
|
|
26
|
-
import { AgentBuilder } from "./standards-sdk.es24.js";
|
|
27
|
-
import { HCS11Client } from "./standards-sdk.es28.js";
|
|
28
|
-
import { inscribeWithSigner } from "./standards-sdk.es125.js";
|
|
29
|
-
const isBrowser = typeof window !== "undefined";
|
|
30
|
-
class BrowserHCSClient extends HCS10BaseClient {
|
|
31
|
-
constructor(config) {
|
|
32
|
-
super({
|
|
33
|
-
network: config.network,
|
|
34
|
-
logLevel: config.logLevel,
|
|
35
|
-
prettyPrint: config.prettyPrint,
|
|
36
|
-
feeAmount: config.feeAmount,
|
|
37
|
-
mirrorNode: config.mirrorNode,
|
|
38
|
-
silent: config.silent
|
|
39
|
-
});
|
|
40
|
-
this.hcs11Client = null;
|
|
41
|
-
this.hwc = config.hwc;
|
|
42
|
-
if (!config.guardedRegistryBaseUrl) {
|
|
43
|
-
this.guardedRegistryBaseUrl = "https://moonscape.tech";
|
|
44
|
-
} else {
|
|
45
|
-
this.guardedRegistryBaseUrl = config.guardedRegistryBaseUrl;
|
|
46
|
-
}
|
|
47
|
-
let logLevel;
|
|
48
|
-
if (config.logLevel) {
|
|
49
|
-
logLevel = config.logLevel;
|
|
50
|
-
} else {
|
|
51
|
-
logLevel = "info";
|
|
52
|
-
}
|
|
53
|
-
this.logger = Logger.getInstance({
|
|
54
|
-
level: logLevel,
|
|
55
|
-
module: "HCS-Browser",
|
|
56
|
-
prettyPrint: config.prettyPrint,
|
|
57
|
-
silent: config.silent
|
|
58
|
-
});
|
|
59
|
-
if (isBrowser) {
|
|
60
|
-
try {
|
|
61
|
-
const { accountId, signer } = this.getAccountAndSigner();
|
|
62
|
-
this.hcs11Client = new HCS11Client({
|
|
63
|
-
network: config.network,
|
|
64
|
-
auth: {
|
|
65
|
-
operatorId: accountId,
|
|
66
|
-
signer
|
|
67
|
-
},
|
|
68
|
-
logLevel: config.logLevel,
|
|
69
|
-
silent: config.silent
|
|
70
|
-
});
|
|
71
|
-
} catch (err) {
|
|
72
|
-
this.logger.warn(`Failed to initialize HCS11Client: ${err}`);
|
|
73
|
-
}
|
|
74
|
-
} else {
|
|
75
|
-
this.logger.error(
|
|
76
|
-
"BrowserHCSClient initialized in server environment - browser-specific features will not be available. Use HCS10Client instead."
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
async sendMessage(connectionTopicId, data, memo, submitKey, options) {
|
|
81
|
-
this.logger.info("Sending message");
|
|
82
|
-
const operatorId = await this.getOperatorId();
|
|
83
|
-
const payload = {
|
|
84
|
-
p: "hcs-10",
|
|
85
|
-
op: "message",
|
|
86
|
-
operator_id: operatorId,
|
|
87
|
-
data,
|
|
88
|
-
m: memo
|
|
89
|
-
};
|
|
90
|
-
const submissionCheck = await this.canSubmitToTopic(
|
|
91
|
-
connectionTopicId,
|
|
92
|
-
this.hwc.getAccountInfo().accountId
|
|
93
|
-
);
|
|
94
|
-
const payloadString = JSON.stringify(payload);
|
|
95
|
-
const isLargePayload = Buffer.from(payloadString).length > 1e3;
|
|
96
|
-
if (isLargePayload) {
|
|
97
|
-
this.logger.info(
|
|
98
|
-
"Message payload exceeds 1000 bytes, storing via inscription"
|
|
99
|
-
);
|
|
100
|
-
try {
|
|
101
|
-
const contentBuffer = Buffer.from(data);
|
|
102
|
-
const fileName = `message-${Date.now()}.json`;
|
|
103
|
-
const inscriptionResult = await this.inscribeFile(
|
|
104
|
-
contentBuffer,
|
|
105
|
-
fileName,
|
|
106
|
-
{
|
|
107
|
-
progressCallback: options?.progressCallback,
|
|
108
|
-
waitMaxAttempts: options?.waitMaxAttempts,
|
|
109
|
-
waitIntervalMs: options?.waitIntervalMs
|
|
110
|
-
}
|
|
111
|
-
);
|
|
112
|
-
if (getTopicId(inscriptionResult)) {
|
|
113
|
-
payload.data = `hcs://1/${getTopicId(inscriptionResult)}`;
|
|
114
|
-
this.logger.info(
|
|
115
|
-
`Large message inscribed with topic ID: ${getTopicId(inscriptionResult)}`
|
|
116
|
-
);
|
|
117
|
-
} else {
|
|
118
|
-
throw new Error("Failed to inscribe large message content");
|
|
119
|
-
}
|
|
120
|
-
} catch (error) {
|
|
121
|
-
this.logger.error("Error inscribing large message:", error);
|
|
122
|
-
throw new Error(
|
|
123
|
-
`Failed to handle large message: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return await this.submitPayload(
|
|
128
|
-
connectionTopicId,
|
|
129
|
-
payload,
|
|
130
|
-
submitKey,
|
|
131
|
-
submissionCheck.requiresFee
|
|
132
|
-
);
|
|
133
|
-
}
|
|
134
|
-
async getPublicKey(accountId) {
|
|
135
|
-
return await this.mirrorNode.getPublicKey(accountId);
|
|
136
|
-
}
|
|
137
|
-
async handleConnectionRequest(inboundTopicId, requestingAccountId, connectionId, connectionMemo = "Connection accepted. Looking forward to collaborating!", ttl = 60) {
|
|
138
|
-
this.logger.info("Handling connection request");
|
|
139
|
-
const userAccountId = this.hwc.getAccountInfo().accountId;
|
|
140
|
-
if (!userAccountId) {
|
|
141
|
-
throw new Error("Failed to retrieve user account ID");
|
|
142
|
-
}
|
|
143
|
-
const requesterKey = await this.mirrorNode.getPublicKey(requestingAccountId);
|
|
144
|
-
const accountKey = await this.mirrorNode.getPublicKey(userAccountId);
|
|
145
|
-
if (!accountKey) {
|
|
146
|
-
throw new Error("Failed to retrieve public key");
|
|
147
|
-
}
|
|
148
|
-
const thresholdKey = new KeyList([accountKey, requesterKey], 1);
|
|
149
|
-
const memo = this._generateHcs10Memo(Hcs10MemoType.CONNECTION, {
|
|
150
|
-
ttl,
|
|
151
|
-
inboundTopicId,
|
|
152
|
-
connectionId
|
|
153
|
-
});
|
|
154
|
-
const transaction = new TopicCreateTransaction().setTopicMemo(memo).setAutoRenewAccountId(AccountId.fromString(userAccountId)).setAdminKey(thresholdKey).setSubmitKey(thresholdKey);
|
|
155
|
-
this.logger.debug("Executing topic creation transaction");
|
|
156
|
-
const txResponse = await this.hwc.executeTransactionWithErrorHandling(
|
|
157
|
-
transaction,
|
|
158
|
-
false
|
|
159
|
-
);
|
|
160
|
-
if (txResponse?.error) {
|
|
161
|
-
this.logger.error(txResponse.error);
|
|
162
|
-
throw new Error(txResponse.error);
|
|
163
|
-
}
|
|
164
|
-
const resultReceipt = txResponse?.result;
|
|
165
|
-
if (!resultReceipt?.topicId) {
|
|
166
|
-
this.logger.error("Failed to create topic: topicId is null");
|
|
167
|
-
throw new Error("Failed to create topic: topicId is null");
|
|
168
|
-
}
|
|
169
|
-
const connectionTopicId = resultReceipt.topicId.toString();
|
|
170
|
-
const operatorId = `${inboundTopicId}@${userAccountId}`;
|
|
171
|
-
const confirmedConnectionSequenceNumber = await this.confirmConnection(
|
|
172
|
-
inboundTopicId,
|
|
173
|
-
connectionTopicId,
|
|
174
|
-
requestingAccountId,
|
|
175
|
-
connectionId,
|
|
176
|
-
operatorId,
|
|
177
|
-
connectionMemo
|
|
178
|
-
);
|
|
179
|
-
const accountTopics = await this.retrieveCommunicationTopics(userAccountId);
|
|
180
|
-
const requestingAccountTopics = await this.retrieveCommunicationTopics(requestingAccountId);
|
|
181
|
-
const requestingAccountOperatorId = `${requestingAccountTopics.inboundTopic}@${requestingAccountId}`;
|
|
182
|
-
await this.recordOutboundConnectionConfirmation({
|
|
183
|
-
outboundTopicId: accountTopics.outboundTopic,
|
|
184
|
-
requestorOutboundTopicId: requestingAccountTopics.outboundTopic,
|
|
185
|
-
connectionRequestId: connectionId,
|
|
186
|
-
confirmedRequestId: confirmedConnectionSequenceNumber,
|
|
187
|
-
connectionTopicId,
|
|
188
|
-
operatorId: requestingAccountOperatorId,
|
|
189
|
-
memo: `Connection established with ${requestingAccountId}`
|
|
190
|
-
});
|
|
191
|
-
return {
|
|
192
|
-
connectionTopicId,
|
|
193
|
-
confirmedConnectionSequenceNumber,
|
|
194
|
-
operatorId
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
async confirmConnection(inboundTopicId, connectionTopicId, connectedAccountId, connectionId, operatorId, memo) {
|
|
198
|
-
this.logger.info("Confirming connection");
|
|
199
|
-
const payload = {
|
|
200
|
-
p: "hcs-10",
|
|
201
|
-
op: "connection_created",
|
|
202
|
-
connection_topic_id: connectionTopicId,
|
|
203
|
-
connected_account_id: connectedAccountId,
|
|
204
|
-
operator_id: operatorId,
|
|
205
|
-
connection_id: connectionId,
|
|
206
|
-
m: memo
|
|
207
|
-
};
|
|
208
|
-
const transactionResponse = await this.submitPayload(
|
|
209
|
-
inboundTopicId,
|
|
210
|
-
payload
|
|
211
|
-
);
|
|
212
|
-
if (!transactionResponse?.topicSequenceNumber) {
|
|
213
|
-
this.logger.error(
|
|
214
|
-
"Failed to confirm connection: sequence number is null"
|
|
215
|
-
);
|
|
216
|
-
throw new Error("Failed to confirm connection: sequence number is null");
|
|
217
|
-
}
|
|
218
|
-
return transactionResponse.topicSequenceNumber.toNumber();
|
|
219
|
-
}
|
|
220
|
-
async create(builder, options) {
|
|
221
|
-
const progressCallback = options?.progressCallback;
|
|
222
|
-
const progressReporter = new ProgressReporter({
|
|
223
|
-
module: "ProfileCreate",
|
|
224
|
-
logger: this.logger,
|
|
225
|
-
callback: progressCallback
|
|
226
|
-
});
|
|
1
|
+
import { HCS11Client } from "./standards-sdk.es27.js";
|
|
2
|
+
import { sleep } from "./standards-sdk.es115.js";
|
|
3
|
+
class Registration {
|
|
4
|
+
/**
|
|
5
|
+
* Checks the status of a registration request.
|
|
6
|
+
*
|
|
7
|
+
* @param transactionId - The transaction ID of the registration.
|
|
8
|
+
* @param network - The network to use for the registration.
|
|
9
|
+
* @param baseUrl - The base URL of the guarded registry.
|
|
10
|
+
* @param logger - The logger to use for logging.
|
|
11
|
+
* @returns A promise that resolves to the registration status response.
|
|
12
|
+
*/
|
|
13
|
+
async checkRegistrationStatus(transactionId, network, baseUrl, logger) {
|
|
227
14
|
try {
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
this.logger.info("Creating Agent Profile and HCS-10 Topics");
|
|
241
|
-
const agentConfig = builder.build();
|
|
242
|
-
state.agentMetadata = agentConfig.metadata;
|
|
243
|
-
} else {
|
|
244
|
-
this.logger.info("Creating Person HCS-11 Profile");
|
|
245
|
-
}
|
|
246
|
-
progressReporter.preparing(
|
|
247
|
-
`Starting ${isAgentBuilder ? "agent" : "person"} resource creation`,
|
|
248
|
-
0,
|
|
249
|
-
{
|
|
250
|
-
state
|
|
251
|
-
}
|
|
252
|
-
);
|
|
253
|
-
const {
|
|
254
|
-
inboundTopicId,
|
|
255
|
-
outboundTopicId,
|
|
256
|
-
state: updatedState
|
|
257
|
-
} = await this.createCommunicationTopics(options, progressReporter);
|
|
258
|
-
state = updatedState;
|
|
259
|
-
builder.setInboundTopicId(inboundTopicId);
|
|
260
|
-
builder.setOutboundTopicId(outboundTopicId);
|
|
261
|
-
let pfpTopicId;
|
|
262
|
-
let hasPfpBuffer;
|
|
263
|
-
let pfpFileName;
|
|
264
|
-
if (isAgentBuilder) {
|
|
265
|
-
const agentProfile = builder.build();
|
|
266
|
-
pfpTopicId = agentProfile.existingPfpTopicId || state.pfpTopicId;
|
|
267
|
-
hasPfpBuffer = agentProfile.pfpBuffer;
|
|
268
|
-
pfpFileName = agentProfile.pfpFileName || "pfp.png";
|
|
269
|
-
} else {
|
|
270
|
-
const personProfile = builder.build();
|
|
271
|
-
pfpTopicId = state.pfpTopicId;
|
|
272
|
-
hasPfpBuffer = personProfile.pfpBuffer;
|
|
273
|
-
pfpFileName = personProfile.pfpFileName;
|
|
274
|
-
}
|
|
275
|
-
if (!pfpTopicId && hasPfpBuffer && pfpFileName) {
|
|
276
|
-
pfpTopicId = await this.handleProfilePictureCreation(
|
|
277
|
-
hasPfpBuffer,
|
|
278
|
-
pfpFileName,
|
|
279
|
-
state,
|
|
280
|
-
progressReporter
|
|
281
|
-
);
|
|
282
|
-
} else if (pfpTopicId) {
|
|
283
|
-
progressReporter.preparing(
|
|
284
|
-
`Using existing profile picture: ${pfpTopicId}`,
|
|
285
|
-
50,
|
|
286
|
-
{ state }
|
|
287
|
-
);
|
|
288
|
-
state.pfpTopicId = pfpTopicId;
|
|
289
|
-
}
|
|
290
|
-
await this.createAndInscribeProfile(
|
|
291
|
-
isAgentBuilder,
|
|
292
|
-
builder,
|
|
293
|
-
pfpTopicId,
|
|
294
|
-
state,
|
|
295
|
-
inboundTopicId,
|
|
296
|
-
outboundTopicId,
|
|
297
|
-
options,
|
|
298
|
-
progressReporter
|
|
299
|
-
);
|
|
300
|
-
state.currentStage = "complete";
|
|
301
|
-
state.completedPercentage = 100;
|
|
302
|
-
progressReporter.completed(
|
|
303
|
-
`${isAgentBuilder ? "Agent" : "Person"} profile created successfully`,
|
|
304
|
-
{
|
|
305
|
-
profileTopicId: state.profileTopicId,
|
|
306
|
-
inboundTopicId,
|
|
307
|
-
outboundTopicId,
|
|
308
|
-
pfpTopicId,
|
|
309
|
-
state
|
|
15
|
+
const response = await fetch(`${baseUrl}/api/request-confirm`, {
|
|
16
|
+
method: "POST",
|
|
17
|
+
headers: {
|
|
18
|
+
"Content-Type": "application/json",
|
|
19
|
+
"X-Network": network
|
|
20
|
+
},
|
|
21
|
+
body: JSON.stringify({ transaction_id: transactionId })
|
|
22
|
+
});
|
|
23
|
+
if (!response.ok) {
|
|
24
|
+
const error = `Failed to confirm registration: ${response.statusText}`;
|
|
25
|
+
if (logger) {
|
|
26
|
+
logger.error(error);
|
|
310
27
|
}
|
|
311
|
-
|
|
312
|
-
let outTopicId = "";
|
|
313
|
-
if (state.outboundTopicId) {
|
|
314
|
-
outTopicId = state.outboundTopicId;
|
|
315
|
-
}
|
|
316
|
-
let inTopicId = "";
|
|
317
|
-
if (state.inboundTopicId) {
|
|
318
|
-
inTopicId = state.inboundTopicId;
|
|
319
|
-
}
|
|
320
|
-
let profilePicTopicId = "";
|
|
321
|
-
if (state.pfpTopicId) {
|
|
322
|
-
profilePicTopicId = state.pfpTopicId;
|
|
28
|
+
throw new Error(error);
|
|
323
29
|
}
|
|
324
|
-
|
|
325
|
-
if (state.profileTopicId) {
|
|
326
|
-
profTopicId = state.profileTopicId;
|
|
327
|
-
}
|
|
328
|
-
return {
|
|
329
|
-
outboundTopicId: outTopicId,
|
|
330
|
-
inboundTopicId: inTopicId,
|
|
331
|
-
pfpTopicId: profilePicTopicId,
|
|
332
|
-
profileTopicId: profTopicId,
|
|
333
|
-
success: true,
|
|
334
|
-
state
|
|
335
|
-
};
|
|
30
|
+
return await response.json();
|
|
336
31
|
} catch (error) {
|
|
337
|
-
|
|
338
|
-
error: error.message
|
|
339
|
-
});
|
|
340
|
-
return {
|
|
341
|
-
outboundTopicId: "",
|
|
342
|
-
inboundTopicId: "",
|
|
343
|
-
pfpTopicId: "",
|
|
344
|
-
profileTopicId: "",
|
|
345
|
-
success: false,
|
|
346
|
-
error: error.message,
|
|
347
|
-
state: {
|
|
348
|
-
currentStage: "init",
|
|
349
|
-
completedPercentage: 0,
|
|
350
|
-
error: error.message
|
|
351
|
-
}
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
async handleProfilePictureCreation(pfpBuffer, pfpFileName, state, progressReporter) {
|
|
356
|
-
state.currentStage = "pfp";
|
|
357
|
-
progressReporter.preparing("Creating profile picture", 30, {
|
|
358
|
-
state
|
|
359
|
-
});
|
|
360
|
-
const pfpProgress = progressReporter.createSubProgress({
|
|
361
|
-
minPercent: 30,
|
|
362
|
-
maxPercent: 50,
|
|
363
|
-
logPrefix: "PFP"
|
|
364
|
-
});
|
|
365
|
-
const pfpResult = await this.inscribePfp(pfpBuffer, pfpFileName, {
|
|
366
|
-
progressCallback: (data) => pfpProgress.report({
|
|
367
|
-
...data,
|
|
368
|
-
progressPercent: data.progressPercent ?? 0,
|
|
369
|
-
details: { ...data.details, state }
|
|
370
|
-
})
|
|
371
|
-
});
|
|
372
|
-
if (!pfpResult.success) {
|
|
373
|
-
let errorMessage = "Failed to inscribe profile picture";
|
|
374
|
-
if (pfpResult.error) {
|
|
375
|
-
errorMessage = pfpResult.error;
|
|
32
|
+
if (logger) {
|
|
33
|
+
logger.error(`Error checking registration status: ${error.message}`);
|
|
376
34
|
}
|
|
377
|
-
throw
|
|
378
|
-
}
|
|
379
|
-
const pfpTopicId = pfpResult.pfpTopicId;
|
|
380
|
-
state.pfpTopicId = pfpTopicId;
|
|
381
|
-
if (state.createdResources) {
|
|
382
|
-
state.createdResources.push(`pfp:${state.pfpTopicId}`);
|
|
35
|
+
throw error;
|
|
383
36
|
}
|
|
384
|
-
progressReporter.preparing("Profile picture created", 50, { state });
|
|
385
|
-
return pfpTopicId;
|
|
386
37
|
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
maxPercent: 95,
|
|
405
|
-
logPrefix: "StoreProfile"
|
|
406
|
-
});
|
|
407
|
-
let hcs11Profile;
|
|
408
|
-
if (isAgentBuilder) {
|
|
409
|
-
const agentProfile = builder.build();
|
|
410
|
-
const socialLinks = agentProfile.metadata?.socials ? Object.entries(agentProfile.metadata.socials).map(
|
|
411
|
-
([platform, handle]) => ({
|
|
412
|
-
platform,
|
|
413
|
-
handle
|
|
414
|
-
})
|
|
415
|
-
) : [];
|
|
416
|
-
hcs11Profile = this.hcs11Client.createAIAgentProfile(
|
|
417
|
-
agentProfile.name,
|
|
418
|
-
agentProfile.metadata?.type === "manual" ? 0 : 1,
|
|
419
|
-
agentProfile.capabilities || [],
|
|
420
|
-
agentProfile.metadata?.model || "unknown",
|
|
421
|
-
{
|
|
422
|
-
alias: agentProfile.name.toLowerCase().replace(/\s+/g, "_"),
|
|
423
|
-
bio: agentProfile.bio,
|
|
424
|
-
profileImage: pfpTopicId ? `hcs://1/${pfpTopicId}` : void 0,
|
|
425
|
-
socials: socialLinks,
|
|
426
|
-
properties: agentProfile.metadata?.properties || {},
|
|
427
|
-
inboundTopicId,
|
|
428
|
-
outboundTopicId,
|
|
429
|
-
creator: agentProfile.metadata?.creator
|
|
430
|
-
}
|
|
431
|
-
);
|
|
432
|
-
} else {
|
|
433
|
-
const personProfile = builder.build();
|
|
434
|
-
const { pfpBuffer, pfpFileName, ...cleanProfile } = personProfile;
|
|
435
|
-
hcs11Profile = this.hcs11Client.createPersonalProfile(
|
|
436
|
-
personProfile.display_name,
|
|
437
|
-
{
|
|
438
|
-
alias: personProfile.alias,
|
|
439
|
-
bio: personProfile.bio,
|
|
440
|
-
socials: personProfile.socials,
|
|
441
|
-
profileImage: pfpTopicId ? `hcs://1/${pfpTopicId}` : personProfile.profileImage,
|
|
442
|
-
properties: personProfile.properties,
|
|
443
|
-
inboundTopicId,
|
|
444
|
-
outboundTopicId
|
|
445
|
-
}
|
|
38
|
+
/**
|
|
39
|
+
* Waits for a registration to be confirmed.
|
|
40
|
+
*
|
|
41
|
+
* @param transactionId - The transaction ID of the registration.
|
|
42
|
+
* @param network - The network to use for the registration.
|
|
43
|
+
* @param baseUrl - The base URL of the guarded registry.
|
|
44
|
+
* @param maxAttempts - The maximum number of attempts to check the registration status.
|
|
45
|
+
* @param delayMs - The delay in milliseconds between attempts.
|
|
46
|
+
* @param logger - The logger to use for logging.
|
|
47
|
+
* @returns A promise that resolves to true if the registration is confirmed, false otherwise.
|
|
48
|
+
*/
|
|
49
|
+
async waitForRegistrationConfirmation(transactionId, network, baseUrl, maxAttempts = 60, delayMs = 2e3, logger) {
|
|
50
|
+
let attempts = 0;
|
|
51
|
+
while (attempts < maxAttempts) {
|
|
52
|
+
if (logger) {
|
|
53
|
+
logger.info(
|
|
54
|
+
`Checking registration status. Attempt ${attempts + 1}/${maxAttempts}`
|
|
446
55
|
);
|
|
447
56
|
}
|
|
448
|
-
const
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
...data,
|
|
454
|
-
progressPercent: data.progressPercent ?? 0
|
|
455
|
-
})
|
|
456
|
-
}
|
|
57
|
+
const status = await this.checkRegistrationStatus(
|
|
58
|
+
transactionId,
|
|
59
|
+
network,
|
|
60
|
+
baseUrl,
|
|
61
|
+
logger
|
|
457
62
|
);
|
|
458
|
-
if (
|
|
459
|
-
if (
|
|
460
|
-
|
|
461
|
-
`Failed to inscribe ${isAgentBuilder ? "agent" : "person"} profile`,
|
|
462
|
-
{
|
|
463
|
-
error: profileResult.error
|
|
464
|
-
}
|
|
465
|
-
);
|
|
466
|
-
}
|
|
467
|
-
let errorMessage = `Failed to inscribe ${isAgentBuilder ? "agent" : "person"} profile`;
|
|
468
|
-
if (profileResult.error) {
|
|
469
|
-
errorMessage = profileResult.error;
|
|
63
|
+
if (status.status === "success") {
|
|
64
|
+
if (logger) {
|
|
65
|
+
logger.info("Registration confirmed successfully");
|
|
470
66
|
}
|
|
471
|
-
|
|
67
|
+
return true;
|
|
472
68
|
}
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
69
|
+
if (status.status === "failed") {
|
|
70
|
+
if (logger) {
|
|
71
|
+
logger.error("Registration confirmation failed");
|
|
72
|
+
}
|
|
73
|
+
throw new Error("Registration confirmation failed");
|
|
476
74
|
}
|
|
477
|
-
if (
|
|
478
|
-
|
|
75
|
+
if (logger) {
|
|
76
|
+
logger.info(
|
|
77
|
+
`Registration still pending. Waiting ${delayMs}ms before next attempt`
|
|
78
|
+
);
|
|
479
79
|
}
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
`Using existing ${isAgentBuilder ? "agent" : "person"} profile`,
|
|
483
|
-
95,
|
|
484
|
-
{
|
|
485
|
-
state
|
|
486
|
-
}
|
|
487
|
-
);
|
|
80
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
81
|
+
attempts++;
|
|
488
82
|
}
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
const state = existingState || {
|
|
492
|
-
inboundTopicId,
|
|
493
|
-
currentStage: "registration",
|
|
494
|
-
completedPercentage: 0,
|
|
495
|
-
createdResources: []
|
|
496
|
-
};
|
|
497
|
-
if (state.currentStage !== "registration" && state.currentStage !== "complete") {
|
|
498
|
-
state.currentStage = "registration";
|
|
499
|
-
}
|
|
500
|
-
return state;
|
|
501
|
-
}
|
|
502
|
-
updateStateForCompletedRegistration(state, inboundTopicId) {
|
|
503
|
-
state.currentStage = "complete";
|
|
504
|
-
state.completedPercentage = 100;
|
|
505
|
-
if (state.createdResources) {
|
|
506
|
-
state.createdResources.push(`registration:${inboundTopicId}`);
|
|
83
|
+
if (logger) {
|
|
84
|
+
logger.warn(`Registration not confirmed after ${maxAttempts} attempts`);
|
|
507
85
|
}
|
|
86
|
+
return false;
|
|
508
87
|
}
|
|
509
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Executes a registration request for an agent.
|
|
90
|
+
*
|
|
91
|
+
* @param accountId - The account ID of the agent to register.
|
|
92
|
+
* @param network - The network to use for the registration.
|
|
93
|
+
* @param baseUrl - The base URL of the guarded registry.
|
|
94
|
+
* @param logger - The logger to use for logging.
|
|
95
|
+
* @returns A promise that resolves to the registration result.
|
|
96
|
+
*/
|
|
97
|
+
async executeRegistration(accountId, network = "mainnet", baseUrl = "https://moonscape.tech", logger) {
|
|
510
98
|
try {
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
if (options?.existingState?.inboundTopicId) {
|
|
514
|
-
this.logger.info("Using inboundTopicId from existing state");
|
|
515
|
-
inboundTopicId = options.existingState.inboundTopicId;
|
|
516
|
-
} else {
|
|
517
|
-
const profileResponse = await this.retrieveProfile(accountId, false, {
|
|
518
|
-
maxRetries: 5,
|
|
519
|
-
retryDelay: 3e3
|
|
520
|
-
});
|
|
521
|
-
if (!profileResponse.success || !profileResponse.profile || !profileResponse.topicInfo) {
|
|
522
|
-
const errorMessage = profileResponse.error || `Failed to retrieve profile for account ${accountId}. Make sure the agent profile is created and memo is updated before registration.`;
|
|
523
|
-
this.logger.error(errorMessage);
|
|
524
|
-
return {
|
|
525
|
-
error: errorMessage,
|
|
526
|
-
success: false,
|
|
527
|
-
state: {
|
|
528
|
-
currentStage: "registration",
|
|
529
|
-
completedPercentage: 0,
|
|
530
|
-
error: errorMessage
|
|
531
|
-
}
|
|
532
|
-
};
|
|
533
|
-
}
|
|
534
|
-
inboundTopicId = profileResponse.topicInfo.inboundTopic;
|
|
535
|
-
}
|
|
536
|
-
const state = this.initializeRegistrationState(
|
|
537
|
-
inboundTopicId,
|
|
538
|
-
options?.existingState
|
|
539
|
-
);
|
|
540
|
-
const progressReporter = new ProgressReporter({
|
|
541
|
-
module: "AgentRegistration",
|
|
542
|
-
logger: this.logger,
|
|
543
|
-
callback: options?.progressCallback
|
|
544
|
-
});
|
|
545
|
-
progressReporter.preparing("Preparing agent registration", 10, {
|
|
546
|
-
inboundTopicId,
|
|
547
|
-
accountId
|
|
548
|
-
});
|
|
549
|
-
const registrationResult = await this.executeRegistration(
|
|
550
|
-
accountId,
|
|
551
|
-
network,
|
|
552
|
-
this.guardedRegistryBaseUrl,
|
|
553
|
-
this.logger
|
|
554
|
-
);
|
|
555
|
-
if (!registrationResult.success) {
|
|
556
|
-
return {
|
|
557
|
-
...registrationResult,
|
|
558
|
-
state
|
|
559
|
-
};
|
|
99
|
+
if (logger) {
|
|
100
|
+
logger.info("Registering agent with guarded registry");
|
|
560
101
|
}
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
102
|
+
try {
|
|
103
|
+
const hcs11Client = new HCS11Client({
|
|
104
|
+
network,
|
|
105
|
+
auth: { operatorId: "0.0.0" }
|
|
106
|
+
});
|
|
107
|
+
logger?.info(
|
|
108
|
+
`Fetching profile by account ID ${accountId} on ${network}`
|
|
567
109
|
);
|
|
568
|
-
|
|
569
|
-
const
|
|
570
|
-
|
|
571
|
-
|
|
110
|
+
await sleep(5e3);
|
|
111
|
+
const profileResult = await hcs11Client.fetchProfileByAccountId(
|
|
112
|
+
accountId,
|
|
113
|
+
network
|
|
572
114
|
);
|
|
573
|
-
|
|
115
|
+
logger?.info("Profile fetched", profileResult);
|
|
116
|
+
if (profileResult?.error) {
|
|
117
|
+
logger?.error("Error fetching profile", profileResult.error);
|
|
574
118
|
return {
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
success: false,
|
|
578
|
-
state
|
|
119
|
+
error: profileResult.error,
|
|
120
|
+
success: false
|
|
579
121
|
};
|
|
580
122
|
}
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
accountId,
|
|
585
|
-
inboundTopicId,
|
|
586
|
-
transactionId: registrationResult.transactionId
|
|
587
|
-
});
|
|
588
|
-
const maxAttempts = options?.maxAttempts ?? 60;
|
|
589
|
-
const delayMs = options?.delayMs ?? 2e3;
|
|
590
|
-
const confirmed = await this.waitForRegistrationConfirmation(
|
|
591
|
-
registrationResult.transactionId,
|
|
592
|
-
network,
|
|
593
|
-
this.guardedRegistryBaseUrl,
|
|
594
|
-
maxAttempts,
|
|
595
|
-
delayMs,
|
|
596
|
-
this.logger
|
|
597
|
-
);
|
|
598
|
-
this.updateStateForCompletedRegistration(state, inboundTopicId);
|
|
599
|
-
progressReporter.completed("Agent registration complete", {
|
|
600
|
-
transactionId: registrationResult.transactionId,
|
|
601
|
-
inboundTopicId,
|
|
602
|
-
state,
|
|
603
|
-
confirmed
|
|
604
|
-
});
|
|
605
|
-
return {
|
|
606
|
-
...registrationResult,
|
|
607
|
-
confirmed,
|
|
608
|
-
state
|
|
609
|
-
};
|
|
610
|
-
} catch (error) {
|
|
611
|
-
this.logger.error(`Registration error: ${error.message}`);
|
|
612
|
-
return {
|
|
613
|
-
error: `Error during registration: ${error.message}`,
|
|
614
|
-
success: false,
|
|
615
|
-
state: {
|
|
616
|
-
currentStage: "registration",
|
|
617
|
-
completedPercentage: 0,
|
|
618
|
-
error: error.message
|
|
619
|
-
}
|
|
620
|
-
};
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
async createAndRegisterAgent(builder, options) {
|
|
624
|
-
try {
|
|
625
|
-
const agentConfig = builder.build();
|
|
626
|
-
const progressCallback = options?.progressCallback;
|
|
627
|
-
const progressReporter = new ProgressReporter({
|
|
628
|
-
module: "AgentCreateRegister",
|
|
629
|
-
logger: this.logger,
|
|
630
|
-
callback: progressCallback
|
|
631
|
-
});
|
|
632
|
-
let state = options?.existingState || {
|
|
633
|
-
currentStage: "init",
|
|
634
|
-
completedPercentage: 0,
|
|
635
|
-
createdResources: []
|
|
636
|
-
};
|
|
637
|
-
state.agentMetadata = agentConfig.metadata;
|
|
638
|
-
progressReporter.preparing("Starting agent creation process", 0, {
|
|
639
|
-
state
|
|
640
|
-
});
|
|
641
|
-
if (state.currentStage !== "complete" || !state.inboundTopicId || !state.outboundTopicId || !state.profileTopicId) {
|
|
642
|
-
const createResult = await this.create(builder, {
|
|
643
|
-
progressCallback: (progress) => {
|
|
644
|
-
const adjustedPercent = (progress.progressPercent || 0) * 0.3;
|
|
645
|
-
progressReporter.report({
|
|
646
|
-
...progress,
|
|
647
|
-
progressPercent: adjustedPercent,
|
|
648
|
-
details: {
|
|
649
|
-
...progress.details,
|
|
650
|
-
state: progress.details?.state || state
|
|
651
|
-
}
|
|
652
|
-
});
|
|
653
|
-
},
|
|
654
|
-
existingState: state,
|
|
655
|
-
updateAccountMemo: true
|
|
656
|
-
});
|
|
657
|
-
if (!("state" in createResult)) {
|
|
658
|
-
throw new Error("Create method did not return expected agent state.");
|
|
659
|
-
}
|
|
660
|
-
if (!createResult.success) {
|
|
661
|
-
throw new Error(
|
|
662
|
-
createResult.error || "Failed to create agent resources"
|
|
663
|
-
);
|
|
664
|
-
}
|
|
665
|
-
state = createResult.state;
|
|
666
|
-
state.agentMetadata = agentConfig.metadata;
|
|
667
|
-
this.logger.info("Waiting for account memo update to propagate...");
|
|
668
|
-
await new Promise((resolve) => setTimeout(resolve, 5e3));
|
|
669
|
-
}
|
|
670
|
-
progressReporter.preparing(
|
|
671
|
-
`Agent creation status: ${state.currentStage}, ${state.completedPercentage}%`,
|
|
672
|
-
30,
|
|
673
|
-
{ state }
|
|
674
|
-
);
|
|
675
|
-
const { accountId } = this.getAccountAndSigner();
|
|
676
|
-
if (state.currentStage !== "complete" || !state.createdResources?.includes(
|
|
677
|
-
`registration:${state.inboundTopicId}`
|
|
678
|
-
)) {
|
|
679
|
-
if (options?.baseUrl) {
|
|
680
|
-
this.guardedRegistryBaseUrl = options.baseUrl;
|
|
681
|
-
}
|
|
682
|
-
const registrationResult = await this.registerAgentWithGuardedRegistry(
|
|
683
|
-
accountId,
|
|
684
|
-
agentConfig.network,
|
|
685
|
-
{
|
|
686
|
-
progressCallback: (progress) => {
|
|
687
|
-
const adjustedPercent = 30 + (progress.progressPercent || 0) * 0.7;
|
|
688
|
-
progressReporter.report({
|
|
689
|
-
...progress,
|
|
690
|
-
progressPercent: adjustedPercent,
|
|
691
|
-
details: {
|
|
692
|
-
...progress.details,
|
|
693
|
-
state: progress.details?.state || state
|
|
694
|
-
}
|
|
695
|
-
});
|
|
696
|
-
},
|
|
697
|
-
maxAttempts: options?.maxAttempts,
|
|
698
|
-
delayMs: options?.delayMs,
|
|
699
|
-
existingState: state
|
|
123
|
+
if (!profileResult?.success || !profileResult?.profile) {
|
|
124
|
+
if (logger) {
|
|
125
|
+
logger.error("Profile not found for agent registration");
|
|
700
126
|
}
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
);
|
|
706
|
-
}
|
|
707
|
-
state = registrationResult.state;
|
|
708
|
-
}
|
|
709
|
-
progressReporter.completed("Agent creation and registration complete", {
|
|
710
|
-
state
|
|
711
|
-
});
|
|
712
|
-
return {
|
|
713
|
-
success: true,
|
|
714
|
-
state,
|
|
715
|
-
metadata: {
|
|
716
|
-
accountId,
|
|
717
|
-
operatorId: `${state.inboundTopicId}@${accountId}`,
|
|
718
|
-
inboundTopicId: state.inboundTopicId,
|
|
719
|
-
outboundTopicId: state.outboundTopicId,
|
|
720
|
-
profileTopicId: state.profileTopicId,
|
|
721
|
-
pfpTopicId: state.pfpTopicId,
|
|
722
|
-
privateKey: null,
|
|
723
|
-
...state.agentMetadata
|
|
127
|
+
return {
|
|
128
|
+
error: "Profile not found for the provided account ID",
|
|
129
|
+
success: false
|
|
130
|
+
};
|
|
724
131
|
}
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
state: options?.existingState || {
|
|
734
|
-
currentStage: "init",
|
|
735
|
-
completedPercentage: 0,
|
|
736
|
-
error: error.message
|
|
132
|
+
if (!profileResult.profile.inboundTopicId) {
|
|
133
|
+
if (logger) {
|
|
134
|
+
logger.error("Missing inbound topic ID in profile");
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
error: "Profile is missing required inbound topic ID",
|
|
138
|
+
success: false
|
|
139
|
+
};
|
|
737
140
|
}
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
async storeHCS11Profile(agentName, agentBio, inboundTopicId, outboundTopicId, capabilities = [], metadata = {}, pfpBuffer, pfpFileName, existingPfpTopicId, options) {
|
|
742
|
-
try {
|
|
743
|
-
const progressCallback = options?.progressCallback;
|
|
744
|
-
const progressReporter = new ProgressReporter({
|
|
745
|
-
module: "StoreHCS11Profile",
|
|
746
|
-
logger: this.logger,
|
|
747
|
-
callback: progressCallback
|
|
748
|
-
});
|
|
749
|
-
progressReporter.preparing("Preparing agent profile data", 0);
|
|
750
|
-
let pfpTopicId = existingPfpTopicId;
|
|
751
|
-
if (!pfpTopicId && pfpBuffer && pfpFileName) {
|
|
752
|
-
const pfpProgress = progressReporter.createSubProgress({
|
|
753
|
-
minPercent: 0,
|
|
754
|
-
maxPercent: 60,
|
|
755
|
-
logPrefix: "PFP"
|
|
756
|
-
});
|
|
757
|
-
const pfpResult = await this.inscribePfp(pfpBuffer, pfpFileName, {
|
|
758
|
-
progressCallback: (data) => {
|
|
759
|
-
pfpProgress.report({
|
|
760
|
-
stage: data.stage,
|
|
761
|
-
message: data.message,
|
|
762
|
-
progressPercent: data.progressPercent || 0,
|
|
763
|
-
details: data.details
|
|
764
|
-
});
|
|
141
|
+
if (!profileResult.profile.outboundTopicId) {
|
|
142
|
+
if (logger) {
|
|
143
|
+
logger.error("Missing outbound topic ID in profile");
|
|
765
144
|
}
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
145
|
+
return {
|
|
146
|
+
error: "Profile is missing required outbound topic ID",
|
|
147
|
+
success: false
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
if (logger) {
|
|
151
|
+
logger.info(
|
|
152
|
+
`Profile validation successful. Inbound topic: ${profileResult.profile.inboundTopicId}, Outbound topic: ${profileResult.profile.outboundTopicId}`
|
|
770
153
|
);
|
|
771
|
-
} else {
|
|
772
|
-
pfpTopicId = pfpResult.pfpTopicId;
|
|
773
154
|
}
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
`
|
|
777
|
-
|
|
778
|
-
);
|
|
779
|
-
} else {
|
|
780
|
-
progressReporter.preparing("No profile picture provided", 30);
|
|
781
|
-
}
|
|
782
|
-
if (!this.hcs11Client) {
|
|
783
|
-
progressReporter.failed(
|
|
784
|
-
"HCS11Client is not available in this environment"
|
|
785
|
-
);
|
|
155
|
+
} catch (profileError) {
|
|
156
|
+
if (logger) {
|
|
157
|
+
logger.error(`Error validating profile: ${profileError.message}`);
|
|
158
|
+
}
|
|
786
159
|
return {
|
|
787
|
-
|
|
788
|
-
success: false
|
|
789
|
-
error: "HCS11Client is not available in this environment",
|
|
790
|
-
transactionId: ""
|
|
160
|
+
error: `Error validating profile: ${profileError.message}`,
|
|
161
|
+
success: false
|
|
791
162
|
};
|
|
792
163
|
}
|
|
793
|
-
const
|
|
794
|
-
|
|
164
|
+
const response = await fetch(`${baseUrl}/api/request-register`, {
|
|
165
|
+
method: "POST",
|
|
166
|
+
headers: {
|
|
167
|
+
"Content-Type": "application/json",
|
|
168
|
+
Accept: "*/*",
|
|
169
|
+
"Accept-Language": "en;q=0.5",
|
|
170
|
+
Origin: baseUrl,
|
|
171
|
+
Referer: `${baseUrl}/`,
|
|
172
|
+
"X-Network": network
|
|
173
|
+
},
|
|
174
|
+
body: JSON.stringify({
|
|
175
|
+
accountId
|
|
176
|
+
})
|
|
795
177
|
});
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
capabilities,
|
|
805
|
-
metadata.model || "unknown",
|
|
806
|
-
{
|
|
807
|
-
alias: agentName.toLowerCase().replace(/\s+/g, "_"),
|
|
808
|
-
bio: agentBio,
|
|
809
|
-
profileImage: pfpTopicId ? `hcs://1/${pfpTopicId}` : void 0,
|
|
810
|
-
socials: formattedSocials,
|
|
811
|
-
properties: {
|
|
812
|
-
version: metadata.version || "1.0.0",
|
|
813
|
-
creator: metadata.creator || "Unknown",
|
|
814
|
-
supported_languages: metadata.supported_languages || ["en"],
|
|
815
|
-
permissions: metadata.permissions || [],
|
|
816
|
-
model_details: metadata.model_details,
|
|
817
|
-
training: metadata.training,
|
|
818
|
-
capabilities_description: metadata.capabilities_description,
|
|
819
|
-
...metadata
|
|
820
|
-
},
|
|
821
|
-
inboundTopicId,
|
|
822
|
-
outboundTopicId,
|
|
823
|
-
creator: metadata.creator
|
|
824
|
-
}
|
|
825
|
-
);
|
|
826
|
-
const profileProgress = progressReporter.createSubProgress({
|
|
827
|
-
minPercent: 65,
|
|
828
|
-
maxPercent: 100,
|
|
829
|
-
logPrefix: "Profile"
|
|
830
|
-
});
|
|
831
|
-
const profileResult = await this.hcs11Client.createAndInscribeProfile(
|
|
832
|
-
profile,
|
|
833
|
-
options?.updateAccountMemo ?? true,
|
|
834
|
-
{
|
|
835
|
-
progressCallback: (profileData) => {
|
|
836
|
-
profileProgress.report({
|
|
837
|
-
stage: profileData.stage,
|
|
838
|
-
message: profileData.message,
|
|
839
|
-
progressPercent: profileData.progressPercent || 0,
|
|
840
|
-
details: profileData.details
|
|
841
|
-
});
|
|
842
|
-
}
|
|
178
|
+
const data = await response.json();
|
|
179
|
+
if (!response.ok) {
|
|
180
|
+
if (data.details?.length > 0) {
|
|
181
|
+
return {
|
|
182
|
+
validationErrors: data.details,
|
|
183
|
+
error: data.error || "Validation failed",
|
|
184
|
+
success: false
|
|
185
|
+
};
|
|
843
186
|
}
|
|
844
|
-
);
|
|
845
|
-
if (!profileResult.success) {
|
|
846
|
-
progressReporter.failed("Failed to inscribe profile");
|
|
847
187
|
return {
|
|
848
|
-
|
|
849
|
-
success: false
|
|
850
|
-
error: profileResult.error || "Failed to inscribe profile",
|
|
851
|
-
transactionId: profileResult.transactionId || ""
|
|
188
|
+
error: data.error || "Failed to register agent",
|
|
189
|
+
success: false
|
|
852
190
|
};
|
|
853
191
|
}
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
192
|
+
if (logger) {
|
|
193
|
+
logger.info(
|
|
194
|
+
`Created new registration request. Transaction ID: ${data.transaction_id}`
|
|
195
|
+
);
|
|
196
|
+
}
|
|
857
197
|
return {
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
success: true
|
|
861
|
-
transactionId: profileResult.transactionId || ""
|
|
198
|
+
transactionId: data.transaction_id,
|
|
199
|
+
transaction: data.transaction,
|
|
200
|
+
success: true
|
|
862
201
|
};
|
|
863
202
|
} catch (error) {
|
|
864
|
-
this.logger.error(`Error storing HCS11 profile: ${error.message}`);
|
|
865
|
-
return {
|
|
866
|
-
profileTopicId: "",
|
|
867
|
-
success: false,
|
|
868
|
-
error: error.message,
|
|
869
|
-
transactionId: ""
|
|
870
|
-
};
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
async createTopic(memo, adminKey, submitKey) {
|
|
874
|
-
this.logger.info("Creating topic");
|
|
875
|
-
const { accountId, signer } = this.getAccountAndSigner();
|
|
876
|
-
const transaction = new TopicCreateTransaction().setTopicMemo(memo);
|
|
877
|
-
const publicKey = await this.mirrorNode.getPublicKey(accountId);
|
|
878
|
-
if (adminKey && publicKey) {
|
|
879
|
-
transaction.setAdminKey(publicKey);
|
|
880
|
-
transaction.setAutoRenewAccountId(accountId);
|
|
881
|
-
}
|
|
882
|
-
if (submitKey && publicKey) {
|
|
883
|
-
transaction.setSubmitKey(publicKey);
|
|
884
|
-
}
|
|
885
|
-
const transactionResponse = await this.hwc.executeTransactionWithErrorHandling(
|
|
886
|
-
transaction,
|
|
887
|
-
false
|
|
888
|
-
);
|
|
889
|
-
const error = transactionResponse.error;
|
|
890
|
-
if (error) {
|
|
891
|
-
this.logger.error(error);
|
|
892
|
-
return {
|
|
893
|
-
success: false,
|
|
894
|
-
error
|
|
895
|
-
};
|
|
896
|
-
}
|
|
897
|
-
const resultReceipt = transactionResponse.result;
|
|
898
|
-
if (!resultReceipt?.topicId) {
|
|
899
|
-
this.logger.error("Failed to create topic: topicId is null");
|
|
900
203
|
return {
|
|
901
|
-
|
|
902
|
-
|
|
204
|
+
error: `Error during registration request: ${error.message}`,
|
|
205
|
+
success: false
|
|
903
206
|
};
|
|
904
207
|
}
|
|
905
|
-
return {
|
|
906
|
-
success: true,
|
|
907
|
-
topicId: resultReceipt.topicId.toString()
|
|
908
|
-
};
|
|
909
|
-
}
|
|
910
|
-
async submitPayload(topicId, payload, submitKey, requiresFee) {
|
|
911
|
-
this.logger.debug(`Submitting payload to topic ${topicId}`);
|
|
912
|
-
let message;
|
|
913
|
-
if (typeof payload === "string") {
|
|
914
|
-
message = payload;
|
|
915
|
-
} else {
|
|
916
|
-
message = JSON.stringify(payload);
|
|
917
|
-
}
|
|
918
|
-
const transaction = new TopicMessageSubmitTransaction().setTopicId(topicId).setMessage(message);
|
|
919
|
-
const transactionMemo = this.getHcs10TransactionMemo(payload);
|
|
920
|
-
if (transactionMemo) {
|
|
921
|
-
transaction.setTransactionMemo(transactionMemo);
|
|
922
|
-
}
|
|
923
|
-
let transactionResponse;
|
|
924
|
-
if (requiresFee) {
|
|
925
|
-
this.logger.info(
|
|
926
|
-
"Topic requires fee payment, setting max transaction fee"
|
|
927
|
-
);
|
|
928
|
-
transaction.setMaxTransactionFee(new Hbar(this.feeAmount));
|
|
929
|
-
}
|
|
930
|
-
if (submitKey) {
|
|
931
|
-
const { signer } = this.getAccountAndSigner();
|
|
932
|
-
transaction.freezeWithSigner(signer);
|
|
933
|
-
const signedTransaction = await transaction.sign(submitKey);
|
|
934
|
-
transactionResponse = await this.hwc.executeTransactionWithErrorHandling(
|
|
935
|
-
signedTransaction,
|
|
936
|
-
true
|
|
937
|
-
);
|
|
938
|
-
} else {
|
|
939
|
-
transactionResponse = await this.hwc.executeTransactionWithErrorHandling(
|
|
940
|
-
transaction,
|
|
941
|
-
false
|
|
942
|
-
);
|
|
943
|
-
}
|
|
944
|
-
if (transactionResponse?.error) {
|
|
945
|
-
this.logger.error(
|
|
946
|
-
`Failed to submit payload: ${transactionResponse.error}`
|
|
947
|
-
);
|
|
948
|
-
throw new Error(`Failed to submit payload: ${transactionResponse.error}`);
|
|
949
|
-
}
|
|
950
|
-
if (!transactionResponse?.result) {
|
|
951
|
-
this.logger.error(
|
|
952
|
-
"Failed to submit message: receipt is null or undefined"
|
|
953
|
-
);
|
|
954
|
-
throw new Error("Failed to submit message: receipt is null or undefined");
|
|
955
|
-
}
|
|
956
|
-
this.logger.debug("Payload submitted successfully via HWC");
|
|
957
|
-
return transactionResponse.result;
|
|
958
|
-
}
|
|
959
|
-
async inscribeFile(buffer, fileName, options) {
|
|
960
|
-
const { accountId, signer } = this.getAccountAndSigner();
|
|
961
|
-
const mimeType = mime.lookup(fileName) || "application/octet-stream";
|
|
962
|
-
const sdk = await InscriptionSDK.createWithAuth({
|
|
963
|
-
type: "client",
|
|
964
|
-
accountId,
|
|
965
|
-
signer,
|
|
966
|
-
network: this.network
|
|
967
|
-
});
|
|
968
|
-
const inscriptionOptions = {
|
|
969
|
-
mode: "file",
|
|
970
|
-
waitForConfirmation: true,
|
|
971
|
-
waitMaxAttempts: options?.waitMaxAttempts || 30,
|
|
972
|
-
waitIntervalMs: options?.waitIntervalMs || 4e3,
|
|
973
|
-
progressCallback: options?.progressCallback,
|
|
974
|
-
logging: {
|
|
975
|
-
level: this.logger.getLevel ? this.logger.getLevel() : "info"
|
|
976
|
-
}
|
|
977
|
-
};
|
|
978
|
-
const response = await inscribeWithSigner(
|
|
979
|
-
{
|
|
980
|
-
type: "buffer",
|
|
981
|
-
buffer,
|
|
982
|
-
fileName,
|
|
983
|
-
mimeType
|
|
984
|
-
},
|
|
985
|
-
signer,
|
|
986
|
-
{
|
|
987
|
-
...inscriptionOptions,
|
|
988
|
-
network: this.network
|
|
989
|
-
},
|
|
990
|
-
sdk
|
|
991
|
-
);
|
|
992
|
-
if (!response.confirmed || !response.inscription) {
|
|
993
|
-
throw new Error("Inscription was not confirmed");
|
|
994
|
-
}
|
|
995
|
-
return response.inscription;
|
|
996
|
-
}
|
|
997
|
-
getAccountAndSigner() {
|
|
998
|
-
const accountInfo = this?.hwc?.getAccountInfo();
|
|
999
|
-
const accountId = accountInfo?.accountId?.toString();
|
|
1000
|
-
const signer = this?.hwc?.dAppConnector?.signers?.find((s) => {
|
|
1001
|
-
return s.getAccountId().toString() === accountId;
|
|
1002
|
-
});
|
|
1003
|
-
if (!signer) {
|
|
1004
|
-
this.logger.error("Failed to find signer", {
|
|
1005
|
-
accountId,
|
|
1006
|
-
signers: this?.hwc?.dAppConnector?.signers,
|
|
1007
|
-
accountInfo
|
|
1008
|
-
});
|
|
1009
|
-
throw new Error("Failed to find signer");
|
|
1010
|
-
}
|
|
1011
|
-
return { accountId, signer };
|
|
1012
208
|
}
|
|
1013
209
|
/**
|
|
1014
|
-
*
|
|
210
|
+
* Finds registrations based on the provided options.
|
|
1015
211
|
*
|
|
1016
|
-
* @param
|
|
1017
|
-
* @param
|
|
1018
|
-
* @
|
|
1019
|
-
* @returns A promise that resolves to the topic ID of the inscribed PFP.
|
|
212
|
+
* @param options - The options for searching registrations.
|
|
213
|
+
* @param baseUrl - The base URL of the guarded registry.
|
|
214
|
+
* @returns A promise that resolves to the registration search result.
|
|
1020
215
|
*/
|
|
1021
|
-
async
|
|
216
|
+
async findRegistrations(options = {}, baseUrl = "https://moonscape.tech") {
|
|
1022
217
|
try {
|
|
1023
|
-
const
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
218
|
+
const queryParams = new URLSearchParams();
|
|
219
|
+
options.tags?.forEach((tag) => queryParams.append("tags", tag.toString()));
|
|
220
|
+
if (options.accountId) {
|
|
221
|
+
queryParams.append("accountId", options.accountId);
|
|
222
|
+
}
|
|
223
|
+
if (options.network) {
|
|
224
|
+
queryParams.append("network", options.network);
|
|
225
|
+
}
|
|
226
|
+
const response = await fetch(
|
|
227
|
+
`${baseUrl}/api/registrations?${queryParams}`,
|
|
228
|
+
{
|
|
229
|
+
headers: {
|
|
230
|
+
Accept: "*/*",
|
|
231
|
+
"Accept-Language": "en;q=0.5",
|
|
232
|
+
Origin: baseUrl,
|
|
233
|
+
Referer: `${baseUrl}/`
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
);
|
|
237
|
+
if (!response.ok) {
|
|
238
|
+
const error = await response.text();
|
|
1033
239
|
return {
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
transactionId: ""
|
|
240
|
+
registrations: [],
|
|
241
|
+
error: error || "Failed to fetch registrations",
|
|
242
|
+
success: false
|
|
1038
243
|
};
|
|
1039
244
|
}
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
const wrappedProgressCallback = (data) => {
|
|
1043
|
-
progressReporter.report({
|
|
1044
|
-
stage: data.stage || "confirming",
|
|
1045
|
-
message: data.message || "Processing PFP inscription",
|
|
1046
|
-
progressPercent: data.progressPercent || 50,
|
|
1047
|
-
details: data.details
|
|
1048
|
-
});
|
|
1049
|
-
};
|
|
1050
|
-
const imageResult = await this.hcs11Client.inscribeImage(
|
|
1051
|
-
buffer,
|
|
1052
|
-
fileName,
|
|
1053
|
-
{ progressCallback: wrappedProgressCallback }
|
|
1054
|
-
);
|
|
1055
|
-
if (!imageResult.success) {
|
|
1056
|
-
let errorMessage = "Failed to inscribe profile picture";
|
|
1057
|
-
if (imageResult.error) {
|
|
1058
|
-
errorMessage = imageResult.error;
|
|
1059
|
-
}
|
|
1060
|
-
let txId = "";
|
|
1061
|
-
if (imageResult.transactionId) {
|
|
1062
|
-
txId = imageResult.transactionId;
|
|
1063
|
-
}
|
|
245
|
+
const data = await response.json();
|
|
246
|
+
if (data.error) {
|
|
1064
247
|
return {
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
transactionId: txId
|
|
248
|
+
registrations: [],
|
|
249
|
+
error: data.error,
|
|
250
|
+
success: false
|
|
1069
251
|
};
|
|
1070
252
|
}
|
|
1071
|
-
progressReporter.completed("Successfully inscribed profile picture", {
|
|
1072
|
-
pfpTopicId: imageResult.imageTopicId
|
|
1073
|
-
});
|
|
1074
|
-
this.logger.info(
|
|
1075
|
-
`Successfully inscribed profile picture with topic ID: ${imageResult.imageTopicId}`
|
|
1076
|
-
);
|
|
1077
253
|
return {
|
|
1078
|
-
|
|
1079
|
-
success: true
|
|
1080
|
-
transactionId: imageResult.transactionId || ""
|
|
254
|
+
registrations: data.registrations || [],
|
|
255
|
+
success: true
|
|
1081
256
|
};
|
|
1082
|
-
} catch (
|
|
1083
|
-
|
|
257
|
+
} catch (e) {
|
|
258
|
+
const error = e;
|
|
1084
259
|
return {
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
transactionId: ""
|
|
260
|
+
registrations: [],
|
|
261
|
+
error: `Error fetching registrations: ${error.message}`,
|
|
262
|
+
success: false
|
|
1089
263
|
};
|
|
1090
264
|
}
|
|
1091
265
|
}
|
|
1092
|
-
async createCommunicationTopics(options, progressReporter) {
|
|
1093
|
-
let state = options?.existingState || {
|
|
1094
|
-
currentStage: "init",
|
|
1095
|
-
completedPercentage: 0,
|
|
1096
|
-
createdResources: []
|
|
1097
|
-
};
|
|
1098
|
-
if (progressReporter) {
|
|
1099
|
-
progressReporter.preparing("Starting communication topic creation", 0, {
|
|
1100
|
-
state
|
|
1101
|
-
});
|
|
1102
|
-
}
|
|
1103
|
-
const { accountId } = this.getAccountAndSigner();
|
|
1104
|
-
if (!state.outboundTopicId) {
|
|
1105
|
-
state.currentStage = "topics";
|
|
1106
|
-
if (progressReporter) {
|
|
1107
|
-
progressReporter.preparing("Creating outbound topic", 5, {
|
|
1108
|
-
state
|
|
1109
|
-
});
|
|
1110
|
-
}
|
|
1111
|
-
const outboundMemo = this._generateHcs10Memo(Hcs10MemoType.OUTBOUND, {
|
|
1112
|
-
ttl: options?.ttl,
|
|
1113
|
-
accountId
|
|
1114
|
-
});
|
|
1115
|
-
const outboundResult = await this.createTopic(outboundMemo, true, true);
|
|
1116
|
-
if (!outboundResult.success || !outboundResult.topicId) {
|
|
1117
|
-
throw new Error(
|
|
1118
|
-
outboundResult.error || "Failed to create outbound topic"
|
|
1119
|
-
);
|
|
1120
|
-
}
|
|
1121
|
-
state.outboundTopicId = outboundResult.topicId;
|
|
1122
|
-
if (state.createdResources)
|
|
1123
|
-
state.createdResources.push(`outbound:${state.outboundTopicId}`);
|
|
1124
|
-
}
|
|
1125
|
-
if (!state.inboundTopicId) {
|
|
1126
|
-
state.currentStage = "topics";
|
|
1127
|
-
if (progressReporter) {
|
|
1128
|
-
progressReporter.preparing("Creating inbound topic", 10, {
|
|
1129
|
-
state
|
|
1130
|
-
});
|
|
1131
|
-
}
|
|
1132
|
-
const inboundMemo = this._generateHcs10Memo(Hcs10MemoType.INBOUND, {
|
|
1133
|
-
ttl: options?.ttl,
|
|
1134
|
-
accountId
|
|
1135
|
-
});
|
|
1136
|
-
const inboundResult = await this.createTopic(inboundMemo, true, false);
|
|
1137
|
-
if (!inboundResult.success || !inboundResult.topicId) {
|
|
1138
|
-
throw new Error(
|
|
1139
|
-
inboundResult.error || "Failed to create inbound topic"
|
|
1140
|
-
);
|
|
1141
|
-
}
|
|
1142
|
-
state.inboundTopicId = inboundResult.topicId;
|
|
1143
|
-
if (state.createdResources)
|
|
1144
|
-
state.createdResources.push(`inbound:${state.inboundTopicId}`);
|
|
1145
|
-
}
|
|
1146
|
-
return {
|
|
1147
|
-
inboundTopicId: state.inboundTopicId,
|
|
1148
|
-
outboundTopicId: state.outboundTopicId,
|
|
1149
|
-
state
|
|
1150
|
-
};
|
|
1151
|
-
}
|
|
1152
266
|
}
|
|
1153
267
|
export {
|
|
1154
|
-
|
|
268
|
+
Registration
|
|
1155
269
|
};
|
|
1156
270
|
//# sourceMappingURL=standards-sdk.es20.js.map
|