From 107899080d83e2888edbe5bab38da2605e0c2c38 Mon Sep 17 00:00:00 2001 From: Thibault Jaillard Date: Thu, 17 Aug 2023 16:31:15 -0400 Subject: [PATCH 1/3] Add new messages --- .../messageTypes/millionsClaimPrize.svg | 3 + .../images/messageTypes/millionsDeposit.svg | 5 + .../images/messageTypes/millionsWithdraw.svg | 11 +++ src/assets/images/tickers/ticker_atom.svg | 10 ++ .../components/AssetsList/AssetsList.tsx | 6 +- src/constant/enums/MessagesType.ts | 5 + src/core/index.tsx | 94 +++++++++---------- src/locales/locales/en.ts | 9 ++ src/models/models/message.ts | 60 +++++++++++- src/models/models/transactions.ts | 11 ++- .../Transactions/show/TransactionPage.tsx | 47 ++++++++-- src/utils/utils/messages.ts | 16 ++++ 12 files changed, 220 insertions(+), 57 deletions(-) create mode 100644 src/assets/images/messageTypes/millionsClaimPrize.svg create mode 100644 src/assets/images/messageTypes/millionsDeposit.svg create mode 100644 src/assets/images/messageTypes/millionsWithdraw.svg create mode 100644 src/assets/images/tickers/ticker_atom.svg diff --git a/src/assets/images/messageTypes/millionsClaimPrize.svg b/src/assets/images/messageTypes/millionsClaimPrize.svg new file mode 100644 index 00000000..0070ae60 --- /dev/null +++ b/src/assets/images/messageTypes/millionsClaimPrize.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/images/messageTypes/millionsDeposit.svg b/src/assets/images/messageTypes/millionsDeposit.svg new file mode 100644 index 00000000..7814176f --- /dev/null +++ b/src/assets/images/messageTypes/millionsDeposit.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/assets/images/messageTypes/millionsWithdraw.svg b/src/assets/images/messageTypes/millionsWithdraw.svg new file mode 100644 index 00000000..62ee9bd8 --- /dev/null +++ b/src/assets/images/messageTypes/millionsWithdraw.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/assets/images/tickers/ticker_atom.svg b/src/assets/images/tickers/ticker_atom.svg new file mode 100644 index 00000000..64b04df9 --- /dev/null +++ b/src/assets/images/tickers/ticker_atom.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/components/components/AssetsList/AssetsList.tsx b/src/components/components/AssetsList/AssetsList.tsx index de3370fd..b9eea35e 100644 --- a/src/components/components/AssetsList/AssetsList.tsx +++ b/src/components/components/AssetsList/AssetsList.tsx @@ -2,6 +2,7 @@ import React, { useEffect } from 'react'; import { Table, Card } from 'frontend-elements'; import { i18n } from 'utils'; import placeholderTx from 'assets/images/placeholderTx.svg'; +import tickerAtom from 'assets/images/tickers/ticker_atom.svg'; import tickerLum from 'assets/images/tickers/ticker_lum.svg'; import tickerDfr from 'assets/images/tickers/ticker_dfr.svg'; import tickerUsdc from 'assets/images/tickers/ticker_usdc.svg'; @@ -33,6 +34,9 @@ const AssetsList = ({ head, assets, title }: IProps): JSX.Element => { case 'ibc/05554A9BFDD28894D7F18F4C707AA0930D778751A437A9FE1F4684A3E1199728': case 'uusdc': return ['USDC', tickerUsdc]; + case 'ibc/A8C2D23A1E6F95DA4E48BA349667E322BD7A6C996D8A4AAE8BA72E190F3D1477': + case 'uatom': + return ['ATOM', tickerAtom]; default: return [i18n.t('unknown'), tickerUnknown]; } @@ -43,7 +47,7 @@ const AssetsList = ({ head, assets, title }: IProps): JSX.Element => { return ( - {name} {name} + {name} {name} diff --git a/src/constant/enums/MessagesType.ts b/src/constant/enums/MessagesType.ts index 8b8369f2..cfde3a82 100644 --- a/src/constant/enums/MessagesType.ts +++ b/src/constant/enums/MessagesType.ts @@ -12,6 +12,7 @@ enum MessagesType { SUBMIT_PROPOSAL = '/cosmos.gov.v1beta1.MsgSubmitProposal', DEPOSIT = '/cosmos.gov.v1beta1.MsgDeposit', VOTE = '/cosmos.gov.v1beta1.MsgVote', + VOTE2 = '/cosmos.gov.v1.MsgVote', CREATE_VESTING_ACCOUNT = '/cosmos.vesting.v1beta1.MsgCreateVestingAccount', BEGIN_REDELEGATE = '/cosmos.staking.v1beta1.MsgBeginRedelegate', WITHDRAW_VALIDATOR_COMMISSION = '/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission', @@ -23,6 +24,10 @@ enum MessagesType { IBC_RECV_PACKET = '/ibc.core.channel.v1.MsgRecvPacket', EXEC = '/cosmos.authz.v1beta1.MsgExec', GRANT = '/cosmos.authz.v1beta1.MsgGrant', + MILLIONS_DEPOSIT = '/lum.network.millions.MsgDeposit', + MILLIONS_WITHDRAW = '/lum.network.millions.MsgWithdraw', + MILLIONS_CLAIM_PRIZE = '/lum.network.millions.MsgClaimPrize', + SET_WITHDRAW_ADDRESS = '/cosmos.distribution.v1beta1.MsgSetWithdrawAddress', } export default MessagesType; diff --git a/src/core/index.tsx b/src/core/index.tsx index b40ebdf5..31e47a8a 100644 --- a/src/core/index.tsx +++ b/src/core/index.tsx @@ -1,26 +1,26 @@ -import React, { useEffect, useState } from 'react'; +import React, { useEffect } from 'react'; import RootNavigator from 'navigation'; import { useDispatch } from 'react-redux'; import { Dispatch } from 'redux/store'; -import { BlocksModel, TransactionsModel } from 'models'; -import { ApiConstants, SocketConstants } from 'constant'; -import { plainToClass } from 'class-transformer'; -import io, { Socket } from 'socket.io-client'; +// import { BlocksModel, TransactionsModel } from 'models'; +// import { ApiConstants, SocketConstants } from 'constant'; +// import { plainToClass } from 'class-transformer'; +// import io, { Socket } from 'socket.io-client'; const Core = (): JSX.Element => { const dispatch = useDispatch(); - let [socket] = useState(null); + // let [socket] = useState(null); useEffect(() => { fetch(); - sockets(); + // sockets(); - return () => { - if (socket) { - socket.close(); - } - }; + // return () => { + // if (socket) { + // socket.close(); + // } + // }; }, []); const fetch = () => { @@ -33,41 +33,41 @@ const Core = (): JSX.Element => { dispatch.core.getAssets().finally(() => null); }; - const sockets = () => { - socket = io(String(ApiConstants.BASE_URL)); - socket.on('connect', () => { - if (!socket) { - console.warn('cannot listen channel, null socket pointer'); - return; - } - - socket.emit( - SocketConstants.LISTEN_CHANNEL, - JSON.stringify({ - name: SocketConstants.BLOCKS, - }), - ); - - socket.io.emit( - SocketConstants.LISTEN_CHANNEL, - JSON.stringify({ - name: SocketConstants.TRANSACTIONS, - }), - ); - - socket.on(SocketConstants.NEW_TRANSACTION_EVENT, (data: Record) => { - const transaction = plainToClass(TransactionsModel, data); - - dispatch.transactions.addTransaction(transaction); - }); - - socket.on(SocketConstants.NEW_BLOCK_EVENT, (data: Record) => { - const block = plainToClass(BlocksModel, data); - - dispatch.blocks.addBlock(block); - }); - }); - }; + // const sockets = () => { + // socket = io(String(ApiConstants.BASE_URL)); + // socket.on('connect', () => { + // if (!socket) { + // console.warn('cannot listen channel, null socket pointer'); + // return; + // } + // + // socket.emit( + // SocketConstants.LISTEN_CHANNEL, + // JSON.stringify({ + // name: SocketConstants.BLOCKS, + // }), + // ); + // + // socket.io.emit( + // SocketConstants.LISTEN_CHANNEL, + // JSON.stringify({ + // name: SocketConstants.TRANSACTIONS, + // }), + // ); + // + // socket.on(SocketConstants.NEW_TRANSACTION_EVENT, (data: Record) => { + // const transaction = plainToClass(TransactionsModel, data); + // + // dispatch.transactions.addTransaction(transaction); + // }); + // + // socket.on(SocketConstants.NEW_BLOCK_EVENT, (data: Record) => { + // const block = plainToClass(BlocksModel, data); + // + // dispatch.blocks.addBlock(block); + // }); + // }); + // }; return ; }; diff --git a/src/locales/locales/en.ts b/src/locales/locales/en.ts index d7e1bdd5..7c155856 100644 --- a/src/locales/locales/en.ts +++ b/src/locales/locales/en.ts @@ -85,6 +85,11 @@ export default { seconds: 'seconds', active: 'Active', inactive: 'Inactive', + winnerAddress: 'Winner address', + prizeId: 'Prize id', + drawId: 'Draw id', + poolId: 'Pool id', + // Layout dashboard: 'Board', blocks: 'Blocks', @@ -141,6 +146,10 @@ export default { ibcRecvPacketMessage: 'IBC Receive packet', execMessage: 'Exec', grantMessage: 'Grant', + setWithdrawAddressMessage: 'Set withdraw address', + millionsDepositMessage: 'Millions deposit', + millionsClaimPrizeMessage: "Millions Claim Prize", + millionsWithdrawMessage: "Millions Leave Pool", // Badge status badgeJailed: 'Jailed', diff --git a/src/models/models/message.ts b/src/models/models/message.ts index c8221a58..72f70036 100644 --- a/src/models/models/message.ts +++ b/src/models/models/message.ts @@ -215,6 +215,11 @@ export class Vote extends MessageModel { value: VoteValue = new VoteValue(); } +export class Vote2 extends MessageModel { + @Type(() => VoteValue) + value: VoteValue = new VoteValue(); +} + class OpenBeamValue { id?: string; @@ -320,6 +325,54 @@ export class Grant extends MessageModel { value: GrantValue = new GrantValue(); } +class MillionsDepositValue {} + +export class MillionsDeposit extends MessageModel { + @Type(() => MillionsDepositValue) + value: MillionsDepositValue = new MillionsDepositValue(); +} + +class MillionsWithdrawValue {} + +export class MillionsWithdraw extends MessageModel { + @Type(() => MillionsWithdrawValue) + value: MillionsWithdrawValue = new MillionsWithdrawValue(); +} + +class MillionsClaimPrizeValue { + @Expose() + @Transform(({ value }) => { + return new Long(value.low, value.high, value.unsigned); + }) + drawId: Long = new Long(0); + + @Expose() + @Transform(({ value }) => { + return new Long(value.low, value.high, value.unsigned); + }) + poolId: Long = new Long(0); + + @Expose() + @Transform(({ value }) => { + return new Long(value.low, value.high, value.unsigned); + }) + prizeId: Long = new Long(0); + + winnerAddress?: string; +} + +export class MillionsClaimPrize extends MessageModel { + @Type(() => MillionsClaimPrizeValue) + value: MillionsClaimPrizeValue = new MillionsClaimPrizeValue(); +} + +class SetWithdrawAddressValue {} + +export class SetWithdrawAddress extends MessageModel { + @Type(() => SetWithdrawAddressValue) + value: SetWithdrawAddressValue = new SetWithdrawAddressValue(); +} + export type Value = | Send | CreateValidator @@ -334,9 +387,14 @@ export type Value = | SubmitProposal | Deposit | Vote + | Vote2 | CreateVestingAccount | BeginRedelegate | WithdrawValidatorCommission | Unjail | Exec - | Grant; + | Grant + | MillionsDeposit + | MillionsWithdraw + | MillionsClaimPrize + | SetWithdrawAddress; diff --git a/src/models/models/transactions.ts b/src/models/models/transactions.ts index 6ab5c5f4..8addbcab 100644 --- a/src/models/models/transactions.ts +++ b/src/models/models/transactions.ts @@ -10,16 +10,20 @@ import MessageModel, { EditValidator, Exec, GetReward, - Grant, + Grant, MillionsClaimPrize, + MillionsDeposit, + MillionsWithdraw, MultiSend, OpenBeam, Send, + SetWithdrawAddress, SubmitProposal, Undelegate, Unjail, UpdateBeam, Value, Vote, + Vote2, WithdrawValidatorCommission, } from './message'; import CoinModel from './coin'; @@ -77,6 +81,11 @@ class TransactionsModel { { value: Unjail, name: MessagesType.UNJAIL }, { value: Exec, name: MessagesType.EXEC }, { value: Grant, name: MessagesType.GRANT }, + { value: Vote2, name: MessagesType.VOTE2 }, + { value: MillionsDeposit, name: MessagesType.MILLIONS_DEPOSIT }, + { value: MillionsWithdraw, name: MessagesType.MILLIONS_WITHDRAW }, + { value: MillionsClaimPrize, name: MessagesType.MILLIONS_CLAIM_PRIZE }, + { value: SetWithdrawAddress, name: MessagesType.SET_WITHDRAW_ADDRESS }, ], }, keepDiscriminatorProperty: true, diff --git a/src/pages/pages/Transactions/show/TransactionPage.tsx b/src/pages/pages/Transactions/show/TransactionPage.tsx index 7fb0872c..f150a353 100644 --- a/src/pages/pages/Transactions/show/TransactionPage.tsx +++ b/src/pages/pages/Transactions/show/TransactionPage.tsx @@ -425,7 +425,7 @@ const TransactionPage = (props: IProps): JSX.Element => { ); } - if (message instanceof MessageModel.Vote) { + if (message instanceof MessageModel.Vote || message instanceof MessageModel.Vote2) { const { value } = message; return ( @@ -436,12 +436,16 @@ const TransactionPage = (props: IProps): JSX.Element => {
{value.proposalId.toString()}
-
-
{i18n.t('voterAddress')}
-
-
- {value.voterAddress} -
+ {value.voterAddress ? ( + <> +
+
{i18n.t('voterAddress')}
+
+
+ {value.voterAddress} +
+ + ) : null}
{i18n.t('option')}
@@ -608,6 +612,33 @@ const TransactionPage = (props: IProps): JSX.Element => { ); } + if (message instanceof MessageModel.MillionsClaimPrize) { + const { value } = message; + + return ( +
+
+
{i18n.t('winnerAddress')}
+
+
+ {value.winnerAddress} +
+
+
{i18n.t('prizeId')}
+
+
{value.prizeId.toString()}
+
+
{i18n.t('poolId')}
+
+
{value.poolId.toString()}
+
+
{i18n.t('drawId')}
+
+
{value.drawId.toString()}
+
+ ); + } + if (message) { const { value } = message; @@ -782,6 +813,8 @@ const TransactionPage = (props: IProps): JSX.Element => { ); }; + console.log(transaction, loading); + return ( <>

diff --git a/src/utils/utils/messages.ts b/src/utils/utils/messages.ts index 4a508733..df2cfb81 100644 --- a/src/utils/utils/messages.ts +++ b/src/utils/utils/messages.ts @@ -18,6 +18,9 @@ import redelegateLogo from 'assets/images/messageTypes/redelegate.svg'; import gearsLogo from 'assets/images/messageTypes/gears.svg'; import commissionLogo from 'assets/images/messageTypes/commission.svg'; import unjailLogo from 'assets/images/messageTypes/unjail.svg'; +import millionsDepositLogo from 'assets/images/messageTypes/millionsDeposit.svg'; +import millionsClaimPrizeLogo from 'assets/images/messageTypes/millionsClaimPrize.svg'; +import millionsWithdrawLogo from 'assets/images/messageTypes/millionsWithdraw.svg'; export const name = (type?: MessagesType | null): { text: string; icon: string } => { switch (type) { @@ -58,6 +61,7 @@ export const name = (type?: MessagesType | null): { text: string; icon: string } return { text: i18n.t('depositMessage'), icon: depositLogo }; case MessagesType.VOTE: + case MessagesType.VOTE2: return { text: i18n.t('voteMessage'), icon: voteLogo }; case MessagesType.BEGIN_REDELEGATE: @@ -93,6 +97,18 @@ export const name = (type?: MessagesType | null): { text: string; icon: string } case MessagesType.GRANT: return { text: i18n.t('grantMessage'), icon: placeholderLogo }; + case MessagesType.SET_WITHDRAW_ADDRESS: + return { text: i18n.t('setWithdrawAddressMessage'), icon: placeholderLogo }; + + case MessagesType.MILLIONS_DEPOSIT: + return { text: i18n.t('millionsDepositMessage'), icon: millionsDepositLogo }; + + case MessagesType.MILLIONS_CLAIM_PRIZE: + return { text: i18n.t('millionsClaimPrizeMessage'), icon: millionsClaimPrizeLogo }; + + case MessagesType.MILLIONS_WITHDRAW: + return { text: i18n.t('millionsWithdrawMessage'), icon: millionsWithdrawLogo }; + default: return { text: type || '', icon: placeholderLogo }; } From 3c5b27a61597dbba50855e5dc7fec53775f41320 Mon Sep 17 00:00:00 2001 From: Thibault Jaillard Date: Fri, 18 Aug 2023 16:41:16 -0400 Subject: [PATCH 2/3] All new messages done --- src/constant/enums/MessagesType.ts | 2 +- src/locales/locales/en.ts | 2 + src/models/models/message.ts | 42 +++++++++- .../Transactions/show/TransactionPage.tsx | 79 ++++++++++++++++++- src/utils/index.ts | 3 +- src/utils/utils/denoms.ts | 14 ++++ 6 files changed, 134 insertions(+), 8 deletions(-) create mode 100644 src/utils/utils/denoms.ts diff --git a/src/constant/enums/MessagesType.ts b/src/constant/enums/MessagesType.ts index cfde3a82..ee64debf 100644 --- a/src/constant/enums/MessagesType.ts +++ b/src/constant/enums/MessagesType.ts @@ -25,7 +25,7 @@ enum MessagesType { EXEC = '/cosmos.authz.v1beta1.MsgExec', GRANT = '/cosmos.authz.v1beta1.MsgGrant', MILLIONS_DEPOSIT = '/lum.network.millions.MsgDeposit', - MILLIONS_WITHDRAW = '/lum.network.millions.MsgWithdraw', + MILLIONS_WITHDRAW = '/lum.network.millions.MsgWithdrawDeposit', MILLIONS_CLAIM_PRIZE = '/lum.network.millions.MsgClaimPrize', SET_WITHDRAW_ADDRESS = '/cosmos.distribution.v1beta1.MsgSetWithdrawAddress', } diff --git a/src/locales/locales/en.ts b/src/locales/locales/en.ts index 7c155856..8d23633d 100644 --- a/src/locales/locales/en.ts +++ b/src/locales/locales/en.ts @@ -86,9 +86,11 @@ export default { active: 'Active', inactive: 'Inactive', winnerAddress: 'Winner address', + isSponsor: 'Sponsor', prizeId: 'Prize id', drawId: 'Draw id', poolId: 'Pool id', + depositId: 'Deposit id', // Layout dashboard: 'Board', diff --git a/src/models/models/message.ts b/src/models/models/message.ts index 72f70036..bd19713f 100644 --- a/src/models/models/message.ts +++ b/src/models/models/message.ts @@ -325,14 +325,51 @@ export class Grant extends MessageModel { value: GrantValue = new GrantValue(); } -class MillionsDepositValue {} +class MillionsDepositValue { + @Expose() + @Transform(({ value }) => { + return new Long(value.low, value.high, value.unsigned); + }) + poolId: Long = new Long(0); + + @Expose() + isSponsor?: boolean; + + @Expose() + winnerAddress?: string; + + @Expose() + depositorAddress?: string; + + @Expose() + @Type(() => CoinModel) + amount: CoinModel = new CoinModel(); +} export class MillionsDeposit extends MessageModel { @Type(() => MillionsDepositValue) value: MillionsDepositValue = new MillionsDepositValue(); } -class MillionsWithdrawValue {} +class MillionsWithdrawValue { + @Expose() + @Transform(({ value }) => { + return new Long(value.low, value.high, value.unsigned); + }) + poolId: Long = new Long(0); + + @Expose() + @Transform(({ value }) => { + return new Long(value.low, value.high, value.unsigned); + }) + depositId: Long = new Long(0); + + @Expose({ name: 'toAddress' }) + winnerAddress?: string; + + @Expose() + depositorAddress?: string; +} export class MillionsWithdraw extends MessageModel { @Type(() => MillionsWithdrawValue) @@ -358,6 +395,7 @@ class MillionsClaimPrizeValue { }) prizeId: Long = new Long(0); + @Expose() winnerAddress?: string; } diff --git a/src/pages/pages/Transactions/show/TransactionPage.tsx b/src/pages/pages/Transactions/show/TransactionPage.tsx index f150a353..6bf44df5 100644 --- a/src/pages/pages/Transactions/show/TransactionPage.tsx +++ b/src/pages/pages/Transactions/show/TransactionPage.tsx @@ -6,7 +6,7 @@ import { MessageType, Badge, Tooltip, SmallerDecimal, VoteOption } from 'compone import { Card, Loading } from 'frontend-elements'; import moment from 'moment-timezone'; import { NavigationConstants, SystemConstants } from 'constant'; -import { i18n, StringsUtils, NumbersUtils } from 'utils'; +import {i18n, StringsUtils, NumbersUtils, DenomsUtils} from 'utils'; import { MessageModel } from 'models'; import blockLogo from 'assets/images/blockDark.svg'; import transactionLogo from 'assets/images/transactionDark.svg'; @@ -621,7 +621,7 @@ const TransactionPage = (props: IProps): JSX.Element => {
{i18n.t('winnerAddress')}
- {value.winnerAddress} + {value.winnerAddress}
{i18n.t('prizeId')}
@@ -639,6 +639,79 @@ const TransactionPage = (props: IProps): JSX.Element => { ); } + if (message instanceof MessageModel.MillionsDeposit) { + const { value } = message; + + return ( +
+
+
{i18n.t('depositorAddress')}
+
+
+ {value.depositorAddress} +
+
+
{i18n.t('winnerAddress')}
+
+
+ {value.winnerAddress} +
+
+
{i18n.t('poolId')}
+
+
{value.poolId.toString()}
+
+
{i18n.t('amount')}
+
+
+
+ {value.amount ? ( + <> + {NumbersUtils.formatNumber(value.amount, true)} + {DenomsUtils.getFormattedDenom(value.amount.denom)} + + ) : ( + '-' + )} +
+
+
+
{i18n.t('isSponsor')}
+
+
{value.isSponsor ? 'Yes' : 'No'}
+
+ ); + } + + if (message instanceof MessageModel.MillionsWithdraw) { + const { value } = message; + + return ( +
+
+
{i18n.t('depositorAddress')}
+
+
+ {value.depositorAddress} +
+
+
{i18n.t('poolId')}
+
+
{value.poolId.toString()}
+
+
{i18n.t('depositId')}
+
+
{value.depositId.toString()}
+
+
{i18n.t('winnerAddress')}
+
+
+ {value.winnerAddress} +
+
+ ); + } + if (message) { const { value } = message; @@ -813,8 +886,6 @@ const TransactionPage = (props: IProps): JSX.Element => { ); }; - console.log(transaction, loading); - return ( <>

diff --git a/src/utils/index.ts b/src/utils/index.ts index c254b7db..5335f4d9 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -8,8 +8,9 @@ import * as BlockUtils from './utils/blocks'; import * as AnalyticsUtils from './utils/analytics'; import * as GovernanceUtils from './utils/governance'; import * as AssetsUtils from './utils/assets'; +import * as DenomsUtils from './utils/denoms'; export { default as i18n } from './utils/i18n'; export { default as HttpClient } from './utils/http'; export * from './utils/hooks'; -export { StringsUtils, TimesUtils, MessagesUtils, ValidatorsUtils, NumbersUtils, AccountUtils, BlockUtils, AnalyticsUtils, GovernanceUtils, AssetsUtils }; +export { StringsUtils, TimesUtils, MessagesUtils, ValidatorsUtils, NumbersUtils, AccountUtils, BlockUtils, AnalyticsUtils, GovernanceUtils, AssetsUtils, DenomsUtils }; diff --git a/src/utils/utils/denoms.ts b/src/utils/utils/denoms.ts new file mode 100644 index 00000000..c3a47b58 --- /dev/null +++ b/src/utils/utils/denoms.ts @@ -0,0 +1,14 @@ +export const getFormattedDenom = (denom: string) => { + switch (denom) { + case 'ulum': + return 'lum'; + case 'udfr': + return 'dfr'; + case 'ibc/05554A9BFDD28894D7F18F4C707AA0930D778751A437A9FE1F4684A3E1199728': + case 'uusdc': + return 'usdc'; + case 'ibc/A8C2D23A1E6F95DA4E48BA349667E322BD7A6C996D8A4AAE8BA72E190F3D1477': + case 'uatom': + return 'atom'; + } +} From 95cdeaaf9d4a9e52752c6af4c182fa4f3846a366 Mon Sep 17 00:00:00 2001 From: Thibault Jaillard Date: Fri, 18 Aug 2023 16:42:23 -0400 Subject: [PATCH 3/3] Fix warnings --- src/utils/utils/denoms.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils/utils/denoms.ts b/src/utils/utils/denoms.ts index c3a47b58..ba14aaed 100644 --- a/src/utils/utils/denoms.ts +++ b/src/utils/utils/denoms.ts @@ -1,4 +1,4 @@ -export const getFormattedDenom = (denom: string) => { +export const getFormattedDenom = (denom: string): string => { switch (denom) { case 'ulum': return 'lum'; @@ -10,5 +10,7 @@ export const getFormattedDenom = (denom: string) => { case 'ibc/A8C2D23A1E6F95DA4E48BA349667E322BD7A6C996D8A4AAE8BA72E190F3D1477': case 'uatom': return 'atom'; + default: + return denom; } }