Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

Commit

Permalink
fix(kleros): get the current ruling
Browse files Browse the repository at this point in the history
  • Loading branch information
n1c01a5 committed Nov 14, 2018
1 parent b9f931c commit b4a5adf
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kleros-api-2",
"version": "0.18.11",
"version": "0.18.12",
"description": "A Javascript library that makes it easy to build relayers and other DApps that use the Kleros protocol.",
"keywords": [
"Blockchain",
Expand Down
8 changes: 2 additions & 6 deletions src/contracts/implementations/arbitrator/Kleros.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,16 +449,12 @@ class Kleros extends ContractImplementation {
/**
* Get number of jurors for a dispute.
* @param {number} disputeID - Index of dispute.
* @param {number} appeal - Index of appeal.
* @returns {number} - Int indicating the ruling of the dispute.
*/
currentRulingForDispute = async (disputeID, appeal) => {
currentRulingForDispute = async disputeID => {
await this.loadContract()

const ruling = await this.contractInstance.getWinningChoice(
disputeID,
appeal
)
const ruling = await this.contractInstance.currentRuling(disputeID)

return ruling.toNumber()
}
Expand Down
2 changes: 1 addition & 1 deletion src/resources/Disputes.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ class Disputes {
let canExecute = false
let ruling
const rulingPromises = [
this._ArbitratorInstance.currentRulingForDispute(disputeID, appeal)
this._ArbitratorInstance.currentRulingForDispute(disputeID)
]

// Extra info for the last appeal
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/resources/Disputes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ describe('Disputes', () => {
getDispute: mockArbitratorGetDispute,
getPeriod: jest.fn().mockReturnValue(period),
getSession: jest.fn().mockReturnValue(session),
currentRulingForDispute: jest.fn().mockReturnValue(2),
currentRulingForDispute: jest.fn().mockReturnValue(1),
canRuleDispute: jest.fn().mockReturnValue(true),
getContractAddress: jest.fn().mockReturnValue(arbitratorAddress),
getDisputeCreationEvent: jest.fn().mockReturnValue({ blockNumber: 1 }),
Expand Down Expand Up @@ -287,7 +287,7 @@ describe('Disputes', () => {
getDispute: mockArbitratorGetDispute,
getPeriod: jest.fn().mockReturnValue(period),
getSession: jest.fn().mockReturnValue(session),
currentRulingForDispute: jest.fn().mockReturnValue(2),
currentRulingForDispute: jest.fn().mockReturnValue(1),
canRuleDispute: jest.fn().mockReturnValue(false),
getContractAddress: jest.fn().mockReturnValue(arbitratorAddress),
getDisputeCreationEvent: jest.fn().mockReturnValue({ blockNumber: 1 }),
Expand Down Expand Up @@ -404,7 +404,7 @@ describe('Disputes', () => {
getDispute: mockArbitratorGetDispute,
getPeriod: jest.fn().mockReturnValue(period),
getSession: jest.fn().mockReturnValue(session),
currentRulingForDispute: jest.fn().mockReturnValue(2),
currentRulingForDispute: jest.fn().mockReturnValue(1),
canRuleDispute: jest.fn().mockReturnValue(false),
getContractAddress: jest.fn().mockReturnValue(arbitratorAddress),
getDisputeCreationEvent: jest.fn().mockReturnValue({ blockNumber: 1 }),
Expand Down

0 comments on commit b4a5adf

Please sign in to comment.