Skip to content
Permalink
Browse files

fix: timestamps caching error

  • Loading branch information...
satello committed Nov 7, 2018
1 parent 9ec272d commit d20e40261490ca13fec84c49766a349492649581
@@ -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": [
@@ -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.
@@ -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 = []
@@ -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]
)
@@ -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]
)
@@ -116,7 +116,7 @@ class StoreProviderWrapper {
userProfile.disputes,
o =>
o.arbitratorAddress === arbitratorAddress && o.disputeId === disputeID
)[0]
)[0] || {}
dispute.disputeID = dispute.disputeId
return dispute
}

0 comments on commit d20e402

Please sign in to comment.
You can’t perform that action at this time.