# modifyTokenSupply

The `modifyTokenSupply()` operation allows you to **mint** (increase) or **burn** (decrease) the total supply of a token on KeetaNet. This is a low-level supply management tool that modifies the global token supply stored in a given token account.

This operation is part of the transaction builder and must be **published** to take effect.

## When to Use

* Minting new tokens to increase supply (e.g. when issuing rewards or enabling inflation).
* Burning tokens to reduce supply (e.g. for deflationary models or manual corrections).
* Dynamically adjusting circulating supply in response to governance or economic rules.

## How It Works

{% stepper %}
{% step %}

### Get a Token Account

You need the token account you want to modify. This is usually derived from a known public key.

```typescript
const tokenAccount = Client.lib.Account.fromPublicKeyString(tokenPublicKey)
```

{% endstep %}

{% step %}

### Initialize a Builder

Start a transaction builder using `userClient.initBuilder()`.

```typescript
const builder = userClient.initBuilder()
```

{% endstep %}

{% step %}

### Call `modifyTokenSupply()`

Provide an amount and a token account:

* Positive values **mint** tokens.
* Negative values **burn** tokens.\
  The amount must be an integer or a BigNumber.

```typescript
const builder = userClient.initBuilder()
builder.modifyTokenSupply(1000n, { account: tokenAccount }) // Mint 1000 tokens
await userClient.publishBuilder(builder)

const builder = userClient.initBuilder()
builder.modifyTokenSupply(-500n, { account: tokenAccount }) // Burn 500 tokens
await userClient.publishBuilder(builder)
```

{% endstep %}

{% step %}

### Publish the Builder

Send the transaction to the network using `userClient.publishBuilder()`

```typescript
await userClient.publishBuilder(builder)
```

{% endstep %}
{% endstepper %}

## Full Example

```typescript
// Step 1: Load token account
const tokenAccount = Client.lib.Account.fromPublicKeyString(tokenPublicKey)
if (!tokenAccount.isToken()) {
  throw new Error("Invalid token public key")
}

// Step 2: Start builder
const builder = userClient.initBuilder()

// Step 3a: Burn 100 tokens
builder.modifyTokenSupply(-100n, { account: tokenAccount })
// Step 3b: Or mint 100 tokens
builder.modifyTokenSupply(100n, { account: tokenAccount })

// Step 4: Publish the transaction
await userClient.publishBuilder(builder)

```

## Method

```typescript
modifyTokenSupply(
  amount: BigNumber | number,
  options: {
    account: Account; // The token account whose supply you're modifying
  }
): void
```


---

# 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.keeta.com/components/blocks/operations/modifytokensupply.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.
