@glowlabs-org/utils 0.2.158 → 0.2.160

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/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 calculateFarmEfficiency = require('./calculate-farm-efficiency-CLa5037R.js');
18
+ var calculateFarmEfficiency = require('./calculate-farm-efficiency-r_CeFLgH.js');
19
19
 
20
20
  const GENESIS_TIMESTAMP = 1700352000;
21
21
 
@@ -1,8 +1,10 @@
1
- import type { ControlWallet, WalletDetails, MintedEvent, StakedEvent, WalletWeeklyRewardsResponse, WeeklyRewardsQuery } from "../types";
1
+ import type { ControlWallet, WalletDetails, MintedEvent, StakedEvent, WalletWeeklyRewardsResponse, WeeklyRewardsQuery, TosAcceptRequest, TosAcceptResponse, TosStatusResponse } from "../types";
2
2
  export declare function WalletsRouter(baseUrl: string): {
3
3
  readonly fetchAllWallets: () => Promise<ControlWallet[]>;
4
4
  readonly fetchWalletByAddress: (wallet: string) => Promise<WalletDetails>;
5
5
  readonly fetchWalletMintedEvents: (wallet: string, page?: number, limit?: number) => Promise<MintedEvent[]>;
6
6
  readonly fetchWalletStakeEvents: (wallet: string, page?: number, limit?: number, regionId?: number) => Promise<StakedEvent[]>;
7
7
  readonly fetchWalletWeeklyRewards: (wallet: string, query?: WeeklyRewardsQuery) => Promise<WalletWeeklyRewardsResponse>;
8
+ readonly acceptToS: (wallet: string, tosRequest: TosAcceptRequest) => Promise<TosAcceptResponse>;
9
+ readonly fetchTosStatus: (wallet: string) => Promise<TosStatusResponse>;
8
10
  };
@@ -156,6 +156,7 @@ export interface RegionWithMetadata extends Region {
156
156
  activationSolarFarmThreshold: number;
157
157
  installerCount: number;
158
158
  activationInstallerThreshold: number;
159
+ efficiencyScore: number;
159
160
  }
160
161
  export interface ActivationConfig {
161
162
  duration: number;
@@ -688,6 +689,26 @@ export interface RetryFailedOperationResponse {
688
689
  success?: boolean;
689
690
  queued?: boolean;
690
691
  }
692
+ export interface TosAcceptRequest {
693
+ signature: string;
694
+ nonce: string;
695
+ tosVersion: string;
696
+ tosHash: string;
697
+ message: string;
698
+ deadline: string;
699
+ }
700
+ export interface TosAcceptResponse {
701
+ success: boolean;
702
+ version: string;
703
+ acceptedAt: string;
704
+ }
705
+ export interface TosStatusResponse {
706
+ hasAccepted: boolean;
707
+ currentVersion: string;
708
+ acceptedVersion?: string;
709
+ needsReAcceptance: boolean;
710
+ acceptedAt?: string;
711
+ }
691
712
  export interface FarmEfficiencyScore {
692
713
  farmId: string;
693
714
  efficiencyScore: number;
@@ -1,5 +1,5 @@
1
- import { T as TRANSFER_TYPES } from './calculate-farm-efficiency-Ceoa2xwl.js';
2
- export { C as ControlRouter, D as DECIMALS_BY_TOKEN, m as FORWARDER_ABI, F as FarmsRouter, g as ForwarderError, q as GCA_URLS, G as GLOW_WEIGHT_DECIMAL_PRECISION, H as HUB_URL, e as KICKSTARTER_STATUS, K as KickstarterRouter, M as MAX_WEIGHT, n as OFFCHAIN_FRACTIONS_ABI, O as OFF_CHAIN_PAYMENT_CURRENCIES, h as OffchainFractionsError, P as PAYMENT_CURRENCIES, d as REGIONS, o as REWARDS_KERNEL_ABI, R as RegionRouter, i as RewardsKernelError, S as STAKING_DIRECTIONS, U as USDG_WEIGHT_DECIMAL_PRECISION, W as WalletsRouter, j as allRegions, f as calculateFarmEfficiency, c as configureSentry, l as countries, p as getAddresses, t as parseEthersError, s as parseViemError, r as regionMetadata, k as usStates, u as useForwarder, a as useOffchainFractions, b as useRewardsKernel, v as waitForEthersTransactionWithRetry, w as waitForViemTransactionWithRetry } from './calculate-farm-efficiency-Ceoa2xwl.js';
1
+ import { T as TRANSFER_TYPES } from './calculate-farm-efficiency-DDBlAkwU.js';
2
+ export { C as ControlRouter, D as DECIMALS_BY_TOKEN, m as FORWARDER_ABI, F as FarmsRouter, g as ForwarderError, q as GCA_URLS, G as GLOW_WEIGHT_DECIMAL_PRECISION, H as HUB_URL, e as KICKSTARTER_STATUS, K as KickstarterRouter, M as MAX_WEIGHT, n as OFFCHAIN_FRACTIONS_ABI, O as OFF_CHAIN_PAYMENT_CURRENCIES, h as OffchainFractionsError, P as PAYMENT_CURRENCIES, d as REGIONS, o as REWARDS_KERNEL_ABI, R as RegionRouter, i as RewardsKernelError, S as STAKING_DIRECTIONS, U as USDG_WEIGHT_DECIMAL_PRECISION, W as WalletsRouter, j as allRegions, f as calculateFarmEfficiency, c as configureSentry, l as countries, p as getAddresses, t as parseEthersError, s as parseViemError, r as regionMetadata, k as usStates, u as useForwarder, a as useOffchainFractions, b as useRewardsKernel, v as waitForEthersTransactionWithRetry, w as waitForViemTransactionWithRetry } from './calculate-farm-efficiency-DDBlAkwU.js';
3
3
  import 'decimal.js';
4
4
  import { verifyTypedData, checksumAddress } from 'viem';
5
5
  import 'ethers';
@@ -4569,6 +4569,7 @@ function RegionRouter(baseUrl) {
4569
4569
  installerCount: 1,
4570
4570
  createdAt: new Date(),
4571
4571
  activationInstallerThreshold: 1,
4572
+ efficiencyScore: 0,
4572
4573
  };
4573
4574
  };
4574
4575
  // -------------------------------------------------------------------------
@@ -4820,12 +4821,36 @@ function WalletsRouter(baseUrl) {
4820
4821
  throw new Error(parseApiError$1(error));
4821
4822
  }
4822
4823
  };
