Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@
"service": "app",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
// Use 'mounts' to make the cargo cache persistent in a Docker Volume.
// "mounts": [
// {
// "source": "devcontainer-cargo-cache-${devcontainerId}",
// "target": "/usr/local/cargo",
// "type": "volume"
// }
// ]
"mounts": [
"source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached"
],
// Use 'postCreateCommand' to run commands after the container is created.
"postStartCommand": "rustup --version && rustup component add rustfmt && rustup component add clippy",
// Configure tool-specific properties.
Expand Down
1 change: 0 additions & 1 deletion src/asynch/clients/json_rpc/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

use alloc::{string::ToString, vec};
use serde::Serialize;
use serde_json::{Map, Value};
Expand Down
4 changes: 2 additions & 2 deletions src/core/binarycodec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::XRPLSerdeJsonError;
use super::exceptions::XRPLCoreResult;

const TRANSACTION_SIGNATURE_PREFIX: i32 = 0x53545800;
const TRANSACTION_MULTISIG_PREFIX: i32 = 0x534D5400;
const TRANSACTION_MULTISIG_PREFIX: [u8; 4] = (0x534D5400u32).to_be_bytes();

pub fn encode<T>(signed_transaction: &T) -> XRPLCoreResult<String>
where
Expand Down Expand Up @@ -55,7 +55,7 @@ where

serialize_json(
prepared_transaction,
Some(TRANSACTION_MULTISIG_PREFIX.to_be_bytes().as_ref()),
Some(TRANSACTION_MULTISIG_PREFIX.as_ref()),
Some(signing_account_id.as_ref()),
true,
)
Expand Down
8 changes: 7 additions & 1 deletion src/models/requests/submit_multisigned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub struct SubmitMultisigned<'a> {
/// The common fields shared by all requests.
#[serde(flatten)]
pub common_fields: CommonFields<'a>,
pub tx_json: serde_json::Value,
/// If true, and the transaction fails locally, do not
/// retry or relay the transaction to other servers.
pub fail_hard: Option<bool>,
Expand All @@ -41,13 +42,18 @@ impl<'a> Request<'a> for SubmitMultisigned<'a> {
}

