{{ isSelling ? $t('Sell NIM using Sinpe Móvil') : '' }}
+{{ isSelling ? $t('Sell NIM directly to your Sinpe Móvil account.') : '' }}
+-
+
- {{ $t('Confirm Sinpe number') }} +
- {{ isSelling ? $t('Set an amount to sell') : '' }} +
@@ -313,12 +313,11 @@ import {
cancelSwap,
getSwap,
Swap,
+ EurHtlcDetails,
} from '@nimiq/fastspot-api';
import {
- getHtlc,
Htlc as OasisHtlc,
HtlcStatus,
- sandboxMockClearHtlc,
TransactionType,
SepaClearingInstruction,
} from '@nimiq/oasis-api';
@@ -366,8 +365,8 @@ import {
useCurrentLimitCrypto,
useCurrentLimitFiat,
useSwapEstimate,
- eurPerBtc,
- eurPerNim,
+ fiatPerNim,
+ fiatPerBtc,
fetchAssets,
fiatCurrencyInfo,
getFiatSwapParameters,
@@ -378,6 +377,7 @@ import { useBankStore } from '../../stores/Bank';
import { useKycStore } from '../../stores/Kyc';
import KycPrompt from '../kyc/KycPrompt.vue';
import KycOverlay from '../kyc/KycOverlay.vue';
+import { getHtlc, sandboxMockClearHtlc } from '../../lib/OasisEur';
enum Pages {
WELCOME,
@@ -435,9 +435,9 @@ export default defineComponent({
get: () => {
if (_cryptoAmount.value !== 0) return _cryptoAmount.value;
if (!estimate.value) return 0;
-
- if (estimate.value.to.asset !== activeCurrency.value.toUpperCase()) return 0;
- return capDecimals(estimate.value.to.amount - estimate.value.to.fee, estimate.value.to.asset);
+ const { asset, amount, fee } = estimate.value.to;
+ if (asset !== activeCurrency.value.toUpperCase()) return 0;
+ return capDecimals(amount - fee, { asset });
},
set: (value: number) => {
_fiatAmount.value = 0;
@@ -527,7 +527,7 @@ export default defineComponent({
const btcAddress = availableExternalAddresses.value[0];
try {
- const { from, to } = getFiatSwapParameters(_fiatAmount.value
+ const { from, to } = getFiatSwapParameters(SwapAsset.EUR, _fiatAmount.value
? { from: { asset: SwapAsset.EUR, amount: fiatAmount.value } }
: { to: { amount: cryptoAmount.value } },
);
@@ -540,7 +540,7 @@ export default defineComponent({
// Update local fees with latest feePerUnit values
const { settlementFee } = calculateFees({ from: FiatCurrency.EUR }, undefined, {
- eur: swapSuggestion.from.fee || 0,
+ fiat: swapSuggestion.from.fee || 0,
nim: activeCurrency.value === CryptoCurrency.NIM ? swapSuggestion.to.feePerUnit! : 0,
btc: activeCurrency.value === CryptoCurrency.BTC ? swapSuggestion.to.feePerUnit! : 0,
});
@@ -741,7 +741,8 @@ export default defineComponent({
let oasisHtlc: OasisHtlc;
try {
// TODO: Retry getting the HTLC if first time fails
- oasisHtlc = await getHtlc(confirmedSwap.contracts[SwapAsset.EUR]!.htlc.address);
+ const eurHtlc = confirmedSwap.contracts[SwapAsset.EUR]!.htlc as EurHtlcDetails;
+ oasisHtlc = await getHtlc(eurHtlc.address);
if (oasisHtlc.status !== HtlcStatus.PENDING) {
throw new Error(`UNEXPECTED: OASIS HTLC is not 'pending' but '${oasisHtlc.status}'`);
}
@@ -883,7 +884,8 @@ export default defineComponent({
function onPaid() {
if (!swap.value!.fundingInstructions || swap.value!.fundingInstructions.type !== 'sepa') {
// We are in a test environment
- sandboxMockClearHtlc(swap.value!.contracts.EUR!.htlc.address);
+ const eurHtlc = swap.value!.contracts.EUR!.htlc as EurHtlcDetails;
+ sandboxMockClearHtlc(eurHtlc.address);
}
if (!swap.value!.stateEnteredAt) {
@@ -932,8 +934,8 @@ export default defineComponent({
goBack,
selectedFiatCurrency,
CryptoCurrency,
- eurPerNim,
- eurPerBtc,
+ fiatPerNim,
+ fiatPerBtc,
fiatFees: computed(() => fiatFees.value.settlement),
limits,
activeCurrency,
diff --git a/src/components/modals/BuyOptionsModal.vue b/src/components/modals/BuyOptionsModal.vue
index 6596ee0cd..b332f6964 100644
--- a/src/components/modals/BuyOptionsModal.vue
+++ b/src/components/modals/BuyOptionsModal.vue
@@ -9,10 +9,8 @@
@@ -277,10 +277,9 @@ import {
createSwap,
cancelSwap,
getSwap,
+ Contract,
} from '@nimiq/fastspot-api';
import {
- getHtlc,
- exchangeAuthorizationToken,
HtlcStatus,
TransactionType as OasisTransactionType,
} from '@nimiq/oasis-api';
@@ -329,8 +328,8 @@ import {
useCurrentLimitCrypto,
useCurrentLimitFiat,
useSwapEstimate,
- eurPerBtc,
- eurPerNim,
+ fiatPerBtc,
+ fiatPerNim,
fetchAssets,
fiatCurrencyInfo,
getFiatSwapParameters,
@@ -343,6 +342,7 @@ import {
import { useKycStore } from '../../stores/Kyc';
import KycPrompt from '../kyc/KycPrompt.vue';
import KycOverlay from '../kyc/KycOverlay.vue';
+import { exchangeAuthorizationToken, getHtlc } from '../../lib/OasisEur';
type KycResult = import('../../swap-kyc-handler').SetupSwapWithKycResult['kyc'];
@@ -356,6 +356,12 @@ enum Pages {
const ESTIMATE_UPDATE_DEBOUNCE_DURATION = 500; // ms
export default defineComponent({
+ props: {
+ fiatCurrency: {
+ type: String as () => FiatCurrency,
+ default: FiatCurrency.EUR,
+ },
+ },
setup(props, context) {
const { activeAccountInfo, activeCurrency, hasBitcoinAddresses } = useAccountStore();
const { activeAddressInfo, activeAddress } = useAddressStore();
@@ -414,8 +420,10 @@ export default defineComponent({
if (_cryptoAmount.value !== 0) return _cryptoAmount.value;
if (!estimate.value) return 0;
+ const { asset, amount, fee } = estimate.value.from;
if (estimate.value.from.asset !== activeCurrency.value.toUpperCase()) return 0;
- return capDecimals(estimate.value.from.amount + estimate.value.from.fee, estimate.value.from.asset);
+ if (asset !== activeCurrency.value.toUpperCase()) return 0;
+ return capDecimals(amount + fee, { asset });
},
set: (value: number) => {
_fiatAmount.value = 0;
@@ -517,7 +525,7 @@ export default defineComponent({
const btcAddress = availableExternalAddresses.value[0];
try {
- const { from, to } = getFiatSwapParameters(_fiatAmount.value
+ const { from, to } = getFiatSwapParameters(SwapAsset.EUR, _fiatAmount.value
? { to: { asset: SwapAsset.EUR, amount: fiatAmount.value } }
: { from: { amount: cryptoAmount.value } },
);
@@ -530,7 +538,7 @@ export default defineComponent({
// Update local fees with latest feePerUnit values
const { fundingFee } = calculateFees({ to: FiatCurrency.EUR }, swapSuggestion.from.amount, {
- eur: swapSuggestion.to.fee || 0,
+ fiat: swapSuggestion.to.fee || 0,
nim: activeCurrency.value === CryptoCurrency.NIM ? swapSuggestion.from.feePerUnit! : 0,
btc: activeCurrency.value === CryptoCurrency.BTC ? swapSuggestion.from.feePerUnit! : 0,
});
@@ -789,7 +797,8 @@ export default defineComponent({
});
// Fetch OASIS HTLC to get clearing instructions
- const oasisHtlc = await getHtlc(confirmedSwap.contracts[SwapAsset.EUR]!.htlc.address);
+ const eurContract = confirmedSwap.contracts[SwapAsset.EUR] as Contract {{ isSelling ? $t('Sell NIM directly to your Sinpe Móvil account.') : '' }}
+ {{ $t("Enter your Sinpe Móvil phone number.") }}
+
+ {{
+ $t("Enter the code sent to {phoneNumber} to approve.", {
+ phoneNumber: `${phoneNumber}`,
+ })
+ }}
+ {{ errorMessage }}
{{ $t('No funds were received so the swap expired.') }}
{{ $t('Click on ‘Troubleshooting’ to learn more.') }}
{{ isSelling ? $t('Sell NIM using Sinpe Móvil') : '' }}
+
+
+
+
+ {{ $t('The swap expired') }}
-
+
{{ $t('Any funds sent will be refunded within 1-3 days.') }}
{{ $t('Any funds sent will be refunded.') }}
- {{ $t('Your EUR will be transferred to your bank account as soon as new limit is available.') }} + {{ + $t('Your {fiatCurrency} will be transferred to your bank account' + + 'as soon as new limit is available.', toAsset) + }}