import { CISContract, ContractDryRun, ContractTransactionMetadata, ContractUpdateTransactionWithSchema, CreateContractTransactionMetadata } from '../GenericContract.js'; import { ConcordiumGRPCClient } from '../grpc/GRPCClient.js'; import { AccountSigner } from '../signHelpers.js'; import type { HexString, InvokeContractResult } from '../types.js'; import * as AccountAddress from '../types/AccountAddress.js'; import * as BlockHash from '../types/BlockHash.js'; import * as ContractAddress from '../types/ContractAddress.js'; import * as ContractName from '../types/ContractName.js'; import * as TransactionHash from '../types/TransactionHash.js'; import { CIS4, Web3IdSigner } from './util.js'; type Views = 'credentialEntry' | 'credentialStatus' | 'issuer' | 'registryMetadata' | 'revocationKeys'; type Updates = 'registerCredential' | 'revokeCredentialIssuer' | 'revokeCredentialHolder' | 'revokeCredentialOther' | 'registerRevocationKeys' | 'removeRevocationKeys'; /** * Defines methods for performing dry-run invocations of CIS4 contract updates. * Is accessible throught the `dryRun` property of a `CIS4Contract` instance. */ declare class CIS4DryRun extends ContractDryRun { /** * Performs a dry-run invocation of "CIS4.registerCredential" * * @param {AccountAddress.Type | ContractAddress.Type} sender - Address of the sender of the transfer. * @param {CIS4.CredentialInfo} credInfo - the credential info to register * @param {HexString} [additionalData] - any additional data to include * @param {BlockHash.Type} [blockHash] - The hash of the block to perform the invocation of. Defaults to the latest finalized block on chain. * * @returns {InvokeContractResult} the contract invocation result, which includes whether or not the invocation succeeded along with the energy spent. */ registerCredential(sender: AccountAddress.Type | ContractAddress.Type, credInfo: CIS4.CredentialInfo, additionalData?: HexString, blockHash?: BlockHash.Type): Promise; /** * Performs a dry-run invocation of "CIS4.revokeCredentialIssuer" * * @param {AccountAddress.Type | ContractAddress.Type} sender - Address of the sender of the transfer. * @param {HexString} credHolderPubKey - the public key of the credential holder (hex encoded) * @param {string} [reason] - the reason for the revocation * @param {HexString} [additionalData] - any additional data to include * @param {BlockHash.Type} [blockHash] - The hash of the block to perform the invocation of. Defaults to the latest finalized block on chain. * * @returns {InvokeContractResult} the contract invocation result, which includes whether or not the invocation succeeded along with the energy spent. */ revokeCredentialAsIssuer(sender: AccountAddress.Type | ContractAddress.Type, credHolderPubKey: HexString, reason?: string, additionalData?: HexString, blockHash?: BlockHash.Type): Promise; /** * Performs a dry-run invocation of "CIS4.revokeCredentialHolder" * * @param {AccountAddress.Type | ContractAddress.Type} sender - Address of the sender of the transfer. * @param {Web3IdSigner} credHolderSigner - A signer structure for the credential holder * @param {bigint} nonce - the nonce of the owner inside the contract * @param {Date} expiry - Expiry time of the revocation message * @param {string} [reason] - the reason for the revocation * @param {BlockHash.Type} [blockHash] - The hash of the block to perform the invocation of. Defaults to the latest finalized block on chain. * * @returns {InvokeContractResult} the contract invocation result, which includes whether or not the invocation succeeded along with the energy spent. */ revokeCredentialAsHolder(sender: AccountAddress.Type | ContractAddress.Type, credHolderSigner: Web3IdSigner, nonce: bigint, expiry: Date, reason?: string, blockHash?: BlockHash.Type): Promise; /** * Performs a dry-run invocation of "CIS4.revokeCredentialOther" * * @param {AccountAddress.Type | ContractAddress.Type} sender - Address of the sender of the transfer. * @param {Web3IdSigner} revokerSigner - A signer structure for the credential holder * @param {HexString} credentialPubKey - the public key (hex encoded) for the credential to revoke * @param {bigint} nonce - the nonce of the owner inside the contract * @param {Date} expiry - Expiry time of the revocation message * @param {string} [reason] - the reason for the revocation * @param {BlockHash.Type} [blockHash] - The hash of the block to perform the invocation of. Defaults to the latest finalized block on chain. * * @returns {InvokeContractResult} the contract invocation result, which includes whether or not the invocation succeeded along with the energy spent. */ revokeCredentialAsOther(sender: AccountAddress.Type | ContractAddress.Type, revokerSigner: Web3IdSigner, credentialPubKey: HexString, nonce: bigint, expiry: Date, reason?: string, blockHash?: BlockHash.Type): Promise; /** * Performs a dry-run invocation of "CIS4.registerRevocationKeys" * * @param {AccountAddress.Type | ContractAddress.Type} sender - Address of the sender of the transfer. * @param {HexString | HexString[]} keys - a single or list of hex encoded public keys to be used for revocation * @param {HexString} [additionalData] - any additional data to include * @param {BlockHash.Type} [blockHash] - The hash of the block to perform the invocation of. Defaults to the latest finalized block on chain. * * @returns {InvokeContractResult} the contract invocation result, which includes whether or not the invocation succeeded along with the energy spent. */ registerRevocationKeys(sender: AccountAddress.Type | ContractAddress.Type, keys: HexString | HexString[], additionalData?: HexString, blockHash?: BlockHash.Type): Promise; /** * Performs a dry-run invocation of "CIS4.removeRevocationKeys" * * @param {AccountAddress.Type | ContractAddress.Type} sender - Address of the sender of the transfer. * @param {HexString | HexString[]} keys - a single or list of hex encoded public keys to be removed * @param {HexString} [additionalData] - any additional data to include * @param {BlockHash.Type} [blockHash] - The hash of the block to perform the invocation of. Defaults to the latest finalized block on chain. * * @returns {InvokeContractResult} the contract invocation result, which includes whether or not the invocation succeeded along with the energy spent. */ removeRevocationKeys(sender: AccountAddress.Type | ContractAddress.Type, keys: HexString | HexString[], additionalData?: HexString, blockHash?: BlockHash.Type): Promise; } /** * Defines methods for interacting with CIS4 contracts. */ export declare class CIS4Contract extends CISContract { /** * Parameter schemas for each CIS4 update entrypoint. * These are returned individually when creating update transactions to be used for serializing * a corresponding JSON representation of the parameter. */ schema: Record; /** * Creates a new `CIS4Contract` instance by querying the node for the necessary information through the supplied `grpcClient`. * * @param {ConcordiumGRPCClient} grpcClient - The client used for contract invocations and updates. * @param {ContractAddress} contractAddress - Address of the contract instance. * * @throws If `InstanceInfo` could not be received for the contract, * or if the contract name could not be parsed from the information received from the node. */ static create(grpcClient: ConcordiumGRPCClient, contractAddress: ContractAddress.Type): Promise; protected makeDryRunInstance(grpcClient: ConcordiumGRPCClient, contractAddress: ContractAddress.Type, contractName: ContractName.Type): CIS4DryRun; /** * Look up an entry in the registry by the public key of its holder. * * @param {HexString} credHolderPubKey - public key identifying the credential holder * @param {BlockHash.Type} [blockHash] - block to perform query at. * * @returns {CIS4.CredentialEntry} a corresponding credential entry. */ credentialEntry(credHolderPubKey: HexString, blockHash?: BlockHash.Type): Promise; /** * Look up the status of a credential by the public key of its holder. * * @param {HexString} credHolderPubKey - public key identifying the credential holder * @param {BlockHash.Type} [blockHash] - block to perform query at. * * @returns {CIS4.CredentialStatus} a corresponding credential status. */ credentialStatus(credHolderPubKey: HexString, blockHash?: BlockHash.Type): Promise; /** * Get list of all revocation keys and their corresponding nonces. * * @param {BlockHash.Type} [blockHash] - block to perform query at. * * @returns {CIS4.RevocationKeyWithNonce[]} the revocation keys wityh corresponding nonces. */ revocationKeys(blockHash?: BlockHash.Type): Promise; /** * Get the registry metadata. * * @param {BlockHash.Type} [blockHash] - block to perform query at. * * @returns {CIS4.MetadataUrl} a metadata URL. */ registryMetadata(blockHash?: BlockHash.Type): Promise; /** * Get the {@link AccountAddress} public key of the issuer. * * @param {BlockHash.Type} [blockHash] - block to perform query at. * * @returns {HexString} a hex encoded public key. */ issuer(blockHash?: BlockHash.Type): Promise; /** * Create the details necessary to submit a CIS4.registerCredential update transaction. * * @param {CreateContractTransactionMetadata} metadata - transaction metadata * @param {CIS4.CredentialInfo} credInfo - the credential info to register * @param {HexString} [additionalData] - any additional data to include * * @returns {ContractUpdateTransactionWithSchema} Transaction data for a CIS4.registerCredential update. */ createRegisterCredential(metadata: CreateContractTransactionMetadata, credInfo: CIS4.CredentialInfo, additionalData?: HexString): ContractUpdateTransactionWithSchema; /** * Submit CIS4.registerCredential update transaction. * * @param {AccountSigner} signer - to be used for signing the transaction sent to the node. * @param {ContractTransactionMetadata} metadata - transaction metadata * @param {CIS4.CredentialInfo} credInfo - the credential info to register * @param {HexString} [additionalData] - any additional data to include * * @returns {TransactionHash.Type} The hash of the submitted transaction */ registerCredential(signer: AccountSigner, metadata: ContractTransactionMetadata, credInfo: CIS4.CredentialInfo, additionalData?: HexString): Promise; /** * Create the details necessary to submit a CIS4.revokeCredentialIssuer update transaction. * * @param {CreateContractTransactionMetadata} metadata - transaction metadata * @param {HexString} credHolderPubKey - the public key of the credential holder (hex encoded) * @param {string} [reason] - the reason for the revocation * @param {HexString} [additionalData] - any additional data to include * * @returns {ContractUpdateTransactionWithSchema} Transaction data for a CIS4.revokeCredentialIssuer update. */ createRevokeCredentialAsIssuer(metadata: CreateContractTransactionMetadata, credHolderPubKey: HexString, reason?: string, additionalData?: HexString): ContractUpdateTransactionWithSchema; /** * Submit CIS4.revokeCredentialIssuer update transaction. * * @param {AccountSigner} signer - to be used for signing the transaction sent to the node. * @param {ContractTransactionMetadata} metadata - transaction metadata * @param {HexString} credHolderPubKey - the public key of the credential holder (hex encoded) * @param {string} [reason] - the reason for the revocation * @param {HexString} [additionalData] - any additional data to include * * @returns {TransactionHash.Type} The hash of the submitted transaction */ revokeCredentialAsIssuer(signer: AccountSigner, metadata: ContractTransactionMetadata, credHolderPubKey: HexString, reason?: string, additionalData?: HexString): Promise; /** * Create the details necessary to submit a CIS4.revokeCredentialHolder update transaction. * * @param {CreateContractTransactionMetadata} metadata - transaction metadata * @param {Web3IdSigner} credHolderSigner - A signer structure for the credential holder * @param {bigint} nonce - the nonce of the owner inside the contract * @param {Date} expiry - Expiry time of the revocation message * @param {string} [reason] - the reason for the revocation * * @returns {ContractUpdateTransactionWithSchema} Transaction data for a CIS4.revokeCredentialHolder update. */ createRevokeCredentialAsHolder(metadata: CreateContractTransactionMetadata, credHolderSigner: Web3IdSigner, nonce: bigint, expiry: Date, reason?: string): Promise; /** * Submit CIS4.revokeCredentialHolder update transaction. * The revocation message is set to expire at the same time as the transaction (from `metadata.expiry`) * * @param {AccountSigner} signer - to be used for signing the transaction sent to the node. * @param {ContractTransactionMetadata} metadata - transaction metadata * @param {Web3IdSigner} credHolderSigner - A signer structure for the credential holder * @param {bigint} nonce - the nonce of the owner inside the contract * @param {string} [reason] - the reason for the revocation * * @returns {TransactionHash.Type} The hash of the submitted transaction */ revokeCredentialAsHolder(signer: AccountSigner, metadata: ContractTransactionMetadata, credHolderSigner: Web3IdSigner, nonce: bigint, reason?: string): Promise; /** * Create the details necessary to submit a CIS4.revokeCredentialOther update transaction. * * @param {CreateContractTransactionMetadata} metadata - transaction metadata * @param {Web3IdSigner} revokerSigner - A signer structure for the revoker * @param {HexString} credentialPubKey - the public key (hex encoded) for the credential to revoke * @param {bigint} nonce - the nonce of the owner inside the contract * @param {Date} expiry - Expiry time of the revocation message * @param {string} [reason] - the reason for the revocation * * @returns {ContractUpdateTransactionWithSchema} Transaction data for a CIS4.revokeCredentialOther update. */ createRevokeCredentialAsOther(metadata: CreateContractTransactionMetadata, revokerSigner: Web3IdSigner, credentialPubKey: HexString, nonce: bigint, expiry: Date, reason?: string): Promise; /** * Submit CIS4.revokeCredentialOther update transaction. * The revocation message is set to expire at the same time as the transaction (from `metadata.expiry`) * * @param {AccountSigner} signer - to be used for signing the transaction sent to the node. * @param {ContractTransactionMetadata} metadata - transaction metadata * @param {Web3IdSigner} revokerSigner - A signer structure for the credential holder * @param {HexString} credentialPubKey - the public key (hex encoded) for the credential to revoke * @param {bigint} nonce - the nonce of the owner inside the contract * @param {string} [reason] - the reason for the revocation * * @returns {TransactionHash.Type} The hash of the submitted transaction */ revokeCredentialAsOther(signer: AccountSigner, metadata: ContractTransactionMetadata, revokerSigner: Web3IdSigner, credentialPubKey: HexString, nonce: bigint, reason?: string): Promise; /** * Create the details necessary to submit a CIS4.registerRevicationKeys update transaction. * * @param {CreateContractTransactionMetadata} metadata - transaction metadata * @param {HexString | HexString[]} keys - a single or list of hex encoded public keys to be used for revocation * @param {HexString} [additionalData] - any additional data to include * * @returns {ContractUpdateTransactionWithSchema} Transaction data for a CIS4.registerRevicationKeys update. */ createRegisterRevocationKeys(metadata: CreateContractTransactionMetadata, keys: HexString | HexString[], additionalData?: HexString): ContractUpdateTransactionWithSchema; /** * Submit CIS4.registerRevocationKeys update transaction. * * @param {AccountSigner} signer - to be used for signing the transaction sent to the node. * @param {ContractTransactionMetadata} metadata - transaction metadata * @param {HexString | HexString[]} keys - a single or list of hex encoded public keys to be used for revocation * @param {HexString} [additionalData] - any additional data to include * * @returns {TransactionHash.Type} The hash of the submitted transaction */ registerRevocationKeys(signer: AccountSigner, metadata: ContractTransactionMetadata, keys: HexString | HexString[], additionalData?: HexString): Promise; /** * Create the details necessary to submit a CIS4.removeRevicationKeys update transaction. * * @param {CreateContractTransactionMetadata} metadata - transaction metadata * @param {HexString | HexString[]} keys - a single or list of hex encoded public keys to be removed * @param {HexString} [additionalData] - any additional data to include * * @returns {ContractUpdateTransactionWithSchema} Transaction data for a CIS4.removeRevicationKeys update. */ createRemoveRevocationKeys(metadata: CreateContractTransactionMetadata, keys: HexString | HexString[], additionalData?: HexString): ContractUpdateTransactionWithSchema; /** * Submit CIS4.removeRevocationKeys update transaction. * * @param {AccountSigner} signer - to be used for signing the transaction sent to the node. * @param {ContractTransactionMetadata} metadata - transaction metadata * @param {HexString | HexString[]} keys - a single or list of hex encoded public keys to be removed * @param {HexString} [additionalData] - any additional data to include * * @returns {TransactionHash.Type} The hash of the submitted transaction */ removeRevocationKeys(signer: AccountSigner, metadata: ContractTransactionMetadata, keys: HexString | HexString[], additionalData?: HexString): Promise; } export {};