Skip to content

Commit

Permalink
Merge pull request #6 from crossbario/master
Browse files Browse the repository at this point in the history
copy over helper files from deprecated pyethereum repo
  • Loading branch information
rmeissner authored Oct 18, 2019
2 parents 59923c6 + 6830b89 commit 9bc5a29
Show file tree
Hide file tree
Showing 8 changed files with 608 additions and 28 deletions.
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include README.md
include LICENSE
include requirements.txt
2 changes: 1 addition & 1 deletion py_eth_sig_utils/eip712/encoding.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ethereum import utils
from .. import utils
from eth_abi import encode_single, encode_abi

def create_struct_definition(name, schema):
Expand Down
2 changes: 1 addition & 1 deletion py_eth_sig_utils/signing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ethereum import utils
from . import utils
from eth_utils import big_endian_to_int
from .eip712 import encode_typed_data

Expand Down
34 changes: 17 additions & 17 deletions py_eth_sig_utils/tests/test_eip712_encode.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import unittest
from ethereum import utils
from .. import utils
from ..eip712.encoding import *

class TestEIP712(unittest.TestCase):

def test_encode_type_data(self):
#print("Test Simple")
data = {
"types": {
"EIP712Domain": [
data = {
"types": {
"EIP712Domain": [
{ "name": 'name', "type": 'string' },
{ "name": 'version', "type": 'string' },
{ "name": 'chainId', "type": 'uint256' },
Expand Down Expand Up @@ -41,7 +41,7 @@ def test_encode_type_data(self):
"wallet": '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
},
"contents": 'Hello, Bob!',
},
},
}
#print(create_schema("Mail", data["types"]))
self.assertEqual('Mail(Person from,Person to,string contents)Person(string name,address wallet)', create_schema("Mail", data["types"]))
Expand All @@ -58,9 +58,9 @@ def test_encode_type_data(self):

def test_encode_type_data_array(self):
#print("Test Arrays")
data = {
"types": {
"EIP712Domain": [
data = {
"types": {
"EIP712Domain": [
{ "name": 'name', "type": 'string' },
{ "name": 'version', "type": 'string' },
{ "name": 'chainId', "type": 'uint256' },
Expand Down Expand Up @@ -93,7 +93,7 @@ def test_encode_type_data_array(self):
"wallet": '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
}],
"contents": 'Hello, Bob!',
},
},
}

#print(create_schema("Mail", data["types"]))
Expand All @@ -111,9 +111,9 @@ def test_encode_type_data_array(self):

def test_encode_type_data_array_bytes(self):
#print("Test Arrays and Bytes")
data = {
"types": {
"EIP712Domain": [
data = {
"types": {
"EIP712Domain": [
{ "name": 'name', "type": 'string' },
{ "name": 'version', "type": 'string' },
{ "name": 'chainId', "type": 'uint256' },
Expand Down Expand Up @@ -148,7 +148,7 @@ def test_encode_type_data_array_bytes(self):
}],
"contents": 'Hello, Bob!',
"payload": '0x25192142931f380985072cdd991e37f65cf8253ba7a0e675b54163a1d133b8ca'
},
},
}

#print(create_schema("Mail", data["types"]))
Expand All @@ -166,9 +166,9 @@ def test_encode_type_data_array_bytes(self):

def test_sign_type_data_bytes(self):
#print("Test Bytes")
data = {
"types": {
"EIP712Domain": [
data = {
"types": {
"EIP712Domain": [
{ "name": 'name', "type": 'string' },
{ "name": 'version', "type": 'string' },
{ "name": 'chainId', "type": 'uint256' },
Expand Down Expand Up @@ -203,7 +203,7 @@ def test_sign_type_data_bytes(self):
},
"contents": 'Hello, Bob!',
"payload": '0x25192142931f380985072cdd991e37f65cf8253ba7a0e675b54163a1d133b8ca'
},
},
}

#print(create_schema("Mail", data["types"]))
Expand Down
10 changes: 5 additions & 5 deletions py_eth_sig_utils/tests/test_sign_typed_data.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import unittest
from ethereum import utils
from .. import utils
from ..signing import *

class TestSignTypedData(unittest.TestCase):

data = {
"types": {
"EIP712Domain": [
data = {
"types": {
"EIP712Domain": [
{ "name": 'name', "type": 'string' },
{ "name": 'version', "type": 'string' },
{ "name": 'chainId', "type": 'uint256' },
Expand Down Expand Up @@ -39,7 +39,7 @@ class TestSignTypedData(unittest.TestCase):
"wallet": '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
},
"contents": 'Hello, Bob!',
},
},
}

def test_sign(self):
Expand Down
Loading

0 comments on commit 9bc5a29

Please sign in to comment.