diff --git a/package.json b/package.json index 1114fce9..b1bf4baf 100644 --- a/package.json +++ b/package.json @@ -152,7 +152,7 @@ "blind-signatures", "lightning-network" ], - "version": "0.2.0", + "version": "0.2.1", "license": "AGPL-3.0-only", "bugs": { "url": "https://github.com/cashubtc/eNuts/issues" diff --git a/src/components/nav/BottomNav.tsx b/src/components/nav/BottomNav.tsx index 9ef76945..930075de 100644 --- a/src/components/nav/BottomNav.tsx +++ b/src/components/nav/BottomNav.tsx @@ -1,5 +1,6 @@ import { BookIcon, SettingsIcon, WalletIcon } from '@comps/Icons' import Txt from '@comps/Txt' +import { isIOS } from '@consts' import type { TBottomNavProps, TRouteString } from '@model/nav' import { useThemeContext } from '@src/context/Theme' import { NS } from '@src/i18n' @@ -51,7 +52,7 @@ export default function BottomNav({ diff --git a/src/screens/Addressbook/index.tsx b/src/screens/Addressbook/index.tsx index 7ea5b5c3..8b21bb7f 100644 --- a/src/screens/Addressbook/index.tsx +++ b/src/screens/Addressbook/index.tsx @@ -60,7 +60,7 @@ export interface ISearchStates { hasResults: boolean } -const marginBottom = vs(70) +const marginBottom = isIOS ? vs(45) : vs(70) const marginBottomPayment = isIOS ? vs(20) : 0 // https://github.com/nostr-protocol/nips/blob/master/04.md#security-warning diff --git a/src/screens/Payment/Processing.tsx b/src/screens/Payment/Processing.tsx index d9801f6e..f8f02338 100644 --- a/src/screens/Payment/Processing.tsx +++ b/src/screens/Payment/Processing.tsx @@ -186,11 +186,11 @@ export default function ProcessingScreen({ navigation, route }: TProcessingPageP return handleError({ e: 'Auto-mint-swap currently only supports a single source mint.' }) } // TODO this process can take a while, we need to add it as pending transaction? - const { payResult, requestTokenResult, estFee } = await fullAutoMintSwap(tokenInfo, targetMint.mintUrl) + const { payResult, requestTokenResult, estFeeResp } = await fullAutoMintSwap(tokenInfo, targetMint.mintUrl) if (!payResult || !requestTokenResult) { return handleError({ e: 'payResult or requestTokenResult is undefined' }) } - const amountSent = tokenInfo.value - estFee + const amountSent = tokenInfo.value - estFeeResp // add as history entry (multimint swap) await addToHistory({ amount: -amountSent, @@ -203,7 +203,7 @@ export default function ProcessingScreen({ navigation, route }: TProcessingPageP navigation.navigate('success', { amount: amountSent, fee: payResult.realFee, - change: estFee - (payResult.realFee || 0), + change: estFeeResp - (payResult.realFee || 0), isMelt: true }) } diff --git a/src/screens/Payment/Success.tsx b/src/screens/Payment/Success.tsx index d9637862..3e3a5446 100644 --- a/src/screens/Payment/Success.tsx +++ b/src/screens/Payment/Success.tsx @@ -94,10 +94,10 @@ export default function SuccessPage({ navigation, route }: TSuccessPageProps) { {isMelt && amount && -
-
-
- {isNum(change) &&
} +
+
+
+ {isNum(change) &&
} } @@ -141,10 +141,10 @@ export default function SuccessPage({ navigation, route }: TSuccessPageProps) { ) } -function Details({ key, value }: { key: string, value: string }) { +function Details({ txt, value }: { txt: string, value: string }) { return ( - + ) diff --git a/src/wallet/index.ts b/src/wallet/index.ts index 5e68d979..834b9c9e 100644 --- a/src/wallet/index.ts +++ b/src/wallet/index.ts @@ -196,7 +196,7 @@ export async function autoMintSwap( fee: number, proofs: Proof[] = [] ): Promise<{ payResult: { result?: PayLnInvoiceResponse, fee?: number, realFee?: number, error?: unknown }; requestTokenResult: { success: boolean; invoice?: IInvoice | null } }> { - if (!isNum(fee) || fee <= 0) { fee = await checkFees(destMintUrl, (await requestMint(destMintUrl, amount)).pr) } + if (!isNum(fee) || fee <= 0) { fee = await checkFees(srcMintUrl, (await requestMint(destMintUrl, amount)).pr) } l('[autoMintSwap]', { fee, amount, srcMintUrl, destMintUrl }) if (!amount || !isNum(amount) || isNaN(amount) || !isFinite(amount) || amount <= 0) { throw new Error('Swap Error: not enough funds') @@ -221,21 +221,22 @@ export async function autoMintSwap( export async function fullAutoMintSwap(tokenInfo: ITokenInfo, destMintUrl: string) { l('[fullAutoMintSwap] ', { tokenInfo, destMintUrl }) try { + const srcMintUrl = tokenInfo.mints[0] const invoice = await requestMint(destMintUrl, tokenInfo.value) - const estFee = await checkFees(destMintUrl, invoice.pr) + const estFee = await checkFees(srcMintUrl, invoice.pr) const proofs: Proof[] = [] for (const t of tokenInfo.decoded.token) { proofs.push(...t.proofs) } const { payResult, requestTokenResult } = await autoMintSwap( - tokenInfo.mints[0], + srcMintUrl, destMintUrl, tokenInfo.value - estFee, estFee, proofs ) l('[fullAutoMintSwap]', { payResult, requestTokenResult }) - return { payResult, requestTokenResult, estFee } + return { payResult, requestTokenResult, estFeeResp: estFee } } catch (e) { return { payResult: undefined, requestTokenResult: undefined } }