@glowlabs-org/utils 0.2.94 → 0.2.95
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.
- package/dist/cjs/browser.js +1 -1
- package/dist/cjs/{farms-router-pMZv3N9H.js → farms-router-DCCy-acA.js} +11 -7
- package/dist/cjs/farms-router-DCCy-acA.js.map +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/esm/browser.js +2 -2
- package/dist/esm/{farms-router-sm5H9Ax6.js → farms-router-XDjQOQ-c.js} +11 -7
- package/dist/esm/farms-router-XDjQOQ-c.js.map +1 -0
- package/dist/esm/index.js +2 -2
- package/package.json +1 -1
- package/src/lib/hooks/use-forwarder.ts +27 -8
- package/dist/cjs/farms-router-pMZv3N9H.js.map +0 -1
- package/dist/esm/farms-router-sm5H9Ax6.js.map +0 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -515,12 +515,14 @@ function useForwarder(signer, CHAIN_ID) {
|
|
|
515
515
|
default:
|
|
516
516
|
throw new Error(`Unsupported currency for forwarding: ${currency}`);
|
|
517
517
|
}
|
|
518
|
+
// Determine sendToCounterfactualWallet based on currency
|
|
519
|
+
const sendToCounterfactualWallet = currency === "GLW" || currency === "USDG";
|
|
518
520
|
// Run a static call first to surface any revert reason (ethers v6)
|
|
519
521
|
try {
|
|
520
522
|
if (!isAuditFees && currency === "USDC") {
|
|
521
523
|
await forwarderContract
|
|
522
524
|
.getFunction("swapUSDCAndForwardUSDG")
|
|
523
|
-
.staticCall(amount, ADDRESSES.FOUNDATION_WALLET,
|
|
525
|
+
.staticCall(amount, ADDRESSES.FOUNDATION_WALLET, sendToCounterfactualWallet, message, {
|
|
524
526
|
from: owner,
|
|
525
527
|
});
|
|
526
528
|
}
|
|
@@ -529,7 +531,7 @@ function useForwarder(signer, CHAIN_ID) {
|
|
|
529
531
|
.getFunction("forward")
|
|
530
532
|
.staticCall(tokenAddress, isAuditFees
|
|
531
533
|
? ADDRESSES.AUDIT_FEE_WALLET
|
|
532
|
-
: ADDRESSES.FOUNDATION_WALLET, amount,
|
|
534
|
+
: ADDRESSES.FOUNDATION_WALLET, amount, sendToCounterfactualWallet, message, { from: owner });
|
|
533
535
|
}
|
|
534
536
|
}
|
|
535
537
|
catch (staticError) {
|
|
@@ -538,12 +540,12 @@ function useForwarder(signer, CHAIN_ID) {
|
|
|
538
540
|
// Execute the forward transaction
|
|
539
541
|
let tx;
|
|
540
542
|
if (!isAuditFees && currency === "USDC") {
|
|
541
|
-
tx = await forwarderContract.getFunction("swapUSDCAndForwardUSDG")(amount, ADDRESSES.FOUNDATION_WALLET,
|
|
543
|
+
tx = await forwarderContract.getFunction("swapUSDCAndForwardUSDG")(amount, ADDRESSES.FOUNDATION_WALLET, sendToCounterfactualWallet, message);
|
|
542
544
|
}
|
|
543
545
|
else {
|
|
544
546
|
tx = await forwarderContract.getFunction("forward")(tokenAddress, isAuditFees
|
|
545
547
|
? ADDRESSES.AUDIT_FEE_WALLET
|
|
546
|
-
: ADDRESSES.FOUNDATION_WALLET, amount,
|
|
548
|
+
: ADDRESSES.FOUNDATION_WALLET, amount, sendToCounterfactualWallet, message);
|
|
547
549
|
}
|
|
548
550
|
await tx.wait();
|
|
549
551
|
return tx.hash;
|
|
@@ -708,6 +710,8 @@ function useForwarder(signer, CHAIN_ID) {
|
|
|
708
710
|
}
|
|
709
711
|
// Construct the appropriate message for this forward type
|
|
710
712
|
const message = constructForwardMessage(params);
|
|
713
|
+
// Determine sendToCounterfactualWallet based on currency
|
|
714
|
+
const sendToCounterfactualWallet = currency === "GLW" || currency === "USDG";
|
|
711
715
|
// Get token address
|
|
712
716
|
let tokenAddress;
|
|
713
717
|
switch (currency) {
|
|
@@ -731,12 +735,12 @@ function useForwarder(signer, CHAIN_ID) {
|
|
|
731
735
|
const estimatedGas = !isAuditFees && currency === "USDC"
|
|
732
736
|
? await forwarderContract
|
|
733
737
|
.getFunction("swapUSDCAndForwardUSDG")
|
|
734
|
-
.estimateGas(amount, ADDRESSES.FOUNDATION_WALLET,
|
|
738
|
+
.estimateGas(amount, ADDRESSES.FOUNDATION_WALLET, sendToCounterfactualWallet, message)
|
|
735
739
|
: await forwarderContract
|
|
736
740
|
.getFunction("forward")
|
|
737
741
|
.estimateGas(tokenAddress, isAuditFees
|
|
738
742
|
? ADDRESSES.AUDIT_FEE_WALLET
|
|
739
|
-
: ADDRESSES.FOUNDATION_WALLET, amount,
|
|
743
|
+
: ADDRESSES.FOUNDATION_WALLET, amount, sendToCounterfactualWallet, message);
|
|
740
744
|
const estimatedCost = estimatedGas * gasPrice;
|
|
741
745
|
if (ethPriceInUSD) {
|
|
742
746
|
const estimatedCostInEth = viem.formatEther(estimatedCost);
|
|
@@ -2181,4 +2185,4 @@ exports.getAddresses = getAddresses;
|
|
|
2181
2185
|
exports.regionMetadata = regionMetadata;
|
|
2182
2186
|
exports.usStates = usStates;
|
|
2183
2187
|
exports.useForwarder = useForwarder;
|
|
2184
|
-
//# sourceMappingURL=farms-router-
|
|
2188
|
+
//# sourceMappingURL=farms-router-DCCy-acA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"farms-router-DCCy-acA.js","sources":["../../src/constants/urls.ts","../../src/constants/weights.ts","../../src/lib/abis/forwarderABI.ts","../../src/lib/abis/erc20.abi.ts","../../src/constants/addresses.ts","../../src/lib/types/index.ts","../../src/lib/hooks/use-forwarder.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"],"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","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\n// Contract-specific addresses\nconst mainnetAddresses: Record<ContractKeys, `0x${string}`> = {\n AUDIT_FEE_WALLET: \"0x3ff5af3333ddc6048d98849ec5e67868494693c9\",\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: \"0x240CBe07a047ce484DCa2E3Ae15d4907Aba41BE2\",\n FOUNDATION_WALLET: \"0xc5174BBf649a92F9941e981af68AaA14Dd814F85\",\n UNISWAP_V2_ROUTER: \"0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\",\n UNISWAP_V2_FACTORY: \"0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f\",\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: \"0xDaC24F18171224eeaf6a9B38f5C5081aDbDff969\",\n FOUNDATION_WALLET: \"0x5e230FED487c86B90f6508104149F087d9B1B0A7\",\n UNISWAP_V2_ROUTER: \"0xeE567Fe1712Faf6149d80dA1E6934E354124CfE3\",\n UNISWAP_V2_FACTORY: \"0xF62c03E08ada871A0bEb309762E260a7a6a880E6\",\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","// ---------------------------------------------------------------------------\n// Common / Shared Types\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\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}\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 type KickstarterStatus =\n | \"draft\"\n | \"collecting-support\"\n | \"completed\"\n | \"expired\"\n | \"cancelled\"\n | \"suspended\";\n\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 kickoffStakeEventId?: 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 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 adjustedWeeklyCarbonCredits: string;\n protocolDepositUSDC6Decimals: string;\n protocolDepositPaidAmount: string;\n protocolDepositPaidCurrency: string;\n protocolDepositPayerWallet: string | null;\n builtEpoch: number;\n isPurchased: boolean;\n builtAt: string;\n sponsorWallet: string | null;\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 glwPerWeek: number;\n usdgPerWeek: number;\n gctlPerWeek: number;\n carbonCreditsIssued: number;\n carbonCreditsPerWeek: number;\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 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 adjustedWeeklyCarbonCredits: string;\n protocolDepositPaidAmount: string;\n protocolDepositPaidCurrency: string;\n protocolDepositPayerWallet: string | null;\n builtEpoch: number;\n isPurchased: boolean;\n builtAt: string; // ISO 8601\n sponsorWallet: string | null;\n}\n\nexport interface WalletDetails {\n wallet: string;\n controlBalance: string;\n stakedControl: string;\n createdAt: string; // ISO 8601\n regions: WalletRegionStakeTotal[];\n ownedFarms: WalletFarmInfo[];\n purchasedFarms: WalletFarmInfo[];\n}\n\n// ---------------------------------------------------------------------------\n// Barrel exports (convenience)\n// ---------------------------------------------------------------------------\nexport type { MintedEvent as ControlMintedEvent };\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\";\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// Utility to extract the most useful revert reason from an ethers error object\nfunction 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 ForwarderError.UNKNOWN_ERROR;\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 approveTx.wait();\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 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 approveTx.wait();\n } catch (approveError) {\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 =\n currency === \"GLW\" || currency === \"USDG\";\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 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 tx.wait();\n\n return tx.hash;\n } catch (txError: any) {\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 // Determine sendToCounterfactualWallet based on currency\n const sendToCounterfactualWallet =\n currency === \"GLW\" || currency === \"USDG\";\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(\n amount,\n ADDRESSES.FOUNDATION_WALLET,\n sendToCounterfactualWallet,\n message\n )\n : await forwarderContract\n .getFunction(\"forward\")\n .estimateGas(\n tokenAddress,\n isAuditFees\n ? ADDRESSES.AUDIT_FEE_WALLET\n : ADDRESSES.FOUNDATION_WALLET,\n amount,\n sendToCounterfactualWallet,\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 tx.wait();\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","\"use strict\";\n\nimport type {\n GctlPrice,\n StakeRequest,\n RegionStake,\n WalletRegionStake,\n WalletRegionUnlocked,\n TransferDetails,\n GlwPrice,\n GlwRegionRewardsResponse,\n WalletNonce,\n GctlSupply,\n MintedEventsResponse,\n StakeEventsResponse,\n FailedOperationsResponse,\n PendingTransfersResponse,\n PendingTransferType,\n RestakeRequest,\n} from \"../types\";\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\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 // ----------------------- 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<{ gctl_balance: string }>(\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 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 // 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}®ionId=${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 // 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 // ----------------------- Mutations ---------------------------------------\n let isStaking = false;\n let isUnstaking = false;\n let isRestaking = false;\n let isRetryingFailedOperation = false;\n let isPayingProtocolDepositUsingStakedControl = false;\n\n const stakeGctl = async (stakeRequest: StakeRequest): Promise<boolean> => {\n isStaking = true;\n try {\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 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 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 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 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 throw new Error(parseApiError(error));\n } finally {\n isRestaking = false;\n }\n };\n\n const retryFailedOperation = async (\n operationId: string\n ): Promise<boolean> => {\n isRetryingFailedOperation = true;\n try {\n await request(`/operations/failed/${operationId}/retry`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n });\n return true;\n } catch (error) {\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 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 throw new Error(parseApiError(error));\n } finally {\n isPayingProtocolDepositUsingStakedControl = false;\n }\n };\n\n // --------------------------- Public API ----------------------------------\n return {\n // Queries\n fetchGctlBalance,\n fetchGctlPrice,\n fetchGlwPrice,\n fetchCirculatingSupply,\n fetchLastNonce,\n fetchMintedEvents,\n fetchStakeEvents,\n fetchPendingTransfers,\n fetchFailedOperations,\n fetchRegionStake,\n fetchWalletRegionStake,\n fetchWalletRegionUnlocked,\n fetchTransferDetails: getTransferDetails,\n fetchGlwRegionRewards,\n\n // Mutations\n stakeGctl,\n unstakeGctl,\n restakeGctl,\n retryFailedOperation,\n payProtocolDepositUsingStakedControl,\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 } 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 CreateRegionPayload,\n ActivationEvent,\n RegionDetails,\n SponsoredFarm,\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 let isCreatingRegion = 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 // -------------------------------------------------------------------------\n // Mutations\n // -------------------------------------------------------------------------\n const createRegion = async (payload: CreateRegionPayload): Promise<void> => {\n isCreatingRegion = true;\n try {\n await request(`/regions/create`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(payload),\n });\n // Refresh the local cache after successful creation\n await fetchRegions();\n } catch (error) {\n throw new Error(parseApiError(error));\n } finally {\n isCreatingRegion = false;\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 };\n };\n\n // -------------------------------------------------------------------------\n // Public API\n // -------------------------------------------------------------------------\n return {\n // Data access\n fetchRegions,\n fetchActivationConfig,\n fetchActivationEvents,\n fetchRegionByIdOrSlug,\n fetchRegionSolarFarms,\n getRegionByCode,\n createRegion,\n\n // Cached data & flags\n get regions() {\n return cachedRegions;\n },\n get isLoading() {\n return isLoading;\n },\n get isCreatingRegion() {\n return isCreatingRegion;\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} 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 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 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 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 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 throw new Error(parseApiError(error));\n }\n };\n\n return {\n fetchKickstarters,\n fetchKickstarter,\n fetchKickstartersByWallet,\n commitKickstarter,\n createKickstarter,\n get isCreatingKickstarter() {\n return isCreatingKickstarter;\n },\n } as const;\n}\n","\"use strict\";\n\nimport type { ControlWallet, WalletsResponse, WalletDetails } from \"../types\";\nimport type { MintedEvent, StakedEvent } 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}®ionId=${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 return {\n fetchAllWallets,\n fetchWalletByAddress,\n fetchWalletMintedEvents,\n fetchWalletStakeEvents,\n } as const;\n}\n","\"use strict\";\n\nimport type { SponsoredFarm } from \"../types\";\nimport type { SponsoredFarmsResponse } 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 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 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 return {\n fetchSponsoredFarms,\n } as const;\n}\n"],"names":["ForwarderError","Contract","MaxUint256","formatEther","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;;ACd3C,MAAM,aAAa,GAAG;AAC3B,IAAA;AACE,QAAA,MAAM,EAAE;YACN,EAAE,YAAY,EAAE,eAAe,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;YACjE,EAAE,YAAY,EAAE,iBAAiB,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;AACnE,YAAA;AACE,gBAAA,YAAY,EAAE,sCAAsC;AACpD,gBAAA,IAAI,EAAE,aAAa;AACnB,gBAAA,IAAI,EAAE,SAAS;AAChB,aAAA;AACF,SAAA;AACD,QAAA,eAAe,EAAE,SAAS;AAC1B,QAAA,IAAI,EAAE,aAAa;AACpB,KAAA;AACD,IAAA;AACE,QAAA,MAAM,EAAE,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EA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letreejs = require('merkletreejs');
|
|
16
16
|
var ethers = require('ethers');
|
|
17
17
|
var Decimal = require('decimal.js');
|
|
18
|
-
var farmsRouter = require('./farms-router-
|
|
18
|
+
var farmsRouter = require('./farms-router-DCCy-acA.js');
|
|
19
19
|
|
|
20
20
|
const GENESIS_TIMESTAMP = 1700352000;
|
|
21
21
|
|
package/dist/esm/browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TRANSFER_TYPES } from './farms-router-
|
|
2
|
-
export { C as ControlRouter, D as DECIMALS_BY_TOKEN, e as FORWARDER_ABI, F as FarmsRouter, a as ForwarderError, f as GCA_URLS, G as GLOW_WEIGHT_DECIMAL_PRECISION, H as HUB_URL, K as KickstarterRouter, M as MAX_WEIGHT, O as OFF_CHAIN_PAYMENT_CURRENCIES, P as PAYMENT_CURRENCIES, R as RegionRouter, U as USDG_WEIGHT_DECIMAL_PRECISION, W as WalletsRouter, b as allRegions, d as countries, g as getAddresses, r as regionMetadata, c as usStates, u as useForwarder } from './farms-router-
|
|
1
|
+
import { T as TRANSFER_TYPES } from './farms-router-XDjQOQ-c.js';
|
|
2
|
+
export { C as ControlRouter, D as DECIMALS_BY_TOKEN, e as FORWARDER_ABI, F as FarmsRouter, a as ForwarderError, f as GCA_URLS, G as GLOW_WEIGHT_DECIMAL_PRECISION, H as HUB_URL, K as KickstarterRouter, M as MAX_WEIGHT, O as OFF_CHAIN_PAYMENT_CURRENCIES, P as PAYMENT_CURRENCIES, R as RegionRouter, U as USDG_WEIGHT_DECIMAL_PRECISION, W as WalletsRouter, b as allRegions, d as countries, g as getAddresses, r as regionMetadata, c as usStates, u as useForwarder } from './farms-router-XDjQOQ-c.js';
|
|
3
3
|
import { verifyTypedData, getAddress } from 'viem';
|
|
4
4
|
import 'ethers';
|
|
5
5
|
|
|
@@ -513,12 +513,14 @@ function useForwarder(signer, CHAIN_ID) {
|
|
|
513
513
|
default:
|
|
514
514
|
throw new Error(`Unsupported currency for forwarding: ${currency}`);
|
|
515
515
|
}
|
|
516
|
+
// Determine sendToCounterfactualWallet based on currency
|
|
517
|
+
const sendToCounterfactualWallet = currency === "GLW" || currency === "USDG";
|
|
516
518
|
// Run a static call first to surface any revert reason (ethers v6)
|
|
517
519
|
try {
|
|
518
520
|
if (!isAuditFees && currency === "USDC") {
|
|
519
521
|
await forwarderContract
|
|
520
522
|
.getFunction("swapUSDCAndForwardUSDG")
|
|
521
|
-
.staticCall(amount, ADDRESSES.FOUNDATION_WALLET,
|
|
523
|
+
.staticCall(amount, ADDRESSES.FOUNDATION_WALLET, sendToCounterfactualWallet, message, {
|
|
522
524
|
from: owner,
|
|
523
525
|
});
|
|
524
526
|
}
|
|
@@ -527,7 +529,7 @@ function useForwarder(signer, CHAIN_ID) {
|
|
|
527
529
|
.getFunction("forward")
|
|
528
530
|
.staticCall(tokenAddress, isAuditFees
|
|
529
531
|
? ADDRESSES.AUDIT_FEE_WALLET
|
|
530
|
-
: ADDRESSES.FOUNDATION_WALLET, amount,
|
|
532
|
+
: ADDRESSES.FOUNDATION_WALLET, amount, sendToCounterfactualWallet, message, { from: owner });
|
|
531
533
|
}
|
|
532
534
|
}
|
|
533
535
|
catch (staticError) {
|
|
@@ -536,12 +538,12 @@ function useForwarder(signer, CHAIN_ID) {
|
|
|
536
538
|
// Execute the forward transaction
|
|
537
539
|
let tx;
|
|
538
540
|
if (!isAuditFees && currency === "USDC") {
|
|
539
|
-
tx = await forwarderContract.getFunction("swapUSDCAndForwardUSDG")(amount, ADDRESSES.FOUNDATION_WALLET,
|
|
541
|
+
tx = await forwarderContract.getFunction("swapUSDCAndForwardUSDG")(amount, ADDRESSES.FOUNDATION_WALLET, sendToCounterfactualWallet, message);
|
|
540
542
|
}
|
|
541
543
|
else {
|
|
542
544
|
tx = await forwarderContract.getFunction("forward")(tokenAddress, isAuditFees
|
|
543
545
|
? ADDRESSES.AUDIT_FEE_WALLET
|
|
544
|
-
: ADDRESSES.FOUNDATION_WALLET, amount,
|
|
546
|
+
: ADDRESSES.FOUNDATION_WALLET, amount, sendToCounterfactualWallet, message);
|
|
545
547
|
}
|
|
546
548
|
await tx.wait();
|
|
547
549
|
return tx.hash;
|
|
@@ -706,6 +708,8 @@ function useForwarder(signer, CHAIN_ID) {
|
|
|
706
708
|
}
|
|
707
709
|
// Construct the appropriate message for this forward type
|
|
708
710
|
const message = constructForwardMessage(params);
|
|
711
|
+
// Determine sendToCounterfactualWallet based on currency
|
|
712
|
+
const sendToCounterfactualWallet = currency === "GLW" || currency === "USDG";
|
|
709
713
|
// Get token address
|
|
710
714
|
let tokenAddress;
|
|
711
715
|
switch (currency) {
|
|
@@ -729,12 +733,12 @@ function useForwarder(signer, CHAIN_ID) {
|
|
|
729
733
|
const estimatedGas = !isAuditFees && currency === "USDC"
|
|
730
734
|
? await forwarderContract
|
|
731
735
|
.getFunction("swapUSDCAndForwardUSDG")
|
|
732
|
-
.estimateGas(amount, ADDRESSES.FOUNDATION_WALLET,
|
|
736
|
+
.estimateGas(amount, ADDRESSES.FOUNDATION_WALLET, sendToCounterfactualWallet, message)
|
|
733
737
|
: await forwarderContract
|
|
734
738
|
.getFunction("forward")
|
|
735
739
|
.estimateGas(tokenAddress, isAuditFees
|
|
736
740
|
? ADDRESSES.AUDIT_FEE_WALLET
|
|
737
|
-
: ADDRESSES.FOUNDATION_WALLET, amount,
|
|
741
|
+
: ADDRESSES.FOUNDATION_WALLET, amount, sendToCounterfactualWallet, message);
|
|
738
742
|
const estimatedCost = estimatedGas * gasPrice;
|
|
739
743
|
if (ethPriceInUSD) {
|
|
740
744
|
const estimatedCostInEth = formatEther(estimatedCost);
|
|
@@ -2159,4 +2163,4 @@ function FarmsRouter(baseUrl) {
|
|
|
2159
2163
|
}
|
|
2160
2164
|
|
|
2161
2165
|
export { ControlRouter as C, DECIMALS_BY_TOKEN as D, FarmsRouter as F, GLOW_WEIGHT_DECIMAL_PRECISION as G, HUB_URL as H, KickstarterRouter as K, MAX_WEIGHT as M, OFF_CHAIN_PAYMENT_CURRENCIES as O, PAYMENT_CURRENCIES as P, RegionRouter as R, TRANSFER_TYPES as T, USDG_WEIGHT_DECIMAL_PRECISION as U, WalletsRouter as W, ForwarderError as a, allRegions as b, usStates as c, countries as d, FORWARDER_ABI as e, GCA_URLS as f, getAddresses as g, regionMetadata as r, useForwarder as u };
|
|
2162
|
-
//# sourceMappingURL=farms-router-
|
|
2166
|
+
//# sourceMappingURL=farms-router-XDjQOQ-c.js.map
|