@glowlabs-org/utils 0.2.155 → 0.2.157

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.
@@ -5,6 +5,7 @@ export { createWeeklyReport, createWeeklyReportLegacy, fetchWeeklyFarmsData, } f
5
5
  export * from "./lib/types";
6
6
  export { useForwarder } from "./lib/hooks/use-forwarder";
7
7
  export { useOffchainFractions } from "./lib/hooks/use-offchain-fractions";
8
+ export { useRewardsKernel } from "./lib/hooks/use-rewards-kernel";
8
9
  export { ControlRouter } from "./lib/control-api/control-router";
9
10
  export { RegionRouter } from "./lib/control-api/region-router";
10
11
  export { KickstarterRouter } from "./lib/control-api/kickstarter-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 } from './farms-router-BYpMNa_b.js';
17
- export { C as ControlRouter, F as FarmsRouter, d as KICKSTARTER_STATUS, K as KickstarterRouter, O as OFF_CHAIN_PAYMENT_CURRENCIES, P as PAYMENT_CURRENCIES, b as REGIONS, R as RegionRouter, S as STAKING_DIRECTIONS, T as TRANSFER_TYPES, W as WalletsRouter, c as configureSentry, u as useForwarder, a as useOffchainFractions } from './farms-router-BYpMNa_b.js';
16
+ import { H as HUB_URL, U as USDG_WEIGHT_DECIMAL_PRECISION, G as GLOW_WEIGHT_DECIMAL_PRECISION, M as MAX_WEIGHT } from './farms-router-L56VPDNz.js';
17
+ export { C as ControlRouter, F as FarmsRouter, e as KICKSTARTER_STATUS, K as KickstarterRouter, O as OFF_CHAIN_PAYMENT_CURRENCIES, P as PAYMENT_CURRENCIES, d as REGIONS, R as RegionRouter, S as STAKING_DIRECTIONS, T as TRANSFER_TYPES, W as WalletsRouter, c as configureSentry, u as useForwarder, a as useOffchainFractions, b as useRewardsKernel } from './farms-router-L56VPDNz.js';
18
18
 
19
19
  const GENESIS_TIMESTAMP = 1700352000;
20
20
 
@@ -0,0 +1,418 @@
1
+ export declare const REWARDS_KERNEL_ABI: readonly [{
2
+ readonly inputs: readonly [{
3
+ readonly internalType: "address";
4
+ readonly name: "_foundationMultisig";
5
+ readonly type: "address";
6
+ }, {
7
+ readonly internalType: "address";
8
+ readonly name: "_rejectionMultisig";
9
+ readonly type: "address";
10
+ }, {
11
+ readonly internalType: "contract CounterfactualHolderFactory";
12
+ readonly name: "f";
13
+ readonly type: "address";
14
+ }, {
15
+ readonly internalType: "uint256";
16
+ readonly name: "_finality";
17
+ readonly type: "uint256";
18
+ }];
19
+ readonly stateMutability: "payable";
20
+ readonly type: "constructor";
21
+ }, {
22
+ readonly inputs: readonly [{
23
+ readonly internalType: "address";
24
+ readonly name: "target";
25
+ readonly type: "address";
26
+ }];
27
+ readonly name: "AddressEmptyCode";
28
+ readonly type: "error";
29
+ }, {
30
+ readonly inputs: readonly [{
31
+ readonly internalType: "address";
32
+ readonly name: "account";
33
+ readonly type: "address";
34
+ }];
35
+ readonly name: "AddressInsufficientBalance";
36
+ readonly type: "error";
37
+ }, {
38
+ readonly inputs: readonly [];
39
+ readonly name: "AlreadyClaimedNonce";
40
+ readonly type: "error";
41
+ }, {
42
+ readonly inputs: readonly [];
43
+ readonly name: "AlreadyFinalized";
44
+ readonly type: "error";
45
+ }, {
46
+ readonly inputs: readonly [];
47
+ readonly name: "AlreadyRejected";
48
+ readonly type: "error";
49
+ }, {
50
+ readonly inputs: readonly [];
51
+ readonly name: "CannotClaimFromRejectedNonce";
52
+ readonly type: "error";
53
+ }, {
54
+ readonly inputs: readonly [];
55
+ readonly name: "CannotPostZeroRoot";
56
+ readonly type: "error";
57
+ }, {
58
+ readonly inputs: readonly [];
59
+ readonly name: "DuplicateToken";
60
+ readonly type: "error";
61
+ }, {
62
+ readonly inputs: readonly [];
63
+ readonly name: "FailedInnerCall";
64
+ readonly type: "error";
65
+ }, {
66
+ readonly inputs: readonly [];
67
+ readonly name: "InvalidMerkleProof";
68
+ readonly type: "error";
69
+ }, {
70
+ readonly inputs: readonly [];
71
+ readonly name: "LengthsDontMatch";
72
+ readonly type: "error";
73
+ }, {
74
+ readonly inputs: readonly [];
75
+ readonly name: "MaxClaimedExceeded";
76
+ readonly type: "error";
77
+ }, {
78
+ readonly inputs: readonly [];
79
+ readonly name: "NonexistentDataAtNonce";
80
+ readonly type: "error";
81
+ }, {
82
+ readonly inputs: readonly [];
83
+ readonly name: "NotFoundationMultisig";
84
+ readonly type: "error";
85
+ }, {
86
+ readonly inputs: readonly [];
87
+ readonly name: "NotRejectionMultisig";
88
+ readonly type: "error";
89
+ }, {
90
+ readonly inputs: readonly [];
91
+ readonly name: "NotYetFinalized";
92
+ readonly type: "error";
93
+ }, {
94
+ readonly inputs: readonly [];
95
+ readonly name: "ReentrancyGuardReentrantCall";
96
+ readonly type: "error";
97
+ }, {
98
+ readonly inputs: readonly [{
99
+ readonly internalType: "address";
100
+ readonly name: "token";
101
+ readonly type: "address";
102
+ }];
103
+ readonly name: "SafeERC20FailedOperation";
104
+ readonly type: "error";
105
+ }, {
106
+ readonly anonymous: false;
107
+ readonly inputs: readonly [{
108
+ readonly indexed: true;
109
+ readonly internalType: "uint256";
110
+ readonly name: "nonce";
111
+ readonly type: "uint256";
112
+ }];
113
+ readonly name: "NonceRejected";
114
+ readonly type: "event";
115
+ }, {
116
+ readonly anonymous: false;
117
+ readonly inputs: readonly [{
118
+ readonly indexed: true;
119
+ readonly internalType: "address";
120
+ readonly name: "user";
121
+ readonly type: "address";
122
+ }, {
123
+ readonly indexed: true;
124
+ readonly internalType: "address";
125
+ readonly name: "to";
126
+ readonly type: "address";
127
+ }, {
128
+ readonly indexed: true;
129
+ readonly internalType: "uint256";
130
+ readonly name: "nonce";
131
+ readonly type: "uint256";
132
+ }, {
133
+ readonly indexed: false;
134
+ readonly internalType: "address";
135
+ readonly name: "from";
136
+ readonly type: "address";
137
+ }, {
138
+ readonly components: readonly [{
139
+ readonly internalType: "address";
140
+ readonly name: "token";
141
+ readonly type: "address";
142
+ }, {
143
+ readonly internalType: "uint256";
144
+ readonly name: "amount";
145
+ readonly type: "uint256";
146
+ }];
147
+ readonly indexed: false;
148
+ readonly internalType: "struct FoundationRewardKernel.TokenAndAmount[]";
149
+ readonly name: "taa";
150
+ readonly type: "tuple[]";
151
+ }, {
152
+ readonly indexed: false;
153
+ readonly internalType: "bool[]";
154
+ readonly name: "isGuarded";
155
+ readonly type: "bool[]";
156
+ }];
157
+ readonly name: "RewardClaimed";
158
+ readonly type: "event";
159
+ }, {
160
+ readonly anonymous: false;
161
+ readonly inputs: readonly [{
162
+ readonly indexed: true;
163
+ readonly internalType: "uint256";
164
+ readonly name: "nonce";
165
+ readonly type: "uint256";
166
+ }, {
167
+ readonly indexed: true;
168
+ readonly internalType: "bytes32";
169
+ readonly name: "root";
170
+ readonly type: "bytes32";
171
+ }, {
172
+ readonly components: readonly [{
173
+ readonly internalType: "address";
174
+ readonly name: "token";
175
+ readonly type: "address";
176
+ }, {
177
+ readonly internalType: "uint256";
178
+ readonly name: "amount";
179
+ readonly type: "uint256";
180
+ }];
181
+ readonly indexed: false;
182
+ readonly internalType: "struct FoundationRewardKernel.TokenAndAmount[]";
183
+ readonly name: "taa";
184
+ readonly type: "tuple[]";
185
+ }];
186
+ readonly name: "RootPosted";
187
+ readonly type: "event";
188
+ }, {
189
+ readonly inputs: readonly [];
190
+ readonly name: "$nextPostNonce";
191
+ readonly outputs: readonly [{
192
+ readonly internalType: "uint256";
193
+ readonly name: "";
194
+ readonly type: "uint256";
195
+ }];
196
+ readonly stateMutability: "view";
197
+ readonly type: "function";
198
+ }, {
199
+ readonly inputs: readonly [];
200
+ readonly name: "CFH_FACTORY";
201
+ readonly outputs: readonly [{
202
+ readonly internalType: "contract CounterfactualHolderFactory";
203
+ readonly name: "";
204
+ readonly type: "address";
205
+ }];
206
+ readonly stateMutability: "view";
207
+ readonly type: "function";
208
+ }, {
209
+ readonly inputs: readonly [];
210
+ readonly name: "FINALITY";
211
+ readonly outputs: readonly [{
212
+ readonly internalType: "uint256";
213
+ readonly name: "";
214
+ readonly type: "uint256";
215
+ }];
216
+ readonly stateMutability: "view";
217
+ readonly type: "function";
218
+ }, {
219
+ readonly inputs: readonly [];
220
+ readonly name: "FOUNDATION_MULTISIG";
221
+ readonly outputs: readonly [{
222
+ readonly internalType: "address";
223
+ readonly name: "";
224
+ readonly type: "address";
225
+ }];
226
+ readonly stateMutability: "view";
227
+ readonly type: "function";
228
+ }, {
229
+ readonly inputs: readonly [];
230
+ readonly name: "REJECTION_MULTISIG";
231
+ readonly outputs: readonly [{
232
+ readonly internalType: "address";
233
+ readonly name: "";
234
+ readonly type: "address";
235
+ }];
236
+ readonly stateMutability: "view";
237
+ readonly type: "function";
238
+ }, {
239
+ readonly inputs: readonly [{
240
+ readonly internalType: "uint256";
241
+ readonly name: "nonce";
242
+ readonly type: "uint256";
243
+ }, {
244
+ readonly internalType: "bytes32[]";
245
+ readonly name: "proof";
246
+ readonly type: "bytes32[]";
247
+ }, {
248
+ readonly components: readonly [{
249
+ readonly internalType: "address";
250
+ readonly name: "token";
251
+ readonly type: "address";
252
+ }, {
253
+ readonly internalType: "uint256";
254
+ readonly name: "amount";
255
+ readonly type: "uint256";
256
+ }];
257
+ readonly internalType: "struct FoundationRewardKernel.TokenAndAmount[]";
258
+ readonly name: "taa";
259
+ readonly type: "tuple[]";
260
+ }, {
261
+ readonly internalType: "address";
262
+ readonly name: "from";
263
+ readonly type: "address";
264
+ }, {
265
+ readonly internalType: "address";
266
+ readonly name: "to";
267
+ readonly type: "address";
268
+ }, {
269
+ readonly internalType: "bool[]";
270
+ readonly name: "isGuardedToken";
271
+ readonly type: "bool[]";
272
+ }, {
273
+ readonly internalType: "bool[]";
274
+ readonly name: "toCounterfactual";
275
+ readonly type: "bool[]";
276
+ }];
277
+ readonly name: "claimPayout";
278
+ readonly outputs: readonly [];
279
+ readonly stateMutability: "nonpayable";
280
+ readonly type: "function";
281
+ }, {
282
+ readonly inputs: readonly [{
283
+ readonly internalType: "uint256";
284
+ readonly name: "nonce";
285
+ readonly type: "uint256";
286
+ }, {
287
+ readonly internalType: "address";
288
+ readonly name: "token";
289
+ readonly type: "address";
290
+ }];
291
+ readonly name: "getAmountClaimed";
292
+ readonly outputs: readonly [{
293
+ readonly internalType: "uint256";
294
+ readonly name: "";
295
+ readonly type: "uint256";
296
+ }];
297
+ readonly stateMutability: "view";
298
+ readonly type: "function";
299
+ }, {
300
+ readonly inputs: readonly [{
301
+ readonly internalType: "uint256";
302
+ readonly name: "nonce";
303
+ readonly type: "uint256";
304
+ }, {
305
+ readonly internalType: "address";
306
+ readonly name: "token";
307
+ readonly type: "address";
308
+ }];
309
+ readonly name: "getMaxReward";
310
+ readonly outputs: readonly [{
311
+ readonly internalType: "uint256";
312
+ readonly name: "";
313
+ readonly type: "uint256";
314
+ }];
315
+ readonly stateMutability: "view";
316
+ readonly type: "function";
317
+ }, {
318
+ readonly inputs: readonly [{
319
+ readonly internalType: "uint256";
320
+ readonly name: "nonce";
321
+ readonly type: "uint256";
322
+ }];
323
+ readonly name: "getRewardMeta";
324
+ readonly outputs: readonly [{
325
+ readonly internalType: "bytes32";
326
+ readonly name: "merkleRoot";
327
+ readonly type: "bytes32";
328
+ }, {
329
+ readonly internalType: "uint48";
330
+ readonly name: "pushTimestamp";
331
+ readonly type: "uint48";
332
+ }, {
333
+ readonly internalType: "bool";
334
+ readonly name: "rejected";
335
+ readonly type: "bool";
336
+ }];
337
+ readonly stateMutability: "view";
338
+ readonly type: "function";
339
+ }, {
340
+ readonly inputs: readonly [{
341
+ readonly internalType: "address";
342
+ readonly name: "user";
343
+ readonly type: "address";
344
+ }, {
345
+ readonly internalType: "uint256";
346
+ readonly name: "nonce";
347
+ readonly type: "uint256";
348
+ }];
349
+ readonly name: "isClaimed";
350
+ readonly outputs: readonly [{
351
+ readonly internalType: "bool";
352
+ readonly name: "";
353
+ readonly type: "bool";
354
+ }];
355
+ readonly stateMutability: "view";
356
+ readonly type: "function";
357
+ }, {
358
+ readonly inputs: readonly [{
359
+ readonly internalType: "uint256";
360
+ readonly name: "nonce";
361
+ readonly type: "uint256";
362
+ }];
363
+ readonly name: "isFinalized";
364
+ readonly outputs: readonly [{
365
+ readonly internalType: "bool";
366
+ readonly name: "";
367
+ readonly type: "bool";
368
+ }];
369
+ readonly stateMutability: "view";
370
+ readonly type: "function";
371
+ }, {
372
+ readonly inputs: readonly [{
373
+ readonly internalType: "bytes[]";
374
+ readonly name: "data";
375
+ readonly type: "bytes[]";
376
+ }];
377
+ readonly name: "multicall";
378
+ readonly outputs: readonly [{
379
+ readonly internalType: "bytes[]";
380
+ readonly name: "results";
381
+ readonly type: "bytes[]";
382
+ }];
383
+ readonly stateMutability: "nonpayable";
384
+ readonly type: "function";
385
+ }, {
386
+ readonly inputs: readonly [{
387
+ readonly internalType: "bytes32";
388
+ readonly name: "root";
389
+ readonly type: "bytes32";
390
+ }, {
391
+ readonly components: readonly [{
392
+ readonly internalType: "address";
393
+ readonly name: "token";
394
+ readonly type: "address";
395
+ }, {
396
+ readonly internalType: "uint256";
397
+ readonly name: "amount";
398
+ readonly type: "uint256";
399
+ }];
400
+ readonly internalType: "struct FoundationRewardKernel.TokenAndAmount[]";
401
+ readonly name: "taa";
402
+ readonly type: "tuple[]";
403
+ }];
404
+ readonly name: "postPayoutRoot";
405
+ readonly outputs: readonly [];
406
+ readonly stateMutability: "nonpayable";
407
+ readonly type: "function";
408
+ }, {
409
+ readonly inputs: readonly [{
410
+ readonly internalType: "uint256";
411
+ readonly name: "nonce";
412
+ readonly type: "uint256";
413
+ }];
414
+ readonly name: "rejectNonce";
415
+ readonly outputs: readonly [];
416
+ readonly stateMutability: "nonpayable";
417
+ readonly type: "function";
418
+ }];
@@ -0,0 +1,45 @@
1
+ import { type WalletClient, type PublicClient } from "viem";
2
+ export declare enum RewardsKernelError {
3
+ CONTRACT_NOT_AVAILABLE = "Contract not available",
4
+ SIGNER_NOT_AVAILABLE = "Signer not available",
5
+ UNKNOWN_ERROR = "Unknown error",
6
+ INVALID_PARAMETERS = "Invalid parameters",
7
+ ALREADY_CLAIMED = "Already claimed from this nonce",
8
+ NOT_FINALIZED = "Nonce not yet finalized",
9
+ NONCE_REJECTED = "Cannot claim from rejected nonce"
10
+ }
11
+ export interface TokenAndAmount {
12
+ token: `0x${string}`;
13
+ amount: bigint;
14
+ }
15
+ export interface RewardMeta {
16
+ merkleRoot: string;
17
+ pushTimestamp: number;
18
+ rejected: boolean;
19
+ }
20
+ export interface ClaimPayoutParams {
21
+ nonce: bigint;
22
+ proof: `0x${string}`[];
23
+ tokensAndAmounts: TokenAndAmount[];
24
+ from: `0x${string}`;
25
+ to: `0x${string}`;
26
+ isGuardedToken: boolean[];
27
+ toCounterfactual: boolean[];
28
+ }
29
+ export declare function useRewardsKernel(walletClient: WalletClient | undefined, publicClient: PublicClient | undefined, CHAIN_ID: number): {
30
+ claimPayout: (params: ClaimPayoutParams) => Promise<string>;
31
+ getRewardMeta: (nonce: bigint) => Promise<RewardMeta>;
32
+ getMaxReward: (nonce: bigint, token: `0x${string}`) => Promise<bigint>;
33
+ getAmountClaimed: (nonce: bigint, token: `0x${string}`) => Promise<bigint>;
34
+ isFinalized: (nonce: bigint) => Promise<boolean>;
35
+ isClaimed: (user: `0x${string}`, nonce: bigint) => Promise<boolean>;
36
+ getNextPostNonce: () => Promise<bigint>;
37
+ getFinality: () => Promise<bigint>;
38
+ getFoundationMultisig: () => Promise<string>;
39
+ getRejectionMultisig: () => Promise<string>;
40
+ getCFHFactory: () => Promise<string>;
41
+ estimateGasForClaimPayout: (params: ClaimPayoutParams, ethPriceInUSD: number | null) => Promise<string>;
42
+ readonly isProcessing: boolean;
43
+ addresses: Record<import("../../constants/addresses").ContractKeys, `0x${string}`>;
44
+ isSignerAvailable: boolean;
45
+ };
@@ -496,6 +496,8 @@ export interface WeeklyReward {
496
496
  paymentCurrency: PaymentCurrency;
497
497
  protocolDepositRewardsReceived: string;
498
498
  glowInflationTotal: string;
499
+ v1MerkleRoot: string;
500
+ v2MerkleRoot: string;
499
501
  }
