This repository has been archived by the owner on Mar 7, 2023. It is now read-only.
forked from trustwallet/wallet-core
-
Notifications
You must be signed in to change notification settings - Fork 7
Dgld 2 #3
Open
haael
wants to merge
15
commits into
blockchain:master
Choose a base branch
from
commerceblock:dgld_2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Dgld 2 #3
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
839a589
Linux build.
927d36a
DGLD skeleton generated.
189fed6
DGLD address logic.
7a965eb
Derivation path changed to reflect BIP44.
5306003
Fix for tests.
30f4f4e
Build fixes.
35238eb
Entry code for DGLD. Coin parameters update.
5e046a2
DGLD address logic simplified.
17dcd24
Build system fixes to allow compilation on Linux for Android.
e4159b0
Android test app.
e805e9c
Fixes for Android build.
9c0c344
Fix wallet test.
d7f4835
Signer tests for DGLD.
0ad87c5
Merge remote-tracking branch 'blockchaincom/master' into dgld_clean_1
46e3bf5
Fixes for tests and build system.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,8 @@ xcode/ | |
cmake-build-debug/ | ||
.cquery_cache/ | ||
.cxx/ | ||
CMakeCache.txt | ||
CMakeFiles/ | ||
|
||
# Dependencies | ||
node_modules | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...droidTest/java/com/trustwallet/core/app/blockchains/digitalgold/TestDigitalGoldAddress.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// 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. | ||
|
||
package com.trustwallet.core.app.blockchains.digitalgold | ||
|
||
import com.trustwallet.core.app.utils.toHex | ||
import com.trustwallet.core.app.utils.toHexByteArray | ||
import org.junit.Assert.assertEquals | ||
import org.junit.Test | ||
import wallet.core.jni.* | ||
|
||
class TestDigitalGoldAddress { | ||
|
||
init { | ||
System.loadLibrary("TrustWalletCore") | ||
} | ||
|
||
@Test | ||
fun testAddress() { | ||
// TODO: Check and finalize implementation | ||
|
||
val key = PrivateKey("__PRIVATE_KEY_DATA__".toHexByteArray()) | ||
val pubkey = key.publicKeyEd25519 | ||
val address = AnyAddress(pubkey, CoinType.DIGITALGOLD) | ||
val expected = AnyAddress("__EXPECTED_RESULT_ADDRESS__", CoinType.DIGITALGOLD) | ||
|
||
assertEquals(pubkey.data().toHex(), "0x__EXPECTED_PUBKEY_DATA__") | ||
assertEquals(address.description(), expected.description()) | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
...ndroidTest/java/com/trustwallet/core/app/blockchains/digitalgold/TestDigitalGoldSigner.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
||
package com.trustwallet.core.app.blockchains.digitalgold | ||
|
||
import com.google.protobuf.ByteString | ||
import com.trustwallet.core.app.utils.Numeric | ||
import com.trustwallet.core.app.utils.toHexByteArray | ||
import com.trustwallet.core.app.utils.toHexBytes | ||
import com.trustwallet.core.app.utils.toHexBytesInByteString | ||
import junit.framework.Assert.assertEquals | ||
import org.junit.Test | ||
import wallet.core.jni.BitcoinSigner | ||
import wallet.core.jni.proto.Bitcoin | ||
|
||
class TestDigitalGoldSigner { | ||
|
||
init { | ||
System.loadLibrary("TrustWalletCore") | ||
} | ||
|
||
@Test | ||
fun DigitalGoldTransactionSigning() { | ||
// TODO: Finalize implementation | ||
|
||
//val transfer = DigitalGold.TransferMessage.newBuilder() | ||
// .setTo("...") | ||
// .setAmount(...) | ||
// ... | ||
// .build() | ||
//val signingInput = DigitalGold.SigningInput.newBuilder() | ||
// ... | ||
// .build() | ||
|
||
//val output: DigitalGold.SigningOutput = DigitalGoldSigner.sign(signingInput) | ||
|
||
//assertEquals( | ||
// "__EXPECTED_RESULT_DATA__", | ||
// Numeric.toHexString(output.encoded.toByteArray()) | ||
//) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And here |
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
|
||
#include <algorithm> | ||
#include <cctype> | ||
#include <cassert> | ||
|
||
using namespace TW; | ||
|
||
|
@@ -77,7 +78,7 @@ Data Base58::decode(const char* begin, const char* end) const { | |
auto it = begin; | ||
|
||
// Skip leading spaces. | ||
it = std::find_if_not(it, end, std::isspace); | ||
it = std::find_if_not(it, end, [](unsigned char ch) -> bool { return std::isspace(ch); }); | ||
|
||
// Skip and count leading zeros. | ||
std::size_t zeroes = 0; | ||
|
@@ -118,7 +119,7 @@ Data Base58::decode(const char* begin, const char* end) const { | |
} | ||
|
||
// Skip trailing spaces. | ||
it = std::find_if_not(it, end, std::isspace); | ||
it = std::find_if_not(it, end, [](unsigned char ch) -> bool { return std::isspace(ch); }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it a new requirement enforced by altered build flags? |
||
if (it != end) { | ||
// Extra charaters at the end | ||
return {}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
#include <cstdint> | ||
#include <vector> | ||
#include <string> | ||
#include <tuple> | ||
|
||
namespace TW { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
|
||
#include <string> | ||
#include <vector> | ||
#include <cassert> | ||
|
||
namespace TW::Bitcoin { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
#include <TrustWalletCore/TWHRP.h> | ||
|
||
#include <array> | ||
#include <cstring> | ||
|
||
using namespace TW; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
#pragma once | ||
|
||
#include <cctype> | ||
#include <climits> | ||
|
||
#include "../Data.h" | ||
#include "../BinaryCoding.h" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// 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. | ||
|
||
import TrustWalletCore | ||
import XCTest | ||
|
||
class DigitalGoldTests: XCTestCase { | ||
// TODO: Check and finalize implementation | ||
|
||
func testAddress() { | ||
// TODO: Check and finalize implementation | ||
|
||
let key = PrivateKey(data: Data(hexString: "__PRIVATE_KEY_DATA__")!)! | ||
let pubkey = key.getPublicKeyEd25519() | ||
let address = AnyAddress(publicKey: pubkey, coin: .digitalgold) | ||
let addressFromString = AnyAddress(string: "__ADDRESS_DATA__", coin: .digitalgold)! | ||
|
||
XCTAssertEqual(pubkey.data.hexString, "__EXPECTED_PUBKEY_DATA__") | ||
XCTAssertEqual(address.description, addressFromString.description) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And on Swift level too |
||
} | ||
|
||
func testSign() { | ||
// TODO: Create implementation | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you planning to add test cases here? Seems like you already have one working on C++ core level