Skip to content

Commit 6619ee6

Browse files
authored
Merge pull request Loopring#803 from Loopring/staging
earn, bridge, guardian web3Modal
2 parents 0c99931 + edc957b commit 6619ee6

File tree

60 files changed

+368
-361
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+368
-361
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
"dependencies": {
1212
"@emotion/react": "^11.4.1",
1313
"@emotion/styled": "^11.3.0",
14-
"@loopring-web/loopring-sdk": "3.8.22",
14+
"@loopring-web/loopring-sdk": "3.8.23",
1515
"@loopring-web/recharts": "^2.0.10",
16-
"@loopring-web/web3-provider": "1.4.15",
16+
"@loopring-web/web3-provider": "1.4.16",
1717
"@mui/lab": "5.0.0-alpha.45",
1818
"@mui/material": "5.6.2",
1919
"@ramp-network/ramp-instant-sdk": "^4.0.4",
@@ -22,6 +22,7 @@
2222
"@react-spring/parallax": "^9.4.4",
2323
"@reduxjs/toolkit": "^1.8.1",
2424
"@web3modal/ethers5": "^4.1.1",
25+
"@web3modal/siwe": "^4.1.5",
2526
"assert": "^2.0.0",
2627
"bignumber.js": "^9.1.1",
2728
"bn.js": "^5.2.1",

packages/common-resources/static-resources/src/constant/router.ts

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,12 +481,14 @@ export const DEFI_CONFIG = {
481481
TAIKO: [] as string[],
482482
ETHEREUM: ['LIDO', 'ROCKETPOOL'],
483483
GOERLI: ['ROCKETPOOL'],
484+
SEPOLIA: ['LIDO'],
484485
ARBGOERLI: ['ROCKETPOOL'],
485486
},
486487
MARKETS: {
487488
TAIKO: [] as string[],
488489
ETHEREUM: ['RETH-ETH', 'WSTETH-ETH'],
489490
GOERLI: ['RETH-ETH'],
491+
SEPOLIA: ['WSTETH-ETH'],
490492
ARBGOERLI: ['RETH-ETH'],
491493
},
492494
}
@@ -495,24 +497,28 @@ export const LEVERAGE_ETH_CONFIG = {
495497
TAIKO: [] as string[],
496498
ETHEREUM: ['CIETH'],
497499
GOERLI: ['WSTETH'],
500+
SEPOLIA: ['WSTETH'],
498501
ARBGOERLI: ['WSTETH'],
499502
},
500503
types: {
501504
TAIKO: [] as string[],
502505
ETHEREUM: ['cian'],
503506
GOERLI: ['lido'],
507+
SEPOLIA: ['lido'],
504508
ARBGOERLI: ['lido'],
505509
},
506510
products: {
507511
TAIKO: [] as string[],
508512
ETHEREUM: ['CIAN'],
509513
GOERLI: ['LIDO'],
514+
SEPOLIA: ['LIDO'],
510515
ARBGOERLI: ['LIDO'],
511516
},
512517
MARKETS: {
513518
TAIKO: [] as string[],
514519
ETHEREUM: ['CIETH-ETH'],
515520
GOERLI: ['WSTETH-ETH'],
521+
SEPOLIA: ['WSTETH-ETH'],
516522
ARBGOERLI: ['WSTETH-ETH'],
517523
},
518524
// ['LIDO,ROCKETPOOL', 'CIAN'] : ['ROCKETPOOL', 'LIDO']
@@ -523,6 +529,7 @@ export const DUAL_CONFIG = {
523529
TAIKO: [] as string[],
524530
ETHEREUM: ['PIONEX'],
525531
GOERLI: ['PIONEX'],
532+
SEPOLIA: ['PIONEX'],
526533
ARBGOERLI: ['PIONEX'],
527534
},
528535
}
@@ -885,13 +892,15 @@ export const headerMenuDataMap: { [key: string]: HeaderMenuItemInterface[] } = {
885892
],
886893
ETHEREUM: headerMenuData,
887894
GOERLI: headerMenuData,
895+
SEPOLIA: headerMenuData,
888896
ARBGOERLI: headerMenuData,
889897
}
890898

