westwallet / westwallet-php-api
WestWallet API 库
v1.8.3
2023-06-16 21:26 UTC
Requires
- php: >=5.6.0
README
westwallet-php-api 是 PHP 编程语言的 WestWallet 公共 API 包装器。用于构建支付解决方案。
安装
通过 composer 安装
composer require westwallet/westwallet-php-api
创建提款示例
<?php require_once 'vendor/autoload.php'; use WestWallet\WestWallet\Client; use WestWallet\WestWallet\InsufficientFundsException; $client = new Client("your_public_key", "your_private_key"); // Send 0.1 ETH to 0x57689002367b407f031f1BB5Ef2923F103015A32 try { $tx = $client->createWithdrawal("ETH", "0.1", "0x57689002367b407f031f1BB5Ef2923F103015A32"); print(implode("|", $tx)."\n"); } catch(InsufficientFundsException $e) { print("You don't have enough funds to make this withdrawal"."\n"); }
生成地址示例
<?php require_once 'vendor/autoload.php'; use WestWallet\WestWallet\Client; use WestWallet\WestWallet\CurrencyNotFoundException; $client = new Client("your_public_key", "your_private_key"); // Send 0.1 ETH to 0x57689002367b407f031f1BB5Ef2923F103015A32 try { $address = $client->generateAddress("BTC"); print($address['address'])."\n"); } catch(CurrencyNotFoundException $e) { print("This currency doesn't exist!"."\n"); }