Merge branch 'main' into custom-ledger-app-simon
This commit is contained in:
commit
2906dac731
@ -1,4 +1,8 @@
|
||||
version: 2
|
||||
version: 2.1
|
||||
|
||||
orbs:
|
||||
browser-tools: circleci/browser-tools@1.2.2
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
workflow:
|
||||
@ -22,7 +26,7 @@ workflows:
|
||||
- test:
|
||||
requires:
|
||||
- build
|
||||
- test-node-v12:
|
||||
- test-node-v14:
|
||||
requires:
|
||||
- build
|
||||
- test-chrome:
|
||||
@ -65,7 +69,7 @@ jobs:
|
||||
# executor in local jobs." (https://circleci.com/docs/2.0/local-cli/#limitations-of-running-jobs-locally)
|
||||
#
|
||||
# Available images: https://circleci.com/docs/2.0/configuration-reference/#available-machine-images
|
||||
image: ubuntu-2004:202010-01
|
||||
image: ubuntu-2004:202107-02
|
||||
steps:
|
||||
- run:
|
||||
name: Install Git Large File Storage (LFS)
|
||||
@ -100,10 +104,12 @@ jobs:
|
||||
name: Merge build folders into project (merge with hardlinks)
|
||||
command: cp --recursive --link /tmp/builds/* .
|
||||
- run:
|
||||
# The images ubuntu-1604 comes with preinstalled nvm, which does not work well with non-login shells
|
||||
# The images comes with preinstalled nvm, which does not work well with non-login shells
|
||||
name: Uninstall nvm
|
||||
# Moving to trash is faster than deleting (gvfs-trash is not installed on this image)
|
||||
command: mkdir -p ~/.local/share/Trash && mv "$NVM_DIR" ~/.npm ~/.local/share/Trash
|
||||
command: |
|
||||
nvm --version && nvm ls
|
||||
mkdir -p ~/.local/share/Trash && mv "$NVM_DIR" ~/.npm ~/.local/share/Trash
|
||||
- run:
|
||||
name: Install nodejs
|
||||
# In the current image, `sudo apt install nodejs` requires `sudo apt update` which is too slow
|
||||
@ -113,7 +119,7 @@ jobs:
|
||||
- run:
|
||||
name: Install yarn
|
||||
command: |
|
||||
wget -O "$HOME/yarn.deb" https://dl.yarnpkg.com/debian/pool/main/y/yarn/yarn_1.22.4_all.deb
|
||||
wget -O "$HOME/yarn.deb" https://dl.yarnpkg.com/debian/pool/main/y/yarn/yarn_1.22.15_all.deb
|
||||
sudo dpkg -i "$HOME/yarn.deb"
|
||||
- run:
|
||||
name: Version information
|
||||
@ -174,7 +180,7 @@ jobs:
|
||||
./scripts/simapp/slow_stop.sh
|
||||
./scripts/wasmd/stop.sh
|
||||
./scripts/launchpad/stop.sh
|
||||
test-node-v12:
|
||||
test-node-v14:
|
||||
machine:
|
||||
# We can't use a containerized environment since it requires remote docker to start custom containers.
|
||||
# However, we can't access the remote docker's network from the primary container. This is a
|
||||
@ -183,7 +189,7 @@ jobs:
|
||||
# executor in local jobs." (https://circleci.com/docs/2.0/local-cli/#limitations-of-running-jobs-locally)
|
||||
#
|
||||
# Available images: https://circleci.com/docs/2.0/configuration-reference/#available-machine-images
|
||||
image: ubuntu-2004:202010-01
|
||||
image: ubuntu-2004:202107-02
|
||||
steps:
|
||||
- run:
|
||||
name: Install Git Large File Storage (LFS)
|
||||
@ -218,20 +224,22 @@ jobs:
|
||||
name: Merge build folders into project (merge with hardlinks)
|
||||
command: cp --recursive --link /tmp/builds/* .
|
||||
- run:
|
||||
# The images ubuntu-1604 comes with preinstalled nvm, which does not work well with non-login shells
|
||||
# The images comes with preinstalled nvm, which does not work well with non-login shells
|
||||
name: Uninstall nvm
|
||||
# Moving to trash is faster than deleting (gvfs-trash is not installed on this image)
|
||||
command: mkdir -p ~/.local/share/Trash && mv "$NVM_DIR" ~/.npm ~/.local/share/Trash
|
||||
command: |
|
||||
nvm --version && nvm ls
|
||||
mkdir -p ~/.local/share/Trash && mv "$NVM_DIR" ~/.npm ~/.local/share/Trash
|
||||
- run:
|
||||
name: Install nodejs
|
||||
# In the current image, `sudo apt install nodejs` requires `sudo apt update` which is too slow
|
||||
command: |
|
||||
wget -O "$HOME/nodejs.deb" https://deb.nodesource.com/node_12.x/pool/main/n/nodejs/nodejs_12.20.1-deb-1nodesource1_amd64.deb
|
||||
wget -O "$HOME/nodejs.deb" https://deb.nodesource.com/node_14.x/pool/main/n/nodejs/nodejs_14.18.0-deb-1nodesource1_amd64.deb
|
||||
sudo dpkg -i "$HOME/nodejs.deb"
|
||||
- run:
|
||||
name: Install yarn
|
||||
command: |
|
||||
wget -O "$HOME/yarn.deb" https://dl.yarnpkg.com/debian/pool/main/y/yarn/yarn_1.22.4_all.deb
|
||||
wget -O "$HOME/yarn.deb" https://dl.yarnpkg.com/debian/pool/main/y/yarn/yarn_1.22.15_all.deb
|
||||
sudo dpkg -i "$HOME/yarn.deb"
|
||||
- run:
|
||||
name: Version information
|
||||
@ -296,8 +304,9 @@ jobs:
|
||||
# executor in local jobs." (https://circleci.com/docs/2.0/local-cli/#limitations-of-running-jobs-locally)
|
||||
#
|
||||
# Available images: https://circleci.com/docs/2.0/configuration-reference/#available-machine-images
|
||||
image: ubuntu-2004:202010-01
|
||||
image: ubuntu-2004:202107-02
|
||||
steps:
|
||||
- browser-tools/install-chrome # Slow because apt update but what can you do 🤷
|
||||
- run:
|
||||
name: Install Git Large File Storage (LFS)
|
||||
# In the current image, `sudo apt install git-lfs` requires `sudo apt update` which is too slow
|
||||
@ -331,10 +340,12 @@ jobs:
|
||||
name: Merge build folders into project (merge with hardlinks)
|
||||
command: cp --recursive --link /tmp/builds/* .
|
||||
- run:
|
||||
# The images ubuntu-1604 comes with preinstalled nvm, which does not work well with non-login shells
|
||||
# The images comes with preinstalled nvm, which does not work well with non-login shells
|
||||
name: Uninstall nvm
|
||||
# Moving to trash is faster than deleting (gvfs-trash is not installed on this image)
|
||||
command: mkdir -p ~/.local/share/Trash && mv "$NVM_DIR" ~/.npm ~/.local/share/Trash
|
||||
command: |
|
||||
nvm --version && nvm ls
|
||||
mkdir -p ~/.local/share/Trash && mv "$NVM_DIR" ~/.npm ~/.local/share/Trash
|
||||
- run:
|
||||
name: Install nodejs
|
||||
# In the current image, `sudo apt install nodejs` requires `sudo apt update` which is too slow
|
||||
@ -344,7 +355,7 @@ jobs:
|
||||
- run:
|
||||
name: Install yarn
|
||||
command: |
|
||||
wget -O "$HOME/yarn.deb" https://dl.yarnpkg.com/debian/pool/main/y/yarn/yarn_1.22.4_all.deb
|
||||
wget -O "$HOME/yarn.deb" https://dl.yarnpkg.com/debian/pool/main/y/yarn/yarn_1.22.15_all.deb
|
||||
sudo dpkg -i "$HOME/yarn.deb"
|
||||
- run:
|
||||
name: Version information
|
||||
@ -396,7 +407,7 @@ jobs:
|
||||
# executor in local jobs." (https://circleci.com/docs/2.0/local-cli/#limitations-of-running-jobs-locally)
|
||||
#
|
||||
# Available images: https://circleci.com/docs/2.0/configuration-reference/#available-machine-images
|
||||
image: ubuntu-2004:202010-01
|
||||
image: ubuntu-2004:202107-02
|
||||
steps:
|
||||
- run:
|
||||
name: Install Git Large File Storage (LFS)
|
||||
@ -431,10 +442,12 @@ jobs:
|
||||
name: Merge build folders into project (merge with hardlinks)
|
||||
command: cp --recursive --link /tmp/builds/* .
|
||||
- run:
|
||||
# The images ubuntu-1604 comes with preinstalled nvm, which does not work well with non-login shells
|
||||
# The images comes with preinstalled nvm, which does not work well with non-login shells
|
||||
name: Uninstall nvm
|
||||
# Moving to trash is faster than deleting (gvfs-trash is not installed on this image)
|
||||
command: mkdir -p ~/.local/share/Trash && mv "$NVM_DIR" ~/.npm ~/.local/share/Trash
|
||||
command: |
|
||||
nvm --version && nvm ls
|
||||
mkdir -p ~/.local/share/Trash && mv "$NVM_DIR" ~/.npm ~/.local/share/Trash
|
||||
- run:
|
||||
name: Install nodejs
|
||||
# In the current image, `sudo apt install nodejs` requires `sudo apt update` which is too slow
|
||||
@ -444,7 +457,7 @@ jobs:
|
||||
- run:
|
||||
name: Install yarn
|
||||
command: |
|
||||
wget -O "$HOME/yarn.deb" https://dl.yarnpkg.com/debian/pool/main/y/yarn/yarn_1.22.4_all.deb
|
||||
wget -O "$HOME/yarn.deb" https://dl.yarnpkg.com/debian/pool/main/y/yarn/yarn_1.22.15_all.deb
|
||||
sudo dpkg -i "$HOME/yarn.deb"
|
||||
- run:
|
||||
name: Version information
|
||||
|
||||
14
CHANGELOG.md
14
CHANGELOG.md
@ -6,6 +6,17 @@ and this project adheres to
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.26.2] - 2021-10-12
|
||||
|
||||
### Fixed
|
||||
|
||||
- @cosmjs/stargate: remove extra space in messageTimeout registry.
|
||||
- @cosmjs/cosmwasm-stargate: Fix Amino JSON representation of
|
||||
`MsgInstantiateContract`, `MsgMigrateContract` and `MsgExecuteContract` to
|
||||
match the wasmd expectation. This was broken since the wasmd upgrade to
|
||||
Stargate such that no Ledger signing was possible for those message types in
|
||||
the meantime.
|
||||
|
||||
## [0.26.1] - 2021-09-30
|
||||
|
||||
### Added
|
||||
@ -591,7 +602,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.26.1...HEAD
|
||||
[unreleased]: https://github.com/cosmos/cosmjs/compare/v0.26.2...HEAD
|
||||
[0.26.2]: https://github.com/cosmos/cosmjs/compare/v0.26.1...v0.26.2
|
||||
[0.26.1]: https://github.com/cosmos/cosmjs/compare/v0.26.0...v0.26.1
|
||||
[0.26.0]: https://github.com/cosmos/cosmjs/compare/v0.25.6...v0.26.0
|
||||
[0.25.6]: https://github.com/cosmos/cosmjs/compare/v0.25.5...v0.25.6
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/amino",
|
||||
"version": "0.26.1",
|
||||
"version": "0.26.2",
|
||||
"description": "Helpers for Amino based signing which are shared between @cosmjs/launchpad and @cosmjs/stargate.",
|
||||
"contributors": [
|
||||
"Simon Warta <webmaster128@users.noreply.github.com>"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/cli",
|
||||
"version": "0.26.1",
|
||||
"version": "0.26.2",
|
||||
"description": "Command line interface",
|
||||
"contributors": [
|
||||
"IOV SAS <admin@iov.one>",
|
||||
|
||||
@ -6,11 +6,11 @@ An SDK to build CosmWasm clients.
|
||||
|
||||
## Compatibility
|
||||
|
||||
| CosmWasm | x/wasm | @cosmjs/cosmwasm-stargate |
|
||||
| -------- | --------- | ------------------------- |
|
||||
| 0.16 | 0.18 | `^0.26.0` |
|
||||
| 0.14 | 0.16 | `^0.25.0` |
|
||||
| 0.13 | 0.14-0.15 | `^0.24.0` |
|
||||
| CosmWasm | x/wasm | @cosmjs/cosmwasm-stargate |
|
||||
| --------------- | --------- | ------------------------- |
|
||||
| 0.16-1.0.0-beta | 0.18-0.20 | `^0.26.0` |
|
||||
| 0.14 | 0.16 | `^0.25.0` |
|
||||
| 0.13 | 0.14-0.15 | `^0.24.0` |
|
||||
|
||||
## Development
|
||||
|
||||
@ -18,7 +18,7 @@ Updating Hackatom development contract in `src/testdata/contract.json`:
|
||||
|
||||
```sh
|
||||
cd packages/cosmwasm-stargate
|
||||
export HACKATOM_URL=https://github.com/CosmWasm/cosmwasm/releases/download/v0.14.0/hackatom.wasm
|
||||
export HACKATOM_URL=https://github.com/CosmWasm/cosmwasm/releases/download/v1.0.0-beta/hackatom.wasm
|
||||
echo "{\"// source\": \"$HACKATOM_URL\", \"data\": \"$(curl -sS --location $HACKATOM_URL | base64 | tr -d '[:space:]')\" }" | jq > src/testdata/contract.json
|
||||
```
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/cosmwasm-stargate",
|
||||
"version": "0.26.1",
|
||||
"version": "0.26.2",
|
||||
"description": "CosmWasm SDK",
|
||||
"contributors": [
|
||||
"Will Clark <willclarktech@users.noreply.github.com>"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { fromBase64, toUtf8 } from "@cosmjs/encoding";
|
||||
import { fromBase64, toBase64, toUtf8 } from "@cosmjs/encoding";
|
||||
import { AminoTypes, coins } from "@cosmjs/stargate";
|
||||
import {
|
||||
MsgClearAdmin,
|
||||
@ -44,36 +44,61 @@ describe("AminoTypes", () => {
|
||||
});
|
||||
|
||||
it("works for MsgInstantiateContract", () => {
|
||||
const msg: MsgInstantiateContract = {
|
||||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
codeId: Long.fromString("12345"),
|
||||
label: "sticky",
|
||||
msg: toUtf8(
|
||||
JSON.stringify({
|
||||
foo: "bar",
|
||||
}),
|
||||
),
|
||||
funds: coins(1234, "ucosm"),
|
||||
admin: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5",
|
||||
};
|
||||
const aminoMsg = new AminoTypes({ additions: cosmWasmTypes }).toAmino({
|
||||
typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract",
|
||||
value: msg,
|
||||
});
|
||||
const expected: AminoMsgInstantiateContract = {
|
||||
type: "wasm/MsgInstantiateContract",
|
||||
value: {
|
||||
// With admin
|
||||
{
|
||||
const msg: MsgInstantiateContract = {
|
||||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
code_id: "12345",
|
||||
codeId: Long.fromString("12345"),
|
||||
label: "sticky",
|
||||
msg: {
|
||||
foo: "bar",
|
||||
},
|
||||
msg: toUtf8(`{"foo":"bar"}`),
|
||||
funds: coins(1234, "ucosm"),
|
||||
admin: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5",
|
||||
},
|
||||
};
|
||||
expect(aminoMsg).toEqual(expected);
|
||||
};
|
||||
const aminoMsg = new AminoTypes({ additions: cosmWasmTypes }).toAmino({
|
||||
typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract",
|
||||
value: msg,
|
||||
});
|
||||
const expected: AminoMsgInstantiateContract = {
|
||||
type: "wasm/MsgInstantiateContract",
|
||||
value: {
|
||||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
code_id: "12345",
|
||||
label: "sticky",
|
||||
msg: toBase64(toUtf8(`{"foo":"bar"}`)),
|
||||
funds: coins(1234, "ucosm"),
|
||||
admin: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5",
|
||||
},
|
||||
};
|
||||
expect(aminoMsg).toEqual(expected);
|
||||
}
|
||||
|
||||
// Without admin
|
||||
{
|
||||
const msg: MsgInstantiateContract = {
|
||||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
codeId: Long.fromString("12345"),
|
||||
label: "sticky",
|
||||
msg: toUtf8(`{"foo":"bar"}`),
|
||||
funds: coins(1234, "ucosm"),
|
||||
admin: "",
|
||||
};
|
||||
const aminoMsg = new AminoTypes({ additions: cosmWasmTypes }).toAmino({
|
||||
typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract",
|
||||
value: msg,
|
||||
});
|
||||
const expected: AminoMsgInstantiateContract = {
|
||||
type: "wasm/MsgInstantiateContract",
|
||||
value: {
|
||||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
code_id: "12345",
|
||||
label: "sticky",
|
||||
msg: toBase64(toUtf8(`{"foo":"bar"}`)),
|
||||
funds: coins(1234, "ucosm"),
|
||||
admin: undefined,
|
||||
},
|
||||
};
|
||||
expect(aminoMsg).toEqual(expected);
|
||||
}
|
||||
});
|
||||
|
||||
it("works for MsgUpdateAdmin", () => {
|
||||
@ -120,11 +145,7 @@ describe("AminoTypes", () => {
|
||||
const msg: MsgExecuteContract = {
|
||||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
contract: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k",
|
||||
msg: toUtf8(
|
||||
JSON.stringify({
|
||||
foo: "bar",
|
||||
}),
|
||||
),
|
||||
msg: toUtf8(`{"foo":"bar"}`),
|
||||
funds: coins(1234, "ucosm"),
|
||||
};
|
||||
const aminoMsg = new AminoTypes({ additions: cosmWasmTypes }).toAmino({
|
||||
@ -136,9 +157,7 @@ describe("AminoTypes", () => {
|
||||
value: {
|
||||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
contract: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k",
|
||||
msg: {
|
||||
foo: "bar",
|
||||
},
|
||||
msg: toBase64(toUtf8(`{"foo":"bar"}`)),
|
||||
funds: coins(1234, "ucosm"),
|
||||
},
|
||||
};
|
||||
@ -150,11 +169,7 @@ describe("AminoTypes", () => {
|
||||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
contract: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k",
|
||||
codeId: Long.fromString("98765"),
|
||||
msg: toUtf8(
|
||||
JSON.stringify({
|
||||
foo: "bar",
|
||||
}),
|
||||
),
|
||||
msg: toUtf8(`{"foo":"bar"}`),
|
||||
};
|
||||
const aminoMsg = new AminoTypes({ additions: cosmWasmTypes }).toAmino({
|
||||
typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContract",
|
||||
@ -166,9 +181,7 @@ describe("AminoTypes", () => {
|
||||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
contract: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k",
|
||||
code_id: "98765",
|
||||
msg: {
|
||||
foo: "bar",
|
||||
},
|
||||
msg: toBase64(toUtf8(`{"foo":"bar"}`)),
|
||||
},
|
||||
};
|
||||
expect(aminoMsg).toEqual(expected);
|
||||
@ -197,36 +210,60 @@ describe("AminoTypes", () => {
|
||||
});
|
||||
|
||||
it("works for MsgInstantiateContract", () => {
|
||||
const aminoMsg: AminoMsgInstantiateContract = {
|
||||
type: "wasm/MsgInstantiateContract",
|
||||
value: {
|
||||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
code_id: "12345",
|
||||
label: "sticky",
|
||||
msg: {
|
||||
foo: "bar",
|
||||
// With admin
|
||||
{
|
||||
const aminoMsg: AminoMsgInstantiateContract = {
|
||||
type: "wasm/MsgInstantiateContract",
|
||||
value: {
|
||||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
code_id: "12345",
|
||||
label: "sticky",
|
||||
msg: toBase64(toUtf8(`{"foo":"bar"}`)),
|
||||
funds: coins(1234, "ucosm"),
|
||||
admin: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5",
|
||||
},
|
||||
};
|
||||
const msg = new AminoTypes({ additions: cosmWasmTypes }).fromAmino(aminoMsg);
|
||||
const expectedValue: MsgInstantiateContract = {
|
||||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
codeId: Long.fromString("12345"),
|
||||
label: "sticky",
|
||||
msg: toUtf8(`{"foo":"bar"}`),
|
||||
funds: coins(1234, "ucosm"),
|
||||
admin: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5",
|
||||
},
|
||||
};
|
||||
const msg = new AminoTypes({ additions: cosmWasmTypes }).fromAmino(aminoMsg);
|
||||
const expectedValue: MsgInstantiateContract = {
|
||||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
codeId: Long.fromString("12345"),
|
||||
label: "sticky",
|
||||
msg: toUtf8(
|
||||
JSON.stringify({
|
||||
foo: "bar",
|
||||
}),
|
||||
),
|
||||
funds: coins(1234, "ucosm"),
|
||||
admin: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5",
|
||||
};
|
||||
expect(msg).toEqual({
|
||||
typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract",
|
||||
value: expectedValue,
|
||||
});
|
||||
};
|
||||
expect(msg).toEqual({
|
||||
typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract",
|
||||
value: expectedValue,
|
||||
});
|
||||
}
|
||||
|
||||
// Without admin
|
||||
{
|
||||
const aminoMsg: AminoMsgInstantiateContract = {
|
||||
type: "wasm/MsgInstantiateContract",
|
||||
value: {
|
||||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
code_id: "12345",
|
||||
label: "sticky",
|
||||
msg: toBase64(toUtf8(`{"foo":"bar"}`)),
|
||||
funds: coins(1234, "ucosm"),
|
||||
},
|
||||
};
|
||||
const msg = new AminoTypes({ additions: cosmWasmTypes }).fromAmino(aminoMsg);
|
||||
const expectedValue: MsgInstantiateContract = {
|
||||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
codeId: Long.fromString("12345"),
|
||||
label: "sticky",
|
||||
msg: toUtf8(`{"foo":"bar"}`),
|
||||
funds: coins(1234, "ucosm"),
|
||||
admin: "",
|
||||
};
|
||||
expect(msg).toEqual({
|
||||
typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract",
|
||||
value: expectedValue,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it("works for MsgUpdateAdmin", () => {
|
||||
@ -275,9 +312,7 @@ describe("AminoTypes", () => {
|
||||
value: {
|
||||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
contract: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k",
|
||||
msg: {
|
||||
foo: "bar",
|
||||
},
|
||||
msg: toBase64(toUtf8(`{"foo":"bar"}`)),
|
||||
funds: coins(1234, "ucosm"),
|
||||
},
|
||||
};
|
||||
@ -285,11 +320,7 @@ describe("AminoTypes", () => {
|
||||
const expectedValue: MsgExecuteContract = {
|
||||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
contract: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k",
|
||||
msg: toUtf8(
|
||||
JSON.stringify({
|
||||
foo: "bar",
|
||||
}),
|
||||
),
|
||||
msg: toUtf8(`{"foo":"bar"}`),
|
||||
funds: coins(1234, "ucosm"),
|
||||
};
|
||||
expect(msg).toEqual({
|
||||
@ -305,9 +336,7 @@ describe("AminoTypes", () => {
|
||||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
contract: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k",
|
||||
code_id: "98765",
|
||||
msg: {
|
||||
foo: "bar",
|
||||
},
|
||||
msg: toBase64(toUtf8(`{"foo":"bar"}`)),
|
||||
},
|
||||
};
|
||||
const msg = new AminoTypes({ additions: cosmWasmTypes }).fromAmino(aminoMsg);
|
||||
@ -315,11 +344,7 @@ describe("AminoTypes", () => {
|
||||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
contract: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k",
|
||||
codeId: Long.fromString("98765"),
|
||||
msg: toUtf8(
|
||||
JSON.stringify({
|
||||
foo: "bar",
|
||||
}),
|
||||
),
|
||||
msg: toUtf8(`{"foo":"bar"}`),
|
||||
};
|
||||
expect(msg).toEqual({
|
||||
typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContract",
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { fromBase64, fromUtf8, toBase64, toUtf8 } from "@cosmjs/encoding";
|
||||
import { fromBase64, toBase64 } from "@cosmjs/encoding";
|
||||
import { AminoConverter, Coin } from "@cosmjs/stargate";
|
||||
import {
|
||||
MsgClearAdmin,
|
||||
@ -45,8 +45,8 @@ export interface AminoMsgExecuteContract {
|
||||
readonly sender: string;
|
||||
/** Bech32 account address */
|
||||
readonly contract: string;
|
||||
/** Handle message as JavaScript object */
|
||||
readonly msg: any;
|
||||
/** Execute message as base64 encoded JSON */
|
||||
readonly msg: string;
|
||||
readonly funds: readonly Coin[];
|
||||
};
|
||||
}
|
||||
@ -65,8 +65,8 @@ export interface AminoMsgInstantiateContract {
|
||||
readonly code_id: string;
|
||||
/** Human-readable label for this contract */
|
||||
readonly label: string;
|
||||
/** Instantiate message as JavaScript object */
|
||||
readonly msg: any;
|
||||
/** Instantiate message as base64 encoded JSON */
|
||||
readonly msg: string;
|
||||
readonly funds: readonly Coin[];
|
||||
/** Bech32-encoded admin address */
|
||||
readonly admin?: string;
|
||||
@ -87,8 +87,8 @@ export interface AminoMsgMigrateContract {
|
||||
readonly contract: string;
|
||||
/** The new code */
|
||||
readonly code_id: string;
|
||||
/** Migrate message as JavaScript object */
|
||||
readonly msg: any;
|
||||
/** Migrate message as base64 encoded JSON */
|
||||
readonly msg: string;
|
||||
};
|
||||
}
|
||||
|
||||
@ -150,9 +150,9 @@ export const cosmWasmTypes: Record<string, AminoConverter> = {
|
||||
sender: sender,
|
||||
code_id: codeId.toString(),
|
||||
label: label,
|
||||
msg: JSON.parse(fromUtf8(msg)),
|
||||
msg: toBase64(msg),
|
||||
funds: funds,
|
||||
admin: admin ?? undefined,
|
||||
admin: admin || undefined,
|
||||
}),
|
||||
fromAmino: ({
|
||||
sender,
|
||||
@ -165,7 +165,7 @@ export const cosmWasmTypes: Record<string, AminoConverter> = {
|
||||
sender: sender,
|
||||
codeId: Long.fromString(code_id),
|
||||
label: label,
|
||||
msg: toUtf8(JSON.stringify(msg)),
|
||||
msg: fromBase64(msg),
|
||||
funds: [...funds],
|
||||
admin: admin ?? "",
|
||||
}),
|
||||
@ -199,13 +199,13 @@ export const cosmWasmTypes: Record<string, AminoConverter> = {
|
||||
toAmino: ({ sender, contract, msg, funds }: MsgExecuteContract): AminoMsgExecuteContract["value"] => ({
|
||||
sender: sender,
|
||||
contract: contract,
|
||||
msg: JSON.parse(fromUtf8(msg)),
|
||||
msg: toBase64(msg),
|
||||
funds: funds,
|
||||
}),
|
||||
fromAmino: ({ sender, contract, msg, funds }: AminoMsgExecuteContract["value"]): MsgExecuteContract => ({
|
||||
sender: sender,
|
||||
contract: contract,
|
||||
msg: toUtf8(JSON.stringify(msg)),
|
||||
msg: fromBase64(msg),
|
||||
funds: [...funds],
|
||||
}),
|
||||
},
|
||||
@ -215,7 +215,7 @@ export const cosmWasmTypes: Record<string, AminoConverter> = {
|
||||
sender: sender,
|
||||
contract: contract,
|
||||
code_id: codeId.toString(),
|
||||
msg: JSON.parse(fromUtf8(msg)),
|
||||
msg: toBase64(msg),
|
||||
}),
|
||||
fromAmino: ({
|
||||
sender,
|
||||
@ -226,7 +226,7 @@ export const cosmWasmTypes: Record<string, AminoConverter> = {
|
||||
sender: sender,
|
||||
contract: contract,
|
||||
codeId: Long.fromString(code_id),
|
||||
msg: toUtf8(JSON.stringify(msg)),
|
||||
msg: fromBase64(msg),
|
||||
}),
|
||||
},
|
||||
};
|
||||
|
||||
@ -271,9 +271,13 @@ describe("CosmWasmClient", () => {
|
||||
it("works", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const client = await CosmWasmClient.connect(wasmd.endpoint);
|
||||
const result = await client.getContracts(1);
|
||||
const result = await client.getContracts(deployedHackatom.codeId);
|
||||
const expectedAddresses = deployedHackatom.instances.map((info) => info.address);
|
||||
expect(result).toEqual(expectedAddresses);
|
||||
|
||||
// Test first 3 instances we get from scripts/wasmd/init.sh. There may me more than that in the result.
|
||||
expect(result[0]).toEqual(expectedAddresses[0]);
|
||||
expect(result[1]).toEqual(expectedAddresses[1]);
|
||||
expect(result[2]).toEqual(expectedAddresses[2]);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -34,6 +34,7 @@ import {
|
||||
defaultSigningClientOptions,
|
||||
defaultUpdateAdminFee,
|
||||
defaultUploadFee,
|
||||
deployedHackatom,
|
||||
getHackatom,
|
||||
makeRandomAddress,
|
||||
makeWasmClient,
|
||||
@ -150,7 +151,7 @@ describe("SigningCosmWasmClient", () => {
|
||||
const options = { ...defaultSigningClientOptions, prefix: wasmd.prefix };
|
||||
const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, options);
|
||||
const { codeId } = await client.upload(alice.address0, getHackatom().data, defaultUploadFee);
|
||||
const contractAddress1 = await client.instantiate(
|
||||
const { contractAddress: address1 } = await client.instantiate(
|
||||
alice.address0,
|
||||
codeId,
|
||||
{
|
||||
@ -160,7 +161,7 @@ describe("SigningCosmWasmClient", () => {
|
||||
"contract 1",
|
||||
defaultInstantiateFee,
|
||||
);
|
||||
const contractAddress2 = await client.instantiate(
|
||||
const { contractAddress: address2 } = await client.instantiate(
|
||||
alice.address0,
|
||||
codeId,
|
||||
{
|
||||
@ -170,7 +171,41 @@ describe("SigningCosmWasmClient", () => {
|
||||
"contract 2",
|
||||
defaultInstantiateFee,
|
||||
);
|
||||
expect(contractAddress1).not.toEqual(contractAddress2);
|
||||
expect(address1).not.toEqual(address2);
|
||||
client.disconnect();
|
||||
});
|
||||
|
||||
it("works with legacy Amino signer", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
|
||||
const options = { ...defaultSigningClientOptions, prefix: wasmd.prefix };
|
||||
const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, options);
|
||||
|
||||
// With admin
|
||||
await client.instantiate(
|
||||
alice.address0,
|
||||
deployedHackatom.codeId,
|
||||
{
|
||||
verifier: alice.address0,
|
||||
beneficiary: makeRandomAddress(),
|
||||
},
|
||||
"contract 1",
|
||||
defaultInstantiateFee,
|
||||
{ admin: makeRandomAddress() },
|
||||
);
|
||||
|
||||
// Without admin
|
||||
await client.instantiate(
|
||||
alice.address0,
|
||||
deployedHackatom.codeId,
|
||||
{
|
||||
verifier: alice.address0,
|
||||
beneficiary: makeRandomAddress(),
|
||||
},
|
||||
"contract 1",
|
||||
defaultInstantiateFee,
|
||||
);
|
||||
|
||||
client.disconnect();
|
||||
});
|
||||
});
|
||||
@ -247,7 +282,7 @@ describe("SigningCosmWasmClient", () => {
|
||||
});
|
||||
|
||||
describe("migrate", () => {
|
||||
it("can can migrate from one code ID to another", async () => {
|
||||
it("works", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
|
||||
const options = { ...defaultSigningClientOptions, prefix: wasmd.prefix };
|
||||
@ -290,6 +325,48 @@ describe("SigningCosmWasmClient", () => {
|
||||
|
||||
client.disconnect();
|
||||
});
|
||||
|
||||
it("works with legacy Amino signer", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
|
||||
const options = { ...defaultSigningClientOptions, prefix: wasmd.prefix };
|
||||
const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, options);
|
||||
const { codeId: codeId1 } = await client.upload(alice.address0, getHackatom().data, defaultUploadFee);
|
||||
const { codeId: codeId2 } = await client.upload(alice.address0, getHackatom().data, defaultUploadFee);
|
||||
const beneficiaryAddress = makeRandomAddress();
|
||||
const { contractAddress } = await client.instantiate(
|
||||
alice.address0,
|
||||
codeId1,
|
||||
{
|
||||
verifier: alice.address0,
|
||||
beneficiary: beneficiaryAddress,
|
||||
},
|
||||
"My cool label",
|
||||
defaultInstantiateFee,
|
||||
{ admin: alice.address0 },
|
||||
);
|
||||
const wasmClient = await makeWasmClient(wasmd.endpoint);
|
||||
const { contractInfo: contractInfo1 } = await wasmClient.wasm.getContractInfo(contractAddress);
|
||||
assert(contractInfo1);
|
||||
expect(contractInfo1.admin).toEqual(alice.address0);
|
||||
|
||||
const newVerifier = makeRandomAddress();
|
||||
await client.migrate(
|
||||
alice.address0,
|
||||
contractAddress,
|
||||
codeId2,
|
||||
{ verifier: newVerifier },
|
||||
defaultMigrateFee,
|
||||
);
|
||||
const { contractInfo: contractInfo2 } = await wasmClient.wasm.getContractInfo(contractAddress);
|
||||
assert(contractInfo2);
|
||||
expect({ ...contractInfo2 }).toEqual({
|
||||
...contractInfo1,
|
||||
codeId: Long.fromNumber(codeId2, true),
|
||||
});
|
||||
|
||||
client.disconnect();
|
||||
});
|
||||
});
|
||||
|
||||
describe("execute", () => {
|
||||
@ -342,6 +419,56 @@ describe("SigningCosmWasmClient", () => {
|
||||
|
||||
client.disconnect();
|
||||
});
|
||||
|
||||
it("works with legacy Amino signer", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
|
||||
const options = { ...defaultSigningClientOptions, prefix: wasmd.prefix };
|
||||
const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, options);
|
||||
const { codeId } = await client.upload(alice.address0, getHackatom().data, defaultUploadFee);
|
||||
// instantiate
|
||||
const funds = [coin(233444, "ucosm"), coin(5454, "ustake")];
|
||||
const beneficiaryAddress = makeRandomAddress();
|
||||
const { contractAddress } = await client.instantiate(
|
||||
alice.address0,
|
||||
codeId,
|
||||
{
|
||||
verifier: alice.address0,
|
||||
beneficiary: beneficiaryAddress,
|
||||
},
|
||||
"amazing random contract",
|
||||
defaultInstantiateFee,
|
||||
{
|
||||
funds: funds,
|
||||
},
|
||||
);
|
||||
// execute
|
||||
const result = await client.execute(
|
||||
alice.address0,
|
||||
contractAddress,
|
||||
{ release: {} },
|
||||
defaultExecuteFee,
|
||||
);
|
||||
const wasmEvent = result.logs[0].events.find((e) => e.type === "wasm");
|
||||
assert(wasmEvent, "Event of type wasm expected");
|
||||
expect(wasmEvent.attributes).toContain({ key: "action", value: "release" });
|
||||
expect(wasmEvent.attributes).toContain({
|
||||
key: "destination",
|
||||
value: beneficiaryAddress,
|
||||
});
|
||||
// Verify token transfer from contract to beneficiary
|
||||
const wasmClient = await makeWasmClient(wasmd.endpoint);
|
||||
const beneficiaryBalanceUcosm = await wasmClient.bank.balance(beneficiaryAddress, "ucosm");
|
||||
expect(beneficiaryBalanceUcosm).toEqual(funds[0]);
|
||||
const beneficiaryBalanceUstake = await wasmClient.bank.balance(beneficiaryAddress, "ustake");
|
||||
expect(beneficiaryBalanceUstake).toEqual(funds[1]);
|
||||
const contractBalanceUcosm = await wasmClient.bank.balance(contractAddress, "ucosm");
|
||||
expect(contractBalanceUcosm).toEqual(coin(0, "ucosm"));
|
||||
const contractBalanceUstake = await wasmClient.bank.balance(contractAddress, "ustake");
|
||||
expect(contractBalanceUstake).toEqual(coin(0, "ustake"));
|
||||
|
||||
client.disconnect();
|
||||
});
|
||||
});
|
||||
|
||||
describe("sendTokens", () => {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -118,7 +118,7 @@ export const validator = {
|
||||
/** Deployed as part of scripts/wasmd/init.sh */
|
||||
export const deployedHackatom = {
|
||||
codeId: 1,
|
||||
checksum: "716a97b1c086e0d7769ae7887edaa0e34faba2d7b8cda07f741f9fbf95706e8c",
|
||||
checksum: "13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5",
|
||||
instances: [
|
||||
{
|
||||
beneficiary: alice.address0,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/crypto",
|
||||
"version": "0.26.1",
|
||||
"version": "0.26.2",
|
||||
"description": "Cryptography resources for blockchain projects",
|
||||
"contributors": [
|
||||
"IOV SAS <admin@iov.one>",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/encoding",
|
||||
"version": "0.26.1",
|
||||
"version": "0.26.2",
|
||||
"description": "Encoding helpers for blockchain projects",
|
||||
"contributors": [
|
||||
"IOV SAS <admin@iov.one>"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/faucet-client",
|
||||
"version": "0.26.1",
|
||||
"version": "0.26.2",
|
||||
"description": "The faucet client",
|
||||
"contributors": [
|
||||
"Will Clark <willclarktech@users.noreply.github.com>"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/faucet",
|
||||
"version": "0.26.1",
|
||||
"version": "0.26.2",
|
||||
"description": "The faucet",
|
||||
"contributors": [
|
||||
"Ethan Frey <ethanfrey@users.noreply.github.com>",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/json-rpc",
|
||||
"version": "0.26.1",
|
||||
"version": "0.26.2",
|
||||
"description": "Framework for implementing a JSON-RPC 2.0 API",
|
||||
"contributors": [
|
||||
"IOV SAS <admin@iov.one>",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/launchpad",
|
||||
"version": "0.26.1",
|
||||
"version": "0.26.2",
|
||||
"description": "A client library for the Cosmos SDK 0.37 (cosmoshub-3), 0.38 and 0.39 (Launchpad)",
|
||||
"contributors": [
|
||||
"Ethan Frey <ethanfrey@users.noreply.github.com>",
|
||||
|
||||
@ -44,7 +44,7 @@ http://localhost:8000/demo.
|
||||
|
||||
Then follow the instructions on that page.
|
||||
|
||||
## Runnng tests
|
||||
## Running tests
|
||||
|
||||
The tests in this package require a Ledger device
|
||||
[initialized with the mnemonic](https://support.ledger.com/hc/en-us/articles/360005434914)
|
||||
@ -53,7 +53,23 @@ from
|
||||
(see "Ledger: accounts for Ledger based demos and tests") with an installed
|
||||
"Cosmos (ATOM)" app. The device must be connected via USB, unlocked and the
|
||||
Cosmos app must be opened. The tests require the user to manually approve
|
||||
transactions. Start a local Launchpad blockchain as described in
|
||||
transactions.
|
||||
|
||||
### Stargate tests
|
||||
|
||||
Start a local Stargate blockchain as described in
|
||||
[scripts/simapp/README.md](https://github.com/cosmos/cosmjs/blob/main/scripts/simapp/README.md)
|
||||
and execute:
|
||||
|
||||
```sh
|
||||
export LEDGER_ENABLED=1
|
||||
export SIMAPP_ENABLED=1
|
||||
yarn test
|
||||
```
|
||||
|
||||
### Launchpad tests
|
||||
|
||||
Start a local Launchpad blockchain as described in
|
||||
[scripts/launchpad/README.md](https://github.com/cosmos/cosmjs/blob/main/scripts/launchpad/README.md)
|
||||
and execute:
|
||||
|
||||
|
||||
@ -10,18 +10,22 @@ async function run() {
|
||||
|
||||
const accountNumber0 = 0;
|
||||
const address0 = accounts[accountNumber0].address;
|
||||
console.info(
|
||||
`Signing on Ledger device with account index ${accountNumber0} (${address0}). Please review and approve on the device now.`,
|
||||
);
|
||||
const signature0 = await demo.sign(signer, accountNumber0, address0, address0);
|
||||
console.info(`Signature from Ledger device for account number 0 (${address0}):`);
|
||||
console.info(signature0);
|
||||
console.info("Signature:", signature0);
|
||||
|
||||
// It seems the Ledger device needs a bit of time to recover
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
|
||||
const accountNumber10 = 10;
|
||||
const address10 = accounts[accountNumbers.findIndex((n) => n === accountNumber10)].address;
|
||||
console.info(
|
||||
`Signing on Ledger device with account index ${accountNumber10} (${address10}). Please review and approve on the device now.`,
|
||||
);
|
||||
const signature1 = await demo.sign(signer, accountNumber10, address10, address10);
|
||||
console.info(`Signature from Ledger device for account number 10 (${address10}):`);
|
||||
console.info(signature1);
|
||||
console.info("Signature:", signature1);
|
||||
}
|
||||
|
||||
run().catch(console.error);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/ledger-amino",
|
||||
"version": "0.26.1",
|
||||
"version": "0.26.2",
|
||||
"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.26.1",
|
||||
"version": "0.26.2",
|
||||
"description": "Math helpers for blockchain projects",
|
||||
"contributors": [
|
||||
"IOV SAS <admin@iov.one>"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/proto-signing",
|
||||
"version": "0.26.1",
|
||||
"version": "0.26.2",
|
||||
"description": "Utilities for protobuf based signing (Cosmos SDK 0.40+)",
|
||||
"contributors": [
|
||||
"Will Clark <willclarktech@users.noreply.github.com>",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/socket",
|
||||
"version": "0.26.1",
|
||||
"version": "0.26.2",
|
||||
"description": "Utility functions for working with WebSockets",
|
||||
"contributors": [
|
||||
"IOV SAS <admin@iov.one>",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/stargate",
|
||||
"version": "0.26.1",
|
||||
"version": "0.26.2",
|
||||
"description": "Utilities for Cosmos SDK 0.40",
|
||||
"contributors": [
|
||||
"Simon Warta <webmaster128@users.noreply.github.com>"
|
||||
|
||||
@ -91,7 +91,7 @@ export const defaultRegistryTypes: ReadonlyArray<[string, GeneratedType]> = [
|
||||
["/ibc.core.channel.v1.MsgChannelCloseInit", MsgChannelCloseInit],
|
||||
["/ibc.core.channel.v1.MsgChannelCloseConfirm", MsgChannelCloseConfirm],
|
||||
["/ibc.core.channel.v1.MsgRecvPacket", MsgRecvPacket],
|
||||
["/ibc.core.channel.v1.MsgTimeout ", MsgTimeout],
|
||||
["/ibc.core.channel.v1.MsgTimeout", MsgTimeout],
|
||||
["/ibc.core.channel.v1.MsgTimeoutOnClose", MsgTimeoutOnClose],
|
||||
["/ibc.core.channel.v1.MsgAcknowledgement", MsgAcknowledgement],
|
||||
["/ibc.core.client.v1.MsgCreateClient", MsgCreateClient],
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/stream",
|
||||
"version": "0.26.1",
|
||||
"version": "0.26.2",
|
||||
"description": "Utility functions for producing and consuming streams",
|
||||
"contributors": [
|
||||
"IOV SAS <admin@iov.one>",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/tendermint-rpc",
|
||||
"version": "0.26.1",
|
||||
"version": "0.26.2",
|
||||
"description": "Tendermint RPC clients",
|
||||
"contributors": [
|
||||
"IOV SAS <admin@iov.one>",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { createJsonRpcRequest } from "../jsonrpc";
|
||||
import { defaultInstance } from "../testutil.spec";
|
||||
import { HttpClient } from "./httpclient";
|
||||
import { http, HttpClient } from "./httpclient";
|
||||
|
||||
function pendingWithoutTendermint(): void {
|
||||
if (!process.env.TENDERMINT_ENABLED) {
|
||||
@ -8,9 +8,23 @@ function pendingWithoutTendermint(): void {
|
||||
}
|
||||
}
|
||||
|
||||
describe("HttpClient", () => {
|
||||
const tendermintUrl = defaultInstance.url;
|
||||
const tendermintUrl = defaultInstance.url;
|
||||
|
||||
describe("http", () => {
|
||||
it("can send a health request", async () => {
|
||||
pendingWithoutTendermint();
|
||||
const response = await http("POST", `http://${tendermintUrl}`, createJsonRpcRequest("health"));
|
||||
expect(response).toEqual(jasmine.objectContaining({ jsonrpc: "2.0" }));
|
||||
});
|
||||
|
||||
it("errors for non-open port", async () => {
|
||||
await expectAsync(
|
||||
http("POST", `http://localhost:56745`, createJsonRpcRequest("health")),
|
||||
).toBeRejectedWithError(/(ECONNREFUSED|Failed to fetch)/i);
|
||||
});
|
||||
});
|
||||
|
||||
describe("HttpClient", () => {
|
||||
it("can make a simple call", async () => {
|
||||
pendingWithoutTendermint();
|
||||
const client = new HttpClient(tendermintUrl);
|
||||
|
||||
@ -24,7 +24,8 @@ function filterBadStatus(res: any): any {
|
||||
*
|
||||
* For some reason, fetch does not complain about missing server-side CORS support.
|
||||
*/
|
||||
async function http(method: "POST", url: string, request?: any): Promise<any> {
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
export async function http(method: "POST", url: string, request?: any): Promise<any> {
|
||||
if (typeof fetch !== "undefined") {
|
||||
const body = request ? JSON.stringify(request) : undefined;
|
||||
return fetch(url, { method: method, body: body })
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cosmjs/utils",
|
||||
"version": "0.26.1",
|
||||
"version": "0.26.2",
|
||||
"description": "Utility tools, primarily for testing code",
|
||||
"contributors": [
|
||||
"IOV SAS <admin@iov.one>"
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
716a97b1c086e0d7769ae7887edaa0e34faba2d7b8cda07f741f9fbf95706e8c hackatom.wasm
|
||||
0a127c6e04c8aad95dd3d50177e95b6116606546f0a4fc894ba82a29ce3b6fc1 ibc_reflect.wasm
|
||||
13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5 hackatom.wasm
|
||||
1da6c16de2cbaf7ad8cbb66f0925ba33f5c278cb2491762d04658c1480ea229b ibc_reflect.wasm
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
# This must get from 2-3 different repos, fix the versions here:
|
||||
|
||||
COSMWASM_VERSION="v0.16.0"
|
||||
COSMWASM_VERSION="v1.0.0-beta"
|
||||
|
||||
curl -sS -L -O "https://github.com/CosmWasm/cosmwasm/releases/download/${COSMWASM_VERSION}/hackatom.wasm"
|
||||
curl -sS -L -O "https://github.com/CosmWasm/cosmwasm/releases/download/${COSMWASM_VERSION}/ibc_reflect.wasm"
|
||||
|
||||
BIN
scripts/wasmd/contracts/hackatom.wasm
(Stored with Git LFS)
BIN
scripts/wasmd/contracts/hackatom.wasm
(Stored with Git LFS)
Binary file not shown.
BIN
scripts/wasmd/contracts/ibc_reflect.wasm
(Stored with Git LFS)
BIN
scripts/wasmd/contracts/ibc_reflect.wasm
(Stored with Git LFS)
Binary file not shown.
@ -1,5 +1,5 @@
|
||||
# Choose from https://hub.docker.com/r/cosmwasm/wasmd/tags
|
||||
REPOSITORY="cosmwasm/wasmd"
|
||||
VERSION="v0.18.0"
|
||||
VERSION="v0.20.0"
|
||||
|
||||
CONTAINER_NAME="wasmd"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user