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

Commit

Permalink
Merge 050893b into 9ec272d
Browse files Browse the repository at this point in the history
  • Loading branch information
satello committed Nov 7, 2018
2 parents 9ec272d + 050893b commit f7313f2
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "kleros-api",
"name": "kleros-api-2",
"version": "0.18.7",
"description": "A Javascript library that makes it easy to build relayers and other DApps that use the Kleros protocol.",
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,23 @@ class MultipleArbitrableTransaction extends Arbitrable {
setArbitrableTransactionId = arbitrableTransactionId =>
(this.arbitrableTransactionId = arbitrableTransactionId)

/**
* Fetch the parties involved in the arbitrable transaction contract.
* @returns {object} returns a mapping of partyA and partyB to ETH addresses.
*/
getParties = async (arbitrableTransactionId) => {
await this.loadContract()

const arbitrableTransaction = await this.contractInstance.transactions(
arbitrableTransactionId
)

return {
seller: arbitrableTransaction[0],
buyer: arbitrableTransaction[1]
}
}

/**
* Data of the contract
* @param {number} arbitrableTransactionId - The index of the transaction.
Expand Down
1 change: 1 addition & 0 deletions src/contracts/implementations/arbitrator/Kleros.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ class Kleros extends ContractImplementation {

let voteCounters = []
const status = await this.contractInstance.disputeStatus(disputeID)

if (withVoteCount) {
for (let appeal = 0; appeal <= numberOfAppeals; appeal++) {
const voteCounts = []
Expand Down
6 changes: 2 additions & 4 deletions src/resources/Disputes.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,8 @@ class Disputes {
* @returns {number} timestamp of the appeal
*/
getAppealRuledAt = async (disputeID, appeal = 0) => {
const cachedDispute = this.disputeCache[disputeID]
const cachedDispute = this.disputeCache[disputeID] || {}
if (
cachedDispute &&
cachedDispute.appealRuledAt &&
cachedDispute.appealRuledAt[appeal]
)
Expand Down Expand Up @@ -253,9 +252,8 @@ class Disputes {
* @returns {number} timestamp of the appeal
*/
getAppealCreatedAt = async (disputeID, account, appeal = 0) => {
const cachedDispute = this.disputeCache[disputeID]
const cachedDispute = this.disputeCache[disputeID] || {}
if (
cachedDispute &&
cachedDispute.appealCreatedAt &&
cachedDispute.appealCreatedAt[appeal]
)
Expand Down
2 changes: 1 addition & 1 deletion src/utils/StoreProviderWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class StoreProviderWrapper {
userProfile.disputes,
o =>
o.arbitratorAddress === arbitratorAddress && o.disputeId === disputeID
)[0]
)[0] || {}
dispute.disputeID = dispute.disputeId
return dispute
}
Expand Down

0 comments on commit f7313f2

Please sign in to comment.