nis-ruby 0.0.6.1 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +119 -0
- data/demo/request_account.rb +8 -8
- data/demo/request_block.rb +11 -0
- data/demo/request_debug.rb +7 -14
- data/demo/request_local.rb +20 -0
- data/demo/request_namespace.rb +11 -0
- data/demo/request_nis.rb +0 -1
- data/demo/request_node.rb +31 -0
- data/demo/request_transaction.rb +6 -7
- data/lib/nis/client.rb +1 -1
- data/lib/nis/endpoint/account/get.rb +4 -4
- data/lib/nis/endpoint/account/harvests.rb +3 -3
- data/lib/nis/endpoint/account/historical.rb +5 -5
- data/lib/nis/endpoint/account/lock.rb +1 -1
- data/lib/nis/endpoint/account/mosaic.rb +4 -4
- data/lib/nis/endpoint/account/namespace.rb +5 -5
- data/lib/nis/endpoint/account/status.rb +1 -1
- data/lib/nis/endpoint/account/transfers.rb +12 -12
- data/lib/nis/endpoint/account/unconfirmed_transactions.rb +7 -2
- data/lib/nis/endpoint/account/unlock.rb +1 -1
- data/lib/nis/endpoint/block/at.rb +10 -0
- data/lib/nis/endpoint/block/get.rb +10 -0
- data/lib/nis/endpoint/block.rb +4 -0
- data/lib/nis/endpoint/chain/height.rb +11 -0
- data/lib/nis/endpoint/chain/last_block.rb +14 -0
- data/lib/nis/endpoint/chain/score.rb +11 -0
- data/lib/nis/endpoint/local/account/transfers.rb +34 -0
- data/lib/nis/endpoint/local/chain.rb +16 -0
- data/lib/nis/endpoint/namespace/mosaic.rb +15 -0
- data/lib/nis/endpoint/namespace/root.rb +14 -0
- data/lib/nis/endpoint/namespace.rb +10 -0
- data/lib/nis/endpoint/node/active_peers.rb +11 -0
- data/lib/nis/endpoint/node/boot.rb +10 -0
- data/lib/nis/endpoint/node/experiences.rb +9 -0
- data/lib/nis/endpoint/node/extended_info.rb +9 -0
- data/lib/nis/endpoint/node/info.rb +9 -0
- data/lib/nis/endpoint/node/peer_list.rb +25 -0
- data/lib/nis/endpoint/node.rb +4 -0
- data/lib/nis/endpoint/transaction/announce.rb +1 -1
- data/lib/nis/endpoint/transaction/prepareAnnounce.rb +1 -1
- data/lib/nis/error.rb +1 -0
- data/lib/nis/struct/account_meta_data.rb +1 -1
- data/lib/nis/struct/account_meta_data_pair.rb +4 -4
- data/lib/nis/struct/account_private_key_transactions_page.rb +14 -0
- data/lib/nis/struct/application_meta_data.rb +21 -0
- data/lib/nis/struct/block.rb +24 -0
- data/lib/nis/struct/block_height.rb +22 -0
- data/lib/nis/struct/block_score.rb +17 -0
- data/lib/nis/struct/boot_node_request.rb +23 -0
- data/lib/nis/struct/error.rb +18 -0
- data/lib/nis/struct/explorer_block_view_model.rb +17 -0
- data/lib/nis/struct/explorer_transfer_view_model.rb +18 -0
- data/lib/nis/struct/explorer_view_model_transaction.rb +16 -0
- data/lib/nis/struct/extended_node_experience_pair.rb +14 -0
- data/lib/nis/struct/harvest_info.rb +2 -2
- data/lib/nis/struct/mosaic_definition.rb +2 -0
- data/lib/nis/struct/mosaic_definition_meta_data.rb +12 -0
- data/lib/nis/struct/mosaic_definition_meta_data_pair.rb +16 -0
- data/lib/nis/struct/mosaic_levy.rb +18 -0
- data/lib/nis/struct/mosaic_properties.rb +8 -3
- data/lib/nis/struct/namespace_meta_data.rb +12 -0
- data/lib/nis/struct/namespace_meta_data_pair.rb +16 -0
- data/lib/nis/struct/nis_node_info.rb +19 -0
- data/lib/nis/struct/node_collection.rb +20 -0
- data/lib/nis/struct/node_experience.rb +13 -0
- data/lib/nis/struct/node_info.rb +28 -0
- data/lib/nis/struct/request_announce.rb +13 -0
- data/lib/nis/struct/transaction_meta_data.rb +3 -6
- data/lib/nis/struct/transaction_meta_data_pair.rb +2 -5
- data/lib/nis/struct/unconfirmed_transaction_meta_data_pair.rb +5 -5
- data/lib/nis/util.rb +2 -1
- data/lib/nis/version.rb +1 -1
- data/lib/nis.rb +21 -0
- metadata +46 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 061a83269fcef596e746171c60d75f215c1ee99c
|
4
|
+
data.tar.gz: 943f352e756874a0622196046708e533c2b43a56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 430fbd5bebbfd64f3edef98fca026873a7255b710e987af87dc77bd09597f8111aa3c04e15eb2ef6c0b5f7df91d4636cdff685c02f5d02030cfede35c5d53679
|
7
|
+
data.tar.gz: a32054344daeef7210c1c4dfbadf08629a2fb213d4f209e545ab36dec02bb56e3f308daeaa50f1bfaeabdd37bec75918ea223f5876db1ff4660e4e58aac46542
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.2
|
3
|
+
DisabledByDefault: true
|
4
|
+
Exclude:
|
5
|
+
- '**/vendor/**/*'
|
6
|
+
|
7
|
+
# Prefer &&/|| over and/or.
|
8
|
+
Style/AndOr:
|
9
|
+
Enabled: true
|
10
|
+
|
11
|
+
# Do not use braces for hash literals when they are the last argument of a
|
12
|
+
# method call.
|
13
|
+
Style/BracesAroundHashParameters:
|
14
|
+
Enabled: true
|
15
|
+
|
16
|
+
# Align `when` with `case`.
|
17
|
+
Style/CaseIndentation:
|
18
|
+
Enabled: true
|
19
|
+
|
20
|
+
# Align comments with method definitions.
|
21
|
+
Style/CommentIndentation:
|
22
|
+
Enabled: true
|
23
|
+
|
24
|
+
# No extra empty lines.
|
25
|
+
Style/EmptyLines:
|
26
|
+
Enabled: true
|
27
|
+
|
28
|
+
# In a regular class definition, no empty lines around the body.
|
29
|
+
Style/EmptyLinesAroundClassBody:
|
30
|
+
Enabled: true
|
31
|
+
|
32
|
+
# In a regular method definition, no empty lines around the body.
|
33
|
+
Style/EmptyLinesAroundMethodBody:
|
34
|
+
Enabled: true
|
35
|
+
|
36
|
+
# In a regular module definition, no empty lines around the body.
|
37
|
+
Style/EmptyLinesAroundModuleBody:
|
38
|
+
Enabled: true
|
39
|
+
|
40
|
+
# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
|
41
|
+
Style/HashSyntax:
|
42
|
+
Enabled: true
|
43
|
+
|
44
|
+
# Method definitions after `private` or `protected` isolated calls need one
|
45
|
+
# extra level of indentation.
|
46
|
+
Style/IndentationConsistency:
|
47
|
+
Enabled: true
|
48
|
+
|
49
|
+
# Two spaces, no tabs (for indentation).
|
50
|
+
Style/IndentationWidth:
|
51
|
+
Enabled: true
|
52
|
+
|
53
|
+
Style/SpaceAfterColon:
|
54
|
+
Enabled: true
|
55
|
+
|
56
|
+
Style/SpaceAfterComma:
|
57
|
+
Enabled: true
|
58
|
+
|
59
|
+
Style/SpaceAroundEqualsInParameterDefault:
|
60
|
+
Enabled: true
|
61
|
+
|
62
|
+
Style/SpaceAroundKeyword:
|
63
|
+
Enabled: true
|
64
|
+
|
65
|
+
Style/SpaceAroundOperators:
|
66
|
+
Enabled: true
|
67
|
+
|
68
|
+
Style/SpaceBeforeFirstArg:
|
69
|
+
Enabled: true
|
70
|
+
|
71
|
+
# Defining a method with parameters needs parentheses.
|
72
|
+
Style/MethodDefParentheses:
|
73
|
+
Enabled: true
|
74
|
+
|
75
|
+
# Use `foo {}` not `foo{}`.
|
76
|
+
Style/SpaceBeforeBlockBraces:
|
77
|
+
Enabled: true
|
78
|
+
|
79
|
+
# Use `foo { bar }` not `foo {bar}`.
|
80
|
+
Style/SpaceInsideBlockBraces:
|
81
|
+
Enabled: true
|
82
|
+
|
83
|
+
# Use `{ a: 1 }` not `{a:1}`.
|
84
|
+
Style/SpaceInsideHashLiteralBraces:
|
85
|
+
Enabled: true
|
86
|
+
|
87
|
+
Style/SpaceInsideParens:
|
88
|
+
Enabled: true
|
89
|
+
|
90
|
+
# Check quotes usage according to lint rule below.
|
91
|
+
Style/StringLiterals:
|
92
|
+
Enabled: true
|
93
|
+
EnforcedStyle: single_quotes
|
94
|
+
|
95
|
+
# Detect hard tabs, no hard tabs.
|
96
|
+
Style/Tab:
|
97
|
+
Enabled: true
|
98
|
+
|
99
|
+
# Blank lines should not have any spaces.
|
100
|
+
Style/TrailingBlankLines:
|
101
|
+
Enabled: true
|
102
|
+
|
103
|
+
# No trailing whitespace.
|
104
|
+
Style/TrailingWhitespace:
|
105
|
+
Enabled: true
|
106
|
+
|
107
|
+
# Use quotes for string literals when they are enough.
|
108
|
+
Style/UnneededPercentQ:
|
109
|
+
Enabled: true
|
110
|
+
|
111
|
+
# Align `end` with the matching keyword or starting expression except for
|
112
|
+
# assignments, where it should be aligned with the LHS.
|
113
|
+
Lint/EndAlignment:
|
114
|
+
Enabled: true
|
115
|
+
EnforcedStyleAlignWith: variable
|
116
|
+
|
117
|
+
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
118
|
+
Lint/RequireParentheses:
|
119
|
+
Enabled: true
|
data/demo/request_account.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'nis'
|
2
|
-
|
2
|
+
hr = '-' * 64
|
3
3
|
|
4
4
|
# create NIS instance
|
5
5
|
nis = Nis.new
|
@@ -9,32 +9,32 @@ nis = Nis.new
|
|
9
9
|
# Each endpoint mapped into method name.
|
10
10
|
# It returns Nis::Struct object which mapped API response.
|
11
11
|
keypair = nis.account_generate
|
12
|
-
puts
|
12
|
+
puts hr
|
13
13
|
|
14
14
|
# Access properties.
|
15
15
|
# Names are same API response.
|
16
16
|
puts keypair.address
|
17
17
|
puts keypair.privateKey
|
18
18
|
puts keypair.publicKey
|
19
|
-
puts
|
19
|
+
puts hr
|
20
20
|
|
21
21
|
# Ruby style access.
|
22
22
|
# Also can be access property by snakecase.
|
23
23
|
puts keypair.private_key
|
24
24
|
puts keypair.public_key
|
25
|
-
puts
|
25
|
+
puts hr
|
26
26
|
|
27
27
|
# hash like access.
|
28
28
|
# Also can be access property like hash.
|
29
29
|
puts keypair[:privateKey]
|
30
30
|
puts keypair[:private_key]
|
31
|
-
puts
|
31
|
+
puts hr
|
32
32
|
|
33
33
|
# Address object
|
34
34
|
# Some property wrapped by value object.
|
35
35
|
puts address = keypair.address
|
36
36
|
puts address.testnet?
|
37
|
-
puts
|
37
|
+
puts hr
|
38
38
|
|
39
39
|
# /account/get?address={address}
|
40
40
|
# -> account_get address: {address}
|
@@ -42,11 +42,11 @@ puts _hr
|
|
42
42
|
account_meta_pair = nis.account_get address: keypair.address
|
43
43
|
account = account_meta_pair[:account]
|
44
44
|
puts account.balance
|
45
|
-
puts
|
45
|
+
puts hr
|
46
46
|
|
47
47
|
# /account/get/from-public-key?public-key={key}
|
48
48
|
# -> account_get_public_key public_key: {key}
|
49
49
|
account_meta_pair = nis.account_get_from_public_key public_key: keypair.public_key
|
50
50
|
account = account_meta_pair.account
|
51
51
|
puts account.address
|
52
|
-
puts
|
52
|
+
puts hr
|
data/demo/request_debug.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'pp'
|
2
2
|
require 'nis'
|
3
|
-
|
3
|
+
hr = '-' * 64
|
4
4
|
|
5
5
|
# create NIS instance
|
6
6
|
nis = Nis.new
|
@@ -10,40 +10,33 @@ incoming = nis.debug_connections_incoming
|
|
10
10
|
incoming[:outstanding].each do |ai|
|
11
11
|
puts ai.to_hash
|
12
12
|
end
|
13
|
-
puts
|
13
|
+
puts hr
|
14
14
|
|
15
15
|
incoming[:most_recent].each do |ai|
|
16
16
|
puts ai.to_hash
|
17
17
|
end
|
18
|
-
puts
|
19
|
-
|
20
|
-
|
18
|
+
puts hr
|
21
19
|
|
22
20
|
outgoing = nis.debug_connections_outgoing
|
23
21
|
|
24
22
|
outgoing[:outstanding].each do |ai|
|
25
23
|
puts ai.to_hash
|
26
24
|
end
|
27
|
-
puts
|
25
|
+
puts hr
|
28
26
|
|
29
27
|
outgoing[:most_recent].each do |ai|
|
30
28
|
puts ai.to_hash
|
31
29
|
end
|
32
|
-
puts
|
33
|
-
|
34
|
-
|
30
|
+
puts hr
|
35
31
|
|
36
32
|
timers = nis.debug_connections_timers
|
37
33
|
timers.each do |t|
|
38
34
|
puts t.to_hash
|
39
35
|
end
|
40
|
-
puts
|
41
|
-
|
42
|
-
|
36
|
+
puts hr
|
43
37
|
|
44
38
|
syncs = nis.debug_time_synchronization
|
45
39
|
syncs.each do |sync|
|
46
40
|
puts sync.to_hash
|
47
41
|
end
|
48
|
-
puts
|
49
|
-
|
42
|
+
puts hr
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'nis'
|
2
|
+
hr = '-' * 64
|
3
|
+
|
4
|
+
nis = Nis.new
|
5
|
+
|
6
|
+
page = Nis::Struct::AccountPrivateKeyTransactionsPage.new(
|
7
|
+
value: '00b4a68d16dc505302e9631b860664ba43a8183f0903bc5782a2403b2f9eb3c8a1'
|
8
|
+
)
|
9
|
+
|
10
|
+
puts nis.local_account_transfers_incoming(page: page)
|
11
|
+
puts hr
|
12
|
+
|
13
|
+
puts nis.local_account_transfers_outgoing(page: page)
|
14
|
+
puts hr
|
15
|
+
|
16
|
+
puts nis.local_account_transfers_all(page: page)
|
17
|
+
puts hr
|
18
|
+
|
19
|
+
puts nis.local_chain_blocks_after(block_height: 2649)
|
20
|
+
puts hr
|
data/demo/request_nis.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'nis'
|
2
|
+
hr = '-' * 64
|
3
|
+
|
4
|
+
# create NIS instance
|
5
|
+
nis = Nis.new
|
6
|
+
|
7
|
+
puts nis.node_info
|
8
|
+
puts hr
|
9
|
+
|
10
|
+
puts nis.node_extended_info
|
11
|
+
puts hr
|
12
|
+
|
13
|
+
puts nis.node_experiences
|
14
|
+
puts hr
|
15
|
+
|
16
|
+
puts nis.node_peerlist_all
|
17
|
+
puts hr
|
18
|
+
|
19
|
+
puts nis.node_peerlist_reachable
|
20
|
+
puts hr
|
21
|
+
|
22
|
+
puts nis.node_peerlist_active
|
23
|
+
puts hr
|
24
|
+
|
25
|
+
puts nis.node_active_peers_max_chain_height
|
26
|
+
puts hr
|
27
|
+
|
28
|
+
# bnr = Nis::Struct::BootNodeRequest.new(
|
29
|
+
# )
|
30
|
+
# puts nis.node_boot(boot_node_request: bnr)
|
31
|
+
# puts hr
|
data/demo/request_transaction.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'nis'
|
2
|
-
|
3
|
-
_hr = '-' * 64
|
2
|
+
hr = '-' * 64
|
4
3
|
|
5
4
|
# Account A (Source)
|
6
5
|
A_ADDRESS = 'TAH4MBR6MNLZKJAVW5ZJCMFAL7RS5U2YODUQKLCT'.freeze
|
@@ -36,14 +35,14 @@ rpa = Nis::Struct::RequestPrepareAnnounce.new(
|
|
36
35
|
nis = Nis.new
|
37
36
|
|
38
37
|
# check banalces before sending XEM.
|
39
|
-
puts
|
38
|
+
puts 'Account A => balance: %d' %
|
40
39
|
(nis.account_get address: A_ADDRESS)[:account][:balance]
|
41
|
-
puts
|
40
|
+
puts 'Account B => balance: %d' %
|
42
41
|
(nis.account_get address: B_ADDRESS)[:account][:balance]
|
43
|
-
puts
|
42
|
+
puts hr
|
44
43
|
|
45
44
|
# Send XEM request.
|
46
|
-
|
47
|
-
|
45
|
+
res = nis.transaction_prepare_announce(request_prepare_announce: rpa)
|
46
|
+
puts res.message
|
48
47
|
|
49
48
|
# After several minutes, check to see Account B received XEM.
|
data/lib/nis/client.rb
CHANGED
@@ -31,7 +31,7 @@ class Nis::Client
|
|
31
31
|
# @param [Hash] params API Parameters
|
32
32
|
# @return [Hash] Hash converted API Response
|
33
33
|
def request(method, path, params = {})
|
34
|
-
if params.is_a?(Hash)
|
34
|
+
if params.is_a?(Hash) && !params.empty?
|
35
35
|
params.reject! { |_, value| value.nil? }
|
36
36
|
end
|
37
37
|
res = connection.send(method, path, params)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Nis::Endpoint
|
2
2
|
module Account::Get
|
3
|
-
# @
|
3
|
+
# @param [String] address
|
4
4
|
# @return [Nis::Struct::AccountMetaDataPair]
|
5
5
|
# @see http://bob.nem.ninja/docs/#requesting-the-account-data
|
6
6
|
def account_get(address:)
|
@@ -11,7 +11,7 @@ module Nis::Endpoint
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
# @
|
14
|
+
# @param [String] public_key
|
15
15
|
# @return [Nis::Struct::AccountMetaDataPair]
|
16
16
|
# @see http://bob.nem.ninja/docs/#requesting-the-account-data
|
17
17
|
def account_get_from_public_key(public_key:)
|
@@ -22,7 +22,7 @@ module Nis::Endpoint
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
# @
|
25
|
+
# @param [String] address
|
26
26
|
# @return [Nis::Struct::AccountMetaDataPair]
|
27
27
|
# @see http://bob.nem.ninja/docs/#requesting-the-original-account-data-for-a-delegate-account
|
28
28
|
def account_get_forwarded(address:)
|
@@ -33,7 +33,7 @@ module Nis::Endpoint
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
# @
|
36
|
+
# @param [String] public_key
|
37
37
|
# @return [Nis::Struct::AccountMetaDataPair] delegate account
|
38
38
|
# @see http://bob.nem.ninja/docs/#requesting-the-original-account-data-for-a-delegate-account
|
39
39
|
def account_get_forwarded_from_public_key(public_key:)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Nis::Endpoint
|
2
2
|
module Account::Harvests
|
3
|
-
# @
|
4
|
-
# @
|
3
|
+
# @param [String] address
|
4
|
+
# @param [String] hash
|
5
5
|
# @return [Array <Nis::Struct::HarvestInfo>]
|
6
6
|
# @see http://bob.nem.ninja/docs/#requesting-harvest-info-data-for-an-account
|
7
7
|
def account_harvests(address:, hash: nil)
|
@@ -9,7 +9,7 @@ module Nis::Endpoint
|
|
9
9
|
address: address,
|
10
10
|
hash: hash
|
11
11
|
) do |res|
|
12
|
-
res[:data].map{|hvst| Nis::Struct::HarvestInfo.build(hvst) }
|
12
|
+
res[:data].map { |hvst| Nis::Struct::HarvestInfo.build(hvst) }
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module Nis::Endpoint
|
2
2
|
module Account::Historical
|
3
|
-
# @
|
4
|
-
# @
|
5
|
-
# @
|
6
|
-
# @
|
3
|
+
# @param [String] address
|
4
|
+
# @param [Integer] start_height
|
5
|
+
# @param [Integer] end_height
|
6
|
+
# @param [Integer] increment
|
7
7
|
# @return [Array <Nis::Struct::AccountHistoricalDataViewModel>]
|
8
8
|
# @see http://bob.nem.ninja/docs/#retrieving-historical-account-data
|
9
9
|
def account_historical_get(address:, start_height:, end_height:, increment:)
|
@@ -13,7 +13,7 @@ module Nis::Endpoint
|
|
13
13
|
endHeight: end_height,
|
14
14
|
increment: increment
|
15
15
|
) do |res|
|
16
|
-
res[:data].map{|ahdvm| Nis::Struct::AccountHistoricalDataViewModel(ahdvm) }
|
16
|
+
res[:data].map { |ahdvm| Nis::Struct::AccountHistoricalDataViewModel(ahdvm) }
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Nis::Endpoint
|
2
2
|
module Account::Mosaic
|
3
|
-
# @
|
4
|
-
# @
|
5
|
-
# @
|
3
|
+
# @param [String] address
|
4
|
+
# @param [String] parent
|
5
|
+
# @param [String] id
|
6
6
|
# @return [Array <Nis::Struct::MosaicDefinition>]
|
7
7
|
# @see http://bob.nem.ninja/docs/##retrieving-mosaic-definitions-that-an-account-has-created
|
8
8
|
def account_mosaic_definition_page(address:, parent: nil, id: nil)
|
@@ -15,7 +15,7 @@ module Nis::Endpoint
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
# @
|
18
|
+
# @param [String] address
|
19
19
|
# @return [Array <Nis::Struct::AccountMetaDataPair>]
|
20
20
|
# @see http://bob.nem.ninja/docs/#retrieving-mosaics-that-an-account-owns
|
21
21
|
def account_mosaic_owned(address:)
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module Nis::Endpoint
|
2
2
|
module Account::Namespace
|
3
|
-
# @
|
4
|
-
# @
|
5
|
-
# @
|
6
|
-
# @
|
3
|
+
# @param [String] address
|
4
|
+
# @param [String] parent
|
5
|
+
# @param [String] id
|
6
|
+
# @param [Integer] page_size
|
7
7
|
# @return [Array <Nis::Struct::Namespace>]
|
8
8
|
# @see http://bob.nem.ninja/docs/#retrieving-namespaces-that-an-account-owns
|
9
9
|
def account_namespace_page(address:, parent: nil, id: nil, page_size: nil)
|
@@ -13,7 +13,7 @@ module Nis::Endpoint
|
|
13
13
|
id: id,
|
14
14
|
pageSize: page_size
|
15
15
|
) do |res|
|
16
|
-
res[:data].map{|ns| Nis::Struct::Namespace.build(ns) }
|
16
|
+
res[:data].map { |ns| Nis::Struct::Namespace.build(ns) }
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Nis::Endpoint
|
2
2
|
module Account::Transfers
|
3
|
-
# @
|
4
|
-
# @
|
5
|
-
# @
|
3
|
+
# @param [String] address
|
4
|
+
# @param [String] hash
|
5
|
+
# @param [String] id
|
6
6
|
# @return [Array <Nis::Struct::TransactionMetaDataPair>]
|
7
7
|
# @see http://bob.nem.ninja/docs/#requesting-transaction-data-for-an-account
|
8
8
|
def account_transfers_incoming(address:, hash: nil, id: nil)
|
@@ -11,13 +11,13 @@ module Nis::Endpoint
|
|
11
11
|
hash: hash,
|
12
12
|
id: id
|
13
13
|
) do |res|
|
14
|
-
res[:data].map{|tmdp| Nis::Struct::TransactionMetaDataPair.build(tmdp) }
|
14
|
+
res[:data].map { |tmdp| Nis::Struct::TransactionMetaDataPair.build(tmdp) }
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
# @
|
19
|
-
# @
|
20
|
-
# @
|
18
|
+
# @param [String] address
|
19
|
+
# @param [String] hash
|
20
|
+
# @param [String] id
|
21
21
|
# @return [Array <Nis::Struct::TransactionMetaDataPair>]
|
22
22
|
# @see http://bob.nem.ninja/docs/#requesting-transaction-data-for-an-account
|
23
23
|
def account_transfers_outgoing(address:, hash: nil, id: nil)
|
@@ -26,13 +26,13 @@ module Nis::Endpoint
|
|
26
26
|
hash: hash,
|
27
27
|
id: id
|
28
28
|
) do |res|
|
29
|
-
res[:data].map{|tmdp| Nis::Struct::TransactionMetaDataPair.build(tmdp) }
|
29
|
+
res[:data].map { |tmdp| Nis::Struct::TransactionMetaDataPair.build(tmdp) }
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
# @
|
34
|
-
# @
|
35
|
-
# @
|
33
|
+
# @param [String] address
|
34
|
+
# @param [String] hash
|
35
|
+
# @param [String] id
|
36
36
|
# @return [Array <Nis::Struct::TransactionMetaDataPair>]
|
37
37
|
# @see http://bob.nem.ninja/docs/#requesting-transaction-data-for-an-account
|
38
38
|
def account_transfers_all(address:, hash: nil, id: nil)
|
@@ -41,7 +41,7 @@ module Nis::Endpoint
|
|
41
41
|
hash: hash,
|
42
42
|
id: id
|
43
43
|
) do |res|
|
44
|
-
res[:data].map{|tmdp| Nis::Struct::TransactionMetaDataPair.build(tmdp) }
|
44
|
+
res[:data].map { |tmdp| Nis::Struct::TransactionMetaDataPair.build(tmdp) }
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
@@ -1,11 +1,16 @@
|
|
1
1
|
module Nis::Endpoint
|
2
2
|
module Account::UnconfirmedTransactions
|
3
|
-
# @
|
3
|
+
# @param [String] address
|
4
4
|
# @return [Array <Nis::Struct::UnconfirmedTransactionMetaDataPair>]
|
5
5
|
# @see http://bob.nem.ninja/docs/#requesting-transaction-data-for-an-account
|
6
6
|
def account_unconfirmed_transactions(address:)
|
7
7
|
request!(:get, '/account/unconfirmedTransactions', address: address) do |res|
|
8
|
-
res[:data].map
|
8
|
+
res[:data].map do |utmdp|
|
9
|
+
Nis::Struct::UnconfirmedTransactionMetaDataPair.build(
|
10
|
+
meta: utmdp[:meta],
|
11
|
+
transaction: utmdp[:data]
|
12
|
+
)
|
13
|
+
end
|
9
14
|
end
|
10
15
|
end
|
11
16
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module Nis::Endpoint
|
2
|
+
module Block::At
|
3
|
+
# @param [Integer] block_height
|
4
|
+
# @return [Nis::Struct::Block]
|
5
|
+
# @see http://bob.nem.ninja/docs/#getting-a-block-with-a-given-height
|
6
|
+
def block_at_public(block_height:)
|
7
|
+
Nis::Struct::Block.build request!(:post, '/block/at/public', height: block_height)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module Nis::Endpoint
|
2
|
+
module Block::Get
|
3
|
+
# @param [String] block_hash
|
4
|
+
# @return [Nis::Struct::Block]
|
5
|
+
# @see http://bob.nem.ninja/docs/#requesting-parts-of-the-block-chain
|
6
|
+
def block_get(block_hash:)
|
7
|
+
Nis::Struct::Block.build request!(:get, '/block/get', blockHash: block_hash)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Nis::Endpoint
|
2
|
+
module Chain
|
3
|
+
module LastBlock
|
4
|
+
# @return [Nis::Struct::Block]
|
5
|
+
# @see http://bob.nem.ninja/docs/#last-block-of-the-block-chain-score
|
6
|
+
def chain_last_block
|
7
|
+
request!(:get, '/chain/last-block') do |res|
|
8
|
+
res[:transactions] = res[:transactions].map { |t| Nis::Struct::Transaction.new(t) }
|
9
|
+
Nis::Struct::Block.build res
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|