cardano_wallet 0.3.2 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -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, "argument should be Hash" unless param.is_a?(Hash)
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, "argument should be Array" unless param.is_a?(Array)
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"}}, {:address=>"addr2", :amount=>{:quantity=>2, :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
- raise ArgumentError, "argument should be Array of single Hashes" unless payments.all?{|p| p.size == 1 && p.is_a?(Hash)}
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
- {:address => addr.to_s,
21
- :amount => {:quantity => amt.to_i,
22
- :unit => "lovelace"}
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module CardanoWallet
2
- VERSION = "0.3.2"
4
+ VERSION = '0.3.7'
3
5
  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.3.2
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Stachyra
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-18 00:00:00.000000000 Z
11
+ date: 2021-05-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: rake
28
+ name: bip_mnemonic
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '12.3'
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: '12.3'
40
+ version: 0.0.4
41
41
  - !ruby/object:Gem::Dependency
42
- name: rspec
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.7'
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.7'
68
+ version: '12.3'
55
69
  - !ruby/object:Gem::Dependency
56
- name: bip_mnemonic
70
+ name: rspec
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: 0.0.4
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: 0.0.4
82
+ version: '3.7'
69
83
  - !ruby/object:Gem::Dependency
70
- name: codecov
84
+ name: rubocop
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - '='
87
+ - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: 0.2.8
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: 0.2.8
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-shelley.yml
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.3.0
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.2.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,74 +0,0 @@
1
- name: Nightly
2
-
3
- on:
4
- schedule:
5
- - cron: "0 23 * * *"
6
- workflow_dispatch:
7
- inputs:
8
- nodeTag:
9
- description: 'Node tag (docker)'
10
- required: true
11
- default: '1.24.2'
12
- walletTag:
13
- description: 'Wallet tag (docker)'
14
- required: true
15
- default: 'dev-master-shelley'
16
-
17
- jobs:
18
- test:
19
-
20
- runs-on: ubuntu-latest
21
-
22
- steps:
23
- - uses: actions/checkout@v2
24
-
25
- - name: Cache node db
26
- id: cache
27
- uses: actions/cache@v2
28
- with:
29
- path: ~/node-db-nightly-docker
30
- key: ${{ runner.os }}-node-db-nightly-docker-tests-${{ hashFiles('**/protocolMagicId') }}
31
-
32
- - name: Set up cardano-wallet and cardano-node MANUAL
33
- if: ${{ github.event.inputs.walletTag != '' && github.event.inputs.nodeTag != ''}}
34
- env:
35
- WALLET: ${{ github.event.inputs.walletTag }}
36
- NODE: ${{ github.event.inputs.nodeTag }}
37
- run: |
38
- echo "Wallet: $WALLET"
39
- echo "Node: $NODE"
40
- NODE_CONFIG_PATH=`pwd`/spec/testnet docker-compose -f docker-compose-shelley.yml up --detach
41
- docker run --rm inputoutput/cardano-wallet:$WALLET version
42
- docker run --rm inputoutput/cardano-node:$NODE version
43
- ls ~/node-db-nightly-docker
44
-
45
- - name: Set up cardano-wallet and cardano-node NIGHTLY
46
- if: ${{ github.event.inputs.walletTag == '' && github.event.inputs.nodeTag == ''}}
47
- run: |
48
- echo "Wallet: $WALLET"
49
- echo "Node: $NODE"
50
- NODE_CONFIG_PATH=`pwd`/spec/testnet docker-compose -f docker-compose-shelley.yml up --detach
51
- docker run --rm inputoutput/cardano-wallet:$WALLET version
52
- docker run --rm inputoutput/cardano-node:$NODE version
53
- ls ~/node-db-nightly-docker
54
-
55
- - name: Set up Ruby
56
- uses: ruby/setup-ruby@v1
57
-
58
- - name: Install dependencies
59
- run: bundle install
60
-
61
- - name: Wait until node is synced
62
- run: bundle exec rake wait_until_node_synced
63
-
64
- - name: Run all tests
65
- run: bundle exec rspec .
66
-
67
- - name: Stop docker-compose
68
- run: NODE_CONFIG_PATH=`pwd`/spec/testnet docker-compose -f docker-compose-shelley.yml down
69
- env:
70
- CI: true
71
- CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
72
- NETWORK: testnet
73
- WALLET: dev-master-shelley
74
- NODE: 1.25.1