DaemonClient class
JSON-RPC Client to interact with TOS daemon.
- Inheritance
-
- Object
- RpcClientRepository
- DaemonClient
- Available extensions
Constructors
- DaemonClient.new({required String endPoint, bool secureWebSocket = true, int timeout = 60000, Logger? logger})
- DaemonClient constructor
Properties
-
eventsCallbacks
↔ Map<
TosJsonKey, List< Function> > -
Event callbacks
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- log → Logger?
-
Logger
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- socket ↔ WebSocket?
-
Websocket client
getter/setter pairinherited
-
state
→ Stream<
ClientState> -
get client state
no setterinherited
Methods
-
connect(
) → void -
Initialize the websocket to communicate with RPC server and start
listening.
inherited
-
countAccounts(
) → Future< int> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Counts the number of accounts saved on disk -
countAssets(
) → Future< int> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Counts the number of assets saved on disk. -
countContracts(
) → Future< int> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Retrieve the number of contracts saved on disk. -
countTransactions(
) → Future< int> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Returns the number of transactions saved on node disk. -
decryptExtraData(
DecryptExtraDataDaemonParams decryptExtraDataParams) → Future -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Decrypt extra data from a transaction. -
disconnect(
) → void -
Close the websocket channel.
inherited
-
extractKeyFromAddress(
ExtractKeyFromAddressParams extractKeyFromAddressParams) → Future< ExtractKeyFromAddressResult> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Extract key from address -
getAccountAssets(
GetAccountAssetsParams getAccountAssetsParams) → Future< GetAccountAssetsResult> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Retrieve all assets for an account -
getAccountHistory(
GetAccountHistoryParams getAccountHistoryParams) → Future< GetAccountHistoryResult> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Fetch up to 20 history events for an account on a specific asset -
getAccountRegistrationTopoheight(
GetAccountRegistrationTopoheightParams getAccountRegistrationTopoheightParams) → Future< int> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Retrieve the account registration topoheight. -
getAccounts(
[GetAccountsParams? getAccountsParams]) → Future< GetAccountsResult> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Retrieve all available accounts (each account got at least one interaction on chain). -
getAsset(
GetAssetParams getAssetParams) → Future< RPCAssetData> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Get registered topoheight and decimals data from a specific asset. -
getAssets(
[GetAssetsParams? getAssetsParams]) → Future< List< RPCAssetData> > -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Get all assets available on network with its registered topoheight. -
getBalance(
GetBalanceParams getBalanceParams) → Future< GetBalanceResult> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Returns up-to-date asset's balance for a specific address. -
getBalanceAtTopoHeight(
GetBalanceAtTopoHeightParams getBalanceAtTopoHeightParams) → Future< BalanceVersion> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Returns asset's balance from address at exact topo height. -
getBlockAtTopoHeight(
GetBlockAtTopoHeightParams getBlockAtTopoHeightParams) → Future< Block> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Returns a block at a specific topo height. -
getBlockByHash(
GetBlockByHashParams getBlockByHashParams) → Future< Block> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Return a block by its hash. -
getBlocksAtHeight(
GetBlocksAtHeightParams getBlocksAtHeightParams) → Future< List< Block> > -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Returns all blocks at a specific height. -
getBlocksRangeByHeight(
GetHeightRangeParams getHeightRangeParams) → Future< List< Block> > -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Returns a specific range of blocks (up to 20 maximum) based on height. -
getBlocksRangeByTopoHeight(
GetTopoHeightRangeParams getTopoHeightRangeParams) → Future< List< Block> > -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Returns a specific range of blocks (up to 20 maximum) based on topo height. -
getBlockTemplate(
GetBlockTemplateParams getBlockTemplateParams) → Future< GetBlockTemplateResult> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Returns the block template for PoW work. -
getContractData(
GetContractDataParams getContractDataParams) → Future< GetContractDataResult> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Retrieve the contract data with the requested key. -
getContractModule(
GetContractModuleParams getContractModuleParams) → Future< Map< String, dynamic> > -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
TODO: Add documentation -
getContractOutputs(
GetContractOutputsParams getContractOutputsParams) → Future< List< Map< >String, dynamic> > -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Retrieve the contract outputs that have occurred in the requested transaction hash. -
getDagOrder(
GetTopoHeightRangeParams getTopoHeightRangeParams) → Future< List< String> > -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Returns the whole DAG order (all blocks hash ordered by topo height). -
getDevFeeThresholds(
) → Future< List< DevFeeThresholds> > -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Retrieve configured dev fees thresholds -
getDifficulty(
) → Future< GetDifficultyResult> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Returns the current difficulty and associated network hashrate. -
getEstimatedFeeRates(
) → Future< FeeRatesEstimated> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Get estimated fee rates. -
getHardForks(
) → Future< List< GetHardForksResult> > -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Get hard forks -
getHeight(
) → Future< int> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Returns current height of the chain. -
getInfo(
) → Future< GetInfoResult> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Returns current information from chain. -
getMempool(
GetMempoolParams getMempoolParams) → Future< GetMempoolResult> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Fetch all transactions presents in the mempool. -
getMempoolCache(
GetMempoolCacheParams getMempoolCacheParams) → Future< GetMempoolCacheResult> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Retrieve the stored mempool cache for a requested address. -
getMempoolSummary(
GetMempoolParams getMempoolParams) → Future< GetMempoolSummaryResult> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Fetch transactions summary presents in the mempool. -
getMinerWork(
GetMinerWorkParams getMinerWorkParams) → Future< GetMinerWorkResult> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Get miner Work -
getMultisig(
GetMultisigParams getMultisigParams) → Future< GetMultisigResult> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Retrieve the latest multisig information for a specific address. -
getMultisigAtTopoheight(
GetMultisigAtTopoheightParams getMultisigAtTopoheightParams) → Future< GetMultisigAtTopoheightResult> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Retrieve the latest multisig information for a specific address at a specific topoheight. -
getNonce(
GetNonceParams getNonceParams) → Future< GetNonceResult> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Returns the nonce for address in request params. -
getNonceAtTopoHeight(
GetNonceAtTopoHeightParams getNonceAtTopoHeightParams) → Future< GetNonceAtTopoHeightResult> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Get nonce from address at exact topoheight. -
getPeers(
) → Future< GetPeersResult> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Retrieve all peers connected -
getSizeOnDisk(
) → Future< GetSizeOnDiskResult> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Get size of the blockchain on disk -
getStableBalance(
GetBalanceParams getBalanceParams) → Future< GetStableBalanceResult> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Get up-to-date asset's balance for a specific address. -
getStableHeight(
) → Future< int> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Returns the stable height of the chain. -
getStableTopoHeight(
) → Future< int> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Returns the stable topological height of the chain. -
getTips(
) → Future< List< String> > -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Returns Tips (highest blocks from blockDAG) from chain. -
getTopBlock(
[GetTopBlockParams? getTopBlockParams]) → Future< Block> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Returns the highest block based on the topological height. -
getTopoHeight(
) → Future< int> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Returns current topological height of the chain. -
getTransaction(
GetTransactionParams getTransactionParams) → Future< TransactionResponse> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Fetch a transaction by its hash from daemon. -
getTransactionExecutor(
GetTransactionParams getTransactionParams) → Future< GetTransactionExecutorResult> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
TODO: Add documentation -
getTransactions(
GetTransactionsParams getTransactionsParams) → Future< List< TransactionResponse> > -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Fetch transactions by theirs hashes from daemon and keep the same order in response. -
getVersion(
) → Future< String> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Returns current daemon version. -
hasBalance(
HasBalanceParams hasBalanceParams) → Future< HasBalanceResult> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Verify if address has a balance on-chain registered for requested asset. -
hasMultisig(
HasMultisigParams hasMultisigParams) → Future< bool> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Verify if the address has a multisig setup. -
hasMultisigAtTopoheight(
HasMultisigAtTopoheightParams hasMultisigAtTopoheightParams) → Future< bool> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Verify if the address has a multisig setup at a specific topoheight. -
hasNonce(
HasNonceParams hasNonceParams) → Future< HasNonceResult> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Verify if address has a nonce on-chain registered -
isAccountRegistered(
IsAccountRegisteredParams isAccountRegisteredParams) → Future< bool> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Verify if the account on chain is registered. This is useful to determine if we should pay additionnal fee or not. -
isTxExecutedInBlock(
IsTxExecutedInBlockParams isTxExecutedInBlockParams) → Future< bool> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Check if the asked TX is executed in the block -
makeIntegratedAddress(
MakeIntegratedAddressParams makeIntegratedAddressParams) → Future< String> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Create an integrated address using a wallet address and data to include. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onBlockOrdered(
void callback(BlockOrderedEvent blockOrderEvent)) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Registers a callback for BlockOrdered event. -
onBlockOrphaned(
void callback(BlockOrphanedEvent blockOrphanedEvent)) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
When a block that was ordered is not in the new DAG order. It contains BlockOrphanedEvent that got orphaned. -
onClose(
void callback()) → void -
Registers a callbacks for connection state change events.
inherited
-
onContractEvent(
void callback(ContractEvent event)) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Registers a callback for ContractEvent event. -
onContractTransfer(
void callback(ContractTransferEvent event)) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Registers a callback for ContractTransfer event. -
onDeployContract(
void callback(NewContractEvent event)) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Registers a callback for DeployContract event. -
onError(
void callback(dynamic)) → void -
Registers a callbacks for connection state change events.
inherited
-
onEvent(
TosJsonKey event, Function callback) → void -
Subscribe and add callback to a specific event.
inherited
-
onInvokeContract(
void callback(InvokeContractEvent event)) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Registers a callback for InvokeContract event. -
onNewAsset(
void callback(NewAssetEvent newAssetEvent)) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Registers a callback for NewAsset event. -
onNewBlock(
void callback(Block block)) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Registers a callback for NewBlock event. -
onOpen(
void callback()) → void -
Registers a callbacks for connection state change events.
inherited
-
onPeerConnected(
void callback(PeerEntry peerConnected)) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Registers a callback for PeerConnected event. -
onPeerDisconnected(
void callback(PeerEntry peerDisconnected)) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Registers a callback for PeerDisconnected event. -
onPeerPeerDisconnected(
void callback(PeerEntry peerDisconnected)) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Registers a callback for PeerPeerDisconnected event. -
onPeerPeerListUpdated(
void callback(PeerPeerListUpdatedEvent peerPeerListUpdatedEvent)) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Registers a callback for PeerPeerListUpdated event. -
onPeerStateUpdated(
void callback(PeerEntry peerUpdated)) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Registers a callback for PeerStateUpdated event. -
onStableHeightChanged(
void callback(StableHeightChangedEvent stableHeightChangedEvent)) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Registers a callback for StableHeightChanged event. -
onStableTopoHeightChanged(
void callback(StableTopoheightChangedEvent stableTopoheightChangedEvent)) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Registers a callback for StableTopoHeightChanged event. -
onTransactionAddedInMempool(
void callback(MempoolTransactionSummary mempoolTransactionSummary)) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Registers a callback for TransactionAddedInMempool event. -
onTransactionExecuted(
void callback(TransactionExecutedEvent transactionExecutedEvent)) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Registers a callback for TransactionExecuted event. -
onTransactionOrphaned(
void callback(TransactionResponse transactionResponse)) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
When a transaction that was executed in a block is not reintroduced in mempool. It contains TransactionOrphanedEvent as value. -
p2pStatus(
) → Future< P2pStatusResult> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Returns information about P2P. -
registerCallback(
TosJsonKey event, Function callback) → void -
Registers a callback for a TOS event.
inherited
-
sendRequest(
TosJsonKey method, [Map< String, dynamic> ? params]) → Future -
Sends a request to TOS rpc server.
inherited
-
splitAddress(
SplitAddressParams splitAddressParams) → Future< SplitAddressResult> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Splits address and integrated data into two different fields. -
submitBlock(
SubmitBlockParams submitBlockParams) → Future< bool> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Submit a block to the daemon. -
submitTransaction(
SubmitTransactionParams submitTransactionParams) → Future< bool> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Submit a transaction in hex format to daemon mempool. -
subscribeTo(
TosJsonKey event) → Future< void> -
Subscribe to a TOS event.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
unsubscribeFrom(
TosJsonKey event) → Future< void> -
Unsubscribe from a TOS event.
inherited
-
unsubscribeFromAll(
) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Unsubscribes from all events. -
unsubscribeFromBlockOrdered(
) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Unsubscribes from BlockOrdered event. -
unsubscribeFromBlockOrphaned(
) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Unsubscribes from BlockOrphaned event. -
unsubscribeFromContractEvent(
) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Unsubscribes from ContractEvent event. -
unsubscribeFromContractTransfer(
) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Unsubscribes from ContractTransfer event. -
unsubscribeFromDeployContract(
) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Unsubscribes from DeployContract event. -
unsubscribeFromInvokeContract(
) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Unsubscribes from InvokeContract event. -
unsubscribeFromNewAsset(
) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Unsubscribes from NewAsset event. -
unsubscribeFromNewBlock(
) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Unsubscribes from NewBlock event. -
unsubscribeFromPeerConnected(
) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Unsubscribes from PeerConnected event. -
unsubscribeFromPeerDisconnected(
) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Unsubscribes from PeerDisconnected event. -
unsubscribeFromPeerPeerDisconnected(
) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Unsubscribes from PeerPeerDisconnected event. -
unsubscribeFromPeerPeerListUpdated(
) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Unsubscribes from PeerPeerListUpdated event. -
unsubscribeFromPeerStateUpdated(
) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Unsubscribes from PeerStateUpdated event. -
unsubscribeFromStableHeightChanged(
) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Unsubscribes from StableHeightChanged event. -
unsubscribeFromStableTopoHeightChanged(
) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Unsubscribes from StableTopoHeightChanged event. -
unsubscribeFromTransactionAddedInMempool(
) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Unsubscribes from TransactionAddedInMempool event. -
unsubscribeFromTransactionExecuted(
) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Unsubscribes from TransactionExecuted event. -
unsubscribeFromTransactionOrphaned(
) → void -
Available on DaemonClient, provided by the DaemonEventsExtension extension
Unsubscribes from TransactionOrphaned event. -
validateAddress(
ValidateAddressParams validateAddressParams) → Future< ValidateAddressResult> -
Available on DaemonClient, provided by the DaemonRpcMethodsExtension extension
Validate an address
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited