Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Dgld #2

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
72c8b9e
Update FIO block explorer url (#903)
hewigovens Mar 30, 2020
48c04b5
Linux build.
Apr 3, 2020
645931c
Merge branch 'master' of github.com:trustwallet/wallet-core
Apr 3, 2020
72846ba
Update zcash/xlm block explorer (#915)
hewigovens Apr 4, 2020
d3e86ea
Change password type from string to data (#917)
hewigovens Apr 6, 2020
21b25e0
DGLD skeleton generated.
Apr 8, 2020
8f8a396
enable Filecoin json protobuf signing (#919)
hewigovens Apr 9, 2020
9d76b1a
DGLD address logic.
Apr 9, 2020
0d91994
[IoTeX ] support IoTeX native staking (#912)
coderbradlee Apr 10, 2020
0ee8c70
Merge branch 'master' of github.com:trustwallet/wallet-core
Apr 14, 2020
59664e5
Derivation path changed to reflect BIP44.
Apr 14, 2020
4fd327a
Fix possible memory leak in walletconsole/Util.cpp (#921)
draane Apr 14, 2020
6196197
Fix for tests.
Apr 14, 2020
f8761e9
Merge branch 'master' of github.com:blockchain/wallet-core
Apr 14, 2020
e8ff9c7
Build sample apps in CI (#909)
optout21 Apr 15, 2020
7545323
Build fixes.
Apr 15, 2020
fa3d717
Entry code for DGLD. Coin parameters update.
Apr 15, 2020
6990c1b
Merge branch 'master' of github.com:trustwallet/wallet-core
Apr 15, 2020
0f11aa1
DGLD address logic simplified.
Apr 16, 2020
87c4f1f
Create auto_assign.yml (#928)
vikmeup Apr 23, 2020
15fb8f3
Add CODEOWNERS (#930)
vikmeup Apr 23, 2020
e0e21bc
Migrate CI to GitHub Actions (#937)
hewigovens Apr 27, 2020
7dde1a5
Bitcoin Script minor fixes and new tests. (#933)
optout21 Apr 27, 2020
be7aa7d
Build system fixes to allow compilation on Linux for Android.
Apr 28, 2020
9a7c3cb
Merge branch 'master' of github.com:trustwallet/wallet-core
Apr 28, 2020
4dfeeeb
Some low-impact cppcheck finding fixes. (#938)
optout21 Apr 29, 2020
02eab8a
Add Elrond blockchain (#929)
andreibancioiu Apr 29, 2020
3eb5175
Android test app.
Apr 29, 2020
d1b8a62
Merge branch 'master' of github.com:trustwallet/wallet-core
Apr 29, 2020
458d32e
Fixes for Android build.
Apr 29, 2020
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
6 changes: 6 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.

* @hewigovens @catenocrypt
37 changes: 37 additions & 0 deletions .github/workflows/android-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Android CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: [macos-10.15]

steps:
- uses: actions/checkout@v2
- name: Install system dependencies
run: brew install boost ninja
- name: Install Android Dependencies
run: |
$ANDROID_HOME/tools/bin/sdkmanager --verbose "cmake;3.10.2.4988404" "ndk-bundle"
$ANDROID_HOME/tools/bin/sdkmanager "system-images;android-26;google_apis;x86"
- name: Accept Licenses
run: echo -e "y\ny\ny\ny\ny\n" | $ANDROID_HOME/tools/bin/sdkmanager --licenses
- name: Cache internal dependencies
id: internal_cache
uses: actions/[email protected]
with:
path: build/local
key: ${{ runner.os }}-internal-${{ hashFiles('tools/install-dependencies') }}
- name: Install internal dependencies
run: |
tools/install-dependencies
if: steps.internal_cache.outputs.cache-hit != 'true'
- name: Run test
run: |
tools/generate-files
tools/android-test
32 changes: 32 additions & 0 deletions .github/workflows/ios-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: iOS CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: [macos-10.15]
steps:
- uses: actions/checkout@v2
- name: Install system dependencies
run: |
brew install boost ninja xcodegen
- name: Cache internal dependencies
id: internal_cache
uses: actions/[email protected]
with:
path: build/local
key: ${{ runner.os }}-internal-${{ hashFiles('tools/install-dependencies') }}
- name: Install internal dependencies
run: |
tools/install-dependencies
if: steps.internal_cache.outputs.cache-hit != 'true'
- name: Run codegen tests
run: tools/codegen-test
- name: Run iOS tests
run: |
tools/generate-files
tools/ios-test
43 changes: 43 additions & 0 deletions .github/workflows/linux-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Linux CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: [ubuntu-18.04]
steps:
- uses: actions/checkout@v2
- name: Install system dependencies
run: |
# build-essential libboost-all-dev clang-9 ruby-full cmake
sudo apt-get install libc++-dev libc++abi-dev ninja-build lcov llvm
- name: Cache internal dependencies
id: internal_cache
uses: actions/[email protected]
with:
path: build/local
key: ${{ runner.os }}-internal-${{ hashFiles('tools/install-dependencies') }}
- name: Install internal dependencies
run: |
tools/install-dependencies
env:
CC: /usr/bin/clang
CXX: /usr/bin/clang++
if: steps.internal_cache.outputs.cache-hit != 'true'
- name: Build and test
run: |
tools/generate-files
cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Debug -DCODE_COVERAGE=ON -DBOOST_ROOT=${BOOST_ROOT_1_72_0}
make -Cbuild
build/tests/tests tests --gtest_output=xml
env:
CC: /usr/bin/clang
CXX: /usr/bin/clang++
- name: Gather code coverage
run: |
sudo rm -rf coverage.info
tools/coverage
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ xcode/
cmake-build-debug/
.cquery_cache/
.cxx/
CMakeCache.txt
CMakeFiles/

# Dependencies
node_modules
Expand Down
23 changes: 22 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ project(TrustWalletCore)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
if(ANDROID)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++")
endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

Expand All @@ -18,6 +22,7 @@ else()
set(PREFIX "$ENV{PREFIX}")
endif()


include_directories(${PREFIX}/include)
link_directories(${PREFIX}/lib)

Expand Down Expand Up @@ -88,3 +93,19 @@ if(NOT ANDROID AND NOT IOS_PLATFORM AND NOT WASM)
endif()

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/swift/cpp.xcconfig.in ${CMAKE_CURRENT_SOURCE_DIR}/swift/cpp.xcconfig @ONLY)

if(ANDROID)
# Workaround: <https://developercommunity.visualstudio.com/content/problem/171290/android-ndk-include-paths-are-incorrect.html>
include_directories(BEFORE SYSTEM
$ENV{NDK_DIR}/sources/android/support/include
$ENV{NDK_DIR}/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/9.0.8/include # stddef.h
$ENV{NDK_DIR}/sysroot/usr/include
$ENV{NDK_DIR}/sources/cxx-stl/llvm-libc++abi/include
$ENV{NDK_DIR}/sources/cxx-stl/llvm-libc++/include
)
else()
include_directories(BEFORE SYSTEM
/usr/include/x86_64-linux-gnu/c++/7.5.0
/usr/include/c++/7.5.0
)
endif()
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

Trust Wallet Core is a cross-platform library that implements low-level cryptographic wallet functionality for all supported blockchains. Most of the code is C++ with a set of strict exported C interfaces. The library provides idiomatic interfaces for all supported languages (currently Swift for iOS and Java for Android).

[![iOS status](https://dev.azure.com/TrustWallet/Trust%20Wallet%20Core/_apis/build/status/Wallet%20Core%20iOS)](https://dev.azure.com/TrustWallet/Trust%20Wallet%20Core/_build/latest?definitionId=13)
[![Android status](https://dev.azure.com/TrustWallet/Trust%20Wallet%20Core/_apis/build/status/Wallet%20Core%20Android)](https://dev.azure.com/TrustWallet/Trust%20Wallet%20Core/_build/latest?definitionId=11)
[![Linux status](https://dev.azure.com/TrustWallet/Trust%20Wallet%20Core/_apis/build/status/Wallet%20Core%20Linux)](https://dev.azure.com/TrustWallet/Trust%20Wallet%20Core/_build/latest?definitionId=24)
![iOS CI](https://github.com/trustwallet/wallet-core/workflows/iOS%20CI/badge.svg)
![Android CI](https://github.com/trustwallet/wallet-core/workflows/Android%20CI/badge.svg)
![Linux CI](https://github.com/trustwallet/wallet-core/workflows/Linux%20CI/badge.svg)

[![Codacy Badge](https://api.codacy.com/project/badge/Grade/82e76f6ea4ba4f0d9029e8846c04c093)](https://www.codacy.com/app/hewigovens/wallet-core?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=TrustWallet/wallet-core&amp;utm_campaign=Badge_Grade)
![Codecov](https://codecov.io/gh/TrustWallet/wallet-core/branch/master/graph/badge.svg)
Expand Down
2 changes: 1 addition & 1 deletion TrustWalletCore.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Pod::Spec.new do |s|
end

s.subspec 'Core' do |ss|
protobuf_source_dir = 'build/protobuf/staging/protobuf-3.9.0'
protobuf_source_dir = 'build/local/src/protobuf/protobuf-3.9.0'
include_dir = 'build/local/include'
ss.source_files =
'src/**/*.{c,cc,cpp,h}',
Expand Down
35 changes: 26 additions & 9 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
compileSdkVersion 29
buildToolsVersion '29.0.3'
ndkVersion '21.1.6352462'

defaultConfig {
applicationId "com.trustwallet.core.app"
minSdkVersion 23
targetSdkVersion 28
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -24,19 +26,34 @@ android {
dependencies {
implementation project(':trustwalletcore')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.appcompat:appcompat:1.2.0-beta01'

// Tests
testImplementation 'junit:junit:4.12'
androidTestImplementation("androidx.test.espresso:espresso-core:3.1.0-beta02", {
testImplementation 'junit:junit:4.13'
androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0-beta01', {
exclude group: "com.android.support", module: "support-annotations"
})
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.1.1'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.2.0'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'android.arch.core:core-testing:1.1.1'

implementation 'io.grpc:grpc-protobuf:1.24.2'
implementation 'io.grpc:grpc-protobuf:1.29.0'

debugImplementation 'com.github.DonaldDu:FixUnhandledEvent:1.0'
}

repositories {
mavenCentral()
maven { url "https://jitpack.io" }
}

configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == "com.android.support") {
if (!requested.name.startsWith("multidex")) {
details.useVersion "${targetSdk}.+"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,6 @@ class CoinAddressDerivationTests {
CARDANO -> assertEquals("addr1snpa4z7ntyfszv7ckquprdw75w4qjqh0qmya9jtkpxxlzxghlqyvv7l0yjamh8fxraw06p3ua8sj2g2gv98v4849s43t9g2999kquuu5egnprk", address)
NEO -> assertEquals("AT6w7PJvwPcSqHvtbNBY2aHPDv12eW5Uuf", address)
FILECOIN -> assertEquals("f1zzykebxldfcakj5wdb5n3n7priul522fnmjzori", address)
ELROND -> assertEquals("erd1jfcy8aeru6vlx4fe6h3pc3vlpe2cnnur5zetxdhp879yagq7vqvs8na4f8", address)
}
}
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__")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@haael This is unclear - are you planning to follow-up in this or next PR with actual test cases?

assertEquals(address.description(), expected.description())
}
}
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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here


//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())
//)
}
}
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.

package com.trustwallet.core.app.blockchains.elrond

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 TestElrondAddress {

init {
System.loadLibrary("TrustWalletCore")
}

private val aliceBech32 = "erd1l453hd0gt5gzdp7czpuall8ggt2dcv5zwmfdf3sd3lguxseux2fsmsgldz"
private var aliceSeedHex = "1a927e2af5306a9bb2ea777f73e06ecc0ac9aaa72fb4ea3fecf659451394cccf"
private var alicePubKeyHex = "0xfd691bb5e85d102687d81079dffce842d4dc328276d2d4c60d8fd1c3433c3293"

@Test
fun testAddressFromPrivateKey() {
val key = PrivateKey(aliceSeedHex.toHexByteArray())
val pubKey = key.publicKeyEd25519
val address = AnyAddress(pubKey, CoinType.ELROND)

assertEquals(alicePubKeyHex, pubKey.data().toHex())
assertEquals(aliceBech32, address.description())
}

@Test
fun testAddressFromPublicKey() {
val pubKey = PublicKey(alicePubKeyHex.toHexByteArray(), PublicKeyType.ED25519)
val address = AnyAddress(pubKey, CoinType.ELROND)

assertEquals(aliceBech32, address.description())
}

@Test
fun testAddressFromString() {
val address = AnyAddress(aliceBech32, CoinType.ELROND)

assertEquals(aliceBech32, address.description())
}
}
Loading