Skip to content

Commit

Permalink
minor fixes for use via packagist
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-da committed Feb 10, 2020
1 parent 2d6c21b commit dd74acc
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 31 deletions.
15 changes: 8 additions & 7 deletions README.md
Expand Up @@ -520,19 +520,19 @@ as of 2015-12-30:
Here's a quick example how you one can access the API directly without invoking
the CLI program.

in your project's compsoser.json:
in your project's composer.json:

```
{
"require": {
"dan-da/strictmode-php": "0.1.9"
"dan-da/hd-wallet-addrs": "0.1.9"
}
}
```

yourproject.php
```php
require_once __DIR__ . '/../vendor/autoload.php';
require_once 'vendor/autoload.php';

// normally a single xpub is used. multiple can be provided for multisig key generation.
$xpub_list = ['xpub6BfKpqjTwvH21wJGWEfxLppb8sU7C6FJge2kWb9315oP4ZVqCXG29cdUtkyu7YQhHyfA5nt63nzcNZHYmqXYHDxYo8mm1Xq1dAC7YtodwUR'];
Expand All @@ -541,11 +541,12 @@ $params = walletaddrs::default_params();
// modify params here if you need to. see default_params() for keys.

$wa = new walletaddrs($params);
$data = $worker->discover_wallet_addrs( $xpub_list );
$data = $wa->discover_wallet_addrs( $xpub_list );

walletaddrsreport::print_results($worker->get_params(), $data);
// or you could just use instead:
// echo json_encode($data, JSON_PRETTY_PRINT);
echo json_encode($data, JSON_PRETTY_PRINT);

// or for fancier printing, you could use:
// walletaddrsreport::print_results($wa->get_params(), $data);
```


Expand Down
49 changes: 25 additions & 24 deletions lib/walletaddrs.class.php
@@ -1,6 +1,6 @@
<?php

require_once __DIR__ . '/../vendor/autoload.php';
require_once 'vendor/autoload.php';

// For HD-Wallet Key Derivation
use \BitWasp\Bitcoin\Bitcoin;
Expand Down Expand Up @@ -45,32 +45,33 @@ class walletaddrs {

static public function default_params() {
$params = [
'xpub:'=> null,
'xpubfile:'=> null,
'outfile:'=> null,
'derivation:'=> 'relative',
'numsig:'=> null,
'format:'=> 'jsonpretty',
'cols:'=> 'all',
'gap-limit:'=> 20,
'logfile:'=> null,
'loglevel:'=> null,
'toshi:'=> 'https://bitcoin.toshi.io',
'blockchaindotinfo:'=> 'https://blockchain.info',
'btcd:'=> null,
'btcdotcom:'=> 'https://chain.api.btc.com',
'blockcypher:'=> 'https://api.blockcypher.com',
'insight:'=> 'https://insight.bitpay.com/api',
'esplora:'=> 'https://blockstream.info/api',
'api:'=> 'blockchaindotinfo', // blockchaindotinfo, blockcypher, blockr, btcd, btcdotcom, esplora, insight, toshi
'oracle-raw:'=> null,
'oracle-json:'=> null,
'include:'=> 'used', // used, unused, both
'gen-only:'=> false, // only generate keys, do not query blockchain
'type:'=> 'both', // receive, change, both
'xpub'=> null,
'xpubfile'=> null,
'outfile'=> null,
'derivation'=> 'relative',
'numsig'=> null,
'format'=> 'jsonpretty',
'cols'=> self::default_cols(),
'gap-limit'=> 20,
'logfile'=> null,
'loglevel'=> null,
'toshi'=> 'https://bitcoin.toshi.io',
'blockchaindotinfo'=> 'https://blockchain.info',
'btcd'=> null,
'btcdotcom'=> 'https://chain.api.btc.com',
'blockcypher'=> 'https://api.blockcypher.com',
'insight'=> 'https://insight.bitpay.com/api',
'esplora'=> 'https://blockstream.info/api',
'api'=> 'blockchaindotinfo', // blockchaindotinfo, blockcypher, blockr, btcd, btcdotcom, esplora, insight, toshi
'oracle-raw'=> null,
'oracle-json'=> null,
'include'=> 'used', // used, unused, both
'gen-only'=> false, // only generate keys, do not query blockchain
'type'=> 'both', // receive, change, both
'batch-size' => 'auto',
'multisig' => false,
];
return $params;
}

public function __construct( $params ) {
Expand Down

0 comments on commit dd74acc

Please sign in to comment.