@hashgraphonline/standards-sdk 0.1.158 → 0.1.160
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-12/validation/schemas.d.ts +4 -4
- package/dist/cjs/hcs-14/index.d.ts +5 -0
- package/dist/cjs/hcs-14/index.d.ts.map +1 -1
- package/dist/cjs/hcs-14/resolvers/aid-dns-web-profile.d.ts +37 -0
- package/dist/cjs/hcs-14/resolvers/aid-dns-web-profile.d.ts.map +1 -0
- package/dist/cjs/hcs-14/resolvers/dns.d.ts +3 -0
- package/dist/cjs/hcs-14/resolvers/dns.d.ts.map +1 -0
- package/dist/cjs/hcs-14/resolvers/hcs-11-profile.d.ts +8 -0
- package/dist/cjs/hcs-14/resolvers/hcs-11-profile.d.ts.map +1 -0
- package/dist/cjs/hcs-14/resolvers/profile-utils.d.ts +9 -0
- package/dist/cjs/hcs-14/resolvers/profile-utils.d.ts.map +1 -0
- package/dist/cjs/hcs-14/resolvers/registry.d.ts +21 -1
- package/dist/cjs/hcs-14/resolvers/registry.d.ts.map +1 -1
- package/dist/cjs/hcs-14/resolvers/types.d.ts +106 -5
- package/dist/cjs/hcs-14/resolvers/types.d.ts.map +1 -1
- package/dist/cjs/hcs-14/resolvers/uaid-did-resolution-profile.d.ts +10 -0
- package/dist/cjs/hcs-14/resolvers/uaid-did-resolution-profile.d.ts.map +1 -0
- package/dist/cjs/hcs-14/resolvers/uaid-dns-web-profile.d.ts +22 -0
- package/dist/cjs/hcs-14/resolvers/uaid-dns-web-profile.d.ts.map +1 -0
- package/dist/cjs/hcs-14/sdk.d.ts +16 -1
- package/dist/cjs/hcs-14/sdk.d.ts.map +1 -1
- package/dist/cjs/inscribe/inscriber.d.ts +1 -1
- package/dist/cjs/inscribe/inscriber.d.ts.map +1 -1
- package/dist/cjs/inscribe/inscription-cost.d.ts +12 -0
- package/dist/cjs/inscribe/inscription-cost.d.ts.map +1 -0
- package/dist/cjs/inscribe/types.d.ts +5 -1
- package/dist/cjs/inscribe/types.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/schemas.d.ts +1548 -0
- package/dist/cjs/services/registry-broker/schemas.d.ts.map +1 -1
- package/dist/cjs/standards-sdk.cjs +2 -2
- package/dist/cjs/standards-sdk.cjs.map +1 -1
- package/dist/es/hcs-12/validation/schemas.d.ts +4 -4
- package/dist/es/hcs-14/index.d.ts +5 -0
- package/dist/es/hcs-14/index.d.ts.map +1 -1
- package/dist/es/hcs-14/resolvers/aid-dns-web-profile.d.ts +37 -0
- package/dist/es/hcs-14/resolvers/aid-dns-web-profile.d.ts.map +1 -0
- package/dist/es/hcs-14/resolvers/dns.d.ts +3 -0
- package/dist/es/hcs-14/resolvers/dns.d.ts.map +1 -0
- package/dist/es/hcs-14/resolvers/hcs-11-profile.d.ts +8 -0
- package/dist/es/hcs-14/resolvers/hcs-11-profile.d.ts.map +1 -0
- package/dist/es/hcs-14/resolvers/profile-utils.d.ts +9 -0
- package/dist/es/hcs-14/resolvers/profile-utils.d.ts.map +1 -0
- package/dist/es/hcs-14/resolvers/registry.d.ts +21 -1
- package/dist/es/hcs-14/resolvers/registry.d.ts.map +1 -1
- package/dist/es/hcs-14/resolvers/types.d.ts +106 -5
- package/dist/es/hcs-14/resolvers/types.d.ts.map +1 -1
- package/dist/es/hcs-14/resolvers/uaid-did-resolution-profile.d.ts +10 -0
- package/dist/es/hcs-14/resolvers/uaid-did-resolution-profile.d.ts.map +1 -0
- package/dist/es/hcs-14/resolvers/uaid-dns-web-profile.d.ts +22 -0
- package/dist/es/hcs-14/resolvers/uaid-dns-web-profile.d.ts.map +1 -0
- package/dist/es/hcs-14/sdk.d.ts +16 -1
- package/dist/es/hcs-14/sdk.d.ts.map +1 -1
- package/dist/es/inscribe/inscriber.d.ts +1 -1
- package/dist/es/inscribe/inscriber.d.ts.map +1 -1
- package/dist/es/inscribe/inscription-cost.d.ts +12 -0
- package/dist/es/inscribe/inscription-cost.d.ts.map +1 -0
- package/dist/es/inscribe/types.d.ts +5 -1
- package/dist/es/inscribe/types.d.ts.map +1 -1
- package/dist/es/services/registry-broker/schemas.d.ts +1548 -0
- package/dist/es/services/registry-broker/schemas.d.ts.map +1 -1
- package/dist/es/standards-sdk.es.js +96 -83
- package/dist/es/standards-sdk.es.js.map +1 -1
- package/dist/es/standards-sdk.es100.js +41 -224
- package/dist/es/standards-sdk.es100.js.map +1 -1
- package/dist/es/standards-sdk.es101.js +249 -97
- package/dist/es/standards-sdk.es101.js.map +1 -1
- package/dist/es/standards-sdk.es102.js +95 -27
- package/dist/es/standards-sdk.es102.js.map +1 -1
- package/dist/es/standards-sdk.es103.js +97 -80
- package/dist/es/standards-sdk.es103.js.map +1 -1
- package/dist/es/standards-sdk.es104.js +29 -30
- package/dist/es/standards-sdk.es104.js.map +1 -1
- package/dist/es/standards-sdk.es105.js +229 -249
- package/dist/es/standards-sdk.es105.js.map +1 -1
- package/dist/es/standards-sdk.es106.js +103 -468
- package/dist/es/standards-sdk.es106.js.map +1 -1
- package/dist/es/standards-sdk.es107.js +32 -103
- package/dist/es/standards-sdk.es107.js.map +1 -1
- package/dist/es/standards-sdk.es108.js +79 -155
- package/dist/es/standards-sdk.es108.js.map +1 -1
- package/dist/es/standards-sdk.es109.js +28 -31
- package/dist/es/standards-sdk.es109.js.map +1 -1
- package/dist/es/standards-sdk.es11.js +1 -1
- package/dist/es/standards-sdk.es110.js +250 -10
- package/dist/es/standards-sdk.es110.js.map +1 -1
- package/dist/es/standards-sdk.es111.js +451 -115
- package/dist/es/standards-sdk.es111.js.map +1 -1
- package/dist/es/standards-sdk.es112.js +101 -25
- package/dist/es/standards-sdk.es112.js.map +1 -1
- package/dist/es/standards-sdk.es113.js +155 -17
- package/dist/es/standards-sdk.es113.js.map +1 -1
- package/dist/es/standards-sdk.es114.js +29 -155
- package/dist/es/standards-sdk.es114.js.map +1 -1
- package/dist/es/standards-sdk.es115.js +9 -200
- package/dist/es/standards-sdk.es115.js.map +1 -1
- package/dist/es/standards-sdk.es116.js +109 -757
- package/dist/es/standards-sdk.es116.js.map +1 -1
- package/dist/es/standards-sdk.es117.js +27 -11
- package/dist/es/standards-sdk.es117.js.map +1 -1
- package/dist/es/standards-sdk.es118.js +19 -564
- package/dist/es/standards-sdk.es118.js.map +1 -1
- package/dist/es/standards-sdk.es119.js +140 -582
- package/dist/es/standards-sdk.es119.js.map +1 -1
- package/dist/es/standards-sdk.es12.js +1 -1
- package/dist/es/standards-sdk.es120.js +202 -12
- package/dist/es/standards-sdk.es120.js.map +1 -1
- package/dist/es/standards-sdk.es121.js +790 -2
- package/dist/es/standards-sdk.es121.js.map +1 -1
- package/dist/es/standards-sdk.es122.js +10 -84
- package/dist/es/standards-sdk.es122.js.map +1 -1
- package/dist/es/standards-sdk.es123.js +567 -40
- package/dist/es/standards-sdk.es123.js.map +1 -1
- package/dist/es/standards-sdk.es124.js +602 -2
- package/dist/es/standards-sdk.es124.js.map +1 -1
- package/dist/es/standards-sdk.es125.js +12 -234
- package/dist/es/standards-sdk.es125.js.map +1 -1
- package/dist/es/standards-sdk.es126.js +2 -1140
- package/dist/es/standards-sdk.es126.js.map +1 -1
- package/dist/es/standards-sdk.es127.js +73 -292
- package/dist/es/standards-sdk.es127.js.map +1 -1
- package/dist/es/standards-sdk.es128.js +36 -418
- package/dist/es/standards-sdk.es128.js.map +1 -1
- package/dist/es/standards-sdk.es129.js +2 -355
- package/dist/es/standards-sdk.es129.js.map +1 -1
- package/dist/es/standards-sdk.es13.js +1 -1
- package/dist/es/standards-sdk.es130.js +197 -1090
- package/dist/es/standards-sdk.es130.js.map +1 -1
- package/dist/es/standards-sdk.es131.js +1107 -175
- package/dist/es/standards-sdk.es131.js.map +1 -1
- package/dist/es/standards-sdk.es132.js +218 -1479
- package/dist/es/standards-sdk.es132.js.map +1 -1
- package/dist/es/standards-sdk.es133.js +422 -1236
- package/dist/es/standards-sdk.es133.js.map +1 -1
- package/dist/es/standards-sdk.es134.js +351 -13
- package/dist/es/standards-sdk.es134.js.map +1 -1
- package/dist/es/standards-sdk.es135.js +1102 -73
- package/dist/es/standards-sdk.es135.js.map +1 -1
- package/dist/es/standards-sdk.es136.js +203 -76
- package/dist/es/standards-sdk.es136.js.map +1 -1
- package/dist/es/standards-sdk.es137.js +1459 -785
- package/dist/es/standards-sdk.es137.js.map +1 -1
- package/dist/es/standards-sdk.es138.js +1254 -59
- package/dist/es/standards-sdk.es138.js.map +1 -1
- package/dist/es/standards-sdk.es139.js +14 -156
- package/dist/es/standards-sdk.es139.js.map +1 -1
- package/dist/es/standards-sdk.es14.js +1 -1
- package/dist/es/standards-sdk.es140.js +87 -7
- package/dist/es/standards-sdk.es140.js.map +1 -1
- package/dist/es/standards-sdk.es141.js +74 -79
- package/dist/es/standards-sdk.es141.js.map +1 -1
- package/dist/es/standards-sdk.es142.js +889 -61
- package/dist/es/standards-sdk.es142.js.map +1 -1
- package/dist/es/standards-sdk.es143.js +60 -30
- package/dist/es/standards-sdk.es143.js.map +1 -1
- package/dist/es/standards-sdk.es144.js +159 -34
- package/dist/es/standards-sdk.es144.js.map +1 -1
- package/dist/es/standards-sdk.es145.js +7 -28
- package/dist/es/standards-sdk.es145.js.map +1 -1
- package/dist/es/standards-sdk.es146.js +70 -122
- package/dist/es/standards-sdk.es146.js.map +1 -1
- package/dist/es/standards-sdk.es147.js +58 -35
- package/dist/es/standards-sdk.es147.js.map +1 -1
- package/dist/es/standards-sdk.es148.js +30 -12320
- package/dist/es/standards-sdk.es148.js.map +1 -1
- package/dist/es/standards-sdk.es149.js +34 -56
- package/dist/es/standards-sdk.es149.js.map +1 -1
- package/dist/es/standards-sdk.es15.js +1 -1
- package/dist/es/standards-sdk.es150.js +41 -84
- package/dist/es/standards-sdk.es150.js.map +1 -1
- package/dist/es/standards-sdk.es151.js +134 -13
- package/dist/es/standards-sdk.es151.js.map +1 -1
- package/dist/es/standards-sdk.es152.js +36 -236
- package/dist/es/standards-sdk.es152.js.map +1 -1
- package/dist/es/standards-sdk.es153.js +12444 -134
- package/dist/es/standards-sdk.es153.js.map +1 -1
- package/dist/es/standards-sdk.es154.js +139 -289
- package/dist/es/standards-sdk.es154.js.map +1 -1
- package/dist/es/standards-sdk.es155.js +274 -298
- package/dist/es/standards-sdk.es155.js.map +1 -1
- package/dist/es/standards-sdk.es156.js +262 -369
- package/dist/es/standards-sdk.es156.js.map +1 -1
- package/dist/es/standards-sdk.es157.js +316 -194
- package/dist/es/standards-sdk.es157.js.map +1 -1
- package/dist/es/standards-sdk.es158.js +319 -64
- package/dist/es/standards-sdk.es158.js.map +1 -1
- package/dist/es/standards-sdk.es159.js +61 -157
- package/dist/es/standards-sdk.es159.js.map +1 -1
- package/dist/es/standards-sdk.es16.js +5 -5
- package/dist/es/standards-sdk.es160.js +14 -219
- package/dist/es/standards-sdk.es160.js.map +1 -1
- package/dist/es/standards-sdk.es161.js +226 -223
- package/dist/es/standards-sdk.es161.js.map +1 -1
- package/dist/es/standards-sdk.es162.js +49 -112
- package/dist/es/standards-sdk.es162.js.map +1 -1
- package/dist/es/standards-sdk.es163.js +72 -114
- package/dist/es/standards-sdk.es163.js.map +1 -1
- package/dist/es/standards-sdk.es164.js +67 -147
- package/dist/es/standards-sdk.es164.js.map +1 -1
- package/dist/es/standards-sdk.es165.js +61 -173
- package/dist/es/standards-sdk.es165.js.map +1 -1
- package/dist/es/standards-sdk.es166.js +153 -120
- package/dist/es/standards-sdk.es166.js.map +1 -1
- package/dist/es/standards-sdk.es167.js +178 -287
- package/dist/es/standards-sdk.es167.js.map +1 -1
- package/dist/es/standards-sdk.es168.js +218 -238
- package/dist/es/standards-sdk.es168.js.map +1 -1
- package/dist/es/standards-sdk.es169.js +75 -72
- package/dist/es/standards-sdk.es169.js.map +1 -1
- package/dist/es/standards-sdk.es170.js +129 -0
- package/dist/es/standards-sdk.es170.js.map +1 -0
- package/dist/es/standards-sdk.es171.js +164 -0
- package/dist/es/standards-sdk.es171.js.map +1 -0
- package/dist/es/standards-sdk.es172.js +188 -0
- package/dist/es/standards-sdk.es172.js.map +1 -0
- package/dist/es/standards-sdk.es173.js +142 -0
- package/dist/es/standards-sdk.es173.js.map +1 -0
- package/dist/es/standards-sdk.es174.js +334 -0
- package/dist/es/standards-sdk.es174.js.map +1 -0
- package/dist/es/standards-sdk.es175.js +262 -0
- package/dist/es/standards-sdk.es175.js.map +1 -0
- package/dist/es/standards-sdk.es176.js +119 -0
- package/dist/es/standards-sdk.es176.js.map +1 -0
- package/dist/es/standards-sdk.es18.js +12 -12
- package/dist/es/standards-sdk.es19.js +9 -9
- package/dist/es/standards-sdk.es2.js +2 -2
- package/dist/es/standards-sdk.es20.js +1 -1
- package/dist/es/standards-sdk.es21.js +1 -1
- package/dist/es/standards-sdk.es22.js +1 -1
- package/dist/es/standards-sdk.es23.js +1 -1
- package/dist/es/standards-sdk.es24.js +1 -1
- package/dist/es/standards-sdk.es25.js +1 -1
- package/dist/es/standards-sdk.es26.js +1 -1
- package/dist/es/standards-sdk.es27.js +12 -12
- package/dist/es/standards-sdk.es30.js +2 -2
- package/dist/es/standards-sdk.es31.js +4 -4
- package/dist/es/standards-sdk.es32.js +1 -1
- package/dist/es/standards-sdk.es35.js +6 -6
- package/dist/es/standards-sdk.es36.js +4 -4
- package/dist/es/standards-sdk.es37.js +2 -2
- package/dist/es/standards-sdk.es38.js +2 -2
- package/dist/es/standards-sdk.es39.js +1 -1
- package/dist/es/standards-sdk.es4.js +2 -2
- package/dist/es/standards-sdk.es40.js +1 -1
- package/dist/es/standards-sdk.es41.js +2 -2
- package/dist/es/standards-sdk.es46.js +1 -1
- package/dist/es/standards-sdk.es5.js +2 -2
- package/dist/es/standards-sdk.es51.js +1 -1
- package/dist/es/standards-sdk.es53.js +1 -1
- package/dist/es/standards-sdk.es56.js +2 -2
- package/dist/es/standards-sdk.es58.js +194 -13
- package/dist/es/standards-sdk.es58.js.map +1 -1
- package/dist/es/standards-sdk.es59.js +1 -1
- package/dist/es/standards-sdk.es6.js +2 -2
- package/dist/es/standards-sdk.es60.js +100 -192
- package/dist/es/standards-sdk.es60.js.map +1 -1
- package/dist/es/standards-sdk.es61.js +172 -24
- package/dist/es/standards-sdk.es61.js.map +1 -1
- package/dist/es/standards-sdk.es62.js +204 -77
- package/dist/es/standards-sdk.es62.js.map +1 -1
- package/dist/es/standards-sdk.es63.js +130 -3
- package/dist/es/standards-sdk.es63.js.map +1 -1
- package/dist/es/standards-sdk.es64.js +41 -95
- package/dist/es/standards-sdk.es64.js.map +1 -1
- package/dist/es/standards-sdk.es65.js +245 -88
- package/dist/es/standards-sdk.es65.js.map +1 -1
- package/dist/es/standards-sdk.es66.js +32 -17
- package/dist/es/standards-sdk.es66.js.map +1 -1
- package/dist/es/standards-sdk.es67.js +96 -77
- package/dist/es/standards-sdk.es67.js.map +1 -1
- package/dist/es/standards-sdk.es68.js +4 -458
- package/dist/es/standards-sdk.es68.js.map +1 -1
- package/dist/es/standards-sdk.es69.js +72 -295
- package/dist/es/standards-sdk.es69.js.map +1 -1
- package/dist/es/standards-sdk.es7.js +1 -1
- package/dist/es/standards-sdk.es70.js +86 -194
- package/dist/es/standards-sdk.es70.js.map +1 -1
- package/dist/es/standards-sdk.es71.js +16 -69
- package/dist/es/standards-sdk.es71.js.map +1 -1
- package/dist/es/standards-sdk.es72.js +69 -63
- package/dist/es/standards-sdk.es72.js.map +1 -1
- package/dist/es/standards-sdk.es73.js +458 -143
- package/dist/es/standards-sdk.es73.js.map +1 -1
- package/dist/es/standards-sdk.es74.js +298 -43
- package/dist/es/standards-sdk.es74.js.map +1 -1
- package/dist/es/standards-sdk.es75.js +174 -370
- package/dist/es/standards-sdk.es75.js.map +1 -1
- package/dist/es/standards-sdk.es76.js +71 -495
- package/dist/es/standards-sdk.es76.js.map +1 -1
- package/dist/es/standards-sdk.es77.js +71 -365
- package/dist/es/standards-sdk.es77.js.map +1 -1
- package/dist/es/standards-sdk.es78.js +137 -83
- package/dist/es/standards-sdk.es78.js.map +1 -1
- package/dist/es/standards-sdk.es79.js +69 -125
- package/dist/es/standards-sdk.es79.js.map +1 -1
- package/dist/es/standards-sdk.es80.js +402 -6
- package/dist/es/standards-sdk.es80.js.map +1 -1
- package/dist/es/standards-sdk.es81.js +492 -43
- package/dist/es/standards-sdk.es81.js.map +1 -1
- package/dist/es/standards-sdk.es82.js +350 -86
- package/dist/es/standards-sdk.es82.js.map +1 -1
- package/dist/es/standards-sdk.es83.js +88 -347
- package/dist/es/standards-sdk.es83.js.map +1 -1
- package/dist/es/standards-sdk.es84.js +125 -281
- package/dist/es/standards-sdk.es84.js.map +1 -1
- package/dist/es/standards-sdk.es85.js +6 -59
- package/dist/es/standards-sdk.es85.js.map +1 -1
- package/dist/es/standards-sdk.es86.js +43 -45
- package/dist/es/standards-sdk.es86.js.map +1 -1
- package/dist/es/standards-sdk.es87.js +86 -135
- package/dist/es/standards-sdk.es87.js.map +1 -1
- package/dist/es/standards-sdk.es88.js +333 -52
- package/dist/es/standards-sdk.es88.js.map +1 -1
- package/dist/es/standards-sdk.es89.js +277 -26
- package/dist/es/standards-sdk.es89.js.map +1 -1
- package/dist/es/standards-sdk.es9.js +2 -2
- package/dist/es/standards-sdk.es90.js +59 -23
- package/dist/es/standards-sdk.es90.js.map +1 -1
- package/dist/es/standards-sdk.es91.js +26 -217
- package/dist/es/standards-sdk.es91.js.map +1 -1
- package/dist/es/standards-sdk.es92.js +104 -236
- package/dist/es/standards-sdk.es92.js.map +1 -1
- package/dist/es/standards-sdk.es93.js +51 -141
- package/dist/es/standards-sdk.es93.js.map +1 -1
- package/dist/es/standards-sdk.es94.js +22 -137
- package/dist/es/standards-sdk.es94.js.map +1 -1
- package/dist/es/standards-sdk.es95.js +20 -44
- package/dist/es/standards-sdk.es95.js.map +1 -1
- package/dist/es/standards-sdk.es96.js +227 -252
- package/dist/es/standards-sdk.es96.js.map +1 -1
- package/dist/es/standards-sdk.es97.js +248 -68
- package/dist/es/standards-sdk.es97.js.map +1 -1
- package/dist/es/standards-sdk.es98.js +108 -52
- package/dist/es/standards-sdk.es98.js.map +1 -1
- package/dist/es/standards-sdk.es99.js +144 -29
- package/dist/es/standards-sdk.es99.js.map +1 -1
- package/package.json +14 -4
|
@@ -1,481 +1,116 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const minor = Number(match[2]);
|
|
16
|
-
const patch = Number(match[3]);
|
|
17
|
-
if (![major, minor, patch].every(Number.isFinite)) {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
const prereleaseRaw = match[4];
|
|
21
|
-
const prerelease = prereleaseRaw ? prereleaseRaw.split(".").map((part) => {
|
|
22
|
-
if (/^(0|[1-9]\d*)$/.test(part)) {
|
|
23
|
-
return Number(part);
|
|
24
|
-
}
|
|
25
|
-
return part;
|
|
26
|
-
}) : [];
|
|
27
|
-
return { major, minor, patch, prerelease };
|
|
28
|
-
}
|
|
29
|
-
function compareSemver(a, b) {
|
|
30
|
-
if (a.major !== b.major) return a.major - b.major;
|
|
31
|
-
if (a.minor !== b.minor) return a.minor - b.minor;
|
|
32
|
-
if (a.patch !== b.patch) return a.patch - b.patch;
|
|
33
|
-
const aHasPre = a.prerelease.length > 0;
|
|
34
|
-
const bHasPre = b.prerelease.length > 0;
|
|
35
|
-
if (!aHasPre && bHasPre) return 1;
|
|
36
|
-
if (aHasPre && !bHasPre) return -1;
|
|
37
|
-
if (!aHasPre && !bHasPre) return 0;
|
|
38
|
-
const len = Math.max(a.prerelease.length, b.prerelease.length);
|
|
39
|
-
for (let index = 0; index < len; index += 1) {
|
|
40
|
-
const aId = a.prerelease[index];
|
|
41
|
-
const bId = b.prerelease[index];
|
|
42
|
-
if (aId === void 0 && bId !== void 0) return -1;
|
|
43
|
-
if (aId !== void 0 && bId === void 0) return 1;
|
|
44
|
-
if (aId === bId) continue;
|
|
45
|
-
if (typeof aId === "number" && typeof bId === "number") {
|
|
46
|
-
return aId - bId;
|
|
47
|
-
}
|
|
48
|
-
if (typeof aId === "number" && typeof bId === "string") {
|
|
49
|
-
return -1;
|
|
50
|
-
}
|
|
51
|
-
if (typeof aId === "string" && typeof bId === "number") {
|
|
52
|
-
return 1;
|
|
53
|
-
}
|
|
54
|
-
if (typeof aId === "string" && typeof bId === "string") {
|
|
55
|
-
return aId < bId ? -1 : 1;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return 0;
|
|
59
|
-
}
|
|
60
|
-
function isActiveStatus(status) {
|
|
61
|
-
return !status || status === "active";
|
|
62
|
-
}
|
|
63
|
-
function normalizeUidString(value) {
|
|
64
|
-
if (typeof value !== "string") {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
const trimmed = value.trim();
|
|
68
|
-
return trimmed.length > 0 ? trimmed : null;
|
|
69
|
-
}
|
|
70
|
-
function resolveSequenceNumber(primary, fallback) {
|
|
71
|
-
if (typeof primary === "number") {
|
|
72
|
-
return primary;
|
|
73
|
-
}
|
|
74
|
-
if (typeof fallback === "number") {
|
|
75
|
-
return fallback;
|
|
76
|
-
}
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
function parseSequenceFromUid(uid) {
|
|
80
|
-
if (!/^\d+$/.test(uid)) {
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
const parsed = Number(uid);
|
|
84
|
-
return Number.isSafeInteger(parsed) ? parsed : null;
|
|
85
|
-
}
|
|
86
|
-
function ensureNonEmptyString(value, field) {
|
|
87
|
-
if (typeof value !== "string") {
|
|
88
|
-
throw new Error(`Expected ${field} to be a string`);
|
|
89
|
-
}
|
|
90
|
-
const trimmed = value.trim();
|
|
91
|
-
if (!trimmed) {
|
|
92
|
-
throw new Error(`Expected ${field} to be a non-empty string`);
|
|
93
|
-
}
|
|
94
|
-
return trimmed;
|
|
95
|
-
}
|
|
96
|
-
function mergeDiscoveryMetadata(base, update) {
|
|
97
|
-
if (!update) {
|
|
98
|
-
return base;
|
|
99
|
-
}
|
|
100
|
-
return { ...base, ...update };
|
|
101
|
-
}
|
|
102
|
-
function normalizeDiscoveryRegister(input, messageSequenceNumber) {
|
|
103
|
-
const seq = typeof input.sequence_number === "number" ? input.sequence_number : typeof messageSequenceNumber === "number" ? messageSequenceNumber : void 0;
|
|
104
|
-
if ("t_id" in input) {
|
|
105
|
-
return {
|
|
106
|
-
p: "hcs-26",
|
|
107
|
-
op: "register",
|
|
108
|
-
t_id: ensureNonEmptyString(input.t_id, "t_id"),
|
|
109
|
-
account_id: ensureNonEmptyString(input.account_id, "account_id"),
|
|
110
|
-
metadata: input.metadata,
|
|
111
|
-
...input.m ? { m: input.m } : {},
|
|
112
|
-
...typeof seq === "number" ? { sequence_number: seq } : {}
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
return {
|
|
116
|
-
p: "hcs-26",
|
|
117
|
-
op: "register",
|
|
118
|
-
t_id: ensureNonEmptyString(input.version_registry, "version_registry"),
|
|
119
|
-
account_id: ensureNonEmptyString(input.publisher, "publisher"),
|
|
120
|
-
metadata: input.metadata,
|
|
121
|
-
...input.m ? { m: input.m } : {},
|
|
122
|
-
...typeof seq === "number" ? { sequence_number: seq } : {}
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
class Hcs26SkillRegistryResolver {
|
|
126
|
-
constructor(deps) {
|
|
127
|
-
this.network = deps.network;
|
|
128
|
-
this.logger = deps.logger ?? Logger.getInstance({
|
|
129
|
-
module: "HCS26Resolver",
|
|
130
|
-
level: "info"
|
|
1
|
+
import { Client } from "@hashgraph/sdk";
|
|
2
|
+
import { Logger } from "./standards-sdk.es116.js";
|
|
3
|
+
import { createNodeOperatorContext } from "./standards-sdk.es151.js";
|
|
4
|
+
import { buildHcs18CreateDiscoveryTopicTx, buildHcs18AnnounceMessage, buildHcs18SubmitDiscoveryMessageTx, buildHcs18ProposeMessage, buildHcs18RespondMessage, buildHcs18CompleteMessage, buildHcs18WithdrawMessage } from "./standards-sdk.es108.js";
|
|
5
|
+
import { HCS18BaseClient } from "./standards-sdk.es109.js";
|
|
6
|
+
class HCS18Client extends HCS18BaseClient {
|
|
7
|
+
constructor(config) {
|
|
8
|
+
super({
|
|
9
|
+
network: config.network,
|
|
10
|
+
logger: Logger.getInstance({
|
|
11
|
+
level: config.logLevel || "info",
|
|
12
|
+
module: "HCS-18",
|
|
13
|
+
silent: config.silent
|
|
14
|
+
})
|
|
131
15
|
});
|
|
132
|
-
this.
|
|
133
|
-
deps.network,
|
|
134
|
-
this.logger,
|
|
135
|
-
deps.mirrorNode
|
|
136
|
-
);
|
|
137
|
-
this.hrlResolver = new HRLResolver("warn");
|
|
138
|
-
}
|
|
139
|
-
async resolveDiscoveryMetadataHrl(metadataHrl, mode) {
|
|
140
|
-
const resolved = await this.hrlResolver.resolve(metadataHrl, {
|
|
16
|
+
this.operatorCtx = createNodeOperatorContext({
|
|
141
17
|
network: this.network,
|
|
142
|
-
|
|
18
|
+
operatorId: config.operatorId,
|
|
19
|
+
operatorKey: config.operatorKey,
|
|
20
|
+
mirrorNode: this.mirrorNode,
|
|
21
|
+
logger: this.logger,
|
|
22
|
+
client: Client.forName(this.network)
|
|
143
23
|
});
|
|
144
|
-
|
|
145
|
-
let raw;
|
|
146
|
-
try {
|
|
147
|
-
raw = JSON.parse(bytes.toString("utf8"));
|
|
148
|
-
} catch {
|
|
149
|
-
throw new Error("Discovery metadata HRL content is not valid JSON");
|
|
150
|
-
}
|
|
151
|
-
const schema = mode === "full" ? hcs26DiscoveryMetadataSchema : hcs26DiscoveryMetadataPatchSchema;
|
|
152
|
-
const parsed = schema.safeParse(raw);
|
|
153
|
-
if (!parsed.success) {
|
|
154
|
-
throw new Error(`Invalid discovery metadata: ${parsed.error.message}`);
|
|
155
|
-
}
|
|
156
|
-
return this.normalizeDiscoveryMetadataObject(
|
|
157
|
-
parsed.data
|
|
158
|
-
);
|
|
159
|
-
}
|
|
160
|
-
normalizeDiscoveryMetadataObject(metadata) {
|
|
161
|
-
if (typeof metadata.icon !== "string" || metadata.icon.trim().length === 0) {
|
|
162
|
-
const iconLegacy = metadata.icon_hcs1;
|
|
163
|
-
if (typeof iconLegacy === "string" && iconLegacy.trim().length > 0) {
|
|
164
|
-
return { ...metadata, icon: iconLegacy };
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
return metadata;
|
|
24
|
+
this.client = this.operatorCtx.client;
|
|
168
25
|
}
|
|
169
|
-
async
|
|
170
|
-
|
|
171
|
-
if (trimmed.startsWith("hcs://1/")) {
|
|
172
|
-
return this.resolveDiscoveryMetadataHrl(trimmed, mode);
|
|
173
|
-
}
|
|
174
|
-
throw new Error(`Unsupported discovery metadata URI: ${trimmed}`);
|
|
175
|
-
}
|
|
176
|
-
resolveDiscoveryMetadataObject(params) {
|
|
177
|
-
if (typeof params.metadata === "string") {
|
|
178
|
-
return this.resolveDiscoveryMetadataUri(params.metadata, params.mode);
|
|
179
|
-
}
|
|
180
|
-
const schema = params.mode === "full" ? hcs26DiscoveryMetadataSchema : hcs26DiscoveryMetadataPatchSchema;
|
|
181
|
-
const parsed = schema.safeParse(params.metadata);
|
|
182
|
-
if (!parsed.success) {
|
|
183
|
-
throw new Error(`Invalid discovery metadata: ${parsed.error.message}`);
|
|
184
|
-
}
|
|
185
|
-
return Promise.resolve(
|
|
186
|
-
this.normalizeDiscoveryMetadataObject(
|
|
187
|
-
parsed.data
|
|
188
|
-
)
|
|
189
|
-
);
|
|
26
|
+
async ensureInitialized() {
|
|
27
|
+
await this.operatorCtx.ensureInitialized();
|
|
190
28
|
}
|
|
191
|
-
async
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
207
|
-
const normalized = normalizeDiscoveryRegister(
|
|
208
|
-
parsed.data,
|
|
209
|
-
message.sequence_number
|
|
210
|
-
);
|
|
211
|
-
const seq = normalized.sequence_number;
|
|
212
|
-
if (typeof seq === "number" && seq === params.skillUid) {
|
|
213
|
-
const metadata = await this.resolveDiscoveryMetadataObject({
|
|
214
|
-
metadata: normalized.metadata,
|
|
215
|
-
mode: "full"
|
|
216
|
-
});
|
|
217
|
-
return { ...normalized, metadata };
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
return null;
|
|
221
|
-
}
|
|
222
|
-
async resolveDiscoveryRecord(params) {
|
|
223
|
-
const register = await this.getDiscoveryRegister({
|
|
224
|
-
directoryTopicId: params.directoryTopicId,
|
|
225
|
-
skillUid: params.skillUid
|
|
29
|
+
async createDiscoveryTopic(options) {
|
|
30
|
+
await this.ensureInitialized();
|
|
31
|
+
const ttl = options?.ttlSeconds;
|
|
32
|
+
let operatorPublicKey;
|
|
33
|
+
try {
|
|
34
|
+
operatorPublicKey = this.operatorCtx.operatorKey.publicKey;
|
|
35
|
+
} catch {
|
|
36
|
+
operatorPublicKey = void 0;
|
|
37
|
+
}
|
|
38
|
+
const tx = buildHcs18CreateDiscoveryTopicTx({
|
|
39
|
+
ttlSeconds: ttl,
|
|
40
|
+
adminKey: options?.adminKey,
|
|
41
|
+
submitKey: options?.submitKey,
|
|
42
|
+
operatorPublicKey,
|
|
43
|
+
memoOverride: options?.memoOverride
|
|
226
44
|
});
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
);
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
params.
|
|
242
|
-
);
|
|
243
|
-
let current = register;
|
|
244
|
-
for (const message of messages) {
|
|
245
|
-
const messageSequence = resolveSequenceNumber(
|
|
246
|
-
void 0,
|
|
247
|
-
message.sequence_number
|
|
248
|
-
);
|
|
249
|
-
const deleteParsed = hcs26DiscoveryDeleteSchema.safeParse(message);
|
|
250
|
-
if (deleteParsed.success && deleteParsed.data.uid === uid) {
|
|
251
|
-
const deleteSequence = resolveSequenceNumber(
|
|
252
|
-
deleteParsed.data.sequence_number,
|
|
253
|
-
messageSequence
|
|
254
|
-
);
|
|
255
|
-
if (registerSequence !== null && deleteSequence !== null && deleteSequence <= registerSequence) {
|
|
256
|
-
continue;
|
|
257
|
-
}
|
|
258
|
-
return null;
|
|
259
|
-
}
|
|
260
|
-
const updateParsedNew = hcs26DiscoveryUpdateSchema.safeParse(message);
|
|
261
|
-
const updateParsedLegacy = updateParsedNew.success ? null : hcs26DiscoveryUpdateLegacySchema.safeParse(message);
|
|
262
|
-
const updateParsed = updateParsedNew.success ? updateParsedNew : updateParsedLegacy && updateParsedLegacy.success ? updateParsedLegacy : null;
|
|
263
|
-
if (!updateParsed || updateParsed.data.uid !== uid) {
|
|
264
|
-
continue;
|
|
265
|
-
}
|
|
266
|
-
const updateSequence = resolveSequenceNumber(
|
|
267
|
-
updateParsed.data.sequence_number,
|
|
268
|
-
messageSequence
|
|
269
|
-
);
|
|
270
|
-
if (registerSequence !== null && updateSequence !== null && updateSequence <= registerSequence) {
|
|
271
|
-
continue;
|
|
272
|
-
}
|
|
273
|
-
const nextAccountId = "account_id" in updateParsed.data ? normalizeUidString(updateParsed.data.account_id) : normalizeUidString(updateParsed.data.publisher);
|
|
274
|
-
const nextMetadataRaw = updateParsed.data.metadata;
|
|
275
|
-
const nextMetadata = nextMetadataRaw !== void 0 ? await this.resolveDiscoveryMetadataObject({
|
|
276
|
-
metadata: nextMetadataRaw,
|
|
277
|
-
mode: "patch"
|
|
278
|
-
}) : void 0;
|
|
279
|
-
current = {
|
|
280
|
-
...current,
|
|
281
|
-
...nextAccountId ? { account_id: nextAccountId } : {},
|
|
282
|
-
metadata: mergeDiscoveryMetadata(current.metadata, nextMetadata)
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
return current;
|
|
286
|
-
}
|
|
287
|
-
async listVersionRegisters(params) {
|
|
288
|
-
const limit = typeof params.limit === "number" && params.limit > 0 ? Math.min(1e3, params.limit) : 500;
|
|
289
|
-
const messages = await this.mirrorNode.getTopicMessages(
|
|
290
|
-
params.versionRegistryTopicId,
|
|
291
|
-
{
|
|
292
|
-
limit,
|
|
293
|
-
order: "desc"
|
|
294
|
-
}
|
|
295
|
-
);
|
|
296
|
-
const registersByUid = /* @__PURE__ */ new Map();
|
|
297
|
-
const updatesByUid = /* @__PURE__ */ new Map();
|
|
298
|
-
const deletedByUid = /* @__PURE__ */ new Map();
|
|
299
|
-
for (const message of messages) {
|
|
300
|
-
const parsedNew = hcs26VersionRegisterSchema.safeParse(message);
|
|
301
|
-
const parsedLegacy = parsedNew.success ? null : hcs26VersionRegisterLegacySchema.safeParse(message);
|
|
302
|
-
const registerParsed = parsedNew.success ? parsedNew : parsedLegacy && parsedLegacy.success ? parsedLegacy : null;
|
|
303
|
-
if (registerParsed) {
|
|
304
|
-
if (registerParsed.data.skill_uid !== params.skillUid) {
|
|
305
|
-
continue;
|
|
306
|
-
}
|
|
307
|
-
const uid = typeof registerParsed.data.sequence_number === "number" ? String(registerParsed.data.sequence_number) : typeof message.sequence_number === "number" ? String(message.sequence_number) : null;
|
|
308
|
-
if (uid) {
|
|
309
|
-
const registerSequence = resolveSequenceNumber(
|
|
310
|
-
registerParsed.data.sequence_number,
|
|
311
|
-
message.sequence_number
|
|
312
|
-
);
|
|
313
|
-
registersByUid.set(uid, {
|
|
314
|
-
register: registerParsed.data,
|
|
315
|
-
sequenceNumber: registerSequence
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
continue;
|
|
319
|
-
}
|
|
320
|
-
const updateParsed = hcs26VersionUpdateSchema.safeParse(message);
|
|
321
|
-
if (updateParsed.success) {
|
|
322
|
-
const uid = updateParsed.data.uid.trim();
|
|
323
|
-
const list = updatesByUid.get(uid) ?? [];
|
|
324
|
-
list.push({
|
|
325
|
-
update: updateParsed.data,
|
|
326
|
-
sequenceNumber: resolveSequenceNumber(
|
|
327
|
-
updateParsed.data.sequence_number,
|
|
328
|
-
message.sequence_number
|
|
329
|
-
)
|
|
330
|
-
});
|
|
331
|
-
updatesByUid.set(uid, list);
|
|
332
|
-
continue;
|
|
333
|
-
}
|
|
334
|
-
const deleteParsed = hcs26VersionDeleteSchema.safeParse(message);
|
|
335
|
-
if (deleteParsed.success) {
|
|
336
|
-
const uid = deleteParsed.data.uid.trim();
|
|
337
|
-
const list = deletedByUid.get(uid) ?? [];
|
|
338
|
-
const sequenceNumber = resolveSequenceNumber(
|
|
339
|
-
deleteParsed.data.sequence_number,
|
|
340
|
-
message.sequence_number
|
|
341
|
-
);
|
|
342
|
-
if (sequenceNumber !== null) {
|
|
343
|
-
list.push(sequenceNumber);
|
|
344
|
-
deletedByUid.set(uid, list);
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
const entries = [];
|
|
349
|
-
for (const [uid, registerState] of registersByUid.entries()) {
|
|
350
|
-
const registerSequence = registerState.sequenceNumber ?? parseSequenceFromUid(uid);
|
|
351
|
-
const deleteSequences = deletedByUid.get(uid) ?? [];
|
|
352
|
-
const hasDeleteAfterRegister = deleteSequences.some(
|
|
353
|
-
(sequence) => registerSequence === null ? true : sequence > registerSequence
|
|
354
|
-
);
|
|
355
|
-
if (hasDeleteAfterRegister) {
|
|
356
|
-
continue;
|
|
357
|
-
}
|
|
358
|
-
const updates = updatesByUid.get(uid);
|
|
359
|
-
if (!updates || updates.length === 0) {
|
|
360
|
-
entries.push(registerState.register);
|
|
361
|
-
continue;
|
|
362
|
-
}
|
|
363
|
-
const sorted = [...updates].filter(
|
|
364
|
-
(update) => registerSequence === null ? true : update.sequenceNumber !== null && update.sequenceNumber > registerSequence
|
|
365
|
-
).sort((a, b) => {
|
|
366
|
-
const aSeq = a.sequenceNumber ?? 0;
|
|
367
|
-
const bSeq = b.sequenceNumber ?? 0;
|
|
368
|
-
return aSeq - bSeq;
|
|
369
|
-
});
|
|
370
|
-
if (sorted.length === 0) {
|
|
371
|
-
entries.push(registerState.register);
|
|
372
|
-
continue;
|
|
373
|
-
}
|
|
374
|
-
const final = sorted.reduce((acc, updateState) => {
|
|
375
|
-
if (updateState.update.status) {
|
|
376
|
-
return { ...acc, status: updateState.update.status };
|
|
377
|
-
}
|
|
378
|
-
return acc;
|
|
379
|
-
}, registerState.register);
|
|
380
|
-
entries.push(final);
|
|
381
|
-
}
|
|
382
|
-
return entries;
|
|
383
|
-
}
|
|
384
|
-
async getLatestVersionRegister(params) {
|
|
385
|
-
const entries = await this.listVersionRegisters({
|
|
386
|
-
versionRegistryTopicId: params.versionRegistryTopicId,
|
|
387
|
-
skillUid: params.skillUid,
|
|
388
|
-
limit: 100
|
|
45
|
+
const resp = await tx.execute(this.client);
|
|
46
|
+
const receipt = await resp.getReceipt(this.client);
|
|
47
|
+
const topicId = receipt.topicId?.toString();
|
|
48
|
+
if (!topicId) {
|
|
49
|
+
throw new Error("Failed to create discovery topic");
|
|
50
|
+
}
|
|
51
|
+
return { topicId, receipt };
|
|
52
|
+
}
|
|
53
|
+
async announce(params) {
|
|
54
|
+
await this.ensureInitialized();
|
|
55
|
+
const message = buildHcs18AnnounceMessage(params.data);
|
|
56
|
+
const tx = buildHcs18SubmitDiscoveryMessageTx({
|
|
57
|
+
topicId: params.discoveryTopicId,
|
|
58
|
+
message,
|
|
59
|
+
transactionMemo: params.memo
|
|
389
60
|
});
|
|
390
|
-
const
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
continue;
|
|
403
|
-
}
|
|
404
|
-
if (bestParsed && candidateParsed) {
|
|
405
|
-
const cmp = compareSemver(candidateParsed, bestParsed);
|
|
406
|
-
if (cmp > 0) {
|
|
407
|
-
best = candidate;
|
|
408
|
-
bestParsed = candidateParsed;
|
|
409
|
-
continue;
|
|
410
|
-
}
|
|
411
|
-
if (cmp === 0) {
|
|
412
|
-
const bestSeq = typeof best.sequence_number === "number" ? best.sequence_number : 0;
|
|
413
|
-
const candSeq = typeof candidate.sequence_number === "number" ? candidate.sequence_number : 0;
|
|
414
|
-
if (candSeq > bestSeq) {
|
|
415
|
-
best = candidate;
|
|
416
|
-
bestParsed = candidateParsed;
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
return best;
|
|
422
|
-
}
|
|
423
|
-
async resolveManifest(params) {
|
|
424
|
-
const manifestHrl = typeof params.manifestHrl === "string" && params.manifestHrl.trim().length > 0 ? params.manifestHrl.trim() : typeof params.manifestTopicId === "string" && params.manifestTopicId.trim().length > 0 ? `hcs://1/${params.manifestTopicId.trim()}` : null;
|
|
425
|
-
if (!manifestHrl) {
|
|
426
|
-
throw new Error("Manifest HRL or topic id is required");
|
|
427
|
-
}
|
|
428
|
-
const resolved = await this.hrlResolver.resolve(manifestHrl, {
|
|
429
|
-
network: this.network,
|
|
430
|
-
returnRaw: true
|
|
61
|
+
const resp = await tx.execute(this.client);
|
|
62
|
+
const receipt = await resp.getReceipt(this.client);
|
|
63
|
+
const seq = receipt.topicSequenceNumber.toNumber();
|
|
64
|
+
return { receipt, sequenceNumber: seq };
|
|
65
|
+
}
|
|
66
|
+
async propose(params) {
|
|
67
|
+
await this.ensureInitialized();
|
|
68
|
+
const message = buildHcs18ProposeMessage(params.data);
|
|
69
|
+
const tx = buildHcs18SubmitDiscoveryMessageTx({
|
|
70
|
+
topicId: params.discoveryTopicId,
|
|
71
|
+
message,
|
|
72
|
+
transactionMemo: params.memo
|
|
431
73
|
});
|
|
432
|
-
const
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
const
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
const
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
}
|
|
470
|
-
const expectedHex = checksum.slice("sha256:".length);
|
|
471
|
-
if (params.manifestSha256Hex !== expectedHex) {
|
|
472
|
-
throw new Error(
|
|
473
|
-
`Manifest checksum mismatch (expected ${expectedHex}, got ${params.manifestSha256Hex})`
|
|
474
|
-
);
|
|
475
|
-
}
|
|
74
|
+
const resp = await tx.execute(this.client);
|
|
75
|
+
const receipt = await resp.getReceipt(this.client);
|
|
76
|
+
const seq = receipt.topicSequenceNumber.toNumber();
|
|
77
|
+
return { receipt, sequenceNumber: seq };
|
|
78
|
+
}
|
|
79
|
+
async respond(params) {
|
|
80
|
+
await this.ensureInitialized();
|
|
81
|
+
const message = buildHcs18RespondMessage(params.data);
|
|
82
|
+
const tx = buildHcs18SubmitDiscoveryMessageTx({
|
|
83
|
+
topicId: params.discoveryTopicId,
|
|
84
|
+
message,
|
|
85
|
+
transactionMemo: params.memo
|
|
86
|
+
});
|
|
87
|
+
const resp = await tx.execute(this.client);
|
|
88
|
+
return await resp.getReceipt(this.client);
|
|
89
|
+
}
|
|
90
|
+
async complete(params) {
|
|
91
|
+
await this.ensureInitialized();
|
|
92
|
+
const message = buildHcs18CompleteMessage(params.data);
|
|
93
|
+
const tx = buildHcs18SubmitDiscoveryMessageTx({
|
|
94
|
+
topicId: params.discoveryTopicId,
|
|
95
|
+
message,
|
|
96
|
+
transactionMemo: params.memo
|
|
97
|
+
});
|
|
98
|
+
const resp = await tx.execute(this.client);
|
|
99
|
+
return await resp.getReceipt(this.client);
|
|
100
|
+
}
|
|
101
|
+
async withdraw(params) {
|
|
102
|
+
await this.ensureInitialized();
|
|
103
|
+
const message = buildHcs18WithdrawMessage(params.data);
|
|
104
|
+
const tx = buildHcs18SubmitDiscoveryMessageTx({
|
|
105
|
+
topicId: params.discoveryTopicId,
|
|
106
|
+
message,
|
|
107
|
+
transactionMemo: params.memo
|
|
108
|
+
});
|
|
109
|
+
const resp = await tx.execute(this.client);
|
|
110
|
+
return await resp.getReceipt(this.client);
|
|
476
111
|
}
|
|
477
112
|
}
|
|
478
113
|
export {
|
|
479
|
-
|
|
114
|
+
HCS18Client
|
|
480
115
|
};
|
|
481
116
|
//# sourceMappingURL=standards-sdk.es106.js.map
|