pub struct TangleClient {
pub config: TangleClientConfig,
/* private fields */
}Expand description
Tangle Client for interacting with Tangle v2 contracts
Fields§
§config: TangleClientConfigClient configuration
Implementations§
Source§impl TangleClient
impl TangleClient
Sourcepub async fn new(config: TangleClientConfig) -> Result<Self>
pub async fn new(config: TangleClientConfig) -> Result<Self>
Sourcepub async fn with_keystore(
config: TangleClientConfig,
keystore: Keystore,
) -> Result<Self>
pub async fn with_keystore( config: TangleClientConfig, keystore: Keystore, ) -> Result<Self>
Sourcepub fn tangle_contract(&self) -> ITangleInstance<Arc<TangleProvider>>
pub fn tangle_contract(&self) -> ITangleInstance<Arc<TangleProvider>>
Get the Tangle contract instance
Sourcepub fn staking_contract(
&self,
) -> IMultiAssetDelegationInstance<Arc<TangleProvider>>
pub fn staking_contract( &self, ) -> IMultiAssetDelegationInstance<Arc<TangleProvider>>
Get the MultiAssetDelegation contract instance
Sourcepub fn status_registry_contract(
&self,
) -> IOperatorStatusRegistryInstance<Arc<TangleProvider>>
pub fn status_registry_contract( &self, ) -> IOperatorStatusRegistryInstance<Arc<TangleProvider>>
Get the operator status registry contract instance
Sourcepub fn provider(&self) -> &Arc<TangleProvider>
pub fn provider(&self) -> &Arc<TangleProvider>
Get the provider
Sourcepub fn tangle_address(&self) -> Address
pub fn tangle_address(&self) -> Address
Get the Tangle contract address
Sourcepub fn ecdsa_signing_key(&self) -> Result<K256SigningKey>
pub fn ecdsa_signing_key(&self) -> Result<K256SigningKey>
Get the ECDSA signing key from the keystore
§Errors
Returns error if the key is not found in the keystore
Sourcepub fn wallet(&self) -> Result<EthereumWallet>
pub fn wallet(&self) -> Result<EthereumWallet>
Get an Ethereum wallet for signing transactions
§Errors
Returns error if the key is not found or wallet creation fails
Sourcepub async fn block_number(&self) -> Result<u64>
pub async fn block_number(&self) -> Result<u64>
Get the current block number
Sourcepub async fn get_block(&self, number: BlockNumberOrTag) -> Result<Option<Block>>
pub async fn get_block(&self, number: BlockNumberOrTag) -> Result<Option<Block>>
Get a block by number
Sourcepub async fn next_event(&self) -> Option<TangleEvent>
pub async fn next_event(&self) -> Option<TangleEvent>
Get the next event (polls for new blocks)
On the first call, scans a small recent window to catch up on any
near-realtime events while staying compatible with hosted RPC plans
that cap eth_getLogs block ranges. Older active services are still
discovered by the manager’s contract-state fallback during initialize.
Subsequent calls only scan new blocks.
Sourcepub async fn latest_event(&self) -> Option<TangleEvent>
pub async fn latest_event(&self) -> Option<TangleEvent>
Get the latest observed event
Sourcepub async fn get_blueprint(&self, blueprint_id: u64) -> Result<Blueprint>
pub async fn get_blueprint(&self, blueprint_id: u64) -> Result<Blueprint>
Get blueprint information
Sourcepub async fn get_raw_blueprint_definition(
&self,
blueprint_id: u64,
) -> Result<Vec<u8>>
pub async fn get_raw_blueprint_definition( &self, blueprint_id: u64, ) -> Result<Vec<u8>>
Fetch the raw ABI-encoded blueprint definition bytes.
Sourcepub async fn get_blueprint_config(
&self,
blueprint_id: u64,
) -> Result<BlueprintConfig>
pub async fn get_blueprint_config( &self, blueprint_id: u64, ) -> Result<BlueprintConfig>
Get blueprint configuration
Sourcepub async fn get_blueprint_definition(
&self,
blueprint_id: u64,
) -> Result<BlueprintDefinition>
pub async fn get_blueprint_definition( &self, blueprint_id: u64, ) -> Result<BlueprintDefinition>
Get the full blueprint definition.
Sourcepub async fn create_blueprint(
&self,
encoded_definition: Vec<u8>,
) -> Result<(TransactionResult, u64)>
pub async fn create_blueprint( &self, encoded_definition: Vec<u8>, ) -> Result<(TransactionResult, u64)>
Create a new blueprint from an encoded definition.
Sourcepub async fn is_operator_registered(
&self,
blueprint_id: u64,
operator: Address,
) -> Result<bool>
pub async fn is_operator_registered( &self, blueprint_id: u64, operator: Address, ) -> Result<bool>
Check if operator is registered for blueprint
Sourcepub async fn get_service(&self, service_id: u64) -> Result<Service>
pub async fn get_service(&self, service_id: u64) -> Result<Service>
Get service information
Sourcepub async fn get_service_operators(
&self,
service_id: u64,
) -> Result<Vec<Address>>
pub async fn get_service_operators( &self, service_id: u64, ) -> Result<Vec<Address>>
Get service operators
Sourcepub async fn is_service_operator(
&self,
service_id: u64,
operator: Address,
) -> Result<bool>
pub async fn is_service_operator( &self, service_id: u64, operator: Address, ) -> Result<bool>
Check if address is a service operator
Sourcepub async fn get_service_operator(
&self,
service_id: u64,
operator: Address,
) -> Result<ServiceOperator>
pub async fn get_service_operator( &self, service_id: u64, operator: Address, ) -> Result<ServiceOperator>
Get service operator info including exposure
Returns the ServiceOperator struct which contains exposureBps.
Sourcepub async fn get_service_total_exposure(&self, service_id: u64) -> Result<U256>
pub async fn get_service_total_exposure(&self, service_id: u64) -> Result<U256>
Get total exposure for a service
Returns the sum of all operator exposureBps values.
Sourcepub async fn get_service_operator_weights(
&self,
service_id: u64,
) -> Result<BTreeMap<Address, u16>>
pub async fn get_service_operator_weights( &self, service_id: u64, ) -> Result<BTreeMap<Address, u16>>
Get operator weights (exposureBps) for all operators in a service
Returns a map of operator address to their exposure in basis points. This is useful for stake-weighted BLS signature threshold calculations.
Sourcepub async fn register_operator(
&self,
blueprint_id: u64,
rpc_endpoint: impl Into<String>,
registration_inputs: Option<Bytes>,
) -> Result<TransactionResult>
pub async fn register_operator( &self, blueprint_id: u64, rpc_endpoint: impl Into<String>, registration_inputs: Option<Bytes>, ) -> Result<TransactionResult>
Register the current operator for a blueprint.
Sourcepub async fn unregister_operator(
&self,
blueprint_id: u64,
) -> Result<TransactionResult>
pub async fn unregister_operator( &self, blueprint_id: u64, ) -> Result<TransactionResult>
Unregister the current operator from a blueprint.
Sourcepub async fn blueprint_count(&self) -> Result<u64>
pub async fn blueprint_count(&self) -> Result<u64>
Get the number of registered blueprints.
Sourcepub async fn service_count(&self) -> Result<u64>
pub async fn service_count(&self) -> Result<u64>
Get the number of registered services.
Sourcepub async fn get_service_request(
&self,
request_id: u64,
) -> Result<ServiceRequest>
pub async fn get_service_request( &self, request_id: u64, ) -> Result<ServiceRequest>
Get a service request by ID.
Sourcepub async fn service_request_count(&self) -> Result<u64>
pub async fn service_request_count(&self) -> Result<u64>
Get the total number of service requests ever created.
Sourcepub async fn get_job_call(
&self,
service_id: u64,
call_id: u64,
) -> Result<JobCall>
pub async fn get_job_call( &self, service_id: u64, call_id: u64, ) -> Result<JobCall>
Fetch metadata recorded for a specific job call.
Sourcepub async fn get_operator_metadata(
&self,
blueprint_id: u64,
operator: Address,
) -> Result<OperatorMetadata>
pub async fn get_operator_metadata( &self, blueprint_id: u64, operator: Address, ) -> Result<OperatorMetadata>
Fetch operator metadata (ECDSA public key + RPC endpoint) for a blueprint.
Sourcepub async fn request_service(
&self,
params: ServiceRequestParams,
) -> Result<(TransactionResult, u64)>
pub async fn request_service( &self, params: ServiceRequestParams, ) -> Result<(TransactionResult, u64)>
Submit a service request.
Sourcepub async fn join_service(
&self,
service_id: u64,
exposure_bps: u16,
) -> Result<TransactionResult>
pub async fn join_service( &self, service_id: u64, exposure_bps: u16, ) -> Result<TransactionResult>
Join a dynamic service with the requested exposure.
Sourcepub async fn join_service_with_commitments(
&self,
service_id: u64,
exposure_bps: u16,
commitments: Vec<AssetSecurityCommitment>,
) -> Result<TransactionResult>
pub async fn join_service_with_commitments( &self, service_id: u64, exposure_bps: u16, commitments: Vec<AssetSecurityCommitment>, ) -> Result<TransactionResult>
Join a dynamic service with the requested exposure and explicit security commitments.
Use this method when the service has security requirements that mandate operators provide asset commitments when joining.
Sourcepub async fn leave_service(&self, service_id: u64) -> Result<TransactionResult>
pub async fn leave_service(&self, service_id: u64) -> Result<TransactionResult>
Leave a dynamic service using the legacy immediate exit helper.
Note: This only works when exitQueueDuration == 0. For services with
an exit queue (default 7 days), use the exit queue workflow:
schedule_exit()- Enter the exit queue- Wait for exit queue duration
execute_exit()- Complete the exit
Sourcepub async fn schedule_exit(&self, service_id: u64) -> Result<TransactionResult>
pub async fn schedule_exit(&self, service_id: u64) -> Result<TransactionResult>
Schedule an exit from a dynamic service.
This enters the operator into the exit queue. After the exit queue duration
has passed (default 7 days), call execute_exit() to complete the exit.
Requires that the operator has fulfilled the minimum commitment duration since joining the service.
Sourcepub async fn execute_exit(&self, service_id: u64) -> Result<TransactionResult>
pub async fn execute_exit(&self, service_id: u64) -> Result<TransactionResult>
Execute a previously scheduled exit from a dynamic service.
This completes the exit after the exit queue duration has passed.
Must be called after schedule_exit() and waiting for the queue duration.
Sourcepub async fn cancel_exit(&self, service_id: u64) -> Result<TransactionResult>
pub async fn cancel_exit(&self, service_id: u64) -> Result<TransactionResult>
Cancel a previously scheduled exit from a dynamic service.
This cancels the exit and keeps the operator in the service.
Can only be called before execute_exit().
Sourcepub async fn approve_service(
&self,
request_id: u64,
restaking_percent: u8,
) -> Result<TransactionResult>
pub async fn approve_service( &self, request_id: u64, restaking_percent: u8, ) -> Result<TransactionResult>
Approve a pending service request with a simple restaking percentage.
Sourcepub async fn approve_service_with_commitments(
&self,
request_id: u64,
commitments: Vec<AssetSecurityCommitment>,
) -> Result<TransactionResult>
pub async fn approve_service_with_commitments( &self, request_id: u64, commitments: Vec<AssetSecurityCommitment>, ) -> Result<TransactionResult>
Approve a service request with explicit security commitments.
Sourcepub async fn reject_service(&self, request_id: u64) -> Result<TransactionResult>
pub async fn reject_service(&self, request_id: u64) -> Result<TransactionResult>
Reject a pending service request.
Sourcepub async fn is_operator(&self, operator: Address) -> Result<bool>
pub async fn is_operator(&self, operator: Address) -> Result<bool>
Check if address is a registered operator
Sourcepub async fn is_operator_active(&self, operator: Address) -> Result<bool>
pub async fn is_operator_active(&self, operator: Address) -> Result<bool>
Check if operator is active
Sourcepub async fn get_operator_stake(&self, operator: Address) -> Result<U256>
pub async fn get_operator_stake(&self, operator: Address) -> Result<U256>
Get operator’s total stake
Sourcepub async fn min_operator_stake(&self) -> Result<U256>
pub async fn min_operator_stake(&self) -> Result<U256>
Get minimum operator stake requirement
Sourcepub async fn operator_status(
&self,
service_id: u64,
operator: Address,
) -> Result<OperatorStatusSnapshot>
pub async fn operator_status( &self, service_id: u64, operator: Address, ) -> Result<OperatorStatusSnapshot>
Fetch status registry metadata for an operator/service pair.
Sourcepub async fn get_restaking_metadata(
&self,
operator: Address,
) -> Result<RestakingMetadata>
pub async fn get_restaking_metadata( &self, operator: Address, ) -> Result<RestakingMetadata>
Fetch restaking metadata for an operator.
Sourcepub async fn get_operator_self_stake(&self, operator: Address) -> Result<U256>
pub async fn get_operator_self_stake(&self, operator: Address) -> Result<U256>
Get operator self stake from MultiAssetDelegation.
Sourcepub async fn get_operator_delegated_stake(
&self,
operator: Address,
) -> Result<U256>
pub async fn get_operator_delegated_stake( &self, operator: Address, ) -> Result<U256>
Get operator delegated stake from MultiAssetDelegation.
Sourcepub async fn get_operator_delegators(
&self,
operator: Address,
) -> Result<Vec<Address>>
pub async fn get_operator_delegators( &self, operator: Address, ) -> Result<Vec<Address>>
Get delegators for the operator.
Sourcepub async fn get_operator_delegator_count(
&self,
operator: Address,
) -> Result<u64>
pub async fn get_operator_delegator_count( &self, operator: Address, ) -> Result<u64>
Get delegator count for the operator.
Sourcepub async fn restaking_round(&self) -> Result<u64>
pub async fn restaking_round(&self) -> Result<u64>
Get current restaking round.
Sourcepub async fn operator_commission_bps(&self) -> Result<u16>
pub async fn operator_commission_bps(&self) -> Result<u16>
Get operator commission (basis points).
Sourcepub async fn get_delegation_mode(
&self,
operator: Address,
) -> Result<DelegationMode>
pub async fn get_delegation_mode( &self, operator: Address, ) -> Result<DelegationMode>
Get operator’s delegation mode.
Returns the delegation policy for the operator:
- Disabled: Only operator can self-stake
- Whitelist: Only approved addresses can delegate
- Open: Anyone can delegate
Sourcepub async fn is_delegator_whitelisted(
&self,
operator: Address,
delegator: Address,
) -> Result<bool>
pub async fn is_delegator_whitelisted( &self, operator: Address, delegator: Address, ) -> Result<bool>
Check if delegator is whitelisted for operator.
Sourcepub async fn can_delegate(
&self,
operator: Address,
delegator: Address,
) -> Result<bool>
pub async fn can_delegate( &self, operator: Address, delegator: Address, ) -> Result<bool>
Check if delegator can delegate to operator.
This checks the operator’s delegation mode and whitelist status.
Sourcepub async fn set_delegation_mode(
&self,
mode: DelegationMode,
) -> Result<TransactionResult>
pub async fn set_delegation_mode( &self, mode: DelegationMode, ) -> Result<TransactionResult>
Set delegation mode for the calling operator.
Changes take effect immediately for NEW delegations only. Existing delegations remain valid regardless of mode change.
§Arguments
mode- Delegation mode: Disabled (0), Whitelist (1), or Open (2)
Sourcepub async fn set_delegation_whitelist(
&self,
delegators: Vec<Address>,
approved: bool,
) -> Result<TransactionResult>
pub async fn set_delegation_whitelist( &self, delegators: Vec<Address>, approved: bool, ) -> Result<TransactionResult>
Update delegation whitelist for the calling operator.
Whitelist only applies when delegation mode is set to Whitelist. Can be called regardless of current mode to pre-configure.
§Arguments
delegators- Array of delegator addresses to updateapproved- True to approve for delegation, false to revoke
Sourcepub async fn erc20_allowance(
&self,
token: Address,
owner: Address,
spender: Address,
) -> Result<U256>
pub async fn erc20_allowance( &self, token: Address, owner: Address, spender: Address, ) -> Result<U256>
Fetch ERC20 allowance for an owner/spender pair.
Sourcepub async fn erc20_balance(
&self,
token: Address,
owner: Address,
) -> Result<U256>
pub async fn erc20_balance( &self, token: Address, owner: Address, ) -> Result<U256>
Fetch ERC20 balance for an owner.
Sourcepub async fn erc20_approve(
&self,
token: Address,
spender: Address,
amount: U256,
) -> Result<TransactionResult>
pub async fn erc20_approve( &self, token: Address, spender: Address, amount: U256, ) -> Result<TransactionResult>
Approve ERC20 spending for the given spender.
Sourcepub async fn get_deposit_info(
&self,
delegator: Address,
token: Address,
) -> Result<DepositInfo>
pub async fn get_deposit_info( &self, delegator: Address, token: Address, ) -> Result<DepositInfo>
Fetch delegator deposit info for a token.
Sourcepub async fn get_locks(
&self,
delegator: Address,
token: Address,
) -> Result<Vec<LockInfo>>
pub async fn get_locks( &self, delegator: Address, token: Address, ) -> Result<Vec<LockInfo>>
Fetch lock info for a token.
Sourcepub async fn get_delegations(
&self,
delegator: Address,
) -> Result<Vec<DelegationInfo>>
pub async fn get_delegations( &self, delegator: Address, ) -> Result<Vec<DelegationInfo>>
Fetch delegations for a delegator.
Sourcepub async fn get_delegations_with_blueprints(
&self,
delegator: Address,
) -> Result<Vec<DelegationRecord>>
pub async fn get_delegations_with_blueprints( &self, delegator: Address, ) -> Result<Vec<DelegationRecord>>
Fetch delegations with blueprint selections attached.
Sourcepub async fn get_delegation_blueprints(
&self,
delegator: Address,
index: u64,
) -> Result<Vec<u64>>
pub async fn get_delegation_blueprints( &self, delegator: Address, index: u64, ) -> Result<Vec<u64>>
Fetch blueprint IDs for a fixed delegation.
Sourcepub async fn get_pending_unstakes(
&self,
delegator: Address,
) -> Result<Vec<PendingUnstake>>
pub async fn get_pending_unstakes( &self, delegator: Address, ) -> Result<Vec<PendingUnstake>>
Fetch pending delegator unstakes.
Sourcepub async fn get_pending_withdrawals(
&self,
delegator: Address,
) -> Result<Vec<PendingWithdrawal>>
pub async fn get_pending_withdrawals( &self, delegator: Address, ) -> Result<Vec<PendingWithdrawal>>
Fetch pending delegator withdrawals.
Sourcepub async fn deposit_and_delegate_with_options(
&self,
operator: Address,
token: Address,
amount: U256,
selection_mode: BlueprintSelectionMode,
blueprint_ids: Vec<u64>,
) -> Result<TransactionResult>
pub async fn deposit_and_delegate_with_options( &self, operator: Address, token: Address, amount: U256, selection_mode: BlueprintSelectionMode, blueprint_ids: Vec<u64>, ) -> Result<TransactionResult>
Deposit and delegate in a single call.
Sourcepub async fn delegate_with_options(
&self,
operator: Address,
token: Address,
amount: U256,
selection_mode: BlueprintSelectionMode,
blueprint_ids: Vec<u64>,
) -> Result<TransactionResult>
pub async fn delegate_with_options( &self, operator: Address, token: Address, amount: U256, selection_mode: BlueprintSelectionMode, blueprint_ids: Vec<u64>, ) -> Result<TransactionResult>
Delegate existing deposits with explicit selection.
Sourcepub async fn schedule_delegator_unstake(
&self,
operator: Address,
token: Address,
amount: U256,
) -> Result<TransactionResult>
pub async fn schedule_delegator_unstake( &self, operator: Address, token: Address, amount: U256, ) -> Result<TransactionResult>
Schedule a delegator unstake (bond-less).
Sourcepub async fn execute_delegator_unstake(&self) -> Result<TransactionResult>
pub async fn execute_delegator_unstake(&self) -> Result<TransactionResult>
Execute any matured delegator unstake requests.
Sourcepub async fn execute_delegator_unstake_and_withdraw(
&self,
operator: Address,
token: Address,
shares: U256,
requested_round: u64,
receiver: Address,
) -> Result<TransactionResult>
pub async fn execute_delegator_unstake_and_withdraw( &self, operator: Address, token: Address, shares: U256, requested_round: u64, receiver: Address, ) -> Result<TransactionResult>
Execute a specific delegator unstake and withdraw.
Sourcepub async fn schedule_withdraw(
&self,
token: Address,
amount: U256,
) -> Result<TransactionResult>
pub async fn schedule_withdraw( &self, token: Address, amount: U256, ) -> Result<TransactionResult>
Schedule a withdrawal for a token.
Sourcepub async fn execute_withdraw(&self) -> Result<TransactionResult>
pub async fn execute_withdraw(&self) -> Result<TransactionResult>
Execute any matured withdrawal requests.
Sourcepub async fn schedule_operator_unstake(
&self,
amount: U256,
) -> Result<TransactionResult>
pub async fn schedule_operator_unstake( &self, amount: U256, ) -> Result<TransactionResult>
Schedule an operator unstake.
Sourcepub async fn execute_operator_unstake(&self) -> Result<TransactionResult>
pub async fn execute_operator_unstake(&self) -> Result<TransactionResult>
Execute an operator unstake.
Sourcepub async fn start_leaving(&self) -> Result<TransactionResult>
pub async fn start_leaving(&self) -> Result<TransactionResult>
Start leaving the operator set.
Sourcepub async fn complete_leaving(&self) -> Result<TransactionResult>
pub async fn complete_leaving(&self) -> Result<TransactionResult>
Complete leaving after delay.
Sourcepub async fn operator_bond_token(&self) -> Result<Address>
pub async fn operator_bond_token(&self) -> Result<Address>
Get the operator bond token address.
Returns Address::ZERO if native ETH is used for operator bonds,
otherwise returns the ERC20 token address (e.g., TNT).
Sourcepub async fn register_operator_restaking(
&self,
stake_amount: U256,
) -> Result<TransactionResult>
pub async fn register_operator_restaking( &self, stake_amount: U256, ) -> Result<TransactionResult>
Register as an operator on the restaking layer.
Automatically uses the configured bond token (native ETH or ERC20 like TNT). For ERC20 tokens, automatically approves the staking contract first.
Sourcepub async fn increase_stake(&self, amount: U256) -> Result<TransactionResult>
pub async fn increase_stake(&self, amount: U256) -> Result<TransactionResult>
Increase operator stake.
Automatically uses the configured bond token (native ETH or ERC20 like TNT). For ERC20 tokens, automatically approves the staking contract first.
Sourcepub async fn deposit_native(&self, amount: U256) -> Result<TransactionResult>
pub async fn deposit_native(&self, amount: U256) -> Result<TransactionResult>
Deposit native ETH without delegating.
Use this to pre-fund your account before delegating.
Sourcepub async fn deposit_erc20(
&self,
token: Address,
amount: U256,
) -> Result<TransactionResult>
pub async fn deposit_erc20( &self, token: Address, amount: U256, ) -> Result<TransactionResult>
Deposit ERC20 tokens without delegating.
Use this to pre-fund your account before delegating.
Sourcepub async fn get_blueprint_manager(
&self,
service_id: u64,
) -> Result<Option<Address>>
pub async fn get_blueprint_manager( &self, service_id: u64, ) -> Result<Option<Address>>
Get the blueprint manager address for a service
Sourcepub async fn requires_aggregation(
&self,
service_id: u64,
job_index: u8,
) -> Result<bool>
pub async fn requires_aggregation( &self, service_id: u64, job_index: u8, ) -> Result<bool>
Check if a job requires BLS aggregation
Queries the blueprint’s service manager contract to determine if the specified job index requires aggregated BLS signatures instead of individual results.
Sourcepub async fn get_aggregation_threshold(
&self,
service_id: u64,
job_index: u8,
) -> Result<(u16, u8)>
pub async fn get_aggregation_threshold( &self, service_id: u64, job_index: u8, ) -> Result<(u16, u8)>
Get the aggregation threshold configuration for a job
Returns (threshold_bps, threshold_type) where:
- threshold_bps: Threshold in basis points (e.g., 6700 = 67%)
- threshold_type: 0 = CountBased (% of operators), 1 = StakeWeighted (% of stake)
Sourcepub async fn get_aggregation_config(
&self,
service_id: u64,
job_index: u8,
) -> Result<AggregationConfig>
pub async fn get_aggregation_config( &self, service_id: u64, job_index: u8, ) -> Result<AggregationConfig>
Get the aggregation configuration for a specific job
Returns the full aggregation config including whether it’s required and threshold settings
Sourcepub async fn submit_job(
&self,
service_id: u64,
job_index: u8,
inputs: Bytes,
) -> Result<JobSubmissionResult>
pub async fn submit_job( &self, service_id: u64, job_index: u8, inputs: Bytes, ) -> Result<JobSubmissionResult>
Submit a job invocation to the Tangle contract.
Sourcepub async fn submit_job_with_value(
&self,
service_id: u64,
job_index: u8,
inputs: Bytes,
value: U256,
) -> Result<JobSubmissionResult>
pub async fn submit_job_with_value( &self, service_id: u64, job_index: u8, inputs: Bytes, value: U256, ) -> Result<JobSubmissionResult>
Submit a job invocation with native token payment.
For EventDriven services the caller should send event_rate as value.
For free jobs or services that don’t charge per-event, pass U256::ZERO.
Sourcepub async fn submit_job_from_quote(
&self,
service_id: u64,
job_index: u8,
inputs: Bytes,
quotes: Vec<SignedJobQuote>,
) -> Result<JobSubmissionResult>
pub async fn submit_job_from_quote( &self, service_id: u64, job_index: u8, inputs: Bytes, quotes: Vec<SignedJobQuote>, ) -> Result<JobSubmissionResult>
Submit a job from operator-signed quotes with payment.
Calls the on-chain submitJobFromQuote function. The total quoted
price is sent as native value with the transaction.
Sourcepub async fn submit_result(
&self,
service_id: u64,
call_id: u64,
output: Bytes,
) -> Result<TransactionResult>
pub async fn submit_result( &self, service_id: u64, call_id: u64, output: Bytes, ) -> Result<TransactionResult>
Sourcepub async fn submit_aggregated_result(
&self,
service_id: u64,
call_id: u64,
output: Bytes,
signer_bitmap: U256,
aggregated_signature: [U256; 2],
aggregated_pubkey: [U256; 4],
) -> Result<TransactionResult>
pub async fn submit_aggregated_result( &self, service_id: u64, call_id: u64, output: Bytes, signer_bitmap: U256, aggregated_signature: [U256; 2], aggregated_pubkey: [U256; 4], ) -> Result<TransactionResult>
Submit an aggregated BLS signature result to the Tangle contract
This sends a signed transaction to submit an aggregated result with BLS signature.
§Arguments
service_id- The service IDcall_id- The call/job IDoutput- The encoded result outputsigner_bitmap- Bitmap indicating which operators signedaggregated_signature- The aggregated BLS signature [2]aggregated_pubkey- The aggregated BLS public key [4]
§Returns
The transaction hash and receipt on success
Source§impl TangleClient
Extension trait for service-related operations on TangleClient
impl TangleClient
Extension trait for service-related operations on TangleClient
Sourcepub async fn get_service_info(&self, service_id: u64) -> Result<ServiceInfo>
pub async fn get_service_info(&self, service_id: u64) -> Result<ServiceInfo>
Get full service information
Sourcepub async fn get_blueprint_info(
&self,
blueprint_id: u64,
) -> Result<BlueprintInfo>
pub async fn get_blueprint_info( &self, blueprint_id: u64, ) -> Result<BlueprintInfo>
Get full blueprint information
Sourcepub async fn get_blueprint_config_info(
&self,
blueprint_id: u64,
) -> Result<BlueprintConfig>
pub async fn get_blueprint_config_info( &self, blueprint_id: u64, ) -> Result<BlueprintConfig>
Get full blueprint configuration
Sourcepub async fn get_operator_services(&self, operator: Address) -> Result<Vec<u64>>
pub async fn get_operator_services(&self, operator: Address) -> Result<Vec<u64>>
Get services for an operator
Queries all services and filters for those where the operator is active
Sourcepub async fn is_registered_for_blueprint(&self) -> Result<bool>
pub async fn is_registered_for_blueprint(&self) -> Result<bool>
Check if current operator is registered for the configured blueprint
Sourcepub async fn is_operator_active_in_restaking(&self) -> Result<bool>
pub async fn is_operator_active_in_restaking(&self) -> Result<bool>
Check if current operator is active in the restaking system
Sourcepub async fn get_own_stake(&self) -> Result<U256>
pub async fn get_own_stake(&self) -> Result<U256>
Get current operator’s stake
Sourcepub async fn list_blueprints(&self) -> Result<Vec<(u64, BlueprintInfo)>>
pub async fn list_blueprints(&self) -> Result<Vec<(u64, BlueprintInfo)>>
Fetch all blueprint summaries.
Sourcepub async fn list_services(&self) -> Result<Vec<(u64, ServiceInfo)>>
pub async fn list_services(&self) -> Result<Vec<(u64, ServiceInfo)>>
Fetch all services registered on-chain.
Sourcepub async fn get_service_request_info(
&self,
request_id: u64,
) -> Result<ServiceRequestInfo>
pub async fn get_service_request_info( &self, request_id: u64, ) -> Result<ServiceRequestInfo>
Fetch a single service request.
Sourcepub async fn list_service_requests(&self) -> Result<Vec<ServiceRequestInfo>>
pub async fn list_service_requests(&self) -> Result<Vec<ServiceRequestInfo>>
List all service requests ever recorded on-chain.
Source§impl TangleClient
impl TangleClient
Sourcepub async fn get_service_operators_with_exposure(
&self,
service_id: u64,
) -> Result<Vec<OperatorSecurityCommitment>>
pub async fn get_service_operators_with_exposure( &self, service_id: u64, ) -> Result<Vec<OperatorSecurityCommitment>>
Get operators with their security commitments for a service
Trait Implementations§
Source§impl BlueprintServicesClient for TangleClient
impl BlueprintServicesClient for TangleClient
Source§async fn get_operators(
&self,
) -> Result<OperatorSet<Self::PublicAccountIdentity, Self::PublicApplicationIdentity>, Self::Error>
async fn get_operators( &self, ) -> Result<OperatorSet<Self::PublicAccountIdentity, Self::PublicApplicationIdentity>, Self::Error>
Get all operators for the current service with their ECDSA keys
Source§async fn operator_id(
&self,
) -> Result<Self::PublicApplicationIdentity, Self::Error>
async fn operator_id( &self, ) -> Result<Self::PublicApplicationIdentity, Self::Error>
Get the current operator’s ECDSA public key
Source§type PublicApplicationIdentity = [u8; 65]
type PublicApplicationIdentity = [u8; 65]
Source§type PublicAccountIdentity = Address
type PublicAccountIdentity = Address
PublicApplicationIdentity,
but may be cryptographically related thereto. E.g., AccountId32type Error = Error
Source§async fn get_operators_and_operator_id(
&self,
) -> Result<(BTreeMap<usize, Self::PublicApplicationIdentity>, usize), Self::Error>
async fn get_operators_and_operator_id( &self, ) -> Result<(BTreeMap<usize, Self::PublicApplicationIdentity>, usize), Self::Error>
Source§impl Clone for TangleClient
impl Clone for TangleClient
Source§fn clone(&self) -> TangleClient
fn clone(&self) -> TangleClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TangleClient
impl Debug for TangleClient
Source§impl EventsClient<TangleEvent> for TangleClient
impl EventsClient<TangleEvent> for TangleClient
Source§async fn next_event(&self) -> Option<TangleEvent>
async fn next_event(&self) -> Option<TangleEvent>
Source§async fn latest_event(&self) -> Option<TangleEvent>
async fn latest_event(&self) -> Option<TangleEvent>
Auto Trait Implementations§
impl Freeze for TangleClient
impl !RefUnwindSafe for TangleClient
impl Send for TangleClient
impl Sync for TangleClient
impl Unpin for TangleClient
impl UnsafeUnpin for TangleClient
impl !UnwindSafe for TangleClient
Blanket Implementations§
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more