@hashgraphonline/standards-sdk 0.0.16 → 0.0.18

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.
Files changed (35) hide show
  1. package/dist/es/hcs-10/agent-builder.d.ts +42 -0
  2. package/dist/es/hcs-10/base-client.d.ts +60 -0
  3. package/dist/es/hcs-10/browser.d.ts +2 -6
  4. package/dist/es/hcs-10/fee-config-builder.d.ts +66 -0
  5. package/dist/es/hcs-10/index.d.ts +2 -2
  6. package/dist/es/hcs-10/registrations.d.ts +16 -0
  7. package/dist/es/hcs-10/sdk.d.ts +36 -50
  8. package/dist/es/index.d.ts +1 -0
  9. package/dist/es/services/index.d.ts +1 -0
  10. package/dist/es/services/mirror-node.d.ts +149 -0
  11. package/dist/es/standards-sdk.es.js +23743 -23833
  12. package/dist/es/standards-sdk.es.js.map +1 -1
  13. package/dist/es/utils/index.d.ts +1 -0
  14. package/dist/es/utils/topic-fee-utils.d.ts +11 -0
  15. package/dist/umd/hcs-10/agent-builder.d.ts +42 -0
  16. package/dist/umd/hcs-10/base-client.d.ts +60 -0
  17. package/dist/umd/hcs-10/browser.d.ts +2 -6
  18. package/dist/umd/hcs-10/fee-config-builder.d.ts +66 -0
  19. package/dist/umd/hcs-10/index.d.ts +2 -2
  20. package/dist/umd/hcs-10/registrations.d.ts +16 -0
  21. package/dist/umd/hcs-10/sdk.d.ts +36 -50
  22. package/dist/umd/index.d.ts +1 -0
  23. package/dist/umd/services/index.d.ts +1 -0
  24. package/dist/umd/services/mirror-node.d.ts +149 -0
  25. package/dist/umd/standards-sdk.umd.js +13 -13
  26. package/dist/umd/standards-sdk.umd.js.map +1 -1
  27. package/dist/umd/utils/index.d.ts +1 -0
  28. package/dist/umd/utils/topic-fee-utils.d.ts +11 -0
  29. package/package.json +6 -3
  30. package/dist/es/hcs-10/outbound.d.ts +0 -150
  31. package/dist/es/hcs-10/registration-utils.d.ts +0 -34
  32. package/dist/es/hcs-10/types.d.ts +0 -11
  33. package/dist/umd/hcs-10/outbound.d.ts +0 -150
  34. package/dist/umd/hcs-10/registration-utils.d.ts +0 -34
  35. package/dist/umd/hcs-10/types.d.ts +0 -11
