@hashgraphonline/standards-sdk 0.1.137 → 0.1.138-feat-hcs-21-package-std.canary.9db1bab.34

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.
Files changed (223) hide show
  1. package/dist/cjs/hcs-21/base-client.d.ts +33 -0
  2. package/dist/cjs/hcs-21/base-client.d.ts.map +1 -0
  3. package/dist/cjs/hcs-21/browser.d.ts +20 -0
  4. package/dist/cjs/hcs-21/browser.d.ts.map +1 -0
  5. package/dist/cjs/hcs-21/errors.d.ts +6 -0
  6. package/dist/cjs/hcs-21/errors.d.ts.map +1 -0
  7. package/dist/cjs/hcs-21/index.d.ts +7 -0
  8. package/dist/cjs/hcs-21/index.d.ts.map +1 -0
  9. package/dist/cjs/hcs-21/sdk.d.ts +48 -0
  10. package/dist/cjs/hcs-21/sdk.d.ts.map +1 -0
  11. package/dist/cjs/hcs-21/tx.d.ts +20 -0
  12. package/dist/cjs/hcs-21/tx.d.ts.map +1 -0
  13. package/dist/cjs/hcs-21/types.d.ts +89 -0
  14. package/dist/cjs/hcs-21/types.d.ts.map +1 -0
  15. package/dist/cjs/index.d.ts +1 -0
  16. package/dist/cjs/index.d.ts.map +1 -1
  17. package/dist/cjs/services/registry-broker/client.d.ts.map +1 -1
  18. package/dist/cjs/services/types.d.ts +1 -1
  19. package/dist/cjs/services/types.d.ts.map +1 -1
  20. package/dist/cjs/standards-sdk.cjs +2 -2
  21. package/dist/cjs/standards-sdk.cjs.map +1 -1
  22. package/dist/es/hcs-21/base-client.d.ts +33 -0
  23. package/dist/es/hcs-21/base-client.d.ts.map +1 -0
  24. package/dist/es/hcs-21/browser.d.ts +20 -0
  25. package/dist/es/hcs-21/browser.d.ts.map +1 -0
  26. package/dist/es/hcs-21/errors.d.ts +6 -0
  27. package/dist/es/hcs-21/errors.d.ts.map +1 -0
  28. package/dist/es/hcs-21/index.d.ts +7 -0
  29. package/dist/es/hcs-21/index.d.ts.map +1 -0
  30. package/dist/es/hcs-21/sdk.d.ts +48 -0
  31. package/dist/es/hcs-21/sdk.d.ts.map +1 -0
  32. package/dist/es/hcs-21/tx.d.ts +20 -0
  33. package/dist/es/hcs-21/tx.d.ts.map +1 -0
  34. package/dist/es/hcs-21/types.d.ts +89 -0
  35. package/dist/es/hcs-21/types.d.ts.map +1 -0
  36. package/dist/es/index.d.ts +1 -0
  37. package/dist/es/index.d.ts.map +1 -1
  38. package/dist/es/services/registry-broker/client.d.ts.map +1 -1
  39. package/dist/es/services/types.d.ts +1 -1
  40. package/dist/es/services/types.d.ts.map +1 -1
  41. package/dist/es/standards-sdk.es.js +67 -48
  42. package/dist/es/standards-sdk.es.js.map +1 -1
  43. package/dist/es/standards-sdk.es10.js +2 -2
  44. package/dist/es/standards-sdk.es100.js +231 -28
  45. package/dist/es/standards-sdk.es100.js.map +1 -1
  46. package/dist/es/standards-sdk.es101.js +109 -18
  47. package/dist/es/standards-sdk.es101.js.map +1 -1
  48. package/dist/es/standards-sdk.es102.js +32 -158
  49. package/dist/es/standards-sdk.es102.js.map +1 -1
  50. package/dist/es/standards-sdk.es103.js +80 -204
  51. package/dist/es/standards-sdk.es103.js.map +1 -1
  52. package/dist/es/standards-sdk.es104.js +21 -780
  53. package/dist/es/standards-sdk.es104.js.map +1 -1
  54. package/dist/es/standards-sdk.es105.js +140 -11
  55. package/dist/es/standards-sdk.es105.js.map +1 -1
  56. package/dist/es/standards-sdk.es106.js +29 -567
  57. package/dist/es/standards-sdk.es106.js.map +1 -1
  58. package/dist/es/standards-sdk.es107.js +17 -597
  59. package/dist/es/standards-sdk.es107.js.map +1 -1
  60. package/dist/es/standards-sdk.es108.js +159 -12
  61. package/dist/es/standards-sdk.es108.js.map +1 -1
  62. package/dist/es/standards-sdk.es109.js +208 -2
  63. package/dist/es/standards-sdk.es109.js.map +1 -1
  64. package/dist/es/standards-sdk.es110.js +774 -67
  65. package/dist/es/standards-sdk.es110.js.map +1 -1
  66. package/dist/es/standards-sdk.es111.js +11 -37
  67. package/dist/es/standards-sdk.es111.js.map +1 -1
  68. package/dist/es/standards-sdk.es112.js +567 -2
  69. package/dist/es/standards-sdk.es112.js.map +1 -1
  70. package/dist/es/standards-sdk.es113.js +576 -197
  71. package/dist/es/standards-sdk.es113.js.map +1 -1
  72. package/dist/es/standards-sdk.es114.js +12 -1139
  73. package/dist/es/standards-sdk.es114.js.map +1 -1
  74. package/dist/es/standards-sdk.es115.js +2 -306
  75. package/dist/es/standards-sdk.es115.js.map +1 -1
  76. package/dist/es/standards-sdk.es116.js +79 -418
  77. package/dist/es/standards-sdk.es116.js.map +1 -1
  78. package/dist/es/standards-sdk.es117.js +35 -351
  79. package/dist/es/standards-sdk.es117.js.map +1 -1
  80. package/dist/es/standards-sdk.es118.js +2 -761
  81. package/dist/es/standards-sdk.es118.js.map +1 -1
  82. package/dist/es/standards-sdk.es119.js +204 -185
  83. package/dist/es/standards-sdk.es119.js.map +1 -1
  84. package/dist/es/standards-sdk.es12.js +1 -1
  85. package/dist/es/standards-sdk.es120.js +1055 -1482
  86. package/dist/es/standards-sdk.es120.js.map +1 -1
  87. package/dist/es/standards-sdk.es121.js +265 -2024
  88. package/dist/es/standards-sdk.es121.js.map +1 -1
  89. package/dist/es/standards-sdk.es122.js +420 -50
  90. package/dist/es/standards-sdk.es122.js.map +1 -1
  91. package/dist/es/standards-sdk.es123.js +350 -82
  92. package/dist/es/standards-sdk.es123.js.map +1 -1
  93. package/dist/es/standards-sdk.es124.js +741 -139
  94. package/dist/es/standards-sdk.es124.js.map +1 -1
  95. package/dist/es/standards-sdk.es125.js +204 -7
  96. package/dist/es/standards-sdk.es125.js.map +1 -1
  97. package/dist/es/standards-sdk.es126.js +1533 -52
  98. package/dist/es/standards-sdk.es126.js.map +1 -1
  99. package/dist/es/standards-sdk.es127.js +2077 -59
  100. package/dist/es/standards-sdk.es127.js.map +1 -1
  101. package/dist/es/standards-sdk.es128.js +52 -28
  102. package/dist/es/standards-sdk.es128.js.map +1 -1
  103. package/dist/es/standards-sdk.es129.js +80 -131
  104. package/dist/es/standards-sdk.es129.js.map +1 -1
  105. package/dist/es/standards-sdk.es13.js +1 -1
  106. package/dist/es/standards-sdk.es130.js +152 -35
  107. package/dist/es/standards-sdk.es130.js.map +1 -1
  108. package/dist/es/standards-sdk.es131.js +7 -17
  109. package/dist/es/standards-sdk.es131.js.map +1 -1
  110. package/dist/es/standards-sdk.es132.js +53 -12241
  111. package/dist/es/standards-sdk.es132.js.map +1 -1
  112. package/dist/es/standards-sdk.es133.js +65 -694
  113. package/dist/es/standards-sdk.es133.js.map +1 -1
  114. package/dist/es/standards-sdk.es134.js +28 -172
  115. package/dist/es/standards-sdk.es134.js.map +1 -1
  116. package/dist/es/standards-sdk.es135.js +115 -299
  117. package/dist/es/standards-sdk.es135.js.map +1 -1
  118. package/dist/es/standards-sdk.es136.js +36 -340
  119. package/dist/es/standards-sdk.es136.js.map +1 -1
  120. package/dist/es/standards-sdk.es137.js +12216 -395
  121. package/dist/es/standards-sdk.es137.js.map +1 -1
  122. package/dist/es/standards-sdk.es138.js +694 -331
  123. package/dist/es/standards-sdk.es138.js.map +1 -1
  124. package/dist/es/standards-sdk.es139.js +15 -74
  125. package/dist/es/standards-sdk.es139.js.map +1 -1
  126. package/dist/es/standards-sdk.es14.js +1 -1
  127. package/dist/es/standards-sdk.es141.js +1 -1
  128. package/dist/es/standards-sdk.es142.js +175 -0
  129. package/dist/es/standards-sdk.es142.js.map +1 -0
  130. package/dist/es/standards-sdk.es143.js +325 -0
  131. package/dist/es/standards-sdk.es143.js.map +1 -0
  132. package/dist/es/standards-sdk.es144.js +349 -0
  133. package/dist/es/standards-sdk.es144.js.map +1 -0
  134. package/dist/es/standards-sdk.es145.js +456 -0
  135. package/dist/es/standards-sdk.es145.js.map +1 -0
  136. package/dist/es/standards-sdk.es146.js +334 -0
  137. package/dist/es/standards-sdk.es146.js.map +1 -0
  138. package/dist/es/standards-sdk.es147.js +79 -0
  139. package/dist/es/standards-sdk.es147.js.map +1 -0
  140. package/dist/es/standards-sdk.es15.js +1 -1
  141. package/dist/es/standards-sdk.es16.js +1 -1
  142. package/dist/es/standards-sdk.es17.js +5 -5
  143. package/dist/es/standards-sdk.es19.js +12 -12
  144. package/dist/es/standards-sdk.es20.js +9 -9
  145. package/dist/es/standards-sdk.es21.js +1 -1
  146. package/dist/es/standards-sdk.es22.js +1 -1
  147. package/dist/es/standards-sdk.es23.js +1 -1
  148. package/dist/es/standards-sdk.es24.js +1 -1
  149. package/dist/es/standards-sdk.es25.js +1 -1
  150. package/dist/es/standards-sdk.es26.js +1 -1
  151. package/dist/es/standards-sdk.es27.js +1 -1
  152. package/dist/es/standards-sdk.es28.js +12 -12
  153. package/dist/es/standards-sdk.es3.js +2 -2
  154. package/dist/es/standards-sdk.es31.js +2 -2
  155. package/dist/es/standards-sdk.es32.js +4 -4
  156. package/dist/es/standards-sdk.es33.js +1 -1
  157. package/dist/es/standards-sdk.es36.js +6 -6
  158. package/dist/es/standards-sdk.es37.js +4 -4
  159. package/dist/es/standards-sdk.es38.js +2 -2
  160. package/dist/es/standards-sdk.es39.js +2 -2
  161. package/dist/es/standards-sdk.es40.js +1 -1
  162. package/dist/es/standards-sdk.es41.js +1 -1
  163. package/dist/es/standards-sdk.es42.js +2 -2
  164. package/dist/es/standards-sdk.es47.js +1 -1
  165. package/dist/es/standards-sdk.es5.js +2 -2
  166. package/dist/es/standards-sdk.es52.js +1 -1
  167. package/dist/es/standards-sdk.es54.js +1 -1
  168. package/dist/es/standards-sdk.es57.js +1 -1
  169. package/dist/es/standards-sdk.es6.js +2 -2
  170. package/dist/es/standards-sdk.es61.js +7 -7
  171. package/dist/es/standards-sdk.es65.js +2 -2
  172. package/dist/es/standards-sdk.es66.js +3 -3
  173. package/dist/es/standards-sdk.es69.js +2 -2
  174. package/dist/es/standards-sdk.es7.js +2 -2
  175. package/dist/es/standards-sdk.es70.js +3 -3
  176. package/dist/es/standards-sdk.es71.js +2 -2
  177. package/dist/es/standards-sdk.es72.js +1 -1
  178. package/dist/es/standards-sdk.es75.js +2 -2
  179. package/dist/es/standards-sdk.es77.js +2 -2
  180. package/dist/es/standards-sdk.es78.js +4 -4
  181. package/dist/es/standards-sdk.es79.js +1 -1
  182. package/dist/es/standards-sdk.es8.js +1 -1
  183. package/dist/es/standards-sdk.es80.js +41 -27
  184. package/dist/es/standards-sdk.es80.js.map +1 -1
  185. package/dist/es/standards-sdk.es81.js +6 -78
  186. package/dist/es/standards-sdk.es81.js.map +1 -1
  187. package/dist/es/standards-sdk.es82.js +27 -64
  188. package/dist/es/standards-sdk.es82.js.map +1 -1
  189. package/dist/es/standards-sdk.es83.js +69 -23
  190. package/dist/es/standards-sdk.es83.js.map +1 -1
  191. package/dist/es/standards-sdk.es84.js +165 -23
  192. package/dist/es/standards-sdk.es84.js.map +1 -1
  193. package/dist/es/standards-sdk.es85.js +31 -166
  194. package/dist/es/standards-sdk.es85.js.map +1 -1
  195. package/dist/es/standards-sdk.es86.js +24 -127
  196. package/dist/es/standards-sdk.es86.js.map +1 -1
  197. package/dist/es/standards-sdk.es87.js +65 -142
  198. package/dist/es/standards-sdk.es87.js.map +1 -1
  199. package/dist/es/standards-sdk.es88.js +52 -127
  200. package/dist/es/standards-sdk.es88.js.map +1 -1
  201. package/dist/es/standards-sdk.es89.js +26 -41
  202. package/dist/es/standards-sdk.es89.js.map +1 -1
  203. package/dist/es/standards-sdk.es90.js +23 -261
  204. package/dist/es/standards-sdk.es90.js.map +1 -1
  205. package/dist/es/standards-sdk.es91.js +162 -93
  206. package/dist/es/standards-sdk.es91.js.map +1 -1
  207. package/dist/es/standards-sdk.es92.js +112 -83
  208. package/dist/es/standards-sdk.es92.js.map +1 -1
  209. package/dist/es/standards-sdk.es93.js +156 -28
  210. package/dist/es/standards-sdk.es93.js.map +1 -1
  211. package/dist/es/standards-sdk.es94.js +133 -225
  212. package/dist/es/standards-sdk.es94.js.map +1 -1
  213. package/dist/es/standards-sdk.es95.js +40 -108
  214. package/dist/es/standards-sdk.es95.js.map +1 -1
  215. package/dist/es/standards-sdk.es96.js +253 -24
  216. package/dist/es/standards-sdk.es96.js.map +1 -1
  217. package/dist/es/standards-sdk.es97.js +96 -80
  218. package/dist/es/standards-sdk.es97.js.map +1 -1
  219. package/dist/es/standards-sdk.es98.js +91 -21
  220. package/dist/es/standards-sdk.es98.js.map +1 -1
  221. package/dist/es/standards-sdk.es99.js +28 -141
  222. package/dist/es/standards-sdk.es99.js.map +1 -1
  223. package/package.json +62 -59
