Skip to content

Commit 1417a94

Browse files
authored
Merge pull request #11 from lightninglabs/v0.2.2-alpha
v0.2.2-alpha updates
2 parents 59ecdee + 35bab27 commit 1417a94

File tree

23 files changed

+494
-48
lines changed

23 files changed

+494
-48
lines changed

lib/types/proto/lnd/lightning.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export enum OutputScriptType {
1010
SCRIPT_TYPE_NULLDATA = 'SCRIPT_TYPE_NULLDATA',
1111
SCRIPT_TYPE_NON_STANDARD = 'SCRIPT_TYPE_NON_STANDARD',
1212
SCRIPT_TYPE_WITNESS_UNKNOWN = 'SCRIPT_TYPE_WITNESS_UNKNOWN',
13+
SCRIPT_TYPE_WITNESS_V1_TAPROOT = 'SCRIPT_TYPE_WITNESS_V1_TAPROOT',
1314
UNRECOGNIZED = 'UNRECOGNIZED'
1415
}
1516

lib/types/proto/loop/client.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -325,19 +325,12 @@ export interface SwapResponse {
325325
* depending on the request, the semantics are different.
326326
* - For internal loop-in htlc_address contains the address of the
327327
* native segwit (P2WSH) htlc.
328-
* - For external loop-in htlc_address contains the address of the
329-
* nested segwit (NP2WSH) htlc.
330-
* - For loop-out htlc_address always contains the native segwit (P2WSH)
328+
* / - For loop-out htlc_address always contains the native segwit (P2WSH)
331329
* htlc address.
332330
*
333331
* @deprecated
334332
*/
335333
htlcAddress: string;
336-
/**
337-
* The nested segwit address of the on-chain htlc.
338-
* This field remains empty for loop-out.
339-
*/
340-
htlcAddressNp2wsh: string;
341334
/**
342335
* The native segwit address of the on-chain htlc.
343336
* Used for both loop-in and loop-out.
@@ -385,8 +378,6 @@ export interface SwapStatus {
385378
* DEPRECATED: This field stores the address of the onchain htlc.
386379
* - For internal loop-in htlc_address contains the address of the
387380
* native segwit (P2WSH) htlc.
388-
* - For external loop-in htlc_address contains the nested segwit (NP2WSH)
389-
* address.
390381
* - For loop-out htlc_address always contains the native segwit (P2WSH)
391382
* htlc address.
392383
*
@@ -395,8 +386,6 @@ export interface SwapStatus {
395386
htlcAddress: string;
396387
/** HTLC address (native segwit), used in loop-in and loop-out swaps. */
397388
htlcAddressP2wsh: string;
398-
/** HTLC address (nested segwit), used in loop-in swaps only. */
399-
htlcAddressNp2wsh: string;
400389
/** The address of the v3 (taproot) htlc. Used for both loop-in and loop-out. */
401390
htlcAddressP2tr: string;
402391
/** Swap server cost */
@@ -661,6 +650,11 @@ export interface LiquidityParameters {
661650
maxSwapAmount: string;
662651
/** The confirmation target for loop in on-chain htlcs. */
663652
htlcConfTarget: number;
653+
/**
654+
* The destination address to use for autoloop loop outs. Set to "default" in
655+
* order to revert to default behavior.
656+
*/
657+
autoloopDestAddress: string;
664658
}
665659

666660
export interface LiquidityRule {

lib/types/proto/pool/auctioneerrpc/auctioneer.ts

Lines changed: 147 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,20 @@ export enum OrderChannelType {
6363
UNRECOGNIZED = 'UNRECOGNIZED'
6464
}
6565

66+
export enum AuctionType {
67+
/**
68+
* AUCTION_TYPE_BTC_INBOUND_LIQUIDITY - Default auction type where the bidder is paying for getting bitcoin inbound
69+
* liqiudity from the asker.
70+
*/
71+
AUCTION_TYPE_BTC_INBOUND_LIQUIDITY = 'AUCTION_TYPE_BTC_INBOUND_LIQUIDITY',
72+
/**
73+
* AUCTION_TYPE_BTC_OUTBOUND_LIQUIDITY - Auction type where the bidder is paying the asker to accept a channel
74+
* (bitcoin outbound liquidity) from the bidder.
75+
*/
76+
AUCTION_TYPE_BTC_OUTBOUND_LIQUIDITY = 'AUCTION_TYPE_BTC_OUTBOUND_LIQUIDITY',
77+
UNRECOGNIZED = 'UNRECOGNIZED'
78+
}
79+
6680
export enum NodeTier {
6781
/**
6882
* TIER_DEFAULT - The default node tier. This value will be determined at run-time by the
@@ -85,6 +99,22 @@ export enum NodeTier {
8599
UNRECOGNIZED = 'UNRECOGNIZED'
86100
}
87101

102+
/** Channel announcement constraints for matched channels. */
103+
export enum ChannelAnnouncementConstraints {
104+
ANNOUNCEMENT_NO_PREFERENCE = 'ANNOUNCEMENT_NO_PREFERENCE',
105+
ONLY_ANNOUNCED = 'ONLY_ANNOUNCED',
106+
ONLY_UNANNOUNCED = 'ONLY_UNANNOUNCED',
107+
UNRECOGNIZED = 'UNRECOGNIZED'
108+
}
109+
110+
/** Channel confirmation constraints for matched channels. */
111+
export enum ChannelConfirmationConstraints {
112+
CONFIRMATION_NO_PREFERENCE = 'CONFIRMATION_NO_PREFERENCE',
113+
ONLY_CONFIRMED = 'ONLY_CONFIRMED',
114+
ONLY_ZEROCONF = 'ONLY_ZEROCONF',
115+
UNRECOGNIZED = 'UNRECOGNIZED'
116+
}
117+
88118
export enum OrderState {
89119
ORDER_SUBMITTED = 'ORDER_SUBMITTED',
90120
ORDER_CLEARED = 'ORDER_CLEARED',
@@ -127,13 +157,23 @@ export interface ReserveAccountRequest {
127157
accountExpiry: number;
128158
/** The trader's account key. */
129159
traderKey: Uint8Array | string;
160+
/** The account version. Must be set to 0 for legacy (non-taproot) accounts. */
161+
version: number;
130162
}
131163

132164
export interface ReserveAccountResponse {
133165
/**
134166
* The base key of the auctioneer. This key should be tweaked with the trader's
135167
* per-batch tweaked key to obtain the corresponding per-batch tweaked
136-
* auctioneer key.
168+
* auctioneer key. Or, in case of the version 1, Taproot enabled account, the
169+
* trader and auctioneer key will be combined into a MuSig2 combined key that
170+
* is static throughout the lifetime of the account. The on-chain uniqueness of
171+
* the generated output will be ensured by the merkle root hash that is applied
172+
* as a tweak to the MuSig2 combined internal key. The merkle root hash is
173+
* either the hash of the timeout script path (which uses the trader key
174+
* tweaked with the per-batch key) directly or the root of a tree with one leaf
175+
* that is the timeout script path and a leaf that is a Taro commitment (which
176+
* is a root hash by itself).
137177
*/
138178
auctioneerKey: Uint8Array | string;
139179
/**
@@ -152,7 +192,12 @@ export interface ServerInitAccountRequest {
152192
* account value below.
153193
*/
154194
accountPoint: OutPoint | undefined;
155-
/** The script used to create the account point. */
195+
/**
196+
* The script used to create the account point. For version 1 (Taproot enabled)
197+
* accounts this represents the 32-byte (x-only) Taproot public key with the
198+
* combined MuSig2 key of the auctioneer's key and the trader's key with the
199+
* expiry script path applied as a single tapscript leaf.
200+
*/
156201
accountScript: Uint8Array | string;
157202
/**
158203
* The value of the account in satoshis. Must match the amount of the
@@ -173,6 +218,8 @@ export interface ServerInitAccountRequest {
173218
* litd/v0.4.0-alpha/commit=326d754,initiator=lit-ui
174219
*/
175220
userAgent: string;
221+
/** The account version. Must be set to 0 for legacy (non-taproot) accounts. */
222+
version: number;
176223
}
177224

178225
export interface ServerInitAccountResponse {}
@@ -382,6 +429,11 @@ export interface OrderMatchSign {
382429
* transaction. The map key corresponds to the trader's account key of the
383430
* account in the batch transaction. The account key/ID has to be hex encoded
384431
* into a string because protobuf doesn't allow bytes as a map key data type.
432+
* For version 1 (Taproot enabled) accounts, this merely represents a partial
433+
* MuSig2 signature that can be combined into a full signature by the auction
434+
* server by adding its own partial signature. A set of nonces will be provided
435+
* by the trader for each v1 account to allow finalizing the MuSig2 signing
436+
* session.
385437
*/
386438
accountSigs: { [key: string]: Uint8Array | string };
387439
/**
@@ -391,6 +443,13 @@ export interface OrderMatchSign {
391443
* outpoint.
392444
*/
393445
channelInfos: { [key: string]: ChannelInfo };
446+
/**
447+
* A set of 66-byte nonces for each version 1 (Taproot enabled) account. The
448+
* nonces can be used to produce a MuSig2 partial signature to spend the
449+
* account using the key spend path, which is a MuSig2 combined key of the
450+
* auctioneer key and the trader key.
451+
*/
452+
traderNonces: { [key: string]: Uint8Array | string };
394453
}
395454

396455
export interface OrderMatchSign_AccountSigsEntry {
@@ -403,6 +462,11 @@ export interface OrderMatchSign_ChannelInfosEntry {
403462
value: ChannelInfo | undefined;
404463
}
405464

465+
export interface OrderMatchSign_TraderNoncesEntry {
466+
key: string;
467+
value: Uint8Array | string;
468+
}
469+
406470
export interface AccountRecovery {
407471
/** The trader's account key of the account to recover. */
408472
traderKey: Uint8Array | string;
@@ -551,9 +615,34 @@ export interface OrderMatchPrepare_MatchedMarketsEntry {
551615
value: MatchedMarket | undefined;
552616
}
553617

618+
export interface TxOut {
619+
/** The value of the transaction output in satoshis. */
620+
value: string;
621+
/** The public key script of the output. */
622+
pkScript: Uint8Array | string;
623+
}
624+
554625
export interface OrderMatchSignBegin {
555626
/** The 32 byte unique identifier of this batch. */
556627
batchId: Uint8Array | string;
628+
/**
629+
* A set of 66-byte nonces for each version 1 (Taproot enabled) account. The
630+
* nonces can be used to produce a MuSig2 partial signature to spend the
631+
* account using the key spend path, which is a MuSig2 combined key of the
632+
* auctioneer key and the trader key.
633+
*/
634+
serverNonces: { [key: string]: Uint8Array | string };
635+
/**
636+
* The full list of UTXO information for each of the inputs being spent. This
637+
* is required when spending one or more Taproot enabled (account version 1)
638+
* outputs.
639+
*/
640+
prevOutputs: TxOut[];
641+
}
642+
643+
export interface OrderMatchSignBegin_ServerNoncesEntry {
644+
key: string;
645+
value: Uint8Array | string;
557646
}
558647

559648
export interface OrderMatchFinalize {
@@ -636,6 +725,8 @@ export interface AuctionAccount {
636725
* after the account has met its initial funding confirmation.
637726
*/
638727
latestTx: Uint8Array | string;
728+
/** The account version. Will be set to 0 for legacy (non-taproot) accounts. */
729+
version: number;
639730
}
640731

641732
export interface MatchedOrder {
@@ -689,6 +780,12 @@ export interface AccountDiff {
689780
* value.
690781
*/
691782
newExpiry: number;
783+
/**
784+
* The new account version used to verify the batch. If this is non-zero, it
785+
* means the account was automatically upgraded to the given version during the
786+
* batch execution.
787+
*/
788+
newVersion: number;
692789
}
693790

694791
export enum AccountDiff_AccountState {
@@ -742,6 +839,13 @@ export interface ServerOrder {
742839
* with the `allowed_node_ids` field.
743840
*/
744841
notAllowedNodeIds: Uint8Array | string[];
842+
/** Auction type where this order must be considered during the matching. */
843+
auctionType: AuctionType;
844+
/**
845+
* Flag used to signal that this order can be shared in public market
846+
* places.
847+
*/
848+
isPublic: boolean;
745849
}
746850

747851
export interface ServerBid {
@@ -766,9 +870,9 @@ export interface ServerBid {
766870
* Give the incoming channel that results from this bid being matched an
767871
* initial outbound balance by adding additional funds from the taker's account
768872
* into the channel. As a simplification for the execution protocol and the
769-
* channel reserve calculations, the self_chan_balance can be at most the same
770-
* as the order amount and the min_chan_amt must be set to the full order
771-
* amount.
873+
* channel reserve calculations the min_chan_amt must be set to the full order
874+
* amount. For the inbound liquidity market the self_chan_balance can be at
875+
* most the same as the order amount.
772876
*/
773877
selfChanBalance: string;
774878
/**
@@ -778,6 +882,10 @@ export interface ServerBid {
778882
* correspond to the recipient node's details.
779883
*/
780884
isSidecarChannel: boolean;
885+
/** Signals if this bid is interested in an announced or unannounced channel. */
886+
unannouncedChannel: boolean;
887+
/** Signals if this bid is interested in a zero conf channel or not. */
888+
zeroConfChannel: boolean;
781889
}
782890

783891
export interface ServerAsk {
@@ -793,6 +901,13 @@ export interface ServerAsk {
793901
* features are added.
794902
*/
795903
version: number;
904+
/** The constraints for selling the liquidity based on channel discoverability. */
905+
announcementConstraints: ChannelAnnouncementConstraints;
906+
/**
907+
* The constraints for selling the liquidity based on the number of
908+
* blocks before considering the channel confirmed.
909+
*/
910+
confirmationConstraints: ChannelConfirmationConstraints;
796911
}
797912

798913
export interface CancelOrder {
@@ -844,21 +959,47 @@ export interface ServerModifyAccountRequest {
844959
newOutputs: ServerOutput[];
845960
/** The new parameters to apply for the account. */
846961
newParams: ServerModifyAccountRequest_NewAccountParameters | undefined;
962+
/**
963+
* A set of 66-byte nonces for each version 1 (Taproot enabled) account. The
964+
* nonces can be used to produce a MuSig2 partial signature to spend the
965+
* account using the key spend path, which is a MuSig2 combined key of the
966+
* auctioneer key and the trader key.
967+
*/
968+
traderNonces: Uint8Array | string;
969+
/**
970+
* The full list of UTXO information for each of the inputs being spent. This
971+
* is required when spending a Taproot enabled (account version 1) output or
972+
* when adding additional Taproot inputs.
973+
*/
974+
prevOutputs: TxOut[];
847975
}
848976

849977
export interface ServerModifyAccountRequest_NewAccountParameters {
850978
/** The new value of the account. */
851979
value: string;
852980
/** The new expiry of the account as an absolute height. */
853981
expiry: number;
982+
/** The new version of the account. */
983+
version: number;
854984
}
855985

856986
export interface ServerModifyAccountResponse {
857987
/**
858988
* The auctioneer's signature that allows a trader to broadcast a transaction
859-
* spending from an account output.
989+
* spending from an account output. For version 1 (Taproot enabled) accounts,
990+
* this merely represents a partial MuSig2 signature that can be combined into
991+
* a full signature by the trader daemon by adding its own partial signature. A
992+
* set of nonces will be provided by the server (in case this is a v1 account)
993+
* to allow finalizing the MuSig2 signing session.
860994
*/
861995
accountSig: Uint8Array | string;
996+
/**
997+
* An optional set of 66-byte nonces for a version 1 (Taproot enabled) account
998+
* spend. The nonces can be used to produce a MuSig2 partial signature to spend
999+
* the account using the key spend path, which is a MuSig2 combined key of the
1000+
* auctioneer key and the trader key.
1001+
*/
1002+
serverNonces: Uint8Array | string;
8621003
}
8631004

8641005
export interface ServerOrderStateRequest {

0 commit comments

Comments
 (0)