@miden-sdk/use-miden-para-react 0.10.10 → 0.13.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/README.md +3 -3
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/useParaMiden.ts +2 -2
package/README.md
CHANGED
|
@@ -12,15 +12,15 @@ npm install @miden-sdk/use-miden-para-react
|
|
|
12
12
|
|
|
13
13
|
`@miden-sdk/use-miden-para-react` expects these packages to be provided by the consuming app. Install matching versions alongside this package to avoid duplicate copies:
|
|
14
14
|
|
|
15
|
-
- `@
|
|
15
|
+
- `@miden-sdk/miden-sdk@^0.13.0`
|
|
16
16
|
- `@getpara/react-sdk-lite@^2.2.0`
|
|
17
|
-
- `@miden-sdk/miden-para@^0.
|
|
17
|
+
- `@miden-sdk/miden-para@^0.13.0`
|
|
18
18
|
- `react@^18.0.0 || ^19.0.0`
|
|
19
19
|
|
|
20
20
|
Example install:
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
yarn add @miden-sdk/use-miden-para-react @
|
|
23
|
+
yarn add @miden-sdk/use-miden-para-react @miden-sdk/miden-sdk@^0.13.0 @getpara/react-sdk-lite@^2.2.0 @miden-sdk/miden-para@^0.13.0 react@^18.0.0
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
## Usage
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _getpara_react_sdk_lite from '@getpara/react-sdk-lite';
|
|
2
|
-
import * as
|
|
2
|
+
import * as _miden_sdk_miden_sdk from '@miden-sdk/miden-sdk';
|
|
3
3
|
import { MidenAccountStorageMode, Opts, CustomSignConfirmStep } from '@miden-sdk/miden-para';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -17,7 +17,7 @@ import { MidenAccountStorageMode, Opts, CustomSignConfirmStep } from '@miden-sdk
|
|
|
17
17
|
* - customSignConfirmStep: optional callback for custom transaction confirmation flows
|
|
18
18
|
*/
|
|
19
19
|
declare function useParaMiden(nodeUrl: string, storageMode?: MidenAccountStorageMode, opts?: Omit<Opts, 'endpoint' | 'type' | 'storageMode'>, showSigningModal?: boolean, customSignConfirmStep?: CustomSignConfirmStep): {
|
|
20
|
-
client:
|
|
20
|
+
client: _miden_sdk_miden_sdk.WebClient | null;
|
|
21
21
|
accountId: string;
|
|
22
22
|
para: _getpara_react_sdk_lite.default | undefined;
|
|
23
23
|
evmWallets: _getpara_react_sdk_lite.AvailableWallet[] | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _getpara_react_sdk_lite from '@getpara/react-sdk-lite';
|
|
2
|
-
import * as
|
|
2
|
+
import * as _miden_sdk_miden_sdk from '@miden-sdk/miden-sdk';
|
|
3
3
|
import { MidenAccountStorageMode, Opts, CustomSignConfirmStep } from '@miden-sdk/miden-para';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -17,7 +17,7 @@ import { MidenAccountStorageMode, Opts, CustomSignConfirmStep } from '@miden-sdk
|
|
|
17
17
|
* - customSignConfirmStep: optional callback for custom transaction confirmation flows
|
|
18
18
|
*/
|
|
19
19
|
declare function useParaMiden(nodeUrl: string, storageMode?: MidenAccountStorageMode, opts?: Omit<Opts, 'endpoint' | 'type' | 'storageMode'>, showSigningModal?: boolean, customSignConfirmStep?: CustomSignConfirmStep): {
|
|
20
|
-
client:
|
|
20
|
+
client: _miden_sdk_miden_sdk.WebClient | null;
|
|
21
21
|
accountId: string;
|
|
22
22
|
para: _getpara_react_sdk_lite.default | undefined;
|
|
23
23
|
evmWallets: _getpara_react_sdk_lite.AvailableWallet[] | undefined;
|
package/dist/index.js
CHANGED
|
@@ -59,7 +59,7 @@ function useParaMiden(nodeUrl, storageMode = "public", opts = {}, showSigningMod
|
|
|
59
59
|
if (!isConnected || !para || !((_a = embedded.wallets) == null ? void 0 : _a.length) || clientRef.current) {
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
|
-
const { AccountType } = await import("@
|
|
62
|
+
const { AccountType } = await import("@miden-sdk/miden-sdk");
|
|
63
63
|
const { client: midenParaClient, accountId: aId } = await (0, import_miden_para.createParaMidenClient)(
|
|
64
64
|
para,
|
|
65
65
|
evmWallets,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/useParaMiden.ts"],"sourcesContent":["export { useParaMiden } from './useParaMiden';\n","'use client';\n\nimport { useClient, useAccount, type Wallet } from '@getpara/react-sdk-lite';\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport {\n createParaMidenClient,\n type Opts,\n type MidenAccountStorageMode,\n type CustomSignConfirmStep,\n} from '@miden-sdk/miden-para';\n\n/**\n * React hook that converts Para React SDK context into a ready-to-use Miden WebClient.\n * Spawns the client once a Para session with at least one EVM wallet is active.\n *\n * Returns:\n * - client: WebClient instance backed by the active Para session (or null while loading)\n * - accountId: Miden account id derived for the selected EVM wallet\n * - para: Para client instance from context\n * - evmWallets: filtered list of Para wallets with type === 'EVM'\n * - nodeUrl: Miden node endpoint used for the client\n * - opts: forwarded options used when creating the client\n * - showSigningModal: toggles the built-in signing modal\n * - customSignConfirmStep: optional callback for custom transaction confirmation flows\n */\nexport function useParaMiden(\n nodeUrl: string,\n storageMode: MidenAccountStorageMode = 'public',\n opts: Omit<Opts, 'endpoint' | 'type' | 'storageMode'> = {},\n showSigningModal: boolean = true,\n customSignConfirmStep?: CustomSignConfirmStep\n) {\n const para = useClient();\n const { isConnected, embedded } = useAccount();\n const clientRef = useRef<import('@
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/useParaMiden.ts"],"sourcesContent":["export { useParaMiden } from './useParaMiden';\n","'use client';\n\nimport { useClient, useAccount, type Wallet } from '@getpara/react-sdk-lite';\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport {\n createParaMidenClient,\n type Opts,\n type MidenAccountStorageMode,\n type CustomSignConfirmStep,\n} from '@miden-sdk/miden-para';\n\n/**\n * React hook that converts Para React SDK context into a ready-to-use Miden WebClient.\n * Spawns the client once a Para session with at least one EVM wallet is active.\n *\n * Returns:\n * - client: WebClient instance backed by the active Para session (or null while loading)\n * - accountId: Miden account id derived for the selected EVM wallet\n * - para: Para client instance from context\n * - evmWallets: filtered list of Para wallets with type === 'EVM'\n * - nodeUrl: Miden node endpoint used for the client\n * - opts: forwarded options used when creating the client\n * - showSigningModal: toggles the built-in signing modal\n * - customSignConfirmStep: optional callback for custom transaction confirmation flows\n */\nexport function useParaMiden(\n nodeUrl: string,\n storageMode: MidenAccountStorageMode = 'public',\n opts: Omit<Opts, 'endpoint' | 'type' | 'storageMode'> = {},\n showSigningModal: boolean = true,\n customSignConfirmStep?: CustomSignConfirmStep\n) {\n const para = useClient();\n const { isConnected, embedded } = useAccount();\n const clientRef = useRef<import('@miden-sdk/miden-sdk').WebClient | null>(\n null\n );\n const [accountId, setAccountId] = useState<string>('');\n\n const evmWallets = useMemo(\n () => embedded.wallets?.filter((wallet) => wallet.type === 'EVM'),\n [embedded.wallets]\n );\n\n useEffect(() => {\n let cancelled = false;\n\n async function setupClient() {\n if (\n !isConnected ||\n !para ||\n !embedded.wallets?.length ||\n clientRef.current\n ) {\n return;\n }\n\n const { AccountType } = await import('@miden-sdk/miden-sdk');\n\n const { client: midenParaClient, accountId: aId } =\n await createParaMidenClient(\n para,\n evmWallets as Wallet[],\n {\n ...opts,\n endpoint: nodeUrl,\n type: AccountType.RegularAccountImmutableCode,\n storageMode,\n },\n showSigningModal,\n customSignConfirmStep\n );\n\n if (cancelled) {\n return;\n }\n\n clientRef.current = midenParaClient;\n setAccountId(aId);\n }\n\n setupClient();\n\n return () => {\n cancelled = true;\n };\n }, [\n isConnected,\n evmWallets,\n para,\n nodeUrl,\n showSigningModal,\n customSignConfirmStep,\n ]);\n\n return {\n client: clientRef.current,\n accountId,\n para,\n evmWallets,\n nodeUrl,\n opts,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,4BAAmD;AACnD,mBAAqD;AACrD,wBAKO;AAgBA,SAAS,aACd,SACA,cAAuC,UACvC,OAAwD,CAAC,GACzD,mBAA4B,MAC5B,uBACA;AACA,QAAM,WAAO,iCAAU;AACvB,QAAM,EAAE,aAAa,SAAS,QAAI,kCAAW;AAC7C,QAAM,gBAAY;AAAA,IAChB;AAAA,EACF;AACA,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAiB,EAAE;AAErD,QAAM,iBAAa;AAAA,IACjB,MAAG;AAxCP;AAwCU,4BAAS,YAAT,mBAAkB,OAAO,CAAC,WAAW,OAAO,SAAS;AAAA;AAAA,IAC3D,CAAC,SAAS,OAAO;AAAA,EACnB;AAEA,8BAAU,MAAM;AACd,QAAI,YAAY;AAEhB,mBAAe,cAAc;AA/CjC;AAgDM,UACE,CAAC,eACD,CAAC,QACD,GAAC,cAAS,YAAT,mBAAkB,WACnB,UAAU,SACV;AACA;AAAA,MACF;AAEA,YAAM,EAAE,YAAY,IAAI,MAAM,OAAO,sBAAsB;AAE3D,YAAM,EAAE,QAAQ,iBAAiB,WAAW,IAAI,IAC9C,UAAM;AAAA,QACJ;AAAA,QACA;AAAA,QACA;AAAA,UACE,GAAG;AAAA,UACH,UAAU;AAAA,UACV,MAAM,YAAY;AAAA,UAClB;AAAA,QACF;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAEF,UAAI,WAAW;AACb;AAAA,MACF;AAEA,gBAAU,UAAU;AACpB,mBAAa,GAAG;AAAA,IAClB;AAEA,gBAAY;AAEZ,WAAO,MAAM;AACX,kBAAY;AAAA,IACd;AAAA,EACF,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL,QAAQ,UAAU;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
package/dist/index.mjs
CHANGED
|
@@ -25,7 +25,7 @@ function useParaMiden(nodeUrl, storageMode = "public", opts = {}, showSigningMod
|
|
|
25
25
|
if (!isConnected || !para || !((_a = embedded.wallets) == null ? void 0 : _a.length) || clientRef.current) {
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
|
-
const { AccountType } = await import("@
|
|
28
|
+
const { AccountType } = await import("@miden-sdk/miden-sdk");
|
|
29
29
|
const { client: midenParaClient, accountId: aId } = await createParaMidenClient(
|
|
30
30
|
para,
|
|
31
31
|
evmWallets,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/useParaMiden.ts"],"sourcesContent":["'use client';\n\nimport { useClient, useAccount, type Wallet } from '@getpara/react-sdk-lite';\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport {\n createParaMidenClient,\n type Opts,\n type MidenAccountStorageMode,\n type CustomSignConfirmStep,\n} from '@miden-sdk/miden-para';\n\n/**\n * React hook that converts Para React SDK context into a ready-to-use Miden WebClient.\n * Spawns the client once a Para session with at least one EVM wallet is active.\n *\n * Returns:\n * - client: WebClient instance backed by the active Para session (or null while loading)\n * - accountId: Miden account id derived for the selected EVM wallet\n * - para: Para client instance from context\n * - evmWallets: filtered list of Para wallets with type === 'EVM'\n * - nodeUrl: Miden node endpoint used for the client\n * - opts: forwarded options used when creating the client\n * - showSigningModal: toggles the built-in signing modal\n * - customSignConfirmStep: optional callback for custom transaction confirmation flows\n */\nexport function useParaMiden(\n nodeUrl: string,\n storageMode: MidenAccountStorageMode = 'public',\n opts: Omit<Opts, 'endpoint' | 'type' | 'storageMode'> = {},\n showSigningModal: boolean = true,\n customSignConfirmStep?: CustomSignConfirmStep\n) {\n const para = useClient();\n const { isConnected, embedded } = useAccount();\n const clientRef = useRef<import('@
|
|
1
|
+
{"version":3,"sources":["../src/useParaMiden.ts"],"sourcesContent":["'use client';\n\nimport { useClient, useAccount, type Wallet } from '@getpara/react-sdk-lite';\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport {\n createParaMidenClient,\n type Opts,\n type MidenAccountStorageMode,\n type CustomSignConfirmStep,\n} from '@miden-sdk/miden-para';\n\n/**\n * React hook that converts Para React SDK context into a ready-to-use Miden WebClient.\n * Spawns the client once a Para session with at least one EVM wallet is active.\n *\n * Returns:\n * - client: WebClient instance backed by the active Para session (or null while loading)\n * - accountId: Miden account id derived for the selected EVM wallet\n * - para: Para client instance from context\n * - evmWallets: filtered list of Para wallets with type === 'EVM'\n * - nodeUrl: Miden node endpoint used for the client\n * - opts: forwarded options used when creating the client\n * - showSigningModal: toggles the built-in signing modal\n * - customSignConfirmStep: optional callback for custom transaction confirmation flows\n */\nexport function useParaMiden(\n nodeUrl: string,\n storageMode: MidenAccountStorageMode = 'public',\n opts: Omit<Opts, 'endpoint' | 'type' | 'storageMode'> = {},\n showSigningModal: boolean = true,\n customSignConfirmStep?: CustomSignConfirmStep\n) {\n const para = useClient();\n const { isConnected, embedded } = useAccount();\n const clientRef = useRef<import('@miden-sdk/miden-sdk').WebClient | null>(\n null\n );\n const [accountId, setAccountId] = useState<string>('');\n\n const evmWallets = useMemo(\n () => embedded.wallets?.filter((wallet) => wallet.type === 'EVM'),\n [embedded.wallets]\n );\n\n useEffect(() => {\n let cancelled = false;\n\n async function setupClient() {\n if (\n !isConnected ||\n !para ||\n !embedded.wallets?.length ||\n clientRef.current\n ) {\n return;\n }\n\n const { AccountType } = await import('@miden-sdk/miden-sdk');\n\n const { client: midenParaClient, accountId: aId } =\n await createParaMidenClient(\n para,\n evmWallets as Wallet[],\n {\n ...opts,\n endpoint: nodeUrl,\n type: AccountType.RegularAccountImmutableCode,\n storageMode,\n },\n showSigningModal,\n customSignConfirmStep\n );\n\n if (cancelled) {\n return;\n }\n\n clientRef.current = midenParaClient;\n setAccountId(aId);\n }\n\n setupClient();\n\n return () => {\n cancelled = true;\n };\n }, [\n isConnected,\n evmWallets,\n para,\n nodeUrl,\n showSigningModal,\n customSignConfirmStep,\n ]);\n\n return {\n client: clientRef.current,\n accountId,\n para,\n evmWallets,\n nodeUrl,\n opts,\n };\n}\n"],"mappings":";AAEA,SAAS,WAAW,kBAA+B;AACnD,SAAS,WAAW,SAAS,QAAQ,gBAAgB;AACrD;AAAA,EACE;AAAA,OAIK;AAgBA,SAAS,aACd,SACA,cAAuC,UACvC,OAAwD,CAAC,GACzD,mBAA4B,MAC5B,uBACA;AACA,QAAM,OAAO,UAAU;AACvB,QAAM,EAAE,aAAa,SAAS,IAAI,WAAW;AAC7C,QAAM,YAAY;AAAA,IAChB;AAAA,EACF;AACA,QAAM,CAAC,WAAW,YAAY,IAAI,SAAiB,EAAE;AAErD,QAAM,aAAa;AAAA,IACjB,MAAG;AAxCP;AAwCU,4BAAS,YAAT,mBAAkB,OAAO,CAAC,WAAW,OAAO,SAAS;AAAA;AAAA,IAC3D,CAAC,SAAS,OAAO;AAAA,EACnB;AAEA,YAAU,MAAM;AACd,QAAI,YAAY;AAEhB,mBAAe,cAAc;AA/CjC;AAgDM,UACE,CAAC,eACD,CAAC,QACD,GAAC,cAAS,YAAT,mBAAkB,WACnB,UAAU,SACV;AACA;AAAA,MACF;AAEA,YAAM,EAAE,YAAY,IAAI,MAAM,OAAO,sBAAsB;AAE3D,YAAM,EAAE,QAAQ,iBAAiB,WAAW,IAAI,IAC9C,MAAM;AAAA,QACJ;AAAA,QACA;AAAA,QACA;AAAA,UACE,GAAG;AAAA,UACH,UAAU;AAAA,UACV,MAAM,YAAY;AAAA,UAClB;AAAA,QACF;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAEF,UAAI,WAAW;AACb;AAAA,MACF;AAEA,gBAAU,UAAU;AACpB,mBAAa,GAAG;AAAA,IAClB;AAEA,gBAAY;AAEZ,WAAO,MAAM;AACX,kBAAY;AAAA,IACd;AAAA,EACF,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL,QAAQ,UAAU;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@miden-sdk/use-miden-para-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "React hook that wires Para accounts into a Miden client",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Miden Labs",
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
"publish": "npm run build && npm publish --access public"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@
|
|
39
|
+
"@miden-sdk/miden-sdk": "^0.13.0",
|
|
40
40
|
"@getpara/react-sdk-lite": "^2.2.0",
|
|
41
|
-
"@miden-sdk/miden-para": "^0.
|
|
41
|
+
"@miden-sdk/miden-para": "^0.13.0",
|
|
42
42
|
"react": "^18.0.0 || ^19.0.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@
|
|
45
|
+
"@miden-sdk/miden-sdk": "^0.13.0",
|
|
46
46
|
"@types/react": "^19.2.5",
|
|
47
47
|
"tsup": "^8.3.0",
|
|
48
48
|
"typescript": "^5.9.3",
|
package/src/useParaMiden.ts
CHANGED
|
@@ -32,7 +32,7 @@ export function useParaMiden(
|
|
|
32
32
|
) {
|
|
33
33
|
const para = useClient();
|
|
34
34
|
const { isConnected, embedded } = useAccount();
|
|
35
|
-
const clientRef = useRef<import('@
|
|
35
|
+
const clientRef = useRef<import('@miden-sdk/miden-sdk').WebClient | null>(
|
|
36
36
|
null
|
|
37
37
|
);
|
|
38
38
|
const [accountId, setAccountId] = useState<string>('');
|
|
@@ -55,7 +55,7 @@ export function useParaMiden(
|
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
const { AccountType } = await import('@
|
|
58
|
+
const { AccountType } = await import('@miden-sdk/miden-sdk');
|
|
59
59
|
|
|
60
60
|
const { client: midenParaClient, accountId: aId } =
|
|
61
61
|
await createParaMidenClient(
|