Skip to content

Commit

Permalink
refactor test.py
Browse files Browse the repository at this point in the history
  • Loading branch information
esaulpaugh committed Jun 8, 2024
1 parent 04e1b01 commit 65f224b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions python/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import binascii

from abiv3.TypeFactory import TypeFactory
from abiv3.V3 import V3


def to_hex(data):
return ''.join(format(b, '02x') for b in data)


# schema = [V3Type.BOOL, V3Type.INT256, V3Type.BYTES, V3Type.INT256_ARRAY_3, V3Type.UFIXED_128_X_18]
# objects = [True, 5, b'\x03\x09', [10, -16777215, 0], -10.9]

Expand All @@ -42,7 +45,7 @@
# print(dec.elementType.elementType.canonicalType)

enc = V3.encode_function(1, [t], [[[[True, False], [False, False], [False, True], [True, True]]]], True)
print(binascii.hexlify(enc))
print(to_hex(enc)) # b'41040100000000010101'
valz = V3.decode_function([t], enc)
print(valz)

Expand Down Expand Up @@ -74,7 +77,7 @@

n = len(arr)
print('len = ' + str(n))
print(binascii.hexlify(arr))
print(to_hex(arr)) # b'5f0489fffffffffffffffffe80890000000000000000ff8900000000000000ffff'
# for i in range(0, n):
# print(Utils.to_signed_byte(arr[i]))

Expand All @@ -92,7 +95,7 @@

n = len(arr)
print('len = ' + str(n))
print(binascii.hexlify(arr))
print(to_hex(arr)) # b'7e0489fffffffffffffffffe80890000000000000000ff89000000000000010000'
# for i in range(0, n):
# print(Utils.to_signed_byte(arr[i]))

Expand Down

0 comments on commit 65f224b

Please sign in to comment.