20TEST(TransactionsAccountSetTests, BuilderSettersRoundTrip)
23 auto const [publicKey, secretKey] =
50 builder.setEmailHash(emailHashValue);
51 builder.setWalletLocator(walletLocatorValue);
52 builder.setWalletSize(walletSizeValue);
53 builder.setMessageKey(messageKeyValue);
54 builder.setDomain(domainValue);
55 builder.setTransferRate(transferRateValue);
56 builder.setSetFlag(setFlagValue);
57 builder.setClearFlag(clearFlagValue);
58 builder.setTickSize(tickSizeValue);
59 builder.setNFTokenMinter(nFTokenMinterValue);
61 auto tx = builder.build(publicKey, secretKey);
64 EXPECT_TRUE(tx.validate(reason)) << reason;
67 EXPECT_FALSE(tx.getSigningPubKey().empty());
68 EXPECT_TRUE(tx.hasTxnSignature());
71 EXPECT_EQ(tx.getAccount(), accountValue);
72 EXPECT_EQ(tx.getSequence(), sequenceValue);
73 EXPECT_EQ(tx.getFee(), feeValue);
78 auto const& expected = emailHashValue;
79 auto const actualOpt = tx.getEmailHash();
80 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfEmailHash should be present";
82 EXPECT_TRUE(tx.hasEmailHash());
86 auto const& expected = walletLocatorValue;
87 auto const actualOpt = tx.getWalletLocator();
88 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfWalletLocator should be present";
90 EXPECT_TRUE(tx.hasWalletLocator());
94 auto const& expected = walletSizeValue;
95 auto const actualOpt = tx.getWalletSize();
96 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfWalletSize should be present";
98 EXPECT_TRUE(tx.hasWalletSize());
102 auto const& expected = messageKeyValue;
103 auto const actualOpt = tx.getMessageKey();
104 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfMessageKey should be present";
106 EXPECT_TRUE(tx.hasMessageKey());
110 auto const& expected = domainValue;
111 auto const actualOpt = tx.getDomain();
112 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfDomain should be present";
114 EXPECT_TRUE(tx.hasDomain());
118 auto const& expected = transferRateValue;
119 auto const actualOpt = tx.getTransferRate();
120 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfTransferRate should be present";
122 EXPECT_TRUE(tx.hasTransferRate());
126 auto const& expected = setFlagValue;
127 auto const actualOpt = tx.getSetFlag();
128 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfSetFlag should be present";
130 EXPECT_TRUE(tx.hasSetFlag());
134 auto const& expected = clearFlagValue;
135 auto const actualOpt = tx.getClearFlag();
136 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfClearFlag should be present";
138 EXPECT_TRUE(tx.hasClearFlag());
142 auto const& expected = tickSizeValue;
143 auto const actualOpt = tx.getTickSize();
144 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfTickSize should be present";
146 EXPECT_TRUE(tx.hasTickSize());
150 auto const& expected = nFTokenMinterValue;
151 auto const actualOpt = tx.getNFTokenMinter();
152 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfNFTokenMinter should be present";
154 EXPECT_TRUE(tx.hasNFTokenMinter());
161TEST(TransactionsAccountSetTests, BuilderFromStTxRoundTrip)
164 auto const [publicKey, secretKey] =
191 initialBuilder.setEmailHash(emailHashValue);
192 initialBuilder.setWalletLocator(walletLocatorValue);
193 initialBuilder.setWalletSize(walletSizeValue);
194 initialBuilder.setMessageKey(messageKeyValue);
195 initialBuilder.setDomain(domainValue);
196 initialBuilder.setTransferRate(transferRateValue);
197 initialBuilder.setSetFlag(setFlagValue);
198 initialBuilder.setClearFlag(clearFlagValue);
199 initialBuilder.setTickSize(tickSizeValue);
200 initialBuilder.setNFTokenMinter(nFTokenMinterValue);
202 auto initialTx = initialBuilder.build(publicKey, secretKey);
207 auto rebuiltTx = builderFromTx.
build(publicKey, secretKey);
210 EXPECT_TRUE(rebuiltTx.validate(reason)) << reason;
213 EXPECT_EQ(rebuiltTx.getAccount(), accountValue);
214 EXPECT_EQ(rebuiltTx.getSequence(), sequenceValue);
215 EXPECT_EQ(rebuiltTx.getFee(), feeValue);
220 auto const& expected = emailHashValue;
221 auto const actualOpt = rebuiltTx.getEmailHash();
222 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfEmailHash should be present";
227 auto const& expected = walletLocatorValue;
228 auto const actualOpt = rebuiltTx.getWalletLocator();
229 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfWalletLocator should be present";
234 auto const& expected = walletSizeValue;
235 auto const actualOpt = rebuiltTx.getWalletSize();
236 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfWalletSize should be present";
241 auto const& expected = messageKeyValue;
242 auto const actualOpt = rebuiltTx.getMessageKey();
243 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfMessageKey should be present";
248 auto const& expected = domainValue;
249 auto const actualOpt = rebuiltTx.getDomain();
250 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfDomain should be present";
255 auto const& expected = transferRateValue;
256 auto const actualOpt = rebuiltTx.getTransferRate();
257 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfTransferRate should be present";
262 auto const& expected = setFlagValue;
263 auto const actualOpt = rebuiltTx.getSetFlag();
264 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfSetFlag should be present";
269 auto const& expected = clearFlagValue;
270 auto const actualOpt = rebuiltTx.getClearFlag();
271 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfClearFlag should be present";
276 auto const& expected = tickSizeValue;
277 auto const actualOpt = rebuiltTx.getTickSize();
278 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfTickSize should be present";
283 auto const& expected = nFTokenMinterValue;
284 auto const actualOpt = rebuiltTx.getNFTokenMinter();
285 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfNFTokenMinter should be present";
320TEST(TransactionsAccountSetTests, OptionalFieldsReturnNullopt)
323 auto const [publicKey, secretKey] =
341 auto tx = builder.build(publicKey, secretKey);
344 EXPECT_FALSE(tx.hasEmailHash());
345 EXPECT_FALSE(tx.getEmailHash().has_value());
346 EXPECT_FALSE(tx.hasWalletLocator());
347 EXPECT_FALSE(tx.getWalletLocator().has_value());
348 EXPECT_FALSE(tx.hasWalletSize());
349 EXPECT_FALSE(tx.getWalletSize().has_value());
350 EXPECT_FALSE(tx.hasMessageKey());
351 EXPECT_FALSE(tx.getMessageKey().has_value());
352 EXPECT_FALSE(tx.hasDomain());
353 EXPECT_FALSE(tx.getDomain().has_value());
354 EXPECT_FALSE(tx.hasTransferRate());
355 EXPECT_FALSE(tx.getTransferRate().has_value());
356 EXPECT_FALSE(tx.hasSetFlag());
357 EXPECT_FALSE(tx.getSetFlag().has_value());
358 EXPECT_FALSE(tx.hasClearFlag());
359 EXPECT_FALSE(tx.getClearFlag().has_value());
360 EXPECT_FALSE(tx.hasTickSize());
361 EXPECT_FALSE(tx.getTickSize().has_value());
362 EXPECT_FALSE(tx.hasNFTokenMinter());
363 EXPECT_FALSE(tx.getNFTokenMinter().has_value());