@altheia-xyz/sui is the TypeScript SDK for altheia on Sui. It builds the policy-gated transactions; the contract enforces the policy. The package re-exports the @mysten/sui primitives an agent author needs, so a project imports one package and runs one copy of @mysten/sui.
AltheiaSui
Construct with a client, the agent’s refs, and an executor. Every method builds, signs, and submits internally — the caller never touches a PTB.
Agent actions
Signed with the agent key. Each returns{ digest } and throws if the transaction fails. A policy abort surfaces as a thrown error you decode with decodePolicyAbort.
amount is bigint | number in base units. swap(50_000_000n) spends 0.05 SUI.
Owner lifecycle
Signed with the owner key. The refs must carryownerCap.
Reads
Example
agentRefs
SuiRefs from just the agent’s address. It reads the AgentCap the agent owns on chain and pulls vault_id, policy_id, and the cap id from it; the package ids, pool, and coin types come from deploy (defaults to SUI_TESTNET). The agent author needs only the key.
Throws if the address owns no AgentCap — wrong key, or the agent is not provisioned.
ownerCap is empty in the derived refs; supply it when constructing owner-side refs for revoke / killAndDrain.
keypairExecutor
Executor is (tx: Transaction) => Promise<SuiTransactionBlockResponse>; a dapp-kit browser executor is also provided for wallet-signed flows.
SUI_TESTNET
The deployed testnet coordinates — the same for every agent.
PTB builders
The lower-level builders behind the high-level methods.