SOMA SDK

raw JSON →
0.1.15 verified Fri May 01 auth: no python

Python SDK for the SOMA network, enabling interaction with the SOMA blockchain, wallet management, and transaction building. Current version is 0.1.15, with active development on testnet-v0.1.21. Release cadence is rapid, with frequent patch releases.

pip install soma-sdk
error ModuleNotFoundError: No module named 'soma_sdk'
cause Incorrect import name: the correct module is 'somasdk' (no underscore).
fix
Install: pip install soma-sdk Import: import somasdk or from somasdk import ...
error ImportError: cannot import name 'Wallet' from 'somasdk'
cause The SDK version is too old (pre-0.1.0) or the class is in a submodule.
fix
Upgrade: pip install --upgrade soma-sdk Then: from somasdk import Wallet.
error AttributeError: 'SomaClient' object has no attribute 'get_balance'
cause The method was renamed to `get_balance_v2` in testnet-v0.1.20.
fix
Use client.get_balance_v2(address) for version >=0.1.20.
error somasdk.exceptions.UnauthorizedError: 401 Client Error: Unauthorized
cause Missing or invalid auth token when connecting to a private node.
fix
Set the SOMA_AUTH_TOKEN environment variable or pass headers to SomaClient.
gotcha The SDK uses `somasdk` as the package name, not `soma_sdk`. The PyPI distribution is `soma-sdk` but imports use `somasdk`.
fix Use `import somasdk` or `from somasdk import ...`.
breaking The `SomaClient` constructor changed in testnet-v0.1.18: `api_key` parameter removed; authentication is now via `auth_token` header.
fix Update code to use `headers={'Authorization': f'Bearer {token}'}` instead of `api_key`.
deprecated `Wallet.from_mnemonic()` is deprecated in favor of `Wallet.from_phrase()`.
fix Replace `Wallet.from_mnemonic(mnemonic)` with `Wallet.from_phrase(mnemonic)`.
gotcha Node URLs must include `http://` or `https://` prefix; otherwise silent failure.
fix Always include scheme: `https://testnet.soma.org`.

Basic usage: create a client and generate a wallet.

import os
from somasdk import SomaClient, Wallet

# Initialize client (no auth required for public testnet)
client = SomaClient(node_url=os.environ.get('SOMA_NODE_URL', 'https://testnet.soma.org'))

# Create a new wallet
wallet = Wallet.generate()
print("Address:", wallet.address)
print("Mnemonic:", wallet.mnemonic)

# Get balance
balance = client.get_balance(wallet.address)
print("Balance:", balance)