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

fix: moralis-v1 imports #272

Open
wants to merge 3 commits 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"husky": "^7.0.4",
"jest": "^27.4.5",
"lint-staged": "^12.1.2",
"moralis": "1.8.0",
"moralis-v1": "^1.11.0",
"prettier": "^2.5.1",
"rollup": "^2.61.1",
"rollup-plugin-cleaner": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/config/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { components } from "moralis/types/generated/web3Api";
import { components } from "moralis-v1/types/generated/web3Api";
export type ApiChain = components["schemas"]["chainList"];

export const DEFAULT_API_CHAIN: ApiChain = "eth";
Expand Down
2 changes: 1 addition & 1 deletion src/context/MoralisContext/MoralisContext.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createContext } from "react";
import MoralisType from "moralis";
import MoralisType from "moralis-v1";
import {
AuthenticateOptions,
Authentication,
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/core/useMoralis/_useMoralisAuth.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState, useCallback, useEffect } from "react";
import { setMultipleDataToUser, SetUserData } from "./utils/setUserData";
import { AuthError } from "../../../context/MoralisContext/MoralisContext";
import MoralisType from "moralis";
import MoralisType from "moralis-v1";
import { Environment } from "./_useMoralisInit";

export enum AuthenticationState {
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/core/useMoralis/_useMoralisInit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useCallback, useEffect, useRef, useState } from "react";
import MoralisImport from "moralis";
import MoralisImport from "moralis-v1";
import { ReactMoralisError } from "../../../Errors";

export type Environment = "browser" | "native";
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/core/useMoralis/_useMoralisUser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import MoralisType from "moralis";
import MoralisType from "moralis-v1";
import { useCallback, useState } from "react";
import { NotAuthenticatedError, ReactMoralisError } from "../../../Errors";
import { setMultipleDataToUser, SetUserData } from "./utils/setUserData";
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/core/useMoralis/_useMoralisWeb3.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState, useCallback, useEffect, useMemo } from "react";
import MoralisType from "moralis";
import MoralisType from "moralis-v1";

export type Web3EnableOptions = MoralisType.EnableOptions & {
onError?: (error: Error) => void;
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/core/useMoralis/utils/setUserData.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import MoralisType from "moralis";
import MoralisType from "moralis-v1";
import { ValidationError } from "../../../../Errors";

// UserData can accept all these types
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/core/useMoralisFile/useMoralisFile.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import MoralisType from "moralis";
import MoralisType from "moralis-v1";
import { useCallback, useState } from "react";
import { useMoralis } from "../useMoralis";

Expand Down
2 changes: 1 addition & 1 deletion src/hooks/core/useMoralisObject/useNewMoralisObject.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import MoralisType from "moralis";
import MoralisType from "moralis-v1";
import { useCallback, useState } from "react";
import { useMoralis } from "../useMoralis";

Expand Down
2 changes: 1 addition & 1 deletion src/hooks/core/useMoralisQuery/_useSafeUpdatedQuery.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import MoralisType from "moralis";
import MoralisType from "moralis-v1";
import { useMemo } from "react";
import { useMoralis } from "../useMoralis";
import { Query } from "../../../utils/genericQuery";
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/core/useMoralisQuery/useMoralisQuery.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { WritableDraft } from "immer/dist/internal";
import MoralisType from "moralis";
import MoralisType from "moralis-v1";
import { useCallback } from "react";
import { DefaultQueryAttribute, Query } from "../../../utils/genericQuery";
import { useMoralis } from "../useMoralis";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import MoralisType from "moralis";
import MoralisType from "moralis-v1";
import { useEffect } from "react";
import { useMoralis } from "../useMoralis";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import MoralisType from "moralis";
import MoralisType from "moralis-v1";
import { useContext, useEffect, useRef, useState } from "react";
import { MoralisContext } from "../../../context";
import { Query } from "../../../utils/genericQuery";
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/web3ApiWrappers/useApiContract/useApiContract.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import MoralisType from "moralis/types";
import MoralisType from "moralis-v1/types";
import {
useMoralisWeb3Api,
useMoralisWeb3ApiCall,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
UseMoralisWeb3ApiCallOptions,
} from "../../core/useMoralisWeb3Api";
import { DEFAULT_API_CHAIN } from "../../../config";
import MoralisType from "moralis";
import MoralisType from "moralis-v1";
import { isValidApiChain } from "../../../utils/isValidApiChain";

export interface UseERC20BalancesParams
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
UseMoralisWeb3ApiCallOptions,
} from "../../core/useMoralisWeb3Api";
import { DEFAULT_API_CHAIN } from "../../../config";
import MoralisType from "moralis";
import MoralisType from "moralis-v1";
import { isValidApiChain } from "../../../utils/isValidApiChain";

export interface UseERC20TransfersParams
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/web3ApiWrappers/useNFTBalances/useNFTBalances.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useMemo } from "react";
import MoralisType from "moralis";
import MoralisType from "moralis-v1";
import { useMoralis } from "../../core/useMoralis";
import {
useMoralisWeb3Api,
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/web3ApiWrappers/useNFTTransfers/useNFTTransfers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import MoralisType from "moralis";
import MoralisType from "moralis-v1";
import { useMoralis } from "../../core/useMoralis";
import {
useMoralisWeb3Api,
Expand All @@ -10,7 +10,7 @@ import { isValidApiChain } from "../../../utils/isValidApiChain";

export interface UseNFTTransfersParams
extends Omit<
Parameters<typeof MoralisType.Web3API["account"]["getTokenTransfers"]>[0],
Parameters<typeof MoralisType.Web3API["account"]["getNFTTransfers"]>[0],
"address"
> {
address?: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import MoralisType from "moralis/types";
import MoralisType from "moralis-v1/types";
import { useMemo } from "react";
import { DEFAULT_API_CHAIN } from "../../../config";
import { isValidApiChain } from "../../../utils/isValidApiChain";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import MoralisType from "moralis";
import MoralisType from "moralis-v1";
import { useMoralis } from "../../core/useMoralis";
import {
useMoralisWeb3Api,
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/web3ApiWrappers/useTokenPrice/useTokenPrice.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useMemo } from "react";
import MoralisType from "moralis";
import MoralisType from "moralis-v1";
import { tokenValueTxt, toUsd } from "../../../utils/formatters";
import {
useMoralisWeb3Api,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/genericQuery.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import MoralisType from "moralis";
import MoralisType from "moralis-v1";

export type DefaultQueryAttribute = MoralisType.Attributes;

Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7246,10 +7246,10 @@ modify-values@^1.0.0:
resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022"
integrity sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==

moralis@1.8.0:
version "1.8.0"
resolved "https://registry.yarnpkg.com/moralis/-/moralis-1.8.0.tgz#fc0aee2fdccde195e04e9395fa78bac97c1b133f"
integrity sha512-p8V5Ur4oLymweySUh+TBuYmQVDeqnNO3+Lk+VfPorGJsmbcer6xVy6MHHNinl1zhhWiCJNpc+XWot5wAcMb4QA==
moralis-v1@^1.11.0:
version "1.11.0"
resolved "https://registry.yarnpkg.com/moralis-v1/-/moralis-v1-1.11.0.tgz#fc8f5055d14b91c8301337ab58b331fa6e4b4f60"
integrity sha512-6FxKTdh1kOLme+R5Z6kIT++MHwZzTrYGhiS/E7hRnapomY423RThrxsnYgs7XnLEe8g2TLvA4Sx0+DIgwYWTjg==
dependencies:
"@babel/runtime" "7.16.7"
"@babel/runtime-corejs3" "7.16.8"
Expand Down