blockchain 1.0.2 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +1,18 @@
1
- ##Push transaction functionality
2
-
3
- ####`pushtx`
4
- Call the pushtx endpoint and broadcast a hex encoded transaction. The method does not return anything upon success, but will raise exceptions if the transaction is malformed.
5
-
6
- Params:
7
- ```
8
- tx : str (hex encoded)
9
- api_code : str (optional)
10
- ```
11
-
12
- Usage:
13
- ```ruby
14
- require 'blockchain'
15
-
16
- Blockchain::pushtx( '0100000001fd468e431cf5797b108e4d22724e1e055b3ecec59af4ef17b063afd36d3c5cf6010000008c4930460221009918eee8be186035be8ca573b7a4ef7bc672c59430785e5390cc375329a2099702210085b86387e3e15d68c847a1bdf786ed0fdbc87ab3b7c224f3c5490ac19ff4e756014104fe2cfcf0733e559cbf28d7b1489a673c0d7d6de8470d7ff3b272e7221afb051b777b5f879dd6a8908f459f950650319f0e83a5cf1d7c1dfadf6458f09a84ba80ffffffff01185d2033000000001976a9144be9a6a5f6fb75765145d9c54f1a4929e407d2ec88ac00000000')
17
-
18
- ```
1
+ ##Push transaction functionality
2
+
3
+ ####`pushtx`
4
+ Call the pushtx endpoint and broadcast a hex encoded transaction. The method does not return anything upon success, but will raise exceptions if the transaction is malformed.
5
+
6
+ Params:
7
+ ```
8
+ tx : str (hex encoded)
9
+ api_code : str (optional)
10
+ ```
11
+
12
+ Usage:
13
+ ```ruby
14
+ require 'blockchain'
15
+
16
+ Blockchain::pushtx( '0100000001fd468e431cf5797b108e4d22724e1e055b3ecec59af4ef17b063afd36d3c5cf6010000008c4930460221009918eee8be186035be8ca573b7a4ef7bc672c59430785e5390cc375329a2099702210085b86387e3e15d68c847a1bdf786ed0fdbc87ab3b7c224f3c5490ac19ff4e756014104fe2cfcf0733e559cbf28d7b1489a673c0d7d6de8470d7ff3b272e7221afb051b777b5f879dd6a8908f459f950650319f0e83a5cf1d7c1dfadf6458f09a84ba80ffffffff01185d2033000000001976a9144be9a6a5f6fb75765145d9c54f1a4929e407d2ec88ac00000000')
17
+
18
+ ```
@@ -1,19 +1,57 @@
1
- ##Receive functionality
2
-
3
- ####`receive`
4
- Call the 'api/receive' endpoint and create a forwarding address. Returns a `ReceiveResponse` object.
5
-
6
- Params:
7
- ```
8
- dest_addr : str
9
- callback : str
10
- api_code : str (optional)
11
- ```
12
-
13
- Usage:
14
- ```ruby
15
- require 'blockchain'
16
-
17
- resp = Blockchain::receive('1hNapz1CuH4DhnV1DFHH7hafwDE8FJRheA', 'http://your.url.com')
18
-
19
- ```
1
+ ##Receive V1 functionality (deprecated)
2
+
3
+ ####`receive`
4
+ Call the 'api/receive' endpoint and create a forwarding address. Returns a `ReceiveResponse` object.
5
+
6
+ Params:
7
+ ```
8
+ dest_addr : str
9
+ callback : str
10
+ api_code : str (optional)
11
+ ```
12
+
13
+ Usage:
14
+ ```ruby
15
+ require 'blockchain'
16
+
17
+ resp = Blockchain::receive('1hNapz1CuH4DhnV1DFHH7hafwDE8FJRheA', 'http://your.url.com')
18
+
19
+ ```
20
+
21
+
22
+ ##Receive V2 functionality
23
+
24
+ ####`receive`
25
+ Call the 'v2/receive' endpoint and create a new address. Returns a `V2::ReceiveResponse` object.
26
+
27
+ Params:
28
+ ```
29
+ xpub : str
30
+ callback : str
31
+ api_key : str
32
+ ```
33
+
34
+ Usage:
35
+ ```ruby
36
+ require 'blockchain'
37
+
38
+ resp = Blockchain::V2::receive('xpub1hNapz1CuH4DhnV1DFHH7hafwDE8FJRheA', 'http://your.url.com', 'yourApiKey')
39
+
40
+ ```
41
+
42
+ ####`callback_log`
43
+ Call the 'v2/receive/callback_log' endpoint. Returns an array of `LogEntry` objects.
44
+
45
+ Params:
46
+ ```
47
+ callback : str
48
+ api_key : str
49
+ ```
50
+
51
+ Usage:
52
+ ```ruby
53
+ require 'blockchain'
54
+
55
+ resp = Blockchain::callback_log('1hNapz1CuH4DhnV1DFHH7hafwDE8FJRheA', 'http://your.url.com')
56
+
57
+ ```
@@ -1,16 +1,16 @@
1
- ## Statistics functionality
2
-
3
- ####`get`
4
- Get network statistics. Returns a `StatisticsResponse` object.
5
-
6
- Params:
7
- ```
8
- api_code : str (optional)
9
- ```
10
-
11
- Usage:
12
- ```ruby
13
- require 'blockchain'
14
-
15
- stats = Blockchain::get_statistics()
1
+ ## Statistics functionality
2
+
3
+ ####`get`
4
+ Get network statistics. Returns a `StatisticsResponse` object.
5
+
6
+ Params:
7
+ ```
8
+ api_code : str (optional)
9
+ ```
10
+
11
+ Usage:
12
+ ```ruby
13
+ require 'blockchain'
14
+
15
+ stats = Blockchain::get_statistics()
16
16
  ```
@@ -1,148 +1,148 @@
1
- ##`wallet` module
2
-
3
- An instance of the `Wallet` class needs to be initialized before it can be used.
4
-
5
- Constructor params:
6
- ```
7
- identifier : str
8
- password : str
9
- second_password : str (optional)
10
- api_code : str (optional)
11
- ```
12
-
13
- Usage:
14
- ```ruby
15
- require 'blockchain'
16
-
17
- wallet = Blockchain::Wallet.new('ada4e4b6-3c9f-11e4-baad-164230d1df67', 'password123')
18
- ```
19
-
20
- ####`send`
21
- Send bitcoin from your wallet to a single address. Returns a `PaymentResponse` object.
22
-
23
- Params:
24
- ```
25
- to : str - receiving address
26
- amount : int - amount to send (in satoshi)
27
- from_address : str - specific address to send from (optional, keyword)
28
- fee : int - transaction fee in satoshi. Must be greater than default (optional, keyword)
29
- note : str - public note to include with the transaction if amount >= 0.005 BTC (optional, keyword)
30
- ```
31
-
32
- Usage:
33
- ```ruby
34
- payment = wallet.send('1NAF7GbdyRg3miHNrw2bGxrd63tfMEmJob', 1000000, from_address: '1A8JiWcwvpY7tAopUkSnGuEYHmzGYfZPiq')
35
-
36
- puts payment.tx_hash
37
- ```
38
-
39
- ####`send_many`
40
- Send bitcoin from your wallet to multiple addresses. Returns a `PaymentResponse` object.
41
-
42
- Params:
43
- ```
44
- recipients : dictionary - dictionary with the structure of 'address':amount
45
- from_address : str - specific address to send from (optional, keyword)
46
- fee : int - transaction fee in satoshi. Must be greater than default (optional, keyword)
47
- note : str - public note to include with the transaction if amount >= 0.005 BTC (optional, keyword)
48
- ```
49
-
50
- Usage:
51
- ```ruby
52
- recipients = { '1NAF7GbdyRg3miHNrw2bGxrd63tfMEmJob' => 1428300,
53
- '1A8JiWcwvpY7tAopUkSnGuEYHmzGYfZPiq' => 234522117 }
54
- payment = wallet.send_many(recipients)
55
-
56
- puts payment.tx_hash
57
- ```
58
-
59
- ####`get_balance`
60
- Fetch the wallet balance. Includes unconfirmed transactions and possibly double spends. Returns the wallet balance in satoshi.
61
-
62
- Usage:
63
- ```ruby
64
- puts wallet.get_balance()
65
- ```
66
-
67
- ####`list_addresses`
68
- List all active addresses in the wallet. Returns an array of `Address` objects.
69
-
70
- Params:
71
- ```
72
- confirmations : int - minimum number of confirmations transactions must have before being included in balance of addresses (optional)
73
- ```
74
-
75
- Usage:
76
- ```ruby
77
- addresses = wallet.list_addresses()
78
- addresses.each do |a|
79
- puts a.balance
80
- end
81
-
82
- ```
83
-
84
- ####`get_address`
85
- Retrieve an address from the wallet. Returns an `Address` object.
86
-
87
- Params:
88
- ```
89
- confirmations : int - minimum number of confirmations transactions must have before being included in the balance (optional)
90
- ```
91
-
92
- Usage:
93
- ```ruby
94
- addr = wallet.get_address('1NAF7GbdyRg3miHNrw2bGxrd63tfMEmJob', confirmations = 2)
95
- puts addr.balance
96
- ```
97
-
98
- ####`new_address`
99
- Generate a new address and add it to the wallet. Returns an `Address` object.
100
-
101
- Params:
102
- ```
103
- label : str - label to attach to the address (optional, keyword)
104
- ```
105
-
106
- Usage:
107
- ```ruby
108
- newaddr = wallet.new_address('test_label')
109
- ```
110
-
111
- ####`archive_address`
112
- Archive an address. Returns a string representation of the archived address.
113
-
114
- Params:
115
- ```
116
- address : str - address to archive
117
- ```
118
-
119
- Usage:
120
- ```ruby
121
- wallet.archive_address('1NAF7GbdyRg3miHNrw2bGxrd63tfMEmJob')
122
- ```
123
-
124
- ####`unarchive_address`
125
- Unarchive an address. Returns a string representation of the unarchived address.
126
-
127
- Params:
128
- ```
129
- address : str - address to unarchive
130
- ```
131
-
132
- Usage:
133
- ```ruby
134
- wallet.unarchive_address('1NAF7GbdyRg3miHNrw2bGxrd63tfMEmJob')
135
- ```
136
-
137
- ####`consolidate`
138
- Consolidate the wallet addresses. Returns a string array of consolidated addresses.
139
-
140
- Params:
141
- ```
142
- days : int - addresses which have not received any transactions in at least this many days will be consolidated.
143
- ```
144
-
145
- Usage:
146
- ```ruby
147
- wallet.consolidate(50)
148
- ```
1
+ ##`wallet` module
2
+
3
+ An instance of the `Wallet` class needs to be initialized before it can be used.
4
+
5
+ Constructor params:
6
+ ```
7
+ identifier : str
8
+ password : str
9
+ second_password : str (optional)
10
+ api_code : str (optional)
11
+ ```
12
+
13
+ Usage:
14
+ ```ruby
15
+ require 'blockchain'
16
+
17
+ wallet = Blockchain::Wallet.new('ada4e4b6-3c9f-11e4-baad-164230d1df67', 'password123')
18
+ ```
19
+
20
+ ####`send`
21
+ Send bitcoin from your wallet to a single address. Returns a `PaymentResponse` object.
22
+
23
+ Params:
24
+ ```
25
+ to : str - receiving address
26
+ amount : int - amount to send (in satoshi)
27
+ from_address : str - specific address to send from (optional, keyword)
28
+ fee : int - transaction fee in satoshi. Must be greater than default (optional, keyword)
29
+ note : str - public note to include with the transaction if amount >= 0.005 BTC (optional, keyword)
30
+ ```
31
+
32
+ Usage:
33
+ ```ruby
34
+ payment = wallet.send('1NAF7GbdyRg3miHNrw2bGxrd63tfMEmJob', 1000000, from_address: '1A8JiWcwvpY7tAopUkSnGuEYHmzGYfZPiq')
35
+
36
+ puts payment.tx_hash
37
+ ```
38
+
39
+ ####`send_many`
40
+ Send bitcoin from your wallet to multiple addresses. Returns a `PaymentResponse` object.
41
+
42
+ Params:
43
+ ```
44
+ recipients : dictionary - dictionary with the structure of 'address':amount
45
+ from_address : str - specific address to send from (optional, keyword)
46
+ fee : int - transaction fee in satoshi. Must be greater than default (optional, keyword)
47
+ note : str - public note to include with the transaction if amount >= 0.005 BTC (optional, keyword)
48
+ ```
49
+
50
+ Usage:
51
+ ```ruby
52
+ recipients = { '1NAF7GbdyRg3miHNrw2bGxrd63tfMEmJob' => 1428300,
53
+ '1A8JiWcwvpY7tAopUkSnGuEYHmzGYfZPiq' => 234522117 }
54
+ payment = wallet.send_many(recipients)
55
+
56
+ puts payment.tx_hash
57
+ ```
58
+
59
+ ####`get_balance`
60
+ Fetch the wallet balance. Includes unconfirmed transactions and possibly double spends. Returns the wallet balance in satoshi.
61
+
62
+ Usage:
63
+ ```ruby
64
+ puts wallet.get_balance()
65
+ ```
66
+
67
+ ####`list_addresses`
68
+ List all active addresses in the wallet. Returns an array of `Address` objects.
69
+
70
+ Params:
71
+ ```
72
+ confirmations : int - minimum number of confirmations transactions must have before being included in balance of addresses (optional)
73
+ ```
74
+
75
+ Usage:
76
+ ```ruby
77
+ addresses = wallet.list_addresses()
78
+ addresses.each do |a|
79
+ puts a.balance
80
+ end
81
+
82
+ ```
83
+
84
+ ####`get_address`
85
+ Retrieve an address from the wallet. Returns an `Address` object.
86
+
87
+ Params:
88
+ ```
89
+ confirmations : int - minimum number of confirmations transactions must have before being included in the balance (optional)
90
+ ```
91
+
92
+ Usage:
93
+ ```ruby
94
+ addr = wallet.get_address('1NAF7GbdyRg3miHNrw2bGxrd63tfMEmJob', confirmations = 2)
95
+ puts addr.balance
96
+ ```
97
+
98
+ ####`new_address`
99
+ Generate a new address and add it to the wallet. Returns an `Address` object.
100
+
101
+ Params:
102
+ ```
103
+ label : str - label to attach to the address (optional, keyword)
104
+ ```
105
+
106
+ Usage:
107
+ ```ruby
108
+ newaddr = wallet.new_address('test_label')
109
+ ```
110
+
111
+ ####`archive_address`
112
+ Archive an address. Returns a string representation of the archived address.
113
+
114
+ Params:
115
+ ```
116
+ address : str - address to archive
117
+ ```
118
+
119
+ Usage:
120
+ ```ruby
121
+ wallet.archive_address('1NAF7GbdyRg3miHNrw2bGxrd63tfMEmJob')
122
+ ```
123
+
124
+ ####`unarchive_address`
125
+ Unarchive an address. Returns a string representation of the unarchived address.
126
+
127
+ Params:
128
+ ```
129
+ address : str - address to unarchive
130
+ ```
131
+
132
+ Usage:
133
+ ```ruby
134
+ wallet.unarchive_address('1NAF7GbdyRg3miHNrw2bGxrd63tfMEmJob')
135
+ ```
136
+
137
+ ####`consolidate`
138
+ Consolidate the wallet addresses. Returns a string array of consolidated addresses.
139
+
140
+ Params:
141
+ ```
142
+ days : int - addresses which have not received any transactions in at least this many days will be consolidated.
143
+ ```
144
+
145
+ Usage:
146
+ ```ruby
147
+ wallet.consolidate(50)
148
+ ```
@@ -8,5 +8,6 @@ require "blockchain/statistics"
8
8
  require "blockchain/wallet"
9
9
 
10
10
  module Blockchain
11
-
11
+ module V2
12
+ end
12
13
  end