@hashgraphonline/standards-sdk 0.0.41 → 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/base-client.d.ts +0 -3
- package/dist/es/hcs-10/browser.d.ts +39 -41
- package/dist/es/hcs-10/registrations.d.ts +36 -0
- package/dist/es/hcs-10/sdk.d.ts +1 -1
- package/dist/es/hcs-11/index.d.ts +30 -4
- 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 +293 -162
- 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/base-client.d.ts +0 -3
- package/dist/umd/hcs-10/browser.d.ts +39 -41
- package/dist/umd/hcs-10/registrations.d.ts +36 -0
- package/dist/umd/hcs-10/sdk.d.ts +1 -1
- package/dist/umd/hcs-11/index.d.ts +30 -4
- 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 +3 -3
- package/dist/umd/standards-sdk.umd.js.map +1 -1
- package/dist/umd/utils/progress-reporter.d.ts +1 -1
- package/package.json +1 -1
|
@@ -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[]>;
|
|
@@ -29,6 +29,15 @@ interface SocialLinks {
|
|
|
29
29
|
export type BrowserAgentConfig = Omit<AgentConfig<BrowserHCSClient>, 'privateKey'> & {
|
|
30
30
|
client: BrowserHCSClient;
|
|
31
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
|
+
};
|
|
32
41
|
export declare class BrowserHCSClient extends HCS10BaseClient {
|
|
33
42
|
private hwc;
|
|
34
43
|
protected logger: Logger;
|
|
@@ -49,28 +58,30 @@ export declare class BrowserHCSClient extends HCS10BaseClient {
|
|
|
49
58
|
error?: string;
|
|
50
59
|
}>;
|
|
51
60
|
getPublicKey(accountId: string): Promise<PublicKey>;
|
|
52
|
-
handleConnectionRequest(inboundTopicId: string, requestingAccountId: string, connectionId: number, connectionMemo?: string): Promise<
|
|
53
|
-
connectionTopicId: string;
|
|
54
|
-
confirmedConnectionSequenceNumber: number;
|
|
55
|
-
operatorId: string;
|
|
56
|
-
}>;
|
|
61
|
+
handleConnectionRequest(inboundTopicId: string, requestingAccountId: string, connectionId: number, connectionMemo?: string): Promise<HandleConnectionRequestResponse>;
|
|
57
62
|
confirmConnection(inboundTopicId: string, connectionTopicId: string, connectedAccountId: string, connectionId: number, operatorId: string, memo: string): Promise<number>;
|
|
58
63
|
submitMessage(topicId: string, content: string, metadata?: object, memo?: string): Promise<{
|
|
59
64
|
result?: TransactionReceipt;
|
|
60
65
|
error?: string;
|
|
61
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
|
+
*/
|
|
62
81
|
createAgent(pfpBuffer: Buffer, pfpFileName: string, agentName: string, agentDescription: string, capabilities: number[], metadata: AgentMetadata, existingPfpTopicId?: string, options?: {
|
|
63
82
|
progressCallback?: RegistrationProgressCallback;
|
|
64
83
|
existingState?: AgentCreationState;
|
|
65
|
-
}): Promise<
|
|
66
|
-
outboundTopicId: string;
|
|
67
|
-
inboundTopicId: string;
|
|
68
|
-
pfpTopicId: string;
|
|
69
|
-
profileTopicId: string;
|
|
70
|
-
error?: string;
|
|
71
|
-
success: boolean;
|
|
72
|
-
state: AgentCreationState;
|
|
73
|
-
}>;
|
|
84
|
+
}): Promise<RegisteredAgent>;
|
|
74
85
|
private initializeRegistrationState;
|
|
75
86
|
private updateStateForCompletedRegistration;
|
|
76
87
|
registerAgentWithGuardedRegistry(accountId: string, network?: string, options?: {
|
|
@@ -78,31 +89,17 @@ export declare class BrowserHCSClient extends HCS10BaseClient {
|
|
|
78
89
|
maxAttempts?: number;
|
|
79
90
|
delayMs?: number;
|
|
80
91
|
existingState?: AgentCreationState;
|
|
81
|
-
}): Promise<
|
|
82
|
-
error?: string;
|
|
83
|
-
success: boolean;
|
|
84
|
-
transaction?: any;
|
|
85
|
-
transactionId?: string;
|
|
86
|
-
confirmed?: boolean;
|
|
87
|
-
validationErrors?: any[];
|
|
88
|
-
state: AgentCreationState;
|
|
89
|
-
}>;
|
|
92
|
+
}): Promise<AgentRegistrationResult>;
|
|
90
93
|
createAndRegisterAgent(builder: AgentBuilder, options?: {
|
|
91
94
|
progressCallback?: RegistrationProgressCallback;
|
|
92
95
|
maxAttempts?: number;
|
|
93
96
|
delayMs?: number;
|
|
94
97
|
existingState?: AgentCreationState;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}>;
|
|
98
|
+
baseUrl?: string;
|
|
99
|
+
}): Promise<AgentRegistrationResult>;
|
|
98
100
|
storeHCS11Profile(agentName: string, agentDescription: string, inboundTopicId: string, outboundTopicId: string, capabilities?: number[], metadata?: Record<string, any>, pfpBuffer?: Buffer, pfpFileName?: string, existingPfpTopicId?: string, options?: {
|
|
99
101
|
progressCallback?: RegistrationProgressCallback;
|
|
100
|
-
}): Promise<
|
|
101
|
-
profileTopicId: string;
|
|
102
|
-
pfpTopicId?: string;
|
|
103
|
-
error?: string;
|
|
104
|
-
success: boolean;
|
|
105
|
-
}>;
|
|
102
|
+
}): Promise<StoreHCS11ProfileResponse>;
|
|
106
103
|
createTopic(memo: string, adminKey?: boolean, submitKey?: boolean): Promise<{
|
|
107
104
|
success: boolean;
|
|
108
105
|
topicId?: string;
|
|
@@ -110,16 +107,17 @@ export declare class BrowserHCSClient extends HCS10BaseClient {
|
|
|
110
107
|
}>;
|
|
111
108
|
private submitPayload;
|
|
112
109
|
inscribeFile(buffer: Buffer, fileName: string): Promise<RetrievedInscriptionResult>;
|
|
113
|
-
getAccountAndSigner():
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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
|
+
*/
|
|
117
119
|
inscribePfp(buffer: Buffer, fileName: string, options?: {
|
|
118
120
|
progressCallback?: RegistrationProgressCallback;
|
|
119
|
-
}): Promise<
|
|
120
|
-
pfpTopicId: string;
|
|
121
|
-
success: boolean;
|
|
122
|
-
error?: string;
|
|
123
|
-
}>;
|
|
121
|
+
}): Promise<InscribePfpResponse>;
|
|
124
122
|
}
|
|
125
123
|
export {};
|
|
@@ -64,8 +64,44 @@ export interface RegistrationStatusResponse {
|
|
|
64
64
|
error?: string;
|
|
65
65
|
}
|
|
66
66
|
export declare abstract class Registration {
|
|
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
|
+
*/
|
|
67
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
|
+
*/
|
|
68
88
|
waitForRegistrationConfirmation(transactionId: string, network: string, baseUrl: string, maxAttempts?: number, delayMs?: number, logger?: Logger): Promise<boolean>;
|
|
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
|
+
*/
|
|
69
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
|
+
*/
|
|
70
106
|
findRegistrations(options?: RegistrationSearchOptions, baseUrl?: string): Promise<RegistrationSearchResult>;
|
|
71
107
|
}
|
package/dist/es/hcs-10/sdk.d.ts
CHANGED
|
@@ -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
|
|
@@ -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;
|
|
@@ -149,16 +151,40 @@ export declare class HCS11Client {
|
|
|
149
151
|
inscribeImage(buffer: Buffer, fileName: string, options?: InscribeImageOptions): Promise<InscribeImageResponse>;
|
|
150
152
|
inscribeProfile(profile: HCS11Profile, options?: InscribeProfileOptions): Promise<InscribeProfileResponse>;
|
|
151
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
|
+
*/
|
|
152
162
|
createAndInscribeProfile(profile: HCS11Profile, updateAccountMemo?: boolean, options?: InscribeProfileOptions): Promise<InscribeProfileResponse>;
|
|
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
|
+
*/
|
|
153
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
|
+
*/
|
|
154
176
|
getAgentTypeFromMetadata(metadata: AIAgentMetadata): AIAgentType;
|
|
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
|
+
*/
|
|
155
184
|
fetchProfileByAccountId(accountId: string | AccountId, network?: string): Promise<{
|
|
156
185
|
success: boolean;
|
|
157
186
|
profile?: HCS11Profile;
|
|
158
187
|
error?: string;
|
|
159
|
-
topicInfo?:
|
|
160
|
-
inboundTopicId?: string;
|
|
161
|
-
outboundTopicId?: string;
|
|
162
|
-
};
|
|
188
|
+
topicInfo?: TopicInfo;
|
|
163
189
|
}>;
|
|
164
190
|
}
|
package/dist/es/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>;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
export interface Balance {
|
|
2
|
+
balance: number;
|
|
3
|
+
timestamp: string;
|
|
4
|
+
tokens: TokenBalance[];
|
|
5
|
+
}
|
|
6
|
+
export interface TokenBalance {
|
|
7
|
+
token_id: string;
|
|
8
|
+
balance: number;
|
|
9
|
+
}
|
|
10
|
+
export interface Key {
|
|
11
|
+
_type: string;
|
|
12
|
+
key: string;
|
|
13
|
+
}
|
|
14
|
+
export interface AccountResponse {
|
|
15
|
+
account: string;
|
|
16
|
+
alias: string;
|
|
17
|
+
auto_renew_period: number;
|
|
18
|
+
balance: Balance;
|
|
19
|
+
created_timestamp: string;
|
|
20
|
+
decline_reward: boolean;
|
|
21
|
+
deleted: boolean;
|
|
22
|
+
ethereum_nonce: number;
|
|
23
|
+
evm_address: string;
|
|
24
|
+
expiry_timestamp: string;
|
|
25
|
+
key: Key;
|
|
26
|
+
max_automatic_token_associations: number;
|
|
27
|
+
memo: string;
|
|
28
|
+
pending_reward: number;
|
|
29
|
+
receiver_sig_required: boolean;
|
|
30
|
+
staked_account_id: string | null;
|
|
31
|
+
staked_node_id: string | null;
|
|
32
|
+
stake_period_start: string | null;
|
|
33
|
+
transactions: Transaction[];
|
|
34
|
+
links: Links;
|
|
35
|
+
}
|
|
36
|
+
export interface Transaction {
|
|
37
|
+
bytes: string | null;
|
|
38
|
+
charged_tx_fee: number;
|
|
39
|
+
consensus_timestamp: string;
|
|
40
|
+
entity_id: string | null;
|
|
41
|
+
max_fee: string;
|
|
42
|
+
memo_base64: string;
|
|
43
|
+
name: string;
|
|
44
|
+
nft_transfers: NftTransfer[];
|
|
45
|
+
node: string;
|
|
46
|
+
nonce: number;
|
|
47
|
+
parent_consensus_timestamp: string | null;
|
|
48
|
+
result: string;
|
|
49
|
+
scheduled: boolean;
|
|
50
|
+
staking_reward_transfers: Transfer[];
|
|
51
|
+
token_transfers: TokenTransfer[];
|
|
52
|
+
transaction_hash: string;
|
|
53
|
+
transaction_id: string;
|
|
54
|
+
transfers: Transfer[];
|
|
55
|
+
valid_duration_seconds: string;
|
|
56
|
+
valid_start_timestamp: string;
|
|
57
|
+
}
|
|
58
|
+
export interface Transfer {
|
|
59
|
+
account: string;
|
|
60
|
+
amount: number;
|
|
61
|
+
is_approval: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface TokenTransfer {
|
|
64
|
+
token_id: string;
|
|
65
|
+
account: string;
|
|
66
|
+
amount: string;
|
|
67
|
+
is_approval: boolean;
|
|
68
|
+
}
|
|
69
|
+
export interface NftTransfer {
|
|
70
|
+
receiver_account_id: string;
|
|
71
|
+
sender_account_id: string;
|
|
72
|
+
serial_number: number;
|
|
73
|
+
is_approval: boolean;
|
|
74
|
+
}
|
|
75
|
+
export interface Links {
|
|
76
|
+
next: string;
|
|
77
|
+
}
|
|
78
|
+
export type NetworkType = 'mainnet' | 'testnet';
|
|
79
|
+
export interface TopicInfo {
|
|
80
|
+
inboundTopic: string;
|
|
81
|
+
outboundTopic: string;
|
|
82
|
+
profileTopicId: string;
|
|
83
|
+
}
|
|
84
|
+
export interface TopicMessage {
|
|
85
|
+
consensus_timestamp: string;
|
|
86
|
+
topic_id: string;
|
|
87
|
+
message: string;
|
|
88
|
+
sequence_number: number;
|
|
89
|
+
running_hash: string;
|
|
90
|
+
running_hash_version: number;
|
|
91
|
+
payer_account_id: string;
|
|
92
|
+
}
|
|
93
|
+
export interface TopicMessagesResponse {
|
|
94
|
+
messages: TopicMessage[];
|
|
95
|
+
links: {
|
|
96
|
+
next?: string;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
export interface TopicResponse {
|
|
100
|
+
admin_key: Key;
|
|
101
|
+
auto_renew_account: string;
|
|
102
|
+
auto_renew_period: number;
|
|
103
|
+
created_timestamp: string;
|
|
104
|
+
custom_fees: CustomFees;
|
|
105
|
+
deleted: boolean;
|
|
106
|
+
fee_exempt_key_list: Key[];
|
|
107
|
+
fee_schedule_key: Key;
|
|
108
|
+
memo: string;
|
|
109
|
+
submit_key: Key;
|
|
110
|
+
timestamp: Timestamp;
|
|
111
|
+
topic_id: string;
|
|
112
|
+
}
|
|
113
|
+
export interface Key {
|
|
114
|
+
_type: string;
|
|
115
|
+
key: string;
|
|
116
|
+
}
|
|
117
|
+
export interface CustomFees {
|
|
118
|
+
created_timestamp: string;
|
|
119
|
+
fixed_fees: FixedFee[];
|
|
120
|
+
}
|
|
121
|
+
export interface FixedFee {
|
|
122
|
+
amount: number;
|
|
123
|
+
collector_account_id: string;
|
|
124
|
+
denominating_token_id: string;
|
|
125
|
+
}
|
|
126
|
+
export interface Timestamp {
|
|
127
|
+
from: string;
|
|
128
|
+
to: string;
|
|
129
|
+
}
|
|
130
|
+
export interface TRate {
|
|
131
|
+
cent_equivalent: number;
|
|
132
|
+
expiration_time: number;
|
|
133
|
+
hbar_equivalent: number;
|
|
134
|
+
}
|
|
135
|
+
export interface HBARPrice {
|
|
136
|
+
current_rate: TRate;
|
|
137
|
+
next_rate: TRate;
|
|
138
|
+
timestamp: string;
|
|
139
|
+
}
|