Skip to content

Commit

Permalink
fix: integrated with new asset type from chains.json (#2601)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnthecat authored Nov 8, 2024
1 parent be68d21 commit e02cb47
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { type Meta, type StoryFn } from '@storybook/react';

import { AssetType } from '@/shared/core';

import { AssetBalance } from './AssetBalance';

export default {
Expand All @@ -13,6 +15,7 @@ const assetDot = {
symbol: 'DOT',
precision: 10,
priceId: 'polkadot',
type: AssetType.NATIVE,
icon: 'https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/chains/white/Polkadot.svg',
name: 'Polkadot',
};
Expand Down
1 change: 1 addition & 0 deletions src/renderer/entities/transaction/lib/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const CONTROLLER_ARG_NAME = 'controller';
export const DEST_WEIGHT_ARG_NAME = 'destWeight';

export const TransferType: Record<AssetType, TransactionType> = {
[AssetType.NATIVE]: TransactionType.TRANSFER,
[AssetType.ORML]: TransactionType.ORML_TRANSFER,
[AssetType.STATEMINE]: TransactionType.ASSET_TRANSFER,
};
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/shared/api/balances/service/balanceService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function subscribeBalances(
ormlAssets: Asset[];
}>(
(acc, asset) => {
if (!asset.type) acc.nativeAsset = asset;
if (asset.type === AssetType.NATIVE) acc.nativeAsset = asset;
if (asset.type === AssetType.STATEMINE) acc.statemineAssets.push(asset);
if (asset.type === AssetType.ORML) acc.ormlAssets.push(asset);

Expand Down
3 changes: 2 additions & 1 deletion src/renderer/shared/core/types/asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export type Asset = {
precision: number;
priceId?: string;
icon: string;
type?: AssetType;
type: AssetType;
typeExtras?: StatemineExtras | OrmlExtras;
};

Expand All @@ -19,6 +19,7 @@ export const enum StakingType {
}

export const enum AssetType {
NATIVE = 'native',
ORML = 'orml',
STATEMINE = 'statemine',
}
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/shared/mocks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { createTestKeyring } from '@polkadot/keyring';
import {
AccountType,
type Asset,
AssetType,
type BaseAccount,
type Chain,
type ChainAccount,
Expand Down Expand Up @@ -30,6 +31,7 @@ export const dotAsset: Asset = {
assetId: 0,
symbol: 'DOT',
precision: 10,
type: AssetType.NATIVE,
icon: 'https://raw.githubusercontent.com/novasamatech/nova-spektr-utils/main/icons/v1/assets/white/Polkadot_(DOT).svg',
name: 'Polkadot',
};
Expand Down

0 comments on commit e02cb47

Please sign in to comment.