@glowlabs-org/utils 0.2.59 → 0.2.61
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.d.ts +1 -0
- package/dist/cjs/index.js +43 -93
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/{region-router-B_O_Q0Ea.js → kickstarter-router-CZaSq6Pl.js} +121 -27
- package/dist/cjs/kickstarter-router-CZaSq6Pl.js.map +1 -0
- package/dist/cjs/lib/control-api/wallets-router.d.ts +5 -0
- package/dist/cjs/lib/types/index.d.ts +50 -0
- package/dist/esm/browser.d.ts +1 -0
- package/dist/esm/browser.js +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +11 -62
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/{region-router-D8fhG-fI.js → kickstarter-router-D8tZPVSu.js} +121 -28
- package/dist/esm/kickstarter-router-D8tZPVSu.js.map +1 -0
- package/dist/esm/lib/control-api/wallets-router.d.ts +5 -0
- package/dist/esm/lib/types/index.d.ts +50 -0
- package/package.json +1 -1
- package/src/browser.ts +1 -0
- package/src/constants/addresses.ts +1 -1
- package/src/index.ts +1 -0
- package/src/lib/control-api/wallets-router.ts +49 -0
- package/src/lib/types/index.ts +56 -0
- package/dist/cjs/region-router-B_O_Q0Ea.js.map +0 -1
- package/dist/esm/region-router-D8fhG-fI.js.map +0 -1
|
@@ -230,4 +230,54 @@ export interface RegionSolarFarmsResponse {
|
|
|
230
230
|
export interface FetchRegionsParams {
|
|
231
231
|
isActive?: boolean;
|
|
232
232
|
}
|
|
233
|
+
export interface ControlWallet {
|
|
234
|
+
address: string;
|
|
235
|
+
controlBalance: string;
|
|
236
|
+
stakedControl: string;
|
|
237
|
+
createdAt: string;
|
|
238
|
+
}
|
|
239
|
+
export interface WalletsResponse {
|
|
240
|
+
wallets: ControlWallet[];
|
|
241
|
+
}
|
|
242
|
+
export interface WalletRegionStakeTotal {
|
|
243
|
+
regionId: number;
|
|
244
|
+
totalStaked: string;
|
|
245
|
+
pendingUnstake: string;
|
|
246
|
+
pendingRestakeOut: string;
|
|
247
|
+
region?: {
|
|
248
|
+
id: number;
|
|
249
|
+
name: string;
|
|
250
|
+
code: string;
|
|
251
|
+
slug: string;
|
|
252
|
+
isUs: boolean;
|
|
253
|
+
isActivated: boolean;
|
|
254
|
+
bannerUrl: string;
|
|
255
|
+
description: string;
|
|
256
|
+
createdAt: string;
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
export interface WalletFarmInfo {
|
|
260
|
+
farmId: string;
|
|
261
|
+
regionId: number;
|
|
262
|
+
name: string;
|
|
263
|
+
location: string;
|
|
264
|
+
kwhCapacity: string;
|
|
265
|
+
solarPanelsQuantity: number;
|
|
266
|
+
adjustedWeeklyCarbonCredits: string;
|
|
267
|
+
protocolDepositAmount: string;
|
|
268
|
+
protocolDepositPayerWallet: string | null;
|
|
269
|
+
builtEpoch: number;
|
|
270
|
+
isPurchased: boolean;
|
|
271
|
+
builtAt?: string;
|
|
272
|
+
purchaserWallet: string | null;
|
|
273
|
+
}
|
|
274
|
+
export interface WalletDetails {
|
|
275
|
+
wallet: string;
|
|
276
|
+
controlBalance: string;
|
|
277
|
+
stakedControl: string;
|
|
278
|
+
createdAt: string;
|
|
279
|
+
regions: WalletRegionStakeTotal[];
|
|
280
|
+
ownedFarms: WalletFarmInfo[];
|
|
281
|
+
purchasedFarms: WalletFarmInfo[];
|
|
282
|
+
}
|
|
233
283
|
export type { MintedEvent as ControlMintedEvent };
|
package/dist/esm/browser.d.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";
|
package/dist/esm/browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { C as ControlRouter, D as DECIMALS_BY_TOKEN, d as FORWARDER_ABI, F as ForwarderError, e as GCA_URLS, G as GLOW_WEIGHT_DECIMAL_PRECISION, H as HUB_URL, M as MAX_WEIGHT, R as RegionRouter, U as USDG_WEIGHT_DECIMAL_PRECISION, a as allRegions, c as countries, g as getAddresses, r as regionMetadata, b as usStates, u as useForwarder } from './
|
|
1
|
+
export { C as ControlRouter, D as DECIMALS_BY_TOKEN, d as FORWARDER_ABI, F as ForwarderError, e as GCA_URLS, G as GLOW_WEIGHT_DECIMAL_PRECISION, H as HUB_URL, K as KickstarterRouter, M as MAX_WEIGHT, R as RegionRouter, U as USDG_WEIGHT_DECIMAL_PRECISION, a as allRegions, c as countries, g as getAddresses, r as regionMetadata, b as usStates, u as useForwarder } from './kickstarter-router-D8tZPVSu.js';
|
|
2
2
|
import { verifyTypedData } from 'viem';
|
|
3
3
|
import 'ethers';
|
|
4
4
|
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -6,3 +6,4 @@ export { useForwarder } from "./lib/hooks/use-forwarder";
|
|
|
6
6
|
export { ControlRouter } from "./lib/control-api/control-router";
|
|
7
7
|
export { RegionRouter } from "./lib/control-api/region-router";
|
|
8
8
|
export { KickstarterRouter } from "./lib/control-api/kickstarter-router";
|
|
9
|
+
export { WalletsRouter } from "./lib/control-api/wallets-router";
|
package/dist/esm/index.js
CHANGED
|
@@ -13,8 +13,8 @@ import { parseUnits, formatUnits } from 'viem';
|
|
|
13
13
|
import { MerkleTree } from 'merkletreejs';
|
|
14
14
|
import { solidityPackedKeccak256, keccak256 } from 'ethers';
|
|
15
15
|
import Decimal from 'decimal.js';
|
|
16
|
-
import { H as HUB_URL, U as USDG_WEIGHT_DECIMAL_PRECISION, G as GLOW_WEIGHT_DECIMAL_PRECISION, M as MAX_WEIGHT
|
|
17
|
-
export { C as ControlRouter, R as RegionRouter, u as useForwarder } from './
|
|
16
|
+
import { H as HUB_URL, U as USDG_WEIGHT_DECIMAL_PRECISION, G as GLOW_WEIGHT_DECIMAL_PRECISION, M as MAX_WEIGHT } from './kickstarter-router-D8tZPVSu.js';
|
|
17
|
+
export { C as ControlRouter, K as KickstarterRouter, R as RegionRouter, u as useForwarder } from './kickstarter-router-D8tZPVSu.js';
|
|
18
18
|
|
|
19
19
|
const GENESIS_TIMESTAMP = 1700352000;
|
|
20
20
|
|
|
@@ -19160,7 +19160,7 @@ function parseApiError(error) {
|
|
|
19160
19160
|
const possible = error;
|
|
19161
19161
|
return possible?.error?.message ?? possible?.message ?? "Unknown error";
|
|
19162
19162
|
}
|
|
19163
|
-
function
|
|
19163
|
+
function WalletsRouter(baseUrl) {
|
|
19164
19164
|
if (!baseUrl)
|
|
19165
19165
|
throw new Error("CONTROL API base URL is not set");
|
|
19166
19166
|
const request = async (path, init) => {
|
|
@@ -19171,79 +19171,28 @@ function KickstarterRouter(baseUrl) {
|
|
|
19171
19171
|
}
|
|
19172
19172
|
return (await res.json());
|
|
19173
19173
|
};
|
|
19174
|
-
|
|
19175
|
-
const fetchKickstarters = async () => {
|
|
19174
|
+
const fetchAllWallets = async () => {
|
|
19176
19175
|
try {
|
|
19177
|
-
const data = await request(`/
|
|
19178
|
-
return data.
|
|
19176
|
+
const data = await request(`/wallets/all`);
|
|
19177
|
+
return data.wallets ?? [];
|
|
19179
19178
|
}
|
|
19180
19179
|
catch (error) {
|
|
19181
19180
|
throw new Error(parseApiError(error));
|
|
19182
19181
|
}
|
|
19183
19182
|
};
|
|
19184
|
-
const
|
|
19185
|
-
isCreatingKickstarter = true;
|
|
19183
|
+
const fetchWalletByAddress = async (wallet) => {
|
|
19186
19184
|
try {
|
|
19187
|
-
|
|
19188
|
-
if (!exists) {
|
|
19189
|
-
throw new Error(`Unknown region code: ${payload.code}`);
|
|
19190
|
-
}
|
|
19191
|
-
const data = await request(`/kickstarters`, {
|
|
19192
|
-
method: "POST",
|
|
19193
|
-
headers: { "Content-Type": "application/json" },
|
|
19194
|
-
body: JSON.stringify(payload),
|
|
19195
|
-
});
|
|
19196
|
-
return data;
|
|
19197
|
-
}
|
|
19198
|
-
catch (error) {
|
|
19199
|
-
throw new Error(parseApiError(error));
|
|
19200
|
-
}
|
|
19201
|
-
finally {
|
|
19202
|
-
isCreatingKickstarter = false;
|
|
19203
|
-
}
|
|
19204
|
-
};
|
|
19205
|
-
const fetchKickstarter = async (idOrSlug) => {
|
|
19206
|
-
try {
|
|
19207
|
-
const data = await request(`/kickstarters/${encodeURIComponent(idOrSlug)}`);
|
|
19208
|
-
return data.kickstarter;
|
|
19209
|
-
}
|
|
19210
|
-
catch (error) {
|
|
19211
|
-
throw new Error(parseApiError(error));
|
|
19212
|
-
}
|
|
19213
|
-
};
|
|
19214
|
-
const fetchKickstartersByWallet = async (wallet) => {
|
|
19215
|
-
try {
|
|
19216
|
-
const data = await request(`/kickstarters/by-wallet/${encodeURIComponent(wallet)}`);
|
|
19217
|
-
return data.kickstarters ?? [];
|
|
19218
|
-
}
|
|
19219
|
-
catch (error) {
|
|
19220
|
-
throw new Error(parseApiError(error));
|
|
19221
|
-
}
|
|
19222
|
-
};
|
|
19223
|
-
const commitKickstarter = async (kickstarterId, payload) => {
|
|
19224
|
-
try {
|
|
19225
|
-
const data = await request(`/kickstarters/commit/${encodeURIComponent(kickstarterId)}`, {
|
|
19226
|
-
method: "POST",
|
|
19227
|
-
headers: { "Content-Type": "application/json" },
|
|
19228
|
-
body: JSON.stringify(payload),
|
|
19229
|
-
});
|
|
19230
|
-
return data;
|
|
19185
|
+
return await request(`/wallets/address/${encodeURIComponent(wallet)}`);
|
|
19231
19186
|
}
|
|
19232
19187
|
catch (error) {
|
|
19233
19188
|
throw new Error(parseApiError(error));
|
|
19234
19189
|
}
|
|
19235
19190
|
};
|
|
19236
19191
|
return {
|
|
19237
|
-
|
|
19238
|
-
|
|
19239
|
-
fetchKickstartersByWallet,
|
|
19240
|
-
commitKickstarter,
|
|
19241
|
-
createKickstarter,
|
|
19242
|
-
get isCreatingKickstarter() {
|
|
19243
|
-
return isCreatingKickstarter;
|
|
19244
|
-
},
|
|
19192
|
+
fetchAllWallets,
|
|
19193
|
+
fetchWalletByAddress,
|
|
19245
19194
|
};
|
|
19246
19195
|
}
|
|
19247
19196
|
|
|
19248
|
-
export { GENESIS_TIMESTAMP,
|
|
19197
|
+
export { GENESIS_TIMESTAMP, WalletsRouter, createWeeklyReport, createWeeklyReportLegacy };
|
|
19249
19198
|
//# sourceMappingURL=index.js.map
|