cryptocoin_payable 1.0.0

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.
Files changed (103) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +5 -0
  3. data/.rspec +1 -0
  4. data/.rubocop.yml +36 -0
  5. data/Gemfile +8 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +237 -0
  8. data/Rakefile +3 -0
  9. data/bin/console +15 -0
  10. data/bin/setup +8 -0
  11. data/cryptocoin_payable.gemspec +39 -0
  12. data/features/coin_payments.feature +51 -0
  13. data/features/default.feature +5 -0
  14. data/features/pricing_processor.feature +4 -0
  15. data/features/step_definitions/coin_payment_steps.rb +45 -0
  16. data/features/step_definitions/currency_conversion_steps.rb +12 -0
  17. data/features/step_definitions/model_step.rb +11 -0
  18. data/features/step_definitions/processor_steps.rb +7 -0
  19. data/features/step_definitions/widget_steps.rb +3 -0
  20. data/features/support/env.rb +26 -0
  21. data/lib/cryptocoin_payable/adapters/base.rb +99 -0
  22. data/lib/cryptocoin_payable/adapters/bitcoin.rb +93 -0
  23. data/lib/cryptocoin_payable/adapters/bitcoin_cash.rb +34 -0
  24. data/lib/cryptocoin_payable/adapters/ethereum.rb +77 -0
  25. data/lib/cryptocoin_payable/adapters.rb +27 -0
  26. data/lib/cryptocoin_payable/coin_payment.rb +141 -0
  27. data/lib/cryptocoin_payable/coin_payment_transaction.rb +5 -0
  28. data/lib/cryptocoin_payable/commands/payment_processor.rb +67 -0
  29. data/lib/cryptocoin_payable/commands/pricing_processor.rb +43 -0
  30. data/lib/cryptocoin_payable/config.rb +65 -0
  31. data/lib/cryptocoin_payable/currency_conversion.rb +11 -0
  32. data/lib/cryptocoin_payable/errors.rb +7 -0
  33. data/lib/cryptocoin_payable/has_coin_payments.rb +15 -0
  34. data/lib/cryptocoin_payable/tasks.rb +20 -0
  35. data/lib/cryptocoin_payable/version.rb +3 -0
  36. data/lib/cryptocoin_payable.rb +18 -0
  37. data/lib/generators/cryptocoin_payable/install_generator.rb +27 -0
  38. data/lib/generators/cryptocoin_payable/templates/create_coin_payment_transactions.rb +16 -0
  39. data/lib/generators/cryptocoin_payable/templates/create_coin_payments.rb +19 -0
  40. data/lib/generators/cryptocoin_payable/templates/create_currency_conversions.rb +11 -0
  41. data/spec/acceptance/adapters/bitcoin_cash_spec.rb +54 -0
  42. data/spec/acceptance/adapters/bitcoin_spec.rb +79 -0
  43. data/spec/acceptance/adapters/ethereum_spec.rb +77 -0
  44. data/spec/dummy/README.rdoc +28 -0
  45. data/spec/dummy/Rakefile +6 -0
  46. data/spec/dummy/app/assets/images/.keep +0 -0
  47. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  48. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  49. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  50. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  51. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  52. data/spec/dummy/app/mailers/.keep +0 -0
  53. data/spec/dummy/app/models/.keep +0 -0
  54. data/spec/dummy/app/models/concerns/.keep +0 -0
  55. data/spec/dummy/app/models/widget.rb +3 -0
  56. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  57. data/spec/dummy/bin/bundle +3 -0
  58. data/spec/dummy/bin/rails +4 -0
  59. data/spec/dummy/bin/rake +4 -0
  60. data/spec/dummy/config/application.rb +22 -0
  61. data/spec/dummy/config/boot.rb +5 -0
  62. data/spec/dummy/config/database.yml +25 -0
  63. data/spec/dummy/config/environment.rb +5 -0
  64. data/spec/dummy/config/environments/development.rb +29 -0
  65. data/spec/dummy/config/environments/production.rb +80 -0
  66. data/spec/dummy/config/environments/test.rb +36 -0
  67. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  68. data/spec/dummy/config/initializers/cryptocoin_payable.rb +23 -0
  69. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  70. data/spec/dummy/config/initializers/inflections.rb +16 -0
  71. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  72. data/spec/dummy/config/initializers/secret_token.rb +14 -0
  73. data/spec/dummy/config/initializers/session_store.rb +3 -0
  74. data/spec/dummy/config/initializers/state_machine.rb +10 -0
  75. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  76. data/spec/dummy/config/locales/en.yml +23 -0
  77. data/spec/dummy/config/routes.rb +56 -0
  78. data/spec/dummy/config.ru +4 -0
  79. data/spec/dummy/db/development.sqlite3 +0 -0
  80. data/spec/dummy/db/migrate/20140510023211_create_widgets.rb +5 -0
  81. data/spec/dummy/db/migrate/20171227225132_create_coin_payments.rb +19 -0
  82. data/spec/dummy/db/migrate/20171227225133_create_coin_payment_transactions.rb +16 -0
  83. data/spec/dummy/db/migrate/20171227225134_create_currency_conversions.rb +11 -0
  84. data/spec/dummy/db/schema.rb +54 -0
  85. data/spec/dummy/lib/assets/.keep +0 -0
  86. data/spec/dummy/log/.keep +0 -0
  87. data/spec/dummy/public/404.html +58 -0
  88. data/spec/dummy/public/422.html +58 -0
  89. data/spec/dummy/public/500.html +57 -0
  90. data/spec/dummy/public/favicon.ico +0 -0
  91. data/spec/dummy/test/fixtures/widgets.yml +11 -0
  92. data/spec/dummy/test/models/widget_test.rb +7 -0
  93. data/spec/fixtures/vcr_cassettes/CryptocoinPayable_Adapters_Bitcoin/gets_an_empty_result_when_no_transactions_found.yml +67 -0
  94. data/spec/fixtures/vcr_cassettes/CryptocoinPayable_Adapters_Bitcoin/gets_transactions_for_a_given_address.yml +73 -0
  95. data/spec/fixtures/vcr_cassettes/CryptocoinPayable_Adapters_Bitcoin/raises_an_error_when_an_invalid_address_is_passed.yml +103 -0
  96. data/spec/fixtures/vcr_cassettes/CryptocoinPayable_Adapters_Bitcoin/when_the_Block_Explorer_API_fails/falls_back_to_using_the_BlockCypher_API.yml +171 -0
  97. data/spec/fixtures/vcr_cassettes/CryptocoinPayable_Adapters_BitcoinCash/gets_an_empty_result_when_no_transactions_found.yml +62 -0
  98. data/spec/fixtures/vcr_cassettes/CryptocoinPayable_Adapters_BitcoinCash/gets_transactions_for_a_given_address.yml +65 -0
  99. data/spec/fixtures/vcr_cassettes/CryptocoinPayable_Adapters_Ethereum/gets_an_empty_result_when_no_transactions_found.yml +44 -0
  100. data/spec/fixtures/vcr_cassettes/CryptocoinPayable_Adapters_Ethereum/gets_transactions_for_a_given_address.yml +44 -0
  101. data/spec/fixtures/vcr_cassettes/CryptocoinPayable_Adapters_Ethereum/raises_an_error_when_an_invalid_address_is_passed.yml +44 -0
  102. data/spec/spec_helper.rb +112 -0
  103. metadata +428 -0
