MCPcopy Create free account
hub / github.com/QuipNetwork/cpp-sdk / MockQuipWallet

Class MockQuipWallet

include/mock_wallet.hpp:11–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9namespace quip {
10
11class MockQuipWallet : public QuipWallet {
12public:
13 MockQuipWallet(const std::string &rpc_url,
14 const std::string &contract_address)
15 : QuipWallet(rpc_url, contract_address) {}
16
17 // Mock function handlers
18 std::function<bool(const PublicKey &, const Signature &, const Address &,
19 Amount, const PrivateKey &)>
20 transferWithWinternitzMock;
21 std::function<bool(const PublicKey &, const Signature &, const Address &,
22 const std::vector<uint8_t> &, const PrivateKey &)>
23 executeWithWinternitzMock;
24 std::function<bool(const PublicKey &, const Signature &, const PrivateKey &)>
25 changePqOwnerMock;
26 std::function<Address()> getPqOwnerMock;
27 std::function<Amount()> getBalanceMock;
28
29 // Override virtual functions
30 bool transferWithWinternitz(const PublicKey &pq_pubkey,
31 const Signature &pq_sig,
32 const Address &to_address, Amount amount,
33 const PrivateKey &private_key) override {
34 if (transferWithWinternitzMock) {
35 return transferWithWinternitzMock(pq_pubkey, pq_sig, to_address, amount,
36 private_key);
37 }
38 return QuipWallet::transferWithWinternitz(pq_pubkey, pq_sig, to_address,
39 amount, private_key);
40 }
41
42 bool executeWithWinternitz(const PublicKey &pq_pubkey,
43 const Signature &pq_sig,
44 const Address &target_address,
45 const std::vector<uint8_t> &opdata,
46 const PrivateKey &private_key) override {
47 if (executeWithWinternitzMock) {
48 return executeWithWinternitzMock(pq_pubkey, pq_sig, target_address,
49 opdata, private_key);
50 }
51 return QuipWallet::executeWithWinternitz(pq_pubkey, pq_sig, target_address,
52 opdata, private_key);
53 }
54
55 bool changePqOwner(const PublicKey &pq_pubkey, const Signature &pq_sig,
56 const PrivateKey &private_key) override {
57 if (changePqOwnerMock) {
58 return changePqOwnerMock(pq_pubkey, pq_sig, private_key);
59 }
60 return QuipWallet::changePqOwner(pq_pubkey, pq_sig, private_key);
61 }
62
63 Address getPqOwner() override {
64 if (getPqOwnerMock) {
65 return getPqOwnerMock();
66 }
67 return QuipWallet::getPqOwner();
68 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected