/** * Represents an Aleo account */ interface Account { /** * The account's private key */ privateKey?: string; /** * The account's view key */ viewKey?: string; /** * The account's address */ address: string; } /** * Account creation options */ interface AccountOptions { privateKey?: string; seed?: Uint8Array; } /** Aleo address string (view_key * G) */ type address = string; /** Boolean value (true or false) */ type bool = boolean | string; /** Aleo group element (often used for commitments or public keys) */ type group = string; /** Unsigned 8-bit integer (0 to 255) */ type u8 = number | string; /** Unsigned 16-bit integer (0 to 65,535) */ type u16 = number | string; /** Unsigned 32-bit integer (0 to 4,294,967,295) */ type u32 = number | string; /** Unsigned 64-bit integer (bigint for full precision) */ type u64 = bigint | string; /** Unsigned 128-bit integer (bigint for full precision) */ type u128 = bigint | string; /** Signed 8-bit integer (-128 to 127) */ type i8 = number | string; /** Signed 16-bit integer (-32,768 to 32,767) */ type i16 = number | string; /** Signed 32-bit integer (-2,147,483,648 to 2,147,483,647) */ type i32 = number | string; /** Signed 64-bit integer (bigint for full precision) */ type i64 = bigint | string; /** Signed 128-bit integer (bigint for full precision) */ type i128 = bigint | string; /** Aleo field element */ type field = string; /** Aleo scalar value */ type scalar = string; /** Aleo signature string (result of signing a message with a private key) */ type signature = string; /** A union type of all possible Aleo atomic types */ type Literal = address | bool | group | u8 | u16 | u32 | u64 | u128 | i8 | i16 | i32 | i64 | i128 | field | scalar | signature; /** An enum enumerating all literal types. */ declare enum LiteralType { ADDRESS = "address", BOOL = "bool", GROUP = "group", U8 = "u8", U16 = "u16", U32 = "u32", U64 = "u64", U128 = "u128", I8 = "i8", I16 = "i16", I32 = "i32", I64 = "i64", I128 = "i128", FIELD = "field", SCALAR = "scalar", SIGNATURE = "signature" } /** Aleo struct type */ type Struct = { [key: string]: Array$1 | Literal | Struct; }; /** An aleo array type */ type Array$1 = Array$1[] | Literal[] | Struct[]; /** All possible plaintext types */ type Plaintext = Array$1 | Literal | Struct; /** An enum enumerating all plaintext types. */ declare enum PlaintextType { ARRAY = "array", LITERAL = "literal", STRUCT = "struct" } /** Ciphertext type */ type Ciphertext = string; /** An aleo record type */ interface Record$1 { owner: address; [key: string]: Array$1 | Literal | Struct; nonce: string; } /** An aleo future type */ type Future = { programId: string; function: string; value: Future[] | Plaintext[]; }; /** A union type of all possible Aleo types */ type Value = Plaintext | Record$1 | Future; /** An enum enumerating all value types. */ declare enum ValueType { PLAINTEXT = "plaintext", RECORD = "record", FUTURE = "future" } /** * Status of a transaction */ declare enum TransactionStatus { PENDING = "pending", ACCEPTED = "accepted", FAILED = "failed", REJECTED = "rejected" } /** * Represents an Aleo transaction */ interface Transaction { /** * The transaction ID */ id: string; /** * The transaction status */ status: TransactionStatus; /** * The block height at which the transaction was confirmed */ blockHeight?: number; /** * The transaction fee */ fee?: number; /** * The transaction data */ data?: Record; } /** * Per-field comparison conditions on a record field. All present operators are AND-combined. */ interface RecordFieldFilter { eq?: string; gte?: string; lte?: string; neq?: string; } /** * Map from a record field name (or dotted struct path, e.g. "data.amount") to a filter. * Multiple entries are AND-combined. */ type RecordFilters = Record; /** * A request the dapp emits in place of a literal input. The wallet fulfills the * request before passing the transaction to the SDK. See * `docs/adapter-privacy-extension.md` for the full specification. */ type InputRequest = { /** Fill the input slot with the active address. Allowed in `address`, `group`, `scalar`, or `field` positions. */ type: 'address'; label?: string; } | { /** * Use an owned record of type `program/recordname` as the input. When * `uid` is present, it pins a specific record previously returned by * `requestRecords` and `filters` is ignored. When absent, the wallet * auto-selects an unspent record of `recordname` matching `filters`. * `uid` and `filters` are mutually exclusive — supplying both is rejected * before reaching the wallet. * * `recordname` is required so the gate can match the request against the * dapp's grant on the same `(program, recordname, field)` triple the * grant model uses; without it, filter keys that collide across record * types in the same program would be ambiguous. Allowed in `record`, * `dynamic_record`, or `external_record` positions. */ type: 'record'; program: string; recordname: string; filters?: RecordFilters; uid?: string; } | { /** * Fill the input slot with the output of a wallet-evaluated cryptographic * algorithm. The wallet runs the named `algorithm` over its own state * (view key, wallet-maintained counters, etc.) plus the dapp's `args`, * and substitutes the result into the slot. The dapp never observes the * wallet-side inputs — only the output. * * Strictly opt-in: the wallet refuses every derived request whose * `(algorithm, program, function, inputPosition)` tuple is not present * in the connection's `algorithmsAllowed`. Each algorithm declares its * `args` schema and output Aleo type; the output type determines which * input positions are valid (same rules as `type: "address"`). */ type: 'derived'; algorithm: AlgorithmName; args: Record; label?: string; }; /** Algorithms that conforming wallets are expected to implement. */ declare const KNOWN_ALGORITHMS: readonly ["program-scoped-blinding-factor", "program-scoped-blinded-address"]; /** * New algorithms are added to `KNOWN_ALGORITHMS` as they're standardized. The * `(string & {})` extension in `AlgorithmName` permits unknown values for * forward-compat: a wallet shipping a new algorithm before this catalog is * updated can still be addressed. The wallet validates at runtime against its * own `algorithmsSupported()` list. */ type KnownAlgorithm = (typeof KNOWN_ALGORITHMS)[number]; type AlgorithmName = KnownAlgorithm | (string & Record); /** Arg-level type: an Aleo literal type, or "string" for non-literal args (enums, identifiers). */ type ArgType = LiteralType | 'string'; /** * One typed argument passed to a wallet-side cryptographic algorithm. The * wallet parses `value` according to `type` — either an Aleo primitive type * (`LiteralType`) or `"string"` for non-literal args such as enum identifiers. */ interface AlgorithmArg { type: ArgType; value: string; } /** A per-arg grant constraint: a fixed allowlist of acceptable values, or "any". */ type ArgConstraint = string[] | 'any'; /** * Static catalog of known algorithms — their dapp-provided `args` schema, the * Aleo type of their output, and the input-slot positions where they are * valid. The wallet is the source of truth at runtime; this registry lets the * SDK and dapp tooling render correct forms and pre-validate shapes. */ declare const ALGORITHM_SCHEMAS: { readonly 'program-scoped-blinding-factor': { readonly args: { readonly mode: { readonly type: ArgType; readonly possibleValues: readonly ["issue", "resolve"]; }; readonly membershipProgram: { readonly type: ArgType; }; readonly membershipMapping: { readonly type: ArgType; }; readonly targetAddress: { readonly type: ArgType; readonly optional: true; }; }; readonly outputType: LiteralType; readonly validSlotTypes: LiteralType[]; }; readonly 'program-scoped-blinded-address': { readonly args: { readonly mode: { readonly type: ArgType; readonly possibleValues: readonly ["issue", "resolve"]; }; readonly membershipProgram: { readonly type: ArgType; }; readonly membershipMapping: { readonly type: ArgType; }; readonly targetAddress: { readonly type: ArgType; readonly optional: true; }; }; readonly outputType: LiteralType; readonly validSlotTypes: LiteralType[]; }; }; /** * One element of a transaction's `inputs` array. A literal Aleo value (string) * or an `InputRequest` describing a value the wallet should supply. */ type TransactionInput = string | InputRequest; /** * Structured form of a record's plaintext fields, returned alongside the * wallet-defined record envelope from `requestRecords`. Only fields the dapp * has read access to are present; redacted fields are omitted (not * present-with-undefined). See `docs/adapter-privacy-extension.md` for the * grant rules that govern field exposure. */ interface RecordView { fields: Record; } /** * Additive contract for the per-record envelope returned by `requestRecords`. * Wallets keep their existing record shape (e.g. Shield's `OwnedRecord`); this * interface declares the two new fields conforming wallets emit on top. * * - `recordView` — structured form of the plaintext, populated whenever the * wallet decrypted the record. * - `uid` — wallet-issued opaque handle, stable for the lifetime of the * connection. Pass back as `uid` in a `type: "record"` `InputRequest` to pin * this exact record. Not derived from the record's commitment, nonce, or tag. * * Both are optional in the type because pre-spec wallets won't emit them; * conforming wallets always populate them. */ interface RecordEnvelope { recordView?: RecordView; uid?: string; [legacyField: string]: unknown; } /** Type guard for a literal input slot. */ declare function isLiteralInput(input: TransactionInput): input is string; /** Returns true if any element of `inputs` is an `InputRequest` rather than a literal. */ declare function hasInputRequest(inputs: TransactionInput[]): boolean; /** * Transaction creation options */ interface TransactionOptions { /** * The program to execute */ program: string; /** * The function to call */ function: string; /** * The function inputs. Each entry is either a literal Aleo value (string) * or an `InputRequest` describing a value the wallet should supply. */ inputs: TransactionInput[]; /** * The transaction fee to pay */ fee?: number; /** * Record indices to use */ recordIndices?: number[]; /** * Whether the fee is private */ privateFee?: boolean; /** * List of program names that should be imported when calling a dynamic dispatch function. */ imports?: string[]; } /** * Transaction status response */ interface TransactionStatusResponse { /** * The transaction status */ status: string; /** * The onchain transaction ID (if already exists) */ transactionId?: string; /** * The error message (if any) */ error?: string; } /** * response of requestTransactionHistory */ interface TxHistoryResult { transactions: Array<{ transactionId: string; id: string; }>; } /** * Supported Aleo networks */ declare enum Network { MAINNET = "mainnet", TESTNET = "testnet", CANARY = "canary" } /** * Network configuration */ interface NetworkConfig { /** * Network name */ network: Network; /** * API endpoint for the network */ apiUrl: string; /** * Explorer URL for the network */ explorerUrl?: string; /** * Chain ID for the network */ chainId: string; } export { ALGORITHM_SCHEMAS, type Account, type AccountOptions, type AlgorithmArg, type AlgorithmName, type ArgConstraint, type ArgType, type Array$1 as Array, type Ciphertext, type Future, type InputRequest, KNOWN_ALGORITHMS, type KnownAlgorithm, type Literal, LiteralType, Network, type NetworkConfig, type Plaintext, PlaintextType, type Record$1 as Record, type RecordEnvelope, type RecordFieldFilter, type RecordFilters, type RecordView, type Struct, type Transaction, type TransactionInput, type TransactionOptions, TransactionStatus, type TransactionStatusResponse, type TxHistoryResult, type Value, ValueType, type address, type bool, type field, type group, hasInputRequest, type i128, type i16, type i32, type i64, type i8, isLiteralInput, type scalar, type signature, type u128, type u16, type u32, type u64, type u8 };