Skip to content

Commit e181c2e

Browse files
WGB5445gregnazario
authored andcommitted
feat: add support for multi-agent transactions with fee payer in submit_transaction test
1 parent e743b63 commit e181c2e

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

crates/examples/src/lib.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ mod tests {
99
use aptos_rust_sdk_types::api_types::chain_id::ChainId;
1010
use aptos_rust_sdk_types::api_types::module_id::ModuleId;
1111
use aptos_rust_sdk_types::api_types::transaction::{
12-
EntryFunction, RawTransaction, SignedTransaction, TransactionPayload,
12+
EntryFunction, RawTransaction, RawTransactionWithData, SignedTransaction,
13+
TransactionPayload,
1314
};
1415
use aptos_rust_sdk_types::api_types::transaction_authenticator::{
1516
AccountAuthenticator, AuthenticationKey, TransactionAuthenticator,
1617
};
1718
use ed25519_dalek::Digest;
1819
use std::str::FromStr;
20+
use std::vec;
1921

2022
#[tokio::test]
2123
async fn submit_transaction() {
@@ -151,18 +153,20 @@ mod tests {
151153
chain_id,
152154
);
153155

156+
let raw_txn_with_data = RawTransactionWithData::new_multi_agent_with_fee_payer(
157+
raw_txn.clone(),
158+
vec![],
159+
fee_payer_address,
160+
);
161+
154162
let mut sha3 = Sha3_256::new();
155163
sha3.update("APTOS::RawTransactionWithData".as_bytes());
156164
let hash = sha3.finalize().to_vec();
157165
let mut bytes = vec![];
158-
bcs::serialize_into(&mut bytes, &raw_txn).unwrap();
166+
bcs::serialize_into(&mut bytes, &raw_txn_with_data).unwrap();
159167
let mut message = vec![];
160168
message.extend(hash);
161-
// FeePayerRawTransaction 1
162-
message.extend(bcs::to_bytes(&1u8).unwrap());
163169
message.extend(bytes);
164-
message.extend(bcs::to_bytes::<Vec<AccountAddress>>(&vec![]).unwrap());
165-
message.extend(bcs::to_bytes::<AccountAddress>(&fee_payer_address).unwrap());
166170

167171
let txn_sender_signature = txn_sender_key.sign_message(&message);
168172

0 commit comments

Comments
 (0)