Merge branch 'main' of github.com:mvid/cosmjs into authz-queries
This commit is contained in:
@@ -85,7 +85,7 @@ jobs:
|
||||
name: Install Git Large File Storage (LFS)
|
||||
# In the current image, `sudo apt install git-lfs` requires `sudo apt update` which is too slow
|
||||
command: |
|
||||
wget -O "$HOME/git-lfs.deb" https://packagecloud.io/github/git-lfs/packages/ubuntu/focal/git-lfs_2.12.1_amd64.deb/download.deb
|
||||
wget -O "$HOME/git-lfs.deb" https://packagecloud.io/github/git-lfs/packages/ubuntu/focal/git-lfs_2.13.3_amd64.deb/download.deb
|
||||
sudo dpkg -i "$HOME/git-lfs.deb"
|
||||
- checkout
|
||||
- run: # start early for less wait time below
|
||||
@@ -207,7 +207,7 @@ jobs:
|
||||
name: Install Git Large File Storage (LFS)
|
||||
# In the current image, `sudo apt install git-lfs` requires `sudo apt update` which is too slow
|
||||
command: |
|
||||
wget -O "$HOME/git-lfs.deb" https://packagecloud.io/github/git-lfs/packages/ubuntu/focal/git-lfs_2.12.1_amd64.deb/download.deb
|
||||
wget -O "$HOME/git-lfs.deb" https://packagecloud.io/github/git-lfs/packages/ubuntu/focal/git-lfs_2.13.3_amd64.deb/download.deb
|
||||
sudo dpkg -i "$HOME/git-lfs.deb"
|
||||
- checkout
|
||||
- run: # start early for less wait time below
|
||||
@@ -329,7 +329,7 @@ jobs:
|
||||
name: Install Git Large File Storage (LFS)
|
||||
# In the current image, `sudo apt install git-lfs` requires `sudo apt update` which is too slow
|
||||
command: |
|
||||
wget -O "$HOME/git-lfs.deb" https://packagecloud.io/github/git-lfs/packages/ubuntu/focal/git-lfs_2.12.1_amd64.deb/download.deb
|
||||
wget -O "$HOME/git-lfs.deb" https://packagecloud.io/github/git-lfs/packages/ubuntu/focal/git-lfs_2.13.3_amd64.deb/download.deb
|
||||
sudo dpkg -i "$HOME/git-lfs.deb"
|
||||
- checkout
|
||||
- run: # start early for less wait time below
|
||||
@@ -427,7 +427,7 @@ jobs:
|
||||
name: Install Git Large File Storage (LFS)
|
||||
# In the current image, `sudo apt install git-lfs` requires `sudo apt update` which is too slow
|
||||
command: |
|
||||
wget -O "$HOME/git-lfs.deb" https://packagecloud.io/github/git-lfs/packages/ubuntu/focal/git-lfs_2.12.1_amd64.deb/download.deb
|
||||
wget -O "$HOME/git-lfs.deb" https://packagecloud.io/github/git-lfs/packages/ubuntu/focal/git-lfs_2.13.3_amd64.deb/download.deb
|
||||
sudo dpkg -i "$HOME/git-lfs.deb"
|
||||
- checkout
|
||||
- run: # start early for less wait time below
|
||||
|
||||
@@ -416,8 +416,8 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"npm:1.1.0"\
|
||||
],\
|
||||
[\
|
||||
"@socket.io/base64-arraybuffer",\
|
||||
"npm:1.0.2"\
|
||||
"@socket.io/component-emitter",\
|
||||
"npm:3.1.0"\
|
||||
],\
|
||||
[\
|
||||
"@tootallnate/once",\
|
||||
@@ -447,10 +447,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"@types/body-parser",\
|
||||
"npm:1.19.0"\
|
||||
],\
|
||||
[\
|
||||
"@types/component-emitter",\
|
||||
"npm:1.2.10"\
|
||||
],\
|
||||
[\
|
||||
"@types/connect",\
|
||||
"npm:3.4.34"\
|
||||
@@ -477,7 +473,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
],\
|
||||
[\
|
||||
"@types/elliptic",\
|
||||
"npm:6.4.12"\
|
||||
"npm:6.4.14"\
|
||||
],\
|
||||
[\
|
||||
"@types/eslint",\
|
||||
@@ -995,10 +991,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"commondir",\
|
||||
"npm:1.0.1"\
|
||||
],\
|
||||
[\
|
||||
"component-emitter",\
|
||||
"npm:1.3.0"\
|
||||
],\
|
||||
[\
|
||||
"concat-map",\
|
||||
"npm:0.0.1"\
|
||||
@@ -1161,11 +1153,11 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
],\
|
||||
[\
|
||||
"engine.io",\
|
||||
"npm:6.1.2"\
|
||||
"npm:6.2.0"\
|
||||
],\
|
||||
[\
|
||||
"engine.io-parser",\
|
||||
"npm:5.0.3"\
|
||||
"npm:5.0.4"\
|
||||
],\
|
||||
[\
|
||||
"enhanced-resolve",\
|
||||
@@ -2453,15 +2445,15 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
],\
|
||||
[\
|
||||
"socket.io",\
|
||||
"npm:4.4.1"\
|
||||
"npm:4.5.3"\
|
||||
],\
|
||||
[\
|
||||
"socket.io-adapter",\
|
||||
"npm:2.3.3"\
|
||||
"npm:2.4.0"\
|
||||
],\
|
||||
[\
|
||||
"socket.io-parser",\
|
||||
"npm:4.0.4"\
|
||||
"npm:4.2.1"\
|
||||
],\
|
||||
[\
|
||||
"socks",\
|
||||
@@ -3335,7 +3327,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["@istanbuljs/nyc-config-typescript", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:1.0.1"],\
|
||||
["@noble/hashes", "npm:1.0.0"],\
|
||||
["@types/bn.js", "npm:5.1.0"],\
|
||||
["@types/elliptic", "npm:6.4.12"],\
|
||||
["@types/elliptic", "npm:6.4.14"],\
|
||||
["@types/eslint-plugin-prettier", "npm:3.1.0"],\
|
||||
["@types/jasmine", "npm:4.0.3"],\
|
||||
["@types/karma-firefox-launcher", "npm:2.1.0"],\
|
||||
@@ -4318,11 +4310,11 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
]],\
|
||||
["@socket.io/base64-arraybuffer", [\
|
||||
["npm:1.0.2", {\
|
||||
"packageLocation": "./.yarn/cache/@socket.io-base64-arraybuffer-npm-1.0.2-066f9f7d09-fa3e58c758.zip/node_modules/@socket.io/base64-arraybuffer/",\
|
||||
["@socket.io/component-emitter", [\
|
||||
["npm:3.1.0", {\
|
||||
"packageLocation": "./.yarn/cache/@socket.io-component-emitter-npm-3.1.0-3f778351c2-db069d9542.zip/node_modules/@socket.io/component-emitter/",\
|
||||
"packageDependencies": [\
|
||||
["@socket.io/base64-arraybuffer", "npm:1.0.2"]\
|
||||
["@socket.io/component-emitter", "npm:3.1.0"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
@@ -4395,15 +4387,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
]],\
|
||||
["@types/component-emitter", [\
|
||||
["npm:1.2.10", {\
|
||||
"packageLocation": "./.yarn/cache/@types-component-emitter-npm-1.2.10-95c27b794b-7589d3a10e.zip/node_modules/@types/component-emitter/",\
|
||||
"packageDependencies": [\
|
||||
["@types/component-emitter", "npm:1.2.10"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
]],\
|
||||
["@types/connect", [\
|
||||
["npm:3.4.34", {\
|
||||
"packageLocation": "./.yarn/cache/@types-connect-npm-3.4.34-39e4f7bb55-c6e2aa299c.zip/node_modules/@types/connect/",\
|
||||
@@ -4464,10 +4447,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
}]\
|
||||
]],\
|
||||
["@types/elliptic", [\
|
||||
["npm:6.4.12", {\
|
||||
"packageLocation": "./.yarn/cache/@types-elliptic-npm-6.4.12-02ae0f4627-35dc3b6b4b.zip/node_modules/@types/elliptic/",\
|
||||
["npm:6.4.14", {\
|
||||
"packageLocation": "./.yarn/cache/@types-elliptic-npm-6.4.14-77735f3256-d5a64f540e.zip/node_modules/@types/elliptic/",\
|
||||
"packageDependencies": [\
|
||||
["@types/elliptic", "npm:6.4.12"],\
|
||||
["@types/elliptic", "npm:6.4.14"],\
|
||||
["@types/bn.js", "npm:5.1.0"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
@@ -6802,15 +6785,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
]],\
|
||||
["component-emitter", [\
|
||||
["npm:1.3.0", {\
|
||||
"packageLocation": "./.yarn/cache/component-emitter-npm-1.3.0-4b848565b9-b3c46de38f.zip/node_modules/component-emitter/",\
|
||||
"packageDependencies": [\
|
||||
["component-emitter", "npm:1.3.0"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
]],\
|
||||
["concat-map", [\
|
||||
["npm:0.0.1", {\
|
||||
"packageLocation": "./.yarn/cache/concat-map-npm-0.0.1-85a921b7ee-902a9f5d89.zip/node_modules/concat-map/",\
|
||||
@@ -7296,10 +7270,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
}]\
|
||||
]],\
|
||||
["engine.io", [\
|
||||
["npm:6.1.2", {\
|
||||
"packageLocation": "./.yarn/cache/engine.io-npm-6.1.2-733cb68993-bd98d6ce2b.zip/node_modules/engine.io/",\
|
||||
["npm:6.2.0", {\
|
||||
"packageLocation": "./.yarn/cache/engine.io-npm-6.2.0-a0c0d83e66-cc485c5ba2.zip/node_modules/engine.io/",\
|
||||
"packageDependencies": [\
|
||||
["engine.io", "npm:6.1.2"],\
|
||||
["engine.io", "npm:6.2.0"],\
|
||||
["@types/cookie", "npm:0.4.1"],\
|
||||
["@types/cors", "npm:2.8.12"],\
|
||||
["@types/node", "npm:15.9.0"],\
|
||||
@@ -7308,18 +7282,17 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["cookie", "npm:0.4.1"],\
|
||||
["cors", "npm:2.8.5"],\
|
||||
["debug", "virtual:6d7ba8035a34a8cbc48e227f3e803dbc3acaabbab2521c3cd66a45a2853fa6bda5b3ccb3ab1942c8a738927bc0e228ea8d5baa6461d73e2cf6a345db629c4f47#npm:4.3.3"],\
|
||||
["engine.io-parser", "npm:5.0.3"],\
|
||||
["ws", "virtual:733cb6899318fc97abde396915533fc4f9852a2d62abe85daf265f0103211854a5c657d9a2fa18cdee56e1c047ccecb37162ba0f185d142200181f148b16695f#npm:8.2.3"]\
|
||||
["engine.io-parser", "npm:5.0.4"],\
|
||||
["ws", "virtual:a0c0d83e66563f51d601c822567e6d79b2ed7475481445e29115ee78d98a1ad5241e9e0cbf0e0eb707d80a4db444175061b5c5627b6aa1262f0868dc9ad1e7a1#npm:8.2.3"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
]],\
|
||||
["engine.io-parser", [\
|
||||
["npm:5.0.3", {\
|
||||
"packageLocation": "./.yarn/cache/engine.io-parser-npm-5.0.3-55c5b3beef-88d664420a.zip/node_modules/engine.io-parser/",\
|
||||
["npm:5.0.4", {\
|
||||
"packageLocation": "./.yarn/cache/engine.io-parser-npm-5.0.4-27a510b395-d4ad0cef6f.zip/node_modules/engine.io-parser/",\
|
||||
"packageDependencies": [\
|
||||
["engine.io-parser", "npm:5.0.3"],\
|
||||
["@socket.io/base64-arraybuffer", "npm:1.0.2"]\
|
||||
["engine.io-parser", "npm:5.0.4"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
@@ -9272,7 +9245,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["qjobs", "npm:1.2.0"],\
|
||||
["range-parser", "npm:1.2.1"],\
|
||||
["rimraf", "npm:3.0.2"],\
|
||||
["socket.io", "npm:4.4.1"],\
|
||||
["socket.io", "npm:4.5.3"],\
|
||||
["source-map", "npm:0.6.1"],\
|
||||
["tmp", "npm:0.2.1"],\
|
||||
["ua-parser-js", "npm:0.7.31"],\
|
||||
@@ -11246,36 +11219,35 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
}]\
|
||||
]],\
|
||||
["socket.io", [\
|
||||
["npm:4.4.1", {\
|
||||
"packageLocation": "./.yarn/cache/socket.io-npm-4.4.1-b2ec7c47a5-a559ae5235.zip/node_modules/socket.io/",\
|
||||
["npm:4.5.3", {\
|
||||
"packageLocation": "./.yarn/cache/socket.io-npm-4.5.3-30385c9144-2a7e4c64bb.zip/node_modules/socket.io/",\
|
||||
"packageDependencies": [\
|
||||
["socket.io", "npm:4.4.1"],\
|
||||
["socket.io", "npm:4.5.3"],\
|
||||
["accepts", "npm:1.3.7"],\
|
||||
["base64id", "npm:2.0.0"],\
|
||||
["debug", "virtual:6d7ba8035a34a8cbc48e227f3e803dbc3acaabbab2521c3cd66a45a2853fa6bda5b3ccb3ab1942c8a738927bc0e228ea8d5baa6461d73e2cf6a345db629c4f47#npm:4.3.3"],\
|
||||
["engine.io", "npm:6.1.2"],\
|
||||
["socket.io-adapter", "npm:2.3.3"],\
|
||||
["socket.io-parser", "npm:4.0.4"]\
|
||||
["engine.io", "npm:6.2.0"],\
|
||||
["socket.io-adapter", "npm:2.4.0"],\
|
||||
["socket.io-parser", "npm:4.2.1"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
]],\
|
||||
["socket.io-adapter", [\
|
||||
["npm:2.3.3", {\
|
||||
"packageLocation": "./.yarn/cache/socket.io-adapter-npm-2.3.3-4fd6b5d0bd-73890e0a33.zip/node_modules/socket.io-adapter/",\
|
||||
["npm:2.4.0", {\
|
||||
"packageLocation": "./.yarn/cache/socket.io-adapter-npm-2.4.0-36a74a6ea1-a84639946d.zip/node_modules/socket.io-adapter/",\
|
||||
"packageDependencies": [\
|
||||
["socket.io-adapter", "npm:2.3.3"]\
|
||||
["socket.io-adapter", "npm:2.4.0"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
}]\
|
||||
]],\
|
||||
["socket.io-parser", [\
|
||||
["npm:4.0.4", {\
|
||||
"packageLocation": "./.yarn/cache/socket.io-parser-npm-4.0.4-1dfc284556-c173b4f374.zip/node_modules/socket.io-parser/",\
|
||||
["npm:4.2.1", {\
|
||||
"packageLocation": "./.yarn/cache/socket.io-parser-npm-4.2.1-7ef513b498-2582202f22.zip/node_modules/socket.io-parser/",\
|
||||
"packageDependencies": [\
|
||||
["socket.io-parser", "npm:4.0.4"],\
|
||||
["@types/component-emitter", "npm:1.2.10"],\
|
||||
["component-emitter", "npm:1.3.0"],\
|
||||
["socket.io-parser", "npm:4.2.1"],\
|
||||
["@socket.io/component-emitter", "npm:3.1.0"],\
|
||||
["debug", "virtual:6d7ba8035a34a8cbc48e227f3e803dbc3acaabbab2521c3cd66a45a2853fa6bda5b3ccb3ab1942c8a738927bc0e228ea8d5baa6461d73e2cf6a345db629c4f47#npm:4.3.3"]\
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
@@ -13751,10 +13723,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
],\
|
||||
"linkType": "SOFT"\
|
||||
}],\
|
||||
["virtual:733cb6899318fc97abde396915533fc4f9852a2d62abe85daf265f0103211854a5c657d9a2fa18cdee56e1c047ccecb37162ba0f185d142200181f148b16695f#npm:8.2.3", {\
|
||||
"packageLocation": "./.yarn/__virtual__/ws-virtual-4b865e96d3/0/cache/ws-npm-8.2.3-03a35b8ad7-c869296ccb.zip/node_modules/ws/",\
|
||||
["virtual:992e8a49329af27dec1603ba7ec6f83173fb73e1d5752e95d78d0bec9ff8e148a218f65e20742125a49b958677fd4d6119ec35f9c56f9b4ea72f0e32f53b591b#npm:7.4.6", {\
|
||||
"packageLocation": "./.yarn/__virtual__/ws-virtual-271fa5cbbc/0/cache/ws-npm-7.4.6-9c9a725604-3a990b32ed.zip/node_modules/ws/",\
|
||||
"packageDependencies": [\
|
||||
["ws", "virtual:733cb6899318fc97abde396915533fc4f9852a2d62abe85daf265f0103211854a5c657d9a2fa18cdee56e1c047ccecb37162ba0f185d142200181f148b16695f#npm:8.2.3"],\
|
||||
["ws", "virtual:992e8a49329af27dec1603ba7ec6f83173fb73e1d5752e95d78d0bec9ff8e148a218f65e20742125a49b958677fd4d6119ec35f9c56f9b4ea72f0e32f53b591b#npm:7.4.6"],\
|
||||
["@types/bufferutil", null],\
|
||||
["@types/utf-8-validate", null],\
|
||||
["bufferutil", null],\
|
||||
@@ -13768,10 +13740,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
],\
|
||||
"linkType": "HARD"\
|
||||
}],\
|
||||
["virtual:992e8a49329af27dec1603ba7ec6f83173fb73e1d5752e95d78d0bec9ff8e148a218f65e20742125a49b958677fd4d6119ec35f9c56f9b4ea72f0e32f53b591b#npm:7.4.6", {\
|
||||
"packageLocation": "./.yarn/__virtual__/ws-virtual-271fa5cbbc/0/cache/ws-npm-7.4.6-9c9a725604-3a990b32ed.zip/node_modules/ws/",\
|
||||
["virtual:a0c0d83e66563f51d601c822567e6d79b2ed7475481445e29115ee78d98a1ad5241e9e0cbf0e0eb707d80a4db444175061b5c5627b6aa1262f0868dc9ad1e7a1#npm:8.2.3", {\
|
||||
"packageLocation": "./.yarn/__virtual__/ws-virtual-d4fe871b31/0/cache/ws-npm-8.2.3-03a35b8ad7-c869296ccb.zip/node_modules/ws/",\
|
||||
"packageDependencies": [\
|
||||
["ws", "virtual:992e8a49329af27dec1603ba7ec6f83173fb73e1d5752e95d78d0bec9ff8e148a218f65e20742125a49b958677fd4d6119ec35f9c56f9b4ea72f0e32f53b591b#npm:7.4.6"],\
|
||||
["ws", "virtual:a0c0d83e66563f51d601c822567e6d79b2ed7475481445e29115ee78d98a1ad5241e9e0cbf0e0eb707d80a4db444175061b5c5627b6aa1262f0868dc9ad1e7a1#npm:8.2.3"],\
|
||||
["@types/bufferutil", null],\
|
||||
["@types/utf-8-validate", null],\
|
||||
["bufferutil", null],\
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
+32
-1
@@ -6,6 +6,36 @@ and this project adheres to
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Deprecated
|
||||
|
||||
- @cosmjs/stargate: Deprecate `QueryClient.queryUnverified` in favour of newly
|
||||
added `QueryClient.queryAbci`.
|
||||
|
||||
## [0.29.4] - 2022-11-15
|
||||
|
||||
### Added
|
||||
|
||||
- @cosmjs/tendermint-rpc: The options in the `HttpBatchClient` constructor are
|
||||
now of type `Partial<HttpBatchClientOptions>`, allowing you to set only the
|
||||
fields you want to change ([#1309]).
|
||||
- @cosmjs/tendermint-rpc: Add missing exports `HttpBatchClient`,
|
||||
`HttpBatchClientOptions`, `RpcClient` ([#1311]).
|
||||
- @cosmjs/tendermint-rpc: Send batch immediately when full in `HttpBatchClient`
|
||||
([#1310]).
|
||||
|
||||
[#1309]: https://github.com/cosmos/cosmjs/issues/1309
|
||||
[#1310]: https://github.com/cosmos/cosmjs/issues/1310
|
||||
[#1311]: https://github.com/cosmos/cosmjs/issues/1311
|
||||
|
||||
### Fixed
|
||||
|
||||
- @cosmjs/cosmwasm-stargate: Fix `ContractCodeHistory` decoding when msg
|
||||
contains non-printable ASCII ([#1320]).
|
||||
- @cosmjs/crypto: Bump elliptic version to ^6.5.4 due to
|
||||
[CVE-2020-28498](https://github.com/advisories/GHSA-r9p9-mrjm-926w).
|
||||
|
||||
[#1320]: https://github.com/cosmos/cosmjs/pull/1320
|
||||
|
||||
## [0.29.3] - 2022-10-25
|
||||
|
||||
### Added
|
||||
@@ -1087,7 +1117,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.3...HEAD
|
||||
[unreleased]: https://github.com/cosmos/cosmjs/compare/v0.29.4...HEAD
|
||||
[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
|
||||
[0.29.1]: https://github.com/cosmos/cosmjs/compare/v0.29.0...v0.29.1
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/amino",
|
||||
"version": "0.29.3",
|
||||
"version": "0.29.4",
|
||||
"description": "Helpers for Amino based signing.",
|
||||
"contributors": [
|
||||
"Simon Warta <webmaster128@users.noreply.github.com>"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/cli",
|
||||
"version": "0.29.3",
|
||||
"version": "0.29.4",
|
||||
"description": "Command line interface",
|
||||
"contributors": [
|
||||
"IOV SAS <admin@iov.one>",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/cosmwasm-stargate",
|
||||
"version": "0.29.3",
|
||||
"version": "0.29.4",
|
||||
"description": "CosmWasm SDK",
|
||||
"contributors": [
|
||||
"Will Clark <willclarktech@users.noreply.github.com>"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { fromAscii, toHex } from "@cosmjs/encoding";
|
||||
import { fromUtf8, toHex } from "@cosmjs/encoding";
|
||||
import { Uint53 } from "@cosmjs/math";
|
||||
import {
|
||||
Account,
|
||||
@@ -415,7 +415,7 @@ export class CosmWasmClient {
|
||||
return {
|
||||
operation: operations[entry.operation],
|
||||
codeId: entry.codeId.toNumber(),
|
||||
msg: JSON.parse(fromAscii(entry.msg)),
|
||||
msg: JSON.parse(fromUtf8(entry.msg)),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/crypto",
|
||||
"version": "0.29.3",
|
||||
"version": "0.29.4",
|
||||
"description": "Cryptography resources for blockchain projects",
|
||||
"contributors": [
|
||||
"IOV SAS <admin@iov.one>",
|
||||
@@ -46,13 +46,13 @@
|
||||
"@cosmjs/utils": "workspace:^",
|
||||
"@noble/hashes": "^1",
|
||||
"bn.js": "^5.2.0",
|
||||
"elliptic": "^6.5.3",
|
||||
"elliptic": "^6.5.4",
|
||||
"libsodium-wrappers": "^0.7.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@istanbuljs/nyc-config-typescript": "^1.0.1",
|
||||
"@types/bn.js": "^5",
|
||||
"@types/elliptic": "^6.4.12",
|
||||
"@types/elliptic": "^6.4.14",
|
||||
"@types/eslint-plugin-prettier": "^3",
|
||||
"@types/jasmine": "^4",
|
||||
"@types/karma-firefox-launcher": "^2",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/encoding",
|
||||
"version": "0.29.3",
|
||||
"version": "0.29.4",
|
||||
"description": "Encoding helpers for blockchain projects",
|
||||
"contributors": [
|
||||
"IOV SAS <admin@iov.one>"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/faucet-client",
|
||||
"version": "0.29.3",
|
||||
"version": "0.29.4",
|
||||
"description": "The faucet client",
|
||||
"contributors": [
|
||||
"Will Clark <willclarktech@users.noreply.github.com>"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/faucet",
|
||||
"version": "0.29.3",
|
||||
"version": "0.29.4",
|
||||
"description": "The faucet",
|
||||
"contributors": [
|
||||
"Ethan Frey <ethanfrey@users.noreply.github.com>",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/json-rpc",
|
||||
"version": "0.29.3",
|
||||
"version": "0.29.4",
|
||||
"description": "Framework for implementing a JSON-RPC 2.0 API",
|
||||
"contributors": [
|
||||
"IOV SAS <admin@iov.one>",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/ledger-amino",
|
||||
"version": "0.29.3",
|
||||
"version": "0.29.4",
|
||||
"description": "A library for signing Amino-encoded transactions using Ledger devices",
|
||||
"contributors": [
|
||||
"Will Clark <willclarktech@users.noreply.github.com>"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/math",
|
||||
"version": "0.29.3",
|
||||
"version": "0.29.4",
|
||||
"description": "Math helpers for blockchain projects",
|
||||
"contributors": [
|
||||
"IOV SAS <admin@iov.one>"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/proto-signing",
|
||||
"version": "0.29.3",
|
||||
"version": "0.29.4",
|
||||
"description": "Utilities for protobuf based signing (Cosmos SDK 0.40+)",
|
||||
"contributors": [
|
||||
"Will Clark <willclarktech@users.noreply.github.com>",
|
||||
|
||||
@@ -46,7 +46,7 @@ export function makeAuthInfoBytes(
|
||||
);
|
||||
assert(feePayer === undefined || typeof feePayer === "string", "feePayer must be undefined or string");
|
||||
|
||||
const authInfo = {
|
||||
const authInfo = AuthInfo.fromPartial({
|
||||
signerInfos: makeSignerInfos(signers, signMode),
|
||||
fee: {
|
||||
amount: [...feeAmount],
|
||||
@@ -54,8 +54,8 @@ export function makeAuthInfoBytes(
|
||||
granter: feeGranter,
|
||||
payer: feePayer,
|
||||
},
|
||||
};
|
||||
return AuthInfo.encode(AuthInfo.fromPartial(authInfo)).finish();
|
||||
});
|
||||
return AuthInfo.encode(authInfo).finish();
|
||||
}
|
||||
|
||||
export function makeSignDoc(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/socket",
|
||||
"version": "0.29.3",
|
||||
"version": "0.29.4",
|
||||
"description": "Utility functions for working with WebSockets",
|
||||
"contributors": [
|
||||
"IOV SAS <admin@iov.one>",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/stargate",
|
||||
"version": "0.29.3",
|
||||
"version": "0.29.4",
|
||||
"description": "Utilities for Cosmos SDK 0.40",
|
||||
"contributors": [
|
||||
"Simon Warta <webmaster128@users.noreply.github.com>"
|
||||
|
||||
@@ -166,4 +166,95 @@ describe("QueryClient", () => {
|
||||
tmClient.disconnect();
|
||||
});
|
||||
});
|
||||
|
||||
describe("queryAbci", () => {
|
||||
it("works via WebSockets", async () => {
|
||||
pendingWithoutSimapp();
|
||||
const [client, tmClient] = await makeClient(simapp.tendermintUrlWs);
|
||||
|
||||
const requestData = Uint8Array.from(
|
||||
QueryAllBalancesRequest.encode({ address: unused.address }).finish(),
|
||||
);
|
||||
const { value } = await client.queryAbci(`/cosmos.bank.v1beta1.Query/AllBalances`, requestData);
|
||||
const response = QueryAllBalancesResponse.decode(value);
|
||||
expect(response.balances.length).toEqual(2);
|
||||
|
||||
tmClient.disconnect();
|
||||
});
|
||||
|
||||
it("works via http", async () => {
|
||||
pendingWithoutSimapp();
|
||||
const [client, tmClient] = await makeClient(simapp.tendermintUrlHttp);
|
||||
|
||||
const requestData = Uint8Array.from(
|
||||
QueryAllBalancesRequest.encode({ address: unused.address }).finish(),
|
||||
);
|
||||
const { value } = await client.queryAbci(`/cosmos.bank.v1beta1.Query/AllBalances`, requestData);
|
||||
const response = QueryAllBalancesResponse.decode(value);
|
||||
expect(response.balances.length).toEqual(2);
|
||||
|
||||
tmClient.disconnect();
|
||||
});
|
||||
|
||||
it("works for height", async () => {
|
||||
pendingWithoutSimapp();
|
||||
const [queryClient, tmClient] = await makeClient(simapp.tendermintUrlHttp);
|
||||
|
||||
const joe = makeRandomAddress();
|
||||
const h1 = (await tmClient.status()).syncInfo.latestBlockHeight;
|
||||
|
||||
// Send tokens to `recipient`
|
||||
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic);
|
||||
const client = await SigningStargateClient.connectWithSigner(
|
||||
simapp.tendermintUrlHttp,
|
||||
wallet,
|
||||
defaultSigningClientOptions,
|
||||
);
|
||||
const amount = coin(332211, simapp.denomFee);
|
||||
await client.sendTokens(faucet.address0, joe, [amount], "auto");
|
||||
|
||||
const h2 = (await tmClient.status()).syncInfo.latestBlockHeight;
|
||||
assert(h1 < h2);
|
||||
|
||||
// Query with no height
|
||||
{
|
||||
const requestData = QueryBalanceRequest.encode({ address: joe, denom: simapp.denomFee }).finish();
|
||||
const { value, height } = await queryClient.queryAbci(
|
||||
`/cosmos.bank.v1beta1.Query/Balance`,
|
||||
requestData,
|
||||
);
|
||||
const response = QueryBalanceResponse.decode(value);
|
||||
expect(response.balance).toEqual(amount);
|
||||
expect(height).toEqual(h2);
|
||||
}
|
||||
|
||||
// Query at h2 (after send)
|
||||
{
|
||||
const requestData = QueryBalanceRequest.encode({ address: joe, denom: simapp.denomFee }).finish();
|
||||
const { value, height } = await queryClient.queryAbci(
|
||||
`/cosmos.bank.v1beta1.Query/Balance`,
|
||||
requestData,
|
||||
h2,
|
||||
);
|
||||
const response = QueryBalanceResponse.decode(value);
|
||||
expect(response.balance).toEqual(amount);
|
||||
expect(height).toEqual(h2);
|
||||
}
|
||||
|
||||
// Query at h1 (before send)
|
||||
{
|
||||
const requestData = QueryBalanceRequest.encode({ address: joe, denom: simapp.denomFee }).finish();
|
||||
const { value, height } = await queryClient.queryAbci(
|
||||
`/cosmos.bank.v1beta1.Query/Balance`,
|
||||
requestData,
|
||||
h1,
|
||||
);
|
||||
const response = QueryBalanceResponse.decode(value);
|
||||
expect(response.balance).toEqual({ amount: "0", denom: simapp.denomFee });
|
||||
expect(height).toEqual(h1);
|
||||
}
|
||||
|
||||
tmClient.disconnect();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -26,6 +26,16 @@ export interface ProvenQuery {
|
||||
readonly height: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* The response of an ABCI query to Tendermint.
|
||||
* This is a subset of `tendermint34.AbciQueryResponse` in order
|
||||
* to abstract away Tendermint versions.
|
||||
*/
|
||||
export interface QueryAbciResponse {
|
||||
readonly value: Uint8Array;
|
||||
readonly height: number;
|
||||
}
|
||||
|
||||
export class QueryClient {
|
||||
/** Constructs a QueryClient with 0 extensions */
|
||||
public static withExtensions(tmClient: Tendermint34Client): QueryClient;
|
||||
@@ -570,11 +580,32 @@ export class QueryClient {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an ABCI query to Tendermint without requesting a proof.
|
||||
*
|
||||
* @deprecated use queryAbci instead
|
||||
*/
|
||||
public async queryUnverified(
|
||||
path: string,
|
||||
request: Uint8Array,
|
||||
desiredHeight?: number,
|
||||
): Promise<Uint8Array> {
|
||||
const response = await this.queryAbci(path, request, desiredHeight);
|
||||
return response.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an ABCI query to Tendermint without requesting a proof.
|
||||
*
|
||||
* If the `desiredHeight` is set, a particular height is requested. Otherwise
|
||||
* the latest height is requested. The response contains the actual height of
|
||||
* the query.
|
||||
*/
|
||||
public async queryAbci(
|
||||
path: string,
|
||||
request: Uint8Array,
|
||||
desiredHeight?: number,
|
||||
): Promise<QueryAbciResponse> {
|
||||
const response = await this.tmClient.abciQuery({
|
||||
path: path,
|
||||
data: request,
|
||||
@@ -586,7 +617,14 @@ export class QueryClient {
|
||||
throw new Error(`Query failed with (${response.code}): ${response.log}`);
|
||||
}
|
||||
|
||||
return response.value;
|
||||
if (!response.height) {
|
||||
throw new Error("No query height returned");
|
||||
}
|
||||
|
||||
return {
|
||||
value: response.value,
|
||||
height: response.height,
|
||||
};
|
||||
}
|
||||
|
||||
// this must return the header for height+1
|
||||
|
||||
@@ -31,9 +31,10 @@ export interface ProtobufRpcClient {
|
||||
|
||||
export function createProtobufRpcClient(base: QueryClient): ProtobufRpcClient {
|
||||
return {
|
||||
request: (service: string, method: string, data: Uint8Array): Promise<Uint8Array> => {
|
||||
request: async (service: string, method: string, data: Uint8Array): Promise<Uint8Array> => {
|
||||
const path = `/${service}/${method}`;
|
||||
return base.queryUnverified(path, data);
|
||||
const response = await base.queryAbci(path, data, undefined);
|
||||
return response.value;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/stream",
|
||||
"version": "0.29.3",
|
||||
"version": "0.29.4",
|
||||
"description": "Utility functions for producing and consuming streams",
|
||||
"contributors": [
|
||||
"IOV SAS <admin@iov.one>",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/tendermint-rpc",
|
||||
"version": "0.29.3",
|
||||
"version": "0.29.4",
|
||||
"description": "Tendermint RPC clients",
|
||||
"contributors": [
|
||||
"IOV SAS <admin@iov.one>",
|
||||
|
||||
@@ -12,11 +12,17 @@ export {
|
||||
toRfc3339WithNanoseconds,
|
||||
toSeconds,
|
||||
} from "./dates";
|
||||
// The public Tendermint34Client.create constructor allows manually choosing an RpcClient.
|
||||
// This is currently the only way to switch to the HttpBatchClient (which may become default at some point).
|
||||
// Due to this API, we make RPC client implementations public.
|
||||
export {
|
||||
// This type is part of the Tendermint34Client.connect API
|
||||
HttpEndpoint,
|
||||
HttpBatchClient,
|
||||
HttpBatchClientOptions,
|
||||
HttpClient,
|
||||
HttpEndpoint, // This type is part of the Tendermint34Client.connect API
|
||||
RpcClient, // Interface type in Tendermint34Client.create
|
||||
WebsocketClient,
|
||||
} from "./rpcclients";
|
||||
export { HttpClient, WebsocketClient } from "./rpcclients"; // TODO: Why do we export those outside of this package?
|
||||
export {
|
||||
AbciInfoRequest,
|
||||
AbciInfoResponse,
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { createJsonRpcRequest } from "../jsonrpc";
|
||||
import { defaultInstance, pendingWithoutTendermint } from "../testutil.spec";
|
||||
import { http } from "./http";
|
||||
|
||||
function pendingWithoutHttpServer(): void {
|
||||
if (!process.env.HTTPSERVER_ENABLED) {
|
||||
pending("Set HTTPSERVER_ENABLED to enable HTTP tests");
|
||||
}
|
||||
}
|
||||
|
||||
const tendermintUrl = defaultInstance.url;
|
||||
const echoUrl = "http://localhost:5555/echo_headers";
|
||||
|
||||
describe("http", () => {
|
||||
it("can send a health request", async () => {
|
||||
pendingWithoutTendermint();
|
||||
const response = await http("POST", `http://${tendermintUrl}`, undefined, createJsonRpcRequest("health"));
|
||||
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 () => {
|
||||
pendingWithoutHttpServer();
|
||||
// Without custom headers
|
||||
const response1 = await http("POST", echoUrl, undefined, createJsonRpcRequest("health"));
|
||||
expect(response1).toEqual({
|
||||
request_headers: jasmine.objectContaining({
|
||||
// Basic headers from http client
|
||||
Accept: jasmine.any(String),
|
||||
"Content-Length": jasmine.any(String),
|
||||
"Content-Type": "application/json",
|
||||
Host: jasmine.any(String),
|
||||
"User-Agent": jasmine.any(String),
|
||||
}),
|
||||
});
|
||||
|
||||
// With custom headers
|
||||
const response2 = await http(
|
||||
"POST",
|
||||
echoUrl,
|
||||
{ foo: "bar123", Authorization: "Basic Z3Vlc3Q6bm9QYXNzMTIz" },
|
||||
createJsonRpcRequest("health"),
|
||||
);
|
||||
expect(response2).toEqual({
|
||||
request_headers: jasmine.objectContaining({
|
||||
// Basic headers from http client
|
||||
"Content-Length": jasmine.any(String),
|
||||
"Content-Type": "application/json",
|
||||
Host: jasmine.any(String),
|
||||
"User-Agent": jasmine.any(String),
|
||||
// Custom headers
|
||||
foo: "bar123",
|
||||
Authorization: "Basic Z3Vlc3Q6bm9QYXNzMTIz",
|
||||
}),
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,44 @@
|
||||
import axios from "axios";
|
||||
|
||||
// Global symbols in some environments
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch
|
||||
declare const fetch: any | undefined;
|
||||
|
||||
function filterBadStatus(res: any): any {
|
||||
if (res.status >= 400) {
|
||||
throw new Error(`Bad status on response: ${res.status}`);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to work around missing CORS support in Tendermint (https://github.com/tendermint/tendermint/pull/2800)
|
||||
*
|
||||
* For some reason, fetch does not complain about missing server-side CORS support.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
export async function http(
|
||||
method: "POST",
|
||||
url: string,
|
||||
headers: Record<string, string> | undefined,
|
||||
request?: any,
|
||||
): Promise<any> {
|
||||
if (typeof fetch !== "undefined") {
|
||||
const settings = {
|
||||
method: method,
|
||||
body: request ? JSON.stringify(request) : undefined,
|
||||
headers: {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
"Content-Type": "application/json",
|
||||
...headers,
|
||||
},
|
||||
};
|
||||
return fetch(url, settings)
|
||||
.then(filterBadStatus)
|
||||
.then((res: any) => res.json());
|
||||
} else {
|
||||
return axios
|
||||
.request({ url: url, method: method, data: request, headers: headers })
|
||||
.then((res) => res.data);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
import { createJsonRpcRequest } from "../jsonrpc";
|
||||
import { defaultInstance } from "../testutil.spec";
|
||||
import { HttpBatchClient } from "./httpbatchclient";
|
||||
import { http } from "./httpclient";
|
||||
|
||||
function pendingWithoutTendermint(): void {
|
||||
if (!process.env.TENDERMINT_ENABLED) {
|
||||
@@ -10,64 +9,7 @@ function pendingWithoutTendermint(): void {
|
||||
}
|
||||
}
|
||||
|
||||
function pendingWithoutHttpServer(): void {
|
||||
if (!process.env.HTTPSERVER_ENABLED) {
|
||||
pending("Set HTTPSERVER_ENABLED to enable HTTP tests");
|
||||
}
|
||||
}
|
||||
|
||||
const tendermintUrl = defaultInstance.url;
|
||||
const echoUrl = "http://localhost:5555/echo_headers";
|
||||
|
||||
describe("http", () => {
|
||||
it("can send a health request", async () => {
|
||||
pendingWithoutTendermint();
|
||||
const response = await http("POST", `http://${tendermintUrl}`, undefined, createJsonRpcRequest("health"));
|
||||
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 () => {
|
||||
pendingWithoutHttpServer();
|
||||
// Without custom headers
|
||||
const response1 = await http("POST", echoUrl, undefined, createJsonRpcRequest("health"));
|
||||
expect(response1).toEqual({
|
||||
request_headers: jasmine.objectContaining({
|
||||
// Basic headers from http client
|
||||
Accept: jasmine.any(String),
|
||||
"Content-Length": jasmine.any(String),
|
||||
"Content-Type": "application/json",
|
||||
Host: jasmine.any(String),
|
||||
"User-Agent": jasmine.any(String),
|
||||
}),
|
||||
});
|
||||
|
||||
// With custom headers
|
||||
const response2 = await http(
|
||||
"POST",
|
||||
echoUrl,
|
||||
{ foo: "bar123", Authorization: "Basic Z3Vlc3Q6bm9QYXNzMTIz" },
|
||||
createJsonRpcRequest("health"),
|
||||
);
|
||||
expect(response2).toEqual({
|
||||
request_headers: jasmine.objectContaining({
|
||||
// Basic headers from http client
|
||||
"Content-Length": jasmine.any(String),
|
||||
"Content-Type": "application/json",
|
||||
Host: jasmine.any(String),
|
||||
"User-Agent": jasmine.any(String),
|
||||
// Custom headers
|
||||
foo: "bar123",
|
||||
Authorization: "Basic Z3Vlc3Q6bm9QYXNzMTIz",
|
||||
}),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("HttpBatchClient", () => {
|
||||
it("can make a simple call", async () => {
|
||||
@@ -88,4 +30,23 @@ describe("HttpBatchClient", () => {
|
||||
|
||||
client.disconnect();
|
||||
});
|
||||
|
||||
it("dispatches requests as soon as batch size limit is reached", async () => {
|
||||
pendingWithoutTendermint();
|
||||
const client = new HttpBatchClient(tendermintUrl, {
|
||||
dispatchInterval: 3600_000 /* 1h to make test time out if this is not working */,
|
||||
batchSizeLimit: 3,
|
||||
});
|
||||
|
||||
const healthResponse = await Promise.all([
|
||||
client.execute(createJsonRpcRequest("health")),
|
||||
client.execute(createJsonRpcRequest("health")),
|
||||
client.execute(createJsonRpcRequest("health")),
|
||||
]);
|
||||
expect(healthResponse[0].result).toEqual({});
|
||||
expect(healthResponse[1].result).toEqual({});
|
||||
expect(healthResponse[2].result).toEqual({});
|
||||
|
||||
client.disconnect();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,15 +5,21 @@ import {
|
||||
parseJsonRpcResponse,
|
||||
} from "@cosmjs/json-rpc";
|
||||
|
||||
import { http, HttpEndpoint } from "./httpclient";
|
||||
import { http } from "./http";
|
||||
import { HttpEndpoint } from "./httpclient";
|
||||
import { hasProtocol, RpcClient } from "./rpcclient";
|
||||
|
||||
export interface HttpBatchClientOptions {
|
||||
/** Interval for dispatching batches (in milliseconds) */
|
||||
dispatchInterval: number;
|
||||
/** Max number of items sent in one request */
|
||||
batchSizeLimit: number;
|
||||
}
|
||||
|
||||
export const defaultHttpBatchClientOptions: HttpBatchClientOptions = {
|
||||
// Those values are private and can change any time.
|
||||
// Does a user need to know them? I don't think so. You either set
|
||||
// a custom value or leave the option field unset.
|
||||
const defaultHttpBatchClientOptions: HttpBatchClientOptions = {
|
||||
dispatchInterval: 20,
|
||||
batchSizeLimit: 20,
|
||||
};
|
||||
@@ -30,11 +36,11 @@ export class HttpBatchClient implements RpcClient {
|
||||
reject: (a: Error) => void;
|
||||
}> = [];
|
||||
|
||||
public constructor(
|
||||
endpoint: string | HttpEndpoint,
|
||||
options: HttpBatchClientOptions = defaultHttpBatchClientOptions,
|
||||
) {
|
||||
this.options = options;
|
||||
public constructor(endpoint: string | HttpEndpoint, options: Partial<HttpBatchClientOptions> = {}) {
|
||||
this.options = {
|
||||
batchSizeLimit: options.batchSizeLimit ?? defaultHttpBatchClientOptions.batchSizeLimit,
|
||||
dispatchInterval: options.dispatchInterval ?? defaultHttpBatchClientOptions.dispatchInterval,
|
||||
};
|
||||
if (typeof endpoint === "string") {
|
||||
// accept host.name:port and assume http protocol
|
||||
this.url = hasProtocol(endpoint) ? endpoint : "http://" + endpoint;
|
||||
@@ -54,6 +60,11 @@ export class HttpBatchClient implements RpcClient {
|
||||
public async execute(request: JsonRpcRequest): Promise<JsonRpcSuccessResponse> {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.queue.push({ request, resolve, reject });
|
||||
|
||||
if (this.queue.length >= this.options.batchSizeLimit) {
|
||||
// this train is full, let's go
|
||||
this.tick();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -67,27 +78,43 @@ export class HttpBatchClient implements RpcClient {
|
||||
}
|
||||
}
|
||||
|
||||
private async tick(): Promise<void> {
|
||||
/**
|
||||
* This is called in an interval where promise rejections cannot be handled.
|
||||
* So this is not async and HTTP errors need to be handled by the queued promises.
|
||||
*/
|
||||
private tick(): void {
|
||||
// Avoid race conditions
|
||||
const queue = this.queue.splice(0, this.options.batchSizeLimit);
|
||||
const batch = this.queue.splice(0, this.options.batchSizeLimit);
|
||||
|
||||
if (!queue.length) return;
|
||||
if (!batch.length) return;
|
||||
|
||||
const request = queue.map((s) => s.request);
|
||||
const raw = await http("POST", this.url, this.headers, request);
|
||||
// Requests with a single entry return as an object
|
||||
const arr = Array.isArray(raw) ? raw : [raw];
|
||||
const requests = batch.map((s) => s.request);
|
||||
const requestIds = requests.map((request) => request.id);
|
||||
|
||||
arr.forEach((el) => {
|
||||
const req = queue.find((s) => s.request.id === el.id);
|
||||
if (!req) return;
|
||||
const { reject, resolve } = req;
|
||||
const response = parseJsonRpcResponse(el);
|
||||
if (isJsonRpcErrorResponse(response)) {
|
||||
reject(new Error(JSON.stringify(response.error)));
|
||||
} else {
|
||||
resolve(response);
|
||||
}
|
||||
});
|
||||
http("POST", this.url, this.headers, requests).then(
|
||||
(raw) => {
|
||||
// Requests with a single entry return as an object
|
||||
const arr = Array.isArray(raw) ? raw : [raw];
|
||||
|
||||
arr.forEach((el) => {
|
||||
const req = batch.find((s) => s.request.id === el.id);
|
||||
if (!req) return;
|
||||
const { reject, resolve } = req;
|
||||
const response = parseJsonRpcResponse(el);
|
||||
if (isJsonRpcErrorResponse(response)) {
|
||||
reject(new Error(JSON.stringify(response.error)));
|
||||
} else {
|
||||
resolve(response);
|
||||
}
|
||||
});
|
||||
},
|
||||
(error) => {
|
||||
for (const requestId of requestIds) {
|
||||
const req = batch.find((s) => s.request.id === requestId);
|
||||
if (!req) return;
|
||||
req.reject(error);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { createJsonRpcRequest } from "../jsonrpc";
|
||||
import { defaultInstance } from "../testutil.spec";
|
||||
import { http, HttpClient } from "./httpclient";
|
||||
import { HttpClient } from "./httpclient";
|
||||
|
||||
function pendingWithoutTendermint(): void {
|
||||
if (!process.env.TENDERMINT_ENABLED) {
|
||||
@@ -9,64 +8,7 @@ function pendingWithoutTendermint(): void {
|
||||
}
|
||||
}
|
||||
|
||||
function pendingWithoutHttpServer(): void {
|
||||
if (!process.env.HTTPSERVER_ENABLED) {
|
||||
pending("Set HTTPSERVER_ENABLED to enable HTTP tests");
|
||||
}
|
||||
}
|
||||
|
||||
const tendermintUrl = defaultInstance.url;
|
||||
const echoUrl = "http://localhost:5555/echo_headers";
|
||||
|
||||
describe("http", () => {
|
||||
it("can send a health request", async () => {
|
||||
pendingWithoutTendermint();
|
||||
const response = await http("POST", `http://${tendermintUrl}`, undefined, createJsonRpcRequest("health"));
|
||||
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 () => {
|
||||
pendingWithoutHttpServer();
|
||||
// Without custom headers
|
||||
const response1 = await http("POST", echoUrl, undefined, createJsonRpcRequest("health"));
|
||||
expect(response1).toEqual({
|
||||
request_headers: jasmine.objectContaining({
|
||||
// Basic headers from http client
|
||||
Accept: jasmine.any(String),
|
||||
"Content-Length": jasmine.any(String),
|
||||
"Content-Type": "application/json",
|
||||
Host: jasmine.any(String),
|
||||
"User-Agent": jasmine.any(String),
|
||||
}),
|
||||
});
|
||||
|
||||
// With custom headers
|
||||
const response2 = await http(
|
||||
"POST",
|
||||
echoUrl,
|
||||
{ foo: "bar123", Authorization: "Basic Z3Vlc3Q6bm9QYXNzMTIz" },
|
||||
createJsonRpcRequest("health"),
|
||||
);
|
||||
expect(response2).toEqual({
|
||||
request_headers: jasmine.objectContaining({
|
||||
// Basic headers from http client
|
||||
"Content-Length": jasmine.any(String),
|
||||
"Content-Type": "application/json",
|
||||
Host: jasmine.any(String),
|
||||
"User-Agent": jasmine.any(String),
|
||||
// Custom headers
|
||||
foo: "bar123",
|
||||
Authorization: "Basic Z3Vlc3Q6bm9QYXNzMTIz",
|
||||
}),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("HttpClient", () => {
|
||||
it("can make a simple call", async () => {
|
||||
|
||||
@@ -4,53 +4,10 @@ import {
|
||||
JsonRpcSuccessResponse,
|
||||
parseJsonRpcResponse,
|
||||
} from "@cosmjs/json-rpc";
|
||||
import axios from "axios";
|
||||
|
||||
import { http } from "./http";
|
||||
import { hasProtocol, RpcClient } from "./rpcclient";
|
||||
|
||||
// Global symbols in some environments
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch
|
||||
declare const fetch: any | undefined;
|
||||
|
||||
function filterBadStatus(res: any): any {
|
||||
if (res.status >= 400) {
|
||||
throw new Error(`Bad status on response: ${res.status}`);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to work around missing CORS support in Tendermint (https://github.com/tendermint/tendermint/pull/2800)
|
||||
*
|
||||
* For some reason, fetch does not complain about missing server-side CORS support.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
export async function http(
|
||||
method: "POST",
|
||||
url: string,
|
||||
headers: Record<string, string> | undefined,
|
||||
request?: any,
|
||||
): Promise<any> {
|
||||
if (typeof fetch !== "undefined") {
|
||||
const settings = {
|
||||
method: method,
|
||||
body: request ? JSON.stringify(request) : undefined,
|
||||
headers: {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
"Content-Type": "application/json",
|
||||
...headers,
|
||||
},
|
||||
};
|
||||
return fetch(url, settings)
|
||||
.then(filterBadStatus)
|
||||
.then((res: any) => res.json());
|
||||
} else {
|
||||
return axios
|
||||
.request({ url: url, method: method, data: request, headers: headers })
|
||||
.then((res) => res.data);
|
||||
}
|
||||
}
|
||||
|
||||
export interface HttpEndpoint {
|
||||
/**
|
||||
* The URL of the HTTP endpoint.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This folder contains Tendermint-specific RPC clients
|
||||
|
||||
export { defaultHttpBatchClientOptions, HttpBatchClient } from "./httpbatchclient";
|
||||
export { HttpBatchClient, HttpBatchClientOptions } from "./httpbatchclient";
|
||||
export { HttpClient, HttpEndpoint } from "./httpclient";
|
||||
export { instanceOfRpcStreamingClient, RpcClient, RpcStreamingClient, SubscriptionEvent } from "./rpcclient";
|
||||
export { WebsocketClient } from "./websocketclient";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/utils",
|
||||
"version": "0.29.3",
|
||||
"version": "0.29.4",
|
||||
"description": "Utility tools, primarily for testing code",
|
||||
"contributors": [
|
||||
"IOV SAS <admin@iov.one>"
|
||||
|
||||
@@ -450,7 +450,7 @@ __metadata:
|
||||
"@istanbuljs/nyc-config-typescript": ^1.0.1
|
||||
"@noble/hashes": ^1
|
||||
"@types/bn.js": ^5
|
||||
"@types/elliptic": ^6.4.12
|
||||
"@types/elliptic": ^6.4.14
|
||||
"@types/eslint-plugin-prettier": ^3
|
||||
"@types/jasmine": ^4
|
||||
"@types/karma-firefox-launcher": ^2
|
||||
@@ -462,7 +462,7 @@ __metadata:
|
||||
"@typescript-eslint/parser": ^5.13.0
|
||||
bn.js: ^5.2.0
|
||||
buffer: ^6.0.3
|
||||
elliptic: ^6.5.3
|
||||
elliptic: ^6.5.4
|
||||
eslint: ^7.5
|
||||
eslint-config-prettier: ^8.3.0
|
||||
eslint-import-resolver-node: ^0.3.4
|
||||
@@ -1341,10 +1341,10 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@socket.io/base64-arraybuffer@npm:~1.0.2":
|
||||
version: 1.0.2
|
||||
resolution: "@socket.io/base64-arraybuffer@npm:1.0.2"
|
||||
checksum: fa3e58c7581643d0557969cd3bece20e198596df77968ff29ede6be329d488e65104bef900e68a67f39d8855abfa59baa2b08d96fb856504bd01cbdd8f52249c
|
||||
"@socket.io/component-emitter@npm:~3.1.0":
|
||||
version: 3.1.0
|
||||
resolution: "@socket.io/component-emitter@npm:3.1.0"
|
||||
checksum: db069d95425b419de1514dffe945cc439795f6a8ef5b9465715acf5b8b50798e2c91b8719cbf5434b3fe7de179d6cdcd503c277b7871cb3dd03febb69bdd50fa
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -1406,13 +1406,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/component-emitter@npm:^1.2.10":
|
||||
version: 1.2.10
|
||||
resolution: "@types/component-emitter@npm:1.2.10"
|
||||
checksum: 7589d3a10ef4e1c60f415db0d7ad90680c2d60b589972d198c19ba092f06559988dde501f83c0293e945fe19b989ef2334da07802b802d1a9846b0dde7a34ab1
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/connect@npm:*":
|
||||
version: 3.4.34
|
||||
resolution: "@types/connect@npm:3.4.34"
|
||||
@@ -1462,12 +1455,12 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/elliptic@npm:^6.4.12":
|
||||
version: 6.4.12
|
||||
resolution: "@types/elliptic@npm:6.4.12"
|
||||
"@types/elliptic@npm:^6.4.14":
|
||||
version: 6.4.14
|
||||
resolution: "@types/elliptic@npm:6.4.14"
|
||||
dependencies:
|
||||
"@types/bn.js": "*"
|
||||
checksum: 35dc3b6b4ba411b2e2ca2dfead45034d1411f5062183ec49270a693b7f2bdff27e3538aae8773a7fce2d04084018a28bacc8a442f578f594fad11431242d87aa
|
||||
checksum: d5a64f540e0ed4b74a12dfa5cc88c0aa7b531eab3b7a9fab17948ffbfc6e01814230e63d7417ce1b607dbd8b5d70e1b64f5afac632deabf96e44875aaac0ae1b
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -2818,13 +2811,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"component-emitter@npm:~1.3.0":
|
||||
version: 1.3.0
|
||||
resolution: "component-emitter@npm:1.3.0"
|
||||
checksum: b3c46de38ffd35c57d1c02488355be9f218e582aec72d72d1b8bbec95a3ac1b38c96cd6e03ff015577e68f550fbb361a3bfdbd9bb248be9390b7b3745691be6b
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"concat-map@npm:0.0.1":
|
||||
version: 0.0.1
|
||||
resolution: "concat-map@npm:0.0.1"
|
||||
@@ -3167,7 +3153,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"elliptic@npm:^6.5.3":
|
||||
"elliptic@npm:^6.5.4":
|
||||
version: 6.5.4
|
||||
resolution: "elliptic@npm:6.5.4"
|
||||
dependencies:
|
||||
@@ -3214,18 +3200,16 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"engine.io-parser@npm:~5.0.0":
|
||||
version: 5.0.3
|
||||
resolution: "engine.io-parser@npm:5.0.3"
|
||||
dependencies:
|
||||
"@socket.io/base64-arraybuffer": ~1.0.2
|
||||
checksum: 88d664420a441dd02db17d110f7bbbd9efe971747918150bf666b82ee138df596a2f5038f461c8a01864c83af67cb202548364e4174543f8c0bf5f4776ca6e0d
|
||||
"engine.io-parser@npm:~5.0.3":
|
||||
version: 5.0.4
|
||||
resolution: "engine.io-parser@npm:5.0.4"
|
||||
checksum: d4ad0cef6ff63c350e35696da9bb3dbd180f67b56e93e90375010cc40393e6c0639b780d5680807e1d93a7e2e3d7b4a1c3b27cf75db28eb8cbf605bc1497da03
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"engine.io@npm:~6.1.0":
|
||||
version: 6.1.2
|
||||
resolution: "engine.io@npm:6.1.2"
|
||||
"engine.io@npm:~6.2.0":
|
||||
version: 6.2.0
|
||||
resolution: "engine.io@npm:6.2.0"
|
||||
dependencies:
|
||||
"@types/cookie": ^0.4.1
|
||||
"@types/cors": ^2.8.12
|
||||
@@ -3235,9 +3219,9 @@ __metadata:
|
||||
cookie: ~0.4.1
|
||||
cors: ~2.8.5
|
||||
debug: ~4.3.1
|
||||
engine.io-parser: ~5.0.0
|
||||
engine.io-parser: ~5.0.3
|
||||
ws: ~8.2.3
|
||||
checksum: bd98d6ce2b1e868e8ff0f65d7667a885b90bce62065d851ea0394a00c86686925be824ab91237151222d6a5acfd5610634f36966fa9b4c502e7cf362fbdf974a
|
||||
checksum: cc485c5ba2e0c4f6ca02dcafd192b22f9dad89d01dc815005298780d3fb910db4cebab4696e8615290c473c2eeb259e8bee2a1fb7ab594d9c80f9f3485771911
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -6634,35 +6618,34 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"socket.io-adapter@npm:~2.3.3":
|
||||
version: 2.3.3
|
||||
resolution: "socket.io-adapter@npm:2.3.3"
|
||||
checksum: 73890e0a33e48a9e4be83e5fa2b8ea9728d2a35ae2fed373cad4d6744c6512c0e1c735e7820df9821e58c4738dc355bdaec5aae30bc56f4d6a41d999596d0c82
|
||||
"socket.io-adapter@npm:~2.4.0":
|
||||
version: 2.4.0
|
||||
resolution: "socket.io-adapter@npm:2.4.0"
|
||||
checksum: a84639946dce13547b95f6e09fe167cdcd5d80941afc2e46790cc23384e0fd3c901e690ecc9bdd600939ce6292261ee15094a0b486f797ed621cfc8783d87a0c
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"socket.io-parser@npm:~4.0.4":
|
||||
version: 4.0.4
|
||||
resolution: "socket.io-parser@npm:4.0.4"
|
||||
"socket.io-parser@npm:~4.2.0":
|
||||
version: 4.2.1
|
||||
resolution: "socket.io-parser@npm:4.2.1"
|
||||
dependencies:
|
||||
"@types/component-emitter": ^1.2.10
|
||||
component-emitter: ~1.3.0
|
||||
"@socket.io/component-emitter": ~3.1.0
|
||||
debug: ~4.3.1
|
||||
checksum: c173b4f3747c51e2af802eca35212f4dcfa8fe55d7fdc07b9a01da1ecc956791c1bf6591e307952548eab69e6500bcfe27cea8aff1386b860d9bb51f98e4fafb
|
||||
checksum: 2582202f22538d7e6b4436991378cb4cea3b2f8219cda24923ae35afd291ab5ad6120e7d093e41738256b6c6ad10c667dd25753c2d9a2340fead04e9286f152d
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"socket.io@npm:^4.2.0":
|
||||
version: 4.4.1
|
||||
resolution: "socket.io@npm:4.4.1"
|
||||
version: 4.5.3
|
||||
resolution: "socket.io@npm:4.5.3"
|
||||
dependencies:
|
||||
accepts: ~1.3.4
|
||||
base64id: ~2.0.0
|
||||
debug: ~4.3.2
|
||||
engine.io: ~6.1.0
|
||||
socket.io-adapter: ~2.3.3
|
||||
socket.io-parser: ~4.0.4
|
||||
checksum: a559ae52359f1ca3ce5a347368cf985c72259e1ab1bf2bf769ca0add5db34e2a86f4e183a58f37f32676ec482c71fedb7b08d873dc31cf581f5ba0797a8382fe
|
||||
engine.io: ~6.2.0
|
||||
socket.io-adapter: ~2.4.0
|
||||
socket.io-parser: ~4.2.0
|
||||
checksum: 2a7e4c64bbebb444d211bc66fb8356c14dd0fd4138d31e1781db03fa5a731a3abb7b305fa32cb6c7b57e5ac788601583aad14bea6ff9b8c4ca7b74118ba55f66
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
||||
Reference in New Issue
Block a user