20TEST(TransactionsSetFeeTests, BuilderSettersRoundTrip)
23 auto const [publicKey, secretKey] =
63 auto tx = builder.
build(publicKey, secretKey);
66 EXPECT_TRUE(tx.validate(reason)) << reason;
69 EXPECT_FALSE(tx.getSigningPubKey().empty());
70 EXPECT_TRUE(tx.hasTxnSignature());
73 EXPECT_EQ(tx.getAccount(), accountValue);
74 EXPECT_EQ(tx.getSequence(), sequenceValue);
75 EXPECT_EQ(tx.getFee(), feeValue);
80 auto const& expected = ledgerSequenceValue;
81 auto const actualOpt = tx.getLedgerSequence();
82 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfLedgerSequence should be present";
84 EXPECT_TRUE(tx.hasLedgerSequence());
88 auto const& expected = baseFeeValue;
89 auto const actualOpt = tx.getBaseFee();
90 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfBaseFee should be present";
92 EXPECT_TRUE(tx.hasBaseFee());
96 auto const& expected = referenceFeeUnitsValue;
97 auto const actualOpt = tx.getReferenceFeeUnits();
98 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfReferenceFeeUnits should be present";
100 EXPECT_TRUE(tx.hasReferenceFeeUnits());
104 auto const& expected = reserveBaseValue;
105 auto const actualOpt = tx.getReserveBase();
106 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfReserveBase should be present";
108 EXPECT_TRUE(tx.hasReserveBase());
112 auto const& expected = reserveIncrementValue;
113 auto const actualOpt = tx.getReserveIncrement();
114 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfReserveIncrement should be present";
116 EXPECT_TRUE(tx.hasReserveIncrement());
120 auto const& expected = baseFeeDropsValue;
121 auto const actualOpt = tx.getBaseFeeDrops();
122 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfBaseFeeDrops should be present";
124 EXPECT_TRUE(tx.hasBaseFeeDrops());
128 auto const& expected = reserveBaseDropsValue;
129 auto const actualOpt = tx.getReserveBaseDrops();
130 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfReserveBaseDrops should be present";
132 EXPECT_TRUE(tx.hasReserveBaseDrops());
136 auto const& expected = reserveIncrementDropsValue;
137 auto const actualOpt = tx.getReserveIncrementDrops();
138 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfReserveIncrementDrops should be present";
140 EXPECT_TRUE(tx.hasReserveIncrementDrops());
144 auto const& expected = gasLimitValue;
145 auto const actualOpt = tx.getGasLimit();
146 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfGasLimit should be present";
148 EXPECT_TRUE(tx.hasGasLimit());
152 auto const& expected = bytecodeSizeLimitValue;
153 auto const actualOpt = tx.getBytecodeSizeLimit();
154 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfBytecodeSizeLimit should be present";
156 EXPECT_TRUE(tx.hasBytecodeSizeLimit());
160 auto const& expected = gasPriceValue;
161 auto const actualOpt = tx.getGasPrice();
162 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfGasPrice should be present";
164 EXPECT_TRUE(tx.hasGasPrice());
171TEST(TransactionsSetFeeTests, BuilderFromStTxRoundTrip)
174 auto const [publicKey, secretKey] =
214 auto initialTx = initialBuilder.
build(publicKey, secretKey);
219 auto rebuiltTx = builderFromTx.
build(publicKey, secretKey);
222 EXPECT_TRUE(rebuiltTx.validate(reason)) << reason;
225 EXPECT_EQ(rebuiltTx.getAccount(), accountValue);
226 EXPECT_EQ(rebuiltTx.getSequence(), sequenceValue);
227 EXPECT_EQ(rebuiltTx.getFee(), feeValue);
232 auto const& expected = ledgerSequenceValue;
233 auto const actualOpt = rebuiltTx.getLedgerSequence();
234 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfLedgerSequence should be present";
239 auto const& expected = baseFeeValue;
240 auto const actualOpt = rebuiltTx.getBaseFee();
241 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfBaseFee should be present";
246 auto const& expected = referenceFeeUnitsValue;
247 auto const actualOpt = rebuiltTx.getReferenceFeeUnits();
248 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfReferenceFeeUnits should be present";
253 auto const& expected = reserveBaseValue;
254 auto const actualOpt = rebuiltTx.getReserveBase();
255 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfReserveBase should be present";
260 auto const& expected = reserveIncrementValue;
261 auto const actualOpt = rebuiltTx.getReserveIncrement();
262 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfReserveIncrement should be present";
267 auto const& expected = baseFeeDropsValue;
268 auto const actualOpt = rebuiltTx.getBaseFeeDrops();
269 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfBaseFeeDrops should be present";
274 auto const& expected = reserveBaseDropsValue;
275 auto const actualOpt = rebuiltTx.getReserveBaseDrops();
276 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfReserveBaseDrops should be present";
281 auto const& expected = reserveIncrementDropsValue;
282 auto const actualOpt = rebuiltTx.getReserveIncrementDrops();
283 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfReserveIncrementDrops should be present";
288 auto const& expected = gasLimitValue;
289 auto const actualOpt = rebuiltTx.getGasLimit();
290 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfGasLimit should be present";
295 auto const& expected = bytecodeSizeLimitValue;
296 auto const actualOpt = rebuiltTx.getBytecodeSizeLimit();
297 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfBytecodeSizeLimit should be present";
302 auto const& expected = gasPriceValue;
303 auto const actualOpt = rebuiltTx.getGasPrice();
304 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfGasPrice should be present";
339TEST(TransactionsSetFeeTests, OptionalFieldsReturnNullopt)
342 auto const [publicKey, secretKey] =
360 auto tx = builder.
build(publicKey, secretKey);
363 EXPECT_FALSE(tx.hasLedgerSequence());
364 EXPECT_FALSE(tx.getLedgerSequence().has_value());
365 EXPECT_FALSE(tx.hasBaseFee());
366 EXPECT_FALSE(tx.getBaseFee().has_value());
367 EXPECT_FALSE(tx.hasReferenceFeeUnits());
368 EXPECT_FALSE(tx.getReferenceFeeUnits().has_value());
369 EXPECT_FALSE(tx.hasReserveBase());
370 EXPECT_FALSE(tx.getReserveBase().has_value());
371 EXPECT_FALSE(tx.hasReserveIncrement());
372 EXPECT_FALSE(tx.getReserveIncrement().has_value());
373 EXPECT_FALSE(tx.hasBaseFeeDrops());
374 EXPECT_FALSE(tx.getBaseFeeDrops().has_value());
375 EXPECT_FALSE(tx.hasReserveBaseDrops());
376 EXPECT_FALSE(tx.getReserveBaseDrops().has_value());
377 EXPECT_FALSE(tx.hasReserveIncrementDrops());
378 EXPECT_FALSE(tx.getReserveIncrementDrops().has_value());
379 EXPECT_FALSE(tx.hasGasLimit());
380 EXPECT_FALSE(tx.getGasLimit().has_value());
381 EXPECT_FALSE(tx.hasBytecodeSizeLimit());
382 EXPECT_FALSE(tx.getBytecodeSizeLimit().has_value());
383 EXPECT_FALSE(tx.hasGasPrice());
384 EXPECT_FALSE(tx.getGasPrice().has_value());