Skip to content

Commit

Permalink
Merge pull request #36 from Manta-Network/incremental_recovery
Browse files Browse the repository at this point in the history
Incremental recovery changes
  • Loading branch information
stechu authored Dec 27, 2021
2 parents bd3626f + 9b60be4 commit 0879a43
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "manta-signer"
edition = "2018"
version = "0.4.1"
version = "0.5.0"
authors = ["Manta Network <[email protected]>"]
readme = "README.md"
license-file = "LICENSE"
Expand Down
3 changes: 2 additions & 1 deletion release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ The version numbers in the following files must be updated:
2. ui/src-tauri/Cargo.toml
3. ui/src-tauri/tauri.conf.json
4. ui/public/about.html
5. ui/package.json
EOF
prompt "Did you update the version numbers?"

Expand Down
30 changes: 22 additions & 8 deletions src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ where
.allow_credentials(false);
let mut server = Server::with_state(State::new(config, authorizer));
server.with(cors);
server.at("/heartbeat").get(Self::heartbeat);
server.at("/version").get(Self::version);
server.at("/recoverAccount").post(Self::recover_account);
server
.at("/deriveShieldedAddress")
Expand Down Expand Up @@ -366,12 +366,13 @@ where
self.0.state()
}

/// Sends a heartbeat to the client.
/// Sends version to the client.
#[inline]
async fn heartbeat(request: Request<A>) -> ServerResult<String> {
Self::log(String::from("HEARTBEAT")).await?;
async fn version(request: Request<A>) -> ServerResult {
Self::log(String::from("REQUEST: version")).await?;
let _ = request;
Ok(String::from("heartbeat"))
Self::log(format!("RESPONSE: {:?}", VERSION)).await?;
Ok(Body::from_json(&VersionMessage::default())?.into())
}

/// Runs an account recovery for the given `request`.
Expand Down Expand Up @@ -499,14 +500,28 @@ where
}
}

/// Version Message
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct VersionMessage {
/// Version
pub version: &'static str,
}

impl Default for VersionMessage {
/// Builds a default [`VersionMessage`].
fn default() -> Self {
Self { version: VERSION }
}
}

/// Shielded Address Message
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ShieldedAddressMessage {
/// Address
pub address: Vec<u8>,

/// Version
pub version: String,
pub version: &'static str,
}

impl ShieldedAddressMessage {
Expand All @@ -515,11 +530,10 @@ impl ShieldedAddressMessage {
pub fn new(address: Vec<u8>) -> Self {
Self {
address,
version: "0.0.0".into(),
version: VERSION,
}
}
}

/// Recover Account Message
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct RecoverAccountMessage {
Expand Down
4 changes: 2 additions & 2 deletions ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "manta-signer-ui",
"version": "0.4.0",
"version": "0.5.0",
"private": true,
"dependencies": {
"@tauri-apps/api": "^1.0.0-beta.8",
Expand Down Expand Up @@ -43,4 +43,4 @@
"devDependencies": {
"@tauri-apps/cli": "^1.0.0-beta.10"
}
}
}
16 changes: 12 additions & 4 deletions ui/public/about.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
Expand All @@ -15,29 +16,36 @@
color: black;
font-family: monospace;
}

main {
text-align: center;
margin-top: 3em;
}

p {
margin: 0.25em;
font-size: 0.85em;
}

button {
margin: 1em;
width: 6em;
}
</style>
</head>

<body>
<main>
<img src="Square89x89Logo.png" />
<h3>Manta Signer</h3>
<p>Version 0.4.1</p>
<p>Version 0.5.0</p>
<p>Copyright © 2019-2021 Manta Network</p>
<p><a href="https://github.com/manta-network/manta-signer">manta-network/manta-signer</a></p>
<br>
<p>
<a href="https://github.com/manta-network/manta-signer">manta-network/manta-signer</a>
</p>
<br />
<p style="font-size: 0.75em; color: red">DOLPHIN TESTNET</p>
</main>
</body>
</html>

</html>
6 changes: 3 additions & 3 deletions ui/src-tauri/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 ui/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "manta-signer-ui"
edition = "2018"
version = "0.4.1"
version = "0.5.0"
authors = ["Manta Network <[email protected]>"]
readme = "README.md"
license-file = "LICENSE"
Expand Down
4 changes: 2 additions & 2 deletions ui/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"package": {
"productName": "Manta Signer",
"version": "0.4.1"
"version": "0.5.0"
},
"build": {
"distDir": "../build",
Expand Down Expand Up @@ -87,4 +87,4 @@
"iconAsTemplate": true
}
}
}
}

0 comments on commit 0879a43

Please sign in to comment.