@glowlabs-org/utils 0.2.168 → 0.2.169
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 +69 -1
- package/dist/cjs/browser.js.map +1 -1
- package/dist/cjs/{calculate-farm-efficiency-D-hx2uPV.js → calculate-farm-efficiency-BVpffn8k.js} +101 -1
- package/dist/cjs/calculate-farm-efficiency-BVpffn8k.js.map +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/lib/control-api/control-router.d.ts +34 -0
- package/dist/cjs/utils/stake-control.d.ts +38 -0
- package/dist/esm/browser.js +67 -3
- package/dist/esm/browser.js.map +1 -1
- package/dist/esm/{calculate-farm-efficiency-DXMSn59D.js → calculate-farm-efficiency-Cq10L_Uq.js} +101 -1
- package/dist/esm/calculate-farm-efficiency-Cq10L_Uq.js.map +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/lib/control-api/control-router.d.ts +34 -0
- package/dist/esm/utils/stake-control.d.ts +38 -0
- package/package.json +1 -1
- package/src/lib/control-api/control-router.ts +147 -0
- package/src/utils/stake-control.ts +86 -0
- package/dist/cjs/calculate-farm-efficiency-D-hx2uPV.js.map +0 -1
- package/dist/esm/calculate-farm-efficiency-DXMSn59D.js.map +0 -1
package/dist/esm/{calculate-farm-efficiency-DXMSn59D.js → calculate-farm-efficiency-Cq10L_Uq.js}
RENAMED
|
@@ -3494,6 +3494,7 @@ function ControlRouter(baseUrl) {
|
|
|
3494
3494
|
let isRetryingFailedOperation = false;
|
|
3495
3495
|
let isPayingProtocolDepositUsingStakedControl = false;
|
|
3496
3496
|
let isMigratingUser = false;
|
|
3497
|
+
let isDelegatingSgctl = false;
|
|
3497
3498
|
const stakeGctl = async (stakeRequest) => {
|
|
3498
3499
|
isStaking = true;
|
|
3499
3500
|
try {
|
|
@@ -3705,6 +3706,99 @@ function ControlRouter(baseUrl) {
|
|
|
3705
3706
|
throw new Error(parseApiError$4(error));
|
|
3706
3707
|
}
|
|
3707
3708
|
};
|
|
3709
|
+
const delegateSgctl = async (delegationRequest) => {
|
|
3710
|
+
isDelegatingSgctl = true;
|
|
3711
|
+
try {
|
|
3712
|
+
sentryAddBreadcrumb({
|
|
3713
|
+
category: "control-api",
|
|
3714
|
+
message: "POST /delegate-sgctl",
|
|
3715
|
+
level: "info",
|
|
3716
|
+
data: {
|
|
3717
|
+
baseUrl,
|
|
3718
|
+
wallet: delegationRequest.wallet,
|
|
3719
|
+
applicationId: delegationRequest.applicationId,
|
|
3720
|
+
fractionId: delegationRequest.fractionId,
|
|
3721
|
+
amount: delegationRequest.amount,
|
|
3722
|
+
},
|
|
3723
|
+
});
|
|
3724
|
+
const response = await request(`/delegate-sgctl`, {
|
|
3725
|
+
method: "POST",
|
|
3726
|
+
headers: { "Content-Type": "application/json" },
|
|
3727
|
+
body: JSON.stringify(delegationRequest),
|
|
3728
|
+
});
|
|
3729
|
+
return response;
|
|
3730
|
+
}
|
|
3731
|
+
catch (error) {
|
|
3732
|
+
sentryCaptureException(error, {
|
|
3733
|
+
action: "delegateSgctl",
|
|
3734
|
+
baseUrl,
|
|
3735
|
+
wallet: delegationRequest.wallet,
|
|
3736
|
+
applicationId: delegationRequest.applicationId,
|
|
3737
|
+
fractionId: delegationRequest.fractionId,
|
|
3738
|
+
amount: delegationRequest.amount,
|
|
3739
|
+
});
|
|
3740
|
+
throw new Error(parseApiError$4(error));
|
|
3741
|
+
}
|
|
3742
|
+
finally {
|
|
3743
|
+
isDelegatingSgctl = false;
|
|
3744
|
+
}
|
|
3745
|
+
};
|
|
3746
|
+
const refundDelegation = async (refundRequest) => {
|
|
3747
|
+
try {
|
|
3748
|
+
sentryAddBreadcrumb({
|
|
3749
|
+
category: "control-api",
|
|
3750
|
+
message: "POST /delegate-sgctl/refund",
|
|
3751
|
+
level: "info",
|
|
3752
|
+
data: {
|
|
3753
|
+
baseUrl,
|
|
3754
|
+
fractionId: refundRequest.fractionId,
|
|
3755
|
+
},
|
|
3756
|
+
});
|
|
3757
|
+
const response = await request(`/delegate-sgctl/refund`, {
|
|
3758
|
+
method: "POST",
|
|
3759
|
+
headers: { "Content-Type": "application/json" },
|
|
3760
|
+
body: JSON.stringify(refundRequest),
|
|
3761
|
+
});
|
|
3762
|
+
return response;
|
|
3763
|
+
}
|
|
3764
|
+
catch (error) {
|
|
3765
|
+
sentryCaptureException(error, {
|
|
3766
|
+
action: "refundDelegation",
|
|
3767
|
+
baseUrl,
|
|
3768
|
+
fractionId: refundRequest.fractionId,
|
|
3769
|
+
});
|
|
3770
|
+
throw new Error(parseApiError$4(error));
|
|
3771
|
+
}
|
|
3772
|
+
};
|
|
3773
|
+
const finalizeDelegation = async (finalizeRequest) => {
|
|
3774
|
+
try {
|
|
3775
|
+
sentryAddBreadcrumb({
|
|
3776
|
+
category: "control-api",
|
|
3777
|
+
message: "POST /delegate-sgctl/finalize",
|
|
3778
|
+
level: "info",
|
|
3779
|
+
data: {
|
|
3780
|
+
baseUrl,
|
|
3781
|
+
fractionId: finalizeRequest.fractionId,
|
|
3782
|
+
farmId: finalizeRequest.farmId,
|
|
3783
|
+
},
|
|
3784
|
+
});
|
|
3785
|
+
const response = await request(`/delegate-sgctl/finalize`, {
|
|
3786
|
+
method: "POST",
|
|
3787
|
+
headers: { "Content-Type": "application/json" },
|
|
3788
|
+
body: JSON.stringify(finalizeRequest),
|
|
3789
|
+
});
|
|
3790
|
+
return response;
|
|
3791
|
+
}
|
|
3792
|
+
catch (error) {
|
|
3793
|
+
sentryCaptureException(error, {
|
|
3794
|
+
action: "finalizeDelegation",
|
|
3795
|
+
baseUrl,
|
|
3796
|
+
fractionId: finalizeRequest.fractionId,
|
|
3797
|
+
farmId: finalizeRequest.farmId,
|
|
3798
|
+
});
|
|
3799
|
+
throw new Error(parseApiError$4(error));
|
|
3800
|
+
}
|
|
3801
|
+
};
|
|
3708
3802
|
// --------------------------- Public API ----------------------------------
|
|
3709
3803
|
return {
|
|
3710
3804
|
// Queries
|
|
@@ -3734,6 +3828,9 @@ function ControlRouter(baseUrl) {
|
|
|
3734
3828
|
retryFailedOperation,
|
|
3735
3829
|
payProtocolDepositUsingStakedControl,
|
|
3736
3830
|
migrateUser,
|
|
3831
|
+
delegateSgctl,
|
|
3832
|
+
refundDelegation,
|
|
3833
|
+
finalizeDelegation,
|
|
3737
3834
|
// Processing flags
|
|
3738
3835
|
get isStaking() {
|
|
3739
3836
|
return isStaking;
|
|
@@ -3753,6 +3850,9 @@ function ControlRouter(baseUrl) {
|
|
|
3753
3850
|
get isMigratingUser() {
|
|
3754
3851
|
return isMigratingUser;
|
|
3755
3852
|
},
|
|
3853
|
+
get isDelegatingSgctl() {
|
|
3854
|
+
return isDelegatingSgctl;
|
|
3855
|
+
},
|
|
3756
3856
|
};
|
|
3757
3857
|
}
|
|
3758
3858
|
|
|
@@ -5197,4 +5297,4 @@ function calculateFarmEfficiency(protocolDepositUsd6, weeklyImpactAssetsWad) {
|
|
|
5197
5297
|
}
|
|
5198
5298
|
|
|
5199
5299
|
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, SGCTL_OFFCHAIN_TOKEN_ADDRESS as q, regionMetadata as r, GCTL_OFFCHAIN_TOKEN_ADDRESS as s, GCA_URLS as t, useForwarder as u, parseViemError as v, parseEthersError as w, waitForViemTransactionWithRetry as x, waitForEthersTransactionWithRetry as y };
|
|
5200
|
-
//# sourceMappingURL=calculate-farm-efficiency-
|
|
5300
|
+
//# sourceMappingURL=calculate-farm-efficiency-Cq10L_Uq.js.map
|