@mysten/dapp-kit 0.13.2 → 0.14.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 +16 -0
- package/README.md +5 -4
- package/dist/cjs/components/AccountDropdownMenu.js +13 -8
- package/dist/cjs/components/AccountDropdownMenu.js.map +2 -2
- package/dist/cjs/components/ConnectButton.js +19 -9
- package/dist/cjs/components/ConnectButton.js.map +2 -2
- package/dist/cjs/components/SuiClientProvider.d.ts +1 -1
- package/dist/cjs/components/SuiClientProvider.js +1 -1
- package/dist/cjs/components/SuiClientProvider.js.map +1 -1
- package/dist/cjs/components/WalletProvider.d.ts +3 -3
- package/dist/cjs/components/WalletProvider.js +104 -33
- package/dist/cjs/components/WalletProvider.js.map +2 -2
- package/dist/cjs/components/connect-modal/ConnectModal.js +10 -4
- package/dist/cjs/components/connect-modal/ConnectModal.js.map +2 -2
- package/dist/cjs/components/connect-modal/wallet-list/WalletList.js.map +2 -2
- package/dist/cjs/constants/walletDefaults.d.ts +1 -1
- package/dist/cjs/constants/walletDefaults.js +4 -2
- package/dist/cjs/constants/walletDefaults.js.map +2 -2
- package/dist/cjs/constants/walletMutationKeys.d.ts +3 -2
- package/dist/cjs/constants/walletMutationKeys.js +4 -3
- package/dist/cjs/constants/walletMutationKeys.js.map +2 -2
- package/dist/cjs/hooks/networkConfig.d.ts +1 -1
- package/dist/cjs/hooks/networkConfig.js +1 -1
- package/dist/cjs/hooks/networkConfig.js.map +1 -1
- package/dist/cjs/hooks/useResolveSuiNSNames.d.ts +1 -1
- package/dist/cjs/hooks/useResolveSuiNSNames.js +1 -1
- package/dist/cjs/hooks/useResolveSuiNSNames.js.map +1 -1
- package/dist/cjs/hooks/useSuiClient.d.ts +1 -1
- package/dist/cjs/hooks/useSuiClient.js +1 -1
- package/dist/cjs/hooks/useSuiClient.js.map +1 -1
- package/dist/cjs/hooks/useSuiClientInfiniteQuery.d.ts +1 -1
- package/dist/cjs/hooks/useSuiClientInfiniteQuery.js +1 -1
- package/dist/cjs/hooks/useSuiClientInfiniteQuery.js.map +1 -1
- package/dist/cjs/hooks/useSuiClientMutation.js +1 -1
- package/dist/cjs/hooks/useSuiClientMutation.js.map +1 -1
- package/dist/cjs/hooks/useSuiClientQueries.js +1 -1
- package/dist/cjs/hooks/useSuiClientQueries.js.map +1 -1
- package/dist/cjs/hooks/useSuiClientQuery.d.ts +1 -1
- package/dist/cjs/hooks/useSuiClientQuery.js +1 -1
- package/dist/cjs/hooks/useSuiClientQuery.js.map +1 -1
- package/dist/cjs/hooks/wallet/useAutoConnectWallet.js +17 -7
- package/dist/cjs/hooks/wallet/useAutoConnectWallet.js.map +2 -2
- package/dist/cjs/hooks/wallet/useConnectWallet.js +10 -4
- package/dist/cjs/hooks/wallet/useConnectWallet.js.map +2 -2
- package/dist/cjs/hooks/wallet/useCurrentWallet.d.ts +3 -0
- package/dist/cjs/hooks/wallet/useCurrentWallet.js +7 -3
- package/dist/cjs/hooks/wallet/useCurrentWallet.js.map +2 -2
- package/dist/cjs/hooks/wallet/useDisconnectWallet.js +11 -6
- package/dist/cjs/hooks/wallet/useDisconnectWallet.js.map +2 -2
- package/dist/cjs/hooks/wallet/useReportTransactionEffects.d.ts +15 -0
- package/dist/cjs/hooks/wallet/{useSignTransactionBlock.js → useReportTransactionEffects.js} +37 -37
- package/dist/cjs/hooks/wallet/useReportTransactionEffects.js.map +7 -0
- package/dist/cjs/hooks/wallet/useSignAndExecuteTransaction.d.ts +29 -0
- package/dist/cjs/hooks/wallet/useSignAndExecuteTransaction.js +248 -0
- package/dist/cjs/hooks/wallet/useSignAndExecuteTransaction.js.map +7 -0
- package/dist/cjs/hooks/wallet/useSignPersonalMessage.js +11 -6
- package/dist/cjs/hooks/wallet/useSignPersonalMessage.js.map +2 -2
- package/dist/cjs/hooks/wallet/useSignTransaction.d.ts +18 -0
- package/dist/cjs/hooks/wallet/{useSignAndExecuteTransactionBlock.js → useSignTransaction.js} +83 -47
- package/dist/cjs/hooks/wallet/useSignTransaction.js.map +7 -0
- package/dist/cjs/hooks/wallet/useStashedWallet.js +17 -7
- package/dist/cjs/hooks/wallet/useStashedWallet.js.map +2 -2
- package/dist/cjs/hooks/wallet/useSwitchAccount.js +11 -6
- package/dist/cjs/hooks/wallet/useSwitchAccount.js.map +2 -2
- package/dist/cjs/hooks/wallet/useUnsafeBurnerWallet.js +64 -9
- package/dist/cjs/hooks/wallet/useUnsafeBurnerWallet.js.map +2 -2
- package/dist/cjs/hooks/wallet/useWalletPropertiesChanged.js +7 -3
- package/dist/cjs/hooks/wallet/useWalletPropertiesChanged.js.map +2 -2
- package/dist/cjs/hooks/wallet/useWalletsChanged.d.ts +1 -1
- package/dist/cjs/hooks/wallet/useWalletsChanged.js +7 -7
- package/dist/cjs/hooks/wallet/useWalletsChanged.js.map +2 -2
- package/dist/cjs/index.d.ts +3 -2
- package/dist/cjs/index.js +231 -86
- package/dist/cjs/index.js.map +4 -4
- package/dist/cjs/types.d.ts +1 -1
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/utils/walletUtils.d.ts +2 -2
- package/dist/cjs/utils/walletUtils.js +2 -2
- package/dist/cjs/utils/walletUtils.js.map +2 -2
- package/dist/cjs/walletStore.d.ts +2 -1
- package/dist/cjs/walletStore.js +8 -4
- package/dist/cjs/walletStore.js.map +2 -2
- package/dist/esm/components/AccountDropdownMenu.js +13 -8
- package/dist/esm/components/AccountDropdownMenu.js.map +2 -2
- package/dist/esm/components/ConnectButton.js +19 -9
- package/dist/esm/components/ConnectButton.js.map +2 -2
- package/dist/esm/components/SuiClientProvider.d.ts +1 -1
- package/dist/esm/components/SuiClientProvider.js +1 -1
- package/dist/esm/components/SuiClientProvider.js.map +1 -1
- package/dist/esm/components/WalletProvider.d.ts +3 -3
- package/dist/esm/components/WalletProvider.js +104 -33
- package/dist/esm/components/WalletProvider.js.map +2 -2
- package/dist/esm/components/connect-modal/ConnectModal.js +10 -4
- package/dist/esm/components/connect-modal/ConnectModal.js.map +2 -2
- package/dist/esm/components/connect-modal/wallet-list/WalletList.js.map +2 -2
- package/dist/esm/constants/walletDefaults.d.ts +1 -1
- package/dist/esm/constants/walletDefaults.js +4 -2
- package/dist/esm/constants/walletDefaults.js.map +2 -2
- package/dist/esm/constants/walletMutationKeys.d.ts +3 -2
- package/dist/esm/constants/walletMutationKeys.js +4 -3
- package/dist/esm/constants/walletMutationKeys.js.map +2 -2
- package/dist/esm/hooks/networkConfig.d.ts +1 -1
- package/dist/esm/hooks/networkConfig.js +1 -1
- package/dist/esm/hooks/networkConfig.js.map +1 -1
- package/dist/esm/hooks/useResolveSuiNSNames.d.ts +1 -1
- package/dist/esm/hooks/useResolveSuiNSNames.js +1 -1
- package/dist/esm/hooks/useResolveSuiNSNames.js.map +1 -1
- package/dist/esm/hooks/useSuiClient.d.ts +1 -1
- package/dist/esm/hooks/useSuiClient.js +1 -1
- package/dist/esm/hooks/useSuiClient.js.map +1 -1
- package/dist/esm/hooks/useSuiClientInfiniteQuery.d.ts +1 -1
- package/dist/esm/hooks/useSuiClientInfiniteQuery.js +1 -1
- package/dist/esm/hooks/useSuiClientInfiniteQuery.js.map +1 -1
- package/dist/esm/hooks/useSuiClientMutation.js +1 -1
- package/dist/esm/hooks/useSuiClientMutation.js.map +1 -1
- package/dist/esm/hooks/useSuiClientQueries.js +1 -1
- package/dist/esm/hooks/useSuiClientQueries.js.map +1 -1
- package/dist/esm/hooks/useSuiClientQuery.d.ts +1 -1
- package/dist/esm/hooks/useSuiClientQuery.js +1 -1
- package/dist/esm/hooks/useSuiClientQuery.js.map +1 -1
- package/dist/esm/hooks/wallet/useAutoConnectWallet.js +17 -7
- package/dist/esm/hooks/wallet/useAutoConnectWallet.js.map +2 -2
- package/dist/esm/hooks/wallet/useConnectWallet.js +10 -4
- package/dist/esm/hooks/wallet/useConnectWallet.js.map +2 -2
- package/dist/esm/hooks/wallet/useCurrentWallet.d.ts +3 -0
- package/dist/esm/hooks/wallet/useCurrentWallet.js +7 -3
- package/dist/esm/hooks/wallet/useCurrentWallet.js.map +2 -2
- package/dist/esm/hooks/wallet/useDisconnectWallet.js +11 -6
- package/dist/esm/hooks/wallet/useDisconnectWallet.js.map +2 -2
- package/dist/esm/hooks/wallet/useReportTransactionEffects.d.ts +15 -0
- package/dist/esm/hooks/wallet/{useSignTransactionBlock.js → useReportTransactionEffects.js} +34 -34
- package/dist/esm/hooks/wallet/useReportTransactionEffects.js.map +7 -0
- package/dist/esm/hooks/wallet/useSignAndExecuteTransaction.d.ts +29 -0
- package/dist/esm/hooks/wallet/useSignAndExecuteTransaction.js +227 -0
- package/dist/esm/hooks/wallet/useSignAndExecuteTransaction.js.map +7 -0
- package/dist/esm/hooks/wallet/useSignPersonalMessage.js +11 -6
- package/dist/esm/hooks/wallet/useSignPersonalMessage.js.map +2 -2
- package/dist/esm/hooks/wallet/useSignTransaction.d.ts +18 -0
- package/dist/esm/hooks/wallet/{useSignAndExecuteTransactionBlock.js → useSignTransaction.js} +80 -44
- package/dist/esm/hooks/wallet/useSignTransaction.js.map +7 -0
- package/dist/esm/hooks/wallet/useStashedWallet.js +17 -7
- package/dist/esm/hooks/wallet/useStashedWallet.js.map +2 -2
- package/dist/esm/hooks/wallet/useSwitchAccount.js +11 -6
- package/dist/esm/hooks/wallet/useSwitchAccount.js.map +2 -2
- package/dist/esm/hooks/wallet/useUnsafeBurnerWallet.js +64 -9
- package/dist/esm/hooks/wallet/useUnsafeBurnerWallet.js.map +2 -2
- package/dist/esm/hooks/wallet/useWalletPropertiesChanged.js +7 -3
- package/dist/esm/hooks/wallet/useWalletPropertiesChanged.js.map +2 -2
- package/dist/esm/hooks/wallet/useWalletsChanged.d.ts +1 -1
- package/dist/esm/hooks/wallet/useWalletsChanged.js +7 -7
- package/dist/esm/hooks/wallet/useWalletsChanged.js.map +2 -2
- package/dist/esm/index.d.ts +3 -2
- package/dist/esm/index.js +231 -86
- package/dist/esm/index.js.map +4 -4
- package/dist/esm/types.d.ts +1 -1
- package/dist/esm/utils/walletUtils.d.ts +2 -2
- package/dist/esm/utils/walletUtils.js +2 -2
- package/dist/esm/utils/walletUtils.js.map +2 -2
- package/dist/esm/walletStore.d.ts +2 -1
- package/dist/esm/walletStore.js +8 -4
- package/dist/esm/walletStore.js.map +2 -2
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/src/components/AccountDropdownMenu.tsx +1 -1
- package/src/components/SuiClientProvider.tsx +2 -2
- package/src/components/WalletProvider.tsx +9 -9
- package/src/constants/walletDefaults.ts +7 -3
- package/src/constants/walletMutationKeys.ts +3 -2
- package/src/hooks/networkConfig.ts +1 -1
- package/src/hooks/useResolveSuiNSNames.ts +1 -1
- package/src/hooks/useSuiClient.ts +1 -1
- package/src/hooks/useSuiClientInfiniteQuery.ts +1 -1
- package/src/hooks/useSuiClientQuery.ts +1 -1
- package/src/hooks/wallet/useConnectWallet.ts +6 -1
- package/src/hooks/wallet/useCurrentWallet.ts +4 -0
- package/src/hooks/wallet/useReportTransactionEffects.ts +82 -0
- package/src/hooks/wallet/useSignAndExecuteTransaction.ts +167 -0
- package/src/hooks/wallet/useSignTransaction.ts +119 -0
- package/src/hooks/wallet/useUnsafeBurnerWallet.ts +69 -6
- package/src/hooks/wallet/useWalletsChanged.ts +5 -5
- package/src/index.ts +3 -2
- package/src/types.ts +1 -1
- package/src/utils/walletUtils.ts +3 -2
- package/src/walletStore.ts +7 -1
- package/dist/cjs/hooks/wallet/useSignAndExecuteTransactionBlock.d.ts +0 -15
- package/dist/cjs/hooks/wallet/useSignAndExecuteTransactionBlock.js.map +0 -7
- package/dist/cjs/hooks/wallet/useSignTransactionBlock.d.ts +0 -13
- package/dist/cjs/hooks/wallet/useSignTransactionBlock.js.map +0 -7
- package/dist/esm/hooks/wallet/useSignAndExecuteTransactionBlock.d.ts +0 -15
- package/dist/esm/hooks/wallet/useSignAndExecuteTransactionBlock.js.map +0 -7
- package/dist/esm/hooks/wallet/useSignTransactionBlock.d.ts +0 -13
- package/dist/esm/hooks/wallet/useSignTransactionBlock.js.map +0 -7
- package/src/hooks/wallet/useSignAndExecuteTransactionBlock.ts +0 -116
- package/src/hooks/wallet/useSignTransactionBlock.ts +0 -84
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"author": "Mysten Labs <build@mystenlabs.com>",
|
|
4
4
|
"description": "A collection of React hooks and components for interacting with the Sui blockchain and wallets.",
|
|
5
5
|
"homepage": "https://sdk.mystenlabs.com/typescript",
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.14.0",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"files": [
|
|
9
9
|
"CHANGELOG.md",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"size-limit": "^8.2.6",
|
|
60
60
|
"typescript": "^5.3.3",
|
|
61
61
|
"vite": "^4.4.4",
|
|
62
|
-
"vitest": "^
|
|
62
|
+
"vitest": "^1.6.0",
|
|
63
63
|
"@mysten/build-scripts": "0.0.0"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
@@ -71,9 +71,9 @@
|
|
|
71
71
|
"@vanilla-extract/recipes": "^0.5.0",
|
|
72
72
|
"clsx": "^2.0.0",
|
|
73
73
|
"zustand": "^4.4.1",
|
|
74
|
-
"@mysten/sui
|
|
75
|
-
"@mysten/wallet-standard": "0.
|
|
76
|
-
"@mysten/zksend": "0.
|
|
74
|
+
"@mysten/sui": "1.0.0",
|
|
75
|
+
"@mysten/wallet-standard": "0.12.0",
|
|
76
|
+
"@mysten/zksend": "0.9.0"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
79
|
"@tanstack/react-query": "^5.0.0",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"scripts": {
|
|
87
87
|
"clean": "rm -rf tsconfig.tsbuildinfo ./dist",
|
|
88
88
|
"build": "build-dapp-kit",
|
|
89
|
-
"test": "pnpm test:typecheck && pnpm vitest",
|
|
89
|
+
"test": "pnpm test:typecheck && pnpm vitest run",
|
|
90
90
|
"test:typecheck": "tsc -b ./test",
|
|
91
91
|
"size": "size-limit",
|
|
92
92
|
"analyze": "size-limit --why",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Mysten Labs, Inc.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { formatAddress } from '@mysten/sui
|
|
4
|
+
import { formatAddress } from '@mysten/sui/utils';
|
|
5
5
|
import type { WalletAccount } from '@mysten/wallet-standard';
|
|
6
6
|
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
|
7
7
|
import clsx from 'clsx';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Copyright (c) Mysten Labs, Inc.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { getFullnodeUrl, isSuiClient, SuiClient } from '@mysten/sui
|
|
5
|
-
import type { SuiClientOptions } from '@mysten/sui
|
|
4
|
+
import { getFullnodeUrl, isSuiClient, SuiClient } from '@mysten/sui/client';
|
|
5
|
+
import type { SuiClientOptions } from '@mysten/sui/client';
|
|
6
6
|
import { createContext, useMemo, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import type { NetworkConfig } from '../hooks/networkConfig.js';
|
|
@@ -8,9 +8,9 @@ import type { StateStorage } from 'zustand/middleware';
|
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
10
|
DEFAULT_PREFERRED_WALLETS,
|
|
11
|
-
DEFAULT_REQUIRED_FEATURES,
|
|
12
11
|
DEFAULT_STORAGE,
|
|
13
12
|
DEFAULT_STORAGE_KEY,
|
|
13
|
+
DEFAULT_WALLET_FILTER,
|
|
14
14
|
} from '../constants/walletDefaults.js';
|
|
15
15
|
import { WalletContext } from '../contexts/walletContext.js';
|
|
16
16
|
import { useAutoConnectWallet } from '../hooks/wallet/useAutoConnectWallet.js';
|
|
@@ -30,8 +30,8 @@ export type WalletProviderProps = {
|
|
|
30
30
|
/** A list of wallets that are sorted to the top of the wallet list, if they are available to connect to. By default, wallets are sorted by the order they are loaded in. */
|
|
31
31
|
preferredWallets?: string[];
|
|
32
32
|
|
|
33
|
-
/** A
|
|
34
|
-
|
|
33
|
+
/** A filter function to select wallets that support features required for the dApp to function. This filters the list of wallets presented to users when selecting a wallet to connect from, ensuring that only wallets that meet the dApps requirements can connect. */
|
|
34
|
+
walletFilter?: (wallet: WalletWithRequiredFeatures) => boolean;
|
|
35
35
|
|
|
36
36
|
/** Enables the development-only unsafe burner wallet, which can be useful for testing. */
|
|
37
37
|
enableUnsafeBurner?: boolean;
|
|
@@ -58,7 +58,7 @@ export type { WalletWithFeatures };
|
|
|
58
58
|
|
|
59
59
|
export function WalletProvider({
|
|
60
60
|
preferredWallets = DEFAULT_PREFERRED_WALLETS,
|
|
61
|
-
|
|
61
|
+
walletFilter = DEFAULT_WALLET_FILTER,
|
|
62
62
|
storage = DEFAULT_STORAGE,
|
|
63
63
|
storageKey = DEFAULT_STORAGE_KEY,
|
|
64
64
|
enableUnsafeBurner = false,
|
|
@@ -70,7 +70,7 @@ export function WalletProvider({
|
|
|
70
70
|
const storeRef = useRef(
|
|
71
71
|
createWalletStore({
|
|
72
72
|
autoConnectEnabled: autoConnect,
|
|
73
|
-
wallets: getRegisteredWallets(preferredWallets,
|
|
73
|
+
wallets: getRegisteredWallets(preferredWallets, walletFilter),
|
|
74
74
|
storage: storage || createInMemoryStore(),
|
|
75
75
|
storageKey,
|
|
76
76
|
}),
|
|
@@ -80,7 +80,7 @@ export function WalletProvider({
|
|
|
80
80
|
<WalletContext.Provider value={storeRef.current}>
|
|
81
81
|
<WalletConnectionManager
|
|
82
82
|
preferredWallets={preferredWallets}
|
|
83
|
-
|
|
83
|
+
walletFilter={walletFilter}
|
|
84
84
|
enableUnsafeBurner={enableUnsafeBurner}
|
|
85
85
|
stashedWallet={stashedWallet}
|
|
86
86
|
>
|
|
@@ -94,17 +94,17 @@ export function WalletProvider({
|
|
|
94
94
|
|
|
95
95
|
type WalletConnectionManagerProps = Pick<
|
|
96
96
|
WalletProviderProps,
|
|
97
|
-
'preferredWallets' | '
|
|
97
|
+
'preferredWallets' | 'walletFilter' | 'enableUnsafeBurner' | 'stashedWallet' | 'children'
|
|
98
98
|
>;
|
|
99
99
|
|
|
100
100
|
function WalletConnectionManager({
|
|
101
101
|
preferredWallets = DEFAULT_PREFERRED_WALLETS,
|
|
102
|
-
|
|
102
|
+
walletFilter = DEFAULT_WALLET_FILTER,
|
|
103
103
|
enableUnsafeBurner = false,
|
|
104
104
|
stashedWallet,
|
|
105
105
|
children,
|
|
106
106
|
}: WalletConnectionManagerProps) {
|
|
107
|
-
useWalletsChanged(preferredWallets,
|
|
107
|
+
useWalletsChanged(preferredWallets, walletFilter);
|
|
108
108
|
useWalletPropertiesChanged();
|
|
109
109
|
useStashedWallet(stashedWallet);
|
|
110
110
|
useUnsafeBurnerWallet(enableUnsafeBurner);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Mysten Labs, Inc.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { WalletWithRequiredFeatures } from '@mysten/wallet-standard';
|
|
4
|
+
import type { SuiWalletFeatures, WalletWithRequiredFeatures } from '@mysten/wallet-standard';
|
|
5
5
|
import { STASHED_WALLET_NAME } from '@mysten/zksend';
|
|
6
6
|
|
|
7
7
|
import { createInMemoryStore } from '../utils/stateStorage.js';
|
|
@@ -13,8 +13,12 @@ export const DEFAULT_STORAGE =
|
|
|
13
13
|
|
|
14
14
|
export const DEFAULT_STORAGE_KEY = 'sui-dapp-kit:wallet-connection-info';
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
const SIGN_FEATURES = [
|
|
17
|
+
'sui:signTransaction',
|
|
17
18
|
'sui:signTransactionBlock',
|
|
18
|
-
];
|
|
19
|
+
] satisfies (keyof SuiWalletFeatures)[];
|
|
20
|
+
|
|
21
|
+
export const DEFAULT_WALLET_FILTER = (wallet: WalletWithRequiredFeatures) =>
|
|
22
|
+
SIGN_FEATURES.some((feature) => wallet.features[feature]);
|
|
19
23
|
|
|
20
24
|
export const DEFAULT_PREFERRED_WALLETS = [SUI_WALLET_NAME, STASHED_WALLET_NAME];
|
|
@@ -9,9 +9,10 @@ export const walletMutationKeys = {
|
|
|
9
9
|
autoconnectWallet: formMutationKeyFn('autoconnect-wallet'),
|
|
10
10
|
disconnectWallet: formMutationKeyFn('disconnect-wallet'),
|
|
11
11
|
signPersonalMessage: formMutationKeyFn('sign-personal-message'),
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
signTransaction: formMutationKeyFn('sign-transaction'),
|
|
13
|
+
signAndExecuteTransaction: formMutationKeyFn('sign-and-execute-transaction'),
|
|
14
14
|
switchAccount: formMutationKeyFn('switch-account'),
|
|
15
|
+
reportTransactionEffects: formMutationKeyFn('report-transaction-effects'),
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
function formMutationKeyFn(baseEntity: string) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Mysten Labs, Inc.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { SuiClientOptions } from '@mysten/sui
|
|
4
|
+
import type { SuiClientOptions } from '@mysten/sui/client';
|
|
5
5
|
|
|
6
6
|
import { useSuiClientContext } from './useSuiClient.js';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Mysten Labs, Inc.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { ResolvedNameServiceNames } from '@mysten/sui
|
|
4
|
+
import type { ResolvedNameServiceNames } from '@mysten/sui/client';
|
|
5
5
|
import type { UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
|
6
6
|
|
|
7
7
|
import { useSuiClientQuery } from './useSuiClientQuery.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Mysten Labs, Inc.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { SuiClient } from '@mysten/sui
|
|
4
|
+
import type { SuiClient } from '@mysten/sui/client';
|
|
5
5
|
import { useContext } from 'react';
|
|
6
6
|
|
|
7
7
|
import { SuiClientContext } from '../components/SuiClientProvider.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Mysten Labs, Inc.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { SuiClient } from '@mysten/sui
|
|
4
|
+
import type { SuiClient } from '@mysten/sui/client';
|
|
5
5
|
import type { UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
|
6
6
|
import { useQuery } from '@tanstack/react-query';
|
|
7
7
|
|
|
@@ -55,7 +55,12 @@ export function useConnectWallet({
|
|
|
55
55
|
);
|
|
56
56
|
const selectedAccount = getSelectedAccount(connectedSuiAccounts, accountAddress);
|
|
57
57
|
|
|
58
|
-
setWalletConnected(
|
|
58
|
+
setWalletConnected(
|
|
59
|
+
wallet,
|
|
60
|
+
connectedSuiAccounts,
|
|
61
|
+
selectedAccount,
|
|
62
|
+
connectResult.supportedIntents,
|
|
63
|
+
);
|
|
59
64
|
|
|
60
65
|
return { accounts: connectedSuiAccounts };
|
|
61
66
|
} catch (error) {
|
|
@@ -9,6 +9,7 @@ import { useWalletStore } from './useWalletStore.js';
|
|
|
9
9
|
export function useCurrentWallet() {
|
|
10
10
|
const currentWallet = useWalletStore((state) => state.currentWallet);
|
|
11
11
|
const connectionStatus = useWalletStore((state) => state.connectionStatus);
|
|
12
|
+
const supportedIntents = useWalletStore((state) => state.supportedIntents);
|
|
12
13
|
|
|
13
14
|
switch (connectionStatus) {
|
|
14
15
|
case 'connecting':
|
|
@@ -18,6 +19,7 @@ export function useCurrentWallet() {
|
|
|
18
19
|
isDisconnected: false,
|
|
19
20
|
isConnecting: true,
|
|
20
21
|
isConnected: false,
|
|
22
|
+
supportedIntents: [],
|
|
21
23
|
} as const;
|
|
22
24
|
case 'disconnected':
|
|
23
25
|
return {
|
|
@@ -26,6 +28,7 @@ export function useCurrentWallet() {
|
|
|
26
28
|
isDisconnected: true,
|
|
27
29
|
isConnecting: false,
|
|
28
30
|
isConnected: false,
|
|
31
|
+
supportedIntents: [],
|
|
29
32
|
} as const;
|
|
30
33
|
case 'connected': {
|
|
31
34
|
return {
|
|
@@ -34,6 +37,7 @@ export function useCurrentWallet() {
|
|
|
34
37
|
isDisconnected: false,
|
|
35
38
|
isConnecting: false,
|
|
36
39
|
isConnected: true,
|
|
40
|
+
supportedIntents,
|
|
37
41
|
} as const;
|
|
38
42
|
}
|
|
39
43
|
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// Copyright (c) Mysten Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { toB64 } from '@mysten/sui/utils';
|
|
5
|
+
import type { SuiReportTransactionEffectsInput } from '@mysten/wallet-standard';
|
|
6
|
+
import type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query';
|
|
7
|
+
import { useMutation } from '@tanstack/react-query';
|
|
8
|
+
|
|
9
|
+
import { walletMutationKeys } from '../../constants/walletMutationKeys.js';
|
|
10
|
+
import type { WalletFeatureNotSupportedError } from '../../errors/walletErrors.js';
|
|
11
|
+
import {
|
|
12
|
+
WalletNoAccountSelectedError,
|
|
13
|
+
WalletNotConnectedError,
|
|
14
|
+
} from '../../errors/walletErrors.js';
|
|
15
|
+
import type { PartialBy } from '../../types/utilityTypes.js';
|
|
16
|
+
import { useCurrentAccount } from './useCurrentAccount.js';
|
|
17
|
+
import { useCurrentWallet } from './useCurrentWallet.js';
|
|
18
|
+
|
|
19
|
+
type UseReportTransactionEffectsArgs = Omit<
|
|
20
|
+
PartialBy<SuiReportTransactionEffectsInput, 'account' | 'chain'>,
|
|
21
|
+
'effects'
|
|
22
|
+
> & {
|
|
23
|
+
effects: string | number[];
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type UseReportTransactionEffectsError =
|
|
27
|
+
| WalletFeatureNotSupportedError
|
|
28
|
+
| WalletNoAccountSelectedError
|
|
29
|
+
| WalletNotConnectedError
|
|
30
|
+
| Error;
|
|
31
|
+
|
|
32
|
+
type UseReportTransactionEffectsMutationOptions = Omit<
|
|
33
|
+
UseMutationOptions<
|
|
34
|
+
void,
|
|
35
|
+
UseReportTransactionEffectsError,
|
|
36
|
+
UseReportTransactionEffectsArgs,
|
|
37
|
+
unknown
|
|
38
|
+
>,
|
|
39
|
+
'mutationFn'
|
|
40
|
+
>;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Mutation hook for prompting the user to sign a message.
|
|
44
|
+
*/
|
|
45
|
+
export function useReportTransactionEffects({
|
|
46
|
+
mutationKey,
|
|
47
|
+
...mutationOptions
|
|
48
|
+
}: UseReportTransactionEffectsMutationOptions = {}): UseMutationResult<
|
|
49
|
+
void,
|
|
50
|
+
UseReportTransactionEffectsError,
|
|
51
|
+
UseReportTransactionEffectsArgs
|
|
52
|
+
> {
|
|
53
|
+
const { currentWallet } = useCurrentWallet();
|
|
54
|
+
const currentAccount = useCurrentAccount();
|
|
55
|
+
|
|
56
|
+
return useMutation({
|
|
57
|
+
mutationKey: walletMutationKeys.reportTransactionEffects(mutationKey),
|
|
58
|
+
mutationFn: async ({ effects, chain = currentWallet?.chains[0], account = currentAccount }) => {
|
|
59
|
+
if (!currentWallet) {
|
|
60
|
+
throw new WalletNotConnectedError('No wallet is connected.');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (!account) {
|
|
64
|
+
throw new WalletNoAccountSelectedError(
|
|
65
|
+
'No wallet account is selected to report transaction effects for',
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const reportTransactionEffectsFeature =
|
|
70
|
+
currentWallet.features['sui:reportTransactionEffects'];
|
|
71
|
+
|
|
72
|
+
if (reportTransactionEffectsFeature) {
|
|
73
|
+
return await reportTransactionEffectsFeature.reportTransactionEffects({
|
|
74
|
+
effects: Array.isArray(effects) ? toB64(new Uint8Array(effects)) : effects,
|
|
75
|
+
account,
|
|
76
|
+
chain: chain ?? currentWallet?.chains[0],
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
...mutationOptions,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// Copyright (c) Mysten Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { Transaction } from '@mysten/sui/transactions';
|
|
5
|
+
import { toB64 } from '@mysten/sui/utils';
|
|
6
|
+
import type {
|
|
7
|
+
SuiSignAndExecuteTransactionInput,
|
|
8
|
+
SuiSignAndExecuteTransactionOutput,
|
|
9
|
+
} from '@mysten/wallet-standard';
|
|
10
|
+
import { signTransaction } from '@mysten/wallet-standard';
|
|
11
|
+
import type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query';
|
|
12
|
+
import { useMutation } from '@tanstack/react-query';
|
|
13
|
+
|
|
14
|
+
import { walletMutationKeys } from '../../constants/walletMutationKeys.js';
|
|
15
|
+
import {
|
|
16
|
+
WalletFeatureNotSupportedError,
|
|
17
|
+
WalletNoAccountSelectedError,
|
|
18
|
+
WalletNotConnectedError,
|
|
19
|
+
} from '../../errors/walletErrors.js';
|
|
20
|
+
import type { PartialBy } from '../../types/utilityTypes.js';
|
|
21
|
+
import { useSuiClient } from '../useSuiClient.js';
|
|
22
|
+
import { useCurrentAccount } from './useCurrentAccount.js';
|
|
23
|
+
import { useCurrentWallet } from './useCurrentWallet.js';
|
|
24
|
+
import { useReportTransactionEffects } from './useReportTransactionEffects.js';
|
|
25
|
+
|
|
26
|
+
type UseSignAndExecuteTransactionArgs = PartialBy<
|
|
27
|
+
Omit<SuiSignAndExecuteTransactionInput, 'transaction'>,
|
|
28
|
+
'account' | 'chain'
|
|
29
|
+
> & {
|
|
30
|
+
transaction: Transaction | string;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
type UseSignAndExecuteTransactionResult = SuiSignAndExecuteTransactionOutput;
|
|
34
|
+
|
|
35
|
+
type UseSignAndExecuteTransactionError =
|
|
36
|
+
| WalletFeatureNotSupportedError
|
|
37
|
+
| WalletNoAccountSelectedError
|
|
38
|
+
| WalletNotConnectedError
|
|
39
|
+
| Error;
|
|
40
|
+
|
|
41
|
+
type ExecuteTransactionResult =
|
|
42
|
+
| {
|
|
43
|
+
digest: string;
|
|
44
|
+
rawEffects?: number[];
|
|
45
|
+
}
|
|
46
|
+
| {
|
|
47
|
+
effects?: {
|
|
48
|
+
bcs?: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
type UseSignAndExecuteTransactionMutationOptions<Result extends ExecuteTransactionResult> = Omit<
|
|
53
|
+
UseMutationOptions<
|
|
54
|
+
Result,
|
|
55
|
+
UseSignAndExecuteTransactionError,
|
|
56
|
+
UseSignAndExecuteTransactionArgs,
|
|
57
|
+
unknown
|
|
58
|
+
>,
|
|
59
|
+
'mutationFn'
|
|
60
|
+
> & {
|
|
61
|
+
execute?: ({ bytes, signature }: { bytes: string; signature: string }) => Promise<Result>;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Mutation hook for prompting the user to sign and execute a transaction.
|
|
66
|
+
*/
|
|
67
|
+
export function useSignAndExecuteTransaction<
|
|
68
|
+
Result extends ExecuteTransactionResult = UseSignAndExecuteTransactionResult,
|
|
69
|
+
>({
|
|
70
|
+
mutationKey,
|
|
71
|
+
execute,
|
|
72
|
+
...mutationOptions
|
|
73
|
+
}: UseSignAndExecuteTransactionMutationOptions<Result> = {}): UseMutationResult<
|
|
74
|
+
Result,
|
|
75
|
+
UseSignAndExecuteTransactionError,
|
|
76
|
+
UseSignAndExecuteTransactionArgs
|
|
77
|
+
> {
|
|
78
|
+
const { currentWallet, supportedIntents } = useCurrentWallet();
|
|
79
|
+
const currentAccount = useCurrentAccount();
|
|
80
|
+
const client = useSuiClient();
|
|
81
|
+
const { mutate: reportTransactionEffects } = useReportTransactionEffects();
|
|
82
|
+
|
|
83
|
+
const executeTransaction: ({
|
|
84
|
+
bytes,
|
|
85
|
+
signature,
|
|
86
|
+
}: {
|
|
87
|
+
bytes: string;
|
|
88
|
+
signature: string;
|
|
89
|
+
}) => Promise<ExecuteTransactionResult> =
|
|
90
|
+
execute ??
|
|
91
|
+
(async ({ bytes, signature }) => {
|
|
92
|
+
const { digest, rawEffects } = await client.executeTransactionBlock({
|
|
93
|
+
transactionBlock: bytes,
|
|
94
|
+
signature,
|
|
95
|
+
options: {
|
|
96
|
+
showRawEffects: true,
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
return {
|
|
101
|
+
digest,
|
|
102
|
+
rawEffects,
|
|
103
|
+
effects: toB64(new Uint8Array(rawEffects!)),
|
|
104
|
+
bytes,
|
|
105
|
+
signature,
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
return useMutation({
|
|
110
|
+
mutationKey: walletMutationKeys.signAndExecuteTransaction(mutationKey),
|
|
111
|
+
mutationFn: async ({ transaction, ...signTransactionArgs }): Promise<Result> => {
|
|
112
|
+
if (!currentWallet) {
|
|
113
|
+
throw new WalletNotConnectedError('No wallet is connected.');
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const signerAccount = signTransactionArgs.account ?? currentAccount;
|
|
117
|
+
if (!signerAccount) {
|
|
118
|
+
throw new WalletNoAccountSelectedError(
|
|
119
|
+
'No wallet account is selected to sign the transaction with.',
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
const chain = signTransactionArgs.chain ?? signerAccount?.chains[0];
|
|
123
|
+
|
|
124
|
+
if (
|
|
125
|
+
!currentWallet.features['sui:signTransaction'] &&
|
|
126
|
+
!currentWallet.features['sui:signTransactionBlock']
|
|
127
|
+
) {
|
|
128
|
+
throw new WalletFeatureNotSupportedError(
|
|
129
|
+
"This wallet doesn't support the `signTransaction` feature.",
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const { signature, bytes } = await signTransaction(currentWallet, {
|
|
134
|
+
...signTransactionArgs,
|
|
135
|
+
transaction: {
|
|
136
|
+
async toJSON() {
|
|
137
|
+
return typeof transaction === 'string'
|
|
138
|
+
? transaction
|
|
139
|
+
: await transaction.toJSON({
|
|
140
|
+
supportedIntents,
|
|
141
|
+
client,
|
|
142
|
+
});
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
account: signerAccount,
|
|
146
|
+
chain: signTransactionArgs.chain ?? signerAccount.chains[0],
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
const result = await executeTransaction({ bytes, signature });
|
|
150
|
+
|
|
151
|
+
let effects: string;
|
|
152
|
+
|
|
153
|
+
if ('effects' in result && result.effects?.bcs) {
|
|
154
|
+
effects = result.effects.bcs;
|
|
155
|
+
} else if ('rawEffects' in result) {
|
|
156
|
+
effects = toB64(new Uint8Array(result.rawEffects!));
|
|
157
|
+
} else {
|
|
158
|
+
throw new Error('Could not parse effects from transaction result.');
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
reportTransactionEffects({ effects, account: signerAccount, chain });
|
|
162
|
+
|
|
163
|
+
return result as Result;
|
|
164
|
+
},
|
|
165
|
+
...mutationOptions,
|
|
166
|
+
});
|
|
167
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// Copyright (c) Mysten Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { Transaction } from '@mysten/sui/transactions';
|
|
5
|
+
import { signTransaction } from '@mysten/wallet-standard';
|
|
6
|
+
import type { SignedTransaction, SuiSignTransactionInput } from '@mysten/wallet-standard';
|
|
7
|
+
import type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query';
|
|
8
|
+
import { useMutation } from '@tanstack/react-query';
|
|
9
|
+
|
|
10
|
+
import { walletMutationKeys } from '../../constants/walletMutationKeys.js';
|
|
11
|
+
import {
|
|
12
|
+
WalletFeatureNotSupportedError,
|
|
13
|
+
WalletNoAccountSelectedError,
|
|
14
|
+
WalletNotConnectedError,
|
|
15
|
+
} from '../../errors/walletErrors.js';
|
|
16
|
+
import type { PartialBy } from '../../types/utilityTypes.js';
|
|
17
|
+
import { useSuiClient } from '../useSuiClient.js';
|
|
18
|
+
import { useCurrentAccount } from './useCurrentAccount.js';
|
|
19
|
+
import { useCurrentWallet } from './useCurrentWallet.js';
|
|
20
|
+
import { useReportTransactionEffects } from './useReportTransactionEffects.js';
|
|
21
|
+
|
|
22
|
+
type UseSignTransactionArgs = PartialBy<
|
|
23
|
+
Omit<SuiSignTransactionInput, 'transaction'>,
|
|
24
|
+
'account' | 'chain'
|
|
25
|
+
> & {
|
|
26
|
+
transaction: Transaction | string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
interface UseSignTransactionResult extends SignedTransaction {
|
|
30
|
+
reportTransactionEffects: (effects: string) => void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
type UseSignTransactionError =
|
|
34
|
+
| WalletFeatureNotSupportedError
|
|
35
|
+
| WalletNoAccountSelectedError
|
|
36
|
+
| WalletNotConnectedError
|
|
37
|
+
| Error;
|
|
38
|
+
|
|
39
|
+
type UseSignTransactionMutationOptions = Omit<
|
|
40
|
+
UseMutationOptions<
|
|
41
|
+
UseSignTransactionResult,
|
|
42
|
+
UseSignTransactionError,
|
|
43
|
+
UseSignTransactionArgs,
|
|
44
|
+
unknown
|
|
45
|
+
>,
|
|
46
|
+
'mutationFn'
|
|
47
|
+
>;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Mutation hook for prompting the user to sign a transaction.
|
|
51
|
+
*/
|
|
52
|
+
export function useSignTransaction({
|
|
53
|
+
mutationKey,
|
|
54
|
+
...mutationOptions
|
|
55
|
+
}: UseSignTransactionMutationOptions = {}): UseMutationResult<
|
|
56
|
+
UseSignTransactionResult,
|
|
57
|
+
UseSignTransactionError,
|
|
58
|
+
UseSignTransactionArgs
|
|
59
|
+
> {
|
|
60
|
+
const { currentWallet } = useCurrentWallet();
|
|
61
|
+
const currentAccount = useCurrentAccount();
|
|
62
|
+
const client = useSuiClient();
|
|
63
|
+
|
|
64
|
+
const { mutate: reportTransactionEffects } = useReportTransactionEffects();
|
|
65
|
+
|
|
66
|
+
return useMutation({
|
|
67
|
+
mutationKey: walletMutationKeys.signTransaction(mutationKey),
|
|
68
|
+
mutationFn: async ({ transaction, ...signTransactionArgs }) => {
|
|
69
|
+
if (!currentWallet) {
|
|
70
|
+
throw new WalletNotConnectedError('No wallet is connected.');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const signerAccount = signTransactionArgs.account ?? currentAccount;
|
|
74
|
+
if (!signerAccount) {
|
|
75
|
+
throw new WalletNoAccountSelectedError(
|
|
76
|
+
'No wallet account is selected to sign the transaction with.',
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (
|
|
81
|
+
!currentWallet.features['sui:signTransaction'] &&
|
|
82
|
+
!currentWallet.features['sui:signTransactionBlock']
|
|
83
|
+
) {
|
|
84
|
+
throw new WalletFeatureNotSupportedError(
|
|
85
|
+
"This wallet doesn't support the `signTransaction` feature.",
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const { bytes, signature } = await signTransaction(currentWallet, {
|
|
90
|
+
...signTransactionArgs,
|
|
91
|
+
transaction: {
|
|
92
|
+
toJSON: async () => {
|
|
93
|
+
return typeof transaction === 'string'
|
|
94
|
+
? transaction
|
|
95
|
+
: await transaction.toJSON({
|
|
96
|
+
supportedIntents: [],
|
|
97
|
+
client,
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
account: signerAccount,
|
|
102
|
+
chain: signTransactionArgs.chain ?? signerAccount.chains[0],
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
return {
|
|
106
|
+
bytes,
|
|
107
|
+
signature,
|
|
108
|
+
reportTransactionEffects: (effects) => {
|
|
109
|
+
reportTransactionEffects({
|
|
110
|
+
effects,
|
|
111
|
+
account: signerAccount,
|
|
112
|
+
chain: signTransactionArgs.chain ?? signerAccount.chains[0],
|
|
113
|
+
});
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
},
|
|
117
|
+
...mutationOptions,
|
|
118
|
+
});
|
|
119
|
+
}
|