@@ -0,0 +1,42 @@
1
+ import { InboundTopicType, NetworkType, FeeConfigBuilderInterface, AgentConfiguration } from './types.d';
2
+ import { AIAgentCapability } from '../hcs-11';
3
+ import { AgentMetadata } from './sdk';
4
+ type SocialPlatform = 'twitter' | 'discord' | 'github' | 'website' | 'x' | 'linkedin' | 'youtube' | 'telegram';
5
+ /**
6
+ * AgentBuilder is a builder class for creating agent configurations.
7
+ * It provides a fluent interface for setting various properties of the agent.
8
+ *
9
+ * Example usage:
10
+ * ```typescript
11
+ * const agentBuilder = new AgentBuilder();
12
+ * agentBuilder.setName('My Agent');
13
+ * agentBuilder.setDescription('This is my agent');
14
+ * agentBuilder.setCapabilities([AIAgentCapability.CREATE_CONTENT]);
15
+ * agentBuilder.setModel('gpt-4o');
16
+ * agentBuilder.setCreator('John Doe');
17
+ * agentBuilder.addSocial('twitter', 'JohnDoe');
18
+ * agentBuilder.addProperty('key', 'value');
19
+ * const agentConfig = agentBuilder.build();
20
+ * ```
21
+ *
22
+ */
23
+ export declare class AgentBuilder {
24
+ private config;
25
+ setName(name: string): AgentBuilder;
26
+ setDescription(description: string): AgentBuilder;
27
+ setCapabilities(capabilities: AIAgentCapability[]): AgentBuilder;
28
+ setAgentType(type: 'autonomous' | 'manual'): AgentBuilder;
29
+ setModel(model: string): AgentBuilder;
30
+ setCreator(creator: string): AgentBuilder;
31
+ addSocial(platform: SocialPlatform, handle: string): AgentBuilder;
32
+ addProperty(key: string, value: any): AgentBuilder;
33
+ setMetadata(metadata: AgentMetadata): AgentBuilder;
34
+ setProfilePicture(pfpBuffer: Buffer, pfpFileName: string): AgentBuilder;
35
+ setNetwork(network: NetworkType): AgentBuilder;
36
+ setInboundTopicType(inboundTopicType: InboundTopicType): AgentBuilder;
37
+ setFeeConfig(feeConfigBuilder: FeeConfigBuilderInterface): AgentBuilder;
38
+ setConnectionFeeConfig(feeConfigBuilder: FeeConfigBuilderInterface): AgentBuilder;
39
+ setExistingAccount(accountId: string, privateKey: string): AgentBuilder;
40
+ build(): AgentConfiguration;
41
+ }
42
+ export {};
@@ -0,0 +1,60 @@
1
+ import { Logger, LogLevel } from '../utils/logger';
2
+ import { Registration } from './registrations';
3
+ import { HederaMirrorNode, TopicInfo, AccountResponse } from '../services/mirror-node';
4
+ export interface HCS10Config {
5
+ network: 'mainnet' | 'testnet';
6
+ logLevel?: LogLevel;
7
+ }
8
+ export interface HCSMessage {
9
+ p: 'hcs-10';
10
+ op: 'connection_request' | 'connection_created' | 'message';
11
+ data: string;
12
+ created?: Date;
13
+ consensus_timestamp?: string;
14
+ m?: string;
15
+ payer: string;
16
+ outbound_topic_id?: string;
17
+ connection_request_id?: number;
18
+ confirmed_request_id?: number;
19
+ connection_topic_id?: string;
20
+ connected_account_id?: string;
21
+ requesting_account_id?: string;
22
+ connection_id?: number;
23
+ sequence_number: number;
24
+ operator_id?: string;
25
+ }
26
+ export declare abstract class HCS10BaseClient extends Registration {
27
+ protected network: string;
28
+ protected logger: Logger;
29
+ protected mirrorNode: HederaMirrorNode;
30
+ constructor(config: HCS10Config);
31
+ abstract getAccountAndSigner(): {
32
+ accountId: string;
33
+ signer: any;
34
+ };
35
+ getMessages(topicId: string): Promise<{
36
+ messages: HCSMessage[];
37
+ }>;
38
+ protected checkRegistrationStatus(transactionId: string, network: string, baseUrl: string): Promise<{
39
+ status: 'pending' | 'success' | 'failed';
40
+ }>;
41
+ requestAccount(account: string): Promise<AccountResponse>;
42
+ getAccountMemo(accountId: string): Promise<string | null>;
43
+ protected getTopicInfoFromMemo(memo: string): Promise<TopicInfo | null>;
44
+ getTopicInfo(accountId: string): Promise<TopicInfo | null>;
45
+ retrieveOutboundConnectTopic(accountId: string): Promise<TopicInfo>;
46
+ retrieveOutboundMessages(agentAccountId: string): Promise<HCSMessage[]>;
47
+ hasConnectionCreated(agentAccountId: string, connectionId: number): Promise<boolean>;
48
+ clearCache(): void;
49
+ }
50
+ export declare class HCS10Cache {
51
+ private static instance;
52
+ private cache;
53
+ private cacheExpiry;
54
+ private readonly CACHE_TTL;
55
+ private constructor();
56
+ static getInstance(): HCS10Cache;
57
+ set(key: string, value: TopicInfo): void;
58
+ get(key: string): TopicInfo | undefined;
59
+ clear(): void;
60
+ }
@@ -2,7 +2,7 @@ import { PublicKey, TransactionReceipt } from '@hashgraph/sdk';
2
2
  import { HashinalsWalletConnectSDK } from '@hashgraphonline/hashinal-wc';
3
3
  import { Logger, LogLevel } from '../utils/logger';
4
4
  import { RetrievedInscriptionResult } from '@kiloscribe/inscription-sdk';
5
- import { Outbound, HCSMessage } from './outbound';
5
+ import { HCS10BaseClient } from './base-client';
6
6
  import { AgentConfig, NetworkType } from './types.d';
