@hashgraphonline/standards-sdk 0.1.141-canary.8 → 0.1.141-feat-hcs-21-flora-adapter.canary.cff94ea.45
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/README.md +13 -1
- package/dist/cjs/hcs-16/base-client.d.ts.map +1 -1
- package/dist/cjs/hcs-17/types.d.ts.map +1 -1
- package/dist/cjs/hcs-20/sdk.d.ts.map +1 -1
- package/dist/cjs/hcs-20/types.d.ts +9 -8
- package/dist/cjs/hcs-20/types.d.ts.map +1 -1
- package/dist/cjs/hcs-21/base-client.d.ts +4 -3
- package/dist/cjs/hcs-21/base-client.d.ts.map +1 -1
- package/dist/cjs/hcs-21/index.d.ts +1 -0
- package/dist/cjs/hcs-21/index.d.ts.map +1 -1
- package/dist/cjs/hcs-21/sdk.d.ts.map +1 -1
- package/dist/cjs/hcs-21/tx.d.ts.map +1 -1
- package/dist/cjs/hcs-21/types.d.ts +135 -64
- package/dist/cjs/hcs-21/types.d.ts.map +1 -1
- package/dist/cjs/hcs-21/verify.d.ts +6 -0
- package/dist/cjs/hcs-21/verify.d.ts.map +1 -0
- package/dist/cjs/inscribe/inscriber.d.ts +1 -0
- package/dist/cjs/inscribe/inscriber.d.ts.map +1 -1
- package/dist/cjs/inscribe/quote-cache.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client.d.ts +4 -3
- package/dist/cjs/services/registry-broker/client.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/private-key-signer.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/schemas.d.ts +38 -38
- 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/cjs/utils/dynamic-import.d.ts +1 -0
- package/dist/cjs/utils/dynamic-import.d.ts.map +1 -1
- package/dist/es/hcs-16/base-client.d.ts.map +1 -1
- package/dist/es/hcs-17/types.d.ts.map +1 -1
- package/dist/es/hcs-20/sdk.d.ts.map +1 -1
- package/dist/es/hcs-20/types.d.ts +9 -8
- package/dist/es/hcs-20/types.d.ts.map +1 -1
- package/dist/es/hcs-21/base-client.d.ts +4 -3
- package/dist/es/hcs-21/base-client.d.ts.map +1 -1
- package/dist/es/hcs-21/index.d.ts +1 -0
- package/dist/es/hcs-21/index.d.ts.map +1 -1
- package/dist/es/hcs-21/sdk.d.ts.map +1 -1
- package/dist/es/hcs-21/tx.d.ts.map +1 -1
- package/dist/es/hcs-21/types.d.ts +135 -64
- package/dist/es/hcs-21/types.d.ts.map +1 -1
- package/dist/es/hcs-21/verify.d.ts +6 -0
- package/dist/es/hcs-21/verify.d.ts.map +1 -0
- package/dist/es/inscribe/inscriber.d.ts +1 -0
- package/dist/es/inscribe/inscriber.d.ts.map +1 -1
- package/dist/es/inscribe/quote-cache.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client.d.ts +4 -3
- package/dist/es/services/registry-broker/client.d.ts.map +1 -1
- package/dist/es/services/registry-broker/private-key-signer.d.ts.map +1 -1
- package/dist/es/services/registry-broker/schemas.d.ts +38 -38
- package/dist/es/services/registry-broker/schemas.d.ts.map +1 -1
- package/dist/es/standards-sdk.es.js +58 -50
- package/dist/es/standards-sdk.es.js.map +1 -1
- package/dist/es/standards-sdk.es10.js +2 -2
- package/dist/es/standards-sdk.es100.js +26 -229
- package/dist/es/standards-sdk.es100.js.map +1 -1
- package/dist/es/standards-sdk.es101.js +228 -109
- package/dist/es/standards-sdk.es101.js.map +1 -1
- package/dist/es/standards-sdk.es102.js +94 -15
- package/dist/es/standards-sdk.es102.js.map +1 -1
- package/dist/es/standards-sdk.es103.js +30 -80
- package/dist/es/standards-sdk.es103.js.map +1 -1
- package/dist/es/standards-sdk.es104.js +80 -27
- package/dist/es/standards-sdk.es104.js.map +1 -1
- package/dist/es/standards-sdk.es105.js +25 -136
- package/dist/es/standards-sdk.es105.js.map +1 -1
- package/dist/es/standards-sdk.es106.js +140 -27
- package/dist/es/standards-sdk.es106.js.map +1 -1
- package/dist/es/standards-sdk.es107.js +27 -20
- package/dist/es/standards-sdk.es107.js.map +1 -1
- package/dist/es/standards-sdk.es108.js +18 -156
- package/dist/es/standards-sdk.es108.js.map +1 -1
- package/dist/es/standards-sdk.es109.js +148 -196
- package/dist/es/standards-sdk.es109.js.map +1 -1
- package/dist/es/standards-sdk.es110.js +160 -747
- package/dist/es/standards-sdk.es110.js.map +1 -1
- package/dist/es/standards-sdk.es111.js +786 -9
- package/dist/es/standards-sdk.es111.js.map +1 -1
- package/dist/es/standards-sdk.es112.js +13 -567
- package/dist/es/standards-sdk.es112.js.map +1 -1
- package/dist/es/standards-sdk.es113.js +541 -576
- package/dist/es/standards-sdk.es113.js.map +1 -1
- package/dist/es/standards-sdk.es114.js +601 -12
- package/dist/es/standards-sdk.es114.js.map +1 -1
- package/dist/es/standards-sdk.es115.js +13 -2
- package/dist/es/standards-sdk.es115.js.map +1 -1
- package/dist/es/standards-sdk.es116.js +2 -83
- package/dist/es/standards-sdk.es116.js.map +1 -1
- package/dist/es/standards-sdk.es117.js +80 -36
- package/dist/es/standards-sdk.es117.js.map +1 -1
- package/dist/es/standards-sdk.es118.js +39 -2
- package/dist/es/standards-sdk.es118.js.map +1 -1
- package/dist/es/standards-sdk.es119.js +2 -223
- package/dist/es/standards-sdk.es119.js.map +1 -1
- package/dist/es/standards-sdk.es120.js +193 -1110
- package/dist/es/standards-sdk.es120.js.map +1 -1
- package/dist/es/standards-sdk.es121.js +1059 -225
- package/dist/es/standards-sdk.es121.js.map +1 -1
- package/dist/es/standards-sdk.es122.js +303 -419
- package/dist/es/standards-sdk.es122.js.map +1 -1
- package/dist/es/standards-sdk.es123.js +418 -351
- package/dist/es/standards-sdk.es123.js.map +1 -1
- package/dist/es/standards-sdk.es124.js +348 -785
- package/dist/es/standards-sdk.es124.js.map +1 -1
- package/dist/es/standards-sdk.es125.js +767 -183
- package/dist/es/standards-sdk.es125.js.map +1 -1
- package/dist/es/standards-sdk.es126.js +153 -1512
- package/dist/es/standards-sdk.es126.js.map +1 -1
- package/dist/es/standards-sdk.es127.js +1373 -1987
- package/dist/es/standards-sdk.es127.js.map +1 -1
- package/dist/es/standards-sdk.es128.js +2208 -67
- package/dist/es/standards-sdk.es128.js.map +1 -1
- package/dist/es/standards-sdk.es129.js +59 -79
- package/dist/es/standards-sdk.es129.js.map +1 -1
- package/dist/es/standards-sdk.es130.js +80 -152
- package/dist/es/standards-sdk.es130.js.map +1 -1
- package/dist/es/standards-sdk.es131.js +159 -7
- package/dist/es/standards-sdk.es131.js.map +1 -1
- package/dist/es/standards-sdk.es132.js +7 -86
- package/dist/es/standards-sdk.es132.js.map +1 -1
- package/dist/es/standards-sdk.es133.js +65 -44
- package/dist/es/standards-sdk.es133.js.map +1 -1
- package/dist/es/standards-sdk.es134.js +65 -28
- package/dist/es/standards-sdk.es134.js.map +1 -1
- package/dist/es/standards-sdk.es135.js +82 -760
- package/dist/es/standards-sdk.es135.js.map +1 -1
- package/dist/es/standards-sdk.es136.js +28 -12274
- package/dist/es/standards-sdk.es136.js.map +1 -1
- package/dist/es/standards-sdk.es137.js +1 -1
- package/dist/es/standards-sdk.es14.js +1 -1
- package/dist/es/standards-sdk.es140.js +766 -64
- package/dist/es/standards-sdk.es140.js.map +1 -1
- package/dist/es/standards-sdk.es141.js +12235 -133
- package/dist/es/standards-sdk.es141.js.map +1 -1
- package/dist/es/standards-sdk.es142.js +13 -318
- package/dist/es/standards-sdk.es142.js.map +1 -1
- package/dist/es/standards-sdk.es143.js +120 -294
- package/dist/es/standards-sdk.es143.js.map +1 -1
- package/dist/es/standards-sdk.es144.js +191 -322
- package/dist/es/standards-sdk.es144.js.map +1 -1
- package/dist/es/standards-sdk.es145.js +294 -279
- package/dist/es/standards-sdk.es145.js.map +1 -1
- package/dist/es/standards-sdk.es146.js +440 -63
- package/dist/es/standards-sdk.es146.js.map +1 -1
- package/dist/es/standards-sdk.es147.js +327 -13
- package/dist/es/standards-sdk.es147.js.map +1 -1
- package/dist/es/standards-sdk.es148.js +79 -0
- package/dist/es/standards-sdk.es148.js.map +1 -0
- package/dist/es/standards-sdk.es15.js +1 -1
- package/dist/es/standards-sdk.es16.js +1 -1
- package/dist/es/standards-sdk.es17.js +5 -11
- package/dist/es/standards-sdk.es17.js.map +1 -1
- package/dist/es/standards-sdk.es19.js +10 -15
- package/dist/es/standards-sdk.es19.js.map +1 -1
- package/dist/es/standards-sdk.es2.js +26 -72
- package/dist/es/standards-sdk.es2.js.map +1 -1
- package/dist/es/standards-sdk.es20.js +9 -14
- package/dist/es/standards-sdk.es20.js.map +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.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 +1 -1
- package/dist/es/standards-sdk.es28.js +11 -16
- package/dist/es/standards-sdk.es28.js.map +1 -1
- package/dist/es/standards-sdk.es3.js +2 -2
- package/dist/es/standards-sdk.es31.js +2 -2
- package/dist/es/standards-sdk.es32.js +4 -4
- package/dist/es/standards-sdk.es33.js +1 -1
- package/dist/es/standards-sdk.es36.js +6 -12
- package/dist/es/standards-sdk.es36.js.map +1 -1
- 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 +2 -2
- package/dist/es/standards-sdk.es40.js +1 -1
- package/dist/es/standards-sdk.es41.js +1 -1
- package/dist/es/standards-sdk.es42.js +2 -2
- package/dist/es/standards-sdk.es47.js +1 -1
- package/dist/es/standards-sdk.es5.js +1 -1
- package/dist/es/standards-sdk.es52.js +1 -1
- package/dist/es/standards-sdk.es57.js +1 -1
- package/dist/es/standards-sdk.es6.js +2 -2
- package/dist/es/standards-sdk.es60.js +1 -1
- package/dist/es/standards-sdk.es61.js +6 -11
- package/dist/es/standards-sdk.es61.js.map +1 -1
- package/dist/es/standards-sdk.es63.js +1 -1
- package/dist/es/standards-sdk.es65.js +2 -2
- package/dist/es/standards-sdk.es66.js +2 -2
- package/dist/es/standards-sdk.es7.js +2 -2
- package/dist/es/standards-sdk.es70.js +2 -2
- package/dist/es/standards-sdk.es71.js +2 -2
- package/dist/es/standards-sdk.es73.js.map +1 -1
- package/dist/es/standards-sdk.es75.js +2 -2
- package/dist/es/standards-sdk.es77.js +4 -2
- package/dist/es/standards-sdk.es77.js.map +1 -1
- package/dist/es/standards-sdk.es78.js +4 -10
- package/dist/es/standards-sdk.es78.js.map +1 -1
- package/dist/es/standards-sdk.es80.js +26 -15
- package/dist/es/standards-sdk.es80.js.map +1 -1
- package/dist/es/standards-sdk.es82.js +11 -3
- package/dist/es/standards-sdk.es82.js.map +1 -1
- package/dist/es/standards-sdk.es83.js +7 -6
- package/dist/es/standards-sdk.es83.js.map +1 -1
- package/dist/es/standards-sdk.es84.js +6 -4
- package/dist/es/standards-sdk.es84.js.map +1 -1
- package/dist/es/standards-sdk.es86.js +55 -21
- package/dist/es/standards-sdk.es86.js.map +1 -1
- package/dist/es/standards-sdk.es87.js +22 -75
- package/dist/es/standards-sdk.es87.js.map +1 -1
- package/dist/es/standards-sdk.es88.js +45 -30
- package/dist/es/standards-sdk.es88.js.map +1 -1
- package/dist/es/standards-sdk.es89.js +57 -22
- package/dist/es/standards-sdk.es89.js.map +1 -1
- package/dist/es/standards-sdk.es90.js +28 -23
- package/dist/es/standards-sdk.es90.js.map +1 -1
- package/dist/es/standards-sdk.es91.js +23 -167
- package/dist/es/standards-sdk.es91.js.map +1 -1
- package/dist/es/standards-sdk.es92.js +158 -119
- package/dist/es/standards-sdk.es92.js.map +1 -1
- package/dist/es/standards-sdk.es93.js +68 -95
- package/dist/es/standards-sdk.es93.js.map +1 -1
- package/dist/es/standards-sdk.es94.js +136 -119
- package/dist/es/standards-sdk.es94.js.map +1 -1
- package/dist/es/standards-sdk.es95.js +139 -39
- package/dist/es/standards-sdk.es95.js.map +1 -1
- package/dist/es/standards-sdk.es96.js +42 -257
- package/dist/es/standards-sdk.es96.js.map +1 -1
- package/dist/es/standards-sdk.es97.js +243 -80
- package/dist/es/standards-sdk.es97.js.map +1 -1
- package/dist/es/standards-sdk.es98.js +47 -48
- package/dist/es/standards-sdk.es98.js.map +1 -1
- package/dist/es/standards-sdk.es99.js +100 -28
- package/dist/es/standards-sdk.es99.js.map +1 -1
- package/dist/es/utils/dynamic-import.d.ts +1 -0
- package/dist/es/utils/dynamic-import.d.ts.map +1 -1
- package/package.json +63 -65
|
@@ -1,143 +1,160 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
this.
|
|
9
|
-
this.logger = params.logger || new Logger({ level: "info", module: "HCS-16" });
|
|
10
|
-
this.mirrorNode = new HederaMirrorNode(this.network, this.logger, {
|
|
11
|
-
customUrl: params.mirrorNodeUrl
|
|
12
|
-
});
|
|
1
|
+
import { ScheduleSignTransaction } from "@hashgraph/sdk";
|
|
2
|
+
import { buildHcs16CreateFloraTopicTx, buildHcs16FloraCreatedTx, buildHcs16TransactionTx, buildHcs16StateUpdateTx, buildHcs16CreateAccountTx, buildHcs16FloraJoinRequestTx, buildHcs16FloraJoinVoteTx, buildHcs16FloraJoinAcceptedTx } from "./standards-sdk.es92.js";
|
|
3
|
+
import { HCS16BaseClient } from "./standards-sdk.es95.js";
|
|
4
|
+
class HCS16BrowserClient extends HCS16BaseClient {
|
|
5
|
+
constructor(config) {
|
|
6
|
+
super({ network: config.network });
|
|
7
|
+
this.hwc = config.hwc;
|
|
8
|
+
this.signer = config.signer;
|
|
13
9
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
ensureConnected() {
|
|
11
|
+
if (this.signer && typeof this.signer.getAccountId === "function") {
|
|
12
|
+
return this.signer.getAccountId().toString();
|
|
13
|
+
}
|
|
14
|
+
const info = this.hwc?.getAccountInfo?.();
|
|
15
|
+
const accountId = info?.accountId;
|
|
16
|
+
if (!accountId) {
|
|
17
|
+
throw new Error("No active wallet connection");
|
|
19
18
|
}
|
|
20
|
-
return
|
|
19
|
+
return accountId;
|
|
21
20
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const pub = await this.mirrorNode.getPublicKey(accountId);
|
|
26
|
-
keys.push(pub);
|
|
21
|
+
getSigner() {
|
|
22
|
+
if (this.signer) {
|
|
23
|
+
return this.signer;
|
|
27
24
|
}
|
|
28
|
-
|
|
25
|
+
this.ensureConnected();
|
|
26
|
+
const s = this.hwc?.dAppConnector?.signers?.[0];
|
|
27
|
+
if (!s) {
|
|
28
|
+
throw new Error("No active wallet signer");
|
|
29
|
+
}
|
|
30
|
+
return s;
|
|
29
31
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
adminKey: params.keyList,
|
|
35
|
-
submitKey: params.submitList,
|
|
36
|
-
autoRenewAccountId: params.autoRenewAccountId
|
|
37
|
-
});
|
|
38
|
-
const transaction = buildHcs16CreateFloraTopicTx({
|
|
32
|
+
async createFloraTopic(params) {
|
|
33
|
+
this.ensureConnected();
|
|
34
|
+
const signer = this.getSigner();
|
|
35
|
+
const tx = buildHcs16CreateFloraTopicTx({
|
|
39
36
|
floraAccountId: params.floraAccountId,
|
|
40
|
-
topicType:
|
|
41
|
-
adminKey: params.
|
|
42
|
-
submitKey: params.
|
|
37
|
+
topicType: params.topicType,
|
|
38
|
+
adminKey: params.adminKey,
|
|
39
|
+
submitKey: params.submitKey,
|
|
43
40
|
autoRenewAccountId: params.autoRenewAccountId
|
|
44
41
|
});
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
autoRenewAccountId: params.autoRenewAccountId
|
|
51
|
-
});
|
|
52
|
-
return { communication, transaction, state };
|
|
42
|
+
const frozen = await tx.freezeWithSigner(signer);
|
|
43
|
+
const res = await frozen.executeWithSigner(signer);
|
|
44
|
+
const receipt = await res.getReceiptWithSigner(signer);
|
|
45
|
+
const topicId = receipt?.topicId?.toString?.() || "";
|
|
46
|
+
return topicId;
|
|
53
47
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (!match) {
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
return {
|
|
63
|
-
protocol: "hcs-16",
|
|
64
|
-
floraAccountId: match[1],
|
|
65
|
-
topicType: Number(match[2])
|
|
66
|
-
};
|
|
48
|
+
async sendFloraCreated(params) {
|
|
49
|
+
const signer = this.getSigner();
|
|
50
|
+
const tx = buildHcs16FloraCreatedTx(params);
|
|
51
|
+
const frozen = await tx.freezeWithSigner(signer);
|
|
52
|
+
await frozen.executeWithSigner(signer);
|
|
67
53
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
p: "hcs-16",
|
|
74
|
-
op,
|
|
75
|
-
operator_id: operatorId,
|
|
76
|
-
...body || {}
|
|
77
|
-
};
|
|
78
|
-
return payload;
|
|
54
|
+
async sendTransaction(params) {
|
|
55
|
+
const signer = this.getSigner();
|
|
56
|
+
const tx = buildHcs16TransactionTx(params);
|
|
57
|
+
const frozen = await tx.freezeWithSigner(signer);
|
|
58
|
+
await frozen.executeWithSigner(signer);
|
|
79
59
|
}
|
|
80
60
|
/**
|
|
81
|
-
*
|
|
61
|
+
* Wallet-signed ScheduleSign for a given scheduleId.
|
|
82
62
|
*/
|
|
83
|
-
async
|
|
84
|
-
const
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
const results = [];
|
|
88
|
-
for (const raw of items) {
|
|
89
|
-
if (raw.p !== "hcs-16") {
|
|
90
|
-
continue;
|
|
91
|
-
}
|
|
92
|
-
const {
|
|
93
|
-
consensus_timestamp,
|
|
94
|
-
sequence_number,
|
|
95
|
-
running_hash,
|
|
96
|
-
running_hash_version,
|
|
97
|
-
topic_id,
|
|
98
|
-
payer,
|
|
99
|
-
created,
|
|
100
|
-
chunk_info,
|
|
101
|
-
...payload
|
|
102
|
-
} = raw;
|
|
103
|
-
const op = payload.op;
|
|
104
|
-
const operatorId = payload.operator_id;
|
|
105
|
-
if (options?.opFilter && op !== options.opFilter) {
|
|
106
|
-
continue;
|
|
107
|
-
}
|
|
108
|
-
if (typeof operatorId !== "string") {
|
|
109
|
-
continue;
|
|
110
|
-
}
|
|
111
|
-
const message = payload;
|
|
112
|
-
results.push({
|
|
113
|
-
message,
|
|
114
|
-
consensus_timestamp,
|
|
115
|
-
sequence_number: Number(sequence_number),
|
|
116
|
-
payer
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
return results;
|
|
63
|
+
async signSchedule(params) {
|
|
64
|
+
const signer = this.getSigner();
|
|
65
|
+
const tx = await new ScheduleSignTransaction().setScheduleId(params.scheduleId).freezeWithSigner(signer);
|
|
66
|
+
await tx.executeWithSigner(signer);
|
|
120
67
|
}
|
|
68
|
+
async sendStateUpdate(params) {
|
|
69
|
+
const signer = this.getSigner();
|
|
70
|
+
const tx = buildHcs16StateUpdateTx(params);
|
|
71
|
+
const frozen = await tx.freezeWithSigner(signer);
|
|
72
|
+
await frozen.executeWithSigner(signer);
|
|
73
|
+
}
|
|
74
|
+
/** credit_purchase is not part of HCS-16 specification */
|
|
121
75
|
/**
|
|
122
|
-
*
|
|
76
|
+
* Create Flora account and C/T/S topics using DAppSigner.
|
|
77
|
+
* - Account KeyList = threshold of members
|
|
78
|
+
* - Topic submitKey = 1-of-M KeyList of members
|
|
79
|
+
* Returns created Flora account ID and topic IDs.
|
|
123
80
|
*/
|
|
124
|
-
async
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
81
|
+
async createFloraAccountWithTopics(params) {
|
|
82
|
+
const signer = this.getSigner();
|
|
83
|
+
const keyList = await this.assembleKeyList({
|
|
84
|
+
members: params.members,
|
|
85
|
+
threshold: params.threshold
|
|
86
|
+
});
|
|
87
|
+
const submitList = await this.assembleSubmitKeyList(params.members);
|
|
88
|
+
const createAcc = buildHcs16CreateAccountTx({
|
|
89
|
+
keyList,
|
|
90
|
+
initialBalanceHbar: typeof params.initialBalanceHbar === "number" ? params.initialBalanceHbar : 5,
|
|
91
|
+
maxAutomaticTokenAssociations: -1
|
|
129
92
|
});
|
|
130
|
-
|
|
131
|
-
|
|
93
|
+
const accFrozen = await createAcc.freezeWithSigner(signer);
|
|
94
|
+
const accExec = await accFrozen.executeWithSigner(signer);
|
|
95
|
+
const accReceipt = await accExec.getReceiptWithSigner(signer);
|
|
96
|
+
const floraAccountId = accReceipt?.accountId?.toString?.();
|
|
97
|
+
if (!floraAccountId) {
|
|
98
|
+
throw new Error("Failed to create Flora account");
|
|
132
99
|
}
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
100
|
+
const {
|
|
101
|
+
communication: commTx,
|
|
102
|
+
transaction: trnTx,
|
|
103
|
+
state: stateTx
|
|
104
|
+
} = this.buildFloraTopicCreateTxs({
|
|
105
|
+
floraAccountId,
|
|
106
|
+
keyList,
|
|
107
|
+
submitList,
|
|
108
|
+
autoRenewAccountId: params.autoRenewAccountId
|
|
109
|
+
});
|
|
110
|
+
const commR = await (await (await commTx.freezeWithSigner(signer)).executeWithSigner(signer)).getReceiptWithSigner(signer);
|
|
111
|
+
const trnR = await (await (await trnTx.freezeWithSigner(signer)).executeWithSigner(signer)).getReceiptWithSigner(signer);
|
|
112
|
+
const stateR = await (await (await stateTx.freezeWithSigner(signer)).executeWithSigner(signer)).getReceiptWithSigner(signer);
|
|
113
|
+
const topics = {
|
|
114
|
+
communication: commR?.topicId?.toString?.() || "",
|
|
115
|
+
transaction: trnR?.topicId?.toString?.() || "",
|
|
116
|
+
state: stateR?.topicId?.toString?.() || ""
|
|
117
|
+
};
|
|
118
|
+
return { floraAccountId, topics };
|
|
119
|
+
}
|
|
120
|
+
/** Publish flora_created on the communication topic. */
|
|
121
|
+
async publishFloraCreated(params) {
|
|
122
|
+
const signer = this.getSigner();
|
|
123
|
+
const tx = buildHcs16FloraCreatedTx({
|
|
124
|
+
topicId: params.communicationTopicId,
|
|
125
|
+
operatorId: params.operatorId,
|
|
126
|
+
floraAccountId: params.floraAccountId,
|
|
127
|
+
topics: params.topics
|
|
137
128
|
});
|
|
129
|
+
const frozen = await tx.freezeWithSigner(signer);
|
|
130
|
+
await frozen.executeWithSigner(signer);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Post flora_join_request on Flora communication topic.
|
|
134
|
+
* If submitKey=1/M, a member must relay the message.
|
|
135
|
+
*/
|
|
136
|
+
async sendFloraJoinRequest(params) {
|
|
137
|
+
const signer = this.getSigner();
|
|
138
|
+
const tx = buildHcs16FloraJoinRequestTx(params);
|
|
139
|
+
const frozen = await tx.freezeWithSigner(signer);
|
|
140
|
+
await frozen.executeWithSigner(signer);
|
|
141
|
+
}
|
|
142
|
+
/** Post flora_join_vote approval/rejection on the communication topic. */
|
|
143
|
+
async sendFloraJoinVote(params) {
|
|
144
|
+
const signer = this.getSigner();
|
|
145
|
+
const tx = buildHcs16FloraJoinVoteTx(params);
|
|
146
|
+
const frozen = await tx.freezeWithSigner(signer);
|
|
147
|
+
await frozen.executeWithSigner(signer);
|
|
148
|
+
}
|
|
149
|
+
/** Post flora_join_accepted after threshold approval. */
|
|
150
|
+
async sendFloraJoinAccepted(params) {
|
|
151
|
+
const signer = this.getSigner();
|
|
152
|
+
const tx = buildHcs16FloraJoinAcceptedTx(params);
|
|
153
|
+
const frozen = await tx.freezeWithSigner(signer);
|
|
154
|
+
await frozen.executeWithSigner(signer);
|
|
138
155
|
}
|
|
139
156
|
}
|
|
140
157
|
export {
|
|
141
|
-
|
|
158
|
+
HCS16BrowserClient
|
|
142
159
|
};
|
|
143
160
|
//# sourceMappingURL=standards-sdk.es94.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es94.js","sources":["../../src/hcs-16/base-client.ts"],"sourcesContent":["import { HederaMirrorNode } from '../services/mirror-node';\nimport { KeyList, TopicCreateTransaction, PublicKey } from '@hashgraph/sdk';\nimport { buildHcs16CreateFloraTopicTx } from './tx';\nimport { Logger, ILogger } from '../utils/logger';\nimport { NetworkType } from '../utils/types';\nimport { FloraTopicType, FloraMessage, FloraOperation } from './types';\nimport type { HCSMessageWithCommonFields } from '../services/types';\n\n/**\n * Base client for HCS‑16 functionality. Provides logging, mirror‑node access,\n * memo helpers, and light message utilities shared by Node and Browser clients.\n */\nexport class HCS16BaseClient {\n protected readonly network: NetworkType;\n public mirrorNode: HederaMirrorNode;\n protected readonly logger: ILogger;\n\n constructor(params: {\n network: NetworkType;\n logger?: ILogger;\n mirrorNodeUrl?: string;\n }) {\n this.network = params.network;\n this.logger =\n params.logger || new Logger({ level: 'info', module: 'HCS-16' });\n this.mirrorNode = new HederaMirrorNode(this.network, this.logger, {\n customUrl: params.mirrorNodeUrl,\n });\n }\n\n async assembleKeyList(params: {\n members: string[];\n threshold: number;\n }): Promise<KeyList> {\n const keys: PublicKey[] = [];\n for (const accountId of params.members) {\n const pub = await this.mirrorNode.getPublicKey(accountId);\n keys.push(pub);\n }\n return new KeyList(keys, params.threshold);\n }\n\n async assembleSubmitKeyList(members: string[]): Promise<KeyList> {\n const keys: PublicKey[] = [];\n for (const accountId of members) {\n const pub = await this.mirrorNode.getPublicKey(accountId);\n keys.push(pub);\n }\n return new KeyList(keys, 1);\n }\n\n buildFloraTopicCreateTxs(params: {\n floraAccountId: string;\n keyList: KeyList;\n submitList: KeyList;\n autoRenewAccountId?: string;\n }): {\n communication: TopicCreateTransaction;\n transaction: TopicCreateTransaction;\n state: TopicCreateTransaction;\n } {\n const communication = buildHcs16CreateFloraTopicTx({\n floraAccountId: params.floraAccountId,\n topicType: FloraTopicType.COMMUNICATION,\n adminKey: params.keyList,\n submitKey: params.submitList,\n autoRenewAccountId: params.autoRenewAccountId,\n });\n const transaction = buildHcs16CreateFloraTopicTx({\n floraAccountId: params.floraAccountId,\n topicType: FloraTopicType.TRANSACTION,\n adminKey: params.keyList,\n submitKey: params.submitList,\n autoRenewAccountId: params.autoRenewAccountId,\n });\n const state = buildHcs16CreateFloraTopicTx({\n floraAccountId: params.floraAccountId,\n topicType: FloraTopicType.STATE,\n adminKey: params.keyList,\n submitKey: params.submitList,\n autoRenewAccountId: params.autoRenewAccountId,\n });\n return { communication, transaction, state };\n }\n\n /**\n * Parse an HCS‑16 Flora topic memo of the form `hcs-16:<floraAccountId>:<topicType>`.\n */\n parseTopicMemo(memo: string): {\n protocol: 'hcs-16';\n floraAccountId: string;\n topicType: FloraTopicType;\n } | null {\n const match = memo.match(/^hcs-16:([0-9.]+):(\\d)$/);\n if (!match) {\n return null;\n }\n return {\n protocol: 'hcs-16',\n floraAccountId: match[1],\n topicType: Number(match[2]) as FloraTopicType,\n };\n }\n\n /**\n * Build a Flora message envelope by merging an operation body into the HCS‑16 envelope.\n */\n protected createFloraMessage(\n op: FloraOperation,\n operatorId: string,\n body?: Record<string, unknown>,\n ): FloraMessage {\n const payload: FloraMessage = {\n p: 'hcs-16',\n op,\n operator_id: operatorId,\n ...(body || {}),\n } as FloraMessage;\n return payload;\n }\n\n /**\n * Fetch recent HCS‑16 messages from a topic via Mirror Node.\n */\n async getRecentMessages(\n topicId: string,\n options?: {\n limit?: number;\n order?: 'asc' | 'desc';\n opFilter?: FloraOperation | string;\n },\n ): Promise<\n Array<{\n message: FloraMessage;\n consensus_timestamp?: string;\n sequence_number: number;\n payer?: string;\n }>\n > {\n const limit = options?.limit ?? 25;\n const order = options?.order ?? 'desc';\n const items: HCSMessageWithCommonFields[] =\n await this.mirrorNode.getTopicMessages(topicId, { limit, order });\n\n const results: Array<{\n message: FloraMessage;\n consensus_timestamp?: string;\n sequence_number: number;\n payer?: string;\n }> = [];\n\n for (const raw of items) {\n if (raw.p !== 'hcs-16') {\n continue;\n }\n\n const {\n consensus_timestamp,\n sequence_number,\n running_hash,\n running_hash_version,\n topic_id,\n payer,\n created,\n chunk_info,\n ...payload\n } = raw as unknown as Record<string, unknown>;\n\n const op = payload.op as FloraOperation | string | undefined;\n const operatorId = payload.operator_id as string | undefined;\n\n if (options?.opFilter && op !== options.opFilter) {\n continue;\n }\n if (typeof operatorId !== 'string') {\n continue;\n }\n\n const message = payload as unknown as FloraMessage;\n\n results.push({\n message,\n consensus_timestamp: consensus_timestamp as string | undefined,\n sequence_number: Number(sequence_number),\n payer: payer as string | undefined,\n });\n }\n return results;\n }\n\n /**\n * Return the latest valid HCS‑16 message on a topic, if any.\n */\n async getLatestMessage(\n topicId: string,\n opFilter?: FloraOperation | string,\n ): Promise<\n | (FloraMessage & { consensus_timestamp?: string; sequence_number: number })\n | null\n > {\n const items = await this.getRecentMessages(topicId, {\n limit: 1,\n order: 'desc',\n opFilter,\n });\n if (items.length === 0) {\n return null;\n }\n const first = items[0];\n return Object.assign({}, first.message, {\n consensus_timestamp: first.consensus_timestamp,\n sequence_number: first.sequence_number,\n });\n }\n}\n"],"names":[],"mappings":";;;;;AAYO,MAAM,gBAAgB;AAAA,EAK3B,YAAY,QAIT;AACD,SAAK,UAAU,OAAO;AACtB,SAAK,SACH,OAAO,UAAU,IAAI,OAAO,EAAE,OAAO,QAAQ,QAAQ,UAAU;AACjE,SAAK,aAAa,IAAI,iBAAiB,KAAK,SAAS,KAAK,QAAQ;AAAA,MAChE,WAAW,OAAO;AAAA,IAAA,CACnB;AAAA,EACH;AAAA,EAEA,MAAM,gBAAgB,QAGD;AACnB,UAAM,OAAoB,CAAA;AAC1B,eAAW,aAAa,OAAO,SAAS;AACtC,YAAM,MAAM,MAAM,KAAK,WAAW,aAAa,SAAS;AACxD,WAAK,KAAK,GAAG;AAAA,IACf;AACA,WAAO,IAAI,QAAQ,MAAM,OAAO,SAAS;AAAA,EAC3C;AAAA,EAEA,M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AA;AAAA;AAAA;AAAA,EAKA,MAAM,kBACJ,SACA,SAYA;AACA,UAAM,QAAQ,SAAS,SAAS;AAChC,UAAM,QAAQ,SAAS,SAAS;AAChC,UAAM,QACJ,MAAM,KAAK,WAAW,iBAAiB,SAAS,EAAE,OAAO,OAAO;AAElE,UAAM,UAKD,CAAA;AAEL,eAAW,OAAO,OAAO;AACvB,UAAI,IAAI,MAAM,UAAU;AACtB;AAAA,MACF;AAEA,YAAM;AAAA,QACJ;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,GAAG;AAAA,MAAA,IACD;AAEJ,YAAM,KAAK,QAAQ;AACnB,YAAM,aAAa,QAAQ;AAE3B,UAAI,SAAS,YAAY,OAAO,QAAQ,UAAU;AAChD;AAAA,MACF;AACA,UAAI,OAAO,eAAe,UAAU;AAClC;AAAA,MACF;AAEA,YAAM,UAAU;AAEhB,cAAQ,KAAK;AAAA,QACX;AAAA,QACA;AAAA,QACA,iBAAiB,OAAO,eAAe;AAAA,QACvC;AAAA,MAAA,CACD;AAAA,IACH;AACA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,iBACJ,SACA,UAIA;AACA,UAAM,QAAQ,MAAM,KAAK,kBAAkB,SAAS;AAAA,MAClD,OAAO;AAAA,MACP,OAAO;AAAA,MACP;AAAA,IAAA,CACD;AACD,QAAI,MAAM,WAAW,GAAG;AACtB,aAAO;AAAA,IACT;AACA,UAAM,QAAQ,MAAM,CAAC;AACrB,WAAO,OAAO,OAAO,IAAI,MAAM,SAAS;AAAA,MACtC,qBAAqB,MAAM;AAAA,MAC3B,iBAAiB,MAAM;AAAA,IAAA,CACxB;AAAA,EACH;AACF;"}
|
|
1
|
+
{"version":3,"file":"standards-sdk.es94.js","sources":["../../src/hcs-16/browser.ts"],"sourcesContent":["import type { HashinalsWalletConnectSDK } from '@hashgraphonline/hashinal-wc';\nimport type { DAppSigner } from '@hashgraph/hedera-wallet-connect';\nimport type { PublicKey, KeyList } from '@hashgraph/sdk';\nimport { ScheduleSignTransaction } from '@hashgraph/sdk';\nimport {\n buildHcs16CreateFloraTopicTx,\n buildHcs16FloraCreatedTx,\n buildHcs16TransactionTx,\n buildHcs16StateUpdateTx,\n buildHcs16FloraJoinRequestTx,\n buildHcs16FloraJoinVoteTx,\n buildHcs16FloraJoinAcceptedTx,\n buildHcs16CreateAccountTx,\n} from './tx';\nimport { FloraTopicType } from './types';\nimport { HCS16BaseClient } from './base-client';\n\nexport interface HCS16BrowserClientConfig {\n network: 'testnet' | 'mainnet';\n hwc?: HashinalsWalletConnectSDK;\n signer?: DAppSigner;\n}\n\n/**\n * Browser client for HCS‑16 operations using a DAppSigner.\n */\nexport class HCS16BrowserClient extends HCS16BaseClient {\n private readonly hwc?: HashinalsWalletConnectSDK;\n private readonly signer?: DAppSigner;\n\n constructor(config: HCS16BrowserClientConfig) {\n super({ network: config.network });\n this.hwc = config.hwc;\n this.signer = config.signer;\n }\n\n private ensureConnected(): string {\n if (\n this.signer &&\n typeof (this.signer as DAppSigner).getAccountId === 'function'\n ) {\n return (this.signer as DAppSigner).getAccountId().toString();\n }\n const info = this.hwc?.getAccountInfo?.();\n const accountId = info?.accountId;\n if (!accountId) {\n throw new Error('No active wallet connection');\n }\n return accountId;\n }\n\n private getSigner(): DAppSigner {\n if (this.signer) {\n return this.signer;\n }\n this.ensureConnected();\n const s = this.hwc?.dAppConnector?.signers?.[0];\n if (!s) {\n throw new Error('No active wallet signer');\n }\n return s as unknown as DAppSigner;\n }\n\n async createFloraTopic(params: {\n floraAccountId: string;\n topicType: FloraTopicType;\n adminKey?: PublicKey | KeyList;\n submitKey?: PublicKey | KeyList;\n autoRenewAccountId?: string;\n }): Promise<string> {\n this.ensureConnected();\n const signer = this.getSigner();\n const tx = buildHcs16CreateFloraTopicTx({\n floraAccountId: params.floraAccountId,\n topicType: params.topicType,\n adminKey: params.adminKey,\n submitKey: params.submitKey,\n autoRenewAccountId: params.autoRenewAccountId,\n });\n const frozen = await tx.freezeWithSigner(signer);\n const res = await frozen.executeWithSigner(signer);\n const receipt = await res.getReceiptWithSigner(signer);\n const topicId = receipt?.topicId?.toString?.() || '';\n return topicId;\n }\n\n async sendFloraCreated(params: {\n topicId: string;\n operatorId: string;\n floraAccountId: string;\n topics: { communication: string; transaction: string; state: string };\n }): Promise<void> {\n const signer = this.getSigner();\n const tx = buildHcs16FloraCreatedTx(params);\n const frozen = await tx.freezeWithSigner(signer);\n await frozen.executeWithSigner(signer);\n }\n\n async sendTransaction(params: {\n topicId: string;\n operatorId: string;\n scheduleId: string;\n data?: string;\n }): Promise<void> {\n const signer = this.getSigner();\n const tx = buildHcs16TransactionTx(params);\n const frozen = await tx.freezeWithSigner(signer);\n await frozen.executeWithSigner(signer);\n }\n\n /**\n * Wallet-signed ScheduleSign for a given scheduleId.\n */\n async signSchedule(params: { scheduleId: string }): Promise<void> {\n const signer = this.getSigner();\n const tx = await new ScheduleSignTransaction()\n .setScheduleId(params.scheduleId)\n .freezeWithSigner(signer);\n await tx.executeWithSigner(signer);\n }\n\n async sendStateUpdate(params: {\n topicId: string;\n operatorId: string;\n hash: string;\n epoch?: number;\n }): Promise<void> {\n const signer = this.getSigner();\n const tx = buildHcs16StateUpdateTx(params);\n const frozen = await tx.freezeWithSigner(signer);\n await frozen.executeWithSigner(signer);\n }\n\n /** credit_purchase is not part of HCS-16 specification */\n\n /**\n * Create Flora account and C/T/S topics using DAppSigner.\n * - Account KeyList = threshold of members\n * - Topic submitKey = 1-of-M KeyList of members\n * Returns created Flora account ID and topic IDs.\n */\n async createFloraAccountWithTopics(params: {\n members: string[];\n threshold: number;\n initialBalanceHbar?: number;\n autoRenewAccountId?: string;\n }): Promise<{\n floraAccountId: string;\n topics: { communication: string; transaction: string; state: string };\n }> {\n const signer = this.getSigner();\n const keyList = await this.assembleKeyList({\n members: params.members,\n threshold: params.threshold,\n });\n const submitList = await this.assembleSubmitKeyList(params.members);\n\n const createAcc = buildHcs16CreateAccountTx({\n keyList,\n initialBalanceHbar:\n typeof params.initialBalanceHbar === 'number'\n ? params.initialBalanceHbar\n : 5,\n maxAutomaticTokenAssociations: -1,\n });\n const accFrozen = await createAcc.freezeWithSigner(signer);\n const accExec = await accFrozen.executeWithSigner(signer);\n const accReceipt = await accExec.getReceiptWithSigner(signer);\n const floraAccountId = accReceipt?.accountId?.toString?.();\n if (!floraAccountId) {\n throw new Error('Failed to create Flora account');\n }\n\n const {\n communication: commTx,\n transaction: trnTx,\n state: stateTx,\n } = this.buildFloraTopicCreateTxs({\n floraAccountId,\n keyList,\n submitList,\n autoRenewAccountId: params.autoRenewAccountId,\n });\n\n const commR = await (\n await (await commTx.freezeWithSigner(signer)).executeWithSigner(signer)\n ).getReceiptWithSigner(signer);\n const trnR = await (\n await (await trnTx.freezeWithSigner(signer)).executeWithSigner(signer)\n ).getReceiptWithSigner(signer);\n const stateR = await (\n await (await stateTx.freezeWithSigner(signer)).executeWithSigner(signer)\n ).getReceiptWithSigner(signer);\n const topics = {\n communication: commR?.topicId?.toString?.() || '',\n transaction: trnR?.topicId?.toString?.() || '',\n state: stateR?.topicId?.toString?.() || '',\n };\n return { floraAccountId, topics };\n }\n\n /** Publish flora_created on the communication topic. */\n async publishFloraCreated(params: {\n communicationTopicId: string;\n operatorId: string;\n floraAccountId: string;\n topics: { communication: string; transaction: string; state: string };\n }): Promise<void> {\n const signer = this.getSigner();\n const tx = buildHcs16FloraCreatedTx({\n topicId: params.communicationTopicId,\n operatorId: params.operatorId,\n floraAccountId: params.floraAccountId,\n topics: params.topics,\n });\n const frozen = await tx.freezeWithSigner(signer);\n await frozen.executeWithSigner(signer);\n }\n\n /**\n * Post flora_join_request on Flora communication topic.\n * If submitKey=1/M, a member must relay the message.\n */\n async sendFloraJoinRequest(params: {\n topicId: string;\n operatorId: string;\n candidateAccountId: string;\n }): Promise<void> {\n const signer = this.getSigner();\n const tx = buildHcs16FloraJoinRequestTx(params);\n const frozen = await tx.freezeWithSigner(signer);\n await frozen.executeWithSigner(signer);\n }\n\n /** Post flora_join_vote approval/rejection on the communication topic. */\n async sendFloraJoinVote(params: {\n topicId: string;\n operatorId: string;\n candidateAccountId: string;\n approve: boolean;\n }): Promise<void> {\n const signer = this.getSigner();\n const tx = buildHcs16FloraJoinVoteTx(params);\n const frozen = await tx.freezeWithSigner(signer);\n await frozen.executeWithSigner(signer);\n }\n\n /** Post flora_join_accepted after threshold approval. */\n async sendFloraJoinAccepted(params: {\n topicId: string;\n operatorId: string;\n members: string[];\n epoch?: number;\n }): Promise<void> {\n const signer = this.getSigner();\n const tx = buildHcs16FloraJoinAcceptedTx(params);\n const frozen = await tx.freezeWithSigner(signer);\n await frozen.executeWithSigner(signer);\n }\n}\n"],"names":[],"mappings":";;;AA0BO,MAAM,2BAA2B,gBAAgB;AAAA,EAItD,YAAY,QAAkC;AAC5C,UAAM,EAAE,SAAS,OAAO,QAAA,CAAS;AACjC,SAAK,MAAM,OAAO;AAClB,SAAK,SAAS,OAAO;AAAA,EACvB;AAAA,EAEQ,kBAA0B;AAChC,QACE,KAAK,UACL,OAAQ,KAAK,OAAsB,iBAAiB,YACpD;AACA,aAAQ,KAAK,OAAsB,aAAA,EAAe,SAAA;AAAA,IACpD;AACA,UAAM,OAAO,KAAK,KAAK,iBAAA;AACvB,UAAM,YAAY,MAAM;AACxB,QAAI,CAAC,WAAW;AACd,YAAM,IAAI,MAAM,6BAA6B;AAAA,IAC/C;AACA,WAAO;AAAA,EACT;AAAA,EAEQ,YAAwB;AAC9B,QAAI,KAAK,QAAQ;AACf,aAAO,KAAK;AAAA,IACd;AACA,SAAK,gBAAA;AACL,UAAM,IAAI,KAAK,KAAK,eAAe,UAAU,CAAC;AAC9C,QAAI,CAAC,GAAG;AACN,YAAM,IAAI,MAAM,yBAAyB;AAAA,IAC3C;AACA,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,iBAAiB,QAMH;AAClB,SAAK,gBAAA;AACL,UAAM,S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AAAA,EAGA,MAAM,oBAAoB,QAKR;AAChB,UAAM,SAAS,KAAK,UAAA;AACpB,UAAM,KAAK,yBAAyB;AAAA,MAClC,SAAS,OAAO;AAAA,MAChB,YAAY,OAAO;AAAA,MACnB,gBAAgB,OAAO;AAAA,MACvB,QAAQ,OAAO;AAAA,IAAA,CAChB;AACD,UAAM,SAAS,MAAM,GAAG,iBAAiB,MAAM;AAC/C,UAAM,OAAO,kBAAkB,MAAM;AAAA,EACvC;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,qBAAqB,QAIT;AAChB,UAAM,SAAS,KAAK,UAAA;AACpB,UAAM,KAAK,6BAA6B,MAAM;AAC9C,UAAM,SAAS,MAAM,GAAG,iBAAiB,MAAM;AAC/C,UAAM,OAAO,kBAAkB,MAAM;AAAA,EACvC;AAAA;AAAA,EAGA,MAAM,kBAAkB,QAKN;AAChB,UAAM,SAAS,KAAK,UAAA;AACpB,UAAM,KAAK,0BAA0B,MAAM;AAC3C,UAAM,SAAS,MAAM,GAAG,iBAAiB,MAAM;AAC/C,UAAM,OAAO,kBAAkB,MAAM;AAAA,EACvC;AAAA;AAAA,EAGA,MAAM,sBAAsB,QAKV;AAChB,UAAM,SAAS,KAAK,UAAA;AACpB,UAAM,KAAK,8BAA8B,MAAM;AAC/C,UAAM,SAAS,MAAM,GAAG,iBAAiB,MAAM;AAC/C,UAAM,OAAO,kBAAkB,MAAM;AAAA,EACvC;AACF;"}
|
|
@@ -1,48 +1,148 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
super(message);
|
|
14
|
-
this.code = code;
|
|
15
|
-
this.name = "StateHashError";
|
|
1
|
+
import { HederaMirrorNode } from "./standards-sdk.es127.js";
|
|
2
|
+
import { KeyList } from "@hashgraph/sdk";
|
|
3
|
+
import { buildHcs16CreateFloraTopicTx } from "./standards-sdk.es92.js";
|
|
4
|
+
import { Logger } from "./standards-sdk.es106.js";
|
|
5
|
+
import { FloraTopicType } from "./standards-sdk.es91.js";
|
|
6
|
+
class HCS16BaseClient {
|
|
7
|
+
constructor(params) {
|
|
8
|
+
this.network = params.network;
|
|
9
|
+
this.logger = params.logger || new Logger({ level: "info", module: "HCS-16" });
|
|
10
|
+
this.mirrorNode = new HederaMirrorNode(this.network, this.logger, {
|
|
11
|
+
customUrl: params.mirrorNodeUrl
|
|
12
|
+
});
|
|
16
13
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
14
|
+
async assembleKeyList(params) {
|
|
15
|
+
const keys = [];
|
|
16
|
+
for (const accountId of params.members) {
|
|
17
|
+
const pub = await this.mirrorNode.getPublicKey(accountId);
|
|
18
|
+
keys.push(pub);
|
|
19
|
+
}
|
|
20
|
+
return new KeyList(keys, params.threshold);
|
|
21
|
+
}
|
|
22
|
+
async assembleSubmitKeyList(members) {
|
|
23
|
+
const keys = [];
|
|
24
|
+
for (const accountId of members) {
|
|
25
|
+
const pub = await this.mirrorNode.getPublicKey(accountId);
|
|
26
|
+
keys.push(pub);
|
|
27
|
+
}
|
|
28
|
+
return new KeyList(keys, 1);
|
|
29
|
+
}
|
|
30
|
+
buildFloraTopicCreateTxs(params) {
|
|
31
|
+
const communication = buildHcs16CreateFloraTopicTx({
|
|
32
|
+
floraAccountId: params.floraAccountId,
|
|
33
|
+
topicType: FloraTopicType.COMMUNICATION,
|
|
34
|
+
adminKey: params.keyList,
|
|
35
|
+
submitKey: params.submitList,
|
|
36
|
+
autoRenewAccountId: params.autoRenewAccountId
|
|
37
|
+
});
|
|
38
|
+
const transaction = buildHcs16CreateFloraTopicTx({
|
|
39
|
+
floraAccountId: params.floraAccountId,
|
|
40
|
+
topicType: FloraTopicType.TRANSACTION,
|
|
41
|
+
adminKey: params.keyList,
|
|
42
|
+
submitKey: params.submitList,
|
|
43
|
+
autoRenewAccountId: params.autoRenewAccountId
|
|
44
|
+
});
|
|
45
|
+
const state = buildHcs16CreateFloraTopicTx({
|
|
46
|
+
floraAccountId: params.floraAccountId,
|
|
47
|
+
topicType: FloraTopicType.STATE,
|
|
48
|
+
adminKey: params.keyList,
|
|
49
|
+
submitKey: params.submitList,
|
|
50
|
+
autoRenewAccountId: params.autoRenewAccountId
|
|
51
|
+
});
|
|
52
|
+
return { communication, transaction, state };
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Parse an HCS‑16 Flora topic memo of the form `hcs-16:<floraAccountId>:<topicType>`.
|
|
56
|
+
*/
|
|
57
|
+
parseTopicMemo(memo) {
|
|
58
|
+
const match = memo.match(/^hcs-16:([0-9.]+):(\d)$/);
|
|
28
59
|
if (!match) {
|
|
29
|
-
return
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
const floraAccountId = match[1];
|
|
63
|
+
const topicType = Number(match[2]);
|
|
64
|
+
if (topicType !== FloraTopicType.COMMUNICATION && topicType !== FloraTopicType.TRANSACTION && topicType !== FloraTopicType.STATE) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
protocol: "hcs-16",
|
|
69
|
+
floraAccountId,
|
|
70
|
+
topicType
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Build a Flora message envelope by merging an operation body into the HCS‑16 envelope.
|
|
75
|
+
*/
|
|
76
|
+
createFloraMessage(op, operatorId, body) {
|
|
77
|
+
const payload = {
|
|
78
|
+
p: "hcs-16",
|
|
79
|
+
op,
|
|
80
|
+
operator_id: operatorId,
|
|
81
|
+
...body || {}
|
|
82
|
+
};
|
|
83
|
+
return payload;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Fetch recent HCS‑16 messages from a topic via Mirror Node.
|
|
87
|
+
*/
|
|
88
|
+
async getRecentMessages(topicId, options) {
|
|
89
|
+
const limit = options?.limit ?? 25;
|
|
90
|
+
const order = options?.order ?? "desc";
|
|
91
|
+
const items = await this.mirrorNode.getTopicMessages(topicId, { limit, order });
|
|
92
|
+
const results = [];
|
|
93
|
+
for (const raw of items) {
|
|
94
|
+
if (raw.p !== "hcs-16") {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
const {
|
|
98
|
+
consensus_timestamp,
|
|
99
|
+
sequence_number,
|
|
100
|
+
running_hash,
|
|
101
|
+
running_hash_version,
|
|
102
|
+
topic_id,
|
|
103
|
+
payer,
|
|
104
|
+
created,
|
|
105
|
+
chunk_info,
|
|
106
|
+
...payload
|
|
107
|
+
} = raw;
|
|
108
|
+
const op = payload.op;
|
|
109
|
+
const operatorId = payload.operator_id;
|
|
110
|
+
if (options?.opFilter && op !== options.opFilter) {
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
if (typeof operatorId !== "string") {
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
const message = payload;
|
|
117
|
+
results.push({
|
|
118
|
+
message,
|
|
119
|
+
consensus_timestamp,
|
|
120
|
+
sequence_number: Number(sequence_number),
|
|
121
|
+
payer
|
|
122
|
+
});
|
|
30
123
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
124
|
+
return results;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Return the latest valid HCS‑16 message on a topic, if any.
|
|
128
|
+
*/
|
|
129
|
+
async getLatestMessage(topicId, opFilter) {
|
|
130
|
+
const items = await this.getRecentMessages(topicId, {
|
|
131
|
+
limit: 1,
|
|
132
|
+
order: "desc",
|
|
133
|
+
opFilter
|
|
134
|
+
});
|
|
135
|
+
if (items.length === 0) {
|
|
136
|
+
return null;
|
|
35
137
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
138
|
+
const first = items[0];
|
|
139
|
+
return Object.assign({}, first.message, {
|
|
140
|
+
consensus_timestamp: first.consensus_timestamp,
|
|
141
|
+
sequence_number: first.sequence_number
|
|
142
|
+
});
|
|
39
143
|
}
|
|
40
144
|
}
|
|
41
145
|
export {
|
|
42
|
-
|
|
43
|
-
StateHashError,
|
|
44
|
-
generateHCS17Memo,
|
|
45
|
-
hcs17MessageSchema,
|
|
46
|
-
parseHCS17Memo
|
|
146
|
+
HCS16BaseClient
|
|
47
147
|
};
|
|
48
148
|
//# sourceMappingURL=standards-sdk.es95.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es95.js","sources":["../../src/hcs-
|
|
1
|
+
{"version":3,"file":"standards-sdk.es95.js","sources":["../../src/hcs-16/base-client.ts"],"sourcesContent":["import { HederaMirrorNode } from '../services/mirror-node';\nimport { KeyList, TopicCreateTransaction, PublicKey } from '@hashgraph/sdk';\nimport { buildHcs16CreateFloraTopicTx } from './tx';\nimport { Logger, ILogger } from '../utils/logger';\nimport { NetworkType } from '../utils/types';\nimport { FloraTopicType, FloraMessage, FloraOperation } from './types';\nimport type { HCSMessageWithCommonFields } from '../services/types';\n\n/**\n * Base client for HCS‑16 functionality. Provides logging, mirror‑node access,\n * memo helpers, and light message utilities shared by Node and Browser clients.\n */\nexport class HCS16BaseClient {\n protected readonly network: NetworkType;\n public mirrorNode: HederaMirrorNode;\n protected readonly logger: ILogger;\n\n constructor(params: {\n network: NetworkType;\n logger?: ILogger;\n mirrorNodeUrl?: string;\n }) {\n this.network = params.network;\n this.logger =\n params.logger || new Logger({ level: 'info', module: 'HCS-16' });\n this.mirrorNode = new HederaMirrorNode(this.network, this.logger, {\n customUrl: params.mirrorNodeUrl,\n });\n }\n\n async assembleKeyList(params: {\n members: string[];\n threshold: number;\n }): Promise<KeyList> {\n const keys: PublicKey[] = [];\n for (const accountId of params.members) {\n const pub = await this.mirrorNode.getPublicKey(accountId);\n keys.push(pub);\n }\n return new KeyList(keys, params.threshold);\n }\n\n async assembleSubmitKeyList(members: string[]): Promise<KeyList> {\n const keys: PublicKey[] = [];\n for (const accountId of members) {\n const pub = await this.mirrorNode.getPublicKey(accountId);\n keys.push(pub);\n }\n return new KeyList(keys, 1);\n }\n\n buildFloraTopicCreateTxs(params: {\n floraAccountId: string;\n keyList: KeyList;\n submitList: KeyList;\n autoRenewAccountId?: string;\n }): {\n communication: TopicCreateTransaction;\n transaction: TopicCreateTransaction;\n state: TopicCreateTransaction;\n } {\n const communication = buildHcs16CreateFloraTopicTx({\n floraAccountId: params.floraAccountId,\n topicType: FloraTopicType.COMMUNICATION,\n adminKey: params.keyList,\n submitKey: params.submitList,\n autoRenewAccountId: params.autoRenewAccountId,\n });\n const transaction = buildHcs16CreateFloraTopicTx({\n floraAccountId: params.floraAccountId,\n topicType: FloraTopicType.TRANSACTION,\n adminKey: params.keyList,\n submitKey: params.submitList,\n autoRenewAccountId: params.autoRenewAccountId,\n });\n const state = buildHcs16CreateFloraTopicTx({\n floraAccountId: params.floraAccountId,\n topicType: FloraTopicType.STATE,\n adminKey: params.keyList,\n submitKey: params.submitList,\n autoRenewAccountId: params.autoRenewAccountId,\n });\n return { communication, transaction, state };\n }\n\n /**\n * Parse an HCS‑16 Flora topic memo of the form `hcs-16:<floraAccountId>:<topicType>`.\n */\n parseTopicMemo(memo: string): {\n protocol: 'hcs-16';\n floraAccountId: string;\n topicType: FloraTopicType;\n } | null {\n const match = memo.match(/^hcs-16:([0-9.]+):(\\d)$/);\n if (!match) {\n return null;\n }\n const floraAccountId = match[1];\n const topicType = Number(match[2]) as FloraTopicType;\n if (\n topicType !== FloraTopicType.COMMUNICATION &&\n topicType !== FloraTopicType.TRANSACTION &&\n topicType !== FloraTopicType.STATE\n ) {\n return null;\n }\n return {\n protocol: 'hcs-16',\n floraAccountId,\n topicType,\n };\n }\n\n /**\n * Build a Flora message envelope by merging an operation body into the HCS‑16 envelope.\n */\n protected createFloraMessage(\n op: FloraOperation,\n operatorId: string,\n body?: Record<string, unknown>,\n ): FloraMessage {\n const payload: FloraMessage = {\n p: 'hcs-16',\n op,\n operator_id: operatorId,\n ...(body || {}),\n } as FloraMessage;\n return payload;\n }\n\n /**\n * Fetch recent HCS‑16 messages from a topic via Mirror Node.\n */\n async getRecentMessages(\n topicId: string,\n options?: {\n limit?: number;\n order?: 'asc' | 'desc';\n opFilter?: FloraOperation | string;\n },\n ): Promise<\n Array<{\n message: FloraMessage;\n consensus_timestamp?: string;\n sequence_number: number;\n payer?: string;\n }>\n > {\n const limit = options?.limit ?? 25;\n const order = options?.order ?? 'desc';\n const items: HCSMessageWithCommonFields[] =\n await this.mirrorNode.getTopicMessages(topicId, { limit, order });\n\n const results: Array<{\n message: FloraMessage;\n consensus_timestamp?: string;\n sequence_number: number;\n payer?: string;\n }> = [];\n\n for (const raw of items) {\n if (raw.p !== 'hcs-16') {\n continue;\n }\n\n const {\n consensus_timestamp,\n sequence_number,\n running_hash,\n running_hash_version,\n topic_id,\n payer,\n created,\n chunk_info,\n ...payload\n } = raw as unknown as Record<string, unknown>;\n\n const op = payload.op as FloraOperation | string | undefined;\n const operatorId = payload.operator_id as string | undefined;\n\n if (options?.opFilter && op !== options.opFilter) {\n continue;\n }\n if (typeof operatorId !== 'string') {\n continue;\n }\n\n const message = payload as unknown as FloraMessage;\n\n results.push({\n message,\n consensus_timestamp: consensus_timestamp as string | undefined,\n sequence_number: Number(sequence_number),\n payer: payer as string | undefined,\n });\n }\n return results;\n }\n\n /**\n * Return the latest valid HCS‑16 message on a topic, if any.\n */\n async getLatestMessage(\n topicId: string,\n opFilter?: FloraOperation | string,\n ): Promise<\n | (FloraMessage & { consensus_timestamp?: string; sequence_number: number })\n | null\n > {\n const items = await this.getRecentMessages(topicId, {\n limit: 1,\n order: 'desc',\n opFilter,\n });\n if (items.length === 0) {\n return null;\n }\n const first = items[0];\n return Object.assign({}, first.message, {\n consensus_timestamp: first.consensus_timestamp,\n sequence_number: first.sequence_number,\n });\n }\n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