depolymerization

wire gateway for Bitcoin/Ethereum
Log | Files | Refs | Submodules | README | LICENSE

commit 2e56f6960161ae30758dd44ff2181c54f8ed2c10
parent 502ed283fd45af1f430e94a90f9a57e5d7621ade
Author: Antoine A <>
Date:   Tue, 17 Dec 2024 20:14:15 +0100

update utils

Diffstat:
MCargo.lock | 118++++++++++++++++++++++++++++++++++++++++++++++---------------------------------
Mbtc-wire/src/lib.rs | 14++++++++------
Mbtc-wire/src/loops/worker.rs | 3++-
Mbtc-wire/src/taler_utils.rs | 11++++++++---
Mcommon/src/config.rs | 2+-
Mcommon/src/sql.rs | 5++++-
Meth-wire/src/lib.rs | 2+-
Meth-wire/src/loops/worker.rs | 2+-
Meth-wire/src/taler_util.rs | 2+-
Minstrumentation/src/gateway.rs | 4++--
Minstrumentation/src/utils.rs | 4++--
Mwire-gateway/src/main.rs | 5++---
12 files changed, 101 insertions(+), 71 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock @@ -308,7 +308,7 @@ dependencies = [ "serde", "serde_json", "serde_repr", - "thiserror 2.0.6", + "thiserror 2.0.7", ] [[package]] @@ -337,9 +337,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.2.3" +version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27f657647bcff5394bf56c7317665bbf790a137a50eaaa5c6bfbb9e27a518f2d" +checksum = "9157bbaa6b165880c27a4293a474c91cdcf265cc68cc829bf10be0964a391caf" dependencies = [ "shlex", ] @@ -472,7 +472,7 @@ dependencies = [ "serde_with", "sqlx", "taler-common", - "thiserror 2.0.6", + "thiserror 2.0.7", "uri-pack", "url", "zeroize", @@ -489,15 +489,15 @@ dependencies = [ [[package]] name = "console" -version = "0.15.8" +version = "0.15.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" +checksum = "ea3c6ecd8059b57859df5c69830340ed3c41d30e3da0c1cbed90a96ac853041b" dependencies = [ "encode_unicode", - "lazy_static", "libc", - "unicode-width 0.1.14", - "windows-sys 0.52.0", + "once_cell", + "unicode-width", + "windows-sys 0.59.0", ] [[package]] @@ -616,9 +616,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" dependencies = [ "crossbeam-epoch", "crossbeam-utils", @@ -635,18 +635,18 @@ dependencies = [ [[package]] name = "crossbeam-queue" -version = "0.3.11" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" +checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.20" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crunchy" @@ -810,9 +810,9 @@ dependencies = [ [[package]] name = "encode_unicode" -version = "0.3.6" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" [[package]] name = "env_logger" @@ -862,7 +862,7 @@ dependencies = [ "serde", "serde_json", "serde_repr", - "thiserror 2.0.6", + "thiserror 2.0.7", ] [[package]] @@ -951,7 +951,7 @@ checksum = "4613c3fa90ebf91dff72ff383a9324329c017819711bda86142be81368ac6fad" dependencies = [ "chrono", "log", - "thiserror 2.0.6", + "thiserror 2.0.7", ] [[package]] @@ -1182,11 +1182,11 @@ dependencies = [ [[package]] name = "home" -version = "0.5.9" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1237,9 +1237,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "1.5.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f" +checksum = "256fb8d4bd6413123cc9d91832d78325c48ff41677595be797d90f42969beae0" dependencies = [ "bytes", "futures-channel", @@ -1478,7 +1478,7 @@ dependencies = [ "console", "number_prefix", "portable-atomic", - "unicode-width 0.2.0", + "unicode-width", "web-time", ] @@ -1539,6 +1539,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] +name = "jiff" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db69f08d4fb10524cacdb074c10b296299d71274ddbc830a8ee65666867002e9" +dependencies = [ + "jiff-tzdb-platform", + "windows-sys 0.59.0", +] + +[[package]] +name = "jiff-tzdb" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91335e575850c5c4c673b9bd467b0e025f164ca59d0564f69d0c2ee0ffad4653" + +[[package]] +name = "jiff-tzdb-platform" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9835f0060a626fe59f160437bc725491a6af23133ea906500027d1bd2f8f4329" +dependencies = [ + "jiff-tzdb", +] + +[[package]] name = "js-sys" version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1682,9 +1707,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.8.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +checksum = "4ffbe83022cedc1d264172192511ae958937694cd57ce297164951b8b3568394" dependencies = [ "adler2", ] @@ -2043,9 +2068,9 @@ dependencies = [ [[package]] name = "proptest" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" +checksum = "14cae93065090804185d3b75f0bf93b8eeda30c7a9b4a33d3bdb3988d6229e50" dependencies = [ "bitflags", "lazy_static", @@ -2303,9 +2328,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.10.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" +checksum = "d2bf47e6ff922db3825eb750c4e2ff784c6ff8fb9e13046ef6a1d1c5401b0b37" [[package]] name = "rustls-webpki" @@ -2863,7 +2888,7 @@ dependencies = [ [[package]] name = "taler-api" version = "0.1.0" -source = "git+https://git.taler.net/taler-rust.git/#fcc09117ad3a761486922279845b3abec0efd024" +source = "git+https://git.taler.net/taler-rust.git/#95f68d984566240e7606df863ec61460e1b8ae93" dependencies = [ "axum", "dashmap", @@ -2884,17 +2909,18 @@ dependencies = [ [[package]] name = "taler-common" version = "0.1.0" -source = "git+https://git.taler.net/taler-rust.git/#fcc09117ad3a761486922279845b3abec0efd024" +source = "git+https://git.taler.net/taler-rust.git/#95f68d984566240e7606df863ec61460e1b8ae93" dependencies = [ "base32", "fastrand", + "jiff", "rand", "serde", "serde_json", "serde_urlencoded", "serde_with", "sqlx", - "thiserror 2.0.6", + "thiserror 2.0.7", "url", ] @@ -2931,11 +2957,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.6" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fec2a1820ebd077e2b90c4df007bebf344cd394098a13c563957d0afc83ea47" +checksum = "93605438cbd668185516ab499d589afb7ee1859ea3d5fc8f6b0755e1c7443767" dependencies = [ - "thiserror-impl 2.0.6", + "thiserror-impl 2.0.7", ] [[package]] @@ -2951,9 +2977,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.6" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d65750cab40f4ff1929fb1ba509e9914eb756131cef4210da8d5d700d26f6312" +checksum = "e1d8749b4531af2117677a5fcd12b1348a3fe2b81e36e61ffeac5c4aa3273e36" dependencies = [ "proc-macro2", "quote", @@ -3272,9 +3298,9 @@ checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" [[package]] name = "unicode-bidi" -version = "0.3.17" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" [[package]] name = "unicode-ident" @@ -3299,12 +3325,6 @@ checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" [[package]] name = "unicode-width" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" - -[[package]] -name = "unicode-width" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" @@ -3349,7 +3369,7 @@ dependencies = [ "quickcheck", "quickcheck_macros", "serde_json", - "thiserror 2.0.6", + "thiserror 2.0.7", "url", ] @@ -3724,7 +3744,7 @@ dependencies = [ "sqlx", "taler-api", "taler-common", - "thiserror 2.0.6", + "thiserror 2.0.7", "time", "tokio", ] diff --git a/btc-wire/src/lib.rs b/btc-wire/src/lib.rs @@ -18,12 +18,14 @@ use std::str::FromStr; use bitcoin::{hashes::hex::FromHex, Address, Amount, Network, Txid}; use btc_config::BitcoinConfig; -use common::config::TalerConfig; -use common::currency::{Currency, CurrencyBtc}; -use common::log::{fail, OrFail}; -use common::postgres; -use common::taler_common::amount::Amount as TalerAmount; -use common::url::Url; +use common::{ + config::TalerConfig, + currency::{Currency, CurrencyBtc}, + log::{fail, OrFail}, + postgres, + taler_common::types::amount::Amount as TalerAmount, + url::Url, +}; use rpc::{Category, Rpc, Transaction}; use rpc_utils::{default_data_dir, segwit_min_amount, sender_address}; use segwit::{decode_segwit_msg, encode_segwit_key}; diff --git a/btc-wire/src/loops/worker.rs b/btc-wire/src/loops/worker.rs @@ -32,7 +32,8 @@ use common::{ reconnect::AutoReconnectDb, sql::{sql_array, sql_url}, status::{BounceStatus, DebitStatus}, - taler_common::api_common::{base32, Timestamp}, + taler_common::api_common::base32, + taler_common::types::timestamp::Timestamp, }; use postgres::{fallible_iterator::FallibleIterator, Client}; diff --git a/btc-wire/src/taler_utils.rs b/btc-wire/src/taler_utils.rs @@ -16,9 +16,14 @@ //! Utils function to convert taler API types to bitcoin API types use bitcoin::{Address, Amount as BtcAmount, SignedAmount}; -use common::taler_common::{amount::Amount, payto::Payto}; -use common::url::Url; -use common::{currency::CurrencyBtc, taler_common::amount::FRAC_BASE}; +use common::{ + currency::CurrencyBtc, + taler_common::types::{ + amount::{Amount, FRAC_BASE}, + payto::Payto, + }, + url::Url, +}; use std::str::FromStr; /// Generate a payto uri from a btc address diff --git a/common/src/config.rs b/common/src/config.rs @@ -20,7 +20,7 @@ use std::{ process::Command, str::FromStr, }; -use taler_common::payto::Payto; +use taler_common::types::payto::Payto; use url::Url; use crate::{ diff --git a/common/src/sql.rs b/common/src/sql.rs @@ -17,7 +17,10 @@ use std::str::FromStr; use postgres::Row; -use taler_common::{amount::Amount, api_common::SafeU64, payto::Payto}; +use taler_common::{ + api_common::SafeU64, + types::{amount::Amount, payto::Payto}, +}; use url::Url; use crate::log::OrFail; diff --git a/eth-wire/src/lib.rs b/eth-wire/src/lib.rs @@ -26,7 +26,7 @@ use common::{ log::{fail, OrFail}, metadata::{InMetadata, OutMetadata}, postgres, - taler_common::{amount::Amount, payto::Payto}, + taler_common::types::{amount::Amount, payto::Payto}, url::Url, }; use ethereum_types::{Address, H160, H256, U256, U64}; diff --git a/eth-wire/src/loops/worker.rs b/eth-wire/src/loops/worker.rs @@ -22,7 +22,7 @@ use common::{ reconnect::AutoReconnectDb, sql::{sql_array, sql_url}, status::{BounceStatus, DebitStatus}, - taler_common::api_common::{base32, Timestamp}, + taler_common::{api_common::base32, types::timestamp::Timestamp}, }; use eth_wire::{ rpc::{self, AutoRpcWallet, Rpc, RpcClient, Transaction, TransactionRequest}, diff --git a/eth-wire/src/taler_util.rs b/eth-wire/src/taler_util.rs @@ -17,7 +17,7 @@ use std::str::FromStr; use common::{ currency::CurrencyEth, - taler_common::{ + taler_common::types::{ amount::{Amount, FRAC_BASE}, payto::Payto, }, diff --git a/instrumentation/src/gateway.rs b/instrumentation/src/gateway.rs @@ -20,10 +20,10 @@ use btc_wire::taler_utils::btc_payto_url; use common::{ rand_slice, taler_common::{ - amount::Amount as TalerAmount, api_common::Base32, api_wire::TransferRequest, - payto::{payto, Payto}, + types::amount::Amount as TalerAmount, + types::payto::{payto, Payto}, }, }; use libdeflater::{CompressionLvl, Compressor}; diff --git a/instrumentation/src/utils.rs b/instrumentation/src/utils.rs @@ -31,10 +31,10 @@ use common::{ config::TalerConfig, rand_slice, taler_common::{ - amount::Amount, api_common::Base32, api_wire::{IncomingBankTransaction, IncomingHistory, OutgoingHistory, TransferRequest}, - payto::Payto, + types::amount::Amount, + types::payto::Payto, }, url::Url, }; diff --git a/wire-gateway/src/main.rs b/wire-gateway/src/main.rs @@ -47,7 +47,6 @@ use taler_api::{ wire_gateway_api, WireGatewayImpl, }; use taler_common::{ - api_common::Timestamp, api_params::{History, Page}, api_wire::{ AddIncomingRequest, AddIncomingResponse, AddKycauthRequest, AddKycauthResponse, @@ -55,7 +54,7 @@ use taler_common::{ TransferList, TransferRequest, TransferResponse, TransferState, TransferStatus, }, error_code::ErrorCode, - payto::Payto, + types::{payto::Payto, timestamp::Timestamp}, }; use tokio::time::sleep; @@ -114,7 +113,7 @@ impl WireGatewayImpl for ServerState { .bind_timestamp(&Timestamp::now()) .bind_amount(&req.amount) .bind(req.wtid.as_slice()) - .bind((&self.payto).raw()) + .bind(self.payto.raw()) .bind(req.credit_account.raw()) .bind(req.exchange_base_url.as_str()) .bind(req.request_uid.as_slice())