mirror of
https://github.com/mimblewimble/grin-wallet.git
synced 2025-01-21 03:21:08 +03:00
final updates for tag and build based on grin 1.1.0 merge
This commit is contained in:
parent
0e9ccef3e5
commit
9b49bde4f9
7 changed files with 228 additions and 198 deletions
366
Cargo.lock
generated
366
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -31,6 +31,7 @@ uuid = { version = "0.7", features = ["serde", "v4"] }
|
||||||
url = "1.7.0"
|
url = "1.7.0"
|
||||||
chrono = { version = "0.4.4", features = ["serde"] }
|
chrono = { version = "0.4.4", features = ["serde"] }
|
||||||
easy-jsonrpc = "0.4.1"
|
easy-jsonrpc = "0.4.1"
|
||||||
|
lazy_static = "1"
|
||||||
|
|
||||||
grin_wallet_util = { path = "../util", version = "1.1.0" }
|
grin_wallet_util = { path = "../util", version = "1.1.0" }
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ use crate::util::Mutex;
|
||||||
use failure::ResultExt;
|
use failure::ResultExt;
|
||||||
use futures::future::{err, ok};
|
use futures::future::{err, ok};
|
||||||
use futures::{Future, Stream};
|
use futures::{Future, Stream};
|
||||||
|
use hyper::header::HeaderValue;
|
||||||
use hyper::{Body, Request, Response, StatusCode};
|
use hyper::{Body, Request, Response, StatusCode};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json;
|
use serde_json;
|
||||||
|
@ -45,6 +46,11 @@ use crate::apiwallet::{Foreign, ForeignRpc, Owner, OwnerRpc};
|
||||||
use easy_jsonrpc;
|
use easy_jsonrpc;
|
||||||
use easy_jsonrpc::Handler;
|
use easy_jsonrpc::Handler;
|
||||||
|
|
||||||
|
lazy_static! {
|
||||||
|
pub static ref GRIN_OWNER_BASIC_REALM: HeaderValue =
|
||||||
|
HeaderValue::from_str("Basic realm=GrinOwnerAPI").unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
/// Instantiate wallet Owner API for a single-use (command line) call
|
/// Instantiate wallet Owner API for a single-use (command line) call
|
||||||
/// Return a function containing a loaded API context to call
|
/// Return a function containing a loaded API context to call
|
||||||
pub fn owner_single_use<F, T: ?Sized, C, K>(wallet: Arc<Mutex<T>>, f: F) -> Result<(), Error>
|
pub fn owner_single_use<F, T: ?Sized, C, K>(wallet: Arc<Mutex<T>>, f: F) -> Result<(), Error>
|
||||||
|
@ -93,8 +99,10 @@ where
|
||||||
if api_secret.is_some() {
|
if api_secret.is_some() {
|
||||||
let api_basic_auth =
|
let api_basic_auth =
|
||||||
"Basic ".to_string() + &to_base64(&("grin:".to_string() + &api_secret.unwrap()));
|
"Basic ".to_string() + &to_base64(&("grin:".to_string() + &api_secret.unwrap()));
|
||||||
let basic_realm = "Basic realm=GrinOwnerAPI".to_string();
|
let basic_auth_middleware = Arc::new(BasicAuthMiddleware::new(
|
||||||
let basic_auth_middleware = Arc::new(BasicAuthMiddleware::new(api_basic_auth, basic_realm));
|
api_basic_auth,
|
||||||
|
&GRIN_OWNER_BASIC_REALM,
|
||||||
|
));
|
||||||
router.add_middleware(basic_auth_middleware);
|
router.add_middleware(basic_auth_middleware);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@ extern crate prettytable;
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
|
#[macro_use]
|
||||||
|
extern crate lazy_static;
|
||||||
use failure;
|
use failure;
|
||||||
use grin_wallet_api as apiwallet;
|
use grin_wallet_api as apiwallet;
|
||||||
use grin_wallet_config as config;
|
use grin_wallet_config as config;
|
||||||
|
|
|
@ -236,7 +236,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
fn iter<'a>(&'a self) -> Box<dyn Iterator<Item = OutputData> + 'a> {
|
fn iter<'a>(&'a self) -> Box<dyn Iterator<Item = OutputData> + 'a> {
|
||||||
Box::new(self.db.iter(&[OUTPUT_PREFIX]).unwrap())
|
Box::new(self.db.iter(&[OUTPUT_PREFIX]).unwrap().map(|o| o.1))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_tx_log_entry(&self, u: &Uuid) -> Result<Option<TxLogEntry>, Error> {
|
fn get_tx_log_entry(&self, u: &Uuid) -> Result<Option<TxLogEntry>, Error> {
|
||||||
|
@ -245,7 +245,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
fn tx_log_iter<'a>(&'a self) -> Box<dyn Iterator<Item = TxLogEntry> + 'a> {
|
fn tx_log_iter<'a>(&'a self) -> Box<dyn Iterator<Item = TxLogEntry> + 'a> {
|
||||||
Box::new(self.db.iter(&[TX_LOG_ENTRY_PREFIX]).unwrap())
|
Box::new(self.db.iter(&[TX_LOG_ENTRY_PREFIX]).unwrap().map(|o| o.1))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_private_context(&mut self, slate_id: &[u8]) -> Result<Context, Error> {
|
fn get_private_context(&mut self, slate_id: &[u8]) -> Result<Context, Error> {
|
||||||
|
@ -266,7 +266,12 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
fn acct_path_iter<'a>(&'a self) -> Box<dyn Iterator<Item = AcctPathMapping> + 'a> {
|
fn acct_path_iter<'a>(&'a self) -> Box<dyn Iterator<Item = AcctPathMapping> + 'a> {
|
||||||
Box::new(self.db.iter(&[ACCOUNT_PATH_MAPPING_PREFIX]).unwrap())
|
Box::new(
|
||||||
|
self.db
|
||||||
|
.iter(&[ACCOUNT_PATH_MAPPING_PREFIX])
|
||||||
|
.unwrap()
|
||||||
|
.map(|o| o.1),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_acct_path(&self, label: String) -> Result<Option<AcctPathMapping>, Error> {
|
fn get_acct_path(&self, label: String) -> Result<Option<AcctPathMapping>, Error> {
|
||||||
|
@ -412,7 +417,8 @@ where
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.iter(&[OUTPUT_PREFIX])
|
.iter(&[OUTPUT_PREFIX])
|
||||||
.unwrap(),
|
.unwrap()
|
||||||
|
.map(|o| o.1),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,7 +456,8 @@ where
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.iter(&[TX_LOG_ENTRY_PREFIX])
|
.iter(&[TX_LOG_ENTRY_PREFIX])
|
||||||
.unwrap(),
|
.unwrap()
|
||||||
|
.map(|o| o.1),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,7 +526,8 @@ where
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.iter(&[ACCOUNT_PATH_MAPPING_PREFIX])
|
.iter(&[ACCOUNT_PATH_MAPPING_PREFIX])
|
||||||
.unwrap(),
|
.unwrap()
|
||||||
|
.map(|o| o.1),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ fn get_outputs_by_pmmr_index_local(
|
||||||
outputs: outputs
|
outputs: outputs
|
||||||
.2
|
.2
|
||||||
.iter()
|
.iter()
|
||||||
.map(|x| api::OutputPrintable::from_output(x, chain.clone(), None, true))
|
.map(|x| api::OutputPrintable::from_output(x, chain.clone(), None, true).unwrap())
|
||||||
.collect(),
|
.collect(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ fn get_outputs_by_pmmr_index_local(
|
||||||
/// Adds a block with a given reward to the chain and mines it
|
/// Adds a block with a given reward to the chain and mines it
|
||||||
pub fn add_block_with_reward(chain: &Chain, txs: Vec<&Transaction>, reward: CbData) {
|
pub fn add_block_with_reward(chain: &Chain, txs: Vec<&Transaction>, reward: CbData) {
|
||||||
let prev = chain.head_header().unwrap();
|
let prev = chain.head_header().unwrap();
|
||||||
let next_header_info = consensus::next_difficulty(1, chain.difficulty_iter());
|
let next_header_info = consensus::next_difficulty(1, chain.difficulty_iter().unwrap());
|
||||||
let mut b = core::core::Block::new(
|
let mut b = core::core::Block::new(
|
||||||
&prev,
|
&prev,
|
||||||
txs.into_iter().cloned().collect(),
|
txs.into_iter().cloned().collect(),
|
||||||
|
|
|
@ -16,12 +16,21 @@ serde_derive = "1"
|
||||||
toml = "0.4"
|
toml = "0.4"
|
||||||
dirs = "1.0.3"
|
dirs = "1.0.3"
|
||||||
|
|
||||||
grin_core = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" }
|
# For Release
|
||||||
grin_keychain = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" }
|
grin_core = "1.1.0-beta.1"
|
||||||
grin_chain = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" }
|
grin_keychain = "1.1.0-beta.1"
|
||||||
grin_util = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" }
|
grin_chain = "1.1.0-beta.1"
|
||||||
grin_api = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" }
|
grin_util = "1.1.0-beta.1"
|
||||||
grin_store = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" }
|
grin_api = "1.1.0-beta.1"
|
||||||
|
grin_store = "1.1.0-beta.1"
|
||||||
|
|
||||||
|
# For bleeding edge
|
||||||
|
#grin_core = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" }
|
||||||
|
#grin_keychain = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" }
|
||||||
|
#grin_chain = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" }
|
||||||
|
#grin_util = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" }
|
||||||
|
#grin_api = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" }
|
||||||
|
#grin_store = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" }
|
||||||
|
|
||||||
# For local testing
|
# For local testing
|
||||||
#grin_core = { path = "../../grin/core", version= "1.1.0"}
|
#grin_core = { path = "../../grin/core", version= "1.1.0"}
|
||||||
|
|
Loading…
Reference in a new issue