trustwallet / wallet-core

Compare 0f2c369 ... +1 ... 6114a5e

Coverage Reach
src/interface/TWEthereumAbiFunction.cpp src/interface/TWStoredKey.cpp src/interface/TWBitcoinScript.cpp src/interface/TWAnyAddress.cpp src/interface/TWPrivateKey.cpp src/interface/TWHash.cpp src/interface/TWData.cpp src/interface/TWEthereumAbiValue.cpp src/interface/TWHDWallet.cpp src/interface/TWPublicKey.cpp src/interface/TWCoinType.cpp src/interface/TWBitcoinAddress.cpp src/interface/TWString+Hex.cpp src/interface/TWSegwitAddress.cpp src/interface/TWString.cpp src/interface/TWEthereumAbi.cpp src/interface/TWBase58.cpp src/interface/TWAES.cpp src/interface/TWAnySigner.cpp src/interface/TWGroestlcoinAddress.cpp src/interface/TWAccount.cpp src/interface/TWSolanaAddress.cpp src/interface/TWFIOAccount.cpp src/interface/TWNEARAccount.cpp src/interface/TWHDVersion.cpp src/interface/TWMnemonic.cpp src/interface/TWBitcoin.cpp src/Ethereum/ABI/ParamFactory.cpp src/Ethereum/ABI/ParamNumber.h src/Ethereum/ABI/Parameters.cpp src/Ethereum/ABI/Bytes.cpp src/Ethereum/ABI/ValueEncoder.cpp src/Ethereum/ABI/Bytes.h src/Ethereum/ABI/Array.cpp src/Ethereum/ABI/ParamNumber.cpp src/Ethereum/ABI/Function.cpp src/Ethereum/ABI/ValueDecoder.cpp src/Ethereum/ABI/Function.h src/Ethereum/ABI/Parameters.h src/Ethereum/ABI/ParamAddress.h src/Ethereum/ABI/Array.h src/Ethereum/ABI/ParamBase.h src/Ethereum/ABI/ValueEncoder.h src/Ethereum/RLP.cpp src/Ethereum/Signer.cpp src/Ethereum/ContractCall.cpp src/Ethereum/Transaction.cpp src/Ethereum/RLP.h src/Ethereum/AddressChecksum.cpp src/Ethereum/Address.cpp src/Ethereum/Transaction.h src/Ethereum/Entry.cpp src/Ethereum/Entry.h src/Ethereum/Address.h src/Ethereum/Signer.h src/Bitcoin/Script.cpp src/Bitcoin/TransactionSigner.cpp src/Bitcoin/Transaction.cpp src/Bitcoin/TransactionBuilder.cpp src/Bitcoin/UnspentSelector.cpp src/Bitcoin/SegwitAddress.cpp src/Bitcoin/CashAddress.cpp src/Bitcoin/TransactionPlan.h src/Bitcoin/Signer.cpp src/Bitcoin/Entry.cpp src/Bitcoin/FeeCalculator.cpp src/Bitcoin/Script.h src/Bitcoin/TransactionBuilder.h src/Bitcoin/TransactionInput.cpp src/Bitcoin/TransactionSigner.h src/Bitcoin/Transaction.h src/Bitcoin/SegwitAddress.h src/Bitcoin/SigHashType.h src/Bitcoin/UnspentSelector.h src/Bitcoin/OutPoint.h src/Bitcoin/Address.h src/Bitcoin/TransactionInput.h src/Bitcoin/OutPoint.cpp src/Bitcoin/TransactionOutput.cpp src/Bitcoin/CashAddress.h src/Bitcoin/Entry.h src/Bitcoin/FeeCalculator.h src/Bitcoin/OpCodes.h src/Bitcoin/TransactionOutput.h src/Solana/Transaction.h src/Solana/Signer.cpp src/Solana/Transaction.cpp src/Solana/Program.cpp src/Solana/Address.cpp src/Solana/Entry.cpp src/Solana/Entry.h src/Solana/Address.h src/FIO/TransactionBuilder.cpp src/FIO/Encryption.cpp src/FIO/Action.cpp src/FIO/Address.cpp src/FIO/Action.h src/FIO/NewFundsRequest.cpp src/FIO/Actor.cpp src/FIO/Signer.cpp src/FIO/Transaction.cpp src/FIO/Entry.cpp src/FIO/Transaction.h src/FIO/Entry.h src/FIO/NewFundsRequest.h src/FIO/Address.h src/FIO/TransactionBuilder.h src/Harmony/Signer.cpp src/Harmony/Staking.h src/Harmony/Transaction.h src/Harmony/Address.h src/Harmony/Entry.cpp src/Harmony/Entry.h src/Harmony/Address.cpp src/Harmony/Signer.h src/Ontology/ParamsBuilder.cpp src/Ontology/Address.cpp src/Ontology/OngTxBuilder.cpp src/Ontology/Signer.cpp src/Ontology/Transaction.cpp src/Ontology/Ong.cpp src/Ontology/OntTxBuilder.cpp src/Ontology/Ont.cpp src/Ontology/SigData.cpp src/Ontology/Transaction.h src/Ontology/Entry.cpp src/Ontology/SigData.h src/Ontology/ParamsBuilder.h src/Ontology/Ong.h src/Ontology/Ont.h src/Ontology/Asset.h src/Ontology/Entry.h src/Ontology/Signer.h src/EOS/Transaction.cpp src/EOS/Asset.cpp src/EOS/Address.cpp src/EOS/Signer.cpp src/EOS/Action.cpp src/EOS/Name.cpp src/EOS/Serialization.h src/EOS/PackedTransaction.cpp src/EOS/Prefixes.h src/EOS/Entry.cpp src/EOS/Action.h src/EOS/Transaction.h src/EOS/Signer.h src/EOS/PackedTransaction.h src/EOS/Name.h src/EOS/Address.h src/EOS/Entry.h src/EOS/Asset.h src/TON/Cell.cpp src/TON/Address.cpp src/TON/Signer.cpp src/TON/Contract.cpp src/TON/Cell.h src/TON/Address.h src/TON/Entry.cpp src/TON/Entry.h src/NEO/Signer.cpp src/NEO/Transaction.cpp src/NEO/ReadData.cpp src/NEO/TransactionAttribute.h src/NEO/Address.cpp src/NEO/TransactionOutput.h src/NEO/Serializable.h src/NEO/CoinReference.h src/NEO/Witness.h src/NEO/Script.cpp src/NEO/MinerTransaction.h src/NEO/Entry.cpp src/NEO/ReadData.h src/NEO/Transaction.h src/NEO/Address.h src/NEO/ISerializable.h src/NEO/Entry.h src/NEO/Signer.h src/Tron/Signer.cpp src/Tron/Serialization.cpp src/Tron/Address.cpp src/Tron/Entry.cpp src/Tron/Entry.h src/Tron/Address.h src/Decred/Signer.cpp src/Decred/Transaction.cpp src/Decred/Address.cpp src/Decred/TransactionBuilder.h src/Decred/Transaction.h src/Decred/TransactionInput.cpp src/Decred/Entry.cpp src/Decred/Signer.h src/Decred/OutPoint.h src/Decred/TransactionOutput.cpp src/Decred/TransactionOutput.h src/Decred/OutPoint.cpp src/Decred/TransactionInput.h src/Decred/Entry.h src/Keystore/StoredKey.cpp src/Keystore/EncryptionParameters.cpp src/Keystore/ScryptParameters.cpp src/Keystore/Account.cpp src/Keystore/PBKDF2Parameters.cpp src/Keystore/AESParameters.cpp src/Keystore/Account.h src/Keystore/EncryptionParameters.h src/Keystore/StoredKey.h src/Keystore/ScryptParameters.h src/Keystore/AESParameters.h src/Keystore/PBKDF2Parameters.h src/Binance/Signer.cpp src/Binance/Serialization.cpp src/Binance/Address.cpp src/Binance/Entry.cpp src/Binance/Address.h src/Binance/Entry.h src/Binance/Signer.h src/Cbor.cpp src/Polkadot/Extrinsic.cpp src/Polkadot/ScaleCodec.h src/Polkadot/Extrinsic.h src/Polkadot/Signer.cpp src/Polkadot/Entry.cpp src/Polkadot/Address.h src/Polkadot/Entry.h src/Cardano/AddressV3.cpp src/Cardano/AddressV2.cpp src/Cardano/Entry.cpp src/Cardano/AddressV2.h src/Cardano/AddressV3.h src/Cardano/Entry.h src/Filecoin/Address.cpp src/Filecoin/Transaction.cpp src/Filecoin/Signer.cpp src/Filecoin/Address.h src/Filecoin/Transaction.h src/Filecoin/Entry.cpp src/Filecoin/Entry.h src/Waves/Transaction.cpp src/Waves/Address.cpp src/Waves/Signer.cpp src/Waves/Entry.cpp src/Waves/BinaryCoding.h src/Waves/Transaction.h src/Waves/Entry.h src/Tezos/Forging.cpp src/Tezos/Signer.cpp src/Tezos/Address.cpp src/Tezos/OperationList.cpp src/Tezos/BinaryCoding.cpp src/Tezos/Entry.cpp src/Tezos/Entry.h src/Tezos/OperationList.h src/Tezos/Address.h src/PrivateKey.cpp src/HDWallet.cpp src/Zcash/Transaction.cpp src/Zcash/Signer.cpp src/Zcash/TransactionBuilder.h src/Zcash/Transaction.h src/Zcash/Entry.cpp src/Zcash/TAddress.h src/Zcash/Entry.h src/NULS/Signer.cpp src/NULS/BinaryCoding.h src/NULS/Address.cpp src/NULS/Entry.cpp src/NULS/Entry.h src/NULS/Signer.h src/Ripple/Transaction.cpp src/Ripple/XAddress.cpp src/Ripple/Signer.cpp src/Ripple/BinaryCoding.h src/Ripple/Transaction.h src/Ripple/Address.cpp src/Ripple/Entry.cpp src/Ripple/Entry.h src/Coin.cpp src/Algorand/BinaryCoding.h src/Algorand/Transaction.cpp src/Algorand/Address.cpp src/Algorand/Signer.cpp src/Algorand/Transaction.h src/Algorand/Entry.cpp src/Algorand/Entry.h src/Cosmos/Serialization.cpp src/Cosmos/Signer.cpp src/Cosmos/Entry.cpp src/Cosmos/Address.h src/Cosmos/Entry.h src/Nano/Signer.cpp src/Nano/Address.cpp src/Nano/Entry.cpp src/Nano/Entry.h src/Nano/Signer.h src/Nebulas/Transaction.cpp src/Nebulas/Signer.cpp src/Nebulas/Address.cpp src/Nebulas/Transaction.h src/Nebulas/Entry.cpp src/Nebulas/Entry.h src/Nebulas/Signer.h src/Stellar/Signer.cpp src/Stellar/Address.cpp src/Stellar/Entry.cpp src/Stellar/Entry.h src/Stellar/Signer.h src/Nimiq/Address.cpp src/Nimiq/Transaction.cpp src/Nimiq/Signer.cpp src/Nimiq/Entry.cpp src/Nimiq/Signer.h src/Nimiq/Transaction.h src/Nimiq/Entry.h src/Nimiq/Address.h src/IoTeX/Staking.cpp src/IoTeX/Signer.cpp src/IoTeX/Address.h src/IoTeX/Entry.cpp src/IoTeX/Signer.h src/IoTeX/Entry.h src/IoTeX/Address.cpp src/Theta/Transaction.cpp src/Theta/Signer.cpp src/Theta/Entry.cpp src/Theta/Transaction.h src/Theta/Coins.h src/Theta/Signer.h src/Theta/Entry.h src/Aeternity/Signer.cpp src/Aeternity/Transaction.cpp src/Aeternity/Address.cpp src/Aeternity/Transaction.h src/Aeternity/Entry.cpp src/Aeternity/Identifiers.h src/Aeternity/Entry.h src/Aeternity/Address.h src/Oasis/Signer.cpp src/Oasis/Transaction.cpp src/Oasis/Address.cpp src/Oasis/Transaction.h src/Oasis/Entry.cpp src/Oasis/Address.h src/Oasis/Signer.h src/Oasis/Entry.h src/Zilliqa/Signer.cpp src/Zilliqa/AddressChecksum.cpp src/Zilliqa/Address.h src/Zilliqa/Entry.cpp src/Zilliqa/Entry.h src/Zilliqa/Address.cpp src/NEAR/Serialization.cpp src/NEAR/Address.cpp src/NEAR/Signer.cpp src/NEAR/Entry.cpp src/NEAR/Account.cpp src/NEAR/Entry.h src/PublicKey.cpp src/BinaryCoding.cpp src/Icon/Signer.cpp src/Icon/Address.cpp src/Icon/Entry.cpp src/Icon/Entry.h src/Icon/Signer.h src/Aion/Signer.cpp src/Aion/Address.cpp src/Aion/Transaction.cpp src/Aion/Transaction.h src/Aion/RLP.h src/Aion/Entry.cpp src/Aion/Address.h src/Aion/Entry.h src/Base58.cpp src/XXHash64.h src/Bech32.cpp src/Hash.cpp src/Elrond/Serialization.cpp src/Elrond/Signer.cpp src/Elrond/Entry.cpp src/Elrond/Address.h src/Elrond/Address.cpp src/Elrond/Entry.h src/VeChain/Transaction.cpp src/VeChain/Signer.cpp src/VeChain/Entry.cpp src/VeChain/Clause.h src/VeChain/Transaction.h src/VeChain/Entry.h src/Groestlcoin/Address.cpp src/Groestlcoin/Signer.cpp src/Groestlcoin/Entry.cpp src/Groestlcoin/Transaction.h src/Groestlcoin/Address.h src/Groestlcoin/Entry.h src/DerivationPath.h src/Wanchain/Signer.cpp src/Wanchain/Entry.cpp src/Wanchain/Address.cpp src/Wanchain/Entry.h src/Wanchain/Signer.h src/Wanchain/Address.h src/Bech32Address.cpp src/Encrypt.cpp src/Hash.h src/SS58Address.h src/uint256.h src/Base58Address.h src/Base64.cpp src/BinaryCoding.h src/Mnemonic.cpp src/DerivationPath.cpp src/Result.h src/HexCoding.h src/Base32.h src/Crc.cpp src/Cbor.h src/Bech32.h src/CoinEntry.h src/Data.h src/Base58.h src/Kusama/Entry.cpp src/Kusama/Address.h src/Kusama/Entry.h src/Bech32Address.h src/PrivateKey.h src/PublicKey.h src/Data.cpp src/HDWallet.h src/Coin.h walletconsole/lib/CommandExecutor.cpp walletconsole/lib/Keys.cpp walletconsole/lib/Util.cpp walletconsole/lib/Address.cpp walletconsole/lib/Coins.cpp walletconsole/lib/Buffer.cpp walletconsole/lib/WalletConsole.cpp walletconsole/lib/Buffer.h walletconsole/lib/TonCoin.h walletconsole/lib/Coins.h walletconsole/lib/WalletConsole.h walletconsole/lib/Keys.h walletconsole/lib/Util.h walletconsole/lib/CommandExecutor.h walletconsole/lib/Address.h

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.


@@ -34,8 +34,6 @@
Loading
34 34
    virtual void sign(TWCoinType coin, const Data& dataIn, Data& dataOut) const;
35 35
    virtual bool supportsJSONSigning() const { return true; }
36 36
    virtual std::string signJSON(TWCoinType coin, const std::string& json, const Data& key) const;
37 -
    virtual void encodeRawTx(TWCoinType coin, const Data& dataIn, Data& dataOut) const;
38 -
    virtual void decodeRawTx(TWCoinType coin, const Data& dataIn, Data& dataOut) const;
39 37
};
40 38
41 39
} // namespace TW::Ethereum

@@ -86,10 +86,6 @@
Loading
86 86
87 87
bool supportsJSONSigning(TWCoinType coinType);
88 88
89 -
void anyCoinEncode(TWCoinType coinType, const Data& dataIn, Data& dataOut);
90 -
91 -
void anyCoinDecode(TWCoinType coinType, const Data& dataIn, Data& dataOut);
92 -
93 89
void anyCoinPlan(TWCoinType coinType, const Data& dataIn, Data& dataOut);
94 90
95 91
// Return coins handled by the same dispatcher as the given coin (mostly for testing)

@@ -9,16 +9,12 @@
Loading
9 9
#include "../Data.h"
10 10
#include "../uint256.h"
11 11
#include "../BinaryCoding.h"
12 -
#include "../HexCoding.h"
13 12
14 -
#include <nlohmann/json.hpp>
15 13
#include <tuple>
16 14
17 15
using namespace TW;
18 16
using namespace TW::Ethereum;
19 17
20 -
using json = nlohmann::json;
21 -
22 18
Data RLP::encode(const uint256_t& value) noexcept {
23 19
    using boost::multiprecision::cpp_int;
24 20
@@ -141,26 +137,7 @@
Loading
141 137
    // clang-format on
142 138
}
143 139
144 -
Data RLP::decodeRawTransaction(const Data& data) {
145 -
    auto decoded = decode(data).decoded;
146 -
    if (decoded.size() < 9) {
147 -
        return {};
148 -
    }
149 -
    auto result = json {
150 -
        {"nonce", hexEncoded(decoded[0])},
151 -
        {"gasPrice", hexEncoded(decoded[1])},
152 -
        {"gas", hexEncoded(decoded[2])},
153 -
        {"to", hexEncoded(decoded[3])},
154 -
        {"value", hexEncoded(decoded[4])},
155 -
        {"input", hexEncoded(decoded[5])},
156 -
        {"v", hexEncoded(decoded[6])},
157 -
        {"r", hexEncoded(decoded[7])},
158 -
        {"s", hexEncoded(decoded[8])},
159 -
    }.dump();
160 -
    return Data(result.begin(), result.end());
161 -
}
162 -
163 -
static RLP::DecodedItem decodeList(const Data& input) {
140 +
RLP::DecodedItem RLP::decodeList(const Data& input) {
164 141
    RLP::DecodedItem item;
165 142
    auto remainder = input;
166 143
    while(true) {
@@ -175,7 +152,7 @@
Loading
175 152
    return item;
176 153
}
177 154
178 -
static uint64_t decodeLength(const Data& data) {
155 +
uint64_t RLP::decodeLength(const Data& data) {
179 156
    size_t index = 0;
180 157
    auto decodedLen = decodeVarInt(data, index);
181 158
    if (!std::get<0>(decodedLen)) {
@@ -237,7 +214,6 @@
Loading
237 214
        if (inputLen < listLen) {
238 215
            throw std::invalid_argument("Invalid rlp string length");
239 216
        }
240 -
        
241 217
        // empty list
242 218
        if (listLen == 0) {
243 219
            item.remainder = Data(input.begin() + 1, input.end());

@@ -232,18 +232,6 @@
Loading
232 232
    return dispatcher->supportsJSONSigning();
233 233
}
234 234
235 -
void TW::anyCoinEncode(TWCoinType coinType, const Data& dataIn, Data& dataOut) {
236 -
    auto dispatcher = coinDispatcher(coinType);
237 -
    assert(dispatcher != nullptr);
238 -
    dispatcher->encodeRawTx(coinType, dataIn, dataOut);
239 -
}
240 -
241 -
void TW::anyCoinDecode(TWCoinType coinType, const Data& dataIn, Data& dataOut) {
242 -
    auto dispatcher = coinDispatcher(coinType);
243 -
    assert(dispatcher != nullptr);
244 -
    dispatcher->decodeRawTx(coinType, dataIn, dataOut);
245 -
}
246 -
247 235
void TW::anyCoinPlan(TWCoinType coinType, const Data& dataIn, Data& dataOut) {
248 236
    auto dispatcher = coinDispatcher(coinType);
249 237
    assert(dispatcher != nullptr);

@@ -32,9 +32,6 @@
Loading
32 32
    virtual bool supportsJSONSigning() const { return false; }
33 33
    // It is optional, Signing JSON input with private key
34 34
    virtual std::string signJSON(TWCoinType coin, const std::string& json, const Data& key) const { return ""; }
35 -
    // Sign and encode broadcastable raw transaction
36 -
    virtual void encodeRawTx(TWCoinType coin, const Data& dataIn, Data& dataOut) const { return; }
37 -
    virtual void decodeRawTx(TWCoinType coin, const Data& dataIn, Data& dataOut) const { return; }
38 35
    // Planning, for UTXO chains, in preparation for signing
39 36
    // It is optional, only UTXO chains need it, default impl. leaves empty result.
40 37
    virtual void plan(TWCoinType coin, const Data& dataIn, Data& dataOut) const { return; }
@@ -51,14 +48,6 @@
Loading
51 48
    dataOut.insert(dataOut.end(), serializedOut.begin(), serializedOut.end());
52 49
}
53 50
54 -
template <typename Signer, typename Input>
55 -
void encodeTemplate(const Data& dataIn, Data& dataOut) {
56 -
    auto input = Input();
57 -
    input.ParseFromArray(dataIn.data(), (int)dataIn.size());
58 -
    auto encoded = Signer::sign(input).encoded();
59 -
    dataOut.insert(dataOut.end(), encoded.begin(), encoded.end());
60 -
}
61 -
62 51
// Note: use output parameter to avoid unneeded copies
63 52
template <typename Planner, typename Input>
64 53
void planTemplate(const Data& dataIn, Data& dataOut) {

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Learn more Showing 38 files with coverage changes found.

Changes in src/Bitcoin/CashAddress.cpp
-7
Loading file...
Changes in src/interface/TWStoredKey.cpp
-1
+1
Loading file...
Changes in src/NEO/Witness.h
-1
Loading file...
Changes in src/NEO/Address.cpp
-1
Loading file...
Changes in src/NEO/ReadData.cpp
-1
Loading file...
Changes in src/Algorand/Address.cpp
-1
Loading file...
Changes in src/Stellar/Address.cpp
-1
Loading file...
Changes in src/Nimiq/Address.cpp
-2
Loading file...
Changes in src/EOS/Asset.cpp
-1
Loading file...
Changes in src/Decred/Signer.cpp
-1
Loading file...
Changes in src/EOS/Transaction.cpp
-1
Loading file...
Changes in src/Encrypt.cpp
-5
Loading file...
Changes in src/Filecoin/Address.cpp
-2
Loading file...
Changes in src/Ontology/ParamsBuilder.cpp
-1
Loading file...
Changes in src/Decred/Transaction.cpp
-1
Loading file...
Changes in src/Bitcoin/TransactionSigner.cpp
-4
Loading file...
Changes in src/Cardano/AddressV3.cpp
-2
Loading file...
Changes in src/TON/Address.cpp
-1
Loading file...
Changes in src/FIO/Address.cpp
-2
Loading file...
Changes in src/XXHash64.h
-1
Loading file...
Changes in src/Hash.cpp
-1
Loading file...
Changes in src/PublicKey.cpp
-1
Loading file...
Changes in src/PrivateKey.cpp
-1
Loading file...
Changes in src/Waves/Transaction.cpp
-1
Loading file...
Changes in src/Harmony/Signer.cpp
-1
Loading file...
Changes in src/FIO/Encryption.cpp
-3
Loading file...
Changes in src/Ontology/Ont.cpp
-3
Loading file...
Changes in src/DerivationPath.cpp
-1
Loading file...
Changes in src/Solana/Transaction.cpp
-1
Loading file...
Changes in src/Bitcoin/Script.cpp
-1
Loading file...
Changes in src/Nimiq/Signer.cpp
-1
Loading file...
Changes in src/Ontology/Ong.cpp
-4
Loading file...
Changes in src/EOS/Serialization.h
-1
Loading file...
Changes in src/EOS/Address.cpp
-4
Loading file...
Changes in src/HDWallet.cpp
+2
Loading file...
Changes in src/interface/TWAnyAddress.cpp
+9
Loading file...
Changes in src/Zcash/Transaction.cpp
-1
Loading file...
Changes in src/Keystore/EncryptionParameters.cpp
-1
-1
Loading file...
Files Coverage
src -0.03% 95.40%
walletconsole/lib 94.71%
Project Totals (443 files) 95.38%
Loading