From 876940d0c343a02d3ecc6cbb2ddbf90ecabae018 Mon Sep 17 00:00:00 2001 From: Noah Saso Date: Tue, 8 Oct 2024 20:03:09 -0400 Subject: [PATCH] fix some missing optional chaining and an incorrect optional type --- packages/core/src/types/hook.ts | 2 +- packages/react-lite/src/utils.ts | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/core/src/types/hook.ts b/packages/core/src/types/hook.ts index 490b51250..ebcacd198 100644 --- a/packages/core/src/types/hook.ts +++ b/packages/core/src/types/hook.ts @@ -103,7 +103,7 @@ export interface ChainWalletContext { // from wallet client qrUrl: Mutable | undefined; appUrl: Mutable | undefined; - defaultSignOptions: SignOptions; + defaultSignOptions: SignOptions | undefined; setDefaultSignOptions: (options: SignOptions) => void; enable: () => Promise; diff --git a/packages/react-lite/src/utils.ts b/packages/react-lite/src/utils.ts index 8f9fc60bf..df774748b 100644 --- a/packages/react-lite/src/utils.ts +++ b/packages/react-lite/src/utils.ts @@ -119,55 +119,55 @@ export function getChainWalletContext( ...params: Parameters ) => clientMethodAssert( - wallet?.client?.setDefaultSignOptions.bind(wallet.client), + wallet?.client?.setDefaultSignOptions?.bind(wallet.client), [...params], 'setDefaultSignOptions' ), enable: () => clientMethodAssert( - wallet?.client?.enable.bind(wallet.client), + wallet?.client?.enable?.bind(wallet.client), [chainId], 'enable' ), suggestToken: (...params: Parameters) => clientMethodAssert( - wallet?.client?.suggestToken.bind(wallet.client), + wallet?.client?.suggestToken?.bind(wallet.client), [...params], 'suggestToken' ), getAccount: () => clientMethodAssert( - wallet?.client?.getAccount.bind(wallet.client), + wallet?.client?.getAccount?.bind(wallet.client), [chainId], 'getAccount' ), getOfflineSigner: () => clientMethodAssert( - wallet?.client?.getOfflineSigner.bind(wallet.client), + wallet?.client?.getOfflineSigner?.bind(wallet.client), [chainId, wallet?.preferredSignType], 'getOfflineSigner' ), getOfflineSignerAmino: () => clientMethodAssert( - wallet?.client?.getOfflineSignerAmino.bind(wallet.client), + wallet?.client?.getOfflineSignerAmino?.bind(wallet.client), [chainId], 'getOfflineSignerAmino' ), getOfflineSignerDirect: () => clientMethodAssert( - wallet?.client?.getOfflineSignerDirect.bind(wallet.client), + wallet?.client?.getOfflineSignerDirect?.bind(wallet.client), [chainId], 'getOfflineSignerDirect' ), signAmino: (...params: Parameters) => clientMethodAssert( - wallet?.client?.signAmino.bind(wallet.client), + wallet?.client?.signAmino?.bind(wallet.client), [chainId, ...params], 'signAmino' ), signDirect: (...params: Parameters) => clientMethodAssert( - wallet?.client?.signDirect.bind(wallet.client), + wallet?.client?.signDirect?.bind(wallet.client), [chainId, ...params], 'signDirect' ), @@ -175,13 +175,13 @@ export function getChainWalletContext( ...params: Parameters ) => clientMethodAssert( - wallet?.client?.signArbitrary.bind(wallet.client), + wallet?.client?.signArbitrary?.bind(wallet.client), [chainId, ...params], 'signArbitrary' ), sendTx: (...params: Parameters) => clientMethodAssert( - wallet?.client?.sendTx.bind(wallet.client), + wallet?.client?.sendTx?.bind(wallet.client), [chainId, ...params], 'sendTx' ),