@glowlabs-org/utils 0.2.137 → 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-BFFs_D4v.js → farms-router-D1kQ7pOC.js} +12 -12
- package/dist/cjs/farms-router-D1kQ7pOC.js.map +1 -0
- package/dist/cjs/index.js +1 -1
- 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-C1WmJIpM.js → farms-router-9XHw3u2N.js} +12 -12
- package/dist/esm/farms-router-9XHw3u2N.js.map +1 -0
- package/dist/esm/index.js +2 -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/hooks/use-forwarder.ts +3 -13
- package/src/lib/types/index.ts +3 -3
- package/dist/cjs/farms-router-BFFs_D4v.js.map +0 -1
- package/dist/esm/farms-router-C1WmJIpM.js.map +0 -1
package/dist/cjs/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var viem = require('viem');
|
|
|
15
15
|
var merkletreejs = require('merkletreejs');
|
|
16
16
|
var ethers = require('ethers');
|
|
17
17
|
var Decimal = require('decimal.js');
|
|
18
|
-
var farmsRouter = require('./farms-router-
|
|
18
|
+
var farmsRouter = require('./farms-router-D1kQ7pOC.js');
|
|
19
19
|
|
|
20
20
|
const GENESIS_TIMESTAMP = 1700352000;
|
|
21
21
|
|
|
@@ -278,7 +278,7 @@ export interface SponsoredFarm {
|
|
|
278
278
|
certifiedInstallerId: string | null;
|
|
279
279
|
kwhCapacity: string;
|
|
280
280
|
solarPanelsQuantity: number;
|
|
281
|
-
|
|
281
|
+
expectedWeeklyCarbonCredits: string;
|
|
282
282
|
protocolDepositUSDC6Decimals: string;
|
|
283
283
|
protocolDepositPaidAmount: string;
|
|
284
284
|
protocolDepositPaidCurrency: string;
|
|
@@ -400,7 +400,7 @@ export interface WalletFarmInfo {
|
|
|
400
400
|
location: string;
|
|
401
401
|
kwhCapacity: string;
|
|
402
402
|
solarPanelsQuantity: number;
|
|
403
|
-
|
|
403
|
+
expectedWeeklyCarbonCredits: string;
|
|
404
404
|
protocolDepositPaidAmount: string;
|
|
405
405
|
protocolDepositPaidCurrency: string;
|
|
406
406
|
builtEpoch: number;
|
|
@@ -420,7 +420,7 @@ export interface EstimateRewardScoreParams {
|
|
|
420
420
|
sponsorSplitPercent: number;
|
|
421
421
|
protocolDepositAmount: string;
|
|
422
422
|
paymentCurrency: PaymentCurrency;
|
|
423
|
-
|
|
423
|
+
expectedWeeklyCarbonCredits: number;
|
|
424
424
|
regionId: number;
|
|
425
425
|
}
|
|
426
426
|
export interface RewardScoreResponse {
|
package/dist/esm/browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TRANSFER_TYPES } from './farms-router-
|
|
2
|
-
export { C as ControlRouter, D as DECIMALS_BY_TOKEN, i as FORWARDER_ABI, F as FarmsRouter, d as ForwarderError, l as GCA_URLS, G as GLOW_WEIGHT_DECIMAL_PRECISION, H as HUB_URL, c as KICKSTARTER_STATUS, K as KickstarterRouter, M as MAX_WEIGHT, j as OFFCHAIN_FRACTIONS_ABI, O as OFF_CHAIN_PAYMENT_CURRENCIES, e as OffchainFractionsError, P as PAYMENT_CURRENCIES, b as REGIONS, R as RegionRouter, S as STAKING_DIRECTIONS, U as USDG_WEIGHT_DECIMAL_PRECISION, W as WalletsRouter, f as allRegions, h as countries, k as getAddresses, r as regionMetadata, g as usStates, u as useForwarder, a as useOffchainFractions } from './farms-router-
|
|
1
|
+
import { T as TRANSFER_TYPES } from './farms-router-9XHw3u2N.js';
|
|
2
|
+
export { C as ControlRouter, D as DECIMALS_BY_TOKEN, i as FORWARDER_ABI, F as FarmsRouter, d as ForwarderError, l as GCA_URLS, G as GLOW_WEIGHT_DECIMAL_PRECISION, H as HUB_URL, c as KICKSTARTER_STATUS, K as KickstarterRouter, M as MAX_WEIGHT, j as OFFCHAIN_FRACTIONS_ABI, O as OFF_CHAIN_PAYMENT_CURRENCIES, e as OffchainFractionsError, P as PAYMENT_CURRENCIES, b as REGIONS, R as RegionRouter, S as STAKING_DIRECTIONS, U as USDG_WEIGHT_DECIMAL_PRECISION, W as WalletsRouter, f as allRegions, h as countries, k as getAddresses, r as regionMetadata, g as usStates, u as useForwarder, a as useOffchainFractions } from './farms-router-9XHw3u2N.js';
|
|
3
3
|
import { verifyTypedData, checksumAddress } from 'viem';
|
|
4
4
|
import 'ethers';
|
|
5
5
|
|
|
@@ -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>;
|
|
@@ -245,7 +245,7 @@ const ERC20_ABI = [
|
|
|
245
245
|
|
|
246
246
|
// Contract-specific addresses
|
|
247
247
|
const mainnetAddresses = {
|
|
248
|
-
AUDIT_FEE_WALLET: "0x3ff5af3333ddc6048d98849ec5e67868494693c9",
|
|
248
|
+
AUDIT_FEE_WALLET: "0x3ff5af3333ddc6048d98849ec5e67868494693c9", //aka GVE wallet
|
|
249
249
|
IMPACT_CATALYST: "0x552Fbb4E0269fd5036daf72Ec006AAF6C958F4Fa",
|
|
250
250
|
USDG_REDEMPTION: "0x1c2cA537757e1823400F857EdBe72B55bbAe0F08",
|
|
251
251
|
USDG: "0xe010ec500720bE9EF3F82129E7eD2Ee1FB7955F2",
|
|
@@ -253,14 +253,15 @@ const mainnetAddresses = {
|
|
|
253
253
|
USDC: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
254
254
|
USDG_UNISWAP: "0xe010ec500720bE9EF3F82129E7eD2Ee1FB7955F2",
|
|
255
255
|
GLW_UNISWAP: "0xf4fbC617A5733EAAF9af08E1Ab816B103388d8B6",
|
|
256
|
-
FORWARDER: "
|
|
257
|
-
OFFCHAIN_FRACTIONS: "
|
|
258
|
-
COUNTERFACTUAL_HOLDER_FACTORY: "
|
|
256
|
+
FORWARDER: "0x1519a8fE33acf8C164578789629146278541506A",
|
|
257
|
+
OFFCHAIN_FRACTIONS: "0x80EA852448c2807BeAe321deC7c603990209F7db",
|
|
258
|
+
COUNTERFACTUAL_HOLDER_FACTORY: "0x5bB7eC88cA80146FF47019079Cf0330532A1157F",
|
|
259
259
|
FOUNDATION_HUB_MANAGER_WALLET: "0x5252FdA14A149c01EA5A1D6514a9c1369E4C70b4", // TODO: change to mainnet address
|
|
260
|
-
FOUNDATION_WALLET: "
|
|
261
|
-
FOUNDATION_REWARDS_WALLET: "
|
|
260
|
+
FOUNDATION_WALLET: "0x77040BbBD506F5e5a7D65f6917416Bae6C78B9fa",
|
|
261
|
+
FOUNDATION_REWARDS_WALLET: "0x6972B05A0c80064fBE8a10CBc2a2FBCF6fb47D6a",
|
|
262
262
|
UNISWAP_V2_ROUTER: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
|
|
263
263
|
UNISWAP_V2_FACTORY: "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",
|
|
264
|
+
ENDOWMENT_WALLET: "0x868D99B4a6e81b4683D10ea5665f13579A9d1607",
|
|
264
265
|
};
|
|
265
266
|
const sepoliaAddresses = {
|
|
266
267
|
AUDIT_FEE_WALLET: "0x3ff5af3333ddc6048d98849ec5e67868494693c9",
|
|
@@ -279,6 +280,7 @@ const sepoliaAddresses = {
|
|
|
279
280
|
FOUNDATION_REWARDS_WALLET: "0x5252FdA14A149c01EA5A1D6514a9c1369E4C70b4",
|
|
280
281
|
UNISWAP_V2_ROUTER: "0xeE567Fe1712Faf6149d80dA1E6934E354124CfE3",
|
|
281
282
|
UNISWAP_V2_FACTORY: "0xF62c03E08ada871A0bEb309762E260a7a6a880E6",
|
|
283
|
+
ENDOWMENT_WALLET: "0x868D99B4a6e81b4683D10ea5665f13579A9d1607",
|
|
282
284
|
};
|
|
283
285
|
const getAddresses = (CHAIN_ID) => {
|
|
284
286
|
switch (CHAIN_ID) {
|
|
@@ -545,7 +547,7 @@ function useForwarder(signer, CHAIN_ID) {
|
|
|
545
547
|
throw new Error(`Unsupported currency for forwarding: ${currency}`);
|
|
546
548
|
}
|
|
547
549
|
// Determine sendToCounterfactualWallet based on currency
|
|
548
|
-
const sendToCounterfactualWallet =
|
|
550
|
+
const sendToCounterfactualWallet = true;
|
|
549
551
|
// Run a static call first to surface any revert reason (ethers v6)
|
|
550
552
|
try {
|
|
551
553
|
if (!isAuditFees && currency === "USDC") {
|
|
@@ -739,8 +741,6 @@ function useForwarder(signer, CHAIN_ID) {
|
|
|
739
741
|
}
|
|
740
742
|
// Construct the appropriate message for this forward type
|
|
741
743
|
const message = constructForwardMessage(params);
|
|
742
|
-
// Determine sendToCounterfactualWallet based on currency
|
|
743
|
-
const sendToCounterfactualWallet = currency === "GLW" || currency === "USDG";
|
|
744
744
|
// Get token address
|
|
745
745
|
let tokenAddress;
|
|
746
746
|
switch (currency) {
|
|
@@ -764,12 +764,12 @@ function useForwarder(signer, CHAIN_ID) {
|
|
|
764
764
|
const estimatedGas = !isAuditFees && currency === "USDC"
|
|
765
765
|
? await forwarderContract
|
|
766
766
|
.getFunction("swapUSDCAndForwardUSDG")
|
|
767
|
-
.estimateGas(amount, ADDRESSES.FOUNDATION_WALLET,
|
|
767
|
+
.estimateGas(amount, ADDRESSES.FOUNDATION_WALLET, true, message)
|
|
768
768
|
: await forwarderContract
|
|
769
769
|
.getFunction("forward")
|
|
770
770
|
.estimateGas(tokenAddress, isAuditFees
|
|
771
771
|
? ADDRESSES.AUDIT_FEE_WALLET
|
|
772
|
-
: ADDRESSES.FOUNDATION_WALLET, amount,
|
|
772
|
+
: ADDRESSES.FOUNDATION_WALLET, amount, true, message);
|
|
773
773
|
const estimatedCost = estimatedGas * gasPrice;
|
|
774
774
|
if (ethPriceInUSD) {
|
|
775
775
|
const estimatedCostInEth = formatEther(estimatedCost);
|
|
@@ -3695,4 +3695,4 @@ function FarmsRouter(baseUrl) {
|
|
|
3695
3695
|
}
|
|
3696
3696
|
|
|
3697
3697
|
export { ControlRouter as C, DECIMALS_BY_TOKEN as D, FarmsRouter as F, GLOW_WEIGHT_DECIMAL_PRECISION as G, HUB_URL as H, KickstarterRouter as K, MAX_WEIGHT as M, OFF_CHAIN_PAYMENT_CURRENCIES as O, PAYMENT_CURRENCIES as P, RegionRouter as R, STAKING_DIRECTIONS as S, TRANSFER_TYPES as T, USDG_WEIGHT_DECIMAL_PRECISION as U, WalletsRouter as W, useOffchainFractions as a, REGIONS as b, KICKSTARTER_STATUS as c, ForwarderError as d, OffchainFractionsError as e, allRegions as f, usStates as g, countries as h, FORWARDER_ABI as i, OFFCHAIN_FRACTIONS_ABI as j, getAddresses as k, GCA_URLS as l, regionMetadata as r, useForwarder as u };
|
|
3698
|
-
//# sourceMappingURL=farms-router-
|
|
3698
|
+
//# sourceMappingURL=farms-router-9XHw3u2N.js.map
|