magic-admin-js icon indicating copy to clipboard operation
magic-admin-js copied to clipboard

MagicWallet is invalid for solana chain

Open AdrianBielecAriane opened this issue 1 year ago • 0 comments

✅ Prerequisites

  • [✅] Did you perform a cursory search of open issues? Is this bug already reported elsewhere?
  • [✅] Are you running the latest SDK version?
  • [✅] Are you reporting to the correct repository (@magic-sdk/admin)?

🐛 Description

The magic sdk types are incorrect for incoming data by getMetadataByTokenAndWallet with second argument SOLANA

      const { issuer, wallets } = await this.magic.users.getMetadataByTokenAndWallet(token, WalletType.SOLANA);
      const solanaWallet = wallets?.find((w) => w.walletType === 'SOLANA');

This piece of code will always return undefined because an item of wallets array will never receive walletType key, the key we receive is wallet_type.

Now magic handles these types by this interface

export interface MagicWallet {
    network: string | null;
    publicAddress: string | null;
    walletType: string | null;
}

Valid types for solana provider should looks like:

  export interface MagicWallet  {
    wallet_type: string | null;
    public_address: string | null;
    network: string | null;
  }

AdrianBielecAriane avatar Aug 23 '24 13:08 AdrianBielecAriane