@xyo-network/react-chain-client 1.23.0 → 2.0.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/dist/browser/index.mjs +215 -178
- package/dist/browser/index.mjs.map +7 -1
- package/package.json +85 -88
package/dist/browser/index.mjs
CHANGED
|
@@ -1,39 +1,50 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// src/components/connected/account/Connected.tsx
|
|
5
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Stack,
|
|
4
|
+
Tooltip,
|
|
5
|
+
Typography
|
|
6
|
+
} from "@mui/material";
|
|
6
7
|
import { EthAddressWrapper } from "@xylabs/sdk-js";
|
|
7
8
|
import { BlockiesAvatarAddress } from "@xyo-network/xl1-blockies";
|
|
8
|
-
import
|
|
9
|
-
var ConnectedAccount =
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
var ConnectedAccount = ({ address }) => {
|
|
10
11
|
const shortenedAddress = `${EthAddressWrapper.fromString(address)?.toShortString(4)}`;
|
|
11
|
-
return /* @__PURE__ */
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
12
|
+
return /* @__PURE__ */ jsxs(
|
|
13
|
+
Stack,
|
|
14
|
+
{
|
|
15
|
+
direction: "row",
|
|
16
|
+
spacing: 1,
|
|
17
|
+
sx: { alignItems: "center" },
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ jsx(BlockiesAvatarAddress, { address, size: 21 }),
|
|
20
|
+
/* @__PURE__ */ jsx(Tooltip, { title: address, children: /* @__PURE__ */ jsx(
|
|
21
|
+
Typography,
|
|
22
|
+
{
|
|
23
|
+
variant: "caption",
|
|
24
|
+
sx: {
|
|
25
|
+
color: "text.secondary",
|
|
26
|
+
fontFamily: "monospace"
|
|
27
|
+
},
|
|
28
|
+
children: shortenedAddress
|
|
29
|
+
}
|
|
30
|
+
) })
|
|
31
|
+
]
|
|
27
32
|
}
|
|
28
|
-
|
|
29
|
-
}
|
|
33
|
+
);
|
|
34
|
+
};
|
|
30
35
|
|
|
31
36
|
// src/components/connected/ConnectAccountsStack.tsx
|
|
32
|
-
import {
|
|
37
|
+
import {
|
|
38
|
+
Alert,
|
|
39
|
+
AlertTitle,
|
|
40
|
+
Button,
|
|
41
|
+
Stack as Stack2,
|
|
42
|
+
Typography as Typography2
|
|
43
|
+
} from "@mui/material";
|
|
33
44
|
import { ButtonEx } from "@xylabs/react-button";
|
|
34
45
|
import { ErrorRender } from "@xylabs/react-error";
|
|
35
46
|
import { isDefined as isDefined3, isUndefined as isUndefined3 } from "@xylabs/sdk-js";
|
|
36
|
-
import
|
|
47
|
+
import { useEffect as useEffect2 } from "react";
|
|
37
48
|
|
|
38
49
|
// src/components/connected/hooks/useConnectAccount.ts
|
|
39
50
|
import { asAddress } from "@xylabs/sdk-js";
|
|
@@ -43,7 +54,7 @@ import { useCallback, useState as useState2 } from "react";
|
|
|
43
54
|
|
|
44
55
|
// src/hooks/client/helpers/findCaveat.ts
|
|
45
56
|
import { isDefined } from "@xylabs/sdk-js";
|
|
46
|
-
var findCaveat =
|
|
57
|
+
var findCaveat = async (permissions, targetCapability, targetCaveatType) => {
|
|
47
58
|
const existingPermissions = await permissions.getPermissions();
|
|
48
59
|
if (isDefined(existingPermissions) && existingPermissions.length > 0) {
|
|
49
60
|
const foundPermissions = existingPermissions.find((p) => p.parentCapability === targetCapability);
|
|
@@ -52,7 +63,7 @@ var findCaveat = /* @__PURE__ */ __name(async (permissions, targetCapability, ta
|
|
|
52
63
|
}
|
|
53
64
|
}
|
|
54
65
|
return existingPermissions;
|
|
55
|
-
}
|
|
66
|
+
};
|
|
56
67
|
|
|
57
68
|
// src/hooks/client/useClientFromWallet.ts
|
|
58
69
|
import { isUndefined as isUndefined2 } from "@xylabs/sdk-js";
|
|
@@ -61,15 +72,15 @@ import { useEffect, useState } from "react";
|
|
|
61
72
|
// src/hooks/helpers/getXyoClient.ts
|
|
62
73
|
import { isUndefined } from "@xylabs/sdk-js";
|
|
63
74
|
var CLIENT_LISTENER_TIMEOUT = 2e3;
|
|
64
|
-
var hasXyoClient =
|
|
75
|
+
var hasXyoClient = () => {
|
|
65
76
|
return "client" in globalThis.xyo;
|
|
66
|
-
}
|
|
67
|
-
var listenForClientInjection =
|
|
77
|
+
};
|
|
78
|
+
var listenForClientInjection = (onClientReady, timeout, onTimeout) => {
|
|
68
79
|
let resolved = false;
|
|
69
|
-
const listener =
|
|
80
|
+
const listener = () => {
|
|
70
81
|
onClientReady();
|
|
71
82
|
resolved = true;
|
|
72
|
-
}
|
|
83
|
+
};
|
|
73
84
|
globalThis.addEventListener("xyo:plugin-ready", listener);
|
|
74
85
|
setTimeout(() => {
|
|
75
86
|
if (!resolved) {
|
|
@@ -77,20 +88,23 @@ var listenForClientInjection = /* @__PURE__ */ __name((onClientReady, timeout, o
|
|
|
77
88
|
onTimeout();
|
|
78
89
|
}
|
|
79
90
|
}, timeout);
|
|
80
|
-
}
|
|
91
|
+
};
|
|
81
92
|
async function getXyoClient(timeout = CLIENT_LISTENER_TIMEOUT) {
|
|
82
93
|
if (isUndefined(globalThis.xyo)) {
|
|
83
94
|
return null;
|
|
84
95
|
}
|
|
85
96
|
return hasXyoClient() ? globalThis.xyo.client : await new Promise((resolve) => {
|
|
86
|
-
listenForClientInjection(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
97
|
+
listenForClientInjection(
|
|
98
|
+
() => {
|
|
99
|
+
resolve(globalThis.xyo.client);
|
|
100
|
+
},
|
|
101
|
+
timeout,
|
|
102
|
+
() => {
|
|
103
|
+
resolve(null);
|
|
104
|
+
}
|
|
105
|
+
);
|
|
91
106
|
});
|
|
92
107
|
}
|
|
93
|
-
__name(getXyoClient, "getXyoClient");
|
|
94
108
|
|
|
95
109
|
// src/hooks/client/useClientFromWallet.ts
|
|
96
110
|
var initialState = {
|
|
@@ -99,11 +113,11 @@ var initialState = {
|
|
|
99
113
|
isLoading: false,
|
|
100
114
|
timedout: false
|
|
101
115
|
};
|
|
102
|
-
var useClientFromWallet =
|
|
116
|
+
var useClientFromWallet = (timeout) => {
|
|
103
117
|
const [state, setState] = useState(initialState);
|
|
104
118
|
useEffect(() => {
|
|
105
119
|
let cancelled = false;
|
|
106
|
-
const initialize =
|
|
120
|
+
const initialize = async () => {
|
|
107
121
|
setState((prev) => {
|
|
108
122
|
if (prev.isLoading) return prev;
|
|
109
123
|
return {
|
|
@@ -139,9 +153,9 @@ var useClientFromWallet = /* @__PURE__ */ __name((timeout) => {
|
|
|
139
153
|
timedout: false
|
|
140
154
|
});
|
|
141
155
|
}
|
|
142
|
-
}
|
|
156
|
+
};
|
|
143
157
|
void initialize();
|
|
144
|
-
const onPluginReady =
|
|
158
|
+
const onPluginReady = () => {
|
|
145
159
|
if (cancelled) return;
|
|
146
160
|
const client = isUndefined2(globalThis.xyo) ? null : globalThis.xyo?.client ?? null;
|
|
147
161
|
setState({
|
|
@@ -150,22 +164,25 @@ var useClientFromWallet = /* @__PURE__ */ __name((timeout) => {
|
|
|
150
164
|
timedout: false,
|
|
151
165
|
error: null
|
|
152
166
|
});
|
|
153
|
-
}
|
|
167
|
+
};
|
|
154
168
|
globalThis.addEventListener("xyo:plugin-ready", onPluginReady);
|
|
155
169
|
return () => {
|
|
156
170
|
cancelled = true;
|
|
157
171
|
globalThis.removeEventListener("xyo:plugin-ready", onPluginReady);
|
|
158
172
|
};
|
|
159
|
-
}, [
|
|
160
|
-
timeout
|
|
161
|
-
]);
|
|
173
|
+
}, [timeout]);
|
|
162
174
|
return state;
|
|
163
|
-
}
|
|
175
|
+
};
|
|
164
176
|
var useClient = useClientFromWallet;
|
|
165
177
|
|
|
166
178
|
// src/hooks/client/permissions/usePermissions.ts
|
|
167
|
-
var usePermissions =
|
|
168
|
-
const {
|
|
179
|
+
var usePermissions = () => {
|
|
180
|
+
const {
|
|
181
|
+
client,
|
|
182
|
+
isLoading,
|
|
183
|
+
error,
|
|
184
|
+
timedout
|
|
185
|
+
} = useClientFromWallet();
|
|
169
186
|
const permissions = client?.permissions;
|
|
170
187
|
return {
|
|
171
188
|
permissions,
|
|
@@ -173,23 +190,30 @@ var usePermissions = /* @__PURE__ */ __name(() => {
|
|
|
173
190
|
error,
|
|
174
191
|
timedout
|
|
175
192
|
};
|
|
176
|
-
}
|
|
193
|
+
};
|
|
177
194
|
|
|
178
195
|
// src/hooks/client/permissions/usePermissionsAccounts.ts
|
|
179
196
|
import { usePromise } from "@xylabs/react-promise";
|
|
180
|
-
import {
|
|
181
|
-
|
|
197
|
+
import {
|
|
198
|
+
isArray,
|
|
199
|
+
isDefined as isDefined2,
|
|
200
|
+
isDefinedNotNull,
|
|
201
|
+
isString
|
|
202
|
+
} from "@xylabs/sdk-js";
|
|
203
|
+
var validateRestrictedAccounts = (restrictedAccounts) => {
|
|
182
204
|
if (isDefined2(restrictedAccounts)) {
|
|
183
205
|
if (isArray(restrictedAccounts) && restrictedAccounts.every(isString)) {
|
|
184
206
|
return restrictedAccounts;
|
|
185
207
|
}
|
|
186
|
-
throw new Error(
|
|
208
|
+
throw new Error(
|
|
209
|
+
`Unrecognized format for restrictReturnedAccounts caveat found on permissions.
|
|
187
210
|
|
|
188
|
-
Should be an array of strings: ${JSON.stringify(restrictedAccounts)}`
|
|
211
|
+
Should be an array of strings: ${JSON.stringify(restrictedAccounts)}`
|
|
212
|
+
);
|
|
189
213
|
}
|
|
190
214
|
return [];
|
|
191
|
-
}
|
|
192
|
-
var useAccountPermissions =
|
|
215
|
+
};
|
|
216
|
+
var useAccountPermissions = () => {
|
|
193
217
|
const { permissions, error } = usePermissions();
|
|
194
218
|
return usePromise(async () => {
|
|
195
219
|
if (isDefinedNotNull(error)) throw error;
|
|
@@ -202,19 +226,22 @@ var useAccountPermissions = /* @__PURE__ */ __name(() => {
|
|
|
202
226
|
);
|
|
203
227
|
return validateRestrictedAccounts(restrictedAccounts);
|
|
204
228
|
}
|
|
205
|
-
}, [
|
|
206
|
-
|
|
207
|
-
]);
|
|
208
|
-
}, "useAccountPermissions");
|
|
229
|
+
}, [permissions]);
|
|
230
|
+
};
|
|
209
231
|
|
|
210
232
|
// src/hooks/client/useGatewayFromWallet.ts
|
|
211
233
|
import { isNull } from "@xylabs/sdk-js";
|
|
212
|
-
var useGatewayFromWallet =
|
|
213
|
-
const {
|
|
214
|
-
|
|
234
|
+
var useGatewayFromWallet = (gatewayName, timeout) => {
|
|
235
|
+
const {
|
|
236
|
+
client,
|
|
237
|
+
isLoading,
|
|
238
|
+
error,
|
|
239
|
+
timedout
|
|
240
|
+
} = useClientFromWallet(timeout);
|
|
241
|
+
const resolveGateway = () => {
|
|
215
242
|
if (isNull(client)) return null;
|
|
216
243
|
return client?.gateways?.[gatewayName];
|
|
217
|
-
}
|
|
244
|
+
};
|
|
218
245
|
return {
|
|
219
246
|
// no gatewayName requested = undefined (opt-out, not "absent")
|
|
220
247
|
gateway: gatewayName ? resolveGateway() : void 0,
|
|
@@ -222,13 +249,17 @@ var useGatewayFromWallet = /* @__PURE__ */ __name((gatewayName, timeout) => {
|
|
|
222
249
|
error,
|
|
223
250
|
timedout
|
|
224
251
|
};
|
|
225
|
-
}
|
|
252
|
+
};
|
|
226
253
|
var useGateway = useGatewayFromWallet;
|
|
227
254
|
|
|
228
255
|
// src/components/connected/hooks/useConnectAccount.ts
|
|
229
|
-
var useConnectAccount =
|
|
256
|
+
var useConnectAccount = (gatewayName = MainNetwork.id, timeout) => {
|
|
230
257
|
const [connectError, setConnectError] = useState2();
|
|
231
|
-
const {
|
|
258
|
+
const {
|
|
259
|
+
gateway,
|
|
260
|
+
error,
|
|
261
|
+
timedout
|
|
262
|
+
} = useGatewayFromWallet(gatewayName, timeout);
|
|
232
263
|
const [accountPermissions, accountPermissionsError] = useAccountPermissions();
|
|
233
264
|
const [address, setAddress] = useState2();
|
|
234
265
|
const connectSigner = useCallback(async () => {
|
|
@@ -242,10 +273,7 @@ var useConnectAccount = /* @__PURE__ */ __name((gatewayName = MainNetwork.id, ti
|
|
|
242
273
|
} catch (e) {
|
|
243
274
|
setConnectError(e);
|
|
244
275
|
}
|
|
245
|
-
}, [
|
|
246
|
-
gateway,
|
|
247
|
-
gatewayName
|
|
248
|
-
]);
|
|
276
|
+
}, [gateway, gatewayName]);
|
|
249
277
|
return {
|
|
250
278
|
address: asAddress(accountPermissions?.[0] ?? address),
|
|
251
279
|
connectSigner,
|
|
@@ -253,68 +281,68 @@ var useConnectAccount = /* @__PURE__ */ __name((gatewayName = MainNetwork.id, ti
|
|
|
253
281
|
gateway,
|
|
254
282
|
timedout
|
|
255
283
|
};
|
|
256
|
-
}
|
|
284
|
+
};
|
|
257
285
|
|
|
258
286
|
// src/components/connected/ConnectAccountsStack.tsx
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
287
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
288
|
+
var DefaultConnectComponent = (props) => /* @__PURE__ */ jsx2(ButtonEx, { variant: "contained", size: "small", ...props });
|
|
289
|
+
var DefaultNoWalletInstalledComponent = () => /* @__PURE__ */ jsxs2(Alert, { severity: "warning", children: [
|
|
290
|
+
/* @__PURE__ */ jsx2(AlertTitle, { children: "XL1 Wallet Not Found" }),
|
|
291
|
+
/* @__PURE__ */ jsx2(Typography2, { gutterBottom: true, children: "Please ensure that your XL1 Wallet is installed to connect your account." }),
|
|
292
|
+
/* @__PURE__ */ jsx2(
|
|
293
|
+
Button,
|
|
294
|
+
{
|
|
295
|
+
sx: { display: "flex", justifySelf: "end" },
|
|
296
|
+
size: "small",
|
|
297
|
+
variant: "outlined",
|
|
298
|
+
href: "https://chromewebstore.google.com/detail/xl1-wallet/fblbagcjeigmhakkfgjpdlcapcgmcfbm",
|
|
299
|
+
target: "_blank",
|
|
300
|
+
rel: "noopener",
|
|
301
|
+
children: "Get XL1 Wallet"
|
|
302
|
+
}
|
|
303
|
+
)
|
|
304
|
+
] });
|
|
305
|
+
var ConnectAccountsStack = ({
|
|
306
|
+
AccountComponent = ConnectedAccount,
|
|
307
|
+
ConnectComponent = DefaultConnectComponent,
|
|
308
|
+
NoWalletInstalledComponent = DefaultNoWalletInstalledComponent,
|
|
309
|
+
onAccountConnected,
|
|
310
|
+
onCancel,
|
|
311
|
+
timeout,
|
|
262
312
|
...props
|
|
263
|
-
})
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
display: "flex",
|
|
271
|
-
justifySelf: "end"
|
|
272
|
-
},
|
|
273
|
-
size: "small",
|
|
274
|
-
variant: "outlined",
|
|
275
|
-
href: "https://chromewebstore.google.com/detail/xl1-wallet/fblbagcjeigmhakkfgjpdlcapcgmcfbm",
|
|
276
|
-
target: "_blank",
|
|
277
|
-
rel: "noopener"
|
|
278
|
-
}, "Get XL1 Wallet")), "DefaultNoWalletInstalledComponent");
|
|
279
|
-
var ConnectAccountsStack = /* @__PURE__ */ __name(({ AccountComponent = ConnectedAccount, ConnectComponent = DefaultConnectComponent, NoWalletInstalledComponent = DefaultNoWalletInstalledComponent, onAccountConnected, onCancel, timeout, ...props }) => {
|
|
280
|
-
const { address, connectSigner, error, timedout } = useConnectAccount(void 0, timeout);
|
|
313
|
+
}) => {
|
|
314
|
+
const {
|
|
315
|
+
address,
|
|
316
|
+
connectSigner,
|
|
317
|
+
error,
|
|
318
|
+
timedout
|
|
319
|
+
} = useConnectAccount(void 0, timeout);
|
|
281
320
|
useEffect2(() => {
|
|
282
321
|
if (isDefined3(error) && isDefined3(onCancel)) {
|
|
283
322
|
onCancel();
|
|
284
323
|
}
|
|
285
|
-
}, [
|
|
286
|
-
error,
|
|
287
|
-
onCancel
|
|
288
|
-
]);
|
|
324
|
+
}, [error, onCancel]);
|
|
289
325
|
useEffect2(() => {
|
|
290
326
|
if (isDefined3(address) && isDefined3(onAccountConnected)) {
|
|
291
327
|
onAccountConnected(address);
|
|
292
328
|
}
|
|
293
|
-
}, [
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
props.sx
|
|
329
|
+
}, [address, onAccountConnected]);
|
|
330
|
+
return /* @__PURE__ */ jsxs2(
|
|
331
|
+
Stack2,
|
|
332
|
+
{
|
|
333
|
+
direction: "row",
|
|
334
|
+
spacing: 2,
|
|
335
|
+
...props,
|
|
336
|
+
sx: [{ alignItems: "start" }, ...Array.isArray(props.sx) ? props.sx : [props.sx]],
|
|
337
|
+
children: [
|
|
338
|
+
isDefined3(address) ? /* @__PURE__ */ jsx2(AccountComponent, { address }) : null,
|
|
339
|
+
isUndefined3(address) && !timedout ? /* @__PURE__ */ jsx2(ConnectComponent, { onClick: () => void connectSigner(), children: "Connect" }) : null,
|
|
340
|
+
isUndefined3(address) && timedout ? /* @__PURE__ */ jsx2(NoWalletInstalledComponent, {}) : null,
|
|
341
|
+
/* @__PURE__ */ jsx2(ErrorRender, { error, scope: "ConnectSigner:error" })
|
|
307
342
|
]
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
}) : null, isUndefined3(address) && !timedout ? /* @__PURE__ */ React2.createElement(ConnectComponent, {
|
|
312
|
-
onClick: /* @__PURE__ */ __name(() => void connectSigner(), "onClick")
|
|
313
|
-
}, "Connect") : null, isUndefined3(address) && timedout ? /* @__PURE__ */ React2.createElement(NoWalletInstalledComponent, null) : null, /* @__PURE__ */ React2.createElement(ErrorRender, {
|
|
314
|
-
error,
|
|
315
|
-
scope: "ConnectSigner:error"
|
|
316
|
-
}));
|
|
317
|
-
}, "ConnectAccountsStack");
|
|
343
|
+
}
|
|
344
|
+
);
|
|
345
|
+
};
|
|
318
346
|
|
|
319
347
|
// src/context/GatewayContext.ts
|
|
320
348
|
import { createContextEx } from "@xylabs/react-shared";
|
|
@@ -326,12 +354,24 @@ var InPageGatewaysContext = createContextEx2();
|
|
|
326
354
|
|
|
327
355
|
// src/context/in-page/Provider.tsx
|
|
328
356
|
import { DefaultNetworks as DefaultNetworks2 } from "@xyo-network/xl1-sdk";
|
|
329
|
-
import
|
|
357
|
+
import {
|
|
358
|
+
startTransition,
|
|
359
|
+
useCallback as useCallback2,
|
|
360
|
+
useEffect as useEffect3,
|
|
361
|
+
useMemo,
|
|
362
|
+
useState as useState3
|
|
363
|
+
} from "react";
|
|
330
364
|
|
|
331
365
|
// src/context/in-page/lib/buildGateway.ts
|
|
332
366
|
import { assertEx as assertEx2, isDefined as isDefined4 } from "@xylabs/sdk-js";
|
|
333
|
-
import {
|
|
334
|
-
|
|
367
|
+
import {
|
|
368
|
+
basicRemoteRunnerLocator,
|
|
369
|
+
basicRemoteViewerLocator,
|
|
370
|
+
DefaultNetworks,
|
|
371
|
+
NetworkDataLakeUrls,
|
|
372
|
+
XyoGatewayMoniker
|
|
373
|
+
} from "@xyo-network/xl1-sdk";
|
|
374
|
+
var buildGateway = async (gatewayName, signerTransport) => {
|
|
335
375
|
const network = DefaultNetworks.find((network2) => network2.id === gatewayName);
|
|
336
376
|
const resolvedNetwork = assertEx2(network, () => `No network found for id ${gatewayName}`);
|
|
337
377
|
const remoteConfig = {
|
|
@@ -343,10 +383,11 @@ var buildGateway = /* @__PURE__ */ __name(async (gatewayName, signerTransport) =
|
|
|
343
383
|
const dataLakeEndpoint = NetworkDataLakeUrls[gatewayName];
|
|
344
384
|
const locator = isDefined4(signerTransport) ? await basicRemoteRunnerLocator(gatewayName, remoteConfig, signerTransport, dataLakeEndpoint) : await basicRemoteViewerLocator(gatewayName, remoteConfig, dataLakeEndpoint);
|
|
345
385
|
return await locator.getInstance(XyoGatewayMoniker);
|
|
346
|
-
}
|
|
386
|
+
};
|
|
347
387
|
|
|
348
388
|
// src/context/in-page/Provider.tsx
|
|
349
|
-
|
|
389
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
390
|
+
var InPageGatewaysProvider = ({ signerTransport, children }) => {
|
|
350
391
|
const [gateways, setGateways] = useState3({});
|
|
351
392
|
const [errors, setErrors] = useState3({});
|
|
352
393
|
const [previousSignerTransport, setPreviousSignerTransport] = useState3(signerTransport);
|
|
@@ -360,14 +401,13 @@ var InPageGatewaysProvider = /* @__PURE__ */ __name(({ signerTransport, children
|
|
|
360
401
|
}
|
|
361
402
|
useEffect3(() => {
|
|
362
403
|
let cancelled = false;
|
|
363
|
-
const buildAll =
|
|
364
|
-
const results = await Promise.allSettled(
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
id: network.id,
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
}));
|
|
404
|
+
const buildAll = async () => {
|
|
405
|
+
const results = await Promise.allSettled(
|
|
406
|
+
DefaultNetworks2.map(async (network) => {
|
|
407
|
+
const gateway = await buildGateway(network.id, signerTransport);
|
|
408
|
+
return { id: network.id, gateway };
|
|
409
|
+
})
|
|
410
|
+
);
|
|
371
411
|
if (cancelled) return;
|
|
372
412
|
const nextGateways = {};
|
|
373
413
|
const nextErrors = {};
|
|
@@ -383,14 +423,12 @@ var InPageGatewaysProvider = /* @__PURE__ */ __name(({ signerTransport, children
|
|
|
383
423
|
setGateways(nextGateways);
|
|
384
424
|
setErrors(nextErrors);
|
|
385
425
|
});
|
|
386
|
-
}
|
|
426
|
+
};
|
|
387
427
|
void buildAll();
|
|
388
428
|
return () => {
|
|
389
429
|
cancelled = true;
|
|
390
430
|
};
|
|
391
|
-
}, [
|
|
392
|
-
signerTransport
|
|
393
|
-
]);
|
|
431
|
+
}, [signerTransport]);
|
|
394
432
|
const value = useMemo(() => {
|
|
395
433
|
const value2 = {
|
|
396
434
|
clearAll,
|
|
@@ -399,27 +437,29 @@ var InPageGatewaysProvider = /* @__PURE__ */ __name(({ signerTransport, children
|
|
|
399
437
|
provided: true
|
|
400
438
|
};
|
|
401
439
|
return value2;
|
|
402
|
-
}, [
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
gateways
|
|
406
|
-
]);
|
|
407
|
-
return /* @__PURE__ */ React3.createElement(InPageGatewaysContext, {
|
|
408
|
-
value
|
|
409
|
-
}, children);
|
|
410
|
-
}, "InPageGatewaysProvider");
|
|
440
|
+
}, [clearAll, errors, gateways]);
|
|
441
|
+
return /* @__PURE__ */ jsx3(InPageGatewaysContext, { value, children });
|
|
442
|
+
};
|
|
411
443
|
|
|
412
444
|
// src/context/in-page/useProvidedInPageGateways.ts
|
|
413
445
|
import { useContextEx } from "@xylabs/react-shared";
|
|
414
|
-
var useProvidedInPageGateways =
|
|
446
|
+
var useProvidedInPageGateways = (required = true) => useContextEx(InPageGatewaysContext, "InPageGateways", required);
|
|
415
447
|
|
|
416
448
|
// src/context/providers/GatewayProvider.tsx
|
|
417
449
|
import { ErrorRender as ErrorRender2 } from "@xylabs/react-error";
|
|
418
450
|
import { isDefinedNotNull as isDefinedNotNull2, isNull as isNull2 } from "@xylabs/sdk-js";
|
|
419
|
-
import
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
const {
|
|
451
|
+
import { useMemo as useMemo2 } from "react";
|
|
452
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
453
|
+
var GatewayProvider = ({ gatewayName, children }) => {
|
|
454
|
+
const {
|
|
455
|
+
gateway: gatewayFromWallet,
|
|
456
|
+
error: gatewayFromWalletError
|
|
457
|
+
} = useGatewayFromWallet(gatewayName);
|
|
458
|
+
const {
|
|
459
|
+
gateways: allGateways,
|
|
460
|
+
errors: allGatewayErrors,
|
|
461
|
+
clearAll
|
|
462
|
+
} = useProvidedInPageGateways(true);
|
|
423
463
|
const gatewayFromConfig = gatewayName ? allGateways[gatewayName] : void 0;
|
|
424
464
|
const gatewayFromConfigError = gatewayName ? allGatewayErrors[gatewayName] : void 0;
|
|
425
465
|
const { defaultGateway, gateways } = useMemo2(() => {
|
|
@@ -447,10 +487,7 @@ var GatewayProvider = /* @__PURE__ */ __name(({ gatewayName, children }) => {
|
|
|
447
487
|
walletGateway: void 0
|
|
448
488
|
}
|
|
449
489
|
};
|
|
450
|
-
}, [
|
|
451
|
-
gatewayFromConfig,
|
|
452
|
-
gatewayFromWallet
|
|
453
|
-
]);
|
|
490
|
+
}, [gatewayFromConfig, gatewayFromWallet]);
|
|
454
491
|
const value = useMemo2(() => {
|
|
455
492
|
const value2 = {
|
|
456
493
|
defaultGateway,
|
|
@@ -467,18 +504,21 @@ var GatewayProvider = /* @__PURE__ */ __name(({ gatewayName, children }) => {
|
|
|
467
504
|
gateways,
|
|
468
505
|
clearAll
|
|
469
506
|
]);
|
|
470
|
-
return /* @__PURE__ */
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
}, "GatewayProvider");
|
|
507
|
+
return /* @__PURE__ */ jsxs3(GatewayContext, { value, children: [
|
|
508
|
+
/* @__PURE__ */ jsx4(ErrorRender2, { error: gatewayFromConfigError }),
|
|
509
|
+
children
|
|
510
|
+
] });
|
|
511
|
+
};
|
|
476
512
|
|
|
477
513
|
// src/context/providers/WalletGatewayProvider.tsx
|
|
478
514
|
import { ErrorRender as ErrorRender3 } from "@xylabs/react-error";
|
|
479
|
-
import
|
|
480
|
-
|
|
481
|
-
|
|
515
|
+
import { useMemo as useMemo3 } from "react";
|
|
516
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
517
|
+
var WalletGatewayProvider = ({ gatewayName, children }) => {
|
|
518
|
+
const {
|
|
519
|
+
gateway: gatewayFromWallet,
|
|
520
|
+
error: gatewayFromWalletError
|
|
521
|
+
} = useGatewayFromWallet(gatewayName);
|
|
482
522
|
const { defaultGateway, gateways } = useMemo3(() => {
|
|
483
523
|
return {
|
|
484
524
|
defaultGateway: gatewayFromWallet,
|
|
@@ -487,9 +527,7 @@ var WalletGatewayProvider = /* @__PURE__ */ __name(({ gatewayName, children }) =
|
|
|
487
527
|
walletGateway: gatewayFromWallet
|
|
488
528
|
}
|
|
489
529
|
};
|
|
490
|
-
}, [
|
|
491
|
-
gatewayFromWallet
|
|
492
|
-
]);
|
|
530
|
+
}, [gatewayFromWallet]);
|
|
493
531
|
const value = useMemo3(() => {
|
|
494
532
|
const value2 = {
|
|
495
533
|
defaultGateway,
|
|
@@ -503,16 +541,15 @@ var WalletGatewayProvider = /* @__PURE__ */ __name(({ gatewayName, children }) =
|
|
|
503
541
|
gatewayFromWalletError,
|
|
504
542
|
gateways
|
|
505
543
|
]);
|
|
506
|
-
return /* @__PURE__ */
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
}, "WalletGatewayProvider");
|
|
544
|
+
return /* @__PURE__ */ jsxs4(GatewayContext, { value, children: [
|
|
545
|
+
/* @__PURE__ */ jsx5(ErrorRender3, { error: gatewayFromWalletError }),
|
|
546
|
+
children
|
|
547
|
+
] });
|
|
548
|
+
};
|
|
512
549
|
|
|
513
550
|
// src/context/useProvidedGateway.ts
|
|
514
551
|
import { useContextEx as useContextEx2 } from "@xylabs/react-shared";
|
|
515
|
-
var useProvidedGateway =
|
|
552
|
+
var useProvidedGateway = (required = true) => useContextEx2(GatewayContext, "Gateway", required);
|
|
516
553
|
export {
|
|
517
554
|
ConnectAccountsStack,
|
|
518
555
|
ConnectedAccount,
|
|
@@ -533,4 +570,4 @@ export {
|
|
|
533
570
|
useProvidedGateway,
|
|
534
571
|
useProvidedInPageGateways
|
|
535
572
|
};
|
|
536
|
-
//# sourceMappingURL=index.mjs.map
|
|
573
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/connected/account/Connected.tsx","../../src/components/connected/ConnectAccountsStack.tsx","../../src/components/connected/hooks/useConnectAccount.ts","../../src/hooks/client/helpers/findCaveat.ts","../../src/hooks/client/useClientFromWallet.ts","../../src/hooks/helpers/getXyoClient.ts","../../src/hooks/client/permissions/usePermissions.ts","../../src/hooks/client/permissions/usePermissionsAccounts.ts","../../src/hooks/client/useGatewayFromWallet.ts","../../src/context/GatewayContext.ts","../../src/context/in-page/InPageGatewaysContext.ts","../../src/context/in-page/Provider.tsx","../../src/context/in-page/lib/buildGateway.ts","../../src/context/in-page/useProvidedInPageGateways.ts","../../src/context/providers/GatewayProvider.tsx","../../src/context/providers/WalletGatewayProvider.tsx","../../src/context/useProvidedGateway.ts"],"sourcesContent":["import {\n Stack, Tooltip, Typography,\n} from '@mui/material'\nimport { EthAddressWrapper } from '@xylabs/sdk-js'\nimport { BlockiesAvatarAddress } from '@xyo-network/xl1-blockies'\nimport React from 'react'\n\n/**\n * @deprecated Use {@link ConnectedAccount} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const ConnectedAccount: React.FC<{ address: string }> = ({ address }) => {\n const shortenedAddress = `${EthAddressWrapper.fromString(address)?.toShortString(4)}`\n\n return (\n <Stack\n direction=\"row\"\n spacing={1}\n sx={{ alignItems: 'center' }}\n >\n <BlockiesAvatarAddress address={address} size={21} />\n <Tooltip title={address}>\n <Typography\n variant=\"caption\"\n sx={{\n color: 'text.secondary',\n fontFamily: 'monospace',\n }}\n >\n {shortenedAddress}\n </Typography>\n </Tooltip>\n </Stack>\n )\n}\n","import type { StackProps } from '@mui/material'\nimport {\n Alert, AlertTitle, Button, Stack,\n Typography,\n} from '@mui/material'\nimport type { ButtonExProps } from '@xylabs/react-button'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ErrorRender } from '@xylabs/react-error'\nimport type { Address } from '@xylabs/sdk-js'\nimport { isDefined, isUndefined } from '@xylabs/sdk-js'\nimport type { ComponentType, MouseEventHandler } from 'react'\nimport React, { useEffect } from 'react'\n\nimport { ConnectedAccount } from './account/index.ts'\nimport { useConnectAccount } from './hooks/index.ts'\n\nconst DefaultConnectComponent: React.FC<ButtonExProps> = props => (\n <ButtonEx variant=\"contained\" size=\"small\" {...props} />\n)\n\nconst DefaultNoWalletInstalledComponent: React.FC = () => (\n <Alert severity=\"warning\">\n <AlertTitle>XL1 Wallet Not Found</AlertTitle>\n <Typography gutterBottom>\n Please ensure that your XL1 Wallet is installed to connect your account.\n </Typography>\n <Button\n sx={{ display: 'flex', justifySelf: 'end' }}\n size=\"small\"\n variant=\"outlined\"\n href=\"https://chromewebstore.google.com/detail/xl1-wallet/fblbagcjeigmhakkfgjpdlcapcgmcfbm\"\n target=\"_blank\"\n rel=\"noopener\"\n >\n Get XL1 Wallet\n </Button>\n </Alert>\n)\n\n/**\n * @deprecated Use {@link ConnectClientAccountsStackProps} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport interface ConnectClientAccountsStackProps extends StackProps {\n AccountComponent?: ComponentType<{ account?: string }>\n ConnectComponent?: ComponentType<{ onClick?: MouseEventHandler<HTMLElement> }>\n NoWalletInstalledComponent?: ComponentType\n onAccountConnected?: (account: Address) => void\n onCancel?: () => void\n timeout?: number\n}\n\n/**\n * Renders a horizontal stack that surfaces the current state of the user's\n * connection to an XL1 wallet (e.g. the XL1 Chrome extension) and lets them\n * kick off a connection.\n *\n * Connection state is derived from `useConnectAccount`, which wraps\n * `useGatewayFromWallet` (wallet/gateway discovery with a configurable\n * `timeout`) and `useAccountPermissions` (already-authorized addresses).\n * The hook returns: `address` (resolved once the wallet exposes one),\n * `connectSigner` (prompts the wallet for an address), `timedout` (the\n * gateway never appeared within `timeout`), and `error` (the first of\n * gateway, permissions, or signer-connect failures).\n *\n * The component renders exactly one of the following wallet states, plus\n * an always-present error slot:\n *\n * - **Connected** — `address` is defined: renders `AccountComponent` for\n * that address. Also fires `onAccountConnected(address)` once via effect.\n * - **Disconnected, wallet available** — no `address` and not `timedout`:\n * renders `ConnectComponent` as a \"Connect\" button that invokes\n * `connectSigner()`. This covers both \"wallet installed but no account\n * authorized yet\" and \"gateway still resolving\".\n * - **Wallet missing / unreachable** — no `address` and `timedout` is true:\n * renders `NoWalletInstalledComponent` (defaults to an Alert linking to\n * the XL1 Wallet Chrome Web Store listing).\n * - **Error** — any error from the hook is rendered via `ErrorRender`\n * alongside the state above, and `onCancel()` is fired once via effect\n * so the host UI can close/abort its connect flow.\n *\n * All three slot components (`AccountComponent`, `ConnectComponent`,\n * `NoWalletInstalledComponent`) are injectable so consumers can restyle\n * any state without forking this component.\n *\n * @deprecated Use {@link ConnectAccountsStack} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const ConnectAccountsStack: React.FC<ConnectClientAccountsStackProps> = ({\n AccountComponent = ConnectedAccount,\n ConnectComponent = DefaultConnectComponent,\n NoWalletInstalledComponent = DefaultNoWalletInstalledComponent,\n onAccountConnected,\n onCancel,\n timeout,\n ...props\n}) => {\n const {\n address, connectSigner, error, timedout,\n } = useConnectAccount(undefined, timeout)\n\n useEffect(() => {\n if (isDefined(error) && isDefined(onCancel)) {\n onCancel()\n }\n }, [error, onCancel])\n\n useEffect(() => {\n if (isDefined(address) && isDefined(onAccountConnected)) {\n onAccountConnected(address)\n }\n }, [address, onAccountConnected])\n\n return (\n <Stack\n direction=\"row\"\n spacing={2}\n {...props}\n sx={[{ alignItems: 'start' }, ...(Array.isArray(props.sx) ? props.sx : [props.sx])]}\n >\n {isDefined(address)\n ? <AccountComponent address={address} />\n : null}\n {isUndefined(address) && !timedout\n ? (\n <ConnectComponent onClick={() => void connectSigner()}>Connect</ConnectComponent>\n )\n : null}\n {isUndefined(address) && timedout\n ? (\n <NoWalletInstalledComponent />\n )\n : null}\n <ErrorRender error={error} scope=\"ConnectSigner:error\" />\n </Stack>\n )\n}\n","import { type Address, asAddress } from '@xylabs/sdk-js'\nimport { assertEx } from '@xylabs/sdk-js'\nimport type { GatewayName } from '@xyo-network/xl1-sdk'\nimport { MainNetwork } from '@xyo-network/xl1-sdk'\nimport { useCallback, useState } from 'react'\n\nimport { useAccountPermissions, useGatewayFromWallet } from '../../../hooks/index.ts'\n\n/**\n * @deprecated Use {@link useConnectAccount} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const useConnectAccount = (gatewayName: GatewayName = MainNetwork.id, timeout?: number) => {\n const [connectError, setConnectError] = useState<Error>()\n\n const {\n gateway, error, timedout,\n } = useGatewayFromWallet(gatewayName, timeout)\n\n const [accountPermissions, accountPermissionsError] = useAccountPermissions()\n\n const [address, setAddress] = useState<Address>()\n\n const connectSigner = useCallback(async () => {\n try {\n setConnectError(undefined)\n const assertedGateway = assertEx(gateway, () => `Gateway ${gatewayName} is not available`)\n const signer = assertedGateway.signer\n const address = await signer.address()\n setAddress(address)\n return address\n } catch (e) {\n setConnectError(e as Error)\n }\n }, [gateway, gatewayName])\n\n return {\n address: asAddress(accountPermissions?.[0] ?? address), connectSigner, error: error ?? accountPermissionsError ?? connectError, gateway, timedout,\n }\n}\n","import { isDefined } from '@xylabs/sdk-js'\nimport type {\n CaveatTypes, ParentCapability, XyoPermissions,\n} from '@xyo-network/xl1-sdk'\n\n/**\n * @deprecated Use {@link findCaveat} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const findCaveat = async (\n permissions: XyoPermissions,\n targetCapability: ParentCapability,\n targetCaveatType: CaveatTypes,\n) => {\n const existingPermissions = await permissions.getPermissions()\n if (isDefined(existingPermissions) && existingPermissions.length > 0) {\n const foundPermissions = existingPermissions\n .find(p => p.parentCapability === targetCapability)\n if (isDefined(foundPermissions)) {\n return foundPermissions.caveats?.find(caveat => caveat.type === targetCaveatType)?.value ?? []\n }\n }\n return existingPermissions\n}\n","import { isUndefined } from '@xylabs/sdk-js'\nimport type { XyoClient } from '@xyo-network/xl1-sdk'\nimport { useEffect, useState } from 'react'\n\nimport { getXyoClient } from '../helpers/index.ts'\n\ninterface ClientState {\n client?: XyoClient | null\n error: Error | null\n isLoading: boolean\n timedout: boolean\n}\n\nconst initialState: ClientState = {\n client: undefined,\n error: null,\n isLoading: false,\n timedout: false,\n}\n\n/**\n * @deprecated Use {@link useClientFromWallet} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const useClientFromWallet = (timeout?: number): ClientState => {\n const [state, setState] = useState<ClientState>(initialState)\n\n useEffect(() => {\n let cancelled = false\n\n const initialize = async () => {\n setState((prev) => {\n if (prev.isLoading) return prev\n return {\n ...prev, isLoading: true, error: null,\n }\n })\n\n try {\n const client = await getXyoClient(timeout)\n if (cancelled) return\n if (client === null) {\n setState({\n client: null, timedout: true, isLoading: false, error: null,\n })\n } else {\n setState({\n client, isLoading: false, error: null, timedout: false,\n })\n }\n } catch (error) {\n if (cancelled) return\n setState({\n client: undefined, isLoading: false, error: error as Error, timedout: false,\n })\n }\n }\n\n void initialize()\n\n // Late recovery: if wallet loads after timeout, update state\n const onPluginReady = () => {\n if (cancelled) return\n const client = isUndefined(globalThis.xyo) ? null : globalThis.xyo?.client ?? null\n setState({\n client, isLoading: false, timedout: false, error: null,\n })\n }\n globalThis.addEventListener('xyo:plugin-ready', onPluginReady)\n\n return () => {\n cancelled = true\n globalThis.removeEventListener('xyo:plugin-ready', onPluginReady)\n }\n }, [timeout])\n\n return state\n}\n\n/** @deprecated - use useClientFromWallet instead */\nexport const useClient = useClientFromWallet\n","import { isUndefined } from '@xylabs/sdk-js'\nimport type { XyoClient } from '@xyo-network/xl1-sdk'\n\nconst CLIENT_LISTENER_TIMEOUT = 2000\n\nconst hasXyoClient = () => {\n return 'client' in globalThis.xyo\n}\n\n/**\n * @deprecated Use {@link listenForClientInjection} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const listenForClientInjection = (onClientReady: () => void, timeout: number, onTimeout: () => void) => {\n let resolved = false\n const listener: EventListener = () => {\n onClientReady()\n resolved = true\n }\n globalThis.addEventListener('xyo:plugin-ready', listener)\n setTimeout(() => {\n if (!resolved) {\n globalThis.removeEventListener('xyo:plugin-ready', listener)\n onTimeout()\n }\n }, timeout)\n}\n\ntype ReturnType = XyoClient | undefined | null\n\n/**\n * @deprecated Use {@link getXyoClient} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport async function getXyoClient(timeout = CLIENT_LISTENER_TIMEOUT): Promise<ReturnType> {\n // if no xyo object, we can bail early\n if (isUndefined(globalThis.xyo)) {\n return null\n }\n return hasXyoClient()\n ? globalThis.xyo.client\n // listen for the XyoWallet to be injected\n : await new Promise<ReturnType>((resolve) => {\n listenForClientInjection(\n () => {\n resolve(globalThis.xyo.client)\n },\n timeout,\n () => {\n resolve(null)\n },\n )\n })\n}\n","import { useClientFromWallet } from '../useClientFromWallet.ts'\n\n/**\n * @deprecated Use {@link usePermissions} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const usePermissions = () => {\n const {\n client, isLoading, error, timedout,\n } = useClientFromWallet()\n const permissions = client?.permissions\n return {\n permissions,\n isLoading,\n error,\n timedout,\n }\n}\n","import { usePromise } from '@xylabs/react-promise'\nimport type { JsonValue } from '@xylabs/sdk-js'\nimport {\n isArray, isDefined, isDefinedNotNull, isString,\n} from '@xylabs/sdk-js'\n\nimport { findCaveat } from '../helpers/index.ts'\nimport { usePermissions } from './usePermissions.ts'\n\nconst validateRestrictedAccounts = (restrictedAccounts: JsonValue): readonly string [] => {\n if (isDefined(restrictedAccounts)) {\n if (isArray(restrictedAccounts) && restrictedAccounts.every(isString)) {\n return restrictedAccounts\n }\n throw new Error(\n `Unrecognized format for restrictReturnedAccounts caveat found on permissions. \\n\n Should be an array of strings: ${JSON.stringify(restrictedAccounts)}`,\n )\n }\n return []\n}\n\n/**\n * @deprecated Use {@link useAccountPermissions} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const useAccountPermissions = () => {\n const { permissions, error } = usePermissions()\n\n return usePromise(async () => {\n if (isDefinedNotNull(error)) throw error\n if (isDefined(permissions)) {\n const restrictedAccounts = await findCaveat(\n permissions,\n // TODO - extract to constant in protocol package\n 'xyoWallet_getAccounts',\n 'restrictReturnedAccounts',\n )\n return validateRestrictedAccounts(restrictedAccounts)\n }\n }, [permissions])\n}\n","import { isNull } from '@xylabs/sdk-js'\nimport type { GatewayName } from '@xyo-network/xl1-sdk'\n\nimport type { GatewayFromWallet } from '../../types/index.ts'\nimport { useClientFromWallet } from './useClientFromWallet.ts'\n\n/**\n * Resolves a gateway from the injected XL1 Wallet extension.\n *\n * The returned `gateway` uses a three-state contract:\n * - `undefined` — wallet detection is still in progress (isLoading=true),\n * or no gatewayName was provided. Consumers should treat this as \"not yet known\"\n * and avoid committing to either a present or absent UI state.\n * - `null` — wallet is definitively absent. Either globalThis.xyo was never set,\n * or detection timed out. Safe to show fallback UI (e.g. \"Get XL1 Wallet\").\n * A late-recovery listener may still transition this to a real gateway if\n * the extension loads after the timeout.\n * - `XyoGatewayRunner` — wallet is present and exposes this gateway for the\n * requested network. Ready to use for transactions and queries.\n *\n * @deprecated Use {@link useGatewayFromWallet} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const useGatewayFromWallet = (gatewayName?: GatewayName, timeout?: number): GatewayFromWallet => {\n const {\n client, isLoading, error, timedout,\n } = useClientFromWallet(timeout)\n\n const resolveGateway = () => {\n // null client = wallet confirmed absent (no globalThis.xyo or timed out)\n if (isNull(client)) return null\n // client is undefined (still loading) or defined (wallet present) —\n // optional chain returns undefined while loading, or the gateway if available\n return client?.gateways?.[gatewayName!]\n }\n\n return {\n // no gatewayName requested = undefined (opt-out, not \"absent\")\n gateway: gatewayName ? resolveGateway() : undefined,\n isLoading,\n error,\n timedout,\n }\n}\n\n/** @deprecated - useGatewayFromWallet */\nexport const useGateway = useGatewayFromWallet\n","import { createContextEx } from '@xylabs/react-shared'\n\nimport type { GatewayContextState } from './GatewayProviderState.ts'\n\n/**\n * Shared React context that decouples gateway *sources* from gateway\n * *consumers*. Any provider that can resolve an `XyoGateway` publishes to\n * this context; any hook or component that needs a gateway reads from it\n * via `useProvidedGateway`. Consumers never import a specific provider —\n * they just require that *some* provider is mounted above them in the\n * tree.\n *\n * Current publishers:\n * - `WalletGatewayProvider` (this package) — sources gateways from the\n * injected XL1 wallet extension.\n * - `GatewayProvider` in `@xyo-network/react-chain-provider` — sources\n * gateways built in-page against RPC endpoints, falling back to the\n * wallet when available.\n *\n * To add a new source (e.g. a mock provider for tests, an iframe-bridged\n * provider, a server-rendered provider), publish a `GatewayContextState`\n * to this same context — do not create a parallel context, or consumers\n * will silently stop receiving updates.\n *\n * @deprecated Use {@link GatewayContext} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const GatewayContext = createContextEx<GatewayContextState>()\n","import { createContextEx } from '@xylabs/react-shared'\n\nimport type { InPageGatewaysState } from './InPageGatewaysState.ts'\n\n/**\n * Narrow, provider-internal context that `InPageGatewaysProvider` writes\n * to and `GatewayProvider` reads from. Do not consume this in application\n * code — use `useProvidedGateway` (which reads the shared\n * `GatewayContext`) instead. This context only exists to decouple the\n * single in-page *builder* from the many single-gateway *adapters* that\n * sit between it and the shared gateway surface.\n *\n * @deprecated Use {@link InPageGatewaysContext} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const InPageGatewaysContext = createContextEx<InPageGatewaysState>()\n","import type {\n GatewayName, RpcTransport, XyoSignerRpcSchemas,\n} from '@xyo-network/xl1-sdk'\nimport { DefaultNetworks } from '@xyo-network/xl1-sdk'\nimport type { PropsWithChildren } from 'react'\nimport React, {\n startTransition,\n useCallback, useEffect, useMemo, useState,\n} from 'react'\n\nimport type { ContextGatewayType } from '../../types/index.ts'\nimport { InPageGatewaysContext } from './InPageGatewaysContext.ts'\nimport type { InPageGatewaysState } from './InPageGatewaysState.ts'\nimport { buildGateway } from './lib/index.ts'\n\n/**\n * @deprecated Use {@link InPageGatewaysProviderProps} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport interface InPageGatewaysProviderProps extends PropsWithChildren {\n signerTransport?: RpcTransport<XyoSignerRpcSchemas>\n}\n\n/**\n * Publishes a keyed map of in-page gateways — one per network in\n * `DefaultNetworks` — under the narrow `InPageGatewaysContext`.\n *\n * This provider is deliberately *not* a direct publisher of the shared\n * `GatewayContext` that `useProvidedGateway` reads. Its consumer is the\n * wrapping `GatewayProvider` in this same package, which picks the\n * `gatewayName` the consumer asked for out of this map, adapts it into\n * the single-gateway `GatewayContextState` shape, and then publishes *that*\n * to the shared context. Splitting the work this way lets one\n * `InPageGatewaysProvider` near the root build every network's gateway\n * once, while many `GatewayProvider` instances deeper in the tree each\n * expose whichever gateway their subtree cares about.\n *\n * Unlike `WalletGatewayProvider`, gateways here are constructed directly\n * in the page (via `buildGateway`) against each network's RPC endpoint\n * — no browser wallet extension is required. `signerTransport` switches\n * between viewer (read-only) and runner (can sign/send) locators; supply\n * it only when the app needs to sign.\n *\n * Behavior:\n * - On mount, and whenever `signerTransport` changes, `buildGateway` is\n * called in parallel for every network in `DefaultNetworks` via\n * `Promise.allSettled`. Networks that resolve populate `gateways[id]`;\n * networks that reject populate `errors[id]`. One failed network does\n * not block the others.\n * - If `signerTransport` is provided, gateways are built with a remote\n * *runner* locator, otherwise with a remote *viewer* locator.\n * - When `signerTransport` changes identity mid-life, the provider clears\n * all cached gateways and errors synchronously during render (via\n * `previousSignerTransport` state) so consumers never see gateways\n * bound to the previous transport, then rebuilds in the effect.\n * - State updates from the rebuild are wrapped in `startTransition` so a\n * slow network doesn't stall higher-priority UI updates.\n * - A `cancelled` flag in the effect's cleanup discards results from a\n * prior `signerTransport` once a new one is in flight.\n *\n * Published `InPageGatewaysState` (narrower than `GatewayContextState` —\n * this is an internal handoff shape, not the cross-publisher surface):\n * - `gateways` — `Partial<Record<GatewayName, ContextGatewayType>>`. Keys\n * are only present for networks that built successfully.\n * - `errors` — `Partial<Record<GatewayName, Error>>`. Per-network build\n * failures, keyed by `GatewayName`.\n * - `clearAll()` — manually empties both maps. Also invoked internally on\n * transport changes. Forwarded by `GatewayProvider` to consumers as\n * `resetGatewaysFromConfig`.\n * - `provided: true` — lets descendants detect a real provider.\n *\n * Note: the commented-out `SimpleXyoClient` at the top is intentionally\n * disabled pending a type unification between `XyoGateway` and\n * `XyoGatewayRunner`.\n *\n * @deprecated Use {@link InPageGatewaysProvider} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const InPageGatewaysProvider: React.FC<InPageGatewaysProviderProps> = ({ signerTransport, children }) => {\n const [gateways, setGateways] = useState<Partial<Record<GatewayName, ContextGatewayType>>>({})\n const [errors, setErrors] = useState<Partial<Record<GatewayName, Error>>>({})\n const [previousSignerTransport, setPreviousSignerTransport] = useState<RpcTransport<XyoSignerRpcSchemas> | undefined>(signerTransport)\n\n // This can come back once we homogenize the type for XyoGateway.\n // Right now, SimpleXyoClient takes XyoGatewayRunners but ideally it would take XyoGateway.\n // const clientInPage = useMemo(() => new SimpleXyoClient(gateways, {}), [gateways])\n\n const clearAll = useCallback(() => {\n setGateways({})\n setErrors({})\n }, [])\n\n if (previousSignerTransport !== signerTransport) {\n clearAll()\n setPreviousSignerTransport(signerTransport)\n }\n\n useEffect(() => {\n let cancelled = false\n\n const buildAll = async () => {\n const results = await Promise.allSettled(\n DefaultNetworks.map(async (network) => {\n const gateway = await buildGateway(network.id as GatewayName, signerTransport)\n return { id: network.id as GatewayName, gateway }\n }),\n )\n\n if (cancelled) return\n\n const nextGateways: Partial<Record<GatewayName, ContextGatewayType>> = {}\n const nextErrors: Partial<Record<GatewayName, Error>> = {}\n\n for (const [index, result] of results.entries()) {\n const networkId = DefaultNetworks[index].id as GatewayName\n if (result.status === 'fulfilled') {\n nextGateways[networkId] = result.value.gateway\n } else {\n nextErrors[networkId] = result.reason instanceof Error ? result.reason : new Error(String(result.reason))\n }\n }\n\n startTransition(() => {\n setGateways(nextGateways)\n setErrors(nextErrors)\n })\n }\n\n void buildAll()\n return () => {\n cancelled = true\n }\n }, [signerTransport])\n\n const value = useMemo(() => {\n const value: InPageGatewaysState = {\n clearAll,\n errors,\n gateways,\n provided: true,\n }\n return value\n }, [clearAll, errors, gateways])\n\n return <InPageGatewaysContext value={value}>{children}</InPageGatewaysContext>\n}\n","import { assertEx, isDefined } from '@xylabs/sdk-js'\nimport type {\n GatewayName,\n RemoteConfig, RpcTransport, SimpleXyoGateway,\n XyoSignerRpcSchemas,\n} from '@xyo-network/xl1-sdk'\nimport {\n basicRemoteRunnerLocator,\n basicRemoteViewerLocator,\n DefaultNetworks, NetworkDataLakeUrls, XyoGatewayMoniker,\n} from '@xyo-network/xl1-sdk'\n\n/**\n * @deprecated Use {@link buildGateway} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const buildGateway = async (gatewayName: GatewayName, signerTransport?: RpcTransport<XyoSignerRpcSchemas>) => {\n const network = DefaultNetworks.find(network => network.id === gatewayName)\n const resolvedNetwork = assertEx(network, () => `No network found for id ${gatewayName}`)\n\n const remoteConfig: RemoteConfig = {\n rpc: {\n protocol: 'http',\n url: `${resolvedNetwork.url}/rpc`,\n },\n }\n\n const dataLakeEndpoint = NetworkDataLakeUrls[gatewayName]\n\n const locator = isDefined(signerTransport)\n ? await basicRemoteRunnerLocator(gatewayName, remoteConfig, signerTransport, dataLakeEndpoint)\n : await basicRemoteViewerLocator(gatewayName, remoteConfig, dataLakeEndpoint)\n\n return await locator.getInstance<SimpleXyoGateway>(XyoGatewayMoniker)\n}\n","import { useContextEx } from '@xylabs/react-shared'\n\nimport { InPageGatewaysContext } from './InPageGatewaysContext.ts'\nimport type { InPageGatewaysState } from './InPageGatewaysState.ts'\n\n/**\n * Reads the `InPageGatewaysContext` map of per-network in-page gateways.\n * Intended for internal use by `GatewayProvider` — application code\n * should prefer `useProvidedGateway`, which returns a single resolved\n * gateway regardless of source.\n *\n * @param required - When `true` (default), throws if no\n * `InPageGatewaysProvider` is mounted above.\n *\n * @deprecated Use {@link useProvidedInPageGateways} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const useProvidedInPageGateways = (required = true) => useContextEx<InPageGatewaysState>(InPageGatewaysContext, 'InPageGateways', required)\n","import { ErrorRender } from '@xylabs/react-error'\nimport { isDefinedNotNull, isNull } from '@xylabs/sdk-js'\nimport React, { useMemo } from 'react'\n\nimport { useGatewayFromWallet } from '../../hooks/index.ts'\nimport { GatewayContext } from '../GatewayContext.ts'\nimport type { GatewayProviderProps } from '../GatewayProviderProps.ts'\nimport type { GatewayContextState } from '../GatewayProviderState.ts'\nimport { useProvidedInPageGateways } from '../in-page/index.ts'\n\n/**\n * Publishes the shared `GatewayContext` backed by two sources: the\n * injected XL1 Wallet extension *and* the in-page gateways built by\n * `InPageGatewaysProvider`. Use this provider when the host app can\n * function without a wallet (falling back to the in-page client) but\n * should still prefer the wallet when it is present.\n *\n * Required ancestry: an `InPageGatewaysProvider` must be mounted above\n * this provider — `useProvidedInPageGateways(true)` throws if missing.\n * If you only need a wallet-backed gateway, use `WalletGatewayProvider`\n * instead.\n *\n * Source precedence for `defaultGateway`:\n * - Wallet present and resolved (`XyoGatewayRunner`) → wallet wins; the\n * in-page gateway is still exposed via `gateways.inPageGateway` for\n * the rare consumer that needs to target it specifically.\n * - Wallet definitively absent (`null`) → fall back to the in-page\n * gateway matching `gatewayName`.\n * - Wallet still resolving (`undefined`) → leave `defaultGateway`\n * `undefined` so consumers render a loading state rather than\n * committing to the in-page fallback prematurely.\n *\n * The published `GatewayContextState` shape:\n * - `defaultGateway` — resolved per the precedence above. Three-state:\n * `undefined` = loading, `null` is not produced by this provider\n * (wallet-null collapses to `gatewayFromConfig`), `XyoGateway` = ready.\n * - `gateways.walletGateway` — raw wallet result (tri-state).\n * - `gateways.inPageGateway` — raw in-page result for the requested\n * `gatewayName`, or `undefined` if no `gatewayName` was passed.\n * - `error` — first non-null of wallet error, then in-page build error\n * for this `gatewayName`. Also rendered inline via `ErrorRender` above\n * `children` so mount-time failures surface even when no consumer\n * reads `error`.\n * - `resetGatewaysFromConfig` — forwards `clearAll` from\n * `InPageGatewaysProvider`, letting consumers force a rebuild of the\n * in-page gateways (e.g. after a network or endpoint change).\n * - `provided: true` — lets descendants detect a real provider in the\n * tree.\n *\n * `defaultGateway`, `gateways`, and the context `value` are memoized so\n * consumers only re-render when wallet or in-page sources actually\n * change identity.\n *\n * @deprecated Use {@link GatewayProvider} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const GatewayProvider: React.FC<GatewayProviderProps> = ({ gatewayName, children }) => {\n const {\n gateway: gatewayFromWallet,\n error: gatewayFromWalletError,\n } = useGatewayFromWallet(gatewayName)\n\n const {\n gateways: allGateways,\n errors: allGatewayErrors,\n clearAll,\n } = useProvidedInPageGateways(true)\n\n const gatewayFromConfig = gatewayName ? allGateways[gatewayName] : undefined\n const gatewayFromConfigError = gatewayName ? allGatewayErrors[gatewayName] : undefined\n\n const { defaultGateway, gateways } = useMemo(() => {\n if (isNull(gatewayFromWallet)) {\n return {\n defaultGateway: gatewayFromConfig,\n gateways: {\n inPageGateway: gatewayFromConfig,\n walletGateway: null,\n },\n }\n } else if (isDefinedNotNull(gatewayFromWallet)) {\n return {\n defaultGateway: gatewayFromWallet,\n gateways: {\n inPageGateway: gatewayFromConfig,\n walletGateway: gatewayFromWallet,\n },\n }\n }\n return {\n defaultGateway: undefined,\n gateways: {\n inPageGateway: undefined,\n walletGateway: undefined,\n },\n }\n }, [gatewayFromConfig, gatewayFromWallet])\n\n const value = useMemo(() => {\n const value: GatewayContextState = {\n defaultGateway,\n error: gatewayFromWalletError || gatewayFromConfigError,\n gateways,\n provided: true,\n resetGatewaysFromConfig: clearAll,\n }\n return value\n }, [\n defaultGateway,\n gatewayFromWalletError,\n gatewayFromConfigError,\n gateways,\n clearAll,\n ])\n\n return (\n <GatewayContext value={value}>\n <ErrorRender error={gatewayFromConfigError} />\n {children}\n </GatewayContext>\n )\n}\n","import { ErrorRender } from '@xylabs/react-error'\nimport React, { useMemo } from 'react'\n\nimport { useGatewayFromWallet } from '../../hooks/index.ts'\nimport { GatewayContext } from '../GatewayContext.ts'\nimport type { GatewayProviderProps } from '../GatewayProviderProps.ts'\nimport type { GatewayContextState } from '../GatewayProviderState.ts'\n\n/**\n * Publishes a `GatewayContext` backed exclusively by the injected XL1 Wallet\n * extension (i.e. `globalThis.xyo`). This is the provider to use when the\n * host app is a browser UI that expects the user to bring their own wallet,\n * rather than running an in-page gateway.\n *\n * The requested `gatewayName` is forwarded to `useGatewayFromWallet`, whose\n * returned gateway uses a three-state contract (`undefined` = still\n * resolving, `null` = wallet confirmed absent / timed out,\n * `XyoGatewayRunner` = ready). That tri-state is passed through to\n * consumers unchanged as `defaultGateway` / `gateways.walletGateway`, so\n * downstream hooks can distinguish \"loading\" from \"missing\".\n *\n * The published `GatewayContextState` shape:\n * - `defaultGateway` — the wallet gateway, used when consumers don't\n * specify which gateway they want.\n * - `gateways.walletGateway` — same instance as `defaultGateway`.\n * - `gateways.inPageGateway` — always `null` here; this provider does not\n * stand up an in-page client. Pair with a different provider if you need\n * both.\n * - `error` — surfaced from `useGatewayFromWallet` (detection / timeout /\n * wallet errors). Also rendered inline via `ErrorRender` above `children`\n * so mount-time failures are visible even if no consumer reads `error`.\n * - `provided: true` — lets descendants detect that a real provider (not\n * the default empty context) is in the tree.\n *\n * The `defaultGateway`, `gateways`, and context `value` are memoized so\n * consumers only re-render when the underlying wallet gateway reference or\n * error actually changes.\n *\n * @deprecated Use {@link WalletGatewayProvider} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const WalletGatewayProvider: React.FC<GatewayProviderProps> = ({ gatewayName, children }) => {\n const {\n gateway: gatewayFromWallet,\n error: gatewayFromWalletError,\n } = useGatewayFromWallet(gatewayName)\n\n const { defaultGateway, gateways } = useMemo(() => {\n return {\n defaultGateway: gatewayFromWallet,\n gateways: {\n inPageGateway: null,\n walletGateway: gatewayFromWallet,\n },\n }\n }, [gatewayFromWallet])\n\n const value = useMemo(() => {\n const value: GatewayContextState = {\n defaultGateway,\n error: gatewayFromWalletError,\n gateways,\n provided: true,\n }\n return value\n }, [\n defaultGateway,\n gatewayFromWalletError,\n gateways,\n ])\n\n return (\n <GatewayContext value={value}>\n <ErrorRender error={gatewayFromWalletError} />\n {children}\n </GatewayContext>\n )\n}\n","import { useContextEx } from '@xylabs/react-shared'\n\nimport { GatewayContext } from './GatewayContext.ts'\nimport type { GatewayContextState } from './GatewayProviderState.ts'\n\n/**\n * The sole consumer entry point for gateway state. Reads the nearest\n * `GatewayContext` in the tree, regardless of which provider published\n * it — this is the decoupling that lets a component work unchanged when\n * the surrounding app swaps `WalletGatewayProvider` for\n * `GatewayProvider` (or a test double).\n *\n * @param required - When `true` (default), throws if no gateway provider\n * is mounted above — use this when the component is meaningless\n * without a gateway. When `false`, returns default state (all fields\n * undefined) so the component can render a graceful fallback.\n *\n * @deprecated Use {@link useProvidedGateway} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const useProvidedGateway = (required = true) => useContextEx<GatewayContextState>(GatewayContext, 'Gateway', required)\n"],"mappings":";;;;AAAA,SACEA,OAAOC,SAASC,kBACX;AACP,SAASC,yBAAyB;AAClC,SAASC,6BAA6B;AACtC,OAAOC,WAAW;AAKX,IAAMC,mBAAkD,wBAAC,EAAEC,QAAO,MAAE;AACzE,QAAMC,mBAAmB,GAAGC,kBAAkBC,WAAWH,OAAAA,GAAUI,cAAc,CAAA,CAAA;AAEjF,SACE,sBAAA,cAACC,OAAAA;IACCC,WAAU;IACVC,SAAS;IACTC,IAAI;MAAEC,YAAY;IAAS;KAE3B,sBAAA,cAACC,uBAAAA;IAAsBV;IAAkBW,MAAM;MAC/C,sBAAA,cAACC,SAAAA;IAAQC,OAAOb;KACd,sBAAA,cAACc,YAAAA;IACCC,SAAQ;IACRP,IAAI;MACFQ,OAAO;MACPC,YAAY;IACd;KAEChB,gBAAAA,CAAAA,CAAAA;AAKX,GAvB+D;;;ACT/D,SACEiB,OAAOC,YAAYC,QAAQC,SAAAA,QAC3BC,cAAAA,mBACK;AAEP,SAASC,gBAAgB;AACzB,SAASC,mBAAmB;AAE5B,SAASC,aAAAA,YAAWC,eAAAA,oBAAmB;AAEvC,OAAOC,UAASC,aAAAA,kBAA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,gBAAgBJ;MAChBK,UAAU;QACRE,eAAe;QACfC,eAAeR;MACjB;IACF;EACF,GAAG;IAACA;GAAkB;AAEtB,QAAMS,QAAQH,SAAQ,MAAA;AACpB,UAAMG,SAA6B;MACjCL;MACAH,OAAOC;MACPG;MACAK,UAAU;IACZ;AACA,WAAOD;EACT,GAAG;IACDL;IACAF;IACAG;GACD;AAED,SACE,gBAAAM,OAAA,cAACC,gBAAAA;IAAeH;KACd,gBAAAE,OAAA,cAACE,cAAAA;IAAYZ,OAAOC;MACnBJ,QAAAA;AAGP,GApCqE;;;ACxCrE,SAASgB,gBAAAA,qBAAoB;AAmBtB,IAAMC,qBAAqB,wBAACC,WAAW,SAASC,cAAkCC,gBAAgB,WAAWF,QAAAA,GAAlF;","names":["Stack","Tooltip","Typography","EthAddressWrapper","BlockiesAvatarAddress","React","ConnectedAccount","address","shortenedAddress","EthAddressWrapper","fromString","toShortString","Stack","direction","spacing","sx","alignItems","BlockiesAvatarAddress","size","Tooltip","title","Typography","variant","color","fontFamily","Alert","AlertTitle","Button","Stack","Typography","ButtonEx","ErrorRender","isDefined","isUndefined","React","useEffect","asAddress","assertEx","MainNetwork","useCallback","useState","isDefined","findCaveat","permissions","targetCapability","targetCaveatType","existingPermissions","getPermissions","isDefined","length","foundPermissions","find","p","parentCapability","caveats","caveat","type","value","isUndefined","useEffect","useState","isUndefined","CLIENT_LISTENER_TIMEOUT","hasXyoClient","globalThis","xyo","listenForClientInjection","onClientReady","timeout","onTimeout","resolved","listener","addEventListener","setTimeout","removeEventListener","getXyoClient","isUndefined","client","Promise","resolve","initialState","client","undefined","error","isLoading","timedout","useClientFromWallet","timeout","state","setState","useState","useEffect","cancelled","initialize","prev","getXyoClient","onPluginReady","isUndefined","globalThis","xyo","addEventListener","removeEventListener","useClient","usePermissions","client","isLoading","error","timedout","useClientFromWallet","permissions","usePromise","isArray","isDefined","isDefinedNotNull","isString","validateRestrictedAccounts","restrictedAccounts","isDefined","isArray","every","isString","Error","JSON","stringify","useAccountPermissions","permissions","error","usePermissions","usePromise","isDefinedNotNull","findCaveat","isNull","useGatewayFromWallet","gatewayName","timeout","client","isLoading","error","timedout","useClientFromWallet","resolveGateway","isNull","gateways","gateway","undefined","useGateway","useConnectAccount","gatewayName","MainNetwork","id","timeout","connectError","setConnectError","useState","gateway","error","timedout","useGatewayFromWallet","accountPermissions","accountPermissionsError","useAccountPermissions","address","setAddress","connectSigner","useCallback","undefined","assertedGateway","assertEx","signer","e","asAddress","DefaultConnectComponent","props","React","ButtonEx","variant","size","DefaultNoWalletInstalledComponent","Alert","severity","AlertTitle","Typography","gutterBottom","Button","sx","display","justifySelf","href","target","rel","ConnectAccountsStack","AccountComponent","ConnectedAccount","ConnectComponent","NoWalletInstalledComponent","onAccountConnected","onCancel","timeout","address","connectSigner","error","timedout","useConnectAccount","undefined","useEffect","isDefined","Stack","direction","spacing","alignItems","Array","isArray","isUndefined","onClick","ErrorRender","scope","createContextEx","GatewayContext","createContextEx","InPageGatewaysContext","DefaultNetworks","React","startTransition","useCallback","useEffect","useMemo","useState","assertEx","isDefined","basicRemoteRunnerLocator","basicRemoteViewerLocator","DefaultNetworks","NetworkDataLakeUrls","XyoGatewayMoniker","buildGateway","gatewayName","signerTransport","network","DefaultNetworks","find","id","resolvedNetwork","assertEx","remoteConfig","rpc","protocol","url","dataLakeEndpoint","NetworkDataLakeUrls","locator","isDefined","basicRemoteRunnerLocator","basicRemoteViewerLocator","getInstance","XyoGatewayMoniker","InPageGatewaysProvider","signerTransport","children","gateways","setGateways","useState","errors","setErrors","previousSignerTransport","setPreviousSignerTransport","clearAll","useCallback","useEffect","cancelled","buildAll","results","Promise","allSettled","DefaultNetworks","map","network","gateway","buildGateway","id","nextGateways","nextErrors","index","result","entries","networkId","status","value","reason","Error","String","startTransition","useMemo","provided","React","InPageGatewaysContext","useContextEx","useProvidedInPageGateways","required","useContextEx","InPageGatewaysContext","ErrorRender","isDefinedNotNull","isNull","React","useMemo","GatewayProvider","gatewayName","children","gateway","gatewayFromWallet","error","gatewayFromWalletError","useGatewayFromWallet","gateways","allGateways","errors","allGatewayErrors","clearAll","useProvidedInPageGateways","gatewayFromConfig","undefined","gatewayFromConfigError","defaultGateway","useMemo","isNull","inPageGateway","walletGateway","isDefinedNotNull","value","provided","resetGatewaysFromConfig","React","GatewayContext","ErrorRender","ErrorRender","React","useMemo","WalletGatewayProvider","gatewayName","children","gateway","gatewayFromWallet","error","gatewayFromWalletError","useGatewayFromWallet","defaultGateway","gateways","useMemo","inPageGateway","walletGateway","value","provided","React","GatewayContext","ErrorRender","useContextEx","useProvidedGateway","required","useContextEx","GatewayContext"]}
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/connected/account/Connected.tsx", "../../src/components/connected/ConnectAccountsStack.tsx", "../../src/components/connected/hooks/useConnectAccount.ts", "../../src/hooks/client/helpers/findCaveat.ts", "../../src/hooks/client/useClientFromWallet.ts", "../../src/hooks/helpers/getXyoClient.ts", "../../src/hooks/client/permissions/usePermissions.ts", "../../src/hooks/client/permissions/usePermissionsAccounts.ts", "../../src/hooks/client/useGatewayFromWallet.ts", "../../src/context/GatewayContext.ts", "../../src/context/in-page/InPageGatewaysContext.ts", "../../src/context/in-page/Provider.tsx", "../../src/context/in-page/lib/buildGateway.ts", "../../src/context/in-page/useProvidedInPageGateways.ts", "../../src/context/providers/GatewayProvider.tsx", "../../src/context/providers/WalletGatewayProvider.tsx", "../../src/context/useProvidedGateway.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n Stack, Tooltip, Typography,\n} from '@mui/material'\nimport { EthAddressWrapper } from '@xylabs/sdk-js'\nimport { BlockiesAvatarAddress } from '@xyo-network/xl1-blockies'\nimport React from 'react'\n\n/**\n * @deprecated Use {@link ConnectedAccount} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const ConnectedAccount: React.FC<{ address: string }> = ({ address }) => {\n const shortenedAddress = `${EthAddressWrapper.fromString(address)?.toShortString(4)}`\n\n return (\n <Stack\n direction=\"row\"\n spacing={1}\n sx={{ alignItems: 'center' }}\n >\n <BlockiesAvatarAddress address={address} size={21} />\n <Tooltip title={address}>\n <Typography\n variant=\"caption\"\n sx={{\n color: 'text.secondary',\n fontFamily: 'monospace',\n }}\n >\n {shortenedAddress}\n </Typography>\n </Tooltip>\n </Stack>\n )\n}\n", "import type { StackProps } from '@mui/material'\nimport {\n Alert, AlertTitle, Button, Stack,\n Typography,\n} from '@mui/material'\nimport type { ButtonExProps } from '@xylabs/react-button'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ErrorRender } from '@xylabs/react-error'\nimport type { Address } from '@xylabs/sdk-js'\nimport { isDefined, isUndefined } from '@xylabs/sdk-js'\nimport type { ComponentType, MouseEventHandler } from 'react'\nimport React, { useEffect } from 'react'\n\nimport { ConnectedAccount } from './account/index.ts'\nimport { useConnectAccount } from './hooks/index.ts'\n\nconst DefaultConnectComponent: React.FC<ButtonExProps> = props => (\n <ButtonEx variant=\"contained\" size=\"small\" {...props} />\n)\n\nconst DefaultNoWalletInstalledComponent: React.FC = () => (\n <Alert severity=\"warning\">\n <AlertTitle>XL1 Wallet Not Found</AlertTitle>\n <Typography gutterBottom>\n Please ensure that your XL1 Wallet is installed to connect your account.\n </Typography>\n <Button\n sx={{ display: 'flex', justifySelf: 'end' }}\n size=\"small\"\n variant=\"outlined\"\n href=\"https://chromewebstore.google.com/detail/xl1-wallet/fblbagcjeigmhakkfgjpdlcapcgmcfbm\"\n target=\"_blank\"\n rel=\"noopener\"\n >\n Get XL1 Wallet\n </Button>\n </Alert>\n)\n\n/**\n * @deprecated Use {@link ConnectClientAccountsStackProps} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport interface ConnectClientAccountsStackProps extends StackProps {\n AccountComponent?: ComponentType<{ account?: string }>\n ConnectComponent?: ComponentType<{ onClick?: MouseEventHandler<HTMLElement> }>\n NoWalletInstalledComponent?: ComponentType\n onAccountConnected?: (account: Address) => void\n onCancel?: () => void\n timeout?: number\n}\n\n/**\n * Renders a horizontal stack that surfaces the current state of the user's\n * connection to an XL1 wallet (e.g. the XL1 Chrome extension) and lets them\n * kick off a connection.\n *\n * Connection state is derived from `useConnectAccount`, which wraps\n * `useGatewayFromWallet` (wallet/gateway discovery with a configurable\n * `timeout`) and `useAccountPermissions` (already-authorized addresses).\n * The hook returns: `address` (resolved once the wallet exposes one),\n * `connectSigner` (prompts the wallet for an address), `timedout` (the\n * gateway never appeared within `timeout`), and `error` (the first of\n * gateway, permissions, or signer-connect failures).\n *\n * The component renders exactly one of the following wallet states, plus\n * an always-present error slot:\n *\n * - **Connected** \u2014 `address` is defined: renders `AccountComponent` for\n * that address. Also fires `onAccountConnected(address)` once via effect.\n * - **Disconnected, wallet available** \u2014 no `address` and not `timedout`:\n * renders `ConnectComponent` as a \"Connect\" button that invokes\n * `connectSigner()`. This covers both \"wallet installed but no account\n * authorized yet\" and \"gateway still resolving\".\n * - **Wallet missing / unreachable** \u2014 no `address` and `timedout` is true:\n * renders `NoWalletInstalledComponent` (defaults to an Alert linking to\n * the XL1 Wallet Chrome Web Store listing).\n * - **Error** \u2014 any error from the hook is rendered via `ErrorRender`\n * alongside the state above, and `onCancel()` is fired once via effect\n * so the host UI can close/abort its connect flow.\n *\n * All three slot components (`AccountComponent`, `ConnectComponent`,\n * `NoWalletInstalledComponent`) are injectable so consumers can restyle\n * any state without forking this component.\n *\n * @deprecated Use {@link ConnectAccountsStack} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const ConnectAccountsStack: React.FC<ConnectClientAccountsStackProps> = ({\n AccountComponent = ConnectedAccount,\n ConnectComponent = DefaultConnectComponent,\n NoWalletInstalledComponent = DefaultNoWalletInstalledComponent,\n onAccountConnected,\n onCancel,\n timeout,\n ...props\n}) => {\n const {\n address, connectSigner, error, timedout,\n } = useConnectAccount(undefined, timeout)\n\n useEffect(() => {\n if (isDefined(error) && isDefined(onCancel)) {\n onCancel()\n }\n }, [error, onCancel])\n\n useEffect(() => {\n if (isDefined(address) && isDefined(onAccountConnected)) {\n onAccountConnected(address)\n }\n }, [address, onAccountConnected])\n\n return (\n <Stack\n direction=\"row\"\n spacing={2}\n {...props}\n sx={[{ alignItems: 'start' }, ...(Array.isArray(props.sx) ? props.sx : [props.sx])]}\n >\n {isDefined(address)\n ? <AccountComponent address={address} />\n : null}\n {isUndefined(address) && !timedout\n ? (\n <ConnectComponent onClick={() => void connectSigner()}>Connect</ConnectComponent>\n )\n : null}\n {isUndefined(address) && timedout\n ? (\n <NoWalletInstalledComponent />\n )\n : null}\n <ErrorRender error={error} scope=\"ConnectSigner:error\" />\n </Stack>\n )\n}\n", "import { type Address, asAddress } from '@xylabs/sdk-js'\nimport { assertEx } from '@xylabs/sdk-js'\nimport type { GatewayName } from '@xyo-network/xl1-sdk'\nimport { MainNetwork } from '@xyo-network/xl1-sdk'\nimport { useCallback, useState } from 'react'\n\nimport { useAccountPermissions, useGatewayFromWallet } from '../../../hooks/index.ts'\n\n/**\n * @deprecated Use {@link useConnectAccount} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const useConnectAccount = (gatewayName: GatewayName = MainNetwork.id, timeout?: number) => {\n const [connectError, setConnectError] = useState<Error>()\n\n const {\n gateway, error, timedout,\n } = useGatewayFromWallet(gatewayName, timeout)\n\n const [accountPermissions, accountPermissionsError] = useAccountPermissions()\n\n const [address, setAddress] = useState<Address>()\n\n const connectSigner = useCallback(async () => {\n try {\n setConnectError(undefined)\n const assertedGateway = assertEx(gateway, () => `Gateway ${gatewayName} is not available`)\n const signer = assertedGateway.signer\n const address = await signer.address()\n setAddress(address)\n return address\n } catch (e) {\n setConnectError(e as Error)\n }\n }, [gateway, gatewayName])\n\n return {\n address: asAddress(accountPermissions?.[0] ?? address), connectSigner, error: error ?? accountPermissionsError ?? connectError, gateway, timedout,\n }\n}\n", "import { isDefined } from '@xylabs/sdk-js'\nimport type {\n CaveatTypes, ParentCapability, XyoPermissions,\n} from '@xyo-network/xl1-sdk'\n\n/**\n * @deprecated Use {@link findCaveat} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const findCaveat = async (\n permissions: XyoPermissions,\n targetCapability: ParentCapability,\n targetCaveatType: CaveatTypes,\n) => {\n const existingPermissions = await permissions.getPermissions()\n if (isDefined(existingPermissions) && existingPermissions.length > 0) {\n const foundPermissions = existingPermissions\n .find(p => p.parentCapability === targetCapability)\n if (isDefined(foundPermissions)) {\n return foundPermissions.caveats?.find(caveat => caveat.type === targetCaveatType)?.value ?? []\n }\n }\n return existingPermissions\n}\n", "import { isUndefined } from '@xylabs/sdk-js'\nimport type { XyoClient } from '@xyo-network/xl1-sdk'\nimport { useEffect, useState } from 'react'\n\nimport { getXyoClient } from '../helpers/index.ts'\n\ninterface ClientState {\n client?: XyoClient | null\n error: Error | null\n isLoading: boolean\n timedout: boolean\n}\n\nconst initialState: ClientState = {\n client: undefined,\n error: null,\n isLoading: false,\n timedout: false,\n}\n\n/**\n * @deprecated Use {@link useClientFromWallet} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const useClientFromWallet = (timeout?: number): ClientState => {\n const [state, setState] = useState<ClientState>(initialState)\n\n useEffect(() => {\n let cancelled = false\n\n const initialize = async () => {\n setState((prev) => {\n if (prev.isLoading) return prev\n return {\n ...prev, isLoading: true, error: null,\n }\n })\n\n try {\n const client = await getXyoClient(timeout)\n if (cancelled) return\n if (client === null) {\n setState({\n client: null, timedout: true, isLoading: false, error: null,\n })\n } else {\n setState({\n client, isLoading: false, error: null, timedout: false,\n })\n }\n } catch (error) {\n if (cancelled) return\n setState({\n client: undefined, isLoading: false, error: error as Error, timedout: false,\n })\n }\n }\n\n void initialize()\n\n // Late recovery: if wallet loads after timeout, update state\n const onPluginReady = () => {\n if (cancelled) return\n const client = isUndefined(globalThis.xyo) ? null : globalThis.xyo?.client ?? null\n setState({\n client, isLoading: false, timedout: false, error: null,\n })\n }\n globalThis.addEventListener('xyo:plugin-ready', onPluginReady)\n\n return () => {\n cancelled = true\n globalThis.removeEventListener('xyo:plugin-ready', onPluginReady)\n }\n }, [timeout])\n\n return state\n}\n\n/** @deprecated - use useClientFromWallet instead */\nexport const useClient = useClientFromWallet\n", "import { isUndefined } from '@xylabs/sdk-js'\nimport type { XyoClient } from '@xyo-network/xl1-sdk'\n\nconst CLIENT_LISTENER_TIMEOUT = 2000\n\nconst hasXyoClient = () => {\n return 'client' in globalThis.xyo\n}\n\n/**\n * @deprecated Use {@link listenForClientInjection} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const listenForClientInjection = (onClientReady: () => void, timeout: number, onTimeout: () => void) => {\n let resolved = false\n const listener: EventListener = () => {\n onClientReady()\n resolved = true\n }\n globalThis.addEventListener('xyo:plugin-ready', listener)\n setTimeout(() => {\n if (!resolved) {\n globalThis.removeEventListener('xyo:plugin-ready', listener)\n onTimeout()\n }\n }, timeout)\n}\n\ntype ReturnType = XyoClient | undefined | null\n\n/**\n * @deprecated Use {@link getXyoClient} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport async function getXyoClient(timeout = CLIENT_LISTENER_TIMEOUT): Promise<ReturnType> {\n // if no xyo object, we can bail early\n if (isUndefined(globalThis.xyo)) {\n return null\n }\n return hasXyoClient()\n ? globalThis.xyo.client\n // listen for the XyoWallet to be injected\n : await new Promise<ReturnType>((resolve) => {\n listenForClientInjection(\n () => {\n resolve(globalThis.xyo.client)\n },\n timeout,\n () => {\n resolve(null)\n },\n )\n })\n}\n", "import { useClientFromWallet } from '../useClientFromWallet.ts'\n\n/**\n * @deprecated Use {@link usePermissions} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const usePermissions = () => {\n const {\n client, isLoading, error, timedout,\n } = useClientFromWallet()\n const permissions = client?.permissions\n return {\n permissions,\n isLoading,\n error,\n timedout,\n }\n}\n", "import { usePromise } from '@xylabs/react-promise'\nimport type { JsonValue } from '@xylabs/sdk-js'\nimport {\n isArray, isDefined, isDefinedNotNull, isString,\n} from '@xylabs/sdk-js'\n\nimport { findCaveat } from '../helpers/index.ts'\nimport { usePermissions } from './usePermissions.ts'\n\nconst validateRestrictedAccounts = (restrictedAccounts: JsonValue): readonly string [] => {\n if (isDefined(restrictedAccounts)) {\n if (isArray(restrictedAccounts) && restrictedAccounts.every(isString)) {\n return restrictedAccounts\n }\n throw new Error(\n `Unrecognized format for restrictReturnedAccounts caveat found on permissions. \\n\n Should be an array of strings: ${JSON.stringify(restrictedAccounts)}`,\n )\n }\n return []\n}\n\n/**\n * @deprecated Use {@link useAccountPermissions} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const useAccountPermissions = () => {\n const { permissions, error } = usePermissions()\n\n return usePromise(async () => {\n if (isDefinedNotNull(error)) throw error\n if (isDefined(permissions)) {\n const restrictedAccounts = await findCaveat(\n permissions,\n // TODO - extract to constant in protocol package\n 'xyoWallet_getAccounts',\n 'restrictReturnedAccounts',\n )\n return validateRestrictedAccounts(restrictedAccounts)\n }\n }, [permissions])\n}\n", "import { isNull } from '@xylabs/sdk-js'\nimport type { GatewayName } from '@xyo-network/xl1-sdk'\n\nimport type { GatewayFromWallet } from '../../types/index.ts'\nimport { useClientFromWallet } from './useClientFromWallet.ts'\n\n/**\n * Resolves a gateway from the injected XL1 Wallet extension.\n *\n * The returned `gateway` uses a three-state contract:\n * - `undefined` \u2014 wallet detection is still in progress (isLoading=true),\n * or no gatewayName was provided. Consumers should treat this as \"not yet known\"\n * and avoid committing to either a present or absent UI state.\n * - `null` \u2014 wallet is definitively absent. Either globalThis.xyo was never set,\n * or detection timed out. Safe to show fallback UI (e.g. \"Get XL1 Wallet\").\n * A late-recovery listener may still transition this to a real gateway if\n * the extension loads after the timeout.\n * - `XyoGatewayRunner` \u2014 wallet is present and exposes this gateway for the\n * requested network. Ready to use for transactions and queries.\n *\n * @deprecated Use {@link useGatewayFromWallet} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const useGatewayFromWallet = (gatewayName?: GatewayName, timeout?: number): GatewayFromWallet => {\n const {\n client, isLoading, error, timedout,\n } = useClientFromWallet(timeout)\n\n const resolveGateway = () => {\n // null client = wallet confirmed absent (no globalThis.xyo or timed out)\n if (isNull(client)) return null\n // client is undefined (still loading) or defined (wallet present) \u2014\n // optional chain returns undefined while loading, or the gateway if available\n return client?.gateways?.[gatewayName!]\n }\n\n return {\n // no gatewayName requested = undefined (opt-out, not \"absent\")\n gateway: gatewayName ? resolveGateway() : undefined,\n isLoading,\n error,\n timedout,\n }\n}\n\n/** @deprecated - useGatewayFromWallet */\nexport const useGateway = useGatewayFromWallet\n", "import { createContextEx } from '@xylabs/react-shared'\n\nimport type { GatewayContextState } from './GatewayProviderState.ts'\n\n/**\n * Shared React context that decouples gateway *sources* from gateway\n * *consumers*. Any provider that can resolve an `XyoGateway` publishes to\n * this context; any hook or component that needs a gateway reads from it\n * via `useProvidedGateway`. Consumers never import a specific provider \u2014\n * they just require that *some* provider is mounted above them in the\n * tree.\n *\n * Current publishers:\n * - `WalletGatewayProvider` (this package) \u2014 sources gateways from the\n * injected XL1 wallet extension.\n * - `GatewayProvider` in `@xyo-network/react-chain-provider` \u2014 sources\n * gateways built in-page against RPC endpoints, falling back to the\n * wallet when available.\n *\n * To add a new source (e.g. a mock provider for tests, an iframe-bridged\n * provider, a server-rendered provider), publish a `GatewayContextState`\n * to this same context \u2014 do not create a parallel context, or consumers\n * will silently stop receiving updates.\n *\n * @deprecated Use {@link GatewayContext} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const GatewayContext = createContextEx<GatewayContextState>()\n", "import { createContextEx } from '@xylabs/react-shared'\n\nimport type { InPageGatewaysState } from './InPageGatewaysState.ts'\n\n/**\n * Narrow, provider-internal context that `InPageGatewaysProvider` writes\n * to and `GatewayProvider` reads from. Do not consume this in application\n * code \u2014 use `useProvidedGateway` (which reads the shared\n * `GatewayContext`) instead. This context only exists to decouple the\n * single in-page *builder* from the many single-gateway *adapters* that\n * sit between it and the shared gateway surface.\n *\n * @deprecated Use {@link InPageGatewaysContext} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const InPageGatewaysContext = createContextEx<InPageGatewaysState>()\n", "import type {\n GatewayName, RpcTransport, XyoSignerRpcSchemas,\n} from '@xyo-network/xl1-sdk'\nimport { DefaultNetworks } from '@xyo-network/xl1-sdk'\nimport type { PropsWithChildren } from 'react'\nimport React, {\n startTransition,\n useCallback, useEffect, useMemo, useState,\n} from 'react'\n\nimport type { ContextGatewayType } from '../../types/index.ts'\nimport { InPageGatewaysContext } from './InPageGatewaysContext.ts'\nimport type { InPageGatewaysState } from './InPageGatewaysState.ts'\nimport { buildGateway } from './lib/index.ts'\n\n/**\n * @deprecated Use {@link InPageGatewaysProviderProps} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport interface InPageGatewaysProviderProps extends PropsWithChildren {\n signerTransport?: RpcTransport<XyoSignerRpcSchemas>\n}\n\n/**\n * Publishes a keyed map of in-page gateways \u2014 one per network in\n * `DefaultNetworks` \u2014 under the narrow `InPageGatewaysContext`.\n *\n * This provider is deliberately *not* a direct publisher of the shared\n * `GatewayContext` that `useProvidedGateway` reads. Its consumer is the\n * wrapping `GatewayProvider` in this same package, which picks the\n * `gatewayName` the consumer asked for out of this map, adapts it into\n * the single-gateway `GatewayContextState` shape, and then publishes *that*\n * to the shared context. Splitting the work this way lets one\n * `InPageGatewaysProvider` near the root build every network's gateway\n * once, while many `GatewayProvider` instances deeper in the tree each\n * expose whichever gateway their subtree cares about.\n *\n * Unlike `WalletGatewayProvider`, gateways here are constructed directly\n * in the page (via `buildGateway`) against each network's RPC endpoint\n * \u2014 no browser wallet extension is required. `signerTransport` switches\n * between viewer (read-only) and runner (can sign/send) locators; supply\n * it only when the app needs to sign.\n *\n * Behavior:\n * - On mount, and whenever `signerTransport` changes, `buildGateway` is\n * called in parallel for every network in `DefaultNetworks` via\n * `Promise.allSettled`. Networks that resolve populate `gateways[id]`;\n * networks that reject populate `errors[id]`. One failed network does\n * not block the others.\n * - If `signerTransport` is provided, gateways are built with a remote\n * *runner* locator, otherwise with a remote *viewer* locator.\n * - When `signerTransport` changes identity mid-life, the provider clears\n * all cached gateways and errors synchronously during render (via\n * `previousSignerTransport` state) so consumers never see gateways\n * bound to the previous transport, then rebuilds in the effect.\n * - State updates from the rebuild are wrapped in `startTransition` so a\n * slow network doesn't stall higher-priority UI updates.\n * - A `cancelled` flag in the effect's cleanup discards results from a\n * prior `signerTransport` once a new one is in flight.\n *\n * Published `InPageGatewaysState` (narrower than `GatewayContextState` \u2014\n * this is an internal handoff shape, not the cross-publisher surface):\n * - `gateways` \u2014 `Partial<Record<GatewayName, ContextGatewayType>>`. Keys\n * are only present for networks that built successfully.\n * - `errors` \u2014 `Partial<Record<GatewayName, Error>>`. Per-network build\n * failures, keyed by `GatewayName`.\n * - `clearAll()` \u2014 manually empties both maps. Also invoked internally on\n * transport changes. Forwarded by `GatewayProvider` to consumers as\n * `resetGatewaysFromConfig`.\n * - `provided: true` \u2014 lets descendants detect a real provider.\n *\n * Note: the commented-out `SimpleXyoClient` at the top is intentionally\n * disabled pending a type unification between `XyoGateway` and\n * `XyoGatewayRunner`.\n *\n * @deprecated Use {@link InPageGatewaysProvider} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const InPageGatewaysProvider: React.FC<InPageGatewaysProviderProps> = ({ signerTransport, children }) => {\n const [gateways, setGateways] = useState<Partial<Record<GatewayName, ContextGatewayType>>>({})\n const [errors, setErrors] = useState<Partial<Record<GatewayName, Error>>>({})\n const [previousSignerTransport, setPreviousSignerTransport] = useState<RpcTransport<XyoSignerRpcSchemas> | undefined>(signerTransport)\n\n // This can come back once we homogenize the type for XyoGateway.\n // Right now, SimpleXyoClient takes XyoGatewayRunners but ideally it would take XyoGateway.\n // const clientInPage = useMemo(() => new SimpleXyoClient(gateways, {}), [gateways])\n\n const clearAll = useCallback(() => {\n setGateways({})\n setErrors({})\n }, [])\n\n if (previousSignerTransport !== signerTransport) {\n clearAll()\n setPreviousSignerTransport(signerTransport)\n }\n\n useEffect(() => {\n let cancelled = false\n\n const buildAll = async () => {\n const results = await Promise.allSettled(\n DefaultNetworks.map(async (network) => {\n const gateway = await buildGateway(network.id as GatewayName, signerTransport)\n return { id: network.id as GatewayName, gateway }\n }),\n )\n\n if (cancelled) return\n\n const nextGateways: Partial<Record<GatewayName, ContextGatewayType>> = {}\n const nextErrors: Partial<Record<GatewayName, Error>> = {}\n\n for (const [index, result] of results.entries()) {\n const networkId = DefaultNetworks[index].id as GatewayName\n if (result.status === 'fulfilled') {\n nextGateways[networkId] = result.value.gateway\n } else {\n nextErrors[networkId] = result.reason instanceof Error ? result.reason : new Error(String(result.reason))\n }\n }\n\n startTransition(() => {\n setGateways(nextGateways)\n setErrors(nextErrors)\n })\n }\n\n void buildAll()\n return () => {\n cancelled = true\n }\n }, [signerTransport])\n\n const value = useMemo(() => {\n const value: InPageGatewaysState = {\n clearAll,\n errors,\n gateways,\n provided: true,\n }\n return value\n }, [clearAll, errors, gateways])\n\n return <InPageGatewaysContext value={value}>{children}</InPageGatewaysContext>\n}\n", "import { assertEx, isDefined } from '@xylabs/sdk-js'\nimport type {\n GatewayName,\n RemoteConfig, RpcTransport, SimpleXyoGateway,\n XyoSignerRpcSchemas,\n} from '@xyo-network/xl1-sdk'\nimport {\n basicRemoteRunnerLocator,\n basicRemoteViewerLocator,\n DefaultNetworks, NetworkDataLakeUrls, XyoGatewayMoniker,\n} from '@xyo-network/xl1-sdk'\n\n/**\n * @deprecated Use {@link buildGateway} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const buildGateway = async (gatewayName: GatewayName, signerTransport?: RpcTransport<XyoSignerRpcSchemas>) => {\n const network = DefaultNetworks.find(network => network.id === gatewayName)\n const resolvedNetwork = assertEx(network, () => `No network found for id ${gatewayName}`)\n\n const remoteConfig: RemoteConfig = {\n rpc: {\n protocol: 'http',\n url: `${resolvedNetwork.url}/rpc`,\n },\n }\n\n const dataLakeEndpoint = NetworkDataLakeUrls[gatewayName]\n\n const locator = isDefined(signerTransport)\n ? await basicRemoteRunnerLocator(gatewayName, remoteConfig, signerTransport, dataLakeEndpoint)\n : await basicRemoteViewerLocator(gatewayName, remoteConfig, dataLakeEndpoint)\n\n return await locator.getInstance<SimpleXyoGateway>(XyoGatewayMoniker)\n}\n", "import { useContextEx } from '@xylabs/react-shared'\n\nimport { InPageGatewaysContext } from './InPageGatewaysContext.ts'\nimport type { InPageGatewaysState } from './InPageGatewaysState.ts'\n\n/**\n * Reads the `InPageGatewaysContext` map of per-network in-page gateways.\n * Intended for internal use by `GatewayProvider` \u2014 application code\n * should prefer `useProvidedGateway`, which returns a single resolved\n * gateway regardless of source.\n *\n * @param required - When `true` (default), throws if no\n * `InPageGatewaysProvider` is mounted above.\n *\n * @deprecated Use {@link useProvidedInPageGateways} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const useProvidedInPageGateways = (required = true) => useContextEx<InPageGatewaysState>(InPageGatewaysContext, 'InPageGateways', required)\n", "import { ErrorRender } from '@xylabs/react-error'\nimport { isDefinedNotNull, isNull } from '@xylabs/sdk-js'\nimport React, { useMemo } from 'react'\n\nimport { useGatewayFromWallet } from '../../hooks/index.ts'\nimport { GatewayContext } from '../GatewayContext.ts'\nimport type { GatewayProviderProps } from '../GatewayProviderProps.ts'\nimport type { GatewayContextState } from '../GatewayProviderState.ts'\nimport { useProvidedInPageGateways } from '../in-page/index.ts'\n\n/**\n * Publishes the shared `GatewayContext` backed by two sources: the\n * injected XL1 Wallet extension *and* the in-page gateways built by\n * `InPageGatewaysProvider`. Use this provider when the host app can\n * function without a wallet (falling back to the in-page client) but\n * should still prefer the wallet when it is present.\n *\n * Required ancestry: an `InPageGatewaysProvider` must be mounted above\n * this provider \u2014 `useProvidedInPageGateways(true)` throws if missing.\n * If you only need a wallet-backed gateway, use `WalletGatewayProvider`\n * instead.\n *\n * Source precedence for `defaultGateway`:\n * - Wallet present and resolved (`XyoGatewayRunner`) \u2192 wallet wins; the\n * in-page gateway is still exposed via `gateways.inPageGateway` for\n * the rare consumer that needs to target it specifically.\n * - Wallet definitively absent (`null`) \u2192 fall back to the in-page\n * gateway matching `gatewayName`.\n * - Wallet still resolving (`undefined`) \u2192 leave `defaultGateway`\n * `undefined` so consumers render a loading state rather than\n * committing to the in-page fallback prematurely.\n *\n * The published `GatewayContextState` shape:\n * - `defaultGateway` \u2014 resolved per the precedence above. Three-state:\n * `undefined` = loading, `null` is not produced by this provider\n * (wallet-null collapses to `gatewayFromConfig`), `XyoGateway` = ready.\n * - `gateways.walletGateway` \u2014 raw wallet result (tri-state).\n * - `gateways.inPageGateway` \u2014 raw in-page result for the requested\n * `gatewayName`, or `undefined` if no `gatewayName` was passed.\n * - `error` \u2014 first non-null of wallet error, then in-page build error\n * for this `gatewayName`. Also rendered inline via `ErrorRender` above\n * `children` so mount-time failures surface even when no consumer\n * reads `error`.\n * - `resetGatewaysFromConfig` \u2014 forwards `clearAll` from\n * `InPageGatewaysProvider`, letting consumers force a rebuild of the\n * in-page gateways (e.g. after a network or endpoint change).\n * - `provided: true` \u2014 lets descendants detect a real provider in the\n * tree.\n *\n * `defaultGateway`, `gateways`, and the context `value` are memoized so\n * consumers only re-render when wallet or in-page sources actually\n * change identity.\n *\n * @deprecated Use {@link GatewayProvider} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const GatewayProvider: React.FC<GatewayProviderProps> = ({ gatewayName, children }) => {\n const {\n gateway: gatewayFromWallet,\n error: gatewayFromWalletError,\n } = useGatewayFromWallet(gatewayName)\n\n const {\n gateways: allGateways,\n errors: allGatewayErrors,\n clearAll,\n } = useProvidedInPageGateways(true)\n\n const gatewayFromConfig = gatewayName ? allGateways[gatewayName] : undefined\n const gatewayFromConfigError = gatewayName ? allGatewayErrors[gatewayName] : undefined\n\n const { defaultGateway, gateways } = useMemo(() => {\n if (isNull(gatewayFromWallet)) {\n return {\n defaultGateway: gatewayFromConfig,\n gateways: {\n inPageGateway: gatewayFromConfig,\n walletGateway: null,\n },\n }\n } else if (isDefinedNotNull(gatewayFromWallet)) {\n return {\n defaultGateway: gatewayFromWallet,\n gateways: {\n inPageGateway: gatewayFromConfig,\n walletGateway: gatewayFromWallet,\n },\n }\n }\n return {\n defaultGateway: undefined,\n gateways: {\n inPageGateway: undefined,\n walletGateway: undefined,\n },\n }\n }, [gatewayFromConfig, gatewayFromWallet])\n\n const value = useMemo(() => {\n const value: GatewayContextState = {\n defaultGateway,\n error: gatewayFromWalletError || gatewayFromConfigError,\n gateways,\n provided: true,\n resetGatewaysFromConfig: clearAll,\n }\n return value\n }, [\n defaultGateway,\n gatewayFromWalletError,\n gatewayFromConfigError,\n gateways,\n clearAll,\n ])\n\n return (\n <GatewayContext value={value}>\n <ErrorRender error={gatewayFromConfigError} />\n {children}\n </GatewayContext>\n )\n}\n", "import { ErrorRender } from '@xylabs/react-error'\nimport React, { useMemo } from 'react'\n\nimport { useGatewayFromWallet } from '../../hooks/index.ts'\nimport { GatewayContext } from '../GatewayContext.ts'\nimport type { GatewayProviderProps } from '../GatewayProviderProps.ts'\nimport type { GatewayContextState } from '../GatewayProviderState.ts'\n\n/**\n * Publishes a `GatewayContext` backed exclusively by the injected XL1 Wallet\n * extension (i.e. `globalThis.xyo`). This is the provider to use when the\n * host app is a browser UI that expects the user to bring their own wallet,\n * rather than running an in-page gateway.\n *\n * The requested `gatewayName` is forwarded to `useGatewayFromWallet`, whose\n * returned gateway uses a three-state contract (`undefined` = still\n * resolving, `null` = wallet confirmed absent / timed out,\n * `XyoGatewayRunner` = ready). That tri-state is passed through to\n * consumers unchanged as `defaultGateway` / `gateways.walletGateway`, so\n * downstream hooks can distinguish \"loading\" from \"missing\".\n *\n * The published `GatewayContextState` shape:\n * - `defaultGateway` \u2014 the wallet gateway, used when consumers don't\n * specify which gateway they want.\n * - `gateways.walletGateway` \u2014 same instance as `defaultGateway`.\n * - `gateways.inPageGateway` \u2014 always `null` here; this provider does not\n * stand up an in-page client. Pair with a different provider if you need\n * both.\n * - `error` \u2014 surfaced from `useGatewayFromWallet` (detection / timeout /\n * wallet errors). Also rendered inline via `ErrorRender` above `children`\n * so mount-time failures are visible even if no consumer reads `error`.\n * - `provided: true` \u2014 lets descendants detect that a real provider (not\n * the default empty context) is in the tree.\n *\n * The `defaultGateway`, `gateways`, and context `value` are memoized so\n * consumers only re-render when the underlying wallet gateway reference or\n * error actually changes.\n *\n * @deprecated Use {@link WalletGatewayProvider} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const WalletGatewayProvider: React.FC<GatewayProviderProps> = ({ gatewayName, children }) => {\n const {\n gateway: gatewayFromWallet,\n error: gatewayFromWalletError,\n } = useGatewayFromWallet(gatewayName)\n\n const { defaultGateway, gateways } = useMemo(() => {\n return {\n defaultGateway: gatewayFromWallet,\n gateways: {\n inPageGateway: null,\n walletGateway: gatewayFromWallet,\n },\n }\n }, [gatewayFromWallet])\n\n const value = useMemo(() => {\n const value: GatewayContextState = {\n defaultGateway,\n error: gatewayFromWalletError,\n gateways,\n provided: true,\n }\n return value\n }, [\n defaultGateway,\n gatewayFromWalletError,\n gateways,\n ])\n\n return (\n <GatewayContext value={value}>\n <ErrorRender error={gatewayFromWalletError} />\n {children}\n </GatewayContext>\n )\n}\n", "import { useContextEx } from '@xylabs/react-shared'\n\nimport { GatewayContext } from './GatewayContext.ts'\nimport type { GatewayContextState } from './GatewayProviderState.ts'\n\n/**\n * The sole consumer entry point for gateway state. Reads the nearest\n * `GatewayContext` in the tree, regardless of which provider published\n * it \u2014 this is the decoupling that lets a component work unchanged when\n * the surrounding app swaps `WalletGatewayProvider` for\n * `GatewayProvider` (or a test double).\n *\n * @param required - When `true` (default), throws if no gateway provider\n * is mounted above \u2014 use this when the component is meaningless\n * without a gateway. When `false`, returns default state (all fields\n * undefined) so the component can render a graceful fallback.\n *\n * @deprecated Use {@link useProvidedGateway} from `@xyo-network/xl1-react-client-sdk/client` instead.\n */\nexport const useProvidedGateway = (required = true) => useContextEx<GatewayContextState>(GatewayContext, 'Gateway', required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A,MACL,gBAAgB;AAAA,MAChB,UAAU;AAAA,QACR,eAAe;AAAA,QACf,eAAe;AAAA,MACjB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,iBAAiB,CAAC;AAEtB,QAAM,QAAQA,SAAQ,MAAM;AAC1B,UAAMC,SAA6B;AAAA,MACjC;AAAA,MACA,OAAO;AAAA,MACP;AAAA,MACA,UAAU;AAAA,IACZ;AACA,WAAOA;AAAA,EACT,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,SACE,gBAAAF,MAAC,kBAAe,OACd;AAAA,oBAAAD,KAACI,cAAA,EAAY,OAAO,wBAAwB;AAAA,IAC3C;AAAA,KACH;AAEJ;;;AC5EA,SAAS,gBAAAC,qBAAoB;AAmBtB,IAAM,qBAAqB,CAAC,WAAW,SAASC,cAAkC,gBAAgB,WAAW,QAAQ;",
|
|
6
|
+
"names": ["Stack", "Typography", "isDefined", "isUndefined", "useEffect", "useState", "isUndefined", "isUndefined", "isDefined", "isDefined", "useState", "address", "jsx", "jsxs", "Typography", "useEffect", "isDefined", "Stack", "isUndefined", "createContextEx", "DefaultNetworks", "useCallback", "useEffect", "useState", "assertEx", "isDefined", "network", "jsx", "useState", "useCallback", "useEffect", "DefaultNetworks", "value", "ErrorRender", "isDefinedNotNull", "isNull", "useMemo", "jsx", "jsxs", "useMemo", "isNull", "isDefinedNotNull", "value", "ErrorRender", "ErrorRender", "useMemo", "jsx", "jsxs", "useMemo", "value", "ErrorRender", "useContextEx", "useContextEx"]
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/react-chain-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "XYO Layer One React SDK - Client/Wallet Hooks",
|
|
5
5
|
"homepage": "https://xylabs.com",
|
|
6
6
|
"bugs": {
|
|
@@ -41,51 +41,52 @@
|
|
|
41
41
|
"@bitauth/libauth": "~3.0.0",
|
|
42
42
|
"@metamask/json-rpc-engine": "^10.5.0",
|
|
43
43
|
"@metamask/providers": "^22.1.1",
|
|
44
|
-
"@metamask/utils": "
|
|
45
|
-
"@mui/icons-material": "~9.0",
|
|
46
|
-
"@mui/material": "~9.0",
|
|
44
|
+
"@metamask/utils": "^11.11.0",
|
|
45
|
+
"@mui/icons-material": "~9.0.1",
|
|
46
|
+
"@mui/material": "~9.0.1",
|
|
47
47
|
"@opentelemetry/api": "^1.9.1",
|
|
48
48
|
"@opentelemetry/sdk-trace-base": "^2.7.1",
|
|
49
49
|
"@react-spring/web": "~10.0.3",
|
|
50
50
|
"@scure/base": "~2.2.0",
|
|
51
51
|
"@scure/bip39": "~2.2.0",
|
|
52
|
-
"@storybook/react-vite": "^10.
|
|
53
|
-
"@types/react": "^19.2.
|
|
54
|
-
"@xylabs/fetch": "~
|
|
55
|
-
"@xylabs/geo": "
|
|
56
|
-
"@xylabs/pixel": "~
|
|
57
|
-
"@xylabs/react-button": "~
|
|
58
|
-
"@xylabs/react-error": "~
|
|
59
|
-
"@xylabs/react-promise": "~
|
|
60
|
-
"@xylabs/react-shared": "~
|
|
61
|
-
"@xylabs/react-theme": "~
|
|
62
|
-
"@xylabs/sdk-js": "^
|
|
63
|
-
"@xylabs/threads": "~
|
|
64
|
-
"@xylabs/toolchain": "~
|
|
65
|
-
"@xylabs/tsconfig": "~
|
|
66
|
-
"@xylabs/tsconfig-dom": "~
|
|
67
|
-
"@xylabs/tsconfig-react": "~
|
|
68
|
-
"@xyo-network/account": "~
|
|
69
|
-
"@xyo-network/account-model": "~
|
|
70
|
-
"@xyo-network/api": "~
|
|
71
|
-
"@xyo-network/api-models": "~
|
|
72
|
-
"@xyo-network/boundwitness-builder": "~
|
|
73
|
-
"@xyo-network/boundwitness-model": "~
|
|
74
|
-
"@xyo-network/boundwitness-wrapper": "~
|
|
75
|
-
"@xyo-network/config-payload-plugin": "~
|
|
76
|
-
"@xyo-network/huri": "~
|
|
77
|
-
"@xyo-network/manifest-model": "~
|
|
78
|
-
"@xyo-network/payload-builder": "~
|
|
79
|
-
"@xyo-network/payload-model": "~
|
|
80
|
-
"@xyo-network/payload-plugin": "~
|
|
81
|
-
"@xyo-network/payload-wrapper": "~
|
|
82
|
-
"@xyo-network/query-payload-plugin": "~
|
|
83
|
-
"@xyo-network/sdk-js": "
|
|
84
|
-
"@xyo-network/sdk-protocol-js": "~
|
|
85
|
-
"@xyo-network/wallet": "~
|
|
86
|
-
"@xyo-network/wallet-model": "^
|
|
87
|
-
"@xyo-network/xl1-blockies": "
|
|
88
|
-
"@xyo-network/xl1-sdk": "^
|
|
52
|
+
"@storybook/react-vite": "^10.4.0",
|
|
53
|
+
"@types/react": "^19.2.15",
|
|
54
|
+
"@xylabs/fetch": "~6.0.2",
|
|
55
|
+
"@xylabs/geo": "~6.0.2",
|
|
56
|
+
"@xylabs/pixel": "~6.0.2",
|
|
57
|
+
"@xylabs/react-button": "~9.0",
|
|
58
|
+
"@xylabs/react-error": "~9.0",
|
|
59
|
+
"@xylabs/react-promise": "~9.0",
|
|
60
|
+
"@xylabs/react-shared": "~9.0",
|
|
61
|
+
"@xylabs/react-theme": "~9.0.0",
|
|
62
|
+
"@xylabs/sdk-js": "^6.0.2",
|
|
63
|
+
"@xylabs/threads": "~6.0.2",
|
|
64
|
+
"@xylabs/toolchain": "~8.1.1",
|
|
65
|
+
"@xylabs/tsconfig": "~8.1.1",
|
|
66
|
+
"@xylabs/tsconfig-dom": "~8.1.1",
|
|
67
|
+
"@xylabs/tsconfig-react": "~8.1.1",
|
|
68
|
+
"@xyo-network/account": "~6.0.0",
|
|
69
|
+
"@xyo-network/account-model": "~6.0.0",
|
|
70
|
+
"@xyo-network/api": "~6.0",
|
|
71
|
+
"@xyo-network/api-models": "~6.0",
|
|
72
|
+
"@xyo-network/boundwitness-builder": "~6.0.0",
|
|
73
|
+
"@xyo-network/boundwitness-model": "~6.0.0",
|
|
74
|
+
"@xyo-network/boundwitness-wrapper": "~6.0.0",
|
|
75
|
+
"@xyo-network/config-payload-plugin": "~6.0.0",
|
|
76
|
+
"@xyo-network/huri": "~6.0",
|
|
77
|
+
"@xyo-network/manifest-model": "~6.0.0",
|
|
78
|
+
"@xyo-network/payload-builder": "~6.0.0",
|
|
79
|
+
"@xyo-network/payload-model": "~6.0.0",
|
|
80
|
+
"@xyo-network/payload-plugin": "~6.0",
|
|
81
|
+
"@xyo-network/payload-wrapper": "~6.0.0",
|
|
82
|
+
"@xyo-network/query-payload-plugin": "~6.0.0",
|
|
83
|
+
"@xyo-network/sdk-js": "~6.0",
|
|
84
|
+
"@xyo-network/sdk-protocol-js": "~6.0",
|
|
85
|
+
"@xyo-network/wallet": "~6.0",
|
|
86
|
+
"@xyo-network/wallet-model": "^6.0.0",
|
|
87
|
+
"@xyo-network/xl1-blockies": "~2.0",
|
|
88
|
+
"@xyo-network/xl1-react-client-sdk": "^2.0.0",
|
|
89
|
+
"@xyo-network/xl1-sdk": "~2.0",
|
|
89
90
|
"ajv": "^8.20.0",
|
|
90
91
|
"async-mutex": "^0.5.0",
|
|
91
92
|
"bn.js": "^5.2.3",
|
|
@@ -94,40 +95,39 @@
|
|
|
94
95
|
"chalk": "^5.6.2",
|
|
95
96
|
"cosmiconfig": "^9.0.1",
|
|
96
97
|
"debug": "~4.4.3",
|
|
97
|
-
"eslint": "^10.
|
|
98
|
+
"eslint": "^10.4.0",
|
|
98
99
|
"ethers": "^6.16.0",
|
|
99
100
|
"fast-deep-equal": "~3.1.3",
|
|
100
101
|
"hash-wasm": "~4.12.0",
|
|
101
102
|
"idb": "^8.0.3",
|
|
102
|
-
"js-cookie": "~3.0.
|
|
103
|
-
"lru-cache": "^11.
|
|
104
|
-
"mapbox-gl": "^3.
|
|
105
|
-
"mixpanel-browser": "~2.
|
|
103
|
+
"js-cookie": "~3.0.7",
|
|
104
|
+
"lru-cache": "^11.5.0",
|
|
105
|
+
"mapbox-gl": "^3.24.0",
|
|
106
|
+
"mixpanel-browser": "~2.79",
|
|
106
107
|
"observable-fns": "~0.6.1",
|
|
107
108
|
"pako": "^2.1.0",
|
|
108
109
|
"query-string": "~9.3.1",
|
|
109
110
|
"react": "^19.2.6",
|
|
110
111
|
"react-dom": "^19.2.6",
|
|
111
112
|
"react-is": "^19.2.6",
|
|
112
|
-
"react-router-dom": "^7.15.
|
|
113
|
+
"react-router-dom": "^7.15.1",
|
|
113
114
|
"recharts": "~3.8.1",
|
|
114
115
|
"spark-md5": "~3.0.2",
|
|
115
116
|
"store2": "~2.14.4",
|
|
116
|
-
"storybook": "^10.
|
|
117
|
-
"typescript": "~
|
|
117
|
+
"storybook": "^10.4.0",
|
|
118
|
+
"typescript": "~6.0.3",
|
|
118
119
|
"uuid": "~14.0.0",
|
|
119
|
-
"vite": "^8.0.
|
|
120
|
+
"vite": "^8.0.13",
|
|
120
121
|
"wasm-feature-detect": "~1.8.0",
|
|
121
122
|
"webextension-polyfill": "^0.12.0",
|
|
122
123
|
"zod": "~4.4.3",
|
|
123
|
-
"@xyo-network/react-chain-
|
|
124
|
-
"@xyo-network/react-chain-model": "~1.23.0"
|
|
124
|
+
"@xyo-network/react-chain-model": "~2.0.0"
|
|
125
125
|
},
|
|
126
126
|
"peerDependencies": {
|
|
127
127
|
"@bitauth/libauth": "~3.0",
|
|
128
128
|
"@metamask/json-rpc-engine": "^10.3",
|
|
129
129
|
"@metamask/providers": "^22.1",
|
|
130
|
-
"@metamask/utils": "
|
|
130
|
+
"@metamask/utils": "^11.11",
|
|
131
131
|
"@mui/icons-material": "~9.0",
|
|
132
132
|
"@mui/material": "~9.0",
|
|
133
133
|
"@opentelemetry/api": "^1.9",
|
|
@@ -135,38 +135,37 @@
|
|
|
135
135
|
"@react-spring/web": "~10.0",
|
|
136
136
|
"@scure/base": "~2.2",
|
|
137
137
|
"@scure/bip39": "~2.2",
|
|
138
|
-
"@
|
|
139
|
-
"@xylabs/
|
|
140
|
-
"@xylabs/
|
|
141
|
-
"@xylabs/
|
|
142
|
-
"@xylabs/react-
|
|
143
|
-
"@xylabs/react-
|
|
144
|
-
"@xylabs/react-
|
|
145
|
-
"@xylabs/react-
|
|
146
|
-
"@xylabs/
|
|
147
|
-
"@xylabs/
|
|
148
|
-
"@
|
|
149
|
-
"@xyo-network/account": "~
|
|
150
|
-
"@xyo-network/
|
|
151
|
-
"@xyo-network/api": "~
|
|
152
|
-
"@xyo-network/
|
|
153
|
-
"@xyo-network/boundwitness-
|
|
154
|
-
"@xyo-network/boundwitness-
|
|
155
|
-
"@xyo-network/
|
|
156
|
-
"@xyo-network/
|
|
157
|
-
"@xyo-network/
|
|
158
|
-
"@xyo-network/
|
|
159
|
-
"@xyo-network/payload-
|
|
160
|
-
"@xyo-network/payload-
|
|
161
|
-
"@xyo-network/payload-
|
|
162
|
-
"@xyo-network/payload-
|
|
163
|
-
"@xyo-network/
|
|
164
|
-
"@xyo-network/sdk-js": "
|
|
165
|
-
"@xyo-network/
|
|
166
|
-
"@xyo-network/wallet": "
|
|
167
|
-
"@xyo-network/
|
|
168
|
-
"@xyo-network/xl1-
|
|
169
|
-
"@xyo-network/xl1-sdk": "^1.28",
|
|
138
|
+
"@xylabs/fetch": "^6.0",
|
|
139
|
+
"@xylabs/geo": "^6.0",
|
|
140
|
+
"@xylabs/pixel": "~6.0",
|
|
141
|
+
"@xylabs/react-button": "~9.0",
|
|
142
|
+
"@xylabs/react-error": "~9.0",
|
|
143
|
+
"@xylabs/react-promise": "~9.0",
|
|
144
|
+
"@xylabs/react-shared": "~9.0",
|
|
145
|
+
"@xylabs/react-theme": "~9.0",
|
|
146
|
+
"@xylabs/sdk-js": "^6.0",
|
|
147
|
+
"@xylabs/threads": "~6.0",
|
|
148
|
+
"@xyo-network/account": "~6.0",
|
|
149
|
+
"@xyo-network/account-model": "~6.0",
|
|
150
|
+
"@xyo-network/api": "~6.0",
|
|
151
|
+
"@xyo-network/api-models": "~6.0",
|
|
152
|
+
"@xyo-network/boundwitness-builder": "~6.0",
|
|
153
|
+
"@xyo-network/boundwitness-model": "~6.0",
|
|
154
|
+
"@xyo-network/boundwitness-wrapper": "~6.0",
|
|
155
|
+
"@xyo-network/config-payload-plugin": "~6.0",
|
|
156
|
+
"@xyo-network/huri": "~6.0",
|
|
157
|
+
"@xyo-network/manifest-model": "~6.0",
|
|
158
|
+
"@xyo-network/payload-builder": "~6.0",
|
|
159
|
+
"@xyo-network/payload-model": "~6.0",
|
|
160
|
+
"@xyo-network/payload-plugin": "~6.0",
|
|
161
|
+
"@xyo-network/payload-wrapper": "~6.0",
|
|
162
|
+
"@xyo-network/query-payload-plugin": "~6.0",
|
|
163
|
+
"@xyo-network/sdk-js": "^6.0",
|
|
164
|
+
"@xyo-network/sdk-protocol-js": "~6.0",
|
|
165
|
+
"@xyo-network/wallet": "~6.0",
|
|
166
|
+
"@xyo-network/wallet-model": "^6.0",
|
|
167
|
+
"@xyo-network/xl1-blockies": "^2.0",
|
|
168
|
+
"@xyo-network/xl1-sdk": "^2.0",
|
|
170
169
|
"ajv": "^8.20",
|
|
171
170
|
"async-mutex": "^0.5",
|
|
172
171
|
"bn.js": "^5.2",
|
|
@@ -182,7 +181,7 @@
|
|
|
182
181
|
"js-cookie": "~3.0",
|
|
183
182
|
"lru-cache": "^11.3",
|
|
184
183
|
"mapbox-gl": "^3.23",
|
|
185
|
-
"mixpanel-browser": "~2.
|
|
184
|
+
"mixpanel-browser": "~2.79",
|
|
186
185
|
"observable-fns": "~0.6",
|
|
187
186
|
"pako": "^2.1",
|
|
188
187
|
"query-string": "~9.3",
|
|
@@ -193,9 +192,7 @@
|
|
|
193
192
|
"recharts": "~3.8",
|
|
194
193
|
"spark-md5": "~3.0",
|
|
195
194
|
"store2": "~2.14",
|
|
196
|
-
"storybook": "^10.3",
|
|
197
195
|
"uuid": "~14.0",
|
|
198
|
-
"vite": "^8.0",
|
|
199
196
|
"wasm-feature-detect": "~1.8",
|
|
200
197
|
"webextension-polyfill": "^0.12",
|
|
201
198
|
"zod": "~4.4"
|