@curvefi/api 2.61.9 → 2.61.11
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/lib/dao.d.ts +6 -3
- package/lib/dao.js +56 -0
- package/lib/index.d.ts +5 -2
- package/lib/index.js +4 -1
- package/lib/interfaces.d.ts +1 -0
- package/lib/pools/gaugePool.js +3 -3
- package/lib/utils.js +0 -2
- package/package.json +1 -1
package/lib/dao.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IGaugeUserVote, IVotingGauge, IDaoProposalListItem, IDaoProposalUserListItem, IDaoProposal } from './interfaces';
|
|
1
|
+
import { IGaugeUserVote, IVotingGauge, IDaoProposalListItem, IDaoProposalUserListItem, IDaoProposal, TVoteType } from './interfaces';
|
|
2
2
|
export declare const crvSupplyStats: () => Promise<{
|
|
3
3
|
circulating: string;
|
|
4
4
|
locked: string;
|
|
@@ -40,5 +40,8 @@ export declare const voteForGauge: (gauge: string, power: number | string) => Pr
|
|
|
40
40
|
export declare const getProposalList: () => Promise<IDaoProposalListItem[]>;
|
|
41
41
|
export declare const getProposal: (type: "PARAMETER" | "OWNERSHIP", id: number) => Promise<IDaoProposal>;
|
|
42
42
|
export declare const userProposalVotes: (address?: string) => Promise<IDaoProposalUserListItem[]>;
|
|
43
|
-
export declare const voteForProposalEstimateGas: (type:
|
|
44
|
-
export declare const voteForProposal: (type:
|
|
43
|
+
export declare const voteForProposalEstimateGas: (type: TVoteType, id: number, support: boolean) => Promise<number | number[]>;
|
|
44
|
+
export declare const voteForProposal: (type: TVoteType, id: number, support: boolean) => Promise<string>;
|
|
45
|
+
export declare const executeVoteEstimateGas: (type: TVoteType, id: number) => Promise<number | number[]>;
|
|
46
|
+
export declare const executeVote: (type: TVoteType, id: number) => Promise<string>;
|
|
47
|
+
export declare const isCanVoteExecute: (type: TVoteType, id: number) => Promise<boolean>;
|
package/lib/dao.js
CHANGED
|
@@ -673,3 +673,59 @@ export var voteForProposal = function (type, id, support) { return __awaiter(voi
|
|
|
673
673
|
}
|
|
674
674
|
});
|
|
675
675
|
}); };
|
|
676
|
+
var _executeVote = function (type, id, estimateGas) {
|
|
677
|
+
if (estimateGas === void 0) { estimateGas = false; }
|
|
678
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
679
|
+
var contractAddress, contract, gas, gasLimit;
|
|
680
|
+
return __generator(this, function (_a) {
|
|
681
|
+
switch (_a.label) {
|
|
682
|
+
case 0:
|
|
683
|
+
if (curve.chainId !== 1)
|
|
684
|
+
throw Error("Ethereum-only method");
|
|
685
|
+
contractAddress = type === "PARAMETER" ? curve.constants.ALIASES.voting_parameter : curve.constants.ALIASES.voting_ownership;
|
|
686
|
+
contract = curve.contracts[contractAddress].contract;
|
|
687
|
+
return [4 /*yield*/, contract.executeVote.estimateGas(id, curve.constantOptions)];
|
|
688
|
+
case 1:
|
|
689
|
+
gas = _a.sent();
|
|
690
|
+
if (estimateGas)
|
|
691
|
+
return [2 /*return*/, smartNumber(gas)];
|
|
692
|
+
return [4 /*yield*/, curve.updateFeeData()];
|
|
693
|
+
case 2:
|
|
694
|
+
_a.sent();
|
|
695
|
+
gasLimit = mulBy1_3(DIGas(gas));
|
|
696
|
+
return [4 /*yield*/, contract.executeVote(id, __assign(__assign({}, curve.options), { gasLimit: gasLimit }))];
|
|
697
|
+
case 3: return [2 /*return*/, (_a.sent()).hash];
|
|
698
|
+
}
|
|
699
|
+
});
|
|
700
|
+
});
|
|
701
|
+
};
|
|
702
|
+
export var executeVoteEstimateGas = function (type, id) { return __awaiter(void 0, void 0, void 0, function () {
|
|
703
|
+
return __generator(this, function (_a) {
|
|
704
|
+
switch (_a.label) {
|
|
705
|
+
case 0: return [4 /*yield*/, _executeVote(type, id, true)];
|
|
706
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
707
|
+
}
|
|
708
|
+
});
|
|
709
|
+
}); };
|
|
710
|
+
export var executeVote = function (type, id) { return __awaiter(void 0, void 0, void 0, function () {
|
|
711
|
+
return __generator(this, function (_a) {
|
|
712
|
+
switch (_a.label) {
|
|
713
|
+
case 0: return [4 /*yield*/, _executeVote(type, id, false)];
|
|
714
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
}); };
|
|
718
|
+
export var isCanVoteExecute = function (type, id) { return __awaiter(void 0, void 0, void 0, function () {
|
|
719
|
+
var contractAddress, contract;
|
|
720
|
+
return __generator(this, function (_a) {
|
|
721
|
+
switch (_a.label) {
|
|
722
|
+
case 0:
|
|
723
|
+
if (curve.chainId !== 1)
|
|
724
|
+
throw Error("Ethereum-only method");
|
|
725
|
+
contractAddress = type === "PARAMETER" ? curve.constants.ALIASES.voting_parameter : curve.constants.ALIASES.voting_ownership;
|
|
726
|
+
contract = curve.contracts[contractAddress].contract;
|
|
727
|
+
return [4 /*yield*/, contract.canExecute(id, __assign({}, curve.options))];
|
|
728
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
729
|
+
}
|
|
730
|
+
});
|
|
731
|
+
}); };
|
package/lib/index.d.ts
CHANGED
|
@@ -289,7 +289,9 @@ declare const curve: {
|
|
|
289
289
|
getProposalList: () => Promise<import("./interfaces.js").IDaoProposalListItem[]>;
|
|
290
290
|
getProposal: (type: "PARAMETER" | "OWNERSHIP", id: number) => Promise<import("./interfaces.js").IDaoProposal>;
|
|
291
291
|
userProposalVotes: (address?: string) => Promise<import("./interfaces.js").IDaoProposalUserListItem[]>;
|
|
292
|
-
voteForProposal: (type: "
|
|
292
|
+
voteForProposal: (type: import("./interfaces.js").TVoteType, id: number, support: boolean) => Promise<string>;
|
|
293
|
+
executeVote: (type: import("./interfaces.js").TVoteType, id: number) => Promise<string>;
|
|
294
|
+
isCanVoteExecute: (type: import("./interfaces.js").TVoteType, id: number) => Promise<boolean>;
|
|
293
295
|
estimateGas: {
|
|
294
296
|
crvLockApprove: (amount: string | number) => Promise<number | number[]>;
|
|
295
297
|
createCrvLock: (amount: string | number, days: string | number) => Promise<number | number[]>;
|
|
@@ -298,7 +300,8 @@ declare const curve: {
|
|
|
298
300
|
withdrawLockedCrv: () => Promise<number | number[]>;
|
|
299
301
|
claimFees: (address?: string) => Promise<number | number[]>;
|
|
300
302
|
voteForGauge: (gauge: string, power: string | number) => Promise<number | number[]>;
|
|
301
|
-
voteForProposal: (type: "
|
|
303
|
+
voteForProposal: (type: import("./interfaces.js").TVoteType, id: number, support: boolean) => Promise<number | number[]>;
|
|
304
|
+
executeVote: (type: import("./interfaces.js").TVoteType, id: number) => Promise<number | number[]>;
|
|
302
305
|
};
|
|
303
306
|
};
|
|
304
307
|
};
|
package/lib/index.js
CHANGED
|
@@ -41,7 +41,7 @@ import { curve as _curve } from "./curve.js";
|
|
|
41
41
|
import { getCrv, getLockedAmountAndUnlockTime, getVeCrv, getVeCrvPct, calcUnlockTime, createLockEstimateGas, createLock, isApproved, approveEstimateGas, approve, increaseAmountEstimateGas, increaseAmount, increaseUnlockTimeEstimateGas, increaseUnlockTime, withdrawLockedCrvEstimateGas, withdrawLockedCrv, claimableFees, claimFeesEstimateGas, claimFees, lastEthBlock, getAnycallBalance, topUpAnycall, topUpAnycallEstimateGas, lastBlockSent, blockToSend, sendBlockhash, sendBlockhashEstimateGas, submitProof, submitProofEstimateGas, claimFeesCrvUSDEstimateGas, claimableFeesCrvUSD, claimFeesCrvUSD, } from "./boosting.js";
|
|
42
42
|
import { getBalances, getAllowance, hasAllowance, ensureAllowanceEstimateGas, ensureAllowance, getUsdRate, getGasPriceFromL1, getGasPriceFromL2, getGasInfoForL2, getTVL, getCoinsData, getVolume, hasDepositAndStake, hasRouter, getBasePools, getGasPrice, } from "./utils.js";
|
|
43
43
|
import { deployStablePlainPool, deployStablePlainPoolEstimateGas, getDeployedStablePlainPoolAddress, setOracle, setOracleEstimateGas, deployStableMetaPool, deployStableMetaPoolEstimateGas, getDeployedStableMetaPoolAddress, deployCryptoPool, deployCryptoPoolEstimateGas, getDeployedCryptoPoolAddress, deployTricryptoPool, deployTricryptoPoolEstimateGas, getDeployedTricryptoPoolAddress, deployGauge, deployGaugeEstimateGas, getDeployedGaugeAddress, deployGaugeSidechain, deployGaugeSidechainEstimateGas, deployGaugeMirror, deployGaugeMirrorEstimateGas, getDeployedGaugeMirrorAddress, getDeployedGaugeMirrorAddressByTx, deployStableNgPlainPool, deployStableNgPlainPoolEstimateGas, deployStableNgMetaPool, deployStableNgMetaPoolEstimateGas, deployTwocryptoPool, deployTwocryptoPoolEstimateGas, getDeployedTwocryptoPoolAddress, } from './factory/deploy.js';
|
|
44
|
-
import { crvSupplyStats, userCrv, userVeCrv, crvLockIsApproved, crvLockApproveEstimateGas, crvLockApprove, calcCrvUnlockTime, createCrvLockEstimateGas, createCrvLock, increaseCrvLockedAmountEstimateGas, increaseCrvLockedAmount, increaseCrvUnlockTimeEstimateGas, increaseCrvUnlockTime, withdrawLockedCrvEstimateGas as daoWithdrawLockedCrvEstimateGas, withdrawLockedCrv as daoWithdrawLockedCrv, claimableFees as daoClaimableFees, claimFeesEstimateGas as daoClaimFeesEstimateGas, claimFees as daoClaimFees, getVotingGaugeList, userGaugeVotes, voteForGaugeNextTime, voteForGaugeEstimateGas, voteForGauge, getProposalList, getProposal, userProposalVotes, voteForProposalEstimateGas, voteForProposal, } from "./dao.js";
|
|
44
|
+
import { crvSupplyStats, userCrv, userVeCrv, crvLockIsApproved, crvLockApproveEstimateGas, crvLockApprove, calcCrvUnlockTime, createCrvLockEstimateGas, createCrvLock, increaseCrvLockedAmountEstimateGas, increaseCrvLockedAmount, increaseCrvUnlockTimeEstimateGas, increaseCrvUnlockTime, withdrawLockedCrvEstimateGas as daoWithdrawLockedCrvEstimateGas, withdrawLockedCrv as daoWithdrawLockedCrv, claimableFees as daoClaimableFees, claimFeesEstimateGas as daoClaimFeesEstimateGas, claimFees as daoClaimFees, getVotingGaugeList, userGaugeVotes, voteForGaugeNextTime, voteForGaugeEstimateGas, voteForGauge, getProposalList, getProposal, userProposalVotes, voteForProposalEstimateGas, voteForProposal, executeVote, executeVoteEstimateGas, isCanVoteExecute, } from "./dao.js";
|
|
45
45
|
function init(providerType, providerSettings, options) {
|
|
46
46
|
if (options === void 0) { options = {}; }
|
|
47
47
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -350,6 +350,8 @@ var curve = {
|
|
|
350
350
|
userProposalVotes: userProposalVotes,
|
|
351
351
|
// Transaction methods
|
|
352
352
|
voteForProposal: voteForProposal,
|
|
353
|
+
executeVote: executeVote,
|
|
354
|
+
isCanVoteExecute: isCanVoteExecute,
|
|
353
355
|
estimateGas: {
|
|
354
356
|
// --- CRV lock ---
|
|
355
357
|
crvLockApprove: crvLockApproveEstimateGas,
|
|
@@ -362,6 +364,7 @@ var curve = {
|
|
|
362
364
|
voteForGauge: voteForGaugeEstimateGas,
|
|
363
365
|
// --- Proposal voting ---
|
|
364
366
|
voteForProposal: voteForProposalEstimateGas,
|
|
367
|
+
executeVote: executeVoteEstimateGas,
|
|
365
368
|
},
|
|
366
369
|
},
|
|
367
370
|
};
|
package/lib/interfaces.d.ts
CHANGED
package/lib/pools/gaugePool.js
CHANGED
|
@@ -52,9 +52,9 @@ var GaugePool = /** @class */ (function () {
|
|
|
52
52
|
this.address = address;
|
|
53
53
|
this.poolName = poolName;
|
|
54
54
|
this.estimateGas = {
|
|
55
|
-
addReward: this.addRewardEstimateGas,
|
|
56
|
-
depositRewardApprove: this.depositRewardApproveEstimateGas,
|
|
57
|
-
depositReward: this.depositRewardEstimateGas,
|
|
55
|
+
addReward: this.addRewardEstimateGas.bind(this),
|
|
56
|
+
depositRewardApprove: this.depositRewardApproveEstimateGas.bind(this),
|
|
57
|
+
depositReward: this.depositRewardEstimateGas.bind(this),
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
GaugePool.prototype.gaugeManager = function () {
|
package/lib/utils.js
CHANGED
|
@@ -352,7 +352,6 @@ export var _ensureAllowance = function (coins, amounts, spender, isMax) {
|
|
|
352
352
|
return [4 /*yield*/, contract.approve(spender, curve.parseUnits("0"), __assign(__assign({}, curve.options), { gasLimit: gasLimit_1 }))];
|
|
353
353
|
case 5:
|
|
354
354
|
resetTx = _e.sent();
|
|
355
|
-
console.log("Reset approval tx hash: ".concat(resetTx.hash));
|
|
356
355
|
txHashes.push(resetTx.hash);
|
|
357
356
|
return [4 /*yield*/, resetTx.wait()];
|
|
358
357
|
case 6:
|
|
@@ -367,7 +366,6 @@ export var _ensureAllowance = function (coins, amounts, spender, isMax) {
|
|
|
367
366
|
return [4 /*yield*/, contract.approve(spender, _approveAmount, __assign(__assign({}, curve.options), { gasLimit: gasLimit }))];
|
|
368
367
|
case 9:
|
|
369
368
|
approveTx = _e.sent();
|
|
370
|
-
console.log("Set approval tx hash: ".concat(approveTx.hash));
|
|
371
369
|
txHashes.push(approveTx.hash);
|
|
372
370
|
return [4 /*yield*/, approveTx.wait()];
|
|
373
371
|
case 10:
|