Bindings

Note

The bindings module is auto-generated from the Saline blockchain’s codebase. This documentation is applied at documentation build time and does not modify the original source code.

Python bindings for the Saline blockchain transaction types and operations.

This module is auto-generated from the Saline codebase and provides the necessary classes and functions to interact with the Saline blockchain at a low level.

The module includes: - Data structures for transactions, instructions, and intents - Serialization and deserialization functions - Enumeration types for tokens, relations, etc.

class saline_sdk.transaction.bindings.All(children)[source]

Bases: Intent

An intent that requires all child intents to be satisfied.

This is similar to an AND logical operation for intents.

Parameters:

children (list[Intent])

children

List of child intents that must all be satisfied

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (All)

class saline_sdk.transaction.bindings.AllW(children)[source]

Bases: Witness

A witness for an All intent

Parameters:

children (list[Witness])

children

List of child witnesses

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (AllW)

class saline_sdk.transaction.bindings.Any(threshold, children)[source]

Bases: Intent

An intent that requires a threshold number of child intents to be satisfied.

Parameters:
threshold

Minimum number of child intents that must be satisfied

children

List of child intents

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Any)

class saline_sdk.transaction.bindings.AnyW(children)[source]

Bases: Witness

A witness for an Any intent. Should have exactly as many children as the required threshold

Parameters:

children (dict[uint64, Witness])

children

Dictionary of child witnesses keyed by the index of the matching intent

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (AnyW)

class saline_sdk.transaction.bindings.Arithmetic(*values)[source]

Bases: Enum

Enumeration of arithmetic operations used in expressions.

Members:

Add: Addition (+) Div: Division (/) Mul: Multiplication (*) Sub: Subtraction (-)

static from_json(s)[source]
static to_json(x)[source]
Parameters:

x (Arithmetic)

Add = 0
Div = 1
Mul = 2
Sub = 3
class saline_sdk.transaction.bindings.Arithmetic2(lhs, operation, rhs)[source]

Bases: Expr

An arithmetic operation between two expressions.

Parameters:
lhs

Left-hand side expression

operation

The arithmetic operation type

rhs

Right-hand side expression

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Arithmetic2)

class saline_sdk.transaction.bindings.AutoW[source]

Bases: Witness

A witness to prove validation of trivial or unambiguous intents

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (AutoW)

class saline_sdk.transaction.bindings.Balance(token)[source]

Bases: Expr

Parameters:

token (Token)

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Balance)

class saline_sdk.transaction.bindings.Bridge(bridgedAccount, instruction)[source]

Bases: Instruction

An instruction to perform a bridge operation.

Parameters:
bridgedAccount

The account involved in the bridge operation

instruction

The bridge instruction to execute

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Bridge)

class saline_sdk.transaction.bindings.BridgeInstruction[source]

Bases: object

Base class for bridge instructions in the Saline blockchain.

Bridge instructions allow interaction with other blockchains.

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (BridgeInstruction)

class saline_sdk.transaction.bindings.Burn(token, amount)[source]

Bases: BridgeInstruction

A bridge instruction to burn tokens.

Parameters:
  • token (Token)

  • amount (float64)

token

The token type to burn

amount

The amount to burn

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Burn)

class saline_sdk.transaction.bindings.Counterparty(address)[source]

Bases: Intent

Parameters:

address (G2Element)

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Counterparty)

class saline_sdk.transaction.bindings.Delete(host)[source]

Bases: Instruction

An instruction to reset an account to the default intent.

Parameters:

host (G2Element)

host

The account whose intent will be deleted

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Delete)

class saline_sdk.transaction.bindings.Expr[source]

Bases: object

Base class for expressions in the Saline blockchain.

Expressions represent values, variables, calculations, as well as references to data from transactions, wallets or oracles, that can be evaluated at the time of verification.

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Expr)

class saline_sdk.transaction.bindings.Finite(uses, inner)[source]

Bases: Intent

Parameters:
  • uses (uint64)

  • inner (Intent)

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Finite)

class saline_sdk.transaction.bindings.Instruction[source]

Bases: object

Base class for instructions in the Saline blockchain.

Instructions are the fundamental operations that can be performed in transactions.

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Instruction)

class saline_sdk.transaction.bindings.Intent[source]

Bases: object

Base class for intents in the Saline blockchain.

Intents represent conditions or requirements that must be satisfied for a transaction to be valid.

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Intent)

class saline_sdk.transaction.bindings.Lit(value)[source]

Bases: Expr

A literal value expression.

Parameters:

value (Any)

value

The literal value (number, string, etc.)

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Lit)

class saline_sdk.transaction.bindings.Mint(prover, token, amount)[source]

Bases: BridgeInstruction

A bridge instruction to mint tokens.

Parameters:
  • prover (G2Element)

  • token (Token)

  • amount (float64)

prover

The account that proves the minting operation

token

The token type to mint

amount

The amount to mint

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Mint)

class saline_sdk.transaction.bindings.NonEmpty(head, tail)[source]

Bases: Generic

A non-empty list type that guarantees at least one element.

This type is used in many Saline data structures where an empty collection is invalid, such as transaction instructions or signers lists.

list

The internal standard python list

Initialize a new NonEmpty collection.

Parameters:
  • head (TypeVar(T)) – The first element of the collection

  • tail (list[TypeVar(T)]) – A list of additional elements

static from_json(x)[source]
static from_list(elements)[source]

Create a NonEmpty collection from a regular list.

Parameters:

elements (list[TypeVar(T)]) – A list with at least one element

Returns:

A new NonEmpty collection

Raises:

ValueError – If the input list is empty

static to_json(x)[source]
Parameters:

x (NonEmpty)

__init__(head, tail)[source]

Initialize a new NonEmpty collection.

Parameters:
  • head (TypeVar(T)) – The first element of the collection

  • tail (list[TypeVar(T)]) – A list of additional elements

class saline_sdk.transaction.bindings.OrIntent(host, intent)[source]

Bases: Instruction

An instruction to add to, rather than replace an account’s intent. For instance, to post multiple limit orders.

Parameters:
  • host (G2Element)

  • intent (Intent)

host

The account to add the intent to

intent

The intent to add

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (OrIntent)

class saline_sdk.transaction.bindings.Receive(token)[source]

Bases: Expr

An expression representing the amount of tokens received

Parameters:

token (Token)

token

The selected token

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Receive)

class saline_sdk.transaction.bindings.Relation(*values)[source]

Bases: Enum

Enumeration of comparison relations used in conditional expressions.

Members:

EQ: Equal to (==) LT: Less than (<) LE: Less than or equal to (<=) GT: Greater than (>) GE: Greater than or equal to (>=)

static from_json(s)[source]
static to_json(x)[source]
Parameters:

x (Relation)

EQ = 0
GE = 4
GT = 3
LE = 2
LT = 1
class saline_sdk.transaction.bindings.Restriction(lhs, relation, rhs)[source]

Bases: Intent

An intent that enforces a specific relationship between expressions.

Parameters:
lhs

Left-hand side expression

relation

The relation type (e.g., EQ, LT, GT)

rhs

Right-hand side expression

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Restriction)

class saline_sdk.transaction.bindings.Send(token)[source]

Bases: Expr

An expression representing the amount of tokens sent

Parameters:

token (Token)

token

The selected token

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Send)

class saline_sdk.transaction.bindings.SetIntent(host, intent)[source]

Bases: Instruction

An instruction to set the intent for an account.

Parameters:
  • host (G2Element)

  • intent (Intent)

host

The account to set the intent for

intent

The intent to set

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (SetIntent)

class saline_sdk.transaction.bindings.Signature(signer)[source]

Bases: Intent

An intent that requires a specific signature.

Parameters:

signer (G2Element)

signer

The public key of the required signer

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Signature)

class saline_sdk.transaction.bindings.Signed(nonce, signature, signee, signers)[source]

Bases: object

Represents a signed transaction ready for submission.

Parameters:
  • nonce (str) – Unique identifier for this transaction

  • signature (str) – The cryptographic signature

  • signee (Transaction) – The transaction being signed

  • signers (List[str]) – List of public keys that signed the transaction

nonce

Unique identifier for this transaction

signature

The cryptographic signature

signee

The transaction being signed

signers

Non-empty list of public keys that signed the transaction

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Signed)

class saline_sdk.transaction.bindings.Temporary(duration, availableAfter, inner)[source]

Bases: Intent

Parameters:
static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Temporary)

class saline_sdk.transaction.bindings.Token(*values)[source]

Bases: Enum

Enumeration of supported token types in the Saline blockchain.

Members:

BTC: Bitcoin ETH: Ethereum USDC: USD Coin USDT: Tether SALT: Saline native token

static from_json(s)[source]
static to_json(x)[source]
Parameters:

x (Token)

BTC = 0
ETH = 1
SALT = 4
USDC = 2
USDT = 3
class saline_sdk.transaction.bindings.Transaction(instructions)[source]

Bases: object

Represents a transaction on the Saline blockchain.

A transaction consists of one or more instructions to be executed atomically.

Parameters:

instructions (List[Instruction]) – List of instructions to execute

instructions

Non-empty list of instructions to execute

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Transaction)

class saline_sdk.transaction.bindings.TransferFunds(source, target, funds)[source]

Bases: Instruction

An instruction to transfer funds between accounts.

Parameters:
  • source (str) – The sender account’s public key

  • target (str) – The recipient account’s public key

  • funds (Dict[str, float]) – Dictionary mapping token types to amounts

source

The sender account

target

The recipient account

funds

Dictionary mapping token types to amounts

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (TransferFunds)

class saline_sdk.transaction.bindings.Var(var)[source]

Bases: Expr

A variable reference expression.

Parameters:

var (Variable)

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Var)

class saline_sdk.transaction.bindings.Variable(kind, name)[source]

Bases: object

Parameters:
static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Variable)

class saline_sdk.transaction.bindings.VariableTag(*values)[source]

Bases: Enum

static from_json(s)[source]
static to_json(x)[source]
Parameters:

x (VariableTag)

Address = 0
Amount = 1
Count = 2
List = 3
class saline_sdk.transaction.bindings.Witness[source]

Bases: object

Base class for transaction witnesses.

Witnesses are used to provide evidence for non-trivial validations. For instance, given a multi-level multi-sig, witnesses specify the paths of the tree that are valid, which means the verification engine can avoid evaluating all the false paths. This allows doing less computation on-chain, where it’s more expensive.

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Witness)

saline_sdk.transaction.bindings.dumps(x)[source]
saline_sdk.transaction.bindings.loads(x)[source]

Core Classes

Transaction and Signing

class saline_sdk.transaction.bindings.Transaction(instructions)[source]

Bases: object

Represents a transaction on the Saline blockchain.

A transaction consists of one or more instructions to be executed atomically.

Parameters:

instructions (List[Instruction]) – List of instructions to execute

instructions

Non-empty list of instructions to execute

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Transaction)

class saline_sdk.transaction.bindings.Signed(nonce, signature, signee, signers)[source]

Bases: object

Represents a signed transaction ready for submission.

Parameters:
  • nonce (str) – Unique identifier for this transaction

  • signature (str) – The cryptographic signature

  • signee (Transaction) – The transaction being signed

  • signers (List[str]) – List of public keys that signed the transaction

nonce

Unique identifier for this transaction

signature

The cryptographic signature

signee

The transaction being signed

signers

Non-empty list of public keys that signed the transaction

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Signed)

Instructions

class saline_sdk.transaction.bindings.Instruction[source]

Bases: object

Base class for instructions in the Saline blockchain.

Instructions are the fundamental operations that can be performed in transactions.

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Instruction)

class saline_sdk.transaction.bindings.TransferFunds(source, target, funds)[source]

Bases: Instruction

An instruction to transfer funds between accounts.

Parameters:
  • source (str) – The sender account’s public key

  • target (str) – The recipient account’s public key

  • funds (Dict[str, float]) – Dictionary mapping token types to amounts

source

The sender account

target

The recipient account

funds

Dictionary mapping token types to amounts

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (TransferFunds)

class saline_sdk.transaction.bindings.SetIntent(host, intent)[source]

Bases: Instruction

An instruction to set the intent for an account.

Parameters:
  • host (G2Element)

  • intent (Intent)

host

The account to set the intent for

intent

The intent to set

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (SetIntent)

Intents

class saline_sdk.transaction.bindings.Intent[source]

Bases: object

Base class for intents in the Saline blockchain.

Intents represent conditions or requirements that must be satisfied for a transaction to be valid.

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Intent)

class saline_sdk.transaction.bindings.All(children)[source]

Bases: Intent

An intent that requires all child intents to be satisfied.

This is similar to an AND logical operation for intents.

Parameters:

children (list[Intent])

children

List of child intents that must all be satisfied

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (All)

class saline_sdk.transaction.bindings.Any(threshold, children)[source]

Bases: Intent

An intent that requires a threshold number of child intents to be satisfied.

Parameters:
threshold

Minimum number of child intents that must be satisfied

children

List of child intents

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Any)

class saline_sdk.transaction.bindings.Signature(signer)[source]

Bases: Intent

An intent that requires a specific signature.

Parameters:

signer (G2Element)

signer

The public key of the required signer

static from_json(d)[source]
static to_json(x)[source]
Parameters:

x (Signature)

Enumerations

class saline_sdk.transaction.bindings.Token(*values)[source]

Bases: Enum

Enumeration of supported token types in the Saline blockchain.

Members:

BTC: Bitcoin ETH: Ethereum USDC: USD Coin USDT: Tether SALT: Saline native token

static from_json(s)[source]
static to_json(x)[source]
Parameters:

x (Token)

BTC = 0
ETH = 1
SALT = 4
USDC = 2
USDT = 3
class saline_sdk.transaction.bindings.Relation(*values)[source]

Bases: Enum

Enumeration of comparison relations used in conditional expressions.

Members:

EQ: Equal to (==) LT: Less than (<) LE: Less than or equal to (<=) GT: Greater than (>) GE: Greater than or equal to (>=)

static from_json(s)[source]
static to_json(x)[source]
Parameters:

x (Relation)

EQ = 0
GE = 4
GT = 3
LE = 2
LT = 1
class saline_sdk.transaction.bindings.Arithmetic(*values)[source]

Bases: Enum

Enumeration of arithmetic operations used in expressions.

Members:

Add: Addition (+) Div: Division (/) Mul: Multiplication (*) Sub: Subtraction (-)

static from_json(s)[source]
static to_json(x)[source]
Parameters:

x (Arithmetic)

Add = 0
Div = 1
Mul = 2
Sub = 3

Utility Functions

saline_sdk.transaction.bindings.dumps(x)[source]
saline_sdk.transaction.bindings.loads(x)[source]