Skip to content
This repository has been archived by the owner on Aug 23, 2022. It is now read-only.

Usar scripts HTML ao invés de empacotar na app #142

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@
"date-fns": "2.12.0",
"ethereum-blockies-base64": "1.0.2",
"ethers": "4.0.47",
"ipfs": "0.40.0",
"moment": "2.26.0",
"multicodec": "0.5.6",
"orbit-db": "0.23.1",
"prop-types": "15.7.2",
"react": "16.13.1",
"react-dom": "16.13.1",
Expand Down
2 changes: 2 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="dlx" />
<script src="https://unpkg.com/[email protected]/dist/index.min.js"></script>
<script src="https://unpkg.com/orbit-db/dist/orbitdb.min.js"></script>
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
Expand Down
4 changes: 1 addition & 3 deletions src/helpers/ipfsFactory.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import IPFS from 'ipfs';

// Configuration for IPFS instance
const ipfsConfig = {
repo: process.env.REACT_APP_IPFS_REPO,
Expand Down Expand Up @@ -27,7 +25,7 @@ const ipfsConfig = {
export async function startIpfsInstance(): Promise<any> {
return new Promise((resolve, reject) => {
// Create IPFS instance
const ipfs = new IPFS(ipfsConfig);
const ipfs = new (window as any).Ipfs(ipfsConfig);

ipfs.on('error', (e: any) => reject(e));
ipfs.on('ready', async () => resolve(ipfs));
Expand Down
4 changes: 1 addition & 3 deletions src/helpers/orbitdb/store.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import OrbitDB from 'orbit-db';

// Configuration for the database
const dbConfig = {
// If database doesn't exist, create it
Expand All @@ -19,7 +17,7 @@ export async function store(ipfs: any, namespace: string): Promise<any> {
return new Promise(async (resolve, reject) => {
try {
// Create an OrbitDB instance
const orbitdb = await OrbitDB.createInstance(ipfs);
const orbitdb = await (window as any).OrbitDB.createInstance(ipfs);
// Open (or create) database
const postsDb = await orbitdb.docs(`${namespace}.posts`, dbConfig);
const meetupsDb = await orbitdb.docs(`${namespace}.meetups`, dbConfig);
Expand Down
12 changes: 10 additions & 2 deletions src/react-app-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@
declare module 'truffle-contract';
declare module 'web3';
declare module '3box';
declare module 'ipfs';
declare module 'react-emoji-render';
declare module 'date-format';
declare module 'orbit-db';
declare module 'react-stack-grid';

declare global {
interface Window {
Ipfs: any;
OrbitDB: any;
}
}

// let OrbitDB = window.OrbitDB;
// let Ipfs = window.Ipfs;