Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: document auto-generated <ContractType>Ext structs and their usage #1308

Open
dj8yfo opened this issue Feb 13, 2025 · 1 comment
Open

Comments

@dj8yfo
Copy link
Collaborator

dj8yfo commented Feb 13, 2025

not very clear where to put <ContractType>Ext doc itself

EDIT: it should be a sub-heading under #[near] macro documentation, peer (at the same heading level as) to attributes such as #[private] and what not

This task should describe, that this structure is created for all contracts, and what's the purpose of each method,
and how its methods signatures can be looked up on generated cargo doc --lib for contract

#[must_use]
pub struct CrossContractExt {
    pub(crate) account_id: ::near_sdk::AccountId,
    pub(crate) deposit: ::near_sdk::NearToken,
    pub(crate) static_gas: ::near_sdk::Gas,
    pub(crate) gas_weight: ::near_sdk::GasWeight,
}
impl CrossContractExt {
    pub fn with_attached_deposit(mut self, amount: ::near_sdk::NearToken) -> Self {
        /// ...
    }
    pub fn with_static_gas(mut self, static_gas: ::near_sdk::Gas) -> Self {
        /// ...
    }
    pub fn with_unused_gas_weight(mut self, gas_weight: u64) -> Self {
        /// ...
    }
}
impl CrossContract {
    /// API for calling this contract's functions in a subsequent execution.
    pub fn ext(account_id: ::near_sdk::AccountId) -> CrossContractExt {
        /// ....
    }
}
impl CrossContractExt {
    pub fn contract_source_metadata(self) -> ::near_sdk::Promise {
        /// ...
    }
}
impl CrossContractExt {
    pub fn method_one(self, n: u32) -> ::near_sdk::Promise {}

    pub fn method_two(self, n: u32) -> ::near_sdk::Promise {
        /// ...
    }
}

links:

  1. <ContractType>Ext => [near_sdk::Promise]
  2. anchor [near#inner-workings-of-nearcontract_state-macro-on-structenum] => <ContractType>Ext (added in scope of doc: #[near(contract_state)] in-depth pass #1307)
  3. anchor [near#inner-workings-of-near-macro-on-impl-block] => <ContractType>Ext (added in scope of doc: #[near(contract_state)] in-depth pass #1307)
@TobieTom
Copy link

Hola. I'm Tobias . I've already contributed to some projects concerning their documentation and would like to add this to my pool of experience plus I recently learned rust and cairo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: NEW❗
Development

No branches or pull requests

2 participants