@mysten/dapp-kit-react 2.1.19 → 2.1.20
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/dist/index.d.mts +10 -10
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/docs/actions/connect-wallet.md +2 -4
- package/docs/actions/disconnect-wallet.md +2 -4
- package/docs/actions/sign-and-execute-transaction.md +1 -3
- package/docs/actions/sign-personal-message.md +2 -4
- package/docs/actions/sign-transaction.md +2 -4
- package/docs/actions/switch-account.md +2 -4
- package/docs/actions/switch-network.md +1 -1
- package/docs/index.md +4 -16
- package/docs/llms-index.md +9 -10
- package/docs/react/dapp-kit-provider.md +1 -1
- package/docs/state.md +1 -3
- package/docs/web-components/connect-button.md +1 -1
- package/docs/web-components/connect-modal.md +1 -1
- package/package.json +5 -5
- package/src/hooks/useWalletConnection.ts +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _mysten_dapp_kit_core4 from "@mysten/dapp-kit-core";
|
|
2
2
|
import { DAppKit, DefaultExpectedDppKit, RegisteredDAppKit } from "@mysten/dapp-kit-core";
|
|
3
3
|
import * as react0 from "react";
|
|
4
4
|
import { PropsWithChildren } from "react";
|
|
@@ -6,7 +6,7 @@ import * as nanostores0 from "nanostores";
|
|
|
6
6
|
export * from "@mysten/dapp-kit-core";
|
|
7
7
|
|
|
8
8
|
//#region src/components/DAppKitProvider.d.ts
|
|
9
|
-
declare const DAppKitContext: react0.Context<
|
|
9
|
+
declare const DAppKitContext: react0.Context<_mysten_dapp_kit_core4.DAppKit<any, _mysten_dapp_kit_core4.ClientWithCoreApi> | null>;
|
|
10
10
|
type DAppKitProviderProps = PropsWithChildren<{
|
|
11
11
|
dAppKit: DefaultExpectedDppKit;
|
|
12
12
|
}>;
|
|
@@ -24,13 +24,13 @@ type UseWalletsOptions<TDAppKit extends DAppKit> = {
|
|
|
24
24
|
};
|
|
25
25
|
declare function useWallets<TDAppKit extends DAppKit<any> = RegisteredDAppKit>({
|
|
26
26
|
dAppKit
|
|
27
|
-
}?: UseWalletsOptions<TDAppKit>):
|
|
27
|
+
}?: UseWalletsOptions<TDAppKit>): _mysten_dapp_kit_core4.UiWallet[];
|
|
28
28
|
//#endregion
|
|
29
29
|
//#region src/hooks/useWalletConnection.d.ts
|
|
30
30
|
type UseWalletConnectionOptions<TDAppKit extends DAppKit<any>> = {
|
|
31
31
|
dAppKit?: TDAppKit;
|
|
32
32
|
};
|
|
33
|
-
declare function useWalletConnection<TDAppKit extends DAppKit = RegisteredDAppKit>({
|
|
33
|
+
declare function useWalletConnection<TDAppKit extends DAppKit<any> = RegisteredDAppKit>({
|
|
34
34
|
dAppKit
|
|
35
35
|
}?: UseWalletConnectionOptions<TDAppKit>): {
|
|
36
36
|
readonly wallet: null;
|
|
@@ -42,8 +42,8 @@ declare function useWalletConnection<TDAppKit extends DAppKit = RegisteredDAppKi
|
|
|
42
42
|
readonly isReconnecting: false;
|
|
43
43
|
readonly isDisconnected: true;
|
|
44
44
|
} | {
|
|
45
|
-
readonly wallet:
|
|
46
|
-
readonly account:
|
|
45
|
+
readonly wallet: _mysten_dapp_kit_core4.UiWallet;
|
|
46
|
+
readonly account: _mysten_dapp_kit_core4.UiWalletAccount;
|
|
47
47
|
readonly status: "connected";
|
|
48
48
|
readonly supportedIntents: string[];
|
|
49
49
|
readonly isConnected: true;
|
|
@@ -69,8 +69,8 @@ declare function useWalletConnection<TDAppKit extends DAppKit = RegisteredDAppKi
|
|
|
69
69
|
readonly isReconnecting: true;
|
|
70
70
|
readonly isDisconnected: false;
|
|
71
71
|
} | {
|
|
72
|
-
readonly wallet:
|
|
73
|
-
readonly account:
|
|
72
|
+
readonly wallet: _mysten_dapp_kit_core4.UiWallet;
|
|
73
|
+
readonly account: _mysten_dapp_kit_core4.UiWalletAccount;
|
|
74
74
|
readonly status: "reconnecting";
|
|
75
75
|
readonly supportedIntents: string[];
|
|
76
76
|
readonly isConnected: false;
|
|
@@ -85,7 +85,7 @@ type UseCurrentAccountOptions<TDAppKit extends DAppKit> = {
|
|
|
85
85
|
};
|
|
86
86
|
declare function useCurrentAccount<TDAppKit extends DAppKit<any> = RegisteredDAppKit>({
|
|
87
87
|
dAppKit
|
|
88
|
-
}?: UseCurrentAccountOptions<TDAppKit>):
|
|
88
|
+
}?: UseCurrentAccountOptions<TDAppKit>): _mysten_dapp_kit_core4.UiWalletAccount | null;
|
|
89
89
|
//#endregion
|
|
90
90
|
//#region src/hooks/useCurrentWallet.d.ts
|
|
91
91
|
type UseCurrentWalletOptions<TDAppKit extends DAppKit> = {
|
|
@@ -93,7 +93,7 @@ type UseCurrentWalletOptions<TDAppKit extends DAppKit> = {
|
|
|
93
93
|
};
|
|
94
94
|
declare function useCurrentWallet<TDAppKit extends DAppKit<any> = RegisteredDAppKit>({
|
|
95
95
|
dAppKit
|
|
96
|
-
}?: UseCurrentWalletOptions<TDAppKit>):
|
|
96
|
+
}?: UseCurrentWalletOptions<TDAppKit>): _mysten_dapp_kit_core4.UiWallet | null;
|
|
97
97
|
//#endregion
|
|
98
98
|
//#region src/hooks/useCurrentClient.d.ts
|
|
99
99
|
type UseCurrentClientOptions<TDAppKit extends DAppKit<any>> = {
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/components/DAppKitProvider.tsx","../src/hooks/useDAppKit.ts","../src/hooks/useWallets.ts","../src/hooks/useWalletConnection.ts","../src/hooks/useCurrentAccount.ts","../src/hooks/useCurrentWallet.ts","../src/hooks/useCurrentClient.ts","../src/hooks/useCurrentNetwork.ts"],"mappings":";;;;;;;;cAOa,cAAA,EAAc,MAAA,CAAA,OAAA,CAAA,sBAAA,CAAA,OAAA,MAAoD,sBAAA,CAApD,iBAAA;AAAA,KAEf,oBAAA,GAAuB,iBAAA;EAClC,OAAA,EAAS,qBAAA;AAAA;AAAA,iBAGM,eAAA,CAAA;EAAkB,OAAA;EAAS;AAAA,GAAY,oBAAA,GAAoB,MAAA,CAAA,GAAA,CAAA,OAAA;;;iBCN3D,UAAA,kBAA4B,OAAA,QAAe,iBAAA,CAAA,CAAmB,OAAA,GAAU,QAAA,GAAQ,QAAA;;;KCApF,iBAAA,kBAAmC,OAAA;EAC9C,OAAA,GAAU,QAAA;AAAA;AAAA,iBAGK,UAAA,kBAA4B,OAAA,QAAe,iBAAA,CAAA,CAAA;EAC1D;AAAA,IACE,iBAAA,CAAkB,QAAA,IAAD,sBAAA,CAAe,QAAA;;;KCNvB,0BAAA,kBAA4C,OAAA;EACvD,OAAA,GAAU,QAAA;AAAA;AAAA,iBAGK,mBAAA,kBAAqC,OAAA,
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/components/DAppKitProvider.tsx","../src/hooks/useDAppKit.ts","../src/hooks/useWallets.ts","../src/hooks/useWalletConnection.ts","../src/hooks/useCurrentAccount.ts","../src/hooks/useCurrentWallet.ts","../src/hooks/useCurrentClient.ts","../src/hooks/useCurrentNetwork.ts"],"mappings":";;;;;;;;cAOa,cAAA,EAAc,MAAA,CAAA,OAAA,CAAA,sBAAA,CAAA,OAAA,MAAoD,sBAAA,CAApD,iBAAA;AAAA,KAEf,oBAAA,GAAuB,iBAAA;EAClC,OAAA,EAAS,qBAAA;AAAA;AAAA,iBAGM,eAAA,CAAA;EAAkB,OAAA;EAAS;AAAA,GAAY,oBAAA,GAAoB,MAAA,CAAA,GAAA,CAAA,OAAA;;;iBCN3D,UAAA,kBAA4B,OAAA,QAAe,iBAAA,CAAA,CAAmB,OAAA,GAAU,QAAA,GAAQ,QAAA;;;KCApF,iBAAA,kBAAmC,OAAA;EAC9C,OAAA,GAAU,QAAA;AAAA;AAAA,iBAGK,UAAA,kBAA4B,OAAA,QAAe,iBAAA,CAAA,CAAA;EAC1D;AAAA,IACE,iBAAA,CAAkB,QAAA,IAAD,sBAAA,CAAe,QAAA;;;KCNvB,0BAAA,kBAA4C,OAAA;EACvD,OAAA,GAAU,QAAA;AAAA;AAAA,iBAGK,mBAAA,kBAAqC,OAAA,QAAe,iBAAA,CAAA,CAAA;EACnE;AAAA,IACE,0BAAA,CAA2B,QAAA;EAAA;;;;;;;;;mBAAD,sBAAA,CAAA,QAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KCPjB,wBAAA,kBAA0C,OAAA;EACrD,OAAA,GAAU,QAAA;AAAA;AAAA,iBAGK,iBAAA,kBAAmC,OAAA,QAAe,iBAAA,CAAA,CAAA;EACjE;AAAA,IACE,wBAAA,CAAyB,QAAA,IAAD,sBAAA,CAAe,eAAA;;;KCN9B,uBAAA,kBAAyC,OAAA;EACpD,OAAA,GAAU,QAAA;AAAA;AAAA,iBAGK,gBAAA,kBAAkC,OAAA,QAAe,iBAAA,CAAA,CAAA;EAChE;AAAA,IACE,uBAAA,CAAwB,QAAA,IAAD,sBAAA,CAAe,QAAA;;;KCL7B,uBAAA,kBAAyC,OAAA;EACpD,OAAA,GAAU,QAAA;AAAA;AAAA,iBAGK,gBAAA,kBAAkC,OAAA,QAAe,iBAAA,CAAA,CAAA;EAChE;AAAA,IACE,uBAAA,CAAwB,QAAA,IAEyB,UAAA,CAAW,QAAA;;;KCRnD,wBAAA,kBAA0C,OAAA;EACrD,OAAA,GAAU,QAAA;AAAA;AAAA,iBAGK,iBAAA,kBAAmC,OAAA,QAAe,iBAAA,CAAA,CAAA;EACjE;AAAA,IACE,wBAAA,CAAyB,QAAA,IAAc,WAAA,CAAA,UAAA,CAAA,QAAA"}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/hooks/useWallets.ts","../src/hooks/useWalletConnection.ts","../src/hooks/useCurrentAccount.ts","../src/hooks/useCurrentWallet.ts","../src/hooks/useCurrentClient.ts","../src/hooks/useCurrentNetwork.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { DAppKit, RegisteredDAppKit } from '@mysten/dapp-kit-core';\nimport { useStore } from '@nanostores/react';\nimport { useDAppKit } from './useDAppKit.js';\n\nexport type UseWalletsOptions<TDAppKit extends DAppKit> = {\n\tdAppKit?: TDAppKit;\n};\n\nexport function useWallets<TDAppKit extends DAppKit<any> = RegisteredDAppKit>({\n\tdAppKit,\n}: UseWalletsOptions<TDAppKit> = {}) {\n\tconst instance = useDAppKit(dAppKit);\n\treturn useStore(instance.stores.$wallets);\n}\n","// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { DAppKit, RegisteredDAppKit } from '@mysten/dapp-kit-core';\nimport { useStore } from '@nanostores/react';\nimport { useDAppKit } from './useDAppKit.js';\n\nexport type UseWalletConnectionOptions<TDAppKit extends DAppKit<any>> = {\n\tdAppKit?: TDAppKit;\n};\n\nexport function useWalletConnection<TDAppKit extends DAppKit = RegisteredDAppKit>({\n\tdAppKit,\n}: UseWalletConnectionOptions<TDAppKit> = {}) {\n\tconst instance = useDAppKit(dAppKit);\n\treturn useStore(instance.stores.$connection);\n}\n","// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { DAppKit, RegisteredDAppKit } from '@mysten/dapp-kit-core';\nimport { useWalletConnection } from './useWalletConnection.js';\n\nexport type UseCurrentAccountOptions<TDAppKit extends DAppKit> = {\n\tdAppKit?: TDAppKit;\n};\n\nexport function useCurrentAccount<TDAppKit extends DAppKit<any> = RegisteredDAppKit>({\n\tdAppKit,\n}: UseCurrentAccountOptions<TDAppKit> = {}) {\n\tconst connection = useWalletConnection({ dAppKit });\n\treturn connection.account;\n}\n","// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { DAppKit, RegisteredDAppKit } from '@mysten/dapp-kit-core';\nimport { useWalletConnection } from './useWalletConnection.js';\n\nexport type UseCurrentWalletOptions<TDAppKit extends DAppKit> = {\n\tdAppKit?: TDAppKit;\n};\n\nexport function useCurrentWallet<TDAppKit extends DAppKit<any> = RegisteredDAppKit>({\n\tdAppKit,\n}: UseCurrentWalletOptions<TDAppKit> = {}) {\n\tconst connection = useWalletConnection({ dAppKit });\n\treturn connection.wallet;\n}\n","// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { DAppKit, RegisteredDAppKit } from '@mysten/dapp-kit-core';\nimport { useStore } from '@nanostores/react';\nimport { useDAppKit } from './useDAppKit.js';\n\nexport type UseCurrentClientOptions<TDAppKit extends DAppKit<any>> = {\n\tdAppKit?: TDAppKit;\n};\n\nexport function useCurrentClient<TDAppKit extends DAppKit<any> = RegisteredDAppKit>({\n\tdAppKit,\n}: UseCurrentClientOptions<TDAppKit> = {}) {\n\tconst instance = useDAppKit(dAppKit);\n\treturn useStore(instance.stores.$currentClient) as ReturnType<TDAppKit['getClient']>;\n}\n","// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { DAppKit, RegisteredDAppKit } from '@mysten/dapp-kit-core';\nimport { useDAppKit } from './useDAppKit.js';\nimport { useStore } from '@nanostores/react';\n\nexport type UseCurrentNetworkOptions<TDAppKit extends DAppKit> = {\n\tdAppKit?: TDAppKit;\n};\n\nexport function useCurrentNetwork<TDAppKit extends DAppKit<any> = RegisteredDAppKit>({\n\tdAppKit,\n}: UseCurrentNetworkOptions<TDAppKit> = {}) {\n\tconst instance = useDAppKit(dAppKit);\n\treturn useStore<TDAppKit['stores']['$currentNetwork']>(instance.stores.$currentNetwork);\n}\n"],"mappings":";;;;;;AAWA,SAAgB,WAA8D,EAC7E,YACgC,EAAE,EAAE;AAEpC,QAAO,SADU,WAAW,QAAQ,CACX,OAAO,SAAS;;;;;ACJ1C,SAAgB,
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/hooks/useWallets.ts","../src/hooks/useWalletConnection.ts","../src/hooks/useCurrentAccount.ts","../src/hooks/useCurrentWallet.ts","../src/hooks/useCurrentClient.ts","../src/hooks/useCurrentNetwork.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { DAppKit, RegisteredDAppKit } from '@mysten/dapp-kit-core';\nimport { useStore } from '@nanostores/react';\nimport { useDAppKit } from './useDAppKit.js';\n\nexport type UseWalletsOptions<TDAppKit extends DAppKit> = {\n\tdAppKit?: TDAppKit;\n};\n\nexport function useWallets<TDAppKit extends DAppKit<any> = RegisteredDAppKit>({\n\tdAppKit,\n}: UseWalletsOptions<TDAppKit> = {}) {\n\tconst instance = useDAppKit(dAppKit);\n\treturn useStore(instance.stores.$wallets);\n}\n","// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { DAppKit, RegisteredDAppKit } from '@mysten/dapp-kit-core';\nimport { useStore } from '@nanostores/react';\nimport { useDAppKit } from './useDAppKit.js';\n\nexport type UseWalletConnectionOptions<TDAppKit extends DAppKit<any>> = {\n\tdAppKit?: TDAppKit;\n};\n\nexport function useWalletConnection<TDAppKit extends DAppKit<any> = RegisteredDAppKit>({\n\tdAppKit,\n}: UseWalletConnectionOptions<TDAppKit> = {}) {\n\tconst instance = useDAppKit(dAppKit);\n\treturn useStore(instance.stores.$connection);\n}\n","// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { DAppKit, RegisteredDAppKit } from '@mysten/dapp-kit-core';\nimport { useWalletConnection } from './useWalletConnection.js';\n\nexport type UseCurrentAccountOptions<TDAppKit extends DAppKit> = {\n\tdAppKit?: TDAppKit;\n};\n\nexport function useCurrentAccount<TDAppKit extends DAppKit<any> = RegisteredDAppKit>({\n\tdAppKit,\n}: UseCurrentAccountOptions<TDAppKit> = {}) {\n\tconst connection = useWalletConnection({ dAppKit });\n\treturn connection.account;\n}\n","// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { DAppKit, RegisteredDAppKit } from '@mysten/dapp-kit-core';\nimport { useWalletConnection } from './useWalletConnection.js';\n\nexport type UseCurrentWalletOptions<TDAppKit extends DAppKit> = {\n\tdAppKit?: TDAppKit;\n};\n\nexport function useCurrentWallet<TDAppKit extends DAppKit<any> = RegisteredDAppKit>({\n\tdAppKit,\n}: UseCurrentWalletOptions<TDAppKit> = {}) {\n\tconst connection = useWalletConnection({ dAppKit });\n\treturn connection.wallet;\n}\n","// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { DAppKit, RegisteredDAppKit } from '@mysten/dapp-kit-core';\nimport { useStore } from '@nanostores/react';\nimport { useDAppKit } from './useDAppKit.js';\n\nexport type UseCurrentClientOptions<TDAppKit extends DAppKit<any>> = {\n\tdAppKit?: TDAppKit;\n};\n\nexport function useCurrentClient<TDAppKit extends DAppKit<any> = RegisteredDAppKit>({\n\tdAppKit,\n}: UseCurrentClientOptions<TDAppKit> = {}) {\n\tconst instance = useDAppKit(dAppKit);\n\treturn useStore(instance.stores.$currentClient) as ReturnType<TDAppKit['getClient']>;\n}\n","// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { DAppKit, RegisteredDAppKit } from '@mysten/dapp-kit-core';\nimport { useDAppKit } from './useDAppKit.js';\nimport { useStore } from '@nanostores/react';\n\nexport type UseCurrentNetworkOptions<TDAppKit extends DAppKit> = {\n\tdAppKit?: TDAppKit;\n};\n\nexport function useCurrentNetwork<TDAppKit extends DAppKit<any> = RegisteredDAppKit>({\n\tdAppKit,\n}: UseCurrentNetworkOptions<TDAppKit> = {}) {\n\tconst instance = useDAppKit(dAppKit);\n\treturn useStore<TDAppKit['stores']['$currentNetwork']>(instance.stores.$currentNetwork);\n}\n"],"mappings":";;;;;;AAWA,SAAgB,WAA8D,EAC7E,YACgC,EAAE,EAAE;AAEpC,QAAO,SADU,WAAW,QAAQ,CACX,OAAO,SAAS;;;;;ACJ1C,SAAgB,oBAAuE,EACtF,YACyC,EAAE,EAAE;AAE7C,QAAO,SADU,WAAW,QAAQ,CACX,OAAO,YAAY;;;;;ACL7C,SAAgB,kBAAqE,EACpF,YACuC,EAAE,EAAE;AAE3C,QADmB,oBAAoB,EAAE,SAAS,CAAC,CACjC;;;;;ACJnB,SAAgB,iBAAoE,EACnF,YACsC,EAAE,EAAE;AAE1C,QADmB,oBAAoB,EAAE,SAAS,CAAC,CACjC;;;;;ACHnB,SAAgB,iBAAoE,EACnF,YACsC,EAAE,EAAE;AAE1C,QAAO,SADU,WAAW,QAAQ,CACX,OAAO,eAAe;;;;;ACJhD,SAAgB,kBAAqE,EACpF,YACuC,EAAE,EAAE;AAE3C,QAAO,SADU,WAAW,QAAQ,CAC4B,OAAO,gBAAgB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Connect Wallet
|
|
2
2
|
|
|
3
|
-
> Programmatically connect to a Sui wallet using the dApp Kit connectWallet action.
|
|
3
|
+
> >- Programmatically connect to a Sui wallet using the dApp Kit connectWallet action.
|
|
4
4
|
|
|
5
5
|
The dApp Kit SDK provides an action for wallet connection, allowing users to connect, disconnect,
|
|
6
6
|
and switch between wallets and accounts.
|
|
@@ -18,9 +18,7 @@ The `connectWallet` action prompts a wallet to connect and authorize accounts fo
|
|
|
18
18
|
|
|
19
19
|
```typescript
|
|
20
20
|
|
|
21
|
-
const dAppKit = createDAppKit({
|
|
22
|
-
/* config */
|
|
23
|
-
});
|
|
21
|
+
const dAppKit = createDAppKit({/* config */});
|
|
24
22
|
|
|
25
23
|
// Connect to a specific wallet
|
|
26
24
|
const result = await dAppKit.connectWallet({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Disconnect Wallet
|
|
2
2
|
|
|
3
|
-
> Programmatically disconnect from a Sui wallet using the dApp Kit disconnectWallet action.
|
|
3
|
+
> >- Programmatically disconnect from a Sui wallet using the dApp Kit disconnectWallet action.
|
|
4
4
|
|
|
5
5
|
The `disconnectWallet` action terminates the connection with the currently connected wallet.
|
|
6
6
|
|
|
@@ -19,9 +19,7 @@ The `disconnectWallet` action terminates the connection with the currently conne
|
|
|
19
19
|
|
|
20
20
|
```typescript
|
|
21
21
|
|
|
22
|
-
const dAppKit = createDAppKit({
|
|
23
|
-
/* config */
|
|
24
|
-
});
|
|
22
|
+
const dAppKit = createDAppKit({/* config */});
|
|
25
23
|
|
|
26
24
|
await dAppKit.disconnectWallet();
|
|
27
25
|
```
|
|
@@ -9,9 +9,7 @@ a transaction on the Sui network. This is the most common way to execute transac
|
|
|
9
9
|
|
|
10
10
|
```typescript
|
|
11
11
|
|
|
12
|
-
const dAppKit = createDAppKit({
|
|
13
|
-
/* config */
|
|
14
|
-
});
|
|
12
|
+
const dAppKit = createDAppKit({/* config */});
|
|
15
13
|
|
|
16
14
|
const tx = new Transaction();
|
|
17
15
|
// No need to manually set sender - it's done automatically
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Sign Personal Message
|
|
2
2
|
|
|
3
|
-
> Sign an arbitrary message with the connected wallet for authentication or proof of ownership.
|
|
3
|
+
> >- Sign an arbitrary message with the connected wallet for authentication or proof of ownership.
|
|
4
4
|
|
|
5
5
|
The `signPersonalMessage` action prompts the connected wallet to sign a personal message. This is
|
|
6
6
|
useful for authentication, proof of ownership, or other scenarios where you need cryptographic proof
|
|
@@ -10,9 +10,7 @@ that a user controls a specific account.
|
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
12
|
|
|
13
|
-
const dAppKit = createDAppKit({
|
|
14
|
-
/* config */
|
|
15
|
-
});
|
|
13
|
+
const dAppKit = createDAppKit({/* config */});
|
|
16
14
|
|
|
17
15
|
const message = new TextEncoder().encode('Please sign this message');
|
|
18
16
|
const result = await dAppKit.signPersonalMessage({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Sign Transaction
|
|
2
2
|
|
|
3
|
-
> Sign a Sui transaction without executing it for deferred or multi-signature scenarios.
|
|
3
|
+
> >- Sign a Sui transaction without executing it for deferred or multi-signature scenarios.
|
|
4
4
|
|
|
5
5
|
The `signTransaction` action prompts the connected wallet to sign a transaction without executing
|
|
6
6
|
it. This is useful when you need a signed transaction for later execution or for multi-signature
|
|
@@ -10,9 +10,7 @@ scenarios.
|
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
12
|
|
|
13
|
-
const dAppKit = createDAppKit({
|
|
14
|
-
/* config */
|
|
15
|
-
});
|
|
13
|
+
const dAppKit = createDAppKit({/* config */});
|
|
16
14
|
|
|
17
15
|
const tx = new Transaction();
|
|
18
16
|
// No need to manually set sender - it's done automatically
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Switch Account
|
|
2
2
|
|
|
3
|
-
> Switch the active account in the connected wallet using the dApp Kit switchAccount action.
|
|
3
|
+
> >- Switch the active account in the connected wallet using the dApp Kit switchAccount action.
|
|
4
4
|
|
|
5
5
|
The `switchAccount` action changes the currently selected account to a different account from the
|
|
6
6
|
connected wallet.
|
|
@@ -17,9 +17,7 @@ connected wallet.
|
|
|
17
17
|
|
|
18
18
|
```typescript
|
|
19
19
|
|
|
20
|
-
const dAppKit = createDAppKit({
|
|
21
|
-
/* config */
|
|
22
|
-
});
|
|
20
|
+
const dAppKit = createDAppKit({/* config */});
|
|
23
21
|
|
|
24
22
|
// Switch to a different account
|
|
25
23
|
dAppKit.switchAccount({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Switch Network
|
|
2
2
|
|
|
3
|
-
> Switch the active network for the dApp Kit instance between mainnet, testnet, and other networks.
|
|
3
|
+
> >- Switch the active network for the dApp Kit instance between mainnet, testnet, and other networks.
|
|
4
4
|
|
|
5
5
|
The `switchNetwork` action changes the currently selected network that the dApp Kit client is
|
|
6
6
|
configured to use.
|
package/docs/index.md
CHANGED
|
@@ -52,19 +52,7 @@ Check the framework-specific guides:
|
|
|
52
52
|
- [Next.js](/dapp-kit/getting-started/next-js)
|
|
53
53
|
- [Vue](/dapp-kit/getting-started/vue)
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
See the [Legacy dApp Kit documentation](/dapp-kit/legacy).
|
|
60
|
-
|
|
61
|
-
The original React-focused version of the dApp Kit. This package provides:
|
|
62
|
-
|
|
63
|
-
- React hooks for wallet connection and blockchain queries
|
|
64
|
-
- Pre-built UI components with Radix UI
|
|
65
|
-
- Integration with TanStack React Query
|
|
66
|
-
- Comprehensive wallet state management
|
|
67
|
-
|
|
68
|
-
> **Warning:** **Deprecated JSON RPC Only**: This legacy package only works with the deprecated JSON RPC API and
|
|
69
|
-
> will not be updated to support gRPC or GraphQL. All new projects should use
|
|
70
|
-
> `@mysten/dapp-kit-core` and `@mysten/dapp-kit-react`.
|
|
55
|
+
> **Warning:** **Deprecated JSON RPC Only**: The legacy `@mysten/dapp-kit` package only works with the deprecated
|
|
56
|
+
> JSON RPC API and will not receive further updates. Follow the [migration
|
|
57
|
+
> guide](/sui/migrations/sui-2.0/dapp-kit) to move to `@mysten/dapp-kit-core` and
|
|
58
|
+
> `@mysten/dapp-kit-react`.
|
package/docs/llms-index.md
CHANGED
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
- [Vue](./getting-started/vue.md): Set up dApp Kit in a Vue application
|
|
9
9
|
- [DApp Kit Instance](./dapp-kit-instance.md): Create and configure a DAppKit instance for wallet and client management
|
|
10
10
|
- [State](./state.md): Access and subscribe to wallet connection state in dApp Kit
|
|
11
|
-
- [Connect Wallet](./actions/connect-wallet.md): Programmatically connect to a Sui wallet using the dApp Kit connectWallet action.
|
|
12
|
-
- [Disconnect Wallet](./actions/disconnect-wallet.md): Programmatically disconnect from a Sui wallet using the dApp Kit disconnectWallet action.
|
|
11
|
+
- [Connect Wallet](./actions/connect-wallet.md): >- Programmatically connect to a Sui wallet using the dApp Kit connectWallet action.
|
|
12
|
+
- [Disconnect Wallet](./actions/disconnect-wallet.md): >- Programmatically disconnect from a Sui wallet using the dApp Kit disconnectWallet action.
|
|
13
13
|
- [Sign and Execute Transaction](./actions/sign-and-execute-transaction.md): Sign and execute a transaction on the Sui network using the connected wallet.
|
|
14
|
-
- [Sign Personal Message](./actions/sign-personal-message.md): Sign an arbitrary message with the connected wallet for authentication or proof of ownership.
|
|
15
|
-
- [Sign Transaction](./actions/sign-transaction.md): Sign a Sui transaction without executing it for deferred or multi-signature scenarios.
|
|
16
|
-
- [Switch Account](./actions/switch-account.md): Switch the active account in the connected wallet using the dApp Kit switchAccount action.
|
|
17
|
-
- [Switch Network](./actions/switch-network.md): Switch the active network for the dApp Kit instance between mainnet, testnet, and other networks.
|
|
18
|
-
- [DAppKitProvider](./react/dapp-kit-provider.md): React context provider that makes dApp Kit available throughout your application.
|
|
14
|
+
- [Sign Personal Message](./actions/sign-personal-message.md): >- Sign an arbitrary message with the connected wallet for authentication or proof of ownership.
|
|
15
|
+
- [Sign Transaction](./actions/sign-transaction.md): >- Sign a Sui transaction without executing it for deferred or multi-signature scenarios.
|
|
16
|
+
- [Switch Account](./actions/switch-account.md): >- Switch the active account in the connected wallet using the dApp Kit switchAccount action.
|
|
17
|
+
- [Switch Network](./actions/switch-network.md): >- Switch the active network for the dApp Kit instance between mainnet, testnet, and other networks.
|
|
18
|
+
- [DAppKitProvider](./react/dapp-kit-provider.md): >- React context provider that makes dApp Kit available throughout your application.
|
|
19
19
|
- [React Hooks](./react/hooks.md): React hooks for accessing dApp Kit state and actions in Sui applications.
|
|
20
20
|
- [useDAppKit](./react/hooks/use-dapp-kit.md): React hook to access the full dApp Kit instance for calling actions directly.
|
|
21
21
|
- [useCurrentAccount](./react/hooks/use-current-account.md): React hook to get the currently selected wallet account in a Sui dApp.
|
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
- [React Components](./react/components.md): Pre-built React UI components for wallet interaction in Sui dApps.
|
|
28
28
|
- [Connect Button](./react/components/connect-button.md): React button component for connecting and disconnecting Sui wallets.
|
|
29
29
|
- [Connect Modal](./react/components/connect-modal.md): React modal component for selecting and connecting to a Sui wallet.
|
|
30
|
-
- [Connect Button](./web-components/connect-button.md): Framework-agnostic web component providing a complete wallet connection UI for Sui dApps.
|
|
31
|
-
- [Connect Modal](./web-components/connect-modal.md): Framework-agnostic web component for wallet selection and connection in Sui dApps.
|
|
30
|
+
- [Connect Button](./web-components/connect-button.md): >- Framework-agnostic web component providing a complete wallet connection UI for Sui dApps.
|
|
31
|
+
- [Connect Modal](./web-components/connect-modal.md): >- Framework-agnostic web component for wallet selection and connection in Sui dApps.
|
|
32
32
|
- [Theming](./theming.md): Customize the appearance of dApp Kit UI components.
|
|
33
|
-
- [Sui dApp Kit (Legacy)](./legacy.md): Legacy dApp Kit API reference for the deprecated @mysten/dapp-kit package using JSON RPC.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# DAppKitProvider
|
|
2
2
|
|
|
3
|
-
> React context provider that makes dApp Kit available throughout your application.
|
|
3
|
+
> >- React context provider that makes dApp Kit available throughout your application.
|
|
4
4
|
|
|
5
5
|
The `DAppKitProvider` is a React context provider that makes your dApp Kit instance available
|
|
6
6
|
throughout your React application. It must wrap any components that use dApp Kit hooks.
|
package/docs/state.md
CHANGED
|
@@ -21,9 +21,7 @@ All stores are available through the `dAppKit.stores` property:
|
|
|
21
21
|
|
|
22
22
|
```typescript
|
|
23
23
|
|
|
24
|
-
const dAppKit = createDAppKit({
|
|
25
|
-
/* config */
|
|
26
|
-
});
|
|
24
|
+
const dAppKit = createDAppKit({/* config */});
|
|
27
25
|
|
|
28
26
|
// Access stores
|
|
29
27
|
const connection = dAppKit.stores.$connection.get();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Connect Button
|
|
2
2
|
|
|
3
|
-
> Framework-agnostic web component providing a complete wallet connection UI for Sui dApps.
|
|
3
|
+
> >- Framework-agnostic web component providing a complete wallet connection UI for Sui dApps.
|
|
4
4
|
|
|
5
5
|
The `<mysten-dapp-kit-connect-button>` Web Component provides a complete wallet connection UI. It
|
|
6
6
|
displays a "Connect Wallet" button when no wallet is connected, and shows the connected account with
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Connect Modal
|
|
2
2
|
|
|
3
|
-
> Framework-agnostic web component for wallet selection and connection in Sui dApps.
|
|
3
|
+
> >- Framework-agnostic web component for wallet selection and connection in Sui dApps.
|
|
4
4
|
|
|
5
5
|
The `<mysten-dapp-kit-connect-modal>` Web Component provides a modal dialog for wallet connection.
|
|
6
6
|
While most apps should use the [`Connect Button`](./connect-button) which includes an integrated
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@mysten/dapp-kit-react",
|
|
3
3
|
"author": "Mysten Labs <build@mystenlabs.com>",
|
|
4
4
|
"description": "React bindings for @mysten/dapp-kit-core",
|
|
5
|
-
"version": "2.1.
|
|
5
|
+
"version": "2.1.20",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"files": [
|
|
8
8
|
"LICENSE",
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"tsdown": "0.22.
|
|
41
|
-
"typescript": "^
|
|
40
|
+
"tsdown": "0.22.14",
|
|
41
|
+
"typescript": "^7.0.2"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@lit/react": "^1.0.8",
|
|
45
45
|
"@nanostores/react": "^1.0.0",
|
|
46
|
-
"nanostores": "^1.
|
|
47
|
-
"@mysten/dapp-kit-core": "^1.6.
|
|
46
|
+
"nanostores": "^1.4.2",
|
|
47
|
+
"@mysten/dapp-kit-core": "^1.6.18"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@types/react": ">=17.0.0",
|
|
@@ -9,7 +9,7 @@ export type UseWalletConnectionOptions<TDAppKit extends DAppKit<any>> = {
|
|
|
9
9
|
dAppKit?: TDAppKit;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
export function useWalletConnection<TDAppKit extends DAppKit = RegisteredDAppKit>({
|
|
12
|
+
export function useWalletConnection<TDAppKit extends DAppKit<any> = RegisteredDAppKit>({
|
|
13
13
|
dAppKit,
|
|
14
14
|
}: UseWalletConnectionOptions<TDAppKit> = {}) {
|
|
15
15
|
const instance = useDAppKit(dAppKit);
|