Skip to content

Commit

Permalink
fix: fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
TiyoSheng committed Oct 31, 2023
1 parent 41ddf8f commit 3dd32e1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions packages/client/src/mud/createSystemCalls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ export function createSystemCalls(
}
}

const selectUserNft = async (tokenId: any, address: any) => {
const selectUserNft = async (tokenId: any, address: any, nonce: any) => {
try {
const tx = await worldContract.write.selectUserNft([tokenId]);
const tx = await worldContract.write.selectUserNft([tokenId], {nonce});
await waitForTransaction(tx);
return getComponentValue(Player, encodeEntity({ addr: "address" }, { addr: address}));
} catch (error) {
Expand All @@ -93,9 +93,9 @@ export function createSystemCalls(
}
}

const selectLootNFT = async (tokenId: any, address: any) => {
const selectLootNFT = async (tokenId: any, address: any, nonce: any) => {
try {
const tx = await worldContract.write.selectLootNFT([tokenId]);
const tx = await worldContract.write.selectLootNFT([tokenId], {nonce});
await waitForTransaction(tx);
let LootList1Data = getComponentValue(LootList1, encodeEntity({ addr: "address" }, { addr: address}));
let LootList2Data = getComponentValue(LootList2, encodeEntity({ addr: "address" }, { addr: address}));
Expand Down
5 changes: 3 additions & 2 deletions packages/client/src/pages/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,9 @@ const Home = () => {
lootUrl = atobUrl(lootUrl)
setUserUrl(url.image)
setLootUrl(lootUrl.image)

let rep = await Promise.all([selectUserNft(userTokenId, network.account), selectLootNFT(lootTokenId, network.account)])
let nonce = await network.publicClient.getTransactionCount({address: network.account})
console.log(nonce, 'nonce')
let rep = await Promise.all([selectUserNft(userTokenId, network.account, nonce), selectLootNFT(lootTokenId, network.account, nonce + 1)])
console.log(rep, 'rep')
let playerData = rep[0]
let lootData = rep[1]
Expand Down

0 comments on commit 3dd32e1

Please sign in to comment.