4824
+ const acceptToS = async (wallet, tosRequest) => {
4825
+ try {
4826
+ return await request(`/wallets/address/${encodeURIComponent(wallet)}/tos/accept`, {
4827
+ method: "POST",
4828
+ headers: {
4829
+ "Content-Type": "application/json",
4830
+ },
4831
+ body: JSON.stringify(tosRequest),
4832
+ });
4833
+ }
4834
+ catch (error) {
4835
+ throw new Error(parseApiError$1(error));
4836
+ }
4837
+ };
4838
+ const fetchTosStatus = async (wallet) => {
4839
+ try {
4840
+ return await request(`/wallets/address/${encodeURIComponent(wallet)}/tos/status`);
4841
+ }
4842
+ catch (error) {
4843
+ throw new Error(parseApiError$1(error));
4844
+ }
4845
+ };
4823
4846
  return {
4824
4847
  fetchAllWallets,
4825
4848
  fetchWalletByAddress,
4826
4849
  fetchWalletMintedEvents,
4827
4850
  fetchWalletStakeEvents,
4828
4851
  fetchWalletWeeklyRewards,
4852
+ acceptToS,
4853
+ fetchTosStatus,
4829
4854
  };
4830
4855
  }
4831
4856
 
@@ -5064,4 +5089,4 @@ function calculateFarmEfficiency(protocolDepositUsd6, weeklyImpactAssetsWad) {
5064
5089
  }
5065
5090
 
5066
5091
  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, useRewardsKernel as b, configureSentry as c, REGIONS as d, KICKSTARTER_STATUS as e, calculateFarmEfficiency as f, ForwarderError as g, OffchainFractionsError as h, RewardsKernelError as i, allRegions as j, usStates as k, countries as l, FORWARDER_ABI as m, OFFCHAIN_FRACTIONS_ABI as n, REWARDS_KERNEL_ABI as o, getAddresses as p, GCA_URLS as q, regionMetadata as r, parseViemError as s, parseEthersError as t, useForwarder as u, waitForEthersTransactionWithRetry as v, waitForViemTransactionWithRetry as w };
5067
- //# sourceMappingURL=calculate-farm-efficiency-Ceoa2xwl.js.map
5092
+ //# sourceMappingURL=calculate-farm-efficiency-DDBlAkwU.js.map