magic-admin-js
magic-admin-js copied to clipboard
getMetadataByTokenAndWallet always returns empty
✅ Prerequisites
- [x] Did you perform a cursory search of open issues? Is this bug already reported elsewhere?
- [x] Are you running the latest SDK version?
- [x] 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:
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'
{
"data": {
"email": "[email protected]",
"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
- run
magic.users.getMetadataByTokenAndWalletin 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 |
@wiredmatt What is the NodeJS SDK version you're on?
Hey Richard! This is very very old and I'm not working on that project any longer. May as well close this issue. We fixed it by making raw http calls to the API.