@xyo-network/react-chain-network 1.20.1 → 1.20.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/browser/context/ActiveGatewayProvider.d.ts +8 -0
- package/dist/browser/context/ActiveGatewayProvider.d.ts.map +1 -0
- package/dist/browser/context/index.d.ts +1 -0
- package/dist/browser/context/index.d.ts.map +1 -1
- package/dist/browser/hooks/provider/useActiveNetworkCurrentBlock.d.ts.map +1 -1
- package/dist/browser/hooks/provider/useActiveNetworkNetwork.d.ts.map +1 -1
- package/dist/browser/hooks/provider/useActiveNetworkRunner.d.ts.map +1 -1
- package/dist/browser/hooks/provider/useViewerInPage.d.ts +1 -0
- package/dist/browser/hooks/provider/useViewerInPage.d.ts.map +1 -1
- package/dist/browser/hooks/provider/useViewerInWallet.d.ts +1 -0
- package/dist/browser/hooks/provider/useViewerInWallet.d.ts.map +1 -1
- package/dist/browser/index.mjs +95 -64
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +19 -19
- package/src/context/ActiveGatewayProvider.tsx +19 -0
- package/src/context/index.ts +1 -0
- package/src/hooks/provider/UseViewerInPage.stories.tsx +5 -24
- package/src/hooks/provider/UseViewerInPageV2.stories.tsx +135 -0
- package/src/hooks/provider/useActiveNetworkCurrentBlock.ts +2 -0
- package/src/hooks/provider/useActiveNetworkNetwork.ts +1 -0
- package/src/hooks/provider/useActiveNetworkRunner.ts +1 -0
- package/src/hooks/provider/useViewerInPage.ts +35 -7
- package/src/hooks/provider/useViewerInWallet.ts +1 -0
- package/src/hooks/status/usePollNetworkStatus.ts +1 -1
- package/dist/browser/components/broadcast/details/SummaryStack.stories.d.ts +0 -8
- package/dist/browser/components/broadcast/details/SummaryStack.stories.d.ts.map +0 -1
- package/dist/browser/components/status/Alert.stories.d.ts +0 -10
- package/dist/browser/components/status/Alert.stories.d.ts.map +0 -1
- package/dist/browser/hooks/provider/UseViewerInPage.stories.d.ts +0 -10
- package/dist/browser/hooks/provider/UseViewerInPage.stories.d.ts.map +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AccountInstance } from '@xyo-network/sdk-js';
|
|
2
|
+
import type { PropsWithChildren } from 'react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export interface ActiveGatewayProviderProps extends PropsWithChildren {
|
|
5
|
+
account?: AccountInstance;
|
|
6
|
+
}
|
|
7
|
+
export declare const ActiveGatewayProvider: React.FC<ActiveGatewayProviderProps>;
|
|
8
|
+
//# sourceMappingURL=ActiveGatewayProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActiveGatewayProvider.d.ts","sourceRoot":"","sources":["../../../src/context/ActiveGatewayProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,MAAM,WAAW,0BAA2B,SAAQ,iBAAiB;IACnE,OAAO,CAAC,EAAE,eAAe,CAAA;CAC1B;AAED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAOtE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/context/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/context/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA;AAC3C,cAAc,oBAAoB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useActiveNetworkCurrentBlock.d.ts","sourceRoot":"","sources":["../../../../src/hooks/provider/useActiveNetworkCurrentBlock.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"useActiveNetworkCurrentBlock.d.ts","sourceRoot":"","sources":["../../../../src/hooks/provider/useActiveNetworkCurrentBlock.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAKrD,eAAO,MAAM,4BAA4B,GAAI,gBAAW,EAAE,SAAS,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iGAI3E,CAAA;AAGD,eAAO,MAAM,kCAAkC,GAAI,gBAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iGAK7D,CAAA;AAED,eAAO,MAAM,oCAAoC,GAAI,gBAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iGAK/D,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useActiveNetworkNetwork.d.ts","sourceRoot":"","sources":["../../../../src/hooks/provider/useActiveNetworkNetwork.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useActiveNetworkNetwork.d.ts","sourceRoot":"","sources":["../../../../src/hooks/provider/useActiveNetworkNetwork.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,uBAAuB,4EAInC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useActiveNetworkRunner.d.ts","sourceRoot":"","sources":["../../../../src/hooks/provider/useActiveNetworkRunner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useActiveNetworkRunner.d.ts","sourceRoot":"","sources":["../../../../src/hooks/provider/useActiveNetworkRunner.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,sBAAsB,6aAKlC,CAAA"}
|
|
@@ -4,4 +4,5 @@ import type { NetworkBootstrap } from '@xyo-network/xl1-sdk';
|
|
|
4
4
|
* @returns - XyoViewer for the active network
|
|
5
5
|
*/
|
|
6
6
|
export declare const useViewerInPage: (networkOverride?: NetworkBootstrap) => import("@xyo-network/xl1-sdk").XyoViewer | undefined;
|
|
7
|
+
export declare const useViewerInPageV2: () => import("@xyo-network/xl1-sdk").XyoViewer | undefined;
|
|
7
8
|
//# sourceMappingURL=useViewerInPage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useViewerInPage.d.ts","sourceRoot":"","sources":["../../../../src/hooks/provider/useViewerInPage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useViewerInPage.d.ts","sourceRoot":"","sources":["../../../../src/hooks/provider/useViewerInPage.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAa,MAAM,sBAAsB,CAAA;AAWvE;;;GAGG;AAEH,eAAO,MAAM,eAAe,GAAI,kBAAkB,gBAAgB,yDAsBjE,CAAA;AAED,eAAO,MAAM,iBAAiB,4DAuB7B,CAAA"}
|
|
@@ -2,5 +2,6 @@
|
|
|
2
2
|
* Get the viewer directly from the active network
|
|
3
3
|
* @returns - The viewer for the active network
|
|
4
4
|
*/
|
|
5
|
+
/** @deprecated use useViewerFromGateway in \@xyo-network/react-chain-provider */
|
|
5
6
|
export declare const useViewerInWallet: () => import("@xyo-network/xl1-protocol").XyoViewer | undefined;
|
|
6
7
|
//# sourceMappingURL=useViewerInWallet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useViewerInWallet.d.ts","sourceRoot":"","sources":["../../../../src/hooks/provider/useViewerInWallet.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,eAAO,MAAM,iBAAiB,iEAI7B,CAAA"}
|
|
1
|
+
{"version":3,"file":"useViewerInWallet.d.ts","sourceRoot":"","sources":["../../../../src/hooks/provider/useViewerInWallet.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,iFAAiF;AACjF,eAAO,MAAM,iBAAiB,iEAI7B,CAAA"}
|
package/dist/browser/index.mjs
CHANGED
|
@@ -3,14 +3,18 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3
3
|
|
|
4
4
|
// src/components/broadcast/Drawer.tsx
|
|
5
5
|
import { Box, Button, Drawer, Pagination, Stack as Stack3, Typography as Typography3 } from "@mui/material";
|
|
6
|
-
import
|
|
6
|
+
import React6, { useState as useState7 } from "react";
|
|
7
7
|
|
|
8
8
|
// src/hooks/provider/useActiveNetworkCurrentBlock.ts
|
|
9
9
|
import { useCurrentBlock, useViewerFromWallet as useViewerFromWallet2 } from "@xyo-network/react-chain-provider";
|
|
10
10
|
|
|
11
11
|
// src/hooks/provider/useViewerInPage.ts
|
|
12
12
|
import { isDefined as isDefined2, isNull, isUndefined } from "@xylabs/sdk-js";
|
|
13
|
-
import { useHttpRpcViewer, useViewerFromWallet } from "@xyo-network/react-chain-provider";
|
|
13
|
+
import { useHttpRpcViewer, useProvidedGateway, useViewerFromWallet } from "@xyo-network/react-chain-provider";
|
|
14
|
+
|
|
15
|
+
// src/context/ActiveGatewayProvider.tsx
|
|
16
|
+
import { GatewayProvider } from "@xyo-network/react-chain-provider";
|
|
17
|
+
import React2 from "react";
|
|
14
18
|
|
|
15
19
|
// src/context/network/context.ts
|
|
16
20
|
import { createContextEx } from "@xylabs/react-shared";
|
|
@@ -115,9 +119,18 @@ var ChainNetworkProvider = /* @__PURE__ */ __name(({ children, getActiveNetwork,
|
|
|
115
119
|
import { useContextEx } from "@xylabs/react-shared";
|
|
116
120
|
var useChainNetwork = /* @__PURE__ */ __name((required = true) => useContextEx(ChainNetworkContext, "ChainNetwork", required), "useChainNetwork");
|
|
117
121
|
|
|
122
|
+
// src/context/ActiveGatewayProvider.tsx
|
|
123
|
+
var ActiveGatewayProvider = /* @__PURE__ */ __name(({ account, children }) => {
|
|
124
|
+
const { activeNetwork } = useChainNetwork();
|
|
125
|
+
return /* @__PURE__ */ React2.createElement(GatewayProvider, {
|
|
126
|
+
gatewayName: activeNetwork?.id,
|
|
127
|
+
account
|
|
128
|
+
}, children);
|
|
129
|
+
}, "ActiveGatewayProvider");
|
|
130
|
+
|
|
118
131
|
// src/hooks/provider/useViewerInPage.ts
|
|
119
|
-
var shouldProxy = /* @__PURE__ */ __name((networkSettings,
|
|
120
|
-
return isDefined2(
|
|
132
|
+
var shouldProxy = /* @__PURE__ */ __name((networkSettings, networkId) => {
|
|
133
|
+
return isDefined2(networkId) && isDefined2(networkSettings[networkId]) && networkSettings[networkId].proxy;
|
|
121
134
|
}, "shouldProxy");
|
|
122
135
|
var useViewerInPage = /* @__PURE__ */ __name((networkOverride) => {
|
|
123
136
|
let networkBootstrap;
|
|
@@ -126,7 +139,7 @@ var useViewerInPage = /* @__PURE__ */ __name((networkOverride) => {
|
|
|
126
139
|
const httpRpcViewer = useHttpRpcViewer(networkBootstrap);
|
|
127
140
|
const [walletRpcViewer] = useViewerFromWallet(networkBootstrap?.id);
|
|
128
141
|
if (isUndefined(walletRpcViewer)) return;
|
|
129
|
-
if (shouldProxy(networkSettings, networkBootstrap)) {
|
|
142
|
+
if (shouldProxy(networkSettings, networkBootstrap?.id)) {
|
|
130
143
|
if (isNull(walletRpcViewer)) {
|
|
131
144
|
console.warn(`Network ${networkBootstrap?.id} is set to proxy but no wallet viewer is available, falling back to HTTP RPC viewer`);
|
|
132
145
|
return httpRpcViewer;
|
|
@@ -135,6 +148,22 @@ var useViewerInPage = /* @__PURE__ */ __name((networkOverride) => {
|
|
|
135
148
|
}
|
|
136
149
|
return httpRpcViewer;
|
|
137
150
|
}, "useViewerInPage");
|
|
151
|
+
var useViewerInPageV2 = /* @__PURE__ */ __name(() => {
|
|
152
|
+
const { networkSettings, activeNetwork } = useChainNetwork();
|
|
153
|
+
const { gateways } = useProvidedGateway();
|
|
154
|
+
const { inPageGateway, walletGateway } = gateways;
|
|
155
|
+
const inPageViewer = inPageGateway?.connection?.viewer;
|
|
156
|
+
const walletViewer = walletGateway?.connection?.viewer;
|
|
157
|
+
if (isUndefined(walletGateway)) return;
|
|
158
|
+
if (shouldProxy(networkSettings, activeNetwork?.id)) {
|
|
159
|
+
if (isNull(walletGateway)) {
|
|
160
|
+
console.warn(`Network ${activeNetwork?.id} is set to proxy but no wallet viewer is available, falling back to HTTP RPC viewer`);
|
|
161
|
+
return inPageViewer;
|
|
162
|
+
}
|
|
163
|
+
return walletViewer;
|
|
164
|
+
}
|
|
165
|
+
return inPageViewer;
|
|
166
|
+
}, "useViewerInPageV2");
|
|
138
167
|
|
|
139
168
|
// src/hooks/provider/useActiveNetworkCurrentBlock.ts
|
|
140
169
|
var useActiveNetworkCurrentBlock = /* @__PURE__ */ __name((refresh = 1, viewer) => {
|
|
@@ -259,7 +288,7 @@ var usePollNetworkStatus = /* @__PURE__ */ __name(() => {
|
|
|
259
288
|
setNetworkStatus(response);
|
|
260
289
|
setNetworkStatusError(void 0);
|
|
261
290
|
} catch (error) {
|
|
262
|
-
console.
|
|
291
|
+
console.info("Error fetching network status:", error);
|
|
263
292
|
setNetworkStatus(void 0);
|
|
264
293
|
setNetworkStatusError(error);
|
|
265
294
|
}
|
|
@@ -281,9 +310,9 @@ var usePollNetworkStatus = /* @__PURE__ */ __name(() => {
|
|
|
281
310
|
// src/components/broadcast/CloseDrawerIconButton.tsx
|
|
282
311
|
import { Cancel } from "@mui/icons-material";
|
|
283
312
|
import { IconButton } from "@mui/material";
|
|
284
|
-
import
|
|
313
|
+
import React3 from "react";
|
|
285
314
|
var CloseDrawerIconButton = /* @__PURE__ */ __name(({ anchor, onClose }) => {
|
|
286
|
-
return /* @__PURE__ */
|
|
315
|
+
return /* @__PURE__ */ React3.createElement(IconButton, {
|
|
287
316
|
onClick: /* @__PURE__ */ __name((e) => onClose?.(e, "backdropClick"), "onClick"),
|
|
288
317
|
size: "small",
|
|
289
318
|
sx: {
|
|
@@ -292,7 +321,7 @@ var CloseDrawerIconButton = /* @__PURE__ */ __name(({ anchor, onClose }) => {
|
|
|
292
321
|
right: anchor === "right" ? void 0 : 8,
|
|
293
322
|
left: anchor === "left" ? void 0 : 8
|
|
294
323
|
}
|
|
295
|
-
}, /* @__PURE__ */
|
|
324
|
+
}, /* @__PURE__ */ React3.createElement(Cancel, {
|
|
296
325
|
fontSize: "small"
|
|
297
326
|
}));
|
|
298
327
|
}, "CloseDrawerIconButton");
|
|
@@ -301,7 +330,7 @@ var CloseDrawerIconButton = /* @__PURE__ */ __name(({ anchor, onClose }) => {
|
|
|
301
330
|
import { Card, Collapse, Stack as Stack2, Typography as Typography2 } from "@mui/material";
|
|
302
331
|
import { isDefined as isDefined5 } from "@xylabs/sdk-js";
|
|
303
332
|
import { JsonViewerEx } from "@xyo-network/react-payload-raw-info";
|
|
304
|
-
import
|
|
333
|
+
import React5, { memo, useState as useState5 } from "react";
|
|
305
334
|
|
|
306
335
|
// src/components/broadcast/details/SummaryStack.tsx
|
|
307
336
|
import { ArrowRight, CheckCircle, Warning } from "@mui/icons-material";
|
|
@@ -310,7 +339,7 @@ import { Identicon } from "@xylabs/react-identicon";
|
|
|
310
339
|
import { usePromise as usePromise2 } from "@xylabs/react-promise";
|
|
311
340
|
import { isDefined as isDefined4 } from "@xylabs/sdk-js";
|
|
312
341
|
import { ObjectHasher } from "@xyo-network/hash";
|
|
313
|
-
import
|
|
342
|
+
import React4 from "react";
|
|
314
343
|
var BroadcastedRpcCallDetailsSummaryStack = /* @__PURE__ */ __name(({ expanded, setExpanded, method, timestamp, hasResult, params, ...props }) => {
|
|
315
344
|
const theme = useTheme();
|
|
316
345
|
const [hash, hashError] = usePromise2(async () => {
|
|
@@ -320,55 +349,55 @@ var BroadcastedRpcCallDetailsSummaryStack = /* @__PURE__ */ __name(({ expanded,
|
|
|
320
349
|
}, [
|
|
321
350
|
params
|
|
322
351
|
]);
|
|
323
|
-
return /* @__PURE__ */
|
|
352
|
+
return /* @__PURE__ */ React4.createElement(Stack, {
|
|
324
353
|
direction: "row",
|
|
325
354
|
gap: 2,
|
|
326
355
|
alignItems: "center",
|
|
327
356
|
justifyContent: "space-between",
|
|
328
357
|
...props
|
|
329
|
-
}, /* @__PURE__ */
|
|
358
|
+
}, /* @__PURE__ */ React4.createElement(Stack, {
|
|
330
359
|
direction: "row",
|
|
331
360
|
gap: 2,
|
|
332
361
|
alignItems: "center"
|
|
333
|
-
}, /* @__PURE__ */
|
|
362
|
+
}, /* @__PURE__ */ React4.createElement(IconButton2, {
|
|
334
363
|
size: "small",
|
|
335
364
|
onClick: /* @__PURE__ */ __name(() => setExpanded?.(!expanded), "onClick")
|
|
336
|
-
}, /* @__PURE__ */
|
|
365
|
+
}, /* @__PURE__ */ React4.createElement(ArrowRight, {
|
|
337
366
|
sx: {
|
|
338
367
|
transform: expanded ? "rotate(90deg)" : "rotate(0deg)",
|
|
339
368
|
transition: "transform 0.2s ease-in-out"
|
|
340
369
|
},
|
|
341
370
|
fontSize: "small"
|
|
342
|
-
})), /* @__PURE__ */
|
|
371
|
+
})), /* @__PURE__ */ React4.createElement(Tooltip, {
|
|
343
372
|
title: isDefined4(hashError) ? `Error generating hash of params: ${hashError.message}` : isDefined4(params) ? `Params : ${JSON.stringify(params, null, 2)}` : "No Params Provided"
|
|
344
|
-
}, /* @__PURE__ */
|
|
373
|
+
}, /* @__PURE__ */ React4.createElement(Avatar, {
|
|
345
374
|
sx: {
|
|
346
375
|
backgroundColor: theme.vars?.palette.text.primary,
|
|
347
376
|
width: 20,
|
|
348
377
|
height: 20,
|
|
349
378
|
opacity: isDefined4(hash) ? 1 : 0.5
|
|
350
379
|
}
|
|
351
|
-
}, /* @__PURE__ */
|
|
380
|
+
}, /* @__PURE__ */ React4.createElement(Identicon, {
|
|
352
381
|
value: hash,
|
|
353
382
|
size: 14
|
|
354
|
-
}))), /* @__PURE__ */
|
|
383
|
+
}))), /* @__PURE__ */ React4.createElement(Typography, {
|
|
355
384
|
component: "span",
|
|
356
385
|
variant: "body2",
|
|
357
386
|
fontFamily: "monospace"
|
|
358
|
-
}, method), /* @__PURE__ */
|
|
387
|
+
}, method), /* @__PURE__ */ React4.createElement(Typography, {
|
|
359
388
|
component: "span",
|
|
360
389
|
variant: "caption",
|
|
361
390
|
color: "text.secondary",
|
|
362
391
|
sx: {
|
|
363
392
|
opacity: 0.6
|
|
364
393
|
}
|
|
365
|
-
}, isDefined4(timestamp) ? new Date(timestamp).toLocaleString() : "")), /* @__PURE__ */
|
|
394
|
+
}, isDefined4(timestamp) ? new Date(timestamp).toLocaleString() : "")), /* @__PURE__ */ React4.createElement(Icon, {
|
|
366
395
|
sx: {
|
|
367
396
|
justifySelf: "end"
|
|
368
397
|
}
|
|
369
|
-
}, hasResult ? /* @__PURE__ */
|
|
398
|
+
}, hasResult ? /* @__PURE__ */ React4.createElement(CheckCircle, {
|
|
370
399
|
color: "success"
|
|
371
|
-
}) : /* @__PURE__ */
|
|
400
|
+
}) : /* @__PURE__ */ React4.createElement(Warning, {
|
|
372
401
|
color: "warning"
|
|
373
402
|
})));
|
|
374
403
|
}, "BroadcastedRpcCallDetailsSummaryStack");
|
|
@@ -379,7 +408,7 @@ var BroadcastedRpcCallDetailsCard = /* @__PURE__ */ memo(({ rpcRequestResponsePa
|
|
|
379
408
|
const [expanded, setExpanded] = useState5(false);
|
|
380
409
|
if (!rpcRequestResponsePairs) return null;
|
|
381
410
|
const { request, result, source } = rpcRequestResponsePairs;
|
|
382
|
-
return /* @__PURE__ */
|
|
411
|
+
return /* @__PURE__ */ React5.createElement(Card, {
|
|
383
412
|
sx: {
|
|
384
413
|
p: 1,
|
|
385
414
|
display: "flex",
|
|
@@ -388,42 +417,42 @@ var BroadcastedRpcCallDetailsCard = /* @__PURE__ */ memo(({ rpcRequestResponsePa
|
|
|
388
417
|
...sx
|
|
389
418
|
},
|
|
390
419
|
...props
|
|
391
|
-
}, /* @__PURE__ */
|
|
420
|
+
}, /* @__PURE__ */ React5.createElement(BroadcastedRpcCallDetailsSummaryStack, {
|
|
392
421
|
expanded,
|
|
393
422
|
params: request.rpcCall.params,
|
|
394
423
|
hasResult: isDefined5(result),
|
|
395
424
|
method: request.rpcCall.method,
|
|
396
425
|
setExpanded,
|
|
397
426
|
timestamp: request.timestamp
|
|
398
|
-
}), /* @__PURE__ */
|
|
427
|
+
}), /* @__PURE__ */ React5.createElement(Collapse, {
|
|
399
428
|
in: expanded,
|
|
400
429
|
mountOnEnter: true,
|
|
401
430
|
unmountOnExit: true
|
|
402
|
-
}, /* @__PURE__ */
|
|
431
|
+
}, /* @__PURE__ */ React5.createElement(Stack2, {
|
|
403
432
|
direction: "column",
|
|
404
433
|
p: 1,
|
|
405
434
|
gap: 2,
|
|
406
435
|
alignItems: "stretch"
|
|
407
|
-
}, /* @__PURE__ */
|
|
436
|
+
}, /* @__PURE__ */ React5.createElement(Typography2, {
|
|
408
437
|
variant: "body2"
|
|
409
|
-
}, "Source:", /* @__PURE__ */
|
|
438
|
+
}, "Source:", /* @__PURE__ */ React5.createElement(Typography2, {
|
|
410
439
|
variant: "caption",
|
|
411
440
|
component: "span",
|
|
412
441
|
fontFamily: "monospace",
|
|
413
442
|
sx: {
|
|
414
443
|
ml: 1
|
|
415
444
|
}
|
|
416
|
-
}, source)), /* @__PURE__ */
|
|
445
|
+
}, source)), /* @__PURE__ */ React5.createElement(Typography2, {
|
|
417
446
|
variant: "body2"
|
|
418
|
-
}, "Request:"), /* @__PURE__ */
|
|
447
|
+
}, "Request:"), /* @__PURE__ */ React5.createElement(JsonViewerEx, {
|
|
419
448
|
value: request,
|
|
420
449
|
sx: {
|
|
421
450
|
maxHeight: 300,
|
|
422
451
|
overflow: "auto"
|
|
423
452
|
}
|
|
424
|
-
}), isDefined5(result) ? /* @__PURE__ */
|
|
453
|
+
}), isDefined5(result) ? /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(Typography2, {
|
|
425
454
|
variant: "body2"
|
|
426
|
-
}, "Result:"), /* @__PURE__ */
|
|
455
|
+
}, "Result:"), /* @__PURE__ */ React5.createElement(JsonViewerEx, {
|
|
427
456
|
value: result,
|
|
428
457
|
sx: {
|
|
429
458
|
maxHeight: 300,
|
|
@@ -504,44 +533,44 @@ var usePaginatedEventPairs = /* @__PURE__ */ __name((formattedEvents, numberOfVi
|
|
|
504
533
|
var BroadcastedRpcCallsDrawer = /* @__PURE__ */ __name(({ anchor = "right", onClearEvents, drawerTitle, events, onClose, numberOfVisibleEvents = 25, ...props }) => {
|
|
505
534
|
const [scrollableDiv, setScrollableDiv] = useState7(null);
|
|
506
535
|
const { allEventEntries, visibleEvents, totalPages, effectiveCurrentPage, handleClearEvents, handlePageChange } = usePaginatedEventPairs(events, numberOfVisibleEvents, onClearEvents, scrollableDiv);
|
|
507
|
-
return /* @__PURE__ */
|
|
536
|
+
return /* @__PURE__ */ React6.createElement(Drawer, {
|
|
508
537
|
anchor,
|
|
509
538
|
onClose,
|
|
510
539
|
keepMounted: false,
|
|
511
540
|
...props
|
|
512
|
-
}, /* @__PURE__ */
|
|
541
|
+
}, /* @__PURE__ */ React6.createElement(CloseDrawerIconButton, {
|
|
513
542
|
anchor,
|
|
514
543
|
onClose
|
|
515
|
-
}), /* @__PURE__ */
|
|
544
|
+
}), /* @__PURE__ */ React6.createElement(Stack3, {
|
|
516
545
|
gap: 2,
|
|
517
546
|
sx: {
|
|
518
547
|
p: 3
|
|
519
548
|
},
|
|
520
549
|
flexShrink: 0
|
|
521
|
-
}, /* @__PURE__ */
|
|
550
|
+
}, /* @__PURE__ */ React6.createElement(Stack3, {
|
|
522
551
|
direction: "row",
|
|
523
552
|
justifyContent: "space-between",
|
|
524
553
|
alignItems: "center",
|
|
525
554
|
gap: 4
|
|
526
|
-
}, /* @__PURE__ */
|
|
555
|
+
}, /* @__PURE__ */ React6.createElement(Typography3, {
|
|
527
556
|
variant: "h6"
|
|
528
|
-
}, drawerTitle ?? "Broadcasted RPC Calls"), /* @__PURE__ */
|
|
557
|
+
}, drawerTitle ?? "Broadcasted RPC Calls"), /* @__PURE__ */ React6.createElement(Button, {
|
|
529
558
|
variant: "outlined",
|
|
530
559
|
size: "small",
|
|
531
560
|
onClick: handleClearEvents
|
|
532
|
-
}, "Clear All")), allEventEntries.length > 0 && /* @__PURE__ */
|
|
561
|
+
}, "Clear All")), allEventEntries.length > 0 && /* @__PURE__ */ React6.createElement(Pagination, {
|
|
533
562
|
count: totalPages,
|
|
534
563
|
page: effectiveCurrentPage,
|
|
535
564
|
onChange: handlePageChange,
|
|
536
565
|
color: "primary"
|
|
537
|
-
})), /* @__PURE__ */
|
|
566
|
+
})), /* @__PURE__ */ React6.createElement(Stack3, {
|
|
538
567
|
direction: "column",
|
|
539
568
|
id: "events-container",
|
|
540
569
|
flexGrow: 1,
|
|
541
570
|
sx: {
|
|
542
571
|
overflowY: "hidden"
|
|
543
572
|
}
|
|
544
|
-
}, /* @__PURE__ */
|
|
573
|
+
}, /* @__PURE__ */ React6.createElement(Box, {
|
|
545
574
|
ref: /* @__PURE__ */ __name((el) => setScrollableDiv(el), "ref"),
|
|
546
575
|
sx: {
|
|
547
576
|
overflowY: "auto",
|
|
@@ -549,7 +578,7 @@ var BroadcastedRpcCallsDrawer = /* @__PURE__ */ __name(({ anchor = "right", onCl
|
|
|
549
578
|
pb: 3
|
|
550
579
|
}
|
|
551
580
|
}, visibleEvents.map(([id, broadcastedRpcCall], index) => {
|
|
552
|
-
return /* @__PURE__ */
|
|
581
|
+
return /* @__PURE__ */ React6.createElement(BroadcastedRpcCallDetailsCard, {
|
|
553
582
|
key: id,
|
|
554
583
|
rpcRequestResponsePairs: broadcastedRpcCall,
|
|
555
584
|
sx: {
|
|
@@ -560,7 +589,7 @@ var BroadcastedRpcCallsDrawer = /* @__PURE__ */ __name(({ anchor = "right", onCl
|
|
|
560
589
|
}, "BroadcastedRpcCallsDrawer");
|
|
561
590
|
var BroadcastedRpcCallsDrawerWithEvents = /* @__PURE__ */ __name((props) => {
|
|
562
591
|
const { clearEvents, events } = useRpcBroadcastListener();
|
|
563
|
-
return /* @__PURE__ */
|
|
592
|
+
return /* @__PURE__ */ React6.createElement(BroadcastedRpcCallsDrawer, {
|
|
564
593
|
events,
|
|
565
594
|
onClearEvents: clearEvents,
|
|
566
595
|
...props
|
|
@@ -569,12 +598,12 @@ var BroadcastedRpcCallsDrawerWithEvents = /* @__PURE__ */ __name((props) => {
|
|
|
569
598
|
|
|
570
599
|
// src/components/menu/Avatar.tsx
|
|
571
600
|
import { Avatar as Avatar2 } from "@mui/material";
|
|
572
|
-
import
|
|
601
|
+
import React8 from "react";
|
|
573
602
|
|
|
574
603
|
// src/components/menu/Icon.tsx
|
|
575
|
-
import
|
|
604
|
+
import React7 from "react";
|
|
576
605
|
var NetworkIcon = /* @__PURE__ */ __name(({ icon, style, ...props }) => {
|
|
577
|
-
return /* @__PURE__ */
|
|
606
|
+
return /* @__PURE__ */ React7.createElement("span", {
|
|
578
607
|
// eslint-disable-next-line react-dom/no-dangerously-set-innerhtml
|
|
579
608
|
dangerouslySetInnerHTML: {
|
|
580
609
|
__html: icon ?? ""
|
|
@@ -591,14 +620,14 @@ var NetworkIcon = /* @__PURE__ */ __name(({ icon, style, ...props }) => {
|
|
|
591
620
|
|
|
592
621
|
// src/components/menu/Avatar.tsx
|
|
593
622
|
var NetworkAvatar = /* @__PURE__ */ __name(({ icon, iconStyles, name, sx, ...props }) => {
|
|
594
|
-
return /* @__PURE__ */
|
|
623
|
+
return /* @__PURE__ */ React8.createElement(Avatar2, {
|
|
595
624
|
sx: {
|
|
596
625
|
backgroundColor: "white",
|
|
597
626
|
...sx
|
|
598
627
|
},
|
|
599
628
|
alt: name,
|
|
600
629
|
...props
|
|
601
|
-
}, /* @__PURE__ */
|
|
630
|
+
}, /* @__PURE__ */ React8.createElement(NetworkIcon, {
|
|
602
631
|
icon,
|
|
603
632
|
style: {
|
|
604
633
|
...iconStyles
|
|
@@ -607,7 +636,7 @@ var NetworkAvatar = /* @__PURE__ */ __name(({ icon, iconStyles, name, sx, ...pro
|
|
|
607
636
|
}, "NetworkAvatar");
|
|
608
637
|
var ActiveNetworkAvatar = /* @__PURE__ */ __name((props) => {
|
|
609
638
|
const { activeNetwork } = useChainNetwork();
|
|
610
|
-
return /* @__PURE__ */
|
|
639
|
+
return /* @__PURE__ */ React8.createElement(NetworkAvatar, {
|
|
611
640
|
icon: activeNetwork?.icon,
|
|
612
641
|
name: activeNetwork?.name,
|
|
613
642
|
...props
|
|
@@ -617,14 +646,14 @@ var ActiveNetworkAvatar = /* @__PURE__ */ __name((props) => {
|
|
|
617
646
|
// src/components/menu/MenuItem.tsx
|
|
618
647
|
import { ListItemText } from "@mui/material";
|
|
619
648
|
import { ActiveMenuItem } from "@xyo-network/react-chain-shared";
|
|
620
|
-
import
|
|
649
|
+
import React9 from "react";
|
|
621
650
|
var NetworkMenuItem = /* @__PURE__ */ __name(({ active, network, onClick, updateActiveNetwork, ...props }) => {
|
|
622
651
|
const handleClick = /* @__PURE__ */ __name((event) => {
|
|
623
652
|
if (network === void 0) throw new Error("Network is undefined");
|
|
624
653
|
updateActiveNetwork?.(network.id);
|
|
625
654
|
onClick?.(event);
|
|
626
655
|
}, "handleClick");
|
|
627
|
-
return /* @__PURE__ */
|
|
656
|
+
return /* @__PURE__ */ React9.createElement(ActiveMenuItem, {
|
|
628
657
|
title: network?.name,
|
|
629
658
|
disableRipple: true,
|
|
630
659
|
onClick: handleClick,
|
|
@@ -633,38 +662,38 @@ var NetworkMenuItem = /* @__PURE__ */ __name(({ active, network, onClick, update
|
|
|
633
662
|
py: 1
|
|
634
663
|
},
|
|
635
664
|
...props
|
|
636
|
-
}, /* @__PURE__ */
|
|
665
|
+
}, /* @__PURE__ */ React9.createElement(NetworkAvatar, {
|
|
637
666
|
icon: network?.icon,
|
|
638
667
|
name: network?.name,
|
|
639
668
|
sx: {
|
|
640
669
|
width: 30,
|
|
641
670
|
height: 30
|
|
642
671
|
}
|
|
643
|
-
}), /* @__PURE__ */
|
|
672
|
+
}), /* @__PURE__ */ React9.createElement(ListItemText, null, network?.name));
|
|
644
673
|
}, "NetworkMenuItem");
|
|
645
674
|
|
|
646
675
|
// src/components/status/Alert.tsx
|
|
647
676
|
import { Alert, AlertTitle, Button as Button3 } from "@mui/material";
|
|
648
|
-
import
|
|
677
|
+
import React11, { useMemo as useMemo3, useState as useState8 } from "react";
|
|
649
678
|
|
|
650
679
|
// src/components/status/Dialog.tsx
|
|
651
680
|
import { Button as Button2, Dialog, DialogActions, DialogContent, DialogTitle, List, ListItem, Typography as Typography4 } from "@mui/material";
|
|
652
|
-
import
|
|
681
|
+
import React10 from "react";
|
|
653
682
|
var NetworkStatusDialog = /* @__PURE__ */ __name(({ updates, ...props }) => {
|
|
654
|
-
return /* @__PURE__ */
|
|
683
|
+
return /* @__PURE__ */ React10.createElement(Dialog, props, /* @__PURE__ */ React10.createElement(DialogTitle, null, "Recent Status Updates"), /* @__PURE__ */ React10.createElement(DialogContent, null, /* @__PURE__ */ React10.createElement(List, null, updates.map(({ start, end, update }) => /* @__PURE__ */ React10.createElement(ListItem, {
|
|
655
684
|
key: start + update,
|
|
656
685
|
sx: {
|
|
657
686
|
flexDirection: "column",
|
|
658
687
|
alignItems: "start",
|
|
659
688
|
pl: 0
|
|
660
689
|
}
|
|
661
|
-
}, /* @__PURE__ */
|
|
690
|
+
}, /* @__PURE__ */ React10.createElement(Typography4, null, update), /* @__PURE__ */ React10.createElement(Typography4, {
|
|
662
691
|
gutterBottom: true,
|
|
663
692
|
sx: {
|
|
664
693
|
opacity: 0.75,
|
|
665
694
|
fontSize: ".8333rem"
|
|
666
695
|
}
|
|
667
|
-
}, "Start:", " ", new Date(start).toLocaleString(), " ", /* @__PURE__ */
|
|
696
|
+
}, "Start:", " ", new Date(start).toLocaleString(), " ", /* @__PURE__ */ React10.createElement("br", null), "End:", " ", new Date(end).toLocaleString()))))), /* @__PURE__ */ React10.createElement(DialogActions, null, /* @__PURE__ */ React10.createElement(Button2, {
|
|
668
697
|
onClick: /* @__PURE__ */ __name((e) => props.onClose?.(e, "backdropClick"), "onClick"),
|
|
669
698
|
color: "primary",
|
|
670
699
|
variant: "outlined"
|
|
@@ -694,15 +723,15 @@ var NetworkStatusAlert = /* @__PURE__ */ __name(({ status, ...props }) => {
|
|
|
694
723
|
}, [
|
|
695
724
|
status
|
|
696
725
|
]);
|
|
697
|
-
return /* @__PURE__ */
|
|
726
|
+
return /* @__PURE__ */ React11.createElement(Alert, {
|
|
698
727
|
severity,
|
|
699
728
|
...props
|
|
700
|
-
}, /* @__PURE__ */
|
|
729
|
+
}, /* @__PURE__ */ React11.createElement(AlertTitle, null, status?.description), status?.updates && status.updates.length > 0 ? /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(Button3, {
|
|
701
730
|
color: severity,
|
|
702
731
|
variant: "outlined",
|
|
703
732
|
size: "small",
|
|
704
733
|
onClick: /* @__PURE__ */ __name(() => setOpen(true), "onClick")
|
|
705
|
-
}, "Updates"), /* @__PURE__ */
|
|
734
|
+
}, "Updates"), /* @__PURE__ */ React11.createElement(NetworkStatusDialog, {
|
|
706
735
|
open,
|
|
707
736
|
onClose: handleClose,
|
|
708
737
|
updates: status.updates
|
|
@@ -710,7 +739,7 @@ var NetworkStatusAlert = /* @__PURE__ */ __name(({ status, ...props }) => {
|
|
|
710
739
|
}, "NetworkStatusAlert");
|
|
711
740
|
|
|
712
741
|
// src/components/status/NetworkStatus.tsx
|
|
713
|
-
import
|
|
742
|
+
import React12 from "react";
|
|
714
743
|
var validNetworkStates = /* @__PURE__ */ new Set([
|
|
715
744
|
"online",
|
|
716
745
|
"unknown"
|
|
@@ -718,7 +747,7 @@ var validNetworkStates = /* @__PURE__ */ new Set([
|
|
|
718
747
|
var NetworkStatus = /* @__PURE__ */ __name(({ children, ...props }) => {
|
|
719
748
|
const [networkStatus] = usePollNetworkStatus();
|
|
720
749
|
const showStatus = networkStatus && !validNetworkStates.has(networkStatus.state);
|
|
721
|
-
return /* @__PURE__ */
|
|
750
|
+
return /* @__PURE__ */ React12.createElement(React12.Fragment, null, showStatus ? /* @__PURE__ */ React12.createElement(NetworkStatusAlert, {
|
|
722
751
|
status: networkStatus,
|
|
723
752
|
...props
|
|
724
753
|
}) : null, children);
|
|
@@ -732,6 +761,7 @@ var defaultBroadcastConfig = {
|
|
|
732
761
|
response: true
|
|
733
762
|
};
|
|
734
763
|
export {
|
|
764
|
+
ActiveGatewayProvider,
|
|
735
765
|
ActiveNetworkAvatar,
|
|
736
766
|
BroadcastRpcRequestEventName,
|
|
737
767
|
BroadcastRpcResponseEventName,
|
|
@@ -756,6 +786,7 @@ export {
|
|
|
756
786
|
usePollNetworkStatus,
|
|
757
787
|
useRpcBroadcastListener,
|
|
758
788
|
useViewerInPage,
|
|
789
|
+
useViewerInPageV2,
|
|
759
790
|
useViewerInWallet
|
|
760
791
|
};
|
|
761
792
|
//# sourceMappingURL=index.mjs.map
|