cardano_wallet 0.1.3 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18f7c7b3b86013c1d54155e315cc55618607d3966fed126a32041f59db989e43
4
- data.tar.gz: 327110f84584c66842d1fd2d5fd89e55711a01c5372b93585763f7dac0eb3a19
3
+ metadata.gz: ebc7d4ddc02947d49ab653cfc6e1a86a09ff4e8cf7efb33921a1418a855dc68a
4
+ data.tar.gz: 187877c6fe0fa07d231676f2140a93e30bf2934e325fa9761df63e72a3c85476
5
5
  SHA512:
6
- metadata.gz: 591537d49cd9665a1e162435e6e72e6fe41b2515e47dde9a0894e1593572efcab01fb567879fe3bbc7a75050397fbce1a40b67687b6d7745cccd0be40268ebc9
7
- data.tar.gz: 4fe2f473246fafb52bde69d8c85b9140a66fd40bc024a8307dde779fbe291a6a7aa9fa89f396ec3c65c0c47d63eaa457fb5f2db20bea0ad7dda0752f6a225795
6
+ metadata.gz: f4956699eb0dc284137b84f7aa53bc38f2fd6b7bed5e0f7793d6c4ec30b692f3f45160db173c175a2421cc889bb2d1d5861c7c5431dd1f924f38fb3d2e7245a2
7
+ data.tar.gz: d0d63600ec42d8b59fb4f6f5bdf29e88c5e7aa42209b854d5a3da3cea84994f93dd3df5165ae46dd89ec1581137e7f6dfec779fb8d5b1e5fb1b114be548055c5
@@ -2,7 +2,7 @@ name: Nightly
2
2
 
3
3
  on:
4
4
  schedule:
5
- - cron: "0 21 * * *"
5
+ - cron: "0 23 * * *"
6
6
 
7
7
  jobs:
8
8
  test:
@@ -12,7 +12,7 @@ jobs:
12
12
  steps:
13
13
  - uses: actions/checkout@v2
14
14
  - name: Set up cardano-wallet
15
- run: NODE_CONFIG_PATH=`pwd`/spec/shelley-testnet docker-compose -f docker-compose-shelley.yml up --detach
15
+ run: NODE_CONFIG_PATH=`pwd`/spec/testnet docker-compose -f docker-compose-shelley.yml up --detach
16
16
  - name: Set up Ruby
17
17
  # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
18
18
  # change this to (see https://github.com/ruby/setup-ruby#versioning):
@@ -24,11 +24,11 @@ jobs:
24
24
  run: bundle install
25
25
  - name: Wait until node is synced
26
26
  run: bundle exec rake wait_until_node_synced
27
- - name: Run all tests
28
- run: bundle exec rspec
27
+ - name: Run all tests (temporarily without nightly)
28
+ run: bundle exec rspec . -t ~nightly
29
29
  env:
30
30
  CI: true
31
31
  CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
32
32
  NETWORK: testnet
33
33
  WALLET: dev-master-shelley
34
- NODE: master
34
+ NODE: 1.18.0
@@ -21,7 +21,7 @@ jobs:
21
21
  steps:
22
22
  - uses: actions/checkout@v2
23
23
  - name: Set up cardano-wallet
24
- run: NODE_CONFIG_PATH=`pwd`/spec/shelley-testnet docker-compose -f docker-compose-shelley.yml up --detach
24
+ run: NODE_CONFIG_PATH=`pwd`/spec/testnet docker-compose -f docker-compose-shelley.yml up --detach
25
25
  - name: Set up Ruby
26
26
  # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
27
27
  # change this to (see https://github.com/ruby/setup-ruby#versioning):
@@ -38,4 +38,4 @@ jobs:
38
38
  CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
39
39
  NETWORK: testnet
40
40
  WALLET: dev-master-shelley
41
- NODE: master
41
+ NODE: 1.18.0
@@ -3,12 +3,11 @@ version: "3.5"
3
3
  services:
4
4
  cardano-node:
5
5
  image: inputoutput/cardano-node:${NODE}
6
- environment:
7
- NETWORK:
8
6
  volumes:
9
7
  - node-db:/data
10
8
  - node-ipc:/ipc
11
- - ${NODE_CONFIG_PATH}:/configuration
9
+ - ${NODE_CONFIG_PATH}:/config
10
+ command: run --socket-path /ipc/node.socket --config /config/${NETWORK}-config.json --topology /config/${NETWORK}-topology.json --database-path /data
12
11
  restart: on-failure
13
12
 
14
13
  cardano-wallet:
@@ -19,8 +18,7 @@ services:
19
18
  - ${NODE_CONFIG_PATH}:/config
20
19
  ports:
21
20
  - 8090:8090
22
- entrypoint: []
23
- command: cardano-wallet-shelley serve --testnet /config/ff-genesis.json --node-socket /ipc/node.socket --database /wallet-db --listen-address 0.0.0.0
21
+ command: serve --testnet /config/${NETWORK}-byron-genesis.json --node-socket /ipc/node.socket --database /wallet-db --listen-address 0.0.0.0
24
22
  restart: on-failure
25
23
 
26
24
  volumes:
