There appears to be a gap with some of the function wrapping implementations. Currently any Bifrost2 function needs to account for wrapped objects being passed to them before calling the underlying function. With some of the manually wrapped functions this is missing. This means users need to access the underlying JS proxy object.
job.exec is an example of a function currently missing the unwrapping logic
dcp.init()
id = dcp.wallet.get("id")
dcp.identity.set(id)
pay = dcp.wallet.get("default")
input_set = [1,2,3]
def work_function(number):
dcp.progress()
return number
job = dcp.compute_for(input_set, work_function)
job.exec(dcp.compute.marketValue().js_ref, pay.js_ref) // ERRORS without .js_ref
results = job.wait()
The fix can probably be simple like an unwrapping function which can be called at the start of each manually wrapped function. There probably needs to be extra logic for nested items (arrays, dictionaries, etc)
def unwrap_args(*args):
for i, arg in enumerate(args):
if hasattr(args[i], 'js_ref'):
args[i] = args[i].js_ref
return args;
There appears to be a gap with some of the function wrapping implementations. Currently any Bifrost2 function needs to account for wrapped objects being passed to them before calling the underlying function. With some of the manually wrapped functions this is missing. This means users need to access the underlying JS proxy object.
job.exec is an example of a function currently missing the unwrapping logic
The fix can probably be simple like an unwrapping function which can be called at the start of each manually wrapped function. There probably needs to be extra logic for nested items (arrays, dictionaries, etc)