///
import { BufferMap, BufferSet } from 'buffer-map';
import { BlockHeader, Transaction } from '../../primitives';
import { DatabaseKeyRange, IDatabaseTransaction } from '../../storage';
import { WithNonNull, WithRequired } from '../../utils';
import { DecryptedNote } from '../../workerPool/tasks/decryptNotes';
import { AssetBalances } from '../assetBalances';
import { MultisigKeys, MultisigSigner } from '../interfaces/multisigKeys';
import { MasterKey } from '../masterKey';
import { DecryptedAccountValue } from '../walletdb/accountValue';
import { AssetValue } from '../walletdb/assetValue';
import { BalanceValue } from '../walletdb/balanceValue';
import { DecryptedNoteValue } from '../walletdb/decryptedNoteValue';
import { HeadValue } from '../walletdb/headValue';
import { TransactionValue } from '../walletdb/transactionValue';
import { WalletDB } from '../walletdb/walletdb';
import { EncryptedAccount } from './encryptedAccount';
export declare const ACCOUNT_KEY_LENGTH = 32;
export declare const ACCOUNT_SCHEMA_VERSION = 4;
export type SpendingAccount = WithNonNull;
export declare function AssertSpending(account: Account): asserts account is SpendingAccount;
export type MultisigAccount = WithRequired;
type MultisigSignerAccount = WithRequired & {
multisigKeys: MultisigSigner;
};
export declare function AssertMultisig(account: Account): asserts account is MultisigAccount;
export declare function AssertMultisigSigner(account: Account): asserts account is MultisigSignerAccount;
export declare class Account {
private readonly walletDb;
readonly id: string;
readonly displayName: string;
name: string;
readonly spendingKey: string | null;
readonly viewKey: string;
readonly incomingViewKey: string;
readonly outgoingViewKey: string;
readonly version: number;
publicAddress: string;
createdAt: HeadValue | null;
scanningEnabled: boolean;
readonly prefix: Buffer;
readonly prefixRange: DatabaseKeyRange;
readonly multisigKeys?: MultisigKeys;
readonly proofAuthorizingKey: string | null;
ledger: boolean;
constructor({ accountValue, walletDb, }: {
accountValue: DecryptedAccountValue;
walletDb: WalletDB;
});
isSpendingAccount(): this is SpendingAccount;
serialize(): DecryptedAccountValue;
setName(name: string, options?: {
masterKey: MasterKey | null;
}, tx?: IDatabaseTransaction): Promise;
getNotes(keyRange?: DatabaseKeyRange): AsyncGenerator;
getUnspentNotes(assetId: Buffer, options?: {
confirmations?: number;
reverse?: boolean;
}): AsyncGenerator;
getDecryptedNote(hash: Buffer, tx?: IDatabaseTransaction): Promise;
connectTransaction(blockHeader: BlockHeader, transaction: Transaction, decryptedNotes: Array, tx?: IDatabaseTransaction): Promise;
saveAssetFromChain(createdTransactionHash: Buffer, id: Buffer, metadata: Buffer, name: Buffer, nonce: number, creator: Buffer, owner: Buffer, blockHeader?: {
hash: Buffer | null;
sequence: number | null;
}, tx?: IDatabaseTransaction): Promise;
updateAssetWithBlockHeader(assetValue: AssetValue, blockHeader: {
hash: Buffer;
sequence: number;
}, tx?: IDatabaseTransaction): Promise;
saveMintsToAssetsStore({ blockHash, sequence, transaction }: TransactionValue, receivedAssets: BufferSet | null, tx?: IDatabaseTransaction): Promise;
saveConnectedBurnsToAssetsStore(transaction: Transaction, tx?: IDatabaseTransaction): Promise;
private deleteDisconnectedBurnsFromAssetsStore;
private deleteDisconnectedMintsFromAssetsStore;
addPendingTransaction(transaction: Transaction, decryptedNotes: Array, submittedSequence: number, tx?: IDatabaseTransaction): Promise;
disconnectTransaction(blockHeader: BlockHeader, transaction: Transaction, tx?: IDatabaseTransaction): Promise;
deleteTransaction(transaction: Transaction, tx?: IDatabaseTransaction): Promise;
private deleteDecryptedNote;
getNoteHash(nullifier: Buffer, tx?: IDatabaseTransaction): Promise;
getTransaction(hash: Buffer, tx?: IDatabaseTransaction): Promise | undefined>;
getAsset(id: Buffer, tx?: IDatabaseTransaction): Promise | undefined>;
hasTransaction(hash: Buffer, tx?: IDatabaseTransaction): Promise;
hasPendingTransaction(hash: Buffer, tx?: IDatabaseTransaction): Promise;
getTransactions(range?: DatabaseKeyRange, tx?: IDatabaseTransaction): AsyncGenerator>;
getTransactionsByTime(tx?: IDatabaseTransaction, options?: {
reverse?: boolean;
}): AsyncGenerator>;
getTransactionsBySequence(sequence: number, tx?: IDatabaseTransaction): AsyncGenerator>;
getTransactionsBySequenceRange(startSequence?: number, endSequence?: number, tx?: IDatabaseTransaction): AsyncGenerator>;
getPendingTransactions(headSequence: number, tx?: IDatabaseTransaction): AsyncGenerator;
getExpiredTransactions(headSequence: number, tx?: IDatabaseTransaction): AsyncGenerator;
expireTransaction(transaction: Transaction, tx?: IDatabaseTransaction): Promise;
private deleteCreatedAssetsFromTransaction;
getAssets(tx?: IDatabaseTransaction): AsyncGenerator>;
getBalances(confirmations: number, tx?: IDatabaseTransaction): AsyncGenerator<{
assetId: Buffer;
unconfirmed: bigint;
unconfirmedCount: number;
confirmed: bigint;
pending: bigint;
pendingCount: number;
available: bigint;
availableNoteCount: number;
blockHash: Buffer | null;
sequence: number | null;
}>;
/**
* Gets the balance for an account
* unconfirmed: all notes on the chain
* confirmed: confirmed balance minus transactions in unconfirmed range
*/
getBalance(assetId: Buffer, confirmations: number, tx?: IDatabaseTransaction): Promise<{
unconfirmed: bigint;
unconfirmedCount: number;
confirmed: bigint;
pending: bigint;
pendingCount: number;
available: bigint;
availableNoteCount: number;
blockHash: Buffer | null;
sequence: number | null;
}>;
private getPendingDelta;
private getPendingDeltas;
private getUnconfirmedDelta;
private getUnconfirmedDeltas;
calculateAvailableBalance(headSequence: number, assetId: Buffer, confirmations: number, tx?: IDatabaseTransaction): Promise<{
balance: bigint;
noteCount: number;
}>;
getUnconfirmedBalances(tx?: IDatabaseTransaction): Promise>;
getUnconfirmedBalance(assetId: Buffer, tx?: IDatabaseTransaction): Promise;
updateUnconfirmedBalances(balanceDeltas: BufferMap, blockHash: Buffer | null, sequence: number | null, tx?: IDatabaseTransaction): Promise;
saveUnconfirmedBalance(assetId: Buffer, balance: BalanceValue, tx?: IDatabaseTransaction): Promise;
getHead(tx?: IDatabaseTransaction): Promise;
updateHead(head: HeadValue | null, tx?: IDatabaseTransaction): Promise;
updateCreatedAt(createdAt: HeadValue | null, tx?: IDatabaseTransaction): Promise;
updateScanningEnabled(scanningEnabled: boolean, options?: {
masterKey: MasterKey | null;
}, tx?: IDatabaseTransaction): Promise;
getTransactionNotes(transaction: Transaction): Promise>;
getMultisigParticipantIdentities(): Array;
encrypt(masterKey: MasterKey): EncryptedAccount;
}
export declare function calculateAccountPrefix(id: string): Buffer;
export {};
//# sourceMappingURL=account.d.ts.map