import { A as AuthClient } from './auth-CA_YKtM2.js'; import { PolkadotSigner } from 'polkadot-api'; import { R as ResolvedSigner } from './signer-Duup0hgQ.js'; import { A as AllocatableResource } from './allocations-CEPeZr6T.js'; import '@parity/product-sdk-terminal'; import '@parity/product-sdk-tx'; declare class MainnetDefaultWorkerError extends Error { constructor(); } interface DeployActors { worker: ResolvedSigner; /** Set ⇔ transfer-mode is active (signed in && transfer enabled). */ recipientH160?: string; } interface ResolveDeployActorsOptions { suri?: string; transferEnabled: boolean; isTestnet: boolean; sessionPresent: boolean; } declare function resolveDeployActors(authClient: AuthClient, { suri, transferEnabled, isTestnet, sessionPresent }: ResolveDeployActorsOptions): Promise; /** * Result returned by resolveStorageSigner when a Bulletin slot signer was found. * * `owned` is true when the slot comes from the user's own session (cache-hit or * freshly allocated via step-4 prompt). It is used by formatStorageSignerLine to * distinguish "your allowance slot" (owned) from "allowance slot" (explicitly * injected by a programmatic caller). */ interface StorageSignerResult { signer: PolkadotSigner; slotAddress: string; /** true when the slot comes from the user's own session (not a pre-injected slot). */ owned: true; } /** * Injectable dependencies for resolveStorageSigner. * All fields are optional — defaults are used when not provided (deploy path). * Injecting stubs lets unit tests drive every branch without a real adapter. */ interface StorageSignerDeps { /** * Calls adapter.allowance.getBulletinSigner(sessionId, productId). * Returns an Ok/Err result (product-sdk shape). */ getBulletinSigner: (sessionId: string, productId: string, adapter: any) => Promise<{ isOk(): boolean; isErr(): boolean; value?: PolkadotSigner; error?: { reason: string; }; }>; /** * Triggers a phone prompt to allocate the BulletInAllowance resource. * Returns AllocationOutcome[] — one per resource in order. */ requestResourceAllocation: (userSession: any, adapter: any, resources: AllocatableResource[]) => Promise<{ tag: string; value?: unknown; }[]>; /** * Read the cached slot account signer written by requestResourceAllocation. * Returns null on a miss (graceful fallback). */ createSlotAccountSigner?: (adapter: any, resource: AllocatableResource) => Promise; /** Encode a public key as SS58. */ ss58Encode: (publicKey: Uint8Array) => string; /** * Called BEFORE requestResourceAllocation to print the user-facing prompt. * Should print the "check your phone" warning so the user knows what's coming. * Ctrl-C will interrupt the subsequent requestResourceAllocation call directly. */ promptBeforeAllocation: () => void; } /** * Resolve a user-owned Bulletin slot signer from the active session. * * Implements steps 3–4 of the storage-signer precedence: * 3. Cache-hit: adapter.allowance.getBulletinSigner(sessionId) → slot signer. * 4. Cache-miss (NotAvailable / Rejected): prompt then requestResourceAllocation * ([BulletInAllowance]) → newly-allocated slot signer. * 5. Fall through: returns null → caller falls back to pool. * * Non-goals: explicit storageSigner / signer / mnemonic paths — those are handled * upstream by selectStorageReconnect. This function only handles session-derived slots. * * Layer-3 isolation is preserved: when `session` is null (no session file on disk, * no --suri), this function returns null immediately without touching the SSO stack. * * @param session The resolved session object from resolveDeployActors (or null when * no session is present). Must have { userSession, adapter } shape. * @param deps Injectable dependencies for testing. Production callers pass * undefined to use the real auth functions. * @returns A { signer, slotAddress, owned: true } result or null (→ pool). */ declare function resolveStorageSigner(session: { userSession: { id: string; }; adapter: any; } | null | undefined, deps: StorageSignerDeps): Promise; export { type DeployActors, MainnetDefaultWorkerError, type ResolveDeployActorsOptions, type StorageSignerDeps, type StorageSignerResult, resolveDeployActors, resolveStorageSigner };