@@ -1,104 +1,133 @@
1
- import { HCS17BaseClient } from "./standards-sdk.es90.js";
2
- import { buildHcs17CreateTopicTx, buildHcs17MessageTx } from "./standards-sdk.es93.js";
3
- class HCS17BrowserClient extends HCS17BaseClient {
1
+ import { AccountId, Client, ScheduleSignTransaction } from "@hashgraph/sdk";
2
+ import { createNodeOperatorContext } from "./standards-sdk.es135.js";
3
+ import { HederaMirrorNode } from "./standards-sdk.es126.js";
4
+ import { HCS16BaseClient } from "./standards-sdk.es94.js";
5
+ import { buildHcs16CreateFloraTopicTx, buildHcs16FloraCreatedTx, buildHcs16TransactionTx, buildHcs16StateUpdateTx, buildHcs16CreateAccountTx } from "./standards-sdk.es91.js";
6
+ class HCS16Client extends HCS16BaseClient {
4
7
  constructor(config) {
5
- super(config);
6
- this.hwc = config.hwc;
7
- this.signer = config.signer;
8
+ super({ network: config.network, logger: config.logger });
9
+ this.operatorId = AccountId.fromString(config.operatorId);
10
+ const mirror = new HederaMirrorNode(config.network, this.logger);
11
+ this.operatorCtx = createNodeOperatorContext({
12
+ network: config.network,
13
+ operatorId: this.operatorId,
14
+ operatorKey: config.operatorKey,
15
+ keyType: config.keyType,
16
+ mirrorNode: mirror,
17
+ logger: this.logger,
18
+ client: config.network === "mainnet" ? Client.forMainnet() : Client.forTestnet()
19
+ });
20
+ this.client = this.operatorCtx.client;
8
21
  }
9
- ensureConnected() {
10
- if (this.signer && typeof this.signer.getAccountId === "function") {
11
- return this.signer.getAccountId().toString();
12
- }
13
- const info = this.hwc?.getAccountInfo?.();
14
- const accountId = info?.accountId;
15
- if (!accountId) {
16
- throw new Error("No active wallet connection");
22
+ /**
23
+ * Create a Flora topic with memo `hcs-16:<floraAccountId>:<topicType>`.
24
+ */
25
+ async createFloraTopic(params) {
26
+ const tx = buildHcs16CreateFloraTopicTx({
27
+ floraAccountId: params.floraAccountId,
28
+ topicType: params.topicType,
29
+ adminKey: params.adminKey,
30
+ submitKey: params.submitKey,
31
+ operatorPublicKey: this.client.operatorPublicKey || void 0,
32
+ autoRenewAccountId: params.autoRenewAccountId
33
+ });
34
+ const resp = await tx.execute(this.client);
35
+ const receipt = await resp.getReceipt(this.client);
36
+ if (!receipt.topicId) {
37
+ throw new Error("Failed to create Flora topic");
17
38
  }
18
- return accountId;
39
+ return receipt.topicId.toString();
19
40
  }
20
- getSigner() {
21
- if (this.signer) {
22
- return this.signer;
23
- }
24
- this.ensureConnected();
25
- const s = this.hwc?.dAppConnector?.signers?.[0];
26
- if (!s) {
27
- throw new Error("No active wallet signer");
28
- }
29
- return s;
41
+ async sendFloraCreated(params) {
42
+ const tx = buildHcs16FloraCreatedTx(params);
43
+ const resp = await tx.execute(this.client);
44
+ return resp.getReceipt(this.client);
30
45
  }
31
46
  /**
32
- * Create an HCS‑17 state topic, signing with the connected signer.
47
+ * Send HCS-16 transaction (preferred). scheduleId is the ScheduleId entity (e.g., 0.0.12345).
33
48
  */
34
- async createStateTopic(options) {
35
- this.ensureConnected();
36
- const signer = this.getSigner();
37
- const ttl = options?.ttl ?? 86400;
38
- const tx = buildHcs17CreateTopicTx({ ttl });
39
- const frozen = await tx.freezeWithSigner(signer);
40
- const res = await frozen.executeWithSigner(signer);
41
- const receipt = await res.getReceiptWithSigner(signer);
42
- const topicId = receipt?.topicId?.toString?.() || "";
43
- this.logger.info(`Created HCS-17 state topic via wallet: ${topicId}`);
44
- return topicId;
49
+ async sendTransaction(params) {
50
+ const tx = buildHcs16TransactionTx(params);
51
+ const resp = await tx.execute(this.client);
52
+ return resp.getReceipt(this.client);
45
53
  }
46
54
  /**
47
- * Submit an HCS‑17 message to a topic, signing with the connected signer.
55
+ * Sign a scheduled transaction by ScheduleId entity using provided signer key (PrivateKey).
56
+ * The signer must be a valid member key for the scheduled transaction to count toward threshold.
48
57
  */
49
- async submitMessage(topicId, message) {
50
- const { valid, errors } = this.validateMessage(message);
51
- if (!valid) {
52
- throw new Error(`Invalid HCS-17 message: ${errors.join(", ")}`);
53
- }
54
- const signer = this.getSigner();
55
- const tx = buildHcs17MessageTx({
56
- topicId,
57
- stateHash: message.state_hash,
58
- accountId: message.account_id,
59
- topics: message.topics,
60
- memo: message.m
61
- });
62
- const frozen = await tx.freezeWithSigner(signer);
63
- const res = await frozen.executeWithSigner(signer);
64
- await res.getReceiptWithSigner(signer);
65
- return {};
58
+ async signSchedule(params) {
59
+ const tx = await new ScheduleSignTransaction().setScheduleId(params.scheduleId).freezeWith(this.client);
60
+ const signed = await tx.sign(params.signerKey);
61
+ const resp = await signed.execute(this.client);
62
+ return resp.getReceipt(this.client);
63
+ }
64
+ async sendStateUpdate(params) {
65
+ const tx = buildHcs16StateUpdateTx(params);
66
+ const resp = await tx.execute(this.client);
67
+ return resp.getReceipt(this.client);
66
68
  }
67
69
  /**
68
- * Compute current account state hash from topic running hashes and publish it.
70
+ * Resolve member public keys from Mirror Node and build a KeyList with the given threshold.
69
71
  */
70
- async computeAndPublish(params) {
71
- this.ensureConnected();
72
- const signer = this.getSigner();
73
- const topicStates = [];
74
- for (const t of params.topics) {
75
- const msgs = await this.mirrorNode.getTopicMessages(t, {
76
- limit: 1,
77
- order: "desc"
78
- });
79
- const latest = msgs[0];
80
- const running = latest && latest.running_hash || "";
81
- topicStates.push({ topicId: t, latestRunningHash: running });
72
+ async assembleKeyList(params) {
73
+ return super.assembleKeyList(params);
74
+ }
75
+ /**
76
+ * Create a Flora account with a threshold KeyList, then create the three Flora topics.
77
+ * Returns the Flora account ID and the topic IDs.
78
+ */
79
+ async createFloraAccountWithTopics(params) {
80
+ const keyList = await this.assembleKeyList({
81
+ members: params.members,
82
+ threshold: params.threshold
83
+ });
84
+ const submitList = await this.assembleSubmitKeyList(params.members);
85
+ const createAcc = buildHcs16CreateAccountTx({
86
+ keyList,
87
+ initialBalanceHbar: typeof params.initialBalanceHbar === "number" ? params.initialBalanceHbar : 5,
88
+ maxAutomaticTokenAssociations: -1
89
+ });
90
+ const accResp = await createAcc.execute(this.client);
91
+ const accReceipt = await accResp.getReceipt(this.client);
92
+ if (!accReceipt.accountId) {
93
+ throw new Error("Failed to create Flora account");
82
94
  }
83
- const input = {
84
- accountId: params.accountId,
85
- publicKey: params.accountPublicKey,
86
- topics: topicStates
95
+ const floraAccountId = accReceipt.accountId.toString();
96
+ const {
97
+ communication: commTx,
98
+ transaction: trnTx,
99
+ state: stateTx
100
+ } = this.buildFloraTopicCreateTxs({
101
+ floraAccountId,
102
+ keyList,
103
+ submitList,
104
+ autoRenewAccountId: params.autoRenewAccountId
105
+ });
106
+ const commR = await commTx.execute(this.client).then((r) => r.getReceipt(this.client));
107
+ const trnR = await trnTx.execute(this.client).then((r) => r.getReceipt(this.client));
108
+ const stateR = await stateTx.execute(this.client).then((r) => r.getReceipt(this.client));
109
+ const topics = {
110
+ communication: commR.topicId.toString(),
111
+ transaction: trnR.topicId.toString(),
112
+ state: stateR.topicId.toString()
87
113
  };
88
- const result = this.calculateAccountStateHash(input);
89
- const tx = buildHcs17MessageTx({
90
- topicId: params.publishTopicId,
91
- stateHash: result.stateHash,
92
- accountId: params.accountId,
93
- topics: params.topics,
94
- memo: params.memo
114
+ return { floraAccountId, topics };
115
+ }
116
+ /**
117
+ * Convenience: publish flora_created on the communication topic.
118
+ */
119
+ async publishFloraCreated(params) {
120
+ const tx = buildHcs16FloraCreatedTx({
121
+ topicId: params.communicationTopicId,
122
+ operatorId: params.operatorId,
123
+ floraAccountId: params.floraAccountId,
124
+ topics: params.topics
95
125
  });
96
- const frozen = await tx.freezeWithSigner(signer);
97
- await frozen.executeWithSigner(signer);
98
- return { stateHash: result.stateHash };
126
+ const resp = await tx.execute(this.client);
127
+ return resp.getReceipt(this.client);
99
128
  }
100
129
  }
101
130
  export {
102
- HCS17BrowserClient
131
+ HCS16Client
103
132
  };
104
133
  //# sourceMappingURL=standards-sdk.es92.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"standards-sdk.es92.js","sources":["../../src/hcs-17/browser.ts"],"sourcesContent":["import { HCS17BaseClient } from './base-client';\nimport { BrowserHCS17ClientConfig, StateHashMessage } from './types';\nimport { buildHcs17CreateTopicTx, buildHcs17MessageTx } from './tx';\nimport type { HashinalsWalletConnectSDK } from '@hashgraphonline/hashinal-wc';\nimport type { DAppSigner } from '@hashgraph/hedera-wallet-connect';\nimport type { PublicKey } from '@hashgraph/sdk';\n\n/**\n * Browser client for HCS‑17 operations using a DAppSigner.\n * Builds transactions and executes via signer without helper shims.\n */\nexport class HCS17BrowserClient extends HCS17BaseClient {\n private hwc?: HashinalsWalletConnectSDK;\n private signer?: DAppSigner;\n\n constructor(config: BrowserHCS17ClientConfig) {\n super(config);\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 /**\n * Create an HCS‑17 state topic, signing with the connected signer.\n */\n async createStateTopic(options?: {\n ttl?: number;\n adminKey?: boolean | string;\n submitKey?: boolean | string;\n }): Promise<string> {\n this.ensureConnected();\n const signer = this.getSigner();\n const ttl = options?.ttl ?? 86400;\n const tx = buildHcs17CreateTopicTx({ ttl });\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 this.logger.info(`Created HCS-17 state topic via wallet: ${topicId}`);\n return topicId;\n }\n\n /**\n * Submit an HCS‑17 message to a topic, signing with the connected signer.\n */\n async submitMessage(\n topicId: string,\n message: StateHashMessage,\n ): Promise<{ transactionId?: string }> {\n const { valid, errors } = this.validateMessage(message);\n if (!valid) {\n throw new Error(`Invalid HCS-17 message: ${errors.join(', ')}`);\n }\n const signer = this.getSigner();\n const tx = buildHcs17MessageTx({\n topicId,\n stateHash: message.state_hash,\n accountId: message.account_id,\n topics: message.topics,\n memo: message.m,\n });\n const frozen = await tx.freezeWithSigner(signer);\n const res = await frozen.executeWithSigner(signer);\n await res.getReceiptWithSigner(signer);\n return {};\n }\n\n /**\n * Compute current account state hash from topic running hashes and publish it.\n */\n async computeAndPublish(params: {\n accountId: string;\n accountPublicKey: string | PublicKey;\n topics: string[];\n publishTopicId: string;\n memo?: string;\n }): Promise<{ stateHash: string }> {\n this.ensureConnected();\n const signer = this.getSigner();\n\n const topicStates: { topicId: string; latestRunningHash: string }[] = [];\n for (const t of params.topics) {\n const msgs = await this.mirrorNode.getTopicMessages(t, {\n limit: 1,\n order: 'desc',\n });\n const latest = msgs[0];\n const running = (latest && (latest as any).running_hash) || '';\n topicStates.push({ topicId: t, latestRunningHash: running });\n }\n\n const input = {\n accountId: params.accountId,\n publicKey: params.accountPublicKey,\n topics: topicStates,\n };\n const result = this.calculateAccountStateHash(input);\n const tx = buildHcs17MessageTx({\n topicId: params.publishTopicId,\n stateHash: result.stateHash,\n accountId: params.accountId,\n topics: params.topics,\n memo: params.memo,\n });\n const frozen = await tx.freezeWithSigner(signer);\n await frozen.executeWithSigner(signer);\n return { stateHash: result.stateHash };\n }\n}\n"],"names":[],"mappings":";;AAWO,MAAM,2BAA2B,gBAAgB;AAAA,EAItD,YAAY,QA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,\n AccountId,\n PublicKey,\n KeyList,\n TransactionReceipt,\n Hbar,\n ScheduleSignTransaction,\n PrivateKey,\n} from '@hashgraph/sdk';\nimport type { NetworkType } from '../utils/types';\nimport type { Logger } from '../utils/logger';\nimport {\n createNodeOperatorContext,\n type NodeOperatorContext,\n} from '../common/node-operator-resolver';\nimport { HederaMirrorNode } from '../services/mirror-node';\nimport { HCS16BaseClient } from './base-client';\nimport {\n buildHcs16CreateFloraTopicTx,\n buildHcs16FloraCreatedTx,\n buildHcs16TransactionTx,\n buildHcs16StateUpdateTx,\n} from './tx';\nimport { FloraTopicType } from './types';\nimport {\n buildHcs16FloraJoinRequestTx,\n buildHcs16FloraJoinVoteTx,\n buildHcs16FloraJoinAcceptedTx,\n buildHcs16CreateAccountTx,\n} from './tx';\n\nexport interface HCS16ClientConfig {\n network: NetworkType;\n operatorId: string;\n operatorKey: string;\n keyType?: 'ecdsa' | 'ed25519';\n logger?: Logger;\n}\n\n/**\n * Node SDK client for HCS‑16 Flora operations.\n */\nexport class HCS16Client extends HCS16BaseClient {\n private readonly client: Client;\n private readonly operatorId: AccountId;\n private readonly operatorCtx: NodeOperatorContext;\n\n constructor(config: HCS16ClientConfig) {\n super({ network: config.network, logger: config.logger });\n this.operatorId = AccountId.fromString(config.operatorId);\n const mirror = new HederaMirrorNode(config.network, this.logger);\n this.operatorCtx = createNodeOperatorContext({\n network: config.network,\n operatorId: this.operatorId,\n operatorKey: config.operatorKey,\n keyType: config.keyType,\n mirrorNode: mirror,\n logger: this.logger,\n client:\n config.network === 'mainnet'\n ? Client.forMainnet()\n : Client.forTestnet(),\n });\n this.client = this.operatorCtx.client;\n }\n\n /**\n * Create a Flora topic with memo `hcs-16:<floraAccountId>:<topicType>`.\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 const tx = buildHcs16CreateFloraTopicTx({\n floraAccountId: params.floraAccountId,\n topicType: params.topicType,\n adminKey: params.adminKey,\n submitKey: params.submitKey,\n operatorPublicKey: this.client.operatorPublicKey || undefined,\n autoRenewAccountId: params.autoRenewAccountId,\n });\n const resp = await tx.execute(this.client);\n const receipt = await resp.getReceipt(this.client);\n if (!receipt.topicId) {\n throw new Error('Failed to create Flora topic');\n }\n return receipt.topicId.toString();\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<TransactionReceipt> {\n const tx = buildHcs16FloraCreatedTx(params);\n const resp = await tx.execute(this.client);\n return resp.getReceipt(this.client);\n }\n\n /**\n * Send HCS-16 transaction (preferred). scheduleId is the ScheduleId entity (e.g., 0.0.12345).\n */\n async sendTransaction(params: {\n topicId: string;\n operatorId: string;\n scheduleId: string;\n data?: string;\n }): Promise<TransactionReceipt> {\n const tx = buildHcs16TransactionTx(params);\n const resp = await tx.execute(this.client);\n return resp.getReceipt(this.client);\n }\n\n /**\n * Sign a scheduled transaction by ScheduleId entity using provided signer key (PrivateKey).\n * The signer must be a valid member key for the scheduled transaction to count toward threshold.\n */\n async signSchedule(params: {\n scheduleId: string;\n signerKey: PrivateKey;\n }): Promise<TransactionReceipt> {\n const tx = await new ScheduleSignTransaction()\n .setScheduleId(params.scheduleId)\n .freezeWith(this.client);\n const signed = await tx.sign(params.signerKey);\n const resp = await signed.execute(this.client);\n return resp.getReceipt(this.client);\n }\n\n async sendStateUpdate(params: {\n topicId: string;\n operatorId: string;\n hash: string;\n epoch?: number;\n }): Promise<TransactionReceipt> {\n const tx = buildHcs16StateUpdateTx(params);\n const resp = await tx.execute(this.client);\n return resp.getReceipt(this.client);\n }\n\n /**\n * Resolve member public keys from Mirror Node and build a KeyList with the given threshold.\n */\n async assembleKeyList(params: {\n members: string[];\n threshold: number;\n }): Promise<KeyList> {\n return super.assembleKeyList(params);\n }\n\n /**\n * Create a Flora account with a threshold KeyList, then create the three Flora topics.\n * Returns the Flora account ID and the 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 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 accResp = await createAcc.execute(this.client);\n const accReceipt = await accResp.getReceipt(this.client);\n if (!accReceipt.accountId) {\n throw new Error('Failed to create Flora account');\n }\n const floraAccountId = accReceipt.accountId.toString();\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 commTx\n .execute(this.client)\n .then(r => r.getReceipt(this.client));\n const trnR = await trnTx\n .execute(this.client)\n .then(r => r.getReceipt(this.client));\n const stateR = await stateTx\n .execute(this.client)\n .then(r => r.getReceipt(this.client));\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 /**\n * Convenience: publish flora_created on the communication topic.\n */\n async publishFloraCreated(params: {\n communicationTopicId: string;\n operatorId: string;\n floraAccountId: string;\n topics: { communication: string; transaction: string; state: string };\n }): Promise<TransactionReceipt> {\n const tx = buildHcs16FloraCreatedTx({\n topicId: params.communicationTopicId,\n operatorId: params.operatorId,\n floraAccountId: params.floraAccountId,\n topics: params.topics,\n });\n const resp = await tx.execute(this.client);\n return resp.getReceipt(this.client);\n }\n}\n"],"names":[],"mappings":";;;;;AA2CO,MAAM,oBAAoB,gBAAgB;AAAA,EAK/C,YAAY,QAA2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yB;AAAA,MAChC;AAAA,MACA;AAAA,MACA;AAAA,MACA,oBAAoB,OAAO;AAAA,IAAA,CAC5B;AAED,UAAM,QAAQ,MAAM,OACjB,QAAQ,KAAK,MAAM,EACnB,KAAK,CAAA,MAAK,EAAE,WAAW,KAAK,MAAM,CAAC;AACtC,UAAM,OAAO,MAAM,MAChB,QAAQ,KAAK,MAAM,EACnB,KAAK,CAAA,MAAK,EAAE,WAAW,KAAK,MAAM,CAAC;AACtC,UAAM,SAAS,MAAM,QAClB,QAAQ,KAAK,MAAM,EACnB,KAAK,CAAA,MAAK,EAAE,WAAW,KAAK,MAAM,CAAC;AACtC,UAAM,SAAS;AAAA,MACb,eAAe,MAAM,QAAS,SAAA;AAAA,MAC9B,aAAa,KAAK,QAAS,SAAA;AAAA,MAC3B,OAAO,OAAO,QAAS,SAAA;AAAA,IAAS;AAElC,WAAO,EAAE,gBAAgB,OAAA;AAAA,EAC3B;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,oBAAoB,QAKM;AAC9B,UAAM,KAAK,yBAAyB;AAAA,MAClC,SAAS,OAAO;AAAA,MAChB,YAAY,OAAO;AAAA,MACnB,gBAAgB,OAAO;AAAA,MACvB,QAAQ,OAAO;AAAA,IAAA,CAChB;AACD,UAAM,OAAO,MAAM,GAAG,QAAQ,KAAK,MAAM;AACzC,WAAO,KAAK,WAAW,KAAK,MAAM;AAAA,EACpC;AACF;"}
@@ -1,32 +1,160 @@
1
- import { buildTopicCreateTx, buildMessageTx } from "./standards-sdk.es130.js";
2
- import { generateHCS17Memo } from "./standards-sdk.es89.js";
3
- function buildHcs17CreateTopicTx(params) {
4
- const memo = generateHCS17Memo(params.ttl);
5
- return buildTopicCreateTx({
6
- memo,
7
- adminKey: params.adminKey,
8
- submitKey: params.submitKey,
9
- operatorPublicKey: params.operatorPublicKey
10
- });
11
- }
12
- function buildHcs17MessageTx(params) {
13
- const payload = {
14
- p: "hcs-17",
15
- op: "state_hash",
16
- state_hash: params.stateHash,
17
- topics: params.topics,
18
- account_id: params.accountId,
19
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
20
- m: params.memo
21
- };
22
- return buildMessageTx({
23
- topicId: params.topicId,
24
- message: JSON.stringify(payload),
25
- transactionMemo: params.transactionMemo
26
- });
1
+ import { ScheduleSignTransaction } from "@hashgraph/sdk";
2
+ import { buildHcs16CreateFloraTopicTx, buildHcs16FloraCreatedTx, buildHcs16TransactionTx, buildHcs16StateUpdateTx, buildHcs16CreateAccountTx, buildHcs16FloraJoinRequestTx, buildHcs16FloraJoinVoteTx, buildHcs16FloraJoinAcceptedTx } from "./standards-sdk.es91.js";
3
+ import { HCS16BaseClient } from "./standards-sdk.es94.js";
4
+ class HCS16BrowserClient extends HCS16BaseClient {
5
+ constructor(config) {
6
+ super({ network: config.network });
7
+ this.hwc = config.hwc;
8
+ this.signer = config.signer;
9
+ }
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");
18
+ }
19
+ return accountId;
20
+ }
21
+ getSigner() {
22
+ if (this.signer) {
23
+ return this.signer;
24
+ }
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;
31
+ }
32
+ async createFloraTopic(params) {
33
+ this.ensureConnected();
34
+ const signer = this.getSigner();
35
+ const tx = buildHcs16CreateFloraTopicTx({
36
+ floraAccountId: params.floraAccountId,
37
+ topicType: params.topicType,
38
+ adminKey: params.adminKey,
39
+ submitKey: params.submitKey,
40
+ autoRenewAccountId: params.autoRenewAccountId
41
+ });
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;
47
+ }
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);
53
+ }
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);
59
+ }
60
+ /**
61
+ * Wallet-signed ScheduleSign for a given scheduleId.
62
+ */
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);
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 */
75
+ /**
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.
80
+ */
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
92
+ });
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");
99
+ }
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
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);
155
+ }
27
156
  }
