Skip to main content

Questions tagged [polkadot-js]

Questions about the Polkadot-JS API used to interact with Substrate-based chains using JavaScript.

Filter by
Sorted by
Tagged with
12 votes
1 answer
312 views

PolkadotJS how to properly setup api for custom RPC invocation

I'm playing around with custom RPC endpoints exposed from my substrate node, but I'm encountering an issue when trying to call it with polkadotjs. Initially, my endpoint only accepted a single ...
Tony's user avatar
  • 527
9 votes
1 answer
529 views

How to get the balance of an account at a particular nonce using Polkadot.js API

I want get the balance of an account address at a particular nonce. I only know how to get the latest balance of an account address and its latest nonce (total number of transactions sent from that ...
Lee's user avatar
  • 111
9 votes
1 answer
122 views

How to add parachain logo to polkadot.js.org/apps?

How to add parachain logo to left side menu polkadot.js.org ?
Alex's user avatar
  • 304
9 votes
1 answer
161 views

What are type bundles and versioned metadata?

I was exploring typegen for my node's custom types and came across these two concepts in the acala.js codebase in the type-definitions package (their use of a "types-bundle.json"), and ...
islami00's user avatar
  • 561
9 votes
1 answer
127 views

Can an account's transactions be front-run on Polkadot? If so, how?

Is it possible to reliably monitor an account and receive information about a transaction of that account before the transaction is InBlock and then front-run that transaction by issuing a ...
mkl's user avatar
  • 432
9 votes
1 answer
74 views

Incorrect display name for smart contracts numeric return types

When I deploy an ERC20 on Polkadot JS Apps, i can see that the return type of total_supply is u128, however according to the contract metadata it should display Balance. Noticed also for ERC1155 ...
Andreea Eftene's user avatar
8 votes
1 answer
150 views

How to setup and RPC call that accepts a u128 input?

I cannot seem to setup a RPC call that accepts a u128 param. I can input the following let u128Input = new BN("10") let output = await api.rpc.template.testRpc(u128Input); but get an error ...
drbh's user avatar
  • 83
8 votes
1 answer
398 views

How to estimate gas for ink contracts transactions for Weights V2?

For ink contracts with weight v2 it requires refTime and proofSize. For this we are first querying(dry run) the transaction method, getting gasRequired from query result and sending it to transaction. ...
Nikhil Ranjan's user avatar
7 votes
2 answers
420 views

How to decode ink smart contract call and event data?

I want to decode the contract call data and event data saved in a block. How can I do that?
Minh Mốc's user avatar
  • 1,009
7 votes
1 answer
100 views

How to accurately add extrinsic balance transfer values

Is there a simpler way to add balance transfer values without converting them to BN or Unit value first? For example, say I want to add "0x00000000000000001bc16d674ec80000", "...
John Otu's user avatar
  • 385
7 votes
1 answer
213 views

How do I verify a signature signed using Polkadot.js app with rust code

I am trying to write a discord bot using rust/serenity to verify signature signed using polkadot.js app. I use schnorrkel crate, wrap the message in <Bytes>...</Bytes> and use the verify ...
Ankan's user avatar
  • 335
7 votes
1 answer
216 views

Babel loader issues with polkadotjs and create-react-app

We're working to update our dApp to node 16 and update the dev config to point to the latest polkadot dev config. We are using customize-cra to customize the babel loaders which looks partially as: ...
Drew Stone's user avatar
  • 1,194
6 votes
3 answers
541 views

How to convert Public key (hex) to SS58 Address in JavaScript / Polkadot-JS?

I have a Public key (hex) and would like to convert it to an SS58 Address. What is the right function to use? I found the docs here with an code-sniped: https://substrate-developer-hub.github.io/docs/...
SiAlDev's user avatar
  • 91
6 votes
3 answers
151 views

How to track token issuance

How would I track the token issuance of a parachain, using either the polkadot api or on-chain data? Does anyone have a simple example?
Roger J Bos CFA's user avatar
6 votes
1 answer
206 views

PolkadotJS ALICE address differs

When I try to derive the Alice account with PolkadotJS I somehow end up with a different address than in the docs. Here is the code: const keyring = new (require('@polkadot/keyring').Keyring)(); let ...
Oliver Tale-Yazdi's user avatar
6 votes
2 answers
369 views

What format is the block timestamp?

I'm using @polkadot-js to decode extrinsic data. The following method call returns a timestamp at a specific block, but I don't know how to parse this. I tried assuming that it's a unix timestamp in ...
mango's user avatar
  • 163
6 votes
1 answer
68 views

Substrate connect & JS API

This question came to the forefront after reading the question about the connect extension and the usage thereof on live networks. From the comments it is apparent that I can use the JS API to connect ...
Barto's user avatar
  • 584
6 votes
1 answer
86 views

types bundle for kusama

While fetching blocks from kusama, I get the following message in the block range [1, 461692]: Unable to map u16 to a lookup index I suppose this has to do with the types being used in the old blocks....
Naveen's user avatar
  • 273
6 votes
2 answers
352 views

How to make runtime api available from polkadot js

I declared runtime api, implemented it in runtime, but i can't call my runtime api from polkadot.js. What i need to do to be able to call it? Declaration: sp_api::decl_runtime_apis! { pub trait ...
artem's user avatar
  • 61
6 votes
1 answer
546 views

How do we import a self-signed certificate for the Polkadot-JS electron app or AppImage?

According to https://wiki.polkadot.network/docs/maintain-wss#importing-the-certificate One can visit the cloud instance on https and download the certificate and then proceed to connect to a websocket ...
Purple_Turtle's user avatar
6 votes
2 answers
292 views

What's a convenient way to look up a `DispatchError` in polkadot-js?

A DispatchError will refer to a pallet and a member of the pallet's Error enum by index: DispatchError: {"module":{"index":123,"error":456}} It's tiresome and error-...
mkl's user avatar
  • 432
6 votes
2 answers
119 views

How to query chainspec with @polkadot/api

In the documentation getChainProperties(https://polkadot.js.org/docs/api/examples/promise/chain-info/) is mentioned for getting the properties for a blockchain, but it contains very little amount of ...
Szegoo's user avatar
  • 657
6 votes
1 answer
262 views

Moonbeam Parachain staking

I have added parachain staking and moonbeam-orbiters of moonbeam in our project. When I test it, all the extrinsics are performing well except the staking part. I have gone through this https://docs....
Deepak Chaudhary's user avatar
6 votes
0 answers
74 views

Decompose complex types in JS

My overall goal is to build a generic extrinsic builder, just like the extrinsic tab from polkadot-js/apps. This code is very old and very hard to decipher unfortunately and I couldn't find any doc ...
Tbaut's user avatar
  • 253
6 votes
0 answers
225 views

How to use the default Substrate CLI rpc-cors values without using rpc-cors=all for a Collator node and connect from Polkadot.js Apps

I want to be able to connect a collator node using https://polkadot.js.org/apps that is based on the substrate-parachain-template using branch 'polkadot-v0.9.18' and is being run as a parachain in ...
Luke Schoen's user avatar
  • 2,332
5 votes
2 answers
371 views

How to find how many transactions are pending from address to be added to block?

In my application, I need to fire multiple transactions from same address, and want to create statusCheck() function, which will let me know how many transactions of total are still pending to be ...
pravin k's user avatar
  • 111
5 votes
2 answers
849 views

How to decode extrinsic at json-RPC call's data(byte code)

I call json-RPC through the terminal and get the data as below. extrinsics is raw byte, but I'm using polkadot-js(SCALE codec?) to decode it. But I don't know which method to call. "block": ...
PaperFrog's user avatar
  • 495
5 votes
2 answers
206 views

Polkadot.js and Ledger device compatibility

I linked a new Ledger to the Polkadot.js wallet and transferred some refunded DOT tokens into this wallet. But when I opened up my Ledger Live again, the DOT account is showing a 0 balance. Then I ...
Stardust's user avatar
5 votes
1 answer
131 views

How to upload contract using a custom made frontend?

I am making a new UI for substrate based blockchain, and found the code here to upload a Smart Contract. The code allows you to either upload metadata.json && cont.wasm files or a cont....
Divyam Garg's user avatar
5 votes
1 answer
1k views

Custom RPCs not decorated

I added some custom RPC endpoints to a substrate blockchain, but when I connect to the node with a simple script it prints: API/INIT: RPC methods not decorated: ... The RPCs work, but don't show up ...
weichweich's user avatar
5 votes
1 answer
29 views

Using a JS Proxy around ApiPromise

I would like to use a standard JS Proxy around ApiPromise, basically to add my own fields to the object without having to extend it. I have some issues doing the following: const proxied = new Proxy( ...
Xiu Hung's user avatar
  • 527
5 votes
1 answer
107 views

Two-way JS serlialise between hex and extrinsic object

I know that all the objects in the JS API has the toHex() function, so that would answer the first bit of my question - how to serialize when I have an extrinsic from getBlock(). However where I'm ...
Barto's user avatar
  • 584
5 votes
1 answer
155 views

How do I connect substrate frontend with backend on Digital Ocean?

I've launched several substrate nodes in several clouds, one of which is Digital Ocean. The telemetry at telemetry.polkadot.io works just fine, it shows all the nodes and block generated in the real-...
Ilya Tegmark's user avatar
5 votes
2 answers
165 views

How to prevent Polkadot{.js} extension from injecting all addresses into the site's JavaScript context

By default the Polkadot{.js} extension injects all addresses that have been imported into the browser wallet when a connection is requested by a website. In comparison, the Metamask extension on ...
Dcompoze's user avatar
  • 620
5 votes
2 answers
351 views

Sudo option is missing

I just clone the Polkadot repo v0.9.20 and build. When I run the chain sudo option is not showing in developer section. Running chain on 127.0.0.1:9944. Can anyone please tell why this thing happen? ...
Deepak Chaudhary's user avatar
5 votes
2 answers
113 views

Why can't I decode an extrinsic created with the contracts tab in Polkadot JS apps?

I am running the substrate-contracts-node and using the contracts UI to interact with it in Polkadot JS Apps. The contract call is failing when I try using the UI, although the same call works from a ...
extraymond's user avatar
5 votes
1 answer
161 views

When is a transaction `retracted`?

PolkadotJS offers a status indication for a transaction receipt that is called isRetracted. What does it mean and when does it occur?
Oliver Tale-Yazdi's user avatar
5 votes
2 answers
161 views

Show custom RPCs/RuntimeAPIs in PolkadotJS UI

At the moment I try to figure out why PolkadotJS UI (https://polkadot.js.org/) is not able to show my custom RPC endpoints or runtime APIs. They are available in general and also available in the list ...
Janislav's user avatar
  • 319
5 votes
2 answers
197 views

How to use Polkadot.js API for governance proxy call correctly?

I am trying to create a JS code to be able to vote using proxy account that has been given democracy permissions to stash account, so I would be able to vote using just my mobile phone instead of ...
hitchhooker's user avatar
5 votes
1 answer
84 views

What is the Incomplete Execution error on parachain upgrade?

I have been upgrading my parachain many times over the last few days with no issue at all. I have been using Polkadotjs Apps for this also running on my local machine. My process is that I use the ...
T9b's user avatar
  • 466
5 votes
1 answer
208 views

Best way to configure Webpack4 and @polkadot dependencies in a webworker?

I am in the process of updating a react-app from polkadot.js api: 6.9.2 -> 7.12.1. Following some advice in the docs: https://polkadot.js.org/docs/usage/FAQ/, I updated my customize-cra application ...
Nepoche's user avatar
  • 83
5 votes
2 answers
221 views

How to enable units for currencies in polkadot-js

Currently, polkadot-js doesn't allow me to select a unit when specifying balances in the Developer > Extrinsics section, which means that all balances must be specified in the smallest unit (10^12 ...
mkl's user avatar
  • 432
5 votes
2 answers
241 views

What is the best way to batch ~20 000 calls to a chain?

What should I choose between these two options: utility.batch() I can batch multiple calls into one call, so it avoids making too many calls, but I'm afraid this will exceed the size of the block if ...
Nathan's user avatar
  • 454
5 votes
1 answer
514 views

How to format balance?

I tried using @polkadot/util's formatBalance function to get the formatted balance of the account. But it doesn't make sense. I believe unit conversion is not working properly and I wonder what I am ...
Burak's user avatar
  • 903
5 votes
1 answer
80 views

How to create pallet errors for sudo that show up on the Polkadot JS apps interface?

Repost from stackoverflow: So I've been at my wits' end for quite some time regarding #[pallet::error] showing up on Polkadot JS apps interface when calling a fallible function from sudo. So as I've ...
Purple_Turtle's user avatar
5 votes
1 answer
162 views

PolkadotJS Apps shows wrong AccountId20 on Frontier Template Node

Frontier recently received support for Moonbeam's AccountId20: https://github.com/paritytech/frontier/pull/1019 So now I'm trying to use this new feature on PolkadotJS Apps. I'm running a Frontier ...
Bernardo Rodrigues's user avatar
5 votes
1 answer
46 views

How do I get the currently logged address in front end template?

What I´m trying to do is to condition some option/modal to be shown in the screen depending on the logged user/account being the owner or not so to have something similar to: accountPair.address === ...
Xavier's user avatar
  • 415
5 votes
1 answer
58 views

How to access Polkadot/Kusama runtime types from polkadot.js api to work with the transactions arguments

With subxt is straight-forward as you can access the types by generating them using metadata and use them in your fn arguments but in polkadot.js is kinda not straight forward as where and how the ...
Mrisho Lukamba's user avatar
5 votes
1 answer
48 views

How to use @polkadot/react-components? version issue

I have tried to use @polkadot/react-componentsin React project Here, AddressInfo component component is from @polkadot/react-components When I try to use this component, I got this issue I'd really ...
Christian Ramos's user avatar
4 votes
2 answers
146 views

How to load account address from polkadot extension?

I have following code so far. import { useSubstrateState } from './../substrate-lib' import { web3FromSource } from '@polkadot/extension-dapp' const { api, currentAccount } = useSubstrateState() ...
Amiya Behera's user avatar

1
2 3 4 5
12