# NEAR Provider API

## Properties

### near.isSender

`true` if the user has Sender installed.

## Methods

### near.**requestSignIn()**&#x20;

```javascript
/**
* request signin the contract, with the view and change methods provided, return the access key
* @param {*} contractId contract account id
* @param {*} methodNames the method names on the contract that should be allowed to be called. Pass null for no method names and '' or [] for any method names.
* @param {*} createNew if need create new access key, set createNew = true. Default is false
* @returns { accessKey } signed in access key
*/
near.requestSignIn({ contractId, methodNames, createNew = false }): Promise<Result>
```

Request sign in with the contract, given the needed view and change methods, return the access key (The response might be changed in future version).

```javascript
const contractId = 'guest-book.testnet';
const methodNames = ['addMessage'];
const res = await window.near.requestSignIn({ contractId, methodNames });
```

### near.signOut()

```
/**
* @param {*} contractId contract account id (options)
*/
near.signOut({ contractId }): Promise<Result>;
```

Sign out  the access key from this account and then clean the signed in access key from the storage. Must need to pass the specific contractId if one dapp has multiple contractId.

### near.isSignedIn()

```javascript
/**
* @param {*} contractId contract account id (options)
*/
near.isSignedIn({ contractId }): boolean;
```

Check whether the current account has signed in. Must need to pass the specific contractId if one dapp has multiple contractId.

### near.getAccountId()

```javascript
near.getAccountId(): string;
```

The current selected NEAR account ID

### <mark style="color:blue;">\[Work-In Progress]</mark> near.account()

```
near.account(): Account;
```

Return an instance of the `account` object in [near-api-js](http://github.com/near/near-api-js) . The usage can be found in the [documentation here](https://docs.near.org/docs/api/naj-quick-reference#account).&#x20;

### near.**signAndSendTransaction()**

```
near.signAndSendTransaction({ receiverId: string, actions: Action}): Response;
```

Send one single transaction

### **near.requestSignTransactions()**

```
near.requestSignTransactions(options: SignAndSendTransactionOptions): void;
```

Send multiple transactions in batch

### near.request()

```
near.request(method: string, params: Object): Object;
```

Use `request` to submit [RPC requests](https://docs.near.org/docs/api/rpc) to NEAR blockchain via Sender.&#x20;

## Events

### signIn

An account has signed in

```javascript
near.on("signIn", (() => {
  // TODO if account has signed in
});
```

### signOut

The current account has signed out

```javascript
near.on("signOut", (() => {
  // TODO if account has been signed out
});
```

### **accountChanged**

Listen to the current account changed

```javascript
near.on("accountChanged", ((changedAccountId) => {
  // TODO if account has changed
});
```

### rpcChanged

Listen to the current RPC URL changed

```javascript
near.on("rpcChanged", ((response) => {
  // TODO if rpc has changed
});
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.senderwallet.io/api-reference/near/near-provider-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
