MoacServerClient class
- Inheritance
- Object
- Moac
- MoacServerClient
Constructors
- MoacServerClient()
- MoacServerClient.withConnectionParameters(dynamic hostname, [ dynamic port ])
Properties
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- host ↔ String
-
read / write, inherited
- httpAdapter ← MoacINetworkAdapter
-
write-only, inherited
- id ↔ int
-
Transmission id
read / write, inherited
- lastError ↔ MoacError
-
Last error
read / write, inherited
- port ↔ int
-
Connection parameters
read / write, inherited
- printError ↔ bool
-
Print errors, default is off
read / write, inherited
- rpcClient ↔ MoacRpcClient
-
Json RPC client
read / write, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
- uri → Uri
-
read-only, inherited
Methods
-
accounts(
) → Future< List< BigInt> > -
Accounts, a list of addresses owned by client.
inherited
-
blockNumber(
) → Future< int> -
Block number, the number of most recent block.
inherited
-
call(
BigInt address, MoacDefaultBlock block, { BigInt from, int gas, int gasPrice, int value, BigInt data }) → Future< int> -
Call
Executes a new message call immediately without creating a transaction on the block chain.
address: The address the transaction is sent to.
from: (optional) The address the transaction is sent from.
gas: (optional) Integer of the gas provided for the transaction execution. eth_call consumes zero gas,
but this parameter may be needed by some executions.
gasPrice: (optional) Integer of the gasPrice used for each paid gas
value: (optional) Integer of the value send with this transaction
data: (optional) Hash of the method signature and encoded parameters. For details see Moac Contract ABI
block: default block parameter
Returns the return value of executed contract.
inherited
-
clientVersion(
) → Future< String> -
API methods
/ Client version
inherited
-
coinbaseAddress(
) → Future< BigInt> -
The client coinbase address.
inherited
-
connectParameters(
String scheme, String hostname, [ int port ]) → void -
Connect by explicitly setting the connection parameters.
Scheme must be either rpcScheme or rpcWsScheme
inherited
-
connectString(
String hostname) → void -
Connection methods
/ Connect using a host string of the form http://thehost.com:1234,
port is optional. Scheme must be http or ws
inherited
-
connectUri(
Uri uri) → void -
Connect using a URI, port is optional
inherited
-
estimateGas(
{BigInt address, BigInt from, int gas, int gasPrice, int value, BigInt data }) → Future< int> -
Estimate gas
Makes a call or transaction, which won't be added to the blockchain and returns the used gas,
which can be used for estimating the used gas.
See eth_call parameters, expect that all properties are optional. If no gas limit is specified geth
uses the block gas limit from the pending block as an upper bound. As a result the returned estimate
might not be enough to executed the call/transaction when the amount of gas is higher than the
pending block gas limit.
Returns the amount of gas used.
inherited
-
gasPrice(
) → Future< int> -
The current price per gas in wei.
inherited
-
getBalance(
BigInt accountNumber, MoacDefaultBlock block) → Future< int> -
Get balance, the balance of the account of the given address.
inherited
-
getBlockByHash(
BigInt blockHash, [ bool full = true ]) → Future< MoacBlock> -
Get block by hash
Returns information about a block by hash
Hash of a block and a boolean, if true it returns the full transaction objects,
if false only the hashes of the transactions, defaults to true.
Returns A block object, or null when no block was found :
inherited
-
getBlockByNumber(
MoacDefaultBlock blockNumber, [ bool full = true ]) → Future< MoacBlock> -
Get block by number
Returns information about a block by block number.
blockNumber - defualt block parameter
as in the default block parameter.
A boolean, if true it returns the full transaction objects,
if false only the hashes of the transactions, defaults to true.
Returns See getBlockByHash
inherited
-
getBlockTransactionCountByHash(
BigInt blockHash) → Future< int> -
Block Transaction Count By Hash
The number of transactions in a block from a block matching the given block hash.
If the method returns null a count of 0 is returned, this is to distinguish between
this and an error.
inherited
-
getBlockTransactionCountByNumber(
MoacDefaultBlock blockNumber) → Future< int> -
Block Transaction Count By Number
The number of transactions in a block matching the given block number.
If the method returns null a count of 0 is returned, this is to distinguish between
this and an error.
inherited
-
getCode(
BigInt address, MoacDefaultBlock block) → Future< int> -
Get code, the code at the given address.
inherited
-
getFilterChanges(
int filterId) → Future< MoacFilter> -
Get filter changes
Polling method for a filter, which returns an list of logs which occurred since last poll.
Filter Id
Returns an MoacFilter object or null
inherited
-
getFilterLogs(
int filterId) → Future< MoacFilter> -
Get filter logs
Filter Id
Returns see getFilterChanges
inherited
-
getLogs(
{MoacDefaultBlock fromBlock, MoacDefaultBlock toBlock, dynamic address, List< BigInt> topics }) → Future<MoacFilter> -
Get logs
The filter definition, see newFilter parameters.
Returns see getFilterChanges
inherited
-
getStorageAt(
BigInt address, int pos, MoacDefaultBlock block) → Future< BigInt> -
Get Storage at, the value from a storage position at a given address.
Parameters are the address of the storage, the integer position of the storage and
inherited
-
getTransactionByBlockHashAndIndex(
BigInt blockHash, int index) → Future< MoacTransaction> -
Get transaction by block hash and index.
Returns information about a transaction by block hash and transaction index position.
Hash of a block and integer of the transaction index position.
Returns see getTransactionByHash.
inherited
-
getTransactionByBlockNumberAndIndex(
MoacDefaultBlock blockNumber, int index) → Future< MoacTransaction> -
Get transaction by block number and index.
Returns information about a transaction by block number and transaction index position.
A block number as in the default block parameter.
Returns see getTransactionByHash.
inherited
-
getTransactionByHash(
BigInt hash) → Future< MoacTransaction> -
Get transaction by hash
Returns the information about a transaction requested by transaction hash.
Hash of a transaction
Returns a transaction object, or null when no transaction was found:
inherited
-
getTransactionCount(
BigInt address, MoacDefaultBlock block) → Future< int> -
Transaction count, returns the number of transactions sent from an address.
inherited
-
getTransactionReceipt(
BigInt transactionHash) → Future< MoacTransactionReceipt> -
Get transaction receipt
Returns the receipt of a transaction by transaction hash.
Note That the receipt is not available for pending transactions.
Hash of a transaction
Returns a transaction receipt object, or null when no receipt was found:
inherited
-
getUncleByBlockHashAndIndex(
BigInt blockHash, int index) → Future< MoacBlock> -
Get uncle by block hash and index.
Returns information about an uncle by block hash and uncle index position.
Note: An uncle doesn't contain individual transactions.
Hash of a block and integer of the uncle index position.
Returns see getBlockByHash.
inherited
-
getUncleByBlockNumberAndIndex(
MoacDefaultBlock blockNumber, int index) → Future< MoacBlock> -
Get uncle by block number and index.
Returns information about an uncle by block number and uncle index position.
Note: An uncle doesn't contain individual transactions.
A block number as in the default block parameter.
Returns see getBlockByHash.
inherited
-
getUncleCountByHash(
BigInt blockHash) → Future< int> -
Block Uncle Count By Hash
The number of uncles in a block from a block matching the given block hash.
If the method returns null a count of 0 is returned, this is to distinguish between
this and an error.
inherited
-
getUncleCountByNumber(
MoacDefaultBlock blockNumber) → Future< int> -
Block Uncle Count By Number
The number of uncles in a block matching the given block number.
If the method returns null a count of 0 is returned, this is to distinguish between
this and an error.
inherited
-
getWork(
) → Future< MoacWork> -
Get work
Returns the hash of the current block, the seedHash, and the boundary condition to be met ("target").
Returns an MoacWork object or null
inherited
-
hashrate(
) → Future< int> -
Hashrate, returns the number of hashes per second that the node is mining with.
inherited
-
mining(
) → Future< bool> -
Mining, true when mining
inherited
-
netListening(
) → Future< bool> -
Net listening, true when listening
inherited
-
netPeerCount(
) → Future< int> -
Net peer count,
inherited
-
netVersion(
) → Future< String> -
Net version
inherited
-
newBlockFilter(
) → Future< int> -
New block filter
Creates a filter in the node, to notify when a new block arrives.
To check if the state has changed, call getFilterChanges.
Returns a filter id.
inherited
-
newFilter(
{MoacDefaultBlock fromBlock, MoacDefaultBlock toBlock, dynamic address, List< BigInt> topics }) → Future<int> -
New filter
Creates a filter object, based on filter options, to notify when the state changes (logs).
To check if the state has changed, call getFilterChanges.
note on specifying topic filters:
Topics are order-dependent. A transaction with a log with topics
A, B
will be matched by the following topic filters: [] "anything"'A'
"A in first position (and anything after)"null, B
"anything in first position AND B in second position (and anything after)"A, B
"A in first position AND B in second position (and anything after)" [A, B
,A, B
] "(A OR B) in first position AND (A OR B) in second position (and anything after)" fromBlock: - (optional, default: "latest") Integer block number, or "latest" for the last mined block or "pending", "earliest" for not yet mined transactions. toBlock: - (optional, default: "latest") Integer block number, or "latest" for the last mined block or "pending", "earliest" for not yet mined transactions. address: - (optional) Contract address or a list of addresses from which logs should originate. topics: - (optional) topics. Topics are order-dependent. Note: the user must build this structure using the utilities in the MoacUtilities class. See the Moac Wiki RPC page for examples. Returns a filter id.inherited -
newPendingTransactionFilter(
) → Future< int> -
New pending transaction filter
Creates a filter in the node, to notify when a new pending transaction arrives.
To check if the state has changed, call getFilterChanges.
Returns a filter id.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
@pragma('vm.entry-point'), inherited
-
protocolVersion(
) → Future< String> -
Protocol version
inherited
-
sendRawTransaction(
BigInt signedTransaction) → Future< int> -
Send raw transaction
Creates new message call transaction or a contract creation for signed transactions.
Takes the signed transaction data.
Returns the transaction hash, or the zero hash if the transaction is not yet available.
inherited
-
sendTransaction(
BigInt address, BigInt data, { BigInt to, int gas: 9000, int gasPrice, int value, int nonce }) → Future< int> -
Send transaction
Creates new message call transaction or a contract creation, if the data field contains code.
address: The address the transaction is sent from.
to: (optional when creating new contract) The address the transaction is directed to.
gas: (optional, default: 90000) Integer of the gas provided for the transaction execution. It will return unused gas.
gasPrice: (optional, default: To-Be-Determined) Integer of the gasPrice used for each paid gas
value: (optional) Integer of the value send with this transaction
data: The compiled code of a contract OR the hash of the invoked method signature and encoded parameters. For details see Moac Contract ABI
nonce: optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce.
Returns the transaction hash, or the zero hash if the transaction is not yet available.
inherited
-
sha3(
BigInt data) → Future< BigInt> -
Returns Keccak-256 (not the standardized SHA3-256) of the given data.
inherited
-
sign(
BigInt account, int message) → Future< int> -
Sign
The sign method calculates an Moac specific signature with:
sign(keccak256("\x19Moac Signed Message:\n" + len(message) + message))).
Note the address to sign with must be unlocked.
inherited
-
submitWork(
BigInt nonce, BigInt powHash, BigInt digest) → Future< bool> -
Submit work
Used for submitting a proof-of-work solution.
The nonce found
The header's pow-hash
The mix digest
Returns true if the provided solution is valid, otherwise false.
inherited
-
syncStatus(
) → Future< MoacSyncStatus> -
Sync status, an object with data about the sync status if syncing or false if not.
inherited
-
toString(
) → String -
Returns a string representation of this object.
inherited
-
uninstallFilter(
int filterId) → Future< bool> -
Uninstall filter
Uninstalls a filter with given id. Should always be called when watch is no longer needed.
Additionally Filters timeout when they aren't requested with getFilterChanges for a period of time.
Filter id
Returns true if the filter was successfully uninstalled, otherwise false.
inherited
Operators
-
operator ==(
dynamic other) → bool -
The equality operator. [...]
inherited
Static Properties
- serverHttpAdapter ↔ MoacServerHTTPAdapter
-
read / write