DefiantLabs / cosmos-tax-cli

An opensource cosmos tax tool!
https://defiantlabs.net
Apache License 2.0
25 stars 7 forks source link

Support for api key #493

Closed wojciechowskip closed 11 months ago

wojciechowskip commented 12 months ago

How I can pass or extend indexer to support node address with api key in that form? baseUrl/apiKey I tried different options like: 1) baseUrl/apiKey it gave me 'missing port in address' 2) baseUrl:443/apiKey it gave me Error querying chain status. error="error unmarshalling: invalid character '<' looking for beginning of value" 3) `baseUrl/apiKey:443 it gave me 'missing port in address'

How to deal with that?

danbryan commented 12 months ago

it should accept any valid url. I personally use notionals nodes which do api keys in this format..

https://a-osmosis--MYKEY.gw.notionalapi.com:443

and this works.

Are you able to share the URL you are trying, or create me a test api key similar to yours, and i can confirm if it works?

wojciechowskip commented 12 months ago

The thing is that node I am trying to connect has 'convention' of prefixing their endpoints with 'apikey', this is example address: address-of-node.com/apiKey.

I removed all port checks in indexer (because it's trying to add port as a sufix like address-of-node.com/apiKey:443 and that makes no sense as node doesnt see my api key) but looks like method in lens itself is blocking me as it requires passing rpc url + port at the end.

wojciechowskip commented 12 months ago

@danbryan I am also wondering if I can scan cosmoshub network only by updating configuration for indexer? I mean api, rpc uris, prefixes for accounts, chain id. Or does indexer require me to do some code changes?

danbryan commented 11 months ago

I believe it should work on cosmoshub. It has most of the same common message types as osmosis, please let me know if you see differently!

wojciechowskip commented 11 months ago

@danbryan so basically I am updating indexer arguments to this (rest of arguments I leave as they are):

      --base.start-block 16439107 \
      --base.api https://cosmoshub-4-archive.api.l0vd.com:443/myApiKey \
      --lens.rpc https://cosmoshub-4-archive.rpc.l0vd.com:443/myApiKey \
      --lens.account-prefix cosmo \
      --lens.chain-id cosmoshub-4 \
      --lens.chain-name CosmosHub \

I am setting this for both update-denoms and index commands. I am getting parse error while running docker compose:

cosmos-indexer-indexer-1   | 11:08PM INF Running denom update task for all supported chains
cosmos-indexer-indexer-1   | 11:08PM INF Running denom update task for chain osmosis-1
cosmos-indexer-indexer-1   | 11:08PM INF Updating Omsosis specific denoms
cosmos-indexer-indexer-1   | 11:08PM INF Running denom update task for chain juno-1
cosmos-indexer-indexer-1   | 11:08PM INF Updating Juno specific denoms
cosmos-indexer-indexer-1   | 11:08PM INF Running post-update denom validations
cosmos-indexer-indexer-1   | 11:08PM INF All denoms have at least 1 corresponding denom_unit
cosmos-indexer-indexer-1   | 11:08PM INF Updating IBC Denom Metadata from https://cosmoshub-4-archive.api.l0vd.com:443/myApiKey
cosmos-indexer-indexer-1   | 11:08PM FTL Error querying chain status. error="error unmarshalling: invalid character '<' looking for beginning of value"
cosmos-indexer-indexer-1 exited with code 1

Example api key - 1JWLUPBxdvd1Njr0WG so it would be:

--base.api https://cosmoshub-4-archive.api.l0vd.com:443/1JWLUPBxdvd1Njr0WG \
--lens.rpc https://cosmoshub-4-archive.rpc.l0vd.com:443/1JWLUPBxdvd1Njr0WG \

Not sure if thats a problem with api key as a part of url or I used wrong configuration to traverse cosmoshub-4.

danbryan commented 11 months ago
FTL Error querying chain status. error="error unmarshalling: invalid character '<' looking for beginning of value"

means the RPC server did not return valid json data. Could be the RPC server is throttling you. I would try taking your workers down to 1, and set the throttle to something conservative like 10 seconds and see if the issue persists.

danbryan commented 11 months ago

also, i think some of your flags are using legacy value names. @pharr117 any thoughts on this. @wojciechowskip any interest in doing a 30m working session with us, and we should be able to help you index cosmohub-4 for taxable events. If so ,send me a DM on twitter and ill send you a cal link.

wojciechowskip commented 11 months ago

I will dm you then on twitter :) I am trying to use indexer based on docker compose which is currently provided on master branch, if there is more up-to-date version and example - I would love to take a look, not to waste your time guys!

wojciechowskip commented 11 months ago

@danbryan unfortunately I cannot dm you on twitter :) Could you leave a message? My acc https://twitter.com/Patryk42719793

danbryan commented 11 months ago

Added ya, should be able to now