mirror of
https://github.com/uqbar-dao/nectar.git
synced 2024-12-23 08:32:23 +03:00
app_store: move to optimism
This commit is contained in:
parent
53fbce89ec
commit
ea9fa0de7c
@ -39,8 +39,8 @@ use ft_worker_lib::{
|
||||
|
||||
const ICON: &str = include_str!("icon");
|
||||
|
||||
const CHAIN_ID: u64 = 11155111; // sepolia
|
||||
const CONTRACT_ADDRESS: &str = "0x18c39eB547A0060C6034f8bEaFB947D1C16eADF1"; // sepolia
|
||||
const CHAIN_ID: u64 = 10; // optimism
|
||||
const CONTRACT_ADDRESS: &str = "0x52185B6a6017E6f079B994452F234f7C2533787B"; // optimism
|
||||
|
||||
const EVENTS: [&str; 3] = [
|
||||
"AppRegistered(uint256,string,bytes,string,bytes32)",
|
||||
@ -81,7 +81,7 @@ fn fetch_logs(eth_provider: ð::Provider, filter: ð::Filter) -> Vec<eth::Lo
|
||||
}
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "simulation-mode")]
|
||||
#[cfg(feature = "simulation-mode")] // TODO use local testnet
|
||||
vec![]
|
||||
}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -15,7 +15,7 @@
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1.00001, viewport-fit=cover" />
|
||||
<link href='https://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet'>
|
||||
<script type="module" crossorigin src="/main:app_store:sys/assets/index-przgvy-e.js"></script>
|
||||
<script type="module" crossorigin src="/main:app_store:sys/assets/index-LQNA9SRw.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/main:app_store:sys/assets/index-avBSgupm.css">
|
||||
</head>
|
||||
|
||||
|
@ -20,6 +20,7 @@ const connectors: [MetaMask, Web3ReactHooks][] = [
|
||||
declare global {
|
||||
interface ImportMeta {
|
||||
env: {
|
||||
VITE_OPTIMISM_RPC_URL: string;
|
||||
VITE_SEPOLIA_RPC_URL: string;
|
||||
BASE_URL: string;
|
||||
VITE_NODE_URL?: string;
|
||||
@ -38,7 +39,7 @@ const {
|
||||
useProvider,
|
||||
} = metaMaskHooks;
|
||||
|
||||
const RPC_URL = import.meta.env.VITE_SEPOLIA_RPC_URL;
|
||||
const RPC_URL = import.meta.env.VITE_OPTIMISM_RPC_URL;
|
||||
const BASE_URL = import.meta.env.BASE_URL;
|
||||
if (window.our) window.our.process = BASE_URL?.replace("/", "");
|
||||
|
||||
@ -56,15 +57,15 @@ function App() {
|
||||
|
||||
const [packageAbi, setPackageAbi] = useState<PackageStore>(
|
||||
PackageStore__factory.connect(
|
||||
PACKAGE_STORE_ADDRESSES[ChainId.SEPOLIA],
|
||||
PACKAGE_STORE_ADDRESSES[ChainId.OPTIMISM],
|
||||
new ethers.providers.JsonRpcProvider(RPC_URL)) // TODO: get the RPC URL from the wallet
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
provider?.getNetwork().then(network => {
|
||||
if (network.chainId === ChainId.SEPOLIA) {
|
||||
if (network.chainId === ChainId.OPTIMISM) {
|
||||
setPackageAbi(PackageStore__factory.connect(
|
||||
PACKAGE_STORE_ADDRESSES[ChainId.SEPOLIA],
|
||||
PACKAGE_STORE_ADDRESSES[ChainId.OPTIMISM],
|
||||
provider!.getSigner())
|
||||
)
|
||||
}
|
||||
|
@ -8,9 +8,11 @@ export enum ChainId {
|
||||
export const SEPOLIA_OPT_HEX = '0xaa36a7';
|
||||
export const OPTIMISM_OPT_HEX = '0xa';
|
||||
export const SEPOLIA_OPT_INT = '11155111';
|
||||
export const OPTIMISM_OPT_INT = '10';
|
||||
|
||||
// Sepolia (for now)
|
||||
// Optimism (for now)
|
||||
export const PACKAGE_STORE_ADDRESSES = {
|
||||
[ChainId.SEPOLIA]: '0x18c39eB547A0060C6034f8bEaFB947D1C16eADF1',
|
||||
// [ChainId.OPTIMISM]: '0x8f6e1c9C5a0fE0A7f9Cf0e9b3aF1A9c4f5c6A9e0',
|
||||
[ChainId.OPTIMISM]: '0x52185B6a6017E6f079B994452F234f7C2533787B',
|
||||
// [ChainId.SEPOLIA]: '0x18c39eB547A0060C6034f8bEaFB947D1C16eADF1',
|
||||
|
||||
};
|
||||
|
@ -6,7 +6,7 @@ import { useWeb3React } from "@web3-react/core";
|
||||
import SearchHeader from "../components/SearchHeader";
|
||||
import { PageProps } from "../types/Page";
|
||||
import { setChain } from "../utils/chain";
|
||||
import { SEPOLIA_OPT_HEX } from "../constants/chain";
|
||||
import { OPTIMISM_OPT_HEX } from "../constants/chain";
|
||||
import { hooks, metaMask } from "../utils/metamask";
|
||||
import Loader from "../components/Loader";
|
||||
import { toDNSWireFormat } from "../utils/dnsWire";
|
||||
@ -58,7 +58,7 @@ export default function PublishPage({
|
||||
await metaMask.activate().catch(() => { });
|
||||
|
||||
try {
|
||||
setChain(SEPOLIA_OPT_HEX);
|
||||
setChain(OPTIMISM_OPT_HEX);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
@ -100,7 +100,7 @@ export default function PublishPage({
|
||||
|
||||
setLoading("Please confirm the transaction in your wallet");
|
||||
const publisherIdDnsWireFormat = toDNSWireFormat(publisherId);
|
||||
await setChain(SEPOLIA_OPT_HEX);
|
||||
await setChain(OPTIMISM_OPT_HEX);
|
||||
|
||||
// TODO: have a checkbox to show if it's an update of an existing package
|
||||
|
||||
|
@ -40,21 +40,21 @@ export const CHAIN_DETAILS: { [key: string]: Chain } = {
|
||||
|
||||
export const getNetworkName = (networkId: string) => {
|
||||
switch (networkId) {
|
||||
case '1':
|
||||
case '0x1':
|
||||
return 'Ethereum'; // Ethereum Mainnet
|
||||
case '10':
|
||||
case 'a':
|
||||
case '0xa':
|
||||
return 'Optimism'; // Optimism
|
||||
case '42161':
|
||||
return 'Arbitrum'; // Arbitrum One
|
||||
case '11155111':
|
||||
case 'aa36a7':
|
||||
case '0xaa36a7':
|
||||
return 'Sepolia'; // Sepolia Testnet
|
||||
default:
|
||||
return 'Unknown';
|
||||
case '1':
|
||||
case '0x1':
|
||||
return 'Ethereum'; // Ethereum Mainnet
|
||||
case '10':
|
||||
case 'a':
|
||||
case '0xa':
|
||||
return 'Optimism'; // Optimism
|
||||
case '42161':
|
||||
return 'Arbitrum'; // Arbitrum One
|
||||
case '11155111':
|
||||
case 'aa36a7':
|
||||
case '0xaa36a7':
|
||||
return 'Sepolia'; // Sepolia Testnet
|
||||
default:
|
||||
return 'Unknown';
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user