@mysten/dapp-kit 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/hooks/wallet/useSignPersonalMessage.js +19 -8
- package/dist/cjs/hooks/wallet/useSignPersonalMessage.js.map +2 -2
- package/dist/cjs/index.js +19 -8
- package/dist/cjs/index.js.map +2 -2
- package/dist/esm/hooks/wallet/useSignPersonalMessage.js +19 -8
- package/dist/esm/hooks/wallet/useSignPersonalMessage.js.map +2 -2
- package/dist/esm/index.js +19 -8
- package/dist/esm/index.js.map +2 -2
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/hooks/wallet/useSignPersonalMessage.ts +22 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @mysten/dapp-kit
|
|
2
2
|
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- c5d4db238: Have useSignPersonalMessage fall back to use sui:signMessage
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [652bcdd92]
|
|
12
|
+
- @mysten/sui.js@0.46.1
|
|
13
|
+
- @mysten/wallet-standard@0.8.9
|
|
14
|
+
|
|
3
15
|
## 0.8.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -125,16 +125,27 @@ function useSignPersonalMessage({
|
|
|
125
125
|
"No wallet account is selected to sign the personal message with."
|
|
126
126
|
);
|
|
127
127
|
}
|
|
128
|
-
const
|
|
129
|
-
if (
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
const signPersonalMessageFeature = currentWallet.features["sui:signPersonalMessage"];
|
|
129
|
+
if (signPersonalMessageFeature) {
|
|
130
|
+
return await signPersonalMessageFeature.signPersonalMessage({
|
|
131
|
+
...signPersonalMessageArgs,
|
|
132
|
+
account: signerAccount
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
const signMessageFeature = currentWallet.features["sui:signMessage"];
|
|
136
|
+
if (signMessageFeature) {
|
|
137
|
+
console.warn(
|
|
138
|
+
"This wallet doesn't support the `signPersonalMessage` feature... falling back to `signMessage`."
|
|
132
139
|
);
|
|
140
|
+
const { messageBytes, signature } = await signMessageFeature.signMessage({
|
|
141
|
+
...signPersonalMessageArgs,
|
|
142
|
+
account: signerAccount
|
|
143
|
+
});
|
|
144
|
+
return { bytes: messageBytes, signature };
|
|
133
145
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
});
|
|
146
|
+
throw new WalletFeatureNotSupportedError(
|
|
147
|
+
"This wallet doesn't support the `signPersonalMessage` feature."
|
|
148
|
+
);
|
|
138
149
|
},
|
|
139
150
|
...mutationOptions
|
|
140
151
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/hooks/wallet/useSignPersonalMessage.ts", "../../../../src/errors/walletErrors.ts", "../../../../src/constants/walletMutationKeys.ts", "../../../../src/hooks/wallet/useWalletStore.ts", "../../../../src/contexts/walletContext.ts", "../../../../src/hooks/wallet/useCurrentAccount.ts", "../../../../src/hooks/wallet/useCurrentWallet.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type {\n\tSuiSignPersonalMessageInput,\n\tSuiSignPersonalMessageOutput,\n} from '@mysten/wallet-standard';\nimport type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query';\nimport { useMutation } from '@tanstack/react-query';\n\nimport {\n\tWalletFeatureNotSupportedError,\n\tWalletNoAccountSelectedError,\n\tWalletNotConnectedError,\n} from '../..//errors/walletErrors.js';\nimport { walletMutationKeys } from '../../constants/walletMutationKeys.js';\nimport type { PartialBy } from '../../types/utilityTypes.js';\nimport { useCurrentAccount } from './useCurrentAccount.js';\nimport { useCurrentWallet } from './useCurrentWallet.js';\n\ntype UseSignPersonalMessageArgs = PartialBy<SuiSignPersonalMessageInput, 'account'>;\n\ntype UseSignPersonalMessageResult = SuiSignPersonalMessageOutput;\n\ntype UseSignPersonalMessageError =\n\t| WalletFeatureNotSupportedError\n\t| WalletNoAccountSelectedError\n\t| WalletNotConnectedError\n\t| Error;\n\ntype UseSignPersonalMessageMutationOptions = Omit<\n\tUseMutationOptions<\n\t\tUseSignPersonalMessageResult,\n\t\tUseSignPersonalMessageError,\n\t\tUseSignPersonalMessageArgs,\n\t\tunknown\n\t>,\n\t'mutationFn'\n>;\n\n/**\n * Mutation hook for prompting the user to sign a message.\n */\nexport function useSignPersonalMessage({\n\tmutationKey,\n\t...mutationOptions\n}: UseSignPersonalMessageMutationOptions = {}): UseMutationResult<\n\tUseSignPersonalMessageResult,\n\tUseSignPersonalMessageError,\n\tUseSignPersonalMessageArgs\n> {\n\tconst { currentWallet } = useCurrentWallet();\n\tconst currentAccount = useCurrentAccount();\n\n\treturn useMutation({\n\t\tmutationKey: walletMutationKeys.signPersonalMessage(mutationKey),\n\t\tmutationFn: async (signPersonalMessageArgs) => {\n\t\t\tif (!currentWallet) {\n\t\t\t\tthrow new WalletNotConnectedError('No wallet is connected.');\n\t\t\t}\n\n\t\t\tconst signerAccount = signPersonalMessageArgs.account ?? currentAccount;\n\t\t\tif (!signerAccount) {\n\t\t\t\tthrow new WalletNoAccountSelectedError(\n\t\t\t\t\t'No wallet account is selected to sign the personal message with.',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,yBAA4B;;;ACFrB,IAAM,0BAAN,cAAsC,MAAM;AAAC;AAO7C,IAAM,+BAAN,cAA2C,MAAM;AAAC;AAKlD,IAAM,iCAAN,cAA6C,MAAM;A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AA,QACA;AAAA,QACA,gBAAgB;AAAA,QAChB,cAAc;AAAA,QACd,aAAa;AAAA,MACd;AAAA,IACD;AAAA,EACD;AACD;;;ANIO,SAAS,uBAAuB;AAAA,EACtC;AAAA,EACA,GAAG;AACJ,IAA2C,CAAC,GAI1C;AACD,QAAM,EAAE,cAAc,IAAI,iBAAiB;AAC3C,QAAM,iBAAiB,kBAAkB;AAEzC,aAAO,gCAAY;AAAA,IAClB,aAAa,mBAAmB,oBAAoB,WAAW;AAAA,IAC/D,YAAY,OAAO,4BAA4B;AAC9C,UAAI,CAAC,eAAe;AACnB,cAAM,IAAI,wBAAwB,yBAAyB;AAAA,MAC5D;AAEA,YAAM,gBAAgB,wBAAwB,WAAW;AACzD,UAAI,CAAC,eAAe;AACnB,cAAM,IAAI;AAAA,UACT;AAAA,QACD;AAAA,MACD;AAEA,YAAM,
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type {\n\tSuiSignPersonalMessageInput,\n\tSuiSignPersonalMessageOutput,\n} from '@mysten/wallet-standard';\nimport type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query';\nimport { useMutation } from '@tanstack/react-query';\n\nimport {\n\tWalletFeatureNotSupportedError,\n\tWalletNoAccountSelectedError,\n\tWalletNotConnectedError,\n} from '../..//errors/walletErrors.js';\nimport { walletMutationKeys } from '../../constants/walletMutationKeys.js';\nimport type { PartialBy } from '../../types/utilityTypes.js';\nimport { useCurrentAccount } from './useCurrentAccount.js';\nimport { useCurrentWallet } from './useCurrentWallet.js';\n\ntype UseSignPersonalMessageArgs = PartialBy<SuiSignPersonalMessageInput, 'account'>;\n\ntype UseSignPersonalMessageResult = SuiSignPersonalMessageOutput;\n\ntype UseSignPersonalMessageError =\n\t| WalletFeatureNotSupportedError\n\t| WalletNoAccountSelectedError\n\t| WalletNotConnectedError\n\t| Error;\n\ntype UseSignPersonalMessageMutationOptions = Omit<\n\tUseMutationOptions<\n\t\tUseSignPersonalMessageResult,\n\t\tUseSignPersonalMessageError,\n\t\tUseSignPersonalMessageArgs,\n\t\tunknown\n\t>,\n\t'mutationFn'\n>;\n\n/**\n * Mutation hook for prompting the user to sign a message.\n */\nexport function useSignPersonalMessage({\n\tmutationKey,\n\t...mutationOptions\n}: UseSignPersonalMessageMutationOptions = {}): UseMutationResult<\n\tUseSignPersonalMessageResult,\n\tUseSignPersonalMessageError,\n\tUseSignPersonalMessageArgs\n> {\n\tconst { currentWallet } = useCurrentWallet();\n\tconst currentAccount = useCurrentAccount();\n\n\treturn useMutation({\n\t\tmutationKey: walletMutationKeys.signPersonalMessage(mutationKey),\n\t\tmutationFn: async (signPersonalMessageArgs) => {\n\t\t\tif (!currentWallet) {\n\t\t\t\tthrow new WalletNotConnectedError('No wallet is connected.');\n\t\t\t}\n\n\t\t\tconst signerAccount = signPersonalMessageArgs.account ?? currentAccount;\n\t\t\tif (!signerAccount) {\n\t\t\t\tthrow new WalletNoAccountSelectedError(\n\t\t\t\t\t'No wallet account is selected to sign the personal message with.',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst signPersonalMessageFeature = currentWallet.features['sui:signPersonalMessage'];\n\t\t\tif (signPersonalMessageFeature) {\n\t\t\t\treturn await signPersonalMessageFeature.signPersonalMessage({\n\t\t\t\t\t...signPersonalMessageArgs,\n\t\t\t\t\taccount: signerAccount,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// TODO: Remove this once we officially discontinue sui:signMessage in the wallet standard\n\t\t\tconst signMessageFeature = currentWallet.features['sui:signMessage'];\n\t\t\tif (signMessageFeature) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t\"This wallet doesn't support the `signPersonalMessage` feature... falling back to `signMessage`.\",\n\t\t\t\t);\n\n\t\t\t\tconst { messageBytes, signature } = await signMessageFeature.signMessage({\n\t\t\t\t\t...signPersonalMessageArgs,\n\t\t\t\t\taccount: signerAccount,\n\t\t\t\t});\n\t\t\t\treturn { bytes: messageBytes, signature };\n\t\t\t}\n\n\t\t\tthrow new WalletFeatureNotSupportedError(\n\t\t\t\t\"This wallet doesn't support the `signPersonalMessage` feature.\",\n\t\t\t);\n\t\t},\n\t\t...mutationOptions,\n\t});\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * An error that is instantiated when someone attempts to perform an action that requires an active wallet connection.\n */\nexport class WalletNotConnectedError extends Error {}\n\n/**\n * An error that is instantiated when someone attempts to perform an action that requires a selected wallet account.\n * This is more of an edge case stemming from the fact that wallets don't technically require you to authorize any\n * accounts when connecting a wallet.\n */\nexport class WalletNoAccountSelectedError extends Error {}\n\n/**\n * An error that is instantiated when someone attempts to perform an action that isn't supported by a wallet.\n */\nexport class WalletFeatureNotSupportedError extends Error {}\n\n/**\n * An error that is instantiated when a wallet account can't be found for a specific wallet.\n */\nexport class WalletAccountNotFoundError extends Error {}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { MutationKey } from '@tanstack/react-query';\n\nexport const walletMutationKeys = {\n\tall: { baseScope: 'wallet' },\n\tconnectWallet: formMutationKeyFn('connect-wallet'),\n\tdisconnectWallet: formMutationKeyFn('disconnect-wallet'),\n\tsignPersonalMessage: formMutationKeyFn('sign-personal-message'),\n\tsignTransactionBlock: formMutationKeyFn('sign-transaction-block'),\n\tsignAndExecuteTransactionBlock: formMutationKeyFn('sign-and-execute-transaction-block'),\n\tswitchAccount: formMutationKeyFn('switch-account'),\n};\n\nfunction formMutationKeyFn(baseEntity: string) {\n\treturn function mutationKeyFn(additionalKeys: MutationKey = []) {\n\t\treturn [{ ...walletMutationKeys.all, baseEntity }, ...additionalKeys];\n\t};\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useContext } from 'react';\nimport { useStore } from 'zustand';\n\nimport { WalletContext } from '../../contexts/walletContext.js';\nimport type { StoreState } from '../../walletStore.js';\n\nexport function useWalletStore<T>(selector: (state: StoreState) => T): T {\n\tconst store = useContext(WalletContext);\n\tif (!store) {\n\t\tthrow new Error(\n\t\t\t'Could not find WalletContext. Ensure that you have set up the WalletProvider.',\n\t\t);\n\t}\n\treturn useStore(store, selector);\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { createContext } from 'react';\n\nimport type { WalletStore } from '../walletStore.js';\n\nexport const WalletContext = createContext<WalletStore | null>(null);\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { WalletAccount } from '@mysten/wallet-standard';\n\nimport { useWalletStore } from './useWalletStore.js';\n\n/**\n * Retrieves the wallet account that is currently selected, if one exists.\n */\nexport function useCurrentAccount(): WalletAccount | null {\n\treturn useWalletStore((state) => state.currentAccount);\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useWalletStore } from './useWalletStore.js';\n\n/**\n * Retrieves the wallet that is currently connected to the dApp, if one exists.\n */\nexport function useCurrentWallet() {\n\tconst currentWallet = useWalletStore((state) => state.currentWallet);\n\tconst connectionStatus = useWalletStore((state) => state.connectionStatus);\n\n\tswitch (connectionStatus) {\n\t\tcase 'connecting':\n\t\t\treturn {\n\t\t\t\tconnectionStatus,\n\t\t\t\tcurrentWallet: null,\n\t\t\t\tisDisconnected: false,\n\t\t\t\tisConnecting: true,\n\t\t\t\tisConnected: false,\n\t\t\t} as const;\n\t\tcase 'disconnected':\n\t\t\treturn {\n\t\t\t\tconnectionStatus,\n\t\t\t\tcurrentWallet: null,\n\t\t\t\tisDisconnected: true,\n\t\t\t\tisConnecting: false,\n\t\t\t\tisConnected: false,\n\t\t\t} as const;\n\t\tcase 'connected': {\n\t\t\treturn {\n\t\t\t\tconnectionStatus,\n\t\t\t\tcurrentWallet: currentWallet!,\n\t\t\t\tisDisconnected: false,\n\t\t\t\tisConnecting: false,\n\t\t\t\tisConnected: true,\n\t\t\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,GAAG;AAAA,EACJ,CAAC;AACF;",
|
|
6
6
|
"names": ["import_react"]
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1572,16 +1572,27 @@ function useSignPersonalMessage({
|
|
|
1572
1572
|
"No wallet account is selected to sign the personal message with."
|
|
1573
1573
|
);
|
|
1574
1574
|
}
|
|
1575
|
-
const
|
|
1576
|
-
if (
|
|
1577
|
-
|
|
1578
|
-
|
|
1575
|
+
const signPersonalMessageFeature = currentWallet.features["sui:signPersonalMessage"];
|
|
1576
|
+
if (signPersonalMessageFeature) {
|
|
1577
|
+
return await signPersonalMessageFeature.signPersonalMessage({
|
|
1578
|
+
...signPersonalMessageArgs,
|
|
1579
|
+
account: signerAccount
|
|
1580
|
+
});
|
|
1581
|
+
}
|
|
1582
|
+
const signMessageFeature = currentWallet.features["sui:signMessage"];
|
|
1583
|
+
if (signMessageFeature) {
|
|
1584
|
+
console.warn(
|
|
1585
|
+
"This wallet doesn't support the `signPersonalMessage` feature... falling back to `signMessage`."
|
|
1579
1586
|
);
|
|
1587
|
+
const { messageBytes, signature } = await signMessageFeature.signMessage({
|
|
1588
|
+
...signPersonalMessageArgs,
|
|
1589
|
+
account: signerAccount
|
|
1590
|
+
});
|
|
1591
|
+
return { bytes: messageBytes, signature };
|
|
1580
1592
|
}
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
});
|
|
1593
|
+
throw new WalletFeatureNotSupportedError(
|
|
1594
|
+
"This wallet doesn't support the `signPersonalMessage` feature."
|
|
1595
|
+
);
|
|
1585
1596
|
},
|
|
1586
1597
|
...mutationOptions
|
|
1587
1598
|
});
|