Merge pull request #933 from cosmos/fix-env-variables-and-example

Fix env variables in CI and CLI example
This commit is contained in:
Simon Warta 2021-11-18 22:59:06 +01:00 committed by GitHub
commit ac19c1f5db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 16 deletions

View File

@ -152,7 +152,6 @@ jobs:
name: Run tests
environment:
LAUNCHPAD_ENABLED: 1
ERC20_ENABLED: 1
TENDERMINT_ENABLED: 1
SOCKETSERVER_ENABLED: 1
SKIP_BUILD: 1
@ -273,7 +272,6 @@ jobs:
- run:
environment:
LAUNCHPAD_ENABLED: 1
ERC20_ENABLED: 1
SIMAPP42_ENABLED: 1
SLOW_SIMAPP42_ENABLED: 1
TENDERMINT_ENABLED: 1
@ -292,7 +290,13 @@ jobs:
name: Run CLI examples
working_directory: packages/cli
environment:
LAUNCHPAD_ENABLED: 1
SIMAPP42_ENABLED: 1
SLOW_SIMAPP42_ENABLED: 1
TENDERMINT_ENABLED: 1
SOCKETSERVER_ENABLED: 1
SKIP_BUILD: 1
WASMD_ENABLED: 1
command: ./run_examples.sh
- run:
name: Stop chains
@ -389,7 +393,6 @@ jobs:
- run:
environment:
LAUNCHPAD_ENABLED: 1
ERC20_ENABLED: 1
SIMAPP42_ENABLED: 1
SLOW_SIMAPP42_ENABLED: 1
TENDERMINT_ENABLED: 1
@ -491,7 +494,6 @@ jobs:
- run:
environment:
LAUNCHPAD_ENABLED: 1
ERC20_ENABLED: 1
SIMAPP42_ENABLED: 1
SLOW_SIMAPP42_ENABLED: 1
TENDERMINT_ENABLED: 1

View File

@ -55,7 +55,6 @@ multiple versions of raw Tendermint and a basic WebSocket server.
./scripts/launchpad/start.sh
./scripts/launchpad/init.sh
export LAUNCHPAD_ENABLED=1
export ERC20_ENABLED=1
# Start Tendermint
./scripts/tendermint/all_start.sh
@ -71,7 +70,6 @@ yarn test
# And at the end of the day
unset SOCKETSERVER_ENABLED
unset TENDERMINT_ENABLED
unset ERC20_ENABLED
unset LAUNCHPAD_ENABLED
./scripts/socketserver/stop.sh
./scripts/tendermint/all_stop.sh

View File

@ -23,12 +23,7 @@ async function main(hackatomWasmPath: string) {
// Upload contract
const wasm = fs.readFileSync(hackatomWasmPath);
const uploadFee = calculateFee(1_500_000, gasPrice);
const uploadReceipt = await client.upload(
alice.address0,
wasm,
uploadFee,
"Upload hackatom contract",
);
const uploadReceipt = await client.upload(alice.address0, wasm, uploadFee, "Upload hackatom contract");
console.info("Upload succeeded. Receipt:", uploadReceipt);
// Instantiate

View File

@ -1,7 +1,8 @@
import { makeCosmoshubPath } from "@cosmjs/amino";
import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
import { assertIsBroadcastTxSuccess, SigningStargateClient } from "@cosmjs/stargate";
import { assertIsBroadcastTxSuccess, calculateFee, GasPrice, SigningStargateClient } from "@cosmjs/stargate";
// Wallet
const mnemonic =
"economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone";
const path = makeCosmoshubPath(3);
@ -10,15 +11,27 @@ const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, { hdPaths: [
const [account] = await wallet.getAccounts();
console.log("Signer address:", account.address);
// Network config
const rpcEndpoint = "ws://localhost:26658";
const gasPrice = GasPrice.fromString("0.025ucosm");
// Setup client
const client = await SigningStargateClient.connectWithSigner(rpcEndpoint, wallet);
// Send transaction
const recipient = "cosmos1xv9tklw7d82sezh9haa573wufgy59vmwe6xxe5";
const amount = {
denom: "ucosm",
amount: "1234567",
};
const result = await client.sendTokens(account.address, recipient, [amount], "Have fun with your star coins");
const fee = calculateFee(200_000, gasPrice);
const result = await client.sendTokens(
account.address,
recipient,
[amount],
fee,
"Have fun with your star coins",
);
assertIsBroadcastTxSuccess(result);
console.log("Successfully broadcasted:", result);

View File

@ -2,7 +2,7 @@
set -o errexit -o nounset -o pipefail
command -v shellcheck >/dev/null && shellcheck "$0"
if [ -n "${SIMAPP42_ENABLED:-}" ]; then
if [ -n "${WASMD_ENABLED:-}" ]; then
yarn node ./bin/cosmwasm-cli --init examples/cosmwasm.ts --code "process.exit(0)"
fi
if [ -n "${LAUNCHPAD_ENABLED:-}" ]; then

View File

@ -18,7 +18,6 @@ module.exports = [
plugins: [
new webpack.EnvironmentPlugin({
WASMD_ENABLED: "",
ERC20_ENABLED: "",
}),
new webpack.ProvidePlugin({
Buffer: ["buffer", "Buffer"],