Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

How to store I64 on indexer #1500

Open
chlenc opened this issue Dec 6, 2023 · 6 comments
Open

How to store I64 on indexer #1500

chlenc opened this issue Dec 6, 2023 · 6 comments
Assignees

Comments

@chlenc
Copy link

chlenc commented Dec 6, 2023

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
Copy link
Author

chlenc commented Dec 6, 2023

still, I did storage of i64 using strings
image

@ra0x3
Copy link
Contributor

ra0x3 commented Dec 6, 2023

@chlenc

  • I64 is an indexer scalar type
  • You have redefined I64 in your indexer module
  • You can't do that.
  • Remove the impl I64 line 4 and the error should be resolved

@ra0x3
Copy link
Contributor

ra0x3 commented Dec 6, 2023

@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"

@chlenc
Copy link
Author

chlenc commented Dec 6, 2023

@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
Copy link
Contributor

ra0x3 commented Dec 7, 2023

@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?

@ra0x3 ra0x3 self-assigned this Dec 7, 2023
@chlenc
Copy link
Author

chlenc commented Dec 11, 2023

@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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants