Skip to content

Commit

Permalink
fix: extend user profile to return full social information
Browse files Browse the repository at this point in the history
  • Loading branch information
tfrg committed Jan 21, 2025
1 parent 449866a commit a6e5229
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
4 changes: 0 additions & 4 deletions packages/sdk/src/core/types/config.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,3 @@ export enum SocialType {
TWITTER = 'TWITTER',
EMAIL = 'EMAIL',
}

export interface SocialUserProfile {
email: string;
}
13 changes: 3 additions & 10 deletions packages/sdk/src/providers/gno-wallet/gno-social-wallet.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GnoWallet } from '@gnolang/gno-js-client';
import { CustomChainConfig, WALLET_ADAPTERS } from '@web3auth/base';
import { CustomChainConfig, UserInfo, WALLET_ADAPTERS } from '@web3auth/base';
import { CommonPrivateKeyProvider } from '@web3auth/base-provider';
import { Web3AuthNoModal } from '@web3auth/no-modal';
import { OpenloginAdapter } from '@web3auth/openlogin-adapter';
Expand All @@ -10,7 +10,6 @@ import {
SocialGoogleConfigure,
SocialTwitterConfigure,
SocialType,
SocialUserProfile,
} from '../../core';
import { GNO_ADDRESS_PREFIX } from '../../core/constants/chains.constant';
import { hexToUint8Array } from '../../core/utils/encode.utils';
Expand Down Expand Up @@ -248,17 +247,11 @@ export class GnoSocialWalletProvider extends GnoWalletProvider {
return new GnoSocialWalletProvider(web3auth, socialType, [networkConfig]);
}

public async getEmailAddress(): Promise<SocialUserProfile> {
public async getSocialUserProfile(): Promise<Partial<UserInfo>> {
if (!this.web3auth) {
throw new Error('Not initialized web3 provider.');
}

const userInfo = await this.web3auth.getUserInfo();

if (!userInfo.email) {
throw new Error('Email not found');
}

return { email: userInfo.email };
return await this.web3auth.getUserInfo();
}
}

0 comments on commit a6e5229

Please sign in to comment.