<?php // Run on console: // php -f .\sample\wallet-api\DeriveAddressInHDWalletWithSubchainIndexEndpoint.php require __DIR__ . '/../bootstrap.php'; use BlockCypher\Auth\SimpleTokenCredential; use BlockCypher\Client\HDWalletClient; use BlockCypher\Rest\ApiContext; $apiContext = ApiContext::create('main', 'btc', 'v1', new SimpleTokenCredential('c0afcccdde5081d6429de37d16166ead'), array('mode' => 'sandbox', 'log.LogEnabled' => true, 'log.FileName' => 'BlockCypher.log', 'log.LogLevel' => 'DEBUG')); $walletClient = new HDWalletClient($apiContexts['BTC.main']); $params = array('subchain_index' => 1); $hdWallet = $walletClient->deriveAddress('bob', $params); ResultPrinter::printResult("Derive Address in a HDWallet", "HDWallet", $walletName, null, $hdWallet);
<?php // Run on console: // php -f .\sample\wallet-api\DeriveAddressInHDWalletEndpoint.php require __DIR__ . '/../bootstrap.php'; use BlockCypher\Auth\SimpleTokenCredential; use BlockCypher\Client\HDWalletClient; use BlockCypher\Rest\ApiContext; $apiContext = ApiContext::create('main', 'btc', 'v1', new SimpleTokenCredential('c0afcccdde5081d6429de37d16166ead'), array('mode' => 'sandbox', 'log.LogEnabled' => true, 'log.FileName' => 'BlockCypher.log', 'log.LogLevel' => 'DEBUG')); $walletClient = new HDWalletClient($apiContext); $hdWallet = $walletClient->deriveAddress('bob'); ResultPrinter::printResult("Derive Address in a HDWallet", "HDWallet", $walletName, null, $hdWallet);
/** * @dataProvider mockProvider * @param HDWalletClient $obj * @param PHPUnit_Framework_MockObject_MockObject|ApiContext $mockApiContext * @param PHPUnit_Framework_MockObject_MockObject|BlockCypherRestCall $mockBlockCypherRestCall */ public function testDeriveAddress($obj, $mockApiContext, $mockBlockCypherRestCall) { $mockBlockCypherRestCall->expects($this->any())->method('execute')->will($this->returnValue(HDWalletTest::getJson())); $result = $obj->deriveAddress(HDWalletTest::getObject()->getName(), array(), $mockApiContext, $mockBlockCypherRestCall); $this->assertNotNull($result); }