Skip to content

add enum to receive APIs to give more control over the received amount #36

@zoedberg

Description

@zoedberg

Let's add an enum field to receive APIs (blind_receive and witness_receive) to allow the user to have more control over the transfer, based on the RGB amount being received.

The enum should be defined as:

/// Choice of policy to apply when receiving a transfer, based on the RGB amount
pub enum ReceiveAmount{
    /// Any received amount will be accepted, regardless of the amount that has been specified in the invoice
    Whatever,
    /// If the received amount is different from the requested one the transfer should be refused. This value is possible only when setting an amount into the invoice
    Exact,
    /// If the received amount is lower than the requested one the transfer should be refused. This value is possible only when setting an amount into the invoice
    AtLeast,
}

As the enum documentation says, if the user specifies ReceiveAmount::Exact or ReceiveAmount::AtLeast then the optional amount field of the receive APIs should be set, otherwise an Error::NoReceiveAmount error (to be added) should be returned.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions