Skip to main content

Wallet Rules

Wallet rules define automated behaviors and transfer limits for wallets. Each rule is scoped to a specific wallet, network, and network currency.

Rule Types

TypeValueDescription
Auto Transferauto_transferAutomatically transfers funds based on conditions
Permissionless Transfer Limitpermissionless_transfer_limitLimits the amount that can be transferred without approval

Wallet Rule Model

FieldTypeDescription
idstring (UUID)Unique rule identifier
created_by_user_idstring (UUID)User who created the rule
wallet_idstring (UUID)Wallet this rule applies to
namestringRule name
typestringRule type (auto_transfer or permissionless_transfer_limit)
network_idstring (UUID)Network this rule applies to
network_currency_idstring (UUID)Currency this rule applies to
priorityintegerRule priority (1-100)
auto_transfer_typestring | nullAuto-transfer sub-type (see below)
auto_transfer_idstring (UUID) | nullAuto-transfer rule detail ID
auto_transfer_target_wallet_idstring (UUID) | nullTarget wallet for auto-transfers
sign_and_approve_rule_idstring (UUID) | nullSign-and-approve rule detail ID
permissionless_transfer_limit_idstring (UUID) | nullPermissionless transfer limit detail ID
created_atstring (ISO 8601)Creation timestamp
updated_atstring (ISO 8601)Last update timestamp
deleted_atstring (ISO 8601) | nullSoft deletion timestamp

Auto-Transfer Rules

Auto-transfer rules define conditions under which funds are automatically moved between wallets.

Auto-Transfer Sub-Types

ValueDescription
autoFully automatic -- transfers execute without any user intervention
auto_with_approveAutomatic with approval -- transfers require user approval before execution
auto_with_signAutomatic with signing -- transfers require cryptographic signing
approveApproval only -- requires manual approval to trigger
signSign only -- requires cryptographic signing to trigger

RuleLogic Structure

The rule_logic field defines the conditions for triggering an auto-transfer. It is a recursive tree structure using logical operators (AND/OR) and leaf conditions.

Operator Node

Groups multiple conditions with a logical operator.

{
"operator": "AND",
"conditions": [
{ "...condition or nested operator..." },
{ "...condition or nested operator..." }
],
"network_currency_id": "880e8400-e29b-41d4-a716-446655440000"
}
FieldTypeRequiredDescription
operatorstringNoAND or OR (defaults to AND if omitted)
conditionsarrayYes (for operators)Array of nested conditions or operators
network_currency_idstring (UUID)YesCurrency context for evaluation

Leaf Condition

A single comparison condition.

{
"field": "target.balance",
"op": "<",
"value": 100,
"network_currency_id": "880e8400-e29b-41d4-a716-446655440000"
}
FieldTypeRequiredDescription
fieldstringYes (for leaves)Field to check (see valid fields below)
opstringYes (for leaves)Comparison operator: =, <, >
valueanyYes (for leaves)Value to compare against
network_currency_idstring (UUID)YesCurrency context for evaluation

Valid Fields

ValueDescription
target.balanceTarget wallet balance

Valid Operators

ValueDescription
=Equal to
<Less than
>Greater than

RuleLogic Examples

Simple condition -- transfer when target balance drops below 100:

{
"field": "target.balance",
"op": "<",
"value": 100,
"network_currency_id": "880e8400-e29b-41d4-a716-446655440000"
}

AND condition -- transfer when balance is below 100 AND above 0:

{
"operator": "AND",
"conditions": [
{
"field": "target.balance",
"op": "<",
"value": 100,
"network_currency_id": "880e8400-e29b-41d4-a716-446655440000"
},
{
"field": "target.balance",
"op": ">",
"value": 0,
"network_currency_id": "880e8400-e29b-41d4-a716-446655440000"
}
],
"network_currency_id": "880e8400-e29b-41d4-a716-446655440000"
}

Nested conditions -- complex multi-currency logic:

{
"operator": "OR",
"conditions": [
{
"field": "target.balance",
"op": "<",
"value": 50,
"network_currency_id": "880e8400-e29b-41d4-a716-446655440000"
},
{
"operator": "AND",
"conditions": [
{
"field": "target.balance",
"op": "<",
"value": 200,
"network_currency_id": "880e8400-e29b-41d4-a716-446655440001"
},
{
"field": "target.balance",
"op": ">",
"value": 10,
"network_currency_id": "880e8400-e29b-41d4-a716-446655440001"
}
],
"network_currency_id": "880e8400-e29b-41d4-a716-446655440001"
}
],
"network_currency_id": "880e8400-e29b-41d4-a716-446655440000"
}

Sign and Approve Rules

Sign-and-approve rules define who can approve auto-transfer transactions and how many approvals are needed.

FieldTypeRequiredDescription
mandatory_user_idstring (UUID) | nullNoA specific user who MUST approve (in addition to others)
min_priorityinteger | nullNoMinimum role priority required to approve (1-100)
max_priorityinteger | nullNoMaximum role priority allowed to approve (1-100)
min_user_countinteger | nullNoMinimum number of unique approvals required (min: 1)
note

At least one field must be set. If both min_priority and max_priority are set, min_priority must be less than or equal to max_priority.


Permissionless Transfer Limit Rules

These rules cap the total amount that can be transferred from a wallet within a rolling time window without requiring approval.

FieldTypeRequiredDescription
max_amountintegerYesMaximum transfer amount allowed in the time window (must be > 0)
time_periodstringYesTime period unit (see below)
time_period_valueintegerYesNumber of time periods (must be > 0)

Time Period Values

ValueDescription
hourHourly window
dayDaily window
weekWeekly window
monthMonthly window (30 days)
yearYearly window (365 days)

Example: max_amount: 1000, time_period: "day", time_period_value: 1 means "max 1000 units per day".


Endpoints

MethodPathDescription
POST/v1/wallets/{wallet_id}/rulesCreate a wallet rule
GET/v1/wallets/{wallet_id}/rulesList wallet rules
GET/v1/wallets/{wallet_id}/rules/{id}Get wallet rule detail
PUT/v1/wallets/{wallet_id}/rules/{id}Update a wallet rule