Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cosmjs/tendermint-rpc

Package Overview
Dependencies
Maintainers
3
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cosmjs/tendermint-rpc - npm Package Compare versions

Comparing version 0.26.5 to 0.27.0-rc1

6

build/addresses.js

@@ -10,3 +10,3 @@ "use strict";

}
return crypto_1.sha256(pubkeyData).slice(0, 20);
return (0, crypto_1.sha256)(pubkeyData).slice(0, 20);
}

@@ -18,3 +18,3 @@ exports.rawEd25519PubkeyToRawAddress = rawEd25519PubkeyToRawAddress;

}
return crypto_1.ripemd160(crypto_1.sha256(pubkeyData));
return (0, crypto_1.ripemd160)((0, crypto_1.sha256)(pubkeyData));
}

@@ -36,5 +36,5 @@ exports.rawSecp256k1PubkeyToRawAddress = rawSecp256k1PubkeyToRawAddress;

function pubkeyToAddress(type, data) {
return encoding_1.toHex(pubkeyToRawAddress(type, data)).toUpperCase();
return (0, encoding_1.toHex)(pubkeyToRawAddress(type, data)).toUpperCase();
}
exports.pubkeyToAddress = pubkeyToAddress;
//# sourceMappingURL=addresses.js.map

@@ -9,8 +9,8 @@ "use strict";

it("works for Secp256k1", () => {
const pubkey = encoding_1.fromHex("02950E1CDFCB133D6024109FD489F734EEB4502418E538C28481F22BCE276F248C");
expect(addresses_1.pubkeyToRawAddress("secp256k1", pubkey)).toEqual(encoding_1.fromHex("7C2BB42A8BE69791EC763E51F5A49BCD41E82237"));
const pubkey = (0, encoding_1.fromHex)("02950E1CDFCB133D6024109FD489F734EEB4502418E538C28481F22BCE276F248C");
expect((0, addresses_1.pubkeyToRawAddress)("secp256k1", pubkey)).toEqual((0, encoding_1.fromHex)("7C2BB42A8BE69791EC763E51F5A49BCD41E82237"));
});
it("works for Ed25519", () => {
const pubkey = encoding_1.fromHex("14253D61EF42D166D02E68D540D07FDF8D65A9AF0ACAA46302688E788A8521E2");
expect(addresses_1.pubkeyToRawAddress("ed25519", pubkey)).toEqual(encoding_1.fromHex("0CDA3F47EF3C4906693B170EF650EB968C5F4B2C"));
const pubkey = (0, encoding_1.fromHex)("14253D61EF42D166D02E68D540D07FDF8D65A9AF0ACAA46302688E788A8521E2");
expect((0, addresses_1.pubkeyToRawAddress)("ed25519", pubkey)).toEqual((0, encoding_1.fromHex)("0CDA3F47EF3C4906693B170EF650EB968C5F4B2C"));
});

@@ -20,8 +20,8 @@ });

it("works for Secp256k1", () => {
const pubkey = encoding_1.fromHex("02950E1CDFCB133D6024109FD489F734EEB4502418E538C28481F22BCE276F248C");
expect(addresses_1.pubkeyToAddress("secp256k1", pubkey)).toEqual("7C2BB42A8BE69791EC763E51F5A49BCD41E82237");
const pubkey = (0, encoding_1.fromHex)("02950E1CDFCB133D6024109FD489F734EEB4502418E538C28481F22BCE276F248C");
expect((0, addresses_1.pubkeyToAddress)("secp256k1", pubkey)).toEqual("7C2BB42A8BE69791EC763E51F5A49BCD41E82237");
});
it("works for Ed25519", () => {
const pubkey = encoding_1.fromHex("14253D61EF42D166D02E68D540D07FDF8D65A9AF0ACAA46302688E788A8521E2");
expect(addresses_1.pubkeyToAddress("ed25519", pubkey)).toEqual("0CDA3F47EF3C4906693B170EF650EB968C5F4B2C");
const pubkey = (0, encoding_1.fromHex)("14253D61EF42D166D02E68D540D07FDF8D65A9AF0ACAA46302688E788A8521E2");
expect((0, addresses_1.pubkeyToAddress)("ed25519", pubkey)).toEqual("0CDA3F47EF3C4906693B170EF650EB968C5F4B2C");
});

@@ -28,0 +28,0 @@ });

@@ -7,3 +7,3 @@ "use strict";

function fromRfc3339WithNanoseconds(dateTimeString) {
const out = encoding_1.fromRfc3339(dateTimeString);
const out = (0, encoding_1.fromRfc3339)(dateTimeString);
const nanosecondsMatch = dateTimeString.match(/\.(\d+)Z$/);

@@ -10,0 +10,0 @@ const nanoseconds = nanosecondsMatch ? nanosecondsMatch[1].slice(3) : "";

@@ -8,12 +8,12 @@ "use strict";

it("works", () => {
expect(dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26Z").nanoseconds).toEqual(0);
expect(dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26.7Z").nanoseconds).toEqual(0);
expect(dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26.77Z").nanoseconds).toEqual(0);
expect(dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26.778Z").nanoseconds).toEqual(0);
expect(dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26.7789Z").nanoseconds).toEqual(900000);
expect(dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26.77809Z").nanoseconds).toEqual(90000);
expect(dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26.778009Z").nanoseconds).toEqual(9000);
expect(dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26.7780009Z").nanoseconds).toEqual(900);
expect(dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26.77800009Z").nanoseconds).toEqual(90);
expect(dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26.778000009Z").nanoseconds).toEqual(9);
expect((0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26Z").nanoseconds).toEqual(0);
expect((0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26.7Z").nanoseconds).toEqual(0);
expect((0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26.77Z").nanoseconds).toEqual(0);
expect((0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26.778Z").nanoseconds).toEqual(0);
expect((0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26.7789Z").nanoseconds).toEqual(900000);
expect((0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26.77809Z").nanoseconds).toEqual(90000);
expect((0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26.778009Z").nanoseconds).toEqual(9000);
expect((0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26.7780009Z").nanoseconds).toEqual(900);
expect((0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26.77800009Z").nanoseconds).toEqual(90);
expect((0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26.778000009Z").nanoseconds).toEqual(9);
});

@@ -25,21 +25,21 @@ });

date1.nanoseconds = 0;
expect(dates_1.toRfc3339WithNanoseconds(date1)).toEqual("2020-12-15T10:57:26.778000000Z");
expect((0, dates_1.toRfc3339WithNanoseconds)(date1)).toEqual("2020-12-15T10:57:26.778000000Z");
const date2 = new readonly_date_1.ReadonlyDate("2020-12-15T10:57:26.778Z");
date2.nanoseconds = 900000;
expect(dates_1.toRfc3339WithNanoseconds(date2)).toEqual("2020-12-15T10:57:26.778900000Z");
expect((0, dates_1.toRfc3339WithNanoseconds)(date2)).toEqual("2020-12-15T10:57:26.778900000Z");
const date3 = new readonly_date_1.ReadonlyDate("2020-12-15T10:57:26.778Z");
date3.nanoseconds = 90000;
expect(dates_1.toRfc3339WithNanoseconds(date3)).toEqual("2020-12-15T10:57:26.778090000Z");
expect((0, dates_1.toRfc3339WithNanoseconds)(date3)).toEqual("2020-12-15T10:57:26.778090000Z");
const date4 = new readonly_date_1.ReadonlyDate("2020-12-15T10:57:26.778Z");
date4.nanoseconds = 9000;
expect(dates_1.toRfc3339WithNanoseconds(date4)).toEqual("2020-12-15T10:57:26.778009000Z");
expect((0, dates_1.toRfc3339WithNanoseconds)(date4)).toEqual("2020-12-15T10:57:26.778009000Z");
const date5 = new readonly_date_1.ReadonlyDate("2020-12-15T10:57:26.778Z");
date5.nanoseconds = 900;
expect(dates_1.toRfc3339WithNanoseconds(date5)).toEqual("2020-12-15T10:57:26.778000900Z");
expect((0, dates_1.toRfc3339WithNanoseconds)(date5)).toEqual("2020-12-15T10:57:26.778000900Z");
const date6 = new readonly_date_1.ReadonlyDate("2020-12-15T10:57:26.778Z");
date6.nanoseconds = 90;
expect(dates_1.toRfc3339WithNanoseconds(date6)).toEqual("2020-12-15T10:57:26.778000090Z");
expect((0, dates_1.toRfc3339WithNanoseconds)(date6)).toEqual("2020-12-15T10:57:26.778000090Z");
const date7 = new readonly_date_1.ReadonlyDate("2020-12-15T10:57:26.778Z");
date7.nanoseconds = 9;
expect(dates_1.toRfc3339WithNanoseconds(date7)).toEqual("2020-12-15T10:57:26.778000009Z");
expect((0, dates_1.toRfc3339WithNanoseconds)(date7)).toEqual("2020-12-15T10:57:26.778000009Z");
});

@@ -49,7 +49,7 @@ it("works for DateWithNanoseconds", () => {

date1.nanoseconds = 1;
expect(dates_1.toRfc3339WithNanoseconds(date1)).toEqual("2020-12-15T10:57:26.778000001Z");
expect((0, dates_1.toRfc3339WithNanoseconds)(date1)).toEqual("2020-12-15T10:57:26.778000001Z");
});
it("works for Date", () => {
const date1 = new Date("2020-12-15T10:57:26.778Z");
expect(dates_1.toRfc3339WithNanoseconds(date1)).toEqual("2020-12-15T10:57:26.778000000Z");
expect((0, dates_1.toRfc3339WithNanoseconds)(date1)).toEqual("2020-12-15T10:57:26.778000000Z");
});

@@ -60,51 +60,51 @@ });

{
const date = dates_1.fromSeconds(1608029846);
expect(date).toEqual(dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26Z"));
const date = (0, dates_1.fromSeconds)(1608029846);
expect(date).toEqual((0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26Z"));
}
{
const date = dates_1.fromSeconds(1608029846, 0);
expect(date).toEqual(dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26Z"));
const date = (0, dates_1.fromSeconds)(1608029846, 0);
expect(date).toEqual((0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26Z"));
}
{
const date = dates_1.fromSeconds(1608029846, 1);
expect(date).toEqual(dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26.000000001Z"));
const date = (0, dates_1.fromSeconds)(1608029846, 1);
expect(date).toEqual((0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26.000000001Z"));
}
{
const date = dates_1.fromSeconds(1608029846, 10);
expect(date).toEqual(dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26.000000010Z"));
const date = (0, dates_1.fromSeconds)(1608029846, 10);
expect(date).toEqual((0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26.000000010Z"));
}
{
const date = dates_1.fromSeconds(1608029846, 100);
expect(date).toEqual(dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26.000000100Z"));
const date = (0, dates_1.fromSeconds)(1608029846, 100);
expect(date).toEqual((0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26.000000100Z"));
}
{
const date = dates_1.fromSeconds(1608029846, 1000);
expect(date).toEqual(dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26.000001000Z"));
const date = (0, dates_1.fromSeconds)(1608029846, 1000);
expect(date).toEqual((0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26.000001000Z"));
}
{
const date = dates_1.fromSeconds(1608029846, 10000);
expect(date).toEqual(dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26.000010000Z"));
const date = (0, dates_1.fromSeconds)(1608029846, 10000);
expect(date).toEqual((0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26.000010000Z"));
}
{
const date = dates_1.fromSeconds(1608029846, 100000);
expect(date).toEqual(dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26.000100000Z"));
const date = (0, dates_1.fromSeconds)(1608029846, 100000);
expect(date).toEqual((0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26.000100000Z"));
}
{
const date = dates_1.fromSeconds(1608029846, 1000000);
expect(date).toEqual(dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26.001000000Z"));
const date = (0, dates_1.fromSeconds)(1608029846, 1000000);
expect(date).toEqual((0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26.001000000Z"));
}
{
const date = dates_1.fromSeconds(1608029846, 10000000);
expect(date).toEqual(dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26.010000000Z"));
const date = (0, dates_1.fromSeconds)(1608029846, 10000000);
expect(date).toEqual((0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26.010000000Z"));
}
{
const date = dates_1.fromSeconds(1608029846, 100000000);
expect(date).toEqual(dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26.100000000Z"));
const date = (0, dates_1.fromSeconds)(1608029846, 100000000);
expect(date).toEqual((0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26.100000000Z"));
}
});
it("throws for nanos out of range", () => {
expect(() => dates_1.fromSeconds(1608029846, 1000000000)).toThrow();
expect(() => dates_1.fromSeconds(1608029846, -1)).toThrow();
expect(() => dates_1.fromSeconds(1608029846, 1.2)).toThrow();
expect(() => dates_1.fromSeconds(1608029846, NaN)).toThrow();
expect(() => (0, dates_1.fromSeconds)(1608029846, 1000000000)).toThrow();
expect(() => (0, dates_1.fromSeconds)(1608029846, -1)).toThrow();
expect(() => (0, dates_1.fromSeconds)(1608029846, 1.2)).toThrow();
expect(() => (0, dates_1.fromSeconds)(1608029846, NaN)).toThrow();
});

@@ -115,40 +115,40 @@ });

{
const date = dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26Z");
expect(dates_1.toSeconds(date)).toEqual({ seconds: 1608029846, nanos: 0 });
const date = (0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26Z");
expect((0, dates_1.toSeconds)(date)).toEqual({ seconds: 1608029846, nanos: 0 });
}
{
const date = dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26.7Z");
expect(dates_1.toSeconds(date)).toEqual({ seconds: 1608029846, nanos: 700000000 });
const date = (0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26.7Z");
expect((0, dates_1.toSeconds)(date)).toEqual({ seconds: 1608029846, nanos: 700000000 });
}
{
const date = dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26.77Z");
expect(dates_1.toSeconds(date)).toEqual({ seconds: 1608029846, nanos: 770000000 });
const date = (0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26.77Z");
expect((0, dates_1.toSeconds)(date)).toEqual({ seconds: 1608029846, nanos: 770000000 });
}
{
const date = dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26.778Z");
expect(dates_1.toSeconds(date)).toEqual({ seconds: 1608029846, nanos: 778000000 });
const date = (0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26.778Z");
expect((0, dates_1.toSeconds)(date)).toEqual({ seconds: 1608029846, nanos: 778000000 });
}
{
const date = dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26.7789Z");
expect(dates_1.toSeconds(date)).toEqual({ seconds: 1608029846, nanos: 778900000 });
const date = (0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26.7789Z");
expect((0, dates_1.toSeconds)(date)).toEqual({ seconds: 1608029846, nanos: 778900000 });
}
{
const date = dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26.77809Z");
expect(dates_1.toSeconds(date)).toEqual({ seconds: 1608029846, nanos: 778090000 });
const date = (0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26.77809Z");
expect((0, dates_1.toSeconds)(date)).toEqual({ seconds: 1608029846, nanos: 778090000 });
}
{
const date = dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26.778009Z");
expect(dates_1.toSeconds(date)).toEqual({ seconds: 1608029846, nanos: 778009000 });
const date = (0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26.778009Z");
expect((0, dates_1.toSeconds)(date)).toEqual({ seconds: 1608029846, nanos: 778009000 });
}
{
const date = dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26.7780009Z");
expect(dates_1.toSeconds(date)).toEqual({ seconds: 1608029846, nanos: 778000900 });
const date = (0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26.7780009Z");
expect((0, dates_1.toSeconds)(date)).toEqual({ seconds: 1608029846, nanos: 778000900 });
}
{
const date = dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26.77800009Z");
expect(dates_1.toSeconds(date)).toEqual({ seconds: 1608029846, nanos: 778000090 });
const date = (0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26.77800009Z");
expect((0, dates_1.toSeconds)(date)).toEqual({ seconds: 1608029846, nanos: 778000090 });
}
{
const date = dates_1.fromRfc3339WithNanoseconds("2020-12-15T10:57:26.778000009Z");
expect(dates_1.toSeconds(date)).toEqual({ seconds: 1608029846, nanos: 778000009 });
const date = (0, dates_1.fromRfc3339WithNanoseconds)("2020-12-15T10:57:26.778000009Z");
expect((0, dates_1.toSeconds)(date)).toEqual({ seconds: 1608029846, nanos: 778000009 });
}

@@ -155,0 +155,0 @@ });

export { pubkeyToAddress, pubkeyToRawAddress, rawEd25519PubkeyToRawAddress, rawSecp256k1PubkeyToRawAddress, } from "./addresses";
export { DateTime, ReadonlyDateWithNanoseconds, fromRfc3339WithNanoseconds, fromSeconds, toRfc3339WithNanoseconds, toSeconds, } from "./dates";
export { DateTime, fromRfc3339WithNanoseconds, fromSeconds, ReadonlyDateWithNanoseconds, toRfc3339WithNanoseconds, toSeconds, } from "./dates";
export { HttpClient, WebsocketClient } from "./rpcclients";
export { BlockIdFlag, CommitSignature, ValidatorEd25519Pubkey, ValidatorSecp256k1Pubkey, ValidatorPubkey, } from "./types";
export * as tendermint33 from "./tendermint33";
export { Tendermint33Client, AbciInfoResponse, AbciQueryResponse, Attribute, Block, BlockchainResponse, BlockGossipParams, BlockId, BlockMeta, BlockParams, BlockResponse, BlockResultsResponse, BroadcastTxAsyncResponse, BroadcastTxCommitResponse, broadcastTxCommitSuccess, BroadcastTxSyncResponse, broadcastTxSyncSuccess, Commit, CommitResponse, ConsensusParams, Event, Evidence, EvidenceParams, GenesisResponse, Header, HealthResponse, NewBlockEvent, NewBlockHeaderEvent, NodeInfo, ProofOp, QueryProof, Response, StatusResponse, SyncInfo, TxData, TxEvent, TxProof, TxResponse, TxSearchResponse, TxSizeParams, Validator, ValidatorsResponse, Version, Vote, VoteType, AbciInfoRequest, AbciQueryParams, AbciQueryRequest, BlockRequest, BlockchainRequest, BlockResultsRequest, BroadcastTxRequest, BroadcastTxParams, CommitRequest, GenesisRequest, HealthRequest, Method, Request, QueryTag, StatusRequest, SubscriptionEventType, TxParams, TxRequest, TxSearchParams, TxSearchRequest, ValidatorsRequest, ValidatorsParams, } from "./tendermint33";
export { AbciInfoRequest, AbciInfoResponse, AbciQueryParams, AbciQueryRequest, AbciQueryResponse, Attribute, Block, BlockchainRequest, BlockchainResponse, BlockGossipParams, BlockId, BlockMeta, BlockParams, BlockRequest, BlockResponse, BlockResultsRequest, BlockResultsResponse, BroadcastTxAsyncResponse, BroadcastTxCommitResponse, broadcastTxCommitSuccess, BroadcastTxParams, BroadcastTxRequest, BroadcastTxSyncResponse, broadcastTxSyncSuccess, Commit, CommitRequest, CommitResponse, ConsensusParams, Event, Evidence, EvidenceParams, GenesisRequest, GenesisResponse, Header, HealthRequest, HealthResponse, Method, NewBlockEvent, NewBlockHeaderEvent, NodeInfo, ProofOp, QueryProof, QueryTag, Request, Response, StatusRequest, StatusResponse, SubscriptionEventType, SyncInfo, TxData, TxEvent, TxParams, TxProof, TxRequest, TxResponse, TxSearchParams, TxSearchRequest, TxSearchResponse, TxSizeParams, Validator, ValidatorsParams, ValidatorsRequest, ValidatorsResponse, Version, Vote, VoteType, } from "./tendermint34";
export * as tendermint34 from "./tendermint34";
export { Tendermint34Client } from "./tendermint34";
export { BlockIdFlag, CommitSignature, ValidatorEd25519Pubkey, ValidatorPubkey, ValidatorSecp256k1Pubkey, } from "./types";

@@ -22,3 +22,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Tendermint34Client = exports.tendermint34 = exports.SubscriptionEventType = exports.Method = exports.VoteType = exports.broadcastTxSyncSuccess = exports.broadcastTxCommitSuccess = exports.Tendermint33Client = exports.tendermint33 = exports.BlockIdFlag = exports.WebsocketClient = exports.HttpClient = exports.toSeconds = exports.toRfc3339WithNanoseconds = exports.fromSeconds = exports.fromRfc3339WithNanoseconds = exports.DateTime = exports.rawSecp256k1PubkeyToRawAddress = exports.rawEd25519PubkeyToRawAddress = exports.pubkeyToRawAddress = exports.pubkeyToAddress = void 0;
exports.BlockIdFlag = exports.Tendermint34Client = exports.tendermint34 = exports.VoteType = exports.SubscriptionEventType = exports.Method = exports.broadcastTxSyncSuccess = exports.broadcastTxCommitSuccess = exports.WebsocketClient = exports.HttpClient = 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");

@@ -38,15 +38,13 @@ Object.defineProperty(exports, "pubkeyToAddress", { enumerable: true, get: function () { return addresses_1.pubkeyToAddress; } });

Object.defineProperty(exports, "WebsocketClient", { enumerable: true, get: function () { return rpcclients_1.WebsocketClient; } });
var tendermint34_1 = require("./tendermint34");
Object.defineProperty(exports, "broadcastTxCommitSuccess", { enumerable: true, get: function () { return tendermint34_1.broadcastTxCommitSuccess; } });
Object.defineProperty(exports, "broadcastTxSyncSuccess", { enumerable: true, get: function () { return tendermint34_1.broadcastTxSyncSuccess; } });
Object.defineProperty(exports, "Method", { enumerable: true, get: function () { return tendermint34_1.Method; } });
Object.defineProperty(exports, "SubscriptionEventType", { enumerable: true, get: function () { return tendermint34_1.SubscriptionEventType; } });
Object.defineProperty(exports, "VoteType", { enumerable: true, get: function () { return tendermint34_1.VoteType; } });
exports.tendermint34 = __importStar(require("./tendermint34"));
var tendermint34_2 = require("./tendermint34");
Object.defineProperty(exports, "Tendermint34Client", { enumerable: true, get: function () { return tendermint34_2.Tendermint34Client; } });
var types_1 = require("./types");
Object.defineProperty(exports, "BlockIdFlag", { enumerable: true, get: function () { return types_1.BlockIdFlag; } });
exports.tendermint33 = __importStar(require("./tendermint33"));
var tendermint33_1 = require("./tendermint33");
Object.defineProperty(exports, "Tendermint33Client", { enumerable: true, get: function () { return tendermint33_1.Tendermint33Client; } });
Object.defineProperty(exports, "broadcastTxCommitSuccess", { enumerable: true, get: function () { return tendermint33_1.broadcastTxCommitSuccess; } });
Object.defineProperty(exports, "broadcastTxSyncSuccess", { enumerable: true, get: function () { return tendermint33_1.broadcastTxSyncSuccess; } });
Object.defineProperty(exports, "VoteType", { enumerable: true, get: function () { return tendermint33_1.VoteType; } });
Object.defineProperty(exports, "Method", { enumerable: true, get: function () { return tendermint33_1.Method; } });
Object.defineProperty(exports, "SubscriptionEventType", { enumerable: true, get: function () { return tendermint33_1.SubscriptionEventType; } });
exports.tendermint34 = __importStar(require("./tendermint34"));
var tendermint34_1 = require("./tendermint34");
Object.defineProperty(exports, "Tendermint34Client", { enumerable: true, get: function () { return tendermint34_1.Tendermint34Client; } });
//# sourceMappingURL=index.js.map

@@ -7,3 +7,3 @@ "use strict";

it("generates proper object with correct method", () => {
const request = jsonrpc_1.createJsonRpcRequest("do_something");
const request = (0, jsonrpc_1.createJsonRpcRequest)("do_something");
expect(request.jsonrpc).toEqual("2.0");

@@ -14,4 +14,4 @@ expect(request.id.toString()).toMatch(/^[1-9]{12}$/);

it("generates distinct IDs", () => {
const request1 = jsonrpc_1.createJsonRpcRequest("foo");
const request2 = jsonrpc_1.createJsonRpcRequest("foo");
const request1 = (0, jsonrpc_1.createJsonRpcRequest)("foo");
const request2 = (0, jsonrpc_1.createJsonRpcRequest)("foo");
expect(request2.id).not.toEqual(request1.id);

@@ -21,3 +21,3 @@ });

const params = { foo: "bar" };
const request = jsonrpc_1.createJsonRpcRequest("some_method", params);
const request = (0, jsonrpc_1.createJsonRpcRequest)("some_method", params);
expect(request.params).toEqual(params);

@@ -24,0 +24,0 @@ expect(request.params).not.toBe(params);

@@ -11,5 +11,5 @@ import { JsonRpcRequest, JsonRpcSuccessResponse } from "@cosmjs/json-rpc";

protected readonly url: string;
constructor(url?: string);
constructor(url: string);
disconnect(): void;
execute(request: JsonRpcRequest): Promise<JsonRpcSuccessResponse>;
}

@@ -35,5 +35,5 @@ "use strict";

class HttpClient {
constructor(url = "http://localhost:46657") {
constructor(url) {
// accept host.name:port and assume http protocol
this.url = rpcclient_1.hasProtocol(url) ? url : "http://" + url;
this.url = (0, rpcclient_1.hasProtocol)(url) ? url : "http://" + url;
}

@@ -44,4 +44,4 @@ disconnect() {

async execute(request) {
const response = json_rpc_1.parseJsonRpcResponse(await http("POST", this.url, request));
if (json_rpc_1.isJsonRpcErrorResponse(response)) {
const response = (0, json_rpc_1.parseJsonRpcResponse)(await http("POST", this.url, request));
if ((0, json_rpc_1.isJsonRpcErrorResponse)(response)) {
throw new Error(JSON.stringify(response.error));

@@ -48,0 +48,0 @@ }

@@ -15,7 +15,7 @@ "use strict";

pendingWithoutTendermint();
const response = await httpclient_1.http("POST", `http://${tendermintUrl}`, jsonrpc_1.createJsonRpcRequest("health"));
const response = await (0, httpclient_1.http)("POST", `http://${tendermintUrl}`, (0, jsonrpc_1.createJsonRpcRequest)("health"));
expect(response).toEqual(jasmine.objectContaining({ jsonrpc: "2.0" }));
});
it("errors for non-open port", async () => {
await expectAsync(httpclient_1.http("POST", `http://localhost:56745`, jsonrpc_1.createJsonRpcRequest("health"))).toBeRejectedWithError(/(ECONNREFUSED|Failed to fetch)/i);
await expectAsync((0, httpclient_1.http)("POST", `http://localhost:56745`, (0, jsonrpc_1.createJsonRpcRequest)("health"))).toBeRejectedWithError(/(ECONNREFUSED|Failed to fetch)/i);
});

@@ -27,9 +27,9 @@ });

const client = new httpclient_1.HttpClient(tendermintUrl);
const healthResponse = await client.execute(jsonrpc_1.createJsonRpcRequest("health"));
const healthResponse = await client.execute((0, jsonrpc_1.createJsonRpcRequest)("health"));
expect(healthResponse.result).toEqual({});
const statusResponse = await client.execute(jsonrpc_1.createJsonRpcRequest("status"));
const statusResponse = await client.execute((0, jsonrpc_1.createJsonRpcRequest)("status"));
expect(statusResponse.result).toBeTruthy();
expect(statusResponse.result.node_info).toBeTruthy();
await client
.execute(jsonrpc_1.createJsonRpcRequest("no-such-method"))
.execute((0, jsonrpc_1.createJsonRpcRequest)("no-such-method"))
.then(() => fail("must not resolve"))

@@ -36,0 +36,0 @@ .catch((error) => expect(error).toBeTruthy());

@@ -0,3 +1,3 @@

export { HttpClient } from "./httpclient";
export { instanceOfRpcStreamingClient, RpcClient, RpcStreamingClient, SubscriptionEvent } from "./rpcclient";
export { HttpClient } from "./httpclient";
export { WebsocketClient } from "./websocketclient";
"use strict";
// This folder contains Tendermint-specific RPC clients
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebsocketClient = exports.HttpClient = exports.instanceOfRpcStreamingClient = void 0;
exports.WebsocketClient = exports.instanceOfRpcStreamingClient = exports.HttpClient = void 0;
var httpclient_1 = require("./httpclient");
Object.defineProperty(exports, "HttpClient", { enumerable: true, get: function () { return httpclient_1.HttpClient; } });
var rpcclient_1 = require("./rpcclient");
Object.defineProperty(exports, "instanceOfRpcStreamingClient", { enumerable: true, get: function () { return rpcclient_1.instanceOfRpcStreamingClient; } });
var httpclient_1 = require("./httpclient");
Object.defineProperty(exports, "HttpClient", { enumerable: true, get: function () { return httpclient_1.HttpClient; } });
var websocketclient_1 = require("./websocketclient");
Object.defineProperty(exports, "WebsocketClient", { enumerable: true, get: function () { return websocketclient_1.WebsocketClient; } });
//# sourceMappingURL=index.js.map

@@ -19,4 +19,4 @@ "use strict";

const wsClient = new websocketclient_1.WebsocketClient(tendermintUrl);
expect(rpcclient_1.instanceOfRpcStreamingClient(httpClient)).toEqual(false);
expect(rpcclient_1.instanceOfRpcStreamingClient(wsClient)).toEqual(true);
expect((0, rpcclient_1.instanceOfRpcStreamingClient)(httpClient)).toEqual(false);
expect((0, rpcclient_1.instanceOfRpcStreamingClient)(wsClient)).toEqual(true);
httpClient.disconnect();

@@ -28,3 +28,3 @@ await wsClient.connected();

pendingWithoutTendermint();
const statusRequest = jsonrpc_1.createJsonRpcRequest("status");
const statusRequest = (0, jsonrpc_1.createJsonRpcRequest)("status");
const httpClient = new httpclient_1.HttpClient(tendermintUrl + "/");

@@ -31,0 +31,0 @@ expect(await httpClient.execute(statusRequest)).toBeDefined();

@@ -10,3 +10,3 @@ import { JsonRpcId, JsonRpcRequest, JsonRpcResponse, JsonRpcSuccessResponse } from "@cosmjs/json-rpc";

private readonly subscriptionStreams;
constructor(baseUrl?: string, onError?: (err: any) => void);
constructor(baseUrl: string, onError?: (err: any) => void);
execute(request: JsonRpcRequest): Promise<JsonRpcSuccessResponse>;

@@ -13,0 +13,0 @@ listen(request: JsonRpcRequest): Stream<SubscriptionEvent>;

@@ -17,3 +17,3 @@ "use strict";

}
const jsonRpcEvent = json_rpc_1.parseJsonRpcResponse(JSON.parse(message.data));
const jsonRpcEvent = (0, json_rpc_1.parseJsonRpcResponse)(JSON.parse(message.data));
return jsonRpcEvent;

@@ -69,3 +69,3 @@ }

next: (response) => {
if (json_rpc_1.isJsonRpcErrorResponse(response)) {
if ((0, json_rpc_1.isJsonRpcErrorResponse)(response)) {
this.closeSubscriptions();

@@ -84,3 +84,3 @@ listener.error(JSON.stringify(response.error));

next: (response) => {
if (json_rpc_1.isJsonRpcErrorResponse(response)) {
if ((0, json_rpc_1.isJsonRpcErrorResponse)(response)) {
this.closeSubscriptions();

@@ -116,3 +116,3 @@ listener.error(JSON.stringify(response.error));

class WebsocketClient {
constructor(baseUrl = "ws://localhost:46657", onError = defaultErrorHandler) {
constructor(baseUrl, onError = defaultErrorHandler) {
// Lazily create streams and use the same stream when listening to the same query twice.

@@ -126,3 +126,3 @@ //

const path = baseUrl.endsWith("/") ? "websocket" : "/websocket";
const cleanBaseUrl = rpcclient_1.hasProtocol(baseUrl) ? baseUrl : "ws://" + baseUrl;
const cleanBaseUrl = (0, rpcclient_1.hasProtocol)(baseUrl) ? baseUrl : "ws://" + baseUrl;
this.url = cleanBaseUrl + path;

@@ -143,3 +143,3 @@ this.socket = new socket_1.ReconnectingSocket(this.url);

const response = await pendingResponse;
if (json_rpc_1.isJsonRpcErrorResponse(response)) {
if ((0, json_rpc_1.isJsonRpcErrorResponse)(response)) {
throw new Error(JSON.stringify(response.error));

@@ -176,3 +176,3 @@ }

async responseForRequestId(id) {
return stream_1.firstEvent(this.jsonRpcResponseStream.filter((r) => r.id === id));
return (0, stream_1.firstEvent)(this.jsonRpcResponseStream.filter((r) => r.id === id));
}

@@ -179,0 +179,0 @@ }

@@ -19,9 +19,9 @@ "use strict";

const client = new websocketclient_1.WebsocketClient(tendermintUrl);
const healthResponse = await client.execute(jsonrpc_1.createJsonRpcRequest("health"));
const healthResponse = await client.execute((0, jsonrpc_1.createJsonRpcRequest)("health"));
expect(healthResponse.result).toEqual({});
const statusResponse = await client.execute(jsonrpc_1.createJsonRpcRequest("status"));
const statusResponse = await client.execute((0, jsonrpc_1.createJsonRpcRequest)("status"));
expect(statusResponse.result).toBeTruthy();
expect(statusResponse.result.node_info).toBeTruthy();
await client
.execute(jsonrpc_1.createJsonRpcRequest("no-such-method"))
.execute((0, jsonrpc_1.createJsonRpcRequest)("no-such-method"))
.then(() => fail("must not resolve"))

@@ -35,3 +35,3 @@ .catch((error) => expect(error).toBeTruthy());

const query = "tm.event='NewBlockHeader'";
const req = jsonrpc_1.createJsonRpcRequest("subscribe", { query: query });
const req = (0, jsonrpc_1.createJsonRpcRequest)("subscribe", { query: query });
const headers = client.listen(req);

@@ -65,7 +65,7 @@ const events = [];

// we need two requests with unique IDs
const request1 = jsonrpc_1.createJsonRpcRequest("subscribe", { query: newBlockHeaderQuery });
const request2 = jsonrpc_1.createJsonRpcRequest("subscribe", { query: newBlockHeaderQuery });
const request1 = (0, jsonrpc_1.createJsonRpcRequest)("subscribe", { query: newBlockHeaderQuery });
const request2 = (0, jsonrpc_1.createJsonRpcRequest)("subscribe", { query: newBlockHeaderQuery });
const stream1 = client.listen(request1);
const stream2 = client.listen(request2);
const eventHeights = await stream_1.toListPromise(xstream_1.Stream.merge(stream1, stream2).map((event) => {
const eventHeights = await (0, stream_1.toListPromise)(xstream_1.Stream.merge(stream1, stream2).map((event) => {
// height is string or number, depending on Tendermint version. But we don't care in this case

@@ -81,3 +81,3 @@ return event.data.value.header.height;

const query = "tm.event='NewBlockHeader'";
const req = jsonrpc_1.createJsonRpcRequest("subscribe", { query: query });
const req = (0, jsonrpc_1.createJsonRpcRequest)("subscribe", { query: query });
const headers = client.listen(req);

@@ -103,3 +103,3 @@ const events = [];

client
.execute(jsonrpc_1.createJsonRpcRequest("status"))
.execute((0, jsonrpc_1.createJsonRpcRequest)("status"))
.then((startusResponse) => expect(startusResponse).toBeTruthy())

@@ -112,3 +112,3 @@ .catch(done.fail);

const query = "tm.event='NewBlockHeader'";
const req = jsonrpc_1.createJsonRpcRequest("subscribe", { query: query });
const req = (0, jsonrpc_1.createJsonRpcRequest)("subscribe", { query: query });
const headers = client.listen(req);

@@ -130,6 +130,6 @@ const receivedEvents = [];

// dummy command to ensure client is connected
await client.execute(jsonrpc_1.createJsonRpcRequest("health"));
await client.execute((0, jsonrpc_1.createJsonRpcRequest)("health"));
client.disconnect();
await client
.execute(jsonrpc_1.createJsonRpcRequest("health"))
.execute((0, jsonrpc_1.createJsonRpcRequest)("health"))
.then(() => fail("must not resolve"))

@@ -144,6 +144,6 @@ .catch((error) => expect(error).toMatch(/socket has disconnected/i));

// dummy command to ensure client is connected
await client.execute(jsonrpc_1.createJsonRpcRequest("health"));
await client.execute((0, jsonrpc_1.createJsonRpcRequest)("health"));
client.disconnect();
const query = "tm.event='NewBlockHeader'";
const req = jsonrpc_1.createJsonRpcRequest("subscribe", { query: query });
const req = (0, jsonrpc_1.createJsonRpcRequest)("subscribe", { query: query });
expect(() => client.listen(req).subscribe({})).toThrowError(/socket has disconnected/i);

@@ -156,3 +156,3 @@ done();

const client = new websocketclient_1.WebsocketClient(tendermintUrl);
const req = jsonrpc_1.createJsonRpcRequest("health");
const req = (0, jsonrpc_1.createJsonRpcRequest)("health");
expect(() => client.listen(req)).toThrowError(/request method must be "subscribe"/i);

@@ -159,0 +159,0 @@ await client.connected();

@@ -30,3 +30,3 @@ "use strict";

return {
height: encodings_1.may(encodings_1.Integer.encode, param.height),
height: (0, encodings_1.may)(encodings_1.Integer.encode, param.height),
};

@@ -36,4 +36,4 @@ }

return {
minHeight: encodings_1.may(encodings_1.Integer.encode, param.minHeight),
maxHeight: encodings_1.may(encodings_1.Integer.encode, param.maxHeight),
minHeight: (0, encodings_1.may)(encodings_1.Integer.encode, param.minHeight),
maxHeight: (0, encodings_1.may)(encodings_1.Integer.encode, param.maxHeight),
};

@@ -44,4 +44,4 @@ }

query: params.query,
page: encodings_1.may(encodings_1.Integer.encode, params.page),
per_page: encodings_1.may(encodings_1.Integer.encode, params.per_page),
page: (0, encodings_1.may)(encodings_1.Integer.encode, params.page),
per_page: (0, encodings_1.may)(encodings_1.Integer.encode, params.per_page),
order_by: params.order_by,

@@ -52,5 +52,5 @@ };

return {
path: encodings_1.assertNotEmpty(params.path),
data: encoding_1.toHex(params.data),
height: encodings_1.may(encodings_1.Integer.encode, params.height),
path: (0, encodings_1.assertNotEmpty)(params.path),
data: (0, encoding_1.toHex)(params.data),
height: (0, encodings_1.may)(encodings_1.Integer.encode, params.height),
prove: params.prove,

@@ -61,3 +61,3 @@ };

return {
tx: encoding_1.toBase64(encodings_1.assertNotEmpty(params.tx)),
tx: (0, encoding_1.toBase64)((0, encodings_1.assertNotEmpty)(params.tx)),
};

@@ -67,3 +67,3 @@ }

return {
hash: encoding_1.toBase64(encodings_1.assertNotEmpty(params.hash)),
hash: (0, encoding_1.toBase64)((0, encodings_1.assertNotEmpty)(params.hash)),
prove: params.prove,

@@ -76,4 +76,4 @@ };

prove: params.prove,
page: encodings_1.may(encodings_1.Integer.encode, params.page),
per_page: encodings_1.may(encodings_1.Integer.encode, params.per_page),
page: (0, encodings_1.may)(encodings_1.Integer.encode, params.page),
per_page: (0, encodings_1.may)(encodings_1.Integer.encode, params.per_page),
order_by: params.order_by,

@@ -84,5 +84,5 @@ };

return {
height: encodings_1.may(encodings_1.Integer.encode, params.height),
page: encodings_1.may(encodings_1.Integer.encode, params.page),
per_page: encodings_1.may(encodings_1.Integer.encode, params.per_page),
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),
};

@@ -92,33 +92,33 @@ }

static encodeAbciInfo(req) {
return jsonrpc_1.createJsonRpcRequest(req.method);
return (0, jsonrpc_1.createJsonRpcRequest)(req.method);
}
static encodeAbciQuery(req) {
return jsonrpc_1.createJsonRpcRequest(req.method, encodeAbciQueryParams(req.params));
return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeAbciQueryParams(req.params));
}
static encodeBlock(req) {
return jsonrpc_1.createJsonRpcRequest(req.method, encodeHeightParam(req.params));
return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeHeightParam(req.params));
}
static encodeBlockchain(req) {
return jsonrpc_1.createJsonRpcRequest(req.method, encodeBlockchainRequestParams(req.params));
return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeBlockchainRequestParams(req.params));
}
static encodeBlockResults(req) {
return jsonrpc_1.createJsonRpcRequest(req.method, encodeHeightParam(req.params));
return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeHeightParam(req.params));
}
static encodeBlockSearch(req) {
return jsonrpc_1.createJsonRpcRequest(req.method, encodeBlockSearchParams(req.params));
return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeBlockSearchParams(req.params));
}
static encodeBroadcastTx(req) {
return jsonrpc_1.createJsonRpcRequest(req.method, encodeBroadcastTxParams(req.params));
return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeBroadcastTxParams(req.params));
}
static encodeCommit(req) {
return jsonrpc_1.createJsonRpcRequest(req.method, encodeHeightParam(req.params));
return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeHeightParam(req.params));
}
static encodeGenesis(req) {
return jsonrpc_1.createJsonRpcRequest(req.method);
return (0, jsonrpc_1.createJsonRpcRequest)(req.method);
}
static encodeHealth(req) {
return jsonrpc_1.createJsonRpcRequest(req.method);
return (0, jsonrpc_1.createJsonRpcRequest)(req.method);
}
static encodeStatus(req) {
return jsonrpc_1.createJsonRpcRequest(req.method);
return (0, jsonrpc_1.createJsonRpcRequest)(req.method);
}

@@ -128,13 +128,13 @@ static encodeSubscribe(req) {

const query = requests.buildQuery({ tags: [eventTag], raw: req.query.raw });
return jsonrpc_1.createJsonRpcRequest("subscribe", { query: query });
return (0, jsonrpc_1.createJsonRpcRequest)("subscribe", { query: query });
}
static encodeTx(req) {
return jsonrpc_1.createJsonRpcRequest(req.method, encodeTxParams(req.params));
return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeTxParams(req.params));
}
// TODO: encode params for query string???
static encodeTxSearch(req) {
return jsonrpc_1.createJsonRpcRequest(req.method, encodeTxSearchParams(req.params));
return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeTxSearchParams(req.params));
}
static encodeValidators(req) {
return jsonrpc_1.createJsonRpcRequest(req.method, encodeValidatorsParams(req.params));
return (0, jsonrpc_1.createJsonRpcRequest)(req.method, encodeValidatorsParams(req.params));
}

@@ -141,0 +141,0 @@ }

@@ -14,4 +14,4 @@ "use strict";

data: data.data,
lastBlockHeight: encodings_1.may(encodings_1.Integer.parse, data.last_block_height),
lastBlockAppHash: encodings_1.may(encoding_1.fromBase64, data.last_block_app_hash),
lastBlockHeight: (0, encodings_1.may)(encodings_1.Integer.parse, data.last_block_height),
lastBlockAppHash: (0, encodings_1.may)(encoding_1.fromBase64, data.last_block_app_hash),
};

@@ -23,4 +23,4 @@ }

type: op.type,
key: encoding_1.fromBase64(op.key),
data: encoding_1.fromBase64(op.data),
key: (0, encoding_1.fromBase64)(op.key),
data: (0, encoding_1.fromBase64)(op.data),
})),

@@ -31,8 +31,8 @@ };

return {
key: encoding_1.fromBase64(encodings_1.optional(data.key, "")),
value: encoding_1.fromBase64(encodings_1.optional(data.value, "")),
proof: encodings_1.may(decodeQueryProof, data.proofOps),
height: encodings_1.may(encodings_1.Integer.parse, data.height),
code: encodings_1.may(encodings_1.Integer.parse, data.code),
index: encodings_1.may(encodings_1.Integer.parse, data.index),
key: (0, encoding_1.fromBase64)((0, encodings_1.optional)(data.key, "")),
value: (0, encoding_1.fromBase64)((0, encodings_1.optional)(data.value, "")),
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),
log: data.log,

@@ -43,8 +43,8 @@ };

return {
key: encoding_1.fromBase64(encodings_1.assertNotEmpty(attribute.key)),
value: encoding_1.fromBase64(encodings_1.optional(attribute.value, "")),
key: (0, encoding_1.fromBase64)((0, encodings_1.assertNotEmpty)(attribute.key)),
value: (0, encoding_1.fromBase64)((0, encodings_1.optional)(attribute.value, "")),
};
}
function decodeAttributes(attributes) {
return encodings_1.assertArray(attributes).map(decodeAttribute);
return (0, encodings_1.assertArray)(attributes).map(decodeAttribute);
}

@@ -58,13 +58,13 @@ function decodeEvent(event) {

function decodeEvents(events) {
return encodings_1.assertArray(events).map(decodeEvent);
return (0, encodings_1.assertArray)(events).map(decodeEvent);
}
function decodeTxData(data) {
return {
code: encodings_1.Integer.parse(encodings_1.assertNumber(encodings_1.optional(data.code, 0))),
code: encodings_1.Integer.parse((0, encodings_1.assertNumber)((0, encodings_1.optional)(data.code, 0))),
codeSpace: data.codespace,
log: data.log,
data: encodings_1.may(encoding_1.fromBase64, data.data),
data: (0, encodings_1.may)(encoding_1.fromBase64, data.data),
events: data.events ? decodeEvents(data.events) : [],
gasWanted: encodings_1.Integer.parse(encodings_1.optional(data.gas_wanted, "0")),
gasUsed: encodings_1.Integer.parse(encodings_1.optional(data.gas_used, "0")),
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")),
};

@@ -78,3 +78,3 @@ }

algorithm: "ed25519",
data: encoding_1.fromBase64(encodings_1.assertNotEmpty(data.value)),
data: (0, encoding_1.fromBase64)((0, encodings_1.assertNotEmpty)(data.value)),
};

@@ -84,3 +84,3 @@ case "tendermint/PubKeySecp256k1":

algorithm: "secp256k1",
data: encoding_1.fromBase64(encodings_1.assertNotEmpty(data.value)),
data: (0, encoding_1.fromBase64)((0, encodings_1.assertNotEmpty)(data.value)),
};

@@ -93,5 +93,5 @@ default:

return {
pubkey: decodePubkey(encodings_1.assertObject(data.pub_key)),
votingPower: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.voting_power)),
address: encoding_1.fromHex(encodings_1.assertNotEmpty(data.address)),
pubkey: decodePubkey((0, encodings_1.assertObject)(data.pub_key)),
votingPower: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.voting_power)),
address: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.address)),
proposerPriority: encodings_1.Integer.parse(data.proposer_priority),

@@ -108,4 +108,4 @@ };

return {
maxBytes: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.max_bytes)),
maxGas: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.max_gas)),
maxBytes: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.max_bytes)),
maxGas: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.max_gas)),
};

@@ -115,4 +115,4 @@ }

return {
maxAgeNumBlocks: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.max_age_num_blocks)),
maxAgeDuration: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.max_age_duration)),
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)),
};

@@ -122,4 +122,4 @@ }

return {
block: decodeBlockParams(encodings_1.assertObject(data.block)),
evidence: decodeEvidenceParams(encodings_1.assertObject(data.evidence)),
block: decodeBlockParams((0, encodings_1.assertObject)(data.block)),
evidence: decodeEvidenceParams((0, encodings_1.assertObject)(data.evidence)),
};

@@ -129,6 +129,6 @@ }

return {
height: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.height)),
height: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.height)),
results: (data.txs_results || []).map(decodeTxData),
validatorUpdates: (data.validator_updates || []).map(decodeValidatorUpdate),
consensusUpdates: encodings_1.may(decodeConsensusParams, data.consensus_param_updates),
consensusUpdates: (0, encodings_1.may)(decodeConsensusParams, data.consensus_param_updates),
beginBlockEvents: decodeEvents(data.begin_block_events || []),

@@ -140,6 +140,6 @@ endBlockEvents: decodeEvents(data.end_block_events || []),

return {
hash: encoding_1.fromHex(encodings_1.assertNotEmpty(data.hash)),
hash: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.hash)),
parts: {
total: encodings_1.assertNotEmpty(data.parts.total),
hash: encoding_1.fromHex(encodings_1.assertNotEmpty(data.parts.hash)),
total: (0, encodings_1.assertNotEmpty)(data.parts.total),
hash: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.parts.hash)),
},

@@ -158,17 +158,17 @@ };

version: decodeBlockVersion(data.version),
chainId: encodings_1.assertNotEmpty(data.chain_id),
height: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.height)),
time: dates_1.fromRfc3339WithNanoseconds(encodings_1.assertNotEmpty(data.time)),
chainId: (0, encodings_1.assertNotEmpty)(data.chain_id),
height: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.height)),
time: (0, dates_1.fromRfc3339WithNanoseconds)((0, encodings_1.assertNotEmpty)(data.time)),
// When there is no last block ID (i.e. this block's height is 1), we get an empty structure like this:
// { hash: '', parts: { total: 0, hash: '' } }
lastBlockId: data.last_block_id.hash ? decodeBlockId(data.last_block_id) : null,
lastCommitHash: encoding_1.fromHex(encodings_1.assertSet(data.last_commit_hash)),
dataHash: encoding_1.fromHex(encodings_1.assertSet(data.data_hash)),
validatorsHash: encoding_1.fromHex(encodings_1.assertSet(data.validators_hash)),
nextValidatorsHash: encoding_1.fromHex(encodings_1.assertSet(data.next_validators_hash)),
consensusHash: encoding_1.fromHex(encodings_1.assertSet(data.consensus_hash)),
appHash: encoding_1.fromHex(encodings_1.assertSet(data.app_hash)),
lastResultsHash: encoding_1.fromHex(encodings_1.assertSet(data.last_results_hash)),
evidenceHash: encoding_1.fromHex(encodings_1.assertSet(data.evidence_hash)),
proposerAddress: encoding_1.fromHex(encodings_1.assertNotEmpty(data.proposer_address)),
lastCommitHash: (0, encoding_1.fromHex)((0, encodings_1.assertSet)(data.last_commit_hash)),
dataHash: (0, encoding_1.fromHex)((0, encodings_1.assertSet)(data.data_hash)),
validatorsHash: (0, encoding_1.fromHex)((0, encodings_1.assertSet)(data.validators_hash)),
nextValidatorsHash: (0, encoding_1.fromHex)((0, encodings_1.assertSet)(data.next_validators_hash)),
consensusHash: (0, encoding_1.fromHex)((0, encodings_1.assertSet)(data.consensus_hash)),
appHash: (0, encoding_1.fromHex)((0, encodings_1.assertSet)(data.app_hash)),
lastResultsHash: (0, encoding_1.fromHex)((0, encodings_1.assertSet)(data.last_results_hash)),
evidenceHash: (0, encoding_1.fromHex)((0, encodings_1.assertSet)(data.evidence_hash)),
proposerAddress: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.proposer_address)),
};

@@ -179,5 +179,5 @@ }

blockId: decodeBlockId(data.block_id),
blockSize: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.block_size)),
blockSize: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.block_size)),
header: decodeHeader(data.header),
numTxs: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.num_txs)),
numTxs: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.num_txs)),
};

@@ -187,8 +187,8 @@ }

return {
lastHeight: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.last_height)),
blockMetas: encodings_1.assertArray(data.block_metas).map(decodeBlockMeta),
lastHeight: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.last_height)),
blockMetas: (0, encodings_1.assertArray)(data.block_metas).map(decodeBlockMeta),
};
}
function decodeBroadcastTxSync(data) {
return Object.assign(Object.assign({}, decodeTxData(data)), { hash: encoding_1.fromHex(encodings_1.assertNotEmpty(data.hash)) });
return Object.assign(Object.assign({}, decodeTxData(data)), { hash: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.hash)) });
}

