Skip to content

Commit

Permalink
Updated deps and ESLint, TypeScript fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ekenigs committed Apr 12, 2024
1 parent c887dff commit e2cfa1e
Show file tree
Hide file tree
Showing 31 changed files with 1,712 additions and 1,485 deletions.
19 changes: 15 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{
"extends": ["airbnb-base", "airbnb-typescript/base", "prettier"],
"plugins": [
// this should be last
"extends": [
"airbnb-base",
"airbnb-typescript/base",
"plugin:@typescript-eslint/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"prettier"
],
"plugins": ["@typescript-eslint", "import", "prettier"],
"parserOptions": {
"project": "./tsconfig.json"
},
Expand All @@ -25,6 +30,12 @@
"sort-keys": ["error"],
"import/prefer-default-export": "off",
"import/no-default-export": "error",
"import/no-cycle": "off"
"import/no-unresolved": "error",
"import/no-cycle": [
2,
{
"maxDepth": "∞"
}
]
}
}
3,109 changes: 1,646 additions & 1,463 deletions package-lock.json

Large diffs are not rendered by default.

23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,33 +41,34 @@
"@polkadot/util-crypto": "^12.5.1"
},
"devDependencies": {
"@changesets/changelog-github": "^0.4.8",
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.1",
"@slack/webhook": "^7.0.2",
"@types/jest": "^29.5.11",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"bun": "^1.0.21",
"@types/jest": "^29.5.12",
"@typescript-eslint/eslint-plugin": "^7.6.0",
"@typescript-eslint/parser": "^7.6.0",
"bun": "^1.1.3",
"dotenv": "^16.4.5",
"eslint": "^8.57.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^18.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-jest": "^28.2.0",
"eslint-plugin-prettier": "^5.1.3",
"ethers": "^6.11.0",
"glob": "^10.3.10",
"ethers": "^6.11.1",
"glob": "^10.3.12",
"husky": "^9.0.11",
"jest": "^29.7.0",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
"ts-jest": "^29.1.2",
"ts-node": "^10.9.2",
"tsup": "^8.0.2",
"turbo": "^1.12.5",
"typescript": "^5.4.2",
"viem": "^2.7.8"
"turbo": "^1.13.2",
"typescript": "^5.4.5",
"viem": "^2.9.16"
},
"lint-staged": {
"*.{js,ts}": "eslint --cache --fix --max-warnings=0",
Expand Down
3 changes: 1 addition & 2 deletions packages/builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@
"dependencies": {
"@moonbeam-network/xcm-types": "2.0.3",
"@moonbeam-network/xcm-utils": "2.0.3",
"big.js": "^6.2.1",
"type-fest": "^3.8.0"
"big.js": "^6.2.1"
},
"peerDependencies": {
"@polkadot/api": "^10.10.1",
Expand Down
1 change: 1 addition & 0 deletions packages/builder/src/asset-min/AssetMinBuilder.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { TypeRegistry, U128 } from '@polkadot/types';
import { describe, expect, it } from '@jest/globals';
import { AssetMinBuilder } from './AssetMinBuilder';

function balanceOf(number: number | string): U128 {
Expand Down
2 changes: 2 additions & 0 deletions packages/builder/src/asset-min/AssetMinBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function assetRegistry() {
module: pallet,
func: 'assetMetadatas',
args: [asset],
// eslint-disable-next-line @typescript-eslint/no-explicit-any
transform: async (response: Option<any>): Promise<bigint> =>
response.unwrapOrDefault().minimalBalance.toBigInt(),
}),
Expand All @@ -32,6 +33,7 @@ function assetRegistry() {
module: pallet,
func: 'currencyMetadatas',
args: [asset],
// eslint-disable-next-line @typescript-eslint/no-explicit-any
transform: async (response: Option<any>): Promise<bigint> =>
response.unwrapOrDefault().minimalBalance.toBigInt(),
}),
Expand Down
1 change: 1 addition & 0 deletions packages/builder/src/balance/BalanceBuilder.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { TypeRegistry, U128 } from '@polkadot/types';
import { describe, expect, it } from '@jest/globals';
import { SubstrateQueryConfig } from '../types/substrate/SubstrateQueryConfig';
import { BalanceBuilder } from './BalanceBuilder';

Expand Down
2 changes: 2 additions & 0 deletions packages/builder/src/balance/BalanceBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ function system() {
balances = res;
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
if (Array.isArray((res as any)?.v0?.balance)) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
balances = (res as any).v0.balance;
}

Expand Down
2 changes: 2 additions & 0 deletions packages/builder/src/contract/ContractConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import { BaseConfig, BaseConfigConstructorParams } from '../types/BaseConfig';

export interface ContractConfigConstructorParams
extends Omit<BaseConfigConstructorParams, 'type'> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
args: any[];
address?: string;
}

export class ContractConfig extends BaseConfig {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
readonly args: any[];

readonly address?: string;
Expand Down
2 changes: 2 additions & 0 deletions packages/builder/src/extrinsic/ExtrinsicConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import { BaseConfig, BaseConfigConstructorParams } from '../types/BaseConfig';

export interface ExtrinsicConfigConstructorParams
extends Omit<BaseConfigConstructorParams, 'type'> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
getArgs: (func?: SubmittableExtrinsicFunction<'promise'>) => any[];
}

