Skip to content

Commit

Permalink
chore: update package version to v0.8.0-rc0 (#73)
Browse files Browse the repository at this point in the history
* chore: add changelog of #69

Signed-off-by: zemyblue <zemyblue@gmail.com>

* chore: update a package version of @lbmjs/finschia`

Signed-off-by: zemyblue <zemyblue@gmail.com>

* fix: local test error of `Tx2Extension`

Signed-off-by: zemyblue <zemyblue@gmail.com>

* chore: update gitignore

Signed-off-by: zemyblue <zemyblue@gmail.com>

* chore: update changelog for this PR.

Signed-off-by: zemyblue <zemyblue@gmail.com>

---------

Signed-off-by: zemyblue <zemyblue@gmail.com>
  • Loading branch information
zemyblue committed Feb 16, 2023
1 parent 08f1c2e commit 55ea65d
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
7 changes: 4 additions & 3 deletions packages/finschia/package.json
Original file line number Diff line number Diff line change
@@ -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 <zemyblue@users.noreply.github.com>",
"loin3 <55660267+loin3@users.noreply.github.com>"
"loin3 <55660267+loin3@users.noreply.github.com>",
"jaeseung-bae <jaeseung-bae@users.noreply.github.com>"
],
"license": "Apache-2.0",
"main": "build/index.js",
Expand Down
74 changes: 36 additions & 38 deletions packages/finschia/src/modules/tx2/queries.spec.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -12,6 +12,7 @@ import {
makeRandomAddress,
pendingWithoutSimapp,
simapp,
simappEnabled,
} from "../../testutils.spec";
import { longify } from "../../utils";
import { setupTx2Extension, Tx2Extension } from "./queries";
Expand All @@ -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();
});
});

0 comments on commit 55ea65d

Please sign in to comment.