Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permissionless listing token & pool v2 #1058

Merged
merged 123 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
3b0b59e
chore: initialize OraidexCommon in various components and hooks
trungbach Dec 1, 2024
aa10834
chore: refactor token imports and initialize OraidexCommon in index
trungbach Dec 1, 2024
81c696d
chore: refactor imports to initialize OraidexCommon from index
trungbach Dec 1, 2024
2d11067
chore: update OraidexCommon initialization and import tokens in vario…
vuonghuuhung Dec 1, 2024
f5b7b84
chore: refactor OraidexCommon imports across components and hooks
vuonghuuhung Dec 1, 2024
ffae24b
chore: update imports to initialize additional tokens from OraidexCom…
vuonghuuhung Dec 1, 2024
f162c93
chore: refactor network imports to use index across various component…
vuonghuuhung Dec 1, 2024
c1cf85c
Merge branch 'main' into feat/permissionless-todo
vuonghuuhung Dec 2, 2024
744c835
chore: update package dependencies to latest versions
vuonghuuhung Dec 2, 2024
200ddf6
feat: refactor imports to use initCommon and add polyfill logging
vuonghuuhung Dec 2, 2024
e1d3d9f
feat: refactor imports to use initCommon across multiple files
vuonghuuhung Dec 2, 2024
5fc8a4d
chore: update package dependencies to beta versions and remove consol…
vuonghuuhung Dec 2, 2024
b9cdb8d
feat: add target option to rollupOptions in vite.config
vuonghuuhung Dec 2, 2024
93263f4
feat: refactor imports to use initCommon and remove references to con…
vuonghuuhung Dec 4, 2024
d8fbc19
chore: update package dependencies to beta12 versions and refactor im…
vuonghuuhung Dec 4, 2024
9c987e2
feat: reorganize imports and update references to initCommon across m…
trungbach Dec 4, 2024
21ae706
feat: update getPathInfo to use chainInfos and improve icon handling …
trungbach Dec 5, 2024
72f7dbf
feat: restore loading animation in LoadingBox and comment out BTC Das…
vuonghuuhung Dec 5, 2024
7c75443
feat: update icon handling and styles across multiple components for …
trungbach Dec 5, 2024
a8f182c
Merge branch 'main' into feat/permissionless-todo
trungbach Dec 5, 2024
0a1be54
feat: integrate oraidexCommon and adjust icon sizes in ZapOutForm and…
vuonghuuhung Dec 6, 2024
0dbfc4f
feat: update icon handling and styles in various components for impro…
trungbach Dec 6, 2024
8778516
feat: add onchain tokens reducer and hooks, integrate token inspector…
vuonghuuhung Dec 12, 2024
1ae53b8
feat: refactor SelectTokenModal and NewTokenModal for improved functi…
vuonghuuhung Dec 13, 2024
ebb0bed
fix: add optional chaining for tokenXinfo and handle null onchainToke…
trungbach Dec 13, 2024
8f39fc6
feat: enhance NewPoolModal with liquidity creation logic and asset ha…
vuonghuuhung Dec 14, 2024
c204299
Merge branch 'feat/permissionless-todo' of https://github.com/oraidex…
vuonghuuhung Dec 14, 2024
3a3b6b7
feat: update NewPoolModal and SelectTokenModal to utilize oraichainTo…
trungbach Dec 16, 2024
1140d7f
feat: implement refetching of LP pools on address change and update t…
trungbach Dec 16, 2024
9146e51
feat: update orai-token-inspector to version 0.1.2 and enhance token …
vuonghuuhung Dec 16, 2024
7a164cc
feat: implement refetching of LP pools on address change and improve …
vuonghuuhung Dec 16, 2024
fe38e30
feat: refactor token icon handling and introduce usePoolIcons hook fo…
trungbach Dec 16, 2024
4729d55
feat: update token inspector to version 0.1.3 and enable off-chain da…
trungbach Dec 16, 2024
acc2ac0
feat: add SelectTokenModal component and enhance token handling in va…
trungbach Dec 18, 2024
4802258
feat: update orai-token-inspector to version 0.1.4 and change TOKEN_F…
vuonghuuhung Dec 18, 2024
40b7307
Merge branch 'feat/permissionless-todo' of https://github.com/oraidex…
vuonghuuhung Dec 18, 2024
278548a
feat: add manifest file, enhance wallet and token handling, and impro…
trungbach Dec 18, 2024
38e436c
feat: enhance token retrieval logic in useHandleEffectTokenChange hook
trungbach Dec 18, 2024
6f98524
Merge branch 'feat/permissionless-todo' of https://github.com/oraicha…
trungbach Dec 18, 2024
b0c92bf
feat: remove unused components and hooks from BitcoinDashboard and up…
vuonghuuhung Dec 18, 2024
06e13a5
feat: add new SVG icons for create token and trash actions, and integ…
vuonghuuhung Dec 19, 2024
67894a4
feat: clean up imports, add new SVG icons, and enhance pool helper fu…
trungbach Dec 19, 2024
e134f5f
Merge remote-tracking branch 'origin/feat/permissionless-todo' into f…
trungbach Dec 19, 2024
480aa50
feat: update orai-token-inspector to version 0.1.6 and enhance pool l…
vuonghuuhung Dec 19, 2024
dce766b
feat: update package versions, enhance token selection filters, and i…
trungbach Dec 19, 2024
9017c03
Merge remote-tracking branch 'origin/feat/permissionless-todo' into f…
trungbach Dec 19, 2024
d6d62ce
feat: update orai-token-inspector to version 0.1.7 and enhance token …
trungbach Dec 19, 2024
9f7ce82
feat: update axios baseURL to staging environment and add TODO for pr…
trungbach Dec 19, 2024
14efb1c
feat: refactor token icon handling and improve modal styles across co…
trungbach Dec 20, 2024
671fd8d
feat: integrate Redux store for token management in pool simulation a…
trungbach Dec 20, 2024
0205fb4
feat: enhance styling for light mode and improve SVG icon handling ac…
vuonghuuhung Dec 20, 2024
bdcc79a
feat: update orai-token-inspector to version 0.1.15 and add Solana RP…
vuonghuuhung Dec 21, 2024
df6bed7
feat: add verified icon to token display and update oraidex-common ve…
trungbach Dec 21, 2024
6dc8df8
fix: handle optional chain symbol image URL and improve token list fi…
trungbach Dec 22, 2024
b16cfe6
feat: update orai-token-inspector to version 0.1.16 and refactor toke…
vuonghuuhung Dec 22, 2024
c6c849f
Merge branch 'feat/permissionless-todo' of https://github.com/oraidex…
vuonghuuhung Dec 22, 2024
a32b777
feat: refactor token handling and improve token selection logic acros…
vuonghuuhung Dec 22, 2024
957d4b7
feat: enhance token handling in UniversalSwap by refining icon genera…
trungbach Dec 22, 2024
01e7bd9
Merge branch 'feat/permissionless-todo' of https://github.com/oraicha…
trungbach Dec 22, 2024
76c6942
feat: update orai-token-inspector to version 0.1.17 and enhance token…
vuonghuuhung Dec 22, 2024
18bf656
Merge branch 'feat/permissionless-todo' of https://github.com/oraidex…
vuonghuuhung Dec 22, 2024
d40ff35
feat: update NomicClient to return null in getConfig and refine token…
vuonghuuhung Dec 22, 2024
4053d1e
feat: enhance token handling and improve icon display in token select…
trungbach Dec 22, 2024
1ede67b
Merge branch 'feat/permissionless-todo' of https://github.com/oraicha…
trungbach Dec 22, 2024
eaa5441
feat: add default token icon URL and update icon handling in various …
trungbach Dec 23, 2024
3491128
refactor: remove unused token state and simplify search logic in Sele…
trungbach Dec 23, 2024
4f05a89
chore: update @oraichain/oraidex-common to version 2.0.1 and @oraicha…
trungbach Dec 23, 2024
b2bef1a
chore: update @oraichain/orai-token-inspector to version 0.1.18
trungbach Dec 23, 2024
dc7a11f
refactor: remove unnecessary decimals check in SelectTokenModal filte…
vuonghuuhung Dec 23, 2024
4bef28a
chore: update @oraichain/orai-token-inspector to version 0.1.20
trungbach Dec 23, 2024
72438df
chore: update persistence version to 2.6 and clean up SelectTokenModa…
trungbach Dec 23, 2024
d243250
refactor: improve token handling in NewTokenModal and use optional ch…
trungbach Dec 23, 2024
e188e2d
refactor: enhance NewTokenModal styling and input handling, improve t…
trungbach Dec 23, 2024
cdf0cd7
refactor: improve formatting and validation logic in NewTokenModal it…
trungbach Dec 23, 2024
d2a27f3
refactor: remove console logs and enhance liquidity provision logic i…
vuonghuuhung Dec 23, 2024
b626c19
Merge branch 'feat/permissionless-todo' of https://github.com/oraidex…
vuonghuuhung Dec 23, 2024
2d19fd2
chore: update @oraichain/oraidex-common to version 2.0.3 and refine N…
trungbach Dec 23, 2024
da30a12
Merge branch 'feat/permissionless-todo' of https://github.com/oraicha…
trungbach Dec 23, 2024
d55cef3
chore: update @oraichain/oraidex-common to version 2.0.4 and enhance …
trungbach Dec 23, 2024
0bbca4a
feat: integrate token inspection dispatch in NewTokenModal after succ…
trungbach Dec 23, 2024
d821f89
feat: integrate Redux selector to fetch all Oraichain tokens in Pools…
trungbach Dec 23, 2024
f85f142
feat: enhance SelectTokenModal and Balance components for improved to…
vuonghuuhung Dec 24, 2024
5f9c427
feat: update @oraichain/orai-token-inspector to version 0.1.21 and en…
vuonghuuhung Dec 24, 2024
00fe434
fix get token amount cosmos
haunv3 Dec 24, 2024
f6b7335
feat: add ModalConfirmUnverifiedToken component and enhance token sel…
trungbach Dec 24, 2024
e4eded1
Merge branch 'feat/permissionless-todo' of https://github.com/oraidex…
haunv3 Dec 24, 2024
36f1e99
feat: enhance token icon styling with rounded borders and clean up co…
vuonghuuhung Dec 24, 2024
ecaddd7
feat: update VSCode settings and refactor Pools and UniversalSwap com…
vuonghuuhung Dec 24, 2024
dcd6c00
Merge branch 'feat/permissionless-todo' of https://github.com/oraicha…
trungbach Dec 24, 2024
622e429
fix: correct filter typo in SelectToken component and remove unnecess…
trungbach Dec 25, 2024
d14950c
fix: correct typo in filter method in SelectToken component
trungbach Dec 25, 2024
1e84564
fix: update balance references to use new token format for ORAIX
trungbach Dec 25, 2024
2784357
feat: enhance token inspection to track user-added tokens and streaml…
trungbach Dec 25, 2024
1809963
feat: update token selection to include user-added tokens and improve…
trungbach Dec 25, 2024
4dc1b2d
fix feedback test
haunv3 Dec 25, 2024
9ef867d
fix: refactor PoolDetail and MyPoolInfo components for improved reada…
trungbach Dec 25, 2024
bfc799a
Merge branch 'recheck-permissionless' into feat/permissionless-todo
haunv3 Dec 25, 2024
806dfeb
feat: enhance number formatting function and improve token icon styli…
vuonghuuhung Dec 25, 2024
357ce84
feat: add ModalConfirmUnverifiedToken component, update token balance…
vuonghuuhung Dec 25, 2024
e751555
fix: wrap verified icon in a span for improved layout in SelectToken …
vuonghuuhung Dec 25, 2024
6aacab0
feat: filter out disabled tokens in SelectTokenModal and improve toke…
trungbach Dec 25, 2024
67e55b4
feat: enhance OverviewPool component with improved styling and copy f…
trungbach Dec 25, 2024
2efc4a1
fix: update orai-token-inspector version and improve number formattin…
vuonghuuhung Dec 25, 2024
7a518e7
Merge branch 'feat/permissionless-todo' of https://github.com/oraidex…
vuonghuuhung Dec 25, 2024
f51047d
fix: update orai-token-inspector version to 0.1.24
vuonghuuhung Dec 25, 2024
6840c40
feat: add malicious token warning in ModalConfirmUnverifiedToken comp…
vuonghuuhung Dec 25, 2024
a520ee6
fix: ensure allOraichainTokens is initialized to an empty array to pr…
vuonghuuhung Dec 25, 2024
1478f71
fix: handle potential undefined state for allOraichainTokens and impr…
trungbach Dec 25, 2024
b6a629b
Merge branch 'feat/permissionless-todo' of https://github.com/oraicha…
trungbach Dec 25, 2024
5af79c5
feat: implement query chunking for multicall to improve performance
vuonghuuhung Dec 25, 2024
442531d
fix permission
haunv3 Dec 25, 2024
0c1de4b
Merge branch 'feat/permissionless-todo' of https://github.com/oraidex…
vuonghuuhung Dec 25, 2024
2138594
fix: handle potential null values for token amounts and improve forma…
trungbach Dec 26, 2024
5a54d32
Merge branch 'feat/permissionless-todo' of https://github.com/oraidex…
haunv3 Dec 26, 2024
8e782a3
refactor: clean up unused imports and improve state initialization in…
trungbach Dec 26, 2024
3bfbd28
Merge branch 'feat/permissionless-todo' of https://github.com/oraicha…
trungbach Dec 26, 2024
bd3b739
feat: add search icons and enhance styling for token selection and po…
vuonghuuhung Dec 26, 2024
53074fd
Merge branch 'feat/permissionless-todo' of https://github.com/oraidex…
vuonghuuhung Dec 26, 2024
cfab0a9
fix: update API URLs to production endpoints and remove staging refer…
trungbach Dec 26, 2024
0e426f0
Merge branch 'feat/permissionless-todo' of https://github.com/oraicha…
trungbach Dec 26, 2024
a5d121d
Merge branch 'main' into feat/permissionless-todo
trungbach Dec 26, 2024
67d37b9
fix: update @oraichain/oraidex-common to version 2.0.5 in package.jso…
trungbach Dec 26, 2024
d91eff2
fix: ensure addedTokens defaults to an empty array and improve condit…
trungbach Dec 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading