Skip to content

Commit f275c5b

Browse files
author
Sandro Keil
committed
updated changelog and readme
1 parent bdb736e commit f275c5b

File tree

3 files changed

+86
-46
lines changed

3 files changed

+86
-46
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# BlockchainWalletApi CHANGELOG
22

3-
## Version 1.0.0 - TBA
3+
## Version 1.0.0 - (2014-07-01)
44

55
* Satoshi view helper which converts satoshi to other unit e.g. bitcoin
66
* Validator support via input filter

README.md

Lines changed: 84 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Put the following into your composer.json
2626

2727
{
2828
"require": {
29-
"sandrokeil/blockchain-wallet-api": "dev-master"
29+
"sandrokeil/blockchain-wallet-api": "~1.0"
3030
}
3131
}
3232

@@ -38,7 +38,7 @@ Copy `config/blockchainwalletapi.local.php.dist` to `config/blockchainwalletapi.
3838

3939
Please refer to [blockchain wallet api documentation](https://blockchain.info/en/api/blockchain_wallet_api) for request details.
4040

41-
These request classes matches to api methods
41+
**These request classes matches to api methods**
4242

4343
* Send => payment
4444
* SendMany => sendmany
@@ -50,7 +50,47 @@ These request classes matches to api methods
5050
* AddressUnarchive => unarchive_address
5151
* AutoConsolidateAddresses => auto_consolidate
5252

53-
Here is an example how to send bitcoins to a bitcoin address:
53+
## Configuration
54+
Connection parameters can be defined in the application configuration:
55+
56+
```php
57+
<?php
58+
59+
return array(
60+
'sake_bwa' => array(
61+
'connection' => array(
62+
'default' => array(
63+
'options' => array(
64+
// see \Sake\BlockchainWalletApi\Service\BlockchainWalletOptions for all configurations
65+
'url' => 'https://blockchain.info/de/merchant/', // note on your country
66+
'guid' => 'your My Wallet identifier (found on the login page)',
67+
'main_password' => 'Your Main My wallet password',
68+
'second_password' => 'Your second My Wallet password if double encryption is enabled',
69+
),
70+
'client' => 'Service factory name for Http Client, Lazy-loads a Zend\Http\Client instance if none registered'
71+
)
72+
)
73+
)
74+
);
75+
```
76+
77+
## Registered service names
78+
* `sake_bwa.service.default`: a \Sake\BlockchainWalletApi\Service\BlockchainWallet instance to send requests to the api
79+
* `sake_bwa.service.response`: a \Sake\BlockchainWalletApi\Service\ResponsePluginManager Service plugin manager to create responses via api method name
80+
* `sake_bwa.service.request`: a \Sake\BlockchainWalletApi\Service\RequestPluginManager Service plugin manager to create requests via api method name
81+
* `sake_bwa.service.input_filter`: a \Sake\BlockchainWalletApi\Service\InputFilterPluginManager Service plugin manager to create input filter via api method name
82+
* `sake_bwa.service.hydrator`: a \Zend\Stdlib\Hydrator\ClassMethods instance with strategies and filters for requests/responses
83+
84+
## Registered view helper
85+
To use this view helper you must add `zendframework/zend-view` to your composer dependencies.
86+
87+
* `satoshi`: a \Zend\View\Helper\AbstractHelper instance which converts satoshi to other unit e.g. bitcoin
88+
89+
## Examples
90+
This module is very easy to use. However, these code snippets should help you to start.
91+
92+
### Send bitcoins
93+
Here is an example how to send a transaction to a bitcoin address:
5494

5595
```php
5696
<?php
@@ -64,8 +104,8 @@ $request = $sl->get('sake_bwa.service.request')->get('payment');
64104
// or
65105
$request = new BlockchainWalletApi\Request\Send();
66106

67-
$request->setAmount(10000000); // in satoshi
68-
$request->setTo('1A8JiWcwvpY7tAopUkSnGuEYHmzGYfZPiq');
107+
$request->setAmount(100000); // in satoshi
108+
$request->setTo('1KwbP2sRHW7uDsxnW8sBbymVwnSsm8cFXC');
69109

70110
try {
71111
// validate request
@@ -80,6 +120,42 @@ try {
80120
}
81121
```
82122

123+
### Send bitcoins to multiple addresses
124+
Here is an example how to send a transaction to multiple recipients in the same transaction.
125+
126+
```php
127+
<?php
128+
use Sake\BlockchainWalletApi;
129+
130+
// $sl is the service locator
131+
$blockchain = $sl->get('sake_bwa.service.default');
132+
133+
/* @var $request BlockchainWalletApi\Request\SendMany */
134+
$request = $sl->get('sake_bwa.service.request')->get('sendmany');
135+
// or
136+
$request = new BlockchainWalletApi\Request\SendMany();
137+
138+
$request->setRecipients(
139+
array(
140+
new BlockchainWalletApi\Request\Recipient('1BzHqGWhdpXyLqiYkAT7sasfCoffYo79tT', 10000),
141+
new BlockchainWalletApi\Request\Recipient('1NqH4QkkjDErD9TNC7arDQVMv4zKgfCzmb', 10000),
142+
)
143+
);
144+
145+
try {
146+
// validate request
147+
if ($blockchain->isValid($request)) {
148+
/* @var $response BlockchainWalletApi\Response\SendMany */
149+
$response = $service->send($request);
150+
// access to response data
151+
$transactionHash = $response->getTxHash();
152+
}
153+
} catch (BlockchainWalletApi\Exception\ExceptionInterface $exception) {
154+
// error handling
155+
}
156+
```
157+
158+
### Get wallet balance
83159
Here is an example how to retrieve wallet balance:
84160

85161
```php
@@ -95,7 +171,6 @@ $request = $sl->get('sake_bwa.service.request')->get('balance');
95171
// or
96172
$request = new BlockchainWalletApi\Request\WalletBalance();
97173

98-
99174
try {
100175
// validate request
101176
if ($blockchain->isValid($request)) {
@@ -108,7 +183,9 @@ try {
108183
// error handling
109184
}
110185
```
111-
Here is an example how to use satoshi view helper to convert satoshi to other unit:
186+
187+
### Using view helper to convert satoshi to other unit e.g. bitcoins
188+
Here is an example how to use satoshi view helper to convert satoshi to an other unit:
112189

113190
```php
114191
<?php
@@ -121,40 +198,3 @@ echo $this->satoshi($response->getBalanace(), 'mBTC'); // Milli Bits
121198
// or
122199
echo $this->satoshi($response->getBalanace(), 'uBTC'); // Micro Bitcoin
123200
```
124-
125-
## Configuration
126-
Connection parameters can be defined in the application configuration:
127-
128-
```php
129-
<?php
130-
131-
return array(
132-
'sake_bwa' => array(
133-
'connection' => array(
134-
'default' => array(
135-
'options' => array(
136-
// see \Sake\BlockchainWalletApi\Service\BlockchainWalletOptions for all configurations
137-
'url' => 'https://blockchain.info/de/merchant/', // note on your country
138-
'guid' => 'your My Wallet identifier (found on the login page)',
139-
'main_password' => 'Your Main My wallet password',
140-
'second_password' => 'Your second My Wallet password if double encryption is enabled',
141-
),
142-
'client' => 'Service factory name for Http Client, Lazy-loads a Zend\Http\Client instance if none registered'
143-
)
144-
)
145-
)
146-
);
147-
```
148-
149-
## Registered service names
150-
* `sake_bwa.service.default`: a \Sake\BlockchainWalletApi\Service\BlockchainWallet instance to send requests to the api
151-
* `sake_bwa.service.response`: a \Sake\BlockchainWalletApi\Service\ResponsePluginManager Service plugin manager to create responses via api method name
152-
* `sake_bwa.service.request`: a \Sake\BlockchainWalletApi\Service\RequestPluginManager Service plugin manager to create requests via api method name
153-
* `sake_bwa.service.input_filter`: a \Sake\BlockchainWalletApi\Service\InputFilterPluginManager Service plugin manager to create input filter via api method name
154-
* `sake_bwa.service.hydrator`: a \Zend\Stdlib\Hydrator\ClassMethods instance with strategies and filters for requests/responses
155-
156-
## Registered view helper
157-
To use this view helper you must add `zendframework/zend-view` to your composer dependencies.
158-
159-
* `satoshi`: a \Zend\View\Helper\AbstractHelper instance which converts satoshi to other unit e.g. bitcoin
160-

src/Request/SendMany.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public function setShared($shared)
176176
/**
177177
* Returns list of recipients objects
178178
*
179-
* @return array
179+
* @return array List of recipient objects
180180
*/
181181
public function getRecipients()
182182
{

0 commit comments

Comments
 (0)