@hashgraphonline/standards-sdk 0.1.141-canary.3 → 0.1.141-canary.30

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 (251) hide show
  1. package/README.md +13 -1
  2. package/dist/cjs/hcs-16/base-client.d.ts.map +1 -1
  3. package/dist/cjs/hcs-17/types.d.ts.map +1 -1
  4. package/dist/cjs/hcs-20/sdk.d.ts.map +1 -1
  5. package/dist/cjs/hcs-20/types.d.ts +9 -8
  6. package/dist/cjs/hcs-20/types.d.ts.map +1 -1
  7. package/dist/cjs/hcs-21/base-client.d.ts +4 -3
  8. package/dist/cjs/hcs-21/base-client.d.ts.map +1 -1
  9. package/dist/cjs/hcs-21/index.d.ts +1 -0
  10. package/dist/cjs/hcs-21/index.d.ts.map +1 -1
  11. package/dist/cjs/hcs-21/sdk.d.ts +34 -0
  12. package/dist/cjs/hcs-21/sdk.d.ts.map +1 -1
  13. package/dist/cjs/hcs-21/tx.d.ts.map +1 -1
  14. package/dist/cjs/hcs-21/types.d.ts +135 -64
  15. package/dist/cjs/hcs-21/types.d.ts.map +1 -1
  16. package/dist/cjs/hcs-21/verify.d.ts +6 -0
  17. package/dist/cjs/hcs-21/verify.d.ts.map +1 -0
  18. package/dist/cjs/inscribe/inscriber.d.ts +1 -0
  19. package/dist/cjs/inscribe/inscriber.d.ts.map +1 -1
  20. package/dist/cjs/inscribe/quote-cache.d.ts.map +1 -1
  21. package/dist/cjs/services/registry-broker/client.d.ts +4 -3
  22. package/dist/cjs/services/registry-broker/client.d.ts.map +1 -1
  23. package/dist/cjs/services/registry-broker/private-key-signer.d.ts.map +1 -1
  24. package/dist/cjs/services/registry-broker/schemas.d.ts +38 -38
  25. package/dist/cjs/services/registry-broker/schemas.d.ts.map +1 -1
  26. package/dist/cjs/standards-sdk.cjs +2 -2
  27. package/dist/cjs/standards-sdk.cjs.map +1 -1
  28. package/dist/cjs/utils/dynamic-import.d.ts +1 -0
  29. package/dist/cjs/utils/dynamic-import.d.ts.map +1 -1
  30. package/dist/es/hcs-16/base-client.d.ts.map +1 -1
  31. package/dist/es/hcs-17/types.d.ts.map +1 -1
  32. package/dist/es/hcs-20/sdk.d.ts.map +1 -1
  33. package/dist/es/hcs-20/types.d.ts +9 -8
  34. package/dist/es/hcs-20/types.d.ts.map +1 -1
  35. package/dist/es/hcs-21/base-client.d.ts +4 -3
  36. package/dist/es/hcs-21/base-client.d.ts.map +1 -1
  37. package/dist/es/hcs-21/index.d.ts +1 -0
  38. package/dist/es/hcs-21/index.d.ts.map +1 -1
  39. package/dist/es/hcs-21/sdk.d.ts +34 -0
  40. package/dist/es/hcs-21/sdk.d.ts.map +1 -1
  41. package/dist/es/hcs-21/tx.d.ts.map +1 -1
  42. package/dist/es/hcs-21/types.d.ts +135 -64
  43. package/dist/es/hcs-21/types.d.ts.map +1 -1
  44. package/dist/es/hcs-21/verify.d.ts +6 -0
  45. package/dist/es/hcs-21/verify.d.ts.map +1 -0
  46. package/dist/es/inscribe/inscriber.d.ts +1 -0
  47. package/dist/es/inscribe/inscriber.d.ts.map +1 -1
  48. package/dist/es/inscribe/quote-cache.d.ts.map +1 -1
  49. package/dist/es/services/registry-broker/client.d.ts +4 -3
  50. package/dist/es/services/registry-broker/client.d.ts.map +1 -1
  51. package/dist/es/services/registry-broker/private-key-signer.d.ts.map +1 -1
  52. package/dist/es/services/registry-broker/schemas.d.ts +38 -38
  53. package/dist/es/services/registry-broker/schemas.d.ts.map +1 -1
  54. package/dist/es/standards-sdk.es.js +58 -50
  55. package/dist/es/standards-sdk.es.js.map +1 -1
  56. package/dist/es/standards-sdk.es10.js +2 -2
  57. package/dist/es/standards-sdk.es100.js +26 -229
  58. package/dist/es/standards-sdk.es100.js.map +1 -1
  59. package/dist/es/standards-sdk.es101.js +228 -109
  60. package/dist/es/standards-sdk.es101.js.map +1 -1
  61. package/dist/es/standards-sdk.es102.js +94 -15
  62. package/dist/es/standards-sdk.es102.js.map +1 -1
  63. package/dist/es/standards-sdk.es103.js +30 -80
  64. package/dist/es/standards-sdk.es103.js.map +1 -1
  65. package/dist/es/standards-sdk.es104.js +80 -27
  66. package/dist/es/standards-sdk.es104.js.map +1 -1
  67. package/dist/es/standards-sdk.es105.js +25 -136
  68. package/dist/es/standards-sdk.es105.js.map +1 -1
  69. package/dist/es/standards-sdk.es106.js +140 -27
  70. package/dist/es/standards-sdk.es106.js.map +1 -1
  71. package/dist/es/standards-sdk.es107.js +27 -20
  72. package/dist/es/standards-sdk.es107.js.map +1 -1
  73. package/dist/es/standards-sdk.es108.js +18 -156
  74. package/dist/es/standards-sdk.es108.js.map +1 -1
  75. package/dist/es/standards-sdk.es109.js +148 -196
  76. package/dist/es/standards-sdk.es109.js.map +1 -1
  77. package/dist/es/standards-sdk.es110.js +160 -747
  78. package/dist/es/standards-sdk.es110.js.map +1 -1
  79. package/dist/es/standards-sdk.es111.js +786 -9
  80. package/dist/es/standards-sdk.es111.js.map +1 -1
  81. package/dist/es/standards-sdk.es112.js +13 -567
  82. package/dist/es/standards-sdk.es112.js.map +1 -1
  83. package/dist/es/standards-sdk.es113.js +541 -576
  84. package/dist/es/standards-sdk.es113.js.map +1 -1
  85. package/dist/es/standards-sdk.es114.js +601 -12
  86. package/dist/es/standards-sdk.es114.js.map +1 -1
  87. package/dist/es/standards-sdk.es115.js +13 -2
  88. package/dist/es/standards-sdk.es115.js.map +1 -1
  89. package/dist/es/standards-sdk.es116.js +2 -83
  90. package/dist/es/standards-sdk.es116.js.map +1 -1
  91. package/dist/es/standards-sdk.es117.js +80 -36
  92. package/dist/es/standards-sdk.es117.js.map +1 -1
  93. package/dist/es/standards-sdk.es118.js +39 -2
  94. package/dist/es/standards-sdk.es118.js.map +1 -1
  95. package/dist/es/standards-sdk.es119.js +2 -223
  96. package/dist/es/standards-sdk.es119.js.map +1 -1
  97. package/dist/es/standards-sdk.es12.js +1 -1
  98. package/dist/es/standards-sdk.es120.js +193 -1110
  99. package/dist/es/standards-sdk.es120.js.map +1 -1
  100. package/dist/es/standards-sdk.es121.js +1059 -225
  101. package/dist/es/standards-sdk.es121.js.map +1 -1
  102. package/dist/es/standards-sdk.es122.js +303 -419
  103. package/dist/es/standards-sdk.es122.js.map +1 -1
  104. package/dist/es/standards-sdk.es123.js +418 -351
  105. package/dist/es/standards-sdk.es123.js.map +1 -1
  106. package/dist/es/standards-sdk.es124.js +348 -785
  107. package/dist/es/standards-sdk.es124.js.map +1 -1
  108. package/dist/es/standards-sdk.es125.js +766 -182
  109. package/dist/es/standards-sdk.es125.js.map +1 -1
  110. package/dist/es/standards-sdk.es126.js +153 -1512
  111. package/dist/es/standards-sdk.es126.js.map +1 -1
  112. package/dist/es/standards-sdk.es127.js +1373 -1977
  113. package/dist/es/standards-sdk.es127.js.map +1 -1
  114. package/dist/es/standards-sdk.es128.js +2211 -50
  115. package/dist/es/standards-sdk.es128.js.map +1 -1
  116. package/dist/es/standards-sdk.es129.js +59 -79
  117. package/dist/es/standards-sdk.es129.js.map +1 -1
  118. package/dist/es/standards-sdk.es13.js +1 -1
  119. package/dist/es/standards-sdk.es130.js +80 -152
  120. package/dist/es/standards-sdk.es130.js.map +1 -1
  121. package/dist/es/standards-sdk.es131.js +159 -7
  122. package/dist/es/standards-sdk.es131.js.map +1 -1
  123. package/dist/es/standards-sdk.es132.js +7 -86
  124. package/dist/es/standards-sdk.es132.js.map +1 -1
  125. package/dist/es/standards-sdk.es133.js +65 -44
  126. package/dist/es/standards-sdk.es133.js.map +1 -1
  127. package/dist/es/standards-sdk.es134.js +65 -28
  128. package/dist/es/standards-sdk.es134.js.map +1 -1
  129. package/dist/es/standards-sdk.es135.js +69 -125
  130. package/dist/es/standards-sdk.es135.js.map +1 -1
  131. package/dist/es/standards-sdk.es136.js +28 -42
  132. package/dist/es/standards-sdk.es136.js.map +1 -1
  133. package/dist/es/standards-sdk.es137.js +138 -760
  134. package/dist/es/standards-sdk.es137.js.map +1 -1
  135. package/dist/es/standards-sdk.es138.js +36 -50
  136. package/dist/es/standards-sdk.es138.js.map +1 -1
  137. package/dist/es/standards-sdk.es139.js +766 -64
  138. package/dist/es/standards-sdk.es139.js.map +1 -1
  139. package/dist/es/standards-sdk.es14.js +1 -1
  140. package/dist/es/standards-sdk.es141.js +13 -168
  141. package/dist/es/standards-sdk.es141.js.map +1 -1
  142. package/dist/es/standards-sdk.es142.js +55 -321
  143. package/dist/es/standards-sdk.es142.js.map +1 -1
  144. package/dist/es/standards-sdk.es143.js +120 -294
  145. package/dist/es/standards-sdk.es143.js.map +1 -1
  146. package/dist/es/standards-sdk.es144.js +191 -322
  147. package/dist/es/standards-sdk.es144.js.map +1 -1
  148. package/dist/es/standards-sdk.es145.js +294 -279
  149. package/dist/es/standards-sdk.es145.js.map +1 -1
  150. package/dist/es/standards-sdk.es146.js +440 -63
  151. package/dist/es/standards-sdk.es146.js.map +1 -1
  152. package/dist/es/standards-sdk.es147.js +327 -13
  153. package/dist/es/standards-sdk.es147.js.map +1 -1
  154. package/dist/es/standards-sdk.es148.js +79 -0
  155. package/dist/es/standards-sdk.es148.js.map +1 -0
  156. package/dist/es/standards-sdk.es15.js +1 -1
  157. package/dist/es/standards-sdk.es16.js +1 -1
  158. package/dist/es/standards-sdk.es17.js +5 -10
  159. package/dist/es/standards-sdk.es17.js.map +1 -1
  160. package/dist/es/standards-sdk.es19.js +11 -15
  161. package/dist/es/standards-sdk.es19.js.map +1 -1
  162. package/dist/es/standards-sdk.es2.js +26 -72
  163. package/dist/es/standards-sdk.es2.js.map +1 -1
  164. package/dist/es/standards-sdk.es20.js +8 -12
  165. package/dist/es/standards-sdk.es20.js.map +1 -1
  166. package/dist/es/standards-sdk.es21.js +1 -1
  167. package/dist/es/standards-sdk.es22.js +1 -1
  168. package/dist/es/standards-sdk.es23.js +1 -1
  169. package/dist/es/standards-sdk.es24.js +1 -1
  170. package/dist/es/standards-sdk.es25.js +1 -1
  171. package/dist/es/standards-sdk.es26.js +1 -1
  172. package/dist/es/standards-sdk.es27.js +1 -1
  173. package/dist/es/standards-sdk.es28.js +11 -15
  174. package/dist/es/standards-sdk.es28.js.map +1 -1
  175. package/dist/es/standards-sdk.es3.js +2 -2
  176. package/dist/es/standards-sdk.es31.js +1 -1
  177. package/dist/es/standards-sdk.es32.js +3 -3
  178. package/dist/es/standards-sdk.es33.js +1 -1
  179. package/dist/es/standards-sdk.es36.js +6 -11
  180. package/dist/es/standards-sdk.es36.js.map +1 -1
  181. package/dist/es/standards-sdk.es37.js +3 -3
  182. package/dist/es/standards-sdk.es38.js +1 -1
  183. package/dist/es/standards-sdk.es39.js +2 -2
  184. package/dist/es/standards-sdk.es40.js +1 -1
  185. package/dist/es/standards-sdk.es41.js +1 -1
  186. package/dist/es/standards-sdk.es42.js +2 -2
  187. package/dist/es/standards-sdk.es47.js +1 -1
  188. package/dist/es/standards-sdk.es5.js +2 -2
  189. package/dist/es/standards-sdk.es52.js +1 -1
  190. package/dist/es/standards-sdk.es54.js +1 -1
  191. package/dist/es/standards-sdk.es57.js +2 -2
  192. package/dist/es/standards-sdk.es59.js +1 -1
  193. package/dist/es/standards-sdk.es6.js +2 -2
  194. package/dist/es/standards-sdk.es60.js +1 -1
  195. package/dist/es/standards-sdk.es61.js +7 -11
  196. package/dist/es/standards-sdk.es61.js.map +1 -1
  197. package/dist/es/standards-sdk.es63.js +1 -1
  198. package/dist/es/standards-sdk.es65.js +2 -2
  199. package/dist/es/standards-sdk.es66.js +3 -3
  200. package/dist/es/standards-sdk.es69.js +2 -2
  201. package/dist/es/standards-sdk.es7.js +2 -2
  202. package/dist/es/standards-sdk.es70.js +3 -3
  203. package/dist/es/standards-sdk.es71.js +2 -2
  204. package/dist/es/standards-sdk.es72.js +1 -1
  205. package/dist/es/standards-sdk.es73.js.map +1 -1
  206. package/dist/es/standards-sdk.es75.js +2 -2
  207. package/dist/es/standards-sdk.es77.js +5 -3
  208. package/dist/es/standards-sdk.es77.js.map +1 -1
  209. package/dist/es/standards-sdk.es78.js +4 -10
  210. package/dist/es/standards-sdk.es78.js.map +1 -1
  211. package/dist/es/standards-sdk.es79.js +1 -1
  212. package/dist/es/standards-sdk.es8.js +1 -1
  213. package/dist/es/standards-sdk.es80.js +26 -15
  214. package/dist/es/standards-sdk.es80.js.map +1 -1
  215. package/dist/es/standards-sdk.es82.js +12 -4
  216. package/dist/es/standards-sdk.es82.js.map +1 -1
  217. package/dist/es/standards-sdk.es83.js +7 -6
  218. package/dist/es/standards-sdk.es83.js.map +1 -1
  219. package/dist/es/standards-sdk.es84.js +106 -5
  220. package/dist/es/standards-sdk.es84.js.map +1 -1
  221. package/dist/es/standards-sdk.es86.js +55 -21
  222. package/dist/es/standards-sdk.es86.js.map +1 -1
  223. package/dist/es/standards-sdk.es87.js +22 -75
  224. package/dist/es/standards-sdk.es87.js.map +1 -1
  225. package/dist/es/standards-sdk.es88.js +45 -30
  226. package/dist/es/standards-sdk.es88.js.map +1 -1
  227. package/dist/es/standards-sdk.es89.js +57 -22
  228. package/dist/es/standards-sdk.es89.js.map +1 -1
  229. package/dist/es/standards-sdk.es90.js +28 -23
  230. package/dist/es/standards-sdk.es90.js.map +1 -1
  231. package/dist/es/standards-sdk.es91.js +23 -167
  232. package/dist/es/standards-sdk.es91.js.map +1 -1
  233. package/dist/es/standards-sdk.es92.js +158 -119
  234. package/dist/es/standards-sdk.es92.js.map +1 -1
  235. package/dist/es/standards-sdk.es93.js +68 -95
  236. package/dist/es/standards-sdk.es93.js.map +1 -1
  237. package/dist/es/standards-sdk.es94.js +136 -119
  238. package/dist/es/standards-sdk.es94.js.map +1 -1
  239. package/dist/es/standards-sdk.es95.js +139 -39
  240. package/dist/es/standards-sdk.es95.js.map +1 -1
  241. package/dist/es/standards-sdk.es96.js +42 -257
  242. package/dist/es/standards-sdk.es96.js.map +1 -1
  243. package/dist/es/standards-sdk.es97.js +243 -80
  244. package/dist/es/standards-sdk.es97.js.map +1 -1
  245. package/dist/es/standards-sdk.es98.js +47 -48
  246. package/dist/es/standards-sdk.es98.js.map +1 -1
  247. package/dist/es/standards-sdk.es99.js +100 -28
  248. package/dist/es/standards-sdk.es99.js.map +1 -1
  249. package/dist/es/utils/dynamic-import.d.ts +1 -0
  250. package/dist/es/utils/dynamic-import.d.ts.map +1 -1
  251. package/package.json +65 -63
@@ -1,85 +1,82 @@
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 {
1
+ import { AccountId, Client, ScheduleSignTransaction } from "@hashgraph/sdk";
2
+ import { createNodeOperatorContext } from "./standards-sdk.es137.js";
3
+ import { HederaMirrorNode } from "./standards-sdk.es127.js";
4
+ import { HCS16BaseClient } from "./standards-sdk.es95.js";
5
+ import { buildHcs16CreateFloraTopicTx, buildHcs16FloraCreatedTx, buildHcs16TransactionTx, buildHcs16StateUpdateTx, buildHcs16CreateAccountTx } from "./standards-sdk.es92.js";
6
+ class HCS16Client extends HCS16BaseClient {
5
7
  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;
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;
31
21
  }
22
+ /**
23
+ * Create a Flora topic with memo `hcs-16:<floraAccountId>:<topicType>`.
24
+ */
32
25
  async createFloraTopic(params) {
33
- this.ensureConnected();
34
- const signer = this.getSigner();
35
26
  const tx = buildHcs16CreateFloraTopicTx({
36
27
  floraAccountId: params.floraAccountId,
37
28
  topicType: params.topicType,
38
29
  adminKey: params.adminKey,
39
30
  submitKey: params.submitKey,
31
+ operatorPublicKey: this.client.operatorPublicKey || void 0,
40
32
  autoRenewAccountId: params.autoRenewAccountId
41
33
  });
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;
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");
38
+ }
39
+ return receipt.topicId.toString();
47
40
  }
48
41
  async sendFloraCreated(params) {
49
- const signer = this.getSigner();
50
42
  const tx = buildHcs16FloraCreatedTx(params);
51
- const frozen = await tx.freezeWithSigner(signer);
52
- await frozen.executeWithSigner(signer);
43
+ const resp = await tx.execute(this.client);
44
+ return resp.getReceipt(this.client);
53
45
  }
46
+ /**
47
+ * Send HCS-16 transaction (preferred). scheduleId is the ScheduleId entity (e.g., 0.0.12345).
48
+ */
54
49
  async sendTransaction(params) {
55
- const signer = this.getSigner();
56
50
  const tx = buildHcs16TransactionTx(params);
57
- const frozen = await tx.freezeWithSigner(signer);
58
- await frozen.executeWithSigner(signer);
51
+ const resp = await tx.execute(this.client);
52
+ return resp.getReceipt(this.client);
59
53
  }
60
54
  /**
61
- * Wallet-signed ScheduleSign for a given scheduleId.
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.
62
57
  */
63
58
  async signSchedule(params) {
64
- const signer = this.getSigner();
65
- const tx = await new ScheduleSignTransaction().setScheduleId(params.scheduleId).freezeWithSigner(signer);
66
- await tx.executeWithSigner(signer);
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);
67
63
  }
