nanook 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- var search_data = {"index":{"searchIndex":["nanook","account","block","error","key","node","rpc","util","wallet","walletaccount","workpeer","nano_to_raw()","account()","account()","account()","account_id()","accounts()","add()","balance()","balance()","block()","block_count()","block_count_type()","bootstrap()","bootstrap_any()","call()","cancel_work()","chain()","change_password()","change_seed()","clear()","coerce_empty_string_to_type()","contains?()","create()","create()","delegators()","destroy()","destroy()","exists?()","export()","frontier_count()","generate()","generate_work()","history()","history()","id()","id()","id()","id()","info()","info()","info()","inspect()","is_valid_work?()","key()","ledger()","list()","locked?()","method_missing()","new()","new()","new()","new()","new()","new()","new()","new()","new()","node()","pay()","pay()","peers()","pending()","pending?()","process()","public_key()","raw_to_nano()","receive()","receive()","representative()","representatives()","republish()","stop()","successors()","sync_progress()","synced?()","unlock()","version()","wallet()","wallet_id()","weight()","work_peers()","readme"],"longSearchIndex":["nanook","nanook::account","nanook::block","nanook::error","nanook::key","nanook::node","nanook::rpc","nanook::util","nanook::wallet","nanook::walletaccount","nanook::workpeer","nanook::util::nano_to_raw()","nanook#account()","nanook::block#account()","nanook::wallet#account()","nanook::walletaccount#account_id()","nanook::wallet#accounts()","nanook::workpeer#add()","nanook::account#balance()","nanook::wallet#balance()","nanook#block()","nanook::node#block_count()","nanook::node#block_count_type()","nanook::node#bootstrap()","nanook::node#bootstrap_any()","nanook::rpc#call()","nanook::block#cancel_work()","nanook::block#chain()","nanook::wallet#change_password()","nanook::wallet#change_seed()","nanook::workpeer#clear()","nanook::util::coerce_empty_string_to_type()","nanook::wallet#contains?()","nanook::wallet#create()","nanook::walletaccount#create()","nanook::account#delegators()","nanook::wallet#destroy()","nanook::walletaccount#destroy()","nanook::account#exists?()","nanook::wallet#export()","nanook::node#frontier_count()","nanook::key#generate()","nanook::block#generate_work()","nanook::account#history()","nanook::block#history()","nanook::account#id()","nanook::block#id()","nanook::key#id()","nanook::wallet#id()","nanook::account#info()","nanook::block#info()","nanook::key#info()","nanook#inspect()","nanook::block#is_valid_work?()","nanook#key()","nanook::account#ledger()","nanook::workpeer#list()","nanook::wallet#locked?()","nanook::walletaccount#method_missing()","nanook::new()","nanook::account::new()","nanook::block::new()","nanook::key::new()","nanook::node::new()","nanook::rpc::new()","nanook::wallet::new()","nanook::walletaccount::new()","nanook::workpeer::new()","nanook#node()","nanook::wallet#pay()","nanook::walletaccount#pay()","nanook::node#peers()","nanook::account#pending()","nanook::block#pending?()","nanook::block#process()","nanook::account#public_key()","nanook::util::raw_to_nano()","nanook::wallet#receive()","nanook::walletaccount#receive()","nanook::account#representative()","nanook::node#representatives()","nanook::block#republish()","nanook::node#stop()","nanook::block#successors()","nanook::node#sync_progress()","nanook::node#synced?()","nanook::wallet#unlock()","nanook::node#version()","nanook#wallet()","nanook::walletaccount#wallet_id()","nanook::account#weight()","nanook#work_peers()",""],"info":[["Nanook","","classes/Nanook.html","","<p>Initializing\n<p>Connect to the default RPC host at localhost:7076 and with a timeout of 500\nseconds:\n\n<pre><code>nanook ...\n</code></pre>\n"],["Nanook::Account","","classes/Nanook/Account.html","","<p>The <code>Nanook::Account</code> class contains methods to discover\npublicly-available information about accounts …\n"],["Nanook::Block","","classes/Nanook/Block.html","","<p>The <code>Nanook::Block</code> class contains methods to discover\npublicly-available information about blocks on the …\n"],["Nanook::Error","","classes/Nanook/Error.html","",""],["Nanook::Key","","classes/Nanook/Key.html","",""],["Nanook::Node","","classes/Nanook/Node.html","",""],["Nanook::Rpc","","classes/Nanook/Rpc.html","",""],["Nanook::Util","","classes/Nanook/Util.html","",""],["Nanook::Wallet","","classes/Nanook/Wallet.html","","<p>The <code>Nanook::Wallet</code> class lets you manage your nano wallets, as\nwell as some account-specific things like …\n"],["Nanook::WalletAccount","","classes/Nanook/WalletAccount.html","",""],["Nanook::WorkPeer","","classes/Nanook/WorkPeer.html","",""],["NANO_to_raw","Nanook::Util","classes/Nanook/Util.html#method-c-NANO_to_raw","(nano)",""],["account","Nanook","classes/Nanook.html#method-i-account","(account=nil)","<p>Returns a Nanook::Account instance.\n\n<pre><code>nanook = Nanook.new\n\naccount = nanook.account\naccount = nanook.account(&quot;xrb_3e3j5tkog48pnny9dmfzj1r16pg8t1e76dz5tmac6iq689wyjfpi00000000&quot;)\n</code></pre>\n"],["account","Nanook::Block","classes/Nanook/Block.html#method-i-account","()",""],["account","Nanook::Wallet","classes/Nanook/Wallet.html#method-i-account","(account=nil)","<p>A convenient method that returns an account in your wallet, allowing you to\nperform all the actions in …\n"],["account_id","Nanook::WalletAccount","classes/Nanook/WalletAccount.html#method-i-account_id","()",""],["accounts","Nanook::Wallet","classes/Nanook/Wallet.html#method-i-accounts","()","<p>Returns an Array with Strings of all account ids in the wallet.\n<p>Example response\n\n<pre><code>[\n &quot;xrb_3e3j5tkog48pnny9dmfzj1r16pg8t1e76dz5tmac6iq689wyjfpi00000000&quot;, ...\n</code></pre>\n"],["add","Nanook::WorkPeer","classes/Nanook/WorkPeer.html#method-i-add","(address:, port:)",""],["balance","Nanook::Account","classes/Nanook/Account.html#method-i-balance","(unit: Nanook::WalletAccount::DEFAULT_UNIT)","<p>Returns a Hash containing the account&#39;s balance. Units are in raw.\n<p><code>:balance</code> &mdash; Account balance\n<p><code>:pending</code> … &mdash; "],["balance","Nanook::Wallet","classes/Nanook/Wallet.html#method-i-balance","(account_break_down: false, unit: Nanook::WalletAccount::DEFAULT_UNIT)",""],["block","Nanook","classes/Nanook.html#method-i-block","(block=nil)",""],["block_count","Nanook::Node","classes/Nanook/Node.html#method-i-block_count","()",""],["block_count_type","Nanook::Node","classes/Nanook/Node.html#method-i-block_count_type","()",""],["bootstrap","Nanook::Node","classes/Nanook/Node.html#method-i-bootstrap","(address:, port:)",""],["bootstrap_any","Nanook::Node","classes/Nanook/Node.html#method-i-bootstrap_any","()",""],["call","Nanook::Rpc","classes/Nanook/Rpc.html#method-i-call","(action, params={})",""],["cancel_work","Nanook::Block","classes/Nanook/Block.html#method-i-cancel_work","()",""],["chain","Nanook::Block","classes/Nanook/Block.html#method-i-chain","(limit: 1000)",""],["change_password","Nanook::Wallet","classes/Nanook/Wallet.html#method-i-change_password","(password)","<p>Changes the password for a wallet. Returns a boolean to indicate if the\naction was successful.\n<p>Example …\n"],["change_seed","Nanook::Wallet","classes/Nanook/Wallet.html#method-i-change_seed","(seed)",""],["clear","Nanook::WorkPeer","classes/Nanook/WorkPeer.html#method-i-clear","()",""],["coerce_empty_string_to_type","Nanook::Util","classes/Nanook/Util.html#method-c-coerce_empty_string_to_type","(response, type)",""],["contains?","Nanook::Wallet","classes/Nanook/Wallet.html#method-i-contains-3F","(account)","<p>Returns boolean indicating if the wallet contains an account.\n<p>Arguments\n<p><code>account</code> &mdash; String account id (will …\n"],["create","Nanook::Wallet","classes/Nanook/Wallet.html#method-i-create","()","<p>Creates a new wallet.\n\n<pre><code>Nanook.new.wallet.create\n</code></pre>\n<p>Very important\n"],["create","Nanook::WalletAccount","classes/Nanook/WalletAccount.html#method-i-create","()",""],["delegators","Nanook::Account","classes/Nanook/Account.html#method-i-delegators","()","<p>Example response\n\n<pre><code>{\n &quot;xrb_13bqhi1cdqq8yb9szneoc38qk899d58i5rcrgdk5mkdm86hekpoez3zxw5sd&quot;: &quot;500000000000000000000000000000000000&quot;, ...\n</code></pre>\n"],["destroy","Nanook::Wallet","classes/Nanook/Wallet.html#method-i-destroy","()","<p>Destroy the wallet. Returns a boolean indicating whether the action was\nsuccessful or not.\n<p>Example Response …\n"],["destroy","Nanook::WalletAccount","classes/Nanook/WalletAccount.html#method-i-destroy","()",""],["exists?","Nanook::Account","classes/Nanook/Account.html#method-i-exists-3F","()","<p>Returns a boolean indicating if account is known. Note, the reliability of\nthe check depends on the node …\n"],["export","Nanook::Wallet","classes/Nanook/Wallet.html#method-i-export","()","<p>Generates a String containing a JSON representation of your wallet.\n<p>Example response\n\n<pre><code>&quot;{\\n \\&quot;0000000000000000000000000000000000000000000000000000000000000000\\&quot;: ...\n</code></pre>\n"],["frontier_count","Nanook::Node","classes/Nanook/Node.html#method-i-frontier_count","()",""],["generate","Nanook::Key","classes/Nanook/Key.html#method-i-generate","(seed: nil, index: nil)",""],["generate_work","Nanook::Block","classes/Nanook/Block.html#method-i-generate_work","()",""],["history","Nanook::Account","classes/Nanook/Account.html#method-i-history","(limit: 1000)","<p>Returns an account&#39;s history of send and receive payments. Amounts are\nin raw.\n<p>Arguments\n<p><code>limit:</code> &mdash; Integer …\n"],["history","Nanook::Block","classes/Nanook/Block.html#method-i-history","(limit: 1000)",""],["id","Nanook::Account","classes/Nanook/Account.html#method-i-id","()",""],["id","Nanook::Block","classes/Nanook/Block.html#method-i-id","()",""],["id","Nanook::Key","classes/Nanook/Key.html#method-i-id","()",""],["id","Nanook::Wallet","classes/Nanook/Wallet.html#method-i-id","()",""],["info","Nanook::Account","classes/Nanook/Account.html#method-i-info","(detailed: false)","<p>Returns a Hash containing the following information about an account:\n<p><code>:frontier</code> &mdash; The latest block hash …\n"],["info","Nanook::Block","classes/Nanook/Block.html#method-i-info","(allow_unchecked: false)",""],["info","Nanook::Key","classes/Nanook/Key.html#method-i-info","()",""],["inspect","Nanook","classes/Nanook.html#method-i-inspect","()",""],["is_valid_work?","Nanook::Block","classes/Nanook/Block.html#method-i-is_valid_work-3F","(work)",""],["key","Nanook","classes/Nanook.html#method-i-key","(key=nil)",""],["ledger","Nanook::Account","classes/Nanook/Account.html#method-i-ledger","(limit: 1)","<p>Returns information about the given account as well as other accounts up\nthe ledger. The number of accounts …\n"],["list","Nanook::WorkPeer","classes/Nanook/WorkPeer.html#method-i-list","()",""],["locked?","Nanook::Wallet","classes/Nanook/Wallet.html#method-i-locked-3F","()","<p>Returns a boolean to indicate if the wallet is locked.\n<p>Example response\n\n<pre><code>true\n</code></pre>\n"],["method_missing","Nanook::WalletAccount","classes/Nanook/WalletAccount.html#method-i-method_missing","(m, *args, &block)","<p>Any method of Nanook::Account can be called on this class too\n"],["new","Nanook","classes/Nanook.html#method-c-new","(uri=Nanook::Rpc::DEFAULT_URI, timeout:Nanook::Rpc::DEFAULT_TIMEOUT)","<p>Arguments\n<p><code>uri</code> - RPC host to connect to (default is “localhost:7076”)\n<p><code>timeout:</code> - Connection timeout …\n"],["new","Nanook::Account","classes/Nanook/Account.html#method-c-new","(rpc, account)",""],["new","Nanook::Block","classes/Nanook/Block.html#method-c-new","(rpc, block)",""],["new","Nanook::Key","classes/Nanook/Key.html#method-c-new","(rpc, key=nil)",""],["new","Nanook::Node","classes/Nanook/Node.html#method-c-new","(rpc)",""],["new","Nanook::Rpc","classes/Nanook/Rpc.html#method-c-new","(uri=DEFAULT_URI, timeout:DEFAULT_TIMEOUT)",""],["new","Nanook::Wallet","classes/Nanook/Wallet.html#method-c-new","(rpc, wallet)",""],["new","Nanook::WalletAccount","classes/Nanook/WalletAccount.html#method-c-new","(rpc, wallet, account)",""],["new","Nanook::WorkPeer","classes/Nanook/WorkPeer.html#method-c-new","(rpc)",""],["node","Nanook","classes/Nanook.html#method-i-node","()",""],["pay","Nanook::Wallet","classes/Nanook/Wallet.html#method-i-pay","(from:, to:, amount:, unit: Nanook::WalletAccount::DEFAULT_UNIT, id:)","<p>Make a payment from an account in your wallet to another account on the\nnano network. Returns a <em>send</em> …\n"],["pay","Nanook::WalletAccount","classes/Nanook/WalletAccount.html#method-i-pay","(to:, amount:, unit: DEFAULT_UNIT, id:)",""],["peers","Nanook::Node","classes/Nanook/Node.html#method-i-peers","()",""],["pending","Nanook::Account","classes/Nanook/Account.html#method-i-pending","(limit: 1000, detailed: false)","<p>Returns information about pending block hashes that are waiting to be\nreceived by the account.\n<p>The default …\n"],["pending?","Nanook::Block","classes/Nanook/Block.html#method-i-pending-3F","()",""],["process","Nanook::Block","classes/Nanook/Block.html#method-i-process","()",""],["public_key","Nanook::Account","classes/Nanook/Account.html#method-i-public_key","()","<p>Returns the public key belonging to an account.\n<p>Example response\n\n<pre><code>&quot;3068BB1CA04525BB0E416C485FE6A67FD52540227D267CC8B6E8DA958A7FA039&quot;\n</code></pre>\n"],["raw_to_NANO","Nanook::Util","classes/Nanook/Util.html#method-c-raw_to_NANO","(raw)",""],["receive","Nanook::Wallet","classes/Nanook/Wallet.html#method-i-receive","(block=nil, into:)","<p>Receives a pending payment into an account in the wallet.\n<p>When called with no <code>block</code> argument, the latest …\n"],["receive","Nanook::WalletAccount","classes/Nanook/WalletAccount.html#method-i-receive","(block=nil)","<p>Returns false if no block to receive\n"],["representative","Nanook::Account","classes/Nanook/Account.html#method-i-representative","()","<p>Returns a String of the representative account for the account.\nRepresentatives are accounts which cast …\n"],["representatives","Nanook::Node","classes/Nanook/Node.html#method-i-representatives","()",""],["republish","Nanook::Block","classes/Nanook/Block.html#method-i-republish","(destinations:nil, sources:nil)",""],["stop","Nanook::Node","classes/Nanook/Node.html#method-i-stop","()",""],["successors","Nanook::Block","classes/Nanook/Block.html#method-i-successors","(limit: 1000)",""],["sync_progress","Nanook::Node","classes/Nanook/Node.html#method-i-sync_progress","()",""],["synced?","Nanook::Node","classes/Nanook/Node.html#method-i-synced-3F","()",""],["unlock","Nanook::Wallet","classes/Nanook/Wallet.html#method-i-unlock","(password)","<p>Unlocks a previously locked wallet. Returns a boolean to indicate if the\naction was successful.\n<p>Example …\n"],["version","Nanook::Node","classes/Nanook/Node.html#method-i-version","()",""],["wallet","Nanook","classes/Nanook.html#method-i-wallet","(wallet=nil)",""],["wallet_id","Nanook::WalletAccount","classes/Nanook/WalletAccount.html#method-i-wallet_id","()",""],["weight","Nanook::Account","classes/Nanook/Account.html#method-i-weight","()","<p>Returns the account&#39;s weight. Weight is determined by the account&#39;s\nbalance, and represents the …\n"],["work_peers","Nanook","classes/Nanook.html#method-i-work_peers","()",""],["README","","files/README_md.html","","<p>Nanook\n<p>This is a Ruby library for managing a nano currency node, including making\nand receiving payments, …\n"]]}}
1
+ var search_data = {"index":{"searchIndex":["nanook","account","block","error","key","node","rpc","util","wallet","walletaccount","workpeer","nano_to_raw()","account()","account()","account()","account_id()","accounts()","add()","balance()","balance()","block()","block_count()","block_count_type()","bootstrap()","bootstrap_any()","call()","cancel_work()","chain()","change_password()","clear()","coerce_empty_string_to_type()","contains?()","create()","create()","delegators()","destroy()","destroy()","exists?()","export()","frontier_count()","generate()","generate_work()","history()","history()","id()","id()","id()","id()","info()","info()","info()","inspect()","is_valid_work?()","key()","ledger()","list()","locked?()","method_missing()","new()","new()","new()","new()","new()","new()","new()","new()","new()","node()","pay()","pay()","peers()","pending()","pending?()","process()","public_key()","publish()","raw_to_nano()","receive()","receive()","representative()","representatives()","republish()","stop()","successors()","sync_progress()","synced?()","unlock()","version()","wallet()","wallet_id()","weight()","work_peers()","readme"],"longSearchIndex":["nanook","nanook::account","nanook::block","nanook::error","nanook::key","nanook::node","nanook::rpc","nanook::util","nanook::wallet","nanook::walletaccount","nanook::workpeer","nanook::util::nano_to_raw()","nanook#account()","nanook::block#account()","nanook::wallet#account()","nanook::walletaccount#account_id()","nanook::wallet#accounts()","nanook::workpeer#add()","nanook::account#balance()","nanook::wallet#balance()","nanook#block()","nanook::node#block_count()","nanook::node#block_count_type()","nanook::node#bootstrap()","nanook::node#bootstrap_any()","nanook::rpc#call()","nanook::block#cancel_work()","nanook::block#chain()","nanook::wallet#change_password()","nanook::workpeer#clear()","nanook::util::coerce_empty_string_to_type()","nanook::wallet#contains?()","nanook::wallet#create()","nanook::walletaccount#create()","nanook::account#delegators()","nanook::wallet#destroy()","nanook::walletaccount#destroy()","nanook::account#exists?()","nanook::wallet#export()","nanook::node#frontier_count()","nanook::key#generate()","nanook::block#generate_work()","nanook::account#history()","nanook::block#history()","nanook::account#id()","nanook::block#id()","nanook::key#id()","nanook::wallet#id()","nanook::account#info()","nanook::block#info()","nanook::key#info()","nanook#inspect()","nanook::block#is_valid_work?()","nanook#key()","nanook::account#ledger()","nanook::workpeer#list()","nanook::wallet#locked?()","nanook::walletaccount#method_missing()","nanook::new()","nanook::account::new()","nanook::block::new()","nanook::key::new()","nanook::node::new()","nanook::rpc::new()","nanook::wallet::new()","nanook::walletaccount::new()","nanook::workpeer::new()","nanook#node()","nanook::wallet#pay()","nanook::walletaccount#pay()","nanook::node#peers()","nanook::account#pending()","nanook::block#pending?()","nanook::block#process()","nanook::account#public_key()","nanook::block#publish()","nanook::util::raw_to_nano()","nanook::wallet#receive()","nanook::walletaccount#receive()","nanook::account#representative()","nanook::node#representatives()","nanook::block#republish()","nanook::node#stop()","nanook::block#successors()","nanook::node#sync_progress()","nanook::node#synced?()","nanook::wallet#unlock()","nanook::node#version()","nanook#wallet()","nanook::walletaccount#wallet_id()","nanook::account#weight()","nanook#work_peers()",""],"info":[["Nanook","","classes/Nanook.html","","<p>Initializing\n<p>Connect to the default RPC host at localhost:7076 and with a timeout of 500\nseconds:\n\n<pre><code>nanook ...\n</code></pre>\n"],["Nanook::Account","","classes/Nanook/Account.html","","<p>The <code>Nanook::Account</code> class contains methods to discover\npublicly-available information about accounts …\n"],["Nanook::Block","","classes/Nanook/Block.html","","<p>The <code>Nanook::Block</code> class contains methods to discover\npublicly-available information about blocks on the …\n"],["Nanook::Error","","classes/Nanook/Error.html","",""],["Nanook::Key","","classes/Nanook/Key.html","",""],["Nanook::Node","","classes/Nanook/Node.html","",""],["Nanook::Rpc","","classes/Nanook/Rpc.html","",""],["Nanook::Util","","classes/Nanook/Util.html","",""],["Nanook::Wallet","","classes/Nanook/Wallet.html","","<p>The <code>Nanook::Wallet</code> class lets you manage your nano wallets, as\nwell as some account-specific things like …\n"],["Nanook::WalletAccount","","classes/Nanook/WalletAccount.html","",""],["Nanook::WorkPeer","","classes/Nanook/WorkPeer.html","",""],["NANO_to_raw","Nanook::Util","classes/Nanook/Util.html#method-c-NANO_to_raw","(nano)",""],["account","Nanook","classes/Nanook.html#method-i-account","(account=nil)","<p>Returns a Nanook::Account instance.\n\n<pre><code>nanook = Nanook.new\n\naccount = nanook.account\naccount = nanook.account(&quot;xrb_3e3j5tkog48pnny9dmfzj1r16pg8t1e76dz5tmac6iq689wyjfpi00000000&quot;)\n</code></pre>\n"],["account","Nanook::Block","classes/Nanook/Block.html#method-i-account","()","<p>Returns a String of the account id of the block.\n<p>Example\n\n<pre><code>block.account # =&gt; &quot;xrb_3x7c...&quot;\n</code></pre>\n"],["account","Nanook::Wallet","classes/Nanook/Wallet.html#method-i-account","(account=nil)","<p>A convenient method that returns an account in your wallet, allowing you to\nperform all the actions in …\n"],["account_id","Nanook::WalletAccount","classes/Nanook/WalletAccount.html#method-i-account_id","()",""],["accounts","Nanook::Wallet","classes/Nanook/Wallet.html#method-i-accounts","()","<p>Returns an Array with Strings of all account ids in the wallet.\n<p>Example response\n\n<pre><code>[\n &quot;xrb_3e3j5tkog48pnny9dmfzj1r16pg8t1e76dz5tmac6iq689wyjfpi00000000&quot;, ...\n</code></pre>\n"],["add","Nanook::WorkPeer","classes/Nanook/WorkPeer.html#method-i-add","(address:, port:)",""],["balance","Nanook::Account","classes/Nanook/Account.html#method-i-balance","(unit: Nanook::WalletAccount::DEFAULT_UNIT)","<p>Returns a Hash containing the account&#39;s balance. Units are in raw.\n<p><code>:balance</code> &mdash; Account balance\n<p><code>:pending</code> … &mdash; "],["balance","Nanook::Wallet","classes/Nanook/Wallet.html#method-i-balance","(account_break_down: false, unit: Nanook::WalletAccount::DEFAULT_UNIT)","<p>Returns a Hash containing the balance of all accounts in the wallet,\noptionally breaking the balances …\n"],["block","Nanook","classes/Nanook.html#method-i-block","(block=nil)",""],["block_count","Nanook::Node","classes/Nanook/Node.html#method-i-block_count","()",""],["block_count_type","Nanook::Node","classes/Nanook/Node.html#method-i-block_count_type","()",""],["bootstrap","Nanook::Node","classes/Nanook/Node.html#method-i-bootstrap","(address:, port:)",""],["bootstrap_any","Nanook::Node","classes/Nanook/Node.html#method-i-bootstrap_any","()",""],["call","Nanook::Rpc","classes/Nanook/Rpc.html#method-i-call","(action, params={})",""],["cancel_work","Nanook::Block","classes/Nanook/Block.html#method-i-cancel_work","()","<p>Stop generating work for a block.\n<p>Returns boolean signalling if the action was successful.\n<p>Example\n"],["chain","Nanook::Block","classes/Nanook/Block.html#method-i-chain","(limit: 1000)","<p>Returns an Array of block hashes in the account chain starting at this\nblock.\n<p>See also #successors.\n<p>Arguments …\n"],["change_password","Nanook::Wallet","classes/Nanook/Wallet.html#method-i-change_password","(password)","<p>Changes the password for a wallet. Returns a boolean to indicate if the\naction was successful.\n<p>Example …\n"],["clear","Nanook::WorkPeer","classes/Nanook/WorkPeer.html#method-i-clear","()",""],["coerce_empty_string_to_type","Nanook::Util","classes/Nanook/Util.html#method-c-coerce_empty_string_to_type","(response, type)",""],["contains?","Nanook::Wallet","classes/Nanook/Wallet.html#method-i-contains-3F","(account)","<p>Returns boolean indicating if the wallet contains an account.\n<p>Arguments\n<p><code>account</code> &mdash; String account id (will …\n"],["create","Nanook::Wallet","classes/Nanook/Wallet.html#method-i-create","()","<p>Creates a new wallet.\n\n<pre><code>Nanook.new.wallet.create\n</code></pre>\n<p>Very important\n"],["create","Nanook::WalletAccount","classes/Nanook/WalletAccount.html#method-i-create","()",""],["delegators","Nanook::Account","classes/Nanook/Account.html#method-i-delegators","()","<p>Example response\n\n<pre><code>{\n &quot;xrb_13bqhi1cdqq8yb9szneoc38qk899d58i5rcrgdk5mkdm86hekpoez3zxw5sd&quot;: &quot;500000000000000000000000000000000000&quot;, ...\n</code></pre>\n"],["destroy","Nanook::Wallet","classes/Nanook/Wallet.html#method-i-destroy","()","<p>Destroy the wallet. Returns a boolean indicating whether the action was\nsuccessful or not.\n<p>Example Response …\n"],["destroy","Nanook::WalletAccount","classes/Nanook/WalletAccount.html#method-i-destroy","()",""],["exists?","Nanook::Account","classes/Nanook/Account.html#method-i-exists-3F","()","<p>Returns a boolean indicating if account is known. Note, the reliability of\nthe check depends on the node …\n"],["export","Nanook::Wallet","classes/Nanook/Wallet.html#method-i-export","()","<p>Generates a String containing a JSON representation of your wallet.\n<p>Example response\n\n<pre><code>&quot;{\\n \\&quot;0000000000000000000000000000000000000000000000000000000000000000\\&quot;: ...\n</code></pre>\n"],["frontier_count","Nanook::Node","classes/Nanook/Node.html#method-i-frontier_count","()",""],["generate","Nanook::Key","classes/Nanook/Key.html#method-i-generate","(seed: nil, index: nil)",""],["generate_work","Nanook::Block","classes/Nanook/Block.html#method-i-generate_work","()","<p>Generate work for a block.\n<p>Returns the work id of the work completed.\n\n<pre><code>block.generate_work # =&gt; &quot;2bf29ef00786a6bc&quot;\n</code></pre>\n"],["history","Nanook::Account","classes/Nanook/Account.html#method-i-history","(limit: 1000)","<p>Returns an account&#39;s history of send and receive payments. Amounts are\nin raw.\n<p>Arguments\n<p><code>limit:</code> &mdash; Integer …\n"],["history","Nanook::Block","classes/Nanook/Block.html#method-i-history","(limit: 1000)","<p>Returns Array of Hashes containing information about a chain of\nsend/receive blocks, starting from this …\n"],["id","Nanook::Account","classes/Nanook/Account.html#method-i-id","()","<p>Returns the id of the account\n"],["id","Nanook::Block","classes/Nanook/Block.html#method-i-id","()","<p>Returns the block hash\n\n<pre><code>block.id #=&gt; &quot;FBF8B0E...&quot;\n</code></pre>\n"],["id","Nanook::Key","classes/Nanook/Key.html#method-i-id","()",""],["id","Nanook::Wallet","classes/Nanook/Wallet.html#method-i-id","()",""],["info","Nanook::Account","classes/Nanook/Account.html#method-i-info","(detailed: false)","<p>Returns a Hash containing the following information about an account:\n<p><code>:frontier</code> &mdash; The latest block hash …\n"],["info","Nanook::Block","classes/Nanook/Block.html#method-i-info","(allow_unchecked: false)","<p>Returns a Hash of information about the block.\n<p>Arguments\n<p><code>allow_unchecked:</code> &mdash; Boolean (default is <code>false</code>). …\n"],["info","Nanook::Key","classes/Nanook/Key.html#method-i-info","()",""],["inspect","Nanook","classes/Nanook.html#method-i-inspect","()",""],["is_valid_work?","Nanook::Block","classes/Nanook/Block.html#method-i-is_valid_work-3F","(work)","<p>Returns boolean signalling if work is valid for the block.\n\n<pre><code>block.is_valid_work?(&quot;2bf29ef00786a6bc&quot;) # ...\n</code></pre>\n"],["key","Nanook","classes/Nanook.html#method-i-key","(key=nil)",""],["ledger","Nanook::Account","classes/Nanook/Account.html#method-i-ledger","(limit: 1)","<p>Returns information about the given account as well as other accounts up\nthe ledger. The number of accounts …\n"],["list","Nanook::WorkPeer","classes/Nanook/WorkPeer.html#method-i-list","()",""],["locked?","Nanook::Wallet","classes/Nanook/Wallet.html#method-i-locked-3F","()","<p>Returns a boolean to indicate if the wallet is locked.\n<p>Example response\n\n<pre><code>true\n</code></pre>\n"],["method_missing","Nanook::WalletAccount","classes/Nanook/WalletAccount.html#method-i-method_missing","(m, *args, &block)","<p>Any method of Nanook::Account can be called on this class too\n"],["new","Nanook","classes/Nanook.html#method-c-new","(uri=Nanook::Rpc::DEFAULT_URI, timeout:Nanook::Rpc::DEFAULT_TIMEOUT)","<p>Arguments\n<p><code>uri</code> - RPC host to connect to (default is “localhost:7076”)\n<p><code>timeout:</code> - Connection timeout …\n"],["new","Nanook::Account","classes/Nanook/Account.html#method-c-new","(rpc, account)",""],["new","Nanook::Block","classes/Nanook/Block.html#method-c-new","(rpc, block)",""],["new","Nanook::Key","classes/Nanook/Key.html#method-c-new","(rpc, key=nil)",""],["new","Nanook::Node","classes/Nanook/Node.html#method-c-new","(rpc)",""],["new","Nanook::Rpc","classes/Nanook/Rpc.html#method-c-new","(uri=DEFAULT_URI, timeout:DEFAULT_TIMEOUT)",""],["new","Nanook::Wallet","classes/Nanook/Wallet.html#method-c-new","(rpc, wallet)",""],["new","Nanook::WalletAccount","classes/Nanook/WalletAccount.html#method-c-new","(rpc, wallet, account)",""],["new","Nanook::WorkPeer","classes/Nanook/WorkPeer.html#method-c-new","(rpc)",""],["node","Nanook","classes/Nanook.html#method-i-node","()",""],["pay","Nanook::Wallet","classes/Nanook/Wallet.html#method-i-pay","(from:, to:, amount:, unit: Nanook::WalletAccount::DEFAULT_UNIT, id:)","<p>Make a payment from an account in your wallet to another account on the\nnano network. Returns a <em>send</em> …\n"],["pay","Nanook::WalletAccount","classes/Nanook/WalletAccount.html#method-i-pay","(to:, amount:, unit: DEFAULT_UNIT, id:)",""],["peers","Nanook::Node","classes/Nanook/Node.html#method-i-peers","()",""],["pending","Nanook::Account","classes/Nanook/Account.html#method-i-pending","(limit: 1000, detailed: false)","<p>Returns information about pending block hashes that are waiting to be\nreceived by the account.\n<p>The default …\n"],["pending?","Nanook::Block","classes/Nanook/Block.html#method-i-pending-3F","()","<p>Returns boolean <code>true</code> if the block is a pending block.\n\n<pre><code>block.pending? #=&gt; false\n</code></pre>\n"],["process","Nanook::Block","classes/Nanook/Block.html#method-i-process","()",""],["public_key","Nanook::Account","classes/Nanook/Account.html#method-i-public_key","()","<p>Returns the public key belonging to an account.\n<p>Example response\n\n<pre><code>&quot;3068BB1CA04525BB0E416C485FE6A67FD52540227D267CC8B6E8DA958A7FA039&quot;\n</code></pre>\n"],["publish","Nanook::Block","classes/Nanook/Block.html#method-i-publish","()","<p>Publish the block to the nano network.\n<p>Note, if block has previously been published, use #republish instead. …\n"],["raw_to_NANO","Nanook::Util","classes/Nanook/Util.html#method-c-raw_to_NANO","(raw)",""],["receive","Nanook::Wallet","classes/Nanook/Wallet.html#method-i-receive","(block=nil, into:)","<p>Receives a pending payment into an account in the wallet.\n<p>When called with no <code>block</code> argument, the latest …\n"],["receive","Nanook::WalletAccount","classes/Nanook/WalletAccount.html#method-i-receive","(block=nil)","<p>Returns false if no block to receive\n"],["representative","Nanook::Account","classes/Nanook/Account.html#method-i-representative","()","<p>Returns a String of the representative account for the account.\nRepresentatives are accounts which cast …\n"],["representatives","Nanook::Node","classes/Nanook/Node.html#method-i-representatives","()",""],["republish","Nanook::Block","classes/Nanook/Block.html#method-i-republish","(destinations:nil, sources:nil)","<p>Republish blocks starting at this block up the account chain back to the\nnano network.\n<p>Returns an Array …\n"],["stop","Nanook::Node","classes/Nanook/Node.html#method-i-stop","()",""],["successors","Nanook::Block","classes/Nanook/Block.html#method-i-successors","(limit: 1000)","<p>Returns an Array of block hashes in the account chain ending at this block.\n<p>See also #chain.\n<p>Arguments …\n"],["sync_progress","Nanook::Node","classes/Nanook/Node.html#method-i-sync_progress","()",""],["synced?","Nanook::Node","classes/Nanook/Node.html#method-i-synced-3F","()",""],["unlock","Nanook::Wallet","classes/Nanook/Wallet.html#method-i-unlock","(password)","<p>Unlocks a previously locked wallet. Returns a boolean to indicate if the\naction was successful.\n<p>Example …\n"],["version","Nanook::Node","classes/Nanook/Node.html#method-i-version","()",""],["wallet","Nanook","classes/Nanook.html#method-i-wallet","(wallet=nil)",""],["wallet_id","Nanook::WalletAccount","classes/Nanook/WalletAccount.html#method-i-wallet_id","()",""],["weight","Nanook::Account","classes/Nanook/Account.html#method-i-weight","()","<p>Returns the account&#39;s weight. Weight is determined by the account&#39;s\nbalance, and represents the …\n"],["work_peers","Nanook","classes/Nanook.html#method-i-work_peers","()",""],["README","","files/README_md.html","","<p>Nanook\n<p>This is a Ruby library for managing a nano currency node, including making\nand receiving payments, …\n"]]}}
@@ -133,6 +133,7 @@ class Nanook
133
133
  end
134
134
  end
135
135
 
136
+ # Returns the id of the account
136
137
  def id
137
138
  @block
138
139
  end
data/lib/nanook/block.rb CHANGED
@@ -3,17 +3,19 @@ class Nanook
3
3
  # The <tt>Nanook::Block</tt> class contains methods to discover
4
4
  # publicly-available information about blocks on the nano network.
5
5
  #
6
- # A block is represented by a unique hash
6
+ # A block is represented by a unique id like this:
7
+ #
8
+ # "FBF8B0E6623A31AB528EBD839EEAA91CAFD25C12294C46754E45FD017F7939EB"
7
9
  #
8
10
  # Initialize this class through the convenient Nanook#block method:
9
11
  #
10
12
  # nanook = Nanook.new
11
- # account = nanook.block("991CF19...")
13
+ # account = nanook.block("FBF8B0E...")
12
14
  #
13
15
  # Or compose the longhand way like this:
14
16
  #
15
17
  # rpc_conn = Nanook::Rpc.new
16
- # block = Nanook::Block.new(rpc_conn, "991CF19...")
18
+ # block = Nanook::Block.new(rpc_conn, "FBF8B0E...")
17
19
  class Block
18
20
 
19
21
  def initialize(rpc, block)
@@ -22,31 +24,109 @@ class Nanook
22
24
  block_required! # All methods expect a block
23
25
  end
24
26
 
27
+ # Returns a String of the account id of the block.
28
+ #
29
+ # ==== Example
30
+ #
31
+ # block.account # => "xrb_3x7c..."
25
32
  def account
26
33
  rpc(:block_account, :hash)[:account]
27
34
  end
28
35
 
36
+ # Stop generating work for a block.
37
+ #
38
+ # Returns boolean signalling if the action was successful.
39
+ #
40
+ # ==== Example
41
+ #
42
+ # block.cancel_work # => true
29
43
  def cancel_work
30
44
  rpc(:work_cancel, :hash).empty?
31
45
  end
32
46
 
47
+ # Returns an Array of block hashes in the account chain starting at
48
+ # this block.
49
+ #
50
+ # See also #successors.
51
+ #
52
+ # ==== Arguments
53
+ #
54
+ # [+limit:+] Maximum number of block hashes to return (default is 1000)
55
+ #
56
+ # ==== Example
57
+ #
58
+ # block.chain(limit: 2)
59
+ #
60
+ # ==== Example reponse
61
+ #
62
+ # [
63
+ # "36A0FB717368BA8CF8D255B63DC207771EABC6C6FFC22A7F455EC2209464897E",
64
+ # "FBF8B0E6623A31AB528EBD839EEAA91CAFD25C12294C46754E45FD017F7939EB"
65
+ # ]
33
66
  def chain(limit: 1000)
34
67
  response = rpc(:chain, :block, count: limit)[:blocks]
35
68
  Nanook::Util.coerce_empty_string_to_type(response, Array)
36
69
  end
37
70
 
71
+ # Generate work for a block.
72
+ #
73
+ # Returns the work id of the work completed.
74
+ #
75
+ # block.generate_work # => "2bf29ef00786a6bc"
38
76
  def generate_work
39
77
  rpc(:work_generate, :hash)[:work]
40
78
  end
41
79
 
80
+ # Returns Array of Hashes containing information about a chain of
81
+ # send/receive blocks, starting from this block.
82
+ #
83
+ # ==== Arguments
84
+ #
85
+ # [+limit:+] Maximum number of send/receive block hashes to return
86
+ # in the chain (default is 1000)
87
+ #
88
+ # ==== Example
89
+ #
90
+ # block.history(limit: 1)
91
+ #
92
+ # ==== Example response
93
+ #
94
+ # [
95
+ # {
96
+ # :account=>"xrb_3x7cjioqahgs5ppheys6prpqtb4rdknked83chf97bot1unrbdkaux37t31b",
97
+ # :amount=>539834279601145558517940224,
98
+ # :hash=>"36A0FB717368BA8CF8D255B63DC207771EABC6C6FFC22A7F455EC2209464897E",
99
+ # :type=>"send"
100
+ # }
101
+ # ]
42
102
  def history(limit: 1000)
