Browse Source

修改页面bug

master
mac 7 months ago
parent
commit
c5eb870f65
  1. 4
      env.md
  2. 1
      package.json
  3. BIN
      src/assets/menu/menu-bg-1.png
  4. 3
      src/contract/api.ts
  5. 28
      src/contract/index.ts
  6. 9
      src/language/hk.json
  7. 9
      src/language/zh.json
  8. 9
      src/pages/home/index.tsx
  9. 2
      src/pages/invitation-detail/index.tsx
  10. 19
      src/pages/invitation/index.tsx
  11. 7
      src/pages/my-pledge/index.tsx
  12. 10
      src/pages/nft-detail/index.tsx
  13. 10
      src/pages/pledge/index.tsx
  14. 12
      src/router/layout/Navbar.tsx
  15. 2
      src/styles/admin.scss
  16. 4
      src/styles/home.scss
  17. 4
      src/styles/pledge.scss
  18. 2
      src/types/store.d.ts
  19. 12
      src/utils/index.ts
  20. 10793
      yarn.lock

4
env.md

@ -1,4 +1,4 @@
SKIP_PREFLIGHT_CHECK=true SKIP_PREFLIGHT_CHECK=true
GENERATE_SOURCEMAP=false GENERATE_SOURCEMAP=false
REACT_APP_CHAINID=97
REACT_APP_DAY_TIME=60
REACT_APP_CHAINID=56
REACT_APP_DAY_TIME=86400

1
package.json

@ -82,6 +82,7 @@
"build": "node scripts/build.js", "build": "node scripts/build.js",
"test": "node scripts/test.js", "test": "node scripts/test.js",
"deploy:dev": "npm run build && scp -r ./build/* vps:/home/ubuntu/pzy/sofil", "deploy:dev": "npm run build && scp -r ./build/* vps:/home/ubuntu/pzy/sofil",
"deploy:test": "npm run build && scp -r ./build/* dcfilefast_prod:/home/web/code/test-app.sofil.io",
"deploy:prod": "npm run build && scp -r ./build/* vpsDcminer:/data/wwwroot/sofil" "deploy:prod": "npm run build && scp -r ./build/* vpsDcminer:/data/wwwroot/sofil"
}, },
"eslintConfig": { "eslintConfig": {

BIN
src/assets/menu/menu-bg-1.png

Before

Width: 800  |  Height: 716  |  Size: 20 KiB

After

Width: 600  |  Height: 537  |  Size: 126 KiB

3
src/contract/api.ts

@ -8,9 +8,10 @@ import {
} from "~/types/api.d"; } from "~/types/api.d";
import { toFixed2 } from "~/utils"; import { toFixed2 } from "~/utils";
import { fromWei, toBigInt, toWei } from "~/utils/wei"; import { fromWei, toBigInt, toWei } from "~/utils/wei";
import { Pledge } from "./typechain-types";
const { _contract } = store.state.contract; const { _contract } = store.state.contract;
const { Pledge__factory } = _contract;
const Pledge__factory =(_contract ? _contract.Pledge__factory : {} ) as Pledge;
const eth_pledgeRecords = async (_owner: string) => { const eth_pledgeRecords = async (_owner: string) => {
const _recordPs = Pledge__factory.getPledgeRecords(_owner); //質押記錄 const _recordPs = Pledge__factory.getPledgeRecords(_owner); //質押記錄

28
src/contract/index.tsx → src/contract/index.ts

@ -5,16 +5,16 @@ import store from '~/store';
import { ContractType } from '~/types/store'; import { ContractType } from '~/types/store';
// 0x7a89c2D92Bf53160ab58d7889966741cA8Eb5855 // 0x7a89c2D92Bf53160ab58d7889966741cA8Eb5855
export const config = { export const config = {
56: {
chainId: 56,
rpc: "https://bsc-dataseed1.defibit.io",
address: {
FIL__factory: "0x0d8ce2a99bb6e3b7db580ed848240e4a0f9ae153",
NFT__factory: "0x5fd156B6B47Bb0B363fa3D4e2E31a8394Ee7A630",
Pool__factory: "0xC31cEb39961076d8fAD3936D88489972c02b4D83",
Pledge__factory: "0x2F3d8761c8214627743F84F9890A8eEeD914ddf1",
}
},
// 56: {
// chainId: 56,
// rpc: "https://bsc-dataseed1.defibit.io",
// address: {
// FIL__factory: "0x0d8ce2a99bb6e3b7db580ed848240e4a0f9ae153",
// NFT__factory: "0x5fd156B6B47Bb0B363fa3D4e2E31a8394Ee7A630",
// Pool__factory: "0xC31cEb39961076d8fAD3936D88489972c02b4D83",
// Pledge__factory: "0x2F3d8761c8214627743F84F9890A8eEeD914ddf1",
// }
// },
97: { 97: {
chainId: 97, chainId: 97,
rpc: "https://bsc-testnet.blockpi.network/v1/rpc/public", rpc: "https://bsc-testnet.blockpi.network/v1/rpc/public",
@ -34,7 +34,7 @@ export const config = {
Pool__factory: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9", Pool__factory: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9",
Pledge__factory: "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707", Pledge__factory: "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707",
} }
}
},
} as any } as any
// 57.333333333333333332 // 57.333333333333333332
const contractObj = { const contractObj = {
@ -75,6 +75,7 @@ const switchNetWork = () => {
export const initContract = async () => { export const initContract = async () => {
try {
let chainId = Number(process.env.REACT_APP_CHAINID); let chainId = Number(process.env.REACT_APP_CHAINID);
let account = [] as string[]; let account = [] as string[];
@ -93,7 +94,7 @@ export const initContract = async () => {
})) }))
} }
if(!config[chainId]){
if (!config[chainId]) {
chainId = Number(process.env.REACT_APP_CHAINID) chainId = Number(process.env.REACT_APP_CHAINID)
}; };
@ -112,5 +113,8 @@ export const initContract = async () => {
_contract._contract[item] = contractObj[item].connect(contractAddress.address[item], _provider); _contract._contract[item] = contractObj[item].connect(contractAddress.address[item], _provider);
}) })
store.setContract(_contract as ContractType); store.setContract(_contract as ContractType);
} catch (error) {
}
} }

9
src/language/hk.json

@ -81,7 +81,7 @@
"WITHDRAW":"提取", "WITHDRAW":"提取",
"No. of Staking Contracts":"持有的質押合約", "No. of Staking Contracts":"持有的質押合約",
"Contract(NFT)":"合約NFT", "Contract(NFT)":"合約NFT",
"Withdrawable":"可提取總額",
"Withdrawable":"可提取收益",
"Maturity Date":"到期日", "Maturity Date":"到期日",
"Status":"狀態", "Status":"狀態",
"Active":"未到期", "Active":"未到期",
@ -90,8 +90,9 @@
"No records":"暫無記錄", "No records":"暫無記錄",
"Accumulative Stake":"總質押", "Accumulative Stake":"總質押",
"Accumulative Rewards Withdraw":"總提取收益", "Accumulative Rewards Withdraw":"總提取收益",
"Withdraw":"質押",
"Stake":"提取",
"Accumulative Rewards":"總收益",
"Withdraw":"提取",
"Stake":"質押",
"Create Contract(NFT)":"創建合約(NFT)", "Create Contract(NFT)":"創建合約(NFT)",
"Contract Address":"合約地址", "Contract Address":"合約地址",
"Copy Success":"複製成功", "Copy Success":"複製成功",
@ -125,7 +126,7 @@
"Addresses": "錢包地址", "Addresses": "錢包地址",
"Contributed": "獎勵貢獻", "Contributed": "獎勵貢獻",
"Binding Time": "綁定時間", "Binding Time": "綁定時間",
"Contreact(Rewards) Details": "合約(奖励)明細",
"Contract(Rewards) Details": "合約(奖励)明細",
"Days Staking": "天質押", "Days Staking": "天質押",
"Rewards Details": "收益及提取明細" "Rewards Details": "收益及提取明細"
} }

9
src/language/zh.json

@ -81,7 +81,7 @@
"WITHDRAW": "提取", "WITHDRAW": "提取",
"No. of Staking Contracts": "持有的质押合约", "No. of Staking Contracts": "持有的质押合约",
"Contract(NFT)": "合约NFT", "Contract(NFT)": "合约NFT",
"Withdrawable": "可提取总额",
"Withdrawable": "可提取收益",
"Maturity Date": "到期日", "Maturity Date": "到期日",
"Status": "状态", "Status": "状态",
"Active": "未到期", "Active": "未到期",
@ -90,8 +90,9 @@
"No records": "暂无记录", "No records": "暂无记录",
"Accumulative Stake": "总质押", "Accumulative Stake": "总质押",
"Accumulative Rewards Withdraw": "总提取收益", "Accumulative Rewards Withdraw": "总提取收益",
"Withdraw": "质押",
"Stake": "提取",
"Accumulative Rewards":"总收益",
"Withdraw": "提取",
"Stake": "质押",
"Create Contract(NFT)": "创建合约(NFT)", "Create Contract(NFT)": "创建合约(NFT)",
"Contract Address": "合约地址", "Contract Address": "合约地址",
"Copy Success": "复制成功", "Copy Success": "复制成功",
@ -125,7 +126,7 @@
"Addresses": "钱包地址", "Addresses": "钱包地址",
"Contributed": "奖励贡献", "Contributed": "奖励贡献",
"Binding Time": "绑定时间", "Binding Time": "绑定时间",
"Contreact(Rewards) Details": "合约(奖励)明细",
"Contract(Rewards) Details": "合约(奖励)明细",
"Days Staking": "天质押", "Days Staking": "天质押",
"Rewards Details": "收益及提取明细" "Rewards Details": "收益及提取明细"
} }

9
src/pages/home/index.tsx

