sessions library
Time-limited trading sessions — package:deepbook/sessions.dart.
Mirrors the official @mysten/deepbook-v3/sessions subpath: an Account
owner authorizes an ephemeral address to act for the Account until a fixed
expiry, and the session key never holds a reusable Auth — each wrapper
mints app authorization internally and consumes it in the same call. Like
the official subpath, this entry point is a separate library: importing it
does not load spot or margin code, and package:deepbook/deepbook.dart is
unchanged.
Classes
- DeploymentInfo
- Which on-chain deployment a set of ids came from.
- DeploymentUnits
- Scale constants the deployment owns rather than the SDK.
- SessionGrant
- One stored session grant.
- SessionsConfig
- Deployed ids the sessions builders address.
- SessionsContract
- SessionsContract — time-limited trading sessions over a canonical Account.
- SessionsDeploymentConfig
- A SessionsConfig that also carries the SessionsSpotIds and SessionsPredictIds of a recorded deployment — what getSessionsConfig returns.
- SessionsPredictIds
- Ids the Predict session wrappers need beyond SessionsConfig.
- SessionsSpotIds
- Ids the DeepBook spot session wrappers need on top of SessionsConfig. The Predict wrappers never take these, so they are kept off the main config rather than made optional there.
Constants
- MAX_SESSION_DURATION_MS → const int
- The maximum session duration the contract accepts: 30 days, in milliseconds.
- MAX_SESSIONS_PER_ACCOUNT → const int
- The maximum number of distinct session addresses one Account may store.
- TESTNET_DEPLOYMENT → const DeploymentInfo
- Which on-chain deployment the ids below came from.
- TESTNET_UNITS → const DeploymentUnits
- Scale constants the deployment owns rather than the SDK.
Properties
-
SessionAuthorized
→ BcsType<
Map< String, dynamic> , dynamic> -
final
-
SessionRevoked
→ BcsType<
Map< String, dynamic> , dynamic> -
final
-
SessionsAdminCap
→ BcsType<
Map< String, dynamic> , dynamic> -
final
-
SessionsApp
→ BcsType<
Map< String, dynamic> , dynamic> -
final
-
SessionsData
→ BcsType<
Map< String, dynamic> , dynamic> -
final
Functions
-
Authorize
sessionfrom execution time for at most 30 days. Accounts may store at most 20 addresses; reauthorization replaces in place. -
bumpVersionWatermark(
{dynamic arguments, String? package, Map< String, dynamic> ? config}) → MoveCallBuilder - Advance the version floor to this package's compiled-in version. This is ungated so an upgraded package can retire older versions, and it cannot accept a caller-selected target.
-
cancelLiveOrder(
{dynamic arguments, String? package, List< String> typeArguments = const [], Map<String, dynamic> ? config}) → MoveCallBuilder - Cancel a DeepBook spot order for an Account with an active session.
-
cancelLiveOrders(
{dynamic arguments, String? package, List< String> typeArguments = const [], Map<String, dynamic> ? config}) → MoveCallBuilder - Cancel multiple DeepBook spot orders for an Account with an active session.
-
getDeployment(
String network) → DeploymentInfo -
Which deployment the ids on
networkcame from — its name and the deepbookv3 commit they were generated at. Useful when a bug report needs to say which on-chain deployment an SDK build was pinned to. -
getSessionsConfig(
String network) → SessionsDeploymentConfig -
The deployed sessions ids for
network, so a caller does not transcribe them. Generated from the deploy manifest — seelib/src/deployments/. The returned object also carries SessionsSpotIds for the generated spot wrappers. -
getUnits(
String network) → DeploymentUnits -
Scale constants for
network— lot size, fixed-point scale, and coin decimals. Deployment-wide, so any subsystem formatting a custody balance can read them rather than hardcoding 6. -
id(
{dynamic arguments, String? package, Map< String, dynamic> ? config}) → MoveCallBuilder - Return the config object ID for external PTB construction.
-
mintExactAmount(
{dynamic arguments, String? package, Map< String, dynamic> ? config}) → MoveCallBuilder - Mint a budget-sized Predict position for an Account with an active session.
-
mintExactCost(
{dynamic arguments, String? package, Map< String, dynamic> ? config}) → MoveCallBuilder - Mint a Predict position sized to an all-in cost for an Account with an active session.
-
mintExactQuantity(
{dynamic arguments, String? package, Map< String, dynamic> ? config}) → MoveCallBuilder - Mint an exact Predict position quantity for an Account with an active session.
-
placeLimitOrder(
{dynamic arguments, String? package, List< String> typeArguments = const [], Map<String, dynamic> ? config}) → MoveCallBuilder - Place a DeepBook spot limit order for an Account with an active session.
-
placeMarketOrder(
{dynamic arguments, String? package, List< String> typeArguments = const [], Map<String, dynamic> ? config}) → MoveCallBuilder - Place a DeepBook spot market order for an Account with an active session.
-
redeemLive(
{dynamic arguments, String? package, Map< String, dynamic> ? config}) → MoveCallBuilder - Redeem a live Predict order for an Account with an active session.
-
redeemSettled(
{dynamic arguments, String? package, Map< String, dynamic> ? config}) → MoveCallBuilder - Redeem a settled Predict order for an Account with an active session.
-
revokeSession(
{required dynamic arguments, String? package, Map< String, dynamic> ? config}) → MoveCallBuilder -
Revoke
sessionif it is present. Only the Account owner may call this function. -
sessionExpirationMs(
{required dynamic arguments, String? package, Map< String, dynamic> ? config}) → MoveCallBuilder - Return a known session's expiration timestamp for SDK and devInspect reads.
-
versionWatermark(
{dynamic arguments, String? package, Map< String, dynamic> ? config}) → MoveCallBuilder - Return the minimum Sessions package version accepted by gated entrypoints.
-
withdrawSettledAmounts(
{dynamic arguments, String? package, List< String> typeArguments = const [], Map<String, dynamic> ? config}) → MoveCallBuilder - Sweep settled DeepBook spot proceeds into an Account with an active session.
Exceptions / Errors
- ConfigurationError
- Thrown when configuration is invalid or missing.
- DeepBookError
- Base class for DeepBook errors.
- ValidationError
- Thrown when transaction validation fails.