Internal session state managed by O2Client.

Returned by O2Client.createSession and passed to trading methods. Contains everything needed to sign and submit session actions.

const session = await client.createSession(wallet, ["fFUEL/fUSDC"]);
console.log(session.tradeAccountId); // "0x..."
console.log(session.expiry); // Unix seconds
interface SessionState {
    contractIds: ContractId[];
    expiry: number;
    nonce: bigint;
    ownerAddress: string;
    sessionAddress: string;
    sessionPrivateKey: Uint8Array;
    tradeAccountId: TradeAccountId;
}

Properties

contractIds: ContractId[]

Contract IDs the session is authorized for.

expiry: number

Session expiry (Unix seconds).

nonce: bigint

Current nonce (auto-incremented after each action).

ownerAddress: string

The owner wallet's b256 address.

sessionAddress: string

The session key's b256 address.

sessionPrivateKey: Uint8Array

The session key's private key (32 bytes).

tradeAccountId: TradeAccountId

The trade account contract ID.