Questions tagged [near-api-js]
11 questions
4
votes
0 answers
How to get basic info of near wallet from near api?
I am trying to get the basic info shown in the near wallet using near API.
I want to fetch the info regarding stake and staking reward, basically all the info like:-
I am able to get the stacked near amount but not getting Reward earned, Pending…

Mohit Chandel
- 1,838
- 10
- 31
2
votes
2 answers
Unable to transfer NEAR tokens between accounts using near-api-js
I am trying to transfer NEAR tokens between 2 testnet wallets using the near-api-js library in NextJS
Running send money function of the account, I am getting the following error
import { connect, keyStores } from "near-api-js";
export const…

Sandeep Singh
- 71
- 8
2
votes
0 answers
Near Pagoda Trying to connect to https://rpc.testnet.near.org/ but getting CORS
folks, trying to connect to Pagoda via near-api-js
const CONTRACT_NAME = process.env.CONTRACT_NAME || 'mycontract.testnet'
const API_KEY = '06cffba5-e0c5-bla-bla-blablabla';
const keyStore = new keyStores.BrowserLocalStorageKeyStore();
My config…

kiskesis
- 171
- 1
- 1
- 9
1
vote
1 answer
nearprotocol - best way to pay transaction fees for contract users
I want to pay all costs for some contract users (probably forever). The idea is to incorporate more users in NEAR ecosystem and provide them the ability to use my contract for free for easier onboarding.
The scenario similar to the one described in…

Vsevolod
- 87
- 6
1
vote
2 answers
Cannot Perform ViewFunction from near-api-js in Macos zsh but it works fine in Powershell
I've run into some error while trying to perform near-api-js viewFunction.
I've made a script to check for storage balance of an accountId parse from the API body.
When i receive the accountId parse from the API i parse into this ftGetStorageBalance…

hqphuoc129
- 13
- 2
1
vote
1 answer
Near Protocol Unknown arguments
It might be a stupid question, but I am trying to learn how to work with Near Protocol in Near academy.
In chapter 6, you have a task to login to NEAR using CLI, register yourself as a meme museum contributor and register your meme.
Link to the…

hjugo
- 13
- 3
1
vote
1 answer
near-api-js: how to create a new function access key after allowance is spent on the first?
After logging in to a NEAR app with near-api-js (walletConnection.requestSignin()) you get a function access key with 0.25N allowance. This makes it possible to call the contract without confirming the transaction. When the allowance is spent all…

Peter Salomonsen
- 5,525
- 2
- 24
- 38
0
votes
0 answers
Get block hash from a receipt id in Near blockchain localnet
On sending the function call txn using near-api-js, I only receive receipt id (as shown in the logs) and from the docs , it looks like I cannot get the block hash just from receipt id.
How can I get the block hash or timestamp of a txn from receipt…

Parshant Singh
- 81
- 4
0
votes
0 answers
A react(typescript) project that uses Near api js works in dev but not preview mode
Am using a react project(typescript) with vite, the project interacts with a deployed sample donations smart contract.
The project works as expected in dev mode but once built and deployed I encounter the following error in the console.
I have…

kenn
- 1,384
- 12
- 19
0
votes
1 answer
NEAR Protocol JsonRpcProvider(url?: string) deprecated use `JsonRpcProvider(connectionInfo: ConnectionInfo)` instead
I'm initiating API/RPC connection to NEAR Protocol using JsonRpcProvider like that:
const provider = new nearAPI.providers.JsonRpcProvider(
`https://rpc.${networkId}.near.org`
)
I'm getting this warning
JsonRpcProvider(url?: string) deprecated…

MSaudi
- 4,442
- 2
- 40
- 65
-1
votes
1 answer
Why is there an error in this contract call?
new to nearprotocol! Trying to do a little hello world using near-api-js, here is my issue ...
const { keyStores, connect } = require("near-api-js");
const fs = require("fs");
const path = require("path");
const homedir =…

AKRA
- 300
- 2
- 12