@steerprotocol/app-loader 3.0.6 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +86 -0
  2. package/lib/browser.d.ts +5 -2
  3. package/lib/browser.mjs +247 -72
  4. package/lib/browser.mjs.map +1 -1
  5. package/lib/index.cjs +3687 -107
  6. package/lib/index.cjs.map +1 -1
  7. package/lib/index.d.ts +5 -2
  8. package/lib/index.mjs +3687 -107
  9. package/lib/index.mjs.map +1 -1
  10. package/lib/internal/asyncHostCalls.d.ts +37 -0
  11. package/lib/internal/instantiate.d.ts +3 -4
  12. package/lib/internal/loadOptions.d.ts +1 -0
  13. package/lib/internal/panoptic/deps.d.ts +24 -0
  14. package/lib/internal/panoptic/dynamicJobs/fragments.d.ts +10 -0
  15. package/lib/internal/panoptic/dynamicJobs/renderExecuteJob.d.ts +8 -0
  16. package/lib/internal/panoptic/fragments/collateral.d.ts +5 -0
  17. package/lib/internal/panoptic/fragments/erc20.d.ts +3 -0
  18. package/lib/internal/panoptic/fragments/hypovault.d.ts +12 -0
  19. package/lib/internal/panoptic/fragments/merkle.d.ts +22 -0
  20. package/lib/internal/panoptic/fragments/panoptic.d.ts +17 -0
  21. package/lib/internal/panoptic/fragments/permit2.d.ts +3 -0
  22. package/lib/internal/panoptic/fragments/support.d.ts +16 -0
  23. package/lib/internal/panoptic/fragments/uniswap.d.ts +10 -0
  24. package/lib/internal/panoptic/fragments/weth.d.ts +19 -0
  25. package/lib/internal/panoptic/handlers.d.ts +27 -0
  26. package/lib/internal/panoptic/protocol.d.ts +29 -0
  27. package/lib/internal/panoptic/reads/account.d.ts +11 -0
  28. package/lib/internal/panoptic/reads/greeks.d.ts +5 -0
  29. package/lib/internal/panoptic/reads/hypovault.d.ts +7 -0
  30. package/lib/internal/panoptic/reads/pool.d.ts +10 -0
  31. package/lib/internal/panoptic/reads/uniswap.d.ts +6 -0
  32. package/lib/internal/panoptic/support.d.ts +20 -0
  33. package/lib/internal/panopticBrowserRuntime.d.ts +6 -0
  34. package/lib/internal/panopticDtos.d.ts +72 -0
  35. package/lib/internal/panopticHostEnvelope.d.ts +2 -0
  36. package/lib/internal/panopticHostImport.d.ts +17 -0
  37. package/lib/internal/panopticJsonArgs.d.ts +26 -0
  38. package/lib/internal/panopticRuntime.d.ts +12 -0
  39. package/lib/internal/panopticScalars.d.ts +10 -0
  40. package/lib/internal/panopticSerialization.d.ts +19 -0
  41. package/lib/internal/panopticSources.d.ts +22 -0
  42. package/lib/loadOptions.d.ts +5 -0
  43. package/lib/node.cjs +3634 -72
  44. package/lib/node.cjs.map +1 -1
  45. package/lib/node.d.ts +5 -2
  46. package/lib/node.mjs +3634 -72
  47. package/lib/node.mjs.map +1 -1
  48. package/lib/panoptic.cjs +19 -0
  49. package/lib/panoptic.cjs.map +1 -0
  50. package/lib/panoptic.d.ts +56 -0
  51. package/lib/panoptic.mjs +1 -0
  52. package/lib/panoptic.mjs.map +1 -0
  53. package/package.json +44 -3
@@ -0,0 +1,37 @@
1
+ type StagedHostCall = {
2
+ kind: 'fetch-buffer';
3
+ run: () => Promise<ArrayBuffer>;
4
+ } | {
5
+ kind: 'ccxt-ohlcv';
6
+ run: () => Promise<number[][]>;
7
+ } | {
8
+ kind: 'panoptic-json';
9
+ run: () => Promise<string>;
10
+ };
11
+ type CompletedHostCall = {
12
+ kind: 'fetch-buffer';
13
+ value: ArrayBuffer;
14
+ } | {
15
+ kind: 'ccxt-ohlcv';
16
+ value: number[][];
17
+ } | {
18
+ kind: 'panoptic-json';
19
+ value: string;
20
+ };
21
+ type AsyncHostCallSlot = {
22
+ stage(call: StagedHostCall): void;
23
+ complete(): Promise<void>;
24
+ take(kind: 'fetch-buffer'): Extract<CompletedHostCall, {
25
+ kind: 'fetch-buffer';
26
+ }>;
27
+ take(kind: 'ccxt-ohlcv'): Extract<CompletedHostCall, {
28
+ kind: 'ccxt-ohlcv';
29
+ }>;
30
+ take(kind: 'panoptic-json'): Extract<CompletedHostCall, {
31
+ kind: 'panoptic-json';
32
+ }>;
33
+ reset(): void;
34
+ };
35
+ declare function createAsyncHostCallSlot(): AsyncHostCallSlot;
36
+ export { createAsyncHostCallSlot };
37
+ export type { AsyncHostCallSlot, CompletedHostCall, StagedHostCall };
@@ -1,15 +1,14 @@
1
1
  import { Candle } from '../Candle';
