cardano_wallet 0.2.9 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +24 -11
- data/.gitignore +4 -0
- data/.rubocop.yml +24 -0
- data/Gemfile +3 -1
- data/README.md +9 -25
- data/Rakefile +30 -10
- data/bin/console +4 -3
- data/bin/run_all_tests +6 -0
- data/cardano_wallet.gemspec +20 -18
- data/dev +1 -1
- data/{docker-compose-shelley.yml → docker-compose.yml} +1 -2
- data/lib/cardano_wallet.rb +12 -7
- data/lib/cardano_wallet/base.rb +13 -6
- data/lib/cardano_wallet/byron.rb +84 -66
- data/lib/cardano_wallet/misc.rb +25 -44
- data/lib/cardano_wallet/shared.rb +76 -0
- data/lib/cardano_wallet/shelley.rb +111 -88
- data/lib/cardano_wallet/utils.rb +14 -10
- data/lib/cardano_wallet/version.rb +3 -1
- metadata +34 -18
- data/.github/workflows/nightly.yml +0 -29
data/lib/cardano_wallet/utils.rb
CHANGED
@@ -1,26 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module CardanoWallet
|
4
|
+
##
|
5
|
+
# General Utils not connected to API
|
2
6
|
module Utils
|
3
|
-
|
4
7
|
def self.verify_param_is_hash!(param)
|
5
|
-
raise ArgumentError,
|
8
|
+
raise ArgumentError, 'argument should be Hash' unless param.is_a?(Hash)
|
6
9
|
end
|
7
10
|
|
8
11
|
def self.verify_param_is_array!(param)
|
9
|
-
raise ArgumentError,
|
12
|
+
raise ArgumentError, 'argument should be Array' unless param.is_a?(Array)
|
10
13
|
end
|
11
14
|
|
12
15
|
##
|
13
16
|
# @param payments [Array of Hashes] - [{addr1: 1}, {addr2: 2}]
|
14
|
-
# @return [Array of Hashes] - [{:address=>"addr1", :amount=>{:quantity=>1, :unit=>"lovelace"}}, {
|
17
|
+
# @return [Array of Hashes] - [{:address=>"addr1", :amount=>{:quantity=>1, :unit=>"lovelace"}}, {...}}]
|
15
18
|
def self.format_payments(payments)
|
16
19
|
verify_param_is_array!(payments)
|
17
|
-
|
20
|
+
unless payments.all? { |p| p.size == 1 && p.is_a?(Hash) }
|
21
|
+
raise ArgumentError, 'argument should be Array of single Hashes'
|
22
|
+
end
|
23
|
+
|
18
24
|
payments.map do |p|
|
19
25
|
a = p.collect do |addr, amt|
|
20
|
-
{:
|
21
|
-
|
22
|
-
|
23
|
-
}
|
26
|
+
{ address: addr.to_s,
|
27
|
+
amount: { quantity: amt.to_i,
|
28
|
+
unit: 'lovelace' } }
|
24
29
|
end.flatten
|
25
30
|
Hash[*a]
|
26
31
|
end
|
@@ -33,6 +38,5 @@ module CardanoWallet
|
|
33
38
|
end.join '&'
|
34
39
|
"?#{q}"
|
35
40
|
end
|
36
|
-
|
37
41
|
end
|
38
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cardano_wallet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Stachyra
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -25,61 +25,75 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.18.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: bip_mnemonic
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 0.0.4
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 0.0.4
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: codecov
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.2.8
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.2.8
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3
|
61
|
+
version: '12.3'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3
|
68
|
+
version: '12.3'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
70
|
+
name: rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
75
|
+
version: '3.7'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
82
|
+
version: '3.7'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
84
|
+
name: rubocop
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
89
|
+
version: '1.11'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
94
|
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
96
|
+
version: '1.11'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: simplecov
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -102,11 +116,11 @@ extensions: []
|
|
102
116
|
extra_rdoc_files: []
|
103
117
|
files:
|
104
118
|
- ".github/workflows/gem-push.yml"
|
105
|
-
- ".github/workflows/nightly.yml"
|
106
119
|
- ".github/workflows/tests.yml"
|
107
120
|
- ".gitignore"
|
108
121
|
- ".rakeTasks"
|
109
122
|
- ".rspec"
|
123
|
+
- ".rubocop.yml"
|
110
124
|
- ".ruby-version"
|
111
125
|
- CODE_OF_CONDUCT.md
|
112
126
|
- Gemfile
|
@@ -114,14 +128,16 @@ files:
|
|
114
128
|
- README.md
|
115
129
|
- Rakefile
|
116
130
|
- bin/console
|
131
|
+
- bin/run_all_tests
|
117
132
|
- bin/setup
|
118
133
|
- cardano_wallet.gemspec
|
119
134
|
- dev
|
120
|
-
- docker-compose
|
135
|
+
- docker-compose.yml
|
121
136
|
- lib/cardano_wallet.rb
|
122
137
|
- lib/cardano_wallet/base.rb
|
123
138
|
- lib/cardano_wallet/byron.rb
|
124
139
|
- lib/cardano_wallet/misc.rb
|
140
|
+
- lib/cardano_wallet/shared.rb
|
125
141
|
- lib/cardano_wallet/shelley.rb
|
126
142
|
- lib/cardano_wallet/utils.rb
|
127
143
|
- lib/cardano_wallet/version.rb
|
@@ -141,14 +157,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
141
157
|
requirements:
|
142
158
|
- - ">="
|
143
159
|
- !ruby/object:Gem::Version
|
144
|
-
version: 2.
|
160
|
+
version: 2.7.0
|
145
161
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
162
|
requirements:
|
147
163
|
- - ">="
|
148
164
|
- !ruby/object:Gem::Version
|
149
165
|
version: '0'
|
150
166
|
requirements: []
|
151
|
-
rubygems_version: 3.
|
167
|
+
rubygems_version: 3.2.15
|
152
168
|
signing_key:
|
153
169
|
specification_version: 4
|
154
170
|
summary: Ruby wrapper over cardano-wallet.
|
@@ -1,29 +0,0 @@
|
|
1
|
-
name: Nightly
|
2
|
-
|
3
|
-
on:
|
4
|
-
schedule:
|
5
|
-
- cron: "0 23 * * *"
|
6
|
-
|
7
|
-
jobs:
|
8
|
-
test:
|
9
|
-
|
10
|
-
runs-on: ubuntu-latest
|
11
|
-
|
12
|
-
steps:
|
13
|
-
- uses: actions/checkout@v2
|
14
|
-
- name: Set up cardano-wallet
|
15
|
-
run: NODE_CONFIG_PATH=`pwd`/spec/testnet docker-compose -f docker-compose-shelley.yml up --detach
|
16
|
-
- name: Set up Ruby
|
17
|
-
uses: ruby/setup-ruby@v1
|
18
|
-
- name: Install dependencies
|
19
|
-
run: bundle install
|
20
|
-
- name: Wait until node is synced
|
21
|
-
run: bundle exec rake wait_until_node_synced
|
22
|
-
- name: Run all tests
|
23
|
-
run: bundle exec rspec .
|
24
|
-
env:
|
25
|
-
CI: true
|
26
|
-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
27
|
-
NETWORK: testnet
|
28
|
-
WALLET: dev-master-shelley
|
29
|
-
NODE: 1.21.1
|