Backend is currently sending TFT to itself #3

Closed
opened 2026-02-25 12:06:56 +00:00 by mahmoud · 3 comments
Member

Description

We should add the user ledger address as memo text instead

### Description We should add the user ledger address as memo text instead
mahmoud self-assigned this 2026-02-25 12:06:59 +00:00
Owner

What Needs to be Fixed

1. Change the Destination Account

Current: crates/frontend/src/components/transfer.rs:87

let to = w.account_id().to_string();  // Sends to self

Required: Send to a designated TFT receiving account (treasury/exchange account)

let to = DESIGNATED_TFT_ACCOUNT.to_string();  // Config constant

2. Add Hero Ledger Address to Transaction Memo

Current: crates/backend/src/api.rs:213-216

subxt::dynamic::tx(
    "Balances",
    "transfer_keep_alive",
    vec![dest_multi, DynamicValue::u128(amount)],
)

Required: Include Hero Ledger pubkey in transaction via:

  • Option A: Utility::batch_all([transfer_keep_alive(...), remark(hero_ledger_pubkey)])
  • Option B: Balances::transfer_with_remark (if available in TFChain)
  • Option C: Use a pallet that supports memos/remarks

3. Update the Data Flow

Modify TransferPrepareRequest to include Hero Ledger information.

## What Needs to be Fixed ### 1. Change the Destination Account **Current:** [crates/frontend/src/components/transfer.rs:87](crates/frontend/src/components/transfer.rs:87) ```rust let to = w.account_id().to_string(); // Sends to self ``` **Required:** Send to a designated TFT receiving account (treasury/exchange account) ```rust let to = DESIGNATED_TFT_ACCOUNT.to_string(); // Config constant ``` ### 2. Add Hero Ledger Address to Transaction Memo **Current:** [crates/backend/src/api.rs:213-216](crates/backend/src/api.rs:213-216) ```rust subxt::dynamic::tx( "Balances", "transfer_keep_alive", vec![dest_multi, DynamicValue::u128(amount)], ) ``` **Required:** Include Hero Ledger pubkey in transaction via: - Option A: `Utility::batch_all([transfer_keep_alive(...), remark(hero_ledger_pubkey)])` - Option B: `Balances::transfer_with_remark` (if available in TFChain) - Option C: Use a pallet that supports memos/remarks ### 3. Update the Data Flow Modify `TransferPrepareRequest` to include Hero Ledger information.
Owner

How It Will Work (After Implementation)

  1. User clicks "Send TFT & Get SPORE"
  2. Frontend derives Hero Ledger pubkey from same mnemonic
  3. Backend creates a batched transaction:
    • Transfer TFT to designated account
    • Remark with Hero Ledger pubkey in transaction memo
  4. User signs the transaction locally
  5. Transaction is submitted to TFChain
  6. Lightning daemon monitors the designated account for incoming TFT transfers
  7. Daemon extracts Hero Ledger pubkey from transaction memo
  8. Daemon sends SPORE tokens to the Hero Ledger account at 10:1 ratio
## How It Will Work (After Implementation) 1. **User clicks "Send TFT & Get SPORE"** 2. Frontend derives Hero Ledger pubkey from same mnemonic 3. Backend creates a batched transaction: - Transfer TFT to designated account - Remark with Hero Ledger pubkey in transaction memo 4. User signs the transaction locally 5. Transaction is submitted to TFChain 6. **Lightning daemon monitors the designated account** for incoming TFT transfers 7. **Daemon extracts Hero Ledger pubkey from transaction memo** 8. **Daemon sends SPORE tokens** to the Hero Ledger account at 10:1 ratio
Author
Member

Code is merged

Code is merged
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mycelium/www_migrate_mycelium#3
No description provided.