From ced76d960314a8560f9ff368cc0a1ac34d14f08d Mon Sep 17 00:00:00 2001 From: Alec Ananian <1013230+alecananian@users.noreply.github.com> Date: Fri, 24 Jan 2025 14:57:22 -0800 Subject: [PATCH] feat(ecosystems): add flag for skipping default ecosystem info fetch --- .changeset/neat-poems-impress.md | 5 +++++ packages/thirdweb/src/wallets/ecosystem/types.ts | 4 ++++ .../thirdweb/src/wallets/in-app/core/wallet/in-app-core.ts | 6 +++--- packages/thirdweb/src/wallets/in-app/core/wallet/types.ts | 4 ++++ packages/thirdweb/src/wallets/in-app/web/ecosystem.ts | 1 + 5 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 .changeset/neat-poems-impress.md diff --git a/.changeset/neat-poems-impress.md b/.changeset/neat-poems-impress.md new file mode 100644 index 00000000000..aa6081adb73 --- /dev/null +++ b/.changeset/neat-poems-impress.md @@ -0,0 +1,5 @@ +--- +"thirdweb": patch +--- + +Added optional flag to ecosystem wallet creation for skipping fetching of default ecosystem info defined in the dashboard. diff --git a/packages/thirdweb/src/wallets/ecosystem/types.ts b/packages/thirdweb/src/wallets/ecosystem/types.ts index 8072a4d6661..4a6fdb1d185 100644 --- a/packages/thirdweb/src/wallets/ecosystem/types.ts +++ b/packages/thirdweb/src/wallets/ecosystem/types.ts @@ -23,6 +23,10 @@ export type EcosystemWalletCreationOptions = { * The partnerId of the ecosystem wallet to connect to */ partnerId?: string; + /** + * Optional flag to skip fetching and usage of ecosystem's info default account abstraction settings + */ + skipEcosystemInfo?: boolean; }; export type EcosystemWalletConnectionOptions = InAppWalletConnectionOptions; diff --git a/packages/thirdweb/src/wallets/in-app/core/wallet/in-app-core.ts b/packages/thirdweb/src/wallets/in-app/core/wallet/in-app-core.ts index 2a652b5bd71..c06232bbd62 100644 --- a/packages/thirdweb/src/wallets/in-app/core/wallet/in-app-core.ts +++ b/packages/thirdweb/src/wallets/in-app/core/wallet/in-app-core.ts @@ -78,7 +78,7 @@ export function createInAppWallet(args: { ecosystem, ); - if (ecosystem) { + if (ecosystem && !createOptions?.skipEcosystemInfo) { const ecosystemOptions = await getEcosystemInfo(ecosystem.id); const smartAccountOptions = ecosystemOptions?.smartAccountOptions; if (smartAccountOptions) { @@ -132,7 +132,7 @@ export function createInAppWallet(args: { ecosystem, ); - if (ecosystem) { + if (ecosystem && !createOptions?.skipEcosystemInfo) { const ecosystemOptions = await getEcosystemInfo(ecosystem.id); const smartAccountOptions = ecosystemOptions?.smartAccountOptions; if (smartAccountOptions) { @@ -206,7 +206,7 @@ export function createInAppWallet(args: { ecosystem, ); - if (ecosystem) { + if (ecosystem && !createOptions?.skipEcosystemInfo) { const ecosystemOptions = await getEcosystemInfo(ecosystem.id); const smartAccountOptions = ecosystemOptions?.smartAccountOptions; if (smartAccountOptions) { diff --git a/packages/thirdweb/src/wallets/in-app/core/wallet/types.ts b/packages/thirdweb/src/wallets/in-app/core/wallet/types.ts index 7d0a048ad85..3578336d513 100644 --- a/packages/thirdweb/src/wallets/in-app/core/wallet/types.ts +++ b/packages/thirdweb/src/wallets/in-app/core/wallet/types.ts @@ -87,5 +87,9 @@ export type InAppWalletCreationOptions = * Whether to hide the private key export button in the Connect Modal */ hidePrivateKeyExport?: boolean; + /** + * Optional flag to skip fetching and usage of ecosystem's info default account abstraction settings + */ + skipEcosystemInfo?: boolean; } | undefined; diff --git a/packages/thirdweb/src/wallets/in-app/web/ecosystem.ts b/packages/thirdweb/src/wallets/in-app/web/ecosystem.ts index 2f887c5ae3a..cec6fcabc54 100644 --- a/packages/thirdweb/src/wallets/in-app/web/ecosystem.ts +++ b/packages/thirdweb/src/wallets/in-app/web/ecosystem.ts @@ -67,6 +67,7 @@ export function ecosystemWallet( options: [], // controlled by ecosystem }, partnerId: ecosystem.partnerId, + skipEcosystemInfo: createOptions?.skipEcosystemInfo, }, connectorFactory: async (client: ThirdwebClient) => { const { InAppWebConnector } = await import("./lib/web-connector.js");