-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Feature: CPI Events API #2438
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
Feature: CPI Events API #2438
Changes from 3 commits
1b9ff06
eed5e6f
6c9fced
e1d234c
f5c5ab9
bca57d6
ffd6fb1
aadba4e
bbd869b
7bc2c25
3d04a71
014256f
76ee7be
f4c225c
25bc040
4786e85
b072f59
0b678cf
b7ccc2a
8c2fbdc
e68be79
d9cd325
f9bfeff
5634cef
9cd071f
8b7f515
1f456ea
fe49ef6
397108b
cdd9776
8cc2642
690e8c7
66d72b1
87652d2
eb051ef
fd182fe
852b8bd
aa11826
ac45fc7
9b17a4c
22b902a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Sha256(anchor:event)[..8] | ||
| pub const EVENT_IX_TAG: u64 = 0x1d9acb512ea545e4; | ||
| pub const EVENT_IX_TAG_LE: [u8; 8] = EVENT_IX_TAG.to_le_bytes(); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
|
|
||
callensm marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,6 +91,16 @@ pub fn generate(program: &Program) -> proc_macro2::TokenStream { | |
| } | ||
| }; | ||
|
|
||
| let non_inlined_event: proc_macro2::TokenStream = { | ||
| quote! { | ||
| #[inline(never)] | ||
| #[cfg(not(feature = "no-cpi-events"))] | ||
| pub fn __event_dispatch(program_id: &Pubkey, accounts: &[AccountInfo], event_data: &[u8]) -> anchor_lang::Result<()> { | ||
acheroncrypto marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Ok(()) | ||
|
||
| } | ||
| } | ||
| }; | ||
|
|
||
| let non_inlined_handlers: Vec<proc_macro2::TokenStream> = program | ||
| .ixs | ||
| .iter() | ||
|
|
@@ -173,7 +183,12 @@ pub fn generate(program: &Program) -> proc_macro2::TokenStream { | |
| #idl_accounts_and_functions | ||
| } | ||
|
|
||
| /// __idl mod defines handler for self-cpi based event logging | ||
| pub mod __events { | ||
| use super::*; | ||
|
|
||
| #non_inlined_event | ||
| } | ||
|
|
||
| /// __global mod defines wrapped handlers for global instructions. | ||
| pub mod __global { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.