Browse Source

Add and run dprint fmt

bdk-0.11
Philipp Hoenisch 4 years ago
committed by Lucas Soriano del Pino
parent
commit
45c8d05ceb
No known key found for this signature in database GPG Key ID: EE611E973A1530E7
  1. 2
      Cargo.toml
  2. 2
      README.md
  3. 40
      cfd_protocol/src/lib.rs
  4. 1
      docs/roadmap.md
  5. 14
      dprint.json

2
Cargo.toml

@ -1,3 +1,3 @@
[workspace] [workspace]
members = [ "cfd_protocol" ] members = ["cfd_protocol"]
resolver = "2" resolver = "2"

2
README.md

@ -2,4 +2,4 @@
CFD trading on Bitcoin. CFD trading on Bitcoin.
Coming soon. Coming soon.

40
cfd_protocol/src/lib.rs

@ -1,26 +1,22 @@
use anyhow::bail; use anyhow::{bail, Context, Result};
use anyhow::Context;
use anyhow::Result;
use bdk::bitcoin::hashes::*; use bdk::bitcoin::hashes::*;
use bdk::bitcoin::Script; use bdk::bitcoin::Script;
use bdk::bitcoin::hashes::hex::ToHex;
use bdk::bitcoin::util::bip143::SigHashCache;
use bdk::bitcoin::util::psbt::{Global, PartiallySignedTransaction};
use bdk::bitcoin::{
self, Address, Amount, Network, OutPoint, PublicKey, SigHash, SigHashType, Transaction, TxIn,
TxOut,
};
use bdk::database::BatchDatabase; use bdk::database::BatchDatabase;
use bdk::descriptor::Descriptor;
use bdk::miniscript::descriptor::Wsh;
use bdk::miniscript::DescriptorTrait;
use bdk::wallet::AddressIndex; use bdk::wallet::AddressIndex;
use bdk::{
bitcoin::{
self, hashes::hex::ToHex, util::bip143::SigHashCache, util::psbt::Global,
util::psbt::PartiallySignedTransaction, Address, Amount, Network, OutPoint, PublicKey,
SigHash, SigHashType, Transaction, TxIn, TxOut,
},
descriptor::Descriptor,
miniscript::{descriptor::Wsh, DescriptorTrait},
};
use bitcoin::PrivateKey; use bitcoin::PrivateKey;
use itertools::Itertools; use itertools::Itertools;
use secp256k1_zkp::EcdsaAdaptorSignature; use secp256k1_zkp::{self, schnorrsig, EcdsaAdaptorSignature, SecretKey, Signature, SECP256K1};
use secp256k1_zkp::SecretKey;
use secp256k1_zkp::SECP256K1;
use secp256k1_zkp::{self, schnorrsig, Signature};
use std::collections::HashMap; use std::collections::HashMap;
/// In satoshi per vbyte. /// In satoshi per vbyte.
@ -826,11 +822,11 @@ impl LockTransaction {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use bdk::bitcoin::{util::bip32::ExtendedPrivKey, PrivateKey}; use bdk::bitcoin::util::bip32::ExtendedPrivKey;
use bdk::bitcoin::PrivateKey;
use bdk::wallet::AddressIndex; use bdk::wallet::AddressIndex;
use bdk::SignOptions; use bdk::SignOptions;
use rand::SeedableRng; use rand::{CryptoRng, RngCore, SeedableRng};
use rand::{CryptoRng, RngCore};
use rand_chacha::ChaChaRng; use rand_chacha::ChaChaRng;
#[test] #[test]
@ -1231,8 +1227,7 @@ mod tests {
where where
R: RngCore + CryptoRng, R: RngCore + CryptoRng,
{ {
use bdk::populate_test_db; use bdk::{populate_test_db, testutils};
use bdk::testutils;
let mut seed = [0u8; 32]; let mut seed = [0u8; 32];
rng.fill_bytes(&mut seed); rng.fill_bytes(&mut seed);
@ -1371,8 +1366,7 @@ mod tests {
use secp256k1_zkp::secp256k1_zkp_sys::types::c_void; use secp256k1_zkp::secp256k1_zkp_sys::types::c_void;
use secp256k1_zkp::secp256k1_zkp_sys::CPtr; use secp256k1_zkp::secp256k1_zkp_sys::CPtr;
use std::os::raw::c_int; use std::os::raw::{c_int, c_uchar};
use std::os::raw::c_uchar;
use std::ptr; use std::ptr;
/// Create a Schnorr signature using the provided nonce instead of generating one. /// Create a Schnorr signature using the provided nonce instead of generating one.

1
docs/roadmap.md

@ -52,4 +52,3 @@ Constraints:
- Anonymity - Anonymity
- Orderbook - Orderbook
- Multiple makers - Multiple makers

14
dprint.json

@ -0,0 +1,14 @@
{
"$schema": "https://dprint.dev/schemas/v0.json",
"incremental": true,
"rustfmt": {
"imports_granularity": "module"
},
"includes": ["**/*.{md,rs,toml}"],
"excludes": ["**/target"],
"plugins": [
"https://plugins.dprint.dev/markdown-0.9.2.wasm",
"https://plugins.dprint.dev/rustfmt-0.4.0.exe-plugin@c6bb223ef6e5e87580177f6461a0ab0554ac9ea6b54f78ea7ae8bf63b14f5bc2",
"https://plugins.dprint.dev/toml-0.4.0.wasm"
]
}
Loading…
Cancel
Save