Questions tagged [polkadot-js]
Questions about the Polkadot-JS API used to interact with Substrate-based chains using JavaScript.
538
questions
0
votes
0
answers
34
views
Getting Mnemonic/Seed Phrase from JSON backups
I have a password-protected digital backup of an account using the JSON file from the Polkadot.JS extension.
How do I get the mnemonic/seed phrase from this file so that I can back it up on paper? ...
0
votes
1
answer
24
views
What is the signing context chosen by PolkadotJS API?
In the verification of a schnorrkel sr25519 signature, there is a signing context which takes an arbitrary string/bytes.
What is the signing context used in the PolkadotJS Extension?
Is it something ...
1
vote
1
answer
67
views
jsonrpc method `payment_queryInfo` is being deprecated
I saw this polkadot API document: https://polkadot.js.org/docs/substrate/rpc/#payment
and it mentioned that the payment_queryInfo is deprecated and should use api.call.transactionPaymentApi.queryInfo ...
1
vote
0
answers
11
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 ...
0
votes
0
answers
7
views
Kusama 1.2 - How to associate stash accounts with host via RPC/JS/shell
this key previously worked with Kusama until the recent metadata update (with beefy key)
const keys = await api.query.session.nextKeys(address.address);
const keysHex = keys.toHex();
const result = ...
0
votes
1
answer
35
views
How to parse a raw signature from PolkadotJS in Substrate runtime
The Polkadot claims pallet verifies and extracts an ethereum address from an EcdsaSignature. Is there a similar implementation for doing this with an Sr25519Signature signed by a wallet using ...
0
votes
1
answer
30
views
Limit and Offset for for storage entries and keys
Following the docs for polkadot js storage we are getting entries and keys from the chain. Is there a way to use limit and offset to implement paging. Any ideas?
2
votes
0
answers
15
views
when will `‘Balances::transfer' will be removed` take into effect on main-net?
In this link Balances::transfer will be removed it say 'transfer' is deprecated.
I have experienced this change on test-net and fixed my Dapp after got failure report.
But when does it take into ...
2
votes
1
answer
27
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 ...
1
vote
1
answer
40
views
Generated Types Not Found
Hi we are following along with the typegen docs on polkadotjs documentation.
and the generated code cannot find most the types.
an example line:
Called: AugmentedEvent<ApiType, [caller: ...
1
vote
1
answer
18
views
Extrinsic with BalanceOf<T> and UI
Many Substrate pallets extrinsics take a Balance type, for example balances->transfer or bounties->create.
The Polkadot/substrate Development UI somehow detects that it is a Token related field ...
1
vote
1
answer
49
views
Decoupled composition, signing, and publishing with @polkadot/api [duplicate]
I'm building an application whose architecture decouples transaction composition, signing, and publishing. These processes literally live in separate components that communicate with each other, but ...
2
votes
1
answer
37
views
Is `createType` safe to use in polkadot-js/api
In this comment of pjs github, it says that we should never do the following:
const something = api.createType('SomeType', { foo: 'bar' });
...
await api.tx.somewhere.something(something);
...
and ...
1
vote
1
answer
74
views
TypeError: api.tx.balances.transfer is not a function substrate contracts node
api.tx.balances.transfer was working perfectly some time ago. I tried to re-run my testcase today and I'm getting this error.
const rawTX = api.tx.balances.transfer(alice.address, 30)
...
0
votes
0
answers
20
views
Use Keyring at a custom component
I'm trying to add a custom component to a fork of polkadot apps:
https://github.com/polkadot-js/apps
The component looks like:
import type { KeyringPair } from '@polkadot/keyring/types';
import { ...
0
votes
1
answer
24
views
polkadot query api and None parameter
Some API queries accept optional parameters Option that can be omitted.
How are those queries written with the javascript API?
For example:
api.query.preimage.preimageFor() takes an Option<(H256,...
0
votes
1
answer
15
views
How to send native tokens from one wallet to another using javascript
I want to send native enjin token on the enjin relay chain from my wallet to another wallet using a js script. I am using @polkadot/api package.
import { ApiPromise, WsProvider, Keyring } from '@...
0
votes
0
answers
23
views
Assertion Failed error when minimumPeriod is set to 0
I'm currently working on upgrading a parachain to use Asynchronous Backing which requires a change in the pallet_timestamp making the MinimumPeriod = 0
impl pallet_timestamp::Config for Runtime {
....
0
votes
1
answer
14
views
Westend token getting via polkadot/api
Would you please advise if there is an alternative to Faucet to get WND - does Polkadot API help with it?
I went through API documentation and did not find any info, I'm glad to be wrong :)
Thank you ...
1
vote
1
answer
74
views
Error: Unable to initialise options more than once
I am using polkadotjs/ui-keyring in which i am trying to use different accounts stores based on user preferences. And i am calling the loadAll to get all the accounts to the keyring, as shown in the ...
1
vote
0
answers
27
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 ...
1
vote
0
answers
20
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 ...
2
votes
1
answer
63
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 ...
0
votes
0
answers
13
views
Polkadot Typegen importing JS extension instead of TS
We are using the typegen to create types for our custom chain.
Following the docs
The code that is generated is kinda strange. In the augment-api.ts file it tries to import all the other generated ts ...
2
votes
0
answers
21
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 ...
0
votes
0
answers
66
views
Smoldot + polkadotjs: UnusedProofEntry when attempting to query a contract
I'm running a custom smoldot node, synced with a hosted bootnode, in a react-based application and attempting to interact with an ink! contract deployed to the network. My fork of smoldot accounts for ...
0
votes
1
answer
13
views
Polkadot.js wallet dosen't show methot section(transaction details) when making a transaction
When making a transaction we are supposed to see the transaction details under the method section but we only see method data
Wrong:
Correct(you can see the method -> assetConversion..):
1
vote
1
answer
25
views
Polkadot JS query response types are missing
No types for blockchain query responses are available in our IDE.
Doing any query like this
await blockchain.api.query.assets.asset(id, (res) => {
const info = res.toJSON()
console.log(&...
1
vote
1
answer
59
views
Substrate Node Error: Denied request: HTTP header: host value verification failed
I am trying to run a Substrate node with a custom configuration using the following command:
./target/release/node-template \
--base-path /tmp/pikamo \
--chain ./customSpecRaw.json \
--port ...
1
vote
2
answers
35
views
How many ways are there to get all items stored in custom pallet
I would like to know what are the ways and how we can retrieve the all items stored in a custom pallet
I was having data structured in this way
#[derive(
Clone, Encode, Decode, Eq, PartialEq, ...
1
vote
0
answers
49
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 ...
0
votes
1
answer
106
views
How to properly decode a SCALE-encoded string using polkadot-js?
Using @polkadot-js/api, one can encode a string aabbcc into 0x18616162626363
> u8aToHex(api.createType('String', "aabbcc").toU8a())
"0x18616162626363"
I know that SCALE ...
2
votes
1
answer
40
views
Transaction pool management
I have to send thousands of transactions to a custom substrate chain, it will probably take a few days to process all of them. Of course I can't just send all the transactions at once because they ...
2
votes
1
answer
34
views
How to retrieve number of decimals for custom token (not DOT)?
How to retrieve number of decimals for custom token (not DOT)?
api.registry.chainDecimals is for DOT. I need to retrieve it for a custom token.
1
vote
0
answers
15
views
Why are payloads wrapped in a <Bytes> tag? [duplicate]
In Polkadot JS Apps, when signing a payload the payload is wrapped in a <Bytes> tag. E.g.
I put a few console log's in the polkadot JS apps code to figure out what's going on. As you can see, ...
1
vote
1
answer
40
views
Decode event data
I am learning to use polkadotjs api, I am trying to send a system.remarkWithEvent and then get the event that this created and decode de output to verify that the remark is there.
The sending of the ...
1
vote
1
answer
88
views
Issues approving transactions after updating parity signer
After a year of not using my Parity Signer, I attempted to approve a transaction using it. Initially, the signer displayed an error upon scanning the transaction QR code. In response, I updated the ...
2
votes
1
answer
41
views
Obtain the balance of erc20 tokens with Polkadot JS
I'm seeking a method to retrieve the balances of all ERC20 tokens associated with an account using the Polkadot JS API. I've been unable to locate a specific API call that enables this functionality. ...
1
vote
1
answer
144
views
Polkadot - westend/westmint: how to create a pool using the asset conversion pallet?
We want to create a pool and we need to provide asset1 and asset2 values to the function, we are not sure what those asset1 and 2 are exactly (we are not sure what it represents or where to find it).
...
1
vote
2
answers
168
views
system.ExtrinsicFailed Token.NotExpendable
I'm working on a project that involves setting up a shared pot account. Anyone can fund this account, and the owner has the ability to withdraw money from it. However, I'm encountering an error: ...
0
votes
1
answer
79
views
If a transaction is created using subxt/polkadot-js and how to sign it using any crypto libraries and send it again using subxt/polkadot-js
I'm trying to create a poc to separate out the signing of transactions from the libraries such as subxt or polkadot-js. I was trying subxt and schnorrkel libs to create partial signed transaction and ...
1
vote
0
answers
65
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 ...
1
vote
2
answers
32
views
Provide judgement on polkadot js
I'm trying to use my node's identity pallet via polkadot js. Generally that works well, but I do run into an issue when providing judgements.
This function requires an identity: H256 (Hash) value. ...
0
votes
1
answer
43
views
Kilt SDK import breaks types
after adding the kiltprotocol/sdk-js to my front-end, I get the following two errors when importing the kilt module.
Error 1:
Type 'Codec | Codec[]' is not assignable to type 'InjectedAccountWithMeta[]...
0
votes
0
answers
22
views
How to Handle Disconnections with WsProvider for Persistent Browser Tabs and Safari on IOS?
We're currently working on [Grill. chat] (https://grill.chat)and uses the WsProvider to establish a WebSocket connection with xSubsocial node. However, we are encountering an issue where the WebSocket ...
1
vote
1
answer
97
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 ...
3
votes
1
answer
38
views
subscriptions with parameters in polkadot.js api
I am using React+Typescript and trying to retrieve data from a struc using a query subscription. I first tried the following in order to check that I'm retrieving the right data:
api.query.rolesModule....
0
votes
1
answer
40
views
Uncaught (in promise) Error: Cannot convert 'InBlock' via asFinalized
I am trying to sign and send some transactions using the batch function.
Here are some code snippets for reproduction.
const nftMinting = async (item) => {
try {
let collection = 1
...
0
votes
1
answer
32
views
Where can I find the js code of polkadot pallet?
As we can see in polkadotjs, when we add pallet then we can see interaction interface as shown in image below. But how this code is generated? Where can I find the code?
2
votes
0
answers
39
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 ...