Skip to content

Commit

Permalink
fix some missing optional chaining and an incorrect optional type
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahSaso committed Oct 9, 2024
1 parent df0d5aa commit 876940d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/types/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export interface ChainWalletContext {
// from wallet client
qrUrl: Mutable<string> | undefined;
appUrl: Mutable<AppUrl> | undefined;
defaultSignOptions: SignOptions;
defaultSignOptions: SignOptions | undefined;

setDefaultSignOptions: (options: SignOptions) => void;
enable: () => Promise<void>;
Expand Down
22 changes: 11 additions & 11 deletions packages/react-lite/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,69 +119,69 @@ export function getChainWalletContext(
...params: Parameters<ChainWalletContext['setDefaultSignOptions']>
) =>
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<ChainWalletContext['suggestToken']>) =>
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<ChainWalletContext['signAmino']>) =>
clientMethodAssert(
wallet?.client?.signAmino.bind(wallet.client),
wallet?.client?.signAmino?.bind(wallet.client),
[chainId, ...params],
'signAmino'
),
signDirect: (...params: Parameters<ChainWalletContext['signDirect']>) =>
clientMethodAssert(
wallet?.client?.signDirect.bind(wallet.client),
wallet?.client?.signDirect?.bind(wallet.client),
[chainId, ...params],
'signDirect'
),
signArbitrary: (
...params: Parameters<ChainWalletContext['signArbitrary']>
) =>
clientMethodAssert(
wallet?.client?.signArbitrary.bind(wallet.client),
wallet?.client?.signArbitrary?.bind(wallet.client),
[chainId, ...params],
'signArbitrary'
),
sendTx: (...params: Parameters<ChainWalletContext['sendTx']>) =>
clientMethodAssert(
wallet?.client?.sendTx.bind(wallet.client),
wallet?.client?.sendTx?.bind(wallet.client),
[chainId, ...params],
'sendTx'
),
Expand Down

0 comments on commit 876940d

Please sign in to comment.