findSeatPrice not accessible
See original GitHub issueI am unable to getSeatPrice from the API. I have tried many options and tried to recompile the code with different import/export permutations.
There is an existing reference to validators in the compiled js that references a function. I believe they get removed. See https://devblogs.microsoft.com/typescript/announcing-typescript-3-8-beta/#type-only-imports-exports
ERROR:
Uncaught (in promise) TypeError: Cannot read property 'findSeatPrice' of undefined
BASIC SETUP Index.js
const { validators } = require('near-api-js');
async function validatorsInfo(near, epochId) {
const genesisConfig = await near.connection.provider.sendJsonRpc('EXPERIMENTAL_genesis_config', {});
const result = await near.connection.provider.sendJsonRpc('validators', [epochId]);
result.genesisConfig = genesisConfig;
result.numSeats = genesisConfig.num_block_producer_seats + genesisConfig.avg_hidden_validator_seats_per_shard.reduce((a, b) => a + b);
return result;
}
async function initContract() {
const result = await validatorsInfo(near, null);
const seatPrice = validators.findSeatPrice(result.current_validators, result.numSeats);
...
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Releases · near/near-api-js - GitHub
findAccessKey() now throws a typed error if no key exists in keystore for the current ... We are working towards modularization of the...
Read more >Mapping Seats for Concert Reservations in WordPress ...
Now your website has a working and interactive hall layout integrated. It responds to hover events and seat selection but it is not...
Read more >Google Flight Tickets To India From Usa Departing Tue Jan
Cheap Flights India. New Delhi From $594 Non-stop. Ahmedabad From $600 1+ stops. Mumbai From $600 1+ stops. Chennai From $605 1+ stops....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

this is fixed here AFAIK https://github.com/near/near-api-js/releases/tag/v0.26.0
@chadoh sorry didn’t see your comment here and just decided to fix as needed to cut release with other stuff (like new RPCs)
We have a separate
browser-index.jsfile that is used as the entry point for browsers, whileindex.jsis used as the entry point for nodejs. It looks like the two have become out-of-sync;browser-index.jsdoes not import & re-exportvalidatorsthe way thatindex.jsdoes. My guess is that the other classes/types you noticed probably stem from the same issue.I will extract the common exports to a
common-index.jsto make sure this doesn’t happen going forward, and so that you can stop using thenear-api-js/lib/...workaround.