@glowlabs-org/utils 0.2.109 → 0.2.111
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/{farms-router-DuVI7Pig.js → farms-router-DhAOciuN.js} +311 -25
- package/dist/cjs/farms-router-DhAOciuN.js.map +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/lib/abis/offchainFractions.d.ts +176 -21
- package/dist/cjs/lib/hooks/use-offchain-fractions.d.ts +14 -2
- package/dist/cjs/lib/types/index.d.ts +1 -0
- package/dist/esm/browser.js +2 -2
- package/dist/esm/{farms-router-Cncy_gI0.js → farms-router-UmqKWCHo.js} +311 -25
- package/dist/esm/farms-router-UmqKWCHo.js.map +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/lib/abis/offchainFractions.d.ts +176 -21
- package/dist/esm/lib/hooks/use-offchain-fractions.d.ts +14 -2
- package/dist/esm/lib/types/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/lib/abis/offchainFractions.ts +129 -12
- package/src/lib/hooks/use-offchain-fractions.ts +290 -17
- package/src/lib/types/index.ts +1 -0
- package/dist/cjs/farms-router-DuVI7Pig.js.map +0 -1
- package/dist/esm/farms-router-Cncy_gI0.js.map +0 -1
|
@@ -22,10 +22,6 @@ export declare const OFFCHAIN_FRACTIONS_ABI: readonly [{
|
|
|
22
22
|
}];
|
|
23
23
|
readonly name: "AddressInsufficientBalance";
|
|
24
24
|
readonly type: "error";
|
|
25
|
-
}, {
|
|
26
|
-
readonly inputs: readonly [];
|
|
27
|
-
readonly name: "AlreadyClaimed";
|
|
28
|
-
readonly type: "error";
|
|
29
25
|
}, {
|
|
30
26
|
readonly inputs: readonly [];
|
|
31
27
|
readonly name: "AlreadyClosed";
|
|
@@ -36,27 +32,23 @@ export declare const OFFCHAIN_FRACTIONS_ABI: readonly [{
|
|
|
36
32
|
readonly type: "error";
|
|
37
33
|
}, {
|
|
38
34
|
readonly inputs: readonly [];
|
|
39
|
-
readonly name: "
|
|
40
|
-
readonly type: "error";
|
|
41
|
-
}, {
|
|
42
|
-
readonly inputs: readonly [];
|
|
43
|
-
readonly name: "CannotClaimPayoutWhenRoundNotFullyFilled";
|
|
35
|
+
readonly name: "CannotClaimRefundWhenNotExpired";
|
|
44
36
|
readonly type: "error";
|
|
45
37
|
}, {
|
|
46
38
|
readonly inputs: readonly [];
|
|
47
|
-
readonly name: "
|
|
39
|
+
readonly name: "CannotClaimRefundWhenThresholdReached";
|
|
48
40
|
readonly type: "error";
|
|
49
41
|
}, {
|
|
50
42
|
readonly inputs: readonly [];
|
|
51
|
-
readonly name: "
|
|
43
|
+
readonly name: "CannotCloseWhenThresholdReached";
|
|
52
44
|
readonly type: "error";
|
|
53
45
|
}, {
|
|
54
46
|
readonly inputs: readonly [];
|
|
55
|
-
readonly name: "
|
|
47
|
+
readonly name: "CannotHaveZeroTotalSteps";
|
|
56
48
|
readonly type: "error";
|
|
57
49
|
}, {
|
|
58
50
|
readonly inputs: readonly [];
|
|
59
|
-
readonly name: "
|
|
51
|
+
readonly name: "ExpirationMustBeInTheFuture";
|
|
60
52
|
readonly type: "error";
|
|
61
53
|
}, {
|
|
62
54
|
readonly inputs: readonly [];
|
|
@@ -84,19 +76,19 @@ export declare const OFFCHAIN_FRACTIONS_ABI: readonly [{
|
|
|
84
76
|
readonly type: "error";
|
|
85
77
|
}, {
|
|
86
78
|
readonly inputs: readonly [];
|
|
87
|
-
readonly name: "
|
|
79
|
+
readonly name: "MinStepsToBuyCannotBeGreaterThanStepsToBuy";
|
|
88
80
|
readonly type: "error";
|
|
89
81
|
}, {
|
|
90
82
|
readonly inputs: readonly [];
|
|
91
|
-
readonly name: "
|
|
83
|
+
readonly name: "MinStepsToBuyCannotBeZero";
|
|
92
84
|
readonly type: "error";
|
|
93
85
|
}, {
|
|
94
86
|
readonly inputs: readonly [];
|
|
95
|
-
readonly name: "
|
|
87
|
+
readonly name: "NoStepsPurchased";
|
|
96
88
|
readonly type: "error";
|
|
97
89
|
}, {
|
|
98
90
|
readonly inputs: readonly [];
|
|
99
|
-
readonly name: "
|
|
91
|
+
readonly name: "NotFractionsCloser";
|
|
100
92
|
readonly type: "error";
|
|
101
93
|
}, {
|
|
102
94
|
readonly inputs: readonly [];
|
|
@@ -106,6 +98,10 @@ export declare const OFFCHAIN_FRACTIONS_ABI: readonly [{
|
|
|
106
98
|
readonly inputs: readonly [];
|
|
107
99
|
readonly name: "ReentrancyGuardReentrantCall";
|
|
108
100
|
readonly type: "error";
|
|
101
|
+
}, {
|
|
102
|
+
readonly inputs: readonly [];
|
|
103
|
+
readonly name: "RefundOperatorNotApproved";
|
|
104
|
+
readonly type: "error";
|
|
109
105
|
}, {
|
|
110
106
|
readonly inputs: readonly [{
|
|
111
107
|
readonly internalType: "address";
|
|
@@ -126,6 +122,10 @@ export declare const OFFCHAIN_FRACTIONS_ABI: readonly [{
|
|
|
126
122
|
readonly inputs: readonly [];
|
|
127
123
|
readonly name: "TotalRaisedOverflow";
|
|
128
124
|
readonly type: "error";
|
|
125
|
+
}, {
|
|
126
|
+
readonly inputs: readonly [];
|
|
127
|
+
readonly name: "UseCounterfactualAddressForRefundNotAllowedIfAddressIsZero";
|
|
128
|
+
readonly type: "error";
|
|
129
129
|
}, {
|
|
130
130
|
readonly inputs: readonly [];
|
|
131
131
|
readonly name: "ZeroSteps";
|
|
@@ -222,6 +222,11 @@ export declare const OFFCHAIN_FRACTIONS_ABI: readonly [{
|
|
|
222
222
|
readonly internalType: "address";
|
|
223
223
|
readonly name: "user";
|
|
224
224
|
readonly type: "address";
|
|
225
|
+
}, {
|
|
226
|
+
readonly indexed: false;
|
|
227
|
+
readonly internalType: "address";
|
|
228
|
+
readonly name: "refundTo";
|
|
229
|
+
readonly type: "address";
|
|
225
230
|
}, {
|
|
226
231
|
readonly indexed: false;
|
|
227
232
|
readonly internalType: "uint256";
|
|
@@ -245,6 +250,11 @@ export declare const OFFCHAIN_FRACTIONS_ABI: readonly [{
|
|
|
245
250
|
}, {
|
|
246
251
|
readonly indexed: true;
|
|
247
252
|
readonly internalType: "address";
|
|
253
|
+
readonly name: "creditTo";
|
|
254
|
+
readonly type: "address";
|
|
255
|
+
}, {
|
|
256
|
+
readonly indexed: false;
|
|
257
|
+
readonly internalType: "address";
|
|
248
258
|
readonly name: "buyer";
|
|
249
259
|
readonly type: "address";
|
|
250
260
|
}, {
|
|
@@ -285,6 +295,26 @@ export declare const OFFCHAIN_FRACTIONS_ABI: readonly [{
|
|
|
285
295
|
}];
|
|
286
296
|
readonly name: "MinSharesReached";
|
|
287
297
|
readonly type: "event";
|
|
298
|
+
}, {
|
|
299
|
+
readonly anonymous: false;
|
|
300
|
+
readonly inputs: readonly [{
|
|
301
|
+
readonly indexed: true;
|
|
302
|
+
readonly internalType: "address";
|
|
303
|
+
readonly name: "user";
|
|
304
|
+
readonly type: "address";
|
|
305
|
+
}, {
|
|
306
|
+
readonly indexed: true;
|
|
307
|
+
readonly internalType: "address";
|
|
308
|
+
readonly name: "refundOperator";
|
|
309
|
+
readonly type: "address";
|
|
310
|
+
}, {
|
|
311
|
+
readonly indexed: false;
|
|
312
|
+
readonly internalType: "bool";
|
|
313
|
+
readonly name: "isApproved";
|
|
314
|
+
readonly type: "bool";
|
|
315
|
+
}];
|
|
316
|
+
readonly name: "RefundOperatorStatusSet";
|
|
317
|
+
readonly type: "event";
|
|
288
318
|
}, {
|
|
289
319
|
readonly anonymous: false;
|
|
290
320
|
readonly inputs: readonly [{
|
|
@@ -300,6 +330,16 @@ export declare const OFFCHAIN_FRACTIONS_ABI: readonly [{
|
|
|
300
330
|
}];
|
|
301
331
|
readonly name: "RoundFilled";
|
|
302
332
|
readonly type: "event";
|
|
333
|
+
}, {
|
|
334
|
+
readonly inputs: readonly [];
|
|
335
|
+
readonly name: "REFUND_WILDCARD_OPERATOR";
|
|
336
|
+
readonly outputs: readonly [{
|
|
337
|
+
readonly internalType: "address";
|
|
338
|
+
readonly name: "";
|
|
339
|
+
readonly type: "address";
|
|
340
|
+
}];
|
|
341
|
+
readonly stateMutability: "view";
|
|
342
|
+
readonly type: "function";
|
|
303
343
|
}, {
|
|
304
344
|
readonly inputs: readonly [{
|
|
305
345
|
readonly internalType: "address";
|
|
@@ -317,6 +357,18 @@ export declare const OFFCHAIN_FRACTIONS_ABI: readonly [{
|
|
|
317
357
|
readonly internalType: "uint256";
|
|
318
358
|
readonly name: "minStepsToBuy";
|
|
319
359
|
readonly type: "uint256";
|
|
360
|
+
}, {
|
|
361
|
+
readonly internalType: "address";
|
|
362
|
+
readonly name: "refundTo";
|
|
363
|
+
readonly type: "address";
|
|
364
|
+
}, {
|
|
365
|
+
readonly internalType: "address";
|
|
366
|
+
readonly name: "creditTo";
|
|
367
|
+
readonly type: "address";
|
|
368
|
+
}, {
|
|
369
|
+
readonly internalType: "bool";
|
|
370
|
+
readonly name: "useCounterfactualAddressForRefund";
|
|
371
|
+
readonly type: "bool";
|
|
320
372
|
}];
|
|
321
373
|
readonly name: "buyFractions";
|
|
322
374
|
readonly outputs: readonly [];
|
|
@@ -324,6 +376,10 @@ export declare const OFFCHAIN_FRACTIONS_ABI: readonly [{
|
|
|
324
376
|
readonly type: "function";
|
|
325
377
|
}, {
|
|
326
378
|
readonly inputs: readonly [{
|
|
379
|
+
readonly internalType: "address";
|
|
380
|
+
readonly name: "user";
|
|
381
|
+
readonly type: "address";
|
|
382
|
+
}, {
|
|
327
383
|
readonly internalType: "address";
|
|
328
384
|
readonly name: "creator";
|
|
329
385
|
readonly type: "address";
|
|
@@ -428,10 +484,6 @@ export declare const OFFCHAIN_FRACTIONS_ABI: readonly [{
|
|
|
428
484
|
readonly internalType: "bool";
|
|
429
485
|
readonly name: "claimedFromMinSharesToRaise";
|
|
430
486
|
readonly type: "bool";
|
|
431
|
-
}, {
|
|
432
|
-
readonly internalType: "address";
|
|
433
|
-
readonly name: "owner";
|
|
434
|
-
readonly type: "address";
|
|
435
487
|
}, {
|
|
436
488
|
readonly internalType: "uint256";
|
|
437
489
|
readonly name: "step";
|
|
@@ -459,6 +511,37 @@ export declare const OFFCHAIN_FRACTIONS_ABI: readonly [{
|
|
|
459
511
|
}];
|
|
460
512
|
readonly stateMutability: "view";
|
|
461
513
|
readonly type: "function";
|
|
514
|
+
}, {
|
|
515
|
+
readonly inputs: readonly [{
|
|
516
|
+
readonly internalType: "address";
|
|
517
|
+
readonly name: "user";
|
|
518
|
+
readonly type: "address";
|
|
519
|
+
}, {
|
|
520
|
+
readonly internalType: "address";
|
|
521
|
+
readonly name: "creator";
|
|
522
|
+
readonly type: "address";
|
|
523
|
+
}, {
|
|
524
|
+
readonly internalType: "bytes32";
|
|
525
|
+
readonly name: "id";
|
|
526
|
+
readonly type: "bytes32";
|
|
527
|
+
}];
|
|
528
|
+
readonly name: "getRefundDetails";
|
|
529
|
+
readonly outputs: readonly [{
|
|
530
|
+
readonly components: readonly [{
|
|
531
|
+
readonly internalType: "address";
|
|
532
|
+
readonly name: "refundTo";
|
|
533
|
+
readonly type: "address";
|
|
534
|
+
}, {
|
|
535
|
+
readonly internalType: "bool";
|
|
536
|
+
readonly name: "useCounterfactualAddress";
|
|
537
|
+
readonly type: "bool";
|
|
538
|
+
}];
|
|
539
|
+
readonly internalType: "struct OffchainFractions.RefundDetails";
|
|
540
|
+
readonly name: "";
|
|
541
|
+
readonly type: "tuple";
|
|
542
|
+
}];
|
|
543
|
+
readonly stateMutability: "view";
|
|
544
|
+
readonly type: "function";
|
|
462
545
|
}, {
|
|
463
546
|
readonly inputs: readonly [];
|
|
464
547
|
readonly name: "i_CFHFactory";
|
|
@@ -469,6 +552,78 @@ export declare const OFFCHAIN_FRACTIONS_ABI: readonly [{
|
|
|
469
552
|
}];
|
|
470
553
|
readonly stateMutability: "view";
|
|
471
554
|
readonly type: "function";
|
|
555
|
+
}, {
|
|
556
|
+
readonly inputs: readonly [{
|
|
557
|
+
readonly internalType: "address";
|
|
558
|
+
readonly name: "user";
|
|
559
|
+
readonly type: "address";
|
|
560
|
+
}, {
|
|
561
|
+
readonly internalType: "address";
|
|
562
|
+
readonly name: "refundOperator";
|
|
563
|
+
readonly type: "address";
|
|
564
|
+
}];
|
|
565
|
+
readonly name: "isRefundOperatorApproved";
|
|
566
|
+
readonly outputs: readonly [{
|
|
567
|
+
readonly internalType: "bool";
|
|
568
|
+
readonly name: "";
|
|
569
|
+
readonly type: "bool";
|
|
570
|
+
}];
|
|
571
|
+
readonly stateMutability: "view";
|
|
572
|
+
readonly type: "function";
|
|
573
|
+
}, {
|
|
574
|
+
readonly inputs: readonly [{
|
|
575
|
+
readonly internalType: "address";
|
|
576
|
+
readonly name: "user";
|
|
577
|
+
readonly type: "address";
|
|
578
|
+
}, {
|
|
579
|
+
readonly internalType: "address";
|
|
580
|
+
readonly name: "refundOperator";
|
|
581
|
+
readonly type: "address";
|
|
582
|
+
}];
|
|
583
|
+
readonly name: "refundApprovals";
|
|
584
|
+
readonly outputs: readonly [{
|
|
585
|
+
readonly internalType: "bool";
|
|
586
|
+
readonly name: "isApproved";
|
|
587
|
+
readonly type: "bool";
|
|
588
|
+
}];
|
|
589
|
+
readonly stateMutability: "view";
|
|
590
|
+
readonly type: "function";
|
|
591
|
+
}, {
|
|
592
|
+
readonly inputs: readonly [{
|
|
593
|
+
readonly internalType: "address";
|
|
594
|
+
readonly name: "creator";
|
|
595
|
+
readonly type: "address";
|
|
596
|
+
}, {
|
|
597
|
+
readonly internalType: "bytes32";
|
|
598
|
+
readonly name: "id";
|
|
599
|
+
readonly type: "bytes32";
|
|
600
|
+
}, {
|
|
601
|
+
readonly internalType: "address";
|
|
602
|
+
readonly name: "refundTo";
|
|
603
|
+
readonly type: "address";
|
|
604
|
+
}, {
|
|
605
|
+
readonly internalType: "bool";
|
|
606
|
+
readonly name: "useCounterfactualAddress";
|
|
607
|
+
readonly type: "bool";
|
|
608
|
+
}];
|
|
609
|
+
readonly name: "setRefundDetails";
|
|
610
|
+
readonly outputs: readonly [];
|
|
611
|
+
readonly stateMutability: "nonpayable";
|
|
612
|
+
readonly type: "function";
|
|
613
|
+
}, {
|
|
614
|
+
readonly inputs: readonly [{
|
|
615
|
+
readonly internalType: "address";
|
|
616
|
+
readonly name: "refundOperator";
|
|
617
|
+
readonly type: "address";
|
|
618
|
+
}, {
|
|
619
|
+
readonly internalType: "bool";
|
|
620
|
+
readonly name: "isApproved";
|
|
621
|
+
readonly type: "bool";
|
|
622
|
+
}];
|
|
623
|
+
readonly name: "setRefundOperatorStatus";
|
|
624
|
+
readonly outputs: readonly [];
|
|
625
|
+
readonly stateMutability: "nonpayable";
|
|
626
|
+
readonly type: "function";
|
|
472
627
|
}, {
|
|
473
628
|
readonly inputs: readonly [{
|
|
474
629
|
readonly internalType: "address";
|
|
@@ -15,7 +15,6 @@ export interface FractionData {
|
|
|
15
15
|
minSharesToRaise: bigint;
|
|
16
16
|
useCounterfactualAddress: boolean;
|
|
17
17
|
claimedFromMinSharesToRaise: boolean;
|
|
18
|
-
owner: string;
|
|
19
18
|
step: bigint;
|
|
20
19
|
to: string;
|
|
21
20
|
soldSteps: bigint;
|
|
@@ -38,14 +37,27 @@ export interface BuyFractionsParams {
|
|
|
38
37
|
id: string;
|
|
39
38
|
stepsToBuy: bigint;
|
|
40
39
|
minStepsToBuy: bigint;
|
|
40
|
+
refundTo: string;
|
|
41
|
+
creditTo: string;
|
|
42
|
+
useCounterfactualAddressForRefund: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface RefundDetails {
|
|
45
|
+
refundTo: string;
|
|
46
|
+
useCounterfactualAddress: boolean;
|
|
41
47
|
}
|
|
42
48
|
export declare function useOffchainFractions(signer: Signer | undefined, CHAIN_ID: number): {
|
|
43
49
|
createFraction: (params: CreateFractionParams) => Promise<string>;
|
|
44
50
|
buyFractions: (params: BuyFractionsParams) => Promise<string>;
|
|
45
|
-
claimRefund: (creator: string, id: string) => Promise<string>;
|
|
51
|
+
claimRefund: (user: string, creator: string, id: string) => Promise<string>;
|
|
46
52
|
closeFraction: (creator: string, id: string) => Promise<string>;
|
|
47
53
|
getFraction: (creator: string, id: string) => Promise<FractionData>;
|
|
48
54
|
getStepsPurchased: (user: string, creator: string, id: string) => Promise<bigint>;
|
|
55
|
+
getRefundWildcardOperator: () => Promise<string>;
|
|
56
|
+
getRefundDetails: (user: string, creator: string, id: string) => Promise<RefundDetails>;
|
|
57
|
+
setRefundDetails: (creator: string, id: string, refundTo: string, useCounterfactualAddress: boolean) => Promise<string>;
|
|
58
|
+
setRefundOperatorStatus: (refundOperator: string, isApproved: boolean) => Promise<string>;
|
|
59
|
+
isRefundOperatorApproved: (user: string, refundOperator: string) => Promise<boolean>;
|
|
60
|
+
getRefundApprovalStatus: (user: string, refundOperator: string) => Promise<boolean>;
|
|
49
61
|
approveToken: (tokenAddress: string, amount: bigint) => Promise<boolean>;
|
|
50
62
|
checkTokenAllowance: (owner: string, tokenAddress: string) => Promise<bigint>;
|
|
51
63
|
checkTokenBalance: (owner: string, tokenAddress: string) => Promise<bigint>;
|
|
@@ -439,6 +439,7 @@ export interface EstimateRewardScoresBatchResponse {
|
|
|
439
439
|
results: BatchRewardScoreResult[];
|
|
440
440
|
}
|
|
441
441
|
export interface UserWeeklyRewards {
|
|
442
|
+
protocolDepositAsset: PaymentCurrency;
|
|
442
443
|
protocolDepositRewards: string;
|
|
443
444
|
glwInflationRewards: string;
|
|
444
445
|
userGlowSplitPercent: string;
|
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, h as FORWARDER_ABI, F as FarmsRouter, b as ForwarderError, k as GCA_URLS, G as GLOW_WEIGHT_DECIMAL_PRECISION, H as HUB_URL, K as KickstarterRouter, M as MAX_WEIGHT, i as OFFCHAIN_FRACTIONS_ABI, d as OFF_CHAIN_PAYMENT_CURRENCIES, O as OffchainFractionsError, P as PAYMENT_CURRENCIES, c as REGIONS, R as RegionRouter, U as USDG_WEIGHT_DECIMAL_PRECISION, W as WalletsRouter, e as allRegions, g as countries, j as getAddresses, r as regionMetadata, f as usStates, u as useForwarder, a as useOffchainFractions } from './farms-router-
|
|
1
|
+
import { T as TRANSFER_TYPES } from './farms-router-UmqKWCHo.js';
|
|
2
|
+
export { C as ControlRouter, D as DECIMALS_BY_TOKEN, h as FORWARDER_ABI, F as FarmsRouter, b as ForwarderError, k as GCA_URLS, G as GLOW_WEIGHT_DECIMAL_PRECISION, H as HUB_URL, K as KickstarterRouter, M as MAX_WEIGHT, i as OFFCHAIN_FRACTIONS_ABI, d as OFF_CHAIN_PAYMENT_CURRENCIES, O as OffchainFractionsError, P as PAYMENT_CURRENCIES, c as REGIONS, R as RegionRouter, U as USDG_WEIGHT_DECIMAL_PRECISION, W as WalletsRouter, e as allRegions, g as countries, j as getAddresses, r as regionMetadata, f as usStates, u as useForwarder, a as useOffchainFractions } from './farms-router-UmqKWCHo.js';
|
|
3
3
|
import { verifyTypedData, getAddress } from 'viem';
|
|
4
4
|
import 'ethers';
|
|
5
5
|
|