@missionsquad/mcp-server-tron 1.2.0

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 (193) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +537 -0
  3. package/bin/cli.js +51 -0
  4. package/build/core/chains.d.ts +17 -0
  5. package/build/core/chains.js +87 -0
  6. package/build/core/chains.js.map +1 -0
  7. package/build/core/prompts.d.ts +19 -0
  8. package/build/core/prompts.js +485 -0
  9. package/build/core/prompts.js.map +1 -0
  10. package/build/core/resources.d.ts +14 -0
  11. package/build/core/resources.js +42 -0
  12. package/build/core/resources.js.map +1 -0
  13. package/build/core/services/account-data.d.ts +144 -0
  14. package/build/core/services/account-data.js +228 -0
  15. package/build/core/services/account-data.js.map +1 -0
  16. package/build/core/services/account-resource.d.ts +56 -0
  17. package/build/core/services/account-resource.js +133 -0
  18. package/build/core/services/account-resource.js.map +1 -0
  19. package/build/core/services/account.d.ts +141 -0
  20. package/build/core/services/account.js +191 -0
  21. package/build/core/services/account.js.map +1 -0
  22. package/build/core/services/address.d.ts +8 -0
  23. package/build/core/services/address.js +52 -0
  24. package/build/core/services/address.js.map +1 -0
  25. package/build/core/services/agent-wallet.d.ts +62 -0
  26. package/build/core/services/agent-wallet.js +234 -0
  27. package/build/core/services/agent-wallet.js.map +1 -0
  28. package/build/core/services/balance.d.ts +26 -0
  29. package/build/core/services/balance.js +60 -0
  30. package/build/core/services/balance.js.map +1 -0
  31. package/build/core/services/blocks.d.ts +25 -0
  32. package/build/core/services/blocks.js +65 -0
  33. package/build/core/services/blocks.js.map +1 -0
  34. package/build/core/services/broadcast.d.ts +13 -0
  35. package/build/core/services/broadcast.js +24 -0
  36. package/build/core/services/broadcast.js.map +1 -0
  37. package/build/core/services/clients.d.ts +5 -0
  38. package/build/core/services/clients.js +29 -0
  39. package/build/core/services/clients.js.map +1 -0
  40. package/build/core/services/contract-data.d.ts +31 -0
  41. package/build/core/services/contract-data.js +54 -0
  42. package/build/core/services/contract-data.js.map +1 -0
  43. package/build/core/services/contracts.d.ts +108 -0
  44. package/build/core/services/contracts.js +482 -0
  45. package/build/core/services/contracts.js.map +1 -0
  46. package/build/core/services/events.d.ts +56 -0
  47. package/build/core/services/events.js +99 -0
  48. package/build/core/services/events.js.map +1 -0
  49. package/build/core/services/governance.d.ts +78 -0
  50. package/build/core/services/governance.js +207 -0
  51. package/build/core/services/governance.js.map +1 -0
  52. package/build/core/services/index.d.ts +28 -0
  53. package/build/core/services/index.js +81 -0
  54. package/build/core/services/index.js.map +1 -0
  55. package/build/core/services/mempool.d.ts +12 -0
  56. package/build/core/services/mempool.js +32 -0
  57. package/build/core/services/mempool.js.map +1 -0
  58. package/build/core/services/multicall-abi.d.ts +55 -0
  59. package/build/core/services/multicall-abi.js +61 -0
  60. package/build/core/services/multicall-abi.js.map +1 -0
  61. package/build/core/services/nodes.d.ts +8 -0
  62. package/build/core/services/nodes.js +18 -0
  63. package/build/core/services/nodes.js.map +1 -0
  64. package/build/core/services/proposals.d.ts +33 -0
  65. package/build/core/services/proposals.js +95 -0
  66. package/build/core/services/proposals.js.map +1 -0
  67. package/build/core/services/query.d.ts +34 -0
  68. package/build/core/services/query.js +60 -0
  69. package/build/core/services/query.js.map +1 -0
  70. package/build/core/services/staking.d.ts +40 -0
  71. package/build/core/services/staking.js +113 -0
  72. package/build/core/services/staking.js.map +1 -0
  73. package/build/core/services/tokens.d.ts +22 -0
  74. package/build/core/services/tokens.js +68 -0
  75. package/build/core/services/tokens.js.map +1 -0
  76. package/build/core/services/transactions.d.ts +16 -0
  77. package/build/core/services/transactions.js +42 -0
  78. package/build/core/services/transactions.js.map +1 -0
  79. package/build/core/services/transfer.d.ts +24 -0
  80. package/build/core/services/transfer.js +84 -0
  81. package/build/core/services/transfer.js.map +1 -0
  82. package/build/core/services/trongrid-client.d.ts +14 -0
  83. package/build/core/services/trongrid-client.js +19 -0
  84. package/build/core/services/trongrid-client.js.map +1 -0
  85. package/build/core/services/utils.d.ts +13 -0
  86. package/build/core/services/utils.js +39 -0
  87. package/build/core/services/utils.js.map +1 -0
  88. package/build/core/services/wallet.d.ts +13 -0
  89. package/build/core/services/wallet.js +18 -0
  90. package/build/core/services/wallet.js.map +1 -0
  91. package/build/core/tools/account-data.d.ts +2 -0
  92. package/build/core/tools/account-data.js +253 -0
  93. package/build/core/tools/account-data.js.map +1 -0
  94. package/build/core/tools/account-resource.d.ts +2 -0
  95. package/build/core/tools/account-resource.js +269 -0
  96. package/build/core/tools/account-resource.js.map +1 -0
  97. package/build/core/tools/account.d.ts +2 -0
  98. package/build/core/tools/account.js +451 -0
  99. package/build/core/tools/account.js.map +1 -0
  100. package/build/core/tools/address.d.ts +2 -0
  101. package/build/core/tools/address.js +45 -0
  102. package/build/core/tools/address.js.map +1 -0
  103. package/build/core/tools/balance.d.ts +2 -0
  104. package/build/core/tools/balance.js +94 -0
  105. package/build/core/tools/balance.js.map +1 -0
  106. package/build/core/tools/block.d.ts +2 -0
  107. package/build/core/tools/block.js +74 -0
  108. package/build/core/tools/block.js.map +1 -0
  109. package/build/core/tools/broadcast.d.ts +2 -0
  110. package/build/core/tools/broadcast.js +102 -0
  111. package/build/core/tools/broadcast.js.map +1 -0
  112. package/build/core/tools/contract-data.d.ts +2 -0
  113. package/build/core/tools/contract-data.js +159 -0
  114. package/build/core/tools/contract-data.js.map +1 -0
  115. package/build/core/tools/contract.d.ts +2 -0
  116. package/build/core/tools/contract.js +600 -0
  117. package/build/core/tools/contract.js.map +1 -0
  118. package/build/core/tools/event.d.ts +2 -0
  119. package/build/core/tools/event.js +159 -0
  120. package/build/core/tools/event.js.map +1 -0
  121. package/build/core/tools/governance.d.ts +6 -0
  122. package/build/core/tools/governance.js +424 -0
  123. package/build/core/tools/governance.js.map +1 -0
  124. package/build/core/tools/index.d.ts +15 -0
  125. package/build/core/tools/index.js +93 -0
  126. package/build/core/tools/index.js.map +1 -0
  127. package/build/core/tools/mempool.d.ts +2 -0
  128. package/build/core/tools/mempool.js +116 -0
  129. package/build/core/tools/mempool.js.map +1 -0
  130. package/build/core/tools/network.d.ts +2 -0
  131. package/build/core/tools/network.js +114 -0
  132. package/build/core/tools/network.js.map +1 -0
  133. package/build/core/tools/node.d.ts +2 -0
  134. package/build/core/tools/node.js +75 -0
  135. package/build/core/tools/node.js.map +1 -0
  136. package/build/core/tools/proposals.d.ts +6 -0
  137. package/build/core/tools/proposals.js +219 -0
  138. package/build/core/tools/proposals.js.map +1 -0
  139. package/build/core/tools/query.d.ts +2 -0
  140. package/build/core/tools/query.js +399 -0
  141. package/build/core/tools/query.js.map +1 -0
  142. package/build/core/tools/staking.d.ts +2 -0
  143. package/build/core/tools/staking.js +281 -0
  144. package/build/core/tools/staking.js.map +1 -0
  145. package/build/core/tools/transaction.d.ts +2 -0
  146. package/build/core/tools/transaction.js +65 -0
  147. package/build/core/tools/transaction.js.map +1 -0
  148. package/build/core/tools/transfer.d.ts +2 -0
  149. package/build/core/tools/transfer.js +101 -0
  150. package/build/core/tools/transfer.js.map +1 -0
  151. package/build/core/tools/types.d.ts +13 -0
  152. package/build/core/tools/types.js +2 -0
  153. package/build/core/tools/types.js.map +1 -0
  154. package/build/core/tools/wallet.d.ts +2 -0
  155. package/build/core/tools/wallet.js +172 -0
  156. package/build/core/tools/wallet.js.map +1 -0
  157. package/build/index.d.ts +1 -0
  158. package/build/index.js +21 -0
  159. package/build/index.js.map +1 -0
  160. package/build/middleware/auth.d.ts +16 -0
  161. package/build/middleware/auth.js +44 -0
  162. package/build/middleware/auth.js.map +1 -0
  163. package/build/oauth/OAuthService.d.ts +100 -0
  164. package/build/oauth/OAuthService.js +507 -0
  165. package/build/oauth/OAuthService.js.map +1 -0
  166. package/build/oauth/page.d.ts +1 -0
  167. package/build/oauth/page.js +255 -0
  168. package/build/oauth/page.js.map +1 -0
  169. package/build/oauth/types.d.ts +65 -0
  170. package/build/oauth/types.js +2 -0
  171. package/build/oauth/types.js.map +1 -0
  172. package/build/server/http-app.d.ts +9 -0
  173. package/build/server/http-app.js +128 -0
  174. package/build/server/http-app.js.map +1 -0
  175. package/build/server/http-server.d.ts +1 -0
  176. package/build/server/http-server.js +35 -0
  177. package/build/server/http-server.js.map +1 -0
  178. package/build/server/oauth-routes.d.ts +7 -0
  179. package/build/server/oauth-routes.js +157 -0
  180. package/build/server/oauth-routes.js.map +1 -0
  181. package/build/server/server.d.ts +9 -0
  182. package/build/server/server.js +54 -0
  183. package/build/server/server.js.map +1 -0
  184. package/build/tenant/TenantManager.d.ts +35 -0
  185. package/build/tenant/TenantManager.js +167 -0
  186. package/build/tenant/TenantManager.js.map +1 -0
  187. package/build/tenant/context.d.ts +11 -0
  188. package/build/tenant/context.js +23 -0
  189. package/build/tenant/context.js.map +1 -0
  190. package/build/tenant/types.d.ts +16 -0
  191. package/build/tenant/types.js +2 -0
  192. package/build/tenant/types.js.map +1 -0
  193. package/package.json +95 -0
@@ -0,0 +1,16 @@
1
+ type Transaction = any;
2
+ type TransactionInfo = any;
3
+ /**
4
+ * Get transaction details by transaction hash
5
+ */
6
+ export declare function getTransaction(txHash: string, network?: string): Promise<Transaction>;
7
+ /**
8
+ * Get transaction info (receipt equivalent)
9
+ */
10
+ export declare function getTransactionInfo(txHash: string, network?: string): Promise<TransactionInfo>;
11
+ export declare const getTransactionReceipt: typeof getTransactionInfo;
12
+ /**
13
+ * Wait for a transaction to be confirmed
14
+ */
15
+ export declare function waitForTransaction(txHash: string, network?: string): Promise<TransactionInfo>;
16
+ export {};
@@ -0,0 +1,42 @@
1
+ import { getTronWeb } from "./clients.js";
2
+ /**
3
+ * Get transaction details by transaction hash
4
+ */
5
+ export async function getTransaction(txHash, network = "mainnet") {
6
+ const tronWeb = getTronWeb(network);
7
+ const tx = await tronWeb.trx.getTransaction(txHash);
8
+ return tx;
9
+ }
10
+ /**
11
+ * Get transaction info (receipt equivalent)
12
+ */
13
+ export async function getTransactionInfo(txHash, network = "mainnet") {
14
+ const tronWeb = getTronWeb(network);
15
+ const info = await tronWeb.trx.getTransactionInfo(txHash);
16
+ return info;
17
+ }
18
+ // Alias for tools expecting 'receipt'
19
+ export const getTransactionReceipt = getTransactionInfo;
20
+ /**
21
+ * Wait for a transaction to be confirmed
22
+ */
23
+ export async function waitForTransaction(txHash, network = "mainnet") {
24
+ const tronWeb = getTronWeb(network);
25
+ // Poll for transaction info
26
+ const maxAttempts = 30;
27
+ const interval = 2000; // 2 seconds
28
+ for (let i = 0; i < maxAttempts; i++) {
29
+ try {
30
+ const info = await tronWeb.trx.getTransactionInfo(txHash);
31
+ if (info && info.id) {
32
+ return info;
33
+ }
34
+ }
35
+ catch (_e) {
36
+ // Ignore error and retry
37
+ }
38
+ await new Promise((resolve) => setTimeout(resolve, interval));
39
+ }
40
+ throw new Error(`Transaction ${txHash} not confirmed after ${maxAttempts * interval}ms`);
41
+ }
42
+ //# sourceMappingURL=transactions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactions.js","sourceRoot":"","sources":["../../../src/core/services/transactions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK1C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,MAAc,EAAE,OAAO,GAAG,SAAS;IACtE,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IACpD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,MAAc,EACd,OAAO,GAAG,SAAS;IAEnB,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC1D,OAAO,IAAI,CAAC;AACd,CAAC;AAED,sCAAsC;AACtC,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAExD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,MAAc,EACd,OAAO,GAAG,SAAS;IAEnB,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAEpC,4BAA4B;IAC5B,MAAM,WAAW,GAAG,EAAE,CAAC;IACvB,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,YAAY;IAEnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;YAC1D,IAAI,IAAI,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC;gBACpB,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QAAC,OAAO,EAAE,EAAE,CAAC;YACZ,yBAAyB;QAC3B,CAAC;QACD,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;IAChE,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,eAAe,MAAM,wBAAwB,WAAW,GAAG,QAAQ,IAAI,CAAC,CAAC;AAC3F,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Transfer TRX to an address
3
+ */
4
+ export declare function transferTRX(to: string, amount: string, // Amount in TRX (not Sun)
5
+ network?: string): Promise<string>;
6
+ /**
7
+ * Transfer TRC20 tokens
8
+ */
9
+ export declare function transferTRC20(tokenAddress: string, to: string, amount: string, // Raw amount (accounting for decimals)
10
+ network?: string): Promise<{
11
+ txHash: any;
12
+ amount: {
13
+ raw: string;
14
+ formatted: string;
15
+ };
16
+ token: {
17
+ symbol: any;
18
+ decimals: number;
19
+ };
20
+ }>;
21
+ /**
22
+ * Approve token spending
23
+ */
24
+ export declare function approveTRC20(tokenAddress: string, spenderAddress: string, amount: string, network?: string): Promise<string>;
@@ -0,0 +1,84 @@
1
+ import { getTronWeb } from "./clients.js";
2
+ import { getOwnerAddress, buildSignBroadcast, signTransaction } from "./agent-wallet.js";
3
+ import { utils } from "./utils.js";
4
+ /**
5
+ * Transfer TRX to an address
6
+ */
7
+ export async function transferTRX(to, amount, // Amount in TRX (not Sun)
8
+ network = "mainnet") {
9
+ const tronWeb = getTronWeb(network);
10
+ const ownerAddress = await getOwnerAddress();
11
+ const amountSun = utils.toSun(amount);
12
+ const unsignedTx = await tronWeb.transactionBuilder.sendTrx(to, amountSun, ownerAddress);
13
+ return await buildSignBroadcast(unsignedTx, network);
14
+ }
15
+ /**
16
+ * Transfer TRC20 tokens
17
+ */
18
+ export async function transferTRC20(tokenAddress, to, amount, // Raw amount (accounting for decimals)
19
+ network = "mainnet") {
20
+ const tronWeb = getTronWeb(network);
21
+ const ownerAddress = await getOwnerAddress();
22
+ try {
23
+ // Build unsigned tx via triggerSmartContract
24
+ const functionSelector = "transfer(address,uint256)";
25
+ const parameter = [
26
+ { type: "address", value: to },
27
+ { type: "uint256", value: amount },
28
+ ];
29
+ const { transaction, result: triggerResult } = await tronWeb.transactionBuilder.triggerSmartContract(tokenAddress, functionSelector, {}, parameter, ownerAddress);
30
+ if (!triggerResult || !triggerResult.result) {
31
+ throw new Error(`Failed to build TRC20 transfer transaction: ${JSON.stringify(triggerResult)}`);
32
+ }
33
+ const signedTx = await signTransaction(transaction);
34
+ const broadcastResult = await tronWeb.trx.sendRawTransaction(signedTx);
35
+ if (!broadcastResult.result) {
36
+ throw new Error(`Broadcast failed: ${JSON.stringify(broadcastResult)}`);
37
+ }
38
+ const txId = broadcastResult.txid || transaction.txID;
39
+ // Fetch token info for return (using read-only client)
40
+ const contract = await tronWeb.contract().at(tokenAddress);
41
+ const symbol = await contract.methods.symbol().call();
42
+ const decimals = await contract.methods.decimals().call();
43
+ const decimalsNum = Number(decimals);
44
+ const divisor = BigInt(10) ** BigInt(decimalsNum);
45
+ const formatted = (Number(BigInt(amount)) / Number(divisor)).toString();
46
+ return {
47
+ txHash: txId,
48
+ amount: {
49
+ raw: amount,
50
+ formatted: formatted,
51
+ },
52
+ token: {
53
+ symbol: symbol,
54
+ decimals: decimalsNum,
55
+ },
56
+ };
57
+ }
58
+ catch (error) {
59
+ throw new Error(`Failed to transfer TRC20: ${error.message}`);
60
+ }
61
+ }
62
+ /**
63
+ * Approve token spending
64
+ */
65
+ export async function approveTRC20(tokenAddress, spenderAddress, amount, network = "mainnet") {
66
+ const tronWeb = getTronWeb(network);
67
+ const ownerAddress = await getOwnerAddress();
68
+ try {
69
+ const functionSelector = "approve(address,uint256)";
70
+ const parameter = [
71
+ { type: "address", value: spenderAddress },
72
+ { type: "uint256", value: amount },
73
+ ];
74
+ const { transaction, result: triggerResult } = await tronWeb.transactionBuilder.triggerSmartContract(tokenAddress, functionSelector, {}, parameter, ownerAddress);
75
+ if (!triggerResult || !triggerResult.result) {
76
+ throw new Error(`Failed to build TRC20 approve transaction: ${JSON.stringify(triggerResult)}`);
77
+ }
78
+ return await buildSignBroadcast(transaction, network);
79
+ }
80
+ catch (error) {
81
+ throw new Error(`Failed to approve TRC20: ${error.message}`);
82
+ }
83
+ }
84
+ //# sourceMappingURL=transfer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transfer.js","sourceRoot":"","sources":["../../../src/core/services/transfer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzF,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,EAAU,EACV,MAAc,EAAE,0BAA0B;AAC1C,OAAO,GAAG,SAAS;IAEnB,MAAM,OAAO,GAAG,UAAU,CAAC,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ACpB,cAAsB,EACtB,MAAc,EACd,OAAO,GAAG,SAAS;IAEnB,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,MAAM,YAAY,GAAG,MAAM,eAAe,EAAE,CAAC;IAE7C,IAAI,CAAC;QACH,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;QACpD,MAAM,SAAS,GAAG;YAChB,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,cAAc,EAAE;YAC1C,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE;SACnC,CAAC;QACF,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,GAC1C,MAAM,OAAO,CAAC,kBAAkB,CAAC,oBAAoB,CACnD,YAAY,EACZ,gBAAgB,EAChB,EAAE,EACF,SAAS,EACT,YAAY,CACb,CAAC;QAEJ,IAAI,CAAC,aAAa,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;YAC5C,MAAM,IAAI,KAAK,CACb,8CAA8C,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,CAC9E,CAAC;QACJ,CAAC;QAED,OAAO,MAAM,kBAAkB,CAAC,WAAkB,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,4BAA4B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC"}
@@ -0,0 +1,14 @@
1
+ export interface TronGridListResponse<T = unknown> {
2
+ data: T[];
3
+ meta?: {
4
+ fingerprint?: string;
5
+ };
6
+ }
7
+ export interface TronGridSingleResponse<T = unknown> {
8
+ data: T[];
9
+ }
10
+ /**
11
+ * Perform a GET request against TronGrid v1 API via the cached TronWeb fullNode.
12
+ * Undefined params are silently filtered before being serialised as query-string.
13
+ */
14
+ export declare function tronGridGet<T = unknown>(network: string, path: string, params?: Record<string, unknown>): Promise<T>;
@@ -0,0 +1,19 @@
1
+ import { getTronWeb } from "./clients.js";
2
+ // ---------------------------------------------------------------------------
3
+ // TronGrid GET helper
4
+ // ---------------------------------------------------------------------------
5
+ /**
6
+ * Perform a GET request against TronGrid v1 API via the cached TronWeb fullNode.
7
+ * Undefined params are silently filtered before being serialised as query-string.
8
+ */
9
+ export async function tronGridGet(network, path, params = {}) {
10
+ const tronWeb = getTronWeb(network);
11
+ const cleanParams = {};
12
+ for (const [key, value] of Object.entries(params)) {
13
+ if (value !== undefined) {
14
+ cleanParams[key] = value;
15
+ }
16
+ }
17
+ return tronWeb.fullNode.request(path, cleanParams, "get");
18
+ }
19
+ //# sourceMappingURL=trongrid-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trongrid-client.js","sourceRoot":"","sources":["../../../src/core/services/trongrid-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAe1C,8EAA8E;AAC9E,sBAAsB;AACtB,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,OAAe,EACf,IAAY,EACZ,SAAkC,EAAE;IAEpC,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,MAAM,WAAW,GAA4B,EAAE,CAAC;IAChD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,WAAW,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,CAAe,CAAC;AAC1E,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Utility functions for formatting and parsing values
3
+ */
4
+ export declare const utils: {
5
+ toSun: (trx: number | string) => string;
6
+ fromSun: (sun: number | string | bigint) => string;
7
+ formatBigInt: (value: bigint | number) => string;
8
+ formatJson: (obj: unknown) => string;
9
+ formatNumber: (value: number | string) => string;
10
+ hexToNumber: (hex: string) => number;
11
+ numberToHex: (num: number) => string;
12
+ isAddress: (address: string) => boolean;
13
+ };
@@ -0,0 +1,39 @@
1
+ // Fix TypeScript error: TronWeb.fromSun returns string, but we can pass string to it (TronWeb types might be outdated or strict)
2
+ import { TronWeb } from "tronweb";
3
+ // Note: TronWeb handles most of these conversions internally or via utility methods.
4
+ // We are wrapping them here for consistent API usage across the application.
5
+ /**
6
+ * Utility functions for formatting and parsing values
7
+ */
8
+ export const utils = {
9
+ // Convert Tron (ether equivalent) to Sun (wei equivalent)
10
+ // 1 TRX = 1,000,000 SUN
11
+ toSun: (trx) => {
12
+ return TronWeb.toSun(trx).toString();
13
+ },
14
+ // Convert Sun to Tron
15
+ fromSun: (sun) => {
16
+ return TronWeb.fromSun(sun.toString()).toString();
17
+ },
18
+ // Format a bigint/number to a string
19
+ formatBigInt: (value) => value.toString(),
20
+ // Format an object to JSON with bigint handling
21
+ formatJson: (obj) => JSON.stringify(obj, (_, value) => (typeof value === "bigint" ? value.toString() : value), 2),
22
+ // Format a number with commas
23
+ formatNumber: (value) => {
24
+ return Number(value).toLocaleString();
25
+ },
26
+ // Convert a hex string to a number
27
+ hexToNumber: (hex) => {
28
+ return parseInt(hex, 16);
29
+ },
30
+ // Convert a number to a hex string
31
+ numberToHex: (num) => {
32
+ return "0x" + num.toString(16);
33
+ },
34
+ // Tron specific utils
35
+ isAddress: (address) => {
36
+ return TronWeb.isAddress(address);
37
+ },
38
+ };
39
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/core/services/utils.ts"],"names":[],"mappings":"AAAA,iIAAiI;AAEjI,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,qFAAqF;AACrF,6EAA6E;AAE7E;;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,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { getOwnerAddress } from "./agent-wallet.js";
2
+ /**
3
+ * Get the address of the active wallet (works in all modes).
4
+ */
5
+ export declare const getWalletAddress: typeof getOwnerAddress;
6
+ /**
7
+ * Sign an arbitrary message using the active wallet.
8
+ */
9
+ export declare const signMessage: (message: string) => Promise<string>;
10
+ /**
11
+ * Sign typed data (EIP-712) using the active wallet.
12
+ */
13
+ export declare const signTypedData: (domain: object, types: object, value: object) => Promise<string>;
@@ -0,0 +1,18 @@
1
+ import { getOwnerAddress, signMessageWithWallet, signTypedDataWithWallet } from "./agent-wallet.js";
2
+ /**
3
+ * Get the address of the active wallet (works in all modes).
4
+ */
5
+ export const getWalletAddress = getOwnerAddress;
6
+ /**
7
+ * Sign an arbitrary message using the active wallet.
8
+ */
9
+ export const signMessage = async (message) => {
10
+ return signMessageWithWallet(message);
11
+ };
12
+ /**
13
+ * Sign typed data (EIP-712) using the active wallet.
14
+ */
15
+ export const signTypedData = async (domain, types, value) => {
16
+ return signTypedDataWithWallet(domain, types, value);
17
+ };
18
+ //# sourceMappingURL=wallet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet.js","sourceRoot":"","sources":["../../../src/core/services/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEpG;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAAE,OAAe,EAAmB,EAAE;IACpE,OAAO,qBAAqB,CAAC,OAAO,CAAC,CAAC;AACxC,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAChC,MAAc,EACd,KAAa,EACb,KAAa,EACI,EAAE;IACnB,OAAO,uBAAuB,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AACvD,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { RegisterToolFn } from "./types.js";
2
+ export declare function registerAccountDataTools(registerTool: RegisterToolFn): void;
@@ -0,0 +1,253 @@
1
+ import { z } from "zod";
2
+ import * as services from "../services/index.js";
3
+ export function registerAccountDataTools(registerTool) {
4
+ registerTool("get_account_info", {
5
+ description: "Get comprehensive account information from TronGrid indexed data, including TRX balance, " +
6
+ "TRC20 balances, frozen resources, and votes. Data comes from the TronGrid indexer and may " +
7
+ "have slight delays compared to on-chain state.",
8
+ inputSchema: {
9
+ address: z
10
+ .string()
11
+ .min(1)
12
+ .describe("Account address (base58 T-address or hex 41-prefixed)"),
13
+ onlyConfirmed: z.boolean().optional().describe("Only return confirmed data"),
14
+ network: z.string().optional().describe("Network name. Defaults to mainnet."),
15
+ },
16
+ annotations: {
17
+ title: "Get Account Info",
18
+ readOnlyHint: true,
19
+ destructiveHint: false,
20
+ idempotentHint: true,
21
+ openWorldHint: true,
22
+ },
23
+ }, async ({ address, onlyConfirmed, network = "mainnet" }) => {
24
+ try {
25
+ const result = await services.getAccountInfo(address, { onlyConfirmed }, network);
26
+ return {
27
+ content: [{ type: "text", text: services.helpers.formatJson(result) }],
28
+ };
29
+ }
30
+ catch (error) {
31
+ return {
32
+ content: [
33
+ {
34
+ type: "text",
35
+ text: `Error fetching account info: ${error instanceof Error ? error.message : String(error)}`,
36
+ },
37
+ ],
38
+ isError: true,
39
+ };
40
+ }
41
+ });
42
+ registerTool("get_account_transactions", {
43
+ description: "Get transaction history for an account from TronGrid indexed data. Returns all transaction " +
44
+ "types (TRX transfers, contract calls, etc.). Supports pagination via limit + fingerprint. " +
45
+ "Default 20 results, max 200 per page.",
46
+ inputSchema: {
47
+ address: z
48
+ .string()
49
+ .min(1)
50
+ .describe("Account address (base58 T-address or hex 41-prefixed)"),
51
+ limit: z
52
+ .number()
53
+ .max(200)
54
+ .optional()
55
+ .describe("Max transactions per page (default 20, max 200)"),
56
+ fingerprint: z.string().optional().describe("Pagination token from previous response"),
57
+ onlyConfirmed: z.boolean().optional().describe("Only return confirmed transactions"),
58
+ onlyUnconfirmed: z.boolean().optional().describe("Only return unconfirmed transactions"),
59
+ orderBy: z.string().optional().describe("Sort field, e.g. 'block_timestamp,desc'"),
60
+ minTimestamp: z.number().optional().describe("Filter: minimum block timestamp (ms)"),
61
+ maxTimestamp: z.number().optional().describe("Filter: maximum block timestamp (ms)"),
62
+ network: z.string().optional().describe("Network name. Defaults to mainnet."),
63
+ },
64
+ annotations: {
65
+ title: "Get Account Transactions",
66
+ readOnlyHint: true,
67
+ destructiveHint: false,
68
+ idempotentHint: true,
69
+ openWorldHint: true,
70
+ },
71
+ }, async ({ address, limit, fingerprint, onlyConfirmed, onlyUnconfirmed, orderBy, minTimestamp, maxTimestamp, network = "mainnet", }) => {
72
+ try {
73
+ const result = await services.getAccountTransactions(address, {
74
+ limit,
75
+ fingerprint,
76
+ onlyConfirmed,
77
+ onlyUnconfirmed,
78
+ orderBy,
79
+ minTimestamp,
80
+ maxTimestamp,
81
+ }, network);
82
+ return {
83
+ content: [{ type: "text", text: services.helpers.formatJson(result) }],
84
+ };
85
+ }
86
+ catch (error) {
87
+ return {
88
+ content: [
89
+ {
90
+ type: "text",
91
+ text: `Error fetching account transactions: ${error instanceof Error ? error.message : String(error)}`,
92
+ },
93
+ ],
94
+ isError: true,
95
+ };
96
+ }
97
+ });
98
+ registerTool("get_account_trc20_transactions", {
99
+ description: "Get TRC20 token transfer history for an account from TronGrid indexed data. Returns token " +
100
+ "transfer details including token info (name, symbol, decimals) and human-readable values. " +
101
+ "Supports pagination via limit + fingerprint. Default 20 results, max 200 per page.",
102
+ inputSchema: {
103
+ address: z
104
+ .string()
105
+ .min(1)
106
+ .describe("Account address (base58 T-address or hex 41-prefixed)"),
107
+ contractAddress: z
108
+ .string()
109
+ .optional()
110
+ .describe("Filter by specific TRC20 token contract address"),
111
+ limit: z
112
+ .number()
113
+ .max(200)
114
+ .optional()
115
+ .describe("Max transactions per page (default 20, max 200)"),
116
+ fingerprint: z.string().optional().describe("Pagination token from previous response"),
117
+ onlyConfirmed: z.boolean().optional().describe("Only return confirmed transactions"),
118
+ onlyUnconfirmed: z.boolean().optional().describe("Only return unconfirmed transactions"),
119
+ orderBy: z.string().optional().describe("Sort field, e.g. 'block_timestamp,desc'"),
120
+ minTimestamp: z.number().optional().describe("Filter: minimum block timestamp (ms)"),
121
+ maxTimestamp: z.number().optional().describe("Filter: maximum block timestamp (ms)"),
122
+ network: z.string().optional().describe("Network name. Defaults to mainnet."),
123
+ },
124
+ annotations: {
125
+ title: "Get Account TRC20 Transactions",
126
+ readOnlyHint: true,
127
+ destructiveHint: false,
128
+ idempotentHint: true,
129
+ openWorldHint: true,
130
+ },
131
+ }, async ({ address, contractAddress, limit, fingerprint, onlyConfirmed, onlyUnconfirmed, orderBy, minTimestamp, maxTimestamp, network = "mainnet", }) => {
132
+ try {
133
+ const result = await services.getAccountTrc20Transactions(address, {
134
+ contractAddress,
135
+ limit,
136
+ fingerprint,
137
+ onlyConfirmed,
138
+ onlyUnconfirmed,
139
+ orderBy,
140
+ minTimestamp,
141
+ maxTimestamp,
142
+ }, network);
143
+ return {
144
+ content: [{ type: "text", text: services.helpers.formatJson(result) }],
145
+ };
146
+ }
147
+ catch (error) {
148
+ return {
149
+ content: [
150
+ {
151
+ type: "text",
152
+ text: `Error fetching TRC20 transactions: ${error instanceof Error ? error.message : String(error)}`,
153
+ },
154
+ ],
155
+ isError: true,
156
+ };
157
+ }
158
+ });
159
+ registerTool("get_account_internal_transactions", {
160
+ description: "Get internal transactions (triggered by smart contract execution) for an account from " +
161
+ "TronGrid indexed data. Supports pagination via limit + fingerprint. Default 20, max 200.",
162
+ inputSchema: {
163
+ address: z
164
+ .string()
165
+ .min(1)
166
+ .describe("Account address (base58 T-address or hex 41-prefixed)"),
167
+ limit: z
168
+ .number()
169
+ .max(200)
170
+ .optional()
171
+ .describe("Max transactions per page (default 20, max 200)"),
172
+ fingerprint: z.string().optional().describe("Pagination token from previous response"),
173
+ onlyConfirmed: z.boolean().optional().describe("Only return confirmed transactions"),
174
+ onlyUnconfirmed: z.boolean().optional().describe("Only return unconfirmed transactions"),
175
+ orderBy: z.string().optional().describe("Sort field, e.g. 'block_timestamp,desc'"),
176
+ minTimestamp: z.number().optional().describe("Filter: minimum block timestamp (ms)"),
177
+ maxTimestamp: z.number().optional().describe("Filter: maximum block timestamp (ms)"),
178
+ network: z.string().optional().describe("Network name. Defaults to mainnet."),
179
+ },
180
+ annotations: {
181
+ title: "Get Account Internal Transactions",
182
+ readOnlyHint: true,
183
+ destructiveHint: false,
184
+ idempotentHint: true,
185
+ openWorldHint: true,
186
+ },
187
+ }, async ({ address, limit, fingerprint, onlyConfirmed, onlyUnconfirmed, orderBy, minTimestamp, maxTimestamp, network = "mainnet", }) => {
188
+ try {
189
+ const result = await services.getAccountInternalTransactions(address, {
190
+ limit,
191
+ fingerprint,
192
+ onlyConfirmed,
193
+ onlyUnconfirmed,
194
+ orderBy,
195
+ minTimestamp,
196
+ maxTimestamp,
197
+ }, network);
198
+ return {
199
+ content: [{ type: "text", text: services.helpers.formatJson(result) }],
200
+ };
201
+ }
202
+ catch (error) {
203
+ return {
204
+ content: [
205
+ {
206
+ type: "text",
207
+ text: `Error fetching internal transactions: ${error instanceof Error ? error.message : String(error)}`,
208
+ },
209
+ ],
210
+ isError: true,
211
+ };
212
+ }
213
+ });
214
+ registerTool("get_account_trc20_balances", {
215
+ description: "Get all TRC20 token balances for an account from TronGrid indexed data. Returns only " +
216
+ "token contract addresses and raw balances — does NOT include token metadata (name, symbol, " +
217
+ "decimals). Use get_token_balance for detailed info on a specific token.",
218
+ inputSchema: {
219
+ address: z
220
+ .string()
221
+ .min(1)
222
+ .describe("Account address (base58 T-address or hex 41-prefixed)"),
223
+ onlyConfirmed: z.boolean().optional().describe("Only return confirmed data"),
224
+ network: z.string().optional().describe("Network name. Defaults to mainnet."),
225
+ },
226
+ annotations: {
227
+ title: "Get Account TRC20 Balances",
228
+ readOnlyHint: true,
229
+ destructiveHint: false,
230
+ idempotentHint: true,
231
+ openWorldHint: true,
232
+ },
233
+ }, async ({ address, onlyConfirmed, network = "mainnet" }) => {
234
+ try {
235
+ const result = await services.getAccountTrc20Balances(address, { onlyConfirmed }, network);
236
+ return {
237
+ content: [{ type: "text", text: services.helpers.formatJson(result) }],
238
+ };
239
+ }
240
+ catch (error) {
241
+ return {
242
+ content: [
243
+ {
244
+ type: "text",
245
+ text: `Error fetching TRC20 balances: ${error instanceof Error ? error.message : String(error)}`,
246
+ },
247
+ ],
248
+ isError: true,
249
+ };
250
+ }
251
+ });
252
+ }
253
+ //# sourceMappingURL=account-data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account-data.js","sourceRoot":"","sources":["../../../src/core/tools/account-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AAGjD,MAAM,UAAU,wBAAwB,CAAC,YAA4B;IACnE,YAAY,CACV,kBAAkB,EAClB;QACE,WAAW,EACT,2FAA2F;YAC3F,4FAA4F;YAC5F,gDAAgD;QAClD,WAAW,EAAE;YACX,OAAO,EAAE,CAAC;iBACP,MAAM,EAAE;iBACR,GAAG,CAAC,CAAC,CAAC;iBACN,QAAQ,CAAC,uDAAuD,CAAC;YACpE,aAAa,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;YAC5E,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;SAC9E;QACD,WAAW,EAAE;YACX,KAAK,EAAE,kBAAkB;YACzB,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,IAAI;SACpB;KACF,EACD,KAAK,E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E,aAAa,EAAE,EAAE,OAAO,CAAC,CAAC;YAC3F,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;aACvE,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,kCAAkC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;qBACjG;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { RegisterToolFn } from "./types.js";
2
+ export declare function registerAccountResourceTools(registerTool: RegisterToolFn): void;