export class ExtrinsicConfig extends BaseConfig {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
getArgs: (func?: SubmittableExtrinsicFunction<'promise'>) => any[];

constructor({ getArgs, ...other }: ExtrinsicConfigConstructorParams) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { describe, expect, it } from '@jest/globals';
import {
buildParachainParamsMock,
buildParamsMock,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import {
buildParachainParamsMock,
buildParamsMock,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from '../../ExtrinsicBuilder.utils';

export interface GetExtrinsicParams extends ExtrinsicConfigBuilderPrams {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
asset: any;
func?: SubmittableExtrinsicFunction<'promise'>;
parents?: Parents;
Expand All @@ -23,6 +24,7 @@ export function getPolkadotXcmExtrinsicArgs({
func,
parents = 1,
feeIndex = 0,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
}: GetExtrinsicParams): any[] {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
const version = getExtrinsicArgumentVersion(func);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import {
buildParachainParamsMock,
buildParamsMock,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import {
buildParachainParamsMock,
buildParamsMock,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { buildParamsMock } from '../../../../fixtures';
import { xcmPallet } from './xcmPallet';

Expand Down
1 change: 1 addition & 0 deletions packages/builder/src/fee/FeeBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function assetManager() {
call: async (): Promise<bigint> => {
const type = (await api.query.assetManager.assetIdType(
asset,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
)) as unknown as Option<any>;

if (type.isNone) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface SubstrateCallConfigConstructorParams {
export class SubstrateCallConfig {
readonly api: ApiPromise;

// eslint-disable-next-line @typescript-eslint/no-explicit-any
readonly call: () => Promise<any>;

readonly type = CallType.Substrate;
Expand Down
6 changes: 5 additions & 1 deletion packages/builder/src/types/substrate/SubstrateQueryConfig.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import { SetOptional } from 'type-fest';
import { SetOptional } from '@moonbeam-network/xcm-types';
import { CallType } from '../../builder.interfaces';
import { BaseConfig, BaseConfigConstructorParams } from '../BaseConfig';

export interface QueryConfigConstructorParams
extends SetOptional<BaseConfigConstructorParams, 'type'> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
args?: any[];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
transform: (data: any) => Promise<bigint>;
}

export class SubstrateQueryConfig extends BaseConfig {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
readonly args: any[];

// eslint-disable-next-line @typescript-eslint/no-explicit-any
readonly transform: (data: any) => Promise<bigint>;

constructor({
Expand Down
1 change: 1 addition & 0 deletions packages/config/src/ConfigBuilder/ConfigBuilder.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable sort-keys */
import { Ecosystem } from '@moonbeam-network/xcm-types';
import { describe, expect, it } from '@jest/globals';
import { ConfigService } from '../ConfigService';
import { dev } from '../assets';
import { moonbaseAlpha, pendulumAlphanet } from '../chains';
Expand Down
1 change: 1 addition & 0 deletions packages/config/src/ConfigService/ConfigService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
EvmParachain,
Parachain,
} from '@moonbeam-network/xcm-types';
import { describe, expect, it } from '@jest/globals';
import { assetsList, dev, glmr, tt1, unit } from '../assets';
import { hydraDX, moonbaseAlpha, moonbeam, pendulumAlphanet } from '../chains';
import { ConfigService } from './ConfigService';
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@
"@polkadot/types": "^10.10.1",
"@polkadot/util": "^12.5.1",
"ethers": "^6.11.0",
"viem": "^2.7.8"
"viem": "^2.9.16"
}
}
1 change: 1 addition & 0 deletions packages/sdk/src/contract/contracts/Xtokens/Xtokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export class Xtokens implements TransferContractInterface {
return 0n;
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
return contract.estimateGas[this.#config.func](this.#config.args as any);
}

Expand Down
3 changes: 1 addition & 2 deletions packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"dependencies": {
"@moonbeam-network/xcm-utils": "2.0.3",
"big.js": "^6.2.1",
"type-fest": "^3.8.0",
"viem": "^2.8.6"
"viem": "^2.9.16"
}
}
1 change: 1 addition & 0 deletions packages/types/src/chain/parachain/EvmParachain.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { Ecosystem } from '../Chain.interfaces';
import { EvmParachain } from './EvmParachain';

Expand Down
1 change: 1 addition & 0 deletions packages/types/src/chain/parachain/Parachain.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { Ecosystem } from '../Chain.interfaces';
import { Parachain } from './Parachain';

Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/chain/parachain/Parachain.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SetOptional } from 'type-fest';
import { Asset } from '../../asset';
import { SetOptional } from '../../common.interfaces';
import { Chain, ChainConstructorParams } from '../Chain';
import { ChainType } from '../Chain.interfaces';
import { ChainAssetId, ChainAssetsData } from './Parachain.interfaces';
Expand Down
2 changes: 2 additions & 0 deletions packages/types/src/common.interfaces.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export type SetOptional<Base, Keys extends keyof Base> = Omit<Base, Keys> &
Partial<Pick<Base, Keys>>;
1 change: 1 addition & 0 deletions packages/types/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './asset';
export * from './chain';
export * from './common.interfaces';
1 change: 1 addition & 0 deletions packages/utils/src/numbers/decimals.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable jest/no-focused-tests */
/* eslint-disable jest/max-expects */
import { describe, expect, it } from '@jest/globals';
import Big from 'big.js';
import {
convertDecimals,
Expand Down
1 change: 1 addition & 0 deletions packages/utils/src/polkadot/polkadot.address.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals';
import { getSovereignAccountAddresses } from './polkadot.address';

describe('utils - polkadot address', () => {
Expand Down

0 comments on commit e2cfa1e

Please sign in to comment.