Skip to content

Commit

Permalink
support lbm-sdk-rc8 and bump up cosmjs (#38)
Browse files Browse the repository at this point in the history
* chore: bump up cosmjs to 0.29.0

* chore: add omitted dependencies

* chore: delete unused wasm files

* chore: bump up comjs in root project

* chore: change lbmjs-types version to rc8

* chore: change path to lbm

* chore: update env to get rc8 image and change upload and instantiate function path

* feat: delete wasm module and add wasmplus module

* chore: change version to rc8

* chore: bump up stargate version to 0.29.0 in root

* chore: change export name for wasmplus

* chore: change version to 0.46.0

* chore: delete other members

Co-authored-by: jinseong.cho <jinseong.cho@linecorp.com>
  • Loading branch information
loin3 and loin3 committed Sep 23, 2022
1 parent f1887c2 commit 40d0806
Show file tree
Hide file tree
Showing 52 changed files with 650 additions and 976 deletions.
299 changes: 154 additions & 145 deletions .pnp.cjs

Large diffs are not rendered by default.

This file was deleted.

Git LFS file not shown

This file was deleted.

Git LFS file not shown

This file was deleted.

Git LFS file not shown

This file was deleted.

Git LFS file not shown

This file was deleted.

Git LFS file not shown
3 changes: 0 additions & 3 deletions .yarn/cache/@cosmjs-math-npm-0.28.4-af1914a3b5-89b7d263b4.zip

This file was deleted.

3 changes: 3 additions & 0 deletions .yarn/cache/@cosmjs-math-npm-0.29.0-536187b13e-b420a5f4e0.zip
Git LFS file not shown

This file was deleted.

Git LFS file not shown

This file was deleted.

Git LFS file not shown

This file was deleted.

Git LFS file not shown

This file was deleted.

Git LFS file not shown

This file was deleted.

Git LFS file not shown

This file was deleted.

Git LFS file not shown
3 changes: 0 additions & 3 deletions .yarn/cache/cosmjs-types-npm-0.4.0-accb450c96-ffc3e6451e.zip

This file was deleted.

3 changes: 0 additions & 3 deletions .yarn/cache/cosmjs-types-npm-0.4.1-7067cbeac4-7921026bb7.zip

This file was deleted.

3 changes: 3 additions & 0 deletions .yarn/cache/cosmjs-types-npm-0.5.1-52380d33c4-418622ea55.zip
Git LFS file not shown

This file was deleted.

Git LFS file not shown
3 changes: 3 additions & 0 deletions .yarn/cache/protobufjs-npm-6.11.3-566fb31188-4a6ce19641.zip
Git LFS file not shown
2 changes: 0 additions & 2 deletions checksums.sha256

This file was deleted.

3 changes: 0 additions & 3 deletions hackatom.wasm

This file was deleted.

3 changes: 0 additions & 3 deletions ibc_reflect.wasm

This file was deleted.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
"publish-latest": "yarn workspaces foreach --no-private exec yarn npm publish"
},
"devDependencies": {
"@cosmjs/crypto": "0.28.4",
"@cosmjs/encoding": "0.28.4",
"@cosmjs/proto-signing": "0.28.4",
"@cosmjs/stargate": "0.28.4",
"@cosmjs/crypto": "^0.29.0",
"@cosmjs/encoding": "^0.29.0",
"@cosmjs/proto-signing": "^0.29.0",
"@cosmjs/stargate": "^0.29.0",
"@lbmjs/finschia": "workspace:packages/finschia",
"eslint": "^7.5",
"karma-chrome-launcher": "^3.1.0",
Expand Down
27 changes: 13 additions & 14 deletions packages/finschia/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"name": "@lbmjs/finschia",
"version": "0.4.0-rc7",
"description": "Utilities for LBM SDK 0.45.0-rc7",
"version": "0.4.0-rc8",
"description": "Utilities for LBM SDK 0.46.0-rc8",
"contributors": [
"Simon Warta <webmaster128@users.noreply.github.com>",
"zemyblue <zemyblue@users.noreply.github.com>",
"loin3 <55660267+loin3@users.noreply.github.com>"
],
Expand Down Expand Up @@ -36,23 +35,23 @@
"pack-web": "yarn build-or-skip && webpack --mode development --config webpack.web.config.js"
},
"dependencies": {
"@cosmjs/amino": "0.28.4",
"@cosmjs/cosmwasm-stargate": "0.28.4",
"@cosmjs/encoding": "0.28.4",
"@cosmjs/math": "0.28.4",
"@cosmjs/proto-signing": "0.28.4",
"@cosmjs/stargate": "0.28.4",
"@cosmjs/tendermint-rpc": "0.28.4",
"@cosmjs/utils": "0.28.4",
"cosmjs-types": "0.4.0",
"lbmjs-types": "^0.46.0-rc7",
"@cosmjs/amino": "^0.29.0",
"@cosmjs/cosmwasm-stargate": "^0.29.0",
"@cosmjs/encoding": "^0.29.0",
"@cosmjs/math": "^0.29.0",
"@cosmjs/proto-signing": "^0.29.0",
"@cosmjs/stargate": "^0.29.0",
"@cosmjs/tendermint-rpc": "^0.29.0",
"@cosmjs/utils": "^0.29.0",
"cosmjs-types": "^0.5.1",
"lbmjs-types": "^0.46.0-rc8",
"long": "^4.0.0",
"pako": "^2.0.2",
"protobufjs": "~6.10.2",
"xstream": "^11.14.0"
},
"devDependencies": {
"@cosmjs/crypto": "0.28.4",
"@cosmjs/crypto": "^0.29.0",
"@istanbuljs/nyc-config-typescript": "^1.0.1",
"@types/eslint-plugin-prettier": "^3",
"@types/jasmine": "^3.8",
Expand Down
4 changes: 3 additions & 1 deletion packages/finschia/src/finschiaclient.searchtx.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ async function sendTokens(
},
];
const gasLimit = 200000;
const authInfoBytes = makeAuthInfoBytes([{ pubkey, sequence }], feeAmount, gasLimit);
const feeGranter = undefined;
const feePayer = undefined;
const authInfoBytes = makeAuthInfoBytes([{ pubkey, sequence }], feeAmount, gasLimit, feeGranter, feePayer);

