Skip to content

Simple Usecases

These simple examples show how Saline Mandates can be used to enforce on-chain logic for asset interactions. Each use case is fully enforceable without smart contracts, using Saline’s SDK, UI, or LLM interfaces.

Block Assets from Being Used by a Matcher

A user holds multiple assets, including 3 BTC, in their Saline asset address. They want to block any transaction that uses their BTC, while allowing other assets to be used freely.

Mandate Logic:BTC balance >= 3.0

This ensures that no transaction can reduce the BTC balance below 3.0, effectively locking it.

Scenario:

  • User A installs a mandate that restricts its BTC balance to always stay above 3

  • Matcher A attempts to transfer 1 BTC → ❌ REJECTED

  • Matcher A transfers 2 ETH → ✅ ACCEPTED


Key Code Snippet:

Sometimes you want only one trusted agent to interact with your assets. This is how you install a whitelist mandate using the SDK:

python
from saline_sdk.transaction.bindings import Balance, Token, SetIntent

# Require BTC balance to always stay >= 3
restricted_intent = (Balance(Token.BTC) >= 3)
set_intent = SetIntent(wallet.public_key, restricted_intent)
  • Balance(Token.BTC) >= 3 — creates a rule that blocks any transaction if it would drop BTC below 3.0.

  • SetIntent(...) — attaches the rule to your asset address.

Try it yourself: See the full code on GitHub for how to build and submit this intent in a full transaction. GitHub code

Only Allow Interaction with a Whitelisted Counterparty

Saline lets many agents interact with an asset, but sometimes you only want a specific agent to transact on your behalf.

Mandate Logic:

json
Counterparty is
nacl:0xa076e5c4bcb3dc469ddbc8259a352d9a8c30ae1a37dd7ade5f426afec692d8649318d852dee8b967c8c698596dd14541

Scenario:

  • User B creates a mandate that whitelists only Matcher/Agent XYZ.

  • Agent XYZ transfers ETH/BTC from User B address → ✅ ACCEPTED

  • Any other agent attempts to transfer asset from User B → ❌ REJECTED


Key Code Snippet:

This is how you install a whitelist mandate using the SDK:

python
from saline_sdk.transaction.bindings import Counterparty, SetIntent

trusted_address = "a076e...d14541"
rule = Counterparty(trusted_address)
intent = SetIntent(wallet.public_key, rule)
  • Counterparty(...) — creates a rule that only this address is allowed to interact with your asset.

  • SetIntent(...) — links the rule to your asset address.

  • This intent can now be submitted as a transaction to enforce it on-chain.

Try it yourself: See the full code in our repo for how to build and submit this intent in a full transaction. GitHub code

Conditional Swap: 0.5 BTC for ≥10 ETH with ABC Only

Limit orders are simple. But on Saline, you can go beyond that by layering custom logic, including counterparty restrictions and usage limits.

This example allows the user to swap 0.5 BTC for at least 10 ETH, but only once, and only with counterparty ABC.

Mandate Logic:

json
  "type": "all",
  "rules": [
    {
      "counterparty": "nacl:0xABC"
    },
    {
      "limit": 1
    },
    {
      "type": "all",
      "rules": [
        { "BTC_out": 0.5 },
        { "ETH_in": ">= 10.0" }
      ]
    }
  ]

Scenario:

  • User C creates an intent: “Only swap 1 BTC for ETH >= 20, agent must be ABC and allow once”

  • Matcher ABC proposes 2 BTC → ❌ REJECTED

  • Matcher XYZ proposes 1 BTC for 20 ETH → ❌ REJECTED

  • Matcher ABC proposes 1 BTC for 20 ETH → ✅ ACCEPTED


Key Code Snippet

python
from saline_sdk.transaction.bindings import (
    Restriction, Relation, Lit, Token, Send, Receive,
    All, Finite, Counterparty, SetIntent
)

# 1. Define swap conditions
base = All([
    Restriction(Send(Token["BTC"]), Relation.EQ, Lit(0.5)),       # Send exactly 0.5 BTC
    Restriction(Receive(Token["ETH"]), Relation.GE, Lit(10))      # Receive at least 10 ETH
])

# 2. Limit to 1 execution
limited = Finite(1, base)

# 3. Only allow from trusted counterparty
trusted_address = "a4af25...d0f53"
intent = Counterparty(trusted_address) & limited

# 4. Attach the mandate to your wallet
set_intent = SetIntent(wallet.public_key, intent)
  • All([...]) — combines multiple rules: you must send 0.5 BTC and receive ≥10 ETH.

  • Finite(1, ...) — enforces the rule only once. After one successful swap, it expires.

  • Counterparty(...) & ... — adds a counterparty whitelist: only trusted address can fill this order.

  • SetIntent(...) — applies the mandate to your asset address.

Try it yourself: This creates a programmable OTC order enforced on-chain, with no smart contract needed. GitHub code