PHP Classes

File: README.ru.md

Recommend this page to a friend!
  Classes of Jacob   TronZap SDK PHP   README.ru.md   Download  
File: README.ru.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: TronZap SDK PHP
Manage Tron energy resource using the TronZap API
Author: By
Last change:
Date: 24 days ago
Size: 4,852 bytes
 

Contents

Class file image Download

??????? ??????? Tron ?????? API

PHP SDK ?? TronZap.com

English | Español | Português | ???????

??????????? PHP SDK ??? API TronZap. ?????? SDK ????????? ????? ????????????? ??????? TronZap ??? ?????? ??????? TRON.

TronZap.com ????????? ???????? ??????? TRON, ??????????? ?????? ???????? ??? ????????? USDT (TRC20).

? ????????????????? ??? ????????? API ?????, ????? ?????? ???????????? TronZap API.

?????????

?????????? ????? ????? composer:

composer require tron-energy-market/tronzap-sdk-php

??????????

  • PHP 7.4 ??? ????
  • ?????????? php-json

?????????????

use TronZap\Client as TronZapClient;
use TronZap\Exception\TronZapException;

// ????????????? ???????
$apiToken = '???_api_token';
$apiSecret = '???_api_secret';
$client = new TronZapClient($apiToken, $apiSecret);

try {
    // ????????? ??????? ????????
    $balance = $client->getBalance();
    print_r($balance);

    // ????????? ???????
    $services = $client->getServices();
    print_r($services);

    // ?????? ?????????? ??????? ??? ???????? USDT
    $estimate = $client->estimateEnergy('FROM_TRX_ADDRESS', 'TO_TRX_ADDRESS', 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t');
    print_r($estimate);

    // ???????? ?????????? ?? ???????
    $transaction = $client->createEnergyTransaction(
        'TRX_ADDRESS',       // ????? ???????? TRON
        $estimate['energy'], // ?????????? ???????
        1,                   // ???????????? ????????????? (????), 1 ??? 24
        'my-tx-id',          // ??????? ID (???????????)
        true                 // ????????? ?????? (???????????)
    );
    print_r($transaction);

    // ???????? ??????? ??????????
    $status = $client->checkTransaction($transaction['id']);
    print_r($status);
} catch (TronZapException $e) {
    echo "??????: " . $e->getMessage() . " (???: " . $e->getCode() . ")\n";
}

????????? ??????

  • `getServices()` - ????????? ?????? ????????? ???????? ? ???
  • `getBalance()` - ????????? ???????? ??????? ????????
  • `createEnergyTransaction(address, energyAmount, duration, externalId, activateAddress)` - ???????? ?????????? ?? ??????? ???????
  • `createAddressActivationTransaction(address, externalId)` - ???????? ?????????? ??? ????????? ??????
  • `checkTransaction(transactionId)` - ???????? ??????? ??????????
  • `getDirectRechargeInfo()` - ????????? ?????????? ? ?????? ??????????

????????? ??????

SDK ?????????? ?????????? TronZapException ??? ??????? API. ???????? ???? ??????:

  • 1: ?????? ??????????????: ????????? API-????? ? ???????????? ???????.
  • 2: ???????????? ?????? ??? ?????????: ????????? ???????? ??????? ? ?????????.
  • 5: ?????????? ??????? ?? ??????: ?????????? ? ?????????.
  • 6: ???????????? ???????: ????????? ?????? ??? ????????? ????????????? ?????????? ???????.
  • 10: ???????????? ????? TRON: ????????? ?????? ?????? (34 ???????).
  • 11: ???????????? ?????????? ???????.
  • 12: ???????????? ????????????. ????????? ???????? 1 ??? 24 ????.
  • 20: ?????????? ?? ???????: ????????? ID ?????????? ??? ??????? ID.
  • 24: ????? ?? ???????????: ??????? ??????????? ?????.
  • 25: ????? ??? ???????????.
  • 500: Internal Server Error.

????????????

composer test

????????

MIT. ??????????? ? ????? ????????.

?????????

?? ???????? ????????? ??????????? ?? support@tronzap.com.