The Cellframe.Common module is designed to work with datum.
class CellFrame.Common.DatumTypeID
This class implements the datum subchain type id object. This class has no methods and attributes.
class CellFrame.Common.Datum
This class implements the chain datum object.
constructor CellFrame.Common.Datum(type: int, data: bytes, dataSize: int)
The constructor accepts arguments type
defines a datum type, data
is datum data, dataSize
is the data size. The type
argument can take the following values:
Value | C definition | Description |
---|---|---|
0x0000 |
DAP_CHAIN_DATUM_BLOCK_END | End section, means all the rest of the block is empty |
0x0001 |
DAP_CHAIN_DATUM_BLOCK_ROOTS | Section with additional roots, for example transaction roots |
0x0100 |
DAP_CHAIN_DATUM_TX | Transaction header section |
0x0300 |
DAP_CHAIN_DATUM_TX_REQUEST | Transaction request section |
0x0900 |
DAP_CHAIN_DATUM_WASM_CODE | Smart contract: DVM code section |
0x0901 |
DAP_CHAIN_DATUM_WASM_DATA | Smart contract: DVM code section |
0x0910 |
DAP_CHAIN_DATUM_EVM_CODE | Smart contract: EVM code section |
0x0911 |
DAP_CHAIN_DATUM_EVM_DATA | Smart contract: EVM data section |
0x0c00 |
DAP_CHAIN_DATUM_CA | CA with public key and self signed metadata |
0xf000 |
DAP_CHAIN_DATUM_TOKEN_DECL | Simple token decl |
0xf100 |
DAP_CHAIN_DATUM_TOKEN_EMISSION | Simple token emmission |
0xf200 |
DAP_CHAIN_DATUM_TOKEN_DISMISSAL | Simple token dismissal |
0xffff |
DAP_CHAIN_DATUM_CUSTOM | Custom |
object method CellFrame.Common.Datum.getSize() -> int
Gets a data size.
object method CellFrame.Common.Datum.isDatumTX() -> bool
Checks if datum type is DAP_CHAIN_DATUM_TX
(0x0100). Returns True
if it is, otherwise False
.
object method CellFrame.Common.Datum.getDatumTX() -> CellFrame.Common.DatumTX
Gets a datum transaction. Returns a CellFrame.ChainDatumTX
object.
object method CellFrame.Common.Datum.isDatumToken() -> bool
Checks if datum type is DAP_CHAIN_DATUM_TOKEN_DECL
(0xf000). Returns True
if it is, otherwise False
.
object method CellFrame.Common.Datum.getDatumToken() -> CellFrame.Common.DatumToken
Gets a datum token. Returns a DatumToken
object.
object method CellFrame.Common.Datum.isDatumTokenEmission() -> bool
Checks if datum type is DAP_CHAIN_DATUM_TOKEN_EMISSION
(0xf100). Returns True
if it is, otherwise False
.
object method CellFrame.Common.Datum.getDatumTokenEmission() -> CellFrame.Common.DatumToken
Gets a datum emission. Returns a DatumTokenEmission
object.
object method CellFrame.Common.Datum.getTypeStr() -> str
Gets a datum type. Returns a string.
getterCellFrame.Common.Datum.versionStr: str
Gets a datum version. Returns a string.
getterCellFrame.Common.Datum.tsCreated: datetime.datetime
Gets the datetime.datetime
object corresponding to the time of datum creation.
getterCellFrame.Common.Datum.raw: bytes
Gets the bytes of datum. Returns a bytes
objects.
getterCellFrame.Common.Datum.rawData: bytes
Gets the data of the datum. Returns a bytes
object.
class CellFrame.Common.DatumIter
This class implements the chain datum iterator object.
class CellFrame.Common.DatumToken
This class implements the chain datum token object.
getterCellFrame.Common.DatumToken.ticker: str
Gets a ticker.
getterCellFrame.Common.DatumToken.typeStr: str
Gets a token type. The getting object is a string, that contains one of the following values: "SIMPLE"
for the DAP_CHAIN_DATUM_TOKEN_TYPE_OLD_SIMPLE and the DAP_CHAIN_DATUM_TOKEN_TYPE_SIMPLE types, "PRIVATE_UPDATE"
for the DAP_CHAIN_DATUM_TOKEN_TYPE_PRIVATE_UPDATE type, "PRIVATE_DECL"
for the DAP_CHAIN_DATUM_TOKEN_TYPE_PRIVATE_DECL type, "PUBLIC"
for the DAP_CHAIN_DATUM_TOKEN_TYPE_OLD_PUBLIC and the DAP_CHAIN_DATUM_TOKEN_TYPE_OLD_PUBLIC types, "CF20_DECL"
for the DAP_CHAIN_DATUM_TOKEN_TYPE_NATIVE_DECL type, "CF20_UPDATE"
for the DAP_CHAIN_DATUM_TOKEN_TYPE_NATIVE_UPDATE type, "UNKNOWN"
the unknown type of token.
getterCellFrame.Common.DatumToken.data: dict
Gets a data. Returns a dictionary with keys: signs_total
, signs_valid
and total_supply
class CellFrame.Common.DatumTokenExt
This class implements the chain datum external token object.
getterCellFrame.Common.Datum.version: int
Gets the version of the token.
getterCellFrame.Common.Datum.ticker: str
Gets the ticker of the token.
getterCellFrame.Common.Datum.chainId: CellFrame.Chain.ChainID
Gets the chain ID of the token.
getterCellFrame.Common.Datum.netId: CellFrame.Chain.NetID
Gets the net ID of the token.
getterCellFrame.Common.Datum.txHash: DAP.Crypto.HashFast
Gets the hash of the token.
getterCellFrame.Common.Datum.txOutIdx: int
Gets the output index of the token.
class CellFrame.Common.DatumEmisson
This class implements the chain datum token emission object.
constructor CellFrame.Common.DatumEmisson(value: str, ticker: str, addr: CellFrame.Chain.ChainAddr)
Creates an instance of the CellFrame.Common.DatumEmisson
object. The value
is a emission value. The ticker
is a token ticker. The addr
is a chain address.
getterCellFrame.Common.DatumEmisson.version: int
Gets the version of the token.
getterCellFrame.Common.DatumEmisson.typeStr: str
Gets a token type.
getterCellFrame.Common.DatumEmisson.ticker: str
Gets a ticker.
getterCellFrame.Common.DatumEmisson.addr: CellFrame.Chain.ChainAddr
Gets an address.
getterCellFrame.Common.DatumEmisson.value: int
Gets a value.
getterCellFrame.Common.DatumEmisson.data: dict
Gets a data. Returns a dictionary with keys: codename
for DAP_CHAIN_DATUM_TOKEN_EMISSION_TYPE_ALGO type; value_start
and value_change_algo_codename
for DAP_CHAIN_DATUM_TOKEN_EMISSION_TYPE_ATOM_OWNER type; None
for DAP_CHAIN_DATUM_TOKEN_EMISSION_TYPE_SMART_CONTRACT and DAP_CHAIN_DATUM_TOKEN_EMISSION_TYPE_UNDEFINED type.
getterCellFrame.Common.DatumEmisson.signCount: int
Gets a count of signs.
getterCellFrame.Common.DatumEmisson.signCount: int
Gets a count of signs.
object methodCellFrame.Common.DatumEmisson.addSign(cert: DAP.Crypto.Cert) -> None
Adds a sign.
object methodCellFrame.Common.DatumEmisson.addTSD(type: int, data: bytes) -> None
Adds a Type-Size-Data section to a datum.
object methodCellFrame.Common.DatumEmisson.getTSD(type: int) -> bytes
Gets a Type-Size-Data section from a datum.
class CellFrame.Common.TxItemType
This class is a generator of a transaction item type. Using the following static functions, you can generate the required type.
Function | Returned Value |
---|---|
CellFrame.ChainTxItemType.TX_ITEM_TYPE_IN() |
0x00 |
CellFrame.ChainTxItemType.TX_ITEM_TYPE_OUT() |
0x10 |
CellFrame.ChainTxItemType.TX_ITEM_TYPE_PKEY() |
0x20 |
CellFrame.ChainTxItemType.TX_ITEM_TYPE_SIG() |
0x30 |
CellFrame.ChainTxItemType.TX_ITEM_TYPE_TOKEN() |
0x40 |
CellFrame.ChainTxItemType.TX_ITEM_TYPE_IN_COND() |
0x50 |
CellFrame.ChainTxItemType.TX_ITEM_TYPE_OUT_COND() |
0x60 |
CellFrame.ChainTxItemType.TX_ITEM_TYPE_RECEIPT() |
0x70 |
class CellFrame.Common.TxCondType
This class implements the chain transaction condition type object. Using the following static functions, you can generate the required type object.
static method CellFrame.Common.DatumTokenExt.COND_SERVICE_PROVIDE() -> CellFrame.ChainDatumTokenExt
Returns the ChainTxCondType
instanse.
static method CellFrame.ChainDatumTokenExt.COND_SERVICE_BILL() -> CellFrame.ChainDatumTokenExt
Returns the ChainTxCondType
instanse.
class CellFrame.Common.DatumTx
This class implements the chain datum transaction object.
object method CellFrame.Common.DatumTx.getSize() -> int
Gets a size of the instance. This function wraps a dap_chain_datum_tx_get_size
C function.
object method CellFrame.Common.DatumTx.addItem(item: int) -> int
Adds a item to transaction. Returns 1
if successful, otherwise -1
.
object method CellFrame.Common.DatumTx.addInItem(hashFast: CellFrame.HashFast, outPrefIndex: int) -> int
Create a in item and insert to the transaction. Returns 1
if successful, otherwise -1
.
object method CellFrame.Common.DatumTx.addInCondItem(hashFast: CellFrame.HashFast, outPrefIndex: int, receiptIndex: int) -> int
Creates a in condition item and inserts to the transaction. Returns 1
if successful, otherwise -1
.
object method CellFrame.Common.DatumTx.addOutItem(address: CellFrame.ChainAddr, outPrefIndex: , value: int) -> int
Creates an out item and inserts to the transaction. Returns 1
if successful, otherwise -1
.
object method CellFrame.Common.DatumTx.addOutCond(key: DAP.Crypto.CryptoKey, netSrvUid: CellFrame.Network.ServiceUID, value: int, valueMaxPerUnit: int, srvPriceUnitUid: CellFrame.Network.ServicePriceUnitUID, cond: bytes, condSize: int) -> int
Creates a out condition item and inserts to the transaction. Returns 1
if successful, otherwise -1
.
object method CellFrame.Common.DatumTx.addSignItem(key: DAP.Crypto.CryptoKey) -> int
Adds a sign item to the transaction. Returns 1
if successful, otherwise -1
.
object method CellFrame.Common.DatumTx.verifySign() -> int
Verifies all sign items in the transaction. Returns 1
if successful, otherwise 0
or less.
object method CellFrame.Common.DatumTx.getItems() -> list
Gets a list
object consisting of items.
attribute CellFrame.Common.DatumTx.hash: DAP.Crypto.HashFast
Gets the CellFrame.HashFast
object.
attribute CellFrame.Common.DatumTx.dateCreated: datetime.datetime
Gets the datetime.datetime
object corresponding to the time of datum creation.
class CellFrame.Common.TxOutCond
This class implements the chain out condition transaction object.
attribute CellFrame.Common.TxOutCond.tsExpires: datetime.datetime
Gets the datetime.datetime
object corresponding to the expire time.
attribute CellFrame.Common.TxOutCond.value: int
Gets a value of the inctance.
attribute CellFrame.Common.TxOutCond.typeSubtype: CellFrame.ChainTxOutCondSubType
Gets a condition subtype of the inctance.
class CellFrame.Common.TxOutCondSubTypeSrvPay
This class is subclass of CellFrame.ChainTxOutCond
class. It implements the chain transaction out condition object with a service pay condition subtype.
attribute CellFrame.Common.TxOutCondSubTypeSrvPay.unit: int
Gets the price unit that uses to check a maximum price.
attribute CellFrame.Common.TxOutCondSubTypeSrvPay.uid: CellFrame.ChainNetSrvUID
Gets the service uid that only could use for this conditioned outout.
attribute CellFrame.Common.TxOutCondSubTypeSrvPay.pkeyHash: CellFrame.ChainHashFast
Gets the public key hash that could use for this conditioned outout.
attribute CellFrame.Common.TxOutCondSubTypeSrvPay.maxPrice: int
Gets the maximum price per the unit.
class CellFrame.Common.TxOutCondSubTypeSrvStake
This class is subclass of CellFrame.Common.TxOutCond
class. It implements the chain transaction out condition object with a service stake condition subtype.
attribute CellFrame.Common.TxOutCondSubTypeSrvPay.uid: CellFrame.Network.ServiceUID
Gets the service uid that could use for this conditioned outout.
attribute CellFrame.Common.TxOutCondSubTypeSrvPay.addr: CellFrame.ChainAddr
Gets the fee address that could use for this conditioned outout.
attribute CellFrame.Common.TxOutCondSubTypeSrvPay.value: CellFrame.Chain.ChainAddr
Gets the percentage fee value in percent that could use for this conditioned outout.
class CellFrame.Common.TxOutCondSubtypeSrvXchange
This class is subclass of CellFrame.Common.TxOutCond
class. It implements the chain transaction out condition object with a service xchange condition subtype.
attribute CellFrame.Common.TxOutCondSubTypeSrvPay.uid: CellFrame.Network.ServiceUID
Gets the service uid that only could use for this conditioned outout.
attribute CellFrame.Common.TxOutCondSubTypeSrvPay.netId: CellFrame.Network.NetID
Gets the chain network to change that could use for this conditioned outout.
attribute CellFrame.Common.TxOutCondSubTypeSrvPay.token: str
Gets the token ticker to change that could use for this conditioned outout.
attribute CellFrame.Common.TxOutCondSubTypeSrvPay.value: int
Gets the total amount of datoshi to change that could use for this conditioned outout.
class CellFrame.Common.TxIn
This class implements the chain in transaction object.
attribute CellFrame.Common.TxIn.prevHash: CellFrame.HashFast
Gets the hash of the previous transaction.
attribute CellFrame.ChainTxIn.prevHash: CellFrame.prevIdx
Gets the previous tx_out index.
class CellFrame.Common.TxInCond
This class implements the chain in condition transaction object.
attribute CellFrame.Common.TxInCond.receiptPrevIdx: int
Gets the previous receipt index.
attribute CellFrame.Common.TxInCond.prevHash: CellFrame.HashFast
Gets the hash of the previous transaction.
attribute CellFrame.Common.TxInCond.outPrevIdx: int
Gets the previous tx_out index.
class CellFrame.Common.TxOut
This class implements the chain out transaction object.
attribute CellFrame.Common.TxIn.addr: CellFrame.ChainAddr
Gets the address.
attribute CellFrame.Common.nTxIn.value: int
Gets the value.
class CellFrame.Common.TxPkey
This class implements the chain transaction with public key object.
attribute CellFrame.Common.TxPkey.sigType: CellFrame.SignType
Gets the sign type.
attribute CellFrame.Common.TxPkey.sigSize: int
Gets the sign size.
attribute CellFrame.Common.TxPkey.sequenceNumber: int
Gets the sequence number.
attribute CellFrame.Common.TxPkey.pkey: CellFrame.Pkey
Gets the public key.
class CellFrame.Common.TxReceipt
This class implements the chain receipt transaction object.
attribute CellFrame.Common.TxReceipt.size: int
Gets the size.
attribute CellFrame.Common.TxReceipt.extSize: int
Gets the extension size.
attribute CellFrame.Common.TxReceipt.units: int
Gets the units of service.
attribute CellFrame.Common.TxReceipt.uid: int
Gets the service UID.
attribute CellFrame.Common.TxReceipt.unitsType: str
Gets the units type.
attribute CellFrame.Common.TxReceipt.value: int
Gets the value.
attribute CellFrame.Common.TxReceipt.provider: Optional[CellFrame.Sign]
Gets the provider sign.
attribute CellFrame.Common.TxReceipt.client: Optional[CellFrame.Sign]
Gets the client sign.
attribute CellFrame.Common.TxReceipt.sign(cert: DAP.Crypto.Cert) CellFrame.Common.TxReceipt
Adds a certificate to the transaction. REturns this transaction.
class CellFrame.Common.TxOutExt
This class implements the multichannel chain out transaction object.
attribute CellFrame.Common.TxOutExt.addr: CellFrame.ChainAddr
Gets the address.
attribute CellFrame.Common.TxOutExt.token: str
Gets the token.
attribute CellFrame.Common.TxOutExt.value: int
Gets the value.
class CellFrame.Common.CustomDatum
This class implements the custom datum object.
static method CellFrame.Common.CustomDatum.create(chain: CellFrame.Chain.Chain, data: bytes) -> str
Creates a custom datum.
static method CellFrame.Common.CustomDatum.read(path: str) -> bytes
Reads data from a disk for a custom datum.