const chainId = await client.getChainId();
const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber);
Expand Down
21 changes: 19 additions & 2 deletions packages/finschia/src/finschiaclient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,15 @@ describe("FinschiaClient", () => {
};
const txBodyBytes = registry.encode(txBody);
const gasLimit = Int53.fromString(fee.gas).toNumber();
const authInfoBytes = makeAuthInfoBytes([{ pubkey, sequence }], fee.amount, gasLimit);
const feeGranter = undefined;
const feePayer = undefined;
const authInfoBytes = makeAuthInfoBytes(
[{ pubkey, sequence }],
fee.amount,
gasLimit,
feeGranter,
feePayer,
);
const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber);
const { signed, signature } = await wallet.signDirect(faucet.address0, signDoc);
const txRaw = TxRaw.fromPartial({
Expand Down Expand Up @@ -331,7 +339,16 @@ describe("FinschiaClient", () => {
const { accountNumber, sequence } = (await client.getSequence(address))!;
const feeAmount = coins(2000, "cony");
const gasLimit = 200000;
const authInfoBytes = makeAuthInfoBytes([{ pubkey, sequence }], feeAmount, gasLimit, sequence);
const feeGranter = undefined;
const feePayer = undefined;
const authInfoBytes = makeAuthInfoBytes(
[{ pubkey, sequence }],
feeAmount,
gasLimit,
feeGranter,
feePayer,
sequence,
);

const chainId = await client.getChainId();
const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber);
Expand Down
31 changes: 23 additions & 8 deletions packages/finschia/src/finschiaclient.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { addCoins } from "@cosmjs/amino";
import { Code, CodeDetails, Contract, ContractCodeHistoryEntry } from "@cosmjs/cosmwasm-stargate";
import {
Code,
CodeDetails,
Contract,
ContractCodeHistoryEntry,
JsonObject,
setupWasmExtension,
WasmExtension,
} from "@cosmjs/cosmwasm-stargate";
import { fromAscii, toHex } from "@cosmjs/encoding";
import { Uint53 } from "@cosmjs/math";
import {
Expand All @@ -22,17 +30,21 @@ import {
SearchTxQuery,
SequenceResponse,
setupAuthExtension,
setupAuthzExtension,
setupBankExtension,
setupDistributionExtension,
setupGovExtension,
setupMintExtension,
setupSlashingExtension,
setupStakingExtension,
setupTxExtension,
StakingExtension,
StargateClientOptions,
TimeoutError,
TxExtension,
} from "@cosmjs/stargate";
import { SlashingExtension } from "@cosmjs/stargate/build/modules";
import { AuthzExtension } from "@cosmjs/stargate/build/modules/authz/queries";
import { HttpEndpoint, Tendermint34Client, toRfc3339WithNanoseconds } from "@cosmjs/tendermint-rpc";
import { assert, sleep } from "@cosmjs/utils";
import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin";
Expand All @@ -51,21 +63,22 @@ import {
FeeGrantExtension,
FoundationExtension,
IbcExtension,
JsonObject,
setupCollectionExtension,
setupEvidenceExtension,
setupFeeGrantExtension,
setupFoundationExtension,
setupIbcExtension,
setupTokenExtension,
setupWasmExtension,
setupWasmplusExtension,
TokenExtension,
WasmExtension,
WasmplusExtension,
} from "./modules";

export type QueryClientWithExtensions = QueryClient &
AuthExtension &
BankExtension &
AuthzExtension &
SlashingExtension &
CollectionExtension &
DistributionExtension &
EvidenceExtension &
Expand All @@ -77,15 +90,16 @@ export type QueryClientWithExtensions = QueryClient &
StakingExtension &
TokenExtension &
TxExtension &
WasmExtension;
WasmExtension &
WasmplusExtension;

function createQueryClientWithExtensions(tmClient: Tendermint34Client): QueryClientWithExtensions {
return QueryClient.withExtensions(
tmClient,
setupAuthExtension,
setupBankExtension,
// setupAuthzExtension, this is omitted in cosmjs export
// setupSlashingExtension, this is omitted in cosmjs export
setupAuthzExtension,
setupSlashingExtension,
setupCollectionExtension,
setupDistributionExtension,
setupEvidenceExtension,
Expand All @@ -98,6 +112,7 @@ function createQueryClientWithExtensions(tmClient: Tendermint34Client): QueryCli
setupTokenExtension,
setupTxExtension,
setupWasmExtension,
setupWasmplusExtension,
);
}

Expand Down Expand Up @@ -362,7 +377,7 @@ export class FinschiaClient {
if (broadcasted.code) {
return Promise.reject(
new Error(
`Broadcasting transaction failed with code ${broadcasted.code} (codespace: ${broadcasted.codeSpace}). Log: ${broadcasted.log}`,
`Broadcasting transaction failed with code ${broadcasted.code} (codespace: ${broadcasted.codespace}). Log: ${broadcasted.log}`,
),
);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/finschia/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export {
MsgStoreCodeAndInstantiateContractEncodeObject,
wasmTypes,
} from "./modules";
export { JsonObject, setupWasmExtension, WasmExtension } from "./modules";
export { setupWasmplusExtension, WasmplusExtension } from "./modules";
export { makeLinkPath } from "./paths";
export {
finschiaRegistryTypes,
Expand Down
12 changes: 8 additions & 4 deletions packages/finschia/src/modules/ibc/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
QueryConnectionChannelsResponse,
QueryNextSequenceReceiveResponse,
QueryPacketAcknowledgementResponse,
QueryPacketAcknowledgementsRequest,
QueryPacketAcknowledgementsResponse,
QueryPacketCommitmentResponse,
QueryPacketCommitmentsResponse,
Expand Down Expand Up @@ -302,22 +303,25 @@ export function setupIbcExtension(base: QueryClient): IbcExtension {
channelId: channelId,
sequence: Long.fromNumber(sequence, true),
}),
packetAcknowledgements: async (portId: string, channelId: string, paginationKey?: Uint8Array) =>
channelQueryService.PacketAcknowledgements({
packetAcknowledgements: async (portId: string, channelId: string, paginationKey?: Uint8Array) => {
const request = QueryPacketAcknowledgementsRequest.fromPartial({
portId: portId,
channelId: channelId,
pagination: createPagination(paginationKey),
}),
});
return channelQueryService.PacketAcknowledgements(request);
},
allPacketAcknowledgements: async (portId: string, channelId: string) => {
const acknowledgements = [];
let response: QueryPacketAcknowledgementsResponse;
let key: Uint8Array | undefined;
do {
response = await channelQueryService.PacketAcknowledgements({
const request = QueryPacketAcknowledgementsRequest.fromPartial({
channelId: channelId,
portId: portId,
pagination: createPagination(key),
});
response = await channelQueryService.PacketAcknowledgements(request);
acknowledgements.push(...response.acknowledgements);
key = response.pagination?.nextKey;
} while (key && key.length);
Expand Down
7 changes: 4 additions & 3 deletions packages/finschia/src/modules/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ export { ibcTypes } from "./ibc/messages";
export { IbcExtension, setupIbcExtension } from "./ibc/queries";
export { tokenTypes } from "./token/messages";
export { setupTokenExtension, TokenExtension } from "./token/queries";
export { wasmTypes } from "./wasm/messages";
export {
isMsgStoreCodeAndInstantiateContract,
MsgStoreCodeAndInstantiateContractEncodeObject,
wasmTypes,
} from "./wasm/messages";
export { JsonObject, setupWasmExtension, WasmExtension } from "./wasm/queries";
wasmplusTypes,
} from "./wasmplus/messages";
export { setupWasmplusExtension, WasmplusExtension } from "./wasmplus/queries";
Loading

0 comments on commit 40d0806

Please sign in to comment.