Skip to content

Commit

Permalink
chore: merge develop into master (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
faustbrian authored Jul 16, 2019
2 parents 7c489c1 + 5e361e3 commit 3b7df4c
Show file tree
Hide file tree
Showing 103 changed files with 3,673 additions and 2,366 deletions.
4 changes: 2 additions & 2 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ image: Visual Studio 2017

environment:
matrix:
- CONFIGURATION: Debug
- CONFIGURATION: Release
- CONFIGURATION: Debug
- CONFIGURATION: Release

install:
- git submodule update --init --recursive
Expand Down
2 changes: 1 addition & 1 deletion .circleci/clang_tidy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if [[ -n $(grep "error: " output.txt) ]]; then
echo "You must pass the clang tidy checks before submitting a pull request"
echo ""
grep --color -E '^|warning: |error: ' output.txt
exit -1;
exit 1;
else
# still output the file to show warnings
echo ""
Expand Down
28 changes: 12 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
steps:
- checkout
- run:
name: Make scripts executable
name: Make scripts executable
command: sudo chmod -R +x ./.circleci/*.sh
- run:
name: Install
Expand All @@ -18,11 +18,16 @@ jobs:
steps:
- checkout
- run:
name: Make scripts executable
name: Make scripts executable
command: sudo chmod -R +x ./.circleci/*.sh
- run:
name: Install
command: ./.circleci/install_platform_io.sh
- run:
name: Empty Git Submodule Folders
command: |
rm -rf ./src/lib/{ArduinoJson/*,BIP66/*,uECC/*}
rm -rf ./test/lib/googletest/*
- run:
name: Build
command: ./.circleci/script_platform_io.sh
Expand All @@ -34,16 +39,15 @@ jobs:
name: Install dependencies
command: |
sudo apt-get remove cmake cmake-data
sudo apt-add-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-add-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-add-repository -y ppa:george-edison55/cmake-3.x
sudo apt-get update
sudo apt-get -y install g++-7 gcc-7 lcov cmake
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7
sudo update-alternatives --config gcc
- run:
name: Make scripts executable
name: Make scripts executable
command: sudo chmod -R +x ./.circleci/*.sh

- run:
name: Build
command: ./.circleci/script_desktop.sh
Expand All @@ -63,28 +67,22 @@ jobs:
sudo apt-get update
sudo apt install python-lldb-5.0 lcov cmake
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
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-5.0 60
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 50
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-5.0 60
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 50
- run:
name: Make scripts executable
name: Make scripts executable
command: sudo chmod -R +x ./.circleci/*.sh

- run:
name: Build
command: ./.circleci/script_desktop.sh

- run:
name: Clang Tidy
command: ./.circleci/clang_tidy.sh

- run:
name: Clang Format
command: ./.circleci/clang_format.sh

build-macos-9-2:
macos:
xcode: "9.2.0"
Expand All @@ -95,7 +93,7 @@ jobs:
name: Install dependencies
command: brew install cmake lcov
- run:
name: Make scripts executable
name: Make scripts executable
command: sudo chmod -R +x ./.circleci/*.sh
- run:
name: Build
Expand All @@ -109,12 +107,11 @@ jobs:
name: Install dependencies
command: brew install cmake lcov
- run:
name: Make scripts executable
name: Make scripts executable
command: sudo chmod -R +x ./.circleci/*.sh
- run:
name: Build
command: ./.circleci/script_desktop.sh

workflows:
version: 2
build:
Expand All @@ -125,4 +122,3 @@ workflows:
- build-linux-clang-5
- build-macos-9-2
- build-macos-9-3

21 changes: 21 additions & 0 deletions .circleci/platformio.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* This file is part of Ark Cpp Crypto.
*
* (c) Ark Ecosystem <info@ark.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
**/

// This is a dummy prototype 'setup' & 'loop' for CI testing.
// This isn't intended for project or production use.
// It is only used in the 'pio run' command from root in CI;
// successful completion of which asserts that the ARK Cpp-Crypto library builds on its own.
#if (defined PLATFORMIO && !defined UNIT_TEST)

#include <Arduino.h>

void setup() {}
void loop() {}

#endif
1 change: 1 addition & 0 deletions .circleci/script_arduino.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ mv ~/project/* ~/Arduino/libraries/cpp-crypto

arduino-cli lib install "ArduinoJson@6.10.0"
arduino-cli lib install "BIP66"
arduino-cli lib install "micro-ecc"

arduino-cli compile --output temp.bin -b esp32:esp32:esp32 ~/Arduino/libraries/cpp-crypto/examples/arduino/ESP32/ESP32.ino --debug
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,25 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## Unreleased
## [0.6.0-arduino] - 2019-07-16

## [0.6.0] - 2019-07-16

### Added

- added Bridgechain support ([#105])

### Changed

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

### Fixed

- fixed Transaction Json numeric serialization ([#103])

## [0.5.0] - 2019-02-20

### Changed
Expand Down
30 changes: 14 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,41 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR})

if (MSVC)
add_definitions(
-D_CRT_SECURE_NO_WARNINGS
-D_SCL_SECURE_NO_WARNINGS
-DNOMINMAX
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
add_definitions(
-D_CRT_SECURE_NO_WARNINGS
-D_SCL_SECURE_NO_WARNINGS
-DNOMINMAX
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
endif()

# clone submodules
execute_process(
COMMAND git submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND git submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

# ------------------------------------------------------------------------------
# Clang Tidy
# ------------------------------------------------------------------------------

if(ENABLE_CLANG_TIDY)

find_program(CLANG_TIDY_BIN clang-tidy-5.0)
find_program(RUN_CLANG_TIDY_BIN run-clang-tidy-5.0.py)

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

if(RUN_CLANG_TIDY_BIN STREQUAL "RUN_CLANG_TIDY_BIN-NOTFOUND")
message(FATAL_ERROR "unable to locate run-clang-tidy-5.0.py")
endif()
if(RUN_CLANG_TIDY_BIN STREQUAL "RUN_CLANG_TIDY_BIN-NOTFOUND")
message(FATAL_ERROR "unable to locate run-clang-tidy-5.0.py")
endif()

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

Expand All @@ -51,7 +50,6 @@ if(ENABLE_CLANG_TIDY)
COMMAND ${RUN_CLANG_TIDY_BIN} ${RUN_CLANG_TIDY_BIN_ARGS}
COMMENT "running clang tidy"
)

endif()

add_subdirectory(src)
Expand Down
73 changes: 73 additions & 0 deletions docs/cpp.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,79 @@ This project is still under development. This page will get more content as the
* [macOS >= 10.10](#OS)
* [Windows >= 7](#OS)

### ARK Transactions

#### Devnet

```cpp
const auto DevnetTransaction = Builder::buildTransfer(
"D61mfSggzbvQgTUe6JhYKH2doHaqJ3Dyib",
100000000ULL,
"this is a devnet transaction",
"this is a top secret passphrase",
"this is a top secret passphrase too");
```

#### Mainnet

```cpp
const Configuration MainnetConfiguration(Networks::Mainnet());

const auto MainnetTransaction = Builder::buildTransfer(
"D61mfSggzbvQgTUe6JhYKH2doHaqJ3Dyib",
100000000ULL,
"this is a mainnet transaction",
"this is a top secret passphrase",
"this is a top secret passphrase too",
MainnetConfiguration);
```
#### BridgeChain Transaction
```cpp
static const Network MyBridgechainNetwork = {
"16c891512149d6d3ff1b70e65900936140bf853a4ae79b5515157981dcc706df",
1, 0x53, 0xaa,
"2019-04-12T13:00:00.000Z"
};
const Configuration MyBridgechainConfiguration(MyBridgechainNetwork);
const auto MyBridgechainTransaction = Builder::buildTransfer(
"D61mfSggzbvQgTUe6JhYKH2doHaqJ3Dyib",
100000000ULL,
"this is a custom bridgechain transaction",
"this is a top secret passphrase",
"this is a top secret passphrase too",
MyBridgechainConfiguration);
```


#### With custom Fees

```cpp
static const Network MyBridgechainNetwork = {
"16c891512149d6d3ff1b70e65900936140bf853a4ae79b5515157981dcc706df",
1, 0x53, 0xaa,
"2019-04-12T13:00:00.000Z"
};

const FeePolicy MyCustomFees = {
900000000ULL, 800000000ULL, 700000000ULL, 600000000ULL, 500000000ULL,
400000000ULL, 300000000ULL, 200000000ULL, 100000000ULL, 0ULL
};

ßconst Configuration MyBridgechainConfiguration(MyBridgechainNetwork,
MyCustomFees);

const auto MyBridgechainTransaction = Builder::buildTransfer(
"D61mfSggzbvQgTUe6JhYKH2doHaqJ3Dyib",
100000000ULL,
"",
"this is a top secret passphrase",
"",
MyBridgechainConfiguration);
```
### Sign
Expand Down
33 changes: 30 additions & 3 deletions examples/arduino/ESP32/ESP32.ino
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,40 @@
/****************************************/

void checkCrypto() {

/**
* Create a BridgeChain transaction, tailored for your custom network.
*/
static const Network MyBridgechainNetwork = {
"16c891512149d6d3ff1b70e65900936140bf853a4ae79b5515157981dcc706df",
1, 0x53, 0xaa,
"2019-04-12T13:00:00.000Z"
};

const Configuration MyBridgechainConfiguration(MyBridgechainNetwork);

auto myBridgechainTransaction = Builder::buildTransfer(
"D61mfSggzbvQgTUe6JhYKH2doHaqJ3Dyib",
100000000ULL,
"this is a custom bridgechain transaction",
"this is a top secret passphrase",
"this is a top secret passphrase too",
MyBridgechainConfiguration);

Serial.print("\nBridgechain Transaction: ");
Serial.println(myBridgechainTransaction.toJson().c_str());

/**/

/********************/

/**
* This is how you can check the default 'Network' "Transaction 'Fees' by type.
* In this example, it should return a 'uint64_t' integer of '10000000' as the default 'Fee' for a 'Transaction' of 'Type' '0'.
*/
Ark::Crypto::Configuration::Fee fee;
unsigned long typeZeroTransactionFee = fee.get(0);
Serial.print("\n Type 0 default Transaction Fee: ");
Configuration config;
unsigned long typeZeroTransactionFee = config.getFee(0);
Serial.print("\nType 0 default Transaction Fee: ");
Serial.println(typeZeroTransactionFee); // The response is a 'uint64_t' integer.

/**/
Expand Down
Loading

0 comments on commit 3b7df4c

Please sign in to comment.