cash-addr 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.rspec +3 -0
  4. data/.rubocop.yml +35 -0
  5. data/.travis.yml +5 -0
  6. data/Gemfile +8 -0
  7. data/Gemfile.lock +53 -0
  8. data/LICENSE.txt +13 -0
  9. data/README.md +73 -0
  10. data/Rakefile +8 -0
  11. data/bin/console +15 -0
  12. data/bin/setup +6 -0
  13. data/cash-addr.gemspec +31 -0
  14. data/circle.yml +7 -0
  15. data/doc/CashAddr.html +110 -0
  16. data/doc/CashAddr/Converter.html +277 -0
  17. data/doc/CashAddr/InvalidAddress.html +103 -0
  18. data/doc/LICENSE_txt.html +99 -0
  19. data/doc/README_md.html +175 -0
  20. data/doc/cash-addr_gemspec.html +125 -0
  21. data/doc/created.rid +11 -0
  22. data/doc/css/fonts.css +167 -0
  23. data/doc/css/rdoc.css +590 -0
  24. data/doc/fonts/Lato-Light.ttf +0 -0
  25. data/doc/fonts/Lato-LightItalic.ttf +0 -0
  26. data/doc/fonts/Lato-Regular.ttf +0 -0
  27. data/doc/fonts/Lato-RegularItalic.ttf +0 -0
  28. data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
  29. data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
  30. data/doc/images/add.png +0 -0
  31. data/doc/images/arrow_up.png +0 -0
  32. data/doc/images/brick.png +0 -0
  33. data/doc/images/brick_link.png +0 -0
  34. data/doc/images/bug.png +0 -0
  35. data/doc/images/bullet_black.png +0 -0
  36. data/doc/images/bullet_toggle_minus.png +0 -0
  37. data/doc/images/bullet_toggle_plus.png +0 -0
  38. data/doc/images/date.png +0 -0
  39. data/doc/images/delete.png +0 -0
  40. data/doc/images/find.png +0 -0
  41. data/doc/images/loadingAnimation.gif +0 -0
  42. data/doc/images/macFFBgHack.png +0 -0
  43. data/doc/images/package.png +0 -0
  44. data/doc/images/page_green.png +0 -0
  45. data/doc/images/page_white_text.png +0 -0
  46. data/doc/images/page_white_width.png +0 -0
  47. data/doc/images/plugin.png +0 -0
  48. data/doc/images/ruby.png +0 -0
  49. data/doc/images/tag_blue.png +0 -0
  50. data/doc/images/tag_green.png +0 -0
  51. data/doc/images/transparent.png +0 -0
  52. data/doc/images/wrench.png +0 -0
  53. data/doc/images/wrench_orange.png +0 -0
  54. data/doc/images/zoom.png +0 -0
  55. data/doc/index.html +175 -0
  56. data/doc/js/darkfish.js +161 -0
  57. data/doc/js/jquery.js +4 -0
  58. data/doc/js/navigation.js +142 -0
  59. data/doc/js/navigation.js.gz +0 -0
  60. data/doc/js/search.js +109 -0
  61. data/doc/js/search_index.js +1 -0
  62. data/doc/js/search_index.js.gz +0 -0
  63. data/doc/js/searcher.js +229 -0
  64. data/doc/js/searcher.js.gz +0 -0
  65. data/doc/table_of_contents.html +94 -0
  66. data/lib/cash_addr.rb +59 -0
  67. data/lib/cash_addr/address.rb +109 -0
  68. data/lib/cash_addr/crypto.rb +95 -0
  69. data/lib/cash_addr/version.rb +7 -0
  70. metadata +182 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9668e77230717c982134d88318cbb138c1f7723a84a9064a2e0e99797d5bdd7d
