Skip to content

Commit

Permalink
Update @nimiq/utils to support CRC as reference fiat currency
Browse files Browse the repository at this point in the history
  • Loading branch information
sisou committed Jan 26, 2024
1 parent 90675ee commit dc6d915
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@nimiq/rpc": "^0.4.1",
"@nimiq/style": "^0.8.2",
"@nimiq/ten31-pass-api": "^1.1.0",
"@nimiq/utils": "^0.9.3",
"@nimiq/utils": "https://github.com/nimiq/nimiq-utils#soeren/dist/crc",
"@nimiq/vue-components": "https://github.com/nimiq/vue-components#build/wallet",
"@opengsn/common": "^2.2.5",
"@sentry/vue": "^6.0.0",
Expand Down
13 changes: 9 additions & 4 deletions src/lib/Constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
export {
FiatApiSupportedFiatCurrency as FiatCurrency,
FiatApiSupportedCryptoCurrency as CryptoCurrency,
} from '@nimiq/utils';
import { FiatApiSupportedFiatCurrency, FiatApiBridgedFiatCurrency } from '@nimiq/utils';

export { FiatApiSupportedCryptoCurrency as CryptoCurrency } from '@nimiq/utils';

export const FiatCurrency = {
...FiatApiSupportedFiatCurrency,
...FiatApiBridgedFiatCurrency,
};
export type FiatCurrency = FiatApiSupportedFiatCurrency | FiatApiBridgedFiatCurrency;

export const FIAT_PRICE_UNAVAILABLE = null;
export const CASHLINK_ADDRESS = 'cashlink';
Expand Down
4 changes: 2 additions & 2 deletions src/lib/swap/utils/CommonUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ export function capDecimals(amount: number, asset: SwapAsset) {
}

export function calculateFees(
{ to, from }: { to: FiatCurrency.EUR, from?: CryptoCurrency }
| { to?: CryptoCurrency, from: FiatCurrency.EUR },
{ to, from }: { to: 'eur', from?: CryptoCurrency }
| { to?: CryptoCurrency, from: 'eur' },
amount?: number,
feesPerUnit = { eur: 0, nim: 0, btc: 0 },
) {
Expand Down
5 changes: 2 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1673,10 +1673,9 @@
dependencies:
big-integer "^1.6.44"

"@nimiq/utils@^0.9.3":
"@nimiq/utils@https://github.com/nimiq/nimiq-utils#soeren/dist/crc":
version "0.9.3"
resolved "https://registry.yarnpkg.com/@nimiq/utils/-/utils-0.9.3.tgz#db402c8f42bb16dee8e5500c617cff18e1497960"
integrity sha512-g/9FpoNcJmU737TRQsNdU5/OGoXnc1UwunJBF/TGw4bx4cQ/pbYO7k0nsZ4RGUFn0jiy9xlxYH+yH1mvSY7+nQ==
resolved "https://github.com/nimiq/nimiq-utils#b97dedd796fd232852dffd1845c6eb3f00d88681"
dependencies:
big-integer "^1.6.44"

Expand Down

0 comments on commit dc6d915

Please sign in to comment.