Skip to content
This repository was archived by the owner on Sep 4, 2021. It is now read-only.

Commit e067dae

Browse files
author
Pascal Krason
committed
Added more API functions
1 parent c2dca70 commit e067dae

1 file changed

Lines changed: 62 additions & 1 deletion

File tree

src/Electrum.php

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ public function SendRequest($method, array $params = [])
184184
// ### Return Data converted to an array
185185
$response = json_decode($response, true);
186186

187-
188187
// ### Check if an error occured
189188
if(isset($response['error'])) {
190189

@@ -198,6 +197,27 @@ public function SendRequest($method, array $params = [])
198197
return $response['result'];
199198
}
200199

200+
/**
201+
* Return the version of electrum.
202+
*
203+
* @return array|bool
204+
*/
205+
public function GetVersion()
206+
{
207+
return $this->SendRequest('version');
208+
}
209+
210+
/**
211+
* Return wallet synchronization status
212+
* @Todo: This thing is broken, not my fault.
213+
*
214+
* @return array|bool
215+
*/
216+
public function isSynchronized()
217+
{
218+
return $this->SendRequest('is_synchronized');
219+
}
220+
201221
/**
202222
* Get current balance
203223
*
@@ -241,6 +261,19 @@ public function GetAddressUnspent($address)
241261
return $this->SendRequest('getaddressunspent', ['address' => $address]);
242262
}
243263

264+
/**
265+
* Check if address is in wallet. Return true if and only address is in wallet
266+
* @Todo: This thing is broken, not my fault.
267+
*
268+
* @param $address
269+
*
270+
* @return array|bool
271+
*/
272+
public function isAddressMine($address)
273+
{
274+
return $this->SendRequest('ismine', ['address' => $address]);
275+
}
276+
244277
/**
245278
* Wallet history. Returns the transaction history of your wallet.
246279
*
@@ -435,4 +468,32 @@ public function Freeze($address)
435468
return $this->SendRequest('freeze', ['address' => $address]);
436469
}
437470

471+
/**
472+
* Return a configuration variable.
473+
*
474+
* @param $key string Config variable
475+
*
476+
* @return array|bool
477+
*/
478+
public function GetConfig($key)
479+
{
480+
return $this->SendRequest('getconfig', ['key' => $key]);
481+
}
482+
483+
/**
484+
* Set a configuration variable. 'value' may be a string or a Python expression.
485+
*
486+
* @param $key string Config variable
487+
* @param $value string Value
488+
*
489+
* @return array|bool
490+
*/
491+
public function SetConfig($key, $value)
492+
{
493+
return $this->SendRequest('setconfig', [
494+
'key' => $key,
495+
'value' => $value,
496+
]);
497+
}
498+
438499
}

0 commit comments

Comments
 (0)