1. Go to this page and download the library: Download yukazakiri/lepton-agent 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/ */
yukazakiri / lepton-agent example snippets
use Yukazakiri\Lepton\Contracts\AuthGateway;
$auth = app(AuthGateway::class);
$status = $auth->authStatus();
$status['testnet']['authenticated']; // bool
$status['mainnet']['expires_in']; // "26d 6h 52m"
// Guard an operation that needs a session.
if (! $auth->isAuthenticatedFor('ARC-TESTNET')) {
throw new RuntimeException('Log in before transferring on testnet.');
}
// Drive the flow programmatically. The OTP still comes from a human inbox.
$requestId = $auth->beginLogin('[email protected]');
// ... later, after the code arrives ...
$auth->completeLogin($requestId, 'B1X-123456');
$address = config('lepton.arc.treasury');
use Yukazakiri\Lepton\Contracts\WalletGateway;
use Yukazakiri\Lepton\Support\Amounts;
$result = app(WalletGateway::class)->transfer(
from: '0xTreasury',
to: '0xRecipient',
amountBaseUnits: Amounts::fromDecimalString('450.00'), // 450_000000
options: ['chain' => 'ARC-TESTNET'],
);
$result->txHash; // 0x…
$result->explorerUrl; // https://testnet.arcscan.app/tx/0x…
$result->isFake; // false under the circle driver
use Yukazakiri\Lepton\Facades\Lepton;
Lepton::transferDecimal('0xTreasury', '0xRecipient', '450.00');
// Estimate the fee without moving money.
$result = $wallets->transfer($from, $to, $units, ['estimate' => true]);
// Or set LEPTON_DRY_RUN=true globally.