Skip to content

Commit 7b7b4ec

Browse files
committed
remove SendAsset payload_multi_sig_user & outer_signer
1 parent 638353b commit 7b7b4ec

File tree

3 files changed

+4
-59
lines changed

3 files changed

+4
-59
lines changed

src/bin/multi_sig_signature_collection.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ fn demonstrate_signature_collection() -> Result<()> {
5454
info!("Signer 2 address: {}", signer2_wallet.address());
5555

5656
// Both signers create the same SendAsset action
57-
let send_asset = create_send_asset(multi_sig_user, outer_signer, destination, amount, nonce);
57+
let send_asset = create_send_asset(destination, amount, nonce);
5858

5959
// Signer 1 signs
6060
let sig1 = sign_multi_sig_user_signed_action_single(&signer1_wallet, &send_asset)?;
@@ -115,13 +115,7 @@ fn demonstrate_signature_collection() -> Result<()> {
115115
}
116116

117117
/// Create a SendAsset action - must be identical for all signers
118-
fn create_send_asset(
119-
multi_sig_user: alloy::primitives::Address,
120-
outer_signer: alloy::primitives::Address,
121-
destination: &str,
122-
amount: &str,
123-
nonce: u64,
124-
) -> SendAsset {
118+
fn create_send_asset(destination: &str, amount: &str, nonce: u64) -> SendAsset {
125119
SendAsset {
126120
signature_chain_id: 421614,
127121
hyperliquid_chain: "Testnet".to_string(),
@@ -132,8 +126,6 @@ fn create_send_asset(
132126
amount: amount.to_string(),
133127
from_sub_account: "".to_string(),
134128
nonce,
135-
payload_multi_sig_user: Some(format!("{:#x}", multi_sig_user).to_lowercase()),
136-
outer_signer: Some(format!("{:#x}", outer_signer).to_lowercase()),
137129
}
138130
}
139131

src/exchange/actions.rs

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,6 @@ pub struct SendAsset {
210210
pub amount: String,
211211
pub from_sub_account: String,
212212
pub nonce: u64,
213-
#[serde(skip_serializing_if = "Option::is_none")]
214-
pub payload_multi_sig_user: Option<String>,
215-
#[serde(skip_serializing_if = "Option::is_none")]
216-
pub outer_signer: Option<String>,
217213
}
218214

219215
impl Eip712 for SendAsset {
@@ -222,31 +218,7 @@ impl Eip712 for SendAsset {
222218
}
223219

224220
fn struct_hash(&self) -> B256 {
225-
if self.payload_multi_sig_user.is_some() && self.outer_signer.is_some() {
226-
let multi_sig_user: Address = self
227-
.payload_multi_sig_user
228-
.as_ref()
229-
.unwrap()
230-
.parse()
231-
.unwrap();
232-
let outer_signer: Address = self.outer_signer.as_ref().unwrap().parse().unwrap();
233-
234-
let items = (
235-
keccak256("HyperliquidTransaction:SendAsset(string hyperliquidChain,address payloadMultiSigUser,address outerSigner,string destination,string sourceDex,string destinationDex,string token,string amount,string fromSubAccount,uint64 nonce)"),
236-
keccak256(&self.hyperliquid_chain),
237-
multi_sig_user,
238-
outer_signer,
239-
keccak256(&self.destination),
240-
keccak256(&self.source_dex),
241-
keccak256(&self.destination_dex),
242-
keccak256(&self.token),
243-
keccak256(&self.amount),
244-
keccak256(&self.from_sub_account),
245-
&self.nonce,
246-
);
247-
keccak256(items.abi_encode())
248-
} else {
249-
let items = (
221+
let items = (
250222
keccak256("HyperliquidTransaction:SendAsset(string hyperliquidChain,string destination,string sourceDex,string destinationDex,string token,string amount,string fromSubAccount,uint64 nonce)"),
251223
keccak256(&self.hyperliquid_chain),
252224
keccak256(&self.destination),
@@ -257,8 +229,7 @@ impl Eip712 for SendAsset {
257229
keccak256(&self.from_sub_account),
258230
&self.nonce,
259231
);
260-
keccak256(items.abi_encode())
261-
}
232+
keccak256(items.abi_encode())
262233
}
263234
}
264235

src/exchange/exchange_client.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,6 @@ impl ExchangeClient {
368368
amount: amount.to_string(),
369369
from_sub_account,
370370
nonce: timestamp,
371-
payload_multi_sig_user: None,
372-
outer_signer: None,
373371
};
374372

375373
let signature = sign_typed_data(&send_asset, wallet)?;
@@ -1206,8 +1204,6 @@ impl ExchangeClient {
12061204
amount: amount.to_string(),
12071205
from_sub_account: "".to_string(),
12081206
nonce: timestamp,
1209-
payload_multi_sig_user: Some(format!("{:#x}", multi_sig_user).to_lowercase()),
1210-
outer_signer: Some(format!("{:#x}", self.wallet.address()).to_lowercase()),
12111207
};
12121208

12131209
let signatures = sign_typed_data_multi_sig(&send_asset, wallets)?;
@@ -1249,8 +1245,6 @@ impl ExchangeClient {
12491245
amount: amount.to_string(),
12501246
from_sub_account: "".to_string(),
12511247
nonce: timestamp,
1252-
payload_multi_sig_user: Some(format!("{:#x}", multi_sig_user).to_lowercase()),
1253-
outer_signer: Some(format!("{:#x}", self.wallet.address()).to_lowercase()),
12541248
};
12551249

12561250
let signatures = sign_typed_data_multi_sig(&send_asset, wallets)?;
@@ -1299,8 +1293,6 @@ impl ExchangeClient {
12991293
/// amount: "100".to_string(),
13001294
/// from_sub_account: "".to_string(),
13011295
/// nonce: 123456789,
1302-
/// payload_multi_sig_user: Some(format!("{:#x}", multi_sig_user).to_lowercase()),
1303-
/// outer_signer: Some("0x...".to_lowercase()),
13041296
/// };
13051297
///
13061298
/// let sig1 = sign_multi_sig_user_signed_action_single(&wallet1, &send_asset)?;
@@ -1340,8 +1332,6 @@ impl ExchangeClient {
13401332
amount: amount.to_string(),
13411333
from_sub_account: "".to_string(),
13421334
nonce: timestamp,
1343-
payload_multi_sig_user: Some(format!("{:#x}", multi_sig_user).to_lowercase()),
1344-
outer_signer: Some(format!("{:#x}", self.wallet.address()).to_lowercase()),
13451335
};
13461336

13471337
let mut action =
@@ -1391,8 +1381,6 @@ impl ExchangeClient {
13911381
amount: amount.to_string(),
13921382
from_sub_account: "".to_string(),
13931383
nonce: timestamp,
1394-
payload_multi_sig_user: Some(format!("{:#x}", multi_sig_user).to_lowercase()),
1395-
outer_signer: Some(format!("{:#x}", self.wallet.address()).to_lowercase()),
13961384
};
13971385

13981386
let mut action =
@@ -1659,8 +1647,6 @@ mod tests {
16591647
amount: "100".to_string(),
16601648
from_sub_account: "".to_string(),
16611649
nonce: 1583838,
1662-
payload_multi_sig_user: None,
1663-
outer_signer: None,
16641650
};
16651651

16661652
let mainnet_signature = sign_typed_data(&mainnet_send, &wallet)?;
@@ -1675,8 +1661,6 @@ mod tests {
16751661
amount: "50".to_string(),
16761662
from_sub_account: "".to_string(),
16771663
nonce: 1583838,
1678-
payload_multi_sig_user: None,
1679-
outer_signer: None,
16801664
};
16811665

16821666
let testnet_signature = sign_typed_data(&testnet_send, &wallet)?;
@@ -1692,8 +1676,6 @@ mod tests {
16921676
amount: "100".to_string(),
16931677
from_sub_account: "0xabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd".to_string(),
16941678
nonce: 1583838,
1695-
payload_multi_sig_user: None,
1696-
outer_signer: None,
16971679
};
16981680

16991681
let vault_signature = sign_typed_data(&vault_send, &wallet)?;

0 commit comments

Comments
 (0)