Skip to content

Commit

Permalink
Anchor fails to generate Initialize without a call.
Browse files Browse the repository at this point in the history
Change-Id: I226631537b06b08d757222cfc3c502b576503c6d
  • Loading branch information
Reisen committed May 5, 2021
1 parent baf9614 commit 360d0ad
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions solana/anchor-bridge/programs/anchor-bridge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ pub mod anchor_bridge {
pub config: types::BridgeConfig,
}

/// Trick Anchor into generating Initialize client structs. Anchor generates a Pubkey only
/// version of every Context struct, but only if a function or method with a self parameter
/// uses it. Bridge::new does not get picked up.
pub fn __trick_anchor_initialize(ctx: Context<Initialize>) -> Result<()> {
Ok(())
}

impl Bridge {
pub fn new(ctx: Context<Initialize>, data: InitializeData) -> Result<Self> {
api::initialize(
Expand Down

0 comments on commit 360d0ad

Please sign in to comment.