@xyo-network/xl1-react-client-sdk 5.6.1 → 5.7.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 +18 -0
- package/dist/browser/client/components/connected/ConnectAccountsStack.d.ts +44 -20
- package/dist/browser/client/components/connected/ConnectAccountsStack.d.ts.map +1 -1
- package/dist/browser/client/components/connected/hooks/useConnectAccount.d.ts +49 -16
- package/dist/browser/client/components/connected/hooks/useConnectAccount.d.ts.map +1 -1
- package/dist/browser/client/hooks/client/permissions/index.d.ts +1 -0
- package/dist/browser/client/hooks/client/permissions/index.d.ts.map +1 -1
- package/dist/browser/client/hooks/client/permissions/useGrantedAccounts.d.ts +38 -0
- package/dist/browser/client/hooks/client/permissions/useGrantedAccounts.d.ts.map +1 -0
- package/dist/browser/client/hooks/client/permissions/usePermissionsAccounts.d.ts +5 -1
- package/dist/browser/client/hooks/client/permissions/usePermissionsAccounts.d.ts.map +1 -1
- package/dist/browser/client/index.mjs +303 -197
- package/dist/browser/client/index.mjs.map +4 -4
- package/dist/browser/index.mjs +308 -202
- package/dist/browser/index.mjs.map +4 -4
- package/package.json +6 -6
|
@@ -34,7 +34,7 @@ var ConnectedAccount = ({ address }) => {
|
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
// src/client/components/connected/ApprovedLakeSelector.tsx
|
|
37
|
-
import { isDefined as
|
|
37
|
+
import { isDefined as isDefined4, isDefinedNotNull as isDefinedNotNull2 } from "@ariestools/sdk";
|
|
38
38
|
import { ButtonEx } from "@ariestools/sdk-react";
|
|
39
39
|
import {
|
|
40
40
|
Alert,
|
|
@@ -46,9 +46,9 @@ import {
|
|
|
46
46
|
Typography as Typography2
|
|
47
47
|
} from "@mui/material";
|
|
48
48
|
import {
|
|
49
|
-
useCallback,
|
|
50
|
-
useEffect as
|
|
51
|
-
useState as
|
|
49
|
+
useCallback as useCallback2,
|
|
50
|
+
useEffect as useEffect3,
|
|
51
|
+
useState as useState3
|
|
52
52
|
} from "react";
|
|
53
53
|
|
|
54
54
|
// src/client/hooks/client/helpers/findCaveat.ts
|
|
@@ -64,12 +64,99 @@ var findCaveat = async (permissions, targetCapability, targetCaveatType) => {
|
|
|
64
64
|
return [];
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
+
// src/client/hooks/client/permissions/useGrantedAccounts.ts
|
|
68
|
+
import {
|
|
69
|
+
asAddress,
|
|
70
|
+
assertEx,
|
|
71
|
+
isArray,
|
|
72
|
+
isDefined as isDefined2,
|
|
73
|
+
isString,
|
|
74
|
+
isUndefined
|
|
75
|
+
} from "@ariestools/sdk";
|
|
76
|
+
import { asXyoAddress } from "@xyo-network/sdk";
|
|
77
|
+
import {
|
|
78
|
+
useCallback,
|
|
79
|
+
useEffect,
|
|
80
|
+
useRef,
|
|
81
|
+
useState
|
|
82
|
+
} from "react";
|
|
83
|
+
var ACCOUNTS_CAPABILITY = "xyoWallet_getAccounts";
|
|
84
|
+
var RESTRICT_RETURNED_ACCOUNTS = "restrictReturnedAccounts";
|
|
85
|
+
function toError(error) {
|
|
86
|
+
return error instanceof Error ? error : new Error(String(error));
|
|
87
|
+
}
|
|
88
|
+
function grantedAccountsFromCaveat(value) {
|
|
89
|
+
if (!isArray(value)) {
|
|
90
|
+
throw new TypeError(`Unrecognized restrictReturnedAccounts caveat, expected an array of account addresses: ${JSON.stringify(value)}`);
|
|
91
|
+
}
|
|
92
|
+
const accounts = value.map((entry) => {
|
|
93
|
+
const account = isString(entry) ? asXyoAddress(entry) ?? asAddress(entry) : void 0;
|
|
94
|
+
if (isUndefined(account)) {
|
|
95
|
+
throw new TypeError(`Unrecognized account in restrictReturnedAccounts caveat: ${JSON.stringify(entry)}`);
|
|
96
|
+
}
|
|
97
|
+
return account;
|
|
98
|
+
});
|
|
99
|
+
return [...new Set(accounts)];
|
|
100
|
+
}
|
|
101
|
+
function isSameAccounts(first, second) {
|
|
102
|
+
if (first === second) return true;
|
|
103
|
+
return isDefined2(first) && isDefined2(second) && first.length === second.length && first.every((account, index) => account === second[index]);
|
|
104
|
+
}
|
|
105
|
+
function settleRead(previous, next) {
|
|
106
|
+
if (previous?.permissions !== next.permissions) return next;
|
|
107
|
+
const accounts = isDefined2(next.error) ? previous.accounts : next.accounts;
|
|
108
|
+
const settled = {
|
|
109
|
+
accounts: isSameAccounts(previous.accounts, accounts) ? previous.accounts : accounts,
|
|
110
|
+
error: previous.error?.message === next.error?.message ? previous.error : next.error,
|
|
111
|
+
permissions: next.permissions
|
|
112
|
+
};
|
|
113
|
+
return settled.accounts === previous.accounts && settled.error === previous.error ? previous : settled;
|
|
114
|
+
}
|
|
115
|
+
function useGrantedAccounts(permissions) {
|
|
116
|
+
const [read, setRead] = useState();
|
|
117
|
+
const readCountRef = useRef(0);
|
|
118
|
+
const refresh = useCallback(async () => {
|
|
119
|
+
if (isUndefined(permissions)) return;
|
|
120
|
+
readCountRef.current += 1;
|
|
121
|
+
const readNumber = readCountRef.current;
|
|
122
|
+
let next;
|
|
123
|
+
try {
|
|
124
|
+
const caveat = await findCaveat(permissions, ACCOUNTS_CAPABILITY, RESTRICT_RETURNED_ACCOUNTS);
|
|
125
|
+
next = { accounts: grantedAccountsFromCaveat(caveat), permissions };
|
|
126
|
+
} catch (error) {
|
|
127
|
+
next = { error: toError(error), permissions };
|
|
128
|
+
}
|
|
129
|
+
if (readNumber === readCountRef.current) setRead((previous) => settleRead(previous, next));
|
|
130
|
+
return next.accounts;
|
|
131
|
+
}, [permissions]);
|
|
132
|
+
const request = useCallback(async () => {
|
|
133
|
+
const provider = assertEx(permissions, () => "Wallet permissions are not available");
|
|
134
|
+
await provider.requestPermissions([{ [ACCOUNTS_CAPABILITY]: {} }]);
|
|
135
|
+
return await refresh();
|
|
136
|
+
}, [permissions, refresh]);
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
if (isUndefined(permissions)) return;
|
|
139
|
+
void refresh();
|
|
140
|
+
const controller = new AbortController();
|
|
141
|
+
addEventListener("focus", () => void refresh(), { signal: controller.signal });
|
|
142
|
+
return () => controller.abort();
|
|
143
|
+
}, [permissions, refresh]);
|
|
144
|
+
const current = isDefined2(permissions) && read?.permissions === permissions ? read : void 0;
|
|
145
|
+
return {
|
|
146
|
+
accounts: current?.accounts,
|
|
147
|
+
error: current?.error,
|
|
148
|
+
isLoading: isDefined2(permissions) && isUndefined(current),
|
|
149
|
+
refresh,
|
|
150
|
+
request
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
67
154
|
// src/client/hooks/client/useClientFromWallet.ts
|
|
68
|
-
import { isUndefined as
|
|
69
|
-
import { useEffect, useState } from "react";
|
|
155
|
+
import { isUndefined as isUndefined3 } from "@ariestools/sdk";
|
|
156
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
70
157
|
|
|
71
158
|
// src/client/hooks/helpers/getXyoClient.ts
|
|
72
|
-
import { isUndefined } from "@ariestools/sdk";
|
|
159
|
+
import { isUndefined as isUndefined2 } from "@ariestools/sdk";
|
|
73
160
|
var CLIENT_LISTENER_TIMEOUT = 2e3;
|
|
74
161
|
var hasXyoClient = () => {
|
|
75
162
|
return "client" in globalThis.xyo;
|
|
@@ -104,7 +191,7 @@ function discoveryAbortError(reason) {
|
|
|
104
191
|
}
|
|
105
192
|
async function getXyoClient(timeout = CLIENT_LISTENER_TIMEOUT, signal) {
|
|
106
193
|
if (signal?.aborted === true) throw discoveryAbortError(signal.reason);
|
|
107
|
-
if (
|
|
194
|
+
if (isUndefined2(globalThis.xyo)) return null;
|
|
108
195
|
if (hasXyoClient()) return globalThis.xyo.client;
|
|
109
196
|
return await new Promise((resolve, reject) => {
|
|
110
197
|
let dispose = () => {
|
|
@@ -140,8 +227,8 @@ var initialState = {
|
|
|
140
227
|
timedout: false
|
|
141
228
|
};
|
|
142
229
|
var useClientFromWallet = (timeout) => {
|
|
143
|
-
const [state, setState] =
|
|
144
|
-
|
|
230
|
+
const [state, setState] = useState2(initialState);
|
|
231
|
+
useEffect2(() => {
|
|
145
232
|
let cancelled = false;
|
|
146
233
|
const controller = new AbortController();
|
|
147
234
|
const initialize = async () => {
|
|
@@ -186,7 +273,7 @@ var useClientFromWallet = (timeout) => {
|
|
|
186
273
|
void initialize();
|
|
187
274
|
const onPluginReady = () => {
|
|
188
275
|
if (cancelled) return;
|
|
189
|
-
const client =
|
|
276
|
+
const client = isUndefined3(globalThis.xyo) ? null : globalThis.xyo?.client ?? null;
|
|
190
277
|
setState({
|
|
191
278
|
client,
|
|
192
279
|
isLoading: false,
|
|
@@ -223,15 +310,15 @@ var usePermissions = () => {
|
|
|
223
310
|
|
|
224
311
|
// src/client/hooks/client/permissions/usePermissionsAccounts.ts
|
|
225
312
|
import {
|
|
226
|
-
isArray,
|
|
227
|
-
isDefined as
|
|
313
|
+
isArray as isArray2,
|
|
314
|
+
isDefined as isDefined3,
|
|
228
315
|
isDefinedNotNull,
|
|
229
|
-
isString
|
|
316
|
+
isString as isString2
|
|
230
317
|
} from "@ariestools/sdk";
|
|
231
318
|
import { usePromise } from "@ariestools/sdk-react";
|
|
232
319
|
var validateRestrictedAccounts = (restrictedAccounts) => {
|
|
233
|
-
if (
|
|
234
|
-
if (
|
|
320
|
+
if (isDefined3(restrictedAccounts)) {
|
|
321
|
+
if (isArray2(restrictedAccounts) && restrictedAccounts.every(isString2)) {
|
|
235
322
|
return restrictedAccounts;
|
|
236
323
|
}
|
|
237
324
|
throw new Error(
|
|
@@ -246,7 +333,7 @@ var useAccountPermissions = () => {
|
|
|
246
333
|
const { permissions, error } = usePermissions();
|
|
247
334
|
return usePromise(async () => {
|
|
248
335
|
if (isDefinedNotNull(error)) throw error;
|
|
249
|
-
if (
|
|
336
|
+
if (isDefined3(permissions)) {
|
|
250
337
|
const restrictedAccounts = await findCaveat(
|
|
251
338
|
permissions,
|
|
252
339
|
// TODO - extract to constant in protocol package
|
|
@@ -299,12 +386,12 @@ var ApprovedLakeSelector = ({
|
|
|
299
386
|
isLoading,
|
|
300
387
|
timedout
|
|
301
388
|
} = useClientFromWallet(timeout);
|
|
302
|
-
const [lakes, setLakes] =
|
|
303
|
-
const [fetchError, setFetchError] =
|
|
304
|
-
const [refreshing, setRefreshing] =
|
|
389
|
+
const [lakes, setLakes] = useState3();
|
|
390
|
+
const [fetchError, setFetchError] = useState3();
|
|
391
|
+
const [refreshing, setRefreshing] = useState3(false);
|
|
305
392
|
const dataLakes = client?.dataLakes;
|
|
306
393
|
const supported = isDefinedNotNull2(dataLakes);
|
|
307
|
-
const refresh =
|
|
394
|
+
const refresh = useCallback2(async () => {
|
|
308
395
|
if (!isDefinedNotNull2(dataLakes)) return;
|
|
309
396
|
setFetchError(void 0);
|
|
310
397
|
setRefreshing(true);
|
|
@@ -317,7 +404,7 @@ var ApprovedLakeSelector = ({
|
|
|
317
404
|
setRefreshing(false);
|
|
318
405
|
}
|
|
319
406
|
}, [dataLakes]);
|
|
320
|
-
|
|
407
|
+
useEffect3(() => {
|
|
321
408
|
if (supported && lakes === void 0 && !refreshing) {
|
|
322
409
|
void refresh();
|
|
323
410
|
}
|
|
@@ -326,7 +413,7 @@ var ApprovedLakeSelector = ({
|
|
|
326
413
|
return /* @__PURE__ */ jsxs2(Stack2, { sx: { gap: 1, width: "100%" }, children: [
|
|
327
414
|
timedout ? /* @__PURE__ */ jsx2(Alert, { severity: "warning", children: "Wallet not detected." }) : null,
|
|
328
415
|
isDefinedNotNull2(client) && !supported ? /* @__PURE__ */ jsx2(Alert, { severity: "warning", children: "This wallet does not expose `xyo.client.dataLakes`." }) : null,
|
|
329
|
-
|
|
416
|
+
isDefined4(lakes) && filtered.length === 0 ? /* @__PURE__ */ jsxs2(Alert, { severity: "info", children: [
|
|
330
417
|
"No approved lakes with",
|
|
331
418
|
" ",
|
|
332
419
|
/* @__PURE__ */ jsx2("strong", { children: capability }),
|
|
@@ -360,7 +447,7 @@ var ApprovedLakeSelector = ({
|
|
|
360
447
|
children: "Refresh"
|
|
361
448
|
}
|
|
362
449
|
),
|
|
363
|
-
|
|
450
|
+
isDefined4(lakes) ? /* @__PURE__ */ jsxs2(Typography2, { variant: "caption", sx: { color: "text.secondary", alignSelf: "center" }, children: [
|
|
364
451
|
lakes.length,
|
|
365
452
|
" ",
|
|
366
453
|
"approved",
|
|
@@ -382,7 +469,7 @@ var ApprovedLakeSelector = ({
|
|
|
382
469
|
|
|
383
470
|
// src/client/components/connected/AutoSignChainPanel.tsx
|
|
384
471
|
import {
|
|
385
|
-
isDefined as
|
|
472
|
+
isDefined as isDefined7,
|
|
386
473
|
isDefinedNotNull as isDefinedNotNull4,
|
|
387
474
|
toHex
|
|
388
475
|
} from "@ariestools/sdk";
|
|
@@ -399,23 +486,23 @@ import {
|
|
|
399
486
|
import { asSchema, PayloadBuilder } from "@xyo-network/sdk";
|
|
400
487
|
import { ExplorerLinks, LocalNetwork } from "@xyo-network/xl1-sdk";
|
|
401
488
|
import {
|
|
402
|
-
useCallback as
|
|
489
|
+
useCallback as useCallback4,
|
|
403
490
|
useMemo,
|
|
404
|
-
useState as
|
|
491
|
+
useState as useState5
|
|
405
492
|
} from "react";
|
|
406
493
|
|
|
407
494
|
// src/client/components/connected/RequestPermissionsButton.tsx
|
|
408
|
-
import { isDefined as
|
|
495
|
+
import { isDefined as isDefined6, isDefinedNotNull as isDefinedNotNull3 } from "@ariestools/sdk";
|
|
409
496
|
import { ButtonEx as ButtonEx3 } from "@ariestools/sdk-react";
|
|
410
497
|
import { Alert as Alert3, Stack as Stack4 } from "@mui/material";
|
|
411
498
|
import {
|
|
412
|
-
useCallback as
|
|
413
|
-
useEffect as
|
|
414
|
-
useState as
|
|
499
|
+
useCallback as useCallback3,
|
|
500
|
+
useEffect as useEffect4,
|
|
501
|
+
useState as useState4
|
|
415
502
|
} from "react";
|
|
416
503
|
|
|
417
504
|
// src/client/components/connected/PermissionsReviewDialog.tsx
|
|
418
|
-
import { isDefined as
|
|
505
|
+
import { isDefined as isDefined5 } from "@ariestools/sdk";
|
|
419
506
|
import { ButtonEx as ButtonEx2 } from "@ariestools/sdk-react";
|
|
420
507
|
import {
|
|
421
508
|
Alert as Alert2,
|
|
@@ -450,11 +537,11 @@ var renderCaveatValue = (caveat) => {
|
|
|
450
537
|
if (caveat.type === "dataLakeAccess" && typeof caveat.value === "object" && caveat.value !== null) {
|
|
451
538
|
const value = caveat.value;
|
|
452
539
|
return /* @__PURE__ */ jsxs3(Stack3, { sx: { gap: 0.5 }, children: [
|
|
453
|
-
|
|
540
|
+
isDefined5(value.perOriginId) ? /* @__PURE__ */ jsxs3(Stack3, { direction: "row", sx: { alignItems: "center", gap: 1 }, children: [
|
|
454
541
|
/* @__PURE__ */ jsx3(Typography3, { variant: "caption", sx: { color: "text.secondary" }, children: "id:" }),
|
|
455
542
|
/* @__PURE__ */ jsx3(Typography3, { variant: "body2", sx: { fontFamily: "monospace", wordBreak: "break-all" }, children: value.perOriginId })
|
|
456
543
|
] }) : null,
|
|
457
|
-
|
|
544
|
+
isDefined5(value.narrowedSchemas) && value.narrowedSchemas.length > 0 ? /* @__PURE__ */ jsxs3(
|
|
458
545
|
Stack3,
|
|
459
546
|
{
|
|
460
547
|
direction: "row",
|
|
@@ -497,7 +584,7 @@ var renderCaveatValue = (caveat) => {
|
|
|
497
584
|
var renderPermission = (permission) => {
|
|
498
585
|
const caveats = permission.caveats ?? [];
|
|
499
586
|
let grantedAt;
|
|
500
|
-
if (
|
|
587
|
+
if (isDefined5(permission.date)) {
|
|
501
588
|
const grantedDate = new Date(permission.date);
|
|
502
589
|
grantedAt = grantedDate.toLocaleString();
|
|
503
590
|
}
|
|
@@ -574,13 +661,13 @@ var RequestPermissionsButton = ({
|
|
|
574
661
|
isLoading,
|
|
575
662
|
timedout
|
|
576
663
|
} = useClientFromWallet(timeout);
|
|
577
|
-
const [granted, setGranted] =
|
|
578
|
-
const [fetchError, setFetchError] =
|
|
579
|
-
const [requestError, setRequestError] =
|
|
580
|
-
const [requesting, setRequesting] =
|
|
581
|
-
const [dialogOpen, setDialogOpen] =
|
|
664
|
+
const [granted, setGranted] = useState4();
|
|
665
|
+
const [fetchError, setFetchError] = useState4();
|
|
666
|
+
const [requestError, setRequestError] = useState4();
|
|
667
|
+
const [requesting, setRequesting] = useState4(false);
|
|
668
|
+
const [dialogOpen, setDialogOpen] = useState4(false);
|
|
582
669
|
const permissionsApi = client?.permissions;
|
|
583
|
-
const refreshGranted =
|
|
670
|
+
const refreshGranted = useCallback3(async () => {
|
|
584
671
|
if (!isDefinedNotNull3(permissionsApi)) return;
|
|
585
672
|
setFetchError(void 0);
|
|
586
673
|
try {
|
|
@@ -591,12 +678,12 @@ var RequestPermissionsButton = ({
|
|
|
591
678
|
setFetchError(e);
|
|
592
679
|
}
|
|
593
680
|
}, [permissionsApi]);
|
|
594
|
-
|
|
681
|
+
useEffect4(() => {
|
|
595
682
|
if (isDefinedNotNull3(permissionsApi) && granted === void 0) {
|
|
596
683
|
void refreshGranted();
|
|
597
684
|
}
|
|
598
685
|
}, [permissionsApi, granted, refreshGranted]);
|
|
599
|
-
const requestPermissions =
|
|
686
|
+
const requestPermissions = useCallback3(async () => {
|
|
600
687
|
if (!isDefinedNotNull3(permissionsApi)) return;
|
|
601
688
|
setRequestError(void 0);
|
|
602
689
|
setRequesting(true);
|
|
@@ -609,7 +696,7 @@ var RequestPermissionsButton = ({
|
|
|
609
696
|
setRequesting(false);
|
|
610
697
|
}
|
|
611
698
|
}, [permissionsApi, permissions, refreshGranted]);
|
|
612
|
-
const hasGranted =
|
|
699
|
+
const hasGranted = isDefined6(granted) && granted.length > 0;
|
|
613
700
|
const handleClick = () => {
|
|
614
701
|
if (hasGranted) {
|
|
615
702
|
setDialogOpen(true);
|
|
@@ -756,10 +843,10 @@ var FireSection = ({
|
|
|
756
843
|
{
|
|
757
844
|
label: `#${attempt.index + 1}`,
|
|
758
845
|
size: "small",
|
|
759
|
-
color:
|
|
846
|
+
color: isDefined7(attempt.error) ? "error" : "success"
|
|
760
847
|
}
|
|
761
848
|
),
|
|
762
|
-
|
|
849
|
+
isDefined7(attempt.txHash) ? /* @__PURE__ */ jsxs5(
|
|
763
850
|
Link,
|
|
764
851
|
{
|
|
765
852
|
href: txUrl(attempt.txHash),
|
|
@@ -816,17 +903,17 @@ var AutoSignChainPanel = ({
|
|
|
816
903
|
error: gatewayError,
|
|
817
904
|
timedout
|
|
818
905
|
} = useGatewayFromWallet(gatewayName, timeout);
|
|
819
|
-
const [resolvedAddress, setResolvedAddress] =
|
|
820
|
-
const [resolving, setResolving] =
|
|
821
|
-
const [resolveError, setResolveError] =
|
|
822
|
-
const [granting, setGranting] =
|
|
823
|
-
const [grantError, setGrantError] =
|
|
824
|
-
const [granted, setGranted] =
|
|
825
|
-
const [firing, setFiring] =
|
|
826
|
-
const [attempts, setAttempts] =
|
|
906
|
+
const [resolvedAddress, setResolvedAddress] = useState5();
|
|
907
|
+
const [resolving, setResolving] = useState5(false);
|
|
908
|
+
const [resolveError, setResolveError] = useState5();
|
|
909
|
+
const [granting, setGranting] = useState5(false);
|
|
910
|
+
const [grantError, setGrantError] = useState5();
|
|
911
|
+
const [granted, setGranted] = useState5(false);
|
|
912
|
+
const [firing, setFiring] = useState5(false);
|
|
913
|
+
const [attempts, setAttempts] = useState5(EMPTY_RESULTS);
|
|
827
914
|
const permissionsApi = client?.permissions;
|
|
828
915
|
const explorer = useMemo(() => new ExplorerLinks(explorerUrl, gatewayName), [explorerUrl, gatewayName]);
|
|
829
|
-
const handleResolve =
|
|
916
|
+
const handleResolve = useCallback4(async () => {
|
|
830
917
|
if (!isDefinedNotNull4(gateway)) return;
|
|
831
918
|
const signer = gateway.signer;
|
|
832
919
|
if (!isDefinedNotNull4(signer)) return;
|
|
@@ -840,8 +927,8 @@ var AutoSignChainPanel = ({
|
|
|
840
927
|
setResolving(false);
|
|
841
928
|
}
|
|
842
929
|
}, [gateway]);
|
|
843
|
-
const handleGrant =
|
|
844
|
-
if (!isDefinedNotNull4(permissionsApi) || !
|
|
930
|
+
const handleGrant = useCallback4(async () => {
|
|
931
|
+
if (!isDefinedNotNull4(permissionsApi) || !isDefined7(resolvedAddress)) return;
|
|
845
932
|
setGrantError(void 0);
|
|
846
933
|
setGranting(true);
|
|
847
934
|
try {
|
|
@@ -860,7 +947,7 @@ var AutoSignChainPanel = ({
|
|
|
860
947
|
setGranting(false);
|
|
861
948
|
}
|
|
862
949
|
}, [permissionsApi, resolvedAddress, chainId, maxTxCount, schemaPatterns]);
|
|
863
|
-
const handleFire =
|
|
950
|
+
const handleFire = useCallback4(async () => {
|
|
864
951
|
if (!isDefinedNotNull4(gateway)) return;
|
|
865
952
|
setFiring(true);
|
|
866
953
|
setAttempts(EMPTY_RESULTS);
|
|
@@ -871,8 +958,8 @@ var AutoSignChainPanel = ({
|
|
|
871
958
|
}
|
|
872
959
|
}, [gateway, burstSize, offChainSchema]);
|
|
873
960
|
const canResolve = isDefinedNotNull4(gateway) && !resolving;
|
|
874
|
-
const canGrant = isDefinedNotNull4(permissionsApi) &&
|
|
875
|
-
const canFire = isDefinedNotNull4(gateway) &&
|
|
961
|
+
const canGrant = isDefinedNotNull4(permissionsApi) && isDefined7(resolvedAddress) && !granting;
|
|
962
|
+
const canFire = isDefinedNotNull4(gateway) && isDefined7(resolvedAddress) && !firing;
|
|
876
963
|
return /* @__PURE__ */ jsxs5(
|
|
877
964
|
Stack5,
|
|
878
965
|
{
|
|
@@ -902,7 +989,7 @@ var AutoSignChainPanel = ({
|
|
|
902
989
|
children: "Resolve account"
|
|
903
990
|
}
|
|
904
991
|
),
|
|
905
|
-
|
|
992
|
+
isDefined7(resolvedAddress) ? /* @__PURE__ */ jsxs5(Typography4, { variant: "caption", sx: { color: "text.secondary" }, children: [
|
|
906
993
|
"Account:",
|
|
907
994
|
" ",
|
|
908
995
|
/* @__PURE__ */ jsx5("code", { children: resolvedAddress })
|
|
@@ -959,7 +1046,7 @@ var AutoSignChainPanel = ({
|
|
|
959
1046
|
};
|
|
960
1047
|
|
|
961
1048
|
// src/client/components/connected/ConnectAccountsStack.tsx
|
|
962
|
-
import { isDefined as
|
|
1049
|
+
import { isDefined as isDefined8 } from "@ariestools/sdk";
|
|
963
1050
|
import { ButtonEx as ButtonEx5 } from "@ariestools/sdk-react";
|
|
964
1051
|
import {
|
|
965
1052
|
Alert as Alert5,
|
|
@@ -968,48 +1055,54 @@ import {
|
|
|
968
1055
|
Stack as Stack6,
|
|
969
1056
|
Typography as Typography5
|
|
970
1057
|
} from "@mui/material";
|
|
971
|
-
import { useEffect as
|
|
1058
|
+
import { useEffect as useEffect5 } from "react";
|
|
972
1059
|
|
|
973
1060
|
// src/client/components/connected/hooks/useConnectAccount.ts
|
|
974
1061
|
import {
|
|
975
|
-
asAddress,
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
1062
|
+
asAddress as asAddress2,
|
|
1063
|
+
isDefinedNotNull as isDefinedNotNull5,
|
|
1064
|
+
isNull as isNull2,
|
|
1065
|
+
isUndefined as isUndefined4
|
|
979
1066
|
} from "@ariestools/sdk";
|
|
980
1067
|
import { MainNetwork } from "@xyo-network/xl1-sdk";
|
|
981
|
-
import { useCallback as
|
|
982
|
-
var ACCOUNTS_CAPABILITY = "xyoWallet_getAccounts";
|
|
983
|
-
var RESTRICT_RETURNED_ACCOUNTS = "restrictReturnedAccounts";
|
|
984
|
-
var firstGrantedAccount = (grantedAccounts) => isArray2(grantedAccounts) && isString2(grantedAccounts[0]) ? grantedAccounts[0] : void 0;
|
|
1068
|
+
import { useCallback as useCallback5, useState as useState6 } from "react";
|
|
985
1069
|
var useConnectAccount = (gatewayName = MainNetwork.id, timeout) => {
|
|
986
|
-
const [connectError, setConnectError] =
|
|
1070
|
+
const [connectError, setConnectError] = useState6();
|
|
987
1071
|
const {
|
|
988
|
-
|
|
989
|
-
error,
|
|
1072
|
+
client,
|
|
1073
|
+
error: clientError,
|
|
990
1074
|
timedout
|
|
991
|
-
} =
|
|
992
|
-
const
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
1075
|
+
} = useClientFromWallet(timeout);
|
|
1076
|
+
const {
|
|
1077
|
+
accounts,
|
|
1078
|
+
error: grantError,
|
|
1079
|
+
isLoading: isReadingGrant,
|
|
1080
|
+
refresh,
|
|
1081
|
+
request
|
|
1082
|
+
} = useGrantedAccounts(client?.permissions);
|
|
1083
|
+
const requestAccounts = useCallback5(async () => {
|
|
1084
|
+
setConnectError(void 0);
|
|
996
1085
|
try {
|
|
997
|
-
|
|
998
|
-
const assertedPermissions = assertEx(permissions, () => "Wallet permissions are not available");
|
|
999
|
-
await assertedPermissions.requestPermissions([{ [ACCOUNTS_CAPABILITY]: {} }]);
|
|
1000
|
-
const grantedAccounts = await findCaveat(assertedPermissions, ACCOUNTS_CAPABILITY, RESTRICT_RETURNED_ACCOUNTS);
|
|
1001
|
-
const connectedAddress = firstGrantedAccount(grantedAccounts);
|
|
1002
|
-
setAddress(connectedAddress);
|
|
1003
|
-
return asAddress(connectedAddress);
|
|
1086
|
+
return await request();
|
|
1004
1087
|
} catch (e) {
|
|
1005
|
-
setConnectError(e);
|
|
1088
|
+
setConnectError(e instanceof Error ? e : new Error(String(e)));
|
|
1006
1089
|
}
|
|
1007
|
-
}, [
|
|
1090
|
+
}, [request]);
|
|
1091
|
+
const connectSigner = useCallback5(async () => {
|
|
1092
|
+
const granted = await requestAccounts();
|
|
1093
|
+
return asAddress2(granted?.[0]);
|
|
1094
|
+
}, [requestAccounts]);
|
|
1095
|
+
const isDiscovering = isUndefined4(client) && !isDefinedNotNull5(clientError);
|
|
1008
1096
|
return {
|
|
1009
|
-
|
|
1097
|
+
accounts,
|
|
1098
|
+
address: asAddress2(accounts?.[0]),
|
|
1010
1099
|
connectSigner,
|
|
1011
|
-
error:
|
|
1012
|
-
|
|
1100
|
+
error: clientError ?? grantError ?? connectError,
|
|
1101
|
+
// Same three-state contract as useGatewayFromWallet.
|
|
1102
|
+
gateway: isNull2(client) ? null : client?.gateways?.[gatewayName],
|
|
1103
|
+
isLoading: isDiscovering || isReadingGrant,
|
|
1104
|
+
refreshAccounts: refresh,
|
|
1105
|
+
requestAccounts,
|
|
1013
1106
|
timedout
|
|
1014
1107
|
};
|
|
1015
1108
|
};
|
|
@@ -1017,6 +1110,7 @@ var useConnectAccount = (gatewayName = MainNetwork.id, timeout) => {
|
|
|
1017
1110
|
// src/client/components/connected/ConnectAccountsStack.tsx
|
|
1018
1111
|
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1019
1112
|
var DefaultConnectComponent = (props) => /* @__PURE__ */ jsx6(ButtonEx5, { variant: "contained", size: "small", ...props });
|
|
1113
|
+
var DefaultLoadingComponent = () => /* @__PURE__ */ jsx6(ButtonEx5, { variant: "contained", size: "small", busy: true, disabled: true, children: "Connect" });
|
|
1020
1114
|
var DefaultNoWalletInstalledComponent = () => /* @__PURE__ */ jsxs6(Alert5, { severity: "warning", children: [
|
|
1021
1115
|
/* @__PURE__ */ jsx6(AlertTitle, { children: "XL1 Wallet Not Found" }),
|
|
1022
1116
|
/* @__PURE__ */ jsx6(Typography5, { gutterBottom: true, children: "Please ensure that your XL1 Wallet is installed to connect your account." }),
|
|
@@ -1036,28 +1130,38 @@ var DefaultNoWalletInstalledComponent = () => /* @__PURE__ */ jsxs6(Alert5, { se
|
|
|
1036
1130
|
var ConnectAccountsStack = ({
|
|
1037
1131
|
AccountComponent = ConnectedAccount,
|
|
1038
1132
|
ConnectComponent = DefaultConnectComponent,
|
|
1133
|
+
LoadingComponent = DefaultLoadingComponent,
|
|
1039
1134
|
NoWalletInstalledComponent = DefaultNoWalletInstalledComponent,
|
|
1040
1135
|
onAccountConnected,
|
|
1136
|
+
onAccountsChanged,
|
|
1041
1137
|
onCancel,
|
|
1042
1138
|
timeout,
|
|
1043
1139
|
...props
|
|
1044
1140
|
}) => {
|
|
1045
1141
|
const {
|
|
1046
|
-
|
|
1047
|
-
connectSigner,
|
|
1142
|
+
accounts,
|
|
1048
1143
|
error,
|
|
1144
|
+
isLoading,
|
|
1145
|
+
requestAccounts,
|
|
1049
1146
|
timedout
|
|
1050
1147
|
} = useConnectAccount(void 0, timeout);
|
|
1051
|
-
|
|
1052
|
-
|
|
1148
|
+
const firstAccount = accounts?.[0];
|
|
1149
|
+
const hasAccounts = isDefined8(firstAccount);
|
|
1150
|
+
useEffect5(() => {
|
|
1151
|
+
if (isDefined8(error) && isDefined8(onCancel)) {
|
|
1053
1152
|
onCancel();
|
|
1054
1153
|
}
|
|
1055
1154
|
}, [error, onCancel]);
|
|
1056
|
-
|
|
1057
|
-
if (
|
|
1058
|
-
onAccountConnected(
|
|
1155
|
+
useEffect5(() => {
|
|
1156
|
+
if (isDefined8(firstAccount) && isDefined8(onAccountConnected)) {
|
|
1157
|
+
onAccountConnected(firstAccount);
|
|
1158
|
+
}
|
|
1159
|
+
}, [firstAccount, onAccountConnected]);
|
|
1160
|
+
useEffect5(() => {
|
|
1161
|
+
if (isDefined8(accounts) && isDefined8(onAccountsChanged)) {
|
|
1162
|
+
onAccountsChanged(accounts);
|
|
1059
1163
|
}
|
|
1060
|
-
}, [
|
|
1164
|
+
}, [accounts, onAccountsChanged]);
|
|
1061
1165
|
return /* @__PURE__ */ jsxs6(
|
|
1062
1166
|
Stack6,
|
|
1063
1167
|
{
|
|
@@ -1066,9 +1170,10 @@ var ConnectAccountsStack = ({
|
|
|
1066
1170
|
...props,
|
|
1067
1171
|
sx: { alignItems: "start", ...props.sx },
|
|
1068
1172
|
children: [
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1173
|
+
isLoading ? /* @__PURE__ */ jsx6(LoadingComponent, {}) : null,
|
|
1174
|
+
!isLoading && hasAccounts ? accounts?.map((account) => /* @__PURE__ */ jsx6(AccountComponent, { account, address: account }, account)) : null,
|
|
1175
|
+
!isLoading && !hasAccounts && !timedout ? /* @__PURE__ */ jsx6(ConnectComponent, { onClick: () => void requestAccounts(), children: "Connect" }) : null,
|
|
1176
|
+
!isLoading && !hasAccounts && timedout ? /* @__PURE__ */ jsx6(NoWalletInstalledComponent, {}) : null,
|
|
1072
1177
|
/* @__PURE__ */ jsx6(ErrorRender, { error, scope: "ConnectSigner:error" })
|
|
1073
1178
|
]
|
|
1074
1179
|
}
|
|
@@ -1076,7 +1181,7 @@ var ConnectAccountsStack = ({
|
|
|
1076
1181
|
};
|
|
1077
1182
|
|
|
1078
1183
|
// src/client/components/connected/DataLakeAddToChainPanel.tsx
|
|
1079
|
-
import { isDefined as
|
|
1184
|
+
import { isDefined as isDefined9, isDefinedNotNull as isDefinedNotNull6 } from "@ariestools/sdk";
|
|
1080
1185
|
import { ButtonEx as ButtonEx6, usePromise as usePromise2 } from "@ariestools/sdk-react";
|
|
1081
1186
|
import { OpenInNew as OpenInNew2 } from "@mui/icons-material";
|
|
1082
1187
|
import {
|
|
@@ -1100,7 +1205,7 @@ import {
|
|
|
1100
1205
|
HashSchema,
|
|
1101
1206
|
SequenceNetwork
|
|
1102
1207
|
} from "@xyo-network/xl1-sdk";
|
|
1103
|
-
import { useMemo as useMemo2, useState as
|
|
1208
|
+
import { useMemo as useMemo2, useState as useState7 } from "react";
|
|
1104
1209
|
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1105
1210
|
var DEFAULT_EXPLORER_URL2 = "https://explore.xyo.network";
|
|
1106
1211
|
var DEFAULT_PAYLOAD_SCHEMA = asSchema2("network.xyo.observation.v2", true);
|
|
@@ -1187,7 +1292,7 @@ var InsertSection = ({
|
|
|
1187
1292
|
children: "Insert into lake"
|
|
1188
1293
|
}
|
|
1189
1294
|
),
|
|
1190
|
-
|
|
1295
|
+
isDefined9(storedHash) ? /* @__PURE__ */ jsxs7(
|
|
1191
1296
|
Stack7,
|
|
1192
1297
|
{
|
|
1193
1298
|
direction: "row",
|
|
@@ -1232,7 +1337,7 @@ var AddToChainSection = ({
|
|
|
1232
1337
|
children: "Add to chain"
|
|
1233
1338
|
}
|
|
1234
1339
|
),
|
|
1235
|
-
|
|
1340
|
+
isDefined9(txHash) && isDefined9(explorerTxUrl) ? /* @__PURE__ */ jsxs7(Stack7, { sx: { gap: 0.5 }, children: [
|
|
1236
1341
|
/* @__PURE__ */ jsxs7(
|
|
1237
1342
|
Stack7,
|
|
1238
1343
|
{
|
|
@@ -1265,7 +1370,7 @@ var AddToChainSection = ({
|
|
|
1265
1370
|
]
|
|
1266
1371
|
}
|
|
1267
1372
|
),
|
|
1268
|
-
|
|
1373
|
+
isDefined9(signedTx) ? /* @__PURE__ */ jsxs7(Typography6, { variant: "caption", sx: { color: "text.secondary" }, children: [
|
|
1269
1374
|
"Signed transaction recorded \u2014 open the explorer link above to verify inclusion on",
|
|
1270
1375
|
" ",
|
|
1271
1376
|
/* @__PURE__ */ jsx7("code", { children: gatewayName }),
|
|
@@ -1288,28 +1393,28 @@ var DataLakeAddToChainPanel = ({
|
|
|
1288
1393
|
error: gatewayError,
|
|
1289
1394
|
timedout
|
|
1290
1395
|
} = useGatewayFromWallet(gatewayName, timeout);
|
|
1291
|
-
const [payloadText, setPayloadText] =
|
|
1396
|
+
const [payloadText, setPayloadText] = useState7(initialPayloadJson ?? "");
|
|
1292
1397
|
usePromise2(async () => setPayloadText(await buildDefaultPayload(payloadSchema)), [payloadSchema]);
|
|
1293
1398
|
const parse = useMemo2(() => parsePayload(payloadText), [payloadText]);
|
|
1294
|
-
const [selectedLakeId, setSelectedLakeId] =
|
|
1295
|
-
const [storedPayload, setStoredPayload] =
|
|
1296
|
-
const [inserting, setInserting] =
|
|
1297
|
-
const [insertError, setInsertError] =
|
|
1298
|
-
const [txHash, setTxHash] =
|
|
1299
|
-
const [signedTx, setSignedTx] =
|
|
1300
|
-
const [addingToChain, setAddingToChain] =
|
|
1301
|
-
const [chainError, setChainError] =
|
|
1399
|
+
const [selectedLakeId, setSelectedLakeId] = useState7("");
|
|
1400
|
+
const [storedPayload, setStoredPayload] = useState7();
|
|
1401
|
+
const [inserting, setInserting] = useState7(false);
|
|
1402
|
+
const [insertError, setInsertError] = useState7();
|
|
1403
|
+
const [txHash, setTxHash] = useState7();
|
|
1404
|
+
const [signedTx, setSignedTx] = useState7();
|
|
1405
|
+
const [addingToChain, setAddingToChain] = useState7(false);
|
|
1406
|
+
const [chainError, setChainError] = useState7();
|
|
1302
1407
|
const dataLakes = client?.dataLakes;
|
|
1303
|
-
const [storedHash] = usePromise2(async () =>
|
|
1304
|
-
const canInsert = parse.ok && selectedLakeId.length > 0 &&
|
|
1305
|
-
const canAddToChain =
|
|
1408
|
+
const [storedHash] = usePromise2(async () => isDefined9(storedPayload) ? await PayloadBuilder2.dataHash(storedPayload) : void 0, [storedPayload]);
|
|
1409
|
+
const canInsert = parse.ok && selectedLakeId.length > 0 && isDefinedNotNull6(dataLakes) && !inserting;
|
|
1410
|
+
const canAddToChain = isDefined9(storedHash) && isDefined9(storedPayload) && isDefinedNotNull6(gateway) && !addingToChain;
|
|
1306
1411
|
const explorerTxUrl = useMemo2(() => {
|
|
1307
|
-
if (!
|
|
1412
|
+
if (!isDefined9(txHash)) return;
|
|
1308
1413
|
const links = new ExplorerLinks2(explorerUrl, gatewayName);
|
|
1309
1414
|
return links.transaction(txHash);
|
|
1310
1415
|
}, [txHash, explorerUrl, gatewayName]);
|
|
1311
1416
|
const handleInsert = async () => {
|
|
1312
|
-
if (!canInsert || !parse.ok || !
|
|
1417
|
+
if (!canInsert || !parse.ok || !isDefinedNotNull6(dataLakes)) return;
|
|
1313
1418
|
setInsertError(void 0);
|
|
1314
1419
|
setStoredPayload(void 0);
|
|
1315
1420
|
setTxHash(void 0);
|
|
@@ -1318,7 +1423,7 @@ var DataLakeAddToChainPanel = ({
|
|
|
1318
1423
|
setInserting(true);
|
|
1319
1424
|
try {
|
|
1320
1425
|
const [stored] = await dataLakes.insert(selectedLakeId, [parse.payload]);
|
|
1321
|
-
if (!
|
|
1426
|
+
if (!isDefined9(stored)) {
|
|
1322
1427
|
setInsertError(new Error("Lake returned no entries for this insert \u2014 the lake may disallow the payload's schema."));
|
|
1323
1428
|
return;
|
|
1324
1429
|
}
|
|
@@ -1334,7 +1439,7 @@ var DataLakeAddToChainPanel = ({
|
|
|
1334
1439
|
}
|
|
1335
1440
|
};
|
|
1336
1441
|
const handleAddToChain = async () => {
|
|
1337
|
-
if (!canAddToChain || !
|
|
1442
|
+
if (!canAddToChain || !isDefinedNotNull6(gateway) || !isDefined9(storedPayload) || !isDefined9(storedHash)) return;
|
|
1338
1443
|
setChainError(void 0);
|
|
1339
1444
|
setTxHash(void 0);
|
|
1340
1445
|
setSignedTx(void 0);
|
|
@@ -1402,14 +1507,14 @@ var DataLakeAddToChainPanel = ({
|
|
|
1402
1507
|
};
|
|
1403
1508
|
|
|
1404
1509
|
// src/client/components/connected/DataLakeGetButton.tsx
|
|
1405
|
-
import { isDefined as
|
|
1510
|
+
import { isDefined as isDefined10, isDefinedNotNull as isDefinedNotNull7 } from "@ariestools/sdk";
|
|
1406
1511
|
import { ButtonEx as ButtonEx7 } from "@ariestools/sdk-react";
|
|
1407
1512
|
import {
|
|
1408
1513
|
Alert as Alert7,
|
|
1409
1514
|
Stack as Stack8,
|
|
1410
1515
|
Typography as Typography7
|
|
1411
1516
|
} from "@mui/material";
|
|
1412
|
-
import { useState as
|
|
1517
|
+
import { useState as useState8 } from "react";
|
|
1413
1518
|
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1414
1519
|
var DataLakeGetButton = ({
|
|
1415
1520
|
id,
|
|
@@ -1423,14 +1528,14 @@ var DataLakeGetButton = ({
|
|
|
1423
1528
|
isLoading,
|
|
1424
1529
|
timedout
|
|
1425
1530
|
} = useClientFromWallet(timeout);
|
|
1426
|
-
const [result, setResult] =
|
|
1427
|
-
const [requestError, setRequestError] =
|
|
1428
|
-
const [requesting, setRequesting] =
|
|
1531
|
+
const [result, setResult] = useState8();
|
|
1532
|
+
const [requestError, setRequestError] = useState8();
|
|
1533
|
+
const [requesting, setRequesting] = useState8(false);
|
|
1429
1534
|
const dataLakes = client?.dataLakes;
|
|
1430
|
-
const supported =
|
|
1535
|
+
const supported = isDefinedNotNull7(dataLakes);
|
|
1431
1536
|
const argsReady = id.length > 0 && hashes.length > 0;
|
|
1432
1537
|
const handleClick = async () => {
|
|
1433
|
-
if (!
|
|
1538
|
+
if (!isDefinedNotNull7(dataLakes)) return;
|
|
1434
1539
|
setRequestError(void 0);
|
|
1435
1540
|
setResult(void 0);
|
|
1436
1541
|
setRequesting(true);
|
|
@@ -1454,7 +1559,7 @@ var DataLakeGetButton = ({
|
|
|
1454
1559
|
},
|
|
1455
1560
|
children: [
|
|
1456
1561
|
timedout ? /* @__PURE__ */ jsx8(Alert7, { severity: "warning", children: "Wallet not detected." }) : null,
|
|
1457
|
-
|
|
1562
|
+
isDefinedNotNull7(client) && !supported ? /* @__PURE__ */ jsx8(Alert7, { severity: "warning", children: "This wallet does not expose `xyo.client.dataLakes`." }) : null,
|
|
1458
1563
|
/* @__PURE__ */ jsxs8(
|
|
1459
1564
|
ButtonEx7,
|
|
1460
1565
|
{
|
|
@@ -1474,7 +1579,7 @@ var DataLakeGetButton = ({
|
|
|
1474
1579
|
}
|
|
1475
1580
|
),
|
|
1476
1581
|
argsReady ? null : /* @__PURE__ */ jsx8(Typography7, { variant: "caption", sx: { color: "text.secondary" }, children: "Provide a per-origin `id` and at least one hash to enable the button." }),
|
|
1477
|
-
|
|
1582
|
+
isDefined10(result) ? /* @__PURE__ */ jsxs8(Stack8, { sx: { gap: 0.5 }, children: [
|
|
1478
1583
|
/* @__PURE__ */ jsx8(Typography7, { variant: "subtitle2", children: result.length === 0 ? "No payloads returned" : `Payloads (${result.length})` }),
|
|
1479
1584
|
/* @__PURE__ */ jsx8(
|
|
1480
1585
|
Typography7,
|
|
@@ -1502,11 +1607,11 @@ import {
|
|
|
1502
1607
|
TextField as TextField2,
|
|
1503
1608
|
Typography as Typography8
|
|
1504
1609
|
} from "@mui/material";
|
|
1505
|
-
import { useMemo as useMemo3, useState as
|
|
1610
|
+
import { useMemo as useMemo3, useState as useState9 } from "react";
|
|
1506
1611
|
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1507
1612
|
var DataLakeGetPanel = ({ timeout, ...props }) => {
|
|
1508
|
-
const [selectedId, setSelectedId] =
|
|
1509
|
-
const [hashesText, setHashesText] =
|
|
1613
|
+
const [selectedId, setSelectedId] = useState9("");
|
|
1614
|
+
const [hashesText, setHashesText] = useState9("");
|
|
1510
1615
|
const hashes = useMemo3(() => {
|
|
1511
1616
|
return hashesText.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
1512
1617
|
}, [hashesText]);
|
|
@@ -1550,14 +1655,14 @@ var DataLakeGetPanel = ({ timeout, ...props }) => {
|
|
|
1550
1655
|
};
|
|
1551
1656
|
|
|
1552
1657
|
// src/client/components/connected/DataLakeInsertButton.tsx
|
|
1553
|
-
import { isDefined as
|
|
1658
|
+
import { isDefined as isDefined11, isDefinedNotNull as isDefinedNotNull8 } from "@ariestools/sdk";
|
|
1554
1659
|
import { ButtonEx as ButtonEx8 } from "@ariestools/sdk-react";
|
|
1555
1660
|
import {
|
|
1556
1661
|
Alert as Alert8,
|
|
1557
1662
|
Stack as Stack10,
|
|
1558
1663
|
Typography as Typography9
|
|
1559
1664
|
} from "@mui/material";
|
|
1560
|
-
import { useState as
|
|
1665
|
+
import { useState as useState10 } from "react";
|
|
1561
1666
|
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1562
1667
|
var DataLakeInsertButton = ({
|
|
1563
1668
|
id,
|
|
@@ -1571,14 +1676,14 @@ var DataLakeInsertButton = ({
|
|
|
1571
1676
|
isLoading,
|
|
1572
1677
|
timedout
|
|
1573
1678
|
} = useClientFromWallet(timeout);
|
|
1574
|
-
const [result, setResult] =
|
|
1575
|
-
const [requestError, setRequestError] =
|
|
1576
|
-
const [requesting, setRequesting] =
|
|
1679
|
+
const [result, setResult] = useState10();
|
|
1680
|
+
const [requestError, setRequestError] = useState10();
|
|
1681
|
+
const [requesting, setRequesting] = useState10(false);
|
|
1577
1682
|
const dataLakes = client?.dataLakes;
|
|
1578
|
-
const supported =
|
|
1683
|
+
const supported = isDefinedNotNull8(dataLakes);
|
|
1579
1684
|
const argsReady = id.length > 0 && payloads.length > 0;
|
|
1580
1685
|
const handleClick = async () => {
|
|
1581
|
-
if (!
|
|
1686
|
+
if (!isDefinedNotNull8(dataLakes)) return;
|
|
1582
1687
|
setRequestError(void 0);
|
|
1583
1688
|
setResult(void 0);
|
|
1584
1689
|
setRequesting(true);
|
|
@@ -1602,7 +1707,7 @@ var DataLakeInsertButton = ({
|
|
|
1602
1707
|
},
|
|
1603
1708
|
children: [
|
|
1604
1709
|
timedout ? /* @__PURE__ */ jsx10(Alert8, { severity: "warning", children: "Wallet not detected." }) : null,
|
|
1605
|
-
|
|
1710
|
+
isDefinedNotNull8(client) && !supported ? /* @__PURE__ */ jsx10(Alert8, { severity: "warning", children: "This wallet does not expose `xyo.client.dataLakes`." }) : null,
|
|
1606
1711
|
/* @__PURE__ */ jsxs10(
|
|
1607
1712
|
ButtonEx8,
|
|
1608
1713
|
{
|
|
@@ -1622,7 +1727,7 @@ var DataLakeInsertButton = ({
|
|
|
1622
1727
|
}
|
|
1623
1728
|
),
|
|
1624
1729
|
argsReady ? null : /* @__PURE__ */ jsx10(Typography9, { variant: "caption", sx: { color: "text.secondary" }, children: "Provide a per-origin `id` and at least one payload to enable the button." }),
|
|
1625
|
-
|
|
1730
|
+
isDefined11(result) ? /* @__PURE__ */ jsxs10(Stack10, { sx: { gap: 0.5 }, children: [
|
|
1626
1731
|
/* @__PURE__ */ jsx10(Typography9, { variant: "subtitle2", children: result.length === 0 ? "No payloads written (wallet filtered all)" : `Inserted (${result.length})` }),
|
|
1627
1732
|
/* @__PURE__ */ jsx10(
|
|
1628
1733
|
Typography9,
|
|
@@ -1651,7 +1756,7 @@ import {
|
|
|
1651
1756
|
TextField as TextField3,
|
|
1652
1757
|
Typography as Typography10
|
|
1653
1758
|
} from "@mui/material";
|
|
1654
|
-
import { useMemo as useMemo4, useState as
|
|
1759
|
+
import { useMemo as useMemo4, useState as useState11 } from "react";
|
|
1655
1760
|
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1656
1761
|
function buildDefaultPayload2() {
|
|
1657
1762
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -1678,8 +1783,8 @@ function parsePayload2(raw) {
|
|
|
1678
1783
|
}
|
|
1679
1784
|
}
|
|
1680
1785
|
var DataLakeInsertPanel = ({ timeout, ...props }) => {
|
|
1681
|
-
const [selectedId, setSelectedId] =
|
|
1682
|
-
const [payloadText, setPayloadText] =
|
|
1786
|
+
const [selectedId, setSelectedId] = useState11("");
|
|
1787
|
+
const [payloadText, setPayloadText] = useState11(buildDefaultPayload2);
|
|
1683
1788
|
const parse = useMemo4(() => parsePayload2(payloadText), [payloadText]);
|
|
1684
1789
|
return /* @__PURE__ */ jsxs11(
|
|
1685
1790
|
Stack11,
|
|
@@ -1735,14 +1840,14 @@ var DataLakeInsertPanel = ({ timeout, ...props }) => {
|
|
|
1735
1840
|
};
|
|
1736
1841
|
|
|
1737
1842
|
// src/client/components/connected/DataLakeListButton.tsx
|
|
1738
|
-
import { isDefined as
|
|
1843
|
+
import { isDefined as isDefined12, isDefinedNotNull as isDefinedNotNull9 } from "@ariestools/sdk";
|
|
1739
1844
|
import { ButtonEx as ButtonEx9 } from "@ariestools/sdk-react";
|
|
1740
1845
|
import {
|
|
1741
1846
|
Alert as Alert10,
|
|
1742
1847
|
Stack as Stack12,
|
|
1743
1848
|
Typography as Typography11
|
|
1744
1849
|
} from "@mui/material";
|
|
1745
|
-
import { useState as
|
|
1850
|
+
import { useState as useState12 } from "react";
|
|
1746
1851
|
import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1747
1852
|
var DataLakeListButton = ({ timeout, ...props }) => {
|
|
1748
1853
|
const {
|
|
@@ -1751,13 +1856,13 @@ var DataLakeListButton = ({ timeout, ...props }) => {
|
|
|
1751
1856
|
isLoading,
|
|
1752
1857
|
timedout
|
|
1753
1858
|
} = useClientFromWallet(timeout);
|
|
1754
|
-
const [lakes, setLakes] =
|
|
1755
|
-
const [requestError, setRequestError] =
|
|
1756
|
-
const [requesting, setRequesting] =
|
|
1859
|
+
const [lakes, setLakes] = useState12();
|
|
1860
|
+
const [requestError, setRequestError] = useState12();
|
|
1861
|
+
const [requesting, setRequesting] = useState12(false);
|
|
1757
1862
|
const dataLakes = client?.dataLakes;
|
|
1758
|
-
const supported =
|
|
1863
|
+
const supported = isDefinedNotNull9(dataLakes);
|
|
1759
1864
|
const handleClick = async () => {
|
|
1760
|
-
if (!
|
|
1865
|
+
if (!isDefinedNotNull9(dataLakes)) return;
|
|
1761
1866
|
setRequestError(void 0);
|
|
1762
1867
|
setLakes(void 0);
|
|
1763
1868
|
setRequesting(true);
|
|
@@ -1781,7 +1886,7 @@ var DataLakeListButton = ({ timeout, ...props }) => {
|
|
|
1781
1886
|
},
|
|
1782
1887
|
children: [
|
|
1783
1888
|
timedout ? /* @__PURE__ */ jsx12(Alert10, { severity: "warning", children: "Wallet not detected." }) : null,
|
|
1784
|
-
|
|
1889
|
+
isDefinedNotNull9(client) && !supported ? /* @__PURE__ */ jsx12(Alert10, { severity: "warning", children: "This wallet does not expose `xyo.client.dataLakes`." }) : null,
|
|
1785
1890
|
/* @__PURE__ */ jsx12(
|
|
1786
1891
|
ButtonEx9,
|
|
1787
1892
|
{
|
|
@@ -1793,7 +1898,7 @@ var DataLakeListButton = ({ timeout, ...props }) => {
|
|
|
1793
1898
|
children: "List approved data lakes"
|
|
1794
1899
|
}
|
|
1795
1900
|
),
|
|
1796
|
-
|
|
1901
|
+
isDefined12(lakes) ? /* @__PURE__ */ jsxs12(Stack12, { sx: { gap: 0.5 }, children: [
|
|
1797
1902
|
/* @__PURE__ */ jsx12(Typography11, { variant: "subtitle2", children: lakes.length === 0 ? "No approved lakes" : `Approved lakes (${lakes.length})` }),
|
|
1798
1903
|
/* @__PURE__ */ jsx12(
|
|
1799
1904
|
Typography11,
|
|
@@ -1833,17 +1938,17 @@ import {
|
|
|
1833
1938
|
Stack as Stack14
|
|
1834
1939
|
} from "@mui/material";
|
|
1835
1940
|
import { asSchema as asSchema3 } from "@xyo-network/sdk";
|
|
1836
|
-
import { useMemo as useMemo5, useState as
|
|
1941
|
+
import { useMemo as useMemo5, useState as useState14 } from "react";
|
|
1837
1942
|
|
|
1838
1943
|
// src/client/components/connected/DataLakeRequestAccessButton.tsx
|
|
1839
|
-
import { isDefined as
|
|
1944
|
+
import { isDefined as isDefined13, isDefinedNotNull as isDefinedNotNull10 } from "@ariestools/sdk";
|
|
1840
1945
|
import { ButtonEx as ButtonEx10 } from "@ariestools/sdk-react";
|
|
1841
1946
|
import {
|
|
1842
1947
|
Alert as Alert11,
|
|
1843
1948
|
Stack as Stack13,
|
|
1844
1949
|
Typography as Typography12
|
|
1845
1950
|
} from "@mui/material";
|
|
1846
|
-
import { useState as
|
|
1951
|
+
import { useState as useState13 } from "react";
|
|
1847
1952
|
import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1848
1953
|
var DataLakeRequestAccessButton = ({
|
|
1849
1954
|
options,
|
|
@@ -1856,13 +1961,13 @@ var DataLakeRequestAccessButton = ({
|
|
|
1856
1961
|
isLoading,
|
|
1857
1962
|
timedout
|
|
1858
1963
|
} = useClientFromWallet(timeout);
|
|
1859
|
-
const [granted, setGranted] =
|
|
1860
|
-
const [requestError, setRequestError] =
|
|
1861
|
-
const [requesting, setRequesting] =
|
|
1964
|
+
const [granted, setGranted] = useState13();
|
|
1965
|
+
const [requestError, setRequestError] = useState13();
|
|
1966
|
+
const [requesting, setRequesting] = useState13(false);
|
|
1862
1967
|
const dataLakes = client?.dataLakes;
|
|
1863
|
-
const supported =
|
|
1968
|
+
const supported = isDefinedNotNull10(dataLakes);
|
|
1864
1969
|
const handleClick = async () => {
|
|
1865
|
-
if (!
|
|
1970
|
+
if (!isDefinedNotNull10(dataLakes)) return;
|
|
1866
1971
|
setRequestError(void 0);
|
|
1867
1972
|
setGranted(void 0);
|
|
1868
1973
|
setRequesting(true);
|
|
@@ -1886,7 +1991,7 @@ var DataLakeRequestAccessButton = ({
|
|
|
1886
1991
|
},
|
|
1887
1992
|
children: [
|
|
1888
1993
|
timedout ? /* @__PURE__ */ jsx13(Alert11, { severity: "warning", children: "Wallet not detected." }) : null,
|
|
1889
|
-
|
|
1994
|
+
isDefinedNotNull10(client) && !supported ? /* @__PURE__ */ jsx13(Alert11, { severity: "warning", children: "This wallet does not expose `xyo.client.dataLakes`." }) : null,
|
|
1890
1995
|
/* @__PURE__ */ jsx13(
|
|
1891
1996
|
ButtonEx10,
|
|
1892
1997
|
{
|
|
@@ -1898,7 +2003,7 @@ var DataLakeRequestAccessButton = ({
|
|
|
1898
2003
|
children: "Request data lake access"
|
|
1899
2004
|
}
|
|
1900
2005
|
),
|
|
1901
|
-
|
|
2006
|
+
isDefined13(granted) ? /* @__PURE__ */ jsxs13(Stack13, { sx: { gap: 0.5 }, children: [
|
|
1902
2007
|
/* @__PURE__ */ jsx13(Typography12, { variant: "subtitle2", children: "Granted:" }),
|
|
1903
2008
|
/* @__PURE__ */ jsxs13(Typography12, { variant: "body2", sx: { fontFamily: "monospace", wordBreak: "break-all" }, children: [
|
|
1904
2009
|
"id:",
|
|
@@ -1918,8 +2023,8 @@ import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
|
1918
2023
|
var observationSchema = asSchema3("network.xyo.observation.v2", true);
|
|
1919
2024
|
var locationSchema = asSchema3("network.xyo.location", true);
|
|
1920
2025
|
var DataLakeRequestAccessPanel = ({ timeout, ...props }) => {
|
|
1921
|
-
const [capability, setCapability] =
|
|
1922
|
-
const [includeSchemas, setIncludeSchemas] =
|
|
2026
|
+
const [capability, setCapability] = useState14("read+write");
|
|
2027
|
+
const [includeSchemas, setIncludeSchemas] = useState14(true);
|
|
1923
2028
|
const supportsSchemasFilter = capability !== "viewer";
|
|
1924
2029
|
const options = useMemo5(() => {
|
|
1925
2030
|
const cap = capability === "read+write" ? { read: true, write: true } : capability;
|
|
@@ -2015,8 +2120,8 @@ var DataLakeOperationsPanel = ({ timeout, ...props }) => {
|
|
|
2015
2120
|
// src/client/components/connected/SignTransactionButton.tsx
|
|
2016
2121
|
import {
|
|
2017
2122
|
assertEx as assertEx2,
|
|
2018
|
-
isDefined as
|
|
2019
|
-
isDefinedNotNull as
|
|
2123
|
+
isDefined as isDefined14,
|
|
2124
|
+
isDefinedNotNull as isDefinedNotNull11
|
|
2020
2125
|
} from "@ariestools/sdk";
|
|
2021
2126
|
import { ButtonEx as ButtonEx11 } from "@ariestools/sdk-react";
|
|
2022
2127
|
import {
|
|
@@ -2033,7 +2138,7 @@ import {
|
|
|
2033
2138
|
HashSchema as HashSchema2,
|
|
2034
2139
|
SequenceNetwork as SequenceNetwork2
|
|
2035
2140
|
} from "@xyo-network/xl1-sdk";
|
|
2036
|
-
import { useCallback as
|
|
2141
|
+
import { useCallback as useCallback6, useState as useState15 } from "react";
|
|
2037
2142
|
import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2038
2143
|
var EMPTY_PAYLOADS = [];
|
|
2039
2144
|
var SIGNER_PERMISSIONS2 = [
|
|
@@ -2053,14 +2158,14 @@ var SignTransactionButton = ({
|
|
|
2053
2158
|
error: gatewayError,
|
|
2054
2159
|
timedout
|
|
2055
2160
|
} = useGatewayFromWallet(gatewayName, timeout);
|
|
2056
|
-
const [signing, setSigning] =
|
|
2057
|
-
const [signError, setSignError] =
|
|
2058
|
-
const [signedHash, setSignedHash] =
|
|
2161
|
+
const [signing, setSigning] = useState15(false);
|
|
2162
|
+
const [signError, setSignError] = useState15();
|
|
2163
|
+
const [signedHash, setSignedHash] = useState15();
|
|
2059
2164
|
const signer = gateway?.signer;
|
|
2060
2165
|
const viewer = gateway?.connection?.viewer;
|
|
2061
|
-
const canSign =
|
|
2062
|
-
const handleSign =
|
|
2063
|
-
if (!
|
|
2166
|
+
const canSign = isDefinedNotNull11(signer) && isDefinedNotNull11(viewer) && !signing;
|
|
2167
|
+
const handleSign = useCallback6(async () => {
|
|
2168
|
+
if (!isDefinedNotNull11(gateway)) return;
|
|
2064
2169
|
const resolvedSigner = assertEx2(gateway.signer, () => "No signer available on gateway");
|
|
2065
2170
|
const resolvedViewer = assertEx2(gateway.connection?.viewer, () => "No viewer available on gateway connection");
|
|
2066
2171
|
setSignError(void 0);
|
|
@@ -2072,7 +2177,7 @@ var SignTransactionButton = ({
|
|
|
2072
2177
|
const exp = asXL1BlockNumber(nbf + 10, true);
|
|
2073
2178
|
const from = await resolvedSigner.address();
|
|
2074
2179
|
const referencedHashes = await PayloadBuilder3.hashes(referencedPayloads);
|
|
2075
|
-
const onChainPayloads = anchorOnChain &&
|
|
2180
|
+
const onChainPayloads = anchorOnChain && isDefined14(referencedHashes[0]) ? [{ schema: HashSchema2, hash: referencedHashes[0] }] : [];
|
|
2076
2181
|
let tx = await buildUnsignedTransaction(
|
|
2077
2182
|
chain,
|
|
2078
2183
|
onChainPayloads,
|
|
@@ -2147,7 +2252,7 @@ var SignTransactionButton = ({
|
|
|
2147
2252
|
),
|
|
2148
2253
|
/* @__PURE__ */ jsx16(PopoverErrorRender, { error: gatewayError ?? signError, scope: "SignTransactionButton" })
|
|
2149
2254
|
] }),
|
|
2150
|
-
|
|
2255
|
+
isDefined14(signedHash) ? /* @__PURE__ */ jsxs16(
|
|
2151
2256
|
Stack16,
|
|
2152
2257
|
{
|
|
2153
2258
|
direction: "row",
|
|
@@ -2177,7 +2282,7 @@ import { createContextEx as createContextEx2 } from "@ariestools/sdk-react";
|
|
|
2177
2282
|
var InPageGatewaysContext = createContextEx2();
|
|
2178
2283
|
|
|
2179
2284
|
// src/client/context/in-page/lib/buildGateway.ts
|
|
2180
|
-
import { assertEx as assertEx3, isDefined as
|
|
2285
|
+
import { assertEx as assertEx3, isDefined as isDefined15 } from "@ariestools/sdk";
|
|
2181
2286
|
import {
|
|
2182
2287
|
basicRemoteRunnerLocator,
|
|
2183
2288
|
basicRemoteViewerLocator,
|
|
@@ -2194,7 +2299,7 @@ var buildGateway = async (gatewayName, localEndpoint, signerTransport, signerFac
|
|
|
2194
2299
|
const rpcUrl = `${resolvedNetwork.url}/rpc`;
|
|
2195
2300
|
if (transport === "rpc") {
|
|
2196
2301
|
const rpcConnection = { protocol: "http", url: rpcUrl };
|
|
2197
|
-
const locator =
|
|
2302
|
+
const locator = isDefined15(signerTransport) || isDefined15(signerFactory) || isDefined15(signerAccount) ? await basicRemoteRunnerLocator(gatewayName, rpcConnection, signerTransport, void 0, { signerAccount, signerFactory }) : await basicRemoteViewerLocator(gatewayName, rpcConnection);
|
|
2198
2303
|
return await locator.getInstance(XyoGatewayMoniker);
|
|
2199
2304
|
}
|
|
2200
2305
|
const config = gatewayName === LocalNetwork2.id ? {
|
|
@@ -2202,7 +2307,7 @@ var buildGateway = async (gatewayName, localEndpoint, signerTransport, signerFac
|
|
|
2202
2307
|
chainState: { readUrl: `${localEndpoint}/state` },
|
|
2203
2308
|
index: { readUrl: `${localEndpoint}/indexes` }
|
|
2204
2309
|
} : restGatewayConfigFromEndpoint(`https://${gatewayName}.xyo.space`);
|
|
2205
|
-
if (
|
|
2310
|
+
if (isDefined15(signerFactory)) {
|
|
2206
2311
|
return await getRestGatewayRunner({
|
|
2207
2312
|
...config,
|
|
2208
2313
|
name: gatewayName,
|
|
@@ -2210,7 +2315,7 @@ var buildGateway = async (gatewayName, localEndpoint, signerTransport, signerFac
|
|
|
2210
2315
|
signerFactory
|
|
2211
2316
|
});
|
|
2212
2317
|
}
|
|
2213
|
-
if (
|
|
2318
|
+
if (isDefined15(signerAccount)) {
|
|
2214
2319
|
return await getRestGatewayRunner({
|
|
2215
2320
|
...config,
|
|
2216
2321
|
name: gatewayName,
|
|
@@ -2218,7 +2323,7 @@ var buildGateway = async (gatewayName, localEndpoint, signerTransport, signerFac
|
|
|
2218
2323
|
signerAccount
|
|
2219
2324
|
});
|
|
2220
2325
|
}
|
|
2221
|
-
if (
|
|
2326
|
+
if (isDefined15(signerTransport)) {
|
|
2222
2327
|
return await getRestGatewayRunner({
|
|
2223
2328
|
...config,
|
|
2224
2329
|
name: gatewayName,
|
|
@@ -2266,10 +2371,10 @@ import { bindPageLifecycle } from "@ariestools/browser-kit-page";
|
|
|
2266
2371
|
import { DefaultNetworks as DefaultNetworks3 } from "@xyo-network/xl1-sdk";
|
|
2267
2372
|
import {
|
|
2268
2373
|
startTransition,
|
|
2269
|
-
useCallback as
|
|
2270
|
-
useEffect as
|
|
2374
|
+
useCallback as useCallback7,
|
|
2375
|
+
useEffect as useEffect6,
|
|
2271
2376
|
useMemo as useMemo6,
|
|
2272
|
-
useState as
|
|
2377
|
+
useState as useState16
|
|
2273
2378
|
} from "react";
|
|
2274
2379
|
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
2275
2380
|
var DEFAULT_LOCAL_ENDPOINT = "https://chain.aries.test:8791";
|
|
@@ -2282,11 +2387,11 @@ var InPageGatewaysProvider = ({
|
|
|
2282
2387
|
transport = "rpc",
|
|
2283
2388
|
children
|
|
2284
2389
|
}) => {
|
|
2285
|
-
const [gateways, setGateways] =
|
|
2286
|
-
const [errors, setErrors] =
|
|
2287
|
-
const [previousSignerTransport, setPreviousSignerTransport] =
|
|
2288
|
-
const [pageGeneration, setPageGeneration] =
|
|
2289
|
-
const clearAll =
|
|
2390
|
+
const [gateways, setGateways] = useState16({});
|
|
2391
|
+
const [errors, setErrors] = useState16({});
|
|
2392
|
+
const [previousSignerTransport, setPreviousSignerTransport] = useState16(signerTransport);
|
|
2393
|
+
const [pageGeneration, setPageGeneration] = useState16(0);
|
|
2394
|
+
const clearAll = useCallback7(() => {
|
|
2290
2395
|
setGateways({});
|
|
2291
2396
|
setErrors({});
|
|
2292
2397
|
}, []);
|
|
@@ -2294,7 +2399,7 @@ var InPageGatewaysProvider = ({
|
|
|
2294
2399
|
clearAll();
|
|
2295
2400
|
setPreviousSignerTransport(signerTransport);
|
|
2296
2401
|
}
|
|
2297
|
-
|
|
2402
|
+
useEffect6(() => {
|
|
2298
2403
|
const controller = new AbortController();
|
|
2299
2404
|
addEventListener("pageshow", (event) => {
|
|
2300
2405
|
if (!event.persisted) return;
|
|
@@ -2303,7 +2408,7 @@ var InPageGatewaysProvider = ({
|
|
|
2303
2408
|
}, { signal: controller.signal });
|
|
2304
2409
|
return () => controller.abort();
|
|
2305
2410
|
}, [clearAll]);
|
|
2306
|
-
|
|
2411
|
+
useEffect6(() => {
|
|
2307
2412
|
let cancelled = false;
|
|
2308
2413
|
const ownedSystems = [];
|
|
2309
2414
|
const buildAll = async () => {
|
|
@@ -2379,7 +2484,7 @@ import { useContextEx } from "@ariestools/sdk-react";
|
|
|
2379
2484
|
var useProvidedInPageGateways = (required = true) => useContextEx(InPageGatewaysContext, "InPageGateways", required);
|
|
2380
2485
|
|
|
2381
2486
|
// src/client/context/providers/GatewayProvider.tsx
|
|
2382
|
-
import { isDefinedNotNull as
|
|
2487
|
+
import { isDefinedNotNull as isDefinedNotNull12, isNull as isNull3 } from "@ariestools/sdk";
|
|
2383
2488
|
import { useMemo as useMemo7 } from "react";
|
|
2384
2489
|
import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2385
2490
|
var GatewayProvider = ({ gatewayName, children }) => {
|
|
@@ -2395,7 +2500,7 @@ var GatewayProvider = ({ gatewayName, children }) => {
|
|
|
2395
2500
|
const gatewayFromConfig = gatewayName ? allGateways[gatewayName] : void 0;
|
|
2396
2501
|
const gatewayFromConfigError = gatewayName ? allGatewayErrors[gatewayName] : void 0;
|
|
2397
2502
|
const { defaultGateway, gateways } = useMemo7(() => {
|
|
2398
|
-
if (
|
|
2503
|
+
if (isNull3(gatewayFromWallet)) {
|
|
2399
2504
|
return {
|
|
2400
2505
|
defaultGateway: gatewayFromConfig,
|
|
2401
2506
|
gateways: {
|
|
@@ -2404,7 +2509,7 @@ var GatewayProvider = ({ gatewayName, children }) => {
|
|
|
2404
2509
|
}
|
|
2405
2510
|
};
|
|
2406
2511
|
}
|
|
2407
|
-
if (
|
|
2512
|
+
if (isDefinedNotNull12(gatewayFromWallet)) {
|
|
2408
2513
|
return {
|
|
2409
2514
|
defaultGateway: gatewayFromWallet,
|
|
2410
2515
|
gateways: {
|
|
@@ -2515,6 +2620,7 @@ export {
|
|
|
2515
2620
|
useConnectAccount,
|
|
2516
2621
|
useGateway,
|
|
2517
2622
|
useGatewayFromWallet,
|
|
2623
|
+
useGrantedAccounts,
|
|
2518
2624
|
usePermissions,
|
|
2519
2625
|
useProvidedGateway,
|
|
2520
2626
|
useProvidedInPageGateways
|