Skip to content

Commit 378f55d

Browse files
committed
Add tx waiting
1 parent 03cabff commit 378f55d

File tree

5 files changed

+24
-6
lines changed

5 files changed

+24
-6
lines changed

Diff for: pages/_app.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ const moonBaseChain: Chain = {
4949
const { chains, provider, webSocketProvider } = configureChains(
5050
[
5151
moonBaseChain,
52+
// chain.goerli,
5253
// moonRiverChain,
5354
...(process.env.NEXT_PUBLIC_ENABLE_TESTNETS === 'true'
5455
? [moonBaseChain]

Diff for: pages/contract/[contractAddress].tsx

+2
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ const MultiResourceNftCollection: NextPage = () => {
120120
description: "Minting a new RMRK NFT",
121121
confirmations: 1,
122122
})
123+
await tx.wait(1)
123124
}
124125
}
125126

@@ -138,6 +139,7 @@ const MultiResourceNftCollection: NextPage = () => {
138139
description: "Adding a new resource to collection",
139140
confirmations: 1,
140141
})
142+
await tx.wait(1)
141143
}
142144
}
143145

Diff for: pages/contract/[contractAddress]/[tokenId].tsx

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useRouter } from "next/router"
22
import styles from "../../../styles/Home.module.css"
33
import Image from "next/image"
44
import React, { useEffect, useState } from "react"
5-
import { Contract, Signer } from "ethers"
5+
import { Signer } from "ethers"
66
import { useContract, useProvider, useSigner } from "wagmi"
77
import { ConnectButton, useAddRecentTransaction } from "@rainbow-me/rainbowkit"
88
import Resource from "../../../components/resource"
@@ -33,9 +33,7 @@ const MultiResourceNft = () => {
3333
})
3434

3535
useEffect(() => {
36-
console.log(
37-
"getting " + contractAddress + " data for token id: " + tokenId
38-
)
36+
console.log("getting " + contractAddress + " data for token id: " + tokenId)
3937
if (Number(tokenId) >= 0) {
4038
fetchNft().then((nft) => {
4139
setCollectionName(nft.name)
@@ -86,6 +84,7 @@ const MultiResourceNft = () => {
8684
description: "Adding a new resource to collection",
8785
confirmations: 1,
8886
})
87+
await tx.wait(1)
8988
}
9089
}
9190

@@ -99,6 +98,7 @@ const MultiResourceNft = () => {
9998
description: "Rejecting a resource for this NFT",
10099
confirmations: 1,
101100
})
101+
await tx.wait(1)
102102
}
103103
}
104104

@@ -112,6 +112,7 @@ const MultiResourceNft = () => {
112112
description: "Accepting a resource for this NFT",
113113
confirmations: 1,
114114
})
115+
await tx.wait(1)
115116
}
116117
}
117118

@@ -125,6 +126,7 @@ const MultiResourceNft = () => {
125126
description: "Adding a resource to this NFT",
126127
confirmations: 1,
127128
})
129+
await tx.wait(1)
128130
}
129131
}
130132

Diff for: pages/nesting/[contractAddress].tsx

+2
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ const NestingNftCollection: NextPage = () => {
117117
description: "Minting a new RMRK NFT",
118118
confirmations: 1,
119119
})
120+
await tx.wait(1)
120121
}
121122
}
122123

@@ -135,6 +136,7 @@ const NestingNftCollection: NextPage = () => {
135136
description: "Adding a new resource to collection",
136137
confirmations: 1,
137138
})
139+
await tx.wait(1)
138140
}
139141
}
140142

Diff for: pages/nesting/[contractAddress]/[tokenId].tsx

+13-2
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ const NestingNft = () => {
141141
description: "Adding a new resource to collection",
142142
confirmations: 1,
143143
})
144+
await tx.wait(1)
144145
}
145146
}
146147

@@ -154,6 +155,7 @@ const NestingNft = () => {
154155
description: "Rejecting a resource for this NFT",
155156
confirmations: 1,
156157
})
158+
await tx.wait(1)
157159
}
158160
}
159161

@@ -167,6 +169,7 @@ const NestingNft = () => {
167169
description: "Accepting a resource for this NFT",
168170
confirmations: 1,
169171
})
172+
await tx.wait(1)
170173
}
171174
}
172175

@@ -180,6 +183,7 @@ const NestingNft = () => {
180183
description: "Adding a resource to this NFT",
181184
confirmations: 1,
182185
})
186+
await tx.wait(1)
183187
}
184188
}
185189

@@ -193,6 +197,7 @@ const NestingNft = () => {
193197
description: "Transferring child token into this NFT",
194198
confirmations: 1,
195199
})
200+
await tx.wait(1)
196201
}
197202
}
198203

@@ -210,6 +215,7 @@ const NestingNft = () => {
210215
description: "Accepting child for this NFT",
211216
confirmations: 1,
212217
})
218+
await tx.wait(1)
213219
}
214220
}
215221

@@ -223,19 +229,22 @@ const NestingNft = () => {
223229
description: "Rejecting child for this NFT",
224230
confirmations: 1,
225231
})
232+
await tx.wait(1)
226233
}
227234
}
228235

229-
async function removeChild(index: number) {
236+
async function removeChild(childId: number, index: number) {
230237
if (signer instanceof Signer) {
231238
const tx = await nestingContract
232239
.connect(signer)
233240
.removeChild(tokenId, index)
241+
// .unnestChild(tokenId, childId, index)
234242
addRecentTransaction({
235243
hash: tx.hash,
236244
description: "Removing child from this NFT",
237245
confirmations: 1,
238246
})
247+
await tx.wait(1)
239248
}
240249
}
241250

@@ -290,7 +299,9 @@ const NestingNft = () => {
290299
<button
291300
className="btn btn-secondary btn-sm ml-2 "
292301
onClick={() => {
293-
removeChild(index).then((r) => fetchNft())
302+
removeChild(Number(child.tokenId), index).then((r) =>
303+
fetchNft()
304+
)
294305
}}
295306
>
296307
Remove child

0 commit comments

Comments
 (0)