Overview
Retrieves information about a specific access key associated with a NEAR account, including its permissions, nonce, and allowed operations.Method Signatures
Throwable Variant
Safe Variant
Result object that contains either the success value or error, never throws.
Parameters
The account ID to query the access key for.
The public key to query. Format:
ed25519:<base58-encoded-key> or secp256k1:<base58-encoded-key>.Example: ed25519:5BGSaf6YjVm7565VzWQHNxoyEjwr3jUpRJSGjREvU9dBQuery access key state at a specific block. Can be:
'LatestOptimisticBlock'- Latest optimistic block (default)'LatestNearFinalBlock'- Latest near-final block'LatestFinalBlock'- Latest final block{ blockHash: BlockHash }- Specific block by hash{ blockHeight: BlockHeight }- Specific block by height'EarliestAvailableBlock'- Earliest available block'GenesisBlock'- Genesis block
Configuration for transport behavior.
Transport-specific policies like retry behavior and timeout settings.
Additional execution options.
AbortSignal to cancel the request.
Return Type
Hash of the block where the access key state was queried.
Height of the block where the access key state was queried.
The queried account ID.
The access key information. Can be either a
FullAccessKey or FunctionCallKey.FullAccessKey
Indicates this is a full access key.
The public key.
Current nonce for the key (used for transaction ordering).
FunctionCallKey
Indicates this is a function call access key.
The public key.
Current nonce for the key.
The contract account this key is allowed to call.
Maximum gas budget for function calls (if set).
Specific functions this key can call (if restricted). If undefined, can call any function.
Raw RPC result from the NEAR node.
Error Codes
When usingsafeGetAccountAccessKey, the following error codes may be returned:
Client Errors
Client.GetAccountAccessKey.Args.InvalidSchema- Invalid arguments providedClient.GetAccountAccessKey.PreferredRpc.NotFound- Preferred RPC endpoint not foundClient.GetAccountAccessKey.Timeout- Request timed outClient.GetAccountAccessKey.Aborted- Request was abortedClient.GetAccountAccessKey.Exhausted- All retry attempts exhausted
RPC Errors
Client.GetAccountAccessKey.Rpc.AccountAccessKey.NotFound- Access key not found for this accountClient.GetAccountAccessKey.Rpc.NotSynced- Node is not syncedClient.GetAccountAccessKey.Rpc.Shard.NotTracked- Shard is not tracked by this nodeClient.GetAccountAccessKey.Rpc.Block.GarbageCollected- Block has been garbage collectedClient.GetAccountAccessKey.Rpc.Block.NotFound- Block not found
Internal Errors
Client.GetAccountAccessKey.Internal- Internal library error