Skip to content

Commit

Permalink
build(deps): bump cosmjs to v0.32.2
Browse files Browse the repository at this point in the history
  • Loading branch information
eliasmpw committed Feb 6, 2024
1 parent 1ceca20 commit 188955c
Show file tree
Hide file tree
Showing 38 changed files with 8,213 additions and 1,182 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## v0.6.1 (Unreleased)

### Changed

- removed `long` package (#115)

#### **arch3-core**

- change the type of `gasWanted` and `gasUsed`of `TxResult` from `number` to `bigint`,
to match the new types returned by `@cosmjs/cosmwasm-stargate` (#115)
- replace deprecated `TendermintClient` with `CosmosClient` (#115)

#### **arch3-proto**

- update `@cosmology/telescope` to version `1.4.12`, and update config files with options
`useTelescopeGeneratedType = true` and `enabledRegistryLoader = false` as a workaround
for currently open [telescope issue #482](https://github.com/cosmology-tech/telescope/issues/482) (#115)
- update codegen script and compile proto files (#115)

## v0.6.0 (2023-02-06)

### BREAKING CHANGES
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ services:
image: archwaynetwork/archwayd:v6.0.0
command: start --x-crisis-skip-assert-invariants
entrypoint: /docker-entrypoint.sh
platform: linux/amd64
ports:
- 1317:1317 # API
- 9090:9090 # gRPC
Expand Down
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,12 @@
]
},
"resolutions": {
"@cosmjs/amino": "^0.31.3",
"@cosmjs/cosmwasm-stargate": "^0.31.3",
"@cosmjs/math": "^0.31.3",
"@cosmjs/proto-signing": "^0.31.3",
"@cosmjs/stargate": "^0.31.3",
"@cosmjs/tendermint-rpc": "^0.31.3",
"long": "^5.2.3"
"@cosmjs/amino": "^0.32.2",
"@cosmjs/cosmwasm-stargate": "^0.32.2",
"@cosmjs/math": "^0.32.2",
"@cosmjs/proto-signing": "^0.32.2",
"@cosmjs/stargate": "^0.32.2",
"@cosmjs/tendermint-rpc": "^0.32.2"
},
"dependencies": {
"@archwayhq/arch3-core": "workspace:^",
Expand Down
15 changes: 7 additions & 8 deletions packages/arch3-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,13 @@
},
"dependencies": {
"@archwayhq/arch3-proto": "workspace:^",
"@cosmjs/amino": "^0.31.3",
"@cosmjs/cosmwasm-stargate": "^0.31.3",
"@cosmjs/math": "^0.31.3",
"@cosmjs/proto-signing": "^0.31.3",
"@cosmjs/stargate": "^0.31.3",
"@cosmjs/tendermint-rpc": "^0.31.3",
"lodash": "^4.17.21",
"long": "^5.2.3"
"@cosmjs/amino": "^0.32.2",
"@cosmjs/cosmwasm-stargate": "^0.32.2",
"@cosmjs/math": "^0.32.2",
"@cosmjs/proto-signing": "^0.32.2",
"@cosmjs/stargate": "^0.32.2",
"@cosmjs/tendermint-rpc": "^0.32.2",
"lodash": "^4.17.21"
},
"devDependencies": {
"@microsoft/eslint-formatter-sarif": "^3.0.0",
Expand Down
24 changes: 12 additions & 12 deletions packages/arch3-core/src/archwayclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { Coin } from '@cosmjs/amino';
import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate';
import {
Tendermint37Client,
TendermintClient,
HttpEndpoint,
RpcClient,
HttpBatchClient,
HttpBatchClientOptions
HttpBatchClientOptions,
CometClient
} from '@cosmjs/tendermint-rpc';

import { IArchwayQueryClient, createArchwayQueryClient } from './queryclient';
Expand All @@ -26,26 +26,26 @@ import {
export class ArchwayClient extends CosmWasmClient implements IArchwayQueryClient {
private readonly archwayQueryClient: IArchwayQueryClient;

protected constructor(tmClient: TendermintClient | undefined) {
super(tmClient);
this.archwayQueryClient = createArchwayQueryClient(tmClient);
protected constructor(cometClient: CometClient | undefined) {
super(cometClient);
this.archwayQueryClient = createArchwayQueryClient(cometClient);
}

/**
* Creates an instance by connecting to the given Tendermint RPC endpoint.
* Creates an instance by connecting to the given Tendermint/Comet RPC endpoint.
*
* @param endpoint - String URL of the RPC endpoint to connect or an {@link HttpEndpoint} object.
* @returns An {@link ArchwayClient} connected to the endpoint.
*
* @see Use {@link ArchwayClient.create} if you need Tendermint 0.37 support.
* @see Use {@link ArchwayClient.create} if you need Comet 0.38 support.
*/
public static override async connect(endpoint: string | HttpEndpoint): Promise<ArchwayClient> {
const tmClient = await Tendermint37Client.connect(endpoint);
return ArchwayClient.create(tmClient);
}

/**
* Creates an instance by connecting to the given Tendermint RPC endpoint using an {@link HttpBatchClient} to batch
* Creates an instance by connecting to the given Tendermint/Comet RPC endpoint using an {@link HttpBatchClient} to batch
* multiple requests and reduce queries to the server.
*
* @param endpoint - String URL of the RPC endpoint to connect or an {@link HttpEndpoint} object.
Expand All @@ -61,14 +61,14 @@ export class ArchwayClient extends CosmWasmClient implements IArchwayQueryClient
}

/**
* Creates an instance from a manually created Tendermint client.
* Creates an instance from a manually created Comet client.
*
* @param tmClient - A Tendermint client for a given endpoint.
* @param cometClient - A Comet client for a given endpoint.
* @returns An {@link ArchwayClient} connected to the endpoint.
*/
/* eslint-disable-next-line @typescript-eslint/require-await */
public static override async create(tmClient: TendermintClient): Promise<ArchwayClient> {
return new ArchwayClient(tmClient);
public static override async create(cometClient: CometClient): Promise<ArchwayClient> {
return new ArchwayClient(cometClient);
}

public async getBlockRewardsTracking(): Promise<BlockTracking> {
Expand Down
3 changes: 1 addition & 2 deletions packages/arch3-core/src/modules/rewards/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
QueryRewardsRecordsResponse
} from '@archwayhq/arch3-proto/build/archway/rewards/v1/query';
import { createPagination, QueryClient } from '@cosmjs/stargate';
import Long from 'long';

export interface RewardsExtension {
readonly rewards: {
Expand Down Expand Up @@ -41,7 +40,7 @@ export function setupRewardsExtension(base: QueryClient): RewardsExtension {
blockRewardsTracking: () => queryService.blockRewardsTracking(),
rewardsPool: () => queryService.rewardsPool(),
estimateTxFees: (gasLimit: number, contractAddress: string) => queryService.estimateTxFees({
gasLimit: Long.fromNumber(gasLimit),
gasLimit: BigInt(gasLimit),
contractAddress,
}),
rewardsRecords: (rewardsAddress: string, paginationKey?: Uint8Array) => queryService.rewardsRecords({
Expand Down
30 changes: 15 additions & 15 deletions packages/arch3-core/src/queryclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
setupTxExtension,
TxExtension
} from '@cosmjs/stargate';
import { fromSeconds, TendermintClient, toRfc3339WithNanoseconds } from '@cosmjs/tendermint-rpc';
import { fromSeconds, CometClient, toRfc3339WithNanoseconds } from '@cosmjs/tendermint-rpc';

import { RewardsExtension, setupRewardsExtension } from './modules';
import {
Expand Down Expand Up @@ -91,10 +91,10 @@ export interface IArchwayQueryClient {
class ArchwayQueryClientImpl implements IArchwayQueryClient {
private readonly queryClient: ExtendedQueryClient | undefined;

public constructor(tmClient: TendermintClient | undefined) {
if (tmClient) {
public constructor(cometClient: CometClient | undefined) {
if (cometClient) {
this.queryClient = QueryClient.withExtensions(
tmClient,
cometClient,
setupAuthExtension,
setupBankExtension,
setupWasmExtension,
Expand Down Expand Up @@ -123,17 +123,17 @@ class ArchwayQueryClientImpl implements IArchwayQueryClient {

const txRewards = txRewardsResponse.map(txReward => {
return {
txId: txReward.txId.toNumber(),
height: txReward.height.toNumber(),
txId: Number(txReward.txId),
height: Number(txReward.height),
feeRewards: txReward.feeRewards,
};
});

return {
inflationRewards: {
height: inflationRewards.height.toNumber(),
height: Number(inflationRewards.height),
inflationRewards: inflationRewards.inflationRewards,
maxGas: inflationRewards.maxGas.toNumber(),
maxGas: Number(inflationRewards.maxGas),
},
txRewards,
};
Expand Down Expand Up @@ -198,7 +198,7 @@ class ArchwayQueryClientImpl implements IArchwayQueryClient {
return {
rewardsAddress,
totalRewards,
totalRecords: recordsNum.toNumber(),
totalRecords: Number(recordsNum),
};
}

Expand All @@ -224,13 +224,13 @@ class ArchwayQueryClientImpl implements IArchwayQueryClient {

const rewardsRecords = records.map(record => {
const calculatedTime = fromSeconds(
record.calculatedTime.seconds.toNumber(),
Number(record.calculatedTime.seconds),
record.calculatedTime.nanos
);
return {
id: record.id.toNumber(),
id: Number(record.id),
rewardsAddress: record.rewardsAddress,
calculatedHeight: record.calculatedHeight.toNumber(),
calculatedHeight: Number(record.calculatedHeight),
calculatedTime: toRfc3339WithNanoseconds(calculatedTime),
rewards: record.rewards,
};
Expand All @@ -249,9 +249,9 @@ class ArchwayQueryClientImpl implements IArchwayQueryClient {
* Created a facade for querying archway modules using the
* {@link QueryClient} extended with the {@link RewardsExtension}.
*
* @param tmClient - A Tendermint client for a given endpoint.
* @param cometClient - A Comet client for a given endpoint.
* @returns A new {@link IArchwayQueryClient} implementation.
*/
export function createArchwayQueryClient(tmClient: TendermintClient | undefined): IArchwayQueryClient {
return new ArchwayQueryClientImpl(tmClient);
export function createArchwayQueryClient(cometClient: CometClient | undefined): IArchwayQueryClient {
return new ArchwayQueryClientImpl(cometClient);
}
32 changes: 16 additions & 16 deletions packages/arch3-core/src/signingarchwayclient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const clientOptions: SigningArchwayClientOptions = {
async function assertGasPriceEstimation(
client: SigningArchwayClient,
transactionHash: string,
gasWanted: number,
gasWanted: bigint,
gasUnitPrice?: GasPrice,
flatFees: readonly Coin[] = [],
): Promise<void> {
Expand All @@ -50,7 +50,7 @@ async function assertGasPriceEstimation(
const tx = decodeTxRaw(txResponse.tx);

// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
const { amount: calculatedAmount, gas: expectedGas } = calculateFee(gasWanted, gasUnitPrice!);
const { amount: calculatedAmount, gas: expectedGas } = calculateFee(Number(gasWanted), gasUnitPrice!);
const expectedAmount = [...calculatedAmount, ...flatFees].reduce(addCoins);
const txFee = tx.authInfo.fee;
expect(txFee?.amount).toContainEqual(expectedAmount);
Expand Down Expand Up @@ -251,8 +251,8 @@ describe('SigningArchwayClient', () => {
expect(result).toMatchObject({
height: expect.any(Number),
transactionHash: expect.any(String),
gasWanted: expect.any(Number),
gasUsed: expect.any(Number),
gasWanted: expect.any(BigInt),
gasUsed: expect.any(BigInt),
metadata,
});
expect(result.logs).not.toHaveLength(0);
Expand All @@ -274,8 +274,8 @@ describe('SigningArchwayClient', () => {
expect(result).toMatchObject({
height: expect.any(Number),
transactionHash: expect.any(String),
gasWanted: expect.any(Number),
gasUsed: expect.any(Number),
gasWanted: expect.any(BigInt),
gasUsed: expect.any(BigInt),
metadata: {
contractAddress,
ownerAddress,
Expand Down Expand Up @@ -307,8 +307,8 @@ describe('SigningArchwayClient', () => {
expect(result).toMatchObject({
height: expect.any(Number),
transactionHash: expect.any(String),
gasWanted: expect.any(Number),
gasUsed: expect.any(Number),
gasWanted: expect.any(BigInt),
gasUsed: expect.any(BigInt),
premium: {
contractAddress,
flatFee,
Expand Down Expand Up @@ -337,8 +337,8 @@ describe('SigningArchwayClient', () => {
expect(result).toMatchObject({
height: expect.any(Number),
transactionHash: expect.any(String),
gasWanted: expect.any(Number),
gasUsed: expect.any(Number),
gasWanted: expect.any(BigInt),
gasUsed: expect.any(BigInt),
premium: {
contractAddress,
flatFee: coin(0, archwayd.denom),
Expand Down Expand Up @@ -375,8 +375,8 @@ describe('SigningArchwayClient', () => {
expect(result).toMatchObject({
height: expect.any(Number),
transactionHash: expect.any(String),
gasWanted: expect.any(Number),
gasUsed: expect.any(Number),
gasWanted: expect.any(BigInt),
gasUsed: expect.any(BigInt),
rewardsAddress: rewardsAddress,
rewards: [expect.objectContaining({
amount: expect.any(String),
Expand All @@ -400,8 +400,8 @@ describe('SigningArchwayClient', () => {
expect(result).toMatchObject({
height: expect.any(Number),
transactionHash: expect.any(String),
gasWanted: expect.any(Number),
gasUsed: expect.any(Number),
gasWanted: expect.any(BigInt),
gasUsed: expect.any(BigInt),
rewardsAddress: rewardsAddress,
rewards: expect.arrayContaining([]),
});
Expand Down Expand Up @@ -432,8 +432,8 @@ describe('SigningArchwayClient', () => {
expect(result).toMatchObject({
height: expect.any(Number),
transactionHash: expect.any(String),
gasWanted: expect.any(Number),
gasUsed: expect.any(Number),
gasWanted: expect.any(BigInt),
gasUsed: expect.any(BigInt),
metadata,
});
expect(result.logs).not.toHaveLength(0);
Expand Down
Loading

0 comments on commit 188955c

Please sign in to comment.