pub struct ContractClient<Type> {
pub client: Client,
pub address: ContractAddress,
pub contract_name: Arc<OwnedContractName>,
pub schema: Arc<Option<VersionedModuleSchema>>,
/* private fields */
}Expand description
A contract client that handles some of the boilerplate such as serialization and parsing of responses when sending transactions, or invoking smart contracts.
Note that cloning is cheap and is, therefore, the intended way of sharing values of this type between multiple tasks.
Fields§
§client: ClientThe underlying network client.
address: ContractAddressThe address of the instance.
contract_name: Arc<OwnedContractName>The name of the contract at the address.
schema: Arc<Option<VersionedModuleSchema>>The schema of the contract at the address.
Implementations§
Source§impl<Type> ContractClient<Type>
impl<Type> ContractClient<Type>
Sourcepub async fn create(
client: Client,
address: ContractAddress,
) -> QueryResult<Self>
pub async fn create( client: Client, address: ContractAddress, ) -> QueryResult<Self>
Construct a ContractClient by looking up metadata from the chain
(such as the contract_name and the embedded schema).
§Arguments
client- The RPC client for the concordium node.address- The contract address of the smart contract instance.
Sourcepub fn new(
client: Client,
address: ContractAddress,
contract_name: OwnedContractName,
) -> Self
pub fn new( client: Client, address: ContractAddress, contract_name: OwnedContractName, ) -> Self
Construct a ContractClient locally. In comparison to
create this always succeeds and does not check
existence of the contract.
§Arguments
client- The RPC client for the concordium node. Note that cloningClientis cheap and is therefore the intended way of sharing.address- The contract address of the smart contract.contract_name- The name of the contract. This must match the name on the chain, otherwise the constructed client will not work.
Sourcepub fn new_with_schema(
client: Client,
address: ContractAddress,
contract_name: OwnedContractName,
schema: VersionedModuleSchema,
) -> Self
pub fn new_with_schema( client: Client, address: ContractAddress, contract_name: OwnedContractName, schema: VersionedModuleSchema, ) -> Self
Construct a ContractClient locally. In comparison to
create this always succeeds and does not check
existence of the contract and does not look up metadata from the chain
(such as embedded schemas). In comparison to
new this constructor also takes a versioned module
schema.
§Arguments
client- The RPC client for the concordium node. Note that cloningClientis cheap and is therefore the intended way of sharing.address- The contract address of the smart contract.contract_name- The name of the contract. This must match the name on the chain, otherwise the constructed client will not work.schema- A versioned module schema of the contract. It is used by the client to decode the error codes in rejected transactions.
Sourcepub async fn view<P: Serial, A: Deserial, E>(
&mut self,
entrypoint: &str,
parameter: &P,
bi: impl IntoBlockIdentifier,
) -> Result<A, E>where
E: From<NewReceiveNameError> + From<RejectReason> + From<ParseError> + From<QueryError> + From<ExceedsParameterSize>,
pub async fn view<P: Serial, A: Deserial, E>(
&mut self,
entrypoint: &str,
parameter: &P,
bi: impl IntoBlockIdentifier,
) -> Result<A, E>where
E: From<NewReceiveNameError> + From<RejectReason> + From<ParseError> + From<QueryError> + From<ExceedsParameterSize>,
Invoke a contract and return the response.
This will always fail for a V0 contract, and for V1 contracts it will
attempt to deserialize the response into the provided type A.
The error E is left generic in order to support specialized errors
such as CIS2 or CIS4 specific errors for more specialized view functions
defined by those standards.
For a general contract ViewError can be used as a concrete error
type E.
Sourcepub async fn view_raw<A: Deserial, E>(
&mut self,
entrypoint: &str,
parameter: OwnedParameter,
bi: impl IntoBlockIdentifier,
) -> Result<A, E>
pub async fn view_raw<A: Deserial, E>( &mut self, entrypoint: &str, parameter: OwnedParameter, bi: impl IntoBlockIdentifier, ) -> Result<A, E>
Like view but expects an already serialized parameter.
Sourcepub async fn invoke_raw<E>(
&mut self,
entrypoint: &str,
amount: Amount,
invoker: Option<Address>,
parameter: OwnedParameter,
bi: impl IntoBlockIdentifier,
) -> Result<InvokeContractResult, E>
pub async fn invoke_raw<E>( &mut self, entrypoint: &str, amount: Amount, invoker: Option<Address>, parameter: OwnedParameter, bi: impl IntoBlockIdentifier, ) -> Result<InvokeContractResult, E>
Invoke a contract instance and return the response without any processing.
Sourcepub async fn dry_run_update<P: Serial, E>(
&mut self,
entrypoint: &str,
amount: Amount,
sender: AccountAddress,
message: &P,
) -> Result<ContractUpdateBuilder, E>where
E: From<NewReceiveNameError> + From<RejectReason> + From<QueryError> + From<ExceedsParameterSize>,
pub async fn dry_run_update<P: Serial, E>(
&mut self,
entrypoint: &str,
amount: Amount,
sender: AccountAddress,
message: &P,
) -> Result<ContractUpdateBuilder, E>where
E: From<NewReceiveNameError> + From<RejectReason> + From<QueryError> + From<ExceedsParameterSize>,
Dry run an update. If the dry run succeeds the return value is an object that has a send method to send the transaction that was simulated during the dry run.
The arguments are
entrypointthe name of the entrypoint to be invoked. Note that this is just the entrypoint name without the contract name.amountthe amount of CCD to send to the contract instancesenderthe account that will be sending the transactionmessagethe parameter to the smart contract entrypoint.
Sourcepub async fn dry_run_update_with_reject_reason_info<P: Serial, E>(
&mut self,
entrypoint: &str,
amount: Amount,
sender: AccountAddress,
message: &P,
) -> Result<InvokeContractOutcome, E>
pub async fn dry_run_update_with_reject_reason_info<P: Serial, E>( &mut self, entrypoint: &str, amount: Amount, sender: AccountAddress, message: &P, ) -> Result<InvokeContractOutcome, E>
Dry run an update. In comparison to
dry_run_update this function does not throw an
error when the transaction reverts and instead tries to decode the
reject reason into a human-readable error. If the dry run succeeds the
return value is an object that has a send method to send the
transaction that was simulated during the dry run.
The arguments are
entrypointthe name of the entrypoint to be invoked. Note that this is just the entrypoint name without the contract name.amountthe amount of CCD to send to the contract instancesenderthe account that will be sending the transactionmessagethe parameter to the smart contract entrypoint.
Sourcepub async fn dry_run_update_raw<E>(
&mut self,
entrypoint: &str,
amount: Amount,
sender: AccountAddress,
message: OwnedParameter,
) -> Result<ContractUpdateBuilder, E>
pub async fn dry_run_update_raw<E>( &mut self, entrypoint: &str, amount: Amount, sender: AccountAddress, message: OwnedParameter, ) -> Result<ContractUpdateBuilder, E>
Like dry_run_update but expects an already
formed parameter.
Sourcepub async fn dry_run_update_raw_with_reject_reason_info<E>(
&mut self,
entrypoint: &str,
amount: Amount,
sender: AccountAddress,
message: OwnedParameter,
) -> Result<InvokeContractOutcome, E>
pub async fn dry_run_update_raw_with_reject_reason_info<E>( &mut self, entrypoint: &str, amount: Amount, sender: AccountAddress, message: OwnedParameter, ) -> Result<InvokeContractOutcome, E>
Like dry_run_update_with_reject_reason_info but expects an already
formed parameter.
Sourcepub fn make_update<P: Serial, E>(
&self,
signer: &impl ExactSizeTransactionSigner,
metadata: &ContractTransactionMetadata,
entrypoint: &str,
message: &P,
) -> Result<AccountTransaction<EncodedPayload>, E>
pub fn make_update<P: Serial, E>( &self, signer: &impl ExactSizeTransactionSigner, metadata: &ContractTransactionMetadata, entrypoint: &str, message: &P, ) -> Result<AccountTransaction<EncodedPayload>, E>
Make the payload of a contract update with the specified parameter.
Sourcepub async fn update<P: Serial, E>(
&mut self,
signer: &impl ExactSizeTransactionSigner,
metadata: &ContractTransactionMetadata,
entrypoint: &str,
message: &P,
) -> Result<TransactionHash, E>
pub async fn update<P: Serial, E>( &mut self, signer: &impl ExactSizeTransactionSigner, metadata: &ContractTransactionMetadata, entrypoint: &str, message: &P, ) -> Result<TransactionHash, E>
Make and send a transaction with the specified parameter.
Sourcepub async fn update_raw<E>(
&mut self,
signer: &impl ExactSizeTransactionSigner,
metadata: &ContractTransactionMetadata,
entrypoint: &str,
message: OwnedParameter,
) -> Result<TransactionHash, E>
pub async fn update_raw<E>( &mut self, signer: &impl ExactSizeTransactionSigner, metadata: &ContractTransactionMetadata, entrypoint: &str, message: OwnedParameter, ) -> Result<TransactionHash, E>
Like update but expects a serialized parameter.
Sourcepub fn make_update_raw<E>(
&self,
signer: &impl ExactSizeTransactionSigner,
metadata: &ContractTransactionMetadata,
entrypoint: &str,
message: OwnedParameter,
) -> Result<AccountTransaction<EncodedPayload>, E>where
E: From<NewReceiveNameError>,
pub fn make_update_raw<E>(
&self,
signer: &impl ExactSizeTransactionSigner,
metadata: &ContractTransactionMetadata,
entrypoint: &str,
message: OwnedParameter,
) -> Result<AccountTransaction<EncodedPayload>, E>where
E: From<NewReceiveNameError>,
Like make_update but expects a serialized
parameter.
Source§impl ContractClient<Cis2Type>
impl ContractClient<Cis2Type>
Sourcepub async fn transfer_dry_run(
&mut self,
bi: impl IntoBlockIdentifier,
sender: Address,
transfers: Vec<Transfer>,
) -> Result<Energy, Cis2DryRunError>
pub async fn transfer_dry_run( &mut self, bi: impl IntoBlockIdentifier, sender: Address, transfers: Vec<Transfer>, ) -> Result<Energy, Cis2DryRunError>
Like transfer except it only dry-runs the
transaction to get the response and, in case of success, amount of
energy used for execution.
§Arguments
bi- The block to dry-run at. The invocation happens at the end of the specified block.sender- The address that is invoking the entrypoint.transfers- A list of CIS2 token transfers to execute.
Sourcepub async fn transfer_single_dry_run(
&mut self,
bi: impl IntoBlockIdentifier,
sender: Address,
transfer: Transfer,
) -> Result<Energy, Cis2DryRunError>
pub async fn transfer_single_dry_run( &mut self, bi: impl IntoBlockIdentifier, sender: Address, transfer: Transfer, ) -> Result<Energy, Cis2DryRunError>
Like transfer_dry_run except it is more
ergonomic when only a single transfer is to be made.
Sourcepub async fn transfer(
&mut self,
signer: &impl ExactSizeTransactionSigner,
transaction_metadata: Cis2TransactionMetadata,
transfers: Vec<Transfer>,
) -> Result<TransactionHash, Cis2TransactionError>
pub async fn transfer( &mut self, signer: &impl ExactSizeTransactionSigner, transaction_metadata: Cis2TransactionMetadata, transfers: Vec<Transfer>, ) -> Result<TransactionHash, Cis2TransactionError>
Construct and send a CIS2 transfer smart contract update transaction given a list of CIS2 transfers. Returns a Result with the transaction hash.
§Arguments
signer- The account keys to use for signing the smart contract update transaction.transaction_metadata- Metadata for constructing the transaction.transfers- A list of CIS2 token transfers to execute.
Sourcepub fn make_transfer(
&self,
signer: &impl ExactSizeTransactionSigner,
transaction_metadata: Cis2TransactionMetadata,
transfers: Vec<Transfer>,
) -> Result<AccountTransaction<EncodedPayload>, Cis2TransactionError>
pub fn make_transfer( &self, signer: &impl ExactSizeTransactionSigner, transaction_metadata: Cis2TransactionMetadata, transfers: Vec<Transfer>, ) -> Result<AccountTransaction<EncodedPayload>, Cis2TransactionError>
Construct a CIS2 transfer smart contract update transaction
given a list of CIS2 transfers. Returns a Result with an account
transaction that can be sent.
§Arguments
signer- The account keys to use for signing the smart contract update transaction.transaction_metadata- Metadata for constructing the transaction.transfers- A list of CIS2 token transfers to execute.
Sourcepub async fn transfer_single(
&mut self,
signer: &impl ExactSizeTransactionSigner,
transaction_metadata: Cis2TransactionMetadata,
transfer: Transfer,
) -> Result<TransactionHash, Cis2TransactionError>
pub async fn transfer_single( &mut self, signer: &impl ExactSizeTransactionSigner, transaction_metadata: Cis2TransactionMetadata, transfer: Transfer, ) -> Result<TransactionHash, Cis2TransactionError>
Like transfer, except it is more ergonomic
when transferring a single token.
Sourcepub fn make_transfer_single(
&self,
signer: &impl ExactSizeTransactionSigner,
transaction_metadata: Cis2TransactionMetadata,
transfer: Transfer,
) -> Result<AccountTransaction<EncodedPayload>, Cis2TransactionError>
pub fn make_transfer_single( &self, signer: &impl ExactSizeTransactionSigner, transaction_metadata: Cis2TransactionMetadata, transfer: Transfer, ) -> Result<AccountTransaction<EncodedPayload>, Cis2TransactionError>
Like make_transfer, except it is more ergonomic
when transferring a single token.
Sourcepub async fn update_operator_dry_run(
&mut self,
bi: impl IntoBlockIdentifier,
owner: Address,
updates: Vec<UpdateOperator>,
) -> Result<Energy, Cis2DryRunError>
pub async fn update_operator_dry_run( &mut self, bi: impl IntoBlockIdentifier, owner: Address, updates: Vec<UpdateOperator>, ) -> Result<Energy, Cis2DryRunError>
Dry run a CIS2 updateOperator transaction. This is analogous to
update_operator, except that it does not send
a transaction to the chain, and just simulates the transaction.
§Arguments
bi- The block to dry-run at. The invocation happens at the end ofowner- The address that is invoking. This is the owner of the tokens.updates- A list of CIS2 UpdateOperators to update.
Sourcepub async fn update_operator_single_dry_run(
&mut self,
bi: impl IntoBlockIdentifier,
owner: Address,
operator: Address,
update: OperatorUpdate,
) -> Result<Energy, Cis2DryRunError>
pub async fn update_operator_single_dry_run( &mut self, bi: impl IntoBlockIdentifier, owner: Address, operator: Address, update: OperatorUpdate, ) -> Result<Energy, Cis2DryRunError>
Like update_operator_dry_run except
more ergonomic when a single operator is to be updated.
Sourcepub fn make_update_operator(
&self,
signer: &impl ExactSizeTransactionSigner,
transaction_metadata: Cis2TransactionMetadata,
updates: Vec<UpdateOperator>,
) -> Result<AccountTransaction<EncodedPayload>, Cis2TransactionError>
pub fn make_update_operator( &self, signer: &impl ExactSizeTransactionSigner, transaction_metadata: Cis2TransactionMetadata, updates: Vec<UpdateOperator>, ) -> Result<AccountTransaction<EncodedPayload>, Cis2TransactionError>
Construct a CIS2 updateOperator smart contract update
transaction given a list of CIS2 UpdateOperators. Returns a Result
with the account transaction that can be sent.
§Arguments
signer- The account keys to use for signing the smart contract update transaction.transaction_metadata- Metadata for constructing the transaction.updates- A list of CIS2 UpdateOperators to update.
Sourcepub async fn update_operator(
&mut self,
signer: &impl ExactSizeTransactionSigner,
transaction_metadata: Cis2TransactionMetadata,
updates: Vec<UpdateOperator>,
) -> Result<TransactionHash, Cis2TransactionError>
pub async fn update_operator( &mut self, signer: &impl ExactSizeTransactionSigner, transaction_metadata: Cis2TransactionMetadata, updates: Vec<UpdateOperator>, ) -> Result<TransactionHash, Cis2TransactionError>
Construct and send a CIS2 updateOperator smart contract update transaction given a list of CIS2 UpdateOperators. Returns a Result with the transaction hash.
§Arguments
signer- The account keys to use for signing the smart contract update transaction.transaction_metadata- Metadata for constructing the transaction.updates- A list of CIS2 UpdateOperators to update.
Sourcepub async fn update_operator_single(
&mut self,
signer: &impl ExactSizeTransactionSigner,
transaction_metadata: Cis2TransactionMetadata,
operator: Address,
update: OperatorUpdate,
) -> Result<TransactionHash, Cis2TransactionError>
pub async fn update_operator_single( &mut self, signer: &impl ExactSizeTransactionSigner, transaction_metadata: Cis2TransactionMetadata, operator: Address, update: OperatorUpdate, ) -> Result<TransactionHash, Cis2TransactionError>
Like update_operator, but more ergonomic
when updating a single operator.
Sourcepub fn make_update_operator_single(
&self,
signer: &impl ExactSizeTransactionSigner,
transaction_metadata: Cis2TransactionMetadata,
operator: Address,
update: OperatorUpdate,
) -> Result<AccountTransaction<EncodedPayload>, Cis2TransactionError>
pub fn make_update_operator_single( &self, signer: &impl ExactSizeTransactionSigner, transaction_metadata: Cis2TransactionMetadata, operator: Address, update: OperatorUpdate, ) -> Result<AccountTransaction<EncodedPayload>, Cis2TransactionError>
Like make_update_operator, but more
ergonomic when updating a single operator.
Sourcepub async fn balance_of(
&mut self,
bi: impl IntoBlockIdentifier,
queries: Vec<BalanceOfQuery>,
) -> Result<BalanceOfQueryResponse, Cis2QueryError>
pub async fn balance_of( &mut self, bi: impl IntoBlockIdentifier, queries: Vec<BalanceOfQuery>, ) -> Result<BalanceOfQueryResponse, Cis2QueryError>
Invoke the CIS2 balanceOf query given a list of BalanceOfQuery.
Note: the query is executed locally by the node and does not produce a transaction on-chain.
§Arguments
bi- The block to query. The query will be executed in the state of the chain at the end of the block.queries- A list queries to execute.
Sourcepub async fn balance_of_single(
&mut self,
bi: impl IntoBlockIdentifier,
token_id: TokenId,
address: Address,
) -> Result<TokenAmount, Cis2QueryError>
pub async fn balance_of_single( &mut self, bi: impl IntoBlockIdentifier, token_id: TokenId, address: Address, ) -> Result<TokenAmount, Cis2QueryError>
Like balance_of, except for querying a single
token. This additionally ensures that the response has correct
length.
Sourcepub async fn operator_of(
&mut self,
bi: impl IntoBlockIdentifier,
queries: Vec<OperatorOfQuery>,
) -> Result<OperatorOfQueryResponse, Cis2QueryError>
pub async fn operator_of( &mut self, bi: impl IntoBlockIdentifier, queries: Vec<OperatorOfQuery>, ) -> Result<OperatorOfQueryResponse, Cis2QueryError>
Invoke the CIS2 operatorOf query given a list of OperatorOfQuery.
Note: the query is executed locally by the node and does not produce a transaction on-chain.
§Arguments
bi- The block to query. The query will be executed in the state of the chain at the end of the block.queries- A list queries to execute.
Sourcepub async fn operator_of_single(
&mut self,
bi: impl IntoBlockIdentifier,
owner: Address,
operator: Address,
) -> Result<bool, Cis2QueryError>
pub async fn operator_of_single( &mut self, bi: impl IntoBlockIdentifier, owner: Address, operator: Address, ) -> Result<bool, Cis2QueryError>
Like operator_of, except for querying a single
owner-address pair. This additionally ensures that the response
has correct length.
Sourcepub async fn token_metadata(
&mut self,
bi: impl IntoBlockIdentifier,
queries: Vec<TokenId>,
) -> Result<TokenMetadataQueryResponse, Cis2QueryError>
pub async fn token_metadata( &mut self, bi: impl IntoBlockIdentifier, queries: Vec<TokenId>, ) -> Result<TokenMetadataQueryResponse, Cis2QueryError>
Invoke the CIS2 tokenMetadata query given a list of CIS2 TokenIds.
Note: the query is executed locally by the node and does not produce a transaction on-chain.
§Arguments
bi- The block to query. The query will be executed in the state of the chain at the end of the block.queries- A list queries to execute.
Sourcepub async fn token_metadata_single(
&mut self,
bi: impl IntoBlockIdentifier,
token_id: TokenId,
) -> Result<MetadataUrl, Cis2QueryError>
pub async fn token_metadata_single( &mut self, bi: impl IntoBlockIdentifier, token_id: TokenId, ) -> Result<MetadataUrl, Cis2QueryError>
Like token_metadata, except for querying a
single token. This additionally ensures that the response has
correct length.
Source§impl ContractClient<Cis3Type>
impl ContractClient<Cis3Type>
Sourcepub async fn permit_dry_run(
&mut self,
bi: impl IntoBlockIdentifier,
sender: Address,
params: PermitParams,
) -> Result<Energy, Cis3PermitDryRunError>
pub async fn permit_dry_run( &mut self, bi: impl IntoBlockIdentifier, sender: Address, params: PermitParams, ) -> Result<Energy, Cis3PermitDryRunError>
Like permit except it only dry-runs the transaction
to get the response and, in case of success, amount of energy used
for execution.
§Arguments
bi- The block to query. The query will be executed in the state of the chain at the end of the block.sender- The (sponsor) address that is invoking the entrypoint.params- The parameters for the permit invocation. Includes the signature of the sponsoree, the address of the sponsoree, and the signed message.
Sourcepub async fn permit(
&mut self,
signer: &impl ExactSizeTransactionSigner,
metadata: &ContractTransactionMetadata,
params: PermitParams,
) -> Result<TransactionHash, Cis3PermitError>
pub async fn permit( &mut self, signer: &impl ExactSizeTransactionSigner, metadata: &ContractTransactionMetadata, params: PermitParams, ) -> Result<TransactionHash, Cis3PermitError>
Construct and send a CIS3 sponsored transaction. This function takes
a signature from the sponsoree along with their account address, and
the signed message to be executed by the contract. Returns a Result
with the transaction hash.
§Arguments
signer- The account keys (of the sponsor) to use for signing the smart contract update transaction.metadata- Metadata for constructing the transaction.params- The parameters for the permit invocation. Includes the signature of the sponsoree, the address of the sponsoree, and the signed message.
Sourcepub fn make_permit(
&mut self,
signer: &impl ExactSizeTransactionSigner,
metadata: &ContractTransactionMetadata,
params: PermitParams,
) -> Result<AccountTransaction<EncodedPayload>, Cis3PermitError>
pub fn make_permit( &mut self, signer: &impl ExactSizeTransactionSigner, metadata: &ContractTransactionMetadata, params: PermitParams, ) -> Result<AccountTransaction<EncodedPayload>, Cis3PermitError>
Construct a CIS3 sponsored transaction. This function takes a signature
from the sponsoree along with their account address, and the signed
message to be executed by the contract. Returns a Result with the
transaction hash.
§Arguments
signer- The account keys (of the sponsor) to use for signing the smart contract update transaction.metadata- Metadata for constructing the transaction.params- The parameters for the permit invocation. Includes the signature of the sponsoree, the address of the sponsoree, and the signed message.
Sourcepub async fn supports_permit(
&mut self,
bi: impl IntoBlockIdentifier,
entrypoints: Vec<OwnedEntrypointName>,
) -> Result<SupportsPermitRepsonse, Cis3SupportsPermitError>
pub async fn supports_permit( &mut self, bi: impl IntoBlockIdentifier, entrypoints: Vec<OwnedEntrypointName>, ) -> Result<SupportsPermitRepsonse, Cis3SupportsPermitError>
Invoke the CIS3 supportsPermit query given a list of entrypoints to
query.
Note: the query is executed locally by the node and does not produce a transaction on-chain.
§Arguments
bi- The block to query. The query will be executed in the state of the chain at the end of the block.entrypoints- A list queries to execute.
Sourcepub async fn supports_permit_single(
&mut self,
bi: impl IntoBlockIdentifier,
entrypoint: OwnedEntrypointName,
) -> Result<bool, Cis3SupportsPermitError>
pub async fn supports_permit_single( &mut self, bi: impl IntoBlockIdentifier, entrypoint: OwnedEntrypointName, ) -> Result<bool, Cis3SupportsPermitError>
Like supports_permit, but only queries a
single entrypoint, and returns a bool indicating whether the entrypoint
is supported.
Source§impl ContractClient<Cis4Type>
impl ContractClient<Cis4Type>
Sourcepub async fn credential_entry(
&mut self,
cred_id: CredentialHolderId,
bi: impl IntoBlockIdentifier,
) -> Result<CredentialEntry, Cis4QueryError>
pub async fn credential_entry( &mut self, cred_id: CredentialHolderId, bi: impl IntoBlockIdentifier, ) -> Result<CredentialEntry, Cis4QueryError>
Look up an entry in the registry by its id.
Sourcepub async fn credential_status(
&mut self,
cred_id: CredentialHolderId,
bi: impl IntoBlockIdentifier,
) -> Result<CredentialStatus, Cis4QueryError>
pub async fn credential_status( &mut self, cred_id: CredentialHolderId, bi: impl IntoBlockIdentifier, ) -> Result<CredentialStatus, Cis4QueryError>
Look up the status of a credential by its id.
Sourcepub async fn revocation_keys(
&mut self,
bi: impl IntoBlockIdentifier,
) -> Result<Vec<RevocationKeyWithNonce>, Cis4QueryError>
pub async fn revocation_keys( &mut self, bi: impl IntoBlockIdentifier, ) -> Result<Vec<RevocationKeyWithNonce>, Cis4QueryError>
Get the list of all the revocation keys together with their nonces.
Sourcepub async fn registry_metadata(
&mut self,
bi: impl IntoBlockIdentifier,
) -> Result<RegistryMetadata, Cis4QueryError>
pub async fn registry_metadata( &mut self, bi: impl IntoBlockIdentifier, ) -> Result<RegistryMetadata, Cis4QueryError>
Look up the credential registry’s metadata.
Sourcepub async fn issuer(
&mut self,
bi: impl IntoBlockIdentifier,
) -> Result<IssuerKey, Cis4QueryError>
pub async fn issuer( &mut self, bi: impl IntoBlockIdentifier, ) -> Result<IssuerKey, Cis4QueryError>
Look up the issuer’s public key.
Sourcepub fn make_register_credential(
&self,
signer: &impl ExactSizeTransactionSigner,
metadata: &Cis4TransactionMetadata,
cred_info: &CredentialInfo,
additional_data: &[u8],
) -> Result<AccountTransaction<EncodedPayload>, Cis4TransactionError>
pub fn make_register_credential( &self, signer: &impl ExactSizeTransactionSigner, metadata: &Cis4TransactionMetadata, cred_info: &CredentialInfo, additional_data: &[u8], ) -> Result<AccountTransaction<EncodedPayload>, Cis4TransactionError>
Construct a transaction for registering a new credential. Note that this does not send the transaction.c
Sourcepub async fn register_credential(
&mut self,
signer: &impl ExactSizeTransactionSigner,
metadata: &Cis4TransactionMetadata,
cred_info: &CredentialInfo,
additional_data: &[u8],
) -> Result<TransactionHash, Cis4TransactionError>
pub async fn register_credential( &mut self, signer: &impl ExactSizeTransactionSigner, metadata: &Cis4TransactionMetadata, cred_info: &CredentialInfo, additional_data: &[u8], ) -> Result<TransactionHash, Cis4TransactionError>
Register a new credential.
Sourcepub fn make_revoke_credential_as_issuer(
&self,
signer: &impl ExactSizeTransactionSigner,
metadata: &Cis4TransactionMetadata,
cred_id: CredentialHolderId,
reason: Option<Reason>,
) -> Result<AccountTransaction<EncodedPayload>, Cis4TransactionError>
pub fn make_revoke_credential_as_issuer( &self, signer: &impl ExactSizeTransactionSigner, metadata: &Cis4TransactionMetadata, cred_id: CredentialHolderId, reason: Option<Reason>, ) -> Result<AccountTransaction<EncodedPayload>, Cis4TransactionError>
Construct a transaction to revoke a credential as an issuer.
Sourcepub async fn revoke_credential_as_issuer(
&mut self,
signer: &impl ExactSizeTransactionSigner,
metadata: &Cis4TransactionMetadata,
cred_id: CredentialHolderId,
reason: Option<Reason>,
) -> Result<TransactionHash, Cis4TransactionError>
pub async fn revoke_credential_as_issuer( &mut self, signer: &impl ExactSizeTransactionSigner, metadata: &Cis4TransactionMetadata, cred_id: CredentialHolderId, reason: Option<Reason>, ) -> Result<TransactionHash, Cis4TransactionError>
Revoke a credential as an issuer.
Sourcepub async fn revoke_credential_as_holder(
&mut self,
signer: &impl ExactSizeTransactionSigner,
metadata: &Cis4TransactionMetadata,
web3signer: impl Web3IdSigner,
nonce: u64,
reason: Option<Reason>,
) -> Result<TransactionHash, Cis4TransactionError>
pub async fn revoke_credential_as_holder( &mut self, signer: &impl ExactSizeTransactionSigner, metadata: &Cis4TransactionMetadata, web3signer: impl Web3IdSigner, nonce: u64, reason: Option<Reason>, ) -> Result<TransactionHash, Cis4TransactionError>
Revoke a credential as the holder.
The extra nonce that must be provided is the holder’s nonce inside the contract. The signature on this revocation message is set to expire at the same time as the transaction.
Sourcepub fn make_revoke_credential_as_holder(
&self,
signer: &impl ExactSizeTransactionSigner,
metadata: &Cis4TransactionMetadata,
web3signer: impl Web3IdSigner,
nonce: u64,
reason: Option<Reason>,
) -> Result<AccountTransaction<EncodedPayload>, Cis4TransactionError>
pub fn make_revoke_credential_as_holder( &self, signer: &impl ExactSizeTransactionSigner, metadata: &Cis4TransactionMetadata, web3signer: impl Web3IdSigner, nonce: u64, reason: Option<Reason>, ) -> Result<AccountTransaction<EncodedPayload>, Cis4TransactionError>
Revoke a credential as the holder.
The extra nonce that must be provided is the holder’s nonce inside the contract. The signature on this revocation message is set to expire at the same time as the transaction.
Sourcepub async fn revoke_credential_other(
&mut self,
signer: &impl ExactSizeTransactionSigner,
metadata: &Cis4TransactionMetadata,
revoker: impl Web3IdSigner,
nonce: u64,
cred_id: CredentialHolderId,
reason: Option<&Reason>,
) -> Result<TransactionHash, Cis4TransactionError>
pub async fn revoke_credential_other( &mut self, signer: &impl ExactSizeTransactionSigner, metadata: &Cis4TransactionMetadata, revoker: impl Web3IdSigner, nonce: u64, cred_id: CredentialHolderId, reason: Option<&Reason>, ) -> Result<TransactionHash, Cis4TransactionError>
Revoke a credential as another party, distinct from issuer or holder.
The extra nonce that must be provided is the nonce associated with the key that signs the revocation message. The signature on this revocation message is set to expire at the same time as the transaction.
Sourcepub fn make_revoke_credential_other(
&self,
signer: &impl ExactSizeTransactionSigner,
metadata: &Cis4TransactionMetadata,
revoker: impl Web3IdSigner,
nonce: u64,
cred_id: CredentialHolderId,
reason: Option<&Reason>,
) -> Result<AccountTransaction<EncodedPayload>, Cis4TransactionError>
pub fn make_revoke_credential_other( &self, signer: &impl ExactSizeTransactionSigner, metadata: &Cis4TransactionMetadata, revoker: impl Web3IdSigner, nonce: u64, cred_id: CredentialHolderId, reason: Option<&Reason>, ) -> Result<AccountTransaction<EncodedPayload>, Cis4TransactionError>
Construct a transaction to revoke a credential as another party, distinct from issuer or holder.
The extra nonce that must be provided is the nonce associated with the key that signs the revocation message. The signature on this revocation message is set to expire at the same time as the transaction.
Trait Implementations§
Source§impl<Type> Clone for ContractClient<Type>
impl<Type> Clone for ContractClient<Type>
Auto Trait Implementations§
impl<Type> !Freeze for ContractClient<Type>
impl<Type> !RefUnwindSafe for ContractClient<Type>
impl<Type> Send for ContractClient<Type>where
Type: Send,
impl<Type> Sync for ContractClient<Type>where
Type: Sync,
impl<Type> Unpin for ContractClient<Type>where
Type: Unpin,
impl<Type> !UnwindSafe for ContractClient<Type>
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> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.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> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.