Skip to content

Commit

Permalink
resolve @typescript-eslint/no-unsafe-enum-comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
TarikGul committed Nov 29, 2023
1 parent 10fdf17 commit c92a2f4
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions src/AssetTransferApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
checkLocalTxInput,
checkXcmTxInputs,
checkXcmVersion,
LocalTxType,
} from './errors';
import { Registry } from './registry';
import { ChainInfoRegistry } from './registry/types';
Expand Down Expand Up @@ -240,19 +241,19 @@ export class AssetTransferApi {
let tx: SubmittableExtrinsic<'promise', ISubmittableResult>;
let palletMethod: LocalTransferTypes;

if (localAssetType === 'Balances') {
if (localAssetType === LocalTxType.Balances) {
tx =
method === 'transferKeepAlive'
? balances.transferKeepAlive(_api, addr, amount)
: balances.transfer(_api, addr, amount);
palletMethod = `balances::${method}`;
} else if (localAssetType === 'Assets') {
} else if (localAssetType === LocalTxType.Assets) {
tx =
method === 'transferKeepAlive'
? assets.transferKeepAlive(_api, addr, assetId, amount)
: assets.transfer(_api, addr, assetId, amount);
palletMethod = `assets::${method}`;
} else if (localAssetType === 'PoolAssets') {
} else if (localAssetType === LocalTxType.PoolAssets) {
tx =
method === 'transferKeepAlive'
? poolAssets.transferKeepAlive(_api, addr, assetId, amount)
Expand Down
2 changes: 1 addition & 1 deletion src/createXcmCalls/util/establishXcmPallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const establishXcmPallet = (
*/
const isXTokensOriginNonForeignAssetsPalletTx = (
xPallet?: XcmPalletName,
direction?: Direction | string,
direction?: Direction,
isForeignAssetsTransfer?: boolean,
isParachainPrimaryNativeAsset?: boolean,
): boolean => {
Expand Down
2 changes: 1 addition & 1 deletion src/errors/checkLocalTxInputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { checkLiquidTokenValidity } from '../errors/checkXcmTxInputs';
import { Registry } from '../registry';
import { BaseError, BaseErrorsEnum } from './BaseError';

enum LocalTxType {
export enum LocalTxType {
Assets = 'Assets',
Balances = 'Balances',
ForeignAssets = 'ForeignAssets',
Expand Down
2 changes: 1 addition & 1 deletion src/errors/checkXcmTxInputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ export const checkXcmVersionIsValidForPaysWithFeeDest = (
* @param isLiquidTokenTransfer
*/
export const checkLiquidTokenTransferDirectionValidity = (xcmDirection: Direction, isLiquidTokenTransfer: boolean) => {
if (xcmDirection !== 'SystemToPara' && isLiquidTokenTransfer) {
if (xcmDirection !== Direction.SystemToPara && isLiquidTokenTransfer) {
throw new BaseError(
`isLiquidTokenTransfer may not be true for the xcmDirection: ${xcmDirection}.`,
BaseErrorsEnum.InvalidInput,
Expand Down
2 changes: 1 addition & 1 deletion src/errors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
export { BaseError, BaseErrorsEnum } from './BaseError';
export { checkBaseInputOptions } from './checkBaseInputOptions';
export { checkBaseInputTypes } from './checkBaseInputTypes';
export { checkLocalTxInput } from './checkLocalTxInputs';
export { checkLocalTxInput, LocalTxType } from './checkLocalTxInputs';
export { checkXcmTxInputs } from './checkXcmTxInputs';
export { checkXcmVersion } from './checkXcmVersion';

0 comments on commit c92a2f4

Please sign in to comment.