@mysten/dapp-kit-react 2.0.3 → 2.1.1

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 CHANGED
@@ -1,20 +1,19 @@
1
- import * as _mysten_dapp_kit_core4 from "@mysten/dapp-kit-core";
1
+ import * as _mysten_dapp_kit_core6 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";
5
- import * as react_jsx_runtime1 from "react/jsx-runtime";
6
5
  import * as nanostores0 from "nanostores";
7
6
  export * from "@mysten/dapp-kit-core";
8
7
 
9
8
  //#region src/components/DAppKitProvider.d.ts
10
- declare const DAppKitContext: react0.Context<_mysten_dapp_kit_core4.DAppKit<any, _mysten_dapp_kit_core4.ClientWithCoreApi> | null>;
9
+ declare const DAppKitContext: react0.Context<_mysten_dapp_kit_core6.DAppKit<any, _mysten_dapp_kit_core6.ClientWithCoreApi> | null>;
11
10
  type DAppKitProviderProps = PropsWithChildren<{
12
11
  dAppKit: DefaultExpectedDppKit;
13
12
  }>;
14
13
  declare function DAppKitProvider({
15
14
  dAppKit,
16
15
  children
17
- }: DAppKitProviderProps): react_jsx_runtime1.JSX.Element;
16
+ }: DAppKitProviderProps): react0.JSX.Element;
18
17
  //#endregion
19
18
  //#region src/hooks/useDAppKit.d.ts
20
19
  declare function useDAppKit<TDAppKit extends DAppKit<any> = RegisteredDAppKit>(dAppKit?: TDAppKit): TDAppKit;
@@ -25,7 +24,7 @@ type UseWalletsOptions<TDAppKit extends DAppKit> = {
25
24
  };
26
25
  declare function useWallets<TDAppKit extends DAppKit<any> = RegisteredDAppKit>({
27
26
  dAppKit
28
- }?: UseWalletsOptions<TDAppKit>): _mysten_dapp_kit_core4.UiWallet[];
27
+ }?: UseWalletsOptions<TDAppKit>): _mysten_dapp_kit_core6.UiWallet[];
29
28
  //#endregion
30
29
  //#region src/hooks/useWalletConnection.d.ts
31
30
  type UseWalletConnectionOptions<TDAppKit extends DAppKit<any>> = {
@@ -43,8 +42,8 @@ declare function useWalletConnection<TDAppKit extends DAppKit = RegisteredDAppKi
43
42
  readonly isReconnecting: false;
44
43
  readonly isDisconnected: true;
45
44
  } | {
46
- readonly wallet: _mysten_dapp_kit_core4.UiWallet;
47
- readonly account: _mysten_dapp_kit_core4.UiWalletAccount;
45
+ readonly wallet: _mysten_dapp_kit_core6.UiWallet;
46
+ readonly account: _mysten_dapp_kit_core6.UiWalletAccount;
48
47
  readonly status: "connected";
49
48
  readonly supportedIntents: string[];
50
49
  readonly isConnected: true;
@@ -61,8 +60,8 @@ declare function useWalletConnection<TDAppKit extends DAppKit = RegisteredDAppKi
61
60
  readonly isReconnecting: false;
62
61
  readonly isDisconnected: false;
63
62
  } | {
64
- readonly wallet: _mysten_dapp_kit_core4.UiWallet;
65
- readonly account: _mysten_dapp_kit_core4.UiWalletAccount;
63
+ readonly wallet: _mysten_dapp_kit_core6.UiWallet;
64
+ readonly account: _mysten_dapp_kit_core6.UiWalletAccount;
66
65
  readonly status: "reconnecting";
67
66
  readonly supportedIntents: string[];
68
67
  readonly isConnected: false;
@@ -77,7 +76,7 @@ type UseCurrentAccountOptions<TDAppKit extends DAppKit> = {
77
76
  };
78
77
  declare function useCurrentAccount<TDAppKit extends DAppKit<any> = RegisteredDAppKit>({
79
78
  dAppKit
80
- }?: UseCurrentAccountOptions<TDAppKit>): _mysten_dapp_kit_core4.UiWalletAccount | null;
79
+ }?: UseCurrentAccountOptions<TDAppKit>): _mysten_dapp_kit_core6.UiWalletAccount | null;
81
80
  //#endregion
82
81
  //#region src/hooks/useCurrentWallet.d.ts
83
82
  type UseCurrentWalletOptions<TDAppKit extends DAppKit> = {
@@ -85,7 +84,7 @@ type UseCurrentWalletOptions<TDAppKit extends DAppKit> = {
85
84
  };
86
85
  declare function useCurrentWallet<TDAppKit extends DAppKit<any> = RegisteredDAppKit>({
87
86
  dAppKit
88
- }?: UseCurrentWalletOptions<TDAppKit>): _mysten_dapp_kit_core4.UiWallet | null;
87
+ }?: UseCurrentWalletOptions<TDAppKit>): _mysten_dapp_kit_core6.UiWallet | null;
89
88
  //#endregion
90
89
  //#region src/hooks/useCurrentClient.d.ts
