metaplex-foundation / metaplex-program-library

Smart contracts maintained by the Metaplex team
Other
588 stars 513 forks source link

[Bug]: Unknown type mpl_token_metadata::state::Creator is neither found in types nor an Account #349

Closed katopz closed 1 year ago

katopz commented 2 years ago

Which package is this bug report for?

fixed-price-sale

Issue description

  1. goto https://github.com/metaplex-foundation/metaplex-program-library/tree/master/fixed-price-sale/js
  2. run yarn api:gen.
  3. wait and getting error (see log below).
$ solana --version
solana-cli 1.8.17 (src:7d2acbc9; feat:3263758455)

$ anchor --version
anchor-cli 0.21.0

$ cargo --version
cargo 1.59.0 (49d8809dc 2022-02-10)

$ rustc --version
rustc 1.59.0 (9d1b2106e 2022-02-23)

$ rustup toolchain list
stable-x86_64-apple-darwin (default)
nightly-x86_64-apple-darwin
bpf
1.58.1-x86_64-apple-darwin

$ rustup --version
rustup 1.24.3 (ce5817a94 2021-05-31)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.59.0 (9d1b2106e 2022-02-23)`

$ node --version
v16.13.0

Relevant log output

thread 'main' panicked at 'Code not parseable: Error("bump targets should not be provided with init. Please use bump without a target.")', lang/syn/src/idl/file.rs:353:58
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

IDL written to: /Users/katopz/git/katopz/metaplex-program-library/fixed-price-sale/js/idl/fixed_price_sale.json
Generating TypeScript SDK to /Users/katopz/git/katopz/metaplex-program-library/fixed-price-sale/js/src/generated
node:internal/process/promises:246
          triggerUncaughtException(err, true /* fromPromise */);
          ^

AssertionError [ERR_ASSERTION]: Unknown type mpl_token_metadata::state::Creator is neither found in types nor an Account
    at TypeMapper.definedTypesImport (/Users/katopz/git/katopz/metaplex-program-library/node_modules/@metaplex-foundation/solita/dist/src/type-mapper.js:263:190)
    at TypeMapper.mapDefinedType (/Users/katopz/git/katopz/metaplex-program-library/node_modules/@metaplex-foundation/solita/dist/src/type-mapper.js:101:34)
    at TypeMapper.map (/Users/katopz/git/katopz/metaplex-program-library/node_modules/@metaplex-foundation/solita/dist/src/type-mapper.js:125:25)
    at TypeMapper.mapVecType (/Users/katopz/git/katopz/metaplex-program-library/node_modules/@metaplex-foundation/solita/dist/src/type-mapper.js:92:28)
    at TypeMapper.map (/Users/katopz/git/katopz/metaplex-program-library/node_modules/@metaplex-foundation/solita/dist/src/type-mapper.js:119:25)
    at InstructionRenderer.renderIxArgField (/Users/katopz/git/katopz/metaplex-program-library/node_modules/@metaplex-foundation/solita/dist/src/render-instruction.js:22:52)
    at /Users/katopz/git/katopz/metaplex-program-library/node_modules/@metaplex-foundation/solita/dist/src/render-instruction.js:40:34
    at Array.map (<anonymous>)
    at InstructionRenderer.renderIxArgsType (/Users/katopz/git/katopz/metaplex-program-library/node_modules/@metaplex-foundation/solita/dist/src/render-instruction.js:40:14)
    at InstructionRenderer.render (/Users/katopz/git/katopz/metaplex-program-library/node_modules/@metaplex-foundation/solita/dist/src/render-instruction.js:205:32)

Priority this issue should have

Medium (should be fixed soon)

zfedoran commented 2 years ago

Hi @katopz,

I'm not seeing this error anymore when taking the following steps:

1. Take a fresh clone of the repository 2. Go to the fixed-price-sale folder 3. Run anchor build --skip-lint 4. Go to fixed-price-sale/js/ 5. Run yarn install, yarn build, yarn api:gen

Perhaps resolved with 358?

edit: Never mind, still getting that error when making a change. Still cannot create new IDL:

Generating TypeScript SDK to /Users/.../fixed-price-sale/js/src/generated
node:internal/process/promises:265
            triggerUncaughtException(err, true /* fromPromise */);
            ^

AssertionError [ERR_ASSERTION]: Unknown type mpl_token_metadata::state::Creator is neither found in types nor an Account
    at TypeMapper.definedTypesImport (/Users/.../node_modules/@metaplex-foundation/solita/dist/src/type-mapper.js:263:190)
    at TypeMapper.mapDefinedType (/Users/.../node_modules/@metaplex-foundation/solita/dist/src/type-mapper.js:101:34)
    at TypeMapper.map (/Users/.../node_modules/@metaplex-foundation/solita/dist/src/type-mapper.js:125:25)
    at TypeMapper.mapVecType (/Users/.../node_modules/@metaplex-foundation/solita/dist/src/type-mapper.js:92:28)
    at TypeMapper.map (/Users/.../node_modules/@metaplex-foundation/solita/dist/src/type-mapper.js:119:25)
    at InstructionRenderer.renderIxArgField (/Users/.../node_modules/@metaplex-foundation/solita/dist/src/render-instruction.js:22:52)
    at /Users/.../node_modules/@metaplex-foundation/solita/dist/src/render-instruction.js:40:34
    at Array.map (<anonymous>)
    at InstructionRenderer.renderIxArgsType (/Users/.../node_modules/@metaplex-foundation/solita/dist/src/render-instruction.js:40:14)
    at InstructionRenderer.render (/Users/.../node_modules/@metaplex-foundation/solita/dist/src/render-instruction.js:205:32) {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: undefined,
  expected: undefined,
  operator: 'fail'
}
zfedoran commented 2 years ago

@katopz I've sort of worked around this using a similar approach as here: https://github.com/metaplex-foundation/metaplex-program-library/blob/master/candy-machine/program/src/lib.rs#L1333