Skip to content

Commit

Permalink
more deprecation updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredcosulich committed Sep 10, 2023
1 parent e1f7fcc commit 1f52c75
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ethos-connect",
"version": "0.0.190",
"version": "0.0.192",
"description": "Build on Sui with ease with the Ethos Wallet APIs. Connect with all wallets and users with no wallet.",
"main": "dist/index.cjs",
"typings": "dist/index.d.ts",
Expand Down
17 changes: 12 additions & 5 deletions src/hooks/useWalletKit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Preapproval } from 'types/Preapproval';
import { Chain } from 'enums/Chain';
import { SuiClient, SuiTransactionBlockResponse } from '@mysten/sui.js/client';
import { EthosExecuteTransactionBlockInput } from 'types/EthosExecuteTransactionBlockInput';
import { SuiSignPersonalMessageOutput, SuiSignTransactionBlockOutput } from '@mysten/wallet-standard';
import { SuiSignPersonalMessageOutput, SuiSignTransactionBlockOutput, SuiSignMessageInput } from '@mysten/wallet-standard';

export interface UseWalletKitArgs {
defaultChain: Chain
Expand Down Expand Up @@ -92,9 +92,16 @@ const useWalletKit = ({ defaultChain, client, preferredWallets, storageAdapter,
new TextEncoder().encode(input.message) :
input.message;

const signFunction = currentWallet.features['sui:signPersonalMessage']?.signPersonalMessage ??
currentWallet.features['sui:signMessage']?.signMessage

const legacySignMessage = async (input: SuiSignMessageInput) => {
const response = await currentWallet.features['sui:signMessage']?.signMessage(input)
return {
...response,
bytes: response?.messageBytes
}
}

const signFunction = currentWallet.features['sui:signPersonalMessage']?.signPersonalMessage ?? legacySignMessage

return signFunction({
...input,
message,
Expand Down Expand Up @@ -130,7 +137,7 @@ const useWalletKit = ({ defaultChain, client, preferredWallets, storageAdapter,
return {
type: SignerType.Extension,
name: currentWallet.name,
icon: currentWallet.name === 'Sui Wallet' ? 'https://sui.io/favicon.png' : currentWallet.icon,
icon: currentWallet.icon,
getAddress: async () => currentAccount?.address,
accounts,
currentAccount,
Expand Down

0 comments on commit 1f52c75

Please sign in to comment.