diff --git a/android/app/build.gradle b/android/app/build.gradle index 9ef7d9fb..14f14530 100755 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -4,7 +4,7 @@ import com.android.build.OutputFile def versionMajor = 1 def versionMinor = 0 -def versionRevision = 12 +def versionRevision = 13 def versionBuild = 0 def keystorePropertiesFile = rootProject.file("keystore.properties"); diff --git a/env/main.android.json b/env/main.android.json index 26469f8f..e68e1d29 100644 --- a/env/main.android.json +++ b/env/main.android.json @@ -1,5 +1,5 @@ { - "APP_VERSION": "1.0.12", + "APP_VERSION": "1.0.13", "ELECTRUM_PROTOCOL_CHANGE": 1.4, "KEY_DERIVATION_VERSION": 1, @@ -49,5 +49,7 @@ "CURRENCY_DEFINITION_STORAGE_INTERNAL_KEY": "currencyDefinitions", "CONTRACT_DEFINITION_STORAGE_INTERNAL_KEY": "ethereumContractDefinitions", - "WYRE_ACCESSIBLE": true + "WYRE_ACCESSIBLE": true, + + "CONVERSION_DISABLED": false } diff --git a/env/main.ios.json b/env/main.ios.json index 899b32af..433438bb 100644 --- a/env/main.ios.json +++ b/env/main.ios.json @@ -1,5 +1,5 @@ { - "APP_VERSION": "1.0.12", + "APP_VERSION": "1.0.13", "ELECTRUM_PROTOCOL_CHANGE": 1.4, "KEY_DERIVATION_VERSION": 1, @@ -49,5 +49,7 @@ "CURRENCY_DEFINITION_STORAGE_INTERNAL_KEY": "currencyDefinitions", "CONTRACT_DEFINITION_STORAGE_INTERNAL_KEY": "ethereumContractDefinitions", - "WYRE_ACCESSIBLE": true + "WYRE_ACCESSIBLE": true, + + "CONVERSION_DISABLED": false } diff --git a/ios/assets/env/main.json b/ios/assets/env/main.json index 899b32af..433438bb 100644 --- a/ios/assets/env/main.json +++ b/ios/assets/env/main.json @@ -1,5 +1,5 @@ { - "APP_VERSION": "1.0.12", + "APP_VERSION": "1.0.13", "ELECTRUM_PROTOCOL_CHANGE": 1.4, "KEY_DERIVATION_VERSION": 1, @@ -49,5 +49,7 @@ "CURRENCY_DEFINITION_STORAGE_INTERNAL_KEY": "currencyDefinitions", "CONTRACT_DEFINITION_STORAGE_INTERNAL_KEY": "ethereumContractDefinitions", - "WYRE_ACCESSIBLE": true + "WYRE_ACCESSIBLE": true, + + "CONVERSION_DISABLED": false } diff --git a/ios/verusMobile.xcodeproj/project.pbxproj b/ios/verusMobile.xcodeproj/project.pbxproj index 96a0a25d..7b67cfa0 100644 --- a/ios/verusMobile.xcodeproj/project.pbxproj +++ b/ios/verusMobile.xcodeproj/project.pbxproj @@ -721,7 +721,7 @@ "\"${PODS_CONFIGURATION_BUILD_DIR}/react-native-webview\"", "\"${PODS_CONFIGURATION_BUILD_DIR}/rn-fetch-blob\"", ); - MARKETING_VERSION = 1.0.12; + MARKETING_VERSION = 1.0.13; PRODUCT_BUNDLE_IDENTIFIER = org.reactjs.native.verusmobile; PRODUCT_NAME = verusmobile; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -792,7 +792,7 @@ "\"${PODS_CONFIGURATION_BUILD_DIR}/react-native-webview\"", "\"${PODS_CONFIGURATION_BUILD_DIR}/rn-fetch-blob\"", ); - MARKETING_VERSION = 1.0.12; + MARKETING_VERSION = 1.0.13; PRODUCT_BUNDLE_IDENTIFIER = org.reactjs.native.verusmobile; PRODUCT_NAME = verusmobile; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/package.json b/package.json index 3a263e1d..363d968b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "verusmobile", - "version": "1.0.12", + "version": "1.0.13", "private": true, "scripts": { "postinstall": "./node_modules/.bin/rn-nodeify --hack --install --yarn && npx jetify", @@ -14,7 +14,7 @@ "lint": "eslint ." }, "dependencies": { - "@bitgo/utxo-lib": "git+https://github.com/VerusCoin/BitGoJS.git#7c754d4a5920198d9fe6827d3e23bd5cf431f264", + "@bitgo/utxo-lib": "git+https://github.com/VerusCoin/BitGoJS.git#utxo-lib-verus", "@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/VerusMobile.js b/src/VerusMobile.js index d1c6e059..9e47e6f3 100644 --- a/src/VerusMobile.js +++ b/src/VerusMobile.js @@ -107,6 +107,11 @@ class VerusMobile extends React.Component { //version) clearCachedVersions() .then(async () => { + const settingsAction = await initSettings(); + this.props.dispatch(settingsAction); + + CoinDirectory.setVrpcOverrides(settingsAction.settings.generalWalletSettings ? settingsAction.settings.generalWalletSettings.vrpcOverrides : {}); + await clearCachedVrpcResponses() const usedCoins = await purgeUnusedCoins() @@ -126,7 +131,6 @@ class VerusMobile extends React.Component { let promiseArr = [ fetchUsers(), - initSettings(), initNotifications(), fetchActiveCoins(), ]; diff --git a/src/actions/actions/account/dispatchers/account.js b/src/actions/actions/account/dispatchers/account.js index 22e2b6a1..c8381b3e 100644 --- a/src/actions/actions/account/dispatchers/account.js +++ b/src/actions/actions/account/dispatchers/account.js @@ -45,28 +45,24 @@ export const initializeAccountData = async ( store.dispatch(settingsAction); try { - const { addressBlocklistDefinition, addressBlocklist } = store.getState().settings.generalWalletSettings; - - if (addressBlocklistDefinition.type === ADDRESS_BLOCKLIST_FROM_WEBSERVER) { - const fetchedBlocklist = await getAddressBlocklistFromServer(); - const currentBlocklist = [...addressBlocklist]; - - for (const address of fetchedBlocklist) { - if (currentBlocklist.find(x => x.address === address) == null) { - currentBlocklist.unshift({ - address, - details: '', - lastModified: Math.floor(Date.now() / 1000) - }); - } - } + const { addressBlocklist } = store.getState().settings.generalWalletSettings; - const saveGeneralSettingsAction = await saveGeneralSettings({ - addressBlocklist: currentBlocklist - }); + const fetchedBlocklist = await getAddressBlocklistFromServer(); + const currentBlocklist = []; - store.dispatch(saveGeneralSettingsAction); + for (const address of fetchedBlocklist) { + currentBlocklist.unshift({ + address, + details: '', + lastModified: Math.floor(Date.now() / 1000) + }); } + + const saveGeneralSettingsAction = await saveGeneralSettings({ + addressBlocklist: currentBlocklist + }); + + store.dispatch(saveGeneralSettingsAction); } catch(e) { console.warn("Failed to fetch address blocklist"); console.warn(e); diff --git a/src/components/SendModal/ConvertOrCrossChainSend/ConvertOrCrossChainSendForm/ConvertOrCrossChainSendForm.js b/src/components/SendModal/ConvertOrCrossChainSend/ConvertOrCrossChainSendForm/ConvertOrCrossChainSendForm.js index 61ded570..3abbfca0 100644 --- a/src/components/SendModal/ConvertOrCrossChainSend/ConvertOrCrossChainSendForm/ConvertOrCrossChainSendForm.js +++ b/src/components/SendModal/ConvertOrCrossChainSend/ConvertOrCrossChainSendForm/ConvertOrCrossChainSendForm.js @@ -50,7 +50,7 @@ import { ETH_CONTRACT_ADDRESS, VETH } from "../../../../utils/constants/web3Cons import { preflightConvertOrCrossChain } from "../../../../utils/api/routers/preflightConvertOrCrossChain"; import { getIdentity } from "../../../../utils/api/routers/getIdentity"; import { addressIsBlocked } from "../../../../utils/addressBlocklist"; -import selectAddressBlocklist from "../../../../selectors/settings"; +import { selectAddressBlocklist } from "../../../../selectors/settings"; import { I_ADDRESS_VERSION, R_ADDRESS_VERSION } from "../../../../utils/constants/constants"; import { getWeb3ProviderForNetwork } from "../../../../utils/web3/provider"; diff --git a/src/components/SendModal/TraditionalCryptoSend/TraditionalCryptoSendForm/TraditionalCryptoSendForm.js b/src/components/SendModal/TraditionalCryptoSend/TraditionalCryptoSendForm/TraditionalCryptoSendForm.js index aa9f8264..abf5f799 100644 --- a/src/components/SendModal/TraditionalCryptoSend/TraditionalCryptoSendForm/TraditionalCryptoSendForm.js +++ b/src/components/SendModal/TraditionalCryptoSend/TraditionalCryptoSendForm/TraditionalCryptoSendForm.js @@ -14,7 +14,7 @@ import Colors from "../../../../globals/colors"; import Styles from "../../../../styles"; import { useEffect } from "react"; import { CoinDirectory } from "../../../../utils/CoinData/CoinDirectory"; -import selectAddressBlocklist from "../../../../selectors/settings"; +import { selectAddressBlocklist } from "../../../../selectors/settings"; import { addressIsBlocked } from "../../../../utils/addressBlocklist"; const TraditionalCryptoSendForm = ({ setLoading, setModalHeight, updateSendFormData, navigation }) => { diff --git a/src/containers/Coin/SendCoin/SendCoin.js b/src/containers/Coin/SendCoin/SendCoin.js index c8b8bd60..3a459182 100644 --- a/src/containers/Coin/SendCoin/SendCoin.js +++ b/src/containers/Coin/SendCoin/SendCoin.js @@ -29,6 +29,9 @@ import { import { saveGeneralSettings } from "../../../actions/actionCreators"; import { openUrl } from "../../../utils/linking"; import { createAlert, resolveAlert } from "../../../actions/actions/alert/dispatchers/alert"; +import { + CONVERSION_DISABLED +} from '../../../../env/index'; const SendCoin = ({ navigation }) => { const activeCoin = useSelector(state => state.coins.activeCoin); @@ -41,7 +44,55 @@ const SendCoin = ({ navigation }) => { ); const dispatch = useDispatch() - const CONVERT_OR_CROSS_CHAIN_OPTIONS = [ + const CONVERT_OR_CROSS_CHAIN_OPTIONS = CONVERSION_DISABLED ? [ + { + key: 'export', + title: 'Send off-chain', + description: `Send ${activeCoin.display_ticker} to an address on a different blockchain network without converting it`, + data: { + [SEND_MODAL_TO_ADDRESS_FIELD]: '', + [SEND_MODAL_AMOUNT_FIELD]: '', + [SEND_MODAL_MEMO_FIELD]: '', + [SEND_MODAL_CONVERTTO_FIELD]: '', + [SEND_MODAL_EXPORTTO_FIELD]: '', + [SEND_MODAL_VIA_FIELD]: '', + [SEND_MODAL_MAPPING_FIELD]: '', + [SEND_MODAL_PRICE_ESTIMATE]: null, + [SEND_MODAL_IS_PRECONVERT]: false, + [SEND_MODAL_SHOW_CONVERTTO_FIELD]: false, + [SEND_MODAL_SHOW_EXPORTTO_FIELD]: true, + [SEND_MODAL_SHOW_MAPPING_FIELD]: true, + [SEND_MODAL_SHOW_VIA_FIELD]: false, + [SEND_MODAL_ADVANCED_FORM]: false, + [SEND_MODAL_DISABLED_INPUTS]: { + [SEND_MODAL_MAPPING_FIELD]: activeCoin.proto === 'vrsc' + } + }, + }, + { + key: 'advanced', + title: 'Advanced', + description: 'Send off-chain using an unguided form', + data: { + [SEND_MODAL_TO_ADDRESS_FIELD]: '', + [SEND_MODAL_AMOUNT_FIELD]: '', + [SEND_MODAL_MEMO_FIELD]: '', + [SEND_MODAL_CONVERTTO_FIELD]: '', + [SEND_MODAL_EXPORTTO_FIELD]: '', + [SEND_MODAL_VIA_FIELD]: '', + [SEND_MODAL_MAPPING_FIELD]: '', + [SEND_MODAL_PRICE_ESTIMATE]: null, + [SEND_MODAL_IS_PRECONVERT]: false, + [SEND_MODAL_SHOW_CONVERTTO_FIELD]: false, + [SEND_MODAL_SHOW_EXPORTTO_FIELD]: true, + [SEND_MODAL_SHOW_MAPPING_FIELD]: (activeCoin.proto === 'erc20' || activeCoin.proto === 'eth'), + [SEND_MODAL_SHOW_VIA_FIELD]: false, + [SEND_MODAL_ADVANCED_FORM]: true, + [SEND_MODAL_SHOW_IS_PRECONVERT]: false, + [SEND_MODAL_DISABLED_INPUTS]: {} + }, + } + ] : [ { key: 'convert', title: 'Convert currency', @@ -245,7 +296,7 @@ By proceeding, you confirm that you've read, understood, and agreed to this. Ens marginBottom: 8, }} > - {"Convert or cross-chain"} + {CONVERSION_DISABLED ? "Send cross-chain" : "Convert or cross-chain"} )} diff --git a/src/containers/FundSourceSelect/FundSourceSelectList.js b/src/containers/FundSourceSelect/FundSourceSelectList.js index 1767871f..71633e49 100644 --- a/src/containers/FundSourceSelect/FundSourceSelectList.js +++ b/src/containers/FundSourceSelect/FundSourceSelectList.js @@ -180,8 +180,7 @@ const FundSourceSelectList = (props) => { amount, via, network, - wallet, - conversion + wallet } = sourceOptions[networkId][optionId]; const balanceLoaded = cryptoBalances[coinObj.id] && cryptoBalances[coinObj.id][wallet.id]; diff --git a/src/containers/RootStack/MainStackScreens/MainStackScreens.js b/src/containers/RootStack/MainStackScreens/MainStackScreens.js index 21e0bfbd..4a2fe261 100644 --- a/src/containers/RootStack/MainStackScreens/MainStackScreens.js +++ b/src/containers/RootStack/MainStackScreens/MainStackScreens.js @@ -16,6 +16,7 @@ import DeleteProfile from '../../Settings/ProfileSettings/DeleteProfile/DeletePr import SecureLoading from '../../SecureLoading/SecureLoading' import HomeTabScreens from '../HomeTabScreens/HomeTabScreens'; import AddressBlocklist from '../../Settings/WalletSettings/AddressBlocklist/AddressBlocklist'; +import VrpcOverrides from '../../Settings/WalletSettings/VrpcOverrides/VrpcOverrides'; const MainStack = createStackNavigator(); @@ -99,6 +100,14 @@ const MainStackScreens = props => { }} /> + + { : settings.addressBlocklistDefinition, addressBlocklist: settings.addressBlocklist == null ? [] : settings.addressBlocklist, + vrpcOverrides: settings.vrpcOverrides == null ? {} : settings.vrpcOverrides, }; const res = await saveGeneralSettings(stateToSave); dispatch(res); diff --git a/src/containers/Settings/WalletSettings/VrpcOverrides/VrpcOverrides.js b/src/containers/Settings/WalletSettings/VrpcOverrides/VrpcOverrides.js new file mode 100644 index 00000000..25fd7274 --- /dev/null +++ b/src/containers/Settings/WalletSettings/VrpcOverrides/VrpcOverrides.js @@ -0,0 +1,254 @@ +import { Component } from "react" +import { connect } from 'react-redux' +import { VrpcOverridesRender } from "./VrpcOverrides.render" +import { Alert } from "react-native"; +import { saveGeneralSettings } from "../../../../actions/actionCreators"; +import { coinsList } from "../../../../utils/CoinData/CoinsList"; +import { VerusdRpcInterface } from "verusd-rpc-ts-client"; +import { timeout } from "../../../../utils/promises"; +import { createAlert } from "../../../../actions/actions/alert/dispatchers/alert"; + +const EDIT = 'edit' +const RESET_TO_DEFAULT = 'default' + +class VrpcOverrides extends Component { + constructor() { + super(); + + this.DEFAULT_SYSTEMS = { + [coinsList.VRSC.system_id]: coinsList.VRSC, + [coinsList.VRSCTEST.system_id]: coinsList.VRSCTEST, + [coinsList.iExBJfZYK7KREDpuhj6PzZBzqMAKaFg7d2.system_id]: coinsList.iExBJfZYK7KREDpuhj6PzZBzqMAKaFg7d2 + }; + + this.state = { + vrpcOverridesSettings: { + vrpcOverrides: {} + }, + editPropertyModal: { + open: false, + label: "", + systemid: null + }, + addVrpcOverrideModal: { + open: false, + label: "", + systemid: null + }, + systems: { + ...this.DEFAULT_SYSTEMS + }, + loading: false + }; + + this.EDIT_PROPERTY_BUTTONS = [{ + key: EDIT, + title: "Edit" + }, + { + key: RESET_TO_DEFAULT, + title: "Reset to default" + }] + } + + componentDidMount() { + this.loadSettings(); + } + + closeEditPropertyModal() { + this.setState({ + editPropertyModal: { + open: false, + label: "", + systemid: null + } + }) + } + + openEditPropertyModal(label, systemid = null) { + this.setState({ + editPropertyModal: { + open: true, + label, + systemid + } + }) + } + + selectEditPropertyButton(button) { + switch (button) { + case EDIT: + this.setState({ + addVrpcOverrideModal: { + open: true, + label: "Edit RPC Server", + systemid: this.state.editPropertyModal.systemid + } + }) + break; + case RESET_TO_DEFAULT: + const systemid = this.state.editPropertyModal.systemid; + + this.setState({ + editPropertyModal: { + open: false, + label: "", + systemid: null + } + }, () => this.editVrpcOverride(null, systemid)) + break; + default: + break; + } + } + + componentDidUpdate(lastProps) { + if (lastProps.settings !== this.props.settings) { + this.loadSettings(); + } + } + + finishAddVrpcOverrideModal(server, systemid) { + this.setState({ + addVrpcOverrideModal: { + open: false, + label: "", + systemid: null + } + }, () => this.editVrpcOverride(server, systemid)) + } + + editVrpcOverride(server, systemid) { + if (!server || server.length === 0) { + let vrpcOverrides = this.state.vrpcOverridesSettings.vrpcOverrides ? {...this.state.vrpcOverridesSettings.vrpcOverrides} : {}; + + delete vrpcOverrides[systemid]; + this.updateVrpcOverrides(vrpcOverrides); + } else { + this.setState({ + loading: true + }, async () => { + let vrpcOverrides = this.state.vrpcOverridesSettings.vrpcOverrides ? {...this.state.vrpcOverridesSettings.vrpcOverrides} : {}; + const testInterface = new VerusdRpcInterface("", server); + const testResult = await timeout(10000, testInterface.getInfo()); + + if (testResult.result && (testResult.result.chainid === systemid || !systemid)) { + vrpcOverrides[testResult.result.chainid] = [server]; + + if (!systemid && this.state.systems.hasOwnProperty(testResult.result.chainid)) { + throw new Error("Cannot add another copy of existing system, edit the server for that system instead.") + } else if (!systemid && !this.state.systems.hasOwnProperty(testResult.result.chainid)) { + this.updateVrpcOverrides(vrpcOverrides, { + ...this.state.systems, + [testResult.result.chainid]: { + vrpc_endpoints: [server], + system_id: testResult.result.chainid, + display_name: testResult.result.chainid + } + }); + } else { + this.updateVrpcOverrides(vrpcOverrides); + } + } else { + this.setState({ + loading: false + }, () => createAlert( + "Error", + (testResult.result && (testResult.result.chainid !== systemid)) ? + `RPC server appears to be for different system than requested (${testResult.result.chainid})` + : + "Failed to connect to the RPC server. Please check the server address and try again.") + ); + } + }) + } + } + + openAddVrpcServerModal() { + this.setState({ + addVrpcOverrideModal: { + open: true, + label: "Add RPC Server", + systemid: null + } + }) + } + + updateVrpcOverrides(overrides, systems = this.state.systems) { + this.setState( + { vrpcOverridesSettings: { ...this.state.vrpcOverridesSettings, vrpcOverrides: overrides }, loading: true, systems }, + async () => { + try { + await this.saveSettings() + } catch(e) { + Alert.alert('Error', e.message) + } + + this.setState({ loading: false }); + } + ); + } + + async saveSettings() { + const stateChanges = { + vrpcOverrides: this.state.vrpcOverridesSettings.vrpcOverrides, + }; + + const res = await saveGeneralSettings(stateChanges); + this.props.dispatch(res); + }; + + loadSettings() { + this.setState({ + vrpcOverridesSettings: { + vrpcOverrides: this.props.settings.vrpcOverrides == null ? {} : this.props.settings.vrpcOverrides + } + }, () => this.loadSystems()); + } + + loadSystems() { + let systems = {...this.state.systems}; + + for (let systemid in this.state.vrpcOverridesSettings.vrpcOverrides) { + if (!systems.hasOwnProperty(systemid)) { + systems[systemid] = { + vrpc_endpoints: this.state.vrpcOverridesSettings.vrpcOverrides[systemid], + system_id: systemid, + display_name: systemid + } + } + } + + const todelete = []; + + for (let systemid in systems) { + if ( + !this.DEFAULT_SYSTEMS.hasOwnProperty(systemid) && + !this.state.vrpcOverridesSettings.vrpcOverrides.hasOwnProperty(systemid) + ) { + todelete.push(systemid); + } + } + + for (let i = 0; i < todelete.length; i++) { + delete systems[todelete[i]]; + } + + this.setState({ + systems + }); + } + + render() { + return VrpcOverridesRender.call(this); + } +} + +const mapStateToProps = (state) => { + return { + activeAccount: state.authentication.activeAccount, + settings: state.settings.generalWalletSettings + } +}; + +export default connect(mapStateToProps)(VrpcOverrides); \ No newline at end of file diff --git a/src/containers/Settings/WalletSettings/VrpcOverrides/VrpcOverrides.render.js b/src/containers/Settings/WalletSettings/VrpcOverrides/VrpcOverrides.render.js new file mode 100644 index 00000000..853a0212 --- /dev/null +++ b/src/containers/Settings/WalletSettings/VrpcOverrides/VrpcOverrides.render.js @@ -0,0 +1,98 @@ +import React from "react"; +import { SafeAreaView, ScrollView, View } from "react-native"; +import { Divider, List, Portal } from "react-native-paper"; +import ListSelectionModal from "../../../../components/ListSelectionModal/ListSelectionModal"; +import TextInputModal from "../../../../components/TextInputModal/TextInputModal"; +import Styles from "../../../../styles"; +import AnimatedActivityIndicatorBox from "../../../../components/AnimatedActivityIndicatorBox"; + +export const VrpcOverridesRender = function () { + return ( + + + + {this.state.addVrpcOverrideModal.open && ( + {}} + cancel={(text) => + this.finishAddVrpcOverrideModal( + text, + this.state.addVrpcOverrideModal.systemid + ) + } + /> + )} + {this.state.editPropertyModal.open && ( + this.selectEditPropertyButton(item.key)} + data={this.EDIT_PROPERTY_BUTTONS} + cancel={() => this.closeEditPropertyModal()} + /> + )} + + {this.state.loading ? + + + + : + <> + + {"RPC Servers for Systems"} + + {Object.values(this.state.systems).map((system, index) => { + return ( + + ( + + )} + description={system.display_name} + onPress={() => + this.openEditPropertyModal( + `Edit RPC Server`, + system.system_id + ) + } + /> + + + ); + }) + } + ( + + )} + onPress={() => this.openAddVrpcServerModal()} + /> + + + { + 'Blockchain data for all currencies on the listed networks will be fetched from the listed server for that network. To change the server for a network, edit the appropriate server URL, and restart Verus Mobile.' + + '\n\nDO NOT EDIT THESE SETTINGS UNLESS YOU KNOW WHAT YOU ARE DOING. MAKE SURE YOU TRUST THE SERVERS YOU ARE CONNECTING TO.' + } + + + + } + + + ); +}; diff --git a/src/containers/Settings/WalletSettings/WalletSettings.js b/src/containers/Settings/WalletSettings/WalletSettings.js index d33d9e47..5485df60 100644 --- a/src/containers/Settings/WalletSettings/WalletSettings.js +++ b/src/containers/Settings/WalletSettings/WalletSettings.js @@ -25,6 +25,7 @@ import { RenderSquareCoinLogo } from "../../../utils/CoinData/Graphics"; const GENERAL_WALLET_SETTINGS = "GeneralWalletSettings" const COIN_SETTINGS = "CoinSettings" const ADDRESS_BLOCKLIST = "AddressBlocklist" +const VRPC_OVERRIDES = "VrpcOverrides" class WalletSettings extends Component { constructor(props) { @@ -112,7 +113,7 @@ class WalletSettings extends Component { /> - this._openSettings(ADDRESS_BLOCKLIST)} > + */} + this._openSettings(VRPC_OVERRIDES)} + > + ( + + )} + right={(props) => ( + + )} + /> + {"Wallet Actions"} this.clearCache()}> @@ -139,7 +154,7 @@ class WalletSettings extends Component { {electrumCoins.length > 0 && ( - {"Coin Settings"} + {"Electrum Coin Settings"} )} diff --git a/src/images/cryptologo/default/pbaas/index.js b/src/images/cryptologo/default/pbaas/index.js index 1281cefa..9a151727 100644 --- a/src/images/cryptologo/default/pbaas/index.js +++ b/src/images/cryptologo/default/pbaas/index.js @@ -9,6 +9,8 @@ import SWITCH_DARK from './switch/switch_dark.svg' import SWITCH_LIGHT from './switch/switch_light.svg' import VARRR_LIGHT from './varrr/varrr_light.svg' import VARRR_DARK from './varrr/varrr_dark.svg' +import KAIJU_DARK from './kaiju/kaiju_dark.svg' +import KAIJU_LIGHT from './kaiju/kaiju_light.svg' const RenderPbaasCurrencyLogo = (iAddr) => { function hashCode(str) { @@ -78,5 +80,6 @@ export default { PURE: { light: PURE_LIGHT, dark: PURE_DARK }, BRIDGE_VETH: { light: BRIDGE_VETH_LIGHT, dark: BRIDGE_VETH_DARK }, SWITCH: { light: SWITCH_LIGHT, dark: SWITCH_DARK }, - VARRR: { light: VARRR_LIGHT, dark: VARRR_DARK } + VARRR: { light: VARRR_LIGHT, dark: VARRR_DARK }, + KAIJU: { light: KAIJU_LIGHT, dark: KAIJU_DARK }, } \ No newline at end of file diff --git a/src/images/cryptologo/default/pbaas/kaiju/kaiju_dark.svg b/src/images/cryptologo/default/pbaas/kaiju/kaiju_dark.svg new file mode 100644 index 00000000..b1a8fc8b --- /dev/null +++ b/src/images/cryptologo/default/pbaas/kaiju/kaiju_dark.svg @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/images/cryptologo/default/pbaas/kaiju/kaiju_light.svg b/src/images/cryptologo/default/pbaas/kaiju/kaiju_light.svg new file mode 100644 index 00000000..b1a8fc8b --- /dev/null +++ b/src/images/cryptologo/default/pbaas/kaiju/kaiju_light.svg @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/reducers/settings.js b/src/reducers/settings.js index 01fc32c1..f1b78aa6 100644 --- a/src/reducers/settings.js +++ b/src/reducers/settings.js @@ -32,7 +32,8 @@ export const settings = (state = { type: ADDRESS_BLOCKLIST_FROM_WEBSERVER, data: null }, - addressBlocklist: [] + addressBlocklist: [], + vrpcOverrides: {} // {[systemId]: [vrpcEndpoint1, vrpcEndpoint2, ...]} }, buySellSettings: {}, //e.g. {user1': {buySellEnabled: true, wyreData: {}}, 'user2: {buySellEnabled: false, wyreData: {}}} coinSettings: {}, //e.g. {VRSC: {verificationLvl: 2, verificationLock: false, channels: ['dlight', 'electrum', 'general'], privateAddrs: 100}} diff --git a/src/selectors/settings.js b/src/selectors/settings.js index 341a20a8..0f6c4ba1 100644 --- a/src/selectors/settings.js +++ b/src/selectors/settings.js @@ -1,15 +1,25 @@ import { createSelector } from 'reselect'; -const getAddressBlocklistFromServer = state => +const addressBlocklist = state => state.settings.generalWalletSettings.addressBlocklist ? state.settings.generalWalletSettings.addressBlocklist : []; +const vrpcOverrides = state => + state.settings.generalWalletSettings.vrpcOverrides + ? state.settings.generalWalletSettings.vrpcOverrides + : {}; + export const selectAddressBlocklist = createSelector( - [getAddressBlocklistFromServer], - (addressBlocklist) => { - return addressBlocklist + [addressBlocklist], + (_addressBlocklist) => { + return _addressBlocklist } ); -export default selectAddressBlocklist; +export const selectVrpcOverrides = createSelector( + [vrpcOverrides], + (_vrpcOverrides) => { + return _vrpcOverrides + } +); \ No newline at end of file diff --git a/src/utils/CoinData/CoinData.js b/src/utils/CoinData/CoinData.js index 29e77568..e07394e3 100644 --- a/src/utils/CoinData/CoinData.js +++ b/src/utils/CoinData/CoinData.js @@ -1,7 +1,7 @@ import { electrumServers } from './electrum/servers'; import Colors from '../../globals/colors' import { coinsList } from './CoinsList' -import { DLIGHT_PRIVATE, ELECTRUM, ERC20, GENERAL, WYRE_SERVICE } from '../constants/intervalConstants'; +import { DLIGHT_PRIVATE, ELECTRUM } from '../constants/intervalConstants'; import { ENABLE_VERUS_IDENTITIES } from '../../../env/index' @@ -146,6 +146,7 @@ export const CoinLogos = { // pbaas protocol ["iHax5qYQGbcMGqJKKrPorpzUBX2oFFXGnY"]: CoinLogoIcons.pbaas.PURE, + ["i9kVWKU2VwARALpbXn4RS9zvrhvNRaUibb"]: CoinLogoIcons.pbaas.KAIJU, ["i3f7tSctFkiPpiedY8QR5Tep9p4qDVebDx"]: CoinLogoIcons.pbaas.BRIDGE_VETH, ["i4Xr5TAMrDTD99H69EemhjDxJ4ktNskUtc"]: CoinLogoIcons.pbaas.SWITCH, ["iGBs4DWztRNvNEJBt4mqHszLxfKTNHTkhM"]: CoinLogoIcons.web3.DAI, // DAI on Verus diff --git a/src/utils/CoinData/CoinDirectory.js b/src/utils/CoinData/CoinDirectory.js index 1dc71f66..49c3c452 100644 --- a/src/utils/CoinData/CoinDirectory.js +++ b/src/utils/CoinData/CoinDirectory.js @@ -19,6 +19,8 @@ class _CoinDirectory { disabledNameList = []; enabledNameList = []; + vrpcOverrides = {}; + constructor(coins = {}) { this.coins = coins; this.updateCoinLists(); @@ -69,7 +71,7 @@ class _CoinDirectory { } // Function to find a coin object by coinId. - findCoinObj(key, userName, useSystemId) { + findSimpleCoinObj(key, userName, useSystemId) { const id = useSystemId ? getSystemNameFromSystemId(key) : key === 'iJhCezBExJHvtyH3fGhNnt2NhU4Ztkf2yq' @@ -89,6 +91,10 @@ class _CoinDirectory { privateAddrs: 0 } } + + if (coinObj.vrpc_endpoints) { + coinObj.vrpc_endpoints = this.getVrpcEndpoints(coinObj.id); + } if (!coinObj.apps || Object.keys(coinObj.apps).length === 0) { const defaultApps = getDefaultApps(coinObj) @@ -115,22 +121,50 @@ class _CoinDirectory { return coinObj; } + setVrpcOverrides(overrides) { + this.vrpcOverrides = overrides ? overrides : {}; + } + + getVrpcEndpoints(coinId) { + const simpleCoinObj = this.getBasicCoinObj(coinId); + + if (this.vrpcOverrides && this.vrpcOverrides.hasOwnProperty(simpleCoinObj.system_id)) { + return this.vrpcOverrides[simpleCoinObj.system_id]; + } else if (simpleCoinObj && simpleCoinObj.vrpc_endpoints) { + return simpleCoinObj.vrpc_endpoints; + } else throw new Error("Cannot find VRPC endpoints for " + simpleCoinObj.id); + } + findSystemCoinObj(id) { - const coinObj = this.findCoinObj(id) + const coinObj = this.findSimpleCoinObj(id) const system = coinObj.system_id try { - const systemObj = this.findCoinObj(system, null, true); + const systemObj = this.findSimpleCoinObj(system, null, true); return systemObj; } catch(e) { if (this.coinExistsInDirectory(system)) { - return this.findCoinObj(system); + return this.findSimpleCoinObj(system); } else { throw new Error("Cannot find system " + system) } } } + findCoinObj(key, userName, useSystemId) { + const coinObj = this.findSimpleCoinObj(key, userName, useSystemId); + + if (coinObj.proto === 'vrsc' && (coinObj.compatible_channels.includes(VRPC) || coinObj.compatible_channels.includes(VERUSID))) { + const systemObj = this.findSystemCoinObj(coinObj.id); + + coinObj.system_options = systemObj.pbaas_options; + coinObj.vrpc_endpoints = systemObj.vrpc_endpoints; + coinObj.seconds_per_block = systemObj.seconds_per_block; + } + + return coinObj; + } + // Function to add PBaaS currency async addPbaasCurrency(currencyDefinition, isTestnet = false, checkEndpoint = true, trySystemFallback = true, storeResults = true) { const id = currencyDefinition.currencyid @@ -196,21 +230,27 @@ class _CoinDirectory { systemOptions = systemObj.pbaas_options; } catch(e) { if (this.coinExistsInDirectory(system)) { - endpoints = this.coins[system].vrpc_endpoints; + endpoints = this.getVrpcEndpoints(system); secondsPerBlock = this.coins[system].seconds_per_block; systemOptions = this.coins[system].pbaas_options; } else if (currencyDefinition.nodes) { - const firstNode = currencyDefinition.nodes[0].networkaddress; secondsPerBlock = currencyDefinition.blocktime; systemOptions = currencyDefinition.options; - const firstNodeSplit = firstNode.split(':') - const firstNodePort = firstNodeSplit[firstNodeSplit.length - 1] - - if (isNaN(firstNodePort)) throw new Error("Cannot deduce vrpc endpoint with port" + firstNodePort + " for " + system) + let endpoint; - const baseServer = isTestnet ? coinsList.VRSCTEST.vrpc_endpoints[0] : coinsList.VRSC.vrpc_endpoints[0] - const endpoint = `${baseServer}:${(Number(firstNodePort) + 1).toString()}` + try { + endpoint = this.getVrpcEndpoints(system)[0]; + } catch(e) { + const firstNode = currencyDefinition.nodes[0].networkaddress; + const firstNodeSplit = firstNode.split(':') + const firstNodePort = firstNodeSplit[firstNodeSplit.length - 1] + + if (isNaN(firstNodePort)) throw new Error("Cannot deduce vrpc endpoint with port" + firstNodePort + " for " + system) + + const baseServer = isTestnet ? this.getVrpcEndpoints("VRSCTEST")[0] : this.getVrpcEndpoints("VRSC")[0] + endpoint = `${baseServer}:${(Number(firstNodePort) + 1).toString()}` + } if (checkEndpoint) { try { @@ -230,8 +270,8 @@ class _CoinDirectory { const currencyInterface = new VerusdRpcInterface( isTestnet ? coinsList.VRSCTEST.currency_id : coinsList.VRSC.currency_id, isTestnet - ? coinsList.VRSCTEST.vrpc_endpoints[0] - : coinsList.VRSC.vrpc_endpoints[0], + ? this.getVrpcEndpoints("VRSCTEST")[0] + : this.getVrpcEndpoints("VRSC")[0], ); const systemDefinition = await currencyInterface.getCurrency(system) @@ -242,7 +282,7 @@ class _CoinDirectory { systemDefinition.result.nodes ) { await this.addPbaasCurrency(systemDefinition.result, isTestnet, checkEndpoint); - endpoints = this.coins[systemDefinition.result.currencyid].vrpc_endpoints; + endpoints = this.getVrpcEndpoints(systemDefinition.result.currencyid); secondsPerBlock = this.coins[systemDefinition.result.currencyid].seconds_per_block; systemOptions = this.coins[systemDefinition.result.currencyid].pbaas_options; } else { diff --git a/src/utils/CoinData/CoinsList.js b/src/utils/CoinData/CoinsList.js index 87d3744d..681e1480 100644 --- a/src/utils/CoinData/CoinsList.js +++ b/src/utils/CoinData/CoinsList.js @@ -107,7 +107,6 @@ export const coinsList = { }, ["iGBs4DWztRNvNEJBt4mqHszLxfKTNHTkhM"]: { pbaas_options: 32, - system_options: 128, id: "iGBs4DWztRNvNEJBt4mqHszLxfKTNHTkhM", currency_id: "iGBs4DWztRNvNEJBt4mqHszLxfKTNHTkhM", system_id: "i9nwxtKuVYX4MSbeULLiK2ttVi6rUEhh4X", @@ -120,9 +119,7 @@ export const coinsList = { compatible_channels: [VERUSID, VRPC, GENERAL], tags: [IS_VERUS, IS_ZCASH, IS_PBAAS], proto: "vrsc", - vrpc_endpoints: ["https://api.verus.services"], decimals: 8, - seconds_per_block: 60, default_app: "wallet", apps: VERUS_APPS, rate_url_params: {coin_paprika: 'dai-dai'}, @@ -131,7 +128,6 @@ export const coinsList = { }, ["iCkKJuJScy4Z6NSDK7Mt42ZAB2NEnAE1o4"]: { pbaas_options: 32, - system_options: 128, id: "iCkKJuJScy4Z6NSDK7Mt42ZAB2NEnAE1o4", currency_id: "iCkKJuJScy4Z6NSDK7Mt42ZAB2NEnAE1o4", system_id: "i9nwxtKuVYX4MSbeULLiK2ttVi6rUEhh4X", @@ -144,9 +140,7 @@ export const coinsList = { compatible_channels: [VERUSID, VRPC, GENERAL], tags: [IS_VERUS, IS_ZCASH, IS_PBAAS], proto: "vrsc", - vrpc_endpoints: ["https://api.verus.services"], decimals: 8, - seconds_per_block: 60, default_app: "wallet", apps: VERUS_APPS, rate_url_params: {coin_paprika: 'mkr-maker'}, @@ -155,7 +149,6 @@ export const coinsList = { }, ["iS8TfRPfVpKo5FVfSUzfHBQxo9KuzpnqLU"]: { pbaas_options: 32, - system_options: 128, id: "iS8TfRPfVpKo5FVfSUzfHBQxo9KuzpnqLU", currency_id: "iS8TfRPfVpKo5FVfSUzfHBQxo9KuzpnqLU", system_id: "i9nwxtKuVYX4MSbeULLiK2ttVi6rUEhh4X", @@ -168,9 +161,7 @@ export const coinsList = { compatible_channels: [VERUSID, VRPC, GENERAL], tags: [IS_VERUS, IS_ZCASH, IS_PBAAS], proto: "vrsc", - vrpc_endpoints: ["https://api.verus.services"], decimals: 8, - seconds_per_block: 60, default_app: "wallet", apps: VERUS_APPS, rate_url_params: {coin_paprika: 'tbtc-tbtc'}, @@ -179,7 +170,6 @@ export const coinsList = { }, ["i61cV2uicKSi1rSMQCBNQeSYC3UAi9GVzd"]: { pbaas_options: 32, - system_options: 128, id: "i61cV2uicKSi1rSMQCBNQeSYC3UAi9GVzd", currency_id: "i61cV2uicKSi1rSMQCBNQeSYC3UAi9GVzd", system_id: "i9nwxtKuVYX4MSbeULLiK2ttVi6rUEhh4X", @@ -192,9 +182,7 @@ export const coinsList = { compatible_channels: [VERUSID, VRPC, GENERAL], tags: [IS_VERUS, IS_ZCASH, IS_PBAAS], proto: "vrsc", - vrpc_endpoints: ["https://api.verus.services"], decimals: 8, - seconds_per_block: 60, default_app: "wallet", apps: VERUS_APPS, rate_url_params: {coin_paprika: 'usdc-usd-coin'}, @@ -203,7 +191,6 @@ export const coinsList = { }, ["iC5TQFrFXSYLQGkiZ8FYmZHFJzaRF5CYgE"]: { pbaas_options: 32, - system_options: 128, id: "iC5TQFrFXSYLQGkiZ8FYmZHFJzaRF5CYgE", currency_id: "iC5TQFrFXSYLQGkiZ8FYmZHFJzaRF5CYgE", system_id: "i9nwxtKuVYX4MSbeULLiK2ttVi6rUEhh4X", @@ -216,9 +203,7 @@ export const coinsList = { compatible_channels: [VERUSID, VRPC, GENERAL], tags: [IS_VERUS, IS_ZCASH, IS_PBAAS], proto: "vrsc", - vrpc_endpoints: ["https://api.verus.services"], decimals: 8, - seconds_per_block: 60, default_app: "wallet", apps: VERUS_APPS, rate_url_params: {coin_paprika: 'eurc-eurc'}, @@ -251,7 +236,6 @@ export const coinsList = { }, ["i3f7tSctFkiPpiedY8QR5Tep9p4qDVebDx"]: { pbaas_options: 545, - system_options: 264, id: "i3f7tSctFkiPpiedY8QR5Tep9p4qDVebDx", currency_id: "i3f7tSctFkiPpiedY8QR5Tep9p4qDVebDx", system_id: "i5w5MuNik5NtLcYmNzcvaoixooEebB6MGV", @@ -264,9 +248,7 @@ export const coinsList = { compatible_channels: [VERUSID, VRPC], tags: [IS_VERUS, IS_ZCASH, IS_PBAAS], proto: "vrsc", - vrpc_endpoints: ["https://api.verus.services"], decimals: 8, - seconds_per_block: 60, default_app: "wallet", apps: VERUS_APPS, website: 'https://verus.io', @@ -274,7 +256,6 @@ export const coinsList = { }, ["iHax5qYQGbcMGqJKKrPorpzUBX2oFFXGnY"]: { pbaas_options: 33, - system_options: 264, id: "iHax5qYQGbcMGqJKKrPorpzUBX2oFFXGnY", currency_id: "iHax5qYQGbcMGqJKKrPorpzUBX2oFFXGnY", system_id: "i5w5MuNik5NtLcYmNzcvaoixooEebB6MGV", @@ -287,16 +268,30 @@ export const coinsList = { compatible_channels: [VERUSID, VRPC], tags: [IS_VERUS, IS_ZCASH, IS_PBAAS], proto: "vrsc", - vrpc_endpoints: ["https://api.verus.services"], decimals: 8, - seconds_per_block: 60, default_app: "wallet", - apps: VERUS_APPS, - website: 'https://verus.io' + apps: VERUS_APPS + }, + ["i9kVWKU2VwARALpbXn4RS9zvrhvNRaUibb"]: { + pbaas_options: 41, + id: "i9kVWKU2VwARALpbXn4RS9zvrhvNRaUibb", + currency_id: "i9kVWKU2VwARALpbXn4RS9zvrhvNRaUibb", + system_id: "i5w5MuNik5NtLcYmNzcvaoixooEebB6MGV", + launch_system_id: "i5w5MuNik5NtLcYmNzcvaoixooEebB6MGV", + bitgojs_network_key: "verus", + display_ticker: "Kaiju", + display_name: "Kaiju", + alt_names: [], + theme_color: "#030a17", + compatible_channels: [VERUSID, VRPC], + tags: [IS_VERUS, IS_ZCASH, IS_PBAAS], + proto: "vrsc", + decimals: 8, + default_app: "wallet", + apps: VERUS_APPS }, ["i4Xr5TAMrDTD99H69EemhjDxJ4ktNskUtc"]: { pbaas_options: 33, - system_options: 264, id: "i4Xr5TAMrDTD99H69EemhjDxJ4ktNskUtc", currency_id: "i4Xr5TAMrDTD99H69EemhjDxJ4ktNskUtc", system_id: "i5w5MuNik5NtLcYmNzcvaoixooEebB6MGV", @@ -309,12 +304,9 @@ export const coinsList = { compatible_channels: [VERUSID, VRPC], tags: [IS_VERUS, IS_ZCASH, IS_PBAAS], proto: "vrsc", - vrpc_endpoints: ["https://api.verus.services"], decimals: 8, - seconds_per_block: 60, default_app: "wallet", - apps: VERUS_APPS, - website: 'https://verus.io' + apps: VERUS_APPS }, ["iExBJfZYK7KREDpuhj6PzZBzqMAKaFg7d2"]: { pbaas_options: 268, @@ -340,7 +332,6 @@ export const coinsList = { }, ["iD5WRg7jdQM1uuoVHsBCAEKfJCKGs1U3TB"]: { pbaas_options: 545, - system_options: 268, id: "iD5WRg7jdQM1uuoVHsBCAEKfJCKGs1U3TB", currency_id: "iD5WRg7jdQM1uuoVHsBCAEKfJCKGs1U3TB", system_id: "iExBJfZYK7KREDpuhj6PzZBzqMAKaFg7d2", @@ -353,9 +344,7 @@ export const coinsList = { compatible_channels: [VERUSID, VRPC], tags: [IS_VERUS, IS_ZCASH, IS_PBAAS], proto: "vrsc", - vrpc_endpoints: ["https://vapi.piratechain.com/"], decimals: 8, - seconds_per_block: 60, default_app: "wallet", apps: VERUS_APPS, website: 'https://piratechain.com/' diff --git a/src/utils/api/channels/erc20/requests/preflight.js b/src/utils/api/channels/erc20/requests/preflight.js index ef55651a..b3578a59 100644 --- a/src/utils/api/channels/erc20/requests/preflight.js +++ b/src/utils/api/channels/erc20/requests/preflight.js @@ -1,6 +1,6 @@ import { ethers } from "ethers" import { getWeb3ProviderForNetwork } from '../../../../web3/provider' -import { ERC20, ETH, VRPC } from "../../../../constants/intervalConstants" +import { ERC20, ETH } from "../../../../constants/intervalConstants" import { coinsToSats, coinsToUnits, satsToCoins, scientificToDecimal } from "../../../../math" import { DAI_VETH, @@ -22,7 +22,8 @@ import { MINIMUM_IMPORT_FEE_WEI, GAS_PRICE_MODIFIER, DAI_CONTRACT_ADDRESS, - DAI_BRIDGE_TRANSFER_GAS_LIMIT + DAI_BRIDGE_TRANSFER_GAS_LIMIT, + TRANSFER_SKIP_CALLSTATIC_TOKENS } from '../../../../constants/web3Constants'; import { getCurrency, getIdentity } from "../../verusid/callCreators" import { getSystemNameFromSystemId } from "../../../../CoinData/CoinData" @@ -43,8 +44,6 @@ import { } from 'verus-typescript-primitives'; import BigNumber from "bignumber.js" -import { requestPrivKey } from "../../../../auth/authBox"; -import { BufferWriter } from "@bitgo/utxo-lib/dist/src/bufferutils"; import { BN } from "bn.js"; import { getStandardEthBalance } from "../../eth/callCreator"; import { ECPair, networks } from "@bitgo/utxo-lib"; @@ -70,11 +69,14 @@ export const txPreflight = async (coinObj, activeUser, address, amount, params) const gasLimModifier = ethers.BigNumber.from("3") const gasEst = await contract.estimateGas.transfer(address, amountBn) const gasLimit = gasEst.add(gasEst.div(gasLimModifier)) - const transaction = await contract.callStatic.transfer( - address, - amountBn, - { gasLimit: gasLimit.toNumber(), gasPrice } - ); + + if (!(TRANSFER_SKIP_CALLSTATIC_TOKENS.some(x => (x.toLowerCase() === coinObj.currency_id.toLowerCase())))) { + const transaction = await contract.callStatic.transfer( + address, + amountBn, + { gasLimit: gasLimit.toNumber(), gasPrice } + ); + } const maxFee = gasLimit.mul(gasPrice) diff --git a/src/utils/api/channels/general/addressBlocklist/getAddressBlocklist.js b/src/utils/api/channels/general/addressBlocklist/getAddressBlocklist.js index d65e9a4d..fbf8360b 100644 --- a/src/utils/api/channels/general/addressBlocklist/getAddressBlocklist.js +++ b/src/utils/api/channels/general/addressBlocklist/getAddressBlocklist.js @@ -3,7 +3,8 @@ import { isJson } from '../../../../objectManip' import axios from 'axios' export const getAddressBlocklistFromServer = async (source) => { - const server = source == null || source.length === 0 ? DEFAULT_ADDRESS_BLOCKLIST_WEBSERVER : source; + //const server = source == null || source.length === 0 ? DEFAULT_ADDRESS_BLOCKLIST_WEBSERVER : source; + const server = DEFAULT_ADDRESS_BLOCKLIST_WEBSERVER; const res = await axios.get(server); diff --git a/src/utils/constants/web3Constants.js b/src/utils/constants/web3Constants.js index 056b0b88..156abd67 100644 --- a/src/utils/constants/web3Constants.js +++ b/src/utils/constants/web3Constants.js @@ -33,4 +33,6 @@ export const GAS_TRANSACTION_IMPORT_FEE = "1400000" export const INITIAL_GAS_LIMIT = 6000000 export const FALLBACK_GAS_BRIDGE_TRANSFER = 1000000 export const ERC20_BRIDGE_TRANSFER_GAS_LIMIT = 750000 -export const DAI_BRIDGE_TRANSFER_GAS_LIMIT = 900000 \ No newline at end of file +export const DAI_BRIDGE_TRANSFER_GAS_LIMIT = 900000 + +export const TRANSFER_SKIP_CALLSTATIC_TOKENS = ['0xdac17f958d2ee523a2206206994597c13d831ec7'] \ No newline at end of file diff --git a/src/utils/vrpc/vrpcInterface.js b/src/utils/vrpc/vrpcInterface.js index 6093eb29..85e115ee 100644 --- a/src/utils/vrpc/vrpcInterface.js +++ b/src/utils/vrpc/vrpcInterface.js @@ -11,6 +11,7 @@ import { getCachedVrpcResponse, getVrpcResponseCacheKey, setCachedVrpcResponse } import { ApiRequest } from 'verus-typescript-primitives'; import { coinsList } from '../CoinData/CoinsList'; import { Alert } from 'react-native'; +import { CoinDirectory } from '../CoinData/CoinDirectory'; class CachedVerusdRpcInterface extends VerusdRpcInterface { static CACHED_REQUESTS = [ @@ -305,8 +306,8 @@ class VrpcInterface { } addDefaultEndpoints = () => { - this.initEndpoint(coinsList.VRSC.system_id, coinsList.VRSC.vrpc_endpoints[0]); - this.initEndpoint(coinsList.VRSCTEST.system_id, coinsList.VRSCTEST.vrpc_endpoints[0]); + this.initEndpoint(coinsList.VRSC.system_id, CoinDirectory.getVrpcEndpoints("VRSC")[0]); + this.initEndpoint(coinsList.VRSCTEST.system_id, CoinDirectory.getVrpcEndpoints("VRSCTEST")[0]); } } diff --git a/yarn.lock b/yarn.lock index 16b1187b..8198d362 100644 --- a/yarn.lock +++ b/yarn.lock @@ -960,9 +960,9 @@ "@bitgo/blake2b-wasm" "^3.0.1" nanoassert "^2.0.0" -"@bitgo/utxo-lib@git+https://github.com/VerusCoin/BitGoJS.git#7c754d4a5920198d9fe6827d3e23bd5cf431f264": +"@bitgo/utxo-lib@git+https://github.com/VerusCoin/BitGoJS.git#utxo-lib-verus": version "1.9.6" - resolved "git+https://github.com/VerusCoin/BitGoJS.git#7c754d4a5920198d9fe6827d3e23bd5cf431f264" + resolved "git+https://github.com/VerusCoin/BitGoJS.git#ec65bc22093848378aafd024f41a4ac92f029552" dependencies: "@bitgo/blake2b" "3.0.1" bech32 "0.0.3" @@ -981,14 +981,15 @@ safe-buffer "5.0.1" typeforce "1.11.3" varuint-bitcoin "1.0.4" - verus-typescript-primitives "https://github.com/VerusCoin/verus-typescript-primitives.git" + verus-typescript-primitives "git+https://github.com/VerusCoin/verus-typescript-primitives.git" wif "2.0.1" optionalDependencies: secp256k1 "3.5.2" -"@bitgo/utxo-lib@https://github.com/VerusCoin/BitGoJS.git#f8723bcc2bf4052de171ca8654de23fc06a03337": +"@bitgo/utxo-lib@https://github.com/VerusCoin/BitGoJS.git#ec65bc22093848378aafd024f41a4ac92f029552": version "1.9.6" - resolved "https://github.com/VerusCoin/BitGoJS.git#f8723bcc2bf4052de171ca8654de23fc06a03337" + uid ec65bc22093848378aafd024f41a4ac92f029552 + resolved "https://github.com/VerusCoin/BitGoJS.git#ec65bc22093848378aafd024f41a4ac92f029552" dependencies: "@bitgo/blake2b" "3.0.1" bech32 "0.0.3" @@ -1007,6 +1008,7 @@ safe-buffer "5.0.1" typeforce "1.11.3" varuint-bitcoin "1.0.4" + verus-typescript-primitives "git+https://github.com/VerusCoin/verus-typescript-primitives.git" wif "2.0.1" optionalDependencies: secp256k1 "3.5.2" @@ -11569,9 +11571,10 @@ version_compare@0.0.3: "verus-typescript-primitives@https://github.com/VerusCoin/verus-typescript-primitives.git": version "1.0.0" - resolved "https://github.com/VerusCoin/verus-typescript-primitives.git#ca735cf46b0dd4ad4a6d4b37ab451bd2f5af4c3e" + resolved "https://github.com/VerusCoin/verus-typescript-primitives.git#75d08c9763e9439569b509dbf24c3845a693d92d" dependencies: base64url "3.0.1" + bech32 "2.0.0" bn.js "5.2.1" bs58check "https://github.com/bitcoinjs/bs58check" create-hash "1.2.0" @@ -11586,23 +11589,24 @@ version_compare@0.0.3: "verusd-rpc-ts-client@git+https://github.com/VerusCoin/verusd-rpc-ts-client.git": version "0.1.0" - resolved "git+https://github.com/VerusCoin/verusd-rpc-ts-client.git#c12448144559b8ffecf58630346a97cdb5356dde" + uid d758a068e439df995b2ade9ab4947bda23f811e4 + resolved "git+https://github.com/VerusCoin/verusd-rpc-ts-client.git#d758a068e439df995b2ade9ab4947bda23f811e4" dependencies: axios "1.6.5" verus-typescript-primitives "https://github.com/VerusCoin/verus-typescript-primitives.git" "verusd-rpc-ts-client@https://github.com/VerusCoin/verusd-rpc-ts-client.git": version "0.1.0" - resolved "https://github.com/VerusCoin/verusd-rpc-ts-client.git#c12448144559b8ffecf58630346a97cdb5356dde" + resolved "https://github.com/VerusCoin/verusd-rpc-ts-client.git#d758a068e439df995b2ade9ab4947bda23f811e4" dependencies: axios "1.6.5" verus-typescript-primitives "https://github.com/VerusCoin/verus-typescript-primitives.git" "verusid-ts-client@git+https://github.com/VerusCoin/verusid-ts-client.git": version "0.1.0" - resolved "git+https://github.com/VerusCoin/verusid-ts-client.git#e1a707744c9e090f1341917e2d84312f3477c4bc" + resolved "git+https://github.com/VerusCoin/verusid-ts-client.git#b3dd814e293a1384f10bc0431615a44dc29b932d" dependencies: - "@bitgo/utxo-lib" "https://github.com/VerusCoin/BitGoJS.git#f8723bcc2bf4052de171ca8654de23fc06a03337" + "@bitgo/utxo-lib" "https://github.com/VerusCoin/BitGoJS.git#ec65bc22093848378aafd024f41a4ac92f029552" axios "1.6.5" bignumber.js "9.1.0" verus-typescript-primitives "https://github.com/VerusCoin/verus-typescript-primitives.git"