From 9bf4bd7cc7ef2bb25337aab05624b484468cea9e Mon Sep 17 00:00:00 2001 From: michaeltout Date: Mon, 3 Jul 2023 21:38:02 +0200 Subject: [PATCH 1/2] Fix bug with non-convertable paths in conversion suggestion list, and bug with miscalulated fees from exportto chains --- package.json | 2 +- .../vrpc/requests/getCurrencyConversionPaths.js | 12 +++++++++++- src/utils/api/channels/vrpc/requests/preflight.js | 8 ++++++-- yarn.lock | 4 ++-- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 74b47084..6b8d704d 100755 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "lint": "eslint ." }, "dependencies": { - "@bitgo/utxo-lib": "git+https://github.com/VerusCoin/BitGoJS.git#b67425ce865ac0032412a1e74c2b1fce3aaf017f", + "@bitgo/utxo-lib": "git+https://github.com/VerusCoin/BitGoJS.git#50702ca84a848020af601081904e6db75c978b78", "@ethersproject/signing-key": "5.0.5", "@react-native-async-storage/async-storage": "1.17.10", "@react-native-camera-roll/camera-roll": "5.0.4", diff --git a/src/utils/api/channels/vrpc/requests/getCurrencyConversionPaths.js b/src/utils/api/channels/vrpc/requests/getCurrencyConversionPaths.js index 44f4e2af..10291c3b 100644 --- a/src/utils/api/channels/vrpc/requests/getCurrencyConversionPaths.js +++ b/src/utils/api/channels/vrpc/requests/getCurrencyConversionPaths.js @@ -18,5 +18,15 @@ export const getCurrencyConversionPaths = async (systemId, src, dest) => { destDefinition = destResponse.result } - return endpoint.getCurrencyConversionPaths(sourceDefinition, destDefinition); + const paths = await endpoint.getCurrencyConversionPaths(sourceDefinition, destDefinition); + + for (const destinationid in paths) { + paths[destinationid] = paths[destinationid].filter(x => { + const offSystem = (x.destination.systemid != systemId) || (x.via != null && x.via.systemid != systemId) + + return !(offSystem && x.exportto == null) + }); + } + + return paths; } \ No newline at end of file diff --git a/src/utils/api/channels/vrpc/requests/preflight.js b/src/utils/api/channels/vrpc/requests/preflight.js index 00ab2c28..2c60e5ce 100644 --- a/src/utils/api/channels/vrpc/requests/preflight.js +++ b/src/utils/api/channels/vrpc/requests/preflight.js @@ -230,6 +230,10 @@ export const preflightCurrencyTransfer = async (coinObj, channelId, activeUser, await saveFriendlyName(coinObj.system_id) } + if (!friendlyNames.has(systemId)) { + await saveFriendlyName(systemId) + } + const { currency, convertto, @@ -293,7 +297,7 @@ export const preflightCurrencyTransfer = async (coinObj, channelId, activeUser, if (isNativeSend && (txSatsBn.plus(nativeFeesPaid)).isGreaterThan(balanceBn)) { output.satoshis = txSatsBn.minus(nativeFeesPaid).toString(); - const newTxSatsBn = BigNumber(output.satoshis) + const newTxSatsBn = BigNumber(output.satoshis); if ((newTxSatsBn.plus(nativeFeesPaid)).isGreaterThan(balanceBn)) { throw new Error("Insufficient funds.") @@ -324,7 +328,7 @@ export const preflightCurrencyTransfer = async (coinObj, channelId, activeUser, const sendCurrencyRes = await getSendCurrencyTransaction( systemId, currency, - satsToCoins(txSatsBn).toNumber(), + satsToCoins(BigNumber(output.satoshis)).toNumber(), addrDest, exportto, convertto, diff --git a/yarn.lock b/yarn.lock index 53e3753a..0d5b116a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -881,9 +881,9 @@ "@bitgo/blake2b-wasm" "^3.0.1" nanoassert "^2.0.0" -"@bitgo/utxo-lib@git+https://github.com/VerusCoin/BitGoJS.git#b67425ce865ac0032412a1e74c2b1fce3aaf017f": +"@bitgo/utxo-lib@git+https://github.com/VerusCoin/BitGoJS.git#50702ca84a848020af601081904e6db75c978b78": version "1.9.6" - resolved "git+https://github.com/VerusCoin/BitGoJS.git#b67425ce865ac0032412a1e74c2b1fce3aaf017f" + resolved "git+https://github.com/VerusCoin/BitGoJS.git#50702ca84a848020af601081904e6db75c978b78" dependencies: "@bitgo/blake2b" "3.0.1" bech32 "0.0.3" From 78a63d6583a7ade3e55200e795c9972fbebaf6ea Mon Sep 17 00:00:00 2001 From: Asher Dawes Date: Wed, 5 Jul 2023 20:03:05 -0700 Subject: [PATCH 2/2] Update version --- android/app/build.gradle | 6 +++--- env/main.android.json | 2 +- env/main.ios.json | 2 +- ios/assets/env/main.json | 2 +- ios/verusMobile.xcodeproj/project.pbxproj | 8 ++++---- package.json | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 7524aa5e..c0894b98 100755 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -2,9 +2,9 @@ apply plugin: "com.android.application" import com.android.build.OutputFile -def versionMajor = 0 -def versionMinor = 9 -def versionRevision = 9 +def versionMajor = 1 +def versionMinor = 0 +def versionRevision = 0 def versionBuild = 0 def keystorePropertiesFile = rootProject.file("keystore.properties"); diff --git a/env/main.android.json b/env/main.android.json index 892f9d01..192e1234 100644 --- a/env/main.android.json +++ b/env/main.android.json @@ -1,5 +1,5 @@ { - "APP_VERSION": "0.9.9", + "APP_VERSION": "1.0.0", "ELECTRUM_PROTOCOL_CHANGE": 1.4, "KEY_DERIVATION_VERSION": 1, diff --git a/env/main.ios.json b/env/main.ios.json index 78a7b906..0f4090f7 100644 --- a/env/main.ios.json +++ b/env/main.ios.json @@ -1,5 +1,5 @@ { - "APP_VERSION": "0.9.9", + "APP_VERSION": "1.0.0", "ELECTRUM_PROTOCOL_CHANGE": 1.4, "KEY_DERIVATION_VERSION": 1, diff --git a/ios/assets/env/main.json b/ios/assets/env/main.json index 78a7b906..0f4090f7 100644 --- a/ios/assets/env/main.json +++ b/ios/assets/env/main.json @@ -1,5 +1,5 @@ { - "APP_VERSION": "0.9.9", + "APP_VERSION": "1.0.0", "ELECTRUM_PROTOCOL_CHANGE": 1.4, "KEY_DERIVATION_VERSION": 1, diff --git a/ios/verusMobile.xcodeproj/project.pbxproj b/ios/verusMobile.xcodeproj/project.pbxproj index 7155f0ba..601d5b69 100644 --- a/ios/verusMobile.xcodeproj/project.pbxproj +++ b/ios/verusMobile.xcodeproj/project.pbxproj @@ -669,7 +669,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 0; + CURRENT_PROJECT_VERSION = 2; DEAD_CODE_STRIPPING = NO; DEVELOPMENT_TEAM = J8Y97B5NMQ; ENABLE_BITCODE = NO; @@ -721,7 +721,7 @@ "\"${PODS_CONFIGURATION_BUILD_DIR}/react-native-webview\"", "\"${PODS_CONFIGURATION_BUILD_DIR}/rn-fetch-blob\"", ); - MARKETING_VERSION = 0.9.9; + MARKETING_VERSION = 1.0.0; PRODUCT_BUNDLE_IDENTIFIER = org.reactjs.native.verusmobile; PRODUCT_NAME = verusmobile; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -740,7 +740,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 0; + CURRENT_PROJECT_VERSION = 2; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_TEAM = J8Y97B5NMQ; ENABLE_BITCODE = NO; @@ -792,7 +792,7 @@ "\"${PODS_CONFIGURATION_BUILD_DIR}/react-native-webview\"", "\"${PODS_CONFIGURATION_BUILD_DIR}/rn-fetch-blob\"", ); - MARKETING_VERSION = 0.9.9; + MARKETING_VERSION = 1.0.0; PRODUCT_BUNDLE_IDENTIFIER = org.reactjs.native.verusmobile; PRODUCT_NAME = verusmobile; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/package.json b/package.json index cc4c57e6..144e28d7 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "verusmobile", - "version": "0.9.9", + "version": "1.0.0", "private": true, "scripts": { "postinstall": "./node_modules/.bin/rn-nodeify --hack --install --yarn && npx jetify",