fix: promised crossbell contract

This commit is contained in:
DIYgod
2022-08-09 22:05:56 +01:00
parent c94396ecf4
commit e03a023bb7
2 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -4,10 +4,10 @@ const indexer = new Indexer()
let contract: Contract | undefined
const getContract = () => {
const getContract = async () => {
if (!contract && typeof window !== "undefined") {
contract = new Contract((<any>window).ethereum)
contract.connect()
await contract.connect()
}
return contract
}
+4 -4
View File
@@ -307,7 +307,7 @@ export async function likePage({
if (!characterId) {
throw notFound(`character not found`)
} else {
return getContract()?.linkNote(
return (await getContract())?.linkNote(
characterId,
pageId.split("-")[0],
pageId.split("-")[1],
@@ -327,7 +327,7 @@ export async function unlikePage({
if (!characterId) {
throw notFound(`character not found`)
} else {
return getContract()?.unlinkNote(
return (await getContract())?.unlinkNote(
characterId,
pageId.split("-")[0],
pageId.split("-")[1],
@@ -373,7 +373,7 @@ export async function mintPage({
address: string
pageId: string
}) {
return getContract()?.mintNote(
return (await getContract())?.mintNote(
pageId.split("-")[0],
pageId.split("-")[1],
address,
@@ -416,7 +416,7 @@ export async function commentPage({
if (!characterId) {
throw notFound(`character not found`)
} else {
return getContract()?.postNoteForNote(
return (await getContract())?.postNoteForNote(
characterId,
{
content,