@bankofai/mcp-server-tron 1.1.3-beta.0 → 1.1.4
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/README.md +126 -79
- package/build/core/services/account-resource.d.ts +56 -0
- package/build/core/services/account-resource.js +133 -0
- package/build/core/services/account-resource.js.map +1 -0
- package/build/core/services/account.js.map +1 -1
- package/build/core/services/accountResource.js +1 -1
- package/build/core/services/accountResource.js.map +1 -1
- package/build/core/services/agent-wallet.d.ts +4 -2
- package/build/core/services/agent-wallet.js +27 -40
- package/build/core/services/agent-wallet.js.map +1 -1
- package/build/core/services/governance.js.map +1 -1
- package/build/core/services/index.d.ts +1 -1
- package/build/core/services/index.js +2 -2
- package/build/core/services/index.js.map +1 -1
- package/build/core/services/proposals.js.map +1 -1
- package/build/core/services/staking.js +2 -1
- package/build/core/services/staking.js.map +1 -1
- package/build/core/services/wallet.js +1 -2
- package/build/core/services/wallet.js.map +1 -1
- package/build/core/tools/account-resource.js +10 -6
- package/build/core/tools/account-resource.js.map +1 -1
- package/build/core/tools/broadcast.js +1 -1
- package/build/core/tools/broadcast.js.map +1 -1
- package/build/core/tools/contract.js +1 -1
- package/build/core/tools/contract.js.map +1 -1
- package/build/core/tools/staking.js +2 -2
- package/build/core/tools/staking.js.map +1 -1
- package/build/core/tools/transfer.js +2 -2
- package/build/core/tools/transfer.js.map +1 -1
- package/build/server/http-server.js +7 -8
- package/build/server/http-server.js.map +1 -1
- package/build/server/server.d.ts +3 -0
- package/build/server/server.js +4 -2
- package/build/server/server.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -69,6 +69,26 @@ Key capabilities:
|
|
|
69
69
|
- **Write Contract**: Execute state-changing functions.
|
|
70
70
|
- **ABI Fetching**: Automatically fetches ABI from the blockchain for verified contracts.
|
|
71
71
|
|
|
72
|
+
### Governance & Proposals
|
|
73
|
+
|
|
74
|
+
- **Super Representatives**: List, vote, create/update witnesses, manage brokerage.
|
|
75
|
+
- **Proposals**: List, view, create, approve, and delete governance proposals.
|
|
76
|
+
- **Rewards**: Query and withdraw SR voting rewards.
|
|
77
|
+
|
|
78
|
+
### Events & Data Queries
|
|
79
|
+
|
|
80
|
+
- **Contract Events**: Query events by transaction, contract address, or block number.
|
|
81
|
+
- **Account Data**: Transaction history, TRC20 transfers, internal transactions, token balances (via TronGrid).
|
|
82
|
+
- **Contract Data**: Contract transaction history, internal transactions, token holder lists.
|
|
83
|
+
- **Mempool**: View pending transactions and pool size.
|
|
84
|
+
- **Node Info**: List connected nodes and query node details.
|
|
85
|
+
|
|
86
|
+
### Staking & Resource Delegation (Stake 2.0)
|
|
87
|
+
|
|
88
|
+
- **Staking**: Freeze/unfreeze TRX for Energy or Bandwidth.
|
|
89
|
+
- **Delegation**: Delegate and undelegate resources to other accounts.
|
|
90
|
+
- **Queries**: Available unfreeze count, withdrawable amounts, delegation details.
|
|
91
|
+
|
|
72
92
|
### Wallet & Security
|
|
73
93
|
|
|
74
94
|
- **Agent-Wallet (Recommended)**: Encrypted key storage via agent-wallet SDK — private keys never leave the keystore.
|
|
@@ -91,7 +111,7 @@ Key capabilities:
|
|
|
91
111
|
|
|
92
112
|
```bash
|
|
93
113
|
# Clone the repository
|
|
94
|
-
git clone https://github.com/
|
|
114
|
+
git clone https://github.com/BofAI/mcp-server-tron.git
|
|
95
115
|
cd mcp-server-tron
|
|
96
116
|
|
|
97
117
|
# Install dependencies
|
|
@@ -121,31 +141,24 @@ Choose **one** of the following modes. If none is configured, the server runs in
|
|
|
121
141
|
|
|
122
142
|
**Option 1: Agent-Wallet Mode (Recommended)**
|
|
123
143
|
|
|
124
|
-
Private keys are encrypted at rest
|
|
144
|
+
Private keys are encrypted at rest and never exposed in environment variables.
|
|
125
145
|
|
|
126
|
-
|
|
127
|
-
# 1. Initialize wallet directory and set master password
|
|
128
|
-
npx agent-wallet init --dir ~/.agent-wallet
|
|
146
|
+
> **Prerequisites**: Install and configure [agent-wallet](https://github.com/BofAI/agent-wallet/blob/main/doc/getting-started.md)
|
|
129
147
|
|
|
130
|
-
|
|
131
|
-
npx agent-wallet add --dir ~/.agent-wallet
|
|
132
|
-
|
|
133
|
-
# 3. View wallet IDs and addresses
|
|
134
|
-
npx agent-wallet list --dir ~/.agent-wallet
|
|
135
|
-
|
|
136
|
-
# 4. Configure environment variables
|
|
137
|
-
export AGENT_WALLET_DIR=~/.agent-wallet
|
|
148
|
+
```bash
|
|
138
149
|
export AGENT_WALLET_PASSWORD="<YOUR_MASTER_PASSWORD>"
|
|
139
|
-
export
|
|
150
|
+
export AGENT_WALLET_DIR="<YOUR_WALLET_DIR>" # Optional, default: ~/.agent-wallet
|
|
140
151
|
```
|
|
141
152
|
|
|
142
|
-
|
|
153
|
+
> `AGENT_WALLET_PASSWORD` must match the master password used during `agent-wallet`. If not set, agent-wallet mode is disabled and the server falls back to legacy mode or read-only mode.
|
|
154
|
+
|
|
155
|
+
**Option 2: Private Key**
|
|
143
156
|
|
|
144
157
|
```bash
|
|
145
158
|
export TRON_PRIVATE_KEY="<YOUR_PRIVATE_KEY_HERE>"
|
|
146
159
|
```
|
|
147
160
|
|
|
148
|
-
**Option 3: Mnemonic Phrase
|
|
161
|
+
**Option 3: Mnemonic Phrase**
|
|
149
162
|
|
|
150
163
|
```bash
|
|
151
164
|
export TRON_MNEMONIC="<WORD1> <WORD2> ... <WORD12>"
|
|
@@ -154,6 +167,8 @@ export TRON_ACCOUNT_INDEX="0" # Optional, default: 0
|
|
|
154
167
|
|
|
155
168
|
> **Security Note**: Legacy modes store keys in plaintext environment variables. Agent-wallet mode is strongly recommended for production use.
|
|
156
169
|
|
|
170
|
+
> See [`.env.example`](.env.example) for a complete list of all supported environment variables.
|
|
171
|
+
|
|
157
172
|
### Server Configuration
|
|
158
173
|
|
|
159
174
|
The server runs on port **3001** by default in HTTP mode.
|
|
@@ -169,7 +184,7 @@ npm start
|
|
|
169
184
|
# Start in readonly mode (disables write tools)
|
|
170
185
|
npm start -- --readonly
|
|
171
186
|
|
|
172
|
-
# Start in HTTP mode (
|
|
187
|
+
# Start in HTTP mode (Streamable HTTP)
|
|
173
188
|
npm run start:http
|
|
174
189
|
```
|
|
175
190
|
|
|
@@ -184,65 +199,46 @@ npm test
|
|
|
184
199
|
# Unit tests (mocked services, no network)
|
|
185
200
|
npx vitest tests/core/tools.test.ts # All MCP tools registration & handlers
|
|
186
201
|
npx vitest tests/core/services/contracts.test.ts # Contract services
|
|
187
|
-
npx vitest tests/core/services/
|
|
202
|
+
npx vitest tests/core/services/account-resource.test.ts # Account resource services
|
|
188
203
|
npx vitest tests/core/services/staking.test.ts # Staking services
|
|
189
204
|
|
|
190
|
-
# Integration tests (real Nile RPC; write tests require TRON_PRIVATE_KEY)
|
|
205
|
+
# Integration tests (real Nile RPC; write tests require AGENT_WALLET_PASSWORD or TRON_PRIVATE_KEY)
|
|
191
206
|
npx vitest tests/core/tools_integration.test.ts # Full tool flow on Nile
|
|
192
207
|
npx vitest tests/core/services/multicall.test.ts # Multicall integration
|
|
193
208
|
npx vitest tests/core/services/services.test.ts # Services integration
|
|
194
209
|
```
|
|
195
210
|
|
|
196
211
|
- **Unit tests** use mocks and do not need network or wallet.
|
|
197
|
-
- **Integration tests** (`tools_integration.test.ts`) call Nile RPC; most cases are read-only. Tests that broadcast transactions (e.g. `vote_witness`, `withdraw_balance`) run only when a wallet is configured (
|
|
212
|
+
- **Integration tests** (`tools_integration.test.ts`) call Nile RPC; most cases are read-only. Tests that broadcast transactions (e.g. `vote_witness`, `withdraw_balance`) run only when a wallet is configured (`AGENT_WALLET_PASSWORD` or `TRON_PRIVATE_KEY`) and are skipped otherwise.
|
|
198
213
|
|
|
199
214
|
### Client Configuration
|
|
200
215
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
#### 1. Locate your Configuration File
|
|
216
|
+
#### Option A: Quick Start (Recommended)
|
|
204
217
|
|
|
205
|
-
|
|
206
|
-
| :--------------------- | :------ | :---------------------------------------------------------------- |
|
|
207
|
-
| **Claude Desktop** | macOS | `~/Library/Application Support/Claude/claude_desktop_config.json` |
|
|
208
|
-
| | Windows | `%APPDATA%\Claude\claude_desktop_config.json` |
|
|
209
|
-
| **Cursor** | All | Project root: `.cursor/mcp.json` |
|
|
210
|
-
| **Google Antigravity** | All | `~/.config/antigravity/mcp.json` |
|
|
211
|
-
| **Opencode** | All | `~/.config/opencode/mcp.json` |
|
|
218
|
+
Runs the latest version directly from npm via stdio transport.
|
|
212
219
|
|
|
213
|
-
|
|
220
|
+
**Claude Code:**
|
|
214
221
|
|
|
215
|
-
|
|
222
|
+
```bash
|
|
223
|
+
claude mcp add mcp-server-tron -- npx -y @bankofai/mcp-server-tron
|
|
224
|
+
```
|
|
216
225
|
|
|
217
|
-
|
|
218
|
-
Runs the latest version directly from npm.
|
|
226
|
+
With environment variables:
|
|
219
227
|
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
"mcpServers": {
|
|
223
|
-
"mcp-server-tron": {
|
|
224
|
-
"command": "npx",
|
|
225
|
-
"args": ["-y", "@bankofai/mcp-server-tron"],
|
|
226
|
-
"env": {
|
|
227
|
-
"TRON_PRIVATE_KEY": "YOUR_KEY_HERE (Or set in system env)",
|
|
228
|
-
"TRONGRID_API_KEY": "YOUR_KEY_HERE (Or set in system env)"
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
228
|
+
```bash
|
|
229
|
+
claude mcp add -e AGENT_WALLET_PASSWORD=xxx -e TRONGRID_API_KEY=xxx mcp-server-tron -- npx -y @bankofai/mcp-server-tron
|
|
233
230
|
```
|
|
234
231
|
|
|
235
|
-
**
|
|
236
|
-
For developers running from the cloned repository.
|
|
232
|
+
**Cursor** (`.cursor/mcp.json`):
|
|
237
233
|
|
|
238
234
|
```json
|
|
239
235
|
{
|
|
240
236
|
"mcpServers": {
|
|
241
237
|
"mcp-server-tron": {
|
|
242
238
|
"command": "npx",
|
|
243
|
-
"args": ["
|
|
239
|
+
"args": ["-y", "@bankofai/mcp-server-tron"],
|
|
244
240
|
"env": {
|
|
245
|
-
"
|
|
241
|
+
"AGENT_WALLET_PASSWORD": "YOUR_PASSWORD (Or set in system env)",
|
|
246
242
|
"TRONGRID_API_KEY": "YOUR_KEY_HERE (Or set in system env)"
|
|
247
243
|
}
|
|
248
244
|
}
|
|
@@ -250,48 +246,28 @@ For developers running from the cloned repository.
|
|
|
250
246
|
}
|
|
251
247
|
```
|
|
252
248
|
|
|
253
|
-
|
|
254
|
-
Connect to the official hosted server at `https://mcp-server.bankofai.io`. No installation required, readonly mode.
|
|
255
|
-
|
|
256
|
-
Claude Desktop / Cursor / Claude Code:
|
|
249
|
+
#### Option B: Official Hosted Server (Remote)
|
|
257
250
|
|
|
258
|
-
|
|
259
|
-
{
|
|
260
|
-
"mcpServers": {
|
|
261
|
-
"mcp-server-tron": {
|
|
262
|
-
"url": "https://mcp-server.bankofai.io/mcp"
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
```
|
|
251
|
+
Connect to the official hosted server at `https://tron-mcp-server.bankofai.io`. No installation required, readonly mode.
|
|
267
252
|
|
|
268
|
-
|
|
253
|
+
**Claude Code:**
|
|
269
254
|
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
"mcpServers": {
|
|
273
|
-
"mcp-server-tron": {
|
|
274
|
-
"serverUrl": "https://mcp-server.bankofai.io/mcp"
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
}
|
|
255
|
+
```bash
|
|
256
|
+
claude mcp add -transport http mcp-server-tron https://tron-mcp-server.bankofai.io/mcp
|
|
278
257
|
```
|
|
279
258
|
|
|
280
|
-
|
|
259
|
+
**Cursor** (`.cursor/mcp.json`):
|
|
281
260
|
|
|
282
261
|
```json
|
|
283
262
|
{
|
|
284
|
-
"
|
|
263
|
+
"mcpServers": {
|
|
285
264
|
"mcp-server-tron": {
|
|
286
|
-
"
|
|
287
|
-
"url": "https://mcp-server.bankofai.io/mcp"
|
|
265
|
+
"url": "https://tron-mcp-server.bankofai.io/mcp"
|
|
288
266
|
}
|
|
289
267
|
}
|
|
290
268
|
}
|
|
291
269
|
```
|
|
292
270
|
|
|
293
|
-
**Important**: We recommend omitting the `env` section if you have already set these variables in your system environment. If your MCP client doesn't inherit system variables, use placeholders or ensure the config file is not shared or committed to version control.
|
|
294
|
-
|
|
295
271
|
## API Reference
|
|
296
272
|
|
|
297
273
|
### Tools
|
|
@@ -301,6 +277,8 @@ Opencode:
|
|
|
301
277
|
| Tool Name | Description | Key Parameters |
|
|
302
278
|
| :------------------- | :-------------------------------------------------- | :------------- |
|
|
303
279
|
| `get_wallet_address` | Get the configured wallet's address (Base58 & Hex). | - |
|
|
280
|
+
| `list_wallets` | List all available wallets with IDs and addresses. | - |
|
|
281
|
+
| `select_wallet` | Switch the active wallet at runtime (agent-wallet mode). | `walletId` |
|
|
304
282
|
| `convert_address` | Convert between Hex and Base58 formats. | `address` |
|
|
305
283
|
|
|
306
284
|
#### Network & Resources
|
|
@@ -408,6 +386,73 @@ Opencode:
|
|
|
408
386
|
| `get_delegated_resource_v2` | Get delegation details between two addresses. | `fromAddress`, `toAddress`, `network` |
|
|
409
387
|
| `get_delegated_resource_account_index_v2`| Get who delegated to/from an address. | `address`, `network` |
|
|
410
388
|
|
|
389
|
+
#### Governance (Super Representatives)
|
|
390
|
+
|
|
391
|
+
| Tool Name | Description | Key Parameters |
|
|
392
|
+
| :------------------------- | :--------------------------------------------------------------- | :------------------------------ |
|
|
393
|
+
| `list_witnesses` | Get the full list of all Super Representatives on the network. | `network` |
|
|
394
|
+
| `get_paginated_witnesses` | Get a paginated list of current active Super Representatives. | `offset`, `limit`, `network` |
|
|
395
|
+
| `get_next_maintenance_time`| Get the next SR maintenance (vote tally) time. | `network` |
|
|
396
|
+
| `get_reward` | Get unclaimed SR voting reward for an address. | `address`, `network` |
|
|
397
|
+
| `get_brokerage` | Get SR brokerage ratio (reward split with voters). | `address`, `network` |
|
|
398
|
+
| `create_witness` | Apply to become a Super Representative candidate. | `url`, `network` |
|
|
399
|
+
| `update_witness` | Update Super Representative URL. | `url`, `network` |
|
|
400
|
+
| `vote_witness` | Vote for Super Representatives with frozen TRX. | `votes`, `network` |
|
|
401
|
+
| `withdraw_balance` | Withdraw accumulated SR block rewards. | `network` |
|
|
402
|
+
| `update_brokerage` | Update SR brokerage ratio. | `brokerage`, `network` |
|
|
403
|
+
|
|
404
|
+
#### Proposals
|
|
405
|
+
|
|
406
|
+
| Tool Name | Description | Key Parameters |
|
|
407
|
+
| :----------------- | :------------------------------------------ | :------------------------------------- |
|
|
408
|
+
| `list_proposals` | List all network governance proposals. | `network` |
|
|
409
|
+
| `get_proposal` | Get details of a specific proposal by ID. | `proposalId`, `network` |
|
|
410
|
+
| `create_proposal` | Create a new governance proposal (SR only). | `parameters`, `network` |
|
|
411
|
+
| `approve_proposal` | Approve or revoke a proposal (SR only). | `proposalId`, `hasApproval`, `network` |
|
|
412
|
+
| `delete_proposal` | Delete a proposal (creator only). | `proposalId`, `network` |
|
|
413
|
+
|
|
414
|
+
#### Events
|
|
415
|
+
|
|
416
|
+
| Tool Name | Description | Key Parameters |
|
|
417
|
+
| :------------------------------ | :---------------------------------------------------- | :--------------------------------------- |
|
|
418
|
+
| `get_events_by_transaction_id` | Get all events emitted by a specific transaction. | `transactionId`, `onlyConfirmed`, `network` |
|
|
419
|
+
| `get_events_by_contract_address`| Get events emitted by a specific contract. | `contractAddress`, `eventName`, `network` |
|
|
420
|
+
| `get_events_by_block_number` | Get all events emitted in a specific block. | `blockNumber`, `network` |
|
|
421
|
+
| `get_events_of_latest_block` | Get all events from the latest block. | `network` |
|
|
422
|
+
|
|
423
|
+
#### Account Data (TronGrid)
|
|
424
|
+
|
|
425
|
+
| Tool Name | Description | Key Parameters |
|
|
426
|
+
| :--------------------------------- | :----------------------------------------------------- | :------------------------------------- |
|
|
427
|
+
| `get_account_info` | Get account summary from TronGrid. | `address`, `network` |
|
|
428
|
+
| `get_account_transactions` | Get transaction history for an account. | `address`, `limit`, `network` |
|
|
429
|
+
| `get_account_trc20_transactions` | Get TRC20 transfer history for an account. | `address`, `limit`, `network` |
|
|
430
|
+
| `get_account_internal_transactions`| Get internal transaction history for an account. | `address`, `limit`, `network` |
|
|
431
|
+
| `get_account_trc20_balances` | Get all TRC20 token balances for an account. | `address`, `network` |
|
|
432
|
+
|
|
433
|
+
#### Contract Data (TronGrid)
|
|
434
|
+
|
|
435
|
+
| Tool Name | Description | Key Parameters |
|
|
436
|
+
| :--------------------------------- | :---------------------------------------------------- | :------------------------------------- |
|
|
437
|
+
| `get_contract_transactions` | Get transaction history for a contract. | `contractAddress`, `limit`, `network` |
|
|
438
|
+
| `get_contract_internal_transactions`| Get internal transactions for a contract. | `contractAddress`, `limit`, `network` |
|
|
439
|
+
| `get_trc20_token_holders` | Get holder list for a TRC20 token. | `contractAddress`, `limit`, `network` |
|
|
440
|
+
|
|
441
|
+
#### Mempool
|
|
442
|
+
|
|
443
|
+
| Tool Name | Description | Key Parameters |
|
|
444
|
+
| :------------------------------ | :------------------------------------------------------- | :-------------------- |
|
|
445
|
+
| `get_pending_transactions` | Get transaction IDs in the pending pool (mempool). | `network` |
|
|
446
|
+
| `get_transaction_from_pending` | Get a specific transaction from the pending pool. | `txId`, `network` |
|
|
447
|
+
| `get_pending_size` | Get the current size of the pending transaction pool. | `network` |
|
|
448
|
+
|
|
449
|
+
#### Node
|
|
450
|
+
|
|
451
|
+
| Tool Name | Description | Key Parameters |
|
|
452
|
+
| :------------- | :---------------------------------------------------- | :------------- |
|
|
453
|
+
| `list_nodes` | List all connected node addresses on the network. | `network` |
|
|
454
|
+
| `get_node_info`| Get detailed info about the connected full node. | `network` |
|
|
455
|
+
|
|
411
456
|
#### Signing & Security
|
|
412
457
|
|
|
413
458
|
| Tool Name | Description | Key Parameters |
|
|
@@ -417,7 +462,9 @@ Opencode:
|
|
|
417
462
|
### Prompts
|
|
418
463
|
|
|
419
464
|
- `prepare_transfer`: Interactive guide to prepare TRX/TRC20 transfers.
|
|
465
|
+
- `interact_with_contract`: Step-by-step guide to interact with a smart contract.
|
|
420
466
|
- `diagnose_transaction`: Analyze a transaction hash for status and errors.
|
|
467
|
+
- `explain_tron_concept`: Explain a TRON blockchain concept with examples.
|
|
421
468
|
- `analyze_wallet`: Comprehensive report of wallet assets.
|
|
422
469
|
- `check_network_status`: Report on network health and resource costs.
|
|
423
470
|
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delegate staked resources (BANDWIDTH or ENERGY) to another address.
|
|
3
|
+
* Wraps TronWeb's transactionBuilder.delegateResource.
|
|
4
|
+
*/
|
|
5
|
+
export declare function delegateResource(params: {
|
|
6
|
+
amount: number;
|
|
7
|
+
receiverAddress: string;
|
|
8
|
+
resource: "BANDWIDTH" | "ENERGY";
|
|
9
|
+
lock?: boolean;
|
|
10
|
+
lockPeriod?: number;
|
|
11
|
+
}, network?: string): Promise<string>;
|
|
12
|
+
/**
|
|
13
|
+
* Revoke delegated resources (BANDWIDTH or ENERGY) from a receiver address.
|
|
14
|
+
* Wraps TronWeb's transactionBuilder.undelegateResource.
|
|
15
|
+
*/
|
|
16
|
+
export declare function undelegateResource(params: {
|
|
17
|
+
amount: number;
|
|
18
|
+
receiverAddress: string;
|
|
19
|
+
resource: "BANDWIDTH" | "ENERGY";
|
|
20
|
+
}, network?: string): Promise<string>;
|
|
21
|
+
/**
|
|
22
|
+
* Get the maximum amount of resources that can currently be delegated by an address.
|
|
23
|
+
* Wraps TronWeb's trx.getCanDelegatedMaxSize / walletsolidity.getcandelegatedmaxsize.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getCanDelegatedMaxSize(address: string, resource: "BANDWIDTH" | "ENERGY", network?: string): Promise<{
|
|
26
|
+
address: string;
|
|
27
|
+
resource: "BANDWIDTH" | "ENERGY";
|
|
28
|
+
maxSizeSun: bigint;
|
|
29
|
+
}>;
|
|
30
|
+
/**
|
|
31
|
+
* Get delegated resource details between two addresses under Stake 2.0.
|
|
32
|
+
* Wraps TronWeb's trx.getDelegatedResourceV2 / wallet.getdelegatedresourcev2.
|
|
33
|
+
*/
|
|
34
|
+
export declare function getDelegatedResourceV2(fromAddress: string, toAddress: string, network?: string): Promise<{
|
|
35
|
+
from: string;
|
|
36
|
+
to: string;
|
|
37
|
+
delegatedResource: {
|
|
38
|
+
from: any;
|
|
39
|
+
to: any;
|
|
40
|
+
frozenBalanceForBandwidthSun: string;
|
|
41
|
+
frozenBalanceForEnergySun: string;
|
|
42
|
+
expireTimeForBandwidth: any;
|
|
43
|
+
expireTimeForEnergy: any;
|
|
44
|
+
}[];
|
|
45
|
+
raw: any;
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* Get delegated resource account index for an address under Stake 2.0.
|
|
49
|
+
* Wraps walletsolidity.getdelegatedresourceaccountindexv2.
|
|
50
|
+
*/
|
|
51
|
+
export declare function getDelegatedResourceAccountIndexV2(address: string, network?: string): Promise<{
|
|
52
|
+
account: any;
|
|
53
|
+
fromAccounts: any;
|
|
54
|
+
toAccounts: any;
|
|
55
|
+
raw: unknown;
|
|
56
|
+
}>;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { getTronWeb } from "./clients.js";
|
|
2
|
+
import { getOwnerAddress, buildSignBroadcast } from "./agent-wallet.js";
|
|
3
|
+
/**
|
|
4
|
+
* Delegate staked resources (BANDWIDTH or ENERGY) to another address.
|
|
5
|
+
* Wraps TronWeb's transactionBuilder.delegateResource.
|
|
6
|
+
*/
|
|
7
|
+
export async function delegateResource(params, network = "mainnet") {
|
|
8
|
+
const tronWeb = getTronWeb(network);
|
|
9
|
+
const ownerAddress = await getOwnerAddress();
|
|
10
|
+
try {
|
|
11
|
+
const { amount, receiverAddress, resource, lock = false, lockPeriod = 0 } = params;
|
|
12
|
+
const tx = await tronWeb.transactionBuilder.delegateResource(amount, receiverAddress, resource, ownerAddress, lock, lockPeriod, {});
|
|
13
|
+
return await buildSignBroadcast(tx, network);
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
throw new Error(`Failed to delegate resource: ${error.message}`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Revoke delegated resources (BANDWIDTH or ENERGY) from a receiver address.
|
|
21
|
+
* Wraps TronWeb's transactionBuilder.undelegateResource.
|
|
22
|
+
*/
|
|
23
|
+
export async function undelegateResource(params, network = "mainnet") {
|
|
24
|
+
const tronWeb = getTronWeb(network);
|
|
25
|
+
const ownerAddress = await getOwnerAddress();
|
|
26
|
+
try {
|
|
27
|
+
const { amount, receiverAddress, resource } = params;
|
|
28
|
+
const tx = await tronWeb.transactionBuilder.undelegateResource(amount, receiverAddress, resource, ownerAddress, {});
|
|
29
|
+
return await buildSignBroadcast(tx, network);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
throw new Error(`Failed to undelegate resource: ${error.message}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Get the maximum amount of resources that can currently be delegated by an address.
|
|
37
|
+
* Wraps TronWeb's trx.getCanDelegatedMaxSize / walletsolidity.getcandelegatedmaxsize.
|
|
38
|
+
*/
|
|
39
|
+
export async function getCanDelegatedMaxSize(address, resource, network = "mainnet") {
|
|
40
|
+
const tronWeb = getTronWeb(network);
|
|
41
|
+
try {
|
|
42
|
+
// Prefer TronWeb helper if available
|
|
43
|
+
const type = resource === "ENERGY" ? 1 : 0;
|
|
44
|
+
// tronWeb.trx.getCanDelegatedMaxSize(address, resourceType)
|
|
45
|
+
const res = typeof tronWeb.trx.getCanDelegatedMaxSize === "function"
|
|
46
|
+
? await tronWeb.trx.getCanDelegatedMaxSize(address, resource)
|
|
47
|
+
: await tronWeb.fullNode.request("wallet/getcandelegatedmaxsize", {
|
|
48
|
+
owner_address: tronWeb.address.toHex(address),
|
|
49
|
+
type,
|
|
50
|
+
visible: false,
|
|
51
|
+
}, "post");
|
|
52
|
+
const raw = res?.max_size;
|
|
53
|
+
if (raw === undefined || (typeof raw !== "number" && typeof raw !== "string")) {
|
|
54
|
+
throw new Error(`Unexpected response from getCanDelegatedMaxSize: ${JSON.stringify(res)}`);
|
|
55
|
+
}
|
|
56
|
+
const maxSizeSun = BigInt(raw);
|
|
57
|
+
return {
|
|
58
|
+
address,
|
|
59
|
+
resource,
|
|
60
|
+
maxSizeSun,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
throw new Error(`Failed to get can delegated max size: ${error.message}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Get delegated resource details between two addresses under Stake 2.0.
|
|
69
|
+
* Wraps TronWeb's trx.getDelegatedResourceV2 / wallet.getdelegatedresourcev2.
|
|
70
|
+
*/
|
|
71
|
+
export async function getDelegatedResourceV2(fromAddress, toAddress, network = "mainnet") {
|
|
72
|
+
const tronWeb = getTronWeb(network);
|
|
73
|
+
try {
|
|
74
|
+
const res = typeof tronWeb.trx.getDelegatedResourceV2 === "function"
|
|
75
|
+
? await tronWeb.trx.getDelegatedResourceV2(fromAddress, toAddress, {
|
|
76
|
+
confirmed: true,
|
|
77
|
+
})
|
|
78
|
+
: await tronWeb.fullNode.request("wallet/getdelegatedresourcev2", {
|
|
79
|
+
fromAddress: tronWeb.address.toHex(fromAddress),
|
|
80
|
+
toAddress: tronWeb.address.toHex(toAddress),
|
|
81
|
+
visible: false,
|
|
82
|
+
}, "post");
|
|
83
|
+
const delegated = res?.delegatedResource || (Array.isArray(res) ? res : []);
|
|
84
|
+
// Normalize numeric fields to BigInt/string form for safety
|
|
85
|
+
const normalized = delegated.map((item) => {
|
|
86
|
+
const bandwidth = item.frozen_balance_for_bandwidth ?? 0;
|
|
87
|
+
const energy = item.frozen_balance_for_energy ?? 0;
|
|
88
|
+
return {
|
|
89
|
+
from: item.from || fromAddress,
|
|
90
|
+
to: item.to || toAddress,
|
|
91
|
+
frozenBalanceForBandwidthSun: BigInt(bandwidth).toString(),
|
|
92
|
+
frozenBalanceForEnergySun: BigInt(energy).toString(),
|
|
93
|
+
expireTimeForBandwidth: item.expire_time_for_bandwidth ?? 0,
|
|
94
|
+
expireTimeForEnergy: item.expire_time_for_energy ?? 0,
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
return {
|
|
98
|
+
from: fromAddress,
|
|
99
|
+
to: toAddress,
|
|
100
|
+
delegatedResource: normalized,
|
|
101
|
+
raw: res,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
throw new Error(`Failed to get delegated resource v2: ${error.message}`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Get delegated resource account index for an address under Stake 2.0.
|
|
110
|
+
* Wraps walletsolidity.getdelegatedresourceaccountindexv2.
|
|
111
|
+
*/
|
|
112
|
+
export async function getDelegatedResourceAccountIndexV2(address, network = "mainnet") {
|
|
113
|
+
const tronWeb = getTronWeb(network);
|
|
114
|
+
try {
|
|
115
|
+
const res = await tronWeb.fullNode.request("wallet/getdelegatedresourceaccountindexv2", {
|
|
116
|
+
value: tronWeb.address.toHex(address),
|
|
117
|
+
visible: false,
|
|
118
|
+
}, "post");
|
|
119
|
+
const account = res?.account ?? address;
|
|
120
|
+
const fromAccounts = res?.fromAccounts ?? [];
|
|
121
|
+
const toAccounts = res?.toAccounts ?? [];
|
|
122
|
+
return {
|
|
123
|
+
account,
|
|
124
|
+
fromAccounts,
|
|
125
|
+
toAccounts,
|
|
126
|
+
raw: res,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
throw new Error(`Failed to get delegated resource account index v2: ${error.message}`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=account-resource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-resource.js","sourceRoot":"","sources":["../../../src/core/services/account-resource.ts"],"names":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,eAAe,EAAE,CAAC;IAE7C,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,kBAAkB,CAAC,wBAAwB,CAC3E,YAAY,EACZ,eAAsB,EACtB,iBAAwB,EACxB,iBAAwB,CACzB,CAAC;QACF,OAAO,MAAM,kBAAkB,CAAC,WAAkB,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,yCAAyC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5E,CAAC;AACH,CAAC"}
|
|
@@ -8,7 +8,7 @@ export async function delegateResource(params, network = "mainnet") {
|
|
|
8
8
|
const tronWeb = getTronWeb(network);
|
|
9
9
|
const ownerAddress = await getOwnerAddress();
|
|
10
10
|
try {
|
|
11
|
-
const { amount, receiverAddress, resource, lock = false, lockPeriod = 0
|
|
11
|
+
const { amount, receiverAddress, resource, lock = false, lockPeriod = 0 } = params;
|
|
12
12
|
const tx = await tronWeb.transactionBuilder.delegateResource(amount, receiverAddress, resource, ownerAddress, lock, lockPeriod, {});
|
|
13
13
|
return await buildSignBroadcast(tx, network);
|
|
14
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accountResource.js","sourceRoot":"","sources":["../../../src/core/services/accountResource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAExE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAMC,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,
|
|
1
|
+
{"version":3,"file":"accountResource.js","sourceRoot":"","sources":["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C;IACJ,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,sDAAsD,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IACzF,CAAC;AACH,CAAC"}
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
* Priority: agent-wallet env vars take precedence over legacy env vars.
|
|
9
9
|
*/
|
|
10
10
|
import { type BaseWallet } from "@bankofai/agent-wallet";
|
|
11
|
-
/** True when agent-wallet
|
|
11
|
+
/** True when agent-wallet is configured (password is required). */
|
|
12
12
|
export declare function isAgentWalletConfigured(): boolean;
|
|
13
13
|
/** True when legacy TRON_PRIVATE_KEY / TRON_MNEMONIC env vars are set. */
|
|
14
14
|
export declare function isLegacyMode(): boolean;
|
|
15
15
|
/**
|
|
16
16
|
* Get the currently active agent-wallet. Lazily initializes provider and
|
|
17
|
-
*
|
|
17
|
+
* uses the active wallet from agent-wallet config (or first available wallet).
|
|
18
18
|
*/
|
|
19
19
|
export declare function getActiveWallet(): Promise<BaseWallet>;
|
|
20
20
|
/**
|
|
@@ -23,6 +23,7 @@ export declare function getActiveWallet(): Promise<BaseWallet>;
|
|
|
23
23
|
export declare function getOwnerAddress(): Promise<string>;
|
|
24
24
|
/**
|
|
25
25
|
* Switch the active wallet at runtime (agent-wallet mode only).
|
|
26
|
+
* Persists the choice to agent-wallet config.
|
|
26
27
|
*/
|
|
27
28
|
export declare function selectWallet(walletId: string): Promise<{
|
|
28
29
|
id: string;
|
|
@@ -38,6 +39,7 @@ export declare function listAgentWallets(): Promise<Array<{
|
|
|
38
39
|
}>>;
|
|
39
40
|
/**
|
|
40
41
|
* Get the currently active wallet ID.
|
|
42
|
+
* Reads from agent-wallet config's `active_wallet` field.
|
|
41
43
|
*/
|
|
42
44
|
export declare function getActiveWalletId(): string | null;
|
|
43
45
|
/**
|