From aa59401307055ed9e704c27d62d9f7010d5acbd4 Mon Sep 17 00:00:00 2001 From: vindard <17693119+vindard@users.noreply.github.com> Date: Tue, 30 Jan 2024 14:40:10 -0400 Subject: [PATCH] chore(core): remove swap (via loopd) functionality --- core/api/galoy.yaml | 11 - core/api/package.json | 2 +- core/api/src/app/index.ts | 3 - core/api/src/app/swap/get-active-loopd.ts | 35 - core/api/src/app/swap/index.ts | 2 - core/api/src/app/swap/swap-listener.ts | 52 - core/api/src/app/swap/swap-out.ts | 87 - core/api/src/config/index.ts | 17 - core/api/src/config/schema.ts | 32 +- core/api/src/config/schema.types.d.ts | 11 - core/api/src/config/types.d.ts | 1 - core/api/src/config/yaml.ts | 17 - core/api/src/domain/swap/errors.ts | 14 - core/api/src/domain/swap/index.ts | 19 - core/api/src/domain/swap/index.types.d.ts | 88 - core/api/src/domain/swap/swap-out-checker.ts | 31 - core/api/src/servers/cron.ts | 8 +- core/api/src/servers/trigger.ts | 43 +- core/api/src/services/ledger/admin.ts | 63 - .../services/ledger/domain/index.types.d.ts | 16 +- core/api/src/services/ledger/schema.ts | 1 - .../api/src/services/ledger/schema.types.d.ts | 1 - .../ledger/services/transactions-metadata.ts | 2 +- core/api/src/services/loopd/index.ts | 1 - core/api/src/services/loopd/loop-service.ts | 281 - .../src/services/loopd/protos/buf.gen.yaml | 20 - core/api/src/services/loopd/protos/buf.yaml | 11 - .../api/src/services/loopd/protos/debug.proto | 25 - .../services/loopd/protos/debug_grpc_pb.js | 52 - .../src/services/loopd/protos/debug_pb.d.ts | 37 - .../api/src/services/loopd/protos/debug_pb.js | 270 - core/api/src/services/loopd/protos/loop.proto | 1036 --- .../services/loopd/protos/loop_grpc_pb.d.ts | 273 - .../src/services/loopd/protos/loop_grpc_pb.js | 478 -- .../src/services/loopd/protos/loop_pb.d.ts | 982 --- core/api/src/services/loopd/protos/loop_pb.js | 7279 ----------------- .../loopd/protos/swapserverrpc/common.proto | 37 - .../protos/swapserverrpc/common_grpc_pb.js | 1 - .../loopd/protos/swapserverrpc/common_pb.d.ts | 63 - .../loopd/protos/swapserverrpc/common_pb.js | 478 -- .../app/swap/swap-listener.spec.ts | 45 - .../app/swap/swap-out.spec.ts | 165 - .../app/swap/swap-record-ledger-fee.spec.ts | 37 - core/api/test/unit/config.spec.ts | 4 +- .../unit/domain/swap/swap-out-checker.spec.ts | 79 - docs/swap.md | 181 - typos.toml | 1 - 47 files changed, 9 insertions(+), 12383 deletions(-) delete mode 100644 core/api/src/app/swap/get-active-loopd.ts delete mode 100644 core/api/src/app/swap/index.ts delete mode 100644 core/api/src/app/swap/swap-listener.ts delete mode 100644 core/api/src/app/swap/swap-out.ts delete mode 100644 core/api/src/domain/swap/errors.ts delete mode 100644 core/api/src/domain/swap/index.ts delete mode 100644 core/api/src/domain/swap/index.types.d.ts delete mode 100644 core/api/src/domain/swap/swap-out-checker.ts delete mode 100644 core/api/src/services/loopd/index.ts delete mode 100644 core/api/src/services/loopd/loop-service.ts delete mode 100644 core/api/src/services/loopd/protos/buf.gen.yaml delete mode 100644 core/api/src/services/loopd/protos/buf.yaml delete mode 100644 core/api/src/services/loopd/protos/debug.proto delete mode 100644 core/api/src/services/loopd/protos/debug_grpc_pb.js delete mode 100644 core/api/src/services/loopd/protos/debug_pb.d.ts delete mode 100644 core/api/src/services/loopd/protos/debug_pb.js delete mode 100644 core/api/src/services/loopd/protos/loop.proto delete mode 100644 core/api/src/services/loopd/protos/loop_grpc_pb.d.ts delete mode 100644 core/api/src/services/loopd/protos/loop_grpc_pb.js delete mode 100644 core/api/src/services/loopd/protos/loop_pb.d.ts delete mode 100644 core/api/src/services/loopd/protos/loop_pb.js delete mode 100644 core/api/src/services/loopd/protos/swapserverrpc/common.proto delete mode 100644 core/api/src/services/loopd/protos/swapserverrpc/common_grpc_pb.js delete mode 100644 core/api/src/services/loopd/protos/swapserverrpc/common_pb.d.ts delete mode 100644 core/api/src/services/loopd/protos/swapserverrpc/common_pb.js delete mode 100644 core/api/test/legacy-integration/app/swap/swap-listener.spec.ts delete mode 100644 core/api/test/legacy-integration/app/swap/swap-out.spec.ts delete mode 100644 core/api/test/legacy-integration/app/swap/swap-record-ledger-fee.spec.ts delete mode 100644 core/api/test/unit/domain/swap/swap-out-checker.spec.ts delete mode 100644 docs/swap.md diff --git a/core/api/galoy.yaml b/core/api/galoy.yaml index b588c60220..6d91bbc9b1 100644 --- a/core/api/galoy.yaml +++ b/core/api/galoy.yaml @@ -141,20 +141,9 @@ onChainWallet: scanDepth: 360 scanDepthOutgoing: 2 scanDepthChannelUpdate: 8 -swap: - loopOutWhenHotWalletLessThan: 200000000 - swapOutAmount: 50000000 - swapProviders: - - Loop - lnd1loopRestEndpoint: https://localhost:8081 - lnd1loopRpcEndpoint: localhost:11010 - lnd2loopRestEndpoint: https://localhost:8082 - lnd2loopRpcEndpoint: localhost:11011 - feeAccountingEnabled: true userActivenessMonthlyVolumeThreshold: 100 cronConfig: rebalanceEnabled: true - swapEnabled: true captcha: mandatory: false skipFeeProbeConfig: diff --git a/core/api/package.json b/core/api/package.json index b54261ca1b..271d3679a6 100644 --- a/core/api/package.json +++ b/core/api/package.json @@ -5,7 +5,7 @@ "eslint-check": "eslint src test --ext .ts", "eslint-fix": "eslint src test --ext .ts --fix", "circular-deps-check": "madge --circular --extensions ts src", - "build": "tsc -p tsconfig-build.json && cp -R src/services/price/protos dist/services/price/ && cp -R src/services/dealer-price/proto dist/services/dealer-price/ && cp -R src/services/loopd/protos dist/services/loopd/ && cp -R src/services/bria/proto dist/services/bria/ && cp -R src/services/notifications/proto dist/services/notifications/ && tscpaths --silent -p tsconfig.json -s ./src -o ./dist", + "build": "tsc -p tsconfig-build.json && cp -R src/services/price/protos dist/services/price/ && cp -R src/services/dealer-price/proto dist/services/dealer-price/ && cp -R src/services/bria/proto dist/services/bria/ && cp -R src/services/notifications/proto dist/services/notifications/ && tscpaths --silent -p tsconfig.json -s ./src -o ./dist", "trigger": "pnpm run build && node dist/servers/trigger.js | pino-pretty -c -l", "ws": "pnpm run build && node dist/servers/ws-server.js | pino-pretty -c -l", "watch": "nodemon -V -e ts,graphql -w ./src -x pnpm run start", diff --git a/core/api/src/app/index.ts b/core/api/src/app/index.ts index 356626c94c..d0cad0c7d2 100644 --- a/core/api/src/app/index.ts +++ b/core/api/src/app/index.ts @@ -11,7 +11,6 @@ import * as TransactionsMod from "./transactions" import * as UsersMod from "./users" import * as WalletsMod from "./wallets" import * as PaymentsMod from "./payments" -import * as SwapMod from "./swap" import { wrapAsyncToRunInSpan } from "@/services/tracing" @@ -29,7 +28,6 @@ const allFunctions = { Users: { ...UsersMod }, Wallets: { ...WalletsMod }, Payments: { ...PaymentsMod }, - Swap: { ...SwapMod }, } as const let subModule: keyof typeof allFunctions @@ -59,5 +57,4 @@ export const { Users, Wallets, Payments, - Swap, } = allFunctions diff --git a/core/api/src/app/swap/get-active-loopd.ts b/core/api/src/app/swap/get-active-loopd.ts deleted file mode 100644 index f23a64c671..0000000000 --- a/core/api/src/app/swap/get-active-loopd.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { NETWORK, getLoopConfig, getSwapConfig } from "@/config" -import { SwapErrorNoActiveLoopdNode } from "@/domain/swap/errors" -import { getActiveLnd } from "@/services/lnd/config" - -export const getActiveLoopd = (): LoopdConfig => { - const activeOffChainNode = getActiveLnd() - if (activeOffChainNode instanceof Error) throw new SwapErrorNoActiveLoopdNode() - switch (activeOffChainNode.name.toLowerCase()) { - case "lnd1": { - return lnd1LoopConfig() - } - case "lnd2": { - return lnd2LoopConfig() - } - default: { - throw new SwapErrorNoActiveLoopdNode() - } - } -} - -export const lnd1LoopConfig = (): LoopdConfig => ({ - btcNetwork: NETWORK, - grpcEndpoint: getSwapConfig().lnd1loopRpcEndpoint, - tlsCert: getLoopConfig().lnd1LoopTls, - macaroon: getLoopConfig().lnd1LoopMacaroon, - lndInstanceName: "LND1", -}) - -export const lnd2LoopConfig = (): LoopdConfig => ({ - btcNetwork: NETWORK, - grpcEndpoint: getSwapConfig().lnd2loopRpcEndpoint, - tlsCert: getLoopConfig().lnd2LoopTls, - macaroon: getLoopConfig().lnd2LoopMacaroon, - lndInstanceName: "LND2", -}) diff --git a/core/api/src/app/swap/index.ts b/core/api/src/app/swap/index.ts deleted file mode 100644 index da70dfa9e1..0000000000 --- a/core/api/src/app/swap/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./swap-out" -export * from "./swap-listener" diff --git a/core/api/src/app/swap/swap-listener.ts b/core/api/src/app/swap/swap-listener.ts deleted file mode 100644 index 4422533694..0000000000 --- a/core/api/src/app/swap/swap-listener.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { admin as LedgerAdmin } from "@/services/ledger/admin" -import { WalletCurrency } from "@/domain/shared" -import { SwapState, SwapType } from "@/domain/swap" -import { addAttributesToCurrentSpan } from "@/services/tracing" -import { DuplicateError } from "@/domain/errors" - -export const handleSwapOutCompleted = async (swapStatus: SwapStatusResultWrapper) => { - if (swapStatus.parsedSwapData) { - const type = swapStatus.parsedSwapData.swapType - const onchainMinerFee = { - amount: BigInt(swapStatus.parsedSwapData.onchainMinerFee), - currency: WalletCurrency.Btc, - } - const offchainRoutingFee = { - amount: BigInt(swapStatus.parsedSwapData.offchainRoutingFee), - currency: WalletCurrency.Btc, - } - const serviceProviderFee = { - amount: BigInt(swapStatus.parsedSwapData.serviceProviderFee), - currency: WalletCurrency.Btc, - } - const totalFees = - onchainMinerFee.amount + offchainRoutingFee.amount + serviceProviderFee.amount - const state = swapStatus.parsedSwapData.state - addAttributesToCurrentSpan({ - "swap.handler.state": state, - "swap.handler.type": type, - "swap.handler.onchainMinerFee": Number(onchainMinerFee.amount), - "swap.handler.offchainRoutingFee": Number(offchainRoutingFee.amount), - "swap.handler.serviceProviderFee": Number(serviceProviderFee.amount), - "swap.handler.totalFees": Number(totalFees), - }) - if (type === SwapType.Swapout && state === SwapState.Success && totalFees > 0n) { - const journalResponse = await LedgerAdmin.addSwapFeeTxSend( - swapStatus.parsedSwapData, - ) - if (journalResponse instanceof DuplicateError) return - addAttributesToCurrentSpan({ - "swap.handler.success": JSON.stringify(journalResponse), - }) - } - if (state === SwapState.Failed) { - addAttributesToCurrentSpan({ - "swap.error": JSON.stringify({ - "swap.handler.errorMsg": swapStatus.parsedSwapData.message, - "swap.handler.errorSwapId": swapStatus.parsedSwapData.id, - "swap.handler.errorAmt": Number(swapStatus.parsedSwapData.amt), - }), - }) - } - } -} diff --git a/core/api/src/app/swap/swap-out.ts b/core/api/src/app/swap/swap-out.ts deleted file mode 100644 index 00e48a8791..0000000000 --- a/core/api/src/app/swap/swap-out.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { getActiveLoopd } from "./get-active-loopd" - -import { getSwapConfig } from "@/config" -import { NoOutboundLiquidityForSwapError, SwapServiceError } from "@/domain/swap/errors" -import { OnChainService } from "@/services/bria" -import { SwapOutChecker } from "@/domain/swap" -import { baseLogger } from "@/services/logger" -import { LoopService } from "@/services/loopd" -import { addAttributesToCurrentSpan } from "@/services/tracing" -import { LndService } from "@/services/lnd" - -import { WalletCurrency } from "@/domain/shared" - -const logger = baseLogger.child({ module: "swap" }) - -export const swapOut = async (): Promise< - SwapOutResult | NoOutboundLiquidityForSwapError | SwapServiceError -> => { - addAttributesToCurrentSpan({ - "swap.event": "started", - }) - const activeLoopdConfig = getActiveLoopd() - const swapService = LoopService(activeLoopdConfig) - if (!swapService.healthCheck()) return new SwapServiceError("Failed health check") - const onChainService = OnChainService() - if (onChainService instanceof Error) return onChainService - const onChainBalance = await onChainService.getHotBalance() - if (onChainBalance instanceof Error) return onChainBalance - const offChainService = LndService() - if (offChainService instanceof Error) return offChainService - const offChainChannelBalances = await offChainService.getInboundOutboundBalance() - if (offChainChannelBalances instanceof Error) return offChainChannelBalances - const outbound = offChainChannelBalances.outbound - const loopOutWhenHotWalletLessThanConfig = getSwapConfig().loopOutWhenHotWalletLessThan - - const swapChecker = SwapOutChecker({ - loopOutWhenHotWalletLessThanConfig, - swapOutAmount: getSwapConfig().swapOutAmount, - }) - const swapOutAmount = swapChecker.getSwapOutAmount({ - currentOnChainHotWalletBalance: onChainBalance, - currentOutboundLiquidityBalance: { - amount: BigInt(outbound), - currency: WalletCurrency.Btc, - }, - }) - - const swapNoOp: SwapOutResult = { - noOp: true, - htlcAddress: "" as OnChainAddress, - serverMessage: "", - swapId: "" as SwapId, - swapIdBytes: "", - } - if (swapOutAmount.amount === 0n) return swapNoOp - - const hasEnoughOutboundLiquidity = outbound > swapOutAmount.amount - if (!hasEnoughOutboundLiquidity) { - addAttributesToCurrentSpan({ - "swap.checker.message": "Not enough outbound liquidity to perform swap out", - "swap.checker.outboundAmountNeeded": Number(swapOutAmount.amount), - "swap.checker.currentOutboundBalance": outbound, - }) - return swapNoOp - } - - logger.info({ swapOutAmount, activeLoopdConfig }, `Initiating swapout`) - addAttributesToCurrentSpan({ - "swap.amount": Number(swapOutAmount.amount), - }) - const swapDestAddress = await onChainService.getAddressForSwap() - if (swapDestAddress instanceof Error) return swapDestAddress - const swapResult = await swapService.swapOut({ - amount: swapOutAmount, - swapDestAddress, - }) - if (swapResult instanceof Error) { - addAttributesToCurrentSpan({ - "swap.error": JSON.stringify(swapResult), - }) - } else { - addAttributesToCurrentSpan({ - "swap.submitted": JSON.stringify(swapResult), - }) - } - return swapResult -} diff --git a/core/api/src/config/index.ts b/core/api/src/config/index.ts index bb832944c1..cd71ddf4fa 100644 --- a/core/api/src/config/index.ts +++ b/core/api/src/config/index.ts @@ -2,7 +2,6 @@ import { getBriaPartialConfigFromYaml, MEMO_SHARING_CENTS_THRESHOLD, MEMO_SHARING_SATS_THRESHOLD, - getCronConfig, } from "./yaml" import { env } from "./env" @@ -66,22 +65,6 @@ export const getGeetestConfig = () => { export const isRunningJest = typeof jest !== "undefined" -export const getLoopConfig = () => { - if (getCronConfig().swapEnabled) { - if (!LND1_LOOP_TLS) throw new ConfigError("Missing LND1_LOOP_TLS config") - if (!LND2_LOOP_TLS) throw new ConfigError("Missing LND2_LOOP_TLS config") - if (!LND1_LOOP_MACAROON) throw new ConfigError("Missing LND1_LOOP_MACAROON config") - if (!LND2_LOOP_MACAROON) throw new ConfigError("Missing LND2_LOOP_MACAROON config") - return { - lnd1LoopTls: LND1_LOOP_TLS, - lnd1LoopMacaroon: LND1_LOOP_MACAROON, - lnd2LoopTls: LND2_LOOP_TLS, - lnd2LoopMacaroon: LND2_LOOP_MACAROON, - } - } - throw new ConfigError("getLoopConfig() was called though swapEnabled is false") -} - export const memoSharingConfig = { memoSharingSatsThreshold: MEMO_SHARING_SATS_THRESHOLD, memoSharingCentsThreshold: MEMO_SHARING_CENTS_THRESHOLD, diff --git a/core/api/src/config/schema.ts b/core/api/src/config/schema.ts index 4e624c4ff0..b9b3755664 100644 --- a/core/api/src/config/schema.ts +++ b/core/api/src/config/schema.ts @@ -555,45 +555,16 @@ export const configSchema = { scanDepthChannelUpdate: 8, }, }, - swap: { - type: "object", - properties: { - loopOutWhenHotWalletLessThan: { type: "integer" }, - lnd1loopRestEndpoint: { type: "string" }, - lnd2loopRestEndpoint: { type: "string" }, - lnd1loopRpcEndpoint: { type: "string" }, - lnd2loopRpcEndpoint: { type: "string" }, - swapOutAmount: { type: "integer" }, - swapProviders: { - type: "array", - items: { enum: ["Loop"] }, - uniqueItems: true, - }, - feeAccountingEnabled: { type: "boolean" }, - }, - default: { - loopOutWhenHotWalletLessThan: 200000000, - swapOutAmount: 50000000, - swapProviders: ["Loop"], - lnd1loopRestEndpoint: "https://localhost:8081", - lnd1loopRpcEndpoint: "localhost:11010", - lnd2loopRestEndpoint: "https://localhost:8082", - lnd2loopRpcEndpoint: "localhost:11011", - feeAccountingEnabled: true, - }, - }, userActivenessMonthlyVolumeThreshold: { type: "integer", default: 100 }, cronConfig: { type: "object", properties: { rebalanceEnabled: { type: "boolean" }, - swapEnabled: { type: "boolean" }, }, - required: ["rebalanceEnabled", "swapEnabled"], + required: ["rebalanceEnabled"], additionalProperties: false, default: { rebalanceEnabled: true, - swapEnabled: true, }, }, captcha: { @@ -658,7 +629,6 @@ export const configSchema = { "ipRecording", "fees", "onChainWallet", - "swap", "userActivenessMonthlyVolumeThreshold", "cronConfig", "captcha", diff --git a/core/api/src/config/schema.types.d.ts b/core/api/src/config/schema.types.d.ts index c42544a283..ce732c39e4 100644 --- a/core/api/src/config/schema.types.d.ts +++ b/core/api/src/config/schema.types.d.ts @@ -130,20 +130,9 @@ type YamlSchema = { scanDepthOutgoing: number scanDepthChannelUpdate: number } - swap: { - loopOutWhenHotWalletLessThan: number - lnd1loopRestEndpoint: string - lnd2loopRestEndpoint: string - lnd1loopRpcEndpoint: string - lnd2loopRpcEndpoint: string - swapOutAmount: number - swapProviders: Array - feeAccountingEnabled: boolean - } userActivenessMonthlyVolumeThreshold: number cronConfig: { rebalanceEnabled: boolean - swapEnabled: boolean } captcha: { mandatory: boolean diff --git a/core/api/src/config/types.d.ts b/core/api/src/config/types.d.ts index a30607426a..d38ea18d34 100644 --- a/core/api/src/config/types.d.ts +++ b/core/api/src/config/types.d.ts @@ -7,7 +7,6 @@ type Levels = number[] type CronConfig = { rebalanceEnabled: boolean - swapEnabled: boolean } type CaptchaConfig = { diff --git a/core/api/src/config/yaml.ts b/core/api/src/config/yaml.ts index 5448305a79..e599a382d6 100644 --- a/core/api/src/config/yaml.ts +++ b/core/api/src/config/yaml.ts @@ -324,23 +324,6 @@ export const getAccountsOnboardConfig = (config = yamlConfig): AccountsOnboardCo } } -export const getSwapConfig = (): SwapConfig => { - const config = yamlConfig.swap - return { - loopOutWhenHotWalletLessThan: { - amount: BigInt(config.loopOutWhenHotWalletLessThan), - currency: WalletCurrency.Btc, - }, - swapOutAmount: { amount: BigInt(config.swapOutAmount), currency: WalletCurrency.Btc }, - lnd1loopRestEndpoint: config.lnd1loopRestEndpoint, - lnd2loopRestEndpoint: config.lnd2loopRestEndpoint, - lnd1loopRpcEndpoint: config.lnd1loopRpcEndpoint, - lnd2loopRpcEndpoint: config.lnd2loopRpcEndpoint, - swapProviders: config.swapProviders, - feeAccountingEnabled: config.feeAccountingEnabled, - } -} - export const getSmsAuthUnsupportedCountries = (): CountryCode[] => { return yamlConfig.smsAuthUnsupportedCountries as CountryCode[] } diff --git a/core/api/src/domain/swap/errors.ts b/core/api/src/domain/swap/errors.ts deleted file mode 100644 index 43a49f10c7..0000000000 --- a/core/api/src/domain/swap/errors.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { DomainError, ErrorLevel } from "@/domain/shared" - -export class SwapError extends DomainError {} -export class NoOutboundLiquidityForSwapError extends DomainError {} -export class SwapTriggerError extends SwapError {} -export class SwapServiceError extends SwapError {} -export class SwapClientNotResponding extends SwapServiceError {} -export class SwapErrorNoActiveLoopdNode extends SwapServiceError {} -export class SwapErrorHealthCheckFailed extends SwapServiceError {} -export class SwapErrorChannelBalanceTooLow extends SwapServiceError {} - -export class UnknownSwapServiceError extends SwapServiceError { - level = ErrorLevel.Critical -} diff --git a/core/api/src/domain/swap/index.ts b/core/api/src/domain/swap/index.ts deleted file mode 100644 index ad63fe8ddf..0000000000 --- a/core/api/src/domain/swap/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -export * from "./swap-out-checker" - -export const SwapProvider = { - Loop: "Loop", -} as const - -export const SwapType = { - Swapout: "swapOut", - Unknown: "unknown", -} as const - -export const SwapState = { - Initiated: "initiated", - PreimageRevealed: "preimageRevealed", - HtlcPublished: "htlcPublished", - Success: "success", - Failed: "failed", - InvoiceSettled: "invoiceSettled", -} as const diff --git a/core/api/src/domain/swap/index.types.d.ts b/core/api/src/domain/swap/index.types.d.ts deleted file mode 100644 index 290e503436..0000000000 --- a/core/api/src/domain/swap/index.types.d.ts +++ /dev/null @@ -1,88 +0,0 @@ -type SwapClientReadableStream = import("@grpc/grpc-js").ClientReadableStream -type SwapServiceError = import("./errors").SwapServiceError -type SwapProvider = - (typeof import("./index").SwapProvider)[keyof typeof import("./index").SwapProvider] -type SwapType = - (typeof import("./index").SwapType)[keyof typeof import("./index").SwapType] -type SwapState = - (typeof import("./index").SwapState)[keyof typeof import("./index").SwapState] - -interface ISwapService { - healthCheck: () => Promise - swapOut: (swapOutArgs: SwapOutArgs) => Promise - swapListener: () => SwapClientReadableStream - swapOutTerms: () => Promise - swapOutQuote: (amt: BtcPaymentAmount) => Promise -} - -type SwapOutArgs = { - amount: BtcPaymentAmount - maxSwapFee?: BtcPaymentAmount - swapDestAddress?: OnChainAddress -} - -type SwapOutResult = { - swapId: SwapId - swapIdBytes: string - htlcAddress: OnChainAddress - serverMessage: string - noOp?: true -} - -type SwapListenerResponse = - | SwapStatusResultWrapper - | (SwapStatusResult & SwapStatusResultWrapper) - -type SwapStatusResultWrapper = { - parsedSwapData: SwapStatusResult -} - -type SwapStatusResult = { - amt: bigint - id: string - state: SwapState - htlcAddress: string - serviceProviderFee: bigint - onchainMinerFee: bigint - offchainRoutingFee: bigint - message: string - swapType: SwapType -} - -type SwapOutTermsResult = { - minSwapAmount: BtcPaymentAmount - maxSwapAmount: BtcPaymentAmount - minCltvDelta: number - maxCltvDelta: number -} - -type SwapOutQuoteResult = { - swapFeeSat: BtcPaymentAmount - prepayAmtSat: BtcPaymentAmount - htlcSweepFeeSat: BtcPaymentAmount - swapPaymentDest: OnChainAddress - cltvDelta: number - confTarget: number -} - -type SwapConfig = { - loopOutWhenHotWalletLessThan: BtcPaymentAmount - swapOutAmount: BtcPaymentAmount - lnd1loopRestEndpoint: string - lnd2loopRestEndpoint: string - lnd1loopRpcEndpoint: string - lnd2loopRpcEndpoint: string - swapProviders: Array - feeAccountingEnabled: boolean -} - -type LoopdConfig = { - macaroon: Macaroon - tlsCert: string - grpcEndpoint: string - btcNetwork: BtcNetwork - lndInstanceName: string -} - -type SwapId = string & { readonly brand: unique symbol } -type SwapHash = string & { readonly brand: unique symbol } diff --git a/core/api/src/domain/swap/swap-out-checker.ts b/core/api/src/domain/swap/swap-out-checker.ts deleted file mode 100644 index 32c88f9edf..0000000000 --- a/core/api/src/domain/swap/swap-out-checker.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { ZERO_SATS } from "@/domain/shared" - -export const SwapOutChecker = ({ - loopOutWhenHotWalletLessThanConfig, - swapOutAmount, -}: { - loopOutWhenHotWalletLessThanConfig: BtcPaymentAmount - swapOutAmount: BtcPaymentAmount -}) => { - // checks the amount of "swap out" that is need - // if return "0" then no swap out needed - // if return an "amount" then swapout needed - const getSwapOutAmount = ({ - currentOnChainHotWalletBalance, - currentOutboundLiquidityBalance, - }: { - currentOnChainHotWalletBalance: BtcPaymentAmount - currentOutboundLiquidityBalance: BtcPaymentAmount - }): BtcPaymentAmount => { - const isOnChainWalletDepleted = - currentOnChainHotWalletBalance.amount < loopOutWhenHotWalletLessThanConfig.amount - const hasEnoughOutboundLiquidity = - currentOutboundLiquidityBalance.amount > swapOutAmount.amount - if (!hasEnoughOutboundLiquidity) return ZERO_SATS - if (isOnChainWalletDepleted && hasEnoughOutboundLiquidity) return swapOutAmount - return ZERO_SATS - } - return { - getSwapOutAmount, - } -} diff --git a/core/api/src/servers/cron.ts b/core/api/src/servers/cron.ts index ec1cc2a73a..00114036e4 100644 --- a/core/api/src/servers/cron.ts +++ b/core/api/src/servers/cron.ts @@ -1,4 +1,4 @@ -import { OnChain, Lightning, Wallets, Payments, Swap } from "@/app" +import { OnChain, Lightning, Wallets, Payments } from "@/app" import { getCronConfig, TWO_MONTHS_IN_MS } from "@/config" @@ -54,11 +54,6 @@ const deleteLndPaymentsBefore2Months = async () => { if (result instanceof Error) throw result } -const swapOutJob = async () => { - const swapResult = await Swap.swapOut() - if (swapResult instanceof Error) throw swapResult -} - const main = async () => { console.log("cronjob started") const start = new Date() @@ -78,7 +73,6 @@ const main = async () => { updateRoutingRevenues, updateLegacyOnChainReceipt, ...(cronConfig.rebalanceEnabled ? [rebalance] : []), - ...(cronConfig.swapEnabled ? [swapOutJob] : []), deleteExpiredPaymentFlows, deleteLndPaymentsBefore2Months, deleteFailedPaymentsAttemptAllLnds, diff --git a/core/api/src/servers/trigger.ts b/core/api/src/servers/trigger.ts index 8d4f60d35f..2aefad20d2 100644 --- a/core/api/src/servers/trigger.ts +++ b/core/api/src/servers/trigger.ts @@ -24,29 +24,16 @@ import { briaEventHandler } from "./event-handlers/bria" import healthzHandler from "./middlewares/healthz" -import { - getSwapConfig, - MS_PER_5_MINS, - NETWORK, - ONCHAIN_MIN_CONFIRMATIONS, - TRIGGER_PORT, -} from "@/config" +import { MS_PER_5_MINS, NETWORK, ONCHAIN_MIN_CONFIRMATIONS, TRIGGER_PORT } from "@/config" -import { - Lightning, - Payments, - Swap as SwapWithSpans, - Wallets as WalletWithSpans, -} from "@/app" +import { Lightning, Payments, Wallets as WalletWithSpans } from "@/app" import { uploadBackup } from "@/app/admin/backup" -import { lnd1LoopConfig, lnd2LoopConfig } from "@/app/swap/get-active-loopd" import * as Prices from "@/app/prices" import * as Wallets from "@/app/wallets" import { TxDecoder } from "@/domain/bitcoin/onchain" import { CacheKeys } from "@/domain/cache" import { CouldNotFindWalletFromOnChainAddressError } from "@/domain/errors" -import { SwapTriggerError } from "@/domain/swap/errors" import { checkedToDisplayCurrency } from "@/domain/fiat" import { DEFAULT_EXPIRATIONS } from "@/domain/bitcoin/lightning/invoice-expiration" import { ErrorLevel, paymentAmountFromNumber, WalletCurrency } from "@/domain/shared" @@ -58,7 +45,6 @@ import { LndService } from "@/services/lnd" import { activateLndHealthCheck, lndStatusEvent } from "@/services/lnd/health" import { onChannelUpdated } from "@/services/lnd/utils" import { baseLogger } from "@/services/logger" -import { LoopService } from "@/services/loopd" import { setupMongoConnection } from "@/services/mongodb" import { NotificationsService } from "@/services/notifications" import { recordExceptionInCurrentSpan, wrapAsyncToRunInSpan } from "@/services/tracing" @@ -426,29 +412,6 @@ const listenerOffchain = ({ lnd, pubkey }: { lnd: AuthenticatedLnd; pubkey: Pubk }) } -const startSwapMonitor = async (swapService: ISwapService) => { - const isSwapServerUp = await swapService.healthCheck() - baseLogger.info({ isSwapServerUp }, "isSwapServerUp") - if (isSwapServerUp) { - const listener = swapService.swapListener() - listener.on("data", (response) => { - baseLogger.info({ response }, "Swap Listener Called") - SwapWithSpans.handleSwapOutCompleted(response) - }) - } -} - -const listenerSwapMonitor = async () => { - try { - const loopServiceLnd1 = LoopService(lnd1LoopConfig()) - const loopServiceLnd2 = LoopService(lnd2LoopConfig()) - startSwapMonitor(loopServiceLnd1) - startSwapMonitor(loopServiceLnd2) - } catch (err) { - return new SwapTriggerError(err) - } -} - const listenerBria = async () => { const wrappedBriaEventHandler = wrapAsyncToRunInSpan({ namespace: "servers.trigger", @@ -487,8 +450,6 @@ const main = () => { publishCurrentPrice() watchHeldInvoices() - if (getSwapConfig().feeAccountingEnabled) listenerSwapMonitor() - console.log("trigger server ready") } diff --git a/core/api/src/services/ledger/admin.ts b/core/api/src/services/ledger/admin.ts index 26d984a805..e9ea8ff1bb 100644 --- a/core/api/src/services/ledger/admin.ts +++ b/core/api/src/services/ledger/admin.ts @@ -2,24 +2,16 @@ import { MainBook, Transaction } from "./books" import { getBankOwnerWalletId } from "./caching" -import { TransactionsMetadataRepository } from "./services" - import { coldStorageAccountId, lndLedgerAccountId } from "./domain/accounts" import { translateToLedgerJournal } from "./helpers" import { - CouldNotFindTransactionMetadataError, LedgerTransactionType, toLiabilitiesWalletId, UnknownLedgerError, } from "@/domain/ledger" import { WalletCurrency } from "@/domain/shared" -import { DuplicateError } from "@/domain/errors" -import { SwapProvider } from "@/domain/swap" -import { sha256 } from "@/domain/bitcoin/lightning" - -const txMetadataRepo = TransactionsMetadataRepository() export const admin = { isToHotWalletTxRecorded: async ( @@ -107,59 +99,4 @@ export const admin = { return new UnknownLedgerError(err) } }, - - addSwapFeeTxSend: async ( - swapResult: SwapStatusResult, - ): Promise => { - const swapFeeMetadata: SwapTransactionMetadataUpdate = { - hash: sha256(Buffer.from(swapResult.id)) as SwapHash, - swapId: swapResult.id as SwapId, - swapAmount: Number(swapResult.amt), - htlcAddress: swapResult.htlcAddress as OnChainAddress, - onchainMinerFee: Number(swapResult.onchainMinerFee), - offchainRoutingFee: Number(swapResult.offchainRoutingFee), - serviceProviderFee: Number(swapResult.serviceProviderFee), - serviceProvider: SwapProvider.Loop, - currency: WalletCurrency.Btc, - type: LedgerTransactionType.Fee, - } - const description = `Swap out fee for swapId ${swapFeeMetadata.swapId}` - const totalSwapFee = - swapFeeMetadata.offchainRoutingFee + - swapFeeMetadata.onchainMinerFee + - swapFeeMetadata.serviceProviderFee - try { - // check for duplicates - const result = await txMetadataRepo.findByHash(swapFeeMetadata.hash) - if (result instanceof CouldNotFindTransactionMetadataError) { - const bankOwnerWalletId = await getBankOwnerWalletId() - const bankOwnerPath = toLiabilitiesWalletId(bankOwnerWalletId) - const entry = MainBook.entry(description) - .credit(lndLedgerAccountId, Number(totalSwapFee), { - currency: WalletCurrency.Btc, - pending: false, - type: LedgerTransactionType.Fee, - }) - .debit(bankOwnerPath, Number(totalSwapFee), { - currency: WalletCurrency.Btc, - pending: false, - type: LedgerTransactionType.Fee, - }) - const saved = await entry.commit() - const journalEntry = translateToLedgerJournal(saved) - const txsMetadataToPersist = journalEntry.transactionIds.map((id) => ({ - id, - hash: swapFeeMetadata.hash, - swap: swapFeeMetadata, - })) - const metadataResults = await txMetadataRepo.persistAll(txsMetadataToPersist) - if (metadataResults instanceof Error) return metadataResults - return journalEntry - } else { - return new DuplicateError() - } - } catch (error) { - return new UnknownLedgerError(error) - } - }, } diff --git a/core/api/src/services/ledger/domain/index.types.d.ts b/core/api/src/services/ledger/domain/index.types.d.ts index 589da88785..e392110d1c 100644 --- a/core/api/src/services/ledger/domain/index.types.d.ts +++ b/core/api/src/services/ledger/domain/index.types.d.ts @@ -148,19 +148,6 @@ type LnLedgerTransactionMetadataUpdate = { revealedPreImage?: RevealedPreImage } -type SwapTransactionMetadataUpdate = { - hash: SwapHash - swapAmount: number - swapId: SwapId - htlcAddress: OnChainAddress - onchainMinerFee: number - offchainRoutingFee: number - serviceProviderFee: number - serviceProvider: string - currency: WalletCurrency - type: LedgerTransactionType -} - // Repeating 'id' key because can't figure out how to type an empty object // and have it still work with the '&' below. type IntraledgerLedgerTransactionMetadataUpdate = { id: LedgerTransactionId } @@ -170,7 +157,6 @@ type LedgerTransactionMetadata = BaseLedgerTransactionMetadata & | OnChainLedgerTransactionMetadataUpdate | LnLedgerTransactionMetadataUpdate | IntraledgerLedgerTransactionMetadataUpdate - | SwapTransactionMetadataUpdate ) interface ITransactionsMetadataRepository { @@ -187,7 +173,7 @@ interface ITransactionsMetadataRepository { findById(id: LedgerTransactionId): Promise findByHash( - hash: PaymentHash | OnChainTxHash | SwapHash, + hash: PaymentHash | OnChainTxHash, ): Promise listByIds( diff --git a/core/api/src/services/ledger/schema.ts b/core/api/src/services/ledger/schema.ts index 1ae52325dc..ab5738a9e4 100644 --- a/core/api/src/services/ledger/schema.ts +++ b/core/api/src/services/ledger/schema.ts @@ -155,7 +155,6 @@ const transactionMetadataSchema = new Schema( type: String, index: true, }, - swap: Schema.Types.Mixed, }, { id: false }, ) diff --git a/core/api/src/services/ledger/schema.types.d.ts b/core/api/src/services/ledger/schema.types.d.ts index 988bc01f50..d3da12714d 100644 --- a/core/api/src/services/ledger/schema.types.d.ts +++ b/core/api/src/services/ledger/schema.types.d.ts @@ -50,5 +50,4 @@ interface TransactionMetadataRecord { hash?: string revealedPreImage?: string - swap: SwapTransactionMetadataUpdate } diff --git a/core/api/src/services/ledger/services/transactions-metadata.ts b/core/api/src/services/ledger/services/transactions-metadata.ts index 8f3b25b453..ba78414e70 100644 --- a/core/api/src/services/ledger/services/transactions-metadata.ts +++ b/core/api/src/services/ledger/services/transactions-metadata.ts @@ -61,7 +61,7 @@ export const TransactionsMetadataRepository = (): ITransactionsMetadataRepositor } } - const findByHash = async (hash: PaymentHash | OnChainTxHash | SwapHash) => { + const findByHash = async (hash: PaymentHash | OnChainTxHash) => { try { const result = await TransactionMetadata.findOne({ hash, diff --git a/core/api/src/services/loopd/index.ts b/core/api/src/services/loopd/index.ts deleted file mode 100644 index e442bcc2e6..0000000000 --- a/core/api/src/services/loopd/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { LoopService } from "./loop-service" diff --git a/core/api/src/services/loopd/loop-service.ts b/core/api/src/services/loopd/loop-service.ts deleted file mode 100644 index 3321a761c7..0000000000 --- a/core/api/src/services/loopd/loop-service.ts +++ /dev/null @@ -1,281 +0,0 @@ -// https://lightning.engineering/loopapi/index.html#service-swapclient -import util from "util" - -import * as grpc from "@grpc/grpc-js" - -import { ServiceClient } from "@grpc/grpc-js/build/src/make-client" - -import { SwapClientClient } from "./protos/loop_grpc_pb" - -import { - FailureReason, - QuoteRequest, - OutQuoteResponse, - LoopOutRequest, - SwapResponse, - MonitorRequest, - SwapState, - SwapStatus, - TokensResponse, - TokensRequest, - TermsRequest, - OutTermsResponse, -} from "./protos/loop_pb" - -import { - SwapClientNotResponding, - SwapServiceError, - UnknownSwapServiceError, - SwapErrorChannelBalanceTooLow, -} from "@/domain/swap/errors" -import { SwapType as DomainSwapType } from "@/domain/swap" -import { wrapAsyncFunctionsToRunInSpan } from "@/services/tracing" -import { BtcNetwork } from "@/domain/bitcoin" - -import { SwapState as DomainSwapState } from "@/domain/swap/index" - -import { WalletCurrency } from "@/domain/shared" - -export const LoopService = ({ - macaroon, - tlsCert, - grpcEndpoint, - btcNetwork, - lndInstanceName, -}: LoopdConfig): ISwapService => { - const mac = Buffer.from(macaroon, "base64").toString("hex") as Macaroon - const tls = Buffer.from(tlsCert, "base64") - const swapClient: ServiceClient = createClient(mac, tls, grpcEndpoint) - - // helpers - const clientHealthCheck = util.promisify( - swapClient.getLsatTokens.bind(swapClient), - ) - const clientSwapOut = util.promisify( - swapClient.loopOut.bind(swapClient), - ) - const clientSwapOutQuote = util.promisify( - swapClient.loopOutQuote.bind(swapClient), - ) - const clientSwapOutTerms = util.promisify( - swapClient.loopOutTerms.bind(swapClient), - ) - - const healthCheck = async (): Promise => { - try { - const request = new TokensRequest() - const resp = await clientHealthCheck(request) - if (resp) return true - } catch { - swapClient.close() - return false - } - return false - } - - const swapOut = async function ({ - amount, - maxSwapFee, - swapDestAddress, - }: SwapOutArgs): Promise { - const fee = maxSwapFee ? Number(maxSwapFee.amount) : 20000 - try { - const request = new LoopOutRequest() - // on regtest, set the publication deadline to 0 for faster swaps, otherwise - // set it to 30 minutes in the future to reduce swap fees - const thirtyMins = 30 * 60 * 1000 - const swapPublicationDeadline = - btcNetwork === BtcNetwork.regtest ? 0 : Date.now() + thirtyMins - if (swapDestAddress) request.setDest(swapDestAddress) - request.setAmt(Number(amount.amount)) - request.setMaxSwapFee(fee) - request.setMaxPrepayRoutingFee(fee) - request.setMaxSwapFee(fee) - request.setMaxPrepayAmt(fee) - request.setMaxMinerFee(fee) - request.setSwapPublicationDeadline(swapPublicationDeadline) - request.setInitiator(`galoy-${lndInstanceName}`) - if (btcNetwork === BtcNetwork.regtest) request.setHtlcConfirmations(1) - if (btcNetwork === BtcNetwork.regtest) request.setSweepConfTarget(2) - const resp = await clientSwapOut(request) - const swapOutResult: SwapOutResult = { - htlcAddress: resp.getHtlcAddress() as OnChainAddress, - serverMessage: resp.getServerMessage(), - swapId: resp.getId() as SwapId, - swapIdBytes: resp.getIdBytes().toString(), - } - return swapOutResult - } catch (error) { - if (error instanceof Error && error.message.includes("channel balance too low")) { - return new SwapErrorChannelBalanceTooLow(error.message) - } - return new SwapServiceError(error) - } - } - - const swapListener = function (): SwapClientReadableStream< - SwapListenerResponse | SwapServiceError - > { - try { - const request = new MonitorRequest() - const listener = swapClient.monitor(request) - listener.on("data", (data: SwapStatus & SwapStatusResultWrapper) => { - listener.pause() - // parse data to our interface - const state = parseState(data.getState()) - const message = parseMessage(data.getFailureReason()) - const swapType = parseSwapType(data.getType()) - const parsedSwapData: SwapStatusResult = { - id: data.getId(), - amt: BigInt(data.getAmt()), - htlcAddress: data.getHtlcAddress(), - offchainRoutingFee: BigInt(data.getCostOffchain()), - onchainMinerFee: BigInt(data.getCostOnchain()), - serviceProviderFee: BigInt(data.getCostServer()), - state: state, - message, - swapType, - } - data.parsedSwapData = parsedSwapData - listener.resume() - }) - return listener - } catch (error) { - throw new UnknownSwapServiceError(error) - } - } - - const swapOutQuote = async ( - btcAmount: BtcPaymentAmount, - ): Promise => { - try { - const request = new QuoteRequest() - request.setAmt(Number(btcAmount.amount)) - const resp = await clientSwapOutQuote(request) - return { - cltvDelta: resp.getCltvDelta(), - confTarget: resp.getConfTarget(), - htlcSweepFeeSat: { - amount: BigInt(resp.getHtlcSweepFeeSat()), - currency: WalletCurrency.Btc, - }, - prepayAmtSat: { - amount: BigInt(resp.getPrepayAmtSat()), - currency: WalletCurrency.Btc, - }, - swapFeeSat: { - amount: BigInt(resp.getSwapFeeSat()), - currency: WalletCurrency.Btc, - }, - swapPaymentDest: resp.getSwapPaymentDest().toString() as OnChainAddress, - } - } catch (error) { - return new UnknownSwapServiceError(error) - } - } - - const swapOutTerms = async (): Promise => { - try { - const request = new TermsRequest() - const resp = await clientSwapOutTerms(request) - return { - maxCltvDelta: resp.getMaxCltvDelta(), - maxSwapAmount: { - amount: BigInt(resp.getMaxSwapAmount()), - currency: WalletCurrency.Btc, - }, - minCltvDelta: resp.getMinCltvDelta(), - minSwapAmount: { - amount: BigInt(resp.getMinSwapAmount()), - currency: WalletCurrency.Btc, - }, - } - } catch (error) { - return new UnknownSwapServiceError(error) - } - } - - function createClient( - macaroon: Macaroon, - tls: Buffer, - grpcEndpoint: string, - ): ServiceClient { - const grpcOptions = { - "grpc.max_receive_message_length": -1, - "grpc.max_send_message_length": -1, - } - const sslCreds = grpc.credentials.createSsl(tls) - const metadata = new grpc.Metadata() - metadata.add("macaroon", macaroon) - const macaroonCreds = grpc.credentials.createFromMetadataGenerator( - (_args, callback) => { - callback(null, metadata) - }, - ) - const credentials = grpc.credentials.combineChannelCredentials( - sslCreds, - macaroonCreds, - ) - try { - const client: ServiceClient = new SwapClientClient( - grpcEndpoint, - credentials, - grpcOptions, - ) - return client - } catch (err) { - throw new SwapClientNotResponding(err) - } - } - - function parseState(state: number) { - try { - const parsedState = Object.keys(SwapState).find((key: string) => { - // eslint-disable-next-line - // @ts-ignore - return SwapState[key] === state - }) - if (parsedState === "INITIATED") return DomainSwapState.Initiated - if (parsedState === "SUCCESS") return DomainSwapState.Success - if (parsedState === "PREIMAGE_REVEALED") return DomainSwapState.PreimageRevealed - if (parsedState === "HTLC_PUBLISHED") return DomainSwapState.HtlcPublished - if (parsedState === "INVOICE_SETTLED") return DomainSwapState.Initiated - return DomainSwapState.Failed - } catch (e) { - return DomainSwapState.Failed - } - } - - function parseMessage(messageCode: number): string { - try { - const parsedMessage = Object.keys(messageCode).find( - // eslint-disable-next-line - // @ts-ignore - (key: string) => FailureReason[key] === messageCode, - ) - return parsedMessage ?? "" - } catch (e) { - return "" - } - } - - function parseSwapType(swapType: number) { - try { - if (swapType === 0) return DomainSwapType.Swapout - return DomainSwapType.Unknown - } catch (e) { - return DomainSwapType.Unknown - } - } - - return wrapAsyncFunctionsToRunInSpan({ - namespace: "services.swap", - fns: { - healthCheck, - swapOut, - swapListener, - swapOutQuote, - swapOutTerms, - }, - }) -} diff --git a/core/api/src/services/loopd/protos/buf.gen.yaml b/core/api/src/services/loopd/protos/buf.gen.yaml deleted file mode 100644 index c3e934cf3e..0000000000 --- a/core/api/src/services/loopd/protos/buf.gen.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# /protos/buf.gen.yaml -version: v1beta1 - -plugins: - - name: js - out: . - opt: import_style=commonjs,binary - - - name: grpc - out: . - opt: grpc_js - path: grpc_tools_node_protoc_plugin - - - name: ts - out: . - opt: grpc_js - path: protoc-gen-ts - -# buf generate -# tsc ./src/services/swap/providers/lightning-labs/protos/loop_grpc_pb.js --declaration --allowJs --emitDeclarationOnly --outDir types diff --git a/core/api/src/services/loopd/protos/buf.yaml b/core/api/src/services/loopd/protos/buf.yaml deleted file mode 100644 index 8245008e4c..0000000000 --- a/core/api/src/services/loopd/protos/buf.yaml +++ /dev/null @@ -1,11 +0,0 @@ -# /protos/buf.yaml -version: v1beta1 -build: - roots: - - . -lint: - use: - - DEFAULT -breaking: - use: - - WIRE_JSON diff --git a/core/api/src/services/loopd/protos/debug.proto b/core/api/src/services/loopd/protos/debug.proto deleted file mode 100644 index 2313449bb4..0000000000 --- a/core/api/src/services/loopd/protos/debug.proto +++ /dev/null @@ -1,25 +0,0 @@ -syntax = "proto3"; - -package looprpc; - -option go_package = "github.com/lightninglabs/loop/looprpc"; - -/* -Debug is a service that exposes endpoints intended for testing purposes. These -endpoints should not operate on mainnet, and should only be included if loop is -built with the dev build tag. -*/ -service Debug { - /* - ForceAutoLoop is intended for *testing purposes only* and will not work on - mainnet. This endpoint ticks our autoloop timer, triggering automated - dispatch of a swap if one is suggested. - */ - rpc ForceAutoLoop (ForceAutoLoopRequest) returns (ForceAutoLoopResponse); -} - -message ForceAutoLoopRequest { -} - -message ForceAutoLoopResponse { -} diff --git a/core/api/src/services/loopd/protos/debug_grpc_pb.js b/core/api/src/services/loopd/protos/debug_grpc_pb.js deleted file mode 100644 index 0b6652bea7..0000000000 --- a/core/api/src/services/loopd/protos/debug_grpc_pb.js +++ /dev/null @@ -1,52 +0,0 @@ -// GENERATED CODE -- DO NOT EDIT! - -'use strict'; -var grpc = require('@grpc/grpc-js'); -var debug_pb = require('./debug_pb.js'); - -function serialize_looprpc_ForceAutoLoopRequest(arg) { - if (!(arg instanceof debug_pb.ForceAutoLoopRequest)) { - throw new Error('Expected argument of type looprpc.ForceAutoLoopRequest'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_looprpc_ForceAutoLoopRequest(buffer_arg) { - return debug_pb.ForceAutoLoopRequest.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_looprpc_ForceAutoLoopResponse(arg) { - if (!(arg instanceof debug_pb.ForceAutoLoopResponse)) { - throw new Error('Expected argument of type looprpc.ForceAutoLoopResponse'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_looprpc_ForceAutoLoopResponse(buffer_arg) { - return debug_pb.ForceAutoLoopResponse.deserializeBinary(new Uint8Array(buffer_arg)); -} - - -// -// Debug is a service that exposes endpoints intended for testing purposes. These -// endpoints should not operate on mainnet, and should only be included if loop is -// built with the dev build tag. -var DebugService = exports.DebugService = { - // -// ForceAutoLoop is intended for *testing purposes only* and will not work on -// mainnet. This endpoint ticks our autoloop timer, triggering automated -// dispatch of a swap if one is suggested. -forceAutoLoop: { - path: '/looprpc.Debug/ForceAutoLoop', - requestStream: false, - responseStream: false, - requestType: debug_pb.ForceAutoLoopRequest, - responseType: debug_pb.ForceAutoLoopResponse, - requestSerialize: serialize_looprpc_ForceAutoLoopRequest, - requestDeserialize: deserialize_looprpc_ForceAutoLoopRequest, - responseSerialize: serialize_looprpc_ForceAutoLoopResponse, - responseDeserialize: deserialize_looprpc_ForceAutoLoopResponse, - }, -}; - -exports.DebugClient = grpc.makeGenericClientConstructor(DebugService); diff --git a/core/api/src/services/loopd/protos/debug_pb.d.ts b/core/api/src/services/loopd/protos/debug_pb.d.ts deleted file mode 100644 index e3892ed981..0000000000 --- a/core/api/src/services/loopd/protos/debug_pb.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -// package: looprpc -// file: debug.proto - -import * as jspb from "google-protobuf"; - -export class ForceAutoLoopRequest extends jspb.Message { - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): ForceAutoLoopRequest.AsObject; - static toObject(includeInstance: boolean, msg: ForceAutoLoopRequest): ForceAutoLoopRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: ForceAutoLoopRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): ForceAutoLoopRequest; - static deserializeBinaryFromReader(message: ForceAutoLoopRequest, reader: jspb.BinaryReader): ForceAutoLoopRequest; -} - -export namespace ForceAutoLoopRequest { - export type AsObject = { - } -} - -export class ForceAutoLoopResponse extends jspb.Message { - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): ForceAutoLoopResponse.AsObject; - static toObject(includeInstance: boolean, msg: ForceAutoLoopResponse): ForceAutoLoopResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: ForceAutoLoopResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): ForceAutoLoopResponse; - static deserializeBinaryFromReader(message: ForceAutoLoopResponse, reader: jspb.BinaryReader): ForceAutoLoopResponse; -} - -export namespace ForceAutoLoopResponse { - export type AsObject = { - } -} - diff --git a/core/api/src/services/loopd/protos/debug_pb.js b/core/api/src/services/loopd/protos/debug_pb.js deleted file mode 100644 index 93baa66fd0..0000000000 --- a/core/api/src/services/loopd/protos/debug_pb.js +++ /dev/null @@ -1,270 +0,0 @@ -// source: debug.proto -/** - * @fileoverview - * @enhanceable - * @suppress {missingRequire} reports error on implicit type usages. - * @suppress {messageConventions} JS Compiler reports an error if a variable or - * field starts with 'MSG_' and isn't a translatable message. - * @public - */ -// GENERATED CODE -- DO NOT EDIT! -/* eslint-disable */ -// @ts-nocheck - -var jspb = require('google-protobuf'); -var goog = jspb; -var global = (function() { - if (this) { return this; } - if (typeof window !== 'undefined') { return window; } - if (typeof global !== 'undefined') { return global; } - if (typeof self !== 'undefined') { return self; } - return Function('return this')(); -}.call(null)); - -goog.exportSymbol('proto.looprpc.ForceAutoLoopRequest', null, global); -goog.exportSymbol('proto.looprpc.ForceAutoLoopResponse', null, global); -/** - * 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.ForceAutoLoopRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.looprpc.ForceAutoLoopRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.ForceAutoLoopRequest.displayName = 'proto.looprpc.ForceAutoLoopRequest'; -} -/** - * 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.ForceAutoLoopResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.looprpc.ForceAutoLoopResponse, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.ForceAutoLoopResponse.displayName = 'proto.looprpc.ForceAutoLoopResponse'; -} - - - -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.ForceAutoLoopRequest.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.ForceAutoLoopRequest.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.ForceAutoLoopRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.ForceAutoLoopRequest.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.ForceAutoLoopRequest} - */ -proto.looprpc.ForceAutoLoopRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.ForceAutoLoopRequest; - return proto.looprpc.ForceAutoLoopRequest.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.looprpc.ForceAutoLoopRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.ForceAutoLoopRequest} - */ -proto.looprpc.ForceAutoLoopRequest.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.ForceAutoLoopRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.ForceAutoLoopRequest.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.ForceAutoLoopRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.ForceAutoLoopRequest.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.ForceAutoLoopResponse.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.ForceAutoLoopResponse.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.ForceAutoLoopResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.ForceAutoLoopResponse.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.ForceAutoLoopResponse} - */ -proto.looprpc.ForceAutoLoopResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.ForceAutoLoopResponse; - return proto.looprpc.ForceAutoLoopResponse.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.looprpc.ForceAutoLoopResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.ForceAutoLoopResponse} - */ -proto.looprpc.ForceAutoLoopResponse.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.ForceAutoLoopResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.ForceAutoLoopResponse.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.ForceAutoLoopResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.ForceAutoLoopResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; -}; - - -goog.object.extend(exports, proto.looprpc); diff --git a/core/api/src/services/loopd/protos/loop.proto b/core/api/src/services/loopd/protos/loop.proto deleted file mode 100644 index ebb60baf6d..0000000000 --- a/core/api/src/services/loopd/protos/loop.proto +++ /dev/null @@ -1,1036 +0,0 @@ -syntax = "proto3"; - -import "swapserverrpc/common.proto"; - -package looprpc; - -option go_package = "github.com/lightninglabs/loop/looprpc"; - -/* -SwapClient is a service that handles the client side process of onchain/offchain -swaps. The service is designed for a single client. -*/ -service SwapClient { - /* loop: `out` - LoopOut initiates an loop out swap with the given parameters. The call - returns after the swap has been set up with the swap server. From that - point onwards, progress can be tracked via the SwapStatus stream that is - returned from Monitor(). - */ - rpc LoopOut (LoopOutRequest) returns (SwapResponse); - - /* loop: `in` - LoopIn initiates a loop in swap with the given parameters. The call - returns after the swap has been set up with the swap server. From that - point onwards, progress can be tracked via the SwapStatus stream - that is returned from Monitor(). - */ - rpc LoopIn (LoopInRequest) returns (SwapResponse); - - /* loop: `monitor` - Monitor will return a stream of swap updates for currently active swaps. - */ - rpc Monitor (MonitorRequest) returns (stream SwapStatus); - - /* loop: `listswaps` - ListSwaps returns a list of all currently known swaps and their current - status. - */ - rpc ListSwaps (ListSwapsRequest) returns (ListSwapsResponse); - - /* loop: `swapinfo` - SwapInfo returns all known details about a single swap. - */ - rpc SwapInfo (SwapInfoRequest) returns (SwapStatus); - - /* loop: `terms` - LoopOutTerms returns the terms that the server enforces for a loop out swap. - */ - rpc LoopOutTerms (TermsRequest) returns (OutTermsResponse); - - /* loop: `quote` - LoopOutQuote returns a quote for a loop out swap with the provided - parameters. - */ - rpc LoopOutQuote (QuoteRequest) returns (OutQuoteResponse); - - /* loop: `terms` - GetTerms returns the terms that the server enforces for swaps. - */ - rpc GetLoopInTerms (TermsRequest) returns (InTermsResponse); - - /* loop: `quote` - GetQuote returns a quote for a swap with the provided parameters. - */ - rpc GetLoopInQuote (QuoteRequest) returns (InQuoteResponse); - - /* - Probe asks he sever to probe the route to us to have a better upfront - estimate about routing fees when loopin-in. - */ - rpc Probe (ProbeRequest) returns (ProbeResponse); - - /* loop: `listauth` - GetLsatTokens returns all LSAT tokens the daemon ever paid for. - */ - rpc GetLsatTokens (TokensRequest) returns (TokensResponse); - - /* loop: `getparams` - GetLiquidityParams gets the parameters that the daemon's liquidity manager - is currently configured with. This may be nil if nothing is configured. - [EXPERIMENTAL]: endpoint is subject to change. - */ - rpc GetLiquidityParams (GetLiquidityParamsRequest) - returns (LiquidityParameters); - - /* loop: `setparams` - SetLiquidityParams sets a new set of parameters for the daemon's liquidity - manager. Note that the full set of parameters must be provided, because - this call fully overwrites our existing parameters. - [EXPERIMENTAL]: endpoint is subject to change. - */ - rpc SetLiquidityParams (SetLiquidityParamsRequest) - returns (SetLiquidityParamsResponse); - - /* loop: `suggestswaps` - SuggestSwaps returns a list of recommended swaps based on the current - state of your node's channels and it's liquidity manager parameters. - Note that only loop out suggestions are currently supported. - [EXPERIMENTAL]: endpoint is subject to change. - */ - rpc SuggestSwaps (SuggestSwapsRequest) returns (SuggestSwapsResponse); -} - -message LoopOutRequest { - /* - Requested swap amount in sat. This does not include the swap and miner fee. - */ - int64 amt = 1; - - /* - Base58 encoded destination address for the swap. - */ - string dest = 2; - - /* - Maximum off-chain fee in sat that may be paid for swap payment to the - server. This limit is applied during path finding. Typically this value is - taken from the response of the GetQuote call. - */ - int64 max_swap_routing_fee = 3; - - /* - Maximum off-chain fee in sat that may be paid for the prepay to the server. - This limit is applied during path finding. Typically this value is taken - from the response of the GetQuote call. - */ - int64 max_prepay_routing_fee = 4; - - /* - Maximum 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. It includes the prepay amount. - */ - int64 max_swap_fee = 5; - - /* - Maximum amount of the swap fee that may be charged as a prepayment. - */ - int64 max_prepay_amt = 6; - - /* - Maximum in on-chain fees that we are willing to spend. If we want to - sweep the on-chain htlc and the fee estimate turns out higher than this - value, we cancel the swap. If the fee estimate is lower, we publish the - sweep tx. - If the sweep tx is not confirmed, we are forced to ratchet up fees until it - is swept. Possibly even exceeding max_miner_fee if we get close to the htlc - timeout. Because the initial publication revealed the preimage, we have no - other choice. The server may already have pulled the off-chain htlc. Only - when the fee becomes higher than the swap amount, we can only wait for fees - to come down and hope - if we are past the timeout - that the server is not - publishing the revocation. - max_miner_fee is typically taken from the response of the GetQuote call. - */ - int64 max_miner_fee = 7; - - /* - Deprecated, use outgoing_chan_set. The channel to loop out, the channel - to loop out is selected based on the lowest routing fee for the swap - payment to the server. - */ - uint64 loop_out_channel = 8 [deprecated = true]; - - /* - A restriction on the channel set that may be used to loop out. The actual - channel(s) that will be used are selected based on the lowest routing fee - for the swap payment to the server. - */ - repeated uint64 outgoing_chan_set = 11; - - /* - The number of blocks from the on-chain HTLC's confirmation height that it - should be swept within. - */ - int32 sweep_conf_target = 9; - - /* - The number of confirmations that we require for the on chain htlc that will - be published by the server before we reveal the preimage. - */ - int32 htlc_confirmations = 13; - - /* - The latest time (in unix seconds) we allow the server to wait before - publishing the HTLC on chain. Setting this to a larger value will give the - server the opportunity to batch multiple swaps together, and wait for - low-fee periods before publishing the HTLC, potentially resulting in a - lower total swap fee. - */ - uint64 swap_publication_deadline = 10; - - /* - An optional label for this swap. This field is limited to 500 characters - and may not start with the prefix [reserved], which is used to tag labels - produced by the daemon. - */ - string label = 12; - - /* - 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 = 14; -} - -message LoopInRequest { - /* - Requested swap amount in sat. This does not include the swap and miner - fee. - */ - int64 amt = 1; - - /* - Maximum 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 = 2; - - /* - Maximum in on-chain fees that we are willing to spend. If we want to - publish the on-chain htlc and the fee estimate turns out higher than this - value, we cancel the swap. - max_miner_fee is typically taken from the response of the GetQuote call. - */ - int64 max_miner_fee = 3; - - /* - The last hop to use for the loop in swap. If empty, the last hop is selected - based on the lowest routing fee for the swap payment from the server. - */ - bytes last_hop = 4; - - /* - If external_htlc is true, we expect the htlc to be published by an external - actor. - */ - bool external_htlc = 5; - - /* - The number of blocks that the on chain htlc should confirm within. - */ - int32 htlc_conf_target = 6; - - /* - 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 = 7; - - /* - 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 = 8; - - /* - Optional route hints to reach the destination through private channels. - - repeated looprpc.RouteHint route_hints = 9; - */ - - /* - Private indicates whether the destination node should be considered - private. In which case, loop will generate hophints to assist with - probing and payment. - */ - bool private = 10; -} - -message SwapResponse { - /* - Swap identifier to track status in the update stream that is returned from - the Start() call. Currently this is the hash that locks the htlcs. - DEPRECATED: To make the API more consistent, this field is deprecated in - favor of id_bytes and will be removed in a future release. - */ - string id = 1 [deprecated = true]; - - /* - Swap identifier to track status in the update stream that is returned from - the Start() call. Currently this is the hash that locks the htlcs. - */ - bytes id_bytes = 3; - - /* - DEPRECATED. This field stores the address of the onchain htlc, but - depending on the request, the semantics are different. - - For internal loop-in htlc_address contains the address of the - native segwit (P2WSH) htlc. - - For external loop-in htlc_address contains the address of the - nested segwit (NP2WSH) htlc. - - For loop-out htlc_address always contains the native segwit (P2WSH) - htlc address. - */ - string htlc_address = 2 [deprecated = true]; - - /* - The nested segwit address of the on-chain htlc. - This field remains empty for loop-out. - */ - string htlc_address_np2wsh = 4; - - /* - The native segwit address of the on-chain htlc. - Used for both loop-in and loop-out. - */ - string htlc_address_p2wsh = 5; - - // A human-readable message received from the loop server. - string server_message = 6; -} - -message MonitorRequest { -} - -message SwapStatus { - /* - Requested swap amount in sat. This does not include the swap and miner - fee. - */ - int64 amt = 1; - - /* - Swap identifier to track status in the update stream that is returned from - the Start() call. Currently this is the hash that locks the htlcs. - DEPRECATED: To make the API more consistent, this field is deprecated in - favor of id_bytes and will be removed in a future release. - */ - string id = 2 [deprecated = true]; - - /* - Swap identifier to track status in the update stream that is returned from - the Start() call. Currently this is the hash that locks the htlcs. - */ - bytes id_bytes = 11; - - /* - The type of the swap. - */ - SwapType type = 3; - - /* - State the swap is currently in, see State enum. - */ - SwapState state = 4; - - /* - A failure reason for the swap, only set if the swap has failed. - */ - FailureReason failure_reason = 14; - - /* - Initiation time of the swap. - */ - int64 initiation_time = 5; - - /* - Initiation time of the swap. - */ - int64 last_update_time = 6; - - /* - DEPRECATED: This field stores the address of the onchain htlc. - - For internal loop-in htlc_address contains the address of the - native segwit (P2WSH) htlc. - - For external loop-in htlc_address contains the nested segwit (NP2WSH) - address. - - For loop-out htlc_address always contains the native segwit (P2WSH) - htlc address. - */ - string htlc_address = 7 [deprecated = true]; - - // HTLC address (native segwit), used in loop-in and loop-out swaps. - string htlc_address_p2wsh = 12; - - // HTLC address (nested segwit), used in loop-in swaps only. - string htlc_address_np2wsh = 13; - - // Swap server cost - int64 cost_server = 8; - - // On-chain transaction cost - int64 cost_onchain = 9; - - // Off-chain routing fees - int64 cost_offchain = 10; - - // Optional last hop if provided in the loop in request. - bytes last_hop = 16; - - // Optional outgoing channel set if provided in the loop out request. - repeated uint64 outgoing_chan_set = 17; - - // An optional label given to the swap on creation. - string label = 15; -} - -enum SwapType { - // LOOP_OUT indicates an loop out swap (off-chain to on-chain) - LOOP_OUT = 0; - - // LOOP_IN indicates a loop in swap (on-chain to off-chain) - LOOP_IN = 1; -} - -enum SwapState { - /* - INITIATED is the initial state of a swap. At that point, the initiation - call to the server has been made and the payment process has been started - for the swap and prepayment invoices. - */ - INITIATED = 0; - - /* - PREIMAGE_REVEALED is reached when the sweep tx publication is first - attempted. From that point on, we should consider the preimage to no - longer be secret and we need to do all we can to get the sweep confirmed. - This state will mostly coalesce with StateHtlcConfirmed, except in the - case where we wait for fees to come down before we sweep. - */ - PREIMAGE_REVEALED = 1; - - /* - HTLC_PUBLISHED is reached when the htlc tx has been published in a loop in - swap. - */ - HTLC_PUBLISHED = 2; - - /* - SUCCESS is the final swap state that is reached when the sweep tx has - the required confirmation depth. - */ - SUCCESS = 3; - - /* - FAILED is the final swap state for a failed swap with or without loss of - the swap amount. - */ - FAILED = 4; - - /* - INVOICE_SETTLED is reached when the swap invoice in a loop in swap has been - paid, but we are still waiting for the htlc spend to confirm. - */ - INVOICE_SETTLED = 5; -} - -enum FailureReason { - /* - FAILURE_REASON_NONE is set when the swap did not fail, it is either in - progress or succeeded. - */ - FAILURE_REASON_NONE = 0; - - /* - FAILURE_REASON_OFFCHAIN indicates that a loop out failed because it wasn't - possible to find a route for one or both off chain payments that met the fee - and timelock limits required. - */ - FAILURE_REASON_OFFCHAIN = 1; - - /* - FAILURE_REASON_TIMEOUT indicates that the swap failed because on chain htlc - did not confirm before its expiry, or it confirmed too late for us to reveal - our preimage and claim. - */ - FAILURE_REASON_TIMEOUT = 2; - - /* - FAILURE_REASON_SWEEP_TIMEOUT indicates that a loop out permanently failed - because the on chain htlc wasn't swept before the server revoked the - htlc. - */ - FAILURE_REASON_SWEEP_TIMEOUT = 3; - - /* - FAILURE_REASON_INSUFFICIENT_VALUE indicates that a loop out has failed - because the on chain htlc had a lower value than requested. - */ - FAILURE_REASON_INSUFFICIENT_VALUE = 4; - - /* - FAILURE_REASON_TEMPORARY indicates that a swap cannot continue due to an - internal error. Manual intervention such as a restart is required. - */ - FAILURE_REASON_TEMPORARY = 5; - - /* - FAILURE_REASON_INCORRECT_AMOUNT indicates that a loop in permanently failed - because the amount extended by an external loop in htlc is insufficient. - */ - FAILURE_REASON_INCORRECT_AMOUNT = 6; -} - -message ListSwapsRequest { -} - -message ListSwapsResponse { - /* - The list of all currently known swaps and their status. - */ - repeated SwapStatus swaps = 1; -} - -message SwapInfoRequest { - /* - The swap identifier which currently is the hash that locks the HTLCs. When - using REST, this field must be encoded as URL safe base64. - */ - bytes id = 1; -} - -message TermsRequest { -} - -message InTermsResponse { - reserved 1, 2, 3, 4, 7; - - /* - Minimum swap amount (sat) - */ - int64 min_swap_amount = 5; - - /* - Maximum swap amount (sat) - */ - int64 max_swap_amount = 6; -} - -message OutTermsResponse { - reserved 1, 2, 3, 4, 7; - - /* - Minimum swap amount (sat) - */ - int64 min_swap_amount = 5; - - /* - Maximum swap amount (sat) - */ - int64 max_swap_amount = 6; - - // The minimally accepted cltv delta of the on-chain htlc. - int32 min_cltv_delta = 8; - - // The maximally accepted cltv delta of the on-chain htlc. - int32 max_cltv_delta = 9; -} - -message QuoteRequest { - /* - The amount to swap in satoshis. - */ - int64 amt = 1; - - /* - The confirmation target that should be used either for the sweep of the - on-chain HTLC broadcast by the swap server in the case of a Loop Out, or for - the confirmation of the on-chain HTLC broadcast by the swap client in the - case of a Loop In. - */ - int32 conf_target = 2; - - /* - If external_htlc is true, we expect the htlc to be published by an external - actor. - */ - bool external_htlc = 3; - - /* - The latest time (in unix seconds) we allow the server to wait before - publishing the HTLC on chain. Setting this to a larger value will give the - server the opportunity to batch multiple swaps together, and wait for - low-fee periods before publishing the HTLC, potentially resulting in a - lower total swap fee. This only has an effect on loop out quotes. - */ - uint64 swap_publication_deadline = 4; - - /* - 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 loop_in_last_hop = 5; - - /* - Optional route hints to reach the destination through private channels. - - repeated looprpc.RouteHint loop_in_route_hints = 6; - */ - - /* - Private indicates whether the destination node should be considered - private. In which case, loop will generate hophints to assist with - probing and payment. - */ - bool private = 7; -} - -message InQuoteResponse { - reserved 2, 4; - - /* - The fee that the swap server is charging for the swap. - */ - int64 swap_fee_sat = 1; - - /* - An estimate of the on-chain fee that needs to be paid to publish the HTLC - If a miner fee of 0 is returned, it means the external_htlc flag was set for - a loop in and the fee estimation was skipped. If a miner fee of -1 is - returned, it means lnd's wallet tried to estimate the fee but was unable to - create a sample estimation transaction because not enough funds are - available. An information message should be shown to the user in this case. - */ - int64 htlc_publish_fee_sat = 3; - - /* - On-chain cltv expiry delta - */ - int32 cltv_delta = 5; - - /* - The confirmation target to be used to publish the on-chain HTLC. - */ - int32 conf_target = 6; -} - -message OutQuoteResponse { - /* - The fee that the swap server is charging for the swap. - */ - int64 swap_fee_sat = 1; - - /* - The part of the swap fee that is requested as a prepayment. - */ - int64 prepay_amt_sat = 2; - - /* - An estimate of the on-chain fee that needs to be paid to sweep the HTLC for - a loop out. - */ - int64 htlc_sweep_fee_sat = 3; - - /* - The node pubkey where the swap payment needs to be paid - to. This can be used to test connectivity before initiating the swap. - */ - bytes swap_payment_dest = 4; - - /* - On-chain cltv expiry delta - */ - int32 cltv_delta = 5; - - /* - The confirmation target to be used for the sweep of the on-chain HTLC. - */ - int32 conf_target = 6; -} - -message ProbeRequest { - /* - The amount to probe. - */ - int64 amt = 1; - - /* - Optional last hop of the route to probe. - */ - bytes last_hop = 2; - - /* - Optional route hints to reach the destination through private channels. - - repeated looprpc.RouteHint route_hints = 3; - */ -} - -message ProbeResponse { -} - -message TokensRequest { -} - -message TokensResponse { - /* - List of all tokens the daemon knows of, including old/expired tokens. - */ - repeated LsatToken tokens = 1; -} - -message LsatToken { - /* - The base macaroon that was baked by the auth server. - */ - bytes base_macaroon = 1; - - /* - The payment hash of the payment that was paid to obtain the token. - */ - bytes payment_hash = 2; - - /* - The preimage of the payment hash, knowledge of this is proof that the - payment has been paid. If the preimage is set to all zeros, this means the - payment is still pending and the token is not yet fully valid. - */ - bytes payment_preimage = 3; - - /* - The amount of millisatoshis that was paid to get the token. - */ - int64 amount_paid_msat = 4; - - /* - The amount of millisatoshis paid in routing fee to pay for the token. - */ - int64 routing_fee_paid_msat = 5; - - /* - The creation time of the token as UNIX timestamp in seconds. - */ - int64 time_created = 6; - - /* - Indicates whether the token is expired or still valid. - */ - bool expired = 7; - - /* - Identifying attribute of this token in the store. Currently represents the - file name of the token where it's stored on the file system. - */ - string storage_name = 8; -} - -message GetLiquidityParamsRequest { -} - -message LiquidityParameters { - /* - A set of liquidity rules that describe the desired liquidity balance. - */ - repeated LiquidityRule rules = 1; - - /* - The parts per million of swap amount that is allowed to be allocated to swap - fees. This value is applied across swap categories and may not be set in - conjunction with sweep fee rate, swap fee ppm, routing fee ppm, prepay - routing, max prepay and max miner fee. - */ - uint64 fee_ppm = 16; - - /* - The limit we place on our estimated sweep cost for a swap in sat/vByte. If - the estimated fee for our sweep transaction within the specified - confirmation target is above this value, we will not suggest any swaps. - */ - uint64 sweep_fee_rate_sat_per_vbyte = 2; - - /* - The maximum fee paid to the server for facilitating the swap, expressed - as parts per million of the swap volume. - */ - uint64 max_swap_fee_ppm = 3; - - /* - The maximum fee paid to route the swap invoice off chain, expressed as - parts per million of the volume being routed. - */ - uint64 max_routing_fee_ppm = 4; - - /* - The maximum fee paid to route the prepay invoice off chain, expressed as - parts per million of the volume being routed. - */ - uint64 max_prepay_routing_fee_ppm = 5; - - /* - The maximum no-show penalty in satoshis paid for a swap. - */ - uint64 max_prepay_sat = 6; - - /* - The maximum miner fee we will pay to sweep the swap on chain. Note that we - will not suggest a swap if the estimate is above the sweep limit set by - these parameters, and we use the current fee estimate to sweep on chain so - this value is only a cap placed on the amount we spend on fees in the case - where the swap needs to be claimed on chain, but fees have suddenly spiked. - */ - uint64 max_miner_fee_sat = 7; - - /* - The number of blocks from the on-chain HTLC's confirmation height that it - should be swept within. - */ - int32 sweep_conf_target = 8; - - /* - The amount of time we require pass since a channel was part of a failed - swap due to off chain payment failure until it will be considered for swap - suggestions again, expressed in seconds. - */ - uint64 failure_backoff_sec = 9; - - /* - Set to true to enable automatic dispatch of swaps. All swaps will be limited - to the fee categories set by these parameters, and total expenditure will - be limited to the autoloop budget. - */ - bool autoloop = 10; - - /* - The total budget for automatically dispatched swaps since the budget start - time, expressed in satoshis. - */ - uint64 autoloop_budget_sat = 11; - - /* - The start time for autoloop budget, expressed as a unix timestamp in - seconds. If this value is 0, the budget will be applied for all - automatically dispatched swaps. Swaps that were completed before this date - will not be included in budget calculations. - */ - uint64 autoloop_budget_start_sec = 12; - - /* - The maximum number of automatically dispatched swaps that we allow to be in - flight at any point in time. - */ - uint64 auto_max_in_flight = 13; - - /* - The minimum amount, expressed in satoshis, that the autoloop client will - dispatch a swap for. This value is subject to the server-side limits - specified by the LoopOutTerms endpoint. - */ - uint64 min_swap_amount = 14; - - /* - The maximum amount, expressed in satoshis, that the autoloop client will - dispatch a swap for. This value is subject to the server-side limits - specified by the LoopOutTerms endpoint. - */ - uint64 max_swap_amount = 15; - - /* - The confirmation target for loop in on-chain htlcs. - */ - int32 htlc_conf_target = 17; -} - -enum LiquidityRuleType { - UNKNOWN = 0; - THRESHOLD = 1; -} - -message LiquidityRule { - /* - The short channel ID of the channel that this rule should be applied to. - This field may not be set when the pubkey field is set. - */ - uint64 channel_id = 1; - - // The type of swap that will be dispatched for this rule. - SwapType swap_type = 6; - - /* - The public key of the peer that this rule should be applied to. This field - may not be set when the channel id field is set. - */ - bytes pubkey = 5; - - /* - Type indicates the type of rule that this message rule represents. Setting - this value will determine which fields are used in the message. The comments - on each field in this message will be prefixed with the LiquidityRuleType - they belong to. - */ - LiquidityRuleType type = 2; - - /* - THRESHOLD: The percentage of total capacity that incoming capacity should - not drop beneath. - */ - uint32 incoming_threshold = 3; - - /* - THRESHOLD: The percentage of total capacity that outgoing capacity should - not drop beneath. - */ - uint32 outgoing_threshold = 4; -} - -message SetLiquidityParamsRequest { - /* - Parameters is the desired new set of parameters for the liquidity management - subsystem. Note that the current set of parameters will be completely - overwritten by the parameters provided (if they are valid), so the full set - of parameters should be provided for each call. - */ - LiquidityParameters parameters = 1; -} - -message SetLiquidityParamsResponse { -} - -message SuggestSwapsRequest { -} - -enum AutoReason { - AUTO_REASON_UNKNOWN = 0; - - /* - Budget not started indicates that we do not recommend any swaps because - the start time for our budget has not arrived yet. - */ - AUTO_REASON_BUDGET_NOT_STARTED = 1; - - /* - Sweep fees indicates that the estimated fees to sweep swaps are too high - right now. - */ - AUTO_REASON_SWEEP_FEES = 2; - - /* - Budget elapsed indicates that the autoloop budget for the period has been - elapsed. - */ - AUTO_REASON_BUDGET_ELAPSED = 3; - - /* - In flight indicates that the limit on in-flight automatically dispatched - swaps has already been reached. - */ - AUTO_REASON_IN_FLIGHT = 4; - - /* - Swap fee indicates that the server fee for a specific swap is too high. - */ - AUTO_REASON_SWAP_FEE = 5; - - /* - Miner fee indicates that the miner fee for a specific swap is to high. - */ - AUTO_REASON_MINER_FEE = 6; - - /* - Prepay indicates that the prepay fee for a specific swap is too high. - */ - AUTO_REASON_PREPAY = 7; - - /* - Failure backoff indicates that a swap has recently failed for this target, - and the backoff period has not yet passed. - */ - AUTO_REASON_FAILURE_BACKOFF = 8; - - /* - Loop out indicates that a loop out swap is currently utilizing the channel, - so it is not eligible. - */ - AUTO_REASON_LOOP_OUT = 9; - - /* - Loop In indicates that a loop in swap is currently in flight for the peer, - so it is not eligible. - */ - AUTO_REASON_LOOP_IN = 10; - - /* - Liquidity ok indicates that a target meets the liquidity balance expressed - in its rule, so no swap is needed. - */ - AUTO_REASON_LIQUIDITY_OK = 11; - - /* - Budget insufficient indicates that we cannot perform a swap because we do - not have enough pending budget available. This differs from budget elapsed, - because we still have some budget available, but we have allocated it to - other swaps. - */ - AUTO_REASON_BUDGET_INSUFFICIENT = 12; - - /* - Fee insufficient indicates that the fee estimate for a swap is higher than - the portion of total swap amount that we allow fees to consume. - */ - AUTO_REASON_FEE_INSUFFICIENT = 13; -} - -message Disqualified { - /* - The short channel ID of the channel that was excluded from our suggestions. - */ - uint64 channel_id = 1; - - /* - The public key of the peer that was excluded from our suggestions. - */ - bytes pubkey = 3; - - /* - The reason that we excluded the channel from the our suggestions. - */ - AutoReason reason = 2; -} - -message SuggestSwapsResponse { - /* - The set of recommended loop outs. - */ - repeated LoopOutRequest loop_out = 1; - - /* - The set of recommended loop in swaps - */ - repeated LoopInRequest loop_in = 3; - - /* - Disqualified contains the set of channels that swaps are not recommended - for. - */ - repeated Disqualified disqualified = 2; -} diff --git a/core/api/src/services/loopd/protos/loop_grpc_pb.d.ts b/core/api/src/services/loopd/protos/loop_grpc_pb.d.ts deleted file mode 100644 index cb0ba9dab2..0000000000 --- a/core/api/src/services/loopd/protos/loop_grpc_pb.d.ts +++ /dev/null @@ -1,273 +0,0 @@ -export namespace SwapClientService { - namespace loopOut { - export const path: string; - export const requestStream: boolean; - export const responseStream: boolean; - export const requestType: typeof loop_pb.LoopOutRequest; - export const responseType: typeof loop_pb.SwapResponse; - export { serialize_looprpc_LoopOutRequest as requestSerialize }; - export { deserialize_looprpc_LoopOutRequest as requestDeserialize }; - export { serialize_looprpc_SwapResponse as responseSerialize }; - export { deserialize_looprpc_SwapResponse as responseDeserialize }; - } - namespace loopIn { - const path_1: string; - export { path_1 as path }; - const requestStream_1: boolean; - export { requestStream_1 as requestStream }; - const responseStream_1: boolean; - export { responseStream_1 as responseStream }; - const requestType_1: typeof loop_pb.LoopInRequest; - export { requestType_1 as requestType }; - const responseType_1: typeof loop_pb.SwapResponse; - export { responseType_1 as responseType }; - export { serialize_looprpc_LoopInRequest as requestSerialize }; - export { deserialize_looprpc_LoopInRequest as requestDeserialize }; - export { serialize_looprpc_SwapResponse as responseSerialize }; - export { deserialize_looprpc_SwapResponse as responseDeserialize }; - } - namespace monitor { - const path_2: string; - export { path_2 as path }; - const requestStream_2: boolean; - export { requestStream_2 as requestStream }; - const responseStream_2: boolean; - export { responseStream_2 as responseStream }; - const requestType_2: typeof loop_pb.MonitorRequest; - export { requestType_2 as requestType }; - const responseType_2: typeof loop_pb.SwapStatus; - export { responseType_2 as responseType }; - export { serialize_looprpc_MonitorRequest as requestSerialize }; - export { deserialize_looprpc_MonitorRequest as requestDeserialize }; - export { serialize_looprpc_SwapStatus as responseSerialize }; - export { deserialize_looprpc_SwapStatus as responseDeserialize }; - } - namespace listSwaps { - const path_3: string; - export { path_3 as path }; - const requestStream_3: boolean; - export { requestStream_3 as requestStream }; - const responseStream_3: boolean; - export { responseStream_3 as responseStream }; - const requestType_3: typeof loop_pb.ListSwapsRequest; - export { requestType_3 as requestType }; - const responseType_3: typeof loop_pb.ListSwapsResponse; - export { responseType_3 as responseType }; - export { serialize_looprpc_ListSwapsRequest as requestSerialize }; - export { deserialize_looprpc_ListSwapsRequest as requestDeserialize }; - export { serialize_looprpc_ListSwapsResponse as responseSerialize }; - export { deserialize_looprpc_ListSwapsResponse as responseDeserialize }; - } - namespace swapInfo { - const path_4: string; - export { path_4 as path }; - const requestStream_4: boolean; - export { requestStream_4 as requestStream }; - const responseStream_4: boolean; - export { responseStream_4 as responseStream }; - const requestType_4: typeof loop_pb.SwapInfoRequest; - export { requestType_4 as requestType }; - const responseType_4: typeof loop_pb.SwapStatus; - export { responseType_4 as responseType }; - export { serialize_looprpc_SwapInfoRequest as requestSerialize }; - export { deserialize_looprpc_SwapInfoRequest as requestDeserialize }; - export { serialize_looprpc_SwapStatus as responseSerialize }; - export { deserialize_looprpc_SwapStatus as responseDeserialize }; - } - namespace loopOutTerms { - const path_5: string; - export { path_5 as path }; - const requestStream_5: boolean; - export { requestStream_5 as requestStream }; - const responseStream_5: boolean; - export { responseStream_5 as responseStream }; - const requestType_5: typeof loop_pb.TermsRequest; - export { requestType_5 as requestType }; - const responseType_5: typeof loop_pb.OutTermsResponse; - export { responseType_5 as responseType }; - export { serialize_looprpc_TermsRequest as requestSerialize }; - export { deserialize_looprpc_TermsRequest as requestDeserialize }; - export { serialize_looprpc_OutTermsResponse as responseSerialize }; - export { deserialize_looprpc_OutTermsResponse as responseDeserialize }; - } - namespace loopOutQuote { - const path_6: string; - export { path_6 as path }; - const requestStream_6: boolean; - export { requestStream_6 as requestStream }; - const responseStream_6: boolean; - export { responseStream_6 as responseStream }; - const requestType_6: typeof loop_pb.QuoteRequest; - export { requestType_6 as requestType }; - const responseType_6: typeof loop_pb.OutQuoteResponse; - export { responseType_6 as responseType }; - export { serialize_looprpc_QuoteRequest as requestSerialize }; - export { deserialize_looprpc_QuoteRequest as requestDeserialize }; - export { serialize_looprpc_OutQuoteResponse as responseSerialize }; - export { deserialize_looprpc_OutQuoteResponse as responseDeserialize }; - } - namespace getLoopInTerms { - const path_7: string; - export { path_7 as path }; - const requestStream_7: boolean; - export { requestStream_7 as requestStream }; - const responseStream_7: boolean; - export { responseStream_7 as responseStream }; - const requestType_7: typeof loop_pb.TermsRequest; - export { requestType_7 as requestType }; - const responseType_7: typeof loop_pb.InTermsResponse; - export { responseType_7 as responseType }; - export { serialize_looprpc_TermsRequest as requestSerialize }; - export { deserialize_looprpc_TermsRequest as requestDeserialize }; - export { serialize_looprpc_InTermsResponse as responseSerialize }; - export { deserialize_looprpc_InTermsResponse as responseDeserialize }; - } - namespace getLoopInQuote { - const path_8: string; - export { path_8 as path }; - const requestStream_8: boolean; - export { requestStream_8 as requestStream }; - const responseStream_8: boolean; - export { responseStream_8 as responseStream }; - const requestType_8: typeof loop_pb.QuoteRequest; - export { requestType_8 as requestType }; - const responseType_8: typeof loop_pb.InQuoteResponse; - export { responseType_8 as responseType }; - export { serialize_looprpc_QuoteRequest as requestSerialize }; - export { deserialize_looprpc_QuoteRequest as requestDeserialize }; - export { serialize_looprpc_InQuoteResponse as responseSerialize }; - export { deserialize_looprpc_InQuoteResponse as responseDeserialize }; - } - namespace probe { - const path_9: string; - export { path_9 as path }; - const requestStream_9: boolean; - export { requestStream_9 as requestStream }; - const responseStream_9: boolean; - export { responseStream_9 as responseStream }; - const requestType_9: typeof loop_pb.ProbeRequest; - export { requestType_9 as requestType }; - const responseType_9: typeof loop_pb.ProbeResponse; - export { responseType_9 as responseType }; - export { serialize_looprpc_ProbeRequest as requestSerialize }; - export { deserialize_looprpc_ProbeRequest as requestDeserialize }; - export { serialize_looprpc_ProbeResponse as responseSerialize }; - export { deserialize_looprpc_ProbeResponse as responseDeserialize }; - } - namespace getLsatTokens { - const path_10: string; - export { path_10 as path }; - const requestStream_10: boolean; - export { requestStream_10 as requestStream }; - const responseStream_10: boolean; - export { responseStream_10 as responseStream }; - const requestType_10: typeof loop_pb.TokensRequest; - export { requestType_10 as requestType }; - const responseType_10: typeof loop_pb.TokensResponse; - export { responseType_10 as responseType }; - export { serialize_looprpc_TokensRequest as requestSerialize }; - export { deserialize_looprpc_TokensRequest as requestDeserialize }; - export { serialize_looprpc_TokensResponse as responseSerialize }; - export { deserialize_looprpc_TokensResponse as responseDeserialize }; - } - namespace getLiquidityParams { - const path_11: string; - export { path_11 as path }; - const requestStream_11: boolean; - export { requestStream_11 as requestStream }; - const responseStream_11: boolean; - export { responseStream_11 as responseStream }; - const requestType_11: typeof loop_pb.GetLiquidityParamsRequest; - export { requestType_11 as requestType }; - const responseType_11: typeof loop_pb.LiquidityParameters; - export { responseType_11 as responseType }; - export { serialize_looprpc_GetLiquidityParamsRequest as requestSerialize }; - export { deserialize_looprpc_GetLiquidityParamsRequest as requestDeserialize }; - export { serialize_looprpc_LiquidityParameters as responseSerialize }; - export { deserialize_looprpc_LiquidityParameters as responseDeserialize }; - } - namespace setLiquidityParams { - const path_12: string; - export { path_12 as path }; - const requestStream_12: boolean; - export { requestStream_12 as requestStream }; - const responseStream_12: boolean; - export { responseStream_12 as responseStream }; - const requestType_12: typeof loop_pb.SetLiquidityParamsRequest; - export { requestType_12 as requestType }; - const responseType_12: typeof loop_pb.SetLiquidityParamsResponse; - export { responseType_12 as responseType }; - export { serialize_looprpc_SetLiquidityParamsRequest as requestSerialize }; - export { deserialize_looprpc_SetLiquidityParamsRequest as requestDeserialize }; - export { serialize_looprpc_SetLiquidityParamsResponse as responseSerialize }; - export { deserialize_looprpc_SetLiquidityParamsResponse as responseDeserialize }; - } - namespace suggestSwaps { - const path_13: string; - export { path_13 as path }; - const requestStream_13: boolean; - export { requestStream_13 as requestStream }; - const responseStream_13: boolean; - export { responseStream_13 as responseStream }; - const requestType_13: typeof loop_pb.SuggestSwapsRequest; - export { requestType_13 as requestType }; - const responseType_13: typeof loop_pb.SuggestSwapsResponse; - export { responseType_13 as responseType }; - export { serialize_looprpc_SuggestSwapsRequest as requestSerialize }; - export { deserialize_looprpc_SuggestSwapsRequest as requestDeserialize }; - export { serialize_looprpc_SuggestSwapsResponse as responseSerialize }; - export { deserialize_looprpc_SuggestSwapsResponse as responseDeserialize }; - } -} -export var SwapClientClient: grpc.ServiceClientConstructor; -import loop_pb = require("./loop_pb.js"); -declare function serialize_looprpc_LoopOutRequest(arg: any): Buffer; -declare function deserialize_looprpc_LoopOutRequest(buffer_arg: any): loop_pb.LoopOutRequest; -declare function serialize_looprpc_SwapResponse(arg: any): Buffer; -declare function deserialize_looprpc_SwapResponse(buffer_arg: any): loop_pb.SwapResponse; -declare function serialize_looprpc_LoopInRequest(arg: any): Buffer; -declare function deserialize_looprpc_LoopInRequest(buffer_arg: any): loop_pb.LoopInRequest; -declare function serialize_looprpc_MonitorRequest(arg: any): Buffer; -declare function deserialize_looprpc_MonitorRequest(buffer_arg: any): loop_pb.MonitorRequest; -declare function serialize_looprpc_SwapStatus(arg: any): Buffer; -declare function deserialize_looprpc_SwapStatus(buffer_arg: any): loop_pb.SwapStatus; -declare function serialize_looprpc_ListSwapsRequest(arg: any): Buffer; -declare function deserialize_looprpc_ListSwapsRequest(buffer_arg: any): loop_pb.ListSwapsRequest; -declare function serialize_looprpc_ListSwapsResponse(arg: any): Buffer; -declare function deserialize_looprpc_ListSwapsResponse(buffer_arg: any): loop_pb.ListSwapsResponse; -declare function serialize_looprpc_SwapInfoRequest(arg: any): Buffer; -declare function deserialize_looprpc_SwapInfoRequest(buffer_arg: any): loop_pb.SwapInfoRequest; -declare function serialize_looprpc_TermsRequest(arg: any): Buffer; -declare function deserialize_looprpc_TermsRequest(buffer_arg: any): loop_pb.TermsRequest; -declare function serialize_looprpc_OutTermsResponse(arg: any): Buffer; -declare function deserialize_looprpc_OutTermsResponse(buffer_arg: any): loop_pb.OutTermsResponse; -declare function serialize_looprpc_QuoteRequest(arg: any): Buffer; -declare function deserialize_looprpc_QuoteRequest(buffer_arg: any): loop_pb.QuoteRequest; -declare function serialize_looprpc_OutQuoteResponse(arg: any): Buffer; -declare function deserialize_looprpc_OutQuoteResponse(buffer_arg: any): loop_pb.OutQuoteResponse; -declare function serialize_looprpc_InTermsResponse(arg: any): Buffer; -declare function deserialize_looprpc_InTermsResponse(buffer_arg: any): loop_pb.InTermsResponse; -declare function serialize_looprpc_InQuoteResponse(arg: any): Buffer; -declare function deserialize_looprpc_InQuoteResponse(buffer_arg: any): loop_pb.InQuoteResponse; -declare function serialize_looprpc_ProbeRequest(arg: any): Buffer; -declare function deserialize_looprpc_ProbeRequest(buffer_arg: any): loop_pb.ProbeRequest; -declare function serialize_looprpc_ProbeResponse(arg: any): Buffer; -declare function deserialize_looprpc_ProbeResponse(buffer_arg: any): loop_pb.ProbeResponse; -declare function serialize_looprpc_TokensRequest(arg: any): Buffer; -declare function deserialize_looprpc_TokensRequest(buffer_arg: any): loop_pb.TokensRequest; -declare function serialize_looprpc_TokensResponse(arg: any): Buffer; -declare function deserialize_looprpc_TokensResponse(buffer_arg: any): loop_pb.TokensResponse; -declare function serialize_looprpc_GetLiquidityParamsRequest(arg: any): Buffer; -declare function deserialize_looprpc_GetLiquidityParamsRequest(buffer_arg: any): loop_pb.GetLiquidityParamsRequest; -declare function serialize_looprpc_LiquidityParameters(arg: any): Buffer; -declare function deserialize_looprpc_LiquidityParameters(buffer_arg: any): loop_pb.LiquidityParameters; -declare function serialize_looprpc_SetLiquidityParamsRequest(arg: any): Buffer; -declare function deserialize_looprpc_SetLiquidityParamsRequest(buffer_arg: any): loop_pb.SetLiquidityParamsRequest; -declare function serialize_looprpc_SetLiquidityParamsResponse(arg: any): Buffer; -declare function deserialize_looprpc_SetLiquidityParamsResponse(buffer_arg: any): loop_pb.SetLiquidityParamsResponse; -declare function serialize_looprpc_SuggestSwapsRequest(arg: any): Buffer; -declare function deserialize_looprpc_SuggestSwapsRequest(buffer_arg: any): loop_pb.SuggestSwapsRequest; -declare function serialize_looprpc_SuggestSwapsResponse(arg: any): Buffer; -declare function deserialize_looprpc_SuggestSwapsResponse(buffer_arg: any): loop_pb.SuggestSwapsResponse; -import grpc = require("@grpc/grpc-js"); -export {}; diff --git a/core/api/src/services/loopd/protos/loop_grpc_pb.js b/core/api/src/services/loopd/protos/loop_grpc_pb.js deleted file mode 100644 index 5261c719bd..0000000000 --- a/core/api/src/services/loopd/protos/loop_grpc_pb.js +++ /dev/null @@ -1,478 +0,0 @@ -// GENERATED CODE -- DO NOT EDIT! - -'use strict'; -var grpc = require('@grpc/grpc-js'); -var loop_pb = require('./loop_pb.js'); -var swapserverrpc_common_pb = require('./swapserverrpc/common_pb.js'); - -function serialize_looprpc_GetLiquidityParamsRequest(arg) { - if (!(arg instanceof loop_pb.GetLiquidityParamsRequest)) { - throw new Error('Expected argument of type looprpc.GetLiquidityParamsRequest'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_looprpc_GetLiquidityParamsRequest(buffer_arg) { - return loop_pb.GetLiquidityParamsRequest.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_looprpc_InQuoteResponse(arg) { - if (!(arg instanceof loop_pb.InQuoteResponse)) { - throw new Error('Expected argument of type looprpc.InQuoteResponse'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_looprpc_InQuoteResponse(buffer_arg) { - return loop_pb.InQuoteResponse.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_looprpc_InTermsResponse(arg) { - if (!(arg instanceof loop_pb.InTermsResponse)) { - throw new Error('Expected argument of type looprpc.InTermsResponse'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_looprpc_InTermsResponse(buffer_arg) { - return loop_pb.InTermsResponse.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_looprpc_LiquidityParameters(arg) { - if (!(arg instanceof loop_pb.LiquidityParameters)) { - throw new Error('Expected argument of type looprpc.LiquidityParameters'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_looprpc_LiquidityParameters(buffer_arg) { - return loop_pb.LiquidityParameters.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_looprpc_ListSwapsRequest(arg) { - if (!(arg instanceof loop_pb.ListSwapsRequest)) { - throw new Error('Expected argument of type looprpc.ListSwapsRequest'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_looprpc_ListSwapsRequest(buffer_arg) { - return loop_pb.ListSwapsRequest.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_looprpc_ListSwapsResponse(arg) { - if (!(arg instanceof loop_pb.ListSwapsResponse)) { - throw new Error('Expected argument of type looprpc.ListSwapsResponse'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_looprpc_ListSwapsResponse(buffer_arg) { - return loop_pb.ListSwapsResponse.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_looprpc_LoopInRequest(arg) { - if (!(arg instanceof loop_pb.LoopInRequest)) { - throw new Error('Expected argument of type looprpc.LoopInRequest'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_looprpc_LoopInRequest(buffer_arg) { - return loop_pb.LoopInRequest.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_looprpc_LoopOutRequest(arg) { - if (!(arg instanceof loop_pb.LoopOutRequest)) { - throw new Error('Expected argument of type looprpc.LoopOutRequest'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_looprpc_LoopOutRequest(buffer_arg) { - return loop_pb.LoopOutRequest.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_looprpc_MonitorRequest(arg) { - if (!(arg instanceof loop_pb.MonitorRequest)) { - throw new Error('Expected argument of type looprpc.MonitorRequest'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_looprpc_MonitorRequest(buffer_arg) { - return loop_pb.MonitorRequest.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_looprpc_OutQuoteResponse(arg) { - if (!(arg instanceof loop_pb.OutQuoteResponse)) { - throw new Error('Expected argument of type looprpc.OutQuoteResponse'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_looprpc_OutQuoteResponse(buffer_arg) { - return loop_pb.OutQuoteResponse.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_looprpc_OutTermsResponse(arg) { - if (!(arg instanceof loop_pb.OutTermsResponse)) { - throw new Error('Expected argument of type looprpc.OutTermsResponse'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_looprpc_OutTermsResponse(buffer_arg) { - return loop_pb.OutTermsResponse.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_looprpc_ProbeRequest(arg) { - if (!(arg instanceof loop_pb.ProbeRequest)) { - throw new Error('Expected argument of type looprpc.ProbeRequest'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_looprpc_ProbeRequest(buffer_arg) { - return loop_pb.ProbeRequest.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_looprpc_ProbeResponse(arg) { - if (!(arg instanceof loop_pb.ProbeResponse)) { - throw new Error('Expected argument of type looprpc.ProbeResponse'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_looprpc_ProbeResponse(buffer_arg) { - return loop_pb.ProbeResponse.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_looprpc_QuoteRequest(arg) { - if (!(arg instanceof loop_pb.QuoteRequest)) { - throw new Error('Expected argument of type looprpc.QuoteRequest'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_looprpc_QuoteRequest(buffer_arg) { - return loop_pb.QuoteRequest.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_looprpc_SetLiquidityParamsRequest(arg) { - if (!(arg instanceof loop_pb.SetLiquidityParamsRequest)) { - throw new Error('Expected argument of type looprpc.SetLiquidityParamsRequest'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_looprpc_SetLiquidityParamsRequest(buffer_arg) { - return loop_pb.SetLiquidityParamsRequest.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_looprpc_SetLiquidityParamsResponse(arg) { - if (!(arg instanceof loop_pb.SetLiquidityParamsResponse)) { - throw new Error('Expected argument of type looprpc.SetLiquidityParamsResponse'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_looprpc_SetLiquidityParamsResponse(buffer_arg) { - return loop_pb.SetLiquidityParamsResponse.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_looprpc_SuggestSwapsRequest(arg) { - if (!(arg instanceof loop_pb.SuggestSwapsRequest)) { - throw new Error('Expected argument of type looprpc.SuggestSwapsRequest'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_looprpc_SuggestSwapsRequest(buffer_arg) { - return loop_pb.SuggestSwapsRequest.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_looprpc_SuggestSwapsResponse(arg) { - if (!(arg instanceof loop_pb.SuggestSwapsResponse)) { - throw new Error('Expected argument of type looprpc.SuggestSwapsResponse'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_looprpc_SuggestSwapsResponse(buffer_arg) { - return loop_pb.SuggestSwapsResponse.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_looprpc_SwapInfoRequest(arg) { - if (!(arg instanceof loop_pb.SwapInfoRequest)) { - throw new Error('Expected argument of type looprpc.SwapInfoRequest'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_looprpc_SwapInfoRequest(buffer_arg) { - return loop_pb.SwapInfoRequest.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_looprpc_SwapResponse(arg) { - if (!(arg instanceof loop_pb.SwapResponse)) { - throw new Error('Expected argument of type looprpc.SwapResponse'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_looprpc_SwapResponse(buffer_arg) { - return loop_pb.SwapResponse.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_looprpc_SwapStatus(arg) { - if (!(arg instanceof loop_pb.SwapStatus)) { - throw new Error('Expected argument of type looprpc.SwapStatus'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_looprpc_SwapStatus(buffer_arg) { - return loop_pb.SwapStatus.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_looprpc_TermsRequest(arg) { - if (!(arg instanceof loop_pb.TermsRequest)) { - throw new Error('Expected argument of type looprpc.TermsRequest'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_looprpc_TermsRequest(buffer_arg) { - return loop_pb.TermsRequest.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_looprpc_TokensRequest(arg) { - if (!(arg instanceof loop_pb.TokensRequest)) { - throw new Error('Expected argument of type looprpc.TokensRequest'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_looprpc_TokensRequest(buffer_arg) { - return loop_pb.TokensRequest.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_looprpc_TokensResponse(arg) { - if (!(arg instanceof loop_pb.TokensResponse)) { - throw new Error('Expected argument of type looprpc.TokensResponse'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_looprpc_TokensResponse(buffer_arg) { - return loop_pb.TokensResponse.deserializeBinary(new Uint8Array(buffer_arg)); -} - - -// -// SwapClient is a service that handles the client side process of onchain/offchain -// swaps. The service is designed for a single client. -var SwapClientService = exports.SwapClientService = { - // loop: `out` -// LoopOut initiates an loop out swap with the given parameters. The call -// returns after the swap has been set up with the swap server. From that -// point onwards, progress can be tracked via the SwapStatus stream that is -// returned from Monitor(). -loopOut: { - path: '/looprpc.SwapClient/LoopOut', - requestStream: false, - responseStream: false, - requestType: loop_pb.LoopOutRequest, - responseType: loop_pb.SwapResponse, - requestSerialize: serialize_looprpc_LoopOutRequest, - requestDeserialize: deserialize_looprpc_LoopOutRequest, - responseSerialize: serialize_looprpc_SwapResponse, - responseDeserialize: deserialize_looprpc_SwapResponse, - }, - // loop: `in` -// LoopIn initiates a loop in swap with the given parameters. The call -// returns after the swap has been set up with the swap server. From that -// point onwards, progress can be tracked via the SwapStatus stream -// that is returned from Monitor(). -loopIn: { - path: '/looprpc.SwapClient/LoopIn', - requestStream: false, - responseStream: false, - requestType: loop_pb.LoopInRequest, - responseType: loop_pb.SwapResponse, - requestSerialize: serialize_looprpc_LoopInRequest, - requestDeserialize: deserialize_looprpc_LoopInRequest, - responseSerialize: serialize_looprpc_SwapResponse, - responseDeserialize: deserialize_looprpc_SwapResponse, - }, - // loop: `monitor` -// Monitor will return a stream of swap updates for currently active swaps. -monitor: { - path: '/looprpc.SwapClient/Monitor', - requestStream: false, - responseStream: true, - requestType: loop_pb.MonitorRequest, - responseType: loop_pb.SwapStatus, - requestSerialize: serialize_looprpc_MonitorRequest, - requestDeserialize: deserialize_looprpc_MonitorRequest, - responseSerialize: serialize_looprpc_SwapStatus, - responseDeserialize: deserialize_looprpc_SwapStatus, - }, - // loop: `listswaps` -// ListSwaps returns a list of all currently known swaps and their current -// status. -listSwaps: { - path: '/looprpc.SwapClient/ListSwaps', - requestStream: false, - responseStream: false, - requestType: loop_pb.ListSwapsRequest, - responseType: loop_pb.ListSwapsResponse, - requestSerialize: serialize_looprpc_ListSwapsRequest, - requestDeserialize: deserialize_looprpc_ListSwapsRequest, - responseSerialize: serialize_looprpc_ListSwapsResponse, - responseDeserialize: deserialize_looprpc_ListSwapsResponse, - }, - // loop: `swapinfo` -// SwapInfo returns all known details about a single swap. -swapInfo: { - path: '/looprpc.SwapClient/SwapInfo', - requestStream: false, - responseStream: false, - requestType: loop_pb.SwapInfoRequest, - responseType: loop_pb.SwapStatus, - requestSerialize: serialize_looprpc_SwapInfoRequest, - requestDeserialize: deserialize_looprpc_SwapInfoRequest, - responseSerialize: serialize_looprpc_SwapStatus, - responseDeserialize: deserialize_looprpc_SwapStatus, - }, - // loop: `terms` -// LoopOutTerms returns the terms that the server enforces for a loop out swap. -loopOutTerms: { - path: '/looprpc.SwapClient/LoopOutTerms', - requestStream: false, - responseStream: false, - requestType: loop_pb.TermsRequest, - responseType: loop_pb.OutTermsResponse, - requestSerialize: serialize_looprpc_TermsRequest, - requestDeserialize: deserialize_looprpc_TermsRequest, - responseSerialize: serialize_looprpc_OutTermsResponse, - responseDeserialize: deserialize_looprpc_OutTermsResponse, - }, - // loop: `quote` -// LoopOutQuote returns a quote for a loop out swap with the provided -// parameters. -loopOutQuote: { - path: '/looprpc.SwapClient/LoopOutQuote', - requestStream: false, - responseStream: false, - requestType: loop_pb.QuoteRequest, - responseType: loop_pb.OutQuoteResponse, - requestSerialize: serialize_looprpc_QuoteRequest, - requestDeserialize: deserialize_looprpc_QuoteRequest, - responseSerialize: serialize_looprpc_OutQuoteResponse, - responseDeserialize: deserialize_looprpc_OutQuoteResponse, - }, - // loop: `terms` -// GetTerms returns the terms that the server enforces for swaps. -getLoopInTerms: { - path: '/looprpc.SwapClient/GetLoopInTerms', - requestStream: false, - responseStream: false, - requestType: loop_pb.TermsRequest, - responseType: loop_pb.InTermsResponse, - requestSerialize: serialize_looprpc_TermsRequest, - requestDeserialize: deserialize_looprpc_TermsRequest, - responseSerialize: serialize_looprpc_InTermsResponse, - responseDeserialize: deserialize_looprpc_InTermsResponse, - }, - // loop: `quote` -// GetQuote returns a quote for a swap with the provided parameters. -getLoopInQuote: { - path: '/looprpc.SwapClient/GetLoopInQuote', - requestStream: false, - responseStream: false, - requestType: loop_pb.QuoteRequest, - responseType: loop_pb.InQuoteResponse, - requestSerialize: serialize_looprpc_QuoteRequest, - requestDeserialize: deserialize_looprpc_QuoteRequest, - responseSerialize: serialize_looprpc_InQuoteResponse, - responseDeserialize: deserialize_looprpc_InQuoteResponse, - }, - // -// Probe asks he sever to probe the route to us to have a better upfront -// estimate about routing fees when loopin-in. -probe: { - path: '/looprpc.SwapClient/Probe', - requestStream: false, - responseStream: false, - requestType: loop_pb.ProbeRequest, - responseType: loop_pb.ProbeResponse, - requestSerialize: serialize_looprpc_ProbeRequest, - requestDeserialize: deserialize_looprpc_ProbeRequest, - responseSerialize: serialize_looprpc_ProbeResponse, - responseDeserialize: deserialize_looprpc_ProbeResponse, - }, - // loop: `listauth` -// GetLsatTokens returns all LSAT tokens the daemon ever paid for. -getLsatTokens: { - path: '/looprpc.SwapClient/GetLsatTokens', - requestStream: false, - responseStream: false, - requestType: loop_pb.TokensRequest, - responseType: loop_pb.TokensResponse, - requestSerialize: serialize_looprpc_TokensRequest, - requestDeserialize: deserialize_looprpc_TokensRequest, - responseSerialize: serialize_looprpc_TokensResponse, - responseDeserialize: deserialize_looprpc_TokensResponse, - }, - // loop: `getparams` -// GetLiquidityParams gets the parameters that the daemon's liquidity manager -// is currently configured with. This may be nil if nothing is configured. -// [EXPERIMENTAL]: endpoint is subject to change. -getLiquidityParams: { - path: '/looprpc.SwapClient/GetLiquidityParams', - requestStream: false, - responseStream: false, - requestType: loop_pb.GetLiquidityParamsRequest, - responseType: loop_pb.LiquidityParameters, - requestSerialize: serialize_looprpc_GetLiquidityParamsRequest, - requestDeserialize: deserialize_looprpc_GetLiquidityParamsRequest, - responseSerialize: serialize_looprpc_LiquidityParameters, - responseDeserialize: deserialize_looprpc_LiquidityParameters, - }, - // loop: `setparams` -// SetLiquidityParams sets a new set of parameters for the daemon's liquidity -// manager. Note that the full set of parameters must be provided, because -// this call fully overwrites our existing parameters. -// [EXPERIMENTAL]: endpoint is subject to change. -setLiquidityParams: { - path: '/looprpc.SwapClient/SetLiquidityParams', - requestStream: false, - responseStream: false, - requestType: loop_pb.SetLiquidityParamsRequest, - responseType: loop_pb.SetLiquidityParamsResponse, - requestSerialize: serialize_looprpc_SetLiquidityParamsRequest, - requestDeserialize: deserialize_looprpc_SetLiquidityParamsRequest, - responseSerialize: serialize_looprpc_SetLiquidityParamsResponse, - responseDeserialize: deserialize_looprpc_SetLiquidityParamsResponse, - }, - // loop: `suggestswaps` -// SuggestSwaps returns a list of recommended swaps based on the current -// state of your node's channels and it's liquidity manager parameters. -// Note that only loop out suggestions are currently supported. -// [EXPERIMENTAL]: endpoint is subject to change. -suggestSwaps: { - path: '/looprpc.SwapClient/SuggestSwaps', - requestStream: false, - responseStream: false, - requestType: loop_pb.SuggestSwapsRequest, - responseType: loop_pb.SuggestSwapsResponse, - requestSerialize: serialize_looprpc_SuggestSwapsRequest, - requestDeserialize: deserialize_looprpc_SuggestSwapsRequest, - responseSerialize: serialize_looprpc_SuggestSwapsResponse, - responseDeserialize: deserialize_looprpc_SuggestSwapsResponse, - }, -}; - -exports.SwapClientClient = grpc.makeGenericClientConstructor(SwapClientService); diff --git a/core/api/src/services/loopd/protos/loop_pb.d.ts b/core/api/src/services/loopd/protos/loop_pb.d.ts deleted file mode 100644 index 692aadea7d..0000000000 --- a/core/api/src/services/loopd/protos/loop_pb.d.ts +++ /dev/null @@ -1,982 +0,0 @@ -// package: looprpc -// file: loop.proto - -import * as jspb from "google-protobuf"; -import * as swapserverrpc_common_pb from "./swapserverrpc/common_pb"; - -export class LoopOutRequest extends jspb.Message { - getAmt(): number; - setAmt(value: number): void; - - getDest(): string; - setDest(value: string): void; - - getMaxSwapRoutingFee(): number; - setMaxSwapRoutingFee(value: number): void; - - getMaxPrepayRoutingFee(): number; - setMaxPrepayRoutingFee(value: number): void; - - getMaxSwapFee(): number; - setMaxSwapFee(value: number): void; - - getMaxPrepayAmt(): number; - setMaxPrepayAmt(value: number): void; - - getMaxMinerFee(): number; - setMaxMinerFee(value: number): void; - - getLoopOutChannel(): number; - setLoopOutChannel(value: number): void; - - clearOutgoingChanSetList(): void; - getOutgoingChanSetList(): Array; - setOutgoingChanSetList(value: Array): void; - addOutgoingChanSet(value: number, index?: number): number; - - getSweepConfTarget(): number; - setSweepConfTarget(value: number): void; - - getHtlcConfirmations(): number; - setHtlcConfirmations(value: number): void; - - getSwapPublicationDeadline(): number; - setSwapPublicationDeadline(value: number): void; - - getLabel(): string; - setLabel(value: string): void; - - getInitiator(): string; - setInitiator(value: string): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): LoopOutRequest.AsObject; - static toObject(includeInstance: boolean, msg: LoopOutRequest): LoopOutRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: LoopOutRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): LoopOutRequest; - static deserializeBinaryFromReader(message: LoopOutRequest, reader: jspb.BinaryReader): LoopOutRequest; -} - -export namespace LoopOutRequest { - export type AsObject = { - amt: number, - dest: string, - maxSwapRoutingFee: number, - maxPrepayRoutingFee: number, - maxSwapFee: number, - maxPrepayAmt: number, - maxMinerFee: number, - loopOutChannel: number, - outgoingChanSetList: Array, - sweepConfTarget: number, - htlcConfirmations: number, - swapPublicationDeadline: number, - label: string, - initiator: string, - } -} - -export class LoopInRequest extends jspb.Message { - getAmt(): number; - setAmt(value: number): void; - - getMaxSwapFee(): number; - setMaxSwapFee(value: number): void; - - getMaxMinerFee(): number; - setMaxMinerFee(value: number): void; - - getLastHop(): Uint8Array | string; - getLastHop_asU8(): Uint8Array; - getLastHop_asB64(): string; - setLastHop(value: Uint8Array | string): void; - - getExternalHtlc(): boolean; - setExternalHtlc(value: boolean): void; - - getHtlcConfTarget(): number; - setHtlcConfTarget(value: number): void; - - getLabel(): string; - setLabel(value: string): void; - - getInitiator(): string; - setInitiator(value: string): void; - - getPrivate(): boolean; - setPrivate(value: boolean): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): LoopInRequest.AsObject; - static toObject(includeInstance: boolean, msg: LoopInRequest): LoopInRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: LoopInRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): LoopInRequest; - static deserializeBinaryFromReader(message: LoopInRequest, reader: jspb.BinaryReader): LoopInRequest; -} - -export namespace LoopInRequest { - export type AsObject = { - amt: number, - maxSwapFee: number, - maxMinerFee: number, - lastHop: Uint8Array | string, - externalHtlc: boolean, - htlcConfTarget: number, - label: string, - initiator: string, - pb_private: boolean, - } -} - -export class SwapResponse extends jspb.Message { - getId(): string; - setId(value: string): void; - - getIdBytes(): Uint8Array | string; - getIdBytes_asU8(): Uint8Array; - getIdBytes_asB64(): string; - setIdBytes(value: Uint8Array | string): void; - - getHtlcAddress(): string; - setHtlcAddress(value: string): void; - - getHtlcAddressNp2wsh(): string; - setHtlcAddressNp2wsh(value: string): void; - - getHtlcAddressP2wsh(): string; - setHtlcAddressP2wsh(value: string): void; - - getServerMessage(): string; - setServerMessage(value: string): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): SwapResponse.AsObject; - static toObject(includeInstance: boolean, msg: SwapResponse): SwapResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: SwapResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): SwapResponse; - static deserializeBinaryFromReader(message: SwapResponse, reader: jspb.BinaryReader): SwapResponse; -} - -export namespace SwapResponse { - export type AsObject = { - id: string, - idBytes: Uint8Array | string, - htlcAddress: string, - htlcAddressNp2wsh: string, - htlcAddressP2wsh: string, - serverMessage: string, - } -} - -export class MonitorRequest extends jspb.Message { - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): MonitorRequest.AsObject; - static toObject(includeInstance: boolean, msg: MonitorRequest): MonitorRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: MonitorRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): MonitorRequest; - static deserializeBinaryFromReader(message: MonitorRequest, reader: jspb.BinaryReader): MonitorRequest; -} - -export namespace MonitorRequest { - export type AsObject = { - } -} - -export class SwapStatus extends jspb.Message { - getAmt(): number; - setAmt(value: number): void; - - getId(): string; - setId(value: string): void; - - getIdBytes(): Uint8Array | string; - getIdBytes_asU8(): Uint8Array; - getIdBytes_asB64(): string; - setIdBytes(value: Uint8Array | string): void; - - getType(): SwapTypeMap[keyof SwapTypeMap]; - setType(value: SwapTypeMap[keyof SwapTypeMap]): void; - - getState(): SwapStateMap[keyof SwapStateMap]; - setState(value: SwapStateMap[keyof SwapStateMap]): void; - - getFailureReason(): FailureReasonMap[keyof FailureReasonMap]; - setFailureReason(value: FailureReasonMap[keyof FailureReasonMap]): void; - - getInitiationTime(): number; - setInitiationTime(value: number): void; - - getLastUpdateTime(): number; - setLastUpdateTime(value: number): void; - - getHtlcAddress(): string; - setHtlcAddress(value: string): void; - - getHtlcAddressP2wsh(): string; - setHtlcAddressP2wsh(value: string): void; - - getHtlcAddressNp2wsh(): string; - setHtlcAddressNp2wsh(value: string): void; - - getCostServer(): number; - setCostServer(value: number): void; - - getCostOnchain(): number; - setCostOnchain(value: number): void; - - getCostOffchain(): number; - setCostOffchain(value: number): void; - - getLastHop(): Uint8Array | string; - getLastHop_asU8(): Uint8Array; - getLastHop_asB64(): string; - setLastHop(value: Uint8Array | string): void; - - clearOutgoingChanSetList(): void; - getOutgoingChanSetList(): Array; - setOutgoingChanSetList(value: Array): void; - addOutgoingChanSet(value: number, index?: number): number; - - getLabel(): string; - setLabel(value: string): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): SwapStatus.AsObject; - static toObject(includeInstance: boolean, msg: SwapStatus): SwapStatus.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: SwapStatus, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): SwapStatus; - static deserializeBinaryFromReader(message: SwapStatus, reader: jspb.BinaryReader): SwapStatus; -} - -export namespace SwapStatus { - export type AsObject = { - amt: number, - id: string, - idBytes: Uint8Array | string, - type: SwapTypeMap[keyof SwapTypeMap], - state: SwapStateMap[keyof SwapStateMap], - failureReason: FailureReasonMap[keyof FailureReasonMap], - initiationTime: number, - lastUpdateTime: number, - htlcAddress: string, - htlcAddressP2wsh: string, - htlcAddressNp2wsh: string, - costServer: number, - costOnchain: number, - costOffchain: number, - lastHop: Uint8Array | string, - outgoingChanSetList: Array, - label: string, - } -} - -export class ListSwapsRequest extends jspb.Message { - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): ListSwapsRequest.AsObject; - static toObject(includeInstance: boolean, msg: ListSwapsRequest): ListSwapsRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: ListSwapsRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): ListSwapsRequest; - static deserializeBinaryFromReader(message: ListSwapsRequest, reader: jspb.BinaryReader): ListSwapsRequest; -} - -export namespace ListSwapsRequest { - export type AsObject = { - } -} - -export class ListSwapsResponse extends jspb.Message { - clearSwapsList(): void; - getSwapsList(): Array; - setSwapsList(value: Array): void; - addSwaps(value?: SwapStatus, index?: number): SwapStatus; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): ListSwapsResponse.AsObject; - static toObject(includeInstance: boolean, msg: ListSwapsResponse): ListSwapsResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: ListSwapsResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): ListSwapsResponse; - static deserializeBinaryFromReader(message: ListSwapsResponse, reader: jspb.BinaryReader): ListSwapsResponse; -} - -export namespace ListSwapsResponse { - export type AsObject = { - swapsList: Array, - } -} - -export class SwapInfoRequest extends jspb.Message { - getId(): Uint8Array | string; - getId_asU8(): Uint8Array; - getId_asB64(): string; - setId(value: Uint8Array | string): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): SwapInfoRequest.AsObject; - static toObject(includeInstance: boolean, msg: SwapInfoRequest): SwapInfoRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: SwapInfoRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): SwapInfoRequest; - static deserializeBinaryFromReader(message: SwapInfoRequest, reader: jspb.BinaryReader): SwapInfoRequest; -} - -export namespace SwapInfoRequest { - export type AsObject = { - id: Uint8Array | string, - } -} - -export class TermsRequest extends jspb.Message { - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): TermsRequest.AsObject; - static toObject(includeInstance: boolean, msg: TermsRequest): TermsRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: TermsRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): TermsRequest; - static deserializeBinaryFromReader(message: TermsRequest, reader: jspb.BinaryReader): TermsRequest; -} - -export namespace TermsRequest { - export type AsObject = { - } -} - -export class InTermsResponse extends jspb.Message { - getMinSwapAmount(): number; - setMinSwapAmount(value: number): void; - - getMaxSwapAmount(): number; - setMaxSwapAmount(value: number): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): InTermsResponse.AsObject; - static toObject(includeInstance: boolean, msg: InTermsResponse): InTermsResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: InTermsResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): InTermsResponse; - static deserializeBinaryFromReader(message: InTermsResponse, reader: jspb.BinaryReader): InTermsResponse; -} - -export namespace InTermsResponse { - export type AsObject = { - minSwapAmount: number, - maxSwapAmount: number, - } -} - -export class OutTermsResponse extends jspb.Message { - getMinSwapAmount(): number; - setMinSwapAmount(value: number): void; - - getMaxSwapAmount(): number; - setMaxSwapAmount(value: number): void; - - getMinCltvDelta(): number; - setMinCltvDelta(value: number): void; - - getMaxCltvDelta(): number; - setMaxCltvDelta(value: number): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): OutTermsResponse.AsObject; - static toObject(includeInstance: boolean, msg: OutTermsResponse): OutTermsResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: OutTermsResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): OutTermsResponse; - static deserializeBinaryFromReader(message: OutTermsResponse, reader: jspb.BinaryReader): OutTermsResponse; -} - -export namespace OutTermsResponse { - export type AsObject = { - minSwapAmount: number, - maxSwapAmount: number, - minCltvDelta: number, - maxCltvDelta: number, - } -} - -export class QuoteRequest extends jspb.Message { - getAmt(): number; - setAmt(value: number): void; - - getConfTarget(): number; - setConfTarget(value: number): void; - - getExternalHtlc(): boolean; - setExternalHtlc(value: boolean): void; - - getSwapPublicationDeadline(): number; - setSwapPublicationDeadline(value: number): void; - - getLoopInLastHop(): Uint8Array | string; - getLoopInLastHop_asU8(): Uint8Array; - getLoopInLastHop_asB64(): string; - setLoopInLastHop(value: Uint8Array | string): void; - - getPrivate(): boolean; - setPrivate(value: boolean): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): QuoteRequest.AsObject; - static toObject(includeInstance: boolean, msg: QuoteRequest): QuoteRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: QuoteRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): QuoteRequest; - static deserializeBinaryFromReader(message: QuoteRequest, reader: jspb.BinaryReader): QuoteRequest; -} - -export namespace QuoteRequest { - export type AsObject = { - amt: number, - confTarget: number, - externalHtlc: boolean, - swapPublicationDeadline: number, - loopInLastHop: Uint8Array | string, - pb_private: boolean, - } -} - -export class InQuoteResponse extends jspb.Message { - getSwapFeeSat(): number; - setSwapFeeSat(value: number): void; - - getHtlcPublishFeeSat(): number; - setHtlcPublishFeeSat(value: number): void; - - getCltvDelta(): number; - setCltvDelta(value: number): void; - - getConfTarget(): number; - setConfTarget(value: number): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): InQuoteResponse.AsObject; - static toObject(includeInstance: boolean, msg: InQuoteResponse): InQuoteResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: InQuoteResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): InQuoteResponse; - static deserializeBinaryFromReader(message: InQuoteResponse, reader: jspb.BinaryReader): InQuoteResponse; -} - -export namespace InQuoteResponse { - export type AsObject = { - swapFeeSat: number, - htlcPublishFeeSat: number, - cltvDelta: number, - confTarget: number, - } -} - -export class OutQuoteResponse extends jspb.Message { - getSwapFeeSat(): number; - setSwapFeeSat(value: number): void; - - getPrepayAmtSat(): number; - setPrepayAmtSat(value: number): void; - - getHtlcSweepFeeSat(): number; - setHtlcSweepFeeSat(value: number): void; - - getSwapPaymentDest(): Uint8Array | string; - getSwapPaymentDest_asU8(): Uint8Array; - getSwapPaymentDest_asB64(): string; - setSwapPaymentDest(value: Uint8Array | string): void; - - getCltvDelta(): number; - setCltvDelta(value: number): void; - - getConfTarget(): number; - setConfTarget(value: number): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): OutQuoteResponse.AsObject; - static toObject(includeInstance: boolean, msg: OutQuoteResponse): OutQuoteResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: OutQuoteResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): OutQuoteResponse; - static deserializeBinaryFromReader(message: OutQuoteResponse, reader: jspb.BinaryReader): OutQuoteResponse; -} - -export namespace OutQuoteResponse { - export type AsObject = { - swapFeeSat: number, - prepayAmtSat: number, - htlcSweepFeeSat: number, - swapPaymentDest: Uint8Array | string, - cltvDelta: number, - confTarget: number, - } -} - -export class ProbeRequest extends jspb.Message { - getAmt(): number; - setAmt(value: number): void; - - getLastHop(): Uint8Array | string; - getLastHop_asU8(): Uint8Array; - getLastHop_asB64(): string; - setLastHop(value: Uint8Array | string): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): ProbeRequest.AsObject; - static toObject(includeInstance: boolean, msg: ProbeRequest): ProbeRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: ProbeRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): ProbeRequest; - static deserializeBinaryFromReader(message: ProbeRequest, reader: jspb.BinaryReader): ProbeRequest; -} - -export namespace ProbeRequest { - export type AsObject = { - amt: number, - lastHop: Uint8Array | string, - } -} - -export class ProbeResponse extends jspb.Message { - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): ProbeResponse.AsObject; - static toObject(includeInstance: boolean, msg: ProbeResponse): ProbeResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: ProbeResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): ProbeResponse; - static deserializeBinaryFromReader(message: ProbeResponse, reader: jspb.BinaryReader): ProbeResponse; -} - -export namespace ProbeResponse { - export type AsObject = { - } -} - -export class TokensRequest extends jspb.Message { - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): TokensRequest.AsObject; - static toObject(includeInstance: boolean, msg: TokensRequest): TokensRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: TokensRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): TokensRequest; - static deserializeBinaryFromReader(message: TokensRequest, reader: jspb.BinaryReader): TokensRequest; -} - -export namespace TokensRequest { - export type AsObject = { - } -} - -export class TokensResponse extends jspb.Message { - clearTokensList(): void; - getTokensList(): Array; - setTokensList(value: Array): void; - addTokens(value?: LsatToken, index?: number): LsatToken; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): TokensResponse.AsObject; - static toObject(includeInstance: boolean, msg: TokensResponse): TokensResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: TokensResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): TokensResponse; - static deserializeBinaryFromReader(message: TokensResponse, reader: jspb.BinaryReader): TokensResponse; -} - -export namespace TokensResponse { - export type AsObject = { - tokensList: Array, - } -} - -export class LsatToken extends jspb.Message { - getBaseMacaroon(): Uint8Array | string; - getBaseMacaroon_asU8(): Uint8Array; - getBaseMacaroon_asB64(): string; - setBaseMacaroon(value: Uint8Array | string): void; - - getPaymentHash(): Uint8Array | string; - getPaymentHash_asU8(): Uint8Array; - getPaymentHash_asB64(): string; - setPaymentHash(value: Uint8Array | string): void; - - getPaymentPreimage(): Uint8Array | string; - getPaymentPreimage_asU8(): Uint8Array; - getPaymentPreimage_asB64(): string; - setPaymentPreimage(value: Uint8Array | string): void; - - getAmountPaidMsat(): number; - setAmountPaidMsat(value: number): void; - - getRoutingFeePaidMsat(): number; - setRoutingFeePaidMsat(value: number): void; - - getTimeCreated(): number; - setTimeCreated(value: number): void; - - getExpired(): boolean; - setExpired(value: boolean): void; - - getStorageName(): string; - setStorageName(value: string): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): LsatToken.AsObject; - static toObject(includeInstance: boolean, msg: LsatToken): LsatToken.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: LsatToken, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): LsatToken; - static deserializeBinaryFromReader(message: LsatToken, reader: jspb.BinaryReader): LsatToken; -} - -export namespace LsatToken { - export type AsObject = { - baseMacaroon: Uint8Array | string, - paymentHash: Uint8Array | string, - paymentPreimage: Uint8Array | string, - amountPaidMsat: number, - routingFeePaidMsat: number, - timeCreated: number, - expired: boolean, - storageName: string, - } -} - -export class GetLiquidityParamsRequest extends jspb.Message { - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): GetLiquidityParamsRequest.AsObject; - static toObject(includeInstance: boolean, msg: GetLiquidityParamsRequest): GetLiquidityParamsRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: GetLiquidityParamsRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): GetLiquidityParamsRequest; - static deserializeBinaryFromReader(message: GetLiquidityParamsRequest, reader: jspb.BinaryReader): GetLiquidityParamsRequest; -} - -export namespace GetLiquidityParamsRequest { - export type AsObject = { - } -} - -export class LiquidityParameters extends jspb.Message { - clearRulesList(): void; - getRulesList(): Array; - setRulesList(value: Array): void; - addRules(value?: LiquidityRule, index?: number): LiquidityRule; - - getFeePpm(): number; - setFeePpm(value: number): void; - - getSweepFeeRateSatPerVbyte(): number; - setSweepFeeRateSatPerVbyte(value: number): void; - - getMaxSwapFeePpm(): number; - setMaxSwapFeePpm(value: number): void; - - getMaxRoutingFeePpm(): number; - setMaxRoutingFeePpm(value: number): void; - - getMaxPrepayRoutingFeePpm(): number; - setMaxPrepayRoutingFeePpm(value: number): void; - - getMaxPrepaySat(): number; - setMaxPrepaySat(value: number): void; - - getMaxMinerFeeSat(): number; - setMaxMinerFeeSat(value: number): void; - - getSweepConfTarget(): number; - setSweepConfTarget(value: number): void; - - getFailureBackoffSec(): number; - setFailureBackoffSec(value: number): void; - - getAutoloop(): boolean; - setAutoloop(value: boolean): void; - - getAutoloopBudgetSat(): number; - setAutoloopBudgetSat(value: number): void; - - getAutoloopBudgetStartSec(): number; - setAutoloopBudgetStartSec(value: number): void; - - getAutoMaxInFlight(): number; - setAutoMaxInFlight(value: number): void; - - getMinSwapAmount(): number; - setMinSwapAmount(value: number): void; - - getMaxSwapAmount(): number; - setMaxSwapAmount(value: number): void; - - getHtlcConfTarget(): number; - setHtlcConfTarget(value: number): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): LiquidityParameters.AsObject; - static toObject(includeInstance: boolean, msg: LiquidityParameters): LiquidityParameters.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: LiquidityParameters, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): LiquidityParameters; - static deserializeBinaryFromReader(message: LiquidityParameters, reader: jspb.BinaryReader): LiquidityParameters; -} - -export namespace LiquidityParameters { - export type AsObject = { - rulesList: Array, - feePpm: number, - sweepFeeRateSatPerVbyte: number, - maxSwapFeePpm: number, - maxRoutingFeePpm: number, - maxPrepayRoutingFeePpm: number, - maxPrepaySat: number, - maxMinerFeeSat: number, - sweepConfTarget: number, - failureBackoffSec: number, - autoloop: boolean, - autoloopBudgetSat: number, - autoloopBudgetStartSec: number, - autoMaxInFlight: number, - minSwapAmount: number, - maxSwapAmount: number, - htlcConfTarget: number, - } -} - -export class LiquidityRule extends jspb.Message { - getChannelId(): number; - setChannelId(value: number): void; - - getSwapType(): SwapTypeMap[keyof SwapTypeMap]; - setSwapType(value: SwapTypeMap[keyof SwapTypeMap]): void; - - getPubkey(): Uint8Array | string; - getPubkey_asU8(): Uint8Array; - getPubkey_asB64(): string; - setPubkey(value: Uint8Array | string): void; - - getType(): LiquidityRuleTypeMap[keyof LiquidityRuleTypeMap]; - setType(value: LiquidityRuleTypeMap[keyof LiquidityRuleTypeMap]): void; - - getIncomingThreshold(): number; - setIncomingThreshold(value: number): void; - - getOutgoingThreshold(): number; - setOutgoingThreshold(value: number): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): LiquidityRule.AsObject; - static toObject(includeInstance: boolean, msg: LiquidityRule): LiquidityRule.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: LiquidityRule, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): LiquidityRule; - static deserializeBinaryFromReader(message: LiquidityRule, reader: jspb.BinaryReader): LiquidityRule; -} - -export namespace LiquidityRule { - export type AsObject = { - channelId: number, - swapType: SwapTypeMap[keyof SwapTypeMap], - pubkey: Uint8Array | string, - type: LiquidityRuleTypeMap[keyof LiquidityRuleTypeMap], - incomingThreshold: number, - outgoingThreshold: number, - } -} - -export class SetLiquidityParamsRequest extends jspb.Message { - hasParameters(): boolean; - clearParameters(): void; - getParameters(): LiquidityParameters | undefined; - setParameters(value?: LiquidityParameters): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): SetLiquidityParamsRequest.AsObject; - static toObject(includeInstance: boolean, msg: SetLiquidityParamsRequest): SetLiquidityParamsRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: SetLiquidityParamsRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): SetLiquidityParamsRequest; - static deserializeBinaryFromReader(message: SetLiquidityParamsRequest, reader: jspb.BinaryReader): SetLiquidityParamsRequest; -} - -export namespace SetLiquidityParamsRequest { - export type AsObject = { - parameters?: LiquidityParameters.AsObject, - } -} - -export class SetLiquidityParamsResponse extends jspb.Message { - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): SetLiquidityParamsResponse.AsObject; - static toObject(includeInstance: boolean, msg: SetLiquidityParamsResponse): SetLiquidityParamsResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: SetLiquidityParamsResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): SetLiquidityParamsResponse; - static deserializeBinaryFromReader(message: SetLiquidityParamsResponse, reader: jspb.BinaryReader): SetLiquidityParamsResponse; -} - -export namespace SetLiquidityParamsResponse { - export type AsObject = { - } -} - -export class SuggestSwapsRequest extends jspb.Message { - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): SuggestSwapsRequest.AsObject; - static toObject(includeInstance: boolean, msg: SuggestSwapsRequest): SuggestSwapsRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: SuggestSwapsRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): SuggestSwapsRequest; - static deserializeBinaryFromReader(message: SuggestSwapsRequest, reader: jspb.BinaryReader): SuggestSwapsRequest; -} - -export namespace SuggestSwapsRequest { - export type AsObject = { - } -} - -export class Disqualified extends jspb.Message { - getChannelId(): number; - setChannelId(value: number): void; - - getPubkey(): Uint8Array | string; - getPubkey_asU8(): Uint8Array; - getPubkey_asB64(): string; - setPubkey(value: Uint8Array | string): void; - - getReason(): AutoReasonMap[keyof AutoReasonMap]; - setReason(value: AutoReasonMap[keyof AutoReasonMap]): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Disqualified.AsObject; - static toObject(includeInstance: boolean, msg: Disqualified): Disqualified.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: Disqualified, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Disqualified; - static deserializeBinaryFromReader(message: Disqualified, reader: jspb.BinaryReader): Disqualified; -} - -export namespace Disqualified { - export type AsObject = { - channelId: number, - pubkey: Uint8Array | string, - reason: AutoReasonMap[keyof AutoReasonMap], - } -} - -export class SuggestSwapsResponse extends jspb.Message { - clearLoopOutList(): void; - getLoopOutList(): Array; - setLoopOutList(value: Array): void; - addLoopOut(value?: LoopOutRequest, index?: number): LoopOutRequest; - - clearLoopInList(): void; - getLoopInList(): Array; - setLoopInList(value: Array): void; - addLoopIn(value?: LoopInRequest, index?: number): LoopInRequest; - - clearDisqualifiedList(): void; - getDisqualifiedList(): Array; - setDisqualifiedList(value: Array): void; - addDisqualified(value?: Disqualified, index?: number): Disqualified; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): SuggestSwapsResponse.AsObject; - static toObject(includeInstance: boolean, msg: SuggestSwapsResponse): SuggestSwapsResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: SuggestSwapsResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): SuggestSwapsResponse; - static deserializeBinaryFromReader(message: SuggestSwapsResponse, reader: jspb.BinaryReader): SuggestSwapsResponse; -} - -export namespace SuggestSwapsResponse { - export type AsObject = { - loopOutList: Array, - loopInList: Array, - disqualifiedList: Array, - } -} - -export interface SwapTypeMap { - LOOP_OUT: 0; - LOOP_IN: 1; -} - -export const SwapType: SwapTypeMap; - -export interface SwapStateMap { - INITIATED: 0; - PREIMAGE_REVEALED: 1; - HTLC_PUBLISHED: 2; - SUCCESS: 3; - FAILED: 4; - INVOICE_SETTLED: 5; -} - -export const SwapState: SwapStateMap; - -export interface FailureReasonMap { - FAILURE_REASON_NONE: 0; - FAILURE_REASON_OFFCHAIN: 1; - FAILURE_REASON_TIMEOUT: 2; - FAILURE_REASON_SWEEP_TIMEOUT: 3; - FAILURE_REASON_INSUFFICIENT_VALUE: 4; - FAILURE_REASON_TEMPORARY: 5; - FAILURE_REASON_INCORRECT_AMOUNT: 6; -} - -export const FailureReason: FailureReasonMap; - -export interface LiquidityRuleTypeMap { - UNKNOWN: 0; - THRESHOLD: 1; -} - -export const LiquidityRuleType: LiquidityRuleTypeMap; - -export interface AutoReasonMap { - AUTO_REASON_UNKNOWN: 0; - AUTO_REASON_BUDGET_NOT_STARTED: 1; - AUTO_REASON_SWEEP_FEES: 2; - AUTO_REASON_BUDGET_ELAPSED: 3; - AUTO_REASON_IN_FLIGHT: 4; - AUTO_REASON_SWAP_FEE: 5; - AUTO_REASON_MINER_FEE: 6; - AUTO_REASON_PREPAY: 7; - AUTO_REASON_FAILURE_BACKOFF: 8; - AUTO_REASON_LOOP_OUT: 9; - AUTO_REASON_LOOP_IN: 10; - AUTO_REASON_LIQUIDITY_OK: 11; - AUTO_REASON_BUDGET_INSUFFICIENT: 12; - AUTO_REASON_FEE_INSUFFICIENT: 13; -} - -export const AutoReason: AutoReasonMap; - diff --git a/core/api/src/services/loopd/protos/loop_pb.js b/core/api/src/services/loopd/protos/loop_pb.js deleted file mode 100644 index 73ce0b78aa..0000000000 --- a/core/api/src/services/loopd/protos/loop_pb.js +++ /dev/null @@ -1,7279 +0,0 @@ -// source: loop.proto -/** - * @fileoverview - * @enhanceable - * @suppress {missingRequire} reports error on implicit type usages. - * @suppress {messageConventions} JS Compiler reports an error if a variable or - * field starts with 'MSG_' and isn't a translatable message. - * @public - */ -// GENERATED CODE -- DO NOT EDIT! -/* eslint-disable */ -// @ts-nocheck - -var jspb = require('google-protobuf'); -var goog = jspb; -var global = (function() { - if (this) { return this; } - if (typeof window !== 'undefined') { return window; } - if (typeof global !== 'undefined') { return global; } - if (typeof self !== 'undefined') { return self; } - return Function('return this')(); -}.call(null)); - -var swapserverrpc_common_pb = require('./swapserverrpc/common_pb.js'); -goog.object.extend(proto, swapserverrpc_common_pb); -goog.exportSymbol('proto.looprpc.AutoReason', null, global); -goog.exportSymbol('proto.looprpc.Disqualified', null, global); -goog.exportSymbol('proto.looprpc.FailureReason', null, global); -goog.exportSymbol('proto.looprpc.GetLiquidityParamsRequest', null, global); -goog.exportSymbol('proto.looprpc.InQuoteResponse', null, global); -goog.exportSymbol('proto.looprpc.InTermsResponse', null, global); -goog.exportSymbol('proto.looprpc.LiquidityParameters', null, global); -goog.exportSymbol('proto.looprpc.LiquidityRule', null, global); -goog.exportSymbol('proto.looprpc.LiquidityRuleType', null, global); -goog.exportSymbol('proto.looprpc.ListSwapsRequest', null, global); -goog.exportSymbol('proto.looprpc.ListSwapsResponse', null, global); -goog.exportSymbol('proto.looprpc.LoopInRequest', null, global); -goog.exportSymbol('proto.looprpc.LoopOutRequest', null, global); -goog.exportSymbol('proto.looprpc.LsatToken', null, global); -goog.exportSymbol('proto.looprpc.MonitorRequest', null, global); -goog.exportSymbol('proto.looprpc.OutQuoteResponse', null, global); -goog.exportSymbol('proto.looprpc.OutTermsResponse', null, global); -goog.exportSymbol('proto.looprpc.ProbeRequest', null, global); -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.SuggestSwapsRequest', null, global); -goog.exportSymbol('proto.looprpc.SuggestSwapsResponse', null, global); -goog.exportSymbol('proto.looprpc.SwapInfoRequest', null, global); -goog.exportSymbol('proto.looprpc.SwapResponse', null, global); -goog.exportSymbol('proto.looprpc.SwapState', null, global); -goog.exportSymbol('proto.looprpc.SwapStatus', null, global); -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); -/** - * 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 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.looprpc.LoopOutRequest.repeatedFields_, null); -}; -goog.inherits(proto.looprpc.LoopOutRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.LoopOutRequest.displayName = '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.LoopInRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.looprpc.LoopInRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.LoopInRequest.displayName = 'proto.looprpc.LoopInRequest'; -} -/** - * 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.SwapResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.looprpc.SwapResponse, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.SwapResponse.displayName = 'proto.looprpc.SwapResponse'; -} -/** - * 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.MonitorRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.looprpc.MonitorRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.MonitorRequest.displayName = 'proto.looprpc.MonitorRequest'; -} -/** - * 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.SwapStatus = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.looprpc.SwapStatus.repeatedFields_, null); -}; -goog.inherits(proto.looprpc.SwapStatus, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.SwapStatus.displayName = 'proto.looprpc.SwapStatus'; -} -/** - * 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.ListSwapsRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.looprpc.ListSwapsRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.ListSwapsRequest.displayName = 'proto.looprpc.ListSwapsRequest'; -} -/** - * 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.ListSwapsResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.looprpc.ListSwapsResponse.repeatedFields_, null); -}; -goog.inherits(proto.looprpc.ListSwapsResponse, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.ListSwapsResponse.displayName = 'proto.looprpc.ListSwapsResponse'; -} -/** - * 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.SwapInfoRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.looprpc.SwapInfoRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.SwapInfoRequest.displayName = 'proto.looprpc.SwapInfoRequest'; -} -/** - * 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.TermsRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.looprpc.TermsRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.TermsRequest.displayName = 'proto.looprpc.TermsRequest'; -} -/** - * 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.InTermsResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.looprpc.InTermsResponse, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.InTermsResponse.displayName = 'proto.looprpc.InTermsResponse'; -} -/** - * 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.OutTermsResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.looprpc.OutTermsResponse, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.OutTermsResponse.displayName = 'proto.looprpc.OutTermsResponse'; -} -/** - * 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.QuoteRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.looprpc.QuoteRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.QuoteRequest.displayName = 'proto.looprpc.QuoteRequest'; -} -/** - * 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.InQuoteResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.looprpc.InQuoteResponse, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.InQuoteResponse.displayName = 'proto.looprpc.InQuoteResponse'; -} -/** - * 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.OutQuoteResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.looprpc.OutQuoteResponse, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.OutQuoteResponse.displayName = 'proto.looprpc.OutQuoteResponse'; -} -/** - * 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.ProbeRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.looprpc.ProbeRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.ProbeRequest.displayName = 'proto.looprpc.ProbeRequest'; -} -/** - * 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.ProbeResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.looprpc.ProbeResponse, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.ProbeResponse.displayName = 'proto.looprpc.ProbeResponse'; -} -/** - * 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.TokensRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.looprpc.TokensRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.TokensRequest.displayName = 'proto.looprpc.TokensRequest'; -} -/** - * 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.TokensResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.looprpc.TokensResponse.repeatedFields_, null); -}; -goog.inherits(proto.looprpc.TokensResponse, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - 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.LsatToken = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.looprpc.LsatToken, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.LsatToken.displayName = 'proto.looprpc.LsatToken'; -} -/** - * 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.GetLiquidityParamsRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.looprpc.GetLiquidityParamsRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.GetLiquidityParamsRequest.displayName = 'proto.looprpc.GetLiquidityParamsRequest'; -} -/** - * 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.LiquidityParameters = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.looprpc.LiquidityParameters.repeatedFields_, null); -}; -goog.inherits(proto.looprpc.LiquidityParameters, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.LiquidityParameters.displayName = 'proto.looprpc.LiquidityParameters'; -} -/** - * 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.LiquidityRule = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.looprpc.LiquidityRule, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.LiquidityRule.displayName = 'proto.looprpc.LiquidityRule'; -} -/** - * 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.SetLiquidityParamsRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.looprpc.SetLiquidityParamsRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.SetLiquidityParamsRequest.displayName = 'proto.looprpc.SetLiquidityParamsRequest'; -} -/** - * 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.SetLiquidityParamsResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.looprpc.SetLiquidityParamsResponse, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.SetLiquidityParamsResponse.displayName = 'proto.looprpc.SetLiquidityParamsResponse'; -} -/** - * 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.SuggestSwapsRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.looprpc.SuggestSwapsRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.SuggestSwapsRequest.displayName = 'proto.looprpc.SuggestSwapsRequest'; -} -/** - * 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.Disqualified = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.looprpc.Disqualified, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.Disqualified.displayName = 'proto.looprpc.Disqualified'; -} -/** - * 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.SuggestSwapsResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.looprpc.SuggestSwapsResponse.repeatedFields_, null); -}; -goog.inherits(proto.looprpc.SuggestSwapsResponse, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.SuggestSwapsResponse.displayName = 'proto.looprpc.SuggestSwapsResponse'; -} - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.looprpc.LoopOutRequest.repeatedFields_ = [11]; - - - -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, "") - }; - - 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 {number} */ (reader.readInt64()); - msg.setAmt(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setDest(value); - break; - case 3: - var value = /** @type {number} */ (reader.readInt64()); - msg.setMaxSwapRoutingFee(value); - break; - case 4: - var value = /** @type {number} */ (reader.readInt64()); - msg.setMaxPrepayRoutingFee(value); - break; - case 5: - var value = /** @type {number} */ (reader.readInt64()); - msg.setMaxSwapFee(value); - break; - case 6: - var value = /** @type {number} */ (reader.readInt64()); - msg.setMaxPrepayAmt(value); - break; - case 7: - var value = /** @type {number} */ (reader.readInt64()); - msg.setMaxMinerFee(value); - break; - case 8: - var value = /** @type {number} */ (reader.readUint64()); - msg.setLoopOutChannel(value); - break; - case 11: - var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedUint64() : [reader.readUint64()]); - 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 {number} */ (reader.readUint64()); - 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; - 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 (f !== 0) { - writer.writeInt64( - 1, - f - ); - } - f = message.getDest(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getMaxSwapRoutingFee(); - if (f !== 0) { - writer.writeInt64( - 3, - f - ); - } - f = message.getMaxPrepayRoutingFee(); - if (f !== 0) { - writer.writeInt64( - 4, - f - ); - } - f = message.getMaxSwapFee(); - if (f !== 0) { - writer.writeInt64( - 5, - f - ); - } - f = message.getMaxPrepayAmt(); - if (f !== 0) { - writer.writeInt64( - 6, - f - ); - } - f = message.getMaxMinerFee(); - if (f !== 0) { - writer.writeInt64( - 7, - f - ); - } - f = message.getLoopOutChannel(); - if (f !== 0) { - writer.writeUint64( - 8, - f - ); - } - f = message.getOutgoingChanSetList(); - if (f.length > 0) { - writer.writePackedUint64( - 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 (f !== 0) { - writer.writeUint64( - 10, - f - ); - } - f = message.getLabel(); - if (f.length > 0) { - writer.writeString( - 12, - f - ); - } - f = message.getInitiator(); - if (f.length > 0) { - writer.writeString( - 14, - f - ); - } -}; - - -/** - * optional int64 amt = 1; - * @return {number} - */ -proto.looprpc.LoopOutRequest.prototype.getAmt = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LoopOutRequest} returns this - */ -proto.looprpc.LoopOutRequest.prototype.setAmt = function(value) { - return jspb.Message.setProto3IntField(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 {number} - */ -proto.looprpc.LoopOutRequest.prototype.getMaxSwapRoutingFee = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LoopOutRequest} returns this - */ -proto.looprpc.LoopOutRequest.prototype.setMaxSwapRoutingFee = function(value) { - return jspb.Message.setProto3IntField(this, 3, value); -}; - - -/** - * optional int64 max_prepay_routing_fee = 4; - * @return {number} - */ -proto.looprpc.LoopOutRequest.prototype.getMaxPrepayRoutingFee = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LoopOutRequest} returns this - */ -proto.looprpc.LoopOutRequest.prototype.setMaxPrepayRoutingFee = function(value) { - return jspb.Message.setProto3IntField(this, 4, value); -}; - - -/** - * optional int64 max_swap_fee = 5; - * @return {number} - */ -proto.looprpc.LoopOutRequest.prototype.getMaxSwapFee = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LoopOutRequest} returns this - */ -proto.looprpc.LoopOutRequest.prototype.setMaxSwapFee = function(value) { - return jspb.Message.setProto3IntField(this, 5, value); -}; - - -/** - * optional int64 max_prepay_amt = 6; - * @return {number} - */ -proto.looprpc.LoopOutRequest.prototype.getMaxPrepayAmt = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LoopOutRequest} returns this - */ -proto.looprpc.LoopOutRequest.prototype.setMaxPrepayAmt = function(value) { - return jspb.Message.setProto3IntField(this, 6, value); -}; - - -/** - * optional int64 max_miner_fee = 7; - * @return {number} - */ -proto.looprpc.LoopOutRequest.prototype.getMaxMinerFee = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 7, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LoopOutRequest} returns this - */ -proto.looprpc.LoopOutRequest.prototype.setMaxMinerFee = function(value) { - return jspb.Message.setProto3IntField(this, 7, value); -}; - - -/** - * optional uint64 loop_out_channel = 8; - * @return {number} - */ -proto.looprpc.LoopOutRequest.prototype.getLoopOutChannel = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 8, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LoopOutRequest} returns this - */ -proto.looprpc.LoopOutRequest.prototype.setLoopOutChannel = function(value) { - return jspb.Message.setProto3IntField(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 {number} 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 {number} - */ -proto.looprpc.LoopOutRequest.prototype.getSwapPublicationDeadline = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 10, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LoopOutRequest} returns this - */ -proto.looprpc.LoopOutRequest.prototype.setSwapPublicationDeadline = function(value) { - return jspb.Message.setProto3IntField(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); -}; - - - - - -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, ""), - 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 {number} */ (reader.readInt64()); - msg.setAmt(value); - break; - case 2: - var value = /** @type {number} */ (reader.readInt64()); - msg.setMaxSwapFee(value); - break; - case 3: - var value = /** @type {number} */ (reader.readInt64()); - 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 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 (f !== 0) { - writer.writeInt64( - 1, - f - ); - } - f = message.getMaxSwapFee(); - if (f !== 0) { - writer.writeInt64( - 2, - f - ); - } - f = message.getMaxMinerFee(); - if (f !== 0) { - writer.writeInt64( - 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.getPrivate(); - if (f) { - writer.writeBool( - 10, - f - ); - } -}; - - -/** - * optional int64 amt = 1; - * @return {number} - */ -proto.looprpc.LoopInRequest.prototype.getAmt = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LoopInRequest} returns this - */ -proto.looprpc.LoopInRequest.prototype.setAmt = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional int64 max_swap_fee = 2; - * @return {number} - */ -proto.looprpc.LoopInRequest.prototype.getMaxSwapFee = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LoopInRequest} returns this - */ -proto.looprpc.LoopInRequest.prototype.setMaxSwapFee = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); -}; - - -/** - * optional int64 max_miner_fee = 3; - * @return {number} - */ -proto.looprpc.LoopInRequest.prototype.getMaxMinerFee = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LoopInRequest} returns this - */ -proto.looprpc.LoopInRequest.prototype.setMaxMinerFee = function(value) { - return jspb.Message.setProto3IntField(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); -}; - - -/** - * 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, ""), - htlcAddressNp2wsh: jspb.Message.getFieldWithDefault(msg, 4, ""), - htlcAddressP2wsh: jspb.Message.getFieldWithDefault(msg, 5, ""), - 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 4: - var value = /** @type {string} */ (reader.readString()); - msg.setHtlcAddressNp2wsh(value); - break; - case 5: - var value = /** @type {string} */ (reader.readString()); - msg.setHtlcAddressP2wsh(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.getHtlcAddressNp2wsh(); - if (f.length > 0) { - writer.writeString( - 4, - f - ); - } - f = message.getHtlcAddressP2wsh(); - if (f.length > 0) { - writer.writeString( - 5, - 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_np2wsh = 4; - * @return {string} - */ -proto.looprpc.SwapResponse.prototype.getHtlcAddressNp2wsh = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); -}; - - -/** - * @param {string} value - * @return {!proto.looprpc.SwapResponse} returns this - */ -proto.looprpc.SwapResponse.prototype.setHtlcAddressNp2wsh = function(value) { - return jspb.Message.setProto3StringField(this, 4, 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 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, ""), - htlcAddressNp2wsh: jspb.Message.getFieldWithDefault(msg, 13, ""), - 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 {number} */ (reader.readInt64()); - 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 {number} */ (reader.readInt64()); - msg.setInitiationTime(value); - break; - case 6: - var value = /** @type {number} */ (reader.readInt64()); - 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 13: - var value = /** @type {string} */ (reader.readString()); - msg.setHtlcAddressNp2wsh(value); - break; - case 8: - var value = /** @type {number} */ (reader.readInt64()); - msg.setCostServer(value); - break; - case 9: - var value = /** @type {number} */ (reader.readInt64()); - msg.setCostOnchain(value); - break; - case 10: - var value = /** @type {number} */ (reader.readInt64()); - 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.readPackedUint64() : [reader.readUint64()]); - 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 (f !== 0) { - writer.writeInt64( - 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 (f !== 0) { - writer.writeInt64( - 5, - f - ); - } - f = message.getLastUpdateTime(); - if (f !== 0) { - writer.writeInt64( - 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.getHtlcAddressNp2wsh(); - if (f.length > 0) { - writer.writeString( - 13, - f - ); - } - f = message.getCostServer(); - if (f !== 0) { - writer.writeInt64( - 8, - f - ); - } - f = message.getCostOnchain(); - if (f !== 0) { - writer.writeInt64( - 9, - f - ); - } - f = message.getCostOffchain(); - if (f !== 0) { - writer.writeInt64( - 10, - f - ); - } - f = message.getLastHop_asU8(); - if (f.length > 0) { - writer.writeBytes( - 16, - f - ); - } - f = message.getOutgoingChanSetList(); - if (f.length > 0) { - writer.writePackedUint64( - 17, - f - ); - } - f = message.getLabel(); - if (f.length > 0) { - writer.writeString( - 15, - f - ); - } -}; - - -/** - * optional int64 amt = 1; - * @return {number} - */ -proto.looprpc.SwapStatus.prototype.getAmt = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.SwapStatus} returns this - */ -proto.looprpc.SwapStatus.prototype.setAmt = function(value) { - return jspb.Message.setProto3IntField(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 {number} - */ -proto.looprpc.SwapStatus.prototype.getInitiationTime = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.SwapStatus} returns this - */ -proto.looprpc.SwapStatus.prototype.setInitiationTime = function(value) { - return jspb.Message.setProto3IntField(this, 5, value); -}; - - -/** - * optional int64 last_update_time = 6; - * @return {number} - */ -proto.looprpc.SwapStatus.prototype.getLastUpdateTime = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.SwapStatus} returns this - */ -proto.looprpc.SwapStatus.prototype.setLastUpdateTime = function(value) { - return jspb.Message.setProto3IntField(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_np2wsh = 13; - * @return {string} - */ -proto.looprpc.SwapStatus.prototype.getHtlcAddressNp2wsh = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 13, "")); -}; - - -/** - * @param {string} value - * @return {!proto.looprpc.SwapStatus} returns this - */ -proto.looprpc.SwapStatus.prototype.setHtlcAddressNp2wsh = function(value) { - return jspb.Message.setProto3StringField(this, 13, value); -}; - - -/** - * optional int64 cost_server = 8; - * @return {number} - */ -proto.looprpc.SwapStatus.prototype.getCostServer = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 8, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.SwapStatus} returns this - */ -proto.looprpc.SwapStatus.prototype.setCostServer = function(value) { - return jspb.Message.setProto3IntField(this, 8, value); -}; - - -/** - * optional int64 cost_onchain = 9; - * @return {number} - */ -proto.looprpc.SwapStatus.prototype.getCostOnchain = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 9, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.SwapStatus} returns this - */ -proto.looprpc.SwapStatus.prototype.setCostOnchain = function(value) { - return jspb.Message.setProto3IntField(this, 9, value); -}; - - -/** - * optional int64 cost_offchain = 10; - * @return {number} - */ -proto.looprpc.SwapStatus.prototype.getCostOffchain = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 10, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.SwapStatus} returns this - */ -proto.looprpc.SwapStatus.prototype.setCostOffchain = function(value) { - return jspb.Message.setProto3IntField(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 {number} 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 = { - - }; - - 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) { - 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; -}; - - - -/** - * 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 {number} */ (reader.readInt64()); - msg.setMinSwapAmount(value); - break; - case 6: - var value = /** @type {number} */ (reader.readInt64()); - 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 (f !== 0) { - writer.writeInt64( - 5, - f - ); - } - f = message.getMaxSwapAmount(); - if (f !== 0) { - writer.writeInt64( - 6, - f - ); - } -}; - - -/** - * optional int64 min_swap_amount = 5; - * @return {number} - */ -proto.looprpc.InTermsResponse.prototype.getMinSwapAmount = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.InTermsResponse} returns this - */ -proto.looprpc.InTermsResponse.prototype.setMinSwapAmount = function(value) { - return jspb.Message.setProto3IntField(this, 5, value); -}; - - -/** - * optional int64 max_swap_amount = 6; - * @return {number} - */ -proto.looprpc.InTermsResponse.prototype.getMaxSwapAmount = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.InTermsResponse} returns this - */ -proto.looprpc.InTermsResponse.prototype.setMaxSwapAmount = function(value) { - return jspb.Message.setProto3IntField(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 {number} */ (reader.readInt64()); - msg.setMinSwapAmount(value); - break; - case 6: - var value = /** @type {number} */ (reader.readInt64()); - 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 (f !== 0) { - writer.writeInt64( - 5, - f - ); - } - f = message.getMaxSwapAmount(); - if (f !== 0) { - writer.writeInt64( - 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 {number} - */ -proto.looprpc.OutTermsResponse.prototype.getMinSwapAmount = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.OutTermsResponse} returns this - */ -proto.looprpc.OutTermsResponse.prototype.setMinSwapAmount = function(value) { - return jspb.Message.setProto3IntField(this, 5, value); -}; - - -/** - * optional int64 max_swap_amount = 6; - * @return {number} - */ -proto.looprpc.OutTermsResponse.prototype.getMaxSwapAmount = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.OutTermsResponse} returns this - */ -proto.looprpc.OutTermsResponse.prototype.setMaxSwapAmount = function(value) { - return jspb.Message.setProto3IntField(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); -}; - - - - - -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(), - pb_private: jspb.Message.getBooleanFieldWithDefault(msg, 7, 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.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; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readInt64()); - 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 {number} */ (reader.readUint64()); - msg.setSwapPublicationDeadline(value); - break; - case 5: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setLoopInLastHop(value); - break; - case 7: - 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.QuoteRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.QuoteRequest.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.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 (f !== 0) { - writer.writeInt64( - 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 (f !== 0) { - writer.writeUint64( - 4, - f - ); - } - f = message.getLoopInLastHop_asU8(); - if (f.length > 0) { - writer.writeBytes( - 5, - f - ); - } - f = message.getPrivate(); - if (f) { - writer.writeBool( - 7, - f - ); - } -}; - - -/** - * optional int64 amt = 1; - * @return {number} - */ -proto.looprpc.QuoteRequest.prototype.getAmt = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.QuoteRequest} returns this - */ -proto.looprpc.QuoteRequest.prototype.setAmt = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional int32 conf_target = 2; - * @return {number} - */ -proto.looprpc.QuoteRequest.prototype.getConfTarget = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.QuoteRequest} returns this - */ -proto.looprpc.QuoteRequest.prototype.setConfTarget = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); -}; - - -/** - * optional bool external_htlc = 3; - * @return {boolean} - */ -proto.looprpc.QuoteRequest.prototype.getExternalHtlc = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); -}; - - -/** - * @param {boolean} value - * @return {!proto.looprpc.QuoteRequest} returns this - */ -proto.looprpc.QuoteRequest.prototype.setExternalHtlc = function(value) { - return jspb.Message.setProto3BooleanField(this, 3, value); -}; - - -/** - * optional uint64 swap_publication_deadline = 4; - * @return {number} - */ -proto.looprpc.QuoteRequest.prototype.getSwapPublicationDeadline = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.QuoteRequest} returns this - */ -proto.looprpc.QuoteRequest.prototype.setSwapPublicationDeadline = function(value) { - return jspb.Message.setProto3IntField(this, 4, value); -}; - - -/** - * optional bytes loop_in_last_hop = 5; - * @return {!(string|Uint8Array)} - */ -proto.looprpc.QuoteRequest.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.QuoteRequest.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.QuoteRequest.prototype.getLoopInLastHop_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getLoopInLastHop())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.looprpc.QuoteRequest} returns this - */ -proto.looprpc.QuoteRequest.prototype.setLoopInLastHop = function(value) { - return jspb.Message.setProto3BytesField(this, 5, value); -}; - - -/** - * optional bool private = 7; - * @return {boolean} - */ -proto.looprpc.QuoteRequest.prototype.getPrivate = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 7, false)); -}; - - -/** - * @param {boolean} value - * @return {!proto.looprpc.QuoteRequest} returns this - */ -proto.looprpc.QuoteRequest.prototype.setPrivate = function(value) { - return jspb.Message.setProto3BooleanField(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} - */ -proto.looprpc.InQuoteResponse.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.InQuoteResponse.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.InQuoteResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -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; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.looprpc.InQuoteResponse} - */ -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); -}; - - -/** - * 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.InQuoteResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readInt64()); - msg.setSwapFeeSat(value); - break; - case 3: - var value = /** @type {number} */ (reader.readInt64()); - 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; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.looprpc.InQuoteResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.InQuoteResponse.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.InQuoteResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.InQuoteResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getSwapFeeSat(); - if (f !== 0) { - writer.writeInt64( - 1, - f - ); - } - f = message.getHtlcPublishFeeSat(); - if (f !== 0) { - writer.writeInt64( - 3, - f - ); - } - f = message.getCltvDelta(); - if (f !== 0) { - writer.writeInt32( - 5, - f - ); - } - f = message.getConfTarget(); - if (f !== 0) { - writer.writeInt32( - 6, - f - ); - } -}; - - -/** - * optional int64 swap_fee_sat = 1; - * @return {number} - */ -proto.looprpc.InQuoteResponse.prototype.getSwapFeeSat = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.InQuoteResponse} returns this - */ -proto.looprpc.InQuoteResponse.prototype.setSwapFeeSat = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional int64 htlc_publish_fee_sat = 3; - * @return {number} - */ -proto.looprpc.InQuoteResponse.prototype.getHtlcPublishFeeSat = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.InQuoteResponse} returns this - */ -proto.looprpc.InQuoteResponse.prototype.setHtlcPublishFeeSat = function(value) { - return jspb.Message.setProto3IntField(this, 3, value); -}; - - -/** - * optional int32 cltv_delta = 5; - * @return {number} - */ -proto.looprpc.InQuoteResponse.prototype.getCltvDelta = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.InQuoteResponse} returns this - */ -proto.looprpc.InQuoteResponse.prototype.setCltvDelta = function(value) { - return jspb.Message.setProto3IntField(this, 5, value); -}; - - -/** - * optional int32 conf_target = 6; - * @return {number} - */ -proto.looprpc.InQuoteResponse.prototype.getConfTarget = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.InQuoteResponse} returns this - */ -proto.looprpc.InQuoteResponse.prototype.setConfTarget = function(value) { - return jspb.Message.setProto3IntField(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.OutQuoteResponse.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.OutQuoteResponse.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.OutQuoteResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.OutQuoteResponse.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) - }; - - 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.OutQuoteResponse} - */ -proto.looprpc.OutQuoteResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - 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.OutQuoteResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.OutQuoteResponse} - */ -proto.looprpc.OutQuoteResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readInt64()); - msg.setSwapFeeSat(value); - break; - case 2: - var value = /** @type {number} */ (reader.readInt64()); - msg.setPrepayAmtSat(value); - break; - case 3: - var value = /** @type {number} */ (reader.readInt64()); - msg.setHtlcSweepFeeSat(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); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.looprpc.OutQuoteResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.OutQuoteResponse.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.OutQuoteResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.OutQuoteResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getSwapFeeSat(); - if (f !== 0) { - writer.writeInt64( - 1, - f - ); - } - f = message.getPrepayAmtSat(); - if (f !== 0) { - writer.writeInt64( - 2, - f - ); - } - f = message.getHtlcSweepFeeSat(); - if (f !== 0) { - writer.writeInt64( - 3, - f - ); - } - f = message.getSwapPaymentDest_asU8(); - if (f.length > 0) { - writer.writeBytes( - 4, - f - ); - } - f = message.getCltvDelta(); - if (f !== 0) { - writer.writeInt32( - 5, - f - ); - } - f = message.getConfTarget(); - if (f !== 0) { - writer.writeInt32( - 6, - f - ); - } -}; - - -/** - * optional int64 swap_fee_sat = 1; - * @return {number} - */ -proto.looprpc.OutQuoteResponse.prototype.getSwapFeeSat = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.OutQuoteResponse} returns this - */ -proto.looprpc.OutQuoteResponse.prototype.setSwapFeeSat = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional int64 prepay_amt_sat = 2; - * @return {number} - */ -proto.looprpc.OutQuoteResponse.prototype.getPrepayAmtSat = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.OutQuoteResponse} returns this - */ -proto.looprpc.OutQuoteResponse.prototype.setPrepayAmtSat = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); -}; - - -/** - * optional int64 htlc_sweep_fee_sat = 3; - * @return {number} - */ -proto.looprpc.OutQuoteResponse.prototype.getHtlcSweepFeeSat = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.OutQuoteResponse} returns this - */ -proto.looprpc.OutQuoteResponse.prototype.setHtlcSweepFeeSat = function(value) { - return jspb.Message.setProto3IntField(this, 3, value); -}; - - -/** - * optional bytes swap_payment_dest = 4; - * @return {!(string|Uint8Array)} - */ -proto.looprpc.OutQuoteResponse.prototype.getSwapPaymentDest = function() { - return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 4, "")); -}; - - -/** - * optional bytes swap_payment_dest = 4; - * This is a type-conversion wrapper around `getSwapPaymentDest()` - * @return {string} - */ -proto.looprpc.OutQuoteResponse.prototype.getSwapPaymentDest_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getSwapPaymentDest())); -}; - - -/** - * 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} - */ -proto.looprpc.OutQuoteResponse.prototype.getSwapPaymentDest_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getSwapPaymentDest())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.looprpc.OutQuoteResponse} returns this - */ -proto.looprpc.OutQuoteResponse.prototype.setSwapPaymentDest = function(value) { - return jspb.Message.setProto3BytesField(this, 4, value); -}; - - -/** - * optional int32 cltv_delta = 5; - * @return {number} - */ -proto.looprpc.OutQuoteResponse.prototype.getCltvDelta = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.OutQuoteResponse} returns this - */ -proto.looprpc.OutQuoteResponse.prototype.setCltvDelta = function(value) { - return jspb.Message.setProto3IntField(this, 5, value); -}; - - -/** - * optional int32 conf_target = 6; - * @return {number} - */ -proto.looprpc.OutQuoteResponse.prototype.getConfTarget = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.OutQuoteResponse} returns this - */ -proto.looprpc.OutQuoteResponse.prototype.setConfTarget = function(value) { - return jspb.Message.setProto3IntField(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.ProbeRequest.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.ProbeRequest.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.ProbeRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.ProbeRequest.toObject = function(includeInstance, msg) { - var f, obj = { - amt: jspb.Message.getFieldWithDefault(msg, 1, 0), - lastHop: msg.getLastHop_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.ProbeRequest} - */ -proto.looprpc.ProbeRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - 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.ProbeRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.ProbeRequest} - */ -proto.looprpc.ProbeRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readInt64()); - msg.setAmt(value); - break; - case 2: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setLastHop(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.looprpc.ProbeRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.ProbeRequest.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.ProbeRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.ProbeRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getAmt(); - if (f !== 0) { - writer.writeInt64( - 1, - f - ); - } - f = message.getLastHop_asU8(); - if (f.length > 0) { - writer.writeBytes( - 2, - f - ); - } -}; - - -/** - * optional int64 amt = 1; - * @return {number} - */ -proto.looprpc.ProbeRequest.prototype.getAmt = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.ProbeRequest} returns this - */ -proto.looprpc.ProbeRequest.prototype.setAmt = function(value) { - return jspb.Message.setProto3IntField(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); -}; - - - - - -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); -}; - - -/** - * 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.ProbeResponse.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.ProbeResponse} - */ -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); -}; - - -/** - * 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.ProbeResponse.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.ProbeResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.ProbeResponse.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.ProbeResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.ProbeResponse.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.TokensRequest.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.TokensRequest.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.TokensRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.TokensRequest.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.TokensRequest} - */ -proto.looprpc.TokensRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - 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.TokensRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.TokensRequest} - */ -proto.looprpc.TokensRequest.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.TokensRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.TokensRequest.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.TokensRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.TokensRequest.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) { -/** - * 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.TokensResponse.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.TokensResponse.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.TokensResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.TokensResponse.toObject = function(includeInstance, msg) { - var f, obj = { - tokensList: jspb.Message.toObjectList(msg.getTokensList(), - proto.looprpc.LsatToken.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.TokensResponse} - */ -proto.looprpc.TokensResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - 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.TokensResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.TokensResponse} - */ -proto.looprpc.TokensResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.looprpc.LsatToken; - reader.readMessage(value,proto.looprpc.LsatToken.deserializeBinaryFromReader); - msg.addTokens(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.looprpc.TokensResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.TokensResponse.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.TokensResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.TokensResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getTokensList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 1, - f, - proto.looprpc.LsatToken.serializeBinaryToWriter - ); - } -}; - - -/** - * repeated LsatToken tokens = 1; - * @return {!Array} - */ -proto.looprpc.TokensResponse.prototype.getTokensList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.looprpc.LsatToken, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.looprpc.TokensResponse} returns this -*/ -proto.looprpc.TokensResponse.prototype.setTokensList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - - -/** - * @param {!proto.looprpc.LsatToken=} opt_value - * @param {number=} opt_index - * @return {!proto.looprpc.LsatToken} - */ -proto.looprpc.TokensResponse.prototype.addTokens = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.looprpc.LsatToken, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.looprpc.TokensResponse} returns this - */ -proto.looprpc.TokensResponse.prototype.clearTokensList = function() { - return this.setTokensList([]); -}; - - - - - -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.LsatToken.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.LsatToken.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.LsatToken} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.LsatToken.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, "") - }; - - 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.LsatToken} - */ -proto.looprpc.LsatToken.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.LsatToken; - return proto.looprpc.LsatToken.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.looprpc.LsatToken} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.LsatToken} - */ -proto.looprpc.LsatToken.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 {number} */ (reader.readInt64()); - msg.setAmountPaidMsat(value); - break; - case 5: - var value = /** @type {number} */ (reader.readInt64()); - msg.setRoutingFeePaidMsat(value); - break; - case 6: - var value = /** @type {number} */ (reader.readInt64()); - 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; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.looprpc.LsatToken.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.LsatToken.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.LsatToken} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.LsatToken.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 (f !== 0) { - writer.writeInt64( - 4, - f - ); - } - f = message.getRoutingFeePaidMsat(); - if (f !== 0) { - writer.writeInt64( - 5, - f - ); - } - f = message.getTimeCreated(); - if (f !== 0) { - writer.writeInt64( - 6, - f - ); - } - f = message.getExpired(); - if (f) { - writer.writeBool( - 7, - f - ); - } - f = message.getStorageName(); - if (f.length > 0) { - writer.writeString( - 8, - f - ); - } -}; - - -/** - * optional bytes base_macaroon = 1; - * @return {!(string|Uint8Array)} - */ -proto.looprpc.LsatToken.prototype.getBaseMacaroon = function() { - return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * optional bytes base_macaroon = 1; - * This is a type-conversion wrapper around `getBaseMacaroon()` - * @return {string} - */ -proto.looprpc.LsatToken.prototype.getBaseMacaroon_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getBaseMacaroon())); -}; - - -/** - * 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.LsatToken.prototype.getBaseMacaroon_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getBaseMacaroon())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.looprpc.LsatToken} returns this - */ -proto.looprpc.LsatToken.prototype.setBaseMacaroon = function(value) { - return jspb.Message.setProto3BytesField(this, 1, value); -}; - - -/** - * optional bytes payment_hash = 2; - * @return {!(string|Uint8Array)} - */ -proto.looprpc.LsatToken.prototype.getPaymentHash = function() { - return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * optional bytes payment_hash = 2; - * This is a type-conversion wrapper around `getPaymentHash()` - * @return {string} - */ -proto.looprpc.LsatToken.prototype.getPaymentHash_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getPaymentHash())); -}; - - -/** - * 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} - */ -proto.looprpc.LsatToken.prototype.getPaymentHash_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getPaymentHash())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.looprpc.LsatToken} returns this - */ -proto.looprpc.LsatToken.prototype.setPaymentHash = function(value) { - return jspb.Message.setProto3BytesField(this, 2, value); -}; - - -/** - * optional bytes payment_preimage = 3; - * @return {!(string|Uint8Array)} - */ -proto.looprpc.LsatToken.prototype.getPaymentPreimage = function() { - return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); -}; - - -/** - * optional bytes payment_preimage = 3; - * This is a type-conversion wrapper around `getPaymentPreimage()` - * @return {string} - */ -proto.looprpc.LsatToken.prototype.getPaymentPreimage_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getPaymentPreimage())); -}; - - -/** - * 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.LsatToken.prototype.getPaymentPreimage_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getPaymentPreimage())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.looprpc.LsatToken} returns this - */ -proto.looprpc.LsatToken.prototype.setPaymentPreimage = function(value) { - return jspb.Message.setProto3BytesField(this, 3, value); -}; - - -/** - * optional int64 amount_paid_msat = 4; - * @return {number} - */ -proto.looprpc.LsatToken.prototype.getAmountPaidMsat = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LsatToken} returns this - */ -proto.looprpc.LsatToken.prototype.setAmountPaidMsat = function(value) { - return jspb.Message.setProto3IntField(this, 4, value); -}; - - -/** - * optional int64 routing_fee_paid_msat = 5; - * @return {number} - */ -proto.looprpc.LsatToken.prototype.getRoutingFeePaidMsat = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LsatToken} returns this - */ -proto.looprpc.LsatToken.prototype.setRoutingFeePaidMsat = function(value) { - return jspb.Message.setProto3IntField(this, 5, value); -}; - - -/** - * optional int64 time_created = 6; - * @return {number} - */ -proto.looprpc.LsatToken.prototype.getTimeCreated = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LsatToken} returns this - */ -proto.looprpc.LsatToken.prototype.setTimeCreated = function(value) { - return jspb.Message.setProto3IntField(this, 6, value); -}; - - -/** - * optional bool expired = 7; - * @return {boolean} - */ -proto.looprpc.LsatToken.prototype.getExpired = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 7, false)); -}; - - -/** - * @param {boolean} value - * @return {!proto.looprpc.LsatToken} returns this - */ -proto.looprpc.LsatToken.prototype.setExpired = function(value) { - return jspb.Message.setProto3BooleanField(this, 7, value); -}; - - -/** - * optional string storage_name = 8; - * @return {string} - */ -proto.looprpc.LsatToken.prototype.getStorageName = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 8, "")); -}; - - -/** - * @param {string} value - * @return {!proto.looprpc.LsatToken} returns this - */ -proto.looprpc.LsatToken.prototype.setStorageName = function(value) { - return jspb.Message.setProto3StringField(this, 8, 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.GetLiquidityParamsRequest.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.GetLiquidityParamsRequest.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.GetLiquidityParamsRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.GetLiquidityParamsRequest.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.GetLiquidityParamsRequest} - */ -proto.looprpc.GetLiquidityParamsRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - 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.GetLiquidityParamsRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.GetLiquidityParamsRequest} - */ -proto.looprpc.GetLiquidityParamsRequest.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.GetLiquidityParamsRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.GetLiquidityParamsRequest.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.GetLiquidityParamsRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.GetLiquidityParamsRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.looprpc.LiquidityParameters.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.LiquidityParameters.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.LiquidityParameters.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.LiquidityParameters} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.LiquidityParameters.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) - }; - - 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.LiquidityParameters} - */ -proto.looprpc.LiquidityParameters.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - 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.LiquidityParameters} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.LiquidityParameters} - */ -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 {number} */ (reader.readUint64()); - msg.setFeePpm(value); - break; - case 2: - var value = /** @type {number} */ (reader.readUint64()); - msg.setSweepFeeRateSatPerVbyte(value); - break; - case 3: - var value = /** @type {number} */ (reader.readUint64()); - msg.setMaxSwapFeePpm(value); - break; - case 4: - var value = /** @type {number} */ (reader.readUint64()); - msg.setMaxRoutingFeePpm(value); - break; - case 5: - var value = /** @type {number} */ (reader.readUint64()); - msg.setMaxPrepayRoutingFeePpm(value); - break; - case 6: - var value = /** @type {number} */ (reader.readUint64()); - msg.setMaxPrepaySat(value); - break; - case 7: - var value = /** @type {number} */ (reader.readUint64()); - msg.setMaxMinerFeeSat(value); - break; - case 8: - var value = /** @type {number} */ (reader.readInt32()); - msg.setSweepConfTarget(value); - break; - case 9: - var value = /** @type {number} */ (reader.readUint64()); - msg.setFailureBackoffSec(value); - break; - case 10: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setAutoloop(value); - break; - case 11: - var value = /** @type {number} */ (reader.readUint64()); - msg.setAutoloopBudgetSat(value); - break; - case 12: - var value = /** @type {number} */ (reader.readUint64()); - msg.setAutoloopBudgetStartSec(value); - break; - case 13: - var value = /** @type {number} */ (reader.readUint64()); - msg.setAutoMaxInFlight(value); - break; - case 14: - var value = /** @type {number} */ (reader.readUint64()); - msg.setMinSwapAmount(value); - break; - case 15: - var value = /** @type {number} */ (reader.readUint64()); - msg.setMaxSwapAmount(value); - break; - case 17: - var value = /** @type {number} */ (reader.readInt32()); - msg.setHtlcConfTarget(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 (f !== 0) { - writer.writeUint64( - 16, - f - ); - } - f = message.getSweepFeeRateSatPerVbyte(); - if (f !== 0) { - writer.writeUint64( - 2, - f - ); - } - f = message.getMaxSwapFeePpm(); - if (f !== 0) { - writer.writeUint64( - 3, - f - ); - } - f = message.getMaxRoutingFeePpm(); - if (f !== 0) { - writer.writeUint64( - 4, - f - ); - } - f = message.getMaxPrepayRoutingFeePpm(); - if (f !== 0) { - writer.writeUint64( - 5, - f - ); - } - f = message.getMaxPrepaySat(); - if (f !== 0) { - writer.writeUint64( - 6, - f - ); - } - f = message.getMaxMinerFeeSat(); - if (f !== 0) { - writer.writeUint64( - 7, - f - ); - } - f = message.getSweepConfTarget(); - if (f !== 0) { - writer.writeInt32( - 8, - f - ); - } - f = message.getFailureBackoffSec(); - if (f !== 0) { - writer.writeUint64( - 9, - f - ); - } - f = message.getAutoloop(); - if (f) { - writer.writeBool( - 10, - f - ); - } - f = message.getAutoloopBudgetSat(); - if (f !== 0) { - writer.writeUint64( - 11, - f - ); - } - f = message.getAutoloopBudgetStartSec(); - if (f !== 0) { - writer.writeUint64( - 12, - f - ); - } - f = message.getAutoMaxInFlight(); - if (f !== 0) { - writer.writeUint64( - 13, - f - ); - } - f = message.getMinSwapAmount(); - if (f !== 0) { - writer.writeUint64( - 14, - f - ); - } - f = message.getMaxSwapAmount(); - if (f !== 0) { - writer.writeUint64( - 15, - f - ); - } - f = message.getHtlcConfTarget(); - if (f !== 0) { - writer.writeInt32( - 17, - f - ); - } -}; - - -/** - * repeated LiquidityRule rules = 1; - * @return {!Array} - */ -proto.looprpc.LiquidityParameters.prototype.getRulesList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.looprpc.LiquidityRule, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.looprpc.LiquidityParameters} returns this -*/ -proto.looprpc.LiquidityParameters.prototype.setRulesList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - - -/** - * @param {!proto.looprpc.LiquidityRule=} opt_value - * @param {number=} opt_index - * @return {!proto.looprpc.LiquidityRule} - */ -proto.looprpc.LiquidityParameters.prototype.addRules = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.looprpc.LiquidityRule, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.looprpc.LiquidityParameters} returns this - */ -proto.looprpc.LiquidityParameters.prototype.clearRulesList = function() { - return this.setRulesList([]); -}; - - -/** - * optional uint64 fee_ppm = 16; - * @return {number} - */ -proto.looprpc.LiquidityParameters.prototype.getFeePpm = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 16, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LiquidityParameters} returns this - */ -proto.looprpc.LiquidityParameters.prototype.setFeePpm = function(value) { - return jspb.Message.setProto3IntField(this, 16, value); -}; - - -/** - * optional uint64 sweep_fee_rate_sat_per_vbyte = 2; - * @return {number} - */ -proto.looprpc.LiquidityParameters.prototype.getSweepFeeRateSatPerVbyte = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LiquidityParameters} returns this - */ -proto.looprpc.LiquidityParameters.prototype.setSweepFeeRateSatPerVbyte = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); -}; - - -/** - * optional uint64 max_swap_fee_ppm = 3; - * @return {number} - */ -proto.looprpc.LiquidityParameters.prototype.getMaxSwapFeePpm = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LiquidityParameters} returns this - */ -proto.looprpc.LiquidityParameters.prototype.setMaxSwapFeePpm = function(value) { - return jspb.Message.setProto3IntField(this, 3, value); -}; - - -/** - * optional uint64 max_routing_fee_ppm = 4; - * @return {number} - */ -proto.looprpc.LiquidityParameters.prototype.getMaxRoutingFeePpm = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LiquidityParameters} returns this - */ -proto.looprpc.LiquidityParameters.prototype.setMaxRoutingFeePpm = function(value) { - return jspb.Message.setProto3IntField(this, 4, value); -}; - - -/** - * optional uint64 max_prepay_routing_fee_ppm = 5; - * @return {number} - */ -proto.looprpc.LiquidityParameters.prototype.getMaxPrepayRoutingFeePpm = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LiquidityParameters} returns this - */ -proto.looprpc.LiquidityParameters.prototype.setMaxPrepayRoutingFeePpm = function(value) { - return jspb.Message.setProto3IntField(this, 5, value); -}; - - -/** - * optional uint64 max_prepay_sat = 6; - * @return {number} - */ -proto.looprpc.LiquidityParameters.prototype.getMaxPrepaySat = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LiquidityParameters} returns this - */ -proto.looprpc.LiquidityParameters.prototype.setMaxPrepaySat = function(value) { - return jspb.Message.setProto3IntField(this, 6, value); -}; - - -/** - * optional uint64 max_miner_fee_sat = 7; - * @return {number} - */ -proto.looprpc.LiquidityParameters.prototype.getMaxMinerFeeSat = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 7, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LiquidityParameters} returns this - */ -proto.looprpc.LiquidityParameters.prototype.setMaxMinerFeeSat = function(value) { - return jspb.Message.setProto3IntField(this, 7, value); -}; - - -/** - * 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 {number} - */ -proto.looprpc.LiquidityParameters.prototype.getFailureBackoffSec = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 9, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LiquidityParameters} returns this - */ -proto.looprpc.LiquidityParameters.prototype.setFailureBackoffSec = function(value) { - return jspb.Message.setProto3IntField(this, 9, value); -}; - - -/** - * optional bool autoloop = 10; - * @return {boolean} - */ -proto.looprpc.LiquidityParameters.prototype.getAutoloop = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 10, false)); -}; - - -/** - * @param {boolean} value - * @return {!proto.looprpc.LiquidityParameters} returns this - */ -proto.looprpc.LiquidityParameters.prototype.setAutoloop = function(value) { - return jspb.Message.setProto3BooleanField(this, 10, value); -}; - - -/** - * optional uint64 autoloop_budget_sat = 11; - * @return {number} - */ -proto.looprpc.LiquidityParameters.prototype.getAutoloopBudgetSat = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 11, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LiquidityParameters} returns this - */ -proto.looprpc.LiquidityParameters.prototype.setAutoloopBudgetSat = function(value) { - return jspb.Message.setProto3IntField(this, 11, value); -}; - - -/** - * optional uint64 autoloop_budget_start_sec = 12; - * @return {number} - */ -proto.looprpc.LiquidityParameters.prototype.getAutoloopBudgetStartSec = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 12, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LiquidityParameters} returns this - */ -proto.looprpc.LiquidityParameters.prototype.setAutoloopBudgetStartSec = function(value) { - return jspb.Message.setProto3IntField(this, 12, value); -}; - - -/** - * optional uint64 auto_max_in_flight = 13; - * @return {number} - */ -proto.looprpc.LiquidityParameters.prototype.getAutoMaxInFlight = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 13, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LiquidityParameters} returns this - */ -proto.looprpc.LiquidityParameters.prototype.setAutoMaxInFlight = function(value) { - return jspb.Message.setProto3IntField(this, 13, value); -}; - - -/** - * optional uint64 min_swap_amount = 14; - * @return {number} - */ -proto.looprpc.LiquidityParameters.prototype.getMinSwapAmount = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 14, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LiquidityParameters} returns this - */ -proto.looprpc.LiquidityParameters.prototype.setMinSwapAmount = function(value) { - return jspb.Message.setProto3IntField(this, 14, value); -}; - - -/** - * optional uint64 max_swap_amount = 15; - * @return {number} - */ -proto.looprpc.LiquidityParameters.prototype.getMaxSwapAmount = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 15, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LiquidityParameters} returns this - */ -proto.looprpc.LiquidityParameters.prototype.setMaxSwapAmount = function(value) { - return jspb.Message.setProto3IntField(this, 15, value); -}; - - -/** - * optional int32 htlc_conf_target = 17; - * @return {number} - */ -proto.looprpc.LiquidityParameters.prototype.getHtlcConfTarget = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 17, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LiquidityParameters} returns this - */ -proto.looprpc.LiquidityParameters.prototype.setHtlcConfTarget = function(value) { - return jspb.Message.setProto3IntField(this, 17, 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.LiquidityRule.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.LiquidityRule.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.LiquidityRule} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.LiquidityRule.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) - }; - - 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.LiquidityRule} - */ -proto.looprpc.LiquidityRule.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - 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.LiquidityRule} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.LiquidityRule} - */ -proto.looprpc.LiquidityRule.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readUint64()); - 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 {!proto.looprpc.LiquidityRuleType} */ (reader.readEnum()); - msg.setType(value); - break; - case 3: - var value = /** @type {number} */ (reader.readUint32()); - msg.setIncomingThreshold(value); - break; - case 4: - var value = /** @type {number} */ (reader.readUint32()); - msg.setOutgoingThreshold(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.looprpc.LiquidityRule.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.LiquidityRule.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.LiquidityRule} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.LiquidityRule.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getChannelId(); - if (f !== 0) { - writer.writeUint64( - 1, - f - ); - } - f = message.getSwapType(); - if (f !== 0.0) { - writer.writeEnum( - 6, - f - ); - } - f = message.getPubkey_asU8(); - if (f.length > 0) { - writer.writeBytes( - 5, - f - ); - } - f = message.getType(); - if (f !== 0.0) { - writer.writeEnum( - 2, - f - ); - } - f = message.getIncomingThreshold(); - if (f !== 0) { - writer.writeUint32( - 3, - f - ); - } - f = message.getOutgoingThreshold(); - if (f !== 0) { - writer.writeUint32( - 4, - f - ); - } -}; - - -/** - * optional uint64 channel_id = 1; - * @return {number} - */ -proto.looprpc.LiquidityRule.prototype.getChannelId = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LiquidityRule} returns this - */ -proto.looprpc.LiquidityRule.prototype.setChannelId = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional SwapType swap_type = 6; - * @return {!proto.looprpc.SwapType} - */ -proto.looprpc.LiquidityRule.prototype.getSwapType = function() { - return /** @type {!proto.looprpc.SwapType} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); -}; - - -/** - * @param {!proto.looprpc.SwapType} value - * @return {!proto.looprpc.LiquidityRule} returns this - */ -proto.looprpc.LiquidityRule.prototype.setSwapType = function(value) { - return jspb.Message.setProto3EnumField(this, 6, value); -}; - - -/** - * optional bytes pubkey = 5; - * @return {!(string|Uint8Array)} - */ -proto.looprpc.LiquidityRule.prototype.getPubkey = function() { - return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 5, "")); -}; - - -/** - * optional bytes pubkey = 5; - * This is a type-conversion wrapper around `getPubkey()` - * @return {string} - */ -proto.looprpc.LiquidityRule.prototype.getPubkey_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getPubkey())); -}; - - -/** - * 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.LiquidityRule.prototype.getPubkey_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getPubkey())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.looprpc.LiquidityRule} returns this - */ -proto.looprpc.LiquidityRule.prototype.setPubkey = function(value) { - return jspb.Message.setProto3BytesField(this, 5, value); -}; - - -/** - * optional LiquidityRuleType type = 2; - * @return {!proto.looprpc.LiquidityRuleType} - */ -proto.looprpc.LiquidityRule.prototype.getType = function() { - return /** @type {!proto.looprpc.LiquidityRuleType} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {!proto.looprpc.LiquidityRuleType} value - * @return {!proto.looprpc.LiquidityRule} returns this - */ -proto.looprpc.LiquidityRule.prototype.setType = function(value) { - return jspb.Message.setProto3EnumField(this, 2, value); -}; - - -/** - * optional uint32 incoming_threshold = 3; - * @return {number} - */ -proto.looprpc.LiquidityRule.prototype.getIncomingThreshold = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LiquidityRule} returns this - */ -proto.looprpc.LiquidityRule.prototype.setIncomingThreshold = function(value) { - return jspb.Message.setProto3IntField(this, 3, value); -}; - - -/** - * optional uint32 outgoing_threshold = 4; - * @return {number} - */ -proto.looprpc.LiquidityRule.prototype.getOutgoingThreshold = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.LiquidityRule} returns this - */ -proto.looprpc.LiquidityRule.prototype.setOutgoingThreshold = function(value) { - return jspb.Message.setProto3IntField(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.SetLiquidityParamsRequest.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.SetLiquidityParamsRequest.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.SetLiquidityParamsRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.SetLiquidityParamsRequest.toObject = function(includeInstance, msg) { - var f, obj = { - parameters: (f = msg.getParameters()) && proto.looprpc.LiquidityParameters.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.SetLiquidityParamsRequest} - */ -proto.looprpc.SetLiquidityParamsRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - 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.SetLiquidityParamsRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.SetLiquidityParamsRequest} - */ -proto.looprpc.SetLiquidityParamsRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.looprpc.LiquidityParameters; - reader.readMessage(value,proto.looprpc.LiquidityParameters.deserializeBinaryFromReader); - msg.setParameters(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.looprpc.SetLiquidityParamsRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.SetLiquidityParamsRequest.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.SetLiquidityParamsRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.SetLiquidityParamsRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getParameters(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.looprpc.LiquidityParameters.serializeBinaryToWriter - ); - } -}; - - -/** - * optional LiquidityParameters parameters = 1; - * @return {?proto.looprpc.LiquidityParameters} - */ -proto.looprpc.SetLiquidityParamsRequest.prototype.getParameters = function() { - return /** @type{?proto.looprpc.LiquidityParameters} */ ( - jspb.Message.getWrapperField(this, proto.looprpc.LiquidityParameters, 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); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.looprpc.SetLiquidityParamsRequest} returns this - */ -proto.looprpc.SetLiquidityParamsRequest.prototype.clearParameters = function() { - return this.setParameters(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.looprpc.SetLiquidityParamsRequest.prototype.hasParameters = 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.SetLiquidityParamsResponse.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.SetLiquidityParamsResponse.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.SetLiquidityParamsResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.SetLiquidityParamsResponse.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.SetLiquidityParamsResponse} - */ -proto.looprpc.SetLiquidityParamsResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - 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.SetLiquidityParamsResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.SetLiquidityParamsResponse} - */ -proto.looprpc.SetLiquidityParamsResponse.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.SetLiquidityParamsResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.SetLiquidityParamsResponse.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.SetLiquidityParamsResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.SetLiquidityParamsResponse.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.SuggestSwapsRequest.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.SuggestSwapsRequest.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.SuggestSwapsRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.SuggestSwapsRequest.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.SuggestSwapsRequest} - */ -proto.looprpc.SuggestSwapsRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - 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.SuggestSwapsRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.SuggestSwapsRequest} - */ -proto.looprpc.SuggestSwapsRequest.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.SuggestSwapsRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.SuggestSwapsRequest.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.SuggestSwapsRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.SuggestSwapsRequest.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.Disqualified.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.Disqualified.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.Disqualified} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.Disqualified.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) - }; - - 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.Disqualified} - */ -proto.looprpc.Disqualified.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - 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.Disqualified} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.Disqualified} - */ -proto.looprpc.Disqualified.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readUint64()); - 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(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.looprpc.Disqualified.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.Disqualified.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.Disqualified} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.Disqualified.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getChannelId(); - if (f !== 0) { - writer.writeUint64( - 1, - f - ); - } - f = message.getPubkey_asU8(); - if (f.length > 0) { - writer.writeBytes( - 3, - f - ); - } - f = message.getReason(); - if (f !== 0.0) { - writer.writeEnum( - 2, - f - ); - } -}; - - -/** - * optional uint64 channel_id = 1; - * @return {number} - */ -proto.looprpc.Disqualified.prototype.getChannelId = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.Disqualified} returns this - */ -proto.looprpc.Disqualified.prototype.setChannelId = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional bytes pubkey = 3; - * @return {!(string|Uint8Array)} - */ -proto.looprpc.Disqualified.prototype.getPubkey = function() { - return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); -}; - - -/** - * optional bytes pubkey = 3; - * This is a type-conversion wrapper around `getPubkey()` - * @return {string} - */ -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) { -/** - * 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.SuggestSwapsResponse.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.SuggestSwapsResponse.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.SuggestSwapsResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.SuggestSwapsResponse.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) - }; - - 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.SuggestSwapsResponse} - */ -proto.looprpc.SuggestSwapsResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - 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.SuggestSwapsResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.SuggestSwapsResponse} - */ -proto.looprpc.SuggestSwapsResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.looprpc.LoopOutRequest; - reader.readMessage(value,proto.looprpc.LoopOutRequest.deserializeBinaryFromReader); - msg.addLoopOut(value); - break; - case 3: - var value = new proto.looprpc.LoopInRequest; - reader.readMessage(value,proto.looprpc.LoopInRequest.deserializeBinaryFromReader); - msg.addLoopIn(value); - break; - case 2: - var value = new proto.looprpc.Disqualified; - reader.readMessage(value,proto.looprpc.Disqualified.deserializeBinaryFromReader); - msg.addDisqualified(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.looprpc.SuggestSwapsResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.SuggestSwapsResponse.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.SuggestSwapsResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.SuggestSwapsResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getLoopOutList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 1, - f, - proto.looprpc.LoopOutRequest.serializeBinaryToWriter - ); - } - f = message.getLoopInList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 3, - f, - proto.looprpc.LoopInRequest.serializeBinaryToWriter - ); - } - f = message.getDisqualifiedList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 2, - f, - proto.looprpc.Disqualified.serializeBinaryToWriter - ); - } -}; - - -/** - * repeated LoopOutRequest loop_out = 1; - * @return {!Array} - */ -proto.looprpc.SuggestSwapsResponse.prototype.getLoopOutList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.looprpc.LoopOutRequest, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.looprpc.SuggestSwapsResponse} returns this -*/ -proto.looprpc.SuggestSwapsResponse.prototype.setLoopOutList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - - -/** - * @param {!proto.looprpc.LoopOutRequest=} opt_value - * @param {number=} opt_index - * @return {!proto.looprpc.LoopOutRequest} - */ -proto.looprpc.SuggestSwapsResponse.prototype.addLoopOut = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.looprpc.LoopOutRequest, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.looprpc.SuggestSwapsResponse} returns this - */ -proto.looprpc.SuggestSwapsResponse.prototype.clearLoopOutList = function() { - return this.setLoopOutList([]); -}; - - -/** - * repeated LoopInRequest loop_in = 3; - * @return {!Array} - */ -proto.looprpc.SuggestSwapsResponse.prototype.getLoopInList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.looprpc.LoopInRequest, 3)); -}; - - -/** - * @param {!Array} value - * @return {!proto.looprpc.SuggestSwapsResponse} returns this -*/ -proto.looprpc.SuggestSwapsResponse.prototype.setLoopInList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 3, value); -}; - - -/** - * @param {!proto.looprpc.LoopInRequest=} opt_value - * @param {number=} opt_index - * @return {!proto.looprpc.LoopInRequest} - */ -proto.looprpc.SuggestSwapsResponse.prototype.addLoopIn = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.looprpc.LoopInRequest, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.looprpc.SuggestSwapsResponse} returns this - */ -proto.looprpc.SuggestSwapsResponse.prototype.clearLoopInList = function() { - return this.setLoopInList([]); -}; - - -/** - * repeated Disqualified disqualified = 2; - * @return {!Array} - */ -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); -}; - - -/** - * @param {!proto.looprpc.Disqualified=} opt_value - * @param {number=} opt_index - * @return {!proto.looprpc.Disqualified} - */ -proto.looprpc.SuggestSwapsResponse.prototype.addDisqualified = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.looprpc.Disqualified, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.looprpc.SuggestSwapsResponse} returns this - */ -proto.looprpc.SuggestSwapsResponse.prototype.clearDisqualifiedList = function() { - return this.setDisqualifiedList([]); -}; - - -/** - * @enum {number} - */ -proto.looprpc.SwapType = { - LOOP_OUT: 0, - LOOP_IN: 1 -}; - -/** - * @enum {number} - */ -proto.looprpc.SwapState = { - INITIATED: 0, - PREIMAGE_REVEALED: 1, - HTLC_PUBLISHED: 2, - SUCCESS: 3, - FAILED: 4, - INVOICE_SETTLED: 5 -}; - -/** - * @enum {number} - */ -proto.looprpc.FailureReason = { - FAILURE_REASON_NONE: 0, - FAILURE_REASON_OFFCHAIN: 1, - FAILURE_REASON_TIMEOUT: 2, - FAILURE_REASON_SWEEP_TIMEOUT: 3, - FAILURE_REASON_INSUFFICIENT_VALUE: 4, - FAILURE_REASON_TEMPORARY: 5, - FAILURE_REASON_INCORRECT_AMOUNT: 6 -}; - -/** - * @enum {number} - */ -proto.looprpc.LiquidityRuleType = { - UNKNOWN: 0, - THRESHOLD: 1 -}; - -/** - * @enum {number} - */ -proto.looprpc.AutoReason = { - AUTO_REASON_UNKNOWN: 0, - AUTO_REASON_BUDGET_NOT_STARTED: 1, - AUTO_REASON_SWEEP_FEES: 2, - AUTO_REASON_BUDGET_ELAPSED: 3, - AUTO_REASON_IN_FLIGHT: 4, - AUTO_REASON_SWAP_FEE: 5, - AUTO_REASON_MINER_FEE: 6, - AUTO_REASON_PREPAY: 7, - AUTO_REASON_FAILURE_BACKOFF: 8, - AUTO_REASON_LOOP_OUT: 9, - AUTO_REASON_LOOP_IN: 10, - AUTO_REASON_LIQUIDITY_OK: 11, - AUTO_REASON_BUDGET_INSUFFICIENT: 12, - AUTO_REASON_FEE_INSUFFICIENT: 13 -}; - -goog.object.extend(exports, proto.looprpc); diff --git a/core/api/src/services/loopd/protos/swapserverrpc/common.proto b/core/api/src/services/loopd/protos/swapserverrpc/common.proto deleted file mode 100644 index 5ea79ecedb..0000000000 --- a/core/api/src/services/loopd/protos/swapserverrpc/common.proto +++ /dev/null @@ -1,37 +0,0 @@ -syntax = "proto3"; - -// We can't change this to swapserverrpc, it would be a breaking change because -// the package name is also contained in the HTTP URIs and old clients would -// call the wrong endpoints. Luckily with the go_package option we can have -// different golang and RPC package names to fix protobuf namespace conflicts. -package looprpc; - -option go_package = "github.com/lightninglabs/loop/swapserverrpc"; - -message HopHint { - // The public key of the node at the start of the channel. - string node_id = 1; - - // The unique identifier of the channel. - uint64 chan_id = 2; - - // The base fee of the channel denominated in millisatoshis. - uint32 fee_base_msat = 3; - - /* - The fee rate of the channel for sending one satoshi across it denominated in - millionths of a satoshi. - */ - uint32 fee_proportional_millionths = 4; - - // The time-lock delta of the channel. - uint32 cltv_expiry_delta = 5; -} - -message RouteHint { - /* - A list of hop hints that when chained together can assist in reaching a - specific destination. - */ - repeated HopHint hop_hints = 1; -} diff --git a/core/api/src/services/loopd/protos/swapserverrpc/common_grpc_pb.js b/core/api/src/services/loopd/protos/swapserverrpc/common_grpc_pb.js deleted file mode 100644 index 51b4d69593..0000000000 --- a/core/api/src/services/loopd/protos/swapserverrpc/common_grpc_pb.js +++ /dev/null @@ -1 +0,0 @@ -// GENERATED CODE -- NO SERVICES IN PROTO diff --git a/core/api/src/services/loopd/protos/swapserverrpc/common_pb.d.ts b/core/api/src/services/loopd/protos/swapserverrpc/common_pb.d.ts deleted file mode 100644 index d09cb56dd8..0000000000 --- a/core/api/src/services/loopd/protos/swapserverrpc/common_pb.d.ts +++ /dev/null @@ -1,63 +0,0 @@ -// package: looprpc -// file: swapserverrpc/common.proto - -import * as jspb from "google-protobuf"; - -export class HopHint extends jspb.Message { - getNodeId(): string; - setNodeId(value: string): void; - - getChanId(): number; - setChanId(value: number): void; - - getFeeBaseMsat(): number; - setFeeBaseMsat(value: number): void; - - getFeeProportionalMillionths(): number; - setFeeProportionalMillionths(value: number): void; - - getCltvExpiryDelta(): number; - setCltvExpiryDelta(value: number): void; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): HopHint.AsObject; - static toObject(includeInstance: boolean, msg: HopHint): HopHint.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: HopHint, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): HopHint; - static deserializeBinaryFromReader(message: HopHint, reader: jspb.BinaryReader): HopHint; -} - -export namespace HopHint { - export type AsObject = { - nodeId: string, - chanId: number, - feeBaseMsat: number, - feeProportionalMillionths: number, - cltvExpiryDelta: number, - } -} - -export class RouteHint extends jspb.Message { - clearHopHintsList(): void; - getHopHintsList(): Array; - setHopHintsList(value: Array): void; - addHopHints(value?: HopHint, index?: number): HopHint; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): RouteHint.AsObject; - static toObject(includeInstance: boolean, msg: RouteHint): RouteHint.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: RouteHint, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): RouteHint; - static deserializeBinaryFromReader(message: RouteHint, reader: jspb.BinaryReader): RouteHint; -} - -export namespace RouteHint { - export type AsObject = { - hopHintsList: Array, - } -} - diff --git a/core/api/src/services/loopd/protos/swapserverrpc/common_pb.js b/core/api/src/services/loopd/protos/swapserverrpc/common_pb.js deleted file mode 100644 index 10181f5b1d..0000000000 --- a/core/api/src/services/loopd/protos/swapserverrpc/common_pb.js +++ /dev/null @@ -1,478 +0,0 @@ -// source: swapserverrpc/common.proto -/** - * @fileoverview - * @enhanceable - * @suppress {missingRequire} reports error on implicit type usages. - * @suppress {messageConventions} JS Compiler reports an error if a variable or - * field starts with 'MSG_' and isn't a translatable message. - * @public - */ -// GENERATED CODE -- DO NOT EDIT! -/* eslint-disable */ -// @ts-nocheck - -var jspb = require('google-protobuf'); -var goog = jspb; -var global = (function() { - if (this) { return this; } - if (typeof window !== 'undefined') { return window; } - if (typeof global !== 'undefined') { return global; } - if (typeof self !== 'undefined') { return self; } - return Function('return this')(); -}.call(null)); - -goog.exportSymbol('proto.looprpc.HopHint', null, global); -goog.exportSymbol('proto.looprpc.RouteHint', null, global); -/** - * 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.HopHint = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.looprpc.HopHint, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.HopHint.displayName = 'proto.looprpc.HopHint'; -} -/** - * 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.RouteHint = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.looprpc.RouteHint.repeatedFields_, null); -}; -goog.inherits(proto.looprpc.RouteHint, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.looprpc.RouteHint.displayName = 'proto.looprpc.RouteHint'; -} - - - -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.HopHint.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.HopHint.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.HopHint} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.HopHint.toObject = function(includeInstance, msg) { - var f, obj = { - nodeId: jspb.Message.getFieldWithDefault(msg, 1, ""), - chanId: jspb.Message.getFieldWithDefault(msg, 2, 0), - feeBaseMsat: jspb.Message.getFieldWithDefault(msg, 3, 0), - feeProportionalMillionths: jspb.Message.getFieldWithDefault(msg, 4, 0), - cltvExpiryDelta: jspb.Message.getFieldWithDefault(msg, 5, 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.HopHint} - */ -proto.looprpc.HopHint.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.HopHint; - return proto.looprpc.HopHint.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.looprpc.HopHint} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.HopHint} - */ -proto.looprpc.HopHint.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.setNodeId(value); - break; - case 2: - var value = /** @type {number} */ (reader.readUint64()); - msg.setChanId(value); - break; - case 3: - var value = /** @type {number} */ (reader.readUint32()); - msg.setFeeBaseMsat(value); - break; - case 4: - var value = /** @type {number} */ (reader.readUint32()); - msg.setFeeProportionalMillionths(value); - break; - case 5: - var value = /** @type {number} */ (reader.readUint32()); - msg.setCltvExpiryDelta(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.looprpc.HopHint.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.HopHint.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.HopHint} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.HopHint.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getNodeId(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } - f = message.getChanId(); - if (f !== 0) { - writer.writeUint64( - 2, - f - ); - } - f = message.getFeeBaseMsat(); - if (f !== 0) { - writer.writeUint32( - 3, - f - ); - } - f = message.getFeeProportionalMillionths(); - if (f !== 0) { - writer.writeUint32( - 4, - f - ); - } - f = message.getCltvExpiryDelta(); - if (f !== 0) { - writer.writeUint32( - 5, - f - ); - } -}; - - -/** - * optional string node_id = 1; - * @return {string} - */ -proto.looprpc.HopHint.prototype.getNodeId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.looprpc.HopHint} returns this - */ -proto.looprpc.HopHint.prototype.setNodeId = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional uint64 chan_id = 2; - * @return {number} - */ -proto.looprpc.HopHint.prototype.getChanId = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.HopHint} returns this - */ -proto.looprpc.HopHint.prototype.setChanId = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); -}; - - -/** - * optional uint32 fee_base_msat = 3; - * @return {number} - */ -proto.looprpc.HopHint.prototype.getFeeBaseMsat = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.HopHint} returns this - */ -proto.looprpc.HopHint.prototype.setFeeBaseMsat = function(value) { - return jspb.Message.setProto3IntField(this, 3, value); -}; - - -/** - * optional uint32 fee_proportional_millionths = 4; - * @return {number} - */ -proto.looprpc.HopHint.prototype.getFeeProportionalMillionths = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.HopHint} returns this - */ -proto.looprpc.HopHint.prototype.setFeeProportionalMillionths = function(value) { - return jspb.Message.setProto3IntField(this, 4, value); -}; - - -/** - * optional uint32 cltv_expiry_delta = 5; - * @return {number} - */ -proto.looprpc.HopHint.prototype.getCltvExpiryDelta = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.looprpc.HopHint} returns this - */ -proto.looprpc.HopHint.prototype.setCltvExpiryDelta = function(value) { - return jspb.Message.setProto3IntField(this, 5, value); -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.looprpc.RouteHint.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.RouteHint.prototype.toObject = function(opt_includeInstance) { - return proto.looprpc.RouteHint.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.RouteHint} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.RouteHint.toObject = function(includeInstance, msg) { - var f, obj = { - hopHintsList: jspb.Message.toObjectList(msg.getHopHintsList(), - proto.looprpc.HopHint.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.RouteHint} - */ -proto.looprpc.RouteHint.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.looprpc.RouteHint; - return proto.looprpc.RouteHint.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.looprpc.RouteHint} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.looprpc.RouteHint} - */ -proto.looprpc.RouteHint.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.looprpc.HopHint; - reader.readMessage(value,proto.looprpc.HopHint.deserializeBinaryFromReader); - msg.addHopHints(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.looprpc.RouteHint.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.looprpc.RouteHint.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.RouteHint} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.looprpc.RouteHint.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getHopHintsList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 1, - f, - proto.looprpc.HopHint.serializeBinaryToWriter - ); - } -}; - - -/** - * repeated HopHint hop_hints = 1; - * @return {!Array} - */ -proto.looprpc.RouteHint.prototype.getHopHintsList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.looprpc.HopHint, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.looprpc.RouteHint} returns this -*/ -proto.looprpc.RouteHint.prototype.setHopHintsList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - - -/** - * @param {!proto.looprpc.HopHint=} opt_value - * @param {number=} opt_index - * @return {!proto.looprpc.HopHint} - */ -proto.looprpc.RouteHint.prototype.addHopHints = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.looprpc.HopHint, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.looprpc.RouteHint} returns this - */ -proto.looprpc.RouteHint.prototype.clearHopHintsList = function() { - return this.setHopHintsList([]); -}; - - -goog.object.extend(exports, proto.looprpc); diff --git a/core/api/test/legacy-integration/app/swap/swap-listener.spec.ts b/core/api/test/legacy-integration/app/swap/swap-listener.spec.ts deleted file mode 100644 index 1d6c35c3ff..0000000000 --- a/core/api/test/legacy-integration/app/swap/swap-listener.spec.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* eslint-disable jest/no-conditional-expect */ -import { handleSwapOutCompleted } from "@/app/swap" -import { lnd1LoopConfig } from "@/app/swap/get-active-loopd" -import { WalletCurrency } from "@/domain/shared" -import { LoopService } from "@/services/loopd" -import { sleep } from "@/utils" - -import { mineBlockAndSyncAll } from "test/helpers" - -describe("Swap", () => { - it("Initiate Swap out, then listen for events", async () => { - const amount = { amount: BigInt(250000), currency: WalletCurrency.Btc } - const swapService = LoopService(lnd1LoopConfig()) - const isSwapServerUp = await swapService.healthCheck() - if (isSwapServerUp) { - await new Promise(async (resolve) => { - // 1) Start Swap Listener - const listener = swapService.swapListener() - listener.on("data", async (response) => { - await handleSwapOutCompleted(response) - expect(response).toBeDefined() - resolve(true) - }) - // 2) Trigger Swap Out - await swapService.swapOut({ amount }) - await sleep(1000) - // 3) Mine blocks and wait a few seconds between rounds - await mineBlockAndSyncAll() - await sleep(1000) - await mineBlockAndSyncAll() - await sleep(1000) - await mineBlockAndSyncAll() - // 4) The swap out should have been picked up by the listener by now - // and triggered the handleSwapOutCompleted above - // 5) Cancel the listener - listener.cancel() - expect.assertions(1) - resolve(true) - }) - } else { - const msg = "Swap Server not running...skipping" - expect(msg).toEqual(msg) - } - }) -}) diff --git a/core/api/test/legacy-integration/app/swap/swap-out.spec.ts b/core/api/test/legacy-integration/app/swap/swap-out.spec.ts deleted file mode 100644 index 8351e43469..0000000000 --- a/core/api/test/legacy-integration/app/swap/swap-out.spec.ts +++ /dev/null @@ -1,165 +0,0 @@ -/* eslint-disable jest/no-conditional-expect */ -import { swapOut } from "@/app/swap" -import { - getActiveLoopd, - lnd1LoopConfig, - lnd2LoopConfig, -} from "@/app/swap/get-active-loopd" -import { OnChainService } from "@/services/bria" - -import { - SwapClientNotResponding, - SwapErrorChannelBalanceTooLow, -} from "@/domain/swap/errors" -import { SwapOutChecker } from "@/domain/swap" -import { WalletCurrency, ZERO_SATS } from "@/domain/shared" - -import { baseLogger } from "@/services/logger" -import { LoopService } from "@/services/loopd" -import { lndsBalances } from "@/services/lnd/utils" - -describe("Swap", () => { - const activeLoopd = getActiveLoopd() - const swapService = LoopService(activeLoopd ?? lnd1LoopConfig()) - const amount: BtcPaymentAmount = { amount: 250000n, currency: WalletCurrency.Btc } - - it("Swap out app returns a SwapOutResult or NoSwapAction", async () => { - const isSwapServerUp = await swapService.healthCheck() - if (isSwapServerUp) { - const swapResult = await swapOut() - if (swapResult instanceof Error) throw swapResult - expect(swapResult).not.toBeInstanceOf(Error) - if (swapResult.noOp) { - expect(swapResult.noOp).toBe(true) - } else { - expect(swapResult).toEqual( - expect.objectContaining({ - swapId: expect.any(String), - }), - ) - } - } - }) - - it("Swap out for default active loop node or lnd1-loop node returns successful swap result", async () => { - const isSwapServerUp = await swapService.healthCheck() - if (isSwapServerUp) { - const swapDestAddress = await OnChainService().getAddressForSwap() - if (swapDestAddress instanceof Error) return swapDestAddress - const swapResult = await swapService.swapOut({ amount, swapDestAddress }) - if (swapResult instanceof SwapClientNotResponding) { - baseLogger.info("Swap Client is not running, skipping") - return - } - if (swapResult instanceof Error) throw swapResult - expect(swapResult).not.toBeInstanceOf(Error) - expect(swapResult).toEqual( - expect.objectContaining({ - swapId: expect.any(String), - }), - ) - } - }) - - it("Swap out for lnd2-loop node returns successful swap result or error if not enough funds", async () => { - const isSwapServerUp = await swapService.healthCheck() - if (isSwapServerUp) { - const loopService = LoopService(lnd2LoopConfig()) - const swapServiceLnd2 = loopService - const isSwapServerUp2 = await swapServiceLnd2.healthCheck() - if (isSwapServerUp2) { - const swapDestAddress = await OnChainService().getAddressForSwap() - if (swapDestAddress instanceof Error) return swapDestAddress - // this might fail in not enough funds in LND2 in regtest - const swapResult = await swapServiceLnd2.swapOut({ amount, swapDestAddress }) - if (swapResult instanceof SwapClientNotResponding) { - baseLogger.info("Swap Client is not running, skipping") - return - } - if (swapResult instanceof Error) { - if (swapResult instanceof SwapErrorChannelBalanceTooLow) { - expect(swapResult).toBeInstanceOf(SwapErrorChannelBalanceTooLow) - } else { - expect(swapResult).not.toBeInstanceOf(Error) - } - } else { - expect(swapResult).toEqual( - expect.objectContaining({ - swapId: expect.any(String), - }), - ) - } - } - } - }) - - it("Swap out without enough funds returns an error", async () => { - const isSwapServerUp = await swapService.healthCheck() - if (isSwapServerUp) { - const btc = { amount: 5_000_000_000n, currency: WalletCurrency.Btc } - const swapResult = await swapService.swapOut({ amount: btc }) - if (swapResult instanceof SwapClientNotResponding) { - return - } - expect(swapResult).toBeInstanceOf(Error) - } - }) - - it("Swap out if on chain wallet is depleted returns a swap result", async () => { - const isSwapServerUp = await swapService.healthCheck() - if (isSwapServerUp) { - // thresholds - const { onChain } = await lndsBalances() - const loopOutWhenHotWalletLessThanConfig = { - amount: BigInt(onChain + 50000), - currency: WalletCurrency.Btc, - } - - // check if wallet is depleted - const swapOutChecker = SwapOutChecker({ - loopOutWhenHotWalletLessThanConfig, - swapOutAmount: amount, - }) - const amountToSwapOut = swapOutChecker.getSwapOutAmount({ - currentOnChainHotWalletBalance: ZERO_SATS, - currentOutboundLiquidityBalance: ZERO_SATS, - }) - if (amountToSwapOut.amount > 0) { - const swapResult = await swapService.swapOut({ amount: amountToSwapOut }) - if (swapResult instanceof SwapClientNotResponding) { - return - } - - expect(swapResult).not.toBeInstanceOf(Error) - expect(swapResult).toEqual( - expect.objectContaining({ - swapId: expect.any(String), - }), - ) - } else { - expect("No swap Needed").toEqual("No swap Needed") - } - } - }) - - it("Swap out quote return quote result", async () => { - const isSwapServerUp = await swapService.healthCheck() - if (isSwapServerUp) { - const btc: BtcPaymentAmount = { amount: 250000n, currency: WalletCurrency.Btc } - const quoteResult = await swapService.swapOutQuote(btc) - if (quoteResult instanceof Error) throw quoteResult - expect(quoteResult).not.toBeInstanceOf(Error) - expect(quoteResult.swapFeeSat).toBeDefined() - } - }) - - it("Swap out terms return terms result", async () => { - const isSwapServerUp = await swapService.healthCheck() - if (isSwapServerUp) { - const termsResult = await swapService.swapOutTerms() - if (termsResult instanceof Error) throw termsResult - expect(termsResult).not.toBeInstanceOf(Error) - expect(termsResult.maxSwapAmount).toBeDefined() - } - }) -}) diff --git a/core/api/test/legacy-integration/app/swap/swap-record-ledger-fee.spec.ts b/core/api/test/legacy-integration/app/swap/swap-record-ledger-fee.spec.ts deleted file mode 100644 index 5960af734b..0000000000 --- a/core/api/test/legacy-integration/app/swap/swap-record-ledger-fee.spec.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { DuplicateError } from "@/domain/errors" -import { SwapState, SwapType } from "@/domain/swap" -import { admin as LedgerAdmin } from "@/services/ledger/admin" -import { createMandatoryUsers } from "test/helpers" - -beforeAll(async () => { - await createMandatoryUsers() -}) - -describe("Swap Record ledger Fee", () => { - let entryId: LedgerTransactionId[] = [] - const swapId = `test-swapid-${Date.now()}` as SwapId - const mockSwapData: SwapStatusResult = { - id: swapId, - amt: 5000000n, - htlcAddress: `test-htlc-addr-${Date.now()}` as OnChainAddress, - onchainMinerFee: 50n, - offchainRoutingFee: 50n, - serviceProviderFee: 50n, - message: "", - state: SwapState.Success, - swapType: SwapType.Swapout, - } - - it("Record fee to ledger", async () => { - const entry = await LedgerAdmin.addSwapFeeTxSend(mockSwapData) - if (entry instanceof Error) throw entry - expect(entry).not.toBeInstanceOf(Error) - entryId = (entry as LedgerJournal).transactionIds - expect(entryId[0]).toBeDefined() - }) - - it("Do not record duplicate fee to ledger", async () => { - const entry = await LedgerAdmin.addSwapFeeTxSend(mockSwapData) - expect(entry).toBeInstanceOf(DuplicateError) - }) -}) diff --git a/core/api/test/unit/config.spec.ts b/core/api/test/unit/config.spec.ts index 68ff374eba..ca4ce595ea 100644 --- a/core/api/test/unit/config.spec.ts +++ b/core/api/test/unit/config.spec.ts @@ -108,8 +108,8 @@ describe("config.ts", () => { it("fails validation missing conditional required", () => { const clonedConfig = JSON.parse(JSON.stringify(yamlConfig)) - clonedConfig.cronConfig.swapEnabled = true - delete clonedConfig.cronConfig.swapEnabled + clonedConfig.cronConfig.rebalanceEnabled = true + delete clonedConfig.cronConfig.rebalanceEnabled // @ts-ignore-next-line no-implicit-any error const valid = validate(clonedConfig) diff --git a/core/api/test/unit/domain/swap/swap-out-checker.spec.ts b/core/api/test/unit/domain/swap/swap-out-checker.spec.ts deleted file mode 100644 index 438fa7fa6f..0000000000 --- a/core/api/test/unit/domain/swap/swap-out-checker.spec.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { WalletCurrency, ZERO_SATS } from "@/domain/shared" -import { SwapOutChecker } from "@/domain/swap" - -describe("SwapOutChecker", () => { - it("returns the amount that should be swapped", () => { - const checker = SwapOutChecker({ - loopOutWhenHotWalletLessThanConfig: { - amount: BigInt(50000), - currency: WalletCurrency.Btc, - }, - swapOutAmount: { - amount: BigInt(250000), - currency: WalletCurrency.Btc, - }, - }) - expect( - checker.getSwapOutAmount({ - currentOnChainHotWalletBalance: { - amount: BigInt(40000), - currency: WalletCurrency.Btc, - }, - currentOutboundLiquidityBalance: { - amount: BigInt(300000), - currency: WalletCurrency.Btc, - }, - }), - ).toEqual({ amount: BigInt(250000), currency: WalletCurrency.Btc }) - }) - - it("returns 0 amount when we don't need a swap out", () => { - const checker = SwapOutChecker({ - loopOutWhenHotWalletLessThanConfig: { - amount: BigInt(50000), - currency: WalletCurrency.Btc, - }, - swapOutAmount: { - amount: BigInt(250000), - currency: WalletCurrency.Btc, - }, - }) - expect( - checker.getSwapOutAmount({ - currentOnChainHotWalletBalance: { - amount: BigInt(100000), - currency: WalletCurrency.Btc, - }, - currentOutboundLiquidityBalance: { - amount: BigInt(300000), - currency: WalletCurrency.Btc, - }, - }), - ).toEqual(ZERO_SATS) - }) - - it("returns 0 amount when we don't have enough outbound liquidity to perform a swap out", () => { - const checker = SwapOutChecker({ - loopOutWhenHotWalletLessThanConfig: { - amount: BigInt(50000), - currency: WalletCurrency.Btc, - }, - swapOutAmount: { - amount: BigInt(250000), - currency: WalletCurrency.Btc, - }, - }) - expect( - checker.getSwapOutAmount({ - currentOnChainHotWalletBalance: { - amount: BigInt(10000), - currency: WalletCurrency.Btc, - }, - currentOutboundLiquidityBalance: { - amount: BigInt(500), - currency: WalletCurrency.Btc, - }, - }), - ).toEqual(ZERO_SATS) - }) -}) diff --git a/docs/swap.md b/docs/swap.md deleted file mode 100644 index 7d0ac0fe31..0000000000 --- a/docs/swap.md +++ /dev/null @@ -1,181 +0,0 @@ -Swap Service (regtest) -======================= - -This docs shows you how to get the swap service up and running in your local dev environment. - -The high level steps are: - -1. Start the loop server -2. Configure the swap params in default.yaml -3. Choose the swap provider in your code -4. Test a swap out -5. Monitor the status of a swap - -Quickstart ----------- -``` -# 1. Start loop server -make start-loopd -# 2. Monitor loop outs -loopd1_id=$(docker ps -q -f name="loopd1-1") -docker exec -it $loopd1_id loop -n regtest monitor -# 3. Loop out -TEST="swap-out" make integration -# 4. Mine a block (or a few) to finish the loop out -make mine-block -make mine-block -``` - -(1) Start the loopserver (regtest LL loop server) and loopd (Rest API) ---------------------------------------- -```sh -make start-loopd -``` - -Successfully starting the loop server returns this: -```json -{ - "swap_fee_sat":"50", - "prepay_amt_sat":"1337", - "htlc_sweep_fee_sat":"7262", - "swap_payment_dest":"A31dVAIzvYn1p/0J7WG3DS7Qbq5FIzWhPgtHQngozskq", - "cltv_delta":0, - "conf_target":9 -} -``` - -(2) Configure the loop params in `default.yaml` ---------------------------------------- - -```yaml -swap: - loopOutWhenHotWalletLessThan: 75000000 - swapOutAmount: 50000000 - swapProviders: ["Loop"] - lnd1loopRestEndpoint: "https://localhost:8081" - lnd1loopRpcEndpoint: "localhost:11010" - lnd2loopRestEndpoint: "https://localhost:8082" - lnd2loopRpcEndpoint: "localhost:11011" - feeAccountingEnabled: true -``` - -When testing in dev you want to override this config by creating a `/var/yaml/custom.yaml` file - -create `/var/yaml/custom.yaml` and set permissions: -``` -sudo touch /var/yaml/custom.yaml -sudo chmod 755 /var/yaml/custom.yaml -``` - -Add the following config (you might need to 'retry as sudo' on mac+vscode): -``` -swap: - loopOutWhenHotWalletLessThan: 300000 - swapOutAmount: 250000 - swapProviders: ["Loop"] - lnd1loopRestEndpoint: "https://localhost:8081" - lnd1loopRpcEndpoint: "localhost:11010" - lnd2loopRestEndpoint: "https://localhost:8082" - lnd2loopRpcEndpoint: "localhost:11011" - feeAccountingEnabled: true -``` - -(3) Choose the swap provider ---------------------------------------- - -By default we use the lightning-labs `loop` swap provider, but there is an `ISwapProvider` interface that third party contributors can code against. For example, you could create a PeerSwap swap provider by configuring the `swapProviders` parameter in the `default.yaml` file. Use the lightning-labs provider as an example here `src/services/loopd`. - -```typescript -import { LoopService } from "@services/loopd" -import { LND1_LOOP_CONFIG } from "./get-active-loopd" - -// do swap out -const loopService = LoopService(LND1_LOOP_CONFIG) -const loopResult = await loopService.swapOut({ amount: swapOutAmount }) -``` - -(4) Monitor Status of the swap ----------------------------- -The easiest way to monitor the status of a loop out in dev is to remote into loopd. -``` -# loop 1 -loopd1_id=$(docker ps -q -f name="loopd1-1") -docker exec -it $loopd1_id loop -n regtest monitor -# loop 2 -loopd2_id=$(docker ps -q -f name="loopd2-1") -docker exec -it $loopd2_id loop -n regtest monitor -``` -This command will keep an open listener for any loop events. - -Also, here is a REST call you can make to check the status of swaps -``` -LOOP_MACAROON=$(cat dev/lnd/loop.macaroon | xxd -p | awk '{print}' ORS='') -curl -k \ - --request GET \ - --url https://localhost:8081/v1/loop/swaps \ - --cert dev/lnd/tls.cert \ - --key dev/lnd/tls.key \ - --header 'Content-Type: application/json' \ - --header "Grpc-Metadata-macaroon: $LOOP_MACAROON" \ - --verbose \ - | yarn pino-pretty -c -l -``` - -(5) Test a Loop Out ---------------------------------------- -The easiest test to run to see if the swap service is up and working is `TEST="swap-out" make integration` - -But you can also run these tests: -```sh -TEST="swap-out-checker" make unit -TEST="swap-listener" make integration -TEST="swap-out" make integration -TEST="swap-record-ledger-fee" make integration -``` - -Event Listeners -============ -There is an event listener for swaps called `listenerSwapMonitor` in the `src/servers/trigger.ts` server. It listens for swap events, like "Swap Out Success" or failure. This listener triggers a `handleSwapOutCompleted` event in the `src/app/swap/swap-listener.ts` file. - -``` -make start-trigger -``` - -In dev, you can monitor the output of this listener in the console. You should see blocks being mined, as well as -successfully loop outs, preimage revealed messages, etc... - -Cron Job -===== -There is a cron job that checks if the onChain wallet is depleted. If it is depleted, it proceeds to do a `swap out` based on the swap config from the `default.yaml` file. - -To Enable - -default.yaml -``` -cronConfig: - swapEnabled: true -``` - -``` -make start-cron -``` - -Tracing -======= -In Honeycomb you can query for `code.namespace = services.swap` - -Generate GRPC Types -==================== -TODO automate via CI -``` -cd src/services/loopd/protos -buf generate -``` - -Troubleshooting -============= -If you get the error: -``` -Waiting for lnd to be fully synced to its chain backend, this might take a while -``` -Then the chain is not synced. Try running `make mine-block` diff --git a/typos.toml b/typos.toml index 428fa89fa4..8c15f3c783 100644 --- a/typos.toml +++ b/typos.toml @@ -2,7 +2,6 @@ files.extend-exclude = [ "dev", "core/api/dev", "core/api/src/domain/users/languages.ts", - "core/api/src/services/loopd/protos", "docs/postman-collection/galoy_graphql_main_api.postman_collection.json", "core/api/docker-compose.yml", "quickstart/*.yml",