91
90
  type UseCurrentClientOptions<TDAppKit extends DAppKit<any>> = {
@@ -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,kBAAA,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,GAAU,iBAAA,CAAA,CAAA;EAC9D;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"}
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,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A,IAAc,WAAA,CAAA,UAAA,CAAA,QAAA"}
package/dist/ui.d.mts CHANGED
@@ -1,5 +1,5 @@
1
+ import * as React from "react";
1
2
  import { ComponentProps } from "react";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
3
3
  import * as _lit_react0 from "@lit/react";
4
4
  import { DAppKitConnectButton, DAppKitConnectModal } from "@mysten/dapp-kit-core/web";
5
5
 
@@ -9,7 +9,7 @@ declare const ConnectButtonComponent: _lit_react0.ReactWebComponent<DAppKitConne
9
9
  declare function ConnectButton({
10
10
  instance,
11
11
  ...props
12
- }: ConnectButtonProps): react_jsx_runtime0.JSX.Element;
12
+ }: ConnectButtonProps): React.JSX.Element;
13
13
  //#endregion
14
14
  //#region src/components/ConnectModal.d.ts
15
15
  type ConnectModalProps = ComponentProps<typeof ConnectModalComponent>;
@@ -17,7 +17,7 @@ declare const ConnectModalComponent: _lit_react0.ReactWebComponent<DAppKitConnec
17
17
  declare function ConnectModal({
18
18
  instance,
19
19
  ...props
20
- }: ConnectModalProps): react_jsx_runtime0.JSX.Element;
20
+ }: ConnectModalProps): React.JSX.Element;
21
21
  //#endregion
22
22
  export { ConnectButton, type ConnectButtonProps, ConnectModal, type ConnectModalProps };
23
23
  //# sourceMappingURL=ui.d.mts.map
package/dist/ui.d.mts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ui.d.mts","names":[],"sources":["../src/components/ConnectButton.tsx","../src/components/ConnectModal.tsx"],"mappings":";;;;;;KASY,kBAAA,GAAqB,cAAA,QAAsB,sBAAA;AAAA,cAEjD,sBAAA,EAAsB,WAAA,CAAA,iBAAA,CAAA,oBAAA;AAAA,iBAMZ,aAAA,CAAA;EAAgB,QAAA;EAAA,GAAa;AAAA,GAAS,kBAAA,GAAkB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;KCR5D,iBAAA,GAAoB,cAAA,QAAsB,qBAAA;AAAA,cAEhD,qBAAA,EAAqB,WAAA,CAAA,iBAAA,CAAA,mBAAA;AAAA,iBAMX,YAAA,CAAA;EAAe,QAAA;EAAA,GAAa;AAAA,GAAS,iBAAA,GAAiB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
1
+ {"version":3,"file":"ui.d.mts","names":[],"sources":["../src/components/ConnectButton.tsx","../src/components/ConnectModal.tsx"],"mappings":";;;;;;KASY,kBAAA,GAAqB,cAAA,QAAsB,sBAAA;AAAA,cAEjD,sBAAA,EAAsB,WAAA,CAAA,iBAAA,CAAA,oBAAA;AAAA,iBAMZ,aAAA,CAAA;EAAgB,QAAA;EAAA,GAAa;AAAA,GAAS,kBAAA,GAAkB,KAAA,CAAA,GAAA,CAAA,OAAA;;;KCR5D,iBAAA,GAAoB,cAAA,QAAsB,qBAAA;AAAA,cAEhD,qBAAA,EAAqB,WAAA,CAAA,iBAAA,CAAA,mBAAA;AAAA,iBAMX,YAAA,CAAA;EAAe,QAAA;EAAA,GAAa;AAAA,GAAS,iBAAA,GAAiB,KAAA,CAAA,GAAA,CAAA,OAAA"}
@@ -32,6 +32,15 @@ console.log('Transaction digest:', result.Transaction.digest);
32
32
 
33
33
  - **`transaction`:** `Transaction | string`: The transaction to sign and execute. Can be either a
34
34
  Transaction instance or base64-encoded bcs bytes for the transaction.
35
+ - **`account`** (optional): `UiWalletAccount`: The account to sign with. Defaults to the currently
36
+ connected account. Must belong to the connected wallet, otherwise a `WalletAccountNotFoundError`
37
+ is thrown. Lets you sign with a specific account without changing the selected account via
38
+ `switchAccount`.
39
+ - **`network`** (optional): The network to sign and execute against (a configured network identifier
40
+ such as `'mainnet'`). Defaults to the active network. The chain and the client used to build the
41
+ transaction are derived from it, so you can target a network without changing the active network
42
+ via `switchNetwork`. Throws a `ChainNotSupportedError` if the signing account does not support the
43
+ network.
35
44
  - **`signal`** (optional): `AbortSignal`: An abort signal to cancel the transaction request.
36
45
 
37
46
  ## Return value
@@ -26,6 +26,15 @@ console.log('Signature:', result.signature);
26
26
  ## Parameters
27
27
 
28
28
  - **`message`:** `Uint8Array` - The message to sign as a byte array
