PHP code example of mrinte / web3-usdt-transfer
1. Go to this page and download the library: Download mrinte/web3-usdt-transfer library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mrinte / web3-usdt-transfer example snippets
use MrInte\Web3USDTTransfer;
// 这是向安智能链(BNB Chain) 代币BSC的USDT合约地址;
$data['contractAddress'] = '0x55d398326f99059fF775485246999027B3197955';
$data['contractABI'] = 'ABI的JSON字条串,内容太长,不便显示,下面补充!';
$data['PrivateKey'] = '转出账号的私钥';
$data['fromAccount'] = '转出账号';
$data['ToAddr'] = '接收账号';
$data['payAmount'] = 0.01; // 转账数额(数值)
$data['ChainUrl'] = 'https://bsc-dataseed1.binance.org'; // 网络 RPC URL
$data['chainId'] = 56; // 链 ID (数值)
$Transfer = new Web3USDTTransfer();
$USDTTransfer = $Transfer->USDTTransfer($data); // 返回交易哈希址地(USDTTransfer)字符串
use MrInte\Web3USDTTransfer;
// 交易详情对象和数组;
$ChainUrl = 'https://bsc-dataseed1.binance.org'; // 网络 RPC URL
$TransactionHash = '交易哈希字条串';
$Transfer = new Web3USDTTransfer();
$Transaction = $Transfer->getTransferStatus($ChainUrl,$TransactionHash); // 返回交易详情对象和数组