Lux Docs
Safe

Transaction API

Building, signing, and executing Safe transactions

Transaction Types

TypeDescription
ETH TransferSend native LUX to an address
ERC-20 TransferSend tokens to an address
Contract InteractionCall any contract function with encoded calldata
BatchExecute multiple operations in a single transaction

Transaction Structure

Each Safe transaction contains:

FieldTypeDescription
toaddressDestination address
valueuint256Amount of native token (wei)
databytesEncoded function call data
operationuint80 = Call, 1 = DelegateCall
nonceuint256Safe transaction nonce

Signing

Transactions are signed off-chain using EIP-712 typed data. Each owner signs the transaction hash, and signatures are collected until the threshold is met.

Transaction Hash = keccak256(
  0x19, 0x01,
  domainSeparator,
  safeTxHash
)

The domain separator is unique to each Safe contract instance and chain.

Execution

Once enough signatures are collected, the transaction is executed by calling execTransaction on the Safe contract:

execTransaction(
  to, value, data, operation,
  safeTxGas, baseGas, gasPrice, gasToken, refundReceiver,
  signatures
)

Signatures are concatenated in ascending order of signer address.

Querying Safe State

QueryDescription
getOwners()List all current owner addresses
getThreshold()Current signing threshold
nonce()Next expected transaction nonce
isOwner(address)Check if an address is an owner
getTransactionHash(...)Compute hash for a proposed transaction

Events

EventDescription
ExecutionSuccessTransaction executed successfully
ExecutionFailureTransaction execution reverted
AddedOwnerNew owner added to the Safe
RemovedOwnerOwner removed from the Safe
ChangedThresholdSigning threshold updated

On this page