Questions tagged [api]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
36 views

Staking with polkadot js api

I try to make a stake with polkadot js api. Here is my commands: const info = await api.tx.staking .bond(amount, {Controller: receiver}) .paymentInfo(sender); ...
Марина Онищенко's user avatar
4 votes
1 answer
45 views

Facing difficulty in fetching data through lite_json

Api data { "student": [ { "listing": { "price": 54, }, }, ] } I’m using below code for fetching data till listing: let student = match val....
Ajit's user avatar
  • 827
2 votes
0 answers
30 views

How to fetch floating no in offchain worker?

I want to fetch the floating value in offchain worker. I'm using lite_json for http request. Api data: { "price": 0.5 } To fetch and store this price from api. I'm defining a struct: pub ...
Deepak Chaudhary's user avatar
3 votes
0 answers
48 views

Integrating External Data into Blockchain: Can Validators Fetch and Incorporate API-sourced Data?

Is it feasible for validators to retrieve information from external APIs, particularly news data, and seamlessly incorporate it into the blockchain?
Ajit's user avatar
  • 827
0 votes
1 answer
48 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,...
rvalle's user avatar
  • 45
1 vote
1 answer
85 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 ...
Emmanuel Thomas's user avatar
1 vote
1 answer
74 views

kusama upload/download bandwidth speed so low

I'm running a Kusama node with a actual network speed ranging from over 100MB/s to 500MB/s on both sides. However, I'm facing issues with slow block propagation time and low upload/download bandwidth ...
jay p's user avatar
  • 61
3 votes
1 answer
67 views

Get the raw hex from substrate

I'm trying to get the raw value of the transaction without using the websocket. For now I'm using a WebSocket for my application and I am in the process of removing it, I could find everything I ...
Dashelldot's user avatar
0 votes
0 answers
20 views

How to preview events by dry running an extrinsic?

following this example I can preview if an extrinsic will succeed How to preflight / preview a transaction? But how can I preview all events emitted by this extrinsic?
Shunji Zhan's user avatar
1 vote
1 answer
47 views

How do third party apps handle paying transaction fees for chains using `pallet-asset-tx-payment`

I found the pallet-asset-tx-payment pretty cool and am planning to add this in my runtime. But my concern is the SignedExtension. Adding the ChargeAssetTxPayment in the SignedExtra portion will make ...
Jitterbug's user avatar
  • 219
3 votes
1 answer
49 views

subscriptions with parameters in polkadot.js api

I am using React+Typescript and trying to retrieve data from a struc using a query subscription. I first tried the following in order to check that I'm retrieving the right data: api.query.rolesModule....
Kazunobu Ndong's user avatar
0 votes
0 answers
32 views

when running a validating nodes, firewall setting is essential?

when running a nodes, firewall is essential? i used this command sudo ufw allow 3033/tpc but it`s result is "ERROR: Bad port" what`s the problem? can i just done "sudo ufw enable" ...
jay p's user avatar
  • 61
6 votes
2 answers
110 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 ...
Szegoo's user avatar
  • 647
3 votes
0 answers
68 views

Transaction fails when using Polkadot extension

We have a customized substrate chain currently running and we are facing some signature issues (repo). This chain has custom types, custom header and an additional extension to check a parameter ...
Leouarz's user avatar
  • 353
6 votes
1 answer
52 views

Parachain support for light clients

What is required from a technical point of view (specific pallets and APIs) for parachains to support light clients? I saw that only a few parachains have the option to interact with the light clients....
user2862's user avatar
  • 309
6 votes
0 answers
73 views

Decompose complex types in JS

My overall goal is to build a generic extrinsic builder, just like the extrinsic tab from polkadot-js/apps. This code is very old and very hard to decipher unfortunately and I couldn't find any doc ...
Tbaut's user avatar
  • 253
3 votes
1 answer
87 views

How to automatically pass the value to custom SignedExtension

For now I have custom SignedExtension in my substrate node: #[derive(Encode, Decode, Clone, Eq, PartialEq, TypeInfo)] #[scale_info(skip_type_params(T))] pub struct CheckAccount<T> { ...
Danylo Kyrieiev's user avatar
3 votes
1 answer
194 views

How to encode an extrinsic for RPC from a web client?

I need to programmatically pack an extrinsic for an RPC, I believe I'm looking for the following front-end functionality: extract relevant indices from the Metadata fill the extrinsic parameters ...
Yury Yukhananov's user avatar
3 votes
1 answer
73 views

How to connect the our local chain to the frontend?

I want to build a frontend for our local chain. how can we connect our local to chain to the frontend?
Deepak Chaudhary's user avatar
6 votes
1 answer
77 views

decl_runtime_api behaving in a weird way

In the project we are currently working on, we declared some runtime apis in our custom pallet, we tried to update the dependencies from 0.9.28 to 0.9.42 but the build fails with the following error: ...
dadzerlaze's user avatar
  • 1,083
5 votes
1 answer
58 views

How to access Polkadot/Kusama runtime types from polkadot.js api to work with the transactions arguments

With subxt is straight-forward as you can access the types by generating them using metadata and use them in your fn arguments but in polkadot.js is kinda not straight forward as where and how the ...
Mrisho Lukamba's user avatar
3 votes
1 answer
215 views

How to make rawTransaction? and Can I get some guide or reference about offchain sign?

[Question] How can I make raw-transaction(unsigned-transaction) with essential parameter(fromAddress, toAddress, value, nonce, fee etc)? I want to know low-level algorithm. What kind of Cryptography ...
지상범's user avatar
0 votes
1 answer
35 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: ...
Syed's user avatar
  • 278
0 votes
1 answer
50 views

How to get history of the native coin total issuance through API - Say DOT

How can one download the history of a native coin total issuance, via an API - Say DOT?
Begley Brothers Inc's user avatar
1 vote
1 answer
62 views

PolkadotJs Api: queryMulti with different blockHashes

Is it possible to do a multiQuery querying multiple types and multiple blockhashes? Even same type and different block hashes would be helpful. Something along the lines of const multiQueryResult = ...
pifragile's user avatar
2 votes
1 answer
58 views

Is there a .into_sub_account_truncating equivalent for Javascript?

In rust I use: .into_sub_account_truncating() Is there a Javascript equivalent?
Ramsey - Decentration's user avatar
0 votes
0 answers
71 views

How to use `useCall()` polkadot react-hook? Type issue

I'm trying to use useCall() to add to polkadot js ui. . I've added the type interface: /** @name UserSupersig */ export interface UserSupersig extends Struct { readonly user_supersigs: Vec<...
Ramsey - Decentration's user avatar
1 vote
1 answer
117 views

Custom ChargeTransactionPayment type for extrinsics

if the type for extrinsic verification pub struct ChargeTransactionPayment<T: Config> has been changed on a chain, how do we update the polkadot.js API to use the new types? Suppose the type has ...
Emmanuel Thomas's user avatar
1 vote
1 answer
48 views

Polkadot-JS wallet staking automation

We are trying to achieve staking automation to nominationPool. Is there any solution to get the number of bonded & unbound (unlocked) funds using the Polakdot-JS API? We would like to fetch the ...
Mars Captain's user avatar
0 votes
1 answer
38 views

is there any api for get substrate api client verison?

all. Currently sidecar owns a api "/node/version" for get polkadot node version. But is there any api could return sidecar api version for us?
Bomax GoGo's user avatar
1 vote
3 answers
65 views

About Polkadot's API List

The polkadot.js documentation has a list of APIs on it, but is there any other list of APIs? The polkadot.js API list includes eth, which cannot be executed without Frontier. Is there an API List that ...
Satish's user avatar
  • 23
2 votes
1 answer
65 views

How to produce empty paramter in an Option?

In the screenshot below the OptionSelect is disabled, which produces info of an array of accounts rather than just one single. How do you replicate this option when curating a call? Using api.query....
Ramsey - Decentration's user avatar
2 votes
1 answer
94 views

What is the smartest way to make multiple dynamic storage queries using subxt?

Is it possible to make batched storage calls to the runtime using subxt or is it only possible to make repeated individual calls against the state? Say there are 3 storage variables I would like to ...
Drew Stone's user avatar
  • 1,194
1 vote
1 answer
44 views

Runtime api execute_block doesn't trigger

Currently, I am trying to test how frame-executive is working in this repo I add some logs in executive interface impl_runtime_apis! : https://github.com/paritytech/substrate/blob/master/bin/node/...
CocDap's user avatar
  • 668
0 votes
1 answer
52 views

connect Polkadot{js} API correctly

Your API has not been initialized correctly and is not connected to a chain the API is successfully connected and return value, but all ContractPromise cause this error. Anyone know how to solve this?
Steve's user avatar
  • 83
1 vote
1 answer
102 views

Gov2: list of who is voting on what | Polkadot.js api

I'm building an automation for the Gov2 referenda module, testing right now using wss://governance2-testnet.litentry.io test network with polkadot.js app Differently from what the democracy module we ...
Alessio's user avatar
  • 11
3 votes
2 answers
174 views

Accessing historical data for validators from the API

I have been trying to pull the validator-level data for Polkadot for a project I am working on. I am using this API and have been unable to find a command I need. Ideally, the request URL would either ...
TG_hence's user avatar
4 votes
0 answers
175 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 ...
cooper jones's user avatar
4 votes
2 answers
262 views

How to use polkadot js typescript Typegen to decorate api for runtime

I'm 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 ...
Ramsey - Decentration's user avatar
1 vote
1 answer
156 views

How to call payable methods with the polkadot API?

I want to call a payable method using the polkadot API. if the method would not be payable it would look like this: const { gasRequired, storageDeposit, result, output } = await contract.query ...
rajohs's user avatar
  • 491
1 vote
1 answer
317 views

How to query transaction details by using the transaction hash on polkadot by using python

Is there something equivalent to w3.eth.getTransaction(txHash), for Substrate based chains using python?
Shahbaz Ali's user avatar
1 vote
1 answer
95 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 ...
rajohs's user avatar
  • 491
2 votes
2 answers
144 views

How to save decoded events using polkadot.js?

I am monitoring the events when calling a method from my contract and want to save the output of one of my custom events, to display it. The call of my method looks like this: contract.tx .method({ ...
rajohs's user avatar
  • 491
1 vote
1 answer
39 views

batched transactions are not all executed, but no error are thrown

I am doing a balance upload (copying and modifying the balances from a chain to another) I have a json file containing all i need, i compute the new balance, and i batch calls doing a setBalance(). I ...
Nathan's user avatar
  • 464
1 vote
1 answer
101 views

How to call prefixed by trait(interface) methods using the polkadot api?

I wrote a smart contract, implementing a psp34 token (docs). Inside the smart contract, it is no problem using the methods provided by openbrush. However, when I deploy it on chain and want to call a ...
rajohs's user avatar
  • 491
1 vote
1 answer
173 views

Using polkadot.js api, how can we list the members of a Kusama nomination pool?

According to the documentation, api.query.nominationPools.poolMembers should yield details about pool members. The result should be a Map so we should be able to iterate the .entries / .keys. (async ()...
DerekC's user avatar
  • 205
2 votes
1 answer
164 views

How to get output when calling a contract method and signing it?

I have a contract which I want to call using the polkadot{.js} extension. To call the method successfully, you have to sign it. When I am now signing a method, I have trouble reading out the value the ...
rajohs's user avatar
  • 491
1 vote
1 answer
197 views

How to call a contract using a custom RPC?

I uploaded a smart contract to the Aleph Zero test net. When I tried to query one of the methods of said smart contract, I encountered this error: 2022-08-09 09:34:28 API/INIT: RPC methods not ...
rajohs's user avatar
  • 491
0 votes
1 answer
601 views

How can you query a smart contract using the polkadot.js api?

I want to query a smart contract which I deployed on the Aleph Zero testnet. The Polkadot.js documentation is pretty clear and easy to follow regarding connecting to the chain and querying general ...
rajohs's user avatar
  • 491
1 vote
1 answer
94 views

How to query an address that has sub-identity?

Using polkadot.js api: How do I get from an address to the parent address/identity? Is there any way to traverse from an identity to the sub-identities? Just calling the identity of the address ...
DerekC's user avatar
  • 205