impl<'a> SubmitMultisigned<'a> {
pub fn new(id: Option<Cow<'a, str>>, fail_hard: Option<bool>) -> Self {
pub fn new(
id: Option<Cow<'a, str>>,
tx_json: serde_json::Value,
fail_hard: Option<bool>,
) -> Self {
Self {
common_fields: CommonFields {
command: RequestMethod::SubmitMultisigned,
id,
},
fail_hard,
tx_json,
}
}
}
18 changes: 9 additions & 9 deletions src/models/transactions/account_delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,29 +68,29 @@ impl<'a> AccountDelete<'a> {
last_ledger_sequence: Option<u32>,
memos: Option<Vec<Memo>>,
sequence: Option<u32>,
signers: Option<Vec<Signer<'a>>>,
signers: Option<Vec<Signer>>,
source_tag: Option<u32>,
ticket_sequence: Option<u32>,
destination: Cow<'a, str>,
destination_tag: Option<u32>,
) -> Self {
Self {
common_fields: CommonFields {
common_fields: CommonFields::new(
account,
transaction_type: TransactionType::AccountDelete,
TransactionType::AccountDelete,
account_txn_id,
fee,
flags: FlagCollection::default(),
Some(FlagCollection::default()),
last_ledger_sequence,
memos,
None,
sequence,
signers,
None,
source_tag,
ticket_sequence,
network_id: None,
signing_pub_key: None,
txn_signature: None,
},
None,
),
destination,
destination_tag,
}
Expand All @@ -116,7 +116,7 @@ mod test_serde {
"rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe".into(),
Some(13),
);
let default_json_str = r#"{"Account":"rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm","TransactionType":"AccountDelete","Fee":"2000000","Flags":0,"Sequence":2470665,"Destination":"rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe","DestinationTag":13}"#;
let default_json_str = r#"{"Account":"rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm","TransactionType":"AccountDelete","Fee":"2000000","Flags":0,"Sequence":2470665,"SigningPubKey":"","Destination":"rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe","DestinationTag":13}"#;
// Serialize
let default_json_value = serde_json::to_value(default_json_str).unwrap();
let serialized_string = serde_json::to_string(&default_txn).unwrap();
Expand Down
18 changes: 9 additions & 9 deletions src/models/transactions/account_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ impl<'a> AccountSet<'a> {
last_ledger_sequence: Option<u32>,
memos: Option<Vec<Memo>>,
sequence: Option<u32>,
signers: Option<Vec<Signer<'a>>>,
signers: Option<Vec<Signer>>,
source_tag: Option<u32>,
ticket_sequence: Option<u32>,
clear_flag: Option<AccountSetFlag>,
Expand All @@ -294,22 +294,22 @@ impl<'a> AccountSet<'a> {
nftoken_minter: Option<Cow<'a, str>>,
) -> Self {
Self {
common_fields: CommonFields {
common_fields: CommonFields::new(
account,
transaction_type: TransactionType::AccountSet,
TransactionType::AccountSet,
account_txn_id,
fee,
flags: flags.unwrap_or_default(),
Some(flags.unwrap_or_default()),
last_ledger_sequence,
memos,
None,
sequence,
signers,
None,
source_tag,
ticket_sequence,
network_id: None,
signing_pub_key: None,
txn_signature: None,
},
None,
),
clear_flag,
domain,
email_hash,
Expand Down Expand Up @@ -558,7 +558,7 @@ mod tests {
None,
None,
);
let default_json_str = r#"{"Account":"rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn","TransactionType":"AccountSet","Fee":"12","Flags":0,"Sequence":5,"Domain":"6578616D706C652E636F6D","MessageKey":"03AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB","SetFlag":5}"#;
let default_json_str = r#"{"Account":"rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn","TransactionType":"AccountSet","Fee":"12","Flags":0,"Sequence":5,"SigningPubKey":"","Domain":"6578616D706C652E636F6D","MessageKey":"03AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB","SetFlag":5}"#;
// Serialize
let default_json_value = serde_json::to_value(default_json_str).unwrap();
let serialized_string = serde_json::to_string(&default_txn).unwrap();
Expand Down
16 changes: 8 additions & 8 deletions src/models/transactions/amm_bid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl<'a> AMMBid<'_> {
last_ledger_sequence: Option<u32>,
memos: Option<Vec<Memo>>,
sequence: Option<u32>,
signers: Option<Vec<Signer<'a>>>,
signers: Option<Vec<Signer>>,
source_tag: Option<u32>,
ticket_sequence: Option<u32>,
asset: Currency<'a>,
Expand All @@ -75,22 +75,22 @@ impl<'a> AMMBid<'_> {
auth_accounts: Option<Vec<AuthAccount>>,
) -> AMMBid<'a> {
AMMBid {
common_fields: CommonFields {
common_fields: CommonFields::new(
account,
transaction_type: TransactionType::AMMBid,
TransactionType::AMMBid,
account_txn_id,
fee,
flags: FlagCollection::default(),
Some(FlagCollection::default()),
last_ledger_sequence,
memos,
None,
sequence,
signers,
None,
source_tag,
ticket_sequence,
network_id: None,
signing_pub_key: None,
txn_signature: None,
},
None,
),
asset,
asset2,
bid_min,
Expand Down
16 changes: 8 additions & 8 deletions src/models/transactions/amm_create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,30 +75,30 @@ impl<'a> AMMCreate<'a> {
last_ledger_sequence: Option<u32>,
memos: Option<Vec<Memo>>,
sequence: Option<u32>,
signers: Option<Vec<Signer<'a>>>,
signers: Option<Vec<Signer>>,
source_tag: Option<u32>,
ticket_sequence: Option<u32>,
amount: Amount<'a>,
amount2: Amount<'a>,
trading_fee: u16,
) -> AMMCreate<'a> {
AMMCreate {
common_fields: CommonFields {
common_fields: CommonFields::new(
account,
transaction_type: TransactionType::AMMCreate,
TransactionType::AMMCreate,
account_txn_id,
fee,
flags: FlagCollection::default(),
Some(FlagCollection::default()),
last_ledger_sequence,
memos,
None,
sequence,
signers,
None,
source_tag,
ticket_sequence,
network_id: None,
signing_pub_key: None,
txn_signature: None,
},
None,
),
amount,
amount2,
trading_fee,
Expand Down
16 changes: 8 additions & 8 deletions src/models/transactions/amm_delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,29 +54,29 @@ impl<'a> AMMDelete<'a> {
last_ledger_sequence: Option<u32>,
memos: Option<Vec<Memo>>,
sequence: Option<u32>,
signers: Option<Vec<Signer<'a>>>,
signers: Option<Vec<Signer>>,
source_tag: Option<u32>,
ticket_sequence: Option<u32>,
asset: Currency<'a>,
asset2: Currency<'a>,
) -> AMMDelete<'a> {
AMMDelete {
common_fields: CommonFields {
common_fields: CommonFields::new(
account,
transaction_type: TransactionType::AMMDelete,
TransactionType::AMMDelete,
account_txn_id,
fee,
flags: FlagCollection::default(),
Some(FlagCollection::default()),
last_ledger_sequence,
memos,
None,
sequence,
signers,
None,
source_tag,
ticket_sequence,
network_id: None,
signing_pub_key: None,
txn_signature: None,
},
None,
),
asset,
asset2,
}
Expand Down
16 changes: 8 additions & 8 deletions src/models/transactions/amm_deposit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl<'a> AMMDeposit<'a> {
last_ledger_sequence: Option<u32>,
memos: Option<Vec<Memo>>,
sequence: Option<u32>,
signers: Option<Vec<Signer<'a>>>,
signers: Option<Vec<Signer>>,
source_tag: Option<u32>,
ticket_sequence: Option<u32>,
asset: Currency<'a>,
Expand All @@ -115,22 +115,22 @@ impl<'a> AMMDeposit<'a> {
lp_token_out: Option<IssuedCurrencyAmount<'a>>,
) -> AMMDeposit<'a> {
AMMDeposit {
common_fields: CommonFields {
common_fields: CommonFields::new(
account,
transaction_type: TransactionType::AMMDeposit,
TransactionType::AMMDeposit,
account_txn_id,
fee,
flags: flags.unwrap_or_default(),
Some(flags.unwrap_or_default()),
last_ledger_sequence,
memos,
None,
sequence,
signers,
None,
source_tag,
ticket_sequence,
network_id: None,
signing_pub_key: None,
txn_signature: None,
},
None,
),
asset,
asset2,
amount,
Expand Down
16 changes: 8 additions & 8 deletions src/models/transactions/amm_vote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,30 +70,30 @@ impl<'a> AMMVote<'a> {
last_ledger_sequence: Option<u32>,
memos: Option<Vec<Memo>>,
sequence: Option<u32>,
signers: Option<Vec<Signer<'a>>>,
signers: Option<Vec<Signer>>,
source_tag: Option<u32>,
ticket_sequence: Option<u32>,
asset: Currency<'a>,
asset2: Currency<'a>,
trading_fee: Option<u16>,
) -> AMMVote<'a> {
AMMVote {
common_fields: CommonFields {
common_fields: CommonFields::new(
account,
TransactionType::AMMVote,
account_txn_id,
fee,
flags: FlagCollection::default(),
Some(FlagCollection::default()),
last_ledger_sequence,
memos,
None,
sequence,
signers,
None,
source_tag,
ticket_sequence,
transaction_type: TransactionType::AMMVote,
network_id: None,
signing_pub_key: None,
txn_signature: None,
},
None,
),
asset,
asset2,
trading_fee,
Expand Down
16 changes: 8 additions & 8 deletions src/models/transactions/amm_withdraw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl<'a> AMMWithdraw<'a> {
last_ledger_sequence: Option<u32>,
memos: Option<Vec<Memo>>,
sequence: Option<u32>,
signers: Option<Vec<Signer<'a>>>,
signers: Option<Vec<Signer>>,
source_tag: Option<u32>,
ticket_sequence: Option<u32>,
asset: Currency<'a>,
Expand All @@ -103,22 +103,22 @@ impl<'a> AMMWithdraw<'a> {
lp_token_in: Option<IssuedCurrencyAmount<'a>>,
) -> Self {
AMMWithdraw {
common_fields: CommonFields {
common_fields: CommonFields::new(
account,
TransactionType::AMMWithdraw,
account_txn_id,
fee,
flags: flags.unwrap_or_default(),
Some(flags.unwrap_or_default()),
last_ledger_sequence,
memos,
None,
sequence,
signers,
None,
source_tag,
ticket_sequence,
network_id: None,
signing_pub_key: None,
txn_signature: None,
transaction_type: TransactionType::AMMWithdraw,
},
None,
),
asset,
asset2,
amount,
Expand Down
Loading
Loading