use CryptoChief\Processing\Contract\Borsh;
use CryptoChief\Processing\Dto\AnchorCallRequest;
use CryptoChief\Processing\Dto\SolanaAccount;
$client->transactions()->signAnchorCall(new AnchorCallRequest(
network: Chain::SolanaMainnet->value,
fromAddress: 'YourMerchantOwnedSolanaWallet',
program: 'YourAnchorProgramId',
method: 'initialize',
args: [
Borsh::u64(1_000_000),
Borsh::string('hello'),
],
accounts: [
new SolanaAccount(pubkey: $from, isSigner: true, isWritable: true),
],
));
use CryptoChief\Processing\Amount;
use CryptoChief\Processing\Chain;
use CryptoChief\Processing\Dto\JettonTransferRequest;
use CryptoChief\Processing\Dto\NftTransferRequest;
use CryptoChief\Processing\Dto\TonCommentRequest;
// USDT on TON — auto-resolves the sender's jetton wallet, picks gas (0.07 or 0.15 TON).
$client->transactions()->jettonTransfer(new JettonTransferRequest(
network: Chain::TonMainnet->value,
fromAddress: 'EQYourTonWallet...',
recipient: 'EQRecipientMainWallet...',
amount: Amount::humanToBase('1.5', 6), // 1.5 USDT
jettonMaster: 'EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs', // USDT jetton master
memo: 'invoice #1234', // shown by every wallet
));
// NFT transfer (TEP-62)
$client->transactions()->nftTransfer(new NftTransferRequest(
network: Chain::TonMainnet->value,
fromAddress: 'EQYourTonWallet...',
nftItem: 'EQNftItemAddress...',
newOwner: 'EQNewOwnerAddress...',
));
// Send TON with a text comment
$client->transactions()->sendTonComment(new TonCommentRequest(
network: Chain::TonMainnet->value,
fromAddress: 'EQYourTonWallet...',
recipient: 'EQRecipient...',
text: 'thanks!',
amountTon: Amount::nanoTon('0.5'),
));
use CryptoChief\Processing\ChainFamily;
use CryptoChief\Processing\Dto\GenerateWalletRequest;
$client = new Client(
merchantId: 'M',
apiKey: 'K',
rsaPrivateKey: '/path/to/private.pem', // PEM string or path
);
$wallet = $client->wallets()->generate(new GenerateWalletRequest(
walletType: 'transit',
chainFamily: ChainFamily::Evm->value,
));
if ($wallet->privateKeyEncrypted !== null) {
// Decryption is local - the plaintext private key never leaves the process.
$key = $client->wallets()->decryptPrivateKey($wallet->privateKeyEncrypted);
}
use CryptoChief\Processing\Exception\WebhookSignatureException;
use CryptoChief\Processing\Webhook;
use CryptoChief\Processing\Webhook\PayoutEvent;
$raw = file_get_contents('php://input') ?: ''; // raw bytes - never re-encode
$signature = $_SERVER['HTTP_SIGNATURE'] ?? null;
try {
$event = Webhook::parseEvent($apiKey, $raw, $signature);
} catch (WebhookSignatureException) {
http_response_code(401);
return;
}
if ($event instanceof PayoutEvent) {
// typed access: $event->uuid, $event->status, $event->amountToReceive, ...
}
use CryptoChief\Processing\ErrorCode;
use CryptoChief\Processing\Exception\ApiException;
try {
$client->payouts()->execute($req);
} catch (ApiException $e) {
if ($e->errorCode === ErrorCode::InsufficientFunds->value) {
// top up and retry
}
}
$credits = $client->credits()->balance();
echo "USD balance: {$credits->usdBalance}\n"; // pre-formatted, e.g. "-1.52" in postpaid debt
if (!$credits->canExecuteGasOperations) {
// top up before /v1/transaction/execute, sweeps, service-fee payouts, ...
}
use CryptoChief\Processing\Dto\CreditsTopupRequest;
$invoice = $client->credits()->topup(new CreditsTopupRequest(
amount: '250.00',
currency: 'USDT',
urlSuccess: 'https://example.com/billing/ok', // optional browser redirects
urlError: 'https://example.com/billing/fail',
));
echo "Pay at: {$invoice->paymentLink}\n"; // status starts as "pending"