891899
export const TokenPriceBase = {
892900
TAIKO: '0x0000000000000000000000000000000000000000',
893901
ETHEREUM: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
894902
GOERLI: '0xd4e71c4bb48850f5971ce40aa428b09f242d3e8a',
903+
SEPOLIA: '0xa7bc5a2731803be668090125b5074555f91cbc9d',
895904
ARBGOERLI: '0xd4e71c4bb48850f5971ce40aa428b09f242d3e8a',
896905
}
897906
export const RecordMap: { [key: string]: RecordTabIndex[] } = {
@@ -922,6 +931,19 @@ export const RecordMap: { [key: string]: RecordTabIndex[] } = {
922931
RecordTabIndex.leverageETHRecords,
923932
RecordTabIndex.VaultRecords,
924933
],
934+
SEPOLIA: [
935+
RecordTabIndex.Transactions,
936+
RecordTabIndex.Trades,
937+
RecordTabIndex.Orders,
938+
RecordTabIndex.StopLimitRecords,
939+
RecordTabIndex.AmmRecords,
940+
RecordTabIndex.DefiRecords,
941+
RecordTabIndex.DualRecords,
942+
RecordTabIndex.SideStakingRecords,
943+
RecordTabIndex.BtradeSwapRecords,
944+
RecordTabIndex.leverageETHRecords,
945+
RecordTabIndex.VaultRecords,
946+
],
925947
ARBGOERLI: [
926948
RecordTabIndex.Transactions,
927949
RecordTabIndex.Trades,
@@ -959,6 +981,14 @@ export const AddAssetListMap = {
959981
AddAssetList.FromExchange.key,
960982
AddAssetList.FromAnotherNet.key,
961983
],
984+
SEPOLIA: [
985+
AddAssetList.FromMyL1.key,
986+
AddAssetList.BuyWithCard.key,
987+
AddAssetList.FromOtherL2.key,
988+
AddAssetList.FromOtherL1.key,
989+
AddAssetList.FromExchange.key,
990+
AddAssetList.FromAnotherNet.key,
991+
],
962992
ARBGOERLI: [
963993
AddAssetList.FromMyL1.key,
964994
AddAssetList.BuyWithCard.key,
@@ -986,6 +1016,12 @@ export const SendAssetListMap = {
9861016
SendAssetList.SendAssetToOtherL1.key,
9871017
SendAssetList.SendAssetToAnotherNet.key,
9881018
],
1019+
SEPOLIA: [
1020+
SendAssetList.SendAssetToMyL1.key,
1021+
SendAssetList.SendAssetToL2.key,
1022+
SendAssetList.SendAssetToOtherL1.key,
1023+
SendAssetList.SendAssetToAnotherNet.key,
1024+
],
9891025
ARBGOERLI: [
9901026
SendAssetList.SendAssetToMyL1.key,
9911027
SendAssetList.SendAssetToL2.key,
@@ -1007,6 +1043,12 @@ export const AssetL2TabIndex = {
10071043
AssetTabIndex.RedPacket,
10081044
AssetTabIndex.Rewards,
10091045
],
1046+
SEPOLIA: [
1047+
AssetTabIndex.Tokens,
1048+
AssetTabIndex.Invests,
1049+
AssetTabIndex.RedPacket,
1050+
AssetTabIndex.Rewards,
1051+
],
10101052
ARBGOERLI: [
10111053
AssetTabIndex.Tokens,
10121054
AssetTabIndex.Invests,
@@ -1052,6 +1094,21 @@ export const RouterAllowIndex = {
10521094
RouterMainKey.invest,
10531095
RouterMainKey.vault,
10541096
],
1097+
SEPOLIA: [
1098+
RouterMainKey.lite,
1099+
RouterMainKey.pro,
1100+
RouterMainKey.stoplimit,
1101+
RouterMainKey.btrade,
1102+
RouterMainKey.fiat,
1103+
RouterMainKey.markets,
1104+
RouterMainKey.mining,
1105+
RouterMainKey.redPacket,
1106+
RouterMainKey.l2assets,
1107+
RouterMainKey.layer2,
1108+
RouterMainKey.nft,
1109+
RouterMainKey.invest,
1110+
RouterMainKey.vault,
1111+
],
10551112
ARBGOERLI: [
10561113
RouterMainKey.lite,
10571114
RouterMainKey.pro,
@@ -1086,6 +1143,14 @@ export const ProfileIndex = {
10861143
Layer2RouterID.referralrewards,
10871144
Layer2RouterID.notification,
10881145
],
1146+
SEPOLIA: [
1147+
Layer2RouterID.security,
1148+
Layer2RouterID.forcewithdraw,
1149+
Layer2RouterID.vip,
1150+
Layer2RouterID.contact,
1151+
Layer2RouterID.referralrewards,
1152+
Layer2RouterID.notification,
1153+
],
10891154
ARBGOERLI: [
10901155
Layer2RouterID.security,
10911156
Layer2RouterID.forcewithdraw,
@@ -1129,6 +1194,17 @@ export const L1L2_NAME_DEFINED = {
11291194
L1Token: 'ETH',
11301195
L2Token: 'LRC',
11311196
},
1197+
SEPOLIA: {
1198+
layer2: 'Layer 2',
1199+
l1ChainName: 'Ethereum',
1200+
loopringL2: 'Loopring L2',
1201+
l2Symbol: 'L2',
1202+
l1Symbol: 'L1',
1203+
ethereumL1: 'Ethereum L1',
1204+
loopringLayer2: 'Loopring Layer 2',
1205+
L1Token: 'ETH',
1206+
L2Token: 'LRC',
1207+
},
11321208
ARBGOERLI: {
11331209
layer2: 'Layer 2',
11341210
l1ChainName: 'Ethereum',
@@ -1140,4 +1216,5 @@ export const L1L2_NAME_DEFINED = {
11401216
L1Token: 'ETH',
11411217
L2Token: 'LRC',
11421218
},
1219+
11431220
}

packages/common-resources/static-resources/src/constant/setting.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export const { NetworkMap, ChainTests, MapChainId, ChainIdExtends } = (
125125
return { NetworkMap, ChainTests, MapChainId, ChainIdExtends }
126126
},
127127
{
128-
MapChainId: { 1: 'ETHEREUM', 5: 'GOERLI', 421613: 'ARBGOERLI' },
128+
MapChainId: { 1: 'ETHEREUM', 5: 'GOERLI', 421613: 'ARBGOERLI', 11155111: 'SEPOLIA'},
129129
NetworkMap: {
130130
1: {
131131
label: 'Ethereum',
@@ -139,14 +139,20 @@ export const { NetworkMap, ChainTests, MapChainId, ChainIdExtends } = (
139139
isTest: true,
140140
walletType: 'ETHEREUM',
141141
},
142+
11155111: {
143+
label: 'Sepolia',
144+
chainId: '11155111',
145+
isTest: true,
146+
walletType: 'ETHEREUM',
147+
},
142148
// 421613: {
143149
// label: 'ARBGOERLI',
144150
// chainId: '421613',
145151
// isTest: true,
146152
// walletType: 'ETHEREUM',
147153
// },
148154
},
149-
ChainTests: [5, 421613],
155+
ChainTests: [11155111, 5, 421613],
150156
ChainIdExtends: {
151157
NONETWORK: 'unknown',
152158
},

packages/common-resources/static-resources/src/i18n/en_US/layout.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,5 @@ export default {
145145
labelVaultHomeDes: 'Access the available portfolio',
146146
labelVaultDashboard: 'Dashboard',
147147
labelVaultDashboardDes: 'Manage and trade your assets',
148+
labelVault2: 'Vault',
148149
}

packages/common-resources/static-resources/src/i18n/zh_CN/layout.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,5 @@ export default {
140140
labelVaultHomeDes: 'Access the available portfolio',
141141
labelVaultDashboard: 'Dashboard',
142142
labelVaultDashboardDes: 'Manage and trade your assets',
143+
labelVault2: 'Vault',
143144
}

packages/common-resources/static-resources/src/utils/util.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@ export const getValuePrecisionThousand = (
229229
if (result && !notRemoveEndZero) {
230230
result = addZeroAfterDot(result)
231231
}
232+
if (BigNumber.isBigNumber(result) ) {
233+
result = result.toString()
234+
}
232235

233236
return result
234237
}

packages/component-lib/src/components/toast/index.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,19 @@ import {
55
GoodIcon,
66
InfoIcon,
77
SnackbarMessage,
8-
ToastType,
98
} from '@loopring-web/common-resources'
109
import styled from '@emotion/styled'
1110
import { withTranslation, WithTranslation } from 'react-i18next'
1211
import React from 'react'
1312
import { VendorIconItem } from '../tradePanel'
1413

14+
export enum ToastType {
15+
success = 'success',
16+
error = 'error',
17+
warning = 'warning',
18+
info = 'info',
19+
}
20+
1521
export type TOASTOPEN = {
1622
open: boolean
1723
content: JSX.Element | string
@@ -140,4 +146,3 @@ export const NoticePanelSnackBar = ({
140146
)
141147
}
142148

143-
export { ToastType }

packages/core/src/component/BtnConnect.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
SagaStatus,
2121
} from '@loopring-web/common-resources'
2222
import { changeShowModel } from '../stores/account/reducer'
23+
import { useWeb3Modal } from '@web3modal/ethers5/react'
2324

2425
export const WalletConnectL2Btn = withTranslation(['common'], {
2526
withRef: true,
@@ -90,6 +91,7 @@ export const BtnConnectL1 = withTranslation(['common', 'layout'], {
9091
setLabel(accountStaticCallBack(_btnLabel))
9192
}
9293
}, [accountStatus])
94+
const modal = useWeb3Modal()
9395

9496
return (
9597
<>
@@ -100,9 +102,7 @@ export const BtnConnectL1 = withTranslation(['common', 'layout'], {
100102
fullWidth={true}
101103
style={{ maxWidth: '280px' }}
102104
onClick={() => {
103-
myLog('UN_CONNECT!')
104-
store.dispatch(changeShowModel({ _userOnModel: true }))
105-
store.dispatch(setShowConnect({ isShow: true, step: WalletConnectStep.Provider }))
105+
modal.open()
106106
}}
107107
>
108108
{label !== '' ? (

packages/core/src/hookConnect.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@ const Icon = ({ label = '' }: { label: string }) => {
145145
<ChainETHEREUMIcon sx={{ width: 20, height: 20 }} />
146146
</Avatar>
147147
)
148+
case 'SEPOLIA':
149+
return (
150+
<Avatar component={'span'} variant='circular'>
151+
<>Sepolia</>{/* todo */}
152+
</Avatar>
153+
)
148154
case 'TAIKO':
149155
return (
150156
<Avatar component={'span'} variant='circular'>

0 commit comments

Comments
 (0)