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

chore!: added documentation for root level and signer module #32

Merged
merged 10 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions examples/sign_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ async fn main() {
Account(account.id().clone())
.add_key(AccessKeyPermission::FullAccess, ledger_pubkey)
.with_signer(
Signer::new(Signer::seed_phrase(new_seed_phrase, Some("smile".to_string())).unwrap())
.unwrap(),
Signer::new(Signer::seed_phrase(&new_seed_phrase, Some("smile")).unwrap()).unwrap(),
akorchyn marked this conversation as resolved.
Show resolved Hide resolved
)
.send_to(&network)
.await
Expand Down
56 changes: 56 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,59 @@
//! A Rust library for interacting with the NEAR Protocol blockchain
//!
//! This crate provides a high-level API for interacting with NEAR Protocol, including:
//! - Account management and creation
akorchyn marked this conversation as resolved.
Show resolved Hide resolved
//! - Contract deployment and interaction
akorchyn marked this conversation as resolved.
Show resolved Hide resolved
//! - Token operations (NEAR, FT, NFT)
akorchyn marked this conversation as resolved.
Show resolved Hide resolved
//! - Storage management and staking operations
//! - Custom transaction building and signing
//! - Several ways to sign the transaction (SecretKey, Seedphrase, File, Ledger, Secure keychain).
//! - Account nonce caching and access-key pooling mechanisms to speed up the transaction processing.
//! - Support for backup RPC endpoints
//!
//! # Example
akorchyn marked this conversation as resolved.
Show resolved Hide resolved
//! ```rust,no_run
//! use near_api::{*, signer::generate_secret_key};
//! use std::str::FromStr;
//!
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! // Initialize network configuration
//! let bob = AccountId::from_str("bob.testnet")?;
//! let bob_seed_phrase = "lucky barrel fall come bottom can rib join rough around subway cloth ";
//!
//! // Fetch NEAR balance
//! let _bob_balance = Tokens::account(bob.clone())
//! .near_balance()
//! .fetch_from_testnet()
//! .await?;
//!
//! // Create an account instance
//! let signer = Signer::new(Signer::seed_phrase(bob_seed_phrase, None)?)?;
//! let alice_secret_key = generate_secret_key()?;
//! Account::create_account(AccountId::from_str("alice.testnet")?)
//! .fund_myself(bob.clone(), NearToken::from_near(1))
//! .public_key(alice_secret_key.public_key())?
//! .with_signer(signer)
//! .send_to_testnet()
//! .await?;
//! # Ok(())
//! # }
//! ```
//!
//! # Features
//! - `ledger`: Enables hardware wallet support
//! - `keystore`: Enables system keychain integration
//! - `workspaces`: Enables integration with near-workspaces for testing
//!
//! # Modules
//! - [`Account`]: Account management and creation
akorchyn marked this conversation as resolved.
Show resolved Hide resolved
//! - [`Chain`]: Chain data queries (block, block number)
//! - [`Contract`]: Contract deployment and interaction
//! - [`Staking`]: Staking operations
//! - [`StorageDeposit`]: Storage management and staking operations
//! - [`Tokens`]: Token operations (NEAR, FT, NFT)
//! - [`Transaction`]: Custom transaction building and signing
//! - [`Signer`](`signer`): Signer management and signing

mod account;
mod chain;
mod config;
Expand Down
Loading
Loading