@glowlabs-org/utils 0.2.135 → 0.2.139
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/browser.js +1 -1
- package/dist/cjs/constants/addresses.d.ts +1 -1
- package/dist/cjs/{farms-router-DQfM--mo.js → farms-router-D1kQ7pOC.js} +21 -21
- package/dist/cjs/farms-router-D1kQ7pOC.js.map +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/lib/control-api/control-router.d.ts +2 -1
- package/dist/cjs/lib/control-api/wallets-router.d.ts +1 -2
- package/dist/cjs/lib/types/index.d.ts +3 -3
- package/dist/esm/browser.js +2 -2
- package/dist/esm/constants/addresses.d.ts +1 -1
- package/dist/esm/{farms-router-COx2_plO.js → farms-router-9XHw3u2N.js} +21 -21
- package/dist/esm/farms-router-9XHw3u2N.js.map +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/lib/control-api/control-router.d.ts +2 -1
- package/dist/esm/lib/control-api/wallets-router.d.ts +1 -2
- package/dist/esm/lib/types/index.d.ts +3 -3
- package/package.json +1 -1
- package/src/constants/addresses.ts +10 -7
- package/src/lib/control-api/control-router.ts +14 -0
- package/src/lib/control-api/wallets-router.ts +1 -19
- package/src/lib/hooks/use-forwarder.ts +3 -13
- package/src/lib/types/index.ts +3 -3
- package/dist/cjs/farms-router-DQfM--mo.js.map +0 -1
- package/dist/esm/farms-router-COx2_plO.js.map +0 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type ContractKeys = "USDC" | "FORWARDER" | "FOUNDATION_WALLET" | "GLW" | "USDG" | "USDG_REDEMPTION" | "IMPACT_CATALYST" | "AUDIT_FEE_WALLET" | "UNISWAP_V2_ROUTER" | "UNISWAP_V2_FACTORY" | "USDG_UNISWAP" | "GLW_UNISWAP" | "OFFCHAIN_FRACTIONS" | "COUNTERFACTUAL_HOLDER_FACTORY" | "FOUNDATION_HUB_MANAGER_WALLET" | "FOUNDATION_REWARDS_WALLET";
|
|
1
|
+
export type ContractKeys = "USDC" | "FORWARDER" | "FOUNDATION_WALLET" | "GLW" | "USDG" | "USDG_REDEMPTION" | "IMPACT_CATALYST" | "AUDIT_FEE_WALLET" | "UNISWAP_V2_ROUTER" | "UNISWAP_V2_FACTORY" | "USDG_UNISWAP" | "GLW_UNISWAP" | "OFFCHAIN_FRACTIONS" | "COUNTERFACTUAL_HOLDER_FACTORY" | "FOUNDATION_HUB_MANAGER_WALLET" | "FOUNDATION_REWARDS_WALLET" | "ENDOWMENT_WALLET";
|
|
2
2
|
export declare const getAddresses: (CHAIN_ID: number) => Record<ContractKeys, `0x${string}`>;
|
|
3
3
|
export declare const DECIMALS_BY_TOKEN: Record<"USDC" | "USDG" | "GCTL" | "SGCTL" | "GLW", number>;
|
|
@@ -247,7 +247,7 @@ const ERC20_ABI = [
|
|
|
247
247
|
|
|
248
248
|
// Contract-specific addresses
|
|
249
249
|
const mainnetAddresses = {
|
|
250
|
-
AUDIT_FEE_WALLET: "0x3ff5af3333ddc6048d98849ec5e67868494693c9",
|
|
250
|
+
AUDIT_FEE_WALLET: "0x3ff5af3333ddc6048d98849ec5e67868494693c9", //aka GVE wallet
|
|
251
251
|
IMPACT_CATALYST: "0x552Fbb4E0269fd5036daf72Ec006AAF6C958F4Fa",
|
|
252
252
|
USDG_REDEMPTION: "0x1c2cA537757e1823400F857EdBe72B55bbAe0F08",
|
|
253
253
|
USDG: "0xe010ec500720bE9EF3F82129E7eD2Ee1FB7955F2",
|
|
@@ -255,14 +255,15 @@ const mainnetAddresses = {
|
|
|
255
255
|
USDC: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
256
256
|
USDG_UNISWAP: "0xe010ec500720bE9EF3F82129E7eD2Ee1FB7955F2",
|
|
257
257
|
GLW_UNISWAP: "0xf4fbC617A5733EAAF9af08E1Ab816B103388d8B6",
|
|
258
|
-
FORWARDER: "
|
|
259
|
-
OFFCHAIN_FRACTIONS: "
|
|
260
|
-
COUNTERFACTUAL_HOLDER_FACTORY: "
|
|
258
|
+
FORWARDER: "0x1519a8fE33acf8C164578789629146278541506A",
|
|
259
|
+
OFFCHAIN_FRACTIONS: "0x80EA852448c2807BeAe321deC7c603990209F7db",
|
|
260
|
+
COUNTERFACTUAL_HOLDER_FACTORY: "0x5bB7eC88cA80146FF47019079Cf0330532A1157F",
|
|
261
261
|
FOUNDATION_HUB_MANAGER_WALLET: "0x5252FdA14A149c01EA5A1D6514a9c1369E4C70b4", // TODO: change to mainnet address
|
|
262
|
-
FOUNDATION_WALLET: "
|
|
263
|
-
FOUNDATION_REWARDS_WALLET: "
|
|
262
|
+
FOUNDATION_WALLET: "0x77040BbBD506F5e5a7D65f6917416Bae6C78B9fa",
|
|
263
|
+
FOUNDATION_REWARDS_WALLET: "0x6972B05A0c80064fBE8a10CBc2a2FBCF6fb47D6a",
|
|
264
264
|
UNISWAP_V2_ROUTER: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
|
|
265
265
|
UNISWAP_V2_FACTORY: "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",
|
|
266
|
+
ENDOWMENT_WALLET: "0x868D99B4a6e81b4683D10ea5665f13579A9d1607",
|
|
266
267
|
};
|
|
267
268
|
const sepoliaAddresses = {
|
|
268
269
|
AUDIT_FEE_WALLET: "0x3ff5af3333ddc6048d98849ec5e67868494693c9",
|
|
@@ -281,6 +282,7 @@ const sepoliaAddresses = {
|
|
|
281
282
|
FOUNDATION_REWARDS_WALLET: "0x5252FdA14A149c01EA5A1D6514a9c1369E4C70b4",
|
|
282
283
|
UNISWAP_V2_ROUTER: "0xeE567Fe1712Faf6149d80dA1E6934E354124CfE3",
|
|
283
284
|
UNISWAP_V2_FACTORY: "0xF62c03E08ada871A0bEb309762E260a7a6a880E6",
|
|
285
|
+
ENDOWMENT_WALLET: "0x868D99B4a6e81b4683D10ea5665f13579A9d1607",
|
|
284
286
|
};
|
|
285
287
|
const getAddresses = (CHAIN_ID) => {
|
|
286
288
|
switch (CHAIN_ID) {
|
|
@@ -547,7 +549,7 @@ function useForwarder(signer, CHAIN_ID) {
|
|
|
547
549
|
throw new Error(`Unsupported currency for forwarding: ${currency}`);
|
|
548
550
|
}
|
|
549
551
|
// Determine sendToCounterfactualWallet based on currency
|
|
550
|
-
const sendToCounterfactualWallet =
|
|
552
|
+
const sendToCounterfactualWallet = true;
|
|
551
553
|
// Run a static call first to surface any revert reason (ethers v6)
|
|
552
554
|
try {
|
|
553
555
|
if (!isAuditFees && currency === "USDC") {
|
|
@@ -741,8 +743,6 @@ function useForwarder(signer, CHAIN_ID) {
|
|
|
741
743
|
}
|
|
742
744
|
// Construct the appropriate message for this forward type
|
|
743
745
|
const message = constructForwardMessage(params);
|
|
744
|
-
// Determine sendToCounterfactualWallet based on currency
|
|
745
|
-
const sendToCounterfactualWallet = currency === "GLW" || currency === "USDG";
|
|
746
746
|
// Get token address
|
|
747
747
|
let tokenAddress;
|
|
748
748
|
switch (currency) {
|
|
@@ -766,12 +766,12 @@ function useForwarder(signer, CHAIN_ID) {
|
|
|
766
766
|
const estimatedGas = !isAuditFees && currency === "USDC"
|
|
767
767
|
? await forwarderContract
|
|
768
768
|
.getFunction("swapUSDCAndForwardUSDG")
|
|
769
|
-
.estimateGas(amount, ADDRESSES.FOUNDATION_WALLET,
|
|
769
|
+
.estimateGas(amount, ADDRESSES.FOUNDATION_WALLET, true, message)
|
|
770
770
|
: await forwarderContract
|
|
771
771
|
.getFunction("forward")
|
|
772
772
|
.estimateGas(tokenAddress, isAuditFees
|
|
773
773
|
? ADDRESSES.AUDIT_FEE_WALLET
|
|
774
|
-
: ADDRESSES.FOUNDATION_WALLET, amount,
|
|
774
|
+
: ADDRESSES.FOUNDATION_WALLET, amount, true, message);
|
|
775
775
|
const estimatedCost = estimatedGas * gasPrice;
|
|
776
776
|
if (ethPriceInUSD) {
|
|
777
777
|
const estimatedCostInEth = viem.formatEther(estimatedCost);
|
|
@@ -2486,6 +2486,14 @@ function ControlRouter(baseUrl) {
|
|
|
2486
2486
|
isMigratingUser = false;
|
|
2487
2487
|
}
|
|
2488
2488
|
};
|
|
2489
|
+
const fetchMigrationAmount = async (wallet) => {
|
|
2490
|
+
try {
|
|
2491
|
+
return await request(`/migration-amount/${encodeURIComponent(wallet)}`);
|
|
2492
|
+
}
|
|
2493
|
+
catch (error) {
|
|
2494
|
+
throw new Error(parseApiError$4(error));
|
|
2495
|
+
}
|
|
2496
|
+
};
|
|
2489
2497
|
// --------------------------- Public API ----------------------------------
|
|
2490
2498
|
return {
|
|
2491
2499
|
// Queries
|
|
@@ -2505,6 +2513,7 @@ function ControlRouter(baseUrl) {
|
|
|
2505
2513
|
fetchWalletRegionCommittedBalance,
|
|
2506
2514
|
fetchTransferDetails: getTransferDetails,
|
|
2507
2515
|
fetchGlwRegionRewards,
|
|
2516
|
+
fetchMigrationAmount,
|
|
2508
2517
|
// Mutations
|
|
2509
2518
|
stakeGctl,
|
|
2510
2519
|
unstakeGctl,
|
|
@@ -3558,20 +3567,11 @@ function WalletsRouter(baseUrl) {
|
|
|
3558
3567
|
throw new Error(parseApiError$1(error));
|
|
3559
3568
|
}
|
|
3560
3569
|
};
|
|
3561
|
-
const fetchMigrationAmount = async (wallet) => {
|
|
3562
|
-
try {
|
|
3563
|
-
return await request(`/wallets/migration-amount/${encodeURIComponent(wallet)}`);
|
|
3564
|
-
}
|
|
3565
|
-
catch (error) {
|
|
3566
|
-
throw new Error(parseApiError$1(error));
|
|
3567
|
-
}
|
|
3568
|
-
};
|
|
3569
3570
|
return {
|
|
3570
3571
|
fetchAllWallets,
|
|
3571
3572
|
fetchWalletByAddress,
|
|
3572
3573
|
fetchWalletMintedEvents,
|
|
3573
3574
|
fetchWalletStakeEvents,
|
|
3574
|
-
fetchMigrationAmount,
|
|
3575
3575
|
};
|
|
3576
3576
|
}
|
|
3577
3577
|
|
|
@@ -3719,4 +3719,4 @@ exports.regionMetadata = regionMetadata;
|
|
|
3719
3719
|
exports.usStates = usStates;
|
|
3720
3720
|
exports.useForwarder = useForwarder;
|
|
3721
3721
|
exports.useOffchainFractions = useOffchainFractions;
|
|
3722
|
-
//# sourceMappingURL=farms-router-
|
|
3722
|
+
//# sourceMappingURL=farms-router-D1kQ7pOC.js.map
|