Skip to content

Commit

Permalink
style: rewrite #todo marker
Browse files Browse the repository at this point in the history
  • Loading branch information
gmosx committed Aug 15, 2023
1 parent e457261 commit 5e885f0
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion xrpl_api/src/api/account_channels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl AccountChannelsRequest {
}
}

// TODO: consider extracting as a type.
// #todo consider extracting as a type.

#[derive(Debug, Serialize, Deserialize)]
pub struct AccountChannel {
Expand Down
2 changes: 1 addition & 1 deletion xrpl_api/src/api/account_nfts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl AccountNftsRequest {
}
}

// TODO: consider extracting as a type.
// #todo consider extracting as a type.

/// The NFToken object represents a single non-fungible token (NFT). It is not
/// stored on its own, but is contained in a NFTokenPage object alongside other
Expand Down
6 changes: 3 additions & 3 deletions xrpl_binary_codec/src/serializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use xrpl_types::{Amount, IssuedAmount, Memo, Transaction};
pub const HASH_PREFIX_TRANSACTION: [u8; 4] = [0x53, 0x4E, 0x44, 0x00];
pub const HASH_PREFIX_UNSIGNED_TRANSACTION_SINGLE: [u8; 4] = [0x53, 0x54, 0x58, 0x00];

// TODO: Define type_code constants / enum
// #todo Define type_code constants / enum

#[derive(Default)]
pub struct Serializer {
Expand Down Expand Up @@ -85,7 +85,7 @@ impl Serializer {
}
}

// TODO: use more descriptive name.
// #todo use more descriptive name.
pub fn push_slice(&mut self, bytes: &[u8]) {
for byte in bytes {
self.push(*byte);
Expand Down Expand Up @@ -162,7 +162,7 @@ impl Serializer {
self.push_slice(decoded);
}

// TODO: implement generic `push_array`
// #todo implement generic `push_array`
// https://xrpl.org/serialization.html#array-fields

pub fn push_blob(&mut self, field_code: u8, blob: &[u8]) {
Expand Down
6 changes: 3 additions & 3 deletions xrpl_binary_codec/src/sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ pub fn sign_transaction(tx: Transaction, public_key: &[u8], secret_key: &[u8]) -
}

pub fn sign(data: &[u8], secret_key: &[u8]) -> Vec<u8> {
// INSIGHT: Sha512Trunc245 does not give same result as Sha512[0..32]
// #insight Sha512Trunc245 does not give same result as Sha512[0..32]
let mut hasher = Sha512::new();
hasher.update(data);
let hash = hasher.finalize().to_vec();

// TODO: remove unwraps.
// #todo remove unwraps.
let message = Message::parse_slice(&hash[0..32]).unwrap();
let key = SecretKey::parse_slice(secret_key).unwrap();

Expand Down Expand Up @@ -113,7 +113,7 @@ mod tests {
fn test_sign() {
let tx = hex::decode("deadbeaf").unwrap();

// INSIGHT: The secret key is 32 bytes long. Remove the first byte (2 hex chars)
// #insight The secret key is 32 bytes long. Remove the first byte (2 hex chars)
// if the key is padded to 33 bytes.
let key = hex::decode("915EDE054B37DF14BA612E7528A95B0D73013DC0ADED094B10957AD9BAD25455")
.unwrap();
Expand Down
10 changes: 5 additions & 5 deletions xrpl_binary_codec/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ const MAX_MANTISSA: i64 = 10i64.pow(16) - 1;
/// - <https://github.com/ripple/rippled/blob/develop/src/ripple/protocol/impl/STAmount.cpp#L781>
/// - <https://github.com/XRPLF/xrpl-py/blob/master/xrpl/core/binarycodec/types/amount.py#L141>
pub fn internal_number_from_string(s: &str) -> u64 {
// TODO: handle sign
// TODO: handle zero case
// TODO: handle integer case
// TODO: handle unwraps!
// #todo handle sign
// #todo handle zero case
// #todo handle integer case
// #todo handle unwraps!

if s == "0" || s == "0.0" {
// Special case for zero value.
Expand Down Expand Up @@ -60,7 +60,7 @@ pub fn internal_number_from_string(s: &str) -> u64 {
return 0b1000000000000000000000000000000000000000000000000000000000000000;
}

// TODO:
// #todo
//
// if exp > _MAX_IOU_EXPONENT or mantissa > _MAX_MANTISSA:
// raise XRPLBinaryCodecException(
Expand Down
6 changes: 3 additions & 3 deletions xrpl_cli/src/account/balances.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ pub async fn account_balances(
let account: &String = account_matches.get_one("ACCOUNT").unwrap();

let client = Client::new();
// TODO: also use account from environment.
// TODO: render as text/md, html and json.
// TODO: use handlebars for formatting?
// #todo also use account from environment.
// #todo render as text/md, html and json.
// #todo use handlebars for formatting?

let mut balances: HashMap<String, f64> = HashMap::new();

Expand Down
6 changes: 3 additions & 3 deletions xrpl_cli/src/account/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ pub async fn account_info(
let account: &String = account_matches.get_one("ACCOUNT").unwrap();

let client = Client::new();
// TODO: also use account from environment.
// TODO: render as text/md, html and json.
// TODO: use handlebars for formatting?
// #todo also use account from environment.
// #todo render as text/md, html and json.
// #todo use handlebars for formatting?

let resp = client.call(AccountInfoRequest::new(account)).await?;

Expand Down
8 changes: 4 additions & 4 deletions xrpl_cli/src/account/offers/list_offers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ pub async fn list_offers(
let account = account.as_ref();

let client = Client::new();
// TODO: add limit option
// TODO: also use account from environment.
// TODO: render as text/md, html and json.
// TODO: use handlebars for formatting?
// #todo add limit option
// #todo also use account from environment.
// #todo render as text/md, html and json.
// #todo use handlebars for formatting?

let req = AccountOffersRequest::new(account);
let resp = client.call(req).await?;
Expand Down
8 changes: 4 additions & 4 deletions xrpl_cli/src/account/trustlines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ pub async fn account_trustlines(
let account: &String = account_matches.get_one("ACCOUNT").unwrap();

let client = Client::new();
// TODO: add limit option
// TODO: also use account from environment.
// TODO: render as text/md, html and json.
// TODO: use handlebars for formatting?
// #todo add limit option
// #todo also use account from environment.
// #todo render as text/md, html and json.
// #todo use handlebars for formatting?

let resp = client.call(AccountLinesRequest::new(account)).await?;

Expand Down
4 changes: 2 additions & 2 deletions xrpl_cli/src/ledger/closed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use xrpl_sdk_jsonrpc::{Client, LedgerClosedRequest};
pub async fn ledger_closed(_ledger_matches: &ArgMatches) -> anyhow::Result<()> {
let client = Client::new();

// TODO: render as text/md, html and json.
// TODO: use handlebars for formatting?
// #todo render as text/md, html and json.
// #todo use handlebars for formatting?

let resp = client.call(LedgerClosedRequest::new()).await?;

Expand Down
2 changes: 1 addition & 1 deletion xrpl_sdk_jsonrpc/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl ClientBuilder {
pub struct Client {
base_url: String,
user_agent: String,
// TODO: hm, not really used currently.
// #todo hm, not really used currently.
http_client: reqwest::Client,
}

Expand Down
4 changes: 2 additions & 2 deletions xrpl_types/src/account.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! <https://xrpl.org/accounts.html>

// TODO: bad name, this is the 'base58Check' version.
// #todo bad name, this is the 'base58Check' version.
pub type AccountId = String;

// TODO: rename to account_root?
// #todo rename to account_root?
18 changes: 9 additions & 9 deletions xrpl_types/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ pub const TF_SETF_AUTH: u32 = 0x0001_0000;
pub const TF_SET_NO_RIPPLE: u32 = 0x0002_0000;
pub const TF_CLEAR_NO_RIPPLE: u32 = 0x0004_0000;

// TODO: consider separate structs per TransactionType?
// TODO: add the serde metadata.
// #todo consider separate structs per TransactionType?
// #todo add the serde metadata.

/// A ledger transaction
///
Expand Down Expand Up @@ -97,15 +97,15 @@ pub struct Transaction {
pub quality_out: Option<u32>,
}

// TODO: PaymentTransaction or Transaction<Payment>
// TODO: TransactionBuilder?
// #todo PaymentTransaction or Transaction<Payment>
// #todo TransactionBuilder?

impl Transaction {
// TODO: Synthetic offer_replace constructor?
// #todo Synthetic offer_replace constructor?

/// <https://xrpl.org/offercreate.html>
pub fn offer_create(account: &str, taker_pays: Amount, taker_gets: Amount) -> Self {
// TODO: Add support for expiration, offer_sequence
// #todo Add support for expiration, offer_sequence
Self {
transaction_type: TransactionType::OfferCreate,
account: account.to_string(),
Expand Down Expand Up @@ -176,7 +176,7 @@ impl Transaction {
}
}

// TODO: make sure we add the NO RIPPLE flag!!!!
// #todo make sure we add the NO RIPPLE flag!!!!
/// <https://xrpl.org/trustset.html>
pub fn trust_set(
account: &str,
Expand Down Expand Up @@ -216,7 +216,7 @@ impl Transaction {
Self {
transaction_type: TransactionType::TrustSet,
account: account.to_string(),
// TODO: remove TF_FULLY_CANONICAL_SIG, it's deprecated!
// #todo remove TF_FULLY_CANONICAL_SIG, it's deprecated!
flags: Some(TF_SET_NO_RIPPLE | TF_FULLY_CANONICAL_SIG),
last_ledger_sequence: None,
fee: None,
Expand Down Expand Up @@ -296,5 +296,5 @@ impl Transaction {
}
}

// TODO: with_fee
// #todo with_fee
}

0 comments on commit 5e885f0

Please sign in to comment.