Merge branch 'main' of github.com:cosmos/cosmjs into authz-queries

This commit is contained in:
Mantas Vidutis 2023-01-03 15:45:33 +07:00
commit 5e21c51eb2
No known key found for this signature in database
GPG Key ID: 60BDC8CD8FA60E29
75 changed files with 4721 additions and 1923 deletions

View File

@ -34,7 +34,7 @@ workflows:
- build
matrix:
parameters:
node-version: ["14", "16"]
node-version: ["14", "16", "18"]
- test-chrome:
requires:
- build
@ -245,6 +245,7 @@ jobs:
declare -A node_links=(
["14"]="https://deb.nodesource.com/node_14.x/pool/main/n/nodejs/nodejs_14.18.0-deb-1nodesource1_amd64.deb"
["16"]="https://deb.nodesource.com/node_16.x/pool/main/n/nodejs/nodejs_16.13.2-deb-1nodesource1_amd64.deb"
["18"]="https://deb.nodesource.com/node_18.x/pool/main/n/nodejs/nodejs_18.7.0-deb-1nodesource1_amd64.deb"
)
wget -O "$HOME/nodejs.deb" "${node_links[<< parameters.node-version >>]}"
sudo dpkg -i "$HOME/nodejs.deb"

2533
.pnp.cjs generated

File diff suppressed because it is too large Load Diff

1828
.pnp.loader.mjs generated

File diff suppressed because it is too large Load Diff

Binary file not shown.

BIN
.yarn/cache/cosmjs-types-npm-0.6.0-4ad2730ce2-06000f10d9.zip (Stored with Git LFS) vendored Normal file

Binary file not shown.

Binary file not shown.

BIN
.yarn/cache/node-addon-api-npm-4.3.0-a07a1232df-3de396e23c.zip (Stored with Git LFS) vendored Normal file

Binary file not shown.

BIN
.yarn/cache/node-gyp-build-npm-4.5.0-2538da6152-d888bae0fb.zip (Stored with Git LFS) vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
.yarn/cache/prettier-npm-2.8.1-be60b51821-4f21a0f126.zip (Stored with Git LFS) vendored Normal file

Binary file not shown.

BIN
.yarn/cache/usb-npm-1.7.1-d03d3a15f5-7d20ffef8b.zip (Stored with Git LFS) vendored

Binary file not shown.

BIN
.yarn/cache/usb-npm-1.9.2-7362a49b80-7aaf6669f0.zip (Stored with Git LFS) vendored Normal file

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

801
.yarn/releases/yarn-3.2.4.cjs vendored Executable file

File diff suppressed because one or more lines are too long

View File

