@hashgraphonline/standards-sdk 0.1.143-feat-solana-register.canary.99d8b7e.62 → 0.1.143-feat-solana-register.canary.749526.64

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.
@@ -1,7 +1,7 @@
1
1
  import "./standards-sdk.es2.js";
2
2
  import { Client, PrivateKey, AccountCreateTransaction, Hbar, CustomFixedFee, AccountId, TokenId, KeyList, TopicMessageSubmitTransaction, Transaction, ScheduleCreateTransaction, Timestamp } from "@hashgraph/sdk";
3
3
  import { AccountCreationError, TopicCreationError, ConnectionConfirmationError, PayloadSizeError } from "./standards-sdk.es18.js";
4
- import { InscriptionSDK } from "./standards-sdk.es147.js";
4
+ import { InscriptionSDK } from "./standards-sdk.es148.js";
5
5
  import { Logger } from "./standards-sdk.es106.js";
6
6
  import { accountIdsToExemptKeys } from "./standards-sdk.es108.js";
7
7
  import { ProgressReporter } from "./standards-sdk.es109.js";
@@ -20,7 +20,7 @@ import "ethers";
20
20
  import "./standards-sdk.es123.js";
21
21
  import "./standards-sdk.es114.js";
22
22
  import { getTopicId } from "./standards-sdk.es115.js";
23
- import { InscriptionSDK } from "./standards-sdk.es147.js";
23
+ import { InscriptionSDK } from "./standards-sdk.es148.js";
24
24
  import { HCS10BaseClient, Hcs10MemoType } from "./standards-sdk.es17.js";
25
25
  import * as mime from "mime-types";
26
26
  import { AgentBuilder } from "./standards-sdk.es24.js";
@@ -1,6 +1,6 @@
1
1
  import { Client, Status, PrivateKey, AccountUpdateTransaction } from "@hashgraph/sdk";
2
2
  import { inscribeWithSigner, inscribe } from "./standards-sdk.es125.js";
3
- import "./standards-sdk.es147.js";
3
+ import "./standards-sdk.es148.js";
4
4
  import { Logger } from "./standards-sdk.es106.js";
5
5
  import { HederaMirrorNode } from "./standards-sdk.es127.js";
6
6
  import { ProgressReporter } from "./standards-sdk.es109.js";
@@ -1,6 +1,6 @@
1
1
  import { RegistryType } from "./standards-sdk.es30.js";
2
2
  import { inscribe, inscribeWithSigner } from "./standards-sdk.es125.js";
3
- import "./standards-sdk.es147.js";
3
+ import "./standards-sdk.es148.js";
4
4
  class BaseRegistry {
5
5
  constructor(networkType, logger, registryType, topicId, client) {
6
6
  this.entries = /* @__PURE__ */ new Map();
@@ -1,7 +1,7 @@
1
1
  import { RegistryType } from "./standards-sdk.es30.js";
2
2
  import { BaseRegistry } from "./standards-sdk.es31.js";
3
3
  import { retrieveInscription } from "./standards-sdk.es125.js";
4
- import "./standards-sdk.es147.js";
4
+ import "./standards-sdk.es148.js";
5
5
  import { getCryptoAdapter } from "./standards-sdk.es120.js";
6
6
  import { isSSREnvironment } from "./standards-sdk.es118.js";
7
7
  import { validateActionRegistration } from "./standards-sdk.es43.js";
@@ -13,7 +13,7 @@ import "crypto";
13
13
  import "@noble/curves/secp256k1.js";
14
14
  import "zod";
15
15
  import "./standards-sdk.es139.js";
16
- import "./standards-sdk.es147.js";
16
+ import "./standards-sdk.es148.js";
17
17
  import "@hashgraph/proto";
18
18
  import "@hashgraph/sdk";
19
19
  import "ethers";
@@ -3,7 +3,7 @@ import { HCS12BaseClient } from "./standards-sdk.es36.js";
3
3
  import { createNodeOperatorContext } from "./standards-sdk.es145.js";
4
4
  import { RegistryType } from "./standards-sdk.es30.js";
5
5
  import { inscribe } from "./standards-sdk.es125.js";
6
- import { InscriptionSDK } from "./standards-sdk.es147.js";
6
+ import { InscriptionSDK } from "./standards-sdk.es148.js";
7
7
  import { ActionRegistry } from "./standards-sdk.es32.js";
8
8
  import { BlockLoader } from "./standards-sdk.es33.js";
9
9
  import { AssemblyRegistry } from "./standards-sdk.es34.js";
@@ -2,7 +2,7 @@ import { TopicCreateTransaction, TransactionId, AccountId, PublicKey, KeyList, T
2
2
  import { HCS12BaseClient } from "./standards-sdk.es36.js";
3
3
  import { RegistryType } from "./standards-sdk.es30.js";
4
4
  import { inscribeWithSigner } from "./standards-sdk.es125.js";
5
- import { InscriptionSDK } from "./standards-sdk.es147.js";
5
+ import { InscriptionSDK } from "./standards-sdk.es148.js";
6
6
  import { ActionRegistry } from "./standards-sdk.es32.js";
7
7
  import { BlockLoader } from "./standards-sdk.es33.js";
8
8
  import { AssemblyRegistry } from "./standards-sdk.es34.js";
@@ -1,4 +1,4 @@
1
- import { HCS5BaseClient } from "./standards-sdk.es148.js";
1
+ import { HCS5BaseClient } from "./standards-sdk.es147.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.es148.js";
1
+ import { HCS5BaseClient } from "./standards-sdk.es147.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";
@@ -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, buildHcs16FloraCreatedTx, buildHcs16TransactionTx, buildHcs16StateUpdateTx, buildHcs16CreateAccountTx } from "./standards-sdk.es92.js";
5
+ import { buildHcs16CreateFloraTopicTx, buildHcs16FloraCreatedTx, buildHcs16TransactionTx, buildHcs16StateUpdateTx, buildHcs16FloraJoinRequestTx, buildHcs16FloraJoinVoteTx, buildHcs16FloraJoinAcceptedTx, 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 });
@@ -62,7 +62,57 @@ class HCS16Client extends HCS16BaseClient {
62
62
  return resp.getReceipt(this.client);
63
63
  }
64
64
  async sendStateUpdate(params) {
65
- const tx = buildHcs16StateUpdateTx(params);
65
+ const tx = buildHcs16StateUpdateTx({
66
+ topicId: params.topicId,
67
+ operatorId: params.operatorId,
68
+ hash: params.hash,
69
+ epoch: params.epoch
70
+ });
71
+ if (params.signerKeys && params.signerKeys.length > 0) {
72
+ const frozen = await tx.freezeWith(this.client);
73
+ let signed = frozen;
74
+ for (const key of params.signerKeys) {
75
+ signed = await signed.sign(key);
76
+ }
77
+ const resp2 = await signed.execute(this.client);
78
+ return resp2.getReceipt(this.client);
79
+ }
80
+ const resp = await tx.execute(this.client);
81
+ return resp.getReceipt(this.client);
82
+ }
83
+ async sendFloraJoinRequest(params) {
84
+ const tx = buildHcs16FloraJoinRequestTx(params);
85
+ if (params.signerKey) {
86
+ const frozen = await tx.freezeWith(this.client);
87
+ const signed = await frozen.sign(params.signerKey);
88
+ const resp2 = await signed.execute(this.client);
89
+ return resp2.getReceipt(this.client);
90
+ }
91
+ const resp = await tx.execute(this.client);
92
+ return resp.getReceipt(this.client);
93
+ }
94
+ async sendFloraJoinVote(params) {
95
+ const tx = buildHcs16FloraJoinVoteTx(params);
96
+ if (params.signerKey) {
97
+ const frozen = await tx.freezeWith(this.client);
98
+ const signed = await frozen.sign(params.signerKey);
99
+ const resp2 = await signed.execute(this.client);
100
+ return resp2.getReceipt(this.client);
101
+ }
102
+ const resp = await tx.execute(this.client);
103
+ return resp.getReceipt(this.client);
104
+ }
105
+ async sendFloraJoinAccepted(params) {
106
+ const tx = buildHcs16FloraJoinAcceptedTx(params);
107
+ if (params.signerKeys && params.signerKeys.length > 0) {
108
+ const frozen = await tx.freezeWith(this.client);
109
+ let signed = frozen;
110
+ for (const key of params.signerKeys) {
111
+ signed = await signed.sign(key);
112
+ }
113
+ const resp2 = await signed.execute(this.client);
114
+ return resp2.getReceipt(this.client);
115
+ }
66
116
  const resp = await tx.execute(this.client);
67
117
  return resp.getReceipt(this.client);
68
118
  }
@@ -1 +1 @@
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;AAA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AAA,IACL,KAAK,yBAAyB;AAAA,MAChC;AAAA,MACA;AAAA,MACA;AAAA,MACA,oBAAoB,OAAO;AAAA,IAAA,CAC5B;AAED,UAAM,QAAQ,MAAM,OACjB,QAAQ,KAAK,MAAM,EACnB,KAAK,CAAA,MAAK,EAAE,WAAW,KAAK,MAAM,CAAC;AACtC,UAAM,OAAO,MAAM,MAChB,QAAQ,KAAK,MAAM,EACnB,KAAK,CAAA,MAAK,EAAE,WAAW,KAAK,MAAM,CAAC;AACtC,UAAM,SAAS,MAAM,QAClB,QAAQ,KAAK,MAAM,EACnB,KAAK,CAAA,MAAK,EAAE,WAAW,KAAK,MAAM,CAAC;AACtC,UAAM,SAAS;AAAA,MACb,eAAe,MAAM,QAAS,SAAA;AAAA,MAC9B,aAAa,KAAK,QAAS,SAAA;AAAA,MAC3B,OAAO,OAAO,QAAS,SAAA;AAAA,IAAS;AAElC,WAAO,EAAE,gBAAgB,OAAA;AAAA,EAC3B;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,oBAAoB,QAKM;AAC9B,UAAM,KAAK,yBAAyB;AAAA,MAClC,SAAS,OAAO;AAAA,MAChB,YAAY,OAAO;AAAA,MACnB,gBAAgB,OAAO;AAAA,MACvB,QAAQ,OAAO;AAAA,IAAA,CAChB;AACD,UAAM,OAAO,MAAM,GAAG,QAAQ,KAAK,MAAM;AACzC,WAAO,KAAK,WAAW,KAAK,MAAM;AAAA,EACpC;AACF;"}
1
+ {"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 signerKeys?: PrivateKey[];\n }): Promise<TransactionReceipt> {\n const tx = buildHcs16StateUpdateTx({\n topicId: params.topicId,\n operatorId: params.operatorId,\n hash: params.hash,\n epoch: params.epoch,\n });\n if (params.signerKeys && params.signerKeys.length > 0) {\n const frozen = await tx.freezeWith(this.client);\n let signed = frozen;\n for (const key of params.signerKeys) {\n signed = await signed.sign(key);\n }\n const resp = await signed.execute(this.client);\n return resp.getReceipt(this.client);\n }\n const resp = await tx.execute(this.client);\n return resp.getReceipt(this.client);\n }\n\n async sendFloraJoinRequest(params: {\n topicId: string;\n operatorId: string;\n accountId: string;\n connectionRequestId: number;\n connectionTopicId: string;\n connectionSeq: number;\n signerKey?: PrivateKey;\n }): Promise<TransactionReceipt> {\n const tx = buildHcs16FloraJoinRequestTx(params);\n if (params.signerKey) {\n const frozen = await tx.freezeWith(this.client);\n const signed = await frozen.sign(params.signerKey);\n const resp = await signed.execute(this.client);\n return resp.getReceipt(this.client);\n }\n const resp = await tx.execute(this.client);\n return resp.getReceipt(this.client);\n }\n\n async sendFloraJoinVote(params: {\n topicId: string;\n operatorId: string;\n accountId: string;\n approve: boolean;\n connectionRequestId: number;\n connectionSeq: number;\n signerKey?: PrivateKey;\n }): Promise<TransactionReceipt> {\n const tx = buildHcs16FloraJoinVoteTx(params);\n if (params.signerKey) {\n const frozen = await tx.freezeWith(this.client);\n const signed = await frozen.sign(params.signerKey);\n const resp = await signed.execute(this.client);\n return resp.getReceipt(this.client);\n }\n const resp = await tx.execute(this.client);\n return resp.getReceipt(this.client);\n }\n\n async sendFloraJoinAccepted(params: {\n topicId: string;\n operatorId: string;\n members: string[];\n epoch?: number;\n signerKeys?: PrivateKey[];\n }): Promise<TransactionReceipt> {\n const tx = buildHcs16FloraJoinAcceptedTx(params);\n if (params.signerKeys && params.signerKeys.length > 0) {\n const frozen = await tx.freezeWith(this.client);\n let signed = frozen;\n for (const key of params.signerKeys) {\n signed = await signed.sign(key);\n }\n const resp = await signed.execute(this.client);\n return resp.getReceipt(this.client);\n }\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":["resp"],"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;AAA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,WAAW,UAAU,SAAA;AAE5C,UAAM;AAAA,MACJ,eAAe;AAAA,MACf,aAAa;AAAA,MACb,OAAO;AAAA,IAAA,IACL,KAAK,yBAAyB;AAAA,MAChC;AAAA,MACA;AAAA,MACA;AAAA,MACA,oBAAoB,OAAO;AAAA,IAAA,CAC5B;AAED,UAAM,QAAQ,MAAM,OACjB,QAAQ,KAAK,MAAM,EACnB,KAAK,CAAA,MAAK,EAAE,WAAW,KAAK,MAAM,CAAC;AACtC,UAAM,OAAO,MAAM,MAChB,QAAQ,KAAK,MAAM,EACnB,KAAK,CAAA,MAAK,EAAE,WAAW,KAAK,MAAM,CAAC;AACtC,UAAM,SAAS,MAAM,QAClB,QAAQ,KAAK,MAAM,EACnB,KAAK,CAAA,MAAK,EAAE,WAAW,KAAK,MAAM,CAAC;AACtC,UAAM,SAAS;AAAA,MACb,eAAe,MAAM,QAAS,SAAA;AAAA,MAC9B,aAAa,KAAK,QAAS,SAAA;AAAA,MAC3B,OAAO,OAAO,QAAS,SAAA;AAAA,IAAS;AAElC,WAAO,EAAE,gBAAgB,OAAA;AAAA,EAC3B;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,oBAAoB,QAKM;AAC9B,UAAM,KAAK,yBAAyB;AAAA,MAClC,SAAS,OAAO;AAAA,MAChB,YAAY,OAAO;AAAA,MACnB,gBAAgB,OAAO;AAAA,MACvB,QAAQ,OAAO;AAAA,IAAA,CAChB;AACD,UAAM,OAAO,MAAM,GAAG,QAAQ,KAAK,MAAM;AACzC,WAAO,KAAK,WAAW,KAAK,MAAM;AAAA,EACpC;AACF;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hashgraphonline/standards-sdk",
3
- "version": "0.1.143-feat-solana-register.canary.99d8b7e.62",
3
+ "version": "0.1.143-feat-solana-register.canary.749526.64",
4
4
  "description": "The Hashgraph Online Standards SDK provides a complete implementation of the Hashgraph Consensus Standards (HCS), giving developers all the tools needed to build applications on Hedera.",
5
5
  "type": "module",
6
6
  "files": [