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

Import contractMap from '@metamask/contract-metadata' #29940

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 19 additions & 0 deletions Dockerfile.centos7-jdk8
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Use CentOS 7 as the base image
FROM centos:centos7

# Add JDK 8 and unzip RPM
ADD jdk-8u301-linux-x64.tar.gz /usr/local/
ADD unzip-6.0-21.el7.x86_64.rpm /tmp

# Install git and clean up
RUN yum -y install git \
&& yum clean all

# Install unzip RPM and clean up
RUN rpm -ivh /tmp/unzip-6.0-21.el7.x86_64.rpm \
&& rm /tmp/unzip-6.0-21.el7.x86_64.rpm

# Set environment variables for Java
ENV JAVA_HOME /usr/local/jdk1.8.0_301
ENV CLASSPATH $JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
ENV PATH $PATH:$JAVA_HOME/bin
35 changes: 35 additions & 0 deletions Dockerfile.ubuntu
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Use Ubuntu 18.04 as the base image
FROM ubuntu:18.04

# Set the working directory
WORKDIR /usr

# Install necessary dependencies
RUN apt-get update && apt-get install -y \
nodejs \
npm \
curl

# Create directory for Java
RUN mkdir /usr/local/java

# Add JDK 8
ADD jdk-8u301-linux-x64.tar.gz /usr/local/java/

# Set environment variables for Java
ENV JAVA_HOME /usr/local/java/jdk1.8.0_301
ENV JRE_HOME $JAVA_HOME/jre
ENV CLASSPATH $JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH
ENV PATH $JAVA_HOME/bin:$PATH

# Copy the project files to the container
COPY . .

# Install project dependencies
RUN npm install

# Expose the port the app runs on
EXPOSE 3000

# Start the application
CMD ["node", "server.js"]
35 changes: 35 additions & 0 deletions Dockerfile.ubuntu-jdk8
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Use Ubuntu 18.04 as the base image
FROM ubuntu:18.04

# Set the working directory
WORKDIR /usr

# Install necessary dependencies
RUN apt-get update && apt-get install -y \
nodejs \
npm \
curl

# Create directory for Java
RUN mkdir /usr/local/java

# Add JDK 8
ADD jdk-8u301-linux-x64.tar.gz /usr/local/java/

# Set environment variables for Java
ENV JAVA_HOME /usr/local/java/jdk1.8.0_301
ENV JRE_HOME $JAVA_HOME/jre
ENV CLASSPATH $JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH
ENV PATH $JAVA_HOME/bin:$PATH

# Copy the project files to the container
COPY . .

# Install project dependencies
RUN npm install

# Expose the port the app runs on
EXPOSE 3000

# Start the application
CMD ["node", "server.js"]
16 changes: 16 additions & 0 deletions app/scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import { storeAsStream } from '@metamask/obs-store';
import { isObject } from '@metamask/utils';
import PortStream from 'extension-port-stream';
import { NotificationServicesController } from '@metamask/notification-services-controller';
import contractMap from '@metamask/contract-metadata';
import { toChecksumAddress } from 'ethereumjs-util';

import {
ENVIRONMENT_TYPE_POPUP,
Expand Down Expand Up @@ -1366,3 +1368,17 @@ async function initBackground() {
if (!process.env.SKIP_BACKGROUND_INITIALIZATION) {
initBackground();
}

function imageElFor(address) {
const metadata = contractMap[toChecksumAddress(address)];
if (metadata?.logo) {
const fileName = metadata.logo;
const path = `${__dirname}/images/contract/${fileName}`;
const img = document.createElement('img');
img.src = path;
img.style.width = '100%';
return img;
}
}

imageElFor("0x06012c8cf97BEaD5deAe237070F9587f8E7A266d");
Loading