> For the complete documentation index, see [llms.txt](https://near-sdk-js.gitbook.io/near-sdk-js/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://near-sdk-js.gitbook.io/near-sdk-js/promise/classes/addaccesskey.md).

# AddAccessKey

[**promise**](/near-sdk-js/promise.md) • **Docs**

***

[near-sdk-js v2.0.0](/near-sdk-js/packages.md) / [promise](/near-sdk-js/promise.md) / AddAccessKey

## Class: AddAccessKey

A add access key promise action.

### Extends

* [`PromiseAction`](/near-sdk-js/promise/classes/promiseaction.md)

### Constructors

#### new AddAccessKey()

> **new AddAccessKey**(`publicKey`, `allowance`, `receiverId`, `functionNames`, `nonce`): [`AddAccessKey`](/near-sdk-js/promise/classes/addaccesskey.md)

**Parameters**

• **publicKey**: [`PublicKey`](/near-sdk-js/types/public_key/classes/publickey.md)

The public key to add as a access key.

• **allowance**: `bigint`

The allowance for the key in yoctoNEAR.

• **receiverId**: `string`

The account ID of the receiver.

• **functionNames**: `string`

The names of functions to authorize.

• **nonce**: `bigint`

The nonce to use.

**Returns**

[`AddAccessKey`](/near-sdk-js/promise/classes/addaccesskey.md)

**Overrides**

[`PromiseAction`](/near-sdk-js/promise/classes/promiseaction.md).[`constructor`](/near-sdk-js/promise/classes/promiseaction.md#constructors)

**Defined in**

[packages/near-sdk-js/src/promise.ts:258](https://github.com/near/near-sdk-js/blob/b58ac04fc6dff2f1120e9098c0cb059493486598/packages/near-sdk-js/src/promise.ts#L258)

### Properties

#### allowance

> **allowance**: `bigint`

The allowance for the key in yoctoNEAR.

**Defined in**

[packages/near-sdk-js/src/promise.ts:260](https://github.com/near/near-sdk-js/blob/b58ac04fc6dff2f1120e9098c0cb059493486598/packages/near-sdk-js/src/promise.ts#L260)

***

#### functionNames

> **functionNames**: `string`

The names of functions to authorize.

**Defined in**

[packages/near-sdk-js/src/promise.ts:262](https://github.com/near/near-sdk-js/blob/b58ac04fc6dff2f1120e9098c0cb059493486598/packages/near-sdk-js/src/promise.ts#L262)

***

#### nonce

> **nonce**: `bigint`

The nonce to use.

**Defined in**

[packages/near-sdk-js/src/promise.ts:263](https://github.com/near/near-sdk-js/blob/b58ac04fc6dff2f1120e9098c0cb059493486598/packages/near-sdk-js/src/promise.ts#L263)

***

#### publicKey

> **publicKey**: [`PublicKey`](/near-sdk-js/types/public_key/classes/publickey.md)

The public key to add as a access key.

**Defined in**

[packages/near-sdk-js/src/promise.ts:259](https://github.com/near/near-sdk-js/blob/b58ac04fc6dff2f1120e9098c0cb059493486598/packages/near-sdk-js/src/promise.ts#L259)

***

#### receiverId

> **receiverId**: `string`

The account ID of the receiver.

**Defined in**

[packages/near-sdk-js/src/promise.ts:261](https://github.com/near/near-sdk-js/blob/b58ac04fc6dff2f1120e9098c0cb059493486598/packages/near-sdk-js/src/promise.ts#L261)

### Methods

#### add()

> **add**(`promiseIndex`): `void`

The method that describes how a promise action adds it's *action* to the promise batch with the provided index.

**Parameters**

• **promiseIndex**: [`PromiseIndex`](/near-sdk-js/utils/type-aliases/promiseindex.md)

The index of the promise batch to attach the action to.

**Returns**

`void`

**Overrides**

[`PromiseAction`](/near-sdk-js/promise/classes/promiseaction.md).[`add`](/near-sdk-js/promise/classes/promiseaction.md#add)

**Defined in**

[packages/near-sdk-js/src/promise.ts:268](https://github.com/near/near-sdk-js/blob/b58ac04fc6dff2f1120e9098c0cb059493486598/packages/near-sdk-js/src/promise.ts#L268)
