Skip to content

Generate request builder error: #116

@silicology1

Description

@silicology1
use wasm_client_anchor::create_program_client;
use wasm_client_anchor::create_program_client_macro;

// 1. Generate the main client struct, pointing to your program's ID
create_program_client!(symbiosky_contract::ID, MyProgramClient);

// 2. Create a macro that will generate request builders
create_program_client_macro!(symbiosky_contract, MyProgramClient);

// 3. For each instruction in your program, generate a request builder.
//    - Use "optional:args" if the instruction struct has no fields.
//    - Omit it if the instruction struct has fields.
my_program_client_request_builder!(InitializeConfig);

Error

error[E0106]: missing lifetime specifier
  --> wasm-client/src/lib.rs:13:1
   |
13 | my_program_client_request_builder!(InitializeConfig);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected named lifetime parameter
   |
   = note: this error originates in the macro `$crate::base_create_request_builder` which comes from the expansion of the macro `my_program_client_request_builder` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider using the `'a` lifetime
  --> /home/amiya/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wasm_client_anchor-0.9.0/src/macros.rs:60:17
   |
60 |                 pub args: ::<'a>$program::instruction::$name_prefix,
   |                             ++++

error[E0106]: missing lifetime specifier
  --> wasm-client/src/lib.rs:13:1
   |
13 | my_program_client_request_builder!(InitializeConfig);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected named lifetime parameter
   |
   = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
   = note: this error originates in the macro `$crate::base_create_request_builder` which comes from the expansion of the macro `my_program_client_request_builder` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider using the `'a` lifetime
  --> /home/amiya/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wasm_client_anchor-0.9.0/src/macros.rs:60:17
   |
60 |                 pub args: ::<'a>$program::instruction::$name_prefix,
   |                             ++++

error[E0726]: implicit elided lifetime not allowed here
  --> wasm-client/src/lib.rs:13:1
   |
13 | my_program_client_request_builder!(InitializeConfig);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected lifetime parameter
   |
   = note: this error originates in the macro `$crate::base_create_request_builder` which comes from the expansion of the macro `my_program_client_request_builder` (in Nightly builds, run with -Z macro-backtrace for more info)
help: indicate the anonymous lifetime
  --> /home/amiya/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wasm_client_anchor-0.9.0/src/macros.rs:60:17
   |
60 |                 pub args: ::<'_>$program::instruction::$name_prefix,
   |                             ++++

error[E0433]: failed to resolve: could not find `typed_builder` in the list of imported crates
  --> wasm-client/src/lib.rs:13:1
   |
13 | my_program_client_request_builder!(InitializeConfig);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ could not find `typed_builder` in the list of imported crates
   |
   = note: this error originates in the derive macro `$crate::__private::typed_builder::TypedBuilder` which comes from the expansion of the macro `my_program_client_request_builder` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0603]: struct `InitializeConfig` is private
  --> wasm-client/src/lib.rs:13:36
   |
13 | my_program_client_request_builder!(InitializeConfig);
   |                                    ^^^^^^^^^^^^^^^^ private struct
   |
note: the struct `InitializeConfig` is defined here
  --> /home/amiya/Documents/workspace/solana-programs/SymbioSky-packages/symbiosky-contract/programs/symbiosky-contract/src/lib.rs:15:1
   |
15 | #[program]
   | ^^^^^^^^^^
   = note: this error originates in the attribute macro `program` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing this struct instead
  --> /home/amiya/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wasm_client_anchor-0.9.0/src/macros.rs:60:15
   |
60 -                 pub args: ::$program::instruction::$name_prefix,
60 +                 pub args: symbiosky_contract::InitializeConfig$program::instruction::$name_prefix,
   |
help: import `InitializeConfig` directly
  --> /home/amiya/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wasm_client_anchor-0.9.0/src/macros.rs:60:15
   |
60 -                 pub args: ::$program::instruction::$name_prefix,
60 +                 pub args: symbiosky_contract::instructions::admin::initialize_config::InitializeConfig$program::instruction::$name_prefix,
   |

error[E0658]: anonymous lifetimes in `impl Trait` are unstable
  --> wasm-client/src/lib.rs:13:1
   |
13 | my_program_client_request_builder!(InitializeConfig);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected named lifetime parameter
   |
   = note: this error originates in the macro `$crate::base_create_request_builder` which comes from the expansion of the macro `my_program_client_request_builder` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider introducing a named lifetime parameter
  --> /home/amiya/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wasm_client_anchor-0.9.0/src/macros.rs:60:13
   |
60 |                 pub args<'a>: ::<'a>$program::instruction::$name_prefix,
   |                         ++++    ++++

Some errors have detailed explanations: E0106, E0433, E0603, E0658, E0726.
For more information about an error, try `rustc --explain E0106`.
error: could not compile `wasm-client` (lib) due to 6 previous errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions