fn upgrade(
env: soroban_sdk::Env,
new_wasm_hash: soroban_sdk::BytesN<32>,
operator: soroban_sdk::Address,
)
Initialise the protocol. Sets the owner and the initial StreamConfig.
fn __constructor(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
config: StreamConfig,
) -> Result<(), StreamError>
fn get_config(env: soroban_sdk::Env) -> StreamConfig
fn whitelist_tokens(
env: soroban_sdk::Env,
tokens: soroban_sdk::Vec,
) -> Result<(), StreamError>
fn remove_whitelisted_token(
env: soroban_sdk::Env,
token: soroban_sdk::Address,
) -> Result<(), StreamError>
fn set_fee_config(
env: soroban_sdk::Env,
fee_recipient: soroban_sdk::Address,
withdraw_account: soroban_sdk::Address,
platform_fee: i64,
base_fee: i64,
stream_token_fee: i64,
xlm_as_fee: bool,
fee_tiers: soroban_sdk::Vec,
) -> Result<(), StreamError>
fn set_frequencies(
env: soroban_sdk::Env,
frequencies: soroban_sdk::Vec,
) -> Result<(), StreamError>
Atomically update all mutable config fields in one call.
fn update_config(
env: soroban_sdk::Env,
fee_recipient: soroban_sdk::Address,
withdraw_account: soroban_sdk::Address,
platform_fee: i64,
base_fee: i64,
stream_token_fee: i64,
xlm_as_fee: bool,
fee_tiers: soroban_sdk::Vec,
frequencies: soroban_sdk::Vec,
admin_signer: soroban_sdk::BytesN<32>,
xlm_token_contract_id: soroban_sdk::BytesN<32>,
) -> Result<(), StreamError>
Read back the tenant fee config for sender. Returns None if not set (uses global).
fn get_tenant_config(
env: soroban_sdk::Env,
sender: soroban_sdk::Address,
) -> Option
Set (or overwrite) a per-tenant fee config for sender.
When set, streams created by sender will route fees to fee_recipient
using this fee schedule instead of the global config.
fn set_tenant_config(
env: soroban_sdk::Env,
sender: soroban_sdk::Address,
fee_recipient: soroban_sdk::Address,
withdraw_account: soroban_sdk::Address,
platform_fee: i64,
base_fee: i64,
stream_token_fee: i64,
fee_tiers: soroban_sdk::Vec,
) -> Result<(), StreamError>
Remove the per-tenant fee config for sender. Streams will fall back to global config.
fn remove_tenant_config(env: soroban_sdk::Env, sender: soroban_sdk::Address)
Create a new payment stream.
stream_id must be unique random bytes — generate with
crypto.getRandomValues(new Uint8Array(32)) on the client (same as Solana's
freshly generated account keypair). Duplicate IDs are rejected.
fn create_stream(
env: soroban_sdk::Env,
stream_id: soroban_sdk::BytesN<32>,
sender: soroban_sdk::Address,
receiver: soroban_sdk::Address,
token: soroban_sdk::Address,
params: CreateStreamParams,
) -> Result<(), StreamError>
Create several streams from the same sender in one transaction.
Auth is collected once from sender; each entry supplies its own
stream_id, receiver, token, and CreateStreamParams. Any entry that
fails validation aborts the whole batch and rolls back prior creates.
fn create_multiple_streams(
env: soroban_sdk::Env,
sender: soroban_sdk::Address,
entries: soroban_sdk::Vec,
) -> Result<(), StreamError>
fn get_stream(
env: soroban_sdk::Env,
stream_id: soroban_sdk::BytesN<32>,
) -> PaymentStream
fn get_withdrawable_amount(
env: soroban_sdk::Env,
stream_id: soroban_sdk::BytesN<32>,
) -> i64
Bump a stream's persistent storage TTL. Anyone may call to prevent ledger archival.
fn bump_stream_ttl(env: soroban_sdk::Env, stream_id: soroban_sdk::BytesN<32>)
Bump the protocol config instance TTL. Anyone may call to prevent config expiry.
fn bump_config_ttl(env: soroban_sdk::Env)
fn pause_resume_stream(
env: soroban_sdk::Env,
stream_id: soroban_sdk::BytesN<32>,
) -> Result<(), StreamError>
Pause or resume multiple streams in one call.
caller must be the sender of each stream; mismatched, non-pausable,
or terminal streams are silently skipped. Active entries are paused
and paused entries are resumed in the same call — group by intent.
Returns the list of stream IDs whose state was successfully toggled.
fn pause_resume_all_streams(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
stream_ids: soroban_sdk::Vec>,
) -> soroban_sdk::Vec>
fn cancel_stream(
env: soroban_sdk::Env,
stream_id: soroban_sdk::BytesN<32>,
caller: soroban_sdk::Address,
) -> Result<(), StreamError>
Cancel multiple streams in one call.
caller must be the sender (with cancelable_by_sender) or receiver
(with cancelable_by_recipient) of each stream; streams that fail the
authorization check, are in a terminal state, or lack the vault balance
to cover vested debt are silently skipped.
Returns the list of stream IDs that were successfully canceled.
fn cancel_all_streams(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
stream_ids: soroban_sdk::Vec>,
) -> soroban_sdk::Vec>
fn withdraw_stream(
env: soroban_sdk::Env,
stream_id: soroban_sdk::BytesN<32>,
caller: soroban_sdk::Address,
) -> Result<(), StreamError>
Withdraw vested tokens from multiple streams in one call.
stream_ids is the caller-supplied list of streams to process (obtain from the indexer).
Streams that are not withdrawable (wrong state, unauthorized, zero amount) are skipped.
Returns the list of stream IDs from which tokens were successfully withdrawn.
fn withdraw_all_streams(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
stream_ids: soroban_sdk::Vec>,
) -> soroban_sdk::Vec>
fn change_recipient(
env: soroban_sdk::Env,
stream_id: soroban_sdk::BytesN<32>,
caller: soroban_sdk::Address,
new_receiver: soroban_sdk::Address,
) -> Result<(), StreamError>
Manual top-up: sender must sign.
fn topup_stream(
env: soroban_sdk::Env,
stream_id: soroban_sdk::BytesN<32>,
amount: i64,
) -> Result<(), StreamError>
Automatic top-up: any caller may trigger. Security gate is the SAC allowance.
fn trigger_topup(
env: soroban_sdk::Env,
stream_id: soroban_sdk::BytesN<32>,
amount: i64,
) -> Result<(), StreamError>
Returns Some(Address) if ownership is set, or None if ownership has
been renounced.
e - Access to the Soroban environment.fn get_owner(env: soroban_sdk::Env) -> Option
Initiates a 2-step ownership transfer to a new address.
Requires authorization from the current owner. The new owner must later
call accept_ownership() to complete the transfer.
e - Access to the Soroban environment.new_owner - The proposed new owner.live_until_ledger - Ledger number until which the new owner can
accept. A value of 0 cancels any pending transfer.OwnableError::OwnerNotSet] - If the owner is not set.crate::role_transfer::RoleTransferError::NoPendingTransfer] - If
trying to cancel a transfer that doesn't exist.crate::role_transfer::RoleTransferError::InvalidLiveUntilLedger] -
If the specified ledger is in the past.crate::role_transfer::RoleTransferError::InvalidPendingAccount] -
If the specified pending account is not the same as the provided new
address.fn transfer_ownership(
env: soroban_sdk::Env,
new_owner: soroban_sdk::Address,
live_until_ledger: u32,
)
Accepts a pending ownership transfer.
e - Access to the Soroban environment.crate::role_transfer::RoleTransferError::NoPendingTransfer] - If
there is no pending transfer to accept.["ownership_transfer_completed"][new_owner: Address]fn accept_ownership(env: soroban_sdk::Env)
Renounces ownership of the contract.
Permanently removes the owner, disabling all functions gated by
#[only_owner].
e - Access to the Soroban environment.OwnableError::TransferInProgress] - If there is a pending ownership
transfer.OwnableError::OwnerNotSet] - If the owner is not set.fn renounce_ownership(env: soroban_sdk::Env)
fn paused(env: soroban_sdk::Env) -> bool
fn pause(env: soroban_sdk::Env, caller: soroban_sdk::Address)
fn unpause(env: soroban_sdk::Env, caller: soroban_sdk::Address)