Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jorbuedo committed Jun 10, 2024
1 parent 9fad6c9 commit c3ae2f1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('assetUtils', () => {
it('should calculate when there are assets', async () => {
const lockedDeposit = await calcLockedDeposit(mocks.utxos, address, '4310')

expect(lockedDeposit).toEqual(new BigNumber('18149410'))
expect(lockedDeposit).toEqual(new BigNumber('20360440'))
})

it('should return 0 when there are no assets', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('withMinAmounts()', () => {
}

expect(await withMinAmounts(address, amounts, walletMocks.wallet.primaryToken)).toEqual({
'': '1055950',
'': '1301620',
'698a6ea0ca99f315034072af31eaac6ec11fe8558d3f48e9775aab9d.7444524950': '12',
'29d222ce763455e3d7a09a665ce554f00ac89d2e99a1a83d267170c6.4d494e': '55',
})
Expand Down Expand Up @@ -69,7 +69,7 @@ describe('getMinAmounts()', () => {
'addr_test1qrrdv3uxj8shu27ea9djvnn3rl4w3lvh3cyck6yc36mvf6ctlqxj9g0azvpycncr9u600p6t556qhc3psk06uzzw6saq4kvdpq'

expect(await getMinAmounts(address, amounts, walletMocks.wallet.primaryToken)).toEqual({
[walletMocks.wallet.primaryToken.identifier]: '1055950',
[walletMocks.wallet.primaryToken.identifier]: '1301620',
})
})

Expand Down
7 changes: 5 additions & 2 deletions apps/wallet-mobile/src/yoroi-wallets/cardano/getMinAmounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,15 @@ export const getMinAmounts = async (address: Address, amounts: Balance.Amounts,
{defaultNetworkId: primaryToken.networkId, defaultIdentifier: primaryToken.identifier},
)

const [value, coinsPerUtxoByte, normalizedAddress] = await Promise.all([
const [value, coinsPerUtxoByte] = await Promise.all([
cardanoValueFromMultiToken(multiToken),
CardanoMobile.BigNum.fromStr(COINS_PER_UTXO_BYTE),
normalizeToAddress(CardanoMobile, address),
])

const normalizedAddress = await normalizeToAddress(CardanoMobile, address).catch(() => {
throw new Error('getMinAmounts::Error not a valid address')
})

if (normalizedAddress === undefined) throw new Error('getMinAmounts::Error not a valid address')

const [txOutput, dataCost] = await Promise.all([
Expand Down

0 comments on commit c3ae2f1

Please sign in to comment.