diff --git a/packages/sdk/src/restclient.spec.ts b/packages/sdk/src/restclient.spec.ts index 9a8b9a29..9c20c438 100644 --- a/packages/sdk/src/restclient.spec.ts +++ b/packages/sdk/src/restclient.spec.ts @@ -25,9 +25,11 @@ const { fromBase64, fromHex, toAscii, toBase64, toHex } = Encoding; const httpUrl = "http://localhost:1317"; const defaultNetworkId = "testing"; -const faucetMnemonic = - "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone"; -const faucetAddress = "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6"; +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 emptyAddress = "cosmos1ltkhnmdcqemmd2tkhnx7qx66tq7e0wykw2j85k"; const unusedAccount = { address: "cosmos1cjsxept9rkggzxztslae9ndgpdyt2408lk850u", @@ -83,7 +85,7 @@ async function uploadContract(client: RestClient, pen: Pen): Promise { describe("post", () => { it("can send tokens", async () => { pendingWithoutCosmos(); - const pen = await Secp256k1Pen.fromMnemonic(faucetMnemonic); + const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); const memo = "My first contract on chain"; const theMsg: MsgSend = { type: "cosmos-sdk/MsgSend", value: { - from_address: faucetAddress, + from_address: faucet.address, to_address: emptyAddress, amount: [ { @@ -257,7 +259,7 @@ describe("RestClient", () => { }; const client = new RestClient(httpUrl); - const account = (await client.authAccounts(faucetAddress)).result.value; + const account = (await client.authAccounts(faucet.address)).result.value; const signBytes = makeSignBytes([theMsg], fee, defaultNetworkId, memo, account); const signature = encodeSecp256k1Signature(pen.pubkey, await pen.createSignature(signBytes)); @@ -269,7 +271,7 @@ describe("RestClient", () => { it("can upload, instantiate and execute wasm", async () => { pendingWithoutCosmos(); - const pen = await Secp256k1Pen.fromMnemonic(faucetMnemonic); + const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); const client = new RestClient(httpUrl); const transferAmount: readonly Coin[] = [ @@ -335,7 +337,7 @@ describe("RestClient", () => { describe("query", () => { it("can list upload code", async () => { pendingWithoutCosmos(); - const pen = await Secp256k1Pen.fromMnemonic(faucetMnemonic); + const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); const client = new RestClient(httpUrl); // check with contracts were here first to compare @@ -355,17 +357,17 @@ describe("RestClient", () => { expect(newInfos.length).toEqual(numExisting + 1); const lastInfo = newInfos[newInfos.length - 1]; expect(lastInfo.id).toEqual(codeId); - expect(lastInfo.creator).toEqual(faucetAddress); + expect(lastInfo.creator).toEqual(faucet.address); // TODO: check code hash matches expectation - // expect(lastInfo.code_hash).toEqual(faucetAddress); + // expect(lastInfo.code_hash).toEqual(faucet.address); // TODO: download code and check against auto-gen }); it("can list contracts and get info", async () => { pendingWithoutCosmos(); - const pen = await Secp256k1Pen.fromMnemonic(faucetMnemonic); + const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); const client = new RestClient(httpUrl); const beneficiaryAddress = makeRandomAddress(); const transferAmount: readonly Coin[] = [ @@ -409,7 +411,7 @@ describe("RestClient", () => { // check out info const myInfo = await client.getContractInfo(myAddress); expect(myInfo.code_id).toEqual(codeId); - expect(myInfo.creator).toEqual(faucetAddress); + expect(myInfo.creator).toEqual(faucet.address); expect((myInfo.init_msg as any).beneficiary).toEqual(beneficiaryAddress); // make sure random addresses don't give useful info @@ -478,7 +480,7 @@ describe("RestClient", () => { // we can query the verifier properly const verifier = await client.queryContractSmart(contractAddress, { verifier: {} }); - expect(verifier).toEqual(faucetAddress); + expect(verifier).toEqual(faucet.address); // invalid query syntax throws an error await client.queryContractSmart(contractAddress, { nosuchkey: {} }).then(