Giter VIP home page Giter VIP logo

ankr.js's People

Contributors

0xrapid avatar bogatyr285 avatar dhaiwat10 avatar faintsmi1e avatar fasashen avatar kfastov avatar romanankr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ankr.js's Issues

The information retrieved through getNFTsByOwner is different

The metadata information obtained through getNFTsByOwner does not match what is in opensea.

The json below is the NFT information obtained through ankr.

ANKR owner: 0xc8B1735929eDa28822721fd9Bdbb1D3de2b3eab2

{

            "contract": {

                "address": "0x1f47ea34d27ecf77bf04a702fbd9e7b7a4b38024",

                "name": "Merge Machines",

                "symbol": "MERGE",

                "totalSupply": "",

                "tokenType": "ERC721"

            },

            "tokenId": "1128",

            "tokenType": "ERC721",

            "title": "Kinetic #1128",

            "description": "",

            "tokenUri": {

                "raw": "https://mergemachines-data.uc.r.appspot.com/metadata/1128",

                "gateway": "https://mergemachines-data.uc.r.appspot.com/metadata/1128"

            },

            "media": {

                "raw": "https://storage.googleapis.com/merge-machines-images/gif/1128.gif",

                "gatewal": "https://storage.googleapis.com/merge-machines-images/gif/1128.gif"

            },

            "balance": 1

        }

https://opensea.io/assets/ethereum/0x1f47ea34d27ecf77bf04a702fbd9e7b7a4b38024/1128

TypeError: adapter is not a function

I am using Supabase functions (powered by Deno). I am importing @ankr.com/ankr.js using an import map and skypack.dev as follows

{
    "imports": {
        "server": "https://deno.land/[email protected]/http/server.ts",
        "lodash": "https://cdn.skypack.dev/lodash",
        "ethers": "https://cdn.skypack.dev/[email protected]",
        "http_status": "https://deno.land/std/http/http_status.ts",
        "@ankr.com/ankr.js": "https://cdn.skypack.dev/@ankr.com/ankr.js",
    }
}

I am making the following call:

import { AnkrProvider } from "@ankr.com/ankr.js"

const blockchain = [
    'eth',
    'bsc',
    'polygon',
    'avalanche'
]

const provider = new AnkrProvider()

export async function balances(walletAddress: string) {
    return await provider.getAccountBalance({
        blockchain,
        walletAddress
    })
}

Which results in the following error:

TypeError: adapter is not a function
    at dispatchRequest2 (https://cdn.skypack.dev/-/[email protected]/dist=es2019,mode=imports/optimized/axios.js:850:10)
    at Axios.request (https://cdn.skypack.dev/-/[email protected]/dist=es2019,mode=imports/optimized/axios.js:1057:15)
    at Axios.<computed> [as post] (https://cdn.skypack.dev/-/[email protected]/dist=es2019,mode=imports/optimized/axios.js:1081:17)
    at Function.wrap [as post] (https://cdn.skypack.dev/-/[email protected]/dist=es2019,mode=imports/optimized/axios.js:7:15)
    at AnkrProvider2.<anonymous> (https://cdn.skypack.dev/-/@ankr.com/[email protected]/dist=es2019,mode=imports/optimized/@ankr.com/ankrjs.js:131:48)
    at Generator.next (<anonymous>)
    at https://cdn.skypack.dev/-/@ankr.com/[email protected]/dist=es2019,mode=imports/optimized/@ankr.com/ankrjs.js:43:69
    at new Promise (<anonymous>)
    at __awaiter (https://cdn.skypack.dev/-/@ankr.com/[email protected]/dist=es2019,mode=imports/optimized/@ankr.com/ankrjs.js:25:12)
    at AnkrProvider2.send (https://cdn.skypack.dev/-/@ankr.com/[email protected]/dist=es2019,mode=imports/optimized/@ankr.com/ankrjs.js:129:14)

It looks to me like this is an issue with the config of the Axios library.

So far, I have tried to add the regenerator-runtime but it hasn't helped.

default export issue

The issue is with

  • how ES6 modules are emulated in CommonJS
  • how you import the module

ES6 to CommonJS

At the time of writing this, no environment supports ES6 modules natively. When using them in Node.js you need to use something like Babel to convert the modules to CommonJS. But how exactly does that happen?

Many people consider module.exports = ... to be equivalent to export default ... and exports.foo ... to be equivalent to export const foo = .... That's not quite true though, or at least not how Babel does it.

ES6 default exports are actually also named exports, except that default is a "reserved" name and there is special syntax support for it

https://stackoverflow.com/questions/40294870/module-exports-vs-export-default-in-node-js-and-es6

ankr_getAccountBalance returned "not authorized"

I tried to run a shell script in the docs https://www.ankr.com/rpc/advanced-api

curl --location --request POST 'https://rpc.ankr.com/multichain' \ --header 'Content-Type: application/json' \ --data-raw '{ "id": 1, "jsonrpc": "2.0", "method": "ankr_getAccountBalance", "params": { "blockchain": [ "bsc", "eth", "polygon", "avalanche" ], "walletAddress": "0xfa9019df60d3c710d7d583b2d69e18d412257617" } }'

But got error below
{"jsonrpc":"2.0","error":{"code":0,"message":"not authorized"},"id":null}

getNFTsByOwner method doesn't work for some contracts

While testing the SDK, I noticed that the getNFTsByOwner method doesn't work for certain NFTs, I will guess it's because the NFT isn't indexed yet? Not sure!

Working example:

Bscscan link

await provider.getNFTsByOwner({
  blockchain: "bsc",
  walletAddress: "0xe1b852bbec7ab161d554765667814cb3ca0ad142",
  pageSize: 2,
  pageToken: "",
  filter: [
      {
          "0xC3c3B849ED5164Fb626c4a4F78e0675907B2C94E": []
      }
  ]
});

Not working example:

Bscscan link

await provider.getNFTsByOwner({
  blockchain: "bsc",
  walletAddress: "0xe1b852bbec7ab161d554765667814cb3ca0ad142",
  pageSize: 2,
  pageToken: "",
  filter: [
      {
          "0x21Dc6714c4a3fccD67f53453b46e1c892A54C8E7": []
      }
  ]
});

tokenPrice for ETH showing 0 when get account balance

I tried to use this example from the docs but got tokenPrice = 0 for ETH
curl --location --request POST 'https://rpc.ankr.com/multichain' \ --header 'Content-Type: application/json' \ --data-raw '{ "jsonrpc": "2.0", "method": "ankr_getAccountBalance", "params": { "blockchain": "eth", "walletAddress": "0xfa9019df60d3c710d7d583b2d69e18d412257617" }, "id": 1 }'

Current result for ETH tokenPrice

[
...
{
      "blockchain": "eth",
      "tokenName": "Ethereum",
      "tokenSymbol": "ETH",
      "tokenDecimals": 18,
      "tokenType": "NATIVE",
      "holderAddress": "0xfa9019df60d3c710d7d583b2d69e18d412257617",
      "balance": "4.54492462147",
      "balanceRawInteger": "4544924621470000000",
      "balanceUsd": "0",
      "tokenPrice": "0",
      "thumbnail": "https://www.ankr.com/protocol/static/media/eth.3ee8ddd4.svg"
    }
...
]

Expected result for ETH tokenPrice
The current ETH price

Api key and limits

Hi, thanks for this sdk. Just wanted to find out which api key this requires and the limits for the multichain rpc per ip and/or key

Errors when trying to get a token price history from polygon

I'm trying to read a price history from polygon and I just get an error, I doesn't matter with contract address I pass.
Tried already by sdk and api directly.
Tried with the other blockchains and is working, expect polygon.

Example:

    "jsonrpc": "2.0",
    "method": "ankr_getTokenPriceHistory",
    "params": {  
        "blockchain": "polygon",
        "contractAddress": "0x0000000000000000000000000000000000001010",
        "toTimestamp": 1667195581,
        "interval": 6000,
        "limit": 8
    },
    "id": 1
}

Result:
{
    "jsonrpc": "2.0",
    "id": 137,
    "error": {
        "code": -32005,
        "message": "Not found: no prices for token=0x0000000000000000000000000000000000001010"
    }
}

ankr_getAccountBalance is not stable

My problem
I used "@ankr.com/[email protected]" package for get account balance with my premium plan, tried to call ankr_getAccountBalance 10 times, 5 times I got empty returned result

This is my request params
Screenshot 2022-11-07 at 11 23 40

Current result: 5 times got this empty result / total 10 tried requests
Screenshot 2022-11-07 at 11 24 33

Expected
With the same request above the method should return data instead of empty result in the randomly time
image

Missed token returned by ankr_getAccountBalance method

Get account balance by running this

curl --location --request POST 'https://rpc.ankr.com/multichain' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: $$$$$$$$$$$$$$$$$$$$$$' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "ankr_getAccountBalance",
    "params": {  
        "walletAddress": "0xdaf835f11537fca6db91e91c266d153200f46d52",
        "pageSize": 10000
    },
    "id": 1
}'

This is list tokens of 0xdaf835f11537fca6db91e91c266d153200f46d52
image

Expected result
ETH token returned in the result

Current result
Missed ETH token in the result

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.