Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lossless image Optimization #4

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions coins.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,34 @@
"clientDocs": "https://github.com/trezor/blockbook/blob/master/docs/api.md"
}
},
{
"id": "bitcoingold",
"name": "Bitcoin Gold",
"symbol": "BTG",
"decimals": 8,
"blockchain": "Bitcoin",
"derivationPath": "m/84'/156'/0'/0/0",
"curve": "secp256k1",
"publicKeyType": "secp256k1",
"p2pkhPrefix": 38,
"p2shPrefix": 23,
"hrp": "btg",
"publicKeyHasher": "sha256ripemd",
"base58Hasher": "sha256d",
"xpub": "zpub",
"xprv": "zprv",
"explorer": {
"url": "https://explorer.bitcoingold.org/insight",
"txPath": "/tx/",
"accountPath": "/address/"
},
"info": {
"url": "https://bitcoingold.org",
"client": "https://github.com/trezor/blockbook",
"clientPublic": "",
"clientDocs": "https://github.com/trezor/blockbook/blob/master/docs/api.md"
}
},
{
"id": "callisto",
"name": "Callisto",
Expand Down
Binary file modified docs/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/coins.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ This list is generated from [./coins.json](../coins.json)
| 144 | XRP | XRP | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ripple/info/logo.png" width="32" /> | <https://ripple.com/xrp> |
| 145 | Bitcoin Cash | BCH | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/bitcoincash/info/logo.png" width="32" /> | <https://bitcoincash.org> |
| 148 | Stellar | XLM | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/stellar/info/logo.png" width="32" /> | <https://stellar.org> |
| 156 | Bitcoin Gold | BTG | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/bitcoingold/info/logo.png" width="32" /> | <https://bitcoingold.org> |
| 165 | Nano | NANO | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/nano/info/logo.png" width="32" /> | <https://nano.org> |
| 175 | Ravencoin | RVN | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ravencoin/info/logo.png" width="32" /> | <https://ravencoin.org> |
| 178 | POA Network | POA | <img src="https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/poa/info/logo.png" width="32" /> | <https://poa.network> |
Expand Down
Binary file modified docs/wallet-core.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions include/TrustWalletCore/TWCoinType.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ enum TWCoinType {
TWCoinTypeBinance = 714,
TWCoinTypeBitcoin = 0,
TWCoinTypeBitcoinCash = 145,
TWCoinTypeBitcoinGold = 156,
TWCoinTypeCallisto = 820,
TWCoinTypeCardano = 1815, // Note: Cardano Shelley testnet uses purpose 1852 (not 44) 1852/1815
TWCoinTypeCosmos = 118,
Expand Down
Binary file modified samples/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified samples/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified samples/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified samples/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified samples/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/Bitcoin/Entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ bool Entry::validateAddress(TWCoinType coin, const string& address, TW::byte p2p
case TWCoinTypeMonacoin:
case TWCoinTypeQtum:
case TWCoinTypeViacoin:
case TWCoinTypeBitcoinGold:
return SegwitAddress::isValid(address, hrp)
|| Address::isValid(address, {{p2pkh}, {p2sh}});

Expand Down Expand Up @@ -60,6 +61,7 @@ string Entry::deriveAddress(TWCoinType coin, const PublicKey& publicKey, TW::byt
case TWCoinTypeDigiByte:
case TWCoinTypeLitecoin:
case TWCoinTypeViacoin:
case TWCoinTypeBitcoinGold:
return SegwitAddress(publicKey, 0, hrp).string();

case TWCoinTypeBitcoinCash:
Expand Down
1 change: 1 addition & 0 deletions src/Bitcoin/Entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Entry: public CoinEntry {
return {
TWCoinTypeBitcoin,
TWCoinTypeBitcoinCash,
TWCoinTypeBitcoinGold,
TWCoinTypeDash,
TWCoinTypeDigiByte,
TWCoinTypeDogecoin,
Expand Down
10 changes: 10 additions & 0 deletions src/BitcoinGold/Address.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright © 2017-2020 Trust Wallet.
//
// This file is part of Trust. The full Trust copyright notice, including
// terms governing use, modification, and redistribution, is contained in the
// file LICENSE at the root of the source code distribution tree.

#include "Address.h"

using namespace TW::BitcoinGold;

35 changes: 35 additions & 0 deletions src/BitcoinGold/Address.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright © 2017-2020 Trust Wallet.
//
// This file is part of Trust. The full Trust copyright notice, including
// terms governing use, modification, and redistribution, is contained in the
// file LICENSE at the root of the source code distribution tree.

#pragma once

#include "../Base58Address.h"
#include "../Data.h"
#include "../PublicKey.h"

#include <string>

namespace TW::BitcoinGold {

/// BitcoinGold base58 address
class Address : public TW::Base58Address<21> {
public:
/// Initializes a address with a string representation.
explicit Address(const std::string& string) : TW::Base58Address<21>(string) {}

/// Initializes a address with a collection of bytes.
explicit Address(const Data& data) : TW::Base58Address<21>(data) {}

/// Initializes a address with a public key and a prefix.
Address(const PublicKey& publicKey, byte prefix) : TW::Base58Address<21>(publicKey, {prefix}) {}
};

} // namespace TW::BitcoinGold

/// Wrapper for C interface.
struct TWBitcoinGoldAddress {
TW::BitcoinGold::Address impl;
};
10 changes: 10 additions & 0 deletions src/BitcoinGold/SegwitAddress.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright © 2017-2020 Trust Wallet.
//
// This file is part of Trust. The full Trust copyright notice, including
// terms governing use, modification, and redistribution, is contained in the
// file LICENSE at the root of the source code distribution tree.

#include "SegwitAddress.h"

using namespace TW::BitcoinGold;

45 changes: 45 additions & 0 deletions src/BitcoinGold/SegwitAddress.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright © 2017-2020 Trust Wallet.
//
// This file is part of Trust. The full Trust copyright notice, including
// terms governing use, modification, and redistribution, is contained in the
// file LICENSE at the root of the source code distribution tree.

#pragma once

#include "../Bitcoin/SegwitAddress.h"

#include <string>

namespace TW::BitcoinGold {

/// BitcoinGold segwit address
class SegwitAddress : public TW::Bitcoin::SegwitAddress {

public:

/// Initializes a Bech32 address with a human-readable part, a witness
/// version, and a witness program.
SegwitAddress(std::string hrp, int witver, std::vector<uint8_t> witprog)
: TW::Bitcoin::SegwitAddress(hrp, witver, witprog) {}

/// Initializes a Bech32 address with a public key and a HRP prefix.
SegwitAddress(const PublicKey& publicKey, int witver, std::string hrp)
: TW::Bitcoin::SegwitAddress(publicKey, witver, hrp) {}

bool operator==(const SegwitAddress& rhs) const {
return hrp == rhs.hrp && witnessVersion == rhs.witnessVersion &&
witnessProgram == rhs.witnessProgram;
}

private:
SegwitAddress() = default;
};

} // namespace TW::BitcoinGold

/// Wrapper for C interface.
struct TWBitcoinGoldSegwitAddress {
TW::BitcoinGold::SegwitAddress impl;
};


12 changes: 12 additions & 0 deletions src/BitcoinGold/Signer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright © 2017-2020 Trust Wallet.
//
// This file is part of Trust. The full Trust copyright notice, including
// terms governing use, modification, and redistribution, is contained in the
// file LICENSE at the root of the source code distribution tree.

#include "Signer.h"
#include "Address.h"
#include "../PublicKey.h"

using namespace TW;
using namespace TW::BitcoinGold;
32 changes: 32 additions & 0 deletions src/BitcoinGold/Signer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright © 2017-2020 Trust Wallet.
//
// This file is part of Trust. The full Trust copyright notice, including
// terms governing use, modification, and redistribution, is contained in the
// file LICENSE at the root of the source code distribution tree.

#pragma once

#include "../Data.h"
#include "../PrivateKey.h"
#include "../proto/BitcoinGold.pb.h"

#include "../Bitcoin/Signer.h"

namespace TW::BitcoinGold {

/// Helper class that performs BitcoinGold transaction signing.
class Signer : public TW::Bitcoin::Signer {
public:
/// Hide default constructor
Signer() = delete;

/// BitcoinGold transaction use Bitcoin signer
// static Proto::SigningOutput sign(const Proto::SigningInput& input) noexcept;
};

} // namespace TW::BitcoinGold

/// Wrapper for C interface.
struct TWBitcoinGoldSigner {
TW::BitcoinGold::Signer impl;
};
11 changes: 11 additions & 0 deletions src/proto/BitcoinGold.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright © 2017-2020 Trust Wallet.
//
// This file is part of Trust. The full Trust copyright notice, including
// terms governing use, modification, and redistribution, is contained in the
// file LICENSE at the root of the source code distribution tree.

syntax = "proto3";

package TW.BitcoinGold.Proto;
option java_package = "wallet.core.jni.proto";

34 changes: 34 additions & 0 deletions tests/BitcoinGold/TWAddressTests.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright © 2017-2020 Trust Wallet.
//
// This file is part of Trust. The full Trust copyright notice, including
// terms governing use, modification, and redistribution, is contained in the
// file LICENSE at the root of the source code distribution tree.
//

#include "../interface/TWTestUtilities.h"
#include "BitcoinGold/Address.h"
#include "PrivateKey.h"
#include "PublicKey.h"
#include "HexCoding.h"
#include <gtest/gtest.h>
#include <TrustWalletCore/TWAnyAddress.h>

using namespace TW;

const char *PRIVATE_KEY = "CA6D1402199530A5D610A01A53505B6A344CF61B0CCB2902D5AEFBEA63C274BB";
const char *ADDRESS = "GSGUyooxtCUVBonYV8AANp7FvKy3WTvpMR";
const char *FAKEADDRESS = "GSGUyooxtCUVBonYV9AANp7FvKy3WTvpMR";

TEST(TWBitcoinGoldAddress, Valid) {
ASSERT_TRUE(BitcoinGold::Address::isValid(std::string(ADDRESS)));
ASSERT_FALSE(BitcoinGold::Address::isValid(std::string(FAKEADDRESS)));
}

TEST(TWBitcoinGoldAddress, PubkeyToAddress) {
const auto privateKey = PrivateKey(parse_hex(PRIVATE_KEY));
const auto publicKey = privateKey.getPublicKey(TWPublicKeyTypeSECP256k1);

/// construct with public key
auto address = BitcoinGold::Address(PublicKey(publicKey), 38);
ASSERT_EQ(address.string(), ADDRESS);
}
34 changes: 34 additions & 0 deletions tests/BitcoinGold/TWCoinTypeTests.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright © 2017-2020 Trust Wallet.
//
// This file is part of Trust. The full Trust copyright notice, including
// terms governing use, modification, and redistribution, is contained in the
// file LICENSE at the root of the source code distribution tree.
//
// This is a GENERATED FILE, changes made here MAY BE LOST.
// Generated one-time (codegen/bin/cointests)
//

#include "../interface/TWTestUtilities.h"
#include <TrustWalletCore/TWCoinTypeConfiguration.h>
#include <gtest/gtest.h>


TEST(TWBitcoinGoldCoinType, TWCoinType) {
auto symbol = WRAPS(TWCoinTypeConfigurationGetSymbol(TWCoinTypeBitcoinGold));
auto txId = TWStringCreateWithUTF8Bytes("2f807d7734de35d2236a1b3d8704eb12954f5f82ea66987949b10e94d9999b23");
auto txUrl = WRAPS(TWCoinTypeConfigurationGetTransactionURL(TWCoinTypeBitcoinGold, txId));
auto accId = TWStringCreateWithUTF8Bytes("GJjz2Du9BoJQ3CPcoyVTHUJZSj62i1693U");
auto accUrl = WRAPS(TWCoinTypeConfigurationGetAccountURL(TWCoinTypeBitcoinGold, accId));
auto id = WRAPS(TWCoinTypeConfigurationGetID(TWCoinTypeBitcoinGold));
auto name = WRAPS(TWCoinTypeConfigurationGetName(TWCoinTypeBitcoinGold));

ASSERT_EQ(TWCoinTypeConfigurationGetDecimals(TWCoinTypeBitcoinGold), 8);
ASSERT_EQ(TWBlockchainBitcoin, TWCoinTypeBlockchain(TWCoinTypeBitcoinGold));
ASSERT_EQ(23, TWCoinTypeP2shPrefix(TWCoinTypeBitcoinGold));
ASSERT_EQ(0, TWCoinTypeStaticPrefix(TWCoinTypeBitcoinGold));
assertStringsEqual(symbol, "BTG");
assertStringsEqual(txUrl, "https://explorer.bitcoingold.org/insight/tx/2f807d7734de35d2236a1b3d8704eb12954f5f82ea66987949b10e94d9999b23");
assertStringsEqual(accUrl, "https://explorer.bitcoingold.org/insight/address/GJjz2Du9BoJQ3CPcoyVTHUJZSj62i1693U");
assertStringsEqual(id, "bitcoingold");
assertStringsEqual(name, "Bitcoin Gold");
}
49 changes: 49 additions & 0 deletions tests/BitcoinGold/TWSegwitAddressTests.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright © 2017-2020 Trust Wallet.
//
// This file is part of Trust. The full Trust copyright notice, including
// terms governing use, modification, and redistribution, is contained in the
// file LICENSE at the root of the source code distribution tree.
//

#include "../interface/TWTestUtilities.h"
#include "BitcoinGold/SegwitAddress.h"
#include "PrivateKey.h"
#include "PublicKey.h"
#include "HexCoding.h"
#include <gtest/gtest.h>
#include <TrustWalletCore/TWAnyAddress.h>

using namespace TW;

TEST(TWBitcoinGoldSegwitAddress, Valid) {
ASSERT_TRUE(BitcoinGold::SegwitAddress::isValid("btg1qtesn92ddy8m5yvypgsdtft3zj5qldj9g2u52sk"));
ASSERT_FALSE(BitcoinGold::SegwitAddress::isValid("btg1qtesn92ddy8m5yvypgsdtft3zj5qldj9g2u52sl"));
}

/// Initializes a Bech32 address with a human-readable part, a witness
/// version, and a witness program.
TEST(TWBitcoinGoldSegwitAddress, WitnessProgramToAddress) {
auto address = BitcoinGold::SegwitAddress("btg", 0, parse_hex("5e6132a9ad21f7423081441ab4ae229501f6c8a8"));

ASSERT_TRUE(BitcoinGold::SegwitAddress::isValid(address.string()));
ASSERT_EQ(address.string(), "btg1qtesn92ddy8m5yvypgsdtft3zj5qldj9g2u52sk");
}

/// Initializes a Bech32 address with a public key and a HRP prefix.
TEST(TWBitcoinGoldSegwitAddress, PubkeyToAddress) {
const auto publicKey = PublicKey(parse_hex("02f74712b5d765a73b52a14c1e113f2ef3f9502d09d5987ee40f53828cfe68b9a6"), TWPublicKeyTypeSECP256k1);

/// construct with public key
auto address = BitcoinGold::SegwitAddress(publicKey, 0, "btg");

ASSERT_TRUE(BitcoinGold::SegwitAddress::isValid(address.string()));
ASSERT_EQ(address.string(), "btg1qtesn92ddy8m5yvypgsdtft3zj5qldj9g2u52sk");
}

/// Decodes a SegWit address.
TEST(TWBitcoinGoldSegwitAddress, Decode) {
std::pair<Bitcoin::SegwitAddress, bool> result = BitcoinGold::SegwitAddress::decode("btg1qtesn92ddy8m5yvypgsdtft3zj5qldj9g2u52sk");

ASSERT_TRUE(result.second);
ASSERT_EQ(result.first.string(), "btg1qtesn92ddy8m5yvypgsdtft3zj5qldj9g2u52sk");
}
Loading