abigen 0.0.1 → 0.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/README.md +18 -4
- data/Rakefile +5 -3
- data/lib/abigen.rb +4 -97
- metadata +37 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a948cfdd420f7932b5c5de6874ebef9ab871156414d4d2651ab37ff31a23a66
|
4
|
+
data.tar.gz: b64a28f7fd83a273dfad24388dabc365f7804ed0df394633cc3da3be179fdf08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf7be52392d9df4ca66e08253d706bfedaa91731b458a41ea4b08150968ba69073777f637fcd341c9fe9c7ecf0aa2c91658825b527f2326911a274b97b4ac550
|
7
|
+
data.tar.gz: 190826558f10b3f9845a5461016186be1f1d12f42b12c09527e02d188b210f35a7732d52d47f8e786964bc99d724feee5450990e8cf855174bdf2f1b149c921e
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# abigen
|
2
2
|
|
3
|
-
abigen -
|
3
|
+
abigen - "high-level" all-in-one umbrella quick starter gem for easy installation & usage application binary interface (abi) code or doc(umentation) gen(eration) for ethereum & co.
|
4
4
|
|
5
5
|
|
6
6
|
* home :: [github.com/rubycocos/blockchain](https://github.com/rubycocos/blockchain)
|
@@ -10,9 +10,23 @@ abigen - generate ready-to-use (blockchain) contract services / function calls f
|
|
10
10
|
|
11
11
|
|
12
12
|
|
13
|
-
##
|
13
|
+
## Download & Install The Ruby Package(s)
|
14
14
|
|
15
|
-
To
|
15
|
+
To install use the ruby package manager (also known as rubygems):
|
16
|
+
|
17
|
+
```
|
18
|
+
$ gem install abigen
|
19
|
+
```
|
20
|
+
|
21
|
+
|
22
|
+
### Gems
|
23
|
+
|
24
|
+
For now ethers includes / bundles-up:
|
25
|
+
|
26
|
+
|
27
|
+
- [abi2ruby](../abi2ruby) - generate ready-to-use (blockchain) contract services / function calls for ethereum & co. via application binary inferfaces (abis)
|
28
|
+
- [abi2sol](../abi2sol) - command-line tool for application binary interface (abi) to solidity (contract) source code generation for Ethereum & Co.
|
29
|
+
- [abidoc](../abidoc) - application binary interface (abi) documentation generator for Ethereum & Co. (blockchain) contracts
|
16
30
|
|
17
31
|
|
18
32
|
|
data/Rakefile
CHANGED
@@ -3,8 +3,8 @@ require 'hoe'
|
|
3
3
|
|
4
4
|
Hoe.spec 'abigen' do
|
5
5
|
|
6
|
-
self.version = '0.
|
7
|
-
self.summary = "
|
6
|
+
self.version = '0.1.1'
|
7
|
+
self.summary = '"high-level" all-in-one umbrella quick starter gem for easy installation & usage application binary interface (abi) code or doc(umentation) gen(eration) for ethereum & co.'
|
8
8
|
self.description = summary
|
9
9
|
|
10
10
|
self.urls = { home: 'https://github.com/rubycocos/blockchain' }
|
@@ -17,7 +17,9 @@ Hoe.spec 'abigen' do
|
|
17
17
|
self.history_file = 'CHANGELOG.md'
|
18
18
|
|
19
19
|
self.extra_deps = [
|
20
|
-
['
|
20
|
+
['abi2ruby'],
|
21
|
+
['abi2sol'],
|
22
|
+
['abidoc'],
|
21
23
|
]
|
22
24
|
|
23
25
|
self.licenses = ['Public Domain']
|
data/lib/abigen.rb
CHANGED
@@ -1,99 +1,6 @@
|
|
1
|
-
|
1
|
+
## all-in-one prelude/prolog
|
2
2
|
|
3
|
+
require 'abi2ruby'
|
4
|
+
require 'abi2sol'
|
5
|
+
require 'abidoc'
|
3
6
|
|
4
|
-
## our own code
|
5
|
-
## require_relative 'abidoc/version' # note: let version always go first
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
module ABI
|
10
|
-
class Contract
|
11
|
-
|
12
|
-
|
13
|
-
def generate_code( name: 'Contract', address: nil )
|
14
|
-
buf = ''
|
15
|
-
buf << "#########################\n"
|
16
|
-
buf << "# #{name} contract / (blockchain) services / function calls\n"
|
17
|
-
buf << "# auto-generated via abigen (see https://rubygems.org/gems/abigen) on #{Time.now.utc}\n"
|
18
|
-
buf << "# - #{query_functions.size} query functions(s)\n\n"
|
19
|
-
|
20
|
-
|
21
|
-
buf << "class #{name} < Ethlite::Contract\n\n"
|
22
|
-
|
23
|
-
if address
|
24
|
-
buf << " address "
|
25
|
-
buf << %Q{"#{address}"}
|
26
|
-
buf << "\n"
|
27
|
-
end
|
28
|
-
|
29
|
-
|
30
|
-
if query_functions.size > 0
|
31
|
-
buf << "\n"
|
32
|
-
query_functions.each do |func|
|
33
|
-
buf << "# #{func.doc} _readonly_\n"
|
34
|
-
|
35
|
-
buf << %Q{sig "#{func.name}"}
|
36
|
-
|
37
|
-
if func.inputs.size > 0
|
38
|
-
quoted_types = func.inputs.map {|param| %Q{"#{param.sig}"} }
|
39
|
-
buf << ", inputs: [#{quoted_types.join(',')}]"
|
40
|
-
end
|
41
|
-
|
42
|
-
if func.outputs.size > 0
|
43
|
-
quoted_types = func.outputs.map {|param| %Q{"#{param.sig}"} }
|
44
|
-
buf << ", outputs: [#{quoted_types.join(',')}]"
|
45
|
-
end
|
46
|
-
buf << "\n"
|
47
|
-
|
48
|
-
buf << "def #{func.name}("
|
49
|
-
|
50
|
-
func.inputs.each_with_index do |param,i|
|
51
|
-
buf << ", " if i > 0
|
52
|
-
if param.name
|
53
|
-
buf << "#{param.name}"
|
54
|
-
else
|
55
|
-
buf << "arg#{i}"
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
buf << ")\n"
|
60
|
-
|
61
|
-
buf << " do_call("
|
62
|
-
buf << %Q{"#{func.name}"}
|
63
|
-
|
64
|
-
func.inputs.each_with_index do |param,i|
|
65
|
-
buf << ", "
|
66
|
-
if param.name
|
67
|
-
buf << "#{param.name}"
|
68
|
-
else
|
69
|
-
buf << "arg#{i}"
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
buf << ")\n"
|
74
|
-
|
75
|
-
buf << "end\n"
|
76
|
-
buf << "\n"
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
|
81
|
-
### todo: add (pure) helper functions too!!!
|
82
|
-
=begin
|
83
|
-
if helper_functions.size > 0
|
84
|
-
buf << "\n"
|
85
|
-
buf << "# #{helper_functions.size} Helper Functions(s)\n\n"
|
86
|
-
helper_functions.each do |func|
|
87
|
-
buf << "# - #{func.doc}\n"
|
88
|
-
## buf << " - sig #{func.sig} => 0x#{sig(func.sig).hexdigest}\n"
|
89
|
-
end
|
90
|
-
end
|
91
|
-
=end
|
92
|
-
|
93
|
-
buf << "end ## class #{name}\n"
|
94
|
-
buf << "\n"
|
95
|
-
buf
|
96
|
-
end
|
97
|
-
|
98
|
-
end ## class Contract
|
99
|
-
end ## module ABI
|
metadata
CHANGED
@@ -1,17 +1,45 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: abigen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: abi2ruby
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: abi2sol
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: abidoc
|
15
43
|
requirement: !ruby/object:Gem::Requirement
|
16
44
|
requirements:
|
17
45
|
- - ">="
|
@@ -58,8 +86,9 @@ dependencies:
|
|
58
86
|
- - "~>"
|
59
87
|
- !ruby/object:Gem::Version
|
60
88
|
version: '3.23'
|
61
|
-
description:
|
62
|
-
|
89
|
+
description: '"high-level" all-in-one umbrella quick starter gem for easy installation
|
90
|
+
& usage application binary interface (abi) code or doc(umentation) gen(eration)
|
91
|
+
for ethereum & co.'
|
63
92
|
email: wwwmake@googlegroups.com
|
64
93
|
executables: []
|
65
94
|
extensions: []
|
@@ -97,6 +126,7 @@ requirements: []
|
|
97
126
|
rubygems_version: 3.3.7
|
98
127
|
signing_key:
|
99
128
|
specification_version: 4
|
100
|
-
summary:
|
101
|
-
|
129
|
+
summary: '"high-level" all-in-one umbrella quick starter gem for easy installation
|
130
|
+
& usage application binary interface (abi) code or doc(umentation) gen(eration)
|
131
|
+
for ethereum & co.'
|
102
132
|
test_files: []
|