Questions tagged [polkadot-js]
Questions about the Polakdot JS API used to interact with Substrate based chains via JavaScript.
469
questions
1
vote
1
answer
153
views
'window is not defined' issue when I integrate polkadot{js} extension into my dapp
ReferenceError: window is not defined
I reload my browser, I get the error shown in the attached image.
However, once I disable bellow imports, the screen works fine.
And also error message say that ...
0
votes
2
answers
48
views
How to remove account using polkadotjs? What function should I call to forget an account?
I added a new account using this command in PolkadotJS.
const { pair, json } = keyring.addUri(mnemonic, 'myStr0ngP@ssworD', { name: 'mnemonic acc' });
And now, I want to forget the account.
I used ...
1
vote
1
answer
48
views
How to submit null options using Polkadot.js/api?
For queries such as api.query.identity.indentityOf(AccountID32) it is possible within Polkadot.JS.org/apps to include or not include a parameter:
I would like to do the same via typescript but I'm ...
1
vote
1
answer
40
views
Index.html file not found on Firefox after building dev version of Polkadot.js extension
When I start the development version of the Polkadot.js extension on Firefox after installing it, I'm getting the error: File not found. Firefox cannot find the file on moz-extension://.../index.html.
...
0
votes
1
answer
42
views
How to calculate block memory size(MB,GB...) for each transaction block?
Is there any API to calculate each block? How much size does it occupy?
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,...
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
...
2
votes
1
answer
121
views
How to determine value for param num_slashing_spans for a withdrawUnbonded tx?
I'm having trouble determining values for param num_slashing_spans for api.tx.staking.withdrawUnbonded.
I see that the most popular value is 0, but sometimes people also use 2 and 84.
Is there any ...
1
vote
1
answer
80
views
How to use api.events.staking.Rewarded.is to get nominator reward?
How to use api.events.staking.Rewarded.is to get reward?
Like this:
let event:IEventLike={
index:9281,
method:"staking",
section:"rewarded",
};
const nominatorReward = api....
0
votes
1
answer
139
views
How to get the validators detail information
As a developer,I want to use the interface to search this information: which can get the validator detail information like the count of nominators and the commission and others information,
0
votes
2
answers
20
views
stuck starting substrate local host has moved
Im working on the substrate for the first time.
https://docs.substrate.io/tutorials/get-started/build-local-blockchain/
stuck right here:
Open http://localhost:8000/ in a browser to view the front-end ...
7
votes
1
answer
66
views
getting Error's while adding pallet_evm to runtime " the trait bound `pallet_evm::Pallet<Runtime>: Callable<Runtime>` is not satisfied in `Call`"
I am trying to add Evm pallet to my substrate runtime i am using Polkadotv0.9.25 for both substrate and frontier but getting error of trait bound for almost every pallet.
error:- within Call, the ...
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 ...
10
votes
2
answers
113
views
Staking Election Failed (staking.StakingElectionFailed The election failed. No new era is planned. ) after adding EVM with NPOS(i.e BABE)
I have Added EVM pallet to my NPOS based Substrate chain but i am facing staking.StakingElectionFailed The election failed. No new era is planned. how to solve this issue.
I have implemented the NPOS ...
0
votes
0
answers
20
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
40
views
How to use as_derivative function found in the Utility pallet?
I found the as_derivative() function call in the FRAME Utility pallet which suggests that I can use it to call a function from address_A on behalf of address_B, provided that address_B was made as a ...
3
votes
2
answers
203
views
How to use polkadot js typescript Typegen to decorate api for runtime
I am following the guide in polkadot-js/typegen, the github source is shared. I am trying to follow along and decorate the api for my custom node-template called supersig-template
I have successfully ...
0
votes
1
answer
69
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?
0
votes
1
answer
72
views
JavaScript/TypeScript: How to pass arguments of an array individually to a function?
I want to dynamically call contract functions. The only problem with this is,
that all of the functions have a different amount of variables.
As of now, the function looks like this:
async call(...
2
votes
1
answer
140
views
Is there a way to add a some transaction message to the dot transfer?
Example: If we are doing 10DOT Transfer from one address to another address, Can we attach some description like "test transaction" or "investment"?
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 } = ...
0
votes
0
answers
31
views
Is it possible to pull the transactions that the Moonbeam collators are sending to the Polkadot relay chain?
Currently, working inside the Moonbeam interface and was wondering if it was possible to pull the group of transactions that the Moonbeam collators are sending to the Polkadot Relay Chain before the ...
1
vote
3
answers
177
views
Docker container...-p 9944:9944 running Node Template not working on polkadot js apps
I'm trying to run a substrate node through docker container but i am not able to with this command:
docker run -p 9944:9944 -p 30333:30333 -p 9933:9933 -p 9615:9615 docker.io/decentration/supersig-...
1
vote
2
answers
96
views
What exactly is the payload?
I am trying to understand what is in a transaction specifically the payload. While the documentation references the term payload, it is not explicit/clear about what exactly it is. It seems to ...
0
votes
0
answers
10
views
How to interact with the pre-defined public address
I want to interact with the pre-defined public address. I want to use a map function to hide the public address with any name I want
0
votes
1
answer
42
views
Is it possible to stake DOT programmatically?
The title is pretty much it. Can I use Polkadot API to stake dot programmatically?
Can't seem to find that in the docs.
1
vote
1
answer
36
views
Display type alias for primitive types
I have observed few pallets have type alias for primitive types for chain state.
For eg- Grandpa pallet has one storage setIdSession which shows type as SetId even though its primitive type is u64.
...
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 ...
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 ...
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/@...
1
vote
2
answers
84
views
How to use `asMultiThreshold1` within the multisig pallet
Aim
I would like to use the asMultiThreshold1 extrinsic in the Extrinsic Tab to produce a multi-sig call to authorise a balance transfer from the multi-sig account ABC (made by Alice, Bob and Charlie) ...
0
votes
1
answer
148
views
Calling an extrinsic using the polkadot-js-api CLI tool
How can I call an extrinsic on a palette using the polkadot-js-api CLI tool? I don't see much documentation on the tool nor does the --help provide much detail. Could I use this tool for this ...
0
votes
2
answers
153
views
Where does initial ALICE account balance come from? From development_config() or local_testnet_config() in chain_spec.rs?
Every time when I start my parachain, I see Alice, Bob, Charlie, Dave,... etc and each of them has 1.1529 MUNIT on Polkadot.js.org's Accounts -> Accounts -> My Account page.
How does Polkadot.js....
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&...
1
vote
1
answer
36
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
83
views
How to set decimal points on Polkadot.js.org account balances for parachain
Every time when I start my parachain, I see Bob, Charlie, Dave,... etc and each of them has 1.1529 MUNIT on Polkadot.js.org's Accounts -> Accounts -> My Account page. But how does Polkadot.js....
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'
});
// ...
0
votes
1
answer
94
views
Past reward history in polkadot.js
api.query.staking.erasRewardPoints(era) query returns reward history for selected era.
And only last 84 eras reward history is available.
I want to get reward history from first era.
How can I get ...
0
votes
0
answers
18
views
Why I don't see OpaquePeerId in the polkadot app?
I have this simple function that emits this event.
I also set a GenesisConfig for the pallet in the node/src/chain_spec.rs in this way.
But when I run the blockchain in dev mode and I call the ...
2
votes
1
answer
60
views
what is Substrate Files Decentralised storage?
Can anyone please give me any link or docs where I can find more about Substrate Files decentralized storage?
I have gone through this link: https://github.com/polkadot-js/apps/pull/6106
Is there any ...
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?
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
0
votes
0
answers
40
views
PolkadotAPI Signing transaction using AccountKey20 address format [duplicate]
I have error signing transaction with account that uses accountkey20, have anyone encountered this problem and fixed it?
What is the current behavior and expected behavior?
When I try to sign ...
0
votes
0
answers
15
views
How can I tell which validator a nominator is bonding when extracting bondExtra extrinsic from block polkadot-js?
I am trying to extract extrinsics with a bonding event from a block and extract a validator, nominator pair for each. I would also like to know how to fetch the amount that was staked.
Code:
// ...
1
vote
2
answers
194
views
Typescript errors when using @polkadot/api
I'm building a typescript project and I'm trying to do the very simplest thing as a first step with Polkadot: Connect to a node and get account information. However, when I run tsc, it totally blows ...
1
vote
1
answer
38
views
How to get circulating supply / 'electorate' from API
I would like to calculate the threshold for referendums to pass. I found this article about how the calculation works, but it requires the number of coins in circulation. Is there an API endpoint for ...
0
votes
1
answer
46
views
polkadot-js: What does targets mean in api.query.staking.nominators?
code:
const nominators = await api.query.staking.nominators.entries();
example json output for nominators vaiable:
[
[
[
"145xupEFYa81KCexCH5bRU6k3fqY9GgLWAH8nMhat2CKHkcd"
],...
2
votes
2
answers
128
views
Polkadot js API Type Issue
I am getting type as Codec while using api.query.<module><method>. The types should be specific or am i missing something. Is there any way to convert this into the right type.
1
vote
1
answer
91
views
How do I connect to an archive node with polkadot.js api?
Is there a list of archive nodes for polkadot/kusama/parachains?
I'm trying to fetch all historical events in order to visualize staking rewards for nominators and validators.
0
votes
1
answer
31
views
After BABE changed to RRSC, explorer does not show the author
After BABE changed to RRSC, explorer does not show the author