Created
October 3, 2023 21:02
-
-
Save captnseagraves/8458ec3915010227d875d1987fbec42f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { data: addressNFTBalance } = useScaffoldContractRead({ | |
contractName: "NonFungibleFriends", | |
functionName: "balanceOf", | |
args: [targetAddress, connectedAddress], | |
}); | |
console.log("addressNFTBalance", Number(addressNFTBalance)); | |
const numberAddressNFTBalance = Number(addressNFTBalance || 0); | |
if (numberAddressNFTBalance > 0) { | |
let array: number[] = []; | |
for (let i = 0; i < (numberAddressNFTBalance || 0); i++) { | |
const { data: token } = useScaffoldContractRead({ | |
contractName: "NonFungibleFriends", | |
functionName: "tokenOfOwnerByIndex", | |
args: [connectedAddress, targetAddress, BigInt(2)], | |
}); | |
console.log(token); | |
array.push(Number(token)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment