CIS
Modules:
| Name | Description |
|---|---|
core |
|
Classes:
| Name | Description |
|---|---|
CIS |
|
CIS
¶
Methods:
| Name | Description |
|---|---|
CCDbalanceOf |
Retrieves the CCD balance of the specified public keys at a given block hash. |
CIS2balanceOf |
Queries the balance of a specific token for a list of public keys from a CIS-2 contract. |
account_address |
Reads a 32-byte account address from a BytesIO stream and encodes it in Base58Check format. |
additionalData |
Reads additional data from a BytesIO stream. |
address |
Parses an address from a given BytesIO stream. |
balanceOf |
Retrieves the balance of a specific token for a list of addresses at a given block hash. |
balanceOfParameter |
Generates a byte stream representing the balance of a parameter for a given token ID and a list of addresses. |
balanceOfQuery |
Queries the balance of a specific token for a given address. |
balanceOfResponse |
Parses the response bytes to extract token balance information. |
burnEvent |
Parses a hexadecimal string to create a burnEvent object. |
ccd_amount |
Extracts the CCD amount from a given BytesIO stream. |
chain_context |
Parses the chain context from the given BytesIO stream. |
contract_address |
Extracts and returns the contract address from a given BytesIO stream. |
contract_index |
Extracts and returns the contract index from a given BytesIO stream. |
contract_subindex |
Extracts and returns a subindex from a binary stream. |
credentialMetaDataEvent |
Parses a hexadecimal string to extract credential metadata event information. |
credentialSchemaRefEvent |
Parses a hexadecimal parameter to extract and return a credential schema reference event. |
credential_id |
Extracts and returns the credential ID from a given BytesIO stream. |
credential_type |
Parses the credential type from a given BytesIO stream. |
depositCCDEvent |
Parses a hexadecimal parameter string and returns a depositCCDEvent object. |
depositCIS2TokensEvent |
Parses a hexadecimal string representing a CIS-2 token deposit event and returns a depositCIS2TokensEvent object. |
fiveStarsRegisterAccess |
Process custom register_access event from 5TARS contract. |
genesis_hash |
Computes the genesis hash from a given BytesIO stream. |
issuerMetaDataEvent |
Parses the issuer metadata event from a hexadecimal parameter. |
itemCreatedEvent |
Parses a hexadecimal parameter to create an itemCreatedEvent. |
itemStatusChangedEvent |
Parses a hexadecimal parameter string and returns an itemStatusChangedEvent object. |
item_id |
Extracts and returns the item ID from a given BytesIO stream. |
metadataUrl |
Parses a metadata URL from a given BytesIO stream. |
mintEvent |
Parses a hexadecimal string to extract and return a mintEvent object. |
nonce |
Extracts a nonce from a given BytesIO stream. |
nonceEventCIS3 |
Parses a hexadecimal string to create a nonceEventCIS3 object. |
nonceEventCIS5 |
Parses a hexadecimal string to create a nonceEventCIS5 object. |
optional_reason |
Parses an optional reason from a given BytesIO stream. |
process_log_events |
Function to determine, based on the tag, whcih event to parse. |
public_key_ed25519 |
Extracts and returns the hexadecimal representation of an Ed25519 public key from a given BytesIO stream. |
reason_string |
Extracts a reason string from a given BytesIO stream. |
receiveHookName |
Reads a hook name from a given BytesIO stream. |
receiver |
Parses a receiver from the given BytesIO stream. |
recognize_event |
Contracts can support multiple standards. Hence, depending on the tag we try |
registerCredentialEvent |
Registers a credential event by parsing a hexadecimal parameter. |
revocationKeyEvent |
Parses a hexadecimal parameter to extract and return a revocation key event. |
revocation_key_action |
Processes the revocation key action from the given byte stream. |
revokeCredentialEvent |
Parses a hexadecimal string representing a revoke credential event and returns a dictionary with the event details. |
revoker |
Determines the revoker type from a given byte stream. |
schema_ref |
Parses the schema reference from the given BytesIO stream. |
signature_ed25519 |
Generates an Ed25519 signature from the given BytesIO stream. |
standard_identifier |
Converts a standard identifier to its byte representation. |
status |
Reads a single byte from the given BytesIO stream and returns its integer value. |
timestamp |
Extracts a timestamp from a given BytesIO stream. |
tokenMetaDataEvent |
Parses a hexadecimal string to extract token metadata event information. |
token_amount |
Decodes and returns the token amount from a given BytesIO stream. |
token_id |
Extracts and returns the token ID from a given BytesIO stream. |
transferCCDEvent |
Parses a hexadecimal string representing a CCD transfer event and returns a transferCCDEvent object. |
transferCIS2TokensEvent |
Parses a hexadecimal string representing a CIS-2 token transfer event and returns a transferCIS2TokensEvent object. |
transferEvent |
Parses a hexadecimal string representing a transfer event and returns a transferEvent object. |
updateOperatorEvent |
Parses a hexadecimal parameter string and returns an updateOperatorEvent object. |
withdrawCCDEvent |
Parses a hexadecimal string representing a CCD withdrawal event and returns a dictionary with the event details. |
withdrawCIS2TokensEvent |
Parses a hexadecimal parameter to extract and return details of a CIS-2 token withdrawal event. |
CCDbalanceOf(block_hash, public_keys)
¶
Retrieves the CCD balance of the specified public keys at a given block hash.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block_hash
|
str
|
The hash of the block at which to query the balance. |
required |
public_keys
|
list[str]
|
A list of public keys to query the balance for. |
required |
Returns:
| Type | Description |
|---|---|
tuple
|
A tuple containing the support result and the invocation instance. |
References
CIS2balanceOf(block_hash, cis2_contract, token_id, public_keys)
¶
Queries the balance of a specific token for a list of public keys from a CIS-2 contract.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block_hash
|
str
|
The hash of the block to query. |
required |
cis2_contract
|
CCD_ContractAddress
|
The address of the CIS-2 contract. |
required |
token_id
|
str
|
The ID of the token to query. |
required |
public_keys
|
list[str]
|
A list of public keys to query the balance for. |
required |
Returns:
| Type | Description |
|---|---|
tuple
|
A tuple containing the balance result and the invocation instance. |
Reference
account_address(bs)
¶
Reads a 32-byte account address from a BytesIO stream and encodes it in Base58Check format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bs
|
BytesIO
|
A BytesIO stream containing the account address. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The Base58Check encoded account address. |
See Also
additionalData(bs)
¶
Reads additional data from a BytesIO stream.
This method reads a 2-byte little-endian integer from the given BytesIO stream, which indicates the length of the subsequent data. It then reads that many bytes from the stream and returns them as a hexadecimal string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bs
|
BytesIO
|
The BytesIO stream to read from. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The hexadecimal representation of the read bytes. |
Reference
address(bs)
¶
Parses an address from a given BytesIO stream.
The function reads the first byte to determine the type of address. If the byte is 0, it parses an account address. If the byte is 1, it parses a contract address. Otherwise, it raises an exception for an invalid type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bs
|
BytesIO
|
The input byte stream containing the address data. |
required |
Returns:
| Type | Description |
|---|---|
CCD_AccountAddress | CCD_ContractAddress
|
The parsed address, either an account address or a contract address. |
Raises:
| Type | Description |
|---|---|
Exception
|
If the address type is invalid. |
See Also: CIS-2 Address
balanceOf(block_hash, tokenID, addresses)
¶
Retrieves the balance of a specific token for a list of addresses at a given block hash.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block_hash
|
str
|
The hash of the block at which to query the balance. |
required |
tokenID
|
str
|
The ID of the token to query. |
required |
addresses
|
list[str]
|
A list of addresses to query the balance for. |
required |
Returns:
| Type | Description |
|---|---|
tuple
|
A tuple containing the balance result and the invocation instance. |
See Also
balanceOfParameter(tokenID, addresses)
¶
Generates a byte stream representing the balance of a parameter for a given token ID and a list of addresses.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tokenID
|
str
|
The token ID for which the balance is being queried. |
required |
addresses
|
list[str]
|
A list of addresses to query the balance for. |
required |
Returns:
| Type | Description |
|---|---|
bytes
|
A byte stream containing the balance information for the given token ID and addresses. |
Reference
balanceOfQuery(tokenID, address)
¶
Queries the balance of a specific token for a given address.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tokenID
|
str
|
The ID of the token to query. |
required |
address
|
str
|
The address to query the token balance for. |
required |
Returns:
| Type | Description |
|---|---|
bytes
|
The serialized query data. |
Reference
balanceOfResponse(res)
¶
Parses the response bytes to extract token balance information.
The response format is defined in the CIS-2 standard: CIS-2 Response
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
res
|
bytes
|
The response bytes to be parsed. |
required |
Returns:
| Type | Description |
|---|---|
list
|
A list of token amounts extracted from the response. |
burnEvent(hexParameter)
¶
Parses a hexadecimal string to create a burnEvent object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hexParameter
|
str
|
A hexadecimal string representing the burn event data. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
burnEvent |
burnEvent
|
An instance of the burnEvent class containing parsed data. |
References
ccd_amount(bs)
¶
Extracts the CCD amount from a given BytesIO stream.
This method reads 8 bytes from the provided BytesIO stream and converts it to an integer using little-endian byte order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bs
|
BytesIO
|
A BytesIO stream containing the CCD amount. |
required |
Returns:
| Type | Description |
|---|---|
int
|
The CCD amount as an integer. |
Reference
chain_context(bs)
¶
Parses the chain context from the given BytesIO stream.
This method extracts the genesis hash, contract index, and contract subindex from the provided binary stream.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bs
|
BytesIO
|
The binary stream containing the chain context data. |
required |
Returns:
| Type | Description |
|---|---|
tuple
|
A tuple containing the genesis hash, contract index, and contract subindex. |
Reference
For more details, see the CIS-5 specification: CIS-5 Chain Context
contract_address(bs)
¶
Extracts and returns the contract address from a given BytesIO stream.
The contract address is composed of two 8-byte integers read from the stream in little-endian byte order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bs
|
BytesIO
|
A BytesIO stream containing the contract address data. |
required |
Returns:
| Type | Description |
|---|---|
tuple
|
A tuple containing two integers representing the contract address. |
For more information, see the CIS-2 Contract Address Specification.
contract_index(bs)
¶
Extracts and returns the contract index from a given BytesIO stream.
The contract index is read as the first 8 bytes from the stream and returned as a hexadecimal string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bs
|
BytesIO
|
A BytesIO stream containing the contract data. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The contract index as a hexadecimal string. |
Reference
contract_subindex(bs)
¶
Extracts and returns a subindex from a binary stream.
This method reads the first 8 bytes from the provided binary stream and converts them to a hexadecimal string representation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bs
|
BytesIO
|
A binary stream from which the subindex is read. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The hexadecimal string representation of the subindex. |
See Also
credentialMetaDataEvent(hexParameter)
¶
Parses a hexadecimal string to extract credential metadata event information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hexParameter
|
str
|
A hexadecimal string representing the credential metadata event. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
credentialMetadataEvent |
credentialMetadataEvent
|
An object containing the parsed credential metadata event information. |
See Also
credentialSchemaRefEvent(hexParameter)
¶
Parses a hexadecimal parameter to extract and return a credential schema reference event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hexParameter
|
str
|
A string representing the hexadecimal parameter to be parsed. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
credentialSchemaRefEvent
|
A dictionary containing the parsed event data with keys 'tag', 'type', and 'schema_ref'. |
Reference
For more details, see the CIS-4 documentation: CIS-4 Credential Schema Reference Event
credential_id(bs)
¶
Extracts and returns the credential ID from a given BytesIO stream.
This method reads the first 32 bytes from the provided BytesIO stream and returns it as a hexadecimal string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bs
|
BytesIO
|
A BytesIO stream containing the credential data. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The hexadecimal representation of the credential ID. |
Reference
credential_type(bs)
¶
Parses the credential type from a given BytesIO stream.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bs
|
BytesIO
|
A BytesIO stream containing the credential type data. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The hexadecimal representation of the credential type. |
Reference
depositCCDEvent(hexParameter)
¶
Parses a hexadecimal parameter string and returns a depositCCDEvent object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hexParameter
|
str
|
A string containing the hexadecimal representation of the event data. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
depositCCDEvent |
depositCCDEvent
|
An object containing the parsed event data. |
The function reads the following data from the hexadecimal string
- tag: An integer representing the event tag.
- ccd_amount: The amount of CCD involved in the event.
- from_address: The address from which the CCD is sent.
- to_public_key_ed25519: The public key of the recipient.
For more details, refer to the CIS-5 specification: CIS-5 Deposit CCD Event
depositCIS2TokensEvent(hexParameter)
¶
Parses a hexadecimal string representing a CIS-2 token deposit event and returns a depositCIS2TokensEvent object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hexParameter
|
str
|
A hexadecimal string representing the CIS-2 token deposit event. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
depositCIS2TokensEvent |
depositCIS2TokensEvent
|
An object containing the parsed event data. |
The event data includes
- tag (int): The event tag.
- token_amount (int): The amount of tokens deposited.
- token_id (int): The ID of the token.
- cis2_token_contract_address (str): The contract address of the CIS-2 token.
- from_address (str): The address from which the tokens were sent.
- to_public_key_ed25519 (str): The public key of the recipient.
For more details, refer to the CIS-5 specification: CIS-5 Specification
fiveStarsRegisterAccess(hexParameter)
¶
Process custom register_access event from 5TARS contract.
genesis_hash(bs)
¶
Computes the genesis hash from a given BytesIO stream.
This method reads the first 32 bytes from the provided BytesIO stream and returns its hexadecimal representation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bs
|
BytesIO
|
A BytesIO stream containing the data to hash. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The hexadecimal representation of the first 32 bytes of the stream. |
See Also
issuerMetaDataEvent(hexParameter)
¶
Parses the issuer metadata event from a hexadecimal parameter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hexParameter
|
str
|
The hexadecimal string representing the issuer metadata event. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
issuerMetadataEvent |
issuerMetadataEvent
|
An instance of issuerMetadataEvent containing the parsed metadata. |
Reference
For more details, see the CIS-4 specification: CIS-4 Issuer Metadata
itemCreatedEvent(hexParameter)
¶
Parses a hexadecimal parameter to create an itemCreatedEvent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hexParameter
|
str
|
The hexadecimal string representing the event data. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
itemCreatedEvent |
itemCreatedEvent
|
An instance of itemCreatedEvent with parsed data. |
References
itemStatusChangedEvent(hexParameter)
¶
Parses a hexadecimal parameter string and returns an itemStatusChangedEvent object.
For more details, refer to the CIS-6 documentation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hexParameter
|
str
|
The hexadecimal string representing the event data. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
itemStatusChangedEvent |
itemStatusChangedEvent
|
An object containing the parsed event data with the following fields: - tag (int): The tag value extracted from the event data. - item_id (int): The item ID extracted from the event data. - new_status (int): The new status extracted from the event data. - additional_data (bytes): Any additional data extracted from the event data. |
item_id(bs)
¶
Extracts and returns the item ID from a given BytesIO stream.
The item ID is read according to the CIS-6 specification. For more details, refer to the CIS-6 documentation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bs
|
BytesIO
|
A BytesIO stream containing the item ID data. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The hexadecimal representation of the item ID. |
metadataUrl(bs)
¶
Parses a metadata URL from a given BytesIO stream.
This method reads a URL from the provided BytesIO stream, calculates its checksum, and returns a MetadataUrl object containing the URL and its checksum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bs
|
BytesIO
|
A BytesIO stream containing the metadata URL. |
required |
Returns:
| Type | Description |
|---|---|
MetadataUrl
|
An object containing the parsed URL and its checksum. |
References
mintEvent(hexParameter)
¶
Parses a hexadecimal string to extract and return a mintEvent object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hexParameter
|
str
|
A hexadecimal string representing the event data. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
mintEvent |
mintEvent
|
An object containing the parsed event data. |
The mintEvent object contains the following fields
- tag (int): The event tag.
- token_id (int): The ID of the token.
- token_amount (int): The amount of tokens.
- to_address (str): The address to which the tokens are minted.
For more details, refer to the CIS-2 specification: CIS-2 Mint Event
nonce(bs)
¶
Extracts a nonce from a given BytesIO stream.
The nonce is an 8-byte integer read from the stream in little-endian byte order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bs
|
BytesIO
|
A BytesIO stream containing the nonce. |
required |
Returns:
| Type | Description |
|---|---|
int
|
The nonce as an integer. |
Reference
nonceEventCIS3(hexParameter)
¶
Parses a hexadecimal string to create a nonceEventCIS3 object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hexParameter
|
str
|
A hexadecimal string representing the nonce event data. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
nonceEvent |
nonceEventCIS3
|
An object containing the parsed nonce event data. |
Reference
For more details, see the CIS-3 NonceEvent specification.
nonceEventCIS5(hexParameter)
¶
Parses a hexadecimal string to create a nonceEventCIS5 object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hexParameter
|
str
|
A hexadecimal string representing the nonce event data. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
nonceEvent |
nonceEventCIS5
|
An object containing the parsed nonce event data. |
Reference
For more details, see the CIS-5 NonceEvent specification.
optional_reason(bs)
¶
Parses an optional reason from a given BytesIO stream.
This method reads the first byte to determine if a reason is present. If the byte is 0, it returns None. If the byte is 2, it reads and returns the reason string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bs
|
BytesIO
|
The input byte stream to read from. |
required |
Returns:
| Type | Description |
|---|---|
Optional[str]
|
The reason string if present, otherwise None. |
See Also
For more details, refer to the CIS-4 specification: CIS-4 Specification
process_log_events(hexParameter)
¶
Function to determine, based on the tag, whcih event to parse.
public_key_ed25519(bs)
¶
Extracts and returns the hexadecimal representation of an Ed25519 public key from a given BytesIO stream.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bs
|
BytesIO
|
A BytesIO stream containing the public key data. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The hexadecimal string representation of the Ed25519 public key. |
Reference
reason_string(bs)
¶
Extracts a reason string from a given BytesIO stream.
This method reads the first byte to determine the length of the reason string, then reads the subsequent bytes to extract the string and returns it in hexadecimal format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bs
|
BytesIO
|
A BytesIO stream containing the reason string data. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The reason string in hexadecimal format. |
Reference
receiveHookName(bs)
¶
Reads a hook name from a given BytesIO stream.
This method reads the first 2 bytes to determine the length of the hook name, then reads the hook name of that length from the stream and decodes it using UTF-8 encoding.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bs
|
BytesIO
|
The input stream containing the hook name. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The decoded hook name. |
Reference
receiver(bs)
¶
Parses a receiver from the given BytesIO stream.
The function reads the first byte to determine the type of receiver. - If the byte is 0, it returns an account address. - If the byte is 1, it returns a tuple containing a contract address and a receive hook name. - For any other value, it raises an exception indicating an invalid type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bs
|
BytesIO
|
The input byte stream to parse. |
required |
Returns:
| Type | Description |
|---|---|
Union[AccountAddress, Tuple[ContractAddress, str]]
|
The parsed receiver, either an account address or a tuple of contract address and receive hook name. |
Raises:
| Type | Description |
|---|---|
Exception
|
If the type byte is not 0 or 1. |
See Also
recognize_event(event, standards, contract_name)
¶
Contracts can support multiple standards. Hence, depending on the tag we try to figure our which standard such an event is specified in and try to parse it.
registerCredentialEvent(hexParameter)
¶
Registers a credential event by parsing a hexadecimal parameter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hexParameter
|
str
|
A string representing the hexadecimal parameter to be parsed. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
registerCredentialEvent
|
A dictionary containing the parsed credential event details with keys: - "tag" (int): The tag value. - "credential_id" (str): The credential ID. - "schema_ref" (str): The schema reference. - "credential_type" (str): The credential type. |
See Also
revocationKeyEvent(hexParameter)
¶
Parses a hexadecimal parameter to extract and return a revocation key event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hexParameter
|
str
|
A string representing the hexadecimal parameter. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
revocationKeyEvent |
revocationKeyEvent
|
An instance of revocationKeyEvent containing the parsed data. |
References
For more information, see the CIS-4 Revocation Key Event documentation.
revocation_key_action(bs)
¶
Processes the revocation key action from the given byte stream.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bs
|
BytesIO
|
A byte stream containing the revocation key action data. |
required |
Returns:
| Type | Description |
|---|---|
str
|
A string indicating the action, either "Register" or "Remove". |
Reference
For more details, see the CIS-4 proposal documentation: CIS-4 Revocation Key Event
revokeCredentialEvent(hexParameter)
¶
Parses a hexadecimal string representing a revoke credential event and returns a dictionary with the event details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hexParameter
|
str
|
A hexadecimal string representing the revoke credential event. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
revokeCredentialEvent
|
A dictionary containing the parsed event details with keys 'tag', 'credential_id', 'revoker', and 'reason'. |
Reference
revoker(bs)
¶
Determines the revoker type from a given byte stream.
This method reads a single byte from the provided io.BytesIO stream and
interprets it to determine the type of revoker. The mapping is as follows:
- 0: "Issuer"
- 1: "Holder"
- 2: "Other" (with additional credential ID)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bs
|
BytesIO
|
A byte stream containing the revoker information. |
required |
Returns:
| Type | Description |
|---|---|
str
|
A string representing the revoker type. |
Reference
schema_ref(bs)
¶
Parses the schema reference from the given BytesIO stream.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bs
|
BytesIO
|
A BytesIO stream containing the schema reference data. |
required |
Returns:
| Type | Description |
|---|---|
SchemaRef
|
An instance of SchemaRef containing the URL and checksum. |
See Also
signature_ed25519(bs)
¶
Generates an Ed25519 signature from the given BytesIO stream.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bs
|
BytesIO
|
A BytesIO stream containing the data to be signed. |
required |
Returns:
| Type | Description |
|---|---|
str
|
A hexadecimal string representation of the Ed25519 signature. |
See Also
standard_identifier(identifier)
¶
Converts a standard identifier to its byte representation.
This method takes a StandardIdentifiers object, calculates the length of its ASCII value,
and returns the byte representation of the identifier prefixed with its length.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
identifier
|
StandardIdentifiers
|
The standard identifier to be converted. |
required |
Returns:
| Type | Description |
|---|---|
bytes
|
The byte representation of the standard identifier. |
See Also
status(bs)
¶
Reads a single byte from the given BytesIO stream and returns its integer value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bs
|
BytesIO
|
A BytesIO stream to read the byte from. |
required |
Returns:
| Type | Description |
|---|---|
int
|
The integer value of the read byte. |
See Also
timestamp(bs)
¶
Extracts a timestamp from a given BytesIO stream.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bs
|
BytesIO
|
A BytesIO stream containing the timestamp. |
required |
Returns:
| Type | Description |
|---|---|
int
|
The extracted timestamp as an integer. |
Reference
tokenMetaDataEvent(hexParameter)
¶
Parses a hexadecimal string to extract token metadata event information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hexParameter
|
str
|
A hexadecimal string representing the token metadata event. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
tokenMetadataEvent |
tokenMetadataEvent
|
An object containing the parsed token metadata event information. |
Reference
token_amount(bs)
¶
Decodes and returns the token amount from a given BytesIO stream.
This method reads a LEB128 encoded unsigned integer from the provided BytesIO stream and returns the decoded value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bs
|
BytesIO
|
A BytesIO stream containing the LEB128 encoded token amount. |
required |
Returns:
| Type | Description |
|---|---|
int
|
The decoded token amount. |
See Also
token_id(bs)
¶
Extracts and returns the token ID from a given BytesIO stream.
The token ID is read from the stream in the following manner: 1. The first byte indicates the length of the token ID. 2. The subsequent bytes represent the token ID itself.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bs
|
BytesIO
|
A BytesIO stream containing the token ID data. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The hexadecimal representation of the token ID. |
Reference
transferCCDEvent(hexParameter)
¶
Parses a hexadecimal string representing a CCD transfer event and returns a transferCCDEvent object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hexParameter
|
str
|
A hexadecimal string representing the CCD transfer event. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
transferCCDEvent |
transferCCDEvent
|
An object containing the parsed CCD transfer event data. |
The CCD transfer event data includes
- tag (int): The event tag.
- ccd_amount (int): The amount of CCD transferred.
- from_public_key_ed25519 (bytes): The sender's public key in ED25519 format.
- to_public_key_ed25519 (bytes): The recipient's public key in ED25519 format.
For more details, refer to the CIS-5 specification: CIS-5 Transfer CCD Event
transferCIS2TokensEvent(hexParameter)
¶
Parses a hexadecimal string representing a CIS-2 token transfer event and returns a transferCIS2TokensEvent object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hexParameter
|
str
|
A hexadecimal string containing the encoded CIS-2 token transfer event data. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
transferCIS2TokensEvent |
transferCIS2TokensEvent
|
An object containing the parsed event data, including: - tag (int): The event tag. - token_amount (int): The amount of tokens transferred. - token_id (int): The ID of the token being transferred. - cis2_token_contract_address (str): The contract address of the CIS-2 token as a string. - from_public_key_ed25519 (bytes): The public key of the sender in Ed25519 format. - to_public_key_ed25519 (bytes): The public key of the recipient in Ed25519 format. |
Reference
transferEvent(hexParameter)
¶
Parses a hexadecimal string representing a transfer event and returns a transferEvent object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hexParameter
|
str
|
A hexadecimal string representing the transfer event data. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
transferEvent |
transferEvent
|
An object containing the parsed transfer event data. |
The transfer event data is parsed according to the CIS-2 standard. For more information, see the CIS-2 Transfer Event documentation.
updateOperatorEvent(hexParameter)
¶
Parses a hexadecimal parameter string and returns an updateOperatorEvent object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hexParameter
|
str
|
The hexadecimal string representing the event data. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
updateOperatorEvent |
updateOperatorEvent
|
An object containing the parsed event data. |
References
withdrawCCDEvent(hexParameter)
¶
Parses a hexadecimal string representing a CCD withdrawal event and returns a dictionary with the event details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hexParameter
|
str
|
A hexadecimal string representing the CCD withdrawal event. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
withdrawCCDEvent
|
A dictionary containing the parsed event details: - tag (int): The event tag. - ccd_amount (int): The amount of CCD withdrawn. - from_public_key_ed25519 (bytes): The public key of the sender. - to_address (str): The formatted address of the recipient. |
Reference
withdrawCIS2TokensEvent(hexParameter)
¶
Parses a hexadecimal parameter to extract and return details of a CIS-2 token withdrawal event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hexParameter
|
str
|
A hexadecimal string representing the event data. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
withdrawCIS2TokensEvent |
withdrawCIS2TokensEvent
|
An instance of withdrawCIS2TokensEvent containing the parsed event details. |
Event Details
- tag (int): The event tag.
- token_amount (int): The amount of tokens withdrawn.
- token_id (int): The ID of the token.
- cis2_token_contract_address (str): The contract address of the CIS-2 token in string format.
- from_public_key_ed25519 (bytes): The public key of the sender in Ed25519 format.
- to_address (str): The address of the recipient.
Reference
For more details, see the CIS-5 specification: CIS-5 WithdrawCIS2TokensEvent