You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let defaultProvider = ethers.getDefaultProvider('ropsten');
but has an error when trying to use a 'new' object re:
let etherscanProvider = new ethers.providers.EtherscanProvider('ropsten');
which is the following:
I/System.out(17764): providerSetupFunction :: function EtherscanProvider(network, apiKey) {
I/System.out(17764): var _this = _super.call(this, network) || this;
I/System.out(17764): errors.checkNew(_this, EtherscanProvider);
I/System.out(17764): var name = 'invalid';
I/System.out(17764): if (_this.network) {
I/System.out(17764): name = _this.network.name;
I/System.out(17764): }
I/System.out(17764): var baseUrl = null;
I/System.out(17764): switch (name) {
I/System.out(17764): case 'homestead':
I/System.out(17764): baseUrl = 'https://api.etherscan.io';
I/System.out(17764): break;
I/System.out(17764): case 'ropsten':
I/System.out(17764): baseUrl = 'https://api-ropsten.etherscan.io';
I/System.out(17764): break;
I/System.out(17764): case 'rinkeby':
I/System.out(17764): baseUrl = 'https://api-rinkeby.etherscan.io';
I/System.out(17764): break;
I/System.out(17764): case 'kovan':
I/System.out(17764): baseUrl = 'https://api-kovan.etherscan.io';
I/System.out(17764): break;
I/System.out(17764): case 'goerli':
I/System.out(17764): baseUrl = 'https://api-goerli.etherscan.io';
I/System.out(17764): break;
I/System.out(17764): default:
I/System.out(17764): throw new Error('unsupported network');
I/System.out(17764): }
I/System.out(17764): properties_1.defineReadOnly(_this, 'baseUrl', baseUrl);
I/System.out(17764): properties_1.defineReadOnly(_this, 'apiKey', apiKey);
I/System.out(17764): return _this;
I/System.out(17764): }
E/AndroidRuntime(17764): FATAL EXCEPTION: Thread-3
E/AndroidRuntime(17764): Process: com.shyftnetwork.wx, PID: 17764
E/AndroidRuntime(17764): TypeError: Object.defineProperty called on non-object
E/AndroidRuntime(17764): at org.liquidplayer.javascript.JSFunction.apply(JSFunction.java:416)
E/AndroidRuntime(17764): at org.liquidplayer.javascript.JSFunction.call(JSFunction.java:377)
further, re:
let defaultProvider = ethers.getDefaultProvider('ropsten');
Getting that (which does work) and then calling a function on one of its members, I'm getting the following error when using "getProviderBlockNumber" (which should return a promise object, though it crashes before returning the object):
I/System.out(14807): myProviderObjectFunction ::function () {
I/System.out(14807): var _this = this;
I/System.out(14807): return this.ready.then(function () {
I/System.out(14807): return _this.perform('getBlockNumber', {}).then(function (result) {
I/System.out(14807): var value = parseInt(result);
I/System.out(14807): if (value != result) {
I/System.out(14807): throw new Error('invalid response - getBlockNumber');
I/System.out(14807): }
I/System.out(14807): _this._setFastBlockNumber(value);
I/System.out(14807): return value;
I/System.out(14807): });
I/System.out(14807): });
I/System.out(14807): }
E/AndroidRuntime(14807): FATAL EXCEPTION: Thread-3
E/AndroidRuntime(14807): Process: com.shyftnetwork.wx, PID: 14807
E/AndroidRuntime(14807): TypeError: Cannot read property 'ready' of null
E/AndroidRuntime(14807): at org.liquidplayer.javascript.JSFunction.apply(JSFunction.java:416)
E/AndroidRuntime(14807): at org.liquidplayer.javascript.JSFunction.call(JSFunction.java:377)
If you could point me to a framework example which work in this case, that would be excellent.
q1) Why would getting a JSObject of the type "new" have internal issues referencing itself?
q2) How do I get a promise object returned without it crashing inside of the function call?
I'm assuming these issues are directly related?
Thanks for your help, I'd vastly prefer understanding how your microservices work and then extending the same mechanisms in the IOS realm rather than patching together different implementations on various platforms.
Fyi:
I'm using the format:
var service = MicroService(this@MainActivity, uri, startListener)
where in the service object I'm starting a new Thread inside of the onStart function, and then running the code that results in the errors referenced above inside of the "run" of the Runnable (which I'm assuming maintains the object references to the various JSObjects, as I thought that may have been the issue with the "new" objects)
The text was updated successfully, but these errors were encountered:
@chris-shyft This is unlikely related to promises and async per se. I have, in fact, tried to get Ethereum to work correctly with LiquidCore on a few past occasions with some success. The problem is typically related to the bundling process. Metro is not very smart when it comes to cyclic dependencies (e.g. file1.js has const file2 = require('./file2') and file2.js has const file2 = require('./file1')). I have tried to fix as many of these as possible in liquidcore-cli (see comment here), but I have had to manually edit the bundled file from time to time because I just couldn't fully bend Metro to my will.
I am in the process of updating liquidcore-cli to work with the newest version of Metro and LiquidCore 0.7.0. I will use Ethereum as a test case and update this issue when I have news to share.
Please try the latest version of LiquidCore (0.7.5+) and see if this is still a problem. IPFS seems to work ok, which uses ethereum. Please re-open if there is still a problem.
Re: issue 64
This is the code I am using (https://docs.ethers.io/ethers.js/html/api-providers.html#connecting-to-ethereum for reference) is able to get a reference to:
but has an error when trying to use a 'new' object re:
which is the following:
further, re:
Getting that (which does work) and then calling a function on one of its members, I'm getting the following error when using "getProviderBlockNumber" (which should return a promise object, though it crashes before returning the object):
If you could point me to a framework example which work in this case, that would be excellent.
q1) Why would getting a JSObject of the type "new" have internal issues referencing itself?
q2) How do I get a promise object returned without it crashing inside of the function call?
I'm assuming these issues are directly related?
Thanks for your help, I'd vastly prefer understanding how your microservices work and then extending the same mechanisms in the IOS realm rather than patching together different implementations on various platforms.
Fyi:
I'm using the format:
where in the service object I'm starting a new Thread inside of the onStart function, and then running the code that results in the errors referenced above inside of the "run" of the Runnable (which I'm assuming maintains the object references to the various JSObjects, as I thought that may have been the issue with the "new" objects)
The text was updated successfully, but these errors were encountered: