Skip to content

Commit

Permalink
Bring remaining u32 amount types to u64
Browse files Browse the repository at this point in the history
  • Loading branch information
ok300 committed Oct 28, 2024
1 parent b78d53b commit 9a82900
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 28 deletions.
17 changes: 8 additions & 9 deletions cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 7 additions & 8 deletions lib/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ frb = ["dep:flutter_rust_bridge"]
[dependencies]
anyhow = { workspace = true }
bip39 = "2.0.0"
boltz-client = { git = "https://github.com/hydra-yse/boltz-rust", branch = "yse-fee-calculation" }
boltz-client = { git = "https://github.com/SatoshiPortal/boltz-rust", branch = "trunk" }
chrono = "0.4"
env_logger = "0.11"
flutter_rust_bridge = { version = "=2.4.0", features = [
Expand Down
2 changes: 1 addition & 1 deletion lib/core/src/buy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl BuyBitcoinApi for BuyBitcoinService {
self.moonpay_provider
.buy_bitcoin(
create_response.lockup_details.lockup_address,
Some(create_response.lockup_details.amount as u64),
Some(create_response.lockup_details.amount),
None,
redirect_url,
)
Expand Down
8 changes: 4 additions & 4 deletions lib/core/src/chain_swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ impl ChainSwapHandler {
.lowball_fee_rate_msat_per_vbyte()
.map(|v| v as f32),
&lockup_details.lockup_address,
lockup_details.amount as u64,
lockup_details.amount,
)
.await
{
Expand All @@ -612,7 +612,7 @@ impl ChainSwapHandler {
.build_drain_tx(
None,
&lockup_details.lockup_address,
Some(lockup_details.amount as u64),
Some(lockup_details.amount),
)
.await
}
Expand Down Expand Up @@ -1114,7 +1114,7 @@ impl ChainSwapHandler {
.unblind(&secp, liquid_swap_script.blinding_key.secret_key())?
.value;
}
if value < claim_details.amount as u64 {
if value < claim_details.amount {
return Err(anyhow!(
"Transaction value {value} sats is less than {} sats",
claim_details.amount
Expand Down Expand Up @@ -1159,7 +1159,7 @@ impl ChainSwapHandler {
.filter(|tx_out| tx_out.script_pubkey == address.script_pubkey())
.map(|tx_out| tx_out.value.to_sat())
.sum();
if value < claim_details.amount as u64 {
if value < claim_details.amount {
return Err(anyhow!(
"Transaction value {value} sats is less than {} sats",
claim_details.amount
Expand Down
2 changes: 1 addition & 1 deletion lib/core/src/persist/receive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ pub(crate) struct InternalCreateReverseResponse {
pub lockup_address: String,
pub refund_public_key: String,
pub timeout_block_height: u32,
pub onchain_amount: u32,
pub onchain_amount: u64,
pub blinding_key: Option<String>,
}
impl InternalCreateReverseResponse {
Expand Down
6 changes: 3 additions & 3 deletions lib/core/src/sdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1305,7 +1305,7 @@ impl LiquidSdk {
claim_public_key: Some(claim_public_key),
refund_public_key: Some(refund_public_key),
user_lock_amount: None,
server_lock_amount: Some(server_lockup_amount_sat as u32), // TODO update our model
server_lock_amount: Some(server_lockup_amount_sat),
pair_hash: Some(pair.hash),
referral_id: None,
webhook,
Expand Down Expand Up @@ -1594,7 +1594,7 @@ impl LiquidSdk {
});

let v2_req = CreateReverseRequest {
invoice_amount: payer_amount_sat as u32, // TODO update our model
invoice_amount: payer_amount_sat,
from: "BTC".to_string(),
to: "L-BTC".to_string(),
preimage_hash: preimage.sha256,
Expand Down Expand Up @@ -1711,7 +1711,7 @@ impl LiquidSdk {
preimage_hash: preimage.sha256,
claim_public_key: Some(claim_public_key),
refund_public_key: Some(refund_public_key),
user_lock_amount: Some(user_lockup_amount_sat as u32), // TODO update our model
user_lock_amount: Some(user_lockup_amount_sat),
server_lock_amount: None,
pair_hash: Some(pair.hash),
referral_id: None,
Expand Down
2 changes: 1 addition & 1 deletion lib/core/src/test_utils/persist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub(crate) fn new_send_swap(payment_state: Option<PaymentState>) -> SendSwap {
let payment_hash = sha256::Hash::from_slice(&[0; 32][..]).expect("Expecting valid hash");
let invoice = InvoiceBuilder::new(Currency::BitcoinTestnet)
.description("Test invoice".into())
.payment_hash(payment_hash.clone())
.payment_hash(payment_hash)
.payment_secret(PaymentSecret([42u8; 32]))
.current_timestamp()
.min_final_cltv_expiry_delta(144)
Expand Down

0 comments on commit 9a82900

Please sign in to comment.