@layerzerolabs/protocol-stellar-v2 0.2.41 → 0.2.44

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.
Files changed (42) hide show
  1. package/.turbo/turbo-build.log +146 -144
  2. package/.turbo/turbo-lint.log +165 -96
  3. package/.turbo/turbo-test.log +1810 -1755
  4. package/Cargo.lock +22 -127
  5. package/Cargo.toml +4 -6
  6. package/contracts/macro-integration-tests/tests/runtime/oapp/mod.rs +3 -5
  7. package/contracts/macro-integration-tests/tests/runtime/oapp/sender.rs +2 -1
  8. package/contracts/macro-integration-tests/tests/runtime/ownable/mod.rs +1 -1
  9. package/contracts/macro-integration-tests/tests/ui/oapp/fail/missing_auth_trait.rs +28 -0
  10. package/contracts/macro-integration-tests/tests/ui/oapp/fail/missing_auth_trait.stderr +397 -0
  11. package/contracts/macro-integration-tests/tests/ui/oapp/fail/missing_lz_receive_internal.rs +1 -0
  12. package/contracts/macro-integration-tests/tests/ui/oapp/fail/missing_lz_receive_internal.stderr +10 -10
  13. package/contracts/macro-integration-tests/tests/ui/oapp/pass/custom_all.rs +1 -0
  14. package/contracts/macro-integration-tests/tests/ui/oapp/pass/custom_single_trait.rs +4 -0
  15. package/contracts/macro-integration-tests/tests/ui/oapp/pass/minimal_contract.rs +5 -4
  16. package/contracts/macro-integration-tests/tests/ui/oapp/pass/struct_with_fields.rs +2 -0
  17. package/contracts/oapps/counter/src/counter.rs +4 -3
  18. package/contracts/oapps/oapp/src/oapp_core.rs +1 -1
  19. package/contracts/oapps/oapp/src/tests/oapp_core.rs +2 -1
  20. package/contracts/oapps/oapp/src/tests/oapp_options_type3.rs +6 -3
  21. package/contracts/oapps/oapp/src/tests/oapp_receiver.rs +2 -1
  22. package/contracts/oapps/oapp/src/tests/oapp_sender.rs +2 -1
  23. package/contracts/oapps/oapp/src/tests/test_macros.rs +10 -0
  24. package/contracts/oapps/oapp-macros/src/generators.rs +6 -9
  25. package/contracts/oapps/oapp-macros/src/lib.rs +1 -1
  26. package/contracts/oapps/oapp-macros/src/tests/snapshots/oapp_macros__tests__oapp__snapshot_generate_oapp.snap +0 -7
  27. package/contracts/oapps/oft/src/oft.rs +2 -1
  28. package/contracts/oapps/oft/src/tests/oft_types/lock_unlock.rs +1 -0
  29. package/contracts/oapps/oft-core/integration-tests/setup.rs +1 -0
  30. package/contracts/oapps/oft-core/src/oft_core.rs +2 -2
  31. package/contracts/oapps/oft-core/src/tests/test_utils.rs +2 -0
  32. package/docs/oapp-guide.md +14 -9
  33. package/package.json +5 -4
  34. package/sdk/.turbo/turbo-test.log +294 -298
  35. package/sdk/dist/generated/counter.d.ts +137 -137
  36. package/sdk/dist/generated/counter.js +27 -27
  37. package/sdk/dist/generated/oft.d.ts +136 -136
  38. package/sdk/dist/generated/oft.js +27 -27
  39. package/sdk/package.json +1 -1
  40. package/ts-bindings-gen.toml +67 -0
  41. package/tools/ts-bindings-gen/Cargo.toml +0 -16
  42. package/tools/ts-bindings-gen/src/main.rs +0 -214
@@ -64,6 +64,7 @@ impl MockEndpoint {
64
64
  }
65
65
 
66
66
  #[oapp_macros::oapp]
67
+ #[common_macros::lz_contract]
67
68
  pub struct DummyOAppSender;
68
69
 
