Skip to content

Commit

Permalink
update to v0.3.1 (#7)
Browse files Browse the repository at this point in the history
* update from cryptogarageinc v0.3.3
  • Loading branch information
k-matsuzawa authored May 27, 2021
1 parent 8f67835 commit 6aa25a9
Show file tree
Hide file tree
Showing 31 changed files with 2,126 additions and 509 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/check_pre-merge_develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ on:
- test_ci

env:
GITHUB_VERSION: v0.0.8
GITHUB_BITCOIN_VERSION: v0.0.8
GITHUB_VERSION: v0.0.10
GITHUB_BITCOIN_VERSION: v0.0.10
DOCKER_PYTHON_VERSION: 3.7
GITHUB_DOCKER_IMAGE: docker.pkg.github.com/cryptogarageinc/elements-testing-dockerfile/elements-testing
ENTRYPOINT_PATH: /github/workspace/.github/workflows/docker/test_entrypoint.sh
Expand Down Expand Up @@ -91,9 +91,9 @@ jobs:
- name: call example
run: python ./tools/example.py

e2e-test:
elements-e2e-test:
timeout-minutes: 20
name: e2e-test
name: elements e2e test
runs-on: ubuntu-18.04

steps:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/check_pre-merge_master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ on:
- master

env:
GITHUB_VERSION: v0.0.8
GITHUB_BITCOIN_VERSION: v0.0.8
GITHUB_VERSION: v0.0.10
GITHUB_BITCOIN_VERSION: v0.0.10
DOCKER_PYTHON_VERSION: 3.7
GITHUB_DOCKER_IMAGE: docker.pkg.github.com/cryptogarageinc/elements-testing-dockerfile/elements-testing
ENTRYPOINT_PATH: /github/workspace/.github/workflows/docker/test_entrypoint.sh
Expand Down Expand Up @@ -90,9 +90,9 @@ jobs:
- name: call example
run: python ./tools/example.py

e2e-test:
elements-e2e-test:
timeout-minutes: 20
name: e2e-test
name: elements e2e test
runs-on: ubuntu-18.04

steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check_pre-merge_sprint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ on:
- features/sprint*

env:
GITHUB_VERSION: v0.0.8
GITHUB_BITCOIN_VERSION: v0.0.8
GITHUB_VERSION: v0.0.10
GITHUB_BITCOIN_VERSION: v0.0.10
DOCKER_PYTHON_VERSION: 3.7
GITHUB_DOCKER_IMAGE: docker.pkg.github.com/cryptogarageinc/elements-testing-dockerfile/elements-testing
ENTRYPOINT_PATH: /github/workspace/.github/workflows/docker/test_entrypoint.sh
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/code_scanner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ jobs:
# We must fetch at least the immediate parents so that if this is a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/docker/test_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@ pip3 install python-bitcoinrpc

cd integration_test

python3 tests/test_bitcoin.py -v
if [ $? -gt 0 ]; then
cd ../..
exit 1
fi

python3 tests/test_elements.py -v
if [ $? -gt 0 ]; then
cd ../..
Expand Down
72 changes: 0 additions & 72 deletions .github/workflows/workflow_modify_checker.yml

This file was deleted.

1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ build3 = "python3 ./setup.py build"
doc = "cd doc && doxygen Doxyfile_quiet_all"
pip_install = "pip install"
pip_list = "pip list"
wheel = "pip wheel ."
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.0
0.3.1
42 changes: 41 additions & 1 deletion cfd/address.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# @file address.py
# @brief address function implements file.
# @note Copyright 2020 CryptoGarage
from typing import Union, Optional, List
from typing import Tuple, Union, Optional, List
from .util import get_util, CfdError, JobHandle, to_hex_string
from .key import Network, Pubkey, SchnorrPubkey
from .script import HashType, Script
Expand Down Expand Up @@ -386,6 +386,46 @@ def get_multisig_address_list(
addr_list.append(_addr)
return addr_list

##
# @brief get pegin address.
# @param[in] fedpeg_script fedpeg script
# @param[in] pubkey pubkey
# @param[in] redeem_script redeem script
# @param[in] hash_type script hash type
# @param[in] mainchain_network mainchain network type
# @retval [0] pegin address.
# @retval [1] claim script.
# @retval [2] tweaked fedpeg script.
@classmethod
def get_pegin_address(
cls,
fedpeg_script: Union['Script', str],
pubkey='',
redeem_script='',
hash_type: Union['HashType', str] = HashType.P2SH_P2WSH,
mainchain_network=Network.MAINNET,
) -> Tuple['Address', 'Script', 'Script']:
_fedpeg_script = to_hex_string(fedpeg_script)
_hash_type = HashType.get(hash_type)
_network = Network.get(mainchain_network)
_pubkey = '' if pubkey is None else to_hex_string(pubkey)
_script = '' if redeem_script is None else to_hex_string(redeem_script)
if (not _pubkey) and (not _script):
raise CfdError(
error_code=1,
message='Error: Both pubkey and redeem_script is empty.')
elif not _script:
_ = Pubkey(_pubkey) # check pubkey

util = get_util()
with util.create_handle() as handle:
addr, claim_script, tweaked_fedpeg = util.call_func(
'CfdGetPeginAddress',
handle.get_handle(), _network.value, _fedpeg_script,
_hash_type.value, _pubkey, _script)
return cls.parse(addr), Script(claim_script), Script(
tweaked_fedpeg)


##
# All import target.
Expand Down
Loading

0 comments on commit 6aa25a9

Please sign in to comment.