Skip to main content
These are the properties accepted by the Near class constructor.
const near = new Near({
  network: "testnet",
  privateKey: "...",
})

Network

Controls which NEAR network to connect to.
network
string | NetworkConfig
required
The network to connect to.Presets: "mainnet", "testnet", "localnet"Custom config:
{
  networkId: "my-private-net",
  rpcUrl: "http://127.0.0.1:3030"
}
Sandbox: Passing a Sandbox instance automatically configures RPC and the root account key.
rpcUrl
string
Override the RPC URL for a preset network (e.g., to use a specific provider like Infura or Lava).
headers
Record<string, string>
Custom HTTP headers for RPC requests.
{ "Authorization": "Bearer ..." }

Credentials & Signing

near-kit checks these in order: wallet > signer > privateKey > keyStore.
privateKey
string
A single private key (ed25519:...). Useful for scripts.
keyStore
KeyStore
A storage backend for multiple keys.
KeyStoreEnvironmentDescription
InMemoryKeyStoreAnyDefault, keys in memory
FileKeyStoreNode.jsStores in ~/.near-credentials
NativeKeyStoreNode.jsmacOS Keychain / Windows Credential Manager
RotatingKeyStoreAnyFor high-concurrency apps
wallet
WalletAdapter
A wrapper around a browser wallet.
wallet: fromWalletSelector(wallet)
signer
(hash: Uint8Array) => Promise<Signature>
A custom signing function. Use this for hardware wallets, KMS, or multi-sig logic.
defaultSignerId
string
The account ID to use when calling near.transaction() without arguments.

Execution Behavior

defaultWaitUntil
string
default:"EXECUTED_OPTIMISTIC"
Controls how long .send() waits before returning.
ValueDescription
"INCLUDED"Return as soon as the network accepts it (fastest, no result value)
"EXECUTED_OPTIMISTIC"Transaction is executed and result is available (default)
"FINAL"Wait for BFT finality (safest, slowest)
retryConfig
object
Configuration for automatic retries on network errors.