class Garlicoin::Client

Defined in:

garlicoin/client.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(host : String, port : Int32, user : String, password : String) #

Create a new Client using connection information for the garlicoind rpc server.


[View source]
def self.new(config : Config) #

Create a new Client by utilizing a Config object. This config object can be created manually or by loading an existing config file.


[View source]

Instance Method Detail

def abandon_transaction(txid : String) #

Mark in-wallet transaction as abandoned This will mark this transaction and all its in-wallet descendants as abandoned which will allow for their inputs to be respent. It can be used to replace "stuck" or evicted transactions. It only works on transactions which are not included in a block and are not currently in the mempool. It has no effect on transactions which are already conflicted or abandoned.


[View source]
def abort_rescan #

Stops current wallet rescan triggered e.g. by an import_prov_key call.


[View source]
def add_multi_sig_address(nrequired : String, keys : Array(String), account : String | Nil = nil) #

Add a nrequired-to-sign multisignature address to the wallet. Each key is a Garlicoin address or hex-encoded public key. If 'account' is specified (DEPRECATED), assign address to that account.


[View source]
def add_witness_address(address : String) #

Add a witness address for a script (with pubkey or redeemscript known). It returns the witness script.


[View source]
def backup_wallet(destination : String) #

Safely copies current wallet file to destination, which can be a directory or a path with filename.


[View source]
def bump_fee(txid : String, options = nil) #

Bumps the fee of an opt-in-RBF transaction T, replacing it with a new transaction B. An opt-in RBF transaction with the given txid must be in the wallet. The command will pay the additional fee by decreasing (or perhaps removing) its change output. If the change output is not big enough to cover the increased fee, the command will currently fail instead of adding new inputs to compensate. (A future implementation could improve this.) The command will fail if the wallet or mempool contains a transaction that spends one of T's outputs. By default, the new fee will be calculated automatically using estimatefee. The user can specify a confirmation target for estimatefee. Alternatively, the user can specify totalFee, or use RPC settxfee to set a higher fee rate. At a minimum, the new fee rate must be high enough to pay an additional new relay fee (incrementalfee returned by getnetworkinfo) to enter the node's mempool.


[View source]
def dump_private_key(address : String) #

Reveals the private key corresponding to 'address'. Then the importprivkey can be used with this output


[View source]
def dump_wallet(filename : String) #

Dumps all wallet keys in a human-readable format.


[View source]
def encrypt_wallet(passphrase : String) #

Encrypts the wallet with 'passphrase'. This is for first time encryption. After this, any calls that interact with private keys such as sending or signing will require the passphrase to be set prior the making these calls. Use the walletpassphrase call for this, and then walletlock call. If the wallet is already encrypted, use the walletpassphrasechange call. Note that this will shutdown the server.


[View source]
def get_account(address : String) #

DEPRECATED . Returns the account associated with the given address.


[View source]
def get_account_address(account : String) #

DEPRECATED . Returns the current Garlicoin address for receiving payments to this account.


[View source]
def get_addresses_by_account(account : String) #

DEPRECATED . Returns the list of addresses for the given account.


[View source]
def get_balance(account = nil, minconf = 1, include_watch_only = false) #

If account is not specified, returns the server's total available balance. If account is specified (DEPRECATED), returns the balance in the account. Note that the account "" is not the same as leaving the parameter out. The server total may be different to the balance in the default "" account.


[View source]
def get_best_block_hash #

Returns the hash of the best (tip) block in the longest blockchain.


[View source]
def get_block(hash : String) #

Returns an Object with information about block and information about each transaction.


[View source]
def get_block_count #

Returns the number of blocks in the longest blockchain.


[View source]
def get_block_hash(index : Int32) #

Returns hash of block in best-block-chain at height provided.


[View source]
def get_block_header(hash : String) #

If verbose is true, returns an Object with information about blockheader .


[View source]
def get_block_template(params = {} of String => JSON::Any) #

If the request parameters include a 'mode' key, that is used to explicitly select between the default 'template' request or a 'proposal'. It returns data needed to construct a block to work on. For full specification, see BIPs 22, 23, 9, and 145: https://github.com/bitcoin/bips/blob/master/bip-0022.mediawiki https://github.com/bitcoin/bips/blob/master/bip-0023.mediawiki https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki#getblocktemplate_changes https://github.com/bitcoin/bips/blob/master/bip-0145.mediawiki


[View source]
def get_blockchain_info #

Returns an object containing various state info regarding blockchain processing.


[View source]
def get_chain_tips #

Return information about all known tips in the block tree, including the main chain as well as orphaned branches.


[View source]
def get_connection_count #

Returns the number of connections to other nodes.


[View source]
def get_difficulty #

Returns the proof-of-work difficulty as a multiple of the minimum difficulty.


[View source]
def get_mining_info(extended = true) #

Returns a json object containing mining-related information.


[View source]
def get_new_address(account = nil) #

Returns a new Garlicoin address for receiving payments. If 'account' is specified (DEPRECATED), it is added to the address book so payments received with the address will be credited to 'account'.


[View source]
def get_raw_mem_pool #

