@hashgraphonline/standards-agent-kit 0.2.155 → 0.2.157
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/builders/inscriber/inscriber-builder.d.ts +1 -1
- package/dist/cjs/standards-agent-kit.cjs +1 -1
- package/dist/cjs/standards-agent-kit.cjs.map +1 -1
- package/dist/es/builders/inscriber/inscriber-builder.d.ts +1 -1
- package/dist/es/standards-agent-kit.es24.js +1 -1
- package/dist/es/standards-agent-kit.es25.js +1 -1
- package/dist/es/standards-agent-kit.es26.js +1 -1
- package/dist/es/standards-agent-kit.es27.js +1 -1
- package/dist/es/standards-agent-kit.es28.js +1 -1
- package/dist/es/standards-agent-kit.es31.js +1 -1
- package/dist/es/standards-agent-kit.es32.js +1 -1
- package/dist/es/standards-agent-kit.es33.js +1 -1
- package/dist/es/standards-agent-kit.es36.js +1 -1
- package/dist/es/standards-agent-kit.es37.js +1 -1
- package/dist/es/standards-agent-kit.es38.js +3 -3
- package/dist/es/standards-agent-kit.es39.js +5 -5
- package/dist/es/standards-agent-kit.es48.js +3 -7
- package/dist/es/standards-agent-kit.es48.js.map +1 -1
- package/dist/es/standards-agent-kit.es49.js +7 -3
- package/dist/es/standards-agent-kit.es49.js.map +1 -1
- package/dist/es/standards-agent-kit.es50.js +3 -20
- package/dist/es/standards-agent-kit.es50.js.map +1 -1
- package/dist/es/standards-agent-kit.es51.js +17 -50
- package/dist/es/standards-agent-kit.es51.js.map +1 -1
- package/dist/es/standards-agent-kit.es52.js +54 -3
- package/dist/es/standards-agent-kit.es52.js.map +1 -1
- package/dist/es/standards-agent-kit.es53.js +2 -39
- package/dist/es/standards-agent-kit.es53.js.map +1 -1
- package/dist/es/standards-agent-kit.es54.js +38 -17
- package/dist/es/standards-agent-kit.es54.js.map +1 -1
- package/dist/es/standards-agent-kit.es55.js +16 -71
- package/dist/es/standards-agent-kit.es55.js.map +1 -1
- package/dist/es/standards-agent-kit.es56.js +73 -3
- package/dist/es/standards-agent-kit.es56.js.map +1 -1
- package/dist/es/standards-agent-kit.es6.js +1 -1
- package/dist/es/standards-agent-kit.es7.js +1 -1
- package/dist/es/standards-agent-kit.es8.js +49 -63
- package/dist/es/standards-agent-kit.es8.js.map +1 -1
- package/dist/es/standards-agent-kit.es9.js +1 -1
- package/dist/umd/builders/inscriber/inscriber-builder.d.ts +1 -1
- package/dist/umd/standards-agent-kit.umd.js +220 -1
- package/dist/umd/standards-agent-kit.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/builders/inscriber/inscriber-builder.ts +56 -68
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hashgraphonline/standards-agent-kit",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.157",
|
|
4
4
|
"description": "A modular SDK for building on-chain autonomous agents using Hashgraph Online Standards, including HCS-10 for agent discovery and communication.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cjs/standards-agent-kit.cjs",
|
|
@@ -125,12 +125,43 @@ export class InscriberBuilder extends BaseServiceBuilder {
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
/**
|
|
128
|
-
* Get or create Inscription SDK
|
|
128
|
+
* Get or create Inscription SDK
|
|
129
129
|
*/
|
|
130
130
|
protected async getInscriptionSDK(
|
|
131
131
|
_options: InscriptionOptions
|
|
132
132
|
): Promise<InscriptionSDK | null> {
|
|
133
|
-
|
|
133
|
+
if (this.inscriptionSDK) {
|
|
134
|
+
return this.inscriptionSDK;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const network = this.hederaKit.client.network;
|
|
138
|
+
const networkType: 'mainnet' | 'testnet' = network.toString().includes('mainnet')
|
|
139
|
+
? 'mainnet'
|
|
140
|
+
: 'testnet';
|
|
141
|
+
|
|
142
|
+
const signer = await this.getSigner();
|
|
143
|
+
const accountId = this.hederaKit.signer.getAccountId().toString();
|
|
144
|
+
|
|
145
|
+
if (signer) {
|
|
146
|
+
this.inscriptionSDK = await InscriptionSDK.createWithAuth({
|
|
147
|
+
type: 'client',
|
|
148
|
+
accountId,
|
|
149
|
+
signer: signer as Parameters<typeof InscriptionSDK.createWithAuth>[0] extends { type: 'client'; signer: infer S } ? S : never,
|
|
150
|
+
network: networkType,
|
|
151
|
+
});
|
|
152
|
+
} else {
|
|
153
|
+
const privateKey = this.hederaKit.signer?.getOperatorPrivateKey();
|
|
154
|
+
if (privateKey) {
|
|
155
|
+
this.inscriptionSDK = await InscriptionSDK.createWithAuth({
|
|
156
|
+
type: 'server',
|
|
157
|
+
accountId,
|
|
158
|
+
privateKey: privateKey.toStringRaw(),
|
|
159
|
+
network: networkType,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return this.inscriptionSDK;
|
|
134
165
|
}
|
|
135
166
|
|
|
136
167
|
/**
|
|
@@ -325,73 +356,30 @@ export class InscriberBuilder extends BaseServiceBuilder {
|
|
|
325
356
|
|
|
326
357
|
const sdk = await this.getInscriptionSDK(options);
|
|
327
358
|
if (sdk) {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
true
|
|
335
|
-
);
|
|
336
|
-
const topicIdFromInscription: string | undefined = getTopicId(
|
|
337
|
-
retrieved as unknown
|
|
338
|
-
);
|
|
339
|
-
const topicId: string | undefined =
|
|
340
|
-
topicIdFromInscription ?? startResponse.topic_id;
|
|
341
|
-
const resultConfirmed: InscriptionResponse = {
|
|
342
|
-
quote: false,
|
|
343
|
-
confirmed: true,
|
|
344
|
-
result: {
|
|
345
|
-
jobId: startResponse.tx_id || '',
|
|
346
|
-
transactionId,
|
|
347
|
-
topicId,
|
|
348
|
-
},
|
|
349
|
-
inscription: retrieved,
|
|
350
|
-
} as unknown as InscriptionResponse;
|
|
351
|
-
this.logger.debug(
|
|
352
|
-
'retrieved inscription',
|
|
353
|
-
resultConfirmed,
|
|
354
|
-
retrieved
|
|
359
|
+
const retrieved: RetrievedInscriptionResult =
|
|
360
|
+
await sdk.waitForInscription(
|
|
361
|
+
transactionId,
|
|
362
|
+
maxAttempts,
|
|
363
|
+
intervalMs,
|
|
364
|
+
true
|
|
355
365
|
);
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
const isDone = status === 'completed' || !!topicId;
|
|
374
|
-
if (isDone) {
|
|
375
|
-
const resultConfirmed: InscriptionResponse = {
|
|
376
|
-
quote: false,
|
|
377
|
-
confirmed: true,
|
|
378
|
-
result: {
|
|
379
|
-
jobId: startResponse.tx_id || '',
|
|
380
|
-
transactionId,
|
|
381
|
-
topicId,
|
|
382
|
-
},
|
|
383
|
-
inscription: retrieved,
|
|
384
|
-
} as unknown as InscriptionResponse;
|
|
385
|
-
this.logger.debug(
|
|
386
|
-
'retrieved inscription',
|
|
387
|
-
resultConfirmed,
|
|
388
|
-
retrieved
|
|
389
|
-
);
|
|
390
|
-
return resultConfirmed;
|
|
391
|
-
}
|
|
392
|
-
} catch {}
|
|
393
|
-
await new Promise((resolve) => setTimeout(resolve, intervalMs));
|
|
394
|
-
}
|
|
366
|
+
const topicIdFromInscription: string | undefined = getTopicId(
|
|
367
|
+
retrieved as unknown
|
|
368
|
+
);
|
|
369
|
+
const topicId: string | undefined =
|
|
370
|
+
topicIdFromInscription ?? startResponse.topic_id;
|
|
371
|
+
const resultConfirmed: InscriptionResponse = {
|
|
372
|
+
quote: false,
|
|
373
|
+
confirmed: true,
|
|
374
|
+
result: {
|
|
375
|
+
jobId: startResponse.tx_id || '',
|
|
376
|
+
transactionId,
|
|
377
|
+
topicId,
|
|
378
|
+
},
|
|
379
|
+
inscription: retrieved,
|
|
380
|
+
} as unknown as InscriptionResponse;
|
|
381
|
+
this.logger.debug('retrieved inscription', resultConfirmed, retrieved);
|
|
382
|
+
return resultConfirmed;
|
|
395
383
|
}
|
|
396
384
|
}
|
|
397
385
|
|