@@ -198,9 +198,9 @@ function decodeBroadcastTxCommit(data) {

height: encodings_1.Integer.parse(data.height),
hash: encoding_1.fromHex(encodings_1.assertNotEmpty(data.hash)),
checkTx: decodeTxData(encodings_1.assertObject(data.check_tx)),
deliverTx: encodings_1.may(decodeTxData, data.deliver_tx),
hash: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.hash)),
checkTx: decodeTxData((0, encodings_1.assertObject)(data.check_tx)),
deliverTx: (0, encodings_1.may)(decodeTxData, data.deliver_tx),
};
}
function decodeBlockIdFlag(blockIdFlag) {
utils_1.assert(blockIdFlag in types_1.BlockIdFlag);
(0, utils_1.assert)(blockIdFlag in types_1.BlockIdFlag);
return blockIdFlag;

@@ -216,3 +216,3 @@ }

const nonZeroTime = timestamp && !timestamp.startsWith("0001-01-01");
return nonZeroTime ? dates_1.fromRfc3339WithNanoseconds(timestamp) : undefined;
return nonZeroTime ? (0, dates_1.fromRfc3339WithNanoseconds)(timestamp) : undefined;
}

@@ -222,5 +222,5 @@ function decodeCommitSignature(data) {

blockIdFlag: decodeBlockIdFlag(data.block_id_flag),
validatorAddress: data.validator_address ? encoding_1.fromHex(data.validator_address) : undefined,
validatorAddress: data.validator_address ? (0, encoding_1.fromHex)(data.validator_address) : undefined,
timestamp: decodeOptionalTime(data.timestamp),
signature: data.signature ? encoding_1.fromBase64(data.signature) : undefined,
signature: data.signature ? (0, encoding_1.fromBase64)(data.signature) : undefined,
};

@@ -230,6 +230,6 @@ }

return {
blockId: decodeBlockId(encodings_1.assertObject(data.block_id)),
height: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.height)),
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),
signatures: encodings_1.assertArray(data.signatures).map(decodeCommitSignature),
signatures: (0, encodings_1.assertArray)(data.signatures).map(decodeCommitSignature),
};

@@ -239,3 +239,3 @@ }

return {
canonical: encodings_1.assertBoolean(data.canonical),
canonical: (0, encodings_1.assertBoolean)(data.canonical),
header: decodeHeader(data.signed_header.header),

@@ -247,5 +247,5 @@ commit: decodeCommit(data.signed_header.commit),

return {
address: encoding_1.fromHex(encodings_1.assertNotEmpty(data.address)),
pubkey: decodePubkey(encodings_1.assertObject(data.pub_key)),
votingPower: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.power)),
address: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.address)),
pubkey: decodePubkey((0, encodings_1.assertObject)(data.pub_key)),
votingPower: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.power)),
};

@@ -255,7 +255,7 @@ }

return {
genesisTime: dates_1.fromRfc3339WithNanoseconds(encodings_1.assertNotEmpty(data.genesis_time)),
chainId: encodings_1.assertNotEmpty(data.chain_id),
genesisTime: (0, dates_1.fromRfc3339WithNanoseconds)((0, encodings_1.assertNotEmpty)(data.genesis_time)),
chainId: (0, encodings_1.assertNotEmpty)(data.chain_id),
consensusParams: decodeConsensusParams(data.consensus_params),
validators: data.validators ? encodings_1.assertArray(data.validators).map(decodeValidatorGenesis) : [],
appHash: encoding_1.fromHex(encodings_1.assertSet(data.app_hash)),
validators: data.validators ? (0, encodings_1.assertArray)(data.validators).map(decodeValidatorGenesis) : [],
appHash: (0, encoding_1.fromHex)((0, encodings_1.assertSet)(data.app_hash)),
appState: data.app_state,

@@ -266,5 +266,5 @@ };

return {
pubkey: decodePubkey(encodings_1.assertObject(data.pub_key)),
votingPower: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.voting_power)),
address: encoding_1.fromHex(encodings_1.assertNotEmpty(data.address)),
pubkey: decodePubkey((0, encodings_1.assertObject)(data.pub_key)),
votingPower: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.voting_power)),
address: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.address)),
};

@@ -274,13 +274,13 @@ }

return {
id: encoding_1.fromHex(encodings_1.assertNotEmpty(data.id)),
listenAddr: encodings_1.assertNotEmpty(data.listen_addr),
network: encodings_1.assertNotEmpty(data.network),
version: encodings_1.assertString(data.version),
channels: encodings_1.assertNotEmpty(data.channels),
moniker: encodings_1.assertNotEmpty(data.moniker),
other: encodings_1.dictionaryToStringMap(data.other),
id: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.id)),
listenAddr: (0, encodings_1.assertNotEmpty)(data.listen_addr),
network: (0, encodings_1.assertNotEmpty)(data.network),
version: (0, encodings_1.assertString)(data.version),
channels: (0, encodings_1.assertNotEmpty)(data.channels),
moniker: (0, encodings_1.assertNotEmpty)(data.moniker),
other: (0, encodings_1.dictionaryToStringMap)(data.other),
protocolVersion: {
app: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.protocol_version.app)),
block: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.protocol_version.block)),
p2p: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.protocol_version.p2p)),
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)),
},

@@ -291,7 +291,7 @@ };

return {
latestBlockHash: encoding_1.fromHex(encodings_1.assertNotEmpty(data.latest_block_hash)),
latestAppHash: encoding_1.fromHex(encodings_1.assertNotEmpty(data.latest_app_hash)),
latestBlockTime: dates_1.fromRfc3339WithNanoseconds(encodings_1.assertNotEmpty(data.latest_block_time)),
latestBlockHeight: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.latest_block_height)),
catchingUp: encodings_1.assertBoolean(data.catching_up),
latestBlockHash: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.latest_block_hash)),
latestAppHash: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.latest_app_hash)),
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)),
catchingUp: (0, encodings_1.assertBoolean)(data.catching_up),
};

@@ -308,9 +308,9 @@ }

return {
data: encoding_1.fromBase64(encodings_1.assertNotEmpty(data.data)),
rootHash: encoding_1.fromHex(encodings_1.assertNotEmpty(data.root_hash)),
data: (0, encoding_1.fromBase64)((0, encodings_1.assertNotEmpty)(data.data)),
rootHash: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.root_hash)),
proof: {
total: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.proof.total)),
index: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.proof.index)),
leafHash: encoding_1.fromBase64(encodings_1.assertNotEmpty(data.proof.leaf_hash)),
aunts: encodings_1.assertArray(data.proof.aunts).map(encoding_1.fromBase64),
total: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.proof.total)),
index: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.proof.index)),
leafHash: (0, encoding_1.fromBase64)((0, encodings_1.assertNotEmpty)(data.proof.leaf_hash)),
aunts: (0, encodings_1.assertArray)(data.proof.aunts).map(encoding_1.fromBase64),
},

@@ -321,8 +321,8 @@ };

return {
tx: encoding_1.fromBase64(encodings_1.assertNotEmpty(data.tx)),
result: decodeTxData(encodings_1.assertObject(data.tx_result)),
height: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.height)),
index: encodings_1.Integer.parse(encodings_1.assertNumber(data.index)),
hash: encoding_1.fromHex(encodings_1.assertNotEmpty(data.hash)),
proof: encodings_1.may(decodeTxProof, data.proof),
tx: (0, encoding_1.fromBase64)((0, encodings_1.assertNotEmpty)(data.tx)),
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)),
hash: (0, encoding_1.fromHex)((0, encodings_1.assertNotEmpty)(data.hash)),
proof: (0, encodings_1.may)(decodeTxProof, data.proof),
};

@@ -332,14 +332,14 @@ }

return {
totalCount: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.total_count)),
txs: encodings_1.assertArray(data.txs).map(decodeTxResponse),
totalCount: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.total_count)),
txs: (0, encodings_1.assertArray)(data.txs).map(decodeTxResponse),
};
}
function decodeTxEvent(data) {
const tx = encoding_1.fromBase64(encodings_1.assertNotEmpty(data.tx));
const tx = (0, encoding_1.fromBase64)((0, encodings_1.assertNotEmpty)(data.tx));
return {
tx: tx,
hash: hasher_1.hashTx(tx),
hash: (0, hasher_1.hashTx)(tx),
result: decodeTxData(data.result),
height: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.height)),
index: encodings_1.may(encodings_1.Integer.parse, data.index),
height: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.height)),
index: (0, encodings_1.may)(encodings_1.Integer.parse, data.index),
};

@@ -349,6 +349,6 @@ }

return {
blockHeight: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.block_height)),
validators: encodings_1.assertArray(data.validators).map(decodeValidatorUpdate),
count: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.count)),
total: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.total)),
blockHeight: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.block_height)),
validators: (0, encodings_1.assertArray)(data.validators).map(decodeValidatorUpdate),
count: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.count)),
total: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.total)),
};

@@ -358,6 +358,6 @@ }

return {
type: encodings_1.assertNotEmpty(data.type),
height: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.height)),
time: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.time)),
totalVotingPower: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.totalVotingPower)),
type: (0, encodings_1.assertNotEmpty)(data.type),
height: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.height)),
time: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.time)),
totalVotingPower: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.totalVotingPower)),
validator: decodeValidatorUpdate(data.validator),

@@ -367,12 +367,12 @@ };

function decodeEvidences(ev) {
return encodings_1.assertArray(ev).map(decodeEvidence);
return (0, encodings_1.assertArray)(ev).map(decodeEvidence);
}
function decodeBlock(data) {
return {
header: decodeHeader(encodings_1.assertObject(data.header)),
header: decodeHeader((0, encodings_1.assertObject)(data.header)),
// For the block at height 1, last commit is not set. This is represented in an empty object like this:
// { height: '0', round: 0, block_id: { hash: '', parts: [Object] }, signatures: [] }
lastCommit: data.last_commit.block_id.hash ? decodeCommit(encodings_1.assertObject(data.last_commit)) : null,
txs: data.data.txs ? encodings_1.assertArray(data.data.txs).map(encoding_1.fromBase64) : [],
evidence: data.evidence && encodings_1.may(decodeEvidences, data.evidence.evidence),
lastCommit: data.last_commit.block_id.hash ? decodeCommit((0, encodings_1.assertObject)(data.last_commit)) : null,
txs: data.data.txs ? (0, encodings_1.assertArray)(data.data.txs).map(encoding_1.fromBase64) : [],
evidence: data.evidence && (0, encodings_1.may)(decodeEvidences, data.evidence.evidence),
};

@@ -388,4 +388,4 @@ }

return {
totalCount: encodings_1.Integer.parse(encodings_1.assertNotEmpty(data.total_count)),
blocks: encodings_1.assertArray(data.blocks).map(decodeBlockResponse),
totalCount: encodings_1.Integer.parse((0, encodings_1.assertNotEmpty)(data.total_count)),
blocks: (0, encodings_1.assertArray)(data.blocks).map(decodeBlockResponse),
};

@@ -395,6 +395,6 @@ }

static decodeAbciInfo(response) {
return decodeAbciInfo(encodings_1.assertObject(response.result.response));
return decodeAbciInfo((0, encodings_1.assertObject)(response.result.response));
}
static decodeAbciQuery(response) {
return decodeAbciQuery(encodings_1.assertObject(response.result.response));
return decodeAbciQuery((0, encodings_1.assertObject)(response.result.response));
}

@@ -426,3 +426,3 @@ static decodeBlock(response) {

static decodeGenesis(response) {
return decodeGenesis(encodings_1.assertObject(response.result.genesis));
return decodeGenesis((0, encodings_1.assertObject)(response.result.genesis));
}

@@ -429,0 +429,0 @@ static decodeHealth() {

@@ -153,3 +153,3 @@ "use strict";

function encodeString(s) {
const utf8 = encoding_1.toUtf8(s);
const utf8 = (0, encoding_1.toUtf8)(s);
return Uint8Array.from([utf8.length, ...utf8]);

@@ -156,0 +156,0 @@ }

@@ -8,5 +8,5 @@ "use strict";

it("works", () => {
expect(encodings_1.encodeString("")).toEqual(Uint8Array.from([0]));
expect((0, encodings_1.encodeString)("")).toEqual(Uint8Array.from([0]));
const str = "hello iov";
expect(encodings_1.encodeString(str)).toEqual(Uint8Array.from([str.length, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x69, 0x6f, 0x76]));
expect((0, encodings_1.encodeString)(str)).toEqual(Uint8Array.from([str.length, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x69, 0x6f, 0x76]));
});

@@ -16,8 +16,8 @@ });

