question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Able to create alexander APIRx but not kusama, substratetest in react-native

See original GitHub issue

Can connect and get details for Alexander, hosted by parity and Web3 Foundation

  1. wss://poc3-rpc.polkadot.io/
  2. wss://alex.unfrastructure.io/public/ws
import { ApiRx, WsProvider, ApiPromise } from '@polkadot/api';
 var provider;
 var api;
        try {
            provider = new WsProvider(rpcServer);
            api = await ApiRx.create(provider).toPromise();
        } catch (error) {
            console.log(error);
   }

But the issue is, Fails in following Wsproviders with below error

  1. Kusama wss://kusama-rpc.polkadot.io/
  2. wss://canary-5.kusama.network/
  3. wss://substrate-rpc.parity.io/

console.error: “2019-09-10 13:04:50”, " RPC-CORE:", “getMetadata (block: Hash): Metadata:: U8a: failed on ‘MagicNumber’:: U8a: failed on ‘MetadataEnum’:: Unable to create Enum via index 7, in MetadataV0, MetadataV1, MetadataV2, MetadataV3, MetadataV4, MetadataV5”

console.error 7455fce6-615b-432d-a856-c602438c55d6:72976:24 apply 7455fce6-615b-432d-a856-c602438c55d6:537382:25 Object.error 7455fce6-615b-432d-a856-c602438c55d6:537414:16 call$ 7455fce6-615b-432d-a856-c602438c55d6:536287:21 tryCatch 7455fce6-615b-432d-a856-c602438c55d6:32250:19 Generator.invoke [as _invoke] 7455fce6-615b-432d-a856-c602438c55d6:32425:24 Generator.prototype.<computed> [as next] 7455fce6-615b-432d-a856-c602438c55d6:32293:23 tryCatch 7455fce6-615b-432d-a856-c602438c55d6:32250:19 invoke 7455fce6-615b-432d-a856-c602438c55d6:32326:22

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
turingpavancommented, Sep 10, 2019

Working fine after clean install watchman watch-del-all && rm package-lock.json && rm -rf node_modules && rm -rf $TMPDIR/metro-* && rm -rf $TMPDIR/haste-map-* && NODE_OPTIONS=--max_old_space_size=8192 npm install

But, header.blockNumber is undefined, header.number gives block numbers instead.

import { ApiRx, WsProvider, ApiPromise } from '@polkadot/api';
 var provider;
 var api;
        try {
            provider = new WsProvider(rpcServer);
            api = await ApiRx.create(provider).toPromise();
        } catch (error) {
            console.log(error);
   }
  api.rpc.chain.subscribeNewHeads().subscribe((header) => {
          console.log(`Chain is at #${header.blockNumber}`);
          console.log(`Chain is at #${header.number}`);
          console.log(`Chain is at #${header}`);
        });

header = {“parentHash”:“0xecf52f1796f9f3b50bc92691967ebd6c0d29f07c8aaf17bb6c0fea9a5ee1bb13”,“number”:259454,“stateRoot”:“0x3f9e149a64f9531aebd2ce66366c8489ab192d3f45c1e0b2b6d733693746b551”,“extrinsicsRoot”:“0x5a2cb032e3f3ac5af7747e66d6abeda0e70b2dfa5f41067eba1a886501198e39”,“digest”:{“logs”:[“0x064241424544010300000085f2930f0000000067f60000”,“0x05424142450101e67bd36607f4ac701db9775f618c159544f589a88d6d7b2d74ba39d0c688b30d452b0c4299ece78df1a58ac472922673d0951b8dd796c85785b4b2b90b7b1881”]}}

0reactions
polkadot-js-botcommented, Jun 5, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Substrate blockchain application with a custom React frontend
Build a custom frontend in React for a Substrate backend. Substrate's approach to the blockchain is powerful to help developers get started.
Read more >
Newest 'polkadot-js' Questions - Stack Overflow
I implemented the sample code according to the polkadot.js official site in the link below. Running and testing with "yarn dev" command works...
Read more >
Let's build a CRYPTO Price Tracker with React Native (p.2)
Follow along and build a real Crypto Price Tracker App in React Native. This step-by-step tutorial is a great starting point for developers ......
Read more >
@polkadot/types: Versions | Openbase
Update to latest Polkadot, Kusama & Substrate metadata ... For users of asm.js, e.g. React Native, there are some additional upgrade instructions in...
Read more >
Is React Native the Best Framework for Cross Platform Mobile ...
Using React Native, web developers are able to create user interfaces and write multiple lines of code in JavaScript and build mobile ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found