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