Skip to content

Commit 198f07e

Browse files
committed
create public Agent::new
1 parent 8e4343f commit 198f07e

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

src/exchange/exchange_client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ struct MultiSigPayload {
7777

7878
#[derive(Clone, Serialize)]
7979
#[serde(rename_all = "camelCase")]
80-
pub(crate) struct MultiSigAction {
80+
pub struct MultiSigAction {
8181
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
8282
pub r#type: Option<String>,
8383
pub signature_chain_id: String,
@@ -156,7 +156,7 @@ impl From<MultiSigAction> for PostAction {
156156
}
157157

158158
impl Actions {
159-
fn hash(
159+
pub fn hash(
160160
&self,
161161
timestamp: u64,
162162
vault_address: Option<Address>,

src/signature/agent.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ pub(crate) mod l1 {
1616
}
1717
}
1818

19+
impl Agent {
20+
pub fn new(is_mainnet: bool, connection_id: B256) -> Agent {
21+
let source = if is_mainnet { "a" } else { "b" }.to_string();
22+
Agent {
23+
source,
24+
connectionId: connection_id,
25+
}
26+
}
27+
}
28+
1929
impl Eip712 for Agent {
2030
fn domain(&self) -> Eip712Domain {
2131
eip712_domain! {

src/signature/create_signature.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@ pub(crate) fn sign_l1_action(
1010
connection_id: B256,
1111
is_mainnet: bool,
1212
) -> Result<Signature> {
13-
let source = if is_mainnet { "a" } else { "b" }.to_string();
14-
let payload = l1::Agent {
15-
source,
16-
connectionId: connection_id,
17-
};
13+
let payload = l1::Agent::new(is_mainnet, connection_id);
1814
sign_typed_data(&payload, wallet)
1915
}
2016

0 commit comments

Comments
 (0)