diff --git a/packages/cosmwasm/src/cosmwasmclient.searchtx.spec.ts b/packages/cosmwasm/src/cosmwasmclient.searchtx.spec.ts index e7f981ea..5eff44b3 100644 --- a/packages/cosmwasm/src/cosmwasmclient.searchtx.spec.ts +++ b/packages/cosmwasm/src/cosmwasmclient.searchtx.spec.ts @@ -7,8 +7,8 @@ import { isMsgExecuteContract, isMsgInstantiateContract } from "./msgs"; import { RestClient } from "./restclient"; import { SigningCosmWasmClient } from "./signingcosmwasmclient"; import { + alice, deployedErc20, - faucet, fromOneElementArray, makeRandomAddress, pendingWithoutWasmd, @@ -47,8 +47,8 @@ describe("CosmWasmClient.searchTx", () => { beforeAll(async () => { if (wasmdEnabled()) { - const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); - const client = new SigningCosmWasmClient(wasmd.endpoint, faucet.address, (signBytes) => + const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic); + const client = new SigningCosmWasmClient(wasmd.endpoint, alice.address0, (signBytes) => pen.sign(signBytes), ); @@ -62,7 +62,7 @@ describe("CosmWasmClient.searchTx", () => { await sleep(50); // wait until tx is indexed const txDetails = await new RestClient(wasmd.endpoint).txById(result.transactionHash); sendSuccessful = { - sender: faucet.address, + sender: alice.address0, recipient: recipient, hash: result.transactionHash, height: Number.parseInt(txDetails.height, 10), @@ -83,7 +83,7 @@ describe("CosmWasmClient.searchTx", () => { type: "cosmos-sdk/MsgSend", value: { // eslint-disable-next-line @typescript-eslint/camelcase - from_address: faucet.address, + from_address: alice.address0, // eslint-disable-next-line @typescript-eslint/camelcase to_address: recipient, amount: transferAmount, @@ -120,7 +120,7 @@ describe("CosmWasmClient.searchTx", () => { // console.log(error); } sendUnsuccessful = { - sender: faucet.address, + sender: alice.address0, recipient: recipient, hash: transactionId, height: heightBeforeThis + 1, @@ -140,7 +140,7 @@ describe("CosmWasmClient.searchTx", () => { await sleep(50); // wait until tx is indexed const txDetails = await new RestClient(wasmd.endpoint).txById(result.transactionHash); postedExecute = { - sender: faucet.address, + sender: alice.address0, contract: hashInstance, hash: result.transactionHash, height: Number.parseInt(txDetails.height, 10), @@ -415,7 +415,7 @@ describe("CosmWasmClient.searchTx", () => { expect(first).toEqual({ type: "wasm/instantiate", value: { - sender: faucet.address, + sender: alice.address0, code_id: deployedErc20.codeId.toString(), label: "HASH", init_msg: jasmine.objectContaining({ symbol: "HASH" }), diff --git a/packages/cosmwasm/src/cosmwasmclient.spec.ts b/packages/cosmwasm/src/cosmwasmclient.spec.ts index 011e1495..32255042 100644 --- a/packages/cosmwasm/src/cosmwasmclient.spec.ts +++ b/packages/cosmwasm/src/cosmwasmclient.spec.ts @@ -10,8 +10,8 @@ import { findAttribute } from "./logs"; import { SigningCosmWasmClient } from "./signingcosmwasmclient"; import cosmoshub from "./testdata/cosmoshub.json"; import { + alice, deployedErc20, - faucet, getHackatom, makeRandomAddress, pendingWithoutWasmd, @@ -202,14 +202,14 @@ describe("CosmWasmClient", () => { describe("postTx", () => { it("works", async () => { pendingWithoutWasmd(); - const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); + const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic); const client = new CosmWasmClient(wasmd.endpoint); const memo = "My first contract on chain"; const sendMsg: MsgSend = { type: "cosmos-sdk/MsgSend", value: { - from_address: faucet.address, + from_address: alice.address0, to_address: makeRandomAddress(), amount: [ { @@ -231,7 +231,7 @@ describe("CosmWasmClient", () => { }; const chainId = await client.getChainId(); - const { accountNumber, sequence } = await client.getNonce(faucet.address); + const { accountNumber, sequence } = await client.getNonce(alice.address0); const signBytes = makeSignBytes([sendMsg], fee, chainId, memo, accountNumber, sequence); const signature = await pen.sign(signBytes); const signedTx = { @@ -259,7 +259,7 @@ describe("CosmWasmClient", () => { source: deployedErc20.source, builder: deployedErc20.builder, checksum: deployedErc20.checksum, - creator: faucet.address, + creator: alice.address0, }); }); }); @@ -275,7 +275,7 @@ describe("CosmWasmClient", () => { source: deployedErc20.source, builder: deployedErc20.builder, checksum: deployedErc20.checksum, - creator: faucet.address, + creator: alice.address0, }; // check info @@ -308,19 +308,19 @@ describe("CosmWasmClient", () => { expect(hash).toEqual({ address: "cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5", codeId: 1, - creator: faucet.address, + creator: alice.address0, label: "HASH", }); expect(isa).toEqual({ address: "cosmos1hqrdl6wstt8qzshwc6mrumpjk9338k0lr4dqxd", codeId: 1, - creator: faucet.address, + creator: alice.address0, label: "ISA", }); expect(jade).toEqual({ address: "cosmos18r5szma8hm93pvx6lwpjwyxruw27e0k5uw835c", codeId: 1, - creator: faucet.address, + creator: alice.address0, label: "JADE", }); }); @@ -334,7 +334,7 @@ describe("CosmWasmClient", () => { expect(hash).toEqual({ address: "cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5", codeId: 1, - creator: faucet.address, + creator: alice.address0, label: "HASH", initMsg: { decimals: 5, @@ -342,7 +342,7 @@ describe("CosmWasmClient", () => { symbol: "HASH", initial_balances: jasmine.arrayContaining([ { - address: faucet.address, + address: alice.address0, amount: "11", }, { @@ -367,8 +367,8 @@ describe("CosmWasmClient", () => { beforeAll(async () => { if (wasmdEnabled()) { pendingWithoutWasmd(); - const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); - const client = new SigningCosmWasmClient(wasmd.endpoint, faucet.address, (signBytes) => + const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic); + const client = new SigningCosmWasmClient(wasmd.endpoint, alice.address0, (signBytes) => pen.sign(signBytes), ); const { codeId } = await client.upload(getHackatom()); @@ -388,7 +388,7 @@ describe("CosmWasmClient", () => { expect(JSON.parse(fromUtf8(raw))).toEqual({ verifier: toBase64(Bech32.decode(contract.initMsg.verifier).data), beneficiary: toBase64(Bech32.decode(contract.initMsg.beneficiary).data), - funder: toBase64(Bech32.decode(faucet.address).data), + funder: toBase64(Bech32.decode(alice.address0).data), }); }); @@ -420,8 +420,8 @@ describe("CosmWasmClient", () => { beforeAll(async () => { if (wasmdEnabled()) { pendingWithoutWasmd(); - const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); - const client = new SigningCosmWasmClient(wasmd.endpoint, faucet.address, (signBytes) => + const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic); + const client = new SigningCosmWasmClient(wasmd.endpoint, alice.address0, (signBytes) => pen.sign(signBytes), ); const { codeId } = await client.upload(getHackatom()); diff --git a/packages/cosmwasm/src/restclient.spec.ts b/packages/cosmwasm/src/restclient.spec.ts index 1ee42402..1d930804 100644 --- a/packages/cosmwasm/src/restclient.spec.ts +++ b/packages/cosmwasm/src/restclient.spec.ts @@ -31,9 +31,9 @@ import { RestClient, TxsResponse } from "./restclient"; import { SigningCosmWasmClient } from "./signingcosmwasmclient"; import cosmoshub from "./testdata/cosmoshub.json"; import { + alice, bech32AddressMatcher, deployedErc20, - faucet, fromOneElementArray, getHackatom, makeRandomAddress, @@ -71,7 +71,7 @@ async function uploadCustomContract( const theMsg: MsgStoreCode = { type: "wasm/store-code", value: { - sender: faucet.address, + sender: alice.address0, wasm_byte_code: toBase64(wasmCode), source: "https://github.com/confio/cosmwasm/raw/0.7/lib/vm/testdata/contract_0.6.wasm", builder: "confio/cosmwasm-opt:0.6.2", @@ -87,7 +87,7 @@ async function uploadCustomContract( gas: "89000000", }; - const { account_number, sequence } = (await client.authAccounts(faucet.address)).result.value; + const { account_number, sequence } = (await client.authAccounts(alice.address0)).result.value; const signBytes = makeSignBytes([theMsg], fee, wasmd.chainId, memo, account_number, sequence); const signature = await pen.sign(signBytes); const signedTx = makeSignedTx(theMsg, fee, memo, signature); @@ -109,11 +109,11 @@ async function instantiateContract( const theMsg: MsgInstantiateContract = { type: "wasm/instantiate", value: { - sender: faucet.address, + sender: alice.address0, code_id: codeId.toString(), label: "my escrow", init_msg: { - verifier: faucet.address, + verifier: alice.address0, beneficiary: beneficiaryAddress, }, init_funds: transferAmount || [], @@ -129,7 +129,7 @@ async function instantiateContract( gas: "89000000", }; - const { account_number, sequence } = (await client.authAccounts(faucet.address)).result.value; + const { account_number, sequence } = (await client.authAccounts(alice.address0)).result.value; const signBytes = makeSignBytes([theMsg], fee, wasmd.chainId, memo, account_number, sequence); const signature = await pen.sign(signBytes); const signedTx = makeSignedTx(theMsg, fee, memo, signature); @@ -145,7 +145,7 @@ async function executeContract( const theMsg: MsgExecuteContract = { type: "wasm/execute", value: { - sender: faucet.address, + sender: alice.address0, contract: contractAddress, msg: { release: {} }, sent_funds: [], @@ -161,7 +161,7 @@ async function executeContract( gas: "89000000", }; - const { account_number, sequence } = (await client.authAccounts(faucet.address)).result.value; + const { account_number, sequence } = (await client.authAccounts(alice.address0)).result.value; const signBytes = makeSignBytes([theMsg], fee, wasmd.chainId, memo, account_number, sequence); const signature = await pen.sign(signBytes); const signedTx = makeSignedTx(theMsg, fee, memo, signature); @@ -207,10 +207,10 @@ describe("RestClient", () => { it("has correct pubkey for faucet", async () => { pendingWithoutWasmd(); const client = new RestClient(wasmd.endpoint); - const { result } = await client.authAccounts(faucet.address); + const { result } = await client.authAccounts(alice.address0); expect(result.value).toEqual( jasmine.objectContaining({ - public_key: encodeBech32Pubkey(faucet.pubkey, "cosmospub"), + public_key: encodeBech32Pubkey(alice.pubkey0, "cosmospub"), }), ); }); @@ -347,8 +347,8 @@ describe("RestClient", () => { beforeAll(async () => { if (wasmdEnabled()) { - const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); - const client = new SigningCosmWasmClient(wasmd.endpoint, faucet.address, (signBytes) => + const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic); + const client = new SigningCosmWasmClient(wasmd.endpoint, alice.address0, (signBytes) => pen.sign(signBytes), ); @@ -360,7 +360,7 @@ describe("RestClient", () => { }; const result = await client.sendTokens(recipient, [transferAmount]); successful = { - sender: faucet.address, + sender: alice.address0, recipient: recipient, hash: result.transactionHash, }; @@ -379,7 +379,7 @@ describe("RestClient", () => { type: "cosmos-sdk/MsgSend", value: { // eslint-disable-next-line @typescript-eslint/camelcase - from_address: faucet.address, + from_address: alice.address0, // eslint-disable-next-line @typescript-eslint/camelcase to_address: recipient, amount: transferAmount, @@ -412,7 +412,7 @@ describe("RestClient", () => { // console.log(error); } unsuccessful = { - sender: faucet.address, + sender: alice.address0, recipient: recipient, hash: transactionId, }; @@ -485,8 +485,8 @@ describe("RestClient", () => { beforeAll(async () => { if (wasmdEnabled()) { - const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); - const client = new SigningCosmWasmClient(wasmd.endpoint, faucet.address, (signBytes) => + const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic); + const client = new SigningCosmWasmClient(wasmd.endpoint, alice.address0, (signBytes) => pen.sign(signBytes), ); @@ -502,7 +502,7 @@ describe("RestClient", () => { await sleep(50); // wait until tx is indexed const txDetails = await new RestClient(wasmd.endpoint).txById(result.transactionHash); posted = { - sender: faucet.address, + sender: alice.address0, recipient: recipient, hash: result.transactionHash, height: Number.parseInt(txDetails.height, 10), @@ -666,7 +666,7 @@ describe("RestClient", () => { assert(isMsgInstantiateContract(jade)); expect(store.value).toEqual( jasmine.objectContaining({ - sender: faucet.address, + sender: alice.address0, source: deployedErc20.source, builder: deployedErc20.builder, }), @@ -678,21 +678,21 @@ describe("RestClient", () => { symbol: "HASH", }), label: "HASH", - sender: faucet.address, + sender: alice.address0, }); expect(isa.value).toEqual({ code_id: deployedErc20.codeId.toString(), init_funds: [], init_msg: jasmine.objectContaining({ symbol: "ISA" }), label: "ISA", - sender: faucet.address, + sender: alice.address0, }); expect(jade.value).toEqual({ code_id: deployedErc20.codeId.toString(), init_funds: [], init_msg: jasmine.objectContaining({ symbol: "JADE" }), label: "JADE", - sender: faucet.address, + sender: alice.address0, }); }); @@ -711,7 +711,7 @@ describe("RestClient", () => { assert(isMsgStoreCode(store)); expect(store.value).toEqual( jasmine.objectContaining({ - sender: faucet.address, + sender: alice.address0, source: deployedErc20.source, builder: deployedErc20.builder, }), @@ -734,21 +734,21 @@ describe("RestClient", () => { symbol: "HASH", }), label: "HASH", - sender: faucet.address, + sender: alice.address0, }); expect(isa.value).toEqual({ code_id: deployedErc20.codeId.toString(), init_funds: [], init_msg: jasmine.objectContaining({ symbol: "ISA" }), label: "ISA", - sender: faucet.address, + sender: alice.address0, }); expect(jade.value).toEqual({ code_id: deployedErc20.codeId.toString(), init_funds: [], init_msg: jasmine.objectContaining({ symbol: "JADE" }), label: "JADE", - sender: faucet.address, + sender: alice.address0, }); } }); @@ -765,13 +765,13 @@ describe("RestClient", () => { describe("postTx", () => { it("can send tokens", async () => { pendingWithoutWasmd(); - const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); + const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic); const memo = "My first contract on chain"; const theMsg: MsgSend = { type: "cosmos-sdk/MsgSend", value: { - from_address: faucet.address, + from_address: alice.address0, to_address: emptyAddress, amount: [ { @@ -793,7 +793,7 @@ describe("RestClient", () => { }; const client = new RestClient(wasmd.endpoint); - const { account_number, sequence } = (await client.authAccounts(faucet.address)).result.value; + const { account_number, sequence } = (await client.authAccounts(alice.address0)).result.value; const signBytes = makeSignBytes([theMsg], fee, wasmd.chainId, memo, account_number, sequence); const signature = await pen.sign(signBytes); @@ -813,9 +813,9 @@ describe("RestClient", () => { it("can't send transaction with additional signatures", async () => { pendingWithoutWasmd(); - const account1 = await Secp256k1Pen.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(0)); - const account2 = await Secp256k1Pen.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(1)); - const account3 = await Secp256k1Pen.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(2)); + const account1 = await Secp256k1Pen.fromMnemonic(alice.mnemonic, makeCosmoshubPath(0)); + const account2 = await Secp256k1Pen.fromMnemonic(alice.mnemonic, makeCosmoshubPath(1)); + const account3 = await Secp256k1Pen.fromMnemonic(alice.mnemonic, makeCosmoshubPath(2)); const address1 = rawSecp256k1PubkeyToAddress(account1.pubkey, "cosmos"); const address2 = rawSecp256k1PubkeyToAddress(account2.pubkey, "cosmos"); const address3 = rawSecp256k1PubkeyToAddress(account3.pubkey, "cosmos"); @@ -870,7 +870,7 @@ describe("RestClient", () => { it("can send multiple messages with one signature", async () => { pendingWithoutWasmd(); - const account1 = await Secp256k1Pen.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(0)); + const account1 = await Secp256k1Pen.fromMnemonic(alice.mnemonic, makeCosmoshubPath(0)); const address1 = rawSecp256k1PubkeyToAddress(account1.pubkey, "cosmos"); const memo = "My first contract on chain"; @@ -929,8 +929,8 @@ describe("RestClient", () => { it("can send multiple messages with multiple signatures", async () => { pendingWithoutWasmd(); - const account1 = await Secp256k1Pen.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(0)); - const account2 = await Secp256k1Pen.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(1)); + const account1 = await Secp256k1Pen.fromMnemonic(alice.mnemonic, makeCosmoshubPath(0)); + const account2 = await Secp256k1Pen.fromMnemonic(alice.mnemonic, makeCosmoshubPath(1)); const address1 = rawSecp256k1PubkeyToAddress(account1.pubkey, "cosmos"); const address2 = rawSecp256k1PubkeyToAddress(account2.pubkey, "cosmos"); @@ -998,8 +998,8 @@ describe("RestClient", () => { it("can't send transaction with wrong signature order (1)", async () => { pendingWithoutWasmd(); - const account1 = await Secp256k1Pen.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(0)); - const account2 = await Secp256k1Pen.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(1)); + const account1 = await Secp256k1Pen.fromMnemonic(alice.mnemonic, makeCosmoshubPath(0)); + const account2 = await Secp256k1Pen.fromMnemonic(alice.mnemonic, makeCosmoshubPath(1)); const address1 = rawSecp256k1PubkeyToAddress(account1.pubkey, "cosmos"); const address2 = rawSecp256k1PubkeyToAddress(account2.pubkey, "cosmos"); @@ -1062,8 +1062,8 @@ describe("RestClient", () => { it("can't send transaction with wrong signature order (2)", async () => { pendingWithoutWasmd(); - const account1 = await Secp256k1Pen.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(0)); - const account2 = await Secp256k1Pen.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(1)); + const account1 = await Secp256k1Pen.fromMnemonic(alice.mnemonic, makeCosmoshubPath(0)); + const account2 = await Secp256k1Pen.fromMnemonic(alice.mnemonic, makeCosmoshubPath(1)); const address1 = rawSecp256k1PubkeyToAddress(account1.pubkey, "cosmos"); const address2 = rawSecp256k1PubkeyToAddress(account2.pubkey, "cosmos"); @@ -1126,7 +1126,7 @@ describe("RestClient", () => { it("can upload, instantiate and execute wasm", async () => { pendingWithoutWasmd(); - const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); + const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic); const client = new RestClient(wasmd.endpoint); const transferAmount: readonly Coin[] = [ @@ -1200,7 +1200,7 @@ describe("RestClient", () => { describe("query", () => { it("can list upload code", async () => { pendingWithoutWasmd(); - const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); + const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic); const client = new RestClient(wasmd.endpoint); // check with contracts were here first to compare @@ -1221,7 +1221,7 @@ describe("RestClient", () => { expect(newInfos.length).toEqual(numExisting + 1); const lastInfo = newInfos[newInfos.length - 1]; expect(lastInfo.id).toEqual(codeId); - expect(lastInfo.creator).toEqual(faucet.address); + expect(lastInfo.creator).toEqual(alice.address0); // ensure metadata is present expect(lastInfo.source).toEqual( @@ -1240,7 +1240,7 @@ describe("RestClient", () => { it("can list contracts and get info", async () => { pendingWithoutWasmd(); - const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); + const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic); const client = new RestClient(wasmd.endpoint); const beneficiaryAddress = makeRandomAddress(); const transferAmount: readonly Coin[] = [ @@ -1284,7 +1284,7 @@ describe("RestClient", () => { expect(newContract).toEqual( jasmine.objectContaining({ code_id: codeId, - creator: faucet.address, + creator: alice.address0, label: "my escrow", }), ); @@ -1293,7 +1293,7 @@ describe("RestClient", () => { const myInfo = await client.getContractInfo(myAddress); assert(myInfo); expect(myInfo.code_id).toEqual(codeId); - expect(myInfo.creator).toEqual(faucet.address); + expect(myInfo.creator).toEqual(alice.address0); expect((myInfo.init_msg as any).beneficiary).toEqual(beneficiaryAddress); // make sure random addresses don't give useful info @@ -1309,7 +1309,7 @@ describe("RestClient", () => { beforeAll(async () => { if (wasmdEnabled()) { - const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); + const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic); const uploadResult = await uploadContract(client, pen); assert(!uploadResult.code); const uploadLogs = parseLogs(uploadResult.logs); @@ -1363,7 +1363,7 @@ describe("RestClient", () => { // we can query the verifier properly const resultDocument = await client.queryContractSmart(contractAddress!, { verifier: {} }); - expect(resultDocument).toEqual({ verifier: faucet.address }); + expect(resultDocument).toEqual({ verifier: alice.address0 }); // invalid query syntax throws an error await client.queryContractSmart(contractAddress!, { nosuchkey: {} }).then( diff --git a/packages/cosmwasm/src/signingcosmwasmclient.spec.ts b/packages/cosmwasm/src/signingcosmwasmclient.spec.ts index d617d9d0..8306e102 100644 --- a/packages/cosmwasm/src/signingcosmwasmclient.spec.ts +++ b/packages/cosmwasm/src/signingcosmwasmclient.spec.ts @@ -6,7 +6,7 @@ import { assert } from "@iov/utils"; import { PrivateCosmWasmClient } from "./cosmwasmclient"; import { RestClient } from "./restclient"; import { SigningCosmWasmClient, UploadMeta } from "./signingcosmwasmclient"; -import { faucet, getHackatom, makeRandomAddress, pendingWithoutWasmd } from "./testutils.spec"; +import { alice, getHackatom, makeRandomAddress, pendingWithoutWasmd } from "./testutils.spec"; const { toHex } = Encoding; @@ -15,8 +15,8 @@ const httpUrl = "http://localhost:1317"; describe("SigningCosmWasmClient", () => { describe("makeReadOnly", () => { it("can be constructed", async () => { - const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); - const client = new SigningCosmWasmClient(httpUrl, faucet.address, (signBytes) => pen.sign(signBytes)); + const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic); + const client = new SigningCosmWasmClient(httpUrl, alice.address0, (signBytes) => pen.sign(signBytes)); expect(client).toBeTruthy(); }); }); @@ -24,8 +24,8 @@ describe("SigningCosmWasmClient", () => { describe("getHeight", () => { it("always uses authAccount implementation", async () => { pendingWithoutWasmd(); - const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); - const client = new SigningCosmWasmClient(httpUrl, faucet.address, (signBytes) => pen.sign(signBytes)); + const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic); + const client = new SigningCosmWasmClient(httpUrl, alice.address0, (signBytes) => pen.sign(signBytes)); const openedClient = (client as unknown) as PrivateCosmWasmClient; const blockLatestSpy = spyOn(openedClient.restClient, "blocksLatest").and.callThrough(); @@ -42,8 +42,8 @@ describe("SigningCosmWasmClient", () => { describe("upload", () => { it("works", async () => { pendingWithoutWasmd(); - const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); - const client = new SigningCosmWasmClient(httpUrl, faucet.address, (signBytes) => pen.sign(signBytes)); + const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic); + const client = new SigningCosmWasmClient(httpUrl, alice.address0, (signBytes) => pen.sign(signBytes)); const wasm = getHackatom(); const { codeId, @@ -61,8 +61,8 @@ describe("SigningCosmWasmClient", () => { it("can set builder and source", async () => { pendingWithoutWasmd(); - const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); - const client = new SigningCosmWasmClient(httpUrl, faucet.address, (signBytes) => pen.sign(signBytes)); + const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic); + const client = new SigningCosmWasmClient(httpUrl, alice.address0, (signBytes) => pen.sign(signBytes)); const wasm = getHackatom(); const meta: UploadMeta = { @@ -80,8 +80,8 @@ describe("SigningCosmWasmClient", () => { describe("instantiate", () => { it("works with transfer amount", async () => { pendingWithoutWasmd(); - const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); - const client = new SigningCosmWasmClient(httpUrl, faucet.address, (signBytes) => pen.sign(signBytes)); + const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic); + const client = new SigningCosmWasmClient(httpUrl, alice.address0, (signBytes) => pen.sign(signBytes)); const { codeId } = await client.upload(getHackatom()); const transferAmount: readonly Coin[] = [ @@ -98,7 +98,7 @@ describe("SigningCosmWasmClient", () => { const { contractAddress } = await client.instantiate( codeId, { - verifier: faucet.address, + verifier: alice.address0, beneficiary: beneficiaryAddress, }, "My cool label", @@ -113,14 +113,14 @@ describe("SigningCosmWasmClient", () => { it("can instantiate one code multiple times", async () => { pendingWithoutWasmd(); - const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); - const client = new SigningCosmWasmClient(httpUrl, faucet.address, (signBytes) => pen.sign(signBytes)); + const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic); + const client = new SigningCosmWasmClient(httpUrl, alice.address0, (signBytes) => pen.sign(signBytes)); const { codeId } = await client.upload(getHackatom()); const contractAddress1 = await client.instantiate( codeId, { - verifier: faucet.address, + verifier: alice.address0, beneficiary: makeRandomAddress(), }, "contract 1", @@ -128,7 +128,7 @@ describe("SigningCosmWasmClient", () => { const contractAddress2 = await client.instantiate( codeId, { - verifier: faucet.address, + verifier: alice.address0, beneficiary: makeRandomAddress(), }, "contract 2", @@ -140,8 +140,8 @@ describe("SigningCosmWasmClient", () => { describe("execute", () => { it("works", async () => { pendingWithoutWasmd(); - const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); - const client = new SigningCosmWasmClient(httpUrl, faucet.address, (signBytes) => pen.sign(signBytes)); + const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic); + const client = new SigningCosmWasmClient(httpUrl, alice.address0, (signBytes) => pen.sign(signBytes)); const { codeId } = await client.upload(getHackatom()); // instantiate @@ -159,7 +159,7 @@ describe("SigningCosmWasmClient", () => { const { contractAddress } = await client.instantiate( codeId, { - verifier: faucet.address, + verifier: alice.address0, beneficiary: beneficiaryAddress, }, "amazing random contract", @@ -189,8 +189,8 @@ describe("SigningCosmWasmClient", () => { describe("sendTokens", () => { it("works", async () => { pendingWithoutWasmd(); - const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); - const client = new SigningCosmWasmClient(httpUrl, faucet.address, (signBytes) => pen.sign(signBytes)); + const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic); + const client = new SigningCosmWasmClient(httpUrl, alice.address0, (signBytes) => pen.sign(signBytes)); // instantiate const transferAmount: readonly Coin[] = [ diff --git a/packages/cosmwasm/src/testutils.spec.ts b/packages/cosmwasm/src/testutils.spec.ts index a8d9194d..86128c7b 100644 --- a/packages/cosmwasm/src/testutils.spec.ts +++ b/packages/cosmwasm/src/testutils.spec.ts @@ -39,14 +39,13 @@ export const wasmd = { chainId: "testing", }; -export const faucet = { - mnemonic: - "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone", - pubkey: { +export const alice = { + mnemonic: "enlist hip relief stomach skate base shallow young switch frequent cry park", + pubkey0: { type: "tendermint/PubKeySecp256k1", - value: "A08EGB7ro1ORuFhjOnZcSgwYlpe0DSFjVNUIkNNQxwKQ", + value: "A9cXhWb8ZpqCzkA8dQCPV29KdeRLV3rUYxrkHudLbQtS", }, - address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", + address0: "cosmos14qemq0vw6y3gc3u3e0aty2e764u4gs5le3hada", }; /** Unused account */ diff --git a/packages/demo-staking/src/index.spec.ts b/packages/demo-staking/src/index.spec.ts index 2bf17ab6..78af9bae 100644 --- a/packages/demo-staking/src/index.spec.ts +++ b/packages/demo-staking/src/index.spec.ts @@ -18,10 +18,9 @@ function pendingWithoutWasmd(): void { } const httpUrl = "http://localhost:1317"; -const faucet = { - mnemonic: - "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone", - address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", +const alice = { + mnemonic: "enlist hip relief stomach skate base shallow young switch frequent cry park", + address0: "cosmos14qemq0vw6y3gc3u3e0aty2e764u4gs5le3hada", }; /** Code info staking.wasm */ @@ -41,14 +40,14 @@ describe("Staking demo", () => { it("works", async () => { pendingWithoutWasmd(); // The owner of the contract that will collect the tax - const ownerPen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); + const ownerPen = await Secp256k1Pen.fromMnemonic(alice.mnemonic); const ownerAddress = ownerPen.address("cosmos"); const ownerClient = new SigningCosmWasmClient(httpUrl, ownerAddress, (signBytes) => ownerPen.sign(signBytes), ); // a user of the contract - const userPen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(1)); + const userPen = await Secp256k1Pen.fromMnemonic(alice.mnemonic, makeCosmoshubPath(1)); const userAddress = userPen.address("cosmos"); const userClient = new SigningCosmWasmClient( httpUrl, diff --git a/scripts/wasmd/deploy_erc20.js b/scripts/wasmd/deploy_erc20.js index 8fc612a9..9cb79a2f 100755 --- a/scripts/wasmd/deploy_erc20.js +++ b/scripts/wasmd/deploy_erc20.js @@ -6,14 +6,13 @@ const { Secp256k1Pen } = require("@cosmwasm/sdk38"); const fs = require("fs"); const httpUrl = "http://localhost:1317"; -const faucet = { - mnemonic: - "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone", - address0: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", - address1: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", - address2: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k", - address3: "cosmos142u9fgcjdlycfcez3lw8x6x5h7rfjlnfhpw2lx", - address4: "cosmos1hsm76p4ahyhl5yh3ve9ur49r5kemhp2r0dcjvx", +const alice = { + mnemonic: "enlist hip relief stomach skate base shallow young switch frequent cry park", + address0: "cosmos14qemq0vw6y3gc3u3e0aty2e764u4gs5le3hada", + address1: "cosmos1hhg2rlu9jscacku2wwckws7932qqqu8x3gfgw0", + address2: "cosmos1xv9tklw7d82sezh9haa573wufgy59vmwe6xxe5", + address3: "cosmos17yg9mssjenmc3jkqth6ulcwj9cxujrxxzezwta", + address4: "cosmos1f7j7ryulwjfe9ljplvhtcaxa6wqgula3etktce", }; const unused = { address: "cosmos1cjsxept9rkggzxztslae9ndgpdyt2408lk850u", @@ -24,7 +23,7 @@ const guest = { const codeMeta = { source: "https://crates.io/api/v1/crates/cw-erc20/0.4.0/download", - builder: "cosmwasm/rust-optimizer:0.8.0" + builder: "cosmwasm/rust-optimizer:0.8.0", }; const initMsgHash = { @@ -33,23 +32,23 @@ const initMsgHash = { symbol: "HASH", initial_balances: [ { - address: faucet.address0, + address: alice.address0, amount: "11", }, { - address: faucet.address1, + address: alice.address1, amount: "11", }, { - address: faucet.address2, + address: alice.address2, amount: "11", }, { - address: faucet.address3, + address: alice.address3, amount: "11", }, { - address: faucet.address4, + address: alice.address4, amount: "11", }, { @@ -68,23 +67,23 @@ const initMsgIsa = { symbol: "ISA", initial_balances: [ { - address: faucet.address0, + address: alice.address0, amount: "999999999", }, { - address: faucet.address1, + address: alice.address1, amount: "999999999", }, { - address: faucet.address2, + address: alice.address2, amount: "999999999", }, { - address: faucet.address3, + address: alice.address3, amount: "999999999", }, { - address: faucet.address4, + address: alice.address4, amount: "999999999", }, { @@ -99,23 +98,23 @@ const initMsgJade = { symbol: "JADE", initial_balances: [ { - address: faucet.address0, + address: alice.address0, amount: "189189189000000000000000000", // 189189189 JADE }, { - address: faucet.address1, + address: alice.address1, amount: "189189189000000000000000000", // 189189189 JADE }, { - address: faucet.address2, + address: alice.address2, amount: "189189189000000000000000000", // 189189189 JADE }, { - address: faucet.address3, + address: alice.address3, amount: "189189189000000000000000000", // 189189189 JADE }, { - address: faucet.address4, + address: alice.address4, amount: "189189189000000000000000000", // 189189189 JADE }, { @@ -126,8 +125,8 @@ const initMsgJade = { }; async function main() { - const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); - const client = new SigningCosmWasmClient(httpUrl, faucet.address0, (signBytes) => pen.sign(signBytes)); + const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic); + const client = new SigningCosmWasmClient(httpUrl, alice.address0, (signBytes) => pen.sign(signBytes)); const wasm = fs.readFileSync(__dirname + "/contracts/cw-erc20.wasm"); const uploadReceipt = await client.upload(wasm, codeMeta, "Upload ERC20 contract"); diff --git a/scripts/wasmd/deploy_nameservice.js b/scripts/wasmd/deploy_nameservice.js index d2e3c196..efe8a58d 100755 --- a/scripts/wasmd/deploy_nameservice.js +++ b/scripts/wasmd/deploy_nameservice.js @@ -6,15 +6,14 @@ const { Secp256k1Pen } = require("@cosmwasm/sdk38"); const fs = require("fs"); const httpUrl = "http://localhost:1317"; -const faucet = { - mnemonic: - "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone", - address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", +const alice = { + mnemonic: "enlist hip relief stomach skate base shallow young switch frequent cry park", + address0: "cosmos14qemq0vw6y3gc3u3e0aty2e764u4gs5le3hada", }; const codeMeta = { source: "https://crates.io/api/v1/crates/cw-nameservice/0.4.0/download", - builder: "cosmwasm/rust-optimizer:0.8.0" + builder: "cosmwasm/rust-optimizer:0.8.0", }; const free = { @@ -23,7 +22,7 @@ const free = { }; const luxury = { - label: "Luxury", + label: "Lux,ury", initMsg: { purchase_price: { denom: "ucosm", @@ -37,8 +36,8 @@ const luxury = { }; async function main() { - const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); - const client = new SigningCosmWasmClient(httpUrl, faucet.address, (signBytes) => pen.sign(signBytes)); + const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic); + const client = new SigningCosmWasmClient(httpUrl, alice.address0, (signBytes) => pen.sign(signBytes)); const wasm = fs.readFileSync(__dirname + "/contracts/cw-nameservice.wasm"); const uploadReceipt = await client.upload(wasm, codeMeta, "Upload Name Service code"); diff --git a/scripts/wasmd/deploy_staking.js b/scripts/wasmd/deploy_staking.js index ba8e0e3b..9025b11e 100755 --- a/scripts/wasmd/deploy_staking.js +++ b/scripts/wasmd/deploy_staking.js @@ -6,10 +6,9 @@ const { Secp256k1Pen } = require("@cosmwasm/sdk38"); const fs = require("fs"); const httpUrl = "http://localhost:1317"; -const faucet = { - mnemonic: - "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone", - address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", +const alice = { + mnemonic: "enlist hip relief stomach skate base shallow young switch frequent cry park", + address0: "cosmos14qemq0vw6y3gc3u3e0aty2e764u4gs5le3hada", }; const codeMeta = { @@ -32,8 +31,8 @@ const bounty = { }; async function main() { - const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); - const client = new SigningCosmWasmClient(httpUrl, faucet.address, (signBytes) => pen.sign(signBytes)); + const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic); + const client = new SigningCosmWasmClient(httpUrl, alice.address0, (signBytes) => pen.sign(signBytes)); const wasm = fs.readFileSync(__dirname + "/contracts/staking.wasm"); const uploadReceipt = await client.upload(wasm, codeMeta, "Upload Staking code");