@hashgraphonline/standards-sdk 0.0.35 → 0.0.37
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/es/hcs-10/browser.d.ts +10 -3
- package/dist/es/hcs-11/index.d.ts +16 -4
- package/dist/es/hcs-3/src/index.d.ts +0 -2
- package/dist/es/inscribe/types.d.ts +14 -10
- package/dist/es/standards-sdk.es.js +18085 -18968
- package/dist/es/standards-sdk.es.js.map +1 -1
- package/dist/es/utils/index.d.ts +1 -0
- package/dist/es/utils/progress-reporter.d.ts +53 -0
- package/dist/umd/hcs-10/browser.d.ts +10 -3
- package/dist/umd/hcs-11/index.d.ts +16 -4
- package/dist/umd/hcs-3/src/index.d.ts +0 -2
- package/dist/umd/inscribe/types.d.ts +14 -10
- package/dist/umd/standards-sdk.umd.js +42 -14
- package/dist/umd/standards-sdk.umd.js.map +1 -1
- package/dist/umd/utils/index.d.ts +1 -0
- package/dist/umd/utils/progress-reporter.d.ts +53 -0
- package/package.json +10 -19
package/dist/es/utils/index.d.ts
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Logger } from './logger';
|
|
2
|
+
export type ProgressStage = 'preparing' | 'submitting' | 'confirming' | 'verifying' | 'completed' | 'failed';
|
|
3
|
+
export interface ProgressData {
|
|
4
|
+
stage: ProgressStage;
|
|
5
|
+
message: string;
|
|
6
|
+
progressPercent: number;
|
|
7
|
+
details?: Record<string, any>;
|
|
8
|
+
}
|
|
9
|
+
export type ProgressCallback = (data: ProgressData) => void;
|
|
10
|
+
export interface ProgressReporterOptions {
|
|
11
|
+
module?: string;
|
|
12
|
+
callback?: ProgressCallback;
|
|
13
|
+
logger?: Logger;
|
|
14
|
+
logProgress?: boolean;
|
|
15
|
+
minPercent?: number;
|
|
16
|
+
maxPercent?: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* ProgressReporter is a singleton class that reports progress of a task.
|
|
20
|
+
* Can be used in a generalized fashion.
|
|
21
|
+
*/
|
|
22
|
+
export declare class ProgressReporter {
|
|
23
|
+
private static instance;
|
|
24
|
+
private module;
|
|
25
|
+
private callback?;
|
|
26
|
+
private logger?;
|
|
27
|
+
private logProgress;
|
|
28
|
+
private minPercent;
|
|
29
|
+
private maxPercent;
|
|
30
|
+
private lastReportedPercent;
|
|
31
|
+
private lastReportedTime;
|
|
32
|
+
private throttleMs;
|
|
33
|
+
constructor(options?: ProgressReporterOptions);
|
|
34
|
+
static getInstance(options?: ProgressReporterOptions): ProgressReporter;
|
|
35
|
+
setCallback(callback: ProgressCallback): void;
|
|
36
|
+
setModule(module: string): void;
|
|
37
|
+
setLogger(logger: Logger): void;
|
|
38
|
+
setMinPercent(minPercent: number): void;
|
|
39
|
+
setMaxPercent(maxPercent: number): void;
|
|
40
|
+
createSubProgress(options: {
|
|
41
|
+
minPercent: number;
|
|
42
|
+
maxPercent: number;
|
|
43
|
+
logPrefix?: string;
|
|
44
|
+
}): ProgressReporter;
|
|
45
|
+
report(data: ProgressData): void;
|
|
46
|
+
private scalePercent;
|
|
47
|
+
preparing(message: string, percent: number, details?: Record<string, any>): void;
|
|
48
|
+
submitting(message: string, percent: number, details?: Record<string, any>): void;
|
|
49
|
+
confirming(message: string, percent: number, details?: Record<string, any>): void;
|
|
50
|
+
verifying(message: string, percent: number, details?: Record<string, any>): void;
|
|
51
|
+
completed(message: string, details?: Record<string, any>): void;
|
|
52
|
+
failed(message: string, details?: Record<string, any>): void;
|
|
53
|
+
}
|
|
@@ -58,7 +58,9 @@ export declare class BrowserHCSClient extends HCS10BaseClient {
|
|
|
58
58
|
result?: TransactionReceipt;
|
|
59
59
|
error?: string;
|
|
60
60
|
}>;
|
|
61
|
-
createAgent(pfpBuffer: Buffer, pfpFileName: string, agentName: string, agentDescription: string, capabilities: number[], metadata: AgentMetadata, existingPfpTopicId?: string
|
|
61
|
+
createAgent(pfpBuffer: Buffer, pfpFileName: string, agentName: string, agentDescription: string, capabilities: number[], metadata: AgentMetadata, existingPfpTopicId?: string, options?: {
|
|
62
|
+
progressCallback?: RegistrationProgressCallback;
|
|
63
|
+
}): Promise<{
|
|
62
64
|
outboundTopicId: string;
|
|
63
65
|
inboundTopicId: string;
|
|
64
66
|
pfpTopicId: string;
|
|
@@ -83,7 +85,10 @@ export declare class BrowserHCSClient extends HCS10BaseClient {
|
|
|
83
85
|
confirmed?: boolean;
|
|
84
86
|
validationErrors?: any[];
|
|
85
87
|
}>;
|
|
86
|
-
|
|
88
|
+
waitForRegistrationConfirmation(transactionId: string, network: string, guardedRegistryBaseUrl: string, maxAttempts?: number, delayMs?: number, progressCallbackOrLogger?: ((currentAttempt: number, maxAttempts: number) => void) | Logger): Promise<boolean>;
|
|
89
|
+
storeHCS11Profile(agentName: string, agentDescription: string, inboundTopicId: string, outboundTopicId: string, capabilities?: number[], metadata?: Record<string, any>, pfpBuffer?: Buffer, pfpFileName?: string, existingPfpTopicId?: string, options?: {
|
|
90
|
+
progressCallback?: RegistrationProgressCallback;
|
|
91
|
+
}): Promise<{
|
|
87
92
|
profileTopicId: string;
|
|
88
93
|
pfpTopicId?: string;
|
|
89
94
|
error?: string;
|
|
@@ -106,7 +111,9 @@ export declare class BrowserHCSClient extends HCS10BaseClient {
|
|
|
106
111
|
* @param fileName Filename for the inscription
|
|
107
112
|
* @returns Object containing the topic ID and success status
|
|
108
113
|
*/
|
|
109
|
-
inscribePfp(buffer: Buffer, fileName: string
|
|
114
|
+
inscribePfp(buffer: Buffer, fileName: string, options?: {
|
|
115
|
+
progressCallback?: RegistrationProgressCallback;
|
|
116
|
+
}): Promise<{
|
|
110
117
|
pfpTopicId: string;
|
|
111
118
|
success: boolean;
|
|
112
119
|
error?: string;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { AccountId, Client, Signer } from '@hashgraph/sdk';
|
|
2
2
|
import { LogLevel } from '../utils/logger';
|
|
3
|
+
import { DAppSigner } from '@hashgraph/hedera-wallet-connect';
|
|
4
|
+
import { RegistrationProgressCallback } from '../hcs-10/types.d';
|
|
3
5
|
export declare enum ProfileType {
|
|
4
6
|
PERSONAL = 0,
|
|
5
7
|
AI_AGENT = 1
|
|
@@ -70,7 +72,7 @@ export type HCS11Profile = PersonalProfile | AIAgentProfile;
|
|
|
70
72
|
export interface HCS11Auth {
|
|
71
73
|
operatorId: string;
|
|
72
74
|
privateKey?: string;
|
|
73
|
-
signer?: Signer;
|
|
75
|
+
signer?: DAppSigner | Signer;
|
|
74
76
|
}
|
|
75
77
|
export interface HCS11ClientConfig {
|
|
76
78
|
network: 'mainnet' | 'testnet';
|
|
@@ -97,6 +99,15 @@ export interface InscribeImageResponse {
|
|
|
97
99
|
export interface AIAgentMetadata {
|
|
98
100
|
type: 'autonomous' | 'manual';
|
|
99
101
|
}
|
|
102
|
+
export interface ProgressOptions {
|
|
103
|
+
progressCallback?: RegistrationProgressCallback;
|
|
104
|
+
}
|
|
105
|
+
export interface InscribeImageOptions extends ProgressOptions {
|
|
106
|
+
waitForConfirmation?: boolean;
|
|
107
|
+
}
|
|
108
|
+
export interface InscribeProfileOptions extends ProgressOptions {
|
|
109
|
+
waitForConfirmation?: boolean;
|
|
110
|
+
}
|
|
100
111
|
export declare const capabilityNameToCapabilityMap: Record<string, AIAgentCapability>;
|
|
101
112
|
export declare class HCS11Client {
|
|
102
113
|
private client;
|
|
@@ -136,10 +147,11 @@ export declare class HCS11Client {
|
|
|
136
147
|
setProfileForAccountMemo(topicId: string, topicStandard?: 1 | 2 | 7): string;
|
|
137
148
|
private executeTransaction;
|
|
138
149
|
private inscribeContent;
|
|
139
|
-
inscribeImage(buffer: Buffer, fileName: string): Promise<InscribeImageResponse>;
|
|
140
|
-
inscribeProfile(profile: HCS11Profile): Promise<InscribeProfileResponse>;
|
|
150
|
+
inscribeImage(buffer: Buffer, fileName: string, options?: InscribeImageOptions): Promise<InscribeImageResponse>;
|
|
151
|
+
inscribeProfile(profile: HCS11Profile, options?: InscribeProfileOptions): Promise<InscribeProfileResponse>;
|
|
141
152
|
updateAccountMemoWithProfile(accountId: string | AccountId, profileTopicId: string): Promise<TransactionResult>;
|
|
142
|
-
createAndInscribeProfile(profile: HCS11Profile, updateAccountMemo?: boolean): Promise<InscribeProfileResponse>;
|
|
153
|
+
createAndInscribeProfile(profile: HCS11Profile, updateAccountMemo?: boolean, options?: InscribeProfileOptions): Promise<InscribeProfileResponse>;
|
|
143
154
|
getCapabilitiesFromTags(capabilityNames: string[]): Promise<AIAgentCapability[]>;
|
|
144
155
|
getAgentTypeFromMetadata(metadata: AIAgentMetadata): AIAgentType;
|
|
156
|
+
private detectMimeTypeFromBase64;
|
|
145
157
|
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { StartInscriptionRequest, InscriptionResult, RetrievedInscriptionResult as SDKRetrievedInscriptionResult, HederaClientConfig, InscriptionNumbersParams, InscriptionNumberDetails } from '@kiloscribe/inscription-sdk';
|
|
2
|
-
import {
|
|
2
|
+
import { LogLevel } from '../utils/logger';
|
|
3
|
+
import { RegistrationProgressCallback } from '../hcs-10/types.d';
|
|
3
4
|
export type { StartInscriptionRequest, InscriptionResult, InscriptionNumbersParams, InscriptionNumberDetails, };
|
|
4
5
|
export interface RetrievedInscriptionResult extends SDKRetrievedInscriptionResult {
|
|
5
6
|
content?: string;
|
|
6
7
|
url?: string;
|
|
7
8
|
metadata?: Record<string, unknown>;
|
|
9
|
+
message?: string;
|
|
10
|
+
messages_processed?: number;
|
|
11
|
+
total_messages?: number;
|
|
8
12
|
}
|
|
9
13
|
export type { HederaClientConfig };
|
|
10
14
|
export interface AuthConfig {
|
|
@@ -21,20 +25,20 @@ export interface InscriptionSDKOptions {
|
|
|
21
25
|
network?: 'mainnet' | 'testnet';
|
|
22
26
|
}
|
|
23
27
|
export interface InscriptionOptions {
|
|
24
|
-
|
|
25
|
-
apiKey?: string;
|
|
26
|
-
baseUrl?: string;
|
|
27
|
-
maxRetries?: number;
|
|
28
|
-
retryDelay?: number;
|
|
28
|
+
mode?: 'file' | 'upload' | 'hashinal' | 'hashinal-collection';
|
|
29
29
|
waitForConfirmation?: boolean;
|
|
30
30
|
waitMaxAttempts?: number;
|
|
31
31
|
waitIntervalMs?: number;
|
|
32
|
-
|
|
33
|
-
metadata?: Record<string, unknown>;
|
|
32
|
+
apiKey?: string;
|
|
34
33
|
tags?: string[];
|
|
35
|
-
|
|
36
|
-
mode?: 'file' | 'upload' | 'hashinal' | 'hashinal-collection';
|
|
34
|
+
metadata?: Record<string, any>;
|
|
37
35
|
jsonFileURL?: string;
|
|
36
|
+
chunkSize?: number;
|
|
37
|
+
logging?: {
|
|
38
|
+
level?: LogLevel;
|
|
39
|
+
};
|
|
40
|
+
progressCallback?: RegistrationProgressCallback;
|
|
41
|
+
network?: 'mainnet' | 'testnet';
|
|
38
42
|
}
|
|
39
43
|
export interface TextInscriptionOptions extends InscriptionOptions {
|
|
40
44
|
contentType?: string;
|