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

fix: undefined tokenId #738

Conversation

Ansonhkg
Copy link
Collaborator

WHAT

When calling the contractClient.pkpNftContractUtils.read.getTokensInfoByAddress function, tokenId is returning undefined. This little fix added a check to ensure addrs.tokenId is assigned a value if it’s missing. If the derivedAddresses function doesn’t return a tokenId, the tokenId from the context (tokenId) is used as a fallback.

@@ -1903,10 +1903,14 @@ https://developer.litprotocol.com/v3/sdk/wallets/auth-methods/#auth-method-scope
for (let i = 0; i < tokenIds.length; i++) {
const tokenId = tokenIds[i];
const pubKey = await this.pkpNftContract.read.getPubkey(tokenId);
const addrs = await derivedAddresses({
const addrs: TokenInfo = await derivedAddresses({
Copy link
Contributor

@FedericoAmura FedericoAmura Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should make the tokenId optional in TokenInfo to keep Typescript consistency. This way we can also remove the any in derivedAddresses return type TokenInfo | any

@Ansonhkg Ansonhkg merged commit a76688b into master Dec 23, 2024
5 checks passed
@Ansonhkg Ansonhkg deleted the feature/drel-378-tg-osmosis-team-facing-issues-with-sdk-utility-method branch December 23, 2024 22:00
@Ansonhkg Ansonhkg mentioned this pull request Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants