@hashgraphonline/standards-sdk 0.1.106 → 0.1.108
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/hcs-10/base-client.d.ts +2 -2
- package/dist/cjs/hcs-10/base-client.d.ts.map +1 -1
- package/dist/cjs/hcs-10/sdk.d.ts +3 -2
- package/dist/cjs/hcs-10/sdk.d.ts.map +1 -1
- package/dist/cjs/hcs-10/tx.d.ts +1 -0
- package/dist/cjs/hcs-10/tx.d.ts.map +1 -1
- package/dist/cjs/hcs-11/client.d.ts +26 -26
- package/dist/cjs/hcs-12/validation/schemas.d.ts +10 -10
- package/dist/cjs/hcs-14/types.d.ts +2 -2
- package/dist/cjs/hcs-20/points-indexer.d.ts.map +1 -1
- package/dist/cjs/hcs-20/sdk.d.ts.map +1 -1
- package/dist/cjs/hcs-20/types.d.ts +5 -1
- package/dist/cjs/hcs-20/types.d.ts.map +1 -1
- package/dist/cjs/services/types.d.ts +2 -0
- package/dist/cjs/services/types.d.ts.map +1 -1
- package/dist/cjs/standards-sdk.cjs +16 -16
- package/dist/cjs/standards-sdk.cjs.map +1 -1
- package/dist/cjs/utils/logger.d.ts +7 -2
- package/dist/cjs/utils/logger.d.ts.map +1 -1
- package/dist/es/hcs-10/base-client.d.ts +2 -2
- package/dist/es/hcs-10/base-client.d.ts.map +1 -1
- package/dist/es/hcs-10/sdk.d.ts +3 -2
- package/dist/es/hcs-10/sdk.d.ts.map +1 -1
- package/dist/es/hcs-10/tx.d.ts +1 -0
- package/dist/es/hcs-10/tx.d.ts.map +1 -1
- package/dist/es/hcs-11/client.d.ts +26 -26
- package/dist/es/hcs-12/validation/schemas.d.ts +10 -10
- package/dist/es/hcs-14/types.d.ts +2 -2
- package/dist/es/hcs-20/points-indexer.d.ts.map +1 -1
- package/dist/es/hcs-20/sdk.d.ts.map +1 -1
- package/dist/es/hcs-20/types.d.ts +5 -1
- package/dist/es/hcs-20/types.d.ts.map +1 -1
- package/dist/es/services/types.d.ts +2 -0
- package/dist/es/services/types.d.ts.map +1 -1
- package/dist/es/standards-sdk.es108.js +1 -1
- package/dist/es/standards-sdk.es109.js +1 -1
- package/dist/es/standards-sdk.es11.js +24 -25
- package/dist/es/standards-sdk.es11.js.map +1 -1
- package/dist/es/standards-sdk.es110.js +5 -5
- package/dist/es/standards-sdk.es112.js +1 -1
- package/dist/es/standards-sdk.es123.js +53 -201
- package/dist/es/standards-sdk.es123.js.map +1 -1
- package/dist/es/standards-sdk.es124.js +188 -156
- package/dist/es/standards-sdk.es124.js.map +1 -1
- package/dist/es/standards-sdk.es125.js +139 -289
- package/dist/es/standards-sdk.es125.js.map +1 -1
- package/dist/es/standards-sdk.es126.js +274 -298
- package/dist/es/standards-sdk.es126.js.map +1 -1
- package/dist/es/standards-sdk.es127.js +262 -369
- package/dist/es/standards-sdk.es127.js.map +1 -1
- package/dist/es/standards-sdk.es128.js +316 -194
- package/dist/es/standards-sdk.es128.js.map +1 -1
- package/dist/es/standards-sdk.es129.js +319 -64
- package/dist/es/standards-sdk.es129.js.map +1 -1
- package/dist/es/standards-sdk.es13.js +165 -81
- package/dist/es/standards-sdk.es13.js.map +1 -1
- package/dist/es/standards-sdk.es130.js +69 -49
- package/dist/es/standards-sdk.es130.js.map +1 -1
- package/dist/es/standards-sdk.es17.js +1 -0
- package/dist/es/standards-sdk.es17.js.map +1 -1
- package/dist/es/standards-sdk.es51.js +1 -1
- package/dist/es/standards-sdk.es53.js +1 -1
- package/dist/es/standards-sdk.es67.js.map +1 -1
- package/dist/es/standards-sdk.es71.js +57 -36
- package/dist/es/standards-sdk.es71.js.map +1 -1
- package/dist/es/standards-sdk.es72.js +30 -34
- package/dist/es/standards-sdk.es72.js.map +1 -1
- package/dist/es/standards-sdk.es93.js +44 -37
- package/dist/es/standards-sdk.es93.js.map +1 -1
- package/dist/es/standards-sdk.es98.js +5 -5
- package/dist/es/utils/logger.d.ts +7 -2
- package/dist/es/utils/logger.d.ts.map +1 -1
- package/package.json +1 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Client, PrivateKey, AccountCreateTransaction, Hbar, CustomFixedFee, AccountId, TokenId, KeyList, Transaction, ScheduleCreateTransaction, Timestamp
|
|
1
|
+
import { Client, PrivateKey, AccountCreateTransaction, Hbar, CustomFixedFee, AccountId, TokenId, KeyList, TopicMessageSubmitTransaction, Transaction, ScheduleCreateTransaction, Timestamp } from "@hashgraph/sdk";
|
|
2
2
|
import { AccountCreationError, TopicCreationError, ConnectionConfirmationError, PayloadSizeError } from "./standards-sdk.es12.js";
|
|
3
3
|
import { I as InscriptionSDK } from "./standards-sdk.es121.js";
|
|
4
4
|
import { Logger } from "./standards-sdk.es93.js";
|
|
@@ -20,6 +20,7 @@ import { HCS11Client } from "./standards-sdk.es22.js";
|
|
|
20
20
|
import { inscribe } from "./standards-sdk.es112.js";
|
|
21
21
|
import { addSeconds } from "date-fns";
|
|
22
22
|
import { buildTopicCreateTx, buildMessageTx } from "./standards-sdk.es120.js";
|
|
23
|
+
import { buildHcs10CreateInboundTopicTx, buildHcs10CreateConnectionTopicTx, buildHcs10ConfirmConnectionTx, buildHcs10SendMessageTx, buildHcs10RegistryRegisterTx, buildHcs10CreateOutboundTopicTx, buildHcs10CreateRegistryTopicTx } from "./standards-sdk.es17.js";
|
|
23
24
|
class HCS10Client extends HCS10BaseClient {
|
|
24
25
|
constructor(config) {
|
|
25
26
|
super({
|
|
@@ -105,7 +106,7 @@ class HCS10Client extends HCS10BaseClient {
|
|
|
105
106
|
*/
|
|
106
107
|
async createInboundTopic(accountId, topicType, ttl = 60, feeConfigBuilder) {
|
|
107
108
|
await this.ensureInitialized();
|
|
108
|
-
|
|
109
|
+
this._generateHcs10Memo(Hcs10MemoType.INBOUND, {
|
|
109
110
|
accountId,
|
|
110
111
|
ttl
|
|
111
112
|
});
|
|
@@ -140,7 +141,20 @@ class HCS10Client extends HCS10BaseClient {
|
|
|
140
141
|
default:
|
|
141
142
|
throw new Error(`Unsupported inbound topic type: ${topicType}`);
|
|
142
143
|
}
|
|
143
|
-
|
|
144
|
+
const operatorPublicKey = this.client.operatorPublicKey || this.operatorCtx.operatorKey.publicKey;
|
|
145
|
+
const transaction = buildHcs10CreateInboundTopicTx({
|
|
146
|
+
accountId,
|
|
147
|
+
ttl,
|
|
148
|
+
adminKey: true,
|
|
149
|
+
submitKey,
|
|
150
|
+
operatorPublicKey
|
|
151
|
+
});
|
|
152
|
+
this.logger.info("Creating inbound topic");
|
|
153
|
+
const { topicId } = await this.executeTopicCreateTransaction({
|
|
154
|
+
transaction,
|
|
155
|
+
feeConfig: finalFeeConfig
|
|
156
|
+
});
|
|
157
|
+
return topicId;
|
|
144
158
|
}
|
|
145
159
|
/**
|
|
146
160
|
* Creates a new agent with inbound and outbound topics
|
|
@@ -594,11 +608,6 @@ class HCS10Client extends HCS10BaseClient {
|
|
|
594
608
|
* @returns Response with connection details
|
|
595
609
|
*/
|
|
596
610
|
async handleConnectionRequest(inboundTopicId, requestingAccountId, connectionRequestId, connectionFeeConfig, ttl = 60) {
|
|
597
|
-
const memo = this._generateHcs10Memo(Hcs10MemoType.CONNECTION, {
|
|
598
|
-
ttl,
|
|
599
|
-
inboundTopicId,
|
|
600
|
-
connectionId: connectionRequestId
|
|
601
|
-
});
|
|
602
611
|
this.logger.info(
|
|
603
612
|
`Handling connection request ${connectionRequestId} from ${requestingAccountId}`
|
|
604
613
|
);
|
|
@@ -614,24 +623,29 @@ class HCS10Client extends HCS10BaseClient {
|
|
|
614
623
|
const thresholdKey = new KeyList([accountKey, requesterKey], 1);
|
|
615
624
|
let connectionTopicId;
|
|
616
625
|
try {
|
|
626
|
+
const connectionTransaction = buildHcs10CreateConnectionTopicTx({
|
|
627
|
+
ttl,
|
|
628
|
+
inboundTopicId,
|
|
629
|
+
connectionId: connectionRequestId,
|
|
630
|
+
adminKey: thresholdKey,
|
|
631
|
+
submitKey: thresholdKey
|
|
632
|
+
});
|
|
617
633
|
if (connectionFeeConfig) {
|
|
618
634
|
const feeConfig = connectionFeeConfig.build();
|
|
619
635
|
const modifiedFeeConfig = {
|
|
620
636
|
...feeConfig,
|
|
621
637
|
exemptAccounts: [...feeConfig.exemptAccounts || []]
|
|
622
638
|
};
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
);
|
|
639
|
+
const { topicId } = await this.executeTopicCreateTransaction({
|
|
640
|
+
transaction: connectionTransaction,
|
|
641
|
+
feeConfig: modifiedFeeConfig
|
|
642
|
+
});
|
|
643
|
+
connectionTopicId = topicId;
|
|
629
644
|
} else {
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
);
|
|
645
|
+
const { topicId } = await this.executeTopicCreateTransaction({
|
|
646
|
+
transaction: connectionTransaction
|
|
647
|
+
});
|
|
648
|
+
connectionTopicId = topicId;
|
|
635
649
|
}
|
|
636
650
|
this.logger.info(`Created new connection topic ID: ${connectionTopicId}`);
|
|
637
651
|
} catch (error) {
|
|
@@ -678,22 +692,21 @@ class HCS10Client extends HCS10BaseClient {
|
|
|
678
692
|
async confirmConnection(inboundTopicId, connectionTopicId, connectedAccountId, connectionId, memo, submitKey) {
|
|
679
693
|
const operatorId = await this.getOperatorId();
|
|
680
694
|
this.logger.info(`Confirming connection with ID ${connectionId}`);
|
|
681
|
-
const payload = {
|
|
682
|
-
p: "hcs-10",
|
|
683
|
-
op: "connection_created",
|
|
684
|
-
connection_topic_id: connectionTopicId,
|
|
685
|
-
connected_account_id: connectedAccountId,
|
|
686
|
-
operator_id: operatorId,
|
|
687
|
-
connection_id: connectionId,
|
|
688
|
-
m: memo
|
|
689
|
-
};
|
|
690
695
|
const submissionCheck = await this.canSubmitToTopic(
|
|
691
696
|
inboundTopicId,
|
|
692
697
|
this.client.operatorAccountId?.toString() || ""
|
|
693
698
|
);
|
|
694
|
-
const
|
|
699
|
+
const transaction = buildHcs10ConfirmConnectionTx({
|
|
695
700
|
inboundTopicId,
|
|
696
|
-
|
|
701
|
+
connectionTopicId,
|
|
702
|
+
connectedAccountId,
|
|
703
|
+
operatorId,
|
|
704
|
+
connectionId,
|
|
705
|
+
memo
|
|
706
|
+
});
|
|
707
|
+
const result = await this.submitPayload(
|
|
708
|
+
transaction,
|
|
709
|
+
void 0,
|
|
697
710
|
submitKey,
|
|
698
711
|
submissionCheck.requiresFee
|
|
699
712
|
);
|
|
@@ -752,33 +765,40 @@ class HCS10Client extends HCS10BaseClient {
|
|
|
752
765
|
}
|
|
753
766
|
}
|
|
754
767
|
this.logger.info("Submitting message to connection topic", payload);
|
|
755
|
-
|
|
768
|
+
const transaction = buildHcs10SendMessageTx({
|
|
756
769
|
connectionTopicId,
|
|
757
|
-
|
|
770
|
+
operatorId,
|
|
771
|
+
data: payload.data,
|
|
772
|
+
memo
|
|
773
|
+
});
|
|
774
|
+
return await this.submitPayload(
|
|
775
|
+
transaction,
|
|
776
|
+
void 0,
|
|
758
777
|
submitKey,
|
|
759
778
|
submissionCheck.requiresFee
|
|
760
779
|
);
|
|
761
780
|
}
|
|
762
|
-
async
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
if (feeConfig) {
|
|
771
|
-
await this.setupFees(transaction, feeConfig);
|
|
781
|
+
async executeTopicCreateTransaction(params) {
|
|
782
|
+
let workingTransaction = params.transaction;
|
|
783
|
+
if (params.feeConfig) {
|
|
784
|
+
workingTransaction = await this.setupFees(
|
|
785
|
+
workingTransaction,
|
|
786
|
+
params.feeConfig,
|
|
787
|
+
params.additionalExemptAccounts || []
|
|
788
|
+
);
|
|
772
789
|
}
|
|
773
790
|
try {
|
|
774
|
-
const
|
|
775
|
-
const receipt = await
|
|
791
|
+
const response = await workingTransaction.execute(this.client);
|
|
792
|
+
const receipt = await response.getReceipt(this.client);
|
|
776
793
|
if (!receipt.topicId) {
|
|
777
794
|
this.logger.error("Failed to create topic: topicId is null");
|
|
778
795
|
throw new Error("Failed to create topic: topicId is null");
|
|
779
796
|
}
|
|
780
|
-
|
|
781
|
-
|
|
797
|
+
return {
|
|
798
|
+
topicId: receipt.topicId.toString(),
|
|
799
|
+
receipt,
|
|
800
|
+
response
|
|
801
|
+
};
|
|
782
802
|
} catch (error) {
|
|
783
803
|
this.logger.error("Topic creation failed", {
|
|
784
804
|
error: error.message,
|
|
@@ -788,7 +808,57 @@ class HCS10Client extends HCS10BaseClient {
|
|
|
788
808
|
throw error;
|
|
789
809
|
}
|
|
790
810
|
}
|
|
791
|
-
async
|
|
811
|
+
async createTopic(memo, adminKey, submitKey, feeConfig) {
|
|
812
|
+
this.logger.info("Creating topic");
|
|
813
|
+
const transaction = buildTopicCreateTx({
|
|
814
|
+
memo,
|
|
815
|
+
adminKey,
|
|
816
|
+
submitKey,
|
|
817
|
+
operatorPublicKey: this.client.operatorPublicKey || this.operatorCtx.operatorKey?.publicKey
|
|
818
|
+
});
|
|
819
|
+
const { topicId } = await this.executeTopicCreateTransaction({
|
|
820
|
+
transaction,
|
|
821
|
+
feeConfig
|
|
822
|
+
});
|
|
823
|
+
return topicId;
|
|
824
|
+
}
|
|
825
|
+
async submitPayload(topicOrTransaction, payload, submitKey, requiresFee = false) {
|
|
826
|
+
const isTransaction = topicOrTransaction instanceof TopicMessageSubmitTransaction || topicOrTransaction?.getMessage !== void 0;
|
|
827
|
+
if (isTransaction) {
|
|
828
|
+
const transaction2 = topicOrTransaction;
|
|
829
|
+
const messageBytes = transaction2.getMessage();
|
|
830
|
+
if (!messageBytes) {
|
|
831
|
+
throw new Error("Message payload is missing");
|
|
832
|
+
}
|
|
833
|
+
const payloadSizeInBytes2 = Buffer.from(messageBytes).length;
|
|
834
|
+
if (payloadSizeInBytes2 > 1e3) {
|
|
835
|
+
throw new PayloadSizeError(
|
|
836
|
+
"Payload size exceeds 1000 bytes limit",
|
|
837
|
+
payloadSizeInBytes2
|
|
838
|
+
);
|
|
839
|
+
}
|
|
840
|
+
if (requiresFee) {
|
|
841
|
+
this.logger.info(
|
|
842
|
+
"Topic requires fee payment, setting max transaction fee"
|
|
843
|
+
);
|
|
844
|
+
transaction2.setMaxTransactionFee(new Hbar(this.feeAmount));
|
|
845
|
+
}
|
|
846
|
+
let transactionResponse2;
|
|
847
|
+
if (submitKey) {
|
|
848
|
+
const frozenTransaction = transaction2.freezeWith(this.client);
|
|
849
|
+
const signedTransaction = await frozenTransaction.sign(submitKey);
|
|
850
|
+
transactionResponse2 = await signedTransaction.execute(this.client);
|
|
851
|
+
} else {
|
|
852
|
+
transactionResponse2 = await transaction2.execute(this.client);
|
|
853
|
+
}
|
|
854
|
+
const receipt2 = await transactionResponse2.getReceipt(this.client);
|
|
855
|
+
if (!receipt2) {
|
|
856
|
+
this.logger.error("Failed to submit message: receipt is null");
|
|
857
|
+
throw new Error("Failed to submit message: receipt is null");
|
|
858
|
+
}
|
|
859
|
+
this.logger.info("Message submitted successfully");
|
|
860
|
+
return receipt2;
|
|
861
|
+
}
|
|
792
862
|
const message = typeof payload === "string" ? payload : JSON.stringify(payload);
|
|
793
863
|
const payloadSizeInBytes = Buffer.byteLength(message, "utf8");
|
|
794
864
|
if (payloadSizeInBytes > 1e3) {
|
|
@@ -799,7 +869,7 @@ class HCS10Client extends HCS10BaseClient {
|
|
|
799
869
|
}
|
|
800
870
|
const transactionMemo = this.getHcs10TransactionMemo(payload);
|
|
801
871
|
const transaction = buildMessageTx({
|
|
802
|
-
topicId,
|
|
872
|
+
topicId: topicOrTransaction,
|
|
803
873
|
message,
|
|
804
874
|
transactionMemo: transactionMemo || void 0
|
|
805
875
|
});
|
|
@@ -1343,14 +1413,13 @@ class HCS10Client extends HCS10BaseClient {
|
|
|
1343
1413
|
*/
|
|
1344
1414
|
async registerAgent(registryTopicId, accountId, inboundTopicId, memo, submitKey) {
|
|
1345
1415
|
this.logger.info("Registering agent");
|
|
1346
|
-
const
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
await this.submitPayload(registryTopicId, payload, submitKey);
|
|
1416
|
+
const transaction = buildHcs10RegistryRegisterTx({
|
|
1417
|
+
registryTopicId,
|
|
1418
|
+
accountId,
|
|
1419
|
+
inboundTopicId,
|
|
1420
|
+
memo
|
|
1421
|
+
});
|
|
1422
|
+
await this.submitPayload(transaction, void 0, submitKey);
|
|
1354
1423
|
}
|
|
1355
1424
|
async getInboundTopicType(topicId) {
|
|
1356
1425
|
try {
|
|
@@ -1522,11 +1591,16 @@ class HCS10Client extends HCS10BaseClient {
|
|
|
1522
1591
|
state
|
|
1523
1592
|
});
|
|
1524
1593
|
}
|
|
1525
|
-
const
|
|
1526
|
-
|
|
1527
|
-
|
|
1594
|
+
const operatorPublicKey = this.client.operatorPublicKey || this.operatorCtx.operatorKey.publicKey;
|
|
1595
|
+
const outboundTopicTx = buildHcs10CreateOutboundTopicTx({
|
|
1596
|
+
ttl: options?.ttl ?? 60,
|
|
1597
|
+
adminKey: true,
|
|
1598
|
+
submitKey: true,
|
|
1599
|
+
operatorPublicKey
|
|
1600
|
+
});
|
|
1601
|
+
const { topicId: outboundTopicId } = await this.executeTopicCreateTransaction({
|
|
1602
|
+
transaction: outboundTopicTx
|
|
1528
1603
|
});
|
|
1529
|
-
const outboundTopicId = await this.createTopic(outboundMemo, true, true);
|
|
1530
1604
|
state.outboundTopicId = outboundTopicId;
|
|
1531
1605
|
if (state.createdResources)
|
|
1532
1606
|
state.createdResources.push(`outbound:${state.outboundTopicId}`);
|
|
@@ -1538,11 +1612,17 @@ class HCS10Client extends HCS10BaseClient {
|
|
|
1538
1612
|
state
|
|
1539
1613
|
});
|
|
1540
1614
|
}
|
|
1541
|
-
const
|
|
1542
|
-
|
|
1543
|
-
accountId
|
|
1615
|
+
const operatorPublicKey = this.client.operatorPublicKey || this.operatorCtx.operatorKey.publicKey;
|
|
1616
|
+
const inboundTopicTx = buildHcs10CreateInboundTopicTx({
|
|
1617
|
+
accountId,
|
|
1618
|
+
ttl: options?.ttl ?? 60,
|
|
1619
|
+
adminKey: true,
|
|
1620
|
+
submitKey: false,
|
|
1621
|
+
operatorPublicKey
|
|
1622
|
+
});
|
|
1623
|
+
const { topicId: inboundTopicId } = await this.executeTopicCreateTransaction({
|
|
1624
|
+
transaction: inboundTopicTx
|
|
1544
1625
|
});
|
|
1545
|
-
const inboundTopicId = await this.createTopic(inboundMemo, true, false);
|
|
1546
1626
|
state.inboundTopicId = inboundTopicId;
|
|
1547
1627
|
if (state.createdResources)
|
|
1548
1628
|
state.createdResources.push(`inbound:${state.inboundTopicId}`);
|
|
@@ -1807,10 +1887,17 @@ class HCS10Client extends HCS10BaseClient {
|
|
|
1807
1887
|
async _createEntityTopics(ttl, existingTopics, accountId, inboundTopicType, feeConfig, pfpBuffer, pfpFileName, progressCallback) {
|
|
1808
1888
|
let { outboundTopicId, inboundTopicId, pfpTopicId, profileTopicId } = existingTopics;
|
|
1809
1889
|
if (!outboundTopicId) {
|
|
1810
|
-
const
|
|
1811
|
-
|
|
1890
|
+
const operatorPublicKey = this.client.operatorPublicKey || this.operatorCtx.operatorKey.publicKey;
|
|
1891
|
+
const outboundTransaction = buildHcs10CreateOutboundTopicTx({
|
|
1892
|
+
ttl,
|
|
1893
|
+
adminKey: true,
|
|
1894
|
+
submitKey: true,
|
|
1895
|
+
operatorPublicKey
|
|
1896
|
+
});
|
|
1897
|
+
const { topicId } = await this.executeTopicCreateTransaction({
|
|
1898
|
+
transaction: outboundTransaction
|
|
1812
1899
|
});
|
|
1813
|
-
outboundTopicId =
|
|
1900
|
+
outboundTopicId = topicId;
|
|
1814
1901
|
this.logger.info(`Created new outbound topic ID: ${outboundTopicId}`);
|
|
1815
1902
|
if (progressCallback) {
|
|
1816
1903
|
progressCallback({
|
|
@@ -2254,21 +2341,18 @@ class HCS10Client extends HCS10BaseClient {
|
|
|
2254
2341
|
details: { metadataTopicId }
|
|
2255
2342
|
});
|
|
2256
2343
|
}
|
|
2257
|
-
const memo = `hcs-10:0:${ttl}:3${metadataTopicId ? `:${metadataTopicId}` : ""}`;
|
|
2258
2344
|
const operatorKey = this.operatorCtx.operatorKey;
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
const
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
throw new Error("Failed to create registry topic");
|
|
2271
|
-
}
|
|
2345
|
+
const operatorPublicKey = this.client.operatorPublicKey || operatorKey.publicKey;
|
|
2346
|
+
const transaction = buildHcs10CreateRegistryTopicTx({
|
|
2347
|
+
ttl,
|
|
2348
|
+
metadataTopicId,
|
|
2349
|
+
adminKey,
|
|
2350
|
+
submitKey,
|
|
2351
|
+
operatorPublicKey
|
|
2352
|
+
});
|
|
2353
|
+
const { topicId, response: txResponse } = await this.executeTopicCreateTransaction({
|
|
2354
|
+
transaction
|
|
2355
|
+
});
|
|
2272
2356
|
if (progressCallback) {
|
|
2273
2357
|
progressCallback({
|
|
2274
2358
|
stage: "completed",
|