@pioneer-platform/pioneer-react 0.2.32 → 0.2.34
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/index.js +8813 -11991
- package/package.json +1 -1
- package/src/index.tsx +10 -9
- package/src/lib/context/Pioneer/index.tsx +2 -3
- package/dist/index_3bde86fb.js +0 -205
- package/dist/index_49fce0b0.js +0 -384033
- package/src/lib/components/pioneer/Pioneer/Nodes.tsx +0 -0
package/package.json
CHANGED
package/src/index.tsx
CHANGED
|
@@ -20,15 +20,16 @@ import App from "./App";
|
|
|
20
20
|
|
|
21
21
|
// index.tsx
|
|
22
22
|
|
|
23
|
-
const root = ReactDOM.createRoot(
|
|
24
|
-
|
|
25
|
-
);
|
|
26
|
-
root.render(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
);
|
|
23
|
+
// const root = ReactDOM.createRoot(
|
|
24
|
+
// document.getElementById("root") as HTMLElement
|
|
25
|
+
// );
|
|
26
|
+
// root.render(
|
|
27
|
+
// <>
|
|
28
|
+
// <ColorModeScript initialColorMode={theme.config?.initialColorMode} />
|
|
29
|
+
// <App />
|
|
30
|
+
// </>
|
|
31
|
+
// );
|
|
32
|
+
|
|
32
33
|
export {
|
|
33
34
|
Pioneer,
|
|
34
35
|
PioneerProvider,
|
|
@@ -240,14 +240,13 @@ export const PioneerProvider = ({
|
|
|
240
240
|
|
|
241
241
|
// @TODO add custom paths from localstorage
|
|
242
242
|
const paths: any = [];
|
|
243
|
+
console.log("VITE_PIONEER_URL_SPEC: ",)
|
|
243
244
|
const spec =
|
|
244
|
-
//@ts-ignore
|
|
245
|
-
import.meta.env.VITE_PIONEER_URL_SPEC ||
|
|
246
245
|
//@ts-ignore
|
|
247
246
|
"https://pioneers.dev/spec/swagger.json";
|
|
248
247
|
//@ts-ignore
|
|
249
248
|
console.log("spec: ", spec);
|
|
250
|
-
const wss =
|
|
249
|
+
const wss = "wss://pioneers.dev";
|
|
251
250
|
const configPioneer: any = {
|
|
252
251
|
blockchains,
|
|
253
252
|
username,
|
package/dist/index_3bde86fb.js
DELETED
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import { u as usePioneer, j as jsxRuntimeExports, S as Search2Icon, M as MiddleEllipsis, W as WalletSelect, A as AssetSelect } from "./index_49fce0b0.js";
|
|
2
|
-
import { Stack, InputGroup, InputLeftElement, Input, Box, Text, Checkbox, HStack, Avatar, Button, useDisclosure, Modal, ModalOverlay, ModalContent, ModalHeader, ModalCloseButton, ModalBody, ModalFooter } from "@chakra-ui/react";
|
|
3
|
-
import { useState, useEffect } from "react";
|
|
4
|
-
import "react-dom";
|
|
5
|
-
import "@emotion/react";
|
|
6
|
-
function BlockchainSelect({ onClose }) {
|
|
7
|
-
const { state, dispatch } = usePioneer();
|
|
8
|
-
const { api, app, user } = state;
|
|
9
|
-
const [searchQuery, setSearchQuery] = useState("");
|
|
10
|
-
const [currentPage, setCurrentPage] = useState([]);
|
|
11
|
-
const [currentPageIndex, setCurrentPageIndex] = useState(0);
|
|
12
|
-
const [showOwnedAssets, setShowOwnedAssets] = useState(false);
|
|
13
|
-
const [timeOut, setTimeOut] = useState(null);
|
|
14
|
-
const itemsPerPage = 6;
|
|
15
|
-
const handleSelectClick = async (asset) => {
|
|
16
|
-
try {
|
|
17
|
-
const changeAssetContext = await app.setAssetContext(asset);
|
|
18
|
-
onClose();
|
|
19
|
-
} catch (e) {
|
|
20
|
-
console.error(e);
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
const onSearch = async function(searchQuery2) {
|
|
24
|
-
try {
|
|
25
|
-
if (!api) {
|
|
26
|
-
alert("Failed to init API!");
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const search = {
|
|
30
|
-
limit: itemsPerPage,
|
|
31
|
-
skip: currentPageIndex * itemsPerPage,
|
|
32
|
-
// Use currentPageIndex for pagination
|
|
33
|
-
collection: "blockchains",
|
|
34
|
-
searchQuery: searchQuery2,
|
|
35
|
-
searchFields: ["name", "symbol"]
|
|
36
|
-
};
|
|
37
|
-
const info = await api.SearchAtlas(search);
|
|
38
|
-
const currentPageData = info.data.results;
|
|
39
|
-
setCurrentPage(currentPageData);
|
|
40
|
-
setTotalBlockchains(info.data.total);
|
|
41
|
-
} catch (e) {
|
|
42
|
-
console.error(e);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
const fetchPage = async (pageIndex) => {
|
|
46
|
-
try {
|
|
47
|
-
if (!api) {
|
|
48
|
-
alert("Failed to init API!");
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const search = {
|
|
52
|
-
limit: itemsPerPage,
|
|
53
|
-
skip: pageIndex * itemsPerPage,
|
|
54
|
-
collection: "blockchains",
|
|
55
|
-
ownedBy: showOwnedAssets ? user.id : void 0
|
|
56
|
-
};
|
|
57
|
-
const info = await api.SearchAtlas(search);
|
|
58
|
-
const currentPageData = info.data.results;
|
|
59
|
-
setCurrentPage(currentPageData);
|
|
60
|
-
setTotalBlockchains(info.data.total);
|
|
61
|
-
} catch (e) {
|
|
62
|
-
console.error(e);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
useEffect(() => {
|
|
66
|
-
fetchPage(currentPageIndex);
|
|
67
|
-
}, [currentPageIndex, showOwnedAssets]);
|
|
68
|
-
const [totalBlockchains, setTotalBlockchains] = useState(0);
|
|
69
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(Stack, { spacing: 4, children: [
|
|
70
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(InputGroup, { children: [
|
|
71
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(InputLeftElement, { pointerEvents: "none", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Search2Icon, { color: "gray.300" }) }),
|
|
72
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
73
|
-
Input,
|
|
74
|
-
{
|
|
75
|
-
placeholder: "Bitcoin...",
|
|
76
|
-
type: "text",
|
|
77
|
-
value: searchQuery,
|
|
78
|
-
onChange: (e) => {
|
|
79
|
-
setSearchQuery(e.target.value);
|
|
80
|
-
if (timeOut) {
|
|
81
|
-
clearTimeout(timeOut);
|
|
82
|
-
}
|
|
83
|
-
setTimeOut(
|
|
84
|
-
// @ts-ignore
|
|
85
|
-
setTimeout(() => {
|
|
86
|
-
setCurrentPageIndex(0);
|
|
87
|
-
onSearch(e.target.value);
|
|
88
|
-
}, 1e3)
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
)
|
|
93
|
-
] }),
|
|
94
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { children: [
|
|
95
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Text, { fontSize: "2xl", children: [
|
|
96
|
-
"Total Chains: ",
|
|
97
|
-
totalBlockchains
|
|
98
|
-
] }),
|
|
99
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
100
|
-
Checkbox,
|
|
101
|
-
{
|
|
102
|
-
isChecked: showOwnedAssets,
|
|
103
|
-
onChange: () => setShowOwnedAssets(!showOwnedAssets),
|
|
104
|
-
children: "Show only blockchains you have assets on"
|
|
105
|
-
}
|
|
106
|
-
),
|
|
107
|
-
currentPage.map((blockchain, index) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { children: [
|
|
108
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(HStack, { spacing: 4, alignItems: "center", children: [
|
|
109
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Avatar, { src: blockchain == null ? void 0 : blockchain.image }),
|
|
110
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { children: [
|
|
111
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("small", { children: [
|
|
112
|
-
"blockchain: ",
|
|
113
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(MiddleEllipsis, { text: blockchain == null ? void 0 : blockchain.caip })
|
|
114
|
-
] }),
|
|
115
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
116
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("small", { children: [
|
|
117
|
-
"name: ",
|
|
118
|
-
blockchain.name
|
|
119
|
-
] })
|
|
120
|
-
] })
|
|
121
|
-
] }),
|
|
122
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(HStack, { mt: 2, spacing: 2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
123
|
-
Button,
|
|
124
|
-
{
|
|
125
|
-
size: "sm",
|
|
126
|
-
variant: "outline",
|
|
127
|
-
onClick: () => handleSelectClick(blockchain),
|
|
128
|
-
children: "Select"
|
|
129
|
-
}
|
|
130
|
-
) })
|
|
131
|
-
] }, index))
|
|
132
|
-
] }),
|
|
133
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(HStack, { mt: 4, children: [
|
|
134
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
135
|
-
Button,
|
|
136
|
-
{
|
|
137
|
-
isDisabled: currentPageIndex === 0,
|
|
138
|
-
onClick: () => setCurrentPageIndex(currentPageIndex - 1),
|
|
139
|
-
children: "Previous Page"
|
|
140
|
-
}
|
|
141
|
-
),
|
|
142
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
143
|
-
Button,
|
|
144
|
-
{
|
|
145
|
-
isDisabled: currentPage.length < itemsPerPage,
|
|
146
|
-
onClick: () => setCurrentPageIndex(currentPageIndex + 1),
|
|
147
|
-
children: "Next Page"
|
|
148
|
-
}
|
|
149
|
-
)
|
|
150
|
-
] })
|
|
151
|
-
] });
|
|
152
|
-
}
|
|
153
|
-
const Home = () => {
|
|
154
|
-
const { state } = usePioneer();
|
|
155
|
-
const { api, app, context, assetContext, blockchainContext, pubkeyContext } = state;
|
|
156
|
-
const [address, setAddress] = useState("");
|
|
157
|
-
const [modalType, setModalType] = useState("");
|
|
158
|
-
const { isOpen, onOpen, onClose } = useDisclosure();
|
|
159
|
-
useEffect(() => {
|
|
160
|
-
console.log("pubkeyContext: ", pubkeyContext);
|
|
161
|
-
setAddress(pubkeyContext.master || pubkeyContext.pubkey);
|
|
162
|
-
}, [pubkeyContext]);
|
|
163
|
-
const openModal = (type) => {
|
|
164
|
-
setModalType(type);
|
|
165
|
-
onOpen();
|
|
166
|
-
};
|
|
167
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
168
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(Modal, { isOpen, onClose: () => onClose(), size: "xl", children: [
|
|
169
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ModalOverlay, {}),
|
|
170
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(ModalContent, { children: [
|
|
171
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ModalHeader, { children: modalType }),
|
|
172
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ModalCloseButton, {}),
|
|
173
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(ModalBody, { children: [
|
|
174
|
-
modalType === "Select wallet" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(WalletSelect, { onClose }) }),
|
|
175
|
-
modalType === "Select Asset" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(AssetSelect, { onClose }) }),
|
|
176
|
-
modalType === "Select Blockchain" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(BlockchainSelect, { onClose }) }),
|
|
177
|
-
modalType === "View Address" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
178
|
-
"address: ",
|
|
179
|
-
address
|
|
180
|
-
] })
|
|
181
|
-
] }),
|
|
182
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ModalFooter, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { colorScheme: "blue", onClick: onClose, children: "Close" }) })
|
|
183
|
-
] })
|
|
184
|
-
] }),
|
|
185
|
-
"Context: ",
|
|
186
|
-
context,
|
|
187
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: () => openModal("Select wallet"), children: "Select wallet" }),
|
|
188
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
189
|
-
"Asset Context: ",
|
|
190
|
-
assetContext == null ? void 0 : assetContext.name,
|
|
191
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: () => openModal("Select Asset"), children: "Select Asset" }),
|
|
192
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
193
|
-
"Blockchain Context: ",
|
|
194
|
-
blockchainContext == null ? void 0 : blockchainContext.name,
|
|
195
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: () => openModal("Select Blockchain"), children: "Select Blockchain" }),
|
|
196
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
|
|
197
|
-
"Address: ",
|
|
198
|
-
(pubkeyContext == null ? void 0 : pubkeyContext.master) || (pubkeyContext == null ? void 0 : pubkeyContext.pubkey),
|
|
199
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: () => openModal("View Address"), children: "View Address" }),
|
|
200
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("br", {})
|
|
201
|
-
] });
|
|
202
|
-
};
|
|
203
|
-
export {
|
|
204
|
-
Home as default
|
|
205
|
-
};
|