metaplex-foundation / beet

Borsh compatible De/Serializer
https://metaplex-foundation.github.io/beet/
32 stars 13 forks source link

Support for f64 #48

Open pindaroso opened 1 year ago

pindaroso commented 1 year ago

Good afternoon. Am wondering, is there any plan to add support for f64 here? I'm currently running into an issue.

# Somewhat redacted output...
➜  js git:(main) ✗ yarn solita
yarn run v1.22.19
$ solita
Removed existing IDL at x.json.
Disable this by setting 'removeExistingIdl: false' inside the '.solitarc.js' config.
Warning: cargo-build-bpf is deprecated. Please, use cargo-build-sbf
cargo-build-bpf child: ~/.local/share/solana/install/active_release/bin/cargo-build-sbf --arch bpf
    Finished release [optimized] target(s) in 0.26s

IDL written to: x.json
Generating TypeScript SDK to /x/js/generated
node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

AssertionError [ERR_ASSERTION]: Types to map primitive type need to be supported by Beet, f64 is not
    at TypeMapper.assertBeetSupported (/x/node_modules/@metaplex-foundation/solita/dist/src/type-mapper.js:417:29)
    at TypeMapper.mapPrimitiveType (/x/node_modules/@metaplex-foundation/solita/dist/src/type-mapper.js:95:14)
    at TypeMapper.map (/x/node_modules/@metaplex-foundation/solita/dist/src/type-mapper.js:177:25)
    at TypeRenderer.renderTypeField (/x/node_modules/@metaplex-foundation/solita/dist/src/render-type.js:24:52)
    at /x/node_modules/@metaplex-foundation/solita/dist/src/render-type.js:44:34
    at Array.map (<anonymous>)
    at TypeRenderer.renderTypeScriptType (/x/node_modules/@metaplex-foundation/solita/dist/src/render-type.js:44:14)
    at TypeRenderer.renderDataStructs (/x/node_modules/@metaplex-foundation/solita/dist/src/render-type.js:91:37)
    at TypeRenderer.determineIsFixable (/x/node_modules/@metaplex-foundation/solita/dist/src/render-type.js:101:14)
    at determineTypeIsFixable (/x/node_modules/@metaplex-foundation/solita/dist/src/render-type.js:127:21) {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: false,
  expected: true,
  operator: '=='
}

Thank you!

pindaroso commented 1 year ago

Not sure what required, but have this basic PR in

pindaroso commented 1 year ago

@thlorenz Hiya! Bump?

staccDOTsol commented 1 year ago

Hello! I'm not entirely sure, but it seems like you're running into an issue with the @metaplex-foundation/solita package not supporting f64 types. I'm not aware of any plans to add support for f64 at the moment, but you could try reaching out to the package maintainers to see if they have any plans to add support in the future. In the meantime, you could try using a different data type that is supported by the package.