@xyo-network/xl1-react-client-sdk 1.28.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/LICENSE +165 -0
- package/README.md +30 -0
- package/dist/browser/client/components/connected/ConnectAccountsStack.d.ts +51 -0
- package/dist/browser/client/components/connected/ConnectAccountsStack.d.ts.map +1 -0
- package/dist/browser/client/components/connected/account/Connected.d.ts +5 -0
- package/dist/browser/client/components/connected/account/Connected.d.ts.map +1 -0
- package/dist/browser/client/components/connected/account/index.d.ts +2 -0
- package/dist/browser/client/components/connected/account/index.d.ts.map +1 -0
- package/dist/browser/client/components/connected/hooks/index.d.ts +2 -0
- package/dist/browser/client/components/connected/hooks/index.d.ts.map +1 -0
- package/dist/browser/client/components/connected/hooks/useConnectAccount.d.ts +17 -0
- package/dist/browser/client/components/connected/hooks/useConnectAccount.d.ts.map +1 -0
- package/dist/browser/client/components/connected/index.d.ts +3 -0
- package/dist/browser/client/components/connected/index.d.ts.map +1 -0
- package/dist/browser/client/components/index.d.ts +2 -0
- package/dist/browser/client/components/index.d.ts.map +1 -0
- package/dist/browser/client/context/GatewayContext.d.ts +28 -0
- package/dist/browser/client/context/GatewayContext.d.ts.map +1 -0
- package/dist/browser/client/context/GatewayProviderProps.d.ts +6 -0
- package/dist/browser/client/context/GatewayProviderProps.d.ts.map +1 -0
- package/dist/browser/client/context/GatewayProviderState.d.ts +33 -0
- package/dist/browser/client/context/GatewayProviderState.d.ts.map +1 -0
- package/dist/browser/client/context/in-page/InPageGatewaysContext.d.ts +16 -0
- package/dist/browser/client/context/in-page/InPageGatewaysContext.d.ts.map +1 -0
- package/dist/browser/client/context/in-page/InPageGatewaysState.d.ts +21 -0
- package/dist/browser/client/context/in-page/InPageGatewaysState.d.ts.map +1 -0
- package/dist/browser/client/context/in-page/Provider.d.ts +60 -0
- package/dist/browser/client/context/in-page/Provider.d.ts.map +1 -0
- package/dist/browser/client/context/in-page/index.d.ts +5 -0
- package/dist/browser/client/context/in-page/index.d.ts.map +1 -0
- package/dist/browser/client/context/in-page/lib/buildGateway.d.ts +3 -0
- package/dist/browser/client/context/in-page/lib/buildGateway.d.ts.map +1 -0
- package/dist/browser/client/context/in-page/lib/index.d.ts +2 -0
- package/dist/browser/client/context/in-page/lib/index.d.ts.map +1 -0
- package/dist/browser/client/context/in-page/useProvidedInPageGateways.d.ts +13 -0
- package/dist/browser/client/context/in-page/useProvidedInPageGateways.d.ts.map +1 -0
- package/dist/browser/client/context/index.d.ts +7 -0
- package/dist/browser/client/context/index.d.ts.map +1 -0
- package/dist/browser/client/context/providers/GatewayProvider.d.ts +47 -0
- package/dist/browser/client/context/providers/GatewayProvider.d.ts.map +1 -0
- package/dist/browser/client/context/providers/WalletGatewayProvider.d.ts +34 -0
- package/dist/browser/client/context/providers/WalletGatewayProvider.d.ts.map +1 -0
- package/dist/browser/client/context/providers/index.d.ts +3 -0
- package/dist/browser/client/context/providers/index.d.ts.map +1 -0
- package/dist/browser/client/context/providers/story/GatewayStatus.d.ts +9 -0
- package/dist/browser/client/context/providers/story/GatewayStatus.d.ts.map +1 -0
- package/dist/browser/client/context/useProvidedGateway.d.ts +16 -0
- package/dist/browser/client/context/useProvidedGateway.d.ts.map +1 -0
- package/dist/browser/client/hooks/client/helpers/findCaveat.d.ts +3 -0
- package/dist/browser/client/hooks/client/helpers/findCaveat.d.ts.map +1 -0
- package/dist/browser/client/hooks/client/helpers/index.d.ts +2 -0
- package/dist/browser/client/hooks/client/helpers/index.d.ts.map +1 -0
- package/dist/browser/client/hooks/client/index.d.ts +5 -0
- package/dist/browser/client/hooks/client/index.d.ts.map +1 -0
- package/dist/browser/client/hooks/client/permissions/index.d.ts +3 -0
- package/dist/browser/client/hooks/client/permissions/index.d.ts.map +1 -0
- package/dist/browser/client/hooks/client/permissions/usePermissions.d.ts +7 -0
- package/dist/browser/client/hooks/client/permissions/usePermissions.d.ts.map +1 -0
- package/dist/browser/client/hooks/client/permissions/usePermissionsAccounts.d.ts +2 -0
- package/dist/browser/client/hooks/client/permissions/usePermissionsAccounts.d.ts.map +1 -0
- package/dist/browser/client/hooks/client/story/GatewayFromWalletStatus.d.ts +7 -0
- package/dist/browser/client/hooks/client/story/GatewayFromWalletStatus.d.ts.map +1 -0
- package/dist/browser/client/hooks/client/story/mockWalletDecorator.d.ts +3 -0
- package/dist/browser/client/hooks/client/story/mockWalletDecorator.d.ts.map +1 -0
- package/dist/browser/client/hooks/client/useClientFromWallet.d.ts +12 -0
- package/dist/browser/client/hooks/client/useClientFromWallet.d.ts.map +1 -0
- package/dist/browser/client/hooks/client/useGatewayFromWallet.d.ts +20 -0
- package/dist/browser/client/hooks/client/useGatewayFromWallet.d.ts.map +1 -0
- package/dist/browser/client/hooks/helpers/getXyoClient.d.ts +6 -0
- package/dist/browser/client/hooks/helpers/getXyoClient.d.ts.map +1 -0
- package/dist/browser/client/hooks/helpers/index.d.ts +2 -0
- package/dist/browser/client/hooks/helpers/index.d.ts.map +1 -0
- package/dist/browser/client/hooks/index.d.ts +3 -0
- package/dist/browser/client/hooks/index.d.ts.map +1 -0
- package/dist/browser/client/index.d.ts +5 -0
- package/dist/browser/client/index.d.ts.map +1 -0
- package/dist/browser/client/index.mjs +546 -0
- package/dist/browser/client/index.mjs.map +1 -0
- package/dist/browser/client/story/GatewayStats.d.ts +7 -0
- package/dist/browser/client/story/GatewayStats.d.ts.map +1 -0
- package/dist/browser/client/story/GatewayStatus.d.ts +3 -0
- package/dist/browser/client/story/GatewayStatus.d.ts.map +1 -0
- package/dist/browser/client/types/ContextGatewayType.d.ts +3 -0
- package/dist/browser/client/types/ContextGatewayType.d.ts.map +1 -0
- package/dist/browser/client/types/GatewayFromWallet.d.ts +8 -0
- package/dist/browser/client/types/GatewayFromWallet.d.ts.map +1 -0
- package/dist/browser/client/types/index.d.ts +3 -0
- package/dist/browser/client/types/index.d.ts.map +1 -0
- package/dist/browser/index.d.ts +4 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.mjs +722 -0
- package/dist/browser/index.mjs.map +1 -0
- package/dist/browser/model/index.d.ts +2 -0
- package/dist/browser/model/index.d.ts.map +1 -0
- package/dist/browser/model/index.mjs +13 -0
- package/dist/browser/model/index.mjs.map +1 -0
- package/dist/browser/model/types/XyoGlobal.d.ts +17 -0
- package/dist/browser/model/types/XyoGlobal.d.ts.map +1 -0
- package/dist/browser/model/types/index.d.ts +2 -0
- package/dist/browser/model/types/index.d.ts.map +1 -0
- package/dist/browser/shared/components/index.d.ts +3 -0
- package/dist/browser/shared/components/index.d.ts.map +1 -0
- package/dist/browser/shared/components/menu-item/ActiveMenuItem.d.ts +6 -0
- package/dist/browser/shared/components/menu-item/ActiveMenuItem.d.ts.map +1 -0
- package/dist/browser/shared/components/menu-item/index.d.ts +2 -0
- package/dist/browser/shared/components/menu-item/index.d.ts.map +1 -0
- package/dist/browser/shared/components/stack/DetailsStack.d.ts +10 -0
- package/dist/browser/shared/components/stack/DetailsStack.d.ts.map +1 -0
- package/dist/browser/shared/components/stack/LabelValueStack.d.ts +8 -0
- package/dist/browser/shared/components/stack/LabelValueStack.d.ts.map +1 -0
- package/dist/browser/shared/components/stack/index.d.ts +3 -0
- package/dist/browser/shared/components/stack/index.d.ts.map +1 -0
- package/dist/browser/shared/decorators/IframeWalletWarningDecorator.d.ts +10 -0
- package/dist/browser/shared/decorators/IframeWalletWarningDecorator.d.ts.map +1 -0
- package/dist/browser/shared/decorators/index.d.ts +2 -0
- package/dist/browser/shared/decorators/index.d.ts.map +1 -0
- package/dist/browser/shared/index.d.ts +3 -0
- package/dist/browser/shared/index.d.ts.map +1 -0
- package/dist/browser/shared/index.mjs +175 -0
- package/dist/browser/shared/index.mjs.map +1 -0
- package/package.json +234 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
+
of this license document, but changing it is not allowed.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
|
11
|
+
License, supplemented by the additional permissions listed below.
|
|
12
|
+
|
|
13
|
+
0. Additional Definitions.
|
|
14
|
+
|
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
17
|
+
General Public License.
|
|
18
|
+
|
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
|
20
|
+
other than an Application or a Combined Work as defined below.
|
|
21
|
+
|
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
25
|
+
of using an interface provided by the Library.
|
|
26
|
+
|
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
|
28
|
+
Application with the Library. The particular version of the Library
|
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
|
30
|
+
Version".
|
|
31
|
+
|
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
35
|
+
based on the Application, and not on the Linked Version.
|
|
36
|
+
|
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
|
38
|
+
object code and/or source code for the Application, including any data
|
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
41
|
+
|
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
|
43
|
+
|
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
|
46
|
+
|
|
47
|
+
2. Conveying Modified Versions.
|
|
48
|
+
|
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
|
51
|
+
that uses the facility (other than as an argument passed when the
|
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
|
53
|
+
version:
|
|
54
|
+
|
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
|
56
|
+
ensure that, in the event an Application does not supply the
|
|
57
|
+
function or data, the facility still operates, and performs
|
|
58
|
+
whatever part of its purpose remains meaningful, or
|
|
59
|
+
|
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
|
61
|
+
this License applicable to that copy.
|
|
62
|
+
|
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
|
64
|
+
|
|
65
|
+
The object code form of an Application may incorporate material from
|
|
66
|
+
a header file that is part of the Library. You may convey such object
|
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
|
68
|
+
material is not limited to numerical parameters, data structure
|
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
|
71
|
+
|
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
|
73
|
+
Library is used in it and that the Library and its use are
|
|
74
|
+
covered by this License.
|
|
75
|
+
|
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
77
|
+
document.
|
|
78
|
+
|
|
79
|
+
4. Combined Works.
|
|
80
|
+
|
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
|
82
|
+
taken together, effectively do not restrict modification of the
|
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
|
85
|
+
the following:
|
|
86
|
+
|
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
|
88
|
+
the Library is used in it and that the Library and its use are
|
|
89
|
+
covered by this License.
|
|
90
|
+
|
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
92
|
+
document.
|
|
93
|
+
|
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
|
95
|
+
execution, include the copyright notice for the Library among
|
|
96
|
+
these notices, as well as a reference directing the user to the
|
|
97
|
+
copies of the GNU GPL and this license document.
|
|
98
|
+
|
|
99
|
+
d) Do one of the following:
|
|
100
|
+
|
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
|
102
|
+
License, and the Corresponding Application Code in a form
|
|
103
|
+
suitable for, and under terms that permit, the user to
|
|
104
|
+
recombine or relink the Application with a modified version of
|
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
|
107
|
+
Corresponding Source.
|
|
108
|
+
|
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
|
111
|
+
a copy of the Library already present on the user's computer
|
|
112
|
+
system, and (b) will operate properly with a modified version
|
|
113
|
+
of the Library that is interface-compatible with the Linked
|
|
114
|
+
Version.
|
|
115
|
+
|
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
|
117
|
+
be required to provide such information under section 6 of the
|
|
118
|
+
GNU GPL, and only to the extent that such information is
|
|
119
|
+
necessary to install and execute a modified version of the
|
|
120
|
+
Combined Work produced by recombining or relinking the
|
|
121
|
+
Application with a modified version of the Linked Version. (If
|
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
|
126
|
+
for conveying Corresponding Source.)
|
|
127
|
+
|
|
128
|
+
5. Combined Libraries.
|
|
129
|
+
|
|
130
|
+
You may place library facilities that are a work based on the
|
|
131
|
+
Library side by side in a single library together with other library
|
|
132
|
+
facilities that are not Applications and are not covered by this
|
|
133
|
+
License, and convey such a combined library under terms of your
|
|
134
|
+
choice, if you do both of the following:
|
|
135
|
+
|
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
|
137
|
+
on the Library, uncombined with any other library facilities,
|
|
138
|
+
conveyed under the terms of this License.
|
|
139
|
+
|
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
|
141
|
+
is a work based on the Library, and explaining where to find the
|
|
142
|
+
accompanying uncombined form of the same work.
|
|
143
|
+
|
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
|
145
|
+
|
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
|
148
|
+
versions will be similar in spirit to the present version, but may
|
|
149
|
+
differ in detail to address new problems or concerns.
|
|
150
|
+
|
|
151
|
+
Each version is given a distinguishing version number. If the
|
|
152
|
+
Library as you received it specifies that a certain numbered version
|
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
|
154
|
+
applies to it, you have the option of following the terms and
|
|
155
|
+
conditions either of that published version or of any later version
|
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
|
160
|
+
|
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
|
164
|
+
permanent authorization for you to choose that version for the
|
|
165
|
+
Library.
|
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# @xyo-network/xl1-react-client-sdk
|
|
2
|
+
|
|
3
|
+
[![npm][npm-badge]][npm-link]
|
|
4
|
+
[![license][license-badge]][license-link]
|
|
5
|
+
|
|
6
|
+
> XL1 React Client/Wallet SDK
|
|
7
|
+
|
|
8
|
+
Combines client/wallet hooks, the XL1 React data model, and shared UI helpers into a single package. Subpath exports are available:
|
|
9
|
+
|
|
10
|
+
- `@xyo-network/xl1-react-client-sdk` — flat barrel of everything below
|
|
11
|
+
- `@xyo-network/xl1-react-client-sdk/client` — providers, hooks, components for client/wallet integration
|
|
12
|
+
- `@xyo-network/xl1-react-client-sdk/model` — `XyoGlobal` type and guards
|
|
13
|
+
- `@xyo-network/xl1-react-client-sdk/shared` — shared MUI components and Storybook decorators
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
{{pm}} add {{name}}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## License
|
|
22
|
+
|
|
23
|
+
See the [LICENSE](LICENSE) file for license rights and limitations (LGPL-3.0-only).
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
[npm-badge]: https://img.shields.io/npm/v/@xyo-network/xl1-react-client-sdk.svg
|
|
28
|
+
[npm-link]: https://www.npmjs.com/package/@xyo-network/xl1-react-client-sdk
|
|
29
|
+
[license-badge]: https://img.shields.io/npm/l/@xyo-network/xl1-react-client-sdk.svg
|
|
30
|
+
[license-link]: https://github.com/xylabs/xl1-protocol/blob/main/LICENSE
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { StackProps } from '@mui/material';
|
|
2
|
+
import type { Address } from '@xylabs/sdk-js';
|
|
3
|
+
import type { ComponentType, MouseEventHandler } from 'react';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
export interface ConnectClientAccountsStackProps extends StackProps {
|
|
6
|
+
AccountComponent?: ComponentType<{
|
|
7
|
+
account?: string;
|
|
8
|
+
}>;
|
|
9
|
+
ConnectComponent?: ComponentType<{
|
|
10
|
+
onClick?: MouseEventHandler<HTMLElement>;
|
|
11
|
+
}>;
|
|
12
|
+
NoWalletInstalledComponent?: ComponentType;
|
|
13
|
+
onAccountConnected?: (account: Address) => void;
|
|
14
|
+
onCancel?: () => void;
|
|
15
|
+
timeout?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Renders a horizontal stack that surfaces the current state of the user's
|
|
19
|
+
* connection to an XL1 wallet (e.g. the XL1 Chrome extension) and lets them
|
|
20
|
+
* kick off a connection.
|
|
21
|
+
*
|
|
22
|
+
* Connection state is derived from `useConnectAccount`, which wraps
|
|
23
|
+
* `useGatewayFromWallet` (wallet/gateway discovery with a configurable
|
|
24
|
+
* `timeout`) and `useAccountPermissions` (already-authorized addresses).
|
|
25
|
+
* The hook returns: `address` (resolved once the wallet exposes one),
|
|
26
|
+
* `connectSigner` (prompts the wallet for an address), `timedout` (the
|
|
27
|
+
* gateway never appeared within `timeout`), and `error` (the first of
|
|
28
|
+
* gateway, permissions, or signer-connect failures).
|
|
29
|
+
*
|
|
30
|
+
* The component renders exactly one of the following wallet states, plus
|
|
31
|
+
* an always-present error slot:
|
|
32
|
+
*
|
|
33
|
+
* - **Connected** — `address` is defined: renders `AccountComponent` for
|
|
34
|
+
* that address. Also fires `onAccountConnected(address)` once via effect.
|
|
35
|
+
* - **Disconnected, wallet available** — no `address` and not `timedout`:
|
|
36
|
+
* renders `ConnectComponent` as a "Connect" button that invokes
|
|
37
|
+
* `connectSigner()`. This covers both "wallet installed but no account
|
|
38
|
+
* authorized yet" and "gateway still resolving".
|
|
39
|
+
* - **Wallet missing / unreachable** — no `address` and `timedout` is true:
|
|
40
|
+
* renders `NoWalletInstalledComponent` (defaults to an Alert linking to
|
|
41
|
+
* the XL1 Wallet Chrome Web Store listing).
|
|
42
|
+
* - **Error** — any error from the hook is rendered via `ErrorRender`
|
|
43
|
+
* alongside the state above, and `onCancel()` is fired once via effect
|
|
44
|
+
* so the host UI can close/abort its connect flow.
|
|
45
|
+
*
|
|
46
|
+
* All three slot components (`AccountComponent`, `ConnectComponent`,
|
|
47
|
+
* `NoWalletInstalledComponent`) are injectable so consumers can restyle
|
|
48
|
+
* any state without forking this component.
|
|
49
|
+
*/
|
|
50
|
+
export declare const ConnectAccountsStack: React.FC<ConnectClientAccountsStackProps>;
|
|
51
|
+
//# sourceMappingURL=ConnectAccountsStack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectAccountsStack.d.ts","sourceRoot":"","sources":["../../../../../src/client/components/connected/ConnectAccountsStack.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAQ/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAC7D,OAAO,KAAoB,MAAM,OAAO,CAAA;AA4BxC,MAAM,WAAW,+BAAgC,SAAQ,UAAU;IACjE,gBAAgB,CAAC,EAAE,aAAa,CAAC;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACtD,gBAAgB,CAAC,EAAE,aAAa,CAAC;QAAE,OAAO,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAA;KAAE,CAAC,CAAA;IAC9E,0BAA0B,CAAC,EAAE,aAAa,CAAA;IAC1C,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IAC/C,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,+BAA+B,CA2C1E,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Connected.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/connected/account/Connected.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAW1D,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/connected/account/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/connected/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { GatewayName } from '@xyo-network/xl1-sdk';
|
|
2
|
+
export declare const useConnectAccount: (gatewayName?: GatewayName, timeout?: number) => {
|
|
3
|
+
address: (Lowercase<string> & {
|
|
4
|
+
readonly __hex: true;
|
|
5
|
+
} & {
|
|
6
|
+
readonly __address: true;
|
|
7
|
+
}) | undefined;
|
|
8
|
+
connectSigner: () => Promise<(Lowercase<string> & {
|
|
9
|
+
readonly __hex: true;
|
|
10
|
+
} & {
|
|
11
|
+
readonly __address: true;
|
|
12
|
+
}) | undefined>;
|
|
13
|
+
error: Error | undefined;
|
|
14
|
+
gateway: import("@xyo-network/xl1-sdk").XyoGatewayRunner | null | undefined;
|
|
15
|
+
timedout: boolean;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=useConnectAccount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConnectAccount.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/connected/hooks/useConnectAccount.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAMvD,eAAO,MAAM,iBAAiB,GAAI,cAAa,WAA4B,EAAE,UAAU,MAAM;;;;;;;;;;;;;;CA2B5F,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/client/components/connected/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,4BAA4B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/client/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared React context that decouples gateway *sources* from gateway
|
|
3
|
+
* *consumers*. Any provider that can resolve an `XyoGateway` publishes to
|
|
4
|
+
* this context; any hook or component that needs a gateway reads from it
|
|
5
|
+
* via `useProvidedGateway`. Consumers never import a specific provider —
|
|
6
|
+
* they just require that *some* provider is mounted above them in the
|
|
7
|
+
* tree.
|
|
8
|
+
*
|
|
9
|
+
* Current publishers:
|
|
10
|
+
* - `WalletGatewayProvider` (this package) — sources gateways from the
|
|
11
|
+
* injected XL1 wallet extension.
|
|
12
|
+
* - `GatewayProvider` in `@xyo-network/react-chain-provider` — sources
|
|
13
|
+
* gateways built in-page against RPC endpoints, falling back to the
|
|
14
|
+
* wallet when available.
|
|
15
|
+
*
|
|
16
|
+
* To add a new source (e.g. a mock provider for tests, an iframe-bridged
|
|
17
|
+
* provider, a server-rendered provider), publish a `GatewayContextState`
|
|
18
|
+
* to this same context — do not create a parallel context, or consumers
|
|
19
|
+
* will silently stop receiving updates.
|
|
20
|
+
*/
|
|
21
|
+
export declare const GatewayContext: import("react").Context<(import("./GatewayProviderState.ts").GatewayStateFields & {
|
|
22
|
+
provided: true;
|
|
23
|
+
}) | (import("@xylabs/react-shared").FixedValues<import("@xylabs/react-shared").ProvidedContextExState<import("./GatewayProviderState.ts").GatewayStateFields>, never> & {
|
|
24
|
+
provided: false;
|
|
25
|
+
}) | (import("@xylabs/react-shared").FixedValues<import("@xylabs/react-shared").NotProvidedContextExState<import("./GatewayProviderState.ts").GatewayStateFields>, never> & {
|
|
26
|
+
provided: false;
|
|
27
|
+
})>;
|
|
28
|
+
//# sourceMappingURL=GatewayContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GatewayContext.d.ts","sourceRoot":"","sources":["../../../../src/client/context/GatewayContext.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,cAAc;;;;;;GAAyC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GatewayProviderProps.d.ts","sourceRoot":"","sources":["../../../../src/client/context/GatewayProviderProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAE9C,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ContextExState } from '@xylabs/react-shared';
|
|
2
|
+
import type { ContextGatewayType } from '../types/index.ts';
|
|
3
|
+
/**
|
|
4
|
+
* The common surface area published to `GatewayContext`. Every gateway
|
|
5
|
+
* provider — wallet-backed, in-page, mock, or otherwise — must emit this
|
|
6
|
+
* shape so that consumers can ignore where the gateway came from.
|
|
7
|
+
*
|
|
8
|
+
* Fields use a three-state contract:
|
|
9
|
+
* - `undefined` — resolution is still in progress; show a loading state.
|
|
10
|
+
* - `null` — resolution completed and the gateway is definitively absent
|
|
11
|
+
* (e.g. no wallet installed, RPC unreachable); safe to show fallback UI.
|
|
12
|
+
* - `XyoGateway` — resolved and ready to use.
|
|
13
|
+
*
|
|
14
|
+
* `defaultGateway` is what most consumers want — the provider picks the
|
|
15
|
+
* best available source. `gateways` exposes the individual sources for
|
|
16
|
+
* the rare consumer that needs to differentiate (e.g. a debug panel, or
|
|
17
|
+
* a flow that must sign with the wallet specifically).
|
|
18
|
+
*
|
|
19
|
+
* `resetGatewaysFromConfig` is optional because not every provider has
|
|
20
|
+
* rebuildable in-page gateways (the wallet-only provider, for instance,
|
|
21
|
+
* has nothing to reset).
|
|
22
|
+
*/
|
|
23
|
+
export interface GatewayStateFields {
|
|
24
|
+
defaultGateway: ContextGatewayType | undefined | null;
|
|
25
|
+
error: Error | null | undefined;
|
|
26
|
+
gateways: {
|
|
27
|
+
inPageGateway: ContextGatewayType | undefined | null;
|
|
28
|
+
walletGateway: ContextGatewayType | undefined | null;
|
|
29
|
+
};
|
|
30
|
+
resetGatewaysFromConfig?: () => void;
|
|
31
|
+
}
|
|
32
|
+
export type GatewayContextState = ContextExState<GatewayStateFields>;
|
|
33
|
+
//# sourceMappingURL=GatewayProviderState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GatewayProviderState.d.ts","sourceRoot":"","sources":["../../../../src/client/context/GatewayProviderState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAE3D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,kBAAkB,GAAG,SAAS,GAAG,IAAI,CAAA;IACrD,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,CAAA;IAC/B,QAAQ,EAAE;QACR,aAAa,EAAE,kBAAkB,GAAG,SAAS,GAAG,IAAI,CAAA;QACpD,aAAa,EAAE,kBAAkB,GAAG,SAAS,GAAG,IAAI,CAAA;KACrD,CAAA;IACD,uBAAuB,CAAC,EAAE,MAAM,IAAI,CAAA;CACrC;AAED,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,kBAAkB,CAAC,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Narrow, provider-internal context that `InPageGatewaysProvider` writes
|
|
3
|
+
* to and `GatewayProvider` reads from. Do not consume this in application
|
|
4
|
+
* code — use `useProvidedGateway` (which reads the shared
|
|
5
|
+
* `GatewayContext`) instead. This context only exists to decouple the
|
|
6
|
+
* single in-page *builder* from the many single-gateway *adapters* that
|
|
7
|
+
* sit between it and the shared gateway surface.
|
|
8
|
+
*/
|
|
9
|
+
export declare const InPageGatewaysContext: import("react").Context<(import("./InPageGatewaysState.ts").InPageGatewaysStateFields & {
|
|
10
|
+
provided: true;
|
|
11
|
+
}) | (import("@xylabs/react-shared").FixedValues<import("@xylabs/react-shared").ProvidedContextExState<import("./InPageGatewaysState.ts").InPageGatewaysStateFields>, never> & {
|
|
12
|
+
provided: false;
|
|
13
|
+
}) | (import("@xylabs/react-shared").FixedValues<import("@xylabs/react-shared").NotProvidedContextExState<import("./InPageGatewaysState.ts").InPageGatewaysStateFields>, never> & {
|
|
14
|
+
provided: false;
|
|
15
|
+
})>;
|
|
16
|
+
//# sourceMappingURL=InPageGatewaysContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InPageGatewaysContext.d.ts","sourceRoot":"","sources":["../../../../../src/client/context/in-page/InPageGatewaysContext.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB;;;;;;GAAyC,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ContextExState } from '@xylabs/react-shared';
|
|
2
|
+
import type { GatewayName } from '@xyo-network/xl1-sdk';
|
|
3
|
+
import type { ContextGatewayType } from '../../types/index.ts';
|
|
4
|
+
/**
|
|
5
|
+
* Internal handoff shape published by `InPageGatewaysProvider` and
|
|
6
|
+
* consumed by `GatewayProvider`. Unlike `GatewayContextState`, this is a
|
|
7
|
+
* *map* of gateways keyed by network id — one builder near the tree root
|
|
8
|
+
* computes every network's gateway once, and individual `GatewayProvider`
|
|
9
|
+
* instances deeper in the tree pick out the one they need.
|
|
10
|
+
*
|
|
11
|
+
* This is not the cross-publisher surface area; consumers that want "a
|
|
12
|
+
* gateway" should read the shared `GatewayContext` via
|
|
13
|
+
* `useProvidedGateway`, not this map directly.
|
|
14
|
+
*/
|
|
15
|
+
export interface InPageGatewaysStateFields {
|
|
16
|
+
clearAll: () => void;
|
|
17
|
+
errors: Partial<Record<GatewayName, Error>>;
|
|
18
|
+
gateways: Partial<Record<GatewayName, ContextGatewayType>>;
|
|
19
|
+
}
|
|
20
|
+
export type InPageGatewaysState = ContextExState<InPageGatewaysStateFields>;
|
|
21
|
+
//# sourceMappingURL=InPageGatewaysState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InPageGatewaysState.d.ts","sourceRoot":"","sources":["../../../../../src/client/context/in-page/InPageGatewaysState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAEvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAE9D;;;;;;;;;;GAUG;AACH,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,CAAA;IAC3C,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC,CAAA;CAC3D;AAED,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,yBAAyB,CAAC,CAAA"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { RpcTransport, XyoSignerRpcSchemas } from '@xyo-network/xl1-sdk';
|
|
2
|
+
import type { PropsWithChildren } from 'react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export interface InPageGatewaysProviderProps extends PropsWithChildren {
|
|
5
|
+
signerTransport?: RpcTransport<XyoSignerRpcSchemas>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Publishes a keyed map of in-page gateways — one per network in
|
|
9
|
+
* `DefaultNetworks` — under the narrow `InPageGatewaysContext`.
|
|
10
|
+
*
|
|
11
|
+
* This provider is deliberately *not* a direct publisher of the shared
|
|
12
|
+
* `GatewayContext` that `useProvidedGateway` reads. Its consumer is the
|
|
13
|
+
* wrapping `GatewayProvider` in this same package, which picks the
|
|
14
|
+
* `gatewayName` the consumer asked for out of this map, adapts it into
|
|
15
|
+
* the single-gateway `GatewayContextState` shape, and then publishes *that*
|
|
16
|
+
* to the shared context. Splitting the work this way lets one
|
|
17
|
+
* `InPageGatewaysProvider` near the root build every network's gateway
|
|
18
|
+
* once, while many `GatewayProvider` instances deeper in the tree each
|
|
19
|
+
* expose whichever gateway their subtree cares about.
|
|
20
|
+
*
|
|
21
|
+
* Unlike `WalletGatewayProvider`, gateways here are constructed directly
|
|
22
|
+
* in the page (via `buildGateway`) against each network's RPC endpoint
|
|
23
|
+
* — no browser wallet extension is required. `signerTransport` switches
|
|
24
|
+
* between viewer (read-only) and runner (can sign/send) locators; supply
|
|
25
|
+
* it only when the app needs to sign.
|
|
26
|
+
*
|
|
27
|
+
* Behavior:
|
|
28
|
+
* - On mount, and whenever `signerTransport` changes, `buildGateway` is
|
|
29
|
+
* called in parallel for every network in `DefaultNetworks` via
|
|
30
|
+
* `Promise.allSettled`. Networks that resolve populate `gateways[id]`;
|
|
31
|
+
* networks that reject populate `errors[id]`. One failed network does
|
|
32
|
+
* not block the others.
|
|
33
|
+
* - If `signerTransport` is provided, gateways are built with a remote
|
|
34
|
+
* *runner* locator, otherwise with a remote *viewer* locator.
|
|
35
|
+
* - When `signerTransport` changes identity mid-life, the provider clears
|
|
36
|
+
* all cached gateways and errors synchronously during render (via
|
|
37
|
+
* `previousSignerTransport` state) so consumers never see gateways
|
|
38
|
+
* bound to the previous transport, then rebuilds in the effect.
|
|
39
|
+
* - State updates from the rebuild are wrapped in `startTransition` so a
|
|
40
|
+
* slow network doesn't stall higher-priority UI updates.
|
|
41
|
+
* - A `cancelled` flag in the effect's cleanup discards results from a
|
|
42
|
+
* prior `signerTransport` once a new one is in flight.
|
|
43
|
+
*
|
|
44
|
+
* Published `InPageGatewaysState` (narrower than `GatewayContextState` —
|
|
45
|
+
* this is an internal handoff shape, not the cross-publisher surface):
|
|
46
|
+
* - `gateways` — `Partial<Record<GatewayName, ContextGatewayType>>`. Keys
|
|
47
|
+
* are only present for networks that built successfully.
|
|
48
|
+
* - `errors` — `Partial<Record<GatewayName, Error>>`. Per-network build
|
|
49
|
+
* failures, keyed by `GatewayName`.
|
|
50
|
+
* - `clearAll()` — manually empties both maps. Also invoked internally on
|
|
51
|
+
* transport changes. Forwarded by `GatewayProvider` to consumers as
|
|
52
|
+
* `resetGatewaysFromConfig`.
|
|
53
|
+
* - `provided: true` — lets descendants detect a real provider.
|
|
54
|
+
*
|
|
55
|
+
* Note: the commented-out `SimpleXyoClient` at the top is intentionally
|
|
56
|
+
* disabled pending a type unification between `XyoGateway` and
|
|
57
|
+
* `XyoGatewayRunner`.
|
|
58
|
+
*/
|
|
59
|
+
export declare const InPageGatewaysProvider: React.FC<InPageGatewaysProviderProps>;
|
|
60
|
+
//# sourceMappingURL=Provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../../src/client/context/in-page/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACG,YAAY,EAAE,mBAAmB,EAC/C,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,KAGN,MAAM,OAAO,CAAA;AAOd,MAAM,WAAW,2BAA4B,SAAQ,iBAAiB;IACpE,eAAe,CAAC,EAAE,YAAY,CAAC,mBAAmB,CAAC,CAAA;CACpD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAmExE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/client/context/in-page/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,0BAA0B,CAAA;AACxC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gCAAgC,CAAA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { GatewayName, RpcTransport, SimpleXyoGateway, XyoSignerRpcSchemas } from '@xyo-network/xl1-sdk';
|
|
2
|
+
export declare const buildGateway: (gatewayName: GatewayName, signerTransport?: RpcTransport<XyoSignerRpcSchemas>) => Promise<import("@xyo-network/xl1-sdk").CreatableProviderInstance<SimpleXyoGateway>>;
|
|
3
|
+
//# sourceMappingURL=buildGateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildGateway.d.ts","sourceRoot":"","sources":["../../../../../../src/client/context/in-page/lib/buildGateway.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACG,YAAY,EAAE,gBAAgB,EAC5C,mBAAmB,EACpB,MAAM,sBAAsB,CAAA;AAO7B,eAAO,MAAM,YAAY,GAAU,aAAa,WAAW,EAAE,kBAAkB,YAAY,CAAC,mBAAmB,CAAC,wFAkB/G,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/client/context/in-page/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads the `InPageGatewaysContext` map of per-network in-page gateways.
|
|
3
|
+
* Intended for internal use by `GatewayProvider` — application code
|
|
4
|
+
* should prefer `useProvidedGateway`, which returns a single resolved
|
|
5
|
+
* gateway regardless of source.
|
|
6
|
+
*
|
|
7
|
+
* @param required - When `true` (default), throws if no
|
|
8
|
+
* `InPageGatewaysProvider` is mounted above.
|
|
9
|
+
*/
|
|
10
|
+
export declare const useProvidedInPageGateways: (required?: boolean) => Omit<import("./InPageGatewaysState.ts").InPageGatewaysStateFields & {
|
|
11
|
+
provided: true;
|
|
12
|
+
}, "provided"> | Omit<import("@xylabs/react-shared").NotProvidedContextExState<import("./InPageGatewaysState.ts").InPageGatewaysState>, "provided">;
|
|
13
|
+
//# sourceMappingURL=useProvidedInPageGateways.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useProvidedInPageGateways.d.ts","sourceRoot":"","sources":["../../../../../src/client/context/in-page/useProvidedInPageGateways.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,GAAI,kBAAe;;mJAAoE,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './GatewayContext.ts';
|
|
2
|
+
export * from './GatewayProviderProps.ts';
|
|
3
|
+
export * from './GatewayProviderState.ts';
|
|
4
|
+
export * from './in-page/index.ts';
|
|
5
|
+
export * from './providers/index.ts';
|
|
6
|
+
export * from './useProvidedGateway.ts';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/client/context/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,yBAAyB,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { GatewayProviderProps } from '../GatewayProviderProps.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Publishes the shared `GatewayContext` backed by two sources: the
|
|
5
|
+
* injected XL1 Wallet extension *and* the in-page gateways built by
|
|
6
|
+
* `InPageGatewaysProvider`. Use this provider when the host app can
|
|
7
|
+
* function without a wallet (falling back to the in-page client) but
|
|
8
|
+
* should still prefer the wallet when it is present.
|
|
9
|
+
*
|
|
10
|
+
* Required ancestry: an `InPageGatewaysProvider` must be mounted above
|
|
11
|
+
* this provider — `useProvidedInPageGateways(true)` throws if missing.
|
|
12
|
+
* If you only need a wallet-backed gateway, use `WalletGatewayProvider`
|
|
13
|
+
* instead.
|
|
14
|
+
*
|
|
15
|
+
* Source precedence for `defaultGateway`:
|
|
16
|
+
* - Wallet present and resolved (`XyoGatewayRunner`) → wallet wins; the
|
|
17
|
+
* in-page gateway is still exposed via `gateways.inPageGateway` for
|
|
18
|
+
* the rare consumer that needs to target it specifically.
|
|
19
|
+
* - Wallet definitively absent (`null`) → fall back to the in-page
|
|
20
|
+
* gateway matching `gatewayName`.
|
|
21
|
+
* - Wallet still resolving (`undefined`) → leave `defaultGateway`
|
|
22
|
+
* `undefined` so consumers render a loading state rather than
|
|
23
|
+
* committing to the in-page fallback prematurely.
|
|
24
|
+
*
|
|
25
|
+
* The published `GatewayContextState` shape:
|
|
26
|
+
* - `defaultGateway` — resolved per the precedence above. Three-state:
|
|
27
|
+
* `undefined` = loading, `null` is not produced by this provider
|
|
28
|
+
* (wallet-null collapses to `gatewayFromConfig`), `XyoGateway` = ready.
|
|
29
|
+
* - `gateways.walletGateway` — raw wallet result (tri-state).
|
|
30
|
+
* - `gateways.inPageGateway` — raw in-page result for the requested
|
|
31
|
+
* `gatewayName`, or `undefined` if no `gatewayName` was passed.
|
|
32
|
+
* - `error` — first non-null of wallet error, then in-page build error
|
|
33
|
+
* for this `gatewayName`. Also rendered inline via `ErrorRender` above
|
|
34
|
+
* `children` so mount-time failures surface even when no consumer
|
|
35
|
+
* reads `error`.
|
|
36
|
+
* - `resetGatewaysFromConfig` — forwards `clearAll` from
|
|
37
|
+
* `InPageGatewaysProvider`, letting consumers force a rebuild of the
|
|
38
|
+
* in-page gateways (e.g. after a network or endpoint change).
|
|
39
|
+
* - `provided: true` — lets descendants detect a real provider in the
|
|
40
|
+
* tree.
|
|
41
|
+
*
|
|
42
|
+
* `defaultGateway`, `gateways`, and the context `value` are memoized so
|
|
43
|
+
* consumers only re-render when wallet or in-page sources actually
|
|
44
|
+
* change identity.
|
|
45
|
+
*/
|
|
46
|
+
export declare const GatewayProvider: React.FC<GatewayProviderProps>;
|
|
47
|
+
//# sourceMappingURL=GatewayProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GatewayProvider.d.ts","sourceRoot":"","sources":["../../../../../src/client/context/providers/GatewayProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAItC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAItE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAiE1D,CAAA"}
|