@hypersokrat/hyper-pay 1.0.1 → 1.0.2
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/package.json +1 -1
- package/.storybook/main.js +0 -9
- package/.storybook/preview.js +0 -41
- package/rollup.config.js +0 -60
- package/src/assets/css/main-theme.css +0 -311
- package/src/assets/fonts/LackRegular/Lack-Regular.eot +0 -0
- package/src/assets/fonts/LackRegular/Lack-Regular.svg +0 -5284
- package/src/assets/fonts/LackRegular/Lack-Regular.ttf +0 -0
- package/src/assets/fonts/LackRegular/Lack-Regular.woff +0 -0
- package/src/assets/fonts/LackRegular/Lack-Regular.woff2 +0 -0
- package/src/assets/fonts/Marcellus/Marcellus-Regular.eot +0 -0
- package/src/assets/fonts/Marcellus/Marcellus-Regular.svg +0 -1966
- package/src/assets/fonts/Marcellus/Marcellus-Regular.ttf +0 -0
- package/src/assets/fonts/Marcellus/Marcellus-Regular.woff +0 -0
- package/src/assets/fonts/Marcellus/Marcellus-Regular.woff2 +0 -0
- package/src/assets/fonts/Marcellus/demo.html +0 -192
- package/src/assets/fonts/Marcellus/stylesheet.css +0 -13
- package/src/assets/fonts/Poppins/Poppins-Regular.eot +0 -0
- package/src/assets/fonts/Poppins/Poppins-Regular.svg +0 -3213
- package/src/assets/fonts/Poppins/Poppins-Regular.ttf +0 -0
- package/src/assets/fonts/Poppins/Poppins-Regular.woff +0 -0
- package/src/assets/fonts/Poppins/Poppins-Regular.woff2 +0 -0
- package/src/assets/fonts/Poppins/stylesheet.css +0 -13
- package/src/assets/fonts/UberMove/UberMove-Medium.eot +0 -0
- package/src/assets/fonts/UberMove/UberMove-Medium.svg +0 -4049
- package/src/assets/fonts/UberMove/UberMove-Medium.ttf +0 -0
- package/src/assets/fonts/UberMove/UberMove-Medium.woff +0 -0
- package/src/assets/fonts/UberMove/UberMove-Medium.woff2 +0 -0
- package/src/assets/fonts/UberMove/UberMove-Regular.eot +0 -0
- package/src/assets/fonts/UberMove/UberMove-Regular.svg +0 -4055
- package/src/assets/fonts/UberMove/UberMove-Regular.ttf +0 -0
- package/src/assets/fonts/UberMove/UberMove-Regular.woff +0 -0
- package/src/assets/fonts/UberMove/UberMove-Regular.woff2 +0 -0
- package/src/assets/img/currency/bitcoin.png +0 -0
- package/src/assets/img/currency/bnb.png +0 -0
- package/src/assets/img/currency/ethereum.jpg +0 -0
- package/src/assets/img/currency/ethereum.png +0 -0
- package/src/assets/img/currency/metamask.png +0 -0
- package/src/assets/img/currency/tether.png +0 -0
- package/src/components/Button/Button.css +0 -29
- package/src/components/Button/Button.jsx +0 -20
- package/src/components/Button/index.js +0 -1
- package/src/components/Metamask/Metamask.css +0 -14
- package/src/components/Metamask/Metamask.jsx +0 -79
- package/src/components/Metamask/index.js +0 -1
- package/src/components/Modal/Modal.css +0 -138
- package/src/components/Modal/Modal.jsx +0 -297
- package/src/components/Modal/index.js +0 -1
- package/src/components/Tabs/Tab.jsx +0 -32
- package/src/components/Tabs/Tabs.css +0 -52
- package/src/components/Tabs/Tabs.jsx +0 -15
- package/src/components/Tabs/index.js +0 -2
- package/src/hooks/index.js +0 -1
- package/src/hooks/useConnect.js +0 -136
- package/src/index.js +0 -6
- package/src/stories/Button.stories.js +0 -25
- package/src/stories/Metamask.stories.js +0 -13
- package/src/stories/Modal.stories.js +0 -23
- package/src/stories/Tabs.stories.js +0 -33
- package/src/translates.json +0 -713
- package/src/utils/WBNB.json +0 -153
- package/src/utils/chainConfig.js +0 -47
- package/storybook-static/0.2ab68c35.iframe.bundle.js +0 -3
- package/storybook-static/0.2ab68c35.iframe.bundle.js.LICENSE.txt +0 -8
- package/storybook-static/0.2ab68c35.iframe.bundle.js.map +0 -1
- package/storybook-static/0.e5489f12ab94aa497491.manager.bundle.js +0 -2
- package/storybook-static/0.e5489f12ab94aa497491.manager.bundle.js.LICENSE.txt +0 -8
- package/storybook-static/1.7d0dd704b26935d06a04.manager.bundle.js +0 -1
- package/storybook-static/1.8c220da3.iframe.bundle.js +0 -3
- package/storybook-static/1.8c220da3.iframe.bundle.js.LICENSE.txt +0 -14
- package/storybook-static/1.8c220da3.iframe.bundle.js.map +0 -1
- package/storybook-static/10.398dd7a0522c1ff2b3a8.manager.bundle.js +0 -1
- package/storybook-static/10.dab4e389.iframe.bundle.js +0 -3
- package/storybook-static/10.dab4e389.iframe.bundle.js.LICENSE.txt +0 -12
- package/storybook-static/10.dab4e389.iframe.bundle.js.map +0 -1
- package/storybook-static/11.e487b823.iframe.bundle.js +0 -1
- package/storybook-static/2.21286279.iframe.bundle.js +0 -1
- package/storybook-static/3.17beddd8.iframe.bundle.js +0 -1
- package/storybook-static/5.23ef655b5acff6eac8ad.manager.bundle.js +0 -1
- package/storybook-static/6.d2f96bcf3b11b0f1a44b.manager.bundle.js +0 -1
- package/storybook-static/7.5ef1ca09.iframe.bundle.js +0 -3
- package/storybook-static/7.5ef1ca09.iframe.bundle.js.LICENSE.txt +0 -31
- package/storybook-static/7.5ef1ca09.iframe.bundle.js.map +0 -1
- package/storybook-static/7.a1c5467faea0833b53d1.manager.bundle.js +0 -1
- package/storybook-static/8.65ec2749796fb05c258c.manager.bundle.js +0 -2
- package/storybook-static/8.65ec2749796fb05c258c.manager.bundle.js.LICENSE.txt +0 -12
- package/storybook-static/8.869413af.iframe.bundle.js +0 -1
- package/storybook-static/9.4080b133.iframe.bundle.js +0 -1
- package/storybook-static/9.acd0ef9064e0667433ac.manager.bundle.js +0 -2
- package/storybook-static/9.acd0ef9064e0667433ac.manager.bundle.js.LICENSE.txt +0 -31
- package/storybook-static/favicon.ico +0 -0
- package/storybook-static/iframe.html +0 -364
- package/storybook-static/index.html +0 -51
- package/storybook-static/main.93d2c8aa127bed373c8a.manager.bundle.js +0 -2
- package/storybook-static/main.93d2c8aa127bed373c8a.manager.bundle.js.LICENSE.txt +0 -54
- package/storybook-static/main.f075035f.iframe.bundle.js +0 -3
- package/storybook-static/main.f075035f.iframe.bundle.js.LICENSE.txt +0 -1
- package/storybook-static/main.f075035f.iframe.bundle.js.map +0 -1
- package/storybook-static/project.json +0 -1
- package/storybook-static/runtime~main.8e5cf3a9715a0d32d390.manager.bundle.js +0 -1
- package/storybook-static/runtime~main.f8e70bd7.iframe.bundle.js +0 -1
- package/storybook-static/static/media/Marcellus-Regular.2fb50c7c.eot +0 -0
- package/storybook-static/static/media/Marcellus-Regular.62064e40.woff +0 -0
- package/storybook-static/static/media/Marcellus-Regular.8ae4aad6.woff2 +0 -0
- package/storybook-static/static/media/Marcellus-Regular.e15056e4.ttf +0 -0
- package/storybook-static/static/media/Marcellus-Regular.e719d450.svg +0 -1966
- package/storybook-static/static/media/Poppins-Regular.387f9003.woff +0 -0
- package/storybook-static/static/media/Poppins-Regular.a20e7b73.eot +0 -0
- package/storybook-static/static/media/Poppins-Regular.ad19729d.woff2 +0 -0
- package/storybook-static/static/media/Poppins-Regular.c533b610.svg +0 -3213
- package/storybook-static/static/media/Poppins-Regular.e09d5cf4.ttf +0 -0
- package/storybook-static/vendors~main.7c47903ea43e951c3707.manager.bundle.js +0 -2
- package/storybook-static/vendors~main.7c47903ea43e951c3707.manager.bundle.js.LICENSE.txt +0 -55
- package/storybook-static/vendors~main.aea8d710.iframe.bundle.js +0 -3
- package/storybook-static/vendors~main.aea8d710.iframe.bundle.js.LICENSE.txt +0 -89
- package/storybook-static/vendors~main.aea8d710.iframe.bundle.js.map +0 -1
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
|
2
|
-
|
|
3
|
-
import "../../assets/css/main-theme.css";
|
|
4
|
-
import "./Tabs.css";
|
|
5
|
-
|
|
6
|
-
export const Tabs = ({ children, customStyles = {} }) => {
|
|
7
|
-
return (
|
|
8
|
-
<div
|
|
9
|
-
className="tabsContainer"
|
|
10
|
-
style={customStyles}
|
|
11
|
-
>
|
|
12
|
-
{children}
|
|
13
|
-
</div>
|
|
14
|
-
);
|
|
15
|
-
};
|
package/src/hooks/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./useConnect.js";
|
package/src/hooks/useConnect.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect, useMemo, useCallback } from "react";
|
|
2
|
-
import Web3 from "web3";
|
|
3
|
-
|
|
4
|
-
import { balanceAbi, networks } from "../utils/chainConfig";
|
|
5
|
-
|
|
6
|
-
export const useConnect = () => {
|
|
7
|
-
const [isMetaMaskInstalled, setIsMetaMaskInstalled] = useState(!!window.ethereum);
|
|
8
|
-
const [isMetaMaskConnected, setIsMetaMaskConnected] = useState(false);
|
|
9
|
-
const [account, setAccount] = useState("");
|
|
10
|
-
const [balance, setBalance] = useState(0);
|
|
11
|
-
const [tokenBalance, setTokenBalance] = useState(0);
|
|
12
|
-
const [chainId, setChainId] = useState(null);
|
|
13
|
-
const [web3, setWeb3] = useState(undefined);
|
|
14
|
-
const [network, setNetwork] = useState(null);
|
|
15
|
-
|
|
16
|
-
const switchNetwork = useCallback(async (params = []) => {
|
|
17
|
-
try {
|
|
18
|
-
if (window.ethereum) {
|
|
19
|
-
await window.ethereum.request({
|
|
20
|
-
method: "wallet_addEthereumChain",
|
|
21
|
-
params: params,
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
// After switching the network, update the chainId state
|
|
25
|
-
const newChainId = await window.ethereum.request({ method: 'eth_chainId' });
|
|
26
|
-
setChainId(newChainId);
|
|
27
|
-
|
|
28
|
-
// Then trigger fetching the updated account data
|
|
29
|
-
getAccountData();
|
|
30
|
-
} else {
|
|
31
|
-
console.log("Can't setup the BSC Testnet on BSC network");
|
|
32
|
-
}
|
|
33
|
-
} catch (error) {
|
|
34
|
-
console.log(error);
|
|
35
|
-
}
|
|
36
|
-
}, []);
|
|
37
|
-
|
|
38
|
-
const disconnect = useCallback(async () => {
|
|
39
|
-
console.log('bla')
|
|
40
|
-
}, []);
|
|
41
|
-
|
|
42
|
-
const connect = useCallback(async (callback) => {
|
|
43
|
-
try {
|
|
44
|
-
const accounts = await window.ethereum.request({ method: "eth_requestAccounts" });
|
|
45
|
-
if (accounts.length > 0) {
|
|
46
|
-
setAccount(accounts[0]);
|
|
47
|
-
setWeb3(new Web3(window.ethereum));
|
|
48
|
-
setIsMetaMaskConnected(true);
|
|
49
|
-
|
|
50
|
-
if (callback) callback();
|
|
51
|
-
}
|
|
52
|
-
} catch (error) {
|
|
53
|
-
console.error("Error connecting to MetaMask:", error);
|
|
54
|
-
}
|
|
55
|
-
}, []);
|
|
56
|
-
|
|
57
|
-
const getAccountData = useCallback(async () => {
|
|
58
|
-
if (!window.ethereum) {
|
|
59
|
-
console.error('MetaMask is not installed');
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
try {
|
|
64
|
-
const balance = await window.ethereum.request({
|
|
65
|
-
method: 'eth_getBalance',
|
|
66
|
-
params: [account, 'latest']
|
|
67
|
-
});
|
|
68
|
-
const balanceInEth = parseFloat(web3.utils.fromWei(balance, 'ether'));
|
|
69
|
-
setBalance(balanceInEth);
|
|
70
|
-
|
|
71
|
-
const chainId = await window.ethereum.request({ method: 'eth_chainId' });
|
|
72
|
-
setChainId(chainId);
|
|
73
|
-
} catch (error) {
|
|
74
|
-
console.error('Error getting balance:', error);
|
|
75
|
-
}
|
|
76
|
-
}, [account, web3]);
|
|
77
|
-
|
|
78
|
-
const getTokenBalance = useCallback(async (chainId, token) => {
|
|
79
|
-
const network = networks.find(network => network.chainId === chainId);
|
|
80
|
-
|
|
81
|
-
const tokenContract = new web3.eth.Contract(balanceAbi, network?.tokens[token]?.address);
|
|
82
|
-
const tokenBalanceInWei = await tokenContract.methods.balanceOf(account).call();
|
|
83
|
-
const tokenBalance = web3.utils.fromWei(tokenBalanceInWei, 'ether');
|
|
84
|
-
|
|
85
|
-
setTokenBalance(tokenBalance);
|
|
86
|
-
setNetwork(network);
|
|
87
|
-
}, [chainId]);
|
|
88
|
-
|
|
89
|
-
useEffect(() => {
|
|
90
|
-
if (window.ethereum) {
|
|
91
|
-
setIsMetaMaskInstalled(true);
|
|
92
|
-
|
|
93
|
-
if (window.ethereum.selectedAddress) {
|
|
94
|
-
setIsMetaMaskConnected(true);
|
|
95
|
-
setAccount(window.ethereum.selectedAddress);
|
|
96
|
-
setWeb3(new Web3(window.ethereum));
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}, []);
|
|
100
|
-
|
|
101
|
-
useEffect(() => {
|
|
102
|
-
if (isMetaMaskConnected) {
|
|
103
|
-
getAccountData();
|
|
104
|
-
}
|
|
105
|
-
}, [isMetaMaskConnected, getAccountData]);
|
|
106
|
-
|
|
107
|
-
return useMemo(() => ({
|
|
108
|
-
connect,
|
|
109
|
-
switchNetwork,
|
|
110
|
-
getAccountData,
|
|
111
|
-
disconnect,
|
|
112
|
-
getTokenBalance,
|
|
113
|
-
account,
|
|
114
|
-
chainId,
|
|
115
|
-
web3,
|
|
116
|
-
isMetaMaskConnected,
|
|
117
|
-
isMetaMaskInstalled,
|
|
118
|
-
balance,
|
|
119
|
-
tokenBalance,
|
|
120
|
-
network
|
|
121
|
-
}), [
|
|
122
|
-
connect,
|
|
123
|
-
switchNetwork,
|
|
124
|
-
getAccountData,
|
|
125
|
-
disconnect,
|
|
126
|
-
getTokenBalance,
|
|
127
|
-
account,
|
|
128
|
-
chainId,
|
|
129
|
-
web3,
|
|
130
|
-
isMetaMaskConnected,
|
|
131
|
-
isMetaMaskInstalled,
|
|
132
|
-
balance,
|
|
133
|
-
tokenBalance,
|
|
134
|
-
network
|
|
135
|
-
]);
|
|
136
|
-
};
|
package/src/index.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { storiesOf } from "@storybook/react";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
|
|
4
|
-
import { Button } from "../components/Button";
|
|
5
|
-
|
|
6
|
-
const stories = storiesOf("UI", module);
|
|
7
|
-
|
|
8
|
-
stories.add("Button", () => {
|
|
9
|
-
let customStyles = {};
|
|
10
|
-
let label = "Confirm";
|
|
11
|
-
let type = "secondary";
|
|
12
|
-
|
|
13
|
-
const handleClick = () => {
|
|
14
|
-
console.log('clicked');
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<Button
|
|
19
|
-
onClick={handleClick}
|
|
20
|
-
customStyles={customStyles}
|
|
21
|
-
label={label}
|
|
22
|
-
type={type}
|
|
23
|
-
/>
|
|
24
|
-
);
|
|
25
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { storiesOf } from "@storybook/react";
|
|
2
|
-
|
|
3
|
-
import { Metamask } from "../components/Metamask";
|
|
4
|
-
|
|
5
|
-
const stories = storiesOf("Metamask", module);
|
|
6
|
-
|
|
7
|
-
stories.add("Metamask", () => {
|
|
8
|
-
return (
|
|
9
|
-
<Metamask
|
|
10
|
-
projectId="93d309807f3d585261a4f8ea64f800a5"
|
|
11
|
-
/>
|
|
12
|
-
);
|
|
13
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { storiesOf } from "@storybook/react";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
|
|
4
|
-
import { Modal } from "../components/Modal";
|
|
5
|
-
|
|
6
|
-
const stories = storiesOf("UI", module);
|
|
7
|
-
|
|
8
|
-
stories.add("Modal", () => {
|
|
9
|
-
let customStyles = {};
|
|
10
|
-
let label = "Choose your payment method";
|
|
11
|
-
|
|
12
|
-
const handleClick = () => {
|
|
13
|
-
console.log('clicked modal');
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<Modal
|
|
18
|
-
onClick={handleClick}
|
|
19
|
-
customStyles={customStyles}
|
|
20
|
-
label={label}
|
|
21
|
-
/>
|
|
22
|
-
);
|
|
23
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { storiesOf } from "@storybook/react";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
|
|
4
|
-
import { Tab, Tabs } from "../components/Tabs";
|
|
5
|
-
|
|
6
|
-
const stories = storiesOf("UI", module);
|
|
7
|
-
|
|
8
|
-
stories.add("Tab", () => {
|
|
9
|
-
const [active, setActive] = useState(true);
|
|
10
|
-
|
|
11
|
-
const tabsData = [
|
|
12
|
-
{
|
|
13
|
-
label: "BTC"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
label: "ETH"
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
label: "USDT"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
label: "BNB"
|
|
23
|
-
}
|
|
24
|
-
];
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<Tabs>
|
|
28
|
-
{tabsData && tabsData.map((item, index) => {
|
|
29
|
-
return <Tab key={index} label={item?.label} />
|
|
30
|
-
})}
|
|
31
|
-
</Tabs>
|
|
32
|
-
);
|
|
33
|
-
});
|