@@ -0,0 +1,103 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://blockexplorer.com/api/txs/?address=foo
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 400
19
+ message: Bad Request
20
+ headers:
21
+ Date:
22
+ - Sun, 14 Oct 2018 10:35:51 GMT
23
+ Content-Type:
24
+ - text/html; charset=utf-8
25
+ Transfer-Encoding:
26
+ - chunked
27
+ Connection:
28
+ - keep-alive
29
+ Set-Cookie:
30
+ - __cfduid=da94483646f7f50cf4fccfb76ee0e929e1539513350; expires=Mon, 14-Oct-19
31
+ 10:35:50 GMT; path=/; domain=.blockexplorer.com; HttpOnly; Secure
32
+ X-Powered-By:
33
+ - Express
34
+ X-Ratelimit-Limit:
35
+ - '10800'
36
+ X-Ratelimit-Remaining:
37
+ - '10787'
38
+ Access-Control-Allow-Origin:
39
+ - "*"
40
+ Access-Control-Allow-Methods:
41
+ - GET, HEAD, PUT, POST, OPTIONS
42
+ Access-Control-Allow-Headers:
43
+ - Origin, X-Requested-With, Content-Type, Accept, Content-Length, Cache-Control,
44
+ cf-connecting-ip
45
+ Cache-Control:
46
+ - public, max-age=30
47
+ Vary:
48
+ - Accept-Encoding
49
+ Cf-Cache-Status:
50
+ - EXPIRED
51
+ Expect-Ct:
52
+ - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
53
+ Server:
54
+ - cloudflare
55
+ Cf-Ray:
56
+ - 469966c91983c365-SIN
57
+ body:
58
+ encoding: UTF-8
59
+ string: Invalid address. Code:-5
60
+ http_version:
61
+ recorded_at: Sun, 14 Oct 2018 10:35:53 GMT
62
+ - request:
63
+ method: get
64
+ uri: https://api.blockcypher.com/v1/btc/main/addrs/foo/full
65
+ body:
66
+ encoding: US-ASCII
67
+ string: ''
68
+ headers:
69
+ Accept-Encoding:
70
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
71
+ Accept:
72
+ - "*/*"
73
+ User-Agent:
74
+ - Ruby
75
+ response:
76
+ status:
77
+ code: 404
78
+ message: Not Found
79
+ headers:
80
+ Server:
81
+ - nginx/1.10.3 (Ubuntu)
82
+ Date:
83
+ - Sun, 14 Oct 2018 10:35:52 GMT
84
+ Content-Type:
85
+ - application/json
86
+ Content-Length:
87
+ - '33'
88
+ Connection:
89
+ - keep-alive
90
+ Access-Control-Allow-Headers:
91
+ - Origin, X-Requested-With, Content-Type, Accept
92
+ Access-Control-Allow-Methods:
93
+ - GET, POST, PUT, DELETE
94
+ Access-Control-Allow-Origin:
95
+ - "*"
96
+ X-Ratelimit-Remaining:
97
+ - '98'
98
+ body:
99
+ encoding: UTF-8
100
+ string: '{"error": "Wallet foo not found"}'
101
+ http_version:
102
+ recorded_at: Sun, 14 Oct 2018 10:35:54 GMT
103
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,171 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.blockcypher.com/v1/btc/main/addrs/3HR9xYD7MybbE7JLVTjwijYse48BtfEKni/full
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx/1.10.3 (Ubuntu)
23
+ Date:
24
+ - Sun, 14 Oct 2018 10:46:00 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ Access-Control-Allow-Headers:
32
+ - Origin, X-Requested-With, Content-Type, Accept
33
+ Access-Control-Allow-Methods:
34
+ - GET, POST, PUT, DELETE
35
+ Access-Control-Allow-Origin:
36
+ - "*"
37
+ X-Ratelimit-Remaining:
38
+ - '97'
39
+ body:
40
+ encoding: ASCII-8BIT
41
+ string: |-
42
+ {
43
+ "address": "3HR9xYD7MybbE7JLVTjwijYse48BtfEKni",
44
+ "total_received": 500000000,
45
+ "total_sent": 0,
46
+ "balance": 500000000,
47
+ "unconfirmed_balance": 0,
48
+ "final_balance": 500000000,
49
+ "n_tx": 2,
50
+ "unconfirmed_n_tx": 0,
51
+ "final_n_tx": 2,
52
+ "txs": [
53
+ {
54
+ "block_hash": "0000000000000000048e8ea3fdd2c3a59ddcbcf7575f82cb96ce9fd17da9f2f4",
55
+ "block_height": 429632,
56
+ "block_index": 893,
57
+ "hash": "5bdeaf7829148d7e0e1e7b5233512a2c5ae54ef7ccbc8e68b2f85b7e49c917a0",
58
+ "addresses": [
59
+ "1CJzCcrY9WarJ5nZCcfbNu2eAnuHqSGqJP",
60
+ "1CVCj6B2Q4DJ1rFEhaXDdcEcaQQho37yrT",
61
+ "3HR9xYD7MybbE7JLVTjwijYse48BtfEKni"
62
+ ],
63
+ "total": 826645063,
64
+ "fees": 13740,
65
+ "size": 223,
66
+ "preference": "high",
67
+ "relayed_by": "79.208.245.182:8333",
68
+ "confirmed": "2016-09-13T15:41:00Z",
69
+ "received": "2016-09-13T15:33:29.126Z",
70
+ "ver": 1,
71
+ "double_spend": false,
72
+ "vin_sz": 1,
73
+ "vout_sz": 2,
74
+ "confirmations": 116077,
75
+ "confidence": 1,
76
+ "inputs": [
77
+ {
78
+ "prev_hash": "252dde616fbbd25ebaf37ee8df82c38d2135a87100cc1f0315797b1b42f52f01",
79
+ "output_index": 0,
80
+ "script": "47304402206b40298326b6c4ab181c4c61b43569490e91773997c0ec53309ab01851098c1002202731263d747aba117b65aaf7d5ee0ad5e88c2e3b4dc3e47d6ecc414e3bbb38e8012102027fcba75d05e735e734d9287c3b22b90465e30ee87ff064303b8175ddeb48fa",
81
+ "output_value": 826658803,
82
+ "sequence": 4294967295,
83
+ "addresses": [
84
+ "1CJzCcrY9WarJ5nZCcfbNu2eAnuHqSGqJP"
85
+ ],
86
+ "script_type": "pay-to-pubkey-hash",
87
+ "age": 426962
88
+ }
89
+ ],
90
+ "outputs": [
91
+ {
92
+ "value": 499000000,
93
+ "script": "a914ac82105dbe13eb1b2b606b8fa4e58ced5b317ceb87",
94
+ "addresses": [
95
+ "3HR9xYD7MybbE7JLVTjwijYse48BtfEKni"
96
+ ],
97
+ "script_type": "pay-to-script-hash"
98
+ },
99
+ {
100
+ "value": 327645063,
101
+ "script": "76a9147dfed19339f4a44a5a9888448ebb270656e2919488ac",
102
+ "spent_by": "08aee92c75baa331b66aaf8ad27fdaea80053f3fdb090112ce332983cb63de00",
103
+ "addresses": [
104
+ "1CVCj6B2Q4DJ1rFEhaXDdcEcaQQho37yrT"
105
+ ],
106
+ "script_type": "pay-to-pubkey-hash"
107
+ }
108
+ ]
109
+ },
110
+ {
111
+ "block_hash": "000000000000000001af27feb303ad97af81a5882157f166781784c639f8e896",
112
+ "block_height": 429629,
113
+ "block_index": 255,
114
+ "hash": "e7bcdb13d9c903973bd8a740054d4c056a559bae67d4e8f6d0a42b4bab552623",
115
+ "addresses": [
116
+ "13Rd2fKcsUQ9eChqMZGprGeo8XAMAsQhMV",
117
+ "1GWPE3nEHHLY6C5U4c6qj3wxZvx4hiVDxZ",
118
+ "3HR9xYD7MybbE7JLVTjwijYse48BtfEKni"
119
+ ],
120
+ "total": 464992520,
121
+ "fees": 13740,
122
+ "size": 223,
123
+ "preference": "high",
124
+ "relayed_by": "71.206.238.16:8333",
125
+ "confirmed": "2016-09-13T15:22:42Z",
126
+ "received": "2016-09-13T15:20:15.538Z",
127
+ "ver": 1,
128
+ "double_spend": false,
129
+ "vin_sz": 1,
130
+ "vout_sz": 2,
131
+ "confirmations": 116080,
132
+ "confidence": 1,
133
+ "inputs": [
134
+ {
135
+ "prev_hash": "e5c2d3a1ffa653121e38d051274dcbfde19ec53ed13d5e4eba54fdf77e8fbf60",
136
+ "output_index": 0,
137
+ "script": "47304402201d1d8197bd319e43ca5931023dad0bd4fbcd5d941f7bbf51e5ea6390bdf59c3702202303a697a6f722a90981e3fd1d7f0f27d397de3e1ee601e0f681ec933b809ccd0121028ee20d4ea0b72c78caf36b803a79e5a315c61f6d76193130699040cded33ad90",
138
+ "output_value": 465006260,
139
+ "sequence": 4294967295,
140
+ "addresses": [
141
+ "1GWPE3nEHHLY6C5U4c6qj3wxZvx4hiVDxZ"
142
+ ],
143
+ "script_type": "pay-to-pubkey-hash",
144
+ "age": 428716
145
+ }
146
+ ],
147
+ "outputs": [
148
+ {
149
+ "value": 463992520,
150
+ "script": "76a9141a984f5195f48bcd9995ec4bb5ed5a386a10dfdf88ac",
151
+ "spent_by": "5c9864d21dca5bd4715a5489fad9e51dbdcde1588e03d58ddbbbcabc0de54e32",
152
+ "addresses": [
153
+ "13Rd2fKcsUQ9eChqMZGprGeo8XAMAsQhMV"
154
+ ],
155
+ "script_type": "pay-to-pubkey-hash"
156
+ },
157
+ {
158
+ "value": 1000000,
159
+ "script": "a914ac82105dbe13eb1b2b606b8fa4e58ced5b317ceb87",
160
+ "addresses": [
161
+ "3HR9xYD7MybbE7JLVTjwijYse48BtfEKni"
162
+ ],
163
+ "script_type": "pay-to-script-hash"
164
+ }
165
+ ]
166
+ }
167
+ ]
168
+ }
169
+ http_version:
170
+ recorded_at: Sun, 14 Oct 2018 10:46:02 GMT
171
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,62 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://bitcoincash.blockexplorer.com/api/txs/?address=16E1jiUfQevixSoe7uE4fscNj4PjJkd1o9
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Fri, 12 Oct 2018 07:32:41 GMT
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ Content-Length:
26
+ - '25'
27
+ Connection:
28
+ - keep-alive
29
+ Set-Cookie:
30
+ - __cfduid=daacb5c42d20ef981bf9b41e8b10381d41539329560; expires=Sat, 12-Oct-19
31
+ 07:32:40 GMT; path=/; domain=.blockexplorer.com; HttpOnly; Secure
32
+ X-Powered-By:
33
+ - Express
34
+ X-Ratelimit-Limit:
35
+ - '10800'
36
+ X-Ratelimit-Remaining:
37
+ - '10701'
38
+ Access-Control-Allow-Origin:
39
+ - "*"
40
+ Access-Control-Allow-Methods:
41
+ - GET, HEAD, PUT, POST, OPTIONS
42
+ Access-Control-Allow-Headers:
43
+ - Origin, X-Requested-With, Content-Type, Accept, Content-Length, Cache-Control,
44
+ cf-connecting-ip
45
+ X-Content-Type-Options:
46
+ - nosniff
47
+ Etag:
48
+ - W/"19-yV2jHjCT6452sEiXtqmAbfkYdac"
49
+ Vary:
50
+ - Accept-Encoding
51
+ Expect-Ct:
52
+ - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
53
+ Server:
54
+ - cloudflare
55
+ Cf-Ray:
56
+ - 4687dfb7d85f318c-SIN
57
+ body:
58
+ encoding: UTF-8
59
+ string: '{"pagesTotal":0,"txs":[]}'
60
+ http_version:
61
+ recorded_at: Fri, 12 Oct 2018 07:32:42 GMT
62
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,65 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://bitcoincash.blockexplorer.com/api/txs/?address=1HfknBcT93RE12YC4SBfm4NNBkARsNc8Wa
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Fri, 12 Oct 2018 07:32:39 GMT
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ Transfer-Encoding:
26
+ - chunked
27
+ Connection:
28
+ - keep-alive
29
+ Set-Cookie:
30
+ - __cfduid=dda29ada292f7048f8a3ebdd480e7fd041539329558; expires=Sat, 12-Oct-19
31
+ 07:32:38 GMT; path=/; domain=.blockexplorer.com; HttpOnly; Secure
32
+ X-Powered-By:
33
+ - Express
34
+ X-Ratelimit-Limit:
35
+ - '10800'
36
+ X-Ratelimit-Remaining:
37
+ - '10702'
38
+ Access-Control-Allow-Origin:
39
+ - "*"
40
+ Access-Control-Allow-Methods:
41
+ - GET, HEAD, PUT, POST, OPTIONS
42
+ Access-Control-Allow-Headers:
43
+ - Origin, X-Requested-With, Content-Type, Accept, Content-Length, Cache-Control,
44
+ cf-connecting-ip
45
+ X-Content-Type-Options:
46
+ - nosniff
47
+ Etag:
48
+ - W/"84c-f7pBa6wjN3QCqsDu9o519TbOLmo"
49
+ Vary:
50
+ - Accept-Encoding
51
+ Expect-Ct:
52
+ - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
53
+ Server:
54
+ - cloudflare
55
+ Cf-Ray:
56
+ - 4687dfaf2b563186-SIN
57
+ body:
58
+ encoding: ASCII-8BIT
59
+ string: '{"pagesTotal":1,"txs":[{"txid":"10d9d3927a21d90c573a5fbbb347f409af37219ceb93f7475d6c4cca4231d29f","version":1,"locktime":0,"vin":[{"txid":"0214539ca7f81cd38a046c7083b592d88e10a74e139c1c66f87904d62db8c149","vout":0,"sequence":4294967295,"n":0,"scriptSig":{"hex":"483045022100e89cbd22d6ffbfeb30c68420d9c5bd39c2ddb9514fc545704778dc42c3ee003b0220696c92a97b3b1c32a4ab140e8f6c447c9b5cb8596eafdc3dac45d6c1f87dc38a412102bec87afd168c0701f5cac29cda799f45eb0d70f52ce902e337b958c9c986005b","asm":"3045022100e89cbd22d6ffbfeb30c68420d9c5bd39c2ddb9514fc545704778dc42c3ee003b0220696c92a97b3b1c32a4ab140e8f6c447c9b5cb8596eafdc3dac45d6c1f87dc38a[ALL|FORKID]
60
+ 02bec87afd168c0701f5cac29cda799f45eb0d70f52ce902e337b958c9c986005b"},"addr":"bitcoincash:qpth77f5fzj3hmmtpw42tt00c9t3and9guumguzfj2","valueSat":4049279,"value":0.04049279,"doubleSpentTxID":null},{"txid":"bf91d7c20551e78665be98c7344ed87281af543d0bfa3997e6dfa2bf4524f4d2","vout":0,"sequence":4294967295,"n":1,"scriptSig":{"hex":"483045022100dcbb116b70e597e1344394e34bc11936f8bf6e7833cb00a6af425b846c31c72e022034f18e40c530a7f9e4af3498dfb83d72b99913ab5ffcdc31e657a6eef84e42ba41210287ad2b715b610834654606551bdf1045ec163cff2df03e3d49f3c6231aa9cf33","asm":"3045022100dcbb116b70e597e1344394e34bc11936f8bf6e7833cb00a6af425b846c31c72e022034f18e40c530a7f9e4af3498dfb83d72b99913ab5ffcdc31e657a6eef84e42ba[ALL|FORKID]
61
+ 0287ad2b715b610834654606551bdf1045ec163cff2df03e3d49f3c6231aa9cf33"},"addr":"bitcoincash:qpe0ccjkmwyku7mk7kqtphlq7x3p6ykedyg8tlttqq","valueSat":79513,"value":0.00079513,"doubleSpentTxID":null}],"vout":[{"value":"0.04128450","n":0,"scriptPubKey":{"hex":"76a914b6d65d2d333d2f16f0d3cefbb775f404649801c688ac","asm":"OP_DUP
62
+ OP_HASH160 b6d65d2d333d2f16f0d3cefbb775f404649801c6 OP_EQUALVERIFY OP_CHECKSIG","addresses":["bitcoincash:qzmdvhfdxv7j79hs6080hdm47szxfxqpccemzq6n52"],"type":"pubkeyhash"},"spentTxId":null,"spentIndex":null,"spentHeight":null}],"blockhash":"0000000000000000015493ab50fde669130f9b64f0918031a5b6dcc44f14698f","blockheight":551829,"confirmations":2,"time":1539329301,"blocktime":1539329301,"valueOut":0.0412845,"size":340,"valueIn":0.04128792,"fees":0.00000342}]}'
63
+ http_version:
64
+ recorded_at: Fri, 12 Oct 2018 07:32:41 GMT
65
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,44 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.etherscan.io/api?action=txlist&address=0x772fDD41BFB34C9903B253322baccdbE2C10851e&module=account&tag=latest
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Cache-Control:
22
+ - private
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ Server:
26
+ - Microsoft-IIS/10.0
27
+ Access-Control-Allow-Origin:
28
+ - "*"
29
+ Access-Control-Allow-Headers:
30
+ - Content-Type
31
+ Access-Control-Allow-Methods:
32
+ - GET, POST, OPTIONS
33
+ X-Frame-Options:
34
+ - SAMEORIGIN
35
+ Date:
36
+ - Thu, 11 Oct 2018 06:20:39 GMT
37
+ Content-Length:
38
+ - '60'
39
+ body:
40
+ encoding: UTF-8
41
+ string: '{"status":"0","message":"No transactions found","result":[]}'
42
+ http_version:
43
+ recorded_at: Thu, 11 Oct 2018 06:20:56 GMT
44
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,44 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.etherscan.io/api?action=txlist&address=0xfc8cfb26c31931572e65e450f7fa498bcc11651c&module=account&tag=latest
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Cache-Control:
22
+ - private
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ Server:
26
+ - Microsoft-IIS/10.0
27
+ Access-Control-Allow-Origin:
28
+ - "*"
29
+ Access-Control-Allow-Headers:
30
+ - Content-Type
31
+ Access-Control-Allow-Methods:
32
+ - GET, POST, OPTIONS
33
+ X-Frame-Options:
34
+ - SAMEORIGIN
35
+ Date:
36
+ - Mon, 08 Oct 2018 18:29:04 GMT
37
+ Content-Length:
38
+ - '2269'
39
+ body:
40
+ encoding: UTF-8
41
+ string: '{"status":"1","message":"OK","result":[{"blockNumber":"5908320","block_hash":"0x752c50e426f65820f5bf6fd49acbb08d79464f8e7e8ea5b77e2299b69fd6398b","timeStamp":"1530770313","hash":"0xa88b799514e9621962e3d0de25e7e0bc7a123e33085f322c7acdb99cc2585c6d","nonce":"342313","transactionIndex":"12","from":"0xeed16856d551569d134530ee3967ec79995e2051","to":"0xfc8cfb26c31931572e65e450f7fa498bcc11651c","value":"33753640000000000","gas":"50000","gasPrice":"93000000000","input":"0x","contractAddress":"","cumulativeGasUsed":"422633","txreceipt_status":"1","gasUsed":"21000","confirmations":"569771","isError":"0"},{"blockNumber":"5908462","block_hash":"0x1c2b73a16fd8c4d25feeccaa2f0bf5c82b8f415f1beaf4d34aaf870daf89689d","timeStamp":"1530772507","hash":"0xb325a8cf241f332bca92c7f715987e4d34be9a6b3bb78d2425c83086b4aced26","nonce":"0","transactionIndex":"36","from":"0xfc8cfb26c31931572e65e450f7fa498bcc11651c","to":"0x6e5eaac372b4abad8957d68af4f53bcf245c0100","value":"2190144444444444","gas":"21000","gasPrice":"43000000000","input":"0x","contractAddress":"","cumulativeGasUsed":"6094102","txreceipt_status":"1","gasUsed":"21000","confirmations":"569629","isError":"0"},{"blockNumber":"5908542","block_hash":"0x4ce71d11146445f123680ea9beba7db968b04dc675caddf60248c9d9d6f5739e","timeStamp":"1530773753","hash":"0xcd874917be5ad177e7ebd88b5c4a7d4283796e00e43345da5b63fb4f78130b37","nonce":"1","transactionIndex":"27","from":"0xfc8cfb26c31931572e65e450f7fa498bcc11651c","to":"0xa80de67c85669132f25678220b492c301217872e","value":"1007518888888888","gas":"21000","gasPrice":"49000000000","input":"0x","contractAddress":"","cumulativeGasUsed":"805592","txreceipt_status":"1","gasUsed":"21000","confirmations":"569549","isError":"0"},{"blockNumber":"6216122","block_hash":"0xc1361b19b2266e2259ac433b9e18b4fbc81339304988bbc62dd93aa24fac6449","timeStamp":"1535274344","hash":"0x799ec2aaafbddbc2e746334f96f59f6127dec62e5693480576db351aaf840bfb","nonce":"0","transactionIndex":"54","from":"0xd2b296fdf2eb4a441721b5a97dc2d9cca44f7a52","to":"0xfc8cfb26c31931572e65e450f7fa498bcc11651c","value":"15678420000000000","gas":"21000","gasPrice":"39000000000","input":"0x","contractAddress":"","cumulativeGasUsed":"7209675","txreceipt_status":"1","gasUsed":"21000","confirmations":"261969","isError":"0"}]}'
42
+ http_version:
43
+ recorded_at: Mon, 08 Oct 2018 18:29:13 GMT
44
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,44 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.etherscan.io/api?action=txlist&address=foo&module=account&tag=latest
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Cache-Control:
22
+ - private
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ Server:
26
+ - Microsoft-IIS/10.0
27
+ Access-Control-Allow-Origin:
28
+ - "*"
29
+ Access-Control-Allow-Headers:
30
+ - Content-Type
31
+ Access-Control-Allow-Methods:
32
+ - GET, POST, OPTIONS
33
+ X-Frame-Options:
34
+ - SAMEORIGIN
35
+ Date:
36
+ - Thu, 11 Oct 2018 06:23:53 GMT
37
+ Content-Length:
38
+ - '73'
39
+ body:
40
+ encoding: UTF-8
41
+ string: '{"status":"0","message":"NOTOK","result":"Error! Invalid address format"}'
42
+ http_version:
43
+ recorded_at: Thu, 11 Oct 2018 06:24:09 GMT
44
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,112 @@
1
+ require 'vcr'
2
+ require 'webmock/rspec'
3
+
4
+ VCR.configure do |config|
5
+ config.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
6
+ config.hook_into :webmock
7
+ config.configure_rspec_metadata!
8
+ end
9
+
10
+ # This file was generated by the `rspec --init` command. Conventionally, all
11
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
12
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
13
+ # this file to always be loaded, without a need to explicitly require it in any
14
+ # files.
15
+ #
16
+ # Given that it is always loaded, you are encouraged to keep this file as
17
+ # light-weight as possible. Requiring heavyweight dependencies from this file
18
+ # will add to the boot time of your test suite on EVERY test run, even for an
19
+ # individual file that may not need all of that loaded. Instead, consider making
20
+ # a separate helper file that requires the additional dependencies and performs
21
+ # the additional setup, and require it from the spec files that actually need
22
+ # it.
23
+ #
24
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
25
+ RSpec.configure do |config|
26
+ # rspec-expectations config goes here. You can use an alternate
27
+ # assertion/expectation library such as wrong or the stdlib/minitest
28
+ # assertions if you prefer.
29
+ config.expect_with :rspec do |expectations|
30
+ # This option will default to `true` in RSpec 4. It makes the `description`
31
+ # and `failure_message` of custom matchers include text for helper methods
32
+ # defined using `chain`, e.g.:
33
+ # be_bigger_than(2).and_smaller_than(4).description
34
+ # # => "be bigger than 2 and smaller than 4"
35
+ # ...rather than:
36
+ # # => "be bigger than 2"
37
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
38
+ end
39
+
40
+ # rspec-mocks config goes here. You can use an alternate test double
41
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
42
+ config.mock_with :rspec do |mocks|
43
+ # Prevents you from mocking or stubbing a method that does not exist on
44
+ # a real object. This is generally recommended, and will default to
45
+ # `true` in RSpec 4.
46
+ mocks.verify_partial_doubles = true
47
+ end
48
+
49
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
50
+ # have no way to turn it off -- the option exists only for backwards
51
+ # compatibility in RSpec 3). It causes shared context metadata to be
52
+ # inherited by the metadata hash of host groups and examples, rather than
53
+ # triggering implicit auto-inclusion in groups with matching metadata.
54
+ config.shared_context_metadata_behavior = :apply_to_host_groups
55
+
56
+ config.before(:suite) do
57
+ CryptocoinPayable.configure do
58
+ end
59
+ end
60
+
61
+ # The settings below are suggested to provide a good initial experience
62
+ # with RSpec, but feel free to customize to your heart's content.
63
+ # # This allows you to limit a spec run to individual examples or groups
64
+ # # you care about by tagging them with `:focus` metadata. When nothing
65
+ # # is tagged with `:focus`, all examples get run. RSpec also provides
66
+ # # aliases for `it`, `describe`, and `context` that include `:focus`
67
+ # # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
68
+ # config.filter_run_when_matching :focus
69
+ #
70
+ # # Allows RSpec to persist some state between runs in order to support
71
+ # # the `--only-failures` and `--next-failure` CLI options. We recommend
72
+ # # you configure your source control system to ignore this file.
73
+ # config.example_status_persistence_file_path = "spec/examples.txt"
74
+ #
75
+ # # Limits the available syntax to the non-monkey patched syntax that is
76
+ # # recommended. For more details, see:
77
+ # # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
78
+ # # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
79
+ # # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
80
+ # config.disable_monkey_patching!
81
+ #
82
+ # # This setting enables warnings. It's recommended, but in some cases may
83
+ # # be too noisy due to issues in dependencies.
84
+ # config.warnings = true
85
+ #
86
+ # # Many RSpec users commonly either run the entire suite or an individual
87
+ # # file, and it's useful to allow more verbose output when running an
88
+ # # individual spec file.
89
+ # if config.files_to_run.one?
90
+ # # Use the documentation formatter for detailed output,
91
+ # # unless a formatter has already been configured
92
+ # # (e.g. via a command-line flag).
93
+ # config.default_formatter = "doc"
94
+ # end
95
+ #
96
+ # # Print the 10 slowest examples and example groups at the
97
+ # # end of the spec run, to help surface which specs are running
98
+ # # particularly slow.
99
+ # config.profile_examples = 10
100
+ #
101
+ # # Run specs in random order to surface order dependencies. If you find an
102
+ # # order dependency and want to debug it, you can fix the order by providing
103
+ # # the seed, which is printed after each run.
104
+ # # --seed 1234
105
+ # config.order = :random
106
+ #
107
+ # # Seed global randomization in this process using the `--seed` CLI option.
108
+ # # Setting this allows you to use `--seed` to deterministically reproduce
109
+ # # test failures related to randomization by passing the same `--seed` value
110
+ # # as the one that triggered the failure.
111
+ # Kernel.srand config.seed
112
+ end