tso-data-models
Advanced tools
Comparing version 1.0.112 to 1.0.113
@@ -8,2 +8,3 @@ import { BigNumber, ethers } from "ethers"; | ||
getTotalVotePower: () => Promise<BigNumber>; | ||
getTotalVotePowerOfAnAddress: (addressToCheck: string) => Promise<BigNumber>; | ||
getVotePowerDelegatedFromAnAddress: (fromAddress: string, toAddress: string) => Promise<BigNumber>; | ||
@@ -10,0 +11,0 @@ getVotePowerDelegatedFromAnAddressAtBlock: (fromAddress: string, toAddress: string, block: number) => Promise<BigNumber>; |
@@ -66,3 +66,3 @@ "use strict"; | ||
}); }; | ||
this.getVotePowerDelegatedFromAnAddress = function (fromAddress, toAddress) { return __awaiter(_this, void 0, void 0, function () { | ||
this.getTotalVotePowerOfAnAddress = function (addressToCheck) { return __awaiter(_this, void 0, void 0, function () { | ||
var valueToReturn, error_2; | ||
@@ -76,3 +76,3 @@ return __generator(this, function (_a) { | ||
_a.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, this.wrappedTokenContract.votePowerFromTo(fromAddress, toAddress)]; | ||
return [4 /*yield*/, this.wrappedTokenContract.votePowerOf(addressToCheck)]; | ||
case 2: | ||
@@ -89,3 +89,3 @@ valueToReturn = _a.sent(); | ||
}); }; | ||
this.getVotePowerDelegatedFromAnAddressAtBlock = function (fromAddress, toAddress, block) { return __awaiter(_this, void 0, void 0, function () { | ||
this.getVotePowerDelegatedFromAnAddress = function (fromAddress, toAddress) { return __awaiter(_this, void 0, void 0, function () { | ||
var valueToReturn, error_3; | ||
@@ -99,3 +99,3 @@ return __generator(this, function (_a) { | ||
_a.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, this.wrappedTokenContract.votePowerFromToAt(fromAddress, toAddress, block)]; | ||
return [4 /*yield*/, this.wrappedTokenContract.votePowerFromTo(fromAddress, toAddress)]; | ||
case 2: | ||
@@ -112,3 +112,3 @@ valueToReturn = _a.sent(); | ||
}); }; | ||
this.getAddressesDelegatedTo = function (addressToGet) { return __awaiter(_this, void 0, void 0, function () { | ||
this.getVotePowerDelegatedFromAnAddressAtBlock = function (fromAddress, toAddress, block) { return __awaiter(_this, void 0, void 0, function () { | ||
var valueToReturn, error_4; | ||
@@ -118,7 +118,7 @@ return __generator(this, function (_a) { | ||
case 0: | ||
valueToReturn = []; | ||
valueToReturn = ethers_1.BigNumber.from(0); | ||
_a.label = 1; | ||
case 1: | ||
_a.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, this.wrappedTokenContract.delegatesOf(addressToGet)]; | ||
return [4 /*yield*/, this.wrappedTokenContract.votePowerFromToAt(fromAddress, toAddress, block)]; | ||
case 2: | ||
@@ -135,3 +135,3 @@ valueToReturn = _a.sent(); | ||
}); }; | ||
this.unDelegateAll = function (addressToGet) { return __awaiter(_this, void 0, void 0, function () { | ||
this.getAddressesDelegatedTo = function (addressToGet) { return __awaiter(_this, void 0, void 0, function () { | ||
var valueToReturn, error_5; | ||
@@ -157,4 +157,25 @@ return __generator(this, function (_a) { | ||
}); }; | ||
this.unDelegateAll = function (addressToGet) { return __awaiter(_this, void 0, void 0, function () { | ||
var valueToReturn, error_6; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
valueToReturn = []; | ||
_a.label = 1; | ||
case 1: | ||
_a.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, this.wrappedTokenContract.delegatesOf(addressToGet)]; | ||
case 2: | ||
valueToReturn = _a.sent(); | ||
return [2 /*return*/, valueToReturn]; | ||
case 3: | ||
error_6 = _a.sent(); | ||
console.log('error ', error_6); | ||
return [2 /*return*/, valueToReturn]; | ||
case 4: return [2 /*return*/]; | ||
} | ||
}); | ||
}); }; | ||
this.handleDelegation = function (tsoAddress, percentage) { return __awaiter(_this, void 0, void 0, function () { | ||
var formattedPercentage, error_6; | ||
var formattedPercentage, error_7; | ||
return __generator(this, function (_a) { | ||
@@ -168,4 +189,4 @@ switch (_a.label) { | ||
case 2: | ||
error_6 = _a.sent(); | ||
console.log('error ', error_6); | ||
error_7 = _a.sent(); | ||
console.log('error ', error_7); | ||
return [2 /*return*/]; | ||
@@ -177,3 +198,3 @@ case 3: return [2 /*return*/]; | ||
this.wrapTokensDeposit = function (addressToGet, amountToDeposit) { return __awaiter(_this, void 0, void 0, function () { | ||
var error_7; | ||
var error_8; | ||
return __generator(this, function (_a) { | ||
@@ -186,4 +207,4 @@ switch (_a.label) { | ||
case 2: | ||
error_7 = _a.sent(); | ||
console.log('error ', error_7); | ||
error_8 = _a.sent(); | ||
console.log('error ', error_8); | ||
return [2 /*return*/]; | ||
@@ -195,3 +216,3 @@ case 3: return [2 /*return*/]; | ||
this.unWrapTokensWithdraw = function (amountToWd) { return __awaiter(_this, void 0, void 0, function () { | ||
var error_8; | ||
var error_9; | ||
return __generator(this, function (_a) { | ||
@@ -204,4 +225,4 @@ switch (_a.label) { | ||
case 2: | ||
error_8 = _a.sent(); | ||
console.log('error ', error_8); | ||
error_9 = _a.sent(); | ||
console.log('error ', error_9); | ||
return [2 /*return*/]; | ||
@@ -219,3 +240,3 @@ case 3: return [2 /*return*/]; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var error_9; | ||
var error_10; | ||
return __generator(this, function (_a) { | ||
@@ -228,4 +249,4 @@ switch (_a.label) { | ||
case 2: | ||
error_9 = _a.sent(); | ||
console.log('Error ', error_9); | ||
error_10 = _a.sent(); | ||
console.log('Error ', error_10); | ||
return [2 /*return*/, ethers_1.BigNumber.from(0)]; | ||
@@ -232,0 +253,0 @@ case 3: return [2 /*return*/]; |
{ | ||
"name": "tso-data-models", | ||
"version": "1.0.112", | ||
"version": "1.0.113", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -30,2 +30,12 @@ import { BigNumber, ethers } from "ethers"; | ||
} | ||
getTotalVotePowerOfAnAddress = async (addressToCheck: string): Promise<BigNumber> => { | ||
let valueToReturn: BigNumber = BigNumber.from(0); | ||
try { | ||
valueToReturn = await this.wrappedTokenContract.votePowerOf(addressToCheck); | ||
return valueToReturn; | ||
} catch (error) { | ||
console.log('error ', error); | ||
return valueToReturn; | ||
} | ||
} | ||
@@ -32,0 +42,0 @@ getVotePowerDelegatedFromAnAddress = async (fromAddress: string, toAddress: string): Promise<BigNumber> => { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
143919
2143