fix(@desktop/wallet): properly handle collectibles api call errors
Fixes #10771
This commit is contained in:
parent
4dd383ffb5
commit
7e0e0e916e
|
@ -9,6 +9,10 @@ const fetchOwnedCollectiblesTaskArg: Task = proc(argEncoded: string) {.gcsafe, n
|
|||
let arg = decode[FetchOwnedCollectiblesTaskArg](argEncoded)
|
||||
try:
|
||||
let response = collectibles.getOpenseaAssetsByOwnerWithCursor(arg.chainId, arg.address, arg.cursor, arg.limit)
|
||||
|
||||
if not response.error.isNil:
|
||||
raise newException(ValueError, "Error getOpenseaAssetsByOwnerWithCursor" & response.error.message)
|
||||
|
||||
let output = %* {
|
||||
"chainId": arg.chainId,
|
||||
"address": arg.address,
|
||||
|
@ -39,6 +43,10 @@ const fetchOwnedCollectiblesFromContractAddressesTaskArg: Task = proc(argEncoded
|
|||
let arg = decode[FetchOwnedCollectiblesFromContractAddressesTaskArg](argEncoded)
|
||||
try:
|
||||
let response = collectibles.getOpenseaAssetsByOwnerAndContractAddressWithCursor(arg.chainId, arg.address, arg.contractAddresses, arg.cursor, arg.limit)
|
||||
|
||||
if not response.error.isNil:
|
||||
raise newException(ValueError, "Error getOpenseaAssetsByOwnerAndContractAddressWithCursor" & response.error.message)
|
||||
|
||||
let output = %* {
|
||||
"chainId": arg.chainId,
|
||||
"address": arg.address,
|
||||
|
@ -67,6 +75,10 @@ const fetchCollectiblesTaskArg: Task = proc(argEncoded: string) {.gcsafe, nimcal
|
|||
let arg = decode[FetchCollectiblesTaskArg](argEncoded)
|
||||
try:
|
||||
let response = collectibles.getOpenseaAssetsByNFTUniqueID(arg.chainId, arg.ids, arg.limit)
|
||||
|
||||
if not response.error.isNil:
|
||||
raise newException(ValueError, "Error getOpenseaAssetsByNFTUniqueID" & response.error.message)
|
||||
|
||||
let output = %* {
|
||||
"chainId": arg.chainId,
|
||||
"collectibles": response.result,
|
||||
|
|
|
@ -32,6 +32,10 @@ const fetchCollectibleOwnersTaskArg: Task = proc(argEncoded: string) {.gcsafe, n
|
|||
let arg = decode[FetchCollectibleOwnersArg](argEncoded)
|
||||
try:
|
||||
let response = collectibles.getCollectibleOwnersByContractAddress(arg.chainId, arg.contractAddress)
|
||||
|
||||
if not response.error.isNil:
|
||||
raise newException(ValueError, "Error getCollectibleOwnersByContractAddress" & response.error.message)
|
||||
|
||||
let output = %* {
|
||||
"chainId": arg.chainId,
|
||||
"contractAddress": arg.contractAddress,
|
||||
|
|
|
@ -50,8 +50,12 @@ const loadTransactionsTask*: Task = proc(argEncoded: string) {.gcsafe, nimcall.}
|
|||
uniqueIds.add(nftId)
|
||||
|
||||
if len(uniqueIds) > 0:
|
||||
let collectiblesResponse = collectibles.getOpenseaAssetsByNFTUniqueID(arg.chainId, uniqueIds, arg.collectiblesLimit).result
|
||||
output["collectibles"] = collectiblesResponse
|
||||
let collectiblesResponse = collectibles.getOpenseaAssetsByNFTUniqueID(arg.chainId, uniqueIds, arg.collectiblesLimit)
|
||||
|
||||
if not collectiblesResponse.error.isNil:
|
||||
raise newException(ValueError, "Error getOpenseaAssetsByNFTUniqueID" & collectiblesResponse.error.message)
|
||||
|
||||
output["collectibles"] = collectiblesResponse.result
|
||||
|
||||
except Exception as e:
|
||||
let errDesription = e.msg
|
||||
|
|
Loading…
Reference in New Issue