69
70
  impl LzReceiveInternal for DummyOAppSender {
@@ -83,7 +84,7 @@ impl LzReceiveInternal for DummyOAppSender {
83
84
  #[contractimpl]
84
85
  impl DummyOAppSender {
85
86
  pub fn __constructor(env: &Env, owner: &Address, endpoint: &Address) {
86
- oapp::oapp_core::initialize_oapp::<Self>(env, owner, endpoint, owner);
87
+ oapp::oapp_core::init_ownable_oapp::<Self>(env, owner, endpoint, owner);
87
88
  }
88
89
 
89
90
  pub fn quote(env: &Env, dst_eid: u32, message: &Bytes, options: &Bytes, pay_in_zro: bool) -> MessagingFee {
@@ -10,6 +10,7 @@ mod test_full_default {
10
10
  use soroban_sdk::{Address, Bytes, BytesN, Env};
11
11
 
12
12
  #[oapp]
13
+ #[common_macros::lz_contract]
13
14
  struct TestFullDefault;
14
15
 
15
16
  impl LzReceiveInternal for TestFullDefault {
@@ -40,6 +41,7 @@ mod test_full_manual_core {
40
41
  use soroban_sdk::{contractimpl, Address, Bytes, BytesN, Env};
41
42
 
42
43
  #[oapp(custom = [core])]
44
+ #[common_macros::lz_contract]
43
45
  struct TestFullManualCore;
44
46
 
45
47
  #[soroban_sdk::contractimpl(contracttrait)]
@@ -80,6 +82,7 @@ mod test_full_manual_sender {
80
82
  use soroban_sdk::{Address, Bytes, BytesN, Env};
81
83
 
82
84
  #[oapp(custom = [sender])]
85
+ #[common_macros::lz_contract]
83
86
  struct TestFullManualSender;
84
87
 
85
88
  impl OAppSenderInternal for TestFullManualSender {
@@ -113,6 +116,7 @@ mod test_full_manual_receiver {
113
116
  use soroban_sdk::{contractimpl, Address, Bytes, BytesN, Env};
114
117
 
115
118
  #[oapp(custom = [receiver])]
119
+ #[common_macros::lz_contract]
116
120
  struct TestFullManualReceiver;
117
121
 
118
122
  impl LzReceiveInternal for TestFullManualReceiver {
@@ -158,6 +162,7 @@ mod test_full_manual_options {
158
162
  use soroban_sdk::{contractimpl, Address, Bytes, BytesN, Env};
159
163
 
160
164
  #[oapp(custom = [options_type3])]
165
+ #[common_macros::lz_contract]
161
166
  struct TestFullManualOptions;
162
167
 
163
168
  impl LzReceiveInternal for TestFullManualOptions {
@@ -192,6 +197,7 @@ mod test_full_manual_core_sender {
192
197
  use soroban_sdk::{contractimpl, Address, Bytes, BytesN, Env};
193
198
 
194
199
  #[oapp(custom = [core, sender])]
200
+ #[common_macros::lz_contract]
195
201
  struct TestFullManualCoreSender;
196
202
 
197
203
  #[soroban_sdk::contractimpl(contracttrait)]
@@ -238,6 +244,7 @@ mod test_full_manual_core_receiver {
238
244
  use soroban_sdk::{contractimpl, Address, Bytes, BytesN, Env};
239
245
 
240
246
  #[oapp(custom = [core, receiver])]
247
+ #[common_macros::lz_contract]
241
248
  struct TestFullManualCoreReceiver;
242
249
 
243
250
  #[soroban_sdk::contractimpl(contracttrait)]
@@ -283,6 +290,7 @@ mod test_full_manual_sender_receiver {
283
290
  use soroban_sdk::{contractimpl, Address, Bytes, BytesN, Env};
284
291
 
285
292
  #[oapp(custom = [sender, receiver])]
293
+ #[common_macros::lz_contract]
286
294
  struct TestFullManualSenderReceiver;
287
295
 
288
296
  impl OAppSenderInternal for TestFullManualSenderReceiver {
@@ -323,6 +331,7 @@ mod test_full_manual_all_except_options {
323
331
  use soroban_sdk::{contractimpl, Address, Bytes, BytesN, Env};
324
332
 
325
333
  #[oapp(custom = [core, sender, receiver])]
334
+ #[common_macros::lz_contract]
326
335
  struct TestFullManualAllExceptOptions;
327
336
 
328
337
  #[soroban_sdk::contractimpl(contracttrait)]
@@ -374,6 +383,7 @@ mod test_full_manual_all {
374
383
  use soroban_sdk::{contractimpl, Address, Bytes, BytesN, Env};
375
384
 
376
385
  #[oapp(custom = [core, sender, receiver, options_type3])]
386
+ #[common_macros::lz_contract]
377
387
  struct TestFullManualAll;
378
388
 
379
389
  #[soroban_sdk::contractimpl(contracttrait)]
@@ -65,15 +65,13 @@ impl Parse for CustomImpls {
65
65
  }
66
66
  }
67
67
 
68
- /// Generates a complete OApp implementation with contract attributes and trait implementations.
68
+ /// Generates OApp trait implementations only. No contract-level attributes are applied.
69
69
  ///
70
- /// This function creates:
71
- /// - `#[common_macros::lz_contract]` - Wrapper macro that combines:
72
- /// - `#[soroban_sdk::contract]` - Makes the struct a Soroban contract
73
- /// - `#[common_macros::ttl_configurable]` - Adds TTL configuration with auth
74
- /// - `#[common_macros::ttl_extendable]` - Adds manual TTL extension support
75
- /// - `#[common_macros::ownable]` - Adds single-owner access control
76
- /// - OAppCore, OAppSenderInternal, OAppReceiver, and OAppOptionsType3 trait implementations
70
+ /// This function creates OAppCore, OAppSenderInternal, OAppReceiver, and OAppOptionsType3 trait implementations.
71
+ ///
72
+ /// **The user must apply a contract macro** such as `#[common_macros::lz_contract]` or
73
+ /// `#[soroban_sdk::contract]` to the struct. `#[lz_contract]` provides contract, TTL, and Auth
74
+ /// (via `#[ownable]` or `#[multisig]`) in one place.
77
75
  ///
78
76
  /// The `custom` parameter controls which trait implementations are generated vs.
79
77
  /// expected to be provided by the user.
@@ -86,7 +84,6 @@ pub fn generate_oapp(attr: TokenStream, input: TokenStream) -> TokenStream {
86
84
  let receiver_impl = (!custom.receiver).then(|| generate_oapp_receiver(&item_struct.ident));
87
85
  let options_type3_impl = (!custom.options_type3).then(|| generate_oapp_options_type3(&item_struct.ident));
88
86
  quote! {
89
- #[common_macros::lz_contract]
90
87
  #item_struct
91
88
 
92
89
  #core_impl
@@ -126,7 +126,7 @@ mod generators;
126
126
 
127
127
  use proc_macro::TokenStream;
128
128
 
129
- /// Derives a complete OApp: `#[contract]` + `#[ownable]` + Core + Sender + Receiver + OptionsType3.
129
+ /// Derives OApp trait implementations. Apply `#[lz_contract]` (or similar) for contract + TTL + Auth.
130
130
  ///
131
131
  /// ## Usage
132
132
  ///
@@ -5,7 +5,6 @@ expression: combined
5
5
  ---
6
6
  // === Default (no custom impls) ===
7
7
 
8
- #[common_macros::lz_contract]
9
8
  pub struct MyOApp;
10
9
  use oapp::oapp_core::OAppCore as _;
11
10
  use utils::rbac::RoleBasedAccessControl as _;
@@ -25,7 +24,6 @@ impl oapp::oapp_options_type3::OAppOptionsType3 for MyOApp {}
25
24
 
26
25
  // === custom = [core] ===
27
26
 
28
- #[common_macros::lz_contract]
29
27
  pub struct MyOApp;
30
28
  use oapp::oapp_sender::OAppSenderInternal as _;
31
29
  impl oapp::oapp_sender::OAppSenderInternal for MyOApp {}
@@ -39,7 +37,6 @@ impl oapp::oapp_options_type3::OAppOptionsType3 for MyOApp {}
39
37
 
40
38
  // === custom = [sender] ===
41
39
 
42
- #[common_macros::lz_contract]
43
40
  pub struct MyOApp;
44
41
  use oapp::oapp_core::OAppCore as _;
45
42
  use utils::rbac::RoleBasedAccessControl as _;
@@ -57,7 +54,6 @@ impl oapp::oapp_options_type3::OAppOptionsType3 for MyOApp {}
57
54
 
58
55
  // === custom = [receiver] ===
59
56
 
60
- #[common_macros::lz_contract]
61
57
  pub struct MyOApp;
62
58
  use oapp::oapp_core::OAppCore as _;
63
59
  use utils::rbac::RoleBasedAccessControl as _;
@@ -74,7 +70,6 @@ impl oapp::oapp_options_type3::OAppOptionsType3 for MyOApp {}
74
70
 
75
71
  // === custom = [options_type3] ===
76
72
 
77
- #[common_macros::lz_contract]
78
73
  pub struct MyOApp;
79
74
  use oapp::oapp_core::OAppCore as _;
80
75
  use utils::rbac::RoleBasedAccessControl as _;
@@ -91,13 +86,11 @@ impl oapp::oapp_receiver::OAppReceiver for MyOApp {}
91
86
 
92
87
  // === custom = [core, sender, receiver, options_type3] ===
93
88
 
94
- #[common_macros::lz_contract]
95
89
  pub struct MyOApp;
96
90
 
97
91
 
98
92
  // === Struct attributes + fields are preserved ===
99
93
 
100
- #[common_macros::lz_contract]
101
94
  #[derive(Clone, Debug)]
102
95
  pub struct FancyOApp {
103
96
  pub x: u32,
@@ -7,7 +7,7 @@ use crate::{
7
7
  },
8
8
  oft_types::{lock_unlock, mint_burn, OftType},
9
9
  };
10
- use common_macros::{contract_impl, storage};
10
+ use common_macros::{contract_impl, lz_contract, storage};
11
11
  use oapp_macros::oapp;
12
12
  use oft_core::{
13
13
  impl_oft_lz_receive, utils as oft_utils, OFTCore, OFTError, OFTFeeDetail, OFTInternal, OFTLimit, OFTReceipt,
@@ -29,6 +29,7 @@ enum OFTStorage {
29
29
  // OFT Contract
30
30
  // =========================================================================
31
31
 
32
+ #[lz_contract]
32
33
  #[oapp]
33
34
  pub struct OFT;
34
35
 
@@ -40,6 +40,7 @@ impl DummyEndpoint {
40
40
  // ============================================================================
41
41
 
42
42
  #[oapp_macros::oapp(custom = [receiver])]
43
+ #[common_macros::lz_contract]
43
44
  pub struct LockUnlockHarnessOFT;
44
45
 
45
46
  #[contractimpl]
@@ -28,6 +28,7 @@ use utils::rbac::grant_role_no_auth;
28
28
  // ============================================================================
29
29
 
30
30
  #[oapp_macros::oapp]
31
+ #[common_macros::lz_contract]
31
32
  pub struct TestOFT;
32
33
 
33
34
  impl LzReceiveInternal for TestOFT {
@@ -58,7 +58,7 @@ use crate::{
58
58
  use common_macros::{contract_trait, only_role};
59
59
  use endpoint_v2::{MessagingComposerClient, MessagingFee, MessagingReceipt};
60
60
  use oapp::{
61
- oapp_core::{initialize_oapp, OAPP_ADMIN_ROLE},
61
+ oapp_core::{init_ownable_oapp, OAPP_ADMIN_ROLE},
62
62
  oapp_options_type3::OAppOptionsType3,
63
63
  oapp_receiver::OAppReceiver,
64
64
  oapp_sender::{FeePayer, OAppSenderInternal},
@@ -116,7 +116,7 @@ pub trait OFTInternal: OAppReceiver + OAppSenderInternal + OAppOptionsType3 + Ow
116
116
  delegate: &Address,
117
117
  ) {
118
118
  // Initialize OApp (includes owner initialization)
119
- initialize_oapp::<Self>(env, owner, endpoint, delegate);
119
+ init_ownable_oapp::<Self>(env, owner, endpoint, delegate);
120
120
 
121
121
  let local_decimals = TokenClient::new(env, token).decimals();
122
122
  assert_with_error!(env, local_decimals >= shared_decimals, OFTError::InvalidLocalDecimals);
@@ -133,6 +133,7 @@ mod test_mint_burn_oft {
133
133
  }
134
134
 
135
135
  #[oapp_macros::oapp]
136
+ #[common_macros::lz_contract]
136
137
  pub struct TestMintBurnOFT;
137
138
 
138
139
  #[contractimpl]
@@ -193,6 +194,7 @@ mod test_lock_unlock_oft {
193
194
  use soroban_sdk::{contractimpl, token::TokenClient, Address, Bytes, BytesN, Env};
194
195
 
195
196
  #[oapp_macros::oapp(custom = [receiver])]
197
+ #[common_macros::lz_contract]
196
198
  pub struct TestLockUnlockOFT;
197
199
 
198
200
  #[contractimpl]
@@ -20,6 +20,7 @@ The `#[oapp]` macro provides the simplest way to create an OApp:
20
20
  use oapp::oapp_receiver::LzReceiveInternal;
21
21
  use oapp_macros::oapp;
22
22
 
23
+ #[lz_contract]
23
24
  #[oapp]
24
25
  pub struct MyOApp;
25
26
 
@@ -38,13 +39,16 @@ impl LzReceiveInternal for MyOApp {
38
39
  }
39
40
  ```
40
41
 
41
- The macro automatically generates:
42
+ The macro generates only OApp trait implementations. You must apply a contract macro such as
43
+ `#[common_macros::lz_contract]` to the struct. `#[lz_contract]` provides:
44
+
45
+ - `#[soroban_sdk::contract]` — makes the struct a Soroban contract
46
+ - `#[common_macros::ownable]` or `#[common_macros::multisig]` — Auth (use `#[lz_contract(multisig)]` for multisig)
47
+ - `#[common_macros::ttl_configurable]` — adds TTL configuration with auth
48
+ - `#[common_macros::ttl_extendable]` — adds manual TTL extension support
49
+
50
+ The `#[oapp]` macro generates:
42
51
 
43
- - `#[common_macros::lz_contract]` attribute, which combines:
44
- - `#[soroban_sdk::contract]` — makes the struct a Soroban contract
45
- - `#[common_macros::ownable]` — adds single-owner access control
46
- - `#[common_macros::ttl_configurable]` — adds TTL configuration with auth
47
- - `#[common_macros::ttl_extendable]` — adds manual TTL extension support
48
52
  - `OAppCore` implementation
49
53
  - `OAppSenderInternal` implementation
50
54
  - `OAppReceiver` implementation
@@ -55,17 +59,17 @@ The macro automatically generates:
55
59
  Initialize your OApp in the constructor:
56
60
 
57
61
  ```rust
58
- use oapp::oapp_core::initialize_oapp;
62
+ use oapp::oapp_core::init_ownable_oapp;
59
63
 
60
64
  #[contract_impl]
61
65
  impl MyOApp {
62
66
  pub fn __constructor(env: &Env, owner: &Address, endpoint: &Address, delegate: &Address) {
63
- initialize_oapp::<Self>(env, owner, endpoint, delegate);
67
+ init_ownable_oapp::<Self>(env, owner, endpoint, delegate);
64
68
  }
65
69
  }
66
70
  ```
67
71
 
68
- The `initialize_oapp` function:
72
+ The `init_ownable_oapp` function:
69
73
 
70
74
  1. Sets the contract owner
71
75
  2. Stores the LayerZero endpoint address
@@ -158,6 +162,7 @@ Use `#[oapp(custom = [...])]` to override default behavior:
158
162
  ### Custom receiver (ordered delivery)
159
163
 
160
164
  ```rust
165
+ #[common_macros::lz_contract]
161
166
  #[oapp(custom = [receiver])]
162
167
  pub struct MyOrderedOApp;
163
168
 
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@layerzerolabs/protocol-stellar-v2",
3
- "version": "0.2.41",
3
+ "version": "0.2.44",
4
4
  "private": false,
5
5
  "devDependencies": {
6
6
  "@types/node": "^22.18.6",
7
7
  "tsx": "^4.19.3",
8
8
  "typescript": "^5.8.2",
9
- "@layerzerolabs/common-node-utils": "0.2.41",
10
- "@layerzerolabs/vm-tooling-stellar": "0.2.41"
9
+ "@layerzerolabs/common-node-utils": "0.2.44",
10
+ "@layerzerolabs/stellar-ts-bindings-gen": "0.2.44",
11
+ "@layerzerolabs/vm-tooling-stellar": "0.2.44"
11
12
  },
12
13
  "publishConfig": {
13
14
  "access": "restricted",
@@ -22,7 +23,7 @@
22
23
  "build": "pnpm build:contracts && pnpm generate:sdk",
23
24
  "build:contracts": "pnpm exec lz-tool stellar contract build",
24
25
  "format": "pnpm exec lz-tool --script \"cargo fmt\" stellar",
25
- "generate:sdk": "pnpm exec lz-tool --script \"cargo run -p ts-bindings-gen\" stellar",
26
+ "generate:sdk": "stellar-ts-bindings-gen --config ts-bindings-gen.toml",
26
27
  "lint": "pnpm exec lz-tool --script \"cargo clippy -- -D warnings\" stellar",
27
28
  "lint:fix": "pnpm exec lz-tool --script \"cargo clippy --fix --allow-dirty --allow-staged && cargo fmt\" stellar",
28
29
  "test": "pnpm exec lz-tool --script \"cargo nextest run\" stellar"