cardano_wallet 0.3.27 → 0.4.0

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: '083f459db029fab491c2d7fddad1f0a6bfff596e08344af6e31ea75dfb9e2a21'
4
- data.tar.gz: eb50ebc2b10e841c941fc36250bc0d035d52b785fc2920961b9c563b0410c9ae
3
+ metadata.gz: ff6a6b64dbaa80f7564f05e29c28068676945ff5bca968563ae764720af2d5b8
4
+ data.tar.gz: a1aa9f10c95dba5d28c749859b43b0756c6bf94ee0035dacc987b2a233b8e0bc
5
5
  SHA512:
6
- metadata.gz: 14ca8505a76dc7d21474b92a7e444d76b4b436e8f33ec7553b3a0a49eb1bb83e415eedc0ade4d6fb50353981eb20f56c129f786576ad1c0ed5c1ac216eeb6205
7
- data.tar.gz: 94ae2907f02096c838b97c9097ee71668ddbbdb293ec2b1786d3ecd505ecfc2c6344c45d9f82016846d5031f22bac7b55ef137621d0bd994290ee03c28558c16
6
+ metadata.gz: 8b00a425a276b3a2428672484fa0fe301e140ab0ae65c88fc45f7ea3e8b0f8889f20d4f1f04de0d0171fb3ebb9ba43b95cf8f54c9a5469102256d89bda05a376
7
+ data.tar.gz: 642380a8b7e87106f1b6f6cf4437a4a7079ebc5d696977764eac4a025b9abd1fcfac066ef8dc7d2629bed24c0d4d3788517f34e71ad47d24ee032a54cf4ba1b1
@@ -0,0 +1,50 @@
1
+ name: Docs
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ tags:
8
+ - '*'
9
+ pull_request:
10
+
11
+ jobs:
12
+ build:
13
+ name: Build + Publish Docs
14
+ runs-on: ubuntu-latest
15
+
16
+ steps:
17
+ - name: '📥 Checkout repository'
18
+ uses: actions/checkout@v2
19
+ - name: '💎 Setup Ruby'
20
+ uses: actions/setup-ruby@v1
21
+
22
+ - name: '🔧 Set versions'
23
+ id: versions
24
+ run: |
25
+ if [[ $GITHUB_REF =~ ^refs/tags/ ]]; then
26
+ version="${GITHUB_REF/refs\/tags\//}"
27
+ commit_message="Release $version"
28
+ else
29
+ version=master
30
+ commit_message="Master"
31
+ fi
32
+ echo "::set-output name=commit_message::$commit_message"
33
+ echo "::set-output name=version::$version"
34
+
35
+ - name: '🔨 Build'
36
+ run: |
37
+ gem install yard
38
+ readme_link=https://github.com/piotr-iohk/cardano-wallet-rb/blob/${{ steps.versions.outputs.version }}/README.md
39
+ yard doc --title "Documentation for cardano_wallet (${{ steps.versions.outputs.version }})"
40
+ sed -i "s|<a href=\"index.html\" title=\"README\">|<a href=\"$readme_link\" title=\"README\">|" ./doc/_index.html
41
+ cp ./doc/_index.html ./doc/index.html
42
+
43
+ - name: '🚀 Publish'
44
+ if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags') }}
45
+ uses: peaceiris/actions-gh-pages@v3
46
+ with:
47
+ github_token: ${{ secrets.GITHUB_TOKEN }}
48
+ publish_dir: doc
49
+ destination_dir: ${{ steps.versions.outputs.version }}
50
+ full_commit_message: ${{ steps.versions.outputs.commit_message }}
data/README.md CHANGED
@@ -1,5 +1,3 @@
1
-
2
-
3
1
  <a href="https://badge.fury.io/rb/cardano_wallet">
4
2
  <img src="https://badge.fury.io/rb/cardano_wallet.svg" alt="Gem Version">
5
3
  </a>
@@ -9,7 +7,9 @@
9
7
  <a href="https://github.com/piotr-iohk/cardano-wallet-rb/actions?query=workflow%3ATests">
