1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00

Sending chainId as a param

This commit is contained in:
Jamie Hewitt 2022-12-08 13:23:28 +03:00
parent 6b63acc701
commit 661b4fd96d

View File

@ -132,20 +132,22 @@ export class Provider {
providerUri,
providerEndpoints
)
const path = this.getEndpointURL(serviceEndpoints, 'encrypt')
? this.getEndpointURL(serviceEndpoints, 'encrypt').urlPath
: null
const path =
(this.getEndpointURL(serviceEndpoints, 'encrypt')
? this.getEndpointURL(serviceEndpoints, 'encrypt').urlPath
: null) + `?chainId=${chainId}`
if (!path) return null
const body = { chainId, data }
console.log('Path:', path)
try {
const response = await fetch(path, {
method: 'POST',
body: JSON.stringify(body),
body: JSON.stringify(data),
headers: { 'Content-Type': 'application/octet-stream' },
signal
})
return await response.text()
} catch (e) {
console.log('Error:', e)
LoggerInstance.error(e)
throw new Error('HTTP request failed calling Provider')
}