# Go Gasless

With Cometh Connect, you can pay the transaction gas fees of your users. You will need to add the contract address of your transaction as a sponsored address for your project. Remember, the contract address corresponds to the "to" field of your transaction.&#x20;

To authorize the sponsorship of a given contract address, you need to add it to your sponsored addresses in the dashboard. From there, we will accept sponsoring transactions targeting this contract.

<figure><img src="/files/soKWQVrACsmLaTAjxhMa" alt=""><figcaption><p>Add a sponsored contract address</p></figcaption></figure>

{% hint style="info" %}
At the end of each month, you will receive an invoice with the total amount of gas fees covered. This fee is then billed through the payment method in your Cometh Connect account.

With Cometh Connect, there is no overhead on the price you pay. Depending on your license type, you have a max number of transactions you can sponsor each month.
{% endhint %}

More details about the Cometh paymaster API :

{% content-ref url="/pages/wahxvj734Q7seLkBBbBp" %}
[Paymaster API](/paymaster/paymaster-api.md)
{% endcontent-ref %}

## Paymaster client

You'll first need to instantiate a paymaster Client, you'll need to get a **paymasterUrl from the cometh dashboard.**

{% tabs %}
{% tab title="TS" %}

```typescript
import { createComethPaymasterClient } from "@cometh/connect-sdk-4337";

const paymasterClient = await createComethPaymasterClient({
    transport: http(paymasterUrl),
    chain,
    publicClient,
})
```

{% endtab %}
{% endtabs %}

You'll then need to add a paymaster methods on your client creation: **getUserOperationGasPrice**.

{% tabs %}
{% tab title="TS" %}

```typescript
const smartAccountClient = createSmartAccountClient({
    account: smartAccount,
    chain,
    bundlerTransport: http(bundlerUrl),
    paymaster: paymasterClient,
    userOperation: {
        estimateFeesPerGas: async () => {
            return await paymasterClient.getUserOperationGasPrice();
        },
    },
})
```

{% endtab %}
{% endtabs %}

Here is the full overview:

{% tabs %}
{% tab title="TS" %}

```typescript
import { createSafeSmartAccount, 
createSmartAccountClient,
createComethPaymasterClient } from "@cometh/connect-sdk-4337";
import { encodeFunctionData } from "viem";
import countContractAbi from "@/contract/counterABI.json";

const apiKey = process.env.COMETH_API_KEY;
const bundlerUrl = process.env.4337_BUNDLER_URL;
const paymasterUrl = process.env.4337_PAYMASTER_URL

 const publicClient = createPublicClient({
    chain: arbitrumSepolia,
    transport: http(),
    cacheTime: 60_000,
    batch: {
        multicall: { wait: 50 },
    },
});


const smartAccount = await createSafeSmartAccount({
    apiKey,
    publicClient,
    chain: arbitrumSepolia,
});

const paymasterClient = await createComethPaymasterClient({
    transport: http(paymasterUrl),
    chain,
    publicClient,
})
    
const smartAccountClient = createSmartAccountClient({
    account: smartAccount,
    chain,
    paymaster: paymasterClient,
    userOperation: {
        estimateFeesPerGas: async () => {
            return await paymasterClient.getUserOperationGasPrice();
        },
    }
})

// Counter address that is sponsored
const COUNTER_CONTRACT_ADDRESS = "0x4FbF9EE4B2AF774D4617eAb027ac2901a41a7b5F";

const calldata = encodeFunctionData({
  abi: countContractAbi,
  functionName: "count",
});

const txHash =  await smartAccountClient.sendTransaction(
  {
    to: COUNTER_CONTRACT_ADDRESS,
    data: calldata,
  }
);
```

{% endtab %}
{% endtabs %}

###


---

# 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.cometh.io/core-features/go-gasless.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.
