nis-ruby 0.0.18.1 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +7 -0
  3. data/README.md +4 -4
  4. data/examples/account/get.rb +5 -14
  5. data/examples/account/harvests.rb +1 -1
  6. data/examples/account/historical.rb +1 -1
  7. data/examples/account/importances.rb +1 -1
  8. data/examples/account/lock.rb +1 -1
  9. data/examples/account/mosaic.rb +1 -1
  10. data/examples/account/namespace.rb +1 -1
  11. data/examples/account/status.rb +1 -1
  12. data/examples/account/transfers.rb +1 -1
  13. data/examples/account/unconfirmed_transactions.rb +1 -1
  14. data/examples/account/unlock.rb +1 -1
  15. data/examples/account/unlocked.rb +1 -1
  16. data/examples/apostille_audit.rb +1 -1
  17. data/examples/apostille_create.rb +1 -1
  18. data/examples/block/at_public.rb +2 -0
  19. data/examples/block/get.rb +2 -0
  20. data/examples/debug/connections.rb +1 -1
  21. data/examples/debug/time_synchronization.rb +1 -1
  22. data/examples/mosaic/supply.rb +6 -0
  23. data/examples/namespace/mosaic_definition.rb +1 -1
  24. data/examples/namespace/root.rb +1 -1
  25. data/examples/nis.rb +1 -1
  26. data/examples/node/active_peers.rb +1 -1
  27. data/examples/node/info.rb +1 -1
  28. data/examples/node/peerlist.rb +1 -1
  29. data/examples/time_sync/network_time.rb +1 -1
  30. data/examples/transactions/get.rb +1 -1
  31. data/examples/transactions/mosaic_definition_creation.rb +1 -0
  32. data/examples/transactions/multisig.rb +1 -1
  33. data/examples/transactions/multisig_signature.rb +1 -0
  34. data/examples/transactions/transfer_remote.rb +1 -1
  35. data/lib/nis.rb +2 -0
  36. data/lib/nis/endpoint/account/lock.rb +1 -4
  37. data/lib/nis/endpoint/account/transfers.rb +16 -8
  38. data/lib/nis/endpoint/account/unlock.rb +1 -3
  39. data/lib/nis/endpoint/mosaic.rb +4 -0
  40. data/lib/nis/endpoint/mosaic/supply.rb +13 -0
  41. data/lib/nis/struct/message.rb +1 -1
  42. data/lib/nis/struct/mosaic_supply.rb +14 -0
  43. data/lib/nis/struct/node.rb +1 -1
  44. data/lib/nis/util/convert.rb +7 -7
  45. data/lib/nis/util/deserializer.rb +1 -1
  46. data/lib/nis/version.rb +1 -1
  47. metadata +7 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ee306dcad3b9ded158ae711de687bc40ca3d60f4
4
- data.tar.gz: 88e430dea815c3abdf3dfd65b7196cf4b831c31e
3
+ metadata.gz: aff51b55f969bf2101a414a7fc60b831da425458
4
+ data.tar.gz: b21347efa3caa04f3efb36b7224b40f935bf7eb7
5
5
  SHA512:
6
- metadata.gz: 07cab0b97be0d10806519dc2d2980ce5fd06d1b1317c2667873f89e8a1a283b929d3989c2baff6e06812718eb3185eccaa84839f85d0282fcb180ed17e76168b
7
- data.tar.gz: f960dc21fe2028276143bd722f2274934ca0b68f9776209436ef20958ea3ac7088d69741d5cff762fe41ce8a340f07f2f2987bef19455411778ca7013b5818ee
6
+ metadata.gz: 87384f3657b1644ea67a0b7f5416087e0037a7c22d45c062147b3d95f5bbdaaa82a254774afc6d9f9547162aff27b50beabc39b394c6d044266df2c5267955cc
7
+ data.tar.gz: 47d4ba8eb4ed63600015bebe621d1eea5066d46b0d0dde69da59fa0064ea8cfb2db5b50890fd4039a2edf133d1479d82b7de151afb518fab112657c1740a737c
@@ -1,12 +1,19 @@
1
1
  language: ruby
