ark_api_ffi/ffi/
applet_v1.rs

1define_api_id!(0xbb0f_0dfe_ff53_2a56, "applet-v1");
2
3#[ark_api_macros::ark_bindgen(imports = "ark-applet-v1")]
4mod applet {
5    use crate::pod_helpers::Align16U128;
6    type PlayerId = u64;
7
8    extern "C" {
9        /// A single 128-bit random value, unique to this run.
10        ///
11        /// Initialize your random number generators that need to be unpredictable from this.
12        /// Not meant for cryptographic operations.
13        #[deprecated_infallible]
14        pub fn random_seed_value() -> Align16U128;
15
16        /// Sets the system clipboard to a string.
17        /// Later, this will require a special permission.
18        #[deprecated_infallible]
19        pub fn set_clipboard_string(string: &str);
20
21        /// Sets the players clipboard to a string.
22        ///
23        /// This is done over network, so it is up to the client
24        /// to refuse the request (with no feedback to the server).
25        pub fn set_player_clipboard_string(player_id: PlayerId, string: &str);
26
27        /// Gets the system clipboard, keeps it around and returns the length.
28        ///
29        /// note: This should really been called `clipboard_string` (without the `get_`) prefix, should fix for a future breaking version
30        /// TODO: Replace this with one that actually just returns a `String`
31        #[deprecated_infallible]
32        pub fn get_clipboard_string() -> u32;
33
34        /// Retrieves the actual string bytes, also clears the internal buffer.
35        ///
36        /// TODO: Replace this with one that actually just returns a `String`
37        #[deprecated_infallible]
38        pub fn retrieve_clipboard_string(string: &mut [u8]);
39    }
40}
41
42pub use applet::*;