chronicled / open-registry-sdk

Apache License 2.0
30 stars 17 forks source link

BigNumber Error when fetching Thing #24

Open DurandA opened 7 years ago

DurandA commented 7 years ago

When running the Consumer example in the README example a BigNumber Error is thrown.

Example snippet:

var Provider = require('open-registry-sdk');
var contracts = {registrarAddress: '0xd76bc6a9eac205734b6fa2f72383db8f0ddecf64', registryAddress: '0x885ef67217954b7fd5d9cd7e79f3aba1599cffe0'};
var sdk = new Provider('http://localhost:8545', 'consumer', null, contracts);

sdk.getThing('ble:1.0:00112233').then(function(thing) {
    console.log(thing);
});

I'm running geth 1.5.9-stable-a07539fb and open-registry-sdk@0.0.36 with node v6.10.1. My node is fully synchronized. I saw some open issues about this with web3.js but usually this is due to a node not synced, which is not the case. I tried with both the ropsten testnet and the main testnet.

Call stack:

BigNumber Error: new BigNumber() not a base 16 number: 
    at raise (/usr/lib/node_modules/open-registry-sdk/build/open-registry-sdk.js:81:351)
    at /usr/lib/node_modules/open-registry-sdk/build/open-registry-sdk.js:81:8066
    at new BigNumber (/usr/lib/node_modules/open-registry-sdk/build/open-registry-sdk.js:80:29002)
    at SolidityTypeDynamicBytes.formatOutputDynamicBytes [as _outputFormatter] (/usr/lib/node_modules/open-registry-sdk/build/open-registry-sdk.js:234:4913)
    at /usr/lib/node_modules/open-registry-sdk/build/open-registry-sdk.js:234:12752
    at SolidityTypeDynamicBytes.SolidityType.decode (/usr/lib/node_modules/open-registry-sdk/build/open-registry-sdk.js:234:12842)
    at /usr/lib/node_modules/open-registry-sdk/build/open-registry-sdk.js:234:754
    at Array.map (native)
    at SolidityCoder.decodeParams (/usr/lib/node_modules/open-registry-sdk/build/open-registry-sdk.js:234:701)
    at SolidityFunction.unpackOutput (/usr/lib/node_modules/open-registry-sdk/build/open-registry-sdk.js:215:16230)
    at Object.callback (/usr/lib/node_modules/open-registry-sdk/build/open-registry-sdk.js:215:16739)
    at /usr/lib/node_modules/open-registry-sdk/build/open-registry-sdk.js:12:31838
    at /usr/lib/node_modules/open-registry-sdk/build/open-registry-sdk.js:216:2030
    at Web3ProviderEngine._inspectResponseForNewBlock (/usr/lib/node_modules/open-registry-sdk/build/open-registry-sdk.js:214:15732)
    at /usr/lib/node_modules/open-registry-sdk/build/open-registry-sdk.js:214:13520
    at /usr/lib/node_modules/open-registry-sdk/build/open-registry-sdk.js:88:304
DurandA commented 7 years ago

It seems that the registryAddress in the example was the contract address created in the old morden testnet. I replaced it with 0xDc3A9Db694BCdd55EBaE4A89B22aC6D12b3F0c24 which I found on the Registry Explorer. Now I get a Unhandled rejection Thing is not existing error when querying against ble:1.0:f0a99e6a93c1 which is because I don't have the registrar address.

What is the address of the chronicled registrar?