onflow / nft-catalog

https://www.flow-nft-catalog.com/
The Unlicense
37 stars 13 forks source link

Server error when using library, max interaction with storage has exceeded the limit. Also can't send parameters to methods. #114

Open NTBooks opened 1 year ago

NTBooks commented 1 year ago

Greetings, I'm a web3 dev who makes multichain wallet viewers. This project seemed perfect for what I want to do but I'm having some trouble following the instructions to get it to work.

If I run the following code, I get two different errors:

import flowcat from "flow-catalog";
import fc from "@onflow/flow-cadut";

app.get("/test2", async (req, res) => {
    try {
        const addressMap = await flowcat.getAddressMaps();
        fc.setEnvironment("mainnet");
        const result = await flowcat.scripts.getNftCatalog(addressMap);
        const result2 = await flowcat.scripts.getNftIdsInAccount('0x3b77a836b3b67081');
        res.send(result);
    } catch (ex) {
        res.render("error", { exception: ex.response?.data ? ex.response.data : ex })
    }
});

"result" contains this error:

[null,{"name":"HTTP Request Error","statusCode":400,"errorMessage":"Invalid Flow argument: failed to execute the script on the execution node execution-0ca407c1da940952ebcc02283b60cd97c9a008e111a48ea6cf1ce8f36f1e0153@execution-004.mainnet21.nodes.onflow.org:3569=100: rpc error: code = InvalidArgument desc = failed to execute script: failed to execute script at block (90e7f5552850e08c962c9846950b0699d00c758701784e8254785977de01811e): [Error Code: 1106] error caused by: [Error Code: 1101] cadence runtime error: Execution failed:\nerror: internal error: get program failed: cannot check account freeze status: failed to load account status for the account (30cf5dcf6ea8d379): [Error Code: 1106] max interaction with storage has exceeded the limit (used: 20147306 bytes, limit 20000000 bytes)\ngoroutine 42950176864 [running]:\nruntime/debug.Stack()\n\t/usr/local/go/src/runtime/debug/stack.go:24 +0x65\ngithub.com/onflow/cadence/runtime/er ... golang.org/grpc@v1.46.2/server.go:1283 +0xcfe\ngoogle.golang.org/grpc.(*Server).handleStream(0x10ca2a048c0, {0x28a2600, 0x10d65a364e0}, 0x12599562240, 0x0)\n\t/go/pkg/mod/google.golang.org/grpc@v1.46.2/server.go:1620 +0xa2f\ngoogle.golang.org/grpc.(*Server).serveStreams.func1.2()\n\t/go/pkg/mod/google.golang.org/grpc@v1.46.2/server.go:922 +0x98\ncreated by google.golang.org/grpc.(*Server).serveStreams.func1\n\t/go/pkg/mod/google.golang.org/grpc@v1.46.2/server.go:920 +0x28a\n\n--> 30cf5dcf6ea8d379.AeraNFT\n"}]

And "result2" is this error getNftIdsInAccount => Incorrect number of arguments: found 0 of 1 even though I tried sending the address multiple ways, it never changes.

I would like to use this library to do two simple things: 1) Load a list of collections that are in a wallet address 2) Load the NFTs with metadata for those NFTs either all at once or per collection.

I have an idea for the upcoming hackathon so I would appreciate any assistance. Thank you.

P.S. I have a typical empty nodejs app using express. I installed node 16.13.1 and I also installed the following packages:

    "@onflow/fcl": "^1.2.0",
    "@onflow/types": "^1.0.2",
    "@onflow/util-actor": "^0.0.2",
    "@onflow/util-invariant": "^1.0.2",
    "@onflow/util-uid": "^0.0.1",
    "axios": "^0.27.2",
    "body-parser": "^1.20.0",
    "bootstrap": "^5.2.3",
    "cors": "^2.8.5",
    "dotenv": "^8.2.0",
    "express": "^4.17.1",
    "express-jwt": "^7.7.5",
    "flow-catalog": "^0.1.1",
    "jsonwebtoken": "^8.5.1",
    "node-cron": "^3.0.2",
    "pug": "^3.0.0",
    "random-number-csprng": "^1.0.2",
    "sanitize": "^2.1.2",
    "winston": "^3.8.2"
NTBooks commented 1 year ago

The first issue with the storage exception is still there but I think the arguments was just me missing the types. Thanks for making this great library! I fixed the argument part like this.

args: (arg, t) => [
            arg("0xABC", t.Address)
        ],