From d368f8a8fea687407a65afa811d723c47c659c4e Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Thu, 23 May 2024 13:48:49 +0200 Subject: [PATCH 01/10] multi: bump to lnd/tapd/lndclient v0.18.4-beta/v0.5.0-alpha --- app/src/types/generated/lnd_pb.d.ts | 92 + app/src/types/generated/lnd_pb.js | 805 +- app/src/types/generated/loop_pb.d.ts | 635 + app/src/types/generated/loop_pb.js | 14489 ++++++++++------ app/src/types/generated/loop_pb_service.d.ts | 152 + app/src/types/generated/loop_pb_service.js | 320 + .../generated/swapserverrpc/server_pb.d.ts | 170 +- .../generated/swapserverrpc/server_pb.js | 1175 +- .../swapserverrpc/server_pb_service.d.ts | 48 - .../swapserverrpc/server_pb_service.js | 95 - app/src/util/tests/sampleData.ts | 3 + go.mod | 58 +- go.sum | 113 +- itest/litd_firewall_test.go | 2 +- itest/litd_mode_integrated_test.go | 2 +- itest/litd_node.go | 7 +- itest/network_harness.go | 15 +- proto/lnd.proto | 77 +- proto/loop.proto | 568 +- proto/swapserverrpc/server.proto | 81 +- subservers/taproot-assets.go | 7 +- terminal.go | 5 +- 22 files changed, 12606 insertions(+), 6313 deletions(-) diff --git a/app/src/types/generated/lnd_pb.d.ts b/app/src/types/generated/lnd_pb.d.ts index 137365bf0..e2dbe766c 100644 --- a/app/src/types/generated/lnd_pb.d.ts +++ b/app/src/types/generated/lnd_pb.d.ts @@ -1506,6 +1506,11 @@ export class Channel extends jspb.Message { getMemo(): string; setMemo(value: string): void; + getCustomChannelData(): Uint8Array | string; + getCustomChannelData_asU8(): Uint8Array; + getCustomChannelData_asB64(): string; + setCustomChannelData(value: Uint8Array | string): void; + serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): Channel.AsObject; static toObject(includeInstance: boolean, msg: Channel): Channel.AsObject; @@ -1554,6 +1559,7 @@ export namespace Channel { peerAlias: string, peerScidAlias: string, memo: string, + customChannelData: Uint8Array | string, } } @@ -2349,6 +2355,42 @@ export namespace ChannelOpenUpdate { } } +export class CloseOutput extends jspb.Message { + getAmountSat(): string; + setAmountSat(value: string): void; + + getPkScript(): Uint8Array | string; + getPkScript_asU8(): Uint8Array; + getPkScript_asB64(): string; + setPkScript(value: Uint8Array | string): void; + + getIsLocal(): boolean; + setIsLocal(value: boolean): void; + + getCustomChannelData(): Uint8Array | string; + getCustomChannelData_asU8(): Uint8Array; + getCustomChannelData_asB64(): string; + setCustomChannelData(value: Uint8Array | string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): CloseOutput.AsObject; + static toObject(includeInstance: boolean, msg: CloseOutput): CloseOutput.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: CloseOutput, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): CloseOutput; + static deserializeBinaryFromReader(message: CloseOutput, reader: jspb.BinaryReader): CloseOutput; +} + +export namespace CloseOutput { + export type AsObject = { + amountSat: string, + pkScript: Uint8Array | string, + isLocal: boolean, + customChannelData: Uint8Array | string, + } +} + export class ChannelCloseUpdate extends jspb.Message { getClosingTxid(): Uint8Array | string; getClosingTxid_asU8(): Uint8Array; @@ -2358,6 +2400,21 @@ export class ChannelCloseUpdate extends jspb.Message { getSuccess(): boolean; setSuccess(value: boolean): void; + hasLocalCloseOutput(): boolean; + clearLocalCloseOutput(): void; + getLocalCloseOutput(): CloseOutput | undefined; + setLocalCloseOutput(value?: CloseOutput): void; + + hasRemoteCloseOutput(): boolean; + clearRemoteCloseOutput(): void; + getRemoteCloseOutput(): CloseOutput | undefined; + setRemoteCloseOutput(value?: CloseOutput): void; + + clearAdditionalOutputsList(): void; + getAdditionalOutputsList(): Array; + setAdditionalOutputsList(value: Array): void; + addAdditionalOutputs(value?: CloseOutput, index?: number): CloseOutput; + serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): ChannelCloseUpdate.AsObject; static toObject(includeInstance: boolean, msg: ChannelCloseUpdate): ChannelCloseUpdate.AsObject; @@ -2372,6 +2429,9 @@ export namespace ChannelCloseUpdate { export type AsObject = { closingTxid: Uint8Array | string, success: boolean, + localCloseOutput?: CloseOutput.AsObject, + remoteCloseOutput?: CloseOutput.AsObject, + additionalOutputsList: Array, } } @@ -3356,6 +3416,11 @@ export namespace PendingChannelsResponse { getMemo(): string; setMemo(value: string): void; + getCustomChannelData(): Uint8Array | string; + getCustomChannelData_asU8(): Uint8Array; + getCustomChannelData_asB64(): string; + setCustomChannelData(value: Uint8Array | string): void; + serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): PendingChannel.AsObject; static toObject(includeInstance: boolean, msg: PendingChannel): PendingChannel.AsObject; @@ -3381,6 +3446,7 @@ export namespace PendingChannelsResponse { chanStatusFlags: string, pb_private: boolean, memo: string, + customChannelData: Uint8Array | string, } } @@ -3847,6 +3913,11 @@ export class ChannelBalanceResponse extends jspb.Message { getPendingOpenRemoteBalance(): Amount | undefined; setPendingOpenRemoteBalance(value?: Amount): void; + getCustomChannelData(): Uint8Array | string; + getCustomChannelData_asU8(): Uint8Array; + getCustomChannelData_asB64(): string; + setCustomChannelData(value: Uint8Array | string): void; + serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): ChannelBalanceResponse.AsObject; static toObject(includeInstance: boolean, msg: ChannelBalanceResponse): ChannelBalanceResponse.AsObject; @@ -3867,6 +3938,7 @@ export namespace ChannelBalanceResponse { unsettledRemoteBalance?: Amount.AsObject, pendingOpenLocalBalance?: Amount.AsObject, pendingOpenRemoteBalance?: Amount.AsObject, + customChannelData: Uint8Array | string, } } @@ -4221,6 +4293,14 @@ export class Route extends jspb.Message { getTotalAmtMsat(): string; setTotalAmtMsat(value: string): void; + getFirstHopAmountMsat(): string; + setFirstHopAmountMsat(value: string): void; + + getCustomChannelData(): Uint8Array | string; + getCustomChannelData_asU8(): Uint8Array; + getCustomChannelData_asB64(): string; + setCustomChannelData(value: Uint8Array | string): void; + serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): Route.AsObject; static toObject(includeInstance: boolean, msg: Route): Route.AsObject; @@ -4239,6 +4319,8 @@ export namespace Route { hopsList: Array, totalFeesMsat: string, totalAmtMsat: string, + firstHopAmountMsat: string, + customChannelData: Uint8Array | string, } } @@ -5354,6 +5436,11 @@ export class InvoiceHTLC extends jspb.Message { getAmp(): AMP | undefined; setAmp(value?: AMP): void; + getCustomChannelData(): Uint8Array | string; + getCustomChannelData_asU8(): Uint8Array; + getCustomChannelData_asB64(): string; + setCustomChannelData(value: Uint8Array | string): void; + serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): InvoiceHTLC.AsObject; static toObject(includeInstance: boolean, msg: InvoiceHTLC): InvoiceHTLC.AsObject; @@ -5377,6 +5464,7 @@ export namespace InvoiceHTLC { customRecordsMap: Array<[number, Uint8Array | string]>, mppTotalAmtMsat: string, amp?: AMP.AsObject, + customChannelData: Uint8Array | string, } } @@ -5628,6 +5716,8 @@ export class Payment extends jspb.Message { getFailureReason(): PaymentFailureReasonMap[keyof PaymentFailureReasonMap]; setFailureReason(value: PaymentFailureReasonMap[keyof PaymentFailureReasonMap]): void; + getFirstHopCustomRecordsMap(): jspb.Map; + clearFirstHopCustomRecordsMap(): void; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): Payment.AsObject; static toObject(includeInstance: boolean, msg: Payment): Payment.AsObject; @@ -5655,6 +5745,7 @@ export namespace Payment { htlcsList: Array, paymentIndex: string, failureReason: PaymentFailureReasonMap[keyof PaymentFailureReasonMap], + firstHopCustomRecordsMap: Array<[number, Uint8Array | string]>, } export interface PaymentStatusMap { @@ -7439,6 +7530,7 @@ export interface CommitmentTypeMap { ANCHORS: 3; SCRIPT_ENFORCED_LEASE: 4; SIMPLE_TAPROOT: 5; + SIMPLE_TAPROOT_OVERLAY: 6; } export const CommitmentType: CommitmentTypeMap; diff --git a/app/src/types/generated/lnd_pb.js b/app/src/types/generated/lnd_pb.js index 740d82862..cb8672f31 100644 --- a/app/src/types/generated/lnd_pb.js +++ b/app/src/types/generated/lnd_pb.js @@ -75,6 +75,7 @@ goog.exportSymbol('proto.lnrpc.ChannelUpdate', null, global); goog.exportSymbol('proto.lnrpc.CheckMacPermRequest', null, global); goog.exportSymbol('proto.lnrpc.CheckMacPermResponse', null, global); goog.exportSymbol('proto.lnrpc.CloseChannelRequest', null, global); +goog.exportSymbol('proto.lnrpc.CloseOutput', null, global); goog.exportSymbol('proto.lnrpc.CloseStatusUpdate', null, global); goog.exportSymbol('proto.lnrpc.CloseStatusUpdate.UpdateCase', null, global); goog.exportSymbol('proto.lnrpc.ClosedChannelUpdate', null, global); @@ -1658,9 +1659,30 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.lnrpc.ChannelCloseUpdate = function(opt_data) { +proto.lnrpc.CloseOutput = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; +goog.inherits(proto.lnrpc.CloseOutput, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.lnrpc.CloseOutput.displayName = 'proto.lnrpc.CloseOutput'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.lnrpc.ChannelCloseUpdate = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.lnrpc.ChannelCloseUpdate.repeatedFields_, null); +}; goog.inherits(proto.lnrpc.ChannelCloseUpdate, jspb.Message); if (goog.DEBUG && !COMPILED) { /** @@ -14527,7 +14549,8 @@ proto.lnrpc.Channel.toObject = function(includeInstance, msg) { zeroConfConfirmedScid: jspb.Message.getFieldWithDefault(msg, 33, "0"), peerAlias: jspb.Message.getFieldWithDefault(msg, 34, ""), peerScidAlias: jspb.Message.getFieldWithDefault(msg, 35, "0"), - memo: jspb.Message.getFieldWithDefault(msg, 36, "") + memo: jspb.Message.getFieldWithDefault(msg, 36, ""), + customChannelData: msg.getCustomChannelData_asB64() }; if (includeInstance) { @@ -14713,6 +14736,10 @@ proto.lnrpc.Channel.deserializeBinaryFromReader = function(msg, reader) { var value = /** @type {string} */ (reader.readString()); msg.setMemo(value); break; + case 37: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setCustomChannelData(value); + break; default: reader.skipField(); break; @@ -14997,6 +15024,13 @@ proto.lnrpc.Channel.serializeBinaryToWriter = function(message, writer) { f ); } + f = message.getCustomChannelData_asU8(); + if (f.length > 0) { + writer.writeBytes( + 37, + f + ); + } }; @@ -15725,6 +15759,48 @@ proto.lnrpc.Channel.prototype.setMemo = function(value) { }; +/** + * optional bytes custom_channel_data = 37; + * @return {!(string|Uint8Array)} + */ +proto.lnrpc.Channel.prototype.getCustomChannelData = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 37, "")); +}; + + +/** + * optional bytes custom_channel_data = 37; + * This is a type-conversion wrapper around `getCustomChannelData()` + * @return {string} + */ +proto.lnrpc.Channel.prototype.getCustomChannelData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getCustomChannelData())); +}; + + +/** + * optional bytes custom_channel_data = 37; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getCustomChannelData()` + * @return {!Uint8Array} + */ +proto.lnrpc.Channel.prototype.getCustomChannelData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getCustomChannelData())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.lnrpc.Channel} returns this + */ +proto.lnrpc.Channel.prototype.setCustomChannelData = function(value) { + return jspb.Message.setProto3BytesField(this, 37, value); +}; + + @@ -21233,6 +21309,281 @@ proto.lnrpc.ChannelOpenUpdate.prototype.hasChannelPoint = function() { +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.lnrpc.CloseOutput.prototype.toObject = function(opt_includeInstance) { + return proto.lnrpc.CloseOutput.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.lnrpc.CloseOutput} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lnrpc.CloseOutput.toObject = function(includeInstance, msg) { + var f, obj = { + amountSat: jspb.Message.getFieldWithDefault(msg, 1, "0"), + pkScript: msg.getPkScript_asB64(), + isLocal: jspb.Message.getBooleanFieldWithDefault(msg, 3, false), + customChannelData: msg.getCustomChannelData_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.lnrpc.CloseOutput} + */ +proto.lnrpc.CloseOutput.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.lnrpc.CloseOutput; + return proto.lnrpc.CloseOutput.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.lnrpc.CloseOutput} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.lnrpc.CloseOutput} + */ +proto.lnrpc.CloseOutput.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setAmountSat(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setPkScript(value); + break; + case 3: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setIsLocal(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setCustomChannelData(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.lnrpc.CloseOutput.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.lnrpc.CloseOutput.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.lnrpc.CloseOutput} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lnrpc.CloseOutput.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAmountSat(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 1, + f + ); + } + f = message.getPkScript_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getIsLocal(); + if (f) { + writer.writeBool( + 3, + f + ); + } + f = message.getCustomChannelData_asU8(); + if (f.length > 0) { + writer.writeBytes( + 4, + f + ); + } +}; + + +/** + * optional int64 amount_sat = 1; + * @return {string} + */ +proto.lnrpc.CloseOutput.prototype.getAmountSat = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.lnrpc.CloseOutput} returns this + */ +proto.lnrpc.CloseOutput.prototype.setAmountSat = function(value) { + return jspb.Message.setProto3StringIntField(this, 1, value); +}; + + +/** + * optional bytes pk_script = 2; + * @return {!(string|Uint8Array)} + */ +proto.lnrpc.CloseOutput.prototype.getPkScript = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes pk_script = 2; + * This is a type-conversion wrapper around `getPkScript()` + * @return {string} + */ +proto.lnrpc.CloseOutput.prototype.getPkScript_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getPkScript())); +}; + + +/** + * optional bytes pk_script = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getPkScript()` + * @return {!Uint8Array} + */ +proto.lnrpc.CloseOutput.prototype.getPkScript_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getPkScript())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.lnrpc.CloseOutput} returns this + */ +proto.lnrpc.CloseOutput.prototype.setPkScript = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional bool is_local = 3; + * @return {boolean} + */ +proto.lnrpc.CloseOutput.prototype.getIsLocal = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.lnrpc.CloseOutput} returns this + */ +proto.lnrpc.CloseOutput.prototype.setIsLocal = function(value) { + return jspb.Message.setProto3BooleanField(this, 3, value); +}; + + +/** + * optional bytes custom_channel_data = 4; + * @return {!(string|Uint8Array)} + */ +proto.lnrpc.CloseOutput.prototype.getCustomChannelData = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * optional bytes custom_channel_data = 4; + * This is a type-conversion wrapper around `getCustomChannelData()` + * @return {string} + */ +proto.lnrpc.CloseOutput.prototype.getCustomChannelData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getCustomChannelData())); +}; + + +/** + * optional bytes custom_channel_data = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getCustomChannelData()` + * @return {!Uint8Array} + */ +proto.lnrpc.CloseOutput.prototype.getCustomChannelData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getCustomChannelData())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.lnrpc.CloseOutput} returns this + */ +proto.lnrpc.CloseOutput.prototype.setCustomChannelData = function(value) { + return jspb.Message.setProto3BytesField(this, 4, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.lnrpc.ChannelCloseUpdate.repeatedFields_ = [5]; + + + if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -21263,7 +21614,11 @@ proto.lnrpc.ChannelCloseUpdate.prototype.toObject = function(opt_includeInstance proto.lnrpc.ChannelCloseUpdate.toObject = function(includeInstance, msg) { var f, obj = { closingTxid: msg.getClosingTxid_asB64(), - success: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + success: jspb.Message.getBooleanFieldWithDefault(msg, 2, false), + localCloseOutput: (f = msg.getLocalCloseOutput()) && proto.lnrpc.CloseOutput.toObject(includeInstance, f), + remoteCloseOutput: (f = msg.getRemoteCloseOutput()) && proto.lnrpc.CloseOutput.toObject(includeInstance, f), + additionalOutputsList: jspb.Message.toObjectList(msg.getAdditionalOutputsList(), + proto.lnrpc.CloseOutput.toObject, includeInstance) }; if (includeInstance) { @@ -21308,6 +21663,21 @@ proto.lnrpc.ChannelCloseUpdate.deserializeBinaryFromReader = function(msg, reade var value = /** @type {boolean} */ (reader.readBool()); msg.setSuccess(value); break; + case 3: + var value = new proto.lnrpc.CloseOutput; + reader.readMessage(value,proto.lnrpc.CloseOutput.deserializeBinaryFromReader); + msg.setLocalCloseOutput(value); + break; + case 4: + var value = new proto.lnrpc.CloseOutput; + reader.readMessage(value,proto.lnrpc.CloseOutput.deserializeBinaryFromReader); + msg.setRemoteCloseOutput(value); + break; + case 5: + var value = new proto.lnrpc.CloseOutput; + reader.readMessage(value,proto.lnrpc.CloseOutput.deserializeBinaryFromReader); + msg.addAdditionalOutputs(value); + break; default: reader.skipField(); break; @@ -21351,6 +21721,30 @@ proto.lnrpc.ChannelCloseUpdate.serializeBinaryToWriter = function(message, write f ); } + f = message.getLocalCloseOutput(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.lnrpc.CloseOutput.serializeBinaryToWriter + ); + } + f = message.getRemoteCloseOutput(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto.lnrpc.CloseOutput.serializeBinaryToWriter + ); + } + f = message.getAdditionalOutputsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 5, + f, + proto.lnrpc.CloseOutput.serializeBinaryToWriter + ); + } }; @@ -21414,6 +21808,118 @@ proto.lnrpc.ChannelCloseUpdate.prototype.setSuccess = function(value) { }; +/** + * optional CloseOutput local_close_output = 3; + * @return {?proto.lnrpc.CloseOutput} + */ +proto.lnrpc.ChannelCloseUpdate.prototype.getLocalCloseOutput = function() { + return /** @type{?proto.lnrpc.CloseOutput} */ ( + jspb.Message.getWrapperField(this, proto.lnrpc.CloseOutput, 3)); +}; + + +/** + * @param {?proto.lnrpc.CloseOutput|undefined} value + * @return {!proto.lnrpc.ChannelCloseUpdate} returns this +*/ +proto.lnrpc.ChannelCloseUpdate.prototype.setLocalCloseOutput = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.lnrpc.ChannelCloseUpdate} returns this + */ +proto.lnrpc.ChannelCloseUpdate.prototype.clearLocalCloseOutput = function() { + return this.setLocalCloseOutput(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.lnrpc.ChannelCloseUpdate.prototype.hasLocalCloseOutput = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional CloseOutput remote_close_output = 4; + * @return {?proto.lnrpc.CloseOutput} + */ +proto.lnrpc.ChannelCloseUpdate.prototype.getRemoteCloseOutput = function() { + return /** @type{?proto.lnrpc.CloseOutput} */ ( + jspb.Message.getWrapperField(this, proto.lnrpc.CloseOutput, 4)); +}; + + +/** + * @param {?proto.lnrpc.CloseOutput|undefined} value + * @return {!proto.lnrpc.ChannelCloseUpdate} returns this +*/ +proto.lnrpc.ChannelCloseUpdate.prototype.setRemoteCloseOutput = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.lnrpc.ChannelCloseUpdate} returns this + */ +proto.lnrpc.ChannelCloseUpdate.prototype.clearRemoteCloseOutput = function() { + return this.setRemoteCloseOutput(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.lnrpc.ChannelCloseUpdate.prototype.hasRemoteCloseOutput = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * repeated CloseOutput additional_outputs = 5; + * @return {!Array} + */ +proto.lnrpc.ChannelCloseUpdate.prototype.getAdditionalOutputsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.lnrpc.CloseOutput, 5)); +}; + + +/** + * @param {!Array} value + * @return {!proto.lnrpc.ChannelCloseUpdate} returns this +*/ +proto.lnrpc.ChannelCloseUpdate.prototype.setAdditionalOutputsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 5, value); +}; + + +/** + * @param {!proto.lnrpc.CloseOutput=} opt_value + * @param {number=} opt_index + * @return {!proto.lnrpc.CloseOutput} + */ +proto.lnrpc.ChannelCloseUpdate.prototype.addAdditionalOutputs = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, proto.lnrpc.CloseOutput, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.lnrpc.ChannelCloseUpdate} returns this + */ +proto.lnrpc.ChannelCloseUpdate.prototype.clearAdditionalOutputsList = function() { + return this.setAdditionalOutputsList([]); +}; + + @@ -28102,7 +28608,8 @@ proto.lnrpc.PendingChannelsResponse.PendingChannel.toObject = function(includeIn numForwardingPackages: jspb.Message.getFieldWithDefault(msg, 10, "0"), chanStatusFlags: jspb.Message.getFieldWithDefault(msg, 11, ""), pb_private: jspb.Message.getBooleanFieldWithDefault(msg, 12, false), - memo: jspb.Message.getFieldWithDefault(msg, 13, "") + memo: jspb.Message.getFieldWithDefault(msg, 13, ""), + customChannelData: msg.getCustomChannelData_asB64() }; if (includeInstance) { @@ -28191,6 +28698,10 @@ proto.lnrpc.PendingChannelsResponse.PendingChannel.deserializeBinaryFromReader = var value = /** @type {string} */ (reader.readString()); msg.setMemo(value); break; + case 34: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setCustomChannelData(value); + break; default: reader.skipField(); break; @@ -28311,6 +28822,13 @@ proto.lnrpc.PendingChannelsResponse.PendingChannel.serializeBinaryToWriter = fun f ); } + f = message.getCustomChannelData_asU8(); + if (f.length > 0) { + writer.writeBytes( + 34, + f + ); + } }; @@ -28548,6 +29066,48 @@ proto.lnrpc.PendingChannelsResponse.PendingChannel.prototype.setMemo = function( }; +/** + * optional bytes custom_channel_data = 34; + * @return {!(string|Uint8Array)} + */ +proto.lnrpc.PendingChannelsResponse.PendingChannel.prototype.getCustomChannelData = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 34, "")); +}; + + +/** + * optional bytes custom_channel_data = 34; + * This is a type-conversion wrapper around `getCustomChannelData()` + * @return {string} + */ +proto.lnrpc.PendingChannelsResponse.PendingChannel.prototype.getCustomChannelData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getCustomChannelData())); +}; + + +/** + * optional bytes custom_channel_data = 34; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getCustomChannelData()` + * @return {!Uint8Array} + */ +proto.lnrpc.PendingChannelsResponse.PendingChannel.prototype.getCustomChannelData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getCustomChannelData())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.lnrpc.PendingChannelsResponse.PendingChannel} returns this + */ +proto.lnrpc.PendingChannelsResponse.PendingChannel.prototype.setCustomChannelData = function(value) { + return jspb.Message.setProto3BytesField(this, 34, value); +}; + + @@ -31625,7 +32185,8 @@ proto.lnrpc.ChannelBalanceResponse.toObject = function(includeInstance, msg) { unsettledLocalBalance: (f = msg.getUnsettledLocalBalance()) && proto.lnrpc.Amount.toObject(includeInstance, f), unsettledRemoteBalance: (f = msg.getUnsettledRemoteBalance()) && proto.lnrpc.Amount.toObject(includeInstance, f), pendingOpenLocalBalance: (f = msg.getPendingOpenLocalBalance()) && proto.lnrpc.Amount.toObject(includeInstance, f), - pendingOpenRemoteBalance: (f = msg.getPendingOpenRemoteBalance()) && proto.lnrpc.Amount.toObject(includeInstance, f) + pendingOpenRemoteBalance: (f = msg.getPendingOpenRemoteBalance()) && proto.lnrpc.Amount.toObject(includeInstance, f), + customChannelData: msg.getCustomChannelData_asB64() }; if (includeInstance) { @@ -31700,6 +32261,10 @@ proto.lnrpc.ChannelBalanceResponse.deserializeBinaryFromReader = function(msg, r reader.readMessage(value,proto.lnrpc.Amount.deserializeBinaryFromReader); msg.setPendingOpenRemoteBalance(value); break; + case 9: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setCustomChannelData(value); + break; default: reader.skipField(); break; @@ -31791,6 +32356,13 @@ proto.lnrpc.ChannelBalanceResponse.serializeBinaryToWriter = function(message, w proto.lnrpc.Amount.serializeBinaryToWriter ); } + f = message.getCustomChannelData_asU8(); + if (f.length > 0) { + writer.writeBytes( + 9, + f + ); + } }; @@ -32052,6 +32624,48 @@ proto.lnrpc.ChannelBalanceResponse.prototype.hasPendingOpenRemoteBalance = funct }; +/** + * optional bytes custom_channel_data = 9; + * @return {!(string|Uint8Array)} + */ +proto.lnrpc.ChannelBalanceResponse.prototype.getCustomChannelData = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 9, "")); +}; + + +/** + * optional bytes custom_channel_data = 9; + * This is a type-conversion wrapper around `getCustomChannelData()` + * @return {string} + */ +proto.lnrpc.ChannelBalanceResponse.prototype.getCustomChannelData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getCustomChannelData())); +}; + + +/** + * optional bytes custom_channel_data = 9; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getCustomChannelData()` + * @return {!Uint8Array} + */ +proto.lnrpc.ChannelBalanceResponse.prototype.getCustomChannelData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getCustomChannelData())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.lnrpc.ChannelBalanceResponse} returns this + */ +proto.lnrpc.ChannelBalanceResponse.prototype.setCustomChannelData = function(value) { + return jspb.Message.setProto3BytesField(this, 9, value); +}; + + /** * List of repeated fields within this message type. @@ -34627,7 +35241,9 @@ proto.lnrpc.Route.toObject = function(includeInstance, msg) { hopsList: jspb.Message.toObjectList(msg.getHopsList(), proto.lnrpc.Hop.toObject, includeInstance), totalFeesMsat: jspb.Message.getFieldWithDefault(msg, 5, "0"), - totalAmtMsat: jspb.Message.getFieldWithDefault(msg, 6, "0") + totalAmtMsat: jspb.Message.getFieldWithDefault(msg, 6, "0"), + firstHopAmountMsat: jspb.Message.getFieldWithDefault(msg, 7, "0"), + customChannelData: msg.getCustomChannelData_asB64() }; if (includeInstance) { @@ -34689,6 +35305,14 @@ proto.lnrpc.Route.deserializeBinaryFromReader = function(msg, reader) { var value = /** @type {string} */ (reader.readInt64String()); msg.setTotalAmtMsat(value); break; + case 7: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setFirstHopAmountMsat(value); + break; + case 8: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setCustomChannelData(value); + break; default: reader.skipField(); break; @@ -34761,6 +35385,20 @@ proto.lnrpc.Route.serializeBinaryToWriter = function(message, writer) { f ); } + f = message.getFirstHopAmountMsat(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 7, + f + ); + } + f = message.getCustomChannelData_asU8(); + if (f.length > 0) { + writer.writeBytes( + 8, + f + ); + } }; @@ -34892,6 +35530,66 @@ proto.lnrpc.Route.prototype.setTotalAmtMsat = function(value) { }; +/** + * optional int64 first_hop_amount_msat = 7; + * @return {string} + */ +proto.lnrpc.Route.prototype.getFirstHopAmountMsat = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.lnrpc.Route} returns this + */ +proto.lnrpc.Route.prototype.setFirstHopAmountMsat = function(value) { + return jspb.Message.setProto3StringIntField(this, 7, value); +}; + + +/** + * optional bytes custom_channel_data = 8; + * @return {!(string|Uint8Array)} + */ +proto.lnrpc.Route.prototype.getCustomChannelData = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 8, "")); +}; + + +/** + * optional bytes custom_channel_data = 8; + * This is a type-conversion wrapper around `getCustomChannelData()` + * @return {string} + */ +proto.lnrpc.Route.prototype.getCustomChannelData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getCustomChannelData())); +}; + + +/** + * optional bytes custom_channel_data = 8; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getCustomChannelData()` + * @return {!Uint8Array} + */ +proto.lnrpc.Route.prototype.getCustomChannelData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getCustomChannelData())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.lnrpc.Route} returns this + */ +proto.lnrpc.Route.prototype.setCustomChannelData = function(value) { + return jspb.Message.setProto3BytesField(this, 8, value); +}; + + @@ -42799,7 +43497,8 @@ proto.lnrpc.InvoiceHTLC.toObject = function(includeInstance, msg) { state: jspb.Message.getFieldWithDefault(msg, 8, 0), customRecordsMap: (f = msg.getCustomRecordsMap()) ? f.toObject(includeInstance, undefined) : [], mppTotalAmtMsat: jspb.Message.getFieldWithDefault(msg, 10, "0"), - amp: (f = msg.getAmp()) && proto.lnrpc.AMP.toObject(includeInstance, f) + amp: (f = msg.getAmp()) && proto.lnrpc.AMP.toObject(includeInstance, f), + customChannelData: msg.getCustomChannelData_asB64() }; if (includeInstance) { @@ -42883,6 +43582,10 @@ proto.lnrpc.InvoiceHTLC.deserializeBinaryFromReader = function(msg, reader) { reader.readMessage(value,proto.lnrpc.AMP.deserializeBinaryFromReader); msg.setAmp(value); break; + case 12: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setCustomChannelData(value); + break; default: reader.skipField(); break; @@ -42987,6 +43690,13 @@ proto.lnrpc.InvoiceHTLC.serializeBinaryToWriter = function(message, writer) { proto.lnrpc.AMP.serializeBinaryToWriter ); } + f = message.getCustomChannelData_asU8(); + if (f.length > 0) { + writer.writeBytes( + 12, + f + ); + } }; @@ -43212,6 +43922,48 @@ proto.lnrpc.InvoiceHTLC.prototype.hasAmp = function() { }; +/** + * optional bytes custom_channel_data = 12; + * @return {!(string|Uint8Array)} + */ +proto.lnrpc.InvoiceHTLC.prototype.getCustomChannelData = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 12, "")); +}; + + +/** + * optional bytes custom_channel_data = 12; + * This is a type-conversion wrapper around `getCustomChannelData()` + * @return {string} + */ +proto.lnrpc.InvoiceHTLC.prototype.getCustomChannelData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getCustomChannelData())); +}; + + +/** + * optional bytes custom_channel_data = 12; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getCustomChannelData()` + * @return {!Uint8Array} + */ +proto.lnrpc.InvoiceHTLC.prototype.getCustomChannelData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getCustomChannelData())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.lnrpc.InvoiceHTLC} returns this + */ +proto.lnrpc.InvoiceHTLC.prototype.setCustomChannelData = function(value) { + return jspb.Message.setProto3BytesField(this, 12, value); +}; + + @@ -44724,7 +45476,8 @@ proto.lnrpc.Payment.toObject = function(includeInstance, msg) { htlcsList: jspb.Message.toObjectList(msg.getHtlcsList(), proto.lnrpc.HTLCAttempt.toObject, includeInstance), paymentIndex: jspb.Message.getFieldWithDefault(msg, 15, "0"), - failureReason: jspb.Message.getFieldWithDefault(msg, 16, 0) + failureReason: jspb.Message.getFieldWithDefault(msg, 16, 0), + firstHopCustomRecordsMap: (f = msg.getFirstHopCustomRecordsMap()) ? f.toObject(includeInstance, undefined) : [] }; if (includeInstance) { @@ -44822,6 +45575,12 @@ proto.lnrpc.Payment.deserializeBinaryFromReader = function(msg, reader) { var value = /** @type {!proto.lnrpc.PaymentFailureReason} */ (reader.readEnum()); msg.setFailureReason(value); break; + case 17: + var value = msg.getFirstHopCustomRecordsMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readUint64, jspb.BinaryReader.prototype.readBytes, null, 0, ""); + }); + break; default: reader.skipField(); break; @@ -44957,6 +45716,10 @@ proto.lnrpc.Payment.serializeBinaryToWriter = function(message, writer) { f ); } + f = message.getFirstHopCustomRecordsMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(17, writer, jspb.BinaryWriter.prototype.writeUint64, jspb.BinaryWriter.prototype.writeBytes); + } }; @@ -45261,6 +46024,29 @@ proto.lnrpc.Payment.prototype.setFailureReason = function(value) { }; +/** + * map first_hop_custom_records = 17; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.lnrpc.Payment.prototype.getFirstHopCustomRecordsMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 17, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.lnrpc.Payment} returns this + */ +proto.lnrpc.Payment.prototype.clearFirstHopCustomRecordsMap = function() { + this.getFirstHopCustomRecordsMap().clear(); + return this; +}; + + @@ -57257,7 +58043,8 @@ proto.lnrpc.CommitmentType = { STATIC_REMOTE_KEY: 2, ANCHORS: 3, SCRIPT_ENFORCED_LEASE: 4, - SIMPLE_TAPROOT: 5 + SIMPLE_TAPROOT: 5, + SIMPLE_TAPROOT_OVERLAY: 6 }; /** diff --git a/app/src/types/generated/loop_pb.d.ts b/app/src/types/generated/loop_pb.d.ts index 3250adeed..903e1f70c 100644 --- a/app/src/types/generated/loop_pb.d.ts +++ b/app/src/types/generated/loop_pb.d.ts @@ -522,6 +522,11 @@ export class QuoteRequest extends jspb.Message { getPrivate(): boolean; setPrivate(value: boolean): void; + clearDepositOutpointsList(): void; + getDepositOutpointsList(): Array; + setDepositOutpointsList(value: Array): void; + addDepositOutpoints(value: string, index?: number): string; + serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): QuoteRequest.AsObject; static toObject(includeInstance: boolean, msg: QuoteRequest): QuoteRequest.AsObject; @@ -541,6 +546,7 @@ export namespace QuoteRequest { loopInLastHop: Uint8Array | string, loopInRouteHintsList: Array, pb_private: boolean, + depositOutpointsList: Array, } } @@ -704,6 +710,38 @@ export namespace TokensResponse { } } +export class FetchL402TokenRequest extends jspb.Message { + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): FetchL402TokenRequest.AsObject; + static toObject(includeInstance: boolean, msg: FetchL402TokenRequest): FetchL402TokenRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: FetchL402TokenRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): FetchL402TokenRequest; + static deserializeBinaryFromReader(message: FetchL402TokenRequest, reader: jspb.BinaryReader): FetchL402TokenRequest; +} + +export namespace FetchL402TokenRequest { + export type AsObject = { + } +} + +export class FetchL402TokenResponse extends jspb.Message { + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): FetchL402TokenResponse.AsObject; + static toObject(includeInstance: boolean, msg: FetchL402TokenResponse): FetchL402TokenResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: FetchL402TokenResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): FetchL402TokenResponse; + static deserializeBinaryFromReader(message: FetchL402TokenResponse, reader: jspb.BinaryReader): FetchL402TokenResponse; +} + +export namespace FetchL402TokenResponse { + export type AsObject = { + } +} + export class L402Token extends jspb.Message { getBaseMacaroon(): Uint8Array | string; getBaseMacaroon_asU8(): Uint8Array; @@ -1470,6 +1508,570 @@ export namespace InstantOut { } } +export class NewStaticAddressRequest extends jspb.Message { + getClientKey(): Uint8Array | string; + getClientKey_asU8(): Uint8Array; + getClientKey_asB64(): string; + setClientKey(value: Uint8Array | string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): NewStaticAddressRequest.AsObject; + static toObject(includeInstance: boolean, msg: NewStaticAddressRequest): NewStaticAddressRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: NewStaticAddressRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): NewStaticAddressRequest; + static deserializeBinaryFromReader(message: NewStaticAddressRequest, reader: jspb.BinaryReader): NewStaticAddressRequest; +} + +export namespace NewStaticAddressRequest { + export type AsObject = { + clientKey: Uint8Array | string, + } +} + +export class NewStaticAddressResponse extends jspb.Message { + getAddress(): string; + setAddress(value: string): void; + + getExpiry(): number; + setExpiry(value: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): NewStaticAddressResponse.AsObject; + static toObject(includeInstance: boolean, msg: NewStaticAddressResponse): NewStaticAddressResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: NewStaticAddressResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): NewStaticAddressResponse; + static deserializeBinaryFromReader(message: NewStaticAddressResponse, reader: jspb.BinaryReader): NewStaticAddressResponse; +} + +export namespace NewStaticAddressResponse { + export type AsObject = { + address: string, + expiry: number, + } +} + +export class ListUnspentDepositsRequest extends jspb.Message { + getMinConfs(): number; + setMinConfs(value: number): void; + + getMaxConfs(): number; + setMaxConfs(value: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ListUnspentDepositsRequest.AsObject; + static toObject(includeInstance: boolean, msg: ListUnspentDepositsRequest): ListUnspentDepositsRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ListUnspentDepositsRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ListUnspentDepositsRequest; + static deserializeBinaryFromReader(message: ListUnspentDepositsRequest, reader: jspb.BinaryReader): ListUnspentDepositsRequest; +} + +export namespace ListUnspentDepositsRequest { + export type AsObject = { + minConfs: number, + maxConfs: number, + } +} + +export class ListUnspentDepositsResponse extends jspb.Message { + clearUtxosList(): void; + getUtxosList(): Array; + setUtxosList(value: Array): void; + addUtxos(value?: Utxo, index?: number): Utxo; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ListUnspentDepositsResponse.AsObject; + static toObject(includeInstance: boolean, msg: ListUnspentDepositsResponse): ListUnspentDepositsResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ListUnspentDepositsResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ListUnspentDepositsResponse; + static deserializeBinaryFromReader(message: ListUnspentDepositsResponse, reader: jspb.BinaryReader): ListUnspentDepositsResponse; +} + +export namespace ListUnspentDepositsResponse { + export type AsObject = { + utxosList: Array, + } +} + +export class Utxo extends jspb.Message { + getStaticAddress(): string; + setStaticAddress(value: string): void; + + getAmountSat(): string; + setAmountSat(value: string): void; + + getOutpoint(): string; + setOutpoint(value: string): void; + + getConfirmations(): string; + setConfirmations(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Utxo.AsObject; + static toObject(includeInstance: boolean, msg: Utxo): Utxo.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Utxo, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Utxo; + static deserializeBinaryFromReader(message: Utxo, reader: jspb.BinaryReader): Utxo; +} + +export namespace Utxo { + export type AsObject = { + staticAddress: string, + amountSat: string, + outpoint: string, + confirmations: string, + } +} + +export class WithdrawDepositsRequest extends jspb.Message { + clearOutpointsList(): void; + getOutpointsList(): Array; + setOutpointsList(value: Array): void; + addOutpoints(value?: OutPoint, index?: number): OutPoint; + + getAll(): boolean; + setAll(value: boolean): void; + + getDestAddr(): string; + setDestAddr(value: string): void; + + getSatPerVbyte(): string; + setSatPerVbyte(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): WithdrawDepositsRequest.AsObject; + static toObject(includeInstance: boolean, msg: WithdrawDepositsRequest): WithdrawDepositsRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: WithdrawDepositsRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): WithdrawDepositsRequest; + static deserializeBinaryFromReader(message: WithdrawDepositsRequest, reader: jspb.BinaryReader): WithdrawDepositsRequest; +} + +export namespace WithdrawDepositsRequest { + export type AsObject = { + outpointsList: Array, + all: boolean, + destAddr: string, + satPerVbyte: string, + } +} + +export class WithdrawDepositsResponse extends jspb.Message { + getWithdrawalTxHash(): string; + setWithdrawalTxHash(value: string): void; + + getPkScript(): string; + setPkScript(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): WithdrawDepositsResponse.AsObject; + static toObject(includeInstance: boolean, msg: WithdrawDepositsResponse): WithdrawDepositsResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: WithdrawDepositsResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): WithdrawDepositsResponse; + static deserializeBinaryFromReader(message: WithdrawDepositsResponse, reader: jspb.BinaryReader): WithdrawDepositsResponse; +} + +export namespace WithdrawDepositsResponse { + export type AsObject = { + withdrawalTxHash: string, + pkScript: string, + } +} + +export class OutPoint extends jspb.Message { + getTxidBytes(): Uint8Array | string; + getTxidBytes_asU8(): Uint8Array; + getTxidBytes_asB64(): string; + setTxidBytes(value: Uint8Array | string): void; + + getTxidStr(): string; + setTxidStr(value: string): void; + + getOutputIndex(): number; + setOutputIndex(value: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): OutPoint.AsObject; + static toObject(includeInstance: boolean, msg: OutPoint): OutPoint.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: OutPoint, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): OutPoint; + static deserializeBinaryFromReader(message: OutPoint, reader: jspb.BinaryReader): OutPoint; +} + +export namespace OutPoint { + export type AsObject = { + txidBytes: Uint8Array | string, + txidStr: string, + outputIndex: number, + } +} + +export class ListStaticAddressDepositsRequest extends jspb.Message { + getStateFilter(): DepositStateMap[keyof DepositStateMap]; + setStateFilter(value: DepositStateMap[keyof DepositStateMap]): void; + + clearOutpointsList(): void; + getOutpointsList(): Array; + setOutpointsList(value: Array): void; + addOutpoints(value: string, index?: number): string; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ListStaticAddressDepositsRequest.AsObject; + static toObject(includeInstance: boolean, msg: ListStaticAddressDepositsRequest): ListStaticAddressDepositsRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ListStaticAddressDepositsRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ListStaticAddressDepositsRequest; + static deserializeBinaryFromReader(message: ListStaticAddressDepositsRequest, reader: jspb.BinaryReader): ListStaticAddressDepositsRequest; +} + +export namespace ListStaticAddressDepositsRequest { + export type AsObject = { + stateFilter: DepositStateMap[keyof DepositStateMap], + outpointsList: Array, + } +} + +export class ListStaticAddressDepositsResponse extends jspb.Message { + clearFilteredDepositsList(): void; + getFilteredDepositsList(): Array; + setFilteredDepositsList(value: Array): void; + addFilteredDeposits(value?: Deposit, index?: number): Deposit; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ListStaticAddressDepositsResponse.AsObject; + static toObject(includeInstance: boolean, msg: ListStaticAddressDepositsResponse): ListStaticAddressDepositsResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ListStaticAddressDepositsResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ListStaticAddressDepositsResponse; + static deserializeBinaryFromReader(message: ListStaticAddressDepositsResponse, reader: jspb.BinaryReader): ListStaticAddressDepositsResponse; +} + +export namespace ListStaticAddressDepositsResponse { + export type AsObject = { + filteredDepositsList: Array, + } +} + +export class ListStaticAddressSwapsRequest extends jspb.Message { + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ListStaticAddressSwapsRequest.AsObject; + static toObject(includeInstance: boolean, msg: ListStaticAddressSwapsRequest): ListStaticAddressSwapsRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ListStaticAddressSwapsRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ListStaticAddressSwapsRequest; + static deserializeBinaryFromReader(message: ListStaticAddressSwapsRequest, reader: jspb.BinaryReader): ListStaticAddressSwapsRequest; +} + +export namespace ListStaticAddressSwapsRequest { + export type AsObject = { + } +} + +export class ListStaticAddressSwapsResponse extends jspb.Message { + clearSwapsList(): void; + getSwapsList(): Array; + setSwapsList(value: Array): void; + addSwaps(value?: StaticAddressLoopInSwap, index?: number): StaticAddressLoopInSwap; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ListStaticAddressSwapsResponse.AsObject; + static toObject(includeInstance: boolean, msg: ListStaticAddressSwapsResponse): ListStaticAddressSwapsResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ListStaticAddressSwapsResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ListStaticAddressSwapsResponse; + static deserializeBinaryFromReader(message: ListStaticAddressSwapsResponse, reader: jspb.BinaryReader): ListStaticAddressSwapsResponse; +} + +export namespace ListStaticAddressSwapsResponse { + export type AsObject = { + swapsList: Array, + } +} + +export class StaticAddressSummaryRequest extends jspb.Message { + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): StaticAddressSummaryRequest.AsObject; + static toObject(includeInstance: boolean, msg: StaticAddressSummaryRequest): StaticAddressSummaryRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: StaticAddressSummaryRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): StaticAddressSummaryRequest; + static deserializeBinaryFromReader(message: StaticAddressSummaryRequest, reader: jspb.BinaryReader): StaticAddressSummaryRequest; +} + +export namespace StaticAddressSummaryRequest { + export type AsObject = { + } +} + +export class StaticAddressSummaryResponse extends jspb.Message { + getStaticAddress(): string; + setStaticAddress(value: string): void; + + getRelativeExpiryBlocks(): string; + setRelativeExpiryBlocks(value: string): void; + + getTotalNumDeposits(): number; + setTotalNumDeposits(value: number): void; + + getValueUnconfirmedSatoshis(): string; + setValueUnconfirmedSatoshis(value: string): void; + + getValueDepositedSatoshis(): string; + setValueDepositedSatoshis(value: string): void; + + getValueExpiredSatoshis(): string; + setValueExpiredSatoshis(value: string): void; + + getValueWithdrawnSatoshis(): string; + setValueWithdrawnSatoshis(value: string): void; + + getValueLoopedInSatoshis(): string; + setValueLoopedInSatoshis(value: string): void; + + getValueHtlcTimeoutSweepsSatoshis(): string; + setValueHtlcTimeoutSweepsSatoshis(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): StaticAddressSummaryResponse.AsObject; + static toObject(includeInstance: boolean, msg: StaticAddressSummaryResponse): StaticAddressSummaryResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: StaticAddressSummaryResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): StaticAddressSummaryResponse; + static deserializeBinaryFromReader(message: StaticAddressSummaryResponse, reader: jspb.BinaryReader): StaticAddressSummaryResponse; +} + +export namespace StaticAddressSummaryResponse { + export type AsObject = { + staticAddress: string, + relativeExpiryBlocks: string, + totalNumDeposits: number, + valueUnconfirmedSatoshis: string, + valueDepositedSatoshis: string, + valueExpiredSatoshis: string, + valueWithdrawnSatoshis: string, + valueLoopedInSatoshis: string, + valueHtlcTimeoutSweepsSatoshis: string, + } +} + +export class Deposit extends jspb.Message { + getId(): Uint8Array | string; + getId_asU8(): Uint8Array; + getId_asB64(): string; + setId(value: Uint8Array | string): void; + + getState(): DepositStateMap[keyof DepositStateMap]; + setState(value: DepositStateMap[keyof DepositStateMap]): void; + + getOutpoint(): string; + setOutpoint(value: string): void; + + getValue(): string; + setValue(value: string): void; + + getConfirmationHeight(): string; + setConfirmationHeight(value: string): void; + + getBlocksUntilExpiry(): string; + setBlocksUntilExpiry(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Deposit.AsObject; + static toObject(includeInstance: boolean, msg: Deposit): Deposit.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Deposit, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Deposit; + static deserializeBinaryFromReader(message: Deposit, reader: jspb.BinaryReader): Deposit; +} + +export namespace Deposit { + export type AsObject = { + id: Uint8Array | string, + state: DepositStateMap[keyof DepositStateMap], + outpoint: string, + value: string, + confirmationHeight: string, + blocksUntilExpiry: string, + } +} + +export class StaticAddressLoopInSwap extends jspb.Message { + getSwapHash(): Uint8Array | string; + getSwapHash_asU8(): Uint8Array; + getSwapHash_asB64(): string; + setSwapHash(value: Uint8Array | string): void; + + clearDepositOutpointsList(): void; + getDepositOutpointsList(): Array; + setDepositOutpointsList(value: Array): void; + addDepositOutpoints(value: string, index?: number): string; + + getState(): StaticAddressLoopInSwapStateMap[keyof StaticAddressLoopInSwapStateMap]; + setState(value: StaticAddressLoopInSwapStateMap[keyof StaticAddressLoopInSwapStateMap]): void; + + getSwapAmountSatoshis(): string; + setSwapAmountSatoshis(value: string): void; + + getPaymentRequestAmountSatoshis(): string; + setPaymentRequestAmountSatoshis(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): StaticAddressLoopInSwap.AsObject; + static toObject(includeInstance: boolean, msg: StaticAddressLoopInSwap): StaticAddressLoopInSwap.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: StaticAddressLoopInSwap, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): StaticAddressLoopInSwap; + static deserializeBinaryFromReader(message: StaticAddressLoopInSwap, reader: jspb.BinaryReader): StaticAddressLoopInSwap; +} + +export namespace StaticAddressLoopInSwap { + export type AsObject = { + swapHash: Uint8Array | string, + depositOutpointsList: Array, + state: StaticAddressLoopInSwapStateMap[keyof StaticAddressLoopInSwapStateMap], + swapAmountSatoshis: string, + paymentRequestAmountSatoshis: string, + } +} + +export class StaticAddressLoopInRequest extends jspb.Message { + clearOutpointsList(): void; + getOutpointsList(): Array; + setOutpointsList(value: Array): void; + addOutpoints(value: string, index?: number): string; + + getMaxSwapFeeSatoshis(): string; + setMaxSwapFeeSatoshis(value: string): void; + + getLastHop(): Uint8Array | string; + getLastHop_asU8(): Uint8Array; + getLastHop_asB64(): string; + setLastHop(value: Uint8Array | string): void; + + getLabel(): string; + setLabel(value: string): void; + + getInitiator(): string; + setInitiator(value: string): void; + + clearRouteHintsList(): void; + getRouteHintsList(): Array; + setRouteHintsList(value: Array): void; + addRouteHints(value?: swapserverrpc_common_pb.RouteHint, index?: number): swapserverrpc_common_pb.RouteHint; + + getPrivate(): boolean; + setPrivate(value: boolean): void; + + getPaymentTimeoutSeconds(): number; + setPaymentTimeoutSeconds(value: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): StaticAddressLoopInRequest.AsObject; + static toObject(includeInstance: boolean, msg: StaticAddressLoopInRequest): StaticAddressLoopInRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: StaticAddressLoopInRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): StaticAddressLoopInRequest; + static deserializeBinaryFromReader(message: StaticAddressLoopInRequest, reader: jspb.BinaryReader): StaticAddressLoopInRequest; +} + +export namespace StaticAddressLoopInRequest { + export type AsObject = { + outpointsList: Array, + maxSwapFeeSatoshis: string, + lastHop: Uint8Array | string, + label: string, + initiator: string, + routeHintsList: Array, + pb_private: boolean, + paymentTimeoutSeconds: number, + } +} + +export class StaticAddressLoopInResponse extends jspb.Message { + getSwapHash(): Uint8Array | string; + getSwapHash_asU8(): Uint8Array; + getSwapHash_asB64(): string; + setSwapHash(value: Uint8Array | string): void; + + getState(): string; + setState(value: string): void; + + getAmount(): string; + setAmount(value: string): void; + + getHtlcCltv(): number; + setHtlcCltv(value: number): void; + + getQuotedSwapFeeSatoshis(): string; + setQuotedSwapFeeSatoshis(value: string): void; + + getMaxSwapFeeSatoshis(): string; + setMaxSwapFeeSatoshis(value: string): void; + + getInitiationHeight(): number; + setInitiationHeight(value: number): void; + + getProtocolVersion(): string; + setProtocolVersion(value: string): void; + + getLabel(): string; + setLabel(value: string): void; + + getInitiator(): string; + setInitiator(value: string): void; + + getPaymentTimeoutSeconds(): number; + setPaymentTimeoutSeconds(value: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): StaticAddressLoopInResponse.AsObject; + static toObject(includeInstance: boolean, msg: StaticAddressLoopInResponse): StaticAddressLoopInResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: StaticAddressLoopInResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): StaticAddressLoopInResponse; + static deserializeBinaryFromReader(message: StaticAddressLoopInResponse, reader: jspb.BinaryReader): StaticAddressLoopInResponse; +} + +export namespace StaticAddressLoopInResponse { + export type AsObject = { + swapHash: Uint8Array | string, + state: string, + amount: string, + htlcCltv: number, + quotedSwapFeeSatoshis: string, + maxSwapFeeSatoshis: string, + initiationHeight: number, + protocolVersion: string, + label: string, + initiator: string, + paymentTimeoutSeconds: number, + } +} + export interface AddressTypeMap { ADDRESS_TYPE_UNKNOWN: 0; TAPROOT_PUBKEY: 1; @@ -1536,3 +2138,36 @@ export interface AutoReasonMap { export const AutoReason: AutoReasonMap; +export interface DepositStateMap { + UNKNOWN_STATE: 0; + DEPOSITED: 1; + WITHDRAWING: 2; + WITHDRAWN: 3; + LOOPING_IN: 4; + LOOPED_IN: 5; + SWEEP_HTLC_TIMEOUT: 6; + HTLC_TIMEOUT_SWEPT: 7; + PUBLISH_EXPIRED: 8; + WAIT_FOR_EXPIRY_SWEEP: 9; + EXPIRED: 10; +} + +export const DepositState: DepositStateMap; + +export interface StaticAddressLoopInSwapStateMap { + UNKNOWN_STATIC_ADDRESS_SWAP_STATE: 0; + INIT_HTLC: 1; + SIGN_HTLC_TX: 2; + MONITOR_INVOICE_HTLC_TX: 3; + PAYMENT_RECEIVED: 4; + SWEEP_STATIC_ADDRESS_HTLC_TIMEOUT: 5; + MONITOR_HTLC_TIMEOUT_SWEEP: 6; + HTLC_STATIC_ADDRESS_TIMEOUT_SWEPT: 7; + SUCCEEDED: 8; + SUCCEEDED_TRANSITIONING_FAILED: 9; + UNLOCK_DEPOSITS: 10; + FAILED_STATIC_ADDRESS_SWAP: 11; +} + +export const StaticAddressLoopInSwapState: StaticAddressLoopInSwapStateMap; + diff --git a/app/src/types/generated/loop_pb.js b/app/src/types/generated/loop_pb.js index bc2e8f94a..37d7766be 100644 --- a/app/src/types/generated/loop_pb.js +++ b/app/src/types/generated/loop_pb.js @@ -31,8 +31,12 @@ goog.exportSymbol('proto.looprpc.AbandonSwapResponse', null, global); goog.exportSymbol('proto.looprpc.AddressType', null, global); goog.exportSymbol('proto.looprpc.AutoReason', null, global); goog.exportSymbol('proto.looprpc.ClientReservation', null, global); +goog.exportSymbol('proto.looprpc.Deposit', null, global); +goog.exportSymbol('proto.looprpc.DepositState', null, global); goog.exportSymbol('proto.looprpc.Disqualified', null, global); goog.exportSymbol('proto.looprpc.FailureReason', null, global); +goog.exportSymbol('proto.looprpc.FetchL402TokenRequest', null, global); +goog.exportSymbol('proto.looprpc.FetchL402TokenResponse', null, global); goog.exportSymbol('proto.looprpc.GetInfoRequest', null, global); goog.exportSymbol('proto.looprpc.GetInfoResponse', null, global); goog.exportSymbol('proto.looprpc.GetLiquidityParamsRequest', null, global); @@ -51,14 +55,23 @@ goog.exportSymbol('proto.looprpc.ListInstantOutsRequest', null, global); goog.exportSymbol('proto.looprpc.ListInstantOutsResponse', null, global); goog.exportSymbol('proto.looprpc.ListReservationsRequest', null, global); goog.exportSymbol('proto.looprpc.ListReservationsResponse', null, global); +goog.exportSymbol('proto.looprpc.ListStaticAddressDepositsRequest', null, global); +goog.exportSymbol('proto.looprpc.ListStaticAddressDepositsResponse', null, global); +goog.exportSymbol('proto.looprpc.ListStaticAddressSwapsRequest', null, global); +goog.exportSymbol('proto.looprpc.ListStaticAddressSwapsResponse', null, global); goog.exportSymbol('proto.looprpc.ListSwapsFilter', null, global); goog.exportSymbol('proto.looprpc.ListSwapsFilter.SwapTypeFilter', null, global); goog.exportSymbol('proto.looprpc.ListSwapsRequest', null, global); goog.exportSymbol('proto.looprpc.ListSwapsResponse', null, global); +goog.exportSymbol('proto.looprpc.ListUnspentDepositsRequest', null, global); +goog.exportSymbol('proto.looprpc.ListUnspentDepositsResponse', null, global); goog.exportSymbol('proto.looprpc.LoopInRequest', null, global); goog.exportSymbol('proto.looprpc.LoopOutRequest', null, global); goog.exportSymbol('proto.looprpc.LoopStats', null, global); goog.exportSymbol('proto.looprpc.MonitorRequest', null, global); +goog.exportSymbol('proto.looprpc.NewStaticAddressRequest', null, global); +goog.exportSymbol('proto.looprpc.NewStaticAddressResponse', null, global); +goog.exportSymbol('proto.looprpc.OutPoint', null, global); goog.exportSymbol('proto.looprpc.OutQuoteResponse', null, global); goog.exportSymbol('proto.looprpc.OutTermsResponse', null, global); goog.exportSymbol('proto.looprpc.ProbeRequest', null, global); @@ -66,6 +79,12 @@ goog.exportSymbol('proto.looprpc.ProbeResponse', null, global); goog.exportSymbol('proto.looprpc.QuoteRequest', null, global); goog.exportSymbol('proto.looprpc.SetLiquidityParamsRequest', null, global); goog.exportSymbol('proto.looprpc.SetLiquidityParamsResponse', null, global); +goog.exportSymbol('proto.looprpc.StaticAddressLoopInRequest', null, global); +goog.exportSymbol('proto.looprpc.StaticAddressLoopInResponse', null, global); +goog.exportSymbol('proto.looprpc.StaticAddressLoopInSwap', null, global); +goog.exportSymbol('proto.looprpc.StaticAddressLoopInSwapState', null, global); +goog.exportSymbol('proto.looprpc.StaticAddressSummaryRequest', null, global); +goog.exportSymbol('proto.looprpc.StaticAddressSummaryResponse', null, global); goog.exportSymbol('proto.looprpc.SuggestSwapsRequest', null, global); goog.exportSymbol('proto.looprpc.SuggestSwapsResponse', null, global); goog.exportSymbol('proto.looprpc.SwapInfoRequest', null, global); @@ -76,6 +95,9 @@ goog.exportSymbol('proto.looprpc.SwapType', null, global); goog.exportSymbol('proto.looprpc.TermsRequest', null, global); goog.exportSymbol('proto.looprpc.TokensRequest', null, global); goog.exportSymbol('proto.looprpc.TokensResponse', null, global); +goog.exportSymbol('proto.looprpc.Utxo', null, global); +goog.exportSymbol('proto.looprpc.WithdrawDepositsRequest', null, global); +goog.exportSymbol('proto.looprpc.WithdrawDepositsResponse', null, global); /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -475,6 +497,48 @@ if (goog.DEBUG && !COMPILED) { */ proto.looprpc.TokensResponse.displayName = 'proto.looprpc.TokensResponse'; } +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.looprpc.FetchL402TokenRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.looprpc.FetchL402TokenRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.looprpc.FetchL402TokenRequest.displayName = 'proto.looprpc.FetchL402TokenRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.looprpc.FetchL402TokenResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.looprpc.FetchL402TokenResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.looprpc.FetchL402TokenResponse.displayName = 'proto.looprpc.FetchL402TokenResponse'; +} /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -979,177 +1043,4043 @@ if (goog.DEBUG && !COMPILED) { */ proto.looprpc.InstantOut.displayName = 'proto.looprpc.InstantOut'; } - /** - * List of repeated fields within this message type. - * @private {!Array} - * @const + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor */ -proto.looprpc.LoopOutRequest.repeatedFields_ = [11,18]; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { +proto.looprpc.NewStaticAddressRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.looprpc.NewStaticAddressRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.looprpc.NewStaticAddressRequest.displayName = 'proto.looprpc.NewStaticAddressRequest'; +} /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor */ -proto.looprpc.LoopOutRequest.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.LoopOutRequest.toObject(opt_includeInstance, this); +proto.looprpc.NewStaticAddressResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; - - +goog.inherits(proto.looprpc.NewStaticAddressResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.looprpc.NewStaticAddressResponse.displayName = 'proto.looprpc.NewStaticAddressResponse'; +} /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.looprpc.LoopOutRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor */ -proto.looprpc.LoopOutRequest.toObject = function(includeInstance, msg) { - var f, obj = { - amt: jspb.Message.getFieldWithDefault(msg, 1, "0"), - dest: jspb.Message.getFieldWithDefault(msg, 2, ""), - maxSwapRoutingFee: jspb.Message.getFieldWithDefault(msg, 3, "0"), - maxPrepayRoutingFee: jspb.Message.getFieldWithDefault(msg, 4, "0"), - maxSwapFee: jspb.Message.getFieldWithDefault(msg, 5, "0"), - maxPrepayAmt: jspb.Message.getFieldWithDefault(msg, 6, "0"), - maxMinerFee: jspb.Message.getFieldWithDefault(msg, 7, "0"), - loopOutChannel: jspb.Message.getFieldWithDefault(msg, 8, "0"), - outgoingChanSetList: (f = jspb.Message.getRepeatedField(msg, 11)) == null ? undefined : f, - sweepConfTarget: jspb.Message.getFieldWithDefault(msg, 9, 0), - htlcConfirmations: jspb.Message.getFieldWithDefault(msg, 13, 0), - swapPublicationDeadline: jspb.Message.getFieldWithDefault(msg, 10, "0"), - label: jspb.Message.getFieldWithDefault(msg, 12, ""), - initiator: jspb.Message.getFieldWithDefault(msg, 14, ""), - account: jspb.Message.getFieldWithDefault(msg, 15, ""), - accountAddrType: jspb.Message.getFieldWithDefault(msg, 16, 0), - isExternalAddr: jspb.Message.getBooleanFieldWithDefault(msg, 17, false), - reservationIdsList: msg.getReservationIdsList_asB64(), - paymentTimeout: jspb.Message.getFieldWithDefault(msg, 19, 0) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; +proto.looprpc.ListUnspentDepositsRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; +goog.inherits(proto.looprpc.ListUnspentDepositsRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.looprpc.ListUnspentDepositsRequest.displayName = 'proto.looprpc.ListUnspentDepositsRequest'; } - - /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.LoopOutRequest} + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor */ -proto.looprpc.LoopOutRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.LoopOutRequest; - return proto.looprpc.LoopOutRequest.deserializeBinaryFromReader(msg, reader); +proto.looprpc.ListUnspentDepositsResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.looprpc.ListUnspentDepositsResponse.repeatedFields_, null); }; - - +goog.inherits(proto.looprpc.ListUnspentDepositsResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.looprpc.ListUnspentDepositsResponse.displayName = 'proto.looprpc.ListUnspentDepositsResponse'; +} /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.looprpc.LoopOutRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.LoopOutRequest} + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor */ -proto.looprpc.LoopOutRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setAmt(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setDest(value); - break; - case 3: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setMaxSwapRoutingFee(value); - break; - case 4: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setMaxPrepayRoutingFee(value); - break; - case 5: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setMaxSwapFee(value); - break; - case 6: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setMaxPrepayAmt(value); - break; - case 7: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setMaxMinerFee(value); - break; - case 8: - var value = /** @type {string} */ (reader.readUint64String()); - msg.setLoopOutChannel(value); - break; - case 11: - var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedUint64String() : [reader.readUint64String()]); - for (var i = 0; i < values.length; i++) { - msg.addOutgoingChanSet(values[i]); - } - break; - case 9: - var value = /** @type {number} */ (reader.readInt32()); - msg.setSweepConfTarget(value); - break; - case 13: - var value = /** @type {number} */ (reader.readInt32()); - msg.setHtlcConfirmations(value); - break; - case 10: - var value = /** @type {string} */ (reader.readUint64String()); - msg.setSwapPublicationDeadline(value); - break; - case 12: - var value = /** @type {string} */ (reader.readString()); - msg.setLabel(value); - break; - case 14: - var value = /** @type {string} */ (reader.readString()); - msg.setInitiator(value); - break; - case 15: - var value = /** @type {string} */ (reader.readString()); - msg.setAccount(value); - break; - case 16: - var value = /** @type {!proto.looprpc.AddressType} */ (reader.readEnum()); - msg.setAccountAddrType(value); - break; - case 17: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setIsExternalAddr(value); - break; - case 18: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.addReservationIds(value); +proto.looprpc.Utxo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.looprpc.Utxo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.looprpc.Utxo.displayName = 'proto.looprpc.Utxo'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.looprpc.WithdrawDepositsRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.looprpc.WithdrawDepositsRequest.repeatedFields_, null); +}; +goog.inherits(proto.looprpc.WithdrawDepositsRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.looprpc.WithdrawDepositsRequest.displayName = 'proto.looprpc.WithdrawDepositsRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.looprpc.WithdrawDepositsResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.looprpc.WithdrawDepositsResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.looprpc.WithdrawDepositsResponse.displayName = 'proto.looprpc.WithdrawDepositsResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.looprpc.OutPoint = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.looprpc.OutPoint, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.looprpc.OutPoint.displayName = 'proto.looprpc.OutPoint'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.looprpc.ListStaticAddressDepositsRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.looprpc.ListStaticAddressDepositsRequest.repeatedFields_, null); +}; +goog.inherits(proto.looprpc.ListStaticAddressDepositsRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.looprpc.ListStaticAddressDepositsRequest.displayName = 'proto.looprpc.ListStaticAddressDepositsRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.looprpc.ListStaticAddressDepositsResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.looprpc.ListStaticAddressDepositsResponse.repeatedFields_, null); +}; +goog.inherits(proto.looprpc.ListStaticAddressDepositsResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.looprpc.ListStaticAddressDepositsResponse.displayName = 'proto.looprpc.ListStaticAddressDepositsResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.looprpc.ListStaticAddressSwapsRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.looprpc.ListStaticAddressSwapsRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.looprpc.ListStaticAddressSwapsRequest.displayName = 'proto.looprpc.ListStaticAddressSwapsRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.looprpc.ListStaticAddressSwapsResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.looprpc.ListStaticAddressSwapsResponse.repeatedFields_, null); +}; +goog.inherits(proto.looprpc.ListStaticAddressSwapsResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.looprpc.ListStaticAddressSwapsResponse.displayName = 'proto.looprpc.ListStaticAddressSwapsResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.looprpc.StaticAddressSummaryRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.looprpc.StaticAddressSummaryRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.looprpc.StaticAddressSummaryRequest.displayName = 'proto.looprpc.StaticAddressSummaryRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.looprpc.StaticAddressSummaryResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.looprpc.StaticAddressSummaryResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.looprpc.StaticAddressSummaryResponse.displayName = 'proto.looprpc.StaticAddressSummaryResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.looprpc.Deposit = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.looprpc.Deposit, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.looprpc.Deposit.displayName = 'proto.looprpc.Deposit'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.looprpc.StaticAddressLoopInSwap = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.looprpc.StaticAddressLoopInSwap.repeatedFields_, null); +}; +goog.inherits(proto.looprpc.StaticAddressLoopInSwap, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.looprpc.StaticAddressLoopInSwap.displayName = 'proto.looprpc.StaticAddressLoopInSwap'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.looprpc.StaticAddressLoopInRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.looprpc.StaticAddressLoopInRequest.repeatedFields_, null); +}; +goog.inherits(proto.looprpc.StaticAddressLoopInRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.looprpc.StaticAddressLoopInRequest.displayName = 'proto.looprpc.StaticAddressLoopInRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.looprpc.StaticAddressLoopInResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.looprpc.StaticAddressLoopInResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.looprpc.StaticAddressLoopInResponse.displayName = 'proto.looprpc.StaticAddressLoopInResponse'; +} + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.looprpc.LoopOutRequest.repeatedFields_ = [11,18]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.looprpc.LoopOutRequest.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.LoopOutRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.looprpc.LoopOutRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.LoopOutRequest.toObject = function(includeInstance, msg) { + var f, obj = { + amt: jspb.Message.getFieldWithDefault(msg, 1, "0"), + dest: jspb.Message.getFieldWithDefault(msg, 2, ""), + maxSwapRoutingFee: jspb.Message.getFieldWithDefault(msg, 3, "0"), + maxPrepayRoutingFee: jspb.Message.getFieldWithDefault(msg, 4, "0"), + maxSwapFee: jspb.Message.getFieldWithDefault(msg, 5, "0"), + maxPrepayAmt: jspb.Message.getFieldWithDefault(msg, 6, "0"), + maxMinerFee: jspb.Message.getFieldWithDefault(msg, 7, "0"), + loopOutChannel: jspb.Message.getFieldWithDefault(msg, 8, "0"), + outgoingChanSetList: (f = jspb.Message.getRepeatedField(msg, 11)) == null ? undefined : f, + sweepConfTarget: jspb.Message.getFieldWithDefault(msg, 9, 0), + htlcConfirmations: jspb.Message.getFieldWithDefault(msg, 13, 0), + swapPublicationDeadline: jspb.Message.getFieldWithDefault(msg, 10, "0"), + label: jspb.Message.getFieldWithDefault(msg, 12, ""), + initiator: jspb.Message.getFieldWithDefault(msg, 14, ""), + account: jspb.Message.getFieldWithDefault(msg, 15, ""), + accountAddrType: jspb.Message.getFieldWithDefault(msg, 16, 0), + isExternalAddr: jspb.Message.getBooleanFieldWithDefault(msg, 17, false), + reservationIdsList: msg.getReservationIdsList_asB64(), + paymentTimeout: jspb.Message.getFieldWithDefault(msg, 19, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.looprpc.LoopOutRequest} + */ +proto.looprpc.LoopOutRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.looprpc.LoopOutRequest; + return proto.looprpc.LoopOutRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.looprpc.LoopOutRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.LoopOutRequest} + */ +proto.looprpc.LoopOutRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setAmt(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setDest(value); + break; + case 3: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setMaxSwapRoutingFee(value); + break; + case 4: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setMaxPrepayRoutingFee(value); + break; + case 5: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setMaxSwapFee(value); + break; + case 6: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setMaxPrepayAmt(value); + break; + case 7: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setMaxMinerFee(value); + break; + case 8: + var value = /** @type {string} */ (reader.readUint64String()); + msg.setLoopOutChannel(value); + break; + case 11: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedUint64String() : [reader.readUint64String()]); + for (var i = 0; i < values.length; i++) { + msg.addOutgoingChanSet(values[i]); + } + break; + case 9: + var value = /** @type {number} */ (reader.readInt32()); + msg.setSweepConfTarget(value); + break; + case 13: + var value = /** @type {number} */ (reader.readInt32()); + msg.setHtlcConfirmations(value); + break; + case 10: + var value = /** @type {string} */ (reader.readUint64String()); + msg.setSwapPublicationDeadline(value); + break; + case 12: + var value = /** @type {string} */ (reader.readString()); + msg.setLabel(value); + break; + case 14: + var value = /** @type {string} */ (reader.readString()); + msg.setInitiator(value); + break; + case 15: + var value = /** @type {string} */ (reader.readString()); + msg.setAccount(value); + break; + case 16: + var value = /** @type {!proto.looprpc.AddressType} */ (reader.readEnum()); + msg.setAccountAddrType(value); + break; + case 17: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setIsExternalAddr(value); + break; + case 18: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addReservationIds(value); + break; + case 19: + var value = /** @type {number} */ (reader.readUint32()); + msg.setPaymentTimeout(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.looprpc.LoopOutRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.LoopOutRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.LoopOutRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.LoopOutRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAmt(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 1, + f + ); + } + f = message.getDest(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getMaxSwapRoutingFee(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 3, + f + ); + } + f = message.getMaxPrepayRoutingFee(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 4, + f + ); + } + f = message.getMaxSwapFee(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 5, + f + ); + } + f = message.getMaxPrepayAmt(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 6, + f + ); + } + f = message.getMaxMinerFee(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 7, + f + ); + } + f = message.getLoopOutChannel(); + if (parseInt(f, 10) !== 0) { + writer.writeUint64String( + 8, + f + ); + } + f = message.getOutgoingChanSetList(); + if (f.length > 0) { + writer.writePackedUint64String( + 11, + f + ); + } + f = message.getSweepConfTarget(); + if (f !== 0) { + writer.writeInt32( + 9, + f + ); + } + f = message.getHtlcConfirmations(); + if (f !== 0) { + writer.writeInt32( + 13, + f + ); + } + f = message.getSwapPublicationDeadline(); + if (parseInt(f, 10) !== 0) { + writer.writeUint64String( + 10, + f + ); + } + f = message.getLabel(); + if (f.length > 0) { + writer.writeString( + 12, + f + ); + } + f = message.getInitiator(); + if (f.length > 0) { + writer.writeString( + 14, + f + ); + } + f = message.getAccount(); + if (f.length > 0) { + writer.writeString( + 15, + f + ); + } + f = message.getAccountAddrType(); + if (f !== 0.0) { + writer.writeEnum( + 16, + f + ); + } + f = message.getIsExternalAddr(); + if (f) { + writer.writeBool( + 17, + f + ); + } + f = message.getReservationIdsList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 18, + f + ); + } + f = message.getPaymentTimeout(); + if (f !== 0) { + writer.writeUint32( + 19, + f + ); + } +}; + + +/** + * optional int64 amt = 1; + * @return {string} + */ +proto.looprpc.LoopOutRequest.prototype.getAmt = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.LoopOutRequest} returns this + */ +proto.looprpc.LoopOutRequest.prototype.setAmt = function(value) { + return jspb.Message.setProto3StringIntField(this, 1, value); +}; + + +/** + * optional string dest = 2; + * @return {string} + */ +proto.looprpc.LoopOutRequest.prototype.getDest = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.LoopOutRequest} returns this + */ +proto.looprpc.LoopOutRequest.prototype.setDest = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional int64 max_swap_routing_fee = 3; + * @return {string} + */ +proto.looprpc.LoopOutRequest.prototype.getMaxSwapRoutingFee = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.LoopOutRequest} returns this + */ +proto.looprpc.LoopOutRequest.prototype.setMaxSwapRoutingFee = function(value) { + return jspb.Message.setProto3StringIntField(this, 3, value); +}; + + +/** + * optional int64 max_prepay_routing_fee = 4; + * @return {string} + */ +proto.looprpc.LoopOutRequest.prototype.getMaxPrepayRoutingFee = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.LoopOutRequest} returns this + */ +proto.looprpc.LoopOutRequest.prototype.setMaxPrepayRoutingFee = function(value) { + return jspb.Message.setProto3StringIntField(this, 4, value); +}; + + +/** + * optional int64 max_swap_fee = 5; + * @return {string} + */ +proto.looprpc.LoopOutRequest.prototype.getMaxSwapFee = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.LoopOutRequest} returns this + */ +proto.looprpc.LoopOutRequest.prototype.setMaxSwapFee = function(value) { + return jspb.Message.setProto3StringIntField(this, 5, value); +}; + + +/** + * optional int64 max_prepay_amt = 6; + * @return {string} + */ +proto.looprpc.LoopOutRequest.prototype.getMaxPrepayAmt = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.LoopOutRequest} returns this + */ +proto.looprpc.LoopOutRequest.prototype.setMaxPrepayAmt = function(value) { + return jspb.Message.setProto3StringIntField(this, 6, value); +}; + + +/** + * optional int64 max_miner_fee = 7; + * @return {string} + */ +proto.looprpc.LoopOutRequest.prototype.getMaxMinerFee = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.LoopOutRequest} returns this + */ +proto.looprpc.LoopOutRequest.prototype.setMaxMinerFee = function(value) { + return jspb.Message.setProto3StringIntField(this, 7, value); +}; + + +/** + * optional uint64 loop_out_channel = 8; + * @return {string} + */ +proto.looprpc.LoopOutRequest.prototype.getLoopOutChannel = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 8, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.LoopOutRequest} returns this + */ +proto.looprpc.LoopOutRequest.prototype.setLoopOutChannel = function(value) { + return jspb.Message.setProto3StringIntField(this, 8, value); +}; + + +/** + * repeated uint64 outgoing_chan_set = 11; + * @return {!Array} + */ +proto.looprpc.LoopOutRequest.prototype.getOutgoingChanSetList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 11)); +}; + + +/** + * @param {!Array} value + * @return {!proto.looprpc.LoopOutRequest} returns this + */ +proto.looprpc.LoopOutRequest.prototype.setOutgoingChanSetList = function(value) { + return jspb.Message.setField(this, 11, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.looprpc.LoopOutRequest} returns this + */ +proto.looprpc.LoopOutRequest.prototype.addOutgoingChanSet = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 11, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.looprpc.LoopOutRequest} returns this + */ +proto.looprpc.LoopOutRequest.prototype.clearOutgoingChanSetList = function() { + return this.setOutgoingChanSetList([]); +}; + + +/** + * optional int32 sweep_conf_target = 9; + * @return {number} + */ +proto.looprpc.LoopOutRequest.prototype.getSweepConfTarget = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 9, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.looprpc.LoopOutRequest} returns this + */ +proto.looprpc.LoopOutRequest.prototype.setSweepConfTarget = function(value) { + return jspb.Message.setProto3IntField(this, 9, value); +}; + + +/** + * optional int32 htlc_confirmations = 13; + * @return {number} + */ +proto.looprpc.LoopOutRequest.prototype.getHtlcConfirmations = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 13, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.looprpc.LoopOutRequest} returns this + */ +proto.looprpc.LoopOutRequest.prototype.setHtlcConfirmations = function(value) { + return jspb.Message.setProto3IntField(this, 13, value); +}; + + +/** + * optional uint64 swap_publication_deadline = 10; + * @return {string} + */ +proto.looprpc.LoopOutRequest.prototype.getSwapPublicationDeadline = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 10, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.LoopOutRequest} returns this + */ +proto.looprpc.LoopOutRequest.prototype.setSwapPublicationDeadline = function(value) { + return jspb.Message.setProto3StringIntField(this, 10, value); +}; + + +/** + * optional string label = 12; + * @return {string} + */ +proto.looprpc.LoopOutRequest.prototype.getLabel = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 12, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.LoopOutRequest} returns this + */ +proto.looprpc.LoopOutRequest.prototype.setLabel = function(value) { + return jspb.Message.setProto3StringField(this, 12, value); +}; + + +/** + * optional string initiator = 14; + * @return {string} + */ +proto.looprpc.LoopOutRequest.prototype.getInitiator = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 14, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.LoopOutRequest} returns this + */ +proto.looprpc.LoopOutRequest.prototype.setInitiator = function(value) { + return jspb.Message.setProto3StringField(this, 14, value); +}; + + +/** + * optional string account = 15; + * @return {string} + */ +proto.looprpc.LoopOutRequest.prototype.getAccount = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 15, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.LoopOutRequest} returns this + */ +proto.looprpc.LoopOutRequest.prototype.setAccount = function(value) { + return jspb.Message.setProto3StringField(this, 15, value); +}; + + +/** + * optional AddressType account_addr_type = 16; + * @return {!proto.looprpc.AddressType} + */ +proto.looprpc.LoopOutRequest.prototype.getAccountAddrType = function() { + return /** @type {!proto.looprpc.AddressType} */ (jspb.Message.getFieldWithDefault(this, 16, 0)); +}; + + +/** + * @param {!proto.looprpc.AddressType} value + * @return {!proto.looprpc.LoopOutRequest} returns this + */ +proto.looprpc.LoopOutRequest.prototype.setAccountAddrType = function(value) { + return jspb.Message.setProto3EnumField(this, 16, value); +}; + + +/** + * optional bool is_external_addr = 17; + * @return {boolean} + */ +proto.looprpc.LoopOutRequest.prototype.getIsExternalAddr = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 17, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.looprpc.LoopOutRequest} returns this + */ +proto.looprpc.LoopOutRequest.prototype.setIsExternalAddr = function(value) { + return jspb.Message.setProto3BooleanField(this, 17, value); +}; + + +/** + * repeated bytes reservation_ids = 18; + * @return {!(Array|Array)} + */ +proto.looprpc.LoopOutRequest.prototype.getReservationIdsList = function() { + return /** @type {!(Array|Array)} */ (jspb.Message.getRepeatedField(this, 18)); +}; + + +/** + * repeated bytes reservation_ids = 18; + * This is a type-conversion wrapper around `getReservationIdsList()` + * @return {!Array} + */ +proto.looprpc.LoopOutRequest.prototype.getReservationIdsList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getReservationIdsList())); +}; + + +/** + * repeated bytes reservation_ids = 18; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getReservationIdsList()` + * @return {!Array} + */ +proto.looprpc.LoopOutRequest.prototype.getReservationIdsList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getReservationIdsList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.looprpc.LoopOutRequest} returns this + */ +proto.looprpc.LoopOutRequest.prototype.setReservationIdsList = function(value) { + return jspb.Message.setField(this, 18, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.looprpc.LoopOutRequest} returns this + */ +proto.looprpc.LoopOutRequest.prototype.addReservationIds = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 18, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.looprpc.LoopOutRequest} returns this + */ +proto.looprpc.LoopOutRequest.prototype.clearReservationIdsList = function() { + return this.setReservationIdsList([]); +}; + + +/** + * optional uint32 payment_timeout = 19; + * @return {number} + */ +proto.looprpc.LoopOutRequest.prototype.getPaymentTimeout = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 19, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.looprpc.LoopOutRequest} returns this + */ +proto.looprpc.LoopOutRequest.prototype.setPaymentTimeout = function(value) { + return jspb.Message.setProto3IntField(this, 19, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.looprpc.LoopInRequest.repeatedFields_ = [9]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.looprpc.LoopInRequest.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.LoopInRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.looprpc.LoopInRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.LoopInRequest.toObject = function(includeInstance, msg) { + var f, obj = { + amt: jspb.Message.getFieldWithDefault(msg, 1, "0"), + maxSwapFee: jspb.Message.getFieldWithDefault(msg, 2, "0"), + maxMinerFee: jspb.Message.getFieldWithDefault(msg, 3, "0"), + lastHop: msg.getLastHop_asB64(), + externalHtlc: jspb.Message.getBooleanFieldWithDefault(msg, 5, false), + htlcConfTarget: jspb.Message.getFieldWithDefault(msg, 6, 0), + label: jspb.Message.getFieldWithDefault(msg, 7, ""), + initiator: jspb.Message.getFieldWithDefault(msg, 8, ""), + routeHintsList: jspb.Message.toObjectList(msg.getRouteHintsList(), + swapserverrpc_common_pb.RouteHint.toObject, includeInstance), + pb_private: jspb.Message.getBooleanFieldWithDefault(msg, 10, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.looprpc.LoopInRequest} + */ +proto.looprpc.LoopInRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.looprpc.LoopInRequest; + return proto.looprpc.LoopInRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.looprpc.LoopInRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.LoopInRequest} + */ +proto.looprpc.LoopInRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setAmt(value); + break; + case 2: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setMaxSwapFee(value); + break; + case 3: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setMaxMinerFee(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setLastHop(value); + break; + case 5: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setExternalHtlc(value); + break; + case 6: + var value = /** @type {number} */ (reader.readInt32()); + msg.setHtlcConfTarget(value); + break; + case 7: + var value = /** @type {string} */ (reader.readString()); + msg.setLabel(value); + break; + case 8: + var value = /** @type {string} */ (reader.readString()); + msg.setInitiator(value); + break; + case 9: + var value = new swapserverrpc_common_pb.RouteHint; + reader.readMessage(value,swapserverrpc_common_pb.RouteHint.deserializeBinaryFromReader); + msg.addRouteHints(value); + break; + case 10: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setPrivate(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.looprpc.LoopInRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.LoopInRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.LoopInRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.LoopInRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAmt(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 1, + f + ); + } + f = message.getMaxSwapFee(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 2, + f + ); + } + f = message.getMaxMinerFee(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 3, + f + ); + } + f = message.getLastHop_asU8(); + if (f.length > 0) { + writer.writeBytes( + 4, + f + ); + } + f = message.getExternalHtlc(); + if (f) { + writer.writeBool( + 5, + f + ); + } + f = message.getHtlcConfTarget(); + if (f !== 0) { + writer.writeInt32( + 6, + f + ); + } + f = message.getLabel(); + if (f.length > 0) { + writer.writeString( + 7, + f + ); + } + f = message.getInitiator(); + if (f.length > 0) { + writer.writeString( + 8, + f + ); + } + f = message.getRouteHintsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 9, + f, + swapserverrpc_common_pb.RouteHint.serializeBinaryToWriter + ); + } + f = message.getPrivate(); + if (f) { + writer.writeBool( + 10, + f + ); + } +}; + + +/** + * optional int64 amt = 1; + * @return {string} + */ +proto.looprpc.LoopInRequest.prototype.getAmt = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.LoopInRequest} returns this + */ +proto.looprpc.LoopInRequest.prototype.setAmt = function(value) { + return jspb.Message.setProto3StringIntField(this, 1, value); +}; + + +/** + * optional int64 max_swap_fee = 2; + * @return {string} + */ +proto.looprpc.LoopInRequest.prototype.getMaxSwapFee = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.LoopInRequest} returns this + */ +proto.looprpc.LoopInRequest.prototype.setMaxSwapFee = function(value) { + return jspb.Message.setProto3StringIntField(this, 2, value); +}; + + +/** + * optional int64 max_miner_fee = 3; + * @return {string} + */ +proto.looprpc.LoopInRequest.prototype.getMaxMinerFee = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.LoopInRequest} returns this + */ +proto.looprpc.LoopInRequest.prototype.setMaxMinerFee = function(value) { + return jspb.Message.setProto3StringIntField(this, 3, value); +}; + + +/** + * optional bytes last_hop = 4; + * @return {!(string|Uint8Array)} + */ +proto.looprpc.LoopInRequest.prototype.getLastHop = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * optional bytes last_hop = 4; + * This is a type-conversion wrapper around `getLastHop()` + * @return {string} + */ +proto.looprpc.LoopInRequest.prototype.getLastHop_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getLastHop())); +}; + + +/** + * optional bytes last_hop = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getLastHop()` + * @return {!Uint8Array} + */ +proto.looprpc.LoopInRequest.prototype.getLastHop_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getLastHop())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.looprpc.LoopInRequest} returns this + */ +proto.looprpc.LoopInRequest.prototype.setLastHop = function(value) { + return jspb.Message.setProto3BytesField(this, 4, value); +}; + + +/** + * optional bool external_htlc = 5; + * @return {boolean} + */ +proto.looprpc.LoopInRequest.prototype.getExternalHtlc = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.looprpc.LoopInRequest} returns this + */ +proto.looprpc.LoopInRequest.prototype.setExternalHtlc = function(value) { + return jspb.Message.setProto3BooleanField(this, 5, value); +}; + + +/** + * optional int32 htlc_conf_target = 6; + * @return {number} + */ +proto.looprpc.LoopInRequest.prototype.getHtlcConfTarget = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.looprpc.LoopInRequest} returns this + */ +proto.looprpc.LoopInRequest.prototype.setHtlcConfTarget = function(value) { + return jspb.Message.setProto3IntField(this, 6, value); +}; + + +/** + * optional string label = 7; + * @return {string} + */ +proto.looprpc.LoopInRequest.prototype.getLabel = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.LoopInRequest} returns this + */ +proto.looprpc.LoopInRequest.prototype.setLabel = function(value) { + return jspb.Message.setProto3StringField(this, 7, value); +}; + + +/** + * optional string initiator = 8; + * @return {string} + */ +proto.looprpc.LoopInRequest.prototype.getInitiator = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 8, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.LoopInRequest} returns this + */ +proto.looprpc.LoopInRequest.prototype.setInitiator = function(value) { + return jspb.Message.setProto3StringField(this, 8, value); +}; + + +/** + * repeated RouteHint route_hints = 9; + * @return {!Array} + */ +proto.looprpc.LoopInRequest.prototype.getRouteHintsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, swapserverrpc_common_pb.RouteHint, 9)); +}; + + +/** + * @param {!Array} value + * @return {!proto.looprpc.LoopInRequest} returns this +*/ +proto.looprpc.LoopInRequest.prototype.setRouteHintsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 9, value); +}; + + +/** + * @param {!proto.looprpc.RouteHint=} opt_value + * @param {number=} opt_index + * @return {!proto.looprpc.RouteHint} + */ +proto.looprpc.LoopInRequest.prototype.addRouteHints = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 9, opt_value, proto.looprpc.RouteHint, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.looprpc.LoopInRequest} returns this + */ +proto.looprpc.LoopInRequest.prototype.clearRouteHintsList = function() { + return this.setRouteHintsList([]); +}; + + +/** + * optional bool private = 10; + * @return {boolean} + */ +proto.looprpc.LoopInRequest.prototype.getPrivate = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 10, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.looprpc.LoopInRequest} returns this + */ +proto.looprpc.LoopInRequest.prototype.setPrivate = function(value) { + return jspb.Message.setProto3BooleanField(this, 10, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.looprpc.SwapResponse.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.SwapResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.looprpc.SwapResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.SwapResponse.toObject = function(includeInstance, msg) { + var f, obj = { + id: jspb.Message.getFieldWithDefault(msg, 1, ""), + idBytes: msg.getIdBytes_asB64(), + htlcAddress: jspb.Message.getFieldWithDefault(msg, 2, ""), + htlcAddressP2wsh: jspb.Message.getFieldWithDefault(msg, 5, ""), + htlcAddressP2tr: jspb.Message.getFieldWithDefault(msg, 7, ""), + serverMessage: jspb.Message.getFieldWithDefault(msg, 6, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.looprpc.SwapResponse} + */ +proto.looprpc.SwapResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.looprpc.SwapResponse; + return proto.looprpc.SwapResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.looprpc.SwapResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.SwapResponse} + */ +proto.looprpc.SwapResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setIdBytes(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setHtlcAddress(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.setHtlcAddressP2wsh(value); + break; + case 7: + var value = /** @type {string} */ (reader.readString()); + msg.setHtlcAddressP2tr(value); + break; + case 6: + var value = /** @type {string} */ (reader.readString()); + msg.setServerMessage(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.looprpc.SwapResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.SwapResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.SwapResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.SwapResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getIdBytes_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } + f = message.getHtlcAddress(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getHtlcAddressP2wsh(); + if (f.length > 0) { + writer.writeString( + 5, + f + ); + } + f = message.getHtlcAddressP2tr(); + if (f.length > 0) { + writer.writeString( + 7, + f + ); + } + f = message.getServerMessage(); + if (f.length > 0) { + writer.writeString( + 6, + f + ); + } +}; + + +/** + * optional string id = 1; + * @return {string} + */ +proto.looprpc.SwapResponse.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.SwapResponse} returns this + */ +proto.looprpc.SwapResponse.prototype.setId = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional bytes id_bytes = 3; + * @return {!(string|Uint8Array)} + */ +proto.looprpc.SwapResponse.prototype.getIdBytes = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes id_bytes = 3; + * This is a type-conversion wrapper around `getIdBytes()` + * @return {string} + */ +proto.looprpc.SwapResponse.prototype.getIdBytes_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getIdBytes())); +}; + + +/** + * optional bytes id_bytes = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdBytes()` + * @return {!Uint8Array} + */ +proto.looprpc.SwapResponse.prototype.getIdBytes_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getIdBytes())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.looprpc.SwapResponse} returns this + */ +proto.looprpc.SwapResponse.prototype.setIdBytes = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + + +/** + * optional string htlc_address = 2; + * @return {string} + */ +proto.looprpc.SwapResponse.prototype.getHtlcAddress = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.SwapResponse} returns this + */ +proto.looprpc.SwapResponse.prototype.setHtlcAddress = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string htlc_address_p2wsh = 5; + * @return {string} + */ +proto.looprpc.SwapResponse.prototype.getHtlcAddressP2wsh = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.SwapResponse} returns this + */ +proto.looprpc.SwapResponse.prototype.setHtlcAddressP2wsh = function(value) { + return jspb.Message.setProto3StringField(this, 5, value); +}; + + +/** + * optional string htlc_address_p2tr = 7; + * @return {string} + */ +proto.looprpc.SwapResponse.prototype.getHtlcAddressP2tr = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.SwapResponse} returns this + */ +proto.looprpc.SwapResponse.prototype.setHtlcAddressP2tr = function(value) { + return jspb.Message.setProto3StringField(this, 7, value); +}; + + +/** + * optional string server_message = 6; + * @return {string} + */ +proto.looprpc.SwapResponse.prototype.getServerMessage = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.SwapResponse} returns this + */ +proto.looprpc.SwapResponse.prototype.setServerMessage = function(value) { + return jspb.Message.setProto3StringField(this, 6, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.looprpc.MonitorRequest.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.MonitorRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.looprpc.MonitorRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.MonitorRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.looprpc.MonitorRequest} + */ +proto.looprpc.MonitorRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.looprpc.MonitorRequest; + return proto.looprpc.MonitorRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.looprpc.MonitorRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.MonitorRequest} + */ +proto.looprpc.MonitorRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.looprpc.MonitorRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.MonitorRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.MonitorRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.MonitorRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.looprpc.SwapStatus.repeatedFields_ = [17]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.looprpc.SwapStatus.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.SwapStatus.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.looprpc.SwapStatus} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.SwapStatus.toObject = function(includeInstance, msg) { + var f, obj = { + amt: jspb.Message.getFieldWithDefault(msg, 1, "0"), + id: jspb.Message.getFieldWithDefault(msg, 2, ""), + idBytes: msg.getIdBytes_asB64(), + type: jspb.Message.getFieldWithDefault(msg, 3, 0), + state: jspb.Message.getFieldWithDefault(msg, 4, 0), + failureReason: jspb.Message.getFieldWithDefault(msg, 14, 0), + initiationTime: jspb.Message.getFieldWithDefault(msg, 5, "0"), + lastUpdateTime: jspb.Message.getFieldWithDefault(msg, 6, "0"), + htlcAddress: jspb.Message.getFieldWithDefault(msg, 7, ""), + htlcAddressP2wsh: jspb.Message.getFieldWithDefault(msg, 12, ""), + htlcAddressP2tr: jspb.Message.getFieldWithDefault(msg, 18, ""), + costServer: jspb.Message.getFieldWithDefault(msg, 8, "0"), + costOnchain: jspb.Message.getFieldWithDefault(msg, 9, "0"), + costOffchain: jspb.Message.getFieldWithDefault(msg, 10, "0"), + lastHop: msg.getLastHop_asB64(), + outgoingChanSetList: (f = jspb.Message.getRepeatedField(msg, 17)) == null ? undefined : f, + label: jspb.Message.getFieldWithDefault(msg, 15, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.looprpc.SwapStatus} + */ +proto.looprpc.SwapStatus.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.looprpc.SwapStatus; + return proto.looprpc.SwapStatus.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.looprpc.SwapStatus} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.SwapStatus} + */ +proto.looprpc.SwapStatus.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setAmt(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + case 11: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setIdBytes(value); + break; + case 3: + var value = /** @type {!proto.looprpc.SwapType} */ (reader.readEnum()); + msg.setType(value); + break; + case 4: + var value = /** @type {!proto.looprpc.SwapState} */ (reader.readEnum()); + msg.setState(value); + break; + case 14: + var value = /** @type {!proto.looprpc.FailureReason} */ (reader.readEnum()); + msg.setFailureReason(value); + break; + case 5: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setInitiationTime(value); + break; + case 6: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setLastUpdateTime(value); + break; + case 7: + var value = /** @type {string} */ (reader.readString()); + msg.setHtlcAddress(value); + break; + case 12: + var value = /** @type {string} */ (reader.readString()); + msg.setHtlcAddressP2wsh(value); + break; + case 18: + var value = /** @type {string} */ (reader.readString()); + msg.setHtlcAddressP2tr(value); + break; + case 8: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setCostServer(value); + break; + case 9: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setCostOnchain(value); + break; + case 10: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setCostOffchain(value); + break; + case 16: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setLastHop(value); + break; + case 17: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedUint64String() : [reader.readUint64String()]); + for (var i = 0; i < values.length; i++) { + msg.addOutgoingChanSet(values[i]); + } + break; + case 15: + var value = /** @type {string} */ (reader.readString()); + msg.setLabel(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.looprpc.SwapStatus.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.SwapStatus.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.SwapStatus} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.SwapStatus.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAmt(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 1, + f + ); + } + f = message.getId(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getIdBytes_asU8(); + if (f.length > 0) { + writer.writeBytes( + 11, + f + ); + } + f = message.getType(); + if (f !== 0.0) { + writer.writeEnum( + 3, + f + ); + } + f = message.getState(); + if (f !== 0.0) { + writer.writeEnum( + 4, + f + ); + } + f = message.getFailureReason(); + if (f !== 0.0) { + writer.writeEnum( + 14, + f + ); + } + f = message.getInitiationTime(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 5, + f + ); + } + f = message.getLastUpdateTime(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 6, + f + ); + } + f = message.getHtlcAddress(); + if (f.length > 0) { + writer.writeString( + 7, + f + ); + } + f = message.getHtlcAddressP2wsh(); + if (f.length > 0) { + writer.writeString( + 12, + f + ); + } + f = message.getHtlcAddressP2tr(); + if (f.length > 0) { + writer.writeString( + 18, + f + ); + } + f = message.getCostServer(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 8, + f + ); + } + f = message.getCostOnchain(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 9, + f + ); + } + f = message.getCostOffchain(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 10, + f + ); + } + f = message.getLastHop_asU8(); + if (f.length > 0) { + writer.writeBytes( + 16, + f + ); + } + f = message.getOutgoingChanSetList(); + if (f.length > 0) { + writer.writePackedUint64String( + 17, + f + ); + } + f = message.getLabel(); + if (f.length > 0) { + writer.writeString( + 15, + f + ); + } +}; + + +/** + * optional int64 amt = 1; + * @return {string} + */ +proto.looprpc.SwapStatus.prototype.getAmt = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.SwapStatus} returns this + */ +proto.looprpc.SwapStatus.prototype.setAmt = function(value) { + return jspb.Message.setProto3StringIntField(this, 1, value); +}; + + +/** + * optional string id = 2; + * @return {string} + */ +proto.looprpc.SwapStatus.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.SwapStatus} returns this + */ +proto.looprpc.SwapStatus.prototype.setId = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional bytes id_bytes = 11; + * @return {!(string|Uint8Array)} + */ +proto.looprpc.SwapStatus.prototype.getIdBytes = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 11, "")); +}; + + +/** + * optional bytes id_bytes = 11; + * This is a type-conversion wrapper around `getIdBytes()` + * @return {string} + */ +proto.looprpc.SwapStatus.prototype.getIdBytes_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getIdBytes())); +}; + + +/** + * optional bytes id_bytes = 11; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getIdBytes()` + * @return {!Uint8Array} + */ +proto.looprpc.SwapStatus.prototype.getIdBytes_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getIdBytes())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.looprpc.SwapStatus} returns this + */ +proto.looprpc.SwapStatus.prototype.setIdBytes = function(value) { + return jspb.Message.setProto3BytesField(this, 11, value); +}; + + +/** + * optional SwapType type = 3; + * @return {!proto.looprpc.SwapType} + */ +proto.looprpc.SwapStatus.prototype.getType = function() { + return /** @type {!proto.looprpc.SwapType} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {!proto.looprpc.SwapType} value + * @return {!proto.looprpc.SwapStatus} returns this + */ +proto.looprpc.SwapStatus.prototype.setType = function(value) { + return jspb.Message.setProto3EnumField(this, 3, value); +}; + + +/** + * optional SwapState state = 4; + * @return {!proto.looprpc.SwapState} + */ +proto.looprpc.SwapStatus.prototype.getState = function() { + return /** @type {!proto.looprpc.SwapState} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** + * @param {!proto.looprpc.SwapState} value + * @return {!proto.looprpc.SwapStatus} returns this + */ +proto.looprpc.SwapStatus.prototype.setState = function(value) { + return jspb.Message.setProto3EnumField(this, 4, value); +}; + + +/** + * optional FailureReason failure_reason = 14; + * @return {!proto.looprpc.FailureReason} + */ +proto.looprpc.SwapStatus.prototype.getFailureReason = function() { + return /** @type {!proto.looprpc.FailureReason} */ (jspb.Message.getFieldWithDefault(this, 14, 0)); +}; + + +/** + * @param {!proto.looprpc.FailureReason} value + * @return {!proto.looprpc.SwapStatus} returns this + */ +proto.looprpc.SwapStatus.prototype.setFailureReason = function(value) { + return jspb.Message.setProto3EnumField(this, 14, value); +}; + + +/** + * optional int64 initiation_time = 5; + * @return {string} + */ +proto.looprpc.SwapStatus.prototype.getInitiationTime = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.SwapStatus} returns this + */ +proto.looprpc.SwapStatus.prototype.setInitiationTime = function(value) { + return jspb.Message.setProto3StringIntField(this, 5, value); +}; + + +/** + * optional int64 last_update_time = 6; + * @return {string} + */ +proto.looprpc.SwapStatus.prototype.getLastUpdateTime = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.SwapStatus} returns this + */ +proto.looprpc.SwapStatus.prototype.setLastUpdateTime = function(value) { + return jspb.Message.setProto3StringIntField(this, 6, value); +}; + + +/** + * optional string htlc_address = 7; + * @return {string} + */ +proto.looprpc.SwapStatus.prototype.getHtlcAddress = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.SwapStatus} returns this + */ +proto.looprpc.SwapStatus.prototype.setHtlcAddress = function(value) { + return jspb.Message.setProto3StringField(this, 7, value); +}; + + +/** + * optional string htlc_address_p2wsh = 12; + * @return {string} + */ +proto.looprpc.SwapStatus.prototype.getHtlcAddressP2wsh = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 12, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.SwapStatus} returns this + */ +proto.looprpc.SwapStatus.prototype.setHtlcAddressP2wsh = function(value) { + return jspb.Message.setProto3StringField(this, 12, value); +}; + + +/** + * optional string htlc_address_p2tr = 18; + * @return {string} + */ +proto.looprpc.SwapStatus.prototype.getHtlcAddressP2tr = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 18, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.SwapStatus} returns this + */ +proto.looprpc.SwapStatus.prototype.setHtlcAddressP2tr = function(value) { + return jspb.Message.setProto3StringField(this, 18, value); +}; + + +/** + * optional int64 cost_server = 8; + * @return {string} + */ +proto.looprpc.SwapStatus.prototype.getCostServer = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 8, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.SwapStatus} returns this + */ +proto.looprpc.SwapStatus.prototype.setCostServer = function(value) { + return jspb.Message.setProto3StringIntField(this, 8, value); +}; + + +/** + * optional int64 cost_onchain = 9; + * @return {string} + */ +proto.looprpc.SwapStatus.prototype.getCostOnchain = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 9, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.SwapStatus} returns this + */ +proto.looprpc.SwapStatus.prototype.setCostOnchain = function(value) { + return jspb.Message.setProto3StringIntField(this, 9, value); +}; + + +/** + * optional int64 cost_offchain = 10; + * @return {string} + */ +proto.looprpc.SwapStatus.prototype.getCostOffchain = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 10, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.SwapStatus} returns this + */ +proto.looprpc.SwapStatus.prototype.setCostOffchain = function(value) { + return jspb.Message.setProto3StringIntField(this, 10, value); +}; + + +/** + * optional bytes last_hop = 16; + * @return {!(string|Uint8Array)} + */ +proto.looprpc.SwapStatus.prototype.getLastHop = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 16, "")); +}; + + +/** + * optional bytes last_hop = 16; + * This is a type-conversion wrapper around `getLastHop()` + * @return {string} + */ +proto.looprpc.SwapStatus.prototype.getLastHop_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getLastHop())); +}; + + +/** + * optional bytes last_hop = 16; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getLastHop()` + * @return {!Uint8Array} + */ +proto.looprpc.SwapStatus.prototype.getLastHop_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getLastHop())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.looprpc.SwapStatus} returns this + */ +proto.looprpc.SwapStatus.prototype.setLastHop = function(value) { + return jspb.Message.setProto3BytesField(this, 16, value); +}; + + +/** + * repeated uint64 outgoing_chan_set = 17; + * @return {!Array} + */ +proto.looprpc.SwapStatus.prototype.getOutgoingChanSetList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 17)); +}; + + +/** + * @param {!Array} value + * @return {!proto.looprpc.SwapStatus} returns this + */ +proto.looprpc.SwapStatus.prototype.setOutgoingChanSetList = function(value) { + return jspb.Message.setField(this, 17, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.looprpc.SwapStatus} returns this + */ +proto.looprpc.SwapStatus.prototype.addOutgoingChanSet = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 17, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.looprpc.SwapStatus} returns this + */ +proto.looprpc.SwapStatus.prototype.clearOutgoingChanSetList = function() { + return this.setOutgoingChanSetList([]); +}; + + +/** + * optional string label = 15; + * @return {string} + */ +proto.looprpc.SwapStatus.prototype.getLabel = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 15, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.SwapStatus} returns this + */ +proto.looprpc.SwapStatus.prototype.setLabel = function(value) { + return jspb.Message.setProto3StringField(this, 15, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.looprpc.ListSwapsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.ListSwapsRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.looprpc.ListSwapsRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.ListSwapsRequest.toObject = function(includeInstance, msg) { + var f, obj = { + listSwapFilter: (f = msg.getListSwapFilter()) && proto.looprpc.ListSwapsFilter.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.looprpc.ListSwapsRequest} + */ +proto.looprpc.ListSwapsRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.looprpc.ListSwapsRequest; + return proto.looprpc.ListSwapsRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.looprpc.ListSwapsRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.ListSwapsRequest} + */ +proto.looprpc.ListSwapsRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.looprpc.ListSwapsFilter; + reader.readMessage(value,proto.looprpc.ListSwapsFilter.deserializeBinaryFromReader); + msg.setListSwapFilter(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.looprpc.ListSwapsRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.ListSwapsRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.ListSwapsRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.ListSwapsRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getListSwapFilter(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.looprpc.ListSwapsFilter.serializeBinaryToWriter + ); + } +}; + + +/** + * optional ListSwapsFilter list_swap_filter = 1; + * @return {?proto.looprpc.ListSwapsFilter} + */ +proto.looprpc.ListSwapsRequest.prototype.getListSwapFilter = function() { + return /** @type{?proto.looprpc.ListSwapsFilter} */ ( + jspb.Message.getWrapperField(this, proto.looprpc.ListSwapsFilter, 1)); +}; + + +/** + * @param {?proto.looprpc.ListSwapsFilter|undefined} value + * @return {!proto.looprpc.ListSwapsRequest} returns this +*/ +proto.looprpc.ListSwapsRequest.prototype.setListSwapFilter = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.looprpc.ListSwapsRequest} returns this + */ +proto.looprpc.ListSwapsRequest.prototype.clearListSwapFilter = function() { + return this.setListSwapFilter(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.looprpc.ListSwapsRequest.prototype.hasListSwapFilter = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.looprpc.ListSwapsFilter.repeatedFields_ = [3]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.looprpc.ListSwapsFilter.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.ListSwapsFilter.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.looprpc.ListSwapsFilter} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.ListSwapsFilter.toObject = function(includeInstance, msg) { + var f, obj = { + swapType: jspb.Message.getFieldWithDefault(msg, 1, 0), + pendingOnly: jspb.Message.getBooleanFieldWithDefault(msg, 2, false), + outgoingChanSetList: (f = jspb.Message.getRepeatedField(msg, 3)) == null ? undefined : f, + label: jspb.Message.getFieldWithDefault(msg, 4, ""), + loopInLastHop: msg.getLoopInLastHop_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.looprpc.ListSwapsFilter} + */ +proto.looprpc.ListSwapsFilter.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.looprpc.ListSwapsFilter; + return proto.looprpc.ListSwapsFilter.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.looprpc.ListSwapsFilter} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.ListSwapsFilter} + */ +proto.looprpc.ListSwapsFilter.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.looprpc.ListSwapsFilter.SwapTypeFilter} */ (reader.readEnum()); + msg.setSwapType(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setPendingOnly(value); + break; + case 3: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedUint64String() : [reader.readUint64String()]); + for (var i = 0; i < values.length; i++) { + msg.addOutgoingChanSet(values[i]); + } + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setLabel(value); + break; + case 5: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setLoopInLastHop(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.looprpc.ListSwapsFilter.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.ListSwapsFilter.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.ListSwapsFilter} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.ListSwapsFilter.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getSwapType(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getPendingOnly(); + if (f) { + writer.writeBool( + 2, + f + ); + } + f = message.getOutgoingChanSetList(); + if (f.length > 0) { + writer.writePackedUint64String( + 3, + f + ); + } + f = message.getLabel(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } + f = message.getLoopInLastHop_asU8(); + if (f.length > 0) { + writer.writeBytes( + 5, + f + ); + } +}; + + +/** + * @enum {number} + */ +proto.looprpc.ListSwapsFilter.SwapTypeFilter = { + ANY: 0, + LOOP_OUT: 1, + LOOP_IN: 2 +}; + +/** + * optional SwapTypeFilter swap_type = 1; + * @return {!proto.looprpc.ListSwapsFilter.SwapTypeFilter} + */ +proto.looprpc.ListSwapsFilter.prototype.getSwapType = function() { + return /** @type {!proto.looprpc.ListSwapsFilter.SwapTypeFilter} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.looprpc.ListSwapsFilter.SwapTypeFilter} value + * @return {!proto.looprpc.ListSwapsFilter} returns this + */ +proto.looprpc.ListSwapsFilter.prototype.setSwapType = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * optional bool pending_only = 2; + * @return {boolean} + */ +proto.looprpc.ListSwapsFilter.prototype.getPendingOnly = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.looprpc.ListSwapsFilter} returns this + */ +proto.looprpc.ListSwapsFilter.prototype.setPendingOnly = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + +/** + * repeated uint64 outgoing_chan_set = 3; + * @return {!Array} + */ +proto.looprpc.ListSwapsFilter.prototype.getOutgoingChanSetList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 3)); +}; + + +/** + * @param {!Array} value + * @return {!proto.looprpc.ListSwapsFilter} returns this + */ +proto.looprpc.ListSwapsFilter.prototype.setOutgoingChanSetList = function(value) { + return jspb.Message.setField(this, 3, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.looprpc.ListSwapsFilter} returns this + */ +proto.looprpc.ListSwapsFilter.prototype.addOutgoingChanSet = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 3, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.looprpc.ListSwapsFilter} returns this + */ +proto.looprpc.ListSwapsFilter.prototype.clearOutgoingChanSetList = function() { + return this.setOutgoingChanSetList([]); +}; + + +/** + * optional string label = 4; + * @return {string} + */ +proto.looprpc.ListSwapsFilter.prototype.getLabel = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.ListSwapsFilter} returns this + */ +proto.looprpc.ListSwapsFilter.prototype.setLabel = function(value) { + return jspb.Message.setProto3StringField(this, 4, value); +}; + + +/** + * optional bytes loop_in_last_hop = 5; + * @return {!(string|Uint8Array)} + */ +proto.looprpc.ListSwapsFilter.prototype.getLoopInLastHop = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * optional bytes loop_in_last_hop = 5; + * This is a type-conversion wrapper around `getLoopInLastHop()` + * @return {string} + */ +proto.looprpc.ListSwapsFilter.prototype.getLoopInLastHop_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getLoopInLastHop())); +}; + + +/** + * optional bytes loop_in_last_hop = 5; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getLoopInLastHop()` + * @return {!Uint8Array} + */ +proto.looprpc.ListSwapsFilter.prototype.getLoopInLastHop_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getLoopInLastHop())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.looprpc.ListSwapsFilter} returns this + */ +proto.looprpc.ListSwapsFilter.prototype.setLoopInLastHop = function(value) { + return jspb.Message.setProto3BytesField(this, 5, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.looprpc.ListSwapsResponse.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.looprpc.ListSwapsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.ListSwapsResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.looprpc.ListSwapsResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.ListSwapsResponse.toObject = function(includeInstance, msg) { + var f, obj = { + swapsList: jspb.Message.toObjectList(msg.getSwapsList(), + proto.looprpc.SwapStatus.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.looprpc.ListSwapsResponse} + */ +proto.looprpc.ListSwapsResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.looprpc.ListSwapsResponse; + return proto.looprpc.ListSwapsResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.looprpc.ListSwapsResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.ListSwapsResponse} + */ +proto.looprpc.ListSwapsResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.looprpc.SwapStatus; + reader.readMessage(value,proto.looprpc.SwapStatus.deserializeBinaryFromReader); + msg.addSwaps(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.looprpc.ListSwapsResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.ListSwapsResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.ListSwapsResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.ListSwapsResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getSwapsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.looprpc.SwapStatus.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated SwapStatus swaps = 1; + * @return {!Array} + */ +proto.looprpc.ListSwapsResponse.prototype.getSwapsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.looprpc.SwapStatus, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.looprpc.ListSwapsResponse} returns this +*/ +proto.looprpc.ListSwapsResponse.prototype.setSwapsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.looprpc.SwapStatus=} opt_value + * @param {number=} opt_index + * @return {!proto.looprpc.SwapStatus} + */ +proto.looprpc.ListSwapsResponse.prototype.addSwaps = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.looprpc.SwapStatus, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.looprpc.ListSwapsResponse} returns this + */ +proto.looprpc.ListSwapsResponse.prototype.clearSwapsList = function() { + return this.setSwapsList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.looprpc.SwapInfoRequest.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.SwapInfoRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.looprpc.SwapInfoRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.SwapInfoRequest.toObject = function(includeInstance, msg) { + var f, obj = { + id: msg.getId_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.looprpc.SwapInfoRequest} + */ +proto.looprpc.SwapInfoRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.looprpc.SwapInfoRequest; + return proto.looprpc.SwapInfoRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.looprpc.SwapInfoRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.SwapInfoRequest} + */ +proto.looprpc.SwapInfoRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.looprpc.SwapInfoRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.SwapInfoRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.SwapInfoRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.SwapInfoRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } +}; + + +/** + * optional bytes id = 1; + * @return {!(string|Uint8Array)} + */ +proto.looprpc.SwapInfoRequest.prototype.getId = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes id = 1; + * This is a type-conversion wrapper around `getId()` + * @return {string} + */ +proto.looprpc.SwapInfoRequest.prototype.getId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getId())); +}; + + +/** + * optional bytes id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getId()` + * @return {!Uint8Array} + */ +proto.looprpc.SwapInfoRequest.prototype.getId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getId())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.looprpc.SwapInfoRequest} returns this + */ +proto.looprpc.SwapInfoRequest.prototype.setId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.looprpc.TermsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.TermsRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.looprpc.TermsRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.TermsRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.looprpc.TermsRequest} + */ +proto.looprpc.TermsRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.looprpc.TermsRequest; + return proto.looprpc.TermsRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.looprpc.TermsRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.TermsRequest} + */ +proto.looprpc.TermsRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.looprpc.TermsRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.TermsRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.TermsRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.TermsRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.looprpc.InTermsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.InTermsResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.looprpc.InTermsResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.InTermsResponse.toObject = function(includeInstance, msg) { + var f, obj = { + minSwapAmount: jspb.Message.getFieldWithDefault(msg, 5, "0"), + maxSwapAmount: jspb.Message.getFieldWithDefault(msg, 6, "0") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.looprpc.InTermsResponse} + */ +proto.looprpc.InTermsResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.looprpc.InTermsResponse; + return proto.looprpc.InTermsResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.looprpc.InTermsResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.InTermsResponse} + */ +proto.looprpc.InTermsResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 5: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setMinSwapAmount(value); + break; + case 6: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setMaxSwapAmount(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.looprpc.InTermsResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.InTermsResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.InTermsResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.InTermsResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMinSwapAmount(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 5, + f + ); + } + f = message.getMaxSwapAmount(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 6, + f + ); + } +}; + + +/** + * optional int64 min_swap_amount = 5; + * @return {string} + */ +proto.looprpc.InTermsResponse.prototype.getMinSwapAmount = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.InTermsResponse} returns this + */ +proto.looprpc.InTermsResponse.prototype.setMinSwapAmount = function(value) { + return jspb.Message.setProto3StringIntField(this, 5, value); +}; + + +/** + * optional int64 max_swap_amount = 6; + * @return {string} + */ +proto.looprpc.InTermsResponse.prototype.getMaxSwapAmount = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.InTermsResponse} returns this + */ +proto.looprpc.InTermsResponse.prototype.setMaxSwapAmount = function(value) { + return jspb.Message.setProto3StringIntField(this, 6, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.looprpc.OutTermsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.OutTermsResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.looprpc.OutTermsResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.OutTermsResponse.toObject = function(includeInstance, msg) { + var f, obj = { + minSwapAmount: jspb.Message.getFieldWithDefault(msg, 5, "0"), + maxSwapAmount: jspb.Message.getFieldWithDefault(msg, 6, "0"), + minCltvDelta: jspb.Message.getFieldWithDefault(msg, 8, 0), + maxCltvDelta: jspb.Message.getFieldWithDefault(msg, 9, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.looprpc.OutTermsResponse} + */ +proto.looprpc.OutTermsResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.looprpc.OutTermsResponse; + return proto.looprpc.OutTermsResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.looprpc.OutTermsResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.OutTermsResponse} + */ +proto.looprpc.OutTermsResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 5: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setMinSwapAmount(value); + break; + case 6: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setMaxSwapAmount(value); + break; + case 8: + var value = /** @type {number} */ (reader.readInt32()); + msg.setMinCltvDelta(value); + break; + case 9: + var value = /** @type {number} */ (reader.readInt32()); + msg.setMaxCltvDelta(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.looprpc.OutTermsResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.OutTermsResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.OutTermsResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.OutTermsResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMinSwapAmount(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 5, + f + ); + } + f = message.getMaxSwapAmount(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 6, + f + ); + } + f = message.getMinCltvDelta(); + if (f !== 0) { + writer.writeInt32( + 8, + f + ); + } + f = message.getMaxCltvDelta(); + if (f !== 0) { + writer.writeInt32( + 9, + f + ); + } +}; + + +/** + * optional int64 min_swap_amount = 5; + * @return {string} + */ +proto.looprpc.OutTermsResponse.prototype.getMinSwapAmount = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.OutTermsResponse} returns this + */ +proto.looprpc.OutTermsResponse.prototype.setMinSwapAmount = function(value) { + return jspb.Message.setProto3StringIntField(this, 5, value); +}; + + +/** + * optional int64 max_swap_amount = 6; + * @return {string} + */ +proto.looprpc.OutTermsResponse.prototype.getMaxSwapAmount = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.OutTermsResponse} returns this + */ +proto.looprpc.OutTermsResponse.prototype.setMaxSwapAmount = function(value) { + return jspb.Message.setProto3StringIntField(this, 6, value); +}; + + +/** + * optional int32 min_cltv_delta = 8; + * @return {number} + */ +proto.looprpc.OutTermsResponse.prototype.getMinCltvDelta = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 8, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.looprpc.OutTermsResponse} returns this + */ +proto.looprpc.OutTermsResponse.prototype.setMinCltvDelta = function(value) { + return jspb.Message.setProto3IntField(this, 8, value); +}; + + +/** + * optional int32 max_cltv_delta = 9; + * @return {number} + */ +proto.looprpc.OutTermsResponse.prototype.getMaxCltvDelta = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 9, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.looprpc.OutTermsResponse} returns this + */ +proto.looprpc.OutTermsResponse.prototype.setMaxCltvDelta = function(value) { + return jspb.Message.setProto3IntField(this, 9, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.looprpc.QuoteRequest.repeatedFields_ = [6,8]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.looprpc.QuoteRequest.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.QuoteRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.looprpc.QuoteRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.QuoteRequest.toObject = function(includeInstance, msg) { + var f, obj = { + amt: jspb.Message.getFieldWithDefault(msg, 1, "0"), + confTarget: jspb.Message.getFieldWithDefault(msg, 2, 0), + externalHtlc: jspb.Message.getBooleanFieldWithDefault(msg, 3, false), + swapPublicationDeadline: jspb.Message.getFieldWithDefault(msg, 4, "0"), + loopInLastHop: msg.getLoopInLastHop_asB64(), + loopInRouteHintsList: jspb.Message.toObjectList(msg.getLoopInRouteHintsList(), + swapserverrpc_common_pb.RouteHint.toObject, includeInstance), + pb_private: jspb.Message.getBooleanFieldWithDefault(msg, 7, false), + depositOutpointsList: (f = jspb.Message.getRepeatedField(msg, 8)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.looprpc.QuoteRequest} + */ +proto.looprpc.QuoteRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.looprpc.QuoteRequest; + return proto.looprpc.QuoteRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.looprpc.QuoteRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.QuoteRequest} + */ +proto.looprpc.QuoteRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { break; - case 19: - var value = /** @type {number} */ (reader.readUint32()); - msg.setPaymentTimeout(value); + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setAmt(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt32()); + msg.setConfTarget(value); + break; + case 3: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setExternalHtlc(value); + break; + case 4: + var value = /** @type {string} */ (reader.readUint64String()); + msg.setSwapPublicationDeadline(value); + break; + case 5: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setLoopInLastHop(value); + break; + case 6: + var value = new swapserverrpc_common_pb.RouteHint; + reader.readMessage(value,swapserverrpc_common_pb.RouteHint.deserializeBinaryFromReader); + msg.addLoopInRouteHints(value); + break; + case 7: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setPrivate(value); + break; + case 8: + var value = /** @type {string} */ (reader.readString()); + msg.addDepositOutpoints(value); break; default: reader.skipField(); @@ -1164,9 +5094,9 @@ proto.looprpc.LoopOutRequest.deserializeBinaryFromReader = function(msg, reader) * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.LoopOutRequest.prototype.serializeBinary = function() { +proto.looprpc.QuoteRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.LoopOutRequest.serializeBinaryToWriter(this, writer); + proto.looprpc.QuoteRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -1174,11 +5104,11 @@ proto.looprpc.LoopOutRequest.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.LoopOutRequest} message + * @param {!proto.looprpc.QuoteRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.LoopOutRequest.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.QuoteRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getAmt(); if (parseInt(f, 10) !== 0) { @@ -1187,129 +5117,53 @@ proto.looprpc.LoopOutRequest.serializeBinaryToWriter = function(message, writer) f ); } - f = message.getDest(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getMaxSwapRoutingFee(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 3, - f - ); - } - f = message.getMaxPrepayRoutingFee(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 4, - f - ); - } - f = message.getMaxSwapFee(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 5, - f - ); - } - f = message.getMaxPrepayAmt(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 6, - f - ); - } - f = message.getMaxMinerFee(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 7, - f - ); - } - f = message.getLoopOutChannel(); - if (parseInt(f, 10) !== 0) { - writer.writeUint64String( - 8, - f - ); - } - f = message.getOutgoingChanSetList(); - if (f.length > 0) { - writer.writePackedUint64String( - 11, - f - ); - } - f = message.getSweepConfTarget(); + f = message.getConfTarget(); if (f !== 0) { writer.writeInt32( - 9, + 2, f ); } - f = message.getHtlcConfirmations(); - if (f !== 0) { - writer.writeInt32( - 13, + f = message.getExternalHtlc(); + if (f) { + writer.writeBool( + 3, f ); } f = message.getSwapPublicationDeadline(); if (parseInt(f, 10) !== 0) { writer.writeUint64String( - 10, - f - ); - } - f = message.getLabel(); - if (f.length > 0) { - writer.writeString( - 12, + 4, f ); } - f = message.getInitiator(); + f = message.getLoopInLastHop_asU8(); if (f.length > 0) { - writer.writeString( - 14, + writer.writeBytes( + 5, f ); } - f = message.getAccount(); + f = message.getLoopInRouteHintsList(); if (f.length > 0) { - writer.writeString( - 15, - f - ); - } - f = message.getAccountAddrType(); - if (f !== 0.0) { - writer.writeEnum( - 16, - f + writer.writeRepeatedMessage( + 6, + f, + swapserverrpc_common_pb.RouteHint.serializeBinaryToWriter ); } - f = message.getIsExternalAddr(); + f = message.getPrivate(); if (f) { writer.writeBool( - 17, + 7, f ); } - f = message.getReservationIdsList_asU8(); + f = message.getDepositOutpointsList(); if (f.length > 0) { - writer.writeRepeatedBytes( - 18, - f - ); - } - f = message.getPaymentTimeout(); - if (f !== 0) { - writer.writeUint32( - 19, + writer.writeRepeatedString( + 8, f ); } @@ -1317,417 +5171,433 @@ proto.looprpc.LoopOutRequest.serializeBinaryToWriter = function(message, writer) /** - * optional int64 amt = 1; - * @return {string} - */ -proto.looprpc.LoopOutRequest.prototype.getAmt = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0")); -}; - - -/** - * @param {string} value - * @return {!proto.looprpc.LoopOutRequest} returns this - */ -proto.looprpc.LoopOutRequest.prototype.setAmt = function(value) { - return jspb.Message.setProto3StringIntField(this, 1, value); -}; - - -/** - * optional string dest = 2; - * @return {string} - */ -proto.looprpc.LoopOutRequest.prototype.getDest = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.looprpc.LoopOutRequest} returns this - */ -proto.looprpc.LoopOutRequest.prototype.setDest = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - - -/** - * optional int64 max_swap_routing_fee = 3; - * @return {string} - */ -proto.looprpc.LoopOutRequest.prototype.getMaxSwapRoutingFee = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "0")); -}; - - -/** - * @param {string} value - * @return {!proto.looprpc.LoopOutRequest} returns this - */ -proto.looprpc.LoopOutRequest.prototype.setMaxSwapRoutingFee = function(value) { - return jspb.Message.setProto3StringIntField(this, 3, value); -}; - - -/** - * optional int64 max_prepay_routing_fee = 4; + * optional int64 amt = 1; * @return {string} */ -proto.looprpc.LoopOutRequest.prototype.getMaxPrepayRoutingFee = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "0")); +proto.looprpc.QuoteRequest.prototype.getAmt = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0")); }; /** * @param {string} value - * @return {!proto.looprpc.LoopOutRequest} returns this + * @return {!proto.looprpc.QuoteRequest} returns this */ -proto.looprpc.LoopOutRequest.prototype.setMaxPrepayRoutingFee = function(value) { - return jspb.Message.setProto3StringIntField(this, 4, value); +proto.looprpc.QuoteRequest.prototype.setAmt = function(value) { + return jspb.Message.setProto3StringIntField(this, 1, value); }; /** - * optional int64 max_swap_fee = 5; - * @return {string} + * optional int32 conf_target = 2; + * @return {number} */ -proto.looprpc.LoopOutRequest.prototype.getMaxSwapFee = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "0")); +proto.looprpc.QuoteRequest.prototype.getConfTarget = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** - * @param {string} value - * @return {!proto.looprpc.LoopOutRequest} returns this + * @param {number} value + * @return {!proto.looprpc.QuoteRequest} returns this */ -proto.looprpc.LoopOutRequest.prototype.setMaxSwapFee = function(value) { - return jspb.Message.setProto3StringIntField(this, 5, value); +proto.looprpc.QuoteRequest.prototype.setConfTarget = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); }; /** - * optional int64 max_prepay_amt = 6; - * @return {string} + * optional bool external_htlc = 3; + * @return {boolean} */ -proto.looprpc.LoopOutRequest.prototype.getMaxPrepayAmt = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "0")); +proto.looprpc.QuoteRequest.prototype.getExternalHtlc = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); }; /** - * @param {string} value - * @return {!proto.looprpc.LoopOutRequest} returns this + * @param {boolean} value + * @return {!proto.looprpc.QuoteRequest} returns this */ -proto.looprpc.LoopOutRequest.prototype.setMaxPrepayAmt = function(value) { - return jspb.Message.setProto3StringIntField(this, 6, value); +proto.looprpc.QuoteRequest.prototype.setExternalHtlc = function(value) { + return jspb.Message.setProto3BooleanField(this, 3, value); }; /** - * optional int64 max_miner_fee = 7; + * optional uint64 swap_publication_deadline = 4; * @return {string} */ -proto.looprpc.LoopOutRequest.prototype.getMaxMinerFee = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "0")); +proto.looprpc.QuoteRequest.prototype.getSwapPublicationDeadline = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "0")); }; /** * @param {string} value - * @return {!proto.looprpc.LoopOutRequest} returns this - */ -proto.looprpc.LoopOutRequest.prototype.setMaxMinerFee = function(value) { - return jspb.Message.setProto3StringIntField(this, 7, value); -}; - - -/** - * optional uint64 loop_out_channel = 8; - * @return {string} + * @return {!proto.looprpc.QuoteRequest} returns this */ -proto.looprpc.LoopOutRequest.prototype.getLoopOutChannel = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 8, "0")); +proto.looprpc.QuoteRequest.prototype.setSwapPublicationDeadline = function(value) { + return jspb.Message.setProto3StringIntField(this, 4, value); }; /** - * @param {string} value - * @return {!proto.looprpc.LoopOutRequest} returns this + * optional bytes loop_in_last_hop = 5; + * @return {!(string|Uint8Array)} */ -proto.looprpc.LoopOutRequest.prototype.setLoopOutChannel = function(value) { - return jspb.Message.setProto3StringIntField(this, 8, value); +proto.looprpc.QuoteRequest.prototype.getLoopInLastHop = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 5, "")); }; /** - * repeated uint64 outgoing_chan_set = 11; - * @return {!Array} + * optional bytes loop_in_last_hop = 5; + * This is a type-conversion wrapper around `getLoopInLastHop()` + * @return {string} */ -proto.looprpc.LoopOutRequest.prototype.getOutgoingChanSetList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 11)); +proto.looprpc.QuoteRequest.prototype.getLoopInLastHop_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getLoopInLastHop())); }; /** - * @param {!Array} value - * @return {!proto.looprpc.LoopOutRequest} returns this + * optional bytes loop_in_last_hop = 5; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getLoopInLastHop()` + * @return {!Uint8Array} */ -proto.looprpc.LoopOutRequest.prototype.setOutgoingChanSetList = function(value) { - return jspb.Message.setField(this, 11, value || []); +proto.looprpc.QuoteRequest.prototype.getLoopInLastHop_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getLoopInLastHop())); }; /** - * @param {string} value - * @param {number=} opt_index - * @return {!proto.looprpc.LoopOutRequest} returns this + * @param {!(string|Uint8Array)} value + * @return {!proto.looprpc.QuoteRequest} returns this */ -proto.looprpc.LoopOutRequest.prototype.addOutgoingChanSet = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 11, value, opt_index); +proto.looprpc.QuoteRequest.prototype.setLoopInLastHop = function(value) { + return jspb.Message.setProto3BytesField(this, 5, value); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.looprpc.LoopOutRequest} returns this + * repeated RouteHint loop_in_route_hints = 6; + * @return {!Array} */ -proto.looprpc.LoopOutRequest.prototype.clearOutgoingChanSetList = function() { - return this.setOutgoingChanSetList([]); +proto.looprpc.QuoteRequest.prototype.getLoopInRouteHintsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, swapserverrpc_common_pb.RouteHint, 6)); }; /** - * optional int32 sweep_conf_target = 9; - * @return {number} - */ -proto.looprpc.LoopOutRequest.prototype.getSweepConfTarget = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 9, 0)); + * @param {!Array} value + * @return {!proto.looprpc.QuoteRequest} returns this +*/ +proto.looprpc.QuoteRequest.prototype.setLoopInRouteHintsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 6, value); }; /** - * @param {number} value - * @return {!proto.looprpc.LoopOutRequest} returns this + * @param {!proto.looprpc.RouteHint=} opt_value + * @param {number=} opt_index + * @return {!proto.looprpc.RouteHint} */ -proto.looprpc.LoopOutRequest.prototype.setSweepConfTarget = function(value) { - return jspb.Message.setProto3IntField(this, 9, value); +proto.looprpc.QuoteRequest.prototype.addLoopInRouteHints = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 6, opt_value, proto.looprpc.RouteHint, opt_index); }; /** - * optional int32 htlc_confirmations = 13; - * @return {number} + * Clears the list making it empty but non-null. + * @return {!proto.looprpc.QuoteRequest} returns this */ -proto.looprpc.LoopOutRequest.prototype.getHtlcConfirmations = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 13, 0)); +proto.looprpc.QuoteRequest.prototype.clearLoopInRouteHintsList = function() { + return this.setLoopInRouteHintsList([]); }; /** - * @param {number} value - * @return {!proto.looprpc.LoopOutRequest} returns this + * optional bool private = 7; + * @return {boolean} */ -proto.looprpc.LoopOutRequest.prototype.setHtlcConfirmations = function(value) { - return jspb.Message.setProto3IntField(this, 13, value); +proto.looprpc.QuoteRequest.prototype.getPrivate = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 7, false)); }; /** - * optional uint64 swap_publication_deadline = 10; - * @return {string} + * @param {boolean} value + * @return {!proto.looprpc.QuoteRequest} returns this */ -proto.looprpc.LoopOutRequest.prototype.getSwapPublicationDeadline = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 10, "0")); +proto.looprpc.QuoteRequest.prototype.setPrivate = function(value) { + return jspb.Message.setProto3BooleanField(this, 7, value); }; /** - * @param {string} value - * @return {!proto.looprpc.LoopOutRequest} returns this + * repeated string deposit_outpoints = 8; + * @return {!Array} */ -proto.looprpc.LoopOutRequest.prototype.setSwapPublicationDeadline = function(value) { - return jspb.Message.setProto3StringIntField(this, 10, value); +proto.looprpc.QuoteRequest.prototype.getDepositOutpointsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 8)); }; /** - * optional string label = 12; - * @return {string} + * @param {!Array} value + * @return {!proto.looprpc.QuoteRequest} returns this */ -proto.looprpc.LoopOutRequest.prototype.getLabel = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 12, "")); +proto.looprpc.QuoteRequest.prototype.setDepositOutpointsList = function(value) { + return jspb.Message.setField(this, 8, value || []); }; /** * @param {string} value - * @return {!proto.looprpc.LoopOutRequest} returns this + * @param {number=} opt_index + * @return {!proto.looprpc.QuoteRequest} returns this */ -proto.looprpc.LoopOutRequest.prototype.setLabel = function(value) { - return jspb.Message.setProto3StringField(this, 12, value); +proto.looprpc.QuoteRequest.prototype.addDepositOutpoints = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 8, value, opt_index); }; /** - * optional string initiator = 14; - * @return {string} + * Clears the list making it empty but non-null. + * @return {!proto.looprpc.QuoteRequest} returns this */ -proto.looprpc.LoopOutRequest.prototype.getInitiator = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 14, "")); +proto.looprpc.QuoteRequest.prototype.clearDepositOutpointsList = function() { + return this.setDepositOutpointsList([]); }; -/** - * @param {string} value - * @return {!proto.looprpc.LoopOutRequest} returns this - */ -proto.looprpc.LoopOutRequest.prototype.setInitiator = function(value) { - return jspb.Message.setProto3StringField(this, 14, value); -}; + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * optional string account = 15; - * @return {string} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.looprpc.LoopOutRequest.prototype.getAccount = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 15, "")); +proto.looprpc.InQuoteResponse.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.InQuoteResponse.toObject(opt_includeInstance, this); }; /** - * @param {string} value - * @return {!proto.looprpc.LoopOutRequest} returns this + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.looprpc.InQuoteResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.LoopOutRequest.prototype.setAccount = function(value) { - return jspb.Message.setProto3StringField(this, 15, value); +proto.looprpc.InQuoteResponse.toObject = function(includeInstance, msg) { + var f, obj = { + swapFeeSat: jspb.Message.getFieldWithDefault(msg, 1, "0"), + htlcPublishFeeSat: jspb.Message.getFieldWithDefault(msg, 3, "0"), + cltvDelta: jspb.Message.getFieldWithDefault(msg, 5, 0), + confTarget: jspb.Message.getFieldWithDefault(msg, 6, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * optional AddressType account_addr_type = 16; - * @return {!proto.looprpc.AddressType} + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.looprpc.InQuoteResponse} */ -proto.looprpc.LoopOutRequest.prototype.getAccountAddrType = function() { - return /** @type {!proto.looprpc.AddressType} */ (jspb.Message.getFieldWithDefault(this, 16, 0)); +proto.looprpc.InQuoteResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.looprpc.InQuoteResponse; + return proto.looprpc.InQuoteResponse.deserializeBinaryFromReader(msg, reader); }; /** - * @param {!proto.looprpc.AddressType} value - * @return {!proto.looprpc.LoopOutRequest} returns this + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.looprpc.InQuoteResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.InQuoteResponse} */ -proto.looprpc.LoopOutRequest.prototype.setAccountAddrType = function(value) { - return jspb.Message.setProto3EnumField(this, 16, value); +proto.looprpc.InQuoteResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setSwapFeeSat(value); + break; + case 3: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setHtlcPublishFeeSat(value); + break; + case 5: + var value = /** @type {number} */ (reader.readInt32()); + msg.setCltvDelta(value); + break; + case 6: + var value = /** @type {number} */ (reader.readInt32()); + msg.setConfTarget(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * optional bool is_external_addr = 17; - * @return {boolean} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.looprpc.LoopOutRequest.prototype.getIsExternalAddr = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 17, false)); +proto.looprpc.InQuoteResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.InQuoteResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * @param {boolean} value - * @return {!proto.looprpc.LoopOutRequest} returns this + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.InQuoteResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.LoopOutRequest.prototype.setIsExternalAddr = function(value) { - return jspb.Message.setProto3BooleanField(this, 17, value); +proto.looprpc.InQuoteResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getSwapFeeSat(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 1, + f + ); + } + f = message.getHtlcPublishFeeSat(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 3, + f + ); + } + f = message.getCltvDelta(); + if (f !== 0) { + writer.writeInt32( + 5, + f + ); + } + f = message.getConfTarget(); + if (f !== 0) { + writer.writeInt32( + 6, + f + ); + } }; /** - * repeated bytes reservation_ids = 18; - * @return {!(Array|Array)} + * optional int64 swap_fee_sat = 1; + * @return {string} */ -proto.looprpc.LoopOutRequest.prototype.getReservationIdsList = function() { - return /** @type {!(Array|Array)} */ (jspb.Message.getRepeatedField(this, 18)); +proto.looprpc.InQuoteResponse.prototype.getSwapFeeSat = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0")); }; /** - * repeated bytes reservation_ids = 18; - * This is a type-conversion wrapper around `getReservationIdsList()` - * @return {!Array} + * @param {string} value + * @return {!proto.looprpc.InQuoteResponse} returns this */ -proto.looprpc.LoopOutRequest.prototype.getReservationIdsList_asB64 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsB64( - this.getReservationIdsList())); +proto.looprpc.InQuoteResponse.prototype.setSwapFeeSat = function(value) { + return jspb.Message.setProto3StringIntField(this, 1, value); }; /** - * repeated bytes reservation_ids = 18; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getReservationIdsList()` - * @return {!Array} + * optional int64 htlc_publish_fee_sat = 3; + * @return {string} */ -proto.looprpc.LoopOutRequest.prototype.getReservationIdsList_asU8 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsU8( - this.getReservationIdsList())); +proto.looprpc.InQuoteResponse.prototype.getHtlcPublishFeeSat = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "0")); }; /** - * @param {!(Array|Array)} value - * @return {!proto.looprpc.LoopOutRequest} returns this + * @param {string} value + * @return {!proto.looprpc.InQuoteResponse} returns this */ -proto.looprpc.LoopOutRequest.prototype.setReservationIdsList = function(value) { - return jspb.Message.setField(this, 18, value || []); +proto.looprpc.InQuoteResponse.prototype.setHtlcPublishFeeSat = function(value) { + return jspb.Message.setProto3StringIntField(this, 3, value); }; /** - * @param {!(string|Uint8Array)} value - * @param {number=} opt_index - * @return {!proto.looprpc.LoopOutRequest} returns this + * optional int32 cltv_delta = 5; + * @return {number} */ -proto.looprpc.LoopOutRequest.prototype.addReservationIds = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 18, value, opt_index); +proto.looprpc.InQuoteResponse.prototype.getCltvDelta = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.looprpc.LoopOutRequest} returns this + * @param {number} value + * @return {!proto.looprpc.InQuoteResponse} returns this */ -proto.looprpc.LoopOutRequest.prototype.clearReservationIdsList = function() { - return this.setReservationIdsList([]); +proto.looprpc.InQuoteResponse.prototype.setCltvDelta = function(value) { + return jspb.Message.setProto3IntField(this, 5, value); }; /** - * optional uint32 payment_timeout = 19; + * optional int32 conf_target = 6; * @return {number} */ -proto.looprpc.LoopOutRequest.prototype.getPaymentTimeout = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 19, 0)); +proto.looprpc.InQuoteResponse.prototype.getConfTarget = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); }; /** * @param {number} value - * @return {!proto.looprpc.LoopOutRequest} returns this + * @return {!proto.looprpc.InQuoteResponse} returns this */ -proto.looprpc.LoopOutRequest.prototype.setPaymentTimeout = function(value) { - return jspb.Message.setProto3IntField(this, 19, value); +proto.looprpc.InQuoteResponse.prototype.setConfTarget = function(value) { + return jspb.Message.setProto3IntField(this, 6, value); }; -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.looprpc.LoopInRequest.repeatedFields_ = [9]; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -1743,8 +5613,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.LoopInRequest.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.LoopInRequest.toObject(opt_includeInstance, this); +proto.looprpc.OutQuoteResponse.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.OutQuoteResponse.toObject(opt_includeInstance, this); }; @@ -1753,23 +5623,18 @@ proto.looprpc.LoopInRequest.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.LoopInRequest} msg The msg instance to transform. + * @param {!proto.looprpc.OutQuoteResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.LoopInRequest.toObject = function(includeInstance, msg) { +proto.looprpc.OutQuoteResponse.toObject = function(includeInstance, msg) { var f, obj = { - amt: jspb.Message.getFieldWithDefault(msg, 1, "0"), - maxSwapFee: jspb.Message.getFieldWithDefault(msg, 2, "0"), - maxMinerFee: jspb.Message.getFieldWithDefault(msg, 3, "0"), - lastHop: msg.getLastHop_asB64(), - externalHtlc: jspb.Message.getBooleanFieldWithDefault(msg, 5, false), - htlcConfTarget: jspb.Message.getFieldWithDefault(msg, 6, 0), - label: jspb.Message.getFieldWithDefault(msg, 7, ""), - initiator: jspb.Message.getFieldWithDefault(msg, 8, ""), - routeHintsList: jspb.Message.toObjectList(msg.getRouteHintsList(), - swapserverrpc_common_pb.RouteHint.toObject, includeInstance), - pb_private: jspb.Message.getBooleanFieldWithDefault(msg, 10, false) + swapFeeSat: jspb.Message.getFieldWithDefault(msg, 1, "0"), + prepayAmtSat: jspb.Message.getFieldWithDefault(msg, 2, "0"), + htlcSweepFeeSat: jspb.Message.getFieldWithDefault(msg, 3, "0"), + swapPaymentDest: msg.getSwapPaymentDest_asB64(), + cltvDelta: jspb.Message.getFieldWithDefault(msg, 5, 0), + confTarget: jspb.Message.getFieldWithDefault(msg, 6, 0) }; if (includeInstance) { @@ -1783,23 +5648,23 @@ proto.looprpc.LoopInRequest.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.LoopInRequest} + * @return {!proto.looprpc.OutQuoteResponse} */ -proto.looprpc.LoopInRequest.deserializeBinary = function(bytes) { +proto.looprpc.OutQuoteResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.LoopInRequest; - return proto.looprpc.LoopInRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.OutQuoteResponse; + return proto.looprpc.OutQuoteResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.LoopInRequest} msg The message object to deserialize into. + * @param {!proto.looprpc.OutQuoteResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.LoopInRequest} + * @return {!proto.looprpc.OutQuoteResponse} */ -proto.looprpc.LoopInRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.OutQuoteResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -1808,44 +5673,27 @@ proto.looprpc.LoopInRequest.deserializeBinaryFromReader = function(msg, reader) switch (field) { case 1: var value = /** @type {string} */ (reader.readInt64String()); - msg.setAmt(value); + msg.setSwapFeeSat(value); break; case 2: var value = /** @type {string} */ (reader.readInt64String()); - msg.setMaxSwapFee(value); + msg.setPrepayAmtSat(value); break; case 3: var value = /** @type {string} */ (reader.readInt64String()); - msg.setMaxMinerFee(value); + msg.setHtlcSweepFeeSat(value); break; case 4: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setLastHop(value); + msg.setSwapPaymentDest(value); break; case 5: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setExternalHtlc(value); + var value = /** @type {number} */ (reader.readInt32()); + msg.setCltvDelta(value); break; case 6: var value = /** @type {number} */ (reader.readInt32()); - msg.setHtlcConfTarget(value); - break; - case 7: - var value = /** @type {string} */ (reader.readString()); - msg.setLabel(value); - break; - case 8: - var value = /** @type {string} */ (reader.readString()); - msg.setInitiator(value); - break; - case 9: - var value = new swapserverrpc_common_pb.RouteHint; - reader.readMessage(value,swapserverrpc_common_pb.RouteHint.deserializeBinaryFromReader); - msg.addRouteHints(value); - break; - case 10: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setPrivate(value); + msg.setConfTarget(value); break; default: reader.skipField(); @@ -1860,9 +5708,9 @@ proto.looprpc.LoopInRequest.deserializeBinaryFromReader = function(msg, reader) * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.LoopInRequest.prototype.serializeBinary = function() { +proto.looprpc.OutQuoteResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.LoopInRequest.serializeBinaryToWriter(this, writer); + proto.looprpc.OutQuoteResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -1870,80 +5718,51 @@ proto.looprpc.LoopInRequest.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.LoopInRequest} message + * @param {!proto.looprpc.OutQuoteResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.LoopInRequest.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.OutQuoteResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getAmt(); + f = message.getSwapFeeSat(); if (parseInt(f, 10) !== 0) { writer.writeInt64String( 1, f ); } - f = message.getMaxSwapFee(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 2, - f - ); - } - f = message.getMaxMinerFee(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 3, - f - ); - } - f = message.getLastHop_asU8(); - if (f.length > 0) { - writer.writeBytes( - 4, - f - ); - } - f = message.getExternalHtlc(); - if (f) { - writer.writeBool( - 5, - f - ); - } - f = message.getHtlcConfTarget(); - if (f !== 0) { - writer.writeInt32( - 6, + f = message.getPrepayAmtSat(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 2, f ); } - f = message.getLabel(); - if (f.length > 0) { - writer.writeString( - 7, + f = message.getHtlcSweepFeeSat(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 3, f ); } - f = message.getInitiator(); + f = message.getSwapPaymentDest_asU8(); if (f.length > 0) { - writer.writeString( - 8, + writer.writeBytes( + 4, f ); } - f = message.getRouteHintsList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 9, - f, - swapserverrpc_common_pb.RouteHint.serializeBinaryToWriter + f = message.getCltvDelta(); + if (f !== 0) { + writer.writeInt32( + 5, + f ); } - f = message.getPrivate(); - if (f) { - writer.writeBool( - 10, + f = message.getConfTarget(); + if (f !== 0) { + writer.writeInt32( + 6, f ); } @@ -1951,229 +5770,144 @@ proto.looprpc.LoopInRequest.serializeBinaryToWriter = function(message, writer) /** - * optional int64 amt = 1; + * optional int64 swap_fee_sat = 1; * @return {string} */ -proto.looprpc.LoopInRequest.prototype.getAmt = function() { +proto.looprpc.OutQuoteResponse.prototype.getSwapFeeSat = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0")); }; /** * @param {string} value - * @return {!proto.looprpc.LoopInRequest} returns this + * @return {!proto.looprpc.OutQuoteResponse} returns this */ -proto.looprpc.LoopInRequest.prototype.setAmt = function(value) { +proto.looprpc.OutQuoteResponse.prototype.setSwapFeeSat = function(value) { return jspb.Message.setProto3StringIntField(this, 1, value); }; /** - * optional int64 max_swap_fee = 2; + * optional int64 prepay_amt_sat = 2; * @return {string} */ -proto.looprpc.LoopInRequest.prototype.getMaxSwapFee = function() { +proto.looprpc.OutQuoteResponse.prototype.getPrepayAmtSat = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "0")); }; /** * @param {string} value - * @return {!proto.looprpc.LoopInRequest} returns this + * @return {!proto.looprpc.OutQuoteResponse} returns this */ -proto.looprpc.LoopInRequest.prototype.setMaxSwapFee = function(value) { +proto.looprpc.OutQuoteResponse.prototype.setPrepayAmtSat = function(value) { return jspb.Message.setProto3StringIntField(this, 2, value); }; /** - * optional int64 max_miner_fee = 3; + * optional int64 htlc_sweep_fee_sat = 3; * @return {string} */ -proto.looprpc.LoopInRequest.prototype.getMaxMinerFee = function() { +proto.looprpc.OutQuoteResponse.prototype.getHtlcSweepFeeSat = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "0")); }; /** * @param {string} value - * @return {!proto.looprpc.LoopInRequest} returns this + * @return {!proto.looprpc.OutQuoteResponse} returns this */ -proto.looprpc.LoopInRequest.prototype.setMaxMinerFee = function(value) { +proto.looprpc.OutQuoteResponse.prototype.setHtlcSweepFeeSat = function(value) { return jspb.Message.setProto3StringIntField(this, 3, value); }; /** - * optional bytes last_hop = 4; + * optional bytes swap_payment_dest = 4; * @return {!(string|Uint8Array)} */ -proto.looprpc.LoopInRequest.prototype.getLastHop = function() { +proto.looprpc.OutQuoteResponse.prototype.getSwapPaymentDest = function() { return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; /** - * optional bytes last_hop = 4; - * This is a type-conversion wrapper around `getLastHop()` + * optional bytes swap_payment_dest = 4; + * This is a type-conversion wrapper around `getSwapPaymentDest()` * @return {string} */ -proto.looprpc.LoopInRequest.prototype.getLastHop_asB64 = function() { +proto.looprpc.OutQuoteResponse.prototype.getSwapPaymentDest_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getLastHop())); + this.getSwapPaymentDest())); }; /** - * optional bytes last_hop = 4; + * optional bytes swap_payment_dest = 4; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getLastHop()` + * This is a type-conversion wrapper around `getSwapPaymentDest()` * @return {!Uint8Array} */ -proto.looprpc.LoopInRequest.prototype.getLastHop_asU8 = function() { +proto.looprpc.OutQuoteResponse.prototype.getSwapPaymentDest_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getLastHop())); + this.getSwapPaymentDest())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.looprpc.LoopInRequest} returns this + * @return {!proto.looprpc.OutQuoteResponse} returns this */ -proto.looprpc.LoopInRequest.prototype.setLastHop = function(value) { +proto.looprpc.OutQuoteResponse.prototype.setSwapPaymentDest = function(value) { return jspb.Message.setProto3BytesField(this, 4, value); }; /** - * optional bool external_htlc = 5; - * @return {boolean} + * optional int32 cltv_delta = 5; + * @return {number} */ -proto.looprpc.LoopInRequest.prototype.getExternalHtlc = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); +proto.looprpc.OutQuoteResponse.prototype.getCltvDelta = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); }; /** - * @param {boolean} value - * @return {!proto.looprpc.LoopInRequest} returns this + * @param {number} value + * @return {!proto.looprpc.OutQuoteResponse} returns this */ -proto.looprpc.LoopInRequest.prototype.setExternalHtlc = function(value) { - return jspb.Message.setProto3BooleanField(this, 5, value); +proto.looprpc.OutQuoteResponse.prototype.setCltvDelta = function(value) { + return jspb.Message.setProto3IntField(this, 5, value); }; /** - * optional int32 htlc_conf_target = 6; + * optional int32 conf_target = 6; * @return {number} */ -proto.looprpc.LoopInRequest.prototype.getHtlcConfTarget = function() { +proto.looprpc.OutQuoteResponse.prototype.getConfTarget = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); }; /** * @param {number} value - * @return {!proto.looprpc.LoopInRequest} returns this + * @return {!proto.looprpc.OutQuoteResponse} returns this */ -proto.looprpc.LoopInRequest.prototype.setHtlcConfTarget = function(value) { +proto.looprpc.OutQuoteResponse.prototype.setConfTarget = function(value) { return jspb.Message.setProto3IntField(this, 6, value); }; -/** - * optional string label = 7; - * @return {string} - */ -proto.looprpc.LoopInRequest.prototype.getLabel = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); -}; - - -/** - * @param {string} value - * @return {!proto.looprpc.LoopInRequest} returns this - */ -proto.looprpc.LoopInRequest.prototype.setLabel = function(value) { - return jspb.Message.setProto3StringField(this, 7, value); -}; - - -/** - * optional string initiator = 8; - * @return {string} - */ -proto.looprpc.LoopInRequest.prototype.getInitiator = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 8, "")); -}; - - -/** - * @param {string} value - * @return {!proto.looprpc.LoopInRequest} returns this - */ -proto.looprpc.LoopInRequest.prototype.setInitiator = function(value) { - return jspb.Message.setProto3StringField(this, 8, value); -}; - - -/** - * repeated RouteHint route_hints = 9; - * @return {!Array} - */ -proto.looprpc.LoopInRequest.prototype.getRouteHintsList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, swapserverrpc_common_pb.RouteHint, 9)); -}; - - -/** - * @param {!Array} value - * @return {!proto.looprpc.LoopInRequest} returns this -*/ -proto.looprpc.LoopInRequest.prototype.setRouteHintsList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 9, value); -}; - - -/** - * @param {!proto.looprpc.RouteHint=} opt_value - * @param {number=} opt_index - * @return {!proto.looprpc.RouteHint} - */ -proto.looprpc.LoopInRequest.prototype.addRouteHints = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 9, opt_value, proto.looprpc.RouteHint, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.looprpc.LoopInRequest} returns this - */ -proto.looprpc.LoopInRequest.prototype.clearRouteHintsList = function() { - return this.setRouteHintsList([]); -}; - - -/** - * optional bool private = 10; - * @return {boolean} - */ -proto.looprpc.LoopInRequest.prototype.getPrivate = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 10, false)); -}; - /** - * @param {boolean} value - * @return {!proto.looprpc.LoopInRequest} returns this + * List of repeated fields within this message type. + * @private {!Array} + * @const */ -proto.looprpc.LoopInRequest.prototype.setPrivate = function(value) { - return jspb.Message.setProto3BooleanField(this, 10, value); -}; - - +proto.looprpc.ProbeRequest.repeatedFields_ = [3]; @@ -2190,8 +5924,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.SwapResponse.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.SwapResponse.toObject(opt_includeInstance, this); +proto.looprpc.ProbeRequest.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.ProbeRequest.toObject(opt_includeInstance, this); }; @@ -2200,18 +5934,16 @@ proto.looprpc.SwapResponse.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.SwapResponse} msg The msg instance to transform. + * @param {!proto.looprpc.ProbeRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.SwapResponse.toObject = function(includeInstance, msg) { +proto.looprpc.ProbeRequest.toObject = function(includeInstance, msg) { var f, obj = { - id: jspb.Message.getFieldWithDefault(msg, 1, ""), - idBytes: msg.getIdBytes_asB64(), - htlcAddress: jspb.Message.getFieldWithDefault(msg, 2, ""), - htlcAddressP2wsh: jspb.Message.getFieldWithDefault(msg, 5, ""), - htlcAddressP2tr: jspb.Message.getFieldWithDefault(msg, 7, ""), - serverMessage: jspb.Message.getFieldWithDefault(msg, 6, "") + amt: jspb.Message.getFieldWithDefault(msg, 1, "0"), + lastHop: msg.getLastHop_asB64(), + routeHintsList: jspb.Message.toObjectList(msg.getRouteHintsList(), + swapserverrpc_common_pb.RouteHint.toObject, includeInstance) }; if (includeInstance) { @@ -2225,23 +5957,23 @@ proto.looprpc.SwapResponse.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.SwapResponse} + * @return {!proto.looprpc.ProbeRequest} */ -proto.looprpc.SwapResponse.deserializeBinary = function(bytes) { +proto.looprpc.ProbeRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.SwapResponse; - return proto.looprpc.SwapResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.ProbeRequest; + return proto.looprpc.ProbeRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.SwapResponse} msg The message object to deserialize into. + * @param {!proto.looprpc.ProbeRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.SwapResponse} + * @return {!proto.looprpc.ProbeRequest} */ -proto.looprpc.SwapResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.ProbeRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -2249,28 +5981,17 @@ proto.looprpc.SwapResponse.deserializeBinaryFromReader = function(msg, reader) { var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setId(value); - break; - case 3: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setIdBytes(value); + var value = /** @type {string} */ (reader.readInt64String()); + msg.setAmt(value); break; case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setHtlcAddress(value); - break; - case 5: - var value = /** @type {string} */ (reader.readString()); - msg.setHtlcAddressP2wsh(value); - break; - case 7: - var value = /** @type {string} */ (reader.readString()); - msg.setHtlcAddressP2tr(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setLastHop(value); break; - case 6: - var value = /** @type {string} */ (reader.readString()); - msg.setServerMessage(value); + case 3: + var value = new swapserverrpc_common_pb.RouteHint; + reader.readMessage(value,swapserverrpc_common_pb.RouteHint.deserializeBinaryFromReader); + msg.addRouteHints(value); break; default: reader.skipField(); @@ -2285,9 +6006,9 @@ proto.looprpc.SwapResponse.deserializeBinaryFromReader = function(msg, reader) { * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.SwapResponse.prototype.serializeBinary = function() { +proto.looprpc.ProbeRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.SwapResponse.serializeBinaryToWriter(this, writer); + proto.looprpc.ProbeRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -2295,186 +6016,233 @@ proto.looprpc.SwapResponse.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.SwapResponse} message + * @param {!proto.looprpc.ProbeRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.SwapResponse.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.ProbeRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getId(); - if (f.length > 0) { - writer.writeString( + f = message.getAmt(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( 1, f ); } - f = message.getIdBytes_asU8(); + f = message.getLastHop_asU8(); if (f.length > 0) { writer.writeBytes( - 3, - f - ); - } - f = message.getHtlcAddress(); - if (f.length > 0) { - writer.writeString( 2, f ); } - f = message.getHtlcAddressP2wsh(); - if (f.length > 0) { - writer.writeString( - 5, - f - ); - } - f = message.getHtlcAddressP2tr(); - if (f.length > 0) { - writer.writeString( - 7, - f - ); - } - f = message.getServerMessage(); + f = message.getRouteHintsList(); if (f.length > 0) { - writer.writeString( - 6, - f + writer.writeRepeatedMessage( + 3, + f, + swapserverrpc_common_pb.RouteHint.serializeBinaryToWriter ); } }; /** - * optional string id = 1; + * optional int64 amt = 1; * @return {string} */ -proto.looprpc.SwapResponse.prototype.getId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.looprpc.ProbeRequest.prototype.getAmt = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0")); }; /** * @param {string} value - * @return {!proto.looprpc.SwapResponse} returns this + * @return {!proto.looprpc.ProbeRequest} returns this */ -proto.looprpc.SwapResponse.prototype.setId = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); +proto.looprpc.ProbeRequest.prototype.setAmt = function(value) { + return jspb.Message.setProto3StringIntField(this, 1, value); }; /** - * optional bytes id_bytes = 3; + * optional bytes last_hop = 2; * @return {!(string|Uint8Array)} */ -proto.looprpc.SwapResponse.prototype.getIdBytes = function() { - return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +proto.looprpc.ProbeRequest.prototype.getLastHop = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** - * optional bytes id_bytes = 3; - * This is a type-conversion wrapper around `getIdBytes()` + * optional bytes last_hop = 2; + * This is a type-conversion wrapper around `getLastHop()` * @return {string} */ -proto.looprpc.SwapResponse.prototype.getIdBytes_asB64 = function() { +proto.looprpc.ProbeRequest.prototype.getLastHop_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getIdBytes())); + this.getLastHop())); }; /** - * optional bytes id_bytes = 3; + * optional bytes last_hop = 2; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getIdBytes()` + * This is a type-conversion wrapper around `getLastHop()` * @return {!Uint8Array} */ -proto.looprpc.SwapResponse.prototype.getIdBytes_asU8 = function() { +proto.looprpc.ProbeRequest.prototype.getLastHop_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getIdBytes())); + this.getLastHop())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.looprpc.SwapResponse} returns this + * @return {!proto.looprpc.ProbeRequest} returns this */ -proto.looprpc.SwapResponse.prototype.setIdBytes = function(value) { - return jspb.Message.setProto3BytesField(this, 3, value); +proto.looprpc.ProbeRequest.prototype.setLastHop = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); }; /** - * optional string htlc_address = 2; - * @return {string} + * repeated RouteHint route_hints = 3; + * @return {!Array} */ -proto.looprpc.SwapResponse.prototype.getHtlcAddress = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.looprpc.ProbeRequest.prototype.getRouteHintsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, swapserverrpc_common_pb.RouteHint, 3)); }; /** - * @param {string} value - * @return {!proto.looprpc.SwapResponse} returns this + * @param {!Array} value + * @return {!proto.looprpc.ProbeRequest} returns this +*/ +proto.looprpc.ProbeRequest.prototype.setRouteHintsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 3, value); +}; + + +/** + * @param {!proto.looprpc.RouteHint=} opt_value + * @param {number=} opt_index + * @return {!proto.looprpc.RouteHint} */ -proto.looprpc.SwapResponse.prototype.setHtlcAddress = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); +proto.looprpc.ProbeRequest.prototype.addRouteHints = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.looprpc.RouteHint, opt_index); }; /** - * optional string htlc_address_p2wsh = 5; - * @return {string} + * Clears the list making it empty but non-null. + * @return {!proto.looprpc.ProbeRequest} returns this */ -proto.looprpc.SwapResponse.prototype.getHtlcAddressP2wsh = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +proto.looprpc.ProbeRequest.prototype.clearRouteHintsList = function() { + return this.setRouteHintsList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.looprpc.ProbeResponse.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.ProbeResponse.toObject(opt_includeInstance, this); }; /** - * @param {string} value - * @return {!proto.looprpc.SwapResponse} returns this + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.looprpc.ProbeResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.SwapResponse.prototype.setHtlcAddressP2wsh = function(value) { - return jspb.Message.setProto3StringField(this, 5, value); +proto.looprpc.ProbeResponse.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * optional string htlc_address_p2tr = 7; - * @return {string} + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.looprpc.ProbeResponse} */ -proto.looprpc.SwapResponse.prototype.getHtlcAddressP2tr = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); +proto.looprpc.ProbeResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.looprpc.ProbeResponse; + return proto.looprpc.ProbeResponse.deserializeBinaryFromReader(msg, reader); }; /** - * @param {string} value - * @return {!proto.looprpc.SwapResponse} returns this + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.looprpc.ProbeResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.ProbeResponse} */ -proto.looprpc.SwapResponse.prototype.setHtlcAddressP2tr = function(value) { - return jspb.Message.setProto3StringField(this, 7, value); +proto.looprpc.ProbeResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * optional string server_message = 6; - * @return {string} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.looprpc.SwapResponse.prototype.getServerMessage = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +proto.looprpc.ProbeResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.ProbeResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * @param {string} value - * @return {!proto.looprpc.SwapResponse} returns this + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.ProbeResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.SwapResponse.prototype.setServerMessage = function(value) { - return jspb.Message.setProto3StringField(this, 6, value); +proto.looprpc.ProbeResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; }; @@ -2494,8 +6262,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.MonitorRequest.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.MonitorRequest.toObject(opt_includeInstance, this); +proto.looprpc.TokensRequest.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.TokensRequest.toObject(opt_includeInstance, this); }; @@ -2504,11 +6272,11 @@ proto.looprpc.MonitorRequest.prototype.toObject = function(opt_includeInstance) * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.MonitorRequest} msg The msg instance to transform. + * @param {!proto.looprpc.TokensRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.MonitorRequest.toObject = function(includeInstance, msg) { +proto.looprpc.TokensRequest.toObject = function(includeInstance, msg) { var f, obj = { }; @@ -2524,23 +6292,23 @@ proto.looprpc.MonitorRequest.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.MonitorRequest} + * @return {!proto.looprpc.TokensRequest} */ -proto.looprpc.MonitorRequest.deserializeBinary = function(bytes) { +proto.looprpc.TokensRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.MonitorRequest; - return proto.looprpc.MonitorRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.TokensRequest; + return proto.looprpc.TokensRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.MonitorRequest} msg The message object to deserialize into. + * @param {!proto.looprpc.TokensRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.MonitorRequest} + * @return {!proto.looprpc.TokensRequest} */ -proto.looprpc.MonitorRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.TokensRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -2560,9 +6328,9 @@ proto.looprpc.MonitorRequest.deserializeBinaryFromReader = function(msg, reader) * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.MonitorRequest.prototype.serializeBinary = function() { +proto.looprpc.TokensRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.MonitorRequest.serializeBinaryToWriter(this, writer); + proto.looprpc.TokensRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -2570,11 +6338,11 @@ proto.looprpc.MonitorRequest.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.MonitorRequest} message + * @param {!proto.looprpc.TokensRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.MonitorRequest.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.TokensRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; }; @@ -2585,7 +6353,7 @@ proto.looprpc.MonitorRequest.serializeBinaryToWriter = function(message, writer) * @private {!Array} * @const */ -proto.looprpc.SwapStatus.repeatedFields_ = [17]; +proto.looprpc.TokensResponse.repeatedFields_ = [1]; @@ -2602,8 +6370,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.SwapStatus.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.SwapStatus.toObject(opt_includeInstance, this); +proto.looprpc.TokensResponse.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.TokensResponse.toObject(opt_includeInstance, this); }; @@ -2612,29 +6380,14 @@ proto.looprpc.SwapStatus.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.SwapStatus} msg The msg instance to transform. + * @param {!proto.looprpc.TokensResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.SwapStatus.toObject = function(includeInstance, msg) { +proto.looprpc.TokensResponse.toObject = function(includeInstance, msg) { var f, obj = { - amt: jspb.Message.getFieldWithDefault(msg, 1, "0"), - id: jspb.Message.getFieldWithDefault(msg, 2, ""), - idBytes: msg.getIdBytes_asB64(), - type: jspb.Message.getFieldWithDefault(msg, 3, 0), - state: jspb.Message.getFieldWithDefault(msg, 4, 0), - failureReason: jspb.Message.getFieldWithDefault(msg, 14, 0), - initiationTime: jspb.Message.getFieldWithDefault(msg, 5, "0"), - lastUpdateTime: jspb.Message.getFieldWithDefault(msg, 6, "0"), - htlcAddress: jspb.Message.getFieldWithDefault(msg, 7, ""), - htlcAddressP2wsh: jspb.Message.getFieldWithDefault(msg, 12, ""), - htlcAddressP2tr: jspb.Message.getFieldWithDefault(msg, 18, ""), - costServer: jspb.Message.getFieldWithDefault(msg, 8, "0"), - costOnchain: jspb.Message.getFieldWithDefault(msg, 9, "0"), - costOffchain: jspb.Message.getFieldWithDefault(msg, 10, "0"), - lastHop: msg.getLastHop_asB64(), - outgoingChanSetList: (f = jspb.Message.getRepeatedField(msg, 17)) == null ? undefined : f, - label: jspb.Message.getFieldWithDefault(msg, 15, "") + tokensList: jspb.Message.toObjectList(msg.getTokensList(), + proto.looprpc.L402Token.toObject, includeInstance) }; if (includeInstance) { @@ -2648,23 +6401,23 @@ proto.looprpc.SwapStatus.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.SwapStatus} + * @return {!proto.looprpc.TokensResponse} */ -proto.looprpc.SwapStatus.deserializeBinary = function(bytes) { +proto.looprpc.TokensResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.SwapStatus; - return proto.looprpc.SwapStatus.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.TokensResponse; + return proto.looprpc.TokensResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.SwapStatus} msg The message object to deserialize into. + * @param {!proto.looprpc.TokensResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.SwapStatus} + * @return {!proto.looprpc.TokensResponse} */ -proto.looprpc.SwapStatus.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.TokensResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -2672,758 +6425,733 @@ proto.looprpc.SwapStatus.deserializeBinaryFromReader = function(msg, reader) { var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setAmt(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setId(value); - break; - case 11: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setIdBytes(value); - break; - case 3: - var value = /** @type {!proto.looprpc.SwapType} */ (reader.readEnum()); - msg.setType(value); - break; - case 4: - var value = /** @type {!proto.looprpc.SwapState} */ (reader.readEnum()); - msg.setState(value); - break; - case 14: - var value = /** @type {!proto.looprpc.FailureReason} */ (reader.readEnum()); - msg.setFailureReason(value); - break; - case 5: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setInitiationTime(value); - break; - case 6: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setLastUpdateTime(value); - break; - case 7: - var value = /** @type {string} */ (reader.readString()); - msg.setHtlcAddress(value); - break; - case 12: - var value = /** @type {string} */ (reader.readString()); - msg.setHtlcAddressP2wsh(value); - break; - case 18: - var value = /** @type {string} */ (reader.readString()); - msg.setHtlcAddressP2tr(value); - break; - case 8: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setCostServer(value); - break; - case 9: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setCostOnchain(value); - break; - case 10: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setCostOffchain(value); - break; - case 16: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setLastHop(value); - break; - case 17: - var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedUint64String() : [reader.readUint64String()]); - for (var i = 0; i < values.length; i++) { - msg.addOutgoingChanSet(values[i]); - } - break; - case 15: - var value = /** @type {string} */ (reader.readString()); - msg.setLabel(value); - break; - default: - reader.skipField(); + var value = new proto.looprpc.L402Token; + reader.readMessage(value,proto.looprpc.L402Token.deserializeBinaryFromReader); + msg.addTokens(value); break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.looprpc.SwapStatus.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.SwapStatus.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.SwapStatus} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.SwapStatus.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getAmt(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 1, - f - ); - } - f = message.getId(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getIdBytes_asU8(); - if (f.length > 0) { - writer.writeBytes( - 11, - f - ); - } - f = message.getType(); - if (f !== 0.0) { - writer.writeEnum( - 3, - f - ); - } - f = message.getState(); - if (f !== 0.0) { - writer.writeEnum( - 4, - f - ); - } - f = message.getFailureReason(); - if (f !== 0.0) { - writer.writeEnum( - 14, - f - ); - } - f = message.getInitiationTime(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 5, - f - ); - } - f = message.getLastUpdateTime(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 6, - f - ); - } - f = message.getHtlcAddress(); - if (f.length > 0) { - writer.writeString( - 7, - f - ); - } - f = message.getHtlcAddressP2wsh(); - if (f.length > 0) { - writer.writeString( - 12, - f - ); - } - f = message.getHtlcAddressP2tr(); - if (f.length > 0) { - writer.writeString( - 18, - f - ); - } - f = message.getCostServer(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 8, - f - ); - } - f = message.getCostOnchain(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 9, - f - ); - } - f = message.getCostOffchain(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 10, - f - ); - } - f = message.getLastHop_asU8(); - if (f.length > 0) { - writer.writeBytes( - 16, - f - ); - } - f = message.getOutgoingChanSetList(); - if (f.length > 0) { - writer.writePackedUint64String( - 17, - f - ); - } - f = message.getLabel(); - if (f.length > 0) { - writer.writeString( - 15, - f - ); + default: + reader.skipField(); + break; + } } + return msg; }; /** - * optional int64 amt = 1; - * @return {string} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.looprpc.SwapStatus.prototype.getAmt = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0")); +proto.looprpc.TokensResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.TokensResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * @param {string} value - * @return {!proto.looprpc.SwapStatus} returns this + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.TokensResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.SwapStatus.prototype.setAmt = function(value) { - return jspb.Message.setProto3StringIntField(this, 1, value); +proto.looprpc.TokensResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getTokensList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.looprpc.L402Token.serializeBinaryToWriter + ); + } }; /** - * optional string id = 2; - * @return {string} + * repeated L402Token tokens = 1; + * @return {!Array} */ -proto.looprpc.SwapStatus.prototype.getId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.looprpc.TokensResponse.prototype.getTokensList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.looprpc.L402Token, 1)); }; /** - * @param {string} value - * @return {!proto.looprpc.SwapStatus} returns this - */ -proto.looprpc.SwapStatus.prototype.setId = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); + * @param {!Array} value + * @return {!proto.looprpc.TokensResponse} returns this +*/ +proto.looprpc.TokensResponse.prototype.setTokensList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** - * optional bytes id_bytes = 11; - * @return {!(string|Uint8Array)} + * @param {!proto.looprpc.L402Token=} opt_value + * @param {number=} opt_index + * @return {!proto.looprpc.L402Token} */ -proto.looprpc.SwapStatus.prototype.getIdBytes = function() { - return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 11, "")); +proto.looprpc.TokensResponse.prototype.addTokens = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.looprpc.L402Token, opt_index); }; /** - * optional bytes id_bytes = 11; - * This is a type-conversion wrapper around `getIdBytes()` - * @return {string} + * Clears the list making it empty but non-null. + * @return {!proto.looprpc.TokensResponse} returns this */ -proto.looprpc.SwapStatus.prototype.getIdBytes_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getIdBytes())); +proto.looprpc.TokensResponse.prototype.clearTokensList = function() { + return this.setTokensList([]); }; -/** - * optional bytes id_bytes = 11; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getIdBytes()` - * @return {!Uint8Array} - */ -proto.looprpc.SwapStatus.prototype.getIdBytes_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getIdBytes())); -}; + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * @param {!(string|Uint8Array)} value - * @return {!proto.looprpc.SwapStatus} returns this + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.looprpc.SwapStatus.prototype.setIdBytes = function(value) { - return jspb.Message.setProto3BytesField(this, 11, value); +proto.looprpc.FetchL402TokenRequest.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.FetchL402TokenRequest.toObject(opt_includeInstance, this); }; /** - * optional SwapType type = 3; - * @return {!proto.looprpc.SwapType} + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.looprpc.FetchL402TokenRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.SwapStatus.prototype.getType = function() { - return /** @type {!proto.looprpc.SwapType} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); -}; +proto.looprpc.FetchL402TokenRequest.toObject = function(includeInstance, msg) { + var f, obj = { + }; -/** - * @param {!proto.looprpc.SwapType} value - * @return {!proto.looprpc.SwapStatus} returns this - */ -proto.looprpc.SwapStatus.prototype.setType = function(value) { - return jspb.Message.setProto3EnumField(this, 3, value); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * optional SwapState state = 4; - * @return {!proto.looprpc.SwapState} + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.looprpc.FetchL402TokenRequest} */ -proto.looprpc.SwapStatus.prototype.getState = function() { - return /** @type {!proto.looprpc.SwapState} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +proto.looprpc.FetchL402TokenRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.looprpc.FetchL402TokenRequest; + return proto.looprpc.FetchL402TokenRequest.deserializeBinaryFromReader(msg, reader); }; /** - * @param {!proto.looprpc.SwapState} value - * @return {!proto.looprpc.SwapStatus} returns this + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.looprpc.FetchL402TokenRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.FetchL402TokenRequest} */ -proto.looprpc.SwapStatus.prototype.setState = function(value) { - return jspb.Message.setProto3EnumField(this, 4, value); +proto.looprpc.FetchL402TokenRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * optional FailureReason failure_reason = 14; - * @return {!proto.looprpc.FailureReason} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.looprpc.SwapStatus.prototype.getFailureReason = function() { - return /** @type {!proto.looprpc.FailureReason} */ (jspb.Message.getFieldWithDefault(this, 14, 0)); +proto.looprpc.FetchL402TokenRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.FetchL402TokenRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * @param {!proto.looprpc.FailureReason} value - * @return {!proto.looprpc.SwapStatus} returns this + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.FetchL402TokenRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.SwapStatus.prototype.setFailureReason = function(value) { - return jspb.Message.setProto3EnumField(this, 14, value); +proto.looprpc.FetchL402TokenRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; }; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * optional int64 initiation_time = 5; - * @return {string} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.looprpc.SwapStatus.prototype.getInitiationTime = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "0")); +proto.looprpc.FetchL402TokenResponse.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.FetchL402TokenResponse.toObject(opt_includeInstance, this); }; /** - * @param {string} value - * @return {!proto.looprpc.SwapStatus} returns this + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.looprpc.FetchL402TokenResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.SwapStatus.prototype.setInitiationTime = function(value) { - return jspb.Message.setProto3StringIntField(this, 5, value); +proto.looprpc.FetchL402TokenResponse.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * optional int64 last_update_time = 6; - * @return {string} + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.looprpc.FetchL402TokenResponse} */ -proto.looprpc.SwapStatus.prototype.getLastUpdateTime = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "0")); +proto.looprpc.FetchL402TokenResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.looprpc.FetchL402TokenResponse; + return proto.looprpc.FetchL402TokenResponse.deserializeBinaryFromReader(msg, reader); }; /** - * @param {string} value - * @return {!proto.looprpc.SwapStatus} returns this + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.looprpc.FetchL402TokenResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.FetchL402TokenResponse} */ -proto.looprpc.SwapStatus.prototype.setLastUpdateTime = function(value) { - return jspb.Message.setProto3StringIntField(this, 6, value); +proto.looprpc.FetchL402TokenResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * optional string htlc_address = 7; - * @return {string} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.looprpc.SwapStatus.prototype.getHtlcAddress = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); +proto.looprpc.FetchL402TokenResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.FetchL402TokenResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * @param {string} value - * @return {!proto.looprpc.SwapStatus} returns this + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.FetchL402TokenResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.SwapStatus.prototype.setHtlcAddress = function(value) { - return jspb.Message.setProto3StringField(this, 7, value); +proto.looprpc.FetchL402TokenResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; }; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * optional string htlc_address_p2wsh = 12; - * @return {string} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.looprpc.SwapStatus.prototype.getHtlcAddressP2wsh = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 12, "")); +proto.looprpc.L402Token.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.L402Token.toObject(opt_includeInstance, this); }; /** - * @param {string} value - * @return {!proto.looprpc.SwapStatus} returns this + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.looprpc.L402Token} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.SwapStatus.prototype.setHtlcAddressP2wsh = function(value) { - return jspb.Message.setProto3StringField(this, 12, value); +proto.looprpc.L402Token.toObject = function(includeInstance, msg) { + var f, obj = { + baseMacaroon: msg.getBaseMacaroon_asB64(), + paymentHash: msg.getPaymentHash_asB64(), + paymentPreimage: msg.getPaymentPreimage_asB64(), + amountPaidMsat: jspb.Message.getFieldWithDefault(msg, 4, "0"), + routingFeePaidMsat: jspb.Message.getFieldWithDefault(msg, 5, "0"), + timeCreated: jspb.Message.getFieldWithDefault(msg, 6, "0"), + expired: jspb.Message.getBooleanFieldWithDefault(msg, 7, false), + storageName: jspb.Message.getFieldWithDefault(msg, 8, ""), + id: jspb.Message.getFieldWithDefault(msg, 9, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * optional string htlc_address_p2tr = 18; - * @return {string} + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.looprpc.L402Token} */ -proto.looprpc.SwapStatus.prototype.getHtlcAddressP2tr = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 18, "")); +proto.looprpc.L402Token.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.looprpc.L402Token; + return proto.looprpc.L402Token.deserializeBinaryFromReader(msg, reader); }; /** - * @param {string} value - * @return {!proto.looprpc.SwapStatus} returns this + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.looprpc.L402Token} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.L402Token} */ -proto.looprpc.SwapStatus.prototype.setHtlcAddressP2tr = function(value) { - return jspb.Message.setProto3StringField(this, 18, value); +proto.looprpc.L402Token.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setBaseMacaroon(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setPaymentHash(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setPaymentPreimage(value); + break; + case 4: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setAmountPaidMsat(value); + break; + case 5: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setRoutingFeePaidMsat(value); + break; + case 6: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setTimeCreated(value); + break; + case 7: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setExpired(value); + break; + case 8: + var value = /** @type {string} */ (reader.readString()); + msg.setStorageName(value); + break; + case 9: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * optional int64 cost_server = 8; - * @return {string} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.looprpc.SwapStatus.prototype.getCostServer = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 8, "0")); +proto.looprpc.L402Token.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.L402Token.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * @param {string} value - * @return {!proto.looprpc.SwapStatus} returns this + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.L402Token} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.SwapStatus.prototype.setCostServer = function(value) { - return jspb.Message.setProto3StringIntField(this, 8, value); +proto.looprpc.L402Token.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBaseMacaroon_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getPaymentHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getPaymentPreimage_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } + f = message.getAmountPaidMsat(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 4, + f + ); + } + f = message.getRoutingFeePaidMsat(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 5, + f + ); + } + f = message.getTimeCreated(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 6, + f + ); + } + f = message.getExpired(); + if (f) { + writer.writeBool( + 7, + f + ); + } + f = message.getStorageName(); + if (f.length > 0) { + writer.writeString( + 8, + f + ); + } + f = message.getId(); + if (f.length > 0) { + writer.writeString( + 9, + f + ); + } }; /** - * optional int64 cost_onchain = 9; - * @return {string} + * optional bytes base_macaroon = 1; + * @return {!(string|Uint8Array)} */ -proto.looprpc.SwapStatus.prototype.getCostOnchain = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 9, "0")); +proto.looprpc.L402Token.prototype.getBaseMacaroon = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * @param {string} value - * @return {!proto.looprpc.SwapStatus} returns this + * optional bytes base_macaroon = 1; + * This is a type-conversion wrapper around `getBaseMacaroon()` + * @return {string} */ -proto.looprpc.SwapStatus.prototype.setCostOnchain = function(value) { - return jspb.Message.setProto3StringIntField(this, 9, value); +proto.looprpc.L402Token.prototype.getBaseMacaroon_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getBaseMacaroon())); }; /** - * optional int64 cost_offchain = 10; - * @return {string} + * optional bytes base_macaroon = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getBaseMacaroon()` + * @return {!Uint8Array} */ -proto.looprpc.SwapStatus.prototype.getCostOffchain = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 10, "0")); +proto.looprpc.L402Token.prototype.getBaseMacaroon_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getBaseMacaroon())); }; /** - * @param {string} value - * @return {!proto.looprpc.SwapStatus} returns this + * @param {!(string|Uint8Array)} value + * @return {!proto.looprpc.L402Token} returns this */ -proto.looprpc.SwapStatus.prototype.setCostOffchain = function(value) { - return jspb.Message.setProto3StringIntField(this, 10, value); +proto.looprpc.L402Token.prototype.setBaseMacaroon = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * optional bytes last_hop = 16; + * optional bytes payment_hash = 2; * @return {!(string|Uint8Array)} */ -proto.looprpc.SwapStatus.prototype.getLastHop = function() { - return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 16, "")); +proto.looprpc.L402Token.prototype.getPaymentHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** - * optional bytes last_hop = 16; - * This is a type-conversion wrapper around `getLastHop()` + * optional bytes payment_hash = 2; + * This is a type-conversion wrapper around `getPaymentHash()` * @return {string} */ -proto.looprpc.SwapStatus.prototype.getLastHop_asB64 = function() { +proto.looprpc.L402Token.prototype.getPaymentHash_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getLastHop())); + this.getPaymentHash())); }; /** - * optional bytes last_hop = 16; + * optional bytes payment_hash = 2; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getLastHop()` + * This is a type-conversion wrapper around `getPaymentHash()` * @return {!Uint8Array} */ -proto.looprpc.SwapStatus.prototype.getLastHop_asU8 = function() { +proto.looprpc.L402Token.prototype.getPaymentHash_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getLastHop())); + this.getPaymentHash())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.looprpc.SwapStatus} returns this + * @return {!proto.looprpc.L402Token} returns this */ -proto.looprpc.SwapStatus.prototype.setLastHop = function(value) { - return jspb.Message.setProto3BytesField(this, 16, value); +proto.looprpc.L402Token.prototype.setPaymentHash = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); }; /** - * repeated uint64 outgoing_chan_set = 17; - * @return {!Array} + * optional bytes payment_preimage = 3; + * @return {!(string|Uint8Array)} */ -proto.looprpc.SwapStatus.prototype.getOutgoingChanSetList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 17)); +proto.looprpc.L402Token.prototype.getPaymentPreimage = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** - * @param {!Array} value - * @return {!proto.looprpc.SwapStatus} returns this + * optional bytes payment_preimage = 3; + * This is a type-conversion wrapper around `getPaymentPreimage()` + * @return {string} */ -proto.looprpc.SwapStatus.prototype.setOutgoingChanSetList = function(value) { - return jspb.Message.setField(this, 17, value || []); +proto.looprpc.L402Token.prototype.getPaymentPreimage_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getPaymentPreimage())); }; /** - * @param {string} value - * @param {number=} opt_index - * @return {!proto.looprpc.SwapStatus} returns this + * optional bytes payment_preimage = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getPaymentPreimage()` + * @return {!Uint8Array} */ -proto.looprpc.SwapStatus.prototype.addOutgoingChanSet = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 17, value, opt_index); +proto.looprpc.L402Token.prototype.getPaymentPreimage_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getPaymentPreimage())); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.looprpc.SwapStatus} returns this + * @param {!(string|Uint8Array)} value + * @return {!proto.looprpc.L402Token} returns this */ -proto.looprpc.SwapStatus.prototype.clearOutgoingChanSetList = function() { - return this.setOutgoingChanSetList([]); +proto.looprpc.L402Token.prototype.setPaymentPreimage = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); }; /** - * optional string label = 15; + * optional int64 amount_paid_msat = 4; * @return {string} */ -proto.looprpc.SwapStatus.prototype.getLabel = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 15, "")); +proto.looprpc.L402Token.prototype.getAmountPaidMsat = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "0")); }; /** * @param {string} value - * @return {!proto.looprpc.SwapStatus} returns this + * @return {!proto.looprpc.L402Token} returns this */ -proto.looprpc.SwapStatus.prototype.setLabel = function(value) { - return jspb.Message.setProto3StringField(this, 15, value); +proto.looprpc.L402Token.prototype.setAmountPaidMsat = function(value) { + return jspb.Message.setProto3StringIntField(this, 4, value); }; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * optional int64 routing_fee_paid_msat = 5; + * @return {string} */ -proto.looprpc.ListSwapsRequest.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.ListSwapsRequest.toObject(opt_includeInstance, this); +proto.looprpc.L402Token.prototype.getRoutingFeePaidMsat = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "0")); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.looprpc.ListSwapsRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * @param {string} value + * @return {!proto.looprpc.L402Token} returns this */ -proto.looprpc.ListSwapsRequest.toObject = function(includeInstance, msg) { - var f, obj = { - listSwapFilter: (f = msg.getListSwapFilter()) && proto.looprpc.ListSwapsFilter.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; +proto.looprpc.L402Token.prototype.setRoutingFeePaidMsat = function(value) { + return jspb.Message.setProto3StringIntField(this, 5, value); }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.ListSwapsRequest} + * optional int64 time_created = 6; + * @return {string} */ -proto.looprpc.ListSwapsRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.ListSwapsRequest; - return proto.looprpc.ListSwapsRequest.deserializeBinaryFromReader(msg, reader); +proto.looprpc.L402Token.prototype.getTimeCreated = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "0")); }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.looprpc.ListSwapsRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.ListSwapsRequest} + * @param {string} value + * @return {!proto.looprpc.L402Token} returns this */ -proto.looprpc.ListSwapsRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.looprpc.ListSwapsFilter; - reader.readMessage(value,proto.looprpc.ListSwapsFilter.deserializeBinaryFromReader); - msg.setListSwapFilter(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; +proto.looprpc.L402Token.prototype.setTimeCreated = function(value) { + return jspb.Message.setProto3StringIntField(this, 6, value); }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * optional bool expired = 7; + * @return {boolean} */ -proto.looprpc.ListSwapsRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.ListSwapsRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.looprpc.L402Token.prototype.getExpired = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 7, false)); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.ListSwapsRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * @param {boolean} value + * @return {!proto.looprpc.L402Token} returns this */ -proto.looprpc.ListSwapsRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getListSwapFilter(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.looprpc.ListSwapsFilter.serializeBinaryToWriter - ); - } +proto.looprpc.L402Token.prototype.setExpired = function(value) { + return jspb.Message.setProto3BooleanField(this, 7, value); }; /** - * optional ListSwapsFilter list_swap_filter = 1; - * @return {?proto.looprpc.ListSwapsFilter} + * optional string storage_name = 8; + * @return {string} */ -proto.looprpc.ListSwapsRequest.prototype.getListSwapFilter = function() { - return /** @type{?proto.looprpc.ListSwapsFilter} */ ( - jspb.Message.getWrapperField(this, proto.looprpc.ListSwapsFilter, 1)); +proto.looprpc.L402Token.prototype.getStorageName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 8, "")); }; /** - * @param {?proto.looprpc.ListSwapsFilter|undefined} value - * @return {!proto.looprpc.ListSwapsRequest} returns this -*/ -proto.looprpc.ListSwapsRequest.prototype.setListSwapFilter = function(value) { - return jspb.Message.setWrapperField(this, 1, value); + * @param {string} value + * @return {!proto.looprpc.L402Token} returns this + */ +proto.looprpc.L402Token.prototype.setStorageName = function(value) { + return jspb.Message.setProto3StringField(this, 8, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.looprpc.ListSwapsRequest} returns this + * optional string id = 9; + * @return {string} */ -proto.looprpc.ListSwapsRequest.prototype.clearListSwapFilter = function() { - return this.setListSwapFilter(undefined); +proto.looprpc.L402Token.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 9, "")); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {string} value + * @return {!proto.looprpc.L402Token} returns this */ -proto.looprpc.ListSwapsRequest.prototype.hasListSwapFilter = function() { - return jspb.Message.getField(this, 1) != null; +proto.looprpc.L402Token.prototype.setId = function(value) { + return jspb.Message.setProto3StringField(this, 9, value); }; -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.looprpc.ListSwapsFilter.repeatedFields_ = [3]; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -3439,8 +7167,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.ListSwapsFilter.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.ListSwapsFilter.toObject(opt_includeInstance, this); +proto.looprpc.LoopStats.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.LoopStats.toObject(opt_includeInstance, this); }; @@ -3449,17 +7177,17 @@ proto.looprpc.ListSwapsFilter.prototype.toObject = function(opt_includeInstance) * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.ListSwapsFilter} msg The msg instance to transform. + * @param {!proto.looprpc.LoopStats} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.ListSwapsFilter.toObject = function(includeInstance, msg) { +proto.looprpc.LoopStats.toObject = function(includeInstance, msg) { var f, obj = { - swapType: jspb.Message.getFieldWithDefault(msg, 1, 0), - pendingOnly: jspb.Message.getBooleanFieldWithDefault(msg, 2, false), - outgoingChanSetList: (f = jspb.Message.getRepeatedField(msg, 3)) == null ? undefined : f, - label: jspb.Message.getFieldWithDefault(msg, 4, ""), - loopInLastHop: msg.getLoopInLastHop_asB64() + pendingCount: jspb.Message.getFieldWithDefault(msg, 1, "0"), + successCount: jspb.Message.getFieldWithDefault(msg, 2, "0"), + failCount: jspb.Message.getFieldWithDefault(msg, 3, "0"), + sumPendingAmt: jspb.Message.getFieldWithDefault(msg, 4, "0"), + sumSucceededAmt: jspb.Message.getFieldWithDefault(msg, 5, "0") }; if (includeInstance) { @@ -3473,23 +7201,23 @@ proto.looprpc.ListSwapsFilter.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.ListSwapsFilter} + * @return {!proto.looprpc.LoopStats} */ -proto.looprpc.ListSwapsFilter.deserializeBinary = function(bytes) { +proto.looprpc.LoopStats.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.ListSwapsFilter; - return proto.looprpc.ListSwapsFilter.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.LoopStats; + return proto.looprpc.LoopStats.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.ListSwapsFilter} msg The message object to deserialize into. + * @param {!proto.looprpc.LoopStats} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.ListSwapsFilter} + * @return {!proto.looprpc.LoopStats} */ -proto.looprpc.ListSwapsFilter.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.LoopStats.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -3497,26 +7225,24 @@ proto.looprpc.ListSwapsFilter.deserializeBinaryFromReader = function(msg, reader var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!proto.looprpc.ListSwapsFilter.SwapTypeFilter} */ (reader.readEnum()); - msg.setSwapType(value); + var value = /** @type {string} */ (reader.readUint64String()); + msg.setPendingCount(value); break; case 2: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setPendingOnly(value); + var value = /** @type {string} */ (reader.readUint64String()); + msg.setSuccessCount(value); break; case 3: - var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedUint64String() : [reader.readUint64String()]); - for (var i = 0; i < values.length; i++) { - msg.addOutgoingChanSet(values[i]); - } + var value = /** @type {string} */ (reader.readUint64String()); + msg.setFailCount(value); break; case 4: - var value = /** @type {string} */ (reader.readString()); - msg.setLabel(value); + var value = /** @type {string} */ (reader.readInt64String()); + msg.setSumPendingAmt(value); break; - case 5: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setLoopInLastHop(value); + case 5: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setSumSucceededAmt(value); break; default: reader.skipField(); @@ -3531,9 +7257,9 @@ proto.looprpc.ListSwapsFilter.deserializeBinaryFromReader = function(msg, reader * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.ListSwapsFilter.prototype.serializeBinary = function() { +proto.looprpc.LoopStats.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.ListSwapsFilter.serializeBinaryToWriter(this, writer); + proto.looprpc.LoopStats.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -3541,43 +7267,43 @@ proto.looprpc.ListSwapsFilter.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.ListSwapsFilter} message + * @param {!proto.looprpc.LoopStats} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.ListSwapsFilter.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.LoopStats.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getSwapType(); - if (f !== 0.0) { - writer.writeEnum( + f = message.getPendingCount(); + if (parseInt(f, 10) !== 0) { + writer.writeUint64String( 1, f ); } - f = message.getPendingOnly(); - if (f) { - writer.writeBool( + f = message.getSuccessCount(); + if (parseInt(f, 10) !== 0) { + writer.writeUint64String( 2, f ); } - f = message.getOutgoingChanSetList(); - if (f.length > 0) { - writer.writePackedUint64String( + f = message.getFailCount(); + if (parseInt(f, 10) !== 0) { + writer.writeUint64String( 3, f ); } - f = message.getLabel(); - if (f.length > 0) { - writer.writeString( + f = message.getSumPendingAmt(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( 4, f ); } - f = message.getLoopInLastHop_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getSumSucceededAmt(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( 5, f ); @@ -3586,155 +7312,96 @@ proto.looprpc.ListSwapsFilter.serializeBinaryToWriter = function(message, writer /** - * @enum {number} - */ -proto.looprpc.ListSwapsFilter.SwapTypeFilter = { - ANY: 0, - LOOP_OUT: 1, - LOOP_IN: 2 -}; - -/** - * optional SwapTypeFilter swap_type = 1; - * @return {!proto.looprpc.ListSwapsFilter.SwapTypeFilter} - */ -proto.looprpc.ListSwapsFilter.prototype.getSwapType = function() { - return /** @type {!proto.looprpc.ListSwapsFilter.SwapTypeFilter} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {!proto.looprpc.ListSwapsFilter.SwapTypeFilter} value - * @return {!proto.looprpc.ListSwapsFilter} returns this + * optional uint64 pending_count = 1; + * @return {string} */ -proto.looprpc.ListSwapsFilter.prototype.setSwapType = function(value) { - return jspb.Message.setProto3EnumField(this, 1, value); +proto.looprpc.LoopStats.prototype.getPendingCount = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0")); }; /** - * optional bool pending_only = 2; - * @return {boolean} + * @param {string} value + * @return {!proto.looprpc.LoopStats} returns this */ -proto.looprpc.ListSwapsFilter.prototype.getPendingOnly = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +proto.looprpc.LoopStats.prototype.setPendingCount = function(value) { + return jspb.Message.setProto3StringIntField(this, 1, value); }; /** - * @param {boolean} value - * @return {!proto.looprpc.ListSwapsFilter} returns this + * optional uint64 success_count = 2; + * @return {string} */ -proto.looprpc.ListSwapsFilter.prototype.setPendingOnly = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); +proto.looprpc.LoopStats.prototype.getSuccessCount = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "0")); }; /** - * repeated uint64 outgoing_chan_set = 3; - * @return {!Array} + * @param {string} value + * @return {!proto.looprpc.LoopStats} returns this */ -proto.looprpc.ListSwapsFilter.prototype.getOutgoingChanSetList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 3)); +proto.looprpc.LoopStats.prototype.setSuccessCount = function(value) { + return jspb.Message.setProto3StringIntField(this, 2, value); }; /** - * @param {!Array} value - * @return {!proto.looprpc.ListSwapsFilter} returns this + * optional uint64 fail_count = 3; + * @return {string} */ -proto.looprpc.ListSwapsFilter.prototype.setOutgoingChanSetList = function(value) { - return jspb.Message.setField(this, 3, value || []); +proto.looprpc.LoopStats.prototype.getFailCount = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "0")); }; /** * @param {string} value - * @param {number=} opt_index - * @return {!proto.looprpc.ListSwapsFilter} returns this - */ -proto.looprpc.ListSwapsFilter.prototype.addOutgoingChanSet = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 3, value, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.looprpc.ListSwapsFilter} returns this + * @return {!proto.looprpc.LoopStats} returns this */ -proto.looprpc.ListSwapsFilter.prototype.clearOutgoingChanSetList = function() { - return this.setOutgoingChanSetList([]); +proto.looprpc.LoopStats.prototype.setFailCount = function(value) { + return jspb.Message.setProto3StringIntField(this, 3, value); }; /** - * optional string label = 4; + * optional int64 sum_pending_amt = 4; * @return {string} */ -proto.looprpc.ListSwapsFilter.prototype.getLabel = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +proto.looprpc.LoopStats.prototype.getSumPendingAmt = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "0")); }; /** * @param {string} value - * @return {!proto.looprpc.ListSwapsFilter} returns this - */ -proto.looprpc.ListSwapsFilter.prototype.setLabel = function(value) { - return jspb.Message.setProto3StringField(this, 4, value); -}; - - -/** - * optional bytes loop_in_last_hop = 5; - * @return {!(string|Uint8Array)} + * @return {!proto.looprpc.LoopStats} returns this */ -proto.looprpc.ListSwapsFilter.prototype.getLoopInLastHop = function() { - return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +proto.looprpc.LoopStats.prototype.setSumPendingAmt = function(value) { + return jspb.Message.setProto3StringIntField(this, 4, value); }; /** - * optional bytes loop_in_last_hop = 5; - * This is a type-conversion wrapper around `getLoopInLastHop()` + * optional int64 sum_succeeded_amt = 5; * @return {string} */ -proto.looprpc.ListSwapsFilter.prototype.getLoopInLastHop_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getLoopInLastHop())); -}; - - -/** - * optional bytes loop_in_last_hop = 5; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getLoopInLastHop()` - * @return {!Uint8Array} - */ -proto.looprpc.ListSwapsFilter.prototype.getLoopInLastHop_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getLoopInLastHop())); +proto.looprpc.LoopStats.prototype.getSumSucceededAmt = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "0")); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.looprpc.ListSwapsFilter} returns this + * @param {string} value + * @return {!proto.looprpc.LoopStats} returns this */ -proto.looprpc.ListSwapsFilter.prototype.setLoopInLastHop = function(value) { - return jspb.Message.setProto3BytesField(this, 5, value); +proto.looprpc.LoopStats.prototype.setSumSucceededAmt = function(value) { + return jspb.Message.setProto3StringIntField(this, 5, value); }; -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.looprpc.ListSwapsResponse.repeatedFields_ = [1]; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -3750,8 +7417,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.ListSwapsResponse.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.ListSwapsResponse.toObject(opt_includeInstance, this); +proto.looprpc.GetInfoRequest.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.GetInfoRequest.toObject(opt_includeInstance, this); }; @@ -3760,14 +7427,13 @@ proto.looprpc.ListSwapsResponse.prototype.toObject = function(opt_includeInstanc * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.ListSwapsResponse} msg The msg instance to transform. + * @param {!proto.looprpc.GetInfoRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.ListSwapsResponse.toObject = function(includeInstance, msg) { +proto.looprpc.GetInfoRequest.toObject = function(includeInstance, msg) { var f, obj = { - swapsList: jspb.Message.toObjectList(msg.getSwapsList(), - proto.looprpc.SwapStatus.toObject, includeInstance) + }; if (includeInstance) { @@ -3781,34 +7447,29 @@ proto.looprpc.ListSwapsResponse.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.ListSwapsResponse} + * @return {!proto.looprpc.GetInfoRequest} */ -proto.looprpc.ListSwapsResponse.deserializeBinary = function(bytes) { +proto.looprpc.GetInfoRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.ListSwapsResponse; - return proto.looprpc.ListSwapsResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.GetInfoRequest; + return proto.looprpc.GetInfoRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.ListSwapsResponse} msg The message object to deserialize into. + * @param {!proto.looprpc.GetInfoRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.ListSwapsResponse} + * @return {!proto.looprpc.GetInfoRequest} */ -proto.looprpc.ListSwapsResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.GetInfoRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = new proto.looprpc.SwapStatus; - reader.readMessage(value,proto.looprpc.SwapStatus.deserializeBinaryFromReader); - msg.addSwaps(value); - break; default: reader.skipField(); break; @@ -3818,72 +7479,26 @@ proto.looprpc.ListSwapsResponse.deserializeBinaryFromReader = function(msg, read }; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.looprpc.ListSwapsResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.ListSwapsResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.ListSwapsResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.ListSwapsResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getSwapsList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 1, - f, - proto.looprpc.SwapStatus.serializeBinaryToWriter - ); - } -}; - - -/** - * repeated SwapStatus swaps = 1; - * @return {!Array} - */ -proto.looprpc.ListSwapsResponse.prototype.getSwapsList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.looprpc.SwapStatus, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.looprpc.ListSwapsResponse} returns this -*/ -proto.looprpc.ListSwapsResponse.prototype.setSwapsList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - - -/** - * @param {!proto.looprpc.SwapStatus=} opt_value - * @param {number=} opt_index - * @return {!proto.looprpc.SwapStatus} +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.looprpc.ListSwapsResponse.prototype.addSwaps = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.looprpc.SwapStatus, opt_index); +proto.looprpc.GetInfoRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.GetInfoRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.looprpc.ListSwapsResponse} returns this + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.GetInfoRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.ListSwapsResponse.prototype.clearSwapsList = function() { - return this.setSwapsList([]); +proto.looprpc.GetInfoRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; }; @@ -3903,8 +7518,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.SwapInfoRequest.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.SwapInfoRequest.toObject(opt_includeInstance, this); +proto.looprpc.GetInfoResponse.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.GetInfoResponse.toObject(opt_includeInstance, this); }; @@ -3913,13 +7528,20 @@ proto.looprpc.SwapInfoRequest.prototype.toObject = function(opt_includeInstance) * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.SwapInfoRequest} msg The msg instance to transform. + * @param {!proto.looprpc.GetInfoResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.SwapInfoRequest.toObject = function(includeInstance, msg) { +proto.looprpc.GetInfoResponse.toObject = function(includeInstance, msg) { var f, obj = { - id: msg.getId_asB64() + version: jspb.Message.getFieldWithDefault(msg, 1, ""), + network: jspb.Message.getFieldWithDefault(msg, 2, ""), + rpcListen: jspb.Message.getFieldWithDefault(msg, 3, ""), + restListen: jspb.Message.getFieldWithDefault(msg, 4, ""), + macaroonPath: jspb.Message.getFieldWithDefault(msg, 5, ""), + tlsCertPath: jspb.Message.getFieldWithDefault(msg, 6, ""), + loopOutStats: (f = msg.getLoopOutStats()) && proto.looprpc.LoopStats.toObject(includeInstance, f), + loopInStats: (f = msg.getLoopInStats()) && proto.looprpc.LoopStats.toObject(includeInstance, f) }; if (includeInstance) { @@ -3933,23 +7555,23 @@ proto.looprpc.SwapInfoRequest.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.SwapInfoRequest} + * @return {!proto.looprpc.GetInfoResponse} */ -proto.looprpc.SwapInfoRequest.deserializeBinary = function(bytes) { +proto.looprpc.GetInfoResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.SwapInfoRequest; - return proto.looprpc.SwapInfoRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.GetInfoResponse; + return proto.looprpc.GetInfoResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.SwapInfoRequest} msg The message object to deserialize into. + * @param {!proto.looprpc.GetInfoResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.SwapInfoRequest} + * @return {!proto.looprpc.GetInfoResponse} */ -proto.looprpc.SwapInfoRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.GetInfoResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -3957,8 +7579,38 @@ proto.looprpc.SwapInfoRequest.deserializeBinaryFromReader = function(msg, reader var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setId(value); + var value = /** @type {string} */ (reader.readString()); + msg.setVersion(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setNetwork(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setRpcListen(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setRestListen(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.setMacaroonPath(value); + break; + case 6: + var value = /** @type {string} */ (reader.readString()); + msg.setTlsCertPath(value); + break; + case 7: + var value = new proto.looprpc.LoopStats; + reader.readMessage(value,proto.looprpc.LoopStats.deserializeBinaryFromReader); + msg.setLoopOutStats(value); + break; + case 8: + var value = new proto.looprpc.LoopStats; + reader.readMessage(value,proto.looprpc.LoopStats.deserializeBinaryFromReader); + msg.setLoopInStats(value); break; default: reader.skipField(); @@ -3973,9 +7625,9 @@ proto.looprpc.SwapInfoRequest.deserializeBinaryFromReader = function(msg, reader * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.SwapInfoRequest.prototype.serializeBinary = function() { +proto.looprpc.GetInfoResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.SwapInfoRequest.serializeBinaryToWriter(this, writer); + proto.looprpc.GetInfoResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -3983,162 +7635,252 @@ proto.looprpc.SwapInfoRequest.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.SwapInfoRequest} message + * @param {!proto.looprpc.GetInfoResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.SwapInfoRequest.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.GetInfoResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getId_asU8(); + f = message.getVersion(); if (f.length > 0) { - writer.writeBytes( + writer.writeString( 1, f ); } + f = message.getNetwork(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getRpcListen(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getRestListen(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } + f = message.getMacaroonPath(); + if (f.length > 0) { + writer.writeString( + 5, + f + ); + } + f = message.getTlsCertPath(); + if (f.length > 0) { + writer.writeString( + 6, + f + ); + } + f = message.getLoopOutStats(); + if (f != null) { + writer.writeMessage( + 7, + f, + proto.looprpc.LoopStats.serializeBinaryToWriter + ); + } + f = message.getLoopInStats(); + if (f != null) { + writer.writeMessage( + 8, + f, + proto.looprpc.LoopStats.serializeBinaryToWriter + ); + } }; /** - * optional bytes id = 1; - * @return {!(string|Uint8Array)} + * optional string version = 1; + * @return {string} */ -proto.looprpc.SwapInfoRequest.prototype.getId = function() { - return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.looprpc.GetInfoResponse.prototype.getVersion = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional bytes id = 1; - * This is a type-conversion wrapper around `getId()` + * @param {string} value + * @return {!proto.looprpc.GetInfoResponse} returns this + */ +proto.looprpc.GetInfoResponse.prototype.setVersion = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string network = 2; * @return {string} */ -proto.looprpc.SwapInfoRequest.prototype.getId_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getId())); +proto.looprpc.GetInfoResponse.prototype.getNetwork = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** - * optional bytes id = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getId()` - * @return {!Uint8Array} + * @param {string} value + * @return {!proto.looprpc.GetInfoResponse} returns this */ -proto.looprpc.SwapInfoRequest.prototype.getId_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getId())); +proto.looprpc.GetInfoResponse.prototype.setNetwork = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string rpc_listen = 3; + * @return {string} + */ +proto.looprpc.GetInfoResponse.prototype.getRpcListen = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.GetInfoResponse} returns this + */ +proto.looprpc.GetInfoResponse.prototype.setRpcListen = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * optional string rest_listen = 4; + * @return {string} + */ +proto.looprpc.GetInfoResponse.prototype.getRestListen = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.GetInfoResponse} returns this + */ +proto.looprpc.GetInfoResponse.prototype.setRestListen = function(value) { + return jspb.Message.setProto3StringField(this, 4, value); +}; + + +/** + * optional string macaroon_path = 5; + * @return {string} + */ +proto.looprpc.GetInfoResponse.prototype.getMacaroonPath = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.GetInfoResponse} returns this + */ +proto.looprpc.GetInfoResponse.prototype.setMacaroonPath = function(value) { + return jspb.Message.setProto3StringField(this, 5, value); +}; + + +/** + * optional string tls_cert_path = 6; + * @return {string} + */ +proto.looprpc.GetInfoResponse.prototype.getTlsCertPath = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.GetInfoResponse} returns this + */ +proto.looprpc.GetInfoResponse.prototype.setTlsCertPath = function(value) { + return jspb.Message.setProto3StringField(this, 6, value); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.looprpc.SwapInfoRequest} returns this + * optional LoopStats loop_out_stats = 7; + * @return {?proto.looprpc.LoopStats} */ -proto.looprpc.SwapInfoRequest.prototype.setId = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.looprpc.GetInfoResponse.prototype.getLoopOutStats = function() { + return /** @type{?proto.looprpc.LoopStats} */ ( + jspb.Message.getWrapperField(this, proto.looprpc.LoopStats, 7)); }; +/** + * @param {?proto.looprpc.LoopStats|undefined} value + * @return {!proto.looprpc.GetInfoResponse} returns this +*/ +proto.looprpc.GetInfoResponse.prototype.setLoopOutStats = function(value) { + return jspb.Message.setWrapperField(this, 7, value); +}; - -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * Clears the message field making it undefined. + * @return {!proto.looprpc.GetInfoResponse} returns this */ -proto.looprpc.TermsRequest.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.TermsRequest.toObject(opt_includeInstance, this); +proto.looprpc.GetInfoResponse.prototype.clearLoopOutStats = function() { + return this.setLoopOutStats(undefined); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.looprpc.TermsRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.looprpc.TermsRequest.toObject = function(includeInstance, msg) { - var f, obj = { - - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; +proto.looprpc.GetInfoResponse.prototype.hasLoopOutStats = function() { + return jspb.Message.getField(this, 7) != null; }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.TermsRequest} + * optional LoopStats loop_in_stats = 8; + * @return {?proto.looprpc.LoopStats} */ -proto.looprpc.TermsRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.TermsRequest; - return proto.looprpc.TermsRequest.deserializeBinaryFromReader(msg, reader); +proto.looprpc.GetInfoResponse.prototype.getLoopInStats = function() { + return /** @type{?proto.looprpc.LoopStats} */ ( + jspb.Message.getWrapperField(this, proto.looprpc.LoopStats, 8)); }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.looprpc.TermsRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.TermsRequest} - */ -proto.looprpc.TermsRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - default: - reader.skipField(); - break; - } - } - return msg; + * @param {?proto.looprpc.LoopStats|undefined} value + * @return {!proto.looprpc.GetInfoResponse} returns this +*/ +proto.looprpc.GetInfoResponse.prototype.setLoopInStats = function(value) { + return jspb.Message.setWrapperField(this, 8, value); }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * Clears the message field making it undefined. + * @return {!proto.looprpc.GetInfoResponse} returns this */ -proto.looprpc.TermsRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.TermsRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.looprpc.GetInfoResponse.prototype.clearLoopInStats = function() { + return this.setLoopInStats(undefined); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.TermsRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * Returns whether this field is set. + * @return {boolean} */ -proto.looprpc.TermsRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; +proto.looprpc.GetInfoResponse.prototype.hasLoopInStats = function() { + return jspb.Message.getField(this, 8) != null; }; @@ -4158,8 +7900,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.InTermsResponse.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.InTermsResponse.toObject(opt_includeInstance, this); +proto.looprpc.GetLiquidityParamsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.GetLiquidityParamsRequest.toObject(opt_includeInstance, this); }; @@ -4168,14 +7910,13 @@ proto.looprpc.InTermsResponse.prototype.toObject = function(opt_includeInstance) * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.InTermsResponse} msg The msg instance to transform. + * @param {!proto.looprpc.GetLiquidityParamsRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.InTermsResponse.toObject = function(includeInstance, msg) { +proto.looprpc.GetLiquidityParamsRequest.toObject = function(includeInstance, msg) { var f, obj = { - minSwapAmount: jspb.Message.getFieldWithDefault(msg, 5, "0"), - maxSwapAmount: jspb.Message.getFieldWithDefault(msg, 6, "0") + }; if (includeInstance) { @@ -4189,37 +7930,29 @@ proto.looprpc.InTermsResponse.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.InTermsResponse} + * @return {!proto.looprpc.GetLiquidityParamsRequest} */ -proto.looprpc.InTermsResponse.deserializeBinary = function(bytes) { +proto.looprpc.GetLiquidityParamsRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.InTermsResponse; - return proto.looprpc.InTermsResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.GetLiquidityParamsRequest; + return proto.looprpc.GetLiquidityParamsRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.InTermsResponse} msg The message object to deserialize into. + * @param {!proto.looprpc.GetLiquidityParamsRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.InTermsResponse} + * @return {!proto.looprpc.GetLiquidityParamsRequest} */ -proto.looprpc.InTermsResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.GetLiquidityParamsRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 5: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setMinSwapAmount(value); - break; - case 6: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setMaxSwapAmount(value); - break; default: reader.skipField(); break; @@ -4233,9 +7966,9 @@ proto.looprpc.InTermsResponse.deserializeBinaryFromReader = function(msg, reader * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.InTermsResponse.prototype.serializeBinary = function() { +proto.looprpc.GetLiquidityParamsRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.InTermsResponse.serializeBinaryToWriter(this, writer); + proto.looprpc.GetLiquidityParamsRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -4243,65 +7976,22 @@ proto.looprpc.InTermsResponse.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.InTermsResponse} message + * @param {!proto.looprpc.GetLiquidityParamsRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.InTermsResponse.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.GetLiquidityParamsRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getMinSwapAmount(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 5, - f - ); - } - f = message.getMaxSwapAmount(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 6, - f - ); - } -}; - - -/** - * optional int64 min_swap_amount = 5; - * @return {string} - */ -proto.looprpc.InTermsResponse.prototype.getMinSwapAmount = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "0")); -}; - - -/** - * @param {string} value - * @return {!proto.looprpc.InTermsResponse} returns this - */ -proto.looprpc.InTermsResponse.prototype.setMinSwapAmount = function(value) { - return jspb.Message.setProto3StringIntField(this, 5, value); }; -/** - * optional int64 max_swap_amount = 6; - * @return {string} - */ -proto.looprpc.InTermsResponse.prototype.getMaxSwapAmount = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "0")); -}; - /** - * @param {string} value - * @return {!proto.looprpc.InTermsResponse} returns this + * List of repeated fields within this message type. + * @private {!Array} + * @const */ -proto.looprpc.InTermsResponse.prototype.setMaxSwapAmount = function(value) { - return jspb.Message.setProto3StringIntField(this, 6, value); -}; - - +proto.looprpc.LiquidityParameters.repeatedFields_ = [1]; @@ -4318,8 +8008,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.OutTermsResponse.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.OutTermsResponse.toObject(opt_includeInstance, this); +proto.looprpc.LiquidityParameters.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.LiquidityParameters.toObject(opt_includeInstance, this); }; @@ -4328,16 +8018,37 @@ proto.looprpc.OutTermsResponse.prototype.toObject = function(opt_includeInstance * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.OutTermsResponse} msg The msg instance to transform. + * @param {!proto.looprpc.LiquidityParameters} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.OutTermsResponse.toObject = function(includeInstance, msg) { +proto.looprpc.LiquidityParameters.toObject = function(includeInstance, msg) { var f, obj = { - minSwapAmount: jspb.Message.getFieldWithDefault(msg, 5, "0"), - maxSwapAmount: jspb.Message.getFieldWithDefault(msg, 6, "0"), - minCltvDelta: jspb.Message.getFieldWithDefault(msg, 8, 0), - maxCltvDelta: jspb.Message.getFieldWithDefault(msg, 9, 0) + rulesList: jspb.Message.toObjectList(msg.getRulesList(), + proto.looprpc.LiquidityRule.toObject, includeInstance), + feePpm: jspb.Message.getFieldWithDefault(msg, 16, "0"), + sweepFeeRateSatPerVbyte: jspb.Message.getFieldWithDefault(msg, 2, "0"), + maxSwapFeePpm: jspb.Message.getFieldWithDefault(msg, 3, "0"), + maxRoutingFeePpm: jspb.Message.getFieldWithDefault(msg, 4, "0"), + maxPrepayRoutingFeePpm: jspb.Message.getFieldWithDefault(msg, 5, "0"), + maxPrepaySat: jspb.Message.getFieldWithDefault(msg, 6, "0"), + maxMinerFeeSat: jspb.Message.getFieldWithDefault(msg, 7, "0"), + sweepConfTarget: jspb.Message.getFieldWithDefault(msg, 8, 0), + failureBackoffSec: jspb.Message.getFieldWithDefault(msg, 9, "0"), + autoloop: jspb.Message.getBooleanFieldWithDefault(msg, 10, false), + autoloopBudgetSat: jspb.Message.getFieldWithDefault(msg, 11, "0"), + autoloopBudgetStartSec: jspb.Message.getFieldWithDefault(msg, 12, "0"), + autoMaxInFlight: jspb.Message.getFieldWithDefault(msg, 13, "0"), + minSwapAmount: jspb.Message.getFieldWithDefault(msg, 14, "0"), + maxSwapAmount: jspb.Message.getFieldWithDefault(msg, 15, "0"), + htlcConfTarget: jspb.Message.getFieldWithDefault(msg, 17, 0), + autoloopDestAddress: jspb.Message.getFieldWithDefault(msg, 18, ""), + autoloopBudgetRefreshPeriodSec: jspb.Message.getFieldWithDefault(msg, 19, "0"), + autoloopBudgetLastRefresh: jspb.Message.getFieldWithDefault(msg, 20, "0"), + easyAutoloop: jspb.Message.getBooleanFieldWithDefault(msg, 21, false), + easyAutoloopLocalTargetSat: jspb.Message.getFieldWithDefault(msg, 22, "0"), + account: jspb.Message.getFieldWithDefault(msg, 23, ""), + accountAddrType: jspb.Message.getFieldWithDefault(msg, 24, 0) }; if (includeInstance) { @@ -4351,44 +8062,125 @@ proto.looprpc.OutTermsResponse.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.OutTermsResponse} + * @return {!proto.looprpc.LiquidityParameters} */ -proto.looprpc.OutTermsResponse.deserializeBinary = function(bytes) { +proto.looprpc.LiquidityParameters.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.OutTermsResponse; - return proto.looprpc.OutTermsResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.LiquidityParameters; + return proto.looprpc.LiquidityParameters.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.OutTermsResponse} msg The message object to deserialize into. + * @param {!proto.looprpc.LiquidityParameters} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.OutTermsResponse} + * @return {!proto.looprpc.LiquidityParameters} */ -proto.looprpc.OutTermsResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.LiquidityParameters.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { + case 1: + var value = new proto.looprpc.LiquidityRule; + reader.readMessage(value,proto.looprpc.LiquidityRule.deserializeBinaryFromReader); + msg.addRules(value); + break; + case 16: + var value = /** @type {string} */ (reader.readUint64String()); + msg.setFeePpm(value); + break; + case 2: + var value = /** @type {string} */ (reader.readUint64String()); + msg.setSweepFeeRateSatPerVbyte(value); + break; + case 3: + var value = /** @type {string} */ (reader.readUint64String()); + msg.setMaxSwapFeePpm(value); + break; + case 4: + var value = /** @type {string} */ (reader.readUint64String()); + msg.setMaxRoutingFeePpm(value); + break; case 5: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setMinSwapAmount(value); + var value = /** @type {string} */ (reader.readUint64String()); + msg.setMaxPrepayRoutingFeePpm(value); break; case 6: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setMaxSwapAmount(value); + var value = /** @type {string} */ (reader.readUint64String()); + msg.setMaxPrepaySat(value); + break; + case 7: + var value = /** @type {string} */ (reader.readUint64String()); + msg.setMaxMinerFeeSat(value); break; case 8: var value = /** @type {number} */ (reader.readInt32()); - msg.setMinCltvDelta(value); + msg.setSweepConfTarget(value); break; case 9: + var value = /** @type {string} */ (reader.readUint64String()); + msg.setFailureBackoffSec(value); + break; + case 10: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setAutoloop(value); + break; + case 11: + var value = /** @type {string} */ (reader.readUint64String()); + msg.setAutoloopBudgetSat(value); + break; + case 12: + var value = /** @type {string} */ (reader.readUint64String()); + msg.setAutoloopBudgetStartSec(value); + break; + case 13: + var value = /** @type {string} */ (reader.readUint64String()); + msg.setAutoMaxInFlight(value); + break; + case 14: + var value = /** @type {string} */ (reader.readUint64String()); + msg.setMinSwapAmount(value); + break; + case 15: + var value = /** @type {string} */ (reader.readUint64String()); + msg.setMaxSwapAmount(value); + break; + case 17: var value = /** @type {number} */ (reader.readInt32()); - msg.setMaxCltvDelta(value); + msg.setHtlcConfTarget(value); + break; + case 18: + var value = /** @type {string} */ (reader.readString()); + msg.setAutoloopDestAddress(value); + break; + case 19: + var value = /** @type {string} */ (reader.readUint64String()); + msg.setAutoloopBudgetRefreshPeriodSec(value); + break; + case 20: + var value = /** @type {string} */ (reader.readUint64String()); + msg.setAutoloopBudgetLastRefresh(value); + break; + case 21: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setEasyAutoloop(value); + break; + case 22: + var value = /** @type {string} */ (reader.readUint64String()); + msg.setEasyAutoloopLocalTargetSat(value); + break; + case 23: + var value = /** @type {string} */ (reader.readString()); + msg.setAccount(value); + break; + case 24: + var value = /** @type {!proto.looprpc.AddressType} */ (reader.readEnum()); + msg.setAccountAddrType(value); break; default: reader.skipField(); @@ -4403,9 +8195,9 @@ proto.looprpc.OutTermsResponse.deserializeBinaryFromReader = function(msg, reade * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.OutTermsResponse.prototype.serializeBinary = function() { +proto.looprpc.LiquidityParameters.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.OutTermsResponse.serializeBinaryToWriter(this, writer); + proto.looprpc.LiquidityParameters.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -4413,37 +8205,178 @@ proto.looprpc.OutTermsResponse.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.OutTermsResponse} message + * @param {!proto.looprpc.LiquidityParameters} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.OutTermsResponse.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.LiquidityParameters.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getMinSwapAmount(); + f = message.getRulesList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.looprpc.LiquidityRule.serializeBinaryToWriter + ); + } + f = message.getFeePpm(); if (parseInt(f, 10) !== 0) { - writer.writeInt64String( + writer.writeUint64String( + 16, + f + ); + } + f = message.getSweepFeeRateSatPerVbyte(); + if (parseInt(f, 10) !== 0) { + writer.writeUint64String( + 2, + f + ); + } + f = message.getMaxSwapFeePpm(); + if (parseInt(f, 10) !== 0) { + writer.writeUint64String( + 3, + f + ); + } + f = message.getMaxRoutingFeePpm(); + if (parseInt(f, 10) !== 0) { + writer.writeUint64String( + 4, + f + ); + } + f = message.getMaxPrepayRoutingFeePpm(); + if (parseInt(f, 10) !== 0) { + writer.writeUint64String( 5, f ); } - f = message.getMaxSwapAmount(); + f = message.getMaxPrepaySat(); if (parseInt(f, 10) !== 0) { - writer.writeInt64String( + writer.writeUint64String( 6, f ); } - f = message.getMinCltvDelta(); + f = message.getMaxMinerFeeSat(); + if (parseInt(f, 10) !== 0) { + writer.writeUint64String( + 7, + f + ); + } + f = message.getSweepConfTarget(); if (f !== 0) { writer.writeInt32( 8, f ); } - f = message.getMaxCltvDelta(); + f = message.getFailureBackoffSec(); + if (parseInt(f, 10) !== 0) { + writer.writeUint64String( + 9, + f + ); + } + f = message.getAutoloop(); + if (f) { + writer.writeBool( + 10, + f + ); + } + f = message.getAutoloopBudgetSat(); + if (parseInt(f, 10) !== 0) { + writer.writeUint64String( + 11, + f + ); + } + f = message.getAutoloopBudgetStartSec(); + if (parseInt(f, 10) !== 0) { + writer.writeUint64String( + 12, + f + ); + } + f = message.getAutoMaxInFlight(); + if (parseInt(f, 10) !== 0) { + writer.writeUint64String( + 13, + f + ); + } + f = message.getMinSwapAmount(); + if (parseInt(f, 10) !== 0) { + writer.writeUint64String( + 14, + f + ); + } + f = message.getMaxSwapAmount(); + if (parseInt(f, 10) !== 0) { + writer.writeUint64String( + 15, + f + ); + } + f = message.getHtlcConfTarget(); if (f !== 0) { writer.writeInt32( - 9, + 17, + f + ); + } + f = message.getAutoloopDestAddress(); + if (f.length > 0) { + writer.writeString( + 18, + f + ); + } + f = message.getAutoloopBudgetRefreshPeriodSec(); + if (parseInt(f, 10) !== 0) { + writer.writeUint64String( + 19, + f + ); + } + f = message.getAutoloopBudgetLastRefresh(); + if (parseInt(f, 10) !== 0) { + writer.writeUint64String( + 20, + f + ); + } + f = message.getEasyAutoloop(); + if (f) { + writer.writeBool( + 21, + f + ); + } + f = message.getEasyAutoloopLocalTargetSat(); + if (parseInt(f, 10) !== 0) { + writer.writeUint64String( + 22, + f + ); + } + f = message.getAccount(); + if (f.length > 0) { + writer.writeString( + 23, + f + ); + } + f = message.getAccountAddrType(); + if (f !== 0.0) { + writer.writeEnum( + 24, f ); } @@ -4451,658 +8384,454 @@ proto.looprpc.OutTermsResponse.serializeBinaryToWriter = function(message, write /** - * optional int64 min_swap_amount = 5; - * @return {string} - */ -proto.looprpc.OutTermsResponse.prototype.getMinSwapAmount = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "0")); -}; - - -/** - * @param {string} value - * @return {!proto.looprpc.OutTermsResponse} returns this - */ -proto.looprpc.OutTermsResponse.prototype.setMinSwapAmount = function(value) { - return jspb.Message.setProto3StringIntField(this, 5, value); -}; - - -/** - * optional int64 max_swap_amount = 6; - * @return {string} - */ -proto.looprpc.OutTermsResponse.prototype.getMaxSwapAmount = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "0")); -}; - - -/** - * @param {string} value - * @return {!proto.looprpc.OutTermsResponse} returns this + * repeated LiquidityRule rules = 1; + * @return {!Array} */ -proto.looprpc.OutTermsResponse.prototype.setMaxSwapAmount = function(value) { - return jspb.Message.setProto3StringIntField(this, 6, value); +proto.looprpc.LiquidityParameters.prototype.getRulesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.looprpc.LiquidityRule, 1)); }; /** - * optional int32 min_cltv_delta = 8; - * @return {number} - */ -proto.looprpc.OutTermsResponse.prototype.getMinCltvDelta = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 8, 0)); + * @param {!Array} value + * @return {!proto.looprpc.LiquidityParameters} returns this +*/ +proto.looprpc.LiquidityParameters.prototype.setRulesList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** - * @param {number} value - * @return {!proto.looprpc.OutTermsResponse} returns this + * @param {!proto.looprpc.LiquidityRule=} opt_value + * @param {number=} opt_index + * @return {!proto.looprpc.LiquidityRule} */ -proto.looprpc.OutTermsResponse.prototype.setMinCltvDelta = function(value) { - return jspb.Message.setProto3IntField(this, 8, value); +proto.looprpc.LiquidityParameters.prototype.addRules = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.looprpc.LiquidityRule, opt_index); }; /** - * optional int32 max_cltv_delta = 9; - * @return {number} + * Clears the list making it empty but non-null. + * @return {!proto.looprpc.LiquidityParameters} returns this */ -proto.looprpc.OutTermsResponse.prototype.getMaxCltvDelta = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 9, 0)); +proto.looprpc.LiquidityParameters.prototype.clearRulesList = function() { + return this.setRulesList([]); }; /** - * @param {number} value - * @return {!proto.looprpc.OutTermsResponse} returns this + * optional uint64 fee_ppm = 16; + * @return {string} */ -proto.looprpc.OutTermsResponse.prototype.setMaxCltvDelta = function(value) { - return jspb.Message.setProto3IntField(this, 9, value); +proto.looprpc.LiquidityParameters.prototype.getFeePpm = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 16, "0")); }; - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.looprpc.QuoteRequest.repeatedFields_ = [6]; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * @param {string} value + * @return {!proto.looprpc.LiquidityParameters} returns this */ -proto.looprpc.QuoteRequest.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.QuoteRequest.toObject(opt_includeInstance, this); +proto.looprpc.LiquidityParameters.prototype.setFeePpm = function(value) { + return jspb.Message.setProto3StringIntField(this, 16, value); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.looprpc.QuoteRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * optional uint64 sweep_fee_rate_sat_per_vbyte = 2; + * @return {string} */ -proto.looprpc.QuoteRequest.toObject = function(includeInstance, msg) { - var f, obj = { - amt: jspb.Message.getFieldWithDefault(msg, 1, "0"), - confTarget: jspb.Message.getFieldWithDefault(msg, 2, 0), - externalHtlc: jspb.Message.getBooleanFieldWithDefault(msg, 3, false), - swapPublicationDeadline: jspb.Message.getFieldWithDefault(msg, 4, "0"), - loopInLastHop: msg.getLoopInLastHop_asB64(), - loopInRouteHintsList: jspb.Message.toObjectList(msg.getLoopInRouteHintsList(), - swapserverrpc_common_pb.RouteHint.toObject, includeInstance), - pb_private: jspb.Message.getBooleanFieldWithDefault(msg, 7, false) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; +proto.looprpc.LiquidityParameters.prototype.getSweepFeeRateSatPerVbyte = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "0")); }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.QuoteRequest} + * @param {string} value + * @return {!proto.looprpc.LiquidityParameters} returns this */ -proto.looprpc.QuoteRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.QuoteRequest; - return proto.looprpc.QuoteRequest.deserializeBinaryFromReader(msg, reader); +proto.looprpc.LiquidityParameters.prototype.setSweepFeeRateSatPerVbyte = function(value) { + return jspb.Message.setProto3StringIntField(this, 2, value); }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.looprpc.QuoteRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.QuoteRequest} + * optional uint64 max_swap_fee_ppm = 3; + * @return {string} */ -proto.looprpc.QuoteRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setAmt(value); - break; - case 2: - var value = /** @type {number} */ (reader.readInt32()); - msg.setConfTarget(value); - break; - case 3: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setExternalHtlc(value); - break; - case 4: - var value = /** @type {string} */ (reader.readUint64String()); - msg.setSwapPublicationDeadline(value); - break; - case 5: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setLoopInLastHop(value); - break; - case 6: - var value = new swapserverrpc_common_pb.RouteHint; - reader.readMessage(value,swapserverrpc_common_pb.RouteHint.deserializeBinaryFromReader); - msg.addLoopInRouteHints(value); - break; - case 7: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setPrivate(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; +proto.looprpc.LiquidityParameters.prototype.getMaxSwapFeePpm = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "0")); }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * @param {string} value + * @return {!proto.looprpc.LiquidityParameters} returns this */ -proto.looprpc.QuoteRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.QuoteRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.looprpc.LiquidityParameters.prototype.setMaxSwapFeePpm = function(value) { + return jspb.Message.setProto3StringIntField(this, 3, value); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.QuoteRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.QuoteRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getAmt(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 1, - f - ); - } - f = message.getConfTarget(); - if (f !== 0) { - writer.writeInt32( - 2, - f - ); - } - f = message.getExternalHtlc(); - if (f) { - writer.writeBool( - 3, - f - ); - } - f = message.getSwapPublicationDeadline(); - if (parseInt(f, 10) !== 0) { - writer.writeUint64String( - 4, - f - ); - } - f = message.getLoopInLastHop_asU8(); - if (f.length > 0) { - writer.writeBytes( - 5, - f - ); - } - f = message.getLoopInRouteHintsList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 6, - f, - swapserverrpc_common_pb.RouteHint.serializeBinaryToWriter - ); - } - f = message.getPrivate(); - if (f) { - writer.writeBool( - 7, - f - ); - } + * optional uint64 max_routing_fee_ppm = 4; + * @return {string} + */ +proto.looprpc.LiquidityParameters.prototype.getMaxRoutingFeePpm = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "0")); }; /** - * optional int64 amt = 1; + * @param {string} value + * @return {!proto.looprpc.LiquidityParameters} returns this + */ +proto.looprpc.LiquidityParameters.prototype.setMaxRoutingFeePpm = function(value) { + return jspb.Message.setProto3StringIntField(this, 4, value); +}; + + +/** + * optional uint64 max_prepay_routing_fee_ppm = 5; * @return {string} */ -proto.looprpc.QuoteRequest.prototype.getAmt = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0")); +proto.looprpc.LiquidityParameters.prototype.getMaxPrepayRoutingFeePpm = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "0")); }; /** * @param {string} value - * @return {!proto.looprpc.QuoteRequest} returns this + * @return {!proto.looprpc.LiquidityParameters} returns this */ -proto.looprpc.QuoteRequest.prototype.setAmt = function(value) { - return jspb.Message.setProto3StringIntField(this, 1, value); +proto.looprpc.LiquidityParameters.prototype.setMaxPrepayRoutingFeePpm = function(value) { + return jspb.Message.setProto3StringIntField(this, 5, value); }; /** - * optional int32 conf_target = 2; - * @return {number} + * optional uint64 max_prepay_sat = 6; + * @return {string} */ -proto.looprpc.QuoteRequest.prototype.getConfTarget = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +proto.looprpc.LiquidityParameters.prototype.getMaxPrepaySat = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "0")); }; /** - * @param {number} value - * @return {!proto.looprpc.QuoteRequest} returns this + * @param {string} value + * @return {!proto.looprpc.LiquidityParameters} returns this */ -proto.looprpc.QuoteRequest.prototype.setConfTarget = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); +proto.looprpc.LiquidityParameters.prototype.setMaxPrepaySat = function(value) { + return jspb.Message.setProto3StringIntField(this, 6, value); }; /** - * optional bool external_htlc = 3; - * @return {boolean} + * optional uint64 max_miner_fee_sat = 7; + * @return {string} */ -proto.looprpc.QuoteRequest.prototype.getExternalHtlc = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); +proto.looprpc.LiquidityParameters.prototype.getMaxMinerFeeSat = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "0")); }; /** - * @param {boolean} value - * @return {!proto.looprpc.QuoteRequest} returns this + * @param {string} value + * @return {!proto.looprpc.LiquidityParameters} returns this */ -proto.looprpc.QuoteRequest.prototype.setExternalHtlc = function(value) { - return jspb.Message.setProto3BooleanField(this, 3, value); +proto.looprpc.LiquidityParameters.prototype.setMaxMinerFeeSat = function(value) { + return jspb.Message.setProto3StringIntField(this, 7, value); }; /** - * optional uint64 swap_publication_deadline = 4; + * optional int32 sweep_conf_target = 8; + * @return {number} + */ +proto.looprpc.LiquidityParameters.prototype.getSweepConfTarget = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 8, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.looprpc.LiquidityParameters} returns this + */ +proto.looprpc.LiquidityParameters.prototype.setSweepConfTarget = function(value) { + return jspb.Message.setProto3IntField(this, 8, value); +}; + + +/** + * optional uint64 failure_backoff_sec = 9; * @return {string} */ -proto.looprpc.QuoteRequest.prototype.getSwapPublicationDeadline = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "0")); +proto.looprpc.LiquidityParameters.prototype.getFailureBackoffSec = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 9, "0")); }; /** * @param {string} value - * @return {!proto.looprpc.QuoteRequest} returns this + * @return {!proto.looprpc.LiquidityParameters} returns this */ -proto.looprpc.QuoteRequest.prototype.setSwapPublicationDeadline = function(value) { - return jspb.Message.setProto3StringIntField(this, 4, value); +proto.looprpc.LiquidityParameters.prototype.setFailureBackoffSec = function(value) { + return jspb.Message.setProto3StringIntField(this, 9, value); }; /** - * optional bytes loop_in_last_hop = 5; - * @return {!(string|Uint8Array)} + * optional bool autoloop = 10; + * @return {boolean} */ -proto.looprpc.QuoteRequest.prototype.getLoopInLastHop = function() { - return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +proto.looprpc.LiquidityParameters.prototype.getAutoloop = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 10, false)); }; /** - * optional bytes loop_in_last_hop = 5; - * This is a type-conversion wrapper around `getLoopInLastHop()` - * @return {string} + * @param {boolean} value + * @return {!proto.looprpc.LiquidityParameters} returns this */ -proto.looprpc.QuoteRequest.prototype.getLoopInLastHop_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getLoopInLastHop())); +proto.looprpc.LiquidityParameters.prototype.setAutoloop = function(value) { + return jspb.Message.setProto3BooleanField(this, 10, value); }; /** - * optional bytes loop_in_last_hop = 5; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getLoopInLastHop()` - * @return {!Uint8Array} + * optional uint64 autoloop_budget_sat = 11; + * @return {string} */ -proto.looprpc.QuoteRequest.prototype.getLoopInLastHop_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getLoopInLastHop())); +proto.looprpc.LiquidityParameters.prototype.getAutoloopBudgetSat = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 11, "0")); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.looprpc.QuoteRequest} returns this + * @param {string} value + * @return {!proto.looprpc.LiquidityParameters} returns this */ -proto.looprpc.QuoteRequest.prototype.setLoopInLastHop = function(value) { - return jspb.Message.setProto3BytesField(this, 5, value); +proto.looprpc.LiquidityParameters.prototype.setAutoloopBudgetSat = function(value) { + return jspb.Message.setProto3StringIntField(this, 11, value); }; /** - * repeated RouteHint loop_in_route_hints = 6; - * @return {!Array} + * optional uint64 autoloop_budget_start_sec = 12; + * @return {string} */ -proto.looprpc.QuoteRequest.prototype.getLoopInRouteHintsList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, swapserverrpc_common_pb.RouteHint, 6)); +proto.looprpc.LiquidityParameters.prototype.getAutoloopBudgetStartSec = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 12, "0")); }; /** - * @param {!Array} value - * @return {!proto.looprpc.QuoteRequest} returns this -*/ -proto.looprpc.QuoteRequest.prototype.setLoopInRouteHintsList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 6, value); + * @param {string} value + * @return {!proto.looprpc.LiquidityParameters} returns this + */ +proto.looprpc.LiquidityParameters.prototype.setAutoloopBudgetStartSec = function(value) { + return jspb.Message.setProto3StringIntField(this, 12, value); }; /** - * @param {!proto.looprpc.RouteHint=} opt_value - * @param {number=} opt_index - * @return {!proto.looprpc.RouteHint} + * optional uint64 auto_max_in_flight = 13; + * @return {string} */ -proto.looprpc.QuoteRequest.prototype.addLoopInRouteHints = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 6, opt_value, proto.looprpc.RouteHint, opt_index); +proto.looprpc.LiquidityParameters.prototype.getAutoMaxInFlight = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 13, "0")); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.looprpc.QuoteRequest} returns this + * @param {string} value + * @return {!proto.looprpc.LiquidityParameters} returns this */ -proto.looprpc.QuoteRequest.prototype.clearLoopInRouteHintsList = function() { - return this.setLoopInRouteHintsList([]); +proto.looprpc.LiquidityParameters.prototype.setAutoMaxInFlight = function(value) { + return jspb.Message.setProto3StringIntField(this, 13, value); }; /** - * optional bool private = 7; - * @return {boolean} + * optional uint64 min_swap_amount = 14; + * @return {string} */ -proto.looprpc.QuoteRequest.prototype.getPrivate = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 7, false)); +proto.looprpc.LiquidityParameters.prototype.getMinSwapAmount = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 14, "0")); }; /** - * @param {boolean} value - * @return {!proto.looprpc.QuoteRequest} returns this + * @param {string} value + * @return {!proto.looprpc.LiquidityParameters} returns this */ -proto.looprpc.QuoteRequest.prototype.setPrivate = function(value) { - return jspb.Message.setProto3BooleanField(this, 7, value); +proto.looprpc.LiquidityParameters.prototype.setMinSwapAmount = function(value) { + return jspb.Message.setProto3StringIntField(this, 14, value); }; +/** + * optional uint64 max_swap_amount = 15; + * @return {string} + */ +proto.looprpc.LiquidityParameters.prototype.getMaxSwapAmount = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 15, "0")); +}; + +/** + * @param {string} value + * @return {!proto.looprpc.LiquidityParameters} returns this + */ +proto.looprpc.LiquidityParameters.prototype.setMaxSwapAmount = function(value) { + return jspb.Message.setProto3StringIntField(this, 15, value); +}; -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * optional int32 htlc_conf_target = 17; + * @return {number} */ -proto.looprpc.InQuoteResponse.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.InQuoteResponse.toObject(opt_includeInstance, this); +proto.looprpc.LiquidityParameters.prototype.getHtlcConfTarget = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 17, 0)); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.looprpc.InQuoteResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * @param {number} value + * @return {!proto.looprpc.LiquidityParameters} returns this */ -proto.looprpc.InQuoteResponse.toObject = function(includeInstance, msg) { - var f, obj = { - swapFeeSat: jspb.Message.getFieldWithDefault(msg, 1, "0"), - htlcPublishFeeSat: jspb.Message.getFieldWithDefault(msg, 3, "0"), - cltvDelta: jspb.Message.getFieldWithDefault(msg, 5, 0), - confTarget: jspb.Message.getFieldWithDefault(msg, 6, 0) - }; +proto.looprpc.LiquidityParameters.prototype.setHtlcConfTarget = function(value) { + return jspb.Message.setProto3IntField(this, 17, value); +}; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; + +/** + * optional string autoloop_dest_address = 18; + * @return {string} + */ +proto.looprpc.LiquidityParameters.prototype.getAutoloopDestAddress = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 18, "")); }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.InQuoteResponse} + * @param {string} value + * @return {!proto.looprpc.LiquidityParameters} returns this */ -proto.looprpc.InQuoteResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.InQuoteResponse; - return proto.looprpc.InQuoteResponse.deserializeBinaryFromReader(msg, reader); +proto.looprpc.LiquidityParameters.prototype.setAutoloopDestAddress = function(value) { + return jspb.Message.setProto3StringField(this, 18, value); +}; + + +/** + * optional uint64 autoloop_budget_refresh_period_sec = 19; + * @return {string} + */ +proto.looprpc.LiquidityParameters.prototype.getAutoloopBudgetRefreshPeriodSec = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 19, "0")); }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.looprpc.InQuoteResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.InQuoteResponse} + * @param {string} value + * @return {!proto.looprpc.LiquidityParameters} returns this */ -proto.looprpc.InQuoteResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setSwapFeeSat(value); - break; - case 3: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setHtlcPublishFeeSat(value); - break; - case 5: - var value = /** @type {number} */ (reader.readInt32()); - msg.setCltvDelta(value); - break; - case 6: - var value = /** @type {number} */ (reader.readInt32()); - msg.setConfTarget(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; +proto.looprpc.LiquidityParameters.prototype.setAutoloopBudgetRefreshPeriodSec = function(value) { + return jspb.Message.setProto3StringIntField(this, 19, value); }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * optional uint64 autoloop_budget_last_refresh = 20; + * @return {string} */ -proto.looprpc.InQuoteResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.InQuoteResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.looprpc.LiquidityParameters.prototype.getAutoloopBudgetLastRefresh = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 20, "0")); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.InQuoteResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * @param {string} value + * @return {!proto.looprpc.LiquidityParameters} returns this */ -proto.looprpc.InQuoteResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getSwapFeeSat(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 1, - f - ); - } - f = message.getHtlcPublishFeeSat(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 3, - f - ); - } - f = message.getCltvDelta(); - if (f !== 0) { - writer.writeInt32( - 5, - f - ); - } - f = message.getConfTarget(); - if (f !== 0) { - writer.writeInt32( - 6, - f - ); - } +proto.looprpc.LiquidityParameters.prototype.setAutoloopBudgetLastRefresh = function(value) { + return jspb.Message.setProto3StringIntField(this, 20, value); }; /** - * optional int64 swap_fee_sat = 1; - * @return {string} + * optional bool easy_autoloop = 21; + * @return {boolean} */ -proto.looprpc.InQuoteResponse.prototype.getSwapFeeSat = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0")); +proto.looprpc.LiquidityParameters.prototype.getEasyAutoloop = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 21, false)); }; /** - * @param {string} value - * @return {!proto.looprpc.InQuoteResponse} returns this + * @param {boolean} value + * @return {!proto.looprpc.LiquidityParameters} returns this */ -proto.looprpc.InQuoteResponse.prototype.setSwapFeeSat = function(value) { - return jspb.Message.setProto3StringIntField(this, 1, value); +proto.looprpc.LiquidityParameters.prototype.setEasyAutoloop = function(value) { + return jspb.Message.setProto3BooleanField(this, 21, value); }; /** - * optional int64 htlc_publish_fee_sat = 3; + * optional uint64 easy_autoloop_local_target_sat = 22; * @return {string} */ -proto.looprpc.InQuoteResponse.prototype.getHtlcPublishFeeSat = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "0")); +proto.looprpc.LiquidityParameters.prototype.getEasyAutoloopLocalTargetSat = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 22, "0")); }; /** * @param {string} value - * @return {!proto.looprpc.InQuoteResponse} returns this + * @return {!proto.looprpc.LiquidityParameters} returns this */ -proto.looprpc.InQuoteResponse.prototype.setHtlcPublishFeeSat = function(value) { - return jspb.Message.setProto3StringIntField(this, 3, value); +proto.looprpc.LiquidityParameters.prototype.setEasyAutoloopLocalTargetSat = function(value) { + return jspb.Message.setProto3StringIntField(this, 22, value); }; /** - * optional int32 cltv_delta = 5; - * @return {number} + * optional string account = 23; + * @return {string} */ -proto.looprpc.InQuoteResponse.prototype.getCltvDelta = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +proto.looprpc.LiquidityParameters.prototype.getAccount = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 23, "")); }; /** - * @param {number} value - * @return {!proto.looprpc.InQuoteResponse} returns this + * @param {string} value + * @return {!proto.looprpc.LiquidityParameters} returns this */ -proto.looprpc.InQuoteResponse.prototype.setCltvDelta = function(value) { - return jspb.Message.setProto3IntField(this, 5, value); +proto.looprpc.LiquidityParameters.prototype.setAccount = function(value) { + return jspb.Message.setProto3StringField(this, 23, value); }; /** - * optional int32 conf_target = 6; - * @return {number} + * optional AddressType account_addr_type = 24; + * @return {!proto.looprpc.AddressType} */ -proto.looprpc.InQuoteResponse.prototype.getConfTarget = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); +proto.looprpc.LiquidityParameters.prototype.getAccountAddrType = function() { + return /** @type {!proto.looprpc.AddressType} */ (jspb.Message.getFieldWithDefault(this, 24, 0)); }; /** - * @param {number} value - * @return {!proto.looprpc.InQuoteResponse} returns this + * @param {!proto.looprpc.AddressType} value + * @return {!proto.looprpc.LiquidityParameters} returns this */ -proto.looprpc.InQuoteResponse.prototype.setConfTarget = function(value) { - return jspb.Message.setProto3IntField(this, 6, value); +proto.looprpc.LiquidityParameters.prototype.setAccountAddrType = function(value) { + return jspb.Message.setProto3EnumField(this, 24, value); }; @@ -5122,8 +8851,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.OutQuoteResponse.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.OutQuoteResponse.toObject(opt_includeInstance, this); +proto.looprpc.LiquidityRule.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.LiquidityRule.toObject(opt_includeInstance, this); }; @@ -5132,18 +8861,18 @@ proto.looprpc.OutQuoteResponse.prototype.toObject = function(opt_includeInstance * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.OutQuoteResponse} msg The msg instance to transform. + * @param {!proto.looprpc.LiquidityRule} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.OutQuoteResponse.toObject = function(includeInstance, msg) { +proto.looprpc.LiquidityRule.toObject = function(includeInstance, msg) { var f, obj = { - swapFeeSat: jspb.Message.getFieldWithDefault(msg, 1, "0"), - prepayAmtSat: jspb.Message.getFieldWithDefault(msg, 2, "0"), - htlcSweepFeeSat: jspb.Message.getFieldWithDefault(msg, 3, "0"), - swapPaymentDest: msg.getSwapPaymentDest_asB64(), - cltvDelta: jspb.Message.getFieldWithDefault(msg, 5, 0), - confTarget: jspb.Message.getFieldWithDefault(msg, 6, 0) + channelId: jspb.Message.getFieldWithDefault(msg, 1, "0"), + swapType: jspb.Message.getFieldWithDefault(msg, 6, 0), + pubkey: msg.getPubkey_asB64(), + type: jspb.Message.getFieldWithDefault(msg, 2, 0), + incomingThreshold: jspb.Message.getFieldWithDefault(msg, 3, 0), + outgoingThreshold: jspb.Message.getFieldWithDefault(msg, 4, 0) }; if (includeInstance) { @@ -5157,23 +8886,23 @@ proto.looprpc.OutQuoteResponse.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.OutQuoteResponse} + * @return {!proto.looprpc.LiquidityRule} */ -proto.looprpc.OutQuoteResponse.deserializeBinary = function(bytes) { +proto.looprpc.LiquidityRule.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.OutQuoteResponse; - return proto.looprpc.OutQuoteResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.LiquidityRule; + return proto.looprpc.LiquidityRule.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.OutQuoteResponse} msg The message object to deserialize into. + * @param {!proto.looprpc.LiquidityRule} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.OutQuoteResponse} + * @return {!proto.looprpc.LiquidityRule} */ -proto.looprpc.OutQuoteResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.LiquidityRule.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5181,28 +8910,28 @@ proto.looprpc.OutQuoteResponse.deserializeBinaryFromReader = function(msg, reade var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setSwapFeeSat(value); + var value = /** @type {string} */ (reader.readUint64String()); + msg.setChannelId(value); + break; + case 6: + var value = /** @type {!proto.looprpc.SwapType} */ (reader.readEnum()); + msg.setSwapType(value); + break; + case 5: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setPubkey(value); break; case 2: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setPrepayAmtSat(value); + var value = /** @type {!proto.looprpc.LiquidityRuleType} */ (reader.readEnum()); + msg.setType(value); break; case 3: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setHtlcSweepFeeSat(value); + var value = /** @type {number} */ (reader.readUint32()); + msg.setIncomingThreshold(value); break; case 4: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setSwapPaymentDest(value); - break; - case 5: - var value = /** @type {number} */ (reader.readInt32()); - msg.setCltvDelta(value); - break; - case 6: - var value = /** @type {number} */ (reader.readInt32()); - msg.setConfTarget(value); + var value = /** @type {number} */ (reader.readUint32()); + msg.setOutgoingThreshold(value); break; default: reader.skipField(); @@ -5217,9 +8946,9 @@ proto.looprpc.OutQuoteResponse.deserializeBinaryFromReader = function(msg, reade * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.OutQuoteResponse.prototype.serializeBinary = function() { +proto.looprpc.LiquidityRule.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.OutQuoteResponse.serializeBinaryToWriter(this, writer); + proto.looprpc.LiquidityRule.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5227,51 +8956,51 @@ proto.looprpc.OutQuoteResponse.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.OutQuoteResponse} message + * @param {!proto.looprpc.LiquidityRule} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.OutQuoteResponse.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.LiquidityRule.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getSwapFeeSat(); + f = message.getChannelId(); if (parseInt(f, 10) !== 0) { - writer.writeInt64String( + writer.writeUint64String( 1, f ); } - f = message.getPrepayAmtSat(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 2, + f = message.getSwapType(); + if (f !== 0.0) { + writer.writeEnum( + 6, f ); } - f = message.getHtlcSweepFeeSat(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 3, + f = message.getPubkey_asU8(); + if (f.length > 0) { + writer.writeBytes( + 5, f ); } - f = message.getSwapPaymentDest_asU8(); - if (f.length > 0) { - writer.writeBytes( - 4, + f = message.getType(); + if (f !== 0.0) { + writer.writeEnum( + 2, f ); } - f = message.getCltvDelta(); + f = message.getIncomingThreshold(); if (f !== 0) { - writer.writeInt32( - 5, + writer.writeUint32( + 3, f ); } - f = message.getConfTarget(); + f = message.getOutgoingThreshold(); if (f !== 0) { - writer.writeInt32( - 6, + writer.writeUint32( + 4, f ); } @@ -5279,145 +9008,138 @@ proto.looprpc.OutQuoteResponse.serializeBinaryToWriter = function(message, write /** - * optional int64 swap_fee_sat = 1; + * optional uint64 channel_id = 1; * @return {string} */ -proto.looprpc.OutQuoteResponse.prototype.getSwapFeeSat = function() { +proto.looprpc.LiquidityRule.prototype.getChannelId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0")); }; /** * @param {string} value - * @return {!proto.looprpc.OutQuoteResponse} returns this + * @return {!proto.looprpc.LiquidityRule} returns this */ -proto.looprpc.OutQuoteResponse.prototype.setSwapFeeSat = function(value) { +proto.looprpc.LiquidityRule.prototype.setChannelId = function(value) { return jspb.Message.setProto3StringIntField(this, 1, value); }; /** - * optional int64 prepay_amt_sat = 2; - * @return {string} + * optional SwapType swap_type = 6; + * @return {!proto.looprpc.SwapType} */ -proto.looprpc.OutQuoteResponse.prototype.getPrepayAmtSat = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "0")); +proto.looprpc.LiquidityRule.prototype.getSwapType = function() { + return /** @type {!proto.looprpc.SwapType} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); }; /** - * @param {string} value - * @return {!proto.looprpc.OutQuoteResponse} returns this + * @param {!proto.looprpc.SwapType} value + * @return {!proto.looprpc.LiquidityRule} returns this */ -proto.looprpc.OutQuoteResponse.prototype.setPrepayAmtSat = function(value) { - return jspb.Message.setProto3StringIntField(this, 2, value); +proto.looprpc.LiquidityRule.prototype.setSwapType = function(value) { + return jspb.Message.setProto3EnumField(this, 6, value); }; /** - * optional int64 htlc_sweep_fee_sat = 3; - * @return {string} + * optional bytes pubkey = 5; + * @return {!(string|Uint8Array)} */ -proto.looprpc.OutQuoteResponse.prototype.getHtlcSweepFeeSat = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "0")); +proto.looprpc.LiquidityRule.prototype.getPubkey = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 5, "")); }; /** - * @param {string} value - * @return {!proto.looprpc.OutQuoteResponse} returns this + * optional bytes pubkey = 5; + * This is a type-conversion wrapper around `getPubkey()` + * @return {string} */ -proto.looprpc.OutQuoteResponse.prototype.setHtlcSweepFeeSat = function(value) { - return jspb.Message.setProto3StringIntField(this, 3, value); +proto.looprpc.LiquidityRule.prototype.getPubkey_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getPubkey())); }; /** - * optional bytes swap_payment_dest = 4; - * @return {!(string|Uint8Array)} + * optional bytes pubkey = 5; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getPubkey()` + * @return {!Uint8Array} */ -proto.looprpc.OutQuoteResponse.prototype.getSwapPaymentDest = function() { - return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +proto.looprpc.LiquidityRule.prototype.getPubkey_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getPubkey())); }; /** - * optional bytes swap_payment_dest = 4; - * This is a type-conversion wrapper around `getSwapPaymentDest()` - * @return {string} + * @param {!(string|Uint8Array)} value + * @return {!proto.looprpc.LiquidityRule} returns this */ -proto.looprpc.OutQuoteResponse.prototype.getSwapPaymentDest_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getSwapPaymentDest())); +proto.looprpc.LiquidityRule.prototype.setPubkey = function(value) { + return jspb.Message.setProto3BytesField(this, 5, value); }; /** - * optional bytes swap_payment_dest = 4; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getSwapPaymentDest()` - * @return {!Uint8Array} + * optional LiquidityRuleType type = 2; + * @return {!proto.looprpc.LiquidityRuleType} */ -proto.looprpc.OutQuoteResponse.prototype.getSwapPaymentDest_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getSwapPaymentDest())); +proto.looprpc.LiquidityRule.prototype.getType = function() { + return /** @type {!proto.looprpc.LiquidityRuleType} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.looprpc.OutQuoteResponse} returns this + * @param {!proto.looprpc.LiquidityRuleType} value + * @return {!proto.looprpc.LiquidityRule} returns this */ -proto.looprpc.OutQuoteResponse.prototype.setSwapPaymentDest = function(value) { - return jspb.Message.setProto3BytesField(this, 4, value); +proto.looprpc.LiquidityRule.prototype.setType = function(value) { + return jspb.Message.setProto3EnumField(this, 2, value); }; /** - * optional int32 cltv_delta = 5; + * optional uint32 incoming_threshold = 3; * @return {number} */ -proto.looprpc.OutQuoteResponse.prototype.getCltvDelta = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +proto.looprpc.LiquidityRule.prototype.getIncomingThreshold = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** * @param {number} value - * @return {!proto.looprpc.OutQuoteResponse} returns this + * @return {!proto.looprpc.LiquidityRule} returns this */ -proto.looprpc.OutQuoteResponse.prototype.setCltvDelta = function(value) { - return jspb.Message.setProto3IntField(this, 5, value); +proto.looprpc.LiquidityRule.prototype.setIncomingThreshold = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); }; /** - * optional int32 conf_target = 6; + * optional uint32 outgoing_threshold = 4; * @return {number} */ -proto.looprpc.OutQuoteResponse.prototype.getConfTarget = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); +proto.looprpc.LiquidityRule.prototype.getOutgoingThreshold = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); }; /** * @param {number} value - * @return {!proto.looprpc.OutQuoteResponse} returns this + * @return {!proto.looprpc.LiquidityRule} returns this */ -proto.looprpc.OutQuoteResponse.prototype.setConfTarget = function(value) { - return jspb.Message.setProto3IntField(this, 6, value); +proto.looprpc.LiquidityRule.prototype.setOutgoingThreshold = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); }; -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.looprpc.ProbeRequest.repeatedFields_ = [3]; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -5433,8 +9155,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.ProbeRequest.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.ProbeRequest.toObject(opt_includeInstance, this); +proto.looprpc.SetLiquidityParamsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.SetLiquidityParamsRequest.toObject(opt_includeInstance, this); }; @@ -5443,16 +9165,13 @@ proto.looprpc.ProbeRequest.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.ProbeRequest} msg The msg instance to transform. + * @param {!proto.looprpc.SetLiquidityParamsRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.ProbeRequest.toObject = function(includeInstance, msg) { +proto.looprpc.SetLiquidityParamsRequest.toObject = function(includeInstance, msg) { var f, obj = { - amt: jspb.Message.getFieldWithDefault(msg, 1, "0"), - lastHop: msg.getLastHop_asB64(), - routeHintsList: jspb.Message.toObjectList(msg.getRouteHintsList(), - swapserverrpc_common_pb.RouteHint.toObject, includeInstance) + parameters: (f = msg.getParameters()) && proto.looprpc.LiquidityParameters.toObject(includeInstance, f) }; if (includeInstance) { @@ -5466,23 +9185,23 @@ proto.looprpc.ProbeRequest.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.ProbeRequest} + * @return {!proto.looprpc.SetLiquidityParamsRequest} */ -proto.looprpc.ProbeRequest.deserializeBinary = function(bytes) { +proto.looprpc.SetLiquidityParamsRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.ProbeRequest; - return proto.looprpc.ProbeRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.SetLiquidityParamsRequest; + return proto.looprpc.SetLiquidityParamsRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.ProbeRequest} msg The message object to deserialize into. + * @param {!proto.looprpc.SetLiquidityParamsRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.ProbeRequest} + * @return {!proto.looprpc.SetLiquidityParamsRequest} */ -proto.looprpc.ProbeRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.SetLiquidityParamsRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5490,17 +9209,9 @@ proto.looprpc.ProbeRequest.deserializeBinaryFromReader = function(msg, reader) { var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setAmt(value); - break; - case 2: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setLastHop(value); - break; - case 3: - var value = new swapserverrpc_common_pb.RouteHint; - reader.readMessage(value,swapserverrpc_common_pb.RouteHint.deserializeBinaryFromReader); - msg.addRouteHints(value); + var value = new proto.looprpc.LiquidityParameters; + reader.readMessage(value,proto.looprpc.LiquidityParameters.deserializeBinaryFromReader); + msg.setParameters(value); break; default: reader.skipField(); @@ -5515,9 +9226,9 @@ proto.looprpc.ProbeRequest.deserializeBinaryFromReader = function(msg, reader) { * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.ProbeRequest.prototype.serializeBinary = function() { +proto.looprpc.SetLiquidityParamsRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.ProbeRequest.serializeBinaryToWriter(this, writer); + proto.looprpc.SetLiquidityParamsRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5525,132 +9236,57 @@ proto.looprpc.ProbeRequest.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.ProbeRequest} message + * @param {!proto.looprpc.SetLiquidityParamsRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.ProbeRequest.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.SetLiquidityParamsRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getAmt(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( + f = message.getParameters(); + if (f != null) { + writer.writeMessage( 1, - f - ); - } - f = message.getLastHop_asU8(); - if (f.length > 0) { - writer.writeBytes( - 2, - f - ); - } - f = message.getRouteHintsList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 3, - f, - swapserverrpc_common_pb.RouteHint.serializeBinaryToWriter - ); - } -}; - - -/** - * optional int64 amt = 1; - * @return {string} - */ -proto.looprpc.ProbeRequest.prototype.getAmt = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0")); -}; - - -/** - * @param {string} value - * @return {!proto.looprpc.ProbeRequest} returns this - */ -proto.looprpc.ProbeRequest.prototype.setAmt = function(value) { - return jspb.Message.setProto3StringIntField(this, 1, value); -}; - - -/** - * optional bytes last_hop = 2; - * @return {!(string|Uint8Array)} - */ -proto.looprpc.ProbeRequest.prototype.getLastHop = function() { - return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * optional bytes last_hop = 2; - * This is a type-conversion wrapper around `getLastHop()` - * @return {string} - */ -proto.looprpc.ProbeRequest.prototype.getLastHop_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getLastHop())); -}; - - -/** - * optional bytes last_hop = 2; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getLastHop()` - * @return {!Uint8Array} - */ -proto.looprpc.ProbeRequest.prototype.getLastHop_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getLastHop())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.looprpc.ProbeRequest} returns this - */ -proto.looprpc.ProbeRequest.prototype.setLastHop = function(value) { - return jspb.Message.setProto3BytesField(this, 2, value); + f, + proto.looprpc.LiquidityParameters.serializeBinaryToWriter + ); + } }; /** - * repeated RouteHint route_hints = 3; - * @return {!Array} + * optional LiquidityParameters parameters = 1; + * @return {?proto.looprpc.LiquidityParameters} */ -proto.looprpc.ProbeRequest.prototype.getRouteHintsList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, swapserverrpc_common_pb.RouteHint, 3)); +proto.looprpc.SetLiquidityParamsRequest.prototype.getParameters = function() { + return /** @type{?proto.looprpc.LiquidityParameters} */ ( + jspb.Message.getWrapperField(this, proto.looprpc.LiquidityParameters, 1)); }; /** - * @param {!Array} value - * @return {!proto.looprpc.ProbeRequest} returns this + * @param {?proto.looprpc.LiquidityParameters|undefined} value + * @return {!proto.looprpc.SetLiquidityParamsRequest} returns this */ -proto.looprpc.ProbeRequest.prototype.setRouteHintsList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 3, value); +proto.looprpc.SetLiquidityParamsRequest.prototype.setParameters = function(value) { + return jspb.Message.setWrapperField(this, 1, value); }; /** - * @param {!proto.looprpc.RouteHint=} opt_value - * @param {number=} opt_index - * @return {!proto.looprpc.RouteHint} + * Clears the message field making it undefined. + * @return {!proto.looprpc.SetLiquidityParamsRequest} returns this */ -proto.looprpc.ProbeRequest.prototype.addRouteHints = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.looprpc.RouteHint, opt_index); +proto.looprpc.SetLiquidityParamsRequest.prototype.clearParameters = function() { + return this.setParameters(undefined); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.looprpc.ProbeRequest} returns this + * Returns whether this field is set. + * @return {boolean} */ -proto.looprpc.ProbeRequest.prototype.clearRouteHintsList = function() { - return this.setRouteHintsList([]); +proto.looprpc.SetLiquidityParamsRequest.prototype.hasParameters = function() { + return jspb.Message.getField(this, 1) != null; }; @@ -5670,8 +9306,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.ProbeResponse.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.ProbeResponse.toObject(opt_includeInstance, this); +proto.looprpc.SetLiquidityParamsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.SetLiquidityParamsResponse.toObject(opt_includeInstance, this); }; @@ -5680,11 +9316,11 @@ proto.looprpc.ProbeResponse.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.ProbeResponse} msg The msg instance to transform. + * @param {!proto.looprpc.SetLiquidityParamsResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.ProbeResponse.toObject = function(includeInstance, msg) { +proto.looprpc.SetLiquidityParamsResponse.toObject = function(includeInstance, msg) { var f, obj = { }; @@ -5700,23 +9336,23 @@ proto.looprpc.ProbeResponse.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.ProbeResponse} + * @return {!proto.looprpc.SetLiquidityParamsResponse} */ -proto.looprpc.ProbeResponse.deserializeBinary = function(bytes) { +proto.looprpc.SetLiquidityParamsResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.ProbeResponse; - return proto.looprpc.ProbeResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.SetLiquidityParamsResponse; + return proto.looprpc.SetLiquidityParamsResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.ProbeResponse} msg The message object to deserialize into. + * @param {!proto.looprpc.SetLiquidityParamsResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.ProbeResponse} + * @return {!proto.looprpc.SetLiquidityParamsResponse} */ -proto.looprpc.ProbeResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.SetLiquidityParamsResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5736,9 +9372,9 @@ proto.looprpc.ProbeResponse.deserializeBinaryFromReader = function(msg, reader) * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.ProbeResponse.prototype.serializeBinary = function() { +proto.looprpc.SetLiquidityParamsResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.ProbeResponse.serializeBinaryToWriter(this, writer); + proto.looprpc.SetLiquidityParamsResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5746,11 +9382,11 @@ proto.looprpc.ProbeResponse.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.ProbeResponse} message + * @param {!proto.looprpc.SetLiquidityParamsResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.ProbeResponse.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.SetLiquidityParamsResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; }; @@ -5771,8 +9407,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.TokensRequest.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.TokensRequest.toObject(opt_includeInstance, this); +proto.looprpc.SuggestSwapsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.SuggestSwapsRequest.toObject(opt_includeInstance, this); }; @@ -5781,11 +9417,11 @@ proto.looprpc.TokensRequest.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.TokensRequest} msg The msg instance to transform. + * @param {!proto.looprpc.SuggestSwapsRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.TokensRequest.toObject = function(includeInstance, msg) { +proto.looprpc.SuggestSwapsRequest.toObject = function(includeInstance, msg) { var f, obj = { }; @@ -5801,23 +9437,23 @@ proto.looprpc.TokensRequest.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.TokensRequest} + * @return {!proto.looprpc.SuggestSwapsRequest} */ -proto.looprpc.TokensRequest.deserializeBinary = function(bytes) { +proto.looprpc.SuggestSwapsRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.TokensRequest; - return proto.looprpc.TokensRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.SuggestSwapsRequest; + return proto.looprpc.SuggestSwapsRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.TokensRequest} msg The message object to deserialize into. + * @param {!proto.looprpc.SuggestSwapsRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.TokensRequest} + * @return {!proto.looprpc.SuggestSwapsRequest} */ -proto.looprpc.TokensRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.SuggestSwapsRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5837,9 +9473,9 @@ proto.looprpc.TokensRequest.deserializeBinaryFromReader = function(msg, reader) * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.TokensRequest.prototype.serializeBinary = function() { +proto.looprpc.SuggestSwapsRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.TokensRequest.serializeBinaryToWriter(this, writer); + proto.looprpc.SuggestSwapsRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5847,23 +9483,16 @@ proto.looprpc.TokensRequest.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.TokensRequest} message + * @param {!proto.looprpc.SuggestSwapsRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.TokensRequest.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.SuggestSwapsRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; }; -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.looprpc.TokensResponse.repeatedFields_ = [1]; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -5879,8 +9508,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.TokensResponse.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.TokensResponse.toObject(opt_includeInstance, this); +proto.looprpc.Disqualified.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.Disqualified.toObject(opt_includeInstance, this); }; @@ -5889,14 +9518,15 @@ proto.looprpc.TokensResponse.prototype.toObject = function(opt_includeInstance) * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.TokensResponse} msg The msg instance to transform. + * @param {!proto.looprpc.Disqualified} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.TokensResponse.toObject = function(includeInstance, msg) { +proto.looprpc.Disqualified.toObject = function(includeInstance, msg) { var f, obj = { - tokensList: jspb.Message.toObjectList(msg.getTokensList(), - proto.looprpc.L402Token.toObject, includeInstance) + channelId: jspb.Message.getFieldWithDefault(msg, 1, "0"), + pubkey: msg.getPubkey_asB64(), + reason: jspb.Message.getFieldWithDefault(msg, 2, 0) }; if (includeInstance) { @@ -5910,23 +9540,23 @@ proto.looprpc.TokensResponse.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.TokensResponse} + * @return {!proto.looprpc.Disqualified} */ -proto.looprpc.TokensResponse.deserializeBinary = function(bytes) { +proto.looprpc.Disqualified.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.TokensResponse; - return proto.looprpc.TokensResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.Disqualified; + return proto.looprpc.Disqualified.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.TokensResponse} msg The message object to deserialize into. + * @param {!proto.looprpc.Disqualified} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.TokensResponse} + * @return {!proto.looprpc.Disqualified} */ -proto.looprpc.TokensResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.Disqualified.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5934,9 +9564,16 @@ proto.looprpc.TokensResponse.deserializeBinaryFromReader = function(msg, reader) var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.looprpc.L402Token; - reader.readMessage(value,proto.looprpc.L402Token.deserializeBinaryFromReader); - msg.addTokens(value); + var value = /** @type {string} */ (reader.readUint64String()); + msg.setChannelId(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setPubkey(value); + break; + case 2: + var value = /** @type {!proto.looprpc.AutoReason} */ (reader.readEnum()); + msg.setReason(value); break; default: reader.skipField(); @@ -5951,9 +9588,9 @@ proto.looprpc.TokensResponse.deserializeBinaryFromReader = function(msg, reader) * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.TokensResponse.prototype.serializeBinary = function() { +proto.looprpc.Disqualified.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.TokensResponse.serializeBinaryToWriter(this, writer); + proto.looprpc.Disqualified.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5961,62 +9598,122 @@ proto.looprpc.TokensResponse.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.TokensResponse} message + * @param {!proto.looprpc.Disqualified} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.TokensResponse.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.Disqualified.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getTokensList(); - if (f.length > 0) { - writer.writeRepeatedMessage( + f = message.getChannelId(); + if (parseInt(f, 10) !== 0) { + writer.writeUint64String( 1, - f, - proto.looprpc.L402Token.serializeBinaryToWriter + f + ); + } + f = message.getPubkey_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } + f = message.getReason(); + if (f !== 0.0) { + writer.writeEnum( + 2, + f ); } }; /** - * repeated L402Token tokens = 1; - * @return {!Array} + * optional uint64 channel_id = 1; + * @return {string} */ -proto.looprpc.TokensResponse.prototype.getTokensList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.looprpc.L402Token, 1)); +proto.looprpc.Disqualified.prototype.getChannelId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0")); }; /** - * @param {!Array} value - * @return {!proto.looprpc.TokensResponse} returns this -*/ -proto.looprpc.TokensResponse.prototype.setTokensList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); + * @param {string} value + * @return {!proto.looprpc.Disqualified} returns this + */ +proto.looprpc.Disqualified.prototype.setChannelId = function(value) { + return jspb.Message.setProto3StringIntField(this, 1, value); }; /** - * @param {!proto.looprpc.L402Token=} opt_value - * @param {number=} opt_index - * @return {!proto.looprpc.L402Token} + * optional bytes pubkey = 3; + * @return {!(string|Uint8Array)} */ -proto.looprpc.TokensResponse.prototype.addTokens = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.looprpc.L402Token, opt_index); +proto.looprpc.Disqualified.prototype.getPubkey = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.looprpc.TokensResponse} returns this + * optional bytes pubkey = 3; + * This is a type-conversion wrapper around `getPubkey()` + * @return {string} */ -proto.looprpc.TokensResponse.prototype.clearTokensList = function() { - return this.setTokensList([]); +proto.looprpc.Disqualified.prototype.getPubkey_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getPubkey())); +}; + + +/** + * optional bytes pubkey = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getPubkey()` + * @return {!Uint8Array} + */ +proto.looprpc.Disqualified.prototype.getPubkey_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getPubkey())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.looprpc.Disqualified} returns this + */ +proto.looprpc.Disqualified.prototype.setPubkey = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + + +/** + * optional AutoReason reason = 2; + * @return {!proto.looprpc.AutoReason} + */ +proto.looprpc.Disqualified.prototype.getReason = function() { + return /** @type {!proto.looprpc.AutoReason} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {!proto.looprpc.AutoReason} value + * @return {!proto.looprpc.Disqualified} returns this + */ +proto.looprpc.Disqualified.prototype.setReason = function(value) { + return jspb.Message.setProto3EnumField(this, 2, value); }; +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.looprpc.SuggestSwapsResponse.repeatedFields_ = [1,3,2]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -6032,8 +9729,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.L402Token.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.L402Token.toObject(opt_includeInstance, this); +proto.looprpc.SuggestSwapsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.SuggestSwapsResponse.toObject(opt_includeInstance, this); }; @@ -6042,21 +9739,18 @@ proto.looprpc.L402Token.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.L402Token} msg The msg instance to transform. + * @param {!proto.looprpc.SuggestSwapsResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.L402Token.toObject = function(includeInstance, msg) { +proto.looprpc.SuggestSwapsResponse.toObject = function(includeInstance, msg) { var f, obj = { - baseMacaroon: msg.getBaseMacaroon_asB64(), - paymentHash: msg.getPaymentHash_asB64(), - paymentPreimage: msg.getPaymentPreimage_asB64(), - amountPaidMsat: jspb.Message.getFieldWithDefault(msg, 4, "0"), - routingFeePaidMsat: jspb.Message.getFieldWithDefault(msg, 5, "0"), - timeCreated: jspb.Message.getFieldWithDefault(msg, 6, "0"), - expired: jspb.Message.getBooleanFieldWithDefault(msg, 7, false), - storageName: jspb.Message.getFieldWithDefault(msg, 8, ""), - id: jspb.Message.getFieldWithDefault(msg, 9, "") + loopOutList: jspb.Message.toObjectList(msg.getLoopOutList(), + proto.looprpc.LoopOutRequest.toObject, includeInstance), + loopInList: jspb.Message.toObjectList(msg.getLoopInList(), + proto.looprpc.LoopInRequest.toObject, includeInstance), + disqualifiedList: jspb.Message.toObjectList(msg.getDisqualifiedList(), + proto.looprpc.Disqualified.toObject, includeInstance) }; if (includeInstance) { @@ -6070,23 +9764,23 @@ proto.looprpc.L402Token.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.L402Token} + * @return {!proto.looprpc.SuggestSwapsResponse} */ -proto.looprpc.L402Token.deserializeBinary = function(bytes) { +proto.looprpc.SuggestSwapsResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.L402Token; - return proto.looprpc.L402Token.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.SuggestSwapsResponse; + return proto.looprpc.SuggestSwapsResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.L402Token} msg The message object to deserialize into. + * @param {!proto.looprpc.SuggestSwapsResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.L402Token} + * @return {!proto.looprpc.SuggestSwapsResponse} */ -proto.looprpc.L402Token.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.SuggestSwapsResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -6094,40 +9788,19 @@ proto.looprpc.L402Token.deserializeBinaryFromReader = function(msg, reader) { var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setBaseMacaroon(value); - break; - case 2: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setPaymentHash(value); + var value = new proto.looprpc.LoopOutRequest; + reader.readMessage(value,proto.looprpc.LoopOutRequest.deserializeBinaryFromReader); + msg.addLoopOut(value); break; case 3: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setPaymentPreimage(value); - break; - case 4: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setAmountPaidMsat(value); - break; - case 5: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setRoutingFeePaidMsat(value); - break; - case 6: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setTimeCreated(value); - break; - case 7: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setExpired(value); - break; - case 8: - var value = /** @type {string} */ (reader.readString()); - msg.setStorageName(value); + var value = new proto.looprpc.LoopInRequest; + reader.readMessage(value,proto.looprpc.LoopInRequest.deserializeBinaryFromReader); + msg.addLoopIn(value); break; - case 9: - var value = /** @type {string} */ (reader.readString()); - msg.setId(value); + case 2: + var value = new proto.looprpc.Disqualified; + reader.readMessage(value,proto.looprpc.Disqualified.deserializeBinaryFromReader); + msg.addDisqualified(value); break; default: reader.skipField(); @@ -6142,9 +9815,9 @@ proto.looprpc.L402Token.deserializeBinaryFromReader = function(msg, reader) { * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.L402Token.prototype.serializeBinary = function() { +proto.looprpc.SuggestSwapsResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.L402Token.serializeBinaryToWriter(this, writer); + proto.looprpc.SuggestSwapsResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -6152,309 +9825,334 @@ proto.looprpc.L402Token.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.L402Token} message + * @param {!proto.looprpc.SuggestSwapsResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.L402Token.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.SuggestSwapsResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getBaseMacaroon_asU8(); + f = message.getLoopOutList(); if (f.length > 0) { - writer.writeBytes( + writer.writeRepeatedMessage( 1, - f - ); - } - f = message.getPaymentHash_asU8(); - if (f.length > 0) { - writer.writeBytes( - 2, - f + f, + proto.looprpc.LoopOutRequest.serializeBinaryToWriter ); } - f = message.getPaymentPreimage_asU8(); + f = message.getLoopInList(); if (f.length > 0) { - writer.writeBytes( + writer.writeRepeatedMessage( 3, - f - ); - } - f = message.getAmountPaidMsat(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 4, - f - ); - } - f = message.getRoutingFeePaidMsat(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 5, - f - ); - } - f = message.getTimeCreated(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 6, - f - ); - } - f = message.getExpired(); - if (f) { - writer.writeBool( - 7, - f - ); - } - f = message.getStorageName(); - if (f.length > 0) { - writer.writeString( - 8, - f + f, + proto.looprpc.LoopInRequest.serializeBinaryToWriter ); } - f = message.getId(); + f = message.getDisqualifiedList(); if (f.length > 0) { - writer.writeString( - 9, - f + writer.writeRepeatedMessage( + 2, + f, + proto.looprpc.Disqualified.serializeBinaryToWriter ); } }; /** - * optional bytes base_macaroon = 1; - * @return {!(string|Uint8Array)} + * repeated LoopOutRequest loop_out = 1; + * @return {!Array} */ -proto.looprpc.L402Token.prototype.getBaseMacaroon = function() { - return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.looprpc.SuggestSwapsResponse.prototype.getLoopOutList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.looprpc.LoopOutRequest, 1)); }; /** - * optional bytes base_macaroon = 1; - * This is a type-conversion wrapper around `getBaseMacaroon()` - * @return {string} - */ -proto.looprpc.L402Token.prototype.getBaseMacaroon_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getBaseMacaroon())); + * @param {!Array} value + * @return {!proto.looprpc.SuggestSwapsResponse} returns this +*/ +proto.looprpc.SuggestSwapsResponse.prototype.setLoopOutList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** - * optional bytes base_macaroon = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getBaseMacaroon()` - * @return {!Uint8Array} + * @param {!proto.looprpc.LoopOutRequest=} opt_value + * @param {number=} opt_index + * @return {!proto.looprpc.LoopOutRequest} */ -proto.looprpc.L402Token.prototype.getBaseMacaroon_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getBaseMacaroon())); +proto.looprpc.SuggestSwapsResponse.prototype.addLoopOut = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.looprpc.LoopOutRequest, opt_index); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.looprpc.L402Token} returns this + * Clears the list making it empty but non-null. + * @return {!proto.looprpc.SuggestSwapsResponse} returns this */ -proto.looprpc.L402Token.prototype.setBaseMacaroon = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.looprpc.SuggestSwapsResponse.prototype.clearLoopOutList = function() { + return this.setLoopOutList([]); }; /** - * optional bytes payment_hash = 2; - * @return {!(string|Uint8Array)} + * repeated LoopInRequest loop_in = 3; + * @return {!Array} */ -proto.looprpc.L402Token.prototype.getPaymentHash = function() { - return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.looprpc.SuggestSwapsResponse.prototype.getLoopInList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.looprpc.LoopInRequest, 3)); }; /** - * optional bytes payment_hash = 2; - * This is a type-conversion wrapper around `getPaymentHash()` - * @return {string} - */ -proto.looprpc.L402Token.prototype.getPaymentHash_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getPaymentHash())); + * @param {!Array} value + * @return {!proto.looprpc.SuggestSwapsResponse} returns this +*/ +proto.looprpc.SuggestSwapsResponse.prototype.setLoopInList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 3, value); }; /** - * optional bytes payment_hash = 2; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getPaymentHash()` - * @return {!Uint8Array} + * @param {!proto.looprpc.LoopInRequest=} opt_value + * @param {number=} opt_index + * @return {!proto.looprpc.LoopInRequest} */ -proto.looprpc.L402Token.prototype.getPaymentHash_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getPaymentHash())); +proto.looprpc.SuggestSwapsResponse.prototype.addLoopIn = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.looprpc.LoopInRequest, opt_index); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.looprpc.L402Token} returns this + * Clears the list making it empty but non-null. + * @return {!proto.looprpc.SuggestSwapsResponse} returns this */ -proto.looprpc.L402Token.prototype.setPaymentHash = function(value) { - return jspb.Message.setProto3BytesField(this, 2, value); +proto.looprpc.SuggestSwapsResponse.prototype.clearLoopInList = function() { + return this.setLoopInList([]); }; /** - * optional bytes payment_preimage = 3; - * @return {!(string|Uint8Array)} + * repeated Disqualified disqualified = 2; + * @return {!Array} */ -proto.looprpc.L402Token.prototype.getPaymentPreimage = function() { - return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +proto.looprpc.SuggestSwapsResponse.prototype.getDisqualifiedList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.looprpc.Disqualified, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.looprpc.SuggestSwapsResponse} returns this +*/ +proto.looprpc.SuggestSwapsResponse.prototype.setDisqualifiedList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 2, value); }; /** - * optional bytes payment_preimage = 3; - * This is a type-conversion wrapper around `getPaymentPreimage()` - * @return {string} + * @param {!proto.looprpc.Disqualified=} opt_value + * @param {number=} opt_index + * @return {!proto.looprpc.Disqualified} */ -proto.looprpc.L402Token.prototype.getPaymentPreimage_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getPaymentPreimage())); +proto.looprpc.SuggestSwapsResponse.prototype.addDisqualified = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.looprpc.Disqualified, opt_index); }; /** - * optional bytes payment_preimage = 3; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getPaymentPreimage()` - * @return {!Uint8Array} + * Clears the list making it empty but non-null. + * @return {!proto.looprpc.SuggestSwapsResponse} returns this */ -proto.looprpc.L402Token.prototype.getPaymentPreimage_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getPaymentPreimage())); +proto.looprpc.SuggestSwapsResponse.prototype.clearDisqualifiedList = function() { + return this.setDisqualifiedList([]); }; -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.looprpc.L402Token} returns this - */ -proto.looprpc.L402Token.prototype.setPaymentPreimage = function(value) { - return jspb.Message.setProto3BytesField(this, 3, value); -}; + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * optional int64 amount_paid_msat = 4; - * @return {string} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.looprpc.L402Token.prototype.getAmountPaidMsat = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "0")); +proto.looprpc.AbandonSwapRequest.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.AbandonSwapRequest.toObject(opt_includeInstance, this); }; /** - * @param {string} value - * @return {!proto.looprpc.L402Token} returns this + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.looprpc.AbandonSwapRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.L402Token.prototype.setAmountPaidMsat = function(value) { - return jspb.Message.setProto3StringIntField(this, 4, value); +proto.looprpc.AbandonSwapRequest.toObject = function(includeInstance, msg) { + var f, obj = { + id: msg.getId_asB64(), + iKnowWhatIAmDoing: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * optional int64 routing_fee_paid_msat = 5; - * @return {string} + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.looprpc.AbandonSwapRequest} */ -proto.looprpc.L402Token.prototype.getRoutingFeePaidMsat = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "0")); +proto.looprpc.AbandonSwapRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.looprpc.AbandonSwapRequest; + return proto.looprpc.AbandonSwapRequest.deserializeBinaryFromReader(msg, reader); }; /** - * @param {string} value - * @return {!proto.looprpc.L402Token} returns this + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.looprpc.AbandonSwapRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.AbandonSwapRequest} */ -proto.looprpc.L402Token.prototype.setRoutingFeePaidMsat = function(value) { - return jspb.Message.setProto3StringIntField(this, 5, value); +proto.looprpc.AbandonSwapRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setId(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setIKnowWhatIAmDoing(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * optional int64 time_created = 6; - * @return {string} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.looprpc.L402Token.prototype.getTimeCreated = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "0")); +proto.looprpc.AbandonSwapRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.AbandonSwapRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * @param {string} value - * @return {!proto.looprpc.L402Token} returns this + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.AbandonSwapRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.L402Token.prototype.setTimeCreated = function(value) { - return jspb.Message.setProto3StringIntField(this, 6, value); +proto.looprpc.AbandonSwapRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getIKnowWhatIAmDoing(); + if (f) { + writer.writeBool( + 2, + f + ); + } }; /** - * optional bool expired = 7; - * @return {boolean} + * optional bytes id = 1; + * @return {!(string|Uint8Array)} */ -proto.looprpc.L402Token.prototype.getExpired = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 7, false)); +proto.looprpc.AbandonSwapRequest.prototype.getId = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * @param {boolean} value - * @return {!proto.looprpc.L402Token} returns this + * optional bytes id = 1; + * This is a type-conversion wrapper around `getId()` + * @return {string} */ -proto.looprpc.L402Token.prototype.setExpired = function(value) { - return jspb.Message.setProto3BooleanField(this, 7, value); +proto.looprpc.AbandonSwapRequest.prototype.getId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getId())); }; /** - * optional string storage_name = 8; - * @return {string} + * optional bytes id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getId()` + * @return {!Uint8Array} */ -proto.looprpc.L402Token.prototype.getStorageName = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 8, "")); +proto.looprpc.AbandonSwapRequest.prototype.getId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getId())); }; /** - * @param {string} value - * @return {!proto.looprpc.L402Token} returns this + * @param {!(string|Uint8Array)} value + * @return {!proto.looprpc.AbandonSwapRequest} returns this */ -proto.looprpc.L402Token.prototype.setStorageName = function(value) { - return jspb.Message.setProto3StringField(this, 8, value); +proto.looprpc.AbandonSwapRequest.prototype.setId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * optional string id = 9; - * @return {string} + * optional bool i_know_what_i_am_doing = 2; + * @return {boolean} */ -proto.looprpc.L402Token.prototype.getId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 9, "")); +proto.looprpc.AbandonSwapRequest.prototype.getIKnowWhatIAmDoing = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** - * @param {string} value - * @return {!proto.looprpc.L402Token} returns this + * @param {boolean} value + * @return {!proto.looprpc.AbandonSwapRequest} returns this */ -proto.looprpc.L402Token.prototype.setId = function(value) { - return jspb.Message.setProto3StringField(this, 9, value); +proto.looprpc.AbandonSwapRequest.prototype.setIKnowWhatIAmDoing = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); }; @@ -6474,8 +10172,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.LoopStats.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.LoopStats.toObject(opt_includeInstance, this); +proto.looprpc.AbandonSwapResponse.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.AbandonSwapResponse.toObject(opt_includeInstance, this); }; @@ -6484,17 +10182,13 @@ proto.looprpc.LoopStats.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.LoopStats} msg The msg instance to transform. + * @param {!proto.looprpc.AbandonSwapResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.LoopStats.toObject = function(includeInstance, msg) { +proto.looprpc.AbandonSwapResponse.toObject = function(includeInstance, msg) { var f, obj = { - pendingCount: jspb.Message.getFieldWithDefault(msg, 1, "0"), - successCount: jspb.Message.getFieldWithDefault(msg, 2, "0"), - failCount: jspb.Message.getFieldWithDefault(msg, 3, "0"), - sumPendingAmt: jspb.Message.getFieldWithDefault(msg, 4, "0"), - sumSucceededAmt: jspb.Message.getFieldWithDefault(msg, 5, "0") + }; if (includeInstance) { @@ -6508,49 +10202,29 @@ proto.looprpc.LoopStats.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.LoopStats} + * @return {!proto.looprpc.AbandonSwapResponse} */ -proto.looprpc.LoopStats.deserializeBinary = function(bytes) { +proto.looprpc.AbandonSwapResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.LoopStats; - return proto.looprpc.LoopStats.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.AbandonSwapResponse; + return proto.looprpc.AbandonSwapResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.LoopStats} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.LoopStats} - */ -proto.looprpc.LoopStats.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readUint64String()); - msg.setPendingCount(value); - break; - case 2: - var value = /** @type {string} */ (reader.readUint64String()); - msg.setSuccessCount(value); - break; - case 3: - var value = /** @type {string} */ (reader.readUint64String()); - msg.setFailCount(value); - break; - case 4: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setSumPendingAmt(value); - break; - case 5: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setSumSucceededAmt(value); + * @param {!proto.looprpc.AbandonSwapResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.AbandonSwapResponse} + */ +proto.looprpc.AbandonSwapResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { break; + } + var field = reader.getFieldNumber(); + switch (field) { default: reader.skipField(); break; @@ -6564,9 +10238,9 @@ proto.looprpc.LoopStats.deserializeBinaryFromReader = function(msg, reader) { * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.LoopStats.prototype.serializeBinary = function() { +proto.looprpc.AbandonSwapResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.LoopStats.serializeBinaryToWriter(this, writer); + proto.looprpc.AbandonSwapResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -6574,140 +10248,123 @@ proto.looprpc.LoopStats.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.LoopStats} message + * @param {!proto.looprpc.AbandonSwapResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.LoopStats.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.AbandonSwapResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getPendingCount(); - if (parseInt(f, 10) !== 0) { - writer.writeUint64String( - 1, - f - ); - } - f = message.getSuccessCount(); - if (parseInt(f, 10) !== 0) { - writer.writeUint64String( - 2, - f - ); - } - f = message.getFailCount(); - if (parseInt(f, 10) !== 0) { - writer.writeUint64String( - 3, - f - ); - } - f = message.getSumPendingAmt(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 4, - f - ); - } - f = message.getSumSucceededAmt(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 5, - f - ); - } }; -/** - * optional uint64 pending_count = 1; - * @return {string} - */ -proto.looprpc.LoopStats.prototype.getPendingCount = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0")); -}; - -/** - * @param {string} value - * @return {!proto.looprpc.LoopStats} returns this - */ -proto.looprpc.LoopStats.prototype.setPendingCount = function(value) { - return jspb.Message.setProto3StringIntField(this, 1, value); -}; +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * optional uint64 success_count = 2; - * @return {string} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.looprpc.LoopStats.prototype.getSuccessCount = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "0")); +proto.looprpc.ListReservationsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.ListReservationsRequest.toObject(opt_includeInstance, this); }; /** - * @param {string} value - * @return {!proto.looprpc.LoopStats} returns this + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.looprpc.ListReservationsRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.LoopStats.prototype.setSuccessCount = function(value) { - return jspb.Message.setProto3StringIntField(this, 2, value); -}; +proto.looprpc.ListReservationsRequest.toObject = function(includeInstance, msg) { + var f, obj = { + }; -/** - * optional uint64 fail_count = 3; - * @return {string} - */ -proto.looprpc.LoopStats.prototype.getFailCount = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "0")); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * @param {string} value - * @return {!proto.looprpc.LoopStats} returns this + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.looprpc.ListReservationsRequest} */ -proto.looprpc.LoopStats.prototype.setFailCount = function(value) { - return jspb.Message.setProto3StringIntField(this, 3, value); +proto.looprpc.ListReservationsRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.looprpc.ListReservationsRequest; + return proto.looprpc.ListReservationsRequest.deserializeBinaryFromReader(msg, reader); }; /** - * optional int64 sum_pending_amt = 4; - * @return {string} + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.looprpc.ListReservationsRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.ListReservationsRequest} */ -proto.looprpc.LoopStats.prototype.getSumPendingAmt = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "0")); +proto.looprpc.ListReservationsRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * @param {string} value - * @return {!proto.looprpc.LoopStats} returns this + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.looprpc.LoopStats.prototype.setSumPendingAmt = function(value) { - return jspb.Message.setProto3StringIntField(this, 4, value); +proto.looprpc.ListReservationsRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.ListReservationsRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * optional int64 sum_succeeded_amt = 5; - * @return {string} + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.ListReservationsRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.LoopStats.prototype.getSumSucceededAmt = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "0")); +proto.looprpc.ListReservationsRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; }; + /** - * @param {string} value - * @return {!proto.looprpc.LoopStats} returns this + * List of repeated fields within this message type. + * @private {!Array} + * @const */ -proto.looprpc.LoopStats.prototype.setSumSucceededAmt = function(value) { - return jspb.Message.setProto3StringIntField(this, 5, value); -}; - - +proto.looprpc.ListReservationsResponse.repeatedFields_ = [1]; @@ -6724,8 +10381,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.GetInfoRequest.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.GetInfoRequest.toObject(opt_includeInstance, this); +proto.looprpc.ListReservationsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.ListReservationsResponse.toObject(opt_includeInstance, this); }; @@ -6734,13 +10391,14 @@ proto.looprpc.GetInfoRequest.prototype.toObject = function(opt_includeInstance) * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.GetInfoRequest} msg The msg instance to transform. + * @param {!proto.looprpc.ListReservationsResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.GetInfoRequest.toObject = function(includeInstance, msg) { +proto.looprpc.ListReservationsResponse.toObject = function(includeInstance, msg) { var f, obj = { - + reservationsList: jspb.Message.toObjectList(msg.getReservationsList(), + proto.looprpc.ClientReservation.toObject, includeInstance) }; if (includeInstance) { @@ -6754,29 +10412,34 @@ proto.looprpc.GetInfoRequest.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.GetInfoRequest} + * @return {!proto.looprpc.ListReservationsResponse} */ -proto.looprpc.GetInfoRequest.deserializeBinary = function(bytes) { +proto.looprpc.ListReservationsResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.GetInfoRequest; - return proto.looprpc.GetInfoRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.ListReservationsResponse; + return proto.looprpc.ListReservationsResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.GetInfoRequest} msg The message object to deserialize into. + * @param {!proto.looprpc.ListReservationsResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.GetInfoRequest} + * @return {!proto.looprpc.ListReservationsResponse} */ -proto.looprpc.GetInfoRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.ListReservationsResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { + case 1: + var value = new proto.looprpc.ClientReservation; + reader.readMessage(value,proto.looprpc.ClientReservation.deserializeBinaryFromReader); + msg.addReservations(value); + break; default: reader.skipField(); break; @@ -6790,9 +10453,9 @@ proto.looprpc.GetInfoRequest.deserializeBinaryFromReader = function(msg, reader) * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.GetInfoRequest.prototype.serializeBinary = function() { +proto.looprpc.ListReservationsResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.GetInfoRequest.serializeBinaryToWriter(this, writer); + proto.looprpc.ListReservationsResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -6800,12 +10463,58 @@ proto.looprpc.GetInfoRequest.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.GetInfoRequest} message + * @param {!proto.looprpc.ListReservationsResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.GetInfoRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; +proto.looprpc.ListReservationsResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getReservationsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.looprpc.ClientReservation.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated ClientReservation reservations = 1; + * @return {!Array} + */ +proto.looprpc.ListReservationsResponse.prototype.getReservationsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.looprpc.ClientReservation, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.looprpc.ListReservationsResponse} returns this +*/ +proto.looprpc.ListReservationsResponse.prototype.setReservationsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.looprpc.ClientReservation=} opt_value + * @param {number=} opt_index + * @return {!proto.looprpc.ClientReservation} + */ +proto.looprpc.ListReservationsResponse.prototype.addReservations = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.looprpc.ClientReservation, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.looprpc.ListReservationsResponse} returns this + */ +proto.looprpc.ListReservationsResponse.prototype.clearReservationsList = function() { + return this.setReservationsList([]); }; @@ -6825,8 +10534,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.GetInfoResponse.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.GetInfoResponse.toObject(opt_includeInstance, this); +proto.looprpc.ClientReservation.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.ClientReservation.toObject(opt_includeInstance, this); }; @@ -6835,20 +10544,18 @@ proto.looprpc.GetInfoResponse.prototype.toObject = function(opt_includeInstance) * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.GetInfoResponse} msg The msg instance to transform. + * @param {!proto.looprpc.ClientReservation} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.GetInfoResponse.toObject = function(includeInstance, msg) { +proto.looprpc.ClientReservation.toObject = function(includeInstance, msg) { var f, obj = { - version: jspb.Message.getFieldWithDefault(msg, 1, ""), - network: jspb.Message.getFieldWithDefault(msg, 2, ""), - rpcListen: jspb.Message.getFieldWithDefault(msg, 3, ""), - restListen: jspb.Message.getFieldWithDefault(msg, 4, ""), - macaroonPath: jspb.Message.getFieldWithDefault(msg, 5, ""), - tlsCertPath: jspb.Message.getFieldWithDefault(msg, 6, ""), - loopOutStats: (f = msg.getLoopOutStats()) && proto.looprpc.LoopStats.toObject(includeInstance, f), - loopInStats: (f = msg.getLoopInStats()) && proto.looprpc.LoopStats.toObject(includeInstance, f) + reservationId: msg.getReservationId_asB64(), + state: jspb.Message.getFieldWithDefault(msg, 2, ""), + amount: jspb.Message.getFieldWithDefault(msg, 3, "0"), + txId: jspb.Message.getFieldWithDefault(msg, 4, ""), + vout: jspb.Message.getFieldWithDefault(msg, 5, 0), + expiry: jspb.Message.getFieldWithDefault(msg, 6, 0) }; if (includeInstance) { @@ -6862,23 +10569,23 @@ proto.looprpc.GetInfoResponse.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.GetInfoResponse} + * @return {!proto.looprpc.ClientReservation} */ -proto.looprpc.GetInfoResponse.deserializeBinary = function(bytes) { +proto.looprpc.ClientReservation.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.GetInfoResponse; - return proto.looprpc.GetInfoResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.ClientReservation; + return proto.looprpc.ClientReservation.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.GetInfoResponse} msg The message object to deserialize into. + * @param {!proto.looprpc.ClientReservation} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.GetInfoResponse} + * @return {!proto.looprpc.ClientReservation} */ -proto.looprpc.GetInfoResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.ClientReservation.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -6886,38 +10593,28 @@ proto.looprpc.GetInfoResponse.deserializeBinaryFromReader = function(msg, reader var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setVersion(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setReservationId(value); break; case 2: var value = /** @type {string} */ (reader.readString()); - msg.setNetwork(value); + msg.setState(value); break; case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setRpcListen(value); + var value = /** @type {string} */ (reader.readUint64String()); + msg.setAmount(value); break; case 4: var value = /** @type {string} */ (reader.readString()); - msg.setRestListen(value); + msg.setTxId(value); break; case 5: - var value = /** @type {string} */ (reader.readString()); - msg.setMacaroonPath(value); + var value = /** @type {number} */ (reader.readUint32()); + msg.setVout(value); break; case 6: - var value = /** @type {string} */ (reader.readString()); - msg.setTlsCertPath(value); - break; - case 7: - var value = new proto.looprpc.LoopStats; - reader.readMessage(value,proto.looprpc.LoopStats.deserializeBinaryFromReader); - msg.setLoopOutStats(value); - break; - case 8: - var value = new proto.looprpc.LoopStats; - reader.readMessage(value,proto.looprpc.LoopStats.deserializeBinaryFromReader); - msg.setLoopInStats(value); + var value = /** @type {number} */ (reader.readUint32()); + msg.setExpiry(value); break; default: reader.skipField(); @@ -6932,9 +10629,9 @@ proto.looprpc.GetInfoResponse.deserializeBinaryFromReader = function(msg, reader * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.GetInfoResponse.prototype.serializeBinary = function() { +proto.looprpc.ClientReservation.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.GetInfoResponse.serializeBinaryToWriter(this, writer); + proto.looprpc.ClientReservation.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -6942,256 +10639,197 @@ proto.looprpc.GetInfoResponse.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.GetInfoResponse} message + * @param {!proto.looprpc.ClientReservation} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.GetInfoResponse.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.ClientReservation.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getVersion(); + f = message.getReservationId_asU8(); if (f.length > 0) { - writer.writeString( + writer.writeBytes( 1, f ); } - f = message.getNetwork(); + f = message.getState(); if (f.length > 0) { writer.writeString( 2, f ); } - f = message.getRpcListen(); - if (f.length > 0) { - writer.writeString( + f = message.getAmount(); + if (parseInt(f, 10) !== 0) { + writer.writeUint64String( 3, f ); } - f = message.getRestListen(); + f = message.getTxId(); if (f.length > 0) { writer.writeString( 4, f ); } - f = message.getMacaroonPath(); - if (f.length > 0) { - writer.writeString( + f = message.getVout(); + if (f !== 0) { + writer.writeUint32( 5, f ); } - f = message.getTlsCertPath(); - if (f.length > 0) { - writer.writeString( + f = message.getExpiry(); + if (f !== 0) { + writer.writeUint32( 6, f ); } - f = message.getLoopOutStats(); - if (f != null) { - writer.writeMessage( - 7, - f, - proto.looprpc.LoopStats.serializeBinaryToWriter - ); - } - f = message.getLoopInStats(); - if (f != null) { - writer.writeMessage( - 8, - f, - proto.looprpc.LoopStats.serializeBinaryToWriter - ); - } -}; - - -/** - * optional string version = 1; - * @return {string} - */ -proto.looprpc.GetInfoResponse.prototype.getVersion = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * @param {string} value - * @return {!proto.looprpc.GetInfoResponse} returns this + * optional bytes reservation_id = 1; + * @return {!(string|Uint8Array)} */ -proto.looprpc.GetInfoResponse.prototype.setVersion = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); +proto.looprpc.ClientReservation.prototype.getReservationId = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional string network = 2; + * optional bytes reservation_id = 1; + * This is a type-conversion wrapper around `getReservationId()` * @return {string} */ -proto.looprpc.GetInfoResponse.prototype.getNetwork = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.looprpc.GetInfoResponse} returns this - */ -proto.looprpc.GetInfoResponse.prototype.setNetwork = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); +proto.looprpc.ClientReservation.prototype.getReservationId_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getReservationId())); }; /** - * optional string rpc_listen = 3; - * @return {string} + * optional bytes reservation_id = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getReservationId()` + * @return {!Uint8Array} */ -proto.looprpc.GetInfoResponse.prototype.getRpcListen = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +proto.looprpc.ClientReservation.prototype.getReservationId_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getReservationId())); }; /** - * @param {string} value - * @return {!proto.looprpc.GetInfoResponse} returns this + * @param {!(string|Uint8Array)} value + * @return {!proto.looprpc.ClientReservation} returns this */ -proto.looprpc.GetInfoResponse.prototype.setRpcListen = function(value) { - return jspb.Message.setProto3StringField(this, 3, value); +proto.looprpc.ClientReservation.prototype.setReservationId = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * optional string rest_listen = 4; + * optional string state = 2; * @return {string} */ -proto.looprpc.GetInfoResponse.prototype.getRestListen = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +proto.looprpc.ClientReservation.prototype.getState = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * @param {string} value - * @return {!proto.looprpc.GetInfoResponse} returns this + * @return {!proto.looprpc.ClientReservation} returns this */ -proto.looprpc.GetInfoResponse.prototype.setRestListen = function(value) { - return jspb.Message.setProto3StringField(this, 4, value); +proto.looprpc.ClientReservation.prototype.setState = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); }; /** - * optional string macaroon_path = 5; + * optional uint64 amount = 3; * @return {string} */ -proto.looprpc.GetInfoResponse.prototype.getMacaroonPath = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +proto.looprpc.ClientReservation.prototype.getAmount = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "0")); }; /** * @param {string} value - * @return {!proto.looprpc.GetInfoResponse} returns this + * @return {!proto.looprpc.ClientReservation} returns this */ -proto.looprpc.GetInfoResponse.prototype.setMacaroonPath = function(value) { - return jspb.Message.setProto3StringField(this, 5, value); +proto.looprpc.ClientReservation.prototype.setAmount = function(value) { + return jspb.Message.setProto3StringIntField(this, 3, value); }; /** - * optional string tls_cert_path = 6; + * optional string tx_id = 4; * @return {string} */ -proto.looprpc.GetInfoResponse.prototype.getTlsCertPath = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +proto.looprpc.ClientReservation.prototype.getTxId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; /** * @param {string} value - * @return {!proto.looprpc.GetInfoResponse} returns this - */ -proto.looprpc.GetInfoResponse.prototype.setTlsCertPath = function(value) { - return jspb.Message.setProto3StringField(this, 6, value); -}; - - -/** - * optional LoopStats loop_out_stats = 7; - * @return {?proto.looprpc.LoopStats} - */ -proto.looprpc.GetInfoResponse.prototype.getLoopOutStats = function() { - return /** @type{?proto.looprpc.LoopStats} */ ( - jspb.Message.getWrapperField(this, proto.looprpc.LoopStats, 7)); -}; - - -/** - * @param {?proto.looprpc.LoopStats|undefined} value - * @return {!proto.looprpc.GetInfoResponse} returns this -*/ -proto.looprpc.GetInfoResponse.prototype.setLoopOutStats = function(value) { - return jspb.Message.setWrapperField(this, 7, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.looprpc.GetInfoResponse} returns this - */ -proto.looprpc.GetInfoResponse.prototype.clearLoopOutStats = function() { - return this.setLoopOutStats(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} + * @return {!proto.looprpc.ClientReservation} returns this */ -proto.looprpc.GetInfoResponse.prototype.hasLoopOutStats = function() { - return jspb.Message.getField(this, 7) != null; +proto.looprpc.ClientReservation.prototype.setTxId = function(value) { + return jspb.Message.setProto3StringField(this, 4, value); }; /** - * optional LoopStats loop_in_stats = 8; - * @return {?proto.looprpc.LoopStats} - */ -proto.looprpc.GetInfoResponse.prototype.getLoopInStats = function() { - return /** @type{?proto.looprpc.LoopStats} */ ( - jspb.Message.getWrapperField(this, proto.looprpc.LoopStats, 8)); + * optional uint32 vout = 5; + * @return {number} + */ +proto.looprpc.ClientReservation.prototype.getVout = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); }; /** - * @param {?proto.looprpc.LoopStats|undefined} value - * @return {!proto.looprpc.GetInfoResponse} returns this -*/ -proto.looprpc.GetInfoResponse.prototype.setLoopInStats = function(value) { - return jspb.Message.setWrapperField(this, 8, value); + * @param {number} value + * @return {!proto.looprpc.ClientReservation} returns this + */ +proto.looprpc.ClientReservation.prototype.setVout = function(value) { + return jspb.Message.setProto3IntField(this, 5, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.looprpc.GetInfoResponse} returns this + * optional uint32 expiry = 6; + * @return {number} */ -proto.looprpc.GetInfoResponse.prototype.clearLoopInStats = function() { - return this.setLoopInStats(undefined); +proto.looprpc.ClientReservation.prototype.getExpiry = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {number} value + * @return {!proto.looprpc.ClientReservation} returns this */ -proto.looprpc.GetInfoResponse.prototype.hasLoopInStats = function() { - return jspb.Message.getField(this, 8) != null; +proto.looprpc.ClientReservation.prototype.setExpiry = function(value) { + return jspb.Message.setProto3IntField(this, 6, value); }; +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.looprpc.InstantOutRequest.repeatedFields_ = [1,2]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -7207,8 +10845,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.GetLiquidityParamsRequest.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.GetLiquidityParamsRequest.toObject(opt_includeInstance, this); +proto.looprpc.InstantOutRequest.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.InstantOutRequest.toObject(opt_includeInstance, this); }; @@ -7217,13 +10855,15 @@ proto.looprpc.GetLiquidityParamsRequest.prototype.toObject = function(opt_includ * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.GetLiquidityParamsRequest} msg The msg instance to transform. + * @param {!proto.looprpc.InstantOutRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.GetLiquidityParamsRequest.toObject = function(includeInstance, msg) { +proto.looprpc.InstantOutRequest.toObject = function(includeInstance, msg) { var f, obj = { - + reservationIdsList: msg.getReservationIdsList_asB64(), + outgoingChanSetList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f, + destAddr: jspb.Message.getFieldWithDefault(msg, 3, "") }; if (includeInstance) { @@ -7237,29 +10877,43 @@ proto.looprpc.GetLiquidityParamsRequest.toObject = function(includeInstance, msg /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.GetLiquidityParamsRequest} + * @return {!proto.looprpc.InstantOutRequest} */ -proto.looprpc.GetLiquidityParamsRequest.deserializeBinary = function(bytes) { +proto.looprpc.InstantOutRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.GetLiquidityParamsRequest; - return proto.looprpc.GetLiquidityParamsRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.InstantOutRequest; + return proto.looprpc.InstantOutRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.GetLiquidityParamsRequest} msg The message object to deserialize into. + * @param {!proto.looprpc.InstantOutRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.GetLiquidityParamsRequest} + * @return {!proto.looprpc.InstantOutRequest} */ -proto.looprpc.GetLiquidityParamsRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.InstantOutRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addReservationIds(value); + break; + case 2: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedUint64String() : [reader.readUint64String()]); + for (var i = 0; i < values.length; i++) { + msg.addOutgoingChanSet(values[i]); + } + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setDestAddr(value); + break; default: reader.skipField(); break; @@ -7273,9 +10927,9 @@ proto.looprpc.GetLiquidityParamsRequest.deserializeBinaryFromReader = function(m * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.GetLiquidityParamsRequest.prototype.serializeBinary = function() { +proto.looprpc.InstantOutRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.GetLiquidityParamsRequest.serializeBinaryToWriter(this, writer); + proto.looprpc.InstantOutRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -7283,22 +10937,152 @@ proto.looprpc.GetLiquidityParamsRequest.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.GetLiquidityParamsRequest} message + * @param {!proto.looprpc.InstantOutRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.GetLiquidityParamsRequest.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.InstantOutRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; + f = message.getReservationIdsList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( + 1, + f + ); + } + f = message.getOutgoingChanSetList(); + if (f.length > 0) { + writer.writePackedUint64String( + 2, + f + ); + } + f = message.getDestAddr(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } }; +/** + * repeated bytes reservation_ids = 1; + * @return {!(Array|Array)} + */ +proto.looprpc.InstantOutRequest.prototype.getReservationIdsList = function() { + return /** @type {!(Array|Array)} */ (jspb.Message.getRepeatedField(this, 1)); +}; + /** - * List of repeated fields within this message type. - * @private {!Array} - * @const + * repeated bytes reservation_ids = 1; + * This is a type-conversion wrapper around `getReservationIdsList()` + * @return {!Array} */ -proto.looprpc.LiquidityParameters.repeatedFields_ = [1]; +proto.looprpc.InstantOutRequest.prototype.getReservationIdsList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getReservationIdsList())); +}; + + +/** + * repeated bytes reservation_ids = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getReservationIdsList()` + * @return {!Array} + */ +proto.looprpc.InstantOutRequest.prototype.getReservationIdsList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getReservationIdsList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.looprpc.InstantOutRequest} returns this + */ +proto.looprpc.InstantOutRequest.prototype.setReservationIdsList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.looprpc.InstantOutRequest} returns this + */ +proto.looprpc.InstantOutRequest.prototype.addReservationIds = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.looprpc.InstantOutRequest} returns this + */ +proto.looprpc.InstantOutRequest.prototype.clearReservationIdsList = function() { + return this.setReservationIdsList([]); +}; + + +/** + * repeated uint64 outgoing_chan_set = 2; + * @return {!Array} + */ +proto.looprpc.InstantOutRequest.prototype.getOutgoingChanSetList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.looprpc.InstantOutRequest} returns this + */ +proto.looprpc.InstantOutRequest.prototype.setOutgoingChanSetList = function(value) { + return jspb.Message.setField(this, 2, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.looprpc.InstantOutRequest} returns this + */ +proto.looprpc.InstantOutRequest.prototype.addOutgoingChanSet = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.looprpc.InstantOutRequest} returns this + */ +proto.looprpc.InstantOutRequest.prototype.clearOutgoingChanSetList = function() { + return this.setOutgoingChanSetList([]); +}; + + +/** + * optional string dest_addr = 3; + * @return {string} + */ +proto.looprpc.InstantOutRequest.prototype.getDestAddr = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.InstantOutRequest} returns this + */ +proto.looprpc.InstantOutRequest.prototype.setDestAddr = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + @@ -7315,8 +11099,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.LiquidityParameters.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.LiquidityParameters.toObject(opt_includeInstance, this); +proto.looprpc.InstantOutResponse.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.InstantOutResponse.toObject(opt_includeInstance, this); }; @@ -7325,37 +11109,15 @@ proto.looprpc.LiquidityParameters.prototype.toObject = function(opt_includeInsta * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.LiquidityParameters} msg The msg instance to transform. + * @param {!proto.looprpc.InstantOutResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.LiquidityParameters.toObject = function(includeInstance, msg) { +proto.looprpc.InstantOutResponse.toObject = function(includeInstance, msg) { var f, obj = { - rulesList: jspb.Message.toObjectList(msg.getRulesList(), - proto.looprpc.LiquidityRule.toObject, includeInstance), - feePpm: jspb.Message.getFieldWithDefault(msg, 16, "0"), - sweepFeeRateSatPerVbyte: jspb.Message.getFieldWithDefault(msg, 2, "0"), - maxSwapFeePpm: jspb.Message.getFieldWithDefault(msg, 3, "0"), - maxRoutingFeePpm: jspb.Message.getFieldWithDefault(msg, 4, "0"), - maxPrepayRoutingFeePpm: jspb.Message.getFieldWithDefault(msg, 5, "0"), - maxPrepaySat: jspb.Message.getFieldWithDefault(msg, 6, "0"), - maxMinerFeeSat: jspb.Message.getFieldWithDefault(msg, 7, "0"), - sweepConfTarget: jspb.Message.getFieldWithDefault(msg, 8, 0), - failureBackoffSec: jspb.Message.getFieldWithDefault(msg, 9, "0"), - autoloop: jspb.Message.getBooleanFieldWithDefault(msg, 10, false), - autoloopBudgetSat: jspb.Message.getFieldWithDefault(msg, 11, "0"), - autoloopBudgetStartSec: jspb.Message.getFieldWithDefault(msg, 12, "0"), - autoMaxInFlight: jspb.Message.getFieldWithDefault(msg, 13, "0"), - minSwapAmount: jspb.Message.getFieldWithDefault(msg, 14, "0"), - maxSwapAmount: jspb.Message.getFieldWithDefault(msg, 15, "0"), - htlcConfTarget: jspb.Message.getFieldWithDefault(msg, 17, 0), - autoloopDestAddress: jspb.Message.getFieldWithDefault(msg, 18, ""), - autoloopBudgetRefreshPeriodSec: jspb.Message.getFieldWithDefault(msg, 19, "0"), - autoloopBudgetLastRefresh: jspb.Message.getFieldWithDefault(msg, 20, "0"), - easyAutoloop: jspb.Message.getBooleanFieldWithDefault(msg, 21, false), - easyAutoloopLocalTargetSat: jspb.Message.getFieldWithDefault(msg, 22, "0"), - account: jspb.Message.getFieldWithDefault(msg, 23, ""), - accountAddrType: jspb.Message.getFieldWithDefault(msg, 24, 0) + instantOutHash: msg.getInstantOutHash_asB64(), + sweepTxId: jspb.Message.getFieldWithDefault(msg, 2, ""), + state: jspb.Message.getFieldWithDefault(msg, 3, "") }; if (includeInstance) { @@ -7369,321 +11131,88 @@ proto.looprpc.LiquidityParameters.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.LiquidityParameters} + * @return {!proto.looprpc.InstantOutResponse} */ -proto.looprpc.LiquidityParameters.deserializeBinary = function(bytes) { +proto.looprpc.InstantOutResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.LiquidityParameters; - return proto.looprpc.LiquidityParameters.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.InstantOutResponse; + return proto.looprpc.InstantOutResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.LiquidityParameters} msg The message object to deserialize into. + * @param {!proto.looprpc.InstantOutResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.LiquidityParameters} + * @return {!proto.looprpc.InstantOutResponse} */ -proto.looprpc.LiquidityParameters.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.InstantOutResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.looprpc.LiquidityRule; - reader.readMessage(value,proto.looprpc.LiquidityRule.deserializeBinaryFromReader); - msg.addRules(value); - break; - case 16: - var value = /** @type {string} */ (reader.readUint64String()); - msg.setFeePpm(value); - break; - case 2: - var value = /** @type {string} */ (reader.readUint64String()); - msg.setSweepFeeRateSatPerVbyte(value); - break; - case 3: - var value = /** @type {string} */ (reader.readUint64String()); - msg.setMaxSwapFeePpm(value); - break; - case 4: - var value = /** @type {string} */ (reader.readUint64String()); - msg.setMaxRoutingFeePpm(value); - break; - case 5: - var value = /** @type {string} */ (reader.readUint64String()); - msg.setMaxPrepayRoutingFeePpm(value); - break; - case 6: - var value = /** @type {string} */ (reader.readUint64String()); - msg.setMaxPrepaySat(value); - break; - case 7: - var value = /** @type {string} */ (reader.readUint64String()); - msg.setMaxMinerFeeSat(value); - break; - case 8: - var value = /** @type {number} */ (reader.readInt32()); - msg.setSweepConfTarget(value); - break; - case 9: - var value = /** @type {string} */ (reader.readUint64String()); - msg.setFailureBackoffSec(value); - break; - case 10: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setAutoloop(value); - break; - case 11: - var value = /** @type {string} */ (reader.readUint64String()); - msg.setAutoloopBudgetSat(value); - break; - case 12: - var value = /** @type {string} */ (reader.readUint64String()); - msg.setAutoloopBudgetStartSec(value); - break; - case 13: - var value = /** @type {string} */ (reader.readUint64String()); - msg.setAutoMaxInFlight(value); - break; - case 14: - var value = /** @type {string} */ (reader.readUint64String()); - msg.setMinSwapAmount(value); - break; - case 15: - var value = /** @type {string} */ (reader.readUint64String()); - msg.setMaxSwapAmount(value); - break; - case 17: - var value = /** @type {number} */ (reader.readInt32()); - msg.setHtlcConfTarget(value); - break; - case 18: - var value = /** @type {string} */ (reader.readString()); - msg.setAutoloopDestAddress(value); - break; - case 19: - var value = /** @type {string} */ (reader.readUint64String()); - msg.setAutoloopBudgetRefreshPeriodSec(value); - break; - case 20: - var value = /** @type {string} */ (reader.readUint64String()); - msg.setAutoloopBudgetLastRefresh(value); - break; - case 21: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setEasyAutoloop(value); - break; - case 22: - var value = /** @type {string} */ (reader.readUint64String()); - msg.setEasyAutoloopLocalTargetSat(value); - break; - case 23: - var value = /** @type {string} */ (reader.readString()); - msg.setAccount(value); - break; - case 24: - var value = /** @type {!proto.looprpc.AddressType} */ (reader.readEnum()); - msg.setAccountAddrType(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.looprpc.LiquidityParameters.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.LiquidityParameters.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.LiquidityParameters} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.LiquidityParameters.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getRulesList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 1, - f, - proto.looprpc.LiquidityRule.serializeBinaryToWriter - ); - } - f = message.getFeePpm(); - if (parseInt(f, 10) !== 0) { - writer.writeUint64String( - 16, - f - ); - } - f = message.getSweepFeeRateSatPerVbyte(); - if (parseInt(f, 10) !== 0) { - writer.writeUint64String( - 2, - f - ); - } - f = message.getMaxSwapFeePpm(); - if (parseInt(f, 10) !== 0) { - writer.writeUint64String( - 3, - f - ); - } - f = message.getMaxRoutingFeePpm(); - if (parseInt(f, 10) !== 0) { - writer.writeUint64String( - 4, - f - ); - } - f = message.getMaxPrepayRoutingFeePpm(); - if (parseInt(f, 10) !== 0) { - writer.writeUint64String( - 5, - f - ); - } - f = message.getMaxPrepaySat(); - if (parseInt(f, 10) !== 0) { - writer.writeUint64String( - 6, - f - ); - } - f = message.getMaxMinerFeeSat(); - if (parseInt(f, 10) !== 0) { - writer.writeUint64String( - 7, - f - ); - } - f = message.getSweepConfTarget(); - if (f !== 0) { - writer.writeInt32( - 8, - f - ); - } - f = message.getFailureBackoffSec(); - if (parseInt(f, 10) !== 0) { - writer.writeUint64String( - 9, - f - ); - } - f = message.getAutoloop(); - if (f) { - writer.writeBool( - 10, - f - ); - } - f = message.getAutoloopBudgetSat(); - if (parseInt(f, 10) !== 0) { - writer.writeUint64String( - 11, - f - ); - } - f = message.getAutoloopBudgetStartSec(); - if (parseInt(f, 10) !== 0) { - writer.writeUint64String( - 12, - f - ); - } - f = message.getAutoMaxInFlight(); - if (parseInt(f, 10) !== 0) { - writer.writeUint64String( - 13, - f - ); - } - f = message.getMinSwapAmount(); - if (parseInt(f, 10) !== 0) { - writer.writeUint64String( - 14, - f - ); - } - f = message.getMaxSwapAmount(); - if (parseInt(f, 10) !== 0) { - writer.writeUint64String( - 15, - f - ); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setInstantOutHash(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setSweepTxId(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setState(value); + break; + default: + reader.skipField(); + break; + } } - f = message.getHtlcConfTarget(); - if (f !== 0) { - writer.writeInt32( - 17, + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.looprpc.InstantOutResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.InstantOutResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.InstantOutResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.InstantOutResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getInstantOutHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, f ); } - f = message.getAutoloopDestAddress(); + f = message.getSweepTxId(); if (f.length > 0) { writer.writeString( - 18, - f - ); - } - f = message.getAutoloopBudgetRefreshPeriodSec(); - if (parseInt(f, 10) !== 0) { - writer.writeUint64String( - 19, - f - ); - } - f = message.getAutoloopBudgetLastRefresh(); - if (parseInt(f, 10) !== 0) { - writer.writeUint64String( - 20, - f - ); - } - f = message.getEasyAutoloop(); - if (f) { - writer.writeBool( - 21, - f - ); - } - f = message.getEasyAutoloopLocalTargetSat(); - if (parseInt(f, 10) !== 0) { - writer.writeUint64String( - 22, + 2, f ); } - f = message.getAccount(); + f = message.getState(); if (f.length > 0) { writer.writeString( - 23, - f - ); - } - f = message.getAccountAddrType(); - if (f !== 0.0) { - writer.writeEnum( - 24, + 3, f ); } @@ -7691,458 +11220,672 @@ proto.looprpc.LiquidityParameters.serializeBinaryToWriter = function(message, wr /** - * repeated LiquidityRule rules = 1; - * @return {!Array} + * optional bytes instant_out_hash = 1; + * @return {!(string|Uint8Array)} */ -proto.looprpc.LiquidityParameters.prototype.getRulesList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.looprpc.LiquidityRule, 1)); +proto.looprpc.InstantOutResponse.prototype.getInstantOutHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * @param {!Array} value - * @return {!proto.looprpc.LiquidityParameters} returns this -*/ -proto.looprpc.LiquidityParameters.prototype.setRulesList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); + * optional bytes instant_out_hash = 1; + * This is a type-conversion wrapper around `getInstantOutHash()` + * @return {string} + */ +proto.looprpc.InstantOutResponse.prototype.getInstantOutHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getInstantOutHash())); }; /** - * @param {!proto.looprpc.LiquidityRule=} opt_value - * @param {number=} opt_index - * @return {!proto.looprpc.LiquidityRule} + * optional bytes instant_out_hash = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getInstantOutHash()` + * @return {!Uint8Array} */ -proto.looprpc.LiquidityParameters.prototype.addRules = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.looprpc.LiquidityRule, opt_index); +proto.looprpc.InstantOutResponse.prototype.getInstantOutHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getInstantOutHash())); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.looprpc.LiquidityParameters} returns this + * @param {!(string|Uint8Array)} value + * @return {!proto.looprpc.InstantOutResponse} returns this */ -proto.looprpc.LiquidityParameters.prototype.clearRulesList = function() { - return this.setRulesList([]); +proto.looprpc.InstantOutResponse.prototype.setInstantOutHash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * optional uint64 fee_ppm = 16; + * optional string sweep_tx_id = 2; * @return {string} */ -proto.looprpc.LiquidityParameters.prototype.getFeePpm = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 16, "0")); +proto.looprpc.InstantOutResponse.prototype.getSweepTxId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * @param {string} value - * @return {!proto.looprpc.LiquidityParameters} returns this + * @return {!proto.looprpc.InstantOutResponse} returns this */ -proto.looprpc.LiquidityParameters.prototype.setFeePpm = function(value) { - return jspb.Message.setProto3StringIntField(this, 16, value); +proto.looprpc.InstantOutResponse.prototype.setSweepTxId = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); }; /** - * optional uint64 sweep_fee_rate_sat_per_vbyte = 2; + * optional string state = 3; * @return {string} */ -proto.looprpc.LiquidityParameters.prototype.getSweepFeeRateSatPerVbyte = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "0")); +proto.looprpc.InstantOutResponse.prototype.getState = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** * @param {string} value - * @return {!proto.looprpc.LiquidityParameters} returns this + * @return {!proto.looprpc.InstantOutResponse} returns this */ -proto.looprpc.LiquidityParameters.prototype.setSweepFeeRateSatPerVbyte = function(value) { - return jspb.Message.setProto3StringIntField(this, 2, value); +proto.looprpc.InstantOutResponse.prototype.setState = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); }; -/** - * optional uint64 max_swap_fee_ppm = 3; - * @return {string} - */ -proto.looprpc.LiquidityParameters.prototype.getMaxSwapFeePpm = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "0")); -}; - -/** - * @param {string} value - * @return {!proto.looprpc.LiquidityParameters} returns this - */ -proto.looprpc.LiquidityParameters.prototype.setMaxSwapFeePpm = function(value) { - return jspb.Message.setProto3StringIntField(this, 3, value); -}; +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * optional uint64 max_routing_fee_ppm = 4; - * @return {string} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.looprpc.LiquidityParameters.prototype.getMaxRoutingFeePpm = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "0")); +proto.looprpc.InstantOutQuoteRequest.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.InstantOutQuoteRequest.toObject(opt_includeInstance, this); }; /** - * @param {string} value - * @return {!proto.looprpc.LiquidityParameters} returns this + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.looprpc.InstantOutQuoteRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.LiquidityParameters.prototype.setMaxRoutingFeePpm = function(value) { - return jspb.Message.setProto3StringIntField(this, 4, value); +proto.looprpc.InstantOutQuoteRequest.toObject = function(includeInstance, msg) { + var f, obj = { + amt: jspb.Message.getFieldWithDefault(msg, 1, "0"), + numReservations: jspb.Message.getFieldWithDefault(msg, 2, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * optional uint64 max_prepay_routing_fee_ppm = 5; - * @return {string} + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.looprpc.InstantOutQuoteRequest} */ -proto.looprpc.LiquidityParameters.prototype.getMaxPrepayRoutingFeePpm = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "0")); +proto.looprpc.InstantOutQuoteRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.looprpc.InstantOutQuoteRequest; + return proto.looprpc.InstantOutQuoteRequest.deserializeBinaryFromReader(msg, reader); }; /** - * @param {string} value - * @return {!proto.looprpc.LiquidityParameters} returns this + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.looprpc.InstantOutQuoteRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.InstantOutQuoteRequest} */ -proto.looprpc.LiquidityParameters.prototype.setMaxPrepayRoutingFeePpm = function(value) { - return jspb.Message.setProto3StringIntField(this, 5, value); +proto.looprpc.InstantOutQuoteRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readUint64String()); + msg.setAmt(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt32()); + msg.setNumReservations(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * optional uint64 max_prepay_sat = 6; - * @return {string} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.looprpc.LiquidityParameters.prototype.getMaxPrepaySat = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "0")); +proto.looprpc.InstantOutQuoteRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.InstantOutQuoteRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * @param {string} value - * @return {!proto.looprpc.LiquidityParameters} returns this + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.InstantOutQuoteRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.LiquidityParameters.prototype.setMaxPrepaySat = function(value) { - return jspb.Message.setProto3StringIntField(this, 6, value); +proto.looprpc.InstantOutQuoteRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAmt(); + if (parseInt(f, 10) !== 0) { + writer.writeUint64String( + 1, + f + ); + } + f = message.getNumReservations(); + if (f !== 0) { + writer.writeInt32( + 2, + f + ); + } }; /** - * optional uint64 max_miner_fee_sat = 7; + * optional uint64 amt = 1; * @return {string} */ -proto.looprpc.LiquidityParameters.prototype.getMaxMinerFeeSat = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "0")); +proto.looprpc.InstantOutQuoteRequest.prototype.getAmt = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0")); }; /** * @param {string} value - * @return {!proto.looprpc.LiquidityParameters} returns this + * @return {!proto.looprpc.InstantOutQuoteRequest} returns this */ -proto.looprpc.LiquidityParameters.prototype.setMaxMinerFeeSat = function(value) { - return jspb.Message.setProto3StringIntField(this, 7, value); +proto.looprpc.InstantOutQuoteRequest.prototype.setAmt = function(value) { + return jspb.Message.setProto3StringIntField(this, 1, value); }; /** - * optional int32 sweep_conf_target = 8; + * optional int32 num_reservations = 2; * @return {number} */ -proto.looprpc.LiquidityParameters.prototype.getSweepConfTarget = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 8, 0)); +proto.looprpc.InstantOutQuoteRequest.prototype.getNumReservations = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** * @param {number} value - * @return {!proto.looprpc.LiquidityParameters} returns this + * @return {!proto.looprpc.InstantOutQuoteRequest} returns this */ -proto.looprpc.LiquidityParameters.prototype.setSweepConfTarget = function(value) { - return jspb.Message.setProto3IntField(this, 8, value); +proto.looprpc.InstantOutQuoteRequest.prototype.setNumReservations = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); }; -/** - * optional uint64 failure_backoff_sec = 9; - * @return {string} - */ -proto.looprpc.LiquidityParameters.prototype.getFailureBackoffSec = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 9, "0")); -}; - -/** - * @param {string} value - * @return {!proto.looprpc.LiquidityParameters} returns this - */ -proto.looprpc.LiquidityParameters.prototype.setFailureBackoffSec = function(value) { - return jspb.Message.setProto3StringIntField(this, 9, value); -}; +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * optional bool autoloop = 10; - * @return {boolean} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.looprpc.LiquidityParameters.prototype.getAutoloop = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 10, false)); +proto.looprpc.InstantOutQuoteResponse.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.InstantOutQuoteResponse.toObject(opt_includeInstance, this); }; /** - * @param {boolean} value - * @return {!proto.looprpc.LiquidityParameters} returns this + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.looprpc.InstantOutQuoteResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.LiquidityParameters.prototype.setAutoloop = function(value) { - return jspb.Message.setProto3BooleanField(this, 10, value); +proto.looprpc.InstantOutQuoteResponse.toObject = function(includeInstance, msg) { + var f, obj = { + serviceFeeSat: jspb.Message.getFieldWithDefault(msg, 1, "0"), + sweepFeeSat: jspb.Message.getFieldWithDefault(msg, 2, "0") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * optional uint64 autoloop_budget_sat = 11; - * @return {string} + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.looprpc.InstantOutQuoteResponse} */ -proto.looprpc.LiquidityParameters.prototype.getAutoloopBudgetSat = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 11, "0")); +proto.looprpc.InstantOutQuoteResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.looprpc.InstantOutQuoteResponse; + return proto.looprpc.InstantOutQuoteResponse.deserializeBinaryFromReader(msg, reader); }; /** - * @param {string} value - * @return {!proto.looprpc.LiquidityParameters} returns this + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.looprpc.InstantOutQuoteResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.InstantOutQuoteResponse} */ -proto.looprpc.LiquidityParameters.prototype.setAutoloopBudgetSat = function(value) { - return jspb.Message.setProto3StringIntField(this, 11, value); +proto.looprpc.InstantOutQuoteResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setServiceFeeSat(value); + break; + case 2: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setSweepFeeSat(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * optional uint64 autoloop_budget_start_sec = 12; - * @return {string} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.looprpc.LiquidityParameters.prototype.getAutoloopBudgetStartSec = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 12, "0")); +proto.looprpc.InstantOutQuoteResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.InstantOutQuoteResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * @param {string} value - * @return {!proto.looprpc.LiquidityParameters} returns this + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.InstantOutQuoteResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.LiquidityParameters.prototype.setAutoloopBudgetStartSec = function(value) { - return jspb.Message.setProto3StringIntField(this, 12, value); +proto.looprpc.InstantOutQuoteResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getServiceFeeSat(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 1, + f + ); + } + f = message.getSweepFeeSat(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 2, + f + ); + } }; /** - * optional uint64 auto_max_in_flight = 13; + * optional int64 service_fee_sat = 1; * @return {string} */ -proto.looprpc.LiquidityParameters.prototype.getAutoMaxInFlight = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 13, "0")); +proto.looprpc.InstantOutQuoteResponse.prototype.getServiceFeeSat = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0")); }; /** * @param {string} value - * @return {!proto.looprpc.LiquidityParameters} returns this + * @return {!proto.looprpc.InstantOutQuoteResponse} returns this */ -proto.looprpc.LiquidityParameters.prototype.setAutoMaxInFlight = function(value) { - return jspb.Message.setProto3StringIntField(this, 13, value); +proto.looprpc.InstantOutQuoteResponse.prototype.setServiceFeeSat = function(value) { + return jspb.Message.setProto3StringIntField(this, 1, value); }; /** - * optional uint64 min_swap_amount = 14; + * optional int64 sweep_fee_sat = 2; * @return {string} */ -proto.looprpc.LiquidityParameters.prototype.getMinSwapAmount = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 14, "0")); +proto.looprpc.InstantOutQuoteResponse.prototype.getSweepFeeSat = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "0")); }; /** * @param {string} value - * @return {!proto.looprpc.LiquidityParameters} returns this + * @return {!proto.looprpc.InstantOutQuoteResponse} returns this */ -proto.looprpc.LiquidityParameters.prototype.setMinSwapAmount = function(value) { - return jspb.Message.setProto3StringIntField(this, 14, value); +proto.looprpc.InstantOutQuoteResponse.prototype.setSweepFeeSat = function(value) { + return jspb.Message.setProto3StringIntField(this, 2, value); }; -/** - * optional uint64 max_swap_amount = 15; - * @return {string} - */ -proto.looprpc.LiquidityParameters.prototype.getMaxSwapAmount = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 15, "0")); -}; + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * @param {string} value - * @return {!proto.looprpc.LiquidityParameters} returns this + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.looprpc.LiquidityParameters.prototype.setMaxSwapAmount = function(value) { - return jspb.Message.setProto3StringIntField(this, 15, value); +proto.looprpc.ListInstantOutsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.ListInstantOutsRequest.toObject(opt_includeInstance, this); }; /** - * optional int32 htlc_conf_target = 17; - * @return {number} + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.looprpc.ListInstantOutsRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.LiquidityParameters.prototype.getHtlcConfTarget = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 17, 0)); +proto.looprpc.ListInstantOutsRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * @param {number} value - * @return {!proto.looprpc.LiquidityParameters} returns this + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.looprpc.ListInstantOutsRequest} */ -proto.looprpc.LiquidityParameters.prototype.setHtlcConfTarget = function(value) { - return jspb.Message.setProto3IntField(this, 17, value); +proto.looprpc.ListInstantOutsRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.looprpc.ListInstantOutsRequest; + return proto.looprpc.ListInstantOutsRequest.deserializeBinaryFromReader(msg, reader); }; /** - * optional string autoloop_dest_address = 18; - * @return {string} + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.looprpc.ListInstantOutsRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.ListInstantOutsRequest} */ -proto.looprpc.LiquidityParameters.prototype.getAutoloopDestAddress = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 18, "")); +proto.looprpc.ListInstantOutsRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * @param {string} value - * @return {!proto.looprpc.LiquidityParameters} returns this + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.looprpc.LiquidityParameters.prototype.setAutoloopDestAddress = function(value) { - return jspb.Message.setProto3StringField(this, 18, value); +proto.looprpc.ListInstantOutsRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.ListInstantOutsRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * optional uint64 autoloop_budget_refresh_period_sec = 19; - * @return {string} + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.ListInstantOutsRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.LiquidityParameters.prototype.getAutoloopBudgetRefreshPeriodSec = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 19, "0")); +proto.looprpc.ListInstantOutsRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; }; + /** - * @param {string} value - * @return {!proto.looprpc.LiquidityParameters} returns this + * List of repeated fields within this message type. + * @private {!Array} + * @const */ -proto.looprpc.LiquidityParameters.prototype.setAutoloopBudgetRefreshPeriodSec = function(value) { - return jspb.Message.setProto3StringIntField(this, 19, value); -}; +proto.looprpc.ListInstantOutsResponse.repeatedFields_ = [1]; + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * optional uint64 autoloop_budget_last_refresh = 20; - * @return {string} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.looprpc.LiquidityParameters.prototype.getAutoloopBudgetLastRefresh = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 20, "0")); +proto.looprpc.ListInstantOutsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.ListInstantOutsResponse.toObject(opt_includeInstance, this); }; /** - * @param {string} value - * @return {!proto.looprpc.LiquidityParameters} returns this + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.looprpc.ListInstantOutsResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.LiquidityParameters.prototype.setAutoloopBudgetLastRefresh = function(value) { - return jspb.Message.setProto3StringIntField(this, 20, value); +proto.looprpc.ListInstantOutsResponse.toObject = function(includeInstance, msg) { + var f, obj = { + swapsList: jspb.Message.toObjectList(msg.getSwapsList(), + proto.looprpc.InstantOut.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * optional bool easy_autoloop = 21; - * @return {boolean} + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.looprpc.ListInstantOutsResponse} */ -proto.looprpc.LiquidityParameters.prototype.getEasyAutoloop = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 21, false)); +proto.looprpc.ListInstantOutsResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.looprpc.ListInstantOutsResponse; + return proto.looprpc.ListInstantOutsResponse.deserializeBinaryFromReader(msg, reader); }; /** - * @param {boolean} value - * @return {!proto.looprpc.LiquidityParameters} returns this + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.looprpc.ListInstantOutsResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.ListInstantOutsResponse} */ -proto.looprpc.LiquidityParameters.prototype.setEasyAutoloop = function(value) { - return jspb.Message.setProto3BooleanField(this, 21, value); +proto.looprpc.ListInstantOutsResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.looprpc.InstantOut; + reader.readMessage(value,proto.looprpc.InstantOut.deserializeBinaryFromReader); + msg.addSwaps(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * optional uint64 easy_autoloop_local_target_sat = 22; - * @return {string} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.looprpc.LiquidityParameters.prototype.getEasyAutoloopLocalTargetSat = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 22, "0")); +proto.looprpc.ListInstantOutsResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.ListInstantOutsResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * @param {string} value - * @return {!proto.looprpc.LiquidityParameters} returns this + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.ListInstantOutsResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.LiquidityParameters.prototype.setEasyAutoloopLocalTargetSat = function(value) { - return jspb.Message.setProto3StringIntField(this, 22, value); +proto.looprpc.ListInstantOutsResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getSwapsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.looprpc.InstantOut.serializeBinaryToWriter + ); + } }; /** - * optional string account = 23; - * @return {string} + * repeated InstantOut swaps = 1; + * @return {!Array} */ -proto.looprpc.LiquidityParameters.prototype.getAccount = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 23, "")); +proto.looprpc.ListInstantOutsResponse.prototype.getSwapsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.looprpc.InstantOut, 1)); }; /** - * @param {string} value - * @return {!proto.looprpc.LiquidityParameters} returns this - */ -proto.looprpc.LiquidityParameters.prototype.setAccount = function(value) { - return jspb.Message.setProto3StringField(this, 23, value); + * @param {!Array} value + * @return {!proto.looprpc.ListInstantOutsResponse} returns this +*/ +proto.looprpc.ListInstantOutsResponse.prototype.setSwapsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** - * optional AddressType account_addr_type = 24; - * @return {!proto.looprpc.AddressType} + * @param {!proto.looprpc.InstantOut=} opt_value + * @param {number=} opt_index + * @return {!proto.looprpc.InstantOut} */ -proto.looprpc.LiquidityParameters.prototype.getAccountAddrType = function() { - return /** @type {!proto.looprpc.AddressType} */ (jspb.Message.getFieldWithDefault(this, 24, 0)); +proto.looprpc.ListInstantOutsResponse.prototype.addSwaps = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.looprpc.InstantOut, opt_index); }; /** - * @param {!proto.looprpc.AddressType} value - * @return {!proto.looprpc.LiquidityParameters} returns this + * Clears the list making it empty but non-null. + * @return {!proto.looprpc.ListInstantOutsResponse} returns this */ -proto.looprpc.LiquidityParameters.prototype.setAccountAddrType = function(value) { - return jspb.Message.setProto3EnumField(this, 24, value); +proto.looprpc.ListInstantOutsResponse.prototype.clearSwapsList = function() { + return this.setSwapsList([]); }; +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.looprpc.InstantOut.repeatedFields_ = [4]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -8158,8 +11901,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.LiquidityRule.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.LiquidityRule.toObject(opt_includeInstance, this); +proto.looprpc.InstantOut.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.InstantOut.toObject(opt_includeInstance, this); }; @@ -8168,18 +11911,17 @@ proto.looprpc.LiquidityRule.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.LiquidityRule} msg The msg instance to transform. + * @param {!proto.looprpc.InstantOut} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.LiquidityRule.toObject = function(includeInstance, msg) { +proto.looprpc.InstantOut.toObject = function(includeInstance, msg) { var f, obj = { - channelId: jspb.Message.getFieldWithDefault(msg, 1, "0"), - swapType: jspb.Message.getFieldWithDefault(msg, 6, 0), - pubkey: msg.getPubkey_asB64(), - type: jspb.Message.getFieldWithDefault(msg, 2, 0), - incomingThreshold: jspb.Message.getFieldWithDefault(msg, 3, 0), - outgoingThreshold: jspb.Message.getFieldWithDefault(msg, 4, 0) + swapHash: msg.getSwapHash_asB64(), + state: jspb.Message.getFieldWithDefault(msg, 2, ""), + amount: jspb.Message.getFieldWithDefault(msg, 3, "0"), + reservationIdsList: msg.getReservationIdsList_asB64(), + sweepTxId: jspb.Message.getFieldWithDefault(msg, 5, "") }; if (includeInstance) { @@ -8193,52 +11935,48 @@ proto.looprpc.LiquidityRule.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.LiquidityRule} + * @return {!proto.looprpc.InstantOut} */ -proto.looprpc.LiquidityRule.deserializeBinary = function(bytes) { +proto.looprpc.InstantOut.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.LiquidityRule; - return proto.looprpc.LiquidityRule.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.InstantOut; + return proto.looprpc.InstantOut.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.LiquidityRule} msg The message object to deserialize into. + * @param {!proto.looprpc.InstantOut} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.LiquidityRule} + * @return {!proto.looprpc.InstantOut} */ -proto.looprpc.LiquidityRule.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.InstantOut.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = /** @type {string} */ (reader.readUint64String()); - msg.setChannelId(value); - break; - case 6: - var value = /** @type {!proto.looprpc.SwapType} */ (reader.readEnum()); - msg.setSwapType(value); - break; - case 5: + case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setPubkey(value); + msg.setSwapHash(value); break; case 2: - var value = /** @type {!proto.looprpc.LiquidityRuleType} */ (reader.readEnum()); - msg.setType(value); + var value = /** @type {string} */ (reader.readString()); + msg.setState(value); break; case 3: - var value = /** @type {number} */ (reader.readUint32()); - msg.setIncomingThreshold(value); + var value = /** @type {string} */ (reader.readUint64String()); + msg.setAmount(value); break; case 4: - var value = /** @type {number} */ (reader.readUint32()); - msg.setOutgoingThreshold(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.addReservationIds(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.setSweepTxId(value); break; default: reader.skipField(); @@ -8253,9 +11991,9 @@ proto.looprpc.LiquidityRule.deserializeBinaryFromReader = function(msg, reader) * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.LiquidityRule.prototype.serializeBinary = function() { +proto.looprpc.InstantOut.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.LiquidityRule.serializeBinaryToWriter(this, writer); + proto.looprpc.InstantOut.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -8263,186 +12001,358 @@ proto.looprpc.LiquidityRule.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.LiquidityRule} message + * @param {!proto.looprpc.InstantOut} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.LiquidityRule.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.InstantOut.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getChannelId(); - if (parseInt(f, 10) !== 0) { - writer.writeUint64String( - 1, - f - ); - } - f = message.getSwapType(); - if (f !== 0.0) { - writer.writeEnum( - 6, - f - ); - } - f = message.getPubkey_asU8(); + f = message.getSwapHash_asU8(); if (f.length > 0) { writer.writeBytes( - 5, + 1, f ); } - f = message.getType(); - if (f !== 0.0) { - writer.writeEnum( + f = message.getState(); + if (f.length > 0) { + writer.writeString( 2, f ); } - f = message.getIncomingThreshold(); - if (f !== 0) { - writer.writeUint32( + f = message.getAmount(); + if (parseInt(f, 10) !== 0) { + writer.writeUint64String( 3, f ); } - f = message.getOutgoingThreshold(); - if (f !== 0) { - writer.writeUint32( + f = message.getReservationIdsList_asU8(); + if (f.length > 0) { + writer.writeRepeatedBytes( 4, f ); } + f = message.getSweepTxId(); + if (f.length > 0) { + writer.writeString( + 5, + f + ); + } }; /** - * optional uint64 channel_id = 1; + * optional bytes swap_hash = 1; + * @return {!(string|Uint8Array)} + */ +proto.looprpc.InstantOut.prototype.getSwapHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes swap_hash = 1; + * This is a type-conversion wrapper around `getSwapHash()` * @return {string} */ -proto.looprpc.LiquidityRule.prototype.getChannelId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0")); +proto.looprpc.InstantOut.prototype.getSwapHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getSwapHash())); }; /** - * @param {string} value - * @return {!proto.looprpc.LiquidityRule} returns this + * optional bytes swap_hash = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getSwapHash()` + * @return {!Uint8Array} */ -proto.looprpc.LiquidityRule.prototype.setChannelId = function(value) { - return jspb.Message.setProto3StringIntField(this, 1, value); +proto.looprpc.InstantOut.prototype.getSwapHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getSwapHash())); }; /** - * optional SwapType swap_type = 6; - * @return {!proto.looprpc.SwapType} + * @param {!(string|Uint8Array)} value + * @return {!proto.looprpc.InstantOut} returns this */ -proto.looprpc.LiquidityRule.prototype.getSwapType = function() { - return /** @type {!proto.looprpc.SwapType} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); +proto.looprpc.InstantOut.prototype.setSwapHash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * @param {!proto.looprpc.SwapType} value - * @return {!proto.looprpc.LiquidityRule} returns this + * optional string state = 2; + * @return {string} */ -proto.looprpc.LiquidityRule.prototype.setSwapType = function(value) { - return jspb.Message.setProto3EnumField(this, 6, value); +proto.looprpc.InstantOut.prototype.getState = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** - * optional bytes pubkey = 5; - * @return {!(string|Uint8Array)} + * @param {string} value + * @return {!proto.looprpc.InstantOut} returns this */ -proto.looprpc.LiquidityRule.prototype.getPubkey = function() { - return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +proto.looprpc.InstantOut.prototype.setState = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); }; /** - * optional bytes pubkey = 5; - * This is a type-conversion wrapper around `getPubkey()` + * optional uint64 amount = 3; * @return {string} */ -proto.looprpc.LiquidityRule.prototype.getPubkey_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getPubkey())); +proto.looprpc.InstantOut.prototype.getAmount = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "0")); }; /** - * optional bytes pubkey = 5; + * @param {string} value + * @return {!proto.looprpc.InstantOut} returns this + */ +proto.looprpc.InstantOut.prototype.setAmount = function(value) { + return jspb.Message.setProto3StringIntField(this, 3, value); +}; + + +/** + * repeated bytes reservation_ids = 4; + * @return {!(Array|Array)} + */ +proto.looprpc.InstantOut.prototype.getReservationIdsList = function() { + return /** @type {!(Array|Array)} */ (jspb.Message.getRepeatedField(this, 4)); +}; + + +/** + * repeated bytes reservation_ids = 4; + * This is a type-conversion wrapper around `getReservationIdsList()` + * @return {!Array} + */ +proto.looprpc.InstantOut.prototype.getReservationIdsList_asB64 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsB64( + this.getReservationIdsList())); +}; + + +/** + * repeated bytes reservation_ids = 4; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getPubkey()` - * @return {!Uint8Array} + * This is a type-conversion wrapper around `getReservationIdsList()` + * @return {!Array} + */ +proto.looprpc.InstantOut.prototype.getReservationIdsList_asU8 = function() { + return /** @type {!Array} */ (jspb.Message.bytesListAsU8( + this.getReservationIdsList())); +}; + + +/** + * @param {!(Array|Array)} value + * @return {!proto.looprpc.InstantOut} returns this + */ +proto.looprpc.InstantOut.prototype.setReservationIdsList = function(value) { + return jspb.Message.setField(this, 4, value || []); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @param {number=} opt_index + * @return {!proto.looprpc.InstantOut} returns this + */ +proto.looprpc.InstantOut.prototype.addReservationIds = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 4, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.looprpc.InstantOut} returns this + */ +proto.looprpc.InstantOut.prototype.clearReservationIdsList = function() { + return this.setReservationIdsList([]); +}; + + +/** + * optional string sweep_tx_id = 5; + * @return {string} + */ +proto.looprpc.InstantOut.prototype.getSweepTxId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.InstantOut} returns this + */ +proto.looprpc.InstantOut.prototype.setSweepTxId = function(value) { + return jspb.Message.setProto3StringField(this, 5, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.looprpc.NewStaticAddressRequest.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.NewStaticAddressRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.looprpc.NewStaticAddressRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.NewStaticAddressRequest.toObject = function(includeInstance, msg) { + var f, obj = { + clientKey: msg.getClientKey_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.looprpc.NewStaticAddressRequest} */ -proto.looprpc.LiquidityRule.prototype.getPubkey_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getPubkey())); +proto.looprpc.NewStaticAddressRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.looprpc.NewStaticAddressRequest; + return proto.looprpc.NewStaticAddressRequest.deserializeBinaryFromReader(msg, reader); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.looprpc.LiquidityRule} returns this + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.looprpc.NewStaticAddressRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.NewStaticAddressRequest} */ -proto.looprpc.LiquidityRule.prototype.setPubkey = function(value) { - return jspb.Message.setProto3BytesField(this, 5, value); +proto.looprpc.NewStaticAddressRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setClientKey(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * optional LiquidityRuleType type = 2; - * @return {!proto.looprpc.LiquidityRuleType} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.looprpc.LiquidityRule.prototype.getType = function() { - return /** @type {!proto.looprpc.LiquidityRuleType} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +proto.looprpc.NewStaticAddressRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.NewStaticAddressRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * @param {!proto.looprpc.LiquidityRuleType} value - * @return {!proto.looprpc.LiquidityRule} returns this + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.NewStaticAddressRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.LiquidityRule.prototype.setType = function(value) { - return jspb.Message.setProto3EnumField(this, 2, value); +proto.looprpc.NewStaticAddressRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getClientKey_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } }; /** - * optional uint32 incoming_threshold = 3; - * @return {number} + * optional bytes client_key = 1; + * @return {!(string|Uint8Array)} */ -proto.looprpc.LiquidityRule.prototype.getIncomingThreshold = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +proto.looprpc.NewStaticAddressRequest.prototype.getClientKey = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * @param {number} value - * @return {!proto.looprpc.LiquidityRule} returns this + * optional bytes client_key = 1; + * This is a type-conversion wrapper around `getClientKey()` + * @return {string} */ -proto.looprpc.LiquidityRule.prototype.setIncomingThreshold = function(value) { - return jspb.Message.setProto3IntField(this, 3, value); +proto.looprpc.NewStaticAddressRequest.prototype.getClientKey_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getClientKey())); }; /** - * optional uint32 outgoing_threshold = 4; - * @return {number} + * optional bytes client_key = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getClientKey()` + * @return {!Uint8Array} */ -proto.looprpc.LiquidityRule.prototype.getOutgoingThreshold = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +proto.looprpc.NewStaticAddressRequest.prototype.getClientKey_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getClientKey())); }; /** - * @param {number} value - * @return {!proto.looprpc.LiquidityRule} returns this + * @param {!(string|Uint8Array)} value + * @return {!proto.looprpc.NewStaticAddressRequest} returns this */ -proto.looprpc.LiquidityRule.prototype.setOutgoingThreshold = function(value) { - return jspb.Message.setProto3IntField(this, 4, value); +proto.looprpc.NewStaticAddressRequest.prototype.setClientKey = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; @@ -8462,8 +12372,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.SetLiquidityParamsRequest.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.SetLiquidityParamsRequest.toObject(opt_includeInstance, this); +proto.looprpc.NewStaticAddressResponse.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.NewStaticAddressResponse.toObject(opt_includeInstance, this); }; @@ -8472,13 +12382,14 @@ proto.looprpc.SetLiquidityParamsRequest.prototype.toObject = function(opt_includ * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.SetLiquidityParamsRequest} msg The msg instance to transform. + * @param {!proto.looprpc.NewStaticAddressResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.SetLiquidityParamsRequest.toObject = function(includeInstance, msg) { +proto.looprpc.NewStaticAddressResponse.toObject = function(includeInstance, msg) { var f, obj = { - parameters: (f = msg.getParameters()) && proto.looprpc.LiquidityParameters.toObject(includeInstance, f) + address: jspb.Message.getFieldWithDefault(msg, 1, ""), + expiry: jspb.Message.getFieldWithDefault(msg, 2, 0) }; if (includeInstance) { @@ -8492,23 +12403,23 @@ proto.looprpc.SetLiquidityParamsRequest.toObject = function(includeInstance, msg /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.SetLiquidityParamsRequest} + * @return {!proto.looprpc.NewStaticAddressResponse} */ -proto.looprpc.SetLiquidityParamsRequest.deserializeBinary = function(bytes) { +proto.looprpc.NewStaticAddressResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.SetLiquidityParamsRequest; - return proto.looprpc.SetLiquidityParamsRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.NewStaticAddressResponse; + return proto.looprpc.NewStaticAddressResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.SetLiquidityParamsRequest} msg The message object to deserialize into. + * @param {!proto.looprpc.NewStaticAddressResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.SetLiquidityParamsRequest} + * @return {!proto.looprpc.NewStaticAddressResponse} */ -proto.looprpc.SetLiquidityParamsRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.NewStaticAddressResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -8516,9 +12427,12 @@ proto.looprpc.SetLiquidityParamsRequest.deserializeBinaryFromReader = function(m var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.looprpc.LiquidityParameters; - reader.readMessage(value,proto.looprpc.LiquidityParameters.deserializeBinaryFromReader); - msg.setParameters(value); + var value = /** @type {string} */ (reader.readString()); + msg.setAddress(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint32()); + msg.setExpiry(value); break; default: reader.skipField(); @@ -8533,9 +12447,9 @@ proto.looprpc.SetLiquidityParamsRequest.deserializeBinaryFromReader = function(m * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.SetLiquidityParamsRequest.prototype.serializeBinary = function() { +proto.looprpc.NewStaticAddressResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.SetLiquidityParamsRequest.serializeBinaryToWriter(this, writer); + proto.looprpc.NewStaticAddressResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -8543,57 +12457,62 @@ proto.looprpc.SetLiquidityParamsRequest.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.SetLiquidityParamsRequest} message + * @param {!proto.looprpc.NewStaticAddressResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.SetLiquidityParamsRequest.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.NewStaticAddressResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getParameters(); - if (f != null) { - writer.writeMessage( + f = message.getAddress(); + if (f.length > 0) { + writer.writeString( 1, - f, - proto.looprpc.LiquidityParameters.serializeBinaryToWriter + f + ); + } + f = message.getExpiry(); + if (f !== 0) { + writer.writeUint32( + 2, + f ); } }; /** - * optional LiquidityParameters parameters = 1; - * @return {?proto.looprpc.LiquidityParameters} + * optional string address = 1; + * @return {string} */ -proto.looprpc.SetLiquidityParamsRequest.prototype.getParameters = function() { - return /** @type{?proto.looprpc.LiquidityParameters} */ ( - jspb.Message.getWrapperField(this, proto.looprpc.LiquidityParameters, 1)); +proto.looprpc.NewStaticAddressResponse.prototype.getAddress = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * @param {?proto.looprpc.LiquidityParameters|undefined} value - * @return {!proto.looprpc.SetLiquidityParamsRequest} returns this -*/ -proto.looprpc.SetLiquidityParamsRequest.prototype.setParameters = function(value) { - return jspb.Message.setWrapperField(this, 1, value); + * @param {string} value + * @return {!proto.looprpc.NewStaticAddressResponse} returns this + */ +proto.looprpc.NewStaticAddressResponse.prototype.setAddress = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.looprpc.SetLiquidityParamsRequest} returns this + * optional uint32 expiry = 2; + * @return {number} */ -proto.looprpc.SetLiquidityParamsRequest.prototype.clearParameters = function() { - return this.setParameters(undefined); +proto.looprpc.NewStaticAddressResponse.prototype.getExpiry = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** - * Returns whether this field is set. - * @return {boolean} + * @param {number} value + * @return {!proto.looprpc.NewStaticAddressResponse} returns this */ -proto.looprpc.SetLiquidityParamsRequest.prototype.hasParameters = function() { - return jspb.Message.getField(this, 1) != null; +proto.looprpc.NewStaticAddressResponse.prototype.setExpiry = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); }; @@ -8613,8 +12532,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.SetLiquidityParamsResponse.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.SetLiquidityParamsResponse.toObject(opt_includeInstance, this); +proto.looprpc.ListUnspentDepositsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.ListUnspentDepositsRequest.toObject(opt_includeInstance, this); }; @@ -8623,13 +12542,14 @@ proto.looprpc.SetLiquidityParamsResponse.prototype.toObject = function(opt_inclu * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.SetLiquidityParamsResponse} msg The msg instance to transform. + * @param {!proto.looprpc.ListUnspentDepositsRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.SetLiquidityParamsResponse.toObject = function(includeInstance, msg) { +proto.looprpc.ListUnspentDepositsRequest.toObject = function(includeInstance, msg) { var f, obj = { - + minConfs: jspb.Message.getFieldWithDefault(msg, 1, 0), + maxConfs: jspb.Message.getFieldWithDefault(msg, 2, 0) }; if (includeInstance) { @@ -8643,29 +12563,37 @@ proto.looprpc.SetLiquidityParamsResponse.toObject = function(includeInstance, ms /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.SetLiquidityParamsResponse} + * @return {!proto.looprpc.ListUnspentDepositsRequest} */ -proto.looprpc.SetLiquidityParamsResponse.deserializeBinary = function(bytes) { +proto.looprpc.ListUnspentDepositsRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.SetLiquidityParamsResponse; - return proto.looprpc.SetLiquidityParamsResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.ListUnspentDepositsRequest; + return proto.looprpc.ListUnspentDepositsRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.SetLiquidityParamsResponse} msg The message object to deserialize into. + * @param {!proto.looprpc.ListUnspentDepositsRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.SetLiquidityParamsResponse} + * @return {!proto.looprpc.ListUnspentDepositsRequest} */ -proto.looprpc.SetLiquidityParamsResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.ListUnspentDepositsRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setMinConfs(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt32()); + msg.setMaxConfs(value); + break; default: reader.skipField(); break; @@ -8679,9 +12607,9 @@ proto.looprpc.SetLiquidityParamsResponse.deserializeBinaryFromReader = function( * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.SetLiquidityParamsResponse.prototype.serializeBinary = function() { +proto.looprpc.ListUnspentDepositsRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.SetLiquidityParamsResponse.serializeBinaryToWriter(this, writer); + proto.looprpc.ListUnspentDepositsRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -8689,16 +12617,73 @@ proto.looprpc.SetLiquidityParamsResponse.prototype.serializeBinary = function() /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.SetLiquidityParamsResponse} message + * @param {!proto.looprpc.ListUnspentDepositsRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.SetLiquidityParamsResponse.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.ListUnspentDepositsRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; + f = message.getMinConfs(); + if (f !== 0) { + writer.writeInt32( + 1, + f + ); + } + f = message.getMaxConfs(); + if (f !== 0) { + writer.writeInt32( + 2, + f + ); + } +}; + + +/** + * optional int32 min_confs = 1; + * @return {number} + */ +proto.looprpc.ListUnspentDepositsRequest.prototype.getMinConfs = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.looprpc.ListUnspentDepositsRequest} returns this + */ +proto.looprpc.ListUnspentDepositsRequest.prototype.setMinConfs = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional int32 max_confs = 2; + * @return {number} + */ +proto.looprpc.ListUnspentDepositsRequest.prototype.getMaxConfs = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.looprpc.ListUnspentDepositsRequest} returns this + */ +proto.looprpc.ListUnspentDepositsRequest.prototype.setMaxConfs = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); }; +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.looprpc.ListUnspentDepositsResponse.repeatedFields_ = [1]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -8714,8 +12699,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.SuggestSwapsRequest.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.SuggestSwapsRequest.toObject(opt_includeInstance, this); +proto.looprpc.ListUnspentDepositsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.ListUnspentDepositsResponse.toObject(opt_includeInstance, this); }; @@ -8724,13 +12709,14 @@ proto.looprpc.SuggestSwapsRequest.prototype.toObject = function(opt_includeInsta * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.SuggestSwapsRequest} msg The msg instance to transform. + * @param {!proto.looprpc.ListUnspentDepositsResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.SuggestSwapsRequest.toObject = function(includeInstance, msg) { +proto.looprpc.ListUnspentDepositsResponse.toObject = function(includeInstance, msg) { var f, obj = { - + utxosList: jspb.Message.toObjectList(msg.getUtxosList(), + proto.looprpc.Utxo.toObject, includeInstance) }; if (includeInstance) { @@ -8744,29 +12730,34 @@ proto.looprpc.SuggestSwapsRequest.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.SuggestSwapsRequest} + * @return {!proto.looprpc.ListUnspentDepositsResponse} */ -proto.looprpc.SuggestSwapsRequest.deserializeBinary = function(bytes) { +proto.looprpc.ListUnspentDepositsResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.SuggestSwapsRequest; - return proto.looprpc.SuggestSwapsRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.ListUnspentDepositsResponse; + return proto.looprpc.ListUnspentDepositsResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.SuggestSwapsRequest} msg The message object to deserialize into. + * @param {!proto.looprpc.ListUnspentDepositsResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.SuggestSwapsRequest} + * @return {!proto.looprpc.ListUnspentDepositsResponse} */ -proto.looprpc.SuggestSwapsRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.ListUnspentDepositsResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { + case 1: + var value = new proto.looprpc.Utxo; + reader.readMessage(value,proto.looprpc.Utxo.deserializeBinaryFromReader); + msg.addUtxos(value); + break; default: reader.skipField(); break; @@ -8780,9 +12771,9 @@ proto.looprpc.SuggestSwapsRequest.deserializeBinaryFromReader = function(msg, re * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.SuggestSwapsRequest.prototype.serializeBinary = function() { +proto.looprpc.ListUnspentDepositsResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.SuggestSwapsRequest.serializeBinaryToWriter(this, writer); + proto.looprpc.ListUnspentDepositsResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -8790,12 +12781,58 @@ proto.looprpc.SuggestSwapsRequest.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.SuggestSwapsRequest} message + * @param {!proto.looprpc.ListUnspentDepositsResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.SuggestSwapsRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; +proto.looprpc.ListUnspentDepositsResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getUtxosList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.looprpc.Utxo.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated Utxo utxos = 1; + * @return {!Array} + */ +proto.looprpc.ListUnspentDepositsResponse.prototype.getUtxosList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.looprpc.Utxo, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.looprpc.ListUnspentDepositsResponse} returns this +*/ +proto.looprpc.ListUnspentDepositsResponse.prototype.setUtxosList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.looprpc.Utxo=} opt_value + * @param {number=} opt_index + * @return {!proto.looprpc.Utxo} + */ +proto.looprpc.ListUnspentDepositsResponse.prototype.addUtxos = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.looprpc.Utxo, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.looprpc.ListUnspentDepositsResponse} returns this + */ +proto.looprpc.ListUnspentDepositsResponse.prototype.clearUtxosList = function() { + return this.setUtxosList([]); }; @@ -8815,8 +12852,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.Disqualified.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.Disqualified.toObject(opt_includeInstance, this); +proto.looprpc.Utxo.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.Utxo.toObject(opt_includeInstance, this); }; @@ -8825,15 +12862,16 @@ proto.looprpc.Disqualified.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.Disqualified} msg The msg instance to transform. + * @param {!proto.looprpc.Utxo} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.Disqualified.toObject = function(includeInstance, msg) { +proto.looprpc.Utxo.toObject = function(includeInstance, msg) { var f, obj = { - channelId: jspb.Message.getFieldWithDefault(msg, 1, "0"), - pubkey: msg.getPubkey_asB64(), - reason: jspb.Message.getFieldWithDefault(msg, 2, 0) + staticAddress: jspb.Message.getFieldWithDefault(msg, 1, ""), + amountSat: jspb.Message.getFieldWithDefault(msg, 2, "0"), + outpoint: jspb.Message.getFieldWithDefault(msg, 3, ""), + confirmations: jspb.Message.getFieldWithDefault(msg, 4, "0") }; if (includeInstance) { @@ -8847,23 +12885,23 @@ proto.looprpc.Disqualified.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.Disqualified} + * @return {!proto.looprpc.Utxo} */ -proto.looprpc.Disqualified.deserializeBinary = function(bytes) { +proto.looprpc.Utxo.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.Disqualified; - return proto.looprpc.Disqualified.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.Utxo; + return proto.looprpc.Utxo.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.Disqualified} msg The message object to deserialize into. + * @param {!proto.looprpc.Utxo} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.Disqualified} + * @return {!proto.looprpc.Utxo} */ -proto.looprpc.Disqualified.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.Utxo.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -8871,16 +12909,20 @@ proto.looprpc.Disqualified.deserializeBinaryFromReader = function(msg, reader) { var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {string} */ (reader.readUint64String()); - msg.setChannelId(value); + var value = /** @type {string} */ (reader.readString()); + msg.setStaticAddress(value); + break; + case 2: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setAmountSat(value); break; case 3: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setPubkey(value); + var value = /** @type {string} */ (reader.readString()); + msg.setOutpoint(value); break; - case 2: - var value = /** @type {!proto.looprpc.AutoReason} */ (reader.readEnum()); - msg.setReason(value); + case 4: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setConfirmations(value); break; default: reader.skipField(); @@ -8895,9 +12937,9 @@ proto.looprpc.Disqualified.deserializeBinaryFromReader = function(msg, reader) { * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.Disqualified.prototype.serializeBinary = function() { +proto.looprpc.Utxo.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.Disqualified.serializeBinaryToWriter(this, writer); + proto.looprpc.Utxo.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -8905,30 +12947,37 @@ proto.looprpc.Disqualified.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.Disqualified} message + * @param {!proto.looprpc.Utxo} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.Disqualified.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.Utxo.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getChannelId(); - if (parseInt(f, 10) !== 0) { - writer.writeUint64String( + f = message.getStaticAddress(); + if (f.length > 0) { + writer.writeString( 1, f ); } - f = message.getPubkey_asU8(); + f = message.getAmountSat(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 2, + f + ); + } + f = message.getOutpoint(); if (f.length > 0) { - writer.writeBytes( + writer.writeString( 3, f ); } - f = message.getReason(); - if (f !== 0.0) { - writer.writeEnum( - 2, + f = message.getConfirmations(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 4, f ); } @@ -8936,80 +12985,74 @@ proto.looprpc.Disqualified.serializeBinaryToWriter = function(message, writer) { /** - * optional uint64 channel_id = 1; + * optional string static_address = 1; * @return {string} */ -proto.looprpc.Disqualified.prototype.getChannelId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0")); +proto.looprpc.Utxo.prototype.getStaticAddress = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value - * @return {!proto.looprpc.Disqualified} returns this + * @return {!proto.looprpc.Utxo} returns this */ -proto.looprpc.Disqualified.prototype.setChannelId = function(value) { - return jspb.Message.setProto3StringIntField(this, 1, value); +proto.looprpc.Utxo.prototype.setStaticAddress = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); }; /** - * optional bytes pubkey = 3; - * @return {!(string|Uint8Array)} + * optional int64 amount_sat = 2; + * @return {string} */ -proto.looprpc.Disqualified.prototype.getPubkey = function() { - return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +proto.looprpc.Utxo.prototype.getAmountSat = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "0")); }; /** - * optional bytes pubkey = 3; - * This is a type-conversion wrapper around `getPubkey()` - * @return {string} + * @param {string} value + * @return {!proto.looprpc.Utxo} returns this */ -proto.looprpc.Disqualified.prototype.getPubkey_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getPubkey())); +proto.looprpc.Utxo.prototype.setAmountSat = function(value) { + return jspb.Message.setProto3StringIntField(this, 2, value); }; /** - * optional bytes pubkey = 3; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getPubkey()` - * @return {!Uint8Array} + * optional string outpoint = 3; + * @return {string} */ -proto.looprpc.Disqualified.prototype.getPubkey_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getPubkey())); +proto.looprpc.Utxo.prototype.getOutpoint = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.looprpc.Disqualified} returns this + * @param {string} value + * @return {!proto.looprpc.Utxo} returns this */ -proto.looprpc.Disqualified.prototype.setPubkey = function(value) { - return jspb.Message.setProto3BytesField(this, 3, value); +proto.looprpc.Utxo.prototype.setOutpoint = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); }; /** - * optional AutoReason reason = 2; - * @return {!proto.looprpc.AutoReason} + * optional int64 confirmations = 4; + * @return {string} */ -proto.looprpc.Disqualified.prototype.getReason = function() { - return /** @type {!proto.looprpc.AutoReason} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +proto.looprpc.Utxo.prototype.getConfirmations = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "0")); }; /** - * @param {!proto.looprpc.AutoReason} value - * @return {!proto.looprpc.Disqualified} returns this + * @param {string} value + * @return {!proto.looprpc.Utxo} returns this */ -proto.looprpc.Disqualified.prototype.setReason = function(value) { - return jspb.Message.setProto3EnumField(this, 2, value); +proto.looprpc.Utxo.prototype.setConfirmations = function(value) { + return jspb.Message.setProto3StringIntField(this, 4, value); }; @@ -9019,7 +13062,7 @@ proto.looprpc.Disqualified.prototype.setReason = function(value) { * @private {!Array} * @const */ -proto.looprpc.SuggestSwapsResponse.repeatedFields_ = [1,3,2]; +proto.looprpc.WithdrawDepositsRequest.repeatedFields_ = [1]; @@ -9036,8 +13079,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.SuggestSwapsResponse.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.SuggestSwapsResponse.toObject(opt_includeInstance, this); +proto.looprpc.WithdrawDepositsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.WithdrawDepositsRequest.toObject(opt_includeInstance, this); }; @@ -9046,18 +13089,17 @@ proto.looprpc.SuggestSwapsResponse.prototype.toObject = function(opt_includeInst * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.SuggestSwapsResponse} msg The msg instance to transform. + * @param {!proto.looprpc.WithdrawDepositsRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.SuggestSwapsResponse.toObject = function(includeInstance, msg) { +proto.looprpc.WithdrawDepositsRequest.toObject = function(includeInstance, msg) { var f, obj = { - loopOutList: jspb.Message.toObjectList(msg.getLoopOutList(), - proto.looprpc.LoopOutRequest.toObject, includeInstance), - loopInList: jspb.Message.toObjectList(msg.getLoopInList(), - proto.looprpc.LoopInRequest.toObject, includeInstance), - disqualifiedList: jspb.Message.toObjectList(msg.getDisqualifiedList(), - proto.looprpc.Disqualified.toObject, includeInstance) + outpointsList: jspb.Message.toObjectList(msg.getOutpointsList(), + proto.looprpc.OutPoint.toObject, includeInstance), + all: jspb.Message.getBooleanFieldWithDefault(msg, 2, false), + destAddr: jspb.Message.getFieldWithDefault(msg, 3, ""), + satPerVbyte: jspb.Message.getFieldWithDefault(msg, 4, "0") }; if (includeInstance) { @@ -9071,23 +13113,23 @@ proto.looprpc.SuggestSwapsResponse.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.SuggestSwapsResponse} + * @return {!proto.looprpc.WithdrawDepositsRequest} */ -proto.looprpc.SuggestSwapsResponse.deserializeBinary = function(bytes) { +proto.looprpc.WithdrawDepositsRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.SuggestSwapsResponse; - return proto.looprpc.SuggestSwapsResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.WithdrawDepositsRequest; + return proto.looprpc.WithdrawDepositsRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.SuggestSwapsResponse} msg The message object to deserialize into. + * @param {!proto.looprpc.WithdrawDepositsRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.SuggestSwapsResponse} + * @return {!proto.looprpc.WithdrawDepositsRequest} */ -proto.looprpc.SuggestSwapsResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.WithdrawDepositsRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -9095,19 +13137,21 @@ proto.looprpc.SuggestSwapsResponse.deserializeBinaryFromReader = function(msg, r var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.looprpc.LoopOutRequest; - reader.readMessage(value,proto.looprpc.LoopOutRequest.deserializeBinaryFromReader); - msg.addLoopOut(value); + var value = new proto.looprpc.OutPoint; + reader.readMessage(value,proto.looprpc.OutPoint.deserializeBinaryFromReader); + msg.addOutpoints(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setAll(value); break; case 3: - var value = new proto.looprpc.LoopInRequest; - reader.readMessage(value,proto.looprpc.LoopInRequest.deserializeBinaryFromReader); - msg.addLoopIn(value); + var value = /** @type {string} */ (reader.readString()); + msg.setDestAddr(value); break; - case 2: - var value = new proto.looprpc.Disqualified; - reader.readMessage(value,proto.looprpc.Disqualified.deserializeBinaryFromReader); - msg.addDisqualified(value); + case 4: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setSatPerVbyte(value); break; default: reader.skipField(); @@ -9122,9 +13166,9 @@ proto.looprpc.SuggestSwapsResponse.deserializeBinaryFromReader = function(msg, r * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.SuggestSwapsResponse.prototype.serializeBinary = function() { +proto.looprpc.WithdrawDepositsRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.SuggestSwapsResponse.serializeBinaryToWriter(this, writer); + proto.looprpc.WithdrawDepositsRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -9132,150 +13176,293 @@ proto.looprpc.SuggestSwapsResponse.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.SuggestSwapsResponse} message + * @param {!proto.looprpc.WithdrawDepositsRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.SuggestSwapsResponse.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.WithdrawDepositsRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getLoopOutList(); + f = message.getOutpointsList(); if (f.length > 0) { writer.writeRepeatedMessage( 1, f, - proto.looprpc.LoopOutRequest.serializeBinaryToWriter + proto.looprpc.OutPoint.serializeBinaryToWriter ); } - f = message.getLoopInList(); + f = message.getAll(); + if (f) { + writer.writeBool( + 2, + f + ); + } + f = message.getDestAddr(); if (f.length > 0) { - writer.writeRepeatedMessage( + writer.writeString( 3, - f, - proto.looprpc.LoopInRequest.serializeBinaryToWriter + f ); } - f = message.getDisqualifiedList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 2, - f, - proto.looprpc.Disqualified.serializeBinaryToWriter + f = message.getSatPerVbyte(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 4, + f ); } }; /** - * repeated LoopOutRequest loop_out = 1; - * @return {!Array} + * repeated OutPoint outpoints = 1; + * @return {!Array} */ -proto.looprpc.SuggestSwapsResponse.prototype.getLoopOutList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.looprpc.LoopOutRequest, 1)); +proto.looprpc.WithdrawDepositsRequest.prototype.getOutpointsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.looprpc.OutPoint, 1)); }; /** - * @param {!Array} value - * @return {!proto.looprpc.SuggestSwapsResponse} returns this + * @param {!Array} value + * @return {!proto.looprpc.WithdrawDepositsRequest} returns this */ -proto.looprpc.SuggestSwapsResponse.prototype.setLoopOutList = function(value) { +proto.looprpc.WithdrawDepositsRequest.prototype.setOutpointsList = function(value) { return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** - * @param {!proto.looprpc.LoopOutRequest=} opt_value + * @param {!proto.looprpc.OutPoint=} opt_value * @param {number=} opt_index - * @return {!proto.looprpc.LoopOutRequest} + * @return {!proto.looprpc.OutPoint} */ -proto.looprpc.SuggestSwapsResponse.prototype.addLoopOut = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.looprpc.LoopOutRequest, opt_index); +proto.looprpc.WithdrawDepositsRequest.prototype.addOutpoints = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.looprpc.OutPoint, opt_index); }; /** * Clears the list making it empty but non-null. - * @return {!proto.looprpc.SuggestSwapsResponse} returns this + * @return {!proto.looprpc.WithdrawDepositsRequest} returns this + */ +proto.looprpc.WithdrawDepositsRequest.prototype.clearOutpointsList = function() { + return this.setOutpointsList([]); +}; + + +/** + * optional bool all = 2; + * @return {boolean} + */ +proto.looprpc.WithdrawDepositsRequest.prototype.getAll = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.looprpc.WithdrawDepositsRequest} returns this + */ +proto.looprpc.WithdrawDepositsRequest.prototype.setAll = function(value) { + return jspb.Message.setProto3BooleanField(this, 2, value); +}; + + +/** + * optional string dest_addr = 3; + * @return {string} + */ +proto.looprpc.WithdrawDepositsRequest.prototype.getDestAddr = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.WithdrawDepositsRequest} returns this + */ +proto.looprpc.WithdrawDepositsRequest.prototype.setDestAddr = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * optional int64 sat_per_vbyte = 4; + * @return {string} + */ +proto.looprpc.WithdrawDepositsRequest.prototype.getSatPerVbyte = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.WithdrawDepositsRequest} returns this + */ +proto.looprpc.WithdrawDepositsRequest.prototype.setSatPerVbyte = function(value) { + return jspb.Message.setProto3StringIntField(this, 4, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.looprpc.WithdrawDepositsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.WithdrawDepositsResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.looprpc.WithdrawDepositsResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.SuggestSwapsResponse.prototype.clearLoopOutList = function() { - return this.setLoopOutList([]); +proto.looprpc.WithdrawDepositsResponse.toObject = function(includeInstance, msg) { + var f, obj = { + withdrawalTxHash: jspb.Message.getFieldWithDefault(msg, 1, ""), + pkScript: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * repeated LoopInRequest loop_in = 3; - * @return {!Array} + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.looprpc.WithdrawDepositsResponse} */ -proto.looprpc.SuggestSwapsResponse.prototype.getLoopInList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.looprpc.LoopInRequest, 3)); +proto.looprpc.WithdrawDepositsResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.looprpc.WithdrawDepositsResponse; + return proto.looprpc.WithdrawDepositsResponse.deserializeBinaryFromReader(msg, reader); }; /** - * @param {!Array} value - * @return {!proto.looprpc.SuggestSwapsResponse} returns this -*/ -proto.looprpc.SuggestSwapsResponse.prototype.setLoopInList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 3, value); + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.looprpc.WithdrawDepositsResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.WithdrawDepositsResponse} + */ +proto.looprpc.WithdrawDepositsResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setWithdrawalTxHash(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setPkScript(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * @param {!proto.looprpc.LoopInRequest=} opt_value - * @param {number=} opt_index - * @return {!proto.looprpc.LoopInRequest} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.looprpc.SuggestSwapsResponse.prototype.addLoopIn = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.looprpc.LoopInRequest, opt_index); +proto.looprpc.WithdrawDepositsResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.WithdrawDepositsResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.looprpc.SuggestSwapsResponse} returns this + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.WithdrawDepositsResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.SuggestSwapsResponse.prototype.clearLoopInList = function() { - return this.setLoopInList([]); +proto.looprpc.WithdrawDepositsResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getWithdrawalTxHash(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getPkScript(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } }; /** - * repeated Disqualified disqualified = 2; - * @return {!Array} + * optional string withdrawal_tx_hash = 1; + * @return {string} */ -proto.looprpc.SuggestSwapsResponse.prototype.getDisqualifiedList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.looprpc.Disqualified, 2)); +proto.looprpc.WithdrawDepositsResponse.prototype.getWithdrawalTxHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * @param {!Array} value - * @return {!proto.looprpc.SuggestSwapsResponse} returns this -*/ -proto.looprpc.SuggestSwapsResponse.prototype.setDisqualifiedList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 2, value); + * @param {string} value + * @return {!proto.looprpc.WithdrawDepositsResponse} returns this + */ +proto.looprpc.WithdrawDepositsResponse.prototype.setWithdrawalTxHash = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); }; /** - * @param {!proto.looprpc.Disqualified=} opt_value - * @param {number=} opt_index - * @return {!proto.looprpc.Disqualified} + * optional string pk_script = 2; + * @return {string} */ -proto.looprpc.SuggestSwapsResponse.prototype.addDisqualified = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.looprpc.Disqualified, opt_index); +proto.looprpc.WithdrawDepositsResponse.prototype.getPkScript = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.looprpc.SuggestSwapsResponse} returns this + * @param {string} value + * @return {!proto.looprpc.WithdrawDepositsResponse} returns this */ -proto.looprpc.SuggestSwapsResponse.prototype.clearDisqualifiedList = function() { - return this.setDisqualifiedList([]); +proto.looprpc.WithdrawDepositsResponse.prototype.setPkScript = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); }; @@ -9295,8 +13482,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.AbandonSwapRequest.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.AbandonSwapRequest.toObject(opt_includeInstance, this); +proto.looprpc.OutPoint.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.OutPoint.toObject(opt_includeInstance, this); }; @@ -9305,14 +13492,15 @@ proto.looprpc.AbandonSwapRequest.prototype.toObject = function(opt_includeInstan * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.AbandonSwapRequest} msg The msg instance to transform. + * @param {!proto.looprpc.OutPoint} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.AbandonSwapRequest.toObject = function(includeInstance, msg) { +proto.looprpc.OutPoint.toObject = function(includeInstance, msg) { var f, obj = { - id: msg.getId_asB64(), - iKnowWhatIAmDoing: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) + txidBytes: msg.getTxidBytes_asB64(), + txidStr: jspb.Message.getFieldWithDefault(msg, 2, ""), + outputIndex: jspb.Message.getFieldWithDefault(msg, 3, 0) }; if (includeInstance) { @@ -9326,23 +13514,23 @@ proto.looprpc.AbandonSwapRequest.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.AbandonSwapRequest} + * @return {!proto.looprpc.OutPoint} */ -proto.looprpc.AbandonSwapRequest.deserializeBinary = function(bytes) { +proto.looprpc.OutPoint.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.AbandonSwapRequest; - return proto.looprpc.AbandonSwapRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.OutPoint; + return proto.looprpc.OutPoint.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.AbandonSwapRequest} msg The message object to deserialize into. + * @param {!proto.looprpc.OutPoint} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.AbandonSwapRequest} + * @return {!proto.looprpc.OutPoint} */ -proto.looprpc.AbandonSwapRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.OutPoint.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -9351,11 +13539,15 @@ proto.looprpc.AbandonSwapRequest.deserializeBinaryFromReader = function(msg, rea switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setId(value); + msg.setTxidBytes(value); break; case 2: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setIKnowWhatIAmDoing(value); + var value = /** @type {string} */ (reader.readString()); + msg.setTxidStr(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint32()); + msg.setOutputIndex(value); break; default: reader.skipField(); @@ -9370,9 +13562,9 @@ proto.looprpc.AbandonSwapRequest.deserializeBinaryFromReader = function(msg, rea * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.AbandonSwapRequest.prototype.serializeBinary = function() { +proto.looprpc.OutPoint.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.AbandonSwapRequest.serializeBinaryToWriter(this, writer); + proto.looprpc.OutPoint.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -9380,90 +13572,122 @@ proto.looprpc.AbandonSwapRequest.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.AbandonSwapRequest} message + * @param {!proto.looprpc.OutPoint} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.AbandonSwapRequest.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.OutPoint.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getId_asU8(); + f = message.getTxidBytes_asU8(); if (f.length > 0) { writer.writeBytes( 1, f ); } - f = message.getIKnowWhatIAmDoing(); - if (f) { - writer.writeBool( + f = message.getTxidStr(); + if (f.length > 0) { + writer.writeString( 2, f ); } + f = message.getOutputIndex(); + if (f !== 0) { + writer.writeUint32( + 3, + f + ); + } }; /** - * optional bytes id = 1; + * optional bytes txid_bytes = 1; * @return {!(string|Uint8Array)} */ -proto.looprpc.AbandonSwapRequest.prototype.getId = function() { +proto.looprpc.OutPoint.prototype.getTxidBytes = function() { return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional bytes id = 1; - * This is a type-conversion wrapper around `getId()` + * optional bytes txid_bytes = 1; + * This is a type-conversion wrapper around `getTxidBytes()` * @return {string} */ -proto.looprpc.AbandonSwapRequest.prototype.getId_asB64 = function() { +proto.looprpc.OutPoint.prototype.getTxidBytes_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getId())); + this.getTxidBytes())); }; /** - * optional bytes id = 1; + * optional bytes txid_bytes = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getId()` + * This is a type-conversion wrapper around `getTxidBytes()` * @return {!Uint8Array} */ -proto.looprpc.AbandonSwapRequest.prototype.getId_asU8 = function() { +proto.looprpc.OutPoint.prototype.getTxidBytes_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getId())); + this.getTxidBytes())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.looprpc.AbandonSwapRequest} returns this + * @return {!proto.looprpc.OutPoint} returns this */ -proto.looprpc.AbandonSwapRequest.prototype.setId = function(value) { +proto.looprpc.OutPoint.prototype.setTxidBytes = function(value) { return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * optional bool i_know_what_i_am_doing = 2; - * @return {boolean} + * optional string txid_str = 2; + * @return {string} */ -proto.looprpc.AbandonSwapRequest.prototype.getIKnowWhatIAmDoing = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +proto.looprpc.OutPoint.prototype.getTxidStr = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** - * @param {boolean} value - * @return {!proto.looprpc.AbandonSwapRequest} returns this + * @param {string} value + * @return {!proto.looprpc.OutPoint} returns this */ -proto.looprpc.AbandonSwapRequest.prototype.setIKnowWhatIAmDoing = function(value) { - return jspb.Message.setProto3BooleanField(this, 2, value); +proto.looprpc.OutPoint.prototype.setTxidStr = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional uint32 output_index = 3; + * @return {number} + */ +proto.looprpc.OutPoint.prototype.getOutputIndex = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.looprpc.OutPoint} returns this + */ +proto.looprpc.OutPoint.prototype.setOutputIndex = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); }; +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.looprpc.ListStaticAddressDepositsRequest.repeatedFields_ = [2]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -9479,8 +13703,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.AbandonSwapResponse.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.AbandonSwapResponse.toObject(opt_includeInstance, this); +proto.looprpc.ListStaticAddressDepositsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.ListStaticAddressDepositsRequest.toObject(opt_includeInstance, this); }; @@ -9489,13 +13713,14 @@ proto.looprpc.AbandonSwapResponse.prototype.toObject = function(opt_includeInsta * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.AbandonSwapResponse} msg The msg instance to transform. + * @param {!proto.looprpc.ListStaticAddressDepositsRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.AbandonSwapResponse.toObject = function(includeInstance, msg) { +proto.looprpc.ListStaticAddressDepositsRequest.toObject = function(includeInstance, msg) { var f, obj = { - + stateFilter: jspb.Message.getFieldWithDefault(msg, 1, 0), + outpointsList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f }; if (includeInstance) { @@ -9509,29 +13734,37 @@ proto.looprpc.AbandonSwapResponse.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.AbandonSwapResponse} + * @return {!proto.looprpc.ListStaticAddressDepositsRequest} */ -proto.looprpc.AbandonSwapResponse.deserializeBinary = function(bytes) { +proto.looprpc.ListStaticAddressDepositsRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.AbandonSwapResponse; - return proto.looprpc.AbandonSwapResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.ListStaticAddressDepositsRequest; + return proto.looprpc.ListStaticAddressDepositsRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.AbandonSwapResponse} msg The message object to deserialize into. + * @param {!proto.looprpc.ListStaticAddressDepositsRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.AbandonSwapResponse} + * @return {!proto.looprpc.ListStaticAddressDepositsRequest} */ -proto.looprpc.AbandonSwapResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.ListStaticAddressDepositsRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { + case 1: + var value = /** @type {!proto.looprpc.DepositState} */ (reader.readEnum()); + msg.setStateFilter(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.addOutpoints(value); + break; default: reader.skipField(); break; @@ -9545,26 +13778,102 @@ proto.looprpc.AbandonSwapResponse.deserializeBinaryFromReader = function(msg, re * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.AbandonSwapResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.AbandonSwapResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.looprpc.ListStaticAddressDepositsRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.ListStaticAddressDepositsRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.ListStaticAddressDepositsRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.ListStaticAddressDepositsRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getStateFilter(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getOutpointsList(); + if (f.length > 0) { + writer.writeRepeatedString( + 2, + f + ); + } +}; + + +/** + * optional DepositState state_filter = 1; + * @return {!proto.looprpc.DepositState} + */ +proto.looprpc.ListStaticAddressDepositsRequest.prototype.getStateFilter = function() { + return /** @type {!proto.looprpc.DepositState} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.looprpc.DepositState} value + * @return {!proto.looprpc.ListStaticAddressDepositsRequest} returns this + */ +proto.looprpc.ListStaticAddressDepositsRequest.prototype.setStateFilter = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * repeated string outpoints = 2; + * @return {!Array} + */ +proto.looprpc.ListStaticAddressDepositsRequest.prototype.getOutpointsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.looprpc.ListStaticAddressDepositsRequest} returns this + */ +proto.looprpc.ListStaticAddressDepositsRequest.prototype.setOutpointsList = function(value) { + return jspb.Message.setField(this, 2, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.looprpc.ListStaticAddressDepositsRequest} returns this + */ +proto.looprpc.ListStaticAddressDepositsRequest.prototype.addOutpoints = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.AbandonSwapResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * Clears the list making it empty but non-null. + * @return {!proto.looprpc.ListStaticAddressDepositsRequest} returns this */ -proto.looprpc.AbandonSwapResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; +proto.looprpc.ListStaticAddressDepositsRequest.prototype.clearOutpointsList = function() { + return this.setOutpointsList([]); }; +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.looprpc.ListStaticAddressDepositsResponse.repeatedFields_ = [1]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -9580,8 +13889,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.ListReservationsRequest.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.ListReservationsRequest.toObject(opt_includeInstance, this); +proto.looprpc.ListStaticAddressDepositsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.ListStaticAddressDepositsResponse.toObject(opt_includeInstance, this); }; @@ -9590,13 +13899,14 @@ proto.looprpc.ListReservationsRequest.prototype.toObject = function(opt_includeI * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.ListReservationsRequest} msg The msg instance to transform. + * @param {!proto.looprpc.ListStaticAddressDepositsResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.ListReservationsRequest.toObject = function(includeInstance, msg) { +proto.looprpc.ListStaticAddressDepositsResponse.toObject = function(includeInstance, msg) { var f, obj = { - + filteredDepositsList: jspb.Message.toObjectList(msg.getFilteredDepositsList(), + proto.looprpc.Deposit.toObject, includeInstance) }; if (includeInstance) { @@ -9610,29 +13920,34 @@ proto.looprpc.ListReservationsRequest.toObject = function(includeInstance, msg) /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.ListReservationsRequest} + * @return {!proto.looprpc.ListStaticAddressDepositsResponse} */ -proto.looprpc.ListReservationsRequest.deserializeBinary = function(bytes) { +proto.looprpc.ListStaticAddressDepositsResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.ListReservationsRequest; - return proto.looprpc.ListReservationsRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.ListStaticAddressDepositsResponse; + return proto.looprpc.ListStaticAddressDepositsResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.ListReservationsRequest} msg The message object to deserialize into. + * @param {!proto.looprpc.ListStaticAddressDepositsResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.ListReservationsRequest} + * @return {!proto.looprpc.ListStaticAddressDepositsResponse} */ -proto.looprpc.ListReservationsRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.ListStaticAddressDepositsResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { + case 1: + var value = new proto.looprpc.Deposit; + reader.readMessage(value,proto.looprpc.Deposit.deserializeBinaryFromReader); + msg.addFilteredDeposits(value); + break; default: reader.skipField(); break; @@ -9646,9 +13961,9 @@ proto.looprpc.ListReservationsRequest.deserializeBinaryFromReader = function(msg * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.ListReservationsRequest.prototype.serializeBinary = function() { +proto.looprpc.ListStaticAddressDepositsResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.ListReservationsRequest.serializeBinaryToWriter(this, writer); + proto.looprpc.ListStaticAddressDepositsResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -9656,22 +13971,61 @@ proto.looprpc.ListReservationsRequest.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.ListReservationsRequest} message + * @param {!proto.looprpc.ListStaticAddressDepositsResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.ListReservationsRequest.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.ListStaticAddressDepositsResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; + f = message.getFilteredDepositsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.looprpc.Deposit.serializeBinaryToWriter + ); + } }; +/** + * repeated Deposit filtered_deposits = 1; + * @return {!Array} + */ +proto.looprpc.ListStaticAddressDepositsResponse.prototype.getFilteredDepositsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.looprpc.Deposit, 1)); +}; + /** - * List of repeated fields within this message type. - * @private {!Array} - * @const + * @param {!Array} value + * @return {!proto.looprpc.ListStaticAddressDepositsResponse} returns this +*/ +proto.looprpc.ListStaticAddressDepositsResponse.prototype.setFilteredDepositsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.looprpc.Deposit=} opt_value + * @param {number=} opt_index + * @return {!proto.looprpc.Deposit} */ -proto.looprpc.ListReservationsResponse.repeatedFields_ = [1]; +proto.looprpc.ListStaticAddressDepositsResponse.prototype.addFilteredDeposits = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.looprpc.Deposit, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.looprpc.ListStaticAddressDepositsResponse} returns this + */ +proto.looprpc.ListStaticAddressDepositsResponse.prototype.clearFilteredDepositsList = function() { + return this.setFilteredDepositsList([]); +}; + + @@ -9688,8 +14042,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.ListReservationsResponse.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.ListReservationsResponse.toObject(opt_includeInstance, this); +proto.looprpc.ListStaticAddressSwapsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.ListStaticAddressSwapsRequest.toObject(opt_includeInstance, this); }; @@ -9698,14 +14052,13 @@ proto.looprpc.ListReservationsResponse.prototype.toObject = function(opt_include * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.ListReservationsResponse} msg The msg instance to transform. + * @param {!proto.looprpc.ListStaticAddressSwapsRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.ListReservationsResponse.toObject = function(includeInstance, msg) { +proto.looprpc.ListStaticAddressSwapsRequest.toObject = function(includeInstance, msg) { var f, obj = { - reservationsList: jspb.Message.toObjectList(msg.getReservationsList(), - proto.looprpc.ClientReservation.toObject, includeInstance) + }; if (includeInstance) { @@ -9719,34 +14072,29 @@ proto.looprpc.ListReservationsResponse.toObject = function(includeInstance, msg) /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.ListReservationsResponse} + * @return {!proto.looprpc.ListStaticAddressSwapsRequest} */ -proto.looprpc.ListReservationsResponse.deserializeBinary = function(bytes) { +proto.looprpc.ListStaticAddressSwapsRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.ListReservationsResponse; - return proto.looprpc.ListReservationsResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.ListStaticAddressSwapsRequest; + return proto.looprpc.ListStaticAddressSwapsRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.ListReservationsResponse} msg The message object to deserialize into. + * @param {!proto.looprpc.ListStaticAddressSwapsRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.ListReservationsResponse} + * @return {!proto.looprpc.ListStaticAddressSwapsRequest} */ -proto.looprpc.ListReservationsResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.ListStaticAddressSwapsRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = new proto.looprpc.ClientReservation; - reader.readMessage(value,proto.looprpc.ClientReservation.deserializeBinaryFromReader); - msg.addReservations(value); - break; default: reader.skipField(); break; @@ -9760,9 +14108,9 @@ proto.looprpc.ListReservationsResponse.deserializeBinaryFromReader = function(ms * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.ListReservationsResponse.prototype.serializeBinary = function() { +proto.looprpc.ListStaticAddressSwapsRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.ListReservationsResponse.serializeBinaryToWriter(this, writer); + proto.looprpc.ListStaticAddressSwapsRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -9770,61 +14118,22 @@ proto.looprpc.ListReservationsResponse.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.ListReservationsResponse} message + * @param {!proto.looprpc.ListStaticAddressSwapsRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.ListReservationsResponse.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.ListStaticAddressSwapsRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getReservationsList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 1, - f, - proto.looprpc.ClientReservation.serializeBinaryToWriter - ); - } -}; - - -/** - * repeated ClientReservation reservations = 1; - * @return {!Array} - */ -proto.looprpc.ListReservationsResponse.prototype.getReservationsList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.looprpc.ClientReservation, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.looprpc.ListReservationsResponse} returns this -*/ -proto.looprpc.ListReservationsResponse.prototype.setReservationsList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); }; -/** - * @param {!proto.looprpc.ClientReservation=} opt_value - * @param {number=} opt_index - * @return {!proto.looprpc.ClientReservation} - */ -proto.looprpc.ListReservationsResponse.prototype.addReservations = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.looprpc.ClientReservation, opt_index); -}; - /** - * Clears the list making it empty but non-null. - * @return {!proto.looprpc.ListReservationsResponse} returns this + * List of repeated fields within this message type. + * @private {!Array} + * @const */ -proto.looprpc.ListReservationsResponse.prototype.clearReservationsList = function() { - return this.setReservationsList([]); -}; - - +proto.looprpc.ListStaticAddressSwapsResponse.repeatedFields_ = [1]; @@ -9841,8 +14150,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.ClientReservation.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.ClientReservation.toObject(opt_includeInstance, this); +proto.looprpc.ListStaticAddressSwapsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.ListStaticAddressSwapsResponse.toObject(opt_includeInstance, this); }; @@ -9851,18 +14160,14 @@ proto.looprpc.ClientReservation.prototype.toObject = function(opt_includeInstanc * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.ClientReservation} msg The msg instance to transform. + * @param {!proto.looprpc.ListStaticAddressSwapsResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.ClientReservation.toObject = function(includeInstance, msg) { +proto.looprpc.ListStaticAddressSwapsResponse.toObject = function(includeInstance, msg) { var f, obj = { - reservationId: msg.getReservationId_asB64(), - state: jspb.Message.getFieldWithDefault(msg, 2, ""), - amount: jspb.Message.getFieldWithDefault(msg, 3, "0"), - txId: jspb.Message.getFieldWithDefault(msg, 4, ""), - vout: jspb.Message.getFieldWithDefault(msg, 5, 0), - expiry: jspb.Message.getFieldWithDefault(msg, 6, 0) + swapsList: jspb.Message.toObjectList(msg.getSwapsList(), + proto.looprpc.StaticAddressLoopInSwap.toObject, includeInstance) }; if (includeInstance) { @@ -9876,23 +14181,23 @@ proto.looprpc.ClientReservation.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.ClientReservation} + * @return {!proto.looprpc.ListStaticAddressSwapsResponse} */ -proto.looprpc.ClientReservation.deserializeBinary = function(bytes) { +proto.looprpc.ListStaticAddressSwapsResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.ClientReservation; - return proto.looprpc.ClientReservation.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.ListStaticAddressSwapsResponse; + return proto.looprpc.ListStaticAddressSwapsResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.ClientReservation} msg The message object to deserialize into. + * @param {!proto.looprpc.ListStaticAddressSwapsResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.ClientReservation} + * @return {!proto.looprpc.ListStaticAddressSwapsResponse} */ -proto.looprpc.ClientReservation.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.ListStaticAddressSwapsResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -9900,28 +14205,9 @@ proto.looprpc.ClientReservation.deserializeBinaryFromReader = function(msg, read var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setReservationId(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setState(value); - break; - case 3: - var value = /** @type {string} */ (reader.readUint64String()); - msg.setAmount(value); - break; - case 4: - var value = /** @type {string} */ (reader.readString()); - msg.setTxId(value); - break; - case 5: - var value = /** @type {number} */ (reader.readUint32()); - msg.setVout(value); - break; - case 6: - var value = /** @type {number} */ (reader.readUint32()); - msg.setExpiry(value); + var value = new proto.looprpc.StaticAddressLoopInSwap; + reader.readMessage(value,proto.looprpc.StaticAddressLoopInSwap.deserializeBinaryFromReader); + msg.addSwaps(value); break; default: reader.skipField(); @@ -9936,9 +14222,9 @@ proto.looprpc.ClientReservation.deserializeBinaryFromReader = function(msg, read * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.ClientReservation.prototype.serializeBinary = function() { +proto.looprpc.ListStaticAddressSwapsResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.ClientReservation.serializeBinaryToWriter(this, writer); + proto.looprpc.ListStaticAddressSwapsResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -9946,197 +14232,163 @@ proto.looprpc.ClientReservation.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.ClientReservation} message + * @param {!proto.looprpc.ListStaticAddressSwapsResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.ClientReservation.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.ListStaticAddressSwapsResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getReservationId_asU8(); + f = message.getSwapsList(); if (f.length > 0) { - writer.writeBytes( + writer.writeRepeatedMessage( 1, - f - ); - } - f = message.getState(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getAmount(); - if (parseInt(f, 10) !== 0) { - writer.writeUint64String( - 3, - f - ); - } - f = message.getTxId(); - if (f.length > 0) { - writer.writeString( - 4, - f - ); - } - f = message.getVout(); - if (f !== 0) { - writer.writeUint32( - 5, - f - ); - } - f = message.getExpiry(); - if (f !== 0) { - writer.writeUint32( - 6, - f + f, + proto.looprpc.StaticAddressLoopInSwap.serializeBinaryToWriter ); - } -}; - - -/** - * optional bytes reservation_id = 1; - * @return {!(string|Uint8Array)} - */ -proto.looprpc.ClientReservation.prototype.getReservationId = function() { - return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * optional bytes reservation_id = 1; - * This is a type-conversion wrapper around `getReservationId()` - * @return {string} - */ -proto.looprpc.ClientReservation.prototype.getReservationId_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getReservationId())); -}; - - -/** - * optional bytes reservation_id = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getReservationId()` - * @return {!Uint8Array} - */ -proto.looprpc.ClientReservation.prototype.getReservationId_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getReservationId())); + } }; /** - * @param {!(string|Uint8Array)} value - * @return {!proto.looprpc.ClientReservation} returns this + * repeated StaticAddressLoopInSwap swaps = 1; + * @return {!Array} */ -proto.looprpc.ClientReservation.prototype.setReservationId = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); +proto.looprpc.ListStaticAddressSwapsResponse.prototype.getSwapsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.looprpc.StaticAddressLoopInSwap, 1)); }; /** - * optional string state = 2; - * @return {string} - */ -proto.looprpc.ClientReservation.prototype.getState = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); + * @param {!Array} value + * @return {!proto.looprpc.ListStaticAddressSwapsResponse} returns this +*/ +proto.looprpc.ListStaticAddressSwapsResponse.prototype.setSwapsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** - * @param {string} value - * @return {!proto.looprpc.ClientReservation} returns this + * @param {!proto.looprpc.StaticAddressLoopInSwap=} opt_value + * @param {number=} opt_index + * @return {!proto.looprpc.StaticAddressLoopInSwap} */ -proto.looprpc.ClientReservation.prototype.setState = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); +proto.looprpc.ListStaticAddressSwapsResponse.prototype.addSwaps = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.looprpc.StaticAddressLoopInSwap, opt_index); }; /** - * optional uint64 amount = 3; - * @return {string} + * Clears the list making it empty but non-null. + * @return {!proto.looprpc.ListStaticAddressSwapsResponse} returns this */ -proto.looprpc.ClientReservation.prototype.getAmount = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "0")); +proto.looprpc.ListStaticAddressSwapsResponse.prototype.clearSwapsList = function() { + return this.setSwapsList([]); }; -/** - * @param {string} value - * @return {!proto.looprpc.ClientReservation} returns this - */ -proto.looprpc.ClientReservation.prototype.setAmount = function(value) { - return jspb.Message.setProto3StringIntField(this, 3, value); -}; + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * optional string tx_id = 4; - * @return {string} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -proto.looprpc.ClientReservation.prototype.getTxId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +proto.looprpc.StaticAddressSummaryRequest.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.StaticAddressSummaryRequest.toObject(opt_includeInstance, this); }; /** - * @param {string} value - * @return {!proto.looprpc.ClientReservation} returns this + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.looprpc.StaticAddressSummaryRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.ClientReservation.prototype.setTxId = function(value) { - return jspb.Message.setProto3StringField(this, 4, value); +proto.looprpc.StaticAddressSummaryRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} /** - * optional uint32 vout = 5; - * @return {number} + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.looprpc.StaticAddressSummaryRequest} */ -proto.looprpc.ClientReservation.prototype.getVout = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +proto.looprpc.StaticAddressSummaryRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.looprpc.StaticAddressSummaryRequest; + return proto.looprpc.StaticAddressSummaryRequest.deserializeBinaryFromReader(msg, reader); }; /** - * @param {number} value - * @return {!proto.looprpc.ClientReservation} returns this + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.looprpc.StaticAddressSummaryRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.looprpc.StaticAddressSummaryRequest} */ -proto.looprpc.ClientReservation.prototype.setVout = function(value) { - return jspb.Message.setProto3IntField(this, 5, value); +proto.looprpc.StaticAddressSummaryRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; }; /** - * optional uint32 expiry = 6; - * @return {number} + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ -proto.looprpc.ClientReservation.prototype.getExpiry = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); +proto.looprpc.StaticAddressSummaryRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.looprpc.StaticAddressSummaryRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); }; /** - * @param {number} value - * @return {!proto.looprpc.ClientReservation} returns this + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.StaticAddressSummaryRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.ClientReservation.prototype.setExpiry = function(value) { - return jspb.Message.setProto3IntField(this, 6, value); +proto.looprpc.StaticAddressSummaryRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; }; -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.looprpc.InstantOutRequest.repeatedFields_ = [1,2]; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -10152,8 +14404,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.InstantOutRequest.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.InstantOutRequest.toObject(opt_includeInstance, this); +proto.looprpc.StaticAddressSummaryResponse.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.StaticAddressSummaryResponse.toObject(opt_includeInstance, this); }; @@ -10162,15 +14414,21 @@ proto.looprpc.InstantOutRequest.prototype.toObject = function(opt_includeInstanc * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.InstantOutRequest} msg The msg instance to transform. + * @param {!proto.looprpc.StaticAddressSummaryResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.InstantOutRequest.toObject = function(includeInstance, msg) { +proto.looprpc.StaticAddressSummaryResponse.toObject = function(includeInstance, msg) { var f, obj = { - reservationIdsList: msg.getReservationIdsList_asB64(), - outgoingChanSetList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f, - destAddr: jspb.Message.getFieldWithDefault(msg, 3, "") + staticAddress: jspb.Message.getFieldWithDefault(msg, 1, ""), + relativeExpiryBlocks: jspb.Message.getFieldWithDefault(msg, 2, "0"), + totalNumDeposits: jspb.Message.getFieldWithDefault(msg, 3, 0), + valueUnconfirmedSatoshis: jspb.Message.getFieldWithDefault(msg, 4, "0"), + valueDepositedSatoshis: jspb.Message.getFieldWithDefault(msg, 5, "0"), + valueExpiredSatoshis: jspb.Message.getFieldWithDefault(msg, 6, "0"), + valueWithdrawnSatoshis: jspb.Message.getFieldWithDefault(msg, 7, "0"), + valueLoopedInSatoshis: jspb.Message.getFieldWithDefault(msg, 8, "0"), + valueHtlcTimeoutSweepsSatoshis: jspb.Message.getFieldWithDefault(msg, 9, "0") }; if (includeInstance) { @@ -10184,23 +14442,23 @@ proto.looprpc.InstantOutRequest.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.InstantOutRequest} + * @return {!proto.looprpc.StaticAddressSummaryResponse} */ -proto.looprpc.InstantOutRequest.deserializeBinary = function(bytes) { +proto.looprpc.StaticAddressSummaryResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.InstantOutRequest; - return proto.looprpc.InstantOutRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.StaticAddressSummaryResponse; + return proto.looprpc.StaticAddressSummaryResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.InstantOutRequest} msg The message object to deserialize into. + * @param {!proto.looprpc.StaticAddressSummaryResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.InstantOutRequest} + * @return {!proto.looprpc.StaticAddressSummaryResponse} */ -proto.looprpc.InstantOutRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.StaticAddressSummaryResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -10208,18 +14466,40 @@ proto.looprpc.InstantOutRequest.deserializeBinaryFromReader = function(msg, read var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.addReservationIds(value); + var value = /** @type {string} */ (reader.readString()); + msg.setStaticAddress(value); break; case 2: - var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedUint64String() : [reader.readUint64String()]); - for (var i = 0; i < values.length; i++) { - msg.addOutgoingChanSet(values[i]); - } + var value = /** @type {string} */ (reader.readUint64String()); + msg.setRelativeExpiryBlocks(value); break; case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setDestAddr(value); + var value = /** @type {number} */ (reader.readUint32()); + msg.setTotalNumDeposits(value); + break; + case 4: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setValueUnconfirmedSatoshis(value); + break; + case 5: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setValueDepositedSatoshis(value); + break; + case 6: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setValueExpiredSatoshis(value); + break; + case 7: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setValueWithdrawnSatoshis(value); + break; + case 8: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setValueLoopedInSatoshis(value); + break; + case 9: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setValueHtlcTimeoutSweepsSatoshis(value); break; default: reader.skipField(); @@ -10234,159 +14514,247 @@ proto.looprpc.InstantOutRequest.deserializeBinaryFromReader = function(msg, read * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.InstantOutRequest.prototype.serializeBinary = function() { +proto.looprpc.StaticAddressSummaryResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.InstantOutRequest.serializeBinaryToWriter(this, writer); + proto.looprpc.StaticAddressSummaryResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.InstantOutRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.looprpc.StaticAddressSummaryResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.looprpc.StaticAddressSummaryResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getStaticAddress(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getRelativeExpiryBlocks(); + if (parseInt(f, 10) !== 0) { + writer.writeUint64String( + 2, + f + ); + } + f = message.getTotalNumDeposits(); + if (f !== 0) { + writer.writeUint32( + 3, + f + ); + } + f = message.getValueUnconfirmedSatoshis(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 4, + f + ); + } + f = message.getValueDepositedSatoshis(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 5, + f + ); + } + f = message.getValueExpiredSatoshis(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 6, + f + ); + } + f = message.getValueWithdrawnSatoshis(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 7, + f + ); + } + f = message.getValueLoopedInSatoshis(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 8, + f + ); + } + f = message.getValueHtlcTimeoutSweepsSatoshis(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 9, + f + ); + } +}; + + +/** + * optional string static_address = 1; + * @return {string} + */ +proto.looprpc.StaticAddressSummaryResponse.prototype.getStaticAddress = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.StaticAddressSummaryResponse} returns this + */ +proto.looprpc.StaticAddressSummaryResponse.prototype.setStaticAddress = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional uint64 relative_expiry_blocks = 2; + * @return {string} + */ +proto.looprpc.StaticAddressSummaryResponse.prototype.getRelativeExpiryBlocks = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.StaticAddressSummaryResponse} returns this + */ +proto.looprpc.StaticAddressSummaryResponse.prototype.setRelativeExpiryBlocks = function(value) { + return jspb.Message.setProto3StringIntField(this, 2, value); +}; + + +/** + * optional uint32 total_num_deposits = 3; + * @return {number} + */ +proto.looprpc.StaticAddressSummaryResponse.prototype.getTotalNumDeposits = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.looprpc.StaticAddressSummaryResponse} returns this */ -proto.looprpc.InstantOutRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getReservationIdsList_asU8(); - if (f.length > 0) { - writer.writeRepeatedBytes( - 1, - f - ); - } - f = message.getOutgoingChanSetList(); - if (f.length > 0) { - writer.writePackedUint64String( - 2, - f - ); - } - f = message.getDestAddr(); - if (f.length > 0) { - writer.writeString( - 3, - f - ); - } +proto.looprpc.StaticAddressSummaryResponse.prototype.setTotalNumDeposits = function(value) { + return jspb.Message.setProto3IntField(this, 3, value); }; /** - * repeated bytes reservation_ids = 1; - * @return {!(Array|Array)} + * optional int64 value_unconfirmed_satoshis = 4; + * @return {string} */ -proto.looprpc.InstantOutRequest.prototype.getReservationIdsList = function() { - return /** @type {!(Array|Array)} */ (jspb.Message.getRepeatedField(this, 1)); +proto.looprpc.StaticAddressSummaryResponse.prototype.getValueUnconfirmedSatoshis = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "0")); }; /** - * repeated bytes reservation_ids = 1; - * This is a type-conversion wrapper around `getReservationIdsList()` - * @return {!Array} + * @param {string} value + * @return {!proto.looprpc.StaticAddressSummaryResponse} returns this */ -proto.looprpc.InstantOutRequest.prototype.getReservationIdsList_asB64 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsB64( - this.getReservationIdsList())); +proto.looprpc.StaticAddressSummaryResponse.prototype.setValueUnconfirmedSatoshis = function(value) { + return jspb.Message.setProto3StringIntField(this, 4, value); }; /** - * repeated bytes reservation_ids = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getReservationIdsList()` - * @return {!Array} + * optional int64 value_deposited_satoshis = 5; + * @return {string} */ -proto.looprpc.InstantOutRequest.prototype.getReservationIdsList_asU8 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsU8( - this.getReservationIdsList())); +proto.looprpc.StaticAddressSummaryResponse.prototype.getValueDepositedSatoshis = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "0")); }; /** - * @param {!(Array|Array)} value - * @return {!proto.looprpc.InstantOutRequest} returns this + * @param {string} value + * @return {!proto.looprpc.StaticAddressSummaryResponse} returns this */ -proto.looprpc.InstantOutRequest.prototype.setReservationIdsList = function(value) { - return jspb.Message.setField(this, 1, value || []); +proto.looprpc.StaticAddressSummaryResponse.prototype.setValueDepositedSatoshis = function(value) { + return jspb.Message.setProto3StringIntField(this, 5, value); }; /** - * @param {!(string|Uint8Array)} value - * @param {number=} opt_index - * @return {!proto.looprpc.InstantOutRequest} returns this + * optional int64 value_expired_satoshis = 6; + * @return {string} */ -proto.looprpc.InstantOutRequest.prototype.addReservationIds = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +proto.looprpc.StaticAddressSummaryResponse.prototype.getValueExpiredSatoshis = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "0")); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.looprpc.InstantOutRequest} returns this + * @param {string} value + * @return {!proto.looprpc.StaticAddressSummaryResponse} returns this */ -proto.looprpc.InstantOutRequest.prototype.clearReservationIdsList = function() { - return this.setReservationIdsList([]); +proto.looprpc.StaticAddressSummaryResponse.prototype.setValueExpiredSatoshis = function(value) { + return jspb.Message.setProto3StringIntField(this, 6, value); }; /** - * repeated uint64 outgoing_chan_set = 2; - * @return {!Array} + * optional int64 value_withdrawn_satoshis = 7; + * @return {string} */ -proto.looprpc.InstantOutRequest.prototype.getOutgoingChanSetList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); +proto.looprpc.StaticAddressSummaryResponse.prototype.getValueWithdrawnSatoshis = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "0")); }; /** - * @param {!Array} value - * @return {!proto.looprpc.InstantOutRequest} returns this + * @param {string} value + * @return {!proto.looprpc.StaticAddressSummaryResponse} returns this */ -proto.looprpc.InstantOutRequest.prototype.setOutgoingChanSetList = function(value) { - return jspb.Message.setField(this, 2, value || []); +proto.looprpc.StaticAddressSummaryResponse.prototype.setValueWithdrawnSatoshis = function(value) { + return jspb.Message.setProto3StringIntField(this, 7, value); }; /** - * @param {string} value - * @param {number=} opt_index - * @return {!proto.looprpc.InstantOutRequest} returns this + * optional int64 value_looped_in_satoshis = 8; + * @return {string} */ -proto.looprpc.InstantOutRequest.prototype.addOutgoingChanSet = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 2, value, opt_index); +proto.looprpc.StaticAddressSummaryResponse.prototype.getValueLoopedInSatoshis = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 8, "0")); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.looprpc.InstantOutRequest} returns this + * @param {string} value + * @return {!proto.looprpc.StaticAddressSummaryResponse} returns this */ -proto.looprpc.InstantOutRequest.prototype.clearOutgoingChanSetList = function() { - return this.setOutgoingChanSetList([]); +proto.looprpc.StaticAddressSummaryResponse.prototype.setValueLoopedInSatoshis = function(value) { + return jspb.Message.setProto3StringIntField(this, 8, value); }; /** - * optional string dest_addr = 3; + * optional int64 value_htlc_timeout_sweeps_satoshis = 9; * @return {string} */ -proto.looprpc.InstantOutRequest.prototype.getDestAddr = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +proto.looprpc.StaticAddressSummaryResponse.prototype.getValueHtlcTimeoutSweepsSatoshis = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 9, "0")); }; /** * @param {string} value - * @return {!proto.looprpc.InstantOutRequest} returns this + * @return {!proto.looprpc.StaticAddressSummaryResponse} returns this */ -proto.looprpc.InstantOutRequest.prototype.setDestAddr = function(value) { - return jspb.Message.setProto3StringField(this, 3, value); +proto.looprpc.StaticAddressSummaryResponse.prototype.setValueHtlcTimeoutSweepsSatoshis = function(value) { + return jspb.Message.setProto3StringIntField(this, 9, value); }; @@ -10406,8 +14774,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.InstantOutResponse.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.InstantOutResponse.toObject(opt_includeInstance, this); +proto.looprpc.Deposit.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.Deposit.toObject(opt_includeInstance, this); }; @@ -10416,15 +14784,18 @@ proto.looprpc.InstantOutResponse.prototype.toObject = function(opt_includeInstan * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.InstantOutResponse} msg The msg instance to transform. + * @param {!proto.looprpc.Deposit} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.InstantOutResponse.toObject = function(includeInstance, msg) { +proto.looprpc.Deposit.toObject = function(includeInstance, msg) { var f, obj = { - instantOutHash: msg.getInstantOutHash_asB64(), - sweepTxId: jspb.Message.getFieldWithDefault(msg, 2, ""), - state: jspb.Message.getFieldWithDefault(msg, 3, "") + id: msg.getId_asB64(), + state: jspb.Message.getFieldWithDefault(msg, 2, 0), + outpoint: jspb.Message.getFieldWithDefault(msg, 3, ""), + value: jspb.Message.getFieldWithDefault(msg, 4, "0"), + confirmationHeight: jspb.Message.getFieldWithDefault(msg, 5, "0"), + blocksUntilExpiry: jspb.Message.getFieldWithDefault(msg, 6, "0") }; if (includeInstance) { @@ -10438,23 +14809,23 @@ proto.looprpc.InstantOutResponse.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.InstantOutResponse} + * @return {!proto.looprpc.Deposit} */ -proto.looprpc.InstantOutResponse.deserializeBinary = function(bytes) { +proto.looprpc.Deposit.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.InstantOutResponse; - return proto.looprpc.InstantOutResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.Deposit; + return proto.looprpc.Deposit.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.InstantOutResponse} msg The message object to deserialize into. + * @param {!proto.looprpc.Deposit} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.InstantOutResponse} + * @return {!proto.looprpc.Deposit} */ -proto.looprpc.InstantOutResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.Deposit.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -10463,15 +14834,27 @@ proto.looprpc.InstantOutResponse.deserializeBinaryFromReader = function(msg, rea switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setInstantOutHash(value); + msg.setId(value); break; case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setSweepTxId(value); + var value = /** @type {!proto.looprpc.DepositState} */ (reader.readEnum()); + msg.setState(value); break; case 3: var value = /** @type {string} */ (reader.readString()); - msg.setState(value); + msg.setOutpoint(value); + break; + case 4: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setValue(value); + break; + case 5: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setConfirmationHeight(value); + break; + case 6: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setBlocksUntilExpiry(value); break; default: reader.skipField(); @@ -10486,9 +14869,9 @@ proto.looprpc.InstantOutResponse.deserializeBinaryFromReader = function(msg, rea * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.InstantOutResponse.prototype.serializeBinary = function() { +proto.looprpc.Deposit.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.InstantOutResponse.serializeBinaryToWriter(this, writer); + proto.looprpc.Deposit.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -10496,275 +14879,197 @@ proto.looprpc.InstantOutResponse.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.InstantOutResponse} message + * @param {!proto.looprpc.Deposit} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.InstantOutResponse.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.Deposit.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getInstantOutHash_asU8(); + f = message.getId_asU8(); if (f.length > 0) { writer.writeBytes( 1, f ); } - f = message.getSweepTxId(); - if (f.length > 0) { - writer.writeString( + f = message.getState(); + if (f !== 0.0) { + writer.writeEnum( 2, f ); } - f = message.getState(); + f = message.getOutpoint(); if (f.length > 0) { writer.writeString( 3, f ); } + f = message.getValue(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 4, + f + ); + } + f = message.getConfirmationHeight(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 5, + f + ); + } + f = message.getBlocksUntilExpiry(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 6, + f + ); + } }; /** - * optional bytes instant_out_hash = 1; + * optional bytes id = 1; * @return {!(string|Uint8Array)} */ -proto.looprpc.InstantOutResponse.prototype.getInstantOutHash = function() { +proto.looprpc.Deposit.prototype.getId = function() { return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional bytes instant_out_hash = 1; - * This is a type-conversion wrapper around `getInstantOutHash()` + * optional bytes id = 1; + * This is a type-conversion wrapper around `getId()` * @return {string} */ -proto.looprpc.InstantOutResponse.prototype.getInstantOutHash_asB64 = function() { +proto.looprpc.Deposit.prototype.getId_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getInstantOutHash())); + this.getId())); }; /** - * optional bytes instant_out_hash = 1; + * optional bytes id = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getInstantOutHash()` + * This is a type-conversion wrapper around `getId()` * @return {!Uint8Array} */ -proto.looprpc.InstantOutResponse.prototype.getInstantOutHash_asU8 = function() { +proto.looprpc.Deposit.prototype.getId_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getInstantOutHash())); + this.getId())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.looprpc.InstantOutResponse} returns this + * @return {!proto.looprpc.Deposit} returns this */ -proto.looprpc.InstantOutResponse.prototype.setInstantOutHash = function(value) { +proto.looprpc.Deposit.prototype.setId = function(value) { return jspb.Message.setProto3BytesField(this, 1, value); }; /** - * optional string sweep_tx_id = 2; - * @return {string} - */ -proto.looprpc.InstantOutResponse.prototype.getSweepTxId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.looprpc.InstantOutResponse} returns this - */ -proto.looprpc.InstantOutResponse.prototype.setSweepTxId = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - - -/** - * optional string state = 3; - * @return {string} - */ -proto.looprpc.InstantOutResponse.prototype.getState = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); -}; - - -/** - * @param {string} value - * @return {!proto.looprpc.InstantOutResponse} returns this - */ -proto.looprpc.InstantOutResponse.prototype.setState = function(value) { - return jspb.Message.setProto3StringField(this, 3, value); -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * optional DepositState state = 2; + * @return {!proto.looprpc.DepositState} */ -proto.looprpc.InstantOutQuoteRequest.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.InstantOutQuoteRequest.toObject(opt_includeInstance, this); +proto.looprpc.Deposit.prototype.getState = function() { + return /** @type {!proto.looprpc.DepositState} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.looprpc.InstantOutQuoteRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.InstantOutQuoteRequest.toObject = function(includeInstance, msg) { - var f, obj = { - amt: jspb.Message.getFieldWithDefault(msg, 1, "0"), - numReservations: jspb.Message.getFieldWithDefault(msg, 2, 0) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; +/** + * @param {!proto.looprpc.DepositState} value + * @return {!proto.looprpc.Deposit} returns this + */ +proto.looprpc.Deposit.prototype.setState = function(value) { + return jspb.Message.setProto3EnumField(this, 2, value); }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.InstantOutQuoteRequest} + * optional string outpoint = 3; + * @return {string} */ -proto.looprpc.InstantOutQuoteRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.InstantOutQuoteRequest; - return proto.looprpc.InstantOutQuoteRequest.deserializeBinaryFromReader(msg, reader); +proto.looprpc.Deposit.prototype.getOutpoint = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.looprpc.InstantOutQuoteRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.InstantOutQuoteRequest} + * @param {string} value + * @return {!proto.looprpc.Deposit} returns this */ -proto.looprpc.InstantOutQuoteRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readUint64String()); - msg.setAmt(value); - break; - case 2: - var value = /** @type {number} */ (reader.readInt32()); - msg.setNumReservations(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; +proto.looprpc.Deposit.prototype.setOutpoint = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * optional int64 value = 4; + * @return {string} */ -proto.looprpc.InstantOutQuoteRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.InstantOutQuoteRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.looprpc.Deposit.prototype.getValue = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "0")); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.InstantOutQuoteRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * @param {string} value + * @return {!proto.looprpc.Deposit} returns this */ -proto.looprpc.InstantOutQuoteRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getAmt(); - if (parseInt(f, 10) !== 0) { - writer.writeUint64String( - 1, - f - ); - } - f = message.getNumReservations(); - if (f !== 0) { - writer.writeInt32( - 2, - f - ); - } +proto.looprpc.Deposit.prototype.setValue = function(value) { + return jspb.Message.setProto3StringIntField(this, 4, value); }; /** - * optional uint64 amt = 1; + * optional int64 confirmation_height = 5; * @return {string} */ -proto.looprpc.InstantOutQuoteRequest.prototype.getAmt = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0")); +proto.looprpc.Deposit.prototype.getConfirmationHeight = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "0")); }; /** * @param {string} value - * @return {!proto.looprpc.InstantOutQuoteRequest} returns this + * @return {!proto.looprpc.Deposit} returns this */ -proto.looprpc.InstantOutQuoteRequest.prototype.setAmt = function(value) { - return jspb.Message.setProto3StringIntField(this, 1, value); +proto.looprpc.Deposit.prototype.setConfirmationHeight = function(value) { + return jspb.Message.setProto3StringIntField(this, 5, value); }; /** - * optional int32 num_reservations = 2; - * @return {number} + * optional int64 blocks_until_expiry = 6; + * @return {string} */ -proto.looprpc.InstantOutQuoteRequest.prototype.getNumReservations = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +proto.looprpc.Deposit.prototype.getBlocksUntilExpiry = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "0")); }; /** - * @param {number} value - * @return {!proto.looprpc.InstantOutQuoteRequest} returns this + * @param {string} value + * @return {!proto.looprpc.Deposit} returns this */ -proto.looprpc.InstantOutQuoteRequest.prototype.setNumReservations = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); +proto.looprpc.Deposit.prototype.setBlocksUntilExpiry = function(value) { + return jspb.Message.setProto3StringIntField(this, 6, value); }; +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.looprpc.StaticAddressLoopInSwap.repeatedFields_ = [2]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -10780,8 +15085,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.InstantOutQuoteResponse.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.InstantOutQuoteResponse.toObject(opt_includeInstance, this); +proto.looprpc.StaticAddressLoopInSwap.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.StaticAddressLoopInSwap.toObject(opt_includeInstance, this); }; @@ -10790,14 +15095,17 @@ proto.looprpc.InstantOutQuoteResponse.prototype.toObject = function(opt_includeI * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.InstantOutQuoteResponse} msg The msg instance to transform. + * @param {!proto.looprpc.StaticAddressLoopInSwap} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.InstantOutQuoteResponse.toObject = function(includeInstance, msg) { +proto.looprpc.StaticAddressLoopInSwap.toObject = function(includeInstance, msg) { var f, obj = { - serviceFeeSat: jspb.Message.getFieldWithDefault(msg, 1, "0"), - sweepFeeSat: jspb.Message.getFieldWithDefault(msg, 2, "0") + swapHash: msg.getSwapHash_asB64(), + depositOutpointsList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f, + state: jspb.Message.getFieldWithDefault(msg, 3, 0), + swapAmountSatoshis: jspb.Message.getFieldWithDefault(msg, 4, "0"), + paymentRequestAmountSatoshis: jspb.Message.getFieldWithDefault(msg, 5, "0") }; if (includeInstance) { @@ -10811,23 +15119,23 @@ proto.looprpc.InstantOutQuoteResponse.toObject = function(includeInstance, msg) /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.InstantOutQuoteResponse} + * @return {!proto.looprpc.StaticAddressLoopInSwap} */ -proto.looprpc.InstantOutQuoteResponse.deserializeBinary = function(bytes) { +proto.looprpc.StaticAddressLoopInSwap.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.InstantOutQuoteResponse; - return proto.looprpc.InstantOutQuoteResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.StaticAddressLoopInSwap; + return proto.looprpc.StaticAddressLoopInSwap.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.InstantOutQuoteResponse} msg The message object to deserialize into. + * @param {!proto.looprpc.StaticAddressLoopInSwap} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.InstantOutQuoteResponse} + * @return {!proto.looprpc.StaticAddressLoopInSwap} */ -proto.looprpc.InstantOutQuoteResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.StaticAddressLoopInSwap.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -10835,12 +15143,24 @@ proto.looprpc.InstantOutQuoteResponse.deserializeBinaryFromReader = function(msg var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setServiceFeeSat(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setSwapHash(value); break; case 2: + var value = /** @type {string} */ (reader.readString()); + msg.addDepositOutpoints(value); + break; + case 3: + var value = /** @type {!proto.looprpc.StaticAddressLoopInSwapState} */ (reader.readEnum()); + msg.setState(value); + break; + case 4: var value = /** @type {string} */ (reader.readInt64String()); - msg.setSweepFeeSat(value); + msg.setSwapAmountSatoshis(value); + break; + case 5: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setPaymentRequestAmountSatoshis(value); break; default: reader.skipField(); @@ -10855,9 +15175,9 @@ proto.looprpc.InstantOutQuoteResponse.deserializeBinaryFromReader = function(msg * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.InstantOutQuoteResponse.prototype.serializeBinary = function() { +proto.looprpc.StaticAddressLoopInSwap.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.InstantOutQuoteResponse.serializeBinaryToWriter(this, writer); + proto.looprpc.StaticAddressLoopInSwap.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -10865,23 +15185,44 @@ proto.looprpc.InstantOutQuoteResponse.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.InstantOutQuoteResponse} message + * @param {!proto.looprpc.StaticAddressLoopInSwap} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.InstantOutQuoteResponse.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.StaticAddressLoopInSwap.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getServiceFeeSat(); + f = message.getSwapHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getDepositOutpointsList(); + if (f.length > 0) { + writer.writeRepeatedString( + 2, + f + ); + } + f = message.getState(); + if (f !== 0.0) { + writer.writeEnum( + 3, + f + ); + } + f = message.getSwapAmountSatoshis(); if (parseInt(f, 10) !== 0) { writer.writeInt64String( - 1, + 4, f ); } - f = message.getSweepFeeSat(); + f = message.getPaymentRequestAmountSatoshis(); if (parseInt(f, 10) !== 0) { writer.writeInt64String( - 2, + 5, f ); } @@ -10889,139 +15230,135 @@ proto.looprpc.InstantOutQuoteResponse.serializeBinaryToWriter = function(message /** - * optional int64 service_fee_sat = 1; - * @return {string} + * optional bytes swap_hash = 1; + * @return {!(string|Uint8Array)} */ -proto.looprpc.InstantOutQuoteResponse.prototype.getServiceFeeSat = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0")); +proto.looprpc.StaticAddressLoopInSwap.prototype.getSwapHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * @param {string} value - * @return {!proto.looprpc.InstantOutQuoteResponse} returns this + * optional bytes swap_hash = 1; + * This is a type-conversion wrapper around `getSwapHash()` + * @return {string} */ -proto.looprpc.InstantOutQuoteResponse.prototype.setServiceFeeSat = function(value) { - return jspb.Message.setProto3StringIntField(this, 1, value); +proto.looprpc.StaticAddressLoopInSwap.prototype.getSwapHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getSwapHash())); }; /** - * optional int64 sweep_fee_sat = 2; - * @return {string} + * optional bytes swap_hash = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getSwapHash()` + * @return {!Uint8Array} */ -proto.looprpc.InstantOutQuoteResponse.prototype.getSweepFeeSat = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "0")); +proto.looprpc.StaticAddressLoopInSwap.prototype.getSwapHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getSwapHash())); }; /** - * @param {string} value - * @return {!proto.looprpc.InstantOutQuoteResponse} returns this + * @param {!(string|Uint8Array)} value + * @return {!proto.looprpc.StaticAddressLoopInSwap} returns this */ -proto.looprpc.InstantOutQuoteResponse.prototype.setSweepFeeSat = function(value) { - return jspb.Message.setProto3StringIntField(this, 2, value); +proto.looprpc.StaticAddressLoopInSwap.prototype.setSwapHash = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; +/** + * repeated string deposit_outpoints = 2; + * @return {!Array} + */ +proto.looprpc.StaticAddressLoopInSwap.prototype.getDepositOutpointsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); +}; + +/** + * @param {!Array} value + * @return {!proto.looprpc.StaticAddressLoopInSwap} returns this + */ +proto.looprpc.StaticAddressLoopInSwap.prototype.setDepositOutpointsList = function(value) { + return jspb.Message.setField(this, 2, value || []); +}; -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * @param {string} value + * @param {number=} opt_index + * @return {!proto.looprpc.StaticAddressLoopInSwap} returns this */ -proto.looprpc.ListInstantOutsRequest.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.ListInstantOutsRequest.toObject(opt_includeInstance, this); +proto.looprpc.StaticAddressLoopInSwap.prototype.addDepositOutpoints = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.looprpc.ListInstantOutsRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * Clears the list making it empty but non-null. + * @return {!proto.looprpc.StaticAddressLoopInSwap} returns this */ -proto.looprpc.ListInstantOutsRequest.toObject = function(includeInstance, msg) { - var f, obj = { +proto.looprpc.StaticAddressLoopInSwap.prototype.clearDepositOutpointsList = function() { + return this.setDepositOutpointsList([]); +}; - }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; +/** + * optional StaticAddressLoopInSwapState state = 3; + * @return {!proto.looprpc.StaticAddressLoopInSwapState} + */ +proto.looprpc.StaticAddressLoopInSwap.prototype.getState = function() { + return /** @type {!proto.looprpc.StaticAddressLoopInSwapState} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.ListInstantOutsRequest} + * @param {!proto.looprpc.StaticAddressLoopInSwapState} value + * @return {!proto.looprpc.StaticAddressLoopInSwap} returns this */ -proto.looprpc.ListInstantOutsRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.ListInstantOutsRequest; - return proto.looprpc.ListInstantOutsRequest.deserializeBinaryFromReader(msg, reader); +proto.looprpc.StaticAddressLoopInSwap.prototype.setState = function(value) { + return jspb.Message.setProto3EnumField(this, 3, value); }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.looprpc.ListInstantOutsRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.ListInstantOutsRequest} + * optional int64 swap_amount_satoshis = 4; + * @return {string} + */ +proto.looprpc.StaticAddressLoopInSwap.prototype.getSwapAmountSatoshis = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.StaticAddressLoopInSwap} returns this */ -proto.looprpc.ListInstantOutsRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - default: - reader.skipField(); - break; - } - } - return msg; +proto.looprpc.StaticAddressLoopInSwap.prototype.setSwapAmountSatoshis = function(value) { + return jspb.Message.setProto3StringIntField(this, 4, value); }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * optional int64 payment_request_amount_satoshis = 5; + * @return {string} */ -proto.looprpc.ListInstantOutsRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.ListInstantOutsRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.looprpc.StaticAddressLoopInSwap.prototype.getPaymentRequestAmountSatoshis = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "0")); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.ListInstantOutsRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * @param {string} value + * @return {!proto.looprpc.StaticAddressLoopInSwap} returns this */ -proto.looprpc.ListInstantOutsRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; +proto.looprpc.StaticAddressLoopInSwap.prototype.setPaymentRequestAmountSatoshis = function(value) { + return jspb.Message.setProto3StringIntField(this, 5, value); }; @@ -11031,7 +15368,7 @@ proto.looprpc.ListInstantOutsRequest.serializeBinaryToWriter = function(message, * @private {!Array} * @const */ -proto.looprpc.ListInstantOutsResponse.repeatedFields_ = [1]; +proto.looprpc.StaticAddressLoopInRequest.repeatedFields_ = [1,6]; @@ -11048,8 +15385,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.ListInstantOutsResponse.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.ListInstantOutsResponse.toObject(opt_includeInstance, this); +proto.looprpc.StaticAddressLoopInRequest.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.StaticAddressLoopInRequest.toObject(opt_includeInstance, this); }; @@ -11058,14 +15395,21 @@ proto.looprpc.ListInstantOutsResponse.prototype.toObject = function(opt_includeI * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.ListInstantOutsResponse} msg The msg instance to transform. + * @param {!proto.looprpc.StaticAddressLoopInRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.ListInstantOutsResponse.toObject = function(includeInstance, msg) { +proto.looprpc.StaticAddressLoopInRequest.toObject = function(includeInstance, msg) { var f, obj = { - swapsList: jspb.Message.toObjectList(msg.getSwapsList(), - proto.looprpc.InstantOut.toObject, includeInstance) + outpointsList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f, + maxSwapFeeSatoshis: jspb.Message.getFieldWithDefault(msg, 2, "0"), + lastHop: msg.getLastHop_asB64(), + label: jspb.Message.getFieldWithDefault(msg, 4, ""), + initiator: jspb.Message.getFieldWithDefault(msg, 5, ""), + routeHintsList: jspb.Message.toObjectList(msg.getRouteHintsList(), + swapserverrpc_common_pb.RouteHint.toObject, includeInstance), + pb_private: jspb.Message.getBooleanFieldWithDefault(msg, 7, false), + paymentTimeoutSeconds: jspb.Message.getFieldWithDefault(msg, 8, 0) }; if (includeInstance) { @@ -11079,23 +15423,23 @@ proto.looprpc.ListInstantOutsResponse.toObject = function(includeInstance, msg) /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.ListInstantOutsResponse} + * @return {!proto.looprpc.StaticAddressLoopInRequest} */ -proto.looprpc.ListInstantOutsResponse.deserializeBinary = function(bytes) { +proto.looprpc.StaticAddressLoopInRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.ListInstantOutsResponse; - return proto.looprpc.ListInstantOutsResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.StaticAddressLoopInRequest; + return proto.looprpc.StaticAddressLoopInRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.ListInstantOutsResponse} msg The message object to deserialize into. + * @param {!proto.looprpc.StaticAddressLoopInRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.ListInstantOutsResponse} + * @return {!proto.looprpc.StaticAddressLoopInRequest} */ -proto.looprpc.ListInstantOutsResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.StaticAddressLoopInRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -11103,9 +15447,37 @@ proto.looprpc.ListInstantOutsResponse.deserializeBinaryFromReader = function(msg var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.looprpc.InstantOut; - reader.readMessage(value,proto.looprpc.InstantOut.deserializeBinaryFromReader); - msg.addSwaps(value); + var value = /** @type {string} */ (reader.readString()); + msg.addOutpoints(value); + break; + case 2: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setMaxSwapFeeSatoshis(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setLastHop(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setLabel(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.setInitiator(value); + break; + case 6: + var value = new swapserverrpc_common_pb.RouteHint; + reader.readMessage(value,swapserverrpc_common_pb.RouteHint.deserializeBinaryFromReader); + msg.addRouteHints(value); + break; + case 7: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setPrivate(value); + break; + case 8: + var value = /** @type {number} */ (reader.readUint32()); + msg.setPaymentTimeoutSeconds(value); break; default: reader.skipField(); @@ -11120,9 +15492,9 @@ proto.looprpc.ListInstantOutsResponse.deserializeBinaryFromReader = function(msg * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.ListInstantOutsResponse.prototype.serializeBinary = function() { +proto.looprpc.StaticAddressLoopInRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.ListInstantOutsResponse.serializeBinaryToWriter(this, writer); + proto.looprpc.StaticAddressLoopInRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -11130,68 +15502,279 @@ proto.looprpc.ListInstantOutsResponse.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.ListInstantOutsResponse} message + * @param {!proto.looprpc.StaticAddressLoopInRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.ListInstantOutsResponse.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.StaticAddressLoopInRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getSwapsList(); + f = message.getOutpointsList(); if (f.length > 0) { - writer.writeRepeatedMessage( + writer.writeRepeatedString( 1, + f + ); + } + f = message.getMaxSwapFeeSatoshis(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 2, + f + ); + } + f = message.getLastHop_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } + f = message.getLabel(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } + f = message.getInitiator(); + if (f.length > 0) { + writer.writeString( + 5, + f + ); + } + f = message.getRouteHintsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 6, f, - proto.looprpc.InstantOut.serializeBinaryToWriter + swapserverrpc_common_pb.RouteHint.serializeBinaryToWriter + ); + } + f = message.getPrivate(); + if (f) { + writer.writeBool( + 7, + f + ); + } + f = message.getPaymentTimeoutSeconds(); + if (f !== 0) { + writer.writeUint32( + 8, + f ); } }; /** - * repeated InstantOut swaps = 1; - * @return {!Array} + * repeated string outpoints = 1; + * @return {!Array} + */ +proto.looprpc.StaticAddressLoopInRequest.prototype.getOutpointsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.looprpc.StaticAddressLoopInRequest} returns this + */ +proto.looprpc.StaticAddressLoopInRequest.prototype.setOutpointsList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.looprpc.StaticAddressLoopInRequest} returns this + */ +proto.looprpc.StaticAddressLoopInRequest.prototype.addOutpoints = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.looprpc.StaticAddressLoopInRequest} returns this + */ +proto.looprpc.StaticAddressLoopInRequest.prototype.clearOutpointsList = function() { + return this.setOutpointsList([]); +}; + + +/** + * optional int64 max_swap_fee_satoshis = 2; + * @return {string} + */ +proto.looprpc.StaticAddressLoopInRequest.prototype.getMaxSwapFeeSatoshis = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.StaticAddressLoopInRequest} returns this + */ +proto.looprpc.StaticAddressLoopInRequest.prototype.setMaxSwapFeeSatoshis = function(value) { + return jspb.Message.setProto3StringIntField(this, 2, value); +}; + + +/** + * optional bytes last_hop = 3; + * @return {!(string|Uint8Array)} + */ +proto.looprpc.StaticAddressLoopInRequest.prototype.getLastHop = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes last_hop = 3; + * This is a type-conversion wrapper around `getLastHop()` + * @return {string} + */ +proto.looprpc.StaticAddressLoopInRequest.prototype.getLastHop_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getLastHop())); +}; + + +/** + * optional bytes last_hop = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getLastHop()` + * @return {!Uint8Array} + */ +proto.looprpc.StaticAddressLoopInRequest.prototype.getLastHop_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getLastHop())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.looprpc.StaticAddressLoopInRequest} returns this + */ +proto.looprpc.StaticAddressLoopInRequest.prototype.setLastHop = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + + +/** + * optional string label = 4; + * @return {string} + */ +proto.looprpc.StaticAddressLoopInRequest.prototype.getLabel = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.StaticAddressLoopInRequest} returns this + */ +proto.looprpc.StaticAddressLoopInRequest.prototype.setLabel = function(value) { + return jspb.Message.setProto3StringField(this, 4, value); +}; + + +/** + * optional string initiator = 5; + * @return {string} + */ +proto.looprpc.StaticAddressLoopInRequest.prototype.getInitiator = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.StaticAddressLoopInRequest} returns this + */ +proto.looprpc.StaticAddressLoopInRequest.prototype.setInitiator = function(value) { + return jspb.Message.setProto3StringField(this, 5, value); +}; + + +/** + * repeated RouteHint route_hints = 6; + * @return {!Array} + */ +proto.looprpc.StaticAddressLoopInRequest.prototype.getRouteHintsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, swapserverrpc_common_pb.RouteHint, 6)); +}; + + +/** + * @param {!Array} value + * @return {!proto.looprpc.StaticAddressLoopInRequest} returns this +*/ +proto.looprpc.StaticAddressLoopInRequest.prototype.setRouteHintsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 6, value); +}; + + +/** + * @param {!proto.looprpc.RouteHint=} opt_value + * @param {number=} opt_index + * @return {!proto.looprpc.RouteHint} */ -proto.looprpc.ListInstantOutsResponse.prototype.getSwapsList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.looprpc.InstantOut, 1)); +proto.looprpc.StaticAddressLoopInRequest.prototype.addRouteHints = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 6, opt_value, proto.looprpc.RouteHint, opt_index); }; /** - * @param {!Array} value - * @return {!proto.looprpc.ListInstantOutsResponse} returns this -*/ -proto.looprpc.ListInstantOutsResponse.prototype.setSwapsList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); + * Clears the list making it empty but non-null. + * @return {!proto.looprpc.StaticAddressLoopInRequest} returns this + */ +proto.looprpc.StaticAddressLoopInRequest.prototype.clearRouteHintsList = function() { + return this.setRouteHintsList([]); }; /** - * @param {!proto.looprpc.InstantOut=} opt_value - * @param {number=} opt_index - * @return {!proto.looprpc.InstantOut} + * optional bool private = 7; + * @return {boolean} */ -proto.looprpc.ListInstantOutsResponse.prototype.addSwaps = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.looprpc.InstantOut, opt_index); +proto.looprpc.StaticAddressLoopInRequest.prototype.getPrivate = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 7, false)); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.looprpc.ListInstantOutsResponse} returns this + * @param {boolean} value + * @return {!proto.looprpc.StaticAddressLoopInRequest} returns this */ -proto.looprpc.ListInstantOutsResponse.prototype.clearSwapsList = function() { - return this.setSwapsList([]); +proto.looprpc.StaticAddressLoopInRequest.prototype.setPrivate = function(value) { + return jspb.Message.setProto3BooleanField(this, 7, value); }; +/** + * optional uint32 payment_timeout_seconds = 8; + * @return {number} + */ +proto.looprpc.StaticAddressLoopInRequest.prototype.getPaymentTimeoutSeconds = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 8, 0)); +}; + /** - * List of repeated fields within this message type. - * @private {!Array} - * @const + * @param {number} value + * @return {!proto.looprpc.StaticAddressLoopInRequest} returns this */ -proto.looprpc.InstantOut.repeatedFields_ = [4]; +proto.looprpc.StaticAddressLoopInRequest.prototype.setPaymentTimeoutSeconds = function(value) { + return jspb.Message.setProto3IntField(this, 8, value); +}; + + @@ -11208,8 +15791,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.InstantOut.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.InstantOut.toObject(opt_includeInstance, this); +proto.looprpc.StaticAddressLoopInResponse.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.StaticAddressLoopInResponse.toObject(opt_includeInstance, this); }; @@ -11218,17 +15801,23 @@ proto.looprpc.InstantOut.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.InstantOut} msg The msg instance to transform. + * @param {!proto.looprpc.StaticAddressLoopInResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.InstantOut.toObject = function(includeInstance, msg) { +proto.looprpc.StaticAddressLoopInResponse.toObject = function(includeInstance, msg) { var f, obj = { swapHash: msg.getSwapHash_asB64(), state: jspb.Message.getFieldWithDefault(msg, 2, ""), amount: jspb.Message.getFieldWithDefault(msg, 3, "0"), - reservationIdsList: msg.getReservationIdsList_asB64(), - sweepTxId: jspb.Message.getFieldWithDefault(msg, 5, "") + htlcCltv: jspb.Message.getFieldWithDefault(msg, 4, 0), + quotedSwapFeeSatoshis: jspb.Message.getFieldWithDefault(msg, 5, "0"), + maxSwapFeeSatoshis: jspb.Message.getFieldWithDefault(msg, 6, "0"), + initiationHeight: jspb.Message.getFieldWithDefault(msg, 7, 0), + protocolVersion: jspb.Message.getFieldWithDefault(msg, 8, ""), + label: jspb.Message.getFieldWithDefault(msg, 9, ""), + initiator: jspb.Message.getFieldWithDefault(msg, 10, ""), + paymentTimeoutSeconds: jspb.Message.getFieldWithDefault(msg, 11, 0) }; if (includeInstance) { @@ -11242,23 +15831,23 @@ proto.looprpc.InstantOut.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.InstantOut} + * @return {!proto.looprpc.StaticAddressLoopInResponse} */ -proto.looprpc.InstantOut.deserializeBinary = function(bytes) { +proto.looprpc.StaticAddressLoopInResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.InstantOut; - return proto.looprpc.InstantOut.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.StaticAddressLoopInResponse; + return proto.looprpc.StaticAddressLoopInResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.InstantOut} msg The message object to deserialize into. + * @param {!proto.looprpc.StaticAddressLoopInResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.InstantOut} + * @return {!proto.looprpc.StaticAddressLoopInResponse} */ -proto.looprpc.InstantOut.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.StaticAddressLoopInResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -11278,12 +15867,36 @@ proto.looprpc.InstantOut.deserializeBinaryFromReader = function(msg, reader) { msg.setAmount(value); break; case 4: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.addReservationIds(value); + var value = /** @type {number} */ (reader.readInt32()); + msg.setHtlcCltv(value); break; case 5: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setQuotedSwapFeeSatoshis(value); + break; + case 6: + var value = /** @type {string} */ (reader.readInt64String()); + msg.setMaxSwapFeeSatoshis(value); + break; + case 7: + var value = /** @type {number} */ (reader.readUint32()); + msg.setInitiationHeight(value); + break; + case 8: var value = /** @type {string} */ (reader.readString()); - msg.setSweepTxId(value); + msg.setProtocolVersion(value); + break; + case 9: + var value = /** @type {string} */ (reader.readString()); + msg.setLabel(value); + break; + case 10: + var value = /** @type {string} */ (reader.readString()); + msg.setInitiator(value); + break; + case 11: + var value = /** @type {number} */ (reader.readUint32()); + msg.setPaymentTimeoutSeconds(value); break; default: reader.skipField(); @@ -11298,9 +15911,9 @@ proto.looprpc.InstantOut.deserializeBinaryFromReader = function(msg, reader) { * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.InstantOut.prototype.serializeBinary = function() { +proto.looprpc.StaticAddressLoopInResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.InstantOut.serializeBinaryToWriter(this, writer); + proto.looprpc.StaticAddressLoopInResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -11308,11 +15921,11 @@ proto.looprpc.InstantOut.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.InstantOut} message + * @param {!proto.looprpc.StaticAddressLoopInResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.InstantOut.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.StaticAddressLoopInResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getSwapHash_asU8(); if (f.length > 0) { @@ -11335,17 +15948,59 @@ proto.looprpc.InstantOut.serializeBinaryToWriter = function(message, writer) { f ); } - f = message.getReservationIdsList_asU8(); - if (f.length > 0) { - writer.writeRepeatedBytes( + f = message.getHtlcCltv(); + if (f !== 0) { + writer.writeInt32( 4, f ); } - f = message.getSweepTxId(); + f = message.getQuotedSwapFeeSatoshis(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 5, + f + ); + } + f = message.getMaxSwapFeeSatoshis(); + if (parseInt(f, 10) !== 0) { + writer.writeInt64String( + 6, + f + ); + } + f = message.getInitiationHeight(); + if (f !== 0) { + writer.writeUint32( + 7, + f + ); + } + f = message.getProtocolVersion(); if (f.length > 0) { writer.writeString( - 5, + 8, + f + ); + } + f = message.getLabel(); + if (f.length > 0) { + writer.writeString( + 9, + f + ); + } + f = message.getInitiator(); + if (f.length > 0) { + writer.writeString( + 10, + f + ); + } + f = message.getPaymentTimeoutSeconds(); + if (f !== 0) { + writer.writeUint32( + 11, f ); } @@ -11356,7 +16011,7 @@ proto.looprpc.InstantOut.serializeBinaryToWriter = function(message, writer) { * optional bytes swap_hash = 1; * @return {!(string|Uint8Array)} */ -proto.looprpc.InstantOut.prototype.getSwapHash = function() { +proto.looprpc.StaticAddressLoopInResponse.prototype.getSwapHash = function() { return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; @@ -11366,7 +16021,7 @@ proto.looprpc.InstantOut.prototype.getSwapHash = function() { * This is a type-conversion wrapper around `getSwapHash()` * @return {string} */ -proto.looprpc.InstantOut.prototype.getSwapHash_asB64 = function() { +proto.looprpc.StaticAddressLoopInResponse.prototype.getSwapHash_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getSwapHash())); }; @@ -11379,7 +16034,7 @@ proto.looprpc.InstantOut.prototype.getSwapHash_asB64 = function() { * This is a type-conversion wrapper around `getSwapHash()` * @return {!Uint8Array} */ -proto.looprpc.InstantOut.prototype.getSwapHash_asU8 = function() { +proto.looprpc.StaticAddressLoopInResponse.prototype.getSwapHash_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getSwapHash())); }; @@ -11387,9 +16042,9 @@ proto.looprpc.InstantOut.prototype.getSwapHash_asU8 = function() { /** * @param {!(string|Uint8Array)} value - * @return {!proto.looprpc.InstantOut} returns this + * @return {!proto.looprpc.StaticAddressLoopInResponse} returns this */ -proto.looprpc.InstantOut.prototype.setSwapHash = function(value) { +proto.looprpc.StaticAddressLoopInResponse.prototype.setSwapHash = function(value) { return jspb.Message.setProto3BytesField(this, 1, value); }; @@ -11398,16 +16053,16 @@ proto.looprpc.InstantOut.prototype.setSwapHash = function(value) { * optional string state = 2; * @return {string} */ -proto.looprpc.InstantOut.prototype.getState = function() { +proto.looprpc.StaticAddressLoopInResponse.prototype.getState = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * @param {string} value - * @return {!proto.looprpc.InstantOut} returns this + * @return {!proto.looprpc.StaticAddressLoopInResponse} returns this */ -proto.looprpc.InstantOut.prototype.setState = function(value) { +proto.looprpc.StaticAddressLoopInResponse.prototype.setState = function(value) { return jspb.Message.setProto3StringField(this, 2, value); }; @@ -11416,96 +16071,161 @@ proto.looprpc.InstantOut.prototype.setState = function(value) { * optional uint64 amount = 3; * @return {string} */ -proto.looprpc.InstantOut.prototype.getAmount = function() { +proto.looprpc.StaticAddressLoopInResponse.prototype.getAmount = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "0")); }; /** * @param {string} value - * @return {!proto.looprpc.InstantOut} returns this + * @return {!proto.looprpc.StaticAddressLoopInResponse} returns this */ -proto.looprpc.InstantOut.prototype.setAmount = function(value) { +proto.looprpc.StaticAddressLoopInResponse.prototype.setAmount = function(value) { return jspb.Message.setProto3StringIntField(this, 3, value); }; /** - * repeated bytes reservation_ids = 4; - * @return {!(Array|Array)} + * optional int32 htlc_cltv = 4; + * @return {number} */ -proto.looprpc.InstantOut.prototype.getReservationIdsList = function() { - return /** @type {!(Array|Array)} */ (jspb.Message.getRepeatedField(this, 4)); +proto.looprpc.StaticAddressLoopInResponse.prototype.getHtlcCltv = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); }; /** - * repeated bytes reservation_ids = 4; - * This is a type-conversion wrapper around `getReservationIdsList()` - * @return {!Array} + * @param {number} value + * @return {!proto.looprpc.StaticAddressLoopInResponse} returns this */ -proto.looprpc.InstantOut.prototype.getReservationIdsList_asB64 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsB64( - this.getReservationIdsList())); +proto.looprpc.StaticAddressLoopInResponse.prototype.setHtlcCltv = function(value) { + return jspb.Message.setProto3IntField(this, 4, value); }; /** - * repeated bytes reservation_ids = 4; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getReservationIdsList()` - * @return {!Array} + * optional int64 quoted_swap_fee_satoshis = 5; + * @return {string} */ -proto.looprpc.InstantOut.prototype.getReservationIdsList_asU8 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsU8( - this.getReservationIdsList())); +proto.looprpc.StaticAddressLoopInResponse.prototype.getQuotedSwapFeeSatoshis = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "0")); }; /** - * @param {!(Array|Array)} value - * @return {!proto.looprpc.InstantOut} returns this + * @param {string} value + * @return {!proto.looprpc.StaticAddressLoopInResponse} returns this */ -proto.looprpc.InstantOut.prototype.setReservationIdsList = function(value) { - return jspb.Message.setField(this, 4, value || []); +proto.looprpc.StaticAddressLoopInResponse.prototype.setQuotedSwapFeeSatoshis = function(value) { + return jspb.Message.setProto3StringIntField(this, 5, value); }; /** - * @param {!(string|Uint8Array)} value - * @param {number=} opt_index - * @return {!proto.looprpc.InstantOut} returns this + * optional int64 max_swap_fee_satoshis = 6; + * @return {string} */ -proto.looprpc.InstantOut.prototype.addReservationIds = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 4, value, opt_index); +proto.looprpc.StaticAddressLoopInResponse.prototype.getMaxSwapFeeSatoshis = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "0")); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.looprpc.InstantOut} returns this + * @param {string} value + * @return {!proto.looprpc.StaticAddressLoopInResponse} returns this */ -proto.looprpc.InstantOut.prototype.clearReservationIdsList = function() { - return this.setReservationIdsList([]); +proto.looprpc.StaticAddressLoopInResponse.prototype.setMaxSwapFeeSatoshis = function(value) { + return jspb.Message.setProto3StringIntField(this, 6, value); }; /** - * optional string sweep_tx_id = 5; + * optional uint32 initiation_height = 7; + * @return {number} + */ +proto.looprpc.StaticAddressLoopInResponse.prototype.getInitiationHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 7, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.looprpc.StaticAddressLoopInResponse} returns this + */ +proto.looprpc.StaticAddressLoopInResponse.prototype.setInitiationHeight = function(value) { + return jspb.Message.setProto3IntField(this, 7, value); +}; + + +/** + * optional string protocol_version = 8; * @return {string} */ -proto.looprpc.InstantOut.prototype.getSweepTxId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +proto.looprpc.StaticAddressLoopInResponse.prototype.getProtocolVersion = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 8, "")); }; /** * @param {string} value - * @return {!proto.looprpc.InstantOut} returns this + * @return {!proto.looprpc.StaticAddressLoopInResponse} returns this */ -proto.looprpc.InstantOut.prototype.setSweepTxId = function(value) { - return jspb.Message.setProto3StringField(this, 5, value); +proto.looprpc.StaticAddressLoopInResponse.prototype.setProtocolVersion = function(value) { + return jspb.Message.setProto3StringField(this, 8, value); +}; + + +/** + * optional string label = 9; + * @return {string} + */ +proto.looprpc.StaticAddressLoopInResponse.prototype.getLabel = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 9, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.StaticAddressLoopInResponse} returns this + */ +proto.looprpc.StaticAddressLoopInResponse.prototype.setLabel = function(value) { + return jspb.Message.setProto3StringField(this, 9, value); +}; + + +/** + * optional string initiator = 10; + * @return {string} + */ +proto.looprpc.StaticAddressLoopInResponse.prototype.getInitiator = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 10, "")); +}; + + +/** + * @param {string} value + * @return {!proto.looprpc.StaticAddressLoopInResponse} returns this + */ +proto.looprpc.StaticAddressLoopInResponse.prototype.setInitiator = function(value) { + return jspb.Message.setProto3StringField(this, 10, value); +}; + + +/** + * optional uint32 payment_timeout_seconds = 11; + * @return {number} + */ +proto.looprpc.StaticAddressLoopInResponse.prototype.getPaymentTimeoutSeconds = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 11, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.looprpc.StaticAddressLoopInResponse} returns this + */ +proto.looprpc.StaticAddressLoopInResponse.prototype.setPaymentTimeoutSeconds = function(value) { + return jspb.Message.setProto3IntField(this, 11, value); }; @@ -11581,4 +16301,39 @@ proto.looprpc.AutoReason = { AUTO_REASON_FEE_INSUFFICIENT: 13 }; +/** + * @enum {number} + */ +proto.looprpc.DepositState = { + UNKNOWN_STATE: 0, + DEPOSITED: 1, + WITHDRAWING: 2, + WITHDRAWN: 3, + LOOPING_IN: 4, + LOOPED_IN: 5, + SWEEP_HTLC_TIMEOUT: 6, + HTLC_TIMEOUT_SWEPT: 7, + PUBLISH_EXPIRED: 8, + WAIT_FOR_EXPIRY_SWEEP: 9, + EXPIRED: 10 +}; + +/** + * @enum {number} + */ +proto.looprpc.StaticAddressLoopInSwapState = { + UNKNOWN_STATIC_ADDRESS_SWAP_STATE: 0, + INIT_HTLC: 1, + SIGN_HTLC_TX: 2, + MONITOR_INVOICE_HTLC_TX: 3, + PAYMENT_RECEIVED: 4, + SWEEP_STATIC_ADDRESS_HTLC_TIMEOUT: 5, + MONITOR_HTLC_TIMEOUT_SWEEP: 6, + HTLC_STATIC_ADDRESS_TIMEOUT_SWEPT: 7, + SUCCEEDED: 8, + SUCCEEDED_TRANSITIONING_FAILED: 9, + UNLOCK_DEPOSITS: 10, + FAILED_STATIC_ADDRESS_SWAP: 11 +}; + goog.object.extend(exports, proto.looprpc); diff --git a/app/src/types/generated/loop_pb_service.d.ts b/app/src/types/generated/loop_pb_service.d.ts index a2b5a3969..67b38e951 100644 --- a/app/src/types/generated/loop_pb_service.d.ts +++ b/app/src/types/generated/loop_pb_service.d.ts @@ -121,6 +121,15 @@ type SwapClientGetLsatTokens = { readonly responseType: typeof loop_pb.TokensResponse; }; +type SwapClientFetchL402Token = { + readonly methodName: string; + readonly service: typeof SwapClient; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof loop_pb.FetchL402TokenRequest; + readonly responseType: typeof loop_pb.FetchL402TokenResponse; +}; + type SwapClientGetInfo = { readonly methodName: string; readonly service: typeof SwapClient; @@ -193,6 +202,69 @@ type SwapClientListInstantOuts = { readonly responseType: typeof loop_pb.ListInstantOutsResponse; }; +type SwapClientNewStaticAddress = { + readonly methodName: string; + readonly service: typeof SwapClient; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof loop_pb.NewStaticAddressRequest; + readonly responseType: typeof loop_pb.NewStaticAddressResponse; +}; + +type SwapClientListUnspentDeposits = { + readonly methodName: string; + readonly service: typeof SwapClient; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof loop_pb.ListUnspentDepositsRequest; + readonly responseType: typeof loop_pb.ListUnspentDepositsResponse; +}; + +type SwapClientWithdrawDeposits = { + readonly methodName: string; + readonly service: typeof SwapClient; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof loop_pb.WithdrawDepositsRequest; + readonly responseType: typeof loop_pb.WithdrawDepositsResponse; +}; + +type SwapClientListStaticAddressDeposits = { + readonly methodName: string; + readonly service: typeof SwapClient; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof loop_pb.ListStaticAddressDepositsRequest; + readonly responseType: typeof loop_pb.ListStaticAddressDepositsResponse; +}; + +type SwapClientListStaticAddressSwaps = { + readonly methodName: string; + readonly service: typeof SwapClient; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof loop_pb.ListStaticAddressSwapsRequest; + readonly responseType: typeof loop_pb.ListStaticAddressSwapsResponse; +}; + +type SwapClientGetStaticAddressSummary = { + readonly methodName: string; + readonly service: typeof SwapClient; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof loop_pb.StaticAddressSummaryRequest; + readonly responseType: typeof loop_pb.StaticAddressSummaryResponse; +}; + +type SwapClientStaticAddressLoopIn = { + readonly methodName: string; + readonly service: typeof SwapClient; + readonly requestStream: false; + readonly responseStream: false; + readonly requestType: typeof loop_pb.StaticAddressLoopInRequest; + readonly responseType: typeof loop_pb.StaticAddressLoopInResponse; +}; + export class SwapClient { static readonly serviceName: string; static readonly LoopOut: SwapClientLoopOut; @@ -208,6 +280,7 @@ export class SwapClient { static readonly Probe: SwapClientProbe; static readonly GetL402Tokens: SwapClientGetL402Tokens; static readonly GetLsatTokens: SwapClientGetLsatTokens; + static readonly FetchL402Token: SwapClientFetchL402Token; static readonly GetInfo: SwapClientGetInfo; static readonly GetLiquidityParams: SwapClientGetLiquidityParams; static readonly SetLiquidityParams: SwapClientSetLiquidityParams; @@ -216,6 +289,13 @@ export class SwapClient { static readonly InstantOut: SwapClientInstantOut; static readonly InstantOutQuote: SwapClientInstantOutQuote; static readonly ListInstantOuts: SwapClientListInstantOuts; + static readonly NewStaticAddress: SwapClientNewStaticAddress; + static readonly ListUnspentDeposits: SwapClientListUnspentDeposits; + static readonly WithdrawDeposits: SwapClientWithdrawDeposits; + static readonly ListStaticAddressDeposits: SwapClientListStaticAddressDeposits; + static readonly ListStaticAddressSwaps: SwapClientListStaticAddressSwaps; + static readonly GetStaticAddressSummary: SwapClientGetStaticAddressSummary; + static readonly StaticAddressLoopIn: SwapClientStaticAddressLoopIn; } export type ServiceError = { message: string, code: number; metadata: grpc.Metadata } @@ -359,6 +439,15 @@ export class SwapClientClient { requestMessage: loop_pb.TokensRequest, callback: (error: ServiceError|null, responseMessage: loop_pb.TokensResponse|null) => void ): UnaryResponse; + fetchL402Token( + requestMessage: loop_pb.FetchL402TokenRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: loop_pb.FetchL402TokenResponse|null) => void + ): UnaryResponse; + fetchL402Token( + requestMessage: loop_pb.FetchL402TokenRequest, + callback: (error: ServiceError|null, responseMessage: loop_pb.FetchL402TokenResponse|null) => void + ): UnaryResponse; getInfo( requestMessage: loop_pb.GetInfoRequest, metadata: grpc.Metadata, @@ -431,5 +520,68 @@ export class SwapClientClient { requestMessage: loop_pb.ListInstantOutsRequest, callback: (error: ServiceError|null, responseMessage: loop_pb.ListInstantOutsResponse|null) => void ): UnaryResponse; + newStaticAddress( + requestMessage: loop_pb.NewStaticAddressRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: loop_pb.NewStaticAddressResponse|null) => void + ): UnaryResponse; + newStaticAddress( + requestMessage: loop_pb.NewStaticAddressRequest, + callback: (error: ServiceError|null, responseMessage: loop_pb.NewStaticAddressResponse|null) => void + ): UnaryResponse; + listUnspentDeposits( + requestMessage: loop_pb.ListUnspentDepositsRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: loop_pb.ListUnspentDepositsResponse|null) => void + ): UnaryResponse; + listUnspentDeposits( + requestMessage: loop_pb.ListUnspentDepositsRequest, + callback: (error: ServiceError|null, responseMessage: loop_pb.ListUnspentDepositsResponse|null) => void + ): UnaryResponse; + withdrawDeposits( + requestMessage: loop_pb.WithdrawDepositsRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: loop_pb.WithdrawDepositsResponse|null) => void + ): UnaryResponse; + withdrawDeposits( + requestMessage: loop_pb.WithdrawDepositsRequest, + callback: (error: ServiceError|null, responseMessage: loop_pb.WithdrawDepositsResponse|null) => void + ): UnaryResponse; + listStaticAddressDeposits( + requestMessage: loop_pb.ListStaticAddressDepositsRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: loop_pb.ListStaticAddressDepositsResponse|null) => void + ): UnaryResponse; + listStaticAddressDeposits( + requestMessage: loop_pb.ListStaticAddressDepositsRequest, + callback: (error: ServiceError|null, responseMessage: loop_pb.ListStaticAddressDepositsResponse|null) => void + ): UnaryResponse; + listStaticAddressSwaps( + requestMessage: loop_pb.ListStaticAddressSwapsRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: loop_pb.ListStaticAddressSwapsResponse|null) => void + ): UnaryResponse; + listStaticAddressSwaps( + requestMessage: loop_pb.ListStaticAddressSwapsRequest, + callback: (error: ServiceError|null, responseMessage: loop_pb.ListStaticAddressSwapsResponse|null) => void + ): UnaryResponse; + getStaticAddressSummary( + requestMessage: loop_pb.StaticAddressSummaryRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: loop_pb.StaticAddressSummaryResponse|null) => void + ): UnaryResponse; + getStaticAddressSummary( + requestMessage: loop_pb.StaticAddressSummaryRequest, + callback: (error: ServiceError|null, responseMessage: loop_pb.StaticAddressSummaryResponse|null) => void + ): UnaryResponse; + staticAddressLoopIn( + requestMessage: loop_pb.StaticAddressLoopInRequest, + metadata: grpc.Metadata, + callback: (error: ServiceError|null, responseMessage: loop_pb.StaticAddressLoopInResponse|null) => void + ): UnaryResponse; + staticAddressLoopIn( + requestMessage: loop_pb.StaticAddressLoopInRequest, + callback: (error: ServiceError|null, responseMessage: loop_pb.StaticAddressLoopInResponse|null) => void + ): UnaryResponse; } diff --git a/app/src/types/generated/loop_pb_service.js b/app/src/types/generated/loop_pb_service.js index ce0f802b4..b6836a7ee 100644 --- a/app/src/types/generated/loop_pb_service.js +++ b/app/src/types/generated/loop_pb_service.js @@ -127,6 +127,15 @@ SwapClient.GetLsatTokens = { responseType: loop_pb.TokensResponse }; +SwapClient.FetchL402Token = { + methodName: "FetchL402Token", + service: SwapClient, + requestStream: false, + responseStream: false, + requestType: loop_pb.FetchL402TokenRequest, + responseType: loop_pb.FetchL402TokenResponse +}; + SwapClient.GetInfo = { methodName: "GetInfo", service: SwapClient, @@ -199,6 +208,69 @@ SwapClient.ListInstantOuts = { responseType: loop_pb.ListInstantOutsResponse }; +SwapClient.NewStaticAddress = { + methodName: "NewStaticAddress", + service: SwapClient, + requestStream: false, + responseStream: false, + requestType: loop_pb.NewStaticAddressRequest, + responseType: loop_pb.NewStaticAddressResponse +}; + +SwapClient.ListUnspentDeposits = { + methodName: "ListUnspentDeposits", + service: SwapClient, + requestStream: false, + responseStream: false, + requestType: loop_pb.ListUnspentDepositsRequest, + responseType: loop_pb.ListUnspentDepositsResponse +}; + +SwapClient.WithdrawDeposits = { + methodName: "WithdrawDeposits", + service: SwapClient, + requestStream: false, + responseStream: false, + requestType: loop_pb.WithdrawDepositsRequest, + responseType: loop_pb.WithdrawDepositsResponse +}; + +SwapClient.ListStaticAddressDeposits = { + methodName: "ListStaticAddressDeposits", + service: SwapClient, + requestStream: false, + responseStream: false, + requestType: loop_pb.ListStaticAddressDepositsRequest, + responseType: loop_pb.ListStaticAddressDepositsResponse +}; + +SwapClient.ListStaticAddressSwaps = { + methodName: "ListStaticAddressSwaps", + service: SwapClient, + requestStream: false, + responseStream: false, + requestType: loop_pb.ListStaticAddressSwapsRequest, + responseType: loop_pb.ListStaticAddressSwapsResponse +}; + +SwapClient.GetStaticAddressSummary = { + methodName: "GetStaticAddressSummary", + service: SwapClient, + requestStream: false, + responseStream: false, + requestType: loop_pb.StaticAddressSummaryRequest, + responseType: loop_pb.StaticAddressSummaryResponse +}; + +SwapClient.StaticAddressLoopIn = { + methodName: "StaticAddressLoopIn", + service: SwapClient, + requestStream: false, + responseStream: false, + requestType: loop_pb.StaticAddressLoopInRequest, + responseType: loop_pb.StaticAddressLoopInResponse +}; + exports.SwapClient = SwapClient; function SwapClientClient(serviceHost, options) { @@ -617,6 +689,37 @@ SwapClientClient.prototype.getLsatTokens = function getLsatTokens(requestMessage }; }; +SwapClientClient.prototype.fetchL402Token = function fetchL402Token(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(SwapClient.FetchL402Token, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + SwapClientClient.prototype.getInfo = function getInfo(requestMessage, metadata, callback) { if (arguments.length === 2) { callback = arguments[1]; @@ -865,5 +968,222 @@ SwapClientClient.prototype.listInstantOuts = function listInstantOuts(requestMes }; }; +SwapClientClient.prototype.newStaticAddress = function newStaticAddress(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(SwapClient.NewStaticAddress, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + +SwapClientClient.prototype.listUnspentDeposits = function listUnspentDeposits(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(SwapClient.ListUnspentDeposits, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + +SwapClientClient.prototype.withdrawDeposits = function withdrawDeposits(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(SwapClient.WithdrawDeposits, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + +SwapClientClient.prototype.listStaticAddressDeposits = function listStaticAddressDeposits(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(SwapClient.ListStaticAddressDeposits, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + +SwapClientClient.prototype.listStaticAddressSwaps = function listStaticAddressSwaps(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(SwapClient.ListStaticAddressSwaps, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + +SwapClientClient.prototype.getStaticAddressSummary = function getStaticAddressSummary(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(SwapClient.GetStaticAddressSummary, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + +SwapClientClient.prototype.staticAddressLoopIn = function staticAddressLoopIn(requestMessage, metadata, callback) { + if (arguments.length === 2) { + callback = arguments[1]; + } + var client = grpc.unary(SwapClient.StaticAddressLoopIn, { + request: requestMessage, + host: this.serviceHost, + metadata: metadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: function (response) { + if (callback) { + if (response.status !== grpc.Code.OK) { + var err = new Error(response.statusMessage); + err.code = response.status; + err.metadata = response.trailers; + callback(err, null); + } else { + callback(null, response.message); + } + } + } + }); + return { + cancel: function () { + callback = null; + client.close(); + } + }; +}; + exports.SwapClientClient = SwapClientClient; diff --git a/app/src/types/generated/swapserverrpc/server_pb.d.ts b/app/src/types/generated/swapserverrpc/server_pb.d.ts index 5f94ab1b8..00cc4dfce 100644 --- a/app/src/types/generated/swapserverrpc/server_pb.d.ts +++ b/app/src/types/generated/swapserverrpc/server_pb.d.ts @@ -1073,6 +1073,11 @@ export class SubscribeNotificationsResponse extends jspb.Message { getReservationNotification(): swapserverrpc_reservation_pb.ServerReservationNotification | undefined; setReservationNotification(value?: swapserverrpc_reservation_pb.ServerReservationNotification): void; + hasStaticLoopInSweep(): boolean; + clearStaticLoopInSweep(): void; + getStaticLoopInSweep(): ServerStaticLoopInSweepNotification | undefined; + setStaticLoopInSweep(value?: ServerStaticLoopInSweepNotification): void; + getNotificationCase(): SubscribeNotificationsResponse.NotificationCase; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): SubscribeNotificationsResponse.AsObject; @@ -1087,155 +1092,50 @@ export class SubscribeNotificationsResponse extends jspb.Message { export namespace SubscribeNotificationsResponse { export type AsObject = { reservationNotification?: swapserverrpc_reservation_pb.ServerReservationNotification.AsObject, + staticLoopInSweep?: ServerStaticLoopInSweepNotification.AsObject, } export enum NotificationCase { NOTIFICATION_NOT_SET = 0, RESERVATION_NOTIFICATION = 1, + STATIC_LOOP_IN_SWEEP = 2, } } -export class ServerNewAddressRequest extends jspb.Message { - getProtocolVersion(): StaticAddressProtocolVersionMap[keyof StaticAddressProtocolVersionMap]; - setProtocolVersion(value: StaticAddressProtocolVersionMap[keyof StaticAddressProtocolVersionMap]): void; - - getClientKey(): Uint8Array | string; - getClientKey_asU8(): Uint8Array; - getClientKey_asB64(): string; - setClientKey(value: Uint8Array | string): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): ServerNewAddressRequest.AsObject; - static toObject(includeInstance: boolean, msg: ServerNewAddressRequest): ServerNewAddressRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: ServerNewAddressRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): ServerNewAddressRequest; - static deserializeBinaryFromReader(message: ServerNewAddressRequest, reader: jspb.BinaryReader): ServerNewAddressRequest; -} - -export namespace ServerNewAddressRequest { - export type AsObject = { - protocolVersion: StaticAddressProtocolVersionMap[keyof StaticAddressProtocolVersionMap], - clientKey: Uint8Array | string, - } -} - -export class ServerNewAddressResponse extends jspb.Message { - hasParams(): boolean; - clearParams(): void; - getParams(): ServerAddressParameters | undefined; - setParams(value?: ServerAddressParameters): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): ServerNewAddressResponse.AsObject; - static toObject(includeInstance: boolean, msg: ServerNewAddressResponse): ServerNewAddressResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: ServerNewAddressResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): ServerNewAddressResponse; - static deserializeBinaryFromReader(message: ServerNewAddressResponse, reader: jspb.BinaryReader): ServerNewAddressResponse; -} - -export namespace ServerNewAddressResponse { - export type AsObject = { - params?: ServerAddressParameters.AsObject, - } -} - -export class ServerAddressParameters extends jspb.Message { - getServerKey(): Uint8Array | string; - getServerKey_asU8(): Uint8Array; - getServerKey_asB64(): string; - setServerKey(value: Uint8Array | string): void; - - getExpiry(): number; - setExpiry(value: number): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): ServerAddressParameters.AsObject; - static toObject(includeInstance: boolean, msg: ServerAddressParameters): ServerAddressParameters.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: ServerAddressParameters, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): ServerAddressParameters; - static deserializeBinaryFromReader(message: ServerAddressParameters, reader: jspb.BinaryReader): ServerAddressParameters; -} - -export namespace ServerAddressParameters { - export type AsObject = { - serverKey: Uint8Array | string, - expiry: number, - } -} - -export class ServerWithdrawRequest extends jspb.Message { - clearOutpointsList(): void; - getOutpointsList(): Array; - setOutpointsList(value: Array): void; - addOutpoints(value?: PrevoutInfo, index?: number): PrevoutInfo; - - clearClientNoncesList(): void; - getClientNoncesList(): Array; - getClientNoncesList_asU8(): Array; - getClientNoncesList_asB64(): Array; - setClientNoncesList(value: Array): void; - addClientNonces(value: Uint8Array | string, index?: number): Uint8Array | string; - - getClientSweepAddr(): string; - setClientSweepAddr(value: string): void; - - getTxFeeRate(): string; - setTxFeeRate(value: string): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): ServerWithdrawRequest.AsObject; - static toObject(includeInstance: boolean, msg: ServerWithdrawRequest): ServerWithdrawRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: ServerWithdrawRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): ServerWithdrawRequest; - static deserializeBinaryFromReader(message: ServerWithdrawRequest, reader: jspb.BinaryReader): ServerWithdrawRequest; -} - -export namespace ServerWithdrawRequest { - export type AsObject = { - outpointsList: Array, - clientNoncesList: Array, - clientSweepAddr: string, - txFeeRate: string, - } -} +export class ServerStaticLoopInSweepNotification extends jspb.Message { + getSweepTxPsbt(): Uint8Array | string; + getSweepTxPsbt_asU8(): Uint8Array; + getSweepTxPsbt_asB64(): string; + setSweepTxPsbt(value: Uint8Array | string): void; -export class ServerWithdrawResponse extends jspb.Message { - clearMusig2SweepSigsList(): void; - getMusig2SweepSigsList(): Array; - getMusig2SweepSigsList_asU8(): Array; - getMusig2SweepSigsList_asB64(): Array; - setMusig2SweepSigsList(value: Array): void; - addMusig2SweepSigs(value: Uint8Array | string, index?: number): Uint8Array | string; + getSwapHash(): Uint8Array | string; + getSwapHash_asU8(): Uint8Array; + getSwapHash_asB64(): string; + setSwapHash(value: Uint8Array | string): void; - clearServerNoncesList(): void; - getServerNoncesList(): Array; - getServerNoncesList_asU8(): Array; - getServerNoncesList_asB64(): Array; - setServerNoncesList(value: Array): void; - addServerNonces(value: Uint8Array | string, index?: number): Uint8Array | string; + getDepositToNoncesMap(): jspb.Map; + clearDepositToNoncesMap(): void; + clearPrevoutInfoList(): void; + getPrevoutInfoList(): Array; + setPrevoutInfoList(value: Array): void; + addPrevoutInfo(value?: PrevoutInfo, index?: number): PrevoutInfo; serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): ServerWithdrawResponse.AsObject; - static toObject(includeInstance: boolean, msg: ServerWithdrawResponse): ServerWithdrawResponse.AsObject; + toObject(includeInstance?: boolean): ServerStaticLoopInSweepNotification.AsObject; + static toObject(includeInstance: boolean, msg: ServerStaticLoopInSweepNotification): ServerStaticLoopInSweepNotification.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: ServerWithdrawResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): ServerWithdrawResponse; - static deserializeBinaryFromReader(message: ServerWithdrawResponse, reader: jspb.BinaryReader): ServerWithdrawResponse; + static serializeBinaryToWriter(message: ServerStaticLoopInSweepNotification, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ServerStaticLoopInSweepNotification; + static deserializeBinaryFromReader(message: ServerStaticLoopInSweepNotification, reader: jspb.BinaryReader): ServerStaticLoopInSweepNotification; } -export namespace ServerWithdrawResponse { +export namespace ServerStaticLoopInSweepNotification { export type AsObject = { - musig2SweepSigsList: Array, - serverNoncesList: Array, + sweepTxPsbt: Uint8Array | string, + swapHash: Uint8Array | string, + depositToNoncesMap: Array<[string, Uint8Array | string]>, + prevoutInfoList: Array, } } @@ -1304,9 +1204,3 @@ export interface RoutingPluginMap { export const RoutingPlugin: RoutingPluginMap; -export interface StaticAddressProtocolVersionMap { - V0: 0; -} - -export const StaticAddressProtocolVersion: StaticAddressProtocolVersionMap; - diff --git a/app/src/types/generated/swapserverrpc/server_pb.js b/app/src/types/generated/swapserverrpc/server_pb.js index 37ebb24b1..84a2e5625 100644 --- a/app/src/types/generated/swapserverrpc/server_pb.js +++ b/app/src/types/generated/swapserverrpc/server_pb.js @@ -46,7 +46,6 @@ goog.exportSymbol('proto.looprpc.ReportRoutingResultRes', null, global); goog.exportSymbol('proto.looprpc.RouteCancel', null, global); goog.exportSymbol('proto.looprpc.RoutePaymentType', null, global); goog.exportSymbol('proto.looprpc.RoutingPlugin', null, global); -goog.exportSymbol('proto.looprpc.ServerAddressParameters', null, global); goog.exportSymbol('proto.looprpc.ServerLoopInQuoteRequest', null, global); goog.exportSymbol('proto.looprpc.ServerLoopInQuoteResponse', null, global); goog.exportSymbol('proto.looprpc.ServerLoopInRequest', null, global); @@ -61,16 +60,12 @@ goog.exportSymbol('proto.looprpc.ServerLoopOutRequest', null, global); goog.exportSymbol('proto.looprpc.ServerLoopOutResponse', null, global); goog.exportSymbol('proto.looprpc.ServerLoopOutTerms', null, global); goog.exportSymbol('proto.looprpc.ServerLoopOutTermsRequest', null, global); -goog.exportSymbol('proto.looprpc.ServerNewAddressRequest', null, global); -goog.exportSymbol('proto.looprpc.ServerNewAddressResponse', null, global); goog.exportSymbol('proto.looprpc.ServerProbeRequest', null, global); goog.exportSymbol('proto.looprpc.ServerProbeResponse', null, global); goog.exportSymbol('proto.looprpc.ServerPushKeyReq', null, global); goog.exportSymbol('proto.looprpc.ServerPushKeyRes', null, global); +goog.exportSymbol('proto.looprpc.ServerStaticLoopInSweepNotification', null, global); goog.exportSymbol('proto.looprpc.ServerSwapState', null, global); -goog.exportSymbol('proto.looprpc.ServerWithdrawRequest', null, global); -goog.exportSymbol('proto.looprpc.ServerWithdrawResponse', null, global); -goog.exportSymbol('proto.looprpc.StaticAddressProtocolVersion', null, global); goog.exportSymbol('proto.looprpc.SubscribeLoopInUpdatesResponse', null, global); goog.exportSymbol('proto.looprpc.SubscribeLoopOutUpdatesResponse', null, global); goog.exportSymbol('proto.looprpc.SubscribeNotificationsRequest', null, global); @@ -843,100 +838,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.looprpc.ServerNewAddressRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.looprpc.ServerNewAddressRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.ServerNewAddressRequest.displayName = 'proto.looprpc.ServerNewAddressRequest'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.looprpc.ServerNewAddressResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.looprpc.ServerNewAddressResponse, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.ServerNewAddressResponse.displayName = 'proto.looprpc.ServerNewAddressResponse'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.looprpc.ServerAddressParameters = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.looprpc.ServerAddressParameters, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.ServerAddressParameters.displayName = 'proto.looprpc.ServerAddressParameters'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.looprpc.ServerWithdrawRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.looprpc.ServerWithdrawRequest.repeatedFields_, null); -}; -goog.inherits(proto.looprpc.ServerWithdrawRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.ServerWithdrawRequest.displayName = 'proto.looprpc.ServerWithdrawRequest'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.looprpc.ServerWithdrawResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.looprpc.ServerWithdrawResponse.repeatedFields_, null); +proto.looprpc.ServerStaticLoopInSweepNotification = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.looprpc.ServerStaticLoopInSweepNotification.repeatedFields_, null); }; -goog.inherits(proto.looprpc.ServerWithdrawResponse, jspb.Message); +goog.inherits(proto.looprpc.ServerStaticLoopInSweepNotification, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.looprpc.ServerWithdrawResponse.displayName = 'proto.looprpc.ServerWithdrawResponse'; + proto.looprpc.ServerStaticLoopInSweepNotification.displayName = 'proto.looprpc.ServerStaticLoopInSweepNotification'; } @@ -8545,14 +8456,15 @@ proto.looprpc.SubscribeNotificationsRequest.serializeBinaryToWriter = function(m * @private {!Array>} * @const */ -proto.looprpc.SubscribeNotificationsResponse.oneofGroups_ = [[1]]; +proto.looprpc.SubscribeNotificationsResponse.oneofGroups_ = [[1,2]]; /** * @enum {number} */ proto.looprpc.SubscribeNotificationsResponse.NotificationCase = { NOTIFICATION_NOT_SET: 0, - RESERVATION_NOTIFICATION: 1 + RESERVATION_NOTIFICATION: 1, + STATIC_LOOP_IN_SWEEP: 2 }; /** @@ -8593,7 +8505,8 @@ proto.looprpc.SubscribeNotificationsResponse.prototype.toObject = function(opt_i */ proto.looprpc.SubscribeNotificationsResponse.toObject = function(includeInstance, msg) { var f, obj = { - reservationNotification: (f = msg.getReservationNotification()) && swapserverrpc_reservation_pb.ServerReservationNotification.toObject(includeInstance, f) + reservationNotification: (f = msg.getReservationNotification()) && swapserverrpc_reservation_pb.ServerReservationNotification.toObject(includeInstance, f), + staticLoopInSweep: (f = msg.getStaticLoopInSweep()) && proto.looprpc.ServerStaticLoopInSweepNotification.toObject(includeInstance, f) }; if (includeInstance) { @@ -8635,6 +8548,11 @@ proto.looprpc.SubscribeNotificationsResponse.deserializeBinaryFromReader = funct reader.readMessage(value,swapserverrpc_reservation_pb.ServerReservationNotification.deserializeBinaryFromReader); msg.setReservationNotification(value); break; + case 2: + var value = new proto.looprpc.ServerStaticLoopInSweepNotification; + reader.readMessage(value,proto.looprpc.ServerStaticLoopInSweepNotification.deserializeBinaryFromReader); + msg.setStaticLoopInSweep(value); + break; default: reader.skipField(); break; @@ -8672,6 +8590,14 @@ proto.looprpc.SubscribeNotificationsResponse.serializeBinaryToWriter = function( swapserverrpc_reservation_pb.ServerReservationNotification.serializeBinaryToWriter ); } + f = message.getStaticLoopInSweep(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.looprpc.ServerStaticLoopInSweepNotification.serializeBinaryToWriter + ); + } }; @@ -8712,6 +8638,50 @@ proto.looprpc.SubscribeNotificationsResponse.prototype.hasReservationNotificatio }; +/** + * optional ServerStaticLoopInSweepNotification static_loop_in_sweep = 2; + * @return {?proto.looprpc.ServerStaticLoopInSweepNotification} + */ +proto.looprpc.SubscribeNotificationsResponse.prototype.getStaticLoopInSweep = function() { + return /** @type{?proto.looprpc.ServerStaticLoopInSweepNotification} */ ( + jspb.Message.getWrapperField(this, proto.looprpc.ServerStaticLoopInSweepNotification, 2)); +}; + + +/** + * @param {?proto.looprpc.ServerStaticLoopInSweepNotification|undefined} value + * @return {!proto.looprpc.SubscribeNotificationsResponse} returns this +*/ +proto.looprpc.SubscribeNotificationsResponse.prototype.setStaticLoopInSweep = function(value) { + return jspb.Message.setOneofWrapperField(this, 2, proto.looprpc.SubscribeNotificationsResponse.oneofGroups_[0], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.looprpc.SubscribeNotificationsResponse} returns this + */ +proto.looprpc.SubscribeNotificationsResponse.prototype.clearStaticLoopInSweep = function() { + return this.setStaticLoopInSweep(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.looprpc.SubscribeNotificationsResponse.prototype.hasStaticLoopInSweep = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.looprpc.ServerStaticLoopInSweepNotification.repeatedFields_ = [4]; @@ -8728,8 +8698,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.looprpc.ServerNewAddressRequest.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.ServerNewAddressRequest.toObject(opt_includeInstance, this); +proto.looprpc.ServerStaticLoopInSweepNotification.prototype.toObject = function(opt_includeInstance) { + return proto.looprpc.ServerStaticLoopInSweepNotification.toObject(opt_includeInstance, this); }; @@ -8738,14 +8708,17 @@ proto.looprpc.ServerNewAddressRequest.prototype.toObject = function(opt_includeI * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.looprpc.ServerNewAddressRequest} msg The msg instance to transform. + * @param {!proto.looprpc.ServerStaticLoopInSweepNotification} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.ServerNewAddressRequest.toObject = function(includeInstance, msg) { +proto.looprpc.ServerStaticLoopInSweepNotification.toObject = function(includeInstance, msg) { var f, obj = { - protocolVersion: jspb.Message.getFieldWithDefault(msg, 1, 0), - clientKey: msg.getClientKey_asB64() + sweepTxPsbt: msg.getSweepTxPsbt_asB64(), + swapHash: msg.getSwapHash_asB64(), + depositToNoncesMap: (f = msg.getDepositToNoncesMap()) ? f.toObject(includeInstance, undefined) : [], + prevoutInfoList: jspb.Message.toObjectList(msg.getPrevoutInfoList(), + proto.looprpc.PrevoutInfo.toObject, includeInstance) }; if (includeInstance) { @@ -8759,23 +8732,23 @@ proto.looprpc.ServerNewAddressRequest.toObject = function(includeInstance, msg) /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.ServerNewAddressRequest} + * @return {!proto.looprpc.ServerStaticLoopInSweepNotification} */ -proto.looprpc.ServerNewAddressRequest.deserializeBinary = function(bytes) { +proto.looprpc.ServerStaticLoopInSweepNotification.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.ServerNewAddressRequest; - return proto.looprpc.ServerNewAddressRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.looprpc.ServerStaticLoopInSweepNotification; + return proto.looprpc.ServerStaticLoopInSweepNotification.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.looprpc.ServerNewAddressRequest} msg The message object to deserialize into. + * @param {!proto.looprpc.ServerStaticLoopInSweepNotification} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.ServerNewAddressRequest} + * @return {!proto.looprpc.ServerStaticLoopInSweepNotification} */ -proto.looprpc.ServerNewAddressRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.looprpc.ServerStaticLoopInSweepNotification.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -8783,12 +8756,23 @@ proto.looprpc.ServerNewAddressRequest.deserializeBinaryFromReader = function(msg var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!proto.looprpc.StaticAddressProtocolVersion} */ (reader.readEnum()); - msg.setProtocolVersion(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setSweepTxPsbt(value); break; case 2: var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setClientKey(value); + msg.setSwapHash(value); + break; + case 3: + var value = msg.getDepositToNoncesMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readBytes, null, "", ""); + }); + break; + case 4: + var value = new proto.looprpc.PrevoutInfo; + reader.readMessage(value,proto.looprpc.PrevoutInfo.deserializeBinaryFromReader); + msg.addPrevoutInfo(value); break; default: reader.skipField(); @@ -8803,9 +8787,9 @@ proto.looprpc.ServerNewAddressRequest.deserializeBinaryFromReader = function(msg * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.looprpc.ServerNewAddressRequest.prototype.serializeBinary = function() { +proto.looprpc.ServerStaticLoopInSweepNotification.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.looprpc.ServerNewAddressRequest.serializeBinaryToWriter(this, writer); + proto.looprpc.ServerStaticLoopInSweepNotification.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -8813,967 +8797,183 @@ proto.looprpc.ServerNewAddressRequest.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.ServerNewAddressRequest} message + * @param {!proto.looprpc.ServerStaticLoopInSweepNotification} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.looprpc.ServerNewAddressRequest.serializeBinaryToWriter = function(message, writer) { +proto.looprpc.ServerStaticLoopInSweepNotification.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getProtocolVersion(); - if (f !== 0.0) { - writer.writeEnum( + f = message.getSweepTxPsbt_asU8(); + if (f.length > 0) { + writer.writeBytes( 1, f ); } - f = message.getClientKey_asU8(); + f = message.getSwapHash_asU8(); if (f.length > 0) { writer.writeBytes( 2, f ); } + f = message.getDepositToNoncesMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(3, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeBytes); + } + f = message.getPrevoutInfoList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 4, + f, + proto.looprpc.PrevoutInfo.serializeBinaryToWriter + ); + } }; /** - * optional StaticAddressProtocolVersion protocol_version = 1; - * @return {!proto.looprpc.StaticAddressProtocolVersion} - */ -proto.looprpc.ServerNewAddressRequest.prototype.getProtocolVersion = function() { - return /** @type {!proto.looprpc.StaticAddressProtocolVersion} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {!proto.looprpc.StaticAddressProtocolVersion} value - * @return {!proto.looprpc.ServerNewAddressRequest} returns this - */ -proto.looprpc.ServerNewAddressRequest.prototype.setProtocolVersion = function(value) { - return jspb.Message.setProto3EnumField(this, 1, value); -}; - - -/** - * optional bytes client_key = 2; + * optional bytes sweep_tx_psbt = 1; * @return {!(string|Uint8Array)} */ -proto.looprpc.ServerNewAddressRequest.prototype.getClientKey = function() { - return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.looprpc.ServerStaticLoopInSweepNotification.prototype.getSweepTxPsbt = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional bytes client_key = 2; - * This is a type-conversion wrapper around `getClientKey()` + * optional bytes sweep_tx_psbt = 1; + * This is a type-conversion wrapper around `getSweepTxPsbt()` * @return {string} */ -proto.looprpc.ServerNewAddressRequest.prototype.getClientKey_asB64 = function() { +proto.looprpc.ServerStaticLoopInSweepNotification.prototype.getSweepTxPsbt_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getClientKey())); + this.getSweepTxPsbt())); }; /** - * optional bytes client_key = 2; + * optional bytes sweep_tx_psbt = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getClientKey()` + * This is a type-conversion wrapper around `getSweepTxPsbt()` * @return {!Uint8Array} */ -proto.looprpc.ServerNewAddressRequest.prototype.getClientKey_asU8 = function() { +proto.looprpc.ServerStaticLoopInSweepNotification.prototype.getSweepTxPsbt_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getClientKey())); + this.getSweepTxPsbt())); }; /** * @param {!(string|Uint8Array)} value - * @return {!proto.looprpc.ServerNewAddressRequest} returns this + * @return {!proto.looprpc.ServerStaticLoopInSweepNotification} returns this */ -proto.looprpc.ServerNewAddressRequest.prototype.setClientKey = function(value) { - return jspb.Message.setProto3BytesField(this, 2, value); +proto.looprpc.ServerStaticLoopInSweepNotification.prototype.setSweepTxPsbt = function(value) { + return jspb.Message.setProto3BytesField(this, 1, value); }; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * optional bytes swap_hash = 2; + * @return {!(string|Uint8Array)} */ -proto.looprpc.ServerNewAddressResponse.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.ServerNewAddressResponse.toObject(opt_includeInstance, this); +proto.looprpc.ServerStaticLoopInSweepNotification.prototype.getSwapHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.looprpc.ServerNewAddressResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * optional bytes swap_hash = 2; + * This is a type-conversion wrapper around `getSwapHash()` + * @return {string} */ -proto.looprpc.ServerNewAddressResponse.toObject = function(includeInstance, msg) { - var f, obj = { - params: (f = msg.getParams()) && proto.looprpc.ServerAddressParameters.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; +proto.looprpc.ServerStaticLoopInSweepNotification.prototype.getSwapHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getSwapHash())); }; -} /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.ServerNewAddressResponse} + * optional bytes swap_hash = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getSwapHash()` + * @return {!Uint8Array} */ -proto.looprpc.ServerNewAddressResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.ServerNewAddressResponse; - return proto.looprpc.ServerNewAddressResponse.deserializeBinaryFromReader(msg, reader); +proto.looprpc.ServerStaticLoopInSweepNotification.prototype.getSwapHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getSwapHash())); }; /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.looprpc.ServerNewAddressResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.ServerNewAddressResponse} + * @param {!(string|Uint8Array)} value + * @return {!proto.looprpc.ServerStaticLoopInSweepNotification} returns this */ -proto.looprpc.ServerNewAddressResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.looprpc.ServerAddressParameters; - reader.readMessage(value,proto.looprpc.ServerAddressParameters.deserializeBinaryFromReader); - msg.setParams(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; +proto.looprpc.ServerStaticLoopInSweepNotification.prototype.setSwapHash = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * map deposit_to_nonces = 3; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} */ -proto.looprpc.ServerNewAddressResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.ServerNewAddressResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.looprpc.ServerStaticLoopInSweepNotification.prototype.getDepositToNoncesMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 3, opt_noLazyCreate, + null)); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.ServerNewAddressResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * Clears values from the map. The map will be non-null. + * @return {!proto.looprpc.ServerStaticLoopInSweepNotification} returns this */ -proto.looprpc.ServerNewAddressResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getParams(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.looprpc.ServerAddressParameters.serializeBinaryToWriter - ); - } +proto.looprpc.ServerStaticLoopInSweepNotification.prototype.clearDepositToNoncesMap = function() { + this.getDepositToNoncesMap().clear(); + return this; }; /** - * optional ServerAddressParameters params = 1; - * @return {?proto.looprpc.ServerAddressParameters} + * repeated PrevoutInfo prevout_info = 4; + * @return {!Array} */ -proto.looprpc.ServerNewAddressResponse.prototype.getParams = function() { - return /** @type{?proto.looprpc.ServerAddressParameters} */ ( - jspb.Message.getWrapperField(this, proto.looprpc.ServerAddressParameters, 1)); +proto.looprpc.ServerStaticLoopInSweepNotification.prototype.getPrevoutInfoList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.looprpc.PrevoutInfo, 4)); }; /** - * @param {?proto.looprpc.ServerAddressParameters|undefined} value - * @return {!proto.looprpc.ServerNewAddressResponse} returns this + * @param {!Array} value + * @return {!proto.looprpc.ServerStaticLoopInSweepNotification} returns this */ -proto.looprpc.ServerNewAddressResponse.prototype.setParams = function(value) { - return jspb.Message.setWrapperField(this, 1, value); +proto.looprpc.ServerStaticLoopInSweepNotification.prototype.setPrevoutInfoList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 4, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.looprpc.ServerNewAddressResponse} returns this + * @param {!proto.looprpc.PrevoutInfo=} opt_value + * @param {number=} opt_index + * @return {!proto.looprpc.PrevoutInfo} */ -proto.looprpc.ServerNewAddressResponse.prototype.clearParams = function() { - return this.setParams(undefined); +proto.looprpc.ServerStaticLoopInSweepNotification.prototype.addPrevoutInfo = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, proto.looprpc.PrevoutInfo, opt_index); }; /** - * Returns whether this field is set. - * @return {boolean} + * Clears the list making it empty but non-null. + * @return {!proto.looprpc.ServerStaticLoopInSweepNotification} returns this */ -proto.looprpc.ServerNewAddressResponse.prototype.hasParams = function() { - return jspb.Message.getField(this, 1) != null; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.looprpc.ServerAddressParameters.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.ServerAddressParameters.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.looprpc.ServerAddressParameters} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.ServerAddressParameters.toObject = function(includeInstance, msg) { - var f, obj = { - serverKey: msg.getServerKey_asB64(), - expiry: jspb.Message.getFieldWithDefault(msg, 2, 0) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.ServerAddressParameters} - */ -proto.looprpc.ServerAddressParameters.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.ServerAddressParameters; - return proto.looprpc.ServerAddressParameters.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.looprpc.ServerAddressParameters} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.ServerAddressParameters} - */ -proto.looprpc.ServerAddressParameters.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setServerKey(value); - break; - case 2: - var value = /** @type {number} */ (reader.readUint32()); - msg.setExpiry(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.looprpc.ServerAddressParameters.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.ServerAddressParameters.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.ServerAddressParameters} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.ServerAddressParameters.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getServerKey_asU8(); - if (f.length > 0) { - writer.writeBytes( - 1, - f - ); - } - f = message.getExpiry(); - if (f !== 0) { - writer.writeUint32( - 2, - f - ); - } -}; - - -/** - * optional bytes server_key = 1; - * @return {!(string|Uint8Array)} - */ -proto.looprpc.ServerAddressParameters.prototype.getServerKey = function() { - return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * optional bytes server_key = 1; - * This is a type-conversion wrapper around `getServerKey()` - * @return {string} - */ -proto.looprpc.ServerAddressParameters.prototype.getServerKey_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getServerKey())); -}; - - -/** - * optional bytes server_key = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getServerKey()` - * @return {!Uint8Array} - */ -proto.looprpc.ServerAddressParameters.prototype.getServerKey_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getServerKey())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.looprpc.ServerAddressParameters} returns this - */ -proto.looprpc.ServerAddressParameters.prototype.setServerKey = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); -}; - - -/** - * optional uint32 expiry = 2; - * @return {number} - */ -proto.looprpc.ServerAddressParameters.prototype.getExpiry = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.ServerAddressParameters} returns this - */ -proto.looprpc.ServerAddressParameters.prototype.setExpiry = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.looprpc.ServerWithdrawRequest.repeatedFields_ = [1,2]; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.looprpc.ServerWithdrawRequest.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.ServerWithdrawRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.looprpc.ServerWithdrawRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.ServerWithdrawRequest.toObject = function(includeInstance, msg) { - var f, obj = { - outpointsList: jspb.Message.toObjectList(msg.getOutpointsList(), - proto.looprpc.PrevoutInfo.toObject, includeInstance), - clientNoncesList: msg.getClientNoncesList_asB64(), - clientSweepAddr: jspb.Message.getFieldWithDefault(msg, 3, ""), - txFeeRate: jspb.Message.getFieldWithDefault(msg, 4, "0") - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.ServerWithdrawRequest} - */ -proto.looprpc.ServerWithdrawRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.ServerWithdrawRequest; - return proto.looprpc.ServerWithdrawRequest.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.looprpc.ServerWithdrawRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.ServerWithdrawRequest} - */ -proto.looprpc.ServerWithdrawRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.looprpc.PrevoutInfo; - reader.readMessage(value,proto.looprpc.PrevoutInfo.deserializeBinaryFromReader); - msg.addOutpoints(value); - break; - case 2: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.addClientNonces(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setClientSweepAddr(value); - break; - case 4: - var value = /** @type {string} */ (reader.readUint64String()); - msg.setTxFeeRate(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.looprpc.ServerWithdrawRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.ServerWithdrawRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.ServerWithdrawRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.ServerWithdrawRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getOutpointsList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 1, - f, - proto.looprpc.PrevoutInfo.serializeBinaryToWriter - ); - } - f = message.getClientNoncesList_asU8(); - if (f.length > 0) { - writer.writeRepeatedBytes( - 2, - f - ); - } - f = message.getClientSweepAddr(); - if (f.length > 0) { - writer.writeString( - 3, - f - ); - } - f = message.getTxFeeRate(); - if (parseInt(f, 10) !== 0) { - writer.writeUint64String( - 4, - f - ); - } -}; - - -/** - * repeated PrevoutInfo outpoints = 1; - * @return {!Array} - */ -proto.looprpc.ServerWithdrawRequest.prototype.getOutpointsList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.looprpc.PrevoutInfo, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.looprpc.ServerWithdrawRequest} returns this -*/ -proto.looprpc.ServerWithdrawRequest.prototype.setOutpointsList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - - -/** - * @param {!proto.looprpc.PrevoutInfo=} opt_value - * @param {number=} opt_index - * @return {!proto.looprpc.PrevoutInfo} - */ -proto.looprpc.ServerWithdrawRequest.prototype.addOutpoints = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.looprpc.PrevoutInfo, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.looprpc.ServerWithdrawRequest} returns this - */ -proto.looprpc.ServerWithdrawRequest.prototype.clearOutpointsList = function() { - return this.setOutpointsList([]); -}; - - -/** - * repeated bytes client_nonces = 2; - * @return {!(Array|Array)} - */ -proto.looprpc.ServerWithdrawRequest.prototype.getClientNoncesList = function() { - return /** @type {!(Array|Array)} */ (jspb.Message.getRepeatedField(this, 2)); -}; - - -/** - * repeated bytes client_nonces = 2; - * This is a type-conversion wrapper around `getClientNoncesList()` - * @return {!Array} - */ -proto.looprpc.ServerWithdrawRequest.prototype.getClientNoncesList_asB64 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsB64( - this.getClientNoncesList())); -}; - - -/** - * repeated bytes client_nonces = 2; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getClientNoncesList()` - * @return {!Array} - */ -proto.looprpc.ServerWithdrawRequest.prototype.getClientNoncesList_asU8 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsU8( - this.getClientNoncesList())); -}; - - -/** - * @param {!(Array|Array)} value - * @return {!proto.looprpc.ServerWithdrawRequest} returns this - */ -proto.looprpc.ServerWithdrawRequest.prototype.setClientNoncesList = function(value) { - return jspb.Message.setField(this, 2, value || []); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @param {number=} opt_index - * @return {!proto.looprpc.ServerWithdrawRequest} returns this - */ -proto.looprpc.ServerWithdrawRequest.prototype.addClientNonces = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 2, value, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.looprpc.ServerWithdrawRequest} returns this - */ -proto.looprpc.ServerWithdrawRequest.prototype.clearClientNoncesList = function() { - return this.setClientNoncesList([]); -}; - - -/** - * optional string client_sweep_addr = 3; - * @return {string} - */ -proto.looprpc.ServerWithdrawRequest.prototype.getClientSweepAddr = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); -}; - - -/** - * @param {string} value - * @return {!proto.looprpc.ServerWithdrawRequest} returns this - */ -proto.looprpc.ServerWithdrawRequest.prototype.setClientSweepAddr = function(value) { - return jspb.Message.setProto3StringField(this, 3, value); -}; - - -/** - * optional uint64 tx_fee_rate = 4; - * @return {string} - */ -proto.looprpc.ServerWithdrawRequest.prototype.getTxFeeRate = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "0")); -}; - - -/** - * @param {string} value - * @return {!proto.looprpc.ServerWithdrawRequest} returns this - */ -proto.looprpc.ServerWithdrawRequest.prototype.setTxFeeRate = function(value) { - return jspb.Message.setProto3StringIntField(this, 4, value); -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.looprpc.ServerWithdrawResponse.repeatedFields_ = [1,2]; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.looprpc.ServerWithdrawResponse.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.ServerWithdrawResponse.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.looprpc.ServerWithdrawResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.ServerWithdrawResponse.toObject = function(includeInstance, msg) { - var f, obj = { - musig2SweepSigsList: msg.getMusig2SweepSigsList_asB64(), - serverNoncesList: msg.getServerNoncesList_asB64() - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.ServerWithdrawResponse} - */ -proto.looprpc.ServerWithdrawResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.ServerWithdrawResponse; - return proto.looprpc.ServerWithdrawResponse.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.looprpc.ServerWithdrawResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.ServerWithdrawResponse} - */ -proto.looprpc.ServerWithdrawResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.addMusig2SweepSigs(value); - break; - case 2: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.addServerNonces(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.looprpc.ServerWithdrawResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.ServerWithdrawResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.looprpc.ServerWithdrawResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.ServerWithdrawResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getMusig2SweepSigsList_asU8(); - if (f.length > 0) { - writer.writeRepeatedBytes( - 1, - f - ); - } - f = message.getServerNoncesList_asU8(); - if (f.length > 0) { - writer.writeRepeatedBytes( - 2, - f - ); - } -}; - - -/** - * repeated bytes musig2_sweep_sigs = 1; - * @return {!(Array|Array)} - */ -proto.looprpc.ServerWithdrawResponse.prototype.getMusig2SweepSigsList = function() { - return /** @type {!(Array|Array)} */ (jspb.Message.getRepeatedField(this, 1)); -}; - - -/** - * repeated bytes musig2_sweep_sigs = 1; - * This is a type-conversion wrapper around `getMusig2SweepSigsList()` - * @return {!Array} - */ -proto.looprpc.ServerWithdrawResponse.prototype.getMusig2SweepSigsList_asB64 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsB64( - this.getMusig2SweepSigsList())); -}; - - -/** - * repeated bytes musig2_sweep_sigs = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getMusig2SweepSigsList()` - * @return {!Array} - */ -proto.looprpc.ServerWithdrawResponse.prototype.getMusig2SweepSigsList_asU8 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsU8( - this.getMusig2SweepSigsList())); -}; - - -/** - * @param {!(Array|Array)} value - * @return {!proto.looprpc.ServerWithdrawResponse} returns this - */ -proto.looprpc.ServerWithdrawResponse.prototype.setMusig2SweepSigsList = function(value) { - return jspb.Message.setField(this, 1, value || []); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @param {number=} opt_index - * @return {!proto.looprpc.ServerWithdrawResponse} returns this - */ -proto.looprpc.ServerWithdrawResponse.prototype.addMusig2SweepSigs = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 1, value, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.looprpc.ServerWithdrawResponse} returns this - */ -proto.looprpc.ServerWithdrawResponse.prototype.clearMusig2SweepSigsList = function() { - return this.setMusig2SweepSigsList([]); -}; - - -/** - * repeated bytes server_nonces = 2; - * @return {!(Array|Array)} - */ -proto.looprpc.ServerWithdrawResponse.prototype.getServerNoncesList = function() { - return /** @type {!(Array|Array)} */ (jspb.Message.getRepeatedField(this, 2)); -}; - - -/** - * repeated bytes server_nonces = 2; - * This is a type-conversion wrapper around `getServerNoncesList()` - * @return {!Array} - */ -proto.looprpc.ServerWithdrawResponse.prototype.getServerNoncesList_asB64 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsB64( - this.getServerNoncesList())); -}; - - -/** - * repeated bytes server_nonces = 2; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getServerNoncesList()` - * @return {!Array} - */ -proto.looprpc.ServerWithdrawResponse.prototype.getServerNoncesList_asU8 = function() { - return /** @type {!Array} */ (jspb.Message.bytesListAsU8( - this.getServerNoncesList())); -}; - - -/** - * @param {!(Array|Array)} value - * @return {!proto.looprpc.ServerWithdrawResponse} returns this - */ -proto.looprpc.ServerWithdrawResponse.prototype.setServerNoncesList = function(value) { - return jspb.Message.setField(this, 2, value || []); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @param {number=} opt_index - * @return {!proto.looprpc.ServerWithdrawResponse} returns this - */ -proto.looprpc.ServerWithdrawResponse.prototype.addServerNonces = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 2, value, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.looprpc.ServerWithdrawResponse} returns this - */ -proto.looprpc.ServerWithdrawResponse.prototype.clearServerNoncesList = function() { - return this.setServerNoncesList([]); +proto.looprpc.ServerStaticLoopInSweepNotification.prototype.clearPrevoutInfoList = function() { + return this.setPrevoutInfoList([]); }; @@ -9847,11 +9047,4 @@ proto.looprpc.RoutingPlugin = { LOW_HIGH: 1 }; -/** - * @enum {number} - */ -proto.looprpc.StaticAddressProtocolVersion = { - V0: 0 -}; - goog.object.extend(exports, proto.looprpc); diff --git a/app/src/types/generated/swapserverrpc/server_pb_service.d.ts b/app/src/types/generated/swapserverrpc/server_pb_service.d.ts index 8b72ae472..6687dbe61 100644 --- a/app/src/types/generated/swapserverrpc/server_pb_service.d.ts +++ b/app/src/types/generated/swapserverrpc/server_pb_service.d.ts @@ -178,30 +178,6 @@ export class SwapServer { static readonly SubscribeNotifications: SwapServerSubscribeNotifications; } -type StaticAddressServerServerNewAddress = { - readonly methodName: string; - readonly service: typeof StaticAddressServer; - readonly requestStream: false; - readonly responseStream: false; - readonly requestType: typeof swapserverrpc_server_pb.ServerNewAddressRequest; - readonly responseType: typeof swapserverrpc_server_pb.ServerNewAddressResponse; -}; - -type StaticAddressServerServerWithdrawDeposits = { - readonly methodName: string; - readonly service: typeof StaticAddressServer; - readonly requestStream: false; - readonly responseStream: false; - readonly requestType: typeof swapserverrpc_server_pb.ServerWithdrawRequest; - readonly responseType: typeof swapserverrpc_server_pb.ServerWithdrawResponse; -}; - -export class StaticAddressServer { - static readonly serviceName: string; - static readonly ServerNewAddress: StaticAddressServerServerNewAddress; - static readonly ServerWithdrawDeposits: StaticAddressServerServerWithdrawDeposits; -} - export type ServiceError = { message: string, code: number; metadata: grpc.Metadata } export type Status = { details: string, code: number; metadata: grpc.Metadata } @@ -365,27 +341,3 @@ export class SwapServerClient { subscribeNotifications(requestMessage: swapserverrpc_server_pb.SubscribeNotificationsRequest, metadata?: grpc.Metadata): ResponseStream; } -export class StaticAddressServerClient { - readonly serviceHost: string; - - constructor(serviceHost: string, options?: grpc.RpcOptions); - serverNewAddress( - requestMessage: swapserverrpc_server_pb.ServerNewAddressRequest, - metadata: grpc.Metadata, - callback: (error: ServiceError|null, responseMessage: swapserverrpc_server_pb.ServerNewAddressResponse|null) => void - ): UnaryResponse; - serverNewAddress( - requestMessage: swapserverrpc_server_pb.ServerNewAddressRequest, - callback: (error: ServiceError|null, responseMessage: swapserverrpc_server_pb.ServerNewAddressResponse|null) => void - ): UnaryResponse; - serverWithdrawDeposits( - requestMessage: swapserverrpc_server_pb.ServerWithdrawRequest, - metadata: grpc.Metadata, - callback: (error: ServiceError|null, responseMessage: swapserverrpc_server_pb.ServerWithdrawResponse|null) => void - ): UnaryResponse; - serverWithdrawDeposits( - requestMessage: swapserverrpc_server_pb.ServerWithdrawRequest, - callback: (error: ServiceError|null, responseMessage: swapserverrpc_server_pb.ServerWithdrawResponse|null) => void - ): UnaryResponse; -} - diff --git a/app/src/types/generated/swapserverrpc/server_pb_service.js b/app/src/types/generated/swapserverrpc/server_pb_service.js index 769064aca..e95117d66 100644 --- a/app/src/types/generated/swapserverrpc/server_pb_service.js +++ b/app/src/types/generated/swapserverrpc/server_pb_service.js @@ -723,98 +723,3 @@ SwapServerClient.prototype.subscribeNotifications = function subscribeNotificati exports.SwapServerClient = SwapServerClient; -var StaticAddressServer = (function () { - function StaticAddressServer() {} - StaticAddressServer.serviceName = "looprpc.StaticAddressServer"; - return StaticAddressServer; -}()); - -StaticAddressServer.ServerNewAddress = { - methodName: "ServerNewAddress", - service: StaticAddressServer, - requestStream: false, - responseStream: false, - requestType: swapserverrpc_server_pb.ServerNewAddressRequest, - responseType: swapserverrpc_server_pb.ServerNewAddressResponse -}; - -StaticAddressServer.ServerWithdrawDeposits = { - methodName: "ServerWithdrawDeposits", - service: StaticAddressServer, - requestStream: false, - responseStream: false, - requestType: swapserverrpc_server_pb.ServerWithdrawRequest, - responseType: swapserverrpc_server_pb.ServerWithdrawResponse -}; - -exports.StaticAddressServer = StaticAddressServer; - -function StaticAddressServerClient(serviceHost, options) { - this.serviceHost = serviceHost; - this.options = options || {}; -} - -StaticAddressServerClient.prototype.serverNewAddress = function serverNewAddress(requestMessage, metadata, callback) { - if (arguments.length === 2) { - callback = arguments[1]; - } - var client = grpc.unary(StaticAddressServer.ServerNewAddress, { - request: requestMessage, - host: this.serviceHost, - metadata: metadata, - transport: this.options.transport, - debug: this.options.debug, - onEnd: function (response) { - if (callback) { - if (response.status !== grpc.Code.OK) { - var err = new Error(response.statusMessage); - err.code = response.status; - err.metadata = response.trailers; - callback(err, null); - } else { - callback(null, response.message); - } - } - } - }); - return { - cancel: function () { - callback = null; - client.close(); - } - }; -}; - -StaticAddressServerClient.prototype.serverWithdrawDeposits = function serverWithdrawDeposits(requestMessage, metadata, callback) { - if (arguments.length === 2) { - callback = arguments[1]; - } - var client = grpc.unary(StaticAddressServer.ServerWithdrawDeposits, { - request: requestMessage, - host: this.serviceHost, - metadata: metadata, - transport: this.options.transport, - debug: this.options.debug, - onEnd: function (response) { - if (callback) { - if (response.status !== grpc.Code.OK) { - var err = new Error(response.statusMessage); - err.code = response.status; - err.metadata = response.trailers; - callback(err, null); - } else { - callback(null, response.message); - } - } - } - }); - return { - cancel: function () { - callback = null; - client.close(); - } - }; -}; - -exports.StaticAddressServerClient = StaticAddressServerClient; - diff --git a/app/src/util/tests/sampleData.ts b/app/src/util/tests/sampleData.ts index 1dd8707cb..6dd8da4ba 100644 --- a/app/src/util/tests/sampleData.ts +++ b/app/src/util/tests/sampleData.ts @@ -74,6 +74,7 @@ export const lndGetNodeInfo: Required = { export const lndChannelBalance: LND.ChannelBalanceResponse.AsObject = { balance: '9990950', pendingOpenBalance: '0', + customChannelData: '', }; export const lndWalletBalance: LND.WalletBalanceResponse.AsObject = { @@ -132,6 +133,7 @@ export const lndChannel: LND.Channel.AsObject = { peerAlias: '', peerScidAlias: '', memo: 'test channel', + customChannelData: '', }; export const lndListChannelsMany: LND.ListChannelsResponse.AsObject = { @@ -172,6 +174,7 @@ export const lndPendingChannel: LND.PendingChannelsResponse.PendingChannel.AsObj chanStatusFlags: 'ChanStatusDefault', pb_private: false, memo: 'test channel', + customChannelData: '', }; export const lndPendingChannels: LND.PendingChannelsResponse.AsObject = { diff --git a/go.mod b/go.mod index 83c4f854c..a21ddd217 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,12 @@ module github.com/lightninglabs/lightning-terminal require ( - github.com/btcsuite/btcd v0.24.2 - github.com/btcsuite/btcd/btcec/v2 v2.3.3 + github.com/btcsuite/btcd v0.24.3-0.20240921052913-67b8efd3ba53 + github.com/btcsuite/btcd/btcec/v2 v2.3.4 github.com/btcsuite/btcd/btcutil v1.1.5 github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 - github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f - github.com/btcsuite/btcwallet/walletdb v1.4.2 + github.com/btcsuite/btclog v0.0.0-20241003133417-09c4e92e319c + github.com/btcsuite/btcwallet/walletdb v1.4.4 github.com/go-errors/errors v1.0.1 github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 github.com/improbable-eng/grpc-web v0.12.0 @@ -15,14 +15,15 @@ require ( github.com/lightninglabs/lightning-node-connect v0.3.2-alpha.0.20240822142323-ee4e7ff52f83 github.com/lightninglabs/lightning-terminal/autopilotserverrpc v0.0.1 github.com/lightninglabs/lightning-terminal/litrpc v1.0.0 - github.com/lightninglabs/lndclient v0.18.0-3 - github.com/lightninglabs/loop v0.28.8-beta.0.20241025130130-d5df72f56c8c - github.com/lightninglabs/loop/looprpc v1.0.0 - github.com/lightninglabs/loop/swapserverrpc v1.0.10 - github.com/lightninglabs/pool v0.6.5-beta.0.20240531084722-4000ec802aaa + github.com/lightninglabs/lndclient v0.18.4-9 + github.com/lightninglabs/loop v0.29.0-beta + github.com/lightninglabs/loop/looprpc v1.0.2 + github.com/lightninglabs/loop/swapserverrpc v1.0.11 + github.com/lightninglabs/pool v0.6.5-beta.0.20241015105339-044cb451b5df github.com/lightninglabs/pool/auctioneerrpc v1.1.2 - github.com/lightninglabs/taproot-assets v0.4.2-0.20240725155459-2bf18437e945 - github.com/lightningnetwork/lnd v0.18.3-beta + github.com/lightninglabs/pool/poolrpc v1.0.0 + github.com/lightninglabs/taproot-assets v0.5.0 + github.com/lightningnetwork/lnd v0.18.4-beta github.com/lightningnetwork/lnd/cert v1.2.2 github.com/lightningnetwork/lnd/kvdb v1.4.10 github.com/lightningnetwork/lnd/tlv v1.2.6 @@ -31,7 +32,7 @@ require ( github.com/mwitkow/grpc-proxy v0.0.0-20230212185441-f345521cb9c9 github.com/stretchr/testify v1.9.0 github.com/urfave/cli v1.22.9 - go.etcd.io/bbolt v1.3.8 + go.etcd.io/bbolt v1.3.11 golang.org/x/crypto v0.31.0 golang.org/x/net v0.27.0 golang.org/x/sync v0.10.0 @@ -42,7 +43,7 @@ require ( ) require ( - dario.cat/mergo v1.0.0 // indirect + dario.cat/mergo v1.0.1 // indirect github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect github.com/NebulousLabs/fastrand v0.0.0-20181203155948-6fb6489aac4e // indirect @@ -54,11 +55,11 @@ require ( github.com/andybalholm/brotli v1.0.4 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/btcsuite/btcd/btcutil/psbt v1.1.8 // indirect - github.com/btcsuite/btcwallet v0.16.10-0.20240718224643-db3a4a2543bd // indirect - github.com/btcsuite/btcwallet/wallet/txauthor v1.3.4 // indirect - github.com/btcsuite/btcwallet/wallet/txrules v1.2.1 // indirect - github.com/btcsuite/btcwallet/wallet/txsizes v1.2.4 // indirect - github.com/btcsuite/btcwallet/wtxmgr v1.5.3 // indirect + github.com/btcsuite/btcwallet v0.16.10-0.20240912233857-ffb143c77cc5 // indirect + github.com/btcsuite/btcwallet/wallet/txauthor v1.3.5 // indirect + github.com/btcsuite/btcwallet/wallet/txrules v1.2.2 // indirect + github.com/btcsuite/btcwallet/wallet/txsizes v1.2.5 // indirect + github.com/btcsuite/btcwallet/wtxmgr v1.5.4 // indirect github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd // indirect github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 // indirect github.com/btcsuite/winsvc v1.0.0 // indirect @@ -86,7 +87,7 @@ require ( github.com/fortytw2/leaktest v1.3.0 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect + github.com/go-viper/mapstructure/v2 v2.2.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v4 v4.5.1 // indirect github.com/golang-migrate/migrate/v4 v4.17.0 // indirect @@ -120,22 +121,22 @@ require ( github.com/jackpal/go-nat-pmp v0.0.0-20170405195558-28a68d0c24ad // indirect github.com/jedib0t/go-pretty/v6 v6.2.7 // indirect github.com/jonboulle/clockwork v0.2.2 // indirect - github.com/jrick/logrotate v1.0.0 // indirect + github.com/jrick/logrotate v1.1.2 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/juju/loggo v1.0.0 // indirect github.com/kkdai/bstream v1.0.0 // indirect - github.com/klauspost/compress v1.15.11 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/klauspost/cpuid/v2 v2.2.7 // indirect github.com/lib/pq v1.10.9 // indirect github.com/libdns/libdns v0.2.1 // indirect - github.com/lightninglabs/aperture v0.3.2-beta // indirect + github.com/lightninglabs/aperture v0.3.4-beta // indirect github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf // indirect github.com/lightninglabs/lightning-node-connect/hashmailrpc v1.0.2 // indirect github.com/lightninglabs/neutrino v0.16.1-0.20240425105051-602843d34ffd // indirect github.com/lightninglabs/neutrino/cache v1.1.2 // indirect github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb // indirect github.com/lightningnetwork/lnd/clock v1.1.1 // indirect - github.com/lightningnetwork/lnd/fn v1.2.0 // indirect + github.com/lightningnetwork/lnd/fn v1.2.3 // indirect github.com/lightningnetwork/lnd/healthcheck v1.2.5 // indirect github.com/lightningnetwork/lnd/queue v1.1.1 // indirect github.com/lightningnetwork/lnd/sqldb v1.0.4 // indirect @@ -158,7 +159,7 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_golang v1.14.0 // indirect - github.com/prometheus/client_model v0.3.0 // indirect + github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect @@ -189,12 +190,12 @@ require ( go.etcd.io/etcd/raft/v3 v3.5.12 // indirect go.etcd.io/etcd/server/v3 v3.5.12 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect - go.opentelemetry.io/otel v1.28.0 // indirect + go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 // indirect - go.opentelemetry.io/otel/metric v1.28.0 // indirect + go.opentelemetry.io/otel/metric v1.32.0 // indirect go.opentelemetry.io/otel/sdk v1.21.0 // indirect - go.opentelemetry.io/otel/trace v1.28.0 // indirect + go.opentelemetry.io/otel/trace v1.32.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/mock v0.4.0 // indirect @@ -222,6 +223,7 @@ require ( modernc.org/strutil v1.2.0 // indirect modernc.org/token v1.1.0 // indirect nhooyr.io/websocket v1.8.7 // indirect + pgregory.net/rapid v1.1.0 // indirect sigs.k8s.io/yaml v1.2.0 // indirect ) @@ -234,4 +236,4 @@ replace google.golang.org/protobuf => github.com/lightninglabs/protobuf-go-hex-d replace github.com/lightninglabs/lightning-terminal/litrpc => ./litrpc -go 1.22.3 +go 1.22.6 diff --git a/go.sum b/go.sum index 644515430..ed3de11a6 100644 --- a/go.sum +++ b/go.sum @@ -596,8 +596,8 @@ cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoIS cloud.google.com/go/workflows v1.8.0/go.mod h1:ysGhmEajwZxGn1OhGOGKsTXc5PyxOc0vfKf5Af+to4M= cloud.google.com/go/workflows v1.9.0/go.mod h1:ZGkj1aFIOd9c8Gerkjjq7OW7I5+l6cSvT3ujaO/WwSA= cloud.google.com/go/workflows v1.10.0/go.mod h1:fZ8LmRmZQWacon9UCX1r/g/DfAXx5VcPALq2CxzdePw= -dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= -dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= +dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s= +dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8= git.sr.ht/~sbinet/gg v0.3.1/go.mod h1:KGYtlADtqsqANL9ueOFkWymvzUvLMQllU5Ixo+8v3pc= @@ -651,12 +651,12 @@ github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd/go.mod h1:nm3Bko6zh6bWP60UxwoT5LzdGJsQJaPo6HjduXq9p6A= -github.com/btcsuite/btcd v0.24.2 h1:aLmxPguqxza+4ag8R1I2nnJjSu2iFn/kqtHTIImswcY= -github.com/btcsuite/btcd v0.24.2/go.mod h1:5C8ChTkl5ejr3WHj8tkQSCmydiMEPB0ZhQhehpq7Dgg= +github.com/btcsuite/btcd v0.24.3-0.20240921052913-67b8efd3ba53 h1:XOZ/wRGHkKv0AqxfDks5IkzaQ1Ge6fq322ZOOG5VIkU= +github.com/btcsuite/btcd v0.24.3-0.20240921052913-67b8efd3ba53/go.mod h1:zHK7t7sw8XbsCkD64WePHE3r3k9/XoGAcf6mXV14c64= github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA= github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= -github.com/btcsuite/btcd/btcec/v2 v2.3.3 h1:6+iXlDKE8RMtKsvK0gshlXIuPbyWM/h84Ensb7o3sC0= -github.com/btcsuite/btcd/btcec/v2 v2.3.3/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= +github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= +github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A= github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE= github.com/btcsuite/btcd/btcutil v1.1.5 h1:+wER79R5670vs/ZusMTF1yTcRYE5GUsFbdjdisflzM8= @@ -667,21 +667,22 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtyd github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6sjybR934QNHSJZPTQ= github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= +github.com/btcsuite/btclog v0.0.0-20241003133417-09c4e92e319c h1:4HxD1lBUGUddhzgaNgrCPsFWd7cGYNpeFUgd9ZIgyM0= +github.com/btcsuite/btclog v0.0.0-20241003133417-09c4e92e319c/go.mod h1:w7xnGOhwT3lmrS4H3b/D1XAXxvh+tbhUm8xeHN2y3TQ= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcwallet v0.16.10-0.20240718224643-db3a4a2543bd h1:QDb8foTCRoXrfoZVEzSYgSde16MJh4gCtCin8OCS0kI= -github.com/btcsuite/btcwallet v0.16.10-0.20240718224643-db3a4a2543bd/go.mod h1:X2xDre+j1QphTRo54y2TikUzeSvreL1t1aMXrD8Kc5A= -github.com/btcsuite/btcwallet/wallet/txauthor v1.3.4 h1:poyHFf7+5+RdxNp5r2T6IBRD7RyraUsYARYbp/7t4D8= -github.com/btcsuite/btcwallet/wallet/txauthor v1.3.4/go.mod h1:GETGDQuyq+VFfH1S/+/7slLM/9aNa4l7P4ejX6dJfb0= -github.com/btcsuite/btcwallet/wallet/txrules v1.2.1 h1:UZo7YRzdHbwhK7Rhv3PO9bXgTxiOH45edK5qdsdiatk= -github.com/btcsuite/btcwallet/wallet/txrules v1.2.1/go.mod h1:MVSqRkju/IGxImXYPfBkG65FgEZYA4fXchheILMVl8g= -github.com/btcsuite/btcwallet/wallet/txsizes v1.2.4 h1:nmcKAVTv/cmYrs0A4hbiC6Qw+WTLYy/14SmTt3mLnCo= -github.com/btcsuite/btcwallet/wallet/txsizes v1.2.4/go.mod h1:YqJR8WAAHiKIPesZTr9Cx9Az4fRhRLcJ6GcxzRUZCAc= -github.com/btcsuite/btcwallet/walletdb v1.4.2 h1:zwZZ+zaHo4mK+FAN6KeK85S3oOm+92x2avsHvFAhVBE= -github.com/btcsuite/btcwallet/walletdb v1.4.2/go.mod h1:7ZQ+BvOEre90YT7eSq8bLoxTsgXidUzA/mqbRS114CQ= -github.com/btcsuite/btcwallet/wtxmgr v1.5.3 h1:QrWCio9Leh3DwkWfp+A1SURj8pYn3JuTLv3waP5uEro= -github.com/btcsuite/btcwallet/wtxmgr v1.5.3/go.mod h1:M4nQpxGTXiDlSOODKXboXX7NFthmiBNjzAKKNS7Fhjg= +github.com/btcsuite/btcwallet v0.16.10-0.20240912233857-ffb143c77cc5 h1:zYy233eUBvkF3lq2MUkybEhxhDsrRDSgiToIKN57mtk= +github.com/btcsuite/btcwallet v0.16.10-0.20240912233857-ffb143c77cc5/go.mod h1:1HJXYbjJzgumlnxOC2+ViR1U+gnHWoOn7WeK5OfY1eU= +github.com/btcsuite/btcwallet/wallet/txauthor v1.3.5 h1:Rr0njWI3r341nhSPesKQ2JF+ugDSzdPoeckS75SeDZk= +github.com/btcsuite/btcwallet/wallet/txauthor v1.3.5/go.mod h1:+tXJ3Ym0nlQc/iHSwW1qzjmPs3ev+UVWMbGgfV1OZqU= +github.com/btcsuite/btcwallet/wallet/txrules v1.2.2 h1:YEO+Lx1ZJJAtdRrjuhXjWrYsmAk26wLTlNzxt2q0lhk= +github.com/btcsuite/btcwallet/wallet/txrules v1.2.2/go.mod h1:4v+grppsDpVn91SJv+mZT7B8hEV4nSmpREM4I8Uohws= +github.com/btcsuite/btcwallet/wallet/txsizes v1.2.5 h1:93o5Xz9dYepBP4RMFUc9RGIFXwqP2volSWRkYJFrNtI= +github.com/btcsuite/btcwallet/wallet/txsizes v1.2.5/go.mod h1:lQ+e9HxZ85QP7r3kdxItkiMSloSLg1PEGis5o5CXUQw= +github.com/btcsuite/btcwallet/walletdb v1.4.4 h1:BDel6iT/ltYSIYKs0YbjwnEDi7xR3yzABIsQxN2F1L8= +github.com/btcsuite/btcwallet/walletdb v1.4.4/go.mod h1:jk/hvpLFINF0C1kfTn0bfx2GbnFT+Nvnj6eblZALfjs= +github.com/btcsuite/btcwallet/wtxmgr v1.5.4 h1:hJjHy1h/dJwSfD9uDsCwcH21D1iOrus6OrI5gR9E/O0= +github.com/btcsuite/btcwallet/wtxmgr v1.5.4/go.mod h1:lAv0b1Vj9Ig5U8QFm0yiJ9WqPl8yGO/6l7JxdHY1PKE= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd h1:R/opQEbFEy9JGkIguV40SvRY1uliPX8ifOvi6ICsFCw= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/golangcrypto v0.0.0-20150304025918-53f62d9b43e8/go.mod h1:tYvUd8KLhm/oXvUeSEs2VlLghFjQt9+ZaF9ghH0JNjc= @@ -854,8 +855,8 @@ github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GO github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= -github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss= +github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= @@ -1081,8 +1082,9 @@ github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJS github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ= github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/jrick/logrotate v1.0.0 h1:lQ1bL/n9mBNeIXoTUoYRlK4dHuNJVofX9oWqBtPnSzI= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= +github.com/jrick/logrotate v1.1.2 h1:6ePk462NCX7TfKtNp5JJ7MbA2YIslkpfgP03TlTYMN0= +github.com/jrick/logrotate v1.1.2/go.mod h1:f9tdWggSVK3iqavGpyvegq5IhNois7KXmasU6/N96OQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -1115,8 +1117,8 @@ github.com/kkdai/bstream v1.0.0/go.mod h1:FDnDOHt5Yx4p3FaHcioFT0QjDOtgUpvjeZqAs+ github.com/klauspost/asmfmt v1.3.2/go.mod h1:AG8TuvYojzulgDAMCnYn50l/5QV3Bs/tp6j0HLHbNSE= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= -github.com/klauspost/compress v1.15.11 h1:Lcadnb3RKGin4FYM/orgq0qde+nc15E5Cbqg4B9Sx9c= -github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= @@ -1145,8 +1147,8 @@ github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libdns/libdns v0.2.1 h1:Wu59T7wSHRgtA0cfxC+n1c/e+O3upJGWytknkmFEDis= github.com/libdns/libdns v0.2.1/go.mod h1:yQCXzk1lEZmmCPa857bnk4TsOiqYasqpyOEeSObbb40= -github.com/lightninglabs/aperture v0.3.2-beta h1:J2GQwBmSHxpr5VOatXbgrTogF/qN2l6UWLPHfIowq10= -github.com/lightninglabs/aperture v0.3.2-beta/go.mod h1:M/5dPzHjHvuYXQuxzicqaGiCclHUvKW6N0ay1t/HGiM= +github.com/lightninglabs/aperture v0.3.4-beta h1:TiQHw1+2CdW785U88uH0BmwUmv0R7nyfvmF9neQd56o= +github.com/lightninglabs/aperture v0.3.4-beta/go.mod h1:xuusZUPdKzQN8wKT5yL2eML8To9nz+AXoRoQa/njd4Q= github.com/lightninglabs/faraday v0.2.13-alpha h1:rpk3IM5WyyEd/wghGWpGcUyDazQhwdfkuj+D/AvDlgk= github.com/lightninglabs/faraday v0.2.13-alpha/go.mod h1:hzuTMntsY7X3gxeBLZ6kYduZlKtXUgqtk1WnnEF0aIg= github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf h1:HZKvJUHlcXI/f/O0Avg7t8sqkPo78HFzjmeYFl6DPnc= @@ -1155,36 +1157,38 @@ github.com/lightninglabs/lightning-node-connect v0.3.2-alpha.0.20240822142323-ee github.com/lightninglabs/lightning-node-connect v0.3.2-alpha.0.20240822142323-ee4e7ff52f83/go.mod h1:+SasPOt0evcJdfApb/ALTaTz4x3a2/kWy5KqFoTpiX8= github.com/lightninglabs/lightning-node-connect/hashmailrpc v1.0.2 h1:Er1miPZD2XZwcfE4xoS5AILqP1mj7kqnhbBSxW9BDxY= github.com/lightninglabs/lightning-node-connect/hashmailrpc v1.0.2/go.mod h1:antQGRDRJiuyQF6l+k6NECCSImgCpwaZapATth2Chv4= -github.com/lightninglabs/lndclient v0.18.0-3 h1:2k5NZJgtrcJlW3KFhvtquS7CWwKwjFN9rtLNa8MlqRA= -github.com/lightninglabs/lndclient v0.18.0-3/go.mod h1:D/0qn5s0JSdB3Kelkw4vl3bqnuZ0IHHORAv9sJjYJcQ= -github.com/lightninglabs/loop v0.28.8-beta.0.20241025130130-d5df72f56c8c h1:DQqiAv0xUErCOVtUeVDXKTafJFRcN7Ce32Mu51Ah8Ew= -github.com/lightninglabs/loop v0.28.8-beta.0.20241025130130-d5df72f56c8c/go.mod h1:30wla2TOtMyJ17OhPu3XjXZOKwm9ZZr2cpjcCDvU3ko= -github.com/lightninglabs/loop/looprpc v1.0.0 h1:xry4QPCZShPww660xJm1BVcNFj8etgNeN2vMpfsv3c4= -github.com/lightninglabs/loop/looprpc v1.0.0/go.mod h1:+hPlWT2LGxEUY9mMVB2FcbV3KJmd1cmEezmZQagVUtY= -github.com/lightninglabs/loop/swapserverrpc v1.0.10 h1:ZLib2zUytlYOwCYOEyWUPJE16wyjR3UG0MmG/Kx/NUc= -github.com/lightninglabs/loop/swapserverrpc v1.0.10/go.mod h1:Ml3gMwe/iTRLvu1QGGZzXcr0DYSa9sJGwKPktLaWtwE= +github.com/lightninglabs/lndclient v0.18.4-9 h1:8PRBmJLyegs1zbqBvpN/0d8qGLiNst3MEtTdO4Wt+SA= +github.com/lightninglabs/lndclient v0.18.4-9/go.mod h1:11hKoRxXk+1IoIndEIvbmo18dwAJnTqr/lylRpYDVSU= +github.com/lightninglabs/loop v0.29.0-beta h1:YRxZ3h41LsFOLTyvisxbijmvCf5UOUx4T0YUemdi0wA= +github.com/lightninglabs/loop v0.29.0-beta/go.mod h1:Lc1qXyO0LoOHQVkzwxVlHTavybGGz0I1t5YozWH1WNo= +github.com/lightninglabs/loop/looprpc v1.0.2 h1:evL3GpceeFaYmkeqf4hzeXQXgjrHeF3fzcB5Eajh7SM= +github.com/lightninglabs/loop/looprpc v1.0.2/go.mod h1:w6zur9qV9EBY7I7bpnUYp0QGjVqNl9cjnozpPal9/XY= +github.com/lightninglabs/loop/swapserverrpc v1.0.11 h1:R/8c/bo4rpqm5/cfi944rj24oQUlZu+xXjzMhEDSkrc= +github.com/lightninglabs/loop/swapserverrpc v1.0.11/go.mod h1:Ml3gMwe/iTRLvu1QGGZzXcr0DYSa9sJGwKPktLaWtwE= github.com/lightninglabs/neutrino v0.16.1-0.20240425105051-602843d34ffd h1:D8aRocHpoCv43hL8egXEMYyPmyOiefFHZ66338KQB2s= github.com/lightninglabs/neutrino v0.16.1-0.20240425105051-602843d34ffd/go.mod h1:x3OmY2wsA18+Kc3TSV2QpSUewOCiscw2mKpXgZv2kZk= github.com/lightninglabs/neutrino/cache v1.1.2 h1:C9DY/DAPaPxbFC+xNNEI/z1SJY9GS3shmlu5hIQ798g= github.com/lightninglabs/neutrino/cache v1.1.2/go.mod h1:XJNcgdOw1LQnanGjw8Vj44CvguYA25IMKjWFZczwZuo= -github.com/lightninglabs/pool v0.6.5-beta.0.20240531084722-4000ec802aaa h1:UYqz8O8teeSU1383NLUMIADCD2QplOeJVjiB4k1xeSI= -github.com/lightninglabs/pool v0.6.5-beta.0.20240531084722-4000ec802aaa/go.mod h1:x2+mFwSvKlBqUES3z5TdoXolS2dWD1ksueRcMORyAJA= +github.com/lightninglabs/pool v0.6.5-beta.0.20241015105339-044cb451b5df h1:EdiN1GxUI+442K6xZcLg9mq/PekvRoSWUGuEKCjLDww= +github.com/lightninglabs/pool v0.6.5-beta.0.20241015105339-044cb451b5df/go.mod h1:ONyfvFj3e3D0AkhpTTZPGDuIDAcY2ODnlj86aDfs2q4= github.com/lightninglabs/pool/auctioneerrpc v1.1.2 h1:Dbg+9Z9jXnhimR27EN37foc4aB1uQqndm/YOO+XAdMA= github.com/lightninglabs/pool/auctioneerrpc v1.1.2/go.mod h1:1wKDzN2zEP8srOi0B9iySlEsPdoPhw6oo3Vbm1v4Mhw= +github.com/lightninglabs/pool/poolrpc v1.0.0 h1:vvosrgNx9WXF4mcHGqLjZOW8wNM0q+BLVfdn897AFLw= +github.com/lightninglabs/pool/poolrpc v1.0.0/go.mod h1:ZqpEpBFRMMBAerMmilEjh27tqauSXDwLaLR0O3jvmMA= github.com/lightninglabs/protobuf-go-hex-display v1.34.2-hex-display h1:w7FM5LH9Z6CpKxl13mS48idsu6F+cEZf0lkyiV+Dq9g= github.com/lightninglabs/protobuf-go-hex-display v1.34.2-hex-display/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= -github.com/lightninglabs/taproot-assets v0.4.2-0.20240725155459-2bf18437e945 h1:vzr2NtI1M9/LQDv7malP0EmV9vVkh2ve5ZpDUcYFC6s= -github.com/lightninglabs/taproot-assets v0.4.2-0.20240725155459-2bf18437e945/go.mod h1:+mGg1ZNFzzcb55ZLd1UulW4iiq+ruzRHOTjCKHBeQ2g= +github.com/lightninglabs/taproot-assets v0.5.0 h1:aXX08DsV9ObUCm5jAbUsd0B1llcAqQHVAfrxtRu+q7Q= +github.com/lightninglabs/taproot-assets v0.5.0/go.mod h1:7XEbJ8DZ79hkYUNuZceuynT6vGqDNdAn7l20knK9DfI= github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb h1:yfM05S8DXKhuCBp5qSMZdtSwvJ+GFzl94KbXMNB1JDY= github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb/go.mod h1:c0kvRShutpj3l6B9WtTsNTBUtjSmjZXbJd9ZBRQOSKI= -github.com/lightningnetwork/lnd v0.18.3-beta h1:I1Mcz79HGpVGPz0U2jSdxzzqzIi2cwUF0DXtzYJS7C8= -github.com/lightningnetwork/lnd v0.18.3-beta/go.mod h1:Xamph8AYM3iWyyn9w/tx+cLG6Tx1SSnSSPRFn71zuyQ= +github.com/lightningnetwork/lnd v0.18.4-beta h1:4pGmIjIMisrs4TMDYp4fk8NeI1YFpcuqwaSiFwLcd1g= +github.com/lightningnetwork/lnd v0.18.4-beta/go.mod h1:nPRQzLla5uHPQFyyZn8r9Vgddkd23PBUDa9rggEPOfY= github.com/lightningnetwork/lnd/cert v1.2.2 h1:71YK6hogeJtxSxw2teq3eGeuy4rHGKcFf0d0Uy4qBjI= github.com/lightningnetwork/lnd/cert v1.2.2/go.mod h1:jQmFn/Ez4zhDgq2hnYSw8r35bqGVxViXhX6Cd7HXM6U= github.com/lightningnetwork/lnd/clock v1.1.1 h1:OfR3/zcJd2RhH0RU+zX/77c0ZiOnIMsDIBjgjWdZgA0= github.com/lightningnetwork/lnd/clock v1.1.1/go.mod h1:mGnAhPyjYZQJmebS7aevElXKTFDuO+uNFFfMXK1W8xQ= -github.com/lightningnetwork/lnd/fn v1.2.0 h1:YTb2m8NN5ZiJAskHeBZAmR1AiPY8SXziIYPAX1VI/ZM= -github.com/lightningnetwork/lnd/fn v1.2.0/go.mod h1:SyFohpVrARPKH3XVAJZlXdVe+IwMYc4OMAvrDY32kw0= +github.com/lightningnetwork/lnd/fn v1.2.3 h1:Q1OrgNSgQynVheBNa16CsKVov1JI5N2AR6G07x9Mles= +github.com/lightningnetwork/lnd/fn v1.2.3/go.mod h1:SyFohpVrARPKH3XVAJZlXdVe+IwMYc4OMAvrDY32kw0= github.com/lightningnetwork/lnd/healthcheck v1.2.5 h1:aTJy5xeBpcWgRtW/PGBDe+LMQEmNm/HQewlQx2jt7OA= github.com/lightningnetwork/lnd/healthcheck v1.2.5/go.mod h1:G7Tst2tVvWo7cx6mSBEToQC5L1XOGxzZTPB29g9Rv2I= github.com/lightningnetwork/lnd/kvdb v1.4.10 h1:vK89IVv1oVH9ubQWU+EmoCQFeVRaC8kfmOrqHbY5zoY= @@ -1297,8 +1301,9 @@ github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1: github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= +github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= @@ -1407,8 +1412,8 @@ github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaD github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= gitlab.com/yawning/bsaes.git v0.0.0-20190805113838-0a714cd429ec h1:FpfFs4EhNehiVfzQttTuxanPIT43FtkkCFypIod8LHo= gitlab.com/yawning/bsaes.git v0.0.0-20190805113838-0a714cd429ec/go.mod h1:BZ1RAoRPbCxum9Grlv5aeksu2H8BiKehBYooU2LFiOQ= -go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= -go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= +go.etcd.io/bbolt v1.3.11 h1:yGEzV1wPz2yVCLsD8ZAiGHhHVlczyC9d1rP43/VCRJ0= +go.etcd.io/bbolt v1.3.11/go.mod h1:dksAq7YMXoljX0xu6VF5DMZGbhYYoLUalEiSySYAS4I= go.etcd.io/etcd/api/v3 v3.5.12 h1:W4sw5ZoU2Juc9gBWuLk5U6fHfNVyY1WC5g9uiXZio/c= go.etcd.io/etcd/api/v3 v3.5.12/go.mod h1:Ot+o0SWSyT6uHhA56al1oCED0JImsRiU9Dc26+C2a+4= go.etcd.io/etcd/client/pkg/v3 v3.5.12 h1:EYDL6pWwyOsylrQyLp2w+HkQ46ATiOvoEdMarindU2A= @@ -1433,20 +1438,20 @@ go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 h1:SpGay3w+nEwMpfVnbqOLH5gY52/foP8RE8UzTZ1pdSE= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1/go.mod h1:4UoMYEZOC0yN/sPGH76KPkkU7zgiEWYWL9vwmbnTJPE= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg= -go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= -go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.57.0 h1:DheMAlT6POBP+gh8RUH19EOTnQIor5QE0uSRPtzCpSw= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.57.0/go.mod h1:wZcGmeVO9nzP67aYSLDqXNWK87EZWhi7JWj1v7ZXf94= +go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= +go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 h1:DeFD0VgTZ+Cj6hxravYYZE2W4GlneVH81iAOPjZkzk8= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0/go.mod h1:GijYcYmNpX1KazD5JmWGsi4P7dDTTTnfv1UbGn84MnU= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 h1:gvmNvqrPYovvyRmCSygkUDyL8lC5Tl845MLEwqpxhEU= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0/go.mod h1:vNUq47TGFioo+ffTSnKNdob241vePmtNZnAODKapKd0= -go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= -go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= +go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= +go.opentelemetry.io/otel/metric v1.32.0/go.mod h1:jH7CIbbK6SH2V2wE16W05BHCtIDzauciCRLoc/SyMv8= go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= -go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= -go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= +go.opentelemetry.io/otel/trace v1.32.0 h1:WIC9mYrXf8TmY/EXuULKc8hR17vE+Hjv2cssQDe03fM= +go.opentelemetry.io/otel/trace v1.32.0/go.mod h1:+i4rkvCraA+tG6AzwloGaCtkx53Fa+L+V8e9a7YvhT8= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= @@ -2264,6 +2269,8 @@ modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= modernc.org/z v1.5.1/go.mod h1:eWFB510QWW5Th9YGZT81s+LwvaAs3Q2yr4sP0rmLkv8= nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g= nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= +pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= +pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= diff --git a/itest/litd_firewall_test.go b/itest/litd_firewall_test.go index 8923631d3..ee263b1f4 100644 --- a/itest/litd_firewall_test.go +++ b/itest/litd_firewall_test.go @@ -202,7 +202,7 @@ func testFirewallRules(ctx context.Context, net *NetworkHarness, resp, err := net.Alice.GetInfo(ctx, &lnrpc.GetInfoRequest{}) require.NoError(t.t, err) require.NotEmpty(t.t, resp.Alias) - require.Contains(t.t, resp.Alias, "0") + require.Contains(t.t, resp.Alias, "Alice") // Open a channel between Alice and Bob so that we have something to // query later. diff --git a/itest/litd_mode_integrated_test.go b/itest/litd_mode_integrated_test.go index 50fda9318..65af53aa8 100644 --- a/itest/litd_mode_integrated_test.go +++ b/itest/litd_mode_integrated_test.go @@ -478,7 +478,7 @@ func integratedTestSuite(ctx context.Context, net *NetworkHarness, t *testing.T, resp, err := net.Alice.GetInfo(ctx, &lnrpc.GetInfoRequest{}) require.NoError(t, err) require.NotEmpty(t, resp.Alias) - require.Contains(t, resp.Alias, "0") + require.Contains(t, resp.Alias, "Alice") t.Run("certificate check", func(tt *testing.T) { runCertificateCheck(tt, net.Alice) diff --git a/itest/litd_node.go b/itest/litd_node.go index 76544959d..618ae17e1 100644 --- a/itest/litd_node.go +++ b/itest/litd_node.go @@ -150,7 +150,7 @@ func (l *litArgs) getArg(name string) (string, bool) { } // toArgList converts the litArgs map to an arguments string slice. -func (l *litArgs) toArgList() []string { +func (l *litArgs) toArgList(nodeName string) []string { l.mu.Lock() defer l.mu.Unlock() @@ -164,7 +164,7 @@ func (l *litArgs) toArgList() []string { args = append(args, fmt.Sprintf("--%s=%s", arg, setting)) } - return args + return append([]string{"--lnd.alias=" + nodeName}, args...) } // LitArgOption defines the signature of a functional option that can be used @@ -197,7 +197,7 @@ func (cfg *LitNodeConfig) GenArgs(opts ...LitArgOption) []string { cfg.ActiveArgs = args - return args.toArgList() + return args.toArgList(cfg.Name) } // defaultLitArgs generates the default arguments to be used with a Litd node. @@ -216,6 +216,7 @@ func (cfg *LitNodeConfig) defaultLitdArgs() *litArgs { "enablerest": "", "restcors": "*", "lnd.debuglevel": "trace,GRPC=error,PEER=info", + "lndconnectinterval": "200ms", } ) for _, arg := range cfg.LitArgs { diff --git a/itest/network_harness.go b/itest/network_harness.go index 9f72e48f6..271163441 100644 --- a/itest/network_harness.go +++ b/itest/network_harness.go @@ -285,11 +285,14 @@ func (n *NetworkHarness) litArgs() []string { // NewNode initializes a new HarnessNode. func (n *NetworkHarness) NewNode(t *testing.T, name string, extraArgs []string, - remoteMode bool, wait bool) (*HarnessNode, error) { + remoteMode bool, wait bool, additionalLitArgs ...string) (*HarnessNode, + error) { + + allLitArgs := append(n.litArgs(), additionalLitArgs...) return n.newNode( - t, name, extraArgs, n.litArgs(), false, remoteMode, nil, - wait, false, + t, name, extraArgs, allLitArgs, false, remoteMode, nil, wait, + false, ) } @@ -1048,7 +1051,9 @@ func (n *NetworkHarness) CloseChannel(lnNode *HarnessNode, err = wait.NoError(func() error { closeReq := &lnrpc.CloseChannelRequest{ - ChannelPoint: cp, Force: force, + ChannelPoint: cp, + Force: force, + SatPerVbyte: 5, } closeRespStream, err = lnNode.CloseChannel(ctx, closeReq) if err != nil { @@ -1076,7 +1081,7 @@ func (n *NetworkHarness) CloseChannel(lnNode *HarnessNode, return fmt.Errorf("unable to decode closeTxid: "+ "%v", err) } - n.LNDHarness.Miner().AssertTxInMempool(closeTxid) + n.LNDHarness.Miner().AssertTxInMempool(*closeTxid) return nil }, wait.ChannelCloseTimeout) diff --git a/proto/lnd.proto b/proto/lnd.proto index a02fdde65..95ee5ae73 100644 --- a/proto/lnd.proto +++ b/proto/lnd.proto @@ -1388,8 +1388,14 @@ enum CommitmentType { A channel that uses musig2 for the funding output, and the new tapscript features where relevant. */ - // TODO(roasbeef): need script enforce mirror type for the above as well? SIMPLE_TAPROOT = 5; + + /* + Identical to the SIMPLE_TAPROOT channel type, but with extra functionality. + This channel type also commits to additional meta data in the tapscript + leaves for the scripts in a channel. + */ + SIMPLE_TAPROOT_OVERLAY = 6; } message ChannelConstraints { @@ -1592,6 +1598,11 @@ message Channel { the channel's operation. */ string memo = 36; + + /* + Custom channel data that might be populated in custom channels. + */ + bytes custom_channel_data = 37; } message ListChannelsRequest { @@ -2028,10 +2039,38 @@ message ChannelOpenUpdate { ChannelPoint channel_point = 1; } +message CloseOutput { + // The amount in satoshi of this close output. This amount is the final + // commitment balance of the channel and the actual amount paid out on chain + // might be smaller due to subtracted fees. + int64 amount_sat = 1 [jstype = JS_STRING]; + + // The pkScript of the close output. + bytes pk_script = 2; + + // Whether this output is for the local or remote node. + bool is_local = 3; + + // The TLV encoded custom channel data records for this output, which might + // be set for custom channels. + bytes custom_channel_data = 4; +} + message ChannelCloseUpdate { bytes closing_txid = 1; bool success = 2; + + // The local channel close output. If the local channel balance was dust to + // begin with, this output will not be set. + CloseOutput local_close_output = 3; + + // The remote channel close output. If the remote channel balance was dust + // to begin with, this output will not be set. + CloseOutput remote_close_output = 4; + + // Any additional outputs that might be added for custom channel types. + repeated CloseOutput additional_outputs = 5; } message CloseChannelRequest { @@ -2709,6 +2748,11 @@ message PendingChannelsResponse { impacts the channel's operation. */ string memo = 13; + + /* + Custom channel data that might be populated in custom channels. + */ + bytes custom_channel_data = 34; } message PendingOpenChannel { @@ -2968,6 +3012,12 @@ message ChannelBalanceResponse { // Sum of channels pending remote balances. Amount pending_open_remote_balance = 8; + + /* + Custom channel data that might be populated if there are custom channels + present. + */ + bytes custom_channel_data = 9; } message QueryRoutesRequest { @@ -3293,6 +3343,20 @@ message Route { The total amount in millisatoshis. */ int64 total_amt_msat = 6 [jstype = JS_STRING]; + + /* + The actual on-chain amount that was sent out to the first hop. This value is + only different from the total_amt_msat field if this is a custom channel + payment and the value transported in the HTLC is different from the BTC + amount in the HTLC. If this value is zero, then this is an old payment that + didn't have this value yet and can be ignored. + */ + int64 first_hop_amount_msat = 7 [jstype = JS_STRING]; + + /* + Custom channel data that might be populated in custom channels. + */ + bytes custom_channel_data = 8; } message NodeInfoRequest { @@ -3922,6 +3986,11 @@ message InvoiceHTLC { // Details relevant to AMP HTLCs, only populated if this is an AMP HTLC. AMP amp = 11; + + /* + Custom channel data that might be populated in custom channels. + */ + bytes custom_channel_data = 12; } // Details specific to AMP HTLCs. @@ -4162,6 +4231,12 @@ message Payment { uint64 payment_index = 15 [jstype = JS_STRING]; PaymentFailureReason failure_reason = 16; + + /* + The custom TLV records that were sent to the first hop as part of the HTLC + wire message for this payment. + */ + map first_hop_custom_records = 17; } message HTLCAttempt { diff --git a/proto/loop.proto b/proto/loop.proto index 57254f94b..c1c7cdd9c 100644 --- a/proto/loop.proto +++ b/proto/loop.proto @@ -89,6 +89,12 @@ service SwapClient { */ rpc GetLsatTokens (TokensRequest) returns (TokensResponse); + /* loop: `fetchl402` + FetchL402Token fetches an L402 token from the server, this is required in + order to receive reservation notifications from the server. + */ + rpc FetchL402Token (FetchL402TokenRequest) returns (FetchL402TokenResponse); + /* loop: `getinfo` GetInfo gets basic information about the loop daemon. */ @@ -143,6 +149,51 @@ service SwapClient { */ rpc ListInstantOuts (ListInstantOutsRequest) returns (ListInstantOutsResponse); + + /* loop: `static newstaticaddress` + NewStaticAddress requests a new static address for loop-ins from the server. + */ + rpc NewStaticAddress (NewStaticAddressRequest) + returns (NewStaticAddressResponse); + + /* loop: `static listunspentdeposits` + ListUnspentDeposits returns a list of utxos deposited at a static address. + */ + rpc ListUnspentDeposits (ListUnspentDepositsRequest) + returns (ListUnspentDepositsResponse); + + /* loop:`static withdraw` + WithdrawDeposits withdraws a selection or all deposits of a static address. + */ + rpc WithdrawDeposits (WithdrawDepositsRequest) + returns (WithdrawDepositsResponse); + + /* loop:`listdeposits` + ListStaticAddressDeposits returns a list of filtered static address + deposits. + */ + rpc ListStaticAddressDeposits (ListStaticAddressDepositsRequest) + returns (ListStaticAddressDepositsResponse); + + /* loop:`listswaps` + ListStaticAddressSwaps returns a list of filtered static address + swaps. + */ + rpc ListStaticAddressSwaps (ListStaticAddressSwapsRequest) + returns (ListStaticAddressSwapsResponse); + + /* loop:`static summary` + GetStaticAddressSummary returns a summary of static address related + statistics. + */ + rpc GetStaticAddressSummary (StaticAddressSummaryRequest) + returns (StaticAddressSummaryResponse); + + /* loop:`static` + StaticAddressLoopIn initiates a static address loop-in swap. + */ + rpc StaticAddressLoopIn (StaticAddressLoopInRequest) + returns (StaticAddressLoopInResponse); } message LoopOutRequest { @@ -735,6 +786,13 @@ message QuoteRequest { probing and payment. */ bool private = 7; + + /* + Static address deposit outpoints that will be quoted for. This option only + pertains to loop in swaps. Either this or the amt parameter can be set at + the same time. + */ + repeated string deposit_outpoints = 8; } message InQuoteResponse { @@ -830,6 +888,12 @@ message TokensResponse { repeated L402Token tokens = 1; } +message FetchL402TokenRequest { +} + +message FetchL402TokenResponse { +} + message L402Token { /* The base macaroon that was baked by the auth server. @@ -1326,20 +1390,24 @@ message ClientReservation { The state the reservation is in. */ string state = 2; + /* - The amount that the reservation is for. + The amount that the reservation is for. */ uint64 amount = 3 [jstype = JS_STRING]; + /* - The transaction id of the reservation. + The transaction id of the reservation. */ string tx_id = 4; + /* - The vout of the reservation. + The vout of the reservation. */ uint32 vout = 5; + /* - The expiry of the reservation. + The expiry of the reservation. */ uint32 expiry = 6; } @@ -1369,10 +1437,12 @@ message InstantOutResponse { The hash of the swap preimage. */ bytes instant_out_hash = 1; + /* The transaction id of the sweep transaction. */ string sweep_tx_id = 2; + /* The state of the swap. */ @@ -1440,3 +1510,493 @@ message InstantOut { */ string sweep_tx_id = 5; } + +message NewStaticAddressRequest { + /* + The client's public key for the 2-of-2 MuSig2 taproot static address. + */ + bytes client_key = 1; +} + +message NewStaticAddressResponse { + /* + The taproot static address. + */ + string address = 1; + + /* + The CSV expiry of the static address. + */ + uint32 expiry = 2; +} + +message ListUnspentDepositsRequest { + /* + The number of minimum confirmations a utxo must have to be listed. + */ + int32 min_confs = 1; + + /* + The number of maximum confirmations a utxo may have to be listed. A zero + value indicates that there is no maximum. + */ + int32 max_confs = 2; +} + +message ListUnspentDepositsResponse { + /* + A list of utxos behind the static address. + */ + repeated Utxo utxos = 1; +} + +message Utxo { + /* + The static address of the utxo. + */ + string static_address = 1; + + /* + The value of the unspent coin in satoshis. + */ + int64 amount_sat = 2 [jstype = JS_STRING]; + + /* + The outpoint in the form txid:index. + */ + string outpoint = 3; + + /* + The number of confirmations for the Utxo. + */ + int64 confirmations = 4 [jstype = JS_STRING]; +} + +message WithdrawDepositsRequest { + /* + The outpoints of the deposits to withdraw. + */ + repeated OutPoint outpoints = 1; + + /* + If set to true, all deposits will be withdrawn. + */ + bool all = 2; + + /* + The address to withdraw the funds to. + */ + string dest_addr = 3; + + /* + The fee rate in sat/vbyte to use for the withdrawal transaction. + */ + int64 sat_per_vbyte = 4 [jstype = JS_STRING]; +} + +message WithdrawDepositsResponse { + /* + The transaction hash of the withdrawal transaction. + */ + string withdrawal_tx_hash = 1; + + /* + The pkscript of the withdrawal transaction. + */ + string pk_script = 2; +} + +message OutPoint { + /* + Raw bytes representing the transaction id. + */ + bytes txid_bytes = 1; + + /* + Reversed, hex-encoded string representing the transaction id. + */ + string txid_str = 2; + + /* + The index of the output on the transaction. + */ + uint32 output_index = 3; +} + +message ListStaticAddressDepositsRequest { + /* + Filters the list of all stored deposits by deposit state. + */ + DepositState state_filter = 1; + + /* + Filters the list of all stored deposits by the outpoint. + */ + repeated string outpoints = 2; +} + +message ListStaticAddressDepositsResponse { + /* + A list of all deposits that match the filtered state. + */ + repeated Deposit filtered_deposits = 1; +} + +message ListStaticAddressSwapsRequest { +} + +message ListStaticAddressSwapsResponse { + /* + A list of all swaps known static address loop-in swaps. + */ + repeated StaticAddressLoopInSwap swaps = 1; +} + +message StaticAddressSummaryRequest { +} + +message StaticAddressSummaryResponse { + /* + The static address of the client. + */ + string static_address = 1; + + /* + The CSV expiry of the static address. + */ + uint64 relative_expiry_blocks = 2 [jstype = JS_STRING]; + + /* + The total number of deposits. + */ + uint32 total_num_deposits = 3; + + /* + The total value of unconfirmed deposits. + */ + int64 value_unconfirmed_satoshis = 4 [jstype = JS_STRING]; + + /* + The total value of confirmed deposits. + */ + int64 value_deposited_satoshis = 5 [jstype = JS_STRING]; + + /* + The total value of all expired deposits. + */ + int64 value_expired_satoshis = 6 [jstype = JS_STRING]; + + /* + The total value of all deposits that have been withdrawn. + */ + int64 value_withdrawn_satoshis = 7 [jstype = JS_STRING]; + + /* + The total value of all loop-ins that have been finalized. + */ + int64 value_looped_in_satoshis = 8 [jstype = JS_STRING]; + + /* + The total value of all htlc timeout sweeps that the client swept. + */ + int64 value_htlc_timeout_sweeps_satoshis = 9 [jstype = JS_STRING]; +} + +enum DepositState { + /* + UNKNOWN_STATE is the default state of a deposit. + */ + UNKNOWN_STATE = 0; + + /* + DEPOSITED indicates that the deposit has been sufficiently confirmed on + chain. + */ + DEPOSITED = 1; + + /* + WITHDRAWING indicates that the deposit is currently being withdrawn. It + flips to WITHDRAWN once the withdrawal transaction has been sufficiently + confirmed. + */ + WITHDRAWING = 2; + + /* + WITHDRAWN indicates that the deposit has been withdrawn. + */ + WITHDRAWN = 3; + + /* + LOOPING_IN indicates that the deposit is currently being used in a static + address loop-in swap. + */ + LOOPING_IN = 4; + + /* + LOOPED_IN indicates that the deposit was used in a static address loop-in + swap. + */ + LOOPED_IN = 5; + + /* + SWEEP_HTLC_TIMEOUT indicates that the deposit is part of an active loop-in + of which the respective htlc was published by the server and the timeout + path has opened up for the client to sweep. + */ + SWEEP_HTLC_TIMEOUT = 6; + + /* + HTLC_TIMEOUT_SWEPT indicates that the timeout path of the htlc has been + swept by the client. + */ + HTLC_TIMEOUT_SWEPT = 7; + + /* + PUBLISH_EXPIRED indicates that the deposit has expired and the sweep + transaction has been published. + */ + PUBLISH_EXPIRED = 8; + + /* + WAIT_FOR_EXPIRY_SWEEP indicates that the deposit has expired and the sweep + transaction has not yet been sufficiently confirmed. + */ + WAIT_FOR_EXPIRY_SWEEP = 9; + + /* + EXPIRED indicates that the deposit has expired and the sweep transaction + has been sufficiently confirmed. + */ + EXPIRED = 10; +} + +message Deposit { + /* + The identifier of the deposit. + */ + bytes id = 1; + + /* + The state of the deposit. + */ + DepositState state = 2; + + /* + The outpoint of the deposit in format txid:index. + */ + string outpoint = 3; + + /* + The value of the deposit in satoshis. + */ + int64 value = 4 [jstype = JS_STRING]; + + /* + The block height at which the deposit was confirmed. + */ + int64 confirmation_height = 5 [jstype = JS_STRING]; + + /* + The number of blocks that are left until the deposit cannot be used for a + loop-in swap anymore. + */ + int64 blocks_until_expiry = 6 [jstype = JS_STRING]; +} + +message StaticAddressLoopInSwap { + /* + The swap hash of the swap. It represents the unique identifier of the swap. + */ + bytes swap_hash = 1; + + /* + */ + repeated string deposit_outpoints = 2; + + /* + */ + StaticAddressLoopInSwapState state = 3; + + /* + The swap amount of the swap. It is the sum of the values of the deposit + outpoints that were used for this swap. + */ + int64 swap_amount_satoshis = 4 [jstype = JS_STRING]; + + /* + The invoiced swap amount. It is the swap amount minus the quoted server + fees. + */ + int64 payment_request_amount_satoshis = 5 [jstype = JS_STRING]; +} + +enum StaticAddressLoopInSwapState { + /* + */ + UNKNOWN_STATIC_ADDRESS_SWAP_STATE = 0; + + /* + */ + INIT_HTLC = 1; + + /* + */ + SIGN_HTLC_TX = 2; + + /* + */ + MONITOR_INVOICE_HTLC_TX = 3; + + /* + */ + PAYMENT_RECEIVED = 4; + + /* + */ + SWEEP_STATIC_ADDRESS_HTLC_TIMEOUT = 5; + + /* + */ + MONITOR_HTLC_TIMEOUT_SWEEP = 6; + + /* + */ + HTLC_STATIC_ADDRESS_TIMEOUT_SWEPT = 7; + + /* + */ + SUCCEEDED = 8; + + /* + */ + SUCCEEDED_TRANSITIONING_FAILED = 9; + + /* + */ + UNLOCK_DEPOSITS = 10; + + /* + */ + FAILED_STATIC_ADDRESS_SWAP = 11; +} + +message StaticAddressLoopInRequest { + /* + The outpoints of the deposits to loop-in. + */ + repeated string outpoints = 1; + + /* + Maximum satoshis we are willing to pay the server for the swap. This value + is not disclosed in the swap initiation call, but if the server asks for a + higher fee, we abort the swap. Typically this value is taken from the + response of the GetQuote call. + */ + int64 max_swap_fee_satoshis = 2 [jstype = JS_STRING]; + + /* + Optionally the client can specify the last hop pubkey when requesting a + loop-in quote. This is useful to get better off-chain routing fee from the + server. + */ + bytes last_hop = 3; + + /* + An optional label for this swap. This field is limited to 500 characters and + may not be one of the reserved values in loop/labels Reserved list. + */ + string label = 4; + + /* + An optional identification string that will be appended to the user agent + string sent to the server to give information about the usage of loop. This + initiator part is meant for user interfaces to add their name to give the + full picture of the binary used (loopd, LiT) and the method used for + triggering the swap (loop CLI, autolooper, LiT UI, other 3rd party UI). + */ + string initiator = 5; + + /* + Optional route hints to reach the destination through private channels. + */ + repeated looprpc.RouteHint route_hints = 6; + + /* + Private indicates whether the destination node should be considered private. + In which case, loop will generate hop hints to assist with probing and + payment. + */ + bool private = 7; + + /* + The swap payment timeout allows the user to specify an upper limit for the + amount of time the server is allowed to take to fulfill the off-chain swap + payment. If the timeout is reached the swap will be aborted on the server + side and the client can retry the swap with different parameters. + */ + uint32 payment_timeout_seconds = 8; +} + +message StaticAddressLoopInResponse { + /* + The swap hash that identifies this swap. + */ + bytes swap_hash = 1; + + /* + The state the swap is in. + */ + string state = 2; + + /* + The amount of the swap. + */ + uint64 amount = 3 [jstype = JS_STRING]; + + /* + The htlc cltv expiry height of the swap. + */ + int32 htlc_cltv = 4; + + /* + The quoted swap fee in satoshis. + */ + int64 quoted_swap_fee_satoshis = 5 [jstype = JS_STRING]; + + /* + The maximum total swap fee the client is willing to pay for the swap. + */ + int64 max_swap_fee_satoshis = 6 [jstype = JS_STRING]; + + /* + The block height at which the swap was initiated. + */ + uint32 initiation_height = 7; + + /* + The static address protocol version. + */ + string protocol_version = 8; + + /* + An optional label for this swap. + */ + string label = 9; + + /* + An optional identification string that will be appended to the user agent + string sent to the server to give information about the usage of loop. This + initiator part is meant for user interfaces to add their name to give the + full picture of the binary used (loopd, LiT) and the method used for + triggering the swap (loop CLI, autolooper, LiT UI, other 3rd party UI). + */ + string initiator = 10; + + /* + The swap payment timeout allows the user to specify an upper limit for the + amount of time the server is allowed to take to fulfill the off-chain swap + payment. If the timeout is reached the swap will be aborted on the server + side and the client can retry the swap with different parameters. + */ + uint32 payment_timeout_seconds = 11; +} diff --git a/proto/swapserverrpc/server.proto b/proto/swapserverrpc/server.proto index 57a3140e6..fec99ecd0 100644 --- a/proto/swapserverrpc/server.proto +++ b/proto/swapserverrpc/server.proto @@ -289,11 +289,10 @@ message ServerLoopInQuoteRequest { // litd/v0.2.0-alpha/commit=326d754 string user_agent = 6; - // If this is a quote request for a static address loop in, this value - // defines the number of static address deposits that the client wants to - // quote for. The amount of the quote reflects the sum of all deposits. The - // number of deposits here is taken into consideration for the total swap - // fee. + // The number of static address deposits the client wants to quote for. + // If the number of deposits exceeds one the server will apply a per-input + // service fee. This is to cover for the increased on-chain fee the server + // has to pay when the sweeping transaction is broadcast. uint32 num_static_address_deposits = 7; } @@ -668,69 +667,23 @@ message SubscribeNotificationsRequest { message SubscribeNotificationsResponse { oneof notification { ServerReservationNotification reservation_notification = 1; + ServerStaticLoopInSweepNotification static_loop_in_sweep = 2; } } -// StaticAddressProtocolVersion represents the static address protocol version -// the client adheres to. -enum StaticAddressProtocolVersion { - // V0 is the initially released static address protocol version. - V0 = 0; -} - -service StaticAddressServer { - // ServerNewAddress generates a new static address for the client to use. - // The server will generate the address and return the server key and the - // address's CSV expiry. - rpc ServerNewAddress (ServerNewAddressRequest) - returns (ServerNewAddressResponse); - - // ServerWithdrawDeposits allows to cooperatively sweep deposits that - // haven't timed out yet to the client's wallet. The server will generate - // the partial sigs for the client's selected deposits. - rpc ServerWithdrawDeposits (ServerWithdrawRequest) - returns (ServerWithdrawResponse); -} - -message ServerNewAddressRequest { - // The protocol version that the client adheres to. - StaticAddressProtocolVersion protocol_version = 1; - - // The client key for the MuSig2 static address output. - bytes client_key = 2; -} - -message ServerNewAddressResponse { - ServerAddressParameters params = 1; -} +// ServerStaticLoopInSweepNotification is a request from the server to the +// client to cosign a transaction that contains deposits from a finished static +// loop ins. +message ServerStaticLoopInSweepNotification { + // The psbt of the sweep transaction. + bytes sweep_tx_psbt = 1; -message ServerAddressParameters { - // The server key for the MuSig2 static address output. - bytes server_key = 1; - - // The CSV expiry of the static address output. - uint32 expiry = 2; -} - -message ServerWithdrawRequest { - // The deposit outpoints the client wishes to close. - repeated PrevoutInfo outpoints = 1; - - // The nonces that the client used to generate the coop close tx sigs. - repeated bytes client_nonces = 2; - - // The address that the client wants to sweep the static address deposits - // to. - string client_sweep_addr = 3; - - // The fee rate in sat/kw that the client wants to use for the sweep. - uint64 tx_fee_rate = 4 [jstype = JS_STRING]; -} + // The swap hash the deposits are associated with. + bytes swap_hash = 2; -message ServerWithdrawResponse { - // The sweep sigs that the server generated for the htlc. - repeated bytes musig2_sweep_sigs = 1; + // The map of deposit txid:idx to the nonce used by the server. + map deposit_to_nonces = 3; - // The nonces that the server used to generate the sweepless sweep sigs. - repeated bytes server_nonces = 2; + // The prevout information of the sweep txn. + repeated PrevoutInfo prevout_info = 4; } diff --git a/subservers/taproot-assets.go b/subservers/taproot-assets.go index fc45a70ad..6c6a15fcc 100644 --- a/subservers/taproot-assets.go +++ b/subservers/taproot-assets.go @@ -103,9 +103,10 @@ func (t *taprootAssetsSubServer) Start(_ lnrpc.LightningClient, return err } - // The taproot asset channel feature is still experimental, so we - // disable it for now. - const enableChannelFeatures = false + // If we're being called here, it means tapd is running in integrated + // mode. But we can only offer Taproot Asset channel functionality if + // lnd is also running in integrated mode. + enableChannelFeatures := !t.lndRemote err = tapcfg.ConfigureSubServer( t.Server, t.cfg, log, &lndGrpc.LndServices, diff --git a/terminal.go b/terminal.go index 88a7d3f1f..ac698518d 100644 --- a/terminal.go +++ b/terminal.go @@ -1284,14 +1284,15 @@ func (g *LightningTerminal) Permissions() map[string][]bakery.Op { // // NOTE: This is part of the lnd.WalletConfigBuilder interface. func (g *LightningTerminal) BuildWalletConfig(ctx context.Context, - dbs *lnd.DatabaseInstances, interceptorChain *rpcperms.InterceptorChain, + dbs *lnd.DatabaseInstances, auxComponents *lnd.AuxComponents, + interceptorChain *rpcperms.InterceptorChain, grpcListeners []*lnd.ListenerWithSignal) (*chainreg.PartialChainControl, *btcwallet.Config, func(), error) { g.lndInterceptorChain = interceptorChain return g.defaultImplCfg.WalletConfigBuilder.BuildWalletConfig( - ctx, dbs, interceptorChain, grpcListeners, + ctx, dbs, auxComponents, interceptorChain, grpcListeners, ) } From 57c40e5ad813fb6bec3be0f4d0d7bfc7bec9daf6 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Thu, 23 May 2024 13:52:28 +0200 Subject: [PATCH 02/10] subservers: add Impl to subservers, GetServer to mgr --- subservers/faraday.go | 11 +++++++++++ subservers/interface.go | 5 +++++ subservers/loop.go | 11 +++++++++++ subservers/manager.go | 13 +++++++++++++ subservers/pool.go | 11 +++++++++++ subservers/taproot-assets.go | 25 +++++++++++++++++++++++++ 6 files changed, 76 insertions(+) diff --git a/subservers/faraday.go b/subservers/faraday.go index 9b9efd8e3..9b8498ffa 100644 --- a/subservers/faraday.go +++ b/subservers/faraday.go @@ -9,6 +9,7 @@ import ( "github.com/lightninglabs/faraday/frdrpcserver" "github.com/lightninglabs/faraday/frdrpcserver/perms" "github.com/lightninglabs/lndclient" + "github.com/lightninglabs/taproot-assets/fn" "github.com/lightningnetwork/lnd/lnrpc" "google.golang.org/grpc" "gopkg.in/macaroon-bakery.v2/bakery" @@ -126,3 +127,13 @@ func (f *faradaySubServer) Permissions() map[string][]bakery.Op { func (f *faradaySubServer) WhiteListedURLs() map[string]struct{} { return nil } + +// Impl returns the actual implementation of the sub-server. This might not be +// set if the sub-server is running in remote mode. +func (f *faradaySubServer) Impl() fn.Option[any] { + if f.RPCServer == nil { + return fn.None[any]() + } + + return fn.Some[any](f.RPCServer) +} diff --git a/subservers/interface.go b/subservers/interface.go index cc7ed5051..4ff0083cf 100644 --- a/subservers/interface.go +++ b/subservers/interface.go @@ -5,6 +5,7 @@ import ( restProxy "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/lightninglabs/lndclient" + "github.com/lightninglabs/taproot-assets/fn" "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/macaroons" "google.golang.org/grpc" @@ -62,4 +63,8 @@ type SubServer interface { // WhiteListedURLs returns a map of all the sub-server's URLs that can // be accessed without a macaroon. WhiteListedURLs() map[string]struct{} + + // Impl returns the actual implementation of the sub-server. This might + // not be set if the sub-server is running in remote mode. + Impl() fn.Option[any] } diff --git a/subservers/loop.go b/subservers/loop.go index 4281125fb..8a405eb18 100644 --- a/subservers/loop.go +++ b/subservers/loop.go @@ -9,6 +9,7 @@ import ( "github.com/lightninglabs/loop/loopd" "github.com/lightninglabs/loop/loopd/perms" "github.com/lightninglabs/loop/looprpc" + "github.com/lightninglabs/taproot-assets/fn" "github.com/lightningnetwork/lnd/lnrpc" "google.golang.org/grpc" "gopkg.in/macaroon-bakery.v2/bakery" @@ -136,3 +137,13 @@ func (l *loopSubServer) Permissions() map[string][]bakery.Op { func (l *loopSubServer) WhiteListedURLs() map[string]struct{} { return nil } + +// Impl returns the actual implementation of the sub-server. This might not be +// set if the sub-server is running in remote mode. +func (l *loopSubServer) Impl() fn.Option[any] { + if l.Daemon == nil { + return fn.None[any]() + } + + return fn.Some[any](l.Daemon) +} diff --git a/subservers/manager.go b/subservers/manager.go index e81595174..8d9f6b1b3 100644 --- a/subservers/manager.go +++ b/subservers/manager.go @@ -90,6 +90,19 @@ func (s *Manager) AddServer(ss SubServer, enable bool) error { return nil } +// GetServer returns the sub-server with the given name if it exists. +func (s *Manager) GetServer(name string) (SubServer, bool) { + s.mu.RLock() + defer s.mu.RUnlock() + + ss, ok := s.servers[name] + if !ok { + return nil, false + } + + return ss.SubServer, true +} + // StartIntegratedServers starts all the manager's sub-servers that should be // started in integrated mode. func (s *Manager) StartIntegratedServers(lndClient lnrpc.LightningClient, diff --git a/subservers/pool.go b/subservers/pool.go index 9c476705b..6a6576125 100644 --- a/subservers/pool.go +++ b/subservers/pool.go @@ -8,6 +8,7 @@ import ( "github.com/lightninglabs/pool" "github.com/lightninglabs/pool/perms" "github.com/lightninglabs/pool/poolrpc" + "github.com/lightninglabs/taproot-assets/fn" "github.com/lightningnetwork/lnd/lnrpc" "google.golang.org/grpc" "gopkg.in/macaroon-bakery.v2/bakery" @@ -126,3 +127,13 @@ func (p *poolSubServer) Permissions() map[string][]bakery.Op { func (p *poolSubServer) WhiteListedURLs() map[string]struct{} { return nil } + +// Impl returns the actual implementation of the sub-server. This might not be +// set if the sub-server is running in remote mode. +func (p *poolSubServer) Impl() fn.Option[any] { + if p.Server == nil { + return fn.None[any]() + } + + return fn.Some[any](p.Server) +} diff --git a/subservers/taproot-assets.go b/subservers/taproot-assets.go index 6c6a15fcc..039882f86 100644 --- a/subservers/taproot-assets.go +++ b/subservers/taproot-assets.go @@ -9,6 +9,7 @@ import ( "github.com/lightninglabs/lndclient" tap "github.com/lightninglabs/taproot-assets" "github.com/lightninglabs/taproot-assets/address" + "github.com/lightninglabs/taproot-assets/fn" "github.com/lightninglabs/taproot-assets/perms" "github.com/lightninglabs/taproot-assets/tapcfg" "github.com/lightninglabs/taproot-assets/taprpc" @@ -177,6 +178,20 @@ func (t *taprootAssetsSubServer) RegisterRestService(ctx context.Context, return err } + err = rfqrpc.RegisterRfqHandlerFromEndpoint( + ctx, mux, endpoint, dialOpts, + ) + if err != nil { + return err + } + + err = tchrpc.RegisterTaprootAssetChannelsHandlerFromEndpoint( + ctx, mux, endpoint, dialOpts, + ) + if err != nil { + return err + } + err = universerpc.RegisterUniverseHandlerFromEndpoint( ctx, mux, endpoint, dialOpts, ) @@ -239,3 +254,13 @@ func (t *taprootAssetsSubServer) WhiteListedURLs() map[string]struct{} { t.cfg.RpcConf.AllowPublicStats || t.remote, ) } + +// Impl returns the actual implementation of the sub-server. This might not be +// set if the sub-server is running in remote mode. +func (t *taprootAssetsSubServer) Impl() fn.Option[any] { + if t.Server == nil { + return fn.None[any]() + } + + return fn.Some[any](t.Server) +} From a027e4051d02b6b324f1d86bf808eaab31abb8ef Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Thu, 23 May 2024 13:54:35 +0200 Subject: [PATCH 03/10] litd: register tapd as aux component of lnd This commit represents the main integration between lnd running in integrated mode and tapd providing auxiliary components for custom channels. --- config.go | 14 +++++++++ go.mod | 2 +- terminal.go | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+), 1 deletion(-) diff --git a/config.go b/config.go index 12cf21f29..bc860914f 100644 --- a/config.go +++ b/config.go @@ -31,6 +31,7 @@ import ( "github.com/lightningnetwork/lnd/cert" "github.com/lightningnetwork/lnd/lncfg" "github.com/lightningnetwork/lnd/lnrpc" + "github.com/lightningnetwork/lnd/lnwire" "github.com/lightningnetwork/lnd/signal" "github.com/mwitkow/go-conntrack/connhelpers" "golang.org/x/crypto/acme/autocert" @@ -627,6 +628,19 @@ func loadConfigFile(preCfg *Config, interceptor signal.Interceptor) (*Config, // configuration is fully valid. This also sets up the main logger that // logs to a sub-directory in the .lnd folder. case ModeIntegrated: + // For the integration of tapd with lnd, we need to allow tapd + // to send custom error messages to peers through the + // SendCustomMessage RPC in lnd. Since the error messages aren't + // in the custom range, we explicitly need to allow them. This + // isn't currently needed in remote mode, because custom + // channels are only available if both lnd and tapd are running + // in integrated mode. We need to set this value before we call + // lnd.ValidateConfig() below, because that's what's going to + // inject these values into the lnwire package. + cfg.Lnd.ProtocolOptions.CustomMessage = append( + cfg.Lnd.ProtocolOptions.CustomMessage, lnwire.MsgError, + ) + var err error cfg.Lnd, err = lnd.ValidateConfig( *cfg.Lnd, interceptor, fileParser, flagParser, diff --git a/go.mod b/go.mod index a21ddd217..b39718923 100644 --- a/go.mod +++ b/go.mod @@ -25,6 +25,7 @@ require ( github.com/lightninglabs/taproot-assets v0.5.0 github.com/lightningnetwork/lnd v0.18.4-beta github.com/lightningnetwork/lnd/cert v1.2.2 + github.com/lightningnetwork/lnd/fn v1.2.3 github.com/lightningnetwork/lnd/kvdb v1.4.10 github.com/lightningnetwork/lnd/tlv v1.2.6 github.com/lightningnetwork/lnd/tor v1.1.2 @@ -136,7 +137,6 @@ require ( github.com/lightninglabs/neutrino/cache v1.1.2 // indirect github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb // indirect github.com/lightningnetwork/lnd/clock v1.1.1 // indirect - github.com/lightningnetwork/lnd/fn v1.2.3 // indirect github.com/lightningnetwork/lnd/healthcheck v1.2.5 // indirect github.com/lightningnetwork/lnd/queue v1.1.1 // indirect github.com/lightningnetwork/lnd/sqldb v1.0.4 // indirect diff --git a/terminal.go b/terminal.go index ac698518d..b013ff0a8 100644 --- a/terminal.go +++ b/terminal.go @@ -34,9 +34,13 @@ import ( "github.com/lightninglabs/lightning-terminal/status" "github.com/lightninglabs/lightning-terminal/subservers" "github.com/lightninglabs/lndclient" + taprootassets "github.com/lightninglabs/taproot-assets" "github.com/lightningnetwork/lnd" "github.com/lightningnetwork/lnd/build" "github.com/lightningnetwork/lnd/chainreg" + "github.com/lightningnetwork/lnd/fn" + "github.com/lightningnetwork/lnd/funding" + "github.com/lightningnetwork/lnd/htlcswitch" "github.com/lightningnetwork/lnd/kvdb" "github.com/lightningnetwork/lnd/lncfg" "github.com/lightningnetwork/lnd/lnrpc" @@ -49,10 +53,14 @@ import ( "github.com/lightningnetwork/lnd/lnrpc/walletrpc" "github.com/lightningnetwork/lnd/lnrpc/watchtowerrpc" "github.com/lightningnetwork/lnd/lnrpc/wtclientrpc" + "github.com/lightningnetwork/lnd/lnwallet" "github.com/lightningnetwork/lnd/lnwallet/btcwallet" + "github.com/lightningnetwork/lnd/lnwallet/chancloser" "github.com/lightningnetwork/lnd/macaroons" + "github.com/lightningnetwork/lnd/msgmux" "github.com/lightningnetwork/lnd/rpcperms" "github.com/lightningnetwork/lnd/signal" + "github.com/lightningnetwork/lnd/sweep" grpcProxy "github.com/mwitkow/grpc-proxy/proxy" "google.golang.org/grpc" "google.golang.org/grpc/credentials" @@ -509,6 +517,25 @@ func (g *LightningTerminal) start() error { }}, } + var auxComponents lnd.AuxComponents + switch g.cfg.TaprootAssetsMode { + case ModeRemote, ModeDisable: + log.Warnf("Taproot Assets daemon is either disabled " + + "or running in remote mode. Taproot Asset " + + "channel functionality will NOT be " + + "available. To enable, set Taproot Assets " + + "mode to 'integrated' in the config file.") + + case ModeIntegrated: + components, err := g.buildAuxComponents() + if err != nil { + return fmt.Errorf("could not build aux "+ + "components: %w", err) + } + + auxComponents = *components + } + implCfg := &lnd.ImplementationCfg{ GrpcRegistrar: g, RestRegistrar: g, @@ -516,6 +543,7 @@ func (g *LightningTerminal) start() error { DatabaseBuilder: g.defaultImplCfg.DatabaseBuilder, WalletConfigBuilder: g, ChainControlBuilder: g.defaultImplCfg.ChainControlBuilder, + AuxComponents: auxComponents, } g.wg.Add(1) @@ -1296,6 +1324,59 @@ func (g *LightningTerminal) BuildWalletConfig(ctx context.Context, ) } +// buildAuxComponent builds the auxiliary components required by lnd when +// running in integrated mode with tapd being the service that provides the +// aux component implementations. +func (g *LightningTerminal) buildAuxComponents() (*lnd.AuxComponents, error) { + errNotAvailable := fmt.Errorf("tapd is not available, both lnd and " + + "tapd must be started in integrated mode for Taproot " + + "Assets Channels to be available") + + tapdWrapper, available := g.subServerMgr.GetServer(subservers.TAP) + if !available { + return nil, errNotAvailable + } + + if tapdWrapper.Remote() { + return nil, errNotAvailable + } + + tapdOpt := tapdWrapper.Impl() + tapdAny, err := tapdOpt.UnwrapOrErr(errors.New("tapd not available")) + if err != nil { + return nil, err + } + + tapd, ok := tapdAny.(*taprootassets.Server) + if !ok { + return nil, fmt.Errorf("tapd is not of the expected type") + } + + router := msgmux.NewMultiMsgRouter() + router.Start() + err = router.RegisterEndpoint(tapd) + if err != nil { + return nil, fmt.Errorf("error registering tapd endpoint: %w", + err) + } + + return &lnd.AuxComponents{ + AuxLeafStore: fn.Some[lnwallet.AuxLeafStore](tapd), + MsgRouter: fn.Some[msgmux.Router](router), + AuxFundingController: fn.Some[funding.AuxFundingController]( + tapd, + ), + AuxSigner: fn.Some[lnwallet.AuxSigner](tapd), + TrafficShaper: fn.Some[htlcswitch.AuxTrafficShaper](tapd), + AuxDataParser: fn.Some[lnd.AuxDataParser](tapd), + AuxChanCloser: fn.Some[chancloser.AuxChanCloser](tapd), + AuxSweeper: fn.Some[sweep.AuxSweeper](tapd), + AuxContractResolver: fn.Some[lnwallet.AuxContractResolver]( + tapd, + ), + }, nil +} + // shutdownSubServers stops all subservers that were started and attached to // lnd. func (g *LightningTerminal) shutdownSubServers() error { From 3f9a63876a543c8ec0fe5139de4cee6aba695c79 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Thu, 23 May 2024 13:55:26 +0200 Subject: [PATCH 04/10] litd: allow faster startup by making re-try configurable This change will speed up integration tests by not waiting a full 5 seconds before re-trying the connection to lnd if it fails the first time. --- config.go | 8 +++++--- terminal.go | 17 ++++++++++------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/config.go b/config.go index bc860914f..18a1ad264 100644 --- a/config.go +++ b/config.go @@ -190,9 +190,10 @@ type Config struct { // friendly. Because then we can reference the explicit modes in the // help descriptions of the section headers. We'll parse the mode into // a bool for internal use for better code readability. - LndMode string `long:"lnd-mode" description:"The mode to run lnd in, either 'remote' (default) or 'integrated'. 'integrated' means lnd is started alongside the UI and everything is stored in lnd's main data directory, configure everything by using the --lnd.* flags. 'remote' means the UI connects to an existing lnd node and acts as a proxy for gRPC calls to it. In the remote node LiT creates its own directory for log and configuration files, configure everything using the --remote.* flags." choice:"integrated" choice:"remote"` - Lnd *lnd.Config `group:"Integrated lnd (use when lnd-mode=integrated)" namespace:"lnd"` - LndRPCTimeout time.Duration `long:"lndrpctimeout" description:"The timeout for RPC calls to lnd from other sub servers. This can be adjusted for slow lnd instances to give loop/pool/faraday/taproot-assets more time when querying into lnd's RPC methods. This value should NOT be set to anything below 30 seconds to avoid problems."` + LndMode string `long:"lnd-mode" description:"The mode to run lnd in, either 'remote' (default) or 'integrated'. 'integrated' means lnd is started alongside the UI and everything is stored in lnd's main data directory, configure everything by using the --lnd.* flags. 'remote' means the UI connects to an existing lnd node and acts as a proxy for gRPC calls to it. In the remote node LiT creates its own directory for log and configuration files, configure everything using the --remote.* flags." choice:"integrated" choice:"remote"` + Lnd *lnd.Config `group:"Integrated lnd (use when lnd-mode=integrated)" namespace:"lnd"` + LndRPCTimeout time.Duration `long:"lndrpctimeout" description:"The timeout for RPC calls to lnd from other sub servers. This can be adjusted for slow lnd instances to give loop/pool/faraday/taproot-assets more time when querying into lnd's RPC methods. This value should NOT be set to anything below 30 seconds to avoid problems."` + LndConnectInterval time.Duration `long:"lndconnectinterval" hidden:"true" description:"The interval at which LiT tries to connect to the lnd node. This value should only be changed for development mode."` FaradayMode string `long:"faraday-mode" description:"The mode to run faraday in, either 'integrated' (default), 'remote' or 'disable'. 'integrated' means faraday is started alongside the UI and everything is stored in faraday's main data directory, configure everything by using the --faraday.* flags. 'remote' means the UI connects to an existing faraday node and acts as a proxy for gRPC calls to it. 'disable' means that LiT is started without faraday." choice:"integrated" choice:"remote" choice:"disable"` Faraday *faraday.Config `group:"Integrated faraday options (use when faraday-mode=integrated)" namespace:"faraday"` @@ -314,6 +315,7 @@ func defaultConfig() *Config { LndMode: DefaultLndMode, Lnd: &lndDefaultConfig, LndRPCTimeout: defaultRPCTimeout, + LndConnectInterval: defaultStartupTimeout, LitDir: DefaultLitDir, LetsEncryptListen: defaultLetsEncryptListen, LetsEncryptDir: defaultLetsEncryptDir, diff --git a/terminal.go b/terminal.go index b013ff0a8..b27e3b2c5 100644 --- a/terminal.go +++ b/terminal.go @@ -811,7 +811,7 @@ func (g *LightningTerminal) setUpLNDClients(lndQuit chan struct{}) error { case <-interceptor.ShutdownChannel(): return fmt.Errorf("received the shutdown signal") - case <-time.After(defaultStartupTimeout): + case <-time.After(g.cfg.LndConnectInterval): return nil } } @@ -893,17 +893,20 @@ func (g *LightningTerminal) setUpLNDClients(lndQuit chan struct{}) error { for { g.lndClient, err = lndclient.NewLndServices( &lndclient.LndServicesConfig{ - LndAddress: host, - Network: network, - TLSPath: tlsPath, - Insecure: insecure, - CustomMacaroonPath: macPath, - CustomMacaroonHex: hex.EncodeToString(macData), + LndAddress: host, + Network: network, + TLSPath: tlsPath, + Insecure: insecure, + CustomMacaroonPath: macPath, + CustomMacaroonHex: hex.EncodeToString( + macData, + ), BlockUntilChainSynced: true, BlockUntilUnlocked: true, CallerCtx: ctxc, CheckVersion: minimalCompatibleVersion, RPCTimeout: g.cfg.LndRPCTimeout, + ChainSyncPollInterval: g.cfg.LndConnectInterval, }, ) if err == nil { From 7ed8ff1a39b2f54fa9ed8a31fc656e41b2f0662f Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Thu, 23 May 2024 13:56:31 +0200 Subject: [PATCH 05/10] cmd/litcli: add ln sub commands for custom channels --- cmd/litcli/ln.go | 718 +++++++++++++++++++++++++++++++++++++++++++++ cmd/litcli/main.go | 94 +++++- 2 files changed, 805 insertions(+), 7 deletions(-) create mode 100644 cmd/litcli/ln.go diff --git a/cmd/litcli/ln.go b/cmd/litcli/ln.go new file mode 100644 index 000000000..83ab07074 --- /dev/null +++ b/cmd/litcli/ln.go @@ -0,0 +1,718 @@ +package main + +import ( + "bytes" + "context" + "crypto/rand" + "encoding/hex" + "errors" + "fmt" + "strconv" + + "github.com/lightninglabs/taproot-assets/asset" + "github.com/lightninglabs/taproot-assets/rfq" + "github.com/lightninglabs/taproot-assets/rfqmath" + "github.com/lightninglabs/taproot-assets/taprpc" + "github.com/lightninglabs/taproot-assets/taprpc/rfqrpc" + tchrpc "github.com/lightninglabs/taproot-assets/taprpc/tapchannelrpc" + "github.com/lightningnetwork/lnd/cmd/commands" + "github.com/lightningnetwork/lnd/lnrpc" + "github.com/lightningnetwork/lnd/lnrpc/routerrpc" + "github.com/lightningnetwork/lnd/lntypes" + "github.com/lightningnetwork/lnd/lnwire" + "github.com/lightningnetwork/lnd/record" + "github.com/urfave/cli" + "google.golang.org/grpc" +) + +const ( + // minAssetAmount is the minimum amount of an asset that can be put into + // a channel. We choose an arbitrary value that allows for at least a + // couple of HTLCs to be created without leading to fractions of assets + // (which doesn't exist). + minAssetAmount = 100 +) + +var lnCommands = []cli.Command{ + { + Name: "ln", + Usage: "Interact with the Lightning Network.", + Category: "Taproot Assets on LN", + Subcommands: []cli.Command{ + fundChannelCommand, + sendPaymentCommand, + payInvoiceCommand, + addInvoiceCommand, + decodeAssetInvoiceCommand, + }, + }, +} + +var fundChannelCommand = cli.Command{ + Name: "fundchannel", + Category: "Channels", + Usage: "Open a Taproot Asset channel with a node on the Lightning " + + "Network.", + Flags: []cli.Flag{ + cli.StringFlag{ + Name: "node_key", + Usage: "the identity public key of the target " + + "node/peer serialized in compressed format, " + + "must already be connected to", + }, + cli.Uint64Flag{ + Name: "sat_per_vbyte", + Usage: "(optional) a manual fee expressed in " + + "sat/vByte that should be used when crafting " + + "the transaction", + }, + cli.Uint64Flag{ + Name: "push_amt", + Usage: "the number of satoshis to give the remote " + + "side as part of the initial commitment " + + "state, this is equivalent to first opening " + + "a channel and then sending the remote party " + + "funds, but done all in one step; therefore, " + + "this is equivalent to a donation to the " + + "remote party, unless they reimburse the " + + "funds in another way (outside the protocol)", + }, + cli.Uint64Flag{ + Name: "asset_amount", + Usage: "The amount of the asset to commit to the " + + "channel.", + }, + cli.StringFlag{ + Name: "asset_id", + Usage: "The asset ID to commit to the channel.", + }, + }, + Action: fundChannel, +} + +func fundChannel(c *cli.Context) error { + tapdConn, cleanup, err := connectSuperMacClient(c) + if err != nil { + return fmt.Errorf("error creating tapd connection: %w", err) + } + + defer cleanup() + + ctxb := context.Background() + tapdClient := taprpc.NewTaprootAssetsClient(tapdConn) + tchrpcClient := tchrpc.NewTaprootAssetChannelsClient(tapdConn) + assets, err := tapdClient.ListAssets(ctxb, &taprpc.ListAssetRequest{}) + if err != nil { + return fmt.Errorf("error fetching assets: %w", err) + } + + assetIDBytes, err := hex.DecodeString(c.String("asset_id")) + if err != nil { + return fmt.Errorf("error hex decoding asset ID: %w", err) + } + + requestedAmount := c.Uint64("asset_amount") + if requestedAmount < minAssetAmount { + return fmt.Errorf("requested amount must be at least %d", + minAssetAmount) + } + + nodePubBytes, err := hex.DecodeString(c.String("node_key")) + if err != nil { + return fmt.Errorf("unable to decode node public key: %w", err) + } + + assetFound := false + totalAmount := uint64(0) + for _, rpcAsset := range assets.Assets { + if !bytes.Equal(rpcAsset.AssetGenesis.AssetId, assetIDBytes) { + continue + } + + totalAmount += rpcAsset.Amount + if totalAmount >= requestedAmount { + assetFound = true + + break + } + + assetFound = true + } + + if !assetFound { + return fmt.Errorf("asset with ID %x not found or no combined "+ + "UTXOs with at least amount %d is available", + assetIDBytes, requestedAmount) + } + + resp, err := tchrpcClient.FundChannel( + ctxb, &tchrpc.FundChannelRequest{ + AssetAmount: requestedAmount, + AssetId: assetIDBytes, + PeerPubkey: nodePubBytes, + FeeRateSatPerVbyte: uint32(c.Uint64("sat_per_vbyte")), + PushSat: c.Int64("push_amt"), + }, + ) + if err != nil { + return fmt.Errorf("error funding channel: %w", err) + } + + printJSON(resp) + + return nil +} + +var ( + assetIDFlag = cli.StringFlag{ + Name: "asset_id", + Usage: "the asset ID of the asset to use when sending " + + "payments with assets", + } + + assetAmountFlag = cli.Uint64Flag{ + Name: "asset_amount", + Usage: "the amount of the asset to send in the asset keysend " + + "payment", + } + + rfqPeerPubKeyFlag = cli.StringFlag{ + Name: "rfq_peer_pubkey", + Usage: "(optional) the public key of the peer to ask for a " + + "quote when converting from assets to sats; must be " + + "set if there are multiple channels with the same " + + "asset ID present", + } + + allowOverpayFlag = cli.BoolFlag{ + Name: "allow_overpay", + Usage: "allow sending asset payments that are uneconomical " + + "because the required non-dust amount for an asset " + + "carrier HTLC plus one asset unit is higher than the " + + "total invoice/payment amount that arrives at the " + + "destination; meaning that the total amount sent " + + "exceeds the total amount received plus routing fees", + } +) + +// resultStreamWrapper is a wrapper around the SendPaymentClient stream that +// implements the generic PaymentResultStream interface. +type resultStreamWrapper struct { + amountMsat int64 + stream tchrpc.TaprootAssetChannels_SendPaymentClient +} + +// Recv receives the next payment result from the stream. +// +// NOTE: This method is part of the PaymentResultStream interface. +func (w *resultStreamWrapper) Recv() (*lnrpc.Payment, error) { + resp, err := w.stream.Recv() + if err != nil { + return nil, err + } + + res := resp.Result + switch r := res.(type) { + // The very first response might be an accepted sell order, which we + // just print out. + case *tchrpc.SendPaymentResponse_AcceptedSellOrder: + quote := r.AcceptedSellOrder + rpcRate := quote.BidAssetRate + rate, err := rfqrpc.UnmarshalFixedPoint(rpcRate) + if err != nil { + return nil, fmt.Errorf("unable to unmarshal fixed "+ + "point: %w", err) + } + + amountMsat := lnwire.MilliSatoshi(w.amountMsat) + milliSatsFP := rfqmath.MilliSatoshiToUnits(amountMsat, *rate) + numUnits := milliSatsFP.ScaleTo(0).ToUint64() + + // If the calculated number of units is 0 then the asset rate + // was not sufficient to represent the value of this payment. + if numUnits == 0 { + // We will calculate the minimum amount that can be + // effectively sent with this asset by calculating the + // value of a single asset unit, based on the provided + // asset rate. + + // We create the single unit. + unit := rfqmath.FixedPointFromUint64[rfqmath.BigInt]( + 1, 0, + ) + + // We derive the minimum amount. + minAmt := rfqmath.UnitsToMilliSatoshi(unit, *rate) + + // We return the error to the user. + return nil, fmt.Errorf("smallest payment with asset "+ + "rate %v is %v, cannot send %v", + rate.ToUint64(), minAmt, amountMsat) + } + + msatPerUnit := uint64(w.amountMsat) / numUnits + + fmt.Printf("Got quote for %v asset units at %v msat/unit from "+ + "peer %s with SCID %d\n", numUnits, msatPerUnit, + quote.Peer, quote.Scid) + + resp, err = w.stream.Recv() + if err != nil { + return nil, err + } + + if resp == nil || resp.Result == nil || + resp.GetPaymentResult() == nil { + + return nil, errors.New("unexpected nil result") + } + + return resp.GetPaymentResult(), nil + + case *tchrpc.SendPaymentResponse_PaymentResult: + return r.PaymentResult, nil + + default: + return nil, fmt.Errorf("unexpected response type: %T", r) + } +} + +var sendPaymentCommand = cli.Command{ + Name: "sendpayment", + Category: commands.SendPaymentCommand.Category, + Usage: "Send a payment over Lightning, potentially using a " + + "mulit-asset channel as the first hop", + Description: commands.SendPaymentCommand.Description + ` + To send an multi-asset LN payment to a single hop, the --asset_id=X + argument should be used. + + Note that this will only work in concert with the --keysend argument. + `, + ArgsUsage: commands.SendPaymentCommand.ArgsUsage + " --asset_id=X " + + "--asset_amount=Y [--rfq_peer_pubkey=Z]", + Flags: append( + commands.SendPaymentCommand.Flags, assetIDFlag, assetAmountFlag, + rfqPeerPubKeyFlag, allowOverpayFlag, + ), + Action: sendPayment, +} + +func sendPayment(ctx *cli.Context) error { + // Show command help if no arguments provided + if ctx.NArg() == 0 && ctx.NumFlags() == 0 { + _ = cli.ShowCommandHelp(ctx, "sendpayment") + return nil + } + + lndConn, cleanup, err := connectClient(ctx, false) + if err != nil { + return fmt.Errorf("unable to make rpc conn: %w", err) + } + defer cleanup() + + tapdConn, cleanup, err := connectSuperMacClient(ctx) + if err != nil { + return fmt.Errorf("error creating tapd connection: %w", err) + } + defer cleanup() + + switch { + case !ctx.IsSet(assetIDFlag.Name): + return fmt.Errorf("the --asset_id flag must be set") + case !ctx.IsSet("keysend"): + return fmt.Errorf("the --keysend flag must be set") + case !ctx.IsSet(assetAmountFlag.Name): + return fmt.Errorf("--asset_amount must be set") + } + + assetIDStr := ctx.String(assetIDFlag.Name) + assetIDBytes, err := hex.DecodeString(assetIDStr) + if err != nil { + return fmt.Errorf("unable to decode assetID: %v", err) + } + + assetAmountToSend := ctx.Uint64(assetAmountFlag.Name) + if assetAmountToSend == 0 { + return fmt.Errorf("must specify asset amount to send") + } + + // With the asset specific work out of the way, we'll parse the rest of + // the command as normal. + var ( + destNode []byte + rHash []byte + ) + + switch { + case ctx.IsSet("dest"): + destNode, err = hex.DecodeString(ctx.String("dest")) + default: + return fmt.Errorf("destination txid argument missing") + } + if err != nil { + return err + } + + if len(destNode) != 33 { + return fmt.Errorf("dest node pubkey must be exactly 33 bytes, "+ + "is instead: %v", len(destNode)) + } + + rfqPeerKey, err := hex.DecodeString(ctx.String(rfqPeerPubKeyFlag.Name)) + if err != nil { + return fmt.Errorf("unable to decode RFQ peer public key: "+ + "%w", err) + } + + // Use the smallest possible non-dust HTLC amount to carry the asset + // HTLCs. In the future, we can use the double HTLC trick here, though + // it consumes more commitment space. + req := &routerrpc.SendPaymentRequest{ + Dest: destNode, + Amt: int64(rfqmath.DefaultOnChainHtlcSat), + DestCustomRecords: make(map[uint64][]byte), + } + + if ctx.IsSet("payment_hash") { + return errors.New("cannot set payment hash when using " + + "keysend") + } + + // Read out the custom preimage for the keysend payment. + var preimage lntypes.Preimage + if _, err := rand.Read(preimage[:]); err != nil { + return err + } + + // Set the preimage. If the user supplied a preimage with the data + // flag, the preimage that is set here will be overwritten later. + req.DestCustomRecords[record.KeySendType] = preimage[:] + + hash := preimage.Hash() + rHash = hash[:] + + req.PaymentHash = rHash + allowOverpay := ctx.Bool(allowOverpayFlag.Name) + + return commands.SendPaymentRequest( + ctx, req, lndConn, tapdConn, func(ctx context.Context, + payConn grpc.ClientConnInterface, + req *routerrpc.SendPaymentRequest) ( + commands.PaymentResultStream, error) { + + tchrpcClient := tchrpc.NewTaprootAssetChannelsClient( + payConn, + ) + + stream, err := tchrpcClient.SendPayment( + ctx, &tchrpc.SendPaymentRequest{ + AssetId: assetIDBytes, + AssetAmount: assetAmountToSend, + PeerPubkey: rfqPeerKey, + PaymentRequest: req, + AllowOverpay: allowOverpay, + }, + ) + if err != nil { + return nil, err + } + + return &resultStreamWrapper{ + stream: stream, + }, nil + }, + ) +} + +var payInvoiceCommand = cli.Command{ + Name: "payinvoice", + Category: "Payments", + Usage: "Pay an invoice over lightning using an asset.", + Description: ` + This command attempts to pay an invoice using an asset channel as the + source of the payment. The asset ID of the channel must be specified + using the --asset_id flag. + `, + ArgsUsage: "pay_req --asset_id=X", + Flags: append(commands.PaymentFlags(), + cli.Int64Flag{ + Name: "amt", + Usage: "(optional) number of satoshis to fulfill the " + + "invoice", + }, + assetIDFlag, + rfqPeerPubKeyFlag, + allowOverpayFlag, + ), + Action: payInvoice, +} + +func payInvoice(ctx *cli.Context) error { + args := ctx.Args() + ctxb := context.Background() + + var payReq string + switch { + case ctx.IsSet("pay_req"): + payReq = ctx.String("pay_req") + case args.Present(): + payReq = args.First() + default: + return fmt.Errorf("pay_req argument missing") + } + + superMacConn, cleanup, err := connectSuperMacClient(ctx) + if err != nil { + return fmt.Errorf("unable to make rpc con: %w", err) + } + + defer cleanup() + + lndClient := lnrpc.NewLightningClient(superMacConn) + + decodeReq := &lnrpc.PayReqString{PayReq: payReq} + decodeResp, err := lndClient.DecodePayReq(ctxb, decodeReq) + if err != nil { + return err + } + + if !ctx.IsSet(assetIDFlag.Name) { + return fmt.Errorf("the --asset_id flag must be set") + } + + assetIDStr := ctx.String(assetIDFlag.Name) + + assetIDBytes, err := hex.DecodeString(assetIDStr) + if err != nil { + return fmt.Errorf("unable to decode assetID: %v", err) + } + + rfqPeerKey, err := hex.DecodeString(ctx.String(rfqPeerPubKeyFlag.Name)) + if err != nil { + return fmt.Errorf("unable to decode RFQ peer public key: "+ + "%w", err) + } + + allowOverpay := ctx.Bool(allowOverpayFlag.Name) + req := &routerrpc.SendPaymentRequest{ + PaymentRequest: commands.StripPrefix(payReq), + } + + return commands.SendPaymentRequest( + ctx, req, superMacConn, superMacConn, func(ctx context.Context, + payConn grpc.ClientConnInterface, + req *routerrpc.SendPaymentRequest) ( + commands.PaymentResultStream, error) { + + tchrpcClient := tchrpc.NewTaprootAssetChannelsClient( + payConn, + ) + + stream, err := tchrpcClient.SendPayment( + ctx, &tchrpc.SendPaymentRequest{ + AssetId: assetIDBytes, + PeerPubkey: rfqPeerKey, + PaymentRequest: req, + AllowOverpay: allowOverpay, + }, + ) + if err != nil { + return nil, err + } + + return &resultStreamWrapper{ + amountMsat: decodeResp.NumMsat, + stream: stream, + }, nil + }, + ) +} + +var addInvoiceCommand = cli.Command{ + Name: "addinvoice", + Category: commands.AddInvoiceCommand.Category, + Usage: "Add a new invoice to receive Taproot Assets.", + Description: ` + Add a new invoice, expressing intent for a future payment, received in + Taproot Assets. + `, + ArgsUsage: "asset_id asset_amount", + Flags: append( + commands.AddInvoiceCommand.Flags, + cli.StringFlag{ + Name: "asset_id", + Usage: "the asset ID of the asset to receive", + }, + cli.Uint64Flag{ + Name: "asset_amount", + Usage: "the amount of assets to receive", + }, + cli.StringFlag{ + Name: "rfq_peer_pubkey", + Usage: "(optional) the public key of the peer to ask " + + "for a quote when converting from assets to " + + "sats for the invoice; must be set if there " + + "are multiple channels with the same " + + "asset ID present", + }, + ), + Action: addInvoice, +} + +func addInvoice(ctx *cli.Context) error { + args := ctx.Args() + ctxb := context.Background() + + var assetIDStr string + switch { + case ctx.IsSet("asset_id"): + assetIDStr = ctx.String("asset_id") + case args.Present(): + assetIDStr = args.First() + args = args.Tail() + default: + return fmt.Errorf("asset_id argument missing") + } + + var ( + assetAmount uint64 + preimage []byte + descHash []byte + err error + ) + switch { + case ctx.IsSet("asset_amount"): + assetAmount = ctx.Uint64("asset_amount") + case args.Present(): + assetAmount, err = strconv.ParseUint(args.First(), 10, 64) + if err != nil { + return fmt.Errorf("unable to parse asset amount %w", + err) + } + default: + return fmt.Errorf("asset_amount argument missing") + } + + if ctx.IsSet("preimage") { + preimage, err = hex.DecodeString(ctx.String("preimage")) + if err != nil { + return fmt.Errorf("unable to parse preimage: %w", err) + } + } + + descHash, err = hex.DecodeString(ctx.String("description_hash")) + if err != nil { + return fmt.Errorf("unable to parse description_hash: %w", err) + } + + expirySeconds := int64(rfq.DefaultInvoiceExpiry.Seconds()) + if ctx.IsSet("expiry") { + expirySeconds = ctx.Int64("expiry") + } + + assetIDBytes, err := hex.DecodeString(assetIDStr) + if err != nil { + return fmt.Errorf("unable to decode assetID: %v", err) + } + + var assetID asset.ID + copy(assetID[:], assetIDBytes) + + rfqPeerKey, err := hex.DecodeString(ctx.String(rfqPeerPubKeyFlag.Name)) + if err != nil { + return fmt.Errorf("unable to decode RFQ peer public key: "+ + "%w", err) + } + + tapdConn, cleanup, err := connectSuperMacClient(ctx) + if err != nil { + return fmt.Errorf("error creating tapd connection: %w", err) + } + defer cleanup() + + channelsClient := tchrpc.NewTaprootAssetChannelsClient(tapdConn) + resp, err := channelsClient.AddInvoice(ctxb, &tchrpc.AddInvoiceRequest{ + AssetId: assetIDBytes, + AssetAmount: assetAmount, + PeerPubkey: rfqPeerKey, + InvoiceRequest: &lnrpc.Invoice{ + Memo: ctx.String("memo"), + RPreimage: preimage, + DescriptionHash: descHash, + FallbackAddr: ctx.String("fallback_addr"), + Expiry: expirySeconds, + Private: ctx.Bool("private"), + IsAmp: ctx.Bool("amp"), + }, + }) + if err != nil { + return fmt.Errorf("error adding invoice: %w", err) + } + + printRespJSON(resp) + + return nil +} + +var decodeAssetInvoiceCommand = cli.Command{ + Name: "decodeassetinvoice", + Category: "Payments", + Usage: "Decodes an LN invoice and displays the invoice's amount in " + + "asset units specified by an asset ID", + Description: ` + This command can be used to display the information encoded in an + invoice. + Given a chosen asset_id, the invoice's amount expressed in units of the + asset will be displayed. + + Other information such as the decimal display of an asset, and the asset + group information (if applicable) are also shown. + `, + ArgsUsage: "--pay_req=X --asset_id=X", + Flags: []cli.Flag{ + cli.StringFlag{ + Name: "pay_req", + Usage: "a zpay32 encoded payment request to fulfill", + }, + assetIDFlag, + }, + Action: decodeAssetInvoice, +} + +func decodeAssetInvoice(ctx *cli.Context) error { + ctxb := context.Background() + + switch { + case !ctx.IsSet("pay_req"): + return fmt.Errorf("pay_req argument missing") + case !ctx.IsSet(assetIDFlag.Name): + return fmt.Errorf("the --asset_id flag must be set") + } + + payReq := ctx.String("pay_req") + + assetIDStr := ctx.String(assetIDFlag.Name) + assetIDBytes, err := hex.DecodeString(assetIDStr) + if err != nil { + return fmt.Errorf("unable to decode assetID: %v", err) + } + + tapdConn, cleanup, err := connectSuperMacClient(ctx) + if err != nil { + return fmt.Errorf("unable to make rpc con: %w", err) + } + defer cleanup() + + channelsClient := tchrpc.NewTaprootAssetChannelsClient(tapdConn) + resp, err := channelsClient.DecodeAssetPayReq(ctxb, &tchrpc.AssetPayReq{ + AssetId: assetIDBytes, + PayReqString: payReq, + }) + if err != nil { + return fmt.Errorf("error adding invoice: %w", err) + } + + printRespJSON(resp) + + return nil +} diff --git a/cmd/litcli/main.go b/cmd/litcli/main.go index f8dc55747..934e2020e 100644 --- a/cmd/litcli/main.go +++ b/cmd/litcli/main.go @@ -1,14 +1,17 @@ package main import ( + "context" + "encoding/hex" "fmt" - "io/ioutil" "os" "path/filepath" "strings" terminal "github.com/lightninglabs/lightning-terminal" + "github.com/lightninglabs/lightning-terminal/litrpc" "github.com/lightninglabs/lndclient" + "github.com/lightningnetwork/lnd/cmd/commands" "github.com/lightningnetwork/lnd/lncfg" "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/macaroons" @@ -69,6 +72,23 @@ func main() { baseDirFlag, tlsCertFlag, macaroonPathFlag, + // The following two flags are only required for the 'litcli ln' + // sub commands, because they call into lnd's commands package + // that requires them. They only need to be _defined_, but + // they're not actually actively used. + cli.StringFlag{ + Name: "lnddir", + Usage: "Path to lnd's base directory", + Hidden: true, + Value: commands.DefaultLndDir, + }, + cli.Int64Flag{ + Name: "macaroontimeout", + Value: 60, + Hidden: true, + Usage: "Anti-replay macaroon validity time in " + + "seconds.", + }, } app.Commands = append(app.Commands, sessionCommands...) app.Commands = append(app.Commands, accountsCommands...) @@ -78,6 +98,7 @@ func main() { app.Commands = append(app.Commands, litCommands...) app.Commands = append(app.Commands, helperCommands) app.Commands = append(app.Commands, statusCommands...) + app.Commands = append(app.Commands, lnCommands...) err := app.Run(os.Args) if err != nil { @@ -98,7 +119,7 @@ func connectClient(ctx *cli.Context, noMac bool) (grpc.ClientConnInterface, if err != nil { return nil, nil, err } - conn, err := getClientConn(rpcServer, tlsCertPath, macPath, noMac) + conn, err := getClientConn(rpcServer, tlsCertPath, macPath, noMac, nil) if err != nil { return nil, nil, err } @@ -107,14 +128,42 @@ func connectClient(ctx *cli.Context, noMac bool) (grpc.ClientConnInterface, return conn, cleanup, nil } -func getClientConn(address, tlsCertPath, macaroonPath string, noMac bool) ( - *grpc.ClientConn, error) { +func connectClientWithMac(ctx *cli.Context, + mac []byte) (grpc.ClientConnInterface, func(), error) { + + rpcServer := ctx.GlobalString("rpcserver") + tlsCertPath, macPath, err := extractPathArgs(ctx) + if err != nil { + return nil, nil, err + } + conn, err := getClientConn(rpcServer, tlsCertPath, macPath, false, mac) + if err != nil { + return nil, nil, err + } + cleanup := func() { _ = conn.Close() } + + return conn, cleanup, nil +} + +func getClientConn(address, tlsCertPath, macaroonPath string, noMac bool, + customMac []byte) (*grpc.ClientConn, error) { opts := []grpc.DialOption{ grpc.WithDefaultCallOptions(maxMsgRecvSize), } - if !noMac { + switch { + case len(customMac) > 0: + macOption, err := macFromBytes(customMac) + if err != nil { + return nil, err + } + opts = append(opts, macOption) + + case noMac: + // Don't do anything. + + default: macOption, err := readMacaroon(macaroonPath) if err != nil { return nil, err @@ -196,13 +245,18 @@ func extractPathArgs(ctx *cli.Context) (string, string, error) { // gRPC dial options from it. func readMacaroon(macPath string) (grpc.DialOption, error) { // Load the specified macaroon file. - macBytes, err := ioutil.ReadFile(macPath) + macBytes, err := os.ReadFile(macPath) if err != nil { return nil, fmt.Errorf("unable to read macaroon path : %v", err) } + return macFromBytes(macBytes) +} + +// macFromBytes returns a macaroon from the given byte slice. +func macFromBytes(macBytes []byte) (grpc.DialOption, error) { mac := &macaroon.Macaroon{} - if err = mac.UnmarshalBinary(macBytes); err != nil { + if err := mac.UnmarshalBinary(macBytes); err != nil { return nil, fmt.Errorf("unable to decode macaroon: %v", err) } @@ -244,3 +298,29 @@ func printRespJSON(resp proto.Message) { // nolint fmt.Println(string(jsonBytes)) } + +func connectSuperMacClient(ctx *cli.Context) (grpc.ClientConnInterface, + func(), error) { + + litdConn, cleanup, err := connectClient(ctx, false) + if err != nil { + return nil, nil, fmt.Errorf("error connecting client: %w", err) + } + defer cleanup() + + ctxb := context.Background() + litClient := litrpc.NewProxyClient(litdConn) + macResp, err := litClient.BakeSuperMacaroon( + ctxb, &litrpc.BakeSuperMacaroonRequest{}, + ) + if err != nil { + return nil, nil, fmt.Errorf("error baking macaroon: %w", err) + } + + macBytes, err := hex.DecodeString(macResp.Macaroon) + if err != nil { + return nil, nil, fmt.Errorf("error decoding macaroon: %w", err) + } + + return connectClientWithMac(ctx, macBytes) +} From 3be9f300ef2b3e61c4b4110b473e7d00e666ac8f Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Fri, 15 Nov 2024 17:39:54 -0800 Subject: [PATCH 06/10] itest: log pid of new nodes --- itest/litd_node.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/itest/litd_node.go b/itest/litd_node.go index 618ae17e1..7ec9a0296 100644 --- a/itest/litd_node.go +++ b/itest/litd_node.go @@ -653,6 +653,9 @@ func (hn *HarnessNode) Start(litdBinary string, litdError chan<- error, return err } + fmt.Printf("Starting node=%v, pid=%v\n", hn.Cfg.Name, + hn.cmd.Process.Pid) + // Launch a new goroutine which that bubbles up any potential fatal // process errors to the goroutine running the tests. hn.processExit = make(chan struct{}) From 23039a92b04a74ccd276a120ca63ce1f06159e38 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Thu, 23 May 2024 13:56:41 +0200 Subject: [PATCH 07/10] itest: add custom channel integration test Co-authored-by: Olaoluwa Osuntokun Co-authored-by: Gijs van Dam Co-authored-by: George Tsagkarelis --- go.mod | 4 +- itest/assertions.go | 46 +- itest/assets_test.go | 2120 ++++++++++++++++ itest/litd_accounts_test.go | 42 + itest/litd_custom_channels_test.go | 3807 ++++++++++++++++++++++++++++ itest/litd_node.go | 38 + itest/litd_test.go | 8 +- itest/litd_test_list_on_test.go | 52 + itest/log.go | 24 + itest/network_harness.go | 103 +- itest/oracle_test.go | 279 ++ 11 files changed, 6509 insertions(+), 14 deletions(-) create mode 100644 itest/assets_test.go create mode 100644 itest/litd_custom_channels_test.go create mode 100644 itest/log.go create mode 100644 itest/oracle_test.go diff --git a/go.mod b/go.mod index b39718923..8be9bf822 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 github.com/btcsuite/btclog v0.0.0-20241003133417-09c4e92e319c github.com/btcsuite/btcwallet/walletdb v1.4.4 + github.com/davecgh/go-spew v1.1.1 github.com/go-errors/errors v1.0.1 github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 github.com/improbable-eng/grpc-web v0.12.0 @@ -35,6 +36,7 @@ require ( github.com/urfave/cli v1.22.9 go.etcd.io/bbolt v1.3.11 golang.org/x/crypto v0.31.0 + golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 golang.org/x/net v0.27.0 golang.org/x/sync v0.10.0 google.golang.org/grpc v1.65.0 @@ -73,7 +75,6 @@ require ( github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect github.com/coreos/go-systemd/v22 v22.3.2 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/decred/dcrd/lru v1.1.2 // indirect @@ -201,7 +202,6 @@ require ( go.uber.org/mock v0.4.0 // indirect go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.23.0 // indirect - golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect golang.org/x/mod v0.17.0 // indirect golang.org/x/sys v0.28.0 // indirect golang.org/x/term v0.27.0 // indirect diff --git a/itest/assertions.go b/itest/assertions.go index 51a6feaf8..f6518fea7 100644 --- a/itest/assertions.go +++ b/itest/assertions.go @@ -3,14 +3,18 @@ package itest import ( "context" "fmt" + "testing" "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/wire" + "github.com/lightninglabs/taproot-assets/taprpc" "github.com/lightningnetwork/lnd/channeldb" "github.com/lightningnetwork/lnd/lnrpc" + "github.com/lightningnetwork/lnd/lnrpc/walletrpc" "github.com/lightningnetwork/lnd/lntest" "github.com/lightningnetwork/lnd/lntest/wait" "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" ) // shutdownAndAssert shuts down the given node and asserts that no errors @@ -172,24 +176,25 @@ func assertChannelClosed(ctx context.Context, t *harnessTest, // block. block := mineBlocks(t, net, 1, 1)[0] - closingTxid, err := net.WaitForChannelClose(closeUpdates) + closingUpdate, err := net.WaitForChannelClose(closeUpdates) require.NoError(t.t, err, "error while waiting for channel close") + closingTxid, err := chainhash.NewHash(closingUpdate.ClosingTxid) + require.NoError(t.t, err) assertTxInBlock(t, block, closingTxid) // Finally, the transaction should no longer be in the waiting close // state as we've just mined a block that should include the closing // transaction. err = wait.Predicate(func() bool { - pendingChansRequest := &lnrpc.PendingChannelsRequest{} - pendingChanResp, err := node.PendingChannels( - ctx, pendingChansRequest, + resp, err := node.PendingChannels( + ctx, &lnrpc.PendingChannelsRequest{}, ) if err != nil { return false } - for _, pendingClose := range pendingChanResp.WaitingCloseChannels { + for _, pendingClose := range resp.WaitingCloseChannels { if pendingClose.Channel.ChannelPoint == chanPointStr { return false } @@ -203,3 +208,34 @@ func assertChannelClosed(ctx context.Context, t *harnessTest, return closingTxid } + +func assertSweepExists(t *testing.T, node *HarnessNode, + witnessType walletrpc.WitnessType) { + + ctxb := context.Background() + err := wait.NoError(func() error { + pendingSweeps, err := node.WalletKitClient.PendingSweeps( + ctxb, &walletrpc.PendingSweepsRequest{}, + ) + if err != nil { + return err + } + + for _, sweep := range pendingSweeps.PendingSweeps { + if sweep.WitnessType == witnessType { + return nil + } + } + + return fmt.Errorf("failed to find second level sweep: %v", + toProtoJSON(t, pendingSweeps)) + }, defaultTimeout) + require.NoError(t, err) +} + +func toProtoJSON(t *testing.T, resp proto.Message) string { + jsonBytes, err := taprpc.ProtoJSONMarshalOpts.Marshal(resp) + require.NoError(t, err) + + return string(jsonBytes) +} diff --git a/itest/assets_test.go b/itest/assets_test.go new file mode 100644 index 000000000..b46c5f367 --- /dev/null +++ b/itest/assets_test.go @@ -0,0 +1,2120 @@ +package itest + +import ( + "bytes" + "context" + "crypto/rand" + "encoding/hex" + "encoding/json" + "fmt" + "os" + "testing" + "time" + + "github.com/btcsuite/btcd/btcec/v2" + "github.com/btcsuite/btcd/btcec/v2/schnorr" + "github.com/btcsuite/btcd/btcutil" + "github.com/btcsuite/btcd/chaincfg/chainhash" + "github.com/btcsuite/btcd/wire" + "github.com/davecgh/go-spew/spew" + tapfn "github.com/lightninglabs/taproot-assets/fn" + "github.com/lightninglabs/taproot-assets/itest" + "github.com/lightninglabs/taproot-assets/proof" + "github.com/lightninglabs/taproot-assets/rfq" + "github.com/lightninglabs/taproot-assets/rfqmath" + "github.com/lightninglabs/taproot-assets/rfqmsg" + "github.com/lightninglabs/taproot-assets/tapfreighter" + "github.com/lightninglabs/taproot-assets/taprpc" + "github.com/lightninglabs/taproot-assets/taprpc/assetwalletrpc" + "github.com/lightninglabs/taproot-assets/taprpc/mintrpc" + "github.com/lightninglabs/taproot-assets/taprpc/rfqrpc" + tchrpc "github.com/lightninglabs/taproot-assets/taprpc/tapchannelrpc" + "github.com/lightninglabs/taproot-assets/taprpc/tapdevrpc" + "github.com/lightninglabs/taproot-assets/taprpc/universerpc" + "github.com/lightninglabs/taproot-assets/tapscript" + "github.com/lightningnetwork/lnd/fn" + "github.com/lightningnetwork/lnd/lnrpc" + "github.com/lightningnetwork/lnd/lnrpc/invoicesrpc" + "github.com/lightningnetwork/lnd/lnrpc/routerrpc" + "github.com/lightningnetwork/lnd/lntest/rpc" + "github.com/lightningnetwork/lnd/lntest/wait" + "github.com/lightningnetwork/lnd/lntypes" + "github.com/lightningnetwork/lnd/lnwire" + "github.com/lightningnetwork/lnd/macaroons" + "github.com/lightningnetwork/lnd/record" + "github.com/stretchr/testify/require" + "golang.org/x/exp/maps" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials" + "gopkg.in/macaroon.v2" +) + +// PaymentTimeout is the default payment timeout we use in our tests. +const ( + PaymentTimeout = 12 * time.Second + DefaultPushSat int64 = 1062 +) + +// nolint: lll +var ( + failureNoBalance = lnrpc.PaymentFailureReason_FAILURE_REASON_INSUFFICIENT_BALANCE + failureNoRoute = lnrpc.PaymentFailureReason_FAILURE_REASON_NO_ROUTE + failureIncorrectDetails = lnrpc.PaymentFailureReason_FAILURE_REASON_INCORRECT_PAYMENT_DETAILS + failureTimeout = lnrpc.PaymentFailureReason_FAILURE_REASON_TIMEOUT + failureNone = lnrpc.PaymentFailureReason_FAILURE_REASON_NONE +) + +// createTestAssetNetwork sends asset funds from Charlie to Dave and Erin, so +// they can fund asset channels with Yara and Fabia, respectively. So the asset +// channels created are Charlie->Dave, Dave->Yara, Erin->Fabia. The channels +// are then confirmed and balances asserted. +func createTestAssetNetwork(t *harnessTest, net *NetworkHarness, charlieTap, + daveTap, erinTap, fabiaTap, yaraTap, universeTap *tapClient, + mintedAsset *taprpc.Asset, assetSendAmount, charlieFundingAmount, + daveFundingAmount, + erinFundingAmount uint64, pushSat int64) (*lnrpc.ChannelPoint, + *lnrpc.ChannelPoint, *lnrpc.ChannelPoint) { + + ctxb := context.Background() + assetID := mintedAsset.AssetGenesis.AssetId + var groupKey []byte + if mintedAsset.AssetGroup != nil { + groupKey = mintedAsset.AssetGroup.TweakedGroupKey + } + + fundingScriptTree := tapscript.NewChannelFundingScriptTree() + fundingScriptKey := fundingScriptTree.TaprootKey + fundingScriptTreeBytes := fundingScriptKey.SerializeCompressed() + + // We need to send some assets to Dave, so he can fund an asset channel + // with Yara. + daveAddr, err := daveTap.NewAddr(ctxb, &taprpc.NewAddrRequest{ + Amt: assetSendAmount, + AssetId: assetID, + ProofCourierAddr: fmt.Sprintf( + "%s://%s", proof.UniverseRpcCourierType, + charlieTap.node.Cfg.LitAddr(), + ), + }) + require.NoError(t.t, err) + + t.Logf("Sending %v asset units to Dave...", assetSendAmount) + + // Send the assets to Dave. + itest.AssertAddrCreated(t.t, daveTap, mintedAsset, daveAddr) + sendResp, err := charlieTap.SendAsset(ctxb, &taprpc.SendAssetRequest{ + TapAddrs: []string{daveAddr.Encoded}, + }) + require.NoError(t.t, err) + itest.ConfirmAndAssertOutboundTransfer( + t.t, t.lndHarness.Miner.Client, charlieTap, sendResp, assetID, + []uint64{mintedAsset.Amount - assetSendAmount, assetSendAmount}, + 0, 1, + ) + itest.AssertNonInteractiveRecvComplete(t.t, daveTap, 1) + + // We need to send some assets to Erin, so he can fund an asset channel + // with Fabia. + erinAddr, err := erinTap.NewAddr(ctxb, &taprpc.NewAddrRequest{ + Amt: assetSendAmount, + AssetId: assetID, + ProofCourierAddr: fmt.Sprintf( + "%s://%s", proof.UniverseRpcCourierType, + charlieTap.node.Cfg.LitAddr(), + ), + }) + require.NoError(t.t, err) + + t.Logf("Sending %v asset units to Erin...", assetSendAmount) + + // Send the assets to Erin. + itest.AssertAddrCreated(t.t, erinTap, mintedAsset, erinAddr) + sendResp, err = charlieTap.SendAsset(ctxb, &taprpc.SendAssetRequest{ + TapAddrs: []string{erinAddr.Encoded}, + }) + require.NoError(t.t, err) + itest.ConfirmAndAssertOutboundTransfer( + t.t, t.lndHarness.Miner.Client, charlieTap, sendResp, assetID, + []uint64{ + mintedAsset.Amount - 2*assetSendAmount, assetSendAmount, + }, 1, 2, + ) + itest.AssertNonInteractiveRecvComplete(t.t, erinTap, 1) + + t.Logf("Opening asset channels...") + + // The first channel we create has a push amount, so Charlie can receive + // payments immediately and not run into the channel reserve issue. + fundRespCD, err := charlieTap.FundChannel( + ctxb, &tchrpc.FundChannelRequest{ + AssetAmount: charlieFundingAmount, + AssetId: assetID, + PeerPubkey: daveTap.node.PubKey[:], + FeeRateSatPerVbyte: 5, + PushSat: pushSat, + }, + ) + require.NoError(t.t, err) + t.Logf("Funded channel between Charlie and Dave: %v", fundRespCD) + + fundRespDY, err := daveTap.FundChannel( + ctxb, &tchrpc.FundChannelRequest{ + AssetAmount: daveFundingAmount, + AssetId: assetID, + PeerPubkey: yaraTap.node.PubKey[:], + FeeRateSatPerVbyte: 5, + }, + ) + require.NoError(t.t, err) + t.Logf("Funded channel between Dave and Yara: %v", fundRespDY) + + fundRespEF, err := erinTap.FundChannel( + ctxb, &tchrpc.FundChannelRequest{ + AssetAmount: erinFundingAmount, + AssetId: assetID, + PeerPubkey: fabiaTap.node.PubKey[:], + FeeRateSatPerVbyte: 5, + PushSat: pushSat, + }, + ) + require.NoError(t.t, err) + t.Logf("Funded channel between Erin and Fabia: %v", fundRespEF) + + // Make sure the pending channel shows up in the list and has the + // custom records set as JSON. + assertPendingChannels( + t.t, charlieTap.node, mintedAsset, 1, charlieFundingAmount, 0, + ) + assertPendingChannels( + t.t, daveTap.node, mintedAsset, 2, daveFundingAmount, + charlieFundingAmount, + ) + assertPendingChannels( + t.t, erinTap.node, mintedAsset, 1, erinFundingAmount, 0, + ) + + // Now that we've looked at the pending channels, let's actually confirm + // all three of them. + mineBlocks(t, net, 6, 3) + + // We'll be tracking the expected asset balances throughout the test, so + // we can assert it after each action. + charlieAssetBalance := mintedAsset.Amount - 2*assetSendAmount - + charlieFundingAmount + daveAssetBalance := assetSendAmount - daveFundingAmount + erinAssetBalance := assetSendAmount - erinFundingAmount + + // After opening the channels, the asset balance of the funding nodes + // should have been decreased with the funding amount. The asset with + // the funding output was imported into the asset DB but are kept out of + // the balance reporting by tapd. + assertAssetBalance(t.t, charlieTap, assetID, charlieAssetBalance) + assertAssetBalance(t.t, daveTap, assetID, daveAssetBalance) + assertAssetBalance(t.t, erinTap, assetID, erinAssetBalance) + + // There should only be a single asset piece for Charlie, the one in the + // channel. + assertNumAssetOutputs(t.t, charlieTap, assetID, 1) + assertAssetExists( + t.t, charlieTap, assetID, charlieFundingAmount, + fundingScriptKey, false, true, true, + ) + + // Dave should just have one asset piece, since we used the full amount + // for the channel opening. + assertNumAssetOutputs(t.t, daveTap, assetID, 1) + assertAssetExists( + t.t, daveTap, assetID, daveFundingAmount, fundingScriptKey, + false, true, true, + ) + + // Erin should just have two equally sized asset pieces, the change and + // the funding transaction. + assertNumAssetOutputs(t.t, erinTap, assetID, 2) + assertAssetExists( + t.t, erinTap, assetID, assetSendAmount-erinFundingAmount, nil, + true, false, false, + ) + assertAssetExists( + t.t, erinTap, assetID, erinFundingAmount, fundingScriptKey, + false, true, true, + ) + + // Assert that the proofs for both channels has been uploaded to the + // designated Universe server. + assertUniverseProofExists( + t.t, universeTap, assetID, groupKey, fundingScriptTreeBytes, + fmt.Sprintf("%v:%v", fundRespCD.Txid, fundRespCD.OutputIndex), + ) + assertUniverseProofExists( + t.t, universeTap, assetID, groupKey, fundingScriptTreeBytes, + fmt.Sprintf("%v:%v", fundRespDY.Txid, fundRespDY.OutputIndex), + ) + assertUniverseProofExists( + t.t, universeTap, assetID, groupKey, fundingScriptTreeBytes, + fmt.Sprintf("%v:%v", fundRespEF.Txid, fundRespEF.OutputIndex), + ) + + // Make sure the channel shows the correct asset information. + assertAssetChan( + t.t, charlieTap.node, daveTap.node, charlieFundingAmount, + mintedAsset, + ) + assertAssetChan( + t.t, daveTap.node, yaraTap.node, daveFundingAmount, mintedAsset, + ) + assertAssetChan( + t.t, erinTap.node, fabiaTap.node, erinFundingAmount, + mintedAsset, + ) + + chanPointCD := &lnrpc.ChannelPoint{ + OutputIndex: uint32(fundRespCD.OutputIndex), + FundingTxid: &lnrpc.ChannelPoint_FundingTxidStr{ + FundingTxidStr: fundRespCD.Txid, + }, + } + chanPointDY := &lnrpc.ChannelPoint{ + OutputIndex: uint32(fundRespDY.OutputIndex), + FundingTxid: &lnrpc.ChannelPoint_FundingTxidStr{ + FundingTxidStr: fundRespDY.Txid, + }, + } + chanPointEF := &lnrpc.ChannelPoint{ + OutputIndex: uint32(fundRespEF.OutputIndex), + FundingTxid: &lnrpc.ChannelPoint_FundingTxidStr{ + FundingTxidStr: fundRespEF.Txid, + }, + } + + return chanPointCD, chanPointDY, chanPointEF +} + +func assertNumAssetUTXOs(t *testing.T, tapdClient *tapClient, + numUTXOs int) *taprpc.ListUtxosResponse { + + ctxb := context.Background() + + var clientUTXOs *taprpc.ListUtxosResponse + err := wait.NoError(func() error { + var err error + clientUTXOs, err = tapdClient.ListUtxos( + ctxb, &taprpc.ListUtxosRequest{}, + ) + if err != nil { + return err + } + + if len(clientUTXOs.ManagedUtxos) != numUTXOs { + return fmt.Errorf("expected %v UTXO, got %d", numUTXOs, + len(clientUTXOs.ManagedUtxos)) + } + + return nil + }, defaultTimeout) + require.NoErrorf(t, err, "failed to assert UTXOs: %v, last state: %v", + err, clientUTXOs) + + return clientUTXOs +} + +func locateAssetTransfers(t *testing.T, tapdClient *tapClient, + txid chainhash.Hash) *taprpc.AssetTransfer { + + var transfer *taprpc.AssetTransfer + err := wait.NoError(func() error { + ctxb := context.Background() + forceCloseTransfer, err := tapdClient.ListTransfers( + ctxb, &taprpc.ListTransfersRequest{ + AnchorTxid: txid.String(), + }, + ) + if err != nil { + return fmt.Errorf("unable to list %v transfers: %w", + tapdClient.node.Name(), err) + } + if len(forceCloseTransfer.Transfers) != 1 { + return fmt.Errorf("%v is missing force close "+ + "transfer", tapdClient.node.Name()) + } + + transfer = forceCloseTransfer.Transfers[0] + + if transfer.AnchorTxBlockHash == nil { + return fmt.Errorf("missing anchor block hash, " + + "transfer not confirmed") + } + + return nil + }, defaultTimeout) + require.NoError(t, err) + + return transfer +} + +func connectAllNodes(t *testing.T, net *NetworkHarness, nodes []*HarnessNode) { + for i, node := range nodes { + for j := i + 1; j < len(nodes); j++ { + peer := nodes[j] + net.ConnectNodesPerm(t, node, peer) + } + } +} + +func fundAllNodes(t *testing.T, net *NetworkHarness, nodes []*HarnessNode) { + for _, node := range nodes { + net.SendCoins(t, btcutil.SatoshiPerBitcoin, node) + } +} + +func syncUniverses(t *testing.T, universe *tapClient, nodes ...*HarnessNode) { + ctxb := context.Background() + ctxt, cancel := context.WithTimeout(ctxb, defaultTimeout) + defer cancel() + + for _, node := range nodes { + nodeTapClient := newTapClient(t, node) + + universeHostAddr := universe.node.Cfg.LitAddr() + t.Logf("Syncing node %v with universe %v", node.Cfg.Name, + universeHostAddr) + + itest.SyncUniverses( + ctxt, t, nodeTapClient, universe, universeHostAddr, + defaultTimeout, + ) + } +} + +func assertUniverseProofExists(t *testing.T, universe *tapClient, + assetID, groupKey, scriptKey []byte, outpoint string) *taprpc.Asset { + + t.Logf("Asserting proof outpoint=%v, script_key=%x", outpoint, + scriptKey) + + req := &universerpc.UniverseKey{ + Id: &universerpc.ID{ + ProofType: universerpc.ProofType_PROOF_TYPE_TRANSFER, + }, + LeafKey: &universerpc.AssetKey{ + Outpoint: &universerpc.AssetKey_OpStr{ + OpStr: outpoint, + }, + ScriptKey: &universerpc.AssetKey_ScriptKeyBytes{ + ScriptKeyBytes: scriptKey, + }, + }, + } + + switch { + case len(groupKey) > 0: + req.Id.Id = &universerpc.ID_GroupKey{ + GroupKey: groupKey, + } + + case len(assetID) > 0: + req.Id.Id = &universerpc.ID_AssetId{ + AssetId: assetID, + } + + default: + t.Fatalf("Need either asset ID or group key") + } + + ctxb := context.Background() + var proofResp *universerpc.AssetProofResponse + err := wait.NoError(func() error { + var pErr error + proofResp, pErr = universe.QueryProof(ctxb, req) + return pErr + }, defaultTimeout) + require.NoError( + t, err, "%v: outpoint=%v, script_key=%x", err, outpoint, + scriptKey, + ) + + if len(groupKey) > 0 { + require.NotNil(t, proofResp.AssetLeaf.Asset.AssetGroup) + require.Equal( + t, proofResp.AssetLeaf.Asset.AssetGroup.TweakedGroupKey, + groupKey, + ) + } else { + require.Equal( + t, proofResp.AssetLeaf.Asset.AssetGenesis.AssetId, + assetID, + ) + } + + a := proofResp.AssetLeaf.Asset + t.Logf("Proof found for scriptKey=%x, amount=%d", a.ScriptKey, a.Amount) + + return a +} + +func assertPendingChannels(t *testing.T, node *HarnessNode, + mintedAsset *taprpc.Asset, numChannels int, localSum, + remoteSum uint64) { + + ctxb := context.Background() + ctxt, cancel := context.WithTimeout(ctxb, defaultTimeout) + defer cancel() + + pendingChannelsResp, err := node.PendingChannels( + ctxt, &lnrpc.PendingChannelsRequest{}, + ) + require.NoError(t, err) + require.Len(t, pendingChannelsResp.PendingOpenChannels, numChannels) + + pendingChan := pendingChannelsResp.PendingOpenChannels[0] + var pendingJSON rfqmsg.JsonAssetChannel + err = json.Unmarshal( + pendingChan.Channel.CustomChannelData, &pendingJSON, + ) + require.NoError(t, err) + require.Len(t, pendingJSON.Assets, 1) + + require.NotZero(t, pendingJSON.Assets[0].Capacity) + + // Check the decimal display of the channel funding blob. If no explicit + // value was set, we assume and expect the value of 0. + var expectedDecimalDisplay uint8 + if mintedAsset.DecimalDisplay != nil { + expectedDecimalDisplay = uint8( + mintedAsset.DecimalDisplay.DecimalDisplay, + ) + } + + require.Equal( + t, expectedDecimalDisplay, + pendingJSON.Assets[0].AssetInfo.DecimalDisplay, + ) + + // Check the balance of the pending channel. + assetID := mintedAsset.AssetGenesis.AssetId + pendingLocalBalance, pendingRemoteBalance, _, _ := + getAssetChannelBalance( + t, node, assetID, true, + ) + require.EqualValues(t, localSum, pendingLocalBalance) + require.EqualValues(t, remoteSum, pendingRemoteBalance) +} + +func assertAssetChan(t *testing.T, src, dst *HarnessNode, fundingAmount uint64, + mintedAsset *taprpc.Asset) { + + assetID := mintedAsset.AssetGenesis.AssetId + assetIDStr := hex.EncodeToString(assetID) + err := wait.NoError(func() error { + a, err := getChannelCustomData(src, dst) + if err != nil { + return err + } + + if a.AssetInfo.AssetGenesis.AssetID != assetIDStr { + return fmt.Errorf("expected asset ID %s, got %s", + assetIDStr, a.AssetInfo.AssetGenesis.AssetID) + } + if a.Capacity != fundingAmount { + return fmt.Errorf("expected capacity %d, got %d", + fundingAmount, a.Capacity) + } + + // Check the decimal display of the channel funding blob. If no + // explicit value was set, we assume and expect the value of 0. + var expectedDecimalDisplay uint8 + if mintedAsset.DecimalDisplay != nil { + expectedDecimalDisplay = uint8( + mintedAsset.DecimalDisplay.DecimalDisplay, + ) + } + + if a.AssetInfo.DecimalDisplay != expectedDecimalDisplay { + return fmt.Errorf("expected decimal display %d, got %d", + expectedDecimalDisplay, + a.AssetInfo.DecimalDisplay) + } + + return nil + }, defaultTimeout) + require.NoError(t, err) +} + +func assertChannelKnown(t *testing.T, node *HarnessNode, + chanPoint *lnrpc.ChannelPoint) { + + ctxb := context.Background() + ctxt, cancel := context.WithTimeout(ctxb, defaultTimeout) + defer cancel() + + txid, err := chainhash.NewHash(chanPoint.GetFundingTxidBytes()) + require.NoError(t, err) + targetChanPoint := fmt.Sprintf( + "%v:%d", txid.String(), chanPoint.OutputIndex, + ) + + err = wait.NoError(func() error { + graphResp, err := node.DescribeGraph( + ctxt, &lnrpc.ChannelGraphRequest{}, + ) + if err != nil { + return err + } + + found := false + for _, edge := range graphResp.Edges { + if edge.ChanPoint == targetChanPoint { + found = true + break + } + } + + if !found { + return fmt.Errorf("channel %v not found", + targetChanPoint) + } + + return nil + }, defaultTimeout) + require.NoError(t, err) +} + +func getChannelCustomData(src, dst *HarnessNode) (*rfqmsg.JsonAssetChanInfo, + error) { + + ctxb := context.Background() + ctxt, cancel := context.WithTimeout(ctxb, defaultTimeout) + defer cancel() + + srcDestChannels, err := src.ListChannels( + ctxt, &lnrpc.ListChannelsRequest{ + Peer: dst.PubKey[:], + }, + ) + if err != nil { + return nil, err + } + + assetChannels := fn.Filter(func(c *lnrpc.Channel) bool { + return len(c.CustomChannelData) > 0 + }, srcDestChannels.Channels) + + if len(assetChannels) != 1 { + return nil, fmt.Errorf("expected 1 asset channel, got %d: %v", + len(assetChannels), spew.Sdump(assetChannels)) + } + + targetChan := assetChannels[0] + + var assetData rfqmsg.JsonAssetChannel + err = json.Unmarshal(targetChan.CustomChannelData, &assetData) + if err != nil { + return nil, fmt.Errorf("unable to unmarshal asset data: %w", + err) + } + + if len(assetData.Assets) != 1 { + return nil, fmt.Errorf("expected 1 asset, got %d", + len(assetData.Assets)) + } + + return &assetData.Assets[0], nil +} + +func getAssetChannelBalance(t *testing.T, node *HarnessNode, assetID []byte, + pending bool) (uint64, uint64, uint64, uint64) { + + ctxb := context.Background() + ctxt, cancel := context.WithTimeout(ctxb, defaultTimeout) + defer cancel() + + balance, err := node.ChannelBalance( + ctxt, &lnrpc.ChannelBalanceRequest{}, + ) + require.NoError(t, err) + + var assetBalance rfqmsg.JsonAssetChannelBalances + err = json.Unmarshal(balance.CustomChannelData, &assetBalance) + require.NoError(t, err) + + balances := assetBalance.OpenChannels + if pending { + balances = assetBalance.PendingChannels + } + + var localSum, remoteSum uint64 + for assetIDString := range balances { + if assetIDString != hex.EncodeToString(assetID) { + continue + } + + localSum += balances[assetIDString].LocalBalance + remoteSum += balances[assetIDString].RemoteBalance + } + + return localSum, remoteSum, balance.LocalBalance.Sat, + balance.RemoteBalance.Sat +} + +func fetchChannel(t *testing.T, node *HarnessNode, + chanPoint *lnrpc.ChannelPoint) *lnrpc.Channel { + + ctxb := context.Background() + ctxt, cancel := context.WithTimeout(ctxb, defaultTimeout) + defer cancel() + + channelResp, err := node.ListChannels(ctxt, &lnrpc.ListChannelsRequest{ + ActiveOnly: true, + }) + require.NoError(t, err) + + chanFundingHash, err := lnrpc.GetChanPointFundingTxid(chanPoint) + require.NoError(t, err) + + chanPointStr := fmt.Sprintf("%v:%v", chanFundingHash, + chanPoint.OutputIndex) + + var targetChan *lnrpc.Channel + for _, channel := range channelResp.Channels { + if channel.ChannelPoint == chanPointStr { + targetChan = channel + + break + } + } + require.NotNil(t, targetChan) + + return targetChan +} + +func assertChannelSatBalance(t *testing.T, node *HarnessNode, + chanPoint *lnrpc.ChannelPoint, local, remote int64) { + + targetChan := fetchChannel(t, node, chanPoint) + + require.InDelta(t, local, targetChan.LocalBalance, 1) + require.InDelta(t, remote, targetChan.RemoteBalance, 1) +} + +func assertChannelAssetBalance(t *testing.T, node *HarnessNode, + chanPoint *lnrpc.ChannelPoint, local, remote uint64) { + + targetChan := fetchChannel(t, node, chanPoint) + + var assetBalance rfqmsg.JsonAssetChannel + err := json.Unmarshal(targetChan.CustomChannelData, &assetBalance) + require.NoError(t, err) + + require.Len(t, assetBalance.Assets, 1) + + require.InDelta(t, local, assetBalance.Assets[0].LocalBalance, 1) + require.InDelta(t, remote, assetBalance.Assets[0].RemoteBalance, 1) +} + +// addRoutingFee adds the default routing fee (1 part per million fee rate plus +// 1000 milli-satoshi base fee) to the given milli-satoshi amount. +func addRoutingFee(amt lnwire.MilliSatoshi) lnwire.MilliSatoshi { + return amt + (amt / 1000_000) + 1000 +} + +func sendAssetKeySendPayment(t *testing.T, src, dst *HarnessNode, amt uint64, + assetID []byte, btcAmt fn.Option[int64], opts ...payOpt) { + + cfg := defaultPayConfig() + for _, opt := range opts { + opt(cfg) + } + + ctxb := context.Background() + ctxt, cancel := context.WithTimeout(ctxb, defaultTimeout) + defer cancel() + + srcTapd := newTapClient(t, src) + + // Read out the custom preimage for the keysend payment. + var preimage lntypes.Preimage + _, err := rand.Read(preimage[:]) + require.NoError(t, err) + + hash := preimage.Hash() + + // Set the preimage. If the user supplied a preimage with the data + // flag, the preimage that is set here will be overwritten later. + customRecords := make(map[uint64][]byte) + customRecords[record.KeySendType] = preimage[:] + + sendReq := &routerrpc.SendPaymentRequest{ + Dest: dst.PubKey[:], + Amt: btcAmt.UnwrapOr(500), + DestCustomRecords: customRecords, + PaymentHash: hash[:], + TimeoutSeconds: int32(PaymentTimeout.Seconds()), + } + + stream, err := srcTapd.SendPayment(ctxt, &tchrpc.SendPaymentRequest{ + AssetId: assetID, + AssetAmount: amt, + PaymentRequest: sendReq, + }) + require.NoError(t, err) + + result, err := getAssetPaymentResult(stream, false) + require.NoError(t, err) + if result.Status == lnrpc.Payment_FAILED { + t.Logf("Failure reason: %v", result.FailureReason) + } + require.Equal(t, cfg.payStatus, result.Status) + require.Equal(t, cfg.failureReason, result.FailureReason) +} + +func sendKeySendPayment(t *testing.T, src, dst *HarnessNode, + amt btcutil.Amount) { + + ctxb := context.Background() + ctxt, cancel := context.WithTimeout(ctxb, defaultTimeout) + defer cancel() + + // Read out the custom preimage for the keysend payment. + var preimage lntypes.Preimage + _, err := rand.Read(preimage[:]) + require.NoError(t, err) + + hash := preimage.Hash() + + // Set the preimage. If the user supplied a preimage with the data + // flag, the preimage that is set here will be overwritten later. + customRecords := make(map[uint64][]byte) + customRecords[record.KeySendType] = preimage[:] + + req := &routerrpc.SendPaymentRequest{ + Dest: dst.PubKey[:], + Amt: int64(amt), + DestCustomRecords: customRecords, + PaymentHash: hash[:], + TimeoutSeconds: int32(PaymentTimeout.Seconds()), + } + + stream, err := src.RouterClient.SendPaymentV2(ctxt, req) + require.NoError(t, err) + + result, err := getPaymentResult(stream) + require.NoError(t, err) + require.Equal(t, lnrpc.Payment_SUCCEEDED, result.Status) +} + +func createAndPayNormalInvoiceWithBtc(t *testing.T, src, dst *HarnessNode, + amountSat btcutil.Amount) { + + ctxb := context.Background() + ctxt, cancel := context.WithTimeout(ctxb, defaultTimeout) + defer cancel() + + expirySeconds := 10 + invoiceResp, err := dst.AddInvoice(ctxt, &lnrpc.Invoice{ + Value: int64(amountSat), + Memo: "normal invoice", + Expiry: int64(expirySeconds), + }) + require.NoError(t, err) + + payInvoiceWithSatoshi(t, src, invoiceResp) +} + +func createAndPayNormalInvoice(t *testing.T, src, rfqPeer, dst *HarnessNode, + amountSat btcutil.Amount, assetID []byte, opts ...payOpt) uint64 { + + ctxb := context.Background() + ctxt, cancel := context.WithTimeout(ctxb, defaultTimeout) + defer cancel() + + expirySeconds := 10 + invoiceResp, err := dst.AddInvoice(ctxt, &lnrpc.Invoice{ + Value: int64(amountSat), + Memo: "normal invoice", + Expiry: int64(expirySeconds), + }) + require.NoError(t, err) + + numUnits, _ := payInvoiceWithAssets( + t, src, rfqPeer, invoiceResp.PaymentRequest, assetID, opts..., + ) + + return numUnits +} + +func payInvoiceWithSatoshi(t *testing.T, payer *HarnessNode, + invoice *lnrpc.AddInvoiceResponse, opts ...payOpt) { + + cfg := defaultPayConfig() + for _, opt := range opts { + opt(cfg) + } + + ctxb := context.Background() + ctxt, cancel := context.WithTimeout(ctxb, defaultTimeout) + defer cancel() + + sendReq := &routerrpc.SendPaymentRequest{ + PaymentRequest: invoice.PaymentRequest, + TimeoutSeconds: int32(PaymentTimeout.Seconds()), + MaxShardSizeMsat: 80_000_000, + FeeLimitMsat: 1_000_000, + } + stream, err := payer.RouterClient.SendPaymentV2(ctxt, sendReq) + require.NoError(t, err) + + result, err := getPaymentResult(stream) + if cfg.errSubStr != "" { + require.ErrorContains(t, err, cfg.errSubStr) + } else { + require.NoError(t, err) + require.Equal(t, cfg.payStatus, result.Status) + require.Equal(t, cfg.failureReason, result.FailureReason) + } +} + +func payInvoiceWithSatoshiLastHop(t *testing.T, payer *HarnessNode, + invoice *lnrpc.AddInvoiceResponse, hopPub []byte, + expectedStatus lnrpc.Payment_PaymentStatus) { + + ctxb := context.Background() + ctxt, cancel := context.WithTimeout(ctxb, defaultTimeout) + defer cancel() + + routeRes, err := payer.RouterClient.BuildRoute( + ctxb, &routerrpc.BuildRouteRequest{ + AmtMsat: 17800, + FinalCltvDelta: 80, + PaymentAddr: invoice.PaymentAddr, + HopPubkeys: [][]byte{hopPub}, + }, + ) + require.NoError(t, err) + + res, err := payer.RouterClient.SendToRouteV2( + ctxt, &routerrpc.SendToRouteRequest{ + PaymentHash: invoice.RHash, + Route: routeRes.Route, + }, + ) + + switch expectedStatus { + case lnrpc.Payment_FAILED: + require.NoError(t, err) + require.Equal(t, lnrpc.HTLCAttempt_FAILED, res.Status) + require.Nil(t, res.Preimage) + + case lnrpc.Payment_SUCCEEDED: + require.NoError(t, err) + require.Equal(t, lnrpc.HTLCAttempt_SUCCEEDED, res.Status) + } +} + +type payConfig struct { + smallShards bool + errSubStr string + allowOverpay bool + feeLimit lnwire.MilliSatoshi + payStatus lnrpc.Payment_PaymentStatus + failureReason lnrpc.PaymentFailureReason + rfq fn.Option[rfqmsg.ID] +} + +func defaultPayConfig() *payConfig { + return &payConfig{ + smallShards: false, + errSubStr: "", + feeLimit: 1_000_000, + payStatus: lnrpc.Payment_SUCCEEDED, + failureReason: lnrpc.PaymentFailureReason_FAILURE_REASON_NONE, + } +} + +type payOpt func(*payConfig) + +func withSmallShards() payOpt { + return func(c *payConfig) { + c.smallShards = true + } +} + +func withPayErrSubStr(errSubStr string) payOpt { + return func(c *payConfig) { + c.errSubStr = errSubStr + } +} + +func withFailure(status lnrpc.Payment_PaymentStatus, + reason lnrpc.PaymentFailureReason) payOpt { + + return func(c *payConfig) { + c.payStatus = status + c.failureReason = reason + } +} + +func withRFQ(rfqID rfqmsg.ID) payOpt { + return func(c *payConfig) { + c.rfq = fn.Some(rfqID) + } +} + +func withFeeLimit(limit lnwire.MilliSatoshi) payOpt { + return func(c *payConfig) { + c.feeLimit = limit + } +} + +func withAllowOverpay() payOpt { + return func(c *payConfig) { + c.allowOverpay = true + } +} + +func payInvoiceWithAssets(t *testing.T, payer, rfqPeer *HarnessNode, + payReq string, assetID []byte, + opts ...payOpt) (uint64, rfqmath.BigIntFixedPoint) { + + cfg := defaultPayConfig() + for _, opt := range opts { + opt(cfg) + } + + ctxb := context.Background() + ctxt, cancel := context.WithTimeout(ctxb, defaultTimeout) + defer cancel() + + payerTapd := newTapClient(t, payer) + + decodedInvoice, err := payer.DecodePayReq(ctxt, &lnrpc.PayReqString{ + PayReq: payReq, + }) + require.NoError(t, err) + + sendReq := &routerrpc.SendPaymentRequest{ + PaymentRequest: payReq, + TimeoutSeconds: int32(PaymentTimeout.Seconds()), + FeeLimitMsat: int64(cfg.feeLimit), + } + + if cfg.smallShards { + sendReq.MaxShardSizeMsat = 80_000_000 + } + + var rfqBytes []byte + cfg.rfq.WhenSome(func(i rfqmsg.ID) { + rfqBytes = make([]byte, len(i[:])) + copy(rfqBytes, i[:]) + }) + + stream, err := payerTapd.SendPayment(ctxt, &tchrpc.SendPaymentRequest{ + AssetId: assetID, + PeerPubkey: rfqPeer.PubKey[:], + PaymentRequest: sendReq, + RfqId: rfqBytes, + AllowOverpay: cfg.allowOverpay, + }) + require.NoError(t, err) + + // If an error is returned by the RPC method (meaning the stream itself + // was established, no network or auth error), we expect the error to be + // returned on the first read on the stream. + if cfg.errSubStr != "" { + _, err := stream.Recv() + require.ErrorContains(t, err, cfg.errSubStr) + + return 0, rfqmath.BigIntFixedPoint{} + } + + var ( + numUnits uint64 + rateVal rfqmath.FixedPoint[rfqmath.BigInt] + ) + if cfg.rfq.IsNone() { + // We want to receive the accepted quote message first, so we + // know how many assets we're going to pay. + quoteMsg, err := stream.Recv() + require.NoError(t, err) + acceptedQuote := quoteMsg.GetAcceptedSellOrder() + require.NotNil(t, acceptedQuote) + + peerPubKey := acceptedQuote.Peer + require.Equal(t, peerPubKey, rfqPeer.PubKeyStr) + + rpcRate := acceptedQuote.BidAssetRate + rate, err := rfqrpc.UnmarshalFixedPoint(rpcRate) + require.NoError(t, err) + + rateVal = *rate + + t.Logf("Got quote for %v asset units per BTC", rate) + + amountMsat := lnwire.MilliSatoshi(decodedInvoice.NumMsat) + milliSatsFP := rfqmath.MilliSatoshiToUnits(amountMsat, *rate) + numUnits = milliSatsFP.ScaleTo(0).ToUint64() + msatPerUnit := float64(decodedInvoice.NumMsat) / + float64(numUnits) + t.Logf("Got quote for %v asset units at %3f msat/unit from "+ + "peer %s with SCID %d", numUnits, msatPerUnit, + peerPubKey, acceptedQuote.Scid) + } + + result, err := getAssetPaymentResult( + stream, cfg.payStatus == lnrpc.Payment_IN_FLIGHT, + ) + require.NoError(t, err) + require.Equal(t, cfg.payStatus, result.Status) + require.Equal(t, cfg.failureReason, result.FailureReason) + + return numUnits, rateVal +} + +type invoiceConfig struct { + errSubStr string +} + +func defaultInvoiceConfig() *invoiceConfig { + return &invoiceConfig{ + errSubStr: "", + } +} + +type invoiceOpt func(*invoiceConfig) + +func withInvoiceErrSubStr(errSubStr string) invoiceOpt { + return func(c *invoiceConfig) { + c.errSubStr = errSubStr + } +} + +func createAssetInvoice(t *testing.T, dstRfqPeer, dst *HarnessNode, + assetAmount uint64, assetID []byte, + opts ...invoiceOpt) *lnrpc.AddInvoiceResponse { + + cfg := defaultInvoiceConfig() + for _, opt := range opts { + opt(cfg) + } + + ctxb := context.Background() + ctxt, cancel := context.WithTimeout(ctxb, defaultTimeout) + defer cancel() + + timeoutSeconds := int64(rfq.DefaultInvoiceExpiry.Seconds()) + + t.Logf("Asking peer %x for quote to buy assets to receive for "+ + "invoice over %d units; waiting up to %ds", + dstRfqPeer.PubKey[:], assetAmount, timeoutSeconds) + + dstTapd := newTapClient(t, dst) + + resp, err := dstTapd.AddInvoice(ctxt, &tchrpc.AddInvoiceRequest{ + AssetId: assetID, + AssetAmount: assetAmount, + PeerPubkey: dstRfqPeer.PubKey[:], + InvoiceRequest: &lnrpc.Invoice{ + Memo: fmt.Sprintf("this is an asset invoice over "+ + "%d units", assetAmount), + Expiry: timeoutSeconds, + }, + }) + if cfg.errSubStr != "" { + require.ErrorContains(t, err, cfg.errSubStr) + + return nil + } else { + require.NoError(t, err) + } + + decodedInvoice, err := dst.DecodePayReq(ctxt, &lnrpc.PayReqString{ + PayReq: resp.InvoiceResult.PaymentRequest, + }) + require.NoError(t, err) + + rpcRate := resp.AcceptedBuyQuote.AskAssetRate + rate, err := rfqrpc.UnmarshalFixedPoint(rpcRate) + require.NoError(t, err) + + t.Logf("Got quote for %v asset units per BTC", rate) + + assetUnits := rfqmath.NewBigIntFixedPoint(assetAmount, 0) + numMSats := rfqmath.UnitsToMilliSatoshi(assetUnits, *rate) + mSatPerUnit := float64(decodedInvoice.NumMsat) / float64(assetAmount) + + require.EqualValues(t, numMSats, decodedInvoice.NumMsat) + + t.Logf("Got quote for %d mSats at %3f msat/unit from peer %x with "+ + "SCID %d", decodedInvoice.NumMsat, mSatPerUnit, + dstRfqPeer.PubKey[:], resp.AcceptedBuyQuote.Scid) + + return resp.InvoiceResult +} + +// assertInvoiceHtlcAssets makes sure the invoice with the given hash shows the +// individual HTLCs that arrived for it and that they show the correct asset +// amounts for the given ID when decoded. +func assertInvoiceHtlcAssets(t *testing.T, node *HarnessNode, + addedInvoice *lnrpc.AddInvoiceResponse, assetID []byte, + assetAmount uint64) { + + ctxb := context.Background() + ctxt, cancel := context.WithTimeout(ctxb, defaultTimeout) + defer cancel() + + invoice, err := node.InvoicesClient.LookupInvoiceV2( + ctxt, &invoicesrpc.LookupInvoiceMsg{ + InvoiceRef: &invoicesrpc.LookupInvoiceMsg_PaymentAddr{ + PaymentAddr: addedInvoice.PaymentAddr, + }, + }, + ) + require.NoError(t, err) + require.NotEmpty(t, invoice.Htlcs) + + t.Logf("Asset invoice: %v", toProtoJSON(t, invoice)) + + targetID := hex.EncodeToString(assetID) + + var totalAssetAmount uint64 + for _, htlc := range invoice.Htlcs { + require.NotEmpty(t, htlc.CustomChannelData) + + jsonHtlc := &rfqmsg.JsonHtlc{} + err := json.Unmarshal(htlc.CustomChannelData, jsonHtlc) + require.NoError(t, err) + + for _, balance := range jsonHtlc.Balances { + if balance.AssetID != targetID { + continue + } + + totalAssetAmount += balance.Amount + } + } + + // Due to rounding we allow up to 1 unit of error. + require.InDelta(t, assetAmount, totalAssetAmount, 1) +} + +// assertPaymentHtlcAssets makes sure the payment with the given hash shows the +// individual HTLCs that arrived for it and that they show the correct asset +// amounts for the given ID when decoded. +func assertPaymentHtlcAssets(t *testing.T, node *HarnessNode, payHash []byte, + assetID []byte, assetAmount uint64) { + + ctxb := context.Background() + ctxt, cancel := context.WithTimeout(ctxb, defaultTimeout) + defer cancel() + + stream, err := node.RouterClient.TrackPaymentV2( + ctxt, &routerrpc.TrackPaymentRequest{ + PaymentHash: payHash, + NoInflightUpdates: true, + }, + ) + require.NoError(t, err) + + payment, err := stream.Recv() + require.NoError(t, err) + require.NotNil(t, payment) + require.NotEmpty(t, payment.Htlcs) + + t.Logf("Asset payment: %v", toProtoJSON(t, payment)) + + targetID := hex.EncodeToString(assetID) + + var totalAssetAmount uint64 + for _, htlc := range payment.Htlcs { + require.NotNil(t, htlc.Route) + require.NotEmpty(t, htlc.Route.CustomChannelData) + + jsonHtlc := &rfqmsg.JsonHtlc{} + err := json.Unmarshal(htlc.Route.CustomChannelData, jsonHtlc) + require.NoError(t, err) + + for _, balance := range jsonHtlc.Balances { + if balance.AssetID != targetID { + continue + } + + totalAssetAmount += balance.Amount + } + } + + // Due to rounding we allow up to 1 unit of error. + require.InDelta(t, assetAmount, totalAssetAmount, 1) +} + +type assetHodlInvoice struct { + preimage lntypes.Preimage + payReq string +} + +func createAssetHodlInvoice(t *testing.T, dstRfqPeer, dst *HarnessNode, + assetAmount uint64, assetID []byte) assetHodlInvoice { + + ctxb := context.Background() + ctxt, cancel := context.WithTimeout(ctxb, defaultTimeout) + defer cancel() + + timeoutSeconds := int64(rfq.DefaultInvoiceExpiry.Seconds()) + + t.Logf("Asking peer %x for quote to buy assets to receive for "+ + "invoice over %d units; waiting up to %ds", + dstRfqPeer.PubKey[:], assetAmount, timeoutSeconds) + + dstTapd := newTapClient(t, dst) + + // As this is a hodl invoice, we'll also need to create a preimage + // external to lnd. + var preimage lntypes.Preimage + _, err := rand.Read(preimage[:]) + require.NoError(t, err) + + payHash := preimage.Hash() + + resp, err := dstTapd.AddInvoice(ctxt, &tchrpc.AddInvoiceRequest{ + AssetId: assetID, + AssetAmount: assetAmount, + PeerPubkey: dstRfqPeer.PubKey[:], + InvoiceRequest: &lnrpc.Invoice{ + Memo: fmt.Sprintf("this is an asset invoice over "+ + "%d units", assetAmount), + Expiry: timeoutSeconds, + }, + HodlInvoice: &tchrpc.HodlInvoice{ + PaymentHash: payHash[:], + }, + }) + require.NoError(t, err) + + decodedInvoice, err := dst.DecodePayReq(ctxt, &lnrpc.PayReqString{ + PayReq: resp.InvoiceResult.PaymentRequest, + }) + require.NoError(t, err) + + rpcRate := resp.AcceptedBuyQuote.AskAssetRate + rate, err := rfqrpc.UnmarshalFixedPoint(rpcRate) + require.NoError(t, err) + + assetUnits := rfqmath.NewBigIntFixedPoint(assetAmount, 0) + numMSats := rfqmath.UnitsToMilliSatoshi(assetUnits, *rate) + mSatPerUnit := float64(decodedInvoice.NumMsat) / float64(assetAmount) + + require.EqualValues(t, uint64(numMSats), uint64(decodedInvoice.NumMsat)) + + t.Logf("Got quote for %d sats at %v msat/unit from peer %x with SCID "+ + "%d", decodedInvoice.NumMsat, mSatPerUnit, dstRfqPeer.PubKey[:], + resp.AcceptedBuyQuote.Scid) + + return assetHodlInvoice{ + preimage: preimage, + payReq: resp.InvoiceResult.PaymentRequest, + } +} + +func waitForSendEvent(t *testing.T, + sendEvents taprpc.TaprootAssets_SubscribeSendEventsClient, + expectedState tapfreighter.SendState) { + + t.Helper() + + for { + sendEvent, err := sendEvents.Recv() + require.NoError(t, err) + + t.Logf("Received send event: %v", sendEvent.SendState) + if sendEvent.SendState == expectedState.String() { + return + } + } +} + +// coOpCloseBalanceCheck is a function type that can be passed into +// closeAssetChannelAndAsset to asset the final balance of the closing +// transaction. +type coOpCloseBalanceCheck func(t *testing.T, local, remote *HarnessNode, + closeTx *wire.MsgTx, closeUpdate *lnrpc.ChannelCloseUpdate, + assetID, groupKey []byte, universeTap *tapClient) + +// noOpCoOpCloseBalanceCheck is a no-op implementation of the co-op close +// balance check that can be used in tests. +func noOpCoOpCloseBalanceCheck(_ *testing.T, _, _ *HarnessNode, _ *wire.MsgTx, + _ *lnrpc.ChannelCloseUpdate, _, _ []byte, _ *tapClient) { + + // This is a no-op function. +} + +// closeAssetChannelAndAssert closes the channel between the local and remote +// node and asserts the final balances of the closing transaction. +func closeAssetChannelAndAssert(t *harnessTest, net *NetworkHarness, + local, remote *HarnessNode, chanPoint *lnrpc.ChannelPoint, + assetID, groupKey []byte, universeTap *tapClient, + balanceCheck coOpCloseBalanceCheck) { + + t.t.Helper() + + ctxb := context.Background() + ctxt, cancel := context.WithTimeout(ctxb, defaultTimeout) + defer cancel() + + closeStream, _, err := t.lndHarness.CloseChannel( + local, chanPoint, false, + ) + require.NoError(t.t, err) + + localTapd := newTapClient(t.t, local) + sendEvents, err := localTapd.SubscribeSendEvents( + ctxt, &taprpc.SubscribeSendEventsRequest{}, + ) + require.NoError(t.t, err) + + mineBlocks(t, net, 1, 1) + + closeUpdate, err := t.lndHarness.WaitForChannelClose(closeStream) + require.NoError(t.t, err) + + closeTxid, err := chainhash.NewHash(closeUpdate.ClosingTxid) + require.NoError(t.t, err) + + closeTransaction := t.lndHarness.Miner.GetRawTransaction(*closeTxid) + closeTx := closeTransaction.MsgTx() + t.Logf("Channel closed with txid: %v", closeTxid) + t.Logf("Close transaction: %v", spew.Sdump(closeTx)) + + waitForSendEvent(t.t, sendEvents, tapfreighter.SendStateComplete) + + // Check the final balance of the closing transaction. + balanceCheck( + t.t, local, remote, closeTx, closeUpdate, assetID, groupKey, + universeTap, + ) +} + +// assertDefaultCoOpCloseBalance returns a default implementation of the co-op +// close balance check that can be used in tests. It assumes the initiator has +// both an asset and BTC balance left, while the responder's balance can be +// specified with the boolean variables. +func assertDefaultCoOpCloseBalance(remoteBtcBalance, + remoteAssetBalance bool) coOpCloseBalanceCheck { + + return func(t *testing.T, local, remote *HarnessNode, + closeTx *wire.MsgTx, closeUpdate *lnrpc.ChannelCloseUpdate, + assetID, groupKey []byte, universeTap *tapClient) { + + defaultCoOpCloseBalanceCheck( + t, local, remote, closeTx, closeUpdate, assetID, + groupKey, universeTap, remoteBtcBalance, + remoteAssetBalance, + ) + } +} + +// defaultCoOpCloseBalanceCheck is a default implementation of the co-op close +// balance check that can be used in tests. It assumes the initiator has both +// an asset and BTC balance left, while the responder's balance can be specified +// with the boolean variables. +func defaultCoOpCloseBalanceCheck(t *testing.T, local, remote *HarnessNode, + closeTx *wire.MsgTx, closeUpdate *lnrpc.ChannelCloseUpdate, + assetID, groupKey []byte, universeTap *tapClient, remoteBtcBalance, + remoteAssetBalance bool) { + + // With the channel closed, we'll now assert that the co-op close + // transaction was inserted into the local universe. + // + // We expect that at most four outputs exist: one for the local asset + // output, one for the remote asset output, one for the remote BTC + // channel balance and one for the remote BTC channel balance. + // + // Those outputs are only present if the respective party has a + // non-dust balance. + numOutputs := 2 + additionalOutputs := 1 + if remoteBtcBalance { + numOutputs++ + } + if remoteAssetBalance { + numOutputs++ + additionalOutputs++ + } + + closeTxid := closeTx.TxHash() + require.Len(t, closeTx.TxOut, numOutputs) + + outIdx := 0 + dummyAmt := int64(1000) + require.LessOrEqual(t, closeTx.TxOut[outIdx].Value, dummyAmt) + + if remoteAssetBalance { + outIdx++ + require.LessOrEqual(t, closeTx.TxOut[outIdx].Value, dummyAmt) + } + + // We also require there to be at most two additional outputs, one for + // each of the asset outputs with balance. + require.Len(t, closeUpdate.AdditionalOutputs, additionalOutputs) + + var remoteCloseOut *lnrpc.CloseOutput + if remoteBtcBalance { + // The remote node has received a couple of HTLCs with an above + // dust value, so it should also have accumulated a non-dust + // balance, even after subtracting 1k sats for the asset output. + remoteCloseOut = closeUpdate.RemoteCloseOutput + require.NotNil(t, remoteCloseOut) + + outIdx++ + require.EqualValues( + t, remoteCloseOut.AmountSat-dummyAmt, + closeTx.TxOut[outIdx].Value, + ) + } else if remoteAssetBalance { + // The remote node has received a couple of HTLCs but not enough + // to go above dust. So it should still have an asset balance + // that we can verify. + remoteCloseOut = closeUpdate.RemoteCloseOutput + require.NotNil(t, remoteCloseOut) + } + + // The local node should have received the local BTC balance minus the + // TX fees and 1k sats for the asset output. + localCloseOut := closeUpdate.LocalCloseOutput + require.NotNil(t, localCloseOut) + outIdx++ + require.Greater( + t, closeTx.TxOut[outIdx].Value, + localCloseOut.AmountSat-dummyAmt, + ) + + // Find out which of the additional outputs is the local one and which + // is the remote. + localAuxOut := closeUpdate.AdditionalOutputs[0] + + var remoteAuxOut *lnrpc.CloseOutput + if remoteAssetBalance { + remoteAuxOut = closeUpdate.AdditionalOutputs[1] + } + if !localAuxOut.IsLocal && remoteAuxOut != nil { + localAuxOut, remoteAuxOut = remoteAuxOut, localAuxOut + } + + // The first two transaction outputs should be the additional outputs + // as identified by the pk scripts in the close update. + localAssetIndex, remoteAssetIndex := 1, 0 + if bytes.Equal(closeTx.TxOut[0].PkScript, localAuxOut.PkScript) { + localAssetIndex, remoteAssetIndex = 0, 1 + } + + if remoteAuxOut != nil { + require.Equal( + t, remoteAuxOut.PkScript, + closeTx.TxOut[remoteAssetIndex].PkScript, + ) + } + + require.Equal( + t, localAuxOut.PkScript, + closeTx.TxOut[localAssetIndex].PkScript, + ) + + // We now verify the arrival of the local balance asset proof at the + // universe server. + var localAssetCloseOut rfqmsg.JsonCloseOutput + err := json.Unmarshal( + localCloseOut.CustomChannelData, &localAssetCloseOut, + ) + require.NoError(t, err) + + for assetIDStr, scriptKeyStr := range localAssetCloseOut.ScriptKeys { + scriptKeyBytes, err := hex.DecodeString(scriptKeyStr) + require.NoError(t, err) + + require.Equal(t, hex.EncodeToString(assetID), assetIDStr) + + a := assertUniverseProofExists( + t, universeTap, assetID, groupKey, scriptKeyBytes, + fmt.Sprintf("%v:%v", closeTxid, localAssetIndex), + ) + + localTapd := newTapClient(t, local) + + scriptKey, err := btcec.ParsePubKey(scriptKeyBytes) + require.NoError(t, err) + assertAssetExists( + t, localTapd, assetID, a.Amount, scriptKey, true, + true, false, + ) + } + + // If there is no remote asset balance, we're done. + if !remoteAssetBalance { + return + } + + // At this point the remote close output should be defined, otherwise + // something went wrong. + require.NotNil(t, remoteCloseOut) + + // And then we verify the arrival of the remote balance asset proof at + // the universe server as well. + var remoteAssetCloseOut rfqmsg.JsonCloseOutput + err = json.Unmarshal( + remoteCloseOut.CustomChannelData, &remoteAssetCloseOut, + ) + require.NoError(t, err) + + for assetIDStr, scriptKeyStr := range remoteAssetCloseOut.ScriptKeys { + scriptKeyBytes, err := hex.DecodeString(scriptKeyStr) + require.NoError(t, err) + + require.Equal(t, hex.EncodeToString(assetID), assetIDStr) + + a := assertUniverseProofExists( + t, universeTap, assetID, groupKey, scriptKeyBytes, + fmt.Sprintf("%v:%v", closeTxid, remoteAssetIndex), + ) + + remoteTapd := newTapClient(t, remote) + + scriptKey, err := btcec.ParsePubKey(scriptKeyBytes) + require.NoError(t, err) + assertAssetExists( + t, remoteTapd, assetID, a.Amount, scriptKey, true, + true, false, + ) + } +} + +// initiatorZeroAssetBalanceCoOpBalanceCheck is a co-op close balance check +// function that can be used when the initiator has a zero asset balance. +func initiatorZeroAssetBalanceCoOpBalanceCheck(t *testing.T, _, + remote *HarnessNode, closeTx *wire.MsgTx, + closeUpdate *lnrpc.ChannelCloseUpdate, assetID, groupKey []byte, + universeTap *tapClient) { + + // With the channel closed, we'll now assert that the co-op close + // transaction was inserted into the local universe. + // + // Since the initiator has a zero asset balance, we expect that at most + // three outputs exist: one for the remote asset output, one for the + // remote BTC channel balance and one for the initiator's BTC channel + // balance (which cannot be zero or below dust due to the mandatory + // channel reserve). + numOutputs := 3 + + closeTxid := closeTx.TxHash() + require.Len(t, closeTx.TxOut, numOutputs) + + // We assume that the local node has a non-zero BTC balance left. + localOut, _ := closeTxOut(t, closeTx, closeUpdate, true) + require.Greater(t, localOut.Value, int64(1000)) + + // We also require there to be exactly one additional output, which is + // the remote asset output. + require.Len(t, closeUpdate.AdditionalOutputs, 1) + assetTxOut, assetOutputIndex := findTxOut( + t, closeTx, closeUpdate.AdditionalOutputs[0].PkScript, + ) + require.LessOrEqual(t, assetTxOut.Value, int64(1000)) + + // The remote node has received a couple of HTLCs with an above + // dust value, so it should also have accumulated a non-dust + // balance, even after subtracting 1k sats for the asset output. + remoteCloseOut := closeUpdate.RemoteCloseOutput + require.NotNil(t, remoteCloseOut) + + // Find out which of the additional outputs is the local one and which + // is the remote. + remoteAuxOut := closeUpdate.AdditionalOutputs[0] + require.False(t, remoteAuxOut.IsLocal) + + // And then we verify the arrival of the remote balance asset proof at + // the universe server as well. + var remoteAssetCloseOut rfqmsg.JsonCloseOutput + err := json.Unmarshal( + remoteCloseOut.CustomChannelData, &remoteAssetCloseOut, + ) + require.NoError(t, err) + + for assetIDStr, scriptKeyStr := range remoteAssetCloseOut.ScriptKeys { + scriptKeyBytes, err := hex.DecodeString(scriptKeyStr) + require.NoError(t, err) + + require.Equal(t, hex.EncodeToString(assetID), assetIDStr) + + a := assertUniverseProofExists( + t, universeTap, assetID, groupKey, scriptKeyBytes, + fmt.Sprintf("%v:%v", closeTxid, assetOutputIndex), + ) + + remoteTapd := newTapClient(t, remote) + + scriptKey, err := btcec.ParsePubKey(scriptKeyBytes) + require.NoError(t, err) + assertAssetExists( + t, remoteTapd, assetID, a.Amount, scriptKey, true, + true, false, + ) + } +} + +// closeTxOut returns either the local or remote output from the close +// transaction, based on the information given in the close update. +func closeTxOut(t *testing.T, closeTx *wire.MsgTx, + closeUpdate *lnrpc.ChannelCloseUpdate, local bool) (*wire.TxOut, int) { + + var targetPkScript []byte + if local { + require.NotNil(t, closeUpdate.LocalCloseOutput) + targetPkScript = closeUpdate.LocalCloseOutput.PkScript + } else { + require.NotNil(t, closeUpdate.RemoteCloseOutput) + targetPkScript = closeUpdate.RemoteCloseOutput.PkScript + } + + return findTxOut(t, closeTx, targetPkScript) +} + +// findTxOut returns the transaction output with the target pk script from the +// given transaction. +func findTxOut(t *testing.T, tx *wire.MsgTx, targetPkScript []byte) ( + *wire.TxOut, int) { + + for i, txOut := range tx.TxOut { + if bytes.Equal(txOut.PkScript, targetPkScript) { + return txOut, i + } + } + + t.Fatalf("close output (targetPkScript=%x) not found in close "+ + "transaction", targetPkScript) + + return &wire.TxOut{}, 0 +} + +type tapClient struct { + node *HarnessNode + lnd *rpc.HarnessRPC + taprpc.TaprootAssetsClient + assetwalletrpc.AssetWalletClient + tapdevrpc.TapDevClient + mintrpc.MintClient + rfqrpc.RfqClient + tchrpc.TaprootAssetChannelsClient + universerpc.UniverseClient +} + +func newTapClient(t *testing.T, node *HarnessNode) *tapClient { + cfg := node.Cfg + superMacFile := bakeSuperMacaroon(t, cfg, getLiTMacFromFile, false) + + t.Cleanup(func() { + require.NoError(t, os.Remove(superMacFile)) + }) + + ctxb := context.Background() + ctxt, cancel := context.WithTimeout(ctxb, defaultTimeout) + defer cancel() + + rawConn, err := connectRPCWithMac( + ctxt, cfg.LitAddr(), cfg.LitTLSCertPath, superMacFile, + ) + require.NoError(t, err) + + t.Cleanup(func() { + _ = rawConn.Close() + }) + + assetsClient := taprpc.NewTaprootAssetsClient(rawConn) + assetWalletClient := assetwalletrpc.NewAssetWalletClient(rawConn) + devClient := tapdevrpc.NewTapDevClient(rawConn) + mintMintClient := mintrpc.NewMintClient(rawConn) + rfqClient := rfqrpc.NewRfqClient(rawConn) + tchClient := tchrpc.NewTaprootAssetChannelsClient(rawConn) + universeClient := universerpc.NewUniverseClient(rawConn) + + return &tapClient{ + node: node, + TaprootAssetsClient: assetsClient, + AssetWalletClient: assetWalletClient, + TapDevClient: devClient, + MintClient: mintMintClient, + RfqClient: rfqClient, + TaprootAssetChannelsClient: tchClient, + UniverseClient: universeClient, + } +} + +func connectRPCWithMac(ctx context.Context, hostPort, tlsCertPath, + macFilePath string) (*grpc.ClientConn, error) { + + tlsCreds, err := credentials.NewClientTLSFromFile(tlsCertPath, "") + if err != nil { + return nil, err + } + + opts := []grpc.DialOption{ + grpc.WithBlock(), + grpc.WithTransportCredentials(tlsCreds), + } + + macOption, err := readMacaroon(macFilePath) + if err != nil { + return nil, err + } + + opts = append(opts, macOption) + + return grpc.DialContext(ctx, hostPort, opts...) +} + +func assertAssetBalance(t *testing.T, client *tapClient, assetID []byte, + expectedBalance uint64) { + + t.Helper() + + ctxb := context.Background() + ctxt, cancel := context.WithTimeout(ctxb, shortTimeout) + defer cancel() + + req := &taprpc.ListBalancesRequest{ + GroupBy: &taprpc.ListBalancesRequest_AssetId{ + AssetId: true, + }, + } + + err := wait.NoError(func() error { + assetIDBalances, err := client.ListBalances(ctxt, req) + if err != nil { + return err + } + + assetIDFound := false + for _, balance := range assetIDBalances.AssetBalances { + if !bytes.Equal(balance.AssetGenesis.AssetId, assetID) { + continue + } + + assetIDFound = true + if expectedBalance != balance.Balance { + return fmt.Errorf("expected balance %d, got %d", + expectedBalance, balance.Balance) + } + } + + if expectedBalance > 0 && !assetIDFound { + return fmt.Errorf("expected balance %d, got 0", + expectedBalance) + } + return nil + }, shortTimeout) + if err != nil { + r, err2 := client.ListAssets(ctxb, &taprpc.ListAssetRequest{}) + require.NoError(t, err2) + + t.Logf("Failed to assert expected balance of %d, current "+ + "assets: %v", expectedBalance, toProtoJSON(t, r)) + + utxos, err3 := client.ListUtxos( + ctxb, &taprpc.ListUtxosRequest{}, + ) + require.NoError(t, err3) + + t.Logf("Current UTXOs: %v", toProtoJSON(t, utxos)) + + t.Fatalf("Failed to assert balance: %v", err) + } +} + +// assertSpendableBalance differs from assertAssetBalance in that it asserts +// that the entire balance is spendable. We consider something spendable if we +// have a local script key for it. +func assertSpendableBalance(t *testing.T, client *tapClient, assetID []byte, + expectedBalance uint64) { + + t.Helper() + + ctxb := context.Background() + ctxt, cancel := context.WithTimeout(ctxb, shortTimeout) + defer cancel() + + err := wait.NoError(func() error { + utxos, err := client.ListUtxos(ctxt, &taprpc.ListUtxosRequest{}) + if err != nil { + return err + } + + assets := tapfn.FlatMap( + maps.Values(utxos.ManagedUtxos), + func(utxo *taprpc.ManagedUtxo) []*taprpc.Asset { + return utxo.Assets + }, + ) + + relevantAssets := fn.Filter(func(utxo *taprpc.Asset) bool { + return bytes.Equal(utxo.AssetGenesis.AssetId, assetID) + }, assets) + + var assetSum uint64 + for _, asset := range relevantAssets { + if asset.ScriptKeyIsLocal { + assetSum += asset.Amount + } + } + + if assetSum != expectedBalance { + return fmt.Errorf("expected balance %d, got %d", + expectedBalance, assetSum) + } + + return nil + }, shortTimeout) + if err != nil { + r, err2 := client.ListAssets(ctxb, &taprpc.ListAssetRequest{}) + require.NoError(t, err2) + + t.Logf("Failed to assert expected balance of %d, current "+ + "assets: %v", expectedBalance, toProtoJSON(t, r)) + + utxos, err3 := client.ListUtxos( + ctxb, &taprpc.ListUtxosRequest{}, + ) + require.NoError(t, err3) + + t.Logf("Current UTXOs: %v", toProtoJSON(t, utxos)) + + t.Fatalf("Failed to assert balance: %v", err) + } +} + +func assertNumAssetOutputs(t *testing.T, client *tapClient, assetID []byte, + numPieces int) { + + ctxb := context.Background() + ctxt, cancel := context.WithTimeout(ctxb, shortTimeout) + defer cancel() + + resp, err := client.ListAssets(ctxt, &taprpc.ListAssetRequest{ + IncludeLeased: true, + }) + require.NoError(t, err) + + var outputs []*taprpc.Asset + for _, a := range resp.Assets { + if !bytes.Equal(a.AssetGenesis.AssetId, assetID) { + continue + } + + outputs = append(outputs, a) + } + + require.Len(t, outputs, numPieces) +} + +func assertAssetExists(t *testing.T, client *tapClient, assetID []byte, + amount uint64, scriptKey *btcec.PublicKey, scriptKeyLocal, + scriptKeyKnown, scriptKeyHasScript bool) *taprpc.Asset { + + t.Helper() + + var a *taprpc.Asset + err := wait.NoError(func() error { + var err error + a, err = assetExists( + t, client, assetID, amount, scriptKey, scriptKeyLocal, + scriptKeyKnown, scriptKeyHasScript, + ) + return err + }, shortTimeout) + require.NoError(t, err) + + return a +} + +func assetExists(t *testing.T, client *tapClient, assetID []byte, + amount uint64, scriptKey *btcec.PublicKey, scriptKeyLocal, + scriptKeyKnown, scriptKeyHasScript bool) (*taprpc.Asset, error) { + + ctxb := context.Background() + ctxt, cancel := context.WithTimeout(ctxb, shortTimeout) + defer cancel() + + resp, err := client.ListAssets(ctxt, &taprpc.ListAssetRequest{ + IncludeLeased: true, + }) + if err != nil { + return nil, err + } + + for _, a := range resp.Assets { + if !bytes.Equal(a.AssetGenesis.AssetId, assetID) { + continue + } + + if amount != a.Amount { + continue + } + + if scriptKey != nil { + xOnlyKey, _ := schnorr.ParsePubKey( + schnorr.SerializePubKey(scriptKey), + ) + xOnlyKeyBytes := xOnlyKey.SerializeCompressed() + if !bytes.Equal(xOnlyKeyBytes, a.ScriptKey) { + continue + } + } + + if scriptKeyLocal != a.ScriptKeyIsLocal { + continue + } + + if scriptKeyKnown != a.ScriptKeyDeclaredKnown { + continue + } + + if scriptKeyHasScript != a.ScriptKeyHasScriptPath { + continue + } + + // Success, we have found the asset we're looking for. + return a, nil + } + + return nil, fmt.Errorf("asset with given criteria (amount=%d) not "+ + "found in list, got: %v", amount, toProtoJSON(t, resp)) +} + +func logBalance(t *testing.T, nodes []*HarnessNode, assetID []byte, + occasion string) { + + t.Helper() + + time.Sleep(time.Millisecond * 250) + + for _, node := range nodes { + local, remote, localSat, remoteSat := + getAssetChannelBalance(t, node, assetID, false) + + t.Logf("%-7s balance: local=%-9d remote=%-9d, localSat=%-9d, "+ + "remoteSat=%-9d (%v)", node.Cfg.Name, local, remote, + localSat, remoteSat, occasion) + } +} + +// readMacaroon tries to read the macaroon file at the specified path and create +// gRPC dial options from it. +func readMacaroon(macPath string) (grpc.DialOption, error) { + // Load the specified macaroon file. + macBytes, err := os.ReadFile(macPath) + if err != nil { + return nil, fmt.Errorf("unable to read macaroon path : %w", err) + } + + return macFromBytes(macBytes) +} + +// macFromBytes returns a macaroon from the given byte slice. +func macFromBytes(macBytes []byte) (grpc.DialOption, error) { + mac := &macaroon.Macaroon{} + if err := mac.UnmarshalBinary(macBytes); err != nil { + return nil, fmt.Errorf("unable to decode macaroon: %w", err) + } + + // Now we append the macaroon credentials to the dial options. + cred, err := macaroons.NewMacaroonCredential(mac) + if err != nil { + return nil, fmt.Errorf("error creating macaroon credential: %w", + err) + } + return grpc.WithPerRPCCredentials(cred), nil +} + +func assertNumHtlcs(t *testing.T, node *HarnessNode, expected int) { + t.Helper() + + ctxb := context.Background() + + err := wait.NoError(func() error { + listChansRequest := &lnrpc.ListChannelsRequest{} + listChansResp, err := node.ListChannels(ctxb, listChansRequest) + if err != nil { + return err + } + + var numHtlcs int + for _, channel := range listChansResp.Channels { + numHtlcs += len(channel.PendingHtlcs) + } + + if numHtlcs != expected { + return fmt.Errorf("expected %v HTLCs, got %v, %v", + expected, numHtlcs, + spew.Sdump(toProtoJSON(t, listChansResp))) + } + + return nil + }, defaultTimeout) + require.NoError(t, err) +} + +type forceCloseExpiryInfo struct { + currentHeight uint32 + csvDelay uint32 + + cltvDelays map[lntypes.Hash]uint32 + + localAssetBalance uint64 + remoteAssetBalance uint64 + + t *testing.T + + node *HarnessNode +} + +func (f *forceCloseExpiryInfo) blockTillExpiry(hash lntypes.Hash) uint32 { + ctxb := context.Background() + nodeInfo, err := f.node.GetInfo(ctxb, &lnrpc.GetInfoRequest{}) + require.NoError(f.t, err) + + cltv, ok := f.cltvDelays[hash] + require.True(f.t, ok) + + f.t.Logf("current_height=%v, expiry=%v, mining %v blocks", + nodeInfo.BlockHeight, cltv, cltv-nodeInfo.BlockHeight) + + return cltv - nodeInfo.BlockHeight +} + +func newCloseExpiryInfo(t *testing.T, node *HarnessNode) forceCloseExpiryInfo { + ctxb := context.Background() + + listChansRequest := &lnrpc.ListChannelsRequest{} + listChansResp, err := node.ListChannels(ctxb, listChansRequest) + require.NoError(t, err) + + mainChan := listChansResp.Channels[0] + + nodeInfo, err := node.GetInfo(ctxb, &lnrpc.GetInfoRequest{}) + require.NoError(t, err) + + cltvs := make(map[lntypes.Hash]uint32) + for _, htlc := range mainChan.PendingHtlcs { + var payHash lntypes.Hash + copy(payHash[:], htlc.HashLock) + cltvs[payHash] = htlc.ExpirationHeight + } + + var assetData rfqmsg.JsonAssetChannel + err = json.Unmarshal(mainChan.CustomChannelData, &assetData) + require.NoError(t, err) + + return forceCloseExpiryInfo{ + csvDelay: mainChan.CsvDelay, + currentHeight: nodeInfo.BlockHeight, + cltvDelays: cltvs, + localAssetBalance: assetData.Assets[0].LocalBalance, + remoteAssetBalance: assetData.Assets[0].RemoteBalance, + t: t, + node: node, + } +} diff --git a/itest/litd_accounts_test.go b/itest/litd_accounts_test.go index f1677c255..b678723f0 100644 --- a/itest/litd_accounts_test.go +++ b/itest/litd_accounts_test.go @@ -10,6 +10,7 @@ import ( "github.com/btcsuite/btcd/btcutil" "github.com/lightninglabs/lightning-terminal/litrpc" + "github.com/lightninglabs/taproot-assets/taprpc/tapchannelrpc" "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/routerrpc" "github.com/lightningnetwork/lnd/lntest" @@ -433,3 +434,44 @@ func getPaymentResult(stream routerrpc.Router_SendPaymentV2Client) ( } } } + +func getAssetPaymentResult( + s tapchannelrpc.TaprootAssetChannels_SendPaymentClient, + isHodl bool) (*lnrpc.Payment, error) { + + // No idea why it makes a difference whether we wait before calling + // s.Recv() or not, but it does. Without the sleep, the test will fail + // with "insufficient local balance"... ¯\_(ツ)_/¯ + // Probably something weird within lnd itself. + time.Sleep(time.Second) + + for { + msg, err := s.Recv() + if err != nil { + return nil, err + } + + // Ignore RFQ quote acceptance messages read from the send + // payment stream, as they are not relevant. + quote := msg.GetAcceptedSellOrder() + if quote != nil { + continue + } + + payment := msg.GetPaymentResult() + if payment == nil { + return nil, fmt.Errorf("unexpected message: %v", msg) + } + + // If this is a hodl payment, then we'll return the first + // expected response. Otherwise, we'll wait until the in flight + // clears to we can observe the other payment states. + switch { + case isHodl: + return payment, nil + + case payment.Status != lnrpc.Payment_IN_FLIGHT: + return payment, nil + } + } +} diff --git a/itest/litd_custom_channels_test.go b/itest/litd_custom_channels_test.go new file mode 100644 index 000000000..b7c9e0597 --- /dev/null +++ b/itest/litd_custom_channels_test.go @@ -0,0 +1,3807 @@ +package itest + +import ( + "bytes" + "context" + "fmt" + "math" + "math/big" + "slices" + "time" + + "github.com/btcsuite/btcd/btcec/v2/schnorr" + "github.com/btcsuite/btcd/btcutil" + "github.com/btcsuite/btcd/chaincfg/chainhash" + "github.com/lightninglabs/taproot-assets/asset" + "github.com/lightninglabs/taproot-assets/itest" + "github.com/lightninglabs/taproot-assets/proof" + "github.com/lightninglabs/taproot-assets/rfqmath" + "github.com/lightninglabs/taproot-assets/rfqmsg" + "github.com/lightninglabs/taproot-assets/taprpc" + "github.com/lightninglabs/taproot-assets/taprpc/mintrpc" + oraclerpc "github.com/lightninglabs/taproot-assets/taprpc/priceoraclerpc" + "github.com/lightninglabs/taproot-assets/taprpc/rfqrpc" + "github.com/lightninglabs/taproot-assets/taprpc/tapchannelrpc" + tchrpc "github.com/lightninglabs/taproot-assets/taprpc/tapchannelrpc" + "github.com/lightninglabs/taproot-assets/taprpc/universerpc" + "github.com/lightninglabs/taproot-assets/tapscript" + "github.com/lightningnetwork/lnd/fn" + "github.com/lightningnetwork/lnd/lnrpc" + "github.com/lightningnetwork/lnd/lnrpc/invoicesrpc" + "github.com/lightningnetwork/lnd/lnrpc/walletrpc" + "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/port" + "github.com/lightningnetwork/lnd/lntest/wait" + "github.com/lightningnetwork/lnd/lnwallet/chainfee" + "github.com/lightningnetwork/lnd/lnwire" + "github.com/stretchr/testify/require" +) + +var ( + dummyMetaData = &taprpc.AssetMeta{ + Data: []byte("some metadata"), + } + + itestAsset = &mintrpc.MintAsset{ + AssetType: taprpc.AssetType_NORMAL, + Name: "itest-asset-cents", + AssetMeta: dummyMetaData, + Amount: 1_000_000, + } + + shortTimeout = time.Second * 5 +) + +var ( + lndArgsTemplate = []string{ + "--trickledelay=50", + "--gossip.sub-batch-delay=5ms", + "--caches.rpc-graph-cache-duration=100ms", + "--default-remote-max-htlcs=483", + "--dust-threshold=5000000", + "--rpcmiddleware.enable", + "--protocol.anchors", + "--protocol.option-scid-alias", + "--protocol.zero-conf", + "--protocol.simple-taproot-chans", + "--protocol.simple-taproot-overlay-chans", + "--protocol.custom-message=17", + "--accept-keysend", + "--debuglevel=trace,GRPC=error,BTCN=info", + } + litdArgsTemplateNoOracle = []string{ + "--taproot-assets.allow-public-uni-proof-courier", + "--taproot-assets.universe.public-access=rw", + "--taproot-assets.universe.sync-all-assets", + "--taproot-assets.universerpccourier.skipinitdelay", + "--taproot-assets.universerpccourier.backoffresetwait=1s", + "--taproot-assets.universerpccourier.numtries=5", + "--taproot-assets.universerpccourier.initialbackoff=300ms", + "--taproot-assets.universerpccourier.maxbackoff=600ms", + "--taproot-assets.universerpccourier.skipinitdelay", + "--taproot-assets.universerpccourier.backoffresetwait=100ms", + "--taproot-assets.universerpccourier.initialbackoff=300ms", + "--taproot-assets.universerpccourier.maxbackoff=600ms", + "--taproot-assets.custodianproofretrievaldelay=500ms", + } + litdArgsTemplate = append(litdArgsTemplateNoOracle, []string{ + "--taproot-assets.experimental.rfq.priceoracleaddress=" + + "use_mock_price_oracle_service_promise_to_" + + "not_use_on_mainnet", + "--taproot-assets.experimental.rfq.mockoracleassetsperbtc=" + + "5820600", + }...) +) + +const ( + fundingAmount = 50_000 + startAmount = fundingAmount * 2 +) + +// testCustomChannelsLarge tests that we can create a network with custom +// channels and send large asset payments over them. +func testCustomChannelsLarge(_ context.Context, net *NetworkHarness, + t *harnessTest) { + + lndArgs := slices.Clone(lndArgsTemplate) + litdArgs := slices.Clone(litdArgsTemplate) + + // Explicitly set the proof courier as Zane (now has no other role + // other than proof shuffling), otherwise a hashmail courier will be + // used. For the funding transaction, we're just posting it and don't + // expect a true receiver. + zane, err := net.NewNode( + t.t, "Zane", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + litdArgs = append(litdArgs, fmt.Sprintf( + "--taproot-assets.proofcourieraddr=%s://%s", + proof.UniverseRpcCourierType, zane.Cfg.LitAddr(), + )) + + // The topology we are going for looks like the following: + // + // Charlie --[assets]--> Dave --[sats]--> Erin --[assets]--> Fabia + // | + // | + // [assets] + // | + // v + // Yara + // + // With [assets] being a custom channel and [sats] being a normal, BTC + // only channel. + // All 5 nodes need to be full litd nodes running in integrated mode + // with tapd included. We also need specific flags to be enabled, so we + // create 5 completely new nodes, ignoring the two default nodes that + // are created by the harness. + charlie, err := net.NewNode( + t.t, "Charlie", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + dave, err := net.NewNode(t.t, "Dave", lndArgs, false, true, litdArgs...) + require.NoError(t.t, err) + erin, err := net.NewNode(t.t, "Erin", lndArgs, false, true, litdArgs...) + require.NoError(t.t, err) + fabia, err := net.NewNode( + t.t, "Fabia", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + yara, err := net.NewNode( + t.t, "Yara", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + nodes := []*HarnessNode{charlie, dave, erin, fabia, yara} + connectAllNodes(t.t, net, nodes) + fundAllNodes(t.t, net, nodes) + + // Create the normal channel between Dave and Erin. + t.Logf("Opening normal channel between Dave and Erin...") + channelOp := openChannelAndAssert( + t, net, dave, erin, lntest.OpenChannelParams{ + Amt: 10_000_000, + SatPerVByte: 5, + }, + ) + defer closeChannelAndAssert(t, net, dave, channelOp, false) + + // This is the only public channel, we need everyone to be aware of it. + assertChannelKnown(t.t, charlie, channelOp) + assertChannelKnown(t.t, fabia, channelOp) + + universeTap := newTapClient(t.t, zane) + charlieTap := newTapClient(t.t, charlie) + daveTap := newTapClient(t.t, dave) + erinTap := newTapClient(t.t, erin) + fabiaTap := newTapClient(t.t, fabia) + yaraTap := newTapClient(t.t, yara) + + // Mint an asset on Charlie and sync all nodes to Charlie as the + // universe. + mintedAssets := itest.MintAssetsConfirmBatch( + t.t, t.lndHarness.Miner.Client, charlieTap, + []*mintrpc.MintAssetRequest{ + { + Asset: itestAsset, + }, + }, + ) + cents := mintedAssets[0] + assetID := cents.AssetGenesis.AssetId + + t.Logf("Minted %d lightning cents, syncing universes...", cents.Amount) + syncUniverses(t.t, charlieTap, dave, erin, fabia, yara) + t.Logf("Universes synced between all nodes, distributing assets...") + + const ( + daveFundingAmount = uint64(400_000) + erinFundingAmount = uint64(200_000) + ) + charlieFundingAmount := cents.Amount - uint64(2*400_000) + + chanPointCD, _, _ := createTestAssetNetwork( + t, net, charlieTap, daveTap, erinTap, fabiaTap, yaraTap, + universeTap, cents, 400_000, charlieFundingAmount, + daveFundingAmount, erinFundingAmount, DefaultPushSat, + ) + + // Before we start sending out payments, let's make sure each node can + // see the other one in the graph and has all required features. + require.NoError(t.t, t.lndHarness.AssertNodeKnown(charlie, dave)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(dave, charlie)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(dave, yara)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(yara, dave)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(erin, fabia)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(fabia, erin)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(charlie, erin)) + + // Print initial channel balances. + logBalance(t.t, nodes, assetID, "initial") + + // Try larger invoice payments, first from Charlie to Fabia, then half + // of the amount back in the other direction. + const fabiaInvoiceAssetAmount = 20_000 + invoiceResp := createAssetInvoice( + t.t, erin, fabia, fabiaInvoiceAssetAmount, assetID, + ) + payInvoiceWithAssets( + t.t, charlie, dave, invoiceResp.PaymentRequest, assetID, + ) + logBalance(t.t, nodes, assetID, "after invoice") + + invoiceResp2 := createAssetInvoice( + t.t, dave, charlie, fabiaInvoiceAssetAmount/2, assetID, + ) + + // Sleep for a second to make sure the balances fully propagated before + // we make the payment. Otherwise, we'll make an RFQ order with a max + // amount of zero. + time.Sleep(time.Second * 1) + + payInvoiceWithAssets( + t.t, fabia, erin, invoiceResp2.PaymentRequest, assetID, + ) + logBalance(t.t, nodes, assetID, "after invoice 2") + + // Now we send a large invoice from Charlie to Dave. + const largeInvoiceAmount = 100_000 + invoiceResp3 := createAssetInvoice( + t.t, charlie, dave, largeInvoiceAmount, assetID, + ) + payInvoiceWithAssets( + t.t, charlie, dave, invoiceResp3.PaymentRequest, assetID, + ) + logBalance(t.t, nodes, assetID, "after invoice 3") + + // Make sure the invoice on the receiver side and the payment on the + // sender side show the individual HTLCs that arrived for it and that + // they show the correct asset amounts when decoded. + assertInvoiceHtlcAssets( + t.t, dave, invoiceResp3, assetID, largeInvoiceAmount, + ) + assertPaymentHtlcAssets( + t.t, charlie, invoiceResp3.RHash, assetID, largeInvoiceAmount, + ) + + // We keysend the rest, so that all the balance is on Dave's side. + charlieRemainingBalance := charlieFundingAmount - largeInvoiceAmount - + fabiaInvoiceAssetAmount/2 + sendAssetKeySendPayment( + t.t, charlie, dave, charlieRemainingBalance, + assetID, fn.None[int64](), + ) + logBalance(t.t, nodes, assetID, "after keysend") + + // And now we close the channel to test how things look if all the + // balance is on the non-initiator (recipient) side. + t.Logf("Closing Charlie -> Dave channel") + closeAssetChannelAndAssert( + t, net, charlie, dave, chanPointCD, assetID, nil, + universeTap, initiatorZeroAssetBalanceCoOpBalanceCheck, + ) +} + +// testCustomChannels tests that we can create a network with custom channels +// and send asset payments over them. +func testCustomChannels(_ context.Context, net *NetworkHarness, + t *harnessTest) { + + ctxb := context.Background() + lndArgs := slices.Clone(lndArgsTemplate) + litdArgs := slices.Clone(litdArgsTemplate) + + // Explicitly set the proof courier as Zane (now has no other role + // other than proof shuffling), otherwise a hashmail courier will be + // used. For the funding transaction, we're just posting it and don't + // expect a true receiver. + zane, err := net.NewNode( + t.t, "Zane", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + litdArgs = append(litdArgs, fmt.Sprintf( + "--taproot-assets.proofcourieraddr=%s://%s", + proof.UniverseRpcCourierType, zane.Cfg.LitAddr(), + )) + + // The topology we are going for looks like the following: + // + // Charlie --[assets]--> Dave --[sats]--> Erin --[assets]--> Fabia + // | + // | + // [assets] + // | + // v + // Yara + // + // With [assets] being a custom channel and [sats] being a normal, BTC + // only channel. + // All 5 nodes need to be full litd nodes running in integrated mode + // with tapd included. We also need specific flags to be enabled, so we + // create 5 completely new nodes, ignoring the two default nodes that + // are created by the harness. + charlie, err := net.NewNode( + t.t, "Charlie", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + dave, err := net.NewNode(t.t, "Dave", lndArgs, false, true, litdArgs...) + require.NoError(t.t, err) + erin, err := net.NewNode(t.t, "Erin", lndArgs, false, true, litdArgs...) + require.NoError(t.t, err) + fabia, err := net.NewNode( + t.t, "Fabia", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + yara, err := net.NewNode( + t.t, "Yara", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + nodes := []*HarnessNode{charlie, dave, erin, fabia, yara} + connectAllNodes(t.t, net, nodes) + fundAllNodes(t.t, net, nodes) + + // Create the normal channel between Dave and Erin. + t.Logf("Opening normal channel between Dave and Erin...") + channelOp := openChannelAndAssert( + t, net, dave, erin, lntest.OpenChannelParams{ + Amt: 5_000_000, + SatPerVByte: 5, + }, + ) + defer closeChannelAndAssert(t, net, dave, channelOp, false) + + // This is the only public channel, we need everyone to be aware of it. + assertChannelKnown(t.t, charlie, channelOp) + assertChannelKnown(t.t, fabia, channelOp) + + universeTap := newTapClient(t.t, zane) + charlieTap := newTapClient(t.t, charlie) + daveTap := newTapClient(t.t, dave) + erinTap := newTapClient(t.t, erin) + fabiaTap := newTapClient(t.t, fabia) + yaraTap := newTapClient(t.t, yara) + + // Mint an asset on Charlie and sync all nodes to Charlie as the + // universe. + mintedAssets := itest.MintAssetsConfirmBatch( + t.t, t.lndHarness.Miner.Client, charlieTap, + []*mintrpc.MintAssetRequest{ + { + Asset: itestAsset, + }, + }, + ) + cents := mintedAssets[0] + assetID := cents.AssetGenesis.AssetId + fundingScriptTree := tapscript.NewChannelFundingScriptTree() + fundingScriptKey := fundingScriptTree.TaprootKey + fundingScriptTreeBytes := fundingScriptKey.SerializeCompressed() + + t.Logf("Minted %d lightning cents, syncing universes...", cents.Amount) + syncUniverses(t.t, charlieTap, dave, erin, fabia, yara) + t.Logf("Universes synced between all nodes, distributing assets...") + + const ( + daveFundingAmount = uint64(startAmount) + erinFundingAmount = uint64(fundingAmount) + ) + charlieFundingAmount := cents.Amount - 2*startAmount + + chanPointCD, chanPointDY, chanPointEF := createTestAssetNetwork( + t, net, charlieTap, daveTap, erinTap, fabiaTap, yaraTap, + universeTap, cents, startAmount, charlieFundingAmount, + daveFundingAmount, erinFundingAmount, DefaultPushSat, + ) + + // We'll be tracking the expected asset balances throughout the test, so + // we can assert it after each action. + charlieAssetBalance := charlieFundingAmount + daveAssetBalance := uint64(startAmount) + erinAssetBalance := uint64(startAmount) + fabiaAssetBalance := uint64(0) + yaraAssetBalance := uint64(0) + + // Before we start sending out payments, let's make sure each node can + // see the other one in the graph and has all required features. + require.NoError(t.t, t.lndHarness.AssertNodeKnown(charlie, dave)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(dave, charlie)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(dave, yara)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(yara, dave)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(erin, fabia)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(fabia, erin)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(charlie, erin)) + + // Print initial channel balances. + logBalance(t.t, nodes, assetID, "initial") + + // ------------ + // Test case 1: Send a direct keysend payment from Charlie to Dave, + // sending the whole balance. + // ------------ + keySendAmount := charlieFundingAmount + sendAssetKeySendPayment( + t.t, charlie, dave, charlieFundingAmount, assetID, + fn.None[int64](), + ) + logBalance(t.t, nodes, assetID, "after keysend") + + charlieAssetBalance -= keySendAmount + daveAssetBalance += keySendAmount + + // We should be able to send 1000 assets back immediately, because + // there is enough on-chain balance on Dave's side to be able to create + // an HTLC. We use an invoice to execute another code path. + const charlieInvoiceAmount = 1_000 + invoiceResp := createAssetInvoice( + t.t, dave, charlie, charlieInvoiceAmount, assetID, + ) + payInvoiceWithAssets( + t.t, dave, charlie, invoiceResp.PaymentRequest, assetID, + withSmallShards(), + ) + logBalance(t.t, nodes, assetID, "after invoice back") + + // Make sure the invoice on the receiver side and the payment on the + // sender side show the individual HTLCs that arrived for it and that + // they show the correct asset amounts when decoded. + assertInvoiceHtlcAssets( + t.t, charlie, invoiceResp, assetID, charlieInvoiceAmount, + ) + assertPaymentHtlcAssets( + t.t, dave, invoiceResp.RHash, assetID, charlieInvoiceAmount, + ) + + charlieAssetBalance += charlieInvoiceAmount + daveAssetBalance -= charlieInvoiceAmount + + // We should also be able to do a non-asset (BTC only) keysend payment + // from Charlie to Dave. This'll also replenish the BTC balance of + // Dave, making it possible to send another asset HTLC below, sending + // all assets back to Charlie (so we have enough balance for further + // tests). + sendKeySendPayment(t.t, charlie, dave, 2000) + logBalance(t.t, nodes, assetID, "after BTC only keysend") + + // Let's keysend the rest of the balance back to Charlie. + sendAssetKeySendPayment( + t.t, dave, charlie, charlieFundingAmount-charlieInvoiceAmount, + assetID, fn.None[int64](), + ) + logBalance(t.t, nodes, assetID, "after keysend back") + + charlieAssetBalance += charlieFundingAmount - charlieInvoiceAmount + daveAssetBalance -= charlieFundingAmount - charlieInvoiceAmount + + // ------------ + // Test case 2: Pay a normal invoice from Dave by Charlie, making it + // a direct channel invoice payment with no RFQ SCID present in the + // invoice. + // ------------ + createAndPayNormalInvoice( + t.t, charlie, dave, dave, 20_000, assetID, withSmallShards(), + withFailure(lnrpc.Payment_FAILED, failureIncorrectDetails), + ) + logBalance(t.t, nodes, assetID, "after invoice") + + // We should also be able to do a multi-hop BTC only payment, paying an + // invoice from Erin by Charlie. + createAndPayNormalInvoiceWithBtc(t.t, charlie, erin, 2000) + logBalance(t.t, nodes, assetID, "after BTC only invoice") + + // ------------ + // Test case 3: Pay an asset invoice from Dave by Charlie, making it + // a direct channel invoice payment with an RFQ SCID present in the + // invoice. + // ------------ + const daveInvoiceAssetAmount = 2_000 + invoiceResp = createAssetInvoice( + t.t, charlie, dave, daveInvoiceAssetAmount, assetID, + ) + payInvoiceWithAssets( + t.t, charlie, dave, invoiceResp.PaymentRequest, assetID, + withSmallShards(), + ) + logBalance(t.t, nodes, assetID, "after invoice") + + charlieAssetBalance -= daveInvoiceAssetAmount + daveAssetBalance += daveInvoiceAssetAmount + + // ------------ + // Test case 3.5: Pay an asset invoice from Dave by Charlie with normal + // satoshi payment flow. We expect that payment to fail, since it's a + // direct channel payment and the invoice is for assets, not sats. So + // without a conversion, it is rejected by the receiver. + // ------------ + invoiceResp = createAssetInvoice( + t.t, charlie, dave, daveInvoiceAssetAmount, assetID, + ) + payInvoiceWithSatoshi( + t.t, charlie, invoiceResp, withFailure( + lnrpc.Payment_FAILED, failureIncorrectDetails, + ), + ) + logBalance(t.t, nodes, assetID, "after asset invoice paid with sats") + + // We don't need to update the asset balances of Charlie and Dave here + // as the invoice payment failed. + + // ------------ + // Test case 4: Pay a normal invoice from Erin by Charlie. + // ------------ + paidAssetAmount := createAndPayNormalInvoice( + t.t, charlie, dave, erin, 20_000, assetID, withSmallShards(), + ) + logBalance(t.t, nodes, assetID, "after invoice") + + charlieAssetBalance -= paidAssetAmount + daveAssetBalance += paidAssetAmount + + // ------------ + // Test case 5: Create an asset invoice on Fabia and pay it from + // Charlie. + // ------------ + const fabiaInvoiceAssetAmount1 = 1000 + invoiceResp = createAssetInvoice( + t.t, erin, fabia, fabiaInvoiceAssetAmount1, assetID, + ) + payInvoiceWithAssets( + t.t, charlie, dave, invoiceResp.PaymentRequest, assetID, + withSmallShards(), + ) + logBalance(t.t, nodes, assetID, "after invoice") + + charlieAssetBalance -= fabiaInvoiceAssetAmount1 + daveAssetBalance += fabiaInvoiceAssetAmount1 + erinAssetBalance -= fabiaInvoiceAssetAmount1 + fabiaAssetBalance += fabiaInvoiceAssetAmount1 + + // ------------ + // Test case 6: Create an asset invoice on Fabia and pay it with just + // BTC from Dave, making sure it ends up being a multipart payment (we + // set the maximum shard size to 80k sat and 15k asset units will be + // more than a single shard). + // ------------ + const fabiaInvoiceAssetAmount2 = 15_000 + invoiceResp = createAssetInvoice( + t.t, erin, fabia, fabiaInvoiceAssetAmount2, assetID, + ) + payInvoiceWithSatoshi(t.t, dave, invoiceResp) + logBalance(t.t, nodes, assetID, "after invoice") + + erinAssetBalance -= fabiaInvoiceAssetAmount2 + fabiaAssetBalance += fabiaInvoiceAssetAmount2 + + // ------------ + // Test case 7: Create an asset invoice on Fabia and pay it with assets + // from Charlie, making sure it ends up being a multipart payment as + // well, with the high amount of asset units to send and the hard coded + // 80k sat max shard size. + // ------------ + const fabiaInvoiceAssetAmount3 = 10_000 + invoiceResp = createAssetInvoice( + t.t, erin, fabia, fabiaInvoiceAssetAmount3, assetID, + ) + payInvoiceWithAssets( + t.t, charlie, dave, invoiceResp.PaymentRequest, assetID, + withSmallShards(), + ) + logBalance(t.t, nodes, assetID, "after invoice") + + charlieAssetBalance -= fabiaInvoiceAssetAmount3 + daveAssetBalance += fabiaInvoiceAssetAmount3 + erinAssetBalance -= fabiaInvoiceAssetAmount3 + fabiaAssetBalance += fabiaInvoiceAssetAmount3 + + // ------------ + // Test case 8: An invoice payment over two channels that are both asset + // channels. + // ------------ + logBalance(t.t, nodes, assetID, "before asset-to-asset") + + const yaraInvoiceAssetAmount1 = 1000 + invoiceResp = createAssetInvoice( + t.t, dave, yara, yaraInvoiceAssetAmount1, assetID, + ) + payInvoiceWithAssets( + t.t, charlie, dave, invoiceResp.PaymentRequest, assetID, + withSmallShards(), + ) + logBalance(t.t, nodes, assetID, "after asset-to-asset") + + charlieAssetBalance -= yaraInvoiceAssetAmount1 + yaraAssetBalance += yaraInvoiceAssetAmount1 + + // ------------ + // Test case 8: Now we'll close each of the channels, starting with the + // Charlie -> Dave custom channel. + // ------------ + t.Logf("Closing Charlie -> Dave channel") + closeAssetChannelAndAssert( + t, net, charlie, dave, chanPointCD, assetID, nil, + universeTap, assertDefaultCoOpCloseBalance(true, true), + ) + + t.Logf("Closing Dave -> Yara channel, close initiated by Yara") + closeAssetChannelAndAssert( + t, net, yara, dave, chanPointDY, assetID, nil, + universeTap, assertDefaultCoOpCloseBalance(false, true), + ) + + t.Logf("Closing Erin -> Fabia channel") + closeAssetChannelAndAssert( + t, net, erin, fabia, chanPointEF, assetID, nil, + universeTap, assertDefaultCoOpCloseBalance(true, true), + ) + + // We've been tracking the off-chain channel balances all this time, so + // now that we have the assets on-chain again, we can assert them. Due + // to rounding errors that happened when sending multiple shards with + // MPP, we need to do some slight adjustments. + charlieAssetBalance += 1 + erinAssetBalance += 4 + fabiaAssetBalance -= 4 + yaraAssetBalance -= 1 + assertAssetBalance(t.t, charlieTap, assetID, charlieAssetBalance) + assertAssetBalance(t.t, daveTap, assetID, daveAssetBalance) + assertAssetBalance(t.t, erinTap, assetID, erinAssetBalance) + assertAssetBalance(t.t, fabiaTap, assetID, fabiaAssetBalance) + assertAssetBalance(t.t, yaraTap, assetID, yaraAssetBalance) + + // ------------ + // Test case 10: We now open a new asset channel and close it again, to + // make sure that a non-existent remote balance is handled correctly. + t.Logf("Opening new asset channel between Charlie and Dave...") + fundRespCD, err := charlieTap.FundChannel( + ctxb, &tchrpc.FundChannelRequest{ + AssetAmount: fundingAmount, + AssetId: assetID, + PeerPubkey: dave.PubKey[:], + FeeRateSatPerVbyte: 5, + }, + ) + require.NoError(t.t, err) + t.Logf("Funded second channel between Charlie and Dave: %v", fundRespCD) + + mineBlocks(t, net, 6, 1) + + // Assert that the proofs for both channels has been uploaded to the + // designated Universe server. + assertUniverseProofExists( + t.t, universeTap, assetID, nil, fundingScriptTreeBytes, + fmt.Sprintf("%v:%v", fundRespCD.Txid, fundRespCD.OutputIndex), + ) + assertAssetChan(t.t, charlie, dave, fundingAmount, cents) + + // And let's just close the channel again. + chanPointCD = &lnrpc.ChannelPoint{ + OutputIndex: uint32(fundRespCD.OutputIndex), + FundingTxid: &lnrpc.ChannelPoint_FundingTxidStr{ + FundingTxidStr: fundRespCD.Txid, + }, + } + + t.Logf("Closing Charlie -> Dave channel") + closeAssetChannelAndAssert( + t, net, charlie, dave, chanPointCD, assetID, nil, + universeTap, assertDefaultCoOpCloseBalance(false, false), + ) + + // Charlie should still have four asset pieces, two with the same size. + assertNumAssetOutputs(t.t, charlieTap, assetID, 2) + assertAssetExists( + t.t, charlieTap, assetID, charlieAssetBalance-fundingAmount, + nil, true, false, false, + ) + assertAssetExists( + t.t, charlieTap, assetID, fundingAmount, nil, true, true, + false, + ) + + // Dave should have two outputs, one from the initial channel with Yara + // and one from the remaining amount of the channel with Charlie. + assertNumAssetOutputs(t.t, daveTap, assetID, 2) + daveFirstChannelRemainder := daveFundingAmount - + yaraInvoiceAssetAmount1 + 1 + assertAssetExists( + t.t, daveTap, assetID, daveFirstChannelRemainder, nil, true, + true, false, + ) + assertAssetExists( + t.t, daveTap, assetID, + daveAssetBalance-daveFirstChannelRemainder, nil, true, true, + false, + ) + + // Fabia and Yara should all have a single output each, just what was + // left over from the initial channel. + assertNumAssetOutputs(t.t, fabiaTap, assetID, 1) + assertAssetExists( + t.t, fabiaTap, assetID, fabiaAssetBalance, nil, true, true, + false, + ) + assertNumAssetOutputs(t.t, yaraTap, assetID, 1) + assertAssetExists( + t.t, yaraTap, assetID, yaraAssetBalance, nil, true, true, false, + ) + + // Erin didn't use all of his assets when opening the channel, so he + // should have two outputs, the change from the channel opening and the + // remaining amount after closing the channel. + assertNumAssetOutputs(t.t, erinTap, assetID, 2) + erinChange := startAmount - erinFundingAmount + assertAssetExists( + t.t, erinTap, assetID, erinAssetBalance-erinChange, nil, true, + true, false, + ) + assertAssetExists( + t.t, erinTap, assetID, erinChange, nil, true, false, false, + ) + + // The asset balances should still remain unchanged. + assertAssetBalance(t.t, charlieTap, assetID, charlieAssetBalance) + assertAssetBalance(t.t, daveTap, assetID, daveAssetBalance) + assertAssetBalance(t.t, erinTap, assetID, erinAssetBalance) + assertAssetBalance(t.t, fabiaTap, assetID, fabiaAssetBalance) +} + +// testCustomChannelsGroupedAsset tests that we can create a network with custom +// channels that use grouped assets and send asset payments over them. +func testCustomChannelsGroupedAsset(_ context.Context, net *NetworkHarness, + t *harnessTest) { + + ctxb := context.Background() + lndArgs := slices.Clone(lndArgsTemplate) + litdArgs := slices.Clone(litdArgsTemplate) + + // Explicitly set the proof courier as Zane (now has no other role + // other than proof shuffling), otherwise a hashmail courier will be + // used. For the funding transaction, we're just posting it and don't + // expect a true receiver. + zane, err := net.NewNode( + t.t, "Zane", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + litdArgs = append(litdArgs, fmt.Sprintf( + "--taproot-assets.proofcourieraddr=%s://%s", + proof.UniverseRpcCourierType, zane.Cfg.LitAddr(), + )) + + // The topology we are going for looks like the following: + // + // Charlie --[assets]--> Dave --[sats]--> Erin --[assets]--> Fabia + // | + // | + // [assets] + // | + // v + // Yara + // + // With [assets] being a custom channel and [sats] being a normal, BTC + // only channel. + // All 5 nodes need to be full litd nodes running in integrated mode + // with tapd included. We also need specific flags to be enabled, so we + // create 5 completely new nodes, ignoring the two default nodes that + // are created by the harness. + charlie, err := net.NewNode( + t.t, "Charlie", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + dave, err := net.NewNode(t.t, "Dave", lndArgs, false, true, litdArgs...) + require.NoError(t.t, err) + erin, err := net.NewNode(t.t, "Erin", lndArgs, false, true, litdArgs...) + require.NoError(t.t, err) + fabia, err := net.NewNode( + t.t, "Fabia", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + yara, err := net.NewNode( + t.t, "Yara", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + nodes := []*HarnessNode{charlie, dave, erin, fabia, yara} + connectAllNodes(t.t, net, nodes) + fundAllNodes(t.t, net, nodes) + + // Create the normal channel between Dave and Erin. + t.Logf("Opening normal channel between Dave and Erin...") + channelOp := openChannelAndAssert( + t, net, dave, erin, lntest.OpenChannelParams{ + Amt: 5_000_000, + SatPerVByte: 5, + }, + ) + defer closeChannelAndAssert(t, net, dave, channelOp, false) + + // This is the only public channel, we need everyone to be aware of it. + assertChannelKnown(t.t, charlie, channelOp) + assertChannelKnown(t.t, fabia, channelOp) + + universeTap := newTapClient(t.t, zane) + charlieTap := newTapClient(t.t, charlie) + daveTap := newTapClient(t.t, dave) + erinTap := newTapClient(t.t, erin) + fabiaTap := newTapClient(t.t, fabia) + yaraTap := newTapClient(t.t, yara) + + groupAssetReq := itest.CopyRequest(&mintrpc.MintAssetRequest{ + Asset: itestAsset, + }) + groupAssetReq.Asset.NewGroupedAsset = true + + // Mint an asset on Charlie and sync all nodes to Charlie as the + // universe. + mintedAssets := itest.MintAssetsConfirmBatch( + t.t, t.lndHarness.Miner.Client, charlieTap, + []*mintrpc.MintAssetRequest{groupAssetReq}, + ) + + cents := mintedAssets[0] + assetID := cents.AssetGenesis.AssetId + groupID := cents.GetAssetGroup().GetTweakedGroupKey() + fundingScriptTree := tapscript.NewChannelFundingScriptTree() + fundingScriptKey := fundingScriptTree.TaprootKey + fundingScriptTreeBytes := fundingScriptKey.SerializeCompressed() + + t.Logf("Minted %d lightning cents, syncing universes...", cents.Amount) + syncUniverses(t.t, charlieTap, dave, erin, fabia, yara) + t.Logf("Universes synced between all nodes, distributing assets...") + + const ( + daveFundingAmount = uint64(startAmount) + erinFundingAmount = uint64(fundingAmount) + ) + charlieFundingAmount := cents.Amount - 2*startAmount + + chanPointCD, chanPointDY, chanPointEF := createTestAssetNetwork( + t, net, charlieTap, daveTap, erinTap, fabiaTap, yaraTap, + universeTap, cents, startAmount, charlieFundingAmount, + daveFundingAmount, erinFundingAmount, DefaultPushSat, + ) + + // We'll be tracking the expected asset balances throughout the test, so + // we can assert it after each action. + charlieAssetBalance := charlieFundingAmount + daveAssetBalance := uint64(startAmount) + erinAssetBalance := uint64(startAmount) + fabiaAssetBalance := uint64(0) + yaraAssetBalance := uint64(0) + + // Before we start sending out payments, let's make sure each node can + // see the other one in the graph and has all required features. + require.NoError(t.t, t.lndHarness.AssertNodeKnown(charlie, dave)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(dave, charlie)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(dave, yara)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(yara, dave)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(erin, fabia)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(fabia, erin)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(charlie, erin)) + + // Print initial channel balances. + logBalance(t.t, nodes, assetID, "initial") + + // ------------ + // Test case 1: Send a direct keysend payment from Charlie to Dave. + // ------------ + const keySendAmount = 100 + sendAssetKeySendPayment( + t.t, charlie, dave, keySendAmount, assetID, fn.None[int64](), + ) + logBalance(t.t, nodes, assetID, "after keysend") + + charlieAssetBalance -= keySendAmount + daveAssetBalance += keySendAmount + + // We should be able to send the 100 assets back immediately, because + // there is enough on-chain balance on Dave's side to be able to create + // an HTLC. + sendAssetKeySendPayment( + t.t, dave, charlie, keySendAmount, assetID, fn.None[int64](), + ) + logBalance(t.t, nodes, assetID, "after keysend back") + + charlieAssetBalance += keySendAmount + daveAssetBalance -= keySendAmount + + // We should also be able to do a non-asset (BTC only) keysend payment. + sendKeySendPayment(t.t, charlie, dave, 2000) + logBalance(t.t, nodes, assetID, "after BTC only keysend") + + // ------------ + // Test case 2: Pay a normal invoice from Dave by Charlie, making it + // a direct channel invoice payment with no RFQ SCID present in the + // invoice. + // ------------ + createAndPayNormalInvoice( + t.t, charlie, dave, dave, 20_000, assetID, withSmallShards(), + withFailure(lnrpc.Payment_FAILED, failureIncorrectDetails), + ) + logBalance(t.t, nodes, assetID, "after invoice") + + // We should also be able to do a multi-hop BTC only payment, paying an + // invoice from Erin by Charlie. + createAndPayNormalInvoiceWithBtc(t.t, charlie, erin, 2000) + logBalance(t.t, nodes, assetID, "after BTC only invoice") + + // ------------ + // Test case 3: Pay an asset invoice from Dave by Charlie, making it + // a direct channel invoice payment with an RFQ SCID present in the + // invoice. + // ------------ + const daveInvoiceAssetAmount = 2_000 + invoiceResp := createAssetInvoice( + t.t, charlie, dave, daveInvoiceAssetAmount, assetID, + ) + payInvoiceWithAssets( + t.t, charlie, dave, invoiceResp.PaymentRequest, assetID, + withSmallShards(), + ) + logBalance(t.t, nodes, assetID, "after invoice") + + // Make sure the invoice on the receiver side and the payment on the + // sender side show the individual HTLCs that arrived for it and that + // they show the correct asset amounts when decoded. + assertInvoiceHtlcAssets( + t.t, dave, invoiceResp, assetID, daveInvoiceAssetAmount, + ) + assertPaymentHtlcAssets( + t.t, charlie, invoiceResp.RHash, assetID, + daveInvoiceAssetAmount, + ) + + charlieAssetBalance -= daveInvoiceAssetAmount + daveAssetBalance += daveInvoiceAssetAmount + + // ------------ + // Test case 4: Pay a normal invoice from Erin by Charlie. + // ------------ + paidAssetAmount := createAndPayNormalInvoice( + t.t, charlie, dave, erin, 20_000, assetID, withSmallShards(), + ) + logBalance(t.t, nodes, assetID, "after invoice") + + charlieAssetBalance -= paidAssetAmount + daveAssetBalance += paidAssetAmount + + // ------------ + // Test case 5: Create an asset invoice on Fabia and pay it from + // Charlie. + // ------------ + const fabiaInvoiceAssetAmount1 = 1000 + invoiceResp = createAssetInvoice( + t.t, erin, fabia, fabiaInvoiceAssetAmount1, assetID, + ) + payInvoiceWithAssets( + t.t, charlie, dave, invoiceResp.PaymentRequest, assetID, + withSmallShards(), + ) + logBalance(t.t, nodes, assetID, "after invoice") + + charlieAssetBalance -= fabiaInvoiceAssetAmount1 + daveAssetBalance += fabiaInvoiceAssetAmount1 + erinAssetBalance -= fabiaInvoiceAssetAmount1 + fabiaAssetBalance += fabiaInvoiceAssetAmount1 + + // ------------ + // Test case 6: Create an asset invoice on Fabia and pay it with just + // BTC from Dave, making sure it ends up being a multipart payment (we + // set the maximum shard size to 80k sat and 15k asset units will be + // more than a single shard). + // ------------ + const fabiaInvoiceAssetAmount2 = 15_000 + invoiceResp = createAssetInvoice( + t.t, erin, fabia, fabiaInvoiceAssetAmount2, assetID, + ) + payInvoiceWithSatoshi(t.t, dave, invoiceResp) + logBalance(t.t, nodes, assetID, "after invoice") + + erinAssetBalance -= fabiaInvoiceAssetAmount2 + fabiaAssetBalance += fabiaInvoiceAssetAmount2 + + // ------------ + // Test case 7: Create an asset invoice on Fabia and pay it with assets + // from Charlie, making sure it ends up being a multipart payment as + // well, with the high amount of asset units to send and the hard coded + // 80k sat max shard size. + // ------------ + const fabiaInvoiceAssetAmount3 = 10_000 + invoiceResp = createAssetInvoice( + t.t, erin, fabia, fabiaInvoiceAssetAmount3, assetID, + ) + payInvoiceWithAssets( + t.t, charlie, dave, invoiceResp.PaymentRequest, assetID, + withSmallShards(), + ) + logBalance(t.t, nodes, assetID, "after invoice") + + charlieAssetBalance -= fabiaInvoiceAssetAmount3 + daveAssetBalance += fabiaInvoiceAssetAmount3 + erinAssetBalance -= fabiaInvoiceAssetAmount3 + fabiaAssetBalance += fabiaInvoiceAssetAmount3 + + // ------------ + // Test case 8: An invoice payment over two channels that are both asset + // channels. + // ------------ + logBalance(t.t, nodes, assetID, "before asset-to-asset") + + const yaraInvoiceAssetAmount1 = 1000 + invoiceResp = createAssetInvoice( + t.t, dave, yara, yaraInvoiceAssetAmount1, assetID, + ) + payInvoiceWithAssets( + t.t, charlie, dave, invoiceResp.PaymentRequest, assetID, + withSmallShards(), + ) + logBalance(t.t, nodes, assetID, "after asset-to-asset") + + charlieAssetBalance -= yaraInvoiceAssetAmount1 + yaraAssetBalance += yaraInvoiceAssetAmount1 + + // ------------ + // Test case 8: Now we'll close each of the channels, starting with the + // Charlie -> Dave custom channel. + // ------------ + t.Logf("Closing Charlie -> Dave channel") + closeAssetChannelAndAssert( + t, net, charlie, dave, chanPointCD, assetID, groupID, + universeTap, assertDefaultCoOpCloseBalance(true, true), + ) + + t.Logf("Closing Dave -> Yara channel, close initiated by Yara") + closeAssetChannelAndAssert( + t, net, yara, dave, chanPointDY, assetID, groupID, + universeTap, assertDefaultCoOpCloseBalance(false, true), + ) + + t.Logf("Closing Erin -> Fabia channel") + closeAssetChannelAndAssert( + t, net, erin, fabia, chanPointEF, assetID, groupID, + universeTap, assertDefaultCoOpCloseBalance(true, true), + ) + + // We've been tracking the off-chain channel balances all this time, so + // now that we have the assets on-chain again, we can assert them. Due + // to rounding errors that happened when sending multiple shards with + // MPP, we need to do some slight adjustments. + charlieAssetBalance += 2 + daveAssetBalance -= 1 + erinAssetBalance += 4 + fabiaAssetBalance -= 4 + yaraAssetBalance -= 1 + assertAssetBalance(t.t, charlieTap, assetID, charlieAssetBalance) + assertAssetBalance(t.t, daveTap, assetID, daveAssetBalance) + assertAssetBalance(t.t, erinTap, assetID, erinAssetBalance) + assertAssetBalance(t.t, fabiaTap, assetID, fabiaAssetBalance) + assertAssetBalance(t.t, yaraTap, assetID, yaraAssetBalance) + + // ------------ + // Test case 10: We now open a new asset channel and close it again, to + // make sure that a non-existent remote balance is handled correctly. + t.Logf("Opening new asset channel between Charlie and Dave...") + fundRespCD, err := charlieTap.FundChannel( + ctxb, &tchrpc.FundChannelRequest{ + AssetAmount: fundingAmount, + AssetId: assetID, + PeerPubkey: dave.PubKey[:], + FeeRateSatPerVbyte: 5, + }, + ) + require.NoError(t.t, err) + t.Logf("Funded second channel between Charlie and Dave: %v", fundRespCD) + + mineBlocks(t, net, 6, 1) + + // Assert that the proofs for both channels has been uploaded to the + // designated Universe server. + assertUniverseProofExists( + t.t, universeTap, nil, groupID, fundingScriptTreeBytes, + fmt.Sprintf("%v:%v", fundRespCD.Txid, fundRespCD.OutputIndex), + ) + assertAssetChan(t.t, charlie, dave, fundingAmount, cents) + + // And let's just close the channel again. + chanPointCD = &lnrpc.ChannelPoint{ + OutputIndex: uint32(fundRespCD.OutputIndex), + FundingTxid: &lnrpc.ChannelPoint_FundingTxidStr{ + FundingTxidStr: fundRespCD.Txid, + }, + } + + t.Logf("Closing Charlie -> Dave channel") + closeAssetChannelAndAssert( + t, net, charlie, dave, chanPointCD, assetID, groupID, + universeTap, assertDefaultCoOpCloseBalance(false, false), + ) + + // Charlie should still have four asset pieces, two with the same size. + assertAssetExists( + t.t, charlieTap, assetID, charlieAssetBalance-fundingAmount, + nil, true, false, false, + ) + assertAssetExists( + t.t, charlieTap, assetID, fundingAmount, nil, true, true, + false, + ) + + // Charlie should have asset outputs: the leftover change from the + // channel funding, and the new close output. + assertNumAssetOutputs(t.t, charlieTap, assetID, 2) + + // The asset balances should still remain unchanged. + assertAssetBalance(t.t, charlieTap, assetID, charlieAssetBalance) + assertAssetBalance(t.t, daveTap, assetID, daveAssetBalance) + assertAssetBalance(t.t, erinTap, assetID, erinAssetBalance) + assertAssetBalance(t.t, fabiaTap, assetID, fabiaAssetBalance) +} + +// testCustomChannelsForceClose tests a force close scenario after both parties +// have an active asset balance. +func testCustomChannelsForceClose(_ context.Context, net *NetworkHarness, + t *harnessTest) { + + lndArgs := slices.Clone(lndArgsTemplate) + litdArgs := slices.Clone(litdArgsTemplate) + + // Explicitly set the proof courier as Zane (now has no other role + // other than proof shuffling), otherwise a hashmail courier will be + // used. For the funding transaction, we're just posting it and don't + // expect a true receiver. + zane, err := net.NewNode( + t.t, "Zane", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + // For our litd args, make sure that they all seen Zane as the main + // Universe server. + litdArgs = append(litdArgs, fmt.Sprintf( + "--taproot-assets.proofcourieraddr=%s://%s", + proof.UniverseRpcCourierType, zane.Cfg.LitAddr(), + )) + + // For this simple test, we'll just have Carol -> Dave as an assets + // channel. + charlie, err := net.NewNode( + t.t, "Charlie", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + dave, err := net.NewNode(t.t, "Dave", lndArgs, false, true, litdArgs...) + require.NoError(t.t, err) + + // Next we'll connect all the nodes and also fund them with some coins. + nodes := []*HarnessNode{charlie, dave} + connectAllNodes(t.t, net, nodes) + fundAllNodes(t.t, net, nodes) + + universeTap := newTapClient(t.t, zane) + charlieTap := newTapClient(t.t, charlie) + daveTap := newTapClient(t.t, dave) + + ctxb := context.Background() + + // Now we'll make an asset for Charlie that we'll use in the test to + // open a channel. + mintedAssets := itest.MintAssetsConfirmBatch( + t.t, t.lndHarness.Miner.Client, charlieTap, + []*mintrpc.MintAssetRequest{ + { + Asset: itestAsset, + }, + }, + ) + cents := mintedAssets[0] + assetID := cents.AssetGenesis.AssetId + + t.Logf("Minted %d lightning cents, syncing universes...", cents.Amount) + syncUniverses(t.t, charlieTap, dave) + t.Logf("Universes synced between all nodes, distributing assets...") + + // Before we actually create the asset channel, we want to make sure + // that failed attempts of creating a channel (e.g. due to insufficient + // on-chain funds) are cleaned up properly on the recipient side. + // We do this by sending all of Charlie's coins to a burn address then + // just sending him 50k sats, which isn't enough to fund a channel. + _, err = charlie.LightningClient.SendCoins( + ctxb, &lnrpc.SendCoinsRequest{ + Addr: burnAddr, + SendAll: true, + MinConfs: 0, + SpendUnconfirmed: true, + }, + ) + require.NoError(t.t, err) + net.SendCoins(t.t, 50_000, charlie) + + // The attempt should fail. But the recipient should receive the error, + // clean up the state and allow Charlie to try again after acquiring + // more funds. + _, err = charlieTap.FundChannel(ctxb, &tchrpc.FundChannelRequest{ + AssetAmount: fundingAmount, + AssetId: assetID, + PeerPubkey: dave.PubKey[:], + FeeRateSatPerVbyte: 5, + }) + require.ErrorContains(t.t, err, "not enough witness outputs to create") + + // Now we'll fund the channel with the correct amount. + net.SendCoins(t.t, btcutil.SatoshiPerBitcoin, charlie) + + // Next we can open an asset channel from Charlie -> Dave, then kick + // off the main scenario. + t.Logf("Opening asset channels...") + assetFundResp, err := charlieTap.FundChannel( + ctxb, &tchrpc.FundChannelRequest{ + AssetAmount: fundingAmount, + AssetId: assetID, + PeerPubkey: dave.PubKey[:], + FeeRateSatPerVbyte: 5, + }, + ) + require.NoError(t.t, err) + t.Logf("Funded channel between Charlie and Dave: %v", assetFundResp) + + // With the channel open, mine a block to confirm it. + mineBlocks(t, net, 6, 1) + + // A transfer for the funding transaction should be found in Charlie's + // DB. + fundingTxid, err := chainhash.NewHashFromStr(assetFundResp.Txid) + require.NoError(t.t, err) + assetFundingTransfer := locateAssetTransfers( + t.t, charlieTap, *fundingTxid, + ) + + t.Logf("Channel funding transfer: %v", + toProtoJSON(t.t, assetFundingTransfer)) + + // Charlie's balance should reflect that the funding asset is now + // excluded from balance reporting by tapd. + assertAssetBalance( + t.t, charlieTap, assetID, itestAsset.Amount-fundingAmount, + ) + + // Make sure that Charlie properly uploaded funding proof to the + // Universe server. + fundingScriptTree := tapscript.NewChannelFundingScriptTree() + fundingScriptKey := fundingScriptTree.TaprootKey + fundingScriptTreeBytes := fundingScriptKey.SerializeCompressed() + assertUniverseProofExists( + t.t, universeTap, assetID, nil, fundingScriptTreeBytes, + fmt.Sprintf( + "%v:%v", assetFundResp.Txid, assetFundResp.OutputIndex, + ), + ) + + // Make sure the channel shows the correct asset information. + assertAssetChan(t.t, charlie, dave, fundingAmount, cents) + + // Before we start sending out payments, let's make sure each node can + // see the other one in the graph and has all required features. + require.NoError(t.t, t.lndHarness.AssertNodeKnown(charlie, dave)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(dave, charlie)) + + // We'll also have dave sync with Charlie+Zane to ensure he has the + // proof for the funding output. We sync the transfers as well so he + // has all the proofs needed. + mode := universerpc.UniverseSyncMode_SYNC_FULL + diff, err := daveTap.SyncUniverse(ctxb, &universerpc.SyncRequest{ + UniverseHost: zane.Cfg.LitAddr(), + SyncMode: mode, + }) + require.NoError(t.t, err) + + t.Logf("Synced Dave w/ Zane, universe_diff=%v", toProtoJSON(t.t, diff)) + + // With the channel confirmed, we'll push over some keysend payments + // from Carol to Dave. We'll send over a bit more BTC each time so Dave + // will go to chain sweep his output (default fee rate is 50 sat/vb). + const ( + numPayments = 5 + keySendAmount = 100 + btcAmt = int64(5_000) + ) + for i := 0; i < numPayments; i++ { + sendAssetKeySendPayment( + t.t, charlie, dave, keySendAmount, assetID, + fn.Some(btcAmt), + ) + } + + logBalance(t.t, nodes, assetID, "after keysend") + + // With the payments sent, we'll now go on chain with a force close + // from Carol. + t.Logf("Force closing channel...") + charlieChanPoint := &lnrpc.ChannelPoint{ + OutputIndex: uint32(assetFundResp.OutputIndex), + FundingTxid: &lnrpc.ChannelPoint_FundingTxidStr{ + FundingTxidStr: assetFundResp.Txid, + }, + } + _, closeTxid, err := net.CloseChannel(charlie, charlieChanPoint, true) + require.NoError(t.t, err) + + t.Logf("Channel closed! Mining blocks, close_txid=%v", closeTxid) + + // Next, we'll mine a block to confirm the force close. + mineBlocks(t, net, 1, 1) + + // At this point, we should have the force close transaction in the set + // of transfers for both nodes. + var forceCloseTransfer *taprpc.ListTransfersResponse + fErr := wait.NoError(func() error { + forceCloseTransfer, err = charlieTap.ListTransfers( + ctxb, &taprpc.ListTransfersRequest{ + AnchorTxid: closeTxid.String(), + }, + ) + if err != nil { + return fmt.Errorf("unable to list charlie transfers: "+ + "%w", err) + } + if len(forceCloseTransfer.Transfers) != 1 { + return fmt.Errorf("charlie is missing force close " + + "transfer") + } + + forceCloseTransfer2, err := daveTap.ListTransfers( + ctxb, &taprpc.ListTransfersRequest{ + AnchorTxid: closeTxid.String(), + }, + ) + if err != nil { + return fmt.Errorf("unable to list dave transfers: %w", + err) + } + if len(forceCloseTransfer2.Transfers) != 1 { + return fmt.Errorf("dave is missing force close " + + "transfer") + } + + return nil + }, defaultTimeout) + require.NoError(t.t, fErr) + + t.Logf("Force close transfer: %v", toProtoJSON(t.t, forceCloseTransfer)) + + // Now that we have the transfer on disk, we'll also assert that the + // universe also has proof for both the relevant transfer outputs. + for _, transfer := range forceCloseTransfer.Transfers { + for _, transferOut := range transfer.Outputs { + assertUniverseProofExists( + t.t, universeTap, assetID, nil, + transferOut.ScriptKey, + transferOut.Anchor.Outpoint, + ) + } + } + + t.Logf("Universe proofs located!") + + time.Sleep(time.Second * 1) + + // We'll mine one more block, which triggers the 1 CSV needed for Dave + // to sweep his output. + mineBlocks(t, net, 1, 0) + + // We should also have a new sweep transaction in the mempool. + daveSweepTxid, err := waitForNTxsInMempool( + net.Miner.Client, 1, time.Second*5, + ) + require.NoError(t.t, err) + + t.Logf("Dave sweep txid: %v", daveSweepTxid) + + // Next, we'll mine a block to confirm Dave's sweep transaction. + // This'll sweep his non-delay commitment output. + mineBlocks(t, net, 1, 1) + + // At this point, a transfer should have been created for Dave's sweep + // transaction. + daveSweepTransfer := locateAssetTransfers( + t.t, daveTap, *daveSweepTxid[0], + ) + + t.Logf("Dave sweep transfer: %v", toProtoJSON(t.t, daveSweepTransfer)) + + time.Sleep(time.Second * 1) + + // Next, we'll mine three additional blocks to trigger the CSV delay + // for Charlie. + mineBlocks(t, net, 3, 0) + + // We expect that Charlie's sweep transaction has been broadcast. + charlieSweepTxid, err := waitForNTxsInMempool( + net.Miner.Client, 1, time.Second*5, + ) + require.NoError(t.t, err) + + t.Logf("Charlie sweep txid: %v", charlieSweepTxid) + + // Now we'll mine a block to confirm Charlie's sweep transaction. + mineBlocks(t, net, 1, 0) + + // Charlie should now have an asset transfer for his sweep transaction. + charlieSweepTransfer := locateAssetTransfers( + t.t, charlieTap, *charlieSweepTxid[0], + ) + + t.Logf("Charlie sweep transfer: %v", toProtoJSON( + t.t, charlieSweepTransfer, + )) + + // Both sides should now reflect their updated asset balances. + daveBalance := uint64(numPayments * keySendAmount) + charlieBalance := itestAsset.Amount - daveBalance + assertAssetBalance(t.t, daveTap, assetID, daveBalance) + assertAssetBalance(t.t, charlieTap, assetID, charlieBalance) + + // Dave should have a single managed UTXO that shows he has a new asset + // UTXO he can use. + assertNumAssetUTXOs(t.t, daveTap, 1) + assertNumAssetUTXOs(t.t, charlieTap, 2) + + // We'll make sure Dave can spend his asset UTXO by sending it all but + // one unit to Zane (the universe). + assetSendAmount := daveBalance - 1 + zaneAddr, err := universeTap.NewAddr(ctxb, &taprpc.NewAddrRequest{ + Amt: assetSendAmount, + AssetId: assetID, + ProofCourierAddr: fmt.Sprintf( + "%s://%s", proof.UniverseRpcCourierType, + charlieTap.node.Cfg.LitAddr(), + ), + }) + require.NoError(t.t, err) + + t.Logf("Sending %v asset from Dave units to Zane...", assetSendAmount) + + // Send the assets to Zane. We expect Dave to have 3 transfers: the + // funding txn, their force close sweep, and now this new send. + itest.AssertAddrCreated(t.t, universeTap, cents, zaneAddr) + sendResp, err := daveTap.SendAsset(ctxb, &taprpc.SendAssetRequest{ + TapAddrs: []string{zaneAddr.Encoded}, + }) + require.NoError(t.t, err) + itest.ConfirmAndAssertOutboundTransfer( + t.t, t.lndHarness.Miner.Client, daveTap, sendResp, assetID, + []uint64{1, assetSendAmount}, 2, 3, + ) + itest.AssertNonInteractiveRecvComplete(t.t, universeTap, 1) + + // And now we also send all assets but one from Charlie to the universe + // to make sure the time lock sweep output can also be spent correctly. + assetSendAmount = charlieBalance - 1 + zaneAddr2, err := universeTap.NewAddr(ctxb, &taprpc.NewAddrRequest{ + Amt: assetSendAmount, + AssetId: assetID, + ProofCourierAddr: fmt.Sprintf( + "%s://%s", proof.UniverseRpcCourierType, + charlieTap.node.Cfg.LitAddr(), + ), + }) + require.NoError(t.t, err) + + t.Logf("Sending %v asset from Charlie units to Zane...", + assetSendAmount) + + itest.AssertAddrCreated(t.t, universeTap, cents, zaneAddr2) + sendResp2, err := charlieTap.SendAsset(ctxb, &taprpc.SendAssetRequest{ + TapAddrs: []string{zaneAddr2.Encoded}, + }) + require.NoError(t.t, err) + itest.ConfirmAndAssertOutboundTransfer( + t.t, t.lndHarness.Miner.Client, charlieTap, sendResp2, assetID, + []uint64{1, assetSendAmount}, 3, 4, + ) + itest.AssertNonInteractiveRecvComplete(t.t, universeTap, 2) +} + +// testCustomChannelsBreach tests a force close scenario that breaches an old +// state, after both parties have an active asset balance. +func testCustomChannelsBreach(_ context.Context, net *NetworkHarness, + t *harnessTest) { + + lndArgs := slices.Clone(lndArgsTemplate) + litdArgs := slices.Clone(litdArgsTemplate) + + // Explicitly set the proof courier as Zane (now has no other role + // other than proof shuffling), otherwise a hashmail courier will be + // used. For the funding transaction, we're just posting it and don't + // expect a true receiver. + zane, err := net.NewNode( + t.t, "Zane", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + // For our litd args, make sure that they all seen Zane as the main + // Universe server. + litdArgs = append(litdArgs, fmt.Sprintf( + "--taproot-assets.proofcourieraddr=%s://%s", + proof.UniverseRpcCourierType, zane.Cfg.LitAddr(), + )) + + // Charlie will be the breached party. We set --nolisten to ensure Dave + // won't be able to connect to him and trigger the channel protection + // logic automatically. We also can't have Charlie automatically + // reconnect too early, otherwise DLP would be initiated instead of the + // breach we want to provoke. + charlieFlags := append( + slices.Clone(lndArgs), "--nolisten", "--minbackoff=1h", + ) + + // For this simple test, we'll just have Carol -> Dave as an assets + // channel. + charlie, err := net.NewNode( + t.t, "Charlie", charlieFlags, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + dave, err := net.NewNode(t.t, "Dave", lndArgs, false, true, litdArgs...) + require.NoError(t.t, err) + + // Next we'll connect all the nodes and also fund them with some coins. + nodes := []*HarnessNode{charlie, dave} + connectAllNodes(t.t, net, nodes) + fundAllNodes(t.t, net, nodes) + + universeTap := newTapClient(t.t, zane) + charlieTap := newTapClient(t.t, charlie) + daveTap := newTapClient(t.t, dave) + + ctxb := context.Background() + + // Now we'll make an asset for Charlie that we'll use in the test to + // open a channel. + mintedAssets := itest.MintAssetsConfirmBatch( + t.t, t.lndHarness.Miner.Client, charlieTap, + []*mintrpc.MintAssetRequest{ + { + Asset: itestAsset, + }, + }, + ) + cents := mintedAssets[0] + assetID := cents.AssetGenesis.AssetId + + t.Logf("Minted %d lightning cents, syncing universes...", cents.Amount) + syncUniverses(t.t, charlieTap, dave) + t.Logf("Universes synced between all nodes, distributing assets...") + + // Next we can open an asset channel from Charlie -> Dave, then kick + // off the main scenario. + t.Logf("Opening asset channels...") + assetFundResp, err := charlieTap.FundChannel( + ctxb, &tchrpc.FundChannelRequest{ + AssetAmount: fundingAmount, + AssetId: assetID, + PeerPubkey: dave.PubKey[:], + FeeRateSatPerVbyte: 5, + }, + ) + require.NoError(t.t, err) + t.Logf("Funded channel between Charlie and Dave: %v", assetFundResp) + + // With the channel open, mine a block to confirm it. + mineBlocks(t, net, 6, 1) + + // A transfer for the funding transaction should be found in Charlie's + // DB. + fundingTxid, err := chainhash.NewHashFromStr(assetFundResp.Txid) + require.NoError(t.t, err) + assetFundingTransfer := locateAssetTransfers( + t.t, charlieTap, *fundingTxid, + ) + + t.Logf("Channel funding transfer: %v", + toProtoJSON(t.t, assetFundingTransfer)) + + // Charlie's balance should reflect that the funding asset is now + // excluded from balance reporting by tapd. + assertAssetBalance( + t.t, charlieTap, assetID, itestAsset.Amount-fundingAmount, + ) + + // Make sure that Charlie properly uploaded funding proof to the + // Universe server. + fundingScriptTree := tapscript.NewChannelFundingScriptTree() + fundingScriptKey := fundingScriptTree.TaprootKey + fundingScriptTreeBytes := fundingScriptKey.SerializeCompressed() + assertUniverseProofExists( + t.t, universeTap, assetID, nil, fundingScriptTreeBytes, + fmt.Sprintf( + "%v:%v", assetFundResp.Txid, assetFundResp.OutputIndex, + ), + ) + + // Make sure the channel shows the correct asset information. + assertAssetChan(t.t, charlie, dave, fundingAmount, cents) + + // Before we start sending out payments, let's make sure each node can + // see the other one in the graph and has all required features. + require.NoError(t.t, t.lndHarness.AssertNodeKnown(charlie, dave)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(dave, charlie)) + + // Next, we'll make keysend payments from Charlie to Dave. we'll use + // this to reach a state where both parties have funds in the channel. + const ( + numPayments = 5 + keySendAmount = 100 + btcAmt = int64(5_000) + ) + for i := 0; i < numPayments; i++ { + sendAssetKeySendPayment( + t.t, charlie, dave, keySendAmount, assetID, + fn.Some(btcAmt), + ) + } + + logBalance(t.t, nodes, assetID, "after keysend -- breach state") + + // Now we'll create an on disk snapshot that we'll use to restore back + // to as our breached state. + require.NoError(t.t, net.StopAndBackupDB(dave)) + connectAllNodes(t.t, net, nodes) + + // We'll send one more keysend payment now to revoke the state we were + // just at above. + sendAssetKeySendPayment( + t.t, charlie, dave, keySendAmount, assetID, fn.Some(btcAmt), + ) + logBalance(t.t, nodes, assetID, "after keysend -- final state") + + // With the final state achieved, we'll now restore Dave (who will be + // force closing) to that old state, the breach state. + require.NoError(t.t, net.StopAndRestoreDB(dave)) + + // With Dave restored, we'll now execute the force close. + t.Logf("Force close by Dave to breach...") + daveChanPoint := &lnrpc.ChannelPoint{ + OutputIndex: uint32(assetFundResp.OutputIndex), + FundingTxid: &lnrpc.ChannelPoint_FundingTxidStr{ + FundingTxidStr: assetFundResp.Txid, + }, + } + _, breachTxid, err := net.CloseChannel(dave, daveChanPoint, true) + require.NoError(t.t, err) + + t.Logf("Channel closed! Mining blocks, close_txid=%v", breachTxid) + + // Next, we'll mine a block to confirm the breach transaction. + mineBlocks(t, net, 1, 1) + + // We should be able to find the transfer of the breach for both + // parties. + charlieBreachTransfer := locateAssetTransfers( + t.t, charlieTap, *breachTxid, + ) + daveBreachTransfer := locateAssetTransfers( + t.t, daveTap, *breachTxid, + ) + + t.Logf("Charlie breach transfer: %v", + toProtoJSON(t.t, charlieBreachTransfer)) + t.Logf("Dave breach transfer: %v", + toProtoJSON(t.t, daveBreachTransfer)) + + // With the breach transaction mined, Charlie should now have a + // transaction in the mempool sweeping the *both* commitment outputs. + charlieJusticeTxid, err := waitForNTxsInMempool( + net.Miner.Client, 1, time.Second*5, + ) + require.NoError(t.t, err) + + t.Logf("Charlie justice txid: %v", charlieJusticeTxid) + + // Next, we'll mine a block to confirm Charlie's justice transaction. + mineBlocks(t, net, 1, 1) + + // Charlie should now have a transfer for his justice transaction. + charlieJusticeTransfer := locateAssetTransfers( + t.t, charlieTap, *charlieJusticeTxid[0], + ) + + t.Logf("Charlie justice transfer: %v", + toProtoJSON(t.t, charlieJusticeTransfer)) + + // Charlie's balance should now be the same as before the breach + // attempt: the amount he minted at the very start. + charlieBalance := itestAsset.Amount + assertAssetBalance(t.t, charlieTap, assetID, charlieBalance) + + t.Logf("Charlie balance after breach: %d", charlieBalance) + + // Charlie should now have 2 total UTXOs: the change from the funding + // output, and now the sweep output from the justice transaction. + charlieUTXOs := assertNumAssetUTXOs(t.t, charlieTap, 2) + + t.Logf("Charlie UTXOs after breach: %v", toProtoJSON(t.t, charlieUTXOs)) +} + +// testCustomChannelsLiquidityEdgeCases is a test that runs through some +// taproot asset channel liquidity related edge cases. +func testCustomChannelsLiquidityEdgeCases(ctxb context.Context, + net *NetworkHarness, t *harnessTest) { + + lndArgs := slices.Clone(lndArgsTemplate) + litdArgs := slices.Clone(litdArgsTemplate) + + // Explicitly set the proof courier as Zane (now has no other role + // other than proof shuffling), otherwise a hashmail courier will be + // used. For the funding transaction, we're just posting it and don't + // expect a true receiver. + zane, err := net.NewNode( + t.t, "Zane", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + litdArgs = append(litdArgs, fmt.Sprintf( + "--taproot-assets.proofcourieraddr=%s://%s", + proof.UniverseRpcCourierType, zane.Cfg.LitAddr(), + )) + + // The topology we are going for looks like the following: + // + // Charlie --[assets]--> Dave --[sats]--> Erin --[assets]--> Fabia + // | + // | + // [assets] + // | + // v + // Yara + // + // With [assets] being a custom channel and [sats] being a normal, BTC + // only channel. + // All 5 nodes need to be full litd nodes running in integrated mode + // with tapd included. We also need specific flags to be enabled, so we + // create 5 completely new nodes, ignoring the two default nodes that + // are created by the harness. + charlie, err := net.NewNode( + t.t, "Charlie", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + dave, err := net.NewNode(t.t, "Dave", lndArgs, false, true, litdArgs...) + require.NoError(t.t, err) + erin, err := net.NewNode(t.t, "Erin", lndArgs, false, true, litdArgs...) + require.NoError(t.t, err) + fabia, err := net.NewNode( + t.t, "Fabia", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + yara, err := net.NewNode( + t.t, "Yara", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + nodes := []*HarnessNode{charlie, dave, erin, fabia, yara} + connectAllNodes(t.t, net, nodes) + fundAllNodes(t.t, net, nodes) + + // Create the normal channel between Dave and Erin. + t.Logf("Opening normal channel between Dave and Erin...") + channelOp := openChannelAndAssert( + t, net, dave, erin, lntest.OpenChannelParams{ + Amt: 10_000_000, + SatPerVByte: 5, + }, + ) + defer closeChannelAndAssert(t, net, dave, channelOp, true) + + // This is the only public channel, we need everyone to be aware of it. + assertChannelKnown(t.t, charlie, channelOp) + assertChannelKnown(t.t, fabia, channelOp) + + universeTap := newTapClient(t.t, zane) + charlieTap := newTapClient(t.t, charlie) + daveTap := newTapClient(t.t, dave) + erinTap := newTapClient(t.t, erin) + fabiaTap := newTapClient(t.t, fabia) + yaraTap := newTapClient(t.t, yara) + + // Mint an asset on Charlie and sync all nodes to Charlie as the + // universe. + mintedAssets := itest.MintAssetsConfirmBatch( + t.t, t.lndHarness.Miner.Client, charlieTap, + []*mintrpc.MintAssetRequest{ + { + Asset: itestAsset, + }, + }, + ) + cents := mintedAssets[0] + assetID := cents.AssetGenesis.AssetId + + t.Logf("Minted %d lightning cents, syncing universes...", cents.Amount) + syncUniverses(t.t, charlieTap, dave, erin, fabia, yara) + t.Logf("Universes synced between all nodes, distributing assets...") + + const ( + daveFundingAmount = uint64(400_000) + erinFundingAmount = uint64(200_000) + ) + charlieFundingAmount := cents.Amount - uint64(2*400_000) + + _, _, _ = createTestAssetNetwork( + t, net, charlieTap, daveTap, erinTap, fabiaTap, yaraTap, + universeTap, cents, 400_000, charlieFundingAmount, + daveFundingAmount, erinFundingAmount, 0, + ) + + // Before we start sending out payments, let's make sure each node can + // see the other one in the graph and has all required features. + require.NoError(t.t, t.lndHarness.AssertNodeKnown(charlie, dave)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(dave, charlie)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(dave, yara)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(yara, dave)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(erin, fabia)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(fabia, erin)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(charlie, erin)) + + logBalance(t.t, nodes, assetID, "initial") + + // Normal case. + // Send 50 assets from Charlie to Dave. + sendAssetKeySendPayment( + t.t, charlie, dave, 50, assetID, fn.None[int64](), + ) + + logBalance(t.t, nodes, assetID, "after 50 assets") + + // Normal case. + // Send 1k sats from Charlie to Dave. + sendKeySendPayment(t.t, charlie, dave, 1000) + + logBalance(t.t, nodes, assetID, "after 1k sats") + + // Edge case: The channel reserve check should trigger, and we should + // get a payment failure, not a timeout. + // + // Now Dave tries to send 50 assets to Charlie. There shouldn't be + // enough sats in the channel. + // + // Assume an acceptable completion window which is half the payment + // timeout. If the payment succeeds within this duration this means we + // didn't fall into a routing loop. + timeoutChan := time.After(PaymentTimeout / 2) + done := make(chan bool, 1) + + go func() { + sendAssetKeySendPayment( + t.t, dave, charlie, 50, assetID, fn.None[int64](), + withFailure(lnrpc.Payment_FAILED, failureNoRoute), + ) + + done <- true + }() + + select { + case <-done: + case <-timeoutChan: + t.Fatalf("Payment didn't fail within expected time duration") + } + + logBalance(t.t, nodes, assetID, "after failed 50 assets") + + // Send 10k sats from Charlie to Dave. + sendKeySendPayment(t.t, charlie, dave, 10000) + + logBalance(t.t, nodes, assetID, "10k sats") + + // Now Dave tries to send 50 assets again, this time he should have + // enough sats. + sendAssetKeySendPayment( + t.t, dave, charlie, 50, assetID, fn.None[int64](), + ) + + logBalance(t.t, nodes, assetID, "after 50 sats backwards") + + // Edge case: This refers to a bug where an asset allocation would be + // expected for this HTLC. This is a dust HTLC and it can not carry + // assets. + // + // Send 1 sat from Charlie to Dave. + sendKeySendPayment(t.t, charlie, dave, 1) + + logBalance(t.t, nodes, assetID, "after 1 sat") + + // Pay a normal bolt11 invoice involving RFQ flow. + _ = createAndPayNormalInvoice( + t.t, charlie, dave, erin, 20_000, assetID, withSmallShards(), + ) + + logBalance(t.t, nodes, assetID, "after 20k sat asset payment") + + // Edge case: There was a bug when paying an asset invoice that would + // evaluate to more than the channel capacity, causing a payment failure + // even though enough asset balance exists. + // + // Pay a bolt11 invoice with assets, which evaluates to more than the + // channel btc capacity. + _ = createAndPayNormalInvoice( + t.t, charlie, dave, erin, 1_000_000, assetID, withSmallShards(), + ) + + logBalance(t.t, nodes, assetID, "after big asset payment (btc "+ + "invoice, multi-hop)") + + // Edge case: Big asset invoice paid by direct peer with assets. + const bigAssetAmount = 100_000 + invoiceResp := createAssetInvoice( + t.t, charlie, dave, bigAssetAmount, assetID, + ) + + payInvoiceWithAssets( + t.t, charlie, dave, invoiceResp.PaymentRequest, assetID, + ) + + logBalance(t.t, nodes, assetID, "after big asset payment (asset "+ + "invoice, direct)") + + // Make sure the invoice on the receiver side and the payment on the + // sender side show the individual HTLCs that arrived for it and that + // they show the correct asset amounts when decoded. + assertInvoiceHtlcAssets( + t.t, dave, invoiceResp, assetID, bigAssetAmount, + ) + assertPaymentHtlcAssets( + t.t, charlie, invoiceResp.RHash, assetID, bigAssetAmount, + ) + + // Dave sends 200k assets and 5k sats to Yara. + sendAssetKeySendPayment( + t.t, dave, yara, 2*bigAssetAmount, assetID, fn.None[int64](), + ) + sendKeySendPayment(t.t, dave, yara, 5_000) + + logBalance(t.t, nodes, assetID, "after 200k assets to Yara") + + // Edge case: Now Charlie creates a big asset invoice to be paid for by + // Yara with assets. This is a multi-hop payment going over 2 asset + // channels, where the total asset value exceeds the btc capacity of the + // channels. + invoiceResp = createAssetInvoice( + t.t, dave, charlie, bigAssetAmount, assetID, + ) + + payInvoiceWithAssets( + t.t, yara, dave, invoiceResp.PaymentRequest, assetID, + ) + + logBalance(t.t, nodes, assetID, "after big asset payment (asset "+ + "invoice, multi-hop)") + + // Edge case: Now Charlie creates a tiny asset invoice to be paid for by + // Yara with satoshi. This is a multi-hop payment going over 2 asset + // channels, where the total asset value is less than the default anchor + // amount of 354 sats. + createAssetInvoice(t.t, dave, charlie, 1, assetID, withInvoiceErrSubStr( + "cannot create invoice over 1 asset units, as the minimal "+ + "transportable amount", + )) + + logBalance(t.t, nodes, assetID, "after small payment (asset "+ + "invoice, <354sats)") + + // Edge case: We now create a small BTC invoice on Erin and ask Charlie + // to pay it with assets. We should get a payment failure as the amount + // is too small to be paid with assets economically. But a payment is + // still possible, since the amount is large enough to represent a + // single unit (17.1 sat per unit). + btcInvoiceResp, err := erin.AddInvoice(ctxb, &lnrpc.Invoice{ + Memo: "small BTC invoice", + ValueMsat: 18_000, + }) + require.NoError(t.t, err) + payInvoiceWithAssets( + t.t, charlie, dave, btcInvoiceResp.PaymentRequest, assetID, + withFeeLimit(2_000), withPayErrSubStr( + "rejecting payment of 20000 mSAT", + ), + ) + + // When we override the uneconomical payment, it should succeed. + payInvoiceWithAssets( + t.t, charlie, dave, btcInvoiceResp.PaymentRequest, assetID, + withFeeLimit(2_000), withAllowOverpay(), + ) + logBalance( + t.t, nodes, assetID, "after small payment (BTC invoice 1 sat)", + ) + + // When we try to pay an invoice amount that's smaller than the + // corresponding value of a single asset unit, the payment will always + // be rejected, even if we set the allow_uneconomical flag. + btcInvoiceResp, err = erin.AddInvoice(ctxb, &lnrpc.Invoice{ + Memo: "very small BTC invoice", + ValueMsat: 1_000, + }) + require.NoError(t.t, err) + payInvoiceWithAssets( + t.t, charlie, dave, btcInvoiceResp.PaymentRequest, assetID, + withFeeLimit(1_000), withAllowOverpay(), withPayErrSubStr( + "rejecting payment of 2000 mSAT", + ), + ) + + // Edge case: Now Dave creates an asset invoice to be paid for by + // Yara with satoshi. For the last hop we try to settle the invoice in + // satoshi, where we will check whether Dave's strict forwarding works + // as expected. Charlie is only used as a dummy RFQ peer in this case, + // Yara totally ignored the RFQ hint and pays agnostically with sats. + invoiceResp = createAssetInvoice(t.t, charlie, dave, 22, assetID) + + stream, err := dave.InvoicesClient.SubscribeSingleInvoice( + ctxb, &invoicesrpc.SubscribeSingleInvoiceRequest{ + RHash: invoiceResp.RHash, + }, + ) + require.NoError(t.t, err) + + // Yara pays Dave with enough satoshis, but Charlie will not settle as + // he expects assets. + payInvoiceWithSatoshiLastHop( + t.t, yara, invoiceResp, dave.PubKey[:], lnrpc.Payment_FAILED, + ) + + t.lndHarness.LNDHarness.AssertInvoiceState(stream, lnrpc.Invoice_OPEN) + + logBalance(t.t, nodes, assetID, "after failed payment (asset "+ + "invoice, strict forwarding)") + + // Edge case: Check if the RFQ HTLC tracking accounts for cancelled + // HTLCs. We achieve this by manually creating & using an RFQ quote with + // a set max amount. We first pay to a hodl invoice that we eventually + // cancel, then pay to a normal invoice which should succeed. + + // We start by sloshing some funds in the Erin<->Fabia. + sendAssetKeySendPayment( + t.t, erin, fabia, 100_000, assetID, fn.Some[int64](20_000), + ) + + logBalance(t.t, nodes, assetID, "balance after 1st slosh") + + // We create the RFQ order. We set the max amt to ~180k sats which is + // going to evaluate to about 10k assets. + inOneHour := time.Now().Add(time.Hour) + resQ, err := charlieTap.RfqClient.AddAssetSellOrder( + ctxb, &rfqrpc.AddAssetSellOrderRequest{ + AssetSpecifier: &rfqrpc.AssetSpecifier{ + Id: &rfqrpc.AssetSpecifier_AssetId{ + AssetId: assetID, + }, + }, + PaymentMaxAmt: 180_000_000, + Expiry: uint64(inOneHour.Unix()), + PeerPubKey: dave.PubKey[:], + TimeoutSeconds: 100, + }, + ) + require.NoError(t.t, err) + + // We now create a hodl invoice on Fabia, for 10k assets. + hodlInv := createAssetHodlInvoice(t.t, erin, fabia, 10_000, assetID) + + // Charlie tries to pay via Dave, by providing the RFQ quote ID that was + // manually created above. + var quoteID rfqmsg.ID + copy(quoteID[:], resQ.GetAcceptedQuote().Id) + payInvoiceWithAssets( + t.t, charlie, dave, hodlInv.payReq, assetID, withSmallShards(), + withFailure(lnrpc.Payment_IN_FLIGHT, failureNone), + withRFQ(quoteID), + ) + + // We now assert that the expected numbers of HTLCs are present on each + // node. + // Reminder, topology looks like this: + // + // Charlie <-> Dave <-> Erin <-> Fabia + // + // Therefore the routing nodes should have double the number of HTLCs + // required for the payment present. + assertNumHtlcs(t.t, charlie, 3) + assertNumHtlcs(t.t, dave, 6) + assertNumHtlcs(t.t, erin, 6) + assertNumHtlcs(t.t, fabia, 3) + + // Now let's cancel the invoice on Fabia. + payHash := hodlInv.preimage.Hash() + _, err = fabia.InvoicesClient.CancelInvoice( + ctxb, &invoicesrpc.CancelInvoiceMsg{ + PaymentHash: payHash[:], + }, + ) + require.NoError(t.t, err) + + // There should be no HTLCs present on any channel. + assertNumHtlcs(t.t, charlie, 0) + assertNumHtlcs(t.t, dave, 0) + assertNumHtlcs(t.t, erin, 0) + assertNumHtlcs(t.t, fabia, 0) + + // Now Fabia creates the normal invoice. + invoiceResp = createAssetInvoice( + t.t, erin, fabia, 10_000, assetID, + ) + + // Now Charlie pays the invoice, again by using the manually specified + // RFQ quote ID. This payment should succeed. + payInvoiceWithAssets( + t.t, charlie, dave, invoiceResp.PaymentRequest, assetID, + withSmallShards(), withRFQ(quoteID), + ) + + logBalance(t.t, nodes, assetID, "after manual rfq hodl") + + // Edge case: Charlie negotiates a quote with Dave which has a low max + // amount (~170k sats). Then Charlie creates an invoice with a total + // amount slightly larger than the max allowed in the quote (200k sats). + // Erin will try to pay that invoice with sats, in shards of max size + // 80k sats. Dave will eventually stop forwarding HTLCs as the RFQ HTLC + // tracking mechanism should stop them from being forwarded, as they + // violate the maximum allowed amount of the quote. + + // Charlie starts by negotiating the quote. + inOneHour = time.Now().Add(time.Hour) + res, err := charlieTap.RfqClient.AddAssetBuyOrder( + ctxb, &rfqrpc.AddAssetBuyOrderRequest{ + AssetSpecifier: &rfqrpc.AssetSpecifier{ + Id: &rfqrpc.AssetSpecifier_AssetId{ + AssetId: assetID, + }, + }, + AssetMaxAmt: 10_000, + Expiry: uint64(inOneHour.Unix()), + PeerPubKey: dave.PubKey[:], + TimeoutSeconds: 10, + }, + ) + require.NoError(t.t, err) + + type acceptedQuote = *rfqrpc.AddAssetBuyOrderResponse_AcceptedQuote + quote, ok := res.Response.(acceptedQuote) + require.True(t.t, ok) + + // We now manually add the invoice in order to inject the above, + // manually generated, quote. + iResp, err := charlie.AddInvoice(ctxb, &lnrpc.Invoice{ + Memo: "", + Value: 200_000, + RPreimage: bytes.Repeat([]byte{11}, 32), + CltvExpiry: 60, + RouteHints: []*lnrpc.RouteHint{{ + HopHints: []*lnrpc.HopHint{{ + NodeId: dave.PubKeyStr, + ChanId: quote.AcceptedQuote.Scid, + }}, + }}, + }) + require.NoError(t.t, err) + + // Now Erin tries to pay the invoice. Since rfq quote cannot satisfy the + // total amount of the invoice this payment will fail. + payInvoiceWithSatoshi( + t.t, erin, iResp, withPayErrSubStr("context deadline exceeded"), + withFailure(lnrpc.Payment_FAILED, failureNone), + ) + + logBalance(t.t, nodes, assetID, "after small manual rfq") +} + +// testCustomChannelsBalanceConsistency is a test that test the balance of nodes +// under channel opening circumstances. +func testCustomChannelsBalanceConsistency(_ context.Context, + net *NetworkHarness, t *harnessTest) { + + ctxb := context.Background() + lndArgs := slices.Clone(lndArgsTemplate) + litdArgs := slices.Clone(litdArgsTemplate) + + // Explicitly set the proof courier as Zane (now has no other role + // other than proof shuffling), otherwise a hashmail courier will be + // used. For the funding transaction, we're just posting it and don't + // expect a true receiver. + zane, err := net.NewNode( + t.t, "Zane", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + litdArgs = append(litdArgs, fmt.Sprintf( + "--taproot-assets.proofcourieraddr=%s://%s", + proof.UniverseRpcCourierType, zane.Cfg.LitAddr(), + )) + + charlie, err := net.NewNode( + t.t, "Charlie", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + dave, err := net.NewNode(t.t, "Dave", lndArgs, false, true, litdArgs...) + require.NoError(t.t, err) + + nodes := []*HarnessNode{charlie, dave} + connectAllNodes(t.t, net, nodes) + fundAllNodes(t.t, net, nodes) + + charlieTap := newTapClient(t.t, charlie) + daveTap := newTapClient(t.t, dave) + universeTap := newTapClient(t.t, zane) + + // Mint an asset on Charlie and sync Dave to Charlie as the universe. + mintedAssets := itest.MintAssetsConfirmBatch( + t.t, t.lndHarness.Miner.Client, charlieTap, + []*mintrpc.MintAssetRequest{ + { + Asset: itestAsset, + }, + }, + ) + cents := mintedAssets[0] + assetID := cents.AssetGenesis.AssetId + var groupKey []byte + if cents.AssetGroup != nil { + groupKey = cents.AssetGroup.TweakedGroupKey + } + + t.Logf("Minted %d lightning cents, syncing universes...", cents.Amount) + syncUniverses(t.t, charlieTap, dave) + t.Logf("Universes synced between all nodes, distributing assets...") + + charlieBalance := cents.Amount + + // Charlie should have a single balance output with the full balance. + assertAssetBalance(t.t, charlieTap, assetID, cents.Amount) + + // The script key should be local to charlie, and the script key should + // be known. It is after all the asset he just minted himself. + scriptKeyLocal := true + scriptKeyKnown := false + scriptKeyHasScriptPath := false + + scriptKey, err := schnorr.ParsePubKey(cents.ScriptKey[1:]) + require.NoError(t.t, err) + assertAssetExists( + t.t, charlieTap, assetID, charlieBalance, + scriptKey, scriptKeyLocal, scriptKeyKnown, + scriptKeyHasScriptPath, + ) + + fundingScriptTree := tapscript.NewChannelFundingScriptTree() + fundingScriptKey := fundingScriptTree.TaprootKey + fundingScriptTreeBytes := fundingScriptKey.SerializeCompressed() + + fundRespCD, err := charlieTap.FundChannel( + ctxb, &tchrpc.FundChannelRequest{ + AssetAmount: charlieBalance, + AssetId: assetID, + PeerPubkey: daveTap.node.PubKey[:], + FeeRateSatPerVbyte: 5, + PushSat: 0, + }, + ) + require.NoError(t.t, err) + t.Logf("Funded channel between Charlie and Dave: %v", fundRespCD) + + // Make sure the pending channel shows up in the list and has the + // custom records set as JSON. + assertPendingChannels( + t.t, charlieTap.node, cents, 1, charlieBalance, 0, + ) + + // Let's confirm the channel. + mineBlocks(t, net, 6, 1) + + // Tapd should not report any balance for Charlie, since the asset is + // used in a funding transaction. It should also not report any balance + // for Dave. All those balances are reported through channel balances. + assertAssetBalance(t.t, charlieTap, assetID, 0) + assertAssetBalance(t.t, daveTap, assetID, 0) + + // There should only be a single asset piece for Charlie, the one in the + // channel. + assertNumAssetOutputs(t.t, charlieTap, assetID, 1) + + // The script key should now not be local anymore, since he funded a + // channel with it. Charlie does still know the script key though. + scriptKeyLocal = false + scriptKeyKnown = true + scriptKeyHasScriptPath = true + assertAssetExists( + t.t, charlieTap, assetID, charlieBalance, + fundingScriptKey, scriptKeyLocal, scriptKeyKnown, + scriptKeyHasScriptPath, + ) + + // Assert that the proofs for both channels has been uploaded to the + // designated Universe server. + assertUniverseProofExists( + t.t, universeTap, assetID, groupKey, fundingScriptTreeBytes, + fmt.Sprintf("%v:%v", fundRespCD.Txid, fundRespCD.OutputIndex), + ) + + // Make sure the channel shows the correct asset information. + assertAssetChan( + t.t, charlieTap.node, daveTap.node, charlieBalance, cents, + ) + + logBalance(t.t, nodes, assetID, "initial") + + // Normal case. + // Send 500 assets from Charlie to Dave. + sendAssetKeySendPayment( + t.t, charlie, dave, 500, assetID, fn.None[int64](), + ) + + logBalance(t.t, nodes, assetID, "after 500 assets") + + // Tapd should still not report balances for Charlie and Dave, since + // they are still locked up in the funding transaction. + assertAssetBalance(t.t, charlieTap, assetID, 0) + assertAssetBalance(t.t, daveTap, assetID, 0) + + // Send 10k sats from Charlie to Dave. Dave needs the sats to be able to + // send assets. + sendKeySendPayment(t.t, charlie, dave, 10000) + + // Now Dave tries to send 250 assets. + sendAssetKeySendPayment( + t.t, dave, charlie, 250, assetID, fn.None[int64](), + ) + + logBalance(t.t, nodes, assetID, "after 250 sats backwards") + + // Tapd should still not report balances for Charlie and Dave, since + // they are still locked up in the funding transaction. + assertAssetBalance(t.t, charlieTap, assetID, 0) + assertAssetBalance(t.t, daveTap, assetID, 0) + + // We will now close the channel. + t.Logf("Close the channel between Charlie and Dave...") + charlieChanPoint := &lnrpc.ChannelPoint{ + OutputIndex: uint32(fundRespCD.OutputIndex), + FundingTxid: &lnrpc.ChannelPoint_FundingTxidStr{ + FundingTxidStr: fundRespCD.Txid, + }, + } + + closeChannelAndAssert(t, net, charlie, charlieChanPoint, false) + + // Charlie should have a single balance output with the balance 250 less + // than the total amount minted. + assertAssetBalance(t.t, charlieTap, assetID, charlieBalance-250) + assertAssetBalance(t.t, daveTap, assetID, 250) + + // The script key should now be local to both Charlie and Dave, since + // the channel was closed. + scriptKeyLocal = true + scriptKeyKnown = true + scriptKeyHasScriptPath = false + assertAssetExists( + t.t, charlieTap, assetID, charlieBalance-250, + nil, scriptKeyLocal, scriptKeyKnown, scriptKeyHasScriptPath, + ) + assertAssetExists( + t.t, daveTap, assetID, 250, + nil, scriptKeyLocal, scriptKeyKnown, scriptKeyHasScriptPath, + ) + + assertNumAssetOutputs(t.t, charlieTap, assetID, 1) + assertNumAssetOutputs(t.t, daveTap, assetID, 1) +} + +// testCustomChannelsSingleAssetMultiInput tests whether it is possible to fund +// a channel using FundChannel that uses multiple inputs from the same asset. +func testCustomChannelsSingleAssetMultiInput(_ context.Context, + net *NetworkHarness, t *harnessTest) { + + ctxb := context.Background() + lndArgs := slices.Clone(lndArgsTemplate) + litdArgs := slices.Clone(litdArgsTemplate) + + zane, err := net.NewNode( + t.t, "Zane", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + litdArgs = append(litdArgs, fmt.Sprintf( + "--taproot-assets.proofcourieraddr=%s://%s", + proof.UniverseRpcCourierType, zane.Cfg.LitAddr(), + )) + + charlie, err := net.NewNode( + t.t, "Charlie", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + dave, err := net.NewNode(t.t, "Dave", lndArgs, false, true, litdArgs...) + require.NoError(t.t, err) + + nodes := []*HarnessNode{charlie, dave} + connectAllNodes(t.t, net, nodes) + fundAllNodes(t.t, net, nodes) + + charlieTap := newTapClient(t.t, charlie) + daveTap := newTapClient(t.t, dave) + + // Mint an assets on Charlie and sync Dave to Charlie as the universe. + mintedAssets := itest.MintAssetsConfirmBatch( + t.t, t.lndHarness.Miner.Client, charlieTap, + []*mintrpc.MintAssetRequest{ + { + Asset: itestAsset, + }, + }, + ) + cents := mintedAssets[0] + assetID := cents.AssetGenesis.AssetId + + t.Logf("Minted %d lightning cents, syncing universes...", + cents.Amount) + syncUniverses(t.t, charlieTap, dave) + t.Logf("Universes synced between all nodes, distributing assets...") + + // Charlie should have two balance outputs with the full balance. + assertAssetBalance(t.t, charlieTap, assetID, cents.Amount) + + // Send assets to Dave so he can fund a channel. + halfCentsAmount := cents.Amount / 2 + daveAddr1, err := daveTap.NewAddr(ctxb, &taprpc.NewAddrRequest{ + Amt: halfCentsAmount, + AssetId: assetID, + ProofCourierAddr: fmt.Sprintf( + "%s://%s", proof.UniverseRpcCourierType, + charlieTap.node.Cfg.LitAddr(), + ), + }) + require.NoError(t.t, err) + daveAddr2, err := daveTap.NewAddr(ctxb, &taprpc.NewAddrRequest{ + Amt: halfCentsAmount, + AssetId: assetID, + ProofCourierAddr: fmt.Sprintf( + "%s://%s", proof.UniverseRpcCourierType, + charlieTap.node.Cfg.LitAddr(), + ), + }) + require.NoError(t.t, err) + + t.Logf("Sending %v asset units to Dave twice...", halfCentsAmount) + + // Send the assets to Dave. + itest.AssertAddrCreated(t.t, daveTap, cents, daveAddr1) + itest.AssertAddrCreated(t.t, daveTap, cents, daveAddr2) + sendResp, err := charlieTap.SendAsset(ctxb, &taprpc.SendAssetRequest{ + TapAddrs: []string{daveAddr1.Encoded, daveAddr2.Encoded}, + }) + require.NoError(t.t, err) + itest.ConfirmAndAssertOutboundTransferWithOutputs( + t.t, t.lndHarness.Miner.Client, charlieTap, sendResp, assetID, + []uint64{ + cents.Amount - 2*halfCentsAmount, halfCentsAmount, + halfCentsAmount, + }, 0, 1, 3, + ) + itest.AssertNonInteractiveRecvComplete(t.t, daveTap, 2) + + // Fund a channel using multiple inputs from the same asset. + fundRespCD, err := daveTap.FundChannel( + ctxb, &tchrpc.FundChannelRequest{ + AssetAmount: 2 * halfCentsAmount, + AssetId: assetID, + PeerPubkey: charlieTap.node.PubKey[:], + FeeRateSatPerVbyte: 5, + PushSat: 0, + }, + ) + require.NoError(t.t, err) + t.Logf("Funded channel between Charlie and Dave: %v", fundRespCD) + + // Let's confirm the channel. + mineBlocks(t, net, 6, 1) + + // Tapd should not report any balance for Charlie, since the asset is + // used in a funding transaction. It should also not report any balance + // for Dave. All those balances are reported through channel balances. + assertAssetBalance(t.t, charlieTap, assetID, 0) + assertAssetBalance(t.t, daveTap, assetID, 0) + + // Make sure the channel shows the correct asset information. + assertAssetChan( + t.t, charlieTap.node, daveTap.node, 2*halfCentsAmount, cents, + ) +} + +// testCustomChannelsOraclePricing tests that all asset transfers are correctly +// priced when using an oracle that isn't tapd's mock oracle. +func testCustomChannelsOraclePricing(_ context.Context, + net *NetworkHarness, t *harnessTest) { + + usdMetaData := &taprpc.AssetMeta{ + Data: []byte(`{ +"description":"this is a USD stablecoin with decimal display of 6" +}`), + Type: taprpc.AssetMetaType_META_TYPE_JSON, + } + + const decimalDisplay = 6 + itestAsset = &mintrpc.MintAsset{ + AssetType: taprpc.AssetType_NORMAL, + Name: "USD", + AssetMeta: usdMetaData, + // We mint 1 million USD with a decimal display of 6, which + // results in 1 trillion asset units. + Amount: 1_000_000_000_000, + DecimalDisplay: decimalDisplay, + } + + oracleAddr := fmt.Sprintf("localhost:%d", port.NextAvailablePort()) + oracle := newOracleHarness(oracleAddr) + oracle.start(t.t) + t.t.Cleanup(oracle.stop) + + ctxb := context.Background() + lndArgs := slices.Clone(lndArgsTemplate) + litdArgs := slices.Clone(litdArgsTemplateNoOracle) + litdArgs = append(litdArgs, fmt.Sprintf( + "--taproot-assets.experimental.rfq.priceoracleaddress="+ + "rfqrpc://%s", oracleAddr, + )) + + // Explicitly set the proof courier as Zane (now has no other role + // other than proof shuffling), otherwise a hashmail courier will be + // used. For the funding transaction, we're just posting it and don't + // expect a true receiver. + zane, err := net.NewNode( + t.t, "Zane", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + litdArgs = append(litdArgs, fmt.Sprintf( + "--taproot-assets.proofcourieraddr=%s://%s", + proof.UniverseRpcCourierType, zane.Cfg.LitAddr(), + )) + + // The topology we are going for looks like the following: + // + // Charlie --[assets]--> Dave --[sats]--> Erin --[assets]--> Fabia + // | + // | + // [assets] + // | + // v + // Yara + // + // With [assets] being a custom channel and [sats] being a normal, BTC + // only channel. + // All 5 nodes need to be full litd nodes running in integrated mode + // with tapd included. We also need specific flags to be enabled, so we + // create 5 completely new nodes, ignoring the two default nodes that + // are created by the harness. + charlie, err := net.NewNode( + t.t, "Charlie", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + dave, err := net.NewNode(t.t, "Dave", lndArgs, false, true, litdArgs...) + require.NoError(t.t, err) + erin, err := net.NewNode(t.t, "Erin", lndArgs, false, true, litdArgs...) + require.NoError(t.t, err) + fabia, err := net.NewNode( + t.t, "Fabia", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + yara, err := net.NewNode( + t.t, "Yara", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + nodes := []*HarnessNode{charlie, dave, erin, fabia, yara} + connectAllNodes(t.t, net, nodes) + fundAllNodes(t.t, net, nodes) + + // Create the normal channel between Dave and Erin. + t.Logf("Opening normal channel between Dave and Erin...") + const btcChannelFundingAmount = 10_000_000 + chanPointDE := openChannelAndAssert( + t, net, dave, erin, lntest.OpenChannelParams{ + Amt: btcChannelFundingAmount, + SatPerVByte: 5, + }, + ) + defer closeChannelAndAssert(t, net, dave, chanPointDE, false) + + // This is the only public channel, we need everyone to be aware of it. + assertChannelKnown(t.t, charlie, chanPointDE) + assertChannelKnown(t.t, fabia, chanPointDE) + + universeTap := newTapClient(t.t, zane) + charlieTap := newTapClient(t.t, charlie) + daveTap := newTapClient(t.t, dave) + erinTap := newTapClient(t.t, erin) + fabiaTap := newTapClient(t.t, fabia) + yaraTap := newTapClient(t.t, yara) + + // Mint an asset on Charlie and sync Dave to Charlie as the universe. + mintedAssets := itest.MintAssetsConfirmBatch( + t.t, t.lndHarness.Miner.Client, charlieTap, + []*mintrpc.MintAssetRequest{ + { + Asset: itestAsset, + }, + }, + ) + usdAsset := mintedAssets[0] + assetID := usdAsset.AssetGenesis.AssetId + + // Now that we've minted the asset, we can set the price in the oracle. + var id asset.ID + copy(id[:], assetID) + + // Let's assume the current USD price for 1 BTC is 66,548.40. We'll take + // that price and add a 4% spread, 2% on each side (buy/sell) to earn + // money as the oracle. 2% is 1,330.97, so we'll set the sell price to + // 65,217.43 and the purchase price to 67,879.37. + // The following numbers are to help understand the magic numbers below. + // They're the price in USD/BTC, the price of 1 USD in sats and the + // expected price in asset units per BTC. + // 65,217.43 => 1533.332 => 65_217_430_000 + // 66,548.40 => 1502.666 => 66_548_400_000 + // 67,879.37 => 1473.202 => 67_879_370_000 + salePrice := rfqmath.NewBigIntFixedPoint(65_217_43, 2) + purchasePrice := rfqmath.NewBigIntFixedPoint(67_879_37, 2) + + // We now have the prices defined in USD. But the asset has a decimal + // display of 6, so we need to multiply them by 10^6. + factor := rfqmath.NewBigInt( + big.NewInt(int64(math.Pow10(decimalDisplay))), + ) + salePrice.Coefficient = salePrice.Coefficient.Mul(factor) + purchasePrice.Coefficient = purchasePrice.Coefficient.Mul(factor) + oracle.setPrice(id, purchasePrice, salePrice) + + t.Logf("Minted %d USD assets, syncing universes...", usdAsset.Amount) + syncUniverses(t.t, charlieTap, dave, erin, fabia, yara) + t.Logf("Universes synced between all nodes, distributing assets...") + + const ( + sendAmount = uint64(400_000_000) + daveFundingAmount = uint64(400_000_000) + erinFundingAmount = uint64(200_000_000) + ) + charlieFundingAmount := usdAsset.Amount - 2*sendAmount + + chanPointCD, chanPointDY, chanPointEF := createTestAssetNetwork( + t, net, charlieTap, daveTap, erinTap, fabiaTap, yaraTap, + universeTap, usdAsset, sendAmount, charlieFundingAmount, + daveFundingAmount, erinFundingAmount, 0, + ) + + // Before we start sending out payments, let's make sure each node can + // see the other one in the graph and has all required features. + require.NoError(t.t, t.lndHarness.AssertNodeKnown(charlie, dave)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(dave, charlie)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(dave, yara)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(yara, dave)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(erin, fabia)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(fabia, erin)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(charlie, erin)) + + // We now create an invoice at Fabia for 100 USD, which is 100_000_000 + // asset units with decimal display of 6. + const fabiaInvoiceAssetAmount = 100_000_000 + invoiceResp := createAssetInvoice( + t.t, erin, fabia, fabiaInvoiceAssetAmount, assetID, + ) + decodedInvoice, err := fabia.DecodePayReq(ctxb, &lnrpc.PayReqString{ + PayReq: invoiceResp.PaymentRequest, + }) + require.NoError(t.t, err) + + // The invoice amount should come out as 100 * 1533.332. + require.EqualValues(t.t, 153_333_242, decodedInvoice.NumMsat) + + numUnits, rate := payInvoiceWithAssets( + t.t, charlie, dave, invoiceResp.PaymentRequest, assetID, + ) + logBalance(t.t, nodes, assetID, "after invoice") + + // The calculated amount Charlie has to pay should come out as + // 153_333_242 / 1473.202, which is quite exactly 4% more than will + // arrive at the destination (which is the oracle's configured spread). + // This is before routing fees though. + const charlieInvoiceAmount = 104_081_638 + require.EqualValues(t.t, charlieInvoiceAmount, numUnits) + + // The default routing fees are 1ppm + 1msat per hop, and we have 2 + // hops in total. + charliePaidMSat := addRoutingFee(addRoutingFee(lnwire.MilliSatoshi( + decodedInvoice.NumMsat, + ))) + charliePaidAmount := rfqmath.MilliSatoshiToUnits( + charliePaidMSat, rate, + ).ScaleTo(0).ToUint64() + assertPaymentHtlcAssets( + t.t, charlie, invoiceResp.RHash, assetID, charliePaidAmount, + ) + + // We now make sure the asset and satoshi channel balances are exactly + // what we expect them to be. + var ( + // channelFundingAmount is the hard coded satoshi amount that + // currently goes into asset channels. + channelFundingAmount int64 = 100_000 + + // commitFeeP2TR is the default commit fee for a P2TR channel + // commitment with 4 outputs (to_local, to_remote, 2 anchors). + commitFeeP2TR int64 = 2420 + commitFeeP2WSH int64 = 2810 + anchorAmount int64 = 330 + assetHtlcCarryAmount = int64( + rfqmath.DefaultOnChainHtlcSat, + ) + unbalancedLocalAmount = channelFundingAmount - commitFeeP2TR - + anchorAmount + balancedLocalAmount = unbalancedLocalAmount - anchorAmount + ) + + // Checking Charlie's sat and asset balances in channel Charlie->Dave. + assertChannelSatBalance( + t.t, charlie, chanPointCD, + balancedLocalAmount-assetHtlcCarryAmount, assetHtlcCarryAmount, + ) + assertChannelAssetBalance( + t.t, charlie, chanPointCD, + charlieFundingAmount-charliePaidAmount, charliePaidAmount, + ) + + // Checking Dave's sat and asset balances in channel Charlie->Dave. + assertChannelSatBalance( + t.t, dave, chanPointCD, + assetHtlcCarryAmount, balancedLocalAmount-assetHtlcCarryAmount, + ) + assertChannelAssetBalance( + t.t, dave, chanPointCD, + charliePaidAmount, charlieFundingAmount-charliePaidAmount, + ) + + // Checking Dave's sat balance in channel Dave->Erin. + forwardAmountDave := addRoutingFee( + lnwire.MilliSatoshi(decodedInvoice.NumMsat), + ).ToSatoshis() + assertChannelSatBalance( + t.t, dave, chanPointDE, + btcChannelFundingAmount-commitFeeP2WSH-2*anchorAmount- + int64(forwardAmountDave), + int64(forwardAmountDave), + ) + + // Checking Erin's sat balance in channel Dave->Erin. + assertChannelSatBalance( + t.t, erin, chanPointDE, + int64(forwardAmountDave), + btcChannelFundingAmount-commitFeeP2WSH-2*anchorAmount- + int64(forwardAmountDave), + ) + + // Checking Erin's sat and asset balances in channel Erin->Fabia. + assertChannelSatBalance( + t.t, erin, chanPointEF, + balancedLocalAmount-assetHtlcCarryAmount, assetHtlcCarryAmount, + ) + assertChannelAssetBalance( + t.t, erin, chanPointEF, + erinFundingAmount-fabiaInvoiceAssetAmount, + fabiaInvoiceAssetAmount, + ) + + // Checking Fabia's sat and asset balances in channel Erin->Fabia. + assertChannelSatBalance( + t.t, fabia, chanPointEF, + assetHtlcCarryAmount, balancedLocalAmount-assetHtlcCarryAmount, + ) + assertChannelAssetBalance( + t.t, erin, chanPointEF, + fabiaInvoiceAssetAmount, + erinFundingAmount-fabiaInvoiceAssetAmount, + ) + + t.Logf("Closing Charlie -> Dave channel") + closeAssetChannelAndAssert( + t, net, charlie, dave, chanPointCD, assetID, nil, universeTap, + noOpCoOpCloseBalanceCheck, + ) + + t.Logf("Closing Dave -> Yara channel, close initiated by Yara") + closeAssetChannelAndAssert( + t, net, yara, dave, chanPointDY, assetID, nil, universeTap, + noOpCoOpCloseBalanceCheck, + ) + + t.Logf("Closing Erin -> Fabia channel") + closeAssetChannelAndAssert( + t, net, erin, fabia, chanPointEF, assetID, nil, universeTap, + noOpCoOpCloseBalanceCheck, + ) +} + +// testCustomChannelsFee tests whether the custom channel funding process +// fails if the proposed fee rate is lower than the minimum relay fee. +func testCustomChannelsFee(_ context.Context, + net *NetworkHarness, t *harnessTest) { + + ctxb := context.Background() + lndArgs := slices.Clone(lndArgsTemplate) + litdArgs := slices.Clone(litdArgsTemplate) + + zane, err := net.NewNode( + t.t, "Zane", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + litdArgs = append(litdArgs, fmt.Sprintf( + "--taproot-assets.proofcourieraddr=%s://%s", + proof.UniverseRpcCourierType, zane.Cfg.LitAddr(), + )) + + charlie, err := net.NewNode( + t.t, "Charlie", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + dave, err := net.NewNode(t.t, "Dave", lndArgs, false, true, litdArgs...) + require.NoError(t.t, err) + + nodes := []*HarnessNode{charlie, dave} + connectAllNodes(t.t, net, nodes) + fundAllNodes(t.t, net, nodes) + + charlieTap := newTapClient(t.t, charlie) + daveTap := newTapClient(t.t, dave) + + // Mint an assets on Charlie and sync Dave to Charlie as the universe. + mintedAssets := itest.MintAssetsConfirmBatch( + t.t, t.lndHarness.Miner.Client, charlieTap, + []*mintrpc.MintAssetRequest{ + { + Asset: itestAsset, + }, + }, + ) + cents := mintedAssets[0] + assetID := cents.AssetGenesis.AssetId + + t.Logf("Minted %d lightning cents, syncing universes...", cents.Amount) + syncUniverses(t.t, charlieTap, dave) + t.Logf("Universes synced between all nodes, distributing assets...") + + // Fund a channel with a fee rate of zero. + zeroFeeRate := uint32(0) + + _, err = charlieTap.FundChannel( + ctxb, &tchrpc.FundChannelRequest{ + AssetAmount: cents.Amount, + AssetId: assetID, + PeerPubkey: daveTap.node.PubKey[:], + FeeRateSatPerVbyte: zeroFeeRate, + PushSat: 0, + }, + ) + + errSpecifyFeerate := "fee rate must be specified" + require.ErrorContains(t.t, err, errSpecifyFeerate) + + // Fund a channel with a fee rate that is too low. + tooLowFeeRate := uint32(1) + tooLowFeeRateAmount := chainfee.SatPerVByte(tooLowFeeRate) + + _, err = charlieTap.FundChannel( + ctxb, &tchrpc.FundChannelRequest{ + AssetAmount: cents.Amount, + AssetId: assetID, + PeerPubkey: daveTap.node.PubKey[:], + FeeRateSatPerVbyte: tooLowFeeRate, + PushSat: 0, + }, + ) + + errFeeRateTooLow := fmt.Sprintf("fee rate %s too low, "+ + "min_relay_fee: ", tooLowFeeRateAmount.FeePerKWeight()) + require.ErrorContains(t.t, err, errFeeRateTooLow) +} + +// testCustomChannelsHtlcForceClose tests that we can force close a channel +// with HTLCs in both directions and that the HTLC outputs are correctly +// swept. +func testCustomChannelsHtlcForceClose(ctxb context.Context, net *NetworkHarness, + t *harnessTest) { + + runCustomChannelsHtlcForceClose(ctxb, t, net, false) + runCustomChannelsHtlcForceClose(ctxb, t, net, true) +} + +// runCustomChannelsHtlcForceClose is a helper function that runs the HTLC force +// close test with the given MPP setting. +func runCustomChannelsHtlcForceClose(ctxb context.Context, t *harnessTest, + net *NetworkHarness, mpp bool) { + + t.Logf("Running test with MPP: %v", mpp) + + lndArgs := slices.Clone(lndArgsTemplate) + litdArgs := slices.Clone(litdArgsTemplate) + + // Zane will serve as our designated Universe node. + zane, err := net.NewNode( + t.t, "Zane", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + litdArgs = append(litdArgs, fmt.Sprintf( + "--taproot-assets.proofcourieraddr=%s://%s", + proof.UniverseRpcCourierType, zane.Cfg.LitAddr(), + )) + + // Next, we'll make Alice and Bob, who will be the main nodes under + // test. + alice, err := net.NewNode( + t.t, "Alice", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + bob, err := net.NewNode( + t.t, "Bob", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + // Now we'll connect all nodes, and also fund them with some coins. + nodes := []*HarnessNode{alice, bob} + connectAllNodes(t.t, net, nodes) + fundAllNodes(t.t, net, nodes) + + aliceTap := newTapClient(t.t, alice) + bobTap := newTapClient(t.t, bob) + + // Next, we'll mint an asset for Alice, who will be the node that opens + // the channel outbound. + mintedAssets := itest.MintAssetsConfirmBatch( + t.t, t.lndHarness.Miner.Client, aliceTap, + []*mintrpc.MintAssetRequest{ + { + Asset: itestAsset, + }, + }, + ) + cents := mintedAssets[0] + assetID := cents.AssetGenesis.AssetId + + t.Logf("Minted %d lightning cents, syncing universes...", cents.Amount) + syncUniverses(t.t, aliceTap, bob) + t.Logf("Universes synced between all nodes, distributing assets...") + + // With the assets created, and synced -- we'll now open the channel + // between Alice and Bob. + t.Logf("Opening asset channels...") + assetFundResp, err := aliceTap.FundChannel( + ctxb, &tchrpc.FundChannelRequest{ + AssetAmount: fundingAmount, + AssetId: assetID, + PeerPubkey: bob.PubKey[:], + FeeRateSatPerVbyte: 5, + }, + ) + require.NoError(t.t, err) + t.Logf("Funded channel between Alice and Bob: %v", assetFundResp) + + // With the channel open, mine a block to confirm it. + mineBlocks(t, net, 6, 1) + + // Before we start sending out payments, let's make sure each node can + // see the other one in the graph and has all required features. + require.NoError(t.t, t.lndHarness.AssertNodeKnown(alice, bob)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(bob, alice)) + + // First, we'll send over some funds from Alice to Bob, as we want Bob + // to be able to extend HTLCs in the other direction. + const ( + numPayments = 10 + keySendAmount = 2_500 + ) + for i := 0; i < numPayments; i++ { + sendAssetKeySendPayment( + t.t, alice, bob, keySendAmount, assetID, + fn.None[int64](), + ) + } + + // Now that both parties have some funds, we'll move onto the main test. + // + // We'll make 2 hodl invoice for each peer, so 4 total. From Alice's + // PoV, she'll have two outgoing HTLCs (or +4 with MPP), and two + // incoming HTLCs. + var ( + bobHodlInvoices []assetHodlInvoice + aliceHodlInvoices []assetHodlInvoice + + // The default oracle rate is 17_180 mSat/asset unit, so 10_000 + // will be equal to 171_800_000 mSat. When we use the mpp bool + // for the smallShards param of payInvoiceWithAssets, that + // means we'll split the payment into shards of 80_000_000 mSat + // max. So we'll get three shards per payment. + assetInvoiceAmt = 10_000 + assetsPerMPPShard = 4656 + ) + for i := 0; i < 2; i++ { + bobHodlInvoices = append( + bobHodlInvoices, createAssetHodlInvoice( + t.t, alice, bob, uint64(assetInvoiceAmt), + assetID, + ), + ) + aliceHodlInvoices = append( + aliceHodlInvoices, createAssetHodlInvoice( + t.t, bob, alice, uint64(assetInvoiceAmt), + assetID, + ), + ) + } + + // Now we'll have both Bob and Alice pay each other's invoices. We only + // care that they're in flight at this point, as they won't be settled + // yet. + for _, aliceInvoice := range aliceHodlInvoices { + opts := []payOpt{ + withFailure( + lnrpc.Payment_IN_FLIGHT, + lnrpc.PaymentFailureReason_FAILURE_REASON_NONE, + ), + } + if mpp { + opts = append(opts, withSmallShards()) + } + payInvoiceWithAssets( + t.t, bob, alice, aliceInvoice.payReq, assetID, opts..., + ) + } + for _, bobInvoice := range bobHodlInvoices { + payInvoiceWithAssets( + t.t, alice, bob, bobInvoice.payReq, assetID, + withFailure( + lnrpc.Payment_IN_FLIGHT, + lnrpc.PaymentFailureReason_FAILURE_REASON_NONE, + ), + ) + } + + // At this point, both sides should have 4 (or +4 with MPP) HTLCs + // active. + numHtlcs := 4 + if mpp { + numAdditionalShards := assetInvoiceAmt / assetsPerMPPShard + numHtlcs += numAdditionalShards * 2 + } + assertNumHtlcs(t.t, alice, numHtlcs) + assertNumHtlcs(t.t, bob, numHtlcs) + + // Before we force close, we'll grab the current height, the CSV delay + // needed, and also the absolute timeout of the set of active HTLCs. + closeExpiryInfo := newCloseExpiryInfo(t.t, alice) + + // With all of the HTLCs established, we'll now force close the channel + // with Alice. + t.Logf("Force close by Alice w/ HTLCs...") + aliceChanPoint := &lnrpc.ChannelPoint{ + OutputIndex: uint32(assetFundResp.OutputIndex), + FundingTxid: &lnrpc.ChannelPoint_FundingTxidStr{ + FundingTxidStr: assetFundResp.Txid, + }, + } + _, closeTxid, err := net.CloseChannel(alice, aliceChanPoint, true) + require.NoError(t.t, err) + + t.Logf("Channel closed! Mining blocks, close_txid=%v", closeTxid) + + // Next, we'll mine a block which should start the clock ticking on the + // relative timeout for the Alice, and Bob. + // + // After this next block, both of them can start to sweep. + // + // For Alice, she'll go to the second level, revealing her preimage in + // the process. She'll then need to wait for the relative timeout to + // expire before she can sweep her output. + // + // For Bob, since the remote party (Alice) closed, he can try to sweep + // right away after initial confirmation. + mineBlocks(t, net, 1, 1) + + // After force closing, Bob should now have a transfer that tracks the + // force closed commitment transaction. + locateAssetTransfers(t.t, bobTap, *closeTxid) + + t.Logf("Settling Bob's hodl invoice") + + // At this point, the commitment transaction has been mined, and we have + // 4 total HTLCs on Alice's commitment transaction: + // + // * 2x outgoing HTLCs from Alice to Bob + // * 2x incoming HTLCs from Bob to Alice (+2 with MPP) + // + // We'll leave half the HTLCs timeout, while pulling the other half. + // To start, we'll signal Bob to settle one of his incoming HTLCs on + // Alice's commitment transaction. For him, this is a remote success + // spend, so there's no CSV delay other than the 1 CSV (carve out), and + // he can spend directly from the commitment transaction. + _, err = bob.InvoicesClient.SettleInvoice( + ctxb, &invoicesrpc.SettleInvoiceMsg{ + Preimage: bobHodlInvoices[0].preimage[:], + }, + ) + require.NoError(t.t, err) + + // We'll pause here for Bob to extend the sweep request to the sweeper. + assertSweepExists( + t.t, bob, + walletrpc.WitnessType_TAPROOT_HTLC_ACCEPTED_REMOTE_SUCCESS, + ) + + // We'll mine an empty block to get the sweeper to tick. + mineBlocks(t, net, 1, 0) + + bobSweepTx1, err := waitForNTxsInMempool( + net.Miner.Client, 1, shortTimeout, + ) + require.NoError(t.t, err) + + // Next, we'll mine an additional block, this should allow Bob to sweep + // both his commitment output, and the incoming HTLC that we just + // settled above. + mineBlocks(t, net, 1, 1) + + // At this point, we should have the next sweep transaction in the + // mempool: Bob's incoming HTLC sweep directly off the commitment + // transaction. + bobSweepTx2, err := waitForNTxsInMempool( + net.Miner.Client, 1, shortTimeout, + ) + require.NoError(t.t, err) + + // We'll now mine the next block, which should confirm Bob's HTLC sweep + // transaction. + mineBlocks(t, net, 1, 1) + + bobSweepTransfer1 := locateAssetTransfers(t.t, bobTap, *bobSweepTx1[0]) + bobSweepTransfer2 := locateAssetTransfers(t.t, bobTap, *bobSweepTx2[0]) + t.Logf("Bob's sweep transfer 1: %v", + toProtoJSON(t.t, bobSweepTransfer1)) + t.Logf("Bob's sweep transfer 2: %v", + toProtoJSON(t.t, bobSweepTransfer2)) + + t.Logf("Confirming Bob's remote HTLC success sweep") + + // Bob's balance should now reflect that he's gained the value of the + // HTLC, in addition to his settled balance. We need to subtract 1 from + // the final balance due to the rounding down of the asset amount during + // RFQ conversion. + bobExpectedBalance := closeExpiryInfo.remoteAssetBalance + + uint64(assetInvoiceAmt-1) + t.Logf("Expecting Bob's balance to be %d", bobExpectedBalance) + assertSpendableBalance(t.t, bobTap, assetID, bobExpectedBalance) + + // With Bob's HTLC settled, we'll now have Alice do the same. For her, + // it'll be a 2nd level sweep, which requires an extra transaction. + // + // Before, we do that though, enough blocks have passed so Alice can now + // sweep her to-local output. So we'll mine an extra block, then assert + // that she's swept everything properly. With the way the sweeper works, + // we need to mine one extra block before the sweeper picks things up. + mineBlocks(t, net, 1, 0) + + aliceSweepTx1, err := waitForNTxsInMempool( + net.Miner.Client, 1, shortTimeout, + ) + require.NoError(t.t, err) + + mineBlocks(t, net, 1, 1) + + aliceSweepTransfer1 := locateAssetTransfers( + t.t, aliceTap, *aliceSweepTx1[0], + ) + t.Logf("Alice's sweep transfer 1: %v", + toProtoJSON(t.t, aliceSweepTransfer1)) + + t.Logf("Confirming Alice's to-local sweep") + + // With this extra block mined, Alice's settled balance should be the + // starting balance, minus the 2 HTLCs, plus her settled balance. + aliceExpectedBalance := itestAsset.Amount - fundingAmount + aliceExpectedBalance += closeExpiryInfo.localAssetBalance + assertSpendableBalance( + t.t, aliceTap, assetID, aliceExpectedBalance, + ) + + t.Logf("Settling Alice's hodl invoice") + + // With her commitment output swept above, we'll now settle one of + // Alice's incoming HTLCs. + _, err = alice.InvoicesClient.SettleInvoice( + ctxb, &invoicesrpc.SettleInvoiceMsg{ + Preimage: aliceHodlInvoices[0].preimage[:], + }, + ) + require.NoError(t.t, err) + + // We'll pause here for Alice to extend the sweep request to the + // sweeper. + assertSweepExists( + t.t, alice, + walletrpc.WitnessType_TAPROOT_HTLC_ACCEPTED_LOCAL_SUCCESS, + ) + + // We'll now mine a block, which should trigger Alice's broadcast of the + // second level sweep transaction. + sweepBlocks := mineBlocks(t, net, 1, 0) + + // If the block mined above didn't also mine our sweep, then we'll mine + // one final block which will confirm Alice's sweep transaction. + if len(sweepBlocks[0].Transactions) == 1 { + sweepTx, err := waitForNTxsInMempool( + net.Miner.Client, 1, shortTimeout, + ) + require.NoError(t.t, err) + + // With the sweep transaction in the mempool, we'll mine a block + // to confirm the sweep. + mineBlocks(t, net, 1, 1) + + aliceSweepTransfer := locateAssetTransfers( + t.t, aliceTap, *sweepTx[0], + ) + t.Logf("Alice's first-level sweep transfer: %v", + toProtoJSON(t.t, aliceSweepTransfer)) + } else { + sweepTx := sweepBlocks[0].Transactions[1] + aliceSweepTransfer := locateAssetTransfers( + t.t, aliceTap, sweepTx.TxHash(), + ) + t.Logf("Alice's first-level sweep transfer: %v", + toProtoJSON(t.t, aliceSweepTransfer)) + } + + t.Logf("Confirming Alice's second level remote HTLC success sweep") + + // Next, we'll mine enough blocks to trigger the CSV expiry so Alice can + // sweep the HTLC into her wallet. + mineBlocks(t, net, closeExpiryInfo.csvDelay, 0) + + // We'll pause here and wait until the sweeper recognizes that we've + // offered the second level sweep transaction. + assertSweepExists( + t.t, alice, + //nolint: lll + walletrpc.WitnessType_TAPROOT_HTLC_ACCEPTED_SUCCESS_SECOND_LEVEL, + ) + + t.Logf("Confirming Alice's local HTLC success sweep") + + // Now that we know the sweep was offered, we'll mine an extra block to + // actually trigger a sweeper broadcast. Due to an internal block race + // condition, the sweep transaction may have already been + // published+mined. If so, we don't need to mine the extra block. + sweepBlocks = mineBlocks(t, net, 1, 0) + + // If the block mined above didn't also mine our sweep, then we'll mine + // one final block which will confirm Alice's sweep transaction. + if len(sweepBlocks[0].Transactions) == 1 { + sweepTx, err := waitForNTxsInMempool( + net.Miner.Client, 1, shortTimeout, + ) + require.NoError(t.t, err) + + mineBlocks(t, net, 1, 1) + + aliceSweepTransfer := locateAssetTransfers( + t.t, aliceTap, *sweepTx[0], + ) + t.Logf("Alice's second-level sweep transfer: %v", + toProtoJSON(t.t, aliceSweepTransfer)) + } else { + sweepTx := sweepBlocks[0].Transactions[1] + aliceSweepTransfer := locateAssetTransfers( + t.t, aliceTap, sweepTx.TxHash(), + ) + t.Logf("Alice's second-level sweep transfer: %v", + toProtoJSON(t.t, aliceSweepTransfer)) + } + + // With the sweep transaction confirmed, Alice's balance should have + // incremented by the amt of the HTLC. + aliceExpectedBalance += uint64(assetInvoiceAmt - 1) + assertSpendableBalance( + t.t, aliceTap, assetID, aliceExpectedBalance, + ) + + t.Logf("Mining enough blocks to time out the remaining HTLCs") + + // At this point, we've swept two HTLCs: one from the remote commit, and + // one via the second layer. We'll now mine the remaining amount of + // blocks to time out the HTLCs. + blockToMine := closeExpiryInfo.blockTillExpiry( + aliceHodlInvoices[1].preimage.Hash(), + ) + mineBlocks(t, net, blockToMine, 0) + + // We'll wait for both Alice and Bob to present their respective sweeps + // to the sweeper. + assertSweepExists( + t.t, alice, + walletrpc.WitnessType_TAPROOT_HTLC_LOCAL_OFFERED_TIMEOUT, + ) + assertSweepExists( + t.t, bob, + walletrpc.WitnessType_TAPROOT_HTLC_OFFERED_REMOTE_TIMEOUT, + ) + + // We'll mine an extra block to trigger the sweeper. + mineBlocks(t, net, 1, 0) + + t.Logf("Confirming initial HTLC timeout txns") + + // Finally, we'll mine a single block to confirm them. + mineBlocks(t, net, 1, 2) + + // At this point, Bob's balance should be incremented by an additional + // HTLC value. + bobExpectedBalance += uint64(assetInvoiceAmt - 1) + assertSpendableBalance( + t.t, bobTap, assetID, bobExpectedBalance, + ) + + t.Logf("Mining extra blocks for Alice's CSV to expire on 2nd level txn") + + // Next, we'll mine 4 additional blocks to Alice's CSV delay expires for + // the second level timeout output. + mineBlocks(t, net, closeExpiryInfo.csvDelay, 0) + + // Wait for Alice to extend the second level output to the sweeper + // before we mine the next block to the sweeper. + assertSweepExists( + t.t, alice, + walletrpc.WitnessType_TAPROOT_HTLC_OFFERED_TIMEOUT_SECOND_LEVEL, + ) + + t.Logf("Confirming Alice's final timeout sweep") + + // With the way the sweeper works, we'll now need to mine an extra block + // to trigger the sweep. + sweepBlocks = mineBlocks(t, net, 1, 0) + + // If the block mined above didn't also mine our sweep, then we'll mine + // one final block which will confirm Alice's sweep transaction. + if len(sweepBlocks[0].Transactions) == 1 { + sweepTx, err := waitForNTxsInMempool( + net.Miner.Client, 1, shortTimeout, + ) + require.NoError(t.t, err) + + // We'll mine one final block which will confirm Alice's sweep + // transaction. + mineBlocks(t, net, 1, 1) + + aliceSweepTransfer := locateAssetTransfers( + t.t, aliceTap, *sweepTx[0], + ) + t.Logf("Alice's final timeout sweep transfer: %v", + toProtoJSON(t.t, aliceSweepTransfer)) + } else { + sweepTx := sweepBlocks[0].Transactions[1] + aliceSweepTransfer := locateAssetTransfers( + t.t, aliceTap, sweepTx.TxHash(), + ) + t.Logf("Alice's final timeout sweep transfer: %v", + toProtoJSON(t.t, aliceSweepTransfer)) + } + + // Finally, we'll assert that Alice's balance has been incremented by + // the timeout value. + aliceExpectedBalance += uint64(assetInvoiceAmt - 1) + t.Logf("Expecting Alice's balance to be %d", aliceExpectedBalance) + assertSpendableBalance( + t.t, aliceTap, assetID, aliceExpectedBalance, + ) + + t.Logf("Sending all settled funds to Zane") + + // As a final sanity check, both Alice and Bob should be able to send + // their entire balances to Zane, our 3rd party. + // + // We'll make two addrs for Zane, one for Alice, and one for bob. + zaneTap := newTapClient(t.t, zane) + aliceAddr, err := zaneTap.NewAddr(ctxb, &taprpc.NewAddrRequest{ + Amt: aliceExpectedBalance, + AssetId: assetID, + ProofCourierAddr: fmt.Sprintf( + "%s://%s", proof.UniverseRpcCourierType, + zaneTap.node.Cfg.LitAddr(), + ), + }) + require.NoError(t.t, err) + bobAddr, err := zaneTap.NewAddr(ctxb, &taprpc.NewAddrRequest{ + Amt: bobExpectedBalance, + AssetId: assetID, + ProofCourierAddr: fmt.Sprintf( + "%s://%s", proof.UniverseRpcCourierType, + zaneTap.node.Cfg.LitAddr(), + ), + }) + require.NoError(t.t, err) + + _, err = aliceTap.SendAsset(ctxb, &taprpc.SendAssetRequest{ + TapAddrs: []string{aliceAddr.Encoded}, + }) + require.NoError(t.t, err) + mineBlocks(t, net, 1, 1) + + itest.AssertNonInteractiveRecvComplete(t.t, zaneTap, 1) + + _, err = bobTap.SendAsset(ctxb, &taprpc.SendAssetRequest{ + TapAddrs: []string{bobAddr.Encoded}, + }) + require.NoError(t.t, err) + mineBlocks(t, net, 1, 1) + + itest.AssertNonInteractiveRecvComplete(t.t, zaneTap, 2) + + // Zane's balance should now be the sum of Alice's and Bob's balances. + zaneExpectedBalance := aliceExpectedBalance + bobExpectedBalance + assertSpendableBalance( + t.t, zaneTap, assetID, zaneExpectedBalance, + ) +} + +// testCustomChannelsForwardBandwidth is a test that runs through some Taproot +// Assets Channel liquidity edge cases, specifically related to forwarding HTLCs +// into channels with no available asset bandwidth. +func testCustomChannelsForwardBandwidth(ctxb context.Context, + net *NetworkHarness, t *harnessTest) { + + lndArgs := slices.Clone(lndArgsTemplate) + litdArgs := slices.Clone(litdArgsTemplate) + + // Explicitly set the proof courier as Zane (now has no other role + // other than proof shuffling), otherwise a hashmail courier will be + // used. For the funding transaction, we're just posting it and don't + // expect a true receiver. + zane, err := net.NewNode( + t.t, "Zane", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + litdArgs = append(litdArgs, fmt.Sprintf( + "--taproot-assets.proofcourieraddr=%s://%s", + proof.UniverseRpcCourierType, zane.Cfg.LitAddr(), + )) + + // The topology we are going for looks like the following: + // + // Charlie --[assets]--> Dave --[sats]--> Erin --[assets]--> Fabia + // | + // | + // [assets] + // | + // v + // Yara + // + // With [assets] being a custom channel and [sats] being a normal, BTC + // only channel. + // All 5 nodes need to be full litd nodes running in integrated mode + // with tapd included. We also need specific flags to be enabled, so we + // create 5 completely new nodes, ignoring the two default nodes that + // are created by the harness. + charlie, err := net.NewNode( + t.t, "Charlie", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + dave, err := net.NewNode(t.t, "Dave", lndArgs, false, true, litdArgs...) + require.NoError(t.t, err) + erin, err := net.NewNode(t.t, "Erin", lndArgs, false, true, litdArgs...) + require.NoError(t.t, err) + fabia, err := net.NewNode( + t.t, "Fabia", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + yara, err := net.NewNode( + t.t, "Yara", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + nodes := []*HarnessNode{charlie, dave, erin, fabia, yara} + connectAllNodes(t.t, net, nodes) + fundAllNodes(t.t, net, nodes) + + // Create the normal channel between Dave and Erin. + t.Logf("Opening normal channel between Dave and Erin...") + channelOp := openChannelAndAssert( + t, net, dave, erin, lntest.OpenChannelParams{ + Amt: 10_000_000, + SatPerVByte: 5, + }, + ) + defer closeChannelAndAssert(t, net, dave, channelOp, false) + + // This is the only public channel, we need everyone to be aware of it. + assertChannelKnown(t.t, charlie, channelOp) + assertChannelKnown(t.t, fabia, channelOp) + + universeTap := newTapClient(t.t, zane) + charlieTap := newTapClient(t.t, charlie) + daveTap := newTapClient(t.t, dave) + erinTap := newTapClient(t.t, erin) + fabiaTap := newTapClient(t.t, fabia) + yaraTap := newTapClient(t.t, yara) + + // Mint an asset on Charlie and sync all nodes to Charlie as the + // universe. + mintedAssets := itest.MintAssetsConfirmBatch( + t.t, t.lndHarness.Miner.Client, charlieTap, + []*mintrpc.MintAssetRequest{ + { + Asset: itestAsset, + }, + }, + ) + cents := mintedAssets[0] + assetID := cents.AssetGenesis.AssetId + + t.Logf("Minted %d lightning cents, syncing universes...", cents.Amount) + syncUniverses(t.t, charlieTap, dave, erin, fabia, yara) + t.Logf("Universes synced between all nodes, distributing assets...") + + const ( + daveFundingAmount = uint64(400_000) + erinFundingAmount = uint64(200_000) + ) + charlieFundingAmount := cents.Amount - uint64(2*400_000) + + _, _, chanPointEF := createTestAssetNetwork( + t, net, charlieTap, daveTap, erinTap, fabiaTap, yaraTap, + universeTap, cents, 400_000, charlieFundingAmount, + daveFundingAmount, erinFundingAmount, 0, + ) + + // Before we start sending out payments, let's make sure each node can + // see the other one in the graph and has all required features. + require.NoError(t.t, t.lndHarness.AssertNodeKnown(charlie, dave)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(dave, charlie)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(dave, yara)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(yara, dave)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(erin, fabia)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(fabia, erin)) + require.NoError(t.t, t.lndHarness.AssertNodeKnown(charlie, erin)) + + logBalance(t.t, nodes, assetID, "initial") + + // We now deplete the channel between Erin and Fabia by moving all + // assets to Fabia. + sendAssetKeySendPayment( + t.t, erin, fabia, erinFundingAmount, assetID, fn.None[int64](), + ) + logBalance(t.t, nodes, assetID, "after moving assets to Fabia") + + // Test case 1: We cannot keysend more assets from Erin to Fabia. + sendAssetKeySendPayment( + t.t, erin, fabia, 1, assetID, fn.None[int64](), + withFailure(lnrpc.Payment_FAILED, failureNoBalance), + ) + + // Test case 2: We cannot pay an invoice from Charlie to Fabia. + invoiceResp := createAssetInvoice(t.t, erin, fabia, 123, assetID) + payInvoiceWithSatoshi( + t.t, charlie, invoiceResp, + withFailure(lnrpc.Payment_FAILED, failureNoRoute), + ) + + // Test case 3: We now create an asset buy order for a normal amount of + // assets. We then "fake" an invoice referencing that buy order that + // is for an amount that is too small to be paid with a single asset + // unit. This should be handled gracefully and not lead to a crash. + // Ideally such an invoice shouldn't be created in the first place, but + // we want to make sure that the system doesn't crash in this case. + numUnits := uint64(10) + buyOrderResp, err := fabiaTap.RfqClient.AddAssetBuyOrder( + ctxb, &rfqrpc.AddAssetBuyOrderRequest{ + AssetSpecifier: &rfqrpc.AssetSpecifier{ + Id: &rfqrpc.AssetSpecifier_AssetId{ + AssetId: assetID, + }, + }, + AssetMaxAmt: numUnits, + Expiry: uint64( + time.Now().Add(time.Hour).Unix(), + ), + PeerPubKey: erin.PubKey[:], + TimeoutSeconds: 10, + }, + ) + require.NoError(t.t, err) + + quoteResp := buyOrderResp.Response + quote, ok := quoteResp.(*rfqrpc.AddAssetBuyOrderResponse_AcceptedQuote) + require.True(t.t, ok) + + // We calculate the milli-satoshi amount one below the equivalent of a + // single asset unit. + rate, err := oraclerpc.UnmarshalFixedPoint(&oraclerpc.FixedPoint{ + Coefficient: quote.AcceptedQuote.AskAssetRate.Coefficient, + Scale: quote.AcceptedQuote.AskAssetRate.Scale, + }) + require.NoError(t.t, err) + + oneUnit := uint64(1) + oneUnitFP := rfqmath.NewBigIntFixedPoint(oneUnit, 0) + oneUnitMilliSat := rfqmath.UnitsToMilliSatoshi(oneUnitFP, *rate) + + t.Logf("Got quote for %v asset units per BTC", rate) + msatPerUnit := float64(oneUnitMilliSat) / float64(oneUnit) + t.Logf("Got quote for %v asset units at %3f msat/unit from peer %s "+ + "with SCID %d", numUnits, msatPerUnit, erin.PubKeyStr, + quote.AcceptedQuote.Scid) + + // We now manually add the invoice in order to inject the above, + // manually generated, quote. + invoiceResp2, err := fabia.AddInvoice(ctxb, &lnrpc.Invoice{ + Memo: "too small invoice", + ValueMsat: int64(oneUnitMilliSat - 1), + RouteHints: []*lnrpc.RouteHint{{ + HopHints: []*lnrpc.HopHint{{ + NodeId: erin.PubKeyStr, + ChanId: quote.AcceptedQuote.Scid, + }}, + }}, + }) + require.NoError(t.t, err) + + payInvoiceWithSatoshi(t.t, dave, invoiceResp2, withFailure( + lnrpc.Payment_FAILED, failureNoRoute, + )) + + // Let's make sure we can still use the channel between Erin and Fabia + // by doing a satoshi keysend payment. + sendKeySendPayment(t.t, erin, fabia, 2000) + logBalance(t.t, nodes, assetID, "after BTC only keysend") + + // Finally, we close the channel between Erin and Fabia to make sure + // everything is settled correctly. + closeAssetChannelAndAssert( + t, net, erin, fabia, chanPointEF, assetID, nil, + universeTap, noOpCoOpCloseBalanceCheck, + ) +} + +// testCustomChannelsDecodeAssetInvoice tests that we're able to properly +// decode and display asset invoice related information. +// +// TODO(roasbeef): just move to tapd repo due to new version that doesn't req a +// chan? +func testCustomChannelsDecodeAssetInvoice(ctx context.Context, + net *NetworkHarness, t *harnessTest) { + + // First, we'll set up some information for our custom oracle that we'll use + // to feed in price information. + oracleAddr := fmt.Sprintf("localhost:%d", port.NextAvailablePort()) + oracle := newOracleHarness(oracleAddr) + oracle.start(t.t) + t.t.Cleanup(oracle.stop) + + ctxb := context.Background() + lndArgs := slices.Clone(lndArgsTemplate) + litdArgs := slices.Clone(litdArgsTemplateNoOracle) + litdArgs = append(litdArgs, fmt.Sprintf( + "--taproot-assets.experimental.rfq.priceoracleaddress="+ + "rfqrpc://%s", oracleAddr, + )) + + // For this test, Zane will be our dedicated Universe server for all parties. + zane, err := net.NewNode( + t.t, "Zane", lndArgs, false, true, litdArgs..., + ) + require.NoError(t.t, err) + + litdArgs = append(litdArgs, fmt.Sprintf( + "--taproot-assets.proofcourieraddr=%s://%s", + proof.UniverseRpcCourierType, zane.Cfg.LitAddr(), + )) + + // We'll just make a single node here, as this doesn't actually rely on a set + // of active channels. + alice, err := net.NewNode(t.t, "Alice", lndArgs, false, true, litdArgs...) + require.NoError(t.t, err) + aliceTap := newTapClient(t.t, alice) + + // Fund Alice so she'll have enough funds to mint the asset. + fundAllNodes(t.t, net, []*HarnessNode{alice}) + + // Next, we'll make a new asset with a specified decimal display. We'll also + // make grouped asset as well. + usdMetaData := &taprpc.AssetMeta{ + Data: []byte(`{ +"description":"this is a USD stablecoin with decimal display of 6" +}`), + Type: taprpc.AssetMetaType_META_TYPE_JSON, + } + + const decimalDisplay = 6 + itestAsset = &mintrpc.MintAsset{ + AssetType: taprpc.AssetType_NORMAL, + Name: "USD", + AssetMeta: usdMetaData, + // We mint 1 million USD with a decimal display of 6, which + // results in 1 trillion asset units. + Amount: 1_000_000_000_000, + DecimalDisplay: decimalDisplay, + NewGroupedAsset: true, + } + + // Mint an asset on Charlie and sync Dave to Charlie as the universe. + mintedAssets := itest.MintAssetsConfirmBatch( + t.t, t.lndHarness.Miner.Client, aliceTap, + []*mintrpc.MintAssetRequest{ + { + Asset: itestAsset, + }, + }, + ) + usdAsset := mintedAssets[0] + assetID := usdAsset.AssetGenesis.AssetId + + // Now that we've minted the asset, we can set the price in the oracle. + var id asset.ID + copy(id[:], assetID) + + // We'll assume a price of $100,000.00 USD for a single BTC. This is just the + // current subjective price our oracle will use. From this BTC price, we'll + // scale things up to be in the precision of the asset we minted above. + btcPrice := rfqmath.NewBigIntFixedPoint( + 100_000_00, 2, + ) + factor := rfqmath.NewBigInt( + big.NewInt(int64(math.Pow10(decimalDisplay))), + ) + btcPrice.Coefficient = btcPrice.Coefficient.Mul(factor) + oracle.setPrice(id, btcPrice, btcPrice) + + // Now we'll make a normal invoice for 1 BTC using Alice. + expirySeconds := 10 + amountSat := 100_000_000 + invoiceResp, err := alice.AddInvoice(ctxb, &lnrpc.Invoice{ + Value: int64(amountSat), + Memo: "normal invoice", + Expiry: int64(expirySeconds), + }) + require.NoError(t.t, err) + + payReq := invoiceResp.PaymentRequest + + // Now that we have our payment request, we'll call into the new decode asset + // pay req call. + decodeResp, err := aliceTap.DecodeAssetPayReq(ctxb, &tapchannelrpc.AssetPayReq{ + AssetId: assetID, + PayReqString: payReq, + }) + require.NoError(t.t, err) + + // The decimal display information, genesis, and asset group information + // should all match. + require.Equal( + t.t, int64(decimalDisplay), int64(decodeResp.DecimalDisplay.DecimalDisplay), + ) + require.Equal(t.t, usdAsset.AssetGenesis, decodeResp.GenesisInfo) + require.Equal(t.t, usdAsset.AssetGroup, decodeResp.AssetGroup) + + // The 1 BTC invoice should map to 100k asset units, with decimal display 6 + // that's 100 billion asset units. + const expectedUnits = 100_000_000_000 + require.Equal(t.t, int64(expectedUnits), int64(decodeResp.AssetAmount)) +} diff --git a/itest/litd_node.go b/itest/litd_node.go index 7ec9a0296..e9be55972 100644 --- a/itest/litd_node.go +++ b/itest/litd_node.go @@ -89,6 +89,9 @@ type LitNodeConfig struct { LitPort int LitRESTPort int + + // backupDBDir is the path where a database backup is stored, if any. + backupDBDir string } func (cfg *LitNodeConfig) LitAddr() string { @@ -2087,3 +2090,38 @@ func connectLitRPC(ctx context.Context, hostPort, tlsCertPath, return grpc.DialContext(ctx, hostPort, opts...) } + +// copyAll copies all files and directories from srcDir to dstDir recursively. +// Note that this function does not support links. +func copyAll(dstDir, srcDir string) error { + entries, err := os.ReadDir(srcDir) + if err != nil { + return err + } + + for _, entry := range entries { + srcPath := filepath.Join(srcDir, entry.Name()) + dstPath := filepath.Join(dstDir, entry.Name()) + + info, err := os.Stat(srcPath) + if err != nil { + return err + } + + if info.IsDir() { + err := os.Mkdir(dstPath, info.Mode()) + if err != nil && !os.IsExist(err) { + return err + } + + err = copyAll(dstPath, srcPath) + if err != nil { + return err + } + } else if err := CopyFile(dstPath, srcPath); err != nil { + return err + } + } + + return nil +} diff --git a/itest/litd_test.go b/itest/litd_test.go index a87a0a426..2736baf6c 100644 --- a/itest/litd_test.go +++ b/itest/litd_test.go @@ -6,6 +6,7 @@ import ( "testing" "time" + "github.com/btcsuite/btclog" "github.com/lightningnetwork/lnd/build" "github.com/lightningnetwork/lnd/lntest" "github.com/lightningnetwork/lnd/signal" @@ -56,7 +57,8 @@ func TestLightningTerminal(t *testing.T) { // Start a chain backend. chainBackend, _, err := lntest.NewBackend( - lndHarness.Miner().P2PAddress(), harnessNetParams, + lndHarness.Miner().P2PAddress(), + harnessNetParams, ) require.NoError(t1, err, "new backend") @@ -130,6 +132,10 @@ func (h *harnessTest) setupLogging() { require.NoError(h.t, err) interceptor = &ic + UseLogger(build.NewSubLogger(Subsystem, func(tag string) btclog.Logger { + return logWriter.GenSubLogger(tag, func() {}) + })) + err = build.ParseAndSetDebugLevels("debug", logWriter) require.NoError(h.t, err) } diff --git a/itest/litd_test_list_on_test.go b/itest/litd_test_list_on_test.go index 1ddc5a2d6..6e104fe6b 100644 --- a/itest/litd_test_list_on_test.go +++ b/itest/litd_test_list_on_test.go @@ -24,4 +24,56 @@ var allTestCases = []*testCase{ name: "test large http header", test: testLargeHttpHeader, }, + { + name: "test custom channels", + test: testCustomChannels, + }, + { + name: "test custom channels large", + test: testCustomChannelsLarge, + }, + { + name: "test custom channels grouped asset", + test: testCustomChannelsGroupedAsset, + }, + { + name: "test custom channels force close", + test: testCustomChannelsForceClose, + }, + { + name: "test custom channels breach", + test: testCustomChannelsBreach, + }, + { + name: "test custom channels liquidity", + test: testCustomChannelsLiquidityEdgeCases, + }, + { + name: "test custom channels htlc force close", + test: testCustomChannelsHtlcForceClose, + }, + { + name: "test custom channels balance consistency", + test: testCustomChannelsBalanceConsistency, + }, + { + name: "test custom channels single asset multi input", + test: testCustomChannelsSingleAssetMultiInput, + }, + { + name: "test custom channels oracle pricing", + test: testCustomChannelsOraclePricing, + }, + { + name: "test custom channels fee", + test: testCustomChannelsFee, + }, + { + name: "test custom channels forward bandwidth", + test: testCustomChannelsForwardBandwidth, + }, + { + name: "test custom channels decode payreq", + test: testCustomChannelsDecodeAssetInvoice, + }, } diff --git a/itest/log.go b/itest/log.go new file mode 100644 index 000000000..67211af57 --- /dev/null +++ b/itest/log.go @@ -0,0 +1,24 @@ +package itest + +import ( + "github.com/btcsuite/btclog" + "github.com/lightningnetwork/lnd/build" +) + +const Subsystem = "ITST" + +// log is a logger that is initialized with no output filters. This means the +// package will not perform any logging by default until the caller requests it. +var log btclog.Logger + +// The default amount of logging is none. +func init() { + UseLogger(build.NewSubLogger(Subsystem, nil)) +} + +// UseLogger uses a specified Logger to output package logging info. +// This should be used in preference to SetLogWriter if the caller is also +// using btclog. +func UseLogger(logger btclog.Logger) { + log = logger +} diff --git a/itest/network_harness.go b/itest/network_harness.go index 271163441..5b562c5ef 100644 --- a/itest/network_harness.go +++ b/itest/network_harness.go @@ -46,7 +46,8 @@ type NetworkHarness struct { // Miner is a reference to a running full node that can be used to create // new blocks on the network. - Miner *miner.HarnessMiner + Miner *miner.HarnessMiner + LNDHarness *lntest.HarnessTest // server is an instance of the local Loop/Pool mock server. @@ -435,6 +436,12 @@ tryconnect: "finish syncing") } } + + // Ignore "already connected to peer" errors. + if strings.Contains(err.Error(), "already connected to peer") { + return nil + } + return err } @@ -767,6 +774,58 @@ func (n *NetworkHarness) StopNode(node *HarnessNode) error { return node.Stop() } +// StopAndBackupDB backs up the database of the target node. +func (n *NetworkHarness) StopAndBackupDB(node *HarnessNode) error { + restart, err := n.SuspendNode(node) + if err != nil { + return err + } + + // Backup files. + tempDir, err := os.MkdirTemp("", "past-state") + if err != nil { + return fmt.Errorf("unable to create temp db folder: %w", + err) + } + + if err := copyAll(tempDir, node.Cfg.DBDir()); err != nil { + return fmt.Errorf("unable to copy database files: %w", + err) + } + + node.Cfg.backupDBDir = tempDir + + return restart() +} + +// StopAndRestoreDB stops the target node, restores the database from a backup +// and starts the node again. +func (n *NetworkHarness) StopAndRestoreDB(node *HarnessNode) error { + restart, err := n.SuspendNode(node) + if err != nil { + return err + } + + // Restore files. + if node.Cfg.backupDBDir == "" { + return fmt.Errorf("no database backup created") + } + + err = copyAll(node.Cfg.DBDir(), node.Cfg.backupDBDir) + if err != nil { + return fmt.Errorf("unable to copy database files: %w", + err) + } + + if err := os.RemoveAll(node.Cfg.backupDBDir); err != nil { + return fmt.Errorf("unable to remove backup dir: %w", + err) + } + node.Cfg.backupDBDir = "" + + return restart() +} + // OpenChannel attempts to open a channel between srcNode and destNode with the // passed channel funding parameters. If the passed context has a timeout, then // if the timeout is reached before the channel pending notification is @@ -1053,8 +1112,11 @@ func (n *NetworkHarness) CloseChannel(lnNode *HarnessNode, closeReq := &lnrpc.CloseChannelRequest{ ChannelPoint: cp, Force: force, - SatPerVbyte: 5, } + if !force { + closeReq.SatPerVbyte = 5 + } + closeRespStream, err = lnNode.CloseChannel(ctx, closeReq) if err != nil { return fmt.Errorf("unable to close channel: %v", err) @@ -1097,7 +1159,8 @@ func (n *NetworkHarness) CloseChannel(lnNode *HarnessNode, // passed context has a timeout, then if the timeout is reached before the // notification is received then an error is returned. func (n *NetworkHarness) WaitForChannelClose( - closeChanStream lnrpc.Lightning_CloseChannelClient) (*chainhash.Hash, error) { + stream lnrpc.Lightning_CloseChannelClient) (*lnrpc.ChannelCloseUpdate, + error) { ctxb := context.Background() ctx, cancel := context.WithTimeout(ctxb, wait.ChannelCloseTimeout) @@ -1106,13 +1169,14 @@ func (n *NetworkHarness) WaitForChannelClose( errChan := make(chan error) updateChan := make(chan *lnrpc.CloseStatusUpdate_ChanClose) go func() { - closeResp, err := closeChanStream.Recv() + closeResp, err := stream.Recv() if err != nil { errChan <- err return } - closeFin, ok := closeResp.Update.(*lnrpc.CloseStatusUpdate_ChanClose) + update := closeResp.Update + closeFin, ok := update.(*lnrpc.CloseStatusUpdate_ChanClose) if !ok { errChan <- fmt.Errorf("expected channel close update, "+ "instead got %v", closeFin) @@ -1130,7 +1194,7 @@ func (n *NetworkHarness) WaitForChannelClose( case err := <-errChan: return nil, err case update := <-updateChan: - return chainhash.NewHash(update.ChanClose.ClosingTxid) + return update.ChanClose, nil } } @@ -1177,6 +1241,33 @@ func (n *NetworkHarness) AssertChannelExists(node *HarnessNode, }, lntest.DefaultTimeout) } +// AssertNodeKnown makes sure the given node knows about the target node in the +// network graph. +func (n *NetworkHarness) AssertNodeKnown(node, target *HarnessNode) error { + ctxb := context.Background() + ctxt, cancel := context.WithTimeout(ctxb, wait.DefaultTimeout) + defer cancel() + + req := &lnrpc.NodeInfoRequest{ + PubKey: hex.EncodeToString( + target.PubKey[:], + ), + } + return wait.NoError(func() error { + info, err := node.GetNodeInfo(ctxt, req) + if err != nil { + return err + } + + if info.Node == nil { + return fmt.Errorf("node %x has no info about %x", + node.PubKey[:], target.PubKey[:]) + } + + return nil + }, lntest.DefaultTimeout) +} + // DumpLogs reads the current logs generated by the passed node, and returns // the logs as a single string. This function is useful for examining the logs // of a particular node in the case of a test failure. diff --git a/itest/oracle_test.go b/itest/oracle_test.go new file mode 100644 index 000000000..8f7cfd0c5 --- /dev/null +++ b/itest/oracle_test.go @@ -0,0 +1,279 @@ +package itest + +import ( + "context" + "crypto/tls" + "encoding/hex" + "fmt" + "net" + "testing" + "time" + + "github.com/lightninglabs/taproot-assets/asset" + "github.com/lightninglabs/taproot-assets/rfqmath" + "github.com/lightninglabs/taproot-assets/rfqmsg" + oraclerpc "github.com/lightninglabs/taproot-assets/taprpc/priceoraclerpc" + "github.com/lightningnetwork/lnd/cert" + "github.com/stretchr/testify/require" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials" +) + +// oracleHarness is a basic integration test RPC price oracle server harness. +type oracleHarness struct { + oraclerpc.UnimplementedPriceOracleServer + + listenAddr string + + grpcListener net.Listener + grpcServer *grpc.Server + + purchasePrices map[asset.ID]rfqmath.BigIntFixedPoint + salePrices map[asset.ID]rfqmath.BigIntFixedPoint +} + +func newOracleHarness(listenAddr string) *oracleHarness { + return &oracleHarness{ + listenAddr: listenAddr, + purchasePrices: make(map[asset.ID]rfqmath.BigIntFixedPoint), + salePrices: make(map[asset.ID]rfqmath.BigIntFixedPoint), + } +} + +func (o *oracleHarness) setPrice(assetID asset.ID, purchasePrice, + salePrice rfqmath.BigIntFixedPoint) { + + o.purchasePrices[assetID] = purchasePrice + o.salePrices[assetID] = salePrice +} + +func (o *oracleHarness) start(t *testing.T) { + // Start the mock RPC price oracle service. + // + // Generate self-signed certificate. This allows us to use TLS for the + // gRPC server. + tlsCert, err := generateSelfSignedCert() + require.NoError(t, err) + + // Create the gRPC server with TLS + transportCredentials := credentials.NewTLS(&tls.Config{ + Certificates: []tls.Certificate{tlsCert}, + }) + o.grpcServer = grpc.NewServer(grpc.Creds(transportCredentials)) + + serviceAddr := fmt.Sprintf("rfqrpc://%s", o.listenAddr) + log.Infof("Starting RPC price oracle service at address: %s\n", + serviceAddr) + + oraclerpc.RegisterPriceOracleServer(o.grpcServer, o) + + go func() { + var err error + o.grpcListener, err = net.Listen("tcp", o.listenAddr) + if err != nil { + log.Errorf("Error oracle listening: %v", err) + return + } + if err := o.grpcServer.Serve(o.grpcListener); err != nil { + log.Errorf("Error oracle serving: %v", err) + } + }() +} + +func (o *oracleHarness) stop() { + if o.grpcServer != nil { + o.grpcServer.Stop() + } + if o.grpcListener != nil { + _ = o.grpcListener.Close() + } +} + +// getAssetRates returns the asset rates for a given transaction type and +// subject asset max amount. +func (o *oracleHarness) getAssetRates(id asset.ID, + transactionType oraclerpc.TransactionType) (oraclerpc.AssetRates, + error) { + + // Determine the rate based on the transaction type. + var subjectAssetRate rfqmath.BigIntFixedPoint + if transactionType == oraclerpc.TransactionType_PURCHASE { + rate, ok := o.purchasePrices[id] + if !ok { + return oraclerpc.AssetRates{}, fmt.Errorf("purchase "+ + "price not found for asset ID=%v", id) + } + subjectAssetRate = rate + } else { + rate, ok := o.salePrices[id] + if !ok { + return oraclerpc.AssetRates{}, fmt.Errorf("sale "+ + "price not found for asset ID=%v", id) + } + subjectAssetRate = rate + } + + // Marshal subject asset rate to RPC format. + rpcSubjectAssetToBtcRate, err := oraclerpc.MarshalBigIntFixedPoint( + subjectAssetRate, + ) + if err != nil { + return oraclerpc.AssetRates{}, err + } + + // Marshal payment asset rate to RPC format. + rpcPaymentAssetToBtcRate, err := oraclerpc.MarshalBigIntFixedPoint( + rfqmsg.MilliSatPerBtc, + ) + if err != nil { + return oraclerpc.AssetRates{}, err + } + + expiry := time.Now().Add(5 * time.Minute).Unix() + return oraclerpc.AssetRates{ + SubjectAssetRate: rpcSubjectAssetToBtcRate, + PaymentAssetRate: rpcPaymentAssetToBtcRate, + ExpiryTimestamp: uint64(expiry), + }, nil +} + +// QueryAssetRates queries the asset rates for a given transaction type, subject +// asset, and payment asset. An asset rate is the number of asset units per +// BTC. +// +// Example use case: +// +// Alice is trying to pay an invoice by spending an asset. Alice therefore +// requests that Bob (her asset channel counterparty) purchase the asset from +// her. Bob's payment, in BTC, will pay the invoice. +// +// Alice requests a bid quote from Bob. Her request includes an asset rates hint +// (ask). Alice obtains the asset rates hint by calling this endpoint. She sets: +// - `SubjectAsset` to the asset she is trying to sell. +// - `SubjectAssetMaxAmount` to the max channel asset outbound. +// - `PaymentAsset` to BTC. +// - `TransactionType` to SALE. +// - `AssetRateHint` to nil. +// +// Bob calls this endpoint to get the bid quote asset rates that he will send as +// a response to Alice's request. He sets: +// - `SubjectAsset` to the asset that Alice is trying to sell. +// - `SubjectAssetMaxAmount` to the value given in Alice's quote request. +// - `PaymentAsset` to BTC. +// - `TransactionType` to PURCHASE. +// - `AssetRateHint` to the value given in Alice's quote request. +func (o *oracleHarness) QueryAssetRates(_ context.Context, + req *oraclerpc.QueryAssetRatesRequest) ( + *oraclerpc.QueryAssetRatesResponse, error) { + + // Ensure that the payment asset is BTC. We only support BTC as the + // payment asset in this example. + if !oraclerpc.IsAssetBtc(req.PaymentAsset) { + log.Infof("Payment asset is not BTC: %v", req.PaymentAsset) + + return &oraclerpc.QueryAssetRatesResponse{ + Result: &oraclerpc.QueryAssetRatesResponse_Error{ + Error: &oraclerpc.QueryAssetRatesErrResponse{ + Message: "unsupported payment asset, " + + "only BTC is supported", + }, + }, + }, nil + } + + // Ensure that the subject asset is set correctly. + subjectAssetID, err := parseSubjectAsset(req.SubjectAsset) + if err != nil { + log.Errorf("Error parsing subject asset: %v", err) + return nil, fmt.Errorf("error parsing subject asset: %w", err) + } + + _, hasPurchase := o.purchasePrices[subjectAssetID] + _, hasSale := o.salePrices[subjectAssetID] + + log.Infof("Have for asset=%x, purchase=%v, sale=%v", subjectAssetID[:], + hasPurchase, hasSale) + + // Ensure that the subject asset is supported. + if !hasPurchase || !hasSale { + log.Infof("Unsupported subject asset ID str: %v\n", + req.SubjectAsset) + + return &oraclerpc.QueryAssetRatesResponse{ + Result: &oraclerpc.QueryAssetRatesResponse_Error{ + Error: &oraclerpc.QueryAssetRatesErrResponse{ + Message: "unsupported subject asset", + }, + }, + }, nil + } + + assetRates, err := o.getAssetRates(subjectAssetID, req.TransactionType) + if err != nil { + return nil, err + } + + log.Infof("QueryAssetRates returning rates (subject_asset_rate=%v, "+ + "payment_asset_rate=%v)", assetRates.SubjectAssetRate, + assetRates.PaymentAssetRate) + + return &oraclerpc.QueryAssetRatesResponse{ + Result: &oraclerpc.QueryAssetRatesResponse_Ok{ + Ok: &oraclerpc.QueryAssetRatesOkResponse{ + AssetRates: &assetRates, + }, + }, + }, nil +} + +// parseSubjectAsset parses the subject asset from the given asset specifier. +func parseSubjectAsset(subjectAsset *oraclerpc.AssetSpecifier) (asset.ID, + error) { + + // Ensure that the subject asset is set. + if subjectAsset == nil { + return asset.ID{}, fmt.Errorf("subject asset is not set (nil)") + } + + // Check the subject asset bytes if set. + var subjectAssetID asset.ID + switch { + case len(subjectAsset.GetAssetId()) > 0: + copy(subjectAssetID[:], subjectAsset.GetAssetId()) + + case len(subjectAsset.GetAssetIdStr()) > 0: + assetIDBytes, err := hex.DecodeString( + subjectAsset.GetAssetIdStr(), + ) + if err != nil { + return asset.ID{}, fmt.Errorf("error decoding asset "+ + "ID hex string: %w", err) + } + + copy(subjectAssetID[:], assetIDBytes) + + default: + return asset.ID{}, fmt.Errorf("subject asset ID bytes and ID " + + "str not set") + } + + return subjectAssetID, nil +} + +// generateSelfSignedCert generates a self-signed TLS certificate and private +// key. +func generateSelfSignedCert() (tls.Certificate, error) { + certBytes, keyBytes, err := cert.GenCertPair( + "itest price oracle", nil, nil, false, 24*time.Hour, + ) + if err != nil { + return tls.Certificate{}, err + } + + tlsCert, err := tls.X509KeyPair(certBytes, keyBytes) + if err != nil { + return tls.Certificate{}, err + } + + return tlsCert, nil +} From edd610ff141a27d51a1019479f0ccb53a0156f7e Mon Sep 17 00:00:00 2001 From: jamaljsr <1356600+jamaljsr@users.noreply.github.com> Date: Fri, 9 Aug 2024 08:55:39 -0500 Subject: [PATCH 08/10] litclient: add taprpc packages to `Registrations` Add the `priceoraclerpc`, `rfqrpc`, and the `tapchannelrpc` JSON callbacks to the litclient's `Registrations` array. This allows the litclient to use the rpc functions contained in these JSON callbacks. --- litclient/jsoncallbacks.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/litclient/jsoncallbacks.go b/litclient/jsoncallbacks.go index 2a6e4028d..d28080cb5 100644 --- a/litclient/jsoncallbacks.go +++ b/litclient/jsoncallbacks.go @@ -10,6 +10,9 @@ import ( "github.com/lightninglabs/taproot-assets/taprpc" "github.com/lightninglabs/taproot-assets/taprpc/assetwalletrpc" "github.com/lightninglabs/taproot-assets/taprpc/mintrpc" + "github.com/lightninglabs/taproot-assets/taprpc/priceoraclerpc" + "github.com/lightninglabs/taproot-assets/taprpc/rfqrpc" + "github.com/lightninglabs/taproot-assets/taprpc/tapchannelrpc" "github.com/lightninglabs/taproot-assets/taprpc/universerpc" "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/autopilotrpc" @@ -55,4 +58,7 @@ var Registrations = []StubPackageRegistration{ assetwalletrpc.RegisterAssetWalletJSONCallbacks, universerpc.RegisterUniverseJSONCallbacks, mintrpc.RegisterMintJSONCallbacks, + priceoraclerpc.RegisterPriceOracleJSONCallbacks, + rfqrpc.RegisterRfqJSONCallbacks, + tapchannelrpc.RegisterTaprootAssetChannelsJSONCallbacks, } From 41b438945b1d063c827d98ae9d197386a0e630fa Mon Sep 17 00:00:00 2001 From: ZZiigguurraatt Date: Thu, 5 Dec 2024 18:06:31 -0500 Subject: [PATCH 09/10] dev.Dockerfile: allow forcing a specific taproot-assets version through a build argument --- dev.Dockerfile | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dev.Dockerfile b/dev.Dockerfile index 5a70f97a0..f7a5e1c2e 100644 --- a/dev.Dockerfile +++ b/dev.Dockerfile @@ -23,10 +23,19 @@ COPY --from=nodejsbuilder /go/src/github.com/lightninglabs/lightning-terminal /g # queries required to connect to linked containers succeed. ENV GODEBUG netdns=cgo +# Allow forcing a specific taproot-assets version through a build argument. +# Please see https://go.dev/ref/mod#version-queries for the types of +# queries that can be used to define a version. +ARG TAPROOT_ASSETS_VERSION + # Install dependencies and install/build lightning-terminal. -RUN apk add --no-cache --update alpine-sdk \ - make \ +RUN apk add --no-cache --update alpine-sdk make \ && cd /go/src/github.com/lightninglabs/lightning-terminal \ + # If a custom taproot-assets version is supplied, force it now. + && if [ -n "$TAPROOT_ASSETS_VERSION" ]; then \ + go get -v github.com/lightninglabs/taproot-assets@$TAPROOT_ASSETS_VERSION \ + && go mod tidy; \ + fi \ && make go-install \ && make go-install-cli From f16893da76c9a725c856747fc094511052717222 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Mon, 21 Oct 2024 16:02:53 +0200 Subject: [PATCH 10/10] version+docs: add release notes, bump version to v0.14.0-alpha --- README.md | 7 ++++++ docs/release-notes/release-notes-0.13.5.md | 2 ++ ...otes-0.13.7.md => release-notes-0.14.0.md} | 23 ++++++++++++++++++- version.go | 4 ++-- 4 files changed, 33 insertions(+), 3 deletions(-) rename docs/release-notes/{release-notes-0.13.7.md => release-notes-0.14.0.md} (63%) diff --git a/README.md b/README.md index 37e521cd7..28d7da0ba 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,7 @@ in remote mode (meaning that `lnd-mode=remote` is set). It shows the | LiT | LND | |-------------------|--------------| +| **v0.14.0-alpha** | v0.18.4-beta | | **v0.13.6-alpha** | v0.17.1-beta | | **v0.13.5-alpha** | v0.17.1-beta | | **v0.13.4-alpha** | v0.17.1-beta | @@ -158,10 +159,16 @@ The following table shows the supported combinations: | `taproot-assets-mode=disable` | X | X | | `lnd` running in "stateless init" mode | X | | +NOTE: Taproot Assets **Channel** functionality is only available when both `lnd` +and `tapd` are running in the same process (by setting both +`lnd-mode=integrated` and `taproot-assets-mode=integrated`). Remote mode support +will be added in the future. + ## Daemon Versions packaged with LiT | LiT | LND | Loop | Faraday | Pool | Taproot Assets | |-------------------|--------------|--------------|---------------|--------------|----------------| +| **v0.14.0-alpha** | v0.18.4-beta | v0.29.0-beta | v0.2.13-alpha | v0.6.5-beta | v0.5.0-alpha | | **v0.13.6-alpha** | v0.18.3-beta | v0.28.8-beta | v0.2.13-alpha | v0.6.5-beta | v0.4.1-alpha | | **v0.13.5-alpha** | v0.18.3-beta | v0.28.8-beta | v0.2.13-alpha | v0.6.5-beta | v0.4.1-alpha | | **v0.13.4-alpha** | v0.18.3-beta | v0.28.7-beta | v0.2.13-alpha | v0.6.5-beta | v0.4.1-alpha | diff --git a/docs/release-notes/release-notes-0.13.5.md b/docs/release-notes/release-notes-0.13.5.md index 05c3eb004..627b7dcf2 100644 --- a/docs/release-notes/release-notes-0.13.5.md +++ b/docs/release-notes/release-notes-0.13.5.md @@ -29,6 +29,8 @@ especially useful in stateless-init mode where users will not have access to a LiT macaroon to perform this call with. +* [Convert litrpc package into a module](https://github.com/lightninglabs/lightning-terminal/pull/823). + ### Technical and Architectural Updates * [Convert litrpc package into a module](https://github.com/lightninglabs/lightning-terminal/pull/823). diff --git a/docs/release-notes/release-notes-0.13.7.md b/docs/release-notes/release-notes-0.14.0.md similarity index 63% rename from docs/release-notes/release-notes-0.13.7.md rename to docs/release-notes/release-notes-0.14.0.md index 0e30c51f4..d15aeed90 100644 --- a/docs/release-notes/release-notes-0.13.7.md +++ b/docs/release-notes/release-notes-0.14.0.md @@ -34,6 +34,16 @@ network](https://github.com/lightninglabs/lightning-terminal/pull/902). This can be done using the `--network=signet` config option. +* Add [custom channel + functionality](https://github.com/lightninglabs/lightning-terminal/pull/848) + to `litd`. Custom channels with Taproot Assets can now be created when `litd` + runs in integrated `lnd` mode (`lnd-mode=integrated`) with the Taproot Assets + daemon also running in integrated mode (`taproot-assets-mode=integrated`). + +* [Add itest](https://github.com/lightninglabs/lightning-terminal/pull/892) for + the MinRelayFee check added in Taproot Assets. The test ensures that + transactions with fees below the minimum relay fee are rejected. + ### Technical and Architectural Updates ## Integrated Binary Updates @@ -42,13 +52,24 @@ ### Loop +* Updated Loop [to the latest version + `v0.29.0-beta`](https://github.com/lightninglabs/loop/releases/tag/v0.29.0-beta). + ### Pool ### Faraday ### Taproot Assets +* Updated `tapd` [to the latest version + `v0.5.0-alpha`](https://github.com/lightninglabs/taproot-assets/releases/tag/v0.5.0). + # Contributors (Alphabetical Order) * Elle Mouton -* Oliver Gugger \ No newline at end of file +* George Tsagkarelis +* Gijs van Dam +* Jamal James +* Jonathan Harvey-Buschel +* Olaoluwa Osuntokun +* Oliver Gugger diff --git a/version.go b/version.go index d3ed75142..ecb231a23 100644 --- a/version.go +++ b/version.go @@ -22,8 +22,8 @@ const semanticAlphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqr // versioning 2.0.0 spec (http://semver.org/). const ( appMajor uint = 0 - appMinor uint = 13 - appPatch uint = 6 + appMinor uint = 14 + appPatch uint = 0 // appPreRelease MUST only contain characters from semanticAlphabet per // the semantic versioning spec.