Questions tagged [api]
The api tag has no usage guidance.
56
questions
2
votes
1
answer
74
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
...
1
vote
1
answer
35
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?
3
votes
1
answer
36
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 dependecies from 0.9.28 to 0.9.42 but the build fails with the following error:
...
3
votes
1
answer
28
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 ...
2
votes
1
answer
75
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
25
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
22
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
45
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
30
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 ...
1
vote
1
answer
26
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
53
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
63
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
35
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
25
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
50
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 ...
1
vote
1
answer
30
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....
1
vote
1
answer
56
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
19
views
Runtime api execute_block doesnt trigger
Currently, I am trying to test how frame-executive is working in this repo https://github.com/paritytech/substrate
I add some logs in executive interface impl_runtime_apis! : https://github.com/...
0
votes
1
answer
37
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
72
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 ...
2
votes
2
answers
80
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
134
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 ...
3
votes
2
answers
201
views
How to use polkadot js typescript Typegen to decorate api for runtime
I am 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
111
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
122
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
53
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 ...
1
vote
2
answers
75
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
32
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 ...
0
votes
1
answer
75
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
100
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
85
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
133
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
273
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 ...
0
votes
1
answer
55
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
258
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 ...
0
votes
1
answer
122
views
how to verify that my validator has the right session keys
I want to write a sanity check that my node has the right session keys configured, based on the stash address:
let nextKeys = await api.query.session.nextKeys(stash_account);
console.log(`Node's ...
2
votes
2
answers
139
views
How to get StorageKey associated with an address?
StorageKey keyword mentioned in the RPC substrate docs and polkadotJS RPC API docs
https://polkadot.js.org/docs/substrate/rpc#getkeyskey-storagekey-at-blockhash-vecstoragekey
How to get this ...
0
votes
1
answer
35
views
How can I listen to new receive transfer?
I want to listen to new transfers and get the hash and amount.
How can I?
Also, Can I get list transfers of account like this url?
https://westend.subscan.io/account/...
2
votes
2
answers
52
views
api.derive.crowdloan.contributions: Expected hex value to convert, found '0x'
Context:
I'm trying to fetch datas from an ended crowdloan.
The crowdloan is on kusama, for parachain id 2113.
I first connect:
async function connect() {
let endpoint = config.endpoint;
...
2
votes
1
answer
70
views
Polkadot.js API how to add the name of an item and collection of NFT's using uniques
could someone help me with this please.
I am using the polkadot.js explorer to add a collection of NFT's to a chain. I can add the collection using this.
Does anyone know how to add the name of an ...
0
votes
3
answers
169
views
Is there a way to integrate polkadot wallet with unity?
I am making an application in C# unity and trying to integrate polkadot wallet in the application. I want to know whether it's possible to use the polkadot wallet browser extension to sign personal ...
2
votes
2
answers
99
views
Help needed with payloads and extrinsics
I know that the payload and extrinsics are dynamic, and even different between parachains/base chains(kusama,polkadot,rococo,westend). But I am struggling to find good documentation on how these ...
1
vote
1
answer
157
views
get bonded balance using API
This is how to get the free balance of an account:
api.query.system.account(stash_account_address).data.free.toBigInt()
How to get the bonded balance instead?
1
vote
1
answer
99
views
Query account balance with HTTP calls
maybe a silly question... Is possible to query a balance using a HTTP call like eth_getBalance? I need a raw http call, like one that i can perform with curl.
I looked the methods that polkadot RPC ...
3
votes
1
answer
163
views
Dev Substrate Node at Capacity for WS Connections, how to flush?
I'm running a node in dev mode: ./substrate/target/release/substrate --dev --tmp --ws-external
My client connection code:
provider = new WsProvider(wsProvider)
api = await new ApiPromise({ provider })....
0
votes
1
answer
59
views
Runtime API to collect values in StorageMap
I'm trying to retrieve all values in my StorageMap defined as such in my pallet:
#[pallet::storage]
#[pallet::getter(fn submitted_tasks)]
pub type SubmittedTasks<T: Config> =
StorageMap<_,...
0
votes
1
answer
78
views
DRR: createType(ExtrinsicStatus):: Cannot map Enum JSON, unable to find 'reason' in future, ready, broadcast, inblock, retracted, finalitytimeout
When I run the following code in some calls I get the following errors:
DRR: createType(ExtrinsicStatus):: Cannot map Enum JSON, unable to find 'reason' in future, ready, broadcast, inblock, ...
3
votes
2
answers
93
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 ...
5
votes
2
answers
118
views
How to use Polkadot.js API for governance proxy call correctly?
I am trying to create a JS code to be able to vote using proxy account that has been given democracy permissions to stash account, so I would be able to vote using just my mobile phone instead of ...
0
votes
1
answer
65
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 ...