File tree Expand file tree Collapse file tree 8 files changed +173
-96
lines changed Expand file tree Collapse file tree 8 files changed +173
-96
lines changed Original file line number Diff line number Diff line change 22
22
"devDependencies" : {
23
23
"@rollup/plugin-commonjs" : " ^21.0.1" ,
24
24
"@rollup/plugin-node-resolve" : " ^13.0.6" ,
25
+ "@rollup/plugin-replace" : " ^6.0.2" ,
25
26
"ethers" : " ^5.5.1" ,
26
27
"rollup" : " ^2.58.0" ,
27
28
"rollup-plugin-copy" : " ^3.4.0" ,
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import css from 'rollup-plugin-css-only';
7
7
import copy from 'rollup-plugin-copy' ;
8
8
import gzipPlugin from 'rollup-plugin-gzip' ;
9
9
import { brotliCompressSync } from 'zlib' ;
10
+ import replace from '@rollup/plugin-replace' ;
10
11
11
12
const production = ! process . env . ROLLUP_WATCH ;
12
13
const hash = String ( require ( 'child_process' ) . execSync ( 'git rev-parse --short HEAD' ) ) . trim ( ) ; // append short git commit to bundles
@@ -48,6 +49,12 @@ export default {
48
49
}
49
50
} ) ,
50
51
52
+ replace ( {
53
+ preventAssignment : true ,
54
+ 'process.env.DEFAULT_CHAIN_ID' : process . env . DEFAULT_CHAIN_ID || 31338 ,
55
+ 'process.env.DEFAULT_RPC_URL' : JSON . stringify ( process . env . DEFAULT_RPC_URL || 'http://localhost:8555' ) ,
56
+ } ) ,
57
+
51
58
production && gzipPlugin ( ) ,
52
59
production && gzipPlugin ( {
53
60
customCompression : content =>
Original file line number Diff line number Diff line change 11
11
12
12
import { shortAddress , showModal } from ' ../lib/utils'
13
13
14
+ import {CHAINDATA } from ' ../lib/constants'
15
+
14
16
onMount (async () => {
15
17
await checkMetamaskSession ();
16
18
});
17
19
20
+ // TODO (autonom): Find another solution when we support multiple L2 chains
21
+ const DEFAULT_CHAIN_ID = Number (process .env .DEFAULT_CHAIN_ID );
22
+ const CHAIN_NAME = CHAINDATA [DEFAULT_CHAIN_ID ]? .name ;
23
+
18
24
< / script>
19
25
20
26
< style>
56
62
< div class = ' wallet' >
57
63
58
64
{#if $address && $wrongNetwork}
59
- <div class ='wrong-network' on:click ={() => {switchChains ()}}>Switch to Arbitrum </div >
65
+ < div class = ' wrong-network' on: click= {() => {switchChains ()}}> Switch to { CHAIN_NAME } < / div>
60
66
{/ if }
61
67
62
68
{#if $address}
Original file line number Diff line number Diff line change 1
1
<script >
2
2
import Modal from ' ../modals/Modal.svelte'
3
- import { connectMetamask , connectWalletConnect } from ' ../../lib/wallet'
3
+ import { connectMetamask } from ' ../../lib/wallet'
4
4
5
5
</script >
6
6
50
50
<div >MetaMask</div >
51
51
</div >
52
52
53
- <div class ='row' on:click ={() => {connectWalletConnect ()}} data-intercept =" true" >
54
- <img src =' https://raw.githubusercontent.com/WalletConnect/walletconnect-assets/master/Icon/Blue%20(Default)/Icon.svg' >
55
- <div >WalletConnect</div >
56
- </div >
57
-
58
53
</Modal >
Original file line number Diff line number Diff line change 3
3
import Button from ' ../layout/Button.svelte'
4
4
5
5
import { switchChains } from ' ../../lib/wallet'
6
+
7
+ import {CHAINDATA } from ' ../../lib/constants'
8
+
9
+ // TODO (autonom): Find another solution when we support multiple L2 chains
10
+ const DEFAULT_CHAIN_ID = Number (process .env .DEFAULT_CHAIN_ID );
11
+ const CHAIN_NAME = CHAINDATA [DEFAULT_CHAIN_ID ]? .name ;
6
12
< / script>
7
13
8
14
< style>
17
23
< Modal title= ' Invalid Network' showHeader= {true } showCancel= {true }>
18
24
19
25
< div class = ' note' >
20
- Select Arbitrum as your wallet's network to trade or pool on CAP.
26
+ Select { CHAIN_NAME } as your wallet' s network to trade or pool on CAP.
21
27
</div>
22
28
23
- <Button wrap ={true } onClick ={() => {switchChains ()}} label ={` Switch to Arbitrum ` } />
29
+ <Button wrap={true} onClick={() => {switchChains()}} label={`Switch to ${CHAIN_NAME} `} />
24
30
25
31
</Modal>
Original file line number Diff line number Diff line change @@ -73,7 +73,9 @@ export const ABIS = {
73
73
74
74
export const CHAINDATA = {
75
75
31338 : {
76
+ name : 'Local Chain' ,
76
77
label : 'localhost' ,
78
+ rpc : 'http://localhost:8555' ,
77
79
router : CONTRACT_ADDRESSES . dexes . cap . router ,
78
80
explorer : 'http://localhost:8555' ,
79
81
currencies : {
@@ -87,22 +89,4 @@ export const CHAINDATA = {
87
89
} ,
88
90
cap : CONTRACT_ADDRESSES . dexes . cap . token . cap
89
91
}
90
- // 42161: {
91
- // label: 'Arbitrum',
92
- // router: '0x5ABFF8F8D5b13253dCAB1e427Fdb3305cA620119',
93
- // explorer: 'https://arbiscan.io',
94
- // rpc: 'https://arb1.arbitrum.io/rpc', // for walletconnect
95
- // currencies: {
96
- // weth: ADDRESS_ZERO,
97
- // usdc: '0xff970a61a04b1ca14834a43f5de4533ebddb5cc8'
98
- // },
99
- // poolInception: {
100
- // weth: 1637154307000,
101
- // usdc: 1637154307000,
102
- // cap: 1637154307000
103
- // },
104
- // cap: '0x031d35296154279DC1984dCD93E392b1f946737b'
105
- // }
106
92
}
107
-
108
- console . log ( 'chain data: ' , CHAINDATA ) ;
You can’t perform that action at this time.
0 commit comments