@mysten/dapp-kit-react 2.1.0 → 2.1.2

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,4 +1,4 @@
1
- import * as _mysten_dapp_kit_core5 from "@mysten/dapp-kit-core";
1
+ import * as _mysten_dapp_kit_core1 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<_mysten_dapp_kit_core5.DAppKit<any, _mysten_dapp_kit_core5.ClientWithCoreApi> | null>;
9
+ declare const DAppKitContext: react0.Context<_mysten_dapp_kit_core1.DAppKit<any, _mysten_dapp_kit_core1.ClientWithCoreApi> | null>;
10
10
  type DAppKitProviderProps = PropsWithChildren<{
11
11
  dAppKit: DefaultExpectedDppKit;
12
12
  }>;
@@ -24,7 +24,7 @@ type UseWalletsOptions<TDAppKit extends DAppKit> = {
24
24
  };
25
25
  declare function useWallets<TDAppKit extends DAppKit<any> = RegisteredDAppKit>({
26
26
  dAppKit
27
- }?: UseWalletsOptions<TDAppKit>): _mysten_dapp_kit_core5.UiWallet[];
27
+ }?: UseWalletsOptions<TDAppKit>): _mysten_dapp_kit_core1.UiWallet[];
28
28
  //#endregion
29
29
  //#region src/hooks/useWalletConnection.d.ts
30
30
  type UseWalletConnectionOptions<TDAppKit extends DAppKit<any>> = {
@@ -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: _mysten_dapp_kit_core5.UiWallet;
46
- readonly account: _mysten_dapp_kit_core5.UiWalletAccount;
45
+ readonly wallet: _mysten_dapp_kit_core1.UiWallet;
46
+ readonly account: _mysten_dapp_kit_core1.UiWalletAccount;
47
47
  readonly status: "connected";
48
48
  readonly supportedIntents: string[];
49
49
  readonly isConnected: true;
@@ -60,8 +60,17 @@ declare function useWalletConnection<TDAppKit extends DAppKit = RegisteredDAppKi
60
60
  readonly isReconnecting: false;
61
61
  readonly isDisconnected: false;
62
62
  } | {
63
- readonly wallet: _mysten_dapp_kit_core5.UiWallet;
64
- readonly account: _mysten_dapp_kit_core5.UiWalletAccount;
63
+ readonly wallet: null;
64
+ readonly account: null;
65
+ readonly status: "reconnecting";
66
+ readonly supportedIntents: readonly [];
67
+ readonly isConnected: false;
68
+ readonly isConnecting: false;
69
+ readonly isReconnecting: true;
70
+ readonly isDisconnected: false;
71
+ } | {
72
+ readonly wallet: _mysten_dapp_kit_core1.UiWallet;
73
+ readonly account: _mysten_dapp_kit_core1.UiWalletAccount;
65
74
  readonly status: "reconnecting";
66
75
  readonly supportedIntents: string[];
67
76
  readonly isConnected: false;
@@ -76,7 +85,7 @@ type UseCurrentAccountOptions<TDAppKit extends DAppKit> = {
76
85
  };
77
86
  declare function useCurrentAccount<TDAppKit extends DAppKit<any> = RegisteredDAppKit>({
78
87
  dAppKit
79
- }?: UseCurrentAccountOptions<TDAppKit>): _mysten_dapp_kit_core5.UiWalletAccount | null;
88
+ }?: UseCurrentAccountOptions<TDAppKit>): _mysten_dapp_kit_core1.UiWalletAccount | null;
80
89
  //#endregion
81
90
  //#region src/hooks/useCurrentWallet.d.ts
82
91
  type UseCurrentWalletOptions<TDAppKit extends DAppKit> = {
@@ -84,7 +93,7 @@ type UseCurrentWalletOptions<TDAppKit extends DAppKit> = {
84
93
  };
85
94
  declare function useCurrentWallet<TDAppKit extends DAppKit<any> = RegisteredDAppKit>({
86
95
  dAppKit
87
- }?: UseCurrentWalletOptions<TDAppKit>): _mysten_dapp_kit_core5.UiWallet | null;
96
+ }?: UseCurrentWalletOptions<TDAppKit>): _mysten_dapp_kit_core1.UiWallet | null;
88
97
  //#endregion
89
98
  //#region src/hooks/useCurrentClient.d.ts
90
99
  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,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,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,CAAA,OAAA;;;iBCN3D,UAAA,kBAA4B,OAAA,QAAe,iBAAA,CAAA,CAAmB,OAAA,GAAU,QAAA,GAAQ,QAAA;;;KC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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
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.0",
5
+ "version": "2.1.2",
6
6
  "license": "Apache-2.0",
7
7
  "files": [
8
8
  "LICENSE",
@@ -44,7 +44,7 @@
44
44
  "@lit/react": "^1.0.8",
45
45
  "@nanostores/react": "^1.0.0",
46
46
  "nanostores": "^1.3.0",
47
- "@mysten/dapp-kit-core": "^1.4.0"
47
+ "@mysten/dapp-kit-core": "^1.6.0"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "@types/react": ">=17.0.0",