Deeplink for Metamask on mobile doesn't connect - ethereum

I'm having some connection issues with Metamask on mobile. It's connecting on desktop fine with this:
const _provider = new ethers.providers.Web3Provider(window.ethereum);
store.provider = _provider;
But, when it comes to the mobile, apparently a deep link should be used. I wrote it like the following:
const dappUrl = 'xxx';
const metamaskAppDeepLink = 'https://metamask.app.link/dapp/' + dappUrl;
The problem is that whenever I click on the connect wallet on mobile, it opens first Metamask as expected, but when I click 'connect wallet' in MM, it forwards me to the app store instead of connecting.
I tried to do it with multiple chains (polygon and ethereum) and yet, the result is the same.

Try removing Metamask and re-installing from the App Store again. AFAIK that's the only way.
Remember that your wallets will be gone, so you have to enter the same seed phrase or private keys to retrieve them.

Related

Chrome & Web Serial API. How to get port without asking

I need your help.
Is there a way to take control of a serial port, previously authorized, without using the popup window? (without port = await navigator.serial.requestPort();)
Thank you and sorry for my english, italian speaking here.
I believe JS code below should work fine for you:
// Get all serial ports the user has previously granted the website access to.
const ports = await navigator.serial.getPorts();
Source: https://web.dev/serial/#open-port

Previously working Google Sheets App Script is now throwing the "Failed to establish a database connection" error for MySQL DB

I've been using Google Sheets App Script successfully the past 4 months that is connected to a MySQL 5.7 DB hosted remotely on a VPS (this script connected to my DB successfully earlier today as well). All of a sudden this afternoon my requests are returning "Failed to establish a database connection. Check connection string, username and password." The database connection still works just fine remotely on my computer using MySQL Workbench.
Additional details:
The credentials didn't change (I confirmed with a new connection test)
I have Chrome V8 Runtime disabled since that does not work well at all
I double checked the Google Server IPs to whitelist and noticed 1 server that's either new or I missed the first time, either way all provided IPs are currently whitelisted
I'm connecting using this syntax: var conn = Jdbc.getConnection(url, user, pwd);
I saw some previous comments from a month ago that some people were able to add these parameters successfully: var conn = Jdbc.getConnection(url+'?verifyServerCertificate=false&useSSL=true&requireSSL=true', user, pwd);
However I just get this: Error Invalid argument: _serverSslCertificate
Any further steps or tips to get this connected successfully again is appreciated, thanks!
Austin, you just made my day... Same thing, my MySQL connections stopped working all of a sudden yesterday. Spent hours trying to fix it. The '?useSSL=false' worked like charm.
Thank you, thank you, thank you
I found a solution.
Seems a change on Google now requires you to explicitly set SSL to false. (previously if you let it omitted it would default to off)
?useSSL=false
So you need to update your connection string to something like this simple example.
function myFunction() {
var conn = Jdbc.getConnection("jdbc:mysql://35.214.129.151:3306/dbiyrogncria1r?useSSL=false", "uyxfedtljijfy8", "rnqgnyrs2dthb");
Logger.log(conn);
conn.close();
}
Apparently it's just working again.... must have been a service blip. What's strange is it started working again after I decided to just try var conn = Jdbc.getConnection(url+'?useSSL=false', user, pwd); since I saw some other comments mention that. Seems like an awful solution, but it started working again after I did that, but has continued to work even after I reverted back to just var conn = Jdbc.getConnection(url, user, pwd);
Follow-up questions, are there any good alternatives to Google Sheets with App Script like usage? I'm getting really tired of Google's awful support - would rather pay for a product than to hear "you get what you pay for" with awful support.
EDIT: After this started working again yesterday by itself, the issue came back. I have now confirmed today that switching to var conn = Jdbc.getConnection(url+'?useSSL=false', user, pwd); has solved my connection issue, but that is not an ideal fix by any means at all. Google must be messing with some network settings on the Apps Script side and it's causing issues.

Chromecast - How to reconnect to the session after page refresh?

After reloading the page, method
cast.framework.CastContext.getInstance()
returns status 'NOT_CONNECTED' and 'NO_SESSION'
My code example:
const castContext = window.cast.framework.CastContext.getInstance();
castContext.setOptions({
receiverApplicationId:
window.chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,
autoJoinPolicy: window.chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,
resumeSavedSession: true
});
await castContext.requestSession(); // wait for prompt
const castSession = castContext.getCurrentSession();
const mediaInfo = new window.chrome.cast.media.MediaInfo(mediaUrl);
const request = new window.chrome.cast.media.LoadRequest(mediaInfo);
await castSession.loadMedia(request);
window.player = new window.cast.framework.RemotePlayer();
window.playerController = new window.cast.framework.RemotePlayerController(
window.player);
Can you please tell me how to connect to an existing session and receive information about playing media?
I been looking around for answers for a while and your switch of port make me think.
Switching port not a valid solution!
Why does a solution suddenly stop working without any changes to my Chromecast code?
Answer: Chrome got the hiccups. I guess this is either because of several live-refresh or something went wrong during development and it has been cached?!
Solution: I cleared the application storage and deleted my Chrome profile. After a restart of Chrome my solution reconnects with the chromecast as it did before.

Sender account not recognized on private ethereum network

I'm currently developing a dApp in Solidity and am working on a web3 library to handle communication with it.
I struggle with the process of new account creation and transaction signing in web3. Before I continue it worth noting that I'm running my own local, private blockchain (currently with Ganache).
My code looks as follows:
try{
let a = web3.eth.accounts.create()
let dataTx = someContract.methods.someMethod().encodeABI()
let rawTx = {
to: someContract._address,
from: account.address,
data: dataTx,
gas: 10000000000
}
const transaction = web3.eth.accounts.signTransaction(rawTx, util.toBuffer(account.privateKey))
web3.eth.sendTransaction(rawTx).then(console.log)
}
catch(e){
console.log(e)
}
The problem here is that the web3.eth.sendTransaction() method raises the following exception: Error: Returned error: sender account not recognized.
My understanding is that web3.eth.accounts is used for managing local accounts and web3.eth.personal is used to communicate with a client (e.g. Geth). I wish to keep the private keys of accounts my app creates locally on the device of the web3 client, but it raises this exception.
Where am I going wrong? Should I register the newly created accounts somewhere before running transactions with it? Is there some vital information I'm missing here?
Thanks!
If you want to use an account other than Ganache provided you, you have to start Ganache providing your accounts data in the form private_key,initial_balance:
Example command: ganache-cli --account 0xf38b5679751228eab7d9f3aa02bd0b0c0f7b44e448c0cfd410a1d7053efb6c56,123456789
And it's output:
Ganache CLI v6.1.8 (ganache-core: 2.2.1)
Available Accounts
================== (0) 0x44fa41e453654ccb365a358e994c764a37eea91f (~0 ETH)
Private Keys
================== (0) 0xf38b5679751228eab7d9f3aa02bd0b0c0f7b44e448c0cfd410a1d7053efb6c56
Gas Price
================== 20000000000
Gas Limit
================== 6721975
Listening on 127.0.0.1:8545
I am having same issue in my project. The problem in my case is beacuse i am not using same web3 provider to create contract variable.
example code:
const providerEth= new Web3.providers.HttpProvider(
'HTTP://127.0.0.1:8545'
);
const web3Eth = new Web3(providerEth);
const contract= new web3Eth.eth.Contract(abi,address);
Here, we are not using metamask provider although both on same network Still it not recognize the account. So you should create contract like this
const web3Eth = new Web3(window.web3.currentProvider);
const contract= new web3Eth.eth.Contract(abi,address);
const accounts = await web3.eth.getAccounts();
var receipt=await contract.methods.transfer(receiver,amount).send({from:accounts[0]});
Now, you can able to call smart contract function with account address.
I had the same issue. It happened when I already opened my truffle console and after that I did a restart of my ganache because I wanted to start clean.
What fixed it for me was stopping the truffle console job and starting it again.
You are refering to functionality in web3 1.0.0 which is not yet fully released.
If you go to https://web3js.readthedocs.io/en/1.0/getting-started.html
you would see that they state the following:
This documentation is work in progress and web3.js 1.0 is not yet released! You can find the current documentation for web3 0.x.x at github.com/ethereum/wiki/wiki/JavaScript-API.
Most probably you are using a version 0.20.x or something like that so check this first. To check this open the dApp in the browser and type in the console the following:
web3.version.api
This should show you which version you are using.
I don't think there is a way to create accounts with web3js 0.20.x directly but you can try to update the web3js to the 1.0.0-beta and try to run your code again. You can find it in NPM here - https://www.npmjs.com/package/web3

Restart Revmob Session - If no connection and then got connected

I have an adobe AIR AS3 application for both Android and iOS. I have implemented all the necessary code with the help of revmob's great technical support team. My problem now is if the user originally was not connected to a wifi or cellular network, the session won't start, thus the banner won't show nor the video, which is normal.
The problem is, when the user switches back to connected, the banner won't show, so i'm guessing the session didn't start.
How can i keep trying to start the revmob session, depending on when the user gets connected? in other terms, how can i restart the session as soon as the user gets connected?
You can see how to create a ConnectionChecker class to check for a internet connection in this link . After creating a ConnectionChecker instance, you can call it and call the startSession method when connection is successful.
Following the link, your code will look something like this:
var checker:ConnectionChecker = new ConnectionChecker();
checker.addEventListener(ConnectionChecker.EVENT_SUCCESS, checker_success);
checker.addEventListener(ConnectionChecker.EVENT_ERROR, checker_error);
checker.check();
private function checker_success(event:Event):void {
// There is internet connection, so call startSession
revmob = new RevMob(< YOUR_APP_ID>);
}
private function checker_error(event:Event):void {
// There is no internet connection, do nothing
}
Best regards,