Class: Nem::Endpoint::Account
Instance Method Summary collapse
- #find(address) ⇒ Nem::Model::Account (also: #get)
- #find_by_public_key(public_key) ⇒ Nem::Model::Account
- #find_forwarded(address) ⇒ Nem::Model::Account
- #find_forwarded_by_public_key(public_key) ⇒ Nem::Model::Account
- #generate ⇒ Nem::Model::Keypair
- #harvests(address, hash: nil) ⇒ Array <Nem::Model::Harvest>
- #historical(address, start_height: nil, end_height: nil, increment: nil) ⇒ Array <Nem::Model::AccountHistorical>
- #importances ⇒ Array <Nem::Model::Importance>
- #lock(private_key) ⇒ nil
- #mosaic_definition(address, parent: nil, id: nil) ⇒ Array <Nem::Model::MosaicDefinition>
- #mosaic_owned(address) ⇒ Array <Nem::Model::AccountMetaDataPair>
- #namespace(address, parent: nil) ⇒ Array <Nem::Model::Namespace>
- #status(address) ⇒ Nem::Model::Account
- #transfers(address, hash: nil, id: nil, page_size: nil, dir: :all) ⇒ Array <Nem::Model::TransactionMetaDataPair>
- #transfers_all(address, hash: nil, id: nil, page_size: nil) ⇒ Array <Nem::Model::Transaction>
- #transfers_incoming(address, hash: nil, id: nil, page_size: nil) ⇒ Array <Nem::Model::Transaction>
- #transfers_outgoing(address, hash: nil, id: nil, page_size: nil) ⇒ Array <Nem::Model::Transaction>
- #unconfirmed_transactions(address) ⇒ Array <Nem::Model::Transaction> (also: #transfers_unconfirmed)
- #unlock(private_key) ⇒ nil
- #unlocked_info ⇒ Nem::Model::UnlockedInfo
Methods inherited from Base
#current_node, #initialize, #next_node!, #request, #request!
Constructor Details
This class inherits a constructor from Nem::Endpoint::Base
Instance Method Details
#find(address) ⇒ Nem::Model::Account Also known as: get
15 16 17 18 19 20 21 |
# File 'lib/nem/endpoint/account.rb', line 15 def find(address) request!(:get, '/account/get', address: address ) do |res| Nem::Model::Account.(res) end end |
#find_by_public_key(public_key) ⇒ Nem::Model::Account
28 29 30 31 32 33 34 |
# File 'lib/nem/endpoint/account.rb', line 28 def find_by_public_key(public_key) request!(:get, '/account/get/from-public-key', publicKey: public_key ) do |res| Nem::Model::Account.(res) end end |
#find_forwarded(address) ⇒ Nem::Model::Account
39 40 41 42 43 44 45 |
# File 'lib/nem/endpoint/account.rb', line 39 def find_forwarded(address) request!(:get, '/account/get/forwarded', address: address ) do |res| Nem::Model::Account.(res) end end |
#find_forwarded_by_public_key(public_key) ⇒ Nem::Model::Account
50 51 52 53 54 55 56 |
# File 'lib/nem/endpoint/account.rb', line 50 def find_forwarded_by_public_key(public_key) request!(:get, '/account/get/forwarded/from-public-key', publicKey: public_key ) do |res| Nem::Model::Account.(res) end end |
#generate ⇒ Nem::Model::Keypair
6 7 8 9 10 |
# File 'lib/nem/endpoint/account.rb', line 6 def generate request!(:get, '/account/generate') do |res| Nem::Model::Keypair.new_from_key_pair_view_model(res) end end |
#harvests(address, hash: nil) ⇒ Array <Nem::Model::Harvest>
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/nem/endpoint/account.rb', line 62 def harvests(address, hash: nil) request!(:get, '/account/harvests', address: address, hash: hash ) do |res| res[:data].map do |harvest| Nem::Model::Harvest.new_from_harvest(harvest) end end end |
#historical(address, start_height: nil, end_height: nil, increment: nil) ⇒ Array <Nem::Model::AccountHistorical>
89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/nem/endpoint/account.rb', line 89 def historical(address, start_height: nil, end_height: nil, increment: nil) request!(:get, '/account/historical/get', address: address, startHeight: start_height, endHeight: end_height, increment: increment ) do |res| res[:data].map do |ah| Nem::Model::AccountHistorical.new_from_account_historical(ah) end end end |
#importances ⇒ Array <Nem::Model::Importance>
75 76 77 78 79 80 81 |
# File 'lib/nem/endpoint/account.rb', line 75 def importances request!(:get, '/account/importances') do |res| res[:data].map do |aivm| Nem::Model::Importance.new_from_account_importance_view_model(aivm) end end end |
#lock(private_key) ⇒ nil
156 157 158 |
# File 'lib/nem/endpoint/account.rb', line 156 def lock(private_key) request!(:post, '/account/lock', value: private_key) end |
#mosaic_definition(address, parent: nil, id: nil) ⇒ Array <Nem::Model::MosaicDefinition>
107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/nem/endpoint/account.rb', line 107 def mosaic_definition(address, parent: nil, id: nil) request!(:get, '/account/mosaic/definition/page', address: address, parent: parent, id: id, ) do |res| res[:data].map do |modef| Nem::Model::MosaicDefinition.new_from_mosaic_definition(modef) end end end |
#mosaic_owned(address) ⇒ Array <Nem::Model::AccountMetaDataPair>
122 123 124 125 126 127 128 |
# File 'lib/nem/endpoint/account.rb', line 122 def mosaic_owned(address) request!(:get, '/account/mosaic/owned', address: address) do |res| Nem::Model::MosaicCollection.new( res[:data].map { |moa| Nem::Model::Mosaic.new_from_mosaic(moa) } ) end end |
#namespace(address, parent: nil) ⇒ Array <Nem::Model::Namespace>
136 137 138 139 140 141 142 |
# File 'lib/nem/endpoint/account.rb', line 136 def namespace(address, parent: nil) request!(:get, '/account/namespace/page', address: address, parent: parent) do |res| res[:data].map do |ns| Nem::Model::Namespace.new_from_namespace(ns) end end end |
#status(address) ⇒ Nem::Model::Account
147 148 149 150 151 |
# File 'lib/nem/endpoint/account.rb', line 147 def status(address) request!(:get, '/account/status', address: address) do |res| Nem::Model::Account.(res) end end |
#transfers(address, hash: nil, id: nil, page_size: nil, dir: :all) ⇒ Array <Nem::Model::TransactionMetaDataPair>
254 255 256 257 258 259 260 261 |
# File 'lib/nem/endpoint/account.rb', line 254 def transfers(address, hash: nil, id: nil, page_size: nil, dir: :all) case dir.to_s when /\Ain/ then transfers_incoming(address, hash, id, page_size) when /\Aout/ then transfers_outgoing(address, hash, id, page_size) when /\Aunconfirmed/ then transfers_unconfirmed(address) else transfers_all(address, hash, id, page_size) end end |
#transfers_all(address, hash: nil, id: nil, page_size: nil) ⇒ Array <Nem::Model::Transaction>
219 220 221 222 223 224 225 226 227 228 229 230 |
# File 'lib/nem/endpoint/account.rb', line 219 def transfers_all(address, hash: nil, id: nil, page_size: nil) request!(:get, '/account/transfers/all', address: address, hash: hash, id: id, pageSize: page_size ) do |res| res[:data].map do |tx| Nem::Model::Transaction.(tx) end end end |
#transfers_incoming(address, hash: nil, id: nil, page_size: nil) ⇒ Array <Nem::Model::Transaction>
181 182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/nem/endpoint/account.rb', line 181 def transfers_incoming(address, hash: nil, id: nil, page_size: nil) request!(:get, '/account/transfers/incoming', address: address, hash: hash, id: id, pageSize: page_size ) do |res| res[:data].map do |tx| Nem::Model::Transaction.(tx) end end end |
#transfers_outgoing(address, hash: nil, id: nil, page_size: nil) ⇒ Array <Nem::Model::Transaction>
200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/nem/endpoint/account.rb', line 200 def transfers_outgoing(address, hash: nil, id: nil, page_size: nil) request!(:get, '/account/transfers/outgoing', address: address, hash: hash, id: id, pageSize: page_size ) do |res| res[:data].map do |tx| Nem::Model::Transaction.(tx) end end end |
#unconfirmed_transactions(address) ⇒ Array <Nem::Model::Transaction> Also known as: transfers_unconfirmed
235 236 237 238 239 240 241 242 243 |
# File 'lib/nem/endpoint/account.rb', line 235 def unconfirmed_transactions(address) request!(:get, '/account/unconfirmedTransactions', address: address ) do |res| res[:data].map do |tx| Nem::Model::Transaction.(tx) end end end |
#unlock(private_key) ⇒ nil
163 164 165 |
# File 'lib/nem/endpoint/account.rb', line 163 def unlock(private_key) request!(:post, '/account/unlock', value: private_key) end |
#unlocked_info ⇒ Nem::Model::UnlockedInfo
169 170 171 172 173 |
# File 'lib/nem/endpoint/account.rb', line 169 def unlocked_info request!(:post, '/account/unlocked/info') do |res| Nem::Model::UnlockedInfo.new_from_unlocked_info(res) end end |