4
+ data.tar.gz: 470b76269f62340d7bd8bfc2d62d6360956cfe225ed212d4a58138b9e717ce98
5
+ SHA512:
6
+ metadata.gz: 27b248c8839ce0f92fbb12036a290b6c00fc08c94f4f12c443251a237235aea0c9c368b43ee09d70bb094158676ba63014f46d864abc3f9930bbd1b924d8d8b1
7
+ data.tar.gz: ef40b4e0e50d2c60b6d63d22e801be9d85dde62c28360752c16e5f6a62f8912d9c28a7186cb800140de34d6ceecfefa58f474939e73f60d1d247a6a47193bac8
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /pkg/
6
+ /spec/reports/
7
+ /tmp/
8
+
9
+ # rspec failure tracking
10
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,35 @@
1
+ Metrics/LineLength:
2
+ Max: 120
3
+
4
+ Style/GuardClause:
5
+ Enabled: false
6
+
7
+ Style/Documentation:
8
+ Enabled: false
9
+
10
+ Metrics/CyclomaticComplexity:
11
+ Enabled: false
12
+
13
+ Metrics/AbcSize:
14
+ Enabled: false
15
+
16
+ Metrics/MethodLength:
17
+ Max: 100
18
+
19
+ Style/IfUnlessModifier:
20
+ Enabled: false
21
+
22
+ Style/NumericPredicate:
23
+ Enabled: false
24
+
25
+ Naming/PredicateName:
26
+ Enabled: false
27
+
28
+ Style/NegatedIf:
29
+ Enabled: false
30
+
31
+ Metrics/PerceivedComplexity:
32
+ Enabled: false
33
+
34
+ Metrics/BlockLength:
35
+ Enabled: false
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.5
5
+ before_install: gem install bundler -v 1.16.0
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in cash_addr.gemspec
8
+ gemspec
@@ -0,0 +1,53 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ cash-addr (0.1.1)
5
+ base58 (~> 0.2.2)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.0)
11
+ base58 (0.2.2)
12
+ diff-lcs (1.3)
13
+ parallel (1.12.1)
14
+ parser (2.5.1.0)
15
+ ast (~> 2.4.0)
16
+ powerpack (0.1.1)
17
+ rainbow (3.0.0)
18
+ rake (10.5.0)
19
+ rspec (3.7.0)
20
+ rspec-core (~> 3.7.0)
21
+ rspec-expectations (~> 3.7.0)
22
+ rspec-mocks (~> 3.7.0)
23
+ rspec-core (3.7.1)
24
+ rspec-support (~> 3.7.0)
25
+ rspec-expectations (3.7.0)
26
+ diff-lcs (>= 1.2.0, < 2.0)
27
+ rspec-support (~> 3.7.0)
28
+ rspec-mocks (3.7.0)
29
+ diff-lcs (>= 1.2.0, < 2.0)
30
+ rspec-support (~> 3.7.0)
31
+ rspec-support (3.7.1)
32
+ rubocop (0.52.1)
33
+ parallel (~> 1.10)
34
+ parser (>= 2.4.0.2, < 3.0)
35
+ powerpack (~> 0.1)
36
+ rainbow (>= 2.2.2, < 4.0)
37
+ ruby-progressbar (~> 1.7)
38
+ unicode-display_width (~> 1.0, >= 1.0.1)
39
+ ruby-progressbar (1.9.0)
40
+ unicode-display_width (1.3.0)
41
+
42
+ PLATFORMS
43
+ ruby
44
+
45
+ DEPENDENCIES
46
+ bundler (~> 1.16)
47
+ cash-addr!
48
+ rake (~> 10.0)
49
+ rspec (~> 3.0)
50
+ rubocop (~> 0.52.1)
51
+
52
+ BUNDLED WITH
53
+ 1.16.0
@@ -0,0 +1,13 @@
1
+ Copyright 2018 Coinbase
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
@@ -0,0 +1,73 @@
1
+ # CashAddr
2
+
3
+ Utility to convert between base58 and CashAddr BCH addresses.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'cash-addr'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ ```
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+
21
+ ```
22
+ $ gem install cash-addr
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ To convert from a legacy address to CashAddr:
28
+
29
+ ```
30
+ CashAddr::Converter.to_cash_address('mmRH4e9WW4ekZUP5HvBScfUyaSUjfQRyvD')
31
+ ```
32
+
33
+ To convert from a CashAddr address to legacy:
34
+
35
+ ```
36
+ CashAddr::Converter.to_legacy_address('bchtest:qpqtmmfpw79thzq5z7s0spcd87uhn6d34uqqem83hf')
37
+ ```
38
+
39
+ To validate a BCH address:
40
+
41
+ ```
42
+ CashAddr::Converter.is_valid?('bchtest:qpqtmmfpw79thzq5z7s0spcd87uhn6d34uqqem83hf')
43
+ ```
44
+
45
+ To display a BCH CashAddr address without the prefix:
46
+
47
+ ```
48
+ CashAddr::Converter.display_address('bchtest:qpqtmmfpw79thzq5z7s0spcd87uhn6d34uqqem83hf')
49
+ ```
50
+
51
+ NOTE: Testnet addresses are used as examples, but both testnet and mainnet are supported.
52
+
53
+ ## Development
54
+
55
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
56
+
57
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
58
+
59
+ ## Documentation
60
+
61
+ Docs are generated via rdoc and are located in the `doc` directory. To update the documentation:
62
+
63
+ ```
64
+ rdoc --main README.md -x Gemfile -x Rakefile -x setup -x address -x crypto
65
+ ```
66
+
67
+ ## Contributing
68
+
69
+ Bug reports and pull requests are welcome on GitHub at https://github.com/coinbase/cash-addr.
70
+
71
+ ## License
72
+
73
+ The gem is available as open source under the terms of the [Apache 2.0 License](https://opensource.org/licenses/Apache-2.0).
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'cash_addr'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
@@ -0,0 +1,31 @@
1
+
2
+ # frozen_string_literal: true
3
+
4
+ lib = File.expand_path('../lib', __FILE__)
5
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
+ require 'cash_addr/version'
7
+
8
+ Gem::Specification.new do |spec|
9
+ spec.name = 'cash-addr'
10
+ spec.version = CashAddr::VERSION
11
+ spec.authors = ['Josh Ellithorpe']
12
+ spec.email = ['josh.ellithorpe@coinbase.com']
13
+
14
+ spec.summary = 'Library to convert between base58 and CashAddr BCH addresses'
15
+ spec.homepage = 'https://github.com/coinbase/cash-addr'
16
+ spec.license = 'Apache-2.0'
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
+ f.match(%r{^(test|spec|features)/})
20
+ end
21
+ spec.bindir = 'exe'
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ['lib']
24
+
25
+ spec.add_development_dependency 'bundler', '~> 1.16'
26
+ spec.add_development_dependency 'rake', '~> 10.0'
27
+ spec.add_development_dependency 'rspec', '~> 3.0'
28
+ spec.add_development_dependency 'rubocop', '~> 0.52.1'
29
+
30
+ spec.add_dependency 'base58', '~> 0.2.2'
31
+ end
@@ -0,0 +1,7 @@
1
+ machine:
2
+ ruby:
3
+ version: 2.3.5
4
+ test:
5
+ override:
6
+ - bundle exec rubocop
7
+ - bundle exec rspec --format documentation --out $CIRCLE_TEST_REPORTS/rspec/rspec.xml spec
@@ -0,0 +1,110 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>module CashAddr - RDoc Documentation</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "./";
11
+ var index_rel_prefix = "./";
12
+ </script>
13
+
14
+ <script src="./js/jquery.js"></script>
15
+ <script src="./js/darkfish.js"></script>
16
+
17
+ <link href="./css/fonts.css" rel="stylesheet">
18
+ <link href="./css/rdoc.css" rel="stylesheet">
19
+
20
+
21
+
22
+ <body id="top" role="document" class="module">
23
+ <nav role="navigation">
24
+ <div id="project-navigation">
25
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
26
+ <h2>
27
+ <a href="./index.html" rel="home">Home</a>
28
+ </h2>
29
+
30
+ <div id="table-of-contents-navigation">
31
+ <a href="./table_of_contents.html#pages">Pages</a>
32
+ <a href="./table_of_contents.html#classes">Classes</a>
33
+ <a href="./table_of_contents.html#methods">Methods</a>
34
+ </div>
35
+ </div>
36
+
37
+ <div id="search-section" role="search" class="project-section initially-hidden">
38
+ <form action="#" method="get" accept-charset="utf-8">
39
+ <div id="search-field-wrapper">
40
+ <input id="search-field" role="combobox" aria-label="Search"
41
+ aria-autocomplete="list" aria-controls="search-results"
42
+ type="text" name="search" placeholder="Search" spellcheck="false"
43
+ title="Type to search, Up and Down to navigate, Enter to load">
44
+ </div>
45
+
46
+ <ul id="search-results" aria-label="Search Results"
47
+ aria-busy="false" aria-expanded="false"
48
+ aria-atomic="false" class="initially-hidden"></ul>
49
+ </form>
50
+ </div>
51
+
52
+ </div>
53
+
54
+
55
+
56
+ <div id="class-metadata">
57
+
58
+
59
+
60
+
61
+
62
+ </div>
63
+ </nav>
64
+
65
+ <main role="main" aria-labelledby="module-CashAddr">
66
+ <h1 id="module-CashAddr" class="module">
67
+ module CashAddr
68
+ </h1>
69
+
70
+ <section class="description">
71
+
72
+ <p>Main module for the cash-addr gem.</p>
73
+
74
+ </section>
75
+
76
+
77
+ <section id="5Buntitled-5D" class="documentation-section">
78
+
79
+
80
+
81
+
82
+
83
+ <section class="constants-list">
84
+ <header>
85
+ <h3>Constants</h3>
86
+ </header>
87
+ <dl>
88
+
89
+ <dt id="VERSION">VERSION
90
+
91
+ <dd><p>Version of the cash-addr gem.</p>
92
+
93
+
94
+ </dl>
95
+ </section>
96
+
97
+
98
+
99
+
100
+
101
+ </section>
102
+ </main>
103
+
104
+
105
+ <footer id="validator-badges" role="contentinfo">
106
+ <p><a href="https://validator.w3.org/check/referer">Validate</a>
107
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.0.3.
108
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
109
+ </footer>
110
+
@@ -0,0 +1,277 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>class CashAddr::Converter - RDoc Documentation</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "../";
11
+ var index_rel_prefix = "../";
12
+ </script>
13
+
14
+ <script src="../js/jquery.js"></script>
15
+ <script src="../js/darkfish.js"></script>
16
+
17
+ <link href="../css/fonts.css" rel="stylesheet">
18
+ <link href="../css/rdoc.css" rel="stylesheet">
19
+
20
+
21
+
22
+ <body id="top" role="document" class="class">
23
+ <nav role="navigation">
24
+ <div id="project-navigation">
25
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
26
+ <h2>
27
+ <a href="../index.html" rel="home">Home</a>
28
+ </h2>
29
+
30
+ <div id="table-of-contents-navigation">
31
+ <a href="../table_of_contents.html#pages">Pages</a>
32
+ <a href="../table_of_contents.html#classes">Classes</a>
33
+ <a href="../table_of_contents.html#methods">Methods</a>
34
+ </div>
35
+ </div>
36
+
37
+ <div id="search-section" role="search" class="project-section initially-hidden">
38
+ <form action="#" method="get" accept-charset="utf-8">
39
+ <div id="search-field-wrapper">
40
+ <input id="search-field" role="combobox" aria-label="Search"
41
+ aria-autocomplete="list" aria-controls="search-results"
42
+ type="text" name="search" placeholder="Search" spellcheck="false"
43
+ title="Type to search, Up and Down to navigate, Enter to load">
44
+ </div>
45
+
46
+ <ul id="search-results" aria-label="Search Results"
47
+ aria-busy="false" aria-expanded="false"
48
+ aria-atomic="false" class="initially-hidden"></ul>
49
+ </form>
50
+ </div>
51
+
52
+ </div>
53
+
54
+
55
+
56
+ <div id="class-metadata">
57
+
58
+ <div id="parent-class-section" class="nav-section">
59
+ <h3>Parent</h3>
60
+
61
+
62
+ <p class="link">Object
63
+
64
+ </div>
65
+
66
+
67
+
68
+ <!-- Method Quickref -->
69
+ <div id="method-list-section" class="nav-section">
70
+ <h3>Methods</h3>
71
+
72
+ <ul class="link-list" role="directory">
73
+
74
+ <li ><a href="#method-c-display_address">::display_address</a>
75
+
76
+ <li ><a href="#method-c-is_valid-3F">::is_valid?</a>
77
+
78
+ <li ><a href="#method-c-to_cash_address">::to_cash_address</a>
79
+
80
+ <li ><a href="#method-c-to_legacy_address">::to_legacy_address</a>
81
+
82
+ </ul>
83
+ </div>
84
+
85
+ </div>
86
+ </nav>
87
+
88
+ <main role="main" aria-labelledby="class-CashAddr::Converter">
89
+ <h1 id="class-CashAddr::Converter" class="class">
90
+ class CashAddr::Converter
91
+ </h1>
92
+
93
+ <section class="description">
94
+
95
+ </section>
96
+
97
+
98
+ <section id="5Buntitled-5D" class="documentation-section">
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section">
109
+ <header>
110
+ <h3>Public Class Methods</h3>
111
+ </header>
112
+
113
+
114
+ <div id="method-c-display_address" class="method-detail ">
115
+
116
+ <div class="method-heading">
117
+ <span class="method-name">display_address</span><span
118
+ class="method-args">(address)</span>
119
+
120
+ <span class="method-click-advice">click to toggle source</span>
121
+
122
+ </div>
123
+
124
+
125
+ <div class="method-description">
126
+
127
+ <p>Displays an address as CashAddr format without the network prefix
128
+ (bitcoincash:)</p>
129
+
130
+ <p>@param address [String] A CashAddr or Legacy address</p>
131
+
132
+ <p>@return [String]</p>
133
+
134
+
135
+
136
+
137
+ <div class="method-source-code" id="display_address-source">
138
+ <pre><span class="ruby-comment"># File lib/cash_addr.rb, line 55</span>
139
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">display_address</span>(<span class="ruby-identifier">address</span>)
140
+ <span class="ruby-identifier">to_cash_address</span>(<span class="ruby-identifier">address</span>).<span class="ruby-identifier">split</span>(<span class="ruby-string">&#39;:&#39;</span>).<span class="ruby-identifier">last</span>.<span class="ruby-identifier">to_s</span>
141
+ <span class="ruby-keyword">end</span></pre>
142
+ </div>
143
+
144
+ </div>
145
+
146
+
147
+
148
+
149
+ </div>
150
+
151
+
152
+ <div id="method-c-is_valid-3F" class="method-detail ">
153
+
154
+ <div class="method-heading">
155
+ <span class="method-name">is_valid?</span><span
156
+ class="method-args">(address)</span>
157
+
158
+ <span class="method-click-advice">click to toggle source</span>
159
+
160
+ </div>
161
+
162
+
163
+ <div class="method-description">
164
+
165
+ <p>Checks if an address is a valid BCH address.</p>
166
+
167
+ <p>@param address [String] A CashAddr or Legacy address</p>
168
+
169
+ <p>@return [Boolean]</p>
170
+
171
+
172
+
173
+
174
+ <div class="method-source-code" id="is_valid-3F-source">
175
+ <pre><span class="ruby-comment"># File lib/cash_addr.rb, line 41</span>
176
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">is_valid?</span>(<span class="ruby-identifier">address</span>)
177
+ <span class="ruby-constant">CashAddr</span><span class="ruby-operator">::</span><span class="ruby-constant">Address</span>.<span class="ruby-identifier">from_string</span>(<span class="ruby-identifier">address</span>)
178
+ <span class="ruby-keyword">true</span>
179
+ <span class="ruby-keyword">rescue</span> <span class="ruby-constant">CashAddr</span><span class="ruby-operator">::</span><span class="ruby-constant">InvalidAddress</span>
180
+ <span class="ruby-keyword">false</span>
181
+ <span class="ruby-keyword">end</span></pre>
182
+ </div>
183
+
184
+ </div>
185
+
186
+
187
+
188
+
189
+ </div>
190
+
191
+
192
+ <div id="method-c-to_cash_address" class="method-detail ">
193
+
194
+ <div class="method-heading">
195
+ <span class="method-name">to_cash_address</span><span
196
+ class="method-args">(address)</span>
197
+
198
+ <span class="method-click-advice">click to toggle source</span>
199
+
200
+ </div>
201
+
202
+
203
+ <div class="method-description">
204
+
205
+ <p>Converts an address to CashAddr format.</p>
206
+
207
+ <p>@param address [String] A CashAddr or Legacy address</p>
208
+
209
+ <p>@return [String]</p>
210
+
211
+
212
+
213
+
214
+ <div class="method-source-code" id="to_cash_address-source">
215
+ <pre><span class="ruby-comment"># File lib/cash_addr.rb, line 21</span>
216
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">to_cash_address</span>(<span class="ruby-identifier">address</span>)
217
+ <span class="ruby-constant">CashAddr</span><span class="ruby-operator">::</span><span class="ruby-constant">Address</span>.<span class="ruby-identifier">from_string</span>(<span class="ruby-identifier">address</span>).<span class="ruby-identifier">cash_address</span>
218
+ <span class="ruby-keyword">end</span></pre>
219
+ </div>
220
+
221
+ </div>
222
+
223
+
224
+
225
+
226
+ </div>
227
+
228
+
229
+ <div id="method-c-to_legacy_address" class="method-detail ">
230
+
231
+ <div class="method-heading">
232
+ <span class="method-name">to_legacy_address</span><span
233
+ class="method-args">(address)</span>
234
+
235
+ <span class="method-click-advice">click to toggle source</span>
236
+
237
+ </div>
238
+
239
+
240
+ <div class="method-description">
241
+
242
+ <p>Converts an address to Legacy format.</p>
243
+
244
+ <p>@param address [String] A CashAddr or Legacy address</p>
245
+
246
+ <p>@return [String]</p>
247
+
248
+
249
+
250
+
251
+ <div class="method-source-code" id="to_legacy_address-source">
252
+ <pre><span class="ruby-comment"># File lib/cash_addr.rb, line 31</span>
253
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">to_legacy_address</span>(<span class="ruby-identifier">address</span>)
254
+ <span class="ruby-constant">CashAddr</span><span class="ruby-operator">::</span><span class="ruby-constant">Address</span>.<span class="ruby-identifier">from_string</span>(<span class="ruby-identifier">address</span>).<span class="ruby-identifier">legacy_address</span>
255
+ <span class="ruby-keyword">end</span></pre>
256
+ </div>
257
+
258
+ </div>
259
+
260
+
261
+
262
+
263
+ </div>
264
+
265
+
266
+ </section>
267
+
268
+ </section>
269
+ </main>
270
+
271
+
272
+ <footer id="validator-badges" role="contentinfo">
273
+ <p><a href="https://validator.w3.org/check/referer">Validate</a>
274
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.0.3.
275
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
276
+ </footer>
277
+