@ape.swap/bonds-sdk 1.0.407 → 1.0.409
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/components/Bonds/Bonds.js +2 -1
- package/dist/components/ConnectWallet/ConnectWalletModal.d.ts +5 -0
- package/dist/components/ConnectWallet/ConnectWalletModal.js +58 -0
- package/dist/components/ConnectWallet/components/AllWallets.d.ts +6 -0
- package/dist/components/ConnectWallet/components/AllWallets.js +21 -0
- package/dist/components/ConnectWallet/components/PrioritizedWallets.d.ts +7 -0
- package/dist/components/ConnectWallet/components/PrioritizedWallets.js +23 -0
- package/dist/components/ConnectWallet/components/WalletCard.d.ts +8 -0
- package/dist/components/ConnectWallet/components/WalletCard.js +39 -0
- package/dist/components/ConnectWallet/components/styles.d.ts +3 -0
- package/dist/components/ConnectWallet/components/styles.js +108 -0
- package/dist/components/ConnectWallet/config.d.ts +3 -0
- package/dist/components/ConnectWallet/config.js +70 -0
- package/dist/components/ConnectWallet/index.d.ts +5 -0
- package/dist/components/ConnectWallet/index.js +21 -0
- package/dist/components/ConnectWallet/types.d.ts +8 -0
- package/dist/components/ConnectWallet/types.js +1 -0
- package/dist/components/uikit-sdk/Modal/ModalFooter.d.ts +4 -0
- package/dist/components/uikit-sdk/Modal/ModalFooter.js +32 -0
- package/dist/components/uikit-sdk/Modal/ModalHeader.d.ts +4 -0
- package/dist/components/uikit-sdk/Modal/ModalHeader.js +31 -0
- package/dist/components/uikit-sdk/Modal/index.d.ts +4 -0
- package/dist/components/uikit-sdk/Modal/index.js +46 -0
- package/dist/components/uikit-sdk/Modal/styles.d.ts +3 -0
- package/dist/components/uikit-sdk/Modal/styles.js +62 -0
- package/dist/components/uikit-sdk/Modal/types.d.ts +17 -0
- package/dist/components/uikit-sdk/Modal/types.js +1 -0
- package/dist/components/uikit-sdk/index.d.ts +1 -0
- package/dist/components/uikit-sdk/index.js +1 -0
- package/dist/state/global/actions.d.ts +1 -0
- package/dist/state/global/actions.js +4 -0
- package/dist/state/user/reducer.d.ts +21 -0
- package/dist/state/user/reducer.js +107 -0
- package/dist/state/user/types.d.ts +10 -0
- package/dist/state/user/types.js +24 -0
- package/dist/utils/connection/activate.d.ts +3 -0
- package/dist/utils/connection/activate.js +61 -0
- package/dist/utils/connection/index.d.ts +9 -0
- package/dist/utils/connection/index.js +83 -0
- package/dist/utils/connection/types.d.ts +14 -0
- package/dist/utils/connection/types.js +8 -0
- package/dist/utils/connection/utils.d.ts +8 -0
- package/dist/utils/connection/utils.js +46 -0
- package/dist/utils/track.d.ts +7 -0
- package/dist/utils/track.js +17 -0
- package/package.json +9 -6
|
@@ -75,6 +75,7 @@ import { TooltipBubble, Svg } from '../uikit-sdk';
|
|
|
75
75
|
import Tooltip from '../Tooltip/Tooltip';
|
|
76
76
|
import { BLOCK_EXPLORER } from '../../config/constants/chains';
|
|
77
77
|
import TokenInfoAndName from '../TokenInfoAndName';
|
|
78
|
+
import ConnectWalletButton from '../ConnectWallet';
|
|
78
79
|
var Bonds = function (_a) {
|
|
79
80
|
var connectionString = _a.connectionString;
|
|
80
81
|
var _b = useWeb3React(), account = _b.account, isActive = _b.isActive;
|
|
@@ -244,7 +245,7 @@ var Bonds = function (_a) {
|
|
|
244
245
|
var vestingDays = vestingTime(bond.vestingTerm).days;
|
|
245
246
|
return parseFloat((((discount * 365) / vestingDays).toFixed(2)));
|
|
246
247
|
};
|
|
247
|
-
return (_jsxs(ThemeUIProvider, __assign({ theme: defaultTheme }, { children: [isActive && account && _jsx("p", { children: account }), isActive && account && _jsx("button", __assign({ onClick: handleApprove }, { children: "Approve USDT" })), _jsxs(Flex, __assign({ className: "container table-container" }, { children: [_jsxs(Flex, __assign({ className: "container header-container" }, { children: [_jsxs(Flex, __assign({ className: "column column-tokens" }, { children: [_jsx(Flex, __assign({ className: "column column-tokeninfoname" }, { children: "Tokens" })), _jsx(Flex, { className: "column column-tokenicons" })] })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_jsxs(Flex, __assign({ className: "column column-discount" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.Discount }), width: "230px", placement: "bottomLeft", transformTip: "translate(18%, -4%)" }, { children: ["Discount", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }))] })) })), _jsx(Flex, __assign({ className: "column header-icon", onClick: function () { return handleSort('discount'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsxs(Flex, __assign({ className: "column column-arr" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.ARR }), width: "230px", placement: "bottomLeft", transformTip: "translate(8%, -5%)" }, { children: ["ARR", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }))] })) })), _jsx(Flex, __assign({ className: "column header-icon", onClick: function () { return handleSort('arr'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsxs(Flex, __assign({ className: "column column-terms" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.Terms }), width: "230px", placement: "bottomRight", transformTip: "translate(11%, -5%)" }, { children: ["Terms", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }))] })) })), _jsx(Flex, __assign({ className: "column header-icon", onClick: function () { return handleSort('terms'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsxs(Flex, __assign({ className: "column column-tokensremaining" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.TokensRemaining }), width: "230px", placement: "bottomRight", transformTip: "translate(12%, -4%)" }, { children: ["Tokens Remaining", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }))] })) })), _jsx(Flex, __assign({ className: "column header-icon", onClick: function () { return handleSort('tokensRemaining'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsx(Flex, { className: "column column-hotbond" })] }))] })), sortedBonds.map(function (bond) {
|
|
248
|
+
return (_jsxs(ThemeUIProvider, __assign({ theme: defaultTheme }, { children: [_jsx(ConnectWalletButton, {}), isActive && account && _jsx("p", { children: account }), isActive && account && _jsx("button", __assign({ onClick: handleApprove }, { children: "Approve USDT" })), _jsxs(Flex, __assign({ className: "container table-container" }, { children: [_jsxs(Flex, __assign({ className: "container header-container" }, { children: [_jsxs(Flex, __assign({ className: "column column-tokens" }, { children: [_jsx(Flex, __assign({ className: "column column-tokeninfoname" }, { children: "Tokens" })), _jsx(Flex, { className: "column column-tokenicons" })] })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_jsxs(Flex, __assign({ className: "column column-discount" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.Discount }), width: "230px", placement: "bottomLeft", transformTip: "translate(18%, -4%)" }, { children: ["Discount", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }))] })) })), _jsx(Flex, __assign({ className: "column header-icon", onClick: function () { return handleSort('discount'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsxs(Flex, __assign({ className: "column column-arr" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.ARR }), width: "230px", placement: "bottomLeft", transformTip: "translate(8%, -5%)" }, { children: ["ARR", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }))] })) })), _jsx(Flex, __assign({ className: "column header-icon", onClick: function () { return handleSort('arr'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsxs(Flex, __assign({ className: "column column-terms" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.Terms }), width: "230px", placement: "bottomRight", transformTip: "translate(11%, -5%)" }, { children: ["Terms", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }))] })) })), _jsx(Flex, __assign({ className: "column header-icon", onClick: function () { return handleSort('terms'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsxs(Flex, __assign({ className: "column column-tokensremaining" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.TokensRemaining }), width: "230px", placement: "bottomRight", transformTip: "translate(12%, -4%)" }, { children: ["Tokens Remaining", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }))] })) })), _jsx(Flex, __assign({ className: "column header-icon", onClick: function () { return handleSort('tokensRemaining'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsx(Flex, { className: "column column-hotbond" })] }))] })), sortedBonds.map(function (bond) {
|
|
248
249
|
var _a, _b, _c, _d;
|
|
249
250
|
return (_jsxs(Flex, __assign({ className: "container bondrow-container", onClick: function () { return rowClick(bond); } }, { children: [_jsxs(Flex, __assign({ className: "column column-tokens" }, { children: [_jsx(Flex, __assign({ className: "column column-tokeninfoname" }, { children: _jsx(TokenInfoAndName, { bill: bond }) })), _jsx(Flex, __assign({ className: "column column-tokenicons" }, { children: _jsx(TooltipBubble, __assign({ body: _jsx(Tooltip, { tokenContract: (bond === null || bond === void 0 ? void 0 : bond.payoutToken) || '', secondURL: getBillContractURL(bond), secondURLTitle: 'View Bond Contract', thirdURL: "https://dashboard.ape.bond/bond/".concat((_a = bond === null || bond === void 0 ? void 0 : bond.billAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()), thirdURLTitle: 'View Insights', twitter: bond === null || bond === void 0 ? void 0 : bond.twitter, projectLink: bond === null || bond === void 0 ? void 0 : bond.projectLink, audit: bond === null || bond === void 0 ? void 0 : bond.audit, chain: (_b = bond.chainId) !== null && _b !== void 0 ? _b : ChainId.BSC }), width: "205px", placement: "bottomRight", transformTip: "translate(11%, 0%)" }, { children: _jsx(Svg, { icon: "more", width: "20px" }) })) }))] })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_jsx(Flex, __assign({ className: "column column-discount ".concat(getDiscountColor(bond === null || bond === void 0 ? void 0 : bond.discount)) }, { children: "".concat((_c = bond === null || bond === void 0 ? void 0 : bond.discount) === null || _c === void 0 ? void 0 : _c.toFixed(2), "%") })), _jsxs(Flex, __assign({ className: "column column-arr" }, { children: [calculateARR(bond), "%"] })), _jsx(Flex, __assign({ className: "column column-term" }, { children: vestingTime(bond.vestingTerm).days ? "".concat(vestingTime(bond.vestingTerm).days, " D") : '-' })), _jsx(Flex, __assign({ className: "column column-tokensremaining" }, { children: _jsx(ProgressBarWrapper, { title: '', value: _jsx(ProgressBar, { value: remainingPercentage(bond) }), style: {
|
|
250
251
|
width: '127px',
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
13
|
+
import { Flex, Modal, Svg, Text } from '../../components/uikit-sdk';
|
|
14
|
+
import ModalHeader from '../../components/uikit-sdk/Modal/ModalHeader';
|
|
15
|
+
import { AnimatePresence, motion } from 'framer-motion';
|
|
16
|
+
import { useState } from 'react';
|
|
17
|
+
import AllWallets from './components/AllWallets';
|
|
18
|
+
import PrioritizedWallets from './components/PrioritizedWallets';
|
|
19
|
+
var modalProps = {
|
|
20
|
+
sx: {
|
|
21
|
+
maxHeight: 'calc(100% - 30px)',
|
|
22
|
+
height: ['395px', '395px', '395px', '470px'],
|
|
23
|
+
width: ['280px', '280px', '280px', '620px'],
|
|
24
|
+
maxWidth: ['280px', '280px', '280px', '620px'],
|
|
25
|
+
minWidth: ['unset', 'unset', 'unset', '620px'],
|
|
26
|
+
overflow: 'hidden',
|
|
27
|
+
padding: ['20px', '20px', '20px', '30px'],
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
var variants = {
|
|
31
|
+
enter: function (direction) {
|
|
32
|
+
return {
|
|
33
|
+
x: direction > 0 ? 1000 : -1000,
|
|
34
|
+
opacity: 0,
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
center: {
|
|
38
|
+
zIndex: 1,
|
|
39
|
+
x: 0,
|
|
40
|
+
opacity: 1,
|
|
41
|
+
},
|
|
42
|
+
exit: function (direction) {
|
|
43
|
+
return {
|
|
44
|
+
zIndex: 0,
|
|
45
|
+
x: direction < 0 ? 1000 : -1000,
|
|
46
|
+
opacity: 0,
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
var ConnectWalletModal = function (_a) {
|
|
51
|
+
var onDismiss = _a.onDismiss;
|
|
52
|
+
var _b = useState(false), open = _b[0], setOpen = _b[1];
|
|
53
|
+
return (_jsxs(Modal, __assign({}, modalProps, { children: [_jsx(ModalHeader, __assign({}, { sx: { height: '24px' } }, { hideDivider: true }, { children: open && (_jsxs(Flex, __assign({ sx: { width: '100%' } }, { children: [_jsxs(Flex, __assign({ onClick: function () { return setOpen(false); }, sx: { '&:hover': { cursor: 'pointer' } } }, { children: [_jsx(Svg, { icon: "caret", direction: "left" }), _jsx(Text, __assign({ sx: { fontWeight: 700, ml: '5px', fontSize: '14px' } }, { children: "Back" }))] })), _jsx(Flex, __assign({ sx: { alignItems: 'center', justifyContent: 'center', width: '100%' } }, { children: _jsx(Text, __assign({ weight: 700 }, { children: "Connect Wallet" })) }))] }))) })), _jsx(Flex, __assign({ sx: { height: '400px', flexDirection: 'column' } }, { children: _jsx(AnimatePresence, __assign({ initial: false }, { children: _jsx(motion.div, __assign({ custom: open ? 1 : -1, variants: variants, initial: "enter", animate: "center", exit: "exit", transition: {
|
|
54
|
+
x: { type: 'spring', stiffness: 300, damping: 30 },
|
|
55
|
+
opacity: { duration: 0.2 },
|
|
56
|
+
}, drag: "x", dragConstraints: { left: 0, right: 0 }, dragElastic: 1, sx: { width: '100%' } }, { children: !open ? (_jsx(PrioritizedWallets, { setOpen: setOpen, onDismiss: onDismiss })) : (_jsx(AllWallets, { onDismiss: onDismiss })) }), open ? 'wallets' : 'connect') })) }))] })));
|
|
57
|
+
};
|
|
58
|
+
export default ConnectWalletModal;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
13
|
+
import { Flex } from '../../uikit-sdk';
|
|
14
|
+
import config from '../config';
|
|
15
|
+
import WalletCard from './WalletCard';
|
|
16
|
+
import styles from './styles';
|
|
17
|
+
var AllWallets = function (_a) {
|
|
18
|
+
var onDismiss = _a.onDismiss;
|
|
19
|
+
return (_jsx(Flex, __assign({ sx: styles.allWalletsContainer }, { children: _jsx(Flex, __assign({ sx: styles.cardsContainer }, { children: config.map(function (entry) { return (_jsx(WalletCard, { walletConfig: entry, onDismiss: onDismiss }, entry.label)); }) })) })));
|
|
20
|
+
};
|
|
21
|
+
export default AllWallets;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
13
|
+
import WalletCard from './WalletCard';
|
|
14
|
+
import config from '../config';
|
|
15
|
+
import { Button, Flex, Svg, Text } from '../../uikit-sdk';
|
|
16
|
+
import styles from './styles';
|
|
17
|
+
import { Link } from 'theme-ui';
|
|
18
|
+
var PrioritizedWallets = function (_a) {
|
|
19
|
+
var setOpen = _a.setOpen, onDismiss = _a.onDismiss;
|
|
20
|
+
var showWallets = config.slice(0, 3);
|
|
21
|
+
return (_jsxs(Flex, __assign({ sx: styles.prioritizedContainer }, { children: [_jsxs(Flex, __assign({ sx: { flexWrap: 'wrap', width: '100%' } }, { children: [_jsx(Flex, __assign({ sx: { display: ['none', 'none', 'none', 'flex'] } }, { children: _jsx(Svg, { icon: "walletImage" }) })), _jsxs(Flex, __assign({ sx: styles.infoContainer }, { children: [_jsx(Flex, __assign({ sx: { width: '100%' } }, { children: _jsx(Text, __assign({ sx: styles.title }, { children: "Connect Wallet" })) })), _jsx(Text, __assign({ sx: styles.firstStep }, { children: "Start by connecting with one of the wallets below. Be sure to store your private keys or seed phrase securely. Never share them with anyone." })), _jsx(Text, __assign({ sx: { fontSize: '12px', fontWeight: 300 } }, { children: _jsxs(Link, __assign({ href: "https://docs.ape.bond/apebond/products-and-features/wallets/how-to-connect-your-wallet", target: "_blank", color: "text", sx: styles.learnHow }, { children: [_jsx(Text, __assign({ mr: "5px" }, { children: "Learn how to connect" })), _jsx(Svg, { icon: "external" })] })) }))] }))] })), _jsxs(Flex, __assign({ sx: styles.buttonsContainer }, { children: [showWallets.map(function (entry) { return (_jsx(WalletCard, { walletConfig: entry, onDismiss: onDismiss }, entry.label)); }), _jsxs(Button, __assign({ sx: __assign(__assign({}, styles.button), { background: 'white4', '&:hover': { background: 'white3' }, border: 'none', '&:hover:not([disabled])': { background: 'white3' } }), onClick: function () { return setOpen(true); } }, { children: [_jsx(Flex, __assign({ sx: { height: ['45px', '45px', '45px', '65px'], alignItems: 'flex-end' } }, { children: _jsx(Flex, __assign({ sx: __assign(__assign({}, styles.moreWallets), { background: 'primaryButtonDisable' }) }, { children: _jsx(Flex, __assign({ sx: { lineHeight: ['24px', '24px', '24px', '40px'], fontWeight: [700, 700, 700, 900] } }, { children: ". . ." })) })) })), _jsx(Flex, __assign({ sx: { height: ['39px', '39px', '39px', '49px'], alignItems: 'center' } }, { children: _jsx(Text, __assign({ sx: styles.walletName }, { children: "MORE" })) }))] }))] }))] })));
|
|
22
|
+
};
|
|
23
|
+
export default PrioritizedWallets;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
13
|
+
import { Button, Flex, Svg, Text } from '../../uikit-sdk';
|
|
14
|
+
import { updateSelectedWallet } from '../../../state/user/reducer';
|
|
15
|
+
import useActivate from '../../../utils/connection/activate';
|
|
16
|
+
import styles from './styles';
|
|
17
|
+
import track from '../../../utils/track';
|
|
18
|
+
import { useWeb3React } from '@web3-react/core';
|
|
19
|
+
var WalletCard = function (_a) {
|
|
20
|
+
var walletConfig = _a.walletConfig, onDismiss = _a.onDismiss;
|
|
21
|
+
var title = walletConfig.label, icon = walletConfig.icon, connection = walletConfig.connection;
|
|
22
|
+
var activate = useActivate();
|
|
23
|
+
var chainId = useWeb3React().chainId;
|
|
24
|
+
var handleConnect = function () {
|
|
25
|
+
activate(connection).then(function () {
|
|
26
|
+
track({
|
|
27
|
+
event: 'wallet_connect',
|
|
28
|
+
chain: chainId,
|
|
29
|
+
data: {
|
|
30
|
+
wallet: title,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
updateSelectedWallet({ wallet: connection.type });
|
|
35
|
+
onDismiss();
|
|
36
|
+
};
|
|
37
|
+
return (_jsxs(Button, __assign({ variant: "tertiary", onClick: handleConnect, sx: styles.button, id: "wallet-connect-".concat(title === null || title === void 0 ? void 0 : title.toLocaleLowerCase()) }, { children: [_jsx(Flex, __assign({ sx: styles.iconContainer }, { children: _jsx(Svg, { icon: icon }) })), _jsx(Flex, __assign({ sx: { height: ['39px', '39px', '39px', '49px'], alignItems: 'center' } }, { children: _jsx(Text, __assign({ sx: styles.walletName }, { children: title })) }))] })));
|
|
38
|
+
};
|
|
39
|
+
export default WalletCard;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ThemeUIStyleObject } from 'theme-ui';
|
|
2
|
+
declare const styles: Record<'allWalletsContainer' | 'title' | 'smallTitle' | 'cardsContainer' | 'prioritizedContainer' | 'infoContainer' | 'firstStep' | 'learnHow' | 'buttonsContainer' | 'button' | 'moreWallets' | 'walletName' | 'iconContainer', ThemeUIStyleObject>;
|
|
3
|
+
export default styles;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
var styles = {
|
|
2
|
+
allWalletsContainer: {
|
|
3
|
+
flexWrap: 'wrap',
|
|
4
|
+
position: 'absolute',
|
|
5
|
+
width: '100%',
|
|
6
|
+
maxWidth: ['240px', '240px', '240px', '580px'],
|
|
7
|
+
flexDirection: 'column',
|
|
8
|
+
justifyContent: 'space-between',
|
|
9
|
+
height: ['325px', '325px', '325px', '390px'],
|
|
10
|
+
overflow: 'hidden',
|
|
11
|
+
},
|
|
12
|
+
title: {
|
|
13
|
+
fontSize: ['16px', '16px', '16px', '25px'],
|
|
14
|
+
fontWeight: 700,
|
|
15
|
+
lineHeight: ['24px', '24px', '24px', '37.5px'],
|
|
16
|
+
mt: ['', '', '', '10px'],
|
|
17
|
+
},
|
|
18
|
+
smallTitle: {
|
|
19
|
+
fontSize: ['12px', '12px', '12px', '16px'],
|
|
20
|
+
fontWeight: 700,
|
|
21
|
+
lineHeight: '24px',
|
|
22
|
+
position: 'absolute',
|
|
23
|
+
right: '240px',
|
|
24
|
+
display: ['none', 'none', 'none', 'block'],
|
|
25
|
+
},
|
|
26
|
+
cardsContainer: {
|
|
27
|
+
flexDirection: 'row',
|
|
28
|
+
flexWrap: 'wrap',
|
|
29
|
+
justifyContent: ['space-between', 'space-between', 'space-between', 'flex-start'],
|
|
30
|
+
mt: '15px',
|
|
31
|
+
mb: '-15px',
|
|
32
|
+
alignItems: 'flex-start',
|
|
33
|
+
maxHeight: ['300px', '300px', '300px', '372px'],
|
|
34
|
+
overflowY: 'auto',
|
|
35
|
+
width: ['240px', '240px', '240px', '563px'],
|
|
36
|
+
'&::-webkit-scrollbar, -ms-overflow-style': { width: '3px' },
|
|
37
|
+
'&::-webkit-scrollbar-track': { boxShadow: 'inset 0 0 2px #4d4040' },
|
|
38
|
+
},
|
|
39
|
+
prioritizedContainer: {
|
|
40
|
+
flexWrap: 'wrap',
|
|
41
|
+
position: 'absolute',
|
|
42
|
+
width: '100%',
|
|
43
|
+
maxWidth: ['240px', '240px', '240px', '563px'],
|
|
44
|
+
},
|
|
45
|
+
infoContainer: {
|
|
46
|
+
flexWrap: 'wrap',
|
|
47
|
+
width: ['100%', '100%', '100%', '50%'],
|
|
48
|
+
flexDirection: 'column',
|
|
49
|
+
height: ['132px', '132px', '132px', 'unset'],
|
|
50
|
+
},
|
|
51
|
+
firstStep: {
|
|
52
|
+
fontSize: ['12px', '12px', '12px', '16px'],
|
|
53
|
+
fontWeight: 500,
|
|
54
|
+
lineHeight: ['14px', '14px', '14px', '24px'],
|
|
55
|
+
mt: ['5px', '5px', '5px', '10px'],
|
|
56
|
+
},
|
|
57
|
+
learnHow: {
|
|
58
|
+
display: 'flex',
|
|
59
|
+
mt: ['5px', '5px', '5px', '5px'],
|
|
60
|
+
textDecoration: 'underline',
|
|
61
|
+
'& svg': { width: '9px' },
|
|
62
|
+
},
|
|
63
|
+
buttonsContainer: {
|
|
64
|
+
flexDirection: 'row',
|
|
65
|
+
flexWrap: 'wrap',
|
|
66
|
+
justifyContent: 'space-between',
|
|
67
|
+
alignItems: 'flex-start',
|
|
68
|
+
minWidth: ['240px', '240px', '240px', '560px'],
|
|
69
|
+
mt: ['15px', '15px', '15px', '30px'],
|
|
70
|
+
},
|
|
71
|
+
button: {
|
|
72
|
+
alignItems: 'center',
|
|
73
|
+
justifyContent: 'center',
|
|
74
|
+
width: ['108px', '108px', '108px', '128px'],
|
|
75
|
+
flexDirection: 'column',
|
|
76
|
+
minHeight: ['84px', '84px', '84px', '114px'],
|
|
77
|
+
mb: '15px',
|
|
78
|
+
mr: ['5px', '5px', '5px', '15px'],
|
|
79
|
+
padding: '0 9px',
|
|
80
|
+
background: 'white3',
|
|
81
|
+
fontSize: ['12px', '12px', '12px', '16px'],
|
|
82
|
+
':nth-of-type(4n)': { mr: ['', '', '', '0px'] },
|
|
83
|
+
':nth-last-of-type(-n+2)': {
|
|
84
|
+
mb: '0px',
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
moreWallets: {
|
|
88
|
+
borderRadius: '25px',
|
|
89
|
+
opacity: 0.9,
|
|
90
|
+
width: ['30px', '30px', '30px', '50px'],
|
|
91
|
+
height: ['30px', '30px', '30px', '50px'],
|
|
92
|
+
alignItems: 'flex-start',
|
|
93
|
+
color: 'white1',
|
|
94
|
+
justifyContent: 'center',
|
|
95
|
+
},
|
|
96
|
+
walletName: {
|
|
97
|
+
lineHeight: ['14px', '14px', '14px', '16px'],
|
|
98
|
+
fontSize: ['12px', '12px', '12px', '14px'],
|
|
99
|
+
fontWeight: 700,
|
|
100
|
+
color: 'text',
|
|
101
|
+
},
|
|
102
|
+
iconContainer: {
|
|
103
|
+
height: ['45px', '45px', '45px', '65px'],
|
|
104
|
+
alignItems: 'flex-end',
|
|
105
|
+
width: ['32px', '32px', '32px', '50px'],
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
export default styles;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { icons } from '../uikit-sdk/Svg/types';
|
|
2
|
+
import { coinbaseWalletConnection, injectedConnection, walletConnectConnection } from '../../utils/connection';
|
|
3
|
+
var connectors = [
|
|
4
|
+
{
|
|
5
|
+
label: 'Metamask',
|
|
6
|
+
icon: icons.METAMASK,
|
|
7
|
+
connection: injectedConnection,
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
label: 'TrustWallet',
|
|
11
|
+
icon: icons.TRUST_WALLET,
|
|
12
|
+
connection: injectedConnection,
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
label: 'Wallet Connect',
|
|
16
|
+
icon: icons.WALLET_CONNECT,
|
|
17
|
+
connection: walletConnectConnection,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
label: 'Bitget Wallet',
|
|
21
|
+
icon: icons.BITKEEP,
|
|
22
|
+
connection: injectedConnection,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
label: 'TokenPocket',
|
|
26
|
+
icon: icons.TOKEN_POCKET,
|
|
27
|
+
connection: injectedConnection,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
label: 'SafePal Wallet',
|
|
31
|
+
icon: icons.SAFE_PAL_WALLET,
|
|
32
|
+
connection: injectedConnection,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
label: 'Brave Wallet',
|
|
36
|
+
icon: icons.BRAVE,
|
|
37
|
+
connection: injectedConnection,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: 'Coinbase Wallet',
|
|
41
|
+
icon: icons.COINBASE,
|
|
42
|
+
connection: coinbaseWalletConnection,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
label: 'NABOX Wallet',
|
|
46
|
+
icon: icons.NABOX,
|
|
47
|
+
connection: injectedConnection,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
label: 'ONTO Wallet',
|
|
51
|
+
icon: icons.ONTO_WALLET,
|
|
52
|
+
connection: injectedConnection,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
label: 'MathWallet',
|
|
56
|
+
icon: icons.MATH_WALLET,
|
|
57
|
+
connection: injectedConnection,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
label: 'OKX Wallet',
|
|
61
|
+
icon: icons.OKX,
|
|
62
|
+
connection: injectedConnection,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
label: 'Madwallet',
|
|
66
|
+
icon: icons.MAD_WALLET,
|
|
67
|
+
connection: injectedConnection,
|
|
68
|
+
},
|
|
69
|
+
];
|
|
70
|
+
export default connectors;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
13
|
+
import { Button, Flex, Text } from '../../components/uikit-sdk';
|
|
14
|
+
import useModal from '../../hooks/useModal';
|
|
15
|
+
import ConnectWalletModal from './ConnectWalletModal';
|
|
16
|
+
var ConnectWalletButton = function (_a) {
|
|
17
|
+
var navBarFlag = _a.navBarFlag;
|
|
18
|
+
var onPresentWalletConnectModal = useModal(_jsx(ConnectWalletModal, { onDismiss: function () { return null; } }), true, true, 'ConnectWalletModal')[0];
|
|
19
|
+
return (_jsx(Flex, __assign({ sx: { height: '100%', width: navBarFlag ? 'auto' : '100%', alignItems: 'center' } }, { children: _jsx(Button, __assign({ fullWidth: true, onClick: onPresentWalletConnectModal, sx: { height: navBarFlag ? '32.5px' : '45px', padding: '10px 10px', alignItems: 'center' } }, { children: _jsx(Text, __assign({ color: "primaryBright", size: navBarFlag ? '14px' : '16px', weight: navBarFlag ? 600 : 700, sx: { mt: '1px' } }, { children: 'Connect' })) })) })));
|
|
20
|
+
};
|
|
21
|
+
export default ConnectWalletButton;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { icons } from '../../components/uikit-sdk/Svg/types';
|
|
2
|
+
import { Connection, ConnectionType } from '../../utils/connection/types';
|
|
3
|
+
export type Login = (connectorId: ConnectionType) => void;
|
|
4
|
+
export interface Config {
|
|
5
|
+
label: string;
|
|
6
|
+
icon: icons;
|
|
7
|
+
connection: Connection;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
13
|
+
import { useContext } from 'react';
|
|
14
|
+
import { Flex } from 'theme-ui';
|
|
15
|
+
import styles from './styles';
|
|
16
|
+
import Text from '../Text';
|
|
17
|
+
import { Context as ModalContext } from '../../../contexts/ModalContext';
|
|
18
|
+
var ModalFooter = function (_a) {
|
|
19
|
+
var children = _a.children, onDismiss = _a.onDismiss, t = _a.t;
|
|
20
|
+
var handleClose = useContext(ModalContext).handleClose;
|
|
21
|
+
var onClose = function () {
|
|
22
|
+
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
23
|
+
handleClose();
|
|
24
|
+
};
|
|
25
|
+
return (_jsxs(Flex, __assign({ sx: styles.modalFooter }, { children: [children, _jsx(Text, __assign({ onClick: onClose, sx: {
|
|
26
|
+
textDecoration: 'underline',
|
|
27
|
+
color: 'text',
|
|
28
|
+
cursor: 'pointer',
|
|
29
|
+
fontSize: '16px',
|
|
30
|
+
} }, { children: t ? t('Cancel') : 'Cancel' }))] })));
|
|
31
|
+
};
|
|
32
|
+
export default ModalFooter;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "theme-ui/jsx-runtime";
|
|
24
|
+
import { Divider, Flex } from 'theme-ui';
|
|
25
|
+
import style from './styles';
|
|
26
|
+
import { IconButton } from '../Button';
|
|
27
|
+
var ModalHeader = function (_a) {
|
|
28
|
+
var children = _a.children, onDismiss = _a.onDismiss, hideDivider = _a.hideDivider, props = __rest(_a, ["children", "onDismiss", "hideDivider"]);
|
|
29
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Flex, __assign({}, props, { sx: style.modalHead }, { children: [children, onDismiss && _jsx(IconButton, { icon: "close", color: "text", variant: "transparent", onClick: onDismiss })] })), !hideDivider && _jsx(Divider, {})] }));
|
|
30
|
+
};
|
|
31
|
+
export default ModalHeader;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
24
|
+
import { useContext } from 'react';
|
|
25
|
+
import { Box } from 'theme-ui';
|
|
26
|
+
import { AnimatePresence, motion } from 'framer-motion';
|
|
27
|
+
import style from './styles';
|
|
28
|
+
import ModalHeader from './ModalHeader';
|
|
29
|
+
import { Context as ModalContext } from '../../../contexts/ModalContext';
|
|
30
|
+
import Text from '../Text';
|
|
31
|
+
var Modal = function (_a) {
|
|
32
|
+
var children = _a.children, onDismiss = _a.onDismiss, _b = _a.open, open = _b === void 0 ? true : _b, title = _a.title, _c = _a.zIndex, zIndex = _c === void 0 ? 'modal' : _c, onAnimationComplete = _a.onAnimationComplete, backdrop = _a.backdrop, props = __rest(_a, ["children", "onDismiss", "open", "title", "zIndex", "onAnimationComplete", "backdrop"]);
|
|
33
|
+
var handleClose = useContext(ModalContext).handleClose;
|
|
34
|
+
var onClose = onDismiss || handleClose;
|
|
35
|
+
return (_jsxs(Box, __assign({ id: title, sx: { zIndex: zIndex } }, { children: [_jsx(AnimatePresence, { children: open && (_jsxs(motion.div, __assign({ initial: {
|
|
36
|
+
opacity: 0,
|
|
37
|
+
transform: 'translate(-50%, -50%) scale(0.1)',
|
|
38
|
+
}, animate: {
|
|
39
|
+
opacity: 1,
|
|
40
|
+
transform: 'translate(-50%, -50%) scale(1.0)',
|
|
41
|
+
}, transition: {
|
|
42
|
+
opacity: { duration: 0.2 },
|
|
43
|
+
transform: { duration: 0.2 },
|
|
44
|
+
}, exit: { opacity: 0, transform: 'translate(-50%, -50%) scale(0)' } }, props, { sx: __assign(__assign({}, style.container), { zIndex: zIndex }), onAnimationComplete: onAnimationComplete }, { children: [title && (_jsx(ModalHeader, __assign({ onDismiss: onClose }, { children: _jsx(Text, __assign({ sx: { fontSize: '22px', fontWeight: 700, lineHeight: '33px' } }, { children: title })) }))), children] }))) }), open && _jsx(Box, { sx: __assign(__assign({}, style.backdrop), backdrop), onClick: onClose })] })));
|
|
45
|
+
};
|
|
46
|
+
export default Modal;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var styles = {
|
|
2
|
+
container: {
|
|
3
|
+
padding: '20px',
|
|
4
|
+
background: 'white2',
|
|
5
|
+
borderRadius: 'normal',
|
|
6
|
+
color: 'text',
|
|
7
|
+
hr: {
|
|
8
|
+
background: '#DCD9D9',
|
|
9
|
+
},
|
|
10
|
+
position: 'fixed',
|
|
11
|
+
display: 'block',
|
|
12
|
+
top: '50%',
|
|
13
|
+
left: '50%',
|
|
14
|
+
transform: 'translate(-50%, -50%)',
|
|
15
|
+
width: '380px',
|
|
16
|
+
minWidth: ['95%', 'min(360px, 90%)', '320px'],
|
|
17
|
+
overflowY: 'auto',
|
|
18
|
+
maxHeight: 'calc(100% - 30px)',
|
|
19
|
+
maxWidth: '95vw',
|
|
20
|
+
},
|
|
21
|
+
backdrop: {
|
|
22
|
+
position: 'fixed',
|
|
23
|
+
top: 0,
|
|
24
|
+
bottom: 0,
|
|
25
|
+
left: 0,
|
|
26
|
+
right: 0,
|
|
27
|
+
background: 'modalOverlay',
|
|
28
|
+
width: '100%',
|
|
29
|
+
height: '100%',
|
|
30
|
+
zIndex: 100,
|
|
31
|
+
transition: 'all 1s ease',
|
|
32
|
+
},
|
|
33
|
+
modalHead: {
|
|
34
|
+
justifyContent: 'space-between',
|
|
35
|
+
alignItems: 'center',
|
|
36
|
+
svg: {
|
|
37
|
+
fill: 'text',
|
|
38
|
+
marginLeft: 'auto',
|
|
39
|
+
cursor: 'pointer',
|
|
40
|
+
},
|
|
41
|
+
button: {
|
|
42
|
+
ml: 'auto',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
modalFooter: {
|
|
46
|
+
flexDirection: 'column',
|
|
47
|
+
justifyContent: 'center',
|
|
48
|
+
alignItems: 'center',
|
|
49
|
+
pt: 9,
|
|
50
|
+
gap: 4,
|
|
51
|
+
},
|
|
52
|
+
cancelButton: {
|
|
53
|
+
background: 'transparent',
|
|
54
|
+
textDecoration: 'underline',
|
|
55
|
+
color: 'text',
|
|
56
|
+
cursor: 'pointer',
|
|
57
|
+
fontSize: 0,
|
|
58
|
+
fontWeight: 'normal',
|
|
59
|
+
p: 0,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
export default styles;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ThemeUIStyleObject, SxProp } from 'theme-ui';
|
|
3
|
+
export interface InternalProps {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
onDismiss?: () => void;
|
|
6
|
+
onAnimationComplete?: () => void;
|
|
7
|
+
t?: (key: string) => string;
|
|
8
|
+
hideDivider?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface ModalProps extends InternalProps {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
open?: boolean;
|
|
13
|
+
title?: string;
|
|
14
|
+
zIndex?: string | number;
|
|
15
|
+
sx?: ThemeUIStyleObject;
|
|
16
|
+
backdrop?: SxProp['sx'];
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,5 +3,6 @@ export { default as Flex } from './Flex';
|
|
|
3
3
|
export { default as Text } from './Text';
|
|
4
4
|
export { default as Skeleton } from './Skeleton';
|
|
5
5
|
export { default as TooltipBubble } from './TooltipBubble';
|
|
6
|
+
export { default as Modal } from './Modal';
|
|
6
7
|
export { Button, IconButton } from './Button';
|
|
7
8
|
export { Tag, ListTag } from './Tag';
|
|
@@ -4,6 +4,7 @@ export { default as Flex } from './Flex';
|
|
|
4
4
|
export { default as Text } from './Text';
|
|
5
5
|
export { default as Skeleton } from './Skeleton';
|
|
6
6
|
export { default as TooltipBubble } from './TooltipBubble';
|
|
7
|
+
export { default as Modal } from './Modal';
|
|
7
8
|
// Exports
|
|
8
9
|
export { Button, IconButton } from './Button';
|
|
9
10
|
export { Tag, ListTag } from './Tag';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const updateVersion: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SupportedChainId } from '@ape.swap/sdk-core';
|
|
2
|
+
import { ConnectionType } from '../../utils/connection/types';
|
|
3
|
+
import { SerializedToken } from './types';
|
|
4
|
+
export declare const INITIAL_ZAP_SLIPPAGE = 100;
|
|
5
|
+
export interface UserState {
|
|
6
|
+
timestamp: number;
|
|
7
|
+
selectedWallet?: ConnectionType;
|
|
8
|
+
selectedNetwork: SupportedChainId;
|
|
9
|
+
tokens: {
|
|
10
|
+
[chainId: number]: {
|
|
11
|
+
[address: string]: SerializedToken;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
userSlippageTolerance: number;
|
|
15
|
+
userZapSlippage: number;
|
|
16
|
+
favoriteTokens: string[];
|
|
17
|
+
}
|
|
18
|
+
export declare const initialState: UserState;
|
|
19
|
+
export declare const updateSelectedWallet: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "user/updateSelectedWallet">, updateUserSlippageTolerance: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "user/updateUserSlippageTolerance">, updateSelectedNetwork: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "user/updateSelectedNetwork">, addSerializedToken: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "user/addSerializedToken">, updateUserZapSlippageTolerance: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "user/updateUserZapSlippageTolerance">, updateFavoriteTokens: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "user/updateFavoriteTokens">;
|
|
20
|
+
declare const _default: import("redux").Reducer<UserState, import("redux").UnknownAction, UserState>;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var _a;
|
|
13
|
+
import { SupportedChainId } from '@ape.swap/sdk-core';
|
|
14
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
15
|
+
import { updateVersion } from '../global/actions';
|
|
16
|
+
import track from '../../utils/track';
|
|
17
|
+
var currentTimestamp = function () { return new Date().getTime(); };
|
|
18
|
+
export var INITIAL_ZAP_SLIPPAGE = 100;
|
|
19
|
+
export var initialState = {
|
|
20
|
+
timestamp: currentTimestamp(),
|
|
21
|
+
selectedNetwork: SupportedChainId.BSC,
|
|
22
|
+
selectedWallet: undefined,
|
|
23
|
+
userSlippageTolerance: 50,
|
|
24
|
+
userZapSlippage: INITIAL_ZAP_SLIPPAGE,
|
|
25
|
+
tokens: {},
|
|
26
|
+
favoriteTokens: [],
|
|
27
|
+
};
|
|
28
|
+
var userSlice = createSlice({
|
|
29
|
+
name: 'user',
|
|
30
|
+
initialState: initialState,
|
|
31
|
+
reducers: {
|
|
32
|
+
updateSelectedWallet: function (state, _a) {
|
|
33
|
+
var wallet = _a.payload.wallet;
|
|
34
|
+
state.selectedWallet = wallet;
|
|
35
|
+
state.timestamp = currentTimestamp();
|
|
36
|
+
},
|
|
37
|
+
updateSelectedNetwork: function (state, _a) {
|
|
38
|
+
var chainId = _a.payload.chainId;
|
|
39
|
+
state.selectedNetwork = chainId;
|
|
40
|
+
state.timestamp = currentTimestamp();
|
|
41
|
+
},
|
|
42
|
+
updateUserSlippageTolerance: function (state, action) {
|
|
43
|
+
state.userSlippageTolerance = action.payload.userSlippageTolerance;
|
|
44
|
+
state.timestamp = currentTimestamp();
|
|
45
|
+
},
|
|
46
|
+
updateUserZapSlippageTolerance: function (state, action) {
|
|
47
|
+
state.userZapSlippage = action.payload.userZapSlippage;
|
|
48
|
+
state.timestamp = currentTimestamp();
|
|
49
|
+
},
|
|
50
|
+
updateFavoriteTokens: function (state, action) {
|
|
51
|
+
var newFavToken = action.payload.newFavToken;
|
|
52
|
+
if (state.favoriteTokens.includes(newFavToken.toLowerCase())) {
|
|
53
|
+
state.favoriteTokens = state.favoriteTokens.filter(function (token) { return token !== newFavToken.toLowerCase(); });
|
|
54
|
+
track({
|
|
55
|
+
event: 'addFavorite',
|
|
56
|
+
chain: 0,
|
|
57
|
+
data: {
|
|
58
|
+
cat: 'remove',
|
|
59
|
+
bond: newFavToken,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
state.favoriteTokens.push(newFavToken.toLowerCase());
|
|
65
|
+
track({
|
|
66
|
+
event: 'addFavorite',
|
|
67
|
+
chain: 0,
|
|
68
|
+
data: {
|
|
69
|
+
cat: 'add',
|
|
70
|
+
bond: newFavToken,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
state.timestamp = currentTimestamp();
|
|
75
|
+
},
|
|
76
|
+
addSerializedToken: function (state, _a) {
|
|
77
|
+
var serializedToken = _a.payload.serializedToken;
|
|
78
|
+
if (!state.tokens) {
|
|
79
|
+
state.tokens = {};
|
|
80
|
+
}
|
|
81
|
+
state.tokens[serializedToken.chainId] = state.tokens[serializedToken.chainId] || {};
|
|
82
|
+
state.tokens[serializedToken.chainId][serializedToken.address] = serializedToken;
|
|
83
|
+
state.timestamp = currentTimestamp();
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
extraReducers: function (builder) {
|
|
87
|
+
// User State persist in localstorage, so in order to add new values to the state you gotta add them here
|
|
88
|
+
// Also it is important to delete unused values
|
|
89
|
+
builder.addCase(updateVersion, function (state) {
|
|
90
|
+
var newState = __assign({}, state);
|
|
91
|
+
//@ts-ignore
|
|
92
|
+
delete newState.pairs;
|
|
93
|
+
//@ts-ignore
|
|
94
|
+
delete newState.userHideClosedPositions;
|
|
95
|
+
//@ts-ignore
|
|
96
|
+
delete newState.flipV3Layout;
|
|
97
|
+
//@ts-ignore
|
|
98
|
+
delete newState.lastUpdateVersionTimestamp;
|
|
99
|
+
if (!state.favoriteTokens) {
|
|
100
|
+
newState.favoriteTokens = [];
|
|
101
|
+
}
|
|
102
|
+
return newState;
|
|
103
|
+
});
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
export var updateSelectedWallet = (_a = userSlice.actions, _a.updateSelectedWallet), updateUserSlippageTolerance = _a.updateUserSlippageTolerance, updateSelectedNetwork = _a.updateSelectedNetwork, addSerializedToken = _a.addSerializedToken, updateUserZapSlippageTolerance = _a.updateUserZapSlippageTolerance, updateFavoriteTokens = _a.updateFavoriteTokens;
|
|
107
|
+
export default userSlice.reducer;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
import { Token } from '@ape.swap/sdk-core';
|
|
17
|
+
var UserAddedToken = /** @class */ (function (_super) {
|
|
18
|
+
__extends(UserAddedToken, _super);
|
|
19
|
+
function UserAddedToken() {
|
|
20
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
21
|
+
}
|
|
22
|
+
return UserAddedToken;
|
|
23
|
+
}(Token));
|
|
24
|
+
export { UserAddedToken };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { useCallback } from 'react';
|
|
38
|
+
// This can be expanded to handle more connection logic
|
|
39
|
+
var useActivate = function () {
|
|
40
|
+
var activate = useCallback(function (connection) { return __awaiter(void 0, void 0, void 0, function () {
|
|
41
|
+
var error_1;
|
|
42
|
+
return __generator(this, function (_a) {
|
|
43
|
+
switch (_a.label) {
|
|
44
|
+
case 0:
|
|
45
|
+
_a.trys.push([0, 2, , 3]);
|
|
46
|
+
return [4 /*yield*/, connection.connector.activate()];
|
|
47
|
+
case 1:
|
|
48
|
+
_a.sent();
|
|
49
|
+
return [3 /*break*/, 3];
|
|
50
|
+
case 2:
|
|
51
|
+
error_1 = _a.sent();
|
|
52
|
+
console.debug(error_1);
|
|
53
|
+
console.error("connection error: ".concat(error_1));
|
|
54
|
+
return [3 /*break*/, 3];
|
|
55
|
+
case 3: return [2 /*return*/];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}); }, []);
|
|
59
|
+
return activate;
|
|
60
|
+
};
|
|
61
|
+
export default useActivate;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { WalletConnect as WalletConnectV2 } from '@web3-react/walletconnect-v2';
|
|
2
|
+
import { Connection } from './types';
|
|
3
|
+
export declare const networkConnection: Connection;
|
|
4
|
+
export declare const injectedConnection: Connection;
|
|
5
|
+
export declare const gnosisSafeConnection: Connection;
|
|
6
|
+
export declare const web3WalletConnectV2: WalletConnectV2, web3WalletConnectHooksV2: import("@web3-react/core").Web3ReactHooks;
|
|
7
|
+
export declare const walletConnectConnection: Connection;
|
|
8
|
+
export declare const coinbaseWalletConnection: Connection;
|
|
9
|
+
export declare const listOfConnections: Connection[];
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import { CoinbaseWallet } from '@web3-react/coinbase-wallet';
|
|
3
|
+
import { initializeConnector } from '@web3-react/core';
|
|
4
|
+
import { GnosisSafe } from '@web3-react/gnosis-safe';
|
|
5
|
+
import { MetaMask } from '@web3-react/metamask';
|
|
6
|
+
import { Network } from '@web3-react/network';
|
|
7
|
+
import { WalletConnect as WalletConnectV2 } from '@web3-react/walletconnect-v2';
|
|
8
|
+
import { ConnectionType } from './types';
|
|
9
|
+
import { PUBLIC_RPC_URLS } from '../../config/constants/networks';
|
|
10
|
+
import { RPC_PROVIDERS } from '../../config/constants/providers';
|
|
11
|
+
import { ChainId, MAINNET_CHAINS } from '../../config/constants/chains';
|
|
12
|
+
// Connections based from uniswap interface
|
|
13
|
+
// https://github.com/Uniswap/interface/blob/main/src/connection/index.ts
|
|
14
|
+
var mainnet = MAINNET_CHAINS[0], optionalChains = MAINNET_CHAINS.slice(1);
|
|
15
|
+
function onError(error) {
|
|
16
|
+
console.debug("web3-react error: ".concat(error));
|
|
17
|
+
}
|
|
18
|
+
var _b = initializeConnector(function (actions) {
|
|
19
|
+
return new Network({
|
|
20
|
+
actions: actions,
|
|
21
|
+
urlMap: RPC_PROVIDERS,
|
|
22
|
+
defaultChainId: ChainId.BSC,
|
|
23
|
+
});
|
|
24
|
+
}), web3Network = _b[0], web3NetworkHooks = _b[1];
|
|
25
|
+
export var networkConnection = {
|
|
26
|
+
connector: web3Network,
|
|
27
|
+
hooks: web3NetworkHooks,
|
|
28
|
+
type: ConnectionType.NETWORK,
|
|
29
|
+
};
|
|
30
|
+
var _c = initializeConnector(function (actions) { return new MetaMask({ actions: actions, onError: onError }); }), web3Injected = _c[0], web3InjectedHooks = _c[1];
|
|
31
|
+
export var injectedConnection = {
|
|
32
|
+
connector: web3Injected,
|
|
33
|
+
hooks: web3InjectedHooks,
|
|
34
|
+
type: ConnectionType.INJECTED,
|
|
35
|
+
};
|
|
36
|
+
var _d = initializeConnector(function (actions) { return new GnosisSafe({ actions: actions }); }), web3GnosisSafe = _d[0], web3GnosisSafeHooks = _d[1];
|
|
37
|
+
export var gnosisSafeConnection = {
|
|
38
|
+
connector: web3GnosisSafe,
|
|
39
|
+
hooks: web3GnosisSafeHooks,
|
|
40
|
+
type: ConnectionType.GNOSIS_SAFE,
|
|
41
|
+
};
|
|
42
|
+
export var web3WalletConnectV2 = (_a = initializeConnector(function (actions) {
|
|
43
|
+
return new WalletConnectV2({
|
|
44
|
+
actions: actions,
|
|
45
|
+
options: {
|
|
46
|
+
projectId: process.env.walletConnectProjectId,
|
|
47
|
+
chains: [mainnet],
|
|
48
|
+
optionalChains: optionalChains,
|
|
49
|
+
showQrModal: true,
|
|
50
|
+
},
|
|
51
|
+
onError: onError,
|
|
52
|
+
});
|
|
53
|
+
}), _a[0]), web3WalletConnectHooksV2 = _a[1];
|
|
54
|
+
export var walletConnectConnection = {
|
|
55
|
+
connector: web3WalletConnectV2,
|
|
56
|
+
hooks: web3WalletConnectHooksV2,
|
|
57
|
+
type: ConnectionType.WALLET_CONNECT,
|
|
58
|
+
};
|
|
59
|
+
var _e = initializeConnector(function (actions) {
|
|
60
|
+
return new CoinbaseWallet({
|
|
61
|
+
actions: actions,
|
|
62
|
+
options: {
|
|
63
|
+
url: PUBLIC_RPC_URLS[ChainId.BSC][0],
|
|
64
|
+
appName: 'ApeSwap',
|
|
65
|
+
appLogoUrl: 'favicon.ico',
|
|
66
|
+
reloadOnDisconnect: false,
|
|
67
|
+
},
|
|
68
|
+
onError: onError,
|
|
69
|
+
});
|
|
70
|
+
}), web3CoinbaseWallet = _e[0], web3CoinbaseWalletHooks = _e[1];
|
|
71
|
+
export var coinbaseWalletConnection = {
|
|
72
|
+
connector: web3CoinbaseWallet,
|
|
73
|
+
hooks: web3CoinbaseWalletHooks,
|
|
74
|
+
type: ConnectionType.COINBASE_WALLET,
|
|
75
|
+
};
|
|
76
|
+
// Order this list for wallet display preferences
|
|
77
|
+
export var listOfConnections = [
|
|
78
|
+
injectedConnection,
|
|
79
|
+
walletConnectConnection,
|
|
80
|
+
coinbaseWalletConnection,
|
|
81
|
+
gnosisSafeConnection,
|
|
82
|
+
networkConnection,
|
|
83
|
+
];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Connector } from '@web3-react/types';
|
|
2
|
+
import { Web3ReactHooks } from '@web3-react/core';
|
|
3
|
+
export declare enum ConnectionType {
|
|
4
|
+
INJECTED = "INJECTED",
|
|
5
|
+
COINBASE_WALLET = "COINBASE_WALLET",
|
|
6
|
+
WALLET_CONNECT = "WALLET_CONNECT",
|
|
7
|
+
NETWORK = "NETWORK",
|
|
8
|
+
GNOSIS_SAFE = "GNOSIS_SAFE"
|
|
9
|
+
}
|
|
10
|
+
export interface Connection {
|
|
11
|
+
connector: Connector;
|
|
12
|
+
hooks: Web3ReactHooks;
|
|
13
|
+
type: ConnectionType;
|
|
14
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export var ConnectionType;
|
|
2
|
+
(function (ConnectionType) {
|
|
3
|
+
ConnectionType["INJECTED"] = "INJECTED";
|
|
4
|
+
ConnectionType["COINBASE_WALLET"] = "COINBASE_WALLET";
|
|
5
|
+
ConnectionType["WALLET_CONNECT"] = "WALLET_CONNECT";
|
|
6
|
+
ConnectionType["NETWORK"] = "NETWORK";
|
|
7
|
+
ConnectionType["GNOSIS_SAFE"] = "GNOSIS_SAFE";
|
|
8
|
+
})(ConnectionType || (ConnectionType = {}));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Connector } from '@web3-react/types';
|
|
2
|
+
import { Connection, ConnectionType } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* @param connection Connection to get the type
|
|
5
|
+
* @returns The string name of the connection
|
|
6
|
+
*/
|
|
7
|
+
export declare const getConnectionName: (connection: Connection) => string;
|
|
8
|
+
export declare function getConnection(c: Connector | ConnectionType): Connection;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Connector } from '@web3-react/types';
|
|
2
|
+
import { coinbaseWalletConnection, gnosisSafeConnection, injectedConnection, listOfConnections, networkConnection, walletConnectConnection, } from '.';
|
|
3
|
+
import { ConnectionType } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* @param connection Connection to get the type
|
|
6
|
+
* @returns The string name of the connection
|
|
7
|
+
*/
|
|
8
|
+
export var getConnectionName = function (connection) {
|
|
9
|
+
var connectionType = connection.type;
|
|
10
|
+
switch (connectionType) {
|
|
11
|
+
// There is other types of injected wallets so additional checks will need to be placed for them
|
|
12
|
+
case ConnectionType.INJECTED:
|
|
13
|
+
return 'MetaMask';
|
|
14
|
+
case ConnectionType.COINBASE_WALLET:
|
|
15
|
+
return 'Coinbase Wallet';
|
|
16
|
+
case ConnectionType.WALLET_CONNECT:
|
|
17
|
+
return 'WalletConnect';
|
|
18
|
+
case ConnectionType.NETWORK:
|
|
19
|
+
return 'Network';
|
|
20
|
+
case ConnectionType.GNOSIS_SAFE:
|
|
21
|
+
return 'Gnosis Safe';
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
export function getConnection(c) {
|
|
25
|
+
if (c instanceof Connector) {
|
|
26
|
+
var connection = listOfConnections.find(function (connection) { return connection.connector === c; });
|
|
27
|
+
if (!connection) {
|
|
28
|
+
throw Error('unsupported connector');
|
|
29
|
+
}
|
|
30
|
+
return connection;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
switch (c) {
|
|
34
|
+
case ConnectionType.INJECTED:
|
|
35
|
+
return injectedConnection;
|
|
36
|
+
case ConnectionType.COINBASE_WALLET:
|
|
37
|
+
return coinbaseWalletConnection;
|
|
38
|
+
case ConnectionType.WALLET_CONNECT:
|
|
39
|
+
return walletConnectConnection;
|
|
40
|
+
case ConnectionType.NETWORK:
|
|
41
|
+
return networkConnection;
|
|
42
|
+
case ConnectionType.GNOSIS_SAFE:
|
|
43
|
+
return gnosisSafeConnection;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
function track(_a) {
|
|
13
|
+
var _b;
|
|
14
|
+
var event = _a.event, chain = _a.chain, data = _a.data, value = _a.value;
|
|
15
|
+
(_b = window.dataLayer) === null || _b === void 0 ? void 0 : _b.push(__assign({ event: event, value: value, chain: chain }, data));
|
|
16
|
+
}
|
|
17
|
+
export default track;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Ape Bond SDK",
|
|
4
4
|
"author": "Ape Bond",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.409",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"module": "dist/index.es.js",
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
@@ -30,16 +30,16 @@
|
|
|
30
30
|
"@types/lodash": "^4.17.6",
|
|
31
31
|
"@types/react": "^18.3.3",
|
|
32
32
|
"@types/react-dom": "^18.3.0",
|
|
33
|
-
"@web3-react/coinbase-wallet": "^8.2.
|
|
33
|
+
"@web3-react/coinbase-wallet": "^8.2.3",
|
|
34
34
|
"@web3-react/core": "^8.2.0",
|
|
35
35
|
"@web3-react/eip1193": "^8.2.0",
|
|
36
36
|
"@web3-react/empty": "^8.2.0",
|
|
37
|
-
"@web3-react/gnosis-safe": "^8.2.
|
|
37
|
+
"@web3-react/gnosis-safe": "^8.2.4",
|
|
38
38
|
"@web3-react/metamask": "^8.2.1",
|
|
39
39
|
"@web3-react/network": "^8.2.0",
|
|
40
40
|
"@web3-react/types": "^8.2.0",
|
|
41
41
|
"@web3-react/url": "^8.2.0",
|
|
42
|
-
"@web3-react/walletconnect-v2": "^8.
|
|
42
|
+
"@web3-react/walletconnect-v2": "^8.5.1",
|
|
43
43
|
"axios": "^1.7.2",
|
|
44
44
|
"copyfiles": "^2.4.1",
|
|
45
45
|
"ethers": "5.7.2",
|
|
@@ -50,12 +50,15 @@
|
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@ape.swap/apeswap-lists": "^2.0.9",
|
|
52
52
|
"@ape.swap/sdk-core": "^1.0.2",
|
|
53
|
-
"@emotion/react": "^11.11.4",
|
|
54
53
|
"@emotion/styled": "^11.11.5",
|
|
54
|
+
"@emotion/react": "^11.11.4",
|
|
55
55
|
"@reduxjs/toolkit": "^2.2.6",
|
|
56
56
|
"@tanstack/react-query": "^5.51.5",
|
|
57
|
-
"@types/node": "^20.14.10",
|
|
58
57
|
"@uniswap/token-lists": "^1.0.0-beta.34",
|
|
58
|
+
"@web3-react/coinbase-wallet": "^8.2.3",
|
|
59
|
+
"@web3-react/gnosis-safe": "^8.2.4",
|
|
60
|
+
"@web3-react/walletconnect-v2": "^8.5.1",
|
|
61
|
+
"@types/node": "^20.14.10",
|
|
59
62
|
"axios-retry": "^4.4.2",
|
|
60
63
|
"bignumber.js": "^9.1.2",
|
|
61
64
|
"framer-motion": "^11.3.2",
|