Skip to content

sgns::MintTransactionV2

Implements a Mint Version 2 transaction.

#include <MintTransactionV2.hpp>

Inherits from sgns::GeniusTransaction

Public Functions

Name
virtual EmbeddedTransaction SerializeToEmbeddedTransaction(const SGTransaction::DAGStruct & dag) const override
Serializes the transaction into an EmbeddedTransaction proto with the appropriate oneof field set.
~MintTransactionV2() override =default
Destroy the Mint Transaction V 2 object.
virtual std::vector< uint8_t > SerializeByteVector(const SGTransaction::DAGStruct & dag) const override
Serializes the transaction.
uint64_t GetAmount() const
Get the amount of the mint.
TokenID GetTokenID() const
Get the Token ID.
virtual std::string GetChainId() const override
Get source chain identifier for bridge mint validation routing.
UTXOTxParameters GetUTXOParameters() const
Returns the UTXOs.
virtual bool HasUTXOParameters() const override
Returns if transaction supports UTXOs.
virtual std::optional< UTXOTxParameters > GetUTXOParametersOpt() const override
Returns the UTXOs.
virtual std::string GetTransactionSpecificPath() const override
Gets the transaction specific path.
virtual std::unordered_set< std::string > GetTopics() const override
Returns the topics of interest of this transaction.
virtual std::string GetSlotID() const override
Generates a slot ID for consensus slot key determination.
std::vector< uint8_t > SerializeByteVector() const
Serializes the transaction using the internal DAG metadata.
EmbeddedTransaction SerializeToEmbeddedTransaction() const
Serializes using internal DAG metadata.
std::shared_ptr< MintTransactionV2 > DeSerializeByteVector(const std::vector< uint8_t > & data)
Deserializes a MintV2 serialized byte vector into an object.
MintTransactionV2 New(uint64_t new_amount, std::string chain_id, TokenID token_id, SGTransaction::DAGStruct dag, std::vector< InputUTXOInfo > mint_inputs, std::string mint_destination)
Creates a new MintV2 transaction.

Additional inherited members

Public Types inherited from sgns::GeniusTransaction

Name
using std::function< std::shared_ptr< GeniusTransaction >(const std::vector< uint8_t > &)> TransactionDeserializeFn
Alias for the de-serializer method type to be implemented in derived classes.

Public Functions inherited from sgns::GeniusTransaction

Name
GeniusTransaction(std::string type, SGTransaction::DAGStruct dag)
Constructs a GeniusTransaction with the specified type and DAG metadata.
virtual ~GeniusTransaction() =default
Virtual destructor to avoid leakage when deleting derived classes through a base pointer.
std::string GetType() const
Returns the transaction type.
std::string GetTransactionFullPath() const
Returns the full storage path for the transaction based on its hash.
std::string GetProofFullPath() const
Returns the full storage path for the proof based on the transaction hash.
std::string GetSrcAddress() const
Returns the source address for the transaction.
std::string GetHash() const
Returns the hash of the transaction.
std::string GetPreviousHash() const
Returns the hash of the previous transaction.
std::string GetUncleHash() const
Returns the hash of the uncle transaction.
uint64_t GetTimestamp() const
Returns the timestamp of the transaction.
uint64_t GetNonce() const
Returns the nonce of the transaction.
void FillHash()
Fills the data hash field in the DAG metadata based on the transaction content.
bool CheckHash() const
Checks the integrity of the transaction by verifying that the hash field matches the calculated hash.
std::vector< uint8_t > MakeSignature(GeniusAccount & account)
Creates a signature for the transaction using the provided GeniusAccount.
bool CheckSignature() const
Verifies the transaction signature using the source address and the serialized transaction content.
bool CheckDAGSignatureLegacy() const
Legacy method to verify the transaction signature using the DAG metadata. This method may be used for backward compatibility with older transaction formats.
outcome::result< SGTransaction::DAGStruct > DeSerializeDAGStruct(const std::vector< uint8_t > & data)
Deserializes the DAG metadata from a byte vector.
outcome::result< SGTransaction::DAGStruct > DeSerializeDAGStruct(const std::string & data)
Deserializes the DAG metadata from a string.
SGTransaction::DAGStruct SetDAGWithType(SGTransaction::DAGStruct dag, const std::string & type)
Sets the transaction type in the DAG metadata and returns the modified DAGStruct.
std::string GetTransactionFullPath(const std::string & tx_hash)
Returns the full storage path for the transaction based on its hash.
void RegisterDeserializer(const std::string & transaction_type, TransactionDeserializeFn fn)
Registers a deserializer function for a specific transaction type.
std::unordered_map< std::string, TransactionDeserializeFn > & GetDeSerializers()
Returns the map of registered deserializer functions for transaction types.

Public Attributes inherited from sgns::GeniusTransaction

Name
std::string_view GENIUS_CHAIN_ID
The chain ID used for transactions that are not associated with a specific external chain.
SGTransaction::DAGStruct dag_st
The DAG metadata struct that is included in all transactions, containing common fields such as source address, hashes, timestamp, nonce, and signature.

Public Functions Documentation

function SerializeToEmbeddedTransaction

virtual EmbeddedTransaction SerializeToEmbeddedTransaction(
    const SGTransaction::DAGStruct & dag
) const override

Serializes the transaction into an EmbeddedTransaction proto with the appropriate oneof field set.

Parameters:

  • dag The DAG metadata to be included in the serialization.

Return: EmbeddedTransaction proto with the typed transaction field set.

Reimplements: sgns::GeniusTransaction::SerializeToEmbeddedTransaction

function ~MintTransactionV2

~MintTransactionV2() override =default

Destroy the Mint Transaction V 2 object.

function SerializeByteVector

virtual std::vector< uint8_t > SerializeByteVector(
    const SGTransaction::DAGStruct & dag
) const override

Serializes the transaction.

Return: The serialized byte vector

Reimplements: sgns::GeniusTransaction::SerializeByteVector

function GetAmount

uint64_t GetAmount() const

Get the amount of the mint.

Return: The amount of tokens minted

function GetTokenID

TokenID GetTokenID() const

Get the Token ID.

Return: The ID which identifies what token was minted

function GetChainId

virtual std::string GetChainId() const override

Get source chain identifier for bridge mint validation routing.

Return: Source chain id

Reimplements: sgns::GeniusTransaction::GetChainId

function GetUTXOParameters

UTXOTxParameters GetUTXOParameters() const

Returns the UTXOs.

Return: The UTXOs of the MintV2 transaction

function HasUTXOParameters

virtual bool HasUTXOParameters() const override

Returns if transaction supports UTXOs.

Return: True if supported, false otherwise

Reimplements: sgns::GeniusTransaction::HasUTXOParameters

function GetUTXOParametersOpt

virtual std::optional< UTXOTxParameters > GetUTXOParametersOpt() const override

Returns the UTXOs.

Return: If exists, returns the UTXOs of the transaction

Reimplements: sgns::GeniusTransaction::GetUTXOParametersOpt

function GetTransactionSpecificPath

inline virtual std::string GetTransactionSpecificPath() const override

Gets the transaction specific path.

Return: Returns the transaction specific path

Reimplements: sgns::GeniusTransaction::GetTransactionSpecificPath

function GetTopics

virtual std::unordered_set< std::string > GetTopics() const override

Returns the topics of interest of this transaction.

Return: A set of topics

Reimplements: sgns::GeniusTransaction::GetTopics

function GetSlotID

virtual std::string GetSlotID() const override

Generates a slot ID for consensus slot key determination.

Return: Deterministic slot key derived from chain/token/amount/dest/burn_tx_hash.

Reimplements: sgns::GeniusTransaction::GetSlotID

function SerializeByteVector

inline std::vector< uint8_t > SerializeByteVector() const

Serializes the transaction using the internal DAG metadata.

Return: The serialized byte vector representing the transaction.

function SerializeToEmbeddedTransaction

inline EmbeddedTransaction SerializeToEmbeddedTransaction() const

Serializes using internal DAG metadata.

function DeSerializeByteVector

static std::shared_ptr< MintTransactionV2 > DeSerializeByteVector(
    const std::vector< uint8_t > & data
)

Deserializes a MintV2 serialized byte vector into an object.

Parameters:

  • data The serialized MintV2 data

Return: A shared pointer to a MintV2 object

function New

static MintTransactionV2 New(
    uint64_t new_amount,
    std::string chain_id,
    TokenID token_id,
    SGTransaction::DAGStruct dag,
    std::vector< InputUTXOInfo > mint_inputs,
    std::string mint_destination
)

Creates a new MintV2 transaction.

Parameters:

  • new_amount The amount to be minted
  • chain_id The chain ID from where the mint came from
  • token_id The token ID
  • dag The DAG structure with the common transaction data
  • mint_inputs Explicit input references for the source-chain burn(s)
  • mint_destination The destination of the Mint

Return: A MintTransactionV2


Updated on 2026-06-05 at 17:22:18 -0700