Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | 3x 3x 3x 3x 3x 3x 3x 3x 1x 3x 1x 3x 3x 4x 4x 3x 16x 6x 1x 5x 10x 1x 9x 6x 5x 1x 3x 1x 2x 3x 9x 2x 1x 1x 7x | import * as P from 'maasglobal-prelude-ts'; import { BalanceName } from '../../../_types/core/balances'; import { defaultMetaCurrencyWMP, MetaCurrencyTOKEN, } from '../../../_types/core/components/common'; import { Fare, TokenId } from '../../../_types/core/components/fare'; import { Currency } from '../../../_types/core/components/units'; import * as MetaCurrency_ from '../../core/components/common/meta-currency'; import * as TokenId_ from '../../core/components/fare/token-id'; import * as Currency_ from '../../core/components/units/currency'; export function fromTokenId(tokenId: TokenId): BalanceName { return tokenId as BalanceName; } export function fromCurrency(currency: Currency): BalanceName { return currency as BalanceName; } export const WMP: BalanceName = defaultMetaCurrencyWMP as BalanceName; export function isTokenId(bn: BalanceName): bn is BalanceName & TokenId { const firstChar: string = bn.charAt(0); return firstChar === firstChar.toLowerCase(); } export const Ord: P.Ord<BalanceName> = P.Ord_.fromCompare((bnA, bnB) => { if (TokenId.is(bnA)) { if (TokenId.is(bnB)) { return TokenId_.Ord.compare(bnA, bnB); } return -1; } if (TokenId.is(bnB)) { return 1; } if (Currency.is(bnA)) { if (Currency.is(bnB)) { return Currency_.Ord.compare(bnA, bnB); } return -1; } if (Currency.is(bnB)) { return 1; } return MetaCurrency_.Ord.compare(bnA, bnB); }); export function fromFare(fare: Fare): BalanceName { if (MetaCurrencyTOKEN.is(fare.currency)) { if (typeof fare.tokenId === 'undefined') { return P.absurd(fare as never); } return fare.tokenId as BalanceName; } return fare.currency as BalanceName; } |