Questions tagged [api]
The api tag has no usage guidance.
71
questions
2
votes
0
answers
24
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 ...
3
votes
0
answers
32
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?
0
votes
1
answer
24
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,...
1
vote
1
answer
74
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 ...
1
vote
1
answer
68
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 ...
3
votes
1
answer
59
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 ...
0
votes
0
answers
14
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?
1
vote
1
answer
42
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 ...
3
votes
1
answer
38
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....
0
votes
0
answers
25
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" ...
5
votes
3
answers
78
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 ...
3
votes
0
answers
49
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 ...
6
votes
1
answer
44
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....
6
votes
0
answers
67
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 ...
3
votes
1
answer
79
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> {
...
3
votes
1
answer
148
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
...
3
votes
1
answer
66
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?
6
votes
1
answer
64
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:
...
5
votes
1
answer
48
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 ...
3
votes
1
answer
166
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 ...
0
votes
1
answer
28
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: ...
0
votes
1
answer
33
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?
1
vote
1
answer
56
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 = ...
0
votes
0
answers
39
views
Council propose motion failing
I have a custom substrate node running and when I tried to use the council propose motion page to propose something it was failing. At first I thought its an issue becasue of my custom implementations ...
2
votes
1
answer
51
views
Is there a .into_sub_account_truncating equivalent for Javascript?
In rust I use:
.into_sub_account_truncating()
Is there a Javascript equivalent?
0
votes
0
answers
66
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<...
1
vote
1
answer
87
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 ...
1
vote
1
answer
36
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 ...
0
votes
1
answer
35
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?
1
vote
3
answers
62
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 ...
2
votes
1
answer
55
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....
2
votes
1
answer
74
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 ...
1
vote
1
answer
40
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/...
0
votes
1
answer
46
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?
1
vote
1
answer
96
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 ...
3
votes
2
answers
139
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 ...
4
votes
0
answers
162
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 ...
4
votes
2
answers
248
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 ...
1
vote
1
answer
145
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
...
1
vote
1
answer
239
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?
1
vote
1
answer
78
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
2
answers
128
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({ ...
1
vote
1
answer
36
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 ...
1
vote
1
answer
92
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 ...
1
vote
1
answer
128
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 ()...
2
votes
1
answer
132
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 ...
1
vote
1
answer
180
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 ...
0
votes
1
answer
492
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 ...
1
vote
1
answer
87
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 ...
0
votes
2
answers
388
views
polkadot.js api: How to find all nominators of a validator?
How does the polkadot api keep track of the nominators per validator?
Here you can see there is a count of nominators.
api.query.staking.nominators(stash) provides a list of validators the stash has ...