nem-ruby 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +119 -0
  5. data/.travis.yml +23 -0
  6. data/CODE_OF_CONDUCT.md +74 -0
  7. data/Gemfile +6 -0
  8. data/README.md +81 -0
  9. data/Rakefile +6 -0
  10. data/examples/apostille_audit.rb +22 -0
  11. data/examples/apostille_create.rb +31 -0
  12. data/examples/endpoint/account.rb +73 -0
  13. data/examples/endpoint/account_local.rb +21 -0
  14. data/examples/endpoint/block.rb +14 -0
  15. data/examples/endpoint/chain.rb +15 -0
  16. data/examples/endpoint/debug.rb +17 -0
  17. data/examples/endpoint/local.rb +17 -0
  18. data/examples/endpoint/mosaic.rb +9 -0
  19. data/examples/endpoint/namespace.rb +13 -0
  20. data/examples/endpoint/node.rb +24 -0
  21. data/examples/endpoint/timesync.rb +9 -0
  22. data/examples/endpoint/transaction.rb +42 -0
  23. data/examples/localnode.rb +0 -0
  24. data/examples/nis.rb +34 -0
  25. data/examples/node_pool.rb +23 -0
  26. data/examples/transaction/importance_transfer.rb +23 -0
  27. data/examples/transaction/mosaic_definition_creation.rb +52 -0
  28. data/examples/transaction/mosaic_supply_change.rb +25 -0
  29. data/examples/transaction/multisig_add_cosignatory.rb +31 -0
  30. data/examples/transaction/multisig_aggregate_modification.rb +29 -0
  31. data/examples/transaction/multisig_signature.rb +41 -0
  32. data/examples/transaction/multisig_transfer.rb +35 -0
  33. data/examples/transaction/provision_namespace.rb +20 -0
  34. data/examples/transaction/transfer.rb +32 -0
  35. data/examples/transaction/transfer_mosaic.rb +72 -0
  36. data/examples/transaction/transfer_with_encrypted_message.rb +40 -0
  37. data/examples/transaction/transfer_with_local.rb +34 -0
  38. data/lib/nem.rb +21 -0
  39. data/lib/nem/apostille.rb +104 -0
  40. data/lib/nem/apostille_audit.rb +47 -0
  41. data/lib/nem/client.rb +170 -0
  42. data/lib/nem/configuration.rb +29 -0
  43. data/lib/nem/endpoint.rb +4 -0
  44. data/lib/nem/endpoint/account.rb +264 -0
  45. data/lib/nem/endpoint/base.rb +45 -0
  46. data/lib/nem/endpoint/block.rb +15 -0
  47. data/lib/nem/endpoint/chain.rb +17 -0
  48. data/lib/nem/endpoint/debug.rb +54 -0
  49. data/lib/nem/endpoint/local/account.rb +54 -0
  50. data/lib/nem/endpoint/local/chain.rb +15 -0
  51. data/lib/nem/endpoint/mosaic.rb +13 -0
  52. data/lib/nem/endpoint/namespace.rb +37 -0
  53. data/lib/nem/endpoint/node.rb +83 -0
  54. data/lib/nem/endpoint/timesync.rb +9 -0
  55. data/lib/nem/endpoint/transaction.rb +34 -0
  56. data/lib/nem/error.rb +6 -0
  57. data/lib/nem/fee.rb +2 -0
  58. data/lib/nem/fee/importance_transfer.rb +24 -0
  59. data/lib/nem/fee/mosaic_definition_creation.rb +24 -0
  60. data/lib/nem/fee/mosaic_supply_change_transfer.rb +24 -0
  61. data/lib/nem/fee/multisig.rb +24 -0
  62. data/lib/nem/fee/multisig_aggregation_modification.rb +28 -0
  63. data/lib/nem/fee/provision_namespace.rb +34 -0
  64. data/lib/nem/fee/transfer.rb +66 -0
  65. data/lib/nem/keypair.rb +44 -0
  66. data/lib/nem/mixin.rb +2 -0
  67. data/lib/nem/mixin/assignable.rb +12 -0
  68. data/lib/nem/model.rb +3 -0
  69. data/lib/nem/model/account.rb +67 -0
  70. data/lib/nem/model/account_historical.rb +19 -0
  71. data/lib/nem/model/block.rb +33 -0
  72. data/lib/nem/model/chain.rb +14 -0
  73. data/lib/nem/model/connection.rb +23 -0
  74. data/lib/nem/model/experience.rb +20 -0
  75. data/lib/nem/model/explorer_block.rb +21 -0
  76. data/lib/nem/model/harvest.rb +23 -0
  77. data/lib/nem/model/heartbeat.rb +21 -0
  78. data/lib/nem/model/importance.rb +29 -0
  79. data/lib/nem/model/importance_transfer_transaction.rb +16 -0
  80. data/lib/nem/model/keypair.rb +19 -0
  81. data/lib/nem/model/message.rb +91 -0
  82. data/lib/nem/model/mosaic.rb +21 -0
  83. data/lib/nem/model/mosaic_attachment.rb +22 -0
  84. data/lib/nem/model/mosaic_definition.rb +65 -0
  85. data/lib/nem/model/mosaic_definition_creation_transaction.rb +18 -0
  86. data/lib/nem/model/mosaic_id.rb +27 -0
  87. data/lib/nem/model/mosaic_levy.rb +32 -0
  88. data/lib/nem/model/mosaic_owned.rb +22 -0
  89. data/lib/nem/model/mosaic_properties.rb +44 -0
  90. data/lib/nem/model/mosaic_supply.rb +21 -0
  91. data/lib/nem/model/mosaic_supply_change_transaction.rb +18 -0
  92. data/lib/nem/model/multisig_aggregate_modification_transaction.rb +21 -0
  93. data/lib/nem/model/multisig_info.rb +16 -0
  94. data/lib/nem/model/multisig_signature_transaction.rb +17 -0
  95. data/lib/nem/model/multisig_transaction.rb +21 -0
  96. data/lib/nem/model/namespace.rb +24 -0
  97. data/lib/nem/model/nem_announce_result.rb +19 -0
  98. data/lib/nem/model/network_time.rb +16 -0
  99. data/lib/nem/model/nis_node_info.rb +26 -0
  100. data/lib/nem/model/node.rb +41 -0
  101. data/lib/nem/model/provision_namespace_transaction.rb +18 -0
  102. data/lib/nem/model/status.rb +21 -0
  103. data/lib/nem/model/timer.rb +31 -0
  104. data/lib/nem/model/timesync.rb +19 -0
  105. data/lib/nem/model/transaction.rb +71 -0
  106. data/lib/nem/model/transfer_transaction.rb +24 -0
  107. data/lib/nem/model/unlocked_info.rb +24 -0
  108. data/lib/nem/mosaic.rb +2 -0
  109. data/lib/nem/mosaic/dim_coin.rb +21 -0
  110. data/lib/nem/mosaic/dim_token.rb +21 -0
  111. data/lib/nem/mosaic/ecobit_eco.rb +21 -0
  112. data/lib/nem/mosaic/xem.rb +21 -0
  113. data/lib/nem/node.rb +29 -0
  114. data/lib/nem/node_pool.rb +31 -0
  115. data/lib/nem/request.rb +2 -0
  116. data/lib/nem/request/announce.rb +76 -0
  117. data/lib/nem/transaction.rb +3 -0
  118. data/lib/nem/transaction/base.rb +45 -0
  119. data/lib/nem/transaction/importance_transfer.rb +42 -0
  120. data/lib/nem/transaction/mosaic_definition_creation.rb +45 -0
  121. data/lib/nem/transaction/mosaic_supply_change.rb +45 -0
  122. data/lib/nem/transaction/multisig.rb +29 -0
  123. data/lib/nem/transaction/multisig_aggregate_modification.rb +30 -0
  124. data/lib/nem/transaction/multisig_cosignatory_modification.rb +33 -0
  125. data/lib/nem/transaction/multisig_signature.rb +31 -0
  126. data/lib/nem/transaction/provision_namespace.rb +65 -0
  127. data/lib/nem/transaction/transfer.rb +63 -0
  128. data/lib/nem/util.rb +44 -0
  129. data/lib/nem/util/assignable.rb +51 -0
  130. data/lib/nem/util/convert.rb +112 -0
  131. data/lib/nem/util/deserializer.rb +158 -0
  132. data/lib/nem/util/ed25519.rb +316 -0
  133. data/lib/nem/util/serializer.rb +260 -0
  134. data/lib/nem/version.rb +3 -0
  135. data/nem-ruby.gemspec +46 -0
  136. metadata +350 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 74250572f96e346748c614f5dca30929f2f4deed
