@pioneer-platform/pioneer-react 0.0.2 → 0.2.32
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/.eslintrc.js +24 -0
- package/.github/workflows/release.yml +22 -0
- package/.github/workflows/update-license.yml +11 -0
- package/.lintstagedrc.json +6 -0
- package/.prettierrc +7 -0
- package/.vscode/extensions.json +8 -0
- package/CHANGELOG.md +5 -0
- package/LICENSE +21 -0
- package/README.md +40 -0
- package/commitlint.config.js +3 -0
- package/dist/assets/404 Error-rafiki.svg +1 -0
- package/dist/assets/Building blocks-amico.svg +1 -0
- package/dist/assets/chakra-ui-logomark-colored.svg +10 -0
- package/dist/assets/favicon.svg +0 -0
- package/dist/assets/react-icon.svg +7 -0
- package/dist/assets/ts-logo-512.svg +1 -0
- package/dist/assets/vite-logo.svg +15 -0
- package/dist/index.js +384249 -0
- package/dist/index_3bde86fb.js +205 -0
- package/dist/index_49fce0b0.js +384033 -0
- package/dist/index_d01e819c.css +63 -0
- package/dist/manifest.json +12 -0
- package/dist/robots.txt +6 -0
- package/index.html +13 -0
- package/netlify.toml +10 -0
- package/package.json +70 -10
- package/public/assets/404 Error-rafiki.svg +1 -0
- package/public/assets/Building blocks-amico.svg +1 -0
- package/public/assets/chakra-ui-logomark-colored.svg +10 -0
- package/public/assets/favicon.svg +0 -0
- package/public/assets/react-icon.svg +7 -0
- package/public/assets/ts-logo-512.svg +1 -0
- package/public/assets/vite-logo.svg +15 -0
- package/public/manifest.json +12 -0
- package/public/robots.txt +6 -0
- package/renovate.json +11 -0
- package/src/App.tsx +21 -0
- package/src/index.tsx +41 -0
- package/src/lib/assets/Icons/KeepKeyIcon.tsx +13 -0
- package/src/lib/assets/Icons/KeplrIcon.tsx +140 -0
- package/src/lib/assets/Icons/MetaMaskIcon.tsx +126 -0
- package/src/lib/assets/Icons/TallyHoIcon.tsx +17 -0
- package/src/lib/assets/Icons/XDEFIIcon.tsx +32 -0
- package/src/lib/assets/favicon.ico +0 -0
- package/src/lib/assets/png/keepkey.png +0 -0
- package/src/lib/assets/png/keplr.png +0 -0
- package/src/lib/assets/png/metamask.png +0 -0
- package/src/lib/assets/png/pioneer.png +0 -0
- package/src/lib/components/AssetSelect/index.tsx +166 -0
- package/src/lib/components/BlockchainSelect/index.tsx +166 -0
- package/src/lib/components/MiddleEllipsis/index.tsx +27 -0
- package/src/lib/components/WalletSelect/index.tsx +112 -0
- package/src/lib/components/auth/RequireAuth.tsx +22 -0
- package/src/lib/components/modals/AssetModal.tsx +67 -0
- package/src/lib/components/modals/SettingsModal.tsx +76 -0
- package/src/lib/components/pioneer/Pioneer/Balances.tsx +266 -0
- package/src/lib/components/pioneer/Pioneer/MiddleEllipsis.tsx +27 -0
- package/src/lib/components/pioneer/Pioneer/Nodes.tsx +0 -0
- package/src/lib/components/pioneer/Pioneer/Paths.tsx +290 -0
- package/src/lib/components/pioneer/Pioneer/Pubkey.tsx +67 -0
- package/src/lib/components/pioneer/Pioneer/Pubkeys.tsx +265 -0
- package/src/lib/components/pioneer/Pioneer/Receive.tsx +26 -0
- package/src/lib/components/pioneer/Pioneer/Send.tsx +135 -0
- package/src/lib/components/pioneer/Pioneer/View.tsx +44 -0
- package/src/lib/components/pioneer/Pioneer/Wallets.tsx +166 -0
- package/src/lib/components/pioneer/index.tsx +525 -0
- package/src/lib/components/utils/index.tsx +47 -0
- package/src/lib/context/Pioneer/index.tsx +420 -0
- package/src/lib/layout/Footer.tsx +22 -0
- package/src/lib/layout/Header.tsx +38 -0
- package/src/lib/layout/Meta.tsx +25 -0
- package/src/lib/layout/Pioneer/Balances.tsx +290 -0
- package/src/lib/layout/Pioneer/MiddleEllipsis.tsx +27 -0
- package/src/lib/layout/Pioneer/Pubkey.tsx +67 -0
- package/src/lib/layout/Pioneer/Receive.tsx +26 -0
- package/src/lib/layout/Pioneer/Send.tsx +135 -0
- package/src/lib/layout/Pioneer/View.tsx +44 -0
- package/src/lib/layout/Pioneer/Wallets.tsx +166 -0
- package/src/lib/layout/ThemeToggle.tsx +16 -0
- package/src/lib/layout/index.tsx +29 -0
- package/src/lib/pages/404/index.tsx +36 -0
- package/src/lib/pages/home/components/CTASection.tsx +36 -0
- package/src/lib/pages/home/components/SomeImage.tsx +36 -0
- package/src/lib/pages/home/components/SomeText.tsx +16 -0
- package/src/lib/pages/home/index.tsx +87 -0
- package/src/lib/router/Routings.tsx +45 -0
- package/src/lib/router/routes.tsx +13 -0
- package/src/lib/styles/theme/config.ts +5 -0
- package/src/lib/styles/theme/index.ts +17 -0
- package/tsconfig.json +19 -9
- package/turbo.json +17 -0
- package/vercel.json +4 -0
- package/vite.config.ts +110 -0
|
@@ -0,0 +1,205 @@
|
|
|
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
|
+
};
|