Returns all transaction ids in memory pool as a json array of string transaction ids. Hint: use get_mempool_entry to fetch a specific transaction from the mempool.


[View source]
def get_raw_transaction(txid : String) #

NOTE By default this function only works for mempool transactions. If the -txindex option is enabled, it also works for blockchain transactions.


[View source]
def get_received_by_account(account : String, minconf = 1) #

DEPRECATED . Returns the total amount received by addresses with in transactions with at least [minconf] confirmations.


[View source]
def get_received_by_address(address : String, minconf = 1) #

Returns the total amount received by the given address in transactions with at least minconf confirmations.


[View source]
def get_transaction(txid : String) #

Get detailed information about in-wallet transaction


[View source]
def get_unconfirmed_balance #

Returns the server's total unconfirmed balance


[View source]
def get_wallet_info #

Returns an object containing various wallet state info.


[View source]
def help(command = "") #

List all json-rpc commands, or get help for a specified command.


[View source]
def import_address(address : String, label = nil, rescan = true, p2sh = true) #

Adds a script (in hex) or address that can be watched as if it were in your wallet but cannot be used to spend.


[View source]
def import_multi(requests : String, options = nil) #

Import addresses/scripts (with private or public keys, redeem script (P2SH)), rescanning all addresses in one-shot-only (rescan can be disabled via options).


[View source]
def import_private_key(key : String, label = nil, rescan = true) #

Adds a private key (as returned by dumpprivkey) to your wallet.


[View source]
def import_pruned_funds #

Imports funds without rescan. Corresponding address or script must previously be included in wallet. Aimed towards pruned wallets. The end-user is responsible to import additional transactions that subsequently spend the imported outputs or rescan after the point in the blockchain the transaction is included.


[View source]
def import_public_key(key : String, label = nil, rescan = true) #

Adds a public key (in hex) that can be watched as if it were in your wallet but cannot be used to spend.


[View source]
def import_wallet(filename : String) #

Imports keys from a wallet dump file (see dump_wallet).


[View source]
def key_pool_refill(newsize : Int32) #

Fills the keypool.


[View source]
def list_accounts(minconf = 1, include_watch_only = false) #

DEPRECATED . Returns Object that has account names as keys, account balances as values.


[View source]
def list_address_groupings #

Lists groups of addresses which have had their common ownership made public by common use as inputs or as the resulting change in past transactions


[View source]
def list_lock_unspent #

Returns list of temporarily unspendable outputs. See the lockunspent call to lock and unlock transactions for spending.


[View source]
def list_received_by_account(minconf = 1, empty = true, include_watch_only = false) #

DEPRECATED . List balances by account.


[View source]
def list_received_by_address(minconf = 1, empty = true, include_watch_only = false) #

List balances by receiving address.


[View source]
def list_since_block(blockhash : String, confirmations = 1, include_watch_only = false, include_removed = true) #

Get all transactions in blocks since block [blockhash], or all transactions if omitted. If "blockhash" is no longer a part of the main chain, transactions from the fork point onward are included. Additionally, if include_removed is set, transactions affecting the wallet which were removed are returned in the "removed" array.


[View source]
def list_transactions(account : String, count = 10, skip = 0, include_watch_only = false) #

Returns up to 'count' most recent transactions skipping the first 'from' transactions for account 'account'.


[View source]
def list_unspent(addresses : Array(String), minconf = 1, maxconf = 9999999, include_unsafe = true, query_options = nil) #

Returns array of unspent transaction outputs with between minconf and maxconf (inclusive) confirmations. Optionally filter to only include txouts paid to specified addresses.


[View source]
def list_wallets #

Returns a list of currently loaded wallets. For full information on the wallet, use #get_wallet_info


[View source]
def lock_unspent(transactions = "") #

Temporarily lock specified transaction outputs.


[View source]
def move(from_account, to_account, amount, minconf = 1, comment = "") #

DEPRECATED . Move a specified amount from one account in your wallet to another.


[View source]
def remove_pruned_funds(txid : String) #

Deletes the specified transaction from the wallet. Meant for use with pruned wallets and as a companion to importprunedfunds. This will affect wallet balances.


[View source]
def send_from(from_account, to_address, amount, minconf = 1, comment = "", comment_to = "") #

DEPRECATED (use send_to_address). Sent an amount from an account to a garlicoin address.


[View source]
def send_many(from_account, addresses : Hash(String, String), minconf = 1, comment = "", comment_to = "") #

Send multiple times. Amounts are double-precision floating point numbers.


[View source]
def send_to_address(address, amount, comment = "", comment_to = "", subtract_fee_from_amount = false, replacable = false, conf_target = 1, estimate_mode = "") #

Send an amount to a given address.


[View source]
def set_account(address, account) #

DEPRECATED . Sets the account associated with the given address.


[View source]
def set_transaction_fee(amount) #

Set the transaction fee per kB. Overwrites the paytxfee parameter.


[View source]
def sign_message(address, message) #

Sign a message with the private key of an address.


[View source]
def unlock_unspent(transactions = "") #

Unlock specified transaction outputs. If no transaction outputs are specified when unlocking then all current locked transaction outputs are unlocked.


[View source]