2
+ cache: bundler
2
3
 
3
4
  rvm:
4
5
  - ruby-head
6
+ - 2.4.3
5
7
  - 2.4.0
8
+ - 2.3.6
6
9
  - 2.3.0
10
+ - 2.2.9
7
11
  - 2.2.6
8
12
 
9
13
  branches:
10
14
  only:
11
15
  - master
12
16
  - development
17
+
18
+ before_install:
19
+ - gem install bundler
data/README.md CHANGED
@@ -1,3 +1,7 @@
1
+ # /!\ Information /!\
2
+
3
+ **Refactored and New gem for nem => [44uk/nem-ruby](https://github.com/44uk/nem-ruby/)**
4
+
1
5
  # nis-ruby
2
6
 
3
7
  [![Gem Version](https://badge.fury.io/rb/nis-ruby.svg)](https://badge.fury.io/rb/nis-ruby)
@@ -9,10 +13,6 @@
9
13
 
10
14
  Ruby client library for the NEM Infrastructure Server(NIS) API.
11
15
 
12
- *The gem is under development. Incompatible changes can be made.*
13
-
14
- *Not recommended for production use because of lack of testing, needed more improvement.*
15
-
16
16
  For further development of nem with ruby, [feel free to send me your feedback!](#feedback-and-contact)
17
17
 
18
18
  * [NEM \- Distributed Ledger Technology \(Blockchain\)](https://www.nem.io/)
@@ -4,23 +4,14 @@ Nis.logger.level = Logger::DEBUG
4
4
  A_ADDRESS = 'TDPP2C4XQLMESBMCYGWN4NRAJAKZEYRV75KGYSOB'
5
5
  A_PUBLIC_KEY = 'cc63b4dcdec745417043c3fa0992ec3a1695461a26d90264744648abbd5caa0d'
6
6
 
7
- nis = Nis.new(host: '23.228.67.85')
8
-
9
- p nis.account_get(address: A_ADDRESS)
10
- p nis.account_get_from_public_key(public_key: A_PUBLIC_KEY)
11
-
12
- p nis.account_get_forwarded(address: A_ADDRESS)
13
- p nis.account_get_forwarded_from_public_key(public_key: A_PUBLIC_KEY)
7
+ nis = Nis.new(host: '104.128.226.60')
14
8
 
15
9
  # /account/get?address={address}
16
10
  # -> account_get address: {address}
17
- # Passing parameters by keyword arguments.
18
- account_meta_pair = nis.account_get(address: keypair.address)
19
- account = account_meta_pair[:account]
20
- p account.balance
11
+ p nis.account_get(address: A_ADDRESS)
12
+ p nis.account_get_from_public_key(public_key: A_PUBLIC_KEY)
21
13
 
22
14
  # /account/get/from-public-key?public-key={key}
23
15
  # -> account_get_public_key public_key: {key}
24
- account_meta_pair = nis.account_get_from_public_key(public_key: keypair.public_key)
25
- account = account_meta_pair.account
26
- p account.address
16
+ p nis.account_get_forwarded(address: A_ADDRESS)
17
+ p nis.account_get_forwarded_from_public_key(public_key: A_PUBLIC_KEY)
@@ -3,6 +3,6 @@ Nis.logger.level = Logger::DEBUG
3
3
 
4
4
  A_ADDRESS = 'TDPP2C4XQLMESBMCYGWN4NRAJAKZEYRV75KGYSOB'
5
5
 
6
- nis = Nis.new(host: '23.228.67.85')
6
+ nis = Nis.new(host: '104.128.226.60')
7
7
 
8
8
  p nis.account_harvests(address: A_ADDRESS)
@@ -3,7 +3,7 @@ Nis.logger.level = Logger::DEBUG
3
3
 
4
4
  A_ADDRESS = 'TDPP2C4XQLMESBMCYGWN4NRAJAKZEYRV75KGYSOB'
5
5
 
6
- nis = Nis.new(host: '23.228.67.85')
6
+ nis = Nis.new(host: '104.128.226.60')
7
7
 
8
8
  p nis.account_historical_get(
9
9
  address: A_ADDRESS,
@@ -3,6 +3,6 @@ Nis.logger.level = Logger::DEBUG
3
3
 
4
4
  A_ADDRESS = 'TDPP2C4XQLMESBMCYGWN4NRAJAKZEYRV75KGYSOB'
5
5
 
6
- nis = Nis.new(host: '23.228.67.85')
6
+ nis = Nis.new(host: '104.128.226.60')
7
7
 
8
8
  p nis.account_importances
@@ -3,6 +3,6 @@ Nis.logger.level = Logger::DEBUG
3
3
 
4
4
  A_PRIVATE_KEY = '4ce5c8f9fce571db0d9ac1adf00b8d3ba0f078ed40835fd3d730a2f24b834214'
5
5
 
6
- nis = Nis.new(host: '23.228.67.85')
6
+ nis = Nis.new
7
7
 
8
8
  nis.account_lock(private_key: A_PRIVATE_KEY)
@@ -3,7 +3,7 @@ Nis.logger.level = Logger::DEBUG
3
3
 
4
4
  A_ADDRESS = 'TDPP2C4XQLMESBMCYGWN4NRAJAKZEYRV75KGYSOB'
5
5
 
6
- nis = Nis.new(host: '23.228.67.85')
6
+ nis = Nis.new(host: '104.128.226.60')
7
7
 
8
8
  p nis.account_mosaic_definition_page(address: A_ADDRESS)
9
9
  p nis.account_mosaic_owned(address: A_ADDRESS)
@@ -3,6 +3,6 @@ Nis.logger.level = Logger::DEBUG
3
3
 
4
4
  A_ADDRESS = 'TDPP2C4XQLMESBMCYGWN4NRAJAKZEYRV75KGYSOB'
5
5
 
6
- nis = Nis.new(host: '23.228.67.85')
6
+ nis = Nis.new(host: '104.128.226.60')
7
7
 
8
8
  p nis.account_namespace_page(address: A_ADDRESS)
@@ -3,6 +3,6 @@ Nis.logger.level = Logger::DEBUG
3
3
 
4
4
  A_ADDRESS = 'TDPP2C4XQLMESBMCYGWN4NRAJAKZEYRV75KGYSOB'
5
5
 
6
- nis = Nis.new(host: '23.228.67.85')
6
+ nis = Nis.new(host: '104.128.226.60')
7
7
 
8
8
  p nis.account_status(address: A_ADDRESS)
@@ -3,7 +3,7 @@ Nis.logger.level = Logger::DEBUG
3
3
 
4
4
  A_ADDRESS = 'TDPP2C4XQLMESBMCYGWN4NRAJAKZEYRV75KGYSOB'
5
5
 
6
- nis = Nis.new(host: '23.228.67.85')
6
+ nis = Nis.new(host: '104.128.226.60')
7
7
 
8
8
  # mapped methods
9
9
  p nis.account_transfers_incoming(address: A_ADDRESS)
@@ -3,6 +3,6 @@ Nis.logger.level = Logger::DEBUG
3
3
 
4
4
  A_ADDRESS = 'TDPP2C4XQLMESBMCYGWN4NRAJAKZEYRV75KGYSOB'
5
5
 
6
- nis = Nis.new(host: '23.228.67.85')
6
+ nis = Nis.new(host: '104.128.226.60')
7
7
 
8
8
  p nis.account_unconfirmed_transactions(address: A_ADDRESS)
@@ -3,6 +3,6 @@ Nis.logger.level = Logger::DEBUG
3
3
 
4
4
  A_PRIVATE_KEY = '4ce5c8f9fce571db0d9ac1adf00b8d3ba0f078ed40835fd3d730a2f24b834214'
5
5
 
6
- nis = Nis.new(host: '23.228.67.85')
6
+ nis = Nis.new
7
7
 
8
8
  nis.account_unlock(private_key: A_PRIVATE_KEY)
@@ -3,6 +3,6 @@ Nis.logger.level = Logger::DEBUG
3
3
 
4
4
  A_PRIVATE_KEY = '4ce5c8f9fce571db0d9ac1adf00b8d3ba0f078ed40835fd3d730a2f24b834214'
5
5
 
6
- nis = Nis.new(host: '23.228.67.85')
6
+ nis = Nis.new(host: '104.128.226.60')
7
7
 
8
8
  nis.account_unlock(private_key: A_PRIVATE_KEY)
@@ -1,7 +1,7 @@
1
1
  require 'nis'
2
2
  Nis.logger.level = Logger::DEBUG
3
3
 
4
- nis = Nis.new(host: '23.228.67.85')
4
+ nis = Nis.new(host: '104.128.226.60')
5
5
 
6
6
  FIXTURES_PATH = File.expand_path('../../spec/fixtures', __FILE__)
7
7
 
@@ -1,7 +1,7 @@
1
1
  require 'nis'
2
2
  Nis.logger.level = Logger::DEBUG
3
3
 
4
- nis = Nis.new(host: '23.228.67.85')
4
+ nis = Nis.new(host: '104.128.226.60')
5
5
 
6
6
  FIXTURES_PATH = File.expand_path('../../spec/fixtures', __FILE__)
7
7
 
@@ -1,4 +1,6 @@
1
1
  require 'nis'
2
2
  Nis.logger.level = Logger::DEBUG
3
3
 
4
+ nis = Nis.new(host: '104.128.226.60')
5
+
4
6
  p nis.block_at_public(block_height: 890_761)
@@ -1,4 +1,6 @@
1
1
  require 'nis'
2
2
  Nis.logger.level = Logger::DEBUG
3
3
 
4
+ nis = Nis.new(host: '104.128.226.60')
5
+
4
6
  p nis.block_get(block_hash: 'fb5e76bf137eb27451926d29fd2b308e672e5d9ec405d9cbcd47cc0f83492cd0')
@@ -1,7 +1,7 @@
1
1
  require 'nis'
2
2
  Nis.logger.level = Logger::DEBUG
3
3
 
4
- nis = Nis.new(host: '23.228.67.85')
4
+ nis = Nis.new(host: '104.128.226.60')
5
5
 
6
6
  # mapped methods
7
7
  p nis.debug_connections_incoming
@@ -1,6 +1,6 @@
1
1
  require 'nis'
2
2
  Nis.logger.level = Logger::DEBUG
3
3
 
4
- nis = Nis.new(host: '23.228.67.85')
4
+ nis = Nis.new(host: '104.128.226.60')
5
5
 
6
6
  p nis.debug_time_synchronization
@@ -0,0 +1,6 @@
1
+ require 'nis'
2
+ Nis.logger.level = Logger::DEBUG
3
+
4
+ nis = Nis.new(host: '104.128.226.60')
5
+
6
+ p nis.mosaic_supply(mosaic_id: 'nembar:vip')
@@ -1,6 +1,6 @@
1
1
  require 'nis'
2
2
  Nis.logger.level = Logger::DEBUG
3
3
 
4
- nis = Nis.new(host: '23.228.67.85')
4
+ nis = Nis.new(host: '104.128.226.60')
5
5
 
6
6
  p nis.namespace_mosaic_definition_page(namespace: 'alice.misc')
@@ -1,6 +1,6 @@
1
1
  require 'nis'
2
2
  Nis.logger.level = Logger::DEBUG
3
3
 
4
- nis = Nis.new(host: '23.228.67.85')
4
+ nis = Nis.new(host: '104.128.226.60')
5
5
 
6
6
  p nis.namespace_root_page
@@ -4,7 +4,7 @@ Nis.logger.level = Logger::DEBUG
4
4
  # Create NIS instance.
5
5
  # By default, connect to local NIS.
6
6
  # You also can connect to remote.
7
- nis = Nis.new(host: '23.228.67.85')
7
+ nis = Nis.new(host: '104.128.226.60')
8
8
 
9
9
  # API path /heartbeat, /status are mapped into methods.
10
10
  # It returns Nis::Struct::NemRequestResult object.
@@ -1,6 +1,6 @@
1
1
  require 'nis'
2
2
  Nis.logger.level = Logger::DEBUG
3
3
 
4
- nis = Nis.new(host: '23.228.67.85')
4
+ nis = Nis.new(host: '104.128.226.60')
5
5
 
6
6
  p nis.node_active_peers_max_chain_height
@@ -1,7 +1,7 @@
1
1
  require 'nis'
2
2
  Nis.logger.level = Logger::DEBUG
3
3
 
4
- nis = Nis.new(host: '23.228.67.85')
4
+ nis = Nis.new(host: '104.128.226.60')
5
5
 
6
6
  p nis.node_info
7
7
  p nis.node_extended_info
@@ -1,7 +1,7 @@
1
1
  require 'nis'
2
2
  Nis.logger.level = Logger::DEBUG
3
3
 
4
- nis = Nis.new(host: '23.228.67.85')
4
+ nis = Nis.new(host: '104.128.226.60')
5
5
 
6
6
  # mapped methods
7
7
  p nis.node_peerlist_all
@@ -1,6 +1,6 @@
1
1
  require 'nis'
2
2
  Nis.logger.level = Logger::DEBUG
3
3
 
4
- nis = Nis.new(host: '23.228.67.85')
4
+ nis = Nis.new(host: '104.128.226.60')
5
5
 
6
6
  p nis.time_sync_network_time
@@ -3,7 +3,7 @@ Nis.logger.level = Logger::DEBUG
3
3
 
4
4
  A_ADDRESS = 'TDPP2C4XQLMESBMCYGWN4NRAJAKZEYRV75KGYSOB'
5
5
 
6
- nis = Nis.new(host: '23.228.67.85')
6
+ nis = Nis.new(host: '104.128.226.60')
7
7
 
8
8
  # transfer
9
9
  hash = 'a7131c0836da45e72f61ac6e76259d7200a85f0d2cf38f79f223b2c366673b08'
@@ -5,6 +5,7 @@ nis = Nis.new
5
5
 
6
6
  # mosaic creator
7
7
  A_PRIVATE_KEY = '4ce5c8f9fce571db0d9ac1adf00b8d3ba0f078ed40835fd3d730a2f24b834214'
8
+ A_PUBLIC_KEY = 'be2ba9cb15a547110d511a4d43c0482fbb584d78781abac01fb053d18f4a0033'
8
9
  A_ADDRESS = 'TDPP2C4XQLMESBMCYGWN4NRAJAKZEYRV75KGYSOB'
9
10
 
10
11
  kp = Nis::Keypair.new(A_PRIVATE_KEY)
@@ -4,7 +4,7 @@ Nis.logger.level = Logger::DEBUG
4
4
  nis = Nis.new
5
5
 
6
6
  # multisig
7
- M_PUBLIC_KEY = '00f077782658ae91b77f238ba5fcd7ef110564b5c189072e4d4590d9b17f9d76f3'
7
+ M_PUBLIC_KEY = '6d72b57d2bc199d328e7ea3e24775f7f614760bc18f3f8501cd3daa9870cc40c'
8
8
 
9
9
  # cosignatory
10
10
  A_PRIVATE_KEY = '4ce5c8f9fce571db0d9ac1adf00b8d3ba0f078ed40835fd3d730a2f24b834214'
@@ -14,6 +14,7 @@ M_ADDRESS = 'TDJNDAQ7F7AQRXKP2YVTH67QYCWWKE6QLSJFWN64'
14
14
 
15
15
  # cosignatory2
16
16
  B_PRIVATE_KEY = '1d13af2c31ee6fb0c3c7aaaea818d9b305dcadba130ba663fc42d9f25b24ded1'
17
+ B_PUBLIC_KEY = '9e7ab2924cd1a3482df784db190614cfc8a33671f5d80a5b15a9c9e8b4d13933'
17
18
  B_ADDRESS = 'TA4TX6U5HG2MROAESH2JE5524T4ZOY2EQKQ6ELHF'
18
19
 
19
20
  kp = Nis::Keypair.new(B_PRIVATE_KEY)
@@ -1,7 +1,7 @@
1
1
  require 'nis'
2
2
  Nis.logger.level = Logger::DEBUG
3
3
 
4
- nis = Nis.new(host: '23.228.67.85')
4
+ nis = Nis.new(host: '104.128.226.60')
5
5
 
6
6
  # sender
7
7
  A_PRIVATE_KEY = '4ce5c8f9fce571db0d9ac1adf00b8d3ba0f078ed40835fd3d730a2f24b834214'
data/lib/nis.rb CHANGED
@@ -58,6 +58,8 @@ class Nis
58
58
  include Nis::Endpoint::Namespace::Mosaic
59
59
  include Nis::Endpoint::Namespace::Root
60
60
 
61
+ include Nis::Endpoint::Mosaic::Supply
62
+
61
63
  include Nis::Endpoint::Block::At
62
64
  include Nis::Endpoint::Block::Get
63
65
 
@@ -4,10 +4,7 @@ module Nis::Endpoint
4
4
  # @return [nil]
5
5
  # @see https://nemproject.github.io/#locking-and-unlocking-accounts
6
6
  def account_lock(private_key:)
7
- request!(:post, '/account/lock',
8
- privateKey: private_key
9
- )
10
- nil
7
+ request!(:post, '/account/lock', value: private_key)
11
8
  end
12
9
  end
13
10
  end
@@ -3,13 +3,15 @@ module Nis::Endpoint
3
3
  # @param [String] address
4
4
  # @param [String] hash
5
5
  # @param [String] id
6
+ # @param [Integer] page_size
6
7
  # @return [Array <Nis::Struct::TransactionMetaDataPair>]
7
8
  # @see https://nemproject.github.io/#requesting-transaction-data-for-an-account
8
- def account_transfers_incoming(address:, hash: nil, id: nil)
9
+ def account_transfers_incoming(address:, hash: nil, id: nil, page_size: nil)
9
10
  request!(:get, '/account/transfers/incoming',
10
11
  address: address,
11
12
  hash: hash,
12
- id: id
13
+ id: id,
14
+ pageSize: page_size
13
15
  ) do |res|
14
16
  res[:data].map { |tmdp| Nis::Struct::TransactionMetaDataPair.build(tmdp) }
15
17
  end
@@ -18,13 +20,15 @@ module Nis::Endpoint
18
20
  # @param [String] address
19
21
  # @param [String] hash
20
22
  # @param [String] id
23
+ # @param [Integer] page_size
21
24
  # @return [Array <Nis::Struct::TransactionMetaDataPair>]
22
25
  # @see https://nemproject.github.io/#requesting-transaction-data-for-an-account
23
- def account_transfers_outgoing(address:, hash: nil, id: nil)
26
+ def account_transfers_outgoing(address:, hash: nil, id: nil, page_size: nil)
24
27
  request!(:get, '/account/transfers/outgoing',
25
28
  address: address,
26
29
  hash: hash,
27
- id: id
30
+ id: id,
31
+ pageSize: page_size
28
32
  ) do |res|
29
33
  res[:data].map { |tmdp| Nis::Struct::TransactionMetaDataPair.build(tmdp) }
30
34
  end
@@ -33,13 +37,15 @@ module Nis::Endpoint
33
37
  # @param [String] address
34
38
  # @param [String] hash
35
39
  # @param [String] id
40
+ # @param [Integer] page_size
36
41
  # @return [Array <Nis::Struct::TransactionMetaDataPair>]
37
42
  # @see https://nemproject.github.io/#requesting-transaction-data-for-an-account
38
- def account_transfers_all(address:, hash: nil, id: nil)
43
+ def account_transfers_all(address:, hash: nil, id: nil, page_size: nil)
39
44
  request!(:get, '/account/transfers/all',
40
45
  address: address,
41
46
  hash: hash,
42
- id: id
47
+ id: id,
48
+ pageSize: page_size
43
49
  ) do |res|
44
50
  res[:data].map { |tmdp| Nis::Struct::TransactionMetaDataPair.build(tmdp) }
45
51
  end
@@ -49,13 +55,15 @@ module Nis::Endpoint
49
55
  # @param [String] address
50
56
  # @param [String] hash
51
57
  # @param [String] id
58
+ # @param [Integer] page_size
52
59
  # @return [Array <Nis::Struct::TransactionMetaDataPair>]
53
60
  # @see https://nemproject.github.io/#requesting-transaction-data-for-an-account
54
- def account_transfers(dir = :all, address:, hash: nil, id: nil)
61
+ def account_transfers(dir = :all, address:, hash: nil, id: nil, page_size: nil)
55
62
  request!(:get, "/account/transfers/#{account_transfers_direction(dir)}",
56
63
  address: address,
57
64
  hash: hash,
58
- id: id
65
+ id: id,
66
+ pageSize: page_size
59
67
  ) do |res|
60
68
  res[:data].map { |tmdp| Nis::Struct::TransactionMetaDataPair.build(tmdp) }
61
69
  end
@@ -4,9 +4,7 @@ module Nis::Endpoint
4
4
  # @return [nil]
5
5
  # @see https://nemproject.github.io/#locking-and-unlocking-accounts
6
6
  def account_unlock(private_key:)
7
- request!(:post, '/account/lock',
8
- privateKey: private_key
9
- )
7
+ request!(:post, '/account/unlock', value: private_key)
10
8
  end
11
9
  end
12
10
  end
@@ -0,0 +1,4 @@
1
+ module Nis::Endpoint
2
+ module Mosaic
3
+ end
4
+ end
@@ -0,0 +1,13 @@
1
+ module Nis::Endpoint
2
+ module Mosaic::Supply
3
+ # @return <Nis::Struct::MosaicSupply
4
+ # @see https://nemproject.github.io/#
5
+ def mosaic_supply(mosaic_id:)
6
+ request!(:get, '/mosaic/supply',
7
+ mosaicId: mosaic_id,
8
+ ) do |res|
9
+ Nis::Struct::MosaicSupply.build(res)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -54,7 +54,7 @@ class Nis::Struct
54
54
 
55
55
  # @return [Boolean]
56
56
  def valid?
57
- bytesize <= 512
57
+ bytesize <= 1024
58
58
  end
59
59
 
60
60
  # @return [Hash]
@@ -0,0 +1,14 @@
1
+ class Nis::Struct
2
+ # @attr [Nis::Struct::MosaicId] id
3
+ # @attr [Integer] supply
4
+ # @see https://nemproject.github.io/#
5
+ class MosaicSupply
6
+ include Nis::Util::Assignable
7
+ attr_accessor :mosaicId, :supply
8
+
9
+ def self.build(attrs)
10
+ attrs[:mosaicId] = MosaicId.build(attrs[:mosaicId])
11
+ new(attrs)
12
+ end
13
+ end
14
+ end
@@ -7,7 +7,7 @@ class Nis::Struct
7
7
  include Nis::Util::Assignable
8
8
  attr_accessor :metaData, :endpoint, :identity
9
9
 
10
- alias :meta_data :metaData
10
+ alias :meta_data :metaData
11
11
 
12
12
  def self.build(attrs)
13
13
  new(attrs)
@@ -48,6 +48,13 @@ module Nis::Util
48
48
  rstr2utf8(str).bytes.inject('') { |memo, b| memo << b.to_s(16) }
49
49
  end
50
50
 
51
+ # Convert hex to UTF-8
52
+ # @param [string] str
53
+ # @return [string]
54
+ def self.hex_to_utf8(hex_str)
55
+ [hex_str].pack('H*').force_encoding('UTF-8')
56
+ end
57
+
51
58
  # Convert an Array to hex
52
59
  # @param [Array] ua - An Uint8Array
53
60
  # @return [string]
@@ -85,8 +92,6 @@ module Nis::Util
85
92
  end
86
93
  end
87
94
 
88
- # Converts a raw javascript string into a string of single byte characters using utf8 encoding.
89
- # This makes it easier to perform other encoding operations on the string.
90
95
  # @param [String] str
91
96
  # @return [String]
92
97
  def self.rstr2utf8(str)
@@ -101,10 +106,5 @@ module Nis::Util
101
106
  end
102
107
  end
103
108
  end
104
-
105
- # Does the reverse of rstr2utf8.
106
- def utf82rstr(input)
107
- raise 'Not implemented.'
108
- end
109
109
  end
110
110
  end
@@ -37,7 +37,7 @@ module Nis::Util
37
37
  # s[60, 4] # length of payload
38
38
  tx[:message] = {
39
39
  type: deserialize_int(s[56, 4]),
40
- payload: deserialize_hex(s[64, s.size])
40
+ payload: Nis::Util::Convert.hex_to_utf8(deserialize_hex(s[64, s.size]))
41
41
  }
42
42
  else
43
43
  tx[:message] = { type: 1, payload: '' }
@@ -1,3 +1,3 @@
1
1
  class Nis
2
- VERSION = '0.0.18.1'.freeze
2
+ VERSION = '0.0.19'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nis-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.18.1
4
+ version: 0.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshiyuki Ieyama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-20 00:00:00.000000000 Z
11
+ date: 2017-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -201,6 +201,7 @@ files:
201
201
  - examples/debug/time_synchronization.rb
202
202
  - examples/local/account_transfers.rb
203
203
  - examples/local/chain_blocks_after.rb
204
+ - examples/mosaic/supply.rb
204
205
  - examples/namespace/mosaic_definition.rb
205
206
  - examples/namespace/root.rb
206
207
  - examples/nis.rb
@@ -254,6 +255,8 @@ files:
254
255
  - lib/nis/endpoint/heartbeat.rb
255
256
  - lib/nis/endpoint/local/account/transfers.rb
256
257
  - lib/nis/endpoint/local/chain.rb
258
+ - lib/nis/endpoint/mosaic.rb
259
+ - lib/nis/endpoint/mosaic/supply.rb
257
260
  - lib/nis/endpoint/namespace.rb
258
261
  - lib/nis/endpoint/namespace/mosaic.rb
259
262
  - lib/nis/endpoint/namespace/root.rb
@@ -318,6 +321,7 @@ files:
318
321
  - lib/nis/struct/mosaic_id.rb
319
322
  - lib/nis/struct/mosaic_levy.rb
320
323
  - lib/nis/struct/mosaic_properties.rb
324
+ - lib/nis/struct/mosaic_supply.rb
321
325
  - lib/nis/struct/mosaic_supply_change_transaction.rb
322
326
  - lib/nis/struct/multisig_aggregate_modification_transaction.rb
323
327
  - lib/nis/struct/multisig_cosignatory_modification.rb
@@ -393,7 +397,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
393
397
  version: '0'
394
398
  requirements: []
395
399
  rubyforge_project:
396
- rubygems_version: 2.6.11
400
+ rubygems_version: 2.6.8
397
401
  signing_key:
398
402
  specification_version: 4
399
403
  summary: Ruby client library for the NEM Infrastructure Server API