@cosmjs/tendermint-rpc
Advanced tools
Comparing version 0.29.5 to 0.30.0-beta.1
@@ -15,5 +15,4 @@ "use strict"; | ||
function toRfc3339WithNanoseconds(dateTime) { | ||
var _a, _b; | ||
const millisecondIso = dateTime.toISOString(); | ||
const nanoseconds = (_b = (_a = dateTime.nanoseconds) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : ""; | ||
const nanoseconds = dateTime.nanoseconds?.toString() ?? ""; | ||
return `${millisecondIso.slice(0, -1)}${nanoseconds.padStart(6, "0")}Z`; | ||
@@ -40,6 +39,5 @@ } | ||
function toSeconds(date) { | ||
var _a; | ||
return { | ||
seconds: Math.floor(date.getTime() / 1000), | ||
nanos: (date.getTime() % 1000) * 1000000 + ((_a = date.nanoseconds) !== null && _a !== void 0 ? _a : 0), | ||
nanos: (date.getTime() % 1000) * 1000000 + (date.nanoseconds ?? 0), | ||
}; | ||
@@ -46,0 +44,0 @@ } |
@@ -9,2 +9,5 @@ export { pubkeyToAddress, pubkeyToRawAddress, rawEd25519PubkeyToRawAddress, rawSecp256k1PubkeyToRawAddress, } from "./addresses"; | ||
export { Tendermint34Client } from "./tendermint34"; | ||
export * as tendermint37 from "./tendermint37"; | ||
export { Tendermint37Client } from "./tendermint37"; | ||
export { isTendermint34Client, isTendermint37Client, TendermintClient } from "./tendermintclient"; | ||
export { BlockIdFlag, CommitSignature, ValidatorEd25519Pubkey, ValidatorPubkey, ValidatorSecp256k1Pubkey, } from "./types"; |
@@ -26,3 +26,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BlockIdFlag = exports.Tendermint34Client = exports.tendermint34 = exports.VoteType = exports.SubscriptionEventType = exports.Method = exports.broadcastTxSyncSuccess = exports.broadcastTxCommitSuccess = exports.WebsocketClient = exports.HttpClient = exports.HttpBatchClient = exports.toSeconds = exports.toRfc3339WithNanoseconds = exports.fromSeconds = exports.fromRfc3339WithNanoseconds = exports.DateTime = exports.rawSecp256k1PubkeyToRawAddress = exports.rawEd25519PubkeyToRawAddress = exports.pubkeyToRawAddress = exports.pubkeyToAddress = void 0; | ||
exports.BlockIdFlag = exports.isTendermint37Client = exports.isTendermint34Client = exports.Tendermint37Client = exports.tendermint37 = exports.Tendermint34Client = exports.tendermint34 = exports.VoteType = exports.SubscriptionEventType = exports.Method = exports.broadcastTxSyncSuccess = exports.broadcastTxCommitSuccess = exports.WebsocketClient = exports.HttpClient = exports.HttpBatchClient = exports.toSeconds = exports.toRfc3339WithNanoseconds = exports.fromSeconds = exports.fromRfc3339WithNanoseconds = exports.DateTime = exports.rawSecp256k1PubkeyToRawAddress = exports.rawEd25519PubkeyToRawAddress = exports.pubkeyToRawAddress = exports.pubkeyToAddress = void 0; | ||
var addresses_1 = require("./addresses"); | ||
@@ -55,8 +55,10 @@ Object.defineProperty(exports, "pubkeyToAddress", { enumerable: true, get: function () { return addresses_1.pubkeyToAddress; } }); | ||
Object.defineProperty(exports, "Tendermint34Client", { enumerable: true, get: function () { return tendermint34_2.Tendermint34Client; } }); | ||
// Tendermint 0.35 support is not public. The implementation may break or be removed at any point in time. | ||
// See https://github.com/cosmos/cosmjs/issues/1225 for more context. | ||
// export * as tendermint35 from "./tendermint35"; | ||
// export { Tendermint35Client } from "./tendermint35"; | ||
exports.tendermint37 = __importStar(require("./tendermint37")); | ||
var tendermint37_1 = require("./tendermint37"); | ||
Object.defineProperty(exports, "Tendermint37Client", { enumerable: true, get: function () { return tendermint37_1.Tendermint37Client; } }); | ||
var tendermintclient_1 = require("./tendermintclient"); | ||
Object.defineProperty(exports, "isTendermint34Client", { enumerable: true, get: function () { return tendermintclient_1.isTendermint34Client; } }); | ||
Object.defineProperty(exports, "isTendermint37Client", { enumerable: true, get: function () { return tendermintclient_1.isTendermint37Client; } }); | ||
var types_1 = require("./types"); | ||
Object.defineProperty(exports, "BlockIdFlag", { enumerable: true, get: function () { return types_1.BlockIdFlag; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -15,2 +15,18 @@ "use strict"; | ||
/** | ||
* Node.js 18 comes with exprimental fetch support (https://nodejs.org/de/blog/announcements/v18-release-announce/). | ||
* This is nice, but the implementation does not yet work wekk for us. We | ||
* can just stick with axios on those systems for now. | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/ban-types | ||
function isExperimental(nodeJsFunc) { | ||
// This works because we get this info in node 18: | ||
// | ||
// > fetch.toString() | ||
// 'async function fetch(input, init = undefined) {\n' + | ||
// " emitExperimentalWarning('The Fetch API');\n" + | ||
// ' return lazyUndici().fetch(input, init);\n' + | ||
// ' }' | ||
return nodeJsFunc.toString().includes("emitExperimentalWarning"); | ||
} | ||
/** | ||
* Helper to work around missing CORS support in Tendermint (https://github.com/tendermint/tendermint/pull/2800) | ||
@@ -22,3 +38,3 @@ * | ||
async function http(method, url, headers, request) { | ||
if (typeof fetch !== "undefined") { | ||
if (typeof fetch === "function" && !isExperimental(fetch)) { | ||
const settings = { | ||
@@ -25,0 +41,0 @@ method: method, |
@@ -16,7 +16,6 @@ "use strict"; | ||
constructor(endpoint, options = {}) { | ||
var _a, _b; | ||
this.queue = []; | ||
this.options = { | ||
batchSizeLimit: (_a = options.batchSizeLimit) !== null && _a !== void 0 ? _a : defaultHttpBatchClientOptions.batchSizeLimit, | ||
dispatchInterval: (_b = options.dispatchInterval) !== null && _b !== void 0 ? _b : defaultHttpBatchClientOptions.dispatchInterval, | ||
batchSizeLimit: options.batchSizeLimit ?? defaultHttpBatchClientOptions.batchSizeLimit, | ||
dispatchInterval: options.dispatchInterval ?? defaultHttpBatchClientOptions.dispatchInterval, | ||
}; | ||
@@ -23,0 +22,0 @@ if (typeof endpoint === "string") { |
@@ -29,20 +29,18 @@ "use strict"; | ||
function decodeAbciQuery(data) { | ||
var _a, _b, _c, _d; | ||
return { | ||
key: (0, encoding_1.fromBase64)((0, encodings_1.assertString)((_a = data.key) !== null && _a !== void 0 ? _a : "")), | ||
value: (0, encoding_1.fromBase64)((0, encodings_1.assertString)((_b = data.value) !== null && _b !== void 0 ? _b : "")), | ||
key: (0, encoding_1.fromBase64)((0, encodings_1.assertString)(data.key ?? "")), | ||
value: (0, encoding_1.fromBase64)((0, encodings_1.assertString)(data.value ?? "")), | ||
proof: (0, encodings_1.may)(decodeQueryProof, data.proofOps), | ||
height: (0, encodings_1.may)(inthelpers_1.apiToSmallInt, data.height), | ||
code: (0, encodings_1.may)(inthelpers_1.apiToSmallInt, data.code), | ||
codespace: (0, encodings_1.assertString)((_c = data.codespace) !== null && _c !== void 0 ? _c : ""), | ||
codespace: (0, encodings_1.assertString)(data.codespace ?? ""), | ||
index: (0, encodings_1.may)(inthelpers_1.apiToSmallInt, data.index), | ||
log: data.log, | ||
info: (0, encodings_1.assertString)((_d = data.info) !== null && _d !== void 0 ? _d : ""), | ||
info: (0, encodings_1.assertString)(data.info ?? ""), | ||
}; | ||
} | ||
function decodeAttribute(attribute) { | ||
var _a; | ||
return { | ||
key: (0, encoding_1.fromBase64)((0, encodings_1.assertNotEmpty)(attribute.key)), | ||
value: (0, encoding_1.fromBase64)((0, encodings_1.assertString)((_a = attribute.value) !== null && _a !== void 0 ? _a : "")), | ||
value: (0, encoding_1.fromBase64)((0, encodings_1.assertString)(attribute.value ?? "")), | ||
}; | ||
@@ -64,5 +62,4 @@ } | ||
function decodeTxData(data) { | ||
var _a, _b, _c; | ||
return { | ||
code: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNumber)((_a = data.code) !== null && _a !== void 0 ? _a : 0)), | ||
code: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNumber)(data.code ?? 0)), | ||
codespace: data.codespace, | ||
@@ -72,4 +69,4 @@ log: data.log, | ||
events: data.events ? decodeEvents(data.events) : [], | ||
gasWanted: (0, inthelpers_1.apiToSmallInt)((_b = data.gas_wanted) !== null && _b !== void 0 ? _b : "0"), | ||
gasUsed: (0, inthelpers_1.apiToSmallInt)((_c = data.gas_used) !== null && _c !== void 0 ? _c : "0"), | ||
gasWanted: (0, inthelpers_1.apiToSmallInt)(data.gas_wanted ?? "0"), | ||
gasUsed: (0, inthelpers_1.apiToSmallInt)(data.gas_used ?? "0"), | ||
}; | ||
@@ -130,6 +127,5 @@ } | ||
function decodeValidatorUpdate(data) { | ||
var _a; | ||
return { | ||
pubkey: decodePubkey((0, encodings_1.assertObject)(data.pub_key)), | ||
votingPower: (0, inthelpers_1.apiToBigInt)((_a = data.power) !== null && _a !== void 0 ? _a : "0"), | ||
votingPower: (0, inthelpers_1.apiToBigInt)(data.power ?? "0"), | ||
}; | ||
@@ -158,6 +154,5 @@ } | ||
function decodeBlockVersion(data) { | ||
var _a; | ||
return { | ||
block: (0, inthelpers_1.apiToSmallInt)(data.block), | ||
app: (0, inthelpers_1.apiToSmallInt)((_a = data.app) !== null && _a !== void 0 ? _a : 0), | ||
app: (0, inthelpers_1.apiToSmallInt)(data.app ?? 0), | ||
}; | ||
@@ -344,3 +339,2 @@ } | ||
height: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.height)), | ||
index: (0, encodings_1.may)(inthelpers_1.apiToSmallInt, data.index), | ||
}; | ||
@@ -357,3 +351,2 @@ } | ||
function decodeBlock(data) { | ||
var _a, _b; | ||
return { | ||
@@ -367,3 +360,3 @@ header: decodeHeader((0, encodings_1.assertObject)(data.header)), | ||
// See https://github.com/tendermint/tendermint/issues/7697 | ||
evidence: (_b = (_a = data.evidence) === null || _a === void 0 ? void 0 : _a.evidence) !== null && _b !== void 0 ? _b : [], | ||
evidence: data.evidence?.evidence ?? [], | ||
}; | ||
@@ -370,0 +363,0 @@ } |
@@ -127,4 +127,2 @@ import { ReadonlyDate } from "readonly-date"; | ||
readonly height: number; | ||
/** @deprecated this value is not set in Tendermint 0.34+ */ | ||
readonly index?: number; | ||
readonly result: TxData; | ||
@@ -131,0 +129,0 @@ } |
@@ -300,3 +300,3 @@ "use strict"; | ||
// NOTE: Default value is for type safety but this should always be set | ||
blockHeight: blockHeight !== null && blockHeight !== void 0 ? blockHeight : 0, | ||
blockHeight: blockHeight ?? 0, | ||
count: validators.length, | ||
@@ -303,0 +303,0 @@ total: validators.length, |
{ | ||
"name": "@cosmjs/tendermint-rpc", | ||
"version": "0.29.5", | ||
"version": "0.30.0-beta.1", | ||
"description": "Tendermint RPC clients", | ||
@@ -45,9 +45,9 @@ "contributors": [ | ||
"dependencies": { | ||
"@cosmjs/crypto": "^0.29.5", | ||
"@cosmjs/encoding": "^0.29.5", | ||
"@cosmjs/json-rpc": "^0.29.5", | ||
"@cosmjs/math": "^0.29.5", | ||
"@cosmjs/socket": "^0.29.5", | ||
"@cosmjs/stream": "^0.29.5", | ||
"@cosmjs/utils": "^0.29.5", | ||
"@cosmjs/crypto": "^0.30.0-beta.1", | ||
"@cosmjs/encoding": "^0.30.0-beta.1", | ||
"@cosmjs/json-rpc": "^0.30.0-beta.1", | ||
"@cosmjs/math": "^0.30.0-beta.1", | ||
"@cosmjs/socket": "^0.30.0-beta.1", | ||
"@cosmjs/stream": "^0.30.0-beta.1", | ||
"@cosmjs/utils": "^0.30.0-beta.1", | ||
"axios": "^0.21.2", | ||
@@ -65,4 +65,4 @@ "readonly-date": "^1.0.0", | ||
"@types/node": "^15.0.1", | ||
"@typescript-eslint/eslint-plugin": "^5.13.0", | ||
"@typescript-eslint/parser": "^5.13.0", | ||
"@typescript-eslint/eslint-plugin": "^5.54.0", | ||
"@typescript-eslint/parser": "^5.54.0", | ||
"eslint": "^7.5", | ||
@@ -92,3 +92,4 @@ "eslint-config-prettier": "^8.3.0", | ||
"webpack-cli": "^4.6.0" | ||
} | ||
}, | ||
"stableVersion": "0.29.5" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
305579
101
4945
3
+ Added@cosmjs/crypto@0.30.1(transitive)
+ Added@cosmjs/encoding@0.30.1(transitive)
+ Added@cosmjs/json-rpc@0.30.1(transitive)
+ Added@cosmjs/math@0.30.1(transitive)
+ Added@cosmjs/socket@0.30.1(transitive)
+ Added@cosmjs/stream@0.30.1(transitive)
+ Added@cosmjs/utils@0.30.1(transitive)
- Removed@cosmjs/crypto@0.29.5(transitive)
- Removed@cosmjs/encoding@0.29.5(transitive)
- Removed@cosmjs/json-rpc@0.29.5(transitive)
- Removed@cosmjs/math@0.29.5(transitive)
- Removed@cosmjs/socket@0.29.5(transitive)
- Removed@cosmjs/stream@0.29.5(transitive)
- Removed@cosmjs/utils@0.29.5(transitive)
Updated@cosmjs/math@^0.30.0-beta.1
Updated@cosmjs/utils@^0.30.0-beta.1