From 3bbcd6337840f794b0a35b82649a55f6795e7555 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Thu, 5 Nov 2020 13:27:37 +0100 Subject: [PATCH] Update packages etc for launchpad chain renaming --- .circleci/config.yml | 36 ++--- HACKING.md | 20 +-- packages/cli/examples/delegate.ts | 2 +- .../src/cosmwasmclient.searchtx.spec.ts | 72 ++++----- packages/cosmwasm/src/cosmwasmclient.spec.ts | 122 +++++++------- packages/cosmwasm/src/lcdapi/wasm.spec.ts | 82 +++++----- .../src/signingcosmwasmclient.spec.ts | 35 ++-- packages/cosmwasm/src/testutils.spec.ts | 18 +-- packages/cosmwasm/webpack.web.config.js | 2 +- packages/faucet-client/README.md | 2 +- packages/faucet/src/faucet.spec.ts | 24 +-- packages/launchpad-ledger/README.md | 8 +- .../launchpad-ledger/src/ledgersigner.spec.ts | 6 +- .../launchpad-ledger/src/testutils.spec.ts | 14 +- .../src/cosmosclient.searchtx.spec.ts | 56 +++---- packages/launchpad/src/cosmosclient.spec.ts | 60 +++---- packages/launchpad/src/lcdapi/auth.spec.ts | 18 +-- packages/launchpad/src/lcdapi/bank.spec.ts | 12 +- .../launchpad/src/lcdapi/distribution.spec.ts | 58 +++---- packages/launchpad/src/lcdapi/gov.spec.ts | 54 +++---- .../launchpad/src/lcdapi/lcdclient.spec.ts | 118 +++++++------- packages/launchpad/src/lcdapi/mint.spec.ts | 16 +- .../launchpad/src/lcdapi/slashing.spec.ts | 10 +- packages/launchpad/src/lcdapi/staking.spec.ts | 152 +++++++++--------- packages/launchpad/src/lcdapi/supply.spec.ts | 10 +- .../launchpad/src/signingcosmosclient.spec.ts | 10 +- packages/launchpad/src/testutils.spec.ts | 12 +- packages/launchpad/webpack.web.config.js | 2 +- 28 files changed, 520 insertions(+), 511 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8913d32c..7b8c1255 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -90,8 +90,8 @@ jobs: sudo dpkg -i "$HOME/git-lfs.deb" - checkout - run: # start early for less wait time below - name: Start wasmd - command: ./scripts/wasmd/start.sh + name: Start launchpad + command: ./scripts/launchpad/start.sh background: true - run: name: Start simapp @@ -142,14 +142,14 @@ jobs: paths: - ~/.cache/yarn - run: - name: Initialize wasmd (deploy contracts and friends) - command: ./scripts/wasmd/init.sh + name: Initialize launchpad (deploy contracts and friends) + command: ./scripts/launchpad/init.sh - run: name: Start socket server command: ./scripts/socketserver/start.sh - run: environment: - WASMD_ENABLED: 1 + LAUNCHPAD_ENABLED: 1 ERC20_ENABLED: 1 SIMAPP_ENABLED: 1 TENDERMINT_ENABLED: 1 @@ -176,7 +176,7 @@ jobs: ./bin/cosmwasm-cli --init examples/local_faucet.ts --code "process.exit(0)" ./bin/cosmwasm-cli --init examples/mask.ts --code "process.exit(0)" - run: - command: ./scripts/wasmd/stop.sh + command: ./scripts/launchpad/stop.sh - run: command: ./scripts/tendermint/all_stop.sh - run: @@ -199,8 +199,8 @@ jobs: sudo dpkg -i "$HOME/git-lfs.deb" - checkout - run: # start early for less wait time below - name: Start wasmd - command: ./scripts/wasmd/start.sh + name: Start launchpad + command: ./scripts/launchpad/start.sh background: true - run: name: Start simapp @@ -251,14 +251,14 @@ jobs: paths: - ~/.cache/yarn - run: - name: Initialize wasmd (deploy contracts and friends) - command: ./scripts/wasmd/init.sh + name: Initialize launchpad (deploy contracts and friends) + command: ./scripts/launchpad/init.sh - run: name: Start socket server command: ./scripts/socketserver/start.sh - run: environment: - WASMD_ENABLED: 1 + LAUNCHPAD_ENABLED: 1 ERC20_ENABLED: 1 SIMAPP_ENABLED: 1 TENDERMINT_ENABLED: 1 @@ -266,7 +266,7 @@ jobs: SKIP_BUILD: 1 command: yarn test-chrome - run: - command: ./scripts/wasmd/stop.sh + command: ./scripts/launchpad/stop.sh - run: command: ./scripts/tendermint/all_stop.sh - run: @@ -289,8 +289,8 @@ jobs: sudo dpkg -i "$HOME/git-lfs.deb" - checkout - run: # start early for less wait time below - name: Start wasmd - command: ./scripts/wasmd/start.sh + name: Start launchpad + command: ./scripts/launchpad/start.sh background: true - run: name: Start simapp @@ -341,14 +341,14 @@ jobs: paths: - ~/.cache/yarn - run: - name: Initialize wasmd (deploy contracts and friends) - command: ./scripts/wasmd/init.sh + name: Initialize launchpad (deploy contracts and friends) + command: ./scripts/launchpad/init.sh - run: name: Start socket server command: ./scripts/socketserver/start.sh - run: environment: - WASMD_ENABLED: 1 + LAUNCHPAD_ENABLED: 1 ERC20_ENABLED: 1 SIMAPP_ENABLED: 1 TENDERMINT_ENABLED: 1 @@ -359,7 +359,7 @@ jobs: name: Upload coverage report command: npx codecov - run: - command: ./scripts/wasmd/stop.sh + command: ./scripts/launchpad/stop.sh - run: command: ./scripts/tendermint/all_stop.sh - run: diff --git a/HACKING.md b/HACKING.md index 58995b74..c87ab311 100644 --- a/HACKING.md +++ b/HACKING.md @@ -26,7 +26,7 @@ To verify everything worked as expected, check if the testing contracts are correctly checked out: ```sh -cd scripts/wasmd/contracts +cd scripts/launchpad/contracts sha256sum -c checksums.sha256 ``` @@ -41,14 +41,14 @@ yarn test To run the entire test suite, you need to run some local blockchain to test against. We use [wasmd](https://github.com/CosmWasm/wasmd) for both CosmWasm -tests and as a generic Cosmos SDK 0.39 blockchain. We also spawn multiple -versions of raw Tendermint and a basic WebSocket server. +tests and as a generic Cosmos SDK 0.39 (Launchpad) blockchain. We also spawn +multiple versions of raw Tendermint and a basic WebSocket server. ```sh # Start wasmd -./scripts/wasmd/start.sh -./scripts/wasmd/init.sh -export WASMD_ENABLED=1 +./scripts/launchpad/start.sh +./scripts/launchpad/init.sh +export LAUNCHPAD_ENABLED=1 export ERC20_ENABLED=1 # Start Tendermint @@ -66,10 +66,10 @@ yarn test unset SOCKETSERVER_ENABLED unset TENDERMINT_ENABLED unset ERC20_ENABLED -unset WASMD_ENABLED +unset LAUNCHPAD_ENABLED ./scripts/socketserver/stop.sh ./scripts/tendermint/all_stop.sh -./scripts/wasmd/stop.sh +./scripts/launchpad/stop.sh ``` ## Sanity @@ -93,8 +93,8 @@ order to avoid conflicts. Here is an overview of the ports used: | ----- | --------------------- | ------------------------------------------------------------------------------------- | | 1317 | wasmd LCD API | @cosmjs/launchpad and @cosmjs/cosmwasm tests | | 1318 | simapp API | Manual Stargate debugging | -| 4444 | sockertserver | @cosmjs/sockets tests | -| 4445 | sockertserver slow | @cosmjs/sockets tests | +| 4444 | socketserver | @cosmjs/sockets tests | +| 4445 | socketserver slow | @cosmjs/sockets tests | | 11133 | Tendermint 0.33 RPC | @cosmjs/tendermint-rpc tests | | 11134 | Tendermint 0.34 RPC | @cosmjs/tendermint-rpc tests ([soon™](https://github.com/CosmWasm/cosmjs/issues/344)) | | 26657 | simapp Tendermint RPC | Stargate client tests | diff --git a/packages/cli/examples/delegate.ts b/packages/cli/examples/delegate.ts index a5d908b5..f99da7e7 100644 --- a/packages/cli/examples/delegate.ts +++ b/packages/cli/examples/delegate.ts @@ -9,7 +9,7 @@ const msg: MsgDelegate = { type: "cosmos-sdk/MsgDelegate", value: { delegator_address: senderAddress, - // To get the proper validator address, start the demo chain (./scripts/wasmd/start.sh), then run: + // To get the proper validator address, start the demo chain (./scripts/launchpad/start.sh), then run: // curl http://localhost:1317/staking/validators | jq '.result[0].operator_address' validator_address: "cosmosvaloper1yfkkk04ve8a0sugj4fe6q6zxuvmvza8r3arurr", amount: coin(300000, "ustake"), diff --git a/packages/cosmwasm/src/cosmwasmclient.searchtx.spec.ts b/packages/cosmwasm/src/cosmwasmclient.searchtx.spec.ts index 8dcc6a85..b62441fa 100644 --- a/packages/cosmwasm/src/cosmwasmclient.searchtx.spec.ts +++ b/packages/cosmwasm/src/cosmwasmclient.searchtx.spec.ts @@ -21,11 +21,11 @@ import { deployedErc20, erc20Enabled, fromOneElementArray, + launchpad, + launchpadEnabled, makeRandomAddress, pendingWithoutErc20, - pendingWithoutWasmd, - wasmd, - wasmdEnabled, + pendingWithoutLaunchpad, } from "./testutils.spec"; interface TestTxSend { @@ -51,16 +51,16 @@ describe("CosmWasmClient.searchTx", () => { let execute: TestTxExecute | undefined; beforeAll(async () => { - if (wasmdEnabled() && erc20Enabled()) { + if (launchpadEnabled() && erc20Enabled()) { const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic); - const client = new SigningCosmWasmClient(wasmd.endpoint, alice.address0, wallet); + const client = new SigningCosmWasmClient(launchpad.endpoint, alice.address0, wallet); { const recipient = makeRandomAddress(); const transferAmount = coins(1234567, "ucosm"); const result = await client.sendTokens(recipient, transferAmount); await sleep(75); // wait until tx is indexed - const txDetails = await new LcdClient(wasmd.endpoint).txById(result.transactionHash); + const txDetails = await new LcdClient(launchpad.endpoint).txById(result.transactionHash); sendSuccessful = { sender: alice.address0, recipient: recipient, @@ -78,7 +78,7 @@ describe("CosmWasmClient.searchTx", () => { }; const result = await client.sendTokens(recipient, [transferAmount]); await sleep(75); // wait until tx is indexed - const txDetails = await new LcdClient(wasmd.endpoint).txById(result.transactionHash); + const txDetails = await new LcdClient(launchpad.endpoint).txById(result.transactionHash); sendSelfSuccessful = { sender: alice.address0, recipient: recipient, @@ -135,7 +135,7 @@ describe("CosmWasmClient.searchTx", () => { }; const result = await client.execute(hashInstance, msg); await sleep(75); // wait until tx is indexed - const txDetails = await new LcdClient(wasmd.endpoint).txById(result.transactionHash); + const txDetails = await new LcdClient(launchpad.endpoint).txById(result.transactionHash); execute = { sender: alice.address0, contract: hashInstance, @@ -149,10 +149,10 @@ describe("CosmWasmClient.searchTx", () => { describe("with SearchByIdQuery", () => { it("can search successful tx by ID", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); pendingWithoutErc20(); assert(sendSuccessful, "value must be set in beforeAll()"); - const client = new CosmWasmClient(wasmd.endpoint); + const client = new CosmWasmClient(launchpad.endpoint); const result = await client.searchTx({ id: sendSuccessful.hash }); expect(result.length).toEqual(1); expect(result[0]).toEqual( @@ -166,10 +166,10 @@ describe("CosmWasmClient.searchTx", () => { }); it("can search unsuccessful tx by ID", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); pendingWithoutErc20(); assert(sendUnsuccessful, "value must be set in beforeAll()"); - const client = new CosmWasmClient(wasmd.endpoint); + const client = new CosmWasmClient(launchpad.endpoint); const result = await client.searchTx({ id: sendUnsuccessful.hash }); expect(result.length).toEqual(1); expect(result[0]).toEqual( @@ -183,19 +183,19 @@ describe("CosmWasmClient.searchTx", () => { }); it("can search by ID (non existent)", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); pendingWithoutErc20(); - const client = new CosmWasmClient(wasmd.endpoint); + const client = new CosmWasmClient(launchpad.endpoint); const nonExistentId = "0000000000000000000000000000000000000000000000000000000000000000"; const result = await client.searchTx({ id: nonExistentId }); expect(result.length).toEqual(0); }); it("can search by ID and filter by minHeight", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); pendingWithoutErc20(); assert(sendSuccessful); - const client = new CosmWasmClient(wasmd.endpoint); + const client = new CosmWasmClient(launchpad.endpoint); const query = { id: sendSuccessful.hash }; { @@ -222,10 +222,10 @@ describe("CosmWasmClient.searchTx", () => { describe("with SearchByHeightQuery", () => { it("can search successful tx by height", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); pendingWithoutErc20(); assert(sendSuccessful, "value must be set in beforeAll()"); - const client = new CosmWasmClient(wasmd.endpoint); + const client = new CosmWasmClient(launchpad.endpoint); const result = await client.searchTx({ height: sendSuccessful.height }); expect(result.length).toBeGreaterThanOrEqual(1); expect(result).toContain( @@ -239,10 +239,10 @@ describe("CosmWasmClient.searchTx", () => { }); it("can search unsuccessful tx by height", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); pendingWithoutErc20(); assert(sendUnsuccessful, "value must be set in beforeAll()"); - const client = new CosmWasmClient(wasmd.endpoint); + const client = new CosmWasmClient(launchpad.endpoint); const result = await client.searchTx({ height: sendUnsuccessful.height }); expect(result.length).toBeGreaterThanOrEqual(1); expect(result).toContain( @@ -258,10 +258,10 @@ describe("CosmWasmClient.searchTx", () => { describe("with SearchBySentFromOrToQuery", () => { it("can search by sender", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); pendingWithoutErc20(); assert(sendSuccessful, "value must be set in beforeAll()"); - const client = new CosmWasmClient(wasmd.endpoint); + const client = new CosmWasmClient(launchpad.endpoint); const results = await client.searchTx({ sentFromOrTo: sendSuccessful.sender }); expect(results.length).toBeGreaterThanOrEqual(1); @@ -287,10 +287,10 @@ describe("CosmWasmClient.searchTx", () => { }); it("can search by recipient", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); pendingWithoutErc20(); assert(sendSuccessful, "value must be set in beforeAll()"); - const client = new CosmWasmClient(wasmd.endpoint); + const client = new CosmWasmClient(launchpad.endpoint); const results = await client.searchTx({ sentFromOrTo: sendSuccessful.recipient }); expect(results.length).toBeGreaterThanOrEqual(1); @@ -315,11 +315,11 @@ describe("CosmWasmClient.searchTx", () => { }); it("can search by sender or recipient (sorted and deduplicated)", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); pendingWithoutErc20(); assert(sendSelfSuccessful, "value must be set in beforeAll()"); const txhash = sendSelfSuccessful.hash; - const client = new CosmWasmClient(wasmd.endpoint); + const client = new CosmWasmClient(launchpad.endpoint); const results = await client.searchTx({ sentFromOrTo: sendSelfSuccessful.recipient }); expect(Array.from(results).sort((tx1, tx2) => tx1.height - tx2.height)).toEqual(results); @@ -327,10 +327,10 @@ describe("CosmWasmClient.searchTx", () => { }); it("can search by recipient and filter by minHeight", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); pendingWithoutErc20(); assert(sendSuccessful); - const client = new CosmWasmClient(wasmd.endpoint); + const client = new CosmWasmClient(launchpad.endpoint); const query = { sentFromOrTo: sendSuccessful.recipient }; { @@ -355,10 +355,10 @@ describe("CosmWasmClient.searchTx", () => { }); it("can search by recipient and filter by maxHeight", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); pendingWithoutErc20(); assert(sendSuccessful); - const client = new CosmWasmClient(wasmd.endpoint); + const client = new CosmWasmClient(launchpad.endpoint); const query = { sentFromOrTo: sendSuccessful.recipient }; { @@ -385,10 +385,10 @@ describe("CosmWasmClient.searchTx", () => { describe("with SearchByTagsQuery", () => { it("can search by transfer.recipient", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); pendingWithoutErc20(); assert(sendSuccessful, "value must be set in beforeAll()"); - const client = new CosmWasmClient(wasmd.endpoint); + const client = new CosmWasmClient(launchpad.endpoint); const results = await client.searchTx({ tags: [{ key: "transfer.recipient", value: sendSuccessful.recipient }], }); @@ -412,10 +412,10 @@ describe("CosmWasmClient.searchTx", () => { }); it("can search by message.contract_address", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); pendingWithoutErc20(); assert(execute, "value must be set in beforeAll()"); - const client = new CosmWasmClient(wasmd.endpoint); + const client = new CosmWasmClient(launchpad.endpoint); const results = await client.searchTx({ tags: [{ key: "message.contract_address", value: execute.contract }], }); @@ -455,10 +455,10 @@ describe("CosmWasmClient.searchTx", () => { }); it("can search by message.contract_address + message.action", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); pendingWithoutErc20(); assert(execute, "value must be set in beforeAll()"); - const client = new CosmWasmClient(wasmd.endpoint); + const client = new CosmWasmClient(launchpad.endpoint); const results = await client.searchTx({ tags: [ { key: "message.contract_address", value: execute.contract }, diff --git a/packages/cosmwasm/src/cosmwasmclient.spec.ts b/packages/cosmwasm/src/cosmwasmclient.spec.ts index 22863012..ef84dcbb 100644 --- a/packages/cosmwasm/src/cosmwasmclient.spec.ts +++ b/packages/cosmwasm/src/cosmwasmclient.spec.ts @@ -21,12 +21,12 @@ import { alice, deployedHackatom, getHackatom, + launchpad, + launchpadEnabled, makeRandomAddress, - pendingWithoutWasmd, + pendingWithoutLaunchpad, tendermintIdMatcher, unused, - wasmd, - wasmdEnabled, } from "./testutils.spec"; const blockTime = 1_000; // ms @@ -42,26 +42,26 @@ interface HackatomInstance { describe("CosmWasmClient", () => { describe("makeReadOnly", () => { it("can be constructed", () => { - const client = new CosmWasmClient(wasmd.endpoint); + const client = new CosmWasmClient(launchpad.endpoint); expect(client).toBeTruthy(); }); }); describe("getChainId", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = new CosmWasmClient(wasmd.endpoint); - expect(await client.getChainId()).toEqual(wasmd.chainId); + pendingWithoutLaunchpad(); + const client = new CosmWasmClient(launchpad.endpoint); + expect(await client.getChainId()).toEqual(launchpad.chainId); }); it("caches chain ID", async () => { - pendingWithoutWasmd(); - const client = new CosmWasmClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new CosmWasmClient(launchpad.endpoint); const openedClient = (client as unknown) as PrivateCosmWasmClient; const getCodeSpy = spyOn(openedClient.lcdClient, "nodeInfo").and.callThrough(); - expect(await client.getChainId()).toEqual(wasmd.chainId); // from network - expect(await client.getChainId()).toEqual(wasmd.chainId); // from cache + expect(await client.getChainId()).toEqual(launchpad.chainId); // from network + expect(await client.getChainId()).toEqual(launchpad.chainId); // from cache expect(getCodeSpy).toHaveBeenCalledTimes(1); }); @@ -69,8 +69,8 @@ describe("CosmWasmClient", () => { describe("getHeight", () => { it("gets height via last block", async () => { - pendingWithoutWasmd(); - const client = new CosmWasmClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new CosmWasmClient(launchpad.endpoint); const openedClient = (client as unknown) as PrivateCosmWasmClient; const blockLatestSpy = spyOn(openedClient.lcdClient, "blocksLatest").and.callThrough(); @@ -85,8 +85,8 @@ describe("CosmWasmClient", () => { }); it("gets height via authAccount once an address is known", async () => { - pendingWithoutWasmd(); - const client = new CosmWasmClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new CosmWasmClient(launchpad.endpoint); const openedClient = (client as unknown) as PrivateCosmWasmClient; const blockLatestSpy = spyOn(openedClient.lcdClient, "blocksLatest").and.callThrough(); @@ -111,8 +111,8 @@ describe("CosmWasmClient", () => { describe("getSequence", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = new CosmWasmClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new CosmWasmClient(launchpad.endpoint); expect(await client.getSequence(unused.address)).toEqual({ accountNumber: unused.accountNumber, sequence: unused.sequence, @@ -120,8 +120,8 @@ describe("CosmWasmClient", () => { }); it("throws for missing accounts", async () => { - pendingWithoutWasmd(); - const client = new CosmWasmClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new CosmWasmClient(launchpad.endpoint); const missing = makeRandomAddress(); await client.getSequence(missing).then( () => fail("this must not succeed"), @@ -132,8 +132,8 @@ describe("CosmWasmClient", () => { describe("getAccount", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = new CosmWasmClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new CosmWasmClient(launchpad.endpoint); expect(await client.getAccount(unused.address)).toEqual({ address: unused.address, accountNumber: unused.accountNumber, @@ -147,8 +147,8 @@ describe("CosmWasmClient", () => { }); it("returns undefined for missing accounts", async () => { - pendingWithoutWasmd(); - const client = new CosmWasmClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new CosmWasmClient(launchpad.endpoint); const missing = makeRandomAddress(); expect(await client.getAccount(missing)).toBeUndefined(); }); @@ -156,8 +156,8 @@ describe("CosmWasmClient", () => { describe("getBlock", () => { it("works for latest block", async () => { - pendingWithoutWasmd(); - const client = new CosmWasmClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new CosmWasmClient(launchpad.endpoint); const response = await client.getBlock(); // id @@ -176,8 +176,8 @@ describe("CosmWasmClient", () => { }); it("works for block by height", async () => { - pendingWithoutWasmd(); - const client = new CosmWasmClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new CosmWasmClient(launchpad.endpoint); const height = (await client.getBlock()).header.height; const response = await client.getBlock(height - 1); @@ -199,8 +199,8 @@ describe("CosmWasmClient", () => { describe("getIdentifier", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = new CosmWasmClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new CosmWasmClient(launchpad.endpoint); assert(isWrappedStdTx(cosmoshub.tx)); expect(await client.getIdentifier(cosmoshub.tx)).toEqual(cosmoshub.id); }); @@ -208,9 +208,9 @@ describe("CosmWasmClient", () => { describe("broadcastTx", () => { it("works", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic); - const client = new CosmWasmClient(wasmd.endpoint); + const client = new CosmWasmClient(launchpad.endpoint); const memo = "My first contract on chain"; const sendMsg: MsgSend = { @@ -252,8 +252,8 @@ describe("CosmWasmClient", () => { describe("getCodes", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = new CosmWasmClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new CosmWasmClient(launchpad.endpoint); const result = await client.getCodes(); expect(result.length).toBeGreaterThanOrEqual(1); const [first] = result; @@ -269,8 +269,8 @@ describe("CosmWasmClient", () => { describe("getCodeDetails", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = new CosmWasmClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new CosmWasmClient(launchpad.endpoint); const result = await client.getCodeDetails(1); const expectedInfo: Code = { @@ -288,8 +288,8 @@ describe("CosmWasmClient", () => { }); it("caches downloads", async () => { - pendingWithoutWasmd(); - const client = new CosmWasmClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new CosmWasmClient(launchpad.endpoint); const openedClient = (client as unknown) as PrivateCosmWasmClient; const getCodeSpy = spyOn(openedClient.lcdClient.wasm, "getCode").and.callThrough(); @@ -303,8 +303,8 @@ describe("CosmWasmClient", () => { describe("getContracts", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = new CosmWasmClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new CosmWasmClient(launchpad.endpoint); const result = await client.getContracts(1); expect(result.length).toBeGreaterThanOrEqual(3); const [zero, one, two] = result; @@ -334,8 +334,8 @@ describe("CosmWasmClient", () => { describe("getContract", () => { it("works for instance without admin", async () => { - pendingWithoutWasmd(); - const client = new CosmWasmClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new CosmWasmClient(launchpad.endpoint); const zero = await client.getContract(deployedHackatom.instances[0].address); expect(zero).toEqual({ address: deployedHackatom.instances[0].address, @@ -347,8 +347,8 @@ describe("CosmWasmClient", () => { }); it("works for instance with admin", async () => { - pendingWithoutWasmd(); - const client = new CosmWasmClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new CosmWasmClient(launchpad.endpoint); const two = await client.getContract(deployedHackatom.instances[2].address); expect(two).toEqual( jasmine.objectContaining({ @@ -368,10 +368,10 @@ describe("CosmWasmClient", () => { let contract: HackatomInstance | undefined; beforeAll(async () => { - if (wasmdEnabled()) { - pendingWithoutWasmd(); + if (launchpadEnabled()) { + pendingWithoutLaunchpad(); const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic); - const client = new SigningCosmWasmClient(wasmd.endpoint, alice.address0, wallet); + const client = new SigningCosmWasmClient(launchpad.endpoint, alice.address0, wallet); const { codeId } = await client.upload(getHackatom().data); const initMsg = { verifier: makeRandomAddress(), beneficiary: makeRandomAddress() }; const { contractAddress } = await client.instantiate(codeId, initMsg, "random hackatom"); @@ -380,10 +380,10 @@ describe("CosmWasmClient", () => { }); it("can query existing key", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(contract); - const client = new CosmWasmClient(wasmd.endpoint); + const client = new CosmWasmClient(launchpad.endpoint); const raw = await client.queryContractRaw(contract.address, configKey); assert(raw, "must get result"); expect(JSON.parse(fromUtf8(raw))).toEqual({ @@ -394,20 +394,20 @@ describe("CosmWasmClient", () => { }); it("can query non-existent key", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(contract); - const client = new CosmWasmClient(wasmd.endpoint); + const client = new CosmWasmClient(launchpad.endpoint); const raw = await client.queryContractRaw(contract.address, otherKey); expect(raw).toBeNull(); }); it("errors for non-existent contract", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(contract); const nonExistentAddress = makeRandomAddress(); - const client = new CosmWasmClient(wasmd.endpoint); + const client = new CosmWasmClient(launchpad.endpoint); await client.queryContractRaw(nonExistentAddress, configKey).then( () => fail("must not succeed"), (error) => expect(error).toMatch(`No contract found at address "${nonExistentAddress}"`), @@ -419,10 +419,10 @@ describe("CosmWasmClient", () => { let contract: HackatomInstance | undefined; beforeAll(async () => { - if (wasmdEnabled()) { - pendingWithoutWasmd(); + if (launchpadEnabled()) { + pendingWithoutLaunchpad(); const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic); - const client = new SigningCosmWasmClient(wasmd.endpoint, alice.address0, wallet); + const client = new SigningCosmWasmClient(launchpad.endpoint, alice.address0, wallet); const { codeId } = await client.upload(getHackatom().data); const initMsg = { verifier: makeRandomAddress(), beneficiary: makeRandomAddress() }; const { contractAddress } = await client.instantiate(codeId, initMsg, "a different hackatom"); @@ -431,19 +431,19 @@ describe("CosmWasmClient", () => { }); it("works", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(contract); - const client = new CosmWasmClient(wasmd.endpoint); + const client = new CosmWasmClient(launchpad.endpoint); const resultDocument = await client.queryContractSmart(contract.address, { verifier: {} }); expect(resultDocument).toEqual({ verifier: contract.initMsg.verifier }); }); it("errors for malformed query message", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(contract); - const client = new CosmWasmClient(wasmd.endpoint); + const client = new CosmWasmClient(launchpad.endpoint); await client.queryContractSmart(contract.address, { broken: {} }).then( () => fail("must not succeed"), (error) => @@ -454,10 +454,10 @@ describe("CosmWasmClient", () => { }); it("errors for non-existent contract", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const nonExistentAddress = makeRandomAddress(); - const client = new CosmWasmClient(wasmd.endpoint); + const client = new CosmWasmClient(launchpad.endpoint); await client.queryContractSmart(nonExistentAddress, { verifier: {} }).then( () => fail("must not succeed"), (error) => expect(error).toMatch(`No contract found at address "${nonExistentAddress}"`), diff --git a/packages/cosmwasm/src/lcdapi/wasm.spec.ts b/packages/cosmwasm/src/lcdapi/wasm.spec.ts index 0b009e81..ca9067cf 100644 --- a/packages/cosmwasm/src/lcdapi/wasm.spec.ts +++ b/packages/cosmwasm/src/lcdapi/wasm.spec.ts @@ -36,10 +36,10 @@ import { deployedHackatom, fromOneElementArray, getHackatom, + launchpad, + launchpadEnabled, makeRandomAddress, - pendingWithoutWasmd, - wasmd, - wasmdEnabled, + pendingWithoutLaunchpad, } from "../testutils.spec"; import { setupWasmExtension, WasmExtension } from "./wasm"; @@ -69,7 +69,7 @@ async function uploadContract( }; const firstAddress = (await signer.getAccounts())[0].address; - const client = new SigningCosmosClient(wasmd.endpoint, firstAddress, signer); + const client = new SigningCosmosClient(launchpad.endpoint, firstAddress, signer); return client.signAndBroadcast([theMsg], fee, memo); } @@ -99,7 +99,7 @@ async function instantiateContract( }; const firstAddress = (await signer.getAccounts())[0].address; - const client = new SigningCosmosClient(wasmd.endpoint, firstAddress, signer); + const client = new SigningCosmosClient(launchpad.endpoint, firstAddress, signer); return client.signAndBroadcast([theMsg], fee, memo); } @@ -125,7 +125,7 @@ async function executeContract( }; const { account_number, sequence } = (await client.auth.account(alice.address0)).result.value; - const signDoc = makeSignDoc([theMsg], fee, wasmd.chainId, memo, account_number, sequence); + const signDoc = makeSignDoc([theMsg], fee, launchpad.chainId, memo, account_number, sequence); const { signed, signature } = await signer.signAmino(alice.address0, signDoc); const signedTx = makeStdTx(signed, signature); return client.broadcastTx(signedTx); @@ -138,7 +138,7 @@ describe("WasmExtension", () => { let hackatomContractAddress: string | undefined; beforeAll(async () => { - if (wasmdEnabled()) { + if (launchpadEnabled()) { const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic); const result = await uploadContract(wallet, hackatom); assertIsBroadcastTxSuccess(result); @@ -156,9 +156,9 @@ describe("WasmExtension", () => { describe("listCodeInfo", () => { it("has recently uploaded contract as last entry", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(hackatomCodeId); - const client = makeWasmClient(wasmd.endpoint); + const client = makeWasmClient(launchpad.endpoint); const codesList = await client.wasm.listCodeInfo(); const lastCode = codesList[codesList.length - 1]; expect(lastCode.id).toEqual(hackatomCodeId); @@ -171,9 +171,9 @@ describe("WasmExtension", () => { describe("getCode", () => { it("contains fill code information", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(hackatomCodeId); - const client = makeWasmClient(wasmd.endpoint); + const client = makeWasmClient(launchpad.endpoint); const code = await client.wasm.getCode(hackatomCodeId); expect(code.id).toEqual(hackatomCodeId); expect(code.creator).toEqual(alice.address0); @@ -187,10 +187,10 @@ describe("WasmExtension", () => { // TODO: move listContractsByCodeId tests out of here describe("getContractInfo", () => { it("works", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(hackatomCodeId); const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic); - const client = makeWasmClient(wasmd.endpoint); + const client = makeWasmClient(launchpad.endpoint); const beneficiaryAddress = makeRandomAddress(); const transferAmount = coins(707707, "ucosm"); @@ -233,9 +233,9 @@ describe("WasmExtension", () => { }); it("returns null for non-existent address", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(hackatomCodeId); - const client = makeWasmClient(wasmd.endpoint); + const client = makeWasmClient(launchpad.endpoint); const nonExistentAddress = makeRandomAddress(); const info = await client.wasm.getContractInfo(nonExistentAddress); expect(info).toBeNull(); @@ -244,10 +244,10 @@ describe("WasmExtension", () => { describe("getContractCodeHistory", () => { it("can list contract history", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(hackatomCodeId); const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic); - const client = makeWasmClient(wasmd.endpoint); + const client = makeWasmClient(launchpad.endpoint); const beneficiaryAddress = makeRandomAddress(); const transferAmount = coins(707707, "ucosm"); @@ -271,9 +271,9 @@ describe("WasmExtension", () => { }); it("returns null for non-existent address", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(hackatomCodeId); - const client = makeWasmClient(wasmd.endpoint); + const client = makeWasmClient(launchpad.endpoint); const nonExistentAddress = makeRandomAddress(); const history = await client.wasm.getContractCodeHistory(nonExistentAddress); expect(history).toBeNull(); @@ -282,9 +282,9 @@ describe("WasmExtension", () => { describe("getAllContractState", () => { it("can get all state", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(hackatomContractAddress); - const client = makeWasmClient(wasmd.endpoint); + const client = makeWasmClient(launchpad.endpoint); const state = await client.wasm.getAllContractState(hackatomContractAddress); expect(state.length).toEqual(1); const data = state[0]; @@ -295,8 +295,8 @@ describe("WasmExtension", () => { }); it("is empty for non-existent address", async () => { - pendingWithoutWasmd(); - const client = makeWasmClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeWasmClient(launchpad.endpoint); const nonExistentAddress = makeRandomAddress(); const state = await client.wasm.getAllContractState(nonExistentAddress); expect(state).toEqual([]); @@ -305,9 +305,9 @@ describe("WasmExtension", () => { describe("queryContractRaw", () => { it("can query by key", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(hackatomContractAddress); - const client = makeWasmClient(wasmd.endpoint); + const client = makeWasmClient(launchpad.endpoint); const raw = await client.wasm.queryContractRaw(hackatomContractAddress, hackatomConfigKey); assert(raw, "must get result"); const model = JSON.parse(fromAscii(raw)); @@ -316,16 +316,16 @@ describe("WasmExtension", () => { }); it("returns null for missing key", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(hackatomContractAddress); - const client = makeWasmClient(wasmd.endpoint); + const client = makeWasmClient(launchpad.endpoint); const info = await client.wasm.queryContractRaw(hackatomContractAddress, fromHex("cafe0dad")); expect(info).toBeNull(); }); it("returns null for non-existent address", async () => { - pendingWithoutWasmd(); - const client = makeWasmClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeWasmClient(launchpad.endpoint); const nonExistentAddress = makeRandomAddress(); const info = await client.wasm.queryContractRaw(nonExistentAddress, hackatomConfigKey); expect(info).toBeNull(); @@ -334,18 +334,18 @@ describe("WasmExtension", () => { describe("queryContractSmart", () => { it("can make smart queries", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(hackatomContractAddress); - const client = makeWasmClient(wasmd.endpoint); + const client = makeWasmClient(launchpad.endpoint); const request = { verifier: {} }; const response = await client.wasm.queryContractSmart(hackatomContractAddress, request); expect(response).toEqual({ verifier: alice.address0 }); }); it("throws for invalid query requests", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(hackatomContractAddress); - const client = makeWasmClient(wasmd.endpoint); + const client = makeWasmClient(launchpad.endpoint); const request = { nosuchkey: {} }; await client.wasm.queryContractSmart(hackatomContractAddress, request).then( () => fail("shouldn't succeed"), @@ -357,8 +357,8 @@ describe("WasmExtension", () => { }); it("throws for non-existent address", async () => { - pendingWithoutWasmd(); - const client = makeWasmClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeWasmClient(launchpad.endpoint); const nonExistentAddress = makeRandomAddress(); const request = { verifier: {} }; await client.wasm.queryContractSmart(nonExistentAddress, request).then( @@ -370,8 +370,8 @@ describe("WasmExtension", () => { describe("txsQuery", () => { it("can query by tags (module + code_id)", async () => { - pendingWithoutWasmd(); - const client = makeWasmClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeWasmClient(launchpad.endpoint); const result = await client.txsQuery(`message.module=wasm&message.code_id=${deployedHackatom.codeId}`); expect(parseInt(result.count, 10)).toBeGreaterThanOrEqual(4); @@ -420,8 +420,8 @@ describe("WasmExtension", () => { // Like previous test but filtered by message.action=store-code and message.action=instantiate it("can query by tags (module + code_id + action)", async () => { - pendingWithoutWasmd(); - const client = makeWasmClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeWasmClient(launchpad.endpoint); { const uploads = await client.txsQuery( @@ -482,9 +482,9 @@ describe("WasmExtension", () => { describe("broadcastTx", () => { it("can upload, instantiate and execute wasm", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic); - const client = makeWasmClient(wasmd.endpoint); + const client = makeWasmClient(launchpad.endpoint); const transferAmount = [coin(1234, "ucosm"), coin(321, "ustake")]; const beneficiaryAddress = makeRandomAddress(); diff --git a/packages/cosmwasm/src/signingcosmwasmclient.spec.ts b/packages/cosmwasm/src/signingcosmwasmclient.spec.ts index 84bc05fc..c0a917d6 100644 --- a/packages/cosmwasm/src/signingcosmwasmclient.spec.ts +++ b/packages/cosmwasm/src/signingcosmwasmclient.spec.ts @@ -17,7 +17,14 @@ import { assert } from "@cosmjs/utils"; import { PrivateCosmWasmClient } from "./cosmwasmclient"; import { setupWasmExtension, WasmExtension } from "./lcdapi/wasm"; import { PrivateSigningCosmWasmClient, SigningCosmWasmClient, UploadMeta } from "./signingcosmwasmclient"; -import { alice, getHackatom, makeRandomAddress, pendingWithoutWasmd, unused, wasmd } from "./testutils.spec"; +import { + alice, + getHackatom, + launchpad, + makeRandomAddress, + pendingWithoutLaunchpad, + unused, +} from "./testutils.spec"; const httpUrl = "http://localhost:1317"; @@ -230,7 +237,7 @@ describe("SigningCosmWasmClient", () => { describe("getHeight", () => { it("always uses authAccount implementation", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic); const client = new SigningCosmWasmClient(httpUrl, alice.address0, wallet); @@ -248,7 +255,7 @@ describe("SigningCosmWasmClient", () => { describe("upload", () => { it("works", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic); const client = new SigningCosmWasmClient(httpUrl, alice.address0, wallet); const wasm = getHackatom().data; @@ -267,7 +274,7 @@ describe("SigningCosmWasmClient", () => { }); it("can set builder and source", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic); const client = new SigningCosmWasmClient(httpUrl, alice.address0, wallet); const hackatom = getHackatom(); @@ -286,7 +293,7 @@ describe("SigningCosmWasmClient", () => { describe("instantiate", () => { it("works with transfer amount", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic); const client = new SigningCosmWasmClient(httpUrl, alice.address0, wallet); const { codeId } = await client.upload(getHackatom().data); @@ -312,7 +319,7 @@ describe("SigningCosmWasmClient", () => { }); it("works with admin", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic); const client = new SigningCosmWasmClient(httpUrl, alice.address0, wallet); const { codeId } = await client.upload(getHackatom().data); @@ -335,7 +342,7 @@ describe("SigningCosmWasmClient", () => { }); it("can instantiate one code multiple times", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic); const client = new SigningCosmWasmClient(httpUrl, alice.address0, wallet); const { codeId } = await client.upload(getHackatom().data); @@ -362,7 +369,7 @@ describe("SigningCosmWasmClient", () => { describe("updateAdmin", () => { it("can update an admin", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic); const client = new SigningCosmWasmClient(httpUrl, alice.address0, wallet); const { codeId } = await client.upload(getHackatom().data); @@ -395,7 +402,7 @@ describe("SigningCosmWasmClient", () => { describe("clearAdmin", () => { it("can clear an admin", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic); const client = new SigningCosmWasmClient(httpUrl, alice.address0, wallet); const { codeId } = await client.upload(getHackatom().data); @@ -428,7 +435,7 @@ describe("SigningCosmWasmClient", () => { describe("migrate", () => { it("can can migrate from one code ID to another", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic); const client = new SigningCosmWasmClient(httpUrl, alice.address0, wallet); const { codeId: codeId1 } = await client.upload(getHackatom().data); @@ -466,7 +473,7 @@ describe("SigningCosmWasmClient", () => { describe("execute", () => { it("works", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic); const client = new SigningCosmWasmClient(httpUrl, alice.address0, wallet); const { codeId } = await client.upload(getHackatom().data); @@ -507,7 +514,7 @@ describe("SigningCosmWasmClient", () => { describe("sendTokens", () => { it("works", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic); const client = new SigningCosmWasmClient(httpUrl, alice.address0, wallet); @@ -534,7 +541,7 @@ describe("SigningCosmWasmClient", () => { describe("signAndBroadcast", () => { it("works", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic); const client = new SigningCosmWasmClient(httpUrl, alice.address0, wallet); @@ -542,7 +549,7 @@ describe("SigningCosmWasmClient", () => { type: "cosmos-sdk/MsgDelegate", value: { delegator_address: alice.address0, - validator_address: wasmd.validator.address, + validator_address: launchpad.validator.address, amount: coin(1234, "ustake"), }, }; diff --git a/packages/cosmwasm/src/testutils.spec.ts b/packages/cosmwasm/src/testutils.spec.ts index d80c2e55..12ce2198 100644 --- a/packages/cosmwasm/src/testutils.spec.ts +++ b/packages/cosmwasm/src/testutils.spec.ts @@ -53,7 +53,7 @@ export const unused = { sequence: 0, }; -/** Deployed as part of scripts/wasmd/init.sh */ +/** Deployed as part of scripts/launchpad/init.sh */ export const deployedHackatom = { codeId: 1, source: "https://crates.io/api/v1/crates/hackatom/not-yet-released/download", @@ -78,7 +78,7 @@ export const deployedHackatom = { ], }; -/** Deployed as part of scripts/wasmd/init.sh */ +/** Deployed as part of scripts/launchpad/init.sh */ export const deployedErc20 = { codeId: 2, source: "https://crates.io/api/v1/crates/cw-erc20/0.7.0/download", @@ -91,7 +91,7 @@ export const deployedErc20 = { ], }; -export const wasmd = { +export const launchpad = { endpoint: "http://localhost:1317", chainId: "testing", validator: { @@ -99,13 +99,13 @@ export const wasmd = { }, }; -export function wasmdEnabled(): boolean { - return !!process.env.WASMD_ENABLED; +export function launchpadEnabled(): boolean { + return !!process.env.LAUNCHPAD_ENABLED; } -export function pendingWithoutWasmd(): void { - if (!wasmdEnabled()) { - return pending("Set WASMD_ENABLED to enable Wasmd based tests"); +export function pendingWithoutLaunchpad(): void { + if (!launchpadEnabled()) { + return pending("Set LAUNCHPAD_ENABLED to enable Launchpad-based tests"); } } @@ -115,7 +115,7 @@ export function erc20Enabled(): boolean { export function pendingWithoutErc20(): void { if (!erc20Enabled()) { - return pending("Set ERC20_ENABLED to enable Wasmd based tests"); + return pending("Set ERC20_ENABLED to enable ERC20-based tests"); } } diff --git a/packages/cosmwasm/webpack.web.config.js b/packages/cosmwasm/webpack.web.config.js index ced780a8..2cda344b 100644 --- a/packages/cosmwasm/webpack.web.config.js +++ b/packages/cosmwasm/webpack.web.config.js @@ -14,6 +14,6 @@ module.exports = [ path: distdir, filename: "tests.js", }, - plugins: [new webpack.EnvironmentPlugin(["WASMD_ENABLED", "ERC20_ENABLED"])], + plugins: [new webpack.EnvironmentPlugin(["LAUNCHPAD_ENABLED", "ERC20_ENABLED"])], }, ]; diff --git a/packages/faucet-client/README.md b/packages/faucet-client/README.md index 5d39b9a2..8c81941a 100644 --- a/packages/faucet-client/README.md +++ b/packages/faucet-client/README.md @@ -8,7 +8,7 @@ First of all you will need an instance of wasmd running. From the root directory of this repository: ```sh -./scripts/wasmd/start.sh && ./scripts/wasmd/init.sh +./scripts/launchpad/start.sh && ./scripts/launchpad/init.sh ``` You will also need a faucet. From the root directory of this repository: diff --git a/packages/faucet/src/faucet.spec.ts b/packages/faucet/src/faucet.spec.ts index dac80440..b3fd2757 100644 --- a/packages/faucet/src/faucet.spec.ts +++ b/packages/faucet/src/faucet.spec.ts @@ -7,9 +7,9 @@ import { assert } from "@cosmjs/utils"; import { Faucet } from "./faucet"; import { TokenConfiguration } from "./tokenmanager"; -function pendingWithoutWasmd(): void { - if (!process.env.WASMD_ENABLED) { - return pending("Set WASMD_ENABLED to enable Cosmos node-based tests"); +function pendingWithoutLaunchpad(): void { + if (!process.env.LAUNCHPAD_ENABLED) { + return pending("Set LAUNCHPAD_ENABLED to enable Launchpad node-based tests"); } } @@ -38,7 +38,7 @@ describe("Faucet", () => { describe("constructor", () => { it("can be constructed", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const faucet = await Faucet.make( apiUrl, defaultAddressPrefix, @@ -53,7 +53,7 @@ describe("Faucet", () => { describe("availableTokens", () => { it("is empty when no tokens are configured", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const faucet = await Faucet.make( apiUrl, defaultAddressPrefix, @@ -67,7 +67,7 @@ describe("Faucet", () => { }); it("is not empty with default token config", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const faucet = await Faucet.make( apiUrl, defaultAddressPrefix, @@ -83,7 +83,7 @@ describe("Faucet", () => { describe("send", () => { it("can send bank token", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const faucet = await Faucet.make( apiUrl, defaultAddressPrefix, @@ -116,7 +116,7 @@ describe("Faucet", () => { describe("refill", () => { it("works", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const faucet = await Faucet.make( apiUrl, defaultAddressPrefix, @@ -144,7 +144,7 @@ describe("Faucet", () => { describe("credit", () => { it("works for fee token", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const faucet = await Faucet.make( apiUrl, defaultAddressPrefix, @@ -168,7 +168,7 @@ describe("Faucet", () => { }); it("works for stake token", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const faucet = await Faucet.make( apiUrl, defaultAddressPrefix, @@ -194,7 +194,7 @@ describe("Faucet", () => { describe("configuredTokens", () => { it("works", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const faucet = await Faucet.make( apiUrl, defaultAddressPrefix, @@ -210,7 +210,7 @@ describe("Faucet", () => { describe("loadAccounts", () => { it("works", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const faucet = await Faucet.make( apiUrl, defaultAddressPrefix, diff --git a/packages/launchpad-ledger/README.md b/packages/launchpad-ledger/README.md index 71c35023..cb842f71 100644 --- a/packages/launchpad-ledger/README.md +++ b/packages/launchpad-ledger/README.md @@ -49,17 +49,17 @@ Then follow the instructions on that page. The tests in this package require a Ledger device [initialized with the mnemonic](https://support.ledger.com/hc/en-us/articles/360005434914) from -[scripts/wasmd/README.md#preset-accounts](https://github.com/CosmWasm/cosmjs/blob/master/scripts/wasmd/README.md#preset-accounts) +[scripts/launchpad/README.md#preset-accounts](https://github.com/CosmWasm/cosmjs/blob/master/scripts/launchpad/README.md#preset-accounts) (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 wasmd blockchain as described in -[scripts/wasmd/README.md](https://github.com/CosmWasm/cosmjs/blob/master/scripts/wasmd/README.md) +transactions. Start a local Launchpad blockchain as described in +[scripts/launchpad/README.md](https://github.com/CosmWasm/cosmjs/blob/master/scripts/launchpad/README.md) and execute: ```sh export LEDGER_ENABLED=1 -export WASMD_ENABLED=1 +export LAUNCHPAD_ENABLED=1 yarn test ``` diff --git a/packages/launchpad-ledger/src/ledgersigner.spec.ts b/packages/launchpad-ledger/src/ledgersigner.spec.ts index 5348fc41..5ac1d1fa 100644 --- a/packages/launchpad-ledger/src/ledgersigner.spec.ts +++ b/packages/launchpad-ledger/src/ledgersigner.spec.ts @@ -15,7 +15,7 @@ import { assert, sleep } from "@cosmjs/utils"; import Transport from "@ledgerhq/hw-transport"; import { LedgerSigner } from "./ledgersigner"; -import { pendingWithoutLedger, pendingWithoutWasmd, wasmd } from "./testutils.spec"; +import { launchpad, pendingWithoutLaunchpad, pendingWithoutLedger } from "./testutils.spec"; const interactiveTimeout = 120_000; @@ -136,14 +136,14 @@ describe("LedgerSigner", () => { "creates signature accepted by launchpad backend", async () => { pendingWithoutLedger(); - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const signer = new LedgerSigner(transport, { testModeAllowed: true, hdPaths: [makeCosmoshubPath(0), makeCosmoshubPath(1), makeCosmoshubPath(10)], }); const [fistAccount] = await signer.getAccounts(); - const client = new SigningCosmosClient(wasmd.endpoint, fistAccount.address, signer); + const client = new SigningCosmosClient(launchpad.endpoint, fistAccount.address, signer); const result = await client.sendTokens(defaultRecipient, coins(1234567, "ucosm")); assert(isBroadcastTxSuccess(result)); }, diff --git a/packages/launchpad-ledger/src/testutils.spec.ts b/packages/launchpad-ledger/src/testutils.spec.ts index d9b011b3..e29cc1c1 100644 --- a/packages/launchpad-ledger/src/testutils.spec.ts +++ b/packages/launchpad-ledger/src/testutils.spec.ts @@ -4,21 +4,21 @@ export function ledgerEnabled(): boolean { export function pendingWithoutLedger(): void { if (!ledgerEnabled()) { - return pending("Set LEDGER_ENABLED to enable Wasmd based tests"); + return pending("Set LEDGER_ENABLED to enable Ledger-based tests"); } } -export function wasmdEnabled(): boolean { - return !!process.env.WASMD_ENABLED; +export function launchpadEnabled(): boolean { + return !!process.env.LAUNCHPAD_ENABLED; } -export function pendingWithoutWasmd(): void { - if (!wasmdEnabled()) { - return pending("Set WASMD_ENABLED to enable Wasmd based tests"); +export function pendingWithoutLaunchpad(): void { + if (!launchpadEnabled()) { + return pending("Set LAUNCHPAD_ENABLED to enable Launchpad-based tests"); } } -export const wasmd = { +export const launchpad = { endpoint: "http://localhost:1317", chainId: "testing", }; diff --git a/packages/launchpad/src/cosmosclient.searchtx.spec.ts b/packages/launchpad/src/cosmosclient.searchtx.spec.ts index 5f5aa775..36445f5c 100644 --- a/packages/launchpad/src/cosmosclient.searchtx.spec.ts +++ b/packages/launchpad/src/cosmosclient.searchtx.spec.ts @@ -11,10 +11,10 @@ import { SigningCosmosClient } from "./signingcosmosclient"; import { faucet, fromOneElementArray, + launchpad, + launchpadEnabled, makeRandomAddress, - pendingWithoutWasmd, - wasmd, - wasmdEnabled, + pendingWithoutLaunchpad, } from "./testutils.spec"; import { makeStdTx, WrappedStdTx } from "./tx"; @@ -31,11 +31,11 @@ describe("CosmosClient.searchTx", () => { let sendSuccessful: TestTxSend | undefined; beforeAll(async () => { - if (wasmdEnabled()) { + if (launchpadEnabled()) { const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); const accounts = await wallet.getAccounts(); const [{ address: walletAddress }] = accounts; - const client = new SigningCosmosClient(wasmd.endpoint, faucet.address, wallet); + const client = new SigningCosmosClient(launchpad.endpoint, faucet.address, wallet); { const memo = "Sending more than I can afford"; @@ -79,7 +79,7 @@ describe("CosmosClient.searchTx", () => { const transferAmount = coins(1234567, "ucosm"); const result = await client.sendTokens(recipient, transferAmount); await sleep(75); // wait until tx is indexed - const txDetails = await new LcdClient(wasmd.endpoint).txById(result.transactionHash); + const txDetails = await new LcdClient(launchpad.endpoint).txById(result.transactionHash); sendSuccessful = { sender: faucet.address, recipient: recipient, @@ -93,9 +93,9 @@ describe("CosmosClient.searchTx", () => { describe("with SearchByIdQuery", () => { it("can search successful tx by ID", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(sendSuccessful, "value must be set in beforeAll()"); - const client = new CosmosClient(wasmd.endpoint); + const client = new CosmosClient(launchpad.endpoint); const result = await client.searchTx({ id: sendSuccessful.hash }); expect(result.length).toEqual(1); expect(result[0]).toEqual( @@ -109,9 +109,9 @@ describe("CosmosClient.searchTx", () => { }); it("can search unsuccessful tx by ID", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(sendUnsuccessful, "value must be set in beforeAll()"); - const client = new CosmosClient(wasmd.endpoint); + const client = new CosmosClient(launchpad.endpoint); const result = await client.searchTx({ id: sendUnsuccessful.hash }); expect(result.length).toEqual(1); expect(result[0]).toEqual( @@ -125,17 +125,17 @@ describe("CosmosClient.searchTx", () => { }); it("can search by ID (non existent)", async () => { - pendingWithoutWasmd(); - const client = new CosmosClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new CosmosClient(launchpad.endpoint); const nonExistentId = "0000000000000000000000000000000000000000000000000000000000000000"; const result = await client.searchTx({ id: nonExistentId }); expect(result.length).toEqual(0); }); it("can search by ID and filter by minHeight", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(sendSuccessful); - const client = new CosmosClient(wasmd.endpoint); + const client = new CosmosClient(launchpad.endpoint); const query = { id: sendSuccessful.hash }; { @@ -162,9 +162,9 @@ describe("CosmosClient.searchTx", () => { describe("with SearchByHeightQuery", () => { it("can search successful tx by height", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(sendSuccessful, "value must be set in beforeAll()"); - const client = new CosmosClient(wasmd.endpoint); + const client = new CosmosClient(launchpad.endpoint); const result = await client.searchTx({ height: sendSuccessful.height }); expect(result.length).toBeGreaterThanOrEqual(1); expect(result).toContain( @@ -178,9 +178,9 @@ describe("CosmosClient.searchTx", () => { }); it("can search unsuccessful tx by height", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(sendUnsuccessful, "value must be set in beforeAll()"); - const client = new CosmosClient(wasmd.endpoint); + const client = new CosmosClient(launchpad.endpoint); const result = await client.searchTx({ height: sendUnsuccessful.height }); expect(result.length).toBeGreaterThanOrEqual(1); expect(result).toContain( @@ -196,9 +196,9 @@ describe("CosmosClient.searchTx", () => { describe("with SearchBySentFromOrToQuery", () => { it("can search by sender", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(sendSuccessful, "value must be set in beforeAll()"); - const client = new CosmosClient(wasmd.endpoint); + const client = new CosmosClient(launchpad.endpoint); const results = await client.searchTx({ sentFromOrTo: sendSuccessful.sender }); expect(results.length).toBeGreaterThanOrEqual(1); @@ -224,9 +224,9 @@ describe("CosmosClient.searchTx", () => { }); it("can search by recipient", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(sendSuccessful, "value must be set in beforeAll()"); - const client = new CosmosClient(wasmd.endpoint); + const client = new CosmosClient(launchpad.endpoint); const results = await client.searchTx({ sentFromOrTo: sendSuccessful.recipient }); expect(results.length).toBeGreaterThanOrEqual(1); @@ -251,9 +251,9 @@ describe("CosmosClient.searchTx", () => { }); it("can search by recipient and filter by minHeight", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(sendSuccessful); - const client = new CosmosClient(wasmd.endpoint); + const client = new CosmosClient(launchpad.endpoint); const query = { sentFromOrTo: sendSuccessful.recipient }; { @@ -278,9 +278,9 @@ describe("CosmosClient.searchTx", () => { }); it("can search by recipient and filter by maxHeight", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(sendSuccessful); - const client = new CosmosClient(wasmd.endpoint); + const client = new CosmosClient(launchpad.endpoint); const query = { sentFromOrTo: sendSuccessful.recipient }; { @@ -307,9 +307,9 @@ describe("CosmosClient.searchTx", () => { describe("with SearchByTagsQuery", () => { it("can search by transfer.recipient", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(sendSuccessful, "value must be set in beforeAll()"); - const client = new CosmosClient(wasmd.endpoint); + const client = new CosmosClient(launchpad.endpoint); const results = await client.searchTx({ tags: [{ key: "transfer.recipient", value: sendSuccessful.recipient }], }); diff --git a/packages/launchpad/src/cosmosclient.spec.ts b/packages/launchpad/src/cosmosclient.spec.ts index dc621fd4..3ddd815c 100644 --- a/packages/launchpad/src/cosmosclient.spec.ts +++ b/packages/launchpad/src/cosmosclient.spec.ts @@ -10,11 +10,11 @@ import { Secp256k1HdWallet } from "./secp256k1hdwallet"; import cosmoshub from "./testdata/cosmoshub.json"; import { faucet, + launchpad, makeRandomAddress, - pendingWithoutWasmd, + pendingWithoutLaunchpad, tendermintIdMatcher, unused, - wasmd, } from "./testutils.spec"; import { isWrappedStdTx, makeStdTx } from "./tx"; import { StdFee } from "./types"; @@ -28,26 +28,26 @@ const guest = { describe("CosmosClient", () => { describe("constructor", () => { it("can be constructed", () => { - const client = new CosmosClient(wasmd.endpoint); + const client = new CosmosClient(launchpad.endpoint); expect(client).toBeTruthy(); }); }); describe("getChainId", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = new CosmosClient(wasmd.endpoint); - expect(await client.getChainId()).toEqual(wasmd.chainId); + pendingWithoutLaunchpad(); + const client = new CosmosClient(launchpad.endpoint); + expect(await client.getChainId()).toEqual(launchpad.chainId); }); it("caches chain ID", async () => { - pendingWithoutWasmd(); - const client = new CosmosClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new CosmosClient(launchpad.endpoint); const openedClient = (client as unknown) as PrivateCosmosClient; const getCodeSpy = spyOn(openedClient.lcdClient, "nodeInfo").and.callThrough(); - expect(await client.getChainId()).toEqual(wasmd.chainId); // from network - expect(await client.getChainId()).toEqual(wasmd.chainId); // from cache + expect(await client.getChainId()).toEqual(launchpad.chainId); // from network + expect(await client.getChainId()).toEqual(launchpad.chainId); // from cache expect(getCodeSpy).toHaveBeenCalledTimes(1); }); @@ -55,8 +55,8 @@ describe("CosmosClient", () => { describe("getHeight", () => { it("gets height via last block", async () => { - pendingWithoutWasmd(); - const client = new CosmosClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new CosmosClient(launchpad.endpoint); const openedClient = (client as unknown) as PrivateCosmosClient; const blockLatestSpy = spyOn(openedClient.lcdClient, "blocksLatest").and.callThrough(); @@ -71,8 +71,8 @@ describe("CosmosClient", () => { }); it("gets height via authAccount once an address is known", async () => { - pendingWithoutWasmd(); - const client = new CosmosClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new CosmosClient(launchpad.endpoint); const openedClient = (client as unknown) as PrivateCosmosClient; const blockLatestSpy = spyOn(openedClient.lcdClient, "blocksLatest").and.callThrough(); @@ -97,8 +97,8 @@ describe("CosmosClient", () => { describe("getSequence", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = new CosmosClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new CosmosClient(launchpad.endpoint); expect(await client.getSequence(unused.address)).toEqual({ accountNumber: unused.accountNumber, sequence: unused.sequence, @@ -106,8 +106,8 @@ describe("CosmosClient", () => { }); it("throws for missing accounts", async () => { - pendingWithoutWasmd(); - const client = new CosmosClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new CosmosClient(launchpad.endpoint); const missing = makeRandomAddress(); await client.getSequence(missing).then( () => fail("this must not succeed"), @@ -118,8 +118,8 @@ describe("CosmosClient", () => { describe("getAccount", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = new CosmosClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new CosmosClient(launchpad.endpoint); expect(await client.getAccount(unused.address)).toEqual({ address: unused.address, accountNumber: unused.accountNumber, @@ -133,8 +133,8 @@ describe("CosmosClient", () => { }); it("returns undefined for missing accounts", async () => { - pendingWithoutWasmd(); - const client = new CosmosClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new CosmosClient(launchpad.endpoint); const missing = makeRandomAddress(); expect(await client.getAccount(missing)).toBeUndefined(); }); @@ -142,8 +142,8 @@ describe("CosmosClient", () => { describe("getBlock", () => { it("works for latest block", async () => { - pendingWithoutWasmd(); - const client = new CosmosClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new CosmosClient(launchpad.endpoint); const response = await client.getBlock(); expect(response).toEqual( @@ -164,8 +164,8 @@ describe("CosmosClient", () => { }); it("works for block by height", async () => { - pendingWithoutWasmd(); - const client = new CosmosClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new CosmosClient(launchpad.endpoint); const height = (await client.getBlock()).header.height; const response = await client.getBlock(height - 1); @@ -189,8 +189,8 @@ describe("CosmosClient", () => { describe("getIdentifier", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = new CosmosClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new CosmosClient(launchpad.endpoint); assert(isWrappedStdTx(cosmoshub.tx)); expect(await client.getIdentifier(cosmoshub.tx)).toEqual(cosmoshub.id); }); @@ -198,11 +198,11 @@ describe("CosmosClient", () => { describe("broadcastTx", () => { it("works", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); const accounts = await wallet.getAccounts(); const [{ address: walletAddress }] = accounts; - const client = new CosmosClient(wasmd.endpoint); + const client = new CosmosClient(launchpad.endpoint); const memo = "Test send"; const sendMsg: MsgSend = { diff --git a/packages/launchpad/src/lcdapi/auth.spec.ts b/packages/launchpad/src/lcdapi/auth.spec.ts index e5723697..3dc13c28 100644 --- a/packages/launchpad/src/lcdapi/auth.spec.ts +++ b/packages/launchpad/src/lcdapi/auth.spec.ts @@ -1,11 +1,11 @@ /* eslint-disable @typescript-eslint/naming-convention */ import { faucet, + launchpad, makeRandomAddress, nonNegativeIntegerMatcher, - pendingWithoutWasmd, + pendingWithoutLaunchpad, unused, - wasmd, } from "../testutils.spec"; import { AuthExtension, setupAuthExtension } from "./auth"; import { LcdClient } from "./lcdclient"; @@ -16,8 +16,8 @@ function makeAuthClient(apiUrl: string): LcdClient & AuthExtension { describe("AuthExtension", () => { it("works for unused account without pubkey", async () => { - pendingWithoutWasmd(); - const client = makeAuthClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeAuthClient(launchpad.endpoint); const { height, result } = await client.auth.account(unused.address); expect(height).toMatch(nonNegativeIntegerMatcher); expect(result).toEqual({ @@ -41,10 +41,10 @@ describe("AuthExtension", () => { }); }); - // This fails in the first test run if you forget to run `./scripts/wasmd/init.sh` + // This fails in the first test run if you forget to run `./scripts/launchpad/init.sh` it("has correct pubkey for faucet", async () => { - pendingWithoutWasmd(); - const client = makeAuthClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeAuthClient(launchpad.endpoint); const { result } = await client.auth.account(faucet.address); expect(result.value).toEqual( jasmine.objectContaining({ @@ -55,8 +55,8 @@ describe("AuthExtension", () => { // This property is used by CosmWasmClient.getAccount it("returns empty address for non-existent account", async () => { - pendingWithoutWasmd(); - const client = makeAuthClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeAuthClient(launchpad.endpoint); const nonExistentAccount = makeRandomAddress(); const { result } = await client.auth.account(nonExistentAccount); expect(result).toEqual({ diff --git a/packages/launchpad/src/lcdapi/bank.spec.ts b/packages/launchpad/src/lcdapi/bank.spec.ts index b440b589..9a7f305a 100644 --- a/packages/launchpad/src/lcdapi/bank.spec.ts +++ b/packages/launchpad/src/lcdapi/bank.spec.ts @@ -1,9 +1,9 @@ import { + launchpad, makeRandomAddress, nonNegativeIntegerMatcher, - pendingWithoutWasmd, + pendingWithoutLaunchpad, unused, - wasmd, } from "../testutils.spec"; import { BankExtension, setupBankExtension } from "./bank"; import { LcdClient } from "./lcdclient"; @@ -14,8 +14,8 @@ function makeBankClient(apiUrl: string): LcdClient & BankExtension { describe("BankExtension", () => { it("returns correct values for the unused account", async () => { - pendingWithoutWasmd(); - const client = makeBankClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeBankClient(launchpad.endpoint); const balances = await client.bank.balances(unused.address); expect(balances).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), @@ -33,8 +33,8 @@ describe("BankExtension", () => { }); it("returns an empty result for a non-existent account", async () => { - pendingWithoutWasmd(); - const client = makeBankClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeBankClient(launchpad.endpoint); const nonExistentAddress = makeRandomAddress(); const balances = await client.bank.balances(nonExistentAddress); expect(balances).toEqual({ diff --git a/packages/launchpad/src/lcdapi/distribution.spec.ts b/packages/launchpad/src/lcdapi/distribution.spec.ts index ec5016fb..55eb96b9 100644 --- a/packages/launchpad/src/lcdapi/distribution.spec.ts +++ b/packages/launchpad/src/lcdapi/distribution.spec.ts @@ -11,10 +11,10 @@ import { SigningCosmosClient } from "../signingcosmosclient"; import { bigDecimalMatcher, faucet, + launchpad, + launchpadEnabled, nonNegativeIntegerMatcher, - pendingWithoutWasmd, - wasmd, - wasmdEnabled, + pendingWithoutLaunchpad, } from "../testutils.spec"; import { makeStdTx } from "../tx"; import { DistributionExtension, setupDistributionExtension } from "./distribution"; @@ -31,20 +31,20 @@ describe("DistributionExtension", () => { }; beforeAll(async () => { - if (wasmdEnabled()) { + if (launchpadEnabled()) { const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); - const client = new SigningCosmosClient(wasmd.endpoint, faucet.address, wallet); + const client = new SigningCosmosClient(launchpad.endpoint, faucet.address, wallet); const chainId = await client.getChainId(); const msg: MsgDelegate = { type: "cosmos-sdk/MsgDelegate", value: { delegator_address: faucet.address, - validator_address: wasmd.validator.address, + validator_address: launchpad.validator.address, amount: coin(25000, "ustake"), }, }; - const memo = "Test delegation for wasmd"; + const memo = "Test delegation for launchpad"; const { accountNumber, sequence } = await client.getSequence(); const signDoc = makeSignDoc([msg], defaultFee, chainId, memo, accountNumber, sequence); const { signed, signature } = await wallet.signAmino(faucet.address, signDoc); @@ -59,15 +59,15 @@ describe("DistributionExtension", () => { describe("delegatorRewards", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeDistributionClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeDistributionClient(launchpad.endpoint); const response = await client.distribution.delegatorRewards(faucet.address); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), result: { rewards: [ { - validator_address: wasmd.validator.address, + validator_address: launchpad.validator.address, reward: null, }, ], @@ -79,9 +79,9 @@ describe("DistributionExtension", () => { describe("delegatorReward", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeDistributionClient(wasmd.endpoint); - const response = await client.distribution.delegatorReward(faucet.address, wasmd.validator.address); + pendingWithoutLaunchpad(); + const client = makeDistributionClient(launchpad.endpoint); + const response = await client.distribution.delegatorReward(faucet.address, launchpad.validator.address); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), result: [], @@ -91,8 +91,8 @@ describe("DistributionExtension", () => { describe("withdrawAddress", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeDistributionClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeDistributionClient(launchpad.endpoint); const response = await client.distribution.withdrawAddress(faucet.address); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), @@ -103,14 +103,14 @@ describe("DistributionExtension", () => { describe("validator", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeDistributionClient(wasmd.endpoint); - const response = await client.distribution.validator(wasmd.validator.address); + pendingWithoutLaunchpad(); + const client = makeDistributionClient(launchpad.endpoint); + const response = await client.distribution.validator(launchpad.validator.address); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), result: { // TODO: This smells like a bug in the backend to me - operator_address: Bech32.encode("cosmos", Bech32.decode(wasmd.validator.address).data), + operator_address: Bech32.encode("cosmos", Bech32.decode(launchpad.validator.address).data), self_bond_rewards: [ { denom: "ucosm", amount: jasmine.stringMatching(bigDecimalMatcher) }, { denom: "ustake", amount: jasmine.stringMatching(bigDecimalMatcher) }, @@ -126,9 +126,9 @@ describe("DistributionExtension", () => { describe("validatorRewards", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeDistributionClient(wasmd.endpoint); - const response = await client.distribution.validatorRewards(wasmd.validator.address); + pendingWithoutLaunchpad(); + const client = makeDistributionClient(launchpad.endpoint); + const response = await client.distribution.validatorRewards(launchpad.validator.address); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), result: [ @@ -141,9 +141,9 @@ describe("DistributionExtension", () => { describe("validatorOutstandingRewards", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeDistributionClient(wasmd.endpoint); - const response = await client.distribution.validatorOutstandingRewards(wasmd.validator.address); + pendingWithoutLaunchpad(); + const client = makeDistributionClient(launchpad.endpoint); + const response = await client.distribution.validatorOutstandingRewards(launchpad.validator.address); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), result: [ @@ -156,8 +156,8 @@ describe("DistributionExtension", () => { describe("parameters", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeDistributionClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeDistributionClient(launchpad.endpoint); const response = await client.distribution.parameters(); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), @@ -173,8 +173,8 @@ describe("DistributionExtension", () => { describe("communityPool", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeDistributionClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeDistributionClient(launchpad.endpoint); const response = await client.distribution.communityPool(); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), diff --git a/packages/launchpad/src/lcdapi/gov.spec.ts b/packages/launchpad/src/lcdapi/gov.spec.ts index 38226377..05ad57b7 100644 --- a/packages/launchpad/src/lcdapi/gov.spec.ts +++ b/packages/launchpad/src/lcdapi/gov.spec.ts @@ -9,10 +9,10 @@ import { SigningCosmosClient } from "../signingcosmosclient"; import { dateTimeStampMatcher, faucet, + launchpad, + launchpadEnabled, nonNegativeIntegerMatcher, - pendingWithoutWasmd, - wasmd, - wasmdEnabled, + pendingWithoutLaunchpad, } from "../testutils.spec"; import { GovExtension, GovParametersType, setupGovExtension } from "./gov"; import { LcdClient } from "./lcdclient"; @@ -29,9 +29,9 @@ describe("GovExtension", () => { let proposalId: string; beforeAll(async () => { - if (wasmdEnabled()) { + if (launchpadEnabled()) { const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); - const client = new SigningCosmosClient(wasmd.endpoint, faucet.address, wallet); + const client = new SigningCosmosClient(launchpad.endpoint, faucet.address, wallet); const chainId = await client.getChainId(); const proposalMsg = { @@ -105,8 +105,8 @@ describe("GovExtension", () => { describe("parameters", () => { it("works for deposit", async () => { - pendingWithoutWasmd(); - const client = makeGovClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeGovClient(launchpad.endpoint); const paramsType = GovParametersType.Deposit; const response = await client.gov.parameters(paramsType); expect(response).toEqual({ @@ -119,8 +119,8 @@ describe("GovExtension", () => { }); it("works for tallying", async () => { - pendingWithoutWasmd(); - const client = makeGovClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeGovClient(launchpad.endpoint); const paramsType = GovParametersType.Tallying; const response = await client.gov.parameters(paramsType); expect(response).toEqual({ @@ -134,8 +134,8 @@ describe("GovExtension", () => { }); it("works for voting", async () => { - pendingWithoutWasmd(); - const client = makeGovClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeGovClient(launchpad.endpoint); const paramsType = GovParametersType.Voting; const response = await client.gov.parameters(paramsType); expect(response).toEqual({ @@ -149,8 +149,8 @@ describe("GovExtension", () => { describe("proposals", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeGovClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeGovClient(launchpad.endpoint); const response = await client.gov.proposals(); expect(response.height).toMatch(nonNegativeIntegerMatcher); expect(response.result.length).toBeGreaterThanOrEqual(1); @@ -176,8 +176,8 @@ describe("GovExtension", () => { describe("proposal", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeGovClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeGovClient(launchpad.endpoint); const response = await client.gov.proposal(proposalId); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), @@ -204,8 +204,8 @@ describe("GovExtension", () => { describe("proposer", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeGovClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeGovClient(launchpad.endpoint); const response = await client.gov.proposer(proposalId); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), @@ -219,8 +219,8 @@ describe("GovExtension", () => { describe("deposits", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeGovClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeGovClient(launchpad.endpoint); const response = await client.gov.deposits(proposalId); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), @@ -237,8 +237,8 @@ describe("GovExtension", () => { describe("deposit", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeGovClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeGovClient(launchpad.endpoint); const response = await client.gov.deposit(proposalId, faucet.address); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), @@ -253,8 +253,8 @@ describe("GovExtension", () => { describe("tally", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeGovClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeGovClient(launchpad.endpoint); const response = await client.gov.tally(proposalId); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), @@ -270,8 +270,8 @@ describe("GovExtension", () => { describe("votes", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeGovClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeGovClient(launchpad.endpoint); const response = await client.gov.votes(proposalId); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), @@ -288,8 +288,8 @@ describe("GovExtension", () => { describe("vote", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeGovClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeGovClient(launchpad.endpoint); const response = await client.gov.vote(proposalId, faucet.address); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), diff --git a/packages/launchpad/src/lcdapi/lcdclient.spec.ts b/packages/launchpad/src/lcdapi/lcdclient.spec.ts index 9736b24b..a50fb4a4 100644 --- a/packages/launchpad/src/lcdapi/lcdclient.spec.ts +++ b/packages/launchpad/src/lcdapi/lcdclient.spec.ts @@ -11,13 +11,13 @@ import { SigningCosmosClient } from "../signingcosmosclient"; import cosmoshub from "../testdata/cosmoshub.json"; import { faucet, + launchpad, + launchpadEnabled, makeRandomAddress, nonNegativeIntegerMatcher, - pendingWithoutWasmd, + pendingWithoutLaunchpad, tendermintIdMatcher, unused, - wasmd, - wasmdEnabled, } from "../testutils.spec"; import { isWrappedStdTx, makeStdTx, StdTx } from "../tx"; import { StdFee } from "../types"; @@ -30,7 +30,7 @@ describe("LcdClient", () => { const defaultRecipientAddress = makeRandomAddress(); it("can be constructed", () => { - const client = new LcdClient(wasmd.endpoint); + const client = new LcdClient(launchpad.endpoint); expect(client).toBeTruthy(); }); @@ -74,14 +74,14 @@ describe("LcdClient", () => { } it("works for no extension", async () => { - const client = LcdClient.withExtensions({ apiUrl: wasmd.endpoint }); + const client = LcdClient.withExtensions({ apiUrl: launchpad.endpoint }); expect(client).toBeTruthy(); }); it("works for one extension", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); - const client = LcdClient.withExtensions({ apiUrl: wasmd.endpoint }, setupSupplyExtension); + const client = LcdClient.withExtensions({ apiUrl: launchpad.endpoint }, setupSupplyExtension); const supply = await client.supply.totalAll(); expect(supply).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), @@ -99,10 +99,10 @@ describe("LcdClient", () => { }); it("works for two extensions", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const client = LcdClient.withExtensions( - { apiUrl: wasmd.endpoint }, + { apiUrl: launchpad.endpoint }, setupSupplyExtension, setupBankExtension, ); @@ -137,7 +137,7 @@ describe("LcdClient", () => { }); it("can merge two extensions into the same module", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); // eslint-disable-next-line @typescript-eslint/explicit-function-return-type function setupSupplyExtensionBasic(base: LcdClient) { @@ -163,7 +163,7 @@ describe("LcdClient", () => { } const client = LcdClient.withExtensions( - { apiUrl: wasmd.endpoint }, + { apiUrl: launchpad.endpoint }, setupSupplyExtensionBasic, setupSupplyExtensionPremium, ); @@ -191,11 +191,11 @@ describe("LcdClient", () => { | undefined; beforeAll(async () => { - if (wasmdEnabled()) { + if (launchpadEnabled()) { const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); const accounts = await wallet.getAccounts(); const [{ address: walletAddress }] = accounts; - const client = new SigningCosmosClient(wasmd.endpoint, faucet.address, wallet); + const client = new SigningCosmosClient(launchpad.endpoint, faucet.address, wallet); { const recipient = makeRandomAddress(); @@ -257,9 +257,9 @@ describe("LcdClient", () => { }); it("works for successful transaction", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(successful); - const client = new LcdClient(wasmd.endpoint); + const client = new LcdClient(launchpad.endpoint); const result = await client.txById(successful.hash); expect(result.height).toBeGreaterThanOrEqual(1); expect(result.txhash).toEqual(successful.hash); @@ -293,9 +293,9 @@ describe("LcdClient", () => { }); it("works for unsuccessful transaction", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(unsuccessful); - const client = new LcdClient(wasmd.endpoint); + const client = new LcdClient(launchpad.endpoint); const result = await client.txById(unsuccessful.hash); expect(result.height).toBeGreaterThanOrEqual(1); expect(result.txhash).toEqual(unsuccessful.hash); @@ -318,9 +318,9 @@ describe("LcdClient", () => { | undefined; beforeAll(async () => { - if (wasmdEnabled()) { + if (launchpadEnabled()) { const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); - const client = new SigningCosmosClient(wasmd.endpoint, faucet.address, wallet); + const client = new SigningCosmosClient(launchpad.endpoint, faucet.address, wallet); const recipient = makeRandomAddress(); const transferAmount = [ @@ -332,7 +332,7 @@ describe("LcdClient", () => { const result = await client.sendTokens(recipient, transferAmount); await sleep(75); // wait until tx is indexed - const txDetails = await new LcdClient(wasmd.endpoint).txById(result.transactionHash); + const txDetails = await new LcdClient(launchpad.endpoint).txById(result.transactionHash); broadcasted = { sender: faucet.address, recipient: recipient, @@ -344,9 +344,9 @@ describe("LcdClient", () => { }); it("can query transactions by height", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(broadcasted); - const client = new LcdClient(wasmd.endpoint); + const client = new LcdClient(launchpad.endpoint); const result = await client.txsQuery(`tx.height=${broadcasted.height}&limit=26`); expect(result).toEqual({ count: jasmine.stringMatching(/^(1|2|3|4|5)$/), // 1-5 transactions as string @@ -359,9 +359,9 @@ describe("LcdClient", () => { }); it("can query transactions by ID", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(broadcasted); - const client = new LcdClient(wasmd.endpoint); + const client = new LcdClient(launchpad.endpoint); const result = await client.txsQuery(`tx.hash=${broadcasted.hash}&limit=26`); expect(result).toEqual({ count: "1", @@ -374,9 +374,9 @@ describe("LcdClient", () => { }); it("can query transactions by sender", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(broadcasted); - const client = new LcdClient(wasmd.endpoint); + const client = new LcdClient(launchpad.endpoint); const result = await client.txsQuery(`message.sender=${broadcasted.sender}&limit=200`); expect(parseInt(result.count, 10)).toBeGreaterThanOrEqual(1); expect(parseInt(result.limit, 10)).toEqual(200); @@ -388,9 +388,9 @@ describe("LcdClient", () => { }); it("can query transactions by recipient", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(broadcasted); - const client = new LcdClient(wasmd.endpoint); + const client = new LcdClient(launchpad.endpoint); const result = await client.txsQuery(`transfer.recipient=${broadcasted.recipient}&limit=200`); expect(parseInt(result.count, 10)).toEqual(1); expect(parseInt(result.limit, 10)).toEqual(200); @@ -403,9 +403,9 @@ describe("LcdClient", () => { it("can filter by tx.hash and tx.minheight", async () => { pending("This combination is broken 🤷‍♂️. Handle client-side at higher level."); - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(broadcasted); - const client = new LcdClient(wasmd.endpoint); + const client = new LcdClient(launchpad.endpoint); const hashQuery = `tx.hash=${broadcasted.hash}`; { @@ -430,9 +430,9 @@ describe("LcdClient", () => { }); it("can filter by recipient and tx.minheight", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(broadcasted); - const client = new LcdClient(wasmd.endpoint); + const client = new LcdClient(launchpad.endpoint); const recipientQuery = `transfer.recipient=${broadcasted.recipient}`; { @@ -457,9 +457,9 @@ describe("LcdClient", () => { }); it("can filter by recipient and tx.maxheight", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); assert(broadcasted); - const client = new LcdClient(wasmd.endpoint); + const client = new LcdClient(launchpad.endpoint); const recipientQuery = `transfer.recipient=${broadcasted.recipient}`; { @@ -486,8 +486,8 @@ describe("LcdClient", () => { describe("encodeTx", () => { it("works for cosmoshub example", async () => { - pendingWithoutWasmd(); - const client = new LcdClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = new LcdClient(launchpad.endpoint); assert(isWrappedStdTx(cosmoshub.tx)); const response = await client.encodeTx(cosmoshub.tx); expect(response).toEqual( @@ -500,7 +500,7 @@ describe("LcdClient", () => { describe("broadcastTx", () => { it("can send tokens", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); const accounts = await wallet.getAccounts(); const [{ address: walletAddress }] = accounts; @@ -530,10 +530,10 @@ describe("LcdClient", () => { gas: "890000", }; - const client = LcdClient.withExtensions({ apiUrl: wasmd.endpoint }, setupAuthExtension); + const client = LcdClient.withExtensions({ apiUrl: launchpad.endpoint }, setupAuthExtension); const { account_number, sequence } = (await client.auth.account(faucet.address)).result.value; - const signDoc = makeSignDoc([theMsg], fee, wasmd.chainId, memo, account_number, sequence); + const signDoc = makeSignDoc([theMsg], fee, launchpad.chainId, memo, account_number, sequence); const { signed, signature } = await wallet.signAmino(walletAddress, signDoc); const signedTx = makeStdTx(signed, signature); const result = await client.broadcastTx(signedTx); @@ -550,7 +550,7 @@ describe("LcdClient", () => { }); it("can't send transaction with additional signatures", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const account1 = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(0)); const account2 = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(1)); const account3 = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(2)); @@ -585,14 +585,14 @@ describe("LcdClient", () => { gas: "890000", }; - const client = LcdClient.withExtensions({ apiUrl: wasmd.endpoint }, setupAuthExtension); + const client = LcdClient.withExtensions({ apiUrl: launchpad.endpoint }, setupAuthExtension); const { account_number: an1, sequence: sequence1 } = (await client.auth.account(address1)).result.value; const { account_number: an2, sequence: sequence2 } = (await client.auth.account(address2)).result.value; const { account_number: an3, sequence: sequence3 } = (await client.auth.account(address3)).result.value; - const signDoc1 = makeSignDoc([theMsg], fee, wasmd.chainId, memo, an1, sequence1); - const signDoc2 = makeSignDoc([theMsg], fee, wasmd.chainId, memo, an2, sequence2); - const signDoc3 = makeSignDoc([theMsg], fee, wasmd.chainId, memo, an3, sequence3); + const signDoc1 = makeSignDoc([theMsg], fee, launchpad.chainId, memo, an1, sequence1); + const signDoc2 = makeSignDoc([theMsg], fee, launchpad.chainId, memo, an2, sequence2); + const signDoc3 = makeSignDoc([theMsg], fee, launchpad.chainId, memo, an3, sequence3); const { signature: signature1 } = await account1.signAmino(address1, signDoc1); const { signature: signature2 } = await account2.signAmino(address2, signDoc2); const { signature: signature3 } = await account3.signAmino(address3, signDoc3); @@ -608,7 +608,7 @@ describe("LcdClient", () => { }); it("can send multiple messages with one signature", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(0)); const accounts = await wallet.getAccounts(); const [{ address: walletAddress }] = accounts; @@ -651,10 +651,10 @@ describe("LcdClient", () => { gas: "890000", }; - const client = LcdClient.withExtensions({ apiUrl: wasmd.endpoint }, setupAuthExtension); + const client = LcdClient.withExtensions({ apiUrl: launchpad.endpoint }, setupAuthExtension); const { account_number, sequence } = (await client.auth.account(walletAddress)).result.value; - const signDoc = makeSignDoc([msg1, msg2], fee, wasmd.chainId, memo, account_number, sequence); + const signDoc = makeSignDoc([msg1, msg2], fee, launchpad.chainId, memo, account_number, sequence); const { signed, signature } = await wallet.signAmino(walletAddress, signDoc); const signedTx = makeStdTx(signed, signature); const broadcastResult = await client.broadcastTx(signedTx); @@ -662,7 +662,7 @@ describe("LcdClient", () => { }); it("can send multiple messages with multiple signatures", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const account1 = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(0)); const account2 = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(1)); const [address1, address2] = await Promise.all( @@ -709,12 +709,12 @@ describe("LcdClient", () => { gas: "890000", }; - const client = LcdClient.withExtensions({ apiUrl: wasmd.endpoint }, setupAuthExtension); + const client = LcdClient.withExtensions({ apiUrl: launchpad.endpoint }, setupAuthExtension); const { account_number: an1, sequence: sequence1 } = (await client.auth.account(address1)).result.value; const { account_number: an2, sequence: sequence2 } = (await client.auth.account(address2)).result.value; - const signDoc1 = makeSignDoc([msg2, msg1], fee, wasmd.chainId, memo, an1, sequence1); - const signDoc2 = makeSignDoc([msg2, msg1], fee, wasmd.chainId, memo, an2, sequence2); + const signDoc1 = makeSignDoc([msg2, msg1], fee, launchpad.chainId, memo, an1, sequence1); + const signDoc2 = makeSignDoc([msg2, msg1], fee, launchpad.chainId, memo, an2, sequence2); const { signature: signature1 } = await account1.signAmino(address1, signDoc1); const { signature: signature2 } = await account2.signAmino(address2, signDoc2); const signedTx: StdTx = { @@ -733,7 +733,7 @@ describe("LcdClient", () => { }); it("can't send transaction with wrong signature order (1)", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const account1 = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(0)); const account2 = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(1)); const [address1, address2] = await Promise.all( @@ -780,12 +780,12 @@ describe("LcdClient", () => { gas: "890000", }; - const client = LcdClient.withExtensions({ apiUrl: wasmd.endpoint }, setupAuthExtension); + const client = LcdClient.withExtensions({ apiUrl: launchpad.endpoint }, setupAuthExtension); const { account_number: an1, sequence: sequence1 } = (await client.auth.account(address1)).result.value; const { account_number: an2, sequence: sequence2 } = (await client.auth.account(address2)).result.value; - const signDoc1 = makeSignDoc([msg1, msg2], fee, wasmd.chainId, memo, an1, sequence1); - const signDoc2 = makeSignDoc([msg1, msg2], fee, wasmd.chainId, memo, an2, sequence2); + const signDoc1 = makeSignDoc([msg1, msg2], fee, launchpad.chainId, memo, an1, sequence1); + const signDoc2 = makeSignDoc([msg1, msg2], fee, launchpad.chainId, memo, an2, sequence2); const { signature: signature1 } = await account1.signAmino(address1, signDoc1); const { signature: signature2 } = await account2.signAmino(address2, signDoc2); const signedTx: StdTx = { @@ -799,7 +799,7 @@ describe("LcdClient", () => { }); it("can't send transaction with wrong signature order (2)", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const account1 = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(0)); const account2 = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(1)); const [address1, address2] = await Promise.all( @@ -846,12 +846,12 @@ describe("LcdClient", () => { gas: "890000", }; - const client = LcdClient.withExtensions({ apiUrl: wasmd.endpoint }, setupAuthExtension); + const client = LcdClient.withExtensions({ apiUrl: launchpad.endpoint }, setupAuthExtension); const { account_number: an1, sequence: sequence1 } = (await client.auth.account(address1)).result.value; const { account_number: an2, sequence: sequence2 } = (await client.auth.account(address2)).result.value; - const signDoc1 = makeSignDoc([msg2, msg1], fee, wasmd.chainId, memo, an1, sequence1); - const signDoc2 = makeSignDoc([msg2, msg1], fee, wasmd.chainId, memo, an2, sequence2); + const signDoc1 = makeSignDoc([msg2, msg1], fee, launchpad.chainId, memo, an1, sequence1); + const signDoc2 = makeSignDoc([msg2, msg1], fee, launchpad.chainId, memo, an2, sequence2); const { signature: signature1 } = await account1.signAmino(address1, signDoc1); const { signature: signature2 } = await account2.signAmino(address2, signDoc2); const signedTx: StdTx = { diff --git a/packages/launchpad/src/lcdapi/mint.spec.ts b/packages/launchpad/src/lcdapi/mint.spec.ts index ff14941b..ca1289e5 100644 --- a/packages/launchpad/src/lcdapi/mint.spec.ts +++ b/packages/launchpad/src/lcdapi/mint.spec.ts @@ -1,10 +1,10 @@ /* eslint-disable @typescript-eslint/naming-convention */ import { bigDecimalMatcher, + launchpad, nonNegativeIntegerMatcher, - pendingWithoutWasmd, + pendingWithoutLaunchpad, smallDecimalMatcher, - wasmd, } from "../testutils.spec"; import { LcdClient } from "./lcdclient"; import { MintExtension, setupMintExtension } from "./mint"; @@ -16,8 +16,8 @@ function makeMintClient(apiUrl: string): LcdClient & MintExtension { describe("MintExtension", () => { describe("parameters", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeMintClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeMintClient(launchpad.endpoint); const response = await client.mint.parameters(); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), @@ -35,8 +35,8 @@ describe("MintExtension", () => { describe("inflation", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeMintClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeMintClient(launchpad.endpoint); const response = await client.mint.inflation(); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), @@ -47,8 +47,8 @@ describe("MintExtension", () => { describe("annualProvisions", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeMintClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeMintClient(launchpad.endpoint); const response = await client.mint.annualProvisions(); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), diff --git a/packages/launchpad/src/lcdapi/slashing.spec.ts b/packages/launchpad/src/lcdapi/slashing.spec.ts index dbb8ebd6..dfe11779 100644 --- a/packages/launchpad/src/lcdapi/slashing.spec.ts +++ b/packages/launchpad/src/lcdapi/slashing.spec.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import { nonNegativeIntegerMatcher, pendingWithoutWasmd, wasmd } from "../testutils.spec"; +import { launchpad, nonNegativeIntegerMatcher, pendingWithoutLaunchpad } from "../testutils.spec"; import { LcdClient } from "./lcdclient"; import { setupSlashingExtension, SlashingExtension } from "./slashing"; @@ -10,8 +10,8 @@ function makeSlashingClient(apiUrl: string): LcdClient & SlashingExtension { describe("SlashingExtension", () => { describe("signingInfos", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeSlashingClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeSlashingClient(launchpad.endpoint); const response = await client.slashing.signingInfos(); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), @@ -31,8 +31,8 @@ describe("SlashingExtension", () => { describe("parameters", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeSlashingClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeSlashingClient(launchpad.endpoint); const response = await client.slashing.parameters(); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), diff --git a/packages/launchpad/src/lcdapi/staking.spec.ts b/packages/launchpad/src/lcdapi/staking.spec.ts index c9d9c189..fa0f1cd3 100644 --- a/packages/launchpad/src/lcdapi/staking.spec.ts +++ b/packages/launchpad/src/lcdapi/staking.spec.ts @@ -11,10 +11,10 @@ import { bigDecimalMatcher, dateTimeStampMatcher, faucet, + launchpad, + launchpadEnabled, nonNegativeIntegerMatcher, - pendingWithoutWasmd, - wasmd, - wasmdEnabled, + pendingWithoutLaunchpad, } from "../testutils.spec"; import { makeStdTx } from "../tx"; import { LcdClient } from "./lcdclient"; @@ -31,9 +31,9 @@ describe("StakingExtension", () => { }; beforeAll(async () => { - if (wasmdEnabled()) { + if (launchpadEnabled()) { const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); - const client = new SigningCosmosClient(wasmd.endpoint, faucet.address, wallet); + const client = new SigningCosmosClient(launchpad.endpoint, faucet.address, wallet); const chainId = await client.getChainId(); { @@ -41,7 +41,7 @@ describe("StakingExtension", () => { type: "cosmos-sdk/MsgDelegate", value: { delegator_address: faucet.address, - validator_address: wasmd.validator.address, + validator_address: launchpad.validator.address, amount: coin(25000, "ustake"), }, }; @@ -59,7 +59,7 @@ describe("StakingExtension", () => { type: "cosmos-sdk/MsgUndelegate", value: { delegator_address: faucet.address, - validator_address: wasmd.validator.address, + validator_address: launchpad.validator.address, amount: coin(100, "ustake"), }, }; @@ -79,15 +79,15 @@ describe("StakingExtension", () => { describe("delegatorDelegations", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeStakingClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeStakingClient(launchpad.endpoint); const response = await client.staking.delegatorDelegations(faucet.address); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), result: [ { delegator_address: faucet.address, - validator_address: wasmd.validator.address, + validator_address: launchpad.validator.address, shares: jasmine.stringMatching(bigDecimalMatcher), balance: { denom: "ustake", amount: jasmine.stringMatching(nonNegativeIntegerMatcher) }, }, @@ -98,15 +98,15 @@ describe("StakingExtension", () => { describe("delegatorUnbondingDelegations", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeStakingClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeStakingClient(launchpad.endpoint); const { height, result } = await client.staking.delegatorUnbondingDelegations(faucet.address); expect(height).toMatch(nonNegativeIntegerMatcher); assert(result); expect(result).toEqual([ { delegator_address: faucet.address, - validator_address: wasmd.validator.address, + validator_address: launchpad.validator.address, entries: jasmine.arrayContaining([ { creation_height: jasmine.stringMatching(nonNegativeIntegerMatcher), @@ -122,8 +122,8 @@ describe("StakingExtension", () => { describe("delegatorTransactions", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeStakingClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeStakingClient(launchpad.endpoint); const response = await client.staking.delegatorTransactions(faucet.address); expect(response.length).toEqual(3); }); @@ -131,21 +131,21 @@ describe("StakingExtension", () => { describe("delegatorValidators", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeStakingClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeStakingClient(launchpad.endpoint); const response = await client.staking.delegatorValidators(faucet.address); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), result: [ { - operator_address: wasmd.validator.address, - consensus_pubkey: wasmd.validator.pubkey, + operator_address: launchpad.validator.address, + consensus_pubkey: launchpad.validator.pubkey, jailed: false, status: BondStatus.Bonded, tokens: jasmine.stringMatching(nonNegativeIntegerMatcher), delegator_shares: jasmine.stringMatching(bigDecimalMatcher), description: { - moniker: wasmd.moniker, + moniker: launchpad.moniker, identity: "", website: "", security_contact: "", @@ -159,7 +159,7 @@ describe("StakingExtension", () => { max_rate: "0.200000000000000000", max_change_rate: "0.010000000000000000", }, - update_time: wasmd.commissionUpdateTime, + update_time: launchpad.commissionUpdateTime, }, min_self_delegation: "1", }, @@ -170,20 +170,20 @@ describe("StakingExtension", () => { describe("delegatorValidator", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeStakingClient(wasmd.endpoint); - const response = await client.staking.delegatorValidator(faucet.address, wasmd.validator.address); + pendingWithoutLaunchpad(); + const client = makeStakingClient(launchpad.endpoint); + const response = await client.staking.delegatorValidator(faucet.address, launchpad.validator.address); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), result: { - operator_address: wasmd.validator.address, - consensus_pubkey: wasmd.validator.pubkey, + operator_address: launchpad.validator.address, + consensus_pubkey: launchpad.validator.pubkey, jailed: false, status: BondStatus.Bonded, tokens: jasmine.stringMatching(nonNegativeIntegerMatcher), delegator_shares: jasmine.stringMatching(bigDecimalMatcher), description: { - moniker: wasmd.moniker, + moniker: launchpad.moniker, identity: "", website: "", security_contact: "", @@ -197,7 +197,7 @@ describe("StakingExtension", () => { max_rate: "0.200000000000000000", max_change_rate: "0.010000000000000000", }, - update_time: wasmd.commissionUpdateTime, + update_time: launchpad.commissionUpdateTime, }, min_self_delegation: "1", }, @@ -207,14 +207,14 @@ describe("StakingExtension", () => { describe("delegation", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeStakingClient(wasmd.endpoint); - const response = await client.staking.delegation(faucet.address, wasmd.validator.address); + pendingWithoutLaunchpad(); + const client = makeStakingClient(launchpad.endpoint); + const response = await client.staking.delegation(faucet.address, launchpad.validator.address); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), result: { delegator_address: faucet.address, - validator_address: wasmd.validator.address, + validator_address: launchpad.validator.address, shares: jasmine.stringMatching(bigDecimalMatcher), balance: { denom: "ustake", amount: jasmine.stringMatching(nonNegativeIntegerMatcher) }, }, @@ -224,17 +224,17 @@ describe("StakingExtension", () => { describe("unbondingDelegation", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeStakingClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeStakingClient(launchpad.endpoint); const { height, result } = await client.staking.unbondingDelegation( faucet.address, - wasmd.validator.address, + launchpad.validator.address, ); expect(height).toMatch(nonNegativeIntegerMatcher); assert(result); expect(result).toEqual({ delegator_address: faucet.address, - validator_address: wasmd.validator.address, + validator_address: launchpad.validator.address, entries: jasmine.arrayContaining([ { creation_height: jasmine.stringMatching(nonNegativeIntegerMatcher), @@ -250,8 +250,8 @@ describe("StakingExtension", () => { describe("redelegations", () => { it("works", async () => { // TODO: Set up a result for this test - pendingWithoutWasmd(); - const client = makeStakingClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeStakingClient(launchpad.endpoint); const response = await client.staking.redelegations(); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), @@ -262,21 +262,21 @@ describe("StakingExtension", () => { describe("validators", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeStakingClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeStakingClient(launchpad.endpoint); const response = await client.staking.validators(); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), result: [ { - operator_address: wasmd.validator.address, - consensus_pubkey: wasmd.validator.pubkey, + operator_address: launchpad.validator.address, + consensus_pubkey: launchpad.validator.pubkey, jailed: false, status: BondStatus.Bonded, tokens: jasmine.stringMatching(nonNegativeIntegerMatcher), delegator_shares: jasmine.stringMatching(bigDecimalMatcher), description: { - moniker: wasmd.moniker, + moniker: launchpad.moniker, identity: "", website: "", security_contact: "", @@ -290,7 +290,7 @@ describe("StakingExtension", () => { max_rate: "0.200000000000000000", max_change_rate: "0.010000000000000000", }, - update_time: wasmd.commissionUpdateTime, + update_time: launchpad.commissionUpdateTime, }, min_self_delegation: "1", }, @@ -299,8 +299,8 @@ describe("StakingExtension", () => { }); it("can filter by status with no results", async () => { - pendingWithoutWasmd(); - const client = makeStakingClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeStakingClient(launchpad.endpoint); const response = await client.staking.validators({ status: "unbonded" }); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), @@ -309,21 +309,21 @@ describe("StakingExtension", () => { }); it("can filter by status with some results", async () => { - pendingWithoutWasmd(); - const client = makeStakingClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeStakingClient(launchpad.endpoint); const response = await client.staking.validators({ status: "bonded" }); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), result: [ { - operator_address: wasmd.validator.address, - consensus_pubkey: wasmd.validator.pubkey, + operator_address: launchpad.validator.address, + consensus_pubkey: launchpad.validator.pubkey, jailed: false, status: BondStatus.Bonded, tokens: jasmine.stringMatching(nonNegativeIntegerMatcher), delegator_shares: jasmine.stringMatching(bigDecimalMatcher), description: { - moniker: wasmd.moniker, + moniker: launchpad.moniker, identity: "", website: "", security_contact: "", @@ -337,7 +337,7 @@ describe("StakingExtension", () => { max_rate: "0.200000000000000000", max_change_rate: "0.010000000000000000", }, - update_time: wasmd.commissionUpdateTime, + update_time: launchpad.commissionUpdateTime, }, min_self_delegation: "1", }, @@ -348,20 +348,20 @@ describe("StakingExtension", () => { describe("validator", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeStakingClient(wasmd.endpoint); - const response = await client.staking.validator(wasmd.validator.address); + pendingWithoutLaunchpad(); + const client = makeStakingClient(launchpad.endpoint); + const response = await client.staking.validator(launchpad.validator.address); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), result: { - operator_address: wasmd.validator.address, - consensus_pubkey: wasmd.validator.pubkey, + operator_address: launchpad.validator.address, + consensus_pubkey: launchpad.validator.pubkey, jailed: false, status: BondStatus.Bonded, tokens: jasmine.stringMatching(nonNegativeIntegerMatcher), delegator_shares: jasmine.stringMatching(bigDecimalMatcher), description: { - moniker: wasmd.moniker, + moniker: launchpad.moniker, identity: "", website: "", security_contact: "", @@ -375,7 +375,7 @@ describe("StakingExtension", () => { max_rate: "0.200000000000000000", max_change_rate: "0.010000000000000000", }, - update_time: wasmd.commissionUpdateTime, + update_time: launchpad.commissionUpdateTime, }, min_self_delegation: "1", }, @@ -385,21 +385,21 @@ describe("StakingExtension", () => { describe("validatorDelegations", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeStakingClient(wasmd.endpoint); - const response = await client.staking.validatorDelegations(wasmd.validator.address); + pendingWithoutLaunchpad(); + const client = makeStakingClient(launchpad.endpoint); + const response = await client.staking.validatorDelegations(launchpad.validator.address); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), result: jasmine.arrayContaining([ { delegator_address: faucet.address, - validator_address: wasmd.validator.address, + validator_address: launchpad.validator.address, shares: jasmine.stringMatching(bigDecimalMatcher), balance: { denom: "ustake", amount: jasmine.stringMatching(nonNegativeIntegerMatcher) }, }, { - delegator_address: wasmd.validator.delegatorAddress, - validator_address: wasmd.validator.address, + delegator_address: launchpad.validator.delegatorAddress, + validator_address: launchpad.validator.address, shares: "250000000.000000000000000000", balance: { denom: "ustake", amount: "250000000" }, }, @@ -410,15 +410,17 @@ describe("StakingExtension", () => { describe("validatorUnbondingDelegations", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeStakingClient(wasmd.endpoint); - const { height, result } = await client.staking.validatorUnbondingDelegations(wasmd.validator.address); + pendingWithoutLaunchpad(); + const client = makeStakingClient(launchpad.endpoint); + const { height, result } = await client.staking.validatorUnbondingDelegations( + launchpad.validator.address, + ); expect(height).toMatch(nonNegativeIntegerMatcher); assert(result); expect(result).toEqual([ { delegator_address: faucet.address, - validator_address: wasmd.validator.address, + validator_address: launchpad.validator.address, entries: jasmine.arrayContaining([ { creation_height: jasmine.stringMatching(nonNegativeIntegerMatcher), @@ -434,8 +436,8 @@ describe("StakingExtension", () => { describe("historicalInfo", () => { it("doesn't work yet", async () => { - pendingWithoutWasmd(); - const client = makeStakingClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeStakingClient(launchpad.endpoint); const currentHeight = (await client.blocksLatest()).block.header.height; return expectAsync(client.staking.historicalInfo(currentHeight)).toBeRejectedWithError( /no historical info found \(HTTP 400\)/i, @@ -445,8 +447,8 @@ describe("StakingExtension", () => { describe("pool", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeStakingClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeStakingClient(launchpad.endpoint); const response = await client.staking.pool(); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), @@ -460,8 +462,8 @@ describe("StakingExtension", () => { describe("parameters", () => { it("works", async () => { - pendingWithoutWasmd(); - const client = makeStakingClient(wasmd.endpoint); + pendingWithoutLaunchpad(); + const client = makeStakingClient(launchpad.endpoint); const response = await client.staking.parameters(); expect(response).toEqual({ height: jasmine.stringMatching(nonNegativeIntegerMatcher), diff --git a/packages/launchpad/src/lcdapi/supply.spec.ts b/packages/launchpad/src/lcdapi/supply.spec.ts index ca95f5d8..263e0e0e 100644 --- a/packages/launchpad/src/lcdapi/supply.spec.ts +++ b/packages/launchpad/src/lcdapi/supply.spec.ts @@ -1,13 +1,13 @@ -import { pendingWithoutWasmd, wasmd } from "../testutils.spec"; +import { launchpad, pendingWithoutLaunchpad } from "../testutils.spec"; import { LcdClient } from "./lcdclient"; import { setupSupplyExtension } from "./supply"; describe("SupplyExtension", () => { describe("totalAll", () => { it("works", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); - const client = LcdClient.withExtensions({ apiUrl: wasmd.endpoint }, setupSupplyExtension); + const client = LcdClient.withExtensions({ apiUrl: launchpad.endpoint }, setupSupplyExtension); const supply = await client.supply.totalAll(); expect(supply).toEqual({ height: jasmine.stringMatching(/^[0-9]+$/), @@ -27,9 +27,9 @@ describe("SupplyExtension", () => { describe("total", () => { it("works", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); - const client = LcdClient.withExtensions({ apiUrl: wasmd.endpoint }, setupSupplyExtension); + const client = LcdClient.withExtensions({ apiUrl: launchpad.endpoint }, setupSupplyExtension); const supply = await client.supply.total("ucosm"); expect(supply).toEqual({ height: jasmine.stringMatching(/^[0-9]+$/), diff --git a/packages/launchpad/src/signingcosmosclient.spec.ts b/packages/launchpad/src/signingcosmosclient.spec.ts index 28a71a52..f3a54e45 100644 --- a/packages/launchpad/src/signingcosmosclient.spec.ts +++ b/packages/launchpad/src/signingcosmosclient.spec.ts @@ -7,7 +7,7 @@ import { GasPrice } from "./gas"; import { MsgDelegate } from "./msgs"; import { Secp256k1HdWallet } from "./secp256k1hdwallet"; import { PrivateSigningCosmosClient, SigningCosmosClient } from "./signingcosmosclient"; -import { makeRandomAddress, pendingWithoutWasmd, wasmd } from "./testutils.spec"; +import { launchpad, makeRandomAddress, pendingWithoutLaunchpad } from "./testutils.spec"; const httpUrl = "http://localhost:1317"; @@ -102,7 +102,7 @@ describe("SigningCosmosClient", () => { describe("getHeight", () => { it("always uses authAccount implementation", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = new SigningCosmosClient(httpUrl, faucet.address, wallet); @@ -120,7 +120,7 @@ describe("SigningCosmosClient", () => { describe("sendTokens", () => { it("works", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = new SigningCosmosClient(httpUrl, faucet.address, wallet); @@ -152,7 +152,7 @@ describe("SigningCosmosClient", () => { describe("signAndBroadcast", () => { it("works", async () => { - pendingWithoutWasmd(); + pendingWithoutLaunchpad(); const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = new SigningCosmosClient(httpUrl, faucet.address, wallet); @@ -160,7 +160,7 @@ describe("SigningCosmosClient", () => { type: "cosmos-sdk/MsgDelegate", value: { delegator_address: faucet.address, - validator_address: wasmd.validator.address, + validator_address: launchpad.validator.address, amount: coin(1234, "ustake"), }, }; diff --git a/packages/launchpad/src/testutils.spec.ts b/packages/launchpad/src/testutils.spec.ts index 134ad886..6464ab8c 100644 --- a/packages/launchpad/src/testutils.spec.ts +++ b/packages/launchpad/src/testutils.spec.ts @@ -23,7 +23,7 @@ export const hexMatcher = /^([0-9a-fA-F][0-9a-fA-F])*$/; // https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#bech32 export const bech32AddressMatcher = /^[\x21-\x7e]{1,83}1[02-9ac-hj-np-z]{38}$/; -export const wasmd = { +export const launchpad = { endpoint: "http://localhost:1317", chainId: "testing", moniker: "node001", @@ -56,13 +56,13 @@ export const unused = { sequence: 0, }; -export function wasmdEnabled(): boolean { - return !!process.env.WASMD_ENABLED; +export function launchpadEnabled(): boolean { + return !!process.env.LAUNCHPAD_ENABLED; } -export function pendingWithoutWasmd(): void { - if (!wasmdEnabled()) { - return pending("Set WASMD_ENABLED to enable Wasmd based tests"); +export function pendingWithoutLaunchpad(): void { + if (!launchpadEnabled()) { + return pending("Set LAUNCHPAD_ENABLED to enable Launchpad-based tests"); } } diff --git a/packages/launchpad/webpack.web.config.js b/packages/launchpad/webpack.web.config.js index 7373cace..b7efc15b 100644 --- a/packages/launchpad/webpack.web.config.js +++ b/packages/launchpad/webpack.web.config.js @@ -14,6 +14,6 @@ module.exports = [ path: distdir, filename: "tests.js", }, - plugins: [new webpack.EnvironmentPlugin(["WASMD_ENABLED"])], + plugins: [new webpack.EnvironmentPlugin(["LAUNCHPAD_ENABLED"])], }, ];