Skip to content

Commit 8d72661

Browse files
committed
feat(docs): add new guide how to mint directly FAssets
1 parent caeeeb9 commit 8d72661

11 files changed

Lines changed: 238 additions & 7 deletions

docs/fassets/developer-guides.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ Guides for [minting FAssets](/fassets/minting) from underlying assets.
4242

4343
<DocCardList
4444
items={[
45+
{
46+
type: "link",
47+
label: "Direct Mint FXRP",
48+
href: "/fassets/developer-guides/fassets-direct-minting",
49+
docId: "fassets/developer-guides/fassets-direct-minting",
50+
},
4551
{
4652
type: "link",
4753
label: "Mint FAssets",

docs/fassets/developer-guides/9-fassets-agent-details.mdx renamed to docs/fassets/developer-guides/10-fassets-agent-details.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ tags: [intermediate, fassets]
44
slug: fassets-agent-details
55
description: Learn how to read FAssets agent details
66
keywords: [fassets, flare-network]
7-
sidebar_position: 9
7+
sidebar_position: 10
88
---
99

1010
import CodeBlock from "@theme/CodeBlock";

docs/fassets/developer-guides/10-fassets-redemption-default.mdx renamed to docs/fassets/developer-guides/11-fassets-redemption-default.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ tags: [intermediate, fassets]
44
slug: fassets-redemption-default
55
description: Monitor and handle redemption scenarios
66
keywords: [fassets, flare-network]
7-
sidebar_position: 10
7+
sidebar_position: 11
88
---
99

1010
import YouTubeEmbed from "@site/src/components/YouTubeEmbed";

docs/fassets/developer-guides/11-fassets-redemption-queue.mdx renamed to docs/fassets/developer-guides/12-fassets-redemption-queue.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ tags: [intermediate, fassets]
44
slug: fassets-redemption-queue
55
description: Learn how to get the redemption queue
66
keywords: [fassets, flare-network]
7-
sidebar_position: 11
7+
sidebar_position: 12
88
---
99

1010
import CodeBlock from "@theme/CodeBlock";
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
title: Direct Mint FXRP
3+
tags: [intermediate, fassets]
4+
slug: fassets-direct-minting
5+
description: Mint FXRP in a single XRPL payment using direct minting.
6+
keywords: [fassets, fxrp, direct-minting, flare-network, xrpl]
7+
sidebar_position: 5
8+
---
9+
10+
import CodeBlock from "@theme/CodeBlock";
11+
import FAssetsDirectMinting from "!!raw-loader!/examples/developer-hub-javascript/fassetsDirectMinting.ts";
12+
13+
## Overview
14+
15+
This guide walks you through minting FAssets FXRP using [direct minting](/fassets/direct-minting): a single XRPL payment to the FXRP [Core Vault](/fassets/core-vault) with a memo that encodes the Flare-side recipient.
16+
An executor then finalizes the mint on Flare, and the recipient receives FXRP.
17+
18+
The complete runnable example is available in the [flare-viem-starter](https://github.com/flare-foundation/flare-viem-starter/blob/main/src/fassets/direct-mint.ts) repository.
19+
20+
## How it differs from standard minting
21+
22+
Compared to the standard [collateral reservation flow](/fassets/developer-guides/fassets-mint), direct minting is a single-step XRPL payment:
23+
24+
- No collateral reservation — the minter does not call [`reserveCollateral`](/fassets/developer-guides/fassets-mint#reserve-collateral) and there is no agent selection.
25+
- A single XRPL payment to the Core Vault address replaces the agent payment.
26+
- The recipient (and optionally the executor) is encoded in the XRPL memo or destination tag.
27+
- An executor calls `executeDirectMinting` on Flare to finalize and receives a flat fee.
28+
29+
This guide demonstrates the **32-byte memo format**, where the recipient is a Flare address and any executor can finalize.
30+
31+
## Prerequisites
32+
33+
- [Flare smart account](/smart-accounts/overview) controlled by your XRPL wallet.
34+
- Testnet XRP on the XRP Ledger Testnet usage.
35+
Get testnet XRP from the [XRP Testnet Faucet](https://xrpl.org/resources/dev-tools/xrp-faucets).
36+
37+
## Direct Minting Memo
38+
39+
The memo is a packed 32-byte [`PaymentReference`](/fassets/direct-minting#memo-field):
40+
41+
| Bytes | Value | Meaning |
42+
| :---- | :----------------- | :------------------------------------------------------------ |
43+
| 0-7 | `4642505266410018` | Direct minting prefix. |
44+
| 8-11 | `00000000` | Zero padding to fill the 32-byte memo. |
45+
| 12-31 | 20-byte recipient | EVM address of the Flare smart account receiving FXRP tokens. |
46+
47+
Because no executor is encoded, anyone can finalize this minting on Flare.
48+
For executor-restricted minting, use the 48-byte memo format described in [Memo Field](/fassets/direct-minting#memo-field).
49+
50+
## Direct Minting Script
51+
52+
<CodeBlock language="typescript" title="src/fassets/direct-mint.ts">
53+
{FAssetsDirectMinting}
54+
</CodeBlock>
55+
56+
## Code Breakdown
57+
58+
1. Define the direct minting prefix constant `DIRECT_MINTING_PREFIX`.
59+
2. `buildDirectMintingMemo` concatenates the prefix, four zero bytes, and the recipient address (without the `0x` prefix, lowercased) into a 32-byte hex string ready to be passed as [`MemoData`](https://xrpl.org/docs/references/protocol/transactions/common-fields#memos-field) on the XRPL payment.
60+
3. `sendDirectMintPayment` builds the memo for the recipient and submits an XRPL `Payment` transaction to the [Core Vault](/fassets/core-vault) address with `memos: [{ Memo: { MemoData } }]`, returning the resulting transaction.
61+
4. Set the net FXRP amount to mint in XRP. Minting and executor fees are added to the net amount to form the XRPL payment amount.
62+
5. Connect to the XRPL Testnet using `XRPL_TESTNET_RPC_URL` and load the sender wallet from `XRPL_SEED`.
63+
6. Resolve the recipient — the Flare [`PersonalAccount`](/smart-accounts/reference/IPersonalAccount) for the XRPL wallet — via [`getPersonalAccountAddress`](/smart-accounts/reference/IPersonalAccount), and look up `AssetManagerFXRP` through the [Flare Contract Registry](/network/guides/flare-contracts-registry) using [`getContractAddressByName`](/network/guides/flare-contracts-registry).
64+
7. Read three values in parallel:
65+
- `getDirectMintingPaymentAddress` — the Core Vault XRPL address that receives the payment.
66+
- `getFxrpBalance` — the recipient's FXRP balance before minting.
67+
- `computeDirectMintingPaymentAmountXrp` — the gross XRP amount equal to the net mint amount plus the minting fee and the executor fee, as quoted by the `AssetManagerFXRP` contract.
68+
8. Send the XRPL payment to the Core Vault with the recipient memo via the `sendDirectMintPayment` function.
69+
9. Wait for the [`DirectMintingExecuted`](/fassets/reference/IAssetManagerEvents#directmintingexecuted) event on `AssetManagerFXRP` using `waitForDirectMintingExecuted` function.
70+
The event's `mintedAmountUBA`, `mintingFeeUBA`, and `executorFeeUBA` describe how the underlying payment was split.
71+
10. Read the final FXRP balance and log the delta.
72+
73+
## Important Notes
74+
75+
- **Fees are deducted from the underlying payment.** The XRP sent to the [Core Vault](/fassets/core-vault) must cover the net mint amount plus the minting fee and the executor fee.
76+
- **If the payment is below the minimum minting fee**, no FXRP is minted, and the entire payment is forfeited to the fee receiver.
77+
- **Rate limits may delay execution.** When hourly, daily, or large-minting thresholds are hit, the minting emits [`DirectMintingDelayed`](/fassets/reference/IAssetManagerEvents#directmintingdelayed) instead of [`DirectMintingExecuted`](/fassets/reference/IAssetManagerEvents#directmintingexecuted), with an `executionAllowedAt` timestamp.
78+
- **For repeat minters**, prefer the destination-tag flow via `IMintingTagManager` — it avoids constructing a memo per payment and lets you set a preferred executor.
79+
80+
:::tip[What's next]
81+
82+
To continue your FAssets development journey, you can:
83+
84+
- Read the protocol details in [Direct Minting](/fassets/direct-minting).
85+
- Check current limits and fees in [Operational Parameters](/fassets/operational-parameters).
86+
- Continue with [Redeem FAssets](/fassets/developer-guides/fassets-redeem).
87+
88+
:::

docs/fassets/developer-guides/5-fassets-mint.mdx renamed to docs/fassets/developer-guides/6-fassets-mint.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ tags: [intermediate, fassets]
44
slug: fassets-mint
55
description: Learn how to mint FAssets
66
keywords: [fassets, flare-network]
7-
sidebar_position: 5
7+
sidebar_position: 6
88
---
99

1010
import CodeBlock from "@theme/CodeBlock";

docs/fassets/developer-guides/6-fassets-mint-executor.mdx renamed to docs/fassets/developer-guides/7-fassets-mint-executor.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ tags: [intermediate, fassets]
44
slug: fassets-mint-executor
55
description: Learn how to mint FAssets using the executor
66
keywords: [fassets, flare-network]
7-
sidebar_position: 6
7+
sidebar_position: 7
88
---
99

1010
import CodeBlock from "@theme/CodeBlock";

docs/fassets/developer-guides/7-fassets-redeem.mdx renamed to docs/fassets/developer-guides/8-fassets-redeem.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ tags: [intermediate, fassets]
44
slug: fassets-redeem
55
description: Learn how to redeem FAssets
66
keywords: [fassets, flare-network]
7-
sidebar_position: 7
7+
sidebar_position: 8
88
---
99

1010
import CodeBlock from "@theme/CodeBlock";

docs/fassets/developer-guides/8-fassets-swap-redeem.mdx renamed to docs/fassets/developer-guides/9-fassets-swap-redeem.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ tags: [intermediate, fassets]
44
slug: fassets-swap-redeem
55
description: Learn how to swap and redeem FAssets
66
keywords: [fassets, flare-network]
7-
sidebar_position: 8
7+
sidebar_position: 9
88
---
99

1010
import CodeBlock from "@theme/CodeBlock";

docs/fassets/reference/IAssetManagerEvents.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,24 @@ event DirectMintingExecuted(
142142
);
143143
```
144144

145+
### `DirectMintingDelayed`
146+
147+
Emitted when a direct minting is throttled by rate limits and its execution is postponed.
148+
149+
Parameters:
150+
151+
- `transactionId`: Identifier of the direct minting transaction
152+
- `amount`: Amount being minted in the underlying base amount
153+
- `executionAllowedAt`: Earliest timestamp at which the minting can be executed
154+
155+
```solidity
156+
event DirectMintingDelayed(
157+
bytes32 transactionId,
158+
uint256 amount,
159+
uint256 executionAllowedAt
160+
);
161+
```
162+
145163
### `MintingPaymentDefault`
146164

147165
Emitted when a minter fails to pay the underlying funds in time.

0 commit comments

Comments
 (0)