Yeah, sorry - I wasn’t able to upload more than one picture at a time. Here’s what the full request looks like in Swift:
func getHeldNFTs(walletAddress:String) {
// Prepare URL
let url = URL(string: "\(moralis.baseEndpoint)\(walletAddress)/nft?chain=\(chain)&format=decimal")
var request = URLRequest(url: url!)
// Set Request Headers
request.setValue(moralis.apiKey, forHTTPHeaderField: "X-API-Key")
// Perform Request
URLSession.shared.dataTask(with: request) {(data, response, error) in
if let responseData = try? JSONDecoder().decode(GetAllNFTResponse.self, from: data!) {
let total = responseData.total
print("\(total)")
}
}
.resume()
}
The original curl request (which works fine anywhere else) is:
curl -v \
-X GET \
-H "User-Agent: HTTPBot-iOS/2021.1" \
-H "X-API-Key: MY-API-KEY" \
"https://deep-index.moralis.io/api/v2/MY-WALLET-ADDRESS/nft?chain=mumbai&format=decimal"