Skip to main content

Documentation Index

Fetch the complete documentation index at: https://limitless-docs-ws-settlement-events.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

The PartnerAccountService creates sub-account profiles linked to the authenticated partner. It requires HMAC authentication with the account_creation scope.

Access

use limitless_exchange_rust_sdk::{Client, HmacCredentials};

let http = Client::builder()
    .hmac_credentials(HmacCredentials {
        token_id: token_id.to_string(),
        secret: secret.to_string(),
    })
    .build()?;

let client = Client::from_http_client(http)?;

// Use client.partner_accounts.*

Server wallet mode

Set create_server_wallet to create a managed wallet for the sub-account. This enables delegated signing:
use limitless_exchange_rust_sdk::CreatePartnerAccountInput;

let account = client
    .partner_accounts
    .create_account(
        &CreatePartnerAccountInput {
            display_name: Some("user-alice".to_string()),
            create_server_wallet: Some(true),
        },
        None,
    )
    .await?;

println!("{}", account.profile_id);
println!("{}", account.account);
New server wallets should be checked with check_allowances before the first delegated trade. If retryable targets are missing or failed, call retry_allowances and poll again.

Allowance recovery

Server-wallet sub-accounts need delegated-trading approvals before they can trade. The partner allowance helpers use the Partner API only:
  • check_allowances(profile_id) calls GET /profiles/partner-accounts/:profileId/allowances
  • retry_allowances(profile_id) calls POST /profiles/partner-accounts/:profileId/allowances/retry
  • both methods require HMAC credentials with account_creation and delegated_signing
  • profile_id is the child/server-wallet profile id
use limitless_exchange_rust_sdk::{
    LimitlessError, PARTNER_ACCOUNT_ALLOWANCE_STATUS_FAILED,
    PARTNER_ACCOUNT_ALLOWANCE_STATUS_MISSING, PARTNER_ACCOUNT_ALLOWANCE_STATUS_SUBMITTED,
};

let mut allowances = client
    .partner_accounts
    .check_allowances(account.profile_id)
    .await?;

if !allowances.ready {
    let retryable = allowances.targets.iter().any(|target| {
        target.retryable
            && matches!(
                target.status.as_str(),
                PARTNER_ACCOUNT_ALLOWANCE_STATUS_MISSING
                    | PARTNER_ACCOUNT_ALLOWANCE_STATUS_FAILED
            )
    });

    if retryable {
        match client
            .partner_accounts
            .retry_allowances(account.profile_id)
            .await
        {
            Ok(retried) => allowances = retried,
            Err(LimitlessError::Api(err)) if err.status == 429 => {
                println!("retryAfterSeconds is in err.data");
            }
            Err(LimitlessError::Api(err)) if err.status == 409 => {
                println!("Retry already running; poll check_allowances again shortly.");
            }
            Err(err) => return Err(err.into()),
        }
    }
}

if allowances
    .targets
    .iter()
    .any(|target| target.status == PARTNER_ACCOUNT_ALLOWANCE_STATUS_SUBMITTED)
{
    // A sponsored tx/user operation was submitted by this retry request.
    // Poll check_allowances again after a short delay to observe confirmed chain state.
}
Recommended partner flow:
  1. Poll check_allowances(profile_id).
  2. If ready == true, continue.
  3. If targets are missing or failed with retryable == true, call retry_allowances(profile_id).
  4. If retry returns submitted targets, poll check_allowances again after a short delay.
  5. If retry returns 429, wait retryAfterSeconds.
  6. If retry returns 409, wait briefly and call check_allowances again.

EOA mode

For externally-owned accounts, pass ownership-verification headers:
use limitless_exchange_rust_sdk::{
    CreatePartnerAccountEoaHeaders, CreatePartnerAccountInput,
};

let account = client
    .partner_accounts
    .create_account(
        &CreatePartnerAccountInput {
            display_name: Some("user-bob".to_string()),
            create_server_wallet: Some(false),
        },
        Some(&CreatePartnerAccountEoaHeaders {
            account: "0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed".to_string(),
            signing_message: "0x...".to_string(),
            signature: "0x...".to_string(),
        }),
    )
    .await?;

Validation

  • display_name is optional and capped at 44 characters
  • when create_server_wallet is not Some(true), EOA headers are required
  • the SDK validates display_name length locally before sending the request
  • 409 Conflict is returned if a profile already exists for the target address
Server-wallet sub-accounts and EOA sub-accounts use different signing models. Use server-wallet mode for delegated signing, and EOA mode when the end user will sign orders themselves.