43
103
  rpc(:history, :hash, count: limit)[:history]
44
104
  end
45
105
 
106
+ # Returns the block hash
107
+ #
108
+ # block.id #=> "FBF8B0E..."
46
109
  def id
47
110
  @block
48
111
  end
49
112
 
113
+ # Returns a Hash of information about the block.
114
+ #
115
+ # ==== Arguments
116
+ #
117
+ # [+allow_unchecked:+] Boolean (default is +false+). If +true+,
118
+ # information can be returned about blocks that
119
+ # are unchecked (unverified).
120
+ # ==== Example response
121
+ #
122
+ # {
123
+ # :type=>"send",
124
+ # :previous=>"FBF8B0E6623A31AB528EBD839EEAA91CAFD25C12294C46754E45FD017F7939EB",
125
+ # :destination=>"xrb_3x7cjioqahgs5ppheys6prpqtb4rdknked83chf97bot1unrbdkaux37t31b",
126
+ # :balance=>"00000000000000000000000000000000",
127
+ # :work=>"44cc24b60705083a",
128
+ # :signature=>"42ADFEFE7C3FFF188AE92A202F8A5734DE91779C454613E446EEC93D001D6C953E9FD16730AF32C891791BA8EDAECEB059A213E2FE1EEB7ADF9D5D0815464D06"
129
+ # }
50
130
  def info(allow_unchecked: false)
51
131
  if allow_unchecked
52
132
  # TODO not actually sure what this response looks like when it's not an unchecked block, assuming its blank
@@ -61,11 +141,25 @@ class Nanook
61
141
  _parse_info_response(response)
62
142
  end
63
143
 
144
+ # Returns boolean signalling if work is valid for the block.
145
+ #
146
+ # block.is_valid_work?("2bf29ef00786a6bc") # => true
64
147
  def is_valid_work?(work)
65
148
  response = rpc(:work_validate, :hash, work: work)
66
149
  !response.empty? && response[:valid] == 1
67
150
  end
68
151
 
152
+ # Republish blocks starting at this block up the account chain
153
+ # back to the nano network.
154
+ #
155
+ # Returns an Array of block hashes that were republished.
156
+ #
157
+ # ==== Example
158
+ #
159
+ # block.republish
160
+ #
161
+ # ==== Example response
162
+ # ["36A0FB717368BA8CF8D255B63DC207771EABC6C6FFC22A7F455EC2209464897E"]
69
163
  def republish(destinations:nil, sources:nil)
70
164
  if !destinations.nil? && !sources.nil?
71
165
  raise ArgumentError.new("You must provide either destinations or sources but not both")
@@ -80,15 +174,44 @@ class Nanook
80
174
  rpc(:republish, :hash, params)[:blocks]
81
175
  end
82
176
 
177
+ # Returns boolean +true+ if the block is a pending block.
178
+ #
179
+ # block.pending? #=> false
83
180
  def pending?
84
181
  response = rpc(:pending_exists, :hash)
85
182
  !response.empty? && response[:exists] == 1
86
183
  end
87
184
 
88
- def process
185
+ # Publish the block to the nano network.
186
+ #
187
+ # Note, if block has previously been published, use #republish instead.
188
+ #
189
+ # Returns the block hash, or false.
190
+ #
191
+ # block.publish # => "FBF8B0E..."
192
+ def publish
193
+ # TODO I think this can return false or error or something?
89
194
  rpc(:process, :block)[:hash]
90
195
  end
91
-
196
+ alias_method :process, :publish
197
+
198
+ # Returns an Array of block hashes in the account chain ending at
199
+ # this block.
200
+ #
201
+ # See also #chain.
202
+ #
203
+ # ==== Arguments
204
+ #
205
+ # [+limit:+] Maximum number of send/receive block hashes to return
206
+ # in the chain (default is 1000)
207
+ #
208
+ # ==== Example
209
+ #
210
+ # block.successors
211
+ #
212
+ # ==== Example response
213
+ #
214
+ # ["36A0FB717368BA8CF8D255B63DC207771EABC6C6FFC22A7F455EC2209464897E"]
92
215
  def successors(limit: 1000)
93
216
  response = rpc(:successors, :block, count: limit)[:blocks]
94
217
  Nanook::Util.coerce_empty_string_to_type(response, Array)
@@ -1,3 +1,3 @@
1
1
  class Nanook
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
data/lib/nanook/wallet.rb CHANGED
@@ -113,16 +113,16 @@ class Nanook
113
113
  #
114
114
  # Example response:
115
115
  #
116
- {
117
- "xrb_3e3j5tkog48pnny9dmfzj1r16pg8t1e76dz5tmac6iq689wyjfpi00000000"=>{
118
- "balance"=>2500000000000000,
119
- "pending"=>10000000000000
120
- },
121
- "xrb_1e5aqegc1jb7qe964u4adzmcezyo6o146zb8hm6dft8tkp79za3sxwjym5rx"=>{
122
- "balance"=>2500000000000000,
123
- "pending"=>0
124
- },
125
- }
116
+ # {
117
+ # "xrb_3e3j5tkog48pnny9dmfzj1r16pg8t1e76dz5tmac6iq689wyjfpi00000000"=>{
118
+ # "balance"=>2.5,
119
+ # "pending"=>1
120
+ # },
121
+ # "xrb_1e5aqegc1jb7qe964u4adzmcezyo6o146zb8hm6dft8tkp79za3sxwjym5rx"=>{
122
+ # "balance"=>51.4,
123
+ # "pending"=>0
124
+ # },
125
+ # }
126
126
  def balance(account_break_down: false, unit: Nanook::WalletAccount::DEFAULT_UNIT)
127
127
  wallet_required!
128
128
 
@@ -135,7 +135,7 @@ class Nanook
135
135
  if unit == :nano
136
136
  r.each do |account, balances|
137
137
  r[account][:balance] = Nanook::Util.raw_to_NANO(r[account][:balance])
138
- r[account][:pending] = Nanook::Util.raw_to_NANO(r[account][:balapendingnce])
138
+ r[account][:pending] = Nanook::Util.raw_to_NANO(r[account][:pending])
139
139
  end
140
140
  end
141
141
  end
data/nanook.gemspec CHANGED
@@ -27,6 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency "rspec", "~> 3.2"
28
28
  spec.add_development_dependency "rspec-collection_matchers", "~> 1.1"
29
29
  spec.add_development_dependency "rspec_junit_formatter", "~> 0.3"
30
+ spec.add_development_dependency "sdoc", "~> 1.0"
30
31
  spec.add_development_dependency "webmock", "~> 3.3"
31
32
 
32
33
  spec.add_dependency "symbolized", "~> 0.0.1"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanook
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Duncalfe
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-14 00:00:00.000000000 Z
11
+ date: 2018-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0.3'
97
+ - !ruby/object:Gem::Dependency
98
+ name: sdoc
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: webmock
99
113
  requirement: !ruby/object:Gem::Requirement