@ -1,13 +1,13 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {

View File

@ -1,13 +1,13 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {

View File

@ -1,13 +1,13 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {

View File

@ -1,6 +1,6 @@
{
"name": "prettier",
"version": "2.4.1-sdk",
"version": "2.8.1-sdk",
"main": "./index.js",
"type": "commonjs"
}

View File

@ -1,13 +1,13 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {

View File

@ -1,13 +1,13 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {

View File

@ -1,13 +1,13 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {

View File

@ -1,13 +1,13 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
const moduleWrapper = tsserver => {
if (!process.versions.pnp) {

View File

@ -1,13 +1,13 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
const moduleWrapper = tsserver => {
if (!process.versions.pnp) {

View File

@ -1,13 +1,13 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {

View File

@ -13,4 +13,4 @@ plugins:
pnpMode: loose
yarnPath: .yarn/releases/yarn-3.2.1.cjs
yarnPath: .yarn/releases/yarn-3.2.4.cjs

View File

@ -6,10 +6,53 @@ and this project adheres to
## [Unreleased]
### Changed
- all: The TypeScript compilation target is now ES2020 ([#1002]).
- all: Add full support for Node.js 18 and run all CI tests with it ([#1240]).
- @cosmjs/tendermint-rpc: Remove unused `index` field from `RpcTxEvent` and
`TxEvent`. This is unset starting with Tendermint 0.34.
- @cosmjs/proto-signing: Make input and output of `decodePubkey` non-optional
([#1289]).
- @cosmjs/stargate: Remove unnecessary address prefix argument from
`createStakingAminoConverters`. This made `prefix` in
`SigningCosmWasmClientOptions` and `SigningStargateClientOptions` obsolete, so
this was also deleted. ([#1291])
- @cosmjs/proto-signing: Remove `fromJSON`/`toJSON` from `TsProtoGeneratedType`
such that generated types are not required to generate those anymore. The
methods were provided by ts-proto but we never needed them. ([#1329])
[#1002]: https://github.com/cosmos/cosmjs/issues/1002
[#1240]: https://github.com/cosmos/cosmjs/pull/1240
[#1289]: https://github.com/cosmos/cosmjs/issues/1289
[#1291]: https://github.com/cosmos/cosmjs/issues/1291
[#1329]: https://github.com/cosmos/cosmjs/pull/1329
## [0.29.5] - 2022-12-07
### Fixed
- @cosmjs/stargate: Fix `protoDecimalToJson` for values with a 0 fractional
part, such as `0.000000000000000000`, `1.000000000000000000` or
`42.000000000000000000` ([#1326]).
[#1326]: https://github.com/cosmos/cosmjs/pull/1326
### Changed
- @cosmjs/crypto: `getSubtle()` does not use `getCryptoModule()` anymore to find
a subtle implementation. Turns out all environments we support have subtle in
`globalThis` or do not have it at all ([#1307], [#1340]).
[#1307]: https://github.com/cosmos/cosmjs/pull/1307
[#1340]: https://github.com/cosmos/cosmjs/pull/1340
### Deprecated
- @cosmjs/stargate: Deprecate `QueryClient.queryUnverified` in favour of newly
added `QueryClient.queryAbci`.
- @cosmjs/stargate: Deprecate `QueryClient.queryVerified` in favour of newly
added `QueryClient.queryStoreVerified`.
## [0.29.4] - 2022-11-15
@ -1117,7 +1160,8 @@ CHANGELOG entries missing. Please see [the diff][0.24.1].
`FeeTable`. @cosmjs/cosmwasm has its own `FeeTable` with those properties.
- @cosmjs/sdk38: Rename package to @cosmjs/launchpad.
[unreleased]: https://github.com/cosmos/cosmjs/compare/v0.29.4...HEAD
[unreleased]: https://github.com/cosmos/cosmjs/compare/v0.29.5...HEAD
[0.29.5]: https://github.com/cosmos/cosmjs/compare/v0.29.4...v0.29.5
[0.29.4]: https://github.com/cosmos/cosmjs/compare/v0.29.3...v0.29.4
[0.29.3]: https://github.com/cosmos/cosmjs/compare/v0.29.2...v0.29.3
[0.29.2]: https://github.com/cosmos/cosmjs/compare/v0.29.1...v0.29.2

View File

@ -89,7 +89,7 @@ Currently the codebase supports the following runtime environments:
[Edge Spartan](https://en.wikipedia.org/wiki/Microsoft_Edge#Development))
3. Browser extensions (Chromium/Firefox)
Our current JavaScript target standard is ES2018. We use WebAssembly to
Our current JavaScript target standard is ES2020. We use WebAssembly to
implement certain cryptographic functions.
We're happy to adjust this list according to users' needs as long as you don't

View File

@ -47,8 +47,8 @@
"@cosmjs/proto-signing": "workspace:^",
"@cosmjs/stargate": "workspace:^",
"eslint": "^7.5",
"prettier": "^2.4.1",
"prettier": "^2.8.1",
"typescript": "~4.6"
},
"packageManager": "yarn@3.2.1"
"packageManager": "yarn@3.2.4"
}

View File

@ -1,6 +1,6 @@
{
"name": "@cosmjs/amino",
"version": "0.29.4",
"version": "0.29.5",
"description": "Helpers for Amino based signing.",
"contributors": [
"Simon Warta <webmaster128@users.noreply.github.com>"
@ -70,7 +70,7 @@
"karma-jasmine": "^5",
"karma-jasmine-html-reporter": "^1.5.4",
"nyc": "^15.1.0",
"prettier": "^2.4.1",
"prettier": "^2.8.1",
"ses": "^0.11.0",
"source-map-support": "^0.5.19",
"ts-node": "^8",

View File

@ -1,6 +1,6 @@
{
"name": "@cosmjs/cli",
"version": "0.29.4",
"version": "0.29.5",
"description": "Command line interface",
"contributors": [
"IOV SAS <admin@iov.one>",
@ -53,7 +53,7 @@
"axios": "^0.21.2",
"babylon": "^6.18.0",
"chalk": "^4",
"cosmjs-types": "^0.5.2",
"cosmjs-types": "^0.6.0",
"diff": "^4",
"recast": "^0.20",
"ts-node": "^8",
@ -80,7 +80,7 @@
"jasmine": "^4",
"jasmine-spec-reporter": "^6",
"nyc": "^15.1.0",
"prettier": "^2.4.1",
"prettier": "^2.8.1",
"source-map-support": "^0.5.19"
}
}

View File

@ -3,7 +3,7 @@
"esModuleInterop": true,
"module": "commonjs",
"moduleResolution": "node",
"target": "es2018",
"target": "es2020",
"noUnusedLocals": false,
"noImplicitAny": false
}

View File

@ -1,6 +1,6 @@
{
"name": "@cosmjs/cosmwasm-stargate",
"version": "0.29.4",
"version": "0.29.5",
"description": "CosmWasm SDK",
"contributors": [
"Will Clark <willclarktech@users.noreply.github.com>"
@ -46,7 +46,7 @@
"@cosmjs/stargate": "workspace:^",
"@cosmjs/tendermint-rpc": "workspace:^",
"@cosmjs/utils": "workspace:^",
"cosmjs-types": "^0.5.2",
"cosmjs-types": "^0.6.0",
"long": "^4.0.0",
"pako": "^2.0.2"
},
@ -78,7 +78,7 @@
"karma-jasmine": "^5",
"karma-jasmine-html-reporter": "^1.5.4",
"nyc": "^15.1.0",
"prettier": "^2.4.1",
"prettier": "^2.8.1",
"protobufjs": "~6.11.3",
"readonly-date": "^1.0.0",
"ses": "^0.11.0",

View File

@ -14,7 +14,8 @@ import {
MsgSendEncodeObject,
} from "@cosmjs/stargate";
import { assert, sleep } from "@cosmjs/utils";
import { DeepPartial, MsgSend } from "cosmjs-types/cosmos/bank/v1beta1/tx";
import { DeepPartial } from "cosmjs-types";
import { MsgSend } from "cosmjs-types/cosmos/bank/v1beta1/tx";
import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin";
import { MsgDelegate } from "cosmjs-types/cosmos/staking/v1beta1/tx";
import { AuthInfo, TxBody, TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
@ -55,7 +56,6 @@ describe("SigningCosmWasmClient", () => {
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, {
...defaultSigningClientOptions,
prefix: wasmd.prefix,
});
expect(client).toBeTruthy();
client.disconnect();
@ -673,7 +673,6 @@ describe("SigningCosmWasmClient", () => {
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, {
...defaultSigningClientOptions,
prefix: wasmd.prefix,
});
const msgDelegateTypeUrl = "/cosmos.staking.v1beta1.MsgDelegate";
@ -702,7 +701,6 @@ describe("SigningCosmWasmClient", () => {
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, {
...defaultSigningClientOptions,
prefix: wasmd.prefix,
gasPrice: defaultGasPrice,
});
const msgDelegateTypeUrl = "/cosmos.staking.v1beta1.MsgDelegate";
@ -730,7 +728,6 @@ describe("SigningCosmWasmClient", () => {
});
const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, {
...defaultSigningClientOptions,
prefix: wasmd.prefix,
});
const msgDelegateTypeUrl = "/cosmos.staking.v1beta1.MsgDelegate";
@ -771,7 +768,6 @@ describe("SigningCosmWasmClient", () => {
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, {
...defaultSigningClientOptions,
prefix: wasmd.prefix,
});
const msgSend: MsgSend = {
@ -799,8 +795,7 @@ describe("SigningCosmWasmClient", () => {
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, {
...defaultSigningClientOptions,
aminoTypes: new AminoTypes(createStakingAminoConverters(wasmd.prefix)),
prefix: wasmd.prefix,
aminoTypes: new AminoTypes(createStakingAminoConverters()),
});
const msgDelegate: MsgDelegate = {
@ -828,7 +823,6 @@ describe("SigningCosmWasmClient", () => {
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, {
...defaultSigningClientOptions,
prefix: wasmd.prefix,
});
const { data } = getHackatom();
@ -885,10 +879,6 @@ describe("SigningCosmWasmClient", () => {
throw new Error("decode method should not be required");
},
fromJSON(): CustomMsgDelegate {
throw new Error("fromJSON method should not be required");
},
fromPartial(object: DeepPartial<CustomMsgDelegate>): CustomMsgDelegate {
const message = { ...baseCustomMsgDelegate } as CustomMsgDelegate;
if (object.customDelegatorAddress !== undefined && object.customDelegatorAddress !== null) {
@ -908,10 +898,6 @@ describe("SigningCosmWasmClient", () => {
}
return message;
},
toJSON(): unknown {
throw new Error("toJSON method should not be required");
},
};
customRegistry.register(msgDelegateTypeUrl, CustomMsgDelegate);
const customAminoTypes = new AminoTypes({
@ -982,8 +968,7 @@ describe("SigningCosmWasmClient", () => {
});
const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, {
...defaultSigningClientOptions,
aminoTypes: new AminoTypes(createStakingAminoConverters(wasmd.prefix)),
prefix: wasmd.prefix,
aminoTypes: new AminoTypes(createStakingAminoConverters()),
});
const msg = {
@ -1025,7 +1010,6 @@ describe("SigningCosmWasmClient", () => {
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, {
...defaultSigningClientOptions,
prefix: wasmd.prefix,
});
const msg = MsgDelegate.fromPartial({
@ -1058,7 +1042,6 @@ describe("SigningCosmWasmClient", () => {
});
const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, {
...defaultSigningClientOptions,
prefix: wasmd.prefix,
});
const msg = MsgDelegate.fromPartial({
@ -1098,7 +1081,6 @@ describe("SigningCosmWasmClient", () => {
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, {
...defaultSigningClientOptions,
prefix: wasmd.prefix,
});
const msgSend: MsgSend = {
@ -1129,8 +1111,7 @@ describe("SigningCosmWasmClient", () => {
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, {
...defaultSigningClientOptions,
aminoTypes: new AminoTypes(createStakingAminoConverters(wasmd.prefix)),
prefix: wasmd.prefix,
aminoTypes: new AminoTypes(createStakingAminoConverters()),
});
const msgDelegate: MsgDelegate = {
@ -1189,10 +1170,6 @@ describe("SigningCosmWasmClient", () => {
throw new Error("decode method should not be required");
},
fromJSON(): CustomMsgDelegate {
throw new Error("fromJSON method should not be required");
},
fromPartial(object: DeepPartial<CustomMsgDelegate>): CustomMsgDelegate {
const message = { ...baseCustomMsgDelegate } as CustomMsgDelegate;
if (object.customDelegatorAddress !== undefined && object.customDelegatorAddress !== null) {
@ -1212,10 +1189,6 @@ describe("SigningCosmWasmClient", () => {
}
return message;
},
toJSON(): unknown {
throw new Error("toJSON method should not be required");
},
};
customRegistry.register(msgDelegateTypeUrl, CustomMsgDelegate);
const customAminoTypes = new AminoTypes({
@ -1286,8 +1259,7 @@ describe("SigningCosmWasmClient", () => {
});
const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, {
...defaultSigningClientOptions,
aminoTypes: new AminoTypes(createStakingAminoConverters(wasmd.prefix)),
prefix: wasmd.prefix,
aminoTypes: new AminoTypes(createStakingAminoConverters()),
});
const msg: MsgDelegate = {

View File

@ -169,7 +169,6 @@ function createDefaultRegistry(): Registry {
export interface SigningCosmWasmClientOptions {
readonly registry?: Registry;
readonly aminoTypes?: AminoTypes;
readonly prefix?: string;
readonly broadcastTimeoutMs?: number;
readonly broadcastPollIntervalMs?: number;
readonly gasPrice?: GasPrice;

View File

@ -1,6 +1,6 @@
{
"name": "@cosmjs/crypto",
"version": "0.29.4",
"version": "0.29.5",
"description": "Cryptography resources for blockchain projects",
"contributors": [
"IOV SAS <admin@iov.one>",
@ -79,7 +79,7 @@
"karma-jasmine": "^5",
"karma-jasmine-html-reporter": "^1.5.4",
"nyc": "^15.1.0",
"prettier": "^2.4.1",
"prettier": "^2.8.1",
"ses": "^0.11.0",
"source-map-support": "^0.5.19",
"ts-node": "^8",

View File

@ -1,11 +1,11 @@
import { fromHex, toAscii, toUtf8 } from "@cosmjs/encoding";
import {
getCryptoModule,
getNodeCrypto,
getSubtle,
pbkdf2Sha512,
pbkdf2Sha512Crypto,
pbkdf2Sha512Noble,
pbkdf2Sha512NodeCrypto,
pbkdf2Sha512Subtle,
} from "./pbkdf2";
@ -146,20 +146,20 @@ describe("pbkdf2", () => {
});
});
describe("pbkdf2Sha512Crypto", () => {
describe("pbkdf2Sha512NodeCrypto", () => {
it("works", async () => {
const crypto = await getCryptoModule();
if (!crypto) pending("The crypto module is not available in this environment");
const nodeCrypto = await getNodeCrypto();
if (!nodeCrypto) pending("The crypto module is not available in this environment");
{
const { secret, salt, iterations, keylen, expected } = botanTest;
const hash = await pbkdf2Sha512Crypto(crypto, secret, salt, iterations, keylen);
const hash = await pbkdf2Sha512NodeCrypto(nodeCrypto, secret, salt, iterations, keylen);
expect(hash).toEqual(expected);
}
for (const [index, test] of brycxTests.entries()) {
const { secret, salt, iterations, keylen, expected } = test;
const hash = await pbkdf2Sha512Crypto(crypto, secret, salt, iterations, keylen);
const hash = await pbkdf2Sha512NodeCrypto(nodeCrypto, secret, salt, iterations, keylen);
expect(hash).withContext(`brycx tests index ${index}`).toEqual(expected);
}
});

View File

@ -9,29 +9,33 @@ import { sha512 as nobleSha512 } from "@noble/hashes/sha512";
* Detects an unimplemented fallback module from Webpack 5 and returns
* `undefined` in that case.
*/
export async function getCryptoModule(): Promise<any | undefined> {
export async function getNodeCrypto(): Promise<any | undefined> {
try {
const crypto = await import("crypto");
const nodeCrypto = await import("crypto");
// We get `Object{default: Object{}}` as a fallback when using
// `crypto: false` in Webpack 5, which we interprete as unavailable.
if (typeof crypto === "object" && Object.keys(crypto).length <= 1) {
if (typeof nodeCrypto === "object" && Object.keys(nodeCrypto).length <= 1) {
return undefined;
}
return crypto;
return nodeCrypto;
} catch {
return undefined;
}
}
export async function getSubtle(): Promise<any | undefined> {
const g: any = globalThis;
let subtle = g.crypto && g.crypto.subtle;
if (!subtle) {
const crypto = await getCryptoModule();
if (crypto && crypto.webcrypto && crypto.webcrypto.subtle) {
subtle = crypto.webcrypto.subtle;
}
}
// From Node.js 15 onwards, webcrypto is available in globalThis.
// In version 15 and 16 this was stored under the webcrypto key.
// With Node.js 17 it was moved to the same locations where browsers
// make it available.
// Loading `require("crypto")` here seems unnecessary since it only
// causes issues with bundlers and does not increase compatibility.
// Browsers and Node.js 17+
let subtle: any | undefined = (globalThis as any)?.crypto?.subtle;
// Node.js 15+
if (!subtle) subtle = (globalThis as any)?.crypto?.webcrypto?.subtle;
return subtle;
}
@ -64,20 +68,24 @@ export async function pbkdf2Sha512Subtle(
);
}
export async function pbkdf2Sha512Crypto(
/**
* Implements pbkdf2-sha512 using the Node.js crypro module (`import "crypto"`).
* This does not use subtle from [Crypto](https://developer.mozilla.org/en-US/docs/Web/API/Crypto).
*/
export async function pbkdf2Sha512NodeCrypto(
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
crypto: any,
nodeCrypto: any,
secret: Uint8Array,
salt: Uint8Array,
iterations: number,
keylen: number,
): Promise<Uint8Array> {
assert(crypto, "Argument crypto is falsy");
assert(typeof crypto === "object", "Argument crypto is not of type object");
assert(typeof crypto.pbkdf2 === "function", "crypto.pbkdf2 is not a function");
assert(nodeCrypto, "Argument nodeCrypto is falsy");
assert(typeof nodeCrypto === "object", "Argument nodeCrypto is not of type object");
assert(typeof nodeCrypto.pbkdf2 === "function", "nodeCrypto.pbkdf2 is not a function");
return new Promise((resolve, reject) => {
crypto.pbkdf2(secret, salt, iterations, keylen, "sha512", (error: any, result: any) => {
nodeCrypto.pbkdf2(secret, salt, iterations, keylen, "sha512", (error: any, result: any) => {
if (error) {
reject(error);
} else {
@ -109,9 +117,9 @@ export async function pbkdf2Sha512(
if (subtle) {
return pbkdf2Sha512Subtle(subtle, secret, salt, iterations, keylen);
} else {
const crypto = await getCryptoModule();
if (crypto) {
return pbkdf2Sha512Crypto(crypto, secret, salt, iterations, keylen);
const nodeCrypto = await getNodeCrypto();
if (nodeCrypto) {
return pbkdf2Sha512NodeCrypto(nodeCrypto, secret, salt, iterations, keylen);
} else {
return pbkdf2Sha512Noble(secret, salt, iterations, keylen);
}

View File

@ -1,6 +1,6 @@
{
"name": "@cosmjs/encoding",
"version": "0.29.4",
"version": "0.29.5",
"description": "Encoding helpers for blockchain projects",
"contributors": [
"IOV SAS <admin@iov.one>"
@ -71,7 +71,7 @@
"karma-jasmine": "^5",
"karma-jasmine-html-reporter": "^1.5.4",
"nyc": "^15.1.0",
"prettier": "^2.4.1",
"prettier": "^2.8.1",
"ses": "^0.11.0",
"source-map-support": "^0.5.19",
"ts-node": "^8",

View File

@ -1,6 +1,6 @@
{
"name": "@cosmjs/faucet-client",
"version": "0.29.4",
"version": "0.29.5",
"description": "The faucet client",
"contributors": [
"Will Clark <willclarktech@users.noreply.github.com>"
@ -68,7 +68,7 @@
"karma-jasmine": "^5",
"karma-jasmine-html-reporter": "^1.5.4",
"nyc": "^15.1.0",
"prettier": "^2.4.1",
"prettier": "^2.8.1",
"ses": "^0.11.0",
"source-map-support": "^0.5.19",
"ts-node": "^8",

View File

@ -1,6 +1,6 @@
{
"name": "@cosmjs/faucet",
"version": "0.29.4",
"version": "0.29.5",
"description": "The faucet",
"contributors": [
"Ethan Frey <ethanfrey@users.noreply.github.com>",
@ -69,7 +69,7 @@
"jasmine": "^4",
"jasmine-spec-reporter": "^6",
"nyc": "^15.1.0",
"prettier": "^2.4.1",
"prettier": "^2.8.1",
"ses": "^0.11.0",
"source-map-support": "^0.5.19",
"ts-node": "^8",

View File

@ -1,6 +1,6 @@
{
"name": "@cosmjs/json-rpc",
"version": "0.29.4",
"version": "0.29.5",
"description": "Framework for implementing a JSON-RPC 2.0 API",
"contributors": [
"IOV SAS <admin@iov.one>",
@ -70,7 +70,7 @@
"karma-jasmine": "^5",
"karma-jasmine-html-reporter": "^1.5.4",
"nyc": "^15.1.0",
"prettier": "^2.4.1",
"prettier": "^2.8.1",
"ses": "^0.11.0",
"source-map-support": "^0.5.19",
"ts-node": "^8",

View File

@ -1,6 +1,6 @@
{
"name": "@cosmjs/ledger-amino",
"version": "0.29.4",
"version": "0.29.5",
"description": "A library for signing Amino-encoded transactions using Ledger devices",
"contributors": [
"Will Clark <willclarktech@users.noreply.github.com>"
@ -70,7 +70,7 @@
"jasmine": "^4",
"jasmine-spec-reporter": "^6",
"nyc": "^15.1.0",
"prettier": "^2.4.1",
"prettier": "^2.8.1",
"ses": "^0.11.0",
"source-map-support": "^0.5.19",
"ts-node": "^8",

View File

@ -4,7 +4,7 @@
"baseUrl": ".",
"outDir": "build",
"rootDir": "src",
"lib": ["es2018", "dom"]
"lib": ["es2020", "dom"]
},
"include": ["src/**/*"]
}

View File

@ -1,6 +1,6 @@
{
"name": "@cosmjs/math",
"version": "0.29.4",
"version": "0.29.5",
"description": "Math helpers for blockchain projects",
"contributors": [
"IOV SAS <admin@iov.one>"
@ -69,7 +69,7 @@
"karma-jasmine": "^5",
"karma-jasmine-html-reporter": "^1.5.4",
"nyc": "^15.1.0",
"prettier": "^2.4.1",
"prettier": "^2.8.1",
"ses": "^0.11.0",
"source-map-support": "^0.5.19",
"ts-node": "^8",

View File

@ -1,6 +1,6 @@
{
"name": "@cosmjs/proto-signing",
"version": "0.29.4",
"version": "0.29.5",
"description": "Utilities for protobuf based signing (Cosmos SDK 0.40+)",
"contributors": [
"Will Clark <willclarktech@users.noreply.github.com>",
@ -44,7 +44,7 @@
"@cosmjs/encoding": "workspace:^",
"@cosmjs/math": "workspace:^",
"@cosmjs/utils": "workspace:^",
"cosmjs-types": "^0.5.2",
"cosmjs-types": "^0.6.0",
"long": "^4.0.0"
},
"devDependencies": {
@ -74,7 +74,7 @@
"karma-jasmine": "^5",
"karma-jasmine-html-reporter": "^1.5.4",
"nyc": "^15.1.0",
"prettier": "^2.4.1",
"prettier": "^2.8.1",
"protobufjs": "~6.11.3",
"ses": "^0.11.0",
"source-map-support": "^0.5.19",

View File

@ -57,8 +57,7 @@ export function encodePubkey(pubkey: Pubkey): Any {
* Decodes a single pubkey (i.e. not a multisig pubkey) from `Any` into
* `SinglePubkey`.
*
* In most cases you probably want to use `decodePubkey`, but `anyToSinglePubkey`
* might be preferred in CosmJS 0.29.x due to https://github.com/cosmos/cosmjs/issues/1289.
* In most cases you probably want to use `decodePubkey`.
*/
export function anyToSinglePubkey(pubkey: Any): SinglePubkey {
switch (pubkey.typeUrl) {
@ -75,11 +74,12 @@ export function anyToSinglePubkey(pubkey: Any): SinglePubkey {
}
}
export function decodePubkey(pubkey?: Any | null): Pubkey | null {
if (!pubkey || !pubkey.value) {
return null;
}
/**
* Decodes a pubkey from a protobuf `Any` into `Pubkey`.
* This supports single pubkeys such as Cosmos ed25519 and secp256k1 keys
* as well as multisig threshold pubkeys.
*/
export function decodePubkey(pubkey: Any): Pubkey {
switch (pubkey.typeUrl) {
case "/cosmos.crypto.secp256k1.PubKey":
case "/cosmos.crypto.ed25519.PubKey": {

View File

@ -12,9 +12,10 @@ import type protobuf from "protobufjs";
export interface TsProtoGeneratedType {
readonly encode: (message: any | { [k: string]: any }, writer?: protobuf.Writer) => protobuf.Writer;
readonly decode: (input: Uint8Array | protobuf.Reader, length?: number) => any;
readonly fromJSON: (object: any) => any;
readonly fromPartial: (object: any) => any;
readonly toJSON: (message: any | { [k: string]: any }) => unknown;
// Methods from ts-proto types we don't need
// readonly fromJSON: (object: any) => any;
// readonly toJSON: (message: any | { [k: string]: any }) => unknown;
}
/**

View File

@ -1,6 +1,6 @@
{
"name": "@cosmjs/socket",
"version": "0.29.4",
"version": "0.29.5",
"description": "Utility functions for working with WebSockets",
"contributors": [
"IOV SAS <admin@iov.one>",
@ -73,7 +73,7 @@
"karma-jasmine": "^5",
"karma-jasmine-html-reporter": "^1.5.4",
"nyc": "^15.1.0",
"prettier": "^2.4.1",
"prettier": "^2.8.1",
"ses": "^0.11.0",
"source-map-support": "^0.5.19",
"ts-node": "^8",

View File

@ -1,6 +1,6 @@
{
"name": "@cosmjs/stargate",
"version": "0.29.4",
"version": "0.29.5",
"description": "Utilities for Cosmos SDK 0.40",
"contributors": [
"Simon Warta <webmaster128@users.noreply.github.com>"
@ -46,7 +46,7 @@
"@cosmjs/stream": "workspace:^",
"@cosmjs/tendermint-rpc": "workspace:^",
"@cosmjs/utils": "workspace:^",
"cosmjs-types": "^0.5.2",
"cosmjs-types": "^0.6.0",
"long": "^4.0.0",
"protobufjs": "~6.11.3",
"xstream": "^11.14.0"
@ -79,7 +79,7 @@
"karma-jasmine": "^5",
"karma-jasmine-html-reporter": "^1.5.4",
"nyc": "^15.1.0",
"prettier": "^2.4.1",
"prettier": "^2.8.1",
"readonly-date": "^1.0.0",
"ses": "^0.11.0",
"source-map-support": "^0.5.19",

View File

@ -1,3 +1,4 @@
import { fromBase64 } from "@cosmjs/encoding";
import { Any } from "cosmjs-types/google/protobuf/any";
import { accountFromAny } from "./accounts";
@ -6,10 +7,11 @@ describe("accounts", () => {
describe("accountFromAny", () => {
it("works for PeriodicVestingAccount", () => {
// Queried from chain via `packages/cli/examples/get_akash_vesting_account.ts`.
const any = Any.fromJSON({
const any = Any.fromPartial({
typeUrl: "/cosmos.vesting.v1beta1.PeriodicVestingAccount",
value:
value: fromBase64(
"CsMBCnoKLGFrYXNoMXF5MHZ1cjNmbDJ1Y3p0cHpjcmZlYTdtYzhqd3o4eGptdnE3cXZ5EkYKHy9jb3Ntb3MuY3J5cHRvLnNlY3AyNTZrMS5QdWJLZXkSIwohA/XsdhwSIKU73TltD9STcaS07FNw0szR4a+oDLr6vikaGDggGxIUCgR1YWt0EgwxNjY2NjY2NzAwMDAaEwoEdWFrdBILMzcxOTAzMzAwMDAiFAoEdWFrdBIMMTY2NjY2NjcwMDAwKOC9wZkGEODvt/sFGhoIgOeEDxITCgR1YWt0Egs4MzMzMzMzNTAwMBoaCIC/ugcSEwoEdWFrdBILNDE2NjY2Njc1MDAaGgiAqMoHEhMKBHVha3QSCzQxNjY2NjY3NTAw",
),
});
const account = accountFromAny(any);

View File

@ -26,7 +26,7 @@ function uint64FromProto(input: number | Long): Uint64 {
function accountFromBaseAccount(input: BaseAccount): Account {
const { address, pubKey, accountNumber, sequence } = input;
const pubkey = decodePubkey(pubKey);
const pubkey = pubKey ? decodePubkey(pubKey) : null;
return {
address: address,
pubkey: pubkey,

View File

@ -45,7 +45,7 @@ describe("AminoTypes", () => {
it("can override type with Amino type collision", () => {
const types = new AminoTypes({
...createStakingAminoConverters("cosmos"),
...createStakingAminoConverters(),
"/cosmos.staking.otherVersion456.MsgDelegate": {
aminoType: "cosmos-sdk/MsgDelegate",
toAmino: (m: MsgDelegate): { readonly foo: string } => ({

View File

@ -108,7 +108,9 @@ export {
createProtobufRpcClient,
decodeCosmosSdkDecFromProto,
ProtobufRpcClient,
QueryAbciResponse,
QueryClient,
QueryStoreResponse,
} from "./queryclient";
export {
isSearchByHeightQuery,

View File

@ -510,31 +510,31 @@ export function setupIbcExtension(base: QueryClient): IbcExtension {
// keeper: https://github.com/cosmos/cosmos-sdk/blob/3bafd8255a502e5a9cee07391cf8261538245dfd/x/ibc/04-channel/keeper/keeper.go#L55-L65
// key: https://github.com/cosmos/cosmos-sdk/blob/ef0a7344af345882729598bc2958a21143930a6b/x/ibc/24-host/keys.go#L117-L120
const key = toAscii(`channelEnds/ports/${portId}/channels/${channelId}`);
const responseData = await base.queryVerified("ibc", key);
return responseData.length ? Channel.decode(responseData) : null;
const { value } = await base.queryStoreVerified("ibc", key);
return value.length ? Channel.decode(value) : null;
},
packetCommitment: async (portId: string, channelId: string, sequence: number) => {
// keeper: https://github.com/cosmos/cosmos-sdk/blob/3bafd8255a502e5a9cee07391cf8261538245dfd/x/ibc/04-channel/keeper/keeper.go#L128-L133
// key: https://github.com/cosmos/cosmos-sdk/blob/ef0a7344af345882729598bc2958a21143930a6b/x/ibc/24-host/keys.go#L183-L185
const key = toAscii(`commitments/ports/${portId}/channels/${channelId}/packets/${sequence}`);
const responseData = await base.queryVerified("ibc", key);
const { value } = await base.queryStoreVerified("ibc", key);
// keeper code doesn't parse, but returns raw
return responseData;
return value;
},
packetAcknowledgement: async (portId: string, channelId: string, sequence: number) => {
// keeper: https://github.com/cosmos/cosmos-sdk/blob/3bafd8255a502e5a9cee07391cf8261538245dfd/x/ibc/04-channel/keeper/keeper.go#L159-L166
// key: https://github.com/cosmos/cosmos-sdk/blob/ef0a7344af345882729598bc2958a21143930a6b/x/ibc/24-host/keys.go#L153-L156
const key = toAscii(`acks/ports/${portId}/channels/${channelId}/acknowledgements/${sequence}`);
const responseData = await base.queryVerified("ibc", key);
const { value } = await base.queryStoreVerified("ibc", key);
// keeper code doesn't parse, but returns raw
return responseData;
return value;
},
nextSequenceReceive: async (portId: string, channelId: string) => {
// keeper: https://github.com/cosmos/cosmos-sdk/blob/3bafd8255a502e5a9cee07391cf8261538245dfd/x/ibc/04-channel/keeper/keeper.go#L92-L101
// key: https://github.com/cosmos/cosmos-sdk/blob/ef0a7344af345882729598bc2958a21143930a6b/x/ibc/24-host/keys.go#L133-L136
const key = toAscii(`seqAcks/ports/${portId}/channels/${channelId}/nextSequenceAck`);
const responseData = await base.queryVerified("ibc", key);
return responseData.length ? Uint64.fromBytes(responseData).toNumber() : null;
const { value } = await base.queryStoreVerified("ibc", key);
return value.length ? Uint64.fromBytes(value).toNumber() : null;
},
},
},

View File

@ -18,9 +18,21 @@ import {
AminoMsgEditValidator,
AminoMsgUndelegate,
createStakingAminoConverters,
protoDecimalToJson,
} from "./aminomessages";
describe("AminoTypes", () => {
describe("protoDecimalToJson", () => {
it("works", () => {
expect(protoDecimalToJson("0")).toEqual("0.000000000000000000");
expect(protoDecimalToJson("1")).toEqual("0.000000000000000001");
expect(protoDecimalToJson("2497")).toEqual("0.000000000000002497");
expect(protoDecimalToJson("987000000000000000")).toEqual("0.987000000000000000");
expect(protoDecimalToJson("123987000000000000000")).toEqual("123.987000000000000000");
expect(protoDecimalToJson("4872000000000000000000")).toEqual("4872.000000000000000000");
});
});
describe("toAmino", () => {
it("works for MsgBeginRedelegate", () => {
const msg: MsgBeginRedelegate = {
@ -29,7 +41,7 @@ describe("AminoTypes", () => {
validatorDstAddress: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k",
amount: coin(1234, "ucosm"),
};
const aminoTypes = new AminoTypes(createStakingAminoConverters("cosmos"));
const aminoTypes = new AminoTypes(createStakingAminoConverters());
const aminoMsg = aminoTypes.toAmino({
typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate",
value: msg,
@ -75,7 +87,7 @@ describe("AminoTypes", () => {
},
value: coin(1234, "ucosm"),
};
const aminoTypes = new AminoTypes(createStakingAminoConverters("cosmos"));
const aminoTypes = new AminoTypes(createStakingAminoConverters());
const aminoMsg = aminoTypes.toAmino({
typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator",
value: msg,
@ -114,7 +126,7 @@ describe("AminoTypes", () => {
validatorAddress: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5",
amount: coin(1234, "ucosm"),
};
const aminoTypes = new AminoTypes(createStakingAminoConverters("cosmos"));
const aminoTypes = new AminoTypes(createStakingAminoConverters());
const aminoMsg = aminoTypes.toAmino({
typeUrl: "/cosmos.staking.v1beta1.MsgDelegate",
value: msg,
@ -143,7 +155,7 @@ describe("AminoTypes", () => {
minSelfDelegation: "123",
validatorAddress: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5",
};
const aminoTypes = new AminoTypes(createStakingAminoConverters("cosmos"));
const aminoTypes = new AminoTypes(createStakingAminoConverters());
const aminoMsg = aminoTypes.toAmino({
typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator",
value: msg,
@ -172,7 +184,7 @@ describe("AminoTypes", () => {
validatorAddress: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5",
amount: coin(1234, "ucosm"),
};
const aminoTypes = new AminoTypes(createStakingAminoConverters("cosmos"));
const aminoTypes = new AminoTypes(createStakingAminoConverters());
const aminoMsg = aminoTypes.toAmino({
typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate",
value: msg,
@ -200,7 +212,7 @@ describe("AminoTypes", () => {
amount: coin(1234, "ucosm"),
},
};
const msg = new AminoTypes(createStakingAminoConverters("cosmos")).fromAmino(aminoMsg);
const msg = new AminoTypes(createStakingAminoConverters()).fromAmino(aminoMsg);
const expectedValue: MsgBeginRedelegate = {
delegatorAddress: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
validatorSrcAddress: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5",
@ -239,7 +251,7 @@ describe("AminoTypes", () => {
value: coin(1234, "ucosm"),
},
};
const msg = new AminoTypes(createStakingAminoConverters("cosmos")).fromAmino(aminoMsg);
const msg = new AminoTypes(createStakingAminoConverters()).fromAmino(aminoMsg);
const expectedValue: MsgCreateValidator = {
description: {
moniker: "validator",
@ -283,7 +295,7 @@ describe("AminoTypes", () => {
amount: coin(1234, "ucosm"),
},
};
const msg = new AminoTypes(createStakingAminoConverters("cosmos")).fromAmino(aminoMsg);
const msg = new AminoTypes(createStakingAminoConverters()).fromAmino(aminoMsg);
const expectedValue: MsgDelegate = {
delegatorAddress: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
validatorAddress: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5",
@ -311,7 +323,7 @@ describe("AminoTypes", () => {
validator_address: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5",
},
};
const msg = new AminoTypes(createStakingAminoConverters("cosmos")).fromAmino(aminoMsg);
const msg = new AminoTypes(createStakingAminoConverters()).fromAmino(aminoMsg);
const expectedValue: MsgEditValidator = {
description: {
moniker: "validator",
@ -339,7 +351,7 @@ describe("AminoTypes", () => {
amount: coin(1234, "ucosm"),
},
};
const msg = new AminoTypes(createStakingAminoConverters("cosmos")).fromAmino(aminoMsg);
const msg = new AminoTypes(createStakingAminoConverters()).fromAmino(aminoMsg);
const expectedValue: MsgUndelegate = {
delegatorAddress: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
validatorAddress: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5",

View File

@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { AminoMsg, Coin, Pubkey } from "@cosmjs/amino";
import { Decimal } from "@cosmjs/math";
import { anyToSinglePubkey, encodePubkey } from "@cosmjs/proto-signing";
import { decodePubkey, encodePubkey } from "@cosmjs/proto-signing";
import { assertDefinedAndNotNull } from "@cosmjs/utils";
import {
MsgBeginRedelegate,
@ -29,10 +29,10 @@ interface Description {
readonly details: string;
}
function protoDecimalToJson(decimal: string): string {
export function protoDecimalToJson(decimal: string): string {
const parsed = Decimal.fromAtomics(decimal, 18);
const [whole, fractional] = parsed.toString().split(".");
return `${whole}.${fractional.padEnd(18, "0")}`;
return `${whole}.${(fractional ?? "").padEnd(18, "0")}`;
}
function jsonDecimalToProto(decimal: string): string {
@ -143,9 +143,7 @@ export function isAminoMsgUndelegate(msg: AminoMsg): msg is AminoMsgUndelegate {
return msg.type === "cosmos-sdk/MsgUndelegate";
}
export function createStakingAminoConverters(
_prefix: string,
): Record<string, AminoConverter | "not_supported_by_chain"> {
export function createStakingAminoConverters(): Record<string, AminoConverter | "not_supported_by_chain"> {
return {
"/cosmos.staking.v1beta1.MsgBeginRedelegate": {
aminoType: "cosmos-sdk/MsgBeginRedelegate",
@ -206,7 +204,7 @@ export function createStakingAminoConverters(
min_self_delegation: minSelfDelegation,
delegator_address: delegatorAddress,
validator_address: validatorAddress,
pubkey: anyToSinglePubkey(pubkey),
pubkey: decodePubkey(pubkey),
value: value,
};
},

View File

@ -1,4 +1,4 @@
export { QueryClient } from "./queryclient";
export { QueryAbciResponse, QueryClient, QueryStoreResponse } from "./queryclient";
export {
createPagination,
createProtobufRpcClient,

View File

@ -37,26 +37,27 @@ async function makeClient(rpcUrl: string): Promise<[QueryClient, Tendermint34Cli
const denomMetadataPrefix = new Uint8Array([0x01]);
describe("QueryClient", () => {
describe("queryVerified", () => {
describe("queryStoreVerified", () => {
it("works via WebSockets", async () => {
pendingWithoutSimapp();
const [client, tmClient] = await makeClient(simapp.tendermintUrlWs);
// "keys before 0.45 had denom two times in the key"
// https://github.com/cosmos/cosmos-sdk/blob/10ad61a4dd/x/bank/migrations/v045/store_test.go#L91
let key: Uint8Array;
let queryKey: Uint8Array;
if (simapp44Enabled()) {
key = Uint8Array.from([
queryKey = Uint8Array.from([
...denomMetadataPrefix,
...toAscii(simapp.denomFee),
...toAscii(simapp.denomFee),
]);
} else {
key = Uint8Array.from([...denomMetadataPrefix, ...toAscii(simapp.denomFee)]);
queryKey = Uint8Array.from([...denomMetadataPrefix, ...toAscii(simapp.denomFee)]);
}
const data = await client.queryVerified("bank", key);
const response = Metadata.decode(data);
const { key, value, height } = await client.queryStoreVerified("bank", queryKey);
expect(height).toBeGreaterThanOrEqual(1);
expect(key).toEqual(queryKey);
const response = Metadata.decode(value);
expect(response.base).toEqual(simapp.denomFee);
expect(response.description).toEqual("The fee token of this test chain");
@ -69,20 +70,21 @@ describe("QueryClient", () => {
// "keys before 0.45 had denom two times in the key"
// https://github.com/cosmos/cosmos-sdk/blob/10ad61a4dd/x/bank/migrations/v045/store_test.go#L91
let key: Uint8Array;
let queryKey: Uint8Array;
if (simapp44Enabled()) {
key = Uint8Array.from([
queryKey = Uint8Array.from([
...denomMetadataPrefix,
...toAscii(simapp.denomFee),
...toAscii(simapp.denomFee),
]);
} else {
key = Uint8Array.from([...denomMetadataPrefix, ...toAscii(simapp.denomFee)]);
queryKey = Uint8Array.from([...denomMetadataPrefix, ...toAscii(simapp.denomFee)]);
}
const data = await client.queryVerified("bank", key);
const response = Metadata.decode(data);
const { key, value, height } = await client.queryStoreVerified("bank", queryKey);
expect(height).toBeGreaterThanOrEqual(1);
expect(key).toEqual(queryKey);
const response = Metadata.decode(value);
expect(response.base).toEqual(simapp.denomFee);
expect(response.description).toEqual("The fee token of this test chain");

View File

@ -26,6 +26,13 @@ export interface ProvenQuery {
readonly height: number;
}
export interface QueryStoreResponse {
/** The response key from Tendermint. This is the same as the query key in the request. */
readonly key: Uint8Array;
readonly value: Uint8Array;
readonly height: number;
}
/**
* The response of an ABCI query to Tendermint.
* This is a subset of `tendermint34.AbciQueryResponse` in order
@ -505,10 +512,31 @@ export class QueryClient {
this.tmClient = tmClient;
}
public async queryVerified(store: string, key: Uint8Array, desiredHeight?: number): Promise<Uint8Array> {
const { height, proof, value } = await this.queryRawProof(store, key, desiredHeight);
/**
* @deprecated use queryStoreVerified instead
*/
public async queryVerified(
store: string,
queryKey: Uint8Array,
desiredHeight?: number,
): Promise<Uint8Array> {
const { value } = await this.queryStoreVerified(store, queryKey, desiredHeight);
return value;
}
const subProof = checkAndParseOp(proof.ops[0], "ics23:iavl", key);
/**
* Queries the database store with a proof, which is then verified.
*
* Please note: the current implementation trusts block headers it gets from the PRC endpoint.
*/
public async queryStoreVerified(
store: string,
queryKey: Uint8Array,
desiredHeight?: number,
): Promise<QueryStoreResponse> {
const { height, proof, key, value } = await this.queryRawProof(store, queryKey, desiredHeight);
const subProof = checkAndParseOp(proof.ops[0], "ics23:iavl", queryKey);
const storeProof = checkAndParseOp(proof.ops[1], "ics23:simple", toAscii(store));
// this must always be existence, if the store is not a typo
@ -520,20 +548,20 @@ export class QueryClient {
// non-existence check
assert(subProof.nonexist);
// the subproof must map the desired key to the "value" of the storeProof
verifyNonExistence(subProof.nonexist, iavlSpec, storeProof.exist.value, key);
verifyNonExistence(subProof.nonexist, iavlSpec, storeProof.exist.value, queryKey);
} else {
// existence check
assert(subProof.exist);
assert(subProof.exist.value);
// the subproof must map the desired key to the "value" of the storeProof
verifyExistence(subProof.exist, iavlSpec, storeProof.exist.value, key, value);
verifyExistence(subProof.exist, iavlSpec, storeProof.exist.value, queryKey, value);
}
// the store proof must map its declared value (root of subProof) to the appHash of the next block
const header = await this.getNextHeader(height);
verifyExistence(storeProof.exist, tendermintSpec, header.appHash, toAscii(store), storeProof.exist.value);
return value;
return { key, value, height };
}
public async queryRawProof(

View File

@ -10,11 +10,12 @@ import {
} from "@cosmjs/proto-signing";
import { Tendermint34Client } from "@cosmjs/tendermint-rpc";
import { assert, sleep } from "@cosmjs/utils";
import { DeepPartial } from "cosmjs-types";
import { MsgSend } from "cosmjs-types/cosmos/bank/v1beta1/tx";
import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin";
import { BasicAllowance } from "cosmjs-types/cosmos/feegrant/v1beta1/feegrant";
import { MsgGrantAllowance } from "cosmjs-types/cosmos/feegrant/v1beta1/tx";
import { DeepPartial, MsgDelegate } from "cosmjs-types/cosmos/staking/v1beta1/tx";
import { MsgDelegate } from "cosmjs-types/cosmos/staking/v1beta1/tx";
import { AuthInfo, TxBody, TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
import { Any } from "cosmjs-types/google/protobuf/any";
import Long from "long";
@ -541,10 +542,6 @@ describe("SigningStargateClient", () => {
throw new Error("decode method should not be required");
},
fromJSON(): CustomMsgDelegate {
throw new Error("fromJSON method should not be required");
},
fromPartial(object: DeepPartial<CustomMsgDelegate>): CustomMsgDelegate {
const message = { ...baseCustomMsgDelegate } as CustomMsgDelegate;
if (object.customDelegatorAddress !== undefined && object.customDelegatorAddress !== null) {
@ -564,10 +561,6 @@ describe("SigningStargateClient", () => {
}
return message;
},
toJSON(): unknown {
throw new Error("toJSON method should not be required");
},
};
customRegistry.register(msgDelegateTypeUrl, CustomMsgDelegate);
const customAminoTypes = new AminoTypes({
@ -829,10 +822,6 @@ describe("SigningStargateClient", () => {
throw new Error("decode method should not be required");
},
fromJSON(): CustomMsgDelegate {
throw new Error("fromJSON method should not be required");
},
fromPartial(object: DeepPartial<CustomMsgDelegate>): CustomMsgDelegate {
const message = { ...baseCustomMsgDelegate } as CustomMsgDelegate;
if (object.customDelegatorAddress !== undefined && object.customDelegatorAddress !== null) {
@ -852,10 +841,6 @@ describe("SigningStargateClient", () => {
}
return message;
},
toJSON(): unknown {
throw new Error("toJSON method should not be required");
},
};
customRegistry.register(msgDelegateTypeUrl, CustomMsgDelegate);
const customAminoTypes = new AminoTypes({

View File

@ -87,19 +87,18 @@ export interface PrivateSigningStargateClient {
export interface SigningStargateClientOptions extends StargateClientOptions {
readonly registry?: Registry;
readonly aminoTypes?: AminoTypes;
readonly prefix?: string;
readonly broadcastTimeoutMs?: number;
readonly broadcastPollIntervalMs?: number;
readonly gasPrice?: GasPrice;
}
function createDefaultTypes(prefix: string): AminoConverters {
function createDefaultTypes(): AminoConverters {
return {
...createAuthzAminoConverters(),
...createBankAminoConverters(),
...createDistributionAminoConverters(),
...createGovAminoConverters(),
...createStakingAminoConverters(prefix),
...createStakingAminoConverters(),
...createIbcAminoConverters(),
...createFeegrantAminoConverters(),
...createVestingAminoConverters(),
@ -146,10 +145,7 @@ export class SigningStargateClient extends StargateClient {
options: SigningStargateClientOptions,
) {
super(tmClient, options);
// TODO: do we really want to set a default here? Ideally we could get it from the signer such that users only have to set it once.
const prefix = options.prefix ?? "cosmos";
const { registry = createDefaultRegistry(), aminoTypes = new AminoTypes(createDefaultTypes(prefix)) } =
options;
const { registry = createDefaultRegistry(), aminoTypes = new AminoTypes(createDefaultTypes()) } = options;
this.registry = registry;
this.aminoTypes = aminoTypes;
this.signer = signer;

View File

@ -1,6 +1,6 @@
{
"name": "@cosmjs/stream",
"version": "0.29.4",
"version": "0.29.5",
"description": "Utility functions for producing and consuming streams",
"contributors": [
"IOV SAS <admin@iov.one>",
@ -70,7 +70,7 @@
"karma-jasmine": "^5",
"karma-jasmine-html-reporter": "^1.5.4",
"nyc": "^15.1.0",
"prettier": "^2.4.1",
"prettier": "^2.8.1",
"ses": "^0.11.0",
"source-map-support": "^0.5.19",
"ts-node": "^8",

View File

@ -1,6 +1,6 @@
{
"name": "@cosmjs/tendermint-rpc",
"version": "0.29.4",
"version": "0.29.5",
"description": "Tendermint RPC clients",
"contributors": [
"IOV SAS <admin@iov.one>",
@ -79,7 +79,7 @@
"karma-jasmine": "^5",
"karma-jasmine-html-reporter": "^1.5.4",
"nyc": "^15.1.0",
"prettier": "^2.4.1",
"prettier": "^2.8.1",
"ses": "^0.11.0",
"source-map-support": "^0.5.19",
"ts-node": "^8",

View File

@ -19,17 +19,11 @@ describe("http", () => {
expect(response).toEqual(jasmine.objectContaining({ jsonrpc: "2.0" }));
});
it("errors for non-open port", async () => {
await expectAsync(
http("POST", `http://localhost:56745`, undefined, createJsonRpcRequest("health")),
).toBeRejectedWithError(/(ECONNREFUSED|Failed to fetch)/i);
});
it("can send custom headers", async () => {
it("can POST to echo server", async () => {
pendingWithoutHttpServer();
// Without custom headers
const response1 = await http("POST", echoUrl, undefined, createJsonRpcRequest("health"));
expect(response1).toEqual({
const response = await http("POST", echoUrl, undefined, createJsonRpcRequest("health"));
expect(response).toEqual({
request_headers: jasmine.objectContaining({
// Basic headers from http client
Accept: jasmine.any(String),
@ -39,15 +33,25 @@ describe("http", () => {
"User-Agent": jasmine.any(String),
}),
});
});
it("errors for non-open port", async () => {
await expectAsync(
http("POST", `http://localhost:56745`, undefined, createJsonRpcRequest("health")),
).toBeRejectedWithError(/(ECONNREFUSED|Failed to fetch)/i);
});
it("can POST to echo server with custom headers", async () => {
pendingWithoutHttpServer();
// With custom headers
const response2 = await http(
const response = await http(
"POST",
echoUrl,
{ foo: "bar123", Authorization: "Basic Z3Vlc3Q6bm9QYXNzMTIz" },
createJsonRpcRequest("health"),
);
expect(response2).toEqual({
expect(response).toEqual({
request_headers: jasmine.objectContaining({
// Basic headers from http client
"Content-Length": jasmine.any(String),

View File

@ -11,6 +11,23 @@ function filterBadStatus(res: any): any {
return res;
}
/**
* Node.js 18 comes with exprimental fetch support (https://nodejs.org/de/blog/announcements/v18-release-announce/).
* This is nice, but the implementation does not yet work wekk for us. We
* can just stick with axios on those systems for now.
*/
// eslint-disable-next-line @typescript-eslint/ban-types
function isExperimental(nodeJsFunc: Function): boolean {
// This works because we get this info in node 18:
//
// > fetch.toString()
// 'async function fetch(input, init = undefined) {\n' +
// " emitExperimentalWarning('The Fetch API');\n" +
// ' return lazyUndici().fetch(input, init);\n' +
// ' }'
return nodeJsFunc.toString().includes("emitExperimentalWarning");
}
/**
* Helper to work around missing CORS support in Tendermint (https://github.com/tendermint/tendermint/pull/2800)
*
@ -23,7 +40,7 @@ export async function http(
headers: Record<string, string> | undefined,
request?: any,
): Promise<any> {
if (typeof fetch !== "undefined") {
if (typeof fetch === "function" && !isExperimental(fetch)) {
const settings = {
method: method,
body: request ? JSON.stringify(request) : undefined,

View File

@ -732,8 +732,6 @@ interface RpcTxEvent {
readonly tx: string;
readonly result: RpcTxData;
readonly height: string;
/** Not set since Tendermint 0.34 */
readonly index?: number;
}
function decodeTxEvent(data: RpcTxEvent): responses.TxEvent {
@ -743,7 +741,6 @@ function decodeTxEvent(data: RpcTxEvent): responses.TxEvent {
hash: hashTx(tx),
result: decodeTxData(data.result),
height: apiToSmallInt(assertNotEmpty(data.height)),
index: may(apiToSmallInt, data.index),
};
}

View File

@ -174,8 +174,6 @@ export interface TxEvent {
readonly tx: Uint8Array;
readonly hash: Uint8Array;
readonly height: number;
/** @deprecated this value is not set in Tendermint 0.34+ */
readonly index?: number;
readonly result: TxData;
}

View File

@ -733,8 +733,6 @@ interface RpcTxEvent {
readonly tx: string;
readonly result: RpcTxData;
readonly height: string;
/** Not set since Tendermint 0.34 */
readonly index?: number;
}
function decodeTxEvent(data: RpcTxEvent): responses.TxEvent {
@ -744,7 +742,6 @@ function decodeTxEvent(data: RpcTxEvent): responses.TxEvent {
hash: hashTx(tx),
result: decodeTxData(data.result),
height: apiToSmallInt(assertNotEmpty(data.height)),
index: may(apiToSmallInt, data.index),
};
}

View File

@ -174,8 +174,6 @@ export interface TxEvent {
readonly tx: Uint8Array;
readonly hash: Uint8Array;
readonly height: number;
/** @deprecated this value is not set in Tendermint 0.34+ */
readonly index?: number;
readonly result: TxData;
}

View File

@ -1,6 +1,6 @@
{
"name": "@cosmjs/utils",
"version": "0.29.4",
"version": "0.29.5",
"description": "Utility tools, primarily for testing code",
"contributors": [
"IOV SAS <admin@iov.one>"
@ -66,7 +66,7 @@
"karma-jasmine": "^5",
"karma-jasmine-html-reporter": "^1.5.4",
"nyc": "^15.1.0",
"prettier": "^2.4.1",
"prettier": "^2.8.1",
"ses": "^0.11.0",
"source-map-support": "^0.5.19",
"ts-node": "^8",

View File

@ -4,8 +4,8 @@
"declaration": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"lib": ["es2018"],
"target": "es2018",
"lib": ["es2020"],
"target": "es2020",
"module": "commonjs",
"moduleResolution": "node",
"newLine": "LF",

136
yarn.lock
View File

@ -325,7 +325,7 @@ __metadata:
karma-jasmine: ^5
karma-jasmine-html-reporter: ^1.5.4
nyc: ^15.1.0
prettier: ^2.4.1
prettier: ^2.8.1
ses: ^0.11.0
source-map-support: ^0.5.19
ts-node: ^8
@ -362,7 +362,7 @@ __metadata:
axios: ^0.21.2
babylon: ^6.18.0
chalk: ^4
cosmjs-types: ^0.5.2
cosmjs-types: ^0.6.0
diff: ^4
eslint: ^7.5
eslint-config-prettier: ^8.3.0
@ -374,7 +374,7 @@ __metadata:
jasmine: ^4
jasmine-spec-reporter: ^6
nyc: ^15.1.0
prettier: ^2.4.1
prettier: ^2.8.1
recast: ^0.20
source-map-support: ^0.5.19
ts-node: ^8
@ -408,7 +408,7 @@ __metadata:
"@types/pako": ^1.0.1
"@typescript-eslint/eslint-plugin": ^5.13.0
"@typescript-eslint/parser": ^5.13.0
cosmjs-types: ^0.5.2
cosmjs-types: ^0.6.0
eslint: ^7.5
eslint-config-prettier: ^8.3.0
eslint-import-resolver-node: ^0.3.4
@ -427,7 +427,7 @@ __metadata:
long: ^4.0.0
nyc: ^15.1.0
pako: ^2.0.2
prettier: ^2.4.1
prettier: ^2.8.1
protobufjs: ~6.11.3
readonly-date: ^1.0.0
ses: ^0.11.0
@ -480,7 +480,7 @@ __metadata:
karma-jasmine-html-reporter: ^1.5.4
libsodium-wrappers: ^0.7.6
nyc: ^15.1.0
prettier: ^2.4.1
prettier: ^2.8.1
ses: ^0.11.0
source-map-support: ^0.5.19
ts-node: ^8
@ -523,7 +523,7 @@ __metadata:
karma-jasmine: ^5
karma-jasmine-html-reporter: ^1.5.4
nyc: ^15.1.0
prettier: ^2.4.1
prettier: ^2.8.1
readonly-date: ^1.0.0
ses: ^0.11.0
source-map-support: ^0.5.19
@ -565,7 +565,7 @@ __metadata:
karma-jasmine: ^5
karma-jasmine-html-reporter: ^1.5.4
nyc: ^15.1.0
prettier: ^2.4.1
prettier: ^2.8.1
ses: ^0.11.0
source-map-support: ^0.5.19
ts-node: ^8
@ -607,7 +607,7 @@ __metadata:
koa: ^2.13
koa-bodyparser: ^4.3
nyc: ^15.1.0
prettier: ^2.4.1
prettier: ^2.8.1
ses: ^0.11.0
source-map-support: ^0.5.19
ts-node: ^8
@ -648,7 +648,7 @@ __metadata:
karma-jasmine: ^5
karma-jasmine-html-reporter: ^1.5.4
nyc: ^15.1.0
prettier: ^2.4.1
prettier: ^2.8.1
ses: ^0.11.0
source-map-support: ^0.5.19
ts-node: ^8
@ -694,7 +694,7 @@ __metadata:
jasmine-spec-reporter: ^6
ledger-cosmos-js: ^2.1.8
nyc: ^15.1.0
prettier: ^2.4.1
prettier: ^2.8.1
semver: ^7.3.2
ses: ^0.11.0
source-map-support: ^0.5.19
@ -737,7 +737,7 @@ __metadata:
karma-jasmine: ^5
karma-jasmine-html-reporter: ^1.5.4
nyc: ^15.1.0
prettier: ^2.4.1
prettier: ^2.8.1
ses: ^0.11.0
source-map-support: ^0.5.19
ts-node: ^8
@ -767,7 +767,7 @@ __metadata:
"@types/node": ^15.0.1
"@typescript-eslint/eslint-plugin": ^5.13.0
"@typescript-eslint/parser": ^5.13.0
cosmjs-types: ^0.5.2
cosmjs-types: ^0.6.0
eslint: ^7.5
eslint-config-prettier: ^8.3.0
eslint-import-resolver-node: ^0.3.4
@ -785,7 +785,7 @@ __metadata:
karma-jasmine-html-reporter: ^1.5.4
long: ^4.0.0
nyc: ^15.1.0
prettier: ^2.4.1
prettier: ^2.8.1
protobufjs: ~6.11.3
ses: ^0.11.0
source-map-support: ^0.5.19
@ -828,7 +828,7 @@ __metadata:
karma-jasmine: ^5
karma-jasmine-html-reporter: ^1.5.4
nyc: ^15.1.0
prettier: ^2.4.1
prettier: ^2.8.1
ses: ^0.11.0
source-map-support: ^0.5.19
ts-node: ^8
@ -864,7 +864,7 @@ __metadata:
"@types/node": ^15.0.1
"@typescript-eslint/eslint-plugin": ^5.13.0
"@typescript-eslint/parser": ^5.13.0
cosmjs-types: ^0.5.2
cosmjs-types: ^0.6.0
eslint: ^7.5
eslint-config-prettier: ^8.3.0
eslint-import-resolver-node: ^0.3.4
@ -882,7 +882,7 @@ __metadata:
karma-jasmine-html-reporter: ^1.5.4
long: ^4.0.0
nyc: ^15.1.0
prettier: ^2.4.1
prettier: ^2.8.1
protobufjs: ~6.11.3
readonly-date: ^1.0.0
ses: ^0.11.0
@ -925,7 +925,7 @@ __metadata:
karma-jasmine: ^5
karma-jasmine-html-reporter: ^1.5.4
nyc: ^15.1.0
prettier: ^2.4.1
prettier: ^2.8.1
ses: ^0.11.0
source-map-support: ^0.5.19
ts-node: ^8
@ -974,7 +974,7 @@ __metadata:
karma-jasmine: ^5
karma-jasmine-html-reporter: ^1.5.4
nyc: ^15.1.0
prettier: ^2.4.1
prettier: ^2.8.1
readonly-date: ^1.0.0
ses: ^0.11.0
source-map-support: ^0.5.19
@ -1017,7 +1017,7 @@ __metadata:
karma-jasmine: ^5
karma-jasmine-html-reporter: ^1.5.4
nyc: ^15.1.0
prettier: ^2.4.1
prettier: ^2.8.1
ses: ^0.11.0
source-map-support: ^0.5.19
ts-node: ^8
@ -2403,7 +2403,7 @@ __metadata:
languageName: node
linkType: hard
"bindings@npm:^1.4.0, bindings@npm:^1.5.0":
"bindings@npm:^1.5.0":
version: 1.5.0
resolution: "bindings@npm:1.5.0"
dependencies:
@ -2924,18 +2924,18 @@ __metadata:
"@cosmjs/proto-signing": "workspace:^"
"@cosmjs/stargate": "workspace:^"
eslint: ^7.5
prettier: ^2.4.1
prettier: ^2.8.1
typescript: ~4.6
languageName: unknown
linkType: soft
"cosmjs-types@npm:^0.5.2":
version: 0.5.2
resolution: "cosmjs-types@npm:0.5.2"
"cosmjs-types@npm:^0.6.0":
version: 0.6.0
resolution: "cosmjs-types@npm:0.6.0"
dependencies:
long: ^4.0.0
protobufjs: ~6.11.2
checksum: 0362cb2136a17c0f91f0727a55a1f49058bb56665136cf88e4502febf6da59fa2d4ce91ed75bc55907571b9f1cd99546d594002509781b69fe71fe972dbfe4c1
checksum: 06000f10d931bbd23381a2303337f6c203add988d2e4e63307a0b920b2c317197d3e17d4fc535e55e7fdc211e472ee3dff18847bb7f42704d194370a1c6ed581
languageName: node
linkType: hard
@ -5431,7 +5431,7 @@ __metadata:
languageName: node
linkType: hard
"node-abi@npm:^2.21.0, node-abi@npm:^2.7.0":
"node-abi@npm:^2.21.0":
version: 2.26.0
resolution: "node-abi@npm:2.26.0"
dependencies:
@ -5440,15 +5440,6 @@ __metadata:
languageName: node
linkType: hard
"node-addon-api@npm:3.0.2":
version: 3.0.2
resolution: "node-addon-api@npm:3.0.2"
dependencies:
node-gyp: latest
checksum: cd4ef5ddc17f96fc291cc74880cbf5c1d65ab849098bc3092fa6f15f6e1a4f5ec474e071715bace3fabeb0860599bccb1a3f151063cd269962c0653dc999bf39
languageName: node
linkType: hard
"node-addon-api@npm:^3.0.2":
version: 3.2.0
resolution: "node-addon-api@npm:3.2.0"
@ -5458,6 +5449,26 @@ __metadata:
languageName: node
linkType: hard
"node-addon-api@npm:^4.2.0":
version: 4.3.0
resolution: "node-addon-api@npm:4.3.0"
dependencies:
node-gyp: latest
checksum: 3de396e23cc209f539c704583e8e99c148850226f6e389a641b92e8967953713228109f919765abc1f4355e801e8f41842f96210b8d61c7dcc10a477002dcf00
languageName: node
linkType: hard
"node-gyp-build@npm:^4.3.0":
version: 4.5.0
resolution: "node-gyp-build@npm:4.5.0"
bin:
node-gyp-build: bin.js
node-gyp-build-optional: optional.js
node-gyp-build-test: build-test.js
checksum: d888bae0fb88335f69af1b57a2294a931c5042f36e413d8d364c992c9ebfa0b96ffe773179a5a2c8f04b73856e8634e09cce108dbb9804396d3cc8c5455ff2db
languageName: node
linkType: hard
"node-gyp@npm:latest":
version: 8.0.0
resolution: "node-gyp@npm:8.0.0"
@ -5935,31 +5946,6 @@ __metadata:
languageName: node
linkType: hard
"prebuild-install@npm:^5.3.3":
version: 5.3.6
resolution: "prebuild-install@npm:5.3.6"
dependencies:
detect-libc: ^1.0.3
expand-template: ^2.0.3
github-from-package: 0.0.0
minimist: ^1.2.3
mkdirp-classic: ^0.5.3
napi-build-utils: ^1.0.1
node-abi: ^2.7.0
noop-logger: ^0.1.1
npmlog: ^4.0.1
pump: ^3.0.0
rc: ^1.2.7
simple-get: ^3.0.3
tar-fs: ^2.0.0
tunnel-agent: ^0.6.0
which-pm-runs: ^1.0.0
bin:
prebuild-install: bin.js
checksum: 9b99e5ea2c1db44efbd1bc1f3d04f887e66ae282af8560191ee3005886c8d3fab578ad3e903d0965fec082d3c0779e6337a63152dc9d0f847f1bc95317356ea1
languageName: node
linkType: hard
"prebuild-install@npm:^6.0.0":
version: 6.1.2
resolution: "prebuild-install@npm:6.1.2"
@ -6000,12 +5986,12 @@ __metadata:
languageName: node
linkType: hard
"prettier@npm:^2.4.1":
version: 2.4.1
resolution: "prettier@npm:2.4.1"
"prettier@npm:^2.8.1":
version: 2.8.1
resolution: "prettier@npm:2.8.1"
bin:
prettier: bin-prettier.js
checksum: cc6830588b401b0d742862fe9c46bc9118204fb307c3abe0e49e95b35ed23629573807ffdf9cdd65289c252a0bb51fc0171437f6626ee36378dea80f0ee80b91
checksum: 4f21a0f1269f76fb36f54e9a8a1ea4c11e27478958bf860661fb4b6d7ac69aac1581f8724fa98ea3585e56d42a2ea317a17ff6e3324f40cb11ff9e20b73785cc
languageName: node
linkType: hard
@ -7224,7 +7210,7 @@ __metadata:
"typescript@patch:typescript@~4.6#~builtin<compat/typescript>":
version: 4.6.4
resolution: "typescript@patch:typescript@npm%3A4.6.4#~builtin<compat/typescript>::version=4.6.4&hash=7ad353"
resolution: "typescript@patch:typescript@npm%3A4.6.4#~builtin<compat/typescript>::version=4.6.4&hash=701156"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
@ -7293,14 +7279,13 @@ __metadata:
linkType: hard
"usb@npm:^1.7.0":
version: 1.7.1
resolution: "usb@npm:1.7.1"
version: 1.9.2
resolution: "usb@npm:1.9.2"
dependencies:
bindings: ^1.4.0
node-addon-api: 3.0.2
node-addon-api: ^4.2.0
node-gyp: latest
prebuild-install: ^5.3.3
checksum: 7d20ffef8bc0052d0510387968bcedf70e071639eec46985ee17648d26cba6595ef0fbee3837b6701235dded52eb30cf1c51be423ab877c704569914ec3323fa
node-gyp-build: ^4.3.0
checksum: 7aaf6669f02c6f4bebe571de1c364447ca44be4dc8c60fc3261f38660e04015099ebed3943935ad64755afccd11213245d697ea05571a2f142d912bb801bb54f
languageName: node
linkType: hard
@ -7492,13 +7477,6 @@ __metadata:
languageName: node
linkType: hard
"which-pm-runs@npm:^1.0.0":
version: 1.0.0
resolution: "which-pm-runs@npm:1.0.0"
checksum: 30cf7aee31f264558070e92414316c169367bb2b84a0a32777d30392fea0892fcf9955b81c3fe7f52165ae5a33f0acfd3bc0916416cb07e6d414c90255c228ca
languageName: node
linkType: hard
"which@npm:^1.2.1":
version: 1.3.1
resolution: "which@npm:1.3.1"