@layerzerolabs/framework-solana-anchor-trait 0.2.84 → 0.2.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/examples/shapes/Cargo.lock +22 -22
- package/examples/shapes/Cargo.toml +1 -1
- package/examples/shapes/target/deploy/shapes_ellipse.so +0 -0
- package/examples/shapes/target/deploy/shapes_triangle.so +0 -0
- package/package.json +5 -5
- package/src/assembly.rs +3 -2
- package/src/lib.rs +1 -1
- package/tests/assembly.rs +33 -28
- package/tests/snapshots/snapshots__tests__snapshot_all_defaults.snap +9 -9
- package/tests/snapshots/snapshots__tests__snapshot_full_override.snap +19 -19
- package/tests/snapshots/snapshots__tests__snapshot_handler_override.snap +19 -19
- package/tests/snapshots/snapshots__tests__snapshot_mixed_overrides.snap +28 -28
- package/tests/snapshots/snapshots__tests__snapshot_with_extend_macro.snap +9 -9
|
@@ -89,9 +89,9 @@ checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
|
|
|
89
89
|
|
|
90
90
|
[[package]]
|
|
91
91
|
name = "anchor-attribute-access-control"
|
|
92
|
-
version = "1.0.
|
|
92
|
+
version = "1.0.2"
|
|
93
93
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
94
|
-
checksum = "
|
|
94
|
+
checksum = "0b8cd233e382ea499e3c1e51bf4f0cb367abb37bb64e9e3667a5d618af3fe265"
|
|
95
95
|
dependencies = [
|
|
96
96
|
"proc-macro2",
|
|
97
97
|
"quote",
|
|
@@ -100,9 +100,9 @@ dependencies = [
|
|
|
100
100
|
|
|
101
101
|
[[package]]
|
|
102
102
|
name = "anchor-attribute-account"
|
|
103
|
-
version = "1.0.
|
|
103
|
+
version = "1.0.2"
|
|
104
104
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
105
|
-
checksum = "
|
|
105
|
+
checksum = "2e12171382e24c5cda6b0f7236a4f6bb9b657da997780c88a0ef794a419298bf"
|
|
106
106
|
dependencies = [
|
|
107
107
|
"anchor-syn",
|
|
108
108
|
"proc-macro2",
|
|
@@ -112,9 +112,9 @@ dependencies = [
|
|
|
112
112
|
|
|
113
113
|
[[package]]
|
|
114
114
|
name = "anchor-attribute-constant"
|
|
115
|
-
version = "1.0.
|
|
115
|
+
version = "1.0.2"
|
|
116
116
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
117
|
-
checksum = "
|
|
117
|
+
checksum = "510f8db71375446405dfabdaf157fb7d3fbf33470c98ed75fad4c467e8ca0080"
|
|
118
118
|
dependencies = [
|
|
119
119
|
"anchor-syn",
|
|
120
120
|
"quote",
|
|
@@ -123,9 +123,9 @@ dependencies = [
|
|
|
123
123
|
|
|
124
124
|
[[package]]
|
|
125
125
|
name = "anchor-attribute-error"
|
|
126
|
-
version = "1.0.
|
|
126
|
+
version = "1.0.2"
|
|
127
127
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
128
|
-
checksum = "
|
|
128
|
+
checksum = "72b203169a49ea74da7782281e740ea8e21017c85f8f3b1ab452712c9796d28f"
|
|
129
129
|
dependencies = [
|
|
130
130
|
"anchor-syn",
|
|
131
131
|
"quote",
|
|
@@ -134,9 +134,9 @@ dependencies = [
|
|
|
134
134
|
|
|
135
135
|
[[package]]
|
|
136
136
|
name = "anchor-attribute-event"
|
|
137
|
-
version = "1.0.
|
|
137
|
+
version = "1.0.2"
|
|
138
138
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
139
|
-
checksum = "
|
|
139
|
+
checksum = "c50a462651e573ec6cc632e8f607e8b1e11f620f6fc26badaeff04fd49f45cc1"
|
|
140
140
|
dependencies = [
|
|
141
141
|
"anchor-syn",
|
|
142
142
|
"proc-macro2",
|
|
@@ -146,9 +146,9 @@ dependencies = [
|
|
|
146
146
|
|
|
147
147
|
[[package]]
|
|
148
148
|
name = "anchor-attribute-program"
|
|
149
|
-
version = "1.0.
|
|
149
|
+
version = "1.0.2"
|
|
150
150
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
151
|
-
checksum = "
|
|
151
|
+
checksum = "84704ee25a7e788afd9d846945cba536cfdcd53b463e8a337cf237cd897ca4d9"
|
|
152
152
|
dependencies = [
|
|
153
153
|
"anchor-lang-idl",
|
|
154
154
|
"anchor-syn",
|
|
@@ -161,9 +161,9 @@ dependencies = [
|
|
|
161
161
|
|
|
162
162
|
[[package]]
|
|
163
163
|
name = "anchor-derive-accounts"
|
|
164
|
-
version = "1.0.
|
|
164
|
+
version = "1.0.2"
|
|
165
165
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
166
|
-
checksum = "
|
|
166
|
+
checksum = "98bf49664527c7bb0ebca04e9b5bfb618d6ceb849ef44a8149241d244bbfb0f6"
|
|
167
167
|
dependencies = [
|
|
168
168
|
"anchor-syn",
|
|
169
169
|
"quote",
|
|
@@ -172,9 +172,9 @@ dependencies = [
|
|
|
172
172
|
|
|
173
173
|
[[package]]
|
|
174
174
|
name = "anchor-derive-serde"
|
|
175
|
-
version = "1.0.
|
|
175
|
+
version = "1.0.2"
|
|
176
176
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
177
|
-
checksum = "
|
|
177
|
+
checksum = "8140a40827bdfd74720f1f3084778fa081262f2f43bd4bdbc350f98ce1b341c6"
|
|
178
178
|
dependencies = [
|
|
179
179
|
"anchor-syn",
|
|
180
180
|
"proc-macro-crate",
|
|
@@ -185,9 +185,9 @@ dependencies = [
|
|
|
185
185
|
|
|
186
186
|
[[package]]
|
|
187
187
|
name = "anchor-derive-space"
|
|
188
|
-
version = "1.0.
|
|
188
|
+
version = "1.0.2"
|
|
189
189
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
190
|
-
checksum = "
|
|
190
|
+
checksum = "1ee5b6fa5dde037399d3e0bb322a1c7360ad8adc6b6afdd797d19566c039dcfb"
|
|
191
191
|
dependencies = [
|
|
192
192
|
"proc-macro2",
|
|
193
193
|
"quote",
|
|
@@ -196,9 +196,9 @@ dependencies = [
|
|
|
196
196
|
|
|
197
197
|
[[package]]
|
|
198
198
|
name = "anchor-lang"
|
|
199
|
-
version = "1.0.
|
|
199
|
+
version = "1.0.2"
|
|
200
200
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
201
|
-
checksum = "
|
|
201
|
+
checksum = "1bac4de7c9a9a69180798af701e22302cc0ebf2ef683b843706a1b7809454735"
|
|
202
202
|
dependencies = [
|
|
203
203
|
"anchor-attribute-access-control",
|
|
204
204
|
"anchor-attribute-account",
|
|
@@ -266,9 +266,9 @@ dependencies = [
|
|
|
266
266
|
|
|
267
267
|
[[package]]
|
|
268
268
|
name = "anchor-syn"
|
|
269
|
-
version = "1.0.
|
|
269
|
+
version = "1.0.2"
|
|
270
270
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
271
|
-
checksum = "
|
|
271
|
+
checksum = "6940253e80acf0f8e83b1ebd9c4772c496aedcce6ad19aa85ce75d0b6b188298"
|
|
272
272
|
dependencies = [
|
|
273
273
|
"anyhow",
|
|
274
274
|
"bs58",
|
|
@@ -3,7 +3,7 @@ members = ["programs/ellipse", "programs/triangle", "macros"]
|
|
|
3
3
|
resolver = "2"
|
|
4
4
|
|
|
5
5
|
[workspace.dependencies]
|
|
6
|
-
anchor-lang = { version = "1.0.
|
|
6
|
+
anchor-lang = { version = "1.0.2" }
|
|
7
7
|
anchor-trait = { path = "../.." }
|
|
8
8
|
shapes-macros = { path = "macros" }
|
|
9
9
|
mollusk-svm = { version = "0.8", features = ["inner-instructions"] }
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layerzerolabs/framework-solana-anchor-trait",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.86",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"rustfmt.toml"
|
|
15
15
|
],
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@layerzerolabs/
|
|
18
|
-
"@layerzerolabs/
|
|
19
|
-
"@layerzerolabs/
|
|
20
|
-
"@layerzerolabs/
|
|
17
|
+
"@layerzerolabs/tsup-configuration": "0.2.86",
|
|
18
|
+
"@layerzerolabs/build-utils-solana": "0.2.86",
|
|
19
|
+
"@layerzerolabs/typescript-configuration": "0.2.86",
|
|
20
|
+
"@layerzerolabs/vm-tooling-solana": "0.2.86"
|
|
21
21
|
},
|
|
22
22
|
"publishConfig": {
|
|
23
23
|
"access": "restricted",
|
package/src/assembly.rs
CHANGED
|
@@ -35,7 +35,6 @@ impl<Ix: InstructionSet> Assembly<Ix> {
|
|
|
35
35
|
///
|
|
36
36
|
/// ```text
|
|
37
37
|
/// prelude // domain-specific definitions (state types, events, etc.)
|
|
38
|
-
/// wrapper_defs // relocated override handler modules
|
|
39
38
|
/// default_impls // generated default accounts structs + handler impls
|
|
40
39
|
/// extend_macro // macro_rules! for extending default accounts (if configured)
|
|
41
40
|
/// #[outer_mod_attrs] // outer attrs from the source module
|
|
@@ -44,6 +43,8 @@ impl<Ix: InstructionSet> Assembly<Ix> {
|
|
|
44
43
|
/// mod name {
|
|
45
44
|
/// #![inner_mod_attrs] // inner attrs from the source module (e.g. #![deny(...)])
|
|
46
45
|
/// filtered_items // original items minus relocated handlers
|
|
46
|
+
/// wrapper_defs // relocated override handler modules — kept inside so handlers
|
|
47
|
+
/// // can reach the user's nested same-module helpers
|
|
47
48
|
/// entrypoints // generated instruction entrypoints
|
|
48
49
|
/// }
|
|
49
50
|
/// ```
|
|
@@ -82,7 +83,6 @@ impl<Ix: InstructionSet> Assembly<Ix> {
|
|
|
82
83
|
|
|
83
84
|
quote! {
|
|
84
85
|
#prelude
|
|
85
|
-
#wrapper_defs
|
|
86
86
|
#default_impls
|
|
87
87
|
#extend_macro
|
|
88
88
|
|
|
@@ -93,6 +93,7 @@ impl<Ix: InstructionSet> Assembly<Ix> {
|
|
|
93
93
|
#(#inner_attrs)*
|
|
94
94
|
use super::*;
|
|
95
95
|
#filtered_items
|
|
96
|
+
#wrapper_defs
|
|
96
97
|
#entrypoints
|
|
97
98
|
}
|
|
98
99
|
}
|
package/src/lib.rs
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
//! (making it available for composition or reference), but the entrypoint delegates to the custom
|
|
14
14
|
//! handler using whatever context type it declares.
|
|
15
15
|
//!
|
|
16
|
-
//! See [`
|
|
16
|
+
//! See [`README.md`](../README.md) for the full specification.
|
|
17
17
|
//!
|
|
18
18
|
//! ## Integration steps for a new macro crate
|
|
19
19
|
//!
|
package/tests/assembly.rs
CHANGED
|
@@ -104,22 +104,24 @@ mod tests {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
#[test]
|
|
107
|
-
fn
|
|
107
|
+
fn wrappers_inside_module_and_default_impls_outside() {
|
|
108
108
|
let module = module_with_override_and_extras();
|
|
109
109
|
let file = assemble_ok(&module, quote! {}, quote! {});
|
|
110
|
-
let (mod_pos,
|
|
110
|
+
let (mod_pos, m) = find_program_mod(&file).expect("module should exist");
|
|
111
111
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
112
|
+
// Wrapper modules are placed inside the program module so override handlers
|
|
113
|
+
// can reach nested same-module helpers (e.g. `mod utils { ... }`).
|
|
114
|
+
let inner = mod_items(m);
|
|
115
|
+
let has_wrapper_inside = inner.iter().any(|item| {
|
|
116
|
+
matches!(item, syn::Item::Mod(m) if m.ident.to_string().contains("__test_instruction__"))
|
|
117
|
+
});
|
|
118
|
+
assert!(has_wrapper_inside, "wrapper defs should live inside the program module");
|
|
119
|
+
|
|
120
|
+
// Wrapper modules must NOT appear at outer scope.
|
|
121
|
+
let has_wrapper_outside = file.items.iter().any(|item| {
|
|
122
|
+
matches!(item, syn::Item::Mod(m) if m.ident.to_string().contains("__test_instruction__"))
|
|
123
|
+
});
|
|
124
|
+
assert!(!has_wrapper_outside, "wrapper defs should not appear outside the program module");
|
|
123
125
|
|
|
124
126
|
// Default structs are always emitted for provided instructions, even when overridden.
|
|
125
127
|
let has_default_impl_outside = file.items[..mod_pos].iter().any(|item| {
|
|
@@ -345,9 +347,9 @@ mod tests {
|
|
|
345
347
|
fn wrapper_defs_contain_override_handlers() {
|
|
346
348
|
let module = module_with_override_and_extras();
|
|
347
349
|
let file = assemble_ok(&module, quote! {}, quote! {});
|
|
350
|
+
let (_, program_mod) = find_program_mod(&file).expect("module should exist");
|
|
348
351
|
|
|
349
|
-
let wrapper =
|
|
350
|
-
.items
|
|
352
|
+
let wrapper = mod_items(program_mod)
|
|
351
353
|
.iter()
|
|
352
354
|
.find_map(|item| match item {
|
|
353
355
|
syn::Item::Mod(m)
|
|
@@ -357,7 +359,7 @@ mod tests {
|
|
|
357
359
|
},
|
|
358
360
|
_ => None,
|
|
359
361
|
})
|
|
360
|
-
.expect("wrapper module for set_peer should exist
|
|
362
|
+
.expect("wrapper module for set_peer should exist inside the program module");
|
|
361
363
|
|
|
362
364
|
let wrapper_items = mod_items(wrapper);
|
|
363
365
|
let has_handler = wrapper_items
|
|
@@ -541,21 +543,14 @@ mod tests {
|
|
|
541
543
|
let module = module_with_override_and_extras();
|
|
542
544
|
let file = assemble_ok(&module, quote! { struct PreludeMarker; }, quote! {});
|
|
543
545
|
|
|
544
|
-
// Verify
|
|
546
|
+
// Verify outer-scope ordering: prelude → default impls → module
|
|
547
|
+
// (wrapper modules now live inside the program module — see assertion below).
|
|
545
548
|
let prelude_pos = file
|
|
546
549
|
.items
|
|
547
550
|
.iter()
|
|
548
551
|
.position(|item| matches!(item, syn::Item::Struct(s) if s.ident == "PreludeMarker"))
|
|
549
552
|
.expect("prelude should exist");
|
|
550
553
|
|
|
551
|
-
let wrapper_pos = file
|
|
552
|
-
.items
|
|
553
|
-
.iter()
|
|
554
|
-
.position(|item| {
|
|
555
|
-
matches!(item, syn::Item::Mod(m) if m.ident.to_string().contains("__test_instruction__"))
|
|
556
|
-
})
|
|
557
|
-
.expect("wrapper should exist");
|
|
558
|
-
|
|
559
554
|
let context_pos = file
|
|
560
555
|
.items
|
|
561
556
|
.iter()
|
|
@@ -566,17 +561,27 @@ mod tests {
|
|
|
566
561
|
|
|
567
562
|
let (mod_pos, m) = find_program_mod(&file).expect("module should exist");
|
|
568
563
|
|
|
569
|
-
assert!(prelude_pos <
|
|
570
|
-
assert!(wrapper_pos < context_pos, "wrapper before default impls");
|
|
564
|
+
assert!(prelude_pos < context_pos, "prelude before default impls");
|
|
571
565
|
assert!(context_pos < mod_pos, "default impls before module");
|
|
572
566
|
|
|
567
|
+
// Wrapper modules must sit inside the program module, not at outer scope.
|
|
568
|
+
let has_wrapper_outside = file.items.iter().any(|item| {
|
|
569
|
+
matches!(item, syn::Item::Mod(m) if m.ident.to_string().contains("__test_instruction__"))
|
|
570
|
+
});
|
|
571
|
+
assert!(!has_wrapper_outside, "wrapper modules should not appear at outer scope");
|
|
572
|
+
|
|
573
|
+
let items = mod_items(m);
|
|
574
|
+
let has_wrapper_inside = items.iter().any(|item| {
|
|
575
|
+
matches!(item, syn::Item::Mod(m) if m.ident.to_string().contains("__test_instruction__"))
|
|
576
|
+
});
|
|
577
|
+
assert!(has_wrapper_inside, "wrapper modules should sit inside the program module");
|
|
578
|
+
|
|
573
579
|
let has_program = m
|
|
574
580
|
.attrs
|
|
575
581
|
.iter()
|
|
576
582
|
.any(|attr| attr.path().segments.last().is_some_and(|seg| seg.ident == "program"));
|
|
577
583
|
assert!(has_program, "module should have #[program]");
|
|
578
584
|
|
|
579
|
-
let items = mod_items(m);
|
|
580
585
|
let fn_names: Vec<_> = items
|
|
581
586
|
.iter()
|
|
582
587
|
.filter_map(|item| match item {
|
|
@@ -2,15 +2,6 @@
|
|
|
2
2
|
source: crates/anchor-trait/tests/snapshots.rs
|
|
3
3
|
expression: output
|
|
4
4
|
---
|
|
5
|
-
mod __test_instruction__lz_receive_handler {
|
|
6
|
-
use super::*;
|
|
7
|
-
pub fn lz_receive(
|
|
8
|
-
ctx: &mut Context<MyReceive>,
|
|
9
|
-
params: &LzReceiveParams,
|
|
10
|
-
) -> Result<()> {
|
|
11
|
-
Ok(())
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
5
|
#[derive(Accounts)]
|
|
15
6
|
pub struct StdSetPeer<'info> {
|
|
16
7
|
pub placeholder: UncheckedAccount<'info>,
|
|
@@ -41,6 +32,15 @@ impl StdToken<'_> {
|
|
|
41
32
|
#[program]
|
|
42
33
|
pub mod my_program {
|
|
43
34
|
use super::*;
|
|
35
|
+
mod __test_instruction__lz_receive_handler {
|
|
36
|
+
use super::*;
|
|
37
|
+
pub fn lz_receive(
|
|
38
|
+
ctx: &mut Context<MyReceive>,
|
|
39
|
+
params: &LzReceiveParams,
|
|
40
|
+
) -> Result<()> {
|
|
41
|
+
Ok(())
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
44
|
pub fn set_peer(mut ctx: Context<StdSetPeer>, params: SetPeerParams) -> Result<()> {
|
|
45
45
|
StdSetPeer::apply(&mut ctx, ¶ms)
|
|
46
46
|
}
|
|
@@ -2,25 +2,6 @@
|
|
|
2
2
|
source: crates/anchor-trait/tests/snapshots.rs
|
|
3
3
|
expression: output
|
|
4
4
|
---
|
|
5
|
-
mod __test_instruction__set_peer_handler {
|
|
6
|
-
use super::*;
|
|
7
|
-
pub fn set_peer(
|
|
8
|
-
ctx: &mut Context<MyCustomAccounts>,
|
|
9
|
-
params: &SetPeerParams,
|
|
10
|
-
) -> Result<()> {
|
|
11
|
-
msg!("fully custom set_peer");
|
|
12
|
-
Ok(())
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
mod __test_instruction__lz_receive_handler {
|
|
16
|
-
use super::*;
|
|
17
|
-
pub fn lz_receive(
|
|
18
|
-
ctx: &mut Context<MyReceive>,
|
|
19
|
-
params: &LzReceiveParams,
|
|
20
|
-
) -> Result<()> {
|
|
21
|
-
Ok(())
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
5
|
#[derive(Accounts)]
|
|
25
6
|
pub struct StdSetPeer<'info> {
|
|
26
7
|
pub placeholder: UncheckedAccount<'info>,
|
|
@@ -51,6 +32,25 @@ impl StdToken<'_> {
|
|
|
51
32
|
#[program]
|
|
52
33
|
pub mod my_program {
|
|
53
34
|
use super::*;
|
|
35
|
+
mod __test_instruction__set_peer_handler {
|
|
36
|
+
use super::*;
|
|
37
|
+
pub fn set_peer(
|
|
38
|
+
ctx: &mut Context<MyCustomAccounts>,
|
|
39
|
+
params: &SetPeerParams,
|
|
40
|
+
) -> Result<()> {
|
|
41
|
+
msg!("fully custom set_peer");
|
|
42
|
+
Ok(())
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
mod __test_instruction__lz_receive_handler {
|
|
46
|
+
use super::*;
|
|
47
|
+
pub fn lz_receive(
|
|
48
|
+
ctx: &mut Context<MyReceive>,
|
|
49
|
+
params: &LzReceiveParams,
|
|
50
|
+
) -> Result<()> {
|
|
51
|
+
Ok(())
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
54
|
pub fn set_peer(
|
|
55
55
|
mut ctx: Context<MyCustomAccounts>,
|
|
56
56
|
params: SetPeerParams,
|
|
@@ -2,25 +2,6 @@
|
|
|
2
2
|
source: crates/anchor-trait/tests/snapshots.rs
|
|
3
3
|
expression: output
|
|
4
4
|
---
|
|
5
|
-
mod __test_instruction__set_peer_handler {
|
|
6
|
-
use super::*;
|
|
7
|
-
pub fn set_peer(
|
|
8
|
-
ctx: &mut Context<StdSetPeer>,
|
|
9
|
-
params: &SetPeerParams,
|
|
10
|
-
) -> Result<()> {
|
|
11
|
-
msg!("custom set_peer logic");
|
|
12
|
-
Ok(())
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
mod __test_instruction__lz_receive_handler {
|
|
16
|
-
use super::*;
|
|
17
|
-
pub fn lz_receive(
|
|
18
|
-
ctx: &mut Context<MyReceive>,
|
|
19
|
-
params: &LzReceiveParams,
|
|
20
|
-
) -> Result<()> {
|
|
21
|
-
Ok(())
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
5
|
#[derive(Accounts)]
|
|
25
6
|
pub struct StdSetPeer<'info> {
|
|
26
7
|
pub placeholder: UncheckedAccount<'info>,
|
|
@@ -51,6 +32,25 @@ impl StdToken<'_> {
|
|
|
51
32
|
#[program]
|
|
52
33
|
pub mod my_program {
|
|
53
34
|
use super::*;
|
|
35
|
+
mod __test_instruction__set_peer_handler {
|
|
36
|
+
use super::*;
|
|
37
|
+
pub fn set_peer(
|
|
38
|
+
ctx: &mut Context<StdSetPeer>,
|
|
39
|
+
params: &SetPeerParams,
|
|
40
|
+
) -> Result<()> {
|
|
41
|
+
msg!("custom set_peer logic");
|
|
42
|
+
Ok(())
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
mod __test_instruction__lz_receive_handler {
|
|
46
|
+
use super::*;
|
|
47
|
+
pub fn lz_receive(
|
|
48
|
+
ctx: &mut Context<MyReceive>,
|
|
49
|
+
params: &LzReceiveParams,
|
|
50
|
+
) -> Result<()> {
|
|
51
|
+
Ok(())
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
54
|
pub fn set_peer(mut ctx: Context<StdSetPeer>, params: SetPeerParams) -> Result<()> {
|
|
55
55
|
__test_instruction__set_peer_handler::set_peer(&mut ctx, ¶ms)
|
|
56
56
|
}
|
|
@@ -3,34 +3,6 @@ source: crates/anchor-trait/tests/snapshots.rs
|
|
|
3
3
|
expression: output
|
|
4
4
|
---
|
|
5
5
|
struct PreludeMarker;
|
|
6
|
-
mod __test_instruction__set_peer_handler {
|
|
7
|
-
use super::*;
|
|
8
|
-
pub fn set_peer(
|
|
9
|
-
ctx: &mut Context<StdSetPeer>,
|
|
10
|
-
params: &SetPeerParams,
|
|
11
|
-
) -> Result<()> {
|
|
12
|
-
msg!("handler override set_peer");
|
|
13
|
-
Ok(())
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
mod __test_instruction__get_peer_handler {
|
|
17
|
-
use super::*;
|
|
18
|
-
pub fn get_peer(
|
|
19
|
-
ctx: &Context<MyCustomGetPeer>,
|
|
20
|
-
params: &GetPeerParams,
|
|
21
|
-
) -> Result<[u8; 32]> {
|
|
22
|
-
Ok([0u8; 32])
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
mod __test_instruction__lz_receive_handler {
|
|
26
|
-
use super::*;
|
|
27
|
-
pub fn lz_receive(
|
|
28
|
-
ctx: &mut Context<MyReceive>,
|
|
29
|
-
params: &LzReceiveParams,
|
|
30
|
-
) -> Result<()> {
|
|
31
|
-
Ok(())
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
6
|
#[derive(Accounts)]
|
|
35
7
|
pub struct StdSetPeer<'info> {
|
|
36
8
|
pub placeholder: UncheckedAccount<'info>,
|
|
@@ -67,6 +39,34 @@ pub mod my_program {
|
|
|
67
39
|
struct MyState {
|
|
68
40
|
value: u64,
|
|
69
41
|
}
|
|
42
|
+
mod __test_instruction__set_peer_handler {
|
|
43
|
+
use super::*;
|
|
44
|
+
pub fn set_peer(
|
|
45
|
+
ctx: &mut Context<StdSetPeer>,
|
|
46
|
+
params: &SetPeerParams,
|
|
47
|
+
) -> Result<()> {
|
|
48
|
+
msg!("handler override set_peer");
|
|
49
|
+
Ok(())
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
mod __test_instruction__get_peer_handler {
|
|
53
|
+
use super::*;
|
|
54
|
+
pub fn get_peer(
|
|
55
|
+
ctx: &Context<MyCustomGetPeer>,
|
|
56
|
+
params: &GetPeerParams,
|
|
57
|
+
) -> Result<[u8; 32]> {
|
|
58
|
+
Ok([0u8; 32])
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
mod __test_instruction__lz_receive_handler {
|
|
62
|
+
use super::*;
|
|
63
|
+
pub fn lz_receive(
|
|
64
|
+
ctx: &mut Context<MyReceive>,
|
|
65
|
+
params: &LzReceiveParams,
|
|
66
|
+
) -> Result<()> {
|
|
67
|
+
Ok(())
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
70
|
pub fn set_peer(mut ctx: Context<StdSetPeer>, params: SetPeerParams) -> Result<()> {
|
|
71
71
|
__test_instruction__set_peer_handler::set_peer(&mut ctx, ¶ms)
|
|
72
72
|
}
|
|
@@ -2,15 +2,6 @@
|
|
|
2
2
|
source: crates/anchor-trait/tests/snapshots.rs
|
|
3
3
|
expression: output
|
|
4
4
|
---
|
|
5
|
-
mod __test_instruction__lz_receive_handler {
|
|
6
|
-
use super::*;
|
|
7
|
-
pub fn lz_receive(
|
|
8
|
-
ctx: &mut Context<MyReceive>,
|
|
9
|
-
params: &LzReceiveParams,
|
|
10
|
-
) -> Result<()> {
|
|
11
|
-
Ok(())
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
5
|
#[derive(Accounts)]
|
|
15
6
|
pub struct StdSetPeer<'info> {
|
|
16
7
|
pub placeholder: UncheckedAccount<'info>,
|
|
@@ -61,6 +52,15 @@ macro_rules! test_extend_accounts {
|
|
|
61
52
|
#[program]
|
|
62
53
|
pub mod my_program {
|
|
63
54
|
use super::*;
|
|
55
|
+
mod __test_instruction__lz_receive_handler {
|
|
56
|
+
use super::*;
|
|
57
|
+
pub fn lz_receive(
|
|
58
|
+
ctx: &mut Context<MyReceive>,
|
|
59
|
+
params: &LzReceiveParams,
|
|
60
|
+
) -> Result<()> {
|
|
61
|
+
Ok(())
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
64
|
pub fn set_peer(mut ctx: Context<StdSetPeer>, params: SetPeerParams) -> Result<()> {
|
|
65
65
|
StdSetPeer::apply(&mut ctx, ¶ms)
|
|
66
66
|
}
|