Skip to content
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

Issues connecting with snap #2037

Open
nikita-fuchs opened this issue Jan 7, 2025 · 4 comments
Open

Issues connecting with snap #2037

nikita-fuchs opened this issue Jan 7, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@nikita-fuchs
Copy link
Contributor

Before holidays, the snap integration demo used to fully work for me: https://docs.aeternity.com/aepp-sdk-js/v14.0.0/examples/browser/aepp/#

Now I get this when clicking 'basic functionality' :


Balance
Error: Address not available
Height
1063523
Node info
{
  "name": "testnet",
  "url": "https://testnet.aeternity.io",
  "nodeNetworkId": "ae_uat",
  "version": "7.1.0",
  "consensusProtocolVersion": 6
}
Compiler version
8.0.0

and as status when I click the 'Install Snap' button:

Status
{
  "blocked": false,
  "enabled": true,
  "id": "npm:@aeternity-snap/plugin",
  "initialPermissions": {
    "endowment:network-access": {},
    "endowment:rpc": {
      "dapps": true,
      "snaps": false
    },
    "snap_dialog": {},
    "snap_getBip32Entropy": [
      {
        "curve": "ed25519",
        "path": [
          "m",
          "44'",
          "457'"
        ]
      }
    ],
    "snap_manageState": {}
  },
  "version": "0.0.9"
}
´´´

It feels like it's missing some sort of permissions now ? Can you reproduce ? 
@nikita-fuchs nikita-fuchs added the bug Something isn't working label Jan 7, 2025
@nikita-fuchs
Copy link
Contributor Author

nikita-fuchs commented Jan 7, 2025

Here is a tiny repro - I tried using the ethereum connector to connect the page to metamask first, but no result, could be an issue inside stackblitz though, I don't know: https://stackblitz.com/edit/stackblitz-starters-wzjs8jwy?file=src%2Fapp%2Fapp.component.ts,src%2Findex.html (check app.component.ts )

@davidyuk
Copy link
Member

The error you have in stackblitz is "UnsupportedPlatformError: Aeternity snap is not installed to MetaMask".
You missed calling await accountFactory.installSnap(); before await accountFactory.initialize(0). I've added this and it looks to be working:

Screenshot 2025-01-15 at 21 57 02

The aepp example still works for me, but it requires extra interactions for debugging purposes. Don't you forget to press "Add account" before switching to "Basic functionality"?

Screenshot 2025-01-15 at 21 53 47

@nikita-fuchs
Copy link
Contributor Author

Hey, adding that one line indeed seems to help - but the function naming seems to be misleading then ? installSnap() sounds like it would literally ask me to install the snap or whatever, which is already present in my metamask. what is installSnap exactly doing then ?

Same goes for 'add account' - I get the idea now, it requests permission from metamask to interact with the account i added there.

@davidyuk
Copy link
Member

what is installSnap exactly doing then?

If Snap is not installed, it will ask you to install it; otherwise, it will just return its version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants