Handle bignumber conversions
The kredits module always returns raw data from the contract. For uint values these are bignumbers. To handle those in the ember app we need to convert them to string or to number.
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import computed from 'ember-computed';
|
||||
|
||||
export default function(dependentKey, converterMethod) {
|
||||
return computed(dependentKey, {
|
||||
get () {
|
||||
return this.get(dependentKey)[converterMethod]();
|
||||
},
|
||||
set (key, value) {
|
||||
this.set(dependentKey, value);
|
||||
return value[converterMethod]();
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user