2
2
  import { RawTradeData } from '../RawTradeData';
3
3
  import type { WasmModule } from '../WasmModule';
4
- /**
5
- * Runtime-provided host adapters for environment-specific dependencies.
6
- */
4
+ import type { JsonValue, PanopticCallRequest, PanopticCallResponse } from './panopticHostEnvelope';
7
5
  type RuntimeAdapters = {
8
6
  getFetch?: () => Promise<typeof fetch>;
9
7
  getCcxt?: () => Promise<any>;
8
+ callPanoptic?: (method: string, request: PanopticCallRequest) => Promise<PanopticCallResponse>;
10
9
  };
11
10
  export { Candle, RawTradeData };
12
- export type { WasmModule };
11
+ export type { JsonValue, PanopticCallRequest, PanopticCallResponse, WasmModule };
13
12
  /**
14
13
  * Instantiates a wasm module and wraps its exports with host-side helpers.
15
14
  * @param module - Compiled wasm module.
@@ -0,0 +1 @@
1
+ export type { LoadWasmOptions } from '../loadOptions';
@@ -0,0 +1,24 @@
1
+ type RuntimeImport = (specifier: string) => Promise<unknown>;
2
+ type PanopticDependencyKey = 'sdk' | 'sdkV2' | 'uniswap' | 'viem';
3
+ type PanopticDependencies = {
4
+ sdk(): Promise<Record<string, unknown>>;
5
+ sdkV2(): Promise<Record<string, unknown>>;
6
+ uniswap(): Promise<Record<string, unknown>>;
7
+ viem(): Promise<Record<string, unknown>>;
8
+ };
9
+ declare const PANOPTIC_MODULE_SPECIFIERS: Record<PanopticDependencyKey, string>;
10
+ declare function createPanopticDependencies(): PanopticDependencies;
11
+ /**
12
+ * Loads a Panoptic runtime module through always-dynamic import.
13
+ */
14
+ declare function loadPanopticModule(key: PanopticDependencyKey): Promise<unknown>;
15
+ /**
16
+ * Test-only hook for proving the dynamic-import path without installing the SDK.
17
+ */
18
+ declare function __setPanopticRuntimeImportForTests(importer: RuntimeImport): void;
19
+ /**
20
+ * Test-only cache reset.
21
+ */
22
+ declare function __resetPanopticRuntimeForTests(): void;
23
+ export { PANOPTIC_MODULE_SPECIFIERS, __resetPanopticRuntimeForTests, __setPanopticRuntimeImportForTests, createPanopticDependencies, loadPanopticModule, };
24
+ export type { PanopticDependencies, RuntimeImport };
@@ -0,0 +1,10 @@
1
+ type DynamicJobFragment = {
2
+ target: string;
3
+ userProvidedData: string;
4
+ strategyProvidedData: string;
5
+ value: string;
6
+ };
7
+ declare function makeDynamicJobFragment(input: DynamicJobFragment): DynamicJobFragment;
8
+ declare function validateDynamicJobFragment(value: unknown, label: string): DynamicJobFragment;
9
+ export { makeDynamicJobFragment, validateDynamicJobFragment };
10
+ export type { DynamicJobFragment };
@@ -0,0 +1,8 @@
1
+ import type { PanopticHandler } from '../handlers';
2
+ type DynamicJobExecutePayload = {
3
+ functionName: 'executeJob(address[],bytes[],bytes[])';
4
+ typesArray: string[];
5
+ valuesArray: string[][];
6
+ };
7
+ declare function renderExecuteJob({ request, method }: Parameters<PanopticHandler>[0]): DynamicJobExecutePayload;
8
+ export { renderExecuteJob };
@@ -0,0 +1,5 @@
1
+ import type { PanopticHandler } from '../handlers';
2
+ declare function depositFragment({ deps, method, request, options }: Parameters<PanopticHandler>[0]): Promise<import("../dynamicJobs/fragments").DynamicJobFragment>;
3
+ declare function withdrawFragment({ deps, method, request, options }: Parameters<PanopticHandler>[0]): Promise<import("../dynamicJobs/fragments").DynamicJobFragment>;
4
+ declare function withdrawWithPositionsFragment({ deps, method, request, options }: Parameters<PanopticHandler>[0]): Promise<import("../dynamicJobs/fragments").DynamicJobFragment>;
5
+ export { depositFragment, withdrawFragment, withdrawWithPositionsFragment };
@@ -0,0 +1,3 @@
1
+ import type { PanopticHandler } from '../handlers';
2
+ declare function approveFragment({ deps, method, request, options }: Parameters<PanopticHandler>[0]): Promise<import("../dynamicJobs/fragments").DynamicJobFragment>;
3
+ export { approveFragment };
@@ -0,0 +1,12 @@
1
+ import type { PanopticHandler } from '../handlers';
2
+ declare function fulfillDepositsFragment({ deps, method, request, options }: Parameters<PanopticHandler>[0]): Promise<import("../dynamicJobs/fragments").DynamicJobFragment>;
3
+ declare function fulfillWithdrawalsFragment({ deps, method, request, options }: Parameters<PanopticHandler>[0]): Promise<import("../dynamicJobs/fragments").DynamicJobFragment>;
4
+ declare function manageCalldataParts({ deps, method, request, options }: Parameters<PanopticHandler>[0]): Promise<{
5
+ functionName: string;
6
+ calldata: string;
7
+ userProvidedData: string;
8
+ strategyProvidedData: string;
9
+ value: string;
10
+ }>;
11
+ declare function manageFragment({ deps, method, request, options }: Parameters<PanopticHandler>[0]): Promise<import("../dynamicJobs/fragments").DynamicJobFragment>;
12
+ export { fulfillDepositsFragment, fulfillWithdrawalsFragment, manageCalldataParts, manageFragment };
@@ -0,0 +1,22 @@
1
+ import type { PanopticHandler } from '../handlers';
2
+ declare function manageVaultWithVerificationFragment({ deps, method, request, options }: Parameters<PanopticHandler>[0]): Promise<import("../dynamicJobs/fragments").DynamicJobFragment>;
3
+ declare function findLeaf({ request, method }: Parameters<PanopticHandler>[0]): {
4
+ action: string;
5
+ description: string;
6
+ leafDigest: string;
7
+ decoder: string;
8
+ target: string;
9
+ functionSignature: string;
10
+ functionSelector: string;
11
+ canSendValue: boolean;
12
+ proof: string[];
13
+ };
14
+ declare function buildManageArgs({ request, method }: Parameters<PanopticHandler>[0]): {
15
+ proofs: string[][];
16
+ decoders: string[];
17
+ innerTargets: string[];
18
+ innerDatas: string[];
19
+ values: bigint[];
20
+ leaves: Record<string, unknown>[];
21
+ };
22
+ export { buildManageArgs, findLeaf, manageVaultWithVerificationFragment };
@@ -0,0 +1,17 @@
1
+ import type { PanopticHandler } from '../handlers';
2
+ declare function dispatchCalldataParts({ deps, request, method }: Parameters<PanopticHandler>[0]): Promise<{
3
+ functionName: string;
4
+ userProvidedData: string;
5
+ strategyProvidedData: string;
6
+ calldata: string;
7
+ }>;
8
+ declare function dispatchFragment({ deps, request, options, method }: Parameters<PanopticHandler>[0]): Promise<import("../dynamicJobs/fragments").DynamicJobFragment>;
9
+ declare function dispatchExplicitCalldataParts({ deps, request, method }: Parameters<PanopticHandler>[0]): Promise<{
10
+ functionName: string;
11
+ userProvidedData: string;
12
+ strategyProvidedData: string;
13
+ calldata: string;
14
+ value: string;
15
+ }>;
16
+ declare function dispatchExplicitFragment({ deps, request, options, method }: Parameters<PanopticHandler>[0]): Promise<import("../dynamicJobs/fragments").DynamicJobFragment>;
17
+ export { dispatchCalldataParts, dispatchExplicitCalldataParts, dispatchExplicitFragment, dispatchFragment };
@@ -0,0 +1,3 @@
1
+ import type { PanopticHandler } from '../handlers';
2
+ declare function approveFragment({ deps, method, request, options }: Parameters<PanopticHandler>[0]): Promise<import("../dynamicJobs/fragments").DynamicJobFragment>;
3
+ export { approveFragment };
@@ -0,0 +1,16 @@
1
+ type SplitCalldataOptions = {
2
+ expectedSelector?: string;
3
+ staticArgWords?: number;
4
+ requireStrategyData?: boolean;
5
+ };
6
+ type SplitCalldataResult = {
7
+ calldata: string;
8
+ userProvidedData: string;
9
+ strategyProvidedData: string;
10
+ target?: string;
11
+ };
12
+ declare function splitCalldata(value: unknown, method: string, options?: SplitCalldataOptions): SplitCalldataResult;
13
+ declare function assertUserProvidedData(value: string, expected: string, method: string): void;
14
+ declare function addressAbiWord(address: string): string;
15
+ declare function uint256AbiWord(value: bigint): string;
16
+ export { addressAbiWord, assertUserProvidedData, splitCalldata, uint256AbiWord };
@@ -0,0 +1,10 @@
1
+ import type { PanopticHandler } from '../handlers';
2
+ declare function buildV3ExactInExecuteCalldataParts({ deps, request, method, options }: Parameters<PanopticHandler>[0]): Promise<{
3
+ functionName: string;
4
+ calldata: string;
5
+ userProvidedData: string;
6
+ strategyProvidedData: string;
7
+ value: string;
8
+ }>;
9
+ declare function buildV3ExactInExecuteFragment({ deps, request, method, options }: Parameters<PanopticHandler>[0]): Promise<import("../dynamicJobs/fragments").DynamicJobFragment>;
10
+ export { buildV3ExactInExecuteCalldataParts, buildV3ExactInExecuteFragment };
@@ -0,0 +1,19 @@
1
+ import type { PanopticHandler } from '../handlers';
2
+ type WethCalldataParts = {
3
+ functionName: 'deposit' | 'withdraw';
4
+ calldata: string;
5
+ userProvidedData: string;
6
+ strategyProvidedData: string;
7
+ value: string;
8
+ };
9
+ type HypovaultWethInnerCall = {
10
+ functionName: 'deposit' | 'withdraw';
11
+ target: string;
12
+ data: string;
13
+ value: string;
14
+ };
15
+ declare function depositCalldataParts({ request, method }: Parameters<PanopticHandler>[0]): WethCalldataParts;
16
+ declare function withdrawCalldataParts({ request, method }: Parameters<PanopticHandler>[0]): WethCalldataParts;
17
+ declare function hypovaultWethDepositInnerCall({ request, method }: Parameters<PanopticHandler>[0]): HypovaultWethInnerCall;
18
+ declare function hypovaultWethWithdrawInnerCall({ request, method }: Parameters<PanopticHandler>[0]): HypovaultWethInnerCall;
19
+ export { depositCalldataParts, hypovaultWethDepositInnerCall, hypovaultWethWithdrawInnerCall, withdrawCalldataParts };
@@ -0,0 +1,27 @@
1
+ import { projectPanopticSerializableValue } from '../panopticSerialization';
2
+ import type { PanopticRuntimeOptions } from '../../panoptic';
3
+ import type { PanopticOperationOptions } from '../panopticSources';
4
+ import type { PanopticDependencies } from './deps';
5
+ import { type PanopticCallRequest, type PanopticCallResponse } from './protocol';
6
+ type PanopticHandlerContext = {
7
+ deps: PanopticDependencies;
8
+ method: string;
9
+ request: PanopticCallRequest;
10
+ options: PanopticRuntimeOptions;
11
+ operationOptions?: PanopticOperationOptions;
12
+ };
13
+ type PanopticHandler = (context: PanopticHandlerContext) => Promise<unknown> | unknown;
14
+ type ExecutePanopticHandlerInput = {
15
+ method: string;
16
+ handler: PanopticHandler;
17
+ request: PanopticCallRequest;
18
+ deps: PanopticDependencies;
19
+ options?: PanopticRuntimeOptions;
20
+ operationOptions?: PanopticOperationOptions;
21
+ responseLimits?: Parameters<typeof projectPanopticSerializableValue>[1];
22
+ };
23
+ declare function getPanopticHandler(method: string): PanopticHandler | undefined;
24
+ declare function getPanopticHandlerNames(): string[];
25
+ declare function executePanopticHandler(input: ExecutePanopticHandlerInput): Promise<PanopticCallResponse>;
26
+ export { executePanopticHandler, getPanopticHandler, getPanopticHandlerNames };
27
+ export type { PanopticHandler };
@@ -0,0 +1,29 @@
1
+ import type { PanopticJsonValue } from '../../panoptic';
2
+ type JsonValue = PanopticJsonValue;
3
+ type PanopticCallRequest = {
4
+ context?: {
5
+ chainId?: string;
6
+ sourceId?: string;
7
+ blockNumber?: string;
8
+ account?: string;
9
+ panopticSubgraphId?: string;
10
+ rpcUrl?: string;
11
+ };
12
+ args?: JsonValue;
13
+ };
14
+ type PanopticCallResponse = {
15
+ ok: true;
16
+ result: JsonValue;
17
+ };
18
+ declare function parsePanopticRequest(value: string, maxBytes?: number): PanopticCallRequest;
19
+ declare function assertPanopticSuccessResponse(value: PanopticCallResponse): void;
20
+ declare function panopticSuccess(result: JsonValue): PanopticCallResponse;
21
+ declare function isJsonRecord(value: unknown): value is {
22
+ [key: string]: JsonValue;
23
+ };
24
+ declare function requestArgs(request: PanopticCallRequest, method: string): {
25
+ [key: string]: JsonValue;
26
+ };
27
+ declare function sanitizePanopticError(error: unknown): string;
28
+ export { assertPanopticSuccessResponse, isJsonRecord, panopticSuccess, parsePanopticRequest, requestArgs, sanitizePanopticError, };
29
+ export type { JsonValue, PanopticCallRequest, PanopticCallResponse };
@@ -0,0 +1,11 @@
1
+ import type { PanopticHandler } from '../handlers';
2
+ declare function getPosition({ deps, method, request, options, }: Parameters<PanopticHandler>[0]): Promise<Record<string, unknown>>;
3
+ declare function getPositions({ deps, method, request, options, }: Parameters<PanopticHandler>[0]): Promise<Record<string, unknown>>;
4
+ declare function getOpenPositionIds({ deps, method, request, options, }: Parameters<PanopticHandler>[0]): Promise<Record<string, unknown>>;
5
+ declare function getAccountCollateral({ deps, method, request, options, }: Parameters<PanopticHandler>[0]): Promise<Record<string, unknown>>;
6
+ declare function getAccountSummaryBasic({ deps, method, request, options, }: Parameters<PanopticHandler>[0]): Promise<Record<string, unknown>>;
7
+ declare function getAccountSummaryRisk({ deps, method, request, options, }: Parameters<PanopticHandler>[0]): Promise<Record<string, unknown>>;
8
+ declare function getNetLiquidationValue({ deps, method, request, options, }: Parameters<PanopticHandler>[0]): Promise<Record<string, unknown>>;
9
+ declare function getNetLiquidationValues({ deps, method, request, options, }: Parameters<PanopticHandler>[0]): Promise<Record<string, unknown>>;
10
+ declare function getLiquidationPrices({ deps, method, request, options, }: Parameters<PanopticHandler>[0]): Promise<Record<string, unknown>>;
11
+ export { getAccountCollateral, getAccountSummaryBasic, getAccountSummaryRisk, getLiquidationPrices, getNetLiquidationValue, getNetLiquidationValues, getOpenPositionIds, getPosition, getPositions, };
@@ -0,0 +1,5 @@
1
+ import type { PanopticHandler } from '../handlers';
2
+ declare function getPositionGreeks({ deps, method, request, options, }: Parameters<PanopticHandler>[0]): Promise<Record<string, unknown>>;
3
+ declare function calculatePositionGreeks({ deps, method, request }: Parameters<PanopticHandler>[0]): Promise<unknown>;
4
+ declare function calculateAccountGreeksPure({ deps, method, request }: Parameters<PanopticHandler>[0]): Promise<unknown>;
5
+ export { calculateAccountGreeksPure, calculatePositionGreeks, getPositionGreeks };
@@ -0,0 +1,7 @@
1
+ import type { PanopticHandler } from '../handlers';
2
+ declare function buildVaultManagerInputAtBlock({ deps, method, request, options, }: Parameters<PanopticHandler>[0]): Promise<Record<string, unknown>>;
3
+ declare function verifyVaultOpenTokenIdsAtBlock({ deps, method, request, options, }: Parameters<PanopticHandler>[0]): Promise<Record<string, unknown>>;
4
+ declare function getOpenPositionIds({ deps, method, request, options, }: Parameters<PanopticHandler>[0]): Promise<Record<string, unknown>>;
5
+ declare function getEpochContext({ deps, method, request, options, }: Parameters<PanopticHandler>[0]): Promise<Record<string, unknown>>;
6
+ declare function getPositionsHashStatus({ deps, method, request, options, }: Parameters<PanopticHandler>[0]): Promise<Record<string, unknown>>;
7
+ export { buildVaultManagerInputAtBlock, getEpochContext, getOpenPositionIds, getPositionsHashStatus, verifyVaultOpenTokenIdsAtBlock, };
@@ -0,0 +1,10 @@
1
+ import type { PanopticHandler } from '../handlers';
2
+ declare function getPool({ deps, method, request, options, }: Parameters<PanopticHandler>[0]): Promise<Record<string, unknown>>;
3
+ declare function fetchPoolId({ deps, method, request, options, }: Parameters<PanopticHandler>[0]): Promise<Record<string, unknown>>;
4
+ declare function getPoolMetadata({ deps, method, request, options, }: Parameters<PanopticHandler>[0]): Promise<Record<string, unknown>>;
5
+ declare function getRiskParameters({ deps, method, request, options, }: Parameters<PanopticHandler>[0]): Promise<Record<string, unknown>>;
6
+ declare function getUtilization({ deps, method, request, options, }: Parameters<PanopticHandler>[0]): Promise<Record<string, unknown>>;
7
+ declare function getOracleState({ deps, method, request, options, }: Parameters<PanopticHandler>[0]): Promise<Record<string, unknown>>;
8
+ declare function getTickSpacing({ deps, method, request }: Parameters<PanopticHandler>[0]): Promise<unknown>;
9
+ declare function getPricesAtTick({ deps, method, request }: Parameters<PanopticHandler>[0]): Promise<unknown>;
10
+ export { fetchPoolId, getOracleState, getPool, getPoolMetadata, getPricesAtTick, getRiskParameters, getTickSpacing, getUtilization, };
@@ -0,0 +1,6 @@
1
+ import type { PanopticHandler } from '../handlers';
2
+ declare function resolveSwapRoute({ deps, method, request, options, }: Parameters<PanopticHandler>[0]): Promise<Record<string, unknown>>;
3
+ declare function quoteSwapExactInViaRouter({ deps, method, request, options, }: Parameters<PanopticHandler>[0]): Promise<Record<string, unknown>>;
4
+ declare function quoteSwapExactOutViaRouter({ deps, method, request, options, }: Parameters<PanopticHandler>[0]): Promise<Record<string, unknown>>;
5
+ declare function checkRouterApproval({ deps, method, request, options, }: Parameters<PanopticHandler>[0]): Promise<Record<string, unknown>>;
6
+ export { checkRouterApproval, quoteSwapExactInViaRouter, quoteSwapExactOutViaRouter, resolveSwapRoute };
@@ -0,0 +1,20 @@
1
+ import type { JsonValue, PanopticCallRequest } from './protocol';
2
+ import { preparePanopticSourceContext, type PanopticResolvedCallContext } from '../panopticSources';
3
+ declare function rejectContext(request: PanopticCallRequest, method: string): void;
4
+ declare function requireSourceContext(request: PanopticCallRequest, method: string): void;
5
+ declare function rejectExtraKeys(args: {
6
+ [key: string]: JsonValue;
7
+ }, allowedKeys: readonly string[], method: string): void;
8
+ declare function requireString(value: unknown, label: string): string;
9
+ declare function requireSdkFunction(sdkModule: Record<string, unknown>, name: string, label: string): (...args: unknown[]) => unknown;
10
+ declare function prepareRuntimeSourceContext(deps: {
11
+ viem: () => Promise<Record<string, unknown>>;
12
+ }, request: PanopticCallRequest, options: {
13
+ sourceRegistry?: Parameters<typeof preparePanopticSourceContext>[2];
14
+ operation?: Parameters<typeof preparePanopticSourceContext>[3];
15
+ clientCache?: Parameters<typeof preparePanopticSourceContext>[4];
16
+ }): Promise<PanopticResolvedCallContext>;
17
+ declare function withSource(value: unknown, sourceContext: PanopticResolvedCallContext, blockNumberRole: 'pinned' | 'sdkResult' | 'preflight' | 'staticReference', label: string, blockNumber?: string, reconciled?: boolean): Record<string, unknown>;
18
+ declare function isRecord(value: unknown): value is Record<string, unknown>;
19
+ export { isRecord, prepareRuntimeSourceContext, rejectContext, rejectExtraKeys, requireSdkFunction, requireSourceContext, requireString, withSource, };
20
+ export type { PanopticResolvedCallContext };
@@ -0,0 +1,6 @@
1
+ import type { PanopticCallRequest, PanopticCallResponse } from './panopticHostEnvelope';
2
+ /**
3
+ * Browser Panoptic adapter placeholder. Phase 8 owns the browser loading model.
4
+ */
5
+ declare function callBrowserPanoptic(method: string, request: PanopticCallRequest): Promise<PanopticCallResponse>;
6
+ export { callBrowserPanoptic };
@@ -0,0 +1,72 @@
1
+ import type { JsonValue } from './panopticHostEnvelope';
2
+ import type { JsonRecord } from './panopticJsonArgs';
3
+ declare function collateralAddressesValue(value: JsonValue, label: string): {
4
+ collateralToken0: string;
5
+ collateralToken1: string;
6
+ };
7
+ declare function poolInfoArrayArg(args: JsonRecord, fieldName: string): {
8
+ pool: string;
9
+ token0: string;
10
+ token1: string;
11
+ maxPriceDeviation: number;
12
+ }[];
13
+ declare function poolMetadataValue(value: JsonValue, label: string): {
14
+ poolKeyBytes: string;
15
+ poolId: bigint;
16
+ collateralToken0Address: string;
17
+ collateralToken1Address: string;
18
+ riskEngineAddress: string;
19
+ token0Asset: string;
20
+ token1Asset: string;
21
+ token0Symbol: string;
22
+ token1Symbol: string;
23
+ token0Decimals: bigint;
24
+ token1Decimals: bigint;
25
+ token0Name: string;
26
+ token1Name: string;
27
+ underlyingPoolId: string;
28
+ isV4: boolean;
29
+ tickSpacing: bigint;
30
+ fee: bigint;
31
+ sfpmAddress: string;
32
+ };
33
+ declare function tokenIdLegArrayArg(args: JsonRecord, fieldName: string): {
34
+ index: bigint;
35
+ asset: bigint;
36
+ optionRatio: bigint;
37
+ isLong: boolean;
38
+ tokenType: bigint;
39
+ riskPartner: bigint;
40
+ strike: bigint;
41
+ width: bigint;
42
+ tickLower: bigint;
43
+ tickUpper: bigint;
44
+ }[];
45
+ declare function storedPositionArrayArg(args: JsonRecord, fieldName: string): {
46
+ tokenId: bigint;
47
+ legs: {
48
+ index: bigint;
49
+ asset: bigint;
50
+ optionRatio: bigint;
51
+ isLong: boolean;
52
+ tokenType: bigint;
53
+ riskPartner: bigint;
54
+ strike: bigint;
55
+ width: bigint;
56
+ tickLower: bigint;
57
+ tickUpper: bigint;
58
+ }[];
59
+ tickAtMint: bigint;
60
+ positionSize: bigint;
61
+ }[];
62
+ declare function vaultCandidatesByPoolArrayArg(args: JsonRecord, fieldName: string): {
63
+ poolAddress: string;
64
+ candidates: bigint[];
65
+ }[];
66
+ declare function uniswapAddressesValue(value: JsonValue, label: string): {
67
+ universalRouter: string;
68
+ v4Quoter: string;
69
+ poolManager: string;
70
+ permit2: string;
71
+ };
72
+ export { collateralAddressesValue, poolInfoArrayArg, poolMetadataValue, storedPositionArrayArg, tokenIdLegArrayArg, uniswapAddressesValue, vaultCandidatesByPoolArrayArg, };
@@ -0,0 +1,2 @@
1
+ export { assertPanopticSuccessResponse, parsePanopticRequest } from './panoptic/protocol';
2
+ export type { JsonValue, PanopticCallRequest, PanopticCallResponse } from './panoptic/protocol';
@@ -0,0 +1,17 @@
1
+ import type { AsyncHostCallSlot } from './asyncHostCalls';
2
+ import { type PanopticCallRequest, type PanopticCallResponse } from './panopticHostEnvelope';
3
+ type PanopticRuntimeAdapter = {
4
+ callPanoptic?: (method: string, request: PanopticCallRequest) => Promise<PanopticCallResponse>;
5
+ };
6
+ type PanopticHostImportOptions = {
7
+ runtime: PanopticRuntimeAdapter;
8
+ hostCalls: AsyncHostCallSlot;
9
+ getAsyncifyState: () => number;
10
+ rewindingState: number;
11
+ stopRewind: () => void;
12
+ startUnwind: () => void;
13
+ liftString: (ptr: number) => string | null;
14
+ lowerString: (value: string, owner: 'host' | 'wasm') => number;
15
+ };
16
+ declare function createPanopticHostImport(options: PanopticHostImportOptions): (methodPtr: number, paramsJsonPtr: number) => number | void;
17
+ export { createPanopticHostImport };
@@ -0,0 +1,26 @@
1
+ import type { JsonValue } from './panopticHostEnvelope';
2
+ type JsonRecord = {
3
+ [key: string]: JsonValue;
4
+ };
5
+ declare function decimalValue(value: JsonValue | undefined, label: string): bigint;
6
+ declare function signedDecimalValue(value: JsonValue | undefined, label: string): bigint;
7
+ declare function stringValue(value: JsonValue | undefined, label: string): string;
8
+ declare function booleanValue(value: JsonValue | undefined, label: string): boolean;
9
+ declare function numberValue(value: JsonValue | undefined, label: string): number;
10
+ declare function decimalArg(args: JsonRecord, fieldName: string): bigint;
11
+ declare function signedDecimalArg(args: JsonRecord, fieldName: string): bigint;
12
+ declare function optionalDecimalArg(args: JsonRecord, fieldName: string): bigint | undefined;
13
+ declare function optionalSignedDecimalArg(args: JsonRecord, fieldName: string): bigint | undefined;
14
+ declare function optionalBooleanArg(args: JsonRecord, fieldName: string): boolean | undefined;
15
+ declare function optionalStringArg(args: JsonRecord, fieldName: string): string | undefined;
16
+ declare function decimalArrayArg(args: JsonRecord, fieldName: string): bigint[];
17
+ declare function optionalDecimalArrayArg(args: JsonRecord, fieldName: string): bigint[] | undefined;
18
+ declare function signedDecimalArrayArg(args: JsonRecord, fieldName: string): bigint[];
19
+ declare function decimalMatrixArg(args: JsonRecord, fieldName: string): bigint[][];
20
+ declare function optionalStringArrayArg(args: JsonRecord, fieldName: string): string[] | undefined;
21
+ declare function decimalArrayValue(value: JsonValue | undefined, label: string): bigint[];
22
+ declare function arrayValue(value: JsonValue | undefined, label: string): JsonValue[];
23
+ declare function recordValue(value: JsonValue | undefined, label: string): JsonRecord;
24
+ declare function isRecord(value: unknown): value is Record<string, unknown>;
25
+ export { arrayValue, booleanValue, decimalArg, decimalArrayArg, decimalArrayValue, decimalMatrixArg, decimalValue, isRecord, numberValue, optionalBooleanArg, optionalDecimalArg, optionalDecimalArrayArg, optionalSignedDecimalArg, optionalStringArg, optionalStringArrayArg, recordValue, signedDecimalArg, signedDecimalArrayArg, signedDecimalValue, stringValue, };
26
+ export type { JsonRecord };
@@ -0,0 +1,12 @@
1
+ import type { PanopticRuntimeOptions } from '../panoptic';
2
+ import type { PanopticCallRequest, PanopticCallResponse } from './panopticHostEnvelope';
3
+ import { PANOPTIC_MODULE_SPECIFIERS, __resetPanopticRuntimeForTests, __setPanopticRuntimeImportForTests, loadPanopticModule, type RuntimeImport } from './panoptic/deps';
4
+ declare const PANOPTIC_RUNTIME_METHOD_NAMES: readonly string[];
5
+ /**
6
+ * Node/root Panoptic adapter skeleton. Source/client context is prepared before
7
+ * method implementations land in later phases.
8
+ */
9
+ declare function callNodePanoptic(method: string, request: PanopticCallRequest, options?: PanopticRuntimeOptions): Promise<PanopticCallResponse>;
10
+ declare function createNodePanopticAdapter(options?: PanopticRuntimeOptions): (method: string, request: PanopticCallRequest) => Promise<PanopticCallResponse>;
11
+ export { PANOPTIC_MODULE_SPECIFIERS, PANOPTIC_RUNTIME_METHOD_NAMES, callNodePanoptic, createNodePanopticAdapter, loadPanopticModule, __resetPanopticRuntimeForTests, __setPanopticRuntimeImportForTests, };
12
+ export type { PanopticRuntimeOptions, RuntimeImport };
@@ -0,0 +1,10 @@
1
+ import type { JsonRecord } from './panopticJsonArgs';
2
+ declare function uint48Arg(args: JsonRecord, fieldName: string): bigint;
3
+ declare function uint128Arg(args: JsonRecord, fieldName: string): bigint;
4
+ declare function uint160Arg(args: JsonRecord, fieldName: string): bigint;
5
+ declare function uint256Arg(args: JsonRecord, fieldName: string): bigint;
6
+ declare function optionalUint256Arg(args: JsonRecord, fieldName: string): bigint | undefined;
7
+ declare function uint256ArrayArg(args: JsonRecord, fieldName: string): bigint[];
8
+ declare function int24Arg(args: JsonRecord, fieldName: string): bigint;
9
+ declare function optionalInt24Arg(args: JsonRecord, fieldName: string): bigint | undefined;
10
+ export { int24Arg, optionalInt24Arg, optionalUint256Arg, uint48Arg, uint128Arg, uint160Arg, uint256Arg, uint256ArrayArg, };
@@ -0,0 +1,19 @@
1
+ import type { JsonValue } from './panopticHostEnvelope';
2
+ type PanopticJsonResourceLimits = {
3
+ maxArrayItems?: number;
4
+ maxObjectKeys?: number;
5
+ maxDepth?: number;
6
+ maxRequestBytes?: number;
7
+ maxResponseBytes?: number;
8
+ maxCalldataBytes?: number;
9
+ maxStringBytes?: number;
10
+ maxDecimalDigits?: number;
11
+ };
12
+ declare function normalizePanopticAddress(value: unknown, fieldName?: string): string;
13
+ declare function normalizePanopticHex(value: unknown, fieldName?: string, maxBytes?: number): string;
14
+ declare function normalizePanopticDecimalString(value: unknown, fieldName?: string, maxDigits?: number): string;
15
+ declare function normalizePanopticSignedDecimalString(value: unknown, fieldName?: string, maxDigits?: number): string;
16
+ declare function projectPanopticSerializableValue(value: unknown, limits?: PanopticJsonResourceLimits, label?: string): JsonValue;
17
+ declare function projectPanopticSerializableRequest(value: unknown, limits?: PanopticJsonResourceLimits, label?: string): JsonValue;
18
+ declare function utf8ByteLength(value: string): number;
19
+ export { normalizePanopticAddress, normalizePanopticDecimalString, normalizePanopticHex, normalizePanopticSignedDecimalString, projectPanopticSerializableRequest, projectPanopticSerializableValue, utf8ByteLength, };
@@ -0,0 +1,22 @@
1
+ import type { PanopticAuditEvent, PanopticClientCacheOptions, PanopticOperationOptions, PanopticRpcSource, PanopticSourceRegistry, PanopticSubgraphSource, SourceMeta } from '../panoptic';
2
+ import type { PanopticCallRequest } from './panopticHostEnvelope';
3
+ type ResolvedPanopticSource = {
4
+ source: PanopticRpcSource;
5
+ chainId: string;
6
+ rpcUrl: string;
7
+ normalizedRpcUrl: string;
8
+ overrideApplied: boolean;
9
+ };
10
+ type PanopticResolvedCallContext = {
11
+ source: ResolvedPanopticSource;
12
+ client: unknown;
13
+ blockNumber: string;
14
+ sourceMeta: SourceMeta;
15
+ };
16
+ declare function resolvePanopticSource(context: PanopticCallRequest['context'] | undefined, registry: PanopticSourceRegistry | undefined): ResolvedPanopticSource;
17
+ declare function preparePanopticSourceContext(request: PanopticCallRequest, viemModule: unknown, registry: PanopticSourceRegistry | undefined, operationOptions?: PanopticOperationOptions, cacheOptions?: PanopticClientCacheOptions): Promise<PanopticResolvedCallContext>;
18
+ declare function getPanopticPublicClient(viemModule: unknown, source: ResolvedPanopticSource, options?: PanopticClientCacheOptions): unknown;
19
+ declare function runPanopticOperation<T>(label: string, operation: () => Promise<T>, options?: PanopticOperationOptions): Promise<T>;
20
+ declare function __resetPanopticSourceStateForTests(): void;
21
+ export { getPanopticPublicClient, preparePanopticSourceContext, resolvePanopticSource, runPanopticOperation, __resetPanopticSourceStateForTests, };
22
+ export type { PanopticAuditEvent, PanopticClientCacheOptions, PanopticOperationOptions, PanopticResolvedCallContext, PanopticRpcSource, PanopticSourceRegistry, PanopticSubgraphSource, SourceMeta, };
@@ -0,0 +1,5 @@
1
+ import type { PanopticRuntimeOptions } from './panoptic';
2
+ type LoadWasmOptions = {
3
+ panoptic?: PanopticRuntimeOptions;
4
+ };
5
+ export type { LoadWasmOptions };