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

Issue with Cusotom Namespaces #1052

Closed
Envoy-VC opened this issue Jan 7, 2025 · 2 comments
Closed

Issue with Cusotom Namespaces #1052

Envoy-VC opened this issue Jan 7, 2025 · 2 comments

Comments

@Envoy-VC
Copy link

Envoy-VC commented Jan 7, 2025

I am having issues with custom namespaces. When a user create account with a custom namespace, the GraphQL API returns the username as null. This is not the case when i omit the namespace argument, which defaults to the lens/ namespace.

Are namespaces blocked for the testnet?

here is my code for creating namespaces

const metadata = username({
      description: 'Username Namespace for SproutsVille',
      collection: {
        name: 'SproutsVille Usernames',
        description: 'The official sproutsville/ usernames',
      },
    });
const sessionClient = await getSessionClient('builder'); // Get a session client with Builder Authentication
const uri = await uploadObject(metadata); // Upload Metadata

const res =  await createUsernameNamespace(sessionClient, {
      symbol: 'SPROUTS',
      namespace: 'sproutsville',
      metadataUri: uri,
      admins: [address],
    });

and this for creating accounts

const sessionClient = await getSessionClient('onboardingUser');
    const metadata = account({
      name,
    });

const { uri } = await uploadObject(metadata);

const res = await createAccountWithUsername(sessionClient, {
  accountManager: [evmAddress(address)],
  username: {
    namespace: evmAddress(Constants.SPROUTSVILLE_NAMESPACE_ADDRESS),
    localName,
  },
  metadataUri: uri,
});

here are some already deployed namespaces

const SPROUTSVILLE_NAMESPACE_ADDRESS =
  '0x05431a755a5f45ca4fce8a0585f2139c40db4cf7';
@cesarenaldi
Copy link
Member

cesarenaldi commented Jan 8, 2025

Hey, this is a known behaviour of the Lens API/SDK.

Currently, if your are interrogating the API directly, you should alias the username field including the desired namespace address:

fragment Account on Account {
  username { # defaults to global namespace (i.e., `lens/*`)
    value
  }
  myUsername: username(request: { namespace: "0x05431a755a5f45ca4fce8a0585f2139c40db4cf7" }) {
    value
  }
}

This will also be possible through the SDK but the feature to provide custom fragments is not ready yet.

@Envoy-VC
Copy link
Author

Ok thanks

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

No branches or pull requests

2 participants