Padrio / php-electrum-api

💰PHP wrapper for Electrum JSONRPC-API
GNU General Public License v3.0
30 stars 24 forks source link

Give some examples on usage #14

Closed oasin closed 4 years ago

oasin commented 4 years ago

Give an example on how to use. send payment receive payment

Padrio commented 4 years ago

Just check out the basic example: https://github.com/Padrio/php-electrum-api#basic-example

In the first line, the method you want to call is defined. In the example it's \Electrum\Request\Method\Version() - You can find all methods in the Electrum\Request\Method-Namespace. See here: https://github.com/Padrio/php-electrum-api/tree/master/src/Request/Method

In the Payment SubNamespace you will find everything regarding payments. I work mostly with PaymentRequests for receiving payments. And PayTo can be used to send coins.

After initializing, some methods require parameters, you can just use their Setters. e.g.:

$method = new \Electrum\Request\Method\Payment\PayTo();
$method->amount = '0.5'; // WIll send 0.5 Bitcoins. You can use ! to send everything available.
$method->destination = 'wallet-address-here'; // The receiver address

// ... Here comes the execution code, see example link above.
oasin commented 4 years ago

Please how can i get (getunusedaddress) ??

Padrio commented 4 years ago

If you can't even read the code i aint gonna help you. Try understanding whats happening in the code. Checkout the namespaces and maybe look into the given folders for the actions.