-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I can't connect wallet on chrome/safari mobile phones(IOS/Android) #3090
Comments
Hello!
Device: iphone 13 |
Hello, @Temitope3665.
If it is possible maybe share the link to your project. |
export const connectWallet = async ({ if ((IS_MOBILE || isSafariBrowser()) && !IN_FRAME) {
} |
`export const connectWallet = async ({ if ((IS_MOBILE || isSafariBrowser()) && !IN_FRAME) {
} |
I think the problem might be in the sdk version. Version |
What fix would you suggest? |
The potential fixes are listed in the |
Alright, I will check out the release description. |
Hi, @Temitope3665. Were you able to resolve your issue? |
No. It has not been resolved yet |
Hi, @Temitope3665. I have few more clarification questions:
|
Yes, it's connecting successfully, and here is the deep link it's generating below Attached below is the response during the connection. But the issue here is that, whenever we want to make a transaction or initiate an activity with the wallet, it keeps saying, wallet not connected. Here is a sample of how the error |
In order to sign/send transaction on mobile, you are to create a new deeplink with the transaction details as such. |
Alright. I will check the thread. |
Could you help with how best to go about it especially when interacting with contract? |
This is a small example. const createDeepLinkUrl = ({ type, callbackUrl, ...params }) => {
const url = new URL(`https;//wallet.superhero.com/${type}`);
if (callbackUrl) {
url.searchParams.set('x-success', callbackUrl);
url.searchParams.set('x-cancel', callbackUrl);
}
Object.entries(params)
.filter(([, value]) => ![undefined, null].includes(value))
.forEach(([name, value]) => url.searchParams.set(name, value));
return url;
};
const contract = await aeSdk.initializeContract(
{
aci,
address,
},
);
const result = await contract[method](
...methodArgs,
{
callStatic: true,
// Instead of `onAccount` property you can use `replace-caller` flag in the deep link
onAccount: createOnAccountObject(address),
},
);
const encodedTx = result.rawTx;
const currentUrl = new URL(window.location.href);
// reset url
currentUrl.searchParams.delete('transaction');
currentUrl.searchParams.delete('transaction-status');
// append transaction parameter for success case
const successUrl = new URL(currentUrl.href);
successUrl.searchParams.set('transaction', '{transaction}');
// append transaction parameter for failed case
const cancelUrl = new URL(currentUrl.href);
cancelUrl.searchParams.set('transaction-status', 'cancelled');
return createDeepLinkUrl({
type: 'sign-transaction',
transaction: encodedTx,
networkId,
// decode these urls because they will be encoded again
'x-success': decodeURI(successUrl.href),
'x-cancel': decodeURI(cancelUrl.href),
}); |
Here's the deep link scheme we use. |
Thank you Cedrink. I was able to do it just like you suggested. Here is the code below. But I keep getting an error relating to pubkey in my console. Could you help me if I'm doing anything wrong or requires an update?
if (callbackUrl) { Object.entries(params) return url; const generateKey: any = () => { const node = new Node('https://testnet.aeternity.io'); // ideally host your own node const aeSdk: any = new AeSdk({ const createDeepLinkUrl2 = async ({ type, callbackUrl, ...params }: any) => { Object.entries(params) const createOnAccountObject = () => { export const contractInterract = async (payload: any) => { const result = await contract['createProposal']( const encodedTx = result.rawTx; const currentUrl = new URL(window.location.href); // append transaction parameter for success case // append transaction parameter for failed case return createDeepLinkUrl2({ |
This is the example of |
Awesome!.
|
You should also set flag |
Yeah. That solves the problem. |
You can store user's address in |
Yes. That's perfect. |
I think that's problem solved, now that we have a deeplink scheme and an actual example of creating a such in JS. Feel free to open the issue back up if there are any unresolved issues or additional questions. |
@CedrikNikita I want to switch the network from our app, although it's switched successfully on our app but, it does not switch on super hero wallet. |
Hi. This is not possible currently. If the user is connected to other dapps in case wallet will change the network for one of them it will change the network for each. It can be frustrated to the users. |
Alright. Thank you. |
Describe the bug
I can connect the wallet to my project on my web but after mobile responsiveness was updated on the project, I could not connect the wallet on mobile phones.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I should be able to connect to my wallet on my smartphones exactly how it worked well on the web.
Screenshots
Attached screenshot
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: