-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
generate_cpi_crate
proc macro panicked
#83
Comments
Same error, have you solved? |
Same error, no one solved it? |
@hongshu7 @CanvasL this lib uses another version of IDL as i understood, you need manually add or replace two fields also you need to move name and version fields from metadata to root of JSON But even with this modification lib generates pretty dummy types with unimplemented blocks, i think this lib is useless use anchor_lang::prelude::*;
pub mod typedefs {
#![doc = r" User-defined types."]
use super::*;
}
pub mod state {
#![doc = r" Structs of accounts which hold state."]
use super::*;
}
pub mod ix_accounts {
#![doc = r" Accounts used in instructions."]
use super::*;
#[derive(Accounts)]
pub struct RefundNative<'info> {
#[account(mut)]
pub sender: Signer<'info>,
#[account(mut)]
pub recipient: AccountInfo<'info>,
pub system_program: AccountInfo<'info>,
}
#[derive(Accounts)]
pub struct RefundTokens<'info> {
pub authority: Signer<'info>,
#[account(mut)]
pub source_token_account: AccountInfo<'info>,
#[account(mut)]
pub destination_token_account: AccountInfo<'info>,
pub spl_token_program: AccountInfo<'info>,
}
}
use ix_accounts::*;
pub use state::*;
pub use typedefs::*;
#[program]
pub mod refund_program {
# v0.3.1."]
use super::*;
pub fn refund_native(_ctx: Context<RefundNative>, _left_tokens: u64) -> Result<()> {
unimplemented!("This program is a wrapper for CPI.")
}
pub fn refund_tokens(_ctx: Context<RefundTokens>, _left_tokens: u64) -> Result<()> {
unimplemented!("This program is a wrapper for CPI.")
}
} |
Just a newbie to rust and solana.
I'm finding ways to let my program interact with other programs. While there is interface in solidity and you only need to know the address that you wanna call and apply the appropriate interface to that address, I may need IDL to do the similar thing in solana.
I've read the guide of anchor for cross program invocation. Just really don't like it. It means you have to clone other program's source code into your project. Then I found IDL to work like an interface that could solve the problem of source code. And then I found this tool for generating rust code from the IDL json file. So I'm trying to split the examples in anchor guide
puppet
andpuppet-master
into two seperate repos. And I'm trying to useanchor-gen
withinpuppet-master
repo in order to invoke puppet. But I ran into this errorpuppet within puppet-master repo
what i'm using
puppet idl json
The text was updated successfully, but these errors were encountered: