This library provides a clean wrapper around all the methods exposed by a Polkadot/Subtrate network client and defines all the types exposed by a node.
Questions tagged [polkadot-js]
88 questions
2
votes
0 answers
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": {
"extrinsics":…

PaperFrog
- 155
- 5
2
votes
1 answer
How to create pallet errors that show up on the Polkadot JS apps interface?
So I've been at my wits' end for quite some time regarding #[pallet::error] showing up on Polkadot JS apps interface. So as I've come to understand following substrate kitties tutorial that we require to return a DispatchResult out of our…

RequireKeys
- 466
- 4
- 15
2
votes
1 answer
Polkadot tx-wrapper offline signing
What does ExtrinsicPayload exactly do? I want to replicate the logic but something is missing.
import {
getRegistry
} from '@substrate/txwrapper-polkadot';
const registry = getRegistry({
chainName: 'Polkadot',
specName,
…

Amin Talebi
- 363
- 1
- 7
2
votes
2 answers
getting an error "SyntaxError: Unexpected string" near the import statement working with ts-node-dev
i have trying to use typescript libraries with node but I keep getting these SyntaxErrors. i am running the dev script form the package.json using the ts-node-dev.
the error show near the import statements and i am not sure if its a problem with my…

Emmanuel Thomas
- 159
- 1
- 12
2
votes
1 answer
How do i get crowdloan info using PolkaDot JS APIs?
I am able to get account information and chain info through JS API just fine, however the balance does not show KSM locked in crowdloans, they are just not there, so how can i know in which CL the address allocated KSM and how many?
This is what i…

JohnUopini
- 960
- 9
- 24
2
votes
2 answers
How to generate types.json in substrate
In polkadot-js has provided for developer to define custom types in the pallet, so that polkadot-ui can understand those types (it means can use some underlying API polkadot-js). These types are defined using the json format. This is example
{
…

CocDap
- 180
- 4
2
votes
1 answer
What is causing this Invalid JSON ABI structure error?
I'm trying to deploy an ink! contract through polkadotJS.
var WASM = fs.readFileSync('./resources/flipper.wasm');
var ABI = fs.readFileSync('./resources/metadata.json');
const api = await ApiPromise.create();
const code = new…

Manolo Viso Romero
- 131
- 1
- 13
2
votes
1 answer
build substrate ink contract
I trying to create a substrate smart contract by following the tutorial as described in https://substrate.dev/substrate-contracts-workshop/#/0/setup. I have installed all the dependencies on Windows 10 OS. However, the process fails after completing…

starwar1
- 21
- 1
2
votes
1 answer
How to get the Polkadot address from the polkadot public key? Polkadot.js
I tried @polkadot/util-crypto lib and @polkadot/keyring to convert, public key to polkadot address but no help.
Is there any method provided by the polkadot.js?
Steps on how to get the address will also work great.
Thank you

Shubham Chadokar
- 2,520
- 1
- 24
- 45
2
votes
1 answer
What is the right way to query Polkadot js for a Substrate storage key?
I am trying to pull a large array from Substrate storage, and when querying via node.js I get "Unable to decode Vec on index 0 Source is too large".
So switching to curl and the JSON RPC interface, I wanted to check I could generate hashes…

Phil H
- 19,928
- 7
- 68
- 105
2
votes
1 answer
In Polkadot Apps developer tab how do you encode a Rust tuple?
There are several examples for including custom Rust types declared in a runtime module that can be applied Polkadot Apps interface here. However I am not sure how to encode tuples. This would also be the case for anyone else planning on using…

T9b
- 3,312
- 5
- 31
- 50
2
votes
1 answer
In Polkadot-js is there a method to create HD wallet addresses
I am using Polkadot-js api and wondered if there is an API to generate hierarchical deterministic wallet addresses from a given seed?
I see that there is some mention of soft and hard derivation paths, in Substrate's subkey documentation but do not…

T9b
- 3,312
- 5
- 31
- 50
2
votes
1 answer
No `kitties` module available in the extrinsics tab
I'm following the Substrate Kitties workshop. In 1/Viewing a Storage Mapping, I cannot access my kitties module on the #extrinsics tab of the Polkadot UI:
I tried reloading it multiple times. This is my kitties.rs (compiles fine):
use…

q9f
- 11,293
- 8
- 57
- 96
1
vote
0 answers
Polkadot.js sr25519 secret key to hex
I am creation a keypair using sr25519PairFromSeed.
I am converting the public key from Uint8Array to hex using encodeAddress(publicKey, 0),
but i have issues converting the secret key from Uint8array to hex.
I use…

Dario Tsvetanoff
- 11
- 1
1
vote
0 answers
"contract" can be obtained as a result of "signAndSend", but the compilation error is not resolved
I implemented the sample code according to the polkadot.js official site in the link below.
Running and testing with "yarn dev" command works as expected.
But when I run "yarn build" I get compilation errors.
Anyone know how to solve…

s.Takahashi
- 469
- 4
- 15