cardano_wallet 0.1.0 → 0.1.1

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: a6e3c345e2c100428cf2bdd638ee903c9df401760a78e75bc531f48d8d2832e3
4
- data.tar.gz: d11fd3e81378d4ff2d4687d16ebe3cdcfa78cf33d342d2d907ac8b8ab374c70b
3
+ metadata.gz: 8bee737961a137776d1544ee46ea7e4866ef2dd78bb0a8de1808e34cd3b0f97b
4
+ data.tar.gz: cc36f525ddd0e0106ef22536797f7ee1ac3eba66ff6b587fe3074ad6c6ec16d4
5
5
  SHA512:
6
- metadata.gz: a2a32cd78ee9ec09f814b1bb9eca9786327b2da53e82da90067aaa9cca6c7a9d146b9d120115173e0e17e4f154c6d3cdf3c6ba7cbe228ce07f53dc7b435a5d88
7
- data.tar.gz: 5b2f5263447204632e7d80d8a9e15186a19fa7d33e40ee1a74651c0982aa799157a3b42455ea75aff25cd38db2ba8fea1609506f1ac2689dee3bc31911b950eb
6
+ metadata.gz: 9f4a2a58cc93aa312ad88fda33ed5d34a83834bf38dbf4a4237ec0a923384341089fe942166bf7a93f4f58df22817255777f19237dfdabc5d94e5c44bf71a2c7
7
+ data.tar.gz: ab96b3386eaa674fdff19072f78e1d6016ef37d67f4904570a82ab453c771b89d1441e6fb03ec80b8d159300f43af7116fa7fe11e1bcf8845705d3755d32fd37
data/README.md CHANGED
@@ -1,3 +1,6 @@
1
+ <a href="https://badge.fury.io/rb/cardano_wallet">
2
+ <img src="https://badge.fury.io/rb/cardano_wallet.svg" alt="Gem Version">
3
+ </a>
1
4
  <a href="https://github.com/piotr-iohk/cardano-wallet-rb/releases">
2
5
  <img src="https://img.shields.io/github/release/piotr-iohk/cardano-wallet-rb.svg" />
3
6
  </a>
@@ -28,6 +31,12 @@ Or install it yourself as:
28
31
 
29
32
  $ gem install cardano_wallet
30
33
 
34
+ ## Documentation
35
+
36
+ For ruby doc see: https://rubydoc.info/gems/cardano_wallet.
37
+
38
+ For `cardano-wallet` REST Api see: https://input-output-hk.github.io/cardano-wallet/api/edge/.
39
+
31
40
  ## Usage
32
41
 
33
42
  ### Initialize
@@ -42,8 +51,10 @@ CW2 = CardanoWallet.new({port: 443,
42
51
  protocol: "https",
43
52
  cacert: "/root/ca.cert",
44
53
  pem: "/root/client.pem"})
54
+ CW3 = CardanoWallet.new({url: "http://localhost:8090/v2"})
45
55
  ```
46
- ### Excercise the API
56
+
57
+ ### Exercise
47
58
  ```ruby
48
59
  CW = CardanoWallet.new
49
60
 
@@ -59,8 +70,8 @@ end
59
70
 
60
71
  #Shelley
61
72
  w = SHELLEY.wallets.create{name: "Wallet1",
62
- mnemonic_sentence: %w[vintage poem topic machine hazard cement dune glimpse fix brief account badge mass silly business],
63
- passphrase: "Secure Passphrase"}
73
+ mnemonic_sentence: %w[vintage poem topic machine hazard cement dune glimpse fix brief account badge mass silly business],
74
+ passphrase: "Secure Passphrase"}
64
75
 
65
76
  SHELLEY.wallets.get(w['id'])
66
77
 
@@ -72,7 +83,7 @@ MISC.network.clock
72
83
  PROXY.submit_external_transaction(File.new("/tmp/blob.bin").read)
73
84
  ```
74
85
 
75
- Refer to documentation.
86
+ Refer to [documentation](https://rubydoc.info/gems/cardano_wallet) for more details.
76
87
 
77
88
  ## Development
78
89
 
data/dev ADDED
@@ -0,0 +1 @@
1
+ NETWORK=testnet WALLET=dev-master-byron NODE=master docker-compose $1
@@ -2,7 +2,7 @@ module CardanoWallet
2
2
  class Base
3
3
  include HTTParty
4
4
 
5
- attr_reader :opt
5
+ attr_accessor :opt
6
6
 
7
7
  def initialize(opt = {})
8
8
  raise ArgumentError, "argument should be Hash" unless opt.is_a?(Hash)
@@ -38,8 +38,8 @@ module CardanoWallet
38
38
 
39
39
  # Check network parameters
40
40
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getNetworkParameters
41
- def parameters(epoch_id)
42
- self.class.get("/network/parameters/#{epoch_id}")
41
+ def parameters
42
+ self.class.get("/network/parameters")
43
43
  end
44
44
 
45
45
  end
@@ -42,6 +42,12 @@ module CardanoWallet
42
42
  StakePools.new @opt
43
43
  end
44
44
 
45
+ # API for Migrations
46
+ # @see https://input-output-hk.github.io/cardano-wallet/api/#tag/Migrations
47
+ def migrations
48
+ Migrations.new @opt
49
+ end
50
+
45
51
  end
46
52
 
47
53
  # API for Wallets
@@ -250,5 +256,33 @@ module CardanoWallet
250
256
  self.class.get("/wallets/#{wid}/delegation-fees")
251
257
  end
252
258
  end
259
+
260
+ # Shelley migrations
261
+ # @see https://input-output-hk.github.io/cardano-wallet/api/#tag/Migrations
262
+ class Migrations < Base
263
+ def initialize opt
264
+ super
265
+ end
266
+
267
+ # Calculate migration cost
268
+ # @see https://input-output-hk.github.io/cardano-wallet/api/#operation/getShelleyWalletMigrationInfo
269
+ def cost(wid)
270
+ self.class.get("/wallets/#{wid}/migrations")
271
+ end
272
+
273
+ # Migrate all funds from Shelley wallet.
274
+ # @see https://input-output-hk.github.io/cardano-wallet/api/#operation/migrateShelleyWallet
275
+ # @param wid [String] wallet id
276
+ # @param passphrase [String] wallet's passphrase
277
+ # @param [Array] array of addresses
278
+ def migrate(wid, passphrase, addresses)
279
+ self.class.post("/wallets/#{wid}/migrations",
280
+ :body => { :addresses => addresses,
281
+ :passphrase => passphrase
282
+ }.to_json,
283
+ :headers => { 'Content-Type' => 'application/json' } )
284
+ end
285
+
286
+ end
253
287
  end
254
288
  end
@@ -1,3 +1,3 @@
1
1
  module CardanoWallet
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
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.0
4
+ version: 0.1.1
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-05-23 00:00:00.000000000 Z
11
+ date: 2020-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -100,6 +100,7 @@ files:
100
100
  - bin/console
101
101
  - bin/setup
102
102
  - cardano_wallet.gemspec
103
+ - dev
103
104
  - docker-compose.yml
104
105
  - lib/cardano_wallet.rb
105
106
  - lib/cardano_wallet/base.rb