Pull out wasmd.expectedChainId
This commit is contained in:
parent
a50369e43e
commit
4f5b5b8aca
@ -11,8 +11,8 @@ import {
|
||||
fromOneElementArray,
|
||||
makeRandomAddress,
|
||||
pendingWithoutWasmd,
|
||||
wasmd,
|
||||
wasmdEnabled,
|
||||
wasmdEndpoint,
|
||||
} from "./testutils.spec";
|
||||
import { Coin, CosmosSdkTx, isMsgExecuteContract, isMsgInstantiateContract, isMsgSend } from "./types";
|
||||
|
||||
@ -39,7 +39,7 @@ describe("CosmWasmClient.searchTx", () => {
|
||||
beforeAll(async () => {
|
||||
if (wasmdEnabled()) {
|
||||
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
|
||||
const client = new SigningCosmWasmClient(wasmdEndpoint, faucet.address, signBytes =>
|
||||
const client = new SigningCosmWasmClient(wasmd.endpoint, faucet.address, signBytes =>
|
||||
pen.sign(signBytes),
|
||||
);
|
||||
|
||||
@ -51,7 +51,7 @@ describe("CosmWasmClient.searchTx", () => {
|
||||
};
|
||||
const result = await client.sendTokens(recipient, [transferAmount]);
|
||||
await sleep(50); // wait until tx is indexed
|
||||
const txDetails = await new RestClient(wasmdEndpoint).txsById(result.transactionHash);
|
||||
const txDetails = await new RestClient(wasmd.endpoint).txsById(result.transactionHash);
|
||||
postedSend = {
|
||||
sender: faucet.address,
|
||||
recipient: recipient,
|
||||
@ -71,7 +71,7 @@ describe("CosmWasmClient.searchTx", () => {
|
||||
};
|
||||
const result = await client.execute(hashInstance, msg);
|
||||
await sleep(50); // wait until tx is indexed
|
||||
const txDetails = await new RestClient(wasmdEndpoint).txsById(result.transactionHash);
|
||||
const txDetails = await new RestClient(wasmd.endpoint).txsById(result.transactionHash);
|
||||
postedExecute = {
|
||||
sender: faucet.address,
|
||||
contract: hashInstance,
|
||||
@ -87,7 +87,7 @@ describe("CosmWasmClient.searchTx", () => {
|
||||
it("can search by ID", async () => {
|
||||
pendingWithoutWasmd();
|
||||
assert(postedSend, "value must be set in beforeAll()");
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
const result = await client.searchTx({ id: postedSend.hash });
|
||||
expect(result.length).toEqual(1);
|
||||
expect(result[0]).toEqual(
|
||||
@ -101,7 +101,7 @@ describe("CosmWasmClient.searchTx", () => {
|
||||
|
||||
it("can search by ID (non existent)", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
const nonExistentId = "0000000000000000000000000000000000000000000000000000000000000000";
|
||||
const result = await client.searchTx({ id: nonExistentId });
|
||||
expect(result.length).toEqual(0);
|
||||
@ -110,7 +110,7 @@ describe("CosmWasmClient.searchTx", () => {
|
||||
it("can search by ID and filter by minHeight", async () => {
|
||||
pendingWithoutWasmd();
|
||||
assert(postedSend);
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
const query = { id: postedSend.hash };
|
||||
|
||||
{
|
||||
@ -139,7 +139,7 @@ describe("CosmWasmClient.searchTx", () => {
|
||||
it("can search by height", async () => {
|
||||
pendingWithoutWasmd();
|
||||
assert(postedSend, "value must be set in beforeAll()");
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
const result = await client.searchTx({ height: postedSend.height });
|
||||
expect(result.length).toEqual(1);
|
||||
expect(result[0]).toEqual(
|
||||
@ -156,7 +156,7 @@ describe("CosmWasmClient.searchTx", () => {
|
||||
it("can search by sender", async () => {
|
||||
pendingWithoutWasmd();
|
||||
assert(postedSend, "value must be set in beforeAll()");
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
const results = await client.searchTx({ sentFromOrTo: postedSend.sender });
|
||||
expect(results.length).toBeGreaterThanOrEqual(1);
|
||||
|
||||
@ -182,7 +182,7 @@ describe("CosmWasmClient.searchTx", () => {
|
||||
it("can search by recipient", async () => {
|
||||
pendingWithoutWasmd();
|
||||
assert(postedSend, "value must be set in beforeAll()");
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
const results = await client.searchTx({ sentFromOrTo: postedSend.recipient });
|
||||
expect(results.length).toBeGreaterThanOrEqual(1);
|
||||
|
||||
@ -208,7 +208,7 @@ describe("CosmWasmClient.searchTx", () => {
|
||||
it("can search by recipient and filter by minHeight", async () => {
|
||||
pendingWithoutWasmd();
|
||||
assert(postedSend);
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
const query = { sentFromOrTo: postedSend.recipient };
|
||||
|
||||
{
|
||||
@ -235,7 +235,7 @@ describe("CosmWasmClient.searchTx", () => {
|
||||
it("can search by recipient and filter by maxHeight", async () => {
|
||||
pendingWithoutWasmd();
|
||||
assert(postedSend);
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
const query = { sentFromOrTo: postedSend.recipient };
|
||||
|
||||
{
|
||||
@ -264,7 +264,7 @@ describe("CosmWasmClient.searchTx", () => {
|
||||
it("can search by transfer.recipient", async () => {
|
||||
pendingWithoutWasmd();
|
||||
assert(postedSend, "value must be set in beforeAll()");
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
const results = await client.searchTx({
|
||||
tags: [{ key: "transfer.recipient", value: postedSend.recipient }],
|
||||
});
|
||||
@ -290,7 +290,7 @@ describe("CosmWasmClient.searchTx", () => {
|
||||
it("can search by message.contract_address", async () => {
|
||||
pendingWithoutWasmd();
|
||||
assert(postedExecute, "value must be set in beforeAll()");
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
const results = await client.searchTx({
|
||||
tags: [{ key: "message.contract_address", value: postedExecute.contract }],
|
||||
});
|
||||
@ -332,7 +332,7 @@ describe("CosmWasmClient.searchTx", () => {
|
||||
it("can search by message.contract_address + message.action", async () => {
|
||||
pendingWithoutWasmd();
|
||||
assert(postedExecute, "value must be set in beforeAll()");
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
const results = await client.searchTx({
|
||||
tags: [
|
||||
{ key: "message.contract_address", value: postedExecute.contract },
|
||||
|
||||
@ -17,8 +17,8 @@ import {
|
||||
makeRandomAddress,
|
||||
pendingWithoutWasmd,
|
||||
tendermintIdMatcher,
|
||||
wasmd,
|
||||
wasmdEnabled,
|
||||
wasmdEndpoint,
|
||||
} from "./testutils.spec";
|
||||
import { MsgSend, StdFee } from "./types";
|
||||
|
||||
@ -43,7 +43,7 @@ interface HackatomInstance {
|
||||
describe("CosmWasmClient", () => {
|
||||
describe("makeReadOnly", () => {
|
||||
it("can be constructed", () => {
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
expect(client).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -51,18 +51,18 @@ describe("CosmWasmClient", () => {
|
||||
describe("getChainId", () => {
|
||||
it("works", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
expect(await client.getChainId()).toEqual("testing");
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
expect(await client.getChainId()).toEqual(wasmd.expectedChainId);
|
||||
});
|
||||
|
||||
it("caches chain ID", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
const openedClient = (client as unknown) as PrivateCosmWasmClient;
|
||||
const getCodeSpy = spyOn(openedClient.restClient, "nodeInfo").and.callThrough();
|
||||
|
||||
expect(await client.getChainId()).toEqual("testing"); // from network
|
||||
expect(await client.getChainId()).toEqual("testing"); // from cache
|
||||
expect(await client.getChainId()).toEqual(wasmd.expectedChainId); // from network
|
||||
expect(await client.getChainId()).toEqual(wasmd.expectedChainId); // from cache
|
||||
|
||||
expect(getCodeSpy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
@ -71,7 +71,7 @@ describe("CosmWasmClient", () => {
|
||||
describe("getHeight", () => {
|
||||
it("gets height via last block", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
const openedClient = (client as unknown) as PrivateCosmWasmClient;
|
||||
const blockLatestSpy = spyOn(openedClient.restClient, "blocksLatest").and.callThrough();
|
||||
|
||||
@ -86,7 +86,7 @@ describe("CosmWasmClient", () => {
|
||||
|
||||
it("gets height via authAccount once an address is known", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
|
||||
const openedClient = (client as unknown) as PrivateCosmWasmClient;
|
||||
const blockLatestSpy = spyOn(openedClient.restClient, "blocksLatest").and.callThrough();
|
||||
@ -111,7 +111,7 @@ describe("CosmWasmClient", () => {
|
||||
describe("getNonce", () => {
|
||||
it("works", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
expect(await client.getNonce(unused.address)).toEqual({
|
||||
accountNumber: 5,
|
||||
sequence: 0,
|
||||
@ -120,7 +120,7 @@ describe("CosmWasmClient", () => {
|
||||
|
||||
it("throws for missing accounts", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
const missing = makeRandomAddress();
|
||||
await client.getNonce(missing).then(
|
||||
() => fail("this must not succeed"),
|
||||
@ -132,7 +132,7 @@ describe("CosmWasmClient", () => {
|
||||
describe("getAccount", () => {
|
||||
it("works", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
expect(await client.getAccount(unused.address)).toEqual({
|
||||
address: unused.address,
|
||||
accountNumber: 5,
|
||||
@ -147,7 +147,7 @@ describe("CosmWasmClient", () => {
|
||||
|
||||
it("returns undefined for missing accounts", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
const missing = makeRandomAddress();
|
||||
expect(await client.getAccount(missing)).toBeUndefined();
|
||||
});
|
||||
@ -156,7 +156,7 @@ describe("CosmWasmClient", () => {
|
||||
describe("getBlock", () => {
|
||||
it("works for latest block", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
const response = await client.getBlock();
|
||||
|
||||
// id
|
||||
@ -176,7 +176,7 @@ describe("CosmWasmClient", () => {
|
||||
|
||||
it("works for block by height", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
const height = (await client.getBlock()).header.height;
|
||||
const response = await client.getBlock(height - 1);
|
||||
|
||||
@ -199,7 +199,7 @@ describe("CosmWasmClient", () => {
|
||||
describe("getIdentifier", () => {
|
||||
it("works", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
expect(await client.getIdentifier(cosmoshub.tx)).toEqual(cosmoshub.id);
|
||||
});
|
||||
});
|
||||
@ -208,7 +208,7 @@ describe("CosmWasmClient", () => {
|
||||
it("works", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
|
||||
const memo = "My first contract on chain";
|
||||
const sendMsg: MsgSend = {
|
||||
@ -255,7 +255,7 @@ describe("CosmWasmClient", () => {
|
||||
describe("getCodes", () => {
|
||||
it("works", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
const result = await client.getCodes();
|
||||
expect(result.length).toBeGreaterThanOrEqual(1);
|
||||
const [first] = result;
|
||||
@ -272,7 +272,7 @@ describe("CosmWasmClient", () => {
|
||||
describe("getCodeDetails", () => {
|
||||
it("works", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
const result = await client.getCodeDetails(1);
|
||||
|
||||
const expectedInfo: Code = {
|
||||
@ -291,7 +291,7 @@ describe("CosmWasmClient", () => {
|
||||
|
||||
it("caches downloads", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
const openedClient = (client as unknown) as PrivateCosmWasmClient;
|
||||
const getCodeSpy = spyOn(openedClient.restClient, "getCode").and.callThrough();
|
||||
|
||||
@ -306,7 +306,7 @@ describe("CosmWasmClient", () => {
|
||||
describe("getContracts", () => {
|
||||
it("works", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
const result = await client.getContracts(1);
|
||||
expect(result.length).toBeGreaterThanOrEqual(3);
|
||||
const [hash, isa, jade] = result;
|
||||
@ -334,7 +334,7 @@ describe("CosmWasmClient", () => {
|
||||
describe("getContract", () => {
|
||||
it("works for HASH instance", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
const hash = await client.getContract("cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5");
|
||||
expect(hash).toEqual({
|
||||
address: "cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5",
|
||||
@ -373,7 +373,7 @@ describe("CosmWasmClient", () => {
|
||||
if (wasmdEnabled()) {
|
||||
pendingWithoutWasmd();
|
||||
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
|
||||
const client = new SigningCosmWasmClient(wasmdEndpoint, faucet.address, signBytes =>
|
||||
const client = new SigningCosmWasmClient(wasmd.endpoint, faucet.address, signBytes =>
|
||||
pen.sign(signBytes),
|
||||
);
|
||||
const { codeId } = await client.upload(getRandomizedHackatom());
|
||||
@ -387,7 +387,7 @@ describe("CosmWasmClient", () => {
|
||||
pendingWithoutWasmd();
|
||||
assert(contract);
|
||||
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
const raw = await client.queryContractRaw(contract.address, configKey);
|
||||
assert(raw, "must get result");
|
||||
expect(JSON.parse(fromUtf8(raw))).toEqual({
|
||||
@ -401,7 +401,7 @@ describe("CosmWasmClient", () => {
|
||||
pendingWithoutWasmd();
|
||||
assert(contract);
|
||||
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
const raw = await client.queryContractRaw(contract.address, otherKey);
|
||||
expect(raw).toBeNull();
|
||||
});
|
||||
@ -411,7 +411,7 @@ describe("CosmWasmClient", () => {
|
||||
assert(contract);
|
||||
|
||||
const nonExistentAddress = makeRandomAddress();
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
await client.queryContractRaw(nonExistentAddress, configKey).then(
|
||||
() => fail("must not succeed"),
|
||||
error => expect(error).toMatch(`No contract found at address "${nonExistentAddress}"`),
|
||||
@ -426,7 +426,7 @@ describe("CosmWasmClient", () => {
|
||||
if (wasmdEnabled()) {
|
||||
pendingWithoutWasmd();
|
||||
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
|
||||
const client = new SigningCosmWasmClient(wasmdEndpoint, faucet.address, signBytes =>
|
||||
const client = new SigningCosmWasmClient(wasmd.endpoint, faucet.address, signBytes =>
|
||||
pen.sign(signBytes),
|
||||
);
|
||||
const { codeId } = await client.upload(getRandomizedHackatom());
|
||||
@ -440,7 +440,7 @@ describe("CosmWasmClient", () => {
|
||||
pendingWithoutWasmd();
|
||||
assert(contract);
|
||||
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
const verifier = await client.queryContractSmart(contract.address, { verifier: {} });
|
||||
expect(fromAscii(verifier)).toEqual(contract.initMsg.verifier);
|
||||
});
|
||||
@ -449,7 +449,7 @@ describe("CosmWasmClient", () => {
|
||||
pendingWithoutWasmd();
|
||||
assert(contract);
|
||||
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
await client.queryContractSmart(contract.address, { broken: {} }).then(
|
||||
() => fail("must not succeed"),
|
||||
error => expect(error).toMatch(/Error parsing QueryMsg/i),
|
||||
@ -460,7 +460,7 @@ describe("CosmWasmClient", () => {
|
||||
pendingWithoutWasmd();
|
||||
|
||||
const nonExistentAddress = makeRandomAddress();
|
||||
const client = new CosmWasmClient(wasmdEndpoint);
|
||||
const client = new CosmWasmClient(wasmd.endpoint);
|
||||
await client.queryContractSmart(nonExistentAddress, { verifier: {} }).then(
|
||||
() => fail("must not succeed"),
|
||||
error => expect(error).toMatch(`No contract found at address "${nonExistentAddress}"`),
|
||||
|
||||
@ -24,8 +24,8 @@ import {
|
||||
tendermintIdMatcher,
|
||||
tendermintOptionalIdMatcher,
|
||||
tendermintShortHashMatcher,
|
||||
wasmd,
|
||||
wasmdEnabled,
|
||||
wasmdEndpoint,
|
||||
} from "./testutils.spec";
|
||||
import {
|
||||
Coin,
|
||||
@ -166,7 +166,7 @@ async function executeContract(
|
||||
|
||||
describe("RestClient", () => {
|
||||
it("can be constructed", () => {
|
||||
const client = new RestClient(wasmdEndpoint);
|
||||
const client = new RestClient(wasmd.endpoint);
|
||||
expect(client).toBeTruthy();
|
||||
});
|
||||
|
||||
@ -175,7 +175,7 @@ describe("RestClient", () => {
|
||||
describe("authAccounts", () => {
|
||||
it("works for unused account without pubkey", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const client = new RestClient(wasmdEndpoint);
|
||||
const client = new RestClient(wasmd.endpoint);
|
||||
const { height, result } = await client.authAccounts(unusedAccount.address);
|
||||
expect(height).toMatch(tendermintHeightMatcher);
|
||||
expect(result).toEqual({
|
||||
@ -202,7 +202,7 @@ describe("RestClient", () => {
|
||||
// This fails in the first test run if you forget to run `./scripts/wasmd/init.sh`
|
||||
it("has correct pubkey for faucet", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const client = new RestClient(wasmdEndpoint);
|
||||
const client = new RestClient(wasmd.endpoint);
|
||||
const { result } = await client.authAccounts(faucet.address);
|
||||
expect(result.value).toEqual(
|
||||
jasmine.objectContaining({
|
||||
@ -214,7 +214,7 @@ describe("RestClient", () => {
|
||||
// This property is used by CosmWasmClient.getAccount
|
||||
it("returns empty address for non-existent account", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const client = new RestClient(wasmdEndpoint);
|
||||
const client = new RestClient(wasmd.endpoint);
|
||||
const nonExistentAccount = makeRandomAddress();
|
||||
const { result } = await client.authAccounts(nonExistentAccount);
|
||||
expect(result).toEqual({
|
||||
@ -229,7 +229,7 @@ describe("RestClient", () => {
|
||||
describe("blocksLatest", () => {
|
||||
it("works", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const client = new RestClient(wasmdEndpoint);
|
||||
const client = new RestClient(wasmd.endpoint);
|
||||
const response = await client.blocksLatest();
|
||||
|
||||
// id
|
||||
@ -262,7 +262,7 @@ describe("RestClient", () => {
|
||||
describe("blocks", () => {
|
||||
it("works for block by height", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const client = new RestClient(wasmdEndpoint);
|
||||
const client = new RestClient(wasmd.endpoint);
|
||||
const height = parseInt((await client.blocksLatest()).block.header.height, 10);
|
||||
const response = await client.blocks(height - 1);
|
||||
|
||||
@ -298,7 +298,7 @@ describe("RestClient", () => {
|
||||
describe("nodeInfo", () => {
|
||||
it("works", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const client = new RestClient(wasmdEndpoint);
|
||||
const client = new RestClient(wasmd.endpoint);
|
||||
const { node_info, application_version } = await client.nodeInfo();
|
||||
|
||||
expect(node_info).toEqual({
|
||||
@ -339,7 +339,7 @@ describe("RestClient", () => {
|
||||
beforeAll(async () => {
|
||||
if (wasmdEnabled()) {
|
||||
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
|
||||
const client = new SigningCosmWasmClient(wasmdEndpoint, faucet.address, signBytes =>
|
||||
const client = new SigningCosmWasmClient(wasmd.endpoint, faucet.address, signBytes =>
|
||||
pen.sign(signBytes),
|
||||
);
|
||||
|
||||
@ -353,7 +353,7 @@ describe("RestClient", () => {
|
||||
const result = await client.sendTokens(recipient, transferAmount);
|
||||
|
||||
await sleep(50); // wait until tx is indexed
|
||||
const txDetails = await new RestClient(wasmdEndpoint).txsById(result.transactionHash);
|
||||
const txDetails = await new RestClient(wasmd.endpoint).txsById(result.transactionHash);
|
||||
posted = {
|
||||
sender: faucet.address,
|
||||
recipient: recipient,
|
||||
@ -367,7 +367,7 @@ describe("RestClient", () => {
|
||||
it("can query transactions by height", async () => {
|
||||
pendingWithoutWasmd();
|
||||
assert(posted);
|
||||
const client = new RestClient(wasmdEndpoint);
|
||||
const client = new RestClient(wasmd.endpoint);
|
||||
const result = await client.txsQuery(`tx.height=${posted.height}&limit=26`);
|
||||
expect(parseInt(result.count, 10)).toEqual(1);
|
||||
expect(parseInt(result.limit, 10)).toEqual(26);
|
||||
@ -380,7 +380,7 @@ describe("RestClient", () => {
|
||||
it("can query transactions by ID", async () => {
|
||||
pendingWithoutWasmd();
|
||||
assert(posted);
|
||||
const client = new RestClient(wasmdEndpoint);
|
||||
const client = new RestClient(wasmd.endpoint);
|
||||
const result = await client.txsQuery(`tx.hash=${posted.hash}&limit=26`);
|
||||
expect(parseInt(result.count, 10)).toEqual(1);
|
||||
expect(parseInt(result.limit, 10)).toEqual(26);
|
||||
@ -393,7 +393,7 @@ describe("RestClient", () => {
|
||||
it("can query transactions by sender", async () => {
|
||||
pendingWithoutWasmd();
|
||||
assert(posted);
|
||||
const client = new RestClient(wasmdEndpoint);
|
||||
const client = new RestClient(wasmd.endpoint);
|
||||
const result = await client.txsQuery(`message.sender=${posted.sender}&limit=200`);
|
||||
expect(parseInt(result.count, 10)).toBeGreaterThanOrEqual(1);
|
||||
expect(parseInt(result.limit, 10)).toEqual(200);
|
||||
@ -407,7 +407,7 @@ describe("RestClient", () => {
|
||||
it("can query transactions by recipient", async () => {
|
||||
pendingWithoutWasmd();
|
||||
assert(posted);
|
||||
const client = new RestClient(wasmdEndpoint);
|
||||
const client = new RestClient(wasmd.endpoint);
|
||||
const result = await client.txsQuery(`transfer.recipient=${posted.recipient}&limit=200`);
|
||||
expect(parseInt(result.count, 10)).toEqual(1);
|
||||
expect(parseInt(result.limit, 10)).toEqual(200);
|
||||
@ -422,7 +422,7 @@ describe("RestClient", () => {
|
||||
pending("This combination is broken 🤷♂️. Handle client-side at higher level.");
|
||||
pendingWithoutWasmd();
|
||||
assert(posted);
|
||||
const client = new RestClient(wasmdEndpoint);
|
||||
const client = new RestClient(wasmd.endpoint);
|
||||
const hashQuery = `tx.hash=${posted.hash}`;
|
||||
|
||||
{
|
||||
@ -449,7 +449,7 @@ describe("RestClient", () => {
|
||||
it("can filter by recipient and tx.minheight", async () => {
|
||||
pendingWithoutWasmd();
|
||||
assert(posted);
|
||||
const client = new RestClient(wasmdEndpoint);
|
||||
const client = new RestClient(wasmd.endpoint);
|
||||
const recipientQuery = `transfer.recipient=${posted.recipient}`;
|
||||
|
||||
{
|
||||
@ -476,7 +476,7 @@ describe("RestClient", () => {
|
||||
it("can filter by recipient and tx.maxheight", async () => {
|
||||
pendingWithoutWasmd();
|
||||
assert(posted);
|
||||
const client = new RestClient(wasmdEndpoint);
|
||||
const client = new RestClient(wasmd.endpoint);
|
||||
const recipientQuery = `transfer.recipient=${posted.recipient}`;
|
||||
|
||||
{
|
||||
@ -503,7 +503,7 @@ describe("RestClient", () => {
|
||||
it("can query by tags (module + code_id)", async () => {
|
||||
pendingWithoutWasmd();
|
||||
assert(posted);
|
||||
const client = new RestClient(wasmdEndpoint);
|
||||
const client = new RestClient(wasmd.endpoint);
|
||||
const result = await client.txsQuery(`message.module=wasm&message.code_id=${deployedErc20.codeId}`);
|
||||
expect(parseInt(result.count, 10)).toBeGreaterThanOrEqual(4);
|
||||
|
||||
@ -549,7 +549,7 @@ describe("RestClient", () => {
|
||||
it("can query by tags (module + code_id + action)", async () => {
|
||||
pendingWithoutWasmd();
|
||||
assert(posted);
|
||||
const client = new RestClient(wasmdEndpoint);
|
||||
const client = new RestClient(wasmd.endpoint);
|
||||
|
||||
{
|
||||
const uploads = await client.txsQuery(
|
||||
@ -606,7 +606,7 @@ describe("RestClient", () => {
|
||||
describe("encodeTx", () => {
|
||||
it("works for cosmoshub example", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const client = new RestClient(wasmdEndpoint);
|
||||
const client = new RestClient(wasmd.endpoint);
|
||||
expect(await client.encodeTx(cosmoshub.tx)).toEqual(fromBase64(cosmoshub.tx_data));
|
||||
});
|
||||
});
|
||||
@ -641,7 +641,7 @@ describe("RestClient", () => {
|
||||
gas: "890000",
|
||||
};
|
||||
|
||||
const client = new RestClient(wasmdEndpoint);
|
||||
const client = new RestClient(wasmd.endpoint);
|
||||
const { account_number, sequence } = (await client.authAccounts(faucet.address)).result.value;
|
||||
|
||||
const signBytes = makeSignBytes([theMsg], fee, defaultNetworkId, memo, account_number, sequence);
|
||||
@ -655,7 +655,7 @@ describe("RestClient", () => {
|
||||
it("can upload, instantiate and execute wasm", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
|
||||
const client = new RestClient(wasmdEndpoint);
|
||||
const client = new RestClient(wasmd.endpoint);
|
||||
|
||||
const transferAmount: readonly Coin[] = [
|
||||
{
|
||||
@ -729,7 +729,7 @@ describe("RestClient", () => {
|
||||
it("can list upload code", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
|
||||
const client = new RestClient(wasmdEndpoint);
|
||||
const client = new RestClient(wasmd.endpoint);
|
||||
|
||||
// check with contracts were here first to compare
|
||||
const existingInfos = await client.listCodeInfo();
|
||||
@ -769,7 +769,7 @@ describe("RestClient", () => {
|
||||
it("can list contracts and get info", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
|
||||
const client = new RestClient(wasmdEndpoint);
|
||||
const client = new RestClient(wasmd.endpoint);
|
||||
const beneficiaryAddress = makeRandomAddress();
|
||||
const transferAmount: readonly Coin[] = [
|
||||
{
|
||||
@ -830,7 +830,7 @@ describe("RestClient", () => {
|
||||
});
|
||||
|
||||
describe("contract state", () => {
|
||||
const client = new RestClient(wasmdEndpoint);
|
||||
const client = new RestClient(wasmd.endpoint);
|
||||
const noContract = makeRandomAddress();
|
||||
const expectedKey = toAscii("config");
|
||||
let contractAddress: string | undefined;
|
||||
|
||||
@ -78,7 +78,10 @@ export const deployedErc20 = {
|
||||
],
|
||||
};
|
||||
|
||||
export const wasmdEndpoint = "http://localhost:1317";
|
||||
export const wasmd = {
|
||||
endpoint: "http://localhost:1317",
|
||||
expectedChainId: "testing",
|
||||
};
|
||||
|
||||
export const faucet = {
|
||||
mnemonic:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user