pub struct NodeService { /* private fields */ }Expand description
A running node service.
Implementations§
Source§impl NodeService
impl NodeService
Sourcepub async fn terminate(self) -> Result<()>
pub async fn terminate(self) -> Result<()>
Terminates the node service by killing its child process.
Sourcepub fn ensure_is_running(&mut self) -> Result<()>
pub fn ensure_is_running(&mut self) -> Result<()>
Checks that the node service child process is still running.
Sourcepub async fn process_inbox(&self, chain_id: &ChainId) -> Result<Vec<CryptoHash>>
pub async fn process_inbox(&self, chain_id: &ChainId) -> Result<Vec<CryptoHash>>
Issues a processInbox GraphQL mutation and returns the hashes of the created blocks.
Sourcepub async fn sync(&self, chain_id: &ChainId) -> Result<u64>
pub async fn sync(&self, chain_id: &ChainId) -> Result<u64>
Issues a sync GraphQL mutation for the given chain and returns the new block height.
Sourcepub async fn transfer(
&self,
chain_id: ChainId,
owner: AccountOwner,
recipient: Account,
amount: Amount,
) -> Result<CryptoHash>
pub async fn transfer( &self, chain_id: ChainId, owner: AccountOwner, recipient: Account, amount: Amount, ) -> Result<CryptoHash>
Issues a transfer GraphQL mutation and returns the resulting block hash.
Sourcepub async fn balance(&self, account: &Account) -> Result<Amount>
pub async fn balance(&self, account: &Account) -> Result<Amount>
Queries the balance of the given account via GraphQL.
Sourcepub fn make_application<A: ContractAbi>(
&self,
chain_id: &ChainId,
application_id: &ApplicationId<A>,
) -> Result<ApplicationWrapper<A>>
pub fn make_application<A: ContractAbi>( &self, chain_id: &ChainId, application_id: &ApplicationId<A>, ) -> Result<ApplicationWrapper<A>>
Returns an ApplicationWrapper for querying the given application on this node service.
Sourcepub async fn publish_data_blob(
&self,
chain_id: &ChainId,
bytes: Vec<u8>,
) -> Result<CryptoHash>
pub async fn publish_data_blob( &self, chain_id: &ChainId, bytes: Vec<u8>, ) -> Result<CryptoHash>
Issues a publishDataBlob GraphQL mutation and returns the blob’s hash.
Sourcepub async fn publish_module<Abi, Parameters, InstantiationArgument>(
&self,
chain_id: &ChainId,
contract: PathBuf,
service: PathBuf,
vm_runtime: VmRuntime,
) -> Result<ModuleId<Abi, Parameters, InstantiationArgument>>
pub async fn publish_module<Abi, Parameters, InstantiationArgument>( &self, chain_id: &ChainId, contract: PathBuf, service: PathBuf, vm_runtime: VmRuntime, ) -> Result<ModuleId<Abi, Parameters, InstantiationArgument>>
Issues a publishModule GraphQL mutation and returns the new module ID.
Sourcepub async fn query_committees(
&self,
chain_id: &ChainId,
) -> Result<BTreeMap<Epoch, Committee>>
pub async fn query_committees( &self, chain_id: &ChainId, ) -> Result<BTreeMap<Epoch, Committee>>
Queries the committees of the given chain via GraphQL.
Sourcepub async fn events_from_index(
&self,
chain_id: &ChainId,
stream_id: &StreamId,
start_index: u32,
) -> Result<Vec<IndexAndEvent>>
pub async fn events_from_index( &self, chain_id: &ChainId, stream_id: &StreamId, start_index: u32, ) -> Result<Vec<IndexAndEvent>>
Issues an eventsFromIndex GraphQL query for events on the given chain and stream.
Sourcepub async fn query_node(&self, query: impl AsRef<str>) -> Result<Value>
pub async fn query_node(&self, query: impl AsRef<str>) -> Result<Value>
Posts the given GraphQL query to the node service, retrying on timeouts and errors.
Sourcepub async fn create_application<Abi: ContractAbi, Parameters: Serialize, InstantiationArgument: Serialize>(
&self,
chain_id: &ChainId,
module_id: &ModuleId<Abi, Parameters, InstantiationArgument>,
parameters: &Parameters,
argument: &InstantiationArgument,
required_application_ids: &[ApplicationId],
) -> Result<ApplicationId<Abi>>
pub async fn create_application<Abi: ContractAbi, Parameters: Serialize, InstantiationArgument: Serialize>( &self, chain_id: &ChainId, module_id: &ModuleId<Abi, Parameters, InstantiationArgument>, parameters: &Parameters, argument: &InstantiationArgument, required_application_ids: &[ApplicationId], ) -> Result<ApplicationId<Abi>>
Issues a createApplication GraphQL mutation and returns the new application ID.
Sourcepub async fn chain_tip(
&self,
chain: ChainId,
) -> Result<Option<(CryptoHash, BlockHeight)>>
pub async fn chain_tip( &self, chain: ChainId, ) -> Result<Option<(CryptoHash, BlockHeight)>>
Obtains the hash and height of the chain’s tip block, as known by this node service.
Sourcepub async fn notifications(
&self,
chain_id: ChainId,
) -> Result<Pin<Box<impl Stream<Item = Result<Notification>>>>>
pub async fn notifications( &self, chain_id: ChainId, ) -> Result<Pin<Box<impl Stream<Item = Result<Notification>>>>>
Subscribes to the node service and returns a stream of notifications about a chain.
Auto Trait Implementations§
impl !RefUnwindSafe for NodeService
impl !UnwindSafe for NodeService
impl Freeze for NodeService
impl Send for NodeService
impl Sync for NodeService
impl Unpin for NodeService
impl UnsafeUnpin for NodeService
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
impl<_INNER> AutoTraits for _INNER
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T> MaybeSend for Twhere
T: Send,
impl<T> MaybeSync for Twhere
T: Sync,
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Post for Twhere
T: Send + 'static,
Source§impl<M, I> RuntimeMemory<&mut I> for Mwhere
M: RuntimeMemory<I>,
impl<M, I> RuntimeMemory<&mut I> for Mwhere
M: RuntimeMemory<I>,
Source§fn read<'instance>(
&self,
instance: &'instance &mut I,
location: GuestPointer,
length: u32,
) -> Result<Cow<'instance, [u8]>, RuntimeError>
fn read<'instance>( &self, instance: &'instance &mut I, location: GuestPointer, length: u32, ) -> Result<Cow<'instance, [u8]>, RuntimeError>
Reads length bytes from memory from the provided location.
Source§fn write(
&mut self,
instance: &mut &mut I,
location: GuestPointer,
bytes: &[u8],
) -> Result<(), RuntimeError>
fn write( &mut self, instance: &mut &mut I, location: GuestPointer, bytes: &[u8], ) -> Result<(), RuntimeError>
Writes the bytes to memory at the provided location.