Questions tagged [polkadot-js]
Questions about the Polkadot-JS API used to interact with Substrate-based chains using JavaScript.
535
questions
0
votes
0
answers
8
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
17
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?
1
vote
1
answer
89
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 ...
1
vote
1
answer
88
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 ...
2
votes
0
answers
10
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
63
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 ...
3
votes
1
answer
47
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 ...
5
votes
1
answer
44
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 === ...
2
votes
1
answer
23
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 ...
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 '@...
1
vote
2
answers
821
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
// **************...
1
vote
1
answer
35
views
Resolving duplicate polkadot dependencies polkadot typescript sdk
I am currently using the polkadot sdk in my typescript project and while I was attempting to upgrade their versions, I deleted my yarn.lock file and reran yarn install but now I get this when I try ...
1
vote
1
answer
127
views
How to get raw payload from Polkadot JS transaction
As the title asks, how do we abstract the raw payload of a transaction created with Polkadot JS?
// set up a tx, e.g. join a nomination pool
const tx = api.tx.nominationPools.join(bond, poolId);
// ...
0
votes
1
answer
36
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
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. ...
1
vote
1
answer
48
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 ...
1
vote
1
answer
17
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
2
answers
31
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, ...
2
votes
1
answer
54
views
Validating node, how connet to polkadot.js
For running validate nodes, through set up, now i can see my node on the telemetry. but I don't know how to connect to polkadot.js.
polka wiki says
"You can generate your Session keys in the ...
5
votes
1
answer
39
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 ...
2
votes
1
answer
36
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 ...
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
67
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 { ...
5
votes
3
answers
77
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 ...
4
votes
1
answer
88
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
...
2
votes
1
answer
50
views
Is there a .into_sub_account_truncating equivalent for Javascript?
In rust I use:
.into_sub_account_truncating()
Is there a Javascript equivalent?
0
votes
1
answer
22
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
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
81
views
How to check what node authoring a block with Aura in the Polkadot.js App?
There is a way to see what node authoring a specific block in the Polkadot app?
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 ...
4
votes
1
answer
33
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 ...
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 ...
6
votes
2
answers
205
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-...
1
vote
1
answer
38
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 } = ...
1
vote
1
answer
51
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 ...
1
vote
0
answers
24
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
1
answer
45
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 ...
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 ...
1
vote
1
answer
102
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&...
2
votes
0
answers
53
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
12
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 ...
0
votes
0
answers
65
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 ...
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 ...
1
vote
1
answer
24
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
56
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 ...
2
votes
1
answer
39
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
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 ...
1
vote
2
answers
57
views
How to get event args values from contracts::contractemitted data?
I am using
const decodedEvent = Abi.decodeEvent(Uint8Array.from(Buffer.from("00000064a7b3b6e00d000000000000000000000000000000000000000000000000", 'hex')))
(...
1
vote
1
answer
72
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 ...