4
+ data.tar.gz: e2e273e49e7d9c5defc1f94b2093cf551ae8e92a
5
+ SHA512:
6
+ metadata.gz: f71c7a0ca04e9f2f0a0169790ee3e63cc56075498a72ce306a25a0c2b3db4b1bfd86648b804f63095a3fa8ad77cfee54e5e9629772e6e3871cede0a65f183dce
7
+ data.tar.gz: 37ce2b96c1ba4bfb0fe926e14536dd88374f2913a4540651857b45d34841b41c251fc2d8fa4dbc5218048af2e108edcc74631f11e13543c2297c0a800a15694b
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -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
@@ -0,0 +1,23 @@
1
+ sudo: false
2
+ language: ruby
3
+ cache: bundler
4
+ bundler_args: --without development
5
+
6
+ rvm:
7
+ - ruby-head
8
+ - 2.4.0
9
+ - 2.3.0
10
+ - 2.2.6
11
+
12
+ branches:
13
+ only:
14
+ - master
15
+ - development
16
+
17
+ matrix:
18
+ fast_finish: true
19
+
20
+ before_install:
21
+ # Bundler on Travis may be too out of date
22
+ # Update bundler to a recent version.
23
+ - gem install bundler
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at yukku0423@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in nem-ruby.gemspec
6
+ gemspec
@@ -0,0 +1,81 @@
1
+ # nem-ruby
2
+
3
+ [![Build Status](https://travis-ci.org/44uk/nem-ruby.svg?branch=master)](https://travis-ci.org/44uk/nem-ruby)
4
+ [![Gem Version](https://badge.fury.io/rb/nem-ruby.svg)](https://badge.fury.io/rb/nem-ruby)
5
+ [![Code Climate](https://codeclimate.com/github/44uk/nem-ruby/badges/gpa.svg)](https://codeclimate.com/github/44uk/nem-ruby)
6
+ [![Join the chat at https://gitter.im/44uk/nem-ruby](https://badges.gitter.im/44uk/nem-ruby.svg)](https://gitter.im/44uk/nem-ruby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
7
+
8
+ <img src="https://cloud.githubusercontent.com/assets/370508/24320282/a332d238-1175-11e7-96dc-75bc30e562d2.png" width="280" height="280" alt="nem" align="right" />
9
+
10
+ Ruby gem for communicating with the nem.
11
+
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
+ For further development of nem with ruby, [feel free to send me your feedback!](#feedback-and-contact)
17
+
18
+ * [NEM \- Distributed Ledger Technology \(Blockchain\)](https://www.nem.io/)
19
+ * [NEM NIS API Documentation](https://nemproject.github.io/)
20
+ * [NEM Forum](https://forum.nem.io/)
21
+ * [NEM Testnet Faucet \- You can get Testnet XEM for development / testing.](http://test-nem-faucet.44uk.net/)
22
+
23
+ ## Installation
24
+
25
+ ```bash
26
+ $ gem install nem-ruby
27
+ ```
28
+
29
+ Or add this line to your application's Gemfile:
30
+
31
+ ```ruby
32
+ gem 'nem-ruby'
33
+ ```
34
+
35
+ ## Usage
36
+
37
+ ```ruby
38
+ require 'pp'
39
+ require 'nem'
40
+
41
+ node = Nem::Node.new(host: '104.128.226.60')
42
+ account_endpoint = Nem::Endpoint::Account.new(node)
43
+
44
+ pp account_endpoint.find('TBULEAUG2CZQISUR442HWA6UAKGWIXHDABJVIPS4')
45
+ # => #<Nem::Model::Account:0x007fe95b35f560
46
+ # @address="TBULEAUG2CZQISUR442HWA6UAKGWIXHDABJVIPS4",
47
+ # @balance=68000000,
48
+ # @cosignatories=[],
49
+ # @cosignatory_of=[],
50
+ # @harvested_blocks=1,
51
+ # @importance=0.0,
52
+ # @label=nil,
53
+ # @public_key=
54
+ # "e59ef184a612d4c3c4d89b5950eb57262c69862b2f96e59c5043bf41765c482f",
55
+ # @remote_status="INACTIVE",
56
+ # @status="LOCKED",
57
+ # @vested_balance=62145647>
58
+ ```
59
+
60
+ ### Examples
61
+
62
+ More specific example codes are in **[examples/](examples/)** directory.
63
+
64
+ ## Feedback and Contact
65
+
66
+ For further development of nem with ruby, feel free to send me your feedback!
67
+
68
+ * [@44uk_i3 - Twitter](https://twitter.com/44uk_i3)
69
+ * [44uk/nem-ruby - gitter](https://gitter.im/44uk/nem-ruby)
70
+
71
+ ## For More Information
72
+
73
+ * [Documentation for nem-ruby - rubydoc.info](http://www.rubydoc.info/gems/nem-ruby)
74
+
75
+ ## Contributing
76
+
77
+ Bug reports and pull requests are welcome on GitHub at https://github.com/44uk/nem-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
78
+
79
+ ## License
80
+
81
+ The gem is available as open source under the terms of the [MIT License](LICENSE).
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -0,0 +1,22 @@
1
+ require 'pp'
2
+ require 'nem'
3
+
4
+ Nem.logger.level = Logger::DEBUG
5
+
6
+ FIXTURES_PATH = File.expand_path('../../spec/fixtures', __FILE__)
7
+
8
+ node = Nem::Node.new(host: '104.128.226.60')
9
+ tx_endpoint = Nem::Endpoint::Transaction.new(node)
10
+
11
+ # transaction hash from Filename
12
+ tx_hash = 'c035c2603356852687c4730fbc6f8d21da3af7c4c0eb8b3619bc9ecdc833255a'
13
+ tx = tx_endpoint.find(tx_hash)
14
+
15
+ # NOTE: it may return "Hash was not found in cache"
16
+ # because of NIS not supporting caching transactions.
17
+ # 'fe4e545902cde315617a435ebfd5fe8875d699e2f2363262f5'
18
+ apostille_hash = tx.message.payload
19
+ file = File.open("#{FIXTURES_PATH}/nemLogoV2 -- Apostille TX c035c2603356852687c4730fbc6f8d21da3af7c4c0eb8b3619bc9ecdc833255a -- Date 2017-12-18.png")
20
+
21
+ apa = Nem::ApostilleAudit.new(file, apostille_hash)
22
+ pp apa.valid? ? 'OK, Valid Apostille!' : 'Bad, Invalid Apostille!'
@@ -0,0 +1,31 @@
1
+ require 'pp'
2
+ require 'nem'
3
+
4
+ Nem.logger.level = Logger::DEBUG
5
+
6
+ FIXTURES_PATH = File.expand_path('../../spec/fixtures', __FILE__)
7
+
8
+ # sender
9
+ A_PRIVATE_KEY = '4ce5c8f9fce571db0d9ac1adf00b8d3ba0f078ed40835fd3d730a2f24b834214'
10
+
11
+ kp = Nem::Keypair.new(A_PRIVATE_KEY)
12
+ node = Nem::Node.new(host: '23.228.67.85')
13
+ tx_endpoint = Nem::Endpoint::Transaction.new(node)
14
+
15
+ file = File.open("#{FIXTURES_PATH}/nemLogoV2.png")
16
+ apo = Nem::Apostille.new(kp, file, :sha1,
17
+ multisig: false,
18
+ private: false,
19
+ network: :testnet
20
+ )
21
+ tx = apo.transaction
22
+ pp "Fee: #{tx.fee.to_i}"
23
+
24
+ req = Nem::Request::Announce.new(tx, kp)
25
+ res = tx_endpoint.announce(req)
26
+
27
+ pp "Message: #{res.message}"
28
+ pp "TransactionHash: #{res.transaction_hash}"
29
+ pp "ApostilleFormat: #{apo.apostille_format(res.transaction_hash)}"
30
+
31
+ FileUtils.cp(file.path, apo.apostille_format(res.transaction_hash))
@@ -0,0 +1,73 @@
1
+ require 'pp'
2
+ require 'nem'
3
+
4
+ Nem.logger.level = Logger::DEBUG
5
+
6
+ # single node
7
+ # node = Nem::Node.new(host: '104.128.226.60')
8
+
9
+ # multiple nodes
10
+ node = Nem::NodePool.new([
11
+ Nem::Node.new(host: 'bigalice2.nem.ninja'),
12
+ Nem::Node.new(host: '192.3.61.243'),
13
+ Nem::Node.new(host: '104.128.226.60')
14
+ ])
15
+
16
+ # new Account Endpoint Object
17
+ account_endpoint = Nem::Endpoint::Account.new(node)
18
+
19
+ # find by address
20
+ pp account_endpoint.find('TBULEAUG2CZQISUR442HWA6UAKGWIXHDABJVIPS4')
21
+
22
+ # find by public key
23
+ pp account_endpoint.find_by_public_key('e59ef184a612d4c3c4d89b5950eb57262c69862b2f96e59c5043bf41765c482f')
24
+
25
+ # find forwarded by address
26
+ pp account_endpoint.find_forwarded('TBULEAUG2CZQISUR442HWA6UAKGWIXHDABJVIPS4')
27
+
28
+ # find forwarded by public key
29
+ pp account_endpoint.find_forwarded_by_public_key('e59ef184a612d4c3c4d89b5950eb57262c69862b2f96e59c5043bf41765c482f')
30
+
31
+ # fetch harvests
32
+ pp account_endpoint.harvests('TBULEAUG2CZQISUR442HWA6UAKGWIXHDABJVIPS4')
33
+
34
+ # namespace
35
+ pp account_endpoint.namespace('TDPICOQ7GIEMIDJOOMIQSOYIJKG3C7V7OP2DUFIR')
36
+
37
+ # fetch mosaic definition of account
38
+ pp account_endpoint.mosaic_definition('TDPICOQ7GIEMIDJOOMIQSOYIJKG3C7V7OP2DUFIR')
39
+
40
+ # fetch owned mosaics of account
41
+ pp account_endpoint.mosaic_owned('TDPICOQ7GIEMIDJOOMIQSOYIJKG3C7V7OP2DUFIR')
42
+
43
+ # transfers
44
+
45
+ ## incomings
46
+ pp account_endpoint.transfers_incoming('TBULEAUG2CZQISUR442HWA6UAKGWIXHDABJVIPS4')
47
+
48
+ ## outgoings
49
+ pp account_endpoint.transfers_outgoing('TBULEAUG2CZQISUR442HWA6UAKGWIXHDABJVIPS4')
50
+
51
+ ## all
52
+ pp account_endpoint.transfers_all('TBULEAUG2CZQISUR442HWA6UAKGWIXHDABJVIPS4')
53
+
54
+ ## unconfirmed
55
+ pp account_endpoint.transfers_unconfirmed('TBULEAUG2CZQISUR442HWA6UAKGWIXHDABJVIPS4')
56
+
57
+ # status
58
+ # pp account_endpoint.status('TBULEAUG2CZQISUR442HWA6UAKGWIXHDABJVIPS4')
59
+ pp account_endpoint.status('TDJNDAQ7F7AQRXKP2YVTH67QYCWWKE6QLSJFWN64')
60
+ pp account_endpoint.status('TDPP2C4XQLMESBMCYGWN4NRAJAKZEYRV75KGYSOB')
61
+
62
+ # fetch importances
63
+ pp account_endpoint.importances
64
+
65
+ # unlock info
66
+ pp account_endpoint.unlocked_info
67
+
68
+ # historical data
69
+ pp account_endpoint.historical('TDWWYDGQNBKSAJBSHZX7QWVX7WNVAWWB7HGPWRB2',
70
+ start_height: 1245390,
71
+ end_height: 1245400,
72
+ increment: 1
73
+ )