Skip to content

Quickstart

Usage patterns

Install package

bash
pip install saline-sdk

Initialise the Client

python
from saline_sdk.rpc.client import Client
RPC_URL = "https://node1.try-saline.com"
rpc = Client(http_url=RPC_URL)

Manage Accounts

python
TEST_MNEMONIC = "excuse ozone east canoe duck tortoise dentist approve bid wagon area funny"
account = Account.from_mnemonic(TEST_MNEMONIC)
# Derive subaccounts for operations
wallet = account.create_subaccount(label="sender")

Check Balances

python
wallet_info = await rpc.get_wallet_info_async(wallet.public_key)
print(f"Balancer: {wallet_info.balances}")

Testnet Faucet

python
from saline_sdk.rpc.testnet.faucet import top_up

# tops up with mixed bag: "BTC": 1, "ETH": 10, "USDC": 1000, "USDT": 1000, "SALT": 1000
await top_up(account=wallet, client=rpc)

Installing Intents

python

restricted_intent = Counterparty(trusted.public_key) & (Receive(Token.SALT) >= 10)
set_intent_instruction = SetIntent(wallet.public_key, restricted_intent)

tx = Transaction(instructions=NonEmpty.from_list([set_intent]))
tx_result = await rpc.tx_commit(prepareSimpleTx(wallet, tx))

Creating and Sending Transactions

python

transfer_instruction = transfer(
        sender=wallet.public_key,
        recipient=receiver.public_key,
        token="USDC",
        amount=20
    )

tx = Transaction(instructions=NonEmpty.from_list([transfer_instruction]))
result = await rpc.tx_broadcast(prepareSimpleTx(wallet,tx))

Developers

Setup for Development

bash
# Clone the repository
git clone https://github.com/risingsealabs/saline-sdk.git
cd saline-sdk

# Create a virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
poetry install

Running Tests

bash
# Run all tests
poetry run pytest -v

# Run specific test modules
poetry run pytest -v tests/unit/transaction/test_simple_transfer.py

# Run tests with coverage report
poetry run pytest -v --cov=saline_sdk