@kava-labs/javascript-sdk
Advanced tools
Comparing version 2.0.0-beta.1 to 2.0.0-beta.2
{ | ||
"name": "@kava-labs/javascript-sdk", | ||
"version": "2.0.0-beta.1", | ||
"version": "2.0.0-beta.2", | ||
"description": "Supports interaction with the Kava blockchain via a REST api", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -129,10 +129,2 @@ const sig = require("@kava-labs/sig"); | ||
/** | ||
* Get information about the account's chain state | ||
* @return {Promise} | ||
*/ | ||
async getAccountData() { | ||
return tx.loadMetaData(this.wallet.address, this.baseURI); | ||
} | ||
/*************************************************** | ||
@@ -139,0 +131,0 @@ * GET tx methods |
@@ -21,12 +21,3 @@ const sig = require("@kava-labs/sig"); | ||
} catch (err) { | ||
// Log status and error or network error | ||
const status = _.get(err, "response.status"); | ||
const statusText = _.get(err, "response.statusText"); | ||
const error = _.get(err, "response.data.error"); | ||
status ? console.log("Status:", status) : null; | ||
statusText ? console.log("Status text:", statusText) : null; | ||
error ? console.log("Error:", error) : null; | ||
if (!status && !statusText && !error) { | ||
console.log("Network error:", err); | ||
} | ||
logErr(err) | ||
} | ||
@@ -42,5 +33,4 @@ } | ||
async function loadMetaData(address, base) { | ||
const path = api.getAccount + "/" + address; | ||
const path = api.getAccount + "/" + address; | ||
const res = await getTx(path, base); | ||
accNum = _.get(res, "data.result.value.account_number"); | ||
@@ -89,12 +79,3 @@ seqNum = _.get(res, "data.result.value.sequence"); | ||
} catch (err) { | ||
// Log status and error or network error | ||
const status = _.get(err, "response.status"); | ||
const statusText = _.get(err, "response.statusText"); | ||
const error = _.get(err, "response.data.error"); | ||
status ? console.log("Status:", status) : null; | ||
statusText ? console.log("Status text:", statusText) : null; | ||
error ? console.log("Error:", error) : null; | ||
if (!status && !statusText && !error) { | ||
console.log("Network error:", err); | ||
} | ||
logErr(err) | ||
} | ||
@@ -116,2 +97,21 @@ | ||
/** | ||
* Parses and logs tx-related errors | ||
* @param {object} err an error resulting from a tx-related action | ||
*/ | ||
const logErr = (err) => { | ||
// Load status, status text, and error | ||
const status = _.get(err, "response.status"); | ||
const statusText = _.get(err, "response.statusText"); | ||
const error = _.get(err, "response.data.error"); | ||
// Log status, status text, and error, or if unidentified, log network error | ||
status ? console.log("Status:", status) : null; | ||
statusText ? console.log("Status text:", statusText) : null; | ||
error ? console.log("Error:", error) : null; | ||
if (!status && !statusText && !error) { | ||
console.log("Network error:", err); | ||
} | ||
}; | ||
module.exports.tx = { | ||
@@ -121,3 +121,4 @@ getTx, | ||
signTx, | ||
broadcastTx | ||
broadcastTx, | ||
logErr | ||
}; |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
46617
9
975