@cosmjs/tendermint-rpc
Advanced tools
Comparing version 0.28.11 to 0.29.0-alpha.1
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -46,4 +50,8 @@ if (k2 === undefined) k2 = k; | ||
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"; | ||
var types_1 = require("./types"); | ||
Object.defineProperty(exports, "BlockIdFlag", { enumerable: true, get: function () { return types_1.BlockIdFlag; } }); | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -25,2 +29,3 @@ if (k2 === undefined) k2 = k; | ||
const encoding_1 = require("@cosmjs/encoding"); | ||
const inthelpers_1 = require("../../inthelpers"); | ||
const jsonrpc_1 = require("../../jsonrpc"); | ||
@@ -31,3 +36,3 @@ const encodings_1 = require("../encodings"); | ||
return { | ||
height: (0, encodings_1.may)(encodings_1.Integer.encode, param.height), | ||
height: (0, encodings_1.may)(inthelpers_1.smallIntToApi, param.height), | ||
}; | ||
@@ -37,4 +42,4 @@ } | ||
return { | ||
minHeight: (0, encodings_1.may)(encodings_1.Integer.encode, param.minHeight), | ||
maxHeight: (0, encodings_1.may)(encodings_1.Integer.encode, param.maxHeight), | ||
minHeight: (0, encodings_1.may)(inthelpers_1.smallIntToApi, param.minHeight), | ||
maxHeight: (0, encodings_1.may)(inthelpers_1.smallIntToApi, param.maxHeight), | ||
}; | ||
@@ -45,4 +50,4 @@ } | ||
query: params.query, | ||
page: (0, encodings_1.may)(encodings_1.Integer.encode, params.page), | ||
per_page: (0, encodings_1.may)(encodings_1.Integer.encode, params.per_page), | ||
page: (0, encodings_1.may)(inthelpers_1.smallIntToApi, params.page), | ||
per_page: (0, encodings_1.may)(inthelpers_1.smallIntToApi, params.per_page), | ||
order_by: params.order_by, | ||
@@ -55,3 +60,3 @@ }; | ||
data: (0, encoding_1.toHex)(params.data), | ||
height: (0, encodings_1.may)(encodings_1.Integer.encode, params.height), | ||
height: (0, encodings_1.may)(inthelpers_1.smallIntToApi, params.height), | ||
prove: params.prove, | ||
@@ -75,4 +80,4 @@ }; | ||
prove: params.prove, | ||
page: (0, encodings_1.may)(encodings_1.Integer.encode, params.page), | ||
per_page: (0, encodings_1.may)(encodings_1.Integer.encode, params.per_page), | ||
page: (0, encodings_1.may)(inthelpers_1.smallIntToApi, params.page), | ||
per_page: (0, encodings_1.may)(inthelpers_1.smallIntToApi, params.per_page), | ||
order_by: params.order_by, | ||
@@ -83,5 +88,5 @@ }; | ||
return { | ||
height: (0, encodings_1.may)(encodings_1.Integer.encode, params.height), | ||
page: (0, encodings_1.may)(encodings_1.Integer.encode, params.page), | ||
per_page: (0, encodings_1.may)(encodings_1.Integer.encode, params.per_page), | ||
height: (0, encodings_1.may)(inthelpers_1.smallIntToApi, params.height), | ||
page: (0, encodings_1.may)(inthelpers_1.smallIntToApi, params.page), | ||
per_page: (0, encodings_1.may)(inthelpers_1.smallIntToApi, params.per_page), | ||
}; | ||
@@ -88,0 +93,0 @@ } |
@@ -18,3 +18,3 @@ import { JsonRpcSuccessResponse } from "@cosmjs/json-rpc"; | ||
/** base64 encoded */ | ||
readonly value: string; | ||
readonly value?: string | null; | ||
} | ||
@@ -21,0 +21,0 @@ interface RpcEvent { |
@@ -8,2 +8,3 @@ "use strict"; | ||
const dates_1 = require("../../dates"); | ||
const inthelpers_1 = require("../../inthelpers"); | ||
const types_1 = require("../../types"); | ||
@@ -15,3 +16,3 @@ const encodings_1 = require("../encodings"); | ||
data: data.data, | ||
lastBlockHeight: (0, encodings_1.may)(encodings_1.Integer.parse, data.last_block_height), | ||
lastBlockHeight: (0, encodings_1.may)(inthelpers_1.apiToSmallInt, data.last_block_height), | ||
lastBlockAppHash: (0, encodings_1.may)(encoding_1.fromBase64, data.last_block_app_hash), | ||
@@ -30,16 +31,20 @@ }; | ||
function decodeAbciQuery(data) { | ||
var _a, _b, _c, _d; | ||
return { | ||
key: (0, encoding_1.fromBase64)((0, encodings_1.optional)(data.key, "")), | ||
value: (0, encoding_1.fromBase64)((0, encodings_1.optional)(data.value, "")), | ||
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 : "")), | ||
proof: (0, encodings_1.may)(decodeQueryProof, data.proofOps), | ||
height: (0, encodings_1.may)(encodings_1.Integer.parse, data.height), | ||
code: (0, encodings_1.may)(encodings_1.Integer.parse, data.code), | ||
index: (0, encodings_1.may)(encodings_1.Integer.parse, data.index), | ||
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 : ""), | ||
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 : ""), | ||
}; | ||
} | ||
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.optional)(attribute.value, "")), | ||
value: (0, encoding_1.fromBase64)((0, encodings_1.assertString)((_a = attribute.value) !== null && _a !== void 0 ? _a : "")), | ||
}; | ||
@@ -61,4 +66,5 @@ } | ||
function decodeTxData(data) { | ||
var _a, _b, _c; | ||
return { | ||
code: encodings_1.Integer.parse((0, encodings_1.assertNumber)((0, encodings_1.optional)(data.code, 0))), | ||
code: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNumber)((_a = data.code) !== null && _a !== void 0 ? _a : 0)), | ||
codeSpace: data.codespace, | ||
@@ -68,4 +74,4 @@ log: data.log, | ||
events: data.events ? decodeEvents(data.events) : [], | ||
gasWanted: encodings_1.Integer.parse((0, encodings_1.optional)(data.gas_wanted, "0")), | ||
gasUsed: encodings_1.Integer.parse((0, encodings_1.optional)(data.gas_used, "0")), | ||
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"), | ||
}; | ||
@@ -109,4 +115,4 @@ } | ||
return { | ||
maxBytes: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.max_bytes)), | ||
maxGas: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.max_gas)), | ||
maxBytes: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.max_bytes)), | ||
maxGas: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.max_gas)), | ||
}; | ||
@@ -116,4 +122,4 @@ } | ||
return { | ||
maxAgeNumBlocks: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.max_age_num_blocks)), | ||
maxAgeDuration: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.max_age_duration)), | ||
maxAgeNumBlocks: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.max_age_num_blocks)), | ||
maxAgeDuration: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.max_age_duration)), | ||
}; | ||
@@ -131,3 +137,3 @@ } | ||
pubkey: decodePubkey((0, encodings_1.assertObject)(data.pub_key)), | ||
votingPower: encodings_1.Integer.parse((_a = data.power) !== null && _a !== void 0 ? _a : 0), | ||
votingPower: (0, inthelpers_1.apiToBigInt)((_a = data.power) !== null && _a !== void 0 ? _a : "0"), | ||
}; | ||
@@ -138,3 +144,3 @@ } | ||
return { | ||
height: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.height)), | ||
height: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.height)), | ||
results: (data.txs_results || []).map(decodeTxData), | ||
@@ -159,4 +165,4 @@ validatorUpdates: (data.validator_updates || []).map(decodeValidatorUpdate), | ||
return { | ||
block: encodings_1.Integer.parse(data.block), | ||
app: encodings_1.Integer.parse((_a = data.app) !== null && _a !== void 0 ? _a : 0), | ||
block: (0, inthelpers_1.apiToSmallInt)(data.block), | ||
app: (0, inthelpers_1.apiToSmallInt)((_a = data.app) !== null && _a !== void 0 ? _a : 0), | ||
}; | ||
@@ -168,3 +174,3 @@ } | ||
chainId: (0, encodings_1.assertNotEmpty)(data.chain_id), | ||
height: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.height)), | ||
height: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.height)), | ||
time: (0, dates_1.fromRfc3339WithNanoseconds)((0, encodings_1.assertNotEmpty)(data.time)), | ||
@@ -188,5 +194,5 @@ // When there is no last block ID (i.e. this block's height is 1), we get an empty structure like this: | ||
blockId: decodeBlockId(data.block_id), | ||
blockSize: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.block_size)), | ||
blockSize: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.block_size)), | ||
header: decodeHeader(data.header), | ||
numTxs: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.num_txs)), | ||
numTxs: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.num_txs)), | ||
}; | ||
@@ -196,3 +202,3 @@ } | ||
return { | ||
lastHeight: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.last_height)), | ||
lastHeight: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.last_height)), | ||
blockMetas: (0, encodings_1.assertArray)(data.block_metas).map(decodeBlockMeta), | ||
@@ -209,3 +215,3 @@ }; | ||
return { | ||
height: encodings_1.Integer.parse(data.height), | ||
height: (0, inthelpers_1.apiToSmallInt)(data.height), | ||
hash: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.hash)), | ||
@@ -241,4 +247,4 @@ checkTx: decodeTxData((0, encodings_1.assertObject)(data.check_tx)), | ||
blockId: decodeBlockId((0, encodings_1.assertObject)(data.block_id)), | ||
height: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.height)), | ||
round: encodings_1.Integer.parse(data.round), | ||
height: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.height)), | ||
round: (0, inthelpers_1.apiToSmallInt)(data.round), | ||
signatures: (0, encodings_1.assertArray)(data.signatures).map(decodeCommitSignature), | ||
@@ -258,3 +264,3 @@ }; | ||
pubkey: decodePubkey((0, encodings_1.assertObject)(data.pub_key)), | ||
votingPower: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.power)), | ||
votingPower: (0, inthelpers_1.apiToBigInt)((0, encodings_1.assertNotEmpty)(data.power)), | ||
}; | ||
@@ -276,5 +282,5 @@ } | ||
pubkey: decodePubkey((0, encodings_1.assertObject)(data.pub_key)), | ||
votingPower: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.voting_power)), | ||
votingPower: (0, inthelpers_1.apiToBigInt)((0, encodings_1.assertNotEmpty)(data.voting_power)), | ||
address: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.address)), | ||
proposerPriority: data.proposer_priority ? encodings_1.Integer.parse(data.proposer_priority) : undefined, | ||
proposerPriority: data.proposer_priority ? (0, inthelpers_1.apiToSmallInt)(data.proposer_priority) : undefined, | ||
}; | ||
@@ -293,5 +299,5 @@ } | ||
protocolVersion: { | ||
app: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.protocol_version.app)), | ||
block: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.protocol_version.block)), | ||
p2p: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.protocol_version.p2p)), | ||
app: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.protocol_version.app)), | ||
block: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.protocol_version.block)), | ||
p2p: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.protocol_version.p2p)), | ||
}, | ||
@@ -305,3 +311,3 @@ }; | ||
latestBlockTime: (0, dates_1.fromRfc3339WithNanoseconds)((0, encodings_1.assertNotEmpty)(data.latest_block_time)), | ||
latestBlockHeight: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.latest_block_height)), | ||
latestBlockHeight: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.latest_block_height)), | ||
catchingUp: (0, encodings_1.assertBoolean)(data.catching_up), | ||
@@ -322,4 +328,4 @@ }; | ||
proof: { | ||
total: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.proof.total)), | ||
index: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.proof.index)), | ||
total: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.proof.total)), | ||
index: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.proof.index)), | ||
leafHash: (0, encoding_1.fromBase64)((0, encodings_1.assertNotEmpty)(data.proof.leaf_hash)), | ||
@@ -334,4 +340,4 @@ aunts: (0, encodings_1.assertArray)(data.proof.aunts).map(encoding_1.fromBase64), | ||
result: decodeTxData((0, encodings_1.assertObject)(data.tx_result)), | ||
height: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.height)), | ||
index: encodings_1.Integer.parse((0, encodings_1.assertNumber)(data.index)), | ||
height: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.height)), | ||
index: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNumber)(data.index)), | ||
hash: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.hash)), | ||
@@ -343,3 +349,3 @@ proof: (0, encodings_1.may)(decodeTxProof, data.proof), | ||
return { | ||
totalCount: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.total_count)), | ||
totalCount: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.total_count)), | ||
txs: (0, encodings_1.assertArray)(data.txs).map(decodeTxResponse), | ||
@@ -354,4 +360,4 @@ }; | ||
result: decodeTxData(data.result), | ||
height: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.height)), | ||
index: (0, encodings_1.may)(encodings_1.Integer.parse, data.index), | ||
height: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.height)), | ||
index: (0, encodings_1.may)(inthelpers_1.apiToSmallInt, data.index), | ||
}; | ||
@@ -361,6 +367,6 @@ } | ||
return { | ||
blockHeight: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.block_height)), | ||
blockHeight: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.block_height)), | ||
validators: (0, encodings_1.assertArray)(data.validators).map(decodeValidatorInfo), | ||
count: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.count)), | ||
total: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.total)), | ||
count: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.count)), | ||
total: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.total)), | ||
}; | ||
@@ -389,3 +395,3 @@ } | ||
return { | ||
totalCount: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.total_count)), | ||
totalCount: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.total_count)), | ||
blocks: (0, encodings_1.assertArray)(data.blocks).map(decodeBlockResponse), | ||
@@ -396,4 +402,4 @@ }; | ||
return { | ||
total: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.total)), | ||
totalBytes: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.total_bytes)), | ||
total: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.total)), | ||
totalBytes: (0, inthelpers_1.apiToSmallInt)((0, encodings_1.assertNotEmpty)(data.total_bytes)), | ||
}; | ||
@@ -400,0 +406,0 @@ } |
@@ -54,11 +54,6 @@ import { ReadonlyDateWithNanoseconds } from "../dates"; | ||
export declare function assertNotEmpty<T>(value: T): T; | ||
export declare function optional<T>(value: T | null | undefined, fallback: T): T; | ||
export declare function may<T, U>(transform: (val: T) => U, value: T | null | undefined): U | undefined; | ||
export declare function dictionaryToStringMap(obj: Record<string, unknown>): Map<string, string>; | ||
export declare class Integer { | ||
static parse(input: string | number): number; | ||
static encode(num: number): string; | ||
} | ||
export declare function encodeString(s: string): Uint8Array; | ||
export declare function encodeInt(n: number): Uint8Array; | ||
export declare function encodeUvarint(n: number): Uint8Array; | ||
export declare function encodeTime(time: ReadonlyDateWithNanoseconds): Uint8Array; | ||
@@ -65,0 +60,0 @@ export declare function encodeBytes(bytes: Uint8Array): Uint8Array; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.encodeBlockId = exports.encodeVersion = exports.encodeBytes = exports.encodeTime = exports.encodeInt = exports.encodeString = exports.Integer = exports.dictionaryToStringMap = exports.may = exports.optional = exports.assertNotEmpty = exports.assertObject = exports.assertArray = exports.assertNumber = exports.assertString = exports.assertBoolean = exports.assertSet = void 0; | ||
exports.encodeBlockId = exports.encodeVersion = exports.encodeBytes = exports.encodeTime = exports.encodeUvarint = exports.encodeString = exports.dictionaryToStringMap = exports.may = exports.assertNotEmpty = exports.assertObject = exports.assertArray = exports.assertNumber = exports.assertString = exports.assertBoolean = exports.assertSet = void 0; | ||
const encoding_1 = require("@cosmjs/encoding"); | ||
const math_1 = require("@cosmjs/math"); | ||
/** | ||
@@ -117,7 +116,2 @@ * A runtime checker that ensures a given value is set (i.e. not undefined or null) | ||
exports.assertNotEmpty = assertNotEmpty; | ||
// optional uses the value or provides a default | ||
function optional(value, fallback) { | ||
return value === undefined || value === null ? fallback : value; | ||
} | ||
exports.optional = optional; | ||
// may will run the transform if value is defined, otherwise returns undefined | ||
@@ -140,12 +134,2 @@ function may(transform, value) { | ||
exports.dictionaryToStringMap = dictionaryToStringMap; | ||
class Integer { | ||
static parse(input) { | ||
const asInt = typeof input === "number" ? new math_1.Int53(input) : math_1.Int53.fromString(input); | ||
return asInt.toNumber(); | ||
} | ||
static encode(num) { | ||
return new math_1.Int53(num).toString(); | ||
} | ||
} | ||
exports.Integer = Integer; | ||
// Encodings needed for hashing block headers | ||
@@ -160,7 +144,10 @@ // Several of these functions are inspired by https://github.com/nomic-io/js-tendermint/blob/tendermint-0.30/src/ | ||
// See https://github.com/tendermint/go-amino/blob/v0.15.0/encoder.go#L79-L87 | ||
function encodeInt(n) { | ||
// eslint-disable-next-line no-bitwise | ||
return n >= 0x80 ? Uint8Array.from([(n & 0xff) | 0x80, ...encodeInt(n >> 7)]) : Uint8Array.from([n & 0xff]); | ||
function encodeUvarint(n) { | ||
return n >= 0x80 | ||
? // eslint-disable-next-line no-bitwise | ||
Uint8Array.from([(n & 0xff) | 0x80, ...encodeUvarint(n >> 7)]) | ||
: // eslint-disable-next-line no-bitwise | ||
Uint8Array.from([n & 0xff]); | ||
} | ||
exports.encodeInt = encodeInt; | ||
exports.encodeUvarint = encodeUvarint; | ||
// See https://github.com/tendermint/go-amino/blob/v0.15.0/encoder.go#L134-L178 | ||
@@ -170,5 +157,5 @@ function encodeTime(time) { | ||
const seconds = Math.floor(milliseconds / 1000); | ||
const secondsArray = seconds ? [0x08, ...encodeInt(seconds)] : new Uint8Array(); | ||
const secondsArray = seconds ? [0x08, ...encodeUvarint(seconds)] : new Uint8Array(); | ||
const nanoseconds = (time.nanoseconds || 0) + (milliseconds % 1000) * 1e6; | ||
const nanosecondsArray = nanoseconds ? [0x10, ...encodeInt(nanoseconds)] : new Uint8Array(); | ||
const nanosecondsArray = nanoseconds ? [0x10, ...encodeUvarint(nanoseconds)] : new Uint8Array(); | ||
return Uint8Array.from([...secondsArray, ...nanosecondsArray]); | ||
@@ -186,4 +173,6 @@ } | ||
function encodeVersion(version) { | ||
const blockArray = version.block ? Uint8Array.from([0x08, ...encodeInt(version.block)]) : new Uint8Array(); | ||
const appArray = version.app ? Uint8Array.from([0x10, ...encodeInt(version.app)]) : new Uint8Array(); | ||
const blockArray = version.block | ||
? Uint8Array.from([0x08, ...encodeUvarint(version.block)]) | ||
: new Uint8Array(); | ||
const appArray = version.app ? Uint8Array.from([0x10, ...encodeUvarint(version.app)]) : new Uint8Array(); | ||
return Uint8Array.from([...blockArray, ...appArray]); | ||
@@ -190,0 +179,0 @@ } |
@@ -52,3 +52,3 @@ "use strict"; | ||
(0, encodings_1.encodeString)(header.chainId), | ||
(0, encodings_1.encodeInt)(header.height), | ||
(0, encodings_1.encodeUvarint)(header.height), | ||
(0, encodings_1.encodeTime)(header.time), | ||
@@ -55,0 +55,0 @@ (0, encodings_1.encodeBlockId)(header.lastBlockId), |
@@ -25,3 +25,5 @@ import { ReadonlyDate } from "readonly-date"; | ||
readonly code?: number; | ||
readonly codespace: string; | ||
readonly log?: string; | ||
readonly info: string; | ||
} | ||
@@ -255,2 +257,5 @@ export interface BlockResponse { | ||
readonly network: string; | ||
/** | ||
* The Tendermint version. Can be empty (see https://github.com/cosmos/cosmos-sdk/issues/7963). | ||
*/ | ||
readonly version: string; | ||
@@ -276,3 +281,3 @@ readonly channels: string; | ||
readonly pubkey?: ValidatorPubkey; | ||
readonly votingPower: number; | ||
readonly votingPower: bigint; | ||
readonly proposerPriority?: number; | ||
@@ -282,3 +287,3 @@ } | ||
readonly pubkey: ValidatorPubkey; | ||
readonly votingPower: number; | ||
readonly votingPower: bigint; | ||
} | ||
@@ -285,0 +290,0 @@ export interface ConsensusParams { |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
{ | ||
"name": "@cosmjs/tendermint-rpc", | ||
"version": "0.28.11", | ||
"version": "0.29.0-alpha.1", | ||
"description": "Tendermint RPC clients", | ||
@@ -45,9 +45,9 @@ "contributors": [ | ||
"dependencies": { | ||
"@cosmjs/crypto": "0.28.11", | ||
"@cosmjs/encoding": "0.28.11", | ||
"@cosmjs/json-rpc": "0.28.11", | ||
"@cosmjs/math": "0.28.11", | ||
"@cosmjs/socket": "0.28.11", | ||
"@cosmjs/stream": "0.28.11", | ||
"@cosmjs/utils": "0.28.11", | ||
"@cosmjs/crypto": "0.29.0-alpha.1", | ||
"@cosmjs/encoding": "0.29.0-alpha.1", | ||
"@cosmjs/json-rpc": "0.29.0-alpha.1", | ||
"@cosmjs/math": "0.29.0-alpha.1", | ||
"@cosmjs/socket": "0.29.0-alpha.1", | ||
"@cosmjs/stream": "0.29.0-alpha.1", | ||
"@cosmjs/utils": "0.29.0-alpha.1", | ||
"axios": "^0.21.2", | ||
@@ -60,3 +60,3 @@ "readonly-date": "^1.0.0", | ||
"@types/eslint-plugin-prettier": "^3", | ||
"@types/jasmine": "^3.8", | ||
"@types/jasmine": "^4", | ||
"@types/karma-firefox-launcher": "^2", | ||
@@ -76,3 +76,3 @@ "@types/karma-jasmine": "^4", | ||
"glob": "^7.1.6", | ||
"jasmine": "^3.99", | ||
"jasmine": "^4", | ||
"jasmine-spec-reporter": "^6", | ||
@@ -82,3 +82,3 @@ "karma": "^6.3.14", | ||
"karma-firefox-launcher": "^2.1.0", | ||
"karma-jasmine": "^4.0.1", | ||
"karma-jasmine": "^5", | ||
"karma-jasmine-html-reporter": "^1.5.4", | ||
@@ -91,6 +91,7 @@ "nyc": "^15.1.0", | ||
"typedoc": "^0.22", | ||
"typescript": "~4.4", | ||
"typescript": "~4.6", | ||
"webpack": "^5.32.0", | ||
"webpack-cli": "^4.6.0" | ||
} | ||
}, | ||
"stableVersion": "0.28.11" | ||
} |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
4773
0
294775
92
+ Added@cosmjs/crypto@0.29.0-alpha.1(transitive)
+ Added@cosmjs/encoding@0.29.0-alpha.1(transitive)
+ Added@cosmjs/json-rpc@0.29.0-alpha.1(transitive)
+ Added@cosmjs/math@0.29.0-alpha.1(transitive)
+ Added@cosmjs/socket@0.29.0-alpha.1(transitive)
+ Added@cosmjs/stream@0.29.0-alpha.1(transitive)
+ Added@cosmjs/utils@0.29.0-alpha.1(transitive)
- Removed@cosmjs/crypto@0.28.11(transitive)
- Removed@cosmjs/encoding@0.28.11(transitive)
- Removed@cosmjs/json-rpc@0.28.11(transitive)
- Removed@cosmjs/math@0.28.11(transitive)
- Removed@cosmjs/socket@0.28.11(transitive)
- Removed@cosmjs/stream@0.28.11(transitive)
- Removed@cosmjs/utils@0.28.11(transitive)
Updated@cosmjs/math@0.29.0-alpha.1
Updated@cosmjs/utils@0.29.0-alpha.1