FuelLabs / fuel-indexer

🗃 The Fuel indexer is a standalone service that can be used to index various components of the Fuel blockchain.
https://docs.fuel.network/docs/indexer/
140 stars 66 forks source link

How to store I64 on indexer #1500

Open chlenc opened 7 months ago

chlenc commented 7 months ago

How to store I64 on indexer?

Hi guys, in my indexer I am going to store values with I64 type, on my contract, I have custom I64, I try to do like here but, I am having that error on indexer's lib.rs file

image

Looks like in the explorer example you are using I64 from sway libs, and I need to add some code to allow usage of my custom I64 standard

image

toolchain

Default host: aarch64-apple-darwin
fuelup home: /Users/alexey/.fuelup

installed toolchains
--------------------
latest-aarch64-apple-darwin (default)
beta-4-aarch64-apple-darwin
my-custom-toolchain

active toolchain
-----------------
latest-aarch64-apple-darwin (default)
  forc : 0.46.1
    - forc-client
      - forc-deploy : 0.46.1
      - forc-run : 0.46.1
    - forc-doc : 0.46.1
    - forc-explore : 0.28.1
    - forc-fmt : 0.46.1
    - forc-index : 0.24.1
    - forc-lsp : 0.46.1
    - forc-tx : 0.46.1
    - forc-wallet : 0.3.0
  fuel-core : 0.20.5
  fuel-core-keygen : Error getting version string
  fuel-indexer : 0.24.1

fuels versions
---------------
forc : 0.45
forc-wallet : 0.45
chlenc commented 7 months ago

still, I did storage of i64 using strings

image
ra0x3 commented 7 months ago

@chlenc

ra0x3 commented 7 months ago

@chlenc

chlenc commented 7 months ago

@chlenc

  • Here is a list of reserved names

    • We enforce this in things like GraphQL schema and ABI JSON

    • However we didn't enforce this in the entire Rust module because we didn't think it would happen

    • We can update with an error to say "This is a reserved name"

removed I64 impl on lines 4-8 and now have this error

image

If trying to make .into() have this error

image
ra0x3 commented 7 months ago

@chlenc

chlenc commented 7 months ago

@chlenc

  • To be clear, these issues are because of your incorrect usage of Rust, not because of the indexer (just want to make that clear)
  • If the value is an I64 why are you trying to convert it into a String? Why not just use I64 in your schema? Is there a problem with that?

I'm trying to use I64, but it gives the next error to me

image image