From fcc8612950afb6b690325c368f5f45fea700c0c5 Mon Sep 17 00:00:00 2001 From: Leonidas Conde <80922146+LeonardoDizConde@users.noreply.github.com> Date: Wed, 20 Mar 2024 14:24:51 -0300 Subject: [PATCH] CU-86a23ccez - Fix Svelte Wallet Connect for TurboRepo --- .../main_2024-03-20-16-22.json | 10 ++++++++++ .../wallet-connect-sdk-svelte/src/WcSdkStore.ts | 16 +++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 common/changes/@cityofzion/wallet-connect-sdk-svelte/main_2024-03-20-16-22.json diff --git a/common/changes/@cityofzion/wallet-connect-sdk-svelte/main_2024-03-20-16-22.json b/common/changes/@cityofzion/wallet-connect-sdk-svelte/main_2024-03-20-16-22.json new file mode 100644 index 0000000..100f9ff --- /dev/null +++ b/common/changes/@cityofzion/wallet-connect-sdk-svelte/main_2024-03-20-16-22.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@cityofzion/wallet-connect-sdk-svelte", + "comment": "Hotfix an error during the build process using SvelteKit and TurboRepo.", + "type": "patch" + } + ], + "packageName": "@cityofzion/wallet-connect-sdk-svelte" +} \ No newline at end of file diff --git a/packages/wallet-connect-sdk-svelte/src/WcSdkStore.ts b/packages/wallet-connect-sdk-svelte/src/WcSdkStore.ts index b4cd0cf..5af441c 100644 --- a/packages/wallet-connect-sdk-svelte/src/WcSdkStore.ts +++ b/packages/wallet-connect-sdk-svelte/src/WcSdkStore.ts @@ -229,12 +229,18 @@ export class WCSDKStore implements IWalletConnectStore { } private async setupWcClient(options: SignClientTypes.Options) { - this.sdk = await WcSdk.init(options) - const signClient = this.sdk.signClient - if (this.autoManageSession) { - this.manageSession() + try { + this.sdk = await WcSdk.init(options) + const signClient = this.sdk.signClient + if (this.autoManageSession) { + this.manageSession() + } + this.signClientWritable.set(signClient) + } catch (error) { + if ((error as string) !== 'TypeError: WcSdk.init is not a function') { + console.error(error) + } } - this.signClientWritable.set(signClient) } private get SdkOrError() {