AltheiaSui methods. The contract decides whether each action lands.
Install
@altheia-xyz/sui re-exports the @mysten/sui primitives an agent needs (SuiJsonRpcClient, getJsonRpcFullnodeUrl, Ed25519Keypair, decodeSuiPrivateKey), so there is one copy of @mysten/sui in play. A dapp-kit executor is provided for browser wallet flows.
Env
The agent needs only its key, from provisioning:Construct the agent
agentRefs reads the AgentCap the key owns and derives the vault, policy, and cap. keypairExecutor signs and submits, waiting for finality so sequential actions don’t race.
agentRefs throws if the address owns no AgentCap — wrong key, or the agent is not provisioned.
Act
swap buys (spends the capped quote, receives base into the vault). sellSwap unwinds a base position back to quote. Amounts are base units. Each method builds, signs, and submits internally.
Handle denials
A policy denial surfaces as a thrown error.decodePolicyAbort tells a policy denial apart from a liquidity or gas failure.
Record denials without spending gas
A denied action aborts on-chain and emits no event, so to log denials, dry-run first.guardedSubmit dry-runs, records a policy abort to the audit backend, and submits only when allowed.
Read state
readPolicyObject, vaultBalances, readAuditLog. See the SDK reference.
Runnable example
A DeepBook agent: allowed, denied, revoked.