@hashgraph/hedera-agent-kit 3.8.2-rc.1

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.
@@ -0,0 +1,354 @@
1
+ import { Client } from '@hashgraph/sdk';
2
+ import BigNumber from 'bignumber.js';
3
+ import { z } from 'zod';
4
+ import { Action, Handler, ActionExample, Validator } from '@elizaos/core';
5
+
6
+ type TopicMessagesQueryParams = {
7
+ topicId: string;
8
+ lowerTimestamp: string;
9
+ upperTimestamp: string;
10
+ limit: number;
11
+ };
12
+ type TopicMessage = {
13
+ topicId: string;
14
+ message: string;
15
+ consensus_timestamp: string;
16
+ };
17
+ type TopicMessagesResponse = {
18
+ topicId: string;
19
+ messages: TopicMessage[];
20
+ };
21
+ type TopicInfo = {
22
+ topic_id?: string;
23
+ memo?: string | null;
24
+ admin_key?: {
25
+ _type?: string;
26
+ key?: string;
27
+ } | null;
28
+ submit_key?: {
29
+ _type?: string;
30
+ key?: string;
31
+ } | null;
32
+ auto_renew_account?: string | null;
33
+ auto_renew_period?: number | null;
34
+ created_timestamp?: string | null;
35
+ deleted?: boolean;
36
+ sequence_number?: number | null;
37
+ running_hash?: string | null;
38
+ running_hash_version?: number | null;
39
+ };
40
+ type TokenBalance = {
41
+ automatic_association: boolean;
42
+ created_timestamp: string;
43
+ token_id: string;
44
+ freeze_status: string;
45
+ kyc_status: string;
46
+ balance: number;
47
+ decimals: number;
48
+ symbol: string;
49
+ };
50
+ type TokenBalancesResponse = {
51
+ tokens: TokenBalance[];
52
+ };
53
+ type NftBalance = {
54
+ account_id: string;
55
+ created_timestamp: string;
56
+ delegating_spender: string | null;
57
+ deleted: boolean;
58
+ metadata: string;
59
+ modified_timestamp: string;
60
+ serial_number: number;
61
+ spender: string | null;
62
+ token_id: string;
63
+ };
64
+ type NftBalanceResponse = {
65
+ nfts: NftBalance[];
66
+ links: {
67
+ next: string | null;
68
+ };
69
+ };
70
+ type AccountResponse = {
71
+ accountId: string;
72
+ accountPublicKey: string;
73
+ balance: AccountBalanceResponse;
74
+ evmAddress: string;
75
+ };
76
+ type AccountBalanceResponse = {
77
+ balance: BigNumber;
78
+ timestamp: string;
79
+ tokens: TokenBalance[];
80
+ };
81
+ /**
82
+ * This type matches responses from Hedera Mirror Node API
83
+ */
84
+ type TokenInfo = {
85
+ token_id?: string;
86
+ name: string;
87
+ symbol: string;
88
+ type?: string;
89
+ memo?: string;
90
+ decimals: string;
91
+ initial_supply?: string;
92
+ total_supply?: string;
93
+ max_supply?: string;
94
+ supply_type?: string;
95
+ treasury_account_id?: string;
96
+ auto_renew_account?: string;
97
+ auto_renew_period?: number;
98
+ deleted: boolean;
99
+ freeze_default?: boolean;
100
+ pause_status?: string;
101
+ created_timestamp?: string;
102
+ modified_timestamp?: string;
103
+ expiry_timestamp?: number;
104
+ admin_key?: {
105
+ _type: string;
106
+ key: string;
107
+ } | null;
108
+ supply_key?: {
109
+ _type: string;
110
+ key: string;
111
+ } | null;
112
+ kyc_key?: {
113
+ _type: string;
114
+ key: string;
115
+ } | null;
116
+ freeze_key?: {
117
+ _type: string;
118
+ key: string;
119
+ } | null;
120
+ wipe_key?: {
121
+ _type: string;
122
+ key: string;
123
+ } | null;
124
+ pause_key?: {
125
+ _type: string;
126
+ key: string;
127
+ } | null;
128
+ fee_schedule_key?: {
129
+ _type: string;
130
+ key: string;
131
+ } | null;
132
+ metadata_key?: {
133
+ _type: string;
134
+ key: string;
135
+ } | null;
136
+ metadata?: string;
137
+ custom_fees?: {
138
+ created_timestamp: string;
139
+ fixed_fees: any[];
140
+ fractional_fees: any[];
141
+ };
142
+ };
143
+ type TransferData = {
144
+ account: string;
145
+ amount: number;
146
+ is_approval: boolean;
147
+ };
148
+ type TransactionData = {
149
+ batch_key: string | null;
150
+ bytes: string | null;
151
+ charged_tx_fee: number;
152
+ consensus_timestamp: string;
153
+ entity_id: string;
154
+ max_fee: string;
155
+ max_custom_fees: any[];
156
+ memo_base64: string;
157
+ name: string;
158
+ nft_transfers: any[];
159
+ node: string;
160
+ nonce: number;
161
+ parent_consensus_timestamp: string | null;
162
+ result: string;
163
+ scheduled: boolean;
164
+ staking_reward_transfers: any[];
165
+ token_transfers: any[];
166
+ transaction_hash: string;
167
+ transaction_id: string;
168
+ transfers: TransferData[];
169
+ valid_duration_seconds: string;
170
+ valid_start_timestamp: string;
171
+ };
172
+ type TransactionDetailsResponse = {
173
+ transactions: TransactionData[];
174
+ };
175
+ interface ContractInfo {
176
+ admin_key?: {
177
+ description?: string;
178
+ _type?: string;
179
+ example?: string;
180
+ key?: string;
181
+ } | null;
182
+ auto_renew_account?: string | null;
183
+ auto_renew_period?: number | null;
184
+ contract_id?: string | null;
185
+ created_timestamp?: string | null;
186
+ deleted?: boolean;
187
+ evm_address?: string;
188
+ expiration_timestamp?: string | null;
189
+ file_id?: string | null;
190
+ max_automatic_token_associations?: number | null;
191
+ memo?: string;
192
+ nonce?: number | null;
193
+ obtainer_id?: string | null;
194
+ permanent_removal?: boolean | null;
195
+ proxy_account_id?: string | null;
196
+ timestamp?: {
197
+ description?: string;
198
+ from: string;
199
+ to?: string | null;
200
+ };
201
+ }
202
+ type ExchangeRate = {
203
+ hbar_equivalent: number;
204
+ cent_equivalent: number;
205
+ expiration_time: number;
206
+ };
207
+ type ExchangeRateResponse = {
208
+ current_rate: ExchangeRate;
209
+ next_rate: ExchangeRate;
210
+ timestamp: string;
211
+ };
212
+ interface TokenAirdropsResponse {
213
+ airdrops: TokenAirdrop[];
214
+ links: Links;
215
+ }
216
+ interface TokenAirdrop {
217
+ amount: number;
218
+ receiver_id: string | null;
219
+ sender_id: string | null;
220
+ serial_number: number | null;
221
+ timestamp: TimestampRange;
222
+ token_id: string | null;
223
+ }
224
+ interface TimestampRange {
225
+ from: string;
226
+ to: string | null;
227
+ }
228
+ interface Links {
229
+ next: string | null;
230
+ }
231
+ interface TokenAllowanceResponse {
232
+ allowances: TokenAllowance[];
233
+ links: {
234
+ next: string | null;
235
+ };
236
+ }
237
+ interface TokenAllowance {
238
+ amount: number;
239
+ amount_granted: number;
240
+ owner: string;
241
+ spender: string;
242
+ timestamp: {
243
+ from: string;
244
+ to: string | null;
245
+ };
246
+ token_id: string;
247
+ }
248
+ interface ScheduledTransactionDetailsResponse {
249
+ admin_key?: {
250
+ _type?: string;
251
+ key?: string;
252
+ } | null;
253
+ deleted: boolean;
254
+ consensus_timestamp: string;
255
+ creator_account_id: string;
256
+ executed_timestamp: string | null;
257
+ expiration_time: string | null;
258
+ memo: string;
259
+ payer_account_id: string;
260
+ schedule_id: string;
261
+ signatures: Array<{
262
+ consensus_timestamp: string;
263
+ public_key_prefix: string;
264
+ signature: string;
265
+ type: string;
266
+ }>;
267
+ transaction_body: string;
268
+ wait_for_expiry: boolean;
269
+ }
270
+
271
+ interface IHederaMirrornodeService {
272
+ getAccount(accountId: string): Promise<AccountResponse>;
273
+ getAccountHbarBalance(accountId: string): Promise<BigNumber>;
274
+ getAccountTokenBalances(accountId: string, tokenId?: string): Promise<TokenBalancesResponse>;
275
+ getTopicMessages(queryParams: TopicMessagesQueryParams): Promise<TopicMessagesResponse>;
276
+ getTopicInfo(topicId: string): Promise<TopicInfo>;
277
+ getTokenInfo(tokenId: string): Promise<TokenInfo>;
278
+ getContractInfo(contractId: string): Promise<ContractInfo>;
279
+ getTransactionRecord(transactionId: string, nonce?: number): Promise<TransactionDetailsResponse>;
280
+ getExchangeRate(timestamp?: string): Promise<ExchangeRateResponse>;
281
+ getPendingAirdrops(accountId: string): Promise<TokenAirdropsResponse>;
282
+ getOutstandingAirdrops(accountId: string): Promise<TokenAirdropsResponse>;
283
+ getTokenAllowances(ownerAccountId: string, spenderAccountId: string): Promise<TokenAllowanceResponse>;
284
+ getAccountNfts(accountId: string): Promise<NftBalanceResponse>;
285
+ getScheduledTransactionDetails(scheduleId: string): Promise<ScheduledTransactionDetailsResponse>;
286
+ getBaseUrl(): string;
287
+ }
288
+
289
+ type Tool = {
290
+ method: string;
291
+ name: string;
292
+ description: string;
293
+ parameters: z.ZodObject<any, any>;
294
+ execute: (client: Client, context: Context, params: any) => Promise<any>;
295
+ outputParser?: (rawOutput: string) => {
296
+ raw: any;
297
+ humanMessage: string;
298
+ };
299
+ };
300
+
301
+ interface Plugin {
302
+ name: string;
303
+ version?: string;
304
+ description?: string;
305
+ tools: (context: Context) => Tool[];
306
+ }
307
+
308
+ declare enum AgentMode {
309
+ AUTONOMOUS = "autonomous",
310
+ RETURN_BYTES = "returnBytes"
311
+ }
312
+ type Context = {
313
+ accountId?: string;
314
+ accountPublicKey?: string;
315
+ mode?: AgentMode;
316
+ mirrornodeService?: IHederaMirrornodeService;
317
+ };
318
+ type Configuration = {
319
+ tools?: string[];
320
+ plugins?: Plugin[];
321
+ context?: Context;
322
+ mcpServers?: HederaMCPServer[];
323
+ };
324
+ declare enum HederaMCPServer {
325
+ HEDERION_MCP_MAINNET = "hederion-mcp-mainnet",
326
+ HGRAPH_MCP_MAINNET = "hgraph-mcp-mainnet"
327
+ }
328
+
329
+ declare class HederaAgentKitTool implements Action {
330
+ description: string;
331
+ handler: Handler;
332
+ similes?: string[] | undefined;
333
+ examples?: ActionExample[][] | undefined;
334
+ name: string;
335
+ validate: Validator;
336
+ constructor(client: Client, context: Context, tool: Tool);
337
+ [key: string]: unknown;
338
+ }
339
+
340
+ declare class HederaElizaOSToolkit {
341
+ private readonly tools;
342
+ private readonly client;
343
+ private readonly context;
344
+ constructor({ client, configuration }: {
345
+ client: Client;
346
+ configuration: Configuration;
347
+ });
348
+ /**
349
+ * Maps hedera-agent-kit tools and returns ElizaOS compatible actions
350
+ */
351
+ getTools(): HederaAgentKitTool[];
352
+ }
353
+
354
+ export { type Configuration, type Context, HederaElizaOSToolkit };