|
2 | 2 |
|
3 | 3 | ## 概述
|
4 | 4 |
|
5 |
| -波场开发包目前支持波场的 TRX 和 TRC20 中生成地址,发起转账,离线签名等功能。正在持续更新,将会支持更多的功能,已修复[iexbase/tron-api](https://github.com/iexbase/tron-api)中的不少bug,将会持续维护。 |
| 5 | +波场开发包目前支持波场的 TRX 和 TRC20 中生成地址,发起转账,离线签名,资源代理和收回等功能。正在持续更新,将会支持更多的功能,已修复[iexbase/tron-api](https://github.com/iexbase/tron-api)中的不少bug,将会持续维护。 |
6 | 6 |
|
7 | 7 | ## 特点
|
8 | 8 |
|
9 | 9 | 1. 方法调用快捷方便
|
10 | 10 | 1. 兼容 TRON 网络中 TRX 货币和 TRC 系列所有通证
|
| 11 | +1. 支持最新的质押2.0中的资源代理和资源回收 |
11 | 12 | 1. 接口可灵活增减
|
12 | 13 | 1. 速度迅速 算法经过专门优化
|
13 | 14 | 1. 持续更新 始终跟进波场新功能
|
|
22 | 23 | - 查询最新区块 `blockNumber()`
|
23 | 24 | - 根据区块链查询信息 `blockByNumber(int $blockID)`
|
24 | 25 | - 根据交易哈希查询信息 `transactionReceipt(string $txHash)`
|
| 26 | +- 资源代理`delegate(Address $from, Address $to, float $amount,string $resource = 'ENERGY', $lock=false,$lock_period=0)` |
| 27 | +- 资源收回`undelegate(Address $from,Address $to, float $amount,string $resource = 'ENERGY')` |
25 | 28 |
|
26 | 29 | ## 快速开始
|
27 | 30 |
|
@@ -70,11 +73,28 @@ $trx = $trxWallet->balance($fromAddr);//获取trx余额
|
70 | 73 | $transferData = $trxWallet->transfer($fromAddr,$toAddr,1); //转账1trx
|
71 | 74 | ```
|
72 | 75 |
|
| 76 | +[Delegate.php](./examples/Delegate.php) |
| 77 | + |
| 78 | +```php |
| 79 | +//以下全部为质押2.0接口 |
| 80 | +$trxWallet->delegate($fromAddr,$toAddr,1);//代理1trx产生的能量 |
| 81 | +$trxWallet->undelegate($fromAddr,$toAddr,1);//收回1trx产生的能量 |
| 82 | +$trxWallet->delegate($fromAddr,$toAddr,1,"BANDWITH");//代理1trx产生的带宽 |
| 83 | +$trxWallet->undelegate($fromAddr,$toAddr,"BANDWITH");//收回1trx产生的带宽 |
| 84 | +$trxWallet->delegate($fromAddr,$toAddr,1,"ENERGY",true,1200);//代理1trx产生的能量,锁定期1小时,单位为3秒 |
| 85 | +$trxWallet->tron->getdelegatedresourceaccountindexv2($fromAddr->address);//获取全部已经代理的资源 |
| 86 | +``` |
| 87 | + |
73 | 88 |
|
74 | 89 |
|
75 | 90 | ## 感谢
|
76 | 91 |
|
77 | 92 | | 开发者名称 | 描述 | 应用场景 |
|
78 | 93 | | :-----| :---- | :---- |
|
79 | 94 | | [iexbase/tron-api](https://github.com/iexbase/tron-api) | 波场官方文档推荐 PHP 扩展包 | 波场基础Api |
|
80 |
| -| [Fenguoz](https://github.com/Fenguoz/) | 波场PHP 实现 | 波场基础Api | |
| 95 | +| [Fenguoz](https://github.com/Fenguoz/) | 波场PHP 实现 | 波场基础Api | |
| 96 | +| [ufado/tron-api](https://github.com/ufado/tron-api) | 基于iexbase的自行维护扩展包 | 波场基础Api | |
| 97 | + |
| 98 | +## 联系 |
| 99 | + |
| 100 | +Https://t.me/ufado_bot |
0 commit comments