Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion dcp/js/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ def isclass(ref):
# if a js object prototype has more than one own property, it is a class
proto_own_prop_names = pm.eval(
'x=>(x?.prototype ? Object.getOwnPropertyNames(x?.prototype) : [])')
return len(proto_own_prop_names(ref)) > 1
# @TODO: what if instead of coming up with a better way, I just made it more cursed?
is_es6_class = pm.eval('x => /^class/.test(Function.prototype.toString.call(x))')
Comment thread
YarnSaw marked this conversation as resolved.
Outdated
return len(proto_own_prop_names(ref)) > 1 or is_es6_class(ref)


def class_name(JSClass):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_api/test_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class TestWallet(unittest.TestCase):

def test_smoke_keystore_address(self):
ks = dcp.wallet.get()
self.assertTrue(isinstance(ks, dcp.wallet.Keystore))
self.assertTrue(pm.eval("(x)=> x instanceof dcp.wallet.BankAccountKeystore")(ks.js_ref))
Comment thread
wiwichips marked this conversation as resolved.
Outdated

address = ks.address
self.assertTrue(isinstance(address, dcp.wallet.Address))
Expand Down
Loading