michaelstivala/omnipay-etherscan

Omnipay支付处理库的Etherscan驱动程序

1.8 2022-03-03 10:17 UTC

This package is auto-updated.

Last update: 2024-09-29 06:03:16 UTC


README

Etherscan.ioOmnipay PHP支付处理库的驱动程序。

安装

composer require financialplugins/omnipay-etherscan

使用

初始化

在使用其他方法之前,这一步是必须的。

$gateway = Omnipay::create('Etherscan');
   
$gateway->initialize([
    'api_key' => '...',
    'network' => 'main' // kovan or ropsten can also be used
]);

获取地址余额

$response = $gateway->fetchBalance(['address' => '0xAAAAAAAAAA...'])->send();

if ($response->isSuccessful()) {
    $data = $response->getData();
} else {
    $errorMessage = $response->getMessage();
}

获取合约(ERC20代币)地址余额

$response = $gateway->fetchTokenBalance([
    'address' => '0xAAAAAAAAAA...',
    'contract_address' => '0xAAAAAAAAAA...'
])->send();

if ($response->isSuccessful()) {
    $data = $response->getData();
} else {
    $errorMessage = $response->getMessage();
}

获取交易信息

$response = $gateway->fetchTransaction(['transactionReference' => '0xAAAAAAAAAA...'])->send();

if ($response->isSuccessful()) {
    $data = $response->getData();
} else {
    $errorMessage = $response->getMessage();
}

支持

如果您在使用Omnipay时遇到一般性问题,建议您在 Stack Overflow 上发帖。请确保添加 omnipay 标签,以便更容易找到。

如果您想了解发布公告、讨论项目想法或提出更详细的问题,您还可以订阅一个 邮件列表

如果您认为您发现了错误,请使用 GitHub问题跟踪器 报告,或者更好的方法是,分支库并提交一个pull request。