export { S as SYSTEM_DEFAULTS, W as WORLD_DEFAULTS } from './defaults-8b2664e0.js';
import { StoreConfig } from '@latticexyz/store/internal';
import { W as WorldConfig, S as SystemConfig } from './types-fd545966.js';
export { E as ExpandSystemConfig, c as ExpandSystemsConfig, M as ModuleConfig, a as SystemUserConfig, b as SystemsUserConfig, d as WorldUserConfig, e as zPluginWorldConfig, z as zWorldConfig } from './types-fd545966.js';
import { Abi, ContractFunctionName, EncodeFunctionDataParameters, Hex, Address, Chain, Account, Client, Transport, WalletActions, PublicClient } from 'viem';
import { AbiParametersToPrimitiveTypes, ExtractAbiFunction } from 'abitype';
import 'zod';
import '@latticexyz/config/library';
import '@latticexyz/common/type-utils';

type ResolvedSystemConfig = ReturnType<typeof resolveSystemConfig>;
type ResolvedWorldConfig = ReturnType<typeof resolveWorldConfig>;
/**
 * Resolves the world config by combining the default and overridden system configs,
 * filtering out excluded systems, validate system names refer to existing contracts, and
 * splitting the access list into addresses and system names.
 */
declare function resolveWorldConfig(config: StoreConfig & WorldConfig, existingContracts?: string[]): {
    systems: Record<string, {
        name: string;
        registerFunctionSelectors: boolean;
        openAccess: boolean;
        accessListAddresses: string[];
        accessListSystems: string[];
    }>;
};
/**
 * Resolves the system config by combining the default and overridden system configs,
 * @param systemName name of the system
 * @param config optional SystemConfig object, if none is provided the default config is used
 * @param existingContracts optional list of existing contract names, used to validate system names in the access list. If not provided, no validation is performed.
 * @returns ResolvedSystemConfig object
 * Default value for name is `systemName`
 * Default value for registerFunctionSelectors is true
 * Default value for openAccess is true
 * Default value for accessListAddresses is []
 * Default value for accessListSystems is []
 */
declare function resolveSystemConfig(systemName: string, config?: SystemConfig, existingContracts?: string[]): {
    name: string;
    registerFunctionSelectors: boolean;
    openAccess: boolean;
    accessListAddresses: string[];
    accessListSystems: string[];
};

declare const abi: [
  {
    "type": "function",
    "name": "call",
    "inputs": [
      {
        "name": "systemId",
        "type": "bytes32",
        "internalType": "ResourceId"
      },
      {
        "name": "callData",
        "type": "bytes",
        "internalType": "bytes"
      }
    ],
    "outputs": [
      {
        "name": "",
        "type": "bytes",
        "internalType": "bytes"
      }
    ],
    "stateMutability": "payable"
  },
  {
    "type": "function",
    "name": "callFrom",
    "inputs": [
      {
        "name": "delegator",
        "type": "address",
        "internalType": "address"
      },
      {
        "name": "systemId",
        "type": "bytes32",
        "internalType": "ResourceId"
      },
      {
        "name": "callData",
        "type": "bytes",
        "internalType": "bytes"
      }
    ],
    "outputs": [
      {
        "name": "",
        "type": "bytes",
        "internalType": "bytes"
      }
    ],
    "stateMutability": "payable"
  }
];

type SystemCall<abi extends Abi, functionName extends ContractFunctionName<abi>> = EncodeFunctionDataParameters<abi, functionName> & {
    readonly systemId: Hex;
};
/** Encode a system call to be passed as arguments into `World.call` */
declare function encodeSystemCall<abi extends Abi, functionName extends ContractFunctionName<abi>>({ abi, systemId, functionName, args, }: SystemCall<abi, functionName>): AbiParametersToPrimitiveTypes<ExtractAbiFunction<typeof abi, "call">["inputs"]>;

type SystemCallFrom<abi extends Abi, functionName extends ContractFunctionName<abi>> = SystemCall<abi, functionName> & {
    readonly from: Address;
};
/** Encode a system call to be passed as arguments into `World.callFrom` */
declare function encodeSystemCallFrom<abi extends Abi, functionName extends ContractFunctionName<abi>>({ abi, from, systemId, functionName, args, }: SystemCallFrom<abi, functionName>): AbiParametersToPrimitiveTypes<ExtractAbiFunction<typeof abi, "callFrom">["inputs"]>;

/** Encode system calls to be passed as arguments into `World.batchCall` */
declare function encodeSystemCalls<abi extends Abi, functionName extends ContractFunctionName<abi>>(abi: abi, systemCalls: readonly Omit<SystemCall<abi, functionName>, "abi">[]): AbiParametersToPrimitiveTypes<ExtractAbiFunction<typeof abi, "call">["inputs"]>[];

/** Encode system calls to be passed as arguments into `World.batchCallFrom` */
declare function encodeSystemCallsFrom<abi extends Abi, functionName extends ContractFunctionName<abi>>(abi: abi, from: Address, systemCalls: readonly Omit<SystemCallFrom<abi, functionName>, "abi" | "from">[]): AbiParametersToPrimitiveTypes<ExtractAbiFunction<typeof abi, "callFrom">["inputs"]>[];

type CallFromParameters = CallFromFunctionParameters | CallFromClientParameters;
type CallFromBaseParameters = {
    worldAddress: Hex;
    delegatorAddress: Hex;
};
type CallFromFunctionParameters = CallFromBaseParameters & {
    worldFunctionToSystemFunction: (worldFunctionSelector: Hex) => Promise<SystemFunction>;
    publicClient?: never;
};
type CallFromClientParameters = CallFromBaseParameters & {
    worldFunctionToSystemFunction?: never;
    publicClient: PublicClient;
};
type SystemFunction = {
    systemId: Hex;
    systemFunctionSelector: Hex;
};
declare function callFrom<TChain extends Chain, TAccount extends Account>(params: CallFromParameters): (client: Client<Transport, TChain, TAccount>) => Pick<WalletActions<TChain, TAccount>, "writeContract">;

declare const callWithSignatureTypes: {
    readonly Call: readonly [{
        readonly name: "signer";
        readonly type: "address";
    }, {
        readonly name: "systemNamespace";
        readonly type: "string";
    }, {
        readonly name: "systemName";
        readonly type: "string";
    }, {
        readonly name: "callData";
        readonly type: "bytes";
    }, {
        readonly name: "nonce";
        readonly type: "uint256";
    }];
};

export { ResolvedSystemConfig, ResolvedWorldConfig, SystemCall, SystemCallFrom, SystemConfig, WorldConfig, callFrom, callWithSignatureTypes, encodeSystemCall, encodeSystemCallFrom, encodeSystemCalls, encodeSystemCallsFrom, resolveSystemConfig, resolveWorldConfig };
