@cosmjs/tendermint-rpc
Advanced tools
Comparing version 0.28.9 to 0.28.10
@@ -14,2 +14,14 @@ import { JsonRpcSuccessResponse } from "@cosmjs/json-rpc"; | ||
} | ||
interface RpcAttribute { | ||
/** base64 encoded */ | ||
readonly key: string; | ||
/** base64 encoded */ | ||
readonly value: string; | ||
} | ||
interface RpcEvent { | ||
readonly type: string; | ||
/** Can be omitted (see https://github.com/cosmos/cosmjs/pull/1198) */ | ||
readonly attributes?: readonly RpcAttribute[]; | ||
} | ||
export declare function decodeEvent(event: RpcEvent): responses.Event; | ||
declare type RpcPubkey = { | ||
@@ -16,0 +28,0 @@ readonly type: string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Responses = exports.decodeValidatorInfo = exports.decodeValidatorGenesis = exports.decodeValidatorUpdate = void 0; | ||
exports.Responses = exports.decodeValidatorInfo = exports.decodeValidatorGenesis = exports.decodeValidatorUpdate = exports.decodeEvent = void 0; | ||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
@@ -50,5 +50,6 @@ const encoding_1 = require("@cosmjs/encoding"); | ||
type: event.type, | ||
attributes: decodeAttributes(event.attributes), | ||
attributes: event.attributes ? decodeAttributes(event.attributes) : [], | ||
}; | ||
} | ||
exports.decodeEvent = decodeEvent; | ||
function decodeEvents(events) { | ||
@@ -55,0 +56,0 @@ return (0, encodings_1.assertArray)(events).map(decodeEvent); |
@@ -7,2 +7,26 @@ "use strict"; | ||
describe("Adaptor Responses", () => { | ||
describe("decodeEvent", () => { | ||
it("works with attributes", () => { | ||
// from https://rpc.mainnet-1.tgrade.confio.run/tx?hash=0x2C44715748022DB2FB5F40105383719BFCFCEE51DBC02FF4088BE3F5924CD7BF | ||
const event = (0, responses_1.decodeEvent)({ | ||
type: "coin_spent", | ||
attributes: [ | ||
{ key: "c3BlbmRlcg==", value: "dGdyYWRlMWpzN2V6cm01NWZxZ3h1M3A2MmQ5eG42cGF0amt1Mno3bmU1ZHZn" }, | ||
{ key: "YW1vdW50", value: "NjAwMDAwMDAwMHV0Z2Q=" }, | ||
], | ||
}); | ||
expect(event.type).toEqual("coin_spent"); | ||
expect(event.attributes).toEqual([ | ||
{ key: (0, encoding_1.toUtf8)("spender"), value: (0, encoding_1.toUtf8)("tgrade1js7ezrm55fqgxu3p62d9xn6patjku2z7ne5dvg") }, | ||
{ key: (0, encoding_1.toUtf8)("amount"), value: (0, encoding_1.toUtf8)("6000000000utgd") }, | ||
]); | ||
}); | ||
it("works with no attribute", () => { | ||
const event = (0, responses_1.decodeEvent)({ | ||
type: "cosmos.module.EmittedEvent", | ||
}); | ||
expect(event.type).toEqual("cosmos.module.EmittedEvent"); | ||
expect(event.attributes).toEqual([]); | ||
}); | ||
}); | ||
describe("decodeValidatorGenesis", () => { | ||
@@ -9,0 +33,0 @@ it("works for genesis format", () => { |
{ | ||
"name": "@cosmjs/tendermint-rpc", | ||
"version": "0.28.9", | ||
"version": "0.28.10", | ||
"description": "Tendermint RPC clients", | ||
@@ -45,9 +45,9 @@ "contributors": [ | ||
"dependencies": { | ||
"@cosmjs/crypto": "0.28.9", | ||
"@cosmjs/encoding": "0.28.9", | ||
"@cosmjs/json-rpc": "0.28.9", | ||
"@cosmjs/math": "0.28.9", | ||
"@cosmjs/socket": "0.28.9", | ||
"@cosmjs/stream": "0.28.9", | ||
"@cosmjs/utils": "0.28.9", | ||
"@cosmjs/crypto": "0.28.10", | ||
"@cosmjs/encoding": "0.28.10", | ||
"@cosmjs/json-rpc": "0.28.10", | ||
"@cosmjs/math": "0.28.10", | ||
"@cosmjs/socket": "0.28.10", | ||
"@cosmjs/stream": "0.28.10", | ||
"@cosmjs/utils": "0.28.10", | ||
"axios": "^0.21.2", | ||
@@ -54,0 +54,0 @@ "readonly-date": "^1.0.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
320482
4250
+ Added@cosmjs/crypto@0.28.10(transitive)
+ Added@cosmjs/encoding@0.28.10(transitive)
+ Added@cosmjs/json-rpc@0.28.10(transitive)
+ Added@cosmjs/math@0.28.10(transitive)
+ Added@cosmjs/socket@0.28.10(transitive)
+ Added@cosmjs/stream@0.28.10(transitive)
+ Added@cosmjs/utils@0.28.10(transitive)
- Removed@cosmjs/crypto@0.28.9(transitive)
- Removed@cosmjs/encoding@0.28.9(transitive)
- Removed@cosmjs/json-rpc@0.28.9(transitive)
- Removed@cosmjs/math@0.28.9(transitive)
- Removed@cosmjs/socket@0.28.9(transitive)
- Removed@cosmjs/stream@0.28.9(transitive)
- Removed@cosmjs/utils@0.28.9(transitive)
Updated@cosmjs/crypto@0.28.10
Updated@cosmjs/encoding@0.28.10
Updated@cosmjs/json-rpc@0.28.10
Updated@cosmjs/math@0.28.10
Updated@cosmjs/socket@0.28.10
Updated@cosmjs/stream@0.28.10
Updated@cosmjs/utils@0.28.10