Skip to content

Commit

Permalink
chore(portfolio): added isprimary helper
Browse files Browse the repository at this point in the history
  • Loading branch information
stackchain committed May 4, 2024
1 parent 4cae501 commit 274b46f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/portfolio/src/helpers/is-primary.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import {tokenInfoMocks} from '../adapters/token-info.mocks'
import {isPrimary} from './is-primary'

describe('isPrimary', () => {
it('should return true if the token nature is Primary', () => {
const result = isPrimary(tokenInfoMocks.primaryETH)

expect(result).toBe(true)
})

it('should return false if the token nature is not Primary', () => {
const result = isPrimary(tokenInfoMocks.nftCryptoKitty)

expect(result).toBe(false)
})
})
5 changes: 5 additions & 0 deletions packages/portfolio/src/helpers/is-primary.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import {Portfolio} from '@yoroi/types'

export function isPrimary(info: Portfolio.Token.Info) {
return info.nature === Portfolio.Token.Nature.Primary
}
1 change: 1 addition & 0 deletions packages/portfolio/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export * from './helpers/amount-breakdown'
export * from './helpers/create-primary-token-info'
export * from './helpers/sorting'
export * from './helpers/info-extract-name'
export * from './helpers/is-primary'

export * from './adapters/amount.mocks'
export * from './adapters/dullahan-api/api-maker.mocks'
Expand Down

0 comments on commit 274b46f

Please sign in to comment.