29
+ - **`account`** (optional) - `UiWalletAccount` - The account to sign with. Defaults to the currently
30
+ connected account. Must belong to the connected wallet, otherwise a `WalletAccountNotFoundError`
31
+ is thrown. Lets you sign with a specific account without changing the selected account via
32
+ `switchAccount`.
33
+ - **`network`** (optional) - The network to sign against (a configured network identifier such as
34
+ `'mainnet'`). Defaults to the active network. The signing chain is derived from it, so you can
35
+ sign against a network without changing the active network via `switchNetwork`. Throws a
36
+ `ChainNotSupportedError` if the signing account does not support the network. This matters for
37
+ network-bound signatures such as zkLogin.
29
38
 
30
39
  ## Return value
31
40
 
@@ -28,6 +28,15 @@ const { bytes, signature } = await dAppKit.signTransaction({
28
28
 
29
29
  - **`transaction`:** `Transaction | string` - The transaction to sign. Can be either a Transaction
30
30
  instance or base64-encoded bcs bytes for the transaction.
31
+ - **`account`** (optional) - `UiWalletAccount` - The account to sign with. Defaults to the currently
32
+ connected account. Must belong to the connected wallet, otherwise a `WalletAccountNotFoundError`
33
+ is thrown. Lets you sign with a specific account without changing the selected account via
34
+ `switchAccount`.
35
+ - **`network`** (optional) - The network to sign against (a configured network identifier such as
36
+ `'mainnet'`). Defaults to the active network. The chain and the client used to build the
37
+ transaction are derived from it, so you can sign against a network without changing the active
38
+ network via `switchNetwork`. Throws a `ChainNotSupportedError` if the signing account does not
39
+ support the network.
31
40
  - **`signal`** (optional) - `AbortSignal` - An abort signal to cancel the signing request.
32
41
 
33
42
  ## Return value
@@ -23,7 +23,7 @@ const GRPC_URLS = {
23
23
 
24
24
  > **Note:** If you use the React bindings, there are two ways to ensure type safety with hooks:
25
25
  >
26
- > 1. [Register the global dAppKit type](./getting-started/react#1-create-a-dapp-kit-instance) once, and all hooks will be properly typed
26
+ > 1. [Register the global dAppKit type](./getting-started/react#step-1-create-a-dapp-kit-instance) once, and all hooks will be properly typed
27
27
  > 2. Pass the dAppKit instance explicitly to each hook: `useWalletConnection({ dAppKit })`
28
28
 
29
29
  This instance provides:
@@ -7,7 +7,7 @@ built in.
7
7
 
8
8
  ## Quick start
9
9
 
10
- ```sh npm2yarn
10
+ ```npm
11
11
  npm create @mysten/dapp
12
12
  ```
13
13
 
@@ -7,7 +7,7 @@ rendering (SSR).
7
7
 
8
8
  ## Installation
9
9
 
10
- ```sh npm2yarn
10
+ ```npm
11
11
  npm i @mysten/dapp-kit-react @mysten/sui
12
12
  ```
13
13
 
@@ -8,7 +8,7 @@ This guide walks you through integrating dApp Kit into a React application.
8
8
 
9
9
  The fastest way to get started is using our CLI tool:
10
10
 
11
- ```sh npm2yarn
11
+ ```npm
12
12
  npm create @mysten/dapp
13
13
  ```
14
14
 
@@ -30,7 +30,7 @@ See the [create-dapp guide](/dapp-kit/getting-started/create-dapp) for more deta
30
30
 
31
31
  ## Manual installation
32
32
 
33
- ```sh npm2yarn
33
+ ```npm
34
34
  npm i @mysten/dapp-kit-react @mysten/sui
35
35
  ```
36
36
 
@@ -7,7 +7,7 @@ direct store access.
7
7
 
8
8
  ## Installation
9
9
 
10
- ```sh npm2yarn
10
+ ```npm
11
11
  npm i @mysten/dapp-kit-core @mysten/sui @nanostores/vue
12
12
  ```
13
13
 
package/docs/index.md CHANGED
@@ -34,13 +34,13 @@ Choose the installation method based on your framework:
34
34
 
35
35
  ### For React applications
36
36
 
37
- ```sh npm2yarn
37
+ ```npm
38
38
  npm i @mysten/dapp-kit-react @mysten/sui
39
39
  ```
40
40
 
41
41
  ### Vanilla JavaScript and other frameworks
42
42
 
43
- ```sh npm2yarn
43
+ ```npm
44
44
  npm i @mysten/dapp-kit-core @mysten/sui
45
45
  ```
46
46
 
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.0.3",
5
+ "version": "2.1.1",
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.20.0-beta.1",
41
- "typescript": "^5.9.3"
40
+ "tsdown": "0.22.2",
41
+ "typescript": "^6.0.3"
42
42
  },
43
43
  "dependencies": {
44
44
  "@lit/react": "^1.0.8",
45
45
  "@nanostores/react": "^1.0.0",
46
- "nanostores": "^1.1.0",
47
- "@mysten/dapp-kit-core": "^1.3.2"
46
+ "nanostores": "^1.3.0",
47
+ "@mysten/dapp-kit-core": "^1.5.0"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "@types/react": ">=17.0.0",