All Questions
Tagged with javascript polkadot-js
18 questions
0
votes
2
answers
34
views
Get crowdloan contributors at specific block
I'm using polkadot-js to get all the contributors for a crowdloan:
const contributors = await api.derive.crowdloan.contributions(paraId);
However, I need to get them at a specific block. I have seen ...
0
votes
1
answer
58
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
37
views
How to query api.query.authorityDiscovery.keys?
I'm trying to call api.query.authorityDiscovery.keys as is described here from rpc.polkadot.io like:
let current_auth_keys = await api.query.authorityDiscovery.keys();
and I keep getting:
TypeError: ...
1
vote
1
answer
246
views
Invalid Transaction: Transaction has a bad signature - Ledger signature into tx
I am attempting to submit a transaction using Polkadot JS API and a signature that has been signed by Ledger. Upon passing it to send I get the Invalid Transaction: Transaction has a bad signature ...
2
votes
1
answer
192
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);
// ...
1
vote
2
answers
93
views
How to verify that signed transaction, is correctly signed?
I want to decode and check if the given hex data for the transaction is valid and signed correctly.
The flowing is how I currently construct the transaction and convert it to hexadecimal format.
...
2
votes
1
answer
61
views
Is there a .into_sub_account_truncating equivalent for Javascript?
In rust I use:
.into_sub_account_truncating()
Is there a Javascript equivalent?
1
vote
1
answer
138
views
Question for api.call.transactionPaymentApi.queryInfo state call
I'm replacing api.rpc.payment.queryInfo with api.call.transactionPaymentApi.queryInfo in the crawler code of Polkastats block explorer but I want to ask about the second parameter len: is that the ...
0
votes
1
answer
388
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(...
1
vote
1
answer
99
views
How to change input from string to Id::Bytes in JavaScript?
I am using the openbrush standard to implement a psp34 token.
Now I want to call certain methods from said token, like for
example owner_of.
owner_of from psp34 has id:Id as an input which can then be ...
2
votes
1
answer
69
views
How to use the polkadot/dev project template
I'm trying to convert my project over to a structure similar to the @polkadotjs repositories, but I'm finding the dev template provided a bit difficult to parse. Specifically:
How do I use this ...
2
votes
1
answer
94
views
How to create a tuple type using polkadot.js api
I am trying to create a tuple. I know we can create an enum by defining the type as
MyEnum: {
_enum: {
'account': String,
'accountId': 'u128'
...
0
votes
1
answer
39
views
Get remaining value of bounty after child bounty
I am writing a web app that shows current info about bounties and child bounties. From what i understand if there is a bounty with a value of 5 DOT, I can create N child bounties which values sum up ...
3
votes
2
answers
183
views
Access your NFTs using PolkadotJS API
Still very new to this ecosystem. I'm trying to build a ReactApp that can access my NFT's that I have purchased on the Singular App.
High level explanation, how do I do this?
Low level, point me in ...
9
votes
1
answer
543
views
How to get the balance of an account at a particular nonce using Polkadot.js API
I want get the balance of an account address at a particular nonce.
I only know how to get the latest balance of an account address and its latest nonce (total number of transactions sent from that ...
1
vote
1
answer
72
views
Invalid params: unknown field `storageDepositLimit` Error when getting contract data from a chain
I deploy the flipper contract to Jupiter testnet, when I try to get the contract data, I got this error message although it works just fine on a local node. (I also tested on other test networks and ...
1
vote
2
answers
711
views
Transaction would exhaust the block limits error when calling a smart contract from Polkadot JS API
I'm trying to call a smart contract using the Polkadot JS API (like here). The contract function is really simple, it takes 2 strings: a key and a value as input parameters, then adds the key, value ...
1
vote
1
answer
161
views
OutOfGas Error when trying to read contract data using Polkadot JS API
I'm trying to read the flipper contract data from a contract in a local node, following the code in here.
This is my code:
// Required imports
const { ApiPromise, WsProvider } = require("@...