import { AccountConfig as AccountConfig$1 } from "./contracts/account/config-arguments.mjs"; import { TESTNET_DEPLOYMENT, TESTNET_UNITS } from "./deployments/testnet.mjs"; import { DeployedNetwork, NetworkArg, getDeployment, getUnits } from "./deployments/index.mjs"; import { Account, AccountWrapper } from "./contracts/account/account.mjs"; import { account_d_exports } from "./account-bindings/account.mjs"; import { account_registry_d_exports } from "./account-bindings/account-registry.mjs"; import { account_events_d_exports } from "./contracts/account/account_events.mjs"; import { Transaction, TransactionObjectArgument, TransactionResult } from "@mysten/sui/transactions"; //#region src/account.d.ts /** * The deployed ids of the shared `account` package this contract builds against. * * Kept deliberately minimal — ids only — so any consumer of the shared account primitive * (DeepBook core's account wrapper, Predict, …) can drive these builders with its OWN * deployment's ids without constructing a full product-SDK config. * * Extends the codegen-generated config interface so there is exactly one config shape and * casing: the generated bindings resolve `options.config` against these same keys, and if * codegen adds, drops, or renames a key this file stops compiling instead of silently * building a PTB against the wrong object. The ids are narrowed to `string` — codegen types * the package id as optional and the registry as the wider `ConfigValue`, but the * wrapper-address derivation needs plain ids. */ interface AccountConfig extends AccountConfig$1 { /** * The ORIGINAL `account` Move package id. Type tags and the derived wrapper address are built * from it, so it never moves to an upgraded package: that would derive addresses nothing lives * at, and a coin sent to one is lost. */ accountPackageId: string; /** The shared `AccountRegistry` object id. */ accountRegistry: string; /** * The latest `account` package, once the network has upgraded it: the call target of every * builder here. A PTB can't call account at an older version than another package in it links * (Predict's Version 5 links account v2), and `receiveCoin` / `receiveCoinAtAccountId` exist * only from v2. Absent while the network runs v1: calls then target `accountPackageId`. */ accountPackageIdLatest?: string; } /** * @description The deployed `account` ids for `network`, so a caller does not transcribe * them. Generated from the deploy manifest — see `src/deployments/`. * @throws if the network has no recorded deployment, rather than returning placeholder ids * that would fail as a confusing on-chain abort. * * ```ts * const account = new AccountContract(getAccountConfig('testnet')); * ``` */ declare function getAccountConfig(network: NetworkArg): AccountConfig; /** * AccountContract — the reusable on-chain account primitive (`packages/account`). * * An owner has one canonical `AccountWrapper`, a *derived* object of the account registry, * so its id is computable off-chain (no read). The wrapper holds an `Account` whose custody * balances apps deposit into and withdraw from; app-specific data hangs off it under an * app-keyed slot. Authority is a hot-potato `Auth` minted from the tx sender and consumed * by the very next account-loading call. */ declare class AccountContract { #private; /** * @param {AccountConfig} config Deployed ids of the shared `account` package */ constructor(config: AccountConfig); /** * @description The deterministic id of an owner's canonical account wrapper — no chain * read needed. The wrapper is a derived object of the account registry, so its id is * `derive_address(registry, AccountWrapperKey(owner))`. * @param {string} owner Owner address * @returns The wrapper object id */ deriveAccountWrapperId(owner: string): string; /** * @description Mint owner authority for the transaction sender. A hot-potato `Auth` * consumed by the very next account-loading call (`load_account_mut` inside * `deposit_funds` / `withdraw_funds` / an app's own entrypoints). * @returns A function that takes a Transaction object */ generateAuth(): (tx: Transaction) => TransactionResult; /** * @description Create the sender's canonical account wrapper and share it. `new` derives * the wrapper at its deterministic address (see `deriveAccountWrapperId`) and aborts if * it already exists; `share` publishes the shared object apps borrow against. * @returns A function that takes a Transaction object */ createAccount(): (tx: Transaction) => void; /** * @description First-time funding in ONE PTB: create the sender's wrapper, deposit * `coin` through the fresh handle, then `share` LAST (once shared, by-value use of the * handle is over). This cannot be split into `createAccount` + `depositFunds`: an object * input can only address an object that pre-exists the PTB, so a wrapper created inside * it is reachable only through `new`'s result handle. * @param {object} params Coin to deposit and its coin type * @returns A function that takes a Transaction object */ createAccountAndDeposit(params: { coin: TransactionObjectArgument; coinType: string; }): (tx: Transaction) => void; /** * @description Deposit a caller-provided `coin` into the account's stored balance via the * PTB-callable `deposit_funds` (folds settle → authorize → load → deposit; clock and * accumulator root auto-injected). The caller owns coin sourcing. * @param {object} params Wrapper id, coin to deposit, and its coin type * @returns A function that takes a Transaction object */ depositFunds(params: { wrapperId: string; coin: TransactionObjectArgument; coinType: string; }): (tx: Transaction) => void; /** * @description Withdraw `amount` (raw u64 units) from the account's stored balance via * the PTB-callable `withdraw_funds` (folds settle → authorize → load → withdraw; clock * and accumulator root auto-injected), returning the minted `Coin` for the caller to * transfer or compose. * @param {object} params Wrapper id, raw amount, and coin type * @returns A function that takes a Transaction object and returns the `Coin` */ withdrawFunds(params: { wrapperId: string; amount: bigint; coinType: string; }): (tx: Transaction) => TransactionResult; /** * @description Move a `Coin` that was transferred to an account's wrapper address into * the account's stored balance (`receive_coin`). Permissionless: anyone may submit it, and * value only enters the account the coin was addressed to. A sender that can only transfer a * coin to an address (a bridge mint, for example) sends it to `deriveAccountWrapperId(owner)`. * The coin can arrive before the account exists and waits there until the owner creates it. * @param {object} params Wrapper id, the received coin's object id (or a `Receiving` input), * and its coin type * @returns A function that takes a Transaction object * @throws if the config has no `accountPackageIdLatest`, i.e. the network still runs account v1 */ receiveCoin(params: { wrapperId: string; coin: string | TransactionObjectArgument; coinType: string; }): (tx: Transaction) => TransactionResult; /** * @description `receiveCoin` for a coin sent to the account's canonical ID (`account_id`, * the address `account_registry::derived_address` returns) instead of its wrapper address. * A `Receiving` input can't name its owner, so pick the call from where the coin sits: the * wrong one aborts `EUnableToReceiveObject`. Senders should use the wrapper address. * @param {object} params Wrapper id, the received coin's object id (or a `Receiving` input), * and its coin type * @returns A function that takes a Transaction object * @throws if the config has no `accountPackageIdLatest`, i.e. the network still runs account v1 */ receiveCoinAtAccountId(params: { wrapperId: string; coin: string | TransactionObjectArgument; coinType: string; }): (tx: Transaction) => TransactionResult; /** * @description Borrow the `Account` out of its wrapper — the read-side entry point apps * chain their own getters onto (`account::balance`, an app's own data accessors). * @param {object} params Wrapper id * @returns A function that takes a Transaction object and returns the `Account` */ loadAccount(params: { wrapperId: string; }): (tx: Transaction) => TransactionResult; /** * @description Read an owner's stored custody balance for a coin type: chains * `load_account(wrapper)` → `balance(account, root, clock)`. Compose in a * dev-inspect/simulate PTB and read the u64 return of the LAST command. * @param {object} params Owner address and coin type * @returns A function that takes a Transaction object */ balance(params: { owner: string; coinType: string; }): (tx: Transaction) => TransactionResult; } //#endregion export { Account, AccountConfig, AccountContract, AccountWrapper, type DeployedNetwork, type NetworkArg, TESTNET_DEPLOYMENT, TESTNET_UNITS, account_events_d_exports as accountEvents, account_d_exports as accountMoveCalls, account_registry_d_exports as accountRegistryMoveCalls, getAccountConfig, getDeployment, getUnits }; //# sourceMappingURL=account.d.mts.map