@exodus/asset-json-rpc
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -19,3 +19,3 @@ "use strict"; | ||
function createApi(url, options = {}) { | ||
const api = (0, _wretch.default)(url).middlewares([next => async (url, options) => { | ||
return (0, _wretch.default)(url).middlewares([next => async (url, options) => { | ||
const body = JSON.stringify(_objectSpread({ | ||
@@ -30,11 +30,16 @@ jsonrpc: '2.0', | ||
}]).resolve(async res => { | ||
const json = await res.json(); | ||
const { | ||
result, | ||
error | ||
} = await res.json(); | ||
if (json.error) { | ||
throw new Error(json.error.message); | ||
if (error) { | ||
const err = new Error(error.message); | ||
err.code = error.code; | ||
err.data = error.data; | ||
throw err; | ||
} | ||
return json.result; | ||
return result; | ||
}); | ||
return api; | ||
} |
{ | ||
"name": "@exodus/asset-json-rpc", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "For all assets", | ||
@@ -15,3 +15,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "667137c8e5d45965140ccbfc5859b04af86d446d" | ||
"gitHead": "f95d996683e3a395f281403a355eb21ef4fd9b22" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
3463
3
35
1
41