it("works", () => {
expect(encodings_1.encodeInt(0)).toEqual(Uint8Array.from([0]));
expect(encodings_1.encodeInt(1)).toEqual(Uint8Array.from([1]));
expect(encodings_1.encodeInt(127)).toEqual(Uint8Array.from([127]));
expect(encodings_1.encodeInt(128)).toEqual(Uint8Array.from([128, 1]));
expect(encodings_1.encodeInt(255)).toEqual(Uint8Array.from([255, 1]));
expect(encodings_1.encodeInt(256)).toEqual(Uint8Array.from([128, 2]));
expect((0, encodings_1.encodeInt)(0)).toEqual(Uint8Array.from([0]));
expect((0, encodings_1.encodeInt)(1)).toEqual(Uint8Array.from([1]));
expect((0, encodings_1.encodeInt)(127)).toEqual(Uint8Array.from([127]));
expect((0, encodings_1.encodeInt)(128)).toEqual(Uint8Array.from([128, 1]));
expect((0, encodings_1.encodeInt)(255)).toEqual(Uint8Array.from([255, 1]));
expect((0, encodings_1.encodeInt)(256)).toEqual(Uint8Array.from([128, 2]));
});

@@ -29,3 +29,3 @@ });

readonlyDateWithNanoseconds.nanoseconds = 666666;
expect(encodings_1.encodeTime(readonlyDateWithNanoseconds)).toEqual(Uint8Array.from([0x08, 173, 174, 89, 0x10, 170, 220, 215, 95]));
expect((0, encodings_1.encodeTime)(readonlyDateWithNanoseconds)).toEqual(Uint8Array.from([0x08, 173, 174, 89, 0x10, 170, 220, 215, 95]));
});

@@ -35,5 +35,5 @@ });

it("works", () => {
expect(encodings_1.encodeBytes(Uint8Array.from([]))).toEqual(Uint8Array.from([]));
expect((0, encodings_1.encodeBytes)(Uint8Array.from([]))).toEqual(Uint8Array.from([]));
const uint8Array = Uint8Array.from([1, 2, 3, 4, 5, 6, 7]);
expect(encodings_1.encodeBytes(uint8Array)).toEqual(Uint8Array.from([uint8Array.length, 1, 2, 3, 4, 5, 6, 7]));
expect((0, encodings_1.encodeBytes)(uint8Array)).toEqual(Uint8Array.from([uint8Array.length, 1, 2, 3, 4, 5, 6, 7]));
});

@@ -47,3 +47,3 @@ });

};
expect(encodings_1.encodeVersion(version)).toEqual(Uint8Array.from([0x08, 170, 216, 40, 0x10, 200, 1]));
expect((0, encodings_1.encodeVersion)(version)).toEqual(Uint8Array.from([0x08, 170, 216, 40, 0x10, 200, 1]));
});

@@ -60,3 +60,3 @@ });

};
expect(encodings_1.encodeBlockId(blockId)).toEqual(Uint8Array.from([
expect((0, encodings_1.encodeBlockId)(blockId)).toEqual(Uint8Array.from([
0x0a,

@@ -63,0 +63,0 @@ blockId.hash.length,

@@ -9,3 +9,3 @@ "use strict";

function hashTx(tx) {
return crypto_1.sha256(tx);
return (0, crypto_1.sha256)(tx);
}

@@ -51,16 +51,16 @@ exports.hashTx = hashTx;

const encodedFields = [
encodings_1.encodeVersion(header.version),
encodings_1.encodeString(header.chainId),
encodings_1.encodeInt(header.height),
encodings_1.encodeTime(header.time),
encodings_1.encodeBlockId(header.lastBlockId),
encodings_1.encodeBytes(header.lastCommitHash),
encodings_1.encodeBytes(header.dataHash),
encodings_1.encodeBytes(header.validatorsHash),
encodings_1.encodeBytes(header.nextValidatorsHash),
encodings_1.encodeBytes(header.consensusHash),
encodings_1.encodeBytes(header.appHash),
encodings_1.encodeBytes(header.lastResultsHash),
encodings_1.encodeBytes(header.evidenceHash),
encodings_1.encodeBytes(header.proposerAddress),
(0, encodings_1.encodeVersion)(header.version),
(0, encodings_1.encodeString)(header.chainId),
(0, encodings_1.encodeInt)(header.height),
(0, encodings_1.encodeTime)(header.time),
(0, encodings_1.encodeBlockId)(header.lastBlockId),
(0, encodings_1.encodeBytes)(header.lastCommitHash),
(0, encodings_1.encodeBytes)(header.dataHash),
(0, encodings_1.encodeBytes)(header.validatorsHash),
(0, encodings_1.encodeBytes)(header.nextValidatorsHash),
(0, encodings_1.encodeBytes)(header.consensusHash),
(0, encodings_1.encodeBytes)(header.appHash),
(0, encodings_1.encodeBytes)(header.lastResultsHash),
(0, encodings_1.encodeBytes)(header.evidenceHash),
(0, encodings_1.encodeBytes)(header.proposerAddress),
];

@@ -67,0 +67,0 @@ return hashTree(encodedFields);

@@ -10,5 +10,5 @@ "use strict";

// curl "http://localhost:11127/tx_search?query=\"tx.hash='5CB2CF94A1097A4BC19258BC2353C3E76102B6D528458BE45C855DC5563C1DB2'\""
const txId = encoding_1.fromHex("5CB2CF94A1097A4BC19258BC2353C3E76102B6D528458BE45C855DC5563C1DB2");
const txData = encoding_1.fromBase64("YUpxZDY2NURaUDMxPWd2TzBPdnNrVWFWYg==");
expect(hasher_1.hashTx(txData)).toEqual(txId);
const txId = (0, encoding_1.fromHex)("5CB2CF94A1097A4BC19258BC2353C3E76102B6D528458BE45C855DC5563C1DB2");
const txData = (0, encoding_1.fromBase64)("YUpxZDY2NURaUDMxPWd2TzBPdnNrVWFWYg==");
expect((0, hasher_1.hashTx)(txData)).toEqual(txId);
});

@@ -18,3 +18,3 @@ it("creates block hash equal to local test for empty block", () => {

// curl "http://localhost:11133/block"
const blockId = encoding_1.fromHex("153C484DCBC33633F0616BC019388C93DEA94F7880627976F2BFE83749E062F7");
const blockId = (0, encoding_1.fromHex)("153C484DCBC33633F0616BC019388C93DEA94F7880627976F2BFE83749E062F7");
const time = new readonly_date_1.ReadonlyDate("2020-06-23T13:54:15.4638668Z");

@@ -31,19 +31,19 @@ time.nanoseconds = 866800;

lastBlockId: {
hash: encoding_1.fromHex("1EC48444E64E7B96585BA518613612E52B976E3DA2F2222B9CD4D1602656C96F"),
hash: (0, encoding_1.fromHex)("1EC48444E64E7B96585BA518613612E52B976E3DA2F2222B9CD4D1602656C96F"),
parts: {
total: 1,
hash: encoding_1.fromHex("D4E6F1B0EE08D0438C9BB8455D7D3F2FC1883C32D66F7C69C4A0F093B073F6D2"),
hash: (0, encoding_1.fromHex)("D4E6F1B0EE08D0438C9BB8455D7D3F2FC1883C32D66F7C69C4A0F093B073F6D2"),
},
},
lastCommitHash: encoding_1.fromHex("BA6A5EEA6687ACA8EE4FFE4F5D40EA073CB7397A5336309C3EC824805AF9723E"),
dataHash: encoding_1.fromHex(""),
validatorsHash: encoding_1.fromHex("0BEEBC6AB3B7D4FE21E22B609CD4AEC7E121A42C07604FF1827651F0173745EB"),
nextValidatorsHash: encoding_1.fromHex("0BEEBC6AB3B7D4FE21E22B609CD4AEC7E121A42C07604FF1827651F0173745EB"),
consensusHash: encoding_1.fromHex("048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F"),
appHash: encoding_1.fromHex("8801000000000000"),
lastResultsHash: encoding_1.fromHex(""),
evidenceHash: encoding_1.fromHex(""),
proposerAddress: encoding_1.fromHex("614F305502F65C01114F9B8711D9A0AB0AC369F4"),
lastCommitHash: (0, encoding_1.fromHex)("BA6A5EEA6687ACA8EE4FFE4F5D40EA073CB7397A5336309C3EC824805AF9723E"),
dataHash: (0, encoding_1.fromHex)(""),
validatorsHash: (0, encoding_1.fromHex)("0BEEBC6AB3B7D4FE21E22B609CD4AEC7E121A42C07604FF1827651F0173745EB"),
nextValidatorsHash: (0, encoding_1.fromHex)("0BEEBC6AB3B7D4FE21E22B609CD4AEC7E121A42C07604FF1827651F0173745EB"),
consensusHash: (0, encoding_1.fromHex)("048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F"),
appHash: (0, encoding_1.fromHex)("8801000000000000"),
lastResultsHash: (0, encoding_1.fromHex)(""),
evidenceHash: (0, encoding_1.fromHex)(""),
proposerAddress: (0, encoding_1.fromHex)("614F305502F65C01114F9B8711D9A0AB0AC369F4"),
};
expect(hasher_1.hashBlock(blockData)).toEqual(blockId);
expect((0, hasher_1.hashBlock)(blockData)).toEqual(blockId);
});

@@ -53,3 +53,3 @@ it("creates block hash equal to local test for block with a transaction", () => {

// curl "http://localhost:11133/block?height=13575"
const blockId = encoding_1.fromHex("FF2995AF1F38B9A584077E53B5E144778718FB86539A51886A2C55F730403373");
const blockId = (0, encoding_1.fromHex)("FF2995AF1F38B9A584077E53B5E144778718FB86539A51886A2C55F730403373");
const time = new readonly_date_1.ReadonlyDate("2020-06-23T15:34:12.3232688Z");

@@ -66,21 +66,21 @@ time.nanoseconds = 268800;

lastBlockId: {
hash: encoding_1.fromHex("046D5441FC4D008FCDBF9F3DD5DC25CF00883763E44CF4FAF3923FB5FEA42D8F"),
hash: (0, encoding_1.fromHex)("046D5441FC4D008FCDBF9F3DD5DC25CF00883763E44CF4FAF3923FB5FEA42D8F"),
parts: {
total: 1,
hash: encoding_1.fromHex("02E4715343625093C717638EAC67FB3A4B24CCC8DA610E0CB324D705E68FEF7B"),
hash: (0, encoding_1.fromHex)("02E4715343625093C717638EAC67FB3A4B24CCC8DA610E0CB324D705E68FEF7B"),
},
},
lastCommitHash: encoding_1.fromHex("AA2B807F3B0ACC866AB58D90C2D0FC70B6C860CFAC440590B4F590CDC178A207"),
dataHash: encoding_1.fromHex("56782879F526889734BA65375CD92A9152C7114B2C91B2D2AD8464FF69E884AA"),
validatorsHash: encoding_1.fromHex("0BEEBC6AB3B7D4FE21E22B609CD4AEC7E121A42C07604FF1827651F0173745EB"),
nextValidatorsHash: encoding_1.fromHex("0BEEBC6AB3B7D4FE21E22B609CD4AEC7E121A42C07604FF1827651F0173745EB"),
consensusHash: encoding_1.fromHex("048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F"),
appHash: encoding_1.fromHex("CC02000000000000"),
lastResultsHash: encoding_1.fromHex("6E340B9CFFB37A989CA544E6BB780A2C78901D3FB33738768511A30617AFA01D"),
evidenceHash: encoding_1.fromHex(""),
proposerAddress: encoding_1.fromHex("614F305502F65C01114F9B8711D9A0AB0AC369F4"),
lastCommitHash: (0, encoding_1.fromHex)("AA2B807F3B0ACC866AB58D90C2D0FC70B6C860CFAC440590B4F590CDC178A207"),
dataHash: (0, encoding_1.fromHex)("56782879F526889734BA65375CD92A9152C7114B2C91B2D2AD8464FF69E884AA"),
validatorsHash: (0, encoding_1.fromHex)("0BEEBC6AB3B7D4FE21E22B609CD4AEC7E121A42C07604FF1827651F0173745EB"),
nextValidatorsHash: (0, encoding_1.fromHex)("0BEEBC6AB3B7D4FE21E22B609CD4AEC7E121A42C07604FF1827651F0173745EB"),
consensusHash: (0, encoding_1.fromHex)("048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F"),
appHash: (0, encoding_1.fromHex)("CC02000000000000"),
lastResultsHash: (0, encoding_1.fromHex)("6E340B9CFFB37A989CA544E6BB780A2C78901D3FB33738768511A30617AFA01D"),
evidenceHash: (0, encoding_1.fromHex)(""),
proposerAddress: (0, encoding_1.fromHex)("614F305502F65C01114F9B8711D9A0AB0AC369F4"),
};
expect(hasher_1.hashBlock(blockData)).toEqual(blockId);
expect((0, hasher_1.hashBlock)(blockData)).toEqual(blockId);
});
});
//# sourceMappingURL=hasher.spec.js.map

@@ -0,3 +1,3 @@

export { AbciInfoRequest, AbciQueryParams, AbciQueryRequest, BlockchainRequest, BlockRequest, BlockResultsRequest, BlockSearchParams, BlockSearchRequest, BroadcastTxParams, BroadcastTxRequest, CommitRequest, GenesisRequest, HealthRequest, Method, QueryTag, Request, StatusRequest, SubscriptionEventType, TxParams, TxRequest, TxSearchParams, TxSearchRequest, ValidatorsParams, ValidatorsRequest, } from "./requests";
export { AbciInfoResponse, AbciQueryResponse, Attribute, Block, BlockchainResponse, BlockGossipParams, BlockId, BlockMeta, BlockParams, BlockResponse, BlockResultsResponse, BlockSearchResponse, BroadcastTxAsyncResponse, BroadcastTxCommitResponse, broadcastTxCommitSuccess, BroadcastTxSyncResponse, broadcastTxSyncSuccess, Commit, CommitResponse, ConsensusParams, Event, Evidence, EvidenceParams, GenesisResponse, Header, HealthResponse, NewBlockEvent, NewBlockHeaderEvent, NodeInfo, ProofOp, QueryProof, Response, StatusResponse, SyncInfo, TxData, TxEvent, TxProof, TxResponse, TxSearchResponse, TxSizeParams, Validator, ValidatorsResponse, Version, Vote, VoteType, } from "./responses";
export { Tendermint34Client } from "./tendermint34client";
export { AbciInfoRequest, AbciQueryParams, AbciQueryRequest, BlockRequest, BlockchainRequest, BlockSearchParams, BlockSearchRequest, BlockResultsRequest, BroadcastTxRequest, BroadcastTxParams, CommitRequest, GenesisRequest, HealthRequest, Method, Request, QueryTag, StatusRequest, SubscriptionEventType, TxParams, TxRequest, TxSearchParams, TxSearchRequest, ValidatorsRequest, ValidatorsParams, } from "./requests";
export { AbciInfoResponse, AbciQueryResponse, Attribute, Block, BlockchainResponse, BlockGossipParams, BlockId, BlockMeta, BlockParams, BlockResponse, BlockResultsResponse, BlockSearchResponse, BroadcastTxAsyncResponse, BroadcastTxCommitResponse, broadcastTxCommitSuccess, BroadcastTxSyncResponse, broadcastTxSyncSuccess, Commit, CommitResponse, ConsensusParams, Event, Evidence, EvidenceParams, GenesisResponse, Header, HealthResponse, NewBlockEvent, NewBlockHeaderEvent, NodeInfo, ProofOp, QueryProof, Response, StatusResponse, SyncInfo, TxData, TxEvent, TxProof, TxResponse, TxSearchResponse, TxSizeParams, Validator, ValidatorsResponse, Version, Vote, VoteType, } from "./responses";

@@ -5,5 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.VoteType = exports.broadcastTxSyncSuccess = exports.broadcastTxCommitSuccess = exports.SubscriptionEventType = exports.Method = exports.Tendermint34Client = void 0;
var tendermint34client_1 = require("./tendermint34client");
Object.defineProperty(exports, "Tendermint34Client", { enumerable: true, get: function () { return tendermint34client_1.Tendermint34Client; } });
exports.Tendermint34Client = exports.VoteType = exports.broadcastTxSyncSuccess = exports.broadcastTxCommitSuccess = exports.SubscriptionEventType = exports.Method = void 0;
var requests_1 = require("./requests");

@@ -16,2 +14,4 @@ Object.defineProperty(exports, "Method", { enumerable: true, get: function () { return requests_1.Method; } });

Object.defineProperty(exports, "VoteType", { enumerable: true, get: function () { return responses_1.VoteType; } });
var tendermint34client_1 = require("./tendermint34client");
Object.defineProperty(exports, "Tendermint34Client", { enumerable: true, get: function () { return tendermint34client_1.Tendermint34Client; } });
//# sourceMappingURL=index.js.map

@@ -7,11 +7,11 @@ "use strict";

it("works for no input", () => {
const query = requests_1.buildQuery({});
const query = (0, requests_1.buildQuery)({});
expect(query).toEqual("");
});
it("works for one tags", () => {
const query = requests_1.buildQuery({ tags: [{ key: "abc", value: "def" }] });
const query = (0, requests_1.buildQuery)({ tags: [{ key: "abc", value: "def" }] });
expect(query).toEqual("abc='def'");
});
it("works for two tags", () => {
const query = requests_1.buildQuery({
const query = (0, requests_1.buildQuery)({
tags: [

@@ -25,7 +25,7 @@ { key: "k", value: "9" },

it("works for raw input", () => {
const query = requests_1.buildQuery({ raw: "aabbCCDD" });
const query = (0, requests_1.buildQuery)({ raw: "aabbCCDD" });
expect(query).toEqual("aabbCCDD");
});
it("works for mixed input", () => {
const query = requests_1.buildQuery({
const query = (0, requests_1.buildQuery)({
tags: [

@@ -32,0 +32,0 @@ { key: "k", value: "9" },

import { ReadonlyDate } from "readonly-date";
import { ReadonlyDateWithNanoseconds } from "../dates";
import { CommitSignature, ValidatorPubkey } from "../types";
export declare type Response = AbciInfoResponse | AbciQueryResponse | BlockResponse | BlockResultsResponse | BlockchainResponse | BroadcastTxAsyncResponse | BroadcastTxSyncResponse | BroadcastTxCommitResponse | CommitResponse | GenesisResponse | HealthResponse | StatusResponse | TxResponse | TxSearchResponse | ValidatorsResponse;
export declare type Response = AbciInfoResponse | AbciQueryResponse | BlockResponse | BlockResultsResponse | BlockSearchResponse | BlockchainResponse | BroadcastTxAsyncResponse | BroadcastTxSyncResponse | BroadcastTxCommitResponse | CommitResponse | GenesisResponse | HealthResponse | StatusResponse | TxResponse | TxSearchResponse | ValidatorsResponse;
export interface AbciInfoResponse {

@@ -47,4 +47,7 @@ readonly data?: string;

}
/** No data in here because RPC method BroadcastTxAsync "returns right away, with no response" */
/**
* No transaction data in here because RPC method BroadcastTxAsync "returns right away, with no response"
*/
export interface BroadcastTxAsyncResponse {
readonly hash: Uint8Array;
}

@@ -51,0 +54,0 @@ export interface BroadcastTxSyncResponse extends TxData {

@@ -58,3 +58,3 @@ "use strict";

static async detectVersion(client) {
const req = jsonrpc_1.createJsonRpcRequest(requests.Method.Status);
const req = (0, jsonrpc_1.createJsonRpcRequest)(requests.Method.Status);
const response = await client.execute(req);

@@ -299,3 +299,3 @@ const result = response.result;

subscribe(request, decode) {
if (!rpcclients_1.instanceOfRpcStreamingClient(this.client)) {
if (!(0, rpcclients_1.instanceOfRpcStreamingClient)(this.client)) {
throw new Error("This RPC client type cannot subscribe to events");

@@ -302,0 +302,0 @@ }

@@ -37,3 +37,3 @@ "use strict";

it("can auto-discover Tendermint version and communicate", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());

@@ -45,3 +45,3 @@ const info = await client.abciInfo();

it("can connect to Tendermint with known version", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());

@@ -53,3 +53,3 @@ expect(await client.abciInfo()).toBeTruthy();

it("can get genesis", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());

@@ -62,5 +62,5 @@ const genesis = await client.genesis();

it("can broadcast a transaction", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());
const tx = testutil_spec_1.buildKvTx(testutil_spec_1.randomString(), testutil_spec_1.randomString());
const tx = (0, testutil_spec_1.buildKvTx)((0, testutil_spec_1.randomString)(), (0, testutil_spec_1.randomString)());
const response = await client.broadcastTxCommit({ tx: tx });

@@ -80,5 +80,5 @@ expect(response.height).toBeGreaterThan(2);

it("can broadcast a transaction", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());
const tx = testutil_spec_1.buildKvTx(testutil_spec_1.randomString(), testutil_spec_1.randomString());
const tx = (0, testutil_spec_1.buildKvTx)((0, testutil_spec_1.randomString)(), (0, testutil_spec_1.randomString)());
const response = await client.broadcastTxSync({ tx: tx });

@@ -94,7 +94,6 @@ expect(response.hash.length).toEqual(32);

it("can broadcast a transaction", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());
const tx = testutil_spec_1.buildKvTx(testutil_spec_1.randomString(), testutil_spec_1.randomString());
const tx = (0, testutil_spec_1.buildKvTx)((0, testutil_spec_1.randomString)(), (0, testutil_spec_1.randomString)());
const response = await client.broadcastTxAsync({ tx: tx });
// TODO: Remove any cast after https://github.com/cosmos/cosmjs/issues/938
expect(response.hash.length).toEqual(32);

@@ -105,5 +104,5 @@ client.disconnect();

it("gets the same tx hash from backend as calculated locally", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());
const tx = testutil_spec_1.buildKvTx(testutil_spec_1.randomString(), testutil_spec_1.randomString());
const tx = (0, testutil_spec_1.buildKvTx)((0, testutil_spec_1.randomString)(), (0, testutil_spec_1.randomString)());
const calculatedTxHash = adaptor_1.adaptor34.hashTx(tx);

@@ -115,9 +114,9 @@ const response = await client.broadcastTxCommit({ tx: tx });

it("can query the state", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());
const key = testutil_spec_1.randomString();
const value = testutil_spec_1.randomString();
await client.broadcastTxCommit({ tx: testutil_spec_1.buildKvTx(key, value) });
const binKey = encoding_1.toAscii(key);
const binValue = encoding_1.toAscii(value);
const key = (0, testutil_spec_1.randomString)();
const value = (0, testutil_spec_1.randomString)();
await client.broadcastTxCommit({ tx: (0, testutil_spec_1.buildKvTx)(key, value) });
const binKey = (0, encoding_1.toAscii)(key);
const binValue = (0, encoding_1.toAscii)(value);
const queryParams = { path: "/key", data: binKey, prove: true };

@@ -132,3 +131,3 @@ const response = await client.abciQuery(queryParams);

var _a, _b;
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());

@@ -145,3 +144,3 @@ const response = await client.commit(4);

it("can get validators", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());

@@ -161,3 +160,3 @@ const response = await client.validators({});

it("can get all validators", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());

@@ -177,3 +176,3 @@ const response = await client.validatorsAll();

it("can call a bunch of methods", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());

@@ -187,3 +186,3 @@ expect(await client.block()).toBeTruthy();

it("works", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());

@@ -212,3 +211,3 @@ const status = await client.status();

it("works", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());

@@ -226,7 +225,7 @@ const height = 3;

beforeAll(async () => {
if (testutil_spec_1.tendermintEnabled()) {
if ((0, testutil_spec_1.tendermintEnabled)()) {
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());
// eslint-disable-next-line no-inner-declarations
async function sendTx() {
const tx = testutil_spec_1.buildKvTx(testutil_spec_1.randomString(), testutil_spec_1.randomString());
const tx = (0, testutil_spec_1.buildKvTx)((0, testutil_spec_1.randomString)(), (0, testutil_spec_1.randomString)());
const txRes = await client.broadcastTxCommit({ tx: tx });

@@ -242,9 +241,9 @@ expect(responses.broadcastTxCommitSuccess(txRes)).toEqual(true);

client.disconnect();
await testutil_spec_1.tendermintSearchIndexUpdated();
await (0, testutil_spec_1.tendermintSearchIndexUpdated)();
}
});
it("can paginate over blockSearch results", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());
const query = requests_1.buildQuery({ raw: "block.height >= 1 AND block.height <= 3" });
const query = (0, requests_1.buildQuery)({ raw: "block.height >= 1 AND block.height <= 3" });
// expect one page of results

@@ -261,5 +260,5 @@ const s1 = await client.blockSearch({ query: query, page: 1, per_page: 2 });

it("can get all search results in one call", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());
const query = requests_1.buildQuery({ raw: "block.height >= 1 AND block.height <= 3" });
const query = (0, requests_1.buildQuery)({ raw: "block.height >= 1 AND block.height <= 3" });
const sall = await client.blockSearchAll({ query: query, per_page: 2 });

@@ -277,3 +276,3 @@ expect(sall.totalCount).toEqual(3);

it("returns latest in descending order by default", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());

@@ -291,3 +290,3 @@ // Run in parallel to increase chance there is no block between the calls

it("can limit by maxHeight", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());

@@ -303,3 +302,3 @@ const height = (await client.status()).syncInfo.latestBlockHeight;

it("works with maxHeight in the future", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());

@@ -315,3 +314,3 @@ const height = (await client.status()).syncInfo.latestBlockHeight;

it("can limit by minHeight and maxHeight", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());

@@ -327,3 +326,3 @@ const height = (await client.status()).syncInfo.latestBlockHeight;

it("contains all the info", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());

@@ -350,7 +349,7 @@ const height = (await client.status()).syncInfo.latestBlockHeight;

it("can query a tx properly", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());
const find = testutil_spec_1.randomString();
const me = testutil_spec_1.randomString();
const tx = testutil_spec_1.buildKvTx(find, me);
const find = (0, testutil_spec_1.randomString)();
const me = (0, testutil_spec_1.randomString)();
const tx = (0, testutil_spec_1.buildKvTx)(find, me);
const txRes = await client.broadcastTxCommit({ tx: tx });

@@ -362,3 +361,3 @@ expect(responses.broadcastTxCommitSuccess(txRes)).toEqual(true);

const hash = txRes.hash;
await testutil_spec_1.tendermintSearchIndexUpdated();
await (0, testutil_spec_1.tendermintSearchIndexUpdated)();
// find by hash - does it match?

@@ -374,3 +373,3 @@ const r = await client.tx({ hash: hash, prove: true });

// tendermint, else you get empty results
const query = requests_1.buildQuery({ tags: [{ key: "app.key", value: find }] });
const query = (0, requests_1.buildQuery)({ tags: [{ key: "app.key", value: find }] });
const s = await client.txSearch({ query: query, page: 1, per_page: 30 });

@@ -397,10 +396,10 @@ // should find the tx

describe("txSearch", () => {
const key = testutil_spec_1.randomString();
const key = (0, testutil_spec_1.randomString)();
beforeAll(async () => {
if (testutil_spec_1.tendermintEnabled()) {
if ((0, testutil_spec_1.tendermintEnabled)()) {
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());
// eslint-disable-next-line no-inner-declarations
async function sendTx() {
const me = testutil_spec_1.randomString();
const tx = testutil_spec_1.buildKvTx(key, me);
const me = (0, testutil_spec_1.randomString)();
const tx = (0, testutil_spec_1.buildKvTx)(key, me);
const txRes = await client.broadcastTxCommit({ tx: tx });

@@ -416,3 +415,3 @@ expect(responses.broadcastTxCommitSuccess(txRes)).toEqual(true);

client.disconnect();
await testutil_spec_1.tendermintSearchIndexUpdated();
await (0, testutil_spec_1.tendermintSearchIndexUpdated)();
}

@@ -424,5 +423,5 @@ });

// Code: https://github.com/tendermint/tendermint/blob/v0.34.10/rpc/core/tx.go#L89
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());
const query = requests_1.buildQuery({ tags: [{ key: "app.key", value: key }] });
const query = (0, requests_1.buildQuery)({ tags: [{ key: "app.key", value: key }] });
const s = await client.txSearch({ query: query });

@@ -437,5 +436,5 @@ expect(s.totalCount).toEqual(3);

it("can set the order", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());
const query = requests_1.buildQuery({ tags: [{ key: "app.key", value: key }] });
const query = (0, requests_1.buildQuery)({ tags: [{ key: "app.key", value: key }] });
const s1 = await client.txSearch({ query: query, order_by: "desc" });

@@ -448,5 +447,5 @@ const s2 = await client.txSearch({ query: query, order_by: "asc" });

it("can paginate over txSearch results", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());
const query = requests_1.buildQuery({ tags: [{ key: "app.key", value: key }] });
const query = (0, requests_1.buildQuery)({ tags: [{ key: "app.key", value: key }] });
// expect one page of results

@@ -463,5 +462,5 @@ const s1 = await client.txSearch({ query: query, page: 1, per_page: 2 });

it("can get all search results in one call", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());
const query = requests_1.buildQuery({ tags: [{ key: "app.key", value: key }] });
const query = (0, requests_1.buildQuery)({ tags: [{ key: "app.key", value: key }] });
const sall = await client.txSearchAll({ query: query, per_page: 2 });

@@ -480,3 +479,3 @@ expect(sall.totalCount).toEqual(3);

it("can subscribe to block header events", (done) => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const testStart = readonly_date_1.ReadonlyDate.now();

@@ -529,6 +528,6 @@ (async () => {

it("can subscribe to block events", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const testStart = readonly_date_1.ReadonlyDate.now();
const transactionData1 = testutil_spec_1.buildKvTx(testutil_spec_1.randomString(), testutil_spec_1.randomString());
const transactionData2 = testutil_spec_1.buildKvTx(testutil_spec_1.randomString(), testutil_spec_1.randomString());
const transactionData1 = (0, testutil_spec_1.buildKvTx)((0, testutil_spec_1.randomString)(), (0, testutil_spec_1.randomString)());
const transactionData2 = (0, testutil_spec_1.buildKvTx)((0, testutil_spec_1.randomString)(), (0, testutil_spec_1.randomString)());
const events = [];

@@ -564,3 +563,3 @@ const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());

// wait for events to be processed
await utils_1.sleep(100);
await (0, utils_1.sleep)(100);
expect(events.length).toEqual(2);

@@ -581,3 +580,3 @@ // Block header

it("can subscribe to transaction events", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const events = [];

@@ -598,8 +597,8 @@ const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());

});
const transactionData1 = testutil_spec_1.buildKvTx(testutil_spec_1.randomString(), testutil_spec_1.randomString());
const transactionData2 = testutil_spec_1.buildKvTx(testutil_spec_1.randomString(), testutil_spec_1.randomString());
const transactionData1 = (0, testutil_spec_1.buildKvTx)((0, testutil_spec_1.randomString)(), (0, testutil_spec_1.randomString)());
const transactionData2 = (0, testutil_spec_1.buildKvTx)((0, testutil_spec_1.randomString)(), (0, testutil_spec_1.randomString)());
await client.broadcastTxCommit({ tx: transactionData1 });
await client.broadcastTxCommit({ tx: transactionData2 });
// wait for events to be processed
await utils_1.sleep(100);
await (0, utils_1.sleep)(100);
expect(events.length).toEqual(2);

@@ -615,8 +614,8 @@ // Meta

it("can subscribe to transaction events filtered by creator", async () => {
testutil_spec_1.pendingWithoutTendermint();
const transactionData1 = testutil_spec_1.buildKvTx(testutil_spec_1.randomString(), testutil_spec_1.randomString());
const transactionData2 = testutil_spec_1.buildKvTx(testutil_spec_1.randomString(), testutil_spec_1.randomString());
(0, testutil_spec_1.pendingWithoutTendermint)();
const transactionData1 = (0, testutil_spec_1.buildKvTx)((0, testutil_spec_1.randomString)(), (0, testutil_spec_1.randomString)());
const transactionData2 = (0, testutil_spec_1.buildKvTx)((0, testutil_spec_1.randomString)(), (0, testutil_spec_1.randomString)());
const events = [];
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());
const query = requests_1.buildQuery({ tags: [{ key: "app.creator", value: expected.appCreator }] });
const query = (0, requests_1.buildQuery)({ tags: [{ key: "app.creator", value: expected.appCreator }] });
const stream = client.subscribeTx(query);

@@ -639,3 +638,3 @@ expect(stream).toBeTruthy();

// wait for events to be processed
await utils_1.sleep(100);
await (0, utils_1.sleep)(100);
expect(events.length).toEqual(2);

@@ -651,20 +650,20 @@ // Meta

it("can unsubscribe and re-subscribe to the same stream", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());
const stream = client.subscribeNewBlockHeader();
const event1 = await stream_1.firstEvent(stream);
const event1 = await (0, stream_1.firstEvent)(stream);
expect(event1.height).toBeGreaterThanOrEqual(1);
expect(event1.time.getTime()).toBeGreaterThanOrEqual(1);
// No sleep: producer will not be stopped in the meantime
const event2 = await stream_1.firstEvent(stream);
const event2 = await (0, stream_1.firstEvent)(stream);
expect(event2.height).toBeGreaterThan(event1.height);
expect(event2.time.getTime()).toBeGreaterThan(event1.time.getTime());
// Very short sleep: just enough to schedule asynchronous producer stopping
await utils_1.sleep(5);
const event3 = await stream_1.firstEvent(stream);
await (0, utils_1.sleep)(5);
const event3 = await (0, stream_1.firstEvent)(stream);
expect(event3.height).toBeGreaterThan(event2.height);
expect(event3.time.getTime()).toBeGreaterThan(event2.time.getTime());
// Proper sleep: enough to finish unsubscribing at over the network
await utils_1.sleep(100);
const event4 = await stream_1.firstEvent(stream);
await (0, utils_1.sleep)(100);
const event4 = await (0, stream_1.firstEvent)(stream);
expect(event4.height).toBeGreaterThan(event3.height);

@@ -675,7 +674,7 @@ expect(event4.time.getTime()).toBeGreaterThan(event3.time.getTime());

it("can subscribe twice", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
const client = await tendermint34client_1.Tendermint34Client.create(rpcFactory());
const stream1 = client.subscribeNewBlockHeader();
const stream2 = client.subscribeNewBlockHeader();
const events = await stream_1.toListPromise(xstream_1.Stream.merge(stream1, stream2), 4);
const events = await (0, stream_1.toListPromise)(xstream_1.Stream.merge(stream1, stream2), 4);
expect(new Set(events.map((e) => e.height)).size).toEqual(2);

@@ -686,5 +685,5 @@ client.disconnect();

describe("Tendermint34Client", () => {
const { url, expected } = testutil_spec_1.tendermintInstances[1];
const { url, expected } = testutil_spec_1.tendermintInstances[0];
it("can connect to a given url", async () => {
testutil_spec_1.pendingWithoutTendermint();
(0, testutil_spec_1.pendingWithoutTendermint)();
// default connection

@@ -691,0 +690,0 @@ {

@@ -22,14 +22,2 @@ "use strict";

{
url: "localhost:11133",
version: "0.33.x",
blockTime: 1000,
expected: {
version: "0.33.8",
appCreator: "Cosmoshi Netowoko",
p2pVersion: 7,
blockVersion: 10,
appVersion: 1,
},
},
{
url: "localhost:11134",

@@ -60,7 +48,7 @@ version: "0.34.x",

// Tendermint needs some time before a committed transaction is found in search
return utils_1.sleep(75);
return (0, utils_1.sleep)(75);
}
exports.tendermintSearchIndexUpdated = tendermintSearchIndexUpdated;
function buildKvTx(k, v) {
return encoding_1.toAscii(`${k}=${v}`);
return (0, encoding_1.toAscii)(`${k}=${v}`);
}

@@ -67,0 +55,0 @@ exports.buildKvTx = buildKvTx;

{
"name": "@cosmjs/tendermint-rpc",
"version": "0.26.5",
"version": "0.27.0-rc1",
"description": "Tendermint RPC clients",

@@ -33,3 +33,3 @@ "contributors": [

"format-text": "prettier --write \"./*.md\"",
"test-node": "node --require esm jasmine-testrunner.js",
"test-node": "yarn node jasmine-testrunner.js",
"test-edge": "yarn pack-web && karma start --single-run --browsers Edge",

@@ -46,8 +46,8 @@ "test-firefox": "yarn pack-web && karma start --single-run --browsers Firefox",

"dependencies": {
"@cosmjs/crypto": "0.26.5",
"@cosmjs/encoding": "0.26.5",
"@cosmjs/json-rpc": "0.26.5",
"@cosmjs/math": "0.26.5",
"@cosmjs/socket": "0.26.5",
"@cosmjs/stream": "0.26.5",
"@cosmjs/crypto": "0.27.0-rc1",
"@cosmjs/encoding": "0.27.0-rc1",
"@cosmjs/json-rpc": "0.27.0-rc1",
"@cosmjs/math": "0.27.0-rc1",
"@cosmjs/socket": "0.27.0-rc1",
"@cosmjs/stream": "0.27.0-rc1",
"axios": "^0.21.2",

@@ -58,3 +58,3 @@ "readonly-date": "^1.0.0",

"devDependencies": {
"@cosmjs/utils": "0.26.5",
"@cosmjs/utils": "0.27.0-rc1",
"@istanbuljs/nyc-config-typescript": "^1.0.1",

@@ -90,7 +90,8 @@ "@types/eslint-plugin-prettier": "^3",

"ts-node": "^8",
"typedoc": "^0.21",
"typescript": "~4.3",
"typedoc": "^0.22",
"typescript": "~4.4",
"webpack": "^5.32.0",
"webpack-cli": "^4.6.0"
}
},
"stableVersion": "0.26.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

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

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc