0

I was trying to make a flutter app where I could have authentication done using Magic and then use it with Solana as my blockchain however the issue that I have been facing is the public address that I get from the magic-sdk flutter package is always ethereum one and not Solana one.

final _magic = Magic.instance;
final metadata = await _magic.user.getMetadata();
final publicAddress = metadata.publicAddress;

I even made a custom Magic class and gave the solana rpc url during instantiation.

Magic.instance = Magic.custom(
  MY_API_KEY,
  rpcUrl: "https://api.testnet.solana.com",
  chainId: 1,
);

Still no success. So any help will over this will be highly appreciated!.

1 Answers1

0

You need to specify the extension. This is in JS, but I believe similar logic applies to flutter:

import { Magic } from 'magic-sdk';
import { SolanaExtension } from '@magic-ext/solana';

const magic = new Magic('YOUR_API_KEY', {
  extensions: [
    new SolanaExtension({
      rpcUrl: 'SOLANA_RPC_NODE_URL',
    }),
  ],
});

NOTE: The didToken will always adhere to the Ethereum method, but now the public key will be a Solana public key.

Kyano
  • 174
  • 1
  • 8
  • Well, just got a reply from the Magic team that Solana isn't supported with flutter at the very moment – Samay Gandhi Jul 08 '22 at 09:20
  • Oh damn that's annoying. There's a lot missing in their sdk to be honest, I find myself getting frustrated quite often. – Kyano Jul 08 '22 at 10:45