diff --git a/.gitignore b/.gitignore index ada1aa28..3c8e876e 100644 --- a/.gitignore +++ b/.gitignore @@ -35,5 +35,5 @@ coverage/ !.yarn/sdks # We are not using yarn's deferred versioning for now (see https://yarnpkg.com/features/release-workflow) # !.yarn/versions -scripts/simapp_local/test_chain_data scripts/simapp/test_chain_data +scripts/lbm/test_chain_data diff --git a/CHANGELOG.md b/CHANGELOG.md index dc5e761d..d0e6c89d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to ## [Unreleased] ### Added +- [\#69](https://github.com/line/lbmjs/pull/69) apply the changes of `x/token` and `x/collection` protos - [\#71](https://github.com/line/lbmjs/pull/71) @lbmjs/finschia: Add custom GetBlockWithTxs for lbm ### Changed @@ -16,6 +17,7 @@ and this project adheres to ### Removed ### Fixed +- [\#73](https://github.com/line/lbmjs/pull/73) fix the local unit test error ### Security diff --git a/packages/finschia/package.json b/packages/finschia/package.json index 9767616d..5c3f5f7e 100644 --- a/packages/finschia/package.json +++ b/packages/finschia/package.json @@ -1,10 +1,11 @@ { "name": "@lbmjs/finschia", - "version": "0.7.2", - "description": "Utilities for LBM SDK 0.46.0", + "version": "0.8.0-rc0", + "description": "Utilities for LBM SDK 0.47.0-alpha1", "contributors": [ "zemyblue ", - "loin3 <55660267+loin3@users.noreply.github.com>" + "loin3 <55660267+loin3@users.noreply.github.com>", + "jaeseung-bae " ], "license": "Apache-2.0", "main": "build/index.js", diff --git a/packages/finschia/src/modules/tx2/queries.spec.ts b/packages/finschia/src/modules/tx2/queries.spec.ts index 016c8140..0f43cb70 100644 --- a/packages/finschia/src/modules/tx2/queries.spec.ts +++ b/packages/finschia/src/modules/tx2/queries.spec.ts @@ -1,8 +1,8 @@ import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; import { coins, MsgSendEncodeObject, QueryClient } from "@cosmjs/stargate"; import { Tendermint34Client } from "@cosmjs/tendermint-rpc"; +import { assert } from "@cosmjs/utils"; import { MsgSend } from "cosmjs-types/cosmos/bank/v1beta1/tx"; -import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx"; import { makeLinkPath } from "../../paths"; import { SigningFinschiaClient } from "../../signingfinschiaclient"; @@ -12,6 +12,7 @@ import { makeRandomAddress, pendingWithoutSimapp, simapp, + simappEnabled, } from "../../testutils.spec"; import { longify } from "../../utils"; import { setupTx2Extension, Tx2Extension } from "./queries"; @@ -21,53 +22,50 @@ async function makeClientWithTx2(rpcUrl: string): Promise<[QueryClient & Tx2Exte return [QueryClient.withExtensions(tmClient, setupTx2Extension), tmClient]; } -async function sendDummyTx() { - const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic, { - hdPaths: [makeLinkPath(0)], - prefix: simapp.prefix, - }); - const client = await SigningFinschiaClient.connectWithSigner( - simapp.tendermintUrl, - wallet, - defaultSigningClientOptions, - ); - const defaultFee = { - amount: coins(250000, simapp.denomFee), - gas: "1500000", - }; - const msg: MsgSend = { - fromAddress: faucet.address0, - toAddress: makeRandomAddress(), - amount: coins(1234, simapp.denomFee), - }; - const dummyMsg: MsgSendEncodeObject = { - typeUrl: "/cosmos.bank.v1beta1.MsgSend", - value: msg, - }; - const signed = await client.sign(faucet.address0, [dummyMsg], defaultFee, ""); - return await client.broadcastTx(Uint8Array.from(TxRaw.encode(signed).finish())); -} - describe("Tx2Extension", () => { - let client: QueryClient & Tx2Extension; - let tmClient: Tendermint34Client; + let txHeight: number | undefined; + beforeAll(async () => { - const res = await makeClientWithTx2(simapp.tendermintUrl); - client = res[0]; - tmClient = res[1]; - }); - afterAll(() => { - tmClient.disconnect(); + if (simappEnabled()) { + const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic, { + hdPaths: [makeLinkPath(0)], + prefix: simapp.prefix, + }); + const client = await SigningFinschiaClient.connectWithSigner( + simapp.tendermintUrl, + wallet, + defaultSigningClientOptions, + ); + const defaultFee = { + amount: coins(250000, simapp.denomFee), + gas: "1500000", + }; + const msg: MsgSend = { + fromAddress: faucet.address0, + toAddress: makeRandomAddress(), + amount: coins(1234, simapp.denomFee), + }; + const dummyMsg: MsgSendEncodeObject = { + typeUrl: "/cosmos.bank.v1beta1.MsgSend", + value: msg, + }; + const result = await client.signAndBroadcast(faucet.address0, [dummyMsg], defaultFee); + txHeight = result.height; + + client.disconnect(); + } }); it("getBlockWithTxs", async () => { pendingWithoutSimapp(); + assert(txHeight, "Missing txHeight"); - const txRes = await sendDummyTx(); - const response = await client.tx2.getBlockWithTxs(longify(txRes.height)); + const [client, tmClient] = await makeClientWithTx2(simapp.tendermintUrl); + const response = await client.tx2.getBlockWithTxs(longify(txHeight)); expect(response.txs).toBeDefined(); expect(response.blockId).toBeDefined(); expect(response.block).toBeDefined(); + tmClient.disconnect(); }); });