7
7
  export type BrowserHCSClientConfig = {
8
8
  network: 'mainnet' | 'testnet';
@@ -28,10 +28,9 @@ interface SocialLinks {
28
28
  export type BrowserAgentConfig = Omit<AgentConfig<BrowserHCSClient>, 'privateKey'> & {
29
29
  client: BrowserHCSClient;
30
30
  };
31
- export declare class BrowserHCSClient extends Outbound {
31
+ export declare class BrowserHCSClient extends HCS10BaseClient {
32
32
  private hwc;
33
33
  protected logger: Logger;
34
- private guardedRegistryTopicId;
35
34
  private guardedRegistryBaseUrl;
36
35
  private hcs11Client;
37
36
  constructor(config: BrowserHCSClientConfig);
@@ -93,9 +92,6 @@ export declare class BrowserHCSClient extends Outbound {
93
92
  accountId: string;
94
93
  signer: any;
95
94
  };
96
- protected getMessages(topicId: string): Promise<{
97
- messages: HCSMessage[];
98
- }>;
99
95
  /**
100
96
  * Inscribes a profile picture file to the Hedera network
101
97
  * @param buffer File buffer to inscribe
@@ -0,0 +1,66 @@
1
+ import { FeeConfigBuilderInterface, TopicFeeConfig } from './types.d';
2
+ /**
3
+ * FeeConfigBuilder provides a fluent interface for creating fee configurations
4
+ * for HCS-10 topics. This makes it easy to configure fees without dealing with
5
+ * the complexity of the underlying fee structure.
6
+ *
7
+ * Example usage:
8
+ * ```typescript
9
+ * const feeConfig = new FeeConfigBuilder()
10
+ * .setHbarAmount(1) // 1 HBAR
11
+ * .setFeeCollector('0.0.12345')
12
+ * .addExemptAccount('0.0.67890')
13
+ * .build();
14
+ * ```
15
+ */
16
+ export declare class FeeConfigBuilder implements FeeConfigBuilderInterface {
17
+ private feeAmount;
18
+ private decimals;
19
+ private feeCollectorAccountId;
20
+ private exemptAccountIds;
21
+ /**
22
+ * Static factory method to create a fee config with HBAR amount in one line
23
+ * @param hbarAmount Amount in HBAR
24
+ * @param collectorAccountId Account that will receive the fees
25
+ * @param exemptAccounts Optional array of exempt account IDs
26
+ * @returns A configured FeeConfigBuilder
27
+ */
28
+ static forHbar(hbarAmount: number, collectorAccountId: string, exemptAccounts?: string[]): FeeConfigBuilder;
29
+ /**
30
+ * Sets the fee amount in HBAR (convenient method)
31
+ * @param hbarAmount The amount in HBAR (e.g., 5 for 5 HBAR)
32
+ * @returns This builder instance for method chaining
33
+ */
34
+ setHbarAmount(hbarAmount: number): FeeConfigBuilder;
35
+ /**
36
+ * Sets the amount of the fee to be collected for topic submissions
37
+ * @param amount The fee amount (in tinybars or token units)
38
+ * @param decimals Decimal places for fixed point representation (default: 0)
39
+ * @returns This builder instance for method chaining
40
+ */
41
+ setFeeAmount(amount: number, decimals?: number): FeeConfigBuilder;
42
+ /**
43
+ * Sets the Hedera account ID that will collect the fees
44
+ * @param accountId The fee collector's account ID (e.g., '0.0.12345')
45
+ * @returns This builder instance for method chaining
46
+ */
47
+ setFeeCollector(accountId: string): FeeConfigBuilder;
48
+ /**
49
+ * Adds an account ID to the list of accounts exempt from paying fees
50
+ * @param accountId The account ID to exempt from fees
51
+ * @returns This builder instance for method chaining
52
+ */
53
+ addExemptAccount(accountId: string): FeeConfigBuilder;
54
+ /**
55
+ * Adds multiple account IDs to the list of accounts exempt from paying fees
56
+ * @param accountIds Array of account IDs to exempt from fees
57
+ * @returns This builder instance for method chaining
58
+ */
59
+ addExemptAccounts(accountIds: string[]): FeeConfigBuilder;
60
+ /**
61
+ * Builds and returns the final fee configuration object
62
+ * @throws Error if fee collector account ID is not set or if fee amount is not positive
63
+ * @returns A complete TopicFeeConfig object
64
+ */
65
+ build(): TopicFeeConfig;
66
+ }
@@ -1,5 +1,5 @@
1
1
  export * from './sdk';
2
- export * from './browser';
3
2
  export * from './errors';
4
- export * from './outbound';
3
+ export * from './agent-builder';
4
+ export * from './base-client';
5
5
  export * from './registrations';
@@ -1,4 +1,5 @@
1
1
  import { AgentMetadata } from './sdk';
2
+ import { Logger } from '../utils/logger';
2
3
  export interface RegistrationSearchOptions {
3
4
  tags?: string[];
4
5
  accountId?: string;
@@ -22,6 +23,21 @@ export interface RegistrationSearchResult {
22
23
  error?: string;
23
24
  success: boolean;
24
25
  }
26
+ export type RegistrationResult = {
27
+ transaction?: any;
28
+ transactionId?: string;
29
+ success: boolean;
30
+ error?: string;
31
+ validationErrors?: any[];
32
+ };
25
33
  export declare abstract class Registration {
34
+ protected checkRegistrationStatus(transactionId: string, network: string, baseUrl: string, logger?: Logger): Promise<{
35
+ status: 'pending' | 'success' | 'failed';
36
+ }>;
37
+ waitForRegistrationConfirmation(transactionId: string, network: string, baseUrl: string, maxAttempts?: number, delayMs?: number, logger?: Logger): Promise<boolean>;
38
+ executeRegistration(accountId: string, inboundTopicId: string, network: string, baseUrl: string, logger?: Logger, metadata?: {
39
+ tags: string[];
40
+ [key: string]: any;
41
+ }): Promise<RegistrationResult>;
26
42
  findRegistrations(options?: RegistrationSearchOptions, baseUrl?: string): Promise<RegistrationSearchResult>;
27
43
  }
@@ -1,8 +1,11 @@
1
- import { Client, PrivateKey, TransactionReceipt, PublicKey } from '@hashgraph/sdk';
1
+ import { Client, PrivateKey, KeyList, TransactionReceipt, PublicKey } from '@hashgraph/sdk';
2
2
  import { RetrievedInscriptionResult } from '@kiloscribe/inscription-sdk';
3
3
  import { Logger } from '../utils/logger';
4
- import { Outbound, HCSMessage } from './outbound';
5
- import { HCSClientConfig, NetworkType, AgentConfig, CreateAccountResponse, CreateAgentResponse, InscribePfpResponse, StoreHCS11ProfileResponse, AgentRegistrationResult, HandleConnectionRequestResponse, WaitForConnectionConfirmationResponse, GetAccountAndSignerResponse } from './types.d';
4
+ import { HCS10BaseClient } from './base-client';
5
+ import { HCSClientConfig, AgentConfig, CreateAccountResponse, CreateAgentResponse, InscribePfpResponse, StoreHCS11ProfileResponse, AgentRegistrationResult, HandleConnectionRequestResponse, WaitForConnectionConfirmationResponse, GetAccountAndSignerResponse, InboundTopicType, TopicFeeConfig, FeeConfigBuilderInterface } from './types.d';
6
+ import { AgentBuilder } from './agent-builder';
7
+ export { InboundTopicType } from './types.d';
8
+ export { FeeConfigBuilder } from './fee-config-builder';
6
9
  export interface AgentMetadata {
7
10
  type: 'autonomous' | 'manual';
8
11
  model?: string;
@@ -19,13 +22,14 @@ export interface AgentMetadata {
19
22
  creator?: string;
20
23
  properties?: Record<string, any>;
21
24
  }
22
- export declare class HCS10Client extends Outbound {
25
+ export declare class HCS10Client extends HCS10BaseClient {
23
26
  private client;
24
27
  private operatorPrivateKey;
25
28
  protected network: string;
26
29
  protected logger: Logger;
27
30
  protected guardedRegistryBaseUrl: string;
28
31
  private hcs11Client;
32
+ private feeAmount;
29
33
  constructor(config: HCSClientConfig);
30
34
  getClient(): Client;
31
35
  /**
@@ -33,17 +37,20 @@ export declare class HCS10Client extends Outbound {
33
37
  * @returns Object with account ID and private key
34
38
  */
35
39
  createAccount(): Promise<CreateAccountResponse>;
40
+ /**
41
+ * Creates an inbound topic with the specified configuration
42
+ * @param accountId Account ID associated with the topic
43
+ * @param topicType Type of inbound topic (public, controlled, or fee-based)
44
+ * @param feeConfig Optional fee configuration for fee-based topics
45
+ * @returns The topic ID of the created inbound topic
46
+ */
47
+ createInboundTopic(accountId: string, topicType: InboundTopicType, feeConfig?: FeeConfigBuilderInterface): Promise<string>;
36
48
  /**
37
49
  * Creates a new agent with inbound and outbound topics
38
- * @param pfpBuffer Profile picture buffer
39
- * @param pfpFileName Profile picture filename
40
- * @param agentName Agent name
41
- * @param agentDescription Agent description
42
- * @param capabilities Agent capability tags
43
- * @param metadata Additional agent metadata
50
+ * @param builder The agent builder object
44
51
  * @returns Object with topic IDs
45
52
  */
46
- createAgent(pfpBuffer: Buffer, pfpFileName: string, agentName: string, agentDescription: string, capabilities: number[], metadata: AgentMetadata): Promise<CreateAgentResponse>;
53
+ createAgent(builder: AgentBuilder): Promise<CreateAgentResponse>;
47
54
  /**
48
55
  * Inscribes a profile picture to Hedera
49
56
  * @param buffer Profile picture buffer
@@ -64,33 +71,21 @@ export declare class HCS10Client extends Outbound {
64
71
  * @returns Response with topic IDs and transaction ID
65
72
  */
66
73
  storeHCS11Profile(agentName: string, agentDescription: string, inboundTopicId: string, outboundTopicId: string, capabilities: number[], metadata: AgentMetadata, pfpBuffer?: Buffer, pfpFileName?: string): Promise<StoreHCS11ProfileResponse>;
74
+ private setupFees;
67
75
  /**
68
76
  * Handles a connection request from another account
69
77
  * @param inboundTopicId Inbound topic ID
70
78
  * @param requestingAccountId Requesting account ID
71
79
  * @param connectionRequestId Connection request ID
80
+ * @param connectionFeeConfig Optional fee configuration for the connection topic
72
81
  * @returns Response with connection details
73
82
  */
74
- handleConnectionRequest(inboundTopicId: string, requestingAccountId: string, connectionRequestId: number): Promise<HandleConnectionRequestResponse>;
83
+ handleConnectionRequest(inboundTopicId: string, requestingAccountId: string, connectionRequestId: number, connectionFeeConfig?: FeeConfigBuilderInterface): Promise<HandleConnectionRequestResponse>;
75
84
  confirmConnection(inboundTopicId: string, connectionTopicId: string, connectedAccountId: string, connectionId: number, operatorId: string, memo: string, submitKey?: PrivateKey): Promise<number>;
76
85
  sendMessage(connectionTopicId: string, operatorId: string, data: string, memo?: string, submitKey?: PrivateKey): Promise<void>;
77
- /**
78
- * Retrieves the memo field from a Hedera account
79
- * @param accountId The account ID to fetch the memo for
80
- * @returns The account memo as a string, or null if not found/error
81
- */
82
- getAccountMemo(accountId: string): Promise<string | null>;
83
- /**
84
- * Creates a threshold topic with the operator and requester keys
85
- * @param memo The memo for the topic
86
- * @param requesterPublicKey The public key of the requester
87
- * @returns The topic ID of the created topic
88
- */
89
- createThresholdTopic(memo: string, requesterPublicKey: string): Promise<string>;
90
- createTopic(memo: string, adminKey?: boolean, submitKey?: boolean): Promise<string>;
86
+ createTopic(memo: string, adminKey?: boolean | PublicKey | KeyList, submitKey?: boolean | PublicKey | KeyList, feeConfig?: TopicFeeConfig): Promise<string>;
91
87
  submitMessage(topicId: string, message: string, submitKey?: PrivateKey): Promise<TransactionReceipt>;
92
88
  private submitPayload;
93
- queryTopicMessages(topicId: string): Promise<string[]>;
94
89
  submitConnectionRequest(inboundTopicId: string, requestingAccountId: string, operatorId: string, memo: string): Promise<TransactionReceipt>;
95
90
  recordOutboundConnectionConfirmation({ outboundTopicId, connectionRequestId, confirmedRequestId, connectionTopicId, operatorId, memo, }: {
96
91
  outboundTopicId: string;
@@ -110,20 +105,18 @@ export declare class HCS10Client extends Outbound {
110
105
  * @returns Connection confirmation details
111
106
  */
112
107
  waitForConnectionConfirmation(inboundTopicId: string, connectionRequestId: number, maxAttempts?: number, delayMs?: number): Promise<WaitForConnectionConfirmationResponse>;
113
- /**
114
- * Gets the account ID and signer for the client
115
- * @returns Account ID and signer
116
- */
117
108
  getAccountAndSigner(): GetAccountAndSignerResponse;
118
- protected getMessages(topicId: string): Promise<{
119
- messages: HCSMessage[];
120
- }>;
121
109
  /**
122
- * Retrieves the public key for a given account ID
123
- * @param accountId Account ID to retrieve the public key for
124
- * @returns The public key of the account
110
+ * Checks if a user can submit to a topic and determines if a fee is required
111
+ * @param topicId The topic ID to check
112
+ * @param userAccountId The account ID of the user attempting to submit
113
+ * @returns Object with canSubmit, requiresFee, and optional reason
125
114
  */
126
- getPublicKey(accountId: string): Promise<PublicKey>;
115
+ canSubmitToInboundTopic(topicId: string, userAccountId: string): Promise<{
116
+ canSubmit: boolean;
117
+ requiresFee: boolean;
118
+ reason?: string;
119
+ }>;
127
120
  /**
128
121
  * Creates and registers an agent with a Guarded registry.
129
122
  *
@@ -133,20 +126,10 @@ export declare class HCS10Client extends Outbound {
133
126
  * 3. Creates an agent on the client.
134
127
  * 4. Registers the agent with the Hashgraph Online Guarded Registry.
135
128
  *
136
- * @param name Agent name
137
- * @param description Agent description
138
- * @param capabilities Agent capability tags
139
- * @param metadata Additional metadata
140
- * @param pfpBuffer Profile picture buffer
141
- * @param pfpFileName Profile picture filename
142
- * @param network Network type
143
- * @param existingAccount Optional existing account
129
+ * @param builder The agent builder object
144
130
  * @returns Agent configuration
145
131
  */
146
- createAndRegisterAgent(name: string, description: string, capabilities: number[], metadata: AgentMetadata, pfpBuffer: Buffer, pfpFileName: string, network: NetworkType, existingAccount?: {
147
- accountId: string;
148
- privateKey: string;
149
- }): Promise<AgentConfig<HCS10Client>>;
132
+ createAndRegisterAgent(builder: AgentBuilder): Promise<AgentConfig<HCS10Client>>;
150
133
  /**
151
134
  * Registers an agent with the guarded registry
152
135
  * @param accountId Account ID to register
@@ -166,4 +149,7 @@ export declare class HCS10Client extends Outbound {
166
149
  * @param submitKey - The submit key of the agent
167
150
  */
168
151
  registerAgent(registryTopicId: string, accountId: string, inboundTopicId: string, memo: string, submitKey?: PrivateKey): Promise<void>;
152
+ getInboundTopicType(topicId: string): Promise<InboundTopicType>;
153
+ getNetwork(): string;
154
+ getLogger(): Logger;
169
155
  }
@@ -4,3 +4,4 @@ export * from './hcs-10';
4
4
  export * from './hcs-11';
5
5
  export * from './utils';
6
6
  export * from './inscribe';
7
+ export * from './services';
@@ -0,0 +1 @@
1
+ export * from './mirror-node';
@@ -0,0 +1,149 @@
1
+ import { PublicKey } from '@hashgraph/sdk';
2
+ import { Logger } from '../utils/logger';
3
+ import { HCSMessage } from '../hcs-10/base-client';
4
+ export interface Balance {
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
+ }
132
+ export declare class HederaMirrorNode {
133
+ private network;
134
+ private baseUrl;
135
+ private logger?;
136
+ constructor(network: NetworkType, logger?: Logger);
137
+ private getMirrorNodeUrl;
138
+ getBaseUrl(): string;
139
+ getPublicKey(accountId: string): Promise<PublicKey>;
140
+ getAccountMemo(accountId: string): Promise<string | null>;
141
+ getTopicInfo(topicId: string): Promise<TopicResponse>;
142
+ getTopicFees(topicId: string): Promise<CustomFees | null>;
143
+ getTopicMessages(topicId: string): Promise<HCSMessage[]>;
144
+ requestAccount(accountId: string): Promise<AccountResponse>;
145
+ checkKeyListAccess(keyBytes: Buffer, userPublicKey: PublicKey): Promise<boolean>;
146
+ private evaluateKeyAccess;
147
+ private evaluateKeyList;
148
+ private compareEd25519Key;
149
+ }