Skip to main content

Questions tagged [polkadot-js]

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

111 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
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
1 answer
47 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
0 answers
48 views

Polkadot JS units for currency

I am implementing a pallet which interacts with pallet_balances via Currency trait. For some reason, when I call any operation on currency trait (like Slash on screen below), it is not aligned to ...
Klapeyron's user avatar
  • 136
4 votes
1 answer
133 views

Creating SignerPayload for PolkadotJS Extenstion: Unsupported extrinsic payload version 0

I am trying to create a SignerPayloadJSON from an encoded partial extrinsic in polkadotjs. The partial extrinsic has the following hex representation ...
Tadeo's user avatar
  • 61
4 votes
1 answer
44 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
4 votes
1 answer
65 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
4 votes
0 answers
177 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
65 views

Subsrate Node Build error: cannot find macro `thread_local` in this scope

Whole error: error: cannot find macro `thread_local` in this scope --> /home/hardeep/.cargo/git/checkouts/substrate-7e08433d4c370a21/948fbd2/primitives/externalities/src/scope_limited.rs:22:1 ...
Gurtej Singh's user avatar
3 votes
0 answers
90 views

Polkadot JS API: Is is possible to define a custom runtime API?

Polkadot JS Api is aware of a lot of common runtime apis in the Substrate ecosystem. The docs contain a complete list of supported runtime apis. One that is missing is the PoW Difficulty API. Because ...
JoshOrndorff's user avatar
  • 1,191
3 votes
0 answers
37 views

How to compare current date with a stored date in a Substrate blockchain module?

I'm working with a Substrate blockchain and have a structure with a field named end_date. I'd like to check if the current date is greater than end_date within a Substrate runtime module, but I'm ...
Mr Coder's user avatar
  • 923
3 votes
0 answers
45 views

How to get runtime types in polkadotjs (typescript)

In subxt we can have Rust types directly from scale-encoded runtime metadata. Is the same possible in polkadotjs? Is there a "polkadots" which has typescript types automatically derived from ...
Hugo Trentesaux's user avatar
3 votes
1 answer
71 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
  • 419
3 votes
0 answers
69 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 ...
Ramsey - Decentration's user avatar
3 votes
0 answers
71 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
  • 121
3 votes
0 answers
95 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
  • 83
2 votes
0 answers
34 views

how can we add external links on the proposal?

I have created a custom chain using Substrate version 0.9.36, and I've been using the governance module. When adding a proposal, there's a default column for external links set to "none." I ...
Gagandeep Dogra ATR594's user avatar
2 votes
1 answer
60 views

How to Calculate the Total Tokens Rewarded to a Nominator?

I'm trying to figure out how to accurately determine the total amount of token rewards received by a nominator in the network. Specifically, I'm interested in the following: The Total Rewards in ...
Pavan Soratur's user avatar
2 votes
1 answer
82 views

Asymmetric Encryption

We are building a substrate blockchain backed by polkadot js. While working on a task I have a requirement of public/private key encryption and decryption. for ex: Sender's Actions: The sender obtains ...
Faiz Sarwar's user avatar
2 votes
0 answers
35 views

How to use staking proxy signing the proxied stash's unbond action?

You know the controller account is deprecating, and the proxy account function is introduced. I set up a proxy with my validator, but I can't nominate(or other staking functions) if I only have the ...
Purson Chan's user avatar
2 votes
0 answers
46 views

Someone suggest me some resources of NFT Pallet frontend react implementation?

I am using nft-pallet for nft creation. I have implemented in substrate node. Now I wan't to write my own code not polkadotjs to create with nft using nft pallet using react frontend. Someone please ...
Ganesh11's user avatar
  • 1,241
2 votes
1 answer
108 views

How to get the current session keys used by an active validator?

There are api.query.session.nextKeys and api.query.session.queuedKeys for obtaining the next session keys for a validator (doc). But how do I query the current the session keys used by an active ...
btwiuse's user avatar
  • 291
2 votes
1 answer
48 views

How to Recover Address from MasterPrivateKey in JS

I trying to make Signature using Polkadot.js without mnemonic in LedgerAddress. import { hdLedger } from "@polkadot/util-crypto"; import { u8aToHex } from "@polkadot/util"; import ...
Albert's user avatar
  • 21
2 votes
1 answer
152 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
2 votes
0 answers
59 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
138 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
  • 923
2 votes
0 answers
83 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
0 answers
51 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,...
b0zero's user avatar
  • 533
2 votes
1 answer
59 views

Is there a .into_sub_account_truncating equivalent for Javascript?

In rust I use: .into_sub_account_truncating() Is there a Javascript equivalent?
Ramsey - Decentration's user avatar
2 votes
1 answer
6k 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
  • 2,332
