Skip to content

Commit

Permalink
Merge pull request #27 from kaiachain/fix/publish-publisher-portal
Browse files Browse the repository at this point in the history
web3py-ext fix bugs
  • Loading branch information
jack authored Jul 19, 2024
2 parents 8d98c28 + e0f6975 commit cdda00a
Show file tree
Hide file tree
Showing 17 changed files with 41 additions and 10 deletions.
16 changes: 9 additions & 7 deletions web3py-ext/setup.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
from setuptools import setup, find_packages
import pathlib

NAME = "web3py_ext"
VERSION = "1.0.3"
# To install the library, run the following
#
# python setup.py install
#
# prerequisite: setuptools
# http://pypi.python.org/pypi/setuptools

with open("./README.md") as readme:
long_description = readme.read()

REQUIRES = [
"web3 ~= 6.3.0"
"web3 ~= 6.3.0",
"eth-account ~= 0.11.2",
]

setup(
name=NAME,
version=VERSION,
description="kaia-sdk",
long_description=long_description,
long_description_content_type="text/markdown",
author="kaia Foundation",
author_email="",
url="https://github.com/kaiachain/kaia-sdk",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
w3 = Web3(Web3.HTTPProvider('https://public-en-baobab.klaytn.net'))

def web3_account_update_legacy():
user = Account.from_key('0x0e4ca6d38096ad99324de0dde108587e5d7c600165ae4cd6c2462c597458c2b8')
# user = Account.from_key('0x0e4ca6d38096ad99324de0dde108587e5d7c600165ae4cd6c2462c597458c2b8')
user = Account.from_key('0x4a72b3d09c3d5e28e8652e0111f9c4ce252e8299aad95bb219a38eb0a3f4da49')

account_update_tx = empty_tx(TxType.ACCOUNT_UPDATE)
account_update_tx = merge(account_update_tx, {
Expand Down
2 changes: 2 additions & 0 deletions web3py-ext/web3py_ext/extend.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
from web3py_ext.transaction.extended_transaction_utils import (
from_peb,
to_peb,
from_kei,
to_kei,
)
from web3.main import BaseWeb3
from eth_utils import units
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def __getitem__(self, index):
except TypeError:
return getattr(self, index)

def klaytn_extended_sign_transaction(self, transaction, private_key):
def klaytn_extended_sign_transaction(self, transaction, private_key, blobs=None):
# case: appending sign by multisig
if isinstance(transaction, bytes):
transaction = Account.decode_transaction(transaction)
Expand Down Expand Up @@ -206,7 +206,7 @@ def klaytn_extended_sign_transaction(self, transaction, private_key):
r,
s,
encoded_transaction,
) = sign_transaction_dict(account._key_obj, sanitized_transaction)
) = sign_transaction_dict(account._key_obj, sanitized_transaction, blobs)
transaction_hash = keccak(encoded_transaction)

return SignedTransaction(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ def payload(self) -> bytes:
transaction_with_signatures = merge(transaction_without_signature_fields, {'signatures':[]})

if vrs != {} and vrs not in transaction_with_signatures['signatures']:
if type(transaction_with_signatures['signatures']) is not list:
transaction_with_signatures['signatures'] = list(transaction_with_signatures['signatures'])
transaction_with_signatures['signatures'].append(vrs)

transaction_with_signatures = pipe(
Expand Down
2 changes: 2 additions & 0 deletions web3py-ext/web3py_ext/transaction/basic/cancel_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ def payload(self) -> bytes:
transaction_with_signatures = merge(transaction_without_signature_fields, {'signatures':[]})

if vrs != {} and vrs not in transaction_with_signatures['signatures']:
if type(transaction_with_signatures['signatures']) is not list:
transaction_with_signatures['signatures'] = list(transaction_with_signatures['signatures'])
transaction_with_signatures['signatures'].append(vrs)

transaction_with_signatures = pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ def payload(self) -> bytes:
transaction_with_signatures = merge(transaction_without_signature_fields, {'signatures':[]})

if vrs != {} and vrs not in transaction_with_signatures['signatures']:
if type(transaction_with_signatures['signatures']) is not list:
transaction_with_signatures['signatures'] = list(transaction_with_signatures['signatures'])
transaction_with_signatures['signatures'].append(vrs)

transaction_with_signatures = pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ def payload(self) -> bytes:
transaction_with_signatures = merge(transaction_without_signature_fields, {'signatures':[]})

if vrs not in transaction_with_signatures["signatures"]:
if type(transaction_with_signatures['signatures']) is not list:
transaction_with_signatures['signatures'] = list(transaction_with_signatures['signatures'])
transaction_with_signatures['signatures'].append(vrs)

transaction_with_signatures = pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ def payload(self) -> bytes:
transaction_with_signatures = merge(transaction_without_signature_fields, {'signatures':[]})

if vrs != {} and vrs not in transaction_with_signatures['signatures']:
if type(transaction_with_signatures['signatures']) is not list:
transaction_with_signatures['signatures'] = list(transaction_with_signatures['signatures'])
transaction_with_signatures['signatures'].append(vrs)

transaction_with_signatures = pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ def payload(self) -> bytes:
transaction_with_signatures = merge(transaction_without_signature_fields, {'signatures':[]})

if vrs != {} and vrs not in transaction_with_signatures['signatures']:
if type(transaction_with_signatures['signatures']) is not list:
transaction_with_signatures['signatures'] = list(transaction_with_signatures['signatures'])
transaction_with_signatures['signatures'].append(vrs)

transaction_with_signatures = pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ def payload(self) -> bytes:
transaction_with_signatures = merge(transaction_without_signature_fields, {'signatures':[]})

if vrs != {} and vrs not in transaction_with_signatures['signatures']:
if type(transaction_with_signatures['signatures']) is not list:
transaction_with_signatures['signatures'] = list(transaction_with_signatures['signatures'])
transaction_with_signatures['signatures'].append(vrs)

transaction_with_signatures = pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,8 @@ def payload(self) -> bytes:
transaction_with_signatures = merge(transaction_without_signature_fields, {'signatures':[]})

if vrs != {} and vrs not in transaction_with_signatures['signatures']:
if type(transaction_with_signatures['signatures']) is not list:
transaction_with_signatures['signatures'] = list(transaction_with_signatures['signatures'])
transaction_with_signatures['signatures'].append(vrs)

transaction_with_signatures = pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@ def payload(self) -> bytes:
transaction_with_signatures = merge(transaction_without_signature_fields, {'signatures':[]})

if vrs != {} and vrs not in transaction_with_signatures['signatures']:
if type(transaction_with_signatures['signatures']) is not list:
transaction_with_signatures['signatures'] = list(transaction_with_signatures['signatures'])
transaction_with_signatures['signatures'].append(vrs)

transaction_with_signatures = pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@ def payload(self) -> bytes:
transaction_with_signatures = merge(transaction_without_signature_fields, {'signatures':[]})

if vrs != {} and vrs not in transaction_with_signatures['signatures']:
if type(transaction_with_signatures['signatures']) is not list:
transaction_with_signatures['signatures'] = list(transaction_with_signatures['signatures'])
transaction_with_signatures['signatures'].append(vrs)

transaction_with_signatures = pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,8 @@ def payload(self) -> bytes:
transaction_with_signatures = merge(transaction_without_signature_fields, {'signatures':[]})

if vrs != {} and vrs not in transaction_with_signatures['signatures']:
if type(transaction_with_signatures['signatures']) is not list:
transaction_with_signatures['signatures'] = list(transaction_with_signatures['signatures'])
transaction_with_signatures['signatures'].append(vrs)

transaction_with_signatures = pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@ def payload(self) -> bytes:
transaction_with_signatures = merge(transaction_without_signature_fields, {'signatures':[]})

if vrs != {} and vrs not in transaction_with_signatures['signatures']:
if type(transaction_with_signatures['signatures']) is not list:
transaction_with_signatures['signatures'] = list(transaction_with_signatures['signatures'])
transaction_with_signatures['signatures'].append(vrs)

transaction_with_signatures = pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,8 @@ def payload(self) -> bytes:
transaction_with_signatures = merge(transaction_without_signature_fields, {'signatures':[]})

if vrs != {} and vrs not in transaction_with_signatures['signatures']:
if type(transaction_with_signatures['signatures']) is not list:
transaction_with_signatures['signatures'] = list(transaction_with_signatures['signatures'])
transaction_with_signatures['signatures'].append(vrs)

transaction_with_signatures = pipe(
Expand Down

0 comments on commit cdda00a

Please sign in to comment.