@@ -55,10 +55,6 @@ pub fn symbol(input: TokenStream) -> TokenStream {
5555 }
5656}
5757
58- /// Exports the publicly accessible functions in the implementation.
59- ///
60- /// Functions that are publicly accessible in the implementation are invocable
61- /// by other contracts, or directly by transactions, when deployed.
6258#[ proc_macro_attribute]
6359pub fn contractimpl ( _metadata : TokenStream , input : TokenStream ) -> TokenStream {
6460 let imp = parse_macro_input ! ( input as ItemImpl ) ;
@@ -123,23 +119,6 @@ struct ContractTypeArgs {
123119 export : Option < bool > ,
124120}
125121
126- /// Generates conversions from the struct/enum from/into a `RawVal`.
127- ///
128- /// There are some constraints on the types that are supported:
129- /// - Enums with integer values must have an explicit integer literal for every
130- /// variant.
131- /// - Enums with unit variants are supported.
132- /// - Enums with tuple-like variants with a maximum of one tuple field are
133- /// supported. The tuple field must be of a type that is also convertible to and
134- /// from `RawVal`.
135- /// - Enums with struct-like variants are not supported.
136- /// - Structs are supported. All fields must be of a type that is also
137- /// convertible to and from `RawVal`.
138- /// - All variant names, field names, and type names must be 10-characters or
139- /// less in length.
140- ///
141- /// Includes the type in the contract spec so that clients can generate bindings
142- /// for the type.
143122#[ proc_macro_attribute]
144123pub fn contracttype ( metadata : TokenStream , input : TokenStream ) -> TokenStream {
145124 let args = parse_macro_input ! ( metadata as AttributeArgs ) ;
@@ -197,15 +176,6 @@ pub fn contracttype(metadata: TokenStream, input: TokenStream) -> TokenStream {
197176 . into ( )
198177}
199178
200- /// Generates conversions from the repr(u32) enum from/into a `Status`.
201- ///
202- /// There are some constraints on the types that are supported:
203- /// - Enum must derive `Copy`.
204- /// - Enum variants must have an explicit integer literal.
205- /// - Enum variants must have a value convertible to u32.
206- ///
207- /// Includes the type in the contract spec so that clients can generate bindings
208- /// for the type.
209179#[ proc_macro_attribute]
210180pub fn contracterror ( metadata : TokenStream , input : TokenStream ) -> TokenStream {
211181 let args = parse_macro_input ! ( metadata as AttributeArgs ) ;
@@ -255,7 +225,6 @@ struct ContractFileArgs {
255225 sha256 : darling:: util:: SpannedValue < String > ,
256226}
257227
258- #[ doc( hidden) ]
259228#[ proc_macro]
260229pub fn contractfile ( metadata : TokenStream ) -> TokenStream {
261230 let args = parse_macro_input ! ( metadata as AttributeArgs ) ;
@@ -297,7 +266,6 @@ struct ContractClientArgs {
297266 name : String ,
298267}
299268
300- #[ doc( hidden) ]
301269#[ proc_macro_attribute]
302270pub fn contractclient ( metadata : TokenStream , input : TokenStream ) -> TokenStream {
303271 let args = parse_macro_input ! ( metadata as AttributeArgs ) ;
@@ -322,51 +290,6 @@ struct ContractImportArgs {
322290 #[ darling( default ) ]
323291 sha256 : darling:: util:: SpannedValue < Option < String > > ,
324292}
325-
326- /// Import a contract from its WASM file.
327- ///
328- /// Generates in the current module:
329- /// - A `Contract` trait that matches the contracts interface.
330- /// - A `ContractClient` struct that has functions for each function in the
331- /// contract.
332- /// - Types for all contract types defined in the contract.
333- ///
334- /// ### Examples
335- ///
336- /// ```ignore
337- /// use soroban_sdk::{BytesN, Env, Symbol};
338- ///
339- /// mod contract_a {
340- /// soroban_sdk::contractimport!(file = "contract_a.wasm");
341- /// }
342- ///
343- /// pub struct ContractB;
344- ///
345- /// #[contractimpl]
346- /// impl ContractB {
347- /// pub fn add_with(env: Env, contract_id: BytesN<32>, x: u32, y: u32) -> u32 {
348- /// let client = contract_a::ContractClient::new(&env, contract_id);
349- /// client.add(&x, &y)
350- /// }
351- /// }
352- ///
353- /// #[test]
354- /// fn test() {
355- /// let env = Env::default();
356- /// // Register contract A using the imported WASM.
357- /// let contract_a_id = env.register_contract_wasm(None, contract_a::WASM);
358- /// let contract_b_id = BytesN::from_array(&env, &[1; 32]);
359- /// // Register contract B defined in this crate.
360- /// env.register_contract(&contract_b_id, ContractB);
361- ///
362- /// // Create a client for calling contract B.
363- /// let client = ContractBClient::new(&env, &contract_b_id);
364- ///
365- /// // Invoke contract B via its client.
366- /// let sum = client.add_with(&contract_a_id, &5, &7);
367- /// assert_eq!(sum, 12);
368- /// }
369- /// ```
370293#[ proc_macro]
371294pub fn contractimport ( metadata : TokenStream ) -> TokenStream {
372295 let attr_args = parse_macro_input ! ( metadata as AttributeArgs ) ;
0 commit comments