import type { HexString } from '../types/index.js'; import type { PoolMetadata } from '../types/poolMetadata.js'; import type { PoolContext } from './weiroll.js'; /** * All well-known magic variable keys. Each is prefixed with `$` to * distinguish them from protocol-specific manifest variables. * * Magic variables are resolved automatically by the SDK from pool metadata; * they are always pinned (stateBitmap bit = 1). */ export declare const MAGIC_VARIABLE_KEYS: readonly ["$executor", "$onchainPM", "$poolEscrow", "$onOffRamp", "$poolId", "$scId", "$accountingTokenId", "$accountingTokenAssetId"]; export type MagicVariableKey = (typeof MAGIC_VARIABLE_KEYS)[number]; /** * Typed inputs required to resolve the SDK's magic variables. * * All values must be ABI-encoded as 32-byte hex strings so they can be * stored directly in the weiroll state array (bytes32 slots). * * Typical encoding per variable: * - addresses (`$executor`, `$poolEscrow`, `$onOffRamp`): left-zero-padded to 32 bytes * - `$poolId`: uint64 value encoded as uint256 (32 bytes) * - `$scId`: bytes16 value right-zero-padded to 32 bytes * - `$accountingTokenId`, `$accountingTokenAssetId`: uint256 (32 bytes) */ export interface MagicVariableContext { /** Address of the workflow executor for this pool, typically the OnchainPM. */ executor: HexString; /** Address of the pool escrow contract. */ poolEscrow: HexString; /** Address of the on/off ramp manager for the share class. */ onOffRamp: HexString; /** Pool ID (uint64) ABI-encoded as a 32-byte value. */ poolId: HexString; /** Share class ID (bytes16) right-zero-padded to 32 bytes. */ scId: HexString; /** ERC6909 accounting token ID for the share class, as a 32-byte value. */ accountingTokenId: HexString; /** Asset ID of the accounting token, as a 32-byte value. */ accountingTokenAssetId: HexString; } /** * Builds a `PoolContext` from a typed `MagicVariableContext` by mapping * each `$`-prefixed magic variable key to its resolved value. * * Pass the returned object as `poolContext` in `buildScript()`: * * ```typescript * const poolContext = resolveMagicVariables(ctx) * const script = buildScript(workflow, { poolContext, configurableValues }) * ``` * * @throws if any value is not a valid 32-byte ABI-encoded hex string */ export declare function resolveMagicVariables(context: MagicVariableContext): PoolContext; /** * Returns a human-readable `{ value, label }` pair for a resolved variable. * * Used by the backend to enrich API responses so the frontend never displays * raw on-chain data. Example: * * ```typescript * resolveVariableLabel('$scId', '0x00010000000000010000000000000001', meta) * // → { value: '0x000100...', label: 'JTRSY' } * ``` * * Label resolution priority: * 1. `poolMetadata.addressLabels[value]` — pool-manager-maintained free-form map * 2. Key-specific fallbacks (e.g. pool name for `$poolId`) * 3. Raw hex string as final fallback * * Pool managers can register labels for any address or slot value via the * `addressLabels` field of the pool metadata to customise what the UI shows. */ export declare function resolveVariableLabel(key: string, value: HexString, poolMetadata: PoolMetadata): { value: HexString; label: string; }; //# sourceMappingURL=variables.d.ts.map