1 vote
1 answer
29 views

Initiating a multisig tx from javascript

How can a multisig transaction be initiated, validated and completed, all using polkadotjs from javascript code? The info I have currently is : https://wiki.polkadot.network/docs/learn-guides-...
ytresza's user avatar
  • 63
1 vote
0 answers
14 views

Light Client (Smoldot) Connecting But Unable To Send Transactions

Implementing smoldot (substrate-connect) on a fork of the polkadot-JS. Connecting to a light node boot node works most of the time, but is intermittent. When we are able to connect via light client, ...
KathrynColleen's user avatar
1 vote
0 answers
9 views

GOV1 referendum voting giving error on 0.1x voting balance

I was making a small service for calling the aye and nye and it is not working for 0.1x voting balance but working fine for every other option it is giving error propsExtrinsic.signAndSend is not a ...
Shubham Gupta's user avatar
1 vote
0 answers
29 views

Facing problem in fetching all Preimages using rpc

At certain time, it shows this error.
Shiv Kumar ATR646's user avatar
1 vote
0 answers
46 views

How to decode contract storage returned data

How do i decode this Hex string to String. It is storage data returned from a contract, using Polkadot-JS. { Ok: { flags: [], data: '...
Woodfish's user avatar
  • 121
1 vote
2 answers
77 views

FATAL: Unable to initialize the API: disconnected from wss://1rpc.io/dot: 1006:: Abnormal Closure

I am trying to access my polkadot.js wallet, but keep recieving this messagge:FATAL: Unable to initialize the API: disconnected from wss://1rpc.io/dot: 1006:: Abnormal Closure I cannot connect wallet ...
Miguel's user avatar
  • 11
1 vote
0 answers
40 views

How To Find The Slash Index?

My question is: When there is a deferred slash waiting to be applied, how do you find the INDEX for that slash? The council can propose a motion to cancel the deferred slash. That form requires the ...
KathrynColleen's user avatar
1 vote
0 answers
35 views

Signed Extension validate len parameter

How is the len parameter of the Signed Extension validation function computed? I tried computing the length with PolkadotJS by getting the length of the encoded call but that does not seem to be the ...
Yatusabes's user avatar
  • 766
1 vote
0 answers
29 views

Substrate enum to typescript(polkadot-js)

I am new to Substrate and Polkadot-JS. I am attempting to convert this enum with values to TypeScript, but I haven't been successful so far. I really appreciate any help you can provide. pub enum ...
Uncle_Sam's user avatar
1 vote
0 answers
53 views

BestWay The Restart Substrate Node

After adding the validator node, it may encounter issues preventing it from creating blocks and initiating the next era in the blockchain. in this case,is there a way to restart the network? keep the ...
user4676's user avatar
1 vote
0 answers
71 views

My implementation wont let me batch more than 4 transfer calls

My implementation wont let me batch more than 4 transfers. Am I doing something wrong? I know the code is a bit complex because its normally not in one func but i has to be in this way. I am suprised ...
Jozzy's user avatar
  • 33
1 vote
1 answer
164 views

Error: createType(ExtrinsicSignature):: Unable to create Enum via index 108, in Ed25519, Sr25519, Ecdsa

I'm trying to use the Polkadot CLI to create an unsigned extrinsic, which I subsequently generate a signature for sign out of band using my custody provider. The Polkadot CLI has a useful tool for ...
Roger's user avatar
  • 11
1 vote
0 answers
124 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
23 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
123 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
  • 101
1 vote
0 answers
62 views

@polkadot/typegen is generating erroneous code

We are using @polkadot/typegen for TypeScript user generated code for Chain modules script. We are getting errors as code generated includes many new types taken from chain but they are not imported.
Nikhil Ranjan's user avatar
1 vote
1 answer
25 views

Would it be possible to render existing values in update form in Polkadot JS UI

I am not sure if this is the right forum to ask question related to PolkadotJS UI. Is there any way to render existing value in the extrinsic fields? I have an extrinsic to update values in a storage. ...
Boleng's user avatar
  • 497
1 vote
0 answers
24 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
  • 497
1 vote
1 answer
46 views

Use polkadot-v0.9.33 or hight verison bianry launch local parachain onborading fails

Using the ts code to call the parasSudoWrapper.sudoScheduleParaInitialize interface to register the parachain locally, the parachain has not produced blocks.. It is only a parathread found in the ...
Chengcheng Shi's user avatar
1 vote
0 answers
17 views

UnsubscribePromise not being returned from subscription

When I try to create a subscription from a custom pallet, it doesn't return a UnsubscribePromise (like the native ones), but returns a Promise<Codec>, even though I added a callback as the last ...
Pedro Filho's user avatar