> For the complete documentation index, see [llms.txt](https://yuga.gitbook.io/zkyuga-whitepaper/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yuga.gitbook.io/zkyuga-whitepaper/developer-guide/erc20/getallowance.md).

# getAllowance

## `getAllowance`

The `getAllowance` function determines the number of tokens an owner has authorized another Ethereum address to expend on their behalf. It is commonly used in conjunction with token approvals, particularly in scenarios where a smart contract needs permission to move tokens on behalf of an owner. This function is a property of the ERC20Instance object, which is obtained through the `getERC20Instance` method of the `ZkyugaClient`.

### Method Signature

```javascript
getAllowance(owner: string, spender: string): Promise<BigNumber>
```

#### Parameters

| Parameter | Type   | Description                                                               |
| --------- | ------ | ------------------------------------------------------------------------- |
| owner     | string | The Ethereum address of the token owner.                                  |
| spender   | string | The Ethereum address authorized to utilize tokens on behalf of the owner. |

#### Returns

* A Promise that resolves to a Bi`BigNumber`gNumber representing the quantity of tokens that the `spender` can withdraw from the `owner`.

### Usage Example

To begin, initialize the desired ERC20 token contract using its designated address:

```javascript
const erc20 = zkyugaClient.getERC20Instance("0xaC405eCD43eD9cEbd8621E8dA0D02196a55425B6");
```

Next, call the `getAllowance` function, providing the Ethereum addresses of the token owner and the spender:

```javascript
const ownerAddress = "0xaC405eCD43eD9cEbd8621E8dA0D02196a55425B6";
const spenderAddress = "0xaC405eCD43eK7cEbd8621R2dA0D02894a83794K9";
const allowance = await erc20.getAllowance(ownerAddress, spenderAddress);
```

### Considerations

* The disclosed allowance will be in the smallest unit of the ERC20 token (such as Wei for Ether). Depending on the token's decimals, you may need to convert this value into a format more easily understood by humans.
* An allowance value of 0 indicates that the `spender` currently lacks permission to transfer any tokens on behalf of the `owner`.

***
