Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/021-projects/crypto-wallets
Library for convenient work with cryptocurrency wallets
https://github.com/021-projects/crypto-wallets
address bitcoin blockchain btc comfort crypto cryptocurrency cryptowallet eth ethereum ethereum-wallet ltc php php81 provider wallet wallets web3
Last synced: 2 months ago
JSON representation
Library for convenient work with cryptocurrency wallets
- Host: GitHub
- URL: https://github.com/021-projects/crypto-wallets
- Owner: 021-projects
- Created: 2022-01-26T10:55:01.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-03-30T14:30:27.000Z (over 1 year ago)
- Last Synced: 2024-09-29T20:04:06.436Z (3 months ago)
- Topics: address, bitcoin, blockchain, btc, comfort, crypto, cryptocurrency, cryptowallet, eth, ethereum, ethereum-wallet, ltc, php, php81, provider, wallet, wallets, web3
- Language: PHP
- Homepage:
- Size: 161 KB
- Stars: 8
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Installation
Run ```composer require 021/crypto-wallets```
Add repositories to composer.json
```
"repositories": [
{
"type": "vcs",
"url": "[email protected]: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