@@ -22,6 +22,12 @@ module CardanoWallet
22
22
  Addresses.new @opt
23
23
  end
24
24
 
25
+ # API for CoinSelections
26
+ # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Byron-Coin-Selections
27
+ def coin_selections
28
+ CoinSelections.new @opt
29
+ end
30
+
25
31
  # Get API for Byron transactions
26
32
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/postByronTransactionFee
27
33
  def transactions
@@ -152,6 +158,36 @@ module CardanoWallet
152
158
  self.class.put("/byron-wallets/#{wid}/addresses/#{addr_id}")
153
159
  end
154
160
 
161
+ # Import addresses to Byron wallet.
162
+ # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/importAddresses
163
+ # @param wid [String] wallet id
164
+ # @param addresses [Array] array of addresses
165
+ def bulk_import(wid, addresses)
166
+ self.class.put("/byron-wallets/#{wid}/addresses",
167
+ :body => { :addresses => addresses
168
+ }.to_json,
169
+ :headers => { 'Content-Type' => 'application/json' } )
170
+ end
171
+ end
172
+
173
+ # API for CoinSelections
174
+ # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Byron-Coin-Selections
175
+ class CoinSelections < Base
176
+ def initialize opt
177
+ super
178
+ end
179
+
180
+ # Show random coin selection for particular payment
181
+ # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/byronSelectCoins
182
+ #
183
+ # @example
184
+ # random(wid, {address1: 123, address2: 456})
185
+ def random(wid, payments)
186
+ payments_formatted = Utils.format_payments(payments)
187
+ self.class.post("/byron-wallets/#{wid}/coin-selections/random",
188
+ :body => {:payments => payments_formatted}.to_json,
189
+ :headers => { 'Content-Type' => 'application/json' })
190
+ end
155
191
  end
156
192
 
157
193
  # Byron transactions
@@ -161,6 +197,12 @@ module CardanoWallet
161
197
  super
162
198
  end
163
199
 
200
+ # Get tx by id
201
+ # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getByronTransaction
202
+ def get(wid, tx_id)
203
+ self.class.get("/byron-wallets/#{wid}/transactions/#{tx_id}")
204
+ end
205
+
164
206
  # List all Byron wallet's transactions.
165
207
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/listByronTransactions
166
208
  #
@@ -174,6 +174,12 @@ module CardanoWallet
174
174
  super
175
175
  end
176
176
 
177
+ # Get tx by id
178
+ # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getTransaction
179
+ def get(wid, tx_id)
180
+ self.class.get("/wallets/#{wid}/transactions/#{tx_id}")
181
+ end
182
+
177
183
  # List all wallet's transactions
178
184
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/listTransactions
179
185
  #
@@ -189,17 +195,27 @@ module CardanoWallet
189
195
  # @param wid [String] source wallet id
190
196
  # @param passphrase [String] source wallet's passphrase
191
197
  # @param payments [Hash] addres, amount pair
198
+ # @param withdrawal [Strin or Array] 'self' or mnemonic sentence
192
199
  #
193
200
  # @example
194
- # create(wid, passphrase, {addr1: 1000000})
195
- def create(wid, passphrase, payments)
201
+ # create(wid, passphrase, {addr1: 1000000}, 'self')
202
+ def create(wid, passphrase, payments, withdrawal = nil)
196
203
  payments_formatted = Utils.format_payments(payments)
204
+
205
+ if withdrawal
206
+ payload = { :payments => payments_formatted,
207
+ :passphrase => passphrase,
208
+ :withdrawal => withdrawal,
209
+ }
210
+ else
211
+ payload = { :payments => payments_formatted,
212
+ :passphrase => passphrase
213
+ }
214
+ end
215
+
197
216
  self.class.post("/wallets/#{wid}/transactions",
198
- :body => { :payments => payments_formatted,
199
- :passphrase => passphrase
200
- }.to_json,
217
+ :body => payload.to_json,
201
218
  :headers => { 'Content-Type' => 'application/json' } )
202
-
203
219
  end
204
220
 
205
221
  # Estimate fees for transaction
@@ -207,10 +223,19 @@ module CardanoWallet
207
223
  #
208
224
  # @example
209
225
  # payment_fees(wid, {addr1: 1000000})
210
- def payment_fees(wid, payments)
226
+ def payment_fees(wid, payments, withdrawal = nil)
211
227
  payments_formatted = Utils.format_payments(payments)
228
+
229
+ if withdrawal
230
+ payload = { :payments => payments_formatted,
231
+ :withdrawal => withdrawal
232
+ }
233
+ else
234
+ payload = { :payments => payments_formatted }
235
+ end
236
+
212
237
  self.class.post("/wallets/#{wid}/payment-fees",
213
- :body => { :payments => payments_formatted }.to_json,
238
+ :body => payload.to_json,
214
239
  :headers => { 'Content-Type' => 'application/json' } )
215
240
  end
216
241
 
@@ -1,3 +1,3 @@
1
1
  module CardanoWallet
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.8"
3
3
  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.1.3
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Stachyra
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-18 00:00:00.000000000 Z
11
+ date: 2020-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty