Questions tagged [polkadot-js]
Questions about the Polakdot JS API used to interact with Substrate based chains via JavaScript.
469
questions
0
votes
1
answer
66
views
How to know if the extrinsic completed without any extrinsic errors
I'd like to get if the extrinsic completed without any extrinsic errors and get the errors if any. result.isError returns false when there's an error.
Could this be because I return DispatchResult ...
1
vote
1
answer
155
views
Sometimes Polkadot JS won't connect to the local node, unless I enable rpc-cors all
I am using the polkadot js appimage and sometimes while connecting to my node, I see this :
Blocked connection to WebSockets server from untrusted origin: Some("file://").
I've tried running ...
1
vote
1
answer
59
views
How to connect to a node from other computer?
I am running a local node on a computer. How can I connect and get information on this node from another computer using Polkadot Js API?
3
votes
1
answer
151
views
How to obtain extrinsic hash
PolkadotJS explorer provides a hash value for every extrinsic (see marked screenshot) but the extrinsics list from block data (block.extrinsics) does not explicitly provide one. How is this value ...
2
votes
3
answers
203
views
Can we query blocks by (extrinsics) timestamp?
Can we query block data by timestamp? If so what time is the correct one to use? For a typical block object, there's a time property that seems to always be undefined, but the first extrinsic (index 0)...
0
votes
1
answer
55
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
1
answer
322
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
102
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("@...
3
votes
1
answer
276
views
How to format balance?
I tried using @polkadot/util's formatBalance function to get the formatted balance of the account. But it doesn't make sense.
I believe unit conversion is not working properly and I wonder what I am ...
4
votes
1
answer
58
views
How to see the parameters that were passed into a contract call?
I want to know the contract address, contract caller, and what parameters were passed into the contract call but in the Polkadot.js UI, the presented fields don't seem to be helpful.
5
votes
2
answers
171
views
What format is the block timestamp?
I'm using @polkadot-js to decode extrinsic data. The following method call returns a timestamp at a specific block, but I don't know how to parse this.
I tried assuming that it's a unix timestamp in ...
0
votes
1
answer
48
views
How to access storage items using polkadot js, javascript playground [closed]
As when i try to to do api.query.templatemodule.get_something() it shows errors in the console
4
votes
2
answers
190
views
How to get historical substrate (extrinsic, events, etc) data using polkaDotJS API
PolkaDotJS API docs show to get extrinsic, events, etc data for a particular block. Is there a way to get all the extrinsic, events, etc data for the substrate network without having to get for each ...
2
votes
2
answers
63
views
How do I write custom a custom api-derive?
I am trying to create my own derives using DeriveCustom like this:
import { DeriveCustom } from '@polkadot/api-derive';
import * as staking from './staking';
export const derive: DeriveCustom = {
...
5
votes
2
answers
503
views
How to decode extrinsic at json-RPC call's data(byte code)
I call json-RPC through the terminal and get the data as below.
extrinsics is raw byte, but I'm using polkadot-js(SCALE codec?) to decode it.
But I don't know which method to call.
"block": ...
2
votes
1
answer
155
views
How do you resolve missing type errors in the @polkadot/api v7.x.x packages?
Upgrading from:
// package.json
"@polkadot/api": "^6.7.2",
"@polkadot/types": "^6.7.2",
to:
// package.json
"@polkadot/api": "^7.7.1",
&...
5
votes
2
answers
194
views
How to enable units for currencies in polkadot-js
Currently, polkadot-js doesn't allow me to select a unit when specifying balances in the Developer > Extrinsics section, which means that all balances must be specified in the smallest unit (10^12 ...
7
votes
1
answer
91
views
Can an account's transactions be front-run on Polkadot? If so, how?
Is it possible to reliably monitor an account and receive information about a transaction of that account before the transaction is InBlock and then front-run that transaction by issuing a ...
4
votes
1
answer
63
views
How to create pallet errors for sudo that show up on the Polkadot JS apps interface?
Repost from stackoverflow:
So I've been at my wits' end for quite some time regarding #[pallet::error] showing up on Polkadot JS apps interface when calling a fallible function from sudo. So as I've ...