Skip to content

Commit

Permalink
updating docs according to new changes
Browse files Browse the repository at this point in the history
  • Loading branch information
haider-rs authored and dvc94ch committed Mar 20, 2023
1 parent 18d1cc0 commit ea3d92f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
2 changes: 2 additions & 0 deletions chains/ethereum/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,5 @@ For contract call this is the method signature of the function we want to call.
`storage`: This call type can be used to fetch storage from given contract provided the position of storage.

`storage_proof`: It returns proof of a value stored in contract storage at a given position.

`transaction_receipt`: This call type can be used to fetch transaction receipt of specified transaction.
9 changes: 9 additions & 0 deletions rosetta-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ pub fn create_signer(_keyfile: Option<&Path>) -> Result<Signer> {
}

/// Returns a client instance.
/// Parameters:
/// - `blockchain`: blockchain name e.g. "bitcoin", "ethereum".
/// - `network`: network name e.g. "dev".
/// - `url`: rosetta server url.
pub async fn create_client(
blockchain: Option<String>,
network: Option<String>,
Expand All @@ -85,6 +89,11 @@ pub async fn create_client(
}

/// Returns a wallet instance.
/// Parameters:
/// - `blockchain`: blockchain name e.g. "bitcoin", "ethereum".
/// - `network`: network name e.g. "dev".
/// - `url`: rosetta server url.
/// - `keyfile`: path to a keyfile.
pub async fn create_wallet(
blockchain: Option<String>,
network: Option<String>,
Expand Down
20 changes: 19 additions & 1 deletion rosetta-client/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ impl Wallet {
Ok(balance.balances[0].clone())
}

/// Returns blokck data
/// Returns block data
/// Takes PartialBlockIdentifier
pub async fn block(&self, data: PartialBlockIdentifier) -> Result<BlockResponse> {
let req = BlockRequest {
network_identifier: self.config.network(),
Expand All @@ -167,6 +168,9 @@ impl Wallet {
}

/// Returns transactions included in a block
/// Parameters:
/// 1. block_identifier: BlockIdentifier containing block number and hash
/// 2. tx_identifier: TransactionIdentifier containing hash of transaction
pub async fn block_transaction(
&self,
block_identifer: BlockIdentifier,
Expand Down Expand Up @@ -209,6 +213,8 @@ impl Wallet {
}

/// Returns the on chain metadata.
/// Parameters:
/// - metadata_params: the metadata parameters which we got from transaction builder.
pub async fn metadata(&self, metadata_params: serde_json::Value) -> Result<serde_json::Value> {
let req = ConstructionMetadataRequest {
network_identifier: self.config.network(),
Expand All @@ -220,6 +226,8 @@ impl Wallet {
}

/// Submits a transaction and returns the transaction identifier.
/// Parameters:
/// - transaction: the transaction bytes to submit
pub async fn submit(&self, transaction: &[u8]) -> Result<TransactionIdentifier> {
let req = ConstructionSubmitRequest {
network_identifier: self.config.network(),
Expand All @@ -230,6 +238,9 @@ impl Wallet {
}

/// Makes a transfer.
/// Parameters:
/// - account: the account to transfer to
/// - amount: the amount to transfer
pub async fn transfer(
&self,
account: &AccountIdentifier,
Expand All @@ -248,6 +259,9 @@ impl Wallet {
}

/// Makes a method call.
/// Parameters:
/// - method: the method to call
/// - params: the parameters to pass to the method
pub async fn method_call(&self, method: &str, params: Value) -> Result<TransactionIdentifier> {
let metadata_params = self.tx.method_call(method, &params)?;
let metadata = self.metadata(metadata_params.clone()).await?;
Expand All @@ -261,6 +275,8 @@ impl Wallet {
}

/// Uses the faucet on dev chains to seed the account with funds.
/// Parameters:
/// - faucet_parameter: the amount to seed the account with
pub async fn faucet(&self, faucet_parameter: u128) -> Result<TransactionIdentifier> {
let req = AccountFaucetRequest {
network_identifier: self.config.network(),
Expand All @@ -272,6 +288,8 @@ impl Wallet {
}

/// Returns the transaction matching the transaction identifier.
/// Parameters:
/// - tx: the transaction identifier to search for.
pub async fn transaction(&self, tx: TransactionIdentifier) -> Result<BlockTransaction> {
let req = SearchTransactionsRequest {
network_identifier: self.config().network(),
Expand Down

0 comments on commit ea3d92f

Please sign in to comment.