021 / crypto-wallets
用于处理加密钱包的包
Requires
- php: ^8.1
- ext-bcmath: *
- 021/ethereum-oracles: ^1.0
- 021/support: ^2.0.1
- denpa/php-bitcoinrpc: ^v3.0.0
- guzzlehttp/guzzle: ^7.4
- illuminate/support: ^8.80|^9.0
- jaggedsoft/php-binance-api: ^0.5.28
- web3p/web3.php: 0.1.6
Requires (Dev)
- phpunit/phpunit: ^9.5
- symfony/var-dumper: ^5.4
- vlucas/phpdotenv: ^5.4
- dev-master
- v9.1.0
- v9.0.1
- v9.0.0
- v8.2.3
- v8.2.2
- v8.2.1
- v8.2.0
- v8.1.0
- v8.0.4
- v8.0.3
- v8.0.2
- v8.0.1
- v8.0.0
- v7.0.0
- v6.1.1
- v6.1.0
- v6.0.0
- v5.x-dev
- v5.5.2
- v5.5.1
- v5.5.0
- v5.4.0
- v5.3.0
- v5.2.0
- v5.1.2
- v5.1.1
- v5.1.0
- v5.0.0
- v4.x-dev
- v4.0.0
- v3.2.1
- v3.2.0
- v3.1.0
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0.0
- v2.x-dev
- v2.1.1
- v2.1.0
- v2.0.0
- v1.x-dev
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.0
This package is auto-updated.
Last update: 2024-08-30 01:12:04 UTC
README
运行 composer require 021/crypto-wallets
将仓库添加到 composer.json
"repositories": [
{
"type": "vcs",
"url": "git@github.com:021-projects/php-bitcoinrpc.git"
}
]
需求
- PHP 8.1+
钱包接口
\O21\CryptoWallets\Interfaces\WalletInterface
__construct(\O21\CryptoWallets\Interfaces\ConnectConfigInterface $config)
isAvailable(): bool
- 检查 RPC 客户端是否可用
getBalance(): string
- 获取钱包余额
getNewAddress($config = null): string
- 获取新地址
isValidAddress(string $address): bool
- 检查地址是否有效
isOwningAddress(string $address): bool
- 检查地址是否属于钱包
getExploreAddressLink(string $address): string
- 返回地址的区块链浏览器链接
getRate(
string $currency = 'USD',
?\O21\CryptoWallets\Interfaces\RateProviderInterface $provider = null
): float
// Returns the cryptocurrency exchange rate for the selected currency
getBestRate(
string $currency = 'USD',
int $limit = 60,
\O21\CryptoWallets\Units\RateInterval $interval = RateInterval::Minutes,
?\O21\CryptoWallets\Interfaces\RateProviderInterface $provider = null
): float
// Returns the best cryptocurrency rate for the selected currency for a given period of time
estimateSendingFee(
string $to,
string $value,
\O21\CryptoWallets\Interfaces\FeeInterface|string $fee
): string
// Estimates the fee amount required to send a transaction
send(
string $to,
string $value,
\O21\CryptoWallets\Interfaces\FeeInterface|string $fee
): string
// Send funds from a wallet
getTransaction(string $hash): ?\O21\CryptoWallets\Interfaces\TransactionInterface
- 从钱包返回交易
getTransactions(int $count = 50, int $skip = 0): \Illuminate\Support\Collection;
- 从钱包返回交易
getTransactionsSinceBlock(string $block = ''): \Illuminate\Support\Collection;
- 从钱包返回交易
getTransactionsCount(): int
- 返回钱包上的交易数量
getExploreTransactionLink(string $hash): string
- 返回交易区块链浏览器链接
/**
* @return \Illuminate\Support\Collection<\O21\CryptoWallets\Interfaces\FeeInterface>
*/
public function getNetworkFees(): Collection;
// Returns the recommended fees for the transaction
getDefaultBestRateLimit(): int
- 返回 getBestRate
函数中期间的默认值
getTypicalTransactionSize(): int
- 返回钱包的典型交易大小
getSymbol(): string
- 返回钱包的符号
此外,一些钱包有自己的独特方法。探索接口 \O21\CryptoWallets\Interfaces\BitcoindWalletInterface
和 \O21\CryptoWallets\Interfaces\EthereumWalletInterface
当前可用的钱包
\O21\CryptoWallets\BitcoinWallet
用于比特币
\O21\CryptoWallets\LitecoinWallet
用于莱特币
\O21\CryptoWallets\EthereumWallet
用于以太坊