import { Scalar } from "../../crypto/scalar"; import { Address, Hex } from "viem"; import storageSchema, { InjectedStorageInterface, StorageInterface } from "./storageSchema"; import { NoteEvent } from "../../chain/contract"; export type AccountState = { /** * Account id, a scalar derived from the private key. */ id: Scalar; /** * Account nonce, increments for each new action. */ nonce: bigint; /** * Account balance, in wei. */ balance: bigint; /** * Hash of the last note. */ currentNote: Scalar; /** * Merkle tree index of the last note. */ currentNoteIndex?: bigint; /** * Version of the storage schema. */ storageSchemaVersion: number; }; export type ShielderTransaction = { type: "NewAccountNative" | "DepositNative" | "WithdrawNative"; amount: bigint; to?: Address; txHash: Hex; block: bigint; }; export declare const eventToTransaction: (event: NoteEvent) => ShielderTransaction; export declare class StateManager { private storage; privateKey: Hex; id: Scalar | undefined; idHash: Scalar | undefined; constructor(privateKey: Hex, storage: StorageInterface); accountState(): Promise; updateAccountState(accountState: AccountState): Promise; emptyAccountState(): Promise; private getId; private getIdHash; } declare const emptyAccountState: (id: Scalar) => AccountState; export { storageSchema, InjectedStorageInterface, emptyAccountState };