68
64
  async sendStateUpdate(params) {
69
- const signer = this.getSigner();
70
65
  const tx = buildHcs16StateUpdateTx(params);
71
- const frozen = await tx.freezeWithSigner(signer);
72
- await frozen.executeWithSigner(signer);
66
+ const resp = await tx.execute(this.client);
67
+ return resp.getReceipt(this.client);
68
+ }
69
+ /**
70
+ * Resolve member public keys from Mirror Node and build a KeyList with the given threshold.
71
+ */
72
+ async assembleKeyList(params) {
73
+ return super.assembleKeyList(params);
73
74
  }
74
- /** credit_purchase is not part of HCS-16 specification */
75
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.
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.
80
78
  */
81
79
  async createFloraAccountWithTopics(params) {
82
- const signer = this.getSigner();
83
80
  const keyList = await this.assembleKeyList({
84
81
  members: params.members,
85
82
  threshold: params.threshold
@@ -90,13 +87,12 @@ class HCS16BrowserClient extends HCS16BaseClient {
90
87
  initialBalanceHbar: typeof params.initialBalanceHbar === "number" ? params.initialBalanceHbar : 5,
91
88
  maxAutomaticTokenAssociations: -1
92
89
  });
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) {
90
+ const accResp = await createAcc.execute(this.client);
91
+ const accReceipt = await accResp.getReceipt(this.client);
92
+ if (!accReceipt.accountId) {
98
93
  throw new Error("Failed to create Flora account");
99
94
  }
95
+ const floraAccountId = accReceipt.accountId.toString();
100
96
  const {
101
97
  communication: commTx,
102
98
  transaction: trnTx,
@@ -107,54 +103,31 @@ class HCS16BrowserClient extends HCS16BaseClient {
107
103
  submitList,
108
104
  autoRenewAccountId: params.autoRenewAccountId
109
105
  });
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);
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));
113
109
  const topics = {
114
- communication: commR?.topicId?.toString?.() || "",
115
- transaction: trnR?.topicId?.toString?.() || "",
116
- state: stateR?.topicId?.toString?.() || ""
110
+ communication: commR.topicId.toString(),
111
+ transaction: trnR.topicId.toString(),
112
+ state: stateR.topicId.toString()
117
113
  };
118
114
  return { floraAccountId, topics };
119
115
  }
120
- /** Publish flora_created on the communication topic. */
116
+ /**
117
+ * Convenience: publish flora_created on the communication topic.
118
+ */
121
119
  async publishFloraCreated(params) {
122
- const signer = this.getSigner();
123
120
  const tx = buildHcs16FloraCreatedTx({
124
121
  topicId: params.communicationTopicId,
125
122
  operatorId: params.operatorId,
126
123
  floraAccountId: params.floraAccountId,
127
124
  topics: params.topics
128
125
  });
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);
126
+ const resp = await tx.execute(this.client);
127
+ return resp.getReceipt(this.client);
155
128
  }
156
129
  }
157
130
  export {
158
- HCS16BrowserClient
131
+ HCS16Client
159
132
  };
160
133
  //# sourceMappingURL=standards-sdk.es93.js.map
@@ -1 +1 @@
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,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,SAAS,KAAK,UAAA;AACpB,UAAM,KAAK,6BAA6B;AAAA,MACtC,gBAAgB,OAAO;AAAA,MACvB,WAAW,OAAO;AAAA,MAClB,UAAU,OAAO;AAAA,MACjB,WAAW,OAAO;AAAA,MAClB,oBAAoB,OAAO;AAAA,IAAA,CAC5B;AACD,UAAM,SAAS,MAAM,GAAG,iBAAiB,MAAM;AAC/C,UAAM,MAAM,MAAM,OAAO,kBAAkB,MAAM;AACjD,UAAM,UAAU,MAAM,IAAI,qBAAqB,MAAM;AACrD,UAAM,UAAU,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BAAqB,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
+ {"version":3,"file":"standards-sdk.es93.js","sources":["../../src/hcs-16/sdk.ts"],"sourcesContent":["import {\n Client,\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,QAA2B;AACrC,UAAM,EAAE,SAAS,OAAO,SAAS,QAAQ,OAAO,QAAQ;AACxD,SAAK,aAAa,UAAU,WAAW,OAAO,UAAU;AACxD,UAAM,SAAS,IAAI,iBAAiB,OAAO,SAAS,KAAK,MAAM;AAC/D,SAAK,cAAc,0BAA0B;AAAA,MAC3C,SAAS,OAAO;AAAA,MAChB,YAAY,KAAK;AAAA,MACjB,aAAa,OAAO;AAAA,MACpB,SAAS,OAAO;AAAA,MAChB,YAAY;AAAA,MACZ,QAAQ,KAAK;AAAA,MACb,QACE,OAAO,YAAY,YACf,OAAO,WAAA,IACP,OAAO,WAAA;AAAA,IAAW,CACzB;AACD,SAAK,SAAS,KAAK,YAAY;AAAA,EACjC;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,iBAAiB,QAMH;AAClB,UAAM,KAAK,6BAA6B;AAAA,MACtC,gBAAgB,OAAO;AAAA,MACvB,WAAW,OAAO;AAAA,MAClB,UAAU,OAA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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,143 +1,160 @@
1
- import { HederaMirrorNode } from "./standards-sdk.es126.js";
2
- import { KeyList } from "@hashgraph/sdk";
3
- import { buildHcs16CreateFloraTopicTx } from "./standards-sdk.es91.js";
4
- import { Logger } from "./standards-sdk.es105.js";
5
- import { FloraTopicType } from "./standards-sdk.es90.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
- });
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
- 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);
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 new KeyList(keys, params.threshold);
19
+ return accountId;
21
20
  }
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);
21
+ getSigner() {
22
+ if (this.signer) {
23
+ return this.signer;
27
24
  }
28
- return new KeyList(keys, 1);
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
- 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({
32
+ async createFloraTopic(params) {
33
+ this.ensureConnected();
34
+ const signer = this.getSigner();
35
+ const tx = buildHcs16CreateFloraTopicTx({
39
36
  floraAccountId: params.floraAccountId,
40
- topicType: FloraTopicType.TRANSACTION,
41
- adminKey: params.keyList,
42
- submitKey: params.submitList,
37
+ topicType: params.topicType,
38
+ adminKey: params.adminKey,
39
+ submitKey: params.submitKey,
43
40
  autoRenewAccountId: params.autoRenewAccountId
44
41
  });
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 };
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
- * 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)$/);
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
- * Build a Flora message envelope by merging an operation body into the HCS‑16 envelope.
70
- */
71
- createFloraMessage(op, operatorId, body) {
72
- const payload = {
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
- * Fetch recent HCS‑16 messages from a topic via Mirror Node.
61
+ * Wallet-signed ScheduleSign for a given scheduleId.
82
62
  */
83
- async getRecentMessages(topicId, options) {
84
- const limit = options?.limit ?? 25;
85
- const order = options?.order ?? "desc";
86
- const items = await this.mirrorNode.getTopicMessages(topicId, { limit, order });
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
- * Return the latest valid HCS‑16 message on a topic, if any.
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 getLatestMessage(topicId, opFilter) {
125
- const items = await this.getRecentMessages(topicId, {
126
- limit: 1,
127
- order: "desc",
128
- opFilter
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
- if (items.length === 0) {
131
- return null;
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 first = items[0];
134
- return Object.assign({}, first.message, {
135
- consensus_timestamp: first.consensus_timestamp,
136
- sequence_number: first.sequence_number
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
- HCS16BaseClient
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,I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esContent":["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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