Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion docs/docs/developers/guides/js_apps/pay_fees.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ Processing this transaction first claims bridged fee juice then is paid for from

A fee paying contract (FPC) is created and nominates a token that it accepts to then pay for txs in fee juice. So a user doesn't need to hold fee juice, they only need the token that the FPC accepts.

### Sponsored Fee Paying Contract (SponsoredFPC)

The most straightforward way to pay for a transaction is via the sponsored fee payment method, bootstrapping some transactions by skipping the need to bridge fee juice to the account. This method uses a type of fee paying contract configured to pay for a number of transactions without requiring payment.

## Bridging fee-juice

To first get fee juice into an account it needs to be bridged from L1.
To first get fee juice into an account it needs to be bridged from L1. You can skip this section if you want to first make a transaction via the SponsoredFPC.

:::note
See here to [Bridge Fee Juice](../../../developers/reference/environment_reference/cli_wallet_reference#bridge-fee-juice) via the CLI wallet.
Expand Down Expand Up @@ -88,6 +92,21 @@ With the fee options explained, lets do a paid transaction.

## Examples

### Sponsored Fee Paying Contract

Creating the SponsoredFPC is as simple as passing it the PXE:
```ts
const paymentMethod = await SponsoredFeePaymentMethod.new(pxe);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unclear how to import it because it isn't in aztec.js?

```

Then a transaction can specify this as the `paymentMethod` in the fee object.
For example, a contract can be deployed with an fpc as follows:

```ts
const paymentMethod = await SponsoredFeePaymentMethod.new(pxe);
myAccountManager.deploy({ fee: { paymentMethod } });
```

### Pay with FeeJuice

To send a transaction from an already deployed account already holding fee juice:
Expand Down