HTLC support (Atomic swaps, Payment Channels)

Does the wallet API intend to support different types of transactions?
A common construct is the Hash Time Locked Contract. This is used frequently in atomic swaps and payment channels.

Wondering if this kind of support is something that fits in the API’s model.

The Wallet API was designed to support anything from simple transfers to complex contract invocations. When we share the specification for the Wallet API in the coming weeks, it should make more sense as to how exactly we do this.

In the case of Hash Time Locked Contracts, it would be up to the implementer of the Wallet API to decide how to represent the interaction (as there are probably a few ways to do it). For example, it could take advantage of the expressive description of accounts to specify which address and HTLC are part of a given transaction:

{
    "address": "<channel participant>",
    "sub_account": {
        "address": "<HTLC>",
    },
}

The Wallet API implementation would then likely need to fetch some metadata from the blockchain (like past outpoints) and/or require the operation.Metadata field to be populated with information necessary to construct the transaction (i.e. the data that could be used to spend the HTLC):

{
    "operation_identifier": {
        "index": 1,
    },
    "type": "HTLC",
    "account": {
        "address": "<HTLC Spender>",
        "sub_account": {
            "address": "<HTLC>",
        },
    },
    "amount": {
        "value": "1238089899992",
        "currency": {
            "symbol": "BTC",
            "decimals": 8,
        },
    },
    "metadata": {
        "data": "304502201fd8abb11443f8b1b9a04e0495e0543d05611473a790c8939f089d073f90509a022100f4677825136605d732e2126d09a2d38c20c75946cd9fc239c0497e84c634e3dd01 03301a8259a12e35694cc22ebc45fee635f4993064190f6ce96e7fb19a03bb6be2"
    }
}

Happy to discuss this in more specifics if you plan to implement something like this!