Skip to content

Commit 051e111

Browse files
committed
Fix compilation errors
1 parent 270a005 commit 051e111

File tree

6 files changed

+90
-46
lines changed

6 files changed

+90
-46
lines changed

Cargo.lock

+22-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/pink/pink-extension/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ std = [
2222

2323
Then, you can use the `http_get!` macro to make a GET request to a remote server:
2424

25-
```rust
25+
```ignore
2626
#[ink::message]
2727
fn http_get_example(&self) {
2828
let response = pink::http_get!("https://httpbin.org/get");
@@ -59,7 +59,7 @@ There are two ways to use JavaScript in your contract:
5959

6060
- For the simplest integration, consider using the [`phat_js`](https://docs.rs/phat_js/) crate. It provides an `eval` function that lets you evaluate JavaScript code snippets directly.
6161
For example:
62-
```rust
62+
```ignore
6363
#[ink::message]
6464
fn eval_js_example(&self) {
6565
let result = phat_js::eval("'Hello,' + 'World'", &[]);

crates/pink/pink-extension/macro/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub fn system(arg: TokenStream, input: TokenStream) -> TokenStream {
5555
/// Below, the `SidevmOperation` trait is annotated with `#[pink::driver]`. This marks it
5656
/// as a driver contract, enabling it to manage SideVM deployments.
5757
///
58-
/// ```rust
58+
/// ```ignore
5959
/// #[pink::driver]
6060
/// #[ink::trait_definition]
6161
/// pub trait SidevmOperation {
@@ -75,7 +75,7 @@ pub fn system(arg: TokenStream, input: TokenStream) -> TokenStream {
7575
/// The actual driver can then be retrieved and its methods, defined by the trait, can be used.
7676
/// For instance, to start a SideVM, one would get the driver instance and call its `deploy` method:
7777
///
78-
/// ```rust
78+
/// ```ignore
7979
/// pub fn start_sidevm(code_hash: Hash) -> Result<(), system::DriverError> {
8080
/// let driver =
8181
/// SidevmOperationRef::instance().ok_or(system::Error::DriverNotFound)?;

crates/pink/pink-extension/macro/src/snapshots/pink_extension_macro__driver_system__tests__show_patch_result.snap

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
---
22
source: crates/pink/pink-extension/macro/src/driver_system.rs
3-
assertion_line: 250
3+
assertion_line: 286
44
expression: "rustfmt_snippet::rustfmt_token_stream(&stream).unwrap()"
55
---
6+
#[doc = "**The doc is messed up by the ink macro. See [`SystemForDoc`] for a clean version**\n\n"]
67
#[ink::trait_definition(namespace = "pink_system")]
78
pub trait System {
89
#[ink(message)]
@@ -12,6 +13,13 @@ pub trait System {
1213
#[ink(message)]
1314
fn deploy_sidevm_to(&self, code_hash: Hash, contract_id: AccountId) -> Result<()>;
1415
}
16+
#[cfg(doc)]
17+
#[doc = "**This is the clean version doc of [`System`]**\n\n"]
18+
pub trait SystemForDoc {
19+
fn get_driver(&self, name: String) -> Option<AccountId>;
20+
fn set_driver(&self, name: String, driver: AccountId);
21+
fn deploy_sidevm_to(&self, code_hash: Hash, contract_id: AccountId) -> Result<()>;
22+
}
1523
pub use _pink_system_impl::SystemRef;
1624
mod _pink_system_impl {
1725
use super::*;

crates/pink/pink-extension/src/chain_extension.rs

+28-24
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ pub use signing::SigType;
88

99
use crate::{Balance, EcdsaPublicKey, EcdsaSignature, Hash};
1010

11+
#[cfg(doc)]
12+
use crate::{http_get, http_post, http_put, debug, info, warn, error};
13+
1114
mod http_request;
1215
pub mod signing;
1316

@@ -116,15 +119,15 @@ pub trait PinkExt {
116119
///
117120
/// # Example
118121
///
119-
/// ```
122+
/// ```ignore
120123
/// let request = HttpRequest::new("https://httpbin.org/get", "GET", Defualt::default(), Defualt::default());
121124
/// let response = pink::ext().http_request(request);
122125
/// ```
123126
///
124127
/// There are also some shortcut macros for this function:
125-
/// - [`crate::http_get!`]
126-
/// - [`crate::http_post!`]
127-
/// - [`crate::http_put!`]
128+
/// - [`http_get!`]
129+
/// - [`http_post!`]
130+
/// - [`http_put!`]
128131
///
129132
/// # Availability
130133
/// any contract | query only
@@ -145,7 +148,7 @@ pub trait PinkExt {
145148
///
146149
/// # Example
147150
///
148-
/// ```
151+
/// ```ignore
149152
/// let derived_key = pink::ext().derive_sr25519_key(b"some salt".into());
150153
/// let message = b"Hello, world!";
151154
/// let signature = pink::ext().sign(SigType::Sr25519, &key, message);
@@ -179,7 +182,7 @@ pub trait PinkExt {
179182
///
180183
/// # Example
181184
///
182-
/// ```
185+
/// ```ignore
183186
/// let derived_key = pink::ext().derive_sr25519_key(b"some salt".into());
184187
/// let message = b"Hello, world!";
185188
/// let signature = pink::ext().sign(SigType::Sr25519, &key, message);
@@ -207,7 +210,7 @@ pub trait PinkExt {
207210
///
208211
/// # Example
209212
///
210-
/// ```
213+
/// ```ignore
211214
/// let derived_key = pink::ext().derive_sr25519_key(b"some salt".into());
212215
/// ```
213216
///
@@ -231,7 +234,7 @@ pub trait PinkExt {
231234
///
232235
/// # Example
233236
///
234-
/// ```
237+
/// ```ignore
235238
/// let derived_key = pink::ext().derive_sr25519_key(b"some salt".into());
236239
/// let pubkey = pink::ext().get_public_key(SigType::Sr25519, &derived_key);
237240
/// ```
@@ -273,7 +276,7 @@ pub trait PinkExt {
273276
///
274277
/// # Example
275278
///
276-
/// ```
279+
/// ```ignore
277280
/// let key = b"my key";
278281
/// let value = b"my value";
279282
/// let result = pink::ext().cache_set(key, value);
@@ -295,7 +298,7 @@ pub trait PinkExt {
295298
///
296299
/// # Example
297300
///
298-
/// ```
301+
/// ```ignore
299302
/// let key = b"my key";
300303
/// let expire = 60; // 1 minute
301304
/// pink::ext().cache_set_expiration(key, expire);
@@ -322,7 +325,7 @@ pub trait PinkExt {
322325
///
323326
/// # Example
324327
///
325-
/// ```
328+
/// ```ignore
326329
/// let key = b"my key";
327330
/// let value = pink::ext().cache_get(key);
328331
/// ```
@@ -362,7 +365,7 @@ pub trait PinkExt {
362365
///
363366
/// # Example
364367
///
365-
/// ```
368+
/// ```ignore
366369
/// let level = 1;
367370
/// let message = "Hello, world!";
368371
/// pink::ext().log(level, message);
@@ -371,10 +374,10 @@ pub trait PinkExt {
371374
/// # Note
372375
/// This is the low-level method for logging. It is recommended to use shortcuts macros below instead:
373376
///
374-
/// - [`crate::debug!`]
375-
/// - [`crate::info!`]
376-
/// - [`crate::warn!`]
377-
/// - [`crate::error!`]
377+
/// - [`debug!`]
378+
/// - [`info!`]
379+
/// - [`warn!`]
380+
/// - [`error!`]
378381
///
379382
/// # Availability
380383
/// any contract | query | transaction
@@ -400,7 +403,7 @@ pub trait PinkExt {
400403
///
401404
/// # Example
402405
///
403-
/// ```
406+
/// ```ignore
404407
/// let length = 32;
405408
/// let random_bytes = pink::ext().getrandom(length);
406409
/// ```
@@ -418,6 +421,7 @@ pub trait PinkExt {
418421
///
419422
/// # Availability
420423
/// any contract | query | transaction
424+
#[allow(clippy::wrong_self_convention)]
421425
#[ink(extension = 12, handle_status = false)]
422426
fn is_in_transaction() -> bool;
423427

@@ -436,7 +440,7 @@ pub trait PinkExt {
436440
///
437441
/// # Example
438442
///
439-
/// ```
443+
/// ```ignore
440444
/// let key = [0u8; 32]; // replace with actual key
441445
/// let message_hash = Hash::zero(); // replace with actual hash
442446
/// let signature = pink::ext().ecdsa_sign_prehashed(&key, message_hash);
@@ -463,7 +467,7 @@ pub trait PinkExt {
463467
///
464468
/// # Example
465469
///
466-
/// ```
470+
/// ```ignore
467471
/// let signature = EcdsaSignature::default(); // replace with actual signature
468472
/// let message_hash = Hash::zero(); // replace with actual hash
469473
/// let pubkey = EcdsaPublicKey::default(); // replace with actual pubkey
@@ -525,7 +529,7 @@ pub trait PinkExt {
525529
///
526530
/// # Example
527531
///
528-
/// ```
532+
/// ```ignore
529533
/// let current_millis = pink::ext().untrusted_millis_since_unix_epoch();
530534
/// ```
531535
///
@@ -542,7 +546,7 @@ pub trait PinkExt {
542546
///
543547
/// # Example
544548
///
545-
/// ```
549+
/// ```ignore
546550
/// let code_hash = Hash::zero(); // replace with actual code hash
547551
/// let exists = pink::ext().code_exists(code_hash, false);
548552
/// ```
@@ -560,7 +564,7 @@ pub trait PinkExt {
560564
///
561565
/// # Example
562566
///
563-
/// ```
567+
/// ```ignore
564568
/// let payer = AccountId::default(); // replace with actual payer id
565569
/// let code_hash = pink::ext().import_latest_system_code(payer);
566570
/// ```
@@ -578,7 +582,7 @@ pub trait PinkExt {
578582
///
579583
/// # Example
580584
///
581-
/// ```
585+
/// ```ignore
582586
/// let (major, minor) = pink::ext().runtime_version();
583587
/// ```
584588
///
@@ -602,7 +606,7 @@ pub trait PinkExt {
602606
///
603607
/// # Example
604608
///
605-
/// ```
609+
/// ```ignore
606610
/// let requests = vec![
607611
/// HttpRequest::new("https://httpbin.org/get",
608612
/// "GET",

0 commit comments

Comments
 (0)