Transaction Policy
Last updated
Last updated
The module ensures secure and customizable transaction controls for users by integrating features like whitelisting and time delays.
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:
The enablePolicy()
method allows enabling/disabling of a transaction policy. - enabled: A flag to enable or disable the transaction policy. - force: A flag to enable the turning- off mode (default is false)
Example:
The disablePolicy()
method allows disable transaction policy.
Example:
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:
The removeWalletAddress()
method removes a specified address from the whitelist. - walletId: The whitelist wallet id
Example:
The updateWalletAddress()
method update a specified address from the whitelist. - walletId: The whitelist wallet id - labels: the alias of wallet
Example:
The getTransactionAmountLimit()
method retrieves the current transaction amount limit policy.
Returns: The current TransactionLimitPolicy
object.
Throws: An error if the retrieval process fails.
Example:
The updateTransactionAmountLimit()
method updates the transaction amount limit policy with new parameters.
Parameters:
perTransactionLimit
: The maximum allowed amount per transaction.
dailyLimit
: The maximum cumulative amount allowed per day.
enable
: A Boolean indicating whether the transaction limit policy should be enabled.
Throws: An error if updating the transaction amount limit fails.
Example:
Description: Updates the transaction amount limit for a specific wallet address and its associated network chain. The new limits must not exceed the corresponding global limits. Increases may be staged (subject to a security delay or whitelisting process), while reductions take effect immediately.
Parameters:
address
: The wallet address whose limits are being updated.
networkChain
: The blockchain network identifier (e.g., "1" for Ethereum).
perTransactionLimit
: The new maximum allowed amount for a single transaction for this address.
dailyLimit
: The new maximum cumulative amount allowed per day for this address.
enable
: A Boolean indicating whether the new limits should be enabled.
Throws: An error if the update operation fails.
Example:
Description: Retrieves the current snapshot of daily transaction usage. This includes global usage totals as well as detailed usage statistics per wallet address.
Returns:
A TransactionCurrentUsage
object containing today's transaction usage details.
Throws: An error if the operation fails.
Example:
Description: Records a transaction for daily usage tracking. It logs the transaction amount, status, and associated wallet information. Daily counters are automatically reset when the day changes.
Parameters:
address
: The wallet address from which the transaction originated.
networkChain
: The blockchain network identifier.
amount
: The transaction amount.
status
: The status of the transaction (e.g., "SUCCESS"
, "FAILED"
, or "UNKNOWN"
).
Returns:
A TransactionRecordResponse
object containing updated usage totals and the recorded date.
Throws: An error if the operation fails.
Example:
Description: Validates whether a given transaction amount in USD complies with the current global and address-specific limits defined by the active policy.
Parameters:
amountInUsd
: The transaction amount in USD.
address
: The wallet address associated with the transaction.
networkChain
: The blockchain network identifier.
Returns: A Boolean value indicating if the transaction amount is within the allowed limits.
Throws: An error if the validation operation fails.
Example: