tso-data-models
Advanced tools
Comparing version 1.0.115 to 1.0.116
@@ -6,4 +6,7 @@ import { ethers } from "ethers"; | ||
epochNumber: number; | ||
registryAddress: string; | ||
providerAddress: string; | ||
listOfHashes: any[]; | ||
listOfPrices: any[]; | ||
listOfRandoms: any[]; | ||
targetSubmitTime?: number; | ||
@@ -20,5 +23,6 @@ actualSubmitTime?: number; | ||
isTargetSubmitTime(): boolean; | ||
preparePriceHashesForSubmission(listOfFTSOs: [], listOfPrices: AssetSubmission, providerAddress: string): void; | ||
submitTransaction(signer: ethers.Signer): Promise<any>; | ||
preparePriceHashesForSubmission(listOfFTSOs: string[], listOfPrices: AssetSubmission, providerAddress: string): void; | ||
submitPriceHashes(contractAddress: string, provider: ethers.providers.JsonRpcProvider, listOfIndices: number[]): Promise<any>; | ||
revealPrices(contractAddress: string, provider: ethers.providers.JsonRpcProvider, epochId: number, listOfIndices: number[]): Promise<any>; | ||
} | ||
//# sourceMappingURL=EpochSubmission.d.ts.map |
@@ -40,5 +40,9 @@ "use strict"; | ||
exports.EpochSubmission = void 0; | ||
var ethers_1 = require("ethers"); | ||
var EpochSubmission = /** @class */ (function () { | ||
function EpochSubmission(submitterAddress, epochData, submitDelay) { | ||
this.registryAddress = ''; | ||
this.listOfHashes = []; | ||
this.listOfPrices = []; | ||
this.listOfRandoms = []; | ||
this.providerAddress = submitterAddress; | ||
@@ -66,11 +70,30 @@ this.initializeSubmissionData(epochData, submitDelay); | ||
}; | ||
EpochSubmission.prototype.submitTransaction = function (signer) { | ||
EpochSubmission.prototype.submitPriceHashes = function (contractAddress, provider, listOfIndices) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var abi; | ||
var abi, submitterContract; | ||
return __generator(this, function (_a) { | ||
abi = ["function submitPriceHashes(uint256[] memory _ftsoIndices, bytes32[] memory _hashes) "]; | ||
return [2 /*return*/]; | ||
switch (_a.label) { | ||
case 0: | ||
abi = ["function submitPriceHashes(uint256[] memory _ftsoIndices, bytes32[] memory _hashes) external"]; | ||
submitterContract = new ethers_1.ethers.Contract(contractAddress, abi, provider.getSigner()); | ||
return [4 /*yield*/, submitterContract.submitPriceHashes(listOfIndices, this.listOfHashes)]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
EpochSubmission.prototype.revealPrices = function (contractAddress, provider, epochId, listOfIndices) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var abi, submitterContract; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
abi = ["function revealPrices(uint256 _epochId, uint256[] memory _ftsoIndices, uint256[] memory _prices, uint256[] memory _randoms) external"]; | ||
submitterContract = new ethers_1.ethers.Contract(contractAddress, abi, provider.getSigner()); | ||
return [4 /*yield*/, submitterContract.revealPrices(epochId, listOfIndices)]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
return EpochSubmission; | ||
@@ -77,0 +100,0 @@ }()); |
@@ -6,6 +6,4 @@ export declare class FTSOPriceSubmitter { | ||
constructor(voterAddress: string, whitelisterContractAddress: string, ftsoIndex: number); | ||
submitPriceHashes(): Promise<any>; | ||
revealPrices(): Promise<any>; | ||
requestFullVoterWhitelisting(): Promise<any>; | ||
} | ||
//# sourceMappingURL=FTSOPriceSubmitter.d.ts.map |
@@ -48,32 +48,2 @@ "use strict"; | ||
} | ||
FTSOPriceSubmitter.prototype.submitPriceHashes = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var testWallet, abi, whitelisterContract; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
testWallet = ethers_1.ethers.Wallet.fromMnemonic(abis_1.TEST_MNEMONIC); | ||
abi = ["function submitPriceHashes(uint256[] memory _ftsoIndices, bytes32[] memory _hashes) external"]; | ||
whitelisterContract = new ethers_1.ethers.Contract(this.whitelisterContractAddress, abi, testWallet); | ||
return [4 /*yield*/, whitelisterContract.submitPriceHashes(this.voterAddress)]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
FTSOPriceSubmitter.prototype.revealPrices = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var testWallet, abi, whitelisterContract; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
testWallet = ethers_1.ethers.Wallet.fromMnemonic(abis_1.TEST_MNEMONIC); | ||
abi = ["function revealPrices(uint256 _epochId, uint256[] memory _ftsoIndices, uint256[] memory _prices, uint256[] memory _randoms) external"]; | ||
whitelisterContract = new ethers_1.ethers.Contract(this.whitelisterContractAddress, abi, testWallet); | ||
return [4 /*yield*/, whitelisterContract.revealPrices(this.voterAddress)]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
FTSOPriceSubmitter.prototype.requestFullVoterWhitelisting = function () { | ||
@@ -80,0 +50,0 @@ return __awaiter(this, void 0, void 0, function () { |
{ | ||
"name": "tso-data-models", | ||
"version": "1.0.115", | ||
"version": "1.0.116", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -8,4 +8,7 @@ import { BigNumber, ethers } from "ethers"; | ||
epochNumber: number; | ||
registryAddress = ''; | ||
providerAddress: string; | ||
listOfHashes: any[] = []; | ||
listOfPrices: any[] = []; | ||
listOfRandoms: any[] = []; | ||
targetSubmitTime?: number; | ||
@@ -37,5 +40,4 @@ actualSubmitTime?: number; | ||
preparePriceHashesForSubmission(listOfFTSOs: [], listOfPrices: AssetSubmission, providerAddress: string) { | ||
preparePriceHashesForSubmission(listOfFTSOs: string[], listOfPrices: AssetSubmission, providerAddress: string) { | ||
this.listOfHashes = []; | ||
for (let i = 0; i < listOfFTSOs.length; i++) { | ||
@@ -47,11 +49,18 @@ const ftso = listOfFTSOs[i]; | ||
} | ||
} | ||
async submitPriceHashes(contractAddress: string, provider: ethers.providers.JsonRpcProvider, listOfIndices: number[]): Promise<any> { | ||
const abi = ["function submitPriceHashes(uint256[] memory _ftsoIndices, bytes32[] memory _hashes) external"]; | ||
const submitterContract = new ethers.Contract(contractAddress, abi, provider.getSigner()); | ||
return await submitterContract.submitPriceHashes(listOfIndices, this.listOfHashes); | ||
} | ||
async submitTransaction(signer: ethers.Signer): Promise<any> { | ||
const abi = ["function submitPriceHashes(uint256[] memory _ftsoIndices, bytes32[] memory _hashes) "]; | ||
//const priceSubmitter = new ethers.Contract(FTSO_REGISTRY_ADDRESS, abi, signer.getSigner()); | ||
// return await priceSubmitter.submitPriceHashes([], this.listOfHashes); | ||
async revealPrices(contractAddress: string, provider: ethers.providers.JsonRpcProvider, epochId: number, listOfIndices: number[]): Promise<any> { | ||
const abi = ["function revealPrices(uint256 _epochId, uint256[] memory _ftsoIndices, uint256[] memory _prices, uint256[] memory _randoms) external"]; | ||
const submitterContract = new ethers.Contract(contractAddress, abi, provider.getSigner()); | ||
return await submitterContract.revealPrices(epochId, listOfIndices, ); | ||
} | ||
} |
@@ -20,18 +20,5 @@ import { BigNumber, ethers } from "ethers"; | ||
async submitPriceHashes(): Promise<any> { | ||
const testWallet: ethers.Wallet = ethers.Wallet.fromMnemonic(TEST_MNEMONIC); | ||
const abi = ["function submitPriceHashes(uint256[] memory _ftsoIndices, bytes32[] memory _hashes) external"]; | ||
const whitelisterContract = new ethers.Contract(this.whitelisterContractAddress, abi, testWallet); | ||
return await whitelisterContract.submitPriceHashes(this.voterAddress); | ||
} | ||
async revealPrices(): Promise<any> { | ||
const testWallet: ethers.Wallet = ethers.Wallet.fromMnemonic(TEST_MNEMONIC); | ||
const abi = ["function revealPrices(uint256 _epochId, uint256[] memory _ftsoIndices, uint256[] memory _prices, uint256[] memory _randoms) external"]; | ||
const whitelisterContract = new ethers.Contract(this.whitelisterContractAddress, abi, testWallet); | ||
return await whitelisterContract.revealPrices(this.voterAddress); | ||
} | ||
async requestFullVoterWhitelisting(): Promise<any> { | ||
@@ -38,0 +25,0 @@ const testWallet: ethers.Wallet = ethers.Wallet.fromMnemonic(TEST_MNEMONIC); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
143713
2115