Skip to content

Commit 3b7df4c

Browse files
authored
chore: merge develop into master (#115)
2 parents 7c489c1 + 5e361e3 commit 3b7df4c

File tree

103 files changed

+3673
-2366
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+3673
-2366
lines changed

.appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ image: Visual Studio 2017
44

55
environment:
66
matrix:
7-
- CONFIGURATION: Debug
8-
- CONFIGURATION: Release
7+
- CONFIGURATION: Debug
8+
- CONFIGURATION: Release
99

1010
install:
1111
- git submodule update --init --recursive

.circleci/clang_tidy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if [[ -n $(grep "error: " output.txt) ]]; then
77
echo "You must pass the clang tidy checks before submitting a pull request"
88
echo ""
99
grep --color -E '^|warning: |error: ' output.txt
10-
exit -1;
10+
exit 1;
1111
else
1212
# still output the file to show warnings
1313
echo ""

.circleci/config.yml

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
steps:
66
- checkout
77
- run:
8-
name: Make scripts executable
8+
name: Make scripts executable
99
command: sudo chmod -R +x ./.circleci/*.sh
1010
- run:
1111
name: Install
@@ -18,11 +18,16 @@ jobs:
1818
steps:
1919
- checkout
2020
- run:
21-
name: Make scripts executable
21+
name: Make scripts executable
2222
command: sudo chmod -R +x ./.circleci/*.sh
2323
- run:
2424
name: Install
2525
command: ./.circleci/install_platform_io.sh
26+
- run:
27+
name: Empty Git Submodule Folders
28+
command: |
29+
rm -rf ./src/lib/{ArduinoJson/*,BIP66/*,uECC/*}
30+
rm -rf ./test/lib/googletest/*
2631
- run:
2732
name: Build
2833
command: ./.circleci/script_platform_io.sh
@@ -34,16 +39,15 @@ jobs:
3439
name: Install dependencies
3540
command: |
3641
sudo apt-get remove cmake cmake-data
37-
sudo apt-add-repository -y ppa:ubuntu-toolchain-r/test
42+
sudo apt-add-repository -y ppa:ubuntu-toolchain-r/test
3843
sudo apt-add-repository -y ppa:george-edison55/cmake-3.x
3944
sudo apt-get update
4045
sudo apt-get -y install g++-7 gcc-7 lcov cmake
4146
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7
4247
sudo update-alternatives --config gcc
4348
- run:
44-
name: Make scripts executable
49+
name: Make scripts executable
4550
command: sudo chmod -R +x ./.circleci/*.sh
46-
4751
- run:
4852
name: Build
4953
command: ./.circleci/script_desktop.sh
@@ -63,28 +67,22 @@ jobs:
6367
sudo apt-get update
6468
sudo apt install python-lldb-5.0 lcov cmake
6569
sudo apt install clang-5.0 clang-tidy-5.0 clang-format-5.0 clang-5.0-doc libclang-common-5.0-dev libclang-5.0-dev libclang1-5.0 libllvm5.0 lldb-5.0 llvm-5.0 llvm-5.0-dev
66-
6770
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-5.0 60
6871
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 50
6972
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-5.0 60
7073
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 50
71-
7274
- run:
73-
name: Make scripts executable
75+
name: Make scripts executable
7476
command: sudo chmod -R +x ./.circleci/*.sh
75-
7677
- run:
7778
name: Build
7879
command: ./.circleci/script_desktop.sh
79-
8080
- run:
8181
name: Clang Tidy
8282
command: ./.circleci/clang_tidy.sh
83-
8483
- run:
8584
name: Clang Format
8685
command: ./.circleci/clang_format.sh
87-
8886
build-macos-9-2:
8987
macos:
9088
xcode: "9.2.0"
@@ -95,7 +93,7 @@ jobs:
9593
name: Install dependencies
9694
command: brew install cmake lcov
9795
- run:
98-
name: Make scripts executable
96+
name: Make scripts executable
9997
command: sudo chmod -R +x ./.circleci/*.sh
10098
- run:
10199
name: Build
@@ -109,12 +107,11 @@ jobs:
109107
name: Install dependencies
110108
command: brew install cmake lcov
111109
- run:
112-
name: Make scripts executable
110+
name: Make scripts executable
113111
command: sudo chmod -R +x ./.circleci/*.sh
114112
- run:
115113
name: Build
116114
command: ./.circleci/script_desktop.sh
117-
118115
workflows:
119116
version: 2
120117
build:
@@ -125,4 +122,3 @@ workflows:
125122
- build-linux-clang-5
126123
- build-macos-9-2
127124
- build-macos-9-3
128-

.circleci/platformio.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* This file is part of Ark Cpp Crypto.
3+
*
4+
* (c) Ark Ecosystem <[email protected]>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
**/
9+
10+
// This is a dummy prototype 'setup' & 'loop' for CI testing.
11+
// This isn't intended for project or production use.
12+
// It is only used in the 'pio run' command from root in CI;
13+
// successful completion of which asserts that the ARK Cpp-Crypto library builds on its own.
14+
#if (defined PLATFORMIO && !defined UNIT_TEST)
15+
16+
#include <Arduino.h>
17+
18+
void setup() {}
19+
void loop() {}
20+
21+
#endif

.circleci/script_arduino.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ mv ~/project/* ~/Arduino/libraries/cpp-crypto
77

88
arduino-cli lib install "[email protected]"
99
arduino-cli lib install "BIP66"
10+
arduino-cli lib install "micro-ecc"
1011

1112
arduino-cli compile --output temp.bin -b esp32:esp32:esp32 ~/Arduino/libraries/cpp-crypto/examples/arduino/ESP32/ESP32.ino --debug

CHANGELOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,25 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

8-
## Unreleased
8+
## [0.6.0-arduino] - 2019-07-16
9+
10+
## [0.6.0] - 2019-07-16
11+
12+
### Added
13+
14+
- added Bridgechain support ([#105])
915

1016
### Changed
1117

18+
- changed amount and fee Json serialization to match Core v.2.5 ([#111])
19+
- improved PlatformIO configuration ([#101])
20+
- improved formatting and maintainability ([#98])
1221
- improved Slots implementations ([#92])
1322

23+
### Fixed
24+
25+
- fixed Transaction Json numeric serialization ([#103])
26+
1427
## [0.5.0] - 2019-02-20
1528

1629
### Changed

CMakeLists.txt

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,41 @@ set(CMAKE_CXX_STANDARD 11)
77
set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR})
88

99
if (MSVC)
10-
add_definitions(
11-
-D_CRT_SECURE_NO_WARNINGS
12-
-D_SCL_SECURE_NO_WARNINGS
13-
-DNOMINMAX
14-
)
15-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8")
16-
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
17-
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
10+
add_definitions(
11+
-D_CRT_SECURE_NO_WARNINGS
12+
-D_SCL_SECURE_NO_WARNINGS
13+
-DNOMINMAX
14+
)
15+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8")
16+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
17+
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
1818
endif()
1919

2020
# clone submodules
2121
execute_process(
22-
COMMAND git submodule update --init --recursive
23-
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
22+
COMMAND git submodule update --init --recursive
23+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
2424
)
2525

2626
# ------------------------------------------------------------------------------
2727
# Clang Tidy
2828
# ------------------------------------------------------------------------------
2929

3030
if(ENABLE_CLANG_TIDY)
31-
3231
find_program(CLANG_TIDY_BIN clang-tidy-5.0)
3332
find_program(RUN_CLANG_TIDY_BIN run-clang-tidy-5.0.py)
3433

3534
if(CLANG_TIDY_BIN STREQUAL "CLANG_TIDY_BIN-NOTFOUND")
3635
message(FATAL_ERROR "unable to locate clang-tidy-5.0")
3736
endif()
3837

39-
if(RUN_CLANG_TIDY_BIN STREQUAL "RUN_CLANG_TIDY_BIN-NOTFOUND")
40-
message(FATAL_ERROR "unable to locate run-clang-tidy-5.0.py")
41-
endif()
38+
if(RUN_CLANG_TIDY_BIN STREQUAL "RUN_CLANG_TIDY_BIN-NOTFOUND")
39+
message(FATAL_ERROR "unable to locate run-clang-tidy-5.0.py")
40+
endif()
4241

4342
list(APPEND RUN_CLANG_TIDY_BIN_ARGS
4443
-clang-tidy-binary ${CLANG_TIDY_BIN}
45-
-header-filter=.*
44+
"\"-header-filter=.*\\b(src|test|examples)\\b\\/(?!lib\/*).*\"" #Only run clang tidy on src, test, examples and skip 3rd party libraries
4645
-checks=clan*,cert*,misc*,perf*,cppc*,read*,mode*,-cert-err58-cpp,-misc-noexcept-move-constructor,-cppcoreguidelines-*
4746
)
4847

@@ -51,7 +50,6 @@ if(ENABLE_CLANG_TIDY)
5150
COMMAND ${RUN_CLANG_TIDY_BIN} ${RUN_CLANG_TIDY_BIN_ARGS}
5251
COMMENT "running clang tidy"
5352
)
54-
5553
endif()
5654

5755
add_subdirectory(src)

docs/cpp.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,79 @@ This project is still under development. This page will get more content as the
1616
* [macOS >= 10.10](#OS)
1717
* [Windows >= 7](#OS)
1818

19+
### ARK Transactions
20+
21+
#### Devnet
22+
23+
```cpp
24+
const auto DevnetTransaction = Builder::buildTransfer(
25+
"D61mfSggzbvQgTUe6JhYKH2doHaqJ3Dyib",
26+
100000000ULL,
27+
"this is a devnet transaction",
28+
"this is a top secret passphrase",
29+
"this is a top secret passphrase too");
30+
```
31+
32+
#### Mainnet
33+
34+
```cpp
35+
const Configuration MainnetConfiguration(Networks::Mainnet());
36+
37+
const auto MainnetTransaction = Builder::buildTransfer(
38+
"D61mfSggzbvQgTUe6JhYKH2doHaqJ3Dyib",
39+
100000000ULL,
40+
"this is a mainnet transaction",
41+
"this is a top secret passphrase",
42+
"this is a top secret passphrase too",
43+
MainnetConfiguration);
44+
```
45+
46+
#### BridgeChain Transaction
47+
48+
```cpp
49+
static const Network MyBridgechainNetwork = {
50+
"16c891512149d6d3ff1b70e65900936140bf853a4ae79b5515157981dcc706df",
51+
1, 0x53, 0xaa,
52+
"2019-04-12T13:00:00.000Z"
53+
};
54+
55+
const Configuration MyBridgechainConfiguration(MyBridgechainNetwork);
56+
57+
const auto MyBridgechainTransaction = Builder::buildTransfer(
58+
"D61mfSggzbvQgTUe6JhYKH2doHaqJ3Dyib",
59+
100000000ULL,
60+
"this is a custom bridgechain transaction",
61+
"this is a top secret passphrase",
62+
"this is a top secret passphrase too",
63+
MyBridgechainConfiguration);
64+
```
65+
66+
67+
#### With custom Fees
68+
69+
```cpp
70+
static const Network MyBridgechainNetwork = {
71+
"16c891512149d6d3ff1b70e65900936140bf853a4ae79b5515157981dcc706df",
72+
1, 0x53, 0xaa,
73+
"2019-04-12T13:00:00.000Z"
74+
};
75+
76+
const FeePolicy MyCustomFees = {
77+
900000000ULL, 800000000ULL, 700000000ULL, 600000000ULL, 500000000ULL,
78+
400000000ULL, 300000000ULL, 200000000ULL, 100000000ULL, 0ULL
79+
};
80+
81+
ßconst Configuration MyBridgechainConfiguration(MyBridgechainNetwork,
82+
MyCustomFees);
83+
84+
const auto MyBridgechainTransaction = Builder::buildTransfer(
85+
"D61mfSggzbvQgTUe6JhYKH2doHaqJ3Dyib",
86+
100000000ULL,
87+
"",
88+
"this is a top secret passphrase",
89+
"",
90+
MyBridgechainConfiguration);
91+
```
1992
2093
### Sign
2194

examples/arduino/ESP32/ESP32.ino

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,40 @@
3131
/****************************************/
3232

3333
void checkCrypto() {
34+
35+
/**
36+
* Create a BridgeChain transaction, tailored for your custom network.
37+
*/
38+
static const Network MyBridgechainNetwork = {
39+
"16c891512149d6d3ff1b70e65900936140bf853a4ae79b5515157981dcc706df",
40+
1, 0x53, 0xaa,
41+
"2019-04-12T13:00:00.000Z"
42+
};
43+
44+
const Configuration MyBridgechainConfiguration(MyBridgechainNetwork);
45+
46+
auto myBridgechainTransaction = Builder::buildTransfer(
47+
"D61mfSggzbvQgTUe6JhYKH2doHaqJ3Dyib",
48+
100000000ULL,
49+
"this is a custom bridgechain transaction",
50+
"this is a top secret passphrase",
51+
"this is a top secret passphrase too",
52+
MyBridgechainConfiguration);
53+
54+
Serial.print("\nBridgechain Transaction: ");
55+
Serial.println(myBridgechainTransaction.toJson().c_str());
56+
57+
/**/
58+
59+
/********************/
60+
3461
/**
3562
* This is how you can check the default 'Network' "Transaction 'Fees' by type.
3663
* In this example, it should return a 'uint64_t' integer of '10000000' as the default 'Fee' for a 'Transaction' of 'Type' '0'.
3764
*/
38-
Ark::Crypto::Configuration::Fee fee;
39-
unsigned long typeZeroTransactionFee = fee.get(0);
40-
Serial.print("\n Type 0 default Transaction Fee: ");
65+
Configuration config;
66+
unsigned long typeZeroTransactionFee = config.getFee(0);
67+
Serial.print("\nType 0 default Transaction Fee: ");
4168
Serial.println(typeZeroTransactionFee); // The response is a 'uint64_t' integer.
4269

4370
/**/

0 commit comments

Comments
 (0)