# Module & Function Whitelist

With this module & function whitelisting dapps can sponsor only transactions from a whitelisted modules and functions.

## Using SDK

### Function Whitelist

To add function to whitelist

```typescript
;(async () => {
  const projectKey = process.env.PROJECT_KEY as string
  const privateKey = process.env.PRIVATE_KEY as string
  const paymasterSdk = new PaymasterSdk({ privateKey: privateKey }, { projectKey: projectKey, network: Network.TESTNET chain: chainName.Aptos})
  // chain by default aptos
  // network by default mainnet
  const addWhitelistFunctionsResponse = await paymasterSdk.addWhitelistFunctions({
    functions: [
      {
        module_name: 'aptos_account',
        function_name: 'batch_transfer_coins',
        module_address: '0x1',
      },
    ],
  })
  console.log('addWhitelistFunctionsResponse', addWhitelistFunctionsResponse)
})()

```

## Dashboard

On the dashboard you can manually add functions to whitelist.

<figure><img src="/files/uBtrnhvFwBD6dRPWyOGd" alt=""><figcaption><p>Function Whitelist</p></figcaption></figure>

## Module Whitelist Function

To add module to whitelist

```typescript
;(async () => {
  const projectKey = process.env.PROJECT_KEY as string
  const privateKey = process.env.PRIVATE_KEY as string
  const paymasterSdk = new PaymasterSdk({ privateKey: privateKey }, { projectKey: projectKey, network: Network.TESTNET })
  // chain by default aptos
  // network by default mainnet
  const addModuleWhitelistFunctionsResponse = await paymasterSdk.addModuleWhitelistFunctions({
    functions: [
      {
        module_address: '0x1',
      },
    ],
  })
  console.log('addModuleWhitelistFunctionsResponse', addModuleWhitelistFunctionsResponse)
})()

```

## Dashboard

On the dashboard you can manually add module address to whitelist.<br>

<figure><img src="/files/SPYXC37nb1BoUrcUmRpc" alt=""><figcaption><p>Module Whitelist</p></figcaption></figure>


---

# 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.kanalabs.io/paymaster-service/kana-paymaster-for-aptos-and-supra/module-and-function-whitelist.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.
