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

getMetadataByTokenAndWallet always returns empty #128

Open
3 tasks done
wiredmatt opened this issue May 12, 2024 · 0 comments
Open
3 tasks done

getMetadataByTokenAndWallet always returns empty #128

wiredmatt opened this issue May 12, 2024 · 0 comments

Comments

@wiredmatt
Copy link

โœ… 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

Using the SDK's getMetadataByTokenAndWallet will always return an empty array of wallets. The API request through a plain curl call works as expected though.

magic.token.validate(token); // returns void if valid, throws if not
req.magicUser = await magic.users.getMetadataByTokenAndWallet(
  token,
  "SUI" as any // use whatever here, wallets response will always be empty.
);

What the SDK returns:
image

What the API returns:

curl --request GET \
  --url 'https://api.magic.link/v1/admin/auth/user/get?issuer=did%3Aethr%3A0x2B05D3f84BeEE532A0FD92B07586EfB141C78d6B&wallet_type=SUI' \
  --header 'X-Magic-Secret-key: sk_live_changeme'

image

{
  "data": {
    "email": "some@gmail.com",
    "issuer": "did:ethr:0x2B05D3f84BeEE532A0FD92B07586EfB141C78d6B",
    "oauth_provider": null,
    "phone_number": null,
    "public_address": "0x2B05D3f84BeEE532A0FD92B07586EfB141C78d6B",
    "wallets": [
      {
        "network": "MAINNET",
        "public_address": "0xa5d2e18eec61c5a2224e5512ca1cb5ba16c0749d1cfe3fc6c52264b887bfaf76",
        "wallet_type": "SUI"
      }
    ]
  },
  "error_code": "",
  "message": "",
  "status": "ok"
}

[Description of the bug.]

๐Ÿงฉ Steps to Reproduce

  1. run magic.users.getMetadataByTokenAndWallet in a nodejs application.

๐Ÿค” Expected behavior

It should return what the HTTP API does.

๐Ÿ˜ฎ Actual behavior

It didn't return what the HTTP API does.

๐Ÿ’ป Code Sample

magic.token.validate(token); // returns void if valid, throws if not
req.magicUser = await magic.users.getMetadataByTokenAndWallet(
  token,
  "SUI" as any // use whatever here, wallets response will always be empty.
);

๐ŸŒŽ Environment

Software Version(s)
@magic-sdk/admin
Node
yarn
Operating System
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant