@glowlabs-org/utils 0.2.166 → 0.2.167

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.
@@ -1 +1 @@
1
- {"version":3,"file":"calculate-farm-efficiency-DabpqtXj.js","sources":["../../src/constants/urls.ts","../../src/constants/weights.ts","../../src/lib/types/index.ts","../../src/lib/abis/forwarderABI.ts","../../src/lib/abis/erc20.abi.ts","../../src/constants/addresses.ts","../../src/utils/transaction-utils.ts","../../src/utils/sentry.ts","../../src/lib/hooks/use-forwarder.ts","../../src/lib/abis/offchainFractions.ts","../../src/lib/hooks/use-offchain-fractions.ts","../../src/lib/abis/rewardKernelABI.ts","../../src/lib/hooks/use-rewards-kernel.ts","../../src/lib/control-api/control-router.ts","../../src/utils/generate-slug.ts","../../src/lib/region-metadata.ts","../../src/lib/control-api/region-router.ts","../../src/lib/control-api/kickstarter-router.ts","../../src/lib/control-api/wallets-router.ts","../../src/lib/control-api/farms-router.ts","../../src/utils/calculate-farm-efficiency.ts"],"sourcesContent":["export const HUB_URL = \"https://glow.org\";\n\nexport const GCA_URLS = [\"http://95.217.194.59:35015\"];\n","/**\n * @dev This is actually not as intuitive as it seems.\n * Glow actually has 18 decimals, but glow weight is based on the amount of protocol fees (USDC) that the farm paid\n * Therefore, the weight is based on the amount of USDC that was paid, which has 8 decimals\n */\nexport const GLOW_WEIGHT_DECIMAL_PRECISION = 8;\n\n/**\n * @dev This is actually not as intuitive as it seems.\n * USDG weight is based on the amount of carbon credits produced, but the max value of a weight is ((2*64)-1) / 5 so we need to choose sensible precision to make sure that number never overflows\n */\nexport const USDG_WEIGHT_DECIMAL_PRECISION = 8;\n\nexport const MAX_WEIGHT: bigint =\n (BigInt(2) ** BigInt(64) - BigInt(1)) / BigInt(5);\n","// ---------------------------------------------------------------------------\n// Common / Shared Types\n// ---------------------------------------------------------------------------\n\nexport enum STAKING_DIRECTIONS {\n STAKE = \"stake\",\n UNSTAKE = \"unstake\",\n RESTAKE = \"restake\",\n IMMEDIATE_UNSTAKE = \"immediate_unstake\",\n}\n\nexport type StakingDirection =\n (typeof STAKING_DIRECTIONS)[keyof typeof STAKING_DIRECTIONS];\n\nexport enum REGIONS {\n CLEAN_GRID_PROJECT = 1,\n UTAH = 2,\n MISSOURI = 3,\n COLORADO = 4,\n}\n\nexport const PAYMENT_CURRENCIES = [\n \"GCTL\",\n \"USDC\",\n \"USDG\",\n \"GLW\",\n \"SGCTL\",\n] as const;\n\nexport const OFF_CHAIN_PAYMENT_CURRENCIES = [\"SGCTL\", \"GCTL\"] as const;\nexport type PaymentCurrency = (typeof PAYMENT_CURRENCIES)[number];\nexport type OffChainPaymentCurrency =\n (typeof OFF_CHAIN_PAYMENT_CURRENCIES)[number];\n\n// ----------------------------- Control-API ----------------------------------\nexport interface MintedEvent {\n txId: string;\n epoch: number;\n wallet: string;\n amountRaw: string;\n currency: string;\n gctlMinted: string;\n ts: string; // ISO date string\n}\n\nexport interface StakedEvent {\n id: string;\n epoch: number;\n wallet: string;\n regionId: number;\n regionName: string;\n amount: string;\n direction: \"stake\" | \"unstake\" | \"restake\";\n ts: string; // ISO date string\n}\n\nexport interface PendingTransfer {\n txId: string;\n wallet: string;\n amountRaw: string;\n type: string;\n currency: string;\n status: string;\n ts: string; // ISO date string\n applicationId?: string;\n farmId?: string;\n regionId?: number;\n kickstarterId?: string;\n}\n\nexport const TRANSFER_TYPES = {\n PayProtocolFeeAndMintGCTLAndStake: \"PayProtocolFeeAndMintGCTLAndStake\",\n PayProtocolFee: \"PayProtocolFee\",\n PayAuditFees: \"PayAuditFees\",\n CommitKickstarter: \"CommitKickstarter\",\n MintGCTLAndStake: \"MintGCTLAndStake\",\n MintGCTL: \"MintGCTL\",\n BuySolarFarm: \"BuySolarFarm\",\n SponsorProtocolFee: \"SponsorProtocolFee\",\n SponsorProtocolFeeAndMintGCTLAndStake:\n \"SponsorProtocolFeeAndMintGCTLAndStake\",\n PayProtocolDepositUsingStakedControl: \"PayProtocolDepositUsingStakedControl\",\n} as const;\n\n// Pending transfer type filter for listing endpoint\nexport type PendingTransferType =\n (typeof TRANSFER_TYPES)[keyof typeof TRANSFER_TYPES];\n\nexport interface TransferDetails extends PendingTransfer {\n blockNumber: string;\n failureInfo?: {\n failureType: string;\n errorMessage: string;\n errorDetails?: string;\n isRetryable: boolean;\n retryCount: number;\n lastRetryAt?: string; // ISO date string\n };\n}\n\nexport interface FailedOperation {\n id: string;\n txId: string;\n operation: string;\n failureType: string;\n errorMessage: string;\n errorDetails?: string;\n isRetryable: string;\n retryCount: number;\n lastRetryAt?: string; // ISO date string\n resolvedAt?: string; // ISO date string\n wallet?: string;\n amountRaw?: string;\n currency?: string;\n createdAt: string; // ISO date string\n updatedAt: string; // ISO date string\n}\n\nexport interface GctlPrice {\n currentPriceUsdc: string;\n}\n\n// Price response for GLW token (mirrors GctlPrice structure)\nexport interface GlwPrice {\n currentPriceUsdc: string;\n}\n\nexport interface WalletNonce {\n wallet: string;\n lastNonce: string;\n}\n\nexport interface GctlSupply {\n circulatingSupply: string;\n}\n\nexport interface StakeRequest {\n wallet: string;\n regionId: number;\n amount: string; // Amount in atomic units (10^6 = 1 GCTL)\n signature: string; // 0x-prefixed 65-byte hex signature\n deadline: string; // unix timestamp (as string)\n nonce: string; // stringified integer\n}\n\nexport interface RestakeRequest {\n wallet: string; // 0x-prefixed 40-char hex\n fromZoneId: number; // Source region ID\n toZoneId: number; // Destination region ID\n amount: string; // Amount in atomic units (10^6 = 1 GCTL)\n signature: string; // 0x-prefixed 65-byte hex signature\n deadline: string; // unix timestamp (as string)\n nonce: string; // stringified integer\n}\n\nexport interface RegionStake {\n regionId: number;\n currentGctlStake: string;\n}\n\nexport interface WalletRegionStake {\n wallet: string;\n regionId: number;\n currentGctlStake: string;\n}\n\nexport interface WalletRegionUnlocked {\n wallet: string;\n regionId: number;\n unlocked: string;\n}\n\nexport interface WalletRegionCommittedBalance {\n wallet: string;\n regionId: number;\n gctl_committed_balance: string;\n}\n\n// ----------------------------- Regions --------------------------------------\n// A superset of fields coming from both control-api regions and regions-service.\nexport interface Region {\n id: number;\n name: string;\n isUs: boolean;\n bannerUrl: string;\n description: string;\n slug: string;\n code: string;\n createdAt: Date;\n}\n\nexport interface RegionWithMetadata extends Region {\n isActive: boolean;\n staked: string;\n activationStakeThreshold: string;\n solarFarmCount: number;\n solarPanelsQuantity: number;\n activationSolarFarmThreshold: number;\n installerCount: number;\n activationInstallerThreshold: number;\n efficiencyScore: number; // Carbon credits per $100,000 deposit/week (aggregated)\n}\n\nexport interface ActivationConfig {\n duration: number; // number of days\n minimumAmountOfGCTL: number;\n minimumAmountOfFarms: number;\n minimumAmountOfInstallers: number;\n}\n\nexport interface CreateRegionPayload {\n code: string;\n name: string;\n isUs: boolean;\n}\n\n// ----------------------------- Region Metadata -----------------------------\nexport interface RegionMetadata {\n code: string;\n name: string;\n description: string;\n isUs: boolean;\n flag?: string;\n}\n\n// ----------------------------- Kickstarters ---------------------------------\nexport enum KICKSTARTER_STATUS {\n DRAFT = \"draft\",\n COLLECTING_SUPPORT = \"collecting-support\",\n COMPLETED = \"completed\",\n FAILED = \"failed\",\n CANCELLED = \"cancelled\",\n}\n\nexport type KickstarterStatus =\n (typeof KICKSTARTER_STATUS)[keyof typeof KICKSTARTER_STATUS];\nexport interface CreateKickstarterPayload {\n creatorWallet: string;\n regionName: string;\n title: string;\n description: string;\n code: string; // region code (e.g., \"US-FL\", \"US\", \"CA\")\n bannerUrl: string;\n}\n\nexport interface KickstarterCreateResponse {\n success: true;\n id: string;\n}\n\nexport interface Kickstarter {\n id: string;\n regionId: number | null;\n code: string;\n creatorWallet: string;\n title: string;\n description: string;\n slug: string;\n bannerUrl: string;\n status: KickstarterStatus | string;\n createdAt: string; // ISO 8601\n updatedAt: string; // ISO 8601\n publishedAt?: string; // ISO 8601\n completedAt?: string; // ISO 8601\n cancelledAt?: string; // ISO 8601\n expiredAt?: string; // ISO 8601\n deadline: string; // ISO 8601\n stakeTargetGctl: string; // atomic units (GCTL scaled by 10^6)\n requiredFarmCount: number;\n requiredInstallerCount: number;\n stakeContributed: boolean;\n farmProvided: boolean;\n installerCertified: boolean;\n kickoffTransferTxId?: string;\n kickoffMintTxId?: string;\n}\n\nexport interface KickstarterDetails extends Kickstarter {\n contributorsCount: number;\n farmCount: number;\n solarFarmApplications: SolarFarmApplication[];\n sponsoredFarms: SponsoredFarm[];\n}\n\nexport interface CommitKickstarterPayload {\n wallet: string; // 0x-prefixed 40-char hex\n amount: string; // atomic GCTL, must equal stakeTargetGctl/KICKSTARTER_STAKE_PERCENTAGE\n nonce: string; // uint256 as string\n deadline: string; // unix seconds as string\n signature: string; // 0x-prefixed 65-byte hex\n}\n\nexport interface CommitKickstarterResponse {\n success: true;\n regionId: number;\n}\n\nexport interface KickstarterCommitmentEvent {\n id: string;\n epoch: number;\n wallet: string;\n regionId: number;\n amount: string; // atomic GCTL (6 decimals)\n ts: string; // ISO 8601\n isFinalized: boolean;\n isRefunded: boolean;\n}\n\nexport interface KickstarterCommitmentsQuery {\n page?: number; // default 1\n limit?: number; // default 50, max 100\n finalized?: boolean; // optional filter on isFinalized\n}\n\nexport interface KickstarterCommitmentsResponse {\n page: number;\n limit: number;\n events: KickstarterCommitmentEvent[];\n}\n\nexport interface ActivationEvent {\n id: string;\n regionId: number;\n epoch: number;\n stakeThresholdMet: boolean;\n solarFarmRequirementMet: boolean;\n installerRequirementMet: boolean;\n activated: boolean;\n ts: string; // ISO 8601\n}\n\n// ----------------------------- Region VCR View ------------------------------\nexport interface FarmRewardSplit {\n walletAddress: string;\n glowSplitPercent6Decimals: string;\n depositSplitPercent6Decimals: string;\n}\n\nexport interface SponsoredFarm {\n farmId: string;\n regionId: number;\n name: string;\n location: string;\n certifiedInstallerId: string | null;\n kwhCapacity: string;\n solarPanelsQuantity: number;\n expectedWeeklyCarbonCredits: string;\n protocolDepositUSDC6Decimals: string;\n protocolDepositPaidAmount: string;\n protocolDepositPaidCurrency: string;\n\n builtEpoch: number;\n builtAt: string;\n afterInstallPictures: {\n id: string;\n name: string;\n url: string;\n isShowingSolarPanels: boolean;\n }[];\n rewardSplits: FarmRewardSplit[];\n}\n\nexport interface SolarFarmApplication {\n applicationId: string;\n farmId: string | null;\n farmOwnerWallet: string;\n regionId: number;\n gcaWallet: string;\n protocolDepositUSDC6Decimals: string;\n status: \"audit_fees_paid\" | \"completed\";\n createdAt: string;\n}\n\nexport interface RegionDetails extends RegionWithMetadata {\n sponsoredFarms: SponsoredFarm[];\n solarFarmApplications: SolarFarmApplication[];\n carbonCreditsIssued: number;\n carbonCreditsPerWeek: number;\n}\n\nexport interface ActiveRegionDataPoint {\n epoch: number;\n timestamp: number;\n gctlStaked: string;\n pendingUnstake: string;\n pendingRestakeOut: string;\n pendingRestakeIn: string;\n netPending: string;\n eventCount: number;\n firstEventTimestamp?: number;\n lastEventTimestamp?: number;\n}\n\nexport interface ActiveRegionSummary {\n id: number;\n name: string;\n code: string;\n slug: string;\n isUs: boolean;\n currentGctlStaked: string;\n glwRewardPerWeek: string;\n rewardShare: string;\n data: ActiveRegionDataPoint[];\n}\n\nexport interface ActiveRegionsSummaryResponse {\n metadata: {\n epochs: number[];\n epochTimestamps: { [epoch: string]: number };\n currentEpoch: number;\n };\n total: {\n totalGctlStaked: string;\n totalGlwRewards: string;\n };\n regions: ActiveRegionSummary[];\n aggregate: {\n epochs: number[];\n timestamps: number[];\n totalGctlStaked: string[];\n eventTypes: string[];\n regionIds: number[];\n };\n}\n\nexport interface RegionActivityPeriod {\n stakes: number;\n unstakes: number;\n restakes: number;\n immediateUnstakes: number;\n netChange: string; // atomic units (can be negative)\n}\n\nexport interface RegionActivity {\n regionId: number;\n regionName: string;\n last24h: RegionActivityPeriod;\n last7d: RegionActivityPeriod;\n}\n\nexport interface RecentRegionActivityResponse {\n activity: RegionActivity[];\n}\n\nexport interface InstallerApplicationPayload {\n wallet: string;\n signature: string;\n nonce: string;\n regionId: string;\n deadline: string;\n}\n\nexport interface InstallerApplicationResponse {\n certified: boolean;\n}\n\n// ----------------------------- API Responses --------------------------------\nexport interface RegionsResponse {\n regions: RegionWithMetadata[];\n}\n\nexport interface RegionResponse {\n region: RegionDetails;\n}\n\nexport interface ActivationEventsResponse {\n events: ActivationEvent[];\n}\n\nexport interface RegionSolarFarmsResponse {\n sponsoredFarms: SponsoredFarm[];\n}\n\nexport interface SponsoredFarmsResponse {\n farms: SponsoredFarm[];\n}\n\nexport interface FetchRegionsParams {\n isActive?: boolean;\n}\n\n// ----------------------------- Control-API Paginated -------------------------\nexport interface PaginatedParams {\n page?: number; // 1-indexed\n limit?: number; // max 100\n}\n\nexport interface MintedEventsResponse {\n page: number;\n limit: number;\n events: MintedEvent[];\n}\n\nexport interface StakeEventsQuery extends PaginatedParams {\n regionId?: number;\n}\n\nexport interface StakeEventsResponse {\n page: number;\n limit: number;\n events: StakedEvent[];\n}\n\nexport interface PendingTransfersQuery extends PaginatedParams {\n type?: PendingTransferType;\n}\n\nexport interface PendingTransfersResponse {\n page: number;\n limit: number;\n transfers: PendingTransfer[];\n}\n\nexport interface FailedOperationsResponse {\n page: number;\n limit: number;\n operations: FailedOperation[];\n}\n\n// ----------------------------- GLW Rewards -----------------------------------\nexport interface GlwRegionReward {\n regionId: number;\n gctlStaked: string;\n glwReward: string;\n rewardShare: string; // WAD (1e18 = 100%)\n}\n\nexport interface GlwRegionRewardsResponse {\n totalGctlStaked: string;\n totalGlwRewards: string;\n regionRewards: GlwRegionReward[];\n}\n\n// ----------------------------- Wallets --------------------------------------\nexport interface ControlWallet {\n address: string;\n controlBalance: string;\n committedControl: string;\n stakedControl: string;\n createdAt: string; // ISO 8601\n}\n\nexport interface WalletsResponse {\n wallets: ControlWallet[];\n}\n\nexport interface WalletRegionStakeTotal {\n regionId: number;\n totalStaked: string;\n pendingUnstake: string;\n pendingRestakeOut: string;\n region?: {\n id: number;\n name: string;\n code: string;\n slug: string;\n isUs: boolean;\n isActivated: boolean;\n bannerUrl: string;\n description: string;\n createdAt: string; // ISO 8601\n };\n}\n\nexport interface WalletFarmInfo {\n farmId: string;\n regionId: number;\n name: string;\n location: string;\n kwhCapacity: string;\n solarPanelsQuantity: number;\n expectedWeeklyCarbonCredits: string;\n protocolDepositPaidAmount: string;\n protocolDepositPaidCurrency: string;\n\n builtEpoch: number;\n builtAt?: string; // ISO 8601\n glowSplitPercent6Decimals: string; // Wallet's GLW reward split (6 decimals)\n depositSplitPercent6Decimals: string; // Wallet's deposit reward split (6 decimals)\n}\n\nexport interface WalletDetails {\n wallet: string;\n controlBalance: string;\n committedControl: string;\n stakedControl: string;\n createdAt: string; // ISO 8601\n regions: WalletRegionStakeTotal[];\n ownedFarms: WalletFarmInfo[];\n}\n\nexport interface WeeklyReward {\n weekNumber: number;\n paymentCurrency: PaymentCurrency;\n protocolDepositRewardsReceived: string; // Protocol deposit rewards received by wallet\n glowInflationTotal: string; // GLW inflation rewards (18 decimals)\n v1MerkleRoot: string; // V1 merkle root for week's reward distribution (hex string)\n v2MerkleRoot: string; // V2 merkle root for week's reward distribution (hex string)\n}\n\nexport interface WeeklyRewardsSummary {\n totalProtocolDepositRewardsReceived: string;\n totalGlowInflation: string;\n weeksActive: number;\n}\n\nexport interface WalletWeeklyRewardsResponse {\n wallet: string;\n summary: WeeklyRewardsSummary;\n rewards: WeeklyReward[];\n}\n\nexport interface WeeklyRewardsQuery {\n startWeek?: number; // Inclusive lower bound epoch/week\n endWeek?: number; // Inclusive upper bound epoch/week\n paymentCurrency?: PaymentCurrency; // Filter by payment currency\n limit?: number; // Max rows to return (default 52, capped at 520)\n}\n\n// ----------------------------- Farm Weekly Rewards ---------------------------\nexport interface FarmWeeklyReward {\n weekNumber: number;\n paymentCurrency: PaymentCurrency;\n protocolDepositPaidTotal: string; // Total amount farm paid as protocol deposit\n glowInflationTotal: string; // Total GLW inflation rewards allocated to farm (18 decimals)\n expectedProductionTotal: string; // Farm's weekly carbon credit production in WAD (18 decimals)\n protocolDepositRewardsDistributed: string; // Portion of protocol deposits distributed to wallets\n}\n\nexport interface FarmWeeklyRewardsSummary {\n totalProtocolDepositPaid: string;\n totalGlowInflation: string;\n totalExpectedProduction: string;\n weeksActive: number;\n}\n\nexport interface FarmWeeklyRewardsResponse {\n farmId: string;\n summary: FarmWeeklyRewardsSummary;\n rewards: FarmWeeklyReward[];\n}\n\nexport interface FarmWeeklyRewardsQuery {\n startWeek?: number; // Inclusive lower bound epoch/week\n endWeek?: number; // Inclusive upper bound epoch/week\n paymentCurrency?: PaymentCurrency; // Filter by payment currency\n limit?: number; // Max rows to return (default 52, capped at 520)\n}\n\n// ----------------------------- Region Weekly Rewards -------------------------\nexport interface RegionWeeklyReward {\n weekNumber: number;\n paymentCurrency: PaymentCurrency;\n protocolDepositPaidTotal: string; // Total amount paid by all farms in region as protocol deposit\n glowInflationTotal: string; // Total GLW inflation rewards allocated to region (18 decimals)\n expectedProductionTotal: string; // Region's total weekly carbon credit production in WAD (18 decimals)\n protocolDepositRewardsDistributed: string; // Always \"0\" for regions (tracked at farm level)\n createdAt?: string; // ISO 8601\n updatedAt?: string; // ISO 8601\n}\n\nexport interface RegionWeeklyRewardsSummary {\n totalProtocolDepositPaid: string;\n totalGlowInflation: string;\n totalExpectedProduction: string;\n weeksActive: number;\n}\n\nexport interface RegionWeeklyRewardsResponse {\n regionId: number;\n summary: RegionWeeklyRewardsSummary;\n rewards: RegionWeeklyReward[];\n}\n\nexport interface RegionWeeklyRewardsQuery {\n startWeek?: number; // Inclusive lower bound epoch/week\n endWeek?: number; // Inclusive upper bound epoch/week\n paymentCurrency?: PaymentCurrency; // Filter by payment currency\n limit?: number; // Max rows to return (default 52, capped at 520)\n}\n\n// ----------------------------- Farms Reward Score ---------------------------\nexport interface EstimateRewardScoreParams {\n userId: string;\n sponsorSplitPercent: number;\n protocolDepositAmount: string;\n paymentCurrency: PaymentCurrency;\n expectedWeeklyCarbonCredits: number;\n regionId: number;\n}\n\nexport interface RewardScoreResponse {\n rewardScore: number;\n userWeeklyPdRewards: string;\n userWeeklyPdRewardsUsd: string;\n userWeeklyGlwRewards: string;\n userWeeklyGlwValueUsd: string;\n userEstimatedWeeklyCash: string;\n userProtocolDeposit: string;\n userGlowSplitPercent: string;\n userDepositSplitPercent: string;\n glwPriceUsd6: string;\n regionInfo: {\n regionId: number;\n regionGctlStaked: string;\n totalGctlStakedAllRegions: string;\n };\n}\n\nexport interface EstimateRewardScoreErrorResponse {\n error: string;\n}\n\n// ----------------------------- Farms Batch Reward Score ---------------------\nexport interface EstimateRewardScoresBatchParams {\n farms: EstimateRewardScoreParams[];\n}\n\nexport interface BatchRewardScoreSuccessResult {\n success: true;\n data: RewardScoreResponse;\n}\n\nexport interface BatchRewardScoreFailureResult {\n success: false;\n error: string;\n farmData: {\n userId: string;\n regionId: number;\n paymentCurrency: string;\n };\n}\n\nexport type BatchRewardScoreResult =\n | BatchRewardScoreSuccessResult\n | BatchRewardScoreFailureResult;\n\nexport interface EstimateRewardScoresBatchResponse {\n results: BatchRewardScoreResult[];\n}\n\n// ----------------------------- Farms Mining Score ----------------------------\nexport interface MiningScoreParams {\n farmId: string; // The farm ID of the existing farm\n userId: string; // User's wallet address to calculate mining score for\n dollarCostOfMiner: string; // Dollar cost of the miner (USD with 6 decimals)\n numberOfMiners: number; // Number of miners in the farm\n minerRewardSplit: string; // Miner reward split percentage (6 decimals)\n}\n\nexport interface MiningScoresBatchParams {\n farms: MiningScoreParams[];\n}\n\nexport interface MiningScoreResponse {\n miningScore: number; // Mining score (calculated using farm's total GLW rewards)\n userWeeklyGlwRewards: string; // User's portion of weekly GLW rewards after split (18 decimals)\n glwPriceUsd6: string; // GLW price used in calculation (6 decimals)\n dollarCostOfMiner: string; // Dollar cost of miner (6 decimals)\n weeksOfMinerLifeRemaining: number; // Weeks of miner life remaining (calculated from farm's end reward period)\n regionInfo: {\n regionId: number;\n regionGctlStaked: string;\n totalGctlStakedAllRegions: string;\n };\n}\n\nexport interface BatchMiningScoreSuccessResult {\n success: true;\n data: MiningScoreResponse;\n}\n\nexport interface BatchMiningScoreFailureResult {\n success: false;\n error: string;\n farmData: {\n farmId: string;\n userId: string;\n };\n}\n\nexport type BatchMiningScoreResult =\n | BatchMiningScoreSuccessResult\n | BatchMiningScoreFailureResult;\n\nexport interface MiningScoresBatchResponse {\n results: BatchMiningScoreResult[];\n}\n\nexport interface MigrationAmountResponse {\n wallet: string;\n migrationAmount: string;\n claimed: boolean;\n eligible: boolean;\n}\n\n// ----------------------------- Wallet Farm Rewards ---------------------------\nexport interface UserWeeklyRewards {\n protocolDepositAsset: PaymentCurrency;\n protocolDepositRewards: string; // User's weekly protocol deposit rewards in the farm's payment currency\n glwInflationRewards: string; // User's weekly GLW inflation rewards (18 decimals)\n userGlowSplitPercent: string; // User's GLW split percentage (6 decimals)\n userDepositSplitPercent: string; // User's deposit split percentage (6 decimals)\n}\n\nexport interface FarmWithRewards extends SponsoredFarm {\n userWeeklyRewards: UserWeeklyRewards;\n}\n\nexport interface WalletFarmsWithRewardsResponse {\n farms: FarmWithRewards[];\n totalFarms: number;\n}\n\n// ----------------------------- Farm Reward Splits ----------------------------\nexport interface FarmRewardSplitsResponse {\n farmId: string;\n rewardSplits: FarmRewardSplit[];\n totalSplits: number;\n}\n\nexport interface FarmRewardSplitsErrorResponse {\n error: string;\n}\n\nexport interface HoldersCountResponse {\n holders: number;\n}\n\nexport interface RetryFailedOperationResponse {\n success?: boolean;\n queued?: boolean;\n}\n\n// ----------------------------- Wallet ToS -----------------------------------\nexport interface TosAcceptRequest {\n signature: string; // EIP-712 signature (0x-prefixed, 130 chars)\n nonce: string; // Unique nonce for replay protection\n tosVersion: string; // ToS version being accepted (e.g. \"1.0\")\n tosHash: string; // Keccak256 hash of ToS content (0x-prefixed, 64 chars)\n message: string; // Full message that was signed\n deadline: string; // Signature expiry timestamp (unix seconds as string)\n}\n\nexport interface TosAcceptResponse {\n success: boolean;\n version: string; // ToS version accepted\n acceptedAt: string; // ISO 8601 timestamp\n}\n\nexport interface TosStatusResponse {\n hasAccepted: boolean; // Has the wallet ever accepted any ToS version\n currentVersion: string; // Current active ToS version (e.g. \"1.0\")\n acceptedVersion?: string; // Version the wallet accepted (if any)\n needsReAcceptance: boolean; // True if wallet needs to accept current version\n acceptedAt?: string; // ISO 8601 timestamp of acceptance (if any)\n}\n\n// ----------------------------- Farm Efficiency Scores ------------------------\nexport interface FarmEfficiencyScore {\n farmId: string;\n name: string; // Farm name\n builtEpoch: number; // Epoch when the farm was built\n efficiencyScore: number;\n protocolDepositUsd6: string;\n weeklyImpactAssetsWad: string;\n}\n\nexport interface EfficiencyScoresResponse {\n farms: FarmEfficiencyScore[];\n}\n\nexport interface SingleEfficiencyScoreResponse extends FarmEfficiencyScore {}\n\nexport interface EfficiencyScoresErrorResponse {\n error: string;\n}\n\n// ----------------------------- Batch Farm Weekly Rewards --------------------\nexport interface FarmWeeklyRewardsBatchQuery {\n farmIds: string[]; // Array of farm IDs (max 100)\n startWeek?: number; // Optional: Inclusive starting week (epoch number)\n endWeek?: number; // Optional: Inclusive ending week (epoch number)\n}\n\nexport interface FarmWeeklyRewardsBatchResult {\n regionId: number; // Region ID where the farm is located\n builtAt: string; // ISO 8601 timestamp when the farm was built\n builtEpoch: number; // Epoch number when the farm was built\n summary: FarmWeeklyRewardsSummary;\n rewards: FarmWeeklyReward[];\n}\n\nexport interface FarmWeeklyRewardsBatchErrorResult {\n error: string;\n}\n\nexport interface FarmWeeklyRewardsBatchResponse {\n results: Record<\n string,\n FarmWeeklyRewardsBatchResult | FarmWeeklyRewardsBatchErrorResult\n >;\n}\n\n// ----------------------------- Wallet Farm Rewards History ------------------\nexport interface WalletFarmReward {\n farmId: string;\n farmName: string;\n regionId: number; // Region ID where the farm is located\n builtAt: string; // ISO 8601 timestamp when the farm was built\n builtEpoch: number; // Epoch number when the farm was built\n expectedWeeklyCarbonCredits: string; // Decimal format\n protocolDepositUSDC6Decimals: string; // 6 decimals\n weekNumber: number;\n walletTotalGlowInflationReward: string; // 18 decimals\n walletTotalProtocolDepositReward: string; // Currency's native decimals\n asset: PaymentCurrency;\n inflationSplitFromLaunchpad: number; // Decimal (e.g., 0.001529 = 0.1529%)\n inflationSplitFromMiningCenter: number;\n depositSplitFromLaunchpad: number;\n depositSplitFromMiningCenter: number;\n walletInflationFromLaunchpad: string; // 18 decimals\n walletProtocolDepositFromLaunchpad: string; // Currency's native decimals\n walletInflationFromMiningCenter: string; // 18 decimals\n walletProtocolDepositFromMiningCenter: string; // Currency's native decimals\n farmTotalInflation: string; // 18 decimals\n farmTotalProtocolDepositReward: string; // Currency's native decimals\n}\n\nexport interface WalletFarmRewardsHistoryQuery {\n startWeek?: number; // Inclusive lower bound epoch/week\n endWeek?: number; // Inclusive upper bound epoch/week\n}\n\nexport interface WalletFarmRewardsHistoryResponse {\n walletAddress: string;\n weekRange: {\n startWeek: number;\n endWeek: number;\n };\n farmRewards: WalletFarmReward[];\n}\n\n// ----------------------------- Batch Wallet Farm Rewards History ------------\nexport interface WalletFarmRewardsHistoryBatchQuery {\n wallets: string[]; // Array of wallet addresses (max 1000)\n startWeek?: number; // Optional: Inclusive starting week (epoch number)\n endWeek?: number; // Optional: Inclusive ending week (epoch number)\n}\n\nexport interface WalletFarmRewardsHistoryBatchResult {\n weekRange: {\n startWeek: number;\n endWeek: number;\n };\n farmRewards: WalletFarmReward[];\n}\n\nexport interface WalletFarmRewardsHistoryBatchResponse {\n results: Record<string, WalletFarmRewardsHistoryBatchResult>;\n}\n\n// ---------------------------------------------------------------------------\n// Barrel exports (convenience)\n// ---------------------------------------------------------------------------\nexport type { MintedEvent as ControlMintedEvent };\n","export const FORWARDER_ABI = [\n {\n inputs: [\n { internalType: \"contract USDG\", name: \"_usdg\", type: \"address\" },\n { internalType: \"contract IERC20\", name: \"_usdc\", type: \"address\" },\n {\n internalType: \"contract CounterfactualHolderFactory\",\n name: \"_cfhFactory\",\n type: \"address\",\n },\n ],\n stateMutability: \"payable\",\n type: \"constructor\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"target\", type: \"address\" }],\n name: \"AddressEmptyCode\",\n type: \"error\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"account\", type: \"address\" }],\n name: \"AddressInsufficientBalance\",\n type: \"error\",\n },\n { inputs: [], name: \"FailedInnerCall\", type: \"error\" },\n { inputs: [], name: \"MaxLengthExceeded\", type: \"error\" },\n { inputs: [], name: \"ReentrancyGuardReentrantCall\", type: \"error\" },\n {\n inputs: [{ internalType: \"address\", name: \"token\", type: \"address\" }],\n name: \"SafeERC20FailedOperation\",\n type: \"error\",\n },\n { inputs: [], name: \"ZeroAmount\", type: \"error\" },\n {\n anonymous: false,\n inputs: [\n { indexed: true, internalType: \"address\", name: \"from\", type: \"address\" },\n { indexed: true, internalType: \"address\", name: \"to\", type: \"address\" },\n {\n indexed: true,\n internalType: \"address\",\n name: \"token\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"amount\",\n type: \"uint256\",\n },\n {\n indexed: false,\n internalType: \"string\",\n name: \"message\",\n type: \"string\",\n },\n ],\n name: \"Forward\",\n type: \"event\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"token\", type: \"address\" },\n { internalType: \"address\", name: \"to\", type: \"address\" },\n { internalType: \"uint256\", name: \"amount\", type: \"uint256\" },\n {\n internalType: \"bool\",\n name: \"sendToCounterfactualWallet\",\n type: \"bool\",\n },\n { internalType: \"string\", name: \"message\", type: \"string\" },\n ],\n name: \"forward\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"i_CFHFactory\",\n outputs: [\n {\n internalType: \"contract CounterfactualHolderFactory\",\n name: \"\",\n type: \"address\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"i_USDC\",\n outputs: [{ internalType: \"contract IERC20\", name: \"\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"i_USDG\",\n outputs: [{ internalType: \"contract USDG\", name: \"\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"nextNonce\",\n outputs: [{ internalType: \"uint256\", name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"uint256\", name: \"amount\", type: \"uint256\" },\n { internalType: \"address\", name: \"to\", type: \"address\" },\n {\n internalType: \"bool\",\n name: \"sendToCounterfactualWallet\",\n type: \"bool\",\n },\n { internalType: \"string\", name: \"message\", type: \"string\" },\n ],\n name: \"swapUSDCAndForwardUSDG\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n] as const;\n","export const ERC20_ABI = [\n {\n inputs: [\n { name: \"spender\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n ],\n name: \"approve\",\n outputs: [{ name: \"\", type: \"bool\" }],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { name: \"owner\", type: \"address\" },\n { name: \"spender\", type: \"address\" },\n ],\n name: \"allowance\",\n outputs: [{ name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { name: \"to\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n ],\n name: \"transfer\",\n outputs: [{ name: \"\", type: \"bool\" }],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [{ name: \"account\", type: \"address\" }],\n name: \"balanceOf\",\n outputs: [{ name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { name: \"account\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n ],\n name: \"mint\",\n outputs: [{ name: \"\", type: \"bool\" }],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n];\n","export type ContractKeys =\n | \"USDC\"\n | \"FORWARDER\"\n | \"FOUNDATION_WALLET\"\n | \"GLW\"\n | \"USDG\"\n | \"USDG_REDEMPTION\"\n | \"IMPACT_CATALYST\"\n | \"AUDIT_FEE_WALLET\"\n | \"UNISWAP_V2_ROUTER\"\n | \"UNISWAP_V2_FACTORY\"\n | \"USDG_UNISWAP\"\n | \"GLW_UNISWAP\"\n | \"OFFCHAIN_FRACTIONS\"\n | \"COUNTERFACTUAL_HOLDER_FACTORY\"\n | \"FOUNDATION_HUB_MANAGER_WALLET\"\n | \"FOUNDATION_REWARDS_WALLET\"\n | \"ENDOWMENT_WALLET\"\n | \"REWARDS_KERNEL\"\n | \"FOUNDATION_HOT_WALLET_PD\";\n\n// Contract-specific addresses\nconst mainnetAddresses: Record<ContractKeys, `0x${string}`> = {\n AUDIT_FEE_WALLET: \"0x3ff5af3333ddc6048d98849ec5e67868494693c9\", //aka GVE wallet\n IMPACT_CATALYST: \"0x552Fbb4E0269fd5036daf72Ec006AAF6C958F4Fa\",\n USDG_REDEMPTION: \"0x1c2cA537757e1823400F857EdBe72B55bbAe0F08\",\n USDG: \"0xe010ec500720bE9EF3F82129E7eD2Ee1FB7955F2\",\n GLW: \"0xf4fbC617A5733EAAF9af08E1Ab816B103388d8B6\",\n USDC: \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n USDG_UNISWAP: \"0xe010ec500720bE9EF3F82129E7eD2Ee1FB7955F2\",\n GLW_UNISWAP: \"0xf4fbC617A5733EAAF9af08E1Ab816B103388d8B6\",\n FORWARDER: \"0x1519a8fE33acf8C164578789629146278541506A\",\n OFFCHAIN_FRACTIONS: \"0x80EA852448c2807BeAe321deC7c603990209F7db\",\n COUNTERFACTUAL_HOLDER_FACTORY: \"0x5bB7eC88cA80146FF47019079Cf0330532A1157F\",\n FOUNDATION_HUB_MANAGER_WALLET: \"0x2b57E1bF5071c6579F2145b367EEC34f8729AA9C\",\n FOUNDATION_WALLET: \"0x77040BbBD506F5e5a7D65f6917416Bae6C78B9fa\",\n FOUNDATION_REWARDS_WALLET: \"0x6972B05A0c80064fBE8a10CBc2a2FBCF6fb47D6a\",\n UNISWAP_V2_ROUTER: \"0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\",\n UNISWAP_V2_FACTORY: \"0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f\",\n ENDOWMENT_WALLET: \"0x868D99B4a6e81b4683D10ea5665f13579A9d1607\",\n REWARDS_KERNEL: \"0xd6d3139d40a32F8bA71D576c1A743529AB4786BB\",\n FOUNDATION_HOT_WALLET_PD: \"0x465E5573c648BC50a11911Cd48D0e279F4409Ec8\",\n};\n\nconst sepoliaAddresses: Record<ContractKeys, `0x${string}`> = {\n AUDIT_FEE_WALLET: \"0x3ff5af3333ddc6048d98849ec5e67868494693c9\",\n IMPACT_CATALYST: \"0xb793Ed3CD94357f0e1933b0bd19F921b99f4C72a\",\n USDG_REDEMPTION: \"0x04829038A6664C16eC994BFb87754Fa621e51135\",\n USDG: \"0xda78313A3fF949890112c1B746AB1c75d1b1c17B\",\n GLW: \"0x2039161fce4c8e5cf5fe64e17fd290e8dff3c9bd\",\n USDC: \"0x93c898be98cd2618ba84a6dccf5003d3bbe40356\",\n USDG_UNISWAP: \"0x2a085A3aEA8982396533327c854753Ce521B666d\",\n GLW_UNISWAP: \"0x8e27016D0B866a56CE74A1a280c749dD679bb0Fa\",\n FORWARDER: \"0xe7A366482899e2Ed29c9504F4792B8D1c67066ff\",\n OFFCHAIN_FRACTIONS: \"0x5Ad30F90AFEf1279157A5055AAd2d8c1529a05D2\",\n COUNTERFACTUAL_HOLDER_FACTORY: \"0x2c3AB887746F6f4a8a4b9Db6aC800eb71945509A\",\n FOUNDATION_WALLET: \"0x5e230FED487c86B90f6508104149F087d9B1B0A7\",\n FOUNDATION_HUB_MANAGER_WALLET: \"0x5252FdA14A149c01EA5A1D6514a9c1369E4C70b4\",\n FOUNDATION_REWARDS_WALLET: \"0x5252FdA14A149c01EA5A1D6514a9c1369E4C70b4\",\n UNISWAP_V2_ROUTER: \"0xeE567Fe1712Faf6149d80dA1E6934E354124CfE3\",\n UNISWAP_V2_FACTORY: \"0xF62c03E08ada871A0bEb309762E260a7a6a880E6\",\n ENDOWMENT_WALLET: \"0x868D99B4a6e81b4683D10ea5665f13579A9d1607\",\n REWARDS_KERNEL: \"0x92fcC4D8565062381d8fBD5Af1b32432104FDBC7\",\n FOUNDATION_HOT_WALLET_PD: \"0x465E5573c648BC50a11911Cd48D0e279F4409Ec8\",\n};\n\nexport const getAddresses = (\n CHAIN_ID: number\n): Record<ContractKeys, `0x${string}`> => {\n switch (CHAIN_ID) {\n case 1:\n return mainnetAddresses;\n case 11155111:\n return sepoliaAddresses;\n default:\n console.warn(\n `Unsupported chain ID: ${CHAIN_ID}, falling back to mainnet addresses`\n );\n return mainnetAddresses;\n }\n};\n\nexport const DECIMALS_BY_TOKEN: Record<\n \"USDC\" | \"USDG\" | \"GCTL\" | \"SGCTL\" | \"GLW\",\n number\n> = {\n USDC: 6,\n USDG: 6,\n GCTL: 6,\n SGCTL: 6,\n GLW: 18,\n};\n","import { type PublicClient } from \"viem\";\nimport { type Signer } from \"ethers\";\n\n// Error parsing utilities\nexport function parseViemError(error: unknown): string {\n if (!error) return \"Unknown error\";\n\n // Check if it's a viem BaseError\n if (error instanceof Error) {\n // For contract revert errors\n if ((error as any).cause?.reason) {\n return (error as any).cause.reason;\n }\n\n // For viem's shortMessage\n if ((error as any).shortMessage) {\n return (error as any).shortMessage;\n }\n\n // Fallback to regular message\n if (error.message) {\n return error.message;\n }\n }\n\n return \"Unknown error\";\n}\n\nexport function parseEthersError(error: unknown): string {\n if (!error) return \"Unknown error\";\n const possibleError: any = error;\n\n // If the error originates from a callStatic it will often be found at `error?.error?.body`\n if (possibleError?.error?.body) {\n try {\n const body = JSON.parse(possibleError.error.body);\n // Hardhat style errors\n if (body?.error?.message) return body.error.message as string;\n } catch {}\n }\n\n // Found on MetaMask/Alchemy shape errors\n if (possibleError?.data?.message) return possibleError.data.message as string;\n if (possibleError?.error?.message)\n return possibleError.error.message as string;\n\n // Standard ethers v5 message\n if (possibleError?.reason) return possibleError.reason as string;\n if (possibleError?.message) return possibleError.message as string;\n\n return \"Unknown error\";\n}\n\n// Transaction receipt utilities\nexport interface TransactionRetryOptions {\n maxRetries?: number;\n timeoutMs?: number;\n enableLogging?: boolean;\n pollIntervalMs?: number;\n}\n\nconst DEFAULT_OPTIONS: Required<TransactionRetryOptions> = {\n maxRetries: 3,\n timeoutMs: 60000,\n enableLogging: true,\n pollIntervalMs: 2000,\n};\n\n/**\n * Enhanced transaction receipt handler with retry logic for viem\n * @param publicClient The viem public client\n * @param hash The transaction hash\n * @param options Retry configuration options\n */\nexport async function waitForViemTransactionWithRetry(\n publicClient: PublicClient,\n hash: `0x${string}`,\n options: TransactionRetryOptions = {}\n): Promise<void> {\n const { maxRetries, timeoutMs, enableLogging, pollIntervalMs } = {\n ...DEFAULT_OPTIONS,\n ...options,\n };\n\n const deadline = Date.now() + timeoutMs;\n let consecutiveErrors = 0;\n\n while (Date.now() < deadline) {\n try {\n const receipt = await publicClient.getTransactionReceipt({ hash });\n if (receipt) {\n if (receipt.status === \"reverted\") {\n throw new Error(`Transaction ${hash} was reverted on-chain`);\n }\n if (enableLogging) {\n console.log(\n `Transaction ${hash} confirmed successfully in block ${receipt.blockNumber}`\n );\n }\n return;\n }\n } catch (error) {\n const errorMessage = parseViemError(error);\n // Treat not found/receipt missing as retryable without counting towards errors\n const isNotFound =\n errorMessage.includes(\"not found\") ||\n errorMessage.includes(\"could not be found\") ||\n errorMessage.includes(\"receipt\") ||\n errorMessage.includes(\"not confirmed\") ||\n errorMessage.includes(\"TransactionReceiptNotFound\");\n\n if (!isNotFound) {\n consecutiveErrors++;\n if (consecutiveErrors >= maxRetries) {\n throw new Error(\n `Transaction failed after ${consecutiveErrors} attempts: ${errorMessage}`\n );\n }\n if (enableLogging) {\n console.warn(\n `Error fetching receipt (attempt ${consecutiveErrors}/${maxRetries}), retrying in ${pollIntervalMs}ms...`\n );\n }\n }\n }\n\n await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));\n }\n\n throw new Error(`Transaction receipt not found within ${timeoutMs}ms`);\n}\n\n/**\n * Enhanced transaction receipt handler with retry logic for ethers.js\n * @param signer The ethers signer\n * @param txHash The transaction hash\n * @param options Retry configuration options\n */\nexport async function waitForEthersTransactionWithRetry(\n signer: Signer,\n txHash: string,\n options: TransactionRetryOptions = {}\n): Promise<void> {\n const { maxRetries, timeoutMs, enableLogging, pollIntervalMs } = {\n ...DEFAULT_OPTIONS,\n ...options,\n };\n\n const provider = signer.provider;\n if (!provider) {\n throw new Error(\"Provider not available\");\n }\n\n const deadline = Date.now() + timeoutMs;\n let consecutiveErrors = 0;\n\n while (Date.now() < deadline) {\n try {\n const receipt = await provider.getTransactionReceipt(txHash);\n if (receipt) {\n if ((receipt as any).status === 0) {\n throw new Error(`Transaction ${txHash} was reverted on-chain`);\n }\n if (enableLogging) {\n console.log(\n `Transaction ${txHash} confirmed successfully in block ${\n (receipt as any).blockNumber\n }`\n );\n }\n return;\n }\n } catch (error) {\n const errorMessage = parseEthersError(error);\n consecutiveErrors++;\n if (consecutiveErrors >= maxRetries) {\n throw new Error(\n `Transaction failed after ${consecutiveErrors} attempts: ${errorMessage}`\n );\n }\n if (enableLogging) {\n console.warn(\n `Error fetching receipt (attempt ${consecutiveErrors}/${maxRetries}), retrying in ${pollIntervalMs}ms...`\n );\n }\n }\n\n await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));\n }\n\n throw new Error(`Transaction receipt not found within ${timeoutMs}ms`);\n}\n","\"use strict\";\n\nexport interface SentryBreadcrumb {\n category: string;\n message?: string;\n level?: \"error\" | \"warning\" | \"info\" | \"debug\";\n data?: Record<string, unknown>;\n}\n\nexport interface SentryClientLike {\n captureException: (\n error: unknown,\n context?: { extra?: Record<string, unknown> }\n ) => void;\n addBreadcrumb?: (breadcrumb: SentryBreadcrumb) => void;\n}\n\ntype SentryConfig = {\n enabled?: boolean;\n client?: SentryClientLike | null;\n defaultContext?: Record<string, unknown>;\n};\n\nlet configuredClient: SentryClientLike | null = null;\nlet isEnabled = true;\nlet defaultExtra: Record<string, unknown> = {};\n\nfunction getSentry(): SentryClientLike | null {\n const client =\n configuredClient ??\n ((globalThis as any)?.Sentry as SentryClientLike | undefined);\n if (!client || typeof client.captureException !== \"function\") return null;\n return client;\n}\n\nexport function configureSentry(config: SentryConfig): void {\n if (config.enabled !== undefined) isEnabled = !!config.enabled;\n if (config.client !== undefined) configuredClient = config.client;\n if (config.defaultContext) defaultExtra = { ...config.defaultContext };\n}\n\nfunction shouldSkipSentry(error: unknown): boolean {\n try {\n const possible: any = error;\n const code: string | undefined = possible?.code || possible?.cause?.code;\n const name: string | undefined = possible?.name || possible?.cause?.name;\n const message: string = String(\n possible?.message || possible?.cause?.message || \"\"\n );\n\n // User rejected wallet request (ethers/viem/common providers)\n if (code === \"ACTION_REJECTED\") return true;\n if (name === \"UserRejectedRequestError\") return true;\n if (/user rejected/i.test(message)) return true;\n\n // Terminal waitForViemTransactionWithRetry error (retries exhausted)\n if (/Transaction failed after\\s+\\d+\\s+attempts:/i.test(message)) {\n return true;\n }\n\n return false;\n } catch {\n return false;\n }\n}\n\nexport function sentryAddBreadcrumb(breadcrumb: SentryBreadcrumb): void {\n try {\n if (!isEnabled) return;\n getSentry()?.addBreadcrumb?.(breadcrumb);\n } catch {}\n}\n\nexport function sentryCaptureException(\n error: unknown,\n extra?: Record<string, unknown>\n): void {\n try {\n if (!isEnabled) return;\n if (shouldSkipSentry(error)) return;\n const client = getSentry();\n if (!client) return;\n const merged = extra ? { ...defaultExtra, ...extra } : defaultExtra;\n client.captureException(\n error,\n Object.keys(merged).length ? { extra: merged } : undefined\n );\n } catch {}\n}\n","import { Contract, MaxUint256, type Signer } from \"ethers\";\nimport { FORWARDER_ABI } from \"../abis/forwarderABI\";\nimport { ERC20_ABI } from \"../abis/erc20.abi\";\nimport { getAddresses } from \"../../constants/addresses\";\nimport { formatEther } from \"viem\";\nimport { PendingTransferType, TRANSFER_TYPES } from \"../types\";\nimport {\n parseEthersError,\n waitForEthersTransactionWithRetry,\n} from \"../../utils/transaction-utils\";\nimport {\n sentryAddBreadcrumb,\n sentryCaptureException,\n} from \"../../utils/sentry\";\n\nexport enum ForwarderError {\n CONTRACT_NOT_AVAILABLE = \"Contract not available\",\n SIGNER_NOT_AVAILABLE = \"Signer not available\",\n UNKNOWN_ERROR = \"Unknown error\",\n INVALID_FORWARD_TYPE = \"Invalid forward type\",\n MISSING_REQUIRED_PARAMS = \"Missing required parameters\",\n}\n\n// Forward types based on API router documentation\nexport type ForwardType = PendingTransferType;\n\n// Currency types\nexport type Currency = \"USDC\" | \"GLW\" | \"USDG\";\n\n// Forward parameters interface\nexport interface ForwardParams {\n amount: bigint;\n userAddress: string;\n type: ForwardType;\n currency?: Currency;\n applicationId?: string;\n farmId?: string;\n regionId?: number;\n kickstarterId?: string;\n}\n\n// Type-guard style helper to ensure a signer exists throughout the rest of the function.\nfunction assertSigner(\n maybeSigner: Signer | undefined\n): asserts maybeSigner is Signer {\n if (!maybeSigner) {\n throw new Error(ForwarderError.SIGNER_NOT_AVAILABLE);\n }\n}\n\nexport function useForwarder(signer: Signer | undefined, CHAIN_ID: number) {\n // Use dynamic addresses based on chain configuration\n const ADDRESSES = getAddresses(CHAIN_ID);\n\n // Framework-agnostic processing flag\n let isProcessing = false;\n const setIsProcessing = (value: boolean) => {\n isProcessing = value;\n };\n\n // Returns a contract instance for Forwarder\n function getForwarderContract() {\n assertSigner(signer);\n return new Contract(ADDRESSES.FORWARDER, FORWARDER_ABI, signer);\n }\n\n /**\n * Construct the message for the forward call based on type and parameters\n */\n function constructForwardMessage(params: ForwardParams): string {\n const {\n type,\n applicationId,\n farmId,\n regionId,\n userAddress,\n kickstarterId,\n } = params;\n\n switch (type) {\n case TRANSFER_TYPES.PayProtocolFeeAndMintGCTLAndStake:\n if (!applicationId) {\n throw new Error(ForwarderError.MISSING_REQUIRED_PARAMS);\n }\n return `PayProtocolFeeAndMintGCTLAndStake::${applicationId}`;\n\n case TRANSFER_TYPES.PayProtocolFee:\n if (!applicationId) {\n throw new Error(ForwarderError.MISSING_REQUIRED_PARAMS);\n }\n return `PayProtocolFee::${applicationId}`;\n\n case TRANSFER_TYPES.SponsorProtocolFee:\n if (!applicationId) {\n throw new Error(ForwarderError.MISSING_REQUIRED_PARAMS);\n }\n return `SponsorProtocolFee::${applicationId}`;\n\n case TRANSFER_TYPES.SponsorProtocolFeeAndMintGCTLAndStake:\n if (!applicationId) {\n throw new Error(ForwarderError.MISSING_REQUIRED_PARAMS);\n }\n return `SponsorProtocolFeeAndMintGCTLAndStake::${applicationId}`;\n\n case TRANSFER_TYPES.MintGCTLAndStake:\n if (!regionId) {\n throw new Error(ForwarderError.MISSING_REQUIRED_PARAMS);\n }\n return `MintGCTLAndStake::${regionId}`;\n\n case TRANSFER_TYPES.MintGCTL:\n if (!userAddress) {\n throw new Error(ForwarderError.MISSING_REQUIRED_PARAMS);\n }\n return `MintGCTL::${userAddress}`;\n\n case TRANSFER_TYPES.BuySolarFarm:\n if (!farmId) {\n throw new Error(ForwarderError.MISSING_REQUIRED_PARAMS);\n }\n return `BuySolarFarm::${farmId}`;\n\n case TRANSFER_TYPES.PayAuditFees:\n if (!applicationId) {\n throw new Error(ForwarderError.MISSING_REQUIRED_PARAMS);\n }\n return `PayAuditFees::${applicationId}`;\n\n case TRANSFER_TYPES.CommitKickstarter:\n if (!kickstarterId) {\n throw new Error(ForwarderError.MISSING_REQUIRED_PARAMS);\n }\n return `CommitKickstarter::${kickstarterId}`;\n\n default:\n throw new Error(ForwarderError.INVALID_FORWARD_TYPE);\n }\n }\n\n /**\n * Get the appropriate token contract based on currency\n */\n function getTokenContract(currency: Currency = \"USDC\") {\n assertSigner(signer);\n\n let tokenAddress: string;\n switch (currency) {\n case \"USDC\":\n tokenAddress = ADDRESSES.USDC;\n break;\n case \"GLW\":\n tokenAddress = ADDRESSES.GLW;\n break;\n case \"USDG\":\n tokenAddress = ADDRESSES.USDG;\n break;\n default:\n throw new Error(\n `Currency ${currency} not yet supported. Only USDC, GLW, and USDG are currently supported.`\n );\n }\n\n return new Contract(tokenAddress, ERC20_ABI, signer);\n }\n\n /**\n * Check current token allowance for the forwarder contract\n * @param owner The wallet address to check allowance for\n * @param currency The currency to check allowance for\n */\n async function checkTokenAllowance(\n owner: string,\n currency: Currency = \"USDC\"\n ): Promise<bigint> {\n assertSigner(signer);\n\n try {\n const tokenContract = getTokenContract(currency);\n if (!tokenContract)\n throw new Error(ForwarderError.CONTRACT_NOT_AVAILABLE);\n\n const allowance: bigint = await tokenContract.allowance(\n owner,\n ADDRESSES.FORWARDER\n );\n return allowance;\n } catch (error) {\n throw new Error(parseEthersError(error));\n }\n }\n\n /**\n * Check user's token balance\n * @param owner The wallet address to check balance for\n * @param currency The currency to check balance for\n */\n async function checkTokenBalance(\n owner: string,\n currency: Currency = \"USDC\"\n ): Promise<bigint> {\n assertSigner(signer);\n\n try {\n const tokenContract = getTokenContract(currency);\n if (!tokenContract)\n throw new Error(ForwarderError.CONTRACT_NOT_AVAILABLE);\n\n const balance: bigint = await tokenContract.balanceOf(owner);\n return balance;\n } catch (error) {\n throw new Error(parseEthersError(error));\n }\n }\n\n /**\n * Approve tokens for the forwarder contract\n * @param amount Amount to approve (BigNumber)\n * @param currency The currency to approve\n */\n async function approveToken(\n amount: bigint,\n currency: Currency = \"USDC\"\n ): Promise<boolean> {\n assertSigner(signer);\n\n try {\n const tokenContract = getTokenContract(currency);\n if (!tokenContract)\n throw new Error(ForwarderError.CONTRACT_NOT_AVAILABLE);\n\n setIsProcessing(true);\n\n // Approve only the specific amount needed\n const approveTx = await tokenContract.approve(\n ADDRESSES.FORWARDER,\n amount\n );\n await waitForEthersTransactionWithRetry(signer, approveTx.hash, {\n timeoutMs: 30000,\n pollIntervalMs: 2000,\n });\n\n return true;\n } catch (error) {\n throw new Error(parseEthersError(error));\n } finally {\n setIsProcessing(false);\n }\n }\n\n /**\n * Forward tokens through the forwarder contract with type-specific handling\n * @param params Forward parameters including type, amount, and required fields\n */\n async function forwardTokens(params: ForwardParams): Promise<string> {\n assertSigner(signer);\n\n try {\n const forwarderContract = getForwarderContract();\n if (!forwarderContract)\n throw new Error(ForwarderError.CONTRACT_NOT_AVAILABLE);\n\n setIsProcessing(true);\n\n const { amount, currency = \"USDC\" } = params;\n const tokenContract = getTokenContract(currency);\n if (!tokenContract)\n throw new Error(ForwarderError.CONTRACT_NOT_AVAILABLE);\n\n sentryAddBreadcrumb({\n category: \"forwarder\",\n message: \"forwardTokens.start\",\n level: \"info\",\n data: {\n chainId: CHAIN_ID,\n type: params.type,\n amount: amount.toString(),\n currency,\n applicationId: params.applicationId,\n farmId: params.farmId,\n regionId: params.regionId,\n kickstarterId: params.kickstarterId,\n userAddress: params.userAddress,\n },\n });\n\n const owner = await signer.getAddress();\n\n // Construct the appropriate message for this forward type\n const message = constructForwardMessage(params);\n\n // Special handling: PayAuditFees can ONLY be USDC, and must call forward()\n const isAuditFees = params.type === TRANSFER_TYPES.PayAuditFees;\n if (isAuditFees && currency !== \"USDC\") {\n throw new Error(\"PayAuditFees only supports USDC\");\n }\n\n // CommitKickstarter supports only USDC or USDG (GLW not allowed)\n const isCommitKickstarter =\n params.type === TRANSFER_TYPES.CommitKickstarter;\n if (isCommitKickstarter && currency === \"GLW\") {\n throw new Error(\"CommitKickstarter supports only USDC or USDG\");\n }\n\n // Check allowance and approve if necessary\n const allowance: bigint = await tokenContract.allowance(\n owner,\n ADDRESSES.FORWARDER\n );\n console.log(\"allowance\", allowance.toString());\n if (allowance < amount) {\n try {\n const approveTx = await tokenContract.approve(\n ADDRESSES.FORWARDER,\n MaxUint256\n );\n await waitForEthersTransactionWithRetry(signer, approveTx.hash, {\n timeoutMs: 30000,\n pollIntervalMs: 2000,\n });\n } catch (approveError) {\n sentryCaptureException(approveError, {\n action: \"forwardTokens.approve\",\n chainId: CHAIN_ID,\n spender: ADDRESSES.FORWARDER,\n amount: MaxUint256.toString(),\n currency,\n });\n throw new Error(\n parseEthersError(approveError) || \"Token approval failed\"\n );\n }\n }\n\n // Get the token address based on currency\n let tokenAddress: string;\n switch (currency) {\n case \"USDC\":\n tokenAddress = ADDRESSES.USDC;\n break;\n case \"USDG\":\n tokenAddress = ADDRESSES.USDG;\n break;\n case \"GLW\":\n tokenAddress = ADDRESSES.GLW;\n break;\n default:\n throw new Error(`Unsupported currency for forwarding: ${currency}`);\n }\n\n // Determine sendToCounterfactualWallet based on currency\n const sendToCounterfactualWallet = true;\n\n // Run a static call first to surface any revert reason (ethers v6)\n try {\n if (!isAuditFees && currency === \"USDC\") {\n await forwarderContract\n .getFunction(\"swapUSDCAndForwardUSDG\")\n .staticCall(\n amount,\n ADDRESSES.FOUNDATION_WALLET,\n sendToCounterfactualWallet,\n message,\n {\n from: owner,\n }\n );\n } else {\n await forwarderContract\n .getFunction(\"forward\")\n .staticCall(\n tokenAddress,\n isAuditFees\n ? ADDRESSES.AUDIT_FEE_WALLET\n : ADDRESSES.FOUNDATION_WALLET,\n amount,\n sendToCounterfactualWallet,\n message,\n { from: owner }\n );\n }\n } catch (staticError) {\n sentryCaptureException(staticError, {\n action: \"forwardTokens.staticCall\",\n chainId: CHAIN_ID,\n function:\n !isAuditFees && currency === \"USDC\"\n ? \"swapUSDCAndForwardUSDG\"\n : \"forward\",\n tokenAddress,\n amount: amount.toString(),\n currency,\n isAuditFees,\n });\n throw new Error(parseEthersError(staticError));\n }\n\n // Execute the forward transaction\n let tx;\n if (!isAuditFees && currency === \"USDC\") {\n tx = await forwarderContract.getFunction(\"swapUSDCAndForwardUSDG\")(\n amount,\n ADDRESSES.FOUNDATION_WALLET,\n sendToCounterfactualWallet,\n message\n );\n } else {\n tx = await forwarderContract.getFunction(\"forward\")(\n tokenAddress,\n isAuditFees\n ? ADDRESSES.AUDIT_FEE_WALLET\n : ADDRESSES.FOUNDATION_WALLET,\n amount,\n sendToCounterfactualWallet,\n message\n );\n }\n await waitForEthersTransactionWithRetry(signer, tx.hash, {\n timeoutMs: 30000,\n pollIntervalMs: 2000,\n });\n\n return tx.hash;\n } catch (txError: any) {\n sentryCaptureException(txError, {\n action: \"forwardTokens\",\n chainId: CHAIN_ID,\n type: params.type,\n amount: params.amount.toString(),\n currency: params.currency ?? \"USDC\",\n applicationId: params.applicationId,\n farmId: params.farmId,\n regionId: params.regionId,\n kickstarterId: params.kickstarterId,\n userAddress: params.userAddress,\n });\n throw new Error(parseEthersError(txError));\n } finally {\n setIsProcessing(false);\n }\n }\n\n /**\n * Forward tokens for protocol fee payment and GCTL minting with staking\n */\n async function payProtocolFeeAndMintGCTLAndStake(\n amount: bigint,\n userAddress: string,\n applicationId: string,\n regionId?: number,\n currency: Currency = \"USDC\"\n ): Promise<string> {\n assertSigner(signer);\n\n // GCTL minting only supports USDC and USDG\n if (currency === \"GLW\") {\n throw new Error(\n \"GCTL minting is not supported with GLW payment. Use USDC or USDG.\"\n );\n }\n\n return forwardTokens({\n amount,\n userAddress,\n type: TRANSFER_TYPES.PayProtocolFeeAndMintGCTLAndStake,\n currency,\n applicationId,\n regionId,\n });\n }\n /**\n * Forward tokens for protocol fee payment and GCTL minting with staking\n */\n async function sponsorProtocolFeeAndMintGCTLAndStake(\n amount: bigint,\n userAddress: string,\n applicationId: string,\n currency: Currency = \"USDC\"\n ): Promise<string> {\n assertSigner(signer);\n\n if (currency === \"GLW\") {\n throw new Error(\n \"GCTL minting is not supported with GLW payment. Use USDC or USDG.\"\n );\n }\n\n return forwardTokens({\n amount,\n userAddress,\n type: TRANSFER_TYPES.SponsorProtocolFeeAndMintGCTLAndStake,\n currency,\n applicationId,\n });\n }\n\n /**\n * Forward tokens for protocol fee payment only\n */\n async function payProtocolFee(\n amount: bigint,\n userAddress: string,\n applicationId: string,\n currency: Currency = \"USDC\"\n ): Promise<string> {\n assertSigner(signer);\n\n return forwardTokens({\n amount,\n userAddress,\n type: TRANSFER_TYPES.PayProtocolFee,\n currency,\n applicationId,\n });\n }\n\n /**\n * Forward tokens for protocol fee payment only\n */\n async function sponsorProtocolFee(\n amount: bigint,\n userAddress: string,\n applicationId: string,\n currency: Currency = \"USDC\"\n ): Promise<string> {\n assertSigner(signer);\n\n return forwardTokens({\n amount,\n userAddress,\n type: TRANSFER_TYPES.SponsorProtocolFee,\n currency,\n applicationId,\n });\n }\n\n /**\n * Forward USDC to mint GCTL and stake to a region\n */\n async function mintGCTLAndStake(\n amount: bigint,\n userAddress: string,\n regionId?: number,\n currency: Currency = \"USDC\"\n ): Promise<string> {\n assertSigner(signer);\n\n // GCTL minting only supports USDC and USDG\n if (currency === \"GLW\") {\n throw new Error(\n \"GCTL minting is not supported with GLW payment. Use USDC or USDG.\"\n );\n }\n\n return forwardTokens({\n amount,\n userAddress,\n type: TRANSFER_TYPES.MintGCTLAndStake,\n currency,\n regionId,\n });\n }\n\n /**\n * Forward USDC to mint GCTL (existing functionality, keeping for compatibility)\n */\n async function mintGCTL(\n amount: bigint,\n userAddress: string,\n currency: Currency = \"USDC\"\n ): Promise<string> {\n assertSigner(signer);\n\n // GCTL minting only supports USDC and USDG\n if (currency === \"GLW\") {\n throw new Error(\n \"GCTL minting is not supported with GLW payment. Use USDC or USDG.\"\n );\n }\n\n return forwardTokens({\n amount,\n userAddress,\n type: TRANSFER_TYPES.MintGCTL,\n currency,\n });\n }\n\n /**\n * Forward tokens to pay audit fees (USDC only, calls forward())\n */\n async function payAuditFees(\n amount: bigint,\n userAddress: string,\n applicationId: string\n ): Promise<string> {\n assertSigner(signer);\n\n return forwardTokens({\n amount,\n userAddress,\n type: TRANSFER_TYPES.PayAuditFees,\n currency: \"USDC\",\n applicationId,\n });\n }\n\n /**\n * Forward tokens to buy a solar farm\n */\n async function buySolarFarm(\n amount: bigint,\n userAddress: string,\n farmId: string,\n currency: Currency = \"USDC\"\n ): Promise<string> {\n assertSigner(signer);\n\n return forwardTokens({\n amount,\n userAddress,\n type: TRANSFER_TYPES.BuySolarFarm,\n currency,\n farmId,\n });\n }\n\n /**\n * Forward tokens to commit to a Kickstarter (USDC or USDG only)\n */\n async function commitKickstarter(\n amount: bigint,\n userAddress: string,\n kickstarterId: string,\n currency: Currency = \"USDC\"\n ): Promise<string> {\n assertSigner(signer);\n\n if (currency === \"GLW\") {\n throw new Error(\"CommitKickstarter supports only USDC or USDG\");\n }\n\n return forwardTokens({\n amount,\n userAddress,\n type: TRANSFER_TYPES.CommitKickstarter,\n currency,\n kickstarterId,\n });\n }\n\n /**\n * Estimate gas for forwarding with type-specific handling\n * @param params Forward parameters\n * @param ethPriceInUSD Current ETH price in USD (for cost estimation)\n */\n async function estimateGasForForward(\n params: ForwardParams,\n ethPriceInUSD: number | null\n ): Promise<string> {\n assertSigner(signer);\n\n try {\n const forwarderContract = getForwarderContract();\n if (!forwarderContract)\n throw new Error(ForwarderError.CONTRACT_NOT_AVAILABLE);\n\n const { amount, currency = \"USDC\" } = params;\n const isAuditFees = params.type === TRANSFER_TYPES.PayAuditFees;\n if (isAuditFees && currency !== \"USDC\") {\n throw new Error(\"PayAuditFees only supports USDC\");\n }\n\n // Construct the appropriate message for this forward type\n const message = constructForwardMessage(params);\n\n // Get token address\n let tokenAddress: string;\n switch (currency) {\n case \"USDC\":\n tokenAddress = ADDRESSES.USDC;\n break;\n case \"USDG\":\n tokenAddress = ADDRESSES.USDG;\n break;\n case \"GLW\":\n tokenAddress = ADDRESSES.GLW;\n break;\n default:\n throw new Error(\n `Unsupported currency for gas estimation: ${currency}`\n );\n }\n\n const feeData = await signer.provider?.getFeeData();\n const gasPrice =\n feeData?.gasPrice ?? feeData?.maxFeePerGas ?? (0n as bigint);\n if (gasPrice === 0n) {\n throw new Error(\"Could not fetch gas price to estimate cost.\");\n }\n const estimatedGas: bigint =\n !isAuditFees && currency === \"USDC\"\n ? await forwarderContract\n .getFunction(\"swapUSDCAndForwardUSDG\")\n .estimateGas(amount, ADDRESSES.FOUNDATION_WALLET, true, message)\n : await forwarderContract\n .getFunction(\"forward\")\n .estimateGas(\n tokenAddress,\n isAuditFees\n ? ADDRESSES.AUDIT_FEE_WALLET\n : ADDRESSES.FOUNDATION_WALLET,\n amount,\n true,\n message\n );\n const estimatedCost: bigint = estimatedGas * gasPrice;\n\n if (ethPriceInUSD) {\n const estimatedCostInEth = formatEther(estimatedCost);\n const estimatedCostInUSD = (\n parseFloat(estimatedCostInEth) * ethPriceInUSD\n ).toFixed(2);\n return estimatedCostInUSD;\n } else {\n throw new Error(\n \"Could not fetch the ETH price to calculate cost in USD.\"\n );\n }\n } catch (error: any) {\n throw new Error(parseEthersError(error));\n }\n }\n\n /**\n * Mint test USDC (only works on testnets with mintable USDC contracts)\n * @param amount Amount of USDC to mint (BigNumber, 6 decimals)\n * @param recipient Address to mint USDC to\n */\n async function mintTestUSDC(\n amount: bigint,\n recipient: string\n ): Promise<string> {\n assertSigner(signer);\n if (CHAIN_ID !== 11155111) {\n throw new Error(\"Minting test USDC is only supported on Sepolia\");\n }\n\n try {\n const usdcContract = getTokenContract(\"USDC\"); // Use getTokenContract for consistency\n if (!usdcContract) throw new Error(ForwarderError.CONTRACT_NOT_AVAILABLE);\n\n setIsProcessing(true);\n\n // Try to call mint function (common for test tokens)\n const tx = await usdcContract.mint(recipient, amount);\n await waitForEthersTransactionWithRetry(signer, tx.hash, {\n timeoutMs: 30000,\n pollIntervalMs: 2000,\n });\n\n return tx.hash;\n } catch (error: any) {\n // If mint function doesn't exist or fails, provide helpful error\n const errorMessage = parseEthersError(error);\n if (errorMessage.includes(\"mint\")) {\n throw new Error(\"This USDC contract doesn't support minting\");\n }\n throw new Error(errorMessage);\n } finally {\n setIsProcessing(false);\n }\n }\n\n return {\n // New methods for different forward types\n forwardTokens,\n payProtocolFeeAndMintGCTLAndStake,\n sponsorProtocolFeeAndMintGCTLAndStake,\n sponsorProtocolFee,\n payProtocolFee,\n mintGCTLAndStake,\n mintGCTL,\n buySolarFarm,\n commitKickstarter,\n payAuditFees,\n\n // Token operations\n approveToken,\n checkTokenAllowance,\n checkTokenBalance,\n\n // Utility methods\n estimateGasForForward,\n mintTestUSDC,\n constructForwardMessage,\n\n // State\n get isProcessing() {\n return isProcessing;\n },\n addresses: ADDRESSES,\n\n // Signer availability\n isSignerAvailable: !!signer,\n };\n}\n","export const OFFCHAIN_FRACTIONS_ABI = [\n {\n inputs: [\n {\n internalType: \"contract CounterfactualHolderFactory\",\n name: \"_counterfactualHolderFactory\",\n type: \"address\",\n },\n ],\n stateMutability: \"nonpayable\",\n type: \"constructor\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"target\", type: \"address\" }],\n name: \"AddressEmptyCode\",\n type: \"error\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"account\", type: \"address\" }],\n name: \"AddressInsufficientBalance\",\n type: \"error\",\n },\n { inputs: [], name: \"AlreadyClosed\", type: \"error\" },\n { inputs: [], name: \"AlreadyExists\", type: \"error\" },\n { inputs: [], name: \"CannotClaimRefundWhenNotExpired\", type: \"error\" },\n { inputs: [], name: \"CannotClaimRefundWhenThresholdReached\", type: \"error\" },\n { inputs: [], name: \"CannotCloseWhenThresholdReached\", type: \"error\" },\n { inputs: [], name: \"CannotHaveZeroTotalSteps\", type: \"error\" },\n { inputs: [], name: \"ExpirationMustBeInTheFuture\", type: \"error\" },\n { inputs: [], name: \"Expired\", type: \"error\" },\n { inputs: [], name: \"FailedInnerCall\", type: \"error\" },\n { inputs: [], name: \"InsufficientSharesAvailable\", type: \"error\" },\n { inputs: [], name: \"InvalidToAddress\", type: \"error\" },\n { inputs: [], name: \"InvalidToken\", type: \"error\" },\n { inputs: [], name: \"MinSharesCannotBeGreaterThanTotalSteps\", type: \"error\" },\n {\n inputs: [],\n name: \"MinStepsToBuyCannotBeGreaterThanStepsToBuy\",\n type: \"error\",\n },\n { inputs: [], name: \"MinStepsToBuyCannotBeZero\", type: \"error\" },\n { inputs: [], name: \"NoStepsPurchased\", type: \"error\" },\n { inputs: [], name: \"NotFractionsCloser\", type: \"error\" },\n { inputs: [], name: \"RecipientCannotBeSelf\", type: \"error\" },\n { inputs: [], name: \"ReentrancyGuardReentrantCall\", type: \"error\" },\n { inputs: [], name: \"RefundOperatorNotApproved\", type: \"error\" },\n {\n inputs: [{ internalType: \"address\", name: \"token\", type: \"address\" }],\n name: \"SafeERC20FailedOperation\",\n type: \"error\",\n },\n { inputs: [], name: \"StepMustBeGreaterThanZero\", type: \"error\" },\n { inputs: [], name: \"TaxTokenNotSupported\", type: \"error\" },\n { inputs: [], name: \"TotalRaisedOverflow\", type: \"error\" },\n {\n inputs: [],\n name: \"UseCounterfactualAddressForRefundNotAllowedIfAddressIsZero\",\n type: \"error\",\n },\n { inputs: [], name: \"ZeroSteps\", type: \"error\" },\n {\n anonymous: false,\n inputs: [\n { indexed: true, internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n {\n indexed: true,\n internalType: \"address\",\n name: \"token\",\n type: \"address\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"owner\",\n type: \"address\",\n },\n ],\n name: \"FractionClosed\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n {\n indexed: true,\n internalType: \"address\",\n name: \"token\",\n type: \"address\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"owner\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"step\",\n type: \"uint256\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"totalSteps\",\n type: \"uint256\",\n },\n {\n indexed: false,\n internalType: \"uint48\",\n name: \"expiration\",\n type: \"uint48\",\n },\n { indexed: false, internalType: \"address\", name: \"to\", type: \"address\" },\n {\n indexed: false,\n internalType: \"bool\",\n name: \"useCounterfactualAddress\",\n type: \"bool\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"minSharesToRaise\",\n type: \"uint256\",\n },\n {\n indexed: false,\n internalType: \"address\",\n name: \"closer\",\n type: \"address\",\n },\n ],\n name: \"FractionCreated\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n {\n indexed: true,\n internalType: \"address\",\n name: \"creator\",\n type: \"address\",\n },\n { indexed: true, internalType: \"address\", name: \"user\", type: \"address\" },\n {\n indexed: false,\n internalType: \"address\",\n name: \"refundTo\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"amount\",\n type: \"uint256\",\n },\n ],\n name: \"FractionRefunded\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n {\n indexed: true,\n internalType: \"address\",\n name: \"creator\",\n type: \"address\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"creditTo\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"address\",\n name: \"buyer\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"step\",\n type: \"uint256\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"amount\",\n type: \"uint256\",\n },\n ],\n name: \"FractionSold\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n {\n indexed: true,\n internalType: \"address\",\n name: \"creator\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"minShares\",\n type: \"uint256\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"newTotalSharesSold\",\n type: \"uint256\",\n },\n ],\n name: \"MinSharesReached\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, internalType: \"address\", name: \"user\", type: \"address\" },\n {\n indexed: true,\n internalType: \"address\",\n name: \"refundOperator\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"bool\",\n name: \"isApproved\",\n type: \"bool\",\n },\n ],\n name: \"RefundOperatorStatusSet\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n {\n indexed: true,\n internalType: \"address\",\n name: \"creator\",\n type: \"address\",\n },\n ],\n name: \"RoundFilled\",\n type: \"event\",\n },\n {\n inputs: [],\n name: \"REFUND_WILDCARD_OPERATOR\",\n outputs: [{ internalType: \"address\", name: \"\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"creator\", type: \"address\" },\n { internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n { internalType: \"uint256\", name: \"stepsToBuy\", type: \"uint256\" },\n { internalType: \"uint256\", name: \"minStepsToBuy\", type: \"uint256\" },\n { internalType: \"address\", name: \"refundTo\", type: \"address\" },\n { internalType: \"address\", name: \"creditTo\", type: \"address\" },\n {\n internalType: \"bool\",\n name: \"useCounterfactualAddressForRefund\",\n type: \"bool\",\n },\n ],\n name: \"buyFractions\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"user\", type: \"address\" },\n { internalType: \"address\", name: \"creator\", type: \"address\" },\n { internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n ],\n name: \"claimRefund\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"creator\", type: \"address\" },\n { internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n ],\n name: \"closeFraction\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n { internalType: \"address\", name: \"token\", type: \"address\" },\n { internalType: \"uint256\", name: \"step\", type: \"uint256\" },\n { internalType: \"uint256\", name: \"totalSteps\", type: \"uint256\" },\n { internalType: \"uint48\", name: \"expiration\", type: \"uint48\" },\n { internalType: \"address\", name: \"to\", type: \"address\" },\n { internalType: \"bool\", name: \"useCounterfactualAddress\", type: \"bool\" },\n { internalType: \"uint256\", name: \"minSharesToRaise\", type: \"uint256\" },\n { internalType: \"address\", name: \"closer\", type: \"address\" },\n ],\n name: \"createFraction\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"creator\", type: \"address\" },\n { internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n ],\n name: \"getFraction\",\n outputs: [\n {\n components: [\n { internalType: \"address\", name: \"token\", type: \"address\" },\n { internalType: \"uint48\", name: \"expiration\", type: \"uint48\" },\n { internalType: \"bool\", name: \"manuallyClosed\", type: \"bool\" },\n {\n internalType: \"uint256\",\n name: \"minSharesToRaise\",\n type: \"uint256\",\n },\n {\n internalType: \"bool\",\n name: \"useCounterfactualAddress\",\n type: \"bool\",\n },\n {\n internalType: \"bool\",\n name: \"claimedFromMinSharesToRaise\",\n type: \"bool\",\n },\n { internalType: \"uint256\", name: \"step\", type: \"uint256\" },\n { internalType: \"address\", name: \"to\", type: \"address\" },\n { internalType: \"uint256\", name: \"soldSteps\", type: \"uint256\" },\n { internalType: \"uint256\", name: \"totalSteps\", type: \"uint256\" },\n { internalType: \"address\", name: \"closer\", type: \"address\" },\n ],\n internalType: \"struct OffchainFractions.FractionData\",\n name: \"\",\n type: \"tuple\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"user\", type: \"address\" },\n { internalType: \"address\", name: \"creator\", type: \"address\" },\n { internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n ],\n name: \"getRefundDetails\",\n outputs: [\n {\n components: [\n { internalType: \"address\", name: \"refundTo\", type: \"address\" },\n {\n internalType: \"bool\",\n name: \"useCounterfactualAddress\",\n type: \"bool\",\n },\n ],\n internalType: \"struct OffchainFractions.RefundDetails\",\n name: \"\",\n type: \"tuple\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"i_CFHFactory\",\n outputs: [\n {\n internalType: \"contract CounterfactualHolderFactory\",\n name: \"\",\n type: \"address\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"user\", type: \"address\" },\n { internalType: \"address\", name: \"refundOperator\", type: \"address\" },\n ],\n name: \"isRefundOperatorApproved\",\n outputs: [{ internalType: \"bool\", name: \"\", type: \"bool\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"user\", type: \"address\" },\n { internalType: \"address\", name: \"refundOperator\", type: \"address\" },\n ],\n name: \"refundApprovals\",\n outputs: [{ internalType: \"bool\", name: \"isApproved\", type: \"bool\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"creator\", type: \"address\" },\n { internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n { internalType: \"address\", name: \"refundTo\", type: \"address\" },\n { internalType: \"bool\", name: \"useCounterfactualAddress\", type: \"bool\" },\n ],\n name: \"setRefundDetails\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"refundOperator\", type: \"address\" },\n { internalType: \"bool\", name: \"isApproved\", type: \"bool\" },\n ],\n name: \"setRefundOperatorStatus\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"user\", type: \"address\" },\n { internalType: \"address\", name: \"creator\", type: \"address\" },\n { internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n ],\n name: \"stepsPurchased\",\n outputs: [\n { internalType: \"uint256\", name: \"stepsPurchased\", type: \"uint256\" },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n] as const;\n","import {\n type WalletClient,\n type PublicClient,\n type Address,\n formatEther,\n} from \"viem\";\nimport { OFFCHAIN_FRACTIONS_ABI } from \"../abis/offchainFractions\";\nimport { ERC20_ABI } from \"../abis/erc20.abi\";\nimport { getAddresses } from \"../../constants/addresses\";\nimport {\n parseViemError,\n waitForViemTransactionWithRetry,\n} from \"../../utils/transaction-utils\";\nimport {\n sentryAddBreadcrumb,\n sentryCaptureException,\n} from \"../../utils/sentry\";\n\nexport enum OffchainFractionsError {\n CONTRACT_NOT_AVAILABLE = \"Contract not available\",\n SIGNER_NOT_AVAILABLE = \"Signer not available\",\n UNKNOWN_ERROR = \"Unknown error\",\n INVALID_PARAMETERS = \"Invalid parameters\",\n FRACTION_NOT_FOUND = \"Fraction not found\",\n INSUFFICIENT_BALANCE = \"Insufficient balance\",\n INSUFFICIENT_ALLOWANCE = \"Insufficient allowance\",\n}\n\n// Fraction data structure matching the contract\nexport interface FractionData {\n token: string;\n expiration: number;\n manuallyClosed: boolean;\n minSharesToRaise: bigint;\n useCounterfactualAddress: boolean;\n claimedFromMinSharesToRaise: boolean;\n step: bigint;\n to: string;\n soldSteps: bigint;\n totalSteps: bigint;\n closer: string;\n}\n\n// Parameters for creating a new fraction\nexport interface CreateFractionParams {\n id: string; // bytes32 as hex string\n token: string;\n step: bigint; // Price per step in wei\n totalSteps: bigint;\n expiration: number; // Unix timestamp\n to: string; // Recipient address\n useCounterfactualAddress: boolean;\n minSharesToRaise: bigint; // 0 for no minimum\n closer: string; // Address allowed to manually close the sale\n}\n\n// Parameters for buying fractions\nexport interface BuyFractionsParams {\n creator: string;\n id: string; // bytes32 as hex string\n stepsToBuy: bigint;\n minStepsToBuy: bigint;\n refundTo: string; // Address to receive refunds if needed\n creditTo: string; // Address to credit the purchase to\n useCounterfactualAddressForRefund: boolean; // Whether to use counterfactual address for refunds\n}\n\n// Refund details structure matching the contract\nexport interface RefundDetails {\n refundTo: string;\n useCounterfactualAddress: boolean;\n}\n\n// Type-guard style helper to ensure a wallet client exists throughout the rest of the function.\nfunction assertWalletClient(\n maybeWalletClient: WalletClient | undefined\n): asserts maybeWalletClient is WalletClient {\n if (!maybeWalletClient) {\n throw new Error(OffchainFractionsError.SIGNER_NOT_AVAILABLE);\n }\n if (!maybeWalletClient.account) {\n throw new Error(\"Wallet client must have an account\");\n }\n}\n\nexport function useOffchainFractions(\n walletClient: WalletClient | undefined,\n publicClient: PublicClient | undefined,\n CHAIN_ID: number\n) {\n // Use dynamic addresses based on chain configuration\n const ADDRESSES = getAddresses(CHAIN_ID);\n\n // Framework-agnostic processing flag\n let isProcessing = false;\n const setIsProcessing = (value: boolean) => {\n isProcessing = value;\n };\n\n // Helper to assert public client is available\n function assertPublicClient(\n maybePublicClient: PublicClient | undefined\n ): asserts maybePublicClient is PublicClient {\n if (!maybePublicClient) {\n throw new Error(\"Public client not available\");\n }\n }\n\n /**\n * Check current token allowance for the offchain fractions contract\n * @param owner The wallet address to check allowance for\n * @param tokenAddress The token contract address\n */\n async function checkTokenAllowance(\n owner: string,\n tokenAddress: string\n ): Promise<bigint> {\n assertPublicClient(publicClient);\n\n try {\n const allowance = await publicClient.readContract({\n address: tokenAddress as Address,\n abi: ERC20_ABI,\n functionName: \"allowance\",\n args: [owner as Address, ADDRESSES.OFFCHAIN_FRACTIONS as Address],\n });\n return allowance as bigint;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Check user's token balance\n * @param owner The wallet address to check balance for\n * @param tokenAddress The token contract address\n */\n async function checkTokenBalance(\n owner: string,\n tokenAddress: string\n ): Promise<bigint> {\n assertPublicClient(publicClient);\n\n try {\n const balance = await publicClient.readContract({\n address: tokenAddress as Address,\n abi: ERC20_ABI,\n functionName: \"balanceOf\",\n args: [owner as Address],\n });\n return balance as bigint;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Approve tokens for the offchain fractions contract\n * @param tokenAddress The token contract address\n * @param amount Amount to approve (BigNumber)\n */\n async function approveToken(\n tokenAddress: string,\n amount: bigint\n ): Promise<boolean> {\n assertWalletClient(walletClient);\n assertPublicClient(publicClient);\n\n try {\n setIsProcessing(true);\n\n const hash = await walletClient.writeContract({\n address: tokenAddress as Address,\n abi: ERC20_ABI,\n functionName: \"approve\",\n args: [ADDRESSES.OFFCHAIN_FRACTIONS as Address, amount + 10000000n],\n chain: walletClient.chain,\n account: walletClient.account!,\n });\n\n await waitForViemTransactionWithRetry(publicClient, hash);\n\n return true;\n } catch (error) {\n throw new Error(parseViemError(error));\n } finally {\n setIsProcessing(false);\n }\n }\n\n /**\n * Create a new fractional token sale\n * @param params Parameters for creating the fraction\n */\n async function createFraction(params: CreateFractionParams): Promise<string> {\n assertWalletClient(walletClient);\n assertPublicClient(publicClient);\n\n try {\n setIsProcessing(true);\n\n sentryAddBreadcrumb({\n category: \"offchain-fractions\",\n message: \"createFraction.start\",\n level: \"info\",\n data: {\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n id: params.id,\n token: params.token,\n step: params.step.toString(),\n totalSteps: params.totalSteps.toString(),\n to: params.to,\n expiration: params.expiration,\n minSharesToRaise: params.minSharesToRaise.toString(),\n closer: params.closer,\n },\n });\n\n const {\n id,\n token,\n step,\n totalSteps,\n expiration,\n to,\n useCounterfactualAddress,\n minSharesToRaise,\n closer,\n } = params;\n\n // Validate parameters\n if (!id || !token || !to) {\n throw new Error(OffchainFractionsError.INVALID_PARAMETERS);\n }\n\n if (step === 0n || totalSteps === 0n) {\n throw new Error(\"Step and totalSteps must be greater than zero\");\n }\n\n if (minSharesToRaise > totalSteps) {\n throw new Error(\"minSharesToRaise cannot be greater than totalSteps\");\n }\n\n // Run a simulation first to surface any revert reason\n try {\n await publicClient.simulateContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"createFraction\",\n args: [\n id as `0x${string}`,\n token as Address,\n step,\n totalSteps,\n expiration,\n to as Address,\n useCounterfactualAddress,\n minSharesToRaise,\n closer as Address,\n ],\n account: walletClient.account!,\n });\n } catch (simulationError) {\n sentryCaptureException(simulationError, {\n action: \"createFraction.simulate\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n id: params.id,\n });\n throw new Error(parseViemError(simulationError));\n }\n\n // Execute the transaction\n const hash = await walletClient.writeContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"createFraction\",\n args: [\n id as `0x${string}`,\n token as Address,\n step,\n totalSteps,\n expiration,\n to as Address,\n useCounterfactualAddress,\n minSharesToRaise,\n closer as Address,\n ],\n chain: walletClient.chain,\n account: walletClient.account!,\n });\n\n await waitForViemTransactionWithRetry(publicClient, hash);\n\n return hash;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"createFraction\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n id: params.id,\n token: params.token,\n });\n throw new Error(parseViemError(error));\n } finally {\n setIsProcessing(false);\n }\n }\n\n /**\n * Buy fractions in an existing sale\n * @param params Parameters for buying fractions\n */\n async function buyFractions(params: BuyFractionsParams): Promise<string> {\n assertWalletClient(walletClient);\n assertPublicClient(publicClient);\n\n try {\n setIsProcessing(true);\n\n sentryAddBreadcrumb({\n category: \"offchain-fractions\",\n message: \"buyFractions.start\",\n level: \"info\",\n data: {\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n creator: params.creator,\n id: params.id,\n stepsToBuy: params.stepsToBuy.toString(),\n minStepsToBuy: params.minStepsToBuy.toString(),\n refundTo: params.refundTo,\n creditTo: params.creditTo,\n useCounterfactualAddressForRefund:\n params.useCounterfactualAddressForRefund,\n },\n });\n\n const {\n creator,\n id,\n stepsToBuy,\n minStepsToBuy,\n refundTo,\n creditTo,\n useCounterfactualAddressForRefund,\n } = params;\n\n // Validate parameters\n if (!creator || !id || !refundTo || !creditTo) {\n throw new Error(OffchainFractionsError.INVALID_PARAMETERS);\n }\n\n if (stepsToBuy === 0n) {\n throw new Error(\"stepsToBuy must be greater than zero\");\n }\n\n if (minStepsToBuy === 0n) {\n throw new Error(\"minStepsToBuy must be greater than zero\");\n }\n\n // Get fraction data to calculate required amount\n const fractionData = await getFraction(creator, id);\n const requiredAmount = stepsToBuy * fractionData.step;\n\n const owner = walletClient.account?.address;\n if (!owner) {\n throw new Error(\"No account found in wallet client\");\n }\n\n // Check token balance\n const balance = await checkTokenBalance(owner, fractionData.token);\n if (balance < requiredAmount) {\n throw new Error(OffchainFractionsError.INSUFFICIENT_BALANCE);\n }\n\n // Check and approve tokens if necessary\n const allowance = await checkTokenAllowance(owner, fractionData.token);\n if (allowance < requiredAmount) {\n const approveHash = await walletClient.writeContract({\n address: fractionData.token as Address,\n abi: ERC20_ABI,\n functionName: \"approve\",\n args: [\n ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n requiredAmount + 10000000n,\n ],\n chain: walletClient.chain,\n account: walletClient.account!,\n });\n await waitForViemTransactionWithRetry(publicClient, approveHash);\n }\n\n // Run a simulation first to surface any revert reason\n try {\n await publicClient.simulateContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"buyFractions\",\n args: [\n creator as Address,\n id as `0x${string}`,\n stepsToBuy,\n minStepsToBuy,\n refundTo as Address,\n creditTo as Address,\n useCounterfactualAddressForRefund,\n ],\n account: walletClient.account!,\n });\n } catch (simulationError) {\n sentryCaptureException(simulationError, {\n action: \"buyFractions.simulate\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n creator: params.creator,\n id: params.id,\n });\n throw new Error(parseViemError(simulationError));\n }\n\n // Execute the transaction\n const hash = await walletClient.writeContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"buyFractions\",\n args: [\n creator as Address,\n id as `0x${string}`,\n stepsToBuy,\n minStepsToBuy,\n refundTo as Address,\n creditTo as Address,\n useCounterfactualAddressForRefund,\n ],\n chain: walletClient.chain,\n account: walletClient.account!,\n });\n\n await waitForViemTransactionWithRetry(publicClient, hash);\n\n return hash;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"buyFractions\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n creator: params.creator,\n refundTo: params.refundTo,\n creditTo: params.creditTo,\n useCounterfactualAddressForRefund:\n params.useCounterfactualAddressForRefund,\n id: params.id,\n stepsToBuy: params.stepsToBuy.toString(),\n minStepsToBuy: params.minStepsToBuy.toString(),\n });\n throw new Error(parseViemError(error));\n } finally {\n setIsProcessing(false);\n }\n }\n\n /**\n * Claim refund from an unfilled sale\n * @param user The user address claiming the refund\n * @param creator The address that created the fraction sale\n * @param id The unique identifier of the fraction sale\n */\n async function claimRefund(\n user: string,\n creator: string,\n id: string\n ): Promise<string> {\n assertWalletClient(walletClient);\n assertPublicClient(publicClient);\n\n try {\n setIsProcessing(true);\n\n sentryAddBreadcrumb({\n category: \"offchain-fractions\",\n message: \"claimRefund.start\",\n level: \"info\",\n data: {\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n user,\n creator,\n id,\n },\n });\n\n // Normalize addresses to lowercase for consistency\n const normalizedUser = user?.toLowerCase();\n const normalizedCreator = creator?.toLowerCase();\n\n // Debug logging\n console.log(\"claimRefund parameters:\", {\n user,\n creator,\n id,\n normalizedUser,\n normalizedCreator,\n userType: typeof user,\n creatorType: typeof creator,\n idType: typeof id,\n });\n\n // Validate parameters\n if (!normalizedUser || !normalizedCreator || !id) {\n throw new Error(OffchainFractionsError.INVALID_PARAMETERS);\n }\n\n const owner = walletClient.account?.address;\n if (!owner) {\n throw new Error(\"No account found in wallet client\");\n }\n\n // Check if user has steps purchased\n const userSteps = await getStepsPurchased(user, creator, id);\n if (userSteps === 0n) {\n throw new Error(\"No steps purchased for this fraction\");\n }\n\n // Run a simulation first to surface any revert reason\n try {\n console.log(\"Calling claimRefund simulation with:\", {\n user,\n creator,\n id,\n from: owner,\n contractMethod: \"claimRefund\",\n });\n\n await publicClient.simulateContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"claimRefund\",\n args: [user as Address, creator as Address, id as `0x${string}`],\n account: walletClient.account!,\n });\n } catch (simulationError) {\n sentryCaptureException(simulationError, {\n action: \"claimRefund.simulate\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n user,\n creator,\n id,\n });\n throw new Error(parseViemError(simulationError));\n }\n\n // Execute the transaction\n const hash = await walletClient.writeContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"claimRefund\",\n args: [user as Address, creator as Address, id as `0x${string}`],\n chain: walletClient.chain,\n account: walletClient.account!,\n });\n\n await waitForViemTransactionWithRetry(publicClient, hash);\n\n return hash;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"claimRefund\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n user,\n creator,\n id,\n });\n throw new Error(parseViemError(error));\n } finally {\n setIsProcessing(false);\n }\n }\n\n /**\n * Close a fraction sale manually (only by closer)\n * @param creator The address that created the fraction sale\n * @param id The unique identifier of the fraction sale to close\n */\n async function closeFraction(creator: string, id: string): Promise<string> {\n assertWalletClient(walletClient);\n assertPublicClient(publicClient);\n\n try {\n setIsProcessing(true);\n\n sentryAddBreadcrumb({\n category: \"offchain-fractions\",\n message: \"closeFraction.start\",\n level: \"info\",\n data: {\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n creator,\n id,\n },\n });\n\n // Validate parameters\n if (!creator || !id) {\n throw new Error(OffchainFractionsError.INVALID_PARAMETERS);\n }\n\n const owner = walletClient.account?.address;\n if (!owner) {\n throw new Error(\"No account found in wallet client\");\n }\n\n // Run a simulation first to surface any revert reason\n try {\n await publicClient.simulateContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"closeFraction\",\n args: [creator as Address, id as `0x${string}`],\n account: walletClient.account!,\n });\n } catch (simulationError) {\n sentryCaptureException(simulationError, {\n action: \"closeFraction.simulate\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n creator,\n id,\n });\n throw new Error(parseViemError(simulationError));\n }\n\n // Execute the transaction\n const hash = await walletClient.writeContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"closeFraction\",\n args: [creator as Address, id as `0x${string}`],\n chain: walletClient.chain,\n account: walletClient.account!,\n });\n\n await waitForViemTransactionWithRetry(publicClient, hash);\n\n return hash;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"closeFraction\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n creator,\n id,\n });\n throw new Error(parseViemError(error));\n } finally {\n setIsProcessing(false);\n }\n }\n\n /**\n * Get fraction data for a specific creator and ID\n * @param creator The address that created the fraction sale\n * @param id The unique identifier of the fraction sale\n */\n async function getFraction(\n creator: string,\n id: string\n ): Promise<FractionData> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"getFraction\",\n args: [creator as Address, id as `0x${string}`],\n })) as any;\n\n return {\n token: result.token,\n expiration: Number(result.expiration),\n manuallyClosed: result.manuallyClosed,\n minSharesToRaise: result.minSharesToRaise,\n useCounterfactualAddress: result.useCounterfactualAddress,\n claimedFromMinSharesToRaise: result.claimedFromMinSharesToRaise,\n step: result.step,\n to: result.to,\n soldSteps: result.soldSteps,\n totalSteps: result.totalSteps,\n closer: result.closer,\n };\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Get the number of steps purchased by a user for a specific fraction\n * @param user The user address\n * @param creator The address that created the fraction sale\n * @param id The unique identifier of the fraction sale\n */\n async function getStepsPurchased(\n user: string,\n creator: string,\n id: string\n ): Promise<bigint> {\n assertPublicClient(publicClient);\n\n try {\n // Debug logging\n console.log(\"getStepsPurchased parameters:\", {\n user,\n creator,\n id,\n contractAddress: ADDRESSES.OFFCHAIN_FRACTIONS,\n });\n\n const result = (await publicClient.readContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"stepsPurchased\",\n args: [user as Address, creator as Address, id as `0x${string}`],\n })) as bigint;\n\n console.log(\"getStepsPurchased result:\", result.toString());\n return result;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Get the refund wildcard operator address\n * @returns The wildcard operator address that can perform refunds for any user\n */\n async function getRefundWildcardOperator(): Promise<string> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"REFUND_WILDCARD_OPERATOR\",\n args: [],\n })) as string;\n return result;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Get refund details for a user's purchase\n * @param user The user address\n * @param creator The address that created the fraction sale\n * @param id The unique identifier of the fraction sale\n */\n async function getRefundDetails(\n user: string,\n creator: string,\n id: string\n ): Promise<RefundDetails> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"getRefundDetails\",\n args: [user as Address, creator as Address, id as `0x${string}`],\n })) as any;\n return {\n refundTo: result.refundTo,\n useCounterfactualAddress: result.useCounterfactualAddress,\n };\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Set refund details for a user's purchase\n * @param creator The address that created the fraction sale\n * @param id The unique identifier of the fraction sale\n * @param refundTo The address to receive refunds\n * @param useCounterfactualAddress Whether to use counterfactual address for refunds\n */\n async function setRefundDetails(\n creator: string,\n id: string,\n refundTo: string,\n useCounterfactualAddress: boolean\n ): Promise<string> {\n assertWalletClient(walletClient);\n assertPublicClient(publicClient);\n\n try {\n setIsProcessing(true);\n\n sentryAddBreadcrumb({\n category: \"offchain-fractions\",\n message: \"setRefundDetails.start\",\n level: \"info\",\n data: {\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n creator,\n id,\n refundTo,\n useCounterfactualAddress,\n },\n });\n\n // Validate parameters\n if (!creator || !id || !refundTo) {\n throw new Error(OffchainFractionsError.INVALID_PARAMETERS);\n }\n\n const owner = walletClient.account?.address;\n if (!owner) {\n throw new Error(\"No account found in wallet client\");\n }\n\n // Run a simulation first to surface any revert reason\n try {\n await publicClient.simulateContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"setRefundDetails\",\n args: [\n creator as Address,\n id as `0x${string}`,\n refundTo as Address,\n useCounterfactualAddress,\n ],\n account: walletClient.account!,\n });\n } catch (simulationError) {\n sentryCaptureException(simulationError, {\n action: \"setRefundDetails.simulate\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n creator,\n id,\n });\n throw new Error(parseViemError(simulationError));\n }\n\n // Execute the transaction\n const hash = await walletClient.writeContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"setRefundDetails\",\n args: [\n creator as Address,\n id as `0x${string}`,\n refundTo as Address,\n useCounterfactualAddress,\n ],\n chain: walletClient.chain,\n account: walletClient.account!,\n });\n\n await waitForViemTransactionWithRetry(publicClient, hash);\n\n return hash;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"setRefundDetails\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n creator,\n id,\n refundTo,\n });\n throw new Error(parseViemError(error));\n } finally {\n setIsProcessing(false);\n }\n }\n\n /**\n * Set refund operator approval status\n * @param refundOperator The address of the refund operator\n * @param isApproved Whether to approve or revoke the operator\n */\n async function setRefundOperatorStatus(\n refundOperator: string,\n isApproved: boolean\n ): Promise<string> {\n assertWalletClient(walletClient);\n assertPublicClient(publicClient);\n\n try {\n setIsProcessing(true);\n\n sentryAddBreadcrumb({\n category: \"offchain-fractions\",\n message: \"setRefundOperatorStatus.start\",\n level: \"info\",\n data: {\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n refundOperator,\n isApproved,\n },\n });\n\n // Validate parameters\n if (!refundOperator) {\n throw new Error(OffchainFractionsError.INVALID_PARAMETERS);\n }\n\n const owner = walletClient.account?.address;\n if (!owner) {\n throw new Error(\"No account found in wallet client\");\n }\n\n // Run a simulation first to surface any revert reason\n try {\n await publicClient.simulateContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"setRefundOperatorStatus\",\n args: [refundOperator as Address, isApproved],\n account: walletClient.account!,\n });\n } catch (simulationError) {\n sentryCaptureException(simulationError, {\n action: \"setRefundOperatorStatus.simulate\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n refundOperator,\n isApproved,\n });\n throw new Error(parseViemError(simulationError));\n }\n\n // Execute the transaction\n const hash = await walletClient.writeContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"setRefundOperatorStatus\",\n args: [refundOperator as Address, isApproved],\n chain: walletClient.chain,\n account: walletClient.account!,\n });\n\n await waitForViemTransactionWithRetry(publicClient, hash);\n\n return hash;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"setRefundOperatorStatus\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n refundOperator,\n isApproved,\n });\n throw new Error(parseViemError(error));\n } finally {\n setIsProcessing(false);\n }\n }\n\n /**\n * Check if a refund operator is approved for a user\n * @param user The user address\n * @param refundOperator The refund operator address\n */\n async function isRefundOperatorApproved(\n user: string,\n refundOperator: string\n ): Promise<boolean> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"isRefundOperatorApproved\",\n args: [user as Address, refundOperator as Address],\n })) as boolean;\n return result;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Get refund approval status for a user and operator\n * @param user The user address\n * @param refundOperator The refund operator address\n */\n async function getRefundApprovalStatus(\n user: string,\n refundOperator: string\n ): Promise<boolean> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"refundApprovals\",\n args: [user as Address, refundOperator as Address],\n })) as any;\n return result.isApproved;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Check if a fraction sale is expired\n * @param creator The address that created the fraction sale\n * @param id The unique identifier of the fraction sale\n */\n async function isFractionExpired(\n creator: string,\n id: string\n ): Promise<boolean> {\n try {\n const fraction = await getFraction(creator, id);\n return Date.now() / 1000 > fraction.expiration;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Check if a fraction sale has reached its minimum shares threshold\n * @param creator The address that created the fraction sale\n * @param id The unique identifier of the fraction sale\n */\n async function hasReachedMinimumShares(\n creator: string,\n id: string\n ): Promise<boolean> {\n try {\n const fraction = await getFraction(creator, id);\n return fraction.soldSteps >= fraction.minSharesToRaise;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Check if a fraction sale is completely filled\n * @param creator The address that created the fraction sale\n * @param id The unique identifier of the fraction sale\n */\n async function isFractionCompletelyFilled(\n creator: string,\n id: string\n ): Promise<boolean> {\n try {\n const fraction = await getFraction(creator, id);\n return fraction.soldSteps >= fraction.totalSteps;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Calculate the total amount raised for a fraction\n * @param creator The address that created the fraction sale\n * @param id The unique identifier of the fraction sale\n */\n async function getTotalAmountRaised(\n creator: string,\n id: string\n ): Promise<bigint> {\n try {\n const fraction = await getFraction(creator, id);\n return fraction.soldSteps * fraction.step;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Calculate the remaining steps available for purchase\n * @param creator The address that created the fraction sale\n * @param id The unique identifier of the fraction sale\n */\n async function getRemainingSteps(\n creator: string,\n id: string\n ): Promise<bigint> {\n try {\n const fraction = await getFraction(creator, id);\n return fraction.totalSteps - fraction.soldSteps;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Estimate gas for creating a fraction\n * @param params Parameters for creating the fraction\n * @param ethPriceInUSD Current ETH price in USD (for cost estimation)\n */\n async function estimateGasForCreateFraction(\n params: CreateFractionParams,\n ethPriceInUSD: number | null\n ): Promise<string> {\n assertWalletClient(walletClient);\n assertPublicClient(publicClient);\n\n try {\n const {\n id,\n token,\n step,\n totalSteps,\n expiration,\n to,\n useCounterfactualAddress,\n minSharesToRaise,\n closer,\n } = params;\n\n const gasPrice = await publicClient.getGasPrice();\n if (!gasPrice) {\n throw new Error(\"Could not fetch gas price to estimate cost.\");\n }\n\n const estimatedGas = await publicClient.estimateContractGas({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"createFraction\",\n args: [\n id as `0x${string}`,\n token as Address,\n step,\n totalSteps,\n expiration,\n to as Address,\n useCounterfactualAddress,\n minSharesToRaise,\n closer as Address,\n ],\n account: walletClient.account!,\n });\n\n const estimatedCost: bigint = estimatedGas * gasPrice;\n\n if (ethPriceInUSD) {\n const estimatedCostInEth = formatEther(estimatedCost);\n const estimatedCostInUSD = (\n parseFloat(estimatedCostInEth) * ethPriceInUSD\n ).toFixed(2);\n return estimatedCostInUSD;\n } else {\n throw new Error(\n \"Could not fetch the ETH price to calculate cost in USD.\"\n );\n }\n } catch (error: any) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Estimate gas for buying fractions\n * @param params Parameters for buying fractions\n * @param ethPriceInUSD Current ETH price in USD (for cost estimation)\n */\n async function estimateGasForBuyFractions(\n params: BuyFractionsParams,\n ethPriceInUSD: number | null\n ): Promise<string> {\n assertWalletClient(walletClient);\n assertPublicClient(publicClient);\n\n try {\n const {\n creator,\n id,\n stepsToBuy,\n minStepsToBuy,\n refundTo,\n creditTo,\n useCounterfactualAddressForRefund,\n } = params;\n\n const gasPrice = await publicClient.getGasPrice();\n if (!gasPrice) {\n throw new Error(\"Could not fetch gas price to estimate cost.\");\n }\n\n const estimatedGas = await publicClient.estimateContractGas({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"buyFractions\",\n args: [\n creator as Address,\n id as `0x${string}`,\n stepsToBuy,\n minStepsToBuy,\n refundTo as Address,\n creditTo as Address,\n useCounterfactualAddressForRefund,\n ],\n account: walletClient.account!,\n });\n\n const estimatedCost: bigint = estimatedGas * gasPrice;\n\n if (ethPriceInUSD) {\n const estimatedCostInEth = formatEther(estimatedCost);\n const estimatedCostInUSD = (\n parseFloat(estimatedCostInEth) * ethPriceInUSD\n ).toFixed(2);\n return estimatedCostInUSD;\n } else {\n throw new Error(\n \"Could not fetch the ETH price to calculate cost in USD.\"\n );\n }\n } catch (error: any) {\n throw new Error(parseViemError(error));\n }\n }\n\n return {\n // Core contract functions\n createFraction,\n buyFractions,\n claimRefund,\n closeFraction,\n\n // View functions\n getFraction,\n getStepsPurchased,\n\n // Refund management functions\n getRefundWildcardOperator,\n getRefundDetails,\n setRefundDetails,\n setRefundOperatorStatus,\n isRefundOperatorApproved,\n getRefundApprovalStatus,\n\n // Token operations\n approveToken,\n checkTokenAllowance,\n checkTokenBalance,\n\n // Utility functions\n isFractionExpired,\n hasReachedMinimumShares,\n isFractionCompletelyFilled,\n getTotalAmountRaised,\n getRemainingSteps,\n\n // Gas estimation\n estimateGasForCreateFraction,\n estimateGasForBuyFractions,\n\n // State\n get isProcessing() {\n return isProcessing;\n },\n addresses: ADDRESSES,\n\n // Wallet client availability\n isSignerAvailable: !!walletClient,\n };\n}\n","export const REWARDS_KERNEL_ABI = [\n {\n inputs: [\n { internalType: \"address\", name: \"_foundationMultisig\", type: \"address\" },\n { internalType: \"address\", name: \"_rejectionMultisig\", type: \"address\" },\n {\n internalType: \"contract CounterfactualHolderFactory\",\n name: \"f\",\n type: \"address\",\n },\n { internalType: \"uint256\", name: \"_finality\", type: \"uint256\" },\n ],\n stateMutability: \"payable\",\n type: \"constructor\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"target\", type: \"address\" }],\n name: \"AddressEmptyCode\",\n type: \"error\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"account\", type: \"address\" }],\n name: \"AddressInsufficientBalance\",\n type: \"error\",\n },\n { inputs: [], name: \"AlreadyClaimedNonce\", type: \"error\" },\n { inputs: [], name: \"AlreadyFinalized\", type: \"error\" },\n { inputs: [], name: \"AlreadyRejected\", type: \"error\" },\n { inputs: [], name: \"CannotClaimFromRejectedNonce\", type: \"error\" },\n { inputs: [], name: \"CannotPostZeroRoot\", type: \"error\" },\n { inputs: [], name: \"DuplicateToken\", type: \"error\" },\n { inputs: [], name: \"FailedInnerCall\", type: \"error\" },\n { inputs: [], name: \"InvalidMerkleProof\", type: \"error\" },\n { inputs: [], name: \"LengthsDontMatch\", type: \"error\" },\n { inputs: [], name: \"MaxClaimedExceeded\", type: \"error\" },\n { inputs: [], name: \"NonexistentDataAtNonce\", type: \"error\" },\n { inputs: [], name: \"NotFoundationMultisig\", type: \"error\" },\n { inputs: [], name: \"NotRejectionMultisig\", type: \"error\" },\n { inputs: [], name: \"NotYetFinalized\", type: \"error\" },\n { inputs: [], name: \"ReentrancyGuardReentrantCall\", type: \"error\" },\n {\n inputs: [{ internalType: \"address\", name: \"token\", type: \"address\" }],\n name: \"SafeERC20FailedOperation\",\n type: \"error\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"uint256\",\n name: \"nonce\",\n type: \"uint256\",\n },\n ],\n name: \"NonceRejected\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, internalType: \"address\", name: \"user\", type: \"address\" },\n { indexed: true, internalType: \"address\", name: \"to\", type: \"address\" },\n {\n indexed: true,\n internalType: \"uint256\",\n name: \"nonce\",\n type: \"uint256\",\n },\n {\n indexed: false,\n internalType: \"address\",\n name: \"from\",\n type: \"address\",\n },\n {\n components: [\n { internalType: \"address\", name: \"token\", type: \"address\" },\n { internalType: \"uint256\", name: \"amount\", type: \"uint256\" },\n ],\n indexed: false,\n internalType: \"struct FoundationRewardKernel.TokenAndAmount[]\",\n name: \"taa\",\n type: \"tuple[]\",\n },\n {\n indexed: false,\n internalType: \"bool[]\",\n name: \"isGuarded\",\n type: \"bool[]\",\n },\n ],\n name: \"RewardClaimed\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"uint256\",\n name: \"nonce\",\n type: \"uint256\",\n },\n { indexed: true, internalType: \"bytes32\", name: \"root\", type: \"bytes32\" },\n {\n components: [\n { internalType: \"address\", name: \"token\", type: \"address\" },\n { internalType: \"uint256\", name: \"amount\", type: \"uint256\" },\n ],\n indexed: false,\n internalType: \"struct FoundationRewardKernel.TokenAndAmount[]\",\n name: \"taa\",\n type: \"tuple[]\",\n },\n ],\n name: \"RootPosted\",\n type: \"event\",\n },\n {\n inputs: [],\n name: \"$nextPostNonce\",\n outputs: [{ internalType: \"uint256\", name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"CFH_FACTORY\",\n outputs: [\n {\n internalType: \"contract CounterfactualHolderFactory\",\n name: \"\",\n type: \"address\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"FINALITY\",\n outputs: [{ internalType: \"uint256\", name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"FOUNDATION_MULTISIG\",\n outputs: [{ internalType: \"address\", name: \"\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"REJECTION_MULTISIG\",\n outputs: [{ internalType: \"address\", name: \"\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"uint256\", name: \"nonce\", type: \"uint256\" },\n { internalType: \"bytes32[]\", name: \"proof\", type: \"bytes32[]\" },\n {\n components: [\n { internalType: \"address\", name: \"token\", type: \"address\" },\n { internalType: \"uint256\", name: \"amount\", type: \"uint256\" },\n ],\n internalType: \"struct FoundationRewardKernel.TokenAndAmount[]\",\n name: \"taa\",\n type: \"tuple[]\",\n },\n { internalType: \"address\", name: \"from\", type: \"address\" },\n { internalType: \"address\", name: \"to\", type: \"address\" },\n { internalType: \"bool[]\", name: \"isGuardedToken\", type: \"bool[]\" },\n { internalType: \"bool[]\", name: \"toCounterfactual\", type: \"bool[]\" },\n ],\n name: \"claimPayout\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"uint256\", name: \"nonce\", type: \"uint256\" },\n { internalType: \"address\", name: \"token\", type: \"address\" },\n ],\n name: \"getAmountClaimed\",\n outputs: [{ internalType: \"uint256\", name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"uint256\", name: \"nonce\", type: \"uint256\" },\n { internalType: \"address\", name: \"token\", type: \"address\" },\n ],\n name: \"getMaxReward\",\n outputs: [{ internalType: \"uint256\", name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"uint256\", name: \"nonce\", type: \"uint256\" }],\n name: \"getRewardMeta\",\n outputs: [\n { internalType: \"bytes32\", name: \"merkleRoot\", type: \"bytes32\" },\n { internalType: \"uint48\", name: \"pushTimestamp\", type: \"uint48\" },\n { internalType: \"bool\", name: \"rejected\", type: \"bool\" },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"user\", type: \"address\" },\n { internalType: \"uint256\", name: \"nonce\", type: \"uint256\" },\n ],\n name: \"isClaimed\",\n outputs: [{ internalType: \"bool\", name: \"\", type: \"bool\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"uint256\", name: \"nonce\", type: \"uint256\" }],\n name: \"isFinalized\",\n outputs: [{ internalType: \"bool\", name: \"\", type: \"bool\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"bytes[]\", name: \"data\", type: \"bytes[]\" }],\n name: \"multicall\",\n outputs: [{ internalType: \"bytes[]\", name: \"results\", type: \"bytes[]\" }],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"bytes32\", name: \"root\", type: \"bytes32\" },\n {\n components: [\n { internalType: \"address\", name: \"token\", type: \"address\" },\n { internalType: \"uint256\", name: \"amount\", type: \"uint256\" },\n ],\n internalType: \"struct FoundationRewardKernel.TokenAndAmount[]\",\n name: \"taa\",\n type: \"tuple[]\",\n },\n ],\n name: \"postPayoutRoot\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"uint256\", name: \"nonce\", type: \"uint256\" }],\n name: \"rejectNonce\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n] as const;\n","import {\n type WalletClient,\n type PublicClient,\n type Address,\n formatEther,\n} from \"viem\";\nimport { REWARDS_KERNEL_ABI } from \"../abis/rewardKernelABI\";\nimport { getAddresses } from \"../../constants/addresses\";\nimport {\n parseViemError,\n waitForViemTransactionWithRetry,\n} from \"../../utils/transaction-utils\";\nimport {\n sentryAddBreadcrumb,\n sentryCaptureException,\n} from \"../../utils/sentry\";\n\nexport enum RewardsKernelError {\n CONTRACT_NOT_AVAILABLE = \"Contract not available\",\n SIGNER_NOT_AVAILABLE = \"Signer not available\",\n UNKNOWN_ERROR = \"Unknown error\",\n INVALID_PARAMETERS = \"Invalid parameters\",\n ALREADY_CLAIMED = \"Already claimed from this nonce\",\n NOT_FINALIZED = \"Nonce not yet finalized\",\n NONCE_REJECTED = \"Cannot claim from rejected nonce\",\n}\n\n// Token and amount structure matching the contract\nexport interface TokenAndAmount {\n token: `0x${string}`;\n amount: bigint;\n}\n\n// Reward metadata structure\nexport interface RewardMeta {\n merkleRoot: string;\n pushTimestamp: number;\n rejected: boolean;\n}\n\n// Parameters for claiming a payout\nexport interface ClaimPayoutParams {\n nonce: bigint;\n proof: `0x${string}`[]; // bytes32[] as hex strings\n tokensAndAmounts: TokenAndAmount[];\n from: `0x${string}`; // Address providing the tokens\n to: `0x${string}`; // Address receiving the tokens\n isGuardedToken: boolean[]; // Which tokens are guarded\n toCounterfactual: boolean[]; // Whether to send to counterfactual wallet\n}\n\n// Type-guard style helper to ensure a wallet client exists\nfunction assertWalletClient(\n maybeWalletClient: WalletClient | undefined\n): asserts maybeWalletClient is WalletClient {\n if (!maybeWalletClient) {\n throw new Error(RewardsKernelError.SIGNER_NOT_AVAILABLE);\n }\n if (!maybeWalletClient.account) {\n throw new Error(\"Wallet client must have an account\");\n }\n}\n\nexport function useRewardsKernel(\n walletClient: WalletClient | undefined,\n publicClient: PublicClient | undefined,\n CHAIN_ID: number\n) {\n // Use dynamic addresses based on chain configuration\n const ADDRESSES = getAddresses(CHAIN_ID);\n\n // Framework-agnostic processing flag\n let isProcessing = false;\n const setIsProcessing = (value: boolean) => {\n isProcessing = value;\n };\n\n // Helper to assert public client is available\n function assertPublicClient(\n maybePublicClient: PublicClient | undefined\n ): asserts maybePublicClient is PublicClient {\n if (!maybePublicClient) {\n throw new Error(\"Public client not available\");\n }\n }\n\n /**\n * Claim payout from a finalized nonce\n * @param params Parameters for claiming the payout\n */\n async function claimPayout(params: ClaimPayoutParams): Promise<string> {\n assertWalletClient(walletClient);\n assertPublicClient(publicClient);\n\n try {\n setIsProcessing(true);\n\n sentryAddBreadcrumb({\n category: \"rewards-kernel\",\n message: \"claimPayout.start\",\n level: \"info\",\n data: {\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.REWARDS_KERNEL,\n nonce: params.nonce.toString(),\n to: params.to,\n from: params.from,\n tokensCount: params.tokensAndAmounts.length,\n },\n });\n\n const {\n nonce,\n proof,\n tokensAndAmounts,\n from,\n to,\n isGuardedToken,\n toCounterfactual,\n } = params;\n\n // Validate parameters\n if (!proof || proof.length === 0) {\n throw new Error(\"Merkle proof is required\");\n }\n\n if (!tokensAndAmounts || tokensAndAmounts.length === 0) {\n throw new Error(\"Tokens and amounts are required\");\n }\n\n if (isGuardedToken.length !== tokensAndAmounts.length) {\n throw new Error(\n \"isGuardedToken array length must match tokensAndAmounts\"\n );\n }\n\n if (toCounterfactual.length !== tokensAndAmounts.length) {\n throw new Error(\n \"toCounterfactual array length must match tokensAndAmounts\"\n );\n }\n\n if (!from || !to) {\n throw new Error(RewardsKernelError.INVALID_PARAMETERS);\n }\n\n // Check if already claimed\n const owner = walletClient.account?.address;\n if (!owner) {\n throw new Error(\"No account found in wallet client\");\n }\n\n const alreadyClaimed = await isClaimed(owner, nonce);\n if (alreadyClaimed) {\n throw new Error(RewardsKernelError.ALREADY_CLAIMED);\n }\n\n // Check if finalized\n const finalized = await isFinalized(nonce);\n if (!finalized) {\n throw new Error(RewardsKernelError.NOT_FINALIZED);\n }\n\n // Run a simulation first to surface any revert reason\n try {\n console.log(\"Simulating claimPayout with:\", {\n nonce: nonce.toString(),\n proof: proof,\n tokensAndAmounts: tokensAndAmounts,\n from: from,\n to: to,\n isGuardedToken: isGuardedToken,\n toCounterfactual: toCounterfactual,\n });\n await publicClient.simulateContract({\n address: ADDRESSES.REWARDS_KERNEL as Address,\n abi: REWARDS_KERNEL_ABI,\n functionName: \"claimPayout\",\n args: [\n nonce,\n proof as `0x${string}`[],\n tokensAndAmounts as readonly {\n token: `0x${string}`;\n amount: bigint;\n }[],\n from as Address,\n to as Address,\n isGuardedToken,\n toCounterfactual,\n ],\n account: walletClient.account!,\n });\n } catch (simulationError) {\n sentryCaptureException(simulationError, {\n action: \"claimPayout.simulate\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.REWARDS_KERNEL,\n nonce: nonce.toString(),\n tokensAndAmounts: tokensAndAmounts,\n proof: proof,\n from: from,\n to: to,\n isGuardedToken: isGuardedToken,\n toCounterfactual: toCounterfactual,\n });\n throw new Error(parseViemError(simulationError));\n }\n\n console.log(\"Executing claimPayout with:\", {\n nonce: nonce.toString(),\n proof: proof,\n tokensAndAmounts: tokensAndAmounts,\n from: from,\n to: to,\n isGuardedToken: isGuardedToken,\n toCounterfactual: toCounterfactual,\n });\n // Execute the transaction\n const hash = await walletClient.writeContract({\n address: ADDRESSES.REWARDS_KERNEL as Address,\n abi: REWARDS_KERNEL_ABI,\n functionName: \"claimPayout\",\n args: [\n nonce,\n proof as `0x${string}`[],\n tokensAndAmounts as readonly {\n token: `0x${string}`;\n amount: bigint;\n }[],\n from as Address,\n to as Address,\n isGuardedToken,\n toCounterfactual,\n ],\n chain: walletClient.chain,\n account: walletClient.account!,\n });\n\n await waitForViemTransactionWithRetry(publicClient, hash);\n\n return hash;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"claimPayout\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.REWARDS_KERNEL,\n nonce: params.nonce.toString(),\n from: params.from,\n proof: params.proof,\n tokensAndAmounts: params.tokensAndAmounts,\n to: params.to,\n isGuardedToken: params.isGuardedToken,\n toCounterfactual: params.toCounterfactual,\n });\n throw new Error(parseViemError(error));\n } finally {\n setIsProcessing(false);\n }\n }\n\n /**\n * Get reward metadata for a specific nonce\n * @param nonce The nonce to query\n */\n async function getRewardMeta(nonce: bigint): Promise<RewardMeta> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.REWARDS_KERNEL as Address,\n abi: REWARDS_KERNEL_ABI,\n functionName: \"getRewardMeta\",\n args: [nonce],\n })) as any;\n\n return {\n merkleRoot: result[0],\n pushTimestamp: Number(result[1]),\n rejected: result[2],\n };\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Get the maximum claimable amount for a token at a specific nonce\n * @param nonce The nonce to query\n * @param token The token address\n */\n async function getMaxReward(\n nonce: bigint,\n token: `0x${string}`\n ): Promise<bigint> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.REWARDS_KERNEL as Address,\n abi: REWARDS_KERNEL_ABI,\n functionName: \"getMaxReward\",\n args: [nonce, token as Address],\n })) as bigint;\n\n return result;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Get the amount already claimed for a token at a specific nonce\n * @param nonce The nonce to query\n * @param token The token address\n */\n async function getAmountClaimed(\n nonce: bigint,\n token: `0x${string}`\n ): Promise<bigint> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.REWARDS_KERNEL as Address,\n abi: REWARDS_KERNEL_ABI,\n functionName: \"getAmountClaimed\",\n args: [nonce, token as Address],\n })) as bigint;\n\n return result;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Check if a nonce is finalized and claimable\n * @param nonce The nonce to check\n */\n async function isFinalized(nonce: bigint): Promise<boolean> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.REWARDS_KERNEL as Address,\n abi: REWARDS_KERNEL_ABI,\n functionName: \"isFinalized\",\n args: [nonce],\n })) as boolean;\n\n return result;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Check if a user has already claimed from a specific nonce\n * @param user The user address\n * @param nonce The nonce to check\n */\n async function isClaimed(\n user: `0x${string}`,\n nonce: bigint\n ): Promise<boolean> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.REWARDS_KERNEL as Address,\n abi: REWARDS_KERNEL_ABI,\n functionName: \"isClaimed\",\n args: [user as Address, nonce],\n })) as boolean;\n\n return result;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Get the next nonce that will be used for posting\n */\n async function getNextPostNonce(): Promise<bigint> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.REWARDS_KERNEL as Address,\n abi: REWARDS_KERNEL_ABI,\n functionName: \"$nextPostNonce\",\n args: [],\n })) as bigint;\n\n return result;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Get the finality period in seconds\n */\n async function getFinality(): Promise<bigint> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.REWARDS_KERNEL as Address,\n abi: REWARDS_KERNEL_ABI,\n functionName: \"FINALITY\",\n args: [],\n })) as bigint;\n\n return result;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Get the foundation multisig address\n */\n async function getFoundationMultisig(): Promise<string> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.REWARDS_KERNEL as Address,\n abi: REWARDS_KERNEL_ABI,\n functionName: \"FOUNDATION_MULTISIG\",\n args: [],\n })) as string;\n\n return result;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Get the rejection multisig address\n */\n async function getRejectionMultisig(): Promise<string> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.REWARDS_KERNEL as Address,\n abi: REWARDS_KERNEL_ABI,\n functionName: \"REJECTION_MULTISIG\",\n args: [],\n })) as string;\n\n return result;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Get the counterfactual holder factory address\n */\n async function getCFHFactory(): Promise<string> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.REWARDS_KERNEL as Address,\n abi: REWARDS_KERNEL_ABI,\n functionName: \"CFH_FACTORY\",\n args: [],\n })) as string;\n\n return result;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Estimate gas for claiming a payout\n * @param params Parameters for claiming the payout\n * @param ethPriceInUSD Current ETH price in USD (for cost estimation)\n */\n async function estimateGasForClaimPayout(\n params: ClaimPayoutParams,\n ethPriceInUSD: number | null\n ): Promise<string> {\n assertWalletClient(walletClient);\n assertPublicClient(publicClient);\n\n try {\n const {\n nonce,\n proof,\n tokensAndAmounts,\n from,\n to,\n isGuardedToken,\n toCounterfactual,\n } = params;\n\n const gasPrice = await publicClient.getGasPrice();\n if (!gasPrice) {\n throw new Error(\"Could not fetch gas price to estimate cost.\");\n }\n\n const estimatedGas = await publicClient.estimateContractGas({\n address: ADDRESSES.REWARDS_KERNEL as Address,\n abi: REWARDS_KERNEL_ABI,\n functionName: \"claimPayout\",\n args: [\n nonce,\n proof as `0x${string}`[],\n tokensAndAmounts as readonly {\n token: `0x${string}`;\n amount: bigint;\n }[],\n from as Address,\n to as Address,\n isGuardedToken,\n toCounterfactual,\n ],\n account: walletClient.account!,\n });\n\n const estimatedCost: bigint = estimatedGas * gasPrice;\n\n if (ethPriceInUSD) {\n const estimatedCostInEth = formatEther(estimatedCost);\n const estimatedCostInUSD = (\n parseFloat(estimatedCostInEth) * ethPriceInUSD\n ).toFixed(2);\n return estimatedCostInUSD;\n } else {\n throw new Error(\n \"Could not fetch the ETH price to calculate cost in USD.\"\n );\n }\n } catch (error: any) {\n throw new Error(parseViemError(error));\n }\n }\n\n return {\n // Core contract functions\n claimPayout,\n\n // View functions\n getRewardMeta,\n getMaxReward,\n getAmountClaimed,\n isFinalized,\n isClaimed,\n getNextPostNonce,\n getFinality,\n getFoundationMultisig,\n getRejectionMultisig,\n getCFHFactory,\n\n // Gas estimation\n estimateGasForClaimPayout,\n\n // State\n get isProcessing() {\n return isProcessing;\n },\n addresses: ADDRESSES,\n\n // Wallet client availability\n isSignerAvailable: !!walletClient,\n };\n}\n","\"use strict\";\n\nimport type {\n GctlPrice,\n StakeRequest,\n RegionStake,\n WalletRegionStake,\n WalletRegionUnlocked,\n WalletRegionCommittedBalance,\n TransferDetails,\n GlwPrice,\n GlwRegionRewardsResponse,\n WalletNonce,\n GctlSupply,\n MintedEventsResponse,\n StakeEventsResponse,\n FailedOperationsResponse,\n PendingTransfersResponse,\n PendingTransferType,\n RestakeRequest,\n MigrationAmountResponse,\n HoldersCountResponse,\n RetryFailedOperationResponse,\n FarmRewardSplitsResponse,\n FarmRewardSplitsErrorResponse,\n FarmRewardSplit,\n} from \"../types\";\n\ninterface FetchGctlBalanceResponse {\n gctl_balance: string;\n}\n\ninterface FetchCommittedBalanceResponse {\n gctl_committed_balance: string;\n}\nimport {\n sentryAddBreadcrumb,\n sentryCaptureException,\n} from \"../../utils/sentry\";\n\nexport interface PayProtocolDepositUsingStakedControlRequest {\n wallet: string;\n regionId: number;\n applicationId: string;\n amount: string;\n signature: string;\n deadline: string;\n nonce: string;\n}\n\nexport interface PayProtocolDepositUsingStakedControlResponse {\n success: true;\n farmId: string;\n applicationId: string;\n}\n\nexport interface MigrateUserRequest {\n wallet: string;\n signature: string;\n deadline: string;\n nonce: string;\n}\n\nexport interface MigrateUserResponse {\n success: true;\n}\n\n// --------------------------------------------------------------------------\n\n/**\n * Extract a useful error message from an unknown error value.\n */\nfunction parseApiError(error: unknown): string {\n if (!error) return \"Unknown error\";\n if (error instanceof Error) return error.message;\n const possible: any = error;\n return possible?.error?.message ?? possible?.message ?? \"Unknown error\";\n}\n\n// --------------------------------------------------------------------------\n// Public Factory\n// --------------------------------------------------------------------------\n\nexport function ControlRouter(baseUrl: string) {\n if (!baseUrl) {\n throw new Error(\"CONTROL API base URL is not set\");\n }\n // ----------------------- Internal helpers --------------------------------\n const request = async <T>(path: string, init?: RequestInit): Promise<T> => {\n const res = await fetch(`${baseUrl}${path}`, init);\n if (!res.ok) {\n const errData = await res.json().catch(() => ({}));\n throw new Error(errData?.error || `Request to ${path} failed`);\n }\n return (await res.json()) as T;\n };\n\n // ----------------------- GETters -----------------------------------------\n const fetchGctlBalance = async (wallet: string): Promise<string> => {\n try {\n const data = await request<FetchGctlBalanceResponse>(\n `/balance/${wallet}`\n );\n return (data?.gctl_balance ?? \"0\").toString();\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchCommittedBalance = async (wallet: string): Promise<string> => {\n try {\n const data = await request<FetchCommittedBalanceResponse>(\n `/committed-balance/${wallet}`\n );\n return (data?.gctl_committed_balance ?? \"0\").toString();\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchGctlPrice = async (): Promise<string> => {\n try {\n const data = await request<GctlPrice>(`/price`);\n return data.currentPriceUsdc;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchGlwPrice = async (): Promise<string> => {\n try {\n const data = await request<GlwPrice>(`/price/glw`);\n return data.currentPriceUsdc;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchLastNonce = async (wallet: string): Promise<string> => {\n try {\n const data = await request<WalletNonce>(`/nonce/${wallet}`);\n return data.lastNonce;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchCirculatingSupply = async (): Promise<string> => {\n try {\n const data = await request<GctlSupply>(`/supply/circulating`);\n return data.circulatingSupply;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchHoldersCount = async (): Promise<number> => {\n try {\n const data = await request<HoldersCountResponse>(`/holders/count`);\n return data.holders;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n // Build pagination query helper\n const buildPaginationQuery = (page?: number, limit?: number) => {\n const p = page ?? 1;\n const l = limit ?? 50;\n return `?page=${p}&limit=${l}`;\n };\n\n const fetchMintedEvents = async (\n page?: number,\n limit?: number\n ): Promise<MintedEventsResponse> => {\n try {\n const data = await request<MintedEventsResponse>(\n `/events/minted${buildPaginationQuery(page, limit)}`\n );\n return data;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchStakeEvents = async (\n page?: number,\n limit?: number,\n regionId?: number\n ): Promise<StakeEventsResponse> => {\n try {\n const base = `/events/stake${buildPaginationQuery(page, limit)}`;\n const query =\n typeof regionId === \"number\" ? `${base}&regionId=${regionId}` : base;\n const data = await request<StakeEventsResponse>(query);\n return data;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchPendingTransfers = async (\n page?: number,\n limit?: number,\n type?: PendingTransferType\n ): Promise<PendingTransfersResponse> => {\n try {\n const base = `/transfers/pending${buildPaginationQuery(page, limit)}`;\n const query = type ? `${base}&type=${encodeURIComponent(type)}` : base;\n const data = await request<PendingTransfersResponse>(query);\n return data;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchTransferDetails = async (\n txId: string\n ): Promise<TransferDetails> => {\n try {\n return await request<TransferDetails>(`/transfer/${txId}`);\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchFailedOperations = async (\n page?: number,\n limit?: number\n ): Promise<FailedOperationsResponse> => {\n try {\n const data = await request<FailedOperationsResponse>(\n `/operations/failed${buildPaginationQuery(page, limit)}`\n );\n return data;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchGlwRegionRewards = async (): Promise<GlwRegionRewardsResponse> => {\n try {\n const data = await request<GlwRegionRewardsResponse>(\n `/rewards/glw/regions`\n );\n return data;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchFarmRewardSplits = async (\n farmId: string\n ): Promise<FarmRewardSplit[]> => {\n try {\n if (!farmId) throw new Error(\"Farm ID is required\");\n const data = await request<\n FarmRewardSplitsResponse | FarmRewardSplitsErrorResponse\n >(`/farms/${encodeURIComponent(farmId)}/reward-splits`);\n if (\"error\" in data) throw new Error(data.error);\n return data.rewardSplits ?? [];\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n // Exposed query with error parsing\n const getTransferDetails = async (txId: string): Promise<TransferDetails> => {\n try {\n return await fetchTransferDetails(txId);\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchRegionStake = async (regionId: number): Promise<RegionStake> => {\n try {\n return await request<RegionStake>(`/region/${regionId}/stake`);\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchWalletRegionStake = async (\n wallet: string,\n regionId: number\n ): Promise<WalletRegionStake> => {\n try {\n return await request<WalletRegionStake>(\n `/wallet/${wallet}/region/${regionId}/stake`\n );\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchWalletRegionUnlocked = async (\n wallet: string,\n regionId: number\n ): Promise<WalletRegionUnlocked> => {\n try {\n return await request<WalletRegionUnlocked>(\n `/wallet/${wallet}/region/${regionId}/unlocked`\n );\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchWalletRegionCommittedBalance = async (\n wallet: string,\n regionId: number\n ): Promise<WalletRegionCommittedBalance> => {\n try {\n return await request<WalletRegionCommittedBalance>(\n `/wallet/${wallet}/region/${regionId}/committed-balance`\n );\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n // ----------------------- Mutations ---------------------------------------\n let isStaking = false;\n let isUnstaking = false;\n let isRestaking = false;\n let isRetryingFailedOperation = false;\n let isPayingProtocolDepositUsingStakedControl = false;\n let isMigratingUser = false;\n\n const stakeGctl = async (stakeRequest: StakeRequest): Promise<boolean> => {\n isStaking = true;\n try {\n sentryAddBreadcrumb({\n category: \"control-api\",\n message: \"POST /stake\",\n level: \"info\",\n data: {\n baseUrl,\n wallet: stakeRequest.wallet,\n regionId: stakeRequest.regionId,\n },\n });\n await request(`/stake`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(stakeRequest),\n });\n return true;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"stakeGctl\",\n baseUrl,\n wallet: stakeRequest.wallet,\n regionId: stakeRequest.regionId,\n amount: stakeRequest.amount,\n deadline: stakeRequest.deadline,\n });\n throw new Error(parseApiError(error));\n } finally {\n isStaking = false;\n }\n };\n\n const unstakeGctl = async (\n unstakeRequest: StakeRequest\n ): Promise<boolean> => {\n isUnstaking = true;\n try {\n sentryAddBreadcrumb({\n category: \"control-api\",\n message: \"POST /unstake\",\n level: \"info\",\n data: {\n baseUrl,\n wallet: unstakeRequest.wallet,\n regionId: unstakeRequest.regionId,\n },\n });\n await request(`/unstake`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(unstakeRequest),\n });\n return true;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"unstakeGctl\",\n baseUrl,\n wallet: unstakeRequest.wallet,\n regionId: unstakeRequest.regionId,\n amount: unstakeRequest.amount,\n deadline: unstakeRequest.deadline,\n });\n throw new Error(parseApiError(error));\n } finally {\n isUnstaking = false;\n }\n };\n\n const restakeGctl = async (\n restakeRequest: RestakeRequest\n ): Promise<boolean> => {\n isRestaking = true;\n try {\n sentryAddBreadcrumb({\n category: \"control-api\",\n message: \"POST /restake\",\n level: \"info\",\n data: {\n baseUrl,\n wallet: restakeRequest.wallet,\n fromZoneId: restakeRequest.fromZoneId,\n toZoneId: restakeRequest.toZoneId,\n },\n });\n await request(`/restake`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(restakeRequest),\n });\n return true;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"restakeGctl\",\n baseUrl,\n wallet: restakeRequest.wallet,\n fromZoneId: restakeRequest.fromZoneId,\n toZoneId: restakeRequest.toZoneId,\n amount: restakeRequest.amount,\n deadline: restakeRequest.deadline,\n });\n throw new Error(parseApiError(error));\n } finally {\n isRestaking = false;\n }\n };\n\n const retryFailedOperation = async (\n operationId: string\n ): Promise<RetryFailedOperationResponse> => {\n isRetryingFailedOperation = true;\n try {\n sentryAddBreadcrumb({\n category: \"control-api\",\n message: \"POST /operations/failed/:id/retry\",\n level: \"info\",\n data: { baseUrl, operationId },\n });\n const response = await request<RetryFailedOperationResponse>(\n `/operations/failed/${operationId}/retry`,\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n }\n );\n return response;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"retryFailedOperation\",\n baseUrl,\n operationId,\n });\n throw new Error(parseApiError(error));\n } finally {\n isRetryingFailedOperation = false;\n }\n };\n\n const payProtocolDepositUsingStakedControl = async (\n paymentRequest: PayProtocolDepositUsingStakedControlRequest\n ): Promise<PayProtocolDepositUsingStakedControlResponse> => {\n isPayingProtocolDepositUsingStakedControl = true;\n try {\n sentryAddBreadcrumb({\n category: \"control-api\",\n message: \"POST /pay-protocol-deposit-staked\",\n level: \"info\",\n data: {\n baseUrl,\n wallet: paymentRequest.wallet,\n regionId: paymentRequest.regionId,\n applicationId: paymentRequest.applicationId,\n amount: paymentRequest.amount,\n },\n });\n const response =\n await request<PayProtocolDepositUsingStakedControlResponse>(\n `/pay-protocol-deposit-staked`,\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(paymentRequest),\n }\n );\n return response;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"payProtocolDepositUsingStakedControl\",\n baseUrl,\n wallet: paymentRequest.wallet,\n regionId: paymentRequest.regionId,\n applicationId: paymentRequest.applicationId,\n amount: paymentRequest.amount,\n });\n throw new Error(parseApiError(error));\n } finally {\n isPayingProtocolDepositUsingStakedControl = false;\n }\n };\n\n const migrateUser = async (\n migrateRequest: MigrateUserRequest\n ): Promise<MigrateUserResponse> => {\n isMigratingUser = true;\n try {\n sentryAddBreadcrumb({\n category: \"control-api\",\n message: \"POST /migrate-user\",\n level: \"info\",\n data: {\n baseUrl,\n wallet: migrateRequest.wallet,\n },\n });\n const response = await request<MigrateUserResponse>(`/migrate-user`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(migrateRequest),\n });\n return response;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"migrateUser\",\n baseUrl,\n wallet: migrateRequest.wallet,\n deadline: migrateRequest.deadline,\n });\n throw new Error(parseApiError(error));\n } finally {\n isMigratingUser = false;\n }\n };\n\n const fetchMigrationAmount = async (\n wallet: string\n ): Promise<MigrationAmountResponse> => {\n try {\n return await request<MigrationAmountResponse>(\n `/migration-amount/${encodeURIComponent(wallet)}`\n );\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n // --------------------------- Public API ----------------------------------\n return {\n // Queries\n fetchGctlBalance,\n fetchCommittedBalance,\n fetchGctlPrice,\n fetchGlwPrice,\n fetchCirculatingSupply,\n fetchHoldersCount,\n fetchLastNonce,\n fetchMintedEvents,\n fetchStakeEvents,\n fetchPendingTransfers,\n fetchFailedOperations,\n fetchRegionStake,\n fetchWalletRegionStake,\n fetchWalletRegionUnlocked,\n fetchWalletRegionCommittedBalance,\n fetchTransferDetails: getTransferDetails,\n fetchGlwRegionRewards,\n fetchFarmRewardSplits,\n fetchMigrationAmount,\n\n // Mutations\n stakeGctl,\n unstakeGctl,\n restakeGctl,\n retryFailedOperation,\n payProtocolDepositUsingStakedControl,\n migrateUser,\n\n // Processing flags\n get isStaking() {\n return isStaking;\n },\n get isUnstaking() {\n return isUnstaking;\n },\n get isRestaking() {\n return isRestaking;\n },\n get isRetryingFailedOperation() {\n return isRetryingFailedOperation;\n },\n get isPayingProtocolDepositUsingStakedControl() {\n return isPayingProtocolDepositUsingStakedControl;\n },\n get isMigratingUser() {\n return isMigratingUser;\n },\n } as const;\n}\n","export function generateSlug(title: string): string {\n const ascii = title.normalize(\"NFKD\").replace(/[\\u0300-\\u036f]/g, \"\");\n\n const slug = ascii\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n\n // Guard against extremely long titles\n return slug.slice(0, 120);\n}\n","import type { RegionMetadata } from \"./types\";\n// Region metadata for kickstarter campaigns\n\nexport const regionMetadata: Record<string, RegionMetadata> = {\n // US States\n \"US-AL\": {\n code: \"US-AL\",\n name: \"Alabama\",\n description: \"The Heart of Dixie is ready for solar transformation\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-AK\": {\n code: \"US-AK\",\n name: \"Alaska\",\n description: \"The Last Frontier embracing renewable energy\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-AZ\": {\n code: \"US-AZ\",\n name: \"Arizona\",\n description: \"The Grand Canyon State with abundant sunshine\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-AR\": {\n code: \"US-AR\",\n name: \"Arkansas\",\n description: \"The Natural State going solar\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-CA\": {\n code: \"US-CA\",\n name: \"California\",\n description: \"The Golden State leading solar innovation\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-CO\": {\n code: \"US-CO\",\n name: \"Colorado\",\n description: \"The Centennial State with high-altitude solar potential\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-CT\": {\n code: \"US-CT\",\n name: \"Connecticut\",\n description: \"The Constitution State embracing clean energy\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-DE\": {\n code: \"US-DE\",\n name: \"Delaware\",\n description: \"The First State to go solar\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-FL\": {\n code: \"US-FL\",\n name: \"Florida\",\n description: \"The Sunshine State living up to its name\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-GA\": {\n code: \"US-GA\",\n name: \"Georgia\",\n description: \"The Peach State harvesting solar energy\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-HI\": {\n code: \"US-HI\",\n name: \"Hawaii\",\n description: \"The Aloha State with year-round solar potential\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-ID\": {\n code: \"US-ID\",\n name: \"Idaho\",\n description: \"The Gem State shining with solar power\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-IL\": {\n code: \"US-IL\",\n name: \"Illinois\",\n description: \"The Prairie State powering up with solar\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-IN\": {\n code: \"US-IN\",\n name: \"Indiana\",\n description: \"The Hoosier State joining the solar revolution\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-IA\": {\n code: \"US-IA\",\n name: \"Iowa\",\n description: \"The Hawkeye State expanding beyond wind to solar\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-KS\": {\n code: \"US-KS\",\n name: \"Kansas\",\n description: \"The Sunflower State growing solar energy\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-KY\": {\n code: \"US-KY\",\n name: \"Kentucky\",\n description: \"The Bluegrass State transitioning to clean energy\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-LA\": {\n code: \"US-LA\",\n name: \"Louisiana\",\n description: \"The Pelican State soaring with solar\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-ME\": {\n code: \"US-ME\",\n name: \"Maine\",\n description: \"The Pine Tree State branching into solar\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-MD\": {\n code: \"US-MD\",\n name: \"Maryland\",\n description: \"The Old Line State drawing new energy lines\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-MA\": {\n code: \"US-MA\",\n name: \"Massachusetts\",\n description: \"The Bay State leading in solar innovation\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-MI\": {\n code: \"US-MI\",\n name: \"Michigan\",\n description: \"The Great Lakes State harnessing solar power\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-MN\": {\n code: \"US-MN\",\n name: \"Minnesota\",\n description: \"The North Star State guiding solar adoption\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-MS\": {\n code: \"US-MS\",\n name: \"Mississippi\",\n description: \"The Magnolia State blooming with solar energy\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-MO\": {\n code: \"US-MO\",\n name: \"Missouri\",\n description: \"The Show-Me State showing solar leadership\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-MT\": {\n code: \"US-MT\",\n name: \"Montana\",\n description: \"Big Sky Country with big solar potential\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-NE\": {\n code: \"US-NE\",\n name: \"Nebraska\",\n description: \"The Cornhusker State cultivating solar power\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-NV\": {\n code: \"US-NV\",\n name: \"Nevada\",\n description: \"The Silver State striking solar gold\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-NH\": {\n code: \"US-NH\",\n name: \"New Hampshire\",\n description: \"The Granite State building solid solar foundation\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-NJ\": {\n code: \"US-NJ\",\n name: \"New Jersey\",\n description: \"The Garden State growing solar gardens\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-NM\": {\n code: \"US-NM\",\n name: \"New Mexico\",\n description: \"The Land of Enchantment enchanted by solar\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-NY\": {\n code: \"US-NY\",\n name: \"New York\",\n description: \"The Empire State building a solar empire\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-NC\": {\n code: \"US-NC\",\n name: \"North Carolina\",\n description: \"The Tar Heel State stepping into solar\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-ND\": {\n code: \"US-ND\",\n name: \"North Dakota\",\n description: \"The Peace Garden State cultivating solar peace\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-OH\": {\n code: \"US-OH\",\n name: \"Ohio\",\n description: \"The Buckeye State branching into solar\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-OK\": {\n code: \"US-OK\",\n name: \"Oklahoma\",\n description: \"The Sooner State adopting solar sooner\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-OR\": {\n code: \"US-OR\",\n name: \"Oregon\",\n description: \"The Beaver State building solar dams\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-PA\": {\n code: \"US-PA\",\n name: \"Pennsylvania\",\n description: \"The Keystone State unlocking solar potential\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-RI\": {\n code: \"US-RI\",\n name: \"Rhode Island\",\n description: \"The Ocean State riding the solar wave\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-SC\": {\n code: \"US-SC\",\n name: \"South Carolina\",\n description: \"The Palmetto State basking in solar\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-SD\": {\n code: \"US-SD\",\n name: \"South Dakota\",\n description: \"Mount Rushmore State carving out solar future\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-TN\": {\n code: \"US-TN\",\n name: \"Tennessee\",\n description: \"The Volunteer State volunteering for solar\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-TX\": {\n code: \"US-TX\",\n name: \"Texas\",\n description: \"The Lone Star State shining with solar power\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-UT\": {\n code: \"US-UT\",\n name: \"Utah\",\n description: \"The Beehive State buzzing with solar activity\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-VT\": {\n code: \"US-VT\",\n name: \"Vermont\",\n description: \"The Green Mountain State going greener\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-VA\": {\n code: \"US-VA\",\n name: \"Virginia\",\n description: \"The Old Dominion embracing new energy\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-WA\": {\n code: \"US-WA\",\n name: \"Washington\",\n description: \"The Evergreen State staying green with solar\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-WV\": {\n code: \"US-WV\",\n name: \"West Virginia\",\n description: \"The Mountain State reaching new heights\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-WI\": {\n code: \"US-WI\",\n name: \"Wisconsin\",\n description: \"The Badger State digging into solar\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-WY\": {\n code: \"US-WY\",\n name: \"Wyoming\",\n description: \"The Equality State equalizing energy access\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n\n // Countries\n CA: {\n code: \"CA\",\n name: \"Canada\",\n description: \"The Great White North embracing solar energy\",\n isUs: false,\n flag: \"🇨🇦\",\n },\n MX: {\n code: \"MX\",\n name: \"Mexico\",\n description: \"Abundant sunshine powering the future\",\n isUs: false,\n flag: \"🇲🇽\",\n },\n BR: {\n code: \"BR\",\n name: \"Brazil\",\n description: \"The largest South American market for solar\",\n isUs: false,\n flag: \"🇧🇷\",\n },\n AR: {\n code: \"AR\",\n name: \"Argentina\",\n description: \"Pampas and sunshine creating energy independence\",\n isUs: false,\n flag: \"🇦🇷\",\n },\n CL: {\n code: \"CL\",\n name: \"Chile\",\n description: \"The Atacama Desert's solar potential unleashed\",\n isUs: false,\n flag: \"🇨🇱\",\n },\n CO: {\n code: \"CO\",\n name: \"Colombia\",\n description: \"Equatorial sunshine year-round\",\n isUs: false,\n flag: \"🇨🇴\",\n },\n PE: {\n code: \"PE\",\n name: \"Peru\",\n description: \"From the Andes to the Amazon with solar\",\n isUs: false,\n flag: \"🇵🇪\",\n },\n GB: {\n code: \"GB\",\n name: \"United Kingdom\",\n description: \"Leading Europe's renewable transition\",\n isUs: false,\n flag: \"🇬🇧\",\n },\n FR: {\n code: \"FR\",\n name: \"France\",\n description: \"La République embracing solar liberté\",\n isUs: false,\n flag: \"🇫🇷\",\n },\n DE: {\n code: \"DE\",\n name: \"Germany\",\n description: \"Engineering excellence in solar deployment\",\n isUs: false,\n flag: \"🇩🇪\",\n },\n IT: {\n code: \"IT\",\n name: \"Italy\",\n description: \"Mediterranean sunshine powering the boot\",\n isUs: false,\n flag: \"🇮🇹\",\n },\n ES: {\n code: \"ES\",\n name: \"Spain\",\n description: \"Iberian peninsula's solar powerhouse\",\n isUs: false,\n flag: \"🇪🇸\",\n },\n PT: {\n code: \"PT\",\n name: \"Portugal\",\n description: \"Atlantic coast harnessing solar waves\",\n isUs: false,\n flag: \"🇵🇹\",\n },\n NL: {\n code: \"NL\",\n name: \"Netherlands\",\n description: \"Low lands, high solar ambitions\",\n isUs: false,\n flag: \"🇳🇱\",\n },\n BE: {\n code: \"BE\",\n name: \"Belgium\",\n description: \"The heart of Europe goes solar\",\n isUs: false,\n flag: \"🇧🇪\",\n },\n CH: {\n code: \"CH\",\n name: \"Switzerland\",\n description: \"Alpine heights capturing pure sunlight\",\n isUs: false,\n flag: \"🇨🇭\",\n },\n AT: {\n code: \"AT\",\n name: \"Austria\",\n description: \"Mountain valleys filled with solar panels\",\n isUs: false,\n flag: \"🇦🇹\",\n },\n SE: {\n code: \"SE\",\n name: \"Sweden\",\n description: \"Nordic innovation in solar technology\",\n isUs: false,\n flag: \"🇸🇪\",\n },\n NO: {\n code: \"NO\",\n name: \"Norway\",\n description: \"Fjords reflecting solar possibilities\",\n isUs: false,\n flag: \"🇳🇴\",\n },\n DK: {\n code: \"DK\",\n name: \"Denmark\",\n description: \"Viking spirit conquering solar frontiers\",\n isUs: false,\n flag: \"🇩🇰\",\n },\n FI: {\n code: \"FI\",\n name: \"Finland\",\n description: \"Land of midnight sun going solar\",\n isUs: false,\n flag: \"🇫🇮\",\n },\n PL: {\n code: \"PL\",\n name: \"Poland\",\n description: \"Central Europe's emerging solar market\",\n isUs: false,\n flag: \"🇵🇱\",\n },\n CZ: {\n code: \"CZ\",\n name: \"Czech Republic\",\n description: \"Bohemian innovation in renewable energy\",\n isUs: false,\n flag: \"🇨🇿\",\n },\n GR: {\n code: \"GR\",\n name: \"Greece\",\n description: \"Aegean sunshine powering ancient lands\",\n isUs: false,\n flag: \"🇬🇷\",\n },\n TR: {\n code: \"TR\",\n name: \"Turkey\",\n description: \"Bridge between continents powered by sun\",\n isUs: false,\n flag: \"🇹🇷\",\n },\n IN: {\n code: \"IN\",\n name: \"India\",\n description: \"World's fastest growing solar market\",\n isUs: false,\n flag: \"🇮🇳\",\n },\n CN: {\n code: \"CN\",\n name: \"China\",\n description: \"Global solar manufacturing leader\",\n isUs: false,\n flag: \"🇨🇳\",\n },\n JP: {\n code: \"JP\",\n name: \"Japan\",\n description: \"Rising sun powering technological innovation\",\n isUs: false,\n flag: \"🇯🇵\",\n },\n KR: {\n code: \"KR\",\n name: \"South Korea\",\n description: \"High-tech nation embracing green energy\",\n isUs: false,\n flag: \"🇰🇷\",\n },\n AU: {\n code: \"AU\",\n name: \"Australia\",\n description: \"Outback sunshine creating energy abundance\",\n isUs: false,\n flag: \"🇦🇺\",\n },\n NZ: {\n code: \"NZ\",\n name: \"New Zealand\",\n description: \"Clean, green Aotearoa\",\n isUs: false,\n flag: \"🇳🇿\",\n },\n ZA: {\n code: \"ZA\",\n name: \"South Africa\",\n description: \"African sunshine lighting the continent\",\n isUs: false,\n flag: \"🇿🇦\",\n },\n EG: {\n code: \"EG\",\n name: \"Egypt\",\n description: \"Desert sun powering ancient civilizations\",\n isUs: false,\n flag: \"🇪🇬\",\n },\n NG: {\n code: \"NG\",\n name: \"Nigeria\",\n description: \"West Africa's solar giant awakening\",\n isUs: false,\n flag: \"🇳🇬\",\n },\n KE: {\n code: \"KE\",\n name: \"Kenya\",\n description: \"East African solar innovation hub\",\n isUs: false,\n flag: \"🇰🇪\",\n },\n MA: {\n code: \"MA\",\n name: \"Morocco\",\n description: \"Saharan edge harnessing desert power\",\n isUs: false,\n flag: \"🇲🇦\",\n },\n SA: {\n code: \"SA\",\n name: \"Saudi Arabia\",\n description: \"Oil kingdom transitioning to solar\",\n isUs: false,\n flag: \"🇸🇦\",\n },\n AE: {\n code: \"AE\",\n name: \"United Arab Emirates\",\n description: \"Desert emirates building solar oases\",\n isUs: false,\n flag: \"🇦🇪\",\n },\n IL: {\n code: \"IL\",\n name: \"Israel\",\n description: \"Innovation nation powered by sunshine\",\n isUs: false,\n flag: \"🇮🇱\",\n },\n SG: {\n code: \"SG\",\n name: \"Singapore\",\n description: \"City-state maximizing rooftop solar\",\n isUs: false,\n flag: \"🇸🇬\",\n },\n ID: {\n code: \"ID\",\n name: \"Indonesia\",\n description: \"Archipelago nation harnessing tropical sun\",\n isUs: false,\n flag: \"🇮🇩\",\n },\n TH: {\n code: \"TH\",\n name: \"Thailand\",\n description: \"Land of smiles powered by solar\",\n isUs: false,\n flag: \"🇹🇭\",\n },\n VN: {\n code: \"VN\",\n name: \"Vietnam\",\n description: \"Southeast Asian solar manufacturing hub\",\n isUs: false,\n flag: \"🇻🇳\",\n },\n PH: {\n code: \"PH\",\n name: \"Philippines\",\n description: \"7,000 islands unified by solar power\",\n isUs: false,\n flag: \"🇵🇭\",\n },\n};\n\n// Helper to get all regions as array\nexport const allRegions = Object.values(regionMetadata);\n\n// Helper to get US states\nexport const usStates = allRegions.filter((r) => r.isUs);\n\n// Helper to get countries\nexport const countries = allRegions.filter((r) => !r.isUs);\n","\"use strict\";\n\nimport { generateSlug } from \"src/utils/generate-slug\";\nimport { regionMetadata } from \"../region-metadata\";\nimport type {\n RegionWithMetadata,\n ActivationConfig,\n ActivationEvent,\n RegionDetails,\n SponsoredFarm,\n ActiveRegionsSummaryResponse,\n RecentRegionActivityResponse,\n InstallerApplicationPayload,\n InstallerApplicationResponse,\n RegionWeeklyRewardsResponse,\n RegionWeeklyRewardsQuery,\n} from \"../types\";\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nfunction parseApiError(error: unknown): string {\n if (!error) return \"Unknown error\";\n if (error instanceof Error) return error.message;\n const possible: any = error;\n return possible?.error?.message ?? possible?.message ?? \"Unknown error\";\n}\n\n// ---------------------------------------------------------------------------\n// Factory\n// ---------------------------------------------------------------------------\n\nexport function RegionRouter(baseUrl: string) {\n if (!baseUrl) throw new Error(\"CONTROL API base URL is not set\");\n\n const request = async <T>(path: string, init?: RequestInit): Promise<T> => {\n const res = await fetch(`${baseUrl}${path}`, init);\n if (!res.ok) {\n const errData = await res.json().catch(() => ({}));\n throw new Error(errData?.error || `Request to ${path} failed`);\n }\n return (await res.json()) as T;\n };\n\n // -------------------------------------------------------------------------\n // Local cache / state flags\n // -------------------------------------------------------------------------\n let cachedRegions: RegionWithMetadata[] = [];\n let isLoading = false;\n\n // -------------------------------------------------------------------------\n // Queries\n // -------------------------------------------------------------------------\n const fetchRegions = async (params?: {\n isActive?: boolean;\n }): Promise<RegionWithMetadata[]> => {\n isLoading = true;\n try {\n const query =\n params && typeof params.isActive === \"boolean\"\n ? `?isActive=${params.isActive ? \"true\" : \"false\"}`\n : \"\";\n const data = await request<{ regions: RegionWithMetadata[] }>(\n `/regions/all${query}`\n );\n cachedRegions = data.regions ?? [];\n return cachedRegions;\n } catch (error) {\n throw new Error(parseApiError(error));\n } finally {\n isLoading = false;\n }\n };\n\n const fetchActivationConfig = async (\n regionCode: string\n ): Promise<ActivationConfig> => {\n try {\n return await request<ActivationConfig>(\n `/regions/activation-config?code=${regionCode}`\n );\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchActivationEvents = async (\n regionId?: number\n ): Promise<ActivationEvent[]> => {\n try {\n const query = typeof regionId === \"number\" ? `?regionId=${regionId}` : \"\";\n const data = await request<{ events: ActivationEvent[] }>(\n `/regions/activation-events${query}`\n );\n return data.events ?? [];\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchRegionByIdOrSlug = async (\n idOrSlug: string\n ): Promise<RegionDetails> => {\n try {\n const data = await request<{ region: RegionDetails }>(\n `/regions/${encodeURIComponent(idOrSlug)}`\n );\n return data.region;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchRegionSolarFarms = async (\n regionId: number\n ): Promise<SponsoredFarm[]> => {\n try {\n const data = await request<{ sponsoredFarms: SponsoredFarm[] }>(\n `/regions/solar-farms/${regionId}`\n );\n return data.sponsoredFarms ?? [];\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchActiveSummary =\n async (): Promise<ActiveRegionsSummaryResponse> => {\n try {\n return await request<ActiveRegionsSummaryResponse>(\n `/regions/active/summary`\n );\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchRecentActivity =\n async (): Promise<RecentRegionActivityResponse> => {\n try {\n return await request<RecentRegionActivityResponse>(\n `/regions/active/recent-activity`\n );\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchRegionWeeklyRewards = async (\n regionId: number,\n query?: RegionWeeklyRewardsQuery\n ): Promise<RegionWeeklyRewardsResponse> => {\n try {\n const params = new URLSearchParams();\n if (query?.startWeek !== undefined)\n params.set(\"startWeek\", query.startWeek.toString());\n if (query?.endWeek !== undefined)\n params.set(\"endWeek\", query.endWeek.toString());\n if (query?.paymentCurrency)\n params.set(\"paymentCurrency\", query.paymentCurrency);\n if (query?.limit !== undefined)\n params.set(\"limit\", query.limit.toString());\n\n const queryString = params.toString();\n const path = `/regions/weekly-rewards/${regionId}${\n queryString ? `?${queryString}` : \"\"\n }`;\n\n return await request<RegionWeeklyRewardsResponse>(path);\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const applyInstallerCertification = async (\n payload: InstallerApplicationPayload\n ): Promise<InstallerApplicationResponse> => {\n try {\n return await request<InstallerApplicationResponse>(\n `/regions/installers/apply`,\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(payload),\n }\n );\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n // Kickstarter-related logic moved to kickstarter-router.ts\n\n // -------------------------------------------------------------------------\n // Helpers (derived)\n // -------------------------------------------------------------------------\n\n const getRegionByCode = (code: string): RegionWithMetadata | null => {\n const metadata = regionMetadata[code];\n if (!metadata) return null;\n\n const existingRegion = cachedRegions.find(\n (r) => r.name.toLowerCase() === metadata.name.toLowerCase()\n );\n\n if (existingRegion) {\n return {\n ...existingRegion,\n code: metadata.code,\n description: metadata.description,\n isUs: metadata.isUs,\n };\n }\n\n // Placeholder if region does not yet exist in DB\n return {\n id: -1,\n name: metadata.name,\n code: metadata.code,\n description: metadata.description,\n bannerUrl: \"\",\n slug: generateSlug(metadata.name),\n isUs: metadata.isUs,\n isActive: false,\n staked: \"0\",\n activationStakeThreshold: metadata.isUs ? \"20000000000\" : \"200000000000\",\n solarFarmCount: 0,\n solarPanelsQuantity: 0,\n activationSolarFarmThreshold: 10,\n installerCount: 1,\n createdAt: new Date(),\n activationInstallerThreshold: 1,\n efficiencyScore: 0,\n };\n };\n\n // -------------------------------------------------------------------------\n // Public API\n // -------------------------------------------------------------------------\n return {\n // Data access\n fetchRegions,\n fetchActivationConfig,\n fetchActivationEvents,\n fetchRegionByIdOrSlug,\n fetchRegionSolarFarms,\n fetchActiveSummary,\n fetchRecentActivity,\n fetchRegionWeeklyRewards,\n getRegionByCode,\n applyInstallerCertification,\n\n // Cached data & flags\n get regions() {\n return cachedRegions;\n },\n get isLoading() {\n return isLoading;\n },\n } as const;\n}\n","\"use strict\";\n\nimport { regionMetadata } from \"../region-metadata\";\nimport type {\n Kickstarter,\n CreateKickstarterPayload,\n KickstarterCreateResponse,\n CommitKickstarterPayload,\n CommitKickstarterResponse,\n KickstarterDetails,\n KickstarterCommitmentsQuery,\n KickstarterCommitmentsResponse,\n} from \"../types\";\nimport {\n sentryAddBreadcrumb,\n sentryCaptureException,\n} from \"../../utils/sentry\";\n\nfunction parseApiError(error: unknown): string {\n if (!error) return \"Unknown error\";\n if (error instanceof Error) return error.message;\n const possible: any = error;\n return possible?.error?.message ?? possible?.message ?? \"Unknown error\";\n}\n\nexport function KickstarterRouter(baseUrl: string) {\n if (!baseUrl) throw new Error(\"CONTROL API base URL is not set\");\n\n const request = async <T>(path: string, init?: RequestInit): Promise<T> => {\n const res = await fetch(`${baseUrl}${path}`, init);\n if (!res.ok) {\n const errData = await res.json().catch(() => ({}));\n throw new Error(errData?.error || `Request to ${path} failed`);\n }\n return (await res.json()) as T;\n };\n\n let isCreatingKickstarter = false;\n\n const fetchKickstarters = async (): Promise<Kickstarter[]> => {\n try {\n const data = await request<{ kickstarters: Kickstarter[] }>(\n `/kickstarters`\n );\n return data.kickstarters ?? [];\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const createKickstarter = async (\n payload: CreateKickstarterPayload\n ): Promise<KickstarterCreateResponse> => {\n isCreatingKickstarter = true;\n try {\n sentryAddBreadcrumb({\n category: \"control-api\",\n message: \"POST /kickstarters\",\n level: \"info\",\n data: {\n baseUrl,\n code: payload.code,\n creatorWallet: payload.creatorWallet,\n },\n });\n const exists = Boolean(regionMetadata[payload.code]);\n if (!exists) {\n throw new Error(`Unknown region code: ${payload.code}`);\n }\n const data = await request<KickstarterCreateResponse>(`/kickstarters`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(payload),\n });\n return data;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"createKickstarter\",\n baseUrl,\n code: payload.code,\n creatorWallet: payload.creatorWallet,\n title: payload.title,\n regionName: payload.regionName,\n });\n throw new Error(parseApiError(error));\n } finally {\n isCreatingKickstarter = false;\n }\n };\n\n const fetchKickstarter = async (\n idOrSlug: string\n ): Promise<KickstarterDetails> => {\n try {\n const data = await request<{\n kickstarter: KickstarterDetails;\n }>(`/kickstarters/${encodeURIComponent(idOrSlug)}`);\n return data.kickstarter;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchKickstartersByWallet = async (\n wallet: string\n ): Promise<Kickstarter[]> => {\n try {\n const data = await request<{ kickstarters: Kickstarter[] }>(\n `/kickstarters/by-wallet/${encodeURIComponent(wallet)}`\n );\n return data.kickstarters ?? [];\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const commitKickstarter = async (\n kickstarterId: string,\n payload: CommitKickstarterPayload\n ): Promise<CommitKickstarterResponse> => {\n try {\n sentryAddBreadcrumb({\n category: \"control-api\",\n message: \"POST /kickstarters/commit/:id\",\n level: \"info\",\n data: { baseUrl, kickstarterId },\n });\n const data = await request<CommitKickstarterResponse>(\n `/kickstarters/commit/${encodeURIComponent(kickstarterId)}`,\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(payload),\n }\n );\n return data;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"commitKickstarter\",\n baseUrl,\n kickstarterId,\n wallet: payload.wallet,\n amount: payload.amount,\n });\n throw new Error(parseApiError(error));\n }\n };\n\n // Build pagination query helper\n const buildPaginationQuery = (page?: number, limit?: number) => {\n const p = page ?? 1;\n const l = limit ?? 50;\n return `?page=${p}&limit=${l}`;\n };\n\n const fetchRegionCommitments = async (\n regionId: number,\n query?: KickstarterCommitmentsQuery\n ): Promise<KickstarterCommitmentsResponse> => {\n try {\n const base = `/kickstarters/region/${regionId}/commitments${buildPaginationQuery(\n query?.page,\n query?.limit\n )}`;\n const finalQuery =\n query?.finalized !== undefined\n ? `${base}&finalized=${query.finalized}`\n : base;\n const data = await request<KickstarterCommitmentsResponse>(finalQuery);\n return data;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n return {\n fetchKickstarters,\n fetchKickstarter,\n fetchKickstartersByWallet,\n commitKickstarter,\n createKickstarter,\n fetchRegionCommitments,\n get isCreatingKickstarter() {\n return isCreatingKickstarter;\n },\n } as const;\n}\n","\"use strict\";\n\nimport type {\n ControlWallet,\n WalletsResponse,\n WalletDetails,\n MintedEvent,\n StakedEvent,\n WalletWeeklyRewardsResponse,\n WeeklyRewardsQuery,\n TosAcceptRequest,\n TosAcceptResponse,\n TosStatusResponse,\n} from \"../types\";\n\nfunction parseApiError(error: unknown): string {\n if (!error) return \"Unknown error\";\n if (error instanceof Error) return error.message;\n const possible: any = error;\n return possible?.error?.message ?? possible?.message ?? \"Unknown error\";\n}\n\nexport function WalletsRouter(baseUrl: string) {\n if (!baseUrl) throw new Error(\"CONTROL API base URL is not set\");\n\n const request = async <T>(path: string, init?: RequestInit): Promise<T> => {\n const res = await fetch(`${baseUrl}${path}`, init);\n if (!res.ok) {\n const errData = await res.json().catch(() => ({}));\n throw new Error(errData?.error || `Request to ${path} failed`);\n }\n return (await res.json()) as T;\n };\n\n const buildPaginationQuery = (page?: number, limit?: number) => {\n const p = page ?? 1;\n const l = limit ?? 50;\n return `?page=${p}&limit=${l}`;\n };\n\n const fetchAllWallets = async (): Promise<ControlWallet[]> => {\n try {\n const data = await request<WalletsResponse>(`/wallets/all`);\n return data.wallets ?? [];\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchWalletByAddress = async (\n wallet: string\n ): Promise<WalletDetails> => {\n try {\n return await request<WalletDetails>(\n `/wallets/address/${encodeURIComponent(wallet)}`\n );\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchWalletMintedEvents = async (\n wallet: string,\n page?: number,\n limit?: number\n ): Promise<MintedEvent[]> => {\n try {\n const data = await request<{ events: MintedEvent[] }>(\n `/wallets/address/${encodeURIComponent(\n wallet\n )}/events/minted${buildPaginationQuery(page, limit)}`\n );\n return data.events ?? [];\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchWalletStakeEvents = async (\n wallet: string,\n page?: number,\n limit?: number,\n regionId?: number\n ): Promise<StakedEvent[]> => {\n try {\n const base = `/wallets/address/${encodeURIComponent(\n wallet\n )}/events/stake${buildPaginationQuery(page, limit)}`;\n const query =\n typeof regionId === \"number\" ? `${base}&regionId=${regionId}` : base;\n const data = await request<{ events: StakedEvent[] }>(query);\n return data.events ?? [];\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchWalletWeeklyRewards = async (\n wallet: string,\n query?: WeeklyRewardsQuery\n ): Promise<WalletWeeklyRewardsResponse> => {\n try {\n const params = new URLSearchParams();\n if (query?.startWeek !== undefined)\n params.set(\"startWeek\", query.startWeek.toString());\n if (query?.endWeek !== undefined)\n params.set(\"endWeek\", query.endWeek.toString());\n if (query?.paymentCurrency)\n params.set(\"paymentCurrency\", query.paymentCurrency);\n if (query?.limit !== undefined)\n params.set(\"limit\", query.limit.toString());\n\n const queryString = params.toString();\n const path = `/wallets/address/${encodeURIComponent(\n wallet\n )}/weekly-rewards${queryString ? `?${queryString}` : \"\"}`;\n\n return await request<WalletWeeklyRewardsResponse>(path);\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const acceptToS = async (\n wallet: string,\n tosRequest: TosAcceptRequest\n ): Promise<TosAcceptResponse> => {\n try {\n return await request<TosAcceptResponse>(\n `/wallets/address/${encodeURIComponent(wallet)}/tos/accept`,\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(tosRequest),\n }\n );\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchTosStatus = async (wallet: string): Promise<TosStatusResponse> => {\n try {\n return await request<TosStatusResponse>(\n `/wallets/address/${encodeURIComponent(wallet)}/tos/status`\n );\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n return {\n fetchAllWallets,\n fetchWalletByAddress,\n fetchWalletMintedEvents,\n fetchWalletStakeEvents,\n fetchWalletWeeklyRewards,\n acceptToS,\n fetchTosStatus,\n } as const;\n}\n","\"use strict\";\n\nimport type {\n SponsoredFarm,\n SponsoredFarmsResponse,\n EstimateRewardScoreParams,\n RewardScoreResponse,\n EstimateRewardScoreErrorResponse,\n EstimateRewardScoresBatchParams,\n EstimateRewardScoresBatchResponse,\n WalletFarmsWithRewardsResponse,\n FarmWithRewards,\n FarmRewardSplitsResponse,\n FarmRewardSplitsErrorResponse,\n FarmRewardSplit,\n MiningScoresBatchParams,\n MiningScoresBatchResponse,\n FarmWeeklyRewardsResponse,\n FarmWeeklyRewardsQuery,\n FarmEfficiencyScore,\n SingleEfficiencyScoreResponse,\n EfficiencyScoresErrorResponse,\n FarmWeeklyRewardsBatchQuery,\n FarmWeeklyRewardsBatchResponse,\n WalletFarmRewardsHistoryQuery,\n WalletFarmRewardsHistoryResponse,\n WalletFarmRewardsHistoryBatchQuery,\n WalletFarmRewardsHistoryBatchResponse,\n} from \"../types\";\nimport {\n sentryAddBreadcrumb,\n sentryCaptureException,\n} from \"../../utils/sentry\";\n\nfunction parseApiError(error: unknown): string {\n if (!error) return \"Unknown error\";\n if (error instanceof Error) return error.message;\n const possible: any = error;\n return possible?.error?.message ?? possible?.message ?? \"Unknown error\";\n}\n\nexport function FarmsRouter(baseUrl: string) {\n if (!baseUrl) throw new Error(\"CONTROL API base URL is not set\");\n\n const request = async <T>(path: string, init?: RequestInit): Promise<T> => {\n const res = await fetch(`${baseUrl}${path}`, init);\n if (!res.ok) {\n const errData = await res.json().catch(() => ({}));\n throw new Error(errData?.error || `Request to ${path} failed`);\n }\n return (await res.json()) as T;\n };\n\n const fetchFarmRewardSplits = async (\n farmId: string\n ): Promise<FarmRewardSplit[]> => {\n try {\n if (!farmId) {\n throw new Error(\"Farm ID is required\");\n }\n\n const data = await request<\n FarmRewardSplitsResponse | FarmRewardSplitsErrorResponse\n >(`/farms/${encodeURIComponent(farmId)}/reward-splits`);\n\n // Check if it's an error response\n if (\"error\" in data) {\n throw new Error(data.error);\n }\n\n // At this point, TypeScript knows it's FarmRewardSplitsResponse\n return data.rewardSplits ?? [];\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchSponsoredFarms = async (\n sponsorWallet?: string\n ): Promise<SponsoredFarm[]> => {\n try {\n const query = sponsorWallet\n ? `?sponsorWallet=${encodeURIComponent(sponsorWallet)}`\n : \"\";\n const data = await request<SponsoredFarmsResponse>(\n `/farms/sponsored${query}`\n );\n return data.farms ?? [];\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchWalletFarmsWithRewards = async (\n walletAddress: string\n ): Promise<FarmWithRewards[]> => {\n try {\n if (!walletAddress) {\n throw new Error(\"Wallet address is required\");\n }\n\n const data = await request<WalletFarmsWithRewardsResponse>(\n `/farms/wallet/${encodeURIComponent(walletAddress)}/farms-with-rewards`\n );\n return data.farms ?? [];\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchFarmWeeklyRewards = async (\n farmId: string,\n query?: FarmWeeklyRewardsQuery\n ): Promise<FarmWeeklyRewardsResponse> => {\n try {\n if (!farmId) {\n throw new Error(\"Farm ID is required\");\n }\n\n const params = new URLSearchParams();\n if (query?.startWeek !== undefined)\n params.set(\"startWeek\", query.startWeek.toString());\n if (query?.endWeek !== undefined)\n params.set(\"endWeek\", query.endWeek.toString());\n if (query?.paymentCurrency)\n params.set(\"paymentCurrency\", query.paymentCurrency);\n if (query?.limit !== undefined)\n params.set(\"limit\", query.limit.toString());\n\n const queryString = params.toString();\n const path = `/farms/${encodeURIComponent(farmId)}/weekly-rewards${\n queryString ? `?${queryString}` : \"\"\n }`;\n\n return await request<FarmWeeklyRewardsResponse>(path);\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const estimateRewardScore = async (\n params: EstimateRewardScoreParams\n ): Promise<RewardScoreResponse> => {\n try {\n sentryAddBreadcrumb({\n category: \"control-api\",\n message: \"POST /farms/estimate-reward-score\",\n level: \"info\",\n data: { baseUrl, regionId: params.regionId, userId: params.userId },\n });\n const data = await request<\n RewardScoreResponse | EstimateRewardScoreErrorResponse\n >(\"/farms/estimate-reward-score\", {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(params),\n });\n\n // Check if it's an error response\n if (\"error\" in data) {\n throw new Error(data.error);\n }\n\n // At this point, TypeScript knows it's RewardScoreResponse\n // All fields are required in the success response based on the API spec\n return data as RewardScoreResponse;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"estimateRewardScore\",\n baseUrl,\n userId: params.userId,\n regionId: params.regionId,\n paymentCurrency: params.paymentCurrency,\n });\n throw new Error(parseApiError(error));\n }\n };\n\n const estimateRewardScoresBatch = async (\n params: EstimateRewardScoresBatchParams\n ): Promise<EstimateRewardScoresBatchResponse> => {\n try {\n sentryAddBreadcrumb({\n category: \"control-api\",\n message: \"POST /farms/estimate-reward-scores-batch\",\n level: \"info\",\n data: { baseUrl },\n });\n const data = await request<EstimateRewardScoresBatchResponse>(\n \"/farms/estimate-reward-scores-batch\",\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(params),\n }\n );\n\n return data;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"estimateRewardScoresBatch\",\n baseUrl,\n farmsCount: params.farms?.length,\n });\n throw new Error(parseApiError(error));\n }\n };\n\n const calculateMiningScoresBatch = async (\n params: MiningScoresBatchParams\n ): Promise<MiningScoresBatchResponse> => {\n try {\n sentryAddBreadcrumb({\n category: \"control-api\",\n message: \"POST /farms/mining-scores-batch\",\n level: \"info\",\n data: { baseUrl },\n });\n const data = await request<MiningScoresBatchResponse>(\n \"/farms/mining-scores-batch\",\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(params),\n }\n );\n\n return data;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"calculateMiningScoresBatch\",\n baseUrl,\n farmsCount: params.farms?.length,\n });\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchEfficiencyScores = async (\n farmId?: string\n ): Promise<FarmEfficiencyScore[] | FarmEfficiencyScore> => {\n try {\n const query = farmId ? `?farmId=${encodeURIComponent(farmId)}` : \"\";\n const data = await request<\n | FarmEfficiencyScore[]\n | SingleEfficiencyScoreResponse\n | EfficiencyScoresErrorResponse\n >(`/farms/efficiency-scores${query}`);\n\n if (\"error\" in data) {\n throw new Error(data.error);\n }\n\n return data as FarmEfficiencyScore[] | FarmEfficiencyScore;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchFarmWeeklyRewardsBatch = async (\n params: FarmWeeklyRewardsBatchQuery\n ): Promise<FarmWeeklyRewardsBatchResponse> => {\n try {\n sentryAddBreadcrumb({\n category: \"control-api\",\n message: \"POST /farms/rewards-history/batch\",\n level: \"info\",\n data: { baseUrl, farmsCount: params.farmIds?.length },\n });\n\n const data = await request<FarmWeeklyRewardsBatchResponse>(\n \"/farms/rewards-history/batch\",\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(params),\n }\n );\n\n return data;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"fetchFarmWeeklyRewardsBatch\",\n baseUrl,\n farmsCount: params.farmIds?.length,\n });\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchWalletFarmRewardsHistory = async (\n walletAddress: string,\n query?: WalletFarmRewardsHistoryQuery\n ): Promise<WalletFarmRewardsHistoryResponse> => {\n try {\n if (!walletAddress) {\n throw new Error(\"Wallet address is required\");\n }\n\n const params = new URLSearchParams();\n if (query?.startWeek !== undefined)\n params.set(\"startWeek\", query.startWeek.toString());\n if (query?.endWeek !== undefined)\n params.set(\"endWeek\", query.endWeek.toString());\n\n const queryString = params.toString();\n const path = `/farms/by-wallet/${encodeURIComponent(\n walletAddress\n )}/farm-rewards-history${queryString ? `?${queryString}` : \"\"}`;\n\n return await request<WalletFarmRewardsHistoryResponse>(path);\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchWalletFarmRewardsHistoryBatch = async (\n params: WalletFarmRewardsHistoryBatchQuery\n ): Promise<WalletFarmRewardsHistoryBatchResponse> => {\n try {\n sentryAddBreadcrumb({\n category: \"control-api\",\n message: \"POST /farms/by-wallet/farm-rewards-history/batch\",\n level: \"info\",\n data: { baseUrl, walletsCount: params.wallets?.length },\n });\n\n const data = await request<WalletFarmRewardsHistoryBatchResponse>(\n \"/farms/by-wallet/farm-rewards-history/batch\",\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(params),\n }\n );\n\n return data;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"fetchWalletFarmRewardsHistoryBatch\",\n baseUrl,\n walletsCount: params.wallets?.length,\n });\n throw new Error(parseApiError(error));\n }\n };\n\n return {\n fetchFarmRewardSplits,\n fetchSponsoredFarms,\n fetchWalletFarmsWithRewards,\n fetchFarmWeeklyRewards,\n estimateRewardScore,\n estimateRewardScoresBatch,\n calculateMiningScoresBatch,\n fetchEfficiencyScores,\n fetchFarmWeeklyRewardsBatch,\n fetchWalletFarmRewardsHistory,\n fetchWalletFarmRewardsHistoryBatch,\n } as const;\n}\n","import Decimal from \"decimal.js\";\n\n/**\n * Calculates the efficiency score for a farm\n *\n * Formula: efficiencyScore = (CC / PD) / 100,000\n *\n * Where:\n * - CC = weekly carbon credits in WAD format (18 decimals)\n * - PD = protocol deposit in USD (6 decimals)\n *\n * Due to the decimal difference (CC has 18 decimals, PD has 6 decimals),\n * the actual calculation maintains a 10^12 factor, resulting in:\n * efficiencyScore = (CC_actual / PD_actual) × 10^8\n *\n * The efficiency score represents carbon credits produced per $100,000 of\n * protocol deposit per week. Higher scores indicate more efficient farms.\n *\n * @param protocolDepositUsd6 - Protocol deposit in USD (6 decimals)\n * @param weeklyImpactAssetsWad - Weekly carbon credits in WAD format (18 decimals)\n * @returns The efficiency score as a number\n *\n * @example\n * ```typescript\n * const score = calculateFarmEfficiency(5000000000n, 1500000000000000000n);\n * // Returns the efficiency score\n * ```\n */\nexport function calculateFarmEfficiency(\n protocolDepositUsd6: bigint,\n weeklyImpactAssetsWad: bigint\n): number {\n // Handle zero carbon credits case\n if (weeklyImpactAssetsWad === 0n) {\n return 0;\n }\n\n // Convert to Decimal for precise calculation\n const pdDecimal = new Decimal(protocolDepositUsd6.toString());\n const ccDecimal = new Decimal(weeklyImpactAssetsWad.toString());\n\n // Formula: efficiencyScore = (CC / PD) / 100,000\n // CC is in 18 decimals, PD is in 6 decimals\n // Direct division: (CC / PD) / 100,000\n const efficiencyDecimal = ccDecimal.div(pdDecimal).div(100000);\n\n return efficiencyDecimal.toNumber();\n}\n"],"names":["STAKING_DIRECTIONS","REGIONS","KICKSTARTER_STATUS","ForwarderError","Contract","MaxUint256","formatEther","OffchainFractionsError","assertWalletClient","RewardsKernelError","parseApiError"],"mappings":";;;;;;AAAO,MAAM,OAAO,GAAG;AAE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AAY,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM;AACrC,aAAA,CAAC;YACF,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACvC;AACF,IAAA,CAAC;IAED,OAAO;QACL,qBAAqB;QACrB,mBAAmB;QACnB,2BAA2B;QAC3B,sBAAsB;QACtB,mBAAmB;QACnB,yBAAyB;QACzB,0BAA0B;QAC1B,qBAAqB;QACrB,2BAA2B;QAC3B,6BAA6B;QAC7B,kCAAkC;KAC1B;AACZ;;AChXA;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;AACG,SAAU,uBAAuB,CACrC,mBAA2B,EAC3B,qBAA6B,EAAA;;AAG7B,IAAA,IAAI,qBAAqB,KAAK,EAAE,EAAE;AAChC,QAAA,OAAO,CAAC;IACV;;IAGA,MAAM,SAAS,GAAG,IAAI,OAAO,CAAC,mBAAmB,CAAC,QAAQ,EAAE,CAAC;IAC7D,MAAM,SAAS,GAAG,IAAI,OAAO,CAAC,qBAAqB,CAAC,QAAQ,EAAE,CAAC;;;;AAK/D,IAAA,MAAM,iBAAiB,GAAG,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;AAE9D,IAAA,OAAO,iBAAiB,CAAC,QAAQ,EAAE;AACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"calculate-farm-efficiency-DabpqtXj.js","sources":["../../src/constants/urls.ts","../../src/constants/weights.ts","../../src/lib/types/index.ts","../../src/lib/abis/forwarderABI.ts","../../src/lib/abis/erc20.abi.ts","../../src/constants/addresses.ts","../../src/utils/transaction-utils.ts","../../src/utils/sentry.ts","../../src/lib/hooks/use-forwarder.ts","../../src/lib/abis/offchainFractions.ts","../../src/lib/hooks/use-offchain-fractions.ts","../../src/lib/abis/rewardKernelABI.ts","../../src/lib/hooks/use-rewards-kernel.ts","../../src/lib/control-api/control-router.ts","../../src/utils/generate-slug.ts","../../src/lib/region-metadata.ts","../../src/lib/control-api/region-router.ts","../../src/lib/control-api/kickstarter-router.ts","../../src/lib/control-api/wallets-router.ts","../../src/lib/control-api/farms-router.ts","../../src/utils/calculate-farm-efficiency.ts"],"sourcesContent":["export const HUB_URL = \"https://glow.org\";\n\nexport const GCA_URLS = [\"http://95.217.194.59:35015\"];\n","/**\n * @dev This is actually not as intuitive as it seems.\n * Glow actually has 18 decimals, but glow weight is based on the amount of protocol fees (USDC) that the farm paid\n * Therefore, the weight is based on the amount of USDC that was paid, which has 8 decimals\n */\nexport const GLOW_WEIGHT_DECIMAL_PRECISION = 8;\n\n/**\n * @dev This is actually not as intuitive as it seems.\n * USDG weight is based on the amount of carbon credits produced, but the max value of a weight is ((2*64)-1) / 5 so we need to choose sensible precision to make sure that number never overflows\n */\nexport const USDG_WEIGHT_DECIMAL_PRECISION = 8;\n\nexport const MAX_WEIGHT: bigint =\n (BigInt(2) ** BigInt(64) - BigInt(1)) / BigInt(5);\n","// ---------------------------------------------------------------------------\n// Common / Shared Types\n// ---------------------------------------------------------------------------\n\nexport enum STAKING_DIRECTIONS {\n STAKE = \"stake\",\n UNSTAKE = \"unstake\",\n RESTAKE = \"restake\",\n IMMEDIATE_UNSTAKE = \"immediate_unstake\",\n}\n\nexport type StakingDirection =\n (typeof STAKING_DIRECTIONS)[keyof typeof STAKING_DIRECTIONS];\n\nexport enum REGIONS {\n CLEAN_GRID_PROJECT = 1,\n UTAH = 2,\n MISSOURI = 3,\n COLORADO = 4,\n}\n\nexport const PAYMENT_CURRENCIES = [\n \"GCTL\",\n \"USDC\",\n \"USDG\",\n \"GLW\",\n \"SGCTL\",\n] as const;\n\nexport const OFF_CHAIN_PAYMENT_CURRENCIES = [\"SGCTL\", \"GCTL\"] as const;\nexport type PaymentCurrency = (typeof PAYMENT_CURRENCIES)[number];\nexport type OffChainPaymentCurrency =\n (typeof OFF_CHAIN_PAYMENT_CURRENCIES)[number];\n\n// ----------------------------- Control-API ----------------------------------\nexport interface MintedEvent {\n txId: string;\n epoch: number;\n wallet: string;\n amountRaw: string;\n currency: string;\n gctlMinted: string;\n ts: string; // ISO date string\n}\n\nexport interface StakedEvent {\n id: string;\n epoch: number;\n wallet: string;\n regionId: number;\n regionName: string;\n amount: string;\n direction: \"stake\" | \"unstake\" | \"restake\";\n ts: string; // ISO date string\n}\n\nexport interface PendingTransfer {\n txId: string;\n wallet: string;\n amountRaw: string;\n type: string;\n currency: string;\n status: string;\n ts: string; // ISO date string\n applicationId?: string;\n farmId?: string;\n regionId?: number;\n kickstarterId?: string;\n}\n\nexport const TRANSFER_TYPES = {\n PayProtocolFeeAndMintGCTLAndStake: \"PayProtocolFeeAndMintGCTLAndStake\",\n PayProtocolFee: \"PayProtocolFee\",\n PayAuditFees: \"PayAuditFees\",\n CommitKickstarter: \"CommitKickstarter\",\n MintGCTLAndStake: \"MintGCTLAndStake\",\n MintGCTL: \"MintGCTL\",\n BuySolarFarm: \"BuySolarFarm\",\n SponsorProtocolFee: \"SponsorProtocolFee\",\n SponsorProtocolFeeAndMintGCTLAndStake:\n \"SponsorProtocolFeeAndMintGCTLAndStake\",\n PayProtocolDepositUsingStakedControl: \"PayProtocolDepositUsingStakedControl\",\n} as const;\n\n// Pending transfer type filter for listing endpoint\nexport type PendingTransferType =\n (typeof TRANSFER_TYPES)[keyof typeof TRANSFER_TYPES];\n\nexport interface TransferDetails extends PendingTransfer {\n blockNumber: string;\n failureInfo?: {\n failureType: string;\n errorMessage: string;\n errorDetails?: string;\n isRetryable: boolean;\n retryCount: number;\n lastRetryAt?: string; // ISO date string\n };\n}\n\nexport interface FailedOperation {\n id: string;\n txId: string;\n operation: string;\n failureType: string;\n errorMessage: string;\n errorDetails?: string;\n isRetryable: string;\n retryCount: number;\n lastRetryAt?: string; // ISO date string\n resolvedAt?: string; // ISO date string\n wallet?: string;\n amountRaw?: string;\n currency?: string;\n createdAt: string; // ISO date string\n updatedAt: string; // ISO date string\n}\n\nexport interface GctlPrice {\n currentPriceUsdc: string;\n}\n\n// Price response for GLW token (mirrors GctlPrice structure)\nexport interface GlwPrice {\n currentPriceUsdc: string;\n}\n\nexport interface WalletNonce {\n wallet: string;\n lastNonce: string;\n}\n\nexport interface GctlSupply {\n circulatingSupply: string;\n}\n\nexport interface StakeRequest {\n wallet: string;\n regionId: number;\n amount: string; // Amount in atomic units (10^6 = 1 GCTL)\n signature: string; // 0x-prefixed 65-byte hex signature\n deadline: string; // unix timestamp (as string)\n nonce: string; // stringified integer\n}\n\nexport interface RestakeRequest {\n wallet: string; // 0x-prefixed 40-char hex\n fromZoneId: number; // Source region ID\n toZoneId: number; // Destination region ID\n amount: string; // Amount in atomic units (10^6 = 1 GCTL)\n signature: string; // 0x-prefixed 65-byte hex signature\n deadline: string; // unix timestamp (as string)\n nonce: string; // stringified integer\n}\n\nexport interface RegionStake {\n regionId: number;\n currentGctlStake: string;\n}\n\nexport interface WalletRegionStake {\n wallet: string;\n regionId: number;\n currentGctlStake: string;\n}\n\nexport interface WalletRegionUnlocked {\n wallet: string;\n regionId: number;\n unlocked: string;\n}\n\nexport interface WalletRegionCommittedBalance {\n wallet: string;\n regionId: number;\n gctl_committed_balance: string;\n}\n\n// ----------------------------- Regions --------------------------------------\n// A superset of fields coming from both control-api regions and regions-service.\nexport interface Region {\n id: number;\n name: string;\n isUs: boolean;\n bannerUrl: string;\n description: string;\n slug: string;\n code: string;\n createdAt: Date;\n}\n\nexport interface RegionWithMetadata extends Region {\n isActive: boolean;\n staked: string;\n activationStakeThreshold: string;\n solarFarmCount: number;\n solarPanelsQuantity: number;\n activationSolarFarmThreshold: number;\n installerCount: number;\n activationInstallerThreshold: number;\n efficiencyScore: number; // Carbon credits per $100,000 deposit/week (aggregated)\n}\n\nexport interface ActivationConfig {\n duration: number; // number of days\n minimumAmountOfGCTL: number;\n minimumAmountOfFarms: number;\n minimumAmountOfInstallers: number;\n}\n\nexport interface CreateRegionPayload {\n code: string;\n name: string;\n isUs: boolean;\n}\n\n// ----------------------------- Region Metadata -----------------------------\nexport interface RegionMetadata {\n code: string;\n name: string;\n description: string;\n isUs: boolean;\n flag?: string;\n}\n\n// ----------------------------- Kickstarters ---------------------------------\nexport enum KICKSTARTER_STATUS {\n DRAFT = \"draft\",\n COLLECTING_SUPPORT = \"collecting-support\",\n COMPLETED = \"completed\",\n FAILED = \"failed\",\n CANCELLED = \"cancelled\",\n}\n\nexport type KickstarterStatus =\n (typeof KICKSTARTER_STATUS)[keyof typeof KICKSTARTER_STATUS];\nexport interface CreateKickstarterPayload {\n creatorWallet: string;\n regionName: string;\n title: string;\n description: string;\n code: string; // region code (e.g., \"US-FL\", \"US\", \"CA\")\n bannerUrl: string;\n}\n\nexport interface KickstarterCreateResponse {\n success: true;\n id: string;\n}\n\nexport interface Kickstarter {\n id: string;\n regionId: number | null;\n code: string;\n creatorWallet: string;\n title: string;\n description: string;\n slug: string;\n bannerUrl: string;\n status: KickstarterStatus | string;\n createdAt: string; // ISO 8601\n updatedAt: string; // ISO 8601\n publishedAt?: string; // ISO 8601\n completedAt?: string; // ISO 8601\n cancelledAt?: string; // ISO 8601\n expiredAt?: string; // ISO 8601\n deadline: string; // ISO 8601\n stakeTargetGctl: string; // atomic units (GCTL scaled by 10^6)\n requiredFarmCount: number;\n requiredInstallerCount: number;\n stakeContributed: boolean;\n farmProvided: boolean;\n installerCertified: boolean;\n kickoffTransferTxId?: string;\n kickoffMintTxId?: string;\n}\n\nexport interface KickstarterDetails extends Kickstarter {\n contributorsCount: number;\n farmCount: number;\n solarFarmApplications: SolarFarmApplication[];\n sponsoredFarms: SponsoredFarm[];\n}\n\nexport interface CommitKickstarterPayload {\n wallet: string; // 0x-prefixed 40-char hex\n amount: string; // atomic GCTL, must equal stakeTargetGctl/KICKSTARTER_STAKE_PERCENTAGE\n nonce: string; // uint256 as string\n deadline: string; // unix seconds as string\n signature: string; // 0x-prefixed 65-byte hex\n}\n\nexport interface CommitKickstarterResponse {\n success: true;\n regionId: number;\n}\n\nexport interface KickstarterCommitmentEvent {\n id: string;\n epoch: number;\n wallet: string;\n regionId: number;\n amount: string; // atomic GCTL (6 decimals)\n ts: string; // ISO 8601\n isFinalized: boolean;\n isRefunded: boolean;\n}\n\nexport interface KickstarterCommitmentsQuery {\n page?: number; // default 1\n limit?: number; // default 50, max 100\n finalized?: boolean; // optional filter on isFinalized\n}\n\nexport interface KickstarterCommitmentsResponse {\n page: number;\n limit: number;\n events: KickstarterCommitmentEvent[];\n}\n\nexport interface ActivationEvent {\n id: string;\n regionId: number;\n epoch: number;\n stakeThresholdMet: boolean;\n solarFarmRequirementMet: boolean;\n installerRequirementMet: boolean;\n activated: boolean;\n ts: string; // ISO 8601\n}\n\n// ----------------------------- Region VCR View ------------------------------\nexport interface FarmRewardSplit {\n walletAddress: string;\n glowSplitPercent6Decimals: string;\n depositSplitPercent6Decimals: string;\n}\n\nexport interface SponsoredFarm {\n farmId: string;\n regionId: number;\n name: string;\n location: string;\n certifiedInstallerId: string | null;\n kwhCapacity: string;\n solarPanelsQuantity: number;\n expectedWeeklyCarbonCredits: string;\n protocolDepositUSDC6Decimals: string;\n protocolDepositPaidAmount: string;\n protocolDepositPaidCurrency: string;\n\n builtEpoch: number;\n builtAt: string;\n afterInstallPictures: {\n id: string;\n name: string;\n url: string;\n isShowingSolarPanels: boolean;\n }[];\n rewardSplits: FarmRewardSplit[];\n}\n\nexport interface SolarFarmApplication {\n applicationId: string;\n farmId: string | null;\n farmOwnerWallet: string;\n regionId: number;\n gcaWallet: string;\n protocolDepositUSDC6Decimals: string;\n status: \"audit_fees_paid\" | \"completed\";\n createdAt: string;\n}\n\nexport interface RegionDetails extends RegionWithMetadata {\n sponsoredFarms: SponsoredFarm[];\n solarFarmApplications: SolarFarmApplication[];\n carbonCreditsIssued: number;\n carbonCreditsPerWeek: number;\n}\n\nexport interface ActiveRegionDataPoint {\n epoch: number;\n timestamp: number;\n gctlStaked: string;\n pendingUnstake: string;\n pendingRestakeOut: string;\n pendingRestakeIn: string;\n netPending: string;\n eventCount: number;\n firstEventTimestamp?: number;\n lastEventTimestamp?: number;\n}\n\nexport interface ActiveRegionSummary {\n id: number;\n name: string;\n code: string;\n slug: string;\n isUs: boolean;\n currentGctlStaked: string;\n glwRewardPerWeek: string;\n rewardShare: string;\n data: ActiveRegionDataPoint[];\n}\n\nexport interface ActiveRegionsSummaryResponse {\n metadata: {\n epochs: number[];\n epochTimestamps: { [epoch: string]: number };\n currentEpoch: number;\n };\n total: {\n totalGctlStaked: string;\n totalGlwRewards: string;\n };\n regions: ActiveRegionSummary[];\n aggregate: {\n epochs: number[];\n timestamps: number[];\n totalGctlStaked: string[];\n eventTypes: string[];\n regionIds: number[];\n };\n}\n\nexport interface RegionActivityPeriod {\n stakes: number;\n unstakes: number;\n restakes: number;\n immediateUnstakes: number;\n netChange: string; // atomic units (can be negative)\n}\n\nexport interface RegionActivity {\n regionId: number;\n regionName: string;\n last24h: RegionActivityPeriod;\n last7d: RegionActivityPeriod;\n}\n\nexport interface RecentRegionActivityResponse {\n activity: RegionActivity[];\n}\n\nexport interface InstallerApplicationPayload {\n wallet: string;\n signature: string;\n nonce: string;\n regionId: string;\n deadline: string;\n}\n\nexport interface InstallerApplicationResponse {\n certified: boolean;\n}\n\n// ----------------------------- API Responses --------------------------------\nexport interface RegionsResponse {\n regions: RegionWithMetadata[];\n}\n\nexport interface RegionResponse {\n region: RegionDetails;\n}\n\nexport interface ActivationEventsResponse {\n events: ActivationEvent[];\n}\n\nexport interface RegionSolarFarmsResponse {\n sponsoredFarms: SponsoredFarm[];\n}\n\nexport interface SponsoredFarmsResponse {\n farms: SponsoredFarm[];\n}\n\nexport interface FetchRegionsParams {\n isActive?: boolean;\n}\n\n// ----------------------------- Control-API Paginated -------------------------\nexport interface PaginatedParams {\n page?: number; // 1-indexed\n limit?: number; // max 100\n}\n\nexport interface MintedEventsResponse {\n page: number;\n limit: number;\n events: MintedEvent[];\n}\n\nexport interface StakeEventsQuery extends PaginatedParams {\n regionId?: number;\n}\n\nexport interface StakeEventsResponse {\n page: number;\n limit: number;\n events: StakedEvent[];\n}\n\nexport interface PendingTransfersQuery extends PaginatedParams {\n type?: PendingTransferType;\n}\n\nexport interface PendingTransfersResponse {\n page: number;\n limit: number;\n transfers: PendingTransfer[];\n}\n\nexport interface FailedOperationsResponse {\n page: number;\n limit: number;\n operations: FailedOperation[];\n}\n\n// ----------------------------- GLW Rewards -----------------------------------\nexport interface GlwRegionReward {\n regionId: number;\n gctlStaked: string;\n glwReward: string;\n rewardShare: string; // WAD (1e18 = 100%)\n}\n\nexport interface GlwRegionRewardsResponse {\n totalGctlStaked: string;\n totalGlwRewards: string;\n regionRewards: GlwRegionReward[];\n}\n\n// ----------------------------- Wallets --------------------------------------\nexport interface ControlWallet {\n address: string;\n controlBalance: string;\n committedControl: string;\n stakedControl: string;\n createdAt: string; // ISO 8601\n}\n\nexport interface WalletsResponse {\n wallets: ControlWallet[];\n}\n\nexport interface WalletRegionStakeTotal {\n regionId: number;\n totalStaked: string;\n pendingUnstake: string;\n pendingRestakeOut: string;\n region?: {\n id: number;\n name: string;\n code: string;\n slug: string;\n isUs: boolean;\n isActivated: boolean;\n bannerUrl: string;\n description: string;\n createdAt: string; // ISO 8601\n };\n}\n\nexport interface WalletFarmInfo {\n farmId: string;\n regionId: number;\n name: string;\n location: string;\n kwhCapacity: string;\n solarPanelsQuantity: number;\n expectedWeeklyCarbonCredits: string;\n protocolDepositPaidAmount: string;\n protocolDepositPaidCurrency: string;\n\n builtEpoch: number;\n builtAt?: string; // ISO 8601\n glowSplitPercent6Decimals: string; // Wallet's GLW reward split (6 decimals)\n depositSplitPercent6Decimals: string; // Wallet's deposit reward split (6 decimals)\n}\n\nexport interface WalletDetails {\n wallet: string;\n controlBalance: string;\n committedControl: string;\n stakedControl: string;\n createdAt: string; // ISO 8601\n regions: WalletRegionStakeTotal[];\n ownedFarms: WalletFarmInfo[];\n}\n\nexport interface WeeklyReward {\n weekNumber: number;\n paymentCurrency: PaymentCurrency;\n protocolDepositRewardsReceived: string; // Protocol deposit rewards received by wallet\n glowInflationTotal: string; // GLW inflation rewards (18 decimals)\n v1MerkleRoot: string; // V1 merkle root for week's reward distribution (hex string)\n v2MerkleRoot: string; // V2 merkle root for week's reward distribution (hex string)\n}\n\nexport interface WeeklyRewardsSummary {\n totalProtocolDepositRewardsReceived: string;\n totalGlowInflation: string;\n weeksActive: number;\n}\n\nexport interface WalletWeeklyRewardsResponse {\n wallet: string;\n summary: WeeklyRewardsSummary;\n rewards: WeeklyReward[];\n}\n\nexport interface WeeklyRewardsQuery {\n startWeek?: number; // Inclusive lower bound epoch/week\n endWeek?: number; // Inclusive upper bound epoch/week\n paymentCurrency?: PaymentCurrency; // Filter by payment currency\n limit?: number; // Max rows to return (default 52, capped at 520)\n}\n\n// ----------------------------- Farm Weekly Rewards ---------------------------\nexport interface FarmWeeklyReward {\n weekNumber: number;\n paymentCurrency: PaymentCurrency;\n protocolDepositPaidTotal: string; // Total amount farm paid as protocol deposit\n glowInflationTotal: string; // Total GLW inflation rewards allocated to farm (18 decimals)\n expectedProductionTotal: string; // Farm's weekly carbon credit production in WAD (18 decimals)\n protocolDepositRewardsDistributed: string; // Portion of protocol deposits distributed to wallets\n}\n\nexport interface FarmWeeklyRewardsSummary {\n totalProtocolDepositPaid: string;\n totalGlowInflation: string;\n totalExpectedProduction: string;\n weeksActive: number;\n}\n\nexport interface FarmWeeklyRewardsResponse {\n farmId: string;\n summary: FarmWeeklyRewardsSummary;\n rewards: FarmWeeklyReward[];\n}\n\nexport interface FarmWeeklyRewardsQuery {\n startWeek?: number; // Inclusive lower bound epoch/week\n endWeek?: number; // Inclusive upper bound epoch/week\n paymentCurrency?: PaymentCurrency; // Filter by payment currency\n limit?: number; // Max rows to return (default 52, capped at 520)\n}\n\n// ----------------------------- Region Weekly Rewards -------------------------\nexport interface RegionWeeklyReward {\n weekNumber: number;\n paymentCurrency: PaymentCurrency;\n protocolDepositPaidTotal: string; // Total amount paid by all farms in region as protocol deposit\n glowInflationTotal: string; // Total GLW inflation rewards allocated to region (18 decimals)\n expectedProductionTotal: string; // Region's total weekly carbon credit production in WAD (18 decimals)\n protocolDepositRewardsDistributed: string; // Always \"0\" for regions (tracked at farm level)\n createdAt?: string; // ISO 8601\n updatedAt?: string; // ISO 8601\n}\n\nexport interface RegionWeeklyRewardsSummary {\n totalProtocolDepositPaid: string;\n totalGlowInflation: string;\n totalExpectedProduction: string;\n weeksActive: number;\n}\n\nexport interface RegionWeeklyRewardsResponse {\n regionId: number;\n summary: RegionWeeklyRewardsSummary;\n rewards: RegionWeeklyReward[];\n}\n\nexport interface RegionWeeklyRewardsQuery {\n startWeek?: number; // Inclusive lower bound epoch/week\n endWeek?: number; // Inclusive upper bound epoch/week\n paymentCurrency?: PaymentCurrency; // Filter by payment currency\n limit?: number; // Max rows to return (default 52, capped at 520)\n}\n\n// ----------------------------- Farms Reward Score ---------------------------\nexport interface EstimateRewardScoreParams {\n userId: string;\n sponsorSplitPercent: number;\n protocolDepositAmount: string;\n paymentCurrency: PaymentCurrency;\n expectedWeeklyCarbonCredits: number;\n regionId: number;\n}\n\nexport interface RewardScoreResponse {\n rewardScore: number;\n userWeeklyPdRewards: string;\n userWeeklyPdRewardsUsd: string;\n userWeeklyGlwRewards: string;\n userWeeklyGlwValueUsd: string;\n userEstimatedWeeklyCash: string;\n userProtocolDeposit: string;\n userGlowSplitPercent: string;\n userDepositSplitPercent: string;\n glwPriceUsd6: string;\n regionInfo: {\n regionId: number;\n regionGctlStaked: string;\n totalGctlStakedAllRegions: string;\n };\n}\n\nexport interface EstimateRewardScoreErrorResponse {\n error: string;\n}\n\n// ----------------------------- Farms Batch Reward Score ---------------------\nexport interface EstimateRewardScoresBatchParams {\n farms: EstimateRewardScoreParams[];\n}\n\nexport interface BatchRewardScoreSuccessResult {\n success: true;\n data: RewardScoreResponse;\n}\n\nexport interface BatchRewardScoreFailureResult {\n success: false;\n error: string;\n farmData: {\n userId: string;\n regionId: number;\n paymentCurrency: string;\n };\n}\n\nexport type BatchRewardScoreResult =\n | BatchRewardScoreSuccessResult\n | BatchRewardScoreFailureResult;\n\nexport interface EstimateRewardScoresBatchResponse {\n results: BatchRewardScoreResult[];\n}\n\n// ----------------------------- Farms Mining Score ----------------------------\nexport interface MiningScoreParams {\n farmId: string; // The farm ID of the existing farm\n userId: string; // User's wallet address to calculate mining score for\n dollarCostOfMiner: string; // Dollar cost of the miner (USD with 6 decimals)\n numberOfMiners: number; // Number of miners in the farm\n minerRewardSplit: string; // Miner reward split percentage (6 decimals)\n}\n\nexport interface MiningScoresBatchParams {\n farms: MiningScoreParams[];\n}\n\nexport interface MiningScoreResponse {\n miningScore: number; // Mining score (calculated using farm's total GLW rewards)\n userWeeklyGlwRewards: string; // User's portion of weekly GLW rewards after split (18 decimals)\n glwPriceUsd6: string; // GLW price used in calculation (6 decimals)\n dollarCostOfMiner: string; // Dollar cost of miner (6 decimals)\n weeksOfMinerLifeRemaining: number; // Weeks of miner life remaining (calculated from farm's end reward period)\n regionInfo: {\n regionId: number;\n regionGctlStaked: string;\n totalGctlStakedAllRegions: string;\n };\n}\n\nexport interface BatchMiningScoreSuccessResult {\n success: true;\n data: MiningScoreResponse;\n}\n\nexport interface BatchMiningScoreFailureResult {\n success: false;\n error: string;\n farmData: {\n farmId: string;\n userId: string;\n };\n}\n\nexport type BatchMiningScoreResult =\n | BatchMiningScoreSuccessResult\n | BatchMiningScoreFailureResult;\n\nexport interface MiningScoresBatchResponse {\n results: BatchMiningScoreResult[];\n}\n\nexport interface MigrationAmountResponse {\n wallet: string;\n migrationAmount: string;\n claimed: boolean;\n eligible: boolean;\n}\n\n// ----------------------------- Wallet Farm Rewards ---------------------------\nexport interface UserWeeklyRewards {\n protocolDepositAsset: PaymentCurrency;\n protocolDepositRewards: string; // User's weekly protocol deposit rewards in the farm's payment currency\n glwInflationRewards: string; // User's weekly GLW inflation rewards (18 decimals)\n userGlowSplitPercent: string; // User's GLW split percentage (6 decimals)\n userDepositSplitPercent: string; // User's deposit split percentage (6 decimals)\n}\n\nexport interface FarmWithRewards extends SponsoredFarm {\n userWeeklyRewards: UserWeeklyRewards;\n}\n\nexport interface WalletFarmsWithRewardsResponse {\n farms: FarmWithRewards[];\n totalFarms: number;\n}\n\n// ----------------------------- Farm Reward Splits ----------------------------\nexport interface FarmRewardSplitsResponse {\n farmId: string;\n rewardSplits: FarmRewardSplit[];\n totalSplits: number;\n}\n\nexport interface FarmRewardSplitsErrorResponse {\n error: string;\n}\n\nexport interface HoldersCountResponse {\n holders: number;\n}\n\nexport interface RetryFailedOperationResponse {\n success?: boolean;\n queued?: boolean;\n}\n\n// ----------------------------- Wallet ToS -----------------------------------\nexport interface TosAcceptRequest {\n signature: string; // EIP-712 signature (0x-prefixed, 130 chars)\n nonce: string; // Unique nonce for replay protection\n tosVersion: string; // ToS version being accepted (e.g. \"1.0\")\n tosHash: string; // Keccak256 hash of ToS content (0x-prefixed, 64 chars)\n message: string; // Full message that was signed\n deadline: string; // Signature expiry timestamp (unix seconds as string)\n}\n\nexport interface TosAcceptResponse {\n success: boolean;\n version: string; // ToS version accepted\n acceptedAt: string; // ISO 8601 timestamp\n}\n\nexport interface TosStatusResponse {\n hasAccepted: boolean; // Has the wallet ever accepted any ToS version\n currentVersion: string; // Current active ToS version (e.g. \"1.0\")\n acceptedVersion?: string; // Version the wallet accepted (if any)\n needsReAcceptance: boolean; // True if wallet needs to accept current version\n acceptedAt?: string; // ISO 8601 timestamp of acceptance (if any)\n}\n\n// ----------------------------- Farm Efficiency Scores ------------------------\nexport interface FarmEfficiencyScore {\n farmId: string;\n name: string; // Farm name\n regionId: number; // Region ID where the farm is located\n builtEpoch: number; // Epoch when the farm was built\n efficiencyScore: number;\n protocolDepositUsd6: string;\n weeklyImpactAssetsWad: string;\n}\n\nexport interface EfficiencyScoresResponse {\n farms: FarmEfficiencyScore[];\n}\n\nexport interface SingleEfficiencyScoreResponse extends FarmEfficiencyScore {}\n\nexport interface EfficiencyScoresErrorResponse {\n error: string;\n}\n\n// ----------------------------- Batch Farm Weekly Rewards --------------------\nexport interface FarmWeeklyRewardsBatchQuery {\n farmIds: string[]; // Array of farm IDs (max 100)\n startWeek?: number; // Optional: Inclusive starting week (epoch number)\n endWeek?: number; // Optional: Inclusive ending week (epoch number)\n}\n\nexport interface FarmWeeklyRewardsBatchResult {\n regionId: number; // Region ID where the farm is located\n builtAt: string; // ISO 8601 timestamp when the farm was built\n builtEpoch: number; // Epoch number when the farm was built\n summary: FarmWeeklyRewardsSummary;\n rewards: FarmWeeklyReward[];\n}\n\nexport interface FarmWeeklyRewardsBatchErrorResult {\n error: string;\n}\n\nexport interface FarmWeeklyRewardsBatchResponse {\n results: Record<\n string,\n FarmWeeklyRewardsBatchResult | FarmWeeklyRewardsBatchErrorResult\n >;\n}\n\n// ----------------------------- Wallet Farm Rewards History ------------------\nexport interface WalletFarmReward {\n farmId: string;\n farmName: string;\n regionId: number; // Region ID where the farm is located\n builtAt: string; // ISO 8601 timestamp when the farm was built\n builtEpoch: number; // Epoch number when the farm was built\n expectedWeeklyCarbonCredits: string; // Decimal format\n protocolDepositUSDC6Decimals: string; // 6 decimals\n weekNumber: number;\n walletTotalGlowInflationReward: string; // 18 decimals\n walletTotalProtocolDepositReward: string; // Currency's native decimals\n asset: PaymentCurrency;\n inflationSplitFromLaunchpad: number; // Decimal (e.g., 0.001529 = 0.1529%)\n inflationSplitFromMiningCenter: number;\n depositSplitFromLaunchpad: number;\n depositSplitFromMiningCenter: number;\n walletInflationFromLaunchpad: string; // 18 decimals\n walletProtocolDepositFromLaunchpad: string; // Currency's native decimals\n walletInflationFromMiningCenter: string; // 18 decimals\n walletProtocolDepositFromMiningCenter: string; // Currency's native decimals\n farmTotalInflation: string; // 18 decimals\n farmTotalProtocolDepositReward: string; // Currency's native decimals\n}\n\nexport interface WalletFarmRewardsHistoryQuery {\n startWeek?: number; // Inclusive lower bound epoch/week\n endWeek?: number; // Inclusive upper bound epoch/week\n}\n\nexport interface WalletFarmRewardsHistoryResponse {\n walletAddress: string;\n weekRange: {\n startWeek: number;\n endWeek: number;\n };\n farmRewards: WalletFarmReward[];\n}\n\n// ----------------------------- Batch Wallet Farm Rewards History ------------\nexport interface WalletFarmRewardsHistoryBatchQuery {\n wallets: string[]; // Array of wallet addresses (max 1000)\n startWeek?: number; // Optional: Inclusive starting week (epoch number)\n endWeek?: number; // Optional: Inclusive ending week (epoch number)\n}\n\nexport interface WalletFarmRewardsHistoryBatchResult {\n weekRange: {\n startWeek: number;\n endWeek: number;\n };\n farmRewards: WalletFarmReward[];\n}\n\nexport interface WalletFarmRewardsHistoryBatchResponse {\n results: Record<string, WalletFarmRewardsHistoryBatchResult>;\n}\n\n// ---------------------------------------------------------------------------\n// Barrel exports (convenience)\n// ---------------------------------------------------------------------------\nexport type { MintedEvent as ControlMintedEvent };\n","export const FORWARDER_ABI = [\n {\n inputs: [\n { internalType: \"contract USDG\", name: \"_usdg\", type: \"address\" },\n { internalType: \"contract IERC20\", name: \"_usdc\", type: \"address\" },\n {\n internalType: \"contract CounterfactualHolderFactory\",\n name: \"_cfhFactory\",\n type: \"address\",\n },\n ],\n stateMutability: \"payable\",\n type: \"constructor\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"target\", type: \"address\" }],\n name: \"AddressEmptyCode\",\n type: \"error\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"account\", type: \"address\" }],\n name: \"AddressInsufficientBalance\",\n type: \"error\",\n },\n { inputs: [], name: \"FailedInnerCall\", type: \"error\" },\n { inputs: [], name: \"MaxLengthExceeded\", type: \"error\" },\n { inputs: [], name: \"ReentrancyGuardReentrantCall\", type: \"error\" },\n {\n inputs: [{ internalType: \"address\", name: \"token\", type: \"address\" }],\n name: \"SafeERC20FailedOperation\",\n type: \"error\",\n },\n { inputs: [], name: \"ZeroAmount\", type: \"error\" },\n {\n anonymous: false,\n inputs: [\n { indexed: true, internalType: \"address\", name: \"from\", type: \"address\" },\n { indexed: true, internalType: \"address\", name: \"to\", type: \"address\" },\n {\n indexed: true,\n internalType: \"address\",\n name: \"token\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"amount\",\n type: \"uint256\",\n },\n {\n indexed: false,\n internalType: \"string\",\n name: \"message\",\n type: \"string\",\n },\n ],\n name: \"Forward\",\n type: \"event\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"token\", type: \"address\" },\n { internalType: \"address\", name: \"to\", type: \"address\" },\n { internalType: \"uint256\", name: \"amount\", type: \"uint256\" },\n {\n internalType: \"bool\",\n name: \"sendToCounterfactualWallet\",\n type: \"bool\",\n },\n { internalType: \"string\", name: \"message\", type: \"string\" },\n ],\n name: \"forward\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"i_CFHFactory\",\n outputs: [\n {\n internalType: \"contract CounterfactualHolderFactory\",\n name: \"\",\n type: \"address\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"i_USDC\",\n outputs: [{ internalType: \"contract IERC20\", name: \"\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"i_USDG\",\n outputs: [{ internalType: \"contract USDG\", name: \"\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"nextNonce\",\n outputs: [{ internalType: \"uint256\", name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"uint256\", name: \"amount\", type: \"uint256\" },\n { internalType: \"address\", name: \"to\", type: \"address\" },\n {\n internalType: \"bool\",\n name: \"sendToCounterfactualWallet\",\n type: \"bool\",\n },\n { internalType: \"string\", name: \"message\", type: \"string\" },\n ],\n name: \"swapUSDCAndForwardUSDG\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n] as const;\n","export const ERC20_ABI = [\n {\n inputs: [\n { name: \"spender\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n ],\n name: \"approve\",\n outputs: [{ name: \"\", type: \"bool\" }],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { name: \"owner\", type: \"address\" },\n { name: \"spender\", type: \"address\" },\n ],\n name: \"allowance\",\n outputs: [{ name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { name: \"to\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n ],\n name: \"transfer\",\n outputs: [{ name: \"\", type: \"bool\" }],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [{ name: \"account\", type: \"address\" }],\n name: \"balanceOf\",\n outputs: [{ name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { name: \"account\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n ],\n name: \"mint\",\n outputs: [{ name: \"\", type: \"bool\" }],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n];\n","export type ContractKeys =\n | \"USDC\"\n | \"FORWARDER\"\n | \"FOUNDATION_WALLET\"\n | \"GLW\"\n | \"USDG\"\n | \"USDG_REDEMPTION\"\n | \"IMPACT_CATALYST\"\n | \"AUDIT_FEE_WALLET\"\n | \"UNISWAP_V2_ROUTER\"\n | \"UNISWAP_V2_FACTORY\"\n | \"USDG_UNISWAP\"\n | \"GLW_UNISWAP\"\n | \"OFFCHAIN_FRACTIONS\"\n | \"COUNTERFACTUAL_HOLDER_FACTORY\"\n | \"FOUNDATION_HUB_MANAGER_WALLET\"\n | \"FOUNDATION_REWARDS_WALLET\"\n | \"ENDOWMENT_WALLET\"\n | \"REWARDS_KERNEL\"\n | \"FOUNDATION_HOT_WALLET_PD\";\n\n// Contract-specific addresses\nconst mainnetAddresses: Record<ContractKeys, `0x${string}`> = {\n AUDIT_FEE_WALLET: \"0x3ff5af3333ddc6048d98849ec5e67868494693c9\", //aka GVE wallet\n IMPACT_CATALYST: \"0x552Fbb4E0269fd5036daf72Ec006AAF6C958F4Fa\",\n USDG_REDEMPTION: \"0x1c2cA537757e1823400F857EdBe72B55bbAe0F08\",\n USDG: \"0xe010ec500720bE9EF3F82129E7eD2Ee1FB7955F2\",\n GLW: \"0xf4fbC617A5733EAAF9af08E1Ab816B103388d8B6\",\n USDC: \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n USDG_UNISWAP: \"0xe010ec500720bE9EF3F82129E7eD2Ee1FB7955F2\",\n GLW_UNISWAP: \"0xf4fbC617A5733EAAF9af08E1Ab816B103388d8B6\",\n FORWARDER: \"0x1519a8fE33acf8C164578789629146278541506A\",\n OFFCHAIN_FRACTIONS: \"0x80EA852448c2807BeAe321deC7c603990209F7db\",\n COUNTERFACTUAL_HOLDER_FACTORY: \"0x5bB7eC88cA80146FF47019079Cf0330532A1157F\",\n FOUNDATION_HUB_MANAGER_WALLET: \"0x2b57E1bF5071c6579F2145b367EEC34f8729AA9C\",\n FOUNDATION_WALLET: \"0x77040BbBD506F5e5a7D65f6917416Bae6C78B9fa\",\n FOUNDATION_REWARDS_WALLET: \"0x6972B05A0c80064fBE8a10CBc2a2FBCF6fb47D6a\",\n UNISWAP_V2_ROUTER: \"0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\",\n UNISWAP_V2_FACTORY: \"0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f\",\n ENDOWMENT_WALLET: \"0x868D99B4a6e81b4683D10ea5665f13579A9d1607\",\n REWARDS_KERNEL: \"0xd6d3139d40a32F8bA71D576c1A743529AB4786BB\",\n FOUNDATION_HOT_WALLET_PD: \"0x465E5573c648BC50a11911Cd48D0e279F4409Ec8\",\n};\n\nconst sepoliaAddresses: Record<ContractKeys, `0x${string}`> = {\n AUDIT_FEE_WALLET: \"0x3ff5af3333ddc6048d98849ec5e67868494693c9\",\n IMPACT_CATALYST: \"0xb793Ed3CD94357f0e1933b0bd19F921b99f4C72a\",\n USDG_REDEMPTION: \"0x04829038A6664C16eC994BFb87754Fa621e51135\",\n USDG: \"0xda78313A3fF949890112c1B746AB1c75d1b1c17B\",\n GLW: \"0x2039161fce4c8e5cf5fe64e17fd290e8dff3c9bd\",\n USDC: \"0x93c898be98cd2618ba84a6dccf5003d3bbe40356\",\n USDG_UNISWAP: \"0x2a085A3aEA8982396533327c854753Ce521B666d\",\n GLW_UNISWAP: \"0x8e27016D0B866a56CE74A1a280c749dD679bb0Fa\",\n FORWARDER: \"0xe7A366482899e2Ed29c9504F4792B8D1c67066ff\",\n OFFCHAIN_FRACTIONS: \"0x5Ad30F90AFEf1279157A5055AAd2d8c1529a05D2\",\n COUNTERFACTUAL_HOLDER_FACTORY: \"0x2c3AB887746F6f4a8a4b9Db6aC800eb71945509A\",\n FOUNDATION_WALLET: \"0x5e230FED487c86B90f6508104149F087d9B1B0A7\",\n FOUNDATION_HUB_MANAGER_WALLET: \"0x5252FdA14A149c01EA5A1D6514a9c1369E4C70b4\",\n FOUNDATION_REWARDS_WALLET: \"0x5252FdA14A149c01EA5A1D6514a9c1369E4C70b4\",\n UNISWAP_V2_ROUTER: \"0xeE567Fe1712Faf6149d80dA1E6934E354124CfE3\",\n UNISWAP_V2_FACTORY: \"0xF62c03E08ada871A0bEb309762E260a7a6a880E6\",\n ENDOWMENT_WALLET: \"0x868D99B4a6e81b4683D10ea5665f13579A9d1607\",\n REWARDS_KERNEL: \"0x92fcC4D8565062381d8fBD5Af1b32432104FDBC7\",\n FOUNDATION_HOT_WALLET_PD: \"0x465E5573c648BC50a11911Cd48D0e279F4409Ec8\",\n};\n\nexport const getAddresses = (\n CHAIN_ID: number\n): Record<ContractKeys, `0x${string}`> => {\n switch (CHAIN_ID) {\n case 1:\n return mainnetAddresses;\n case 11155111:\n return sepoliaAddresses;\n default:\n console.warn(\n `Unsupported chain ID: ${CHAIN_ID}, falling back to mainnet addresses`\n );\n return mainnetAddresses;\n }\n};\n\nexport const DECIMALS_BY_TOKEN: Record<\n \"USDC\" | \"USDG\" | \"GCTL\" | \"SGCTL\" | \"GLW\",\n number\n> = {\n USDC: 6,\n USDG: 6,\n GCTL: 6,\n SGCTL: 6,\n GLW: 18,\n};\n","import { type PublicClient } from \"viem\";\nimport { type Signer } from \"ethers\";\n\n// Error parsing utilities\nexport function parseViemError(error: unknown): string {\n if (!error) return \"Unknown error\";\n\n // Check if it's a viem BaseError\n if (error instanceof Error) {\n // For contract revert errors\n if ((error as any).cause?.reason) {\n return (error as any).cause.reason;\n }\n\n // For viem's shortMessage\n if ((error as any).shortMessage) {\n return (error as any).shortMessage;\n }\n\n // Fallback to regular message\n if (error.message) {\n return error.message;\n }\n }\n\n return \"Unknown error\";\n}\n\nexport function parseEthersError(error: unknown): string {\n if (!error) return \"Unknown error\";\n const possibleError: any = error;\n\n // If the error originates from a callStatic it will often be found at `error?.error?.body`\n if (possibleError?.error?.body) {\n try {\n const body = JSON.parse(possibleError.error.body);\n // Hardhat style errors\n if (body?.error?.message) return body.error.message as string;\n } catch {}\n }\n\n // Found on MetaMask/Alchemy shape errors\n if (possibleError?.data?.message) return possibleError.data.message as string;\n if (possibleError?.error?.message)\n return possibleError.error.message as string;\n\n // Standard ethers v5 message\n if (possibleError?.reason) return possibleError.reason as string;\n if (possibleError?.message) return possibleError.message as string;\n\n return \"Unknown error\";\n}\n\n// Transaction receipt utilities\nexport interface TransactionRetryOptions {\n maxRetries?: number;\n timeoutMs?: number;\n enableLogging?: boolean;\n pollIntervalMs?: number;\n}\n\nconst DEFAULT_OPTIONS: Required<TransactionRetryOptions> = {\n maxRetries: 3,\n timeoutMs: 60000,\n enableLogging: true,\n pollIntervalMs: 2000,\n};\n\n/**\n * Enhanced transaction receipt handler with retry logic for viem\n * @param publicClient The viem public client\n * @param hash The transaction hash\n * @param options Retry configuration options\n */\nexport async function waitForViemTransactionWithRetry(\n publicClient: PublicClient,\n hash: `0x${string}`,\n options: TransactionRetryOptions = {}\n): Promise<void> {\n const { maxRetries, timeoutMs, enableLogging, pollIntervalMs } = {\n ...DEFAULT_OPTIONS,\n ...options,\n };\n\n const deadline = Date.now() + timeoutMs;\n let consecutiveErrors = 0;\n\n while (Date.now() < deadline) {\n try {\n const receipt = await publicClient.getTransactionReceipt({ hash });\n if (receipt) {\n if (receipt.status === \"reverted\") {\n throw new Error(`Transaction ${hash} was reverted on-chain`);\n }\n if (enableLogging) {\n console.log(\n `Transaction ${hash} confirmed successfully in block ${receipt.blockNumber}`\n );\n }\n return;\n }\n } catch (error) {\n const errorMessage = parseViemError(error);\n // Treat not found/receipt missing as retryable without counting towards errors\n const isNotFound =\n errorMessage.includes(\"not found\") ||\n errorMessage.includes(\"could not be found\") ||\n errorMessage.includes(\"receipt\") ||\n errorMessage.includes(\"not confirmed\") ||\n errorMessage.includes(\"TransactionReceiptNotFound\");\n\n if (!isNotFound) {\n consecutiveErrors++;\n if (consecutiveErrors >= maxRetries) {\n throw new Error(\n `Transaction failed after ${consecutiveErrors} attempts: ${errorMessage}`\n );\n }\n if (enableLogging) {\n console.warn(\n `Error fetching receipt (attempt ${consecutiveErrors}/${maxRetries}), retrying in ${pollIntervalMs}ms...`\n );\n }\n }\n }\n\n await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));\n }\n\n throw new Error(`Transaction receipt not found within ${timeoutMs}ms`);\n}\n\n/**\n * Enhanced transaction receipt handler with retry logic for ethers.js\n * @param signer The ethers signer\n * @param txHash The transaction hash\n * @param options Retry configuration options\n */\nexport async function waitForEthersTransactionWithRetry(\n signer: Signer,\n txHash: string,\n options: TransactionRetryOptions = {}\n): Promise<void> {\n const { maxRetries, timeoutMs, enableLogging, pollIntervalMs } = {\n ...DEFAULT_OPTIONS,\n ...options,\n };\n\n const provider = signer.provider;\n if (!provider) {\n throw new Error(\"Provider not available\");\n }\n\n const deadline = Date.now() + timeoutMs;\n let consecutiveErrors = 0;\n\n while (Date.now() < deadline) {\n try {\n const receipt = await provider.getTransactionReceipt(txHash);\n if (receipt) {\n if ((receipt as any).status === 0) {\n throw new Error(`Transaction ${txHash} was reverted on-chain`);\n }\n if (enableLogging) {\n console.log(\n `Transaction ${txHash} confirmed successfully in block ${\n (receipt as any).blockNumber\n }`\n );\n }\n return;\n }\n } catch (error) {\n const errorMessage = parseEthersError(error);\n consecutiveErrors++;\n if (consecutiveErrors >= maxRetries) {\n throw new Error(\n `Transaction failed after ${consecutiveErrors} attempts: ${errorMessage}`\n );\n }\n if (enableLogging) {\n console.warn(\n `Error fetching receipt (attempt ${consecutiveErrors}/${maxRetries}), retrying in ${pollIntervalMs}ms...`\n );\n }\n }\n\n await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));\n }\n\n throw new Error(`Transaction receipt not found within ${timeoutMs}ms`);\n}\n","\"use strict\";\n\nexport interface SentryBreadcrumb {\n category: string;\n message?: string;\n level?: \"error\" | \"warning\" | \"info\" | \"debug\";\n data?: Record<string, unknown>;\n}\n\nexport interface SentryClientLike {\n captureException: (\n error: unknown,\n context?: { extra?: Record<string, unknown> }\n ) => void;\n addBreadcrumb?: (breadcrumb: SentryBreadcrumb) => void;\n}\n\ntype SentryConfig = {\n enabled?: boolean;\n client?: SentryClientLike | null;\n defaultContext?: Record<string, unknown>;\n};\n\nlet configuredClient: SentryClientLike | null = null;\nlet isEnabled = true;\nlet defaultExtra: Record<string, unknown> = {};\n\nfunction getSentry(): SentryClientLike | null {\n const client =\n configuredClient ??\n ((globalThis as any)?.Sentry as SentryClientLike | undefined);\n if (!client || typeof client.captureException !== \"function\") return null;\n return client;\n}\n\nexport function configureSentry(config: SentryConfig): void {\n if (config.enabled !== undefined) isEnabled = !!config.enabled;\n if (config.client !== undefined) configuredClient = config.client;\n if (config.defaultContext) defaultExtra = { ...config.defaultContext };\n}\n\nfunction shouldSkipSentry(error: unknown): boolean {\n try {\n const possible: any = error;\n const code: string | undefined = possible?.code || possible?.cause?.code;\n const name: string | undefined = possible?.name || possible?.cause?.name;\n const message: string = String(\n possible?.message || possible?.cause?.message || \"\"\n );\n\n // User rejected wallet request (ethers/viem/common providers)\n if (code === \"ACTION_REJECTED\") return true;\n if (name === \"UserRejectedRequestError\") return true;\n if (/user rejected/i.test(message)) return true;\n\n // Terminal waitForViemTransactionWithRetry error (retries exhausted)\n if (/Transaction failed after\\s+\\d+\\s+attempts:/i.test(message)) {\n return true;\n }\n\n return false;\n } catch {\n return false;\n }\n}\n\nexport function sentryAddBreadcrumb(breadcrumb: SentryBreadcrumb): void {\n try {\n if (!isEnabled) return;\n getSentry()?.addBreadcrumb?.(breadcrumb);\n } catch {}\n}\n\nexport function sentryCaptureException(\n error: unknown,\n extra?: Record<string, unknown>\n): void {\n try {\n if (!isEnabled) return;\n if (shouldSkipSentry(error)) return;\n const client = getSentry();\n if (!client) return;\n const merged = extra ? { ...defaultExtra, ...extra } : defaultExtra;\n client.captureException(\n error,\n Object.keys(merged).length ? { extra: merged } : undefined\n );\n } catch {}\n}\n","import { Contract, MaxUint256, type Signer } from \"ethers\";\nimport { FORWARDER_ABI } from \"../abis/forwarderABI\";\nimport { ERC20_ABI } from \"../abis/erc20.abi\";\nimport { getAddresses } from \"../../constants/addresses\";\nimport { formatEther } from \"viem\";\nimport { PendingTransferType, TRANSFER_TYPES } from \"../types\";\nimport {\n parseEthersError,\n waitForEthersTransactionWithRetry,\n} from \"../../utils/transaction-utils\";\nimport {\n sentryAddBreadcrumb,\n sentryCaptureException,\n} from \"../../utils/sentry\";\n\nexport enum ForwarderError {\n CONTRACT_NOT_AVAILABLE = \"Contract not available\",\n SIGNER_NOT_AVAILABLE = \"Signer not available\",\n UNKNOWN_ERROR = \"Unknown error\",\n INVALID_FORWARD_TYPE = \"Invalid forward type\",\n MISSING_REQUIRED_PARAMS = \"Missing required parameters\",\n}\n\n// Forward types based on API router documentation\nexport type ForwardType = PendingTransferType;\n\n// Currency types\nexport type Currency = \"USDC\" | \"GLW\" | \"USDG\";\n\n// Forward parameters interface\nexport interface ForwardParams {\n amount: bigint;\n userAddress: string;\n type: ForwardType;\n currency?: Currency;\n applicationId?: string;\n farmId?: string;\n regionId?: number;\n kickstarterId?: string;\n}\n\n// Type-guard style helper to ensure a signer exists throughout the rest of the function.\nfunction assertSigner(\n maybeSigner: Signer | undefined\n): asserts maybeSigner is Signer {\n if (!maybeSigner) {\n throw new Error(ForwarderError.SIGNER_NOT_AVAILABLE);\n }\n}\n\nexport function useForwarder(signer: Signer | undefined, CHAIN_ID: number) {\n // Use dynamic addresses based on chain configuration\n const ADDRESSES = getAddresses(CHAIN_ID);\n\n // Framework-agnostic processing flag\n let isProcessing = false;\n const setIsProcessing = (value: boolean) => {\n isProcessing = value;\n };\n\n // Returns a contract instance for Forwarder\n function getForwarderContract() {\n assertSigner(signer);\n return new Contract(ADDRESSES.FORWARDER, FORWARDER_ABI, signer);\n }\n\n /**\n * Construct the message for the forward call based on type and parameters\n */\n function constructForwardMessage(params: ForwardParams): string {\n const {\n type,\n applicationId,\n farmId,\n regionId,\n userAddress,\n kickstarterId,\n } = params;\n\n switch (type) {\n case TRANSFER_TYPES.PayProtocolFeeAndMintGCTLAndStake:\n if (!applicationId) {\n throw new Error(ForwarderError.MISSING_REQUIRED_PARAMS);\n }\n return `PayProtocolFeeAndMintGCTLAndStake::${applicationId}`;\n\n case TRANSFER_TYPES.PayProtocolFee:\n if (!applicationId) {\n throw new Error(ForwarderError.MISSING_REQUIRED_PARAMS);\n }\n return `PayProtocolFee::${applicationId}`;\n\n case TRANSFER_TYPES.SponsorProtocolFee:\n if (!applicationId) {\n throw new Error(ForwarderError.MISSING_REQUIRED_PARAMS);\n }\n return `SponsorProtocolFee::${applicationId}`;\n\n case TRANSFER_TYPES.SponsorProtocolFeeAndMintGCTLAndStake:\n if (!applicationId) {\n throw new Error(ForwarderError.MISSING_REQUIRED_PARAMS);\n }\n return `SponsorProtocolFeeAndMintGCTLAndStake::${applicationId}`;\n\n case TRANSFER_TYPES.MintGCTLAndStake:\n if (!regionId) {\n throw new Error(ForwarderError.MISSING_REQUIRED_PARAMS);\n }\n return `MintGCTLAndStake::${regionId}`;\n\n case TRANSFER_TYPES.MintGCTL:\n if (!userAddress) {\n throw new Error(ForwarderError.MISSING_REQUIRED_PARAMS);\n }\n return `MintGCTL::${userAddress}`;\n\n case TRANSFER_TYPES.BuySolarFarm:\n if (!farmId) {\n throw new Error(ForwarderError.MISSING_REQUIRED_PARAMS);\n }\n return `BuySolarFarm::${farmId}`;\n\n case TRANSFER_TYPES.PayAuditFees:\n if (!applicationId) {\n throw new Error(ForwarderError.MISSING_REQUIRED_PARAMS);\n }\n return `PayAuditFees::${applicationId}`;\n\n case TRANSFER_TYPES.CommitKickstarter:\n if (!kickstarterId) {\n throw new Error(ForwarderError.MISSING_REQUIRED_PARAMS);\n }\n return `CommitKickstarter::${kickstarterId}`;\n\n default:\n throw new Error(ForwarderError.INVALID_FORWARD_TYPE);\n }\n }\n\n /**\n * Get the appropriate token contract based on currency\n */\n function getTokenContract(currency: Currency = \"USDC\") {\n assertSigner(signer);\n\n let tokenAddress: string;\n switch (currency) {\n case \"USDC\":\n tokenAddress = ADDRESSES.USDC;\n break;\n case \"GLW\":\n tokenAddress = ADDRESSES.GLW;\n break;\n case \"USDG\":\n tokenAddress = ADDRESSES.USDG;\n break;\n default:\n throw new Error(\n `Currency ${currency} not yet supported. Only USDC, GLW, and USDG are currently supported.`\n );\n }\n\n return new Contract(tokenAddress, ERC20_ABI, signer);\n }\n\n /**\n * Check current token allowance for the forwarder contract\n * @param owner The wallet address to check allowance for\n * @param currency The currency to check allowance for\n */\n async function checkTokenAllowance(\n owner: string,\n currency: Currency = \"USDC\"\n ): Promise<bigint> {\n assertSigner(signer);\n\n try {\n const tokenContract = getTokenContract(currency);\n if (!tokenContract)\n throw new Error(ForwarderError.CONTRACT_NOT_AVAILABLE);\n\n const allowance: bigint = await tokenContract.allowance(\n owner,\n ADDRESSES.FORWARDER\n );\n return allowance;\n } catch (error) {\n throw new Error(parseEthersError(error));\n }\n }\n\n /**\n * Check user's token balance\n * @param owner The wallet address to check balance for\n * @param currency The currency to check balance for\n */\n async function checkTokenBalance(\n owner: string,\n currency: Currency = \"USDC\"\n ): Promise<bigint> {\n assertSigner(signer);\n\n try {\n const tokenContract = getTokenContract(currency);\n if (!tokenContract)\n throw new Error(ForwarderError.CONTRACT_NOT_AVAILABLE);\n\n const balance: bigint = await tokenContract.balanceOf(owner);\n return balance;\n } catch (error) {\n throw new Error(parseEthersError(error));\n }\n }\n\n /**\n * Approve tokens for the forwarder contract\n * @param amount Amount to approve (BigNumber)\n * @param currency The currency to approve\n */\n async function approveToken(\n amount: bigint,\n currency: Currency = \"USDC\"\n ): Promise<boolean> {\n assertSigner(signer);\n\n try {\n const tokenContract = getTokenContract(currency);\n if (!tokenContract)\n throw new Error(ForwarderError.CONTRACT_NOT_AVAILABLE);\n\n setIsProcessing(true);\n\n // Approve only the specific amount needed\n const approveTx = await tokenContract.approve(\n ADDRESSES.FORWARDER,\n amount\n );\n await waitForEthersTransactionWithRetry(signer, approveTx.hash, {\n timeoutMs: 30000,\n pollIntervalMs: 2000,\n });\n\n return true;\n } catch (error) {\n throw new Error(parseEthersError(error));\n } finally {\n setIsProcessing(false);\n }\n }\n\n /**\n * Forward tokens through the forwarder contract with type-specific handling\n * @param params Forward parameters including type, amount, and required fields\n */\n async function forwardTokens(params: ForwardParams): Promise<string> {\n assertSigner(signer);\n\n try {\n const forwarderContract = getForwarderContract();\n if (!forwarderContract)\n throw new Error(ForwarderError.CONTRACT_NOT_AVAILABLE);\n\n setIsProcessing(true);\n\n const { amount, currency = \"USDC\" } = params;\n const tokenContract = getTokenContract(currency);\n if (!tokenContract)\n throw new Error(ForwarderError.CONTRACT_NOT_AVAILABLE);\n\n sentryAddBreadcrumb({\n category: \"forwarder\",\n message: \"forwardTokens.start\",\n level: \"info\",\n data: {\n chainId: CHAIN_ID,\n type: params.type,\n amount: amount.toString(),\n currency,\n applicationId: params.applicationId,\n farmId: params.farmId,\n regionId: params.regionId,\n kickstarterId: params.kickstarterId,\n userAddress: params.userAddress,\n },\n });\n\n const owner = await signer.getAddress();\n\n // Construct the appropriate message for this forward type\n const message = constructForwardMessage(params);\n\n // Special handling: PayAuditFees can ONLY be USDC, and must call forward()\n const isAuditFees = params.type === TRANSFER_TYPES.PayAuditFees;\n if (isAuditFees && currency !== \"USDC\") {\n throw new Error(\"PayAuditFees only supports USDC\");\n }\n\n // CommitKickstarter supports only USDC or USDG (GLW not allowed)\n const isCommitKickstarter =\n params.type === TRANSFER_TYPES.CommitKickstarter;\n if (isCommitKickstarter && currency === \"GLW\") {\n throw new Error(\"CommitKickstarter supports only USDC or USDG\");\n }\n\n // Check allowance and approve if necessary\n const allowance: bigint = await tokenContract.allowance(\n owner,\n ADDRESSES.FORWARDER\n );\n console.log(\"allowance\", allowance.toString());\n if (allowance < amount) {\n try {\n const approveTx = await tokenContract.approve(\n ADDRESSES.FORWARDER,\n MaxUint256\n );\n await waitForEthersTransactionWithRetry(signer, approveTx.hash, {\n timeoutMs: 30000,\n pollIntervalMs: 2000,\n });\n } catch (approveError) {\n sentryCaptureException(approveError, {\n action: \"forwardTokens.approve\",\n chainId: CHAIN_ID,\n spender: ADDRESSES.FORWARDER,\n amount: MaxUint256.toString(),\n currency,\n });\n throw new Error(\n parseEthersError(approveError) || \"Token approval failed\"\n );\n }\n }\n\n // Get the token address based on currency\n let tokenAddress: string;\n switch (currency) {\n case \"USDC\":\n tokenAddress = ADDRESSES.USDC;\n break;\n case \"USDG\":\n tokenAddress = ADDRESSES.USDG;\n break;\n case \"GLW\":\n tokenAddress = ADDRESSES.GLW;\n break;\n default:\n throw new Error(`Unsupported currency for forwarding: ${currency}`);\n }\n\n // Determine sendToCounterfactualWallet based on currency\n const sendToCounterfactualWallet = true;\n\n // Run a static call first to surface any revert reason (ethers v6)\n try {\n if (!isAuditFees && currency === \"USDC\") {\n await forwarderContract\n .getFunction(\"swapUSDCAndForwardUSDG\")\n .staticCall(\n amount,\n ADDRESSES.FOUNDATION_WALLET,\n sendToCounterfactualWallet,\n message,\n {\n from: owner,\n }\n );\n } else {\n await forwarderContract\n .getFunction(\"forward\")\n .staticCall(\n tokenAddress,\n isAuditFees\n ? ADDRESSES.AUDIT_FEE_WALLET\n : ADDRESSES.FOUNDATION_WALLET,\n amount,\n sendToCounterfactualWallet,\n message,\n { from: owner }\n );\n }\n } catch (staticError) {\n sentryCaptureException(staticError, {\n action: \"forwardTokens.staticCall\",\n chainId: CHAIN_ID,\n function:\n !isAuditFees && currency === \"USDC\"\n ? \"swapUSDCAndForwardUSDG\"\n : \"forward\",\n tokenAddress,\n amount: amount.toString(),\n currency,\n isAuditFees,\n });\n throw new Error(parseEthersError(staticError));\n }\n\n // Execute the forward transaction\n let tx;\n if (!isAuditFees && currency === \"USDC\") {\n tx = await forwarderContract.getFunction(\"swapUSDCAndForwardUSDG\")(\n amount,\n ADDRESSES.FOUNDATION_WALLET,\n sendToCounterfactualWallet,\n message\n );\n } else {\n tx = await forwarderContract.getFunction(\"forward\")(\n tokenAddress,\n isAuditFees\n ? ADDRESSES.AUDIT_FEE_WALLET\n : ADDRESSES.FOUNDATION_WALLET,\n amount,\n sendToCounterfactualWallet,\n message\n );\n }\n await waitForEthersTransactionWithRetry(signer, tx.hash, {\n timeoutMs: 30000,\n pollIntervalMs: 2000,\n });\n\n return tx.hash;\n } catch (txError: any) {\n sentryCaptureException(txError, {\n action: \"forwardTokens\",\n chainId: CHAIN_ID,\n type: params.type,\n amount: params.amount.toString(),\n currency: params.currency ?? \"USDC\",\n applicationId: params.applicationId,\n farmId: params.farmId,\n regionId: params.regionId,\n kickstarterId: params.kickstarterId,\n userAddress: params.userAddress,\n });\n throw new Error(parseEthersError(txError));\n } finally {\n setIsProcessing(false);\n }\n }\n\n /**\n * Forward tokens for protocol fee payment and GCTL minting with staking\n */\n async function payProtocolFeeAndMintGCTLAndStake(\n amount: bigint,\n userAddress: string,\n applicationId: string,\n regionId?: number,\n currency: Currency = \"USDC\"\n ): Promise<string> {\n assertSigner(signer);\n\n // GCTL minting only supports USDC and USDG\n if (currency === \"GLW\") {\n throw new Error(\n \"GCTL minting is not supported with GLW payment. Use USDC or USDG.\"\n );\n }\n\n return forwardTokens({\n amount,\n userAddress,\n type: TRANSFER_TYPES.PayProtocolFeeAndMintGCTLAndStake,\n currency,\n applicationId,\n regionId,\n });\n }\n /**\n * Forward tokens for protocol fee payment and GCTL minting with staking\n */\n async function sponsorProtocolFeeAndMintGCTLAndStake(\n amount: bigint,\n userAddress: string,\n applicationId: string,\n currency: Currency = \"USDC\"\n ): Promise<string> {\n assertSigner(signer);\n\n if (currency === \"GLW\") {\n throw new Error(\n \"GCTL minting is not supported with GLW payment. Use USDC or USDG.\"\n );\n }\n\n return forwardTokens({\n amount,\n userAddress,\n type: TRANSFER_TYPES.SponsorProtocolFeeAndMintGCTLAndStake,\n currency,\n applicationId,\n });\n }\n\n /**\n * Forward tokens for protocol fee payment only\n */\n async function payProtocolFee(\n amount: bigint,\n userAddress: string,\n applicationId: string,\n currency: Currency = \"USDC\"\n ): Promise<string> {\n assertSigner(signer);\n\n return forwardTokens({\n amount,\n userAddress,\n type: TRANSFER_TYPES.PayProtocolFee,\n currency,\n applicationId,\n });\n }\n\n /**\n * Forward tokens for protocol fee payment only\n */\n async function sponsorProtocolFee(\n amount: bigint,\n userAddress: string,\n applicationId: string,\n currency: Currency = \"USDC\"\n ): Promise<string> {\n assertSigner(signer);\n\n return forwardTokens({\n amount,\n userAddress,\n type: TRANSFER_TYPES.SponsorProtocolFee,\n currency,\n applicationId,\n });\n }\n\n /**\n * Forward USDC to mint GCTL and stake to a region\n */\n async function mintGCTLAndStake(\n amount: bigint,\n userAddress: string,\n regionId?: number,\n currency: Currency = \"USDC\"\n ): Promise<string> {\n assertSigner(signer);\n\n // GCTL minting only supports USDC and USDG\n if (currency === \"GLW\") {\n throw new Error(\n \"GCTL minting is not supported with GLW payment. Use USDC or USDG.\"\n );\n }\n\n return forwardTokens({\n amount,\n userAddress,\n type: TRANSFER_TYPES.MintGCTLAndStake,\n currency,\n regionId,\n });\n }\n\n /**\n * Forward USDC to mint GCTL (existing functionality, keeping for compatibility)\n */\n async function mintGCTL(\n amount: bigint,\n userAddress: string,\n currency: Currency = \"USDC\"\n ): Promise<string> {\n assertSigner(signer);\n\n // GCTL minting only supports USDC and USDG\n if (currency === \"GLW\") {\n throw new Error(\n \"GCTL minting is not supported with GLW payment. Use USDC or USDG.\"\n );\n }\n\n return forwardTokens({\n amount,\n userAddress,\n type: TRANSFER_TYPES.MintGCTL,\n currency,\n });\n }\n\n /**\n * Forward tokens to pay audit fees (USDC only, calls forward())\n */\n async function payAuditFees(\n amount: bigint,\n userAddress: string,\n applicationId: string\n ): Promise<string> {\n assertSigner(signer);\n\n return forwardTokens({\n amount,\n userAddress,\n type: TRANSFER_TYPES.PayAuditFees,\n currency: \"USDC\",\n applicationId,\n });\n }\n\n /**\n * Forward tokens to buy a solar farm\n */\n async function buySolarFarm(\n amount: bigint,\n userAddress: string,\n farmId: string,\n currency: Currency = \"USDC\"\n ): Promise<string> {\n assertSigner(signer);\n\n return forwardTokens({\n amount,\n userAddress,\n type: TRANSFER_TYPES.BuySolarFarm,\n currency,\n farmId,\n });\n }\n\n /**\n * Forward tokens to commit to a Kickstarter (USDC or USDG only)\n */\n async function commitKickstarter(\n amount: bigint,\n userAddress: string,\n kickstarterId: string,\n currency: Currency = \"USDC\"\n ): Promise<string> {\n assertSigner(signer);\n\n if (currency === \"GLW\") {\n throw new Error(\"CommitKickstarter supports only USDC or USDG\");\n }\n\n return forwardTokens({\n amount,\n userAddress,\n type: TRANSFER_TYPES.CommitKickstarter,\n currency,\n kickstarterId,\n });\n }\n\n /**\n * Estimate gas for forwarding with type-specific handling\n * @param params Forward parameters\n * @param ethPriceInUSD Current ETH price in USD (for cost estimation)\n */\n async function estimateGasForForward(\n params: ForwardParams,\n ethPriceInUSD: number | null\n ): Promise<string> {\n assertSigner(signer);\n\n try {\n const forwarderContract = getForwarderContract();\n if (!forwarderContract)\n throw new Error(ForwarderError.CONTRACT_NOT_AVAILABLE);\n\n const { amount, currency = \"USDC\" } = params;\n const isAuditFees = params.type === TRANSFER_TYPES.PayAuditFees;\n if (isAuditFees && currency !== \"USDC\") {\n throw new Error(\"PayAuditFees only supports USDC\");\n }\n\n // Construct the appropriate message for this forward type\n const message = constructForwardMessage(params);\n\n // Get token address\n let tokenAddress: string;\n switch (currency) {\n case \"USDC\":\n tokenAddress = ADDRESSES.USDC;\n break;\n case \"USDG\":\n tokenAddress = ADDRESSES.USDG;\n break;\n case \"GLW\":\n tokenAddress = ADDRESSES.GLW;\n break;\n default:\n throw new Error(\n `Unsupported currency for gas estimation: ${currency}`\n );\n }\n\n const feeData = await signer.provider?.getFeeData();\n const gasPrice =\n feeData?.gasPrice ?? feeData?.maxFeePerGas ?? (0n as bigint);\n if (gasPrice === 0n) {\n throw new Error(\"Could not fetch gas price to estimate cost.\");\n }\n const estimatedGas: bigint =\n !isAuditFees && currency === \"USDC\"\n ? await forwarderContract\n .getFunction(\"swapUSDCAndForwardUSDG\")\n .estimateGas(amount, ADDRESSES.FOUNDATION_WALLET, true, message)\n : await forwarderContract\n .getFunction(\"forward\")\n .estimateGas(\n tokenAddress,\n isAuditFees\n ? ADDRESSES.AUDIT_FEE_WALLET\n : ADDRESSES.FOUNDATION_WALLET,\n amount,\n true,\n message\n );\n const estimatedCost: bigint = estimatedGas * gasPrice;\n\n if (ethPriceInUSD) {\n const estimatedCostInEth = formatEther(estimatedCost);\n const estimatedCostInUSD = (\n parseFloat(estimatedCostInEth) * ethPriceInUSD\n ).toFixed(2);\n return estimatedCostInUSD;\n } else {\n throw new Error(\n \"Could not fetch the ETH price to calculate cost in USD.\"\n );\n }\n } catch (error: any) {\n throw new Error(parseEthersError(error));\n }\n }\n\n /**\n * Mint test USDC (only works on testnets with mintable USDC contracts)\n * @param amount Amount of USDC to mint (BigNumber, 6 decimals)\n * @param recipient Address to mint USDC to\n */\n async function mintTestUSDC(\n amount: bigint,\n recipient: string\n ): Promise<string> {\n assertSigner(signer);\n if (CHAIN_ID !== 11155111) {\n throw new Error(\"Minting test USDC is only supported on Sepolia\");\n }\n\n try {\n const usdcContract = getTokenContract(\"USDC\"); // Use getTokenContract for consistency\n if (!usdcContract) throw new Error(ForwarderError.CONTRACT_NOT_AVAILABLE);\n\n setIsProcessing(true);\n\n // Try to call mint function (common for test tokens)\n const tx = await usdcContract.mint(recipient, amount);\n await waitForEthersTransactionWithRetry(signer, tx.hash, {\n timeoutMs: 30000,\n pollIntervalMs: 2000,\n });\n\n return tx.hash;\n } catch (error: any) {\n // If mint function doesn't exist or fails, provide helpful error\n const errorMessage = parseEthersError(error);\n if (errorMessage.includes(\"mint\")) {\n throw new Error(\"This USDC contract doesn't support minting\");\n }\n throw new Error(errorMessage);\n } finally {\n setIsProcessing(false);\n }\n }\n\n return {\n // New methods for different forward types\n forwardTokens,\n payProtocolFeeAndMintGCTLAndStake,\n sponsorProtocolFeeAndMintGCTLAndStake,\n sponsorProtocolFee,\n payProtocolFee,\n mintGCTLAndStake,\n mintGCTL,\n buySolarFarm,\n commitKickstarter,\n payAuditFees,\n\n // Token operations\n approveToken,\n checkTokenAllowance,\n checkTokenBalance,\n\n // Utility methods\n estimateGasForForward,\n mintTestUSDC,\n constructForwardMessage,\n\n // State\n get isProcessing() {\n return isProcessing;\n },\n addresses: ADDRESSES,\n\n // Signer availability\n isSignerAvailable: !!signer,\n };\n}\n","export const OFFCHAIN_FRACTIONS_ABI = [\n {\n inputs: [\n {\n internalType: \"contract CounterfactualHolderFactory\",\n name: \"_counterfactualHolderFactory\",\n type: \"address\",\n },\n ],\n stateMutability: \"nonpayable\",\n type: \"constructor\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"target\", type: \"address\" }],\n name: \"AddressEmptyCode\",\n type: \"error\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"account\", type: \"address\" }],\n name: \"AddressInsufficientBalance\",\n type: \"error\",\n },\n { inputs: [], name: \"AlreadyClosed\", type: \"error\" },\n { inputs: [], name: \"AlreadyExists\", type: \"error\" },\n { inputs: [], name: \"CannotClaimRefundWhenNotExpired\", type: \"error\" },\n { inputs: [], name: \"CannotClaimRefundWhenThresholdReached\", type: \"error\" },\n { inputs: [], name: \"CannotCloseWhenThresholdReached\", type: \"error\" },\n { inputs: [], name: \"CannotHaveZeroTotalSteps\", type: \"error\" },\n { inputs: [], name: \"ExpirationMustBeInTheFuture\", type: \"error\" },\n { inputs: [], name: \"Expired\", type: \"error\" },\n { inputs: [], name: \"FailedInnerCall\", type: \"error\" },\n { inputs: [], name: \"InsufficientSharesAvailable\", type: \"error\" },\n { inputs: [], name: \"InvalidToAddress\", type: \"error\" },\n { inputs: [], name: \"InvalidToken\", type: \"error\" },\n { inputs: [], name: \"MinSharesCannotBeGreaterThanTotalSteps\", type: \"error\" },\n {\n inputs: [],\n name: \"MinStepsToBuyCannotBeGreaterThanStepsToBuy\",\n type: \"error\",\n },\n { inputs: [], name: \"MinStepsToBuyCannotBeZero\", type: \"error\" },\n { inputs: [], name: \"NoStepsPurchased\", type: \"error\" },\n { inputs: [], name: \"NotFractionsCloser\", type: \"error\" },\n { inputs: [], name: \"RecipientCannotBeSelf\", type: \"error\" },\n { inputs: [], name: \"ReentrancyGuardReentrantCall\", type: \"error\" },\n { inputs: [], name: \"RefundOperatorNotApproved\", type: \"error\" },\n {\n inputs: [{ internalType: \"address\", name: \"token\", type: \"address\" }],\n name: \"SafeERC20FailedOperation\",\n type: \"error\",\n },\n { inputs: [], name: \"StepMustBeGreaterThanZero\", type: \"error\" },\n { inputs: [], name: \"TaxTokenNotSupported\", type: \"error\" },\n { inputs: [], name: \"TotalRaisedOverflow\", type: \"error\" },\n {\n inputs: [],\n name: \"UseCounterfactualAddressForRefundNotAllowedIfAddressIsZero\",\n type: \"error\",\n },\n { inputs: [], name: \"ZeroSteps\", type: \"error\" },\n {\n anonymous: false,\n inputs: [\n { indexed: true, internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n {\n indexed: true,\n internalType: \"address\",\n name: \"token\",\n type: \"address\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"owner\",\n type: \"address\",\n },\n ],\n name: \"FractionClosed\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n {\n indexed: true,\n internalType: \"address\",\n name: \"token\",\n type: \"address\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"owner\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"step\",\n type: \"uint256\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"totalSteps\",\n type: \"uint256\",\n },\n {\n indexed: false,\n internalType: \"uint48\",\n name: \"expiration\",\n type: \"uint48\",\n },\n { indexed: false, internalType: \"address\", name: \"to\", type: \"address\" },\n {\n indexed: false,\n internalType: \"bool\",\n name: \"useCounterfactualAddress\",\n type: \"bool\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"minSharesToRaise\",\n type: \"uint256\",\n },\n {\n indexed: false,\n internalType: \"address\",\n name: \"closer\",\n type: \"address\",\n },\n ],\n name: \"FractionCreated\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n {\n indexed: true,\n internalType: \"address\",\n name: \"creator\",\n type: \"address\",\n },\n { indexed: true, internalType: \"address\", name: \"user\", type: \"address\" },\n {\n indexed: false,\n internalType: \"address\",\n name: \"refundTo\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"amount\",\n type: \"uint256\",\n },\n ],\n name: \"FractionRefunded\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n {\n indexed: true,\n internalType: \"address\",\n name: \"creator\",\n type: \"address\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"creditTo\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"address\",\n name: \"buyer\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"step\",\n type: \"uint256\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"amount\",\n type: \"uint256\",\n },\n ],\n name: \"FractionSold\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n {\n indexed: true,\n internalType: \"address\",\n name: \"creator\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"minShares\",\n type: \"uint256\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"newTotalSharesSold\",\n type: \"uint256\",\n },\n ],\n name: \"MinSharesReached\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, internalType: \"address\", name: \"user\", type: \"address\" },\n {\n indexed: true,\n internalType: \"address\",\n name: \"refundOperator\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"bool\",\n name: \"isApproved\",\n type: \"bool\",\n },\n ],\n name: \"RefundOperatorStatusSet\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n {\n indexed: true,\n internalType: \"address\",\n name: \"creator\",\n type: \"address\",\n },\n ],\n name: \"RoundFilled\",\n type: \"event\",\n },\n {\n inputs: [],\n name: \"REFUND_WILDCARD_OPERATOR\",\n outputs: [{ internalType: \"address\", name: \"\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"creator\", type: \"address\" },\n { internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n { internalType: \"uint256\", name: \"stepsToBuy\", type: \"uint256\" },\n { internalType: \"uint256\", name: \"minStepsToBuy\", type: \"uint256\" },\n { internalType: \"address\", name: \"refundTo\", type: \"address\" },\n { internalType: \"address\", name: \"creditTo\", type: \"address\" },\n {\n internalType: \"bool\",\n name: \"useCounterfactualAddressForRefund\",\n type: \"bool\",\n },\n ],\n name: \"buyFractions\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"user\", type: \"address\" },\n { internalType: \"address\", name: \"creator\", type: \"address\" },\n { internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n ],\n name: \"claimRefund\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"creator\", type: \"address\" },\n { internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n ],\n name: \"closeFraction\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n { internalType: \"address\", name: \"token\", type: \"address\" },\n { internalType: \"uint256\", name: \"step\", type: \"uint256\" },\n { internalType: \"uint256\", name: \"totalSteps\", type: \"uint256\" },\n { internalType: \"uint48\", name: \"expiration\", type: \"uint48\" },\n { internalType: \"address\", name: \"to\", type: \"address\" },\n { internalType: \"bool\", name: \"useCounterfactualAddress\", type: \"bool\" },\n { internalType: \"uint256\", name: \"minSharesToRaise\", type: \"uint256\" },\n { internalType: \"address\", name: \"closer\", type: \"address\" },\n ],\n name: \"createFraction\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"creator\", type: \"address\" },\n { internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n ],\n name: \"getFraction\",\n outputs: [\n {\n components: [\n { internalType: \"address\", name: \"token\", type: \"address\" },\n { internalType: \"uint48\", name: \"expiration\", type: \"uint48\" },\n { internalType: \"bool\", name: \"manuallyClosed\", type: \"bool\" },\n {\n internalType: \"uint256\",\n name: \"minSharesToRaise\",\n type: \"uint256\",\n },\n {\n internalType: \"bool\",\n name: \"useCounterfactualAddress\",\n type: \"bool\",\n },\n {\n internalType: \"bool\",\n name: \"claimedFromMinSharesToRaise\",\n type: \"bool\",\n },\n { internalType: \"uint256\", name: \"step\", type: \"uint256\" },\n { internalType: \"address\", name: \"to\", type: \"address\" },\n { internalType: \"uint256\", name: \"soldSteps\", type: \"uint256\" },\n { internalType: \"uint256\", name: \"totalSteps\", type: \"uint256\" },\n { internalType: \"address\", name: \"closer\", type: \"address\" },\n ],\n internalType: \"struct OffchainFractions.FractionData\",\n name: \"\",\n type: \"tuple\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"user\", type: \"address\" },\n { internalType: \"address\", name: \"creator\", type: \"address\" },\n { internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n ],\n name: \"getRefundDetails\",\n outputs: [\n {\n components: [\n { internalType: \"address\", name: \"refundTo\", type: \"address\" },\n {\n internalType: \"bool\",\n name: \"useCounterfactualAddress\",\n type: \"bool\",\n },\n ],\n internalType: \"struct OffchainFractions.RefundDetails\",\n name: \"\",\n type: \"tuple\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"i_CFHFactory\",\n outputs: [\n {\n internalType: \"contract CounterfactualHolderFactory\",\n name: \"\",\n type: \"address\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"user\", type: \"address\" },\n { internalType: \"address\", name: \"refundOperator\", type: \"address\" },\n ],\n name: \"isRefundOperatorApproved\",\n outputs: [{ internalType: \"bool\", name: \"\", type: \"bool\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"user\", type: \"address\" },\n { internalType: \"address\", name: \"refundOperator\", type: \"address\" },\n ],\n name: \"refundApprovals\",\n outputs: [{ internalType: \"bool\", name: \"isApproved\", type: \"bool\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"creator\", type: \"address\" },\n { internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n { internalType: \"address\", name: \"refundTo\", type: \"address\" },\n { internalType: \"bool\", name: \"useCounterfactualAddress\", type: \"bool\" },\n ],\n name: \"setRefundDetails\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"refundOperator\", type: \"address\" },\n { internalType: \"bool\", name: \"isApproved\", type: \"bool\" },\n ],\n name: \"setRefundOperatorStatus\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"user\", type: \"address\" },\n { internalType: \"address\", name: \"creator\", type: \"address\" },\n { internalType: \"bytes32\", name: \"id\", type: \"bytes32\" },\n ],\n name: \"stepsPurchased\",\n outputs: [\n { internalType: \"uint256\", name: \"stepsPurchased\", type: \"uint256\" },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n] as const;\n","import {\n type WalletClient,\n type PublicClient,\n type Address,\n formatEther,\n} from \"viem\";\nimport { OFFCHAIN_FRACTIONS_ABI } from \"../abis/offchainFractions\";\nimport { ERC20_ABI } from \"../abis/erc20.abi\";\nimport { getAddresses } from \"../../constants/addresses\";\nimport {\n parseViemError,\n waitForViemTransactionWithRetry,\n} from \"../../utils/transaction-utils\";\nimport {\n sentryAddBreadcrumb,\n sentryCaptureException,\n} from \"../../utils/sentry\";\n\nexport enum OffchainFractionsError {\n CONTRACT_NOT_AVAILABLE = \"Contract not available\",\n SIGNER_NOT_AVAILABLE = \"Signer not available\",\n UNKNOWN_ERROR = \"Unknown error\",\n INVALID_PARAMETERS = \"Invalid parameters\",\n FRACTION_NOT_FOUND = \"Fraction not found\",\n INSUFFICIENT_BALANCE = \"Insufficient balance\",\n INSUFFICIENT_ALLOWANCE = \"Insufficient allowance\",\n}\n\n// Fraction data structure matching the contract\nexport interface FractionData {\n token: string;\n expiration: number;\n manuallyClosed: boolean;\n minSharesToRaise: bigint;\n useCounterfactualAddress: boolean;\n claimedFromMinSharesToRaise: boolean;\n step: bigint;\n to: string;\n soldSteps: bigint;\n totalSteps: bigint;\n closer: string;\n}\n\n// Parameters for creating a new fraction\nexport interface CreateFractionParams {\n id: string; // bytes32 as hex string\n token: string;\n step: bigint; // Price per step in wei\n totalSteps: bigint;\n expiration: number; // Unix timestamp\n to: string; // Recipient address\n useCounterfactualAddress: boolean;\n minSharesToRaise: bigint; // 0 for no minimum\n closer: string; // Address allowed to manually close the sale\n}\n\n// Parameters for buying fractions\nexport interface BuyFractionsParams {\n creator: string;\n id: string; // bytes32 as hex string\n stepsToBuy: bigint;\n minStepsToBuy: bigint;\n refundTo: string; // Address to receive refunds if needed\n creditTo: string; // Address to credit the purchase to\n useCounterfactualAddressForRefund: boolean; // Whether to use counterfactual address for refunds\n}\n\n// Refund details structure matching the contract\nexport interface RefundDetails {\n refundTo: string;\n useCounterfactualAddress: boolean;\n}\n\n// Type-guard style helper to ensure a wallet client exists throughout the rest of the function.\nfunction assertWalletClient(\n maybeWalletClient: WalletClient | undefined\n): asserts maybeWalletClient is WalletClient {\n if (!maybeWalletClient) {\n throw new Error(OffchainFractionsError.SIGNER_NOT_AVAILABLE);\n }\n if (!maybeWalletClient.account) {\n throw new Error(\"Wallet client must have an account\");\n }\n}\n\nexport function useOffchainFractions(\n walletClient: WalletClient | undefined,\n publicClient: PublicClient | undefined,\n CHAIN_ID: number\n) {\n // Use dynamic addresses based on chain configuration\n const ADDRESSES = getAddresses(CHAIN_ID);\n\n // Framework-agnostic processing flag\n let isProcessing = false;\n const setIsProcessing = (value: boolean) => {\n isProcessing = value;\n };\n\n // Helper to assert public client is available\n function assertPublicClient(\n maybePublicClient: PublicClient | undefined\n ): asserts maybePublicClient is PublicClient {\n if (!maybePublicClient) {\n throw new Error(\"Public client not available\");\n }\n }\n\n /**\n * Check current token allowance for the offchain fractions contract\n * @param owner The wallet address to check allowance for\n * @param tokenAddress The token contract address\n */\n async function checkTokenAllowance(\n owner: string,\n tokenAddress: string\n ): Promise<bigint> {\n assertPublicClient(publicClient);\n\n try {\n const allowance = await publicClient.readContract({\n address: tokenAddress as Address,\n abi: ERC20_ABI,\n functionName: \"allowance\",\n args: [owner as Address, ADDRESSES.OFFCHAIN_FRACTIONS as Address],\n });\n return allowance as bigint;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Check user's token balance\n * @param owner The wallet address to check balance for\n * @param tokenAddress The token contract address\n */\n async function checkTokenBalance(\n owner: string,\n tokenAddress: string\n ): Promise<bigint> {\n assertPublicClient(publicClient);\n\n try {\n const balance = await publicClient.readContract({\n address: tokenAddress as Address,\n abi: ERC20_ABI,\n functionName: \"balanceOf\",\n args: [owner as Address],\n });\n return balance as bigint;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Approve tokens for the offchain fractions contract\n * @param tokenAddress The token contract address\n * @param amount Amount to approve (BigNumber)\n */\n async function approveToken(\n tokenAddress: string,\n amount: bigint\n ): Promise<boolean> {\n assertWalletClient(walletClient);\n assertPublicClient(publicClient);\n\n try {\n setIsProcessing(true);\n\n const hash = await walletClient.writeContract({\n address: tokenAddress as Address,\n abi: ERC20_ABI,\n functionName: \"approve\",\n args: [ADDRESSES.OFFCHAIN_FRACTIONS as Address, amount + 10000000n],\n chain: walletClient.chain,\n account: walletClient.account!,\n });\n\n await waitForViemTransactionWithRetry(publicClient, hash);\n\n return true;\n } catch (error) {\n throw new Error(parseViemError(error));\n } finally {\n setIsProcessing(false);\n }\n }\n\n /**\n * Create a new fractional token sale\n * @param params Parameters for creating the fraction\n */\n async function createFraction(params: CreateFractionParams): Promise<string> {\n assertWalletClient(walletClient);\n assertPublicClient(publicClient);\n\n try {\n setIsProcessing(true);\n\n sentryAddBreadcrumb({\n category: \"offchain-fractions\",\n message: \"createFraction.start\",\n level: \"info\",\n data: {\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n id: params.id,\n token: params.token,\n step: params.step.toString(),\n totalSteps: params.totalSteps.toString(),\n to: params.to,\n expiration: params.expiration,\n minSharesToRaise: params.minSharesToRaise.toString(),\n closer: params.closer,\n },\n });\n\n const {\n id,\n token,\n step,\n totalSteps,\n expiration,\n to,\n useCounterfactualAddress,\n minSharesToRaise,\n closer,\n } = params;\n\n // Validate parameters\n if (!id || !token || !to) {\n throw new Error(OffchainFractionsError.INVALID_PARAMETERS);\n }\n\n if (step === 0n || totalSteps === 0n) {\n throw new Error(\"Step and totalSteps must be greater than zero\");\n }\n\n if (minSharesToRaise > totalSteps) {\n throw new Error(\"minSharesToRaise cannot be greater than totalSteps\");\n }\n\n // Run a simulation first to surface any revert reason\n try {\n await publicClient.simulateContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"createFraction\",\n args: [\n id as `0x${string}`,\n token as Address,\n step,\n totalSteps,\n expiration,\n to as Address,\n useCounterfactualAddress,\n minSharesToRaise,\n closer as Address,\n ],\n account: walletClient.account!,\n });\n } catch (simulationError) {\n sentryCaptureException(simulationError, {\n action: \"createFraction.simulate\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n id: params.id,\n });\n throw new Error(parseViemError(simulationError));\n }\n\n // Execute the transaction\n const hash = await walletClient.writeContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"createFraction\",\n args: [\n id as `0x${string}`,\n token as Address,\n step,\n totalSteps,\n expiration,\n to as Address,\n useCounterfactualAddress,\n minSharesToRaise,\n closer as Address,\n ],\n chain: walletClient.chain,\n account: walletClient.account!,\n });\n\n await waitForViemTransactionWithRetry(publicClient, hash);\n\n return hash;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"createFraction\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n id: params.id,\n token: params.token,\n });\n throw new Error(parseViemError(error));\n } finally {\n setIsProcessing(false);\n }\n }\n\n /**\n * Buy fractions in an existing sale\n * @param params Parameters for buying fractions\n */\n async function buyFractions(params: BuyFractionsParams): Promise<string> {\n assertWalletClient(walletClient);\n assertPublicClient(publicClient);\n\n try {\n setIsProcessing(true);\n\n sentryAddBreadcrumb({\n category: \"offchain-fractions\",\n message: \"buyFractions.start\",\n level: \"info\",\n data: {\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n creator: params.creator,\n id: params.id,\n stepsToBuy: params.stepsToBuy.toString(),\n minStepsToBuy: params.minStepsToBuy.toString(),\n refundTo: params.refundTo,\n creditTo: params.creditTo,\n useCounterfactualAddressForRefund:\n params.useCounterfactualAddressForRefund,\n },\n });\n\n const {\n creator,\n id,\n stepsToBuy,\n minStepsToBuy,\n refundTo,\n creditTo,\n useCounterfactualAddressForRefund,\n } = params;\n\n // Validate parameters\n if (!creator || !id || !refundTo || !creditTo) {\n throw new Error(OffchainFractionsError.INVALID_PARAMETERS);\n }\n\n if (stepsToBuy === 0n) {\n throw new Error(\"stepsToBuy must be greater than zero\");\n }\n\n if (minStepsToBuy === 0n) {\n throw new Error(\"minStepsToBuy must be greater than zero\");\n }\n\n // Get fraction data to calculate required amount\n const fractionData = await getFraction(creator, id);\n const requiredAmount = stepsToBuy * fractionData.step;\n\n const owner = walletClient.account?.address;\n if (!owner) {\n throw new Error(\"No account found in wallet client\");\n }\n\n // Check token balance\n const balance = await checkTokenBalance(owner, fractionData.token);\n if (balance < requiredAmount) {\n throw new Error(OffchainFractionsError.INSUFFICIENT_BALANCE);\n }\n\n // Check and approve tokens if necessary\n const allowance = await checkTokenAllowance(owner, fractionData.token);\n if (allowance < requiredAmount) {\n const approveHash = await walletClient.writeContract({\n address: fractionData.token as Address,\n abi: ERC20_ABI,\n functionName: \"approve\",\n args: [\n ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n requiredAmount + 10000000n,\n ],\n chain: walletClient.chain,\n account: walletClient.account!,\n });\n await waitForViemTransactionWithRetry(publicClient, approveHash);\n }\n\n // Run a simulation first to surface any revert reason\n try {\n await publicClient.simulateContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"buyFractions\",\n args: [\n creator as Address,\n id as `0x${string}`,\n stepsToBuy,\n minStepsToBuy,\n refundTo as Address,\n creditTo as Address,\n useCounterfactualAddressForRefund,\n ],\n account: walletClient.account!,\n });\n } catch (simulationError) {\n sentryCaptureException(simulationError, {\n action: \"buyFractions.simulate\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n creator: params.creator,\n id: params.id,\n });\n throw new Error(parseViemError(simulationError));\n }\n\n // Execute the transaction\n const hash = await walletClient.writeContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"buyFractions\",\n args: [\n creator as Address,\n id as `0x${string}`,\n stepsToBuy,\n minStepsToBuy,\n refundTo as Address,\n creditTo as Address,\n useCounterfactualAddressForRefund,\n ],\n chain: walletClient.chain,\n account: walletClient.account!,\n });\n\n await waitForViemTransactionWithRetry(publicClient, hash);\n\n return hash;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"buyFractions\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n creator: params.creator,\n refundTo: params.refundTo,\n creditTo: params.creditTo,\n useCounterfactualAddressForRefund:\n params.useCounterfactualAddressForRefund,\n id: params.id,\n stepsToBuy: params.stepsToBuy.toString(),\n minStepsToBuy: params.minStepsToBuy.toString(),\n });\n throw new Error(parseViemError(error));\n } finally {\n setIsProcessing(false);\n }\n }\n\n /**\n * Claim refund from an unfilled sale\n * @param user The user address claiming the refund\n * @param creator The address that created the fraction sale\n * @param id The unique identifier of the fraction sale\n */\n async function claimRefund(\n user: string,\n creator: string,\n id: string\n ): Promise<string> {\n assertWalletClient(walletClient);\n assertPublicClient(publicClient);\n\n try {\n setIsProcessing(true);\n\n sentryAddBreadcrumb({\n category: \"offchain-fractions\",\n message: \"claimRefund.start\",\n level: \"info\",\n data: {\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n user,\n creator,\n id,\n },\n });\n\n // Normalize addresses to lowercase for consistency\n const normalizedUser = user?.toLowerCase();\n const normalizedCreator = creator?.toLowerCase();\n\n // Debug logging\n console.log(\"claimRefund parameters:\", {\n user,\n creator,\n id,\n normalizedUser,\n normalizedCreator,\n userType: typeof user,\n creatorType: typeof creator,\n idType: typeof id,\n });\n\n // Validate parameters\n if (!normalizedUser || !normalizedCreator || !id) {\n throw new Error(OffchainFractionsError.INVALID_PARAMETERS);\n }\n\n const owner = walletClient.account?.address;\n if (!owner) {\n throw new Error(\"No account found in wallet client\");\n }\n\n // Check if user has steps purchased\n const userSteps = await getStepsPurchased(user, creator, id);\n if (userSteps === 0n) {\n throw new Error(\"No steps purchased for this fraction\");\n }\n\n // Run a simulation first to surface any revert reason\n try {\n console.log(\"Calling claimRefund simulation with:\", {\n user,\n creator,\n id,\n from: owner,\n contractMethod: \"claimRefund\",\n });\n\n await publicClient.simulateContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"claimRefund\",\n args: [user as Address, creator as Address, id as `0x${string}`],\n account: walletClient.account!,\n });\n } catch (simulationError) {\n sentryCaptureException(simulationError, {\n action: \"claimRefund.simulate\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n user,\n creator,\n id,\n });\n throw new Error(parseViemError(simulationError));\n }\n\n // Execute the transaction\n const hash = await walletClient.writeContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"claimRefund\",\n args: [user as Address, creator as Address, id as `0x${string}`],\n chain: walletClient.chain,\n account: walletClient.account!,\n });\n\n await waitForViemTransactionWithRetry(publicClient, hash);\n\n return hash;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"claimRefund\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n user,\n creator,\n id,\n });\n throw new Error(parseViemError(error));\n } finally {\n setIsProcessing(false);\n }\n }\n\n /**\n * Close a fraction sale manually (only by closer)\n * @param creator The address that created the fraction sale\n * @param id The unique identifier of the fraction sale to close\n */\n async function closeFraction(creator: string, id: string): Promise<string> {\n assertWalletClient(walletClient);\n assertPublicClient(publicClient);\n\n try {\n setIsProcessing(true);\n\n sentryAddBreadcrumb({\n category: \"offchain-fractions\",\n message: \"closeFraction.start\",\n level: \"info\",\n data: {\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n creator,\n id,\n },\n });\n\n // Validate parameters\n if (!creator || !id) {\n throw new Error(OffchainFractionsError.INVALID_PARAMETERS);\n }\n\n const owner = walletClient.account?.address;\n if (!owner) {\n throw new Error(\"No account found in wallet client\");\n }\n\n // Run a simulation first to surface any revert reason\n try {\n await publicClient.simulateContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"closeFraction\",\n args: [creator as Address, id as `0x${string}`],\n account: walletClient.account!,\n });\n } catch (simulationError) {\n sentryCaptureException(simulationError, {\n action: \"closeFraction.simulate\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n creator,\n id,\n });\n throw new Error(parseViemError(simulationError));\n }\n\n // Execute the transaction\n const hash = await walletClient.writeContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"closeFraction\",\n args: [creator as Address, id as `0x${string}`],\n chain: walletClient.chain,\n account: walletClient.account!,\n });\n\n await waitForViemTransactionWithRetry(publicClient, hash);\n\n return hash;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"closeFraction\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n creator,\n id,\n });\n throw new Error(parseViemError(error));\n } finally {\n setIsProcessing(false);\n }\n }\n\n /**\n * Get fraction data for a specific creator and ID\n * @param creator The address that created the fraction sale\n * @param id The unique identifier of the fraction sale\n */\n async function getFraction(\n creator: string,\n id: string\n ): Promise<FractionData> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"getFraction\",\n args: [creator as Address, id as `0x${string}`],\n })) as any;\n\n return {\n token: result.token,\n expiration: Number(result.expiration),\n manuallyClosed: result.manuallyClosed,\n minSharesToRaise: result.minSharesToRaise,\n useCounterfactualAddress: result.useCounterfactualAddress,\n claimedFromMinSharesToRaise: result.claimedFromMinSharesToRaise,\n step: result.step,\n to: result.to,\n soldSteps: result.soldSteps,\n totalSteps: result.totalSteps,\n closer: result.closer,\n };\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Get the number of steps purchased by a user for a specific fraction\n * @param user The user address\n * @param creator The address that created the fraction sale\n * @param id The unique identifier of the fraction sale\n */\n async function getStepsPurchased(\n user: string,\n creator: string,\n id: string\n ): Promise<bigint> {\n assertPublicClient(publicClient);\n\n try {\n // Debug logging\n console.log(\"getStepsPurchased parameters:\", {\n user,\n creator,\n id,\n contractAddress: ADDRESSES.OFFCHAIN_FRACTIONS,\n });\n\n const result = (await publicClient.readContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"stepsPurchased\",\n args: [user as Address, creator as Address, id as `0x${string}`],\n })) as bigint;\n\n console.log(\"getStepsPurchased result:\", result.toString());\n return result;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Get the refund wildcard operator address\n * @returns The wildcard operator address that can perform refunds for any user\n */\n async function getRefundWildcardOperator(): Promise<string> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"REFUND_WILDCARD_OPERATOR\",\n args: [],\n })) as string;\n return result;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Get refund details for a user's purchase\n * @param user The user address\n * @param creator The address that created the fraction sale\n * @param id The unique identifier of the fraction sale\n */\n async function getRefundDetails(\n user: string,\n creator: string,\n id: string\n ): Promise<RefundDetails> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"getRefundDetails\",\n args: [user as Address, creator as Address, id as `0x${string}`],\n })) as any;\n return {\n refundTo: result.refundTo,\n useCounterfactualAddress: result.useCounterfactualAddress,\n };\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Set refund details for a user's purchase\n * @param creator The address that created the fraction sale\n * @param id The unique identifier of the fraction sale\n * @param refundTo The address to receive refunds\n * @param useCounterfactualAddress Whether to use counterfactual address for refunds\n */\n async function setRefundDetails(\n creator: string,\n id: string,\n refundTo: string,\n useCounterfactualAddress: boolean\n ): Promise<string> {\n assertWalletClient(walletClient);\n assertPublicClient(publicClient);\n\n try {\n setIsProcessing(true);\n\n sentryAddBreadcrumb({\n category: \"offchain-fractions\",\n message: \"setRefundDetails.start\",\n level: \"info\",\n data: {\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n creator,\n id,\n refundTo,\n useCounterfactualAddress,\n },\n });\n\n // Validate parameters\n if (!creator || !id || !refundTo) {\n throw new Error(OffchainFractionsError.INVALID_PARAMETERS);\n }\n\n const owner = walletClient.account?.address;\n if (!owner) {\n throw new Error(\"No account found in wallet client\");\n }\n\n // Run a simulation first to surface any revert reason\n try {\n await publicClient.simulateContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"setRefundDetails\",\n args: [\n creator as Address,\n id as `0x${string}`,\n refundTo as Address,\n useCounterfactualAddress,\n ],\n account: walletClient.account!,\n });\n } catch (simulationError) {\n sentryCaptureException(simulationError, {\n action: \"setRefundDetails.simulate\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n creator,\n id,\n });\n throw new Error(parseViemError(simulationError));\n }\n\n // Execute the transaction\n const hash = await walletClient.writeContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"setRefundDetails\",\n args: [\n creator as Address,\n id as `0x${string}`,\n refundTo as Address,\n useCounterfactualAddress,\n ],\n chain: walletClient.chain,\n account: walletClient.account!,\n });\n\n await waitForViemTransactionWithRetry(publicClient, hash);\n\n return hash;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"setRefundDetails\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n creator,\n id,\n refundTo,\n });\n throw new Error(parseViemError(error));\n } finally {\n setIsProcessing(false);\n }\n }\n\n /**\n * Set refund operator approval status\n * @param refundOperator The address of the refund operator\n * @param isApproved Whether to approve or revoke the operator\n */\n async function setRefundOperatorStatus(\n refundOperator: string,\n isApproved: boolean\n ): Promise<string> {\n assertWalletClient(walletClient);\n assertPublicClient(publicClient);\n\n try {\n setIsProcessing(true);\n\n sentryAddBreadcrumb({\n category: \"offchain-fractions\",\n message: \"setRefundOperatorStatus.start\",\n level: \"info\",\n data: {\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n refundOperator,\n isApproved,\n },\n });\n\n // Validate parameters\n if (!refundOperator) {\n throw new Error(OffchainFractionsError.INVALID_PARAMETERS);\n }\n\n const owner = walletClient.account?.address;\n if (!owner) {\n throw new Error(\"No account found in wallet client\");\n }\n\n // Run a simulation first to surface any revert reason\n try {\n await publicClient.simulateContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"setRefundOperatorStatus\",\n args: [refundOperator as Address, isApproved],\n account: walletClient.account!,\n });\n } catch (simulationError) {\n sentryCaptureException(simulationError, {\n action: \"setRefundOperatorStatus.simulate\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n refundOperator,\n isApproved,\n });\n throw new Error(parseViemError(simulationError));\n }\n\n // Execute the transaction\n const hash = await walletClient.writeContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"setRefundOperatorStatus\",\n args: [refundOperator as Address, isApproved],\n chain: walletClient.chain,\n account: walletClient.account!,\n });\n\n await waitForViemTransactionWithRetry(publicClient, hash);\n\n return hash;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"setRefundOperatorStatus\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.OFFCHAIN_FRACTIONS,\n refundOperator,\n isApproved,\n });\n throw new Error(parseViemError(error));\n } finally {\n setIsProcessing(false);\n }\n }\n\n /**\n * Check if a refund operator is approved for a user\n * @param user The user address\n * @param refundOperator The refund operator address\n */\n async function isRefundOperatorApproved(\n user: string,\n refundOperator: string\n ): Promise<boolean> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"isRefundOperatorApproved\",\n args: [user as Address, refundOperator as Address],\n })) as boolean;\n return result;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Get refund approval status for a user and operator\n * @param user The user address\n * @param refundOperator The refund operator address\n */\n async function getRefundApprovalStatus(\n user: string,\n refundOperator: string\n ): Promise<boolean> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"refundApprovals\",\n args: [user as Address, refundOperator as Address],\n })) as any;\n return result.isApproved;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Check if a fraction sale is expired\n * @param creator The address that created the fraction sale\n * @param id The unique identifier of the fraction sale\n */\n async function isFractionExpired(\n creator: string,\n id: string\n ): Promise<boolean> {\n try {\n const fraction = await getFraction(creator, id);\n return Date.now() / 1000 > fraction.expiration;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Check if a fraction sale has reached its minimum shares threshold\n * @param creator The address that created the fraction sale\n * @param id The unique identifier of the fraction sale\n */\n async function hasReachedMinimumShares(\n creator: string,\n id: string\n ): Promise<boolean> {\n try {\n const fraction = await getFraction(creator, id);\n return fraction.soldSteps >= fraction.minSharesToRaise;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Check if a fraction sale is completely filled\n * @param creator The address that created the fraction sale\n * @param id The unique identifier of the fraction sale\n */\n async function isFractionCompletelyFilled(\n creator: string,\n id: string\n ): Promise<boolean> {\n try {\n const fraction = await getFraction(creator, id);\n return fraction.soldSteps >= fraction.totalSteps;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Calculate the total amount raised for a fraction\n * @param creator The address that created the fraction sale\n * @param id The unique identifier of the fraction sale\n */\n async function getTotalAmountRaised(\n creator: string,\n id: string\n ): Promise<bigint> {\n try {\n const fraction = await getFraction(creator, id);\n return fraction.soldSteps * fraction.step;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Calculate the remaining steps available for purchase\n * @param creator The address that created the fraction sale\n * @param id The unique identifier of the fraction sale\n */\n async function getRemainingSteps(\n creator: string,\n id: string\n ): Promise<bigint> {\n try {\n const fraction = await getFraction(creator, id);\n return fraction.totalSteps - fraction.soldSteps;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Estimate gas for creating a fraction\n * @param params Parameters for creating the fraction\n * @param ethPriceInUSD Current ETH price in USD (for cost estimation)\n */\n async function estimateGasForCreateFraction(\n params: CreateFractionParams,\n ethPriceInUSD: number | null\n ): Promise<string> {\n assertWalletClient(walletClient);\n assertPublicClient(publicClient);\n\n try {\n const {\n id,\n token,\n step,\n totalSteps,\n expiration,\n to,\n useCounterfactualAddress,\n minSharesToRaise,\n closer,\n } = params;\n\n const gasPrice = await publicClient.getGasPrice();\n if (!gasPrice) {\n throw new Error(\"Could not fetch gas price to estimate cost.\");\n }\n\n const estimatedGas = await publicClient.estimateContractGas({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"createFraction\",\n args: [\n id as `0x${string}`,\n token as Address,\n step,\n totalSteps,\n expiration,\n to as Address,\n useCounterfactualAddress,\n minSharesToRaise,\n closer as Address,\n ],\n account: walletClient.account!,\n });\n\n const estimatedCost: bigint = estimatedGas * gasPrice;\n\n if (ethPriceInUSD) {\n const estimatedCostInEth = formatEther(estimatedCost);\n const estimatedCostInUSD = (\n parseFloat(estimatedCostInEth) * ethPriceInUSD\n ).toFixed(2);\n return estimatedCostInUSD;\n } else {\n throw new Error(\n \"Could not fetch the ETH price to calculate cost in USD.\"\n );\n }\n } catch (error: any) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Estimate gas for buying fractions\n * @param params Parameters for buying fractions\n * @param ethPriceInUSD Current ETH price in USD (for cost estimation)\n */\n async function estimateGasForBuyFractions(\n params: BuyFractionsParams,\n ethPriceInUSD: number | null\n ): Promise<string> {\n assertWalletClient(walletClient);\n assertPublicClient(publicClient);\n\n try {\n const {\n creator,\n id,\n stepsToBuy,\n minStepsToBuy,\n refundTo,\n creditTo,\n useCounterfactualAddressForRefund,\n } = params;\n\n const gasPrice = await publicClient.getGasPrice();\n if (!gasPrice) {\n throw new Error(\"Could not fetch gas price to estimate cost.\");\n }\n\n const estimatedGas = await publicClient.estimateContractGas({\n address: ADDRESSES.OFFCHAIN_FRACTIONS as Address,\n abi: OFFCHAIN_FRACTIONS_ABI,\n functionName: \"buyFractions\",\n args: [\n creator as Address,\n id as `0x${string}`,\n stepsToBuy,\n minStepsToBuy,\n refundTo as Address,\n creditTo as Address,\n useCounterfactualAddressForRefund,\n ],\n account: walletClient.account!,\n });\n\n const estimatedCost: bigint = estimatedGas * gasPrice;\n\n if (ethPriceInUSD) {\n const estimatedCostInEth = formatEther(estimatedCost);\n const estimatedCostInUSD = (\n parseFloat(estimatedCostInEth) * ethPriceInUSD\n ).toFixed(2);\n return estimatedCostInUSD;\n } else {\n throw new Error(\n \"Could not fetch the ETH price to calculate cost in USD.\"\n );\n }\n } catch (error: any) {\n throw new Error(parseViemError(error));\n }\n }\n\n return {\n // Core contract functions\n createFraction,\n buyFractions,\n claimRefund,\n closeFraction,\n\n // View functions\n getFraction,\n getStepsPurchased,\n\n // Refund management functions\n getRefundWildcardOperator,\n getRefundDetails,\n setRefundDetails,\n setRefundOperatorStatus,\n isRefundOperatorApproved,\n getRefundApprovalStatus,\n\n // Token operations\n approveToken,\n checkTokenAllowance,\n checkTokenBalance,\n\n // Utility functions\n isFractionExpired,\n hasReachedMinimumShares,\n isFractionCompletelyFilled,\n getTotalAmountRaised,\n getRemainingSteps,\n\n // Gas estimation\n estimateGasForCreateFraction,\n estimateGasForBuyFractions,\n\n // State\n get isProcessing() {\n return isProcessing;\n },\n addresses: ADDRESSES,\n\n // Wallet client availability\n isSignerAvailable: !!walletClient,\n };\n}\n","export const REWARDS_KERNEL_ABI = [\n {\n inputs: [\n { internalType: \"address\", name: \"_foundationMultisig\", type: \"address\" },\n { internalType: \"address\", name: \"_rejectionMultisig\", type: \"address\" },\n {\n internalType: \"contract CounterfactualHolderFactory\",\n name: \"f\",\n type: \"address\",\n },\n { internalType: \"uint256\", name: \"_finality\", type: \"uint256\" },\n ],\n stateMutability: \"payable\",\n type: \"constructor\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"target\", type: \"address\" }],\n name: \"AddressEmptyCode\",\n type: \"error\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"account\", type: \"address\" }],\n name: \"AddressInsufficientBalance\",\n type: \"error\",\n },\n { inputs: [], name: \"AlreadyClaimedNonce\", type: \"error\" },\n { inputs: [], name: \"AlreadyFinalized\", type: \"error\" },\n { inputs: [], name: \"AlreadyRejected\", type: \"error\" },\n { inputs: [], name: \"CannotClaimFromRejectedNonce\", type: \"error\" },\n { inputs: [], name: \"CannotPostZeroRoot\", type: \"error\" },\n { inputs: [], name: \"DuplicateToken\", type: \"error\" },\n { inputs: [], name: \"FailedInnerCall\", type: \"error\" },\n { inputs: [], name: \"InvalidMerkleProof\", type: \"error\" },\n { inputs: [], name: \"LengthsDontMatch\", type: \"error\" },\n { inputs: [], name: \"MaxClaimedExceeded\", type: \"error\" },\n { inputs: [], name: \"NonexistentDataAtNonce\", type: \"error\" },\n { inputs: [], name: \"NotFoundationMultisig\", type: \"error\" },\n { inputs: [], name: \"NotRejectionMultisig\", type: \"error\" },\n { inputs: [], name: \"NotYetFinalized\", type: \"error\" },\n { inputs: [], name: \"ReentrancyGuardReentrantCall\", type: \"error\" },\n {\n inputs: [{ internalType: \"address\", name: \"token\", type: \"address\" }],\n name: \"SafeERC20FailedOperation\",\n type: \"error\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"uint256\",\n name: \"nonce\",\n type: \"uint256\",\n },\n ],\n name: \"NonceRejected\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, internalType: \"address\", name: \"user\", type: \"address\" },\n { indexed: true, internalType: \"address\", name: \"to\", type: \"address\" },\n {\n indexed: true,\n internalType: \"uint256\",\n name: \"nonce\",\n type: \"uint256\",\n },\n {\n indexed: false,\n internalType: \"address\",\n name: \"from\",\n type: \"address\",\n },\n {\n components: [\n { internalType: \"address\", name: \"token\", type: \"address\" },\n { internalType: \"uint256\", name: \"amount\", type: \"uint256\" },\n ],\n indexed: false,\n internalType: \"struct FoundationRewardKernel.TokenAndAmount[]\",\n name: \"taa\",\n type: \"tuple[]\",\n },\n {\n indexed: false,\n internalType: \"bool[]\",\n name: \"isGuarded\",\n type: \"bool[]\",\n },\n ],\n name: \"RewardClaimed\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"uint256\",\n name: \"nonce\",\n type: \"uint256\",\n },\n { indexed: true, internalType: \"bytes32\", name: \"root\", type: \"bytes32\" },\n {\n components: [\n { internalType: \"address\", name: \"token\", type: \"address\" },\n { internalType: \"uint256\", name: \"amount\", type: \"uint256\" },\n ],\n indexed: false,\n internalType: \"struct FoundationRewardKernel.TokenAndAmount[]\",\n name: \"taa\",\n type: \"tuple[]\",\n },\n ],\n name: \"RootPosted\",\n type: \"event\",\n },\n {\n inputs: [],\n name: \"$nextPostNonce\",\n outputs: [{ internalType: \"uint256\", name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"CFH_FACTORY\",\n outputs: [\n {\n internalType: \"contract CounterfactualHolderFactory\",\n name: \"\",\n type: \"address\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"FINALITY\",\n outputs: [{ internalType: \"uint256\", name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"FOUNDATION_MULTISIG\",\n outputs: [{ internalType: \"address\", name: \"\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"REJECTION_MULTISIG\",\n outputs: [{ internalType: \"address\", name: \"\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"uint256\", name: \"nonce\", type: \"uint256\" },\n { internalType: \"bytes32[]\", name: \"proof\", type: \"bytes32[]\" },\n {\n components: [\n { internalType: \"address\", name: \"token\", type: \"address\" },\n { internalType: \"uint256\", name: \"amount\", type: \"uint256\" },\n ],\n internalType: \"struct FoundationRewardKernel.TokenAndAmount[]\",\n name: \"taa\",\n type: \"tuple[]\",\n },\n { internalType: \"address\", name: \"from\", type: \"address\" },\n { internalType: \"address\", name: \"to\", type: \"address\" },\n { internalType: \"bool[]\", name: \"isGuardedToken\", type: \"bool[]\" },\n { internalType: \"bool[]\", name: \"toCounterfactual\", type: \"bool[]\" },\n ],\n name: \"claimPayout\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"uint256\", name: \"nonce\", type: \"uint256\" },\n { internalType: \"address\", name: \"token\", type: \"address\" },\n ],\n name: \"getAmountClaimed\",\n outputs: [{ internalType: \"uint256\", name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"uint256\", name: \"nonce\", type: \"uint256\" },\n { internalType: \"address\", name: \"token\", type: \"address\" },\n ],\n name: \"getMaxReward\",\n outputs: [{ internalType: \"uint256\", name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"uint256\", name: \"nonce\", type: \"uint256\" }],\n name: \"getRewardMeta\",\n outputs: [\n { internalType: \"bytes32\", name: \"merkleRoot\", type: \"bytes32\" },\n { internalType: \"uint48\", name: \"pushTimestamp\", type: \"uint48\" },\n { internalType: \"bool\", name: \"rejected\", type: \"bool\" },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"user\", type: \"address\" },\n { internalType: \"uint256\", name: \"nonce\", type: \"uint256\" },\n ],\n name: \"isClaimed\",\n outputs: [{ internalType: \"bool\", name: \"\", type: \"bool\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"uint256\", name: \"nonce\", type: \"uint256\" }],\n name: \"isFinalized\",\n outputs: [{ internalType: \"bool\", name: \"\", type: \"bool\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"bytes[]\", name: \"data\", type: \"bytes[]\" }],\n name: \"multicall\",\n outputs: [{ internalType: \"bytes[]\", name: \"results\", type: \"bytes[]\" }],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"bytes32\", name: \"root\", type: \"bytes32\" },\n {\n components: [\n { internalType: \"address\", name: \"token\", type: \"address\" },\n { internalType: \"uint256\", name: \"amount\", type: \"uint256\" },\n ],\n internalType: \"struct FoundationRewardKernel.TokenAndAmount[]\",\n name: \"taa\",\n type: \"tuple[]\",\n },\n ],\n name: \"postPayoutRoot\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"uint256\", name: \"nonce\", type: \"uint256\" }],\n name: \"rejectNonce\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n] as const;\n","import {\n type WalletClient,\n type PublicClient,\n type Address,\n formatEther,\n} from \"viem\";\nimport { REWARDS_KERNEL_ABI } from \"../abis/rewardKernelABI\";\nimport { getAddresses } from \"../../constants/addresses\";\nimport {\n parseViemError,\n waitForViemTransactionWithRetry,\n} from \"../../utils/transaction-utils\";\nimport {\n sentryAddBreadcrumb,\n sentryCaptureException,\n} from \"../../utils/sentry\";\n\nexport enum RewardsKernelError {\n CONTRACT_NOT_AVAILABLE = \"Contract not available\",\n SIGNER_NOT_AVAILABLE = \"Signer not available\",\n UNKNOWN_ERROR = \"Unknown error\",\n INVALID_PARAMETERS = \"Invalid parameters\",\n ALREADY_CLAIMED = \"Already claimed from this nonce\",\n NOT_FINALIZED = \"Nonce not yet finalized\",\n NONCE_REJECTED = \"Cannot claim from rejected nonce\",\n}\n\n// Token and amount structure matching the contract\nexport interface TokenAndAmount {\n token: `0x${string}`;\n amount: bigint;\n}\n\n// Reward metadata structure\nexport interface RewardMeta {\n merkleRoot: string;\n pushTimestamp: number;\n rejected: boolean;\n}\n\n// Parameters for claiming a payout\nexport interface ClaimPayoutParams {\n nonce: bigint;\n proof: `0x${string}`[]; // bytes32[] as hex strings\n tokensAndAmounts: TokenAndAmount[];\n from: `0x${string}`; // Address providing the tokens\n to: `0x${string}`; // Address receiving the tokens\n isGuardedToken: boolean[]; // Which tokens are guarded\n toCounterfactual: boolean[]; // Whether to send to counterfactual wallet\n}\n\n// Type-guard style helper to ensure a wallet client exists\nfunction assertWalletClient(\n maybeWalletClient: WalletClient | undefined\n): asserts maybeWalletClient is WalletClient {\n if (!maybeWalletClient) {\n throw new Error(RewardsKernelError.SIGNER_NOT_AVAILABLE);\n }\n if (!maybeWalletClient.account) {\n throw new Error(\"Wallet client must have an account\");\n }\n}\n\nexport function useRewardsKernel(\n walletClient: WalletClient | undefined,\n publicClient: PublicClient | undefined,\n CHAIN_ID: number\n) {\n // Use dynamic addresses based on chain configuration\n const ADDRESSES = getAddresses(CHAIN_ID);\n\n // Framework-agnostic processing flag\n let isProcessing = false;\n const setIsProcessing = (value: boolean) => {\n isProcessing = value;\n };\n\n // Helper to assert public client is available\n function assertPublicClient(\n maybePublicClient: PublicClient | undefined\n ): asserts maybePublicClient is PublicClient {\n if (!maybePublicClient) {\n throw new Error(\"Public client not available\");\n }\n }\n\n /**\n * Claim payout from a finalized nonce\n * @param params Parameters for claiming the payout\n */\n async function claimPayout(params: ClaimPayoutParams): Promise<string> {\n assertWalletClient(walletClient);\n assertPublicClient(publicClient);\n\n try {\n setIsProcessing(true);\n\n sentryAddBreadcrumb({\n category: \"rewards-kernel\",\n message: \"claimPayout.start\",\n level: \"info\",\n data: {\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.REWARDS_KERNEL,\n nonce: params.nonce.toString(),\n to: params.to,\n from: params.from,\n tokensCount: params.tokensAndAmounts.length,\n },\n });\n\n const {\n nonce,\n proof,\n tokensAndAmounts,\n from,\n to,\n isGuardedToken,\n toCounterfactual,\n } = params;\n\n // Validate parameters\n if (!proof || proof.length === 0) {\n throw new Error(\"Merkle proof is required\");\n }\n\n if (!tokensAndAmounts || tokensAndAmounts.length === 0) {\n throw new Error(\"Tokens and amounts are required\");\n }\n\n if (isGuardedToken.length !== tokensAndAmounts.length) {\n throw new Error(\n \"isGuardedToken array length must match tokensAndAmounts\"\n );\n }\n\n if (toCounterfactual.length !== tokensAndAmounts.length) {\n throw new Error(\n \"toCounterfactual array length must match tokensAndAmounts\"\n );\n }\n\n if (!from || !to) {\n throw new Error(RewardsKernelError.INVALID_PARAMETERS);\n }\n\n // Check if already claimed\n const owner = walletClient.account?.address;\n if (!owner) {\n throw new Error(\"No account found in wallet client\");\n }\n\n const alreadyClaimed = await isClaimed(owner, nonce);\n if (alreadyClaimed) {\n throw new Error(RewardsKernelError.ALREADY_CLAIMED);\n }\n\n // Check if finalized\n const finalized = await isFinalized(nonce);\n if (!finalized) {\n throw new Error(RewardsKernelError.NOT_FINALIZED);\n }\n\n // Run a simulation first to surface any revert reason\n try {\n console.log(\"Simulating claimPayout with:\", {\n nonce: nonce.toString(),\n proof: proof,\n tokensAndAmounts: tokensAndAmounts,\n from: from,\n to: to,\n isGuardedToken: isGuardedToken,\n toCounterfactual: toCounterfactual,\n });\n await publicClient.simulateContract({\n address: ADDRESSES.REWARDS_KERNEL as Address,\n abi: REWARDS_KERNEL_ABI,\n functionName: \"claimPayout\",\n args: [\n nonce,\n proof as `0x${string}`[],\n tokensAndAmounts as readonly {\n token: `0x${string}`;\n amount: bigint;\n }[],\n from as Address,\n to as Address,\n isGuardedToken,\n toCounterfactual,\n ],\n account: walletClient.account!,\n });\n } catch (simulationError) {\n sentryCaptureException(simulationError, {\n action: \"claimPayout.simulate\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.REWARDS_KERNEL,\n nonce: nonce.toString(),\n tokensAndAmounts: tokensAndAmounts,\n proof: proof,\n from: from,\n to: to,\n isGuardedToken: isGuardedToken,\n toCounterfactual: toCounterfactual,\n });\n throw new Error(parseViemError(simulationError));\n }\n\n console.log(\"Executing claimPayout with:\", {\n nonce: nonce.toString(),\n proof: proof,\n tokensAndAmounts: tokensAndAmounts,\n from: from,\n to: to,\n isGuardedToken: isGuardedToken,\n toCounterfactual: toCounterfactual,\n });\n // Execute the transaction\n const hash = await walletClient.writeContract({\n address: ADDRESSES.REWARDS_KERNEL as Address,\n abi: REWARDS_KERNEL_ABI,\n functionName: \"claimPayout\",\n args: [\n nonce,\n proof as `0x${string}`[],\n tokensAndAmounts as readonly {\n token: `0x${string}`;\n amount: bigint;\n }[],\n from as Address,\n to as Address,\n isGuardedToken,\n toCounterfactual,\n ],\n chain: walletClient.chain,\n account: walletClient.account!,\n });\n\n await waitForViemTransactionWithRetry(publicClient, hash);\n\n return hash;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"claimPayout\",\n chainId: walletClient?.chain?.id,\n contract: ADDRESSES.REWARDS_KERNEL,\n nonce: params.nonce.toString(),\n from: params.from,\n proof: params.proof,\n tokensAndAmounts: params.tokensAndAmounts,\n to: params.to,\n isGuardedToken: params.isGuardedToken,\n toCounterfactual: params.toCounterfactual,\n });\n throw new Error(parseViemError(error));\n } finally {\n setIsProcessing(false);\n }\n }\n\n /**\n * Get reward metadata for a specific nonce\n * @param nonce The nonce to query\n */\n async function getRewardMeta(nonce: bigint): Promise<RewardMeta> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.REWARDS_KERNEL as Address,\n abi: REWARDS_KERNEL_ABI,\n functionName: \"getRewardMeta\",\n args: [nonce],\n })) as any;\n\n return {\n merkleRoot: result[0],\n pushTimestamp: Number(result[1]),\n rejected: result[2],\n };\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Get the maximum claimable amount for a token at a specific nonce\n * @param nonce The nonce to query\n * @param token The token address\n */\n async function getMaxReward(\n nonce: bigint,\n token: `0x${string}`\n ): Promise<bigint> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.REWARDS_KERNEL as Address,\n abi: REWARDS_KERNEL_ABI,\n functionName: \"getMaxReward\",\n args: [nonce, token as Address],\n })) as bigint;\n\n return result;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Get the amount already claimed for a token at a specific nonce\n * @param nonce The nonce to query\n * @param token The token address\n */\n async function getAmountClaimed(\n nonce: bigint,\n token: `0x${string}`\n ): Promise<bigint> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.REWARDS_KERNEL as Address,\n abi: REWARDS_KERNEL_ABI,\n functionName: \"getAmountClaimed\",\n args: [nonce, token as Address],\n })) as bigint;\n\n return result;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Check if a nonce is finalized and claimable\n * @param nonce The nonce to check\n */\n async function isFinalized(nonce: bigint): Promise<boolean> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.REWARDS_KERNEL as Address,\n abi: REWARDS_KERNEL_ABI,\n functionName: \"isFinalized\",\n args: [nonce],\n })) as boolean;\n\n return result;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Check if a user has already claimed from a specific nonce\n * @param user The user address\n * @param nonce The nonce to check\n */\n async function isClaimed(\n user: `0x${string}`,\n nonce: bigint\n ): Promise<boolean> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.REWARDS_KERNEL as Address,\n abi: REWARDS_KERNEL_ABI,\n functionName: \"isClaimed\",\n args: [user as Address, nonce],\n })) as boolean;\n\n return result;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Get the next nonce that will be used for posting\n */\n async function getNextPostNonce(): Promise<bigint> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.REWARDS_KERNEL as Address,\n abi: REWARDS_KERNEL_ABI,\n functionName: \"$nextPostNonce\",\n args: [],\n })) as bigint;\n\n return result;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Get the finality period in seconds\n */\n async function getFinality(): Promise<bigint> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.REWARDS_KERNEL as Address,\n abi: REWARDS_KERNEL_ABI,\n functionName: \"FINALITY\",\n args: [],\n })) as bigint;\n\n return result;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Get the foundation multisig address\n */\n async function getFoundationMultisig(): Promise<string> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.REWARDS_KERNEL as Address,\n abi: REWARDS_KERNEL_ABI,\n functionName: \"FOUNDATION_MULTISIG\",\n args: [],\n })) as string;\n\n return result;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Get the rejection multisig address\n */\n async function getRejectionMultisig(): Promise<string> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.REWARDS_KERNEL as Address,\n abi: REWARDS_KERNEL_ABI,\n functionName: \"REJECTION_MULTISIG\",\n args: [],\n })) as string;\n\n return result;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Get the counterfactual holder factory address\n */\n async function getCFHFactory(): Promise<string> {\n assertPublicClient(publicClient);\n\n try {\n const result = (await publicClient.readContract({\n address: ADDRESSES.REWARDS_KERNEL as Address,\n abi: REWARDS_KERNEL_ABI,\n functionName: \"CFH_FACTORY\",\n args: [],\n })) as string;\n\n return result;\n } catch (error) {\n throw new Error(parseViemError(error));\n }\n }\n\n /**\n * Estimate gas for claiming a payout\n * @param params Parameters for claiming the payout\n * @param ethPriceInUSD Current ETH price in USD (for cost estimation)\n */\n async function estimateGasForClaimPayout(\n params: ClaimPayoutParams,\n ethPriceInUSD: number | null\n ): Promise<string> {\n assertWalletClient(walletClient);\n assertPublicClient(publicClient);\n\n try {\n const {\n nonce,\n proof,\n tokensAndAmounts,\n from,\n to,\n isGuardedToken,\n toCounterfactual,\n } = params;\n\n const gasPrice = await publicClient.getGasPrice();\n if (!gasPrice) {\n throw new Error(\"Could not fetch gas price to estimate cost.\");\n }\n\n const estimatedGas = await publicClient.estimateContractGas({\n address: ADDRESSES.REWARDS_KERNEL as Address,\n abi: REWARDS_KERNEL_ABI,\n functionName: \"claimPayout\",\n args: [\n nonce,\n proof as `0x${string}`[],\n tokensAndAmounts as readonly {\n token: `0x${string}`;\n amount: bigint;\n }[],\n from as Address,\n to as Address,\n isGuardedToken,\n toCounterfactual,\n ],\n account: walletClient.account!,\n });\n\n const estimatedCost: bigint = estimatedGas * gasPrice;\n\n if (ethPriceInUSD) {\n const estimatedCostInEth = formatEther(estimatedCost);\n const estimatedCostInUSD = (\n parseFloat(estimatedCostInEth) * ethPriceInUSD\n ).toFixed(2);\n return estimatedCostInUSD;\n } else {\n throw new Error(\n \"Could not fetch the ETH price to calculate cost in USD.\"\n );\n }\n } catch (error: any) {\n throw new Error(parseViemError(error));\n }\n }\n\n return {\n // Core contract functions\n claimPayout,\n\n // View functions\n getRewardMeta,\n getMaxReward,\n getAmountClaimed,\n isFinalized,\n isClaimed,\n getNextPostNonce,\n getFinality,\n getFoundationMultisig,\n getRejectionMultisig,\n getCFHFactory,\n\n // Gas estimation\n estimateGasForClaimPayout,\n\n // State\n get isProcessing() {\n return isProcessing;\n },\n addresses: ADDRESSES,\n\n // Wallet client availability\n isSignerAvailable: !!walletClient,\n };\n}\n","\"use strict\";\n\nimport type {\n GctlPrice,\n StakeRequest,\n RegionStake,\n WalletRegionStake,\n WalletRegionUnlocked,\n WalletRegionCommittedBalance,\n TransferDetails,\n GlwPrice,\n GlwRegionRewardsResponse,\n WalletNonce,\n GctlSupply,\n MintedEventsResponse,\n StakeEventsResponse,\n FailedOperationsResponse,\n PendingTransfersResponse,\n PendingTransferType,\n RestakeRequest,\n MigrationAmountResponse,\n HoldersCountResponse,\n RetryFailedOperationResponse,\n FarmRewardSplitsResponse,\n FarmRewardSplitsErrorResponse,\n FarmRewardSplit,\n} from \"../types\";\n\ninterface FetchGctlBalanceResponse {\n gctl_balance: string;\n}\n\ninterface FetchCommittedBalanceResponse {\n gctl_committed_balance: string;\n}\nimport {\n sentryAddBreadcrumb,\n sentryCaptureException,\n} from \"../../utils/sentry\";\n\nexport interface PayProtocolDepositUsingStakedControlRequest {\n wallet: string;\n regionId: number;\n applicationId: string;\n amount: string;\n signature: string;\n deadline: string;\n nonce: string;\n}\n\nexport interface PayProtocolDepositUsingStakedControlResponse {\n success: true;\n farmId: string;\n applicationId: string;\n}\n\nexport interface MigrateUserRequest {\n wallet: string;\n signature: string;\n deadline: string;\n nonce: string;\n}\n\nexport interface MigrateUserResponse {\n success: true;\n}\n\n// --------------------------------------------------------------------------\n\n/**\n * Extract a useful error message from an unknown error value.\n */\nfunction parseApiError(error: unknown): string {\n if (!error) return \"Unknown error\";\n if (error instanceof Error) return error.message;\n const possible: any = error;\n return possible?.error?.message ?? possible?.message ?? \"Unknown error\";\n}\n\n// --------------------------------------------------------------------------\n// Public Factory\n// --------------------------------------------------------------------------\n\nexport function ControlRouter(baseUrl: string) {\n if (!baseUrl) {\n throw new Error(\"CONTROL API base URL is not set\");\n }\n // ----------------------- Internal helpers --------------------------------\n const request = async <T>(path: string, init?: RequestInit): Promise<T> => {\n const res = await fetch(`${baseUrl}${path}`, init);\n if (!res.ok) {\n const errData = await res.json().catch(() => ({}));\n throw new Error(errData?.error || `Request to ${path} failed`);\n }\n return (await res.json()) as T;\n };\n\n // ----------------------- GETters -----------------------------------------\n const fetchGctlBalance = async (wallet: string): Promise<string> => {\n try {\n const data = await request<FetchGctlBalanceResponse>(\n `/balance/${wallet}`\n );\n return (data?.gctl_balance ?? \"0\").toString();\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchCommittedBalance = async (wallet: string): Promise<string> => {\n try {\n const data = await request<FetchCommittedBalanceResponse>(\n `/committed-balance/${wallet}`\n );\n return (data?.gctl_committed_balance ?? \"0\").toString();\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchGctlPrice = async (): Promise<string> => {\n try {\n const data = await request<GctlPrice>(`/price`);\n return data.currentPriceUsdc;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchGlwPrice = async (): Promise<string> => {\n try {\n const data = await request<GlwPrice>(`/price/glw`);\n return data.currentPriceUsdc;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchLastNonce = async (wallet: string): Promise<string> => {\n try {\n const data = await request<WalletNonce>(`/nonce/${wallet}`);\n return data.lastNonce;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchCirculatingSupply = async (): Promise<string> => {\n try {\n const data = await request<GctlSupply>(`/supply/circulating`);\n return data.circulatingSupply;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchHoldersCount = async (): Promise<number> => {\n try {\n const data = await request<HoldersCountResponse>(`/holders/count`);\n return data.holders;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n // Build pagination query helper\n const buildPaginationQuery = (page?: number, limit?: number) => {\n const p = page ?? 1;\n const l = limit ?? 50;\n return `?page=${p}&limit=${l}`;\n };\n\n const fetchMintedEvents = async (\n page?: number,\n limit?: number\n ): Promise<MintedEventsResponse> => {\n try {\n const data = await request<MintedEventsResponse>(\n `/events/minted${buildPaginationQuery(page, limit)}`\n );\n return data;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchStakeEvents = async (\n page?: number,\n limit?: number,\n regionId?: number\n ): Promise<StakeEventsResponse> => {\n try {\n const base = `/events/stake${buildPaginationQuery(page, limit)}`;\n const query =\n typeof regionId === \"number\" ? `${base}&regionId=${regionId}` : base;\n const data = await request<StakeEventsResponse>(query);\n return data;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchPendingTransfers = async (\n page?: number,\n limit?: number,\n type?: PendingTransferType\n ): Promise<PendingTransfersResponse> => {\n try {\n const base = `/transfers/pending${buildPaginationQuery(page, limit)}`;\n const query = type ? `${base}&type=${encodeURIComponent(type)}` : base;\n const data = await request<PendingTransfersResponse>(query);\n return data;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchTransferDetails = async (\n txId: string\n ): Promise<TransferDetails> => {\n try {\n return await request<TransferDetails>(`/transfer/${txId}`);\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchFailedOperations = async (\n page?: number,\n limit?: number\n ): Promise<FailedOperationsResponse> => {\n try {\n const data = await request<FailedOperationsResponse>(\n `/operations/failed${buildPaginationQuery(page, limit)}`\n );\n return data;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchGlwRegionRewards = async (): Promise<GlwRegionRewardsResponse> => {\n try {\n const data = await request<GlwRegionRewardsResponse>(\n `/rewards/glw/regions`\n );\n return data;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchFarmRewardSplits = async (\n farmId: string\n ): Promise<FarmRewardSplit[]> => {\n try {\n if (!farmId) throw new Error(\"Farm ID is required\");\n const data = await request<\n FarmRewardSplitsResponse | FarmRewardSplitsErrorResponse\n >(`/farms/${encodeURIComponent(farmId)}/reward-splits`);\n if (\"error\" in data) throw new Error(data.error);\n return data.rewardSplits ?? [];\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n // Exposed query with error parsing\n const getTransferDetails = async (txId: string): Promise<TransferDetails> => {\n try {\n return await fetchTransferDetails(txId);\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchRegionStake = async (regionId: number): Promise<RegionStake> => {\n try {\n return await request<RegionStake>(`/region/${regionId}/stake`);\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchWalletRegionStake = async (\n wallet: string,\n regionId: number\n ): Promise<WalletRegionStake> => {\n try {\n return await request<WalletRegionStake>(\n `/wallet/${wallet}/region/${regionId}/stake`\n );\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchWalletRegionUnlocked = async (\n wallet: string,\n regionId: number\n ): Promise<WalletRegionUnlocked> => {\n try {\n return await request<WalletRegionUnlocked>(\n `/wallet/${wallet}/region/${regionId}/unlocked`\n );\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchWalletRegionCommittedBalance = async (\n wallet: string,\n regionId: number\n ): Promise<WalletRegionCommittedBalance> => {\n try {\n return await request<WalletRegionCommittedBalance>(\n `/wallet/${wallet}/region/${regionId}/committed-balance`\n );\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n // ----------------------- Mutations ---------------------------------------\n let isStaking = false;\n let isUnstaking = false;\n let isRestaking = false;\n let isRetryingFailedOperation = false;\n let isPayingProtocolDepositUsingStakedControl = false;\n let isMigratingUser = false;\n\n const stakeGctl = async (stakeRequest: StakeRequest): Promise<boolean> => {\n isStaking = true;\n try {\n sentryAddBreadcrumb({\n category: \"control-api\",\n message: \"POST /stake\",\n level: \"info\",\n data: {\n baseUrl,\n wallet: stakeRequest.wallet,\n regionId: stakeRequest.regionId,\n },\n });\n await request(`/stake`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(stakeRequest),\n });\n return true;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"stakeGctl\",\n baseUrl,\n wallet: stakeRequest.wallet,\n regionId: stakeRequest.regionId,\n amount: stakeRequest.amount,\n deadline: stakeRequest.deadline,\n });\n throw new Error(parseApiError(error));\n } finally {\n isStaking = false;\n }\n };\n\n const unstakeGctl = async (\n unstakeRequest: StakeRequest\n ): Promise<boolean> => {\n isUnstaking = true;\n try {\n sentryAddBreadcrumb({\n category: \"control-api\",\n message: \"POST /unstake\",\n level: \"info\",\n data: {\n baseUrl,\n wallet: unstakeRequest.wallet,\n regionId: unstakeRequest.regionId,\n },\n });\n await request(`/unstake`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(unstakeRequest),\n });\n return true;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"unstakeGctl\",\n baseUrl,\n wallet: unstakeRequest.wallet,\n regionId: unstakeRequest.regionId,\n amount: unstakeRequest.amount,\n deadline: unstakeRequest.deadline,\n });\n throw new Error(parseApiError(error));\n } finally {\n isUnstaking = false;\n }\n };\n\n const restakeGctl = async (\n restakeRequest: RestakeRequest\n ): Promise<boolean> => {\n isRestaking = true;\n try {\n sentryAddBreadcrumb({\n category: \"control-api\",\n message: \"POST /restake\",\n level: \"info\",\n data: {\n baseUrl,\n wallet: restakeRequest.wallet,\n fromZoneId: restakeRequest.fromZoneId,\n toZoneId: restakeRequest.toZoneId,\n },\n });\n await request(`/restake`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(restakeRequest),\n });\n return true;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"restakeGctl\",\n baseUrl,\n wallet: restakeRequest.wallet,\n fromZoneId: restakeRequest.fromZoneId,\n toZoneId: restakeRequest.toZoneId,\n amount: restakeRequest.amount,\n deadline: restakeRequest.deadline,\n });\n throw new Error(parseApiError(error));\n } finally {\n isRestaking = false;\n }\n };\n\n const retryFailedOperation = async (\n operationId: string\n ): Promise<RetryFailedOperationResponse> => {\n isRetryingFailedOperation = true;\n try {\n sentryAddBreadcrumb({\n category: \"control-api\",\n message: \"POST /operations/failed/:id/retry\",\n level: \"info\",\n data: { baseUrl, operationId },\n });\n const response = await request<RetryFailedOperationResponse>(\n `/operations/failed/${operationId}/retry`,\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n }\n );\n return response;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"retryFailedOperation\",\n baseUrl,\n operationId,\n });\n throw new Error(parseApiError(error));\n } finally {\n isRetryingFailedOperation = false;\n }\n };\n\n const payProtocolDepositUsingStakedControl = async (\n paymentRequest: PayProtocolDepositUsingStakedControlRequest\n ): Promise<PayProtocolDepositUsingStakedControlResponse> => {\n isPayingProtocolDepositUsingStakedControl = true;\n try {\n sentryAddBreadcrumb({\n category: \"control-api\",\n message: \"POST /pay-protocol-deposit-staked\",\n level: \"info\",\n data: {\n baseUrl,\n wallet: paymentRequest.wallet,\n regionId: paymentRequest.regionId,\n applicationId: paymentRequest.applicationId,\n amount: paymentRequest.amount,\n },\n });\n const response =\n await request<PayProtocolDepositUsingStakedControlResponse>(\n `/pay-protocol-deposit-staked`,\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(paymentRequest),\n }\n );\n return response;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"payProtocolDepositUsingStakedControl\",\n baseUrl,\n wallet: paymentRequest.wallet,\n regionId: paymentRequest.regionId,\n applicationId: paymentRequest.applicationId,\n amount: paymentRequest.amount,\n });\n throw new Error(parseApiError(error));\n } finally {\n isPayingProtocolDepositUsingStakedControl = false;\n }\n };\n\n const migrateUser = async (\n migrateRequest: MigrateUserRequest\n ): Promise<MigrateUserResponse> => {\n isMigratingUser = true;\n try {\n sentryAddBreadcrumb({\n category: \"control-api\",\n message: \"POST /migrate-user\",\n level: \"info\",\n data: {\n baseUrl,\n wallet: migrateRequest.wallet,\n },\n });\n const response = await request<MigrateUserResponse>(`/migrate-user`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(migrateRequest),\n });\n return response;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"migrateUser\",\n baseUrl,\n wallet: migrateRequest.wallet,\n deadline: migrateRequest.deadline,\n });\n throw new Error(parseApiError(error));\n } finally {\n isMigratingUser = false;\n }\n };\n\n const fetchMigrationAmount = async (\n wallet: string\n ): Promise<MigrationAmountResponse> => {\n try {\n return await request<MigrationAmountResponse>(\n `/migration-amount/${encodeURIComponent(wallet)}`\n );\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n // --------------------------- Public API ----------------------------------\n return {\n // Queries\n fetchGctlBalance,\n fetchCommittedBalance,\n fetchGctlPrice,\n fetchGlwPrice,\n fetchCirculatingSupply,\n fetchHoldersCount,\n fetchLastNonce,\n fetchMintedEvents,\n fetchStakeEvents,\n fetchPendingTransfers,\n fetchFailedOperations,\n fetchRegionStake,\n fetchWalletRegionStake,\n fetchWalletRegionUnlocked,\n fetchWalletRegionCommittedBalance,\n fetchTransferDetails: getTransferDetails,\n fetchGlwRegionRewards,\n fetchFarmRewardSplits,\n fetchMigrationAmount,\n\n // Mutations\n stakeGctl,\n unstakeGctl,\n restakeGctl,\n retryFailedOperation,\n payProtocolDepositUsingStakedControl,\n migrateUser,\n\n // Processing flags\n get isStaking() {\n return isStaking;\n },\n get isUnstaking() {\n return isUnstaking;\n },\n get isRestaking() {\n return isRestaking;\n },\n get isRetryingFailedOperation() {\n return isRetryingFailedOperation;\n },\n get isPayingProtocolDepositUsingStakedControl() {\n return isPayingProtocolDepositUsingStakedControl;\n },\n get isMigratingUser() {\n return isMigratingUser;\n },\n } as const;\n}\n","export function generateSlug(title: string): string {\n const ascii = title.normalize(\"NFKD\").replace(/[\\u0300-\\u036f]/g, \"\");\n\n const slug = ascii\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n\n // Guard against extremely long titles\n return slug.slice(0, 120);\n}\n","import type { RegionMetadata } from \"./types\";\n// Region metadata for kickstarter campaigns\n\nexport const regionMetadata: Record<string, RegionMetadata> = {\n // US States\n \"US-AL\": {\n code: \"US-AL\",\n name: \"Alabama\",\n description: \"The Heart of Dixie is ready for solar transformation\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-AK\": {\n code: \"US-AK\",\n name: \"Alaska\",\n description: \"The Last Frontier embracing renewable energy\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-AZ\": {\n code: \"US-AZ\",\n name: \"Arizona\",\n description: \"The Grand Canyon State with abundant sunshine\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-AR\": {\n code: \"US-AR\",\n name: \"Arkansas\",\n description: \"The Natural State going solar\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-CA\": {\n code: \"US-CA\",\n name: \"California\",\n description: \"The Golden State leading solar innovation\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-CO\": {\n code: \"US-CO\",\n name: \"Colorado\",\n description: \"The Centennial State with high-altitude solar potential\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-CT\": {\n code: \"US-CT\",\n name: \"Connecticut\",\n description: \"The Constitution State embracing clean energy\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-DE\": {\n code: \"US-DE\",\n name: \"Delaware\",\n description: \"The First State to go solar\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-FL\": {\n code: \"US-FL\",\n name: \"Florida\",\n description: \"The Sunshine State living up to its name\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-GA\": {\n code: \"US-GA\",\n name: \"Georgia\",\n description: \"The Peach State harvesting solar energy\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-HI\": {\n code: \"US-HI\",\n name: \"Hawaii\",\n description: \"The Aloha State with year-round solar potential\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-ID\": {\n code: \"US-ID\",\n name: \"Idaho\",\n description: \"The Gem State shining with solar power\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-IL\": {\n code: \"US-IL\",\n name: \"Illinois\",\n description: \"The Prairie State powering up with solar\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-IN\": {\n code: \"US-IN\",\n name: \"Indiana\",\n description: \"The Hoosier State joining the solar revolution\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-IA\": {\n code: \"US-IA\",\n name: \"Iowa\",\n description: \"The Hawkeye State expanding beyond wind to solar\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-KS\": {\n code: \"US-KS\",\n name: \"Kansas\",\n description: \"The Sunflower State growing solar energy\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-KY\": {\n code: \"US-KY\",\n name: \"Kentucky\",\n description: \"The Bluegrass State transitioning to clean energy\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-LA\": {\n code: \"US-LA\",\n name: \"Louisiana\",\n description: \"The Pelican State soaring with solar\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-ME\": {\n code: \"US-ME\",\n name: \"Maine\",\n description: \"The Pine Tree State branching into solar\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-MD\": {\n code: \"US-MD\",\n name: \"Maryland\",\n description: \"The Old Line State drawing new energy lines\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-MA\": {\n code: \"US-MA\",\n name: \"Massachusetts\",\n description: \"The Bay State leading in solar innovation\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-MI\": {\n code: \"US-MI\",\n name: \"Michigan\",\n description: \"The Great Lakes State harnessing solar power\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-MN\": {\n code: \"US-MN\",\n name: \"Minnesota\",\n description: \"The North Star State guiding solar adoption\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-MS\": {\n code: \"US-MS\",\n name: \"Mississippi\",\n description: \"The Magnolia State blooming with solar energy\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-MO\": {\n code: \"US-MO\",\n name: \"Missouri\",\n description: \"The Show-Me State showing solar leadership\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-MT\": {\n code: \"US-MT\",\n name: \"Montana\",\n description: \"Big Sky Country with big solar potential\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-NE\": {\n code: \"US-NE\",\n name: \"Nebraska\",\n description: \"The Cornhusker State cultivating solar power\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-NV\": {\n code: \"US-NV\",\n name: \"Nevada\",\n description: \"The Silver State striking solar gold\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-NH\": {\n code: \"US-NH\",\n name: \"New Hampshire\",\n description: \"The Granite State building solid solar foundation\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-NJ\": {\n code: \"US-NJ\",\n name: \"New Jersey\",\n description: \"The Garden State growing solar gardens\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-NM\": {\n code: \"US-NM\",\n name: \"New Mexico\",\n description: \"The Land of Enchantment enchanted by solar\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-NY\": {\n code: \"US-NY\",\n name: \"New York\",\n description: \"The Empire State building a solar empire\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-NC\": {\n code: \"US-NC\",\n name: \"North Carolina\",\n description: \"The Tar Heel State stepping into solar\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-ND\": {\n code: \"US-ND\",\n name: \"North Dakota\",\n description: \"The Peace Garden State cultivating solar peace\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-OH\": {\n code: \"US-OH\",\n name: \"Ohio\",\n description: \"The Buckeye State branching into solar\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-OK\": {\n code: \"US-OK\",\n name: \"Oklahoma\",\n description: \"The Sooner State adopting solar sooner\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-OR\": {\n code: \"US-OR\",\n name: \"Oregon\",\n description: \"The Beaver State building solar dams\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-PA\": {\n code: \"US-PA\",\n name: \"Pennsylvania\",\n description: \"The Keystone State unlocking solar potential\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-RI\": {\n code: \"US-RI\",\n name: \"Rhode Island\",\n description: \"The Ocean State riding the solar wave\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-SC\": {\n code: \"US-SC\",\n name: \"South Carolina\",\n description: \"The Palmetto State basking in solar\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-SD\": {\n code: \"US-SD\",\n name: \"South Dakota\",\n description: \"Mount Rushmore State carving out solar future\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-TN\": {\n code: \"US-TN\",\n name: \"Tennessee\",\n description: \"The Volunteer State volunteering for solar\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-TX\": {\n code: \"US-TX\",\n name: \"Texas\",\n description: \"The Lone Star State shining with solar power\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-UT\": {\n code: \"US-UT\",\n name: \"Utah\",\n description: \"The Beehive State buzzing with solar activity\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-VT\": {\n code: \"US-VT\",\n name: \"Vermont\",\n description: \"The Green Mountain State going greener\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-VA\": {\n code: \"US-VA\",\n name: \"Virginia\",\n description: \"The Old Dominion embracing new energy\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-WA\": {\n code: \"US-WA\",\n name: \"Washington\",\n description: \"The Evergreen State staying green with solar\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-WV\": {\n code: \"US-WV\",\n name: \"West Virginia\",\n description: \"The Mountain State reaching new heights\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-WI\": {\n code: \"US-WI\",\n name: \"Wisconsin\",\n description: \"The Badger State digging into solar\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n \"US-WY\": {\n code: \"US-WY\",\n name: \"Wyoming\",\n description: \"The Equality State equalizing energy access\",\n isUs: true,\n flag: \"🇺🇸\",\n },\n\n // Countries\n CA: {\n code: \"CA\",\n name: \"Canada\",\n description: \"The Great White North embracing solar energy\",\n isUs: false,\n flag: \"🇨🇦\",\n },\n MX: {\n code: \"MX\",\n name: \"Mexico\",\n description: \"Abundant sunshine powering the future\",\n isUs: false,\n flag: \"🇲🇽\",\n },\n BR: {\n code: \"BR\",\n name: \"Brazil\",\n description: \"The largest South American market for solar\",\n isUs: false,\n flag: \"🇧🇷\",\n },\n AR: {\n code: \"AR\",\n name: \"Argentina\",\n description: \"Pampas and sunshine creating energy independence\",\n isUs: false,\n flag: \"🇦🇷\",\n },\n CL: {\n code: \"CL\",\n name: \"Chile\",\n description: \"The Atacama Desert's solar potential unleashed\",\n isUs: false,\n flag: \"🇨🇱\",\n },\n CO: {\n code: \"CO\",\n name: \"Colombia\",\n description: \"Equatorial sunshine year-round\",\n isUs: false,\n flag: \"🇨🇴\",\n },\n PE: {\n code: \"PE\",\n name: \"Peru\",\n description: \"From the Andes to the Amazon with solar\",\n isUs: false,\n flag: \"🇵🇪\",\n },\n GB: {\n code: \"GB\",\n name: \"United Kingdom\",\n description: \"Leading Europe's renewable transition\",\n isUs: false,\n flag: \"🇬🇧\",\n },\n FR: {\n code: \"FR\",\n name: \"France\",\n description: \"La République embracing solar liberté\",\n isUs: false,\n flag: \"🇫🇷\",\n },\n DE: {\n code: \"DE\",\n name: \"Germany\",\n description: \"Engineering excellence in solar deployment\",\n isUs: false,\n flag: \"🇩🇪\",\n },\n IT: {\n code: \"IT\",\n name: \"Italy\",\n description: \"Mediterranean sunshine powering the boot\",\n isUs: false,\n flag: \"🇮🇹\",\n },\n ES: {\n code: \"ES\",\n name: \"Spain\",\n description: \"Iberian peninsula's solar powerhouse\",\n isUs: false,\n flag: \"🇪🇸\",\n },\n PT: {\n code: \"PT\",\n name: \"Portugal\",\n description: \"Atlantic coast harnessing solar waves\",\n isUs: false,\n flag: \"🇵🇹\",\n },\n NL: {\n code: \"NL\",\n name: \"Netherlands\",\n description: \"Low lands, high solar ambitions\",\n isUs: false,\n flag: \"🇳🇱\",\n },\n BE: {\n code: \"BE\",\n name: \"Belgium\",\n description: \"The heart of Europe goes solar\",\n isUs: false,\n flag: \"🇧🇪\",\n },\n CH: {\n code: \"CH\",\n name: \"Switzerland\",\n description: \"Alpine heights capturing pure sunlight\",\n isUs: false,\n flag: \"🇨🇭\",\n },\n AT: {\n code: \"AT\",\n name: \"Austria\",\n description: \"Mountain valleys filled with solar panels\",\n isUs: false,\n flag: \"🇦🇹\",\n },\n SE: {\n code: \"SE\",\n name: \"Sweden\",\n description: \"Nordic innovation in solar technology\",\n isUs: false,\n flag: \"🇸🇪\",\n },\n NO: {\n code: \"NO\",\n name: \"Norway\",\n description: \"Fjords reflecting solar possibilities\",\n isUs: false,\n flag: \"🇳🇴\",\n },\n DK: {\n code: \"DK\",\n name: \"Denmark\",\n description: \"Viking spirit conquering solar frontiers\",\n isUs: false,\n flag: \"🇩🇰\",\n },\n FI: {\n code: \"FI\",\n name: \"Finland\",\n description: \"Land of midnight sun going solar\",\n isUs: false,\n flag: \"🇫🇮\",\n },\n PL: {\n code: \"PL\",\n name: \"Poland\",\n description: \"Central Europe's emerging solar market\",\n isUs: false,\n flag: \"🇵🇱\",\n },\n CZ: {\n code: \"CZ\",\n name: \"Czech Republic\",\n description: \"Bohemian innovation in renewable energy\",\n isUs: false,\n flag: \"🇨🇿\",\n },\n GR: {\n code: \"GR\",\n name: \"Greece\",\n description: \"Aegean sunshine powering ancient lands\",\n isUs: false,\n flag: \"🇬🇷\",\n },\n TR: {\n code: \"TR\",\n name: \"Turkey\",\n description: \"Bridge between continents powered by sun\",\n isUs: false,\n flag: \"🇹🇷\",\n },\n IN: {\n code: \"IN\",\n name: \"India\",\n description: \"World's fastest growing solar market\",\n isUs: false,\n flag: \"🇮🇳\",\n },\n CN: {\n code: \"CN\",\n name: \"China\",\n description: \"Global solar manufacturing leader\",\n isUs: false,\n flag: \"🇨🇳\",\n },\n JP: {\n code: \"JP\",\n name: \"Japan\",\n description: \"Rising sun powering technological innovation\",\n isUs: false,\n flag: \"🇯🇵\",\n },\n KR: {\n code: \"KR\",\n name: \"South Korea\",\n description: \"High-tech nation embracing green energy\",\n isUs: false,\n flag: \"🇰🇷\",\n },\n AU: {\n code: \"AU\",\n name: \"Australia\",\n description: \"Outback sunshine creating energy abundance\",\n isUs: false,\n flag: \"🇦🇺\",\n },\n NZ: {\n code: \"NZ\",\n name: \"New Zealand\",\n description: \"Clean, green Aotearoa\",\n isUs: false,\n flag: \"🇳🇿\",\n },\n ZA: {\n code: \"ZA\",\n name: \"South Africa\",\n description: \"African sunshine lighting the continent\",\n isUs: false,\n flag: \"🇿🇦\",\n },\n EG: {\n code: \"EG\",\n name: \"Egypt\",\n description: \"Desert sun powering ancient civilizations\",\n isUs: false,\n flag: \"🇪🇬\",\n },\n NG: {\n code: \"NG\",\n name: \"Nigeria\",\n description: \"West Africa's solar giant awakening\",\n isUs: false,\n flag: \"🇳🇬\",\n },\n KE: {\n code: \"KE\",\n name: \"Kenya\",\n description: \"East African solar innovation hub\",\n isUs: false,\n flag: \"🇰🇪\",\n },\n MA: {\n code: \"MA\",\n name: \"Morocco\",\n description: \"Saharan edge harnessing desert power\",\n isUs: false,\n flag: \"🇲🇦\",\n },\n SA: {\n code: \"SA\",\n name: \"Saudi Arabia\",\n description: \"Oil kingdom transitioning to solar\",\n isUs: false,\n flag: \"🇸🇦\",\n },\n AE: {\n code: \"AE\",\n name: \"United Arab Emirates\",\n description: \"Desert emirates building solar oases\",\n isUs: false,\n flag: \"🇦🇪\",\n },\n IL: {\n code: \"IL\",\n name: \"Israel\",\n description: \"Innovation nation powered by sunshine\",\n isUs: false,\n flag: \"🇮🇱\",\n },\n SG: {\n code: \"SG\",\n name: \"Singapore\",\n description: \"City-state maximizing rooftop solar\",\n isUs: false,\n flag: \"🇸🇬\",\n },\n ID: {\n code: \"ID\",\n name: \"Indonesia\",\n description: \"Archipelago nation harnessing tropical sun\",\n isUs: false,\n flag: \"🇮🇩\",\n },\n TH: {\n code: \"TH\",\n name: \"Thailand\",\n description: \"Land of smiles powered by solar\",\n isUs: false,\n flag: \"🇹🇭\",\n },\n VN: {\n code: \"VN\",\n name: \"Vietnam\",\n description: \"Southeast Asian solar manufacturing hub\",\n isUs: false,\n flag: \"🇻🇳\",\n },\n PH: {\n code: \"PH\",\n name: \"Philippines\",\n description: \"7,000 islands unified by solar power\",\n isUs: false,\n flag: \"🇵🇭\",\n },\n};\n\n// Helper to get all regions as array\nexport const allRegions = Object.values(regionMetadata);\n\n// Helper to get US states\nexport const usStates = allRegions.filter((r) => r.isUs);\n\n// Helper to get countries\nexport const countries = allRegions.filter((r) => !r.isUs);\n","\"use strict\";\n\nimport { generateSlug } from \"src/utils/generate-slug\";\nimport { regionMetadata } from \"../region-metadata\";\nimport type {\n RegionWithMetadata,\n ActivationConfig,\n ActivationEvent,\n RegionDetails,\n SponsoredFarm,\n ActiveRegionsSummaryResponse,\n RecentRegionActivityResponse,\n InstallerApplicationPayload,\n InstallerApplicationResponse,\n RegionWeeklyRewardsResponse,\n RegionWeeklyRewardsQuery,\n} from \"../types\";\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nfunction parseApiError(error: unknown): string {\n if (!error) return \"Unknown error\";\n if (error instanceof Error) return error.message;\n const possible: any = error;\n return possible?.error?.message ?? possible?.message ?? \"Unknown error\";\n}\n\n// ---------------------------------------------------------------------------\n// Factory\n// ---------------------------------------------------------------------------\n\nexport function RegionRouter(baseUrl: string) {\n if (!baseUrl) throw new Error(\"CONTROL API base URL is not set\");\n\n const request = async <T>(path: string, init?: RequestInit): Promise<T> => {\n const res = await fetch(`${baseUrl}${path}`, init);\n if (!res.ok) {\n const errData = await res.json().catch(() => ({}));\n throw new Error(errData?.error || `Request to ${path} failed`);\n }\n return (await res.json()) as T;\n };\n\n // -------------------------------------------------------------------------\n // Local cache / state flags\n // -------------------------------------------------------------------------\n let cachedRegions: RegionWithMetadata[] = [];\n let isLoading = false;\n\n // -------------------------------------------------------------------------\n // Queries\n // -------------------------------------------------------------------------\n const fetchRegions = async (params?: {\n isActive?: boolean;\n }): Promise<RegionWithMetadata[]> => {\n isLoading = true;\n try {\n const query =\n params && typeof params.isActive === \"boolean\"\n ? `?isActive=${params.isActive ? \"true\" : \"false\"}`\n : \"\";\n const data = await request<{ regions: RegionWithMetadata[] }>(\n `/regions/all${query}`\n );\n cachedRegions = data.regions ?? [];\n return cachedRegions;\n } catch (error) {\n throw new Error(parseApiError(error));\n } finally {\n isLoading = false;\n }\n };\n\n const fetchActivationConfig = async (\n regionCode: string\n ): Promise<ActivationConfig> => {\n try {\n return await request<ActivationConfig>(\n `/regions/activation-config?code=${regionCode}`\n );\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchActivationEvents = async (\n regionId?: number\n ): Promise<ActivationEvent[]> => {\n try {\n const query = typeof regionId === \"number\" ? `?regionId=${regionId}` : \"\";\n const data = await request<{ events: ActivationEvent[] }>(\n `/regions/activation-events${query}`\n );\n return data.events ?? [];\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchRegionByIdOrSlug = async (\n idOrSlug: string\n ): Promise<RegionDetails> => {\n try {\n const data = await request<{ region: RegionDetails }>(\n `/regions/${encodeURIComponent(idOrSlug)}`\n );\n return data.region;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchRegionSolarFarms = async (\n regionId: number\n ): Promise<SponsoredFarm[]> => {\n try {\n const data = await request<{ sponsoredFarms: SponsoredFarm[] }>(\n `/regions/solar-farms/${regionId}`\n );\n return data.sponsoredFarms ?? [];\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchActiveSummary =\n async (): Promise<ActiveRegionsSummaryResponse> => {\n try {\n return await request<ActiveRegionsSummaryResponse>(\n `/regions/active/summary`\n );\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchRecentActivity =\n async (): Promise<RecentRegionActivityResponse> => {\n try {\n return await request<RecentRegionActivityResponse>(\n `/regions/active/recent-activity`\n );\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchRegionWeeklyRewards = async (\n regionId: number,\n query?: RegionWeeklyRewardsQuery\n ): Promise<RegionWeeklyRewardsResponse> => {\n try {\n const params = new URLSearchParams();\n if (query?.startWeek !== undefined)\n params.set(\"startWeek\", query.startWeek.toString());\n if (query?.endWeek !== undefined)\n params.set(\"endWeek\", query.endWeek.toString());\n if (query?.paymentCurrency)\n params.set(\"paymentCurrency\", query.paymentCurrency);\n if (query?.limit !== undefined)\n params.set(\"limit\", query.limit.toString());\n\n const queryString = params.toString();\n const path = `/regions/weekly-rewards/${regionId}${\n queryString ? `?${queryString}` : \"\"\n }`;\n\n return await request<RegionWeeklyRewardsResponse>(path);\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const applyInstallerCertification = async (\n payload: InstallerApplicationPayload\n ): Promise<InstallerApplicationResponse> => {\n try {\n return await request<InstallerApplicationResponse>(\n `/regions/installers/apply`,\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(payload),\n }\n );\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n // Kickstarter-related logic moved to kickstarter-router.ts\n\n // -------------------------------------------------------------------------\n // Helpers (derived)\n // -------------------------------------------------------------------------\n\n const getRegionByCode = (code: string): RegionWithMetadata | null => {\n const metadata = regionMetadata[code];\n if (!metadata) return null;\n\n const existingRegion = cachedRegions.find(\n (r) => r.name.toLowerCase() === metadata.name.toLowerCase()\n );\n\n if (existingRegion) {\n return {\n ...existingRegion,\n code: metadata.code,\n description: metadata.description,\n isUs: metadata.isUs,\n };\n }\n\n // Placeholder if region does not yet exist in DB\n return {\n id: -1,\n name: metadata.name,\n code: metadata.code,\n description: metadata.description,\n bannerUrl: \"\",\n slug: generateSlug(metadata.name),\n isUs: metadata.isUs,\n isActive: false,\n staked: \"0\",\n activationStakeThreshold: metadata.isUs ? \"20000000000\" : \"200000000000\",\n solarFarmCount: 0,\n solarPanelsQuantity: 0,\n activationSolarFarmThreshold: 10,\n installerCount: 1,\n createdAt: new Date(),\n activationInstallerThreshold: 1,\n efficiencyScore: 0,\n };\n };\n\n // -------------------------------------------------------------------------\n // Public API\n // -------------------------------------------------------------------------\n return {\n // Data access\n fetchRegions,\n fetchActivationConfig,\n fetchActivationEvents,\n fetchRegionByIdOrSlug,\n fetchRegionSolarFarms,\n fetchActiveSummary,\n fetchRecentActivity,\n fetchRegionWeeklyRewards,\n getRegionByCode,\n applyInstallerCertification,\n\n // Cached data & flags\n get regions() {\n return cachedRegions;\n },\n get isLoading() {\n return isLoading;\n },\n } as const;\n}\n","\"use strict\";\n\nimport { regionMetadata } from \"../region-metadata\";\nimport type {\n Kickstarter,\n CreateKickstarterPayload,\n KickstarterCreateResponse,\n CommitKickstarterPayload,\n CommitKickstarterResponse,\n KickstarterDetails,\n KickstarterCommitmentsQuery,\n KickstarterCommitmentsResponse,\n} from \"../types\";\nimport {\n sentryAddBreadcrumb,\n sentryCaptureException,\n} from \"../../utils/sentry\";\n\nfunction parseApiError(error: unknown): string {\n if (!error) return \"Unknown error\";\n if (error instanceof Error) return error.message;\n const possible: any = error;\n return possible?.error?.message ?? possible?.message ?? \"Unknown error\";\n}\n\nexport function KickstarterRouter(baseUrl: string) {\n if (!baseUrl) throw new Error(\"CONTROL API base URL is not set\");\n\n const request = async <T>(path: string, init?: RequestInit): Promise<T> => {\n const res = await fetch(`${baseUrl}${path}`, init);\n if (!res.ok) {\n const errData = await res.json().catch(() => ({}));\n throw new Error(errData?.error || `Request to ${path} failed`);\n }\n return (await res.json()) as T;\n };\n\n let isCreatingKickstarter = false;\n\n const fetchKickstarters = async (): Promise<Kickstarter[]> => {\n try {\n const data = await request<{ kickstarters: Kickstarter[] }>(\n `/kickstarters`\n );\n return data.kickstarters ?? [];\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const createKickstarter = async (\n payload: CreateKickstarterPayload\n ): Promise<KickstarterCreateResponse> => {\n isCreatingKickstarter = true;\n try {\n sentryAddBreadcrumb({\n category: \"control-api\",\n message: \"POST /kickstarters\",\n level: \"info\",\n data: {\n baseUrl,\n code: payload.code,\n creatorWallet: payload.creatorWallet,\n },\n });\n const exists = Boolean(regionMetadata[payload.code]);\n if (!exists) {\n throw new Error(`Unknown region code: ${payload.code}`);\n }\n const data = await request<KickstarterCreateResponse>(`/kickstarters`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(payload),\n });\n return data;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"createKickstarter\",\n baseUrl,\n code: payload.code,\n creatorWallet: payload.creatorWallet,\n title: payload.title,\n regionName: payload.regionName,\n });\n throw new Error(parseApiError(error));\n } finally {\n isCreatingKickstarter = false;\n }\n };\n\n const fetchKickstarter = async (\n idOrSlug: string\n ): Promise<KickstarterDetails> => {\n try {\n const data = await request<{\n kickstarter: KickstarterDetails;\n }>(`/kickstarters/${encodeURIComponent(idOrSlug)}`);\n return data.kickstarter;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchKickstartersByWallet = async (\n wallet: string\n ): Promise<Kickstarter[]> => {\n try {\n const data = await request<{ kickstarters: Kickstarter[] }>(\n `/kickstarters/by-wallet/${encodeURIComponent(wallet)}`\n );\n return data.kickstarters ?? [];\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const commitKickstarter = async (\n kickstarterId: string,\n payload: CommitKickstarterPayload\n ): Promise<CommitKickstarterResponse> => {\n try {\n sentryAddBreadcrumb({\n category: \"control-api\",\n message: \"POST /kickstarters/commit/:id\",\n level: \"info\",\n data: { baseUrl, kickstarterId },\n });\n const data = await request<CommitKickstarterResponse>(\n `/kickstarters/commit/${encodeURIComponent(kickstarterId)}`,\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(payload),\n }\n );\n return data;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"commitKickstarter\",\n baseUrl,\n kickstarterId,\n wallet: payload.wallet,\n amount: payload.amount,\n });\n throw new Error(parseApiError(error));\n }\n };\n\n // Build pagination query helper\n const buildPaginationQuery = (page?: number, limit?: number) => {\n const p = page ?? 1;\n const l = limit ?? 50;\n return `?page=${p}&limit=${l}`;\n };\n\n const fetchRegionCommitments = async (\n regionId: number,\n query?: KickstarterCommitmentsQuery\n ): Promise<KickstarterCommitmentsResponse> => {\n try {\n const base = `/kickstarters/region/${regionId}/commitments${buildPaginationQuery(\n query?.page,\n query?.limit\n )}`;\n const finalQuery =\n query?.finalized !== undefined\n ? `${base}&finalized=${query.finalized}`\n : base;\n const data = await request<KickstarterCommitmentsResponse>(finalQuery);\n return data;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n return {\n fetchKickstarters,\n fetchKickstarter,\n fetchKickstartersByWallet,\n commitKickstarter,\n createKickstarter,\n fetchRegionCommitments,\n get isCreatingKickstarter() {\n return isCreatingKickstarter;\n },\n } as const;\n}\n","\"use strict\";\n\nimport type {\n ControlWallet,\n WalletsResponse,\n WalletDetails,\n MintedEvent,\n StakedEvent,\n WalletWeeklyRewardsResponse,\n WeeklyRewardsQuery,\n TosAcceptRequest,\n TosAcceptResponse,\n TosStatusResponse,\n} from \"../types\";\n\nfunction parseApiError(error: unknown): string {\n if (!error) return \"Unknown error\";\n if (error instanceof Error) return error.message;\n const possible: any = error;\n return possible?.error?.message ?? possible?.message ?? \"Unknown error\";\n}\n\nexport function WalletsRouter(baseUrl: string) {\n if (!baseUrl) throw new Error(\"CONTROL API base URL is not set\");\n\n const request = async <T>(path: string, init?: RequestInit): Promise<T> => {\n const res = await fetch(`${baseUrl}${path}`, init);\n if (!res.ok) {\n const errData = await res.json().catch(() => ({}));\n throw new Error(errData?.error || `Request to ${path} failed`);\n }\n return (await res.json()) as T;\n };\n\n const buildPaginationQuery = (page?: number, limit?: number) => {\n const p = page ?? 1;\n const l = limit ?? 50;\n return `?page=${p}&limit=${l}`;\n };\n\n const fetchAllWallets = async (): Promise<ControlWallet[]> => {\n try {\n const data = await request<WalletsResponse>(`/wallets/all`);\n return data.wallets ?? [];\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchWalletByAddress = async (\n wallet: string\n ): Promise<WalletDetails> => {\n try {\n return await request<WalletDetails>(\n `/wallets/address/${encodeURIComponent(wallet)}`\n );\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchWalletMintedEvents = async (\n wallet: string,\n page?: number,\n limit?: number\n ): Promise<MintedEvent[]> => {\n try {\n const data = await request<{ events: MintedEvent[] }>(\n `/wallets/address/${encodeURIComponent(\n wallet\n )}/events/minted${buildPaginationQuery(page, limit)}`\n );\n return data.events ?? [];\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchWalletStakeEvents = async (\n wallet: string,\n page?: number,\n limit?: number,\n regionId?: number\n ): Promise<StakedEvent[]> => {\n try {\n const base = `/wallets/address/${encodeURIComponent(\n wallet\n )}/events/stake${buildPaginationQuery(page, limit)}`;\n const query =\n typeof regionId === \"number\" ? `${base}&regionId=${regionId}` : base;\n const data = await request<{ events: StakedEvent[] }>(query);\n return data.events ?? [];\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchWalletWeeklyRewards = async (\n wallet: string,\n query?: WeeklyRewardsQuery\n ): Promise<WalletWeeklyRewardsResponse> => {\n try {\n const params = new URLSearchParams();\n if (query?.startWeek !== undefined)\n params.set(\"startWeek\", query.startWeek.toString());\n if (query?.endWeek !== undefined)\n params.set(\"endWeek\", query.endWeek.toString());\n if (query?.paymentCurrency)\n params.set(\"paymentCurrency\", query.paymentCurrency);\n if (query?.limit !== undefined)\n params.set(\"limit\", query.limit.toString());\n\n const queryString = params.toString();\n const path = `/wallets/address/${encodeURIComponent(\n wallet\n )}/weekly-rewards${queryString ? `?${queryString}` : \"\"}`;\n\n return await request<WalletWeeklyRewardsResponse>(path);\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const acceptToS = async (\n wallet: string,\n tosRequest: TosAcceptRequest\n ): Promise<TosAcceptResponse> => {\n try {\n return await request<TosAcceptResponse>(\n `/wallets/address/${encodeURIComponent(wallet)}/tos/accept`,\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(tosRequest),\n }\n );\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchTosStatus = async (wallet: string): Promise<TosStatusResponse> => {\n try {\n return await request<TosStatusResponse>(\n `/wallets/address/${encodeURIComponent(wallet)}/tos/status`\n );\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n return {\n fetchAllWallets,\n fetchWalletByAddress,\n fetchWalletMintedEvents,\n fetchWalletStakeEvents,\n fetchWalletWeeklyRewards,\n acceptToS,\n fetchTosStatus,\n } as const;\n}\n","\"use strict\";\n\nimport type {\n SponsoredFarm,\n SponsoredFarmsResponse,\n EstimateRewardScoreParams,\n RewardScoreResponse,\n EstimateRewardScoreErrorResponse,\n EstimateRewardScoresBatchParams,\n EstimateRewardScoresBatchResponse,\n WalletFarmsWithRewardsResponse,\n FarmWithRewards,\n FarmRewardSplitsResponse,\n FarmRewardSplitsErrorResponse,\n FarmRewardSplit,\n MiningScoresBatchParams,\n MiningScoresBatchResponse,\n FarmWeeklyRewardsResponse,\n FarmWeeklyRewardsQuery,\n FarmEfficiencyScore,\n SingleEfficiencyScoreResponse,\n EfficiencyScoresErrorResponse,\n FarmWeeklyRewardsBatchQuery,\n FarmWeeklyRewardsBatchResponse,\n WalletFarmRewardsHistoryQuery,\n WalletFarmRewardsHistoryResponse,\n WalletFarmRewardsHistoryBatchQuery,\n WalletFarmRewardsHistoryBatchResponse,\n} from \"../types\";\nimport {\n sentryAddBreadcrumb,\n sentryCaptureException,\n} from \"../../utils/sentry\";\n\nfunction parseApiError(error: unknown): string {\n if (!error) return \"Unknown error\";\n if (error instanceof Error) return error.message;\n const possible: any = error;\n return possible?.error?.message ?? possible?.message ?? \"Unknown error\";\n}\n\nexport function FarmsRouter(baseUrl: string) {\n if (!baseUrl) throw new Error(\"CONTROL API base URL is not set\");\n\n const request = async <T>(path: string, init?: RequestInit): Promise<T> => {\n const res = await fetch(`${baseUrl}${path}`, init);\n if (!res.ok) {\n const errData = await res.json().catch(() => ({}));\n throw new Error(errData?.error || `Request to ${path} failed`);\n }\n return (await res.json()) as T;\n };\n\n const fetchFarmRewardSplits = async (\n farmId: string\n ): Promise<FarmRewardSplit[]> => {\n try {\n if (!farmId) {\n throw new Error(\"Farm ID is required\");\n }\n\n const data = await request<\n FarmRewardSplitsResponse | FarmRewardSplitsErrorResponse\n >(`/farms/${encodeURIComponent(farmId)}/reward-splits`);\n\n // Check if it's an error response\n if (\"error\" in data) {\n throw new Error(data.error);\n }\n\n // At this point, TypeScript knows it's FarmRewardSplitsResponse\n return data.rewardSplits ?? [];\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchSponsoredFarms = async (\n sponsorWallet?: string\n ): Promise<SponsoredFarm[]> => {\n try {\n const query = sponsorWallet\n ? `?sponsorWallet=${encodeURIComponent(sponsorWallet)}`\n : \"\";\n const data = await request<SponsoredFarmsResponse>(\n `/farms/sponsored${query}`\n );\n return data.farms ?? [];\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchWalletFarmsWithRewards = async (\n walletAddress: string\n ): Promise<FarmWithRewards[]> => {\n try {\n if (!walletAddress) {\n throw new Error(\"Wallet address is required\");\n }\n\n const data = await request<WalletFarmsWithRewardsResponse>(\n `/farms/wallet/${encodeURIComponent(walletAddress)}/farms-with-rewards`\n );\n return data.farms ?? [];\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchFarmWeeklyRewards = async (\n farmId: string,\n query?: FarmWeeklyRewardsQuery\n ): Promise<FarmWeeklyRewardsResponse> => {\n try {\n if (!farmId) {\n throw new Error(\"Farm ID is required\");\n }\n\n const params = new URLSearchParams();\n if (query?.startWeek !== undefined)\n params.set(\"startWeek\", query.startWeek.toString());\n if (query?.endWeek !== undefined)\n params.set(\"endWeek\", query.endWeek.toString());\n if (query?.paymentCurrency)\n params.set(\"paymentCurrency\", query.paymentCurrency);\n if (query?.limit !== undefined)\n params.set(\"limit\", query.limit.toString());\n\n const queryString = params.toString();\n const path = `/farms/${encodeURIComponent(farmId)}/weekly-rewards${\n queryString ? `?${queryString}` : \"\"\n }`;\n\n return await request<FarmWeeklyRewardsResponse>(path);\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const estimateRewardScore = async (\n params: EstimateRewardScoreParams\n ): Promise<RewardScoreResponse> => {\n try {\n sentryAddBreadcrumb({\n category: \"control-api\",\n message: \"POST /farms/estimate-reward-score\",\n level: \"info\",\n data: { baseUrl, regionId: params.regionId, userId: params.userId },\n });\n const data = await request<\n RewardScoreResponse | EstimateRewardScoreErrorResponse\n >(\"/farms/estimate-reward-score\", {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(params),\n });\n\n // Check if it's an error response\n if (\"error\" in data) {\n throw new Error(data.error);\n }\n\n // At this point, TypeScript knows it's RewardScoreResponse\n // All fields are required in the success response based on the API spec\n return data as RewardScoreResponse;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"estimateRewardScore\",\n baseUrl,\n userId: params.userId,\n regionId: params.regionId,\n paymentCurrency: params.paymentCurrency,\n });\n throw new Error(parseApiError(error));\n }\n };\n\n const estimateRewardScoresBatch = async (\n params: EstimateRewardScoresBatchParams\n ): Promise<EstimateRewardScoresBatchResponse> => {\n try {\n sentryAddBreadcrumb({\n category: \"control-api\",\n message: \"POST /farms/estimate-reward-scores-batch\",\n level: \"info\",\n data: { baseUrl },\n });\n const data = await request<EstimateRewardScoresBatchResponse>(\n \"/farms/estimate-reward-scores-batch\",\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(params),\n }\n );\n\n return data;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"estimateRewardScoresBatch\",\n baseUrl,\n farmsCount: params.farms?.length,\n });\n throw new Error(parseApiError(error));\n }\n };\n\n const calculateMiningScoresBatch = async (\n params: MiningScoresBatchParams\n ): Promise<MiningScoresBatchResponse> => {\n try {\n sentryAddBreadcrumb({\n category: \"control-api\",\n message: \"POST /farms/mining-scores-batch\",\n level: \"info\",\n data: { baseUrl },\n });\n const data = await request<MiningScoresBatchResponse>(\n \"/farms/mining-scores-batch\",\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(params),\n }\n );\n\n return data;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"calculateMiningScoresBatch\",\n baseUrl,\n farmsCount: params.farms?.length,\n });\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchEfficiencyScores = async (\n farmId?: string\n ): Promise<FarmEfficiencyScore[] | FarmEfficiencyScore> => {\n try {\n const query = farmId ? `?farmId=${encodeURIComponent(farmId)}` : \"\";\n const data = await request<\n | FarmEfficiencyScore[]\n | SingleEfficiencyScoreResponse\n | EfficiencyScoresErrorResponse\n >(`/farms/efficiency-scores${query}`);\n\n if (\"error\" in data) {\n throw new Error(data.error);\n }\n\n return data as FarmEfficiencyScore[] | FarmEfficiencyScore;\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchFarmWeeklyRewardsBatch = async (\n params: FarmWeeklyRewardsBatchQuery\n ): Promise<FarmWeeklyRewardsBatchResponse> => {\n try {\n sentryAddBreadcrumb({\n category: \"control-api\",\n message: \"POST /farms/rewards-history/batch\",\n level: \"info\",\n data: { baseUrl, farmsCount: params.farmIds?.length },\n });\n\n const data = await request<FarmWeeklyRewardsBatchResponse>(\n \"/farms/rewards-history/batch\",\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(params),\n }\n );\n\n return data;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"fetchFarmWeeklyRewardsBatch\",\n baseUrl,\n farmsCount: params.farmIds?.length,\n });\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchWalletFarmRewardsHistory = async (\n walletAddress: string,\n query?: WalletFarmRewardsHistoryQuery\n ): Promise<WalletFarmRewardsHistoryResponse> => {\n try {\n if (!walletAddress) {\n throw new Error(\"Wallet address is required\");\n }\n\n const params = new URLSearchParams();\n if (query?.startWeek !== undefined)\n params.set(\"startWeek\", query.startWeek.toString());\n if (query?.endWeek !== undefined)\n params.set(\"endWeek\", query.endWeek.toString());\n\n const queryString = params.toString();\n const path = `/farms/by-wallet/${encodeURIComponent(\n walletAddress\n )}/farm-rewards-history${queryString ? `?${queryString}` : \"\"}`;\n\n return await request<WalletFarmRewardsHistoryResponse>(path);\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchWalletFarmRewardsHistoryBatch = async (\n params: WalletFarmRewardsHistoryBatchQuery\n ): Promise<WalletFarmRewardsHistoryBatchResponse> => {\n try {\n sentryAddBreadcrumb({\n category: \"control-api\",\n message: \"POST /farms/by-wallet/farm-rewards-history/batch\",\n level: \"info\",\n data: { baseUrl, walletsCount: params.wallets?.length },\n });\n\n const data = await request<WalletFarmRewardsHistoryBatchResponse>(\n \"/farms/by-wallet/farm-rewards-history/batch\",\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(params),\n }\n );\n\n return data;\n } catch (error) {\n sentryCaptureException(error, {\n action: \"fetchWalletFarmRewardsHistoryBatch\",\n baseUrl,\n walletsCount: params.wallets?.length,\n });\n throw new Error(parseApiError(error));\n }\n };\n\n return {\n fetchFarmRewardSplits,\n fetchSponsoredFarms,\n fetchWalletFarmsWithRewards,\n fetchFarmWeeklyRewards,\n estimateRewardScore,\n estimateRewardScoresBatch,\n calculateMiningScoresBatch,\n fetchEfficiencyScores,\n fetchFarmWeeklyRewardsBatch,\n fetchWalletFarmRewardsHistory,\n fetchWalletFarmRewardsHistoryBatch,\n } as const;\n}\n","import Decimal from \"decimal.js\";\n\n/**\n * Calculates the efficiency score for a farm\n *\n * Formula: efficiencyScore = (CC / PD) / 100,000\n *\n * Where:\n * - CC = weekly carbon credits in WAD format (18 decimals)\n * - PD = protocol deposit in USD (6 decimals)\n *\n * Due to the decimal difference (CC has 18 decimals, PD has 6 decimals),\n * the actual calculation maintains a 10^12 factor, resulting in:\n * efficiencyScore = (CC_actual / PD_actual) × 10^8\n *\n * The efficiency score represents carbon credits produced per $100,000 of\n * protocol deposit per week. Higher scores indicate more efficient farms.\n *\n * @param protocolDepositUsd6 - Protocol deposit in USD (6 decimals)\n * @param weeklyImpactAssetsWad - Weekly carbon credits in WAD format (18 decimals)\n * @returns The efficiency score as a number\n *\n * @example\n * ```typescript\n * const score = calculateFarmEfficiency(5000000000n, 1500000000000000000n);\n * // Returns the efficiency score\n * ```\n */\nexport function calculateFarmEfficiency(\n protocolDepositUsd6: bigint,\n weeklyImpactAssetsWad: bigint\n): number {\n // Handle zero carbon credits case\n if (weeklyImpactAssetsWad === 0n) {\n return 0;\n }\n\n // Convert to Decimal for precise calculation\n const pdDecimal = new Decimal(protocolDepositUsd6.toString());\n const ccDecimal = new Decimal(weeklyImpactAssetsWad.toString());\n\n // Formula: efficiencyScore = (CC / PD) / 100,000\n // CC is in 18 decimals, PD is in 6 decimals\n // Direct division: (CC / PD) / 100,000\n const efficiencyDecimal = ccDecimal.div(pdDecimal).div(100000);\n\n return efficiencyDecimal.toNumber();\n}\n"],"names":["STAKING_DIRECTIONS","REGIONS","KICKSTARTER_STATUS","ForwarderError","Contract","MaxUint256","formatEther","OffchainFractionsError","assertWalletClient","RewardsKernelError","parseApiError"],"mappings":";;;;;;AAAO,MAAM,OAAO,GAAG;AAEhB,MAAM,QAAQ,GAAG,CAAC,4BAA4B;;ACFrD;;;;AAIG;AACI,MAAM,6BAA6B,GAAG;AAE7C;;;AAGG;AACI,MAAM,6BAA6B,GAAG;AAEtC,MAAM,UAAU,GACrB,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC;;ACdlD;AACA;AACA;AAEYA;AAAZ,CAAA,UAAY,kBAAkB,EAAA;AAC5B,IAAA,kBAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,kBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,kBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA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