As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [polkadot-js]

Questions about the Polakdot JS API used to interact with Substrate based chains via JavaScript.

79 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6 votes
0 answers
33 views

How to connect to Polkadot Relay-Chain through the code of moonbeam parachain?

I want to connect polkadot relay chain but i'm not able to select keys for the customSpec generated by the binary of Moonbeam-Parachain. The customSpec is this-> { "name": &...
Wakar Seraj Khan's user avatar
5 votes
0 answers
105 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
  • 1,856
4 votes
0 answers
110 views

FATAL: Unable to initialize the API: createType(BlockHash):: Expected input with 32 bytes (256 bits), found 64 bytes

I was running parity-bridges-common but the second node explorer is showing this error. Please guide me through this.
Arunjot Singh's user avatar
4 votes
0 answers
134 views

api.call.transactionPaymentApi.queryInfo returns partial fee 0

With the update to the Polkadot-JS api depreciating rpc.payment.queryInfo in favor for api.call.transactionPaymentApi.queryInfo I am currently trying to migrate my code over. However I used to get the ...
cooper jones's user avatar
3 votes
1 answer
17 views

Expose a custom `pub fn` from my pallet to frontend via polkadot.js API

I have a pallet that does some light calculation on one or more storage items (GasReserve and IdleFunds below) or wraps some internal functionality. E.g. impl<T: Config> Pallet<T> { ...
Garandor's user avatar
  • 109
3 votes
1 answer
30 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 on 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
  • 122
3 votes
0 answers
80 views

In-browser signing of payload generated with subxt

I am generating a partial unsigned extrinsic via subxt however cannot figure how to how to sign it using the polkadot.js api. For example: #[subxt::subxt(runtime_metadata_path = "...
myson's user avatar
  • 51
3 votes
0 answers
35 views

Where to add the Custom RPC types in polkadot-js/apps directory?

In the Custom RPC types docs it explains how to create the types within the API promise, but it doesn't explain where to add it within the polkadot-js/apps repo, which is understandable because the ...
Decentration's user avatar
  • 1,176
3 votes
0 answers
20 views

Does callback get called when extrinsic is in block/finalized when the transaction is retracted?

In some cases the transaction I am signing and sending gets retracted, but its my impression that they are usually included in a future block. When using polkadot js with the promise api, if the ...
yornaath's user avatar
3 votes
0 answers
56 views

Polkadot-JS API not reflecting changes on explorer or chain in local development

So i created a simple frame pallet with an extrinsic. I called this extrinsic from the local explorer at 127.0.0.1:9944 and everything worked and events were generated. But calling it from the ...
Woodfish's user avatar
  • 101
3 votes
0 answers
83 views

Custom typegen and using ApiPromise: Property 'unwrap' does not exist on type 'Codec'

It seems there is a mismatch between autocomplete suggestion return types from an ApiPromise instance and the actual returned type. I am using "@polkadot/api": "8.1.1". I am ...
Nepoche's user avatar
  • 73
2 votes
1 answer
45 views

How to troubleshoot synchronisation issues between two nodes in a local Substrate blockchain network using server?

I am trying to set up a local blockchain network using the Substrate framework and two separate servers running on Alice (port 9944) and Bob (port 9944). However, I am encountering an issue where the ...
support's user avatar
  • 61
2 votes
0 answers
25 views

How to create a preimage which is the batch of other preimages?

I am wondering whether, and if so how, it is possible to submit a preimage which batches over other preimages, e.g. const pre1= '0x09401eb25e90bf587fbde8d2a9be8af5ac0f3187f02f4e9e9f1f178b0314ebe5'; ...
William Freudenberger's user avatar
2 votes
1 answer
24 views

How to fix "module group is private" error when using frame-support-procedural-tools v3.0.0?

I'm trying to use orml-tokens in my Substrate project and encountered the following error: error[E0603]: module `group` is private --> /home/kianoush/.cargo/registry/src/github.com-...
Mr Coder's user avatar
  • 491
2 votes
1 answer
29 views

Is there any way to get the validators signatures of the finalized blocks in substrate based chains?

I need the signatures of the validators who have signed on the produced and finalized blocks. For example, In cosmos-SDK based blockchains blocks contains the signatures(and validators addresses) of ...
Aravind Makam's user avatar
2 votes
0 answers
55 views

Fuzzing Polkadot produces Invalid Signature after chaos is injected

I'm using Polkadot version 0.9.37-08b1c09ca46, across 4 Nodes - Alice, Bob, Charlie, Dave, in a local testnet environment. I have a period of network chaos applied, and then moments of stabilized '...
David Searle's user avatar
2 votes
1 answer
2k views

Usage Error: Couldn't find the node_modules state file - running an install might help (findPackageLocation)

Prior to cloning the substrate-front-end-template repo with tag "monthly-2022-02" I installed the following since I was building it from a Dockerfile using pre-built Docker image node:...
Luke Schoen's user avatar
  • 1,856
2 votes
0 answers
43 views

How to call a function from custom pallet using api.tx?

I made a custom pallet and wants to access its method using a extrinsic call like api.tx.<module>.<method> but was not able to do that, do i need to implement it in blockchain code or it ...
Shubham Gupta's user avatar
1 vote
1 answer
28 views

How can I sign and execute transactions using custom origin(20 bytes address) in PolkadotJS

I have a pallet which ensures a particular custom origin of H160(20 bytes). Actually, this pallet is to ensure that the Origin is that of an ethereum address(20 bytes). I am therefore writing ...
dharjeezy's user avatar
  • 359
1 vote
1 answer
22 views

Why doesn't getMetadata show my callable methods as extrinsics in Substrate-node-template

When running Substrate-node-template - basically the Kitties - and with a callable eg create_kitty() as a dispatchableResult in the call pallet, what I assume to be an extrinsic in the metadata, this ...
kim mcclymont's user avatar
1 vote
0 answers
46 views

How can I decode this error message {"ok":{"flags":["Revert"],"data":"0x000110"}}?

I'm using polkadotjs to call my ink! smart contracts and I seem to be having trouble with calls that require parameters. For the call below I am getting the revert flag {"ok":{"flags&...
Jordan Greenberg's user avatar
1 vote
0 answers
30 views

How to calculate claimable rewards from dApp Staking on Astar and Shibuya across multiple eras and multiple dApps?

Hi~ I have some questions about the developer staking process. I am using polkadot-api, developer staking part on shibuya-network. At portal.astar.network, I can see staking info on the dApp Staking ...
지상범's user avatar
1 vote
0 answers
19 views

What's the process to auto-generate `typesBundle.ts` in polkadot-js/apps?

Attempting to test some RPCs in development for a new pallet in Frequency, and trying to get them to show up in the Polkadot-JS UI running locally. I finally hit upon manually adding them to apps-...
Joe Caputo's user avatar
1 vote
1 answer
46 views

How can I represent a polkadotjs type for a custom generic Enum?

I'm uncertain how I can structure the generic variant of a polkadotjs type for an on-chain Enum that looks sort of like this: #[derive(TypeInfo, Debug, Clone, Encode, Decode, PartialEq)] pub enum ...
Justin Frevert's user avatar
1 vote
1 answer
55 views

How to get the payload from a polkadot-js transaction

I'm wondering what are the possible ways to extract the payload from a polkadot-js transaction. So far the only way seems to be to define a custom signer that implements the Signer interface and then ...
Hamid's user avatar
  • 71
1 vote
0 answers
32 views

PolkadotJS system and storage events are not being decoded and shown properly

I found a perhaps similar question here : Polkadot Explorer: decode storage system.events We are running a custom parachain with frontier on a local testnet and while the transactions go through fine,...
Block Importer's user avatar
1 vote
1 answer
26 views

Is there a .into_sub_account_truncating equivalent for Javascript?

In rust I use: .into_sub_account_truncating() Is there a Javascript equivalent?
Decentration's user avatar
  • 1,176
1 vote
2 answers
112 views

Update Runtime sudo transaction exhausted (Substrate)

I am trying to reimplement one of the Substrate tutorials: https://docs.substrate.io/tutorials/get-started/upgrade-a-running-network/ But I am stuck with an issue - where it says to do Scheduler -> ...
Gogosama's user avatar
1 vote
0 answers
21 views

How to show dropdown in PolkadotJS after selecting an item for extrinsic?

First of all I apologise in advance for asking this weird question. I am not sure if this is the right forum. I have a scenario, where I have a data structure and storage like this: #[derive(PartialEq,...
Boleng's user avatar
  • 303
1 vote
0 answers
27 views

Subscribe via json-rpc has no response

I don't get any response from json-rpc subscription. It seems I need a type paramater, but the provider.subscribe() method does not document the type parameter. (I checked the js, java and python code,...
DerekC's user avatar
  • 195
1 vote
0 answers
51 views

Use state call to query from custom Runtime Api, Balance in frontend is not equal to Balance in Runtime

Background Our front end use state call to query custom RuntimeApi of our solo chain. We try to use state call to replace custom rpcs. Definition Balance is our chain is u128. RuntimeApi Definition ...
ironman_ch_parami's user avatar
1 vote
1 answer
27 views

How can I tell which validator is being bonded to for a given bonding extrinsic?

I would like to extract the validator that a given nominator is bonding? Is this possible given the extrinsic or should it be done some other way? Here is my code: const { ApiPromise, WsProvider } = ...
Teo's user avatar
  • 37
1 vote
0 answers
22 views

How did kusama and Polkadot integrated their respective ledger nano app via Polkadot ui?

Polkadot and kusama respectively have integrated their platform with ledger hardware wallet. After reading documentation I came to know that integrating a blockchain with ledger requires a nano app ...
vivek sharmapoudel's user avatar
1 vote
0 answers
2k views

error TS2742: The inferred type of X cannot be named without a reference to

I am building simple SDK for Polkadot Api calls. I am running into following issue trying to build it: error TS2742: The inferred type of 'closeChannel' cannot be named without a reference to '.pnpm/@...
Dudo's user avatar
  • 11
1 vote
1 answer
55 views

Subscribe to all storage

Reading through this: https://polkadot.js.org/docs/api/start/api.query.multi/ It states "It should be trivially extendable to subscribe to the validators, track which one have entered or left&...
Tom's user avatar
  • 11
1 vote
1 answer
39 views

How to get event args values from contracts::contractemitted data?

I am using const decodedEvent = Abi.decodeEvent(Uint8Array.from(Buffer.from("00000064a7b3b6e00d000000000000000000000000000000000000000000000000", 'hex'))) (...
Ayudh's user avatar
  • 111
1 vote
0 answers
70 views

Why is it that the signature created using polkadot api is valid, but verifying that signature using substrate library is invalid?

The js code uses polkadot api, util-crypto and extension-dap const { signature } = await signRaw({ address: account.address, data: payload, type: 'bytes' }); // ...
ivanceras's user avatar
  • 111
1 vote
0 answers
47 views

Get reward amount in polkadot.js/api

I want to get reward for specific address in polkadot.js/api. Especially for kusama. Is polkadot.js providing such api to get reward for specific validator address? also for specific block height?
Heindrick's user avatar
  • 173
1 vote
0 answers
31 views

Can not transfer balance in polkadot.js.org?

I start running development node, and try to test about transfer balance in polkadot.js.org Problem: Make Transfer button only hidden, not show
CocDap's user avatar
  • 496
1 vote
1 answer
523 views

API-WS: disconnected from ws://127.0.0.1:9946: 1006:: Abnormal Closure

I'm trying to connect local node running on my pc using polkadot.js library in react.js(browser). I'm pasting my code in below snippet and error that I'm facing in chrome console Code // **************...
Puneet Jindal's user avatar
1 vote
0 answers
41 views

ChainBridge: how to show transferred amount from ERC20 to Substrate parachain?

after following the tutorial[https://chainbridge.chainsafe.io/local/] of running Chainbridge locally, I can send 1 Substrate Native Token to ERC20 But when I sent 1, 100, 1000000, even ...
Russo's user avatar
  • 1,033
1 vote
0 answers
47 views

Error making .multi subscription call (Kitties Tutorial)

The error I see in the browser console is: VEC: Unable to decode on index 0 createType(Lookup9):: Expected at least 32 bytes (256 bits), found 16 bytes Offending code snippet (from Kitties.js): // ...
Zach's user avatar
  • 11
1 vote
0 answers
38 views

Read Token Contract Information

I would like to read contract information(especially name, symbol, decimal, owner) from token contracts like shown here: https://moonbeam.moonscan.io/token/0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b#...
user2395's user avatar
1 vote
0 answers
18 views

Why after passing more than 24 hours some tips close button on Polkadot js are still grey/disabled?

After a treasury tip receives "half + 1" tips from the councils, It goes to the countdown period. I run api.consts.tips.tipCountdown on Polkadot an get 14,400, which should be in blocks! If ...
Kami's user avatar
  • 447
0 votes
0 answers
3 views

Listen to balance changes wrong after transfer token

I'm facing an issue. I used a query subscription to listen and update the free balance on UI. But I don't know why, when I log free in callback, they always return a balance of receiver and then a ...
Tung Le Xuan's user avatar
0 votes
1 answer
22 views

Frontier template using sr25519 - polkajsapi

I just cloned frontier and modified the code for using H256 address following this These are my changes in runtime/src/lib.rs: pub type Signature = MultiSignature; impl pallet_evm::Config for Runtime ...
Huy Duan Tran's user avatar
0 votes
0 answers
16 views

How to log events on frontend dapp from emit_event of smart contract?

I'm currently struggling on obtaining logs of the events emitted from my smart contract on the frontend dapp. The smart contract code itself should work just fine as it emits the event perfectly fine ...
AppleBox's user avatar
0 votes
0 answers
16 views

Where in PJS Apps are signatures added to transactions & submitted?

I have been following the path of a Ledger submitted transaction on Polkadot JS Apps, and have found that the Ledger device is generating a signature here in hw-ledger/src/bundle.ts. I am unable ...
Ross's user avatar
  • 121
0 votes
1 answer
22 views

How to get history of the native coin total issuance through API - Say DOT

How can one download the history of a native coin total issuance, via an API - Say DOT?
Begley Brothers Inc's user avatar
0 votes
0 answers
26 views

Using the --rpc-cors flag with anything besides 'all' gives rejected connection

I'm trying to use the --rpc-cors flag in a remote VM, behind a ssl enabled nginx proxy. When connecting using the Polkadot UI passing 'all' as parameter, it connects without problem in wss://...
Alexandre Ribeiro's user avatar