Skip to content

Commit 6a5659c

Browse files
committed
feat(docs): add guide for minting with tag
1 parent 26e2218 commit 6a5659c

12 files changed

Lines changed: 310 additions & 9 deletions

docs/fassets/03-direct-minting.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ If a preferred executor's minting is delayed, their exclusive execution window r
110110

111111
:::tip[What's next]
112112

113-
Learn more about the different components and processes involved in FAssets - [standard minting](/fassets/minting), [redemptions](/fassets/redemption), [collateral](/fassets/collateral), [liquidations](/fassets/liquidation), and [Core Vault](/fassets/core-vault).
113+
To continue your FAssets development journey, you can:
114+
115+
- Read the protocol details in [Direct Minting](/fassets/direct-minting).
116+
- Mint without a reserved tag using [memo-based direct minting](/fassets/developer-guides/fassets-direct-minting).
117+
- Check current limits and fees in [Operational Parameters](/fassets/operational-parameters).
114118

115119
:::

docs/fassets/developer-guides.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ Guides for [minting FAssets](/fassets/minting) from underlying assets.
4848
href: "/fassets/developer-guides/fassets-direct-minting",
4949
docId: "fassets/developer-guides/fassets-direct-minting",
5050
},
51+
{
52+
type: "link",
53+
label: "Direct Mint FXRP with Tag",
54+
href: "/fassets/developer-guides/fassets-direct-minting-tag",
55+
docId: "fassets/developer-guides/fassets-direct-minting-tag",
56+
},
5157
{
5258
type: "link",
5359
label: "Mint FAssets",

docs/fassets/developer-guides/9-fassets-swap-redeem.mdx renamed to docs/fassets/developer-guides/10-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: 9
7+
sidebar_position: 10
88
---
99

1010
import CodeBlock from "@theme/CodeBlock";

docs/fassets/developer-guides/10-fassets-agent-details.mdx renamed to docs/fassets/developer-guides/11-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: 10
7+
sidebar_position: 11
88
---
99

1010
import CodeBlock from "@theme/CodeBlock";

docs/fassets/developer-guides/11-fassets-redemption-default.mdx renamed to docs/fassets/developer-guides/12-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: 11
7+
sidebar_position: 12
88
---
99

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

docs/fassets/developer-guides/12-fassets-redemption-queue.mdx renamed to docs/fassets/developer-guides/13-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: 12
7+
sidebar_position: 13
88
---
99

1010
import CodeBlock from "@theme/CodeBlock";
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
---
2+
title: Direct Mint FXRP with Tag
3+
tags: [intermediate, fassets]
4+
slug: fassets-direct-minting-tag
5+
description: Mint FXRP using a reserved XRPL destination tag.
6+
keywords: [fassets, fxrp, direct-minting, minting-tag, flare-network, xrpl]
7+
sidebar_position: 6
8+
---
9+
10+
import CodeBlock from "@theme/CodeBlock";
11+
import FAssetsDirectMintingTag from "!!raw-loader!/examples/developer-hub-javascript/fassetsDirectMintingTag.ts";
12+
13+
## Overview
14+
15+
This guide walks you through minting FXRP using [direct minting](/fassets/direct-minting) with an **XRPL destination tag** reserved on Flare that maps to a recipient (and optionally an executor).
16+
Once a tag is reserved and bound, every XRPL payment to the [Core Vault](/fassets/core-vault) carrying that destination tag mints FXRP to the configured recipient — no per-payment memo required.
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-tag.ts) repository.
19+
20+
## Tag vs. memo
21+
22+
Compared to the [memo-based direct minting](/fassets/developer-guides/fassets-direct-minting), the tag flow is better suited for repeat minters:
23+
24+
- **One-time setup**: reserve a tag once via [`MintingTagManager`](/fassets/reference/IMintingTagManager) — pay the [`reservationFee`](/fassets/reference/IMintingTagManager#reservationfee) in native token and bind the recipient with [`setMintingRecipient`](/fassets/reference/IMintingTagManager#setmintingrecipient).
25+
- **Reusable**: every subsequent XRPL payment with the same destination tag routes to the bound recipient without rebuilding a memo.
26+
- **Transferable**: tags are [ERC-721 NFTs](https://ethereum.org/developers/docs/standards/tokens/erc-721/) and can be transferred to another owner with [`transfer`](/fassets/reference/IMintingTagManager#transfer).
27+
- **Optional preferred executor**: the tag owner may restrict execution via `setAllowedExecutor`.
28+
After [`othersCanExecuteAfterSeconds`](/fassets/reference/IAssetManager#getdirectmintingotherscanexecuteafterseconds), anyone can finalize.
29+
30+
## Prerequisites
31+
32+
- [Flare smart account](/smart-accounts/overview) controlled by your XRPL wallet.
33+
- Native FLR (or C2FLR on Coston2) on the Flare wallet to cover the tag reservation fee.
34+
- Testnet XRP on the XRP Ledger Testnet — get it from the [XRP Testnet Faucet](https://xrpl.org/resources/dev-tools/xrp-faucets).
35+
- Environment variables:
36+
- `XRPL_TESTNET_RPC_URL` — XRPL Testnet RPC endpoint.
37+
- `XRPL_SEED` — seed for the XRPL wallet that will send the payment.
38+
- `MINTING_TAG`_optional_.
39+
If set, the script reuses this tag instead of reserving a new one.
40+
41+
## Direct Minting Tag Script
42+
43+
<CodeBlock language="typescript" title="src/fassets/direct-mint-tag.ts">
44+
{FAssetsDirectMintingTag}
45+
</CodeBlock>
46+
47+
## Code Breakdown
48+
49+
1. `reserveTag` function reads the [`reservationFee`](/fassets/reference/IMintingTagManager#reservationfee) from [`MintingTagManager`](/fassets/reference/IMintingTagManager) contract and calls [`reserve`](/fassets/reference/IMintingTagManager#reserve) with the fee.
50+
The contract assigns the next available tag and returns it.
51+
2. `setMintingRecipient` function binds the tag to a recipient address via [`setMintingRecipient`](/fassets/reference/IMintingTagManager#setmintingrecipient).
52+
Payments arriving at the [Core Vault](/fassets/core-vault) with this destination tag will mint FXRP to that recipient.
53+
3. `getMintingRecipient` reads the [`mintingRecipient`](/fassets/reference/IMintingTagManager#mintingrecipient) currently configured for a tag.
54+
4. `getOrReserveTag` reuses `MINTING_TAG` from the `.env` variables if set; otherwise, it reserves a new tag and binds it to the recipient.
55+
5. Set the net FXRP amount to mint in XRP.
56+
Minting and executor fees are added to the the XRPL payment amount.
57+
6. Connect to the XRPL Testnet using `XRPL_TESTNET_RPC_URL` and load the sender wallet from `XRPL_SEED`.
58+
7. 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).
59+
8. Resolve the [`MintingTagManager`](/fassets/reference/IMintingTagManager) contract address from the `AssetManager` using [`getMintingTagManager`](/fassets/reference/IAssetManager#getmintingtagmanager).
60+
9. Reserve a new tag (or reuse one from `MINTING_TAG`) and confirm the configured recipient.
61+
10. Read three values in parallel:
62+
- `getDirectMintingPaymentAddress` — the Core Vault XRPL address that receives the payment.
63+
- `getFxrpBalance` — the recipient's FXRP balance before minting.
64+
- `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.
65+
11. Send the XRPL payment to the [Core Vault](/fassets/core-vault) with `destinationTag: Number(tag)` — no memo required.
66+
12. Wait for the [`DirectMintingExecuted`](/fassets/reference/IAssetManagerEvents#directmintingexecuted) event on `AssetManagerFXRP` using the `waitForDirectMintingExecuted` function.
67+
The event's `mintedAmountUBA`, `mintingFeeUBA`, and `executorFeeUBA` describe how the underlying payment was split.
68+
13. Read the final FXRP balance and log the delta.
69+
70+
## Important Notes
71+
72+
- **Reservations cost native currency.**
73+
Tag reservation pays a fee in native token.
74+
Tags are assigned sequentially.
75+
- **Executor changes are not immediate.** After calling the `setAllowedExecutor` function, the new executor only becomes active after a 10-minute cooldown to protect in-flight FDC proofs.
76+
See [Executor Restrictions](/fassets/direct-minting#executor-restrictions).
77+
- **Transferring a tag resets it.**
78+
When ownership changes, the recipient is reset to the new owner, and the executor is reset to the zero address.
79+
- **Rate limits may delay execution.**
80+
If the minting hits hourly, daily, or large-minting thresholds, [`DirectMintingDelayed`](/fassets/reference/IAssetManagerEvents#directmintingdelayed) is emitted instead of [`DirectMintingExecuted`](/fassets/reference/IAssetManagerEvents#directmintingexecuted), with an `executionAllowedAt` timestamp.
81+
82+
:::tip[What's next]
83+
84+
To continue your FAssets development journey, you can:
85+
86+
- Read the protocol details in [Direct Minting](/fassets/direct-minting).
87+
- Mint without a reserved tag using [memo-based direct minting](/fassets/developer-guides/fassets-direct-minting).
88+
- Check current limits and fees in [Operational Parameters](/fassets/operational-parameters).
89+
90+
:::

docs/fassets/developer-guides/6-fassets-mint.mdx renamed to docs/fassets/developer-guides/7-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: 6
7+
sidebar_position: 7
88
---
99

1010
import CodeBlock from "@theme/CodeBlock";

docs/fassets/developer-guides/7-fassets-mint-executor.mdx renamed to docs/fassets/developer-guides/8-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: 7
7+
sidebar_position: 8
88
---
99

1010
import CodeBlock from "@theme/CodeBlock";

docs/fassets/developer-guides/8-fassets-redeem.mdx renamed to docs/fassets/developer-guides/9-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: 8
7+
sidebar_position: 9
88
---
99

1010
import CodeBlock from "@theme/CodeBlock";

0 commit comments

Comments
 (0)