@ -5,6 +5,7 @@ import Button from '~/components/Button'
import { eth_pledgeProducts } from '~/contract/api' import { eth_pledgeProducts } from '~/contract/api'
import { useRouter } from '~/hooks/useRouter' import { useRouter } from '~/hooks/useRouter'
import '~/styles/home.scss' import '~/styles/home.scss'
import { openGitBook } from '~/utils'
const Home = () => { const Home = () => {
@ -109,7 +110,9 @@ const Home = () => {
<img src={require('~/assets/group.png')} className='img' alt="" /> <img src={require('~/assets/group.png')} className='img' alt="" />
<div className='box p-2'> <div className='box p-2'>
<div className='fz-wb-550 tac'>{t('Up To 7% of Referees Staking Rewards')}</div> <div className='fz-wb-550 tac'>{t('Up To 7% of Referees Staking Rewards')}</div>
<div className='row-center mt-1 plr-1'>
<div className='row-center mt-1 plr-1' onClick={() => {
push('/myPledge')
}}>
<div className='tac fz-14'>{t('By sharing your referral code and introducing your friends to SOFIL and stake, you can earn referral rewards and withdraw everyday.')}</div> <div className='tac fz-14'>{t('By sharing your referral code and introducing your friends to SOFIL and stake, you can earn referral rewards and withdraw everyday.')}</div>
<div className='iconfont icon-arrow fz-26'></div> <div className='iconfont icon-arrow fz-26'></div>
</div> </div>
@ -129,7 +132,9 @@ const Home = () => {
} }
</Collapse> </Collapse>
<div className='row-center'> <div className='row-center'>
<Button className='understand-button mt-3 fz-wb-550'>{t('Learn More')}</Button>
<Button className='understand-button mt-3 fz-wb-550' onClick={() => {
openGitBook()
}}>{t('Learn More')}</Button>
</div> </div>
</div> </div>
</div> </div>

2
src/pages/invitation-detail/index.tsx

@ -77,7 +77,7 @@ const InvitationDetail = () => {
<div className='box plr-3'> <div className='box plr-3'>
<div className='row-items pt-3'> <div className='row-items pt-3'>
<div className='iconfont icon-back_light fz-34' onClick={() => push(-1)}></div> <div className='iconfont icon-back_light fz-34' onClick={() => push(-1)}></div>
<div className='fz-24'>{t('Contreact(Rewards) Details')}</div>
<div className='fz-24'>{t('Contract(Rewards) Details')}</div>
</div> </div>
</div> </div>
</div> </div>

19
src/pages/invitation/index.tsx

@ -16,7 +16,7 @@ import { useTranslation } from 'react-i18next'
const Invitation = () => { const Invitation = () => {
const { t } = useTranslation()
const { t,i18n } = useTranslation()
const { walletAddress, contract } = store.state const { walletAddress, contract } = store.state
const { copyVal } = useCopyLink() const { copyVal } = useCopyLink()
const [tabIndex, setTabIndex] = useState(0) const [tabIndex, setTabIndex] = useState(0)
@ -94,6 +94,20 @@ const Invitation = () => {
} }
}, []) }, [])
const renderTitle = ()=>{
if(i18n.language === 'en'){
return (
<div className='tac mt-1 fz-15'>Up To <span className='fz-24 fz-wb-550'>7%</span> of Referees Staking Rewards</div>
)
}
if(i18n.language === 'hk'){
return (
<div className='tac mt-1 fz-15'> <span className='fz-24 fz-wb-550'>7%</span> </div>
)
}
return <div className='tac mt-1 fz-15'> <span className='fz-24 fz-wb-550'>7%</span> </div>
}
return ( return (
<div className="invitation"> <div className="invitation">
<div className="watermark-1"></div> <div className="watermark-1"></div>
@ -104,7 +118,8 @@ const Invitation = () => {
</div> </div>
<div className='learn-box white'> <div className='learn-box white'>
<div className='notify-img'></div> <div className='notify-img'></div>
<div className='tac mt-1 fz-15'>{t('Up To 7% of Referees Staking Rewards')}</div>
{renderTitle()}
{/* <div className='tac mt-1 fz-15'>{t('Up To 7% of Referees Staking Rewards')}</div> */}
<div className='row-center mt-1'> <div className='row-center mt-1'>
<Button className='modal-button'>{t('Learn More')}</Button> <Button className='modal-button'>{t('Learn More')}</Button>
</div> </div>

7
src/pages/my-pledge/index.tsx

@ -8,11 +8,10 @@ import { useRouter } from '~/hooks/useRouter';
import UnLogin from '~/components/Unlogin'; import UnLogin from '~/components/Unlogin';
import { eth_pledgeInfo, eth_pledgeRecords } from '~/contract/api'; import { eth_pledgeInfo, eth_pledgeRecords } from '~/contract/api';
import { PledgeInfoType, PledgeWithdrawRecordType } from '~/types/api.d'; import { PledgeInfoType, PledgeWithdrawRecordType } from '~/types/api.d';
import { calcIncome, getTime, splitAddress, toFixed2 } from '~/utils';
import { calcExtractableAmount, calcIncome, getTime, splitAddress, toFixed2 } from '~/utils';
import ModalLoading from '~/components/ModalLoading'; import ModalLoading from '~/components/ModalLoading';
import { copy } from '~/utils/copy'; import { copy } from '~/utils/copy';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { t } from 'i18next';
const MyPledge = () => { const MyPledge = () => {
@ -201,6 +200,7 @@ const PledgeContract = (props: PledgeContractProps) => {
const { data, currentTime, filBalance, pledgeToast, withdrawAmount, pledgeInfosLength, withdrawIncome, hash, setVisible, visible, status, loading } = props const { data, currentTime, filBalance, pledgeToast, withdrawAmount, pledgeInfosLength, withdrawIncome, hash, setVisible, visible, status, loading } = props
const { push } = useRouter() const { push } = useRouter()
const [tabIndex, setTabIndex] = useState(0) const [tabIndex, setTabIndex] = useState(0)
const {t} = useTranslation()
return ( return (
<div> <div>
@ -256,7 +256,7 @@ const PledgeContract = (props: PledgeContractProps) => {
</div> </div>
</div> </div>
</div> </div>
<div className='flex-2'>{toFixed2(calcIncome(item), 2)} FIL</div>
<div className='flex-2'>{toFixed2(calcExtractableAmount(item,currentTime), 2)} FIL</div>
<div className='flex-2 row-center'> <div className='flex-2 row-center'>
{ {
tabIndex === 0 && ( tabIndex === 0 && (
@ -302,6 +302,7 @@ const Record = (props: RecordProps) => {
const [tabIndex, setTabIndex] = useState(0) const [tabIndex, setTabIndex] = useState(0)
const { totalPledge, totalWithdraw, pledgeRecord, pledgeWithdrawRecord, contractAddress } = props; const { totalPledge, totalWithdraw, pledgeRecord, pledgeWithdrawRecord, contractAddress } = props;
const {t} = useTranslation()
return ( return (
<div className='record'> <div className='record'>

10
src/pages/nft-detail/index.tsx

@ -1,7 +1,7 @@
import { t } from 'i18next'
import { observer } from 'mobx-react' import { observer } from 'mobx-react'
import { useEffect, useRef, useState } from 'react' import { useEffect, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import Button from '~/components/Button' import Button from '~/components/Button'
import Modal from '~/components/Modal' import Modal from '~/components/Modal'
import ModalLoading from '~/components/ModalLoading' import ModalLoading from '~/components/ModalLoading'
@ -11,11 +11,12 @@ import { useRouter } from '~/hooks/useRouter'
import store from '~/store' import store from '~/store'
import '~/styles/pledge.scss' import '~/styles/pledge.scss'
import { PledgeInfoType } from '~/types/api.d' import { PledgeInfoType } from '~/types/api.d'
import { calcExtractableAmount, calcReleasedIncome, calcWithdrawnAmount, getTime, splitAddress } from '~/utils'
import { calcExtractableAmount, calcIncome, calcReleasedIncome, calcWithdrawnAmount, getTime, splitAddress } from '~/utils'
import { toBigInt } from '~/utils/wei' import { toBigInt } from '~/utils/wei'
const NFTDetail = () => { const NFTDetail = () => {
const {t} = useTranslation()
const { contract, walletAddress } = store.state const { contract, walletAddress } = store.state
const { copyVal } = useCopyLink() const { copyVal } = useCopyLink()
const { push, location } = useRouter() const { push, location } = useRouter()
@ -186,12 +187,17 @@ const NFTDetail = () => {
</div> </div>
<div className='divider mt-2'></div> <div className='divider mt-2'></div>
{/* */} {/* */}
<div> <div>
<div className='fz-18 fz-wb-550 mt-2'>{t('Rewards & Withdrawals Details')}</div> <div className='fz-18 fz-wb-550 mt-2'>{t('Rewards & Withdrawals Details')}</div>
<div className='mt-1 row-between'> <div className='mt-1 row-between'>
<div>{t('Rewards Start Time')}</div> <div>{t('Rewards Start Time')}</div>
<div>{getTime(data.startTime * 1000)}</div> <div>{getTime(data.startTime * 1000)}</div>
</div> </div>
<div className='mt-1 row-between'>
<div>{t('Accumulative Rewards')}</div>
<div>{calcIncome(data)} FIL</div>
</div>
<div className='mt-1 row-between'> <div className='mt-1 row-between'>
<div>{t('Rewards Distributed')}</div> <div>{t('Rewards Distributed')}</div>
<div>{calcReleasedIncome(data, currentTime)} FIL</div> <div>{calcReleasedIncome(data, currentTime)} FIL</div>

10
src/pages/pledge/index.tsx

@ -2,24 +2,26 @@ import { ethers } from 'ethers';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import { useEffect, useRef, useState } from 'react'; import { useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Dialog, Toast } from 'react-vant';
import { Toast } from 'react-vant';
import Button from '~/components/Button'; import Button from '~/components/Button';
import Loading from '~/components/Loading';
import Modal from '~/components/Modal'; import Modal from '~/components/Modal';
import ModalLoading from '~/components/ModalLoading'; import ModalLoading from '~/components/ModalLoading';
import { eth_pledgeProducts } from '~/contract/api'; import { eth_pledgeProducts } from '~/contract/api';
import { useRouter } from '~/hooks/useRouter'; import { useRouter } from '~/hooks/useRouter';
import store from '~/store'; import store from '~/store';
import '~/styles/pledge.scss' import '~/styles/pledge.scss'
import { Contract_Factory } from '~/types/store';
import { toFixed2 } from '~/utils'; import { toFixed2 } from '~/utils';
import { fromWei, toBigInt, toWei, wei } from '~/utils/wei';
import { toBigInt, toWei, wei } from '~/utils/wei';
// //
const Pledge = () => { const Pledge = () => {
const { t } = useTranslation() const { t } = useTranslation()
const { location } = useRouter() const { location } = useRouter()
const { filBalance, walletAddress, contract: { _contract: { Pledge__factory, FIL__factory, Pool__factory } } } = store.state
const { filBalance, walletAddress, contract } = store.state
const {Pledge__factory, FIL__factory, Pool__factory } = contract._contract ? contract._contract : {} as Contract_Factory
const [pledgeList, setPledgeList] = useState([ const [pledgeList, setPledgeList] = useState([
{ day: 180, rate: 14 }, { day: 180, rate: 14 },
{ day: 270, rate: 15 }, { day: 270, rate: 15 },

12
src/router/layout/Navbar.tsx

@ -9,6 +9,7 @@ import { useRouter } from '~/hooks/useRouter'
import { SOFIL_LANGUAGE } from '~/language' import { SOFIL_LANGUAGE } from '~/language'
import store from '~/store' import store from '~/store'
import '~/styles/layout.scss' import '~/styles/layout.scss'
import { openGitBook } from '~/utils'
import { toBigInt } from '~/utils/wei' import { toBigInt } from '~/utils/wei'
interface NavbarProps { interface NavbarProps {
@ -42,15 +43,9 @@ const Navbar = (props: NavbarProps) => {
const langs = useMemo(() => [ const langs = useMemo(() => [
{ title: 'English', key: 'en' }, { title: 'English', key: 'en' },
{ title: '简体中文', key: 'zh' }, { title: '简体中文', key: 'zh' },
{ title: '繁中文', key: 'hk' },
{ title: '繁中文', key: 'hk' },
], []) ], [])
const gitbooks = useMemo(() => ({
'en': 'https://sofil.gitbook.io/main',
'zh': 'https://sofil.gitbook.io/main/v/cn',
'hk': 'https://sofil.gitbook.io/main/v/tc'
} as { [key: string]: string }), [])
const [currentLang, setCurrentLang] = useState(2) const [currentLang, setCurrentLang] = useState(2)
const setLang = (index: number) => { const setLang = (index: number) => {
@ -148,8 +143,7 @@ const Navbar = (props: NavbarProps) => {
push(item.path) push(item.path)
setVisible(false) setVisible(false)
} else { } else {
const key = langs[currentLang].key;
window.open(gitbooks[key])
openGitBook()
} }
}}> }}>
<div></div> <div></div>

2
src/styles/admin.scss

@ -1,4 +1,6 @@
.admin{ .admin{
background-color: #433978;
color: #fff;
.rv-tabs__nav { .rv-tabs__nav {
background: none; background: none;
} }

4
src/styles/home.scss

@ -14,7 +14,6 @@
box-sizing: border-box; box-sizing: border-box;
border: 1px solid #4ee1f9; border: 1px solid #4ee1f9;
box-shadow: 0px 3px 6px 0px rgba(0, 0, 0, 0.1608); box-shadow: 0px 3px 6px 0px rgba(0, 0, 0, 0.1608);
border: none;
font-weight: bold; font-weight: bold;
} }
@ -49,7 +48,6 @@
background-size: 100% 100%; background-size: 100% 100%;
object-fit: cover; object-fit: cover;
position: relative; position: relative;
z-index: 1;
color: $white; color: $white;
.box { .box {
width: 391px; width: 391px;
@ -209,11 +207,11 @@
.rv-cell { .rv-cell {
background: $white; background: $white;
border-radius: 10px; border-radius: 10px;
box-shadow: 0px 6px 6px 0px rgba(0, 0, 0, 0.1608);
} }
.rv-collapse-item { .rv-collapse-item {
border-radius: 20px; border-radius: 20px;
box-shadow: 0px 6px 6px 0px rgba(0, 0, 0, 0.1608);
} }
.rv-collapse-item__title--expanded { .rv-collapse-item__title--expanded {

4
src/styles/pledge.scss

@ -94,6 +94,10 @@
border: none; border: none;
background: none; background: none;
color: $white; color: $white;
&::placeholder{
font-size: 14px;
}
} }
.button { .button {
width: 70px; width: 70px;

2
src/types/store.d.ts

@ -28,4 +28,4 @@ interface ContractType {
_provider: Web3Provider | JsonRpcProvider; _provider: Web3Provider | JsonRpcProvider;
} }
export { StoreLocalStorageKey, ContractType };
export { StoreLocalStorageKey, ContractType,Contract_Factory };

12
src/utils/index.ts

@ -3,6 +3,17 @@ import { Toast } from "react-vant";
import { PledgeInfoType } from "~/types/api"; import { PledgeInfoType } from "~/types/api";
import { toBigInt, toWei } from "./wei"; import { toBigInt, toWei } from "./wei";
import { t } from "i18next"; import { t } from "i18next";
import { SOFIL_LANGUAGE } from "~/language";
const openGitBook = ()=>{
const obj = {
'en': 'https://sofil.gitbook.io/main',
'zh': 'https://sofil.gitbook.io/main/v/cn',
'hk': 'https://sofil.gitbook.io/main/v/tc'
} as {[key:string]:string}
const key = window.sessionStorage.getItem(SOFIL_LANGUAGE) || 'hk'
window.open(obj[key])
}
// 切割字符中 ''...'' // 切割字符中 ''...''
const splitAddress = (address: any, index?: number) => { const splitAddress = (address: any, index?: number) => {
@ -184,4 +195,5 @@ export {
calcIncome, calcIncome,
calcExtractableAmount, calcExtractableAmount,
calcWithdrawnAmount, calcWithdrawnAmount,
openGitBook
}; };

10793
yarn.lock
File diff suppressed because it is too large
View File

Loading…
Cancel
Save