Skip to content

Commit

Permalink
Merge pull request #159 from Aletheia-Data/feature/issue-149-near-int…
Browse files Browse the repository at this point in the history
…egration

minor changes
  • Loading branch information
aletheiadata authored Nov 15, 2022
2 parents 8aecdd0 + f3c0ef6 commit 2933e00
Show file tree
Hide file tree
Showing 12 changed files with 142 additions and 118 deletions.
1 change: 0 additions & 1 deletion .env.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# NODE_TLS_REJECT_UNAUTHORIZED=0 # Optional
REACT_APP_API_ENDPOINT=
REACT_APP_API_VERSION=
REACT_APP_BACKEND_URL=
REACT_APP_MORALIS_APP_ID=
REACT_APP_MORALIS_SERVER_URL=
Expand Down
123 changes: 123 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "App-Aletheia-data",
"version": "2.0.0",
"version": "2.0.1",
"homepage": "/",
"repository": {
"type": "git",
Expand Down Expand Up @@ -88,6 +88,8 @@
"devDependencies": {
"@commitlint/cli": "^16.2.3",
"@commitlint/config-conventional": "^16.2.1",
"@magic-ext/near": "^5.0.0",
"@magic-ext/oauth": "^4.0.0",
"@types/bootstrap": "^5.0.4",
"@types/chart.js": "^2.9.29",
"@types/jest": "^26.0.15",
Expand All @@ -109,6 +111,7 @@
"eslint-plugin-react": "^7.29.4",
"eslint-plugin-react-hooks": "^4.3.0",
"husky": "^7.0.4",
"near-api-js": "^1.1.0",
"prettier": "^2.5.0",
"react-rewards": "^2.0.4",
"web3.storage": "^3.5.7"
Expand Down
15 changes: 0 additions & 15 deletions src/_start/helpers/components/GetSinglePageColumns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,8 @@ import moment from "moment";
import { Ktsvg } from "_start/helpers";
import { Record, NFT } from "_start/types";
import { Link } from "react-router-dom";
import { Magic } from "magic-sdk";
import { ConnectExtension } from "@magic-ext/connect";
import Web3 from "web3";
import { CHAIN_ID } from "../../../app/contracts/config";
import { POLYSCAN, OPENSEA } from "../../../setup/web3js";

const customNodeOptions = {
rpcUrl: "https://rpc-mumbai.maticvigil.com/",
chainId: CHAIN_ID,
};

const magic = new Magic(`${process.env.REACT_APP_MAGIC_LINK_API_KEY}`, {
network: customNodeOptions,
locale: "en_US",
extensions: [new ConnectExtension()],
});
const web3 = new Web3(magic.rpcProvider);
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export const getSinglePageColumns = (data: any) => {
return [
Expand Down
16 changes: 1 addition & 15 deletions src/_start/layout/components/header/Topbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,7 @@ import { useTheme } from "../../core";
import { getUserByToken } from "../../../../app/modules/auth/redux/AuthCRUD";
import { useDispatch } from "react-redux";
import * as auth from "../../../../app/modules/auth/redux/AuthRedux";
import { Magic } from "magic-sdk";
import { ConnectExtension } from "@magic-ext/connect";
import Web3 from "web3";
import { CHAIN_ID } from "app/contracts/config";
const customNodeOptions = {
rpcUrl: "https://rpc-mumbai.maticvigil.com/",
chainId: CHAIN_ID,
};

const magic = new Magic(`${process.env.REACT_APP_MAGIC_LINK_API_KEY}`, {
network: customNodeOptions,
locale: "en_US",
extensions: [new ConnectExtension()],
});
const web3 = new Web3(magic.rpcProvider);
import { magic } from "setup/web3js";

export function Topbar() {
const { config } = useTheme();
Expand Down
17 changes: 1 addition & 16 deletions src/_start/partials/layout/sidebar-partials/SidebarGeneral.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,10 @@ import { getFilesType } from "_start/helpers/getFilesType";

import { useReward } from "react-rewards";

import { Magic } from "magic-sdk";
import { ConnectExtension } from "@magic-ext/connect";
import { initSmartContract } from "../../../../setup/web3js";
import { initSmartContract, web3 } from "../../../../setup/web3js";
import Web3 from "web3";
import { CHAIN_ID } from "../../../../app/contracts/config";
import { makeStorageClient } from "setup/web3.storage";

const customNodeOptions = {
rpcUrl: "https://rpc-mumbai.maticvigil.com/",
chainId: CHAIN_ID,
};

const magic = new Magic(`${process.env.REACT_APP_MAGIC_LINK_API_KEY}`, {
network: customNodeOptions,
locale: "en_US",
extensions: [new ConnectExtension()],
});
const web3 = new Web3(magic.rpcProvider);

// TODO: move to global
const colorPDF = "#FFE6E2";

Expand Down
17 changes: 1 addition & 16 deletions src/app/modules/auth/components/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,7 @@ import { useFormik } from "formik";
import * as auth from "../redux/AuthRedux";
import { login } from "../redux/AuthCRUD";
import { toAbsoluteUrl } from "../../../../_start/helpers";
import { Magic } from "magic-sdk";
import { ConnectExtension } from "@magic-ext/connect";
import Web3 from "web3";
import { CHAIN_ID } from "app/contracts/config";

const customNodeOptions = {
rpcUrl: "https://rpc-mumbai.maticvigil.com/",
chainId: CHAIN_ID,
};

const magic = new Magic(`${process.env.REACT_APP_MAGIC_LINK_API_KEY}`, {
network: customNodeOptions,
locale: "en_US",
extensions: [new ConnectExtension()],
});
const web3 = new Web3(magic.rpcProvider);
import { web3 } from "setup/web3js";

const loginSchema = Yup.object().shape({
account: Yup.string()
Expand Down
14 changes: 1 addition & 13 deletions src/app/modules/auth/redux/AuthCRUD.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { AuthModel } from "../models/AuthModel";
import { Magic } from "magic-sdk";
import { ConnectExtension } from "@magic-ext/connect";
import { CHAIN_ID } from "app/contracts/config";
import { web3 } from "setup/web3js";

const API_URL = process.env.REACT_APP_API_ENDPOINT || "api";

Expand Down Expand Up @@ -36,20 +37,7 @@ export function requestPassword(email: string) {

declare let window: any;

const customNodeOptions = {
rpcUrl: "https://rpc-mumbai.maticvigil.com/",
chainId: CHAIN_ID,
};

const magic = new Magic(`${process.env.REACT_APP_MAGIC_LINK_API_KEY}`, {
network: customNodeOptions,
locale: "en_US",
extensions: [new ConnectExtension()],
});

export function getUserByToken() {
const web3 = new Web3(magic.rpcProvider);

return new Promise<any>(async (resolve, reject) => {
// Authorization head should be fulfilled in interceptor.
// Check common redux folder => setupAxios
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ import { Ktsvg, truncate } from "../../../../../_start/helpers";
import { defaultCreateAppData, ICreateAppData } from "./IAppModels";
import config from "../../../../../setup/config";
import Table from "_start/partials/components/Table";
import Web3 from "web3";
import { Magic } from "magic-sdk";
import { ConnectExtension } from "@magic-ext/connect";
import {
getAllSourcesByName,
getAllDepartmentsByName,
Expand All @@ -18,24 +15,13 @@ import {
} from "../../redux/DashboardCRUD";
import { validURL } from "_start/helpers/ValidateURL";
import moment from "moment";
import { CHAIN_ID } from "app/contracts/config";
import { web3 } from "setup/web3js";
interface Props {
show: boolean;
handleClose: () => void;
}
declare let window: any;

const customNodeOptions = {
rpcUrl: "https://rpc-mumbai.maticvigil.com/",
chainId: CHAIN_ID,
};

const magic = new Magic(`${process.env.REACT_APP_MAGIC_LINK_API_KEY}`, {
network: customNodeOptions,
locale: "en_US",
extensions: [new ConnectExtension()],
});

const CreateAppModal: React.FC<Props> = ({ show, handleClose }) => {
const stepperRef = useRef<HTMLDivElement | null>(null);
const stepper = useRef<StepperComponent | null>(null);
Expand Down Expand Up @@ -205,8 +191,6 @@ const CreateAppModal: React.FC<Props> = ({ show, handleClose }) => {
try {
setIsSigning(true);
if (window?.ethereum) {
const web3 = new Web3(magic.rpcProvider);

const msg = "Confirm contribution to Aletheia!";
// eslint-disable-next-line prefer-destructuring
const fromAddress = (await web3.eth.getAccounts())[0];
Expand Down
Loading

0 comments on commit 2933e00

Please sign in to comment.