import type { Call } from "starknet"; import { Account as TongoAccount } from "@fatsolutions/tongo-sdk"; import type { ConfidentialProvider } from "../confidential/interface.js"; import type { Amount } from "../types/amount.js"; import type { ConfidentialConfig, ConfidentialFundDetails, ConfidentialTransferDetails, ConfidentialWithdrawDetails, ConfidentialRagequitDetails, ConfidentialRolloverDetails, ConfidentialState, ConfidentialRecipient } from "../confidential/types.js"; /** * Tongo implementation of the {@link ConfidentialProvider} interface. * * Each instance is bound to a single Tongo private key and contract. * * In addition to the standard {@link ConfidentialProvider} methods, * this class exposes Tongo-specific operations: {@link ragequit}, * {@link rollover}, and direct access to the underlying Tongo account. * * @example * ```ts * import { StarkZap, TongoConfidential } from "starkzap"; * * const sdk = new StarkZap({ network: "mainnet" }); * const wallet = await sdk.connectWallet({ ... }); * * const confidential = new TongoConfidential({ * privateKey: tongoPrivateKey, * contractAddress: TONGO_CONTRACT, * provider: wallet.getProvider(), * }); * * // Fund confidential account (approve is included automatically) * const amount = Amount.fromRaw(100n, token); * const tx = await wallet.tx() * .confidentialFund(confidential, { amount, sender: wallet.address }) * .send(); * * // Check balance * const state = await confidential.getState(); * console.log(`Confidential balance: ${state.balance}`); * ``` */ export declare class TongoConfidential implements ConfidentialProvider { readonly id = "tongo"; private readonly account; constructor(config: ConfidentialConfig); /** The Tongo address (base58-encoded public key) for this account. */ get address(): string; /** The public key used to receive confidential transfers to this account. */ get recipientId(): ConfidentialRecipient; /** * Get the decrypted confidential account state. * * Reads the on-chain encrypted balance and decrypts it locally * using the private key. */ getState(): Promise; /** * Get the account nonce. */ getNonce(): Promise; /** * Convert a public ERC20 amount to tongo (confidential) units * using the on-chain rate. */ toConfidentialUnits(amount: Amount): Promise; /** * Convert tongo (confidential) units back to a public ERC20 amount * using the on-chain rate. */ toPublicUnits(confidentialAmount: bigint): Promise; /** * Build the Calls for funding this confidential account. * * The returned array includes the ERC20 approve call (when required) * followed by the fund call, so consumers can execute the batch as-is. */ fund(details: ConfidentialFundDetails): Promise; /** * Build the Call for a confidential transfer. * * Generates ZK proofs locally and returns the call to submit on-chain. */ transfer(details: ConfidentialTransferDetails): Promise; /** * Build the Call for withdrawing from the confidential account. * * Converts confidential balance back to public ERC20 tokens. */ withdraw(details: ConfidentialWithdrawDetails): Promise; /** * Build the Call for an emergency ragequit (full withdrawal). * * Exits the entire confidential balance to a public address. * This is a Tongo-specific operation. */ ragequit(details: ConfidentialRagequitDetails): Promise; /** * Build the Call for a rollover (activate pending balance). * * Moves pending balance (from received transfers) into the active balance. * This is a Tongo-specific operation. */ rollover(details: ConfidentialRolloverDetails): Promise; /** * Access the underlying Tongo Account for advanced operations. * * Use this for event reading, audit proofs, or other operations * not covered by the convenience methods. */ getTongoAccount(): TongoAccount; } //# sourceMappingURL=tongo.d.ts.map