021/crypto-wallets
Composer 安装命令:
composer require 021/crypto-wallets
包简介
Package for working with crypto wallets
README 文档
README
Run composer require 021/crypto-wallets
Add repositories to composer.json
"repositories": [
{
"type": "vcs",
"url": "git@github.com:021-projects/php-bitcoinrpc.git"
}
]
Requirements
- PHP 8.1+
Wallet interface
\O21\CryptoWallets\Interfaces\WalletInterface
__construct(\O21\CryptoWallets\Interfaces\ConnectConfigInterface $config)
isAvailable(): bool - check is RPC client available
getBalance(): string - get wallet balance
getNewAddress($config = null): string - get new address
isValidAddress(string $address): bool - check is an address is valid
isOwningAddress(string $address): bool - checks if an address belongs to a wallet
getExploreAddressLink(string $address): string - returns a link to blockchain explorer for the address
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 - returns transaction from a wallet
getTransactions(int $count = 50, int $skip = 0): \Illuminate\Support\Collection; - returns transactions from a wallet
getTransactionsSinceBlock(string $block = ''): \Illuminate\Support\Collection; - returns transactions from a wallet
getTransactionsCount(): int - returns transactions count on a wallet
getExploreTransactionLink(string $hash): string - returns a link to blockchain explorer for the address
/**
* @return \Illuminate\Support\Collection<\O21\CryptoWallets\Interfaces\FeeInterface>
*/
public function getNetworkFees(): Collection;
// Returns the recommended fees for the transaction
getDefaultBestRateLimit(): int - returns the default value for the period in the getBestRate function
getTypicalTransactionSize(): int - returns typical transaction size for a wallet
getSymbol(): string - returns symbol of a wallet
Also, some wallets have their own unique methods. Explore the interfaces \O21\CryptoWallets\Interfaces\BitcoindWalletInterface and \O21\CryptoWallets\Interfaces\EthereumWalletInterface
Currently available wallets
\O21\CryptoWallets\BitcoinWallet for bitcoin
\O21\CryptoWallets\LitecoinWallet for litecoin
\O21\CryptoWallets\EthereumWallet for ethereum
021/crypto-wallets 适用场景与选型建议
021/crypto-wallets 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 77 次下载、GitHub Stars 达 8, 最近一次更新时间为 2022 年 01 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 021/crypto-wallets 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 021/crypto-wallets 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 77
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-01-26