Skip to content

Commit

Permalink
Merge pull request #1058 from oraidex/feat/permissionless-todo
Browse files Browse the repository at this point in the history
Permissionless listing token & pool v2
  • Loading branch information
vuonghuuhung authored Dec 26, 2024
2 parents 2ce549f + d91eff2 commit 60c04fa
Show file tree
Hide file tree
Showing 261 changed files with 4,856 additions and 7,212 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@
},
"[shellscript]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
var exports = {};
var require = {};
</script>
<script type="module" src="src/initCommon.ts"></script>
</head>
<body>
<div id="oraiswap"></div>
Expand Down
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@
"@oraichain/ethereum-multicall": "^1.0.2",
"@oraichain/kawaiiverse-txs": "^0.0.3",
"@oraichain/orai-bitcoin": "2.0.0",
"@oraichain/oraidex-common": "2.0.5",
"@oraichain/orai-token-inspector": "^0.1.24",
"@oraichain/oraidex-common-ui": "1.0.11",
"@oraichain/oraidex-contracts-sdk": "1.0.55",
"@oraichain/oraidex-universal-swap": "1.1.26",
"@oraichain/oraidex-universal-swap": "1.2.0-beta27",
"@oraichain/oraiswap-v3": "1.2.0-beta26",
"@oraichain/ton-bridge-contracts": "^0.15.8",
"@oraichain/tonbridge-contracts-sdk": "^1.3.1",
"@oraichain/tonbridge-sdk": "^1.3.6",
Expand Down Expand Up @@ -98,9 +101,8 @@
"@keplr-wallet/types": "^0.11.38",
"@oraichain/babel-plugin-operator-overloading": "^1.0.4",
"@oraichain/common-contracts-build": "1.0.35",
"@oraichain/cw-simulate": "^2.8.75",
"@oraichain/cw-simulate": "^2.8.108",
"@oraichain/oraidex-contracts-build": "1.0.22",
"@oraichain/oraiswap-v3": "^1.1.2",
"@sentry/webpack-plugin": "^2.10.3",
"@testing-library/jest-dom": "^6.5.0",
"@types/classnames": "^2.2.10",
Expand Down Expand Up @@ -167,7 +169,8 @@
"bitcoinjs-lib": "5.2.0",
"axios": "0.26.1",
"@sentry/react": "7.99.0",
"@oraichain/oraidex-common": "1.1.44"
"@cosmjs/amino": "0.32.4",
"@oraichain/oraidex-common": "2.0.5"
},
"overrides": {
"cosmjs-types@>0.7.0 <0.8.0": "0.7.1",
Expand Down
4 changes: 4 additions & 0 deletions src/assets/icons/ic_copy_address.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/assets/icons/ic_create_pool_v2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/assets/icons/ic_create_pool_v3.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions src/assets/icons/ic_verified.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/assets/icons/iconoir_coins-add.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/ion_chevron-up.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/assets/icons/ion_trash-sharp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/assets/icons/search-svg-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/assets/icons/search-svg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/christmas/balloon.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/christmas/sleigh.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions src/components/DragDropImage/index.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
.form-file-upload {
height: 16rem;
width: 28rem;
max-width: 100%;
text-align: center;
position: relative;

.input-file-upload {
display: none;
}

.label-file-upload {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
border-width: 2px;
border-radius: 1rem;
border-style: dashed;
border-color: #cbd5e1;
background-color: #f8fafc;

.upload-button {
cursor: pointer;
padding: 0.25rem;
font-size: 1rem;
border: none;
font-family: 'Oswald', sans-serif;
background-color: transparent;

&:hover {
text-decoration-line: underline;
}
}

.drag-active {
background-color: #ffffff;
}
}

.drag-file-element {
position: absolute;
width: 100%;
height: 100%;
border-radius: 1rem;
top: 0px;
right: 0px;
bottom: 0px;
left: 0px;
}
}
64 changes: 64 additions & 0 deletions src/components/DragDropImage/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import React from "react";
import styles from "./index.module.scss";
import cn from 'classnames/bind';

const cx = cn.bind(styles);

const ImageInput = ({ }) => {
const [dragActive, setDragActive] = React.useState(false);
const [imageUrl, setImageUrl] = React.useState('');
const inputRef = React.useRef(null);

const handleDrag = function (e) {
e.preventDefault();
e.stopPropagation();
if (e.type === "dragenter" || e.type === "dragover") {
setDragActive(true);
} else if (e.type === "dragleave") {
setDragActive(false);
}
};

const handleDrop = function (e) {
e.preventDefault();
e.stopPropagation();
setDragActive(false);
if (e.dataTransfer.files && e.dataTransfer.files[0]) {
// handleFiles(e.dataTransfer.files);

}
};

const handleChange = function (e) {
console.log("change", e.target.files)
e.preventDefault();

if (e.target.files && e.target.files[0]) {
// handleFiles(e.target.files);
console.log(e.target.files[0]);
setImageUrl(URL.createObjectURL(e.target.files[0]));
}
};

const onButtonClick = () => {
inputRef.current.click();
};

return (
<form className="form-file-upload" onDragEnter={handleDrag} onSubmit={(e) => e.preventDefault()}>
<input ref={inputRef} type="file" className="input-file-upload" multiple={true} onChange={handleChange} />
<label className={cx("label-file-upload", dragActive ? "drag-active" : "")} htmlFor="input-file-upload">
<div>
{/* <p>Drag and drop your file here or</p>
<button className="upload-button" onClick={onButtonClick}>Upload a file</button> */}
</div>
<div>
<img src={imageUrl} alt="preview picture" width={150} height={150} />
</div>
</label>
{dragActive && <div className="drag-file-element" onDragEnter={handleDrag} onDragLeave={handleDrag} onDragOver={handleDrag} onDrop={handleDrop}></div>}
</form>
);
}

export default ImageInput;
4 changes: 2 additions & 2 deletions src/components/InputSwap/InputSwap.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import styles from './InputSwap.module.scss';
import cn from 'classnames/bind';
import NumberFormat from 'react-number-format';
import { CoinIcon, TokenItemType } from '@oraichain/oraidex-common';
import { TokenItemType } from '@oraichain/oraidex-common';

const cx = cn.bind(styles);

interface InputSwapProps {
Icon: CoinIcon;
Icon: any;
setIsSelectFrom: (value: boolean) => void;
token: TokenItemType;
amount: number;
Expand Down
4 changes: 2 additions & 2 deletions src/components/LuckyDraw/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ import {
import { handleErrorTransaction } from 'helper';
import OraiXLightIcon from 'assets/icons/oraix_light.svg?react';
import CongratulationLottie from 'assets/lottie/congratulation.json';
import { network } from 'config/networks';
import classNames from 'classnames';
import Loader from 'components/Loader';
import Lottie from 'lottie-react';
import InputRange from 'pages/CoHarvest/components/InputRange';
import { numberWithCommas } from 'pages/Pools/helpers';
import { Spin } from './luckyDrawClient/LuckyWheelContract.types';
import { network } from 'initCommon';

const LuckyDraw: FC<{}> = () => {
const [address] = useConfigReducer('address');
Expand Down Expand Up @@ -71,7 +71,7 @@ const LuckyDraw: FC<{}> = () => {

const amounts = useSelector((state: RootState) => state.token.amounts);
const loadOraichainToken = useLoadOraichainTokens();
const balance = amounts['oraix'];
const balance = amounts['cw20:orai1lus0f0rhx8s03gdllx2n6vhkmf0536dv57wfge:ORAIX'];

const { spinConfig } = useLuckyDrawConfig();
const { fee = LUCKY_DRAW_FEE, feeDenom = ORAIX_CONTRACT, feeToken } = spinConfig || {};
Expand Down
3 changes: 1 addition & 2 deletions src/components/LuckyDraw/useLuckyDraw.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { ORAIX_CONTRACT } from '@oraichain/oraidex-common';
import { useQuery } from '@tanstack/react-query';
import { LuckyWheelContractQueryClient } from './luckyDrawClient';
import { flattenTokensWithIcon } from 'config/chainInfos';
import { LUCKY_DRAW_CONTRACT, LUCKY_DRAW_FEE, FETCH_RESULT_INTERVAL, MAX_SPIN_TIME_PER_SEND } from './constants';
import { MulticallQueryClient } from '@oraichain/common-contracts-sdk';
import { network } from 'config/networks';
import { fromBinary, toBinary } from '@cosmjs/cosmwasm-stargate';
import { Spin } from './luckyDrawClient/LuckyWheelContract.types';
import { flattenTokensWithIcon, network } from 'initCommon';

export const getDataLogByKey = (log: any, key: string) => {
const events = log?.events || [];
Expand Down
9 changes: 8 additions & 1 deletion src/components/Modal.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,14 @@
right: 16px;
}

span {
.close-icon {
cursor: pointer;
&.light {
svg {
path {
fill: black !important;
}
}
}
}
}
46 changes: 27 additions & 19 deletions src/components/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,38 @@ import CloseIcon from 'assets/icons/close.svg?react';
import { ComponentType, FC, useState } from 'react';
import ReactModal from 'react-modal';
import styles from './Modal.module.scss';
import useTheme from 'hooks/useTheme';
import classNames from 'classnames/bind';

const cx = classNames.bind(styles);

const ModalSafeForReact18 = ReactModal as ComponentType<ReactModal['props']>;

ReactModal.setAppElement('#oraiswap');

const Modal: FC<Modal> = ({ className, isOpen, close, children, isCloseBtn = false }) => (
<ModalSafeForReact18
className={`${styles.modal} ${className || ''}`}
overlayClassName={`${styles.overlay} ${className || ''}`}
preventScroll
htmlOpenClassName={styles.open}
isOpen={isOpen}
onRequestClose={close}
>
{isCloseBtn && (
<div className={styles.close}>
<span onClick={close}>
<CloseIcon color={'#ffffff'} width={20} height={20} />
</span>
</div>
)}
{children}
</ModalSafeForReact18>
);
const Modal: FC<Modal> = ({ className, isOpen, close, children, isCloseBtn = false }) => {
const theme = useTheme();

return (
<ModalSafeForReact18
className={`${styles.modal} ${className || ''}`}
overlayClassName={`${styles.overlay} ${className || ''}`}
preventScroll
htmlOpenClassName={styles.open}
isOpen={isOpen}
onRequestClose={close}
>
{isCloseBtn && (
<div className={styles.close}>
<span className={cx('close-icon', theme)} onClick={close}>
<CloseIcon width={20} height={20} />
</span>
</div>
)}
{children}
</ModalSafeForReact18>
);
}

export default Modal;

Expand Down
Loading

0 comments on commit 60c04fa

Please sign in to comment.