Skip to content

Commit

Permalink
Fix typos (#425)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaolou86 authored Nov 24, 2023
1 parent af40bc0 commit 95d8043
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 57 deletions.
10 changes: 5 additions & 5 deletions lib/web/rgb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ export interface AcceptResponse {
}

export interface ContractsResponse {
/// List of avaliable contracts
/// List of available contracts
contracts: ImportResponse[];
}

Expand All @@ -567,7 +567,7 @@ export interface ContractHiddenResponse {
}

export interface InterfacesResponse {
/// List of avaliable interfaces and implementations
/// List of available interfaces and implementations
interfaces: InterfaceDetail[];
}

Expand All @@ -581,14 +581,14 @@ export interface InterfaceDetail {
}

export interface SchemasResponse {
/// List of avaliable schemas
/// List of available schemas
schemas: SchemaDetail[];
}

export interface SchemaDetail {
/// Schema ID
schema: string;
/// Avaliable Interfaces
/// Available Interfaces
ifaces: string[];
}

Expand Down Expand Up @@ -721,7 +721,7 @@ export interface RgbTransferStatusResponse {
}

export interface RgbTransfersResponse {
/// List of avaliable transfers
/// List of available transfers
transfers: RgbTransferDetail[];
}

Expand Down
20 changes: 10 additions & 10 deletions src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,11 +363,11 @@ mod client {
let name = request.clone().file_name;
let url = format!("{endpoint}/proxy/consignment/{network}-{name}");
let body = RgbProxyConsigCarbonadoReq::from(request);
let (reponse, _) = post_json(&url, &body.clone())
let (response, _) = post_json(&url, &body.clone())
.await
.map_err(|op| ProxyServerError::Parse(op.to_string()))?;

let result = serde_json::from_str::<RgbProxyConsigUploadRes>(&reponse)
let result = serde_json::from_str::<RgbProxyConsigUploadRes>(&response)
.map_err(|op| ProxyServerError::Parse(op.to_string()))?;
Ok(result.clone())
}
Expand All @@ -379,11 +379,11 @@ mod client {

let request_id = request_id.replace("utxob:", "");
let url = format!("{endpoint}/proxy/consignment/{request_id}");
let reponse = get(&url, None)
let response = get(&url, None)
.await
.map_err(|op| ProxyServerError::Parse(op.to_string()))?;

let resp = match serde_json::from_str::<RgbProxyConsigRes>(&reponse) {
let resp = match serde_json::from_str::<RgbProxyConsigRes>(&response) {
Ok(resp) => Some(resp),
Err(_) => None,
};
Expand All @@ -397,11 +397,11 @@ mod client {
let endpoint = BITMASK_ENDPOINT.read().await.to_string();

let url = format!("{endpoint}/proxy/media/{attachment_id}");
let reponse = get(&url, None)
let response = get(&url, None)
.await
.map_err(|op| ProxyServerError::Parse(op.to_string()))?;

let resp = match serde_json::from_str::<RgbProxyMediaRes>(&reponse) {
let resp = match serde_json::from_str::<RgbProxyMediaRes>(&response) {
Ok(resp) => Some(resp),
Err(_) => None,
};
Expand All @@ -414,11 +414,11 @@ mod client {
let endpoint = BITMASK_ENDPOINT.read().await.to_string();

let url = format!("{endpoint}/proxy/media-metadata/{attachment_id}");
let reponse = get(&url, None)
let response = get(&url, None)
.await
.map_err(|op| ProxyServerError::Parse(op.to_string()))?;

let resp = match serde_json::from_str::<RgbProxyMediaRes>(&reponse) {
let resp = match serde_json::from_str::<RgbProxyMediaRes>(&response) {
Ok(resp) => Some(resp),
Err(_) => None,
};
Expand All @@ -436,11 +436,11 @@ mod client {
encode,
item: media,
};
let (reponse, _) = post_json(&url, &body.clone())
let (response, _) = post_json(&url, &body.clone())
.await
.map_err(|op| ProxyServerError::Parse(op.to_string()))?;

let result = serde_json::from_str::<MediaMetadata>(&reponse)
let result = serde_json::from_str::<MediaMetadata>(&response)
.map_err(|op| ProxyServerError::Parse(op.to_string()))?;
Ok(result.clone())
}
Expand Down
2 changes: 1 addition & 1 deletion src/rgb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ pub enum RgbSwapError {
NoWatcher,
/// Contract is required in this operation. Please, import or issue a Contract.
NoContract,
/// Avaliable Utxo is required in this operation. {0}
/// Available Utxo is required in this operation. {0}
NoUtxo(String),
/// The Offer has expired.
OfferExpired,
Expand Down
18 changes: 9 additions & 9 deletions src/rgb/prefetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ pub async fn prefetch_resolver_rgb(
let tx_raw = esplora_client
.get_tx(transaction_id)
.await
.expect("service unavaliable");
.expect("service unavailable");

if let Some(tx) = tx_raw {
let txid =
Expand Down Expand Up @@ -191,7 +191,7 @@ pub async fn prefetch_resolver_import_rgb(
let tx_raw = esplora_client
.get_tx(transaction_id)
.await
.expect("service unavaliable");
.expect("service unavailable");

if let Some(tx) = tx_raw {
let new_tx = Tx {
Expand Down Expand Up @@ -235,7 +235,7 @@ pub async fn prefetch_resolver_psbt(input_utxo: &str, explorer: &mut ExplorerRes
if let Some(tx) = esplora_client
.get_tx(&txid)
.await
.expect("service unavaliable")
.expect("service unavailable")
{
explorer.txs.insert(txid, tx);
}
Expand Down Expand Up @@ -351,7 +351,7 @@ pub async fn prefetch_resolver_utxos(
let mut related_txs = esplora_client
.scripthash_txs(&script_compatible, None)
.await
.expect("Service unavaliable");
.expect("Service unavailable");
let n_confirmed = related_txs.iter().filter(|tx| tx.status.confirmed).count();
// esplora pages on 25 confirmed transactions. If there are 25 or more we
// keep requesting to see if there's more.
Expand All @@ -360,7 +360,7 @@ pub async fn prefetch_resolver_utxos(
let new_related_txs = esplora_client
.scripthash_txs(&script_compatible, Some(related_txs.last().unwrap().txid))
.await
.expect("Service unavaliable");
.expect("Service unavailable");
let n = new_related_txs.len();
related_txs.extend(new_related_txs);
// we've reached the end
Expand Down Expand Up @@ -424,7 +424,7 @@ pub async fn prefetch_resolver_txs(txids: Vec<Txid>, explorer: &mut ExplorerReso
if let Some(tx) = esplora_client
.get_tx(&txid)
.await
.expect("service unavaliable")
.expect("service unavailable")
{
explorer.txs.insert(txid, tx);
}
Expand Down Expand Up @@ -536,7 +536,7 @@ pub async fn prefetch_resolver_wutxo(
if let Some(tx) = esplora_client
.get_tx(&outpoint.txid)
.await
.expect("service unavaliable")
.expect("service unavailable")
{
if let Some(vout) = tx.output.to_vec().get(outpoint.vout as usize) {
let sc = Script::from_str(&vout.script_pubkey.to_hex()).expect("invalid script");
Expand All @@ -561,7 +561,7 @@ pub async fn prefetch_resolver_tx_height(txid: rgbstd::Txid, explorer: &mut Expl
let tx = esplora_client
.get_tx_status(transaction_id)
.await
.expect("service unavaliable");
.expect("service unavailable");

if let Some(tx) = tx {
let status = match tx.block_height {
Expand Down Expand Up @@ -707,7 +707,7 @@ impl ExploreAsyncExt {
.get(&format!("{}/tx/{}", client.url(), txid))
.send()
.await
.expect("unavaliable esplora server");
.expect("unavailable esplora server");

if let StatusCode::NOT_FOUND = resp.status() {
return Err(ExploreClientExtError::NotFound);
Expand Down
2 changes: 1 addition & 1 deletion src/rgb/psbt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pub enum CreatePsbtError {
WrongAddress(AddressFormatParseError),
/// PSBT file cannot be created. '{0}'
Incomplete(String),
/// Invalid PSBT proprietry key. '{0}'
/// Invalid PSBT proprietary key. '{0}'
WrongMetadata(ProprietaryKeyError),
/// The PSBT is invalid (Unexpected behavior).
Inconclusive,
Expand Down
20 changes: 10 additions & 10 deletions src/rgb/resolvers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl rgb::Resolver for ExplorerResolver {
let mut utxos = bset![];
let explorer_client = esplora_block::Builder::new(&self.explorer_url)
.build_blocking()
.expect("service unavaliable");
.expect("service unavailable");

for (derive, script) in scripts {
// TODO: Remove that after bitcoin v.30 full compatibility
Expand All @@ -58,15 +58,15 @@ impl rgb::Resolver for ExplorerResolver {

let mut related_txs = explorer_client
.scripthash_txs(&script_compatible, None)
.expect("Service unavaliable");
.expect("Service unavailable");
let n_confirmed = related_txs.iter().filter(|tx| tx.status.confirmed).count();
// esplora pages on 25 confirmed transactions. If there are 25 or more we
// keep requesting to see if there's more.
if n_confirmed >= 25 {
loop {
let new_related_txs = explorer_client
.scripthash_txs(&script_compatible, Some(related_txs.last().unwrap().txid))
.expect("Service unavaliable");
.expect("Service unavailable");
let n = new_related_txs.len();
related_txs.extend(new_related_txs);
// we've reached the end
Expand Down Expand Up @@ -120,9 +120,9 @@ impl ResolveTx for ExplorerResolver {
) -> Result<bitcoin::Transaction, wallet::onchain::TxResolverError> {
let explorer_client = esplora_block::Builder::new(&self.explorer_url)
.build_blocking()
.expect("service unavaliable");
.expect("service unavailable");

match explorer_client.get_tx(&txid).expect("service unavaliable") {
match explorer_client.get_tx(&txid).expect("service unavailable") {
Some(tx) => Ok(tx),
_ => Err(TxResolverError { txid, err: none!() }),
}
Expand All @@ -146,12 +146,12 @@ impl ResolveHeight for ExplorerResolver {
fn resolve_height(&mut self, txid: Txid) -> Result<WitnessOrd, Self::Error> {
let esplora_client = esplora_block::Builder::new(&self.explorer_url)
.build_blocking()
.expect("service unavaliable");
.expect("service unavailable");
let transaction_id =
&bitcoin::Txid::from_str(&txid.to_hex()).expect("invalid transaction id parse");
let tx = esplora_client
.get_tx_status(transaction_id)
.expect("service unavaliable");
.expect("service unavailable");

let status = match tx.block_height {
Some(height) => WitnessOrd::OnChain(WitnessHeight::new(height).unwrap()),
Expand All @@ -173,13 +173,13 @@ impl ResolveCommiment for ExplorerResolver {
fn resolve_tx(&self, txid: Txid) -> Result<Tx, rgbstd::validation::TxResolverError> {
let explorer_client = esplora_block::Builder::new(&self.explorer_url)
.build_blocking()
.expect("service unavaliable");
.expect("service unavailable");

let transaction_id =
&bitcoin::Txid::from_str(&txid.to_hex()).expect("invalid transaction id parse");
let tx = explorer_client
.get_tx(transaction_id)
.expect("service unavaliable");
.expect("service unavailable");

match tx {
Some(tx) => Ok(Tx {
Expand Down Expand Up @@ -246,7 +246,7 @@ impl ResolveSpent for ExplorerResolver {
) -> Result<UtxoSpentStatus, Self::Error> {
let explorer_client = esplora_block::Builder::new(&self.explorer_url)
.build_blocking()
.expect("service unavaliable");
.expect("service unavailable");

let block_h = if block_height {
match explorer_client.get_full_tx(&txid) {
Expand Down
4 changes: 2 additions & 2 deletions src/rgb/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl ContractAmount {
/// A value ([`u64`]) combine with precision ([`u8`]), generate
/// a new contract value, compabitle with rgb contract value.
///
/// Remeber: All contract amounts are represents in [`u64`].
/// Remember: All contract amounts are represents in [`u64`].
/// The [`ContractAmount`] abstract the calculation.
///
/// # Examples
Expand Down Expand Up @@ -90,7 +90,7 @@ impl ContractAmount {
/// A value ([`u64`]) combine with precision ([`u8`]), load
/// a contract value, compabitle with rgb contract value.
///
/// Remeber: All contract amounts are represents in [`u64`].
/// Remember: All contract amounts are represents in [`u64`].
/// The [`ContractAmount`] abstract the calculation.
///
/// # Examples
Expand Down
18 changes: 9 additions & 9 deletions src/rgb/swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,20 +583,20 @@ pub async fn publish_public_offer(new_offer: RgbOfferSwap) -> Result<(), RgbOffe
let mut local_copy = automerge::AutoCommit::load(&doc)
.map_err(|op| RgbOfferErrors::AutoMerge(op.to_string()))?;
if let Some(offers) = rgb_offers.offers.get(&new_offer.contract_id) {
let mut avaliable_offers = offers.to_owned();
if let Some(position) = avaliable_offers
let mut available_offers = offers.to_owned();
if let Some(position) = available_offers
.iter()
.position(|x| x.offer_id == new_offer.offer_id)
{
avaliable_offers.remove(position);
avaliable_offers.insert(position, new_offer.clone());
available_offers.remove(position);
available_offers.insert(position, new_offer.clone());
} else {
avaliable_offers.push(new_offer.clone());
available_offers.push(new_offer.clone());
}

rgb_offers
.offers
.insert(new_offer.clone().contract_id, avaliable_offers);
.insert(new_offer.clone().contract_id, available_offers);
} else {
rgb_offers
.offers
Expand Down Expand Up @@ -630,9 +630,9 @@ pub async fn publish_public_bid(new_bid: RgbBidSwap) -> Result<(), RgbOfferError

let new_public_bid = PublicRgbBid::from(new_bid);
if let Some(bids) = rgb_offers.bids.get(&offer_id) {
let mut avaliable_bids = bids.to_owned();
avaliable_bids.insert(bid_id, new_public_bid);
rgb_offers.bids.insert(offer_id.clone(), avaliable_bids);
let mut available_bids = bids.to_owned();
available_bids.insert(bid_id, new_public_bid);
rgb_offers.bids.insert(offer_id.clone(), available_bids);
} else {
rgb_offers
.bids
Expand Down
4 changes: 2 additions & 2 deletions src/rgb/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ pub fn next_utxo(
let index = utxo.outpoint.vout.into_u32();
let utxo_status = resolver
.resolve_spent_status(txid, index.into(), true)
.expect("unavaliable service");
.expect("unavailable service");
if !utxo_status.is_spent && !utxo_status.clone().is_invalid_state() {
match utxo_status.block_height {
TxStatus::Mempool => {
Expand Down Expand Up @@ -210,7 +210,7 @@ pub fn next_utxos(
let index = utxo.outpoint.vout.into_u32();
let utxo_status = resolver
.resolve_spent_status(txid, index.into(), true)
.expect("unavaliable service");
.expect("unavailable service");
if !utxo_status.is_spent && !utxo_status.is_invalid_state() && !next_utxo.contains(&utxo) {
next_utxo.push(utxo);
}
Expand Down
Loading

0 comments on commit 95d8043

Please sign in to comment.