10
8
  <img src="https://github.com/piotr-iohk/cardano-wallet-rb/workflows/Tests/badge.svg" />
11
9
  </a>
12
-
10
+ <a href="https://github.com/piotr-iohk/cardano-wallet-rb/actions?query=workflow%3ADocs">
11
+ <img src="https://github.com/piotr-iohk/cardano-wallet-rb/workflows/Docs/badge.svg" />
12
+ </a>
13
13
 
14
14
  # cardano-wallet-rb
15
15
 
@@ -32,9 +32,12 @@ Or:
32
32
 
33
33
  ## Documentation
34
34
 
35
- For ruby doc see: https://rubydoc.info/gems/cardano_wallet.
35
+ | Link | Description |
36
+ |--|--|
37
+ | [Ruby API (edge)](https://piotr-iohk.github.io/cardano-wallet-rb/master/) | cardano-wallet-rb API |
38
+ |[REST API (edge)](https://input-output-hk.github.io/cardano-wallet/api/edge/)| [cardano-wallet's](https://github.com/input-output-hk/cardano-wallet) REST API|
36
39
 
37
- For `cardano-wallet` REST Api see: https://input-output-hk.github.io/cardano-wallet/api/edge/.
40
+ > :warning: Links point to `edge` APIs corresponding to `master` branches for both cardano-wallet and cardano-wallet-rb. Refer to [release page](https://github.com/piotr-iohk/cardano-wallet-rb/releases) for API doc suitable for the latest release.
38
41
 
39
42
  ## Examples
40
43
 
@@ -96,9 +99,6 @@ MISC.proxy.submit_external_transaction(File.new("/tmp/blob.bin").read)
96
99
  MISC.utils.addresses("addr_test1vqrlltfahghjxl5sy5h5mvfrrlt6me5fqphhwjqvj5jd88cccqcek")
97
100
  ```
98
101
 
99
- Refer to [documentation](https://rubydoc.info/gems/cardano_wallet) for more details.
100
-
101
-
102
102
  ## Contributing
103
103
 
104
104
  Bug reports and pull requests are welcome on GitHub at https://github.com/piotr-iohk/cardano-wallet-rb. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/piotr-iohk/cardano-wallet-rb/blob/master/CODE_OF_CONDUCT.md).
@@ -8,6 +8,16 @@ module CardanoWallet
8
8
 
9
9
  attr_accessor :opt
10
10
 
11
+ # Initialize CardanoWallet.
12
+ # @example Initialize CardanoWallet with default settings
13
+ # @cw = CardanoWallet.new
14
+ #
15
+ # @example Initialize CardanoWallet with custom settings
16
+ # @cw = CardanoWallet.new({ port: 4445,
17
+ # protocol: 'https',
18
+ # cacert: '/path/to/cacert',
19
+ # pem: '/path/to/client.pem',
20
+ # timeout: 600 })
11
21
  def initialize(opt = {})
12
22
  raise ArgumentError, 'argument should be Hash' unless opt.is_a?(Hash)
13
23
 
@@ -3,13 +3,24 @@
3
3
  module CardanoWallet
4
4
  ##
5
5
  # Byron APIs
6
+ # @example
7
+ # @cw = CardanoWallet.new
8
+ # @cw.byron # API for Byron
6
9
  module Byron
7
10
  def self.new(opt)
8
11
  Init.new opt
9
12
  end
10
13
 
11
14
  ##
12
- # Init class for Byron APIs
15
+ # Init class for Byron APIs.
16
+ # @example
17
+ # @cw = CardanoWallet.new
18
+ # @cw.byron.wallets # API for Byron wallets
19
+ # @cw.byron.assets # API for Byron assets
20
+ # @cw.byron.coin_selections # API for Byron coin_selections
21
+ # @cw.byron.addresses # API for Byron addresses
22
+ # @cw.byron.transactions # API for Byron transactions
23
+ # @cw.byron.migrations # API for Byron migrations
13
24
  class Init < Base
14
25
  # Get API for Byron wallets
15
26
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Byron-Wallets
@@ -50,10 +61,15 @@ module CardanoWallet
50
61
 
51
62
  ##
52
63
  # Init for Byron assets APIs
64
+ # @example
65
+ # @cw = CardanoWallet.new
66
+ # @cw.byron.assets # API for Byron assets
53
67
  class Assets < Base
54
68
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/listByronAssets
55
69
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getByronAsset
56
70
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getByronAssetDefault
71
+ # @example Get all assets that were ever involved in wallet transaction and been on balance
72
+ # @cw.byron.assets.get(wallet_id)
57
73
  def get(wid, policy_id = nil, asset_name = nil)
58
74
  ep = "/byron-wallets/#{wid}/assets"
59
75
  ep += "/#{policy_id}" if policy_id
@@ -64,15 +80,22 @@ module CardanoWallet
64
80
 
65
81
  # Byron wallets
66
82
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Byron-Wallets
83
+ # @example
84
+ # @cw = CardanoWallet.new
85
+ # @cw.byron.wallets # API for Byron wallets
67
86
  class Wallets < Base
68
87
  # List Byron wallets
69
88
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/listByronWallets
89
+ # @example Get all Byron wallets
90
+ # @cw.byron.wallets.get
70
91
  def list
71
92
  self.class.get('/byron-wallets')
72
93
  end
73
94
 
74
95
  # Get Byron wallet details
75
96
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getByronWallet
97
+ # @example Get Byron wallet details
98
+ # @cw.byron.wallets.get(wallet_id)
76
99
  def get(wid)
77
100
  self.class.get("/byron-wallets/#{wid}")
78
101
  end
@@ -95,6 +118,8 @@ module CardanoWallet
95
118
 
96
119
  # Delete Byron wallet
97
120
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/deleteByronWallet
121
+ # @example Delete Byron wallet
122
+ # @cw.byron.wallets.delete(wallet_id)
98
123
  def delete(wid)
99
124
  self.class.delete("/byron-wallets/#{wid}")
100
125
  end
@@ -103,7 +128,7 @@ module CardanoWallet
103
128
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/putByronWallet
104
129
  #
105
130
  # @example
106
- # update_metadata(wid, {name: "New wallet name"})
131
+ # @cw.byron.wallets.update_metadata(wid, {name: "New wallet name"})
107
132
  def update_metadata(wid, params)
108
133
  Utils.verify_param_is_hash!(params)
109
134
  self.class.put("/byron-wallets/#{wid}",
@@ -113,11 +138,15 @@ module CardanoWallet
113
138
 
114
139
  # See Byron wallet's utxo distribution
115
140
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getByronUTxOsStatistics
141
+ # @example
142
+ # @cw.byron.wallets.utxo(wallet_id)
116
143
  def utxo(wid)
117
144
  self.class.get("/byron-wallets/#{wid}/statistics/utxos")
118
145
  end
119
146
 
120
147
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getByronWalletUtxoSnapshot
148
+ # @example
149
+ # @cw.byron.wallets.utxo_snapshot(wallet_id)
121
150
  def utxo_snapshot(wid)
122
151
  self.class.get("/byron-wallets/#{wid}/utxo")
123
152
  end
@@ -126,7 +155,8 @@ module CardanoWallet
126
155
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/putByronWalletPassphrase
127
156
  #
128
157
  # @example
129
- # update_passphrase(wid, {old_passphrase: "Secure Passphrase", new_passphrase: "Securer Passphrase"})
158
+ # @cw.byron.wallets.update_passphrase(wid, {old_passphrase: "Secure Passphrase",
159
+ # new_passphrase: "Securer Passphrase"})
130
160
  def update_passphrase(wid, params)
131
161
  Utils.verify_param_is_hash!(params)
132
162
  self.class.put("/byron-wallets/#{wid}/passphrase",
@@ -137,12 +167,15 @@ module CardanoWallet
137
167
 
138
168
  # Byron addresses
139
169
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Byron-Addresses
170
+ # @example
171
+ # @cw = CardanoWallet.new
172
+ # @cw.byron.addresses # API for Byron addresses
140
173
  class Addresses < Base
141
174
  # List Byron addresses.
142
175
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/listByronAddresses
143
176
  #
144
177
  # @example
145
- # list(wid, {state: "used"})
178
+ # @cw.byron.addresses.list(wid, {state: "used"})
146
179
  def list(wid, query = {})
147
180
  query_formatted = query.empty? ? '' : Utils.to_query(query)
148
181
  self.class.get("/byron-wallets/#{wid}/addresses#{query_formatted}")
@@ -154,9 +187,9 @@ module CardanoWallet
154
187
  # @param params [Hash] passphrase and (optional) address_index
155
188
  #
156
189
  # @example Create address with index.
157
- # create(wid, {passphrase: "Secure Passphrase", address_index: 2147483648})
190
+ # @cw.byron.addresses.create(wid, {passphrase: "Secure Passphrase", address_index: 2147483648})
158
191
  # @example Create address with random index.
159
- # create(wid, {passphrase: "Secure Passphrase"})
192
+ # @cw.byron.addresses.create(wid, {passphrase: "Secure Passphrase"})
160
193
  def create(wid, params)
161
194
  Utils.verify_param_is_hash!(params)
162
195
  self.class.post("/byron-wallets/#{wid}/addresses",
@@ -185,13 +218,16 @@ module CardanoWallet
185
218
 
186
219
  # API for CoinSelections
187
220
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Byron-Coin-Selections
221
+ # @example
222
+ # @cw = CardanoWallet.new
223
+ # @cw.byron.coin_selections # API for Byron coin_selections
188
224
  class CoinSelections < Base
189
225
  # Show random coin selection for particular payment
190
226
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/byronSelectCoins
191
227
  #
192
228
  # @example
193
- # random(wid, [{addr1: 1000000}, {addr2: 1000000}])
194
- # random(wid, [{ "address": "addr1..",
229
+ # @cw.byron.coin_selections.random(wid, [{addr1: 1000000}, {addr2: 1000000}])
230
+ # @cw.byron.coin_selections.random(wid, [{ "address": "addr1..",
195
231
  # "amount": { "quantity": 42000000, "unit": "lovelace" },
196
232
  # "assets": [{"policy_id": "pid", "asset_name": "name", "quantity": 0 } ] } ])
197
233
  def random(wid, payments)
@@ -209,6 +245,9 @@ module CardanoWallet
209
245
 
210
246
  # Byron transactions
211
247
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/postByronTransactionFee
248
+ # @example
249
+ # @cw = CardanoWallet.new
250
+ # @cw.byron.transactions # API for Byron Transactions
212
251
  class Transactions < Base
213
252
  # Construct transaction
214
253
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/constructByronTransaction
@@ -266,7 +305,7 @@ module CardanoWallet
266
305
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/listByronTransactions
267
306
  #
268
307
  # @example
269
- # list(wid, {start: "2012-09-25T10:15:00Z", order: "descending"})
308
+ # @cw.byron.transactions.list(wid, {start: "2012-09-25T10:15:00Z", order: "descending"})
270
309
  def list(wid, query = {})
271
310
  query_formatted = query.empty? ? '' : Utils.to_query(query)
272
311
  self.class.get("/byron-wallets/#{wid}/transactions#{query_formatted}")
@@ -279,8 +318,8 @@ module CardanoWallet
279
318
  # @param payments [Array of Hashes] addres, amount pair
280
319
  #
281
320
  # @example
282
- # create(wid, passphrase, [{addr1: 1000000}, {addr2: 1000000}])
283
- # create(wid, passphrase, [{ "address": "addr1..",
321
+ # @cw.byron.transactions.create(wid, passphrase, [{addr1: 1000000}, {addr2: 1000000}])
322
+ # @cw.byron.transactions.create(wid, passphrase, [{ "address": "addr1..",
284
323
  # "amount": { "quantity": 42000000, "unit": "lovelace" },
285
324
  # "assets": [{"policy_id": "pid", "asset_name": "name", "quantity": 0 } ] } ])
286
325
 
@@ -301,8 +340,8 @@ module CardanoWallet
301
340
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/postTransactionFee
302
341
  #
303
342
  # @example
304
- # payment_fees(wid, [{addr1: 1000000}, {addr2: 1000000}])
305
- # payment_fees(wid, [{ "address": "addr1..",
343
+ # @cw.byron.transactions.payment_fees(wid, [{addr1: 1000000}, {addr2: 1000000}])
344
+ # @cw.byron.transactions.payment_fees(wid, [{ "address": "addr1..",
306
345
  # "amount": { "quantity": 42000000, "unit": "lovelace" },
307
346
  # "assets": [{"policy_id": "pid", "asset_name": "name", "quantity": 0 } ] } ])
308
347
  def payment_fees(wid, payments)
@@ -326,6 +365,9 @@ module CardanoWallet
326
365
 
327
366
  # Byron migrations
328
367
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Byron-Migrations
368
+ # @example
369
+ # @cw = CardanoWallet.new
370
+ # @cw.byron.migrations # API for Byron Migrations
329
371
  class Migrations < Base
330
372
  # Get migration plan
331
373
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/createByronWalletMigrationPlan
@@ -2,7 +2,10 @@
2
2
 
3
3
  module CardanoWallet
4
4
  ##
5
- # misc
5
+ # Misc
6
+ # @example
7
+ # @cw = CardanoWallet.new
8
+ # @cw.misc
6
9
  module Misc
7
10
  def self.new(opt)
8
11
  Init.new opt
@@ -39,6 +42,9 @@ module CardanoWallet
39
42
  end
40
43
 
41
44
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Node
45
+ # @example
46
+ # @cw = CardanoWallet.new
47
+ # @cw.misc.node
42
48
  class Node < Base
43
49
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Node/paths/~1blocks~1latest~1header/get
44
50
  def block_header
@@ -48,6 +54,9 @@ module CardanoWallet
48
54
 
49
55
  # API for Network
50
56
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Settings
57
+ # @example
58
+ # @cw = CardanoWallet.new
59
+ # @cw.misc.settings
51
60
  class Settings < Base
52
61
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getSettings
53
62
  def get
@@ -65,6 +74,9 @@ module CardanoWallet
65
74
 
66
75
  # API for Network
67
76
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Network
77
+ # @example
78
+ # @cw = CardanoWallet.new
79
+ # @cw.misc.network
68
80
  class Network < Base
69
81
  # Get network information
70
82
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getNetworkInformation
@@ -86,6 +98,9 @@ module CardanoWallet
86
98
  end
87
99
 
88
100
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Utils
101
+ # @example
102
+ # @cw = CardanoWallet.new
103
+ # @cw.misc.utils
89
104
  class Utils < Base
90
105
  # @see https://input-output-hk.github.io/cardano-wallet/api/#operation/signMetadata
91
106
  def sign_metadata(wid, role, index, pass, metadata)
@@ -128,6 +143,9 @@ module CardanoWallet
128
143
  end
129
144
 
130
145
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Proxy
146
+ # @example
147
+ # @cw = CardanoWallet.new
148
+ # @cw.misc.proxy
131
149
  class Proxy < Base
132
150
  # Submit a transaction that was created and signed outside of cardano-wallet.
133
151
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/postExternalTransaction
@@ -2,6 +2,9 @@
2
2
 
3
3
  module CardanoWallet
4
4
  # Init API for Shelley Shared wallets
5
+ # @example
6
+ # @cw = CardanoWallet.new
7
+ # @cw.shared # API for Shared
5
8
  module Shared
6
9
  def self.new(opt)
7
10
  Init.new opt
@@ -35,6 +38,9 @@ module CardanoWallet
35
38
 
36
39
  # API for Transactions
37
40
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Shared-Transactions
41
+ # @example
42
+ # @cw = CardanoWallet.new
43
+ # @cw.shared.transactions # API for Shared transactions
38
44
  class Transactions < Base
39
45
  # Construct transaction
40
46
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/constructSharedTransaction
@@ -107,10 +113,30 @@ module CardanoWallet
107
113
  body: payload.to_json,
108
114
  headers: { 'Content-Type' => 'application/json' })
109
115
  end
116
+
117
+ # Get tx by id
118
+ # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getSharedTransaction
119
+ def get(wid, tx_id, query = {})
120
+ query_formatted = query.empty? ? '' : Utils.to_query(query)
121
+ self.class.get("/shared-wallets/#{wid}/transactions/#{tx_id}#{query_formatted}")
122
+ end
123
+
124
+ # List all wallet's transactions
125
+ # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/listSharedTransactions
126
+ #
127
+ # @example
128
+ # list(wid, {start: "2012-09-25T10:15:00Z", order: "descending"})
129
+ def list(wid, query = {})
130
+ query_formatted = query.empty? ? '' : Utils.to_query(query)
131
+ self.class.get("/shared-wallets/#{wid}/transactions#{query_formatted}")
132
+ end
110
133
  end
111
134
 
112
135
  # API for Addresses
113
136
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Shared-Addresses
137
+ # @example
138
+ # @cw = CardanoWallet.new
139
+ # @cw.shared.addresses # API for Shared addresses
114
140
  class Addresses < Base
115
141
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/listSharedAddresses
116
142
  def list(wid, query = {})
@@ -121,9 +147,11 @@ module CardanoWallet
121
147
 
122
148
  # API for Keys
123
149
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Shared-Keys
150
+ # @example
151
+ # @cw = CardanoWallet.new
152
+ # @cw.shared.keys # API for Shared Keys
124
153
  class Keys < Base
125
154
  # @see https://input-output-hk.github.io/cardano-wallet/api/#operation/getSharedWalletKey
126
- # https://localhost:8090/v2/shared-wallets/{walletId}/keys/{role}/{index}?hash=false
127
155
  def get_public_key(wid, role, index, hash = {})
128
156
  hash_query = hash.empty? ? '' : Utils.to_query(hash)
129
157
  self.class.get("/shared-wallets/#{wid}/keys/#{role}/#{index}#{hash_query}")
@@ -147,6 +175,9 @@ module CardanoWallet
147
175
 
148
176
  # API for Wallets
149
177
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Shared-Wallets
178
+ # @example
179
+ # @cw = CardanoWallet.new
180
+ # @cw.shared.wallets # API for Shared Wallets
150
181
  class Wallets < Base
151
182
  # List all wallets
152
183
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/listSharedWallets
@@ -2,13 +2,26 @@
2
2
 
3
3
  module CardanoWallet
4
4
  # Init API for Shelley
5
+ # @example
6
+ # @cw = CardanoWallet.new
7
+ # @cw.shelley # API for Shelley
5
8
  module Shelley
6
9
  def self.new(opt)
7
10
  Init.new opt
8
11
  end
9
12
 
10
13
  ##
11
- # Base class for Shelley API
14
+ # Init class for Shelley API
15
+ # @example
16
+ # @cw = CardanoWallet.new
17
+ # @cw.shelley.wallets # API for Shelley wallets
18
+ # @cw.shelley.assets # API for Shelley assets
19
+ # @cw.shelley.coin_selections # API for Shelley coin_selections
20
+ # @cw.shelley.addresses # API for Shelley addresses
21
+ # @cw.shelley.transactions # API for Shelley transactions
22
+ # @cw.shelley.migrations # API for Shelley migrations
23
+ # @cw.shelley.stake_pools # API for Shelley stake_pools
24
+ # @cw.shelley.keys # API for Shelley keys
12
25
  class Init < Base
13
26
  # Call API for Wallets
14
27
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Wallets
@@ -61,22 +74,10 @@ module CardanoWallet
61
74
 
62
75
  ##
63
76
  # Base class for Shelley Assets API
77
+ # @example
78
+ # @cw = CardanoWallet.new
79
+ # @cw.shelley.assets # API for Shelley assets
64
80
  class Assets < Base
65
- # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/mintBurnAssets
66
- def mint(wid, mint_burn, pass, metadata = nil, ttl = nil)
67
- payload = {
68
- mint_burn: mint_burn,
69
- passphrase: pass
70
- }
71
-
72
- payload[:metadata] = metadata if metadata
73
- payload[:time_to_live] = { quantity: ttl, unit: 'second' } if ttl
74
-
75
- self.class.post("/wallets/#{wid}/assets",
76
- body: payload.to_json,
77
- headers: { 'Content-Type' => 'application/json' })
78
- end
79
-
80
81
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/listAssets
81
82
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getAsset
82
83
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getAssetDefault
@@ -90,6 +91,9 @@ module CardanoWallet
90
91
 
91
92
  ##
92
93
  # Base class for Shelley Keys API
94
+ # @example
95
+ # @cw = CardanoWallet.new
96
+ # @cw.shelley.keys # API for Shelley Keys
93
97
  class Keys < Base
94
98
  # @see https://input-output-hk.github.io/cardano-wallet/api/#operation/signMetadata
95
99
  def sign_metadata(wid, role, index, pass, metadata)
@@ -149,6 +153,9 @@ module CardanoWallet
149
153
 
150
154
  # API for Wallets
151
155
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Wallets
156
+ # @example
157
+ # @cw = CardanoWallet.new
158
+ # @cw.shelley.wallets # API for Shelley wallets
152
159
  class Wallets < Base
153
160
  # List all wallets
154
161
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/listWallets
@@ -166,12 +173,12 @@ module CardanoWallet
166
173
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/postWallet
167
174
  #
168
175
  # @example Create wallet from mnemonic sentence
169
- # create({name: "Wallet from mnemonic_sentence",
176
+ # @cw.shelley.wallets.create({name: "Wallet from mnemonic_sentence",
170
177
  # passphrase: "Secure Passphrase",
171
178
  # mnemonic_sentence: %w[story egg fun ... ],
172
179
  # })
173
180
  # @example Create wallet from pub key
174
- # create({name: "Wallet from pub key",
181
+ # @cw.shelley.wallets.create({name: "Wallet from pub key",
175
182
  # account_public_key: "b47546e...",
176
183
  # address_pool_gap: 20,
177
184
  # })
@@ -192,7 +199,7 @@ module CardanoWallet
192
199
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/putWallet
193
200
  #
194
201
  # @example
195
- # update_metadata(wid, {name: "New wallet name"})
202
+ # @cw.shelley.wallets.update_metadata(wid, {name: "New wallet name"})
196
203
  def update_metadata(wid, params)
197
204
  Utils.verify_param_is_hash!(params)
198
205
  self.class.put("/wallets/#{wid}",
@@ -215,7 +222,8 @@ module CardanoWallet
215
222
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/putWalletPassphrase
216
223
  #
217
224
  # @example
218
- # update_passphrase(wid, {old_passphrase: "Secure Passphrase", new_passphrase: "Securer Passphrase"})
225
+ # @cw.shelley.wallets.update_passphrase(wid, {old_passphrase: "Secure Passphrase",
226
+ # new_passphrase: "Securer Passphrase"})
219
227
  def update_passphrase(wid, params)
220
228
  Utils.verify_param_is_hash!(params)
221
229
  self.class.put("/wallets/#{wid}/passphrase",
@@ -226,6 +234,9 @@ module CardanoWallet
226
234
 
227
235
  # API for Addresses
228
236
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Addresses
237
+ # @example
238
+ # @cw = CardanoWallet.new
239
+ # @cw.shelley.addresses # API for Shelley addresses
229
240
  class Addresses < Base
230
241
  # List addresses
231
242
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/listAddresses
@@ -240,6 +251,9 @@ module CardanoWallet
240
251
 
241
252
  # API for CoinSelections
242
253
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Coin-Selections
254
+ # @example
255
+ # @cw = CardanoWallet.new
256
+ # @cw.shelley.coin_selections # API for Shelley coin_selections
243
257
  class CoinSelections < Base
244
258
  # Show random coin selection for particular payment
245
259
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/selectCoins
@@ -281,6 +295,9 @@ module CardanoWallet
281
295
 
282
296
  # API for Transactions
283
297
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Transactions
298
+ # @example
299
+ # @cw = CardanoWallet.new
300
+ # @cw.shelley.transactions # API for Shelley Transactions
284
301
  class Transactions < Base
285
302
  # Balance transaction
286
303
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/balanceTransaction
@@ -451,6 +468,9 @@ module CardanoWallet
451
468
 
452
469
  # API for StakePools
453
470
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Stake-Pools
471
+ # @example
472
+ # @cw = CardanoWallet.new
473
+ # @cw.shelley.stake_pools # API for Shelley StakePools
454
474
  class StakePools < Base
455
475
  # Stake pools maintenance actions
456
476
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/postMaintenanceAction
@@ -508,6 +528,9 @@ module CardanoWallet
508
528
 
509
529
  # Shelley migrations
510
530
  # @see https://input-output-hk.github.io/cardano-wallet/api/#tag/Migrations
531
+ # @example
532
+ # @cw = CardanoWallet.new
533
+ # @cw.shelley.migrations # API for Shelley migrations
511
534
  class Migrations < Base
512
535
  # Get migration plan
513
536
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/createShelleyWalletMigrationPlan
@@ -3,22 +3,23 @@
3
3
  module CardanoWallet
4
4
  ##
5
5
  # General Utils not connected to API
6
+ # @example
7
+ # @cw = CardanoWallet.new
8
+ # @cw.utils
6
9
  module Utils
7
10
  def self.new(opt)
8
- Init.new opt
11
+ Mnemonic.new opt
9
12
  end
10
13
 
11
- # Init
12
- class Init < Base
14
+ # Utils for mnemonics
15
+ class Mnemonic < Base
13
16
  # Generate mnemonic sentence
14
17
  #
15
18
  # @example Default 24-word English mnemonic sentence
16
- # CardanoWallet.new.utils.mnemonic_sentence
17
- # ["kiwi", "rent", "denial",...]
19
+ # @cw.utils.mnemonic_sentence
18
20
  #
19
21
  # @example 15-word French mnemonic sentence
20
- # CardanoWallet.new.utils.mnemonic_sentence(15, 'french')
21
- # ["ruser", "malaxer", "forgeron",...]
22
+ # @cw.utils.mnemonic_sentence(15, 'french')
22
23
  def mnemonic_sentence(word_count = 24, language = 'english')
23
24
  languages = %w[english french spanish korean japanese
24
25
  italian chinese_traditional chinese_simplified]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CardanoWallet
4
- VERSION = '0.3.27'
4
+ VERSION = '0.4.0'
5
5
  end
@@ -12,7 +12,7 @@ require_relative 'cardano_wallet/misc'
12
12
  require_relative 'cardano_wallet/shared'
13
13
 
14
14
  ##
15
- # Main module
15
+ # Main module. Go to {Base.initialize} for more details no how to start.
16
16
  module CardanoWallet
17
17
  def self.new(options = {})
18
18
  CardanoWallet::Base.new(options)
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.27
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Stachyra
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-26 00:00:00.000000000 Z
11
+ date: 2022-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bip_mnemonic
@@ -115,6 +115,7 @@ executables: []
115
115
  extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
+ - ".github/workflows/docs.yml"
118
119
  - ".github/workflows/gem-push.yml"
119
120
  - ".github/workflows/tests.yml"
120
121
  - ".gitignore"