@hashgraphonline/standards-sdk 0.1.143-feat-solana-register.canary.1870c8f.71 → 0.1.144

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 (85) hide show
  1. package/dist/cjs/hcs-10/sdk.d.ts +0 -8
  2. package/dist/cjs/hcs-10/sdk.d.ts.map +1 -1
  3. package/dist/cjs/hcs-15/browser.d.ts +0 -2
  4. package/dist/cjs/hcs-15/browser.d.ts.map +1 -1
  5. package/dist/cjs/hcs-15/sdk.d.ts +0 -3
  6. package/dist/cjs/hcs-15/sdk.d.ts.map +1 -1
  7. package/dist/cjs/hcs-15/tx.d.ts +0 -4
  8. package/dist/cjs/hcs-15/tx.d.ts.map +1 -1
  9. package/dist/cjs/hcs-16/browser.d.ts +2 -11
  10. package/dist/cjs/hcs-16/browser.d.ts.map +1 -1
  11. package/dist/cjs/hcs-16/sdk.d.ts +0 -40
  12. package/dist/cjs/hcs-16/sdk.d.ts.map +1 -1
  13. package/dist/cjs/hcs-16/tx.d.ts +3 -21
  14. package/dist/cjs/hcs-16/tx.d.ts.map +1 -1
  15. package/dist/cjs/hcs-17/base-client.d.ts +0 -1
  16. package/dist/cjs/hcs-17/base-client.d.ts.map +1 -1
  17. package/dist/cjs/hcs-17/sdk.d.ts.map +1 -1
  18. package/dist/cjs/hcs-17/tx.d.ts +0 -2
  19. package/dist/cjs/hcs-17/tx.d.ts.map +1 -1
  20. package/dist/cjs/hcs-17/types.d.ts +0 -4
  21. package/dist/cjs/hcs-17/types.d.ts.map +1 -1
  22. package/dist/cjs/services/registry-broker/schemas.d.ts +102 -102
  23. package/dist/cjs/standards-sdk.cjs +2 -2
  24. package/dist/cjs/standards-sdk.cjs.map +1 -1
  25. package/dist/es/hcs-10/sdk.d.ts +0 -8
  26. package/dist/es/hcs-10/sdk.d.ts.map +1 -1
  27. package/dist/es/hcs-15/browser.d.ts +0 -2
  28. package/dist/es/hcs-15/browser.d.ts.map +1 -1
  29. package/dist/es/hcs-15/sdk.d.ts +0 -3
  30. package/dist/es/hcs-15/sdk.d.ts.map +1 -1
  31. package/dist/es/hcs-15/tx.d.ts +0 -4
  32. package/dist/es/hcs-15/tx.d.ts.map +1 -1
  33. package/dist/es/hcs-16/browser.d.ts +2 -11
  34. package/dist/es/hcs-16/browser.d.ts.map +1 -1
  35. package/dist/es/hcs-16/sdk.d.ts +0 -40
  36. package/dist/es/hcs-16/sdk.d.ts.map +1 -1
  37. package/dist/es/hcs-16/tx.d.ts +3 -21
  38. package/dist/es/hcs-16/tx.d.ts.map +1 -1
  39. package/dist/es/hcs-17/base-client.d.ts +0 -1
  40. package/dist/es/hcs-17/base-client.d.ts.map +1 -1
  41. package/dist/es/hcs-17/sdk.d.ts.map +1 -1
  42. package/dist/es/hcs-17/tx.d.ts +0 -2
  43. package/dist/es/hcs-17/tx.d.ts.map +1 -1
  44. package/dist/es/hcs-17/types.d.ts +0 -4
  45. package/dist/es/hcs-17/types.d.ts.map +1 -1
  46. package/dist/es/services/registry-broker/schemas.d.ts +102 -102
  47. package/dist/es/standards-sdk.es.js +2 -8
  48. package/dist/es/standards-sdk.es100.js +1 -2
  49. package/dist/es/standards-sdk.es100.js.map +1 -1
  50. package/dist/es/standards-sdk.es128.js +1 -1
  51. package/dist/es/standards-sdk.es131.js +1 -1
  52. package/dist/es/standards-sdk.es138.js +1 -1
  53. package/dist/es/standards-sdk.es147.js.map +1 -1
  54. package/dist/es/standards-sdk.es148.js +15 -54
  55. package/dist/es/standards-sdk.es148.js.map +1 -1
  56. package/dist/es/standards-sdk.es149.js +48 -74
  57. package/dist/es/standards-sdk.es149.js.map +1 -1
  58. package/dist/es/standards-sdk.es150.js +80 -15
  59. package/dist/es/standards-sdk.es150.js.map +1 -1
  60. package/dist/es/standards-sdk.es19.js +0 -17
  61. package/dist/es/standards-sdk.es19.js.map +1 -1
  62. package/dist/es/standards-sdk.es57.js +1 -1
  63. package/dist/es/standards-sdk.es59.js +1 -1
  64. package/dist/es/standards-sdk.es60.js +1 -1
  65. package/dist/es/standards-sdk.es63.js +1 -1
  66. package/dist/es/standards-sdk.es65.js +1 -1
  67. package/dist/es/standards-sdk.es66.js +1 -1
  68. package/dist/es/standards-sdk.es87.js +0 -22
  69. package/dist/es/standards-sdk.es87.js.map +1 -1
  70. package/dist/es/standards-sdk.es88.js +2 -9
  71. package/dist/es/standards-sdk.es88.js.map +1 -1
  72. package/dist/es/standards-sdk.es89.js +2 -4
  73. package/dist/es/standards-sdk.es89.js.map +1 -1
  74. package/dist/es/standards-sdk.es92.js +19 -90
  75. package/dist/es/standards-sdk.es92.js.map +1 -1
  76. package/dist/es/standards-sdk.es93.js +2 -97
  77. package/dist/es/standards-sdk.es93.js.map +1 -1
  78. package/dist/es/standards-sdk.es94.js.map +1 -1
  79. package/dist/es/standards-sdk.es96.js +0 -1
  80. package/dist/es/standards-sdk.es96.js.map +1 -1
  81. package/dist/es/standards-sdk.es97.js +0 -2
  82. package/dist/es/standards-sdk.es97.js.map +1 -1
  83. package/dist/es/standards-sdk.es98.js +1 -3
  84. package/dist/es/standards-sdk.es98.js.map +1 -1
  85. package/package.json +4 -4
@@ -1,5 +1,5 @@
1
1
  import { getCryptoAdapter } from "./standards-sdk.es120.js";
2
- import { base58Encode } from "./standards-sdk.es148.js";
2
+ import { base58Encode } from "./standards-sdk.es149.js";
3
3
  import { canonicalizeAgentData } from "./standards-sdk.es56.js";
4
4
  function encodeMultibaseB58btc(input) {
5
5
  const bytes = Buffer.from(input, "utf8");
@@ -1,6 +1,6 @@
1
1
  import { HieroDidResolver } from "./standards-sdk.es60.js";
2
2
  import { parseHcs14Did } from "./standards-sdk.es57.js";
3
- import { multibaseB58btcDecode } from "./standards-sdk.es148.js";
3
+ import { multibaseB58btcDecode } from "./standards-sdk.es149.js";
4
4
  class ResolverRegistry {
5
5
  constructor() {
6
6
  this.resolvers = [];
@@ -1,4 +1,4 @@
1
- import { optionalImport } from "./standards-sdk.es149.js";
1
+ import { optionalImport } from "./standards-sdk.es150.js";
2
2
  const hieroResolverModuleId = ["@hiero-did-sdk", "resolver"].join("/");
3
3
  let resolverPromise = null;
4
4
  async function loadResolveDID() {
@@ -1,4 +1,4 @@
1
- import { optionalImport } from "./standards-sdk.es149.js";
1
+ import { optionalImport } from "./standards-sdk.es150.js";
2
2
  const hieroRegistrarModuleId = ["@hiero-did-sdk", "registrar"].join("/");
3
3
  let registrarPromise = null;
4
4
  async function loadCreateDID() {
@@ -1,4 +1,4 @@
1
- import { HCS5BaseClient } from "./standards-sdk.es150.js";
1
+ import { HCS5BaseClient } from "./standards-sdk.es148.js";
2
2
  import { buildHcs1Hrl } from "./standards-sdk.es64.js";
3
3
  import { PrivateKey } from "@hashgraph/sdk";
4
4
  import { inscribeWithSigner } from "./standards-sdk.es125.js";
@@ -1,4 +1,4 @@
1
- import { HCS5BaseClient } from "./standards-sdk.es150.js";
1
+ import { HCS5BaseClient } from "./standards-sdk.es148.js";
2
2
  import { buildHcs1Hrl } from "./standards-sdk.es64.js";
3
3
  import { AccountId } from "@hashgraph/sdk";
4
4
  import { inscribe } from "./standards-sdk.es125.js";
@@ -1,12 +1,4 @@
1
1
  import { AccountCreateTransaction, Hbar } from "@hashgraph/sdk";
2
- const HCS15_BASE_ACCOUNT_CREATE_TRANSACTION_MEMO = "hcs-15:op:base_create";
3
- const HCS15_PETAL_ACCOUNT_CREATE_TRANSACTION_MEMO = "hcs-15:op:petal_create";
4
- function normalizeTransactionMemo(value, fallback) {
5
- if (typeof value !== "string") return fallback;
6
- const trimmed = value.trim();
7
- if (!trimmed) return fallback;
8
- return trimmed;
9
- }
10
2
  function buildHcs15BaseAccountCreateTx(params) {
11
3
  const tx = new AccountCreateTransaction().setECDSAKeyWithAlias(params.publicKey).setInitialBalance(
12
4
  params.initialBalance instanceof Hbar ? params.initialBalance : new Hbar(params.initialBalance ?? 1)
@@ -17,12 +9,6 @@ function buildHcs15BaseAccountCreateTx(params) {
17
9
  if (params.accountMemo) {
18
10
  tx.setAccountMemo(params.accountMemo);
19
11
  }
20
- tx.setTransactionMemo(
21
- normalizeTransactionMemo(
22
- params.transactionMemo,
23
- HCS15_BASE_ACCOUNT_CREATE_TRANSACTION_MEMO
24
- )
25
- );
26
12
  return tx;
27
13
  }
28
14
  function buildHcs15PetalAccountCreateTx(params) {
@@ -35,17 +21,9 @@ function buildHcs15PetalAccountCreateTx(params) {
35
21
  if (params.accountMemo) {
36
22
  tx.setAccountMemo(params.accountMemo);
37
23
  }
38
- tx.setTransactionMemo(
39
- normalizeTransactionMemo(
40
- params.transactionMemo,
41
- HCS15_PETAL_ACCOUNT_CREATE_TRANSACTION_MEMO
42
- )
43
- );
44
24
  return tx;
45
25
  }
46
26
  export {
47
- HCS15_BASE_ACCOUNT_CREATE_TRANSACTION_MEMO,
48
- HCS15_PETAL_ACCOUNT_CREATE_TRANSACTION_MEMO,
49
27
  buildHcs15BaseAccountCreateTx,
50
28
  buildHcs15PetalAccountCreateTx
51
29
  };
@@ -1 +1 @@
1
- {"version":3,"file":"standards-sdk.es87.js","sources":["../../src/hcs-15/tx.ts"],"sourcesContent":["import { AccountCreateTransaction, Hbar, PublicKey } from '@hashgraph/sdk';\n\nexport const HCS15_BASE_ACCOUNT_CREATE_TRANSACTION_MEMO =\n 'hcs-15:op:base_create';\nexport const HCS15_PETAL_ACCOUNT_CREATE_TRANSACTION_MEMO =\n 'hcs-15:op:petal_create';\n\nfunction normalizeTransactionMemo(\n value: string | undefined,\n fallback: string,\n): string {\n if (typeof value !== 'string') return fallback;\n const trimmed = value.trim();\n if (!trimmed) return fallback;\n return trimmed;\n}\n\n/**\n * Build AccountCreateTransaction for an HCS-15 base account.\n * Uses an ECDSA public key and sets the EVM alias from it.\n */\nexport function buildHcs15BaseAccountCreateTx(params: {\n publicKey: PublicKey;\n initialBalance?: Hbar | number;\n maxAutomaticTokenAssociations?: number;\n accountMemo?: string;\n transactionMemo?: string;\n}): AccountCreateTransaction {\n const tx = new AccountCreateTransaction()\n .setECDSAKeyWithAlias(params.publicKey)\n .setInitialBalance(\n params.initialBalance instanceof Hbar\n ? params.initialBalance\n : new Hbar(params.initialBalance ?? 1),\n );\n\n if (typeof params.maxAutomaticTokenAssociations === 'number') {\n tx.setMaxAutomaticTokenAssociations(params.maxAutomaticTokenAssociations);\n }\n if (params.accountMemo) {\n tx.setAccountMemo(params.accountMemo);\n }\n tx.setTransactionMemo(\n normalizeTransactionMemo(\n params.transactionMemo,\n HCS15_BASE_ACCOUNT_CREATE_TRANSACTION_MEMO,\n ),\n );\n return tx;\n}\n\n/**\n * Build AccountCreateTransaction for an HCS-15 Petal account.\n * Reuses the same public key as the base account, without alias.\n */\nexport function buildHcs15PetalAccountCreateTx(params: {\n publicKey: PublicKey;\n initialBalance?: Hbar | number;\n maxAutomaticTokenAssociations?: number;\n accountMemo?: string;\n transactionMemo?: string;\n}): AccountCreateTransaction {\n const tx = new AccountCreateTransaction()\n .setKeyWithoutAlias(params.publicKey)\n .setInitialBalance(\n params.initialBalance instanceof Hbar\n ? params.initialBalance\n : new Hbar(params.initialBalance ?? 1),\n );\n\n if (typeof params.maxAutomaticTokenAssociations === 'number') {\n tx.setMaxAutomaticTokenAssociations(params.maxAutomaticTokenAssociations);\n }\n if (params.accountMemo) {\n tx.setAccountMemo(params.accountMemo);\n }\n tx.setTransactionMemo(\n normalizeTransactionMemo(\n params.transactionMemo,\n HCS15_PETAL_ACCOUNT_CREATE_TRANSACTION_MEMO,\n ),\n );\n return tx;\n}\n"],"names":[],"mappings":";AAEO,MAAM,6CACX;AACK,MAAM,8CACX;AAEF,SAAS,yBACP,OACA,UACQ;AACR,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,QAAM,UAAU,MAAM,KAAA;AACtB,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO;AACT;AAMO,SAAS,8BAA8B,QAMjB;AAC3B,QAAM,KAAK,IAAI,yBAAA,EACZ,qBAAqB,OAAO,SAAS,EACrC;AAAA,IACC,OAAO,0BAA0B,OAC7B,OAAO,iBACP,IAAI,KAAK,OAAO,kBAAkB,CAAC;AAAA,EAAA;AAG3C,MAAI,OAAO,OAAO,kCAAkC,UAAU;AAC5D,OAAG,iCAAiC,OAAO,6BAA6B;AAAA,EAC1E;AACA,MAAI,OAAO,aAAa;AACtB,OAAG,eAAe,OAAO,WAAW;AAAA,EACtC;AACA,KAAG;AAAA,IACD;AAAA,MACE,OAAO;AAAA,MACP;AAAA,IAAA;AAAA,EACF;AAEF,SAAO;AACT;AAMO,SAAS,+BAA+B,QAMlB;AAC3B,QAAM,KAAK,IAAI,yBAAA,EACZ,mBAAmB,OAAO,SAAS,EACnC;AAAA,IACC,OAAO,0BAA0B,OAC7B,OAAO,iBACP,IAAI,KAAK,OAAO,kBAAkB,CAAC;AAAA,EAAA;AAG3C,MAAI,OAAO,OAAO,kCAAkC,UAAU;AAC5D,OAAG,iCAAiC,OAAO,6BAA6B;AAAA,EAC1E;AACA,MAAI,OAAO,aAAa;AACtB,OAAG,eAAe,OAAO,WAAW;AAAA,EACtC;AACA,KAAG;AAAA,IACD;AAAA,MACE,OAAO;AAAA,MACP;AAAA,IAAA;AAAA,EACF;AAEF,SAAO;AACT;"}
1
+ {"version":3,"file":"standards-sdk.es87.js","sources":["../../src/hcs-15/tx.ts"],"sourcesContent":["import { AccountCreateTransaction, Hbar, PublicKey } from '@hashgraph/sdk';\n\n/**\n * Build AccountCreateTransaction for an HCS-15 base account.\n * Uses an ECDSA public key and sets the EVM alias from it.\n */\nexport function buildHcs15BaseAccountCreateTx(params: {\n publicKey: PublicKey;\n initialBalance?: Hbar | number;\n maxAutomaticTokenAssociations?: number;\n accountMemo?: string;\n}): AccountCreateTransaction {\n const tx = new AccountCreateTransaction()\n .setECDSAKeyWithAlias(params.publicKey)\n .setInitialBalance(\n params.initialBalance instanceof Hbar\n ? params.initialBalance\n : new Hbar(params.initialBalance ?? 1),\n );\n\n if (typeof params.maxAutomaticTokenAssociations === 'number') {\n tx.setMaxAutomaticTokenAssociations(params.maxAutomaticTokenAssociations);\n }\n if (params.accountMemo) {\n tx.setAccountMemo(params.accountMemo);\n }\n return tx;\n}\n\n/**\n * Build AccountCreateTransaction for an HCS-15 Petal account.\n * Reuses the same public key as the base account, without alias.\n */\nexport function buildHcs15PetalAccountCreateTx(params: {\n publicKey: PublicKey;\n initialBalance?: Hbar | number;\n maxAutomaticTokenAssociations?: number;\n accountMemo?: string;\n}): AccountCreateTransaction {\n const tx = new AccountCreateTransaction()\n .setKeyWithoutAlias(params.publicKey)\n .setInitialBalance(\n params.initialBalance instanceof Hbar\n ? params.initialBalance\n : new Hbar(params.initialBalance ?? 1),\n );\n\n if (typeof params.maxAutomaticTokenAssociations === 'number') {\n tx.setMaxAutomaticTokenAssociations(params.maxAutomaticTokenAssociations);\n }\n if (params.accountMemo) {\n tx.setAccountMemo(params.accountMemo);\n }\n return tx;\n}\n"],"names":[],"mappings":";AAMO,SAAS,8BAA8B,QAKjB;AAC3B,QAAM,KAAK,IAAI,yBAAA,EACZ,qBAAqB,OAAO,SAAS,EACrC;AAAA,IACC,OAAO,0BAA0B,OAC7B,OAAO,iBACP,IAAI,KAAK,OAAO,kBAAkB,CAAC;AAAA,EAAA;AAG3C,MAAI,OAAO,OAAO,kCAAkC,UAAU;AAC5D,OAAG,iCAAiC,OAAO,6BAA6B;AAAA,EAC1E;AACA,MAAI,OAAO,aAAa;AACtB,OAAG,eAAe,OAAO,WAAW;AAAA,EACtC;AACA,SAAO;AACT;AAMO,SAAS,+BAA+B,QAKlB;AAC3B,QAAM,KAAK,IAAI,yBAAA,EACZ,mBAAmB,OAAO,SAAS,EACnC;AAAA,IACC,OAAO,0BAA0B,OAC7B,OAAO,iBACP,IAAI,KAAK,OAAO,kBAAkB,CAAC;AAAA,EAAA;AAG3C,MAAI,OAAO,OAAO,kCAAkC,UAAU;AAC5D,OAAG,iCAAiC,OAAO,6BAA6B;AAAA,EAC1E;AACA,MAAI,OAAO,aAAa;AACtB,OAAG,eAAe,OAAO,WAAW;AAAA,EACtC;AACA,SAAO;AACT;"}
@@ -26,22 +26,17 @@ class HCS15Client extends HCS15BaseClient {
26
26
  } catch {
27
27
  }
28
28
  }
29
- async ensureOperatorReady() {
30
- await this.operatorCtx.ensureInitialized();
31
- }
32
29
  /**
33
30
  * Create a new base account with a newly generated ECDSA key and EVM alias.
34
31
  */
35
32
  async createBaseAccount(options) {
36
- await this.ensureOperatorReady();
37
33
  const priv = PrivateKey.generateECDSA();
38
34
  const pub = priv.publicKey;
39
35
  const tx = buildHcs15BaseAccountCreateTx({
40
36
  publicKey: pub,
41
37
  initialBalance: new Hbar(options?.initialBalance ?? 10),
42
38
  maxAutomaticTokenAssociations: options?.maxAutomaticTokenAssociations,
43
- accountMemo: options?.accountMemo,
44
- transactionMemo: options?.transactionMemo
39
+ accountMemo: options?.accountMemo
45
40
  });
46
41
  const resp = await tx.execute(this.client);
47
42
  const receipt = await resp.getReceipt(this.client);
@@ -64,15 +59,13 @@ class HCS15Client extends HCS15BaseClient {
64
59
  * Create a Petal account that reuses the base account ECDSA key (no alias).
65
60
  */
66
61
  async createPetalAccount(params) {
67
- await this.ensureOperatorReady();
68
62
  const baseKey = typeof params.basePrivateKey === "string" ? PrivateKey.fromStringECDSA(params.basePrivateKey) : params.basePrivateKey;
69
63
  const pub = baseKey.publicKey;
70
64
  const tx = buildHcs15PetalAccountCreateTx({
71
65
  publicKey: pub,
72
66
  initialBalance: new Hbar(params.initialBalance ?? 1),
73
67
  maxAutomaticTokenAssociations: params.maxAutomaticTokenAssociations,
74
- accountMemo: params.accountMemo,
75
- transactionMemo: params.transactionMemo
68
+ accountMemo: params.accountMemo
76
69
  });
77
70
  const resp = await tx.execute(this.client);
78
71
  const receipt = await resp.getReceipt(this.client);
@@ -1 +1 @@
1
- {"version":3,"file":"standards-sdk.es88.js","sources":["../../src/hcs-15/sdk.ts"],"sourcesContent":["import {\n AccountId,\n Client,\n Hbar,\n PrivateKey,\n PublicKey,\n TransactionReceipt,\n} from '@hashgraph/sdk';\nimport { NetworkType } from '../utils/types';\nimport {\n createNodeOperatorContext,\n type NodeOperatorContext,\n} from '../common/node-operator-resolver';\nimport {\n buildHcs15BaseAccountCreateTx,\n buildHcs15PetalAccountCreateTx,\n} from './tx';\nimport type { SDKHCS15ClientConfig } from './types';\nimport { HCS15BaseClient } from './base-client';\n\nexport class HCS15Client extends HCS15BaseClient {\n private readonly operatorCtx: NodeOperatorContext;\n private readonly client: Client;\n private readonly operatorId: AccountId;\n\n constructor(config: SDKHCS15ClientConfig) {\n super(config);\n this.operatorId = AccountId.fromString(config.operatorId);\n this.operatorCtx = createNodeOperatorContext({\n network: this.network,\n operatorId: this.operatorId,\n operatorKey: config.operatorKey,\n keyType: config.keyType,\n mirrorNode: this.mirrorNode,\n logger: this.logger,\n client:\n this.network === 'mainnet' ? Client.forMainnet() : Client.forTestnet(),\n });\n this.client = this.operatorCtx.client;\n }\n\n public getKeyType(): 'ed25519' | 'ecdsa' {\n return this.operatorCtx.keyType;\n }\n\n public async close(): Promise<void> {\n try {\n this.client.close();\n } catch {}\n }\n\n private async ensureOperatorReady(): Promise<void> {\n await this.operatorCtx.ensureInitialized();\n }\n\n /**\n * Create a new base account with a newly generated ECDSA key and EVM alias.\n */\n async createBaseAccount(options?: {\n initialBalance?: number;\n maxAutomaticTokenAssociations?: number;\n accountMemo?: string;\n transactionMemo?: string;\n }): Promise<{\n accountId: string;\n privateKey: PrivateKey;\n privateKeyHex: string;\n publicKey: PublicKey;\n evmAddress: string;\n receipt: TransactionReceipt;\n }> {\n await this.ensureOperatorReady();\n const priv = PrivateKey.generateECDSA();\n const pub = priv.publicKey;\n const tx = buildHcs15BaseAccountCreateTx({\n publicKey: pub,\n initialBalance: new Hbar(options?.initialBalance ?? 10),\n maxAutomaticTokenAssociations: options?.maxAutomaticTokenAssociations,\n accountMemo: options?.accountMemo,\n transactionMemo: options?.transactionMemo,\n });\n const resp = await tx.execute(this.client);\n const receipt = await resp.getReceipt(this.client);\n if (!receipt.accountId) {\n throw new Error('HCS-15 BASE_ACCOUNT_CREATE_FAILED');\n }\n const accountId = receipt.accountId.toString();\n const evmAddress = `0x${pub.toEvmAddress()}`;\n this.logger.info('Created HCS-15 base account', { accountId, evmAddress });\n return {\n accountId,\n privateKey: priv,\n privateKeyHex: priv.toStringRaw(),\n publicKey: pub,\n evmAddress,\n receipt,\n };\n }\n\n /**\n * Create a Petal account that reuses the base account ECDSA key (no alias).\n */\n async createPetalAccount(params: {\n basePrivateKey: string | PrivateKey;\n initialBalance?: number;\n maxAutomaticTokenAssociations?: number;\n accountMemo?: string;\n transactionMemo?: string;\n }): Promise<{ accountId: string; receipt: TransactionReceipt }> {\n await this.ensureOperatorReady();\n const baseKey =\n typeof params.basePrivateKey === 'string'\n ? PrivateKey.fromStringECDSA(params.basePrivateKey)\n : params.basePrivateKey;\n const pub = baseKey.publicKey;\n const tx = buildHcs15PetalAccountCreateTx({\n publicKey: pub,\n initialBalance: new Hbar(params.initialBalance ?? 1),\n maxAutomaticTokenAssociations: params.maxAutomaticTokenAssociations,\n accountMemo: params.accountMemo,\n transactionMemo: params.transactionMemo,\n });\n const resp = await tx.execute(this.client);\n const receipt = await resp.getReceipt(this.client);\n if (!receipt.accountId) {\n throw new Error('HCS-15 PETAL_ACCOUNT_CREATE_FAILED');\n }\n const accountId = receipt.accountId.toString();\n this.logger.info('Created HCS-15 petal account', { accountId });\n return { accountId, receipt };\n }\n}\n"],"names":[],"mappings":";;;;AAoBO,MAAM,oBAAoB,gBAAgB;AAAA,EAK/C,YAAY,QAA8B;AACxC,UAAM,MAAM;AACZ,SAAK,aAAa,UAAU,WAAW,OAAO,UAAU;AACxD,SAAK,cAAc,0BAA0B;AAAA,MAC3C,SAAS,KAAK;AAAA,MACd,YAAY,KAAK;AAAA,MACjB,aAAa,OAAO;AAAA,MACpB,SAAS,OAAO;AAAA,MAChB,YAAY,KAAK;AAAA,MACjB,QAAQ,KAAK;AAAA,MACb,QACE,KAAK,YAAY,YAAY,OAAO,WAAA,IAAe,OAAO,WAA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AACpB,UAAM,KAAK,+BAA+B;AAAA,MACxC,WAAW;AAAA,MACX,gBAAgB,IAAI,KAAK,OAAO,kBAAkB,CAAC;AAAA,MACnD,+BAA+B,OAAO;AAAA,MACtC,aAAa,OAAO;AAAA,MACpB,iBAAiB,OAAO;AAAA,IAAA,CACzB;AACD,UAAM,OAAO,MAAM,GAAG,QAAQ,KAAK,MAAM;AACzC,UAAM,UAAU,MAAM,KAAK,WAAW,KAAK,MAAM;AACjD,QAAI,CAAC,QAAQ,WAAW;AACtB,YAAM,IAAI,MAAM,oCAAoC;AAAA,IACtD;AACA,UAAM,YAAY,QAAQ,UAAU,SAAA;AACpC,SAAK,OAAO,KAAK,gCAAgC,EAAE,WAAW;AAC9D,WAAO,EAAE,WAAW,QAAA;AAAA,EACtB;AACF;"}
1
+ {"version":3,"file":"standards-sdk.es88.js","sources":["../../src/hcs-15/sdk.ts"],"sourcesContent":["import {\n AccountId,\n Client,\n Hbar,\n PrivateKey,\n PublicKey,\n TransactionReceipt,\n} from '@hashgraph/sdk';\nimport { NetworkType } from '../utils/types';\nimport {\n createNodeOperatorContext,\n type NodeOperatorContext,\n} from '../common/node-operator-resolver';\nimport {\n buildHcs15BaseAccountCreateTx,\n buildHcs15PetalAccountCreateTx,\n} from './tx';\nimport type { SDKHCS15ClientConfig } from './types';\nimport { HCS15BaseClient } from './base-client';\n\nexport class HCS15Client extends HCS15BaseClient {\n private readonly operatorCtx: NodeOperatorContext;\n private readonly client: Client;\n private readonly operatorId: AccountId;\n\n constructor(config: SDKHCS15ClientConfig) {\n super(config);\n this.operatorId = AccountId.fromString(config.operatorId);\n this.operatorCtx = createNodeOperatorContext({\n network: this.network,\n operatorId: this.operatorId,\n operatorKey: config.operatorKey,\n keyType: config.keyType,\n mirrorNode: this.mirrorNode,\n logger: this.logger,\n client:\n this.network === 'mainnet' ? Client.forMainnet() : Client.forTestnet(),\n });\n this.client = this.operatorCtx.client;\n }\n\n public getKeyType(): 'ed25519' | 'ecdsa' {\n return this.operatorCtx.keyType;\n }\n\n public async close(): Promise<void> {\n try {\n this.client.close();\n } catch {}\n }\n\n /**\n * Create a new base account with a newly generated ECDSA key and EVM alias.\n */\n async createBaseAccount(options?: {\n initialBalance?: number;\n maxAutomaticTokenAssociations?: number;\n accountMemo?: string;\n }): Promise<{\n accountId: string;\n privateKey: PrivateKey;\n privateKeyHex: string;\n publicKey: PublicKey;\n evmAddress: string;\n receipt: TransactionReceipt;\n }> {\n const priv = PrivateKey.generateECDSA();\n const pub = priv.publicKey;\n const tx = buildHcs15BaseAccountCreateTx({\n publicKey: pub,\n initialBalance: new Hbar(options?.initialBalance ?? 10),\n maxAutomaticTokenAssociations: options?.maxAutomaticTokenAssociations,\n accountMemo: options?.accountMemo,\n });\n const resp = await tx.execute(this.client);\n const receipt = await resp.getReceipt(this.client);\n if (!receipt.accountId) {\n throw new Error('HCS-15 BASE_ACCOUNT_CREATE_FAILED');\n }\n const accountId = receipt.accountId.toString();\n const evmAddress = `0x${pub.toEvmAddress()}`;\n this.logger.info('Created HCS-15 base account', { accountId, evmAddress });\n return {\n accountId,\n privateKey: priv,\n privateKeyHex: priv.toStringRaw(),\n publicKey: pub,\n evmAddress,\n receipt,\n };\n }\n\n /**\n * Create a Petal account that reuses the base account ECDSA key (no alias).\n */\n async createPetalAccount(params: {\n basePrivateKey: string | PrivateKey;\n initialBalance?: number;\n maxAutomaticTokenAssociations?: number;\n accountMemo?: string;\n }): Promise<{ accountId: string; receipt: TransactionReceipt }> {\n const baseKey =\n typeof params.basePrivateKey === 'string'\n ? PrivateKey.fromStringECDSA(params.basePrivateKey)\n : params.basePrivateKey;\n const pub = baseKey.publicKey;\n const tx = buildHcs15PetalAccountCreateTx({\n publicKey: pub,\n initialBalance: new Hbar(params.initialBalance ?? 1),\n maxAutomaticTokenAssociations: params.maxAutomaticTokenAssociations,\n accountMemo: params.accountMemo,\n });\n const resp = await tx.execute(this.client);\n const receipt = await resp.getReceipt(this.client);\n if (!receipt.accountId) {\n throw new Error('HCS-15 PETAL_ACCOUNT_CREATE_FAILED');\n }\n const accountId = receipt.accountId.toString();\n this.logger.info('Created HCS-15 petal account', { accountId });\n return { accountId, receipt };\n }\n}\n"],"names":[],"mappings":";;;;AAoBO,MAAM,oBAAoB,gBAAgB;AAAA,EAK/C,YAAY,QAA8B;AACxC,UAAM,MAAM;AACZ,SAAK,aAAa,UAAU,WAAW,OAAO,UAAU;AACxD,SAAK,cAAc,0BAA0B;AAAA,MAC3C,SAAS,KAAK;AAAA,MACd,YAAY,KAAK;AAAA,MACjB,aAAa,OAAO;AAAA,MACpB,SAAS,OAAO;AAAA,MAChB,YAAY,KAAK;AAAA,MACjB,QAAQ,KAAK;AAAA,MACb,QACE,KAAK,YAAY,YAAY,OAAO,WAAA,IAAe,OAAO,WAAA;AAAA,IAAW,CACxE;AACD,SAAK,SAAS,KAAK,YAAY;AAAA,EACjC;AAAA,EAEO,aAAkC;AACvC,WAAO,KAAK,YAAY;AAAA,EAC1B;AAAA,EAEA,MAAa,QAAuB;AAClC,QAAI;AACF,WAAK,OAAO,MAAA;AAAA,IACd,QAAQ;AAAA,IAAC;AAAA,EACX;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,kBAAkB,SAWrB;AACD,UAAM,OAAO,WAAW,cAAA;AACxB,UAAM,MAAM,KAAK;AACjB,UAAM,KAAK,8BAA8B;AAAA,MACvC,WAAW;AAAA,MACX,gBAAgB,IAAI,KAAK,SAAS,kBAAkB,EAAE;AAAA,MACtD,+BAA+B,SAAS;AAAA,MACxC,aAAa,SAAS;AAAA,IAAA,CACvB;AACD,UAAM,OAAO,MAAM,GAAG,QAAQ,KAAK,MAAM;AACzC,UAAM,UAAU,MAAM,KAAK,WAAW,KAAK,MAAM;AACjD,QAAI,CAAC,QAAQ,WAAW;AACtB,YAAM,IAAI,MAAM,mCAAmC;AAAA,IACrD;AACA,UAAM,YAAY,QAAQ,UAAU,SAAA;AACpC,UAAM,aAAa,KAAK,IAAI,aAAA,CAAc;AAC1C,SAAK,OAAO,KAAK,+BAA+B,EAAE,WAAW,YAAY;AACzE,WAAO;AAAA,MACL;AAAA,MACA,YAAY;AAAA,MACZ,eAAe,KAAK,YAAA;AAAA,MACpB,WAAW;AAAA,MACX;AAAA,MACA;AAAA,IAAA;AAAA,EAEJ;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,mBAAmB,QAKuC;AAC9D,UAAM,UACJ,OAAO,OAAO,mBAAmB,WAC7B,WAAW,gBAAgB,OAAO,cAAc,IAChD,OAAO;AACb,UAAM,MAAM,QAAQ;AACpB,UAAM,KAAK,+BAA+B;AAAA,MACxC,WAAW;AAAA,MACX,gBAAgB,IAAI,KAAK,OAAO,kBAAkB,CAAC;AAAA,MACnD,+BAA+B,OAAO;AAAA,MACtC,aAAa,OAAO;AAAA,IAAA,CACrB;AACD,UAAM,OAAO,MAAM,GAAG,QAAQ,KAAK,MAAM;AACzC,UAAM,UAAU,MAAM,KAAK,WAAW,KAAK,MAAM;AACjD,QAAI,CAAC,QAAQ,WAAW;AACtB,YAAM,IAAI,MAAM,oCAAoC;AAAA,IACtD;AACA,UAAM,YAAY,QAAQ,UAAU,SAAA;AACpC,SAAK,OAAO,KAAK,gCAAgC,EAAE,WAAW;AAC9D,WAAO,EAAE,WAAW,QAAA;AAAA,EACtB;AACF;"}
@@ -23,8 +23,7 @@ class HCS15BrowserClient extends HCS15BaseClient {
23
23
  publicKey: pub,
24
24
  initialBalance: new Hbar(options?.initialBalance ?? 10),
25
25
  maxAutomaticTokenAssociations: options?.maxAutomaticTokenAssociations,
26
- accountMemo: options?.accountMemo,
27
- transactionMemo: options?.transactionMemo
26
+ accountMemo: options?.accountMemo
28
27
  });
29
28
  const frozen = await tx.freezeWithSigner(signer);
30
29
  const res = await frozen.executeWithSigner(signer);
@@ -53,8 +52,7 @@ class HCS15BrowserClient extends HCS15BaseClient {
53
52
  publicKey: baseKey.publicKey,
54
53
  initialBalance: new Hbar(params.initialBalance ?? 1),
55
54
  maxAutomaticTokenAssociations: params.maxAutomaticTokenAssociations,
56
- accountMemo: params.accountMemo,
57
- transactionMemo: params.transactionMemo
55
+ accountMemo: params.accountMemo
58
56
  });
59
57
  const frozen = await tx.freezeWithSigner(signer);
60
58
  const res = await frozen.executeWithSigner(signer);
@@ -1 +1 @@
1
- {"version":3,"file":"standards-sdk.es89.js","sources":["../../src/hcs-15/browser.ts"],"sourcesContent":["import type { DAppSigner } from '@hashgraph/hedera-wallet-connect';\nimport type {\n PublicKey,\n PrivateKey,\n TransactionResponse,\n} from '@hashgraph/sdk';\nimport { PrivateKey as SDKPrivateKey, Hbar } from '@hashgraph/sdk';\nimport type { BrowserHCS15ClientConfig } from './types';\n\nimport { HCS15BaseClient } from './base-client';\nimport {\n buildHcs15BaseAccountCreateTx,\n buildHcs15PetalAccountCreateTx,\n} from './tx';\n\nexport class HCS15BrowserClient extends HCS15BaseClient {\n private readonly signer?: DAppSigner;\n\n constructor(config: BrowserHCS15ClientConfig) {\n super(config);\n this.signer = config.signer || config.hwc?.dAppConnector?.signers?.[0];\n }\n\n private requireSigner(): DAppSigner {\n if (!this.signer) {\n throw new Error('HCS-15 Browser client requires an active DAppSigner');\n }\n return this.signer as DAppSigner;\n }\n\n /**\n * Create a new base account with a new ECDSA key and EVM alias using a connected wallet signer.\n */\n async createBaseAccount(options?: {\n initialBalance?: number;\n maxAutomaticTokenAssociations?: number;\n accountMemo?: string;\n transactionMemo?: string;\n }): Promise<{\n accountId?: string;\n privateKey: PrivateKey;\n privateKeyHex: string;\n publicKey: PublicKey;\n evmAddress: string;\n }> {\n const signer = this.requireSigner();\n const priv = SDKPrivateKey.generateECDSA();\n const pub = priv.publicKey;\n const tx = buildHcs15BaseAccountCreateTx({\n publicKey: pub,\n initialBalance: new Hbar(options?.initialBalance ?? 10),\n maxAutomaticTokenAssociations: options?.maxAutomaticTokenAssociations,\n accountMemo: options?.accountMemo,\n transactionMemo: options?.transactionMemo,\n });\n const frozen = await tx.freezeWithSigner(signer);\n const res: TransactionResponse = await frozen.executeWithSigner(signer);\n const receipt = await res.getReceiptWithSigner(signer as any);\n const accountId = receipt?.accountId?.toString?.();\n const evmAddress = `0x${pub.toEvmAddress()}`;\n this.logger.info('Created HCS-15 base account (browser)', {\n accountId,\n evmAddress,\n });\n return {\n accountId,\n privateKey: priv,\n privateKeyHex: priv.toStringRaw(),\n publicKey: pub,\n evmAddress,\n };\n }\n\n /**\n * Create a petal account reusing a base ECDSA key, via wallet signer.\n */\n async createPetalAccount(params: {\n basePrivateKey: string | PrivateKey;\n initialBalance?: number;\n maxAutomaticTokenAssociations?: number;\n accountMemo?: string;\n transactionMemo?: string;\n }): Promise<{ accountId?: string }> {\n const signer = this.requireSigner();\n const baseKey =\n typeof params.basePrivateKey === 'string'\n ? SDKPrivateKey.fromStringECDSA(params.basePrivateKey)\n : params.basePrivateKey;\n const tx = buildHcs15PetalAccountCreateTx({\n publicKey: baseKey.publicKey,\n initialBalance: new Hbar(params.initialBalance ?? 1),\n maxAutomaticTokenAssociations: params.maxAutomaticTokenAssociations,\n accountMemo: params.accountMemo,\n transactionMemo: params.transactionMemo,\n });\n const frozen = await tx.freezeWithSigner(signer);\n const res: TransactionResponse = await frozen.executeWithSigner(signer);\n const receipt = await res.getReceiptWithSigner(signer as any);\n const accountId = receipt?.accountId?.toString?.();\n this.logger.info('Created HCS-15 petal account (browser)', { accountId });\n return { accountId };\n }\n}\n"],"names":["SDKPrivateKey"],"mappings":";;;AAeO,MAAM,2BAA2B,gBAAgB;AAAA,EAGtD,YAAY,QAAkC;AAC5C,UAAM,MAAM;AACZ,SAAK,SAAS,OAAO,UAAU,OAAO,KAAK,eAAe,UAAU,CAAC;AAAA,EACvE;AAAA,EAEQ,gBAA4B;AAClC,QAAI,CAAC,KAAK,QAAQ;AAChB,YAAM,IAAI,MAAM,qDAAqD;AAAA,IACvE;AACA,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,kBAAkB,SAWrB;AACD,UAAM,SAAS,KA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AA0C,EAAE,WAAW;AACxE,WAAO,EAAE,UAAA;AAAA,EACX;AACF;"}
1
+ {"version":3,"file":"standards-sdk.es89.js","sources":["../../src/hcs-15/browser.ts"],"sourcesContent":["import type { DAppSigner } from '@hashgraph/hedera-wallet-connect';\nimport type {\n PublicKey,\n PrivateKey,\n TransactionResponse,\n} from '@hashgraph/sdk';\nimport { PrivateKey as SDKPrivateKey, Hbar } from '@hashgraph/sdk';\nimport type { BrowserHCS15ClientConfig } from './types';\n\nimport { HCS15BaseClient } from './base-client';\nimport {\n buildHcs15BaseAccountCreateTx,\n buildHcs15PetalAccountCreateTx,\n} from './tx';\n\nexport class HCS15BrowserClient extends HCS15BaseClient {\n private readonly signer?: DAppSigner;\n\n constructor(config: BrowserHCS15ClientConfig) {\n super(config);\n this.signer = config.signer || config.hwc?.dAppConnector?.signers?.[0];\n }\n\n private requireSigner(): DAppSigner {\n if (!this.signer) {\n throw new Error('HCS-15 Browser client requires an active DAppSigner');\n }\n return this.signer as DAppSigner;\n }\n\n /**\n * Create a new base account with a new ECDSA key and EVM alias using a connected wallet signer.\n */\n async createBaseAccount(options?: {\n initialBalance?: number;\n maxAutomaticTokenAssociations?: number;\n accountMemo?: string;\n }): Promise<{\n accountId?: string;\n privateKey: PrivateKey;\n privateKeyHex: string;\n publicKey: PublicKey;\n evmAddress: string;\n }> {\n const signer = this.requireSigner();\n const priv = SDKPrivateKey.generateECDSA();\n const pub = priv.publicKey;\n const tx = buildHcs15BaseAccountCreateTx({\n publicKey: pub,\n initialBalance: new Hbar(options?.initialBalance ?? 10),\n maxAutomaticTokenAssociations: options?.maxAutomaticTokenAssociations,\n accountMemo: options?.accountMemo,\n });\n const frozen = await tx.freezeWithSigner(signer);\n const res: TransactionResponse = await frozen.executeWithSigner(signer);\n const receipt = await res.getReceiptWithSigner(signer as any);\n const accountId = receipt?.accountId?.toString?.();\n const evmAddress = `0x${pub.toEvmAddress()}`;\n this.logger.info('Created HCS-15 base account (browser)', {\n accountId,\n evmAddress,\n });\n return {\n accountId,\n privateKey: priv,\n privateKeyHex: priv.toStringRaw(),\n publicKey: pub,\n evmAddress,\n };\n }\n\n /**\n * Create a petal account reusing a base ECDSA key, via wallet signer.\n */\n async createPetalAccount(params: {\n basePrivateKey: string | PrivateKey;\n initialBalance?: number;\n maxAutomaticTokenAssociations?: number;\n accountMemo?: string;\n }): Promise<{ accountId?: string }> {\n const signer = this.requireSigner();\n const baseKey =\n typeof params.basePrivateKey === 'string'\n ? SDKPrivateKey.fromStringECDSA(params.basePrivateKey)\n : params.basePrivateKey;\n const tx = buildHcs15PetalAccountCreateTx({\n publicKey: baseKey.publicKey,\n initialBalance: new Hbar(params.initialBalance ?? 1),\n maxAutomaticTokenAssociations: params.maxAutomaticTokenAssociations,\n accountMemo: params.accountMemo,\n });\n const frozen = await tx.freezeWithSigner(signer);\n const res: TransactionResponse = await frozen.executeWithSigner(signer);\n const receipt = await res.getReceiptWithSigner(signer as any);\n const accountId = receipt?.accountId?.toString?.();\n this.logger.info('Created HCS-15 petal account (browser)', { accountId });\n return { accountId };\n }\n}\n"],"names":["SDKPrivateKey"],"mappings":";;;AAeO,MAAM,2BAA2B,gBAAgB;AAAA,EAGtD,YAAY,QAAkC;AAC5C,UAAM,MAAM;AACZ,SAAK,SAAS,OAAO,UAAU,OAAO,KAAK,eAAe,UAAU,CAAC;AAAA,EACvE;AAAA,EAEQ,gBAA4B;AAClC,QAAI,CAAC,KAAK,QAAQ;AAChB,YAAM,IAAI,MAAM,qDAAqD;AAAA,IACvE;AACA,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,kBAAkB,SAUrB;AACD,UAAM,SAAS,KAAK,cAAA;AACpB,UAAM,OAAOA,WAAc,cAAA;AAC3B,UAAM,MAAM,KAAK;AACjB,UAAM,KAAK,8BAA8B;AAAA,MACvC,WAAW;AAAA,MACX,gBAAgB,IAAI,KAAK,SAAS,kBAAkB,EAAE;AAAA,MACtD,+BAA+B,SAAS;AAAA,MACxC,aAAa,SAAS;AAAA,IAAA,CACvB;AACD,UAAM,SAAS,MAAM,GAAG,iBAAiB,MAAM;AAC/C,UAAM,MAA2B,MAAM,OAAO,kBAAkB,MAAM;AACtE,UAAM,UAAU,MAAM,IAAI,qBAAqB,MAAa;AAC5D,UAAM,YAAY,SAAS,WAAW,WAAA;AACtC,UAAM,aAAa,KAAK,IAAI,aAAA,CAAc;AAC1C,SAAK,OAAO,KAAK,yCAAyC;AAAA,MACxD;AAAA,MACA;AAAA,IAAA,CACD;AACD,WAAO;AAAA,MACL;AAAA,MACA,YAAY;AAAA,MACZ,eAAe,KAAK,YAAA;AAAA,MACpB,WAAW;AAAA,MACX;AAAA,IAAA;AAAA,EAEJ;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,mBAAmB,QAKW;AAClC,UAAM,SAAS,KAAK,cAAA;AACpB,UAAM,UACJ,OAAO,OAAO,mBAAmB,WAC7BA,WAAc,gBAAgB,OAAO,cAAc,IACnD,OAAO;AACb,UAAM,KAAK,+BAA+B;AAAA,MACxC,WAAW,QAAQ;AAAA,MACnB,gBAAgB,IAAI,KAAK,OAAO,kBAAkB,CAAC;AAAA,MACnD,+BAA+B,OAAO;AAAA,MACtC,aAAa,OAAO;AAAA,IAAA,CACrB;AACD,UAAM,SAAS,MAAM,GAAG,iBAAiB,MAAM;AAC/C,UAAM,MAA2B,MAAM,OAAO,kBAAkB,MAAM;AACtE,UAAM,UAAU,MAAM,IAAI,qBAAqB,MAAa;AAC5D,UAAM,YAAY,SAAS,WAAW,WAAA;AACtC,SAAK,OAAO,KAAK,0CAA0C,EAAE,WAAW;AACxE,WAAO,EAAE,UAAA;AAAA,EACX;AACF;"}
@@ -1,41 +1,9 @@
1
1
  import { AccountId, TopicCreateTransaction, CustomFixedFee, TokenId, AccountCreateTransaction, Hbar, AccountUpdateTransaction, ScheduleCreateTransaction, TopicUpdateTransaction } from "@hashgraph/sdk";
2
2
  import { buildTopicCreateTx, buildMessageTx } from "./standards-sdk.es146.js";
3
- import { FloraOperation, FloraTopicType } from "./standards-sdk.es91.js";
4
- const HCS16_FLORA_ACCOUNT_CREATE_TRANSACTION_MEMO = "hcs-16:op:flora_account_create";
5
- const HCS17_STATE_HASH_TRANSACTION_MEMO = "hcs-17:op:6:2";
6
- const HCS16_ACCOUNT_KEY_UPDATE_TRANSACTION_MEMO = "hcs-16:op:1:1";
7
- const HCS16_TOPIC_KEY_UPDATE_TRANSACTION_MEMO = "hcs-16:op:1:1";
8
- function normalizeTransactionMemo(value, fallback) {
9
- if (typeof value !== "string") return fallback;
10
- const trimmed = value.trim();
11
- if (!trimmed) return fallback;
12
- return trimmed;
13
- }
3
+ import { FloraOperation } from "./standards-sdk.es91.js";
14
4
  function encodeHcs16FloraMemo(params) {
15
5
  return `hcs-16:${params.floraAccountId}:${params.topicType}`;
16
6
  }
17
- function encodeHcs16TopicCreateTransactionMemo(topicType) {
18
- return `hcs-16:op:topic_create:${topicType}`;
19
- }
20
- const HCS16_OPERATION_ENUM_BY_OP = {
21
- [FloraOperation.FLORA_CREATED]: 0,
22
- [FloraOperation.TRANSACTION]: 1,
23
- [FloraOperation.STATE_UPDATE]: 2,
24
- [FloraOperation.FLORA_JOIN_REQUEST]: 3,
25
- [FloraOperation.FLORA_JOIN_VOTE]: 4,
26
- [FloraOperation.FLORA_JOIN_ACCEPTED]: 5
27
- };
28
- const HCS16_TOPIC_TYPE_BY_OP = {
29
- [FloraOperation.FLORA_CREATED]: FloraTopicType.COMMUNICATION,
30
- [FloraOperation.TRANSACTION]: FloraTopicType.TRANSACTION,
31
- [FloraOperation.STATE_UPDATE]: FloraTopicType.STATE,
32
- [FloraOperation.FLORA_JOIN_REQUEST]: FloraTopicType.COMMUNICATION,
33
- [FloraOperation.FLORA_JOIN_VOTE]: FloraTopicType.COMMUNICATION,
34
- [FloraOperation.FLORA_JOIN_ACCEPTED]: FloraTopicType.STATE
35
- };
36
- function encodeHcs16MessageSubmitTransactionMemo(op) {
37
- return `hcs-16:op:${HCS16_OPERATION_ENUM_BY_OP[op]}:${HCS16_TOPIC_TYPE_BY_OP[op]}`;
38
- }
39
7
  function buildHcs16CreateFloraTopicTx(params) {
40
8
  const memo = encodeHcs16FloraMemo({
41
9
  floraAccountId: params.floraAccountId,
@@ -47,12 +15,6 @@ function buildHcs16CreateFloraTopicTx(params) {
47
15
  submitKey: params.submitKey,
48
16
  operatorPublicKey: params.operatorPublicKey
49
17
  });
50
- tx.setTransactionMemo(
51
- normalizeTransactionMemo(
52
- params.transactionMemo,
53
- encodeHcs16TopicCreateTransactionMemo(params.topicType)
54
- )
55
- );
56
18
  if (params.autoRenewAccountId) {
57
19
  tx.setAutoRenewAccountId(AccountId.fromString(params.autoRenewAccountId));
58
20
  }
@@ -92,22 +54,13 @@ function buildHcs16CreateAccountTx(params) {
92
54
  tx.setInitialBalance(new Hbar(initial));
93
55
  const maxAssoc = typeof params.maxAutomaticTokenAssociations === "number" ? params.maxAutomaticTokenAssociations : -1;
94
56
  tx.setMaxAutomaticTokenAssociations(maxAssoc);
95
- tx.setTransactionMemo(
96
- normalizeTransactionMemo(
97
- params.transactionMemo,
98
- HCS16_FLORA_ACCOUNT_CREATE_TRANSACTION_MEMO
99
- )
100
- );
101
57
  return tx;
102
58
  }
103
59
  function buildHcs16ScheduleAccountKeyUpdateTx(params) {
104
60
  const inner = new AccountUpdateTransaction().setAccountId(AccountId.fromString(params.floraAccountId)).setKey(params.newKeyList);
105
- inner.setTransactionMemo(
106
- normalizeTransactionMemo(
107
- params.transactionMemo ?? params.memo,
108
- HCS16_ACCOUNT_KEY_UPDATE_TRANSACTION_MEMO
109
- )
110
- );
61
+ if (params.memo) {
62
+ inner.setTransactionMemo(params.memo);
63
+ }
111
64
  return new ScheduleCreateTransaction().setScheduledTransaction(inner);
112
65
  }
113
66
  function buildHcs16ScheduleTopicKeyUpdateTx(params) {
@@ -118,12 +71,9 @@ function buildHcs16ScheduleTopicKeyUpdateTx(params) {
118
71
  if (params.submitKey) {
119
72
  inner.setSubmitKey(params.submitKey);
120
73
  }
121
- inner.setTransactionMemo(
122
- normalizeTransactionMemo(
123
- params.transactionMemo ?? params.memo,
124
- HCS16_TOPIC_KEY_UPDATE_TRANSACTION_MEMO
125
- )
126
- );
74
+ if (params.memo) {
75
+ inner.setTransactionMemo(params.memo);
76
+ }
127
77
  return new ScheduleCreateTransaction().setScheduledTransaction(inner);
128
78
  }
129
79
  function buildHcs16MessageTx(params) {
@@ -135,11 +85,7 @@ function buildHcs16MessageTx(params) {
135
85
  };
136
86
  return buildMessageTx({
137
87
  topicId: params.topicId,
138
- message: JSON.stringify(payload),
139
- transactionMemo: normalizeTransactionMemo(
140
- params.transactionMemo,
141
- encodeHcs16MessageSubmitTransactionMemo(params.op)
142
- )
88
+ message: JSON.stringify(payload)
143
89
  });
144
90
  }
145
91
  function buildHcs16FloraCreatedTx(params) {
@@ -166,23 +112,15 @@ function buildHcs16TransactionTx(params) {
166
112
  });
167
113
  }
168
114
  function buildHcs16StateUpdateTx(params) {
169
- const payload = {
170
- p: "hcs-17",
171
- op: "state_hash",
172
- state_hash: params.hash,
173
- topics: params.topics ?? [],
174
- account_id: params.accountId ?? params.operatorId,
175
- epoch: params.epoch,
176
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
177
- m: params.memo
178
- };
179
- return buildMessageTx({
115
+ return buildHcs16MessageTx({
180
116
  topicId: params.topicId,
181
- message: JSON.stringify(payload),
182
- transactionMemo: normalizeTransactionMemo(
183
- params.transactionMemo,
184
- HCS17_STATE_HASH_TRANSACTION_MEMO
185
- )
117
+ operatorId: params.operatorId,
118
+ op: FloraOperation.STATE_UPDATE,
119
+ body: {
120
+ hash: params.hash,
121
+ epoch: params.epoch,
122
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
123
+ }
186
124
  });
187
125
  }
188
126
  function buildHcs16FloraJoinRequestTx(params) {
@@ -191,10 +129,7 @@ function buildHcs16FloraJoinRequestTx(params) {
191
129
  operatorId: params.operatorId,
192
130
  op: FloraOperation.FLORA_JOIN_REQUEST,
193
131
  body: {
194
- account_id: params.accountId,
195
- connection_request_id: params.connectionRequestId,
196
- connection_topic_id: params.connectionTopicId,
197
- connection_seq: params.connectionSeq
132
+ candidate_account_id: params.candidateAccountId
198
133
  }
199
134
  });
200
135
  }
@@ -204,10 +139,8 @@ function buildHcs16FloraJoinVoteTx(params) {
204
139
  operatorId: params.operatorId,
205
140
  op: FloraOperation.FLORA_JOIN_VOTE,
206
141
  body: {
207
- account_id: params.accountId,
208
- approve: params.approve,
209
- connection_request_id: params.connectionRequestId,
210
- connection_seq: params.connectionSeq
142
+ candidate_account_id: params.candidateAccountId,
143
+ approve: params.approve
211
144
  }
212
145
  });
213
146
  }
@@ -223,10 +156,6 @@ function buildHcs16FloraJoinAcceptedTx(params) {
223
156
  });
224
157
  }
225
158
  export {
226
- HCS16_ACCOUNT_KEY_UPDATE_TRANSACTION_MEMO,
227
- HCS16_FLORA_ACCOUNT_CREATE_TRANSACTION_MEMO,
228
- HCS16_TOPIC_KEY_UPDATE_TRANSACTION_MEMO,
229
- HCS17_STATE_HASH_TRANSACTION_MEMO,
230
159
  buildHcs16CreateAccountTx,
231
160
  buildHcs16CreateFloraTopicTx,
232
161
  buildHcs16CreateTransactionTopicTx,
@@ -1 +1 @@
1
- {"version":3,"file":"standards-sdk.es92.js","sources":["../../src/hcs-16/tx.ts"],"sourcesContent":["import {\n TopicCreateTransaction,\n TopicMessageSubmitTransaction,\n TopicUpdateTransaction,\n AccountCreateTransaction,\n AccountUpdateTransaction,\n ScheduleCreateTransaction,\n Hbar,\n PublicKey,\n KeyList,\n AccountId,\n CustomFixedFee,\n TokenId,\n} from '@hashgraph/sdk';\nimport {\n buildTopicCreateTx,\n buildMessageTx,\n type MaybeKey,\n} from '../common/tx/tx-utils';\nimport { FloraOperation, FloraTopicType, type FloraMessage } from './types';\n\nexport const HCS16_FLORA_ACCOUNT_CREATE_TRANSACTION_MEMO =\n 'hcs-16:op:flora_account_create';\nexport const HCS17_STATE_HASH_TRANSACTION_MEMO = 'hcs-17:op:6:2';\nexport const HCS16_ACCOUNT_KEY_UPDATE_TRANSACTION_MEMO = 'hcs-16:op:1:1';\nexport const HCS16_TOPIC_KEY_UPDATE_TRANSACTION_MEMO = 'hcs-16:op:1:1';\n\nfunction normalizeTransactionMemo(\n value: string | undefined,\n fallback: string,\n): string {\n if (typeof value !== 'string') return fallback;\n const trimmed = value.trim();\n if (!trimmed) return fallback;\n return trimmed;\n}\n\nfunction encodeHcs16FloraMemo(params: {\n floraAccountId: string;\n topicType: FloraTopicType;\n}): string {\n return `hcs-16:${params.floraAccountId}:${params.topicType}`;\n}\n\nfunction encodeHcs16TopicCreateTransactionMemo(\n topicType: FloraTopicType,\n): string {\n return `hcs-16:op:topic_create:${topicType}`;\n}\n\nconst HCS16_OPERATION_ENUM_BY_OP: Record<FloraOperation, number> = {\n [FloraOperation.FLORA_CREATED]: 0,\n [FloraOperation.TRANSACTION]: 1,\n [FloraOperation.STATE_UPDATE]: 2,\n [FloraOperation.FLORA_JOIN_REQUEST]: 3,\n [FloraOperation.FLORA_JOIN_VOTE]: 4,\n [FloraOperation.FLORA_JOIN_ACCEPTED]: 5,\n};\n\nconst HCS16_TOPIC_TYPE_BY_OP: Record<FloraOperation, FloraTopicType> = {\n [FloraOperation.FLORA_CREATED]: FloraTopicType.COMMUNICATION,\n [FloraOperation.TRANSACTION]: FloraTopicType.TRANSACTION,\n [FloraOperation.STATE_UPDATE]: FloraTopicType.STATE,\n [FloraOperation.FLORA_JOIN_REQUEST]: FloraTopicType.COMMUNICATION,\n [FloraOperation.FLORA_JOIN_VOTE]: FloraTopicType.COMMUNICATION,\n [FloraOperation.FLORA_JOIN_ACCEPTED]: FloraTopicType.STATE,\n};\n\nfunction encodeHcs16MessageSubmitTransactionMemo(op: FloraOperation): string {\n return `hcs-16:op:${HCS16_OPERATION_ENUM_BY_OP[op]}:${HCS16_TOPIC_TYPE_BY_OP[op]}`;\n}\n\n/**\n * Build a TopicCreateTransaction for HCS‑16 Flora topics (communication/transaction/state).\n */\nexport function buildHcs16CreateFloraTopicTx(params: {\n floraAccountId: string;\n topicType: FloraTopicType;\n adminKey?: MaybeKey;\n submitKey?: MaybeKey;\n operatorPublicKey?: PublicKey;\n autoRenewAccountId?: string;\n transactionMemo?: string;\n}): TopicCreateTransaction {\n const memo = encodeHcs16FloraMemo({\n floraAccountId: params.floraAccountId,\n topicType: params.topicType,\n });\n const tx = buildTopicCreateTx({\n memo,\n adminKey: params.adminKey,\n submitKey: params.submitKey,\n operatorPublicKey: params.operatorPublicKey,\n });\n tx.setTransactionMemo(\n normalizeTransactionMemo(\n params.transactionMemo,\n encodeHcs16TopicCreateTransactionMemo(params.topicType),\n ),\n );\n if (params.autoRenewAccountId) {\n tx.setAutoRenewAccountId(AccountId.fromString(params.autoRenewAccountId));\n }\n return tx;\n}\n\n/**\n * Build a TopicCreateTransaction for a generic HCS‑16 transaction topic with HIP‑991 fees.\n */\nexport function buildHcs16CreateTransactionTopicTx(params: {\n memo: string;\n adminKey?: KeyList | PublicKey;\n submitKey?: KeyList | PublicKey;\n feeScheduleKey?: KeyList | PublicKey;\n customFees?: Array<{\n amount: number;\n feeCollectorAccountId: string;\n denominatingTokenId?: string;\n }>;\n feeExemptKeys?: PublicKey[];\n}): TopicCreateTransaction {\n const tx = new TopicCreateTransaction().setTopicMemo(params.memo);\n if (params.adminKey) {\n tx.setAdminKey(params.adminKey);\n }\n if (params.submitKey) {\n tx.setSubmitKey(params.submitKey);\n }\n if (params.feeScheduleKey) {\n tx.setFeeScheduleKey(params.feeScheduleKey);\n }\n if (params.customFees && params.customFees.length > 0) {\n const fees = params.customFees.map(fee => {\n const cf = new CustomFixedFee()\n .setAmount(fee.amount)\n .setFeeCollectorAccountId(\n AccountId.fromString(fee.feeCollectorAccountId),\n );\n if (fee.denominatingTokenId) {\n cf.setDenominatingTokenId(TokenId.fromString(fee.denominatingTokenId));\n }\n return cf;\n });\n tx.setCustomFees(fees);\n }\n if (params.feeExemptKeys && params.feeExemptKeys.length > 0) {\n throw new Error('feeExemptKeys not supported by installed @hashgraph/sdk');\n }\n return tx;\n}\n\n/**\n * Build an AccountCreateTransaction for a Flora account given a KeyList and optional params.\n */\nexport function buildHcs16CreateAccountTx(params: {\n keyList: KeyList;\n initialBalanceHbar?: number;\n maxAutomaticTokenAssociations?: number;\n transactionMemo?: string;\n}): AccountCreateTransaction {\n const tx = new AccountCreateTransaction().setKey(params.keyList);\n const initial =\n typeof params.initialBalanceHbar === 'number'\n ? params.initialBalanceHbar\n : 1;\n tx.setInitialBalance(new Hbar(initial));\n const maxAssoc =\n typeof params.maxAutomaticTokenAssociations === 'number'\n ? params.maxAutomaticTokenAssociations\n : -1;\n tx.setMaxAutomaticTokenAssociations(maxAssoc);\n tx.setTransactionMemo(\n normalizeTransactionMemo(\n params.transactionMemo,\n HCS16_FLORA_ACCOUNT_CREATE_TRANSACTION_MEMO,\n ),\n );\n return tx;\n}\n\n/**\n * Build a ScheduleCreateTransaction that wraps an AccountUpdateTransaction to rotate the Flora account KeyList.\n * Members will sign this scheduled transaction until threshold is reached and it executes.\n */\nexport function buildHcs16ScheduleAccountKeyUpdateTx(params: {\n floraAccountId: string;\n newKeyList: KeyList;\n memo?: string;\n transactionMemo?: string;\n}): ScheduleCreateTransaction {\n const inner = new AccountUpdateTransaction()\n .setAccountId(AccountId.fromString(params.floraAccountId))\n .setKey(params.newKeyList);\n inner.setTransactionMemo(\n normalizeTransactionMemo(\n params.transactionMemo ?? params.memo,\n HCS16_ACCOUNT_KEY_UPDATE_TRANSACTION_MEMO,\n ),\n );\n return new ScheduleCreateTransaction().setScheduledTransaction(inner);\n}\n\n/**\n * Build a ScheduleCreateTransaction that wraps a TopicUpdateTransaction to rotate topic admin/submit keys.\n * Repeat for CTopic, TTopic, and STopic as needed for membership changes.\n */\nexport function buildHcs16ScheduleTopicKeyUpdateTx(params: {\n topicId: string;\n adminKey?: KeyList | PublicKey;\n submitKey?: KeyList | PublicKey;\n memo?: string;\n transactionMemo?: string;\n}): ScheduleCreateTransaction {\n const inner = new TopicUpdateTransaction().setTopicId(params.topicId);\n if (params.adminKey) {\n inner.setAdminKey(params.adminKey);\n }\n if (params.submitKey) {\n inner.setSubmitKey(params.submitKey);\n }\n inner.setTransactionMemo(\n normalizeTransactionMemo(\n params.transactionMemo ?? params.memo,\n HCS16_TOPIC_KEY_UPDATE_TRANSACTION_MEMO,\n ),\n );\n return new ScheduleCreateTransaction().setScheduledTransaction(inner);\n}\n\n/**\n * Build a TopicMessageSubmitTransaction for generic HCS‑16 messages.\n * Body fields are merged into the envelope `{ p: 'hcs-16', op, operator_id }`.\n */\nexport function buildHcs16MessageTx(params: {\n topicId: string;\n operatorId: string;\n op: FloraOperation;\n body?: Record<string, unknown>;\n transactionMemo?: string;\n}): TopicMessageSubmitTransaction {\n const payload: FloraMessage = {\n p: 'hcs-16',\n op: params.op,\n operator_id: params.operatorId,\n ...(params.body || {}),\n } as FloraMessage;\n\n return buildMessageTx({\n topicId: params.topicId,\n message: JSON.stringify(payload),\n transactionMemo: normalizeTransactionMemo(\n params.transactionMemo,\n encodeHcs16MessageSubmitTransactionMemo(params.op),\n ),\n });\n}\n\n/**\n * Build HCS‑16 flora_created message.\n */\nexport function buildHcs16FloraCreatedTx(params: {\n topicId: string;\n operatorId: string;\n floraAccountId: string;\n topics: { communication: string; transaction: string; state: string };\n}): TopicMessageSubmitTransaction {\n return buildHcs16MessageTx({\n topicId: params.topicId,\n operatorId: params.operatorId,\n op: FloraOperation.FLORA_CREATED,\n body: {\n flora_account_id: params.floraAccountId,\n topics: params.topics,\n },\n });\n}\n\n/**\n * Build HCS‑16 transaction message.\n */\nexport function buildHcs16TransactionTx(params: {\n topicId: string;\n operatorId: string;\n scheduleId: string;\n data?: string;\n}): TopicMessageSubmitTransaction {\n return buildHcs16MessageTx({\n topicId: params.topicId,\n operatorId: params.operatorId,\n op: FloraOperation.TRANSACTION,\n body: {\n schedule_id: params.scheduleId,\n data: params.data,\n m: params.data,\n },\n });\n}\n\n/**\n * Build HCS‑17 state_hash message for Flora STopic state updates.\n */\nexport function buildHcs16StateUpdateTx(params: {\n topicId: string;\n operatorId: string;\n hash: string;\n epoch?: number;\n accountId?: string;\n topics?: string[];\n memo?: string;\n transactionMemo?: string;\n}): TopicMessageSubmitTransaction {\n const payload = {\n p: 'hcs-17',\n op: 'state_hash',\n state_hash: params.hash,\n topics: params.topics ?? [],\n account_id: params.accountId ?? params.operatorId,\n epoch: params.epoch,\n timestamp: new Date().toISOString(),\n m: params.memo,\n };\n return buildMessageTx({\n topicId: params.topicId,\n message: JSON.stringify(payload),\n transactionMemo: normalizeTransactionMemo(\n params.transactionMemo,\n HCS17_STATE_HASH_TRANSACTION_MEMO,\n ),\n });\n}\n\n/**\n * Build HCS‑16 flora_join_request message.\n */\nexport function buildHcs16FloraJoinRequestTx(params: {\n topicId: string;\n operatorId: string;\n accountId: string;\n connectionRequestId: number;\n connectionTopicId: string;\n connectionSeq: number;\n}): TopicMessageSubmitTransaction {\n return buildHcs16MessageTx({\n topicId: params.topicId,\n operatorId: params.operatorId,\n op: FloraOperation.FLORA_JOIN_REQUEST,\n body: {\n account_id: params.accountId,\n connection_request_id: params.connectionRequestId,\n connection_topic_id: params.connectionTopicId,\n connection_seq: params.connectionSeq,\n },\n });\n}\n\n/**\n * Build HCS‑16 flora_join_vote message.\n */\nexport function buildHcs16FloraJoinVoteTx(params: {\n topicId: string;\n operatorId: string;\n accountId: string;\n approve: boolean;\n connectionRequestId: number;\n connectionSeq: number;\n}): TopicMessageSubmitTransaction {\n return buildHcs16MessageTx({\n topicId: params.topicId,\n operatorId: params.operatorId,\n op: FloraOperation.FLORA_JOIN_VOTE,\n body: {\n account_id: params.accountId,\n approve: params.approve,\n connection_request_id: params.connectionRequestId,\n connection_seq: params.connectionSeq,\n },\n });\n}\n\n/**\n * Build HCS‑16 flora_join_accepted message.\n */\nexport function buildHcs16FloraJoinAcceptedTx(params: {\n topicId: string;\n operatorId: string;\n members: string[];\n epoch?: number;\n}): TopicMessageSubmitTransaction {\n return buildHcs16MessageTx({\n topicId: params.topicId,\n operatorId: params.operatorId,\n op: FloraOperation.FLORA_JOIN_ACCEPTED,\n body: {\n members: params.members,\n epoch: params.epoch,\n },\n });\n}\n"],"names":[],"mappings":";;;AAqBO,MAAM,8CACX;AACK,MAAM,oCAAoC;AAC1C,MAAM,4CAA4C;AAClD,MAAM,0CAA0C;AAEvD,SAAS,yBACP,OACA,UACQ;AACR,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,QAAM,UAAU,MAAM,KAAA;AACtB,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO;AACT;AAEA,SAAS,qBAAqB,QAGnB;AACT,SAAO,UAAU,OAAO,cAAc,IAAI,OAAO,SAAS;AAC5D;AAEA,SAAS,sCACP,WACQ;AACR,SAAO,0BAA0B,SAAS;AAC5C;AAEA,MAAM,6BAA6D;AAAA,EACjE,CAAC,eAAe,aAAa,GAAG;AAAA,EAChC,CAAC,eAAe,WAAW,GAAG;AAAA,EAC9B,CAAC,eAAe,YAAY,GAAG;AAAA,EAC/B,CAAC,eAAe,kBAAkB,GAAG;AAAA,EACrC,CAAC,eAAe,eAAe,GAAG;AAAA,EAClC,CAAC,eAAe,mBAAmB,GAAG;AACxC;AAEA,MAAM,yBAAiE;AAAA,EACrE,CAAC,eAAe,aAAa,GAAG,eAAe;AAAA,EAC/C,CAAC,eAAe,WAAW,GAAG,eAAe;AAAA,EAC7C,CAAC,eAAe,YAAY,GAAG,eAAe;AAAA,EAC9C,CAAC,eAAe,kBAAkB,GAAG,eAAe;AAAA,EACpD,CAAC,eAAe,eAAe,GAAG,eAAe;AAAA,EACjD,CAAC,eAAe,mBAAmB,GAAG,eAAe;AACvD;AAEA,SAAS,wCAAwC,IAA4B;AAC3E,SAAO,aAAa,2BAA2B,EAAE,CAAC,IAAI,uBAAuB,EAAE,CAAC;AAClF;AAKO,SAAS,6BAA6B,QAQlB;AACzB,QAAM,OAAO,qB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B,QAOR;AAChC,SAAO,oBAAoB;AAAA,IACzB,SAAS,OAAO;AAAA,IAChB,YAAY,OAAO;AAAA,IACnB,IAAI,eAAe;AAAA,IACnB,MAAM;AAAA,MACJ,YAAY,OAAO;AAAA,MACnB,SAAS,OAAO;AAAA,MAChB,uBAAuB,OAAO;AAAA,MAC9B,gBAAgB,OAAO;AAAA,IAAA;AAAA,EACzB,CACD;AACH;AAKO,SAAS,8BAA8B,QAKZ;AAChC,SAAO,oBAAoB;AAAA,IACzB,SAAS,OAAO;AAAA,IAChB,YAAY,OAAO;AAAA,IACnB,IAAI,eAAe;AAAA,IACnB,MAAM;AAAA,MACJ,SAAS,OAAO;AAAA,MAChB,OAAO,OAAO;AAAA,IAAA;AAAA,EAChB,CACD;AACH;"}
1
+ {"version":3,"file":"standards-sdk.es92.js","sources":["../../src/hcs-16/tx.ts"],"sourcesContent":["import {\n TopicCreateTransaction,\n TopicMessageSubmitTransaction,\n TopicUpdateTransaction,\n AccountCreateTransaction,\n AccountUpdateTransaction,\n ScheduleCreateTransaction,\n Hbar,\n PublicKey,\n KeyList,\n AccountId,\n CustomFixedFee,\n TokenId,\n} from '@hashgraph/sdk';\nimport {\n buildTopicCreateTx,\n buildMessageTx,\n type MaybeKey,\n} from '../common/tx/tx-utils';\nimport { FloraOperation, FloraTopicType, type FloraMessage } from './types';\n\nfunction encodeHcs16FloraMemo(params: {\n floraAccountId: string;\n topicType: FloraTopicType;\n}): string {\n return `hcs-16:${params.floraAccountId}:${params.topicType}`;\n}\n\n/**\n * Build a TopicCreateTransaction for HCS‑16 Flora topics (communication/transaction/state).\n */\nexport function buildHcs16CreateFloraTopicTx(params: {\n floraAccountId: string;\n topicType: FloraTopicType;\n adminKey?: MaybeKey;\n submitKey?: MaybeKey;\n operatorPublicKey?: PublicKey;\n autoRenewAccountId?: string;\n}): TopicCreateTransaction {\n const memo = encodeHcs16FloraMemo({\n floraAccountId: params.floraAccountId,\n topicType: params.topicType,\n });\n const tx = buildTopicCreateTx({\n memo,\n adminKey: params.adminKey,\n submitKey: params.submitKey,\n operatorPublicKey: params.operatorPublicKey,\n });\n if (params.autoRenewAccountId) {\n tx.setAutoRenewAccountId(AccountId.fromString(params.autoRenewAccountId));\n }\n return tx;\n}\n\n/**\n * Build a TopicCreateTransaction for a generic HCS‑16 transaction topic with HIP‑991 fees.\n */\nexport function buildHcs16CreateTransactionTopicTx(params: {\n memo: string;\n adminKey?: KeyList | PublicKey;\n submitKey?: KeyList | PublicKey;\n feeScheduleKey?: KeyList | PublicKey;\n customFees?: Array<{\n amount: number;\n feeCollectorAccountId: string;\n denominatingTokenId?: string;\n }>;\n feeExemptKeys?: PublicKey[];\n}): TopicCreateTransaction {\n const tx = new TopicCreateTransaction().setTopicMemo(params.memo);\n if (params.adminKey) {\n tx.setAdminKey(params.adminKey);\n }\n if (params.submitKey) {\n tx.setSubmitKey(params.submitKey);\n }\n if (params.feeScheduleKey) {\n tx.setFeeScheduleKey(params.feeScheduleKey);\n }\n if (params.customFees && params.customFees.length > 0) {\n const fees = params.customFees.map(fee => {\n const cf = new CustomFixedFee()\n .setAmount(fee.amount)\n .setFeeCollectorAccountId(\n AccountId.fromString(fee.feeCollectorAccountId),\n );\n if (fee.denominatingTokenId) {\n cf.setDenominatingTokenId(TokenId.fromString(fee.denominatingTokenId));\n }\n return cf;\n });\n tx.setCustomFees(fees);\n }\n if (params.feeExemptKeys && params.feeExemptKeys.length > 0) {\n throw new Error('feeExemptKeys not supported by installed @hashgraph/sdk');\n }\n return tx;\n}\n\n/**\n * Build an AccountCreateTransaction for a Flora account given a KeyList and optional params.\n */\nexport function buildHcs16CreateAccountTx(params: {\n keyList: KeyList;\n initialBalanceHbar?: number;\n maxAutomaticTokenAssociations?: number;\n}): AccountCreateTransaction {\n const tx = new AccountCreateTransaction().setKey(params.keyList);\n const initial =\n typeof params.initialBalanceHbar === 'number'\n ? params.initialBalanceHbar\n : 1;\n tx.setInitialBalance(new Hbar(initial));\n const maxAssoc =\n typeof params.maxAutomaticTokenAssociations === 'number'\n ? params.maxAutomaticTokenAssociations\n : -1;\n tx.setMaxAutomaticTokenAssociations(maxAssoc);\n return tx;\n}\n\n/**\n * Build a ScheduleCreateTransaction that wraps an AccountUpdateTransaction to rotate the Flora account KeyList.\n * Members will sign this scheduled transaction until threshold is reached and it executes.\n */\nexport function buildHcs16ScheduleAccountKeyUpdateTx(params: {\n floraAccountId: string;\n newKeyList: KeyList;\n memo?: string;\n}): ScheduleCreateTransaction {\n const inner = new AccountUpdateTransaction()\n .setAccountId(AccountId.fromString(params.floraAccountId))\n .setKey(params.newKeyList);\n if (params.memo) {\n inner.setTransactionMemo(params.memo);\n }\n return new ScheduleCreateTransaction().setScheduledTransaction(inner);\n}\n\n/**\n * Build a ScheduleCreateTransaction that wraps a TopicUpdateTransaction to rotate topic admin/submit keys.\n * Repeat for CTopic, TTopic, and STopic as needed for membership changes.\n */\nexport function buildHcs16ScheduleTopicKeyUpdateTx(params: {\n topicId: string;\n adminKey?: KeyList | PublicKey;\n submitKey?: KeyList | PublicKey;\n memo?: string;\n}): ScheduleCreateTransaction {\n const inner = new TopicUpdateTransaction().setTopicId(params.topicId);\n if (params.adminKey) {\n inner.setAdminKey(params.adminKey);\n }\n if (params.submitKey) {\n inner.setSubmitKey(params.submitKey);\n }\n if (params.memo) {\n inner.setTransactionMemo(params.memo);\n }\n return new ScheduleCreateTransaction().setScheduledTransaction(inner);\n}\n\n/**\n * Build a TopicMessageSubmitTransaction for generic HCS‑16 messages.\n * Body fields are merged into the envelope `{ p: 'hcs-16', op, operator_id }`.\n */\nexport function buildHcs16MessageTx(params: {\n topicId: string;\n operatorId: string;\n op: FloraOperation;\n body?: Record<string, unknown>;\n}): TopicMessageSubmitTransaction {\n const payload: FloraMessage = {\n p: 'hcs-16',\n op: params.op,\n operator_id: params.operatorId,\n ...(params.body || {}),\n } as FloraMessage;\n\n return buildMessageTx({\n topicId: params.topicId,\n message: JSON.stringify(payload),\n });\n}\n\n/**\n * Build HCS‑16 flora_created message.\n */\nexport function buildHcs16FloraCreatedTx(params: {\n topicId: string;\n operatorId: string;\n floraAccountId: string;\n topics: { communication: string; transaction: string; state: string };\n}): TopicMessageSubmitTransaction {\n return buildHcs16MessageTx({\n topicId: params.topicId,\n operatorId: params.operatorId,\n op: FloraOperation.FLORA_CREATED,\n body: {\n flora_account_id: params.floraAccountId,\n topics: params.topics,\n },\n });\n}\n\n/**\n * Build HCS‑16 transaction message.\n */\nexport function buildHcs16TransactionTx(params: {\n topicId: string;\n operatorId: string;\n scheduleId: string;\n data?: string;\n}): TopicMessageSubmitTransaction {\n return buildHcs16MessageTx({\n topicId: params.topicId,\n operatorId: params.operatorId,\n op: FloraOperation.TRANSACTION,\n body: {\n schedule_id: params.scheduleId,\n data: params.data,\n m: params.data,\n },\n });\n}\n\n/**\n * Build HCS‑16 state_update message.\n */\nexport function buildHcs16StateUpdateTx(params: {\n topicId: string;\n operatorId: string;\n hash: string;\n epoch?: number;\n}): TopicMessageSubmitTransaction {\n return buildHcs16MessageTx({\n topicId: params.topicId,\n operatorId: params.operatorId,\n op: FloraOperation.STATE_UPDATE,\n body: {\n hash: params.hash,\n epoch: params.epoch,\n timestamp: new Date().toISOString(),\n },\n });\n}\n\n/**\n * Build HCS‑16 flora_join_request message.\n */\nexport function buildHcs16FloraJoinRequestTx(params: {\n topicId: string;\n operatorId: string;\n candidateAccountId: string;\n}): TopicMessageSubmitTransaction {\n return buildHcs16MessageTx({\n topicId: params.topicId,\n operatorId: params.operatorId,\n op: FloraOperation.FLORA_JOIN_REQUEST,\n body: {\n candidate_account_id: params.candidateAccountId,\n },\n });\n}\n\n/**\n * Build HCS‑16 flora_join_vote message.\n */\nexport function buildHcs16FloraJoinVoteTx(params: {\n topicId: string;\n operatorId: string;\n candidateAccountId: string;\n approve: boolean;\n}): TopicMessageSubmitTransaction {\n return buildHcs16MessageTx({\n topicId: params.topicId,\n operatorId: params.operatorId,\n op: FloraOperation.FLORA_JOIN_VOTE,\n body: {\n candidate_account_id: params.candidateAccountId,\n approve: params.approve,\n },\n });\n}\n\n/**\n * Build HCS‑16 flora_join_accepted message.\n */\nexport function buildHcs16FloraJoinAcceptedTx(params: {\n topicId: string;\n operatorId: string;\n members: string[];\n epoch?: number;\n}): TopicMessageSubmitTransaction {\n return buildHcs16MessageTx({\n topicId: params.topicId,\n operatorId: params.operatorId,\n op: FloraOperation.FLORA_JOIN_ACCEPTED,\n body: {\n members: params.members,\n epoch: params.epoch,\n },\n });\n}\n"],"names":[],"mappings":";;;AAqBA,SAAS,qBAAqB,QAGnB;AACT,SAAO,UAAU,OAAO,cAAc,IAAI,OAAO,SAAS;AAC5D;AAKO,SAAS,6BAA6B,QAOlB;AACzB,QAAM,OAAO,qBAAqB;AAAA,IAChC,gBAAgB,OAAO;AAAA,IACvB,WAAW,OAAO;AAAA,EAAA,CACnB;AACD,QAAM,KAAK,mBAAmB;AAAA,IAC5B;AAAA,IACA,UAAU,OAAO;AAAA,IACjB,WAAW,OAAO;AAAA,IAClB,mBAAmB,OAAO;AAAA,EAAA,CAC3B;AACD,MAAI,OAAO,oBAAoB;AAC7B,OAAG,sBAAsB,UAAU,WAAW,OAAO,kBAAkB,CAAC;AAAA,EAC1E;AACA,SAAO;AACT;AAKO,SAAS,mCAAmC,QAWxB;AACzB,QAAM,KAAK,IAAI,uBAAA,EAAyB,aAAa,OAAO,IAAI;AAChE,MAAI,OAAO,UAAU;AACnB,OAAG,YAAY,OAAO,QAAQ;AAAA,EAChC;AACA,MAAI,OAAO,WAAW;AACpB,OAAG,aAAa,OAAO,SAAS;AAAA,EAClC;AACA,MAAI,OAAO,gBAAgB;AACzB,OAAG,kBAAkB,OAAO,cAAc;AAAA,EAC5C;AACA,MAAI,OAAO,cAAc,OAAO,WAAW,SAAS,GAAG;AACrD,UAAM,OAAO,OAAO,WAAW,IAAI,CAAA,QAAO;AACxC,YAAM,KAAK,IAAI,eAAA,EACZ,UAAU,IAAI,MAAM,EACpB;AAAA,QACC,UAAU,WAAW,I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AAA,IACnB,MAAM;AAAA,MACJ,sBAAsB,OAAO;AAAA,MAC7B,SAAS,OAAO;AAAA,IAAA;AAAA,EAClB,CACD;AACH;AAKO,SAAS,8BAA8B,QAKZ;AAChC,SAAO,oBAAoB;AAAA,IACzB,SAAS,OAAO;AAAA,IAChB,YAAY,OAAO;AAAA,IACnB,IAAI,eAAe;AAAA,IACnB,MAAM;AAAA,MACJ,SAAS,OAAO;AAAA,MAChB,OAAO,OAAO;AAAA,IAAA;AAAA,EAChB,CACD;AACH;"}
@@ -2,7 +2,7 @@ import { AccountId, Client, ScheduleSignTransaction } from "@hashgraph/sdk";
2
2
  import { createNodeOperatorContext } from "./standards-sdk.es145.js";
3
3
  import { HederaMirrorNode } from "./standards-sdk.es127.js";
4
4
  import { HCS16BaseClient } from "./standards-sdk.es95.js";
5
- import { buildHcs16CreateFloraTopicTx, buildHcs16CreateAccountTx, buildHcs16FloraCreatedTx, buildHcs16TransactionTx, buildHcs16StateUpdateTx, buildHcs16FloraJoinRequestTx, buildHcs16FloraJoinVoteTx, buildHcs16FloraJoinAcceptedTx } from "./standards-sdk.es92.js";
5
+ import { buildHcs16CreateFloraTopicTx, buildHcs16FloraCreatedTx, buildHcs16TransactionTx, buildHcs16StateUpdateTx, buildHcs16CreateAccountTx } from "./standards-sdk.es92.js";
6
6
  class HCS16Client extends HCS16BaseClient {
7
7
  constructor(config) {
8
8
  super({ network: config.network, logger: config.logger });
@@ -19,14 +19,10 @@ class HCS16Client extends HCS16BaseClient {
19
19
  });
20
20
  this.client = this.operatorCtx.client;
21
21
  }
22
- async ensureOperatorReady() {
23
- await this.operatorCtx.ensureInitialized();
24
- }
25
22
  /**
26
23
  * Create a Flora topic with memo `hcs-16:<floraAccountId>:<topicType>`.
27
24
  */
28
25
  async createFloraTopic(params) {
29
- await this.ensureOperatorReady();
30
26
  const tx = buildHcs16CreateFloraTopicTx({
31
27
  floraAccountId: params.floraAccountId,
32
28
  topicType: params.topicType,
@@ -35,20 +31,6 @@ class HCS16Client extends HCS16BaseClient {
35
31
  operatorPublicKey: this.client.operatorPublicKey || void 0,
36
32
  autoRenewAccountId: params.autoRenewAccountId
37
33
  });
38
- const signerKeys = params.signerKeys ?? [];
39
- if (signerKeys.length > 0) {
40
- const frozen = await tx.freezeWith(this.client);
41
- let signed = frozen;
42
- for (const key of signerKeys) {
43
- signed = await signed.sign(key);
44
- }
45
- const resp2 = await signed.execute(this.client);
46
- const receipt2 = await resp2.getReceipt(this.client);
47
- if (!receipt2.topicId) {
48
- throw new Error("Failed to create Flora topic");
49
- }
50
- return receipt2.topicId.toString();
51
- }
52
34
  const resp = await tx.execute(this.client);
53
35
  const receipt = await resp.getReceipt(this.client);
54
36
  if (!receipt.topicId) {
@@ -56,22 +38,7 @@ class HCS16Client extends HCS16BaseClient {
56
38
  }
57
39
  return receipt.topicId.toString();
58
40
  }
59
- async createFloraAccount(params) {
60
- await this.ensureOperatorReady();
61
- const tx = buildHcs16CreateAccountTx({
62
- keyList: params.keyList,
63
- initialBalanceHbar: params.initialBalanceHbar,
64
- maxAutomaticTokenAssociations: params.maxAutomaticTokenAssociations
65
- });
66
- const resp = await tx.execute(this.client);
67
- const receipt = await resp.getReceipt(this.client);
68
- if (!receipt.accountId) {
69
- throw new Error("Failed to create Flora account");
70
- }
71
- return { accountId: receipt.accountId.toString(), receipt };
72
- }
73
41
  async sendFloraCreated(params) {
74
- await this.ensureOperatorReady();
75
42
  const tx = buildHcs16FloraCreatedTx(params);
76
43
  const resp = await tx.execute(this.client);
77
44
  return resp.getReceipt(this.client);
@@ -80,7 +47,6 @@ class HCS16Client extends HCS16BaseClient {
80
47
  * Send HCS-16 transaction (preferred). scheduleId is the ScheduleId entity (e.g., 0.0.12345).
81
48
  */
82
49
  async sendTransaction(params) {
83
- await this.ensureOperatorReady();
84
50
  const tx = buildHcs16TransactionTx(params);
85
51
  const resp = await tx.execute(this.client);
86
52
  return resp.getReceipt(this.client);
@@ -90,72 +56,13 @@ class HCS16Client extends HCS16BaseClient {
90
56
  * The signer must be a valid member key for the scheduled transaction to count toward threshold.
91
57
  */
92
58
  async signSchedule(params) {
93
- await this.ensureOperatorReady();
94
59
  const tx = await new ScheduleSignTransaction().setScheduleId(params.scheduleId).freezeWith(this.client);
95
60
  const signed = await tx.sign(params.signerKey);
96
61
  const resp = await signed.execute(this.client);
97
62
  return resp.getReceipt(this.client);
98
63
  }
99
64
  async sendStateUpdate(params) {
100
- await this.ensureOperatorReady();
101
- const tx = buildHcs16StateUpdateTx({
102
- topicId: params.topicId,
103
- operatorId: params.operatorId,
104
- hash: params.hash,
105
- epoch: params.epoch,
106
- accountId: params.accountId,
107
- topics: params.topics,
108
- memo: params.memo,
109
- transactionMemo: params.transactionMemo
110
- });
111
- if (params.signerKeys && params.signerKeys.length > 0) {
112
- const frozen = await tx.freezeWith(this.client);
113
- let signed = frozen;
114
- for (const key of params.signerKeys) {
115
- signed = await signed.sign(key);
116
- }
117
- const resp2 = await signed.execute(this.client);
118
- return resp2.getReceipt(this.client);
119
- }
120
- const resp = await tx.execute(this.client);
121
- return resp.getReceipt(this.client);
122
- }
123
- async sendFloraJoinRequest(params) {
124
- await this.ensureOperatorReady();
125
- const tx = buildHcs16FloraJoinRequestTx(params);
126
- if (params.signerKey) {
127
- const frozen = await tx.freezeWith(this.client);
128
- const signed = await frozen.sign(params.signerKey);
129
- const resp2 = await signed.execute(this.client);
130
- return resp2.getReceipt(this.client);
131
- }
132
- const resp = await tx.execute(this.client);
133
- return resp.getReceipt(this.client);
134
- }
135
- async sendFloraJoinVote(params) {
136
- await this.ensureOperatorReady();
137
- const tx = buildHcs16FloraJoinVoteTx(params);
138
- if (params.signerKey) {
139
- const frozen = await tx.freezeWith(this.client);
140
- const signed = await frozen.sign(params.signerKey);
141
- const resp2 = await signed.execute(this.client);
142
- return resp2.getReceipt(this.client);
143
- }
144
- const resp = await tx.execute(this.client);
145
- return resp.getReceipt(this.client);
146
- }
147
- async sendFloraJoinAccepted(params) {
148
- await this.ensureOperatorReady();
149
- const tx = buildHcs16FloraJoinAcceptedTx(params);
150
- if (params.signerKeys && params.signerKeys.length > 0) {
151
- const frozen = await tx.freezeWith(this.client);
152
- let signed = frozen;
153
- for (const key of params.signerKeys) {
154
- signed = await signed.sign(key);
155
- }
156
- const resp2 = await signed.execute(this.client);
157
- return resp2.getReceipt(this.client);
158
- }
65
+ const tx = buildHcs16StateUpdateTx(params);
159
66
  const resp = await tx.execute(this.client);
160
67
  return resp.getReceipt(this.client);
161
68
  }
@@ -170,7 +77,6 @@ class HCS16Client extends HCS16BaseClient {
170
77
  * Returns the Flora account ID and the topic IDs.
171
78
  */
172
79
  async createFloraAccountWithTopics(params) {
173
- await this.ensureOperatorReady();
174
80
  const keyList = await this.assembleKeyList({
175
81
  members: params.members,
176
82
  threshold: params.threshold
@@ -211,7 +117,6 @@ class HCS16Client extends HCS16BaseClient {
211
117
  * Convenience: publish flora_created on the communication topic.
212
118
  */
213
119
  async publishFloraCreated(params) {
214
- await this.ensureOperatorReady();
215
120
  const tx = buildHcs16FloraCreatedTx({
216
121
  topicId: params.communicationTopicId,
217
122
  operatorId: params.operatorId,