4#include <gtest/gtest.h>
6#include <protocol_autogen/TestHelpers.h>
8#include <xrpl/protocol/SecretKey.h>
9#include <xrpl/protocol/Seed.h>
10#include <xrpl/protocol/STTx.h>
11#include <xrpl/protocol_autogen/transactions/XChainCreateClaimID.h>
12#include <xrpl/protocol_autogen/transactions/AccountSet.h>
20TEST(TransactionsXChainCreateClaimIDTests, BuilderSettersRoundTrip)
23 auto const [publicKey, secretKey] =
40 otherChainSourceValue,
47 auto tx = builder.build(publicKey, secretKey);
50 EXPECT_TRUE(tx.validate(reason)) << reason;
53 EXPECT_FALSE(tx.getSigningPubKey().empty());
54 EXPECT_TRUE(tx.hasTxnSignature());
57 EXPECT_EQ(tx.getAccount(), accountValue);
58 EXPECT_EQ(tx.getSequence(), sequenceValue);
59 EXPECT_EQ(tx.getFee(), feeValue);
63 auto const& expected = xChainBridgeValue;
64 auto const actual = tx.getXChainBridge();
69 auto const& expected = signatureRewardValue;
70 auto const actual = tx.getSignatureReward();
75 auto const& expected = otherChainSourceValue;
76 auto const actual = tx.getOtherChainSource();
85TEST(TransactionsXChainCreateClaimIDTests, BuilderFromStTxRoundTrip)
88 auto const [publicKey, secretKey] =
105 signatureRewardValue,
106 otherChainSourceValue,
112 auto initialTx = initialBuilder.build(publicKey, secretKey);
117 auto rebuiltTx = builderFromTx.
build(publicKey, secretKey);
120 EXPECT_TRUE(rebuiltTx.validate(reason)) << reason;
123 EXPECT_EQ(rebuiltTx.getAccount(), accountValue);
124 EXPECT_EQ(rebuiltTx.getSequence(), sequenceValue);
125 EXPECT_EQ(rebuiltTx.getFee(), feeValue);
129 auto const& expected = xChainBridgeValue;
130 auto const actual = rebuiltTx.getXChainBridge();
135 auto const& expected = signatureRewardValue;
136 auto const actual = rebuiltTx.getSignatureReward();
141 auto const& expected = otherChainSourceValue;
142 auto const actual = rebuiltTx.getOtherChainSource();
150TEST(TransactionsXChainCreateClaimIDTests, WrapperThrowsOnWrongTxType)
153 auto const [pk, sk] =
158 auto wrongTx = wrongBuilder.build(pk, sk);
164TEST(TransactionsXChainCreateClaimIDTests, BuilderThrowsOnWrongTxType)
167 auto const [pk, sk] =
172 auto wrongTx = wrongBuilder.build(pk, sk);
Builder for AccountSet transactions.
std::shared_ptr< STTx const > getSTTx() const
Get the underlying STTx object.
Builder for XChainCreateClaimID transactions.
XChainCreateClaimID build(PublicKey const &publicKey, SecretKey const &secretKey)
Build and return the XChainCreateClaimID wrapper.
Transaction: XChainCreateClaimID.
TEST(TransactionsAccountDeleteTests, BuilderSettersRoundTrip)
AccountValue canonical_ACCOUNT()
Seed generateSeed(std::string const &passPhrase)
Generate a seed deterministically.
XChainBridgeValue canonical_XCHAIN_BRIDGE()
std::pair< PublicKey, SecretKey > generateKeyPair(KeyType type, Seed const &seed)
Generate a key pair deterministically.
AmountValue canonical_AMOUNT()
AccountID calcAccountID(PublicKey const &pk)
void expectEqualField(T const &expected, T const &actual, char const *fieldName)