GithubHelp home page GithubHelp logo

021-projects / crypto-wallets Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 2.0 165 KB

Library for convenient work with cryptocurrency wallets

PHP 100.00%
address bitcoin blockchain cryptocurrency ethereum wallet btc ltc comfort crypto

crypto-wallets's Introduction

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

crypto-wallets's People

Contributors

021-projects avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.