Skip to content

Commit

Permalink
adding coinmarketcap Id to identifiers in model
Browse files Browse the repository at this point in the history
  • Loading branch information
pellicceama committed Nov 2, 2022
1 parent 5244f31 commit abe3e59
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/model/Asset.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RepoObject } from "./RepoObject";
import {TokenInfo as TokenInfoExt } from '@uniswap/token-lists';
import { TokenInfo as TokenInfoExt } from '@uniswap/token-lists';
import { TagName } from "./Tag";
import { getTwaTokenInfo } from "../trustwallet";
import { getNetworkForChainId } from "../utils/chainId";
Expand All @@ -10,6 +10,9 @@ export class Asset extends RepoObject {

address: string;
type: 'asset';
identifiers: {
coinmarketcap?: number;
} | null

constructor(info: Partial<Asset>) {
super(info);
Expand All @@ -20,6 +23,12 @@ export class Asset extends RepoObject {

this.address = formatAddress(info.address);
this.type = 'asset';

if(!info.identifiers) {
this.identifiers = null;
} else {
this.identifiers = info.identifiers;
}
}

static async fromTokenlistTokenInfo(info: TokenInfoExt, source?: string): Promise<Asset> {
Expand Down
1 change: 1 addition & 0 deletions src/model/Network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export class Network extends RepoObject {
identifiers: {
bip44?: number;
chainId?: number;
coinmarketcap?: number;
} | null
regex: {
address: string;
Expand Down

0 comments on commit abe3e59

Please sign in to comment.