-
Notifications
You must be signed in to change notification settings - Fork 29
Description
Summary
This issue to add support for pushing RGB assets when opening a channel, similar to how push_msat works for Bitcoin. This would allow the channel opener to immediately transfer some RGB asset amount to the counterparty upon channel establishment.
Problem Statement
Currently, when opening an RGB channel, all RGB assets remain with the channel opener initially. Users who want to acquire RGB assets must:
- Wait for channel confirmation
- Use the swap API to exchange assets
This creates unnecessary delays and complexity for users who want to buy assets directly during channel opening.
Requested Feature
Add a new field push_asset_amount to the OpenChannelRequest to enable immediate asset transfer to the counterparty during channel opening.
API Enhancement
#[derive(Deserialize, Serialize)]
pub(crate) struct OpenChannelRequest {
// ... existing fields ...
pub(crate) asset_amount: Option<u64>,
pub(crate) asset_id: Option<String>,
pub(crate) push_asset_amount: Option<u64>, // NEW FIELD
// ... existing fields ...
}Use Case
Direct Asset Purchase: Users can buy RGB assets directly when a channel is opened, eliminating the need to:
- Wait for channel confirmations
- Make separate swap API calls
- Handle additional transaction complexity
Example Scenario
A user wants to acquire 250 units of an RGB asset. Instead of:
- Opening a channel with 1000 asset units
- Waiting for confirmation
- Using swap API to get 250 units
They can directly open a channel with asset_amount: 1000 and push_asset_amount: 250, immediately receiving 250 units while the opener retains 750 units.
Expected Behavior
push_asset_amountcan only be used with RGB channels (whenasset_idis specified)push_asset_amountmust not exceedasset_amount- Asset distribution: opener keeps
asset_amount - push_asset_amount, counterparty receivespush_asset_amount
Benefits
- Simplified UX: Single operation instead of channel opening + swap
- Faster asset acquisition: No waiting for confirmations before asset transfer
- Reduced complexity: Eliminates need for separate swap transactions
- Better onboarding: Service providers can instantly provide assets to new users