@@ -48,7 +48,7 @@ class Arbitrable extends StandardContract {
48
48
* @param {string } contractAddress - The address of the arbitrable contract.
49
49
* @param {string } arbitratorAddress - The address of the arbitrator contract.
50
50
* @param {number } evidenceGroupID - The index of the evidence group.
51
- * @param {object } options - Additional paramaters. Includes fromBlock, toBlock, filters, strictHashes, strict
51
+ * @param {object } options - Additional paramaters. Includes fromBlock, toBlock, filters, strict
52
52
* @returns {object[] } An array of evidence objects
53
53
*/
54
54
getEvidence = async (
@@ -84,7 +84,6 @@ class Arbitrable extends StandardContract {
84
84
const { file : evidenceJSON , isValid : evidenceJSONValid } = await validateFileFromURI ( evidenceURI , {
85
85
preValidated,
86
86
strict,
87
- strictHashes : options . strictHashes ,
88
87
customHashFn : options . customHashFn ,
89
88
} ) ;
90
89
@@ -98,7 +97,6 @@ class Arbitrable extends StandardContract {
98
97
await validateFileFromURI ( evidenceURI , {
99
98
preValidated,
100
99
strict,
101
- strictHashes : options . strictHashes ,
102
100
hash : evidenceJSON . fileHash ,
103
101
customHashFn : options . customHashFn ,
104
102
} )
@@ -144,14 +142,15 @@ class Arbitrable extends StandardContract {
144
142
* NOTE: If more than one MetaEvidence with the same metaEvidenceID is found it will return the 1st one.
145
143
* @param {string } contractAddress - The address of the Arbitrable contract.
146
144
* @param {number } metaEvidenceID - The identifier of the metaEvidence log.
147
- * @param {object } options - Additional paramaters. Includes fromBlock, toBlock, strictHashes
145
+ * @param {object } options - Additional paramaters. Includes fromBlock, toBlock, strict, getJsonRpcUrl
148
146
* @returns {object } The metaEvidence object
149
147
*/
150
- getMetaEvidence = async (
148
+ async getMetaEvidence (
151
149
contractAddress = isRequired ( "contractAddress" ) ,
152
150
metaEvidenceID = isRequired ( "metaEvidenceID" ) ,
153
151
options = { }
154
- ) => {
152
+ ) {
153
+ const { getJsonRpcUrl = ( ) => { } } = options ;
155
154
const strict = options . strict || options . strictHashes ;
156
155
const contractInstance = this . _loadContractInstance ( contractAddress ) ;
157
156
@@ -178,7 +177,6 @@ class Arbitrable extends StandardContract {
178
177
const { file : _metaEvidenceJSON , isValid : metaEvidenceJSONValid } = await validateFileFromURI ( metaEvidenceUri , {
179
178
preValidated,
180
179
strict,
181
- strictHashes : options . strictHashes ,
182
180
customHashFn : options . customHashFn ,
183
181
} ) ;
184
182
@@ -209,7 +207,6 @@ class Arbitrable extends StandardContract {
209
207
const script = await validateFileFromURI ( scriptURI , {
210
208
preValidated,
211
209
strict,
212
- strictHashes : options . strictHashes ,
213
210
hash : metaEvidenceJSON . dynamicScriptHash ,
214
211
customHashFn : options . customHashFn ,
215
212
} ) ;
@@ -246,10 +243,51 @@ class Arbitrable extends StandardContract {
246
243
...scriptParameters ,
247
244
} ;
248
245
246
+ if ( injectedParameters . arbitrableContractAddress === undefined ) {
247
+ injectedParameters . arbitrableContractAddress = contractAddress ;
248
+ }
249
+
250
+ if ( injectedParameters . arbitratorChainID !== undefined ) {
251
+ injectedParameters . arbitratorJsonRpcUrl =
252
+ injectedParameters . arbitratorJsonRpcUrl || getJsonRpcUrl ( injectedParameters . arbitratorChainID ) ;
253
+ }
254
+
249
255
if ( injectedParameters . arbitrableChainID === undefined ) {
250
256
injectedParameters . arbitrableChainID = injectedParameters . arbitratorChainID ;
251
257
}
252
258
259
+ if (
260
+ injectedParameters . arbitrableChainID !== undefined &&
261
+ injectedParameters . arbitrableJsonRpcUrl === undefined
262
+ ) {
263
+ if ( injectedParameters . arbitrableChainID === injectedParameters . arbitratorChainID ) {
264
+ injectedParameters . arbitrableJsonRpcUrl = injectedParameters . arbitratorJsonRpcUrl ;
265
+ }
266
+
267
+ injectedParameters . arbitrableJsonRpcUrl =
268
+ injectedParameters . arbitrableJsonRpcUrl || getJsonRpcUrl ( injectedParameters . arbitrableChainID ) ;
269
+ }
270
+
271
+ if (
272
+ injectedParameters . arbitratorChainID !== undefined &&
273
+ injectedParameters . arbitratorJsonRpcUrl === undefined
274
+ ) {
275
+ console . warn (
276
+ `Could not obtain a valid 'arbitratorJsonRpcUrl' for chain ID ${ injectedParameters . arbitratorChainID } on the Arbitrator side.
277
+ You should either provide it directly or provide a 'options.getJsonRpcUrl(chainID: number) => string' callback.`
278
+ ) ;
279
+ }
280
+
281
+ if (
282
+ injectedParameters . arbitrableChainID !== undefined &&
283
+ injectedParameters . arbitrableJsonRpcUrl === undefined
284
+ ) {
285
+ console . warn (
286
+ `Could not obtain a valid 'arbitrableJsonRpcUrl' for chain ID ${ injectedParameters . arbitrableChainID } on the Arbitrable side.
287
+ You should either provide it directly or provide a 'options.getJsonRpcUrl(chainID: number) => string' callback.`
288
+ ) ;
289
+ }
290
+
253
291
const metaEvidenceEdits = await fetchDataFromScript ( script . file , injectedParameters ) ;
254
292
255
293
metaEvidenceJSON = {
@@ -277,7 +315,6 @@ class Arbitrable extends StandardContract {
277
315
await validateFileFromURI ( fileURI , {
278
316
preValidated,
279
317
strict,
280
- strictHashes : options . strictHashes ,
281
318
hash : metaEvidenceJSON . fileHash ,
282
319
customHashFn : options . customHashFn ,
283
320
} )
@@ -303,7 +340,6 @@ class Arbitrable extends StandardContract {
303
340
interfaceValid = (
304
341
await validateFileFromURI ( disputeInterfaceURI , {
305
342
strict,
306
- strictHashes : options . strictHashes ,
307
343
hash : metaEvidenceJSON . evidenceDisplayInterfaceHash ,
308
344
customHashFn : options . customHashFn ,
309
345
} )
@@ -326,7 +362,7 @@ class Arbitrable extends StandardContract {
326
362
blockNumber : metaEvidenceLog . blockNumber ,
327
363
transactionHash : metaEvidenceLog . transactionHash ,
328
364
} ;
329
- } ;
365
+ }
330
366
331
367
/**
332
368
* Fetch the ruling for a dispute.
0 commit comments