@mysten/dapp-kit-core 1.2.1 → 1.3.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 +26 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +60 -62
- package/dist/index.mjs.map +1 -1
- package/dist/{types-CujIIq_S.d.mts → types-Bk3Btq_s.d.mts} +3 -5
- package/dist/types-Bk3Btq_s.d.mts.map +1 -0
- package/dist/web/index.d.mts +9 -1
- package/dist/web/index.d.mts.map +1 -1
- package/dist/web/index.mjs +16 -1
- package/dist/web/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/core/actions/connect-wallet.ts +10 -2
- package/src/core/actions/switch-account.ts +11 -5
- package/src/core/index.ts +2 -4
- package/src/utils/storage.ts +15 -0
- package/src/web/dapp-kit-connect-button.ts +4 -0
- package/src/web/dapp-kit-connect-modal.ts +4 -0
- package/src/web/internal/button.styles.ts +5 -0
- package/src/web/internal/connected-account-menu.styles.ts +3 -1
- package/src/web/internal/wallet-list-item.styles.ts +1 -0
- package/src/web/styles/icon-button.ts +1 -0
- package/src/web/styles/theme.ts +6 -0
- package/dist/types-CujIIq_S.d.mts.map +0 -1
- package/src/core/initializers/sync-state-to-storage.ts +0 -49
|
@@ -15,6 +15,8 @@ import {
|
|
|
15
15
|
import { WalletAccountNotFoundError, WalletNoAccountsConnectedError } from '../../utils/errors.js';
|
|
16
16
|
import { getChain } from '../../utils/networks.js';
|
|
17
17
|
import type { Networks } from '../../utils/networks.js';
|
|
18
|
+
import type { StateStorage } from '../../utils/storage.js';
|
|
19
|
+
import { saveAccountToStorage } from '../../utils/storage.js';
|
|
18
20
|
|
|
19
21
|
export type ConnectWalletArgs = {
|
|
20
22
|
/** The wallet to connect to. */
|
|
@@ -30,6 +32,7 @@ export type ConnectWalletArgs = {
|
|
|
30
32
|
export function connectWalletCreator(
|
|
31
33
|
{ $baseConnection }: DAppKitStores,
|
|
32
34
|
supportedNetworks: Networks,
|
|
35
|
+
{ storage, storageKey }: { storage: StateStorage; storageKey: string },
|
|
33
36
|
) {
|
|
34
37
|
/**
|
|
35
38
|
* Prompts the specified wallet to connect and authorize new accounts for the current domain.
|
|
@@ -62,12 +65,17 @@ export function connectWalletCreator(
|
|
|
62
65
|
);
|
|
63
66
|
}
|
|
64
67
|
|
|
68
|
+
const selectedAccount = account ?? suiAccounts[0];
|
|
69
|
+
const resolvedIntents = supportedIntents ?? [];
|
|
70
|
+
|
|
65
71
|
$baseConnection.set({
|
|
66
72
|
status: 'connected',
|
|
67
|
-
currentAccount:
|
|
68
|
-
supportedIntents:
|
|
73
|
+
currentAccount: selectedAccount,
|
|
74
|
+
supportedIntents: resolvedIntents,
|
|
69
75
|
});
|
|
70
76
|
|
|
77
|
+
saveAccountToStorage(storage, storageKey, selectedAccount, resolvedIntents);
|
|
78
|
+
|
|
71
79
|
return { accounts: suiAccounts };
|
|
72
80
|
} catch (error) {
|
|
73
81
|
$baseConnection.setKey('status', isAlreadyConnected ? 'connected' : 'disconnected');
|
|
@@ -5,28 +5,34 @@ import type { DAppKitStores } from '../store.js';
|
|
|
5
5
|
import { uiWalletAccountBelongsToUiWallet } from '@wallet-standard/ui';
|
|
6
6
|
import type { UiWalletAccount } from '@wallet-standard/ui';
|
|
7
7
|
import { WalletNotConnectedError, WalletAccountNotFoundError } from '../../utils/errors.js';
|
|
8
|
+
import type { StateStorage } from '../../utils/storage.js';
|
|
9
|
+
import { saveAccountToStorage } from '../../utils/storage.js';
|
|
8
10
|
|
|
9
11
|
export type SwitchAccountArgs = {
|
|
10
12
|
/** The account to switch to. */
|
|
11
13
|
account: UiWalletAccount;
|
|
12
14
|
};
|
|
13
15
|
|
|
14
|
-
export function switchAccountCreator(
|
|
16
|
+
export function switchAccountCreator(
|
|
17
|
+
{ $baseConnection, $connection }: DAppKitStores,
|
|
18
|
+
{ storage, storageKey }: { storage: StateStorage; storageKey: string },
|
|
19
|
+
) {
|
|
15
20
|
/**
|
|
16
21
|
* Switches the currently selected account to the specified account.
|
|
17
22
|
*/
|
|
18
23
|
return function switchAccount({ account }: SwitchAccountArgs) {
|
|
19
|
-
const
|
|
20
|
-
if (!wallet) {
|
|
24
|
+
const connection = $connection.get();
|
|
25
|
+
if (!connection.wallet) {
|
|
21
26
|
throw new WalletNotConnectedError('No wallet is connected.');
|
|
22
27
|
}
|
|
23
28
|
|
|
24
|
-
if (!uiWalletAccountBelongsToUiWallet(account, wallet)) {
|
|
29
|
+
if (!uiWalletAccountBelongsToUiWallet(account, connection.wallet)) {
|
|
25
30
|
throw new WalletAccountNotFoundError(
|
|
26
|
-
`No account with address ${account.address} is connected to ${wallet.name}.`,
|
|
31
|
+
`No account with address ${account.address} is connected to ${connection.wallet.name}.`,
|
|
27
32
|
);
|
|
28
33
|
}
|
|
29
34
|
|
|
30
35
|
$baseConnection.setKey('currentAccount', account);
|
|
36
|
+
saveAccountToStorage(storage, storageKey, account, connection.supportedIntents);
|
|
31
37
|
};
|
|
32
38
|
}
|
package/src/core/index.ts
CHANGED
|
@@ -8,7 +8,6 @@ import { createStores } from './store.js';
|
|
|
8
8
|
import { syncRegisteredWallets } from './initializers/registered-wallets.js';
|
|
9
9
|
import { autoConnectWallet } from './initializers/autoconnect-wallet.js';
|
|
10
10
|
import { createInMemoryStorage, DEFAULT_STORAGE_KEY, getDefaultStorage } from '../utils/storage.js';
|
|
11
|
-
import { syncStateToStorage } from './initializers/sync-state-to-storage.js';
|
|
12
11
|
import { manageWalletConnection } from './initializers/manage-connection.js';
|
|
13
12
|
import { createNetworkConfig } from '../utils/networks.js';
|
|
14
13
|
import type { Networks } from '../utils/networks.js';
|
|
@@ -81,7 +80,6 @@ export function createDAppKit<
|
|
|
81
80
|
}
|
|
82
81
|
|
|
83
82
|
storage ||= createInMemoryStorage();
|
|
84
|
-
syncStateToStorage({ stores, storageKey, storage });
|
|
85
83
|
|
|
86
84
|
syncRegisteredWallets(stores);
|
|
87
85
|
manageWalletConnection(stores);
|
|
@@ -105,9 +103,9 @@ export function createDAppKit<
|
|
|
105
103
|
signTransaction: signTransactionCreator(stores),
|
|
106
104
|
signAndExecuteTransaction: signAndExecuteTransactionCreator(stores),
|
|
107
105
|
signPersonalMessage: signPersonalMessageCreator(stores),
|
|
108
|
-
connectWallet: connectWalletCreator(stores, networks),
|
|
106
|
+
connectWallet: connectWalletCreator(stores, networks, { storage, storageKey }),
|
|
109
107
|
disconnectWallet: disconnectWalletCreator(stores, { storage, storageKey }),
|
|
110
|
-
switchAccount: switchAccountCreator(stores),
|
|
108
|
+
switchAccount: switchAccountCreator(stores, { storage, storageKey }),
|
|
111
109
|
switchNetwork: switchNetworkCreator(stores),
|
|
112
110
|
stores: {
|
|
113
111
|
$wallets: stores.$compatibleWallets,
|
package/src/utils/storage.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// Copyright (c) Mysten Labs, Inc.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import type { UiWalletAccount } from '@wallet-standard/ui';
|
|
5
|
+
import { getWalletUniqueIdentifier } from './wallets.js';
|
|
6
|
+
|
|
4
7
|
export type StateStorage = {
|
|
5
8
|
getItem: (name: string) => string | null | Promise<string | null>;
|
|
6
9
|
setItem: (name: string, value: string) => unknown | Promise<unknown>;
|
|
@@ -28,6 +31,18 @@ export function createInMemoryStorage(): StateStorage {
|
|
|
28
31
|
};
|
|
29
32
|
}
|
|
30
33
|
|
|
34
|
+
export function saveAccountToStorage(
|
|
35
|
+
storage: StateStorage,
|
|
36
|
+
storageKey: string,
|
|
37
|
+
account: UiWalletAccount,
|
|
38
|
+
supportedIntents: string[],
|
|
39
|
+
) {
|
|
40
|
+
const walletId = getWalletUniqueIdentifier(account).replace(':', '_');
|
|
41
|
+
const intents = supportedIntents.join(',');
|
|
42
|
+
const value = [walletId, account.address, intents].join(':');
|
|
43
|
+
storage.setItem(storageKey, value);
|
|
44
|
+
}
|
|
45
|
+
|
|
31
46
|
function isLocalStorageAvailable() {
|
|
32
47
|
try {
|
|
33
48
|
const testKey = '__storage_test__';
|
|
@@ -43,6 +43,10 @@ import type { AccountSelectedEvent } from './internal/connected-account-menu-ite
|
|
|
43
43
|
* @cssprop --font-sans - Font family used for text content.
|
|
44
44
|
* @cssprop --font-weight-medium - Medium font weight for text (typically used for buttons and interactive elements).
|
|
45
45
|
* @cssprop --font-weight-semibold - Semibold font weight for text (typically used for headings or emphasized text).
|
|
46
|
+
* @cssprop --cursor-button - Cursor for button elements (default: `default`). Set to `pointer` for a hand cursor.
|
|
47
|
+
* @cssprop --cursor-menu-item - Cursor for menu items such as wallet list entries (default: `default`).
|
|
48
|
+
* @cssprop --cursor-radio - Cursor for radio inputs such as account selection (default: `default`).
|
|
49
|
+
* @cssprop --cursor-disabled - Cursor for disabled interactive elements (default: `not-allowed`).
|
|
46
50
|
*
|
|
47
51
|
* @csspart trigger - The underlying button element. Use `::part(trigger)` to customize sizing, padding, border-radius, etc.
|
|
48
52
|
*/
|
|
@@ -67,6 +67,10 @@ export type DAppKitConnectModalOptions = {
|
|
|
67
67
|
* @cssprop --font-sans - Font family used for text content.
|
|
68
68
|
* @cssprop --font-weight-medium - Medium font weight for text (typically used for buttons and interactive elements).
|
|
69
69
|
* @cssprop --font-weight-semibold - Semibold font weight for text (typically used for headings or emphasized text).
|
|
70
|
+
* @cssprop --cursor-button - Cursor for button elements (default: `default`). Set to `pointer` for a hand cursor.
|
|
71
|
+
* @cssprop --cursor-menu-item - Cursor for menu items such as wallet list entries (default: `default`).
|
|
72
|
+
* @cssprop --cursor-radio - Cursor for radio inputs such as account selection (default: `default`).
|
|
73
|
+
* @cssprop --cursor-disabled - Cursor for disabled interactive elements (default: `not-allowed`).
|
|
70
74
|
*/
|
|
71
75
|
@customElement('mysten-dapp-kit-connect-modal')
|
|
72
76
|
export class DAppKitConnectModal
|
|
@@ -96,6 +96,7 @@ export const styles = [
|
|
|
96
96
|
height: 48px;
|
|
97
97
|
padding: 16px;
|
|
98
98
|
gap: 8px;
|
|
99
|
+
cursor: var(--dapp-kit-cursor-button);
|
|
99
100
|
}
|
|
100
101
|
|
|
101
102
|
.disconnect-button:hover {
|
|
@@ -143,6 +144,7 @@ export const styles = [
|
|
|
143
144
|
|
|
144
145
|
.copy-address-button {
|
|
145
146
|
display: inline-flex;
|
|
147
|
+
cursor: var(--dapp-kit-cursor-button);
|
|
146
148
|
}
|
|
147
149
|
|
|
148
150
|
.copy-address-button svg {
|
|
@@ -181,7 +183,7 @@ export const styles = [
|
|
|
181
183
|
border-radius: 50%;
|
|
182
184
|
background-color: var(--dapp-kit-input);
|
|
183
185
|
border: 1px solid var(--dapp-kit-input);
|
|
184
|
-
cursor:
|
|
186
|
+
cursor: var(--dapp-kit-cursor-radio);
|
|
185
187
|
position: relative;
|
|
186
188
|
outline: none;
|
|
187
189
|
transition: box-shadow 0.2s;
|
package/src/web/styles/theme.ts
CHANGED
|
@@ -52,5 +52,11 @@ export const themeStyles = css`
|
|
|
52
52
|
);
|
|
53
53
|
--dapp-kit-font-weight-medium: var(--font-medium, 500);
|
|
54
54
|
--dapp-kit-font-weight-semibold: var(--font-semibold, 600);
|
|
55
|
+
|
|
56
|
+
/** Cursors */
|
|
57
|
+
--dapp-kit-cursor-button: var(--cursor-button, default);
|
|
58
|
+
--dapp-kit-cursor-menu-item: var(--cursor-menu-item, default);
|
|
59
|
+
--dapp-kit-cursor-radio: var(--cursor-radio, default);
|
|
60
|
+
--dapp-kit-cursor-disabled: var(--cursor-disabled, not-allowed);
|
|
55
61
|
}
|
|
56
62
|
`;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types-CujIIq_S.d.mts","names":[],"sources":["../src/utils/storage.ts","../src/wallets/index.ts","../src/core/types.ts","../src/utils/networks.ts","../src/core/store.ts","../src/core/actions/connect-wallet.ts","../src/core/actions/switch-account.ts","../src/core/actions/sign-personal-message.ts","../src/utils/transaction-result.ts","../src/core/actions/s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A,aAAA,CAAA;IAAR,eAAA,EUqCpC,YVrCoC,CUqCvB,SVrCuB,CAAA,MAAA,CAAA,CAAA;IAAO,cAAA,EUsC5C,YVtC4C,CUsC/B,MVtC+B,CAAA;;;iBU0C9C,gCACG,WAAW,yBACd,0BAA0B;;;;;;;;;;GAWvC,qBAAqB,WAAW,UAAU,QAAQ,WAAW;;;UCrE/C,QAAA;KAEL,gBAAA;WACF;;iBAA0D;;AZLxD,KYQA,iBAAA,GAAoB,gBZRR,CAAA,SAAA,CAAA;AACoB,KYShC,qBAAA,GACX,OZV2C,CAAA,EAAA,CAAA,SYUvB,iBZVuB,GYUH,OZVG,CAAA,GAAA,CAAA,GYUY,iBZVZ"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Mysten Labs, Inc.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { onMount } from 'nanostores';
|
|
5
|
-
import type { DAppKitStores } from '../store.js';
|
|
6
|
-
import type { StateStorage } from '../../utils/storage.js';
|
|
7
|
-
import type { UiWalletAccount } from '@wallet-standard/ui';
|
|
8
|
-
import { getWalletUniqueIdentifier } from '../../utils/wallets.js';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Syncs the most recently connected wallet name and address to storage.
|
|
12
|
-
*/
|
|
13
|
-
export function syncStateToStorage({
|
|
14
|
-
stores: { $connection },
|
|
15
|
-
storage,
|
|
16
|
-
storageKey,
|
|
17
|
-
}: {
|
|
18
|
-
stores: DAppKitStores;
|
|
19
|
-
storage: StateStorage;
|
|
20
|
-
storageKey: string;
|
|
21
|
-
}) {
|
|
22
|
-
onMount($connection, () => {
|
|
23
|
-
return $connection.listen((connection, oldConnection) => {
|
|
24
|
-
if (!oldConnection || oldConnection.status === connection.status) return;
|
|
25
|
-
|
|
26
|
-
if (connection.account) {
|
|
27
|
-
storage.setItem(
|
|
28
|
-
storageKey,
|
|
29
|
-
getSavedAccountStorageKey(connection.account, connection.supportedIntents),
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
// Storage is cleared by the disconnectWallet action on explicit user
|
|
33
|
-
// disconnect so autoconnect won't reconnect after a page refresh.
|
|
34
|
-
// Wallet *removal* (HMR, React strict mode, effect re-runs) does NOT
|
|
35
|
-
// clear storage — those cases are handled by the $baseConnection /
|
|
36
|
-
// $connection computed split: $baseConnection stays 'connected' while
|
|
37
|
-
// the wallet is temporarily unregistered, and $connection recomputes
|
|
38
|
-
// to 'connected' once the wallet re-appears.
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function getSavedAccountStorageKey(
|
|
44
|
-
account: UiWalletAccount,
|
|
45
|
-
supportedIntents: string[],
|
|
46
|
-
): string {
|
|
47
|
-
const walletIdentifier = getWalletUniqueIdentifier(account);
|
|
48
|
-
return `${walletIdentifier.replace(':', '_')}:${account.address}:${supportedIntents.join(',')}:`;
|
|
49
|
-
}
|