pub struct NodeInterface {
    pub api_key: String,
    pub ip: String,
    pub port: String,
}
Expand description

The NodeInterface struct which holds the relevant Ergo node data and has methods implemented to interact with the node.

Fields

api_key: Stringip: Stringport: String

Implementations

Create a new NodeInterface using details about the Node

Returns http://ip:port using ip and port from self

Get all addresses from the node wallet

A CLI interactive interface for prompting a user to select an address

Acquires unspent boxes from the node wallet

Returns unspent boxes from the node wallet ordered from highest to lowest nanoErgs value.

Returns a sorted list of unspent boxes which cover at least the provided value total of nanoErgs. Note: This box selection strategy simply uses the largest value holding boxes from the user’s wallet first.

Returns a list of unspent boxes which cover at least the provided value total of nanoErgs. Note: This box selection strategy simply uses the oldest unspent boxes from the user’s full node wallet first.

Acquires the unspent box with the highest value of Ergs inside from the wallet

Acquires the unspent box with the highest value of Ergs inside from the wallet and serializes it

Acquires unspent boxes which cover total amount of nanoErgs from the wallet and serializes the boxes

Given a P2S Ergo address, extract the hex-encoded serialized ErgoTree (script)

Given a P2S Ergo address, convert it to a hex-encoded Sigma byte array constant

Given an Ergo P2PK Address, convert it to a raw hex-encoded EC point

Given an Ergo P2PK Address, convert it to a raw hex-encoded EC point and prepend the type bytes so it is encoded and ready to be used in a register.

Given a raw hex-encoded EC point, convert it to a P2PK address

Given a raw hex-encoded EC point from a register (thus with type encoded characters in front), convert it to a P2PK address

Given a Vec<ErgoBox> return the given boxes (which must be part of the UTXO-set) as a vec of serialized strings in Base16 encoding

Given an ErgoBox return the given box (which must be part of the UTXO-set) as a serialized string in Base16 encoding

Given a box id return the given box (which must be part of the UTXO-set) as a serialized string in Base16 encoding

Given a box id return the given box (which must be part of the UTXO-set) as a serialized string in Base16 encoding

Get the current nanoErgs balance held in the Ergo Node wallet

Get the current block height of the blockchain

Builds a HeaderValue to use for requests with the api key specified

Sets required headers for a request

Sends a GET request to the Ergo node

source

pub fn send_post_req(&self, endpoint: &str, body: String) -> Result<Response>

Sends a POST request to the Ergo node

Parses response from node into JSON

General function for submitting a Json String body to an endpoint which also returns a JsonValue response.

Scanning-related endpoints

Registers a scan with the node and either returns the scan_id or an error

Using the scan_id of a registered scan, acquires unspent boxes which have been found by said scan

Using the scan_id of a registered scan, manually adds a box to said scan.

Submits a Signed Transaction provided as input as JSON to the Ergo Blockchain mempool.

Sign an Unsigned Transaction which is formatted in JSON

Sign an Unsigned Transaction which is formatted in JSON and then submit it to the mempool.

Submits a Signed Transaction provided as input to the Ergo Blockchain mempool.

Sign an UnsignedTransaction

Sign an UnsignedTransaction and then submit it to the mempool.

Generates and submits a tx using the node endpoints. Input is a json formatted request with rawInputs (and rawDataInputs) manually selected or inputs will be automatically selected by wallet. Returns the resulting TxId.

Generates Json of an Unsigned Transaction. Input must be a json formatted request with rawInputs (and rawDataInputs) manually selected or will be automatically selected by wallet.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Converts self into T using Into<T>. Read more

Causes self to use its Binary implementation when Debug-formatted.

Causes self to use its Display implementation when Debug-formatted. Read more

Causes self to use its LowerExp implementation when Debug-formatted. Read more

Causes self to use its LowerHex implementation when Debug-formatted. Read more

Causes self to use its Octal implementation when Debug-formatted.

Causes self to use its Pointer implementation when Debug-formatted. Read more

Causes self to use its UpperExp implementation when Debug-formatted. Read more

Causes self to use its UpperHex implementation when Debug-formatted. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Pipes by value. This is generally the method you want to use. Read more

Borrows self and passes that borrow into the pipe function. Read more

Mutably borrows self and passes that borrow into the pipe function. Read more

Borrows self, then passes self.borrow() into the pipe function. Read more

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more

Borrows self, then passes self.as_ref() into the pipe function.

Mutably borrows self, then passes self.as_mut() into the pipe function. Read more

Borrows self, then passes self.deref() into the pipe function.

Mutably borrows self, then passes self.deref_mut() into the pipe function. Read more

Should always be Self

Immutable access to a value. Read more

Mutable access to a value. Read more

Immutable access to the Borrow<B> of a value. Read more

Mutable access to the BorrowMut<B> of a value. Read more

Immutable access to the AsRef<R> view of a value. Read more

Mutable access to the AsMut<R> view of a value. Read more

Immutable access to the Deref::Target of a value. Read more

Mutable access to the Deref::Target of a value. Read more

Calls .tap() only in debug builds, and is erased in release builds.

Calls .tap_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_borrow() only in debug builds, and is erased in release builds. Read more

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_ref() only in debug builds, and is erased in release builds. Read more

Calls .tap_ref_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_deref() only in debug builds, and is erased in release builds. Read more

Calls .tap_deref_mut() only in debug builds, and is erased in release builds. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Attempts to convert self into T using TryInto<T>. Read more

Extract value of the given type from any type (e.g. [‘Constant’], [super::value::Value]) on which [TryExtractFrom] is implemented Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more