/** * Wallet signer operations: build add/update/remove signer transactions, encode * the SDK-side {@link SignerKey}/{@link SignerLimits} helpers into the contract's * union types, and read a signer entry back from the ledger. * * `getSigner` reads the flat top-level `SignerKey → SignerVal` entry directly via * RPC (temporary durability before persistent, per the contract's lookup * invariant). This doubles as `connectWallet`'s ownership check (#601 F7): a * keyId that resolves to a live signer entry proves the wallet actually knows * that passkey. When the contract's `get_signer` view lands (A3) this can move * onto the view; the ledger read is equivalent and works today. * * @packageDocumentation */ import { type Server } from "@stellar/stellar-sdk/rpc"; import type { AssembledTransaction, Result, Spec as ContractSpec } from "@stellar/stellar-sdk/contract"; import { Client as PasskeyClient, type SignerKey as SDKSignerKey, type SignerLimits as SDKSignerLimits, type SignerVal } from "passkey-kit-sdk"; import { SignerStore, type SignerKey, type SignerLimits } from "../types.js"; /** * The result of a signer-write / upgrade transaction. The reworked contract's * admin functions are typed `Result` (they return `Ok(())` or a typed * contract error), so the AssembledTransaction is generic over that. */ export type WalletTx = AssembledTransaction>; /** Which write the builder targets. */ type SignerFn = "add_signer" | "update_signer"; /** Encode a SDK-side {@link SignerKey} helper into the contract's union. */ export declare function toContractSignerKey({ key, value }: SignerKey): SDKSignerKey; /** Encode SDK-side {@link SignerLimits} into the contract's `SignerLimits`. */ export declare function toContractSignerLimits(limits: SignerLimits): SDKSignerLimits; /** Shared deps for building signer-write transactions. */ export interface WalletWriteDeps { wallet: PasskeyClient; timeoutInSeconds: number; } export declare function buildSecp256r1SignerTx(deps: WalletWriteDeps, fn: SignerFn, keyId: string | Uint8Array, publicKey: string | Uint8Array, limits: SignerLimits, store: SignerStore, expiration?: number): Promise; export declare function buildEd25519SignerTx(deps: WalletWriteDeps, fn: SignerFn, publicKey: string, limits: SignerLimits, store: SignerStore, expiration?: number): Promise; export declare function buildPolicySignerTx(deps: WalletWriteDeps, fn: SignerFn, policy: string, limits: SignerLimits, store: SignerStore, expiration?: number): Promise; export declare function buildRemoveSignerTx(deps: WalletWriteDeps, signerKey: SignerKey): Promise; /** Build an `upgrade(new_wasm_hash)` transaction (renamed from update_contract_code). */ export declare function buildUpgradeTx(deps: WalletWriteDeps, newWasmHash: Buffer | Uint8Array): Promise; /** * Read a signer entry from the ledger, or `null` if absent. * * Checks temporary durability before persistent (the contract's lookup order). * A non-null result proves the wallet holds this signer — the basis of * `connectWallet`'s ownership verification. * * `null` means a genuine not-found in BOTH durabilities. A transport error * (RPC 429/5xx/timeout) is NOT swallowed — it propagates, so `connectWallet` * never mistakes a flaky RPC for "the passkey is not a signer" and throws a * misleading `WalletOwnershipError` for a valid credential. */ export declare function getSigner(deps: { rpc: Server; spec: ContractSpec; }, contractId: string, signerKey: SignerKey): Promise; export {}; //# sourceMappingURL=wallet-ops.d.ts.map