500
502
  export interface WeeklyRewardsSummary {
501
503
  totalProtocolDepositRewardsReceived: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glowlabs-org/utils",
3
- "version": "0.2.155",
3
+ "version": "0.2.157",
4
4
  "description": "A library containing all typechain types and addresses relating to the glow guarded launch",
5
5
  "keywords": [],
6
6
  "author": "",
package/src/browser.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from "./lib/hooks/use-forwarder";
2
2
  export * from "./lib/hooks/use-offchain-fractions";
3
+ export * from "./lib/hooks/use-rewards-kernel";
3
4
  export * from "./lib/control-api/control-router";
4
5
  export * from "./lib/control-api/region-router";
5
6
  export * from "./lib/control-api/kickstarter-router";
@@ -9,6 +10,7 @@ export * from "./lib/types";
9
10
  export * from "./lib/region-metadata";
10
11
  export * from "./lib/abis/forwarderABI";
11
12
  export * from "./lib/abis/offchainFractions";
13
+ export * from "./lib/abis/rewardKernelABI";
12
14
  export * from "./constants/addresses";
13
15
  export * from "./constants/weights";
14
16
  export * from "./constants/urls";
package/src/index.ts CHANGED
@@ -9,6 +9,7 @@ export {
9
9
  export * from "./lib/types";
10
10
  export { useForwarder } from "./lib/hooks/use-forwarder";
11
11
  export { useOffchainFractions } from "./lib/hooks/use-offchain-fractions";
12
+ export { useRewardsKernel } from "./lib/hooks/use-rewards-kernel";
12
13
  export { ControlRouter } from "./lib/control-api/control-router";
13
14
  export { RegionRouter } from "./lib/control-api/region-router";
14
15
  export { KickstarterRouter } from "./lib/control-api/kickstarter-router";