refactor: import indexer from @crossbell/indexer

This commit is contained in:
Runjuu
2023-01-13 09:58:32 -08:00
parent 68a15776f3
commit 500f73f654
4 changed files with 6 additions and 27 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
import { notFound } from "~/lib/server-side-props"
import { PageVisibilityEnum, Notes, Note } from "~/lib/types"
import unidata from "~/queries/unidata.server"
import { indexer } from "~/queries/crossbell"
import { indexer } from "@crossbell/indexer"
import { NoteEntity, CharacterEntity, ListResponse } from "crossbell.js"
import { getStorage, getKeys } from "~/lib/storage"
import axios from "axios"
+1 -1
View File
@@ -6,7 +6,7 @@ import type Unidata from "unidata.js"
import type { Profiles as UniProfiles } from "unidata.js"
import { createClient } from "@urql/core"
import axios from "axios"
import { indexer } from "~/queries/crossbell"
import { indexer } from "@crossbell/indexer"
import type { LinkEntity, NoteEntity, Contract } from "crossbell.js"
import { CharacterOperatorPermission } from "crossbell.js"
+4
View File
@@ -15,11 +15,15 @@ import {
import { InitContractProvider } from "@crossbell/contract"
import { useRefCallback } from "@crossbell/util-hooks"
import NextNProgress from "nextjs-progressbar"
import { Network } from "crossbell.js"
import { IPFS_GATEWAY } from "~/lib/env"
import { toGateway } from "~/lib/ipfs-parser"
import { connectors, provider } from "~/lib/wallet-config"
import { createIDBPersister } from "~/lib/persister.client"
Network.setIpfsGateway(IPFS_GATEWAY)
const wagmiClient = createClient({
autoConnect: true,
connectors,
-25
View File
@@ -1,25 +0,0 @@
import { useAccount } from "wagmi"
import { Contract, Indexer, Network } from "crossbell.js"
import { IPFS_GATEWAY } from "../lib/env"
Network.setIpfsGateway(IPFS_GATEWAY)
const indexer = new Indexer()
let contract: Contract
const useContract = () => {
const { connector, isConnected } = useAccount()
if (isConnected && connector) {
connector?.getProvider().then(async (provider) => {
contract = new Contract(provider)
await contract.connect()
})
} else {
contract = new Contract()
contract.connect()
}
return contract
}
export { indexer, useContract }