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

Feat/nft checkout plugin #2018

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Feat/nft checkout plugin #2018

wants to merge 8 commits into from

Conversation

tanguyenvn
Copy link
Contributor

@tanguyenvn tanguyenvn commented Nov 21, 2024

Motivation and Context

Jira Link: https://toruslabs.atlassian.net/browse/PD-3995

Description

  • The plugin package can be used in conjunction with the Web3Auth SDK.
  • The embed package can be used as a standalone solution.

How has this been tested?

Screenshots (if appropriate):

  • demo app: config
image - demo app: logged in image - demo app: show NFT free mint image image image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project. (run lint)
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My code requires a db migration.

@@ -27,6 +27,7 @@ export type PluginNamespace = (typeof PLUGIN_NAMESPACES)[keyof typeof PLUGIN_NAM

export const EVM_PLUGINS = {
WALLET_SERVICES: "wallet-services",
NFT_CHECKOUT: "nft-checkout",
Copy link
Contributor

Choose a reason for hiding this comment

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

is nft checkout limited to evm?

Copy link
Contributor

Choose a reason for hiding this comment

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

What about wallet services?

@@ -398,13 +398,13 @@ export class Web3AuthNoModal extends SafeEventEmitter<Web3AuthNoModalEvents> imp
private connectToPlugins(data: { adapter: WALLET_ADAPTER_TYPE }) {
Object.values(this.plugins).map(async (plugin) => {
try {
if (!plugin.SUPPORTED_ADAPTERS.includes(data.adapter)) {
if (!plugin.SUPPORTED_ADAPTERS.includes("all") && !plugin.SUPPORTED_ADAPTERS.includes(data.adapter)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it may be better to list out all possible adapters instead of a separate value called "all". We can put it in a constant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we have dynamic adapters (e.g. injected wallet extensions like Metamask...), so cannot list them out.

return;
}
if (plugin.status === PLUGIN_STATUS.CONNECTED) return;
const { authInstance } = this.walletAdapters[this.connectedAdapterName] as AuthAdapter;
const { options, sessionId, sessionNamespace } = authInstance || {};
await plugin.initWithWeb3Auth(this, options.whiteLabel);
await plugin.initWithWeb3Auth(this, options?.whiteLabel);
await plugin.connect({ sessionId, sessionNamespace });
Copy link
Contributor

Choose a reason for hiding this comment

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

considering that nft checkout plugin connect function takes no arguments should we update IPlugin interface to make it optional?

@BboyStatix BboyStatix self-requested a review November 21, 2024 11:01
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