@hashgraphonline/standards-sdk 0.0.40 → 0.0.42
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/agent-builder.d.ts +1 -0
- package/dist/es/hcs-10/base-client.d.ts +0 -3
- package/dist/es/hcs-10/browser.d.ts +45 -50
- package/dist/es/hcs-10/registrations.d.ts +72 -8
- package/dist/es/hcs-10/sdk.d.ts +11 -5
- package/dist/es/hcs-11/index.d.ts +36 -3
- package/dist/es/index.d.ts +0 -2
- package/dist/es/inscribe/types.d.ts +0 -2
- package/dist/es/services/mirror-node.d.ts +4 -130
- package/dist/es/services/types.d.ts +139 -0
- package/dist/es/standards-sdk.es.js +3925 -7344
- package/dist/es/standards-sdk.es.js.map +1 -1
- package/dist/es/utils/progress-reporter.d.ts +1 -1
- package/dist/umd/hcs-10/agent-builder.d.ts +1 -0
- package/dist/umd/hcs-10/base-client.d.ts +0 -3
- package/dist/umd/hcs-10/browser.d.ts +45 -50
- package/dist/umd/hcs-10/registrations.d.ts +72 -8
- package/dist/umd/hcs-10/sdk.d.ts +11 -5
- package/dist/umd/hcs-11/index.d.ts +36 -3
- package/dist/umd/index.d.ts +0 -2
- package/dist/umd/inscribe/types.d.ts +0 -2
- package/dist/umd/services/mirror-node.d.ts +4 -130
- package/dist/umd/services/types.d.ts +139 -0
- package/dist/umd/standards-sdk.umd.js +11 -11
- package/dist/umd/standards-sdk.umd.js.map +1 -1
- package/dist/umd/utils/progress-reporter.d.ts +1 -1
- package/package.json +5 -2
|
@@ -32,6 +32,7 @@ export declare class AgentBuilder {
|
|
|
32
32
|
addProperty(key: string, value: any): AgentBuilder;
|
|
33
33
|
setMetadata(metadata: AgentMetadata): AgentBuilder;
|
|
34
34
|
setProfilePicture(pfpBuffer: Buffer, pfpFileName: string): AgentBuilder;
|
|
35
|
+
setExistingProfilePicture(pfpTopicId: string): AgentBuilder;
|
|
35
36
|
setNetwork(network: NetworkType): AgentBuilder;
|
|
36
37
|
setInboundTopicType(inboundTopicType: InboundTopicType): AgentBuilder;
|
|
37
38
|
setFeeConfig(feeConfigBuilder: FeeConfigBuilderInterface): AgentBuilder;
|
|
@@ -26,7 +26,6 @@ export interface HCSMessage {
|
|
|
26
26
|
export interface ProfileResponse {
|
|
27
27
|
profile: any;
|
|
28
28
|
topicInfo?: TopicInfo;
|
|
29
|
-
profileTopicId?: string;
|
|
30
29
|
success: boolean;
|
|
31
30
|
error?: string;
|
|
32
31
|
}
|
|
@@ -47,8 +46,6 @@ export declare abstract class HCS10BaseClient extends Registration {
|
|
|
47
46
|
}>;
|
|
48
47
|
requestAccount(account: string): Promise<AccountResponse>;
|
|
49
48
|
getAccountMemo(accountId: string): Promise<string | null>;
|
|
50
|
-
protected getTopicInfoFromMemo(memo: string): Promise<TopicInfo | null>;
|
|
51
|
-
getTopicInfo(accountId: string): Promise<TopicInfo | null>;
|
|
52
49
|
retrieveProfile(accountId: string): Promise<ProfileResponse>;
|
|
53
50
|
retrieveOutboundConnectTopic(accountId: string): Promise<TopicInfo>;
|
|
54
51
|
retrieveOutboundMessages(agentAccountId: string): Promise<HCSMessage[]>;
|
|
@@ -3,7 +3,8 @@ import { HashinalsWalletConnectSDK } from '@hashgraphonline/hashinal-wc';
|
|
|
3
3
|
import { Logger, LogLevel } from '../utils/logger';
|
|
4
4
|
import { RetrievedInscriptionResult } from '@kiloscribe/inscription-sdk';
|
|
5
5
|
import { HCS10BaseClient } from './base-client';
|
|
6
|
-
import { AgentConfig,
|
|
6
|
+
import { AgentConfig, RegistrationProgressCallback, AgentCreationState } from './types.d';
|
|
7
|
+
import { AgentBuilder } from './agent-builder';
|
|
7
8
|
export type BrowserHCSClientConfig = {
|
|
8
9
|
network: 'mainnet' | 'testnet';
|
|
9
10
|
hwc: HashinalsWalletConnectSDK;
|
|
@@ -28,6 +29,15 @@ interface SocialLinks {
|
|
|
28
29
|
export type BrowserAgentConfig = Omit<AgentConfig<BrowserHCSClient>, 'privateKey'> & {
|
|
29
30
|
client: BrowserHCSClient;
|
|
30
31
|
};
|
|
32
|
+
export type RegisteredAgent = {
|
|
33
|
+
outboundTopicId: string;
|
|
34
|
+
inboundTopicId: string;
|
|
35
|
+
pfpTopicId: string;
|
|
36
|
+
profileTopicId: string;
|
|
37
|
+
error?: string;
|
|
38
|
+
success: boolean;
|
|
39
|
+
state: AgentCreationState;
|
|
40
|
+
};
|
|
31
41
|
export declare class BrowserHCSClient extends HCS10BaseClient {
|
|
32
42
|
private hwc;
|
|
33
43
|
protected logger: Logger;
|
|
@@ -48,64 +58,48 @@ export declare class BrowserHCSClient extends HCS10BaseClient {
|
|
|
48
58
|
error?: string;
|
|
49
59
|
}>;
|
|
50
60
|
getPublicKey(accountId: string): Promise<PublicKey>;
|
|
51
|
-
handleConnectionRequest(inboundTopicId: string, requestingAccountId: string, connectionId: number, connectionMemo?: string): Promise<
|
|
52
|
-
connectionTopicId: string;
|
|
53
|
-
confirmedConnectionSequenceNumber: number;
|
|
54
|
-
operatorId: string;
|
|
55
|
-
}>;
|
|
61
|
+
handleConnectionRequest(inboundTopicId: string, requestingAccountId: string, connectionId: number, connectionMemo?: string): Promise<HandleConnectionRequestResponse>;
|
|
56
62
|
confirmConnection(inboundTopicId: string, connectionTopicId: string, connectedAccountId: string, connectionId: number, operatorId: string, memo: string): Promise<number>;
|
|
57
63
|
submitMessage(topicId: string, content: string, metadata?: object, memo?: string): Promise<{
|
|
58
64
|
result?: TransactionReceipt;
|
|
59
65
|
error?: string;
|
|
60
66
|
}>;
|
|
67
|
+
/**
|
|
68
|
+
* Creates an agent directly, but does not register.
|
|
69
|
+
* We highly recommend calling createAndRegisterAgent instead.
|
|
70
|
+
*
|
|
71
|
+
* @param pfpBuffer - The buffer containing the PFP image.
|
|
72
|
+
* @param pfpFileName - The name of the file containing the PFP image.
|
|
73
|
+
* @param agentName - The name of the agent.
|
|
74
|
+
* @param agentDescription - The description of the agent.
|
|
75
|
+
* @param capabilities - The capabilities of the agent.
|
|
76
|
+
* @param metadata - The metadata of the agent.
|
|
77
|
+
* @param existingPfpTopicId - The topic ID of the existing PFP.
|
|
78
|
+
* @param options - Optional configuration options.
|
|
79
|
+
* @returns A promise that resolves to the agent creation state.
|
|
80
|
+
*/
|
|
61
81
|
createAgent(pfpBuffer: Buffer, pfpFileName: string, agentName: string, agentDescription: string, capabilities: number[], metadata: AgentMetadata, existingPfpTopicId?: string, options?: {
|
|
62
82
|
progressCallback?: RegistrationProgressCallback;
|
|
63
83
|
existingState?: AgentCreationState;
|
|
64
|
-
}): Promise<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
profileTopicId: string;
|
|
69
|
-
error?: string;
|
|
70
|
-
success: boolean;
|
|
71
|
-
state: AgentCreationState;
|
|
72
|
-
}>;
|
|
73
|
-
registerAgentWithGuardedRegistry(accountId: string, inboundTopicId: string, network?: string, options?: {
|
|
84
|
+
}): Promise<RegisteredAgent>;
|
|
85
|
+
private initializeRegistrationState;
|
|
86
|
+
private updateStateForCompletedRegistration;
|
|
87
|
+
registerAgentWithGuardedRegistry(accountId: string, network?: string, options?: {
|
|
74
88
|
progressCallback?: RegistrationProgressCallback;
|
|
75
89
|
maxAttempts?: number;
|
|
76
90
|
delayMs?: number;
|
|
77
91
|
existingState?: AgentCreationState;
|
|
78
|
-
}): Promise<
|
|
79
|
-
|
|
80
|
-
success: boolean;
|
|
81
|
-
transaction?: any;
|
|
82
|
-
transactionId?: string;
|
|
83
|
-
confirmed?: boolean;
|
|
84
|
-
validationErrors?: any[];
|
|
85
|
-
state: AgentCreationState;
|
|
86
|
-
}>;
|
|
87
|
-
private initializeRegistrationState;
|
|
88
|
-
private buildGuardedRegistryUrl;
|
|
89
|
-
private submitRegistrationRequest;
|
|
90
|
-
private confirmRegistration;
|
|
91
|
-
private updateStateForCompletedRegistration;
|
|
92
|
-
createAndRegisterAgent(name: string, description: string, capabilities: number[], metadata: AgentMetadata, pfpBuffer: Buffer, pfpFileName: string, network: NetworkType, existingPfpTopicId?: string, options?: {
|
|
92
|
+
}): Promise<AgentRegistrationResult>;
|
|
93
|
+
createAndRegisterAgent(builder: AgentBuilder, options?: {
|
|
93
94
|
progressCallback?: RegistrationProgressCallback;
|
|
94
95
|
maxAttempts?: number;
|
|
95
96
|
delayMs?: number;
|
|
96
97
|
existingState?: AgentCreationState;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}>;
|
|
100
|
-
waitForRegistrationConfirmation(transactionId: string, network: string, guardedRegistryBaseUrl: string, maxAttempts?: number, delayMs?: number, progressCallbackOrLogger?: ((currentAttempt: number, maxAttempts: number) => void) | Logger): Promise<boolean>;
|
|
98
|
+
baseUrl?: string;
|
|
99
|
+
}): Promise<AgentRegistrationResult>;
|
|
101
100
|
storeHCS11Profile(agentName: string, agentDescription: string, inboundTopicId: string, outboundTopicId: string, capabilities?: number[], metadata?: Record<string, any>, pfpBuffer?: Buffer, pfpFileName?: string, existingPfpTopicId?: string, options?: {
|
|
102
101
|
progressCallback?: RegistrationProgressCallback;
|
|
103
|
-
}): Promise<
|
|
104
|
-
profileTopicId: string;
|
|
105
|
-
pfpTopicId?: string;
|
|
106
|
-
error?: string;
|
|
107
|
-
success: boolean;
|
|
108
|
-
}>;
|
|
102
|
+
}): Promise<StoreHCS11ProfileResponse>;
|
|
109
103
|
createTopic(memo: string, adminKey?: boolean, submitKey?: boolean): Promise<{
|
|
110
104
|
success: boolean;
|
|
111
105
|
topicId?: string;
|
|
@@ -113,16 +107,17 @@ export declare class BrowserHCSClient extends HCS10BaseClient {
|
|
|
113
107
|
}>;
|
|
114
108
|
private submitPayload;
|
|
115
109
|
inscribeFile(buffer: Buffer, fileName: string): Promise<RetrievedInscriptionResult>;
|
|
116
|
-
getAccountAndSigner():
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
110
|
+
getAccountAndSigner(): GetAccountAndSignerResponse;
|
|
111
|
+
/**
|
|
112
|
+
* Inscribes a profile picture (PFP) on HCS-11.
|
|
113
|
+
*
|
|
114
|
+
* @param buffer - The buffer containing the PFP image.
|
|
115
|
+
* @param fileName - The name of the file containing the PFP image.
|
|
116
|
+
* @param options - Optional configuration options.
|
|
117
|
+
* @returns A promise that resolves to the topic ID of the inscribed PFP.
|
|
118
|
+
*/
|
|
120
119
|
inscribePfp(buffer: Buffer, fileName: string, options?: {
|
|
121
120
|
progressCallback?: RegistrationProgressCallback;
|
|
122
|
-
}): Promise<
|
|
123
|
-
pfpTopicId: string;
|
|
124
|
-
success: boolean;
|
|
125
|
-
error?: string;
|
|
126
|
-
}>;
|
|
121
|
+
}): Promise<InscribePfpResponse>;
|
|
127
122
|
}
|
|
128
123
|
export {};
|
|
@@ -23,21 +23,85 @@ export interface RegistrationSearchResult {
|
|
|
23
23
|
error?: string;
|
|
24
24
|
success: boolean;
|
|
25
25
|
}
|
|
26
|
+
export interface RegistrationsApiResponse {
|
|
27
|
+
registrations: Array<{
|
|
28
|
+
id: string;
|
|
29
|
+
transaction_id: string;
|
|
30
|
+
status: 'pending' | 'success' | 'failed';
|
|
31
|
+
network: string;
|
|
32
|
+
account_id: string;
|
|
33
|
+
inbound_topic_id: string;
|
|
34
|
+
outbound_topic_id: string;
|
|
35
|
+
operator_id: string;
|
|
36
|
+
metadata: AgentMetadata;
|
|
37
|
+
registry_topic_id: string;
|
|
38
|
+
created_at: string;
|
|
39
|
+
updated_at: string;
|
|
40
|
+
}>;
|
|
41
|
+
error?: string;
|
|
42
|
+
}
|
|
26
43
|
export type RegistrationResult = {
|
|
27
44
|
transaction?: any;
|
|
28
45
|
transactionId?: string;
|
|
29
46
|
success: boolean;
|
|
30
47
|
error?: string;
|
|
31
|
-
validationErrors?:
|
|
48
|
+
validationErrors?: ValidationError[];
|
|
32
49
|
};
|
|
50
|
+
export interface ValidationError {
|
|
51
|
+
message: string;
|
|
52
|
+
path?: string[];
|
|
53
|
+
type?: string;
|
|
54
|
+
context?: any;
|
|
55
|
+
}
|
|
56
|
+
export interface RegistrationApiResponse {
|
|
57
|
+
transaction_id: string;
|
|
58
|
+
transaction: string;
|
|
59
|
+
error?: string;
|
|
60
|
+
details?: ValidationError[];
|
|
61
|
+
}
|
|
62
|
+
export interface RegistrationStatusResponse {
|
|
63
|
+
status: 'pending' | 'success' | 'failed';
|
|
64
|
+
error?: string;
|
|
65
|
+
}
|
|
33
66
|
export declare abstract class Registration {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Checks the status of a registration request.
|
|
69
|
+
*
|
|
70
|
+
* @param transactionId - The transaction ID of the registration.
|
|
71
|
+
* @param network - The network to use for the registration.
|
|
72
|
+
* @param baseUrl - The base URL of the guarded registry.
|
|
73
|
+
* @param logger - The logger to use for logging.
|
|
74
|
+
* @returns A promise that resolves to the registration status response.
|
|
75
|
+
*/
|
|
76
|
+
protected checkRegistrationStatus(transactionId: string, network: string, baseUrl: string, logger?: Logger): Promise<RegistrationStatusResponse>;
|
|
77
|
+
/**
|
|
78
|
+
* Waits for a registration to be confirmed.
|
|
79
|
+
*
|
|
80
|
+
* @param transactionId - The transaction ID of the registration.
|
|
81
|
+
* @param network - The network to use for the registration.
|
|
82
|
+
* @param baseUrl - The base URL of the guarded registry.
|
|
83
|
+
* @param maxAttempts - The maximum number of attempts to check the registration status.
|
|
84
|
+
* @param delayMs - The delay in milliseconds between attempts.
|
|
85
|
+
* @param logger - The logger to use for logging.
|
|
86
|
+
* @returns A promise that resolves to true if the registration is confirmed, false otherwise.
|
|
87
|
+
*/
|
|
37
88
|
waitForRegistrationConfirmation(transactionId: string, network: string, baseUrl: string, maxAttempts?: number, delayMs?: number, logger?: Logger): Promise<boolean>;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Executes a registration request for an agent.
|
|
91
|
+
*
|
|
92
|
+
* @param accountId - The account ID of the agent to register.
|
|
93
|
+
* @param network - The network to use for the registration.
|
|
94
|
+
* @param baseUrl - The base URL of the guarded registry.
|
|
95
|
+
* @param logger - The logger to use for logging.
|
|
96
|
+
* @returns A promise that resolves to the registration result.
|
|
97
|
+
*/
|
|
98
|
+
executeRegistration(accountId: string, network?: string, baseUrl?: string, logger?: Logger): Promise<RegistrationResult>;
|
|
99
|
+
/**
|
|
100
|
+
* Finds registrations based on the provided options.
|
|
101
|
+
*
|
|
102
|
+
* @param options - The options for searching registrations.
|
|
103
|
+
* @param baseUrl - The base URL of the guarded registry.
|
|
104
|
+
* @returns A promise that resolves to the registration search result.
|
|
105
|
+
*/
|
|
42
106
|
findRegistrations(options?: RegistrationSearchOptions, baseUrl?: string): Promise<RegistrationSearchResult>;
|
|
43
107
|
}
|
package/dist/umd/hcs-10/sdk.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Client, PrivateKey, KeyList, TransactionReceipt, PublicKey } from '@has
|
|
|
2
2
|
import { RetrievedInscriptionResult } from '@kiloscribe/inscription-sdk';
|
|
3
3
|
import { Logger } from '../utils/logger';
|
|
4
4
|
import { HCS10BaseClient } from './base-client';
|
|
5
|
-
import { HCSClientConfig,
|
|
5
|
+
import { HCSClientConfig, CreateAccountResponse, CreateAgentResponse, InscribePfpResponse, StoreHCS11ProfileResponse, AgentRegistrationResult, HandleConnectionRequestResponse, WaitForConnectionConfirmationResponse, GetAccountAndSignerResponse, InboundTopicType, TopicFeeConfig, FeeConfigBuilderInterface, AgentCreationState } from './types.d';
|
|
6
6
|
import { AgentBuilder } from './agent-builder';
|
|
7
7
|
export { InboundTopicType } from './types.d';
|
|
8
8
|
export { FeeConfigBuilder } from './fee-config-builder';
|
|
@@ -83,7 +83,7 @@ export declare class HCS10Client extends HCS10BaseClient {
|
|
|
83
83
|
* @param pfpFileName Optional profile picture filename
|
|
84
84
|
* @returns Response with topic IDs and transaction ID
|
|
85
85
|
*/
|
|
86
|
-
storeHCS11Profile(agentName: string, agentDescription: string, inboundTopicId: string, outboundTopicId: string, capabilities: number[], metadata: AgentMetadata, pfpBuffer?: Buffer, pfpFileName?: string): Promise<StoreHCS11ProfileResponse>;
|
|
86
|
+
storeHCS11Profile(agentName: string, agentDescription: string, inboundTopicId: string, outboundTopicId: string, capabilities: number[], metadata: AgentMetadata, pfpBuffer?: Buffer, pfpFileName?: string, existingPfpTopicId?: string): Promise<StoreHCS11ProfileResponse>;
|
|
87
87
|
private setupFees;
|
|
88
88
|
/**
|
|
89
89
|
* Handles a connection request from another account
|
|
@@ -140,9 +140,14 @@ export declare class HCS10Client extends HCS10BaseClient {
|
|
|
140
140
|
* 4. Registers the agent with the Hashgraph Online Guarded Registry.
|
|
141
141
|
*
|
|
142
142
|
* @param builder The agent builder object
|
|
143
|
-
* @
|
|
143
|
+
* @param options Optional configuration including progress callback and state management
|
|
144
|
+
* @returns Agent registration result
|
|
144
145
|
*/
|
|
145
|
-
createAndRegisterAgent(builder: AgentBuilder
|
|
146
|
+
createAndRegisterAgent(builder: AgentBuilder, options?: {
|
|
147
|
+
baseUrl?: string;
|
|
148
|
+
progressCallback?: RegistrationProgressCallback;
|
|
149
|
+
existingState?: AgentCreationState;
|
|
150
|
+
}): Promise<AgentRegistrationResult>;
|
|
146
151
|
/**
|
|
147
152
|
* Registers an agent with the guarded registry
|
|
148
153
|
* @param accountId Account ID to register
|
|
@@ -151,10 +156,11 @@ export declare class HCS10Client extends HCS10BaseClient {
|
|
|
151
156
|
* @param options Optional configuration including progress callback and confirmation settings
|
|
152
157
|
* @returns Registration result
|
|
153
158
|
*/
|
|
154
|
-
registerAgentWithGuardedRegistry(accountId: string,
|
|
159
|
+
registerAgentWithGuardedRegistry(accountId: string, network?: string, options?: {
|
|
155
160
|
progressCallback?: RegistrationProgressCallback;
|
|
156
161
|
maxAttempts?: number;
|
|
157
162
|
delayMs?: number;
|
|
163
|
+
existingState?: AgentCreationState;
|
|
158
164
|
}): Promise<AgentRegistrationResult>;
|
|
159
165
|
/**
|
|
160
166
|
* Registers an agent with the guarded registry. Should be called by a registry.
|
|
@@ -2,6 +2,7 @@ import { AccountId, Client, Signer } from '@hashgraph/sdk';
|
|
|
2
2
|
import { LogLevel } from '../utils/logger';
|
|
3
3
|
import { DAppSigner } from '@hashgraph/hedera-wallet-connect';
|
|
4
4
|
import { RegistrationProgressCallback } from '../hcs-10/types.d';
|
|
5
|
+
import { TopicInfo } from '../services/types';
|
|
5
6
|
export declare enum ProfileType {
|
|
6
7
|
PERSONAL = 0,
|
|
7
8
|
AI_AGENT = 1
|
|
@@ -114,6 +115,7 @@ export declare class HCS11Client {
|
|
|
114
115
|
private auth;
|
|
115
116
|
private network;
|
|
116
117
|
private logger;
|
|
118
|
+
private mirrorNode;
|
|
117
119
|
constructor(config: HCS11ClientConfig);
|
|
118
120
|
getClient(): Client;
|
|
119
121
|
getOperatorId(): string;
|
|
@@ -146,12 +148,43 @@ export declare class HCS11Client {
|
|
|
146
148
|
parseProfileFromString(profileStr: string): HCS11Profile | null;
|
|
147
149
|
setProfileForAccountMemo(topicId: string, topicStandard?: 1 | 2 | 7): string;
|
|
148
150
|
private executeTransaction;
|
|
149
|
-
private inscribeContent;
|
|
150
151
|
inscribeImage(buffer: Buffer, fileName: string, options?: InscribeImageOptions): Promise<InscribeImageResponse>;
|
|
151
152
|
inscribeProfile(profile: HCS11Profile, options?: InscribeProfileOptions): Promise<InscribeProfileResponse>;
|
|
152
153
|
updateAccountMemoWithProfile(accountId: string | AccountId, profileTopicId: string): Promise<TransactionResult>;
|
|
154
|
+
/**
|
|
155
|
+
* Creates and inscribes a profile.
|
|
156
|
+
*
|
|
157
|
+
* @param profile - The profile to create and inscribe.
|
|
158
|
+
* @param updateAccountMemo - Whether to update the account memo with the profile.
|
|
159
|
+
* @param options - Optional configuration options.
|
|
160
|
+
* @returns A promise that resolves to the inscription result.
|
|
161
|
+
*/
|
|
153
162
|
createAndInscribeProfile(profile: HCS11Profile, updateAccountMemo?: boolean, options?: InscribeProfileOptions): Promise<InscribeProfileResponse>;
|
|
154
|
-
|
|
163
|
+
/**
|
|
164
|
+
* Gets the capabilities from the capability names.
|
|
165
|
+
*
|
|
166
|
+
* @param capabilityNames - The capability names to get the capabilities for.
|
|
167
|
+
* @returns The capabilities.
|
|
168
|
+
*/
|
|
169
|
+
getCapabilitiesFromTags(capabilityNames: string[]): Promise<number[]>;
|
|
170
|
+
/**
|
|
171
|
+
* Gets the agent type from the metadata.
|
|
172
|
+
*
|
|
173
|
+
* @param metadata - The metadata of the agent.
|
|
174
|
+
* @returns The agent type.
|
|
175
|
+
*/
|
|
155
176
|
getAgentTypeFromMetadata(metadata: AIAgentMetadata): AIAgentType;
|
|
156
|
-
|
|
177
|
+
/**
|
|
178
|
+
* Fetches a profile from the account memo.
|
|
179
|
+
*
|
|
180
|
+
* @param accountId - The account ID of the agent to fetch the profile for.
|
|
181
|
+
* @param network - The network to use for the fetch.
|
|
182
|
+
* @returns A promise that resolves to the profile.
|
|
183
|
+
*/
|
|
184
|
+
fetchProfileByAccountId(accountId: string | AccountId, network?: string): Promise<{
|
|
185
|
+
success: boolean;
|
|
186
|
+
profile?: HCS11Profile;
|
|
187
|
+
error?: string;
|
|
188
|
+
topicInfo?: TopicInfo;
|
|
189
|
+
}>;
|
|
157
190
|
}
|
package/dist/umd/index.d.ts
CHANGED
|
@@ -7,8 +7,6 @@ export interface RetrievedInscriptionResult extends SDKRetrievedInscriptionResul
|
|
|
7
7
|
url?: string;
|
|
8
8
|
metadata?: Record<string, unknown>;
|
|
9
9
|
message?: string;
|
|
10
|
-
messages_processed?: number;
|
|
11
|
-
total_messages?: number;
|
|
12
10
|
}
|
|
13
11
|
export type { HederaClientConfig };
|
|
14
12
|
export interface AuthConfig {
|
|
@@ -1,146 +1,20 @@
|
|
|
1
1
|
import { PublicKey } from '@hashgraph/sdk';
|
|
2
2
|
import { Logger } from '../utils/logger';
|
|
3
3
|
import { HCSMessage } from '../hcs-10/base-client';
|
|
4
|
-
|
|
5
|
-
balance: number;
|
|
6
|
-
timestamp: string;
|
|
7
|
-
tokens: TokenBalance[];
|
|
8
|
-
}
|
|
9
|
-
export interface TokenBalance {
|
|
10
|
-
token_id: string;
|
|
11
|
-
balance: number;
|
|
12
|
-
}
|
|
13
|
-
export interface Key {
|
|
14
|
-
_type: string;
|
|
15
|
-
key: string;
|
|
16
|
-
}
|
|
17
|
-
export interface AccountResponse {
|
|
18
|
-
account: string;
|
|
19
|
-
alias: string;
|
|
20
|
-
auto_renew_period: number;
|
|
21
|
-
balance: Balance;
|
|
22
|
-
created_timestamp: string;
|
|
23
|
-
decline_reward: boolean;
|
|
24
|
-
deleted: boolean;
|
|
25
|
-
ethereum_nonce: number;
|
|
26
|
-
evm_address: string;
|
|
27
|
-
expiry_timestamp: string;
|
|
28
|
-
key: Key;
|
|
29
|
-
max_automatic_token_associations: number;
|
|
30
|
-
memo: string;
|
|
31
|
-
pending_reward: number;
|
|
32
|
-
receiver_sig_required: boolean;
|
|
33
|
-
staked_account_id: string | null;
|
|
34
|
-
staked_node_id: string | null;
|
|
35
|
-
stake_period_start: string | null;
|
|
36
|
-
transactions: Transaction[];
|
|
37
|
-
links: Links;
|
|
38
|
-
}
|
|
39
|
-
export interface Transaction {
|
|
40
|
-
bytes: string | null;
|
|
41
|
-
charged_tx_fee: number;
|
|
42
|
-
consensus_timestamp: string;
|
|
43
|
-
entity_id: string | null;
|
|
44
|
-
max_fee: string;
|
|
45
|
-
memo_base64: string;
|
|
46
|
-
name: string;
|
|
47
|
-
nft_transfers: NftTransfer[];
|
|
48
|
-
node: string;
|
|
49
|
-
nonce: number;
|
|
50
|
-
parent_consensus_timestamp: string | null;
|
|
51
|
-
result: string;
|
|
52
|
-
scheduled: boolean;
|
|
53
|
-
staking_reward_transfers: Transfer[];
|
|
54
|
-
token_transfers: TokenTransfer[];
|
|
55
|
-
transaction_hash: string;
|
|
56
|
-
transaction_id: string;
|
|
57
|
-
transfers: Transfer[];
|
|
58
|
-
valid_duration_seconds: string;
|
|
59
|
-
valid_start_timestamp: string;
|
|
60
|
-
}
|
|
61
|
-
export interface Transfer {
|
|
62
|
-
account: string;
|
|
63
|
-
amount: number;
|
|
64
|
-
is_approval: boolean;
|
|
65
|
-
}
|
|
66
|
-
export interface TokenTransfer {
|
|
67
|
-
token_id: string;
|
|
68
|
-
account: string;
|
|
69
|
-
amount: string;
|
|
70
|
-
is_approval: boolean;
|
|
71
|
-
}
|
|
72
|
-
export interface NftTransfer {
|
|
73
|
-
receiver_account_id: string;
|
|
74
|
-
sender_account_id: string;
|
|
75
|
-
serial_number: number;
|
|
76
|
-
is_approval: boolean;
|
|
77
|
-
}
|
|
78
|
-
export interface Links {
|
|
79
|
-
next: string;
|
|
80
|
-
}
|
|
81
|
-
export type NetworkType = 'mainnet' | 'testnet';
|
|
82
|
-
export interface TopicInfo {
|
|
83
|
-
inboundTopic: string;
|
|
84
|
-
outboundTopic: string;
|
|
85
|
-
}
|
|
86
|
-
export interface TopicMessage {
|
|
87
|
-
consensus_timestamp: string;
|
|
88
|
-
topic_id: string;
|
|
89
|
-
message: string;
|
|
90
|
-
sequence_number: number;
|
|
91
|
-
running_hash: string;
|
|
92
|
-
running_hash_version: number;
|
|
93
|
-
payer_account_id: string;
|
|
94
|
-
}
|
|
95
|
-
export interface TopicMessagesResponse {
|
|
96
|
-
messages: TopicMessage[];
|
|
97
|
-
links: {
|
|
98
|
-
next?: string;
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
export interface TopicResponse {
|
|
102
|
-
admin_key: Key;
|
|
103
|
-
auto_renew_account: string;
|
|
104
|
-
auto_renew_period: number;
|
|
105
|
-
created_timestamp: string;
|
|
106
|
-
custom_fees: CustomFees;
|
|
107
|
-
deleted: boolean;
|
|
108
|
-
fee_exempt_key_list: Key[];
|
|
109
|
-
fee_schedule_key: Key;
|
|
110
|
-
memo: string;
|
|
111
|
-
submit_key: Key;
|
|
112
|
-
timestamp: Timestamp;
|
|
113
|
-
topic_id: string;
|
|
114
|
-
}
|
|
115
|
-
export interface Key {
|
|
116
|
-
_type: string;
|
|
117
|
-
key: string;
|
|
118
|
-
}
|
|
119
|
-
export interface CustomFees {
|
|
120
|
-
created_timestamp: string;
|
|
121
|
-
fixed_fees: FixedFee[];
|
|
122
|
-
}
|
|
123
|
-
export interface FixedFee {
|
|
124
|
-
amount: number;
|
|
125
|
-
collector_account_id: string;
|
|
126
|
-
denominating_token_id: string;
|
|
127
|
-
}
|
|
128
|
-
export interface Timestamp {
|
|
129
|
-
from: string;
|
|
130
|
-
to: string;
|
|
131
|
-
}
|
|
4
|
+
import { AccountResponse, CustomFees, NetworkType, TopicResponse } from './types';
|
|
132
5
|
export declare class HederaMirrorNode {
|
|
133
6
|
private network;
|
|
134
7
|
private baseUrl;
|
|
135
|
-
private logger
|
|
8
|
+
private logger;
|
|
136
9
|
private isServerEnvironment;
|
|
137
|
-
constructor(network: NetworkType, logger
|
|
10
|
+
constructor(network: NetworkType, logger: Logger);
|
|
138
11
|
private getMirrorNodeUrl;
|
|
139
12
|
getBaseUrl(): string;
|
|
140
13
|
getPublicKey(accountId: string): Promise<PublicKey>;
|
|
141
14
|
getAccountMemo(accountId: string): Promise<string | null>;
|
|
142
15
|
getTopicInfo(topicId: string): Promise<TopicResponse>;
|
|
143
16
|
getTopicFees(topicId: string): Promise<CustomFees | null>;
|
|
17
|
+
getHBARPrice(date: Date): Promise<number | null>;
|
|
144
18
|
getTopicMessages(topicId: string): Promise<HCSMessage[]>;
|
|
145
19
|
requestAccount(accountId: string): Promise<AccountResponse>;
|
|
146
20
|
checkKeyListAccess(keyBytes: Buffer, userPublicKey: PublicKey): Promise<boolean>;
|