Transaction Policy

The Transaction Policy (TP) module ensures secure and customizable transaction controls for users by integrating features like whitelisting and time delays.

1. getCurrentPolicy

The getCurrentPolicy() method retrieves the current transaction policy configuration. This includes details about the whitelisted addresses, time limits, and whether the policy is enabled.

Example:

    fun main() {
        // Retrieve the current transaction policy
        val resPolicy = getCurrentPolicy()
    }

2. enablePolicy

The enablePolicy() method allows updating the settings of a transaction policy. This method supports enabling/disabling the policy - enabled: A flag to enable or disable the transaction policy. - force: A flag to enable the turning- off mode (default is false) Example:

    fun main() {
        val force = false
        val enablePolicy = true
        // Update the Transaction Policy
        val updatedPolicy = enablePolicy(enabled, force)

        // Handle the response
        println("Transaction Policy Updated: $updatedPolicy")
    }

3. disablePolicy

The disablePolicy() method allows updating the settings of a transaction policy. This method supports enabling/disabling the policy

Example:

4. addWalletAddress

The addWalletAddress() method allows you to add a recipient’s wallet address to the whitelist. - address: The recipient's wallet address that you want to whitelist. - networkChain: the chain of wallet - labels: the alias of wallet

Example:

5. removeWalletAddress

The removeWalletAddress() method removes a specified address from the whitelist. - walletId: The whitelist wallet id

Example:

6. updateWalletAddress

The updateWalletAddress() method update a specified address from the whitelist. - walletId: The whitelist wallet id - labels: the alias of wallet

Example:

7. getTransactionAmountLimit

The getTransactionAmountLimit() method retrieves the current transaction limit policy.

Example:

8. updateTransactionAmountLimit

The updateTransactionAmountLimit() method updates the transaction amount limit with the specified parameters.

Example:


9. updateTransactionLimitPolicyForSpecificAddress

The updateTransactionLimitPolicyForSpecificAddress() method sets or updates the transaction limits for a specific address. The new limits must adhere to the global limits, and increasing the limits may trigger a security delay (whitelisting process).

  • Parameters:

    • address: The wallet address for which the limits are being set.

    • networkChain: The blockchain network identifier.

    • perTransactionLimit: The maximum allowed amount for a single transaction for this address.

    • dailyLimit: The maximum allowed cumulative amount per day for this address.

    • enable: A flag indicating whether the limits for this address should be enabled.

Example:


10. getTransactionCurrentUsage

The getTransactionCurrentUsage() method retrieves a snapshot of the current day's transaction usage, including both global totals and address-specific details.

Example:


11. checkAmountWithPolicy

The checkAmountWithPolicy() method validates whether a given transaction amount (in USD) complies with the current transaction policy limits for a specific address.

  • Parameters:

    • amountInUsd: The transaction amount in USD.

    • address: The wallet address for the transaction.

    • networkChain: The blockchain network identifier.

Example:


12. recordTransactionDailyUsage

The recordTransactionDailyUsage() method records a transaction for daily usage tracking. It updates the cumulative total, records the status, and automatically resets if a new day begins.

  • Parameters:

    • address: The wallet address from which the transaction originated.

    • networkChain: The blockchain network identifier.

    • amount: The transaction amount.

    • status: The transaction status (e.g., SUCCESS, FAILED, or UNKNOWN).

Example:

Last updated