Skip to content

Commit

Permalink
update to v0.1.3 (#12)
Browse files Browse the repository at this point in the history
Co-authored-by: k-matsuzawa <[email protected]>
  • Loading branch information
ko-matsu and k-matsuzawa authored Jul 14, 2020
1 parent 0147ffc commit e081458
Show file tree
Hide file tree
Showing 57 changed files with 5,641 additions and 358 deletions.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/Story.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Story
about: Create a story

---

# Overview

<!-- TODO: ストーリーの概要を記述 -->

-

# Completion condition

<!-- TODO: ストーリーが完了したかどうかの判定を記述 -->

-
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/Task.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Task
about: Create a task

---

# Overview

<!-- TODO: タスクの概要を記述 -->

-

# Sub tasks

<!-- TODO: タスクを実現するために、やるべきタスクと予定時間を記述 -->
<!-- 入力例: - [ ] 〇〇クラスに、△△の実装を追加する(1.5h -> h) -->
- [ ]

# Completion condition

<!-- TODO: タスクが完了したかどうかの判定を記述 -->

-
10 changes: 2 additions & 8 deletions .github/workflows/check_pre-merge_develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,13 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/setup-node@v2.1.0
continue-on-error: true
timeout-minutes: 1
with:
node-version: ${{ matrix.node }}
- name: setup-node retry
uses: actions/setup-node@v1
continue-on-error: true
timeout-minutes: 1
with:
node-version: ${{ matrix.node }}
- name: setup-node third-try
uses: actions/setup-node@v1
uses: actions/[email protected]
timeout-minutes: 1
with:
node-version: ${{ matrix.node }}
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/check_pre-merge_master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,13 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/setup-node@v2.1.0
continue-on-error: true
timeout-minutes: 1
with:
node-version: ${{ matrix.node }}
- name: setup-node retry
uses: actions/setup-node@v1
continue-on-error: true
timeout-minutes: 1
with:
node-version: ${{ matrix.node }}
- name: setup-node third-try
uses: actions/setup-node@v1
uses: actions/[email protected]
timeout-minutes: 1
with:
node-version: ${{ matrix.node }}
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/check_pre-merge_sprint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,13 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/setup-node@v2.1.0
continue-on-error: true
timeout-minutes: 1
with:
node-version: ${{ matrix.node }}
- name: setup-node retry
uses: actions/setup-node@v1
continue-on-error: true
timeout-minutes: 1
with:
node-version: ${{ matrix.node }}
- name: setup-node third-try
uses: actions/setup-node@v1
uses: actions/[email protected]
timeout-minutes: 1
with:
node-version: ${{ matrix.node }}
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ local.properties
!.vscode/extensions.json


/wally.js
output

m4
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ else()
add_subdirectory(src)
endif() # CFDJS_API_INSTALLED

if(NOT ENABLE_EMSCRIPTEN)
add_subdirectory(addon)
endif()


if(NOT CFDJS_API_INSTALLED)
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,26 @@ npm run example
npm run elements_example
```

### Tool and library

#### using library

- cfd

#### formatter

- clang-format (using v10.0.0)

#### linter

- cpplint

#### document tool

- doxygen & graphviz

---

## Note

### Git connection:
Expand Down
45 changes: 45 additions & 0 deletions addon/cfdjs_node_addon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* @brief cfd node.js API implements file.
*/
#include <napi.h> // NOLINT

#include <string>

#include "cfd/cfd_common.h"
Expand Down Expand Up @@ -220,6 +221,33 @@ Value CreateSignatureHash(const CallbackInfo &information) {
return NodeAddonJsonApi(information, JsonMappingApi::CreateSignatureHash);
}

/**
* @brief ConvertAes の JSON API関数(request, response).
* @param[in] information node addon apiのコールバック情報
* @return 戻り値(JSON文字列)
*/
Value ConvertAes(const CallbackInfo &information) {
return NodeAddonJsonApi(information, JsonMappingApi::ConvertAes);
}

/**
* @brief EncodeBase58 の JSON API関数(request, response).
* @param[in] information node addon apiのコールバック情報
* @return 戻り値(JSON文字列)
*/
Value EncodeBase58(const CallbackInfo &information) {
return NodeAddonJsonApi(information, JsonMappingApi::EncodeBase58);
}

/**
* @brief DecodeBase58 の JSON API関数(request, response).
* @param[in] information node addon apiのコールバック情報
* @return 戻り値(JSON文字列)
*/
Value DecodeBase58(const CallbackInfo &information) {
return NodeAddonJsonApi(information, JsonMappingApi::DecodeBase58);
}

/**
* @brief EncodeSignatureByDer の JSON API関数(request, response).
* @param[in] information node addon apiのコールバック情報
Expand Down Expand Up @@ -440,6 +468,15 @@ Value SignWithPrivkey(const CallbackInfo &information) {
return NodeAddonJsonApi(information, JsonMappingApi::SignWithPrivkey);
}

/**
* @brief AddScriptHashSignのJSON API関数(request, response).
* @param[in] information node addon apiのコールバック情報
* @return 戻り値(JSON文字列)
*/
Value AddScriptHashSign(const CallbackInfo &information) {
return NodeAddonJsonApi(information, JsonMappingApi::AddScriptHashSign);
}

/**
* @brief UpdateWitnessStackのJSON API関数(request, response).
* @param[in] information node addon apiのコールバック情報
Expand Down Expand Up @@ -736,6 +773,11 @@ void InitializeJsonApi(Env env, Object *exports) {
exports->Set(
String::New(env, "CreateSignatureHash"),
Function::New(env, CreateSignatureHash));
exports->Set(String::New(env, "ConvertAes"), Function::New(env, ConvertAes));
exports->Set(
String::New(env, "EncodeBase58"), Function::New(env, EncodeBase58));
exports->Set(
String::New(env, "DecodeBase58"), Function::New(env, DecodeBase58));
exports->Set(
String::New(env, "EncodeSignatureByDer"),
Function::New(env, EncodeSignatureByDer));
Expand All @@ -752,6 +794,9 @@ void InitializeJsonApi(Env env, Object *exports) {
exports->Set(
String::New(env, "SignWithPrivkey"),
Function::New(env, SignWithPrivkey));
exports->Set(
String::New(env, "AddScriptHashSign"),
Function::New(env, AddScriptHashSign));
exports->Set(
String::New(env, "UpdateWitnessStack"),
Function::New(env, UpdateWitnessStack));
Expand Down
2 changes: 1 addition & 1 deletion cfdjs_util.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const cfdjs = require('./wrap_js/cfdjs_module.js');
const cfdjs = require('./index');

/**
* Parse bip32 path.
Expand Down
10 changes: 10 additions & 0 deletions cmake/CfdCommonOption.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ option(ENABLE_SHARED "enable shared library (ON or OFF. default:OFF)" OFF)
endif()
option(ENABLE_ELEMENTS "enable elements code (ON or OFF. default:ON)" ON)
option(ENABLE_TESTS "enable code tests (ON or OFF. default:ON)" ON)
option(ENABLE_EMSCRIPTEN "enable EMSCRIPTEN (ON or OFF. default:OFF)" OFF)

# use "cmake -DCMAKE_BUILD_TYPE=Debug" or "cmake-js -D"
# option(ENABLE_DEBUG "enable debugging (ON or OFF. default:OFF)" OFF)
Expand Down Expand Up @@ -53,3 +54,12 @@ else()
set(ELEMENTS_COMP_OPT BUILD_ELEMENTS)
set(CFD_ELEMENTS_USE "")
endif()

if(NOT ENABLE_EMSCRIPTEN)
set(USE_EMSCRIPTEN FALSE)
set(EMSCRIPTEN_OPT "")
else()
set(USE_EMSCRIPTEN TRUE)
set(EMSCRIPTEN_OPT "")
#set(EMSCRIPTEN_OPT "-fwasm-exceptions")
endif()
5 changes: 5 additions & 0 deletions cmake/Cpp11Setting.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb")
endif()
endif()

if(${USE_EMSCRIPTEN})
# feature: -fwasm-exceptions
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s DISABLE_EXCEPTION_CATCHING=0")
endif()

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
4 changes: 2 additions & 2 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ if(CFD_TARGET_VERSION)
set(CFD_TARGET_TAG ${CFD_TARGET_VERSION})
message(STATUS "[external project local] cfd target=${CFD_TARGET_VERSION}")
else()
set(CFD_TARGET_TAG v0.1.2)
set(CFD_TARGET_TAG v0.1.3)
endif()
if(CFD_TARGET_URL)
set(CFD_TARGET_REP ${CFD_TARGET_URL})
Expand Down Expand Up @@ -135,7 +135,7 @@ if(LIBWALLY_TARGET_VERSION)
set(LIBWALLY_TARGET_TAG ${LIBWALLY_TARGET_VERSION})
message(STATUS "[external project cfd-js local] libwally-core target=${LIBWALLY_TARGET_VERSION}")
else()
set(LIBWALLY_TARGET_TAG cmake_build)
set(LIBWALLY_TARGET_TAG refs/tags/cfd-0.0.2)
endif()

if(${USE_GIT_SSH})
Expand Down
8 changes: 8 additions & 0 deletions include/cfdjs/cfdjs_api_elements_transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ class CFD_JS_API_EXPORT ElementsTransactionStructApi {
static AddPubkeyHashSignResponseStruct AddPubkeyHashSign(
const AddPubkeyHashSignRequestStruct& request);

/**
* @brief パラメータの情報を元に、Scriptの署名情報を追加する.
* @param[in] request Transactionと署名情報を格納した構造体
* @return Transactionのhexデータを格納した構造体
*/
static AddScriptHashSignResponseStruct AddScriptHashSign(
const AddScriptHashSignRequestStruct& request);

/**
* @brief パラメータの情報を元に、WitnessStackの情報を更新する.
* @param[in] request TransactionとWitnessStack追加情報を格納した構造体
Expand Down
Loading

0 comments on commit e081458

Please sign in to comment.