@glowlabs-org/utils 0.2.59 → 0.2.60
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.d.ts +1 -0
- package/dist/cjs/browser.js +19 -18
- package/dist/cjs/browser.js.map +1 -1
- package/dist/cjs/index.js +34 -127
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/{region-router-B_O_Q0Ea.js → kickstarter-router-BwCv043v.js} +120 -26
- package/dist/cjs/kickstarter-router-BwCv043v.js.map +1 -0
- package/dist/esm/browser.d.ts +1 -0
- package/dist/esm/browser.js +1 -1
- package/dist/esm/index.js +3 -96
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/{region-router-D8fhG-fI.js → kickstarter-router-CVAvqB41.js} +120 -27
- package/dist/esm/kickstarter-router-CVAvqB41.js.map +1 -0
- package/package.json +1 -1
- package/src/browser.ts +1 -0
- package/dist/cjs/region-router-B_O_Q0Ea.js.map +0 -1
- package/dist/esm/region-router-D8fhG-fI.js.map +0 -1
|
@@ -712,7 +712,7 @@ function useForwarder(signer, CHAIN_ID) {
|
|
|
712
712
|
/**
|
|
713
713
|
* Extract a useful error message from an unknown error value.
|
|
714
714
|
*/
|
|
715
|
-
function parseApiError$
|
|
715
|
+
function parseApiError$2(error) {
|
|
716
716
|
if (!error)
|
|
717
717
|
return "Unknown error";
|
|
718
718
|
if (error instanceof Error)
|
|
@@ -740,7 +740,7 @@ function ControlRouter(baseUrl) {
|
|
|
740
740
|
return (data?.gctl_balance ?? "0").toString();
|
|
741
741
|
}
|
|
742
742
|
catch (error) {
|
|
743
|
-
throw new Error(parseApiError$
|
|
743
|
+
throw new Error(parseApiError$2(error));
|
|
744
744
|
}
|
|
745
745
|
};
|
|
746
746
|
const fetchGctlPrice = async () => {
|
|
@@ -749,7 +749,7 @@ function ControlRouter(baseUrl) {
|
|
|
749
749
|
return data.currentPriceUsdc;
|
|
750
750
|
}
|
|
751
751
|
catch (error) {
|
|
752
|
-
throw new Error(parseApiError$
|
|
752
|
+
throw new Error(parseApiError$2(error));
|
|
753
753
|
}
|
|
754
754
|
};
|
|
755
755
|
const fetchGlwPrice = async () => {
|
|
@@ -758,7 +758,7 @@ function ControlRouter(baseUrl) {
|
|
|
758
758
|
return data.currentPriceUsdc;
|
|
759
759
|
}
|
|
760
760
|
catch (error) {
|
|
761
|
-
throw new Error(parseApiError$
|
|
761
|
+
throw new Error(parseApiError$2(error));
|
|
762
762
|
}
|
|
763
763
|
};
|
|
764
764
|
const fetchLastNonce = async (wallet) => {
|
|
@@ -767,7 +767,7 @@ function ControlRouter(baseUrl) {
|
|
|
767
767
|
return data.lastNonce;
|
|
768
768
|
}
|
|
769
769
|
catch (error) {
|
|
770
|
-
throw new Error(parseApiError$
|
|
770
|
+
throw new Error(parseApiError$2(error));
|
|
771
771
|
}
|
|
772
772
|
};
|
|
773
773
|
const fetchCirculatingSupply = async () => {
|
|
@@ -776,7 +776,7 @@ function ControlRouter(baseUrl) {
|
|
|
776
776
|
return data.circulatingSupply;
|
|
777
777
|
}
|
|
778
778
|
catch (error) {
|
|
779
|
-
throw new Error(parseApiError$
|
|
779
|
+
throw new Error(parseApiError$2(error));
|
|
780
780
|
}
|
|
781
781
|
};
|
|
782
782
|
// Build pagination query helper
|
|
@@ -791,7 +791,7 @@ function ControlRouter(baseUrl) {
|
|
|
791
791
|
return data.events ?? [];
|
|
792
792
|
}
|
|
793
793
|
catch (error) {
|
|
794
|
-
throw new Error(parseApiError$
|
|
794
|
+
throw new Error(parseApiError$2(error));
|
|
795
795
|
}
|
|
796
796
|
};
|
|
797
797
|
const fetchStakeEvents = async (page, limit, regionId) => {
|
|
@@ -802,7 +802,7 @@ function ControlRouter(baseUrl) {
|
|
|
802
802
|
return data.events ?? [];
|
|
803
803
|
}
|
|
804
804
|
catch (error) {
|
|
805
|
-
throw new Error(parseApiError$
|
|
805
|
+
throw new Error(parseApiError$2(error));
|
|
806
806
|
}
|
|
807
807
|
};
|
|
808
808
|
const fetchPendingTransfers = async (page, limit) => {
|
|
@@ -811,7 +811,7 @@ function ControlRouter(baseUrl) {
|
|
|
811
811
|
return data.transfers ?? [];
|
|
812
812
|
}
|
|
813
813
|
catch (error) {
|
|
814
|
-
throw new Error(parseApiError$
|
|
814
|
+
throw new Error(parseApiError$2(error));
|
|
815
815
|
}
|
|
816
816
|
};
|
|
817
817
|
const fetchTransferDetails = async (txId) => {
|
|
@@ -819,7 +819,7 @@ function ControlRouter(baseUrl) {
|
|
|
819
819
|
return await request(`/transfer/${txId}`);
|
|
820
820
|
}
|
|
821
821
|
catch (error) {
|
|
822
|
-
throw new Error(parseApiError$
|
|
822
|
+
throw new Error(parseApiError$2(error));
|
|
823
823
|
}
|
|
824
824
|
};
|
|
825
825
|
const fetchFailedOperations = async (page, limit) => {
|
|
@@ -828,7 +828,7 @@ function ControlRouter(baseUrl) {
|
|
|
828
828
|
return data.operations ?? [];
|
|
829
829
|
}
|
|
830
830
|
catch (error) {
|
|
831
|
-
throw new Error(parseApiError$
|
|
831
|
+
throw new Error(parseApiError$2(error));
|
|
832
832
|
}
|
|
833
833
|
};
|
|
834
834
|
// Exposed query with error parsing
|
|
@@ -837,7 +837,7 @@ function ControlRouter(baseUrl) {
|
|
|
837
837
|
return await fetchTransferDetails(txId);
|
|
838
838
|
}
|
|
839
839
|
catch (error) {
|
|
840
|
-
throw new Error(parseApiError$
|
|
840
|
+
throw new Error(parseApiError$2(error));
|
|
841
841
|
}
|
|
842
842
|
};
|
|
843
843
|
const fetchRegionStake = async (regionId) => {
|
|
@@ -845,7 +845,7 @@ function ControlRouter(baseUrl) {
|
|
|
845
845
|
return await request(`/region/${regionId}/stake`);
|
|
846
846
|
}
|
|
847
847
|
catch (error) {
|
|
848
|
-
throw new Error(parseApiError$
|
|
848
|
+
throw new Error(parseApiError$2(error));
|
|
849
849
|
}
|
|
850
850
|
};
|
|
851
851
|
const fetchWalletRegionStake = async (wallet, regionId) => {
|
|
@@ -853,7 +853,7 @@ function ControlRouter(baseUrl) {
|
|
|
853
853
|
return await request(`/wallet/${wallet}/region/${regionId}/stake`);
|
|
854
854
|
}
|
|
855
855
|
catch (error) {
|
|
856
|
-
throw new Error(parseApiError$
|
|
856
|
+
throw new Error(parseApiError$2(error));
|
|
857
857
|
}
|
|
858
858
|
};
|
|
859
859
|
const fetchWalletRegionUnlocked = async (wallet, regionId) => {
|
|
@@ -861,7 +861,7 @@ function ControlRouter(baseUrl) {
|
|
|
861
861
|
return await request(`/wallet/${wallet}/region/${regionId}/unlocked`);
|
|
862
862
|
}
|
|
863
863
|
catch (error) {
|
|
864
|
-
throw new Error(parseApiError$
|
|
864
|
+
throw new Error(parseApiError$2(error));
|
|
865
865
|
}
|
|
866
866
|
};
|
|
867
867
|
// ----------------------- Mutations ---------------------------------------
|
|
@@ -879,7 +879,7 @@ function ControlRouter(baseUrl) {
|
|
|
879
879
|
return true;
|
|
880
880
|
}
|
|
881
881
|
catch (error) {
|
|
882
|
-
throw new Error(parseApiError$
|
|
882
|
+
throw new Error(parseApiError$2(error));
|
|
883
883
|
}
|
|
884
884
|
finally {
|
|
885
885
|
isStaking = false;
|
|
@@ -896,7 +896,7 @@ function ControlRouter(baseUrl) {
|
|
|
896
896
|
return true;
|
|
897
897
|
}
|
|
898
898
|
catch (error) {
|
|
899
|
-
throw new Error(parseApiError$
|
|
899
|
+
throw new Error(parseApiError$2(error));
|
|
900
900
|
}
|
|
901
901
|
finally {
|
|
902
902
|
isUnstaking = false;
|
|
@@ -912,7 +912,7 @@ function ControlRouter(baseUrl) {
|
|
|
912
912
|
return true;
|
|
913
913
|
}
|
|
914
914
|
catch (error) {
|
|
915
|
-
throw new Error(parseApiError$
|
|
915
|
+
throw new Error(parseApiError$2(error));
|
|
916
916
|
}
|
|
917
917
|
finally {
|
|
918
918
|
isRetryingFailedOperation = false;
|
|
@@ -1634,7 +1634,7 @@ const countries = allRegions.filter((r) => !r.isUs);
|
|
|
1634
1634
|
// ---------------------------------------------------------------------------
|
|
1635
1635
|
// Helpers
|
|
1636
1636
|
// ---------------------------------------------------------------------------
|
|
1637
|
-
function parseApiError(error) {
|
|
1637
|
+
function parseApiError$1(error) {
|
|
1638
1638
|
if (!error)
|
|
1639
1639
|
return "Unknown error";
|
|
1640
1640
|
if (error instanceof Error)
|
|
@@ -1676,7 +1676,7 @@ function RegionRouter(baseUrl) {
|
|
|
1676
1676
|
return cachedRegions;
|
|
1677
1677
|
}
|
|
1678
1678
|
catch (error) {
|
|
1679
|
-
throw new Error(parseApiError(error));
|
|
1679
|
+
throw new Error(parseApiError$1(error));
|
|
1680
1680
|
}
|
|
1681
1681
|
finally {
|
|
1682
1682
|
isLoading = false;
|
|
@@ -1687,7 +1687,7 @@ function RegionRouter(baseUrl) {
|
|
|
1687
1687
|
return await request(`/regions/activation-config?code=${regionCode}`);
|
|
1688
1688
|
}
|
|
1689
1689
|
catch (error) {
|
|
1690
|
-
throw new Error(parseApiError(error));
|
|
1690
|
+
throw new Error(parseApiError$1(error));
|
|
1691
1691
|
}
|
|
1692
1692
|
};
|
|
1693
1693
|
const fetchActivationEvents = async (regionId) => {
|
|
@@ -1697,7 +1697,7 @@ function RegionRouter(baseUrl) {
|
|
|
1697
1697
|
return data.events ?? [];
|
|
1698
1698
|
}
|
|
1699
1699
|
catch (error) {
|
|
1700
|
-
throw new Error(parseApiError(error));
|
|
1700
|
+
throw new Error(parseApiError$1(error));
|
|
1701
1701
|
}
|
|
1702
1702
|
};
|
|
1703
1703
|
const fetchRegionByIdOrSlug = async (idOrSlug) => {
|
|
@@ -1706,7 +1706,7 @@ function RegionRouter(baseUrl) {
|
|
|
1706
1706
|
return data.region;
|
|
1707
1707
|
}
|
|
1708
1708
|
catch (error) {
|
|
1709
|
-
throw new Error(parseApiError(error));
|
|
1709
|
+
throw new Error(parseApiError$1(error));
|
|
1710
1710
|
}
|
|
1711
1711
|
};
|
|
1712
1712
|
const fetchRegionSolarFarms = async (regionId) => {
|
|
@@ -1715,7 +1715,7 @@ function RegionRouter(baseUrl) {
|
|
|
1715
1715
|
return data.sponsoredFarms ?? [];
|
|
1716
1716
|
}
|
|
1717
1717
|
catch (error) {
|
|
1718
|
-
throw new Error(parseApiError(error));
|
|
1718
|
+
throw new Error(parseApiError$1(error));
|
|
1719
1719
|
}
|
|
1720
1720
|
};
|
|
1721
1721
|
// -------------------------------------------------------------------------
|
|
@@ -1733,7 +1733,7 @@ function RegionRouter(baseUrl) {
|
|
|
1733
1733
|
await fetchRegions();
|
|
1734
1734
|
}
|
|
1735
1735
|
catch (error) {
|
|
1736
|
-
throw new Error(parseApiError(error));
|
|
1736
|
+
throw new Error(parseApiError$1(error));
|
|
1737
1737
|
}
|
|
1738
1738
|
finally {
|
|
1739
1739
|
isCreatingRegion = false;
|
|
@@ -1801,5 +1801,98 @@ function RegionRouter(baseUrl) {
|
|
|
1801
1801
|
};
|
|
1802
1802
|
}
|
|
1803
1803
|
|
|
1804
|
-
|
|
1805
|
-
|
|
1804
|
+
function parseApiError(error) {
|
|
1805
|
+
if (!error)
|
|
1806
|
+
return "Unknown error";
|
|
1807
|
+
if (error instanceof Error)
|
|
1808
|
+
return error.message;
|
|
1809
|
+
const possible = error;
|
|
1810
|
+
return possible?.error?.message ?? possible?.message ?? "Unknown error";
|
|
1811
|
+
}
|
|
1812
|
+
function KickstarterRouter(baseUrl) {
|
|
1813
|
+
if (!baseUrl)
|
|
1814
|
+
throw new Error("CONTROL API base URL is not set");
|
|
1815
|
+
const request = async (path, init) => {
|
|
1816
|
+
const res = await fetch(`${baseUrl}${path}`, init);
|
|
1817
|
+
if (!res.ok) {
|
|
1818
|
+
const errData = await res.json().catch(() => ({}));
|
|
1819
|
+
throw new Error(errData?.error || `Request to ${path} failed`);
|
|
1820
|
+
}
|
|
1821
|
+
return (await res.json());
|
|
1822
|
+
};
|
|
1823
|
+
let isCreatingKickstarter = false;
|
|
1824
|
+
const fetchKickstarters = async () => {
|
|
1825
|
+
try {
|
|
1826
|
+
const data = await request(`/kickstarters`);
|
|
1827
|
+
return data.kickstarters ?? [];
|
|
1828
|
+
}
|
|
1829
|
+
catch (error) {
|
|
1830
|
+
throw new Error(parseApiError(error));
|
|
1831
|
+
}
|
|
1832
|
+
};
|
|
1833
|
+
const createKickstarter = async (payload) => {
|
|
1834
|
+
isCreatingKickstarter = true;
|
|
1835
|
+
try {
|
|
1836
|
+
const exists = Boolean(regionMetadata[payload.code]);
|
|
1837
|
+
if (!exists) {
|
|
1838
|
+
throw new Error(`Unknown region code: ${payload.code}`);
|
|
1839
|
+
}
|
|
1840
|
+
const data = await request(`/kickstarters`, {
|
|
1841
|
+
method: "POST",
|
|
1842
|
+
headers: { "Content-Type": "application/json" },
|
|
1843
|
+
body: JSON.stringify(payload),
|
|
1844
|
+
});
|
|
1845
|
+
return data;
|
|
1846
|
+
}
|
|
1847
|
+
catch (error) {
|
|
1848
|
+
throw new Error(parseApiError(error));
|
|
1849
|
+
}
|
|
1850
|
+
finally {
|
|
1851
|
+
isCreatingKickstarter = false;
|
|
1852
|
+
}
|
|
1853
|
+
};
|
|
1854
|
+
const fetchKickstarter = async (idOrSlug) => {
|
|
1855
|
+
try {
|
|
1856
|
+
const data = await request(`/kickstarters/${encodeURIComponent(idOrSlug)}`);
|
|
1857
|
+
return data.kickstarter;
|
|
1858
|
+
}
|
|
1859
|
+
catch (error) {
|
|
1860
|
+
throw new Error(parseApiError(error));
|
|
1861
|
+
}
|
|
1862
|
+
};
|
|
1863
|
+
const fetchKickstartersByWallet = async (wallet) => {
|
|
1864
|
+
try {
|
|
1865
|
+
const data = await request(`/kickstarters/by-wallet/${encodeURIComponent(wallet)}`);
|
|
1866
|
+
return data.kickstarters ?? [];
|
|
1867
|
+
}
|
|
1868
|
+
catch (error) {
|
|
1869
|
+
throw new Error(parseApiError(error));
|
|
1870
|
+
}
|
|
1871
|
+
};
|
|
1872
|
+
const commitKickstarter = async (kickstarterId, payload) => {
|
|
1873
|
+
try {
|
|
1874
|
+
const data = await request(`/kickstarters/commit/${encodeURIComponent(kickstarterId)}`, {
|
|
1875
|
+
method: "POST",
|
|
1876
|
+
headers: { "Content-Type": "application/json" },
|
|
1877
|
+
body: JSON.stringify(payload),
|
|
1878
|
+
});
|
|
1879
|
+
return data;
|
|
1880
|
+
}
|
|
1881
|
+
catch (error) {
|
|
1882
|
+
throw new Error(parseApiError(error));
|
|
1883
|
+
}
|
|
1884
|
+
};
|
|
1885
|
+
return {
|
|
1886
|
+
fetchKickstarters,
|
|
1887
|
+
fetchKickstarter,
|
|
1888
|
+
fetchKickstartersByWallet,
|
|
1889
|
+
commitKickstarter,
|
|
1890
|
+
createKickstarter,
|
|
1891
|
+
get isCreatingKickstarter() {
|
|
1892
|
+
return isCreatingKickstarter;
|
|
1893
|
+
},
|
|
1894
|
+
};
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1897
|
+
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, 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 };
|
|
1898
|
+
//# sourceMappingURL=kickstarter-router-CVAvqB41.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kickstarter-router-CVAvqB41.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"],"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: \"0x0000000000000000000000000000000000000000\", // TODO: Update with actual mainnet address\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 MintedEvent,\n StakedEvent,\n PendingTransfer,\n FailedOperation,\n GctlPrice,\n StakeRequest,\n RegionStake,\n WalletRegionStake,\n WalletRegionUnlocked,\n TransferDetails,\n GlwPrice,\n WalletNonce,\n GctlSupply,\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<MintedEvent[]> => {\n try {\n const data = await request<{ events: MintedEvent[] }>(\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 fetchStakeEvents = async (\n page?: number,\n limit?: number,\n regionId?: number\n ): Promise<StakedEvent[]> => {\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<{ events: StakedEvent[] }>(query);\n return data.events ?? [];\n } catch (error) {\n throw new Error(parseApiError(error));\n }\n };\n\n const fetchPendingTransfers = async (\n page?: number,\n limit?: number\n ): Promise<PendingTransfer[]> => {\n try {\n const data = await request<{ transfers: PendingTransfer[] }>(\n `/transfers/pending${buildPaginationQuery(page, limit)}`\n );\n\n return data.transfers ?? [];\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<FailedOperation[]> => {\n try {\n const data = await request<{ operations: FailedOperation[] }>(\n `/operations/failed${buildPaginationQuery(page, limit)}`\n );\n return data.operations ?? [];\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 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 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 retryFailedOperation,\n\n // Processing flags\n get isStaking() {\n return isStaking;\n },\n get isUnstaking() {\n return isUnstaking;\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"],"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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,CAAC,CAAA,CAAE,EAC3D;AACE,gBAAA,MAAM,EAAE,MAAM;AACd,gBAAA,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;AAC/C,gBAAA,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;AAC9B,aAAA,CACF;AACD,YAAA,OAAO,IAAI;QACb;QAAE,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACvC;AACF,IAAA,CAAC;IAED,OAAO;QACL,iBAAiB;QACjB,gBAAgB;QAChB,yBAAyB;QACzB,iBAAiB;QACjB,iBAAiB;AACjB,QAAA,IAAI,qBAAqB,GAAA;AACvB,YAAA,OAAO,qBAAqB;QAC9B,CAAC;KACO;AACZ;;;;"}
|
package/package.json
CHANGED
package/src/browser.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./lib/hooks/use-forwarder";
|
|
2
2
|
export * from "./lib/control-api/control-router";
|
|
3
3
|
export * from "./lib/control-api/region-router";
|
|
4
|
+
export * from "./lib/control-api/kickstarter-router";
|
|
4
5
|
export * from "./lib/types";
|
|
5
6
|
export * from "./lib/region-metadata";
|
|
6
7
|
export * from "./lib/abis/forwarderABI";
|