forked from rooch-network/rooch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[rooch-networkgh-2381] modify sign command for signing.
- Loading branch information
Feliciss
committed
Sep 8, 2024
1 parent
a0f1f33
commit 4959be4
Showing
4 changed files
with
80 additions
and
87 deletions.
There are no files selected for viewing
38 changes: 5 additions & 33 deletions
38
crates/rooch-rpc-api/src/jsonrpc_types/account_sign_view.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,18 @@ | ||
// Copyright (c) RoochNetwork | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use rooch_types::{crypto::Signature, framework::auth_payload::AuthPayload}; | ||
use schemars::JsonSchema; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use super::BytesView; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] | ||
pub struct AccountSignView { | ||
pub msg: String, | ||
pub payload: AuthPayloadView, | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] | ||
pub struct AuthPayloadView { | ||
pub signature: BytesView, | ||
pub message_prefix: BytesView, | ||
pub message_info: BytesView, | ||
pub public_key: BytesView, | ||
pub from_address: String, | ||
pub signature: Signature, | ||
pub payload: AuthPayload, | ||
} | ||
|
||
impl AccountSignView { | ||
pub fn new(msg: String, payload: AuthPayloadView) -> Self { | ||
Self { msg, payload } | ||
} | ||
} | ||
|
||
impl AuthPayloadView { | ||
pub fn new( | ||
signature: BytesView, | ||
message_prefix: BytesView, | ||
message_info: BytesView, | ||
public_key: BytesView, | ||
from_address: String, | ||
) -> Self { | ||
Self { | ||
signature, | ||
message_prefix, | ||
message_info, | ||
public_key, | ||
from_address, | ||
} | ||
pub fn new(signature: Signature, payload: AuthPayload) -> Self { | ||
Self { signature, payload } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters