Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update package version to v0.8.0-rc0 #73

Merged
merged 5 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <[email protected]>",
"loin3 <[email protected]>"
"loin3 <[email protected]>",
"jaeseung-bae <[email protected]>"
],
"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();
});
});