Skip to content

Commit 6aa25a9

Browse files
authored
update to v0.3.1 (#7)
* update from cryptogarageinc v0.3.3
1 parent 8f67835 commit 6aa25a9

31 files changed

+2126
-509
lines changed

.github/workflows/check_pre-merge_develop.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ on:
1515
- test_ci
1616

1717
env:
18-
GITHUB_VERSION: v0.0.8
19-
GITHUB_BITCOIN_VERSION: v0.0.8
18+
GITHUB_VERSION: v0.0.10
19+
GITHUB_BITCOIN_VERSION: v0.0.10
2020
DOCKER_PYTHON_VERSION: 3.7
2121
GITHUB_DOCKER_IMAGE: docker.pkg.github.com/cryptogarageinc/elements-testing-dockerfile/elements-testing
2222
ENTRYPOINT_PATH: /github/workspace/.github/workflows/docker/test_entrypoint.sh
@@ -91,9 +91,9 @@ jobs:
9191
- name: call example
9292
run: python ./tools/example.py
9393

94-
e2e-test:
94+
elements-e2e-test:
9595
timeout-minutes: 20
96-
name: e2e-test
96+
name: elements e2e test
9797
runs-on: ubuntu-18.04
9898

9999
steps:

.github/workflows/check_pre-merge_master.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ on:
1313
- master
1414

1515
env:
16-
GITHUB_VERSION: v0.0.8
17-
GITHUB_BITCOIN_VERSION: v0.0.8
16+
GITHUB_VERSION: v0.0.10
17+
GITHUB_BITCOIN_VERSION: v0.0.10
1818
DOCKER_PYTHON_VERSION: 3.7
1919
GITHUB_DOCKER_IMAGE: docker.pkg.github.com/cryptogarageinc/elements-testing-dockerfile/elements-testing
2020
ENTRYPOINT_PATH: /github/workspace/.github/workflows/docker/test_entrypoint.sh
@@ -90,9 +90,9 @@ jobs:
9090
- name: call example
9191
run: python ./tools/example.py
9292

93-
e2e-test:
93+
elements-e2e-test:
9494
timeout-minutes: 20
95-
name: e2e-test
95+
name: elements e2e test
9696
runs-on: ubuntu-18.04
9797

9898
steps:

.github/workflows/check_pre-merge_sprint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ on:
1313
- features/sprint*
1414

1515
env:
16-
GITHUB_VERSION: v0.0.8
17-
GITHUB_BITCOIN_VERSION: v0.0.8
16+
GITHUB_VERSION: v0.0.10
17+
GITHUB_BITCOIN_VERSION: v0.0.10
1818
DOCKER_PYTHON_VERSION: 3.7
1919
GITHUB_DOCKER_IMAGE: docker.pkg.github.com/cryptogarageinc/elements-testing-dockerfile/elements-testing
2020
ENTRYPOINT_PATH: /github/workspace/.github/workflows/docker/test_entrypoint.sh

.github/workflows/code_scanner.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ jobs:
4141
# We must fetch at least the immediate parents so that if this is a pull request then we can checkout the head.
4242
fetch-depth: 2
4343

44-
# If this run was triggered by a pull request event, then checkout the head of the pull request instead of the merge commit.
45-
- run: git checkout HEAD^2
46-
if: ${{ github.event_name == 'pull_request' }}
47-
4844
# Initializes the CodeQL tools for scanning.
4945
- name: Initialize CodeQL
5046
uses: github/codeql-action/init@v1

.github/workflows/docker/test_entrypoint.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,6 @@ pip3 install python-bitcoinrpc
5252

5353
cd integration_test
5454

55-
python3 tests/test_bitcoin.py -v
56-
if [ $? -gt 0 ]; then
57-
cd ../..
58-
exit 1
59-
fi
60-
6155
python3 tests/test_elements.py -v
6256
if [ $? -gt 0 ]; then
6357
cd ../..

.github/workflows/workflow_modify_checker.yml

Lines changed: 0 additions & 72 deletions
This file was deleted.

Pipfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ build3 = "python3 ./setup.py build"
2222
doc = "cd doc && doxygen Doxyfile_quiet_all"
2323
pip_install = "pip install"
2424
pip_list = "pip list"
25+
wheel = "pip wheel ."

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.3.0
1+
0.3.1

cfd/address.py

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# @file address.py
44
# @brief address function implements file.
55
# @note Copyright 2020 CryptoGarage
6-
from typing import Union, Optional, List
6+
from typing import Tuple, Union, Optional, List
77
from .util import get_util, CfdError, JobHandle, to_hex_string
88
from .key import Network, Pubkey, SchnorrPubkey
99
from .script import HashType, Script
@@ -386,6 +386,46 @@ def get_multisig_address_list(
386386
addr_list.append(_addr)
387387
return addr_list
388388

389+
##
390+
# @brief get pegin address.
391+
# @param[in] fedpeg_script fedpeg script
392+
# @param[in] pubkey pubkey
393+
# @param[in] redeem_script redeem script
394+
# @param[in] hash_type script hash type
395+
# @param[in] mainchain_network mainchain network type
396+
# @retval [0] pegin address.
397+
# @retval [1] claim script.
398+
# @retval [2] tweaked fedpeg script.
399+
@classmethod
400+
def get_pegin_address(
401+
cls,
402+
fedpeg_script: Union['Script', str],
403+
pubkey='',
404+
redeem_script='',
405+
hash_type: Union['HashType', str] = HashType.P2SH_P2WSH,
406+
mainchain_network=Network.MAINNET,
407+
) -> Tuple['Address', 'Script', 'Script']:
408+
_fedpeg_script = to_hex_string(fedpeg_script)
409+
_hash_type = HashType.get(hash_type)
410+
_network = Network.get(mainchain_network)
411+
_pubkey = '' if pubkey is None else to_hex_string(pubkey)
412+
_script = '' if redeem_script is None else to_hex_string(redeem_script)
413+
if (not _pubkey) and (not _script):
414+
raise CfdError(
415+
error_code=1,
416+
message='Error: Both pubkey and redeem_script is empty.')
417+
elif not _script:
418+
_ = Pubkey(_pubkey) # check pubkey
419+
420+
util = get_util()
421+
with util.create_handle() as handle:
422+
addr, claim_script, tweaked_fedpeg = util.call_func(
423+
'CfdGetPeginAddress',
424+
handle.get_handle(), _network.value, _fedpeg_script,
425+
_hash_type.value, _pubkey, _script)
426+
return cls.parse(addr), Script(claim_script), Script(
427+
tweaked_fedpeg)
428+
389429

390430
##
391431
# All import target.

0 commit comments

Comments
 (0)