Skip to content

Commit d7c5260

Browse files
committed
return get address with leading 0x
1 parent 532bff8 commit d7c5260

File tree

5 files changed

+33
-23
lines changed

5 files changed

+33
-23
lines changed

.github/workflows/deploy.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
name: deploy
22
on:
33
push:
4-
tags:
5-
- v*
6-
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
4+
branches:
5+
- master
6+
# tags:
7+
# - v*
8+
79
jobs:
810
deploy:
911
runs-on: ubuntu-latest
@@ -26,11 +28,11 @@ jobs:
2628
PERSONAL_TOKEN: ${{ secrets.ACCESS_TOKEN }}
2729
PUBLISH_BRANCH: gh-pages
2830
PUBLISH_DIR: docs/build/html
29-
#- name: Build Package
30-
#run: |
31-
#python3 setup.py sdist
32-
#- name: Deploy Package
33-
#uses: pypa/gh-action-pypi-publish@master
34-
#with:
35-
#user: __token__
36-
#password: ${{ secrets.PYPI_TOKEN }}
31+
- name: Build Package
32+
run: |
33+
python3 setup.py sdist
34+
- name: Deploy Package
35+
uses: pypa/gh-action-pypi-publish@master
36+
with:
37+
user: __token__
38+
password: ${{ secrets.PYPI_TOKEN }}

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## Change log
22

3+
### 0.0.5
4+
+ Return an address with the 0x prefix added
5+
36
### 0.0.4
47
+ Import/export account private keys as a word phrase
58
+ Convex Wallet tool

convex_api/convex_api.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
from urllib.parse import urljoin
1414

1515
import requests
16-
from eth_utils import remove_0x_prefix
16+
from eth_utils import (
17+
remove_0x_prefix,
18+
add_0x_prefix
19+
)
1720

1821
from convex_api.exceptions import (
1922
ConvexAPIError,
@@ -138,7 +141,7 @@ def get_address(self, function_name, address_account):
138141
line = f'address({function_name})'
139142
result = self.query(line, address_account)
140143
if result and 'value' in result:
141-
return result['value']
144+
return add_0x_prefix(result['value'])
142145

143146
def get_balance(self, address_account, account_from=None):
144147
"""

tests/intergration/test_convex_api.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
"""
66
import pytest
77
import secrets
8-
from eth_utils import remove_0x_prefix
8+
from eth_utils import (
9+
remove_0x_prefix,
10+
add_0x_prefix
11+
)
912

1013
from convex_api.account import Account
1114
from convex_api.convex_api import ConvexAPI
@@ -16,6 +19,7 @@
1619

1720
TEST_FUNDING_AMOUNT = 8888888
1821

22+
1923
def test_convex_api_language_setup(convex_url):
2024
convex = ConvexAPI(convex_url)
2125
assert(convex.language == ConvexAPI.LANGUAGE_LISP)
@@ -69,7 +73,6 @@ def test_convex_api_send_basic_scrypt(convex_url, test_account):
6973
assert 'value' in result
7074
assert(result['value'] == [2, 3, 4, 5, 6])
7175

72-
7376
def test_convex_api_get_balance_no_funds(convex_url):
7477
convex = ConvexAPI(convex_url)
7578
account = Account.create_new()
@@ -113,7 +116,7 @@ def test_convex_api_call(convex_url):
113116
request_amount = convex.request_funds(amount, account)
114117
result = convex.send(deploy_storage, account)
115118
assert(result['value'])
116-
contract_address = result['value']
119+
contract_address = add_0x_prefix(result['value'])
117120
test_number = secrets.randbelow(1000)
118121
call_set_result = convex.send(f'(call storage-example(set {test_number}))', account)
119122
assert(call_set_result['value'] == test_number)
@@ -142,7 +145,6 @@ def test_convex_api_call(convex_url):
142145
#address = convex.get_address(contract_address_api, account)
143146
assert(address == contract_address )
144147

145-
146148
def test_convex_api_transfer(convex_url):
147149
convex = ConvexAPI(convex_url)
148150
account_from = Account.create_new()
@@ -156,18 +158,16 @@ def test_convex_api_transfer(convex_url):
156158
balance_to = convex.get_balance(account_to)
157159
assert(balance_to == amount / 2)
158160

159-
160-
161161
def test_convex_api_query_lisp(convex_url, test_account):
162162
convex = ConvexAPI(convex_url)
163163
result = convex.query(f'(address "{test_account.address_api}")', test_account)
164164
assert(result)
165165
# return value is the address as a checksum
166-
assert(result['value'] == test_account.address_checksum)
166+
assert(add_0x_prefix(result['value']) == test_account.address_checksum)
167167

168168
def test_convex_api_query_scrypt(convex_url, test_account):
169169
convex = ConvexAPI(convex_url, ConvexAPI.LANGUAGE_SCRYPT)
170170
result = convex.query(f'address("{test_account.address_api}")', test_account)
171171
assert(result)
172172
# return value is the address as a checksum
173-
assert(result['value'] == test_account.address_checksum)
173+
assert(add_0x_prefix(result['value']) == test_account.address_checksum)

tests/intergration/test_convex_break.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
import pytest
99
import secrets
10+
from eth_utils import add_0x_prefix
11+
1012

1113
from tests.helpers import auto_topup_account
1214

@@ -35,7 +37,7 @@ def test_convex_recursion(convex, test_account):
3537
"""
3638
auto_topup_account(convex, test_account)
3739
result = convex.send(contract, test_account)
38-
address_list.append(result['value'])
40+
address_list.append(add_0x_prefix(result['value']))
3941
for index in range(0, chain_length):
4042
next_index = index + 1
4143
if next_index == chain_length:
@@ -82,7 +84,7 @@ def test_schedule_transfer(convex, test_account, other_account):
8284
auto_topup_account(convex, test_account)
8385
auto_topup_account(convex, other_account)
8486
result = convex.send(contract, test_account)
85-
contract_address = result['value']
87+
contract_address = add_0x_prefix(result['value'])
8688
convex.transfer(contract_address, 8000000, other_account)
8789
auto_topup_account(convex, test_account)
8890
result = convex.send(f'(call {contract_address} (tx-delay {other_account.address} 1000))', test_account)

0 commit comments

Comments
 (0)