import { type PublicClient } from "viem"; import { BASE_CHAIN_ID } from "./chains.js"; import type { EvmAddress, HexBytes, HexBytes32 } from "./evm.js"; import { type ArbitratorDisputeStatus, type GeneralizedTcrTotalCosts, type TcrItemStatus, type TcrRequestPhase } from "./protocol-governance.js"; import { type BigintLike } from "./protocol-plans.js"; export type ProtocolParticipantReadClient = Pick; export type ProtocolPreflightBase = { network: "base"; chainId: typeof BASE_CHAIN_ID; }; export declare const PROTOCOL_TCR_FLAVORS: readonly ["budget", "allocation-mechanism", "round-submission"]; export type ProtocolTcrFlavor = (typeof PROTOCOL_TCR_FLAVORS)[number]; export declare const PROTOCOL_ARBITRATOR_ROUND_STATES: { readonly pending: 0; readonly active: 1; readonly reveal: 2; readonly solved: 3; }; export type ProtocolArbitratorRoundState = (typeof PROTOCOL_ARBITRATOR_ROUND_STATES)[keyof typeof PROTOCOL_ARBITRATOR_ROUND_STATES]; export declare const GOAL_STATE_LABELS: readonly ["funding", "active", "succeeded", "expired"]; export type GoalStateLabel = (typeof GOAL_STATE_LABELS)[number]; export declare const BUDGET_STATE_LABELS: readonly ["funding", "active", "succeeded", "failed", "expired"]; export type BudgetStateLabel = (typeof BUDGET_STATE_LABELS)[number]; export declare const PROTOCOL_ALLOCATION_STRATEGY_KINDS: readonly ["common", "budget-flow-router"]; export type ProtocolAllocationStrategyKind = (typeof PROTOCOL_ALLOCATION_STRATEGY_KINDS)[number]; export type ProtocolTokenAllowanceHint = { tokenAddress: EvmAddress; spenderAddress: EvmAddress; ownerAddress: EvmAddress | null; requiredAmount: bigint | null; balance: bigint | null; allowance: bigint | null; requiresApproval: boolean | null; insufficientBalance: boolean | null; allowanceShortfall: bigint | null; balanceShortfall: bigint | null; }; export type TcrSubmissionPreflight = ProtocolPreflightBase & { family: "tcr-submission"; flavor: ProtocolTcrFlavor; registryAddress: EvmAddress; depositTokenAddress: EvmAddress; totalCosts: GeneralizedTcrTotalCosts; addItem: { requiredAmount: bigint; approval: ProtocolTokenAllowanceHint | null; }; roundSubmissionContext: { startAt: bigint; endAt: bigint; prizeVaultAddress: EvmAddress; currentTimestamp: bigint; roundOpen: boolean; } | null; }; export type TcrRequestRoundPreflight = { roundIndex: bigint; amountPaid: readonly [bigint, bigint, bigint]; hasPaid: readonly [boolean, boolean, boolean]; feeRewards: bigint; actorContributions: readonly [bigint, bigint, bigint] | null; }; export type TcrRequestPreflight = ProtocolPreflightBase & { family: "tcr-request"; flavor: ProtocolTcrFlavor; registryAddress: EvmAddress; itemId: HexBytes32; itemStatus: TcrItemStatus; itemStatusLabel: string | null; itemData: HexBytes; numberOfRequests: bigint; depositTokenAddress: EvmAddress; submissionDeposit: bigint; totalCosts: GeneralizedTcrTotalCosts; removeItem: { canRemove: boolean; requiredAmount: bigint; approval: ProtocolTokenAllowanceHint | null; }; request: { requestIndex: bigint; requestType: TcrItemStatus; requestTypeLabel: string | null; phase: TcrRequestPhase; phaseLabel: string | null; arbitratorStatus: ArbitratorDisputeStatus; arbitratorStatusLabel: string | null; canChallenge: boolean; canExecuteRequest: boolean; canExecuteTimeout: boolean; canSubmitEvidence: boolean; canWithdrawFeesAndRewards: boolean | null; challengeDeadline: bigint; timeoutAt: bigint; disputed: boolean; resolved: boolean; submissionTime: bigint; disputeId: bigint; requesterAddress: EvmAddress | null; challengerAddress: EvmAddress | null; ruling: number; rulingLabel: string | null; arbitratorAddress: EvmAddress; arbitratorExtraData: HexBytes; metaEvidenceId: bigint; challengePeriodDuration: bigint; disputeTimeout: bigint; arbitrationCost: bigint; challengeBaseDeposit: bigint; challengeRequiredAmount: bigint; challengeApproval: ProtocolTokenAllowanceHint | null; currentRound: TcrRequestRoundPreflight | null; } | null; allocationMechanismContext: { activationQueued: boolean; removalQueued: boolean; } | null; roundSubmissionContext: { startAt: bigint; endAt: bigint; prizeVaultAddress: EvmAddress; } | null; }; export type ArbitratorVotePreflight = ProtocolPreflightBase & { family: "arbitrator"; arbitratorAddress: EvmAddress; disputeId: bigint; disputeStatus: ArbitratorDisputeStatus; disputeStatusLabel: string | null; currentRound: bigint; currentRoundState: ProtocolArbitratorRoundState; currentRoundStateLabel: string | null; currentRuling: number; currentRulingLabel: string | null; executed: boolean; votingTokenAddress: EvmAddress; stakeVaultAddress: EvmAddress; invalidRoundRewardsSinkAddress: EvmAddress; roundInfo: { votingStartTime: bigint; votingEndTime: bigint; revealPeriodStartTime: bigint; revealPeriodEndTime: bigint; creationBlock: bigint; cost: bigint; totalVotes: bigint; requesterVotes: bigint; challengerVotes: bigint; ruling: number; rulingLabel: string | null; }; canExecuteRuling: boolean; voter: { accountAddress: EvmAddress; votingPower: bigint; canVoteInRound: boolean; hasCommitted: boolean; hasRevealed: boolean; commitHash: HexBytes32; choice: bigint; votes: bigint; rewardsClaimed: boolean; slashedOrProcessed: boolean; claimableReward: bigint; claimableGoalSlashReward: bigint; claimableCobuildSlashReward: bigint; canCommit: boolean; canReveal: boolean; canWithdrawReward: boolean; canWithdrawSlashRewards: boolean; } | null; }; export type StakeVaultParticipantPreflight = ProtocolPreflightBase & { family: "stake-vault"; stakeVaultAddress: EvmAddress; goalTreasuryAddress: EvmAddress; budgetStakeLedgerAddress: EvmAddress; goalTokenAddress: EvmAddress; cobuildTokenAddress: EvmAddress; accountAddress: EvmAddress; goalResolved: boolean; goalResolvedAt: bigint; jurorExitDelay: bigint; position: { stakedGoal: bigint; stakedCobuild: bigint; totalWeight: bigint; jurorWeight: bigint; jurorLockedGoal: bigint; delegateAddress: EvmAddress | null; }; underwriterWithdrawal: { registeredBudgetCount: bigint; prepareCursor: bigint; preparedBudgetCount: bigint; preparedForResolvedAt: bigint; preparedComplete: boolean; withdrawalBlocked: boolean; blockedReason: string | null; }; goalDeposit: { amount: bigint | null; approval: ProtocolTokenAllowanceHint | null; quotedWeightOut: bigint | null; snapshotGoalWeight: bigint | null; weightScale: bigint | null; canDeposit: boolean; }; cobuildDeposit: { amount: bigint | null; approval: ProtocolTokenAllowanceHint | null; canDeposit: boolean; }; goalWithdrawal: { amount: bigint | null; withdrawableAmount: bigint; canWithdraw: boolean; blockedReason: string | null; }; cobuildWithdrawal: { amount: bigint | null; withdrawableAmount: bigint; canWithdraw: boolean; blockedReason: string | null; }; juror: { lockAmount: bigint | null; exitAmount: bigint | null; canOptIn: boolean; canRequestExit: boolean; canFinalizeExit: boolean; delegateAddress: EvmAddress | null; delegateUpdateRequired: boolean | null; operatorAuthorized: boolean | null; exitRequest: { goalAmount: bigint; requestedAt: bigint; availableAt: bigint; ready: boolean; } | null; }; }; export type PremiumEscrowPreflight = ProtocolPreflightBase & { family: "premium-escrow"; premiumEscrowAddress: EvmAddress; accountAddress: EvmAddress; budgetTreasuryAddress: EvmAddress; goalFlowAddress: EvmAddress; premiumTokenAddress: EvmAddress; claimable: bigint; userCoverage: bigint; totalCoverage: bigint; exposureIntegral: bigint; premiumIndex: bigint; creditIndex: bigint; closed: boolean; finalState: number; finalStateLabel: BudgetStateLabel | null; isSlashable: boolean; canCheckpoint: boolean; canClaim: boolean; }; export type RoundPrizeVaultPreflight = ProtocolPreflightBase & { family: "round-prize-vault"; roundPrizeVaultAddress: EvmAddress; submissionId: HexBytes32; accountAddress: EvmAddress | null; payoutRecipientAddress: EvmAddress | null; submissionsTcrAddress: EvmAddress; operatorAddress: EvmAddress; superTokenAddress: EvmAddress; underlyingTokenAddress: EvmAddress; entitlement: bigint; claimed: bigint; claimable: bigint; canClaim: boolean; }; export type GoalDonationPreflight = ProtocolPreflightBase & { family: "goal-donation"; goalTreasuryAddress: EvmAddress; accountAddress: EvmAddress | null; state: number; stateLabel: GoalStateLabel | null; lifecycleStatus: { isResolved: boolean; canAcceptHookFunding: boolean; isMintingOpen: boolean; isMinRaiseReached: boolean; isMinRaiseWindowElapsed: boolean; isDeadlinePassed: boolean; hasPendingSuccessAssertion: boolean; treasuryBalance: bigint; minRaise: bigint; minRaiseDeadline: bigint; deadline: bigint; timeRemaining: bigint; targetFlowRate: bigint; }; superTokenAddress: EvmAddress; underlyingTokenAddress: EvmAddress; amount: bigint | null; approval: ProtocolTokenAllowanceHint | null; canDonate: boolean; blockedReason: string | null; }; export type BudgetDonationPreflight = ProtocolPreflightBase & { family: "budget-donation"; budgetTreasuryAddress: EvmAddress; accountAddress: EvmAddress | null; state: number; stateLabel: BudgetStateLabel | null; lifecycleStatus: { isResolved: boolean; canAcceptFunding: boolean; isSuccessResolutionDisabled: boolean; isFundingWindowEnded: boolean; hasDeadline: boolean; isDeadlinePassed: boolean; hasPendingSuccessAssertion: boolean; treasuryBalance: bigint; activationThreshold: bigint; runwayCap: bigint; fundingDeadline: bigint; executionDuration: bigint; deadline: bigint; activatedAt: bigint; timeRemaining: bigint; targetFlowRate: bigint; }; superTokenAddress: EvmAddress; underlyingTokenAddress: EvmAddress; amount: bigint | null; approval: ProtocolTokenAllowanceHint | null; canDonate: boolean; blockedReason: string | null; }; export type FlowAllocationInput = { recipientId: string; allocationPpm: BigintLike; }; export type FlowAllocation = { recipientId: HexBytes32; allocationPpm: number; }; export type FlowChildSyncDebt = { budgetTreasuryAddress: EvmAddress; exists: boolean; childFlowAddress: EvmAddress | null; childStrategyAddress: EvmAddress | null; allocationKey: bigint; reason: HexBytes32; budgetInfo: { isTracked: boolean; removedAt: bigint; activatedAt: bigint; resolvedOrRemovedAt: bigint; } | null; budgetCheckpoint: { totalAllocatedStake: bigint; lastCheckpoint: bigint; } | null; userAllocatedStake: bigint | null; }; export type FlowChildSyncRequirement = { budgetTreasuryAddress: EvmAddress; childFlowAddress: EvmAddress; childStrategyAddress: EvmAddress; allocationKey: bigint; expectedCommit: HexBytes32; }; export type FlowAllocationPreflight = ProtocolPreflightBase & { family: "flow-allocation"; flowAddress: EvmAddress; pipelineAddress: EvmAddress; strategyAddress: EvmAddress; strategyKind: ProtocolAllocationStrategyKind; accountAddress: EvmAddress; allocationKey: bigint; existingCommitment: HexBytes32; hasExistingCommitment: boolean; childFlowAddresses: readonly EvmAddress[]; claimableBalance: bigint; canAccountAllocate: boolean; canAllocate: boolean; accountAllocationWeight: bigint; currentWeight: bigint; routerContext: { budgetStakeLedgerAddress: EvmAddress; canAccountAllocateForFlow: boolean; accountAllocationWeightForFlow: bigint; currentWeightForFlow: bigint; recipientId: HexBytes32; recipientRegistered: boolean; } | null; childSyncDebtCount: bigint; childSyncDebts: readonly FlowChildSyncDebt[]; preview: { previousWeight: bigint; previousAllocations: readonly FlowAllocation[]; nextAllocations: readonly FlowAllocation[]; childSyncRequirements: readonly FlowChildSyncRequirement[]; } | null; }; export declare function readTcrSubmissionPreflight(params: { client: ProtocolParticipantReadClient; registryAddress: string; flavor?: ProtocolTcrFlavor | string; actorAddress?: string | null; }): Promise; export declare function readTcrRequestPreflight(params: { client: ProtocolParticipantReadClient; registryAddress: string; itemId: string; flavor?: ProtocolTcrFlavor | string; actorAddress?: string | null; }): Promise; export declare function readArbitratorVotePreflight(params: { client: ProtocolParticipantReadClient; arbitratorAddress: string; disputeId: BigintLike; voterAddress?: string | null; }): Promise; export declare function readStakeVaultParticipantPreflight(params: { client: ProtocolParticipantReadClient; stakeVaultAddress: string; accountAddress: string; goalDepositAmount?: BigintLike | null; cobuildDepositAmount?: BigintLike | null; goalWithdrawalAmount?: BigintLike | null; cobuildWithdrawalAmount?: BigintLike | null; jurorLockAmount?: BigintLike | null; jurorExitAmount?: BigintLike | null; delegateAddress?: string | null; operatorAddress?: string | null; }): Promise; export declare function readPremiumEscrowPreflight(params: { client: ProtocolParticipantReadClient; premiumEscrowAddress: string; accountAddress: string; }): Promise; export declare function readRoundPrizeVaultPreflight(params: { client: ProtocolParticipantReadClient; roundPrizeVaultAddress: string; submissionId: string; accountAddress?: string | null; }): Promise; export declare function readGoalDonationPreflight(params: { client: ProtocolParticipantReadClient; goalTreasuryAddress: string; accountAddress?: string | null; amount?: BigintLike | null; }): Promise; export declare function readBudgetDonationPreflight(params: { client: ProtocolParticipantReadClient; budgetTreasuryAddress: string; accountAddress?: string | null; amount?: BigintLike | null; }): Promise; export declare function readFlowAllocationPreflight(params: { client: ProtocolParticipantReadClient; flowAddress: string; strategyAddress: string; accountAddress: string; strategyKind?: ProtocolAllocationStrategyKind | string; strategyContextBytes?: string; previousWeight?: BigintLike | null; previousAllocations?: readonly FlowAllocationInput[]; nextAllocations?: readonly FlowAllocationInput[]; budgetTreasuryAddresses?: readonly string[]; }): Promise; export declare function serializeProtocolParticipantPreflight(value: unknown): unknown;