28
157
  export {
29
- buildHcs17CreateTopicTx,
30
- buildHcs17MessageTx
158
+ HCS16BrowserClient
31
159
  };
32
160
  //# sourceMappingURL=standards-sdk.es93.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"standards-sdk.es93.js","sources":["../../src/hcs-17/tx.ts"],"sourcesContent":["import {\n PublicKey,\n KeyList,\n TopicMessageSubmitTransaction,\n TopicCreateTransaction,\n} from '@hashgraph/sdk';\nimport { buildTopicCreateTx, buildMessageTx } from '../common/tx/tx-utils';\nimport { generateHCS17Memo, StateHashMessage } from './types';\n\n/**\n * Build a TopicCreateTransaction for HCS‑17 state topics.\n */\nexport function buildHcs17CreateTopicTx(params: {\n ttl: number;\n adminKey?: boolean | string | PublicKey | KeyList;\n submitKey?: boolean | string | PublicKey | KeyList;\n operatorPublicKey?: PublicKey;\n}): TopicCreateTransaction {\n const memo = generateHCS17Memo(params.ttl);\n return buildTopicCreateTx({\n memo,\n adminKey: params.adminKey,\n submitKey: params.submitKey,\n operatorPublicKey: params.operatorPublicKey,\n });\n}\n\n/**\n * Build a TopicMessageSubmitTransaction for HCS‑17 messages.\n */\n/**\n * Build a TopicMessageSubmitTransaction for HCS‑17 messages.\n */\nexport function buildHcs17MessageTx(params: {\n topicId: string;\n stateHash: string;\n accountId: string;\n topics: string[];\n memo?: string;\n transactionMemo?: string;\n}): TopicMessageSubmitTransaction {\n const payload: StateHashMessage = {\n p: 'hcs-17',\n op: 'state_hash',\n state_hash: params.stateHash,\n topics: params.topics,\n account_id: params.accountId,\n timestamp: new Date().toISOString(),\n m: params.memo,\n };\n return buildMessageTx({\n topicId: params.topicId,\n message: JSON.stringify(payload),\n transactionMemo: params.transactionMemo,\n });\n}\n"],"names":[],"mappings":";;AAYO,SAAS,wBAAwB,QAKb;AACzB,QAAM,OAAO,kBAAkB,OAAO,GAAG;AACzC,SAAO,mBAAmB;AAAA,IACxB;AAAA,IACA,UAAU,OAAO;AAAA,IACjB,WAAW,OAAO;AAAA,IAClB,mBAAmB,OAAO;AAAA,EAAA,CAC3B;AACH;AAQO,SAAS,oBAAoB,QAOF;AAChC,QAAM,UAA4B;AAAA,IAChC,GAAG;AAAA,IACH,IAAI;AAAA,IACJ,YAAY,OAAO;AAAA,IACnB,QAAQ,OAAO;AAAA,IACf,YAAY,OAAO;AAAA,IACnB,YAAW,oBAAI,KAAA,GAAO,YAAA;AAAA,IACtB,GAAG,OAAO;AAAA,EAAA;AAEZ,SAAO,eAAe;AAAA,IACpB,SAAS,OAAO;AAAA,IAChB,SAAS,KAAK,UAAU,OAAO;AAAA,IAC/B,iBAAiB,OAAO;AAAA,EAAA,CACzB;AACH;"}
1
+ {"version":3,"file":"standards-sdk.es93.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,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