@glowlabs-org/utils 0.2.63 → 0.2.65

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.
@@ -788,7 +788,7 @@ function ControlRouter(baseUrl) {
788
788
  const fetchMintedEvents = async (page, limit) => {
789
789
  try {
790
790
  const data = await request(`/events/minted${buildPaginationQuery(page, limit)}`);
791
- return data.events ?? [];
791
+ return data;
792
792
  }
793
793
  catch (error) {
794
794
  throw new Error(parseApiError$3(error));
@@ -799,16 +799,18 @@ function ControlRouter(baseUrl) {
799
799
  const base = `/events/stake${buildPaginationQuery(page, limit)}`;
800
800
  const query = typeof regionId === "number" ? `${base}&regionId=${regionId}` : base;
801
801
  const data = await request(query);
802
- return data.events ?? [];
802
+ return data;
803
803
  }
804
804
  catch (error) {
805
805
  throw new Error(parseApiError$3(error));
806
806
  }
807
807
  };
808
- const fetchPendingTransfers = async (page, limit) => {
808
+ const fetchPendingTransfers = async (page, limit, type) => {
809
809
  try {
810
- const data = await request(`/transfers/pending${buildPaginationQuery(page, limit)}`);
811
- return data.transfers ?? [];
810
+ const base = `/transfers/pending${buildPaginationQuery(page, limit)}`;
811
+ const query = type ? `${base}&type=${encodeURIComponent(type)}` : base;
812
+ const data = await request(query);
813
+ return data;
812
814
  }
813
815
  catch (error) {
814
816
  throw new Error(parseApiError$3(error));
@@ -825,7 +827,7 @@ function ControlRouter(baseUrl) {
825
827
  const fetchFailedOperations = async (page, limit) => {
826
828
  try {
827
829
  const data = await request(`/operations/failed${buildPaginationQuery(page, limit)}`);
828
- return data.operations ?? [];
830
+ return data;
829
831
  }
830
832
  catch (error) {
831
833
  throw new Error(parseApiError$3(error));
@@ -867,6 +869,7 @@ function ControlRouter(baseUrl) {
867
869
  // ----------------------- Mutations ---------------------------------------
868
870
  let isStaking = false;
869
871
  let isUnstaking = false;
872
+ let isRestaking = false;
870
873
  let isRetryingFailedOperation = false;
871
874
  const stakeGctl = async (stakeRequest) => {
872
875
  isStaking = true;
@@ -902,6 +905,23 @@ function ControlRouter(baseUrl) {
902
905
  isUnstaking = false;
903
906
  }
904
907
  };
908
+ const restakeGctl = async (restakeRequest) => {
909
+ isRestaking = true;
910
+ try {
911
+ await request(`/restake`, {
912
+ method: "POST",
913
+ headers: { "Content-Type": "application/json" },
914
+ body: JSON.stringify(restakeRequest),
915
+ });
916
+ return true;
917
+ }
918
+ catch (error) {
919
+ throw new Error(parseApiError$3(error));
920
+ }
921
+ finally {
922
+ isRestaking = false;
923
+ }
924
+ };
905
925
  const retryFailedOperation = async (operationId) => {
906
926
  isRetryingFailedOperation = true;
907
927
  try {
@@ -937,6 +957,7 @@ function ControlRouter(baseUrl) {
937
957
  // Mutations
938
958
  stakeGctl,
939
959
  unstakeGctl,
960
+ restakeGctl,
940
961
  retryFailedOperation,
941
962
  // Processing flags
942
963
  get isStaking() {
@@ -945,6 +966,9 @@ function ControlRouter(baseUrl) {
945
966
  get isUnstaking() {
946
967
  return isUnstaking;
947
968
  },
969
+ get isRestaking() {
970
+ return isRestaking;
971
+ },
948
972
  get isRetryingFailedOperation() {
949
973
  return isRetryingFailedOperation;
950
974
  },
@@ -1964,4 +1988,4 @@ function WalletsRouter(baseUrl) {
1964
1988
  }
1965
1989
 
1966
1990
  export { ControlRouter as C, DECIMALS_BY_TOKEN as D, ForwarderError as F, GLOW_WEIGHT_DECIMAL_PRECISION as G, HUB_URL as H, KickstarterRouter as K, MAX_WEIGHT as M, RegionRouter as R, USDG_WEIGHT_DECIMAL_PRECISION as U, WalletsRouter as W, allRegions as a, usStates as b, countries as c, FORWARDER_ABI as d, GCA_URLS as e, getAddresses as g, regionMetadata as r, useForwarder as u };
1967
- //# sourceMappingURL=wallets-router-KYbgrMuV.js.map
1991
+ //# sourceMappingURL=wallets-router-PWljCI5b.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallets-router-PWljCI5b.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/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"],"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 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 { 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_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 { 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","type ContractKeys =\n | \"USDC\"\n | \"FORWARDER\"\n | \"FOUNDATION_WALLET\"\n | \"GLW\"\n | \"USDG\"\n | \"USDG_REDEMPTION\"\n | \"IMPACT_CATALYST\"\n | \"AUDIT_FEE_WALLET\";\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 FORWARDER: \"0x240CBe07a047ce484DCa2E3Ae15d4907Aba41BE2\",\n FOUNDATION_WALLET: \"0x0000000000000000000000000000000000000000\", // TODO: Update with actual mainnet foundation wallet\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 FORWARDER: \"0x1fb285dDFCbC0456d655F8DC7C637E33c5568858\",\n FOUNDATION_WALLET: \"0x5e230FED487c86B90f6508104149F087d9B1B0A7\",\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\" | \"GLW\",\n number\n> = {\n USDC: 6,\n USDG: 6,\n GCTL: 6,\n GLW: 18,\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\";\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 =\n | \"PayProtocolFeeAndMintGCTLAndStake\"\n | \"PayProtocolFee\"\n | \"MintGCTLAndStake\"\n | \"MintGCTL\"\n | \"BuySolarFarm\"\n | \"PayAuditFees\"\n | \"CommitKickstarter\";\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 \"PayProtocolFeeAndMintGCTLAndStake\":\n if (!applicationId) {\n throw new Error(ForwarderError.MISSING_REQUIRED_PARAMS);\n }\n return `PayProtocolFeeAndMintGCTLAndStake::${applicationId}`;\n\n case \"PayProtocolFee\":\n if (!applicationId) {\n throw new Error(ForwarderError.MISSING_REQUIRED_PARAMS);\n }\n return `PayProtocolFee::${applicationId}`;\n\n case \"MintGCTLAndStake\":\n if (!regionId) {\n throw new Error(ForwarderError.MISSING_REQUIRED_PARAMS);\n }\n return `MintGCTLAndStake::${regionId}`;\n\n case \"MintGCTL\":\n if (!userAddress) {\n throw new Error(ForwarderError.MISSING_REQUIRED_PARAMS);\n }\n return `MintGCTL::${userAddress}`;\n\n case \"BuySolarFarm\":\n if (!farmId) {\n throw new Error(ForwarderError.MISSING_REQUIRED_PARAMS);\n }\n return `BuySolarFarm::${farmId}`;\n\n case \"PayAuditFees\":\n if (!applicationId) {\n throw new Error(ForwarderError.MISSING_REQUIRED_PARAMS);\n }\n return `PayAuditFees::${applicationId}`;\n\n case \"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 === \"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 = params.type === \"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\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 // 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(amount, ADDRESSES.FOUNDATION_WALLET, message, {\n from: owner,\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 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 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 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: \"PayProtocolFeeAndMintGCTLAndStake\",\n currency,\n applicationId,\n regionId,\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: \"PayProtocolFee\",\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: \"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: \"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: \"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: \"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: \"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 === \"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, 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 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 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 WalletNonce,\n GctlSupply,\n MintedEventsResponse,\n StakeEventsResponse,\n FailedOperationsResponse,\n PendingTransfersResponse,\n PendingTransferType,\n RestakeRequest,\n} from \"../types\";\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}&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 // 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\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 // --------------------------- 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\n // Mutations\n stakeGctl,\n unstakeGctl,\n restakeGctl,\n retryFailedOperation,\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 } 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} 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<\n Kickstarter & {\n contributorsCount: number;\n }\n > => {\n try {\n const data = await request<{\n kickstarter: Kickstarter & { contributorsCount: number };\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}&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 return {\n fetchAllWallets,\n fetchWalletByAddress,\n fetchWalletMintedEvents,\n fetchWalletStakeEvents,\n } as const;\n}\n"],"names":["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;AACpE,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,QAA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A,IAAI;AACF,YAAA,MAAM,IAAI,GAAG,MAAM,OAAO,CACxB,CAAA,iBAAA,EAAoB,kBAAkB,CACpC,MAAM,CACP,CAAA,cAAA,EAAiB,oBAAoB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA,CAAE,CACtD;AACD,YAAA,OAAO,IAAI,CAAC,MAAM,IAAI,EAAE;QAC1B;QAAE,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACvC;AACF,IAAA,CAAC;AAED,IAAA,MAAM,sBAAsB,GAAG,OAC7B,MAAc,EACd,IAAa,EACb,KAAc,EACd,QAAiB,KACS;AAC1B,QAAA,IAAI;AACF,YAAA,MAAM,IAAI,GAAG,CAAA,iBAAA,EAAoB,kBAAkB,CACjD,MAAM,CACP,CAAA,aAAA,EAAgB,oBAAoB,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE;AACpD,YAAA,MAAM,KAAK,GACT,OAAO,QAAQ,KAAK,QAAQ,GAAG,CAAA,EAAG,IAAI,aAAa,QAAQ,CAAA,CAAE,GAAG,IAAI;AACtE,YAAA,MAAM,IAAI,GAAG,MAAM,OAAO,CAA4B,KAAK,CAAC;AAC5D,YAAA,OAAO,IAAI,CAAC,MAAM,IAAI,EAAE;QAC1B;QAAE,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACvC;AACF,IAAA,CAAC;IAED,OAAO;QACL,eAAe;QACf,oBAAoB;QACpB,uBAAuB;QACvB,sBAAsB;KACd;AACZ;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glowlabs-org/utils",
3
- "version": "0.2.63",
3
+ "version": "0.2.65",
4
4
  "description": "A library containing all typechain types and addresses relating to the glow guarded launch",
5
5
  "keywords": [],
6
6
  "author": "",
@@ -1,10 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  import type {
4
- MintedEvent,
5
- StakedEvent,
6
- PendingTransfer,
7
- FailedOperation,
8
4
  GctlPrice,
9
5
  StakeRequest,
10
6
  RegionStake,
@@ -14,6 +10,12 @@ import type {
14
10
  GlwPrice,
15
11
  WalletNonce,
16
12
  GctlSupply,
13
+ MintedEventsResponse,
14
+ StakeEventsResponse,
15
+ FailedOperationsResponse,
16
+ PendingTransfersResponse,
17
+ PendingTransferType,
18
+ RestakeRequest,
17
19
  } from "../types";
18
20
 
19
21
  // --------------------------------------------------------------------------
@@ -101,12 +103,12 @@ export function ControlRouter(baseUrl: string) {
101
103
  const fetchMintedEvents = async (
102
104
  page?: number,
103
105
  limit?: number
104
- ): Promise<MintedEvent[]> => {
106
+ ): Promise<MintedEventsResponse> => {
105
107
  try {
106
- const data = await request<{ events: MintedEvent[] }>(
108
+ const data = await request<MintedEventsResponse>(
107
109
  `/events/minted${buildPaginationQuery(page, limit)}`
108
110
  );
109
- return data.events ?? [];
111
+ return data;
110
112
  } catch (error) {
111
113
  throw new Error(parseApiError(error));
112
114
  }
@@ -116,13 +118,13 @@ export function ControlRouter(baseUrl: string) {
116
118
  page?: number,
117
119
  limit?: number,
118
120
  regionId?: number
119
- ): Promise<StakedEvent[]> => {
121
+ ): Promise<StakeEventsResponse> => {
120
122
  try {
121
123
  const base = `/events/stake${buildPaginationQuery(page, limit)}`;
122
124
  const query =
123
125
  typeof regionId === "number" ? `${base}&regionId=${regionId}` : base;
124
- const data = await request<{ events: StakedEvent[] }>(query);
125
- return data.events ?? [];
126
+ const data = await request<StakeEventsResponse>(query);
127
+ return data;
126
128
  } catch (error) {
127
129
  throw new Error(parseApiError(error));
128
130
  }
@@ -130,14 +132,14 @@ export function ControlRouter(baseUrl: string) {
130
132
 
131
133
  const fetchPendingTransfers = async (
132
134
  page?: number,
133
- limit?: number
134
- ): Promise<PendingTransfer[]> => {
135
+ limit?: number,
136
+ type?: PendingTransferType
137
+ ): Promise<PendingTransfersResponse> => {
135
138
  try {
136
- const data = await request<{ transfers: PendingTransfer[] }>(
137
- `/transfers/pending${buildPaginationQuery(page, limit)}`
138
- );
139
-
140
- return data.transfers ?? [];
139
+ const base = `/transfers/pending${buildPaginationQuery(page, limit)}`;
140
+ const query = type ? `${base}&type=${encodeURIComponent(type)}` : base;
141
+ const data = await request<PendingTransfersResponse>(query);
142
+ return data;
141
143
  } catch (error) {
142
144
  throw new Error(parseApiError(error));
143
145
  }
@@ -156,12 +158,12 @@ export function ControlRouter(baseUrl: string) {
156
158
  const fetchFailedOperations = async (
157
159
  page?: number,
158
160
  limit?: number
159
- ): Promise<FailedOperation[]> => {
161
+ ): Promise<FailedOperationsResponse> => {
160
162
  try {
161
- const data = await request<{ operations: FailedOperation[] }>(
163
+ const data = await request<FailedOperationsResponse>(
162
164
  `/operations/failed${buildPaginationQuery(page, limit)}`
163
165
  );
164
- return data.operations ?? [];
166
+ return data;
165
167
  } catch (error) {
166
168
  throw new Error(parseApiError(error));
167
169
  }
@@ -213,6 +215,7 @@ export function ControlRouter(baseUrl: string) {
213
215
  // ----------------------- Mutations ---------------------------------------
214
216
  let isStaking = false;
215
217
  let isUnstaking = false;
218
+ let isRestaking = false;
216
219
  let isRetryingFailedOperation = false;
217
220
 
218
221
  const stakeGctl = async (stakeRequest: StakeRequest): Promise<boolean> => {
@@ -249,6 +252,24 @@ export function ControlRouter(baseUrl: string) {
249
252
  }
250
253
  };
251
254
 
255
+ const restakeGctl = async (
256
+ restakeRequest: RestakeRequest
257
+ ): Promise<boolean> => {
258
+ isRestaking = true;
259
+ try {
260
+ await request(`/restake`, {
261
+ method: "POST",
262
+ headers: { "Content-Type": "application/json" },
263
+ body: JSON.stringify(restakeRequest),
264
+ });
265
+ return true;
266
+ } catch (error) {
267
+ throw new Error(parseApiError(error));
268
+ } finally {
269
+ isRestaking = false;
270
+ }
271
+ };
272
+
252
273
  const retryFailedOperation = async (
253
274
  operationId: string
254
275
  ): Promise<boolean> => {
@@ -286,6 +307,7 @@ export function ControlRouter(baseUrl: string) {
286
307
  // Mutations
287
308
  stakeGctl,
288
309
  unstakeGctl,
310
+ restakeGctl,
289
311
  retryFailedOperation,
290
312
 
291
313
  // Processing flags
@@ -295,6 +317,9 @@ export function ControlRouter(baseUrl: string) {
295
317
  get isUnstaking() {
296
318
  return isUnstaking;
297
319
  },
320
+ get isRestaking() {
321
+ return isRestaking;
322
+ },
298
323
  get isRetryingFailedOperation() {
299
324
  return isRetryingFailedOperation;
300
325
  },
@@ -18,6 +18,7 @@ export interface StakedEvent {
18
18
  epoch: number;
19
19
  wallet: string;
20
20
  regionId: number;
21
+ regionName: string;
21
22
  amount: string;
22
23
  direction: "stake" | "unstake" | "restake";
23
24
  ts: string; // ISO date string
@@ -37,6 +38,16 @@ export interface PendingTransfer {
37
38
  kickstarterId?: string;
38
39
  }
39
40
 
41
+ // Pending transfer type filter for listing endpoint
42
+ export type PendingTransferType =
43
+ | "PayProtocolFeeAndMintGCTLAndStake"
44
+ | "PayProtocolFee"
45
+ | "PayAuditFees"
46
+ | "CommitKickstarter"
47
+ | "MintGCTLAndStake"
48
+ | "MintGCTL"
49
+ | "BuySolarFarm";
50
+
40
51
  export interface TransferDetails extends PendingTransfer {
41
52
  blockNumber: string;
42
53
  failureInfo?: {
@@ -94,6 +105,16 @@ export interface StakeRequest {
94
105
  nonce: string; // stringified integer
95
106
  }
96
107
 
108
+ export interface RestakeRequest {
109
+ wallet: string; // 0x-prefixed 40-char hex
110
+ fromZoneId: number; // Source region ID
111
+ toZoneId: number; // Destination region ID
112
+ amount: string; // Amount in atomic units (10^6 = 1 GCTL)
113
+ signature: string; // 0x-prefixed 65-byte hex signature
114
+ deadline: string; // unix timestamp (as string)
115
+ nonce: string; // stringified integer
116
+ }
117
+
97
118
  export interface RegionStake {
98
119
  regionId: number;
99
120
  currentGctlStake: string;
@@ -280,6 +301,44 @@ export interface FetchRegionsParams {
280
301
  isActive?: boolean;
281
302
  }
282
303
 
304
+ // ----------------------------- Control-API Paginated -------------------------
305
+ export interface PaginatedParams {
306
+ page?: number; // 1-indexed
307
+ limit?: number; // max 100
308
+ }
309
+
310
+ export interface MintedEventsResponse {
311
+ page: number;
312
+ limit: number;
313
+ events: MintedEvent[];
314
+ }
315
+
316
+ export interface StakeEventsQuery extends PaginatedParams {
317
+ regionId?: number;
318
+ }
319
+
320
+ export interface StakeEventsResponse {
321
+ page: number;
322
+ limit: number;
323
+ events: StakedEvent[];
324
+ }
325
+
326
+ export interface PendingTransfersQuery extends PaginatedParams {
327
+ type?: PendingTransferType;
328
+ }
329
+
330
+ export interface PendingTransfersResponse {
331
+ page: number;
332
+ limit: number;
333
+ transfers: PendingTransfer[];
334
+ }
335
+
336
+ export interface FailedOperationsResponse {
337
+ page: number;
338
+ limit: number;
339
+ operations: FailedOperation[];
340
+ }
341
+
283
342
  // ----------------------------- Wallets --------------------------